@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
@@ -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,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
  }
@@ -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 RcSesSearchableField from '@/components/form/inputs/SearchableField'
@@ -14,7 +13,9 @@ const meta: Meta<typeof RcSesSearchableField> = {
14
13
 
15
14
  export default meta
16
15
 
17
- const Template: StoryFn<typeof RcSesSearchableField> = (args) => {
16
+ type Story = StoryObj<typeof RcSesSearchableField>
17
+
18
+ function SearchableFieldDemo(args: any) {
18
19
  const { label } = args
19
20
  const {
20
21
  control,
@@ -74,17 +75,18 @@ const codeBlock = (args: any) => {
74
75
  );`
75
76
  }
76
77
 
77
- export const Main = Template.bind({})
78
- Main.args = {
79
- label: 'This is label',
80
- }
81
-
82
- Main.parameters = {
83
- docs: {
84
- source: {
85
- type: 'dynamic',
86
- transform: (code: string, storyContext: StoryContext) =>
87
- codeBlock(storyContext.args),
78
+ export const Main: Story = {
79
+ render: (args) => <SearchableFieldDemo {...args} />,
80
+ args: {
81
+ label: 'This is label',
82
+ },
83
+ parameters: {
84
+ docs: {
85
+ source: {
86
+ type: 'dynamic',
87
+ transform: (_code: string, storyContext: StoryContext) =>
88
+ codeBlock(storyContext.args),
89
+ },
88
90
  },
89
91
  },
90
92
  }
@@ -1,7 +1,9 @@
1
1
  /* eslint-disable react/function-component-definition */
2
- import { Meta, StoryContext, StoryFn } from '@storybook/react'
2
+ import { Box, Typography } from '@mui/material'
3
+ import { Meta, StoryContext, StoryObj } from '@storybook/react'
3
4
  import { useForm } from 'react-hook-form'
4
5
 
6
+ import RcSesPhoneInput from '@/components/form/inputs/PhoneInput'
5
7
  import RcSesSelect from '@/components/form/inputs/Select'
6
8
  import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
7
9
  import FieldView from '@/components/storybook/FieldView'
@@ -67,7 +69,9 @@ const meta: Meta<typeof RcSesSelect> = {
67
69
 
68
70
  export default meta
69
71
 
70
- const Template: StoryFn<typeof RcSesSelect> = (args) => {
72
+ type Story = StoryObj<typeof RcSesSelect>
73
+
74
+ function SelectDemo(args: any) {
71
75
  const {
72
76
  control,
73
77
  formState: { errors },
@@ -208,19 +212,247 @@ const codeBlock = (args: any) => {
208
212
  );`
209
213
  }
210
214
 
211
- export const Main = Template.bind({})
212
- Main.args = {
213
- label: 'Label',
214
- disabled: false,
215
- slotProps: { wrapper: { labelOnTop: false } },
215
+ export const Main: Story = {
216
+ render: (args: any) => <SelectDemo {...args} />,
217
+ args: {
218
+ label: 'Label',
219
+ disabled: false,
220
+ slotProps: { wrapper: { labelOnTop: false } },
221
+ },
222
+ parameters: {
223
+ docs: {
224
+ source: {
225
+ type: 'dynamic',
226
+ transform: (_code: string, storyContext: StoryContext) =>
227
+ codeBlock(storyContext.args),
228
+ },
229
+ },
230
+ },
231
+ }
232
+
233
+ type VariantsFormModel = {
234
+ singleSelect: string | null
235
+ groupedSelect: string | null
236
+ singleSearchSelect: string | null
237
+ descriptionSelect: string | null
238
+ multiSelect: string[]
239
+ multiSearchSelect: string[]
240
+ phoneInput: string
216
241
  }
217
242
 
218
- Main.parameters = {
219
- docs: {
220
- source: {
221
- type: 'dynamic',
222
- transform: (code: string, storyContext: StoryContext) =>
223
- codeBlock(storyContext.args),
243
+ const variantOptions = [
244
+ { value: 'option-1', label: '1st option' },
245
+ { value: 'option-2', label: '2st option' },
246
+ { value: 'option-3', label: '3rd option' },
247
+ { value: 'option-4', label: '4th option' },
248
+ { value: 'option-5', label: '5th option' },
249
+ ]
250
+
251
+ const groupedVariantOptions: Array<
252
+ {
253
+ group: string
254
+ } & {
255
+ value: string
256
+ label: string
257
+ }
258
+ > = [
259
+ { value: 'group-1-option-1', label: '1st option', group: 'GROUP 1' },
260
+ { value: 'group-1-option-2', label: '2st option', group: 'GROUP 1' },
261
+ { value: 'group-1-option-3', label: '3rd option', group: 'GROUP 1' },
262
+ { value: 'group-2-option-4', label: '4th option', group: 'GROUP 2' },
263
+ { value: 'group-2-option-5', label: '5th option', group: 'GROUP 2' },
264
+ ]
265
+
266
+ const optionsWithDescriptions = [
267
+ {
268
+ value: 'option-1',
269
+ label: '1st option',
270
+ description:
271
+ 'Lorem ipsum is simply dummy text of the printing and typesetting industry.',
272
+ },
273
+ {
274
+ value: 'option-2',
275
+ label: '2st option',
276
+ description:
277
+ 'Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem ipsum has been the industry standard.',
278
+ },
279
+ {
280
+ value: 'option-3',
281
+ label: '3rd option',
282
+ description: 'Lorem ipsum is simply dummy text has been the industry standard.',
283
+ },
284
+ {
285
+ value: 'option-4',
286
+ label: '4th option',
287
+ description: 'Lorem ipsum has been the industry standard.',
288
+ },
289
+ ]
290
+
291
+ const VariantCard = ({
292
+ title,
293
+ description,
294
+ children,
295
+ }: {
296
+ title: string
297
+ description: string
298
+ children: React.ReactNode
299
+ }) => (
300
+ <Box>
301
+ <Typography sx={{ fontWeight: 700, fontSize: '1rem', mb: '.25rem' }}>
302
+ {title}
303
+ </Typography>
304
+ <Typography
305
+ sx={{ color: '#667085', fontSize: '.75rem', mb: '1rem', minHeight: '2rem' }}
306
+ >
307
+ {description}
308
+ </Typography>
309
+ {children}
310
+ </Box>
311
+ )
312
+
313
+ export const AllVariants: Story = {
314
+ render: () => {
315
+ const { control } = useForm<VariantsFormModel>({
316
+ mode: 'all',
317
+ defaultValues: {
318
+ singleSelect: null,
319
+ groupedSelect: null,
320
+ singleSearchSelect: null,
321
+ descriptionSelect: 'option-3',
322
+ multiSelect: ['option-1', 'option-3'],
323
+ multiSearchSelect: ['option-1', 'option-3', 'option-4', 'option-5'],
324
+ phoneInput: '',
325
+ },
326
+ })
327
+
328
+ return (
329
+ <Box sx={{ p: '1rem 0' }}>
330
+ <Box
331
+ sx={{
332
+ display: 'grid',
333
+ gap: '2rem',
334
+ gridTemplateColumns: {
335
+ xs: '1fr',
336
+ sm: 'repeat(2, minmax(0, 1fr))',
337
+ xl: 'repeat(4, minmax(0, 1fr))',
338
+ },
339
+ }}
340
+ >
341
+ <VariantCard
342
+ title='Basic'
343
+ description='Bazinis variantas skirtas iprastiems atvejams.'
344
+ >
345
+ <RcSesSelect
346
+ id='single-select'
347
+ name='singleSelect'
348
+ control={control}
349
+ label='Pasirinkti'
350
+ slotProps={{ wrapper: { labelOnTop: true } }}
351
+ options={variantOptions}
352
+ />
353
+ </VariantCard>
354
+
355
+ <VariantCard
356
+ title='Wide + descriptions'
357
+ description='Didesnis variantas su aprasymais kiekvienai opcijai.'
358
+ >
359
+ <RcSesSelect
360
+ id='description-select'
361
+ name='descriptionSelect'
362
+ control={control}
363
+ label='Pasirinkti'
364
+ slotProps={{ wrapper: { labelOnTop: true } }}
365
+ options={optionsWithDescriptions}
366
+ />
367
+ </VariantCard>
368
+
369
+ <VariantCard
370
+ title='Grouped'
371
+ description='Sugrupuotos parinktys pagal kategorijas.'
372
+ >
373
+ <RcSesSelect
374
+ id='grouped-select'
375
+ name='groupedSelect'
376
+ control={control}
377
+ label='Pasirinkti'
378
+ slotProps={{
379
+ wrapper: { labelOnTop: true },
380
+ field: {
381
+ groupBy: (option) =>
382
+ groupedVariantOptions.find(
383
+ (groupedOption) => groupedOption.value === option.value,
384
+ )?.group ?? '',
385
+ },
386
+ }}
387
+ options={groupedVariantOptions}
388
+ />
389
+ </VariantCard>
390
+
391
+ <VariantCard title='Basic + search' description='Bazinis variantas su paieska.'>
392
+ <RcSesSelect
393
+ id='single-search-select'
394
+ name='singleSearchSelect'
395
+ control={control}
396
+ label='Pasirinkti'
397
+ slotProps={{ wrapper: { labelOnTop: true } }}
398
+ dropdownSearch
399
+ dropdownSearchPlaceholder='Ieškoti'
400
+ options={variantOptions}
401
+ />
402
+ </VariantCard>
403
+
404
+ <VariantCard
405
+ title='Multi select'
406
+ description='Variantas kai galima pasirinkti kelias reiksmes.'
407
+ >
408
+ <RcSesSelect
409
+ id='multi-select'
410
+ name='multiSelect'
411
+ control={control}
412
+ label='Pasirinkti'
413
+ slotProps={{ wrapper: { labelOnTop: true } }}
414
+ multiple
415
+ options={variantOptions}
416
+ />
417
+ </VariantCard>
418
+
419
+ <VariantCard
420
+ title='Multi select + search'
421
+ description='Daugybinis pasirinkimas su paieska ir select all.'
422
+ >
423
+ <RcSesSelect
424
+ id='multi-search-select'
425
+ name='multiSearchSelect'
426
+ control={control}
427
+ label='Pasirinkti'
428
+ slotProps={{ wrapper: { labelOnTop: true } }}
429
+ multiple
430
+ dropdownSearch
431
+ selectAll
432
+ dropdownSearchPlaceholder='Ieškoti'
433
+ options={variantOptions}
434
+ />
435
+ </VariantCard>
436
+
437
+ <VariantCard
438
+ title='Phone input'
439
+ description='Telefono numerio įvesties laukas su šalies kodo pasirinkimu.'
440
+ >
441
+ <RcSesPhoneInput
442
+ id='phone-input'
443
+ name='phoneInput'
444
+ control={control}
445
+ label='Phone number'
446
+ slotProps={{ wrapper: { labelOnTop: true } }}
447
+ />
448
+ </VariantCard>
449
+ </Box>
450
+ </Box>
451
+ )
452
+ },
453
+ parameters: {
454
+ controls: {
455
+ disable: true,
224
456
  },
225
457
  },
226
458
  }
@@ -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
 
4
3
  import RcSesTextField from '@/components/form/inputs/TextField'
5
4
  import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
@@ -15,38 +14,7 @@ const meta: Meta<typeof RcSesTextField> = {
15
14
 
16
15
  export default meta
17
16
 
18
- const Template: StoryFn<typeof RcSesTextField> = (args) => (
19
- <Fields>
20
- <FieldView>
21
- <RcSesTextField {...args} />
22
- </FieldView>
23
-
24
- <FieldPreviewRow>
25
- <PreviewTitle>State previews label on side</PreviewTitle>
26
- <RcSesTextField label='Label' />
27
- <RcSesTextField
28
- errors={{ message: 'Klaidos pranešimas', type: 'required' }}
29
- label='Label'
30
- />
31
- <RcSesTextField disabled label='Label' />
32
- </FieldPreviewRow>
33
-
34
- <FieldPreviewRow>
35
- <PreviewTitle>State previews label on top</PreviewTitle>
36
- <RcSesTextField slotProps={{ wrapper: { labelOnTop: true } }} label='Label' />
37
- <RcSesTextField
38
- slotProps={{ wrapper: { labelOnTop: true } }}
39
- errors={{ message: 'Klaidos pranešimas', type: 'required' }}
40
- label='Label'
41
- />
42
- <RcSesTextField
43
- slotProps={{ wrapper: { labelOnTop: true } }}
44
- disabled
45
- label='Label'
46
- />
47
- </FieldPreviewRow>
48
- </Fields>
49
- )
17
+ type Story = StoryObj<typeof RcSesTextField>
50
18
 
51
19
  const codeBlock = (args: any) => {
52
20
  const { slotProps, disabled, label } = args
@@ -58,20 +26,52 @@ const codeBlock = (args: any) => {
58
26
  );`
59
27
  }
60
28
 
61
- export const Main = Template.bind({})
62
- Main.args = {
63
- label: 'label',
64
- disabled: false,
65
- multiline: true,
66
- slotProps: { wrapper: { labelOnTop: false } },
67
- }
29
+ export const Main: Story = {
30
+ render: (args) => (
31
+ <Fields>
32
+ <FieldView>
33
+ <RcSesTextField {...args} />
34
+ </FieldView>
68
35
 
69
- Main.parameters = {
70
- docs: {
71
- source: {
72
- type: 'dynamic',
73
- transform: (code: string, storyContext: StoryContext) =>
74
- codeBlock(storyContext.args),
36
+ <FieldPreviewRow>
37
+ <PreviewTitle>State previews label on side</PreviewTitle>
38
+ <RcSesTextField label='Label' />
39
+ <RcSesTextField
40
+ errors={{ message: 'Klaidos pranešimas', type: 'required' }}
41
+ label='Label'
42
+ />
43
+ <RcSesTextField disabled label='Label' />
44
+ </FieldPreviewRow>
45
+
46
+ <FieldPreviewRow>
47
+ <PreviewTitle>State previews label on top</PreviewTitle>
48
+ <RcSesTextField slotProps={{ wrapper: { labelOnTop: true } }} label='Label' />
49
+ <RcSesTextField
50
+ slotProps={{ wrapper: { labelOnTop: true } }}
51
+ errors={{ message: 'Klaidos pranešimas', type: 'required' }}
52
+ label='Label'
53
+ />
54
+ <RcSesTextField
55
+ slotProps={{ wrapper: { labelOnTop: true } }}
56
+ disabled
57
+ label='Label'
58
+ />
59
+ </FieldPreviewRow>
60
+ </Fields>
61
+ ),
62
+ args: {
63
+ label: 'label',
64
+ disabled: false,
65
+ multiline: true,
66
+ slotProps: { wrapper: { labelOnTop: false } },
67
+ },
68
+ parameters: {
69
+ docs: {
70
+ source: {
71
+ type: 'dynamic',
72
+ transform: (_code: string, storyContext: StoryContext) =>
73
+ codeBlock(storyContext.args),
74
+ },
75
75
  },
76
76
  },
77
77
  }
@@ -1,5 +1,4 @@
1
- /* eslint-disable react/function-component-definition */
2
- import type { Meta, StoryFn } from '@storybook/react'
1
+ import type { Meta, StoryObj } from '@storybook/react'
3
2
 
4
3
  import RcSesFooter from '@/components/layout/Footer'
5
4
 
@@ -11,9 +10,10 @@ const meta: Meta<typeof RcSesFooter> = {
11
10
 
12
11
  export default meta
13
12
 
14
- const Template: StoryFn<typeof RcSesFooter> = (args) => <RcSesFooter {...args} />
13
+ type Story = StoryObj<typeof RcSesFooter>
15
14
 
16
- export const Main = Template.bind({})
17
- Main.args = {
18
- text: '© Valstybės įmonė Registrų centras. Duomenys apie įmonę kaupiami ir saugomi Juridinių asmenų registre.\nStudentų g. 39, LT-08106 Vilnius | tel. +370 5 268 8262 | el. p. info@registrucentras.lt | įmonės kodas 124110246 | PVM mokėtojo kodas LT241102419',
15
+ export const Main: Story = {
16
+ args: {
17
+ text: '© Valstybės įmonė Registrų centras. Duomenys apie įmonę kaupiami ir saugomi Juridinių asmenų registre.\nStudentų g. 39, LT-08106 Vilnius | tel. +370 5 268 8262 | el. p. info@registrucentras.lt | įmonės kodas 124110246 | PVM mokėtojo kodas LT241102419',
18
+ },
19
19
  }
@@ -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
 
4
3
  import RcSesBreadcrumbs from '@/components/common/Breadcrumbs'
5
4
 
@@ -22,11 +21,10 @@ const meta: Meta<typeof RcSesBreadcrumbs> = {
22
21
 
23
22
  export default meta
24
23
 
25
- const Template: StoryFn<typeof RcSesBreadcrumbs> = (args) => (
26
- <RcSesBreadcrumbs {...args} />
27
- )
24
+ type Story = StoryObj<typeof RcSesBreadcrumbs>
28
25
 
29
- export const Main = Template.bind({})
30
- Main.args = {
31
- path: Path,
26
+ export const Main: Story = {
27
+ args: {
28
+ path: Path,
29
+ },
32
30
  }