@registrucentras/rc-ses-react-components 2.7.3 → 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 +4 -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 +11143 -8378
- 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 +1 -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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box,
|
|
1
|
+
import { Box, Paper, TextField } from '@mui/material'
|
|
2
2
|
import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete'
|
|
3
3
|
import React, { useMemo } from 'react'
|
|
4
4
|
import { FieldValues, UseControllerProps, useController } from 'react-hook-form'
|
|
@@ -7,11 +7,15 @@ import { v4 as uuidv4 } from 'uuid'
|
|
|
7
7
|
|
|
8
8
|
import { CaretDownIcon, CheckIcon } from '@/assets/icons/phosphorIcons'
|
|
9
9
|
import RcSesBadge from '@/components/common/Badge'
|
|
10
|
-
import
|
|
10
|
+
import { colorTokens } from '@/theme/colorTokens'
|
|
11
|
+
import { sizeTokens } from '@/theme/sizeTokens'
|
|
12
|
+
import { spacingRoleBasedTokens } from '@/theme/spacingRoleBasedTokens'
|
|
13
|
+
import { typographyTokens } from '@/theme/typographyTokens'
|
|
11
14
|
|
|
12
15
|
import RcSesFormControlWrapper, {
|
|
13
16
|
RcSesFormControlWrapperProps,
|
|
14
17
|
} from '../../components/FormControlWrapper'
|
|
18
|
+
import { paperStyle, selectStyle } from './Select.styles'
|
|
15
19
|
import { Option } from './Select.types'
|
|
16
20
|
import {
|
|
17
21
|
dropdownGroupOptionValue,
|
|
@@ -95,9 +99,11 @@ function DropdownPaper({
|
|
|
95
99
|
{!!dropdownLabel && (
|
|
96
100
|
<Box
|
|
97
101
|
sx={{
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
102
|
+
pt: spacingRoleBasedTokens['space-20'],
|
|
103
|
+
px: spacingRoleBasedTokens['space-16'],
|
|
104
|
+
pb: spacingRoleBasedTokens['space-12'],
|
|
105
|
+
fontSize: typographyTokens['font-size-body-regular'],
|
|
106
|
+
color: colorTokens['text-secondary'],
|
|
101
107
|
}}
|
|
102
108
|
>
|
|
103
109
|
{dropdownLabel}
|
|
@@ -116,8 +122,6 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
116
122
|
const [open, setOpen] = React.useState(false)
|
|
117
123
|
// rem widths reserved at the end of the input for the clear and dropdown adornments
|
|
118
124
|
const reservedSingleEndAdornmentWidth = 2
|
|
119
|
-
const reservedMultipleTagsEndAdornmentWidth = 2.2
|
|
120
|
-
const reservedMultipleWithCounterEndAdornmentWidth = 3
|
|
121
125
|
const wrapperRef = React.useRef<HTMLDivElement>(null)
|
|
122
126
|
|
|
123
127
|
const {
|
|
@@ -126,7 +130,6 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
126
130
|
control,
|
|
127
131
|
errors,
|
|
128
132
|
label,
|
|
129
|
-
limitTags,
|
|
130
133
|
loading,
|
|
131
134
|
onInputChange,
|
|
132
135
|
options,
|
|
@@ -141,6 +144,10 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
141
144
|
...fieldProps
|
|
142
145
|
} = props
|
|
143
146
|
|
|
147
|
+
const limitTags = multiple
|
|
148
|
+
? (props as MultiSelectProps<TFieldValues>).limitTags
|
|
149
|
+
: undefined
|
|
150
|
+
|
|
144
151
|
const resolvedDropdownSearchPlaceholder =
|
|
145
152
|
dropdownSearchPlaceholder ?? t('searchPlaceholder')
|
|
146
153
|
const resolvedSelectAllLabel = selectAllLabel ?? t('selectAllLabel')
|
|
@@ -185,11 +192,6 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
185
192
|
|
|
186
193
|
const selectedTagCount =
|
|
187
194
|
multiple && Array.isArray(resolvedValue) ? resolvedValue.length : 0
|
|
188
|
-
const hasLimitTagCounter =
|
|
189
|
-
multiple && (limitTags ?? -1) > -1 && selectedTagCount > (limitTags ?? -1)
|
|
190
|
-
const reservedMultipleEndAdornmentWidth = hasLimitTagCounter
|
|
191
|
-
? reservedMultipleWithCounterEndAdornmentWidth
|
|
192
|
-
: reservedMultipleTagsEndAdornmentWidth
|
|
193
195
|
|
|
194
196
|
const [inputValue, setInputValue] = React.useState('')
|
|
195
197
|
const resolvedInputValue = dropdownSearch ? '' : inputValue
|
|
@@ -406,7 +408,15 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
406
408
|
loading={loading}
|
|
407
409
|
loadingText={t('loadingText')}
|
|
408
410
|
noOptionsText={t('noOptionsText')}
|
|
409
|
-
popupIcon={
|
|
411
|
+
popupIcon={
|
|
412
|
+
<CaretDownIcon
|
|
413
|
+
fillColor={colorTokens['text-secondary']}
|
|
414
|
+
style={{
|
|
415
|
+
width: sizeTokens['icon-size-control'],
|
|
416
|
+
height: sizeTokens['icon-size-control'],
|
|
417
|
+
}}
|
|
418
|
+
/>
|
|
419
|
+
}
|
|
410
420
|
value={resolvedValue}
|
|
411
421
|
inputValue={resolvedInputValue}
|
|
412
422
|
onChange={handleChange}
|
|
@@ -437,7 +447,11 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
437
447
|
{!multiple && !!groupValue && (
|
|
438
448
|
<Box
|
|
439
449
|
className='MuiAutocomplete-groupLabel'
|
|
440
|
-
sx={{
|
|
450
|
+
sx={{
|
|
451
|
+
alignItems: 'center',
|
|
452
|
+
display: 'flex',
|
|
453
|
+
gap: spacingRoleBasedTokens['gap-sm'],
|
|
454
|
+
}}
|
|
441
455
|
>
|
|
442
456
|
{groupValue}
|
|
443
457
|
{groupCounts.has(groupValue) && (
|
|
@@ -460,7 +474,11 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
460
474
|
{...params}
|
|
461
475
|
disabled={disabled}
|
|
462
476
|
error={hasError}
|
|
463
|
-
placeholder={
|
|
477
|
+
placeholder={
|
|
478
|
+
selectedSingleLabel || selectedTagCount > 0
|
|
479
|
+
? undefined
|
|
480
|
+
: (placeholder ?? (multiple ? t('placeholder') : undefined))
|
|
481
|
+
}
|
|
464
482
|
sx={{
|
|
465
483
|
...(dropdownSearch || (!multiple && selectedSingleLabel)
|
|
466
484
|
? {
|
|
@@ -472,8 +490,16 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
472
490
|
...(multiple
|
|
473
491
|
? {
|
|
474
492
|
'& .MuiAutocomplete-inputRoot': {
|
|
493
|
+
display: 'flex',
|
|
475
494
|
alignItems: 'center',
|
|
476
|
-
|
|
495
|
+
flexWrap: 'nowrap',
|
|
496
|
+
overflow: 'hidden',
|
|
497
|
+
boxSizing: 'border-box',
|
|
498
|
+
},
|
|
499
|
+
'& .MuiAutocomplete-input': {
|
|
500
|
+
width: 0,
|
|
501
|
+
minWidth: 0,
|
|
502
|
+
flexGrow: 0,
|
|
477
503
|
},
|
|
478
504
|
}
|
|
479
505
|
: {
|
|
@@ -481,7 +507,7 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
481
507
|
boxSizing: 'border-box',
|
|
482
508
|
display: 'block',
|
|
483
509
|
overflowWrap: 'anywhere',
|
|
484
|
-
paddingLeft: '
|
|
510
|
+
paddingLeft: spacingRoleBasedTokens['padding-sm'],
|
|
485
511
|
pointerEvents: 'none',
|
|
486
512
|
width: '100%',
|
|
487
513
|
},
|
|
@@ -536,8 +562,8 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
536
562
|
'&:hover': { backgroundColor: 'transparent !important' },
|
|
537
563
|
display: 'flex',
|
|
538
564
|
flexDirection: 'row !important',
|
|
539
|
-
px: '
|
|
540
|
-
py: '
|
|
565
|
+
px: spacingRoleBasedTokens['padding-md'],
|
|
566
|
+
py: spacingRoleBasedTokens['space-8'],
|
|
541
567
|
}}
|
|
542
568
|
>
|
|
543
569
|
<TextField
|
|
@@ -559,18 +585,18 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
559
585
|
onKeyDown={(event) => {
|
|
560
586
|
event.stopPropagation()
|
|
561
587
|
}}
|
|
562
|
-
sx={
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
588
|
+
sx={[
|
|
589
|
+
selectStyle,
|
|
590
|
+
{
|
|
591
|
+
'& .MuiInputBase-input': {
|
|
592
|
+
padding: `${spacingRoleBasedTokens['space-10']} ${spacingRoleBasedTokens['padding-sm']}`,
|
|
593
|
+
},
|
|
594
|
+
'& .MuiInputBase-input::placeholder': {
|
|
595
|
+
color: colorTokens['text-muted'],
|
|
596
|
+
opacity: 1,
|
|
597
|
+
},
|
|
568
598
|
},
|
|
569
|
-
|
|
570
|
-
color: palette.grey.main,
|
|
571
|
-
opacity: 1,
|
|
572
|
-
},
|
|
573
|
-
}}
|
|
599
|
+
]}
|
|
574
600
|
slotProps={{
|
|
575
601
|
htmlInput: {
|
|
576
602
|
onKeyDown: (event: React.KeyboardEvent<HTMLInputElement>) =>
|
|
@@ -601,7 +627,7 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
601
627
|
alignItems: 'center !important',
|
|
602
628
|
display: 'flex',
|
|
603
629
|
flexDirection: 'row !important',
|
|
604
|
-
gap: '
|
|
630
|
+
gap: spacingRoleBasedTokens['gap-md'],
|
|
605
631
|
}}
|
|
606
632
|
>
|
|
607
633
|
<OptionCheckbox checked={allFilteredSelected} />
|
|
@@ -633,23 +659,25 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
633
659
|
sx={{
|
|
634
660
|
alignItems: 'center !important',
|
|
635
661
|
backgroundColor: isGroupSelected
|
|
636
|
-
?
|
|
662
|
+
? colorTokens['surface-brand-subtle']
|
|
637
663
|
: 'transparent',
|
|
638
664
|
display: 'flex',
|
|
639
665
|
flexDirection: 'row !important',
|
|
640
|
-
gap: '
|
|
666
|
+
gap: spacingRoleBasedTokens['gap-sm'],
|
|
641
667
|
}}
|
|
642
668
|
>
|
|
643
669
|
<OptionCheckbox checked={isGroupSelected} />
|
|
644
670
|
<Box
|
|
645
671
|
component='span'
|
|
646
672
|
sx={{
|
|
647
|
-
color: isGroupSelected
|
|
673
|
+
color: isGroupSelected
|
|
674
|
+
? colorTokens['text-link']
|
|
675
|
+
: colorTokens['text-default'],
|
|
648
676
|
flex: 1,
|
|
649
677
|
fontFamily: '"Public Sans", sans-serif',
|
|
650
|
-
fontSize: '
|
|
651
|
-
fontWeight:
|
|
652
|
-
lineHeight: '
|
|
678
|
+
fontSize: typographyTokens['font-size-body-small'],
|
|
679
|
+
fontWeight: typographyTokens['font-weight-semibold'],
|
|
680
|
+
lineHeight: typographyTokens['line-height-body-small'],
|
|
653
681
|
overflowWrap: 'anywhere',
|
|
654
682
|
}}
|
|
655
683
|
>
|
|
@@ -683,13 +711,22 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
683
711
|
sx={{
|
|
684
712
|
alignItems: 'center !important',
|
|
685
713
|
display: 'flex',
|
|
686
|
-
gap: multiple
|
|
714
|
+
gap: multiple
|
|
715
|
+
? spacingRoleBasedTokens['gap-md']
|
|
716
|
+
: spacingRoleBasedTokens['gap-sm'],
|
|
687
717
|
flexDirection: 'row !important',
|
|
688
718
|
justifyContent: 'space-between',
|
|
689
719
|
minWidth: 0,
|
|
690
720
|
}}
|
|
691
721
|
>
|
|
692
|
-
{multiple &&
|
|
722
|
+
{multiple && (
|
|
723
|
+
<OptionCheckbox
|
|
724
|
+
checked={selected}
|
|
725
|
+
disabled={
|
|
726
|
+
rest['aria-disabled'] === true || rest['aria-disabled'] === 'true'
|
|
727
|
+
}
|
|
728
|
+
/>
|
|
729
|
+
)}
|
|
693
730
|
<Box
|
|
694
731
|
sx={{
|
|
695
732
|
flex: 1,
|
|
@@ -706,7 +743,7 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
706
743
|
>
|
|
707
744
|
<span
|
|
708
745
|
className='rc-ses-select-option-label'
|
|
709
|
-
style={selected ? { color:
|
|
746
|
+
style={selected ? { color: colorTokens['text-link'] } : undefined}
|
|
710
747
|
>
|
|
711
748
|
{option.label}
|
|
712
749
|
</span>
|
|
@@ -719,66 +756,63 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
719
756
|
</Box>
|
|
720
757
|
{!multiple && selected && (
|
|
721
758
|
<CheckIcon
|
|
722
|
-
|
|
723
|
-
|
|
759
|
+
style={{
|
|
760
|
+
width: sizeTokens['icon-size-control'],
|
|
761
|
+
height: sizeTokens['icon-size-control'],
|
|
762
|
+
flexShrink: 0,
|
|
763
|
+
marginLeft: 'auto',
|
|
764
|
+
alignSelf: 'center',
|
|
765
|
+
}}
|
|
766
|
+
fillColor={colorTokens['control-selected']}
|
|
724
767
|
aria-hidden
|
|
725
768
|
weight='bold'
|
|
726
|
-
style={{ flexShrink: 0, marginLeft: 'auto', alignSelf: 'center' }}
|
|
727
769
|
/>
|
|
728
770
|
)}
|
|
729
771
|
</Box>
|
|
730
772
|
)
|
|
731
773
|
}}
|
|
732
|
-
renderValue={(tagValues
|
|
733
|
-
// MUI 9 merged renderTags into renderValue, so this now runs for
|
|
734
|
-
// single-select too where v7's renderTags did not. Single-select must
|
|
735
|
-
// keep showing the plain label - rendering a deletable Chip there both
|
|
736
|
-
// looks wrong and makes the field taller.
|
|
737
|
-
const selected = Array.isArray(tagValues) ? tagValues : [tagValues]
|
|
774
|
+
renderValue={(tagValues) => {
|
|
738
775
|
if (!multiple) {
|
|
739
|
-
|
|
776
|
+
const selected = Array.isArray(tagValues) ? tagValues[0] : tagValues
|
|
777
|
+
return selected?.label ?? ''
|
|
740
778
|
}
|
|
741
779
|
|
|
742
|
-
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
const
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
const hiddenTagCount = selected.length - visibleTags.length
|
|
780
|
+
// Multi-select with text display and overflow indicator
|
|
781
|
+
const selected = Array.isArray(tagValues) ? tagValues : []
|
|
782
|
+
const visibleLimit = limitTags ?? -1
|
|
783
|
+
const shouldLimit = visibleLimit > -1 && selected.length > visibleLimit
|
|
784
|
+
const visibleItems = shouldLimit ? selected.slice(0, visibleLimit) : selected
|
|
785
|
+
const hiddenCount = selected.length - visibleItems.length
|
|
749
786
|
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
key={option.value ?? index}
|
|
756
|
-
label={option.label}
|
|
757
|
-
size='small'
|
|
758
|
-
sx={{
|
|
759
|
-
height: 'auto',
|
|
760
|
-
maxWidth: `calc(100% - ${reservedMultipleEndAdornmentWidth}rem)`,
|
|
761
|
-
'& .MuiChip-label': {
|
|
762
|
-
display: 'block',
|
|
763
|
-
overflowWrap: 'anywhere',
|
|
764
|
-
py: '.25rem',
|
|
765
|
-
textOverflow: 'clip',
|
|
766
|
-
whiteSpace: 'normal',
|
|
767
|
-
},
|
|
768
|
-
}}
|
|
769
|
-
{...getItemProps({ index })}
|
|
770
|
-
/>
|
|
771
|
-
))}
|
|
787
|
+
const summary = visibleItems.map((o) => o.label).join(', ')
|
|
788
|
+
const withOverflow =
|
|
789
|
+
hiddenCount > 0
|
|
790
|
+
? `${summary}, ${t('hiddenTagOverflow', { count: hiddenCount })}`
|
|
791
|
+
: summary
|
|
772
792
|
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
793
|
+
return (
|
|
794
|
+
<span
|
|
795
|
+
style={{
|
|
796
|
+
display: 'block',
|
|
797
|
+
overflow: 'hidden',
|
|
798
|
+
textOverflow: 'ellipsis',
|
|
799
|
+
whiteSpace: 'nowrap',
|
|
800
|
+
width: 0,
|
|
801
|
+
flex: 1,
|
|
802
|
+
minWidth: 0,
|
|
803
|
+
}}
|
|
804
|
+
>
|
|
805
|
+
{withOverflow}
|
|
806
|
+
</span>
|
|
779
807
|
)
|
|
780
808
|
}}
|
|
781
809
|
{...slotProps?.field}
|
|
810
|
+
sx={[
|
|
811
|
+
selectStyle,
|
|
812
|
+
...(Array.isArray(slotProps?.field?.sx)
|
|
813
|
+
? slotProps.field.sx
|
|
814
|
+
: [slotProps?.field?.sx ?? {}]),
|
|
815
|
+
]}
|
|
782
816
|
groupBy={(option) => {
|
|
783
817
|
if (isGroupOptionValue(option.value)) {
|
|
784
818
|
return groupNameFromOptionValue(option.value)
|
|
@@ -801,6 +835,10 @@ function RcSesSelect<TFieldValues extends FieldValues = FieldValues>(
|
|
|
801
835
|
|
|
802
836
|
return {
|
|
803
837
|
...resolved,
|
|
838
|
+
sx: [
|
|
839
|
+
paperStyle,
|
|
840
|
+
...(Array.isArray(resolved?.sx) ? resolved.sx : [resolved?.sx ?? {}]),
|
|
841
|
+
],
|
|
804
842
|
dropdownLabel,
|
|
805
843
|
}
|
|
806
844
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Checkbox as MuiCheckbox, CheckboxProps as MuiCheckboxProps } from '@mui/material'
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
|
-
import
|
|
4
|
+
import RcSesCheckboxMark from '@/components/common/CheckboxMark'
|
|
5
5
|
import getLoadingIcon from '@/components/utils/loading'
|
|
6
6
|
|
|
7
7
|
export type SimpleCheckboxProps = MuiCheckboxProps & {
|
|
@@ -11,8 +11,15 @@ export type SimpleCheckboxProps = MuiCheckboxProps & {
|
|
|
11
11
|
function RcSesSimpleCheckbox({ loading, ...props }: SimpleCheckboxProps) {
|
|
12
12
|
return (
|
|
13
13
|
<MuiCheckbox
|
|
14
|
-
checkedIcon={getLoadingIcon(
|
|
15
|
-
|
|
14
|
+
checkedIcon={getLoadingIcon(
|
|
15
|
+
<RcSesCheckboxMark type='checked' disabled={props.disabled} />,
|
|
16
|
+
loading,
|
|
17
|
+
)}
|
|
18
|
+
icon={getLoadingIcon(<RcSesCheckboxMark disabled={props.disabled} />, loading)}
|
|
19
|
+
indeterminateIcon={getLoadingIcon(
|
|
20
|
+
<RcSesCheckboxMark type='indeterminate' disabled={props.disabled} />,
|
|
21
|
+
loading,
|
|
22
|
+
)}
|
|
16
23
|
{...props}
|
|
17
24
|
disableRipple
|
|
18
25
|
/>
|