@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
@@ -27,27 +27,34 @@ export default meta
27
27
 
28
28
  type Story = StoryObj<typeof ServiceWizardStepper>
29
29
 
30
- const createStory = (orientation: 'horizontal' | 'vertical'): Story => ({
31
- render: (args) => {
32
- const [activeStep, setActiveStep] = useState(0)
33
-
34
- const handleStepClick = (index: number) => {
35
- if (index > activeStep) return
36
- setActiveStep(index)
37
- }
38
-
39
- return (
40
- <ServiceWizardStepper
41
- {...args}
42
- steps={steps}
43
- activeStep={activeStep}
44
- onStepClick={handleStepClick}
45
- orientation={orientation}
46
- />
47
- )
48
- },
49
- })
30
+ function ServiceWizardStepperDemo({
31
+ orientation,
32
+ ...args
33
+ }: {
34
+ orientation: 'horizontal' | 'vertical'
35
+ } & Record<string, unknown>) {
36
+ const [activeStep, setActiveStep] = useState(0)
37
+
38
+ const handleStepClick = (index: number) => {
39
+ if (index > activeStep) return
40
+ setActiveStep(index)
41
+ }
42
+
43
+ return (
44
+ <ServiceWizardStepper
45
+ {...args}
46
+ steps={steps}
47
+ activeStep={activeStep}
48
+ onStepClick={handleStepClick}
49
+ orientation={orientation}
50
+ />
51
+ )
52
+ }
50
53
 
51
- export const Horizontal = createStory('horizontal')
54
+ export const Horizontal: Story = {
55
+ render: (args) => <ServiceWizardStepperDemo {...args} orientation='horizontal' />,
56
+ }
52
57
 
53
- export const Vertical = createStory('vertical')
58
+ export const Vertical: Story = {
59
+ render: (args) => <ServiceWizardStepperDemo {...args} orientation='vertical' />,
60
+ }
@@ -0,0 +1,32 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import RcSesTab from '@/components/common/Tabs/Tab'
4
+
5
+ const meta: Meta<typeof RcSesTab> = {
6
+ title: 'components/tabs/Tab',
7
+ component: RcSesTab,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ disabled: { control: 'boolean' },
11
+ label: { control: 'text' },
12
+ icon: { control: 'text' },
13
+ iconPosition: {
14
+ control: { type: 'select', options: ['top', 'bottom', 'start', 'end'] },
15
+ },
16
+ },
17
+ }
18
+
19
+ export default meta
20
+ type Story = StoryObj<typeof meta>
21
+
22
+ export const Default: Story = {
23
+ args: { label: 'Tab Label' },
24
+ }
25
+
26
+ export const WithIcon: Story = {
27
+ args: { label: 'Home', icon: '⭐', iconPosition: 'start' },
28
+ }
29
+
30
+ export const Disabled: Story = {
31
+ args: { label: 'Disabled Tab', disabled: true },
32
+ }
@@ -0,0 +1,31 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import RcSesTabPanel from '@/components/common/Tabs/TabPanel'
4
+
5
+ const meta: Meta<typeof RcSesTabPanel> = {
6
+ title: 'components/tabs/TabPanel',
7
+ component: RcSesTabPanel,
8
+ tags: ['autodocs'],
9
+ }
10
+
11
+ export default meta
12
+ type Story = StoryObj<typeof meta>
13
+
14
+ export const Visible: Story = {
15
+ render: () => (
16
+ <RcSesTabPanel activeTab={0} index={0}>
17
+ Panel is visible (activeTab matches index)
18
+ </RcSesTabPanel>
19
+ ),
20
+ }
21
+
22
+ export const WithContent: Story = {
23
+ render: () => (
24
+ <RcSesTabPanel activeTab={0} index={0}>
25
+ <div>
26
+ <h3>Panel Title</h3>
27
+ <p>Panel with structured content</p>
28
+ </div>
29
+ </RcSesTabPanel>
30
+ ),
31
+ }
@@ -0,0 +1,62 @@
1
+ import { Box } from '@mui/material'
2
+ import { Meta, StoryObj } from '@storybook/react'
3
+ import { useState } from 'react'
4
+
5
+ import RcSesTab from '@/components/common/Tabs/Tab'
6
+ import RcSesTabs from '@/components/common/Tabs/Tabs'
7
+
8
+ const meta: Meta<typeof RcSesTabs> = {
9
+ title: 'components/tabs/Tabs',
10
+ component: RcSesTabs,
11
+ tags: ['autodocs'],
12
+ argTypes: {
13
+ value: { control: 'number' },
14
+ },
15
+ }
16
+
17
+ export default meta
18
+ type Story = StoryObj<typeof meta>
19
+
20
+ function DefaultTabsWrapper() {
21
+ const [value, setValue] = useState(0)
22
+ return (
23
+ <Box>
24
+ <RcSesTabs value={value} onChange={(_, newValue) => setValue(newValue)}>
25
+ <RcSesTab label='Tab 1' />
26
+ <RcSesTab label='Tab 2' />
27
+ <RcSesTab label='Tab 3' />
28
+ </RcSesTabs>
29
+ <Box sx={{ p: 2 }}>
30
+ {value === 0 && <p>Content for Tab 1 goes here</p>}
31
+ {value === 1 && <p>Content for Tab 2 goes here</p>}
32
+ {value === 2 && <p>Content for Tab 3 goes here</p>}
33
+ </Box>
34
+ </Box>
35
+ )
36
+ }
37
+
38
+ function WithIconsTabsWrapper() {
39
+ const [value, setValue] = useState(0)
40
+ return (
41
+ <Box>
42
+ <RcSesTabs value={value} onChange={(_, newValue) => setValue(newValue)}>
43
+ <RcSesTab label='Home' icon='🏠' iconPosition='start' />
44
+ <RcSesTab label='Settings' icon='⚙️' iconPosition='start' />
45
+ <RcSesTab label='Profile' icon='👤' iconPosition='start' />
46
+ </RcSesTabs>
47
+ <Box sx={{ p: 2 }}>
48
+ {value === 0 && <p>Welcome to the Home tab</p>}
49
+ {value === 1 && <p>Adjust your Settings here</p>}
50
+ {value === 2 && <p>View your Profile information</p>}
51
+ </Box>
52
+ </Box>
53
+ )
54
+ }
55
+
56
+ export const Default: Story = {
57
+ render: () => <DefaultTabsWrapper />,
58
+ }
59
+
60
+ export const WithIcons: Story = {
61
+ render: () => <WithIconsTabsWrapper />,
62
+ }
@@ -0,0 +1,34 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import RcSesTab from '@/components/common/Tabs/Tab'
4
+ import RcSesTabPanel from '@/components/common/Tabs/TabPanel'
5
+ import RcSesTabs from '@/components/common/Tabs/Tabs'
6
+ import RcSesTabsWrapper from '@/components/common/Tabs/TabsWrapper'
7
+
8
+ const meta: Meta<typeof RcSesTabsWrapper> = {
9
+ title: 'components/tabs/TabsWrapper',
10
+ component: RcSesTabsWrapper,
11
+ tags: ['autodocs'],
12
+ argTypes: {
13
+ heading: { control: 'text' },
14
+ },
15
+ }
16
+
17
+ export default meta
18
+ type Story = StoryObj<typeof meta>
19
+
20
+ export const Default: Story = {
21
+ args: {
22
+ heading: 'Section Title',
23
+ },
24
+ render: (args) => (
25
+ <RcSesTabsWrapper heading={args.heading}>
26
+ <RcSesTabs value={0}>
27
+ <RcSesTab label='Tab' />
28
+ </RcSesTabs>
29
+ <RcSesTabPanel activeTab={0} index={0}>
30
+ Tab content
31
+ </RcSesTabPanel>
32
+ </RcSesTabsWrapper>
33
+ ),
34
+ }
@@ -9,6 +9,18 @@ const MuiAutocomplete: Components['MuiAutocomplete'] = {
9
9
  '.MuiOutlinedInput-root': {
10
10
  borderRadius: '.5rem',
11
11
 
12
+ '.MuiOutlinedInput-notchedOutline': {
13
+ borderRadius: '.5rem',
14
+ },
15
+
16
+ '&.Mui-focused': {
17
+ borderRadius: '.5rem',
18
+
19
+ '.MuiOutlinedInput-notchedOutline': {
20
+ borderRadius: '.5rem',
21
+ },
22
+ },
23
+
12
24
  '.MuiAutocomplete-input': {
13
25
  marginRight: '2rem',
14
26
  padding: '.25rem .1875rem',
@@ -16,20 +28,56 @@ const MuiAutocomplete: Components['MuiAutocomplete'] = {
16
28
  },
17
29
  },
18
30
  paper: {
19
- borderRadius: '.5rem',
31
+ backgroundColor: 'white',
32
+ borderRadius: '.375rem',
20
33
  fontSize: '.9375rem',
21
34
  lineHeight: '1.125rem',
22
35
 
23
36
  '.MuiAutocomplete-listbox': {
37
+ '.MuiAutocomplete-groupLabel': {
38
+ color: palette.primary['600'],
39
+ fontFamily: '"Public Sans", sans-serif',
40
+ fontSize: '.75rem',
41
+ fontStyle: 'normal',
42
+ fontWeight: 500,
43
+ letterSpacing: '.0075rem',
44
+ lineHeight: '140%',
45
+ padding: '.5rem .75rem .25rem',
46
+ textTransform: 'uppercase',
47
+ },
48
+
24
49
  '.MuiAutocomplete-option': {
25
50
  alignItems: 'flex-start',
51
+ backgroundColor: 'transparent',
26
52
  borderRadius: '.375rem',
53
+ color: palette.grey['900'],
27
54
  flexDirection: 'column',
28
55
  margin: '0 .375rem',
29
56
  padding: '.8125rem .75rem',
57
+ transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)',
58
+
59
+ '&:hover': {
60
+ backgroundColor: palette.grey['100'],
61
+ },
62
+
63
+ '&.Mui-focused': {
64
+ backgroundColor: palette.grey['100'],
65
+ },
66
+
67
+ '&.Mui-selected': {
68
+ backgroundColor: 'transparent',
69
+
70
+ '&:hover, &.Mui-focused': {
71
+ backgroundColor: palette.grey['100'],
72
+ },
73
+ },
74
+
75
+ '&[aria-selected="true"]': {
76
+ backgroundColor: 'transparent',
77
+ },
30
78
 
31
- '.Mui-focused': {
32
- backgroundClor: palette.grey['100'],
79
+ '&[aria-selected="true"].Mui-focused, &[aria-selected="true"]:hover': {
80
+ backgroundColor: palette.grey['100'],
33
81
  },
34
82
 
35
83
  '.rc-ses-select-option-label': {
@@ -42,6 +90,7 @@ const MuiAutocomplete: Components['MuiAutocomplete'] = {
42
90
  fontStyle: 'italic',
43
91
  lineHeight: '1rem',
44
92
  marginTop: '.25rem',
93
+ fontWeight: 500,
45
94
  },
46
95
  },
47
96
  },
@@ -1,152 +0,0 @@
1
- import { Box, CircularProgress, TextField } from '@mui/material'
2
- import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete'
3
- import React, { useMemo } from 'react'
4
- import { UseControllerProps, useController } from 'react-hook-form'
5
- import { v4 as uuidv4 } from 'uuid'
6
-
7
- import RcSesFormControlWrapper, {
8
- RcSesFormControlWrapperProps,
9
- } from '../components/FormControlWrapper'
10
-
11
- type Option = {
12
- description?: string
13
- label: string
14
- value: string
15
- }
16
-
17
- type TControllerProps = UseControllerProps<any, any>
18
- type ImmediateControllerProps = 'control' | 'rules' | 'name' | 'disabled'
19
-
20
- type TFieldProps = Omit<
21
- AutocompleteProps<Option | '', false, boolean, false>,
22
- 'value' | 'disableClearable'
23
- >
24
- type ImmediateFieldProps = 'onInputChange'
25
-
26
- type TWrapperProps = RcSesFormControlWrapperProps
27
- type ImmediateWrapperProps = 'id' | 'label' | 'errors'
28
-
29
- type Props = Pick<TControllerProps, ImmediateControllerProps> &
30
- Pick<TFieldProps, ImmediateFieldProps> &
31
- Pick<TWrapperProps, ImmediateWrapperProps> & {
32
- clearable?: boolean
33
- loading?: boolean
34
- options: (Option | '')[]
35
- placeholder?: string
36
- slotProps?: {
37
- controller?: Partial<Omit<TControllerProps, ImmediateControllerProps>>
38
- field?: Partial<Omit<TFieldProps, ImmediateFieldProps>>
39
- wrapper?: Partial<Omit<TWrapperProps, ImmediateWrapperProps>>
40
- }
41
- }
42
-
43
- function RcSesSelect(props: Props) {
44
- const [inputValue, setInputValue] = React.useState<string>('')
45
-
46
- const {
47
- clearable,
48
- control,
49
- errors,
50
- label,
51
- loading,
52
- onInputChange,
53
- options,
54
- placeholder,
55
- rules,
56
- slotProps,
57
- ...fieldProps
58
- } = props
59
- const { disabled, name } = fieldProps
60
-
61
- const id = useMemo(() => fieldProps.id ?? uuidv4(), [fieldProps.id])
62
-
63
- const {
64
- field: { onChange, value },
65
- } = useController({
66
- control,
67
- name,
68
- rules,
69
- shouldUnregister: true,
70
- })
71
-
72
- const hasError = !!errors
73
-
74
- const resolvedValue = React.useMemo(
75
- () =>
76
- value
77
- ? {
78
- value,
79
- label: (options.find((o) => (o && o.value) === value) as Option)?.label ?? '',
80
- }
81
- : null,
82
- [options, value],
83
- )
84
-
85
- return (
86
- <RcSesFormControlWrapper
87
- id={id}
88
- errors={errors}
89
- label={label}
90
- required={!!rules?.required}
91
- {...slotProps?.wrapper}
92
- >
93
- <Autocomplete
94
- id={id}
95
- disabled={disabled}
96
- disableClearable={clearable === false}
97
- getOptionLabel={(option) => (typeof option === 'object' ? option.label : '')}
98
- getOptionKey={(option) => (typeof option === 'object' ? option?.value : '')}
99
- inputValue={inputValue}
100
- isOptionEqualToValue={(option, selection) =>
101
- option === '' ||
102
- (typeof option === 'object' &&
103
- typeof selection === 'object' &&
104
- option?.value === selection?.value)
105
- }
106
- loading={loading}
107
- onChange={(_event, item) => onChange(typeof item === 'object' && item?.value)}
108
- onInputChange={(event, val, reason) => {
109
- setInputValue(val ?? null)
110
- if (onInputChange) onInputChange(event, val, reason)
111
- }}
112
- options={options}
113
- renderInput={(params) => (
114
- <TextField
115
- {...params}
116
- disabled={disabled}
117
- error={hasError}
118
- InputProps={{
119
- ...params.InputProps,
120
- endAdornment: (
121
- <>
122
- {loading ? <CircularProgress color='inherit' size={16} /> : null}
123
- {params.InputProps.endAdornment}
124
- </>
125
- ),
126
- }}
127
- placeholder={placeholder}
128
- />
129
- )}
130
- renderOption={(optionProps, option, _state, ownerState) => {
131
- const { key, ...rest } = optionProps as any
132
- return (
133
- <Box key={key} component='li' {...rest}>
134
- <span className='rc-ses-select-option-label'>
135
- {ownerState.getOptionLabel(option)}
136
- </span>
137
- {!!option && (
138
- <span className='rc-ses-select-option-description'>
139
- {option.description}
140
- </span>
141
- )}
142
- </Box>
143
- )
144
- }}
145
- value={resolvedValue}
146
- {...slotProps?.field}
147
- />
148
- </RcSesFormControlWrapper>
149
- )
150
- }
151
-
152
- export default RcSesSelect