@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
@@ -1,7 +1,4 @@
1
- /* eslint-disable @typescript-eslint/no-unused-vars */
2
-
3
- /* eslint-disable react/function-component-definition */
4
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
1
+ import { Meta, StoryObj } from '@storybook/react'
5
2
 
6
3
  import RcSesServiceFormActions from '@/components/layout/ServiceFormActions'
7
4
  import FieldView from '@/components/storybook/FieldView'
@@ -15,30 +12,30 @@ const meta: Meta<typeof RcSesServiceFormActions> = {
15
12
 
16
13
  export default meta
17
14
 
18
- const Template: StoryFn<typeof RcSesServiceFormActions> = (args) => (
19
- <Fields>
20
- <FieldView>
21
- <RcSesServiceFormActions {...args} />
22
- </FieldView>
23
- </Fields>
24
- )
15
+ type Story = StoryObj<typeof RcSesServiceFormActions>
25
16
 
26
- const codeBlock = (args: any) => `
17
+ const codeBlock = () => `
27
18
  import RcSesServiceFormActions from '@/components/layout/ServiceFormActions'
28
19
 
29
20
  const MyComponent = () => (
30
21
  <RcSesServiceFormActions/>
31
22
  );`
32
23
 
33
- export const Main = Template.bind({})
34
- Main.args = {}
35
-
36
- Main.parameters = {
37
- docs: {
38
- source: {
39
- type: 'dynamic',
40
- transform: (code: string, storyContext: StoryContext) =>
41
- codeBlock(storyContext.args),
24
+ export const Main: Story = {
25
+ render: (args) => (
26
+ <Fields>
27
+ <FieldView>
28
+ <RcSesServiceFormActions {...args} />
29
+ </FieldView>
30
+ </Fields>
31
+ ),
32
+ args: {},
33
+ parameters: {
34
+ docs: {
35
+ source: {
36
+ type: 'dynamic',
37
+ transform: () => codeBlock(),
38
+ },
42
39
  },
43
40
  },
44
41
  }
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-unused-vars */
2
2
 
3
3
  /* eslint-disable react/function-component-definition */
4
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
4
+ import { Meta, StoryContext } from '@storybook/react'
5
5
 
6
6
  import RcSesAccordion from '@/components/common/Accordion'
7
7
  import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
@@ -40,7 +40,7 @@ const meta: Meta<typeof RcSesServiceFormContainer> = {
40
40
 
41
41
  export default meta
42
42
 
43
- const Template: StoryFn<typeof RcSesServiceFormContainer> = (args) => {
43
+ function ServiceFormContainerDemo() {
44
44
  const accordionController = useAccordionController({
45
45
  initialState: {
46
46
  basicInformation: {
@@ -164,15 +164,15 @@ const codeBlock = (args: any) => `
164
164
  </RcSesServiceFormContainer>
165
165
  );`
166
166
 
167
- export const Main = Template.bind({})
168
- Main.args = {}
169
-
170
- Main.parameters = {
171
- docs: {
172
- source: {
173
- type: 'dynamic',
174
- transform: (code: string, storyContext: StoryContext) =>
175
- codeBlock(storyContext.args),
167
+ export const Main = {
168
+ render: () => <ServiceFormContainerDemo />,
169
+ parameters: {
170
+ docs: {
171
+ source: {
172
+ type: 'dynamic',
173
+ transform: (code: string, storyContext: StoryContext) =>
174
+ codeBlock(storyContext.args),
175
+ },
176
176
  },
177
177
  },
178
178
  }
@@ -0,0 +1,39 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import CheckBoldIcon from '@/assets/icons/CheckBoldIcon'
4
+ import RcSesIconWithCircularBackground from '@/components/common/IconWithCircularBackground'
5
+
6
+ const meta: Meta<typeof RcSesIconWithCircularBackground> = {
7
+ title: 'components/icons/IconWithCircularBackground',
8
+ component: RcSesIconWithCircularBackground,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ size: {
12
+ control: {
13
+ type: 'select',
14
+ options: ['tiny', 'small', 'medium', 'mediumLarge', 'large'],
15
+ },
16
+ },
17
+ color: {
18
+ control: {
19
+ type: 'select',
20
+ options: ['primary', 'secondary', 'success', 'error', 'warning', 'info'],
21
+ },
22
+ },
23
+ bgShade: { control: 'text' },
24
+ iconShade: { control: 'text' },
25
+ },
26
+ }
27
+
28
+ export default meta
29
+ type Story = StoryObj<typeof meta>
30
+
31
+ export const Default: Story = {
32
+ args: {
33
+ Icon: CheckBoldIcon,
34
+ size: 'medium',
35
+ color: 'primary',
36
+ bgShade: '50',
37
+ iconShade: '600',
38
+ },
39
+ }
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable react/function-component-definition, react/prop-types */
2
2
  import { Box, FormControl, MenuItem, Select, Typography } from '@mui/material'
3
- import type { Meta, StoryFn } from '@storybook/react'
3
+ import type { Meta, StoryObj } from '@storybook/react'
4
4
  import { useMemo, useState } from 'react'
5
5
  import type { ReactElement } from 'react'
6
6
 
@@ -349,4 +349,8 @@ const GalleryComponent = ({ className, size, fillColor }: StoryArgs) => {
349
349
  )
350
350
  }
351
351
 
352
- export const Gallery: StoryFn<StoryArgs> = (args) => <GalleryComponent {...args} />
352
+ type Story = StoryObj<StoryArgs>
353
+
354
+ export const Gallery: Story = {
355
+ render: (args) => <GalleryComponent {...args} />,
356
+ }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
2
+ import { Meta, StoryContext } from '@storybook/react'
3
3
  import { useForm } from 'react-hook-form'
4
4
 
5
5
  import RcSesCheckbox from '@/components/form/inputs/Checkbox'
@@ -73,7 +73,7 @@ const meta: Meta<typeof RcSesCheckbox> = {
73
73
 
74
74
  export default meta
75
75
 
76
- const Template: StoryFn<typeof RcSesCheckbox> = (args) => {
76
+ function CheckboxDemo(args: any) {
77
77
  const {
78
78
  control,
79
79
  formState: { errors },
@@ -195,20 +195,21 @@ const codeBlock = (args: any) => {
195
195
  );`
196
196
  }
197
197
 
198
- export const Main = Template.bind({})
199
- Main.args = {
200
- label: 'Click Me',
201
- variant: 'outlined',
202
- children: 'This is content',
203
- disabled: false,
204
- }
205
-
206
- Main.parameters = {
207
- docs: {
208
- source: {
209
- type: 'dynamic',
210
- transform: (code: string, storyContext: StoryContext) =>
211
- codeBlock(storyContext.args),
198
+ export const Main = {
199
+ render: (args: any) => <CheckboxDemo {...args} />,
200
+ args: {
201
+ label: 'Click Me',
202
+ variant: 'outlined',
203
+ children: 'This is content',
204
+ disabled: false,
205
+ },
206
+ parameters: {
207
+ docs: {
208
+ source: {
209
+ type: 'dynamic',
210
+ transform: (code: string, storyContext: StoryContext) =>
211
+ codeBlock(storyContext.args),
212
+ },
212
213
  },
213
214
  },
214
215
  }
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable react/function-component-definition */
2
2
  import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'
3
3
  import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
4
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
4
+ import { Meta, StoryContext } from '@storybook/react'
5
5
  import { lt } from 'date-fns/locale/lt'
6
6
  import { useForm } from 'react-hook-form'
7
7
 
@@ -28,7 +28,7 @@ const meta: Meta<typeof RcSesDatepicker> = {
28
28
 
29
29
  export default meta
30
30
 
31
- const Template: StoryFn<typeof RcSesDatepicker> = (args) => {
31
+ function DatePickerDemo(args: any) {
32
32
  const { clearable, label, rules } = args
33
33
 
34
34
  const {
@@ -81,19 +81,20 @@ const codeBlock = (args: any) => {
81
81
  );`
82
82
  }
83
83
 
84
- export const Main = Template.bind({})
85
- Main.args = {
86
- clearable: true,
87
- label: 'Terminas',
88
- rules: { required: true },
89
- }
90
-
91
- Main.parameters = {
92
- docs: {
93
- source: {
94
- type: 'dynamic',
95
- transform: (code: string, storyContext: StoryContext) =>
96
- codeBlock(storyContext.args),
84
+ export const Main = {
85
+ render: (args: any) => <DatePickerDemo {...args} />,
86
+ args: {
87
+ clearable: true,
88
+ label: 'Terminas',
89
+ rules: { required: true },
90
+ },
91
+ parameters: {
92
+ docs: {
93
+ source: {
94
+ type: 'dynamic',
95
+ transform: (code: string, storyContext: StoryContext) =>
96
+ codeBlock(storyContext.args),
97
+ },
97
98
  },
98
99
  },
99
100
  }
@@ -1,5 +1,4 @@
1
- /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryFn } from '@storybook/react'
1
+ import { Meta, StoryObj } from '@storybook/react'
3
2
  import { FieldError, useForm } from 'react-hook-form'
4
3
 
5
4
  import RcSesFileDropzone from '@/components/form/inputs/FileDropzone'
@@ -18,38 +17,20 @@ const meta: Meta<typeof RcSesFileDropzone> = {
18
17
  title: 'components/inputs/FileDropzone',
19
18
  component: RcSesFileDropzone,
20
19
  argTypes: {
21
- control: {
22
- table: {
23
- disable: true,
24
- },
25
- },
26
- errors: {
27
- table: {
28
- disable: true,
29
- },
30
- },
31
- rules: {
32
- table: {
33
- disable: true,
34
- },
35
- },
36
- name: {
37
- table: {
38
- disable: true,
39
- },
40
- },
41
- id: {
42
- table: {
43
- disable: true,
44
- },
45
- },
20
+ control: { table: { disable: true } },
21
+ errors: { table: { disable: true } },
22
+ rules: { table: { disable: true } },
23
+ name: { table: { disable: true } },
24
+ id: { table: { disable: true } },
46
25
  },
47
26
  tags: ['autodocs'],
48
27
  }
49
28
 
50
29
  export default meta
51
30
 
52
- const Template: StoryFn<typeof RcSesFileDropzone> = (args) => {
31
+ type Story = StoryObj<typeof RcSesFileDropzone>
32
+
33
+ function FileDropzoneDemo(args: any) {
53
34
  const {
54
35
  control,
55
36
  formState: { errors },
@@ -106,12 +87,14 @@ const Template: StoryFn<typeof RcSesFileDropzone> = (args) => {
106
87
  )
107
88
  }
108
89
 
109
- export const Main = Template.bind({})
110
- Main.args = {
111
- label: 'Upload files',
112
- slotProps: {
113
- wrapper: {
114
- labelSubtitle: 'Tinkami formatai: .doc, .docx, .pdf',
90
+ export const Main: Story = {
91
+ render: (args) => <FileDropzoneDemo {...args} />,
92
+ args: {
93
+ label: 'Upload files',
94
+ slotProps: {
95
+ wrapper: {
96
+ labelSubtitle: 'Tinkami formatai: .doc, .docx, .pdf',
97
+ },
115
98
  },
116
99
  },
117
100
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
2
+ import { Meta, StoryContext } from '@storybook/react'
3
3
  import { useForm } from 'react-hook-form'
4
4
 
5
5
  import RcSesFileUpload from '@/components/form/inputs/FileUpload'
@@ -49,7 +49,7 @@ const meta: Meta<typeof RcSesFileUpload> = {
49
49
 
50
50
  export default meta
51
51
 
52
- const Template: StoryFn<typeof RcSesFileUpload> = (args) => {
52
+ function FileUploadDemo(args: any) {
53
53
  const {
54
54
  control,
55
55
  formState: { errors },
@@ -97,22 +97,6 @@ const Template: StoryFn<typeof RcSesFileUpload> = (args) => {
97
97
  label='Error'
98
98
  errors={{ message: 'Error Message', type: 'required' }}
99
99
  />
100
-
101
- {/* <RcSesFileUpload
102
- id='fileUpload2'
103
- name='fileUpload'
104
- control={control}
105
- rules={{ required: true }}
106
- label='Failo įkėlimas'
107
- errors={errors?.fileUpload}
108
- slotProps={{
109
- wrapper: {
110
- fieldSuffix: (
111
- <RcSesButtonWithPopover popoverContent='Tinkami formatai: .doc, .xdoc, .pdf, .pages' />
112
- ),
113
- },
114
- }}
115
- /> */}
116
100
  </FieldPreviewRow>
117
101
  </Fields>
118
102
  )
@@ -143,17 +127,18 @@ const codeBlock = (args: any) => {
143
127
  );`
144
128
  }
145
129
 
146
- export const Main = Template.bind({})
147
- Main.args = {
148
- label: 'Upload file',
149
- }
150
-
151
- Main.parameters = {
152
- docs: {
153
- source: {
154
- type: 'dynamic',
155
- transform: (code: string, storyContext: StoryContext) =>
156
- codeBlock(storyContext.args),
130
+ export const Main = {
131
+ render: (args: any) => <FileUploadDemo {...args} />,
132
+ args: {
133
+ label: 'Upload file',
134
+ },
135
+ parameters: {
136
+ docs: {
137
+ source: {
138
+ type: 'dynamic',
139
+ transform: (code: string, storyContext: StoryContext) =>
140
+ codeBlock(storyContext.args),
141
+ },
157
142
  },
158
143
  },
159
144
  }
@@ -1,5 +1,4 @@
1
- /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
1
+ import { Meta, StoryContext, StoryObj } from '@storybook/react'
3
2
  import { useForm } from 'react-hook-form'
4
3
 
5
4
  import RcSesNumberStepper from '@/components/form/inputs/NumberStepper'
@@ -18,48 +17,22 @@ const meta: Meta<typeof RcSesNumberStepper> = {
18
17
  title: 'components/inputs/NumberStepper',
19
18
  component: RcSesNumberStepper,
20
19
  argTypes: {
21
- id: {
22
- table: {
23
- disable: true,
24
- },
25
- },
26
- name: {
27
- table: {
28
- disable: true,
29
- },
30
- },
31
- control: {
32
- table: {
33
- disable: true,
34
- },
35
- },
36
- errors: {
37
- table: {
38
- disable: true,
39
- },
40
- },
41
- onChange: {
42
- table: {
43
- disable: true,
44
- },
45
- },
46
- onBlur: {
47
- table: {
48
- disable: true,
49
- },
50
- },
51
- rules: {
52
- table: {
53
- disable: true,
54
- },
55
- },
20
+ id: { table: { disable: true } },
21
+ name: { table: { disable: true } },
22
+ control: { table: { disable: true } },
23
+ errors: { table: { disable: true } },
24
+ onChange: { table: { disable: true } },
25
+ onBlur: { table: { disable: true } },
26
+ rules: { table: { disable: true } },
56
27
  },
57
28
  tags: ['autodocs'],
58
29
  }
59
30
 
60
31
  export default meta
61
32
 
62
- const Template: StoryFn<typeof RcSesNumberStepper> = (args) => {
33
+ type Story = StoryObj<typeof RcSesNumberStepper>
34
+
35
+ function NumberStepperDemo(args: any) {
63
36
  const { control } = useForm<FormModel>({
64
37
  mode: 'all',
65
38
  defaultValues: { countable: 0, countable2: 0, countable3: 0 },
@@ -113,9 +86,7 @@ const Template: StoryFn<typeof RcSesNumberStepper> = (args) => {
113
86
  }
114
87
 
115
88
  const codeBlock = (args: any) => {
116
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
117
- const { label, disabled, min, max, step, displayStepperControls, slotProps, name, id } =
118
- args
89
+ const { label, disabled, min, max, step, name, id } = args
119
90
  return `
120
91
  import RcSesNumberStepper from '@/components/form/inputs/NumberStepper'
121
92
 
@@ -138,25 +109,26 @@ const codeBlock = (args: any) => {
138
109
  );`
139
110
  }
140
111
 
141
- export const Main = Template.bind({})
142
- Main.args = {
143
- label: 'Label',
144
- disabled: false,
145
- min: 0,
146
- max: 100,
147
- step: 1,
148
- displayStepperControls: true,
149
- slotProps: { wrapper: { labelSubtitle: 'optional' } },
150
- id: 'countable',
151
- name: 'countable',
152
- }
153
-
154
- Main.parameters = {
155
- docs: {
156
- source: {
157
- type: 'dynamic',
158
- transform: (code: string, storyContext: StoryContext) =>
159
- codeBlock(storyContext.args),
112
+ export const Main: Story = {
113
+ render: (args) => <NumberStepperDemo {...args} />,
114
+ args: {
115
+ label: 'Label',
116
+ disabled: false,
117
+ min: 0,
118
+ max: 100,
119
+ step: 1,
120
+ displayStepperControls: true,
121
+ slotProps: { wrapper: { labelSubtitle: 'optional' } },
122
+ id: 'countable',
123
+ name: 'countable',
124
+ },
125
+ parameters: {
126
+ docs: {
127
+ source: {
128
+ type: 'dynamic',
129
+ transform: (_code: string, storyContext: StoryContext) =>
130
+ codeBlock(storyContext.args),
131
+ },
160
132
  },
161
133
  },
162
134
  }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryFn } from '@storybook/react'
2
+ import { Meta } from '@storybook/react'
3
3
  import { useForm } from 'react-hook-form'
4
4
 
5
5
  import RcSesPhoneInput from '@/components/form/inputs/PhoneInput'
@@ -49,7 +49,7 @@ const meta: Meta<typeof RcSesPhoneInput> = {
49
49
 
50
50
  export default meta
51
51
 
52
- const Template: StoryFn<typeof RcSesPhoneInput> = (args) => {
52
+ function PhoneInputDemo(args: any) {
53
53
  const {
54
54
  control,
55
55
  formState: { errors },
@@ -104,7 +104,9 @@ const Template: StoryFn<typeof RcSesPhoneInput> = (args) => {
104
104
  )
105
105
  }
106
106
 
107
- export const Main = Template.bind({})
108
- Main.args = {
109
- label: 'Phone number',
107
+ export const Main = {
108
+ render: (args: any) => <PhoneInputDemo {...args} />,
109
+ args: {
110
+ label: 'Phone number',
111
+ },
110
112
  }
@@ -0,0 +1,33 @@
1
+ import { Meta, StoryObj } from '@storybook/react'
2
+ import { useForm } from 'react-hook-form'
3
+
4
+ import RcSesPhoneInputFormControl from '@/components/form/inputs/PhoneInputFormControl'
5
+
6
+ const meta: Meta<typeof RcSesPhoneInputFormControl> = {
7
+ title: 'components/inputs/PhoneInputFormControl',
8
+ component: RcSesPhoneInputFormControl,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ label: { control: 'text' },
12
+ },
13
+ }
14
+
15
+ export default meta
16
+ type Story = StoryObj<typeof meta>
17
+
18
+ function PhoneInputFormControlDemo({ label = 'Phone Number' }: { label?: string }) {
19
+ const { control } = useForm({
20
+ defaultValues: {
21
+ phone: '',
22
+ },
23
+ })
24
+
25
+ return <RcSesPhoneInputFormControl control={control} label={label} name='phone' />
26
+ }
27
+
28
+ export const Default: Story = {
29
+ args: {
30
+ label: 'Phone Number',
31
+ },
32
+ render: ({ label }) => <PhoneInputFormControlDemo label={label} />,
33
+ }
@@ -1,5 +1,4 @@
1
- /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
1
+ import { Meta, StoryContext, StoryObj } from '@storybook/react'
3
2
  import { useForm } from 'react-hook-form'
4
3
 
5
4
  import RcSesRadioButtonGroup from '@/components/form/inputs/RadioButtonGroup'
@@ -31,7 +30,9 @@ const meta: Meta<typeof RcSesRadioButtonGroup> = {
31
30
 
32
31
  export default meta
33
32
 
34
- const Template: StoryFn<typeof RcSesRadioButtonGroup> = (args) => {
33
+ type Story = StoryObj<typeof RcSesRadioButtonGroup>
34
+
35
+ function RadioButtonGroupDemo(args: any) {
35
36
  const {
36
37
  control,
37
38
  formState: { errors },
@@ -133,23 +134,24 @@ const codeBlock = (args: any) => {
133
134
  );`
134
135
  }
135
136
 
136
- export const Main = Template.bind({})
137
- Main.args = {
138
- label: 'Label',
139
- options: [
140
- { label: 'Pick 1', value: 'pick1' },
141
- { label: 'Pick 2', value: 'pick2' },
142
- { label: 'Pick 3', value: 'pick3' },
143
- { label: 'Pick 4', value: 'pick4' },
144
- ],
145
- }
146
-
147
- Main.parameters = {
148
- docs: {
149
- source: {
150
- type: 'dynamic',
151
- transform: (code: string, storyContext: StoryContext) =>
152
- codeBlock(storyContext.args),
137
+ export const Main: Story = {
138
+ render: (args) => <RadioButtonGroupDemo {...args} />,
139
+ args: {
140
+ label: 'Label',
141
+ options: [
142
+ { label: 'Pick 1', value: 'pick1' },
143
+ { label: 'Pick 2', value: 'pick2' },
144
+ { label: 'Pick 3', value: 'pick3' },
145
+ { label: 'Pick 4', value: 'pick4' },
146
+ ],
147
+ },
148
+ parameters: {
149
+ docs: {
150
+ source: {
151
+ type: 'dynamic',
152
+ transform: (_code: string, storyContext: StoryContext) =>
153
+ codeBlock(storyContext.args),
154
+ },
153
155
  },
154
156
  },
155
157
  }