@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,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
  }
@@ -0,0 +1,36 @@
1
+ import Typography from '@mui/material/Typography'
2
+ import { Meta, StoryObj } from '@storybook/react'
3
+
4
+ import RcSesServiceHeader from '@/components/layout/ServiceHeader'
5
+
6
+ const meta: Meta<typeof RcSesServiceHeader> = {
7
+ title: 'components/layout/ServiceHeader',
8
+ component: RcSesServiceHeader,
9
+ tags: ['autodocs'],
10
+ argTypes: {
11
+ title: { control: 'text' },
12
+ children: { control: 'text' },
13
+ },
14
+ }
15
+
16
+ export default meta
17
+ type Story = StoryObj<typeof meta>
18
+
19
+ export const Default: Story = {
20
+ args: {
21
+ title: 'Service Title',
22
+ children: 'This is a description of the service.',
23
+ breadcrumbsProps: {
24
+ path: [
25
+ { label: 'Home', path: '/' },
26
+ { label: 'Services', path: '/services' },
27
+ { label: 'Service Title', path: '/services/service' },
28
+ ],
29
+ },
30
+ },
31
+ render: (args) => (
32
+ <RcSesServiceHeader title={args.title} breadcrumbsProps={args.breadcrumbsProps}>
33
+ {args.children && <Typography variant='body1'>{args.children}</Typography>}
34
+ </RcSesServiceHeader>
35
+ ),
36
+ }
@@ -0,0 +1,26 @@
1
+ import Typography from '@mui/material/Typography'
2
+ import { Meta, StoryObj } from '@storybook/react'
3
+
4
+ import RcSesServicePage from '@/components/layout/ServicePage'
5
+
6
+ const meta: Meta<typeof RcSesServicePage> = {
7
+ title: 'components/layout/ServicePage',
8
+ component: RcSesServicePage,
9
+ tags: ['autodocs'],
10
+ }
11
+
12
+ export default meta
13
+ type Story = StoryObj<typeof meta>
14
+
15
+ export const Default: Story = {
16
+ render: () => (
17
+ <RcSesServicePage>
18
+ <Typography variant='h2' sx={{ mb: 2 }}>
19
+ Page Content
20
+ </Typography>
21
+ <Typography variant='body1'>
22
+ This is the main content area of the service page.
23
+ </Typography>
24
+ </RcSesServicePage>
25
+ ),
26
+ }
@@ -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
 
4
4
  import RcSesAccordion from '@/components/common/Accordion'
5
5
  import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
@@ -24,7 +24,7 @@ const meta: Meta<typeof RcSesAccordion> = {
24
24
 
25
25
  export default meta
26
26
 
27
- const Template: StoryFn<typeof RcSesAccordion> = (args) => {
27
+ function AccordionDemo(args: any) {
28
28
  const { disabled } = args
29
29
 
30
30
  const accordionController = useAccordionController({
@@ -77,17 +77,18 @@ const codeBlock = (args: any) => {
77
77
  );`
78
78
  }
79
79
 
80
- export const Main = Template.bind({})
81
- Main.args = {
82
- disabled: false,
83
- }
84
-
85
- Main.parameters = {
86
- docs: {
87
- source: {
88
- type: 'dynamic',
89
- transform: (code: string, storyContext: StoryContext) =>
90
- codeBlock(storyContext.args),
80
+ export const Main = {
81
+ render: (args: any) => <AccordionDemo {...args} />,
82
+ args: {
83
+ disabled: false,
84
+ },
85
+ parameters: {
86
+ docs: {
87
+ source: {
88
+ type: 'dynamic',
89
+ transform: (code: string, storyContext: StoryContext) =>
90
+ codeBlock(storyContext.args),
91
+ },
91
92
  },
92
93
  },
93
94
  }
@@ -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
  }
@@ -49,26 +49,28 @@ const meta = {
49
49
  export default meta
50
50
  type Story = StoryObj<typeof meta>
51
51
 
52
+ function ControlledDataPaginationDemo({ page: initialPage, onChange, ...args }: any) {
53
+ const [page, setPage] = useState(initialPage ?? 1)
54
+
55
+ return (
56
+ <Box display='flex' flexDirection='column' gap={2}>
57
+ <Typography variant='body2'>Current page: {page}</Typography>
58
+ <DataPagination
59
+ {...args}
60
+ page={page}
61
+ onChange={(nextPage) => {
62
+ setPage(nextPage)
63
+ onChange?.(nextPage)
64
+ }}
65
+ />
66
+ </Box>
67
+ )
68
+ }
69
+
52
70
  export const Uncontrolled: Story = {}
53
71
 
54
72
  export const Controlled: Story = {
55
- render: (args) => {
56
- const [page, setPage] = useState(args.page ?? 1)
57
-
58
- return (
59
- <Box display='flex' flexDirection='column' gap={2}>
60
- <Typography variant='body2'>Current page: {page}</Typography>
61
- <DataPagination
62
- {...args}
63
- page={page}
64
- onChange={(nextPage) => {
65
- setPage(nextPage)
66
- args.onChange?.(nextPage)
67
- }}
68
- />
69
- </Box>
70
- )
71
- },
73
+ render: (args) => <ControlledDataPaginationDemo {...args} />,
72
74
  args: {
73
75
  page: 1,
74
76
  },