diff --git a/src/pages/components/date-picker/images/calendar-picker-min-max.png b/src/pages/components/date-picker/images/calendar-picker-min-max.png index a8eee855120..07d3c8a0dd9 100644 Binary files a/src/pages/components/date-picker/images/calendar-picker-min-max.png and b/src/pages/components/date-picker/images/calendar-picker-min-max.png differ diff --git a/src/pages/components/date-picker/images/date-format-placement.png b/src/pages/components/date-picker/images/date-format-placement.png index d336cbb8852..76b619c8d5b 100644 Binary files a/src/pages/components/date-picker/images/date-format-placement.png and b/src/pages/components/date-picker/images/date-format-placement.png differ diff --git a/src/pages/components/date-picker/images/date-picker-alignment-01.png b/src/pages/components/date-picker/images/date-picker-alignment-01.png index 3fa2002b596..de78209ae3f 100644 Binary files a/src/pages/components/date-picker/images/date-picker-alignment-01.png and b/src/pages/components/date-picker/images/date-picker-alignment-01.png differ diff --git a/src/pages/components/date-picker/images/date-picker-alignment-02.png b/src/pages/components/date-picker/images/date-picker-alignment-02.png index 4cf1070a99b..22cc713c79c 100644 Binary files a/src/pages/components/date-picker/images/date-picker-alignment-02.png and b/src/pages/components/date-picker/images/date-picker-alignment-02.png differ diff --git a/src/pages/components/date-picker/images/date-picker-anatomy.png b/src/pages/components/date-picker/images/date-picker-anatomy.png index 91780f19070..2d482488190 100644 Binary files a/src/pages/components/date-picker/images/date-picker-anatomy.png and b/src/pages/components/date-picker/images/date-picker-anatomy.png differ diff --git a/src/pages/components/date-picker/images/date-picker-style-1.png b/src/pages/components/date-picker/images/date-picker-style-1.png index cdafc01b114..8896c4da160 100644 Binary files a/src/pages/components/date-picker/images/date-picker-style-1.png and b/src/pages/components/date-picker/images/date-picker-style-1.png differ diff --git a/src/pages/components/date-picker/images/date-picker-style-4.png b/src/pages/components/date-picker/images/date-picker-style-4.png index d8ba5137cb6..a6f09ce6a3c 100644 Binary files a/src/pages/components/date-picker/images/date-picker-style-4.png and b/src/pages/components/date-picker/images/date-picker-style-4.png differ diff --git a/src/pages/components/date-picker/images/date-picker-style-6.png b/src/pages/components/date-picker/images/date-picker-style-6.png index 974040dc545..5a5e28aebff 100644 Binary files a/src/pages/components/date-picker/images/date-picker-style-6.png and b/src/pages/components/date-picker/images/date-picker-style-6.png differ diff --git a/src/pages/components/date-picker/images/date-picker-style-7.png b/src/pages/components/date-picker/images/date-picker-style-7.png new file mode 100644 index 00000000000..5aa3775bcd9 Binary files /dev/null and b/src/pages/components/date-picker/images/date-picker-style-7.png differ diff --git a/src/pages/components/date-picker/images/date-picker-style-size.png b/src/pages/components/date-picker/images/date-picker-style-size.png index c649ddb9a5d..d889b097e25 100644 Binary files a/src/pages/components/date-picker/images/date-picker-style-size.png and b/src/pages/components/date-picker/images/date-picker-style-size.png differ diff --git a/src/pages/components/date-picker/images/date-picker-validation.png b/src/pages/components/date-picker/images/date-picker-validation.png index cae66f97f3b..9d57a187d3b 100644 Binary files a/src/pages/components/date-picker/images/date-picker-validation.png and b/src/pages/components/date-picker/images/date-picker-validation.png differ diff --git a/src/pages/components/date-picker/images/range-date-picker.png b/src/pages/components/date-picker/images/range-date-picker.png index f34379ac019..ba84cf8f11b 100644 Binary files a/src/pages/components/date-picker/images/range-date-picker.png and b/src/pages/components/date-picker/images/range-date-picker.png differ diff --git a/src/pages/components/date-picker/images/simple-date-input-states.png b/src/pages/components/date-picker/images/simple-date-input-states.png index 9e346068f65..c6b3e9bc0ce 100644 Binary files a/src/pages/components/date-picker/images/simple-date-input-states.png and b/src/pages/components/date-picker/images/simple-date-input-states.png differ diff --git a/src/pages/components/date-picker/images/simple-date-picker.png b/src/pages/components/date-picker/images/simple-date-picker.png index 7a182a45062..bc641b6ee90 100644 Binary files a/src/pages/components/date-picker/images/simple-date-picker.png and b/src/pages/components/date-picker/images/simple-date-picker.png differ diff --git a/src/pages/components/date-picker/images/single-date-picker.png b/src/pages/components/date-picker/images/single-date-picker.png index c89153cdd14..4ebc2245ecb 100644 Binary files a/src/pages/components/date-picker/images/single-date-picker.png and b/src/pages/components/date-picker/images/single-date-picker.png differ diff --git a/src/pages/components/date-picker/style.mdx b/src/pages/components/date-picker/style.mdx index c8cefe73c4e..0ca9f029484 100644 --- a/src/pages/components/date-picker/style.mdx +++ b/src/pages/components/date-picker/style.mdx @@ -10,20 +10,29 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility'] ### Date input -| Element | Property | Color token | -| ------------------ | ---------------- | ------------------- | -| Label | text-color | `$text-secondary` | -| Field | background-color | `$field` \* | -| | border-bottom | `$border-strong` \* | -| Field text | text-color | `$text-primary` | -| Field text: prompt | text-color | `$text-helper` | -| Calendar icon | svg | `$icon-primary` | +| Element | Property | Color token | +| ---------------- | ---------------- | ------------------- | +| Label | text-color | `$text-secondary` | +| Field | background-color | `$field` \* | +| | border-bottom | `$border-strong` \* | +| Field text | text-color | `$text-primary` | +| Placeholder text | text-color | `$text-placeholder` | +| Helper text | text-color | `$text-helper` | +| Calendar icon | svg | `$icon-primary` | * Denotes a contextual color token that will change values based on the layer it is placed on. + + + +![Date picker input states](images/date-picker-style-7.png) + + + +
#### Interactive states @@ -45,7 +54,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility'] | | Calendar icon | svg | `$icon-disabled` | - + ![Date picker input states](images/date-picker-style-6.png) @@ -64,9 +73,9 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility'] | Day | text-color | `$text-primary` | | Day: hover | background-color | `$layer-hover` \* | | Day: focus | border | `$focus` | +| Day: disabled | text-color | `$text-disabled` | | Day: selected | text-color | `$text-on-color` | | | background-color | `$background-brand` | -| Day: disabled | text-color | `$text-disabled` | | Day: in range | text-color | `$text-primary` | | | background-color | `$highlight` | | Day: end range | text-color | `$text-primary` | @@ -96,11 +105,15 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility'] Labels should be set in sentence case, with only the first word in a phrase and any proper nouns capitalized, and no more than three words. -| Element | Font-size | Font-weight | Type token | -| ------------- | ---------- | ------------- | ----------- | -| Label | 12 / 0.75 | Regular / 400 | `$label-01` | -| Field text | 14 / 0.875 | Regular / 400 | `$code-02` | -| Error message | 12 / 0.75 | Regular / 400 | `$label-01` | +| Element | Font-size | Font-weight | Type token | +| --------------- | ---------- | -------------- | --------------------- | +| Label | 12 / 0.75 | Regular / 400 | `$label-01` | +| Field text | 14 / 0.875 | Regular / 400 | `$code-02` | +| Helper text | 12 / 0.75 | Regular / 400 | `$label-01` | +| Error message | 12 / 0.75 | Regular / 400 | `$label-01` | +| Warning message | 12 / 0.75 | Regular / 400 | `$label-01` | +| Month and year | 14 / 0.875 | SemiBold / 600 | `$heading-compact-01` | +| Day | 14 / 0.875 | Regular / 400 | `$body-compact-01` | ## Structure @@ -108,11 +121,14 @@ any proper nouns capitalized, and no more than three words. The widths of the date inputs may vary based on the grid and layout. -| Element | Property | px / rem | Spacing token | -| ------- | --------------------------- | -------- | ------------- | -| Label | padding-bottom | 8 / 0.5 | `$spacing-03` | -| Field | padding-left, padding-right | 16 / 1 | `$spacing-05` | -| | border-bottom | 1px | - | +| Element | Property | px / rem | Spacing token | +| ------------- | --------------------------- | -------- | ------------- | +| Label | margin-bottom | 8 / 0.5 | `$spacing-03` | +| Field | padding-left, padding-right | 16 / 1 | `$spacing-05` | +| | border-bottom | 1px | – | +| Helper text | margin-top | 4 / .25 | `$spacing-02` | +| Calendar icon | height, width | 16 / 1 | – | +| | padding-left | 8 / 0.5 | `$spacing-03` |
@@ -140,16 +156,14 @@ The widths of the date inputs may vary based on the grid and layout. ### Calendar menu -| Element | Property | px / rem | Spacing token | -| -------------- | ---------------------------------------- | -------- | ------------- | -| Calendar | height | 336 / 21 | – | -| | width | 288 / 18 | – | -| | padding-top, padding-right, padding-left | 4 / 0.25 | `$spacing-02` | -| | padding-bottom | 8 / 0.5 | `$spacing-03` | -| Calendar: icon | height, width | 16 / 1 | – | -| | padding-right, padding-left | 16 / 1 | `$spacing-05` | -| Day | height, width | 40 / 2.5 | – | -| Today: dot | height, width | 4 / 0.25 | – | +| Element | Property | px / rem | Spacing token | +| ------------- | ---------------------------------------- | -------- | ------------- | +| Calendar menu | height | 336 / 21 | – | +| | width | 288 / 18 | – | +| | padding-top, padding-right, padding-left | 4 / 0.25 | `$spacing-02` | +| | padding-bottom | 8 / 0.5 | `$spacing-03` | +| Day | height, width | 40 / 2.5 | – | +| Today: dot | height, width | 4 / 0.25 | – |
@@ -172,7 +186,7 @@ The widths of the date inputs may vary based on the grid and layout. There are two types of time pickers; a 12-hour and 24-hour time picker. The 12-hour Time Picker is accompanied by a time period (am/pm) input, while the 24-hour clock is not. Refer to [select](/components/select/code) for inline -select styling. Hi +select styling. | Element | Property | px / rem | Spacing token | | ------- | --------------------------- | -------- | ------------- | diff --git a/src/pages/components/date-picker/usage.mdx b/src/pages/components/date-picker/usage.mdx index a4e7c45dd85..206e54aa1de 100755 --- a/src/pages/components/date-picker/usage.mdx +++ b/src/pages/components/date-picker/usage.mdx @@ -8,8 +8,8 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility'] -Date and time pickers allow users to select a single or a range of dates and -times. +Date and time pickers allow users to select a single instance or range of dates +and times. @@ -30,23 +30,23 @@ times. ## Overview -Pickers are used to display past, present, or future dates or times. The kind of -date (exact, approximate, memorable) you are requesting from the user will -determine which picker is best to use. Each picker's format can be customized -depending on location or need. +Date pickers allow users to select past, present, or future dates. The kind of +date you are requesting from the user will determine which date picker (simple +or calendar) is best to use. A time picker helps users select a specific time. +You can customize the time picker's format depending on location or need. ### When to use -Use date and time pickers when you are asking the user for a time or date, or -for scheduling tasks. +- When asking the user for an exact, approximate, or memorable date or time. +- For scheduling tasks. ### Variants -| Variant | Purpose | -| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| _Simple date input_ | Use if the date can be remembered by the user easily, such as a date of birth, and they don’t need a calendar to anticipate the dates. It consists only of input fields. | -| _Calendar pickers_ | Use a calendar picker when the user needs to know a date's relationship to other days or when a date could be variable. It allows the user to view and pick dates from a calendar widget or manually type the date in the text field. | -| _Time picker_ | Use when asking the user to input a specific time. | +| Variant | Purpose | +| -------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [Simple date input](/components/date-picker/usage#simple-date-input) | Use if the date can be remembered by the user easily, such as a date of birth, and they don’t need a calendar to anticipate the dates. It consists only of input fields. | +| [Calendar picker](/components/date-picker/usage#calendar-pickers) | Use a calendar picker (single or range) when the user needs to know a date's relationship to other days or when a date could be variable. The user can view and pick dates from a calendar widget or manually type them in the text field. | +| [Time picker](/date-picker/usage#time-pickers) | Use when asking the user to input a specific time. | ## Live demo @@ -199,13 +199,18 @@ for scheduling tasks. 1. **Label**: Instructs the user what to do with the control. 2. **Date field**: A text input field where the user can manually type in the date. -3. **Icon**: `calendar` icon indicates the calendar menu is available. -4. **Calendar**: The menu where a date may be selected. -5. **Month and year controls**: Allows the user to navigate through past and +3. **Date format**: Format instructions should appear as helper text below the + field or inline with the label. +4. **Icon**: `calendar` icon indicates the calendar menu is available. +5. **Calendar**: The menu where a date may be selected. +6. **Month and year controls**: Allows the user to navigate through past and future time frames. -6. **Previous and next month controls**: Allows the user to move forward or +7. **Week day**: Days of the week. +8. **Previous and next month controls**: Allows the user to move forward or backward one month at a time. -7. **Day**: Days in the month. +9. **Day**: Days in the month, see + [calendar variants](/components/date-picker/usage#calendar-variants) for + specific day styles. ### Anatomy of a time picker @@ -256,7 +261,9 @@ should always be aligned to the left edge of its assigned text field. ### Sizes -Date picker comes in three sizes: small (32px), medium (40px), and large (48px). +The input fields for date and time picker come in three height sizes: small +(32px), medium (40px), and large (48px). The calendar menu in the date picker is +a fixed height and width and does not change with the input size. @@ -376,7 +383,7 @@ the same interactive state and behaviors. See the [style tab](/components/date-picker/style) for more details. - + ![Simple date input states](images/simple-date-input-states.png) @@ -401,7 +408,7 @@ Use a calendar picker when the user needs to know a date's relation to other days such as the day of the week it falls on or its proximity to today. They are optimal for scheduling tasks. -### Variants +### Calendar variants #### Single date picker @@ -544,29 +551,6 @@ a meeting time. -## Modifiers - -### Light variant - -Use the `light` prop modifier when placing date pickers on alternate -backgrounds. The light prop will change the background color token of the inputs -from `field-01` to `field-02`. This is frequently used in form modals or when on -a tile. - - - - -![Light prop example](images/date-picker-light-prop.png) - - - - - - {' '} - Both inputs are displayed in the white theme but the one on the right is using - the light prop on the alternate UI background.{' '} - - ## Related #### Asking for relative times and dates @@ -578,10 +562,10 @@ made by using the standard [select](/components/select/usage/) component. #### Using individual inputs -Another acceptable form of a time or date experience would be using individual -inputs for each factor. Using an individual field for each factor of a date or -time can help reduce formatting errors. This is especially beneficial when -localization cannot be used to reformat dates. +Another acceptable form of a date experience would be using individual inputs +for each factor. Using an individual field for each factor of a date can help +reduce formatting errors. This is especially beneficial when localization cannot +be used to reformat dates. Instead of having one input for an exact date (month/day/year), you could have three separate inputs and a clear label for each.