@registrucentras/rc-ses-react-components 1.6.3 → 1.6.5

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.
Files changed (95) hide show
  1. package/dist/assets/IconProps.d.ts +2 -0
  2. package/dist/assets/icons/CheckIcon.d.ts +3 -0
  3. package/dist/assets/icons/PencilSimpleLineIcon.d.ts +3 -0
  4. package/dist/components/common/Card/index.d.ts +4 -1
  5. package/dist/components/form/inputs/Select/Select.types.d.ts +5 -0
  6. package/dist/components/form/inputs/Select/hooks/useFilteredOptions.d.ts +3 -0
  7. package/dist/components/form/inputs/Select/hooks/useSelectAllLogic.d.ts +7 -0
  8. package/dist/components/form/inputs/{Select.d.ts → Select/index.d.ts} +12 -12
  9. package/dist/library/icons.d.ts +2 -1
  10. package/dist/registrucentras-rc-ses-react-components.cjs +11 -11
  11. package/dist/registrucentras-rc-ses-react-components.js +3154 -2747
  12. package/dist/stories/assets/Logo.stories.d.ts +12 -0
  13. package/dist/stories/components/actions/ButtonWithPopover.stories.d.ts +7 -0
  14. package/dist/stories/components/display/Card.stories.d.ts +6 -47
  15. package/dist/stories/components/display/ImageCard.stories.d.ts +6 -6
  16. package/dist/stories/components/feedback/Alert.stories.d.ts +7 -16
  17. package/dist/stories/components/form/CardFormContainer.stories.d.ts +5 -5
  18. package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +3 -23
  19. package/dist/stories/components/form/FormControlWrapper.stories.d.ts +6 -0
  20. package/dist/stories/components/form/ServiceFormActions.stories.d.ts +3 -9
  21. package/dist/stories/components/form/ServiceFormContainer.stories.d.ts +11 -12
  22. package/dist/stories/components/icons/IconWithCircularBackground.stories.d.ts +6 -0
  23. package/dist/stories/components/icons/Icons.stories.d.ts +3 -2
  24. package/dist/stories/components/inputs/Checkbox.stories.d.ts +17 -22
  25. package/dist/stories/components/inputs/DatePicker.stories.d.ts +18 -20
  26. package/dist/stories/components/inputs/FileDropzone.stories.d.ts +3 -29
  27. package/dist/stories/components/inputs/FileUpload.stories.d.ts +14 -26
  28. package/dist/stories/components/inputs/NumberStepper.stories.d.ts +3 -31
  29. package/dist/stories/components/inputs/PhoneInput.stories.d.ts +6 -20
  30. package/dist/stories/components/inputs/PhoneInputFormControl.stories.d.ts +6 -0
  31. package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +4 -32
  32. package/dist/stories/components/inputs/SearchableField.stories.d.ts +3 -332
  33. package/dist/stories/components/inputs/Select.stories.d.ts +4 -871
  34. package/dist/stories/components/inputs/TextField.stories.d.ts +3 -610
  35. package/dist/stories/components/layout/Footer.stories.d.ts +3 -5
  36. package/dist/stories/components/layout/ServiceHeader.stories.d.ts +6 -0
  37. package/dist/stories/components/layout/ServicePage.stories.d.ts +6 -0
  38. package/dist/stories/components/navigation/Accordion.stories.d.ts +15 -27
  39. package/dist/stories/components/navigation/Breadcrumbs.stories.d.ts +4 -6
  40. package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +5 -5
  41. package/dist/stories/components/tabs/Tab.stories.d.ts +8 -0
  42. package/dist/stories/components/tabs/TabPanel.stories.d.ts +7 -0
  43. package/dist/stories/components/tabs/Tabs.stories.d.ts +7 -0
  44. package/dist/stories/components/tabs/TabsWrapper.stories.d.ts +6 -0
  45. package/package.json +1 -1
  46. package/src/assets/IconProps.ts +2 -0
  47. package/src/assets/icons/CheckIcon.tsx +23 -0
  48. package/src/assets/icons/PencilSimpleLineIcon.tsx +17 -0
  49. package/src/components/common/Card/index.test.tsx +8 -0
  50. package/src/components/common/Card/index.tsx +64 -25
  51. package/src/components/common/SelectableCardList/index.tsx +2 -1
  52. package/src/components/form/components/FormControlWrapper/index.tsx +6 -1
  53. package/src/components/form/inputs/PhoneInputFormControl/index.tsx +11 -3
  54. package/src/components/form/inputs/Select/Select.types.ts +5 -0
  55. package/src/components/form/inputs/Select/hooks/useFilteredOptions.ts +18 -0
  56. package/src/components/form/inputs/Select/hooks/useSelectAllLogic.ts +22 -0
  57. package/src/components/form/inputs/Select/index.tsx +494 -0
  58. package/src/library/icons.ts +2 -0
  59. package/src/stories/Welcome.mdx +87 -0
  60. package/src/stories/assets/Logo.stories.tsx +16 -0
  61. package/src/stories/components/actions/ButtonWithPopover.stories.tsx +33 -0
  62. package/src/stories/components/display/Card.stories.tsx +64 -47
  63. package/src/stories/components/display/ImageCard.stories.tsx +29 -27
  64. package/src/stories/components/feedback/Alert.stories.tsx +59 -50
  65. package/src/stories/components/form/CardFormContainer.stories.tsx +77 -63
  66. package/src/stories/components/form/CheckboxFormControl.stories.tsx +29 -71
  67. package/src/stories/components/form/FormControlWrapper.stories.tsx +35 -0
  68. package/src/stories/components/form/ServiceFormActions.stories.tsx +18 -21
  69. package/src/stories/components/form/ServiceFormContainer.stories.tsx +11 -11
  70. package/src/stories/components/icons/IconWithCircularBackground.stories.tsx +39 -0
  71. package/src/stories/components/icons/Icons.stories.tsx +6 -2
  72. package/src/stories/components/inputs/Checkbox.stories.tsx +17 -16
  73. package/src/stories/components/inputs/DatePicker.stories.tsx +16 -15
  74. package/src/stories/components/inputs/FileDropzone.stories.tsx +17 -34
  75. package/src/stories/components/inputs/FileUpload.stories.tsx +14 -29
  76. package/src/stories/components/inputs/NumberStepper.stories.tsx +32 -60
  77. package/src/stories/components/inputs/PhoneInput.stories.tsx +7 -5
  78. package/src/stories/components/inputs/PhoneInputFormControl.stories.tsx +33 -0
  79. package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +22 -20
  80. package/src/stories/components/inputs/SearchableField.stories.tsx +16 -14
  81. package/src/stories/components/inputs/Select.stories.tsx +245 -13
  82. package/src/stories/components/inputs/TextField.stories.tsx +47 -47
  83. package/src/stories/components/layout/Footer.stories.tsx +6 -6
  84. package/src/stories/components/layout/ServiceHeader.stories.tsx +36 -0
  85. package/src/stories/components/layout/ServicePage.stories.tsx +26 -0
  86. package/src/stories/components/navigation/Accordion.stories.tsx +14 -13
  87. package/src/stories/components/navigation/Breadcrumbs.stories.tsx +6 -8
  88. package/src/stories/components/navigation/DataPagination.stories.tsx +19 -17
  89. package/src/stories/components/navigation/ServiceWizardStepper.stories.tsx +29 -22
  90. package/src/stories/components/tabs/Tab.stories.tsx +32 -0
  91. package/src/stories/components/tabs/TabPanel.stories.tsx +31 -0
  92. package/src/stories/components/tabs/Tabs.stories.tsx +62 -0
  93. package/src/stories/components/tabs/TabsWrapper.stories.tsx +34 -0
  94. package/src/theme/light/MuiAutocomplete.ts +52 -3
  95. package/src/components/form/inputs/Select.tsx +0 -152
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesServicePage } from '../../../components/layout/ServicePage';
3
+ declare const meta: Meta<typeof RcSesServicePage>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
@@ -1,30 +1,18 @@
1
- import { Meta, ReactRenderer } from '@storybook/react';
1
+ import { Meta, StoryContext } from '@storybook/react';
2
2
  import { default as RcSesAccordion } from '../../../components/common/Accordion';
3
- import { default as useAccordionController } from '../../../components/common/Accordion/hooks/useAccordionController';
4
- import { AnnotatedStoryFn } from '@storybook/core/csf';
5
- import { AccordionClasses, Theme, AccordionSlotsAndSlotProps, PaperOwnProps } from '@mui/material';
6
- import { SxProps } from '@mui/system';
7
- import { TransitionProps } from '@mui/material/transitions';
8
- import { CommonProps } from '@mui/material/OverridableComponent';
9
- import { DetailedHTMLProps, HTMLAttributes, DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES, RefObject } from 'react';
10
3
  declare const meta: Meta<typeof RcSesAccordion>;
11
4
  export default meta;
12
- export declare const Main: AnnotatedStoryFn<ReactRenderer, {
13
- children: NonNullable<React.ReactNode>;
14
- classes?: Partial< AccordionClasses>;
15
- defaultExpanded?: boolean;
16
- disabled?: boolean;
17
- disableGutters?: boolean;
18
- expanded?: boolean;
19
- onChange?: (event: React.SyntheticEvent, expanded: boolean) => void;
20
- sx?: SxProps<Theme>;
21
- TransitionComponent?: React.JSXElementConstructor< TransitionProps & {
22
- children?: React.ReactElement<any, any>;
23
- }>;
24
- TransitionProps?: TransitionProps;
25
- } & AccordionSlotsAndSlotProps & Omit< PaperOwnProps, "onChange" | "classes"> & CommonProps & Omit<Omit< DetailedHTMLProps<HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
26
- ref?: ((instance: HTMLDivElement | null) => void | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | RefObject<HTMLDivElement> | null | undefined;
27
- }, "elevation" | "children" | "onChange" | "square" | keyof CommonProps | "sx" | "variant" | "defaultExpanded" | "disabled" | "disableGutters" | "expanded" | "TransitionComponent" | "TransitionProps" | keyof AccordionSlotsAndSlotProps> & {
28
- id: string;
29
- controller: ReturnType<typeof useAccordionController>;
30
- }>;
5
+ export declare const Main: {
6
+ render: (args: any) => import("react/jsx-runtime").JSX.Element;
7
+ args: {
8
+ disabled: boolean;
9
+ };
10
+ parameters: {
11
+ docs: {
12
+ source: {
13
+ type: string;
14
+ transform: (code: string, storyContext: StoryContext) => string;
15
+ };
16
+ };
17
+ };
18
+ };
@@ -1,8 +1,6 @@
1
- import { Meta, ReactRenderer } from '@storybook/react';
2
- import { default as RcSesBreadcrumbs, BreadcrumbItem } from '../../../components/common/Breadcrumbs';
3
- import { AnnotatedStoryFn } from '@storybook/core/csf';
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesBreadcrumbs } from '../../../components/common/Breadcrumbs';
4
3
  declare const meta: Meta<typeof RcSesBreadcrumbs>;
5
4
  export default meta;
6
- export declare const Main: AnnotatedStoryFn<ReactRenderer, {
7
- path: BreadcrumbItem[];
8
- }>;
5
+ type Story = StoryObj<typeof RcSesBreadcrumbs>;
6
+ export declare const Main: Story;
@@ -1,7 +1,7 @@
1
- import { Meta, ReactRenderer } from '@storybook/react';
2
- import { default as ServiceWizardStepper, ServiceWizardStepperProps } from '../../../components/layout/ServiceWizardStepper';
3
- import { StoryAnnotations } from '@storybook/core/csf';
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as ServiceWizardStepper } from '../../../components/layout/ServiceWizardStepper';
4
3
  declare const meta: Meta<typeof ServiceWizardStepper>;
5
4
  export default meta;
6
- export declare const Horizontal: StoryAnnotations<ReactRenderer, ServiceWizardStepperProps>;
7
- export declare const Vertical: StoryAnnotations<ReactRenderer, ServiceWizardStepperProps>;
5
+ type Story = StoryObj<typeof ServiceWizardStepper>;
6
+ export declare const Horizontal: Story;
7
+ export declare const Vertical: Story;
@@ -0,0 +1,8 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesTab } from '../../../components/common/Tabs/Tab';
3
+ declare const meta: Meta<typeof RcSesTab>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const WithIcon: Story;
8
+ export declare const Disabled: Story;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesTabPanel } from '../../../components/common/Tabs/TabPanel';
3
+ declare const meta: Meta<typeof RcSesTabPanel>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Visible: Story;
7
+ export declare const WithContent: Story;
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesTabs } from '../../../components/common/Tabs/Tabs';
3
+ declare const meta: Meta<typeof RcSesTabs>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
7
+ export declare const WithIcons: Story;
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { default as RcSesTabsWrapper } from '../../../components/common/Tabs/TabsWrapper';
3
+ declare const meta: Meta<typeof RcSesTabsWrapper>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@registrucentras/rc-ses-react-components",
3
3
  "author": "VĮ REGISTRŲ CENTRAS",
4
- "version": "1.6.3",
4
+ "version": "1.6.5",
5
5
  "description": "RC SES React komponentų biblioteka",
6
6
  "type": "module",
7
7
  "private": false,
@@ -1,8 +1,10 @@
1
+ import type { IconWeight } from '@phosphor-icons/react'
1
2
  import type { SVGProps } from 'react'
2
3
 
3
4
  type IconProps = SVGProps<SVGSVGElement> & {
4
5
  fillColor?: string
5
6
  size?: number
7
+ weight?: IconWeight
6
8
  }
7
9
 
8
10
  export default IconProps
@@ -0,0 +1,23 @@
1
+ import { CheckIcon as CheckFillIcon } from '@phosphor-icons/react'
2
+
3
+ import IconProps from '../IconProps'
4
+
5
+ function CheckIcon({
6
+ className,
7
+ fillColor,
8
+ size = 24,
9
+ weight = 'fill',
10
+ ...rest
11
+ }: IconProps) {
12
+ return (
13
+ <CheckFillIcon
14
+ {...rest}
15
+ className={className}
16
+ size={size}
17
+ weight={weight}
18
+ color={fillColor}
19
+ />
20
+ )
21
+ }
22
+
23
+ export default CheckIcon
@@ -0,0 +1,17 @@
1
+ import { PencilSimpleLineIcon as PencilSimpleLine } from '@phosphor-icons/react'
2
+
3
+ import IconProps from '../IconProps'
4
+
5
+ function PencilSimpleLineIcon({ className, fillColor, size = 24, ...rest }: IconProps) {
6
+ return (
7
+ <PencilSimpleLine
8
+ {...rest}
9
+ className={className}
10
+ size={size}
11
+ weight='fill'
12
+ color={fillColor}
13
+ />
14
+ )
15
+ }
16
+
17
+ export default PencilSimpleLineIcon
@@ -16,6 +16,7 @@ describe('RcSesCard', () => {
16
16
  <RcSesCard
17
17
  title='Card title'
18
18
  description='Card description'
19
+ headerAction={<button type='button'>Edit</button>}
19
20
  leadingActions={<button type='button'>Back</button>}
20
21
  trailingActions={<button type='button'>Continue</button>}
21
22
  >
@@ -26,6 +27,7 @@ describe('RcSesCard', () => {
26
27
  expect(screen.getByText('Card title')).toBeInTheDocument()
27
28
  expect(screen.getByText('Card description')).toBeInTheDocument()
28
29
  expect(screen.getByText('Card content')).toBeInTheDocument()
30
+ expect(screen.getByRole('button', { name: 'Edit' })).toBeInTheDocument()
29
31
  expect(screen.getByRole('button', { name: 'Back' })).toBeInTheDocument()
30
32
  expect(screen.getByRole('button', { name: 'Continue' })).toBeInTheDocument()
31
33
  })
@@ -47,6 +49,7 @@ describe('RcSesCard', () => {
47
49
  <RcSesCard
48
50
  title='Slotted title'
49
51
  description='Slotted description'
52
+ headerAction={<button type='button'>Edit</button>}
50
53
  leadingActions={<button type='button'>Leading</button>}
51
54
  trailingActions={<button type='button'>Trailing</button>}
52
55
  slotProps={{
@@ -54,6 +57,7 @@ describe('RcSesCard', () => {
54
57
  content: { className: 'content-slot' },
55
58
  description: { className: 'description-slot' },
56
59
  header: { className: 'header-slot' },
60
+ headerAction: { className: 'header-action-slot' },
57
61
  leadingActions: { className: 'leading-actions-slot' },
58
62
  title: { className: 'title-slot' },
59
63
  trailingActions: { className: 'trailing-actions-slot' },
@@ -64,6 +68,7 @@ describe('RcSesCard', () => {
64
68
  )
65
69
 
66
70
  expect(container.querySelector('.header-slot')).toBeInTheDocument()
71
+ expect(container.querySelector('.header-action-slot')).toBeInTheDocument()
67
72
  expect(container.querySelector('.title-slot')).toBeInTheDocument()
68
73
  expect(container.querySelector('.description-slot')).toBeInTheDocument()
69
74
  expect(container.querySelector('.content-slot')).toBeInTheDocument()
@@ -77,11 +82,13 @@ describe('RcSesCard', () => {
77
82
  <RcSesCard
78
83
  title='Test id title'
79
84
  description='Test id description'
85
+ headerAction={<button type='button'>Edit</button>}
80
86
  leadingActions={<button type='button'>Leading</button>}
81
87
  trailingActions={<button type='button'>Trailing</button>}
82
88
  testIds={{
83
89
  root: 'card-root',
84
90
  header: 'card-header',
91
+ headerAction: 'card-header-action',
85
92
  title: 'card-title',
86
93
  description: 'card-description',
87
94
  content: 'card-content',
@@ -96,6 +103,7 @@ describe('RcSesCard', () => {
96
103
 
97
104
  expect(screen.getByTestId('card-root')).toBeInTheDocument()
98
105
  expect(screen.getByTestId('card-header')).toBeInTheDocument()
106
+ expect(screen.getByTestId('card-header-action')).toBeInTheDocument()
99
107
  expect(screen.getByTestId('card-title')).toBeInTheDocument()
100
108
  expect(screen.getByTestId('card-description')).toBeInTheDocument()
101
109
  expect(screen.getByTestId('card-content')).toBeInTheDocument()
@@ -18,6 +18,7 @@ export type RcSesCardTestIds = {
18
18
  root?: string
19
19
  image?: string
20
20
  header?: string
21
+ headerAction?: string
21
22
  title?: string
22
23
  description?: string
23
24
  content?: string
@@ -30,6 +31,7 @@ export type RcSesCardProps = Omit<CardProps, 'children' | 'title'> & {
30
31
  title: ReactNode
31
32
  description?: ReactNode
32
33
  image?: ReactNode
34
+ headerAction?: ReactNode
33
35
  centered?: boolean
34
36
  contentBackground?: boolean
35
37
  children?: ReactNode
@@ -41,6 +43,7 @@ export type RcSesCardProps = Omit<CardProps, 'children' | 'title'> & {
41
43
  content?: BoxProps
42
44
  description?: TypographyProps
43
45
  header?: StackProps
46
+ headerAction?: BoxProps
44
47
  image?: BoxProps
45
48
  leadingActions?: StackProps
46
49
  title?: TypographyProps
@@ -73,6 +76,7 @@ function RcSesCard({
73
76
  title,
74
77
  description,
75
78
  image,
79
+ headerAction,
76
80
  centered = false,
77
81
  contentBackground = true,
78
82
  children,
@@ -87,6 +91,7 @@ function RcSesCard({
87
91
  const contentProps = slotProps?.content
88
92
  const descriptionProps = slotProps?.description
89
93
  const headerProps = slotProps?.header
94
+ const headerActionProps = slotProps?.headerAction
90
95
  const imageProps = slotProps?.image
91
96
  const leadingActionsProps = slotProps?.leadingActions
92
97
  const titleProps = slotProps?.title
@@ -95,6 +100,7 @@ function RcSesCard({
95
100
  const normalizedSx = normalizeSx(sx)
96
101
  const normalizedTitleSx = normalizeSx(titleProps?.sx)
97
102
  const normalizedDescriptionSx = normalizeSx(descriptionProps?.sx)
103
+ const normalizedHeaderActionSx = normalizeSx(headerActionProps?.sx)
98
104
  const normalizedContentSx = normalizeSx(contentProps?.sx)
99
105
  const normalizedActionsSx = normalizeSx(actionsProps?.sx)
100
106
  const normalizedImageSx = normalizeSx(imageProps?.sx)
@@ -135,45 +141,78 @@ function RcSesCard({
135
141
  ) : null}
136
142
 
137
143
  <Stack
138
- {...headerProps}
139
- data-testid={testIds?.header}
140
- spacing={0.5}
141
- sx={[centered ? { alignItems: 'center' } : {}, ...normalizeSx(headerProps?.sx)]}
144
+ direction='row'
145
+ sx={{
146
+ alignItems: 'flex-start',
147
+ justifyContent: 'space-between',
148
+ width: '100%',
149
+ }}
142
150
  >
143
- <Typography
144
- color={palette.grey[900]}
145
- data-testid={testIds?.title}
146
- variant='h5'
147
- {...titleProps}
151
+ <Stack
152
+ {...headerProps}
153
+ data-testid={testIds?.header}
154
+ spacing={0.5}
148
155
  sx={[
149
156
  {
150
- lineHeight: '1.75rem',
151
- ...(centered ? { textAlign: 'center' } : {}),
157
+ flex: 1,
158
+ minWidth: 0,
152
159
  },
153
- ...normalizedTitleSx,
160
+ centered ? { alignItems: 'center' } : {},
161
+ ...normalizeSx(headerProps?.sx),
154
162
  ]}
155
163
  >
156
- {title}
157
- </Typography>
158
-
159
- {!!description && (
160
164
  <Typography
161
- color={palette.grey[800]}
162
- data-testid={testIds?.description}
163
- variant='body2'
164
- {...descriptionProps}
165
+ color={palette.grey[900]}
166
+ data-testid={testIds?.title}
167
+ variant='h5'
168
+ {...titleProps}
165
169
  sx={[
166
170
  {
167
- fontWeight: 300,
168
- lineHeight: '1.25rem',
171
+ lineHeight: '1.75rem',
169
172
  ...(centered ? { textAlign: 'center' } : {}),
170
173
  },
171
- ...normalizedDescriptionSx,
174
+ ...normalizedTitleSx,
172
175
  ]}
173
176
  >
174
- {description}
177
+ {title}
175
178
  </Typography>
176
- )}
179
+
180
+ {!!description && (
181
+ <Typography
182
+ color={palette.grey[800]}
183
+ data-testid={testIds?.description}
184
+ variant='body2'
185
+ {...descriptionProps}
186
+ sx={[
187
+ {
188
+ fontWeight: 300,
189
+ lineHeight: '1.25rem',
190
+ ...(centered ? { textAlign: 'center' } : {}),
191
+ },
192
+ ...normalizedDescriptionSx,
193
+ ]}
194
+ >
195
+ {description}
196
+ </Typography>
197
+ )}
198
+ </Stack>
199
+
200
+ {headerAction ? (
201
+ <Box
202
+ {...headerActionProps}
203
+ data-testid={testIds?.headerAction}
204
+ sx={[
205
+ {
206
+ alignItems: 'flex-start',
207
+ display: 'flex',
208
+ flexShrink: 0,
209
+ },
210
+ ...normalizedHeaderActionSx,
211
+ ]}
212
+ >
213
+ {headerAction}
214
+ </Box>
215
+ ) : null}
177
216
  </Stack>
178
217
 
179
218
  {children ? (
@@ -55,11 +55,12 @@ const SelectableCardList = ({
55
55
 
56
56
  return (
57
57
  <Container
58
+ disableGutters
58
59
  sx={{
59
60
  display: 'flex',
60
61
  flexDirection: 'column',
61
62
  alignItems: 'center',
62
- gap: '16px',
63
+ gap: '1rem',
63
64
  }}
64
65
  >
65
66
  {error != null ? (
@@ -59,7 +59,12 @@ function RcSesFormControlWrapper({
59
59
  xs: '0 0 0%',
60
60
  sm: labelOnTop ? '0 0 0%' : `0 0 ${formControlDesktopLabelWidth}`,
61
61
  },
62
- ...(labelOnTop && { fontSize: '.8125rem', fontWeight: 400 }),
62
+ ...(labelOnTop && {
63
+ '&': {
64
+ fontSize: '.8125rem',
65
+ fontWeight: 400,
66
+ },
67
+ }),
63
68
  marginBottom: { xs: '.25rem', sm: labelOnTop ? '.25rem' : '0' },
64
69
  pr: 3,
65
70
  textAlign: { xs: 'left', sm: labelOnTop ? 'left' : 'right' },
@@ -83,13 +83,21 @@ function RcSesPhoneInputFormControl(props: Props) {
83
83
  rules: {
84
84
  ...rules,
85
85
  validate: {
86
- phoneNoFormat: (value) =>
87
- mask.completed(value.replace(country.code ?? '', '')) || t('invalid'),
86
+ phoneNoFormat: (value) => {
87
+ if (typeof value !== 'string') {
88
+ return t('invalid')
89
+ }
90
+
91
+ return mask.completed(value.replace(country.code ?? '', '')) || t('invalid')
92
+ },
88
93
  ...rules?.validate,
89
94
  },
90
95
  },
91
96
  })
92
97
 
98
+ const phoneValue =
99
+ typeof controllerProps.value === 'string' ? controllerProps.value : ''
100
+
93
101
  const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null)
94
102
 
95
103
  const handleClick = (e: React.MouseEvent<HTMLElement>) => setAnchorEl(e.currentTarget)
@@ -172,7 +180,7 @@ function RcSesPhoneInputFormControl(props: Props) {
172
180
  pattern: '^[0-9\\(\\)\\- ]*$/',
173
181
  }}
174
182
  placeholder={mask.opts.mask?.toString()}
175
- value={mask.masked(controllerProps.value.replace(country.code ?? '', ''))}
183
+ value={mask.masked(phoneValue.replace(country.code ?? '', ''))}
176
184
  onChange={(e) =>
177
185
  controllerProps.onChange({
178
186
  ...e,
@@ -0,0 +1,5 @@
1
+ export type Option = {
2
+ label: string
3
+ value: string
4
+ description?: string
5
+ }
@@ -0,0 +1,18 @@
1
+ import { useMemo } from 'react'
2
+
3
+ import { Option } from '../Select.types'
4
+
5
+ function useFilteredOptions(options: Option[], search: string) {
6
+ return useMemo(() => {
7
+ const normalized = search.trim().toLowerCase()
8
+ if (!normalized) return options
9
+
10
+ return options.filter((opt) => {
11
+ const label = opt.label?.toLowerCase() ?? ''
12
+ const desc = opt.description?.toLowerCase() ?? ''
13
+ return label.includes(normalized) || desc.includes(normalized)
14
+ })
15
+ }, [options, search])
16
+ }
17
+
18
+ export default useFilteredOptions
@@ -0,0 +1,22 @@
1
+ import { Option } from '../Select.types'
2
+
3
+ type OnChange = (values: string[]) => void
4
+
5
+ function useSelectAll(options: Option[], selectedValues: string[], onChange: OnChange) {
6
+ const allSelected =
7
+ options.length > 0 && options.every((o) => selectedValues.includes(o.value))
8
+
9
+ const toggle = () => {
10
+ const values = options.map((o) => o.value)
11
+
12
+ if (allSelected) {
13
+ onChange(selectedValues.filter((v) => !values.includes(v)))
14
+ } else {
15
+ onChange(Array.from(new Set([...selectedValues, ...values])))
16
+ }
17
+ }
18
+
19
+ return { allSelected, toggle }
20
+ }
21
+
22
+ export default useSelectAll