@registrucentras/rc-ses-react-components 1.6.4 → 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 (60) 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/components/display/Card.stories.d.ts +6 -47
  13. package/dist/stories/components/display/ImageCard.stories.d.ts +6 -6
  14. package/dist/stories/components/feedback/Alert.stories.d.ts +7 -16
  15. package/dist/stories/components/form/CardFormContainer.stories.d.ts +5 -5
  16. package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +3 -23
  17. package/dist/stories/components/form/ServiceFormActions.stories.d.ts +3 -9
  18. package/dist/stories/components/icons/Icons.stories.d.ts +3 -2
  19. package/dist/stories/components/inputs/FileDropzone.stories.d.ts +3 -29
  20. package/dist/stories/components/inputs/NumberStepper.stories.d.ts +3 -31
  21. package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +4 -32
  22. package/dist/stories/components/inputs/SearchableField.stories.d.ts +3 -332
  23. package/dist/stories/components/inputs/Select.stories.d.ts +4 -871
  24. package/dist/stories/components/inputs/TextField.stories.d.ts +3 -610
  25. package/dist/stories/components/layout/Footer.stories.d.ts +3 -5
  26. package/dist/stories/components/navigation/Breadcrumbs.stories.d.ts +4 -6
  27. package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +5 -5
  28. package/package.json +1 -1
  29. package/src/assets/IconProps.ts +2 -0
  30. package/src/assets/icons/CheckIcon.tsx +23 -0
  31. package/src/assets/icons/PencilSimpleLineIcon.tsx +17 -0
  32. package/src/components/common/Card/index.test.tsx +8 -0
  33. package/src/components/common/Card/index.tsx +64 -25
  34. package/src/components/common/SelectableCardList/index.tsx +2 -1
  35. package/src/components/form/components/FormControlWrapper/index.tsx +6 -1
  36. package/src/components/form/inputs/PhoneInputFormControl/index.tsx +11 -3
  37. package/src/components/form/inputs/Select/Select.types.ts +5 -0
  38. package/src/components/form/inputs/Select/hooks/useFilteredOptions.ts +18 -0
  39. package/src/components/form/inputs/Select/hooks/useSelectAllLogic.ts +22 -0
  40. package/src/components/form/inputs/Select/index.tsx +494 -0
  41. package/src/library/icons.ts +2 -0
  42. package/src/stories/components/display/Card.stories.tsx +64 -47
  43. package/src/stories/components/display/ImageCard.stories.tsx +29 -27
  44. package/src/stories/components/feedback/Alert.stories.tsx +59 -50
  45. package/src/stories/components/form/CardFormContainer.stories.tsx +77 -63
  46. package/src/stories/components/form/CheckboxFormControl.stories.tsx +29 -71
  47. package/src/stories/components/form/ServiceFormActions.stories.tsx +18 -21
  48. package/src/stories/components/form/ServiceFormContainer.stories.tsx +1 -1
  49. package/src/stories/components/icons/Icons.stories.tsx +6 -2
  50. package/src/stories/components/inputs/FileDropzone.stories.tsx +17 -34
  51. package/src/stories/components/inputs/NumberStepper.stories.tsx +32 -60
  52. package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +22 -20
  53. package/src/stories/components/inputs/SearchableField.stories.tsx +16 -14
  54. package/src/stories/components/inputs/Select.stories.tsx +245 -13
  55. package/src/stories/components/inputs/TextField.stories.tsx +47 -47
  56. package/src/stories/components/layout/Footer.stories.tsx +6 -6
  57. package/src/stories/components/navigation/Breadcrumbs.stories.tsx +6 -8
  58. package/src/stories/components/navigation/ServiceWizardStepper.stories.tsx +29 -22
  59. package/src/theme/light/MuiAutocomplete.ts +52 -3
  60. 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
+ }
@@ -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