@loadsmart/loadsmart-ui 5.10.0 → 5.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/SelectionWrapper.d.ts +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.stories.d.ts +1 -1
- package/dist/components/Banner/Banner.stories.d.ts +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +1 -1
- package/dist/components/Button/Button.stories.d.ts +1 -1
- package/dist/components/Calendar/Calendar.stories.d.ts +2 -7
- package/dist/components/Calendar/Date.helper.d.ts +47 -12
- package/dist/components/Card/Card.stories.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.stories.d.ts +1 -1
- package/dist/components/Dialog/Dialog.stories.d.ts +1 -1
- package/dist/components/DragDropFile/DragDropFile.stories.d.ts +1 -1
- package/dist/components/Drawer/Drawer.stories.d.ts +1 -1
- package/dist/components/Dropdown/Dropdown.stories.d.ts +5 -2
- package/dist/components/EmptyState/EmptyState.stories.d.ts +1 -1
- package/dist/components/ErrorMessage/ErrorMessage.stories.d.ts +1 -1
- package/dist/components/HighlightMatch/HighlightMatch.stories.d.ts +1 -1
- package/dist/components/IconFactory/IconFactory.stories.d.ts +1 -1
- package/dist/components/Label/Label.d.ts +2 -2
- package/dist/components/Label/Label.stories.d.ts +1 -1
- package/dist/components/Layout/Box.d.ts +1 -1
- package/dist/components/Layout/Grid.d.ts +1 -1
- package/dist/components/Layout/Layout.stories.d.ts +1 -1
- package/dist/components/Layout/Sidebar.d.ts +1 -1
- package/dist/components/Layout/Switcher.d.ts +1 -1
- package/dist/components/Link/Link.stories.d.ts +1 -1
- package/dist/components/Link/useSafeLink.d.ts +1 -1
- package/dist/components/Loaders/LoadingBar.stories.d.ts +2 -2
- package/dist/components/Loaders/LoadingDots.stories.d.ts +1 -1
- package/dist/components/Loaders/Spinner.stories.d.ts +1 -1
- package/dist/components/Modal/Modal.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.stories.d.ts +1 -1
- package/dist/components/Pagination/Pagination.types.d.ts +2 -2
- package/dist/components/Popover/Popover.stories.d.ts +1 -1
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +1 -1
- package/dist/components/Radio/Radio.d.ts +1 -1
- package/dist/components/Radio/Radio.stories.d.ts +1 -1
- package/dist/components/Section/Sections.stories.d.ts +1 -1
- package/dist/components/Select/Select.fixtures.d.ts +1 -1
- package/dist/components/Select/Select.stories.d.ts +1 -1
- package/dist/components/Select/Select.types.d.ts +2 -2
- package/dist/components/Select/SelectCreatableOption.d.ts +1 -1
- package/dist/components/Select/SelectEmpty.d.ts +1 -1
- package/dist/components/Select/components.d.ts +1 -1
- package/dist/components/Select/useSelectExternal.d.ts +1 -1
- package/dist/components/SideNavigation/SideNavigation.stories.d.ts +1 -1
- package/dist/components/Steps/Steps.d.ts +1 -1
- package/dist/components/Steps/Steps.stories.d.ts +1 -1
- package/dist/components/Steps/StepsStep.d.ts +1 -1
- package/dist/components/Switch/Switch.stories.d.ts +1 -1
- package/dist/components/Table/Table.stories.d.ts +1 -1
- package/dist/components/Table/Table.types.d.ts +3 -4
- package/dist/components/Table/TableSortHandle.d.ts +1 -1
- package/dist/components/TablePagination/RowsPerPage.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.stories.d.ts +1 -1
- package/dist/components/TablePagination/TablePagination.types.d.ts +1 -1
- package/dist/components/TablePagination/TablePaginationActions.d.ts +1 -1
- package/dist/components/Tag/Tag.stories.d.ts +1 -1
- package/dist/components/Text/Text.d.ts +1 -1
- package/dist/components/Text/Text.stories.d.ts +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -1
- package/dist/components/TextField/TextField.stories.d.ts +1 -1
- package/dist/components/Textarea/Textarea.d.ts +1 -1
- package/dist/components/Textarea/Textarea.stories.d.ts +1 -1
- package/dist/components/Toast/Toast.stories.d.ts +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.stories.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +3 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +1 -1
- package/dist/hooks/useFocusTrap/useFocusTrap.stories.d.ts +1 -1
- package/dist/hooks/useHeightExpansionToggler/useHeightExpansionToggler.d.ts +1 -1
- package/dist/index.js +339 -491
- package/dist/index.js.map +1 -1
- package/dist/styles/activatable.d.ts +1 -1
- package/dist/styles/disableable.d.ts +1 -1
- package/dist/styles/focusable.d.ts +1 -1
- package/dist/styles/hoverable.d.ts +1 -1
- package/dist/testing/getInterpolatedStyles/getInterpolatedStyles.d.ts +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/tests/generator.d.ts +35 -0
- package/dist/tests/renderer.d.ts +10 -0
- package/dist/theming/index.d.ts +2 -2
- package/dist/theming/index.js.map +1 -1
- package/package.json +9 -10
- package/src/common/CloseButton/CloseButton.tsx +7 -11
- package/src/common/SelectionWrapper.tsx +8 -8
- package/src/components/Accordion/Accordion.stories.tsx +2 -2
- package/src/components/Accordion/Accordion.test.tsx +2 -2
- package/src/components/Accordion/Accordion.tsx +24 -29
- package/src/components/Banner/Banner.stories.tsx +1 -1
- package/src/components/Banner/Banner.test.tsx +2 -2
- package/src/components/Banner/Banner.tsx +2 -2
- package/src/components/Breadcrumbs/Breadbrumbs.test.tsx +2 -2
- package/src/components/Breadcrumbs/Breadcrumb.tsx +3 -4
- package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +1 -1
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +1 -1
- package/src/components/Button/Button.stories.tsx +1 -1
- package/src/components/Button/Button.test.tsx +2 -2
- package/src/components/Button/Button.tsx +17 -20
- package/src/components/Calendar/Calendar.stories.tsx +4 -2
- package/src/components/Calendar/Calendar.test.tsx +3 -3
- package/src/components/Calendar/Calendar.tsx +4 -8
- package/src/components/Calendar/Date.helper.test.ts +463 -15
- package/src/components/Calendar/Date.helper.ts +106 -45
- package/src/components/Calendar/PickerModeToggle.tsx +3 -6
- package/src/components/Calendar/Pickers/DayPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/DayPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/MonthPicker.test.tsx +2 -2
- package/src/components/Calendar/Pickers/MonthPicker.tsx +1 -1
- package/src/components/Calendar/Pickers/PickerButton.tsx +29 -39
- package/src/components/Calendar/Pickers/YearPicker.test.tsx +9 -7
- package/src/components/Calendar/Pickers/YearPicker.tsx +1 -1
- package/src/components/Card/Card.stories.tsx +2 -2
- package/src/components/Card/Card.test.tsx +2 -2
- package/src/components/Card/Card.tsx +6 -9
- package/src/components/Card/CardTitle.tsx +3 -3
- package/src/components/Checkbox/Checkbox.stories.tsx +1 -1
- package/src/components/Checkbox/Checkbox.test.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +15 -27
- package/src/components/DatePicker/DatePicker.test.tsx +2 -2
- package/src/components/DatePicker/DateRangePicker.stories.tsx +6 -1
- package/src/components/DatePicker/DateRangePicker.test.tsx +2 -2
- package/src/components/Dialog/Dialog.stories.tsx +1 -1
- package/src/components/Dialog/Dialog.test.tsx +2 -2
- package/src/components/Dialog/Dialog.tsx +5 -5
- package/src/components/DragDropFile/DragDropFile.stories.tsx +1 -1
- package/src/components/DragDropFile/components/DropZone.test.tsx +1 -1
- package/src/components/DragDropFile/styles.tsx +6 -11
- package/src/components/Drawer/Drawer.stories.tsx +1 -1
- package/src/components/Drawer/Drawer.test.tsx +1 -1
- package/src/components/Drawer/Drawer.tsx +6 -6
- package/src/components/Dropdown/Dropdown.stories.tsx +11 -6
- package/src/components/Dropdown/Dropdown.test.tsx +14 -16
- package/src/components/Dropdown/DropdownMenu.tsx +15 -28
- package/src/components/Dropdown/DropdownTrigger.tsx +24 -34
- package/src/components/EmptyState/EmptyState.stories.tsx +1 -1
- package/src/components/EmptyState/EmptyState.test.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.stories.tsx +1 -1
- package/src/components/ErrorMessage/ErrorMessage.test.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.stories.tsx +1 -1
- package/src/components/HighlightMatch/HighlightMatch.test.tsx +2 -2
- package/src/components/HighlightMatch/HighlightMatch.tsx +1 -1
- package/src/components/IconFactory/IconFactory.stories.tsx +1 -1
- package/src/components/IconFactory/IconFactory.test.tsx +2 -2
- package/src/components/Label/Label.stories.tsx +1 -1
- package/src/components/Label/Label.test.tsx +2 -2
- package/src/components/Label/Label.tsx +5 -5
- package/src/components/Layout/Box.tsx +1 -1
- package/src/components/Layout/Grid.tsx +1 -1
- package/src/components/Layout/Layout.stories.tsx +1 -1
- package/src/components/Layout/Sidebar.tsx +1 -1
- package/src/components/Layout/Switcher.tsx +1 -1
- package/src/components/Link/Link.stories.tsx +1 -1
- package/src/components/Link/Link.test.tsx +2 -2
- package/src/components/Link/Link.tsx +9 -13
- package/src/components/Link/useSafeLink.ts +1 -1
- package/src/components/Loaders/LoadingBar.stories.tsx +3 -3
- package/src/components/Loaders/LoadingBar.test.tsx +1 -1
- package/src/components/Loaders/LoadingBar.tsx +2 -2
- package/src/components/Loaders/LoadingDots.stories.tsx +1 -1
- package/src/components/Loaders/LoadingDots.test.tsx +1 -1
- package/src/components/Loaders/Spinner.stories.tsx +1 -1
- package/src/components/Loaders/Spinner.test.tsx +2 -2
- package/src/components/Modal/Modal.stories.tsx +1 -1
- package/src/components/Modal/Modal.test.tsx +2 -2
- package/src/components/Modal/Modal.tsx +7 -12
- package/src/components/Pagination/Pagination.stories.tsx +1 -1
- package/src/components/Pagination/Pagination.test.tsx +2 -2
- package/src/components/Pagination/Pagination.types.ts +2 -2
- package/src/components/Popover/Popover.stories.tsx +1 -1
- package/src/components/Popover/Popover.test.tsx +2 -2
- package/src/components/ProgressBar/ProgressBar.stories.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.test.tsx +1 -1
- package/src/components/ProgressBar/ProgressBar.tsx +4 -6
- package/src/components/Radio/Radio.stories.tsx +1 -1
- package/src/components/Radio/Radio.test.tsx +2 -2
- package/src/components/Radio/Radio.tsx +12 -20
- package/src/components/Section/Section.test.tsx +2 -2
- package/src/components/Section/Section.tsx +6 -8
- package/src/components/Section/Sections.stories.tsx +2 -2
- package/src/components/Select/Select.fixtures.ts +2 -2
- package/src/components/Select/Select.stories.tsx +3 -3
- package/src/components/Select/Select.test.tsx +12 -5
- package/src/components/Select/Select.types.ts +2 -2
- package/src/components/Select/SelectCreatableOption.tsx +1 -1
- package/src/components/Select/SelectEmpty.tsx +5 -6
- package/src/components/Select/SelectOption.test.tsx +1 -1
- package/src/components/Select/SelectTrigger.tsx +6 -11
- package/src/components/Select/components.tsx +1 -1
- package/src/components/Select/useSelect.helpers.test.ts +1 -1
- package/src/components/Select/useSelect.ts +1 -1
- package/src/components/Select/useSelectExternal.ts +1 -1
- package/src/components/SideNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/SideNavigation/Menu/Menu.test.tsx +3 -3
- package/src/components/SideNavigation/Menu/Menu.tsx +3 -3
- package/src/components/SideNavigation/Menu/MenuBaseItem.tsx +4 -5
- package/src/components/SideNavigation/Menu/MenuExpandable.tsx +2 -3
- package/src/components/SideNavigation/Separator/Separator.test.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.stories.tsx +1 -1
- package/src/components/SideNavigation/SideNavigation.test.tsx +2 -2
- package/src/components/Steps/ProgressSteps/ProgressStep.tsx +31 -39
- package/src/components/Steps/Steps.fixtures.ts +1 -1
- package/src/components/Steps/Steps.stories.tsx +1 -1
- package/src/components/Steps/Steps.test.tsx +2 -2
- package/src/components/Steps/Steps.tsx +2 -1
- package/src/components/Steps/StepsStep.tsx +2 -1
- package/src/components/Steps/useStep.test.tsx +1 -1
- package/src/components/Switch/Switch.stories.tsx +1 -1
- package/src/components/Switch/Switch.test.tsx +1 -1
- package/src/components/Switch/Switch.tsx +6 -18
- package/src/components/Table/Table.fixtures.ts +1 -1
- package/src/components/Table/Table.stories.tsx +1 -1
- package/src/components/Table/Table.test.tsx +1 -1
- package/src/components/Table/Table.tsx +2 -2
- package/src/components/Table/Table.types.ts +9 -4
- package/src/components/Table/TableSortHandle.tsx +1 -1
- package/src/components/TablePagination/RowsPerPage.tsx +2 -2
- package/src/components/TablePagination/TablePagination.stories.tsx +1 -1
- package/src/components/TablePagination/TablePagination.test.tsx +2 -2
- package/src/components/TablePagination/TablePagination.types.ts +1 -1
- package/src/components/TablePagination/TablePaginationActions.tsx +1 -1
- package/src/components/Tabs/Tabs.test.tsx +1 -1
- package/src/components/Tabs/Tabs.tsx +26 -32
- package/src/components/Tag/Tag.stories.tsx +2 -2
- package/src/components/Tag/Tag.test.tsx +2 -2
- package/src/components/Tag/Tag.tsx +35 -44
- package/src/components/Text/Text.stories.tsx +1 -1
- package/src/components/Text/Text.test.tsx +2 -2
- package/src/components/Text/Text.tsx +1 -1
- package/src/components/TextField/TextField.stories.tsx +1 -1
- package/src/components/TextField/TextField.test.tsx +1 -1
- package/src/components/TextField/TextField.tsx +16 -23
- package/src/components/Textarea/Textarea.stories.tsx +1 -1
- package/src/components/Textarea/Textarea.test.tsx +1 -1
- package/src/components/Textarea/Textarea.tsx +18 -23
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Toast/Toast.test.tsx +2 -2
- package/src/components/Toast/Toast.tsx +3 -3
- package/src/components/ToggleGroup/Toggle.test.tsx +2 -2
- package/src/components/ToggleGroup/Toggle.tsx +7 -7
- package/src/components/ToggleGroup/ToggleGroup.stories.tsx +1 -1
- package/src/components/ToggleGroup/ToggleGroup.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.test.tsx +2 -2
- package/src/components/Tooltip/Tooltip.tsx +23 -24
- package/src/components/TopNavigation/Logo/Logo.test.tsx +2 -2
- package/src/components/TopNavigation/Menu/Menu.test.tsx +1 -1
- package/src/components/TopNavigation/Menu/MenuItemDropdown.tsx +1 -1
- package/src/components/TopNavigation/OpenSideNavButton/OpenSideNavButton.tsx +1 -1
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +1 -1
- package/src/hooks/useClickOutside/useClickOutside.test.tsx +1 -1
- package/src/hooks/useDidMount/useDidMount.test.tsx +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.stories.tsx +1 -1
- package/src/hooks/useFocusTrap/useFocusTrap.test.tsx +1 -1
- package/src/hooks/useFocusWithin/useFocusWithin.test.tsx +1 -1
- package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.test.tsx +1 -1
- package/src/hooks/useHeightExpansionToggler/useHeightExpansionToggler.ts +1 -1
- package/src/hooks/useSelectable/SelectableStrategy.test.ts +1 -1
- package/src/hooks/useSelectable/useSelectable.test.ts +1 -1
- package/src/styles/activatable.tsx +1 -1
- package/src/styles/disableable.tsx +1 -1
- package/src/styles/focusable.tsx +1 -1
- package/src/styles/font.tsx +3 -3
- package/src/styles/hoverable.tsx +1 -1
- package/src/testing/SelectEvent/SelectEvent.test.tsx +2 -2
- package/src/testing/getInterpolatedStyles/getInterpolatedStyles.ts +1 -1
- package/src/tests/generator.ts +127 -0
- package/src/tests/renderer.tsx +39 -0
- package/src/theming/index.ts +3 -2
- package/src/tools/conditional.test.ts +1 -1
- package/src/utils/toolset/interleave.test.ts +1 -1
|
@@ -11,6 +11,9 @@ export const DEFAULT_OPTIONS: DateHelperOptions = {
|
|
|
11
11
|
|
|
12
12
|
export type InputDate = string | number | Date
|
|
13
13
|
|
|
14
|
+
type Unit = 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond'
|
|
15
|
+
type Operator = '>=' | '>' | '=' | '<' | '<='
|
|
16
|
+
|
|
14
17
|
export type DateConstraint =
|
|
15
18
|
| InputDate
|
|
16
19
|
| [InputDate, InputDate]
|
|
@@ -87,42 +90,58 @@ export interface CalendarDate {
|
|
|
87
90
|
* @returns {number}
|
|
88
91
|
*/
|
|
89
92
|
getSeconds(): number
|
|
93
|
+
/**
|
|
94
|
+
* Get the milliseconds value.
|
|
95
|
+
*
|
|
96
|
+
* [!] Be aware that it might be normalized to 12:00:00 (UTC), if you did not call the helper with
|
|
97
|
+
* `options.normalize: false`.
|
|
98
|
+
*
|
|
99
|
+
* @returns {number}
|
|
100
|
+
*/
|
|
101
|
+
getMilliseconds(): number
|
|
90
102
|
/**
|
|
91
103
|
* Check if the current date matches **at least one** of the provided constraints.
|
|
104
|
+
*
|
|
105
|
+
* [!] Be aware that all dates in this comparison will be normalized to 12:00:00 (UTC).
|
|
106
|
+
*
|
|
92
107
|
* @param {...CalendarConstraint[]} constraintsArg
|
|
93
108
|
* @returns {boolean}
|
|
94
109
|
*/
|
|
95
110
|
matches(...constraints: CalendarConstraint[]): boolean
|
|
96
111
|
/**
|
|
97
|
-
* Set the given `value` to the `
|
|
112
|
+
* Set the given `value` to the `unit` property of this instance.
|
|
98
113
|
* This function mutates the internal date instance.
|
|
99
|
-
* @param {
|
|
114
|
+
* @param {Unit} unit
|
|
100
115
|
* @param {number} value
|
|
101
116
|
* @returns {CalendarDate}
|
|
102
117
|
*/
|
|
103
|
-
set(
|
|
118
|
+
set(unit: Unit, value: number): CalendarDate
|
|
104
119
|
/**
|
|
105
|
-
* Return a copy of this instance, adding the given `value` to the `
|
|
106
|
-
* @param {
|
|
120
|
+
* Return a copy of this instance, adding the given `value` to the `unit` property.
|
|
121
|
+
* @param {Unit} unit
|
|
107
122
|
* @param {number} value
|
|
108
123
|
* @returns {CalendarDate}
|
|
109
124
|
*/
|
|
110
|
-
add(
|
|
125
|
+
add(unit: Unit, value: number): CalendarDate
|
|
111
126
|
/**
|
|
112
|
-
* Return a copy of this instance, subtracting the given `value` from the `
|
|
113
|
-
* @param {
|
|
127
|
+
* Return a copy of this instance, subtracting the given `value` from the `unit` property.
|
|
128
|
+
* @param {Unit} unit
|
|
114
129
|
* @param {number} value
|
|
115
130
|
* @returns {CalendarDate}
|
|
116
131
|
*/
|
|
117
|
-
subtract(
|
|
132
|
+
subtract(unit: Unit, value: number): CalendarDate
|
|
118
133
|
/**
|
|
119
134
|
* Compare this date with the given `other`.
|
|
120
|
-
*
|
|
135
|
+
*
|
|
136
|
+
* [!] Be aware that it might be normalized to 12:00:00 (UTC), if you did not call the helper with
|
|
137
|
+
* `options.normalize: false`.
|
|
138
|
+
*
|
|
139
|
+
* @param {Operator} operator - type of comparison to be performed.
|
|
121
140
|
* @param {CalendarDate} other - Other `CalendarDate` to compare with.
|
|
122
|
-
* @param {
|
|
141
|
+
* @param {Unit} [precision] - notice that the precision increases with the evaluated period, so year < month < day < hour < minute < second < millisecond. Default is 'day'.
|
|
123
142
|
* @return {boolean} comparison result
|
|
124
143
|
*/
|
|
125
|
-
is(operator:
|
|
144
|
+
is(operator: Operator, other: CalendarDate, precision?: string): boolean
|
|
126
145
|
/**
|
|
127
146
|
* Return this date as a string value in ISO format.
|
|
128
147
|
* @returns {string}
|
|
@@ -200,6 +219,9 @@ function DateHelper(dateArg?: InputDate, optionsArg = DEFAULT_OPTIONS): Calendar
|
|
|
200
219
|
getSeconds() {
|
|
201
220
|
return utcDate.getUTCSeconds()
|
|
202
221
|
},
|
|
222
|
+
getMilliseconds() {
|
|
223
|
+
return utcDate.getUTCMilliseconds()
|
|
224
|
+
},
|
|
203
225
|
matches(...constraints: CalendarConstraint[]): boolean {
|
|
204
226
|
if (isEmpty(constraints)) {
|
|
205
227
|
return false
|
|
@@ -212,31 +234,35 @@ function DateHelper(dateArg?: InputDate, optionsArg = DEFAULT_OPTIONS): Calendar
|
|
|
212
234
|
return evaluator(date)
|
|
213
235
|
})
|
|
214
236
|
},
|
|
215
|
-
add(
|
|
216
|
-
return add(utcDate,
|
|
237
|
+
add(unit: Unit, value: number) {
|
|
238
|
+
return add(utcDate, unit, value)
|
|
217
239
|
},
|
|
218
|
-
subtract(
|
|
219
|
-
return add(utcDate,
|
|
240
|
+
subtract(unit: Unit, value: number) {
|
|
241
|
+
return add(utcDate, unit, -1 * value)
|
|
220
242
|
},
|
|
221
|
-
set(
|
|
243
|
+
set(unit: Unit, value: number) {
|
|
222
244
|
const newValue = {
|
|
223
245
|
year: utcDate.getUTCFullYear(),
|
|
224
246
|
month: utcDate.getUTCMonth(),
|
|
225
247
|
day: utcDate.getUTCDate(),
|
|
226
|
-
|
|
248
|
+
hour: utcDate.getUTCHours(),
|
|
249
|
+
minute: utcDate.getUTCMinutes(),
|
|
250
|
+
second: utcDate.getUTCSeconds(),
|
|
251
|
+
millisecond: utcDate.getUTCMilliseconds(),
|
|
252
|
+
[unit]: value,
|
|
227
253
|
}
|
|
228
254
|
|
|
229
255
|
utcDate.setUTCFullYear(newValue.year)
|
|
230
256
|
utcDate.setUTCMonth(newValue.month)
|
|
231
257
|
utcDate.setUTCDate(newValue.day)
|
|
258
|
+
utcDate.setUTCHours(newValue.hour)
|
|
259
|
+
utcDate.setUTCMinutes(newValue.minute)
|
|
260
|
+
utcDate.setUTCSeconds(newValue.second)
|
|
261
|
+
utcDate.setUTCMilliseconds(newValue.millisecond)
|
|
232
262
|
|
|
233
263
|
return this
|
|
234
264
|
},
|
|
235
|
-
is(
|
|
236
|
-
operator: '>=' | '>' | '=' | '<' | '<=',
|
|
237
|
-
other: CalendarDate,
|
|
238
|
-
precision?: 'year' | 'month' | 'day'
|
|
239
|
-
): boolean {
|
|
265
|
+
is(operator: Operator, other: CalendarDate, precision?: Unit): boolean {
|
|
240
266
|
function compare(a: number, b: number) {
|
|
241
267
|
let result
|
|
242
268
|
|
|
@@ -262,8 +288,8 @@ function DateHelper(dateArg?: InputDate, optionsArg = DEFAULT_OPTIONS): Calendar
|
|
|
262
288
|
}
|
|
263
289
|
|
|
264
290
|
return compare(
|
|
265
|
-
|
|
266
|
-
|
|
291
|
+
getComparableDate(utcDate, precision),
|
|
292
|
+
getComparableDate(other.get(), precision)
|
|
267
293
|
)
|
|
268
294
|
},
|
|
269
295
|
toString(): string {
|
|
@@ -272,16 +298,44 @@ function DateHelper(dateArg?: InputDate, optionsArg = DEFAULT_OPTIONS): Calendar
|
|
|
272
298
|
}
|
|
273
299
|
}
|
|
274
300
|
|
|
275
|
-
|
|
301
|
+
/**
|
|
302
|
+
* This method takes a date and a unit of precision and then normalizes the given date based on that precision.
|
|
303
|
+
* The return will be the timestamp of the normalized date
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```js
|
|
307
|
+
* getComparableDate(new Date('2022-10-13T17:42:19.948Z'), 'hour')) // returns 1665680400000
|
|
308
|
+
*
|
|
309
|
+
* // '2022-10-13T17:42:19.948Z' will be normalized to '2022-10-13T17:00:00.000Z'
|
|
310
|
+
* // 1665680400000 is equal to: new Date('2022-10-13T17:00:00.000Z').getTime()
|
|
311
|
+
* ```
|
|
312
|
+
*
|
|
313
|
+
* @param {Date} date
|
|
314
|
+
* @param {Unit} precision
|
|
315
|
+
* @returns {number}
|
|
316
|
+
*/
|
|
317
|
+
export function getComparableDate(date: Date, precision: Unit = 'day'): number {
|
|
318
|
+
const DATE_ZERO = MIN_SUPPORTED_DATE.toString()
|
|
276
319
|
const COMPARE_TO = {
|
|
277
|
-
year:
|
|
278
|
-
month:
|
|
279
|
-
day:
|
|
320
|
+
year: 4,
|
|
321
|
+
month: 7,
|
|
322
|
+
day: 10,
|
|
323
|
+
hour: 13,
|
|
324
|
+
minute: 16,
|
|
325
|
+
second: 19,
|
|
326
|
+
millisecond: 24,
|
|
327
|
+
}
|
|
328
|
+
const sliceIndex = COMPARE_TO[precision]
|
|
329
|
+
|
|
330
|
+
if (sliceIndex == null) {
|
|
331
|
+
throw new Error(`precision ${precision} is not supported`)
|
|
280
332
|
}
|
|
281
333
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
334
|
+
const normalizedPart = DATE_ZERO.slice(sliceIndex)
|
|
335
|
+
const datePart = date.toISOString().slice(0, sliceIndex)
|
|
336
|
+
const normalizedDate = `${datePart}${normalizedPart}`
|
|
337
|
+
|
|
338
|
+
return new Date(normalizedDate).getTime()
|
|
285
339
|
}
|
|
286
340
|
|
|
287
341
|
/**
|
|
@@ -328,31 +382,38 @@ export function getConstraintRange(rangeArg: DateConstraint): [number, number] {
|
|
|
328
382
|
}
|
|
329
383
|
|
|
330
384
|
/**
|
|
331
|
-
* Add the given `value` to the provided `
|
|
385
|
+
* Add the given `value` to the provided `unit` of the provided `date`.
|
|
332
386
|
* @param {Date} date - Date where the operation should be performed.
|
|
333
|
-
* @param {
|
|
387
|
+
* @param {Unit} unit - period
|
|
334
388
|
* @param {number} value - value to be added
|
|
335
389
|
* @returns {Date} new date after the operation.
|
|
336
390
|
*/
|
|
337
|
-
function add(date: Date,
|
|
391
|
+
function add(date: Date, unit: Unit, value: number): CalendarDate {
|
|
338
392
|
const increment = {
|
|
339
393
|
year: 0,
|
|
340
394
|
month: 0,
|
|
341
395
|
day: 0,
|
|
342
|
-
|
|
396
|
+
hour: 0,
|
|
397
|
+
minute: 0,
|
|
398
|
+
second: 0,
|
|
399
|
+
millisecond: 0,
|
|
400
|
+
[unit]: value,
|
|
343
401
|
}
|
|
344
402
|
|
|
345
403
|
const newDate = new Date(
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
404
|
+
Date.UTC(
|
|
405
|
+
date.getUTCFullYear() + increment.year,
|
|
406
|
+
date.getUTCMonth() + increment.month,
|
|
407
|
+
date.getUTCDate() + increment.day,
|
|
408
|
+
date.getUTCHours() + increment.hour,
|
|
409
|
+
date.getUTCMinutes() + increment.minute,
|
|
410
|
+
date.getUTCSeconds() + increment.second,
|
|
411
|
+
date.getUTCMilliseconds() + increment.millisecond
|
|
412
|
+
)
|
|
353
413
|
)
|
|
354
414
|
|
|
355
|
-
|
|
415
|
+
// Do not normalize the clone since all units must be preserved.
|
|
416
|
+
return DateHelper(newDate, { normalize: false })
|
|
356
417
|
}
|
|
357
418
|
|
|
358
419
|
/**
|
|
@@ -394,7 +455,7 @@ export const TODAY = DateHelper()
|
|
|
394
455
|
* Maximum and minimum supported `Date`.
|
|
395
456
|
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps
|
|
396
457
|
*/
|
|
397
|
-
export const MIN_SUPPORTED_DATE = DateHelper(0)
|
|
458
|
+
export const MIN_SUPPORTED_DATE = DateHelper(0, { normalize: false })
|
|
398
459
|
export const MAX_SUPPORTED_DATE = DateHelper(8.64e15 - 1)
|
|
399
460
|
|
|
400
461
|
export default DateHelper
|
|
@@ -12,7 +12,10 @@ import typography from 'styles/typography'
|
|
|
12
12
|
import type { ButtonProps } from 'components/Button'
|
|
13
13
|
|
|
14
14
|
const Button = styled(BaseButton)`
|
|
15
|
+
color: ${token('color-neutral-dark')};
|
|
15
16
|
user-select: none;
|
|
17
|
+
background-color: transparent;
|
|
18
|
+
border-color: transparent;
|
|
16
19
|
|
|
17
20
|
${typography(
|
|
18
21
|
conditional({
|
|
@@ -20,15 +23,9 @@ const Button = styled(BaseButton)`
|
|
|
20
23
|
body: whenProps({ 'aria-expanded': false }),
|
|
21
24
|
})
|
|
22
25
|
)};
|
|
23
|
-
border-color: transparent;
|
|
24
|
-
background-color: transparent;
|
|
25
|
-
|
|
26
|
-
color: ${token('color-neutral-dark')};
|
|
27
|
-
|
|
28
26
|
${focusable`
|
|
29
27
|
box-shadow: ${token('button-primary-outline')};
|
|
30
28
|
`}
|
|
31
|
-
|
|
32
29
|
${disableable`
|
|
33
30
|
pointer-events: none;
|
|
34
31
|
opacity: 1;
|
|
@@ -2,8 +2,8 @@ import React from 'react'
|
|
|
2
2
|
|
|
3
3
|
import DateHelper from '../Date.helper'
|
|
4
4
|
import DayPicker, { WEEKDAYS } from './DayPicker'
|
|
5
|
-
import generator from '
|
|
6
|
-
import renderer, { screen, fire } from '
|
|
5
|
+
import generator from '../../../tests/generator'
|
|
6
|
+
import renderer, { screen, fire } from '../../../tests/renderer'
|
|
7
7
|
|
|
8
8
|
import type { useCalendarReturn, CalendarPickerProps, usePickerModeReturn } from '../Calendar.types'
|
|
9
9
|
|
|
@@ -53,9 +53,9 @@ const Text = styled(DefaultText)`
|
|
|
53
53
|
|
|
54
54
|
const Grid = styled.div`
|
|
55
55
|
display: grid;
|
|
56
|
-
grid-gap: ${token('space-2xs')};
|
|
57
56
|
grid-template-rows: 1.25rem repeat(auto-fill, 2.5rem);
|
|
58
57
|
grid-template-columns: repeat(7, 2.5rem);
|
|
58
|
+
grid-gap: ${token('space-2xs')};
|
|
59
59
|
`
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import DateHelper from '../Date.helper'
|
|
4
|
-
import generator from '
|
|
4
|
+
import generator from '../../../tests/generator'
|
|
5
5
|
import MonthHelper from '../Month.helper'
|
|
6
6
|
import MonthPicker from './MonthPicker'
|
|
7
7
|
import range from 'utils/toolset/range'
|
|
8
|
-
import renderer, { screen, fire } from '
|
|
8
|
+
import renderer, { screen, fire } from '../../../tests/renderer'
|
|
9
9
|
|
|
10
10
|
import type { useCalendarReturn, CalendarPickerProps, usePickerModeReturn } from '../Calendar.types'
|
|
11
11
|
import type { CalendarMonthAlias } from '../Month.helper'
|
|
@@ -10,9 +10,9 @@ import type { CalendarMonth, CalendarMonthAlias } from '../Month.helper'
|
|
|
10
10
|
|
|
11
11
|
const Container = styled.div`
|
|
12
12
|
display: grid;
|
|
13
|
+
grid-template-columns: repeat(3, 1fr);
|
|
13
14
|
grid-auto-rows: 3.75rem;
|
|
14
15
|
grid-gap: ${token('space-2xs')};
|
|
15
|
-
grid-template-columns: repeat(3, 1fr);
|
|
16
16
|
`
|
|
17
17
|
|
|
18
18
|
function getStatus(calendar: useCalendarReturn, month: CalendarMonth) {
|
|
@@ -19,20 +19,8 @@ const PickerButton = styled(BaseButton)<{
|
|
|
19
19
|
| 'selection'
|
|
20
20
|
| 'next-month-day'
|
|
21
21
|
}>`
|
|
22
|
-
${typography(
|
|
23
|
-
conditional({
|
|
24
|
-
body: whenProps({ $status: ['default', 'faded'] }),
|
|
25
|
-
'body-bold': whenProps({
|
|
26
|
-
$status: ['current-day', 'selection-start', 'selection', 'selection-end'],
|
|
27
|
-
}),
|
|
28
|
-
})
|
|
29
|
-
)}
|
|
30
|
-
|
|
31
|
-
user-select: none;
|
|
32
|
-
|
|
33
22
|
height: 100%;
|
|
34
|
-
|
|
35
|
-
border-radius: 0;
|
|
23
|
+
padding: ${token('space-xs')} ${token('space-s')};
|
|
36
24
|
|
|
37
25
|
color: ${conditional({
|
|
38
26
|
'color-neutral-lighter': whenProps({
|
|
@@ -42,30 +30,45 @@ const PickerButton = styled(BaseButton)<{
|
|
|
42
30
|
'color-neutral-dark': whenProps({ $status: 'next-month-day' }),
|
|
43
31
|
'color-accent': whenProps({ $status: 'current-day' }),
|
|
44
32
|
})};
|
|
45
|
-
|
|
33
|
+
visibility: ${conditional({
|
|
34
|
+
visible: whenProps({ 'aria-hidden': false }),
|
|
35
|
+
hidden: whenProps({ 'aria-hidden': true }),
|
|
36
|
+
})};
|
|
37
|
+
user-select: none;
|
|
46
38
|
background: ${conditional({
|
|
47
39
|
'color-transparent': whenProps({ $status: ['default', 'faded', 'next-month-day'] }),
|
|
48
40
|
'color-neutral-darker': whenProps({ $status: ['selection-start', 'selection-end'] }),
|
|
49
41
|
'color-neutral': whenProps({ $status: 'selection' }),
|
|
50
42
|
'color-neutral-lightest': whenProps({ $status: 'current-day' }),
|
|
51
43
|
})};
|
|
52
|
-
|
|
53
44
|
border-color: ${conditional({
|
|
54
45
|
'color-transparent': whenProps({ $status: ['default', 'faded', 'next-month-day'] }),
|
|
55
46
|
'color-neutral-darker': whenProps({ $status: ['selection-start', 'selection-end'] }),
|
|
56
47
|
'color-neutral': whenProps({ $status: 'selection' }),
|
|
57
48
|
'color-neutral-light': whenProps({ $status: 'current-day' }),
|
|
58
49
|
})};
|
|
50
|
+
border-radius: 0;
|
|
59
51
|
|
|
60
52
|
${conditional({
|
|
61
53
|
'opacity: 0.4;': whenProps({ $status: 'faded' }),
|
|
62
54
|
'opacity: 1;': whenProps({ $status: (status) => status !== 'faded' }),
|
|
63
55
|
})}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
${typography(
|
|
57
|
+
conditional({
|
|
58
|
+
body: whenProps({ $status: ['default', 'faded'] }),
|
|
59
|
+
'body-bold': whenProps({
|
|
60
|
+
$status: ['current-day', 'selection-start', 'selection', 'selection-end'],
|
|
61
|
+
}),
|
|
62
|
+
})
|
|
63
|
+
)}
|
|
67
64
|
${hoverable`
|
|
68
|
-
|
|
65
|
+
font-weight: ${token('font-weight-bold')};
|
|
66
|
+
color: ${conditional({
|
|
67
|
+
'color-neutral-dark': whenProps({ $status: ['default', 'faded'] }),
|
|
68
|
+
'color-neutral-lightest': whenProps({
|
|
69
|
+
$status: ['selection-start', 'selection', 'selection-end'],
|
|
70
|
+
}),
|
|
71
|
+
})};
|
|
69
72
|
background-color: ${conditional({
|
|
70
73
|
'color-transparent': whenProps({ $status: ['default', 'faded', 'next-month-day'] }),
|
|
71
74
|
'color-neutral-dark': whenProps({
|
|
@@ -73,14 +76,7 @@ const PickerButton = styled(BaseButton)<{
|
|
|
73
76
|
}),
|
|
74
77
|
'color-neutral-lightest': whenProps({ $status: 'current-day' }),
|
|
75
78
|
})};
|
|
76
|
-
color: ${
|
|
77
|
-
'color-neutral-dark': whenProps({ $status: ['default', 'faded'] }),
|
|
78
|
-
'color-neutral-lightest': whenProps({
|
|
79
|
-
$status: ['selection-start', 'selection', 'selection-end'],
|
|
80
|
-
}),
|
|
81
|
-
})};
|
|
82
|
-
|
|
83
|
-
font-weight: ${token('font-weight-bold')};
|
|
79
|
+
border-color: ${token('color-neutral')};
|
|
84
80
|
`}
|
|
85
81
|
|
|
86
82
|
${focusable`
|
|
@@ -89,31 +85,25 @@ const PickerButton = styled(BaseButton)<{
|
|
|
89
85
|
`}
|
|
90
86
|
|
|
91
87
|
${activatable`
|
|
92
|
-
border-color: ${token('color-neutral')};
|
|
93
|
-
background-color: ${conditional({
|
|
94
|
-
'color-transparent': whenProps({ 'aria-checked': false }),
|
|
95
|
-
'color-neutral': whenProps({ 'aria-checked': true }),
|
|
96
|
-
})};
|
|
97
88
|
color: ${conditional({
|
|
98
89
|
'color-neutral': whenProps({ 'aria-checked': false }),
|
|
99
90
|
'color-neutral-white': whenProps({ 'aria-checked': true }),
|
|
100
91
|
})};
|
|
92
|
+
background-color: ${conditional({
|
|
93
|
+
'color-transparent': whenProps({ 'aria-checked': false }),
|
|
94
|
+
'color-neutral': whenProps({ 'aria-checked': true }),
|
|
95
|
+
})};
|
|
96
|
+
border-color: ${token('color-neutral')};
|
|
101
97
|
`}
|
|
102
98
|
|
|
103
99
|
${disableable`
|
|
100
|
+
color: ${token('color-neutral-darker')};
|
|
104
101
|
background-color: ${token('color-transparent')};
|
|
105
102
|
border-color: ${conditional({
|
|
106
103
|
'color-neutral-darkest': whenProps({ 'aria-checked': true }),
|
|
107
104
|
'color-transparent': whenProps({ 'aria-checked': false }),
|
|
108
105
|
})};
|
|
109
|
-
|
|
110
|
-
color: ${token('color-neutral-darker')};
|
|
111
106
|
`}
|
|
112
|
-
|
|
113
|
-
visibility: ${conditional({
|
|
114
|
-
visible: whenProps({ 'aria-hidden': false }),
|
|
115
|
-
hidden: whenProps({ 'aria-hidden': true }),
|
|
116
|
-
})};
|
|
117
107
|
`
|
|
118
108
|
|
|
119
109
|
export default styled(PickerButton)({})
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
|
-
import generator from '
|
|
3
|
+
import generator from '../../../tests/generator'
|
|
4
4
|
import range from 'utils/toolset/range'
|
|
5
|
-
import renderer, { screen, fire } from '
|
|
5
|
+
import renderer, { screen, fire } from '../../../tests/renderer'
|
|
6
6
|
import YearPicker from './YearPicker'
|
|
7
|
+
import DateHelper from '../Date.helper'
|
|
7
8
|
|
|
8
9
|
import type { useCalendarReturn, CalendarPickerProps, usePickerModeReturn } from '../Calendar.types'
|
|
9
10
|
|
|
@@ -15,16 +16,17 @@ function getYearRange() {
|
|
|
15
16
|
|
|
16
17
|
describe('YearPicker', () => {
|
|
17
18
|
const mockedCalendar: useCalendarReturn = {
|
|
19
|
+
mode: 'single',
|
|
18
20
|
months: [
|
|
19
21
|
{
|
|
20
22
|
month: 10,
|
|
21
23
|
year: 2021,
|
|
22
24
|
days: [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
DateHelper('2021-11-01T12:00:00.000Z'),
|
|
26
|
+
DateHelper('2021-11-02T12:00:00.000Z'),
|
|
27
|
+
DateHelper('2021-11-03T12:00:00.000Z'),
|
|
28
|
+
DateHelper('2021-11-04T12:00:00.000Z'),
|
|
29
|
+
DateHelper('2021-11-05T12:00:00.000Z'),
|
|
28
30
|
],
|
|
29
31
|
},
|
|
30
32
|
],
|
|
@@ -9,9 +9,9 @@ import type { useCalendarReturn, CalendarPickerProps } from '../Calendar.types'
|
|
|
9
9
|
|
|
10
10
|
const Container = styled.div`
|
|
11
11
|
display: grid;
|
|
12
|
+
grid-template-columns: repeat(4, 1fr);
|
|
12
13
|
grid-auto-rows: 2.875rem;
|
|
13
14
|
grid-gap: ${token('space-2xs')};
|
|
14
|
-
grid-template-columns: repeat(4, 1fr);
|
|
15
15
|
`
|
|
16
16
|
|
|
17
17
|
const PickerButton = styled(DefaultPickerButton)`
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Story, Meta } from '@storybook/react/types-6-0'
|
|
2
|
+
import type { Story, Meta } from '@storybook/react/types-6-0'
|
|
3
3
|
|
|
4
4
|
import Card from './Card'
|
|
5
|
-
import generator from '
|
|
5
|
+
import generator from '../../tests/generator'
|
|
6
6
|
import Status from 'utils/types/Status'
|
|
7
7
|
|
|
8
8
|
import type { CardProps } from './Card'
|
|
@@ -3,8 +3,8 @@ import { composeStories } from '@storybook/testing-react'
|
|
|
3
3
|
|
|
4
4
|
import * as stories from './Card.stories'
|
|
5
5
|
import Card from './Card'
|
|
6
|
-
import generator from '
|
|
7
|
-
import renderer, { screen } from '
|
|
6
|
+
import generator from '../../tests/generator'
|
|
7
|
+
import renderer, { screen } from '../../tests/renderer'
|
|
8
8
|
import Status from 'utils/types/Status'
|
|
9
9
|
|
|
10
10
|
import type { CardProps } from './Card'
|
|
@@ -15,10 +15,10 @@ export interface CardProps extends HTMLAttributes<HTMLElement> {
|
|
|
15
15
|
|
|
16
16
|
const CardSubtitle = styled.div`
|
|
17
17
|
padding: 0 ${token('card-padding-x')} ${token('card-padding-y')};
|
|
18
|
+
font-size: ${token('card-subtitle-font-size')};
|
|
19
|
+
font-weight: ${token('card-subtitle-font-weight')};
|
|
18
20
|
|
|
19
21
|
color: ${token('card-color')};
|
|
20
|
-
font-weight: ${token('card-subtitle-font-weight')};
|
|
21
|
-
font-size: ${token('card-subtitle-font-size')};
|
|
22
22
|
`
|
|
23
23
|
|
|
24
24
|
const CardSeparator = styled.hr`
|
|
@@ -35,12 +35,13 @@ const CardBody = styled.div`
|
|
|
35
35
|
`
|
|
36
36
|
|
|
37
37
|
const Wrapper = styled.div`
|
|
38
|
-
${font({})}
|
|
39
|
-
|
|
40
38
|
display: flex;
|
|
41
39
|
flex-direction: row;
|
|
42
|
-
|
|
43
40
|
color: ${token('card-color')};
|
|
41
|
+
background: ${token('card-background')};
|
|
42
|
+
border: 1px solid ${token('card-border-color')};
|
|
43
|
+
border-radius: ${token('card-border-radius')};
|
|
44
|
+
${font({})}
|
|
44
45
|
|
|
45
46
|
${CardTitleWrapper} + ${CardSubtitle} {
|
|
46
47
|
margin-top: ${token('space-xs')};
|
|
@@ -49,10 +50,6 @@ const Wrapper = styled.div`
|
|
|
49
50
|
${CardTitleWrapper} + ${CardSeparator} {
|
|
50
51
|
margin-top: ${token('card-padding-y')};
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
border: 1px solid ${token('card-border-color')};
|
|
54
|
-
border-radius: ${token('card-border-radius')};
|
|
55
|
-
background: ${token('card-background')};
|
|
56
53
|
`
|
|
57
54
|
|
|
58
55
|
const Container = styled.div<{ flagged: boolean }>`
|
|
@@ -23,11 +23,11 @@ const Leading = styled(StyledSpan)`
|
|
|
23
23
|
const Wrapper = styled.div`
|
|
24
24
|
|
|
25
25
|
padding: ${token('card-padding-y')} ${token('card-padding-x')} 0;
|
|
26
|
-
|
|
27
|
-
color: ${token('card-color')};
|
|
28
|
-
font-weight: ${token('card-title-font-weight')};
|
|
29
26
|
font-size: ${token('card-title-font-size')};
|
|
27
|
+
font-weight: ${token('card-title-font-weight')};
|
|
30
28
|
line-height: ${token('card-title-font-height')};
|
|
29
|
+
|
|
30
|
+
color: ${token('card-color')};
|
|
31
31
|
`
|
|
32
32
|
|
|
33
33
|
function CardTitle({ children, leading, ...others }: CardTitleProps): JSX.Element {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
|
|
3
3
|
import Checkbox from './Checkbox'
|
|
4
|
-
import generator from '
|
|
5
|
-
import renderer, { fire } from '
|
|
4
|
+
import generator from '../../tests/generator'
|
|
5
|
+
import renderer, { fire } from '../../tests/renderer'
|
|
6
6
|
|
|
7
7
|
const setup = ({ ...overrides }) => renderer(<Checkbox {...overrides} />).render()
|
|
8
8
|
|