@registrucentras/rc-ses-react-components 2.7.2 → 3.0.0-rc.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/assets/icons/phosphorIcons.d.ts +24 -0
- package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +2 -1
- package/dist/components/common/Accordion/index.d.ts +18 -4
- package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +1 -0
- package/dist/components/common/Card/index.d.ts +3 -0
- package/dist/components/common/CheckboxMark/index.d.ts +8 -0
- package/dist/components/common/DataPagination/components/ExpandButton.d.ts +7 -0
- package/dist/components/common/DataPagination/components/PaginationButton.d.ts +2 -1
- package/dist/components/common/DataPagination/index.d.ts +13 -3
- package/dist/components/common/DataPagination/paginationModel.d.ts +4 -0
- package/dist/components/common/Divider/index.d.ts +6 -0
- package/dist/components/common/EmptyState/index.d.ts +21 -0
- package/dist/components/common/IconWithSquareBackground/index.d.ts +2 -2
- package/dist/components/common/ImageCard/index.d.ts +5 -0
- package/dist/components/common/LinkTile/index.d.ts +11 -0
- package/dist/components/common/RadioMark/index.d.ts +8 -0
- package/dist/components/common/StepCard/StepCardFooter/index.d.ts +1 -1
- package/dist/components/common/TitleBlock/types.d.ts +4 -2
- package/dist/components/form/components/FormControlWrapper/index.d.ts +2 -1
- package/dist/components/form/inputs/Datepicker/RangeDatepicker.d.ts +23 -0
- package/dist/components/form/inputs/Datepicker/SingleDatepicker.d.ts +24 -0
- package/dist/components/form/inputs/Datepicker/components/CalendarViewsHeader.d.ts +18 -0
- package/dist/components/form/inputs/Datepicker/index.d.ts +10 -14
- package/dist/components/form/inputs/Datepicker/rangeModel.d.ts +4 -0
- package/dist/components/form/inputs/FileDropzone.d.ts +2 -2
- package/dist/components/form/inputs/RadioButtonGroup.d.ts +1 -0
- package/dist/components/form/inputs/Select/Select.styles.d.ts +84 -0
- package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +2 -1
- package/dist/components/form/inputs/TextField.d.ts +27 -12
- package/dist/components/form/inputs/TextField.styles.d.ts +101 -0
- package/dist/components/layout/ServiceWizardStepper/stepperTokens.d.ts +5 -0
- package/dist/components/loaders/Loader/index.d.ts +12 -9
- package/dist/components/overlays/BottomSheet/index.d.ts +3 -2
- package/dist/components/overlays/Dialog/index.d.ts +1 -1
- package/dist/components/storybook/FileUploadTokenPreview.d.ts +4 -0
- package/dist/components/storybook/TabsTokenPreview.d.ts +3 -0
- package/dist/components/storybook/TokenDocs.d.ts +74 -0
- package/dist/library/index.d.ts +30 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +2 -2
- package/dist/registrucentras-rc-ses-react-components.js +11144 -8374
- package/dist/theme/backdropTokens.d.ts +6 -0
- package/dist/theme/borderTokens.d.ts +33 -0
- package/dist/theme/cards.d.ts +42 -73
- package/dist/theme/colorTokens.d.ts +146 -0
- package/dist/theme/effectTokens.d.ts +9 -0
- package/dist/theme/layoutTokens.d.ts +12 -0
- package/dist/theme/light/MuiAccordion.d.ts +2 -2
- package/dist/theme/light/MuiAccordionSummary.d.ts +19 -0
- package/dist/theme/light/MuiButton.d.ts +7 -0
- package/dist/theme/light/MuiInputBase.d.ts +2 -0
- package/dist/theme/light/MuiPickerPopper.d.ts +3 -0
- package/dist/theme/light/MuiTypography.d.ts +0 -14
- package/dist/theme/palette.d.ts +8 -0
- package/dist/theme/sizeTokens.d.ts +20 -0
- package/dist/theme/spacingRoleBasedTokens.d.ts +38 -0
- package/dist/theme/spacingTokens.d.ts +97 -0
- package/dist/theme/tokenTheme.d.ts +13 -0
- package/dist/theme/typographyTokens.d.ts +104 -0
- package/package.json +2 -2
- package/src/assets/icons/phosphorIcons.ts +11 -0
- package/src/components/common/Accordion/hooks/useAccordionController.tsx +39 -7
- package/src/components/common/Accordion/index.test.tsx +132 -0
- package/src/components/common/Accordion/index.tsx +302 -25
- package/src/components/common/Accordion/types/AccordionControllerState.ts +1 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +3 -3
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +8 -3
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +3 -2
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.test.tsx +3 -3
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.tsx +23 -19
- package/src/components/common/AdvancedList/index.test.tsx +4 -2
- package/src/components/common/Alert/index.tsx +10 -6
- package/src/components/common/Badge/index.tsx +50 -37
- package/src/components/common/Button/index.tsx +12 -10
- package/src/components/common/Card/index.tsx +6 -1
- package/src/components/common/CardShell/index.test.tsx +16 -6
- package/src/components/common/CheckboxMark/index.tsx +86 -0
- package/src/components/common/DataPagination/components/DataPaginationSkeleton.tsx +9 -7
- package/src/components/common/DataPagination/components/ExpandButton.tsx +48 -0
- package/src/components/common/DataPagination/components/PaginationButton.tsx +48 -21
- package/src/components/common/DataPagination/index.test.tsx +229 -12
- package/src/components/common/DataPagination/index.tsx +135 -60
- package/src/components/common/DataPagination/paginationModel.ts +35 -0
- package/src/components/common/Divider/index.test.tsx +33 -0
- package/src/components/common/Divider/index.tsx +52 -0
- package/src/components/common/EmptyState/index.test.tsx +56 -0
- package/src/components/common/EmptyState/index.tsx +211 -0
- package/src/components/common/FilterChip/index.tsx +24 -19
- package/src/components/common/IconWithCircularBackground.tsx +24 -6
- package/src/components/common/IconWithSquareBackground/index.test.tsx +14 -2
- package/src/components/common/IconWithSquareBackground/index.tsx +36 -17
- package/src/components/common/ImageCard/index.test.tsx +16 -0
- package/src/components/common/ImageCard/index.tsx +54 -1
- package/src/components/common/LinkTile/index.test.tsx +57 -0
- package/src/components/common/LinkTile/index.tsx +136 -0
- package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +39 -23
- package/src/components/common/ListWithIcons/index.test.tsx +20 -9
- package/src/components/common/ListWithIcons/index.tsx +6 -6
- package/src/components/common/Popover/index.tsx +11 -1
- package/src/components/common/RadioMark/index.tsx +76 -0
- package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +49 -25
- package/src/components/common/SegmentedControl/index.tsx +10 -6
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +7 -5
- package/src/components/common/SelectableCardList/index.test.tsx +8 -6
- package/src/components/common/SelectionMarks.test.tsx +92 -0
- package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +20 -11
- package/src/components/common/ServiceLinks/index.tsx +3 -3
- package/src/components/common/SideNav/SideNavLayout.tsx +6 -1
- package/src/components/common/SideNav/components/SideNavPill.tsx +24 -12
- package/src/components/common/SideNav/components/SideNavPillList.tsx +18 -12
- package/src/components/common/SideNav/components/SideNavRow.tsx +22 -15
- package/src/components/common/SideNav/index.tsx +10 -9
- package/src/components/common/Snackbar/config.ts +27 -8
- package/src/components/common/Snackbar/index.tsx +39 -16
- package/src/components/common/StepCard/StepCardFooter/index.tsx +28 -6
- package/src/components/common/StepCard/index.tsx +18 -6
- package/src/components/common/Switch/index.tsx +10 -4
- package/src/components/common/Tabs/TabPanel.tsx +6 -3
- package/src/components/common/Tabs/TabsWrapper.tsx +15 -7
- package/src/components/common/TitleBlock/index.test.tsx +14 -17
- package/src/components/common/TitleBlock/index.tsx +120 -15
- package/src/components/common/TitleBlock/types.ts +4 -2
- package/src/components/common/Tooltip/index.tsx +32 -3
- package/src/components/form/components/FormControlWrapper/index.tsx +43 -14
- package/src/components/form/inputs/CheckboxFormControl.tsx +25 -13
- package/src/components/form/inputs/Datepicker/RangeDatepicker.tsx +356 -0
- package/src/components/form/inputs/Datepicker/SingleDatepicker.tsx +207 -0
- package/src/components/form/inputs/Datepicker/components/CalendarViewsHeader.tsx +335 -0
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.tsx +22 -10
- package/src/components/form/inputs/Datepicker/index.test.tsx +23 -18
- package/src/components/form/inputs/Datepicker/index.tsx +20 -150
- package/src/components/form/inputs/Datepicker/rangeModel.test.ts +35 -0
- package/src/components/form/inputs/Datepicker/rangeModel.ts +25 -0
- package/src/components/form/inputs/FileDropzone.tsx +73 -46
- package/src/components/form/inputs/FileUpload.tsx +25 -16
- package/src/components/form/inputs/NumberStepper.tsx +36 -14
- package/src/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.tsx +10 -5
- package/src/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.tsx +7 -1
- package/src/components/form/inputs/PhoneInputFormControl/components/PopperComponent.tsx +5 -2
- package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +9 -5
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +48 -24
- package/src/components/form/inputs/RadioButtonGroup.tsx +14 -6
- package/src/components/form/inputs/Select/Select.styles.ts +76 -0
- package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +6 -33
- package/src/components/form/inputs/Select/index.tsx +124 -86
- package/src/components/form/inputs/SimpleCheckbox.tsx +10 -3
- package/src/components/form/inputs/TextField.presets.test.tsx +284 -0
- package/src/components/form/inputs/TextField.styles.ts +96 -0
- package/src/components/form/inputs/TextField.test.tsx +153 -0
- package/src/components/form/inputs/TextField.tsx +315 -42
- package/src/components/layout/Footer/index.test.tsx +1 -1
- package/src/components/layout/Footer/index.tsx +17 -7
- package/src/components/layout/ServiceFormActions.tsx +5 -1
- package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +3 -3
- package/src/components/layout/ServiceHeader.tsx +19 -19
- package/src/components/layout/ServiceWizardStepper/ServiceWizardStepper.css +10 -10
- package/src/components/layout/ServiceWizardStepper/StepConnector.tsx +8 -5
- package/src/components/layout/ServiceWizardStepper/components/CustomStepIcon.tsx +22 -7
- package/src/components/layout/ServiceWizardStepper/components/HorizontalStepperButton.tsx +15 -11
- package/src/components/layout/ServiceWizardStepper/components/StyledStepLabel.tsx +28 -11
- package/src/components/layout/ServiceWizardStepper/stepperTokens.ts +8 -0
- package/src/components/loaders/FullPageLoader/index.test.tsx +18 -7
- package/src/components/loaders/FullPageLoader/index.tsx +14 -9
- package/src/components/loaders/Loader/index.tsx +48 -17
- package/src/components/overlays/BottomSheet/index.test.tsx +36 -3
- package/src/components/overlays/BottomSheet/index.tsx +54 -21
- package/src/components/overlays/Dialog/index.tsx +5 -23
- package/src/components/overlays/Drawer/index.tsx +29 -14
- package/src/components/overlays/Modal/index.tsx +46 -8
- package/src/components/storybook/FileUploadTokenPreview.tsx +68 -0
- package/src/components/storybook/TabsTokenPreview.tsx +58 -0
- package/src/components/storybook/TokenDocs.tsx +347 -0
- package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +5 -1
- package/src/i18n/namespaces/input/en.json +48 -4
- package/src/i18n/namespaces/input/lt.json +48 -4
- package/src/library/index.ts +50 -0
- package/src/stories/atoms/Badge.stories.tsx +2 -1
- package/src/stories/atoms/Button.stories.tsx +124 -6
- package/src/stories/atoms/CheckboxMark.stories.tsx +79 -0
- package/src/stories/atoms/Divider.stories.tsx +129 -0
- package/src/stories/atoms/FilterChip.stories.tsx +9 -1
- package/src/stories/atoms/IconWithSquareBackground.stories.tsx +7 -7
- package/src/stories/atoms/Icons.stories.tsx +1 -1
- package/src/stories/atoms/NumberStepper.stories.tsx +44 -0
- package/src/stories/atoms/PhoneInput.stories.tsx +42 -0
- package/src/stories/atoms/RadioMark.stories.tsx +132 -0
- package/src/stories/atoms/Select.stories.tsx +139 -2
- package/src/stories/atoms/SimpleCheckbox.stories.tsx +74 -0
- package/src/stories/atoms/Switch.stories.tsx +46 -1
- package/src/stories/atoms/TextField.stories.tsx +508 -0
- package/src/stories/atoms/Tooltip.stories.tsx +5 -0
- package/src/stories/fixtures/foundations/Borders.stories.tsx +84 -0
- package/src/stories/fixtures/foundations/Effects.stories.tsx +204 -0
- package/src/stories/fixtures/foundations/Layout.stories.tsx +76 -0
- package/src/stories/fixtures/foundations/Sizes.stories.tsx +42 -0
- package/src/stories/fixtures/foundations/Spacing.stories.tsx +48 -0
- package/src/stories/fixtures/foundations/Typography.stories.tsx +49 -0
- package/src/stories/foundations/Borders.stories.tsx +179 -0
- package/src/stories/foundations/Colors.stories.tsx +253 -0
- package/src/stories/foundations/Effects.stories.tsx +116 -0
- package/src/stories/foundations/Layout.stories.tsx +177 -0
- package/src/stories/foundations/Sizes.stories.tsx +123 -0
- package/src/stories/foundations/Spacing.stories.tsx +159 -0
- package/src/stories/foundations/ThemeAdapter.stories.tsx +389 -0
- package/src/stories/foundations/Typography.stories.tsx +148 -0
- package/src/stories/molecules/Alert.stories.tsx +18 -0
- package/src/stories/molecules/Breadcrumbs.stories.tsx +51 -0
- package/src/stories/molecules/Card.stories.tsx +1 -1
- package/src/stories/molecules/CardShell.stories.tsx +1 -0
- package/src/stories/molecules/DatePicker.stories.tsx +133 -3
- package/src/stories/molecules/EmptyState.stories.tsx +106 -0
- package/src/stories/molecules/FormControlWrapper.stories.tsx +59 -0
- package/src/stories/molecules/LinkTile.stories.tsx +151 -0
- package/src/stories/molecules/ListWithIcons.stories.tsx +27 -2
- package/src/stories/molecules/RadioButtonGroup.stories.tsx +23 -0
- package/src/stories/molecules/SegmentedControl.stories.tsx +62 -1
- package/src/stories/molecules/Tabs.stories.tsx +4 -0
- package/src/stories/molecules/TitleBlock.stories.tsx +16 -16
- package/src/stories/organisms/Accordion.stories.tsx +132 -0
- package/src/stories/organisms/AdvancedListItemShell.stories.tsx +63 -23
- package/src/stories/organisms/BottomSheet.stories.tsx +48 -1
- package/src/stories/organisms/DataPagination.stories.tsx +127 -3
- package/src/stories/organisms/Dialog.stories.tsx +13 -0
- package/src/stories/organisms/FileDropzone.stories.tsx +6 -0
- package/src/stories/organisms/FileUpload.stories.tsx +4 -0
- package/src/stories/organisms/Footer.stories.tsx +20 -0
- package/src/stories/organisms/Modal.stories.tsx +53 -0
- package/src/stories/organisms/ServiceHeader.stories.tsx +25 -3
- package/src/stories/organisms/ServiceLinks.stories.tsx +1 -1
- package/src/stories/organisms/ServiceWizardStepper.stories.tsx +37 -1
- package/src/stories/organisms/SideNav.stories.tsx +8 -1
- package/src/theme/backdropTokens.test.ts +11 -0
- package/src/theme/backdropTokens.ts +11 -0
- package/src/theme/borderTokens.test.ts +59 -0
- package/src/theme/borderTokens.ts +36 -0
- package/src/theme/cards.ts +28 -28
- package/src/theme/colorTokens.test.ts +66 -0
- package/src/theme/colorTokens.ts +87 -0
- package/src/theme/effectTokens.test.ts +29 -0
- package/src/theme/effectTokens.ts +11 -0
- package/src/theme/layoutTokens.test.ts +42 -0
- package/src/theme/layoutTokens.ts +14 -0
- package/src/theme/light/MuiAccordion.tsx +30 -26
- package/src/theme/light/MuiAccordionDetails.ts +10 -5
- package/src/theme/light/MuiAccordionSummary.tsx +31 -17
- package/src/theme/light/MuiAlert.tsx +42 -65
- package/src/theme/light/MuiAutocomplete.ts +14 -7
- package/src/theme/light/MuiBreadcrumbs.tsx +17 -9
- package/src/theme/light/MuiButton.tsx +213 -204
- package/src/theme/light/MuiCard.tsx +5 -4
- package/src/theme/light/MuiCheckbox.ts +45 -14
- package/src/theme/light/MuiChip.tsx +3 -1
- package/src/theme/light/MuiDialog.ts +45 -6
- package/src/theme/light/MuiFormControl.ts +19 -9
- package/src/theme/light/MuiFormControlLabel.ts +16 -25
- package/src/theme/light/MuiFormGroup.ts +29 -26
- package/src/theme/light/MuiFormHelperText.ts +15 -4
- package/src/theme/light/MuiFormLabel.ts +20 -20
- package/src/theme/light/MuiInputBase.ts +49 -84
- package/src/theme/light/MuiOutlinedInput.ts +50 -6
- package/src/theme/light/MuiPagination.ts +21 -21
- package/src/theme/light/MuiPickerPopper.ts +17 -0
- package/src/theme/light/MuiPickersLayout.ts +63 -34
- package/src/theme/light/MuiPickersOutlinedInput.ts +38 -38
- package/src/theme/light/MuiPopover.ts +3 -1
- package/src/theme/light/MuiRadio.tsx +35 -52
- package/src/theme/light/MuiStepper.ts +21 -17
- package/src/theme/light/MuiSwitch.tsx +27 -23
- package/src/theme/light/MuiTab.tsx +27 -18
- package/src/theme/light/MuiTableCell.ts +4 -2
- package/src/theme/light/MuiTabs.tsx +11 -9
- package/src/theme/light/MuiTooltip.ts +2 -1
- package/src/theme/light/MuiTypography.tsx +0 -17
- package/src/theme/light/index.tsx +2 -0
- package/src/theme/light/themePalette.tsx +1 -0
- package/src/theme/palette.tsx +9 -0
- package/src/theme/sizeTokens.test.ts +37 -0
- package/src/theme/sizeTokens.ts +21 -0
- package/src/theme/spacingRoleBasedTokens.ts +41 -0
- package/src/theme/spacingTokens.test.ts +58 -0
- package/src/theme/spacingTokens.ts +114 -0
- package/src/theme/tokenTheme.test.tsx +402 -0
- package/src/theme/tokenTheme.ts +429 -0
- package/src/theme/tokens.css +476 -0
- package/src/theme/tokens.test.ts +174 -0
- package/src/theme/typographyTokens.test.ts +120 -0
- package/src/theme/typographyTokens.ts +119 -0
- package/dist/theme/spacing.d.ts +0 -4
- package/src/stories/foundations/Colors.mdx +0 -127
- package/src/theme/spacing.ts +0 -5
|
@@ -7,8 +7,10 @@ import { lt } from 'date-fns/locale/lt'
|
|
|
7
7
|
import { useForm } from 'react-hook-form'
|
|
8
8
|
import { describe, expect, test } from 'vitest'
|
|
9
9
|
|
|
10
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
11
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
10
12
|
import theme from '@/theme/light'
|
|
11
|
-
import
|
|
13
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
12
14
|
|
|
13
15
|
import RcSesDatepicker from '.'
|
|
14
16
|
|
|
@@ -47,28 +49,30 @@ function Harness({ value = null, maxDate }: HarnessProps) {
|
|
|
47
49
|
)
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
|
|
51
|
-
const n = parseInt(hex.slice(1), 16)
|
|
52
|
-
// eslint-disable-next-line no-bitwise
|
|
53
|
-
return `rgb(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255})`
|
|
54
|
-
}
|
|
55
|
-
|
|
52
|
+
// JSDOM preserves var() references; resolved colours and live updates are tested in Playwright.
|
|
56
53
|
const dayColour = (label: string) =>
|
|
57
54
|
window.getComputedStyle(screen.getByRole('gridcell', { name: label })).color
|
|
58
55
|
|
|
59
56
|
describe('RcSesDatepicker calendar day colours', () => {
|
|
57
|
+
test('day numbers use the Body/Regular typography role', () => {
|
|
58
|
+
render(<Harness />)
|
|
59
|
+
const style = window.getComputedStyle(screen.getByRole('gridcell', { name: '19' }))
|
|
60
|
+
expect(style.fontSize).toBe(typographyTokens['font-size-body-regular'])
|
|
61
|
+
expect(style.lineHeight).toBe(typographyTokens['line-height-body-regular'])
|
|
62
|
+
})
|
|
63
|
+
|
|
60
64
|
// Pinned here rather than left to the visual suite: a colour-only change on a
|
|
61
65
|
// few glyphs stays under its diff budget.
|
|
62
66
|
test('a selectable weekday uses the default day colour', () => {
|
|
63
67
|
render(<Harness maxDate={MAX} />)
|
|
64
68
|
|
|
65
|
-
expect(dayColour('19')).toBe(
|
|
69
|
+
expect(dayColour('19')).toBe(colorTokens['text-default'])
|
|
66
70
|
})
|
|
67
71
|
|
|
68
72
|
test('a disabled weekday is greyed out', () => {
|
|
69
73
|
render(<Harness maxDate={MAX} />)
|
|
70
74
|
|
|
71
|
-
expect(dayColour('21')).toBe(
|
|
75
|
+
expect(dayColour('21')).toBe(colorTokens['text-muted'])
|
|
72
76
|
})
|
|
73
77
|
|
|
74
78
|
// 1.x paints it white; v9 lost that to the theme's day colour.
|
|
@@ -78,14 +82,14 @@ describe('RcSesDatepicker calendar day colours', () => {
|
|
|
78
82
|
const selected = document.querySelector('.Mui-selected') as HTMLElement
|
|
79
83
|
const cs = window.getComputedStyle(selected)
|
|
80
84
|
|
|
81
|
-
expect(cs.backgroundColor).toBe(
|
|
82
|
-
expect(cs.color).toBe(
|
|
85
|
+
expect(cs.backgroundColor).toBe(colorTokens['control-selected'])
|
|
86
|
+
expect(cs.color).toBe(colorTokens['text-inverse'])
|
|
83
87
|
})
|
|
84
88
|
|
|
85
|
-
test('a disabled weekend
|
|
89
|
+
test('a disabled weekend preserves the existing red distinction through a token', () => {
|
|
86
90
|
render(<Harness maxDate={MAX} />)
|
|
87
91
|
|
|
88
|
-
expect(dayColour('24')).toBe(
|
|
92
|
+
expect(dayColour('24')).toBe('var(--rc-color-red-600)')
|
|
89
93
|
})
|
|
90
94
|
})
|
|
91
95
|
|
|
@@ -98,8 +102,8 @@ describe('RcSesDatepicker field styling', () => {
|
|
|
98
102
|
const field = document.querySelector('.MuiPickersInputBase-root') as HTMLElement
|
|
99
103
|
const cs = window.getComputedStyle(field)
|
|
100
104
|
|
|
101
|
-
expect(cs.borderRadius).toBe('
|
|
102
|
-
expect(cs.backgroundColor).toBe(
|
|
105
|
+
expect(cs.borderRadius).toBe(borderTokens['radius-input'])
|
|
106
|
+
expect(cs.backgroundColor).toBe(colorTokens['surface-base'])
|
|
103
107
|
})
|
|
104
108
|
|
|
105
109
|
test('the value text matches a plain input', () => {
|
|
@@ -110,8 +114,9 @@ describe('RcSesDatepicker field styling', () => {
|
|
|
110
114
|
) as HTMLElement
|
|
111
115
|
const cs = window.getComputedStyle(sections)
|
|
112
116
|
|
|
113
|
-
expect(cs.fontSize).toBe('
|
|
114
|
-
expect(cs.
|
|
115
|
-
expect(cs.
|
|
117
|
+
expect(cs.fontSize).toBe(typographyTokens['font-size-body-regular'])
|
|
118
|
+
expect(cs.lineHeight).toBe(typographyTokens['line-height-body-regular'])
|
|
119
|
+
expect(cs.height).toBe(typographyTokens['line-height-body-regular'])
|
|
120
|
+
expect(cs.color).toBe(colorTokens['text-default'])
|
|
116
121
|
})
|
|
117
122
|
})
|
|
@@ -1,153 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from '../../components/FormControlWrapper'
|
|
18
|
-
import RcSesDatepickerActionBar from './components/RcSesDatepickerActionBar'
|
|
19
|
-
import RcSesDatepickerCalendarHeader from './components/RcSesDatepickerCalendarHeader'
|
|
20
|
-
|
|
21
|
-
type TFieldProps = UseControllerProps<any, any>
|
|
22
|
-
type TWrapperProps = RcSesFormControlWrapperProps
|
|
23
|
-
type ImmediateWrapperProps = 'label' | 'errors'
|
|
24
|
-
|
|
25
|
-
type Props = TFieldProps &
|
|
26
|
-
Pick<TWrapperProps, ImmediateWrapperProps> & {
|
|
27
|
-
id?: string
|
|
28
|
-
clearable?: boolean
|
|
29
|
-
slotProps?: {
|
|
30
|
-
datepicker?: DatePickerProps
|
|
31
|
-
wrapper?: Partial<Omit<TWrapperProps, ImmediateWrapperProps>>
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import RangeDatepicker, { RangeDatepickerProps } from './RangeDatepicker'
|
|
4
|
+
import SingleDatepicker, { SingleDatepickerProps } from './SingleDatepicker'
|
|
5
|
+
|
|
6
|
+
export type { DateRangeValue } from './rangeModel'
|
|
7
|
+
export type { RangeDatepickerProps }
|
|
8
|
+
export type DatepickerProps =
|
|
9
|
+
| (SingleDatepickerProps & { selection?: 'single' })
|
|
10
|
+
| (RangeDatepickerProps & { selection: 'range' })
|
|
11
|
+
|
|
12
|
+
const RcSesDatepicker = React.forwardRef<HTMLInputElement, DatepickerProps>(
|
|
13
|
+
(props, ref) => {
|
|
14
|
+
if (props.selection === 'range') {
|
|
15
|
+
const { selection, ...rangeProps } = props
|
|
16
|
+
return <RangeDatepicker {...rangeProps} ref={ref} />
|
|
32
17
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const upMd = useMediaQuery(theme.breakpoints.up('md'))
|
|
38
|
-
|
|
39
|
-
const { id: idProp, clearable, errors, label, slotProps, ...controllerProps } = props
|
|
40
|
-
|
|
41
|
-
// v9 no longer exports MuiPickersAdapterContext from LocalizationProvider;
|
|
42
|
-
// usePickerAdapter is the public replacement for the `utils` adapter.
|
|
43
|
-
const dateAdapter = usePickerAdapter()
|
|
44
|
-
|
|
45
|
-
const {
|
|
46
|
-
field: { onChange, value, disabled },
|
|
47
|
-
} = useController(controllerProps)
|
|
48
|
-
|
|
49
|
-
const id = useMemo(() => idProp ?? uuidv4(), [idProp])
|
|
50
|
-
|
|
51
|
-
const [modelValue, setModelValue] = React.useState<Date | null>(
|
|
52
|
-
value ? parseISO(value) : null,
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
const handleOnChange = (newValue: Date | null) => {
|
|
56
|
-
try {
|
|
57
|
-
onChange((newValue && fromZonedTime(newValue, 'UTC').toISOString()) ?? '')
|
|
58
|
-
} catch {
|
|
59
|
-
onChange(null)
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
useEffect(() => {
|
|
64
|
-
if (value !== modelValue) setModelValue(value ? parseISO(value) : null)
|
|
65
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
|
-
}, [value])
|
|
67
|
-
|
|
68
|
-
return (
|
|
69
|
-
<RcSesFormControlWrapper
|
|
70
|
-
id={id}
|
|
71
|
-
errors={errors}
|
|
72
|
-
label={label}
|
|
73
|
-
required={!!props?.rules?.required}
|
|
74
|
-
{...slotProps?.wrapper}
|
|
75
|
-
>
|
|
76
|
-
<DatePicker
|
|
77
|
-
inputRef={ref}
|
|
78
|
-
closeOnSelect
|
|
79
|
-
dayOfWeekFormatter={(date: Date) =>
|
|
80
|
-
dateAdapter.format(date, 'weekdayShort').substring(0, 2)
|
|
81
|
-
}
|
|
82
|
-
disabled={disabled}
|
|
83
|
-
onChange={handleOnChange}
|
|
84
|
-
openTo='day'
|
|
85
|
-
showDaysOutsideCurrentMonth
|
|
86
|
-
slots={{
|
|
87
|
-
actionBar: RcSesDatepickerActionBar,
|
|
88
|
-
calendarHeader: RcSesDatepickerCalendarHeader,
|
|
89
|
-
openPickerIcon: CalendarBlankIcon,
|
|
90
|
-
}}
|
|
91
|
-
{...(slotProps?.datepicker ?? {})}
|
|
92
|
-
slotProps={{
|
|
93
|
-
actionBar: {
|
|
94
|
-
actions: ['cancel'],
|
|
95
|
-
...(slotProps?.datepicker?.slotProps?.actionBar ?? {}),
|
|
96
|
-
},
|
|
97
|
-
inputAdornment: {
|
|
98
|
-
position: 'start',
|
|
99
|
-
sx: { mr: '0 !important' },
|
|
100
|
-
...(slotProps?.datepicker?.slotProps?.inputAdornment ?? {}),
|
|
101
|
-
},
|
|
102
|
-
textField: {
|
|
103
|
-
id,
|
|
104
|
-
error: !!errors,
|
|
105
|
-
fullWidth: true,
|
|
106
|
-
...(slotProps?.datepicker?.slotProps?.textField ?? {}),
|
|
107
|
-
|
|
108
|
-
slotProps: {
|
|
109
|
-
input: {
|
|
110
|
-
...(!upMd
|
|
111
|
-
? {
|
|
112
|
-
startAdornment: (
|
|
113
|
-
<InputAdornment
|
|
114
|
-
aria-label={t('aria.openCalendar')}
|
|
115
|
-
position='start'
|
|
116
|
-
sx={{ mr: 0 }}
|
|
117
|
-
>
|
|
118
|
-
<IconButton>
|
|
119
|
-
<CalendarBlankIcon />
|
|
120
|
-
</IconButton>
|
|
121
|
-
</InputAdornment>
|
|
122
|
-
),
|
|
123
|
-
}
|
|
124
|
-
: {}),
|
|
125
|
-
endAdornment: !!value && clearable && (
|
|
126
|
-
<InputAdornment position='end'>
|
|
127
|
-
<IconButton
|
|
128
|
-
aria-label={t('aria.clearValue')}
|
|
129
|
-
onClick={() => handleOnChange(null)}
|
|
130
|
-
>
|
|
131
|
-
<XCircleFillIcon />
|
|
132
|
-
</IconButton>
|
|
133
|
-
</InputAdornment>
|
|
134
|
-
),
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
toolbar: { hidden: true },
|
|
139
|
-
}}
|
|
140
|
-
value={modelValue}
|
|
141
|
-
sx={{
|
|
142
|
-
'.MuiInputBase-input': {
|
|
143
|
-
paddingLeft: 0,
|
|
144
|
-
paddingRight: 0,
|
|
145
|
-
},
|
|
146
|
-
...(slotProps?.datepicker?.sx ?? {}),
|
|
147
|
-
}}
|
|
148
|
-
/>
|
|
149
|
-
</RcSesFormControlWrapper>
|
|
150
|
-
)
|
|
151
|
-
})
|
|
18
|
+
const { selection, ...singleProps } = props
|
|
19
|
+
return <SingleDatepicker {...singleProps} ref={ref} />
|
|
20
|
+
},
|
|
21
|
+
)
|
|
152
22
|
|
|
153
23
|
export default RcSesDatepicker
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest'
|
|
2
|
+
|
|
3
|
+
import { readRange, selectRange } from './rangeModel'
|
|
4
|
+
|
|
5
|
+
describe('DatePicker range model', () => {
|
|
6
|
+
test('starts a new range and preserves a partial selection', () => {
|
|
7
|
+
expect(selectRange([null, null], new Date(2026, 5, 10))).toEqual(['2026-06-10', null])
|
|
8
|
+
expect(readRange(['2026-06-10', null])).toEqual(['2026-06-10', null])
|
|
9
|
+
})
|
|
10
|
+
test('normalizes reverse selection and supports one-day ranges', () => {
|
|
11
|
+
expect(selectRange(['2026-06-17', null], new Date(2026, 5, 10))).toEqual([
|
|
12
|
+
'2026-06-10',
|
|
13
|
+
'2026-06-17',
|
|
14
|
+
])
|
|
15
|
+
expect(selectRange(['2026-06-10', null], new Date(2026, 5, 10))).toEqual([
|
|
16
|
+
'2026-06-10',
|
|
17
|
+
'2026-06-10',
|
|
18
|
+
])
|
|
19
|
+
})
|
|
20
|
+
test('restarts after a complete selection and spans years', () => {
|
|
21
|
+
expect(selectRange(['2026-06-10', '2026-06-17'], new Date(2026, 11, 31))).toEqual([
|
|
22
|
+
'2026-12-31',
|
|
23
|
+
null,
|
|
24
|
+
])
|
|
25
|
+
expect(selectRange(['2026-12-31', null], new Date(2027, 0, 5))).toEqual([
|
|
26
|
+
'2026-12-31',
|
|
27
|
+
'2027-01-05',
|
|
28
|
+
])
|
|
29
|
+
})
|
|
30
|
+
test('rejects malformed form values without crashing', () => {
|
|
31
|
+
expect(readRange(undefined)).toEqual([null, null])
|
|
32
|
+
expect(readRange(['invalid', '2026-06-10'])).toEqual([null, null])
|
|
33
|
+
expect(readRange(['2026-06-17', '2026-06-10'])).toEqual(['2026-06-10', '2026-06-17'])
|
|
34
|
+
})
|
|
35
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { format, isValid, parseISO } from 'date-fns'
|
|
2
|
+
|
|
3
|
+
/** Local calendar dates, without timezone conversion. Partial selection is supported. */
|
|
4
|
+
export type DateRangeValue = [string | null, string | null]
|
|
5
|
+
|
|
6
|
+
export function readRange(value: unknown): DateRangeValue {
|
|
7
|
+
if (!Array.isArray(value)) return [null, null]
|
|
8
|
+
const valid = (item: unknown) =>
|
|
9
|
+
typeof item === 'string' &&
|
|
10
|
+
/^\d{4}-\d{2}-\d{2}$/.test(item) &&
|
|
11
|
+
isValid(parseISO(item))
|
|
12
|
+
? item
|
|
13
|
+
: null
|
|
14
|
+
const start = valid(value[0])
|
|
15
|
+
const end = valid(value[1])
|
|
16
|
+
if (!start) return [null, null]
|
|
17
|
+
return end && end < start ? [end, start] : [start, end]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function selectRange(value: DateRangeValue, day: Date): DateRangeValue {
|
|
21
|
+
const next = format(day, 'yyyy-MM-dd')
|
|
22
|
+
const [start, end] = value
|
|
23
|
+
if (!start || end) return [next, null]
|
|
24
|
+
return next < start ? [next, start] : [start, next]
|
|
25
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box, IconButton, Stack, Typography
|
|
1
|
+
import { Box, IconButton, Stack, Typography } from '@mui/material'
|
|
2
2
|
import React, { useCallback, useMemo } from 'react'
|
|
3
3
|
import type { DropzoneOptions } from 'react-dropzone'
|
|
4
4
|
import { useDropzone } from 'react-dropzone'
|
|
@@ -8,21 +8,20 @@ import { v4 as uuidv4 } from 'uuid'
|
|
|
8
8
|
|
|
9
9
|
import { UploadSimpleIcon, XCircleFillIcon } from '@/assets/icons/phosphorIcons'
|
|
10
10
|
import IconWithCircularBackground from '@/components/common/IconWithCircularBackground'
|
|
11
|
-
import
|
|
11
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
12
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
13
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
14
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
12
15
|
|
|
13
16
|
import RcSesFormControlWrapper, {
|
|
14
17
|
RcSesFormControlWrapperProps,
|
|
15
18
|
} from '../components/FormControlWrapper'
|
|
16
19
|
|
|
17
|
-
const StyledCloseIcon = styled(XCircleFillIcon)({
|
|
18
|
-
'path fill': palette.grey[950],
|
|
19
|
-
})
|
|
20
|
-
|
|
21
20
|
type TControllerProps = UseControllerProps<any, any>
|
|
22
|
-
type ImmediateControllerProps = 'control' | 'rules'
|
|
21
|
+
type ImmediateControllerProps = 'control' | 'disabled' | 'rules'
|
|
23
22
|
|
|
24
23
|
type TFieldProps = React.InputHTMLAttributes<HTMLInputElement>
|
|
25
|
-
type ImmediateFieldProps = 'onChange' | 'onBlur' | '
|
|
24
|
+
type ImmediateFieldProps = 'onChange' | 'onBlur' | 'name'
|
|
26
25
|
|
|
27
26
|
type TWrapperProps = RcSesFormControlWrapperProps
|
|
28
27
|
type ImmediateWrapperProps = 'label' | 'errors'
|
|
@@ -42,7 +41,7 @@ type Props = Pick<TControllerProps, ImmediateControllerProps> &
|
|
|
42
41
|
function RcSesFileDropzone(props: Props) {
|
|
43
42
|
const { t } = useTranslation('input', { keyPrefix: 'components.RcSesFileDropzone' })
|
|
44
43
|
|
|
45
|
-
const { control, errors, label, rules, slotProps, ...fieldProps } = props
|
|
44
|
+
const { control, disabled, errors, label, rules, slotProps, ...fieldProps } = props
|
|
46
45
|
const { name } = fieldProps
|
|
47
46
|
const { description, ...wrapperProps } = slotProps?.wrapper ?? {}
|
|
48
47
|
|
|
@@ -63,6 +62,7 @@ function RcSesFileDropzone(props: Props) {
|
|
|
63
62
|
}, [])
|
|
64
63
|
|
|
65
64
|
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
65
|
+
disabled,
|
|
66
66
|
onDrop,
|
|
67
67
|
...slotProps?.dropzone,
|
|
68
68
|
})
|
|
@@ -88,44 +88,60 @@ function RcSesFileDropzone(props: Props) {
|
|
|
88
88
|
>
|
|
89
89
|
<Box
|
|
90
90
|
{...getRootProps()}
|
|
91
|
+
aria-describedby={description ? `${id}-description` : undefined}
|
|
92
|
+
aria-invalid={!!errors}
|
|
93
|
+
aria-label={t('aria.dropzoneLabel')}
|
|
94
|
+
tabIndex={disabled ? -1 : 0}
|
|
91
95
|
sx={{
|
|
92
96
|
backgroundColor: () => {
|
|
93
|
-
if (
|
|
94
|
-
return isDragActive
|
|
97
|
+
if (disabled) return colorTokens['surface-sunken']
|
|
98
|
+
return isDragActive
|
|
99
|
+
? colorTokens['surface-brand-subtle']
|
|
100
|
+
: colorTokens['surface-base']
|
|
95
101
|
},
|
|
96
102
|
borderColor: () => {
|
|
97
|
-
if (errors) return
|
|
98
|
-
if (
|
|
99
|
-
return isDragActive
|
|
103
|
+
if (errors) return colorTokens['status-error-border']
|
|
104
|
+
if (disabled) return colorTokens['border-subtle']
|
|
105
|
+
return isDragActive
|
|
106
|
+
? colorTokens['border-focus']
|
|
107
|
+
: colorTokens['border-default']
|
|
100
108
|
},
|
|
101
|
-
borderRadius: '
|
|
109
|
+
borderRadius: borderTokens['radius-input'],
|
|
102
110
|
borderStyle: 'dashed',
|
|
103
|
-
borderWidth: 1,
|
|
104
|
-
px:
|
|
105
|
-
py:
|
|
111
|
+
borderWidth: borderTokens['stroke-1'],
|
|
112
|
+
px: `calc(${spacingRoleBasedTokens['space-40']} + ${spacingRoleBasedTokens['space-4']})`,
|
|
113
|
+
py: spacingRoleBasedTokens['space-40'],
|
|
106
114
|
|
|
107
115
|
'&:hover': {
|
|
108
116
|
borderColor: () => {
|
|
109
|
-
if (
|
|
110
|
-
return
|
|
117
|
+
if (disabled) return colorTokens['border-subtle']
|
|
118
|
+
return colorTokens['border-focus']
|
|
111
119
|
},
|
|
112
|
-
cursor:
|
|
120
|
+
cursor: disabled ? 'default' : 'pointer',
|
|
113
121
|
},
|
|
114
122
|
}}
|
|
115
123
|
>
|
|
116
|
-
<input
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
<input
|
|
125
|
+
{...getInputProps()}
|
|
126
|
+
disabled={disabled}
|
|
127
|
+
id={id}
|
|
128
|
+
name={fieldControlProps.name}
|
|
129
|
+
/>
|
|
130
|
+
|
|
131
|
+
<Stack
|
|
132
|
+
direction='row'
|
|
133
|
+
sx={{ alignItems: 'center', gap: spacingRoleBasedTokens['space-16'] }}
|
|
134
|
+
>
|
|
119
135
|
<IconWithCircularBackground
|
|
120
|
-
color={!
|
|
121
|
-
bgShade={!
|
|
122
|
-
iconShade={
|
|
136
|
+
color={!disabled && isDragActive ? 'primary' : 'grey'}
|
|
137
|
+
bgShade={!disabled && isDragActive ? '100' : '50'}
|
|
138
|
+
iconShade={disabled ? '500' : '900'}
|
|
123
139
|
Icon={UploadSimpleIcon}
|
|
124
140
|
/>
|
|
125
141
|
|
|
126
142
|
<Stack
|
|
127
143
|
sx={{
|
|
128
|
-
gap:
|
|
144
|
+
gap: spacingRoleBasedTokens['space-4'],
|
|
129
145
|
flexGrow: 1,
|
|
130
146
|
}}
|
|
131
147
|
>
|
|
@@ -136,20 +152,26 @@ function RcSesFileDropzone(props: Props) {
|
|
|
136
152
|
// eslint-disable-next-line react/no-array-index-key
|
|
137
153
|
key={index}
|
|
138
154
|
direction='row'
|
|
139
|
-
sx={{ alignItems: 'center', gap:
|
|
155
|
+
sx={{ alignItems: 'center', gap: spacingRoleBasedTokens['space-8'] }}
|
|
140
156
|
>
|
|
141
157
|
<Typography
|
|
142
158
|
sx={{
|
|
143
|
-
color:
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
159
|
+
color: disabled
|
|
160
|
+
? colorTokens['text-secondary']
|
|
161
|
+
: colorTokens['text-default'],
|
|
162
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
163
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
164
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
147
165
|
}}
|
|
148
166
|
>
|
|
149
167
|
{file.name}
|
|
150
168
|
<Typography
|
|
151
169
|
component='span'
|
|
152
|
-
sx={{
|
|
170
|
+
sx={{
|
|
171
|
+
color: colorTokens['text-secondary'],
|
|
172
|
+
fontSize: typographyTokens['font-size-body-micro'],
|
|
173
|
+
ml: spacingRoleBasedTokens['space-8'],
|
|
174
|
+
}}
|
|
153
175
|
>
|
|
154
176
|
({Math.round(file.size / 1024)} KB)
|
|
155
177
|
</Typography>
|
|
@@ -157,7 +179,7 @@ function RcSesFileDropzone(props: Props) {
|
|
|
157
179
|
|
|
158
180
|
<Box sx={{ ml: 'auto' }}>
|
|
159
181
|
<IconButton size='small' onClick={(e) => onRemoveFile(e, index)}>
|
|
160
|
-
<
|
|
182
|
+
<XCircleFillIcon fillColor={colorTokens['text-default']} />
|
|
161
183
|
</IconButton>
|
|
162
184
|
</Box>
|
|
163
185
|
</Stack>
|
|
@@ -169,8 +191,10 @@ function RcSesFileDropzone(props: Props) {
|
|
|
169
191
|
<>
|
|
170
192
|
<Typography
|
|
171
193
|
sx={{
|
|
172
|
-
color:
|
|
173
|
-
|
|
194
|
+
color: disabled
|
|
195
|
+
? colorTokens['text-disabled']
|
|
196
|
+
: colorTokens['text-default'],
|
|
197
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
174
198
|
}}
|
|
175
199
|
>
|
|
176
200
|
<Trans t={t} i18nKey='label'>
|
|
@@ -178,12 +202,12 @@ function RcSesFileDropzone(props: Props) {
|
|
|
178
202
|
<Typography
|
|
179
203
|
component='span'
|
|
180
204
|
sx={{
|
|
181
|
-
color:
|
|
182
|
-
?
|
|
183
|
-
:
|
|
184
|
-
fontSize: '
|
|
185
|
-
fontWeight:
|
|
186
|
-
lineHeight: '
|
|
205
|
+
color: disabled
|
|
206
|
+
? colorTokens['text-disabled']
|
|
207
|
+
: colorTokens['text-link'],
|
|
208
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
209
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
210
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
187
211
|
textDecoration: 'underline',
|
|
188
212
|
}}
|
|
189
213
|
>
|
|
@@ -195,11 +219,14 @@ function RcSesFileDropzone(props: Props) {
|
|
|
195
219
|
|
|
196
220
|
{!!description && (
|
|
197
221
|
<Typography
|
|
222
|
+
id={`${id}-description`}
|
|
198
223
|
sx={{
|
|
199
|
-
color:
|
|
200
|
-
|
|
224
|
+
color: disabled
|
|
225
|
+
? colorTokens['text-disabled']
|
|
226
|
+
: colorTokens['text-secondary'],
|
|
227
|
+
fontSize: typographyTokens['font-size-body-micro'],
|
|
201
228
|
fontStyle: 'italic',
|
|
202
|
-
lineHeight: '
|
|
229
|
+
lineHeight: typographyTokens['line-height-body-micro'],
|
|
203
230
|
}}
|
|
204
231
|
>
|
|
205
232
|
{description}
|
|
@@ -5,7 +5,10 @@ import { useTranslation } from 'react-i18next'
|
|
|
5
5
|
import { v4 as uuidv4 } from 'uuid'
|
|
6
6
|
|
|
7
7
|
import { UploadSimpleIcon } from '@/assets/icons/phosphorIcons'
|
|
8
|
-
import
|
|
8
|
+
import { borderTokens } from '@/theme/borderTokens'
|
|
9
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
10
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
11
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
9
12
|
|
|
10
13
|
import RcSesFormControlWrapper, {
|
|
11
14
|
RcSesFormControlWrapperProps,
|
|
@@ -76,23 +79,23 @@ function RcSesFileUpload(props: Props) {
|
|
|
76
79
|
fullWidth
|
|
77
80
|
role={undefined}
|
|
78
81
|
sx={{
|
|
79
|
-
backgroundColor: '
|
|
80
|
-
borderRadius: '
|
|
82
|
+
backgroundColor: `${colorTokens['surface-base']} !important`,
|
|
83
|
+
borderRadius: borderTokens['radius-input'],
|
|
81
84
|
display: 'flex',
|
|
82
85
|
justifyContent: 'space-between',
|
|
83
86
|
minHeight: '2.75rem',
|
|
84
87
|
overflow: 'hidden',
|
|
85
88
|
p: 0,
|
|
86
|
-
pl:
|
|
89
|
+
pl: spacingRoleBasedTokens['space-10'],
|
|
87
90
|
pr: 0,
|
|
88
91
|
position: 'relative',
|
|
89
92
|
|
|
90
93
|
'input:focus-visible ~ .faux-button::after': {
|
|
91
94
|
content: '""',
|
|
92
95
|
background: 'transparent',
|
|
93
|
-
border: '
|
|
94
|
-
borderColor:
|
|
95
|
-
borderRadius: '
|
|
96
|
+
border: `${borderTokens['border-focus']} solid`,
|
|
97
|
+
borderColor: colorTokens['border-focus'],
|
|
98
|
+
borderRadius: borderTokens['radius-input'],
|
|
96
99
|
height: 'calc(100% + 6px)',
|
|
97
100
|
left: '-3px',
|
|
98
101
|
position: 'absolute',
|
|
@@ -121,24 +124,30 @@ function RcSesFileUpload(props: Props) {
|
|
|
121
124
|
sx={{
|
|
122
125
|
alignItems: 'center',
|
|
123
126
|
alignSelf: 'stretch',
|
|
124
|
-
backgroundColor:
|
|
125
|
-
borderColor:
|
|
126
|
-
borderBottomRightRadius:
|
|
127
|
+
backgroundColor: colorTokens['surface-sunken'],
|
|
128
|
+
borderColor: colorTokens['border-default'],
|
|
129
|
+
borderBottomRightRadius: `calc(${borderTokens['radius-input']} - ${borderTokens['stroke-1']})`,
|
|
127
130
|
borderLeftStyle: 'solid',
|
|
128
|
-
borderLeftWidth: '
|
|
129
|
-
borderTopRightRadius:
|
|
130
|
-
color:
|
|
131
|
+
borderLeftWidth: borderTokens['stroke-1'],
|
|
132
|
+
borderTopRightRadius: `calc(${borderTokens['radius-input']} - ${borderTokens['stroke-1']})`,
|
|
133
|
+
color: colorTokens['text-default'],
|
|
131
134
|
display: 'flex',
|
|
132
135
|
flexShrink: 0,
|
|
133
136
|
position: 'relative',
|
|
134
|
-
px:
|
|
137
|
+
px: spacingRoleBasedTokens['space-16'],
|
|
135
138
|
':hover': {
|
|
136
|
-
backgroundColor:
|
|
139
|
+
backgroundColor: colorTokens['surface-muted'],
|
|
137
140
|
},
|
|
138
141
|
}}
|
|
139
142
|
>
|
|
140
143
|
<UploadSimpleIcon />
|
|
141
|
-
<Typography
|
|
144
|
+
<Typography
|
|
145
|
+
variant='body1'
|
|
146
|
+
sx={{
|
|
147
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
148
|
+
ml: spacingRoleBasedTokens['space-8'],
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
142
151
|
{t('label')}
|
|
143
152
|
</Typography>
|
|
144
153
|
</Box>
|