ADM-dateTimePicker.scss

This SCSS file defines the styling for a custom date & time picker used in the LinuxFront V2 Logistics front-end. It leverages Compass mixins and a Ceaser easing library to deliver smooth animations, themeable colors, RTL support, and responsive interactions.

Imports & Theme Variables

🎨 The file begins by importing utilities and defining core color variables for consistent theming:

@import "compass/CSS3";
@import "ceaser-easing";

$green:       #56c489;
$warmBrown:   #e3d6a9;
$brown:       #7e4311;
$blue:        #3770d3;
$orange:      #fc5f2a;
$gray:        #797979;
$red:         #E64949;

$mainColor:   $orange;
$todayColor:  $warmBrown;
Variable Hex Value Usage
$mainColor #fc5f2a Primary highlights, hovers
$todayColor #e3d6a9 “Today” marker in calendar
$red #E64949 Remove icon background
$blue #3770d3 Close icon background

Font Definitions

The picker loads two web fonts for English/Latin and Persian:

@font-face {
  font-family: Sans;
  src: url('https://adm-co.net/fonts/IRSans.woff');
}
@font-face {
  font-family: Tikal;
  src: url('https://adm-co.net/fonts/Tikal.woff');
}

$FAfont: Sans;
$ENfont: Tikal;

Assigns $ENfont by default, and swaps to $FAfont in RTL mode.

Base Container

.ADMdtp-container

  • Font & Direction
    Uses $ENfont for LTR by default.
    Adds .rtf modifier for RTL, swapping fonts and calendar direction.
  • Structure
    .ADMdtp-container {
      font-family: $ENfont, sans-serif;
    
      &.rtf {
        font-family: $FAfont;
        .ADMdtp-calendar-container { direction: rtl; }
        .masterInput input         { direction: ltr; }
      }
      …
    }
    

.clickOutContainer

  • Ensures the calendar overlay can detect clicks outside to close itself.
  • Styles as position: relative; display: block;.

Master Input & Icon Controls

💻 Styles the text input and icon toggles for opening/closing and clearing:

.masterInput {
  input {
    @include transition(all .15s);
    &[disabled] { background: white; color: black; }
  }

  &.touch {
    > .removeIcon { /* always visible on touch */ }
    &.open { /* animate calendar ↔ close icons */ }
  }

  &:not(.touch) {
    > .removeIcon { display: none !important; }
    &:not(.disable) {
      .iconContainer:hover { /* slide calendar/remove icons */ }
    }
  }

  &.disable {
    input[disabled]   { background: darken(white,5%); color: lighten(black,50%); }
    > .removeIcon    { display: none !important; }
    .iconContainer   { cursor: not-allowed; }
  }

  .iconContainer {
    cursor: pointer; overflow: hidden; position: relative;
    .calendarIcon,
    .removeIcon,
    .closeIcon {
      @include transition(all .3s ceaser($easeInOutBack));
    }
    .removeIcon { background: $red;   color: white; @include translateY(-100%); }
    .closeIcon  { background: $blue;  color: white; @include translateY(100%); }
  }
}

Calendar Overlay

📅 Positions and styles the calendar panel:

.ADMdtp-calendar-container {
  position: absolute;
  width: 20em; max-width: 100vw;
  padding: 1em; padding-top: 0;
  background: white; border-radius: 5px;
  @include box-shadow(0 4px 8px rgba(0,0,0,.1));
  @include transition(opacity .5s);
  font-size: 14px;
}

It also neutralizes text selection (::-moz-selection, ::selection).

Header Navigation

  • .yearMonth: center-aligned month/year label.
  • Prev/Next Icons (.glyphicon-menu-left / .glyphicon-menu-right):
    • Absolute-positioned; hover nudges icon and darkens color.

Day Grid

Class Description
.daysNames Weekday headers; bold and colored $mainColor.
.days span Individual date cells; flex grid of 7 per row.
.disable Past/future dates out of range; 50% opacity.
.selected Currently selected date; filled $mainColor.
.valid Range highlight; uses lighten borders and corners.
.today “Today” marker with colored triangular corner.
&.loading Initial load animation flipping cells in.

Transitions stagger via an @for $i from 1 through 50 loop.

  • Today Button
    Centered button highlights current date on click.
  • Calendar Type Toggle 🔄
    Switches between Gregorian and Jalali displays:
    .calTypeContainer {
      /* two stacked <p> tags for each calendar type */
      &.gregorian p.jalali   { @include translateY(100%); }
      &.jalali    p.gregorian{ @include translateY(-100%); }
    }
    

Time Picker Overlay

⏱ Displays a sliding overlay with hour/minute selectors:

.timePickerContainer {
  position: absolute; width: 100%; height: 100%;
  background: rgba(#ccc,.5); direction: ltr;
  @include translateY(100%);
  @include transition(all .7s ceaser($easeInOutBack));

  &.active {
    background: rgba(#fff,.95);
    @include translateY(0);
    .timeSelectIcon { @include translate(0,0); }
  }

  .timeSelectIcon {
    font-size:1.5em; padding:.7em; color:$warmBrown;
    cursor:pointer; @include translate(0,-2.5em);
  }

  .timePicker {
    top:50%; @include translateY(-50%);
    span.glyphicon { cursor:pointer; color:$mainColor; }
    span.period      { font-size:2em; }
  }
}

Each up/down icon animates on hover and active states.

Design Highlights

  • Theming via SCSS variables for easy palette changes.
  • Responsive interactions: touch vs non-touch, disabled mode.
  • RTL support toggled by .rtf class.
  • Animated transitions using Compass and Ceaser easing.
  • Modular structure: chunked into input, calendar, footer, time.

Usage Example

<div class="ADMdtp-container">
  <div class="masterInput">
    <input type="text" placeholder="Select date/time">
    <div class="iconContainer">
      <span class="calendarIcon glyphicon glyphicon-calendar"></span>
      <span class="removeIcon glyphicon glyphicon-remove"></span>
      <span class="closeIcon glyphicon glyphicon-remove-circle"></span>
    </div>
  </div>
  
  <div class="ADMdtp-calendar-container">
    <!-- header, daysNames, days grid, footer -->
  </div>

  <div class="timePickerContainer">
    <span class="timeSelectIcon glyphicon glyphicon-time"></span>
    <div class="timePicker">
      <!-- hour/min controls -->
    </div>
  </div>
</div>

Ensure to include Compass and Ceaser easing in your build pipeline.