@registrucentras/rc-ses-react-components 2.0.0-rc.3 → 2.0.0-rc.4

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 (72) hide show
  1. package/dist/assets/icons/ArrowRightIcon.d.ts +1 -1
  2. package/dist/components/common/CardShell/index.d.ts +1 -1
  3. package/dist/components/common/CardShell/types.d.ts +3 -1
  4. package/dist/components/common/IconWithSquareBackground/index.d.ts +12 -0
  5. package/dist/components/common/ServiceLinks/ServiceLinkItem/index.d.ts +15 -0
  6. package/dist/components/common/ServiceLinks/index.d.ts +3 -0
  7. package/dist/components/common/ServiceLinks/types.d.ts +34 -0
  8. package/dist/components/common/SideNav/SideNav.types.d.ts +20 -0
  9. package/dist/components/common/SideNav/SideNavLayout.d.ts +4 -0
  10. package/dist/components/common/SideNav/components/SideNavPill.d.ts +9 -0
  11. package/dist/components/common/SideNav/components/SideNavPillList.d.ts +9 -0
  12. package/dist/components/common/SideNav/components/SideNavRow.d.ts +9 -0
  13. package/dist/components/common/SideNav/hooks/useSideNavScrollSpy.d.ts +12 -0
  14. package/dist/components/common/SideNav/index.d.ts +4 -0
  15. package/dist/components/common/TitleBlock/index.d.ts +3 -0
  16. package/dist/components/common/TitleBlock/types.d.ts +73 -0
  17. package/dist/components/utils/normalizeSx.d.ts +4 -0
  18. package/dist/library/index.d.ts +8 -2
  19. package/dist/library/types.d.ts +6 -2
  20. package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
  21. package/dist/registrucentras-rc-ses-react-components.js +3412 -2728
  22. package/dist/stories/components/display/CardShell.stories.d.ts +1 -1
  23. package/dist/stories/components/display/SelectableCardList.stories.d.ts +1 -0
  24. package/dist/stories/components/display/ServiceLinks.stories.d.ts +28 -0
  25. package/dist/stories/components/display/TitleBlock.stories.d.ts +20 -0
  26. package/dist/stories/components/form/FormControlWrapper.stories.d.ts +1 -0
  27. package/dist/stories/components/icons/IconWithSquareBackground.stories.d.ts +7 -0
  28. package/dist/stories/components/navigation/SideNav.stories.d.ts +7 -0
  29. package/package.json +1 -1
  30. package/src/assets/icons/ArrowRightIcon.tsx +2 -1
  31. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +8 -6
  32. package/src/components/common/Card/index.tsx +1 -23
  33. package/src/components/common/CardShell/index.tsx +4 -1
  34. package/src/components/common/CardShell/types.ts +3 -1
  35. package/src/components/common/IconWithSquareBackground/index.test.tsx +55 -0
  36. package/src/components/common/IconWithSquareBackground/index.tsx +83 -0
  37. package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +177 -0
  38. package/src/components/common/ServiceLinks/index.test.tsx +166 -0
  39. package/src/components/common/ServiceLinks/index.tsx +66 -0
  40. package/src/components/common/ServiceLinks/types.ts +37 -0
  41. package/src/components/common/SideNav/SideNav.types.ts +24 -0
  42. package/src/components/common/SideNav/SideNavLayout.test.tsx +113 -0
  43. package/src/components/common/SideNav/SideNavLayout.tsx +67 -0
  44. package/src/components/common/SideNav/components/SideNavPill.tsx +62 -0
  45. package/src/components/common/SideNav/components/SideNavPillList.tsx +190 -0
  46. package/src/components/common/SideNav/components/SideNavRow.tsx +72 -0
  47. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.test.ts +457 -0
  48. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.ts +154 -0
  49. package/src/components/common/SideNav/index.test.tsx +99 -0
  50. package/src/components/common/SideNav/index.tsx +83 -0
  51. package/src/components/common/TitleBlock/index.test.tsx +366 -0
  52. package/src/components/common/TitleBlock/index.tsx +144 -0
  53. package/src/components/common/TitleBlock/types.ts +82 -0
  54. package/src/components/utils/normalizeSx.ts +24 -0
  55. package/src/i18n/namespaces/common/en.json +4 -0
  56. package/src/i18n/namespaces/common/lt.json +4 -0
  57. package/src/library/index.ts +8 -2
  58. package/src/library/types.ts +20 -8
  59. package/src/stories/components/display/CardShell.stories.tsx +14 -12
  60. package/src/stories/components/display/SelectableCardList.stories.tsx +33 -1
  61. package/src/stories/components/display/ServiceLinks.stories.tsx +154 -0
  62. package/src/stories/components/display/TitleBlock.stories.tsx +506 -0
  63. package/src/stories/components/form/FormControlWrapper.stories.tsx +23 -0
  64. package/src/stories/components/icons/IconWithSquareBackground.stories.tsx +60 -0
  65. package/src/stories/components/navigation/SideNav.stories.tsx +110 -0
  66. package/src/theme/cards.ts +1 -1
  67. package/src/theme/light/MuiButton.tsx +6 -0
  68. package/dist/components/common/CardShell/CardHeader/index.d.ts +0 -3
  69. package/dist/components/common/CardShell/CardHeader/types.d.ts +0 -33
  70. package/src/components/common/CardShell/CardHeader/index.test.tsx +0 -207
  71. package/src/components/common/CardShell/CardHeader/index.tsx +0 -104
  72. package/src/components/common/CardShell/CardHeader/types.ts +0 -36
@@ -0,0 +1,506 @@
1
+ import { Box, ButtonBase, Divider, Stack } from '@mui/material'
2
+ import { InfoIcon, PhoneCallIcon } from '@phosphor-icons/react'
3
+ import type { Meta, StoryObj } from '@storybook/react-vite'
4
+
5
+ import ArrowRightIcon from '@/assets/icons/ArrowRightIcon'
6
+ import CalendarBlankIcon from '@/assets/icons/CalendarBlankIcon'
7
+ import RcSesButton from '@/components/common/Button'
8
+ import RcSesCardShell from '@/components/common/CardShell'
9
+ import RcSesCardFooter from '@/components/common/CardShell/CardFooter'
10
+ import RcSesIconWithSquareBackground from '@/components/common/IconWithSquareBackground'
11
+ import RcSesTitleBlock from '@/components/common/TitleBlock'
12
+ import palette from '@/theme/palette'
13
+
14
+ const meta: Meta<typeof RcSesTitleBlock> = {
15
+ title: 'components/display/TitleBlock',
16
+ component: RcSesTitleBlock,
17
+ tags: ['autodocs'],
18
+ parameters: {
19
+ docs: {
20
+ description: {
21
+ component:
22
+ 'TitleBlock lays out an optional icon, a title, an optional description and up to two trailing actions. It is the primitive that can be dropped into any row that needs a titled unit (card headers, list items, section rows, modal headers).',
23
+ },
24
+ },
25
+ },
26
+ }
27
+
28
+ export default meta
29
+
30
+ type Story = StoryObj<typeof RcSesTitleBlock>
31
+
32
+ const FooterLink = ({ label, href }: { label: string; href: string }) => (
33
+ <RcSesCardFooter align='start' stretchOnMobile={false}>
34
+ <RcSesButton
35
+ variant='link'
36
+ href={href}
37
+ endIcon={<ArrowRightIcon fillColor={palette.primary[600]} size={20} />}
38
+ >
39
+ {label}
40
+ </RcSesButton>
41
+ </RcSesCardFooter>
42
+ )
43
+
44
+ // Decorative chevron sitting on the right edge of horizontal tile rows.
45
+ // aria-hidden because the row is announced by the heading (and, when the
46
+ // whole row is clickable, by the wrapping ButtonBase's accessible name).
47
+ const TrailingArrow = () => (
48
+ <Box
49
+ aria-hidden
50
+ sx={{
51
+ alignItems: 'center',
52
+ alignSelf: 'stretch',
53
+ color: palette.primary[600],
54
+ display: 'flex',
55
+ flexShrink: 0,
56
+ }}
57
+ >
58
+ <ArrowRightIcon fillColor={palette.primary[600]} size={20} />
59
+ </Box>
60
+ )
61
+
62
+ export const TitleBlock: Story = {
63
+ render: () => (
64
+ <RcSesTitleBlock
65
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
66
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
67
+ titleTone='brand'
68
+ />
69
+ ),
70
+ }
71
+
72
+ export const WithPrimaryAction: Story = {
73
+ render: () => {
74
+ const headingId = 'title-block-with-primary-action'
75
+ return (
76
+ <RcSesTitleBlock
77
+ headingId={headingId}
78
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
79
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
80
+ titleTone='brand'
81
+ actions={
82
+ <RcSesButton
83
+ id={`${headingId}-cta`}
84
+ aria-labelledby={`${headingId}-cta ${headingId}`}
85
+ >
86
+ Užsakyti
87
+ </RcSesButton>
88
+ }
89
+ />
90
+ )
91
+ },
92
+ }
93
+
94
+ export const WithLinkAction: Story = {
95
+ render: () => {
96
+ const headingId = 'title-block-with-link-action'
97
+ return (
98
+ <RcSesTitleBlock
99
+ headingId={headingId}
100
+ title='Santuoką liudijančio įrašo užsakymas'
101
+ description='Oficialus santuokos faktą patvirtinantis įrašas.'
102
+ titleTone='brand'
103
+ actions={
104
+ <RcSesButton
105
+ variant='link'
106
+ id={`${headingId}-cta`}
107
+ aria-labelledby={`${headingId}-cta ${headingId}`}
108
+ >
109
+ Plačiau
110
+ </RcSesButton>
111
+ }
112
+ />
113
+ )
114
+ },
115
+ }
116
+
117
+ export const WithPrimaryAndSecondaryActions: Story = {
118
+ render: () => {
119
+ const headingId = 'title-block-with-primary-and-secondary'
120
+ return (
121
+ <RcSesTitleBlock
122
+ headingId={headingId}
123
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
124
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
125
+ titleTone='brand'
126
+ actions={
127
+ <>
128
+ <RcSesButton
129
+ id={`${headingId}-order`}
130
+ aria-labelledby={`${headingId}-order ${headingId}`}
131
+ >
132
+ Užsakyti
133
+ </RcSesButton>
134
+ <RcSesButton
135
+ variant='link'
136
+ id={`${headingId}-more`}
137
+ aria-labelledby={`${headingId}-more ${headingId}`}
138
+ >
139
+ Plačiau
140
+ </RcSesButton>
141
+ </>
142
+ }
143
+ />
144
+ )
145
+ },
146
+ }
147
+
148
+ export const RowList: Story = {
149
+ render: () => {
150
+ const rowAId = 'row-list-a'
151
+ const rowBId = 'row-list-b'
152
+ return (
153
+ <Stack divider={<Divider flexItem />} spacing={3}>
154
+ <RcSesTitleBlock
155
+ headingId={rowAId}
156
+ title='Santuoką liudijančio įrašo užsakymas'
157
+ description='Oficialus santuokos faktą patvirtinantis įrašas.'
158
+ titleTone='brand'
159
+ actions={
160
+ <RcSesButton
161
+ variant='link'
162
+ id={`${rowAId}-cta`}
163
+ aria-labelledby={`${rowAId}-cta ${rowAId}`}
164
+ >
165
+ Plačiau
166
+ </RcSesButton>
167
+ }
168
+ />
169
+ <RcSesTitleBlock
170
+ headingId={rowBId}
171
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
172
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
173
+ titleTone='brand'
174
+ actions={
175
+ <RcSesButton id={`${rowBId}-cta`} aria-labelledby={`${rowBId}-cta ${rowBId}`}>
176
+ Užsakyti
177
+ </RcSesButton>
178
+ }
179
+ />
180
+ </Stack>
181
+ )
182
+ },
183
+ }
184
+
185
+ export const RowListWithIcons: Story = {
186
+ render: () => {
187
+ const rowAId = 'row-list-with-icons-a'
188
+ const rowBId = 'row-list-with-icons-b'
189
+ return (
190
+ <Stack divider={<Divider flexItem />} spacing={3}>
191
+ <RcSesTitleBlock
192
+ headingId={rowAId}
193
+ title='Santuoką liudijančio įrašo užsakymas'
194
+ description='Oficialus santuokos faktą patvirtinantis įrašas.'
195
+ titleTone='brand'
196
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
197
+ actions={
198
+ <RcSesButton
199
+ variant='link'
200
+ id={`${rowAId}-cta`}
201
+ aria-labelledby={`${rowAId}-cta ${rowAId}`}
202
+ >
203
+ Plačiau
204
+ </RcSesButton>
205
+ }
206
+ />
207
+ <RcSesTitleBlock
208
+ headingId={rowBId}
209
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
210
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
211
+ titleTone='brand'
212
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
213
+ actions={
214
+ <RcSesButton id={`${rowBId}-cta`} aria-labelledby={`${rowBId}-cta ${rowBId}`}>
215
+ Užsakyti
216
+ </RcSesButton>
217
+ }
218
+ />
219
+ </Stack>
220
+ )
221
+ },
222
+ }
223
+
224
+ export const RowListWithIconsAndTwoActions: Story = {
225
+ render: () => {
226
+ const rowAId = 'row-list-two-actions-a'
227
+ const rowBId = 'row-list-two-actions-b'
228
+ return (
229
+ <Stack divider={<Divider flexItem />} spacing={3}>
230
+ <RcSesTitleBlock
231
+ headingId={rowAId}
232
+ title='Santuoką liudijančio įrašo užsakymas'
233
+ description='Oficialus santuokos faktą patvirtinantis įrašas.'
234
+ titleTone='brand'
235
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
236
+ actions={
237
+ <>
238
+ <RcSesButton
239
+ id={`${rowAId}-order`}
240
+ aria-labelledby={`${rowAId}-order ${rowAId}`}
241
+ >
242
+ Užsakyti
243
+ </RcSesButton>
244
+ <RcSesButton
245
+ variant='link'
246
+ id={`${rowAId}-more`}
247
+ aria-labelledby={`${rowAId}-more ${rowAId}`}
248
+ >
249
+ Plačiau
250
+ </RcSesButton>
251
+ </>
252
+ }
253
+ />
254
+ <RcSesTitleBlock
255
+ headingId={rowBId}
256
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
257
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
258
+ titleTone='brand'
259
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
260
+ actions={
261
+ <>
262
+ <RcSesButton
263
+ id={`${rowBId}-order`}
264
+ aria-labelledby={`${rowBId}-order ${rowBId}`}
265
+ >
266
+ Užsakyti
267
+ </RcSesButton>
268
+ <RcSesButton
269
+ variant='link'
270
+ id={`${rowBId}-more`}
271
+ aria-labelledby={`${rowBId}-more ${rowBId}`}
272
+ >
273
+ Plačiau
274
+ </RcSesButton>
275
+ </>
276
+ }
277
+ />
278
+ </Stack>
279
+ )
280
+ },
281
+ }
282
+
283
+ export const HorizontalTitleBlockWithIconAndArrow: Story = {
284
+ render: () => (
285
+ <Stack direction='row' spacing={2} sx={{ alignItems: 'center', width: '100%' }}>
286
+ <Box sx={{ alignSelf: 'center', flex: 1, minWidth: 0 }}>
287
+ <RcSesTitleBlock
288
+ title='Paslaugos pavadinimas'
289
+ description='Trumpas paslaugos paaiškinimas'
290
+ titleTone='brand'
291
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
292
+ />
293
+ </Box>
294
+ <TrailingArrow />
295
+ </Stack>
296
+ ),
297
+ }
298
+
299
+ export const HorizontalTitleBlockWithArrowAndBrandCardShellTheme: Story = {
300
+ render: () => (
301
+ <RcSesCardShell variant='card' theme='brand'>
302
+ <Stack direction='row' spacing={2} sx={{ alignItems: 'center', width: '100%' }}>
303
+ <Box sx={{ alignSelf: 'center', flex: 1, minWidth: 0 }}>
304
+ <RcSesTitleBlock
305
+ title='Paslaugos pavadinimas'
306
+ description='Trumpas paslaugos paaiškinimas'
307
+ titleTone='brand'
308
+ />
309
+ </Box>
310
+ <TrailingArrow />
311
+ </Stack>
312
+ </RcSesCardShell>
313
+ ),
314
+ }
315
+
316
+ export const HorizontalTitleBlockWithArrowAndSunkenCardShellTheme: Story = {
317
+ render: () => (
318
+ <RcSesCardShell variant='card' theme='sunken'>
319
+ <Stack direction='row' spacing={2} sx={{ alignItems: 'center', width: '100%' }}>
320
+ <Box sx={{ alignSelf: 'center', flex: 1, minWidth: 0 }}>
321
+ <RcSesTitleBlock
322
+ title='Paslaugos pavadinimas'
323
+ description='Trumpas paslaugos paaiškinimas'
324
+ titleTone='brand'
325
+ />
326
+ </Box>
327
+ <TrailingArrow />
328
+ </Stack>
329
+ </RcSesCardShell>
330
+ ),
331
+ }
332
+
333
+ export const ClickableHorizontalTitleBlockWithCardShellBase: Story = {
334
+ render: () => (
335
+ <RcSesCardShell variant='card' theme='default'>
336
+ <ButtonBase
337
+ component='a'
338
+ href='#'
339
+ sx={{
340
+ borderRadius: 'inherit',
341
+ display: 'block',
342
+ textAlign: 'left',
343
+ width: '100%',
344
+ }}
345
+ >
346
+ <Stack direction='row' spacing={2} sx={{ alignItems: 'center', width: '100%' }}>
347
+ <Box sx={{ alignSelf: 'center', flex: 1, minWidth: 0 }}>
348
+ <RcSesTitleBlock
349
+ title='Paslaugos sutartiniams klientams'
350
+ description='Peržiūrėkite pagrindinius duomenis be užsakymo - dažniausias pirmas žingsnis.'
351
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
352
+ />
353
+ </Box>
354
+ <TrailingArrow />
355
+ </Stack>
356
+ </ButtonBase>
357
+ </RcSesCardShell>
358
+ ),
359
+ }
360
+
361
+ export const VerticalTitleBlockWithCardShellBase: Story = {
362
+ render: () => (
363
+ <RcSesCardShell
364
+ variant='card'
365
+ theme='default'
366
+ footer={<FooterLink label='Peržiūrėti DUK' href='#' />}
367
+ >
368
+ <RcSesTitleBlock
369
+ orientation='vertical'
370
+ title='DUK'
371
+ description='Atsakymai į dažniausiai užduodamus klausimus apie paslaugas ir savitarną.'
372
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
373
+ />
374
+ </RcSesCardShell>
375
+ ),
376
+ }
377
+
378
+ export const VerticalTitleBlock: Story = {
379
+ render: () => (
380
+ <Box
381
+ sx={{
382
+ display: 'grid',
383
+ gap: 2,
384
+ gridTemplateColumns: { xs: '1fr', md: 'repeat(3, 1fr)' },
385
+ }}
386
+ >
387
+ <RcSesCardShell
388
+ variant='card'
389
+ theme='default'
390
+ fullHeight
391
+ footer={<FooterLink label='Peržiūrėti DUK' href='#' />}
392
+ >
393
+ <RcSesTitleBlock
394
+ orientation='vertical'
395
+ title='DUK'
396
+ description='Atsakymai į dažniausiai užduodamus klausimus apie paslaugas ir savitarną.'
397
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
398
+ />
399
+ </RcSesCardShell>
400
+ <RcSesCardShell
401
+ variant='card'
402
+ theme='default'
403
+ fullHeight
404
+ footer={<FooterLink label='Visi kontaktai' href='#' />}
405
+ >
406
+ <RcSesTitleBlock
407
+ orientation='vertical'
408
+ title='Kontaktai'
409
+ description='Konsultacijos telefonu (0 5) 268 8262 darbo dienomis 8:00-17:00.'
410
+ icon={<RcSesIconWithSquareBackground Icon={PhoneCallIcon} variant='soft' />}
411
+ />
412
+ </RcSesCardShell>
413
+ <RcSesCardShell
414
+ variant='card'
415
+ theme='default'
416
+ fullHeight
417
+ footer={<FooterLink label='Pradėkite registraciją' href='#' />}
418
+ >
419
+ <RcSesTitleBlock
420
+ orientation='vertical'
421
+ title='Registracija vizitui'
422
+ description='Užduokite klausimą konsultantui pokalbių lange - atsakome darbo metu.'
423
+ icon={<RcSesIconWithSquareBackground Icon={CalendarBlankIcon} variant='soft' />}
424
+ />
425
+ </RcSesCardShell>
426
+ </Box>
427
+ ),
428
+ }
429
+
430
+ // Responsive baselines for SAV-6509 / SAV-6480 DoD ("Responsive patikra 375 /
431
+ // 768 / 1440"). Exercises the mobile stacking of the actions slot
432
+ // (direction={{ xs: 'column', sm: 'row' }}) so both the two-action and
433
+ // vertical-grid layouts get pinned baselines at 375 and 768.
434
+
435
+ const responsiveRowAId = 'responsive-row-a'
436
+ const responsiveRowBId = 'responsive-row-b'
437
+
438
+ const ResponsiveTwoActionsRowList = () => (
439
+ <Stack divider={<Divider flexItem />} spacing={3}>
440
+ <RcSesTitleBlock
441
+ headingId={responsiveRowAId}
442
+ title='Santuoką liudijančio įrašo užsakymas'
443
+ description='Oficialus santuokos faktą patvirtinantis įrašas.'
444
+ titleTone='brand'
445
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
446
+ actions={
447
+ <>
448
+ <RcSesButton
449
+ id={`${responsiveRowAId}-order`}
450
+ aria-labelledby={`${responsiveRowAId}-order ${responsiveRowAId}`}
451
+ >
452
+ Užsakyti
453
+ </RcSesButton>
454
+ <RcSesButton
455
+ variant='link'
456
+ id={`${responsiveRowAId}-more`}
457
+ aria-labelledby={`${responsiveRowAId}-more ${responsiveRowAId}`}
458
+ >
459
+ Plačiau
460
+ </RcSesButton>
461
+ </>
462
+ }
463
+ />
464
+ <RcSesTitleBlock
465
+ headingId={responsiveRowBId}
466
+ title='Pažymos santuokai sudaryti užsienyje užsakymas'
467
+ description='Pažyma, kad nėra kliūčių sudaryti santuoką užsienio valstybėje.'
468
+ titleTone='brand'
469
+ icon={<RcSesIconWithSquareBackground Icon={InfoIcon} variant='soft' />}
470
+ actions={
471
+ <>
472
+ <RcSesButton
473
+ id={`${responsiveRowBId}-order`}
474
+ aria-labelledby={`${responsiveRowBId}-order ${responsiveRowBId}`}
475
+ >
476
+ Užsakyti
477
+ </RcSesButton>
478
+ <RcSesButton
479
+ variant='link'
480
+ id={`${responsiveRowBId}-more`}
481
+ aria-labelledby={`${responsiveRowBId}-more ${responsiveRowBId}`}
482
+ >
483
+ Plačiau
484
+ </RcSesButton>
485
+ </>
486
+ }
487
+ />
488
+ </Stack>
489
+ )
490
+
491
+ export const MobileViewport: Story = {
492
+ render: () => <ResponsiveTwoActionsRowList />,
493
+ // Two separate mechanisms, deliberately: the tag sets Playwright's browser
494
+ // width for the baseline, the global sets the canvas iframe width for anyone
495
+ // reviewing in Storybook. Docs pages render stories inline at the container's
496
+ // width, where neither applies, so this one is kept out of the docs page
497
+ // rather than showing a desktop row list under a mobile heading.
498
+ tags: ['viewport-375', '!autodocs'],
499
+ globals: { viewport: { value: 'mobile375' } },
500
+ }
501
+
502
+ export const TabletViewport: Story = {
503
+ render: () => <ResponsiveTwoActionsRowList />,
504
+ tags: ['viewport-768', '!autodocs'],
505
+ globals: { viewport: { value: 'tablet768' } },
506
+ }
@@ -33,3 +33,26 @@ export const Default: Story = {
33
33
  </RcSesFormControlWrapper>
34
34
  ),
35
35
  }
36
+
37
+ export const WithError: Story = {
38
+ args: {
39
+ label: 'Label',
40
+ hideLabel: false,
41
+ labelOnTop: false,
42
+ required: true,
43
+ errors: { type: 'required', message: 'This field is required' },
44
+ },
45
+ render: (args) => (
46
+ <RcSesFormControlWrapper {...args}>
47
+ <TextField id='input' placeholder='Type text here' size='small' fullWidth error />
48
+ </RcSesFormControlWrapper>
49
+ ),
50
+ parameters: {
51
+ docs: {
52
+ description: {
53
+ story:
54
+ 'Pass the react-hook-form `fieldState.error` as `errors` and the message renders below the field, leaving the field itself untouched. This is the validation pattern for any wrapped control, including ones that are not inputs - see `SelectableCardList` → `ValidationError`. When `errors.type` is `required` and no `message` is set, a translated fallback is shown instead.',
55
+ },
56
+ },
57
+ },
58
+ }
@@ -0,0 +1,60 @@
1
+ import { Stack, Typography } from '@mui/material'
2
+ import type { Meta, StoryObj } from '@storybook/react-vite'
3
+
4
+ import InfoFillIcon from '@/assets/icons/InfoFillIcon'
5
+ import RcSesIconWithSquareBackground from '@/components/common/IconWithSquareBackground'
6
+
7
+ const meta: Meta<typeof RcSesIconWithSquareBackground> = {
8
+ title: 'components/icons/IconWithSquareBackground',
9
+ component: RcSesIconWithSquareBackground,
10
+ tags: ['autodocs'],
11
+ argTypes: {
12
+ size: {
13
+ control: { type: 'select' },
14
+ options: [40, 44],
15
+ },
16
+ variant: {
17
+ control: { type: 'select' },
18
+ options: ['solid', 'soft', 'muted'],
19
+ },
20
+ },
21
+ }
22
+
23
+ export default meta
24
+ type Story = StoryObj<typeof meta>
25
+
26
+ export const Default: Story = {
27
+ args: {
28
+ Icon: InfoFillIcon,
29
+ size: 44,
30
+ variant: 'solid',
31
+ },
32
+ }
33
+
34
+ const SIZES = [40, 44] as const
35
+ const VARIANTS = ['solid', 'soft', 'muted'] as const
36
+
37
+ export const AllVariantsAndSizes: Story = {
38
+ parameters: { controls: { disable: true } },
39
+ render: () => (
40
+ <Stack spacing={3}>
41
+ {SIZES.map((size) => (
42
+ <Stack key={size} spacing={1}>
43
+ <Typography variant='caption'>size: {size}</Typography>
44
+ <Stack direction='row' spacing={2} sx={{ alignItems: 'center' }}>
45
+ {VARIANTS.map((variant) => (
46
+ <Stack key={variant} spacing={0.5} sx={{ alignItems: 'center' }}>
47
+ <RcSesIconWithSquareBackground
48
+ Icon={InfoFillIcon}
49
+ size={size}
50
+ variant={variant}
51
+ />
52
+ <Typography variant='caption'>{variant}</Typography>
53
+ </Stack>
54
+ ))}
55
+ </Stack>
56
+ </Stack>
57
+ ))}
58
+ </Stack>
59
+ ),
60
+ }
@@ -0,0 +1,110 @@
1
+ import { Box, Typography } from '@mui/material'
2
+ import { Meta, StoryObj } from '@storybook/react-vite'
3
+ import { useState } from 'react'
4
+
5
+ import { RcSesSideNavItem } from '@/components/common/SideNav/SideNav.types'
6
+ import RcSesSideNavLayout from '@/components/common/SideNav/SideNavLayout'
7
+ import FieldView from '@/components/storybook/FieldView'
8
+
9
+ const ITEMS: RcSesSideNavItem[] = [
10
+ { id: 'family', label: 'Aš ir mano šeima', count: 4 },
11
+ { id: 'documents', label: 'Dokumentai apie gyventoją', count: 2 },
12
+ { id: 'signature', label: 'Elektroninis parašas', count: 1 },
13
+ { id: 'residence', label: 'Gyvenamosios vietos deklaravimas', count: 7 },
14
+ { id: 'authorizations', label: 'Įgaliojimai', count: 6 },
15
+ { id: 'marriage', label: 'Santuoka ir skyrybos', count: 7 },
16
+ ]
17
+
18
+ const SECTION_HEIGHT = 320
19
+
20
+ function Sections() {
21
+ return (
22
+ <>
23
+ {ITEMS.map((item) => (
24
+ <Box
25
+ key={item.id}
26
+ id={item.id}
27
+ sx={{
28
+ height: `${SECTION_HEIGHT}px`,
29
+ borderBottom: '1px dashed #dce0e5',
30
+ paddingTop: '1rem',
31
+ }}
32
+ >
33
+ <Typography variant='h3' sx={{ fontSize: '1.25rem', fontWeight: 600 }}>
34
+ {item.label}
35
+ </Typography>
36
+ <Typography sx={{ color: '#6b747f' }}>
37
+ {item.count} paslaugos šioje temoje.
38
+ </Typography>
39
+ </Box>
40
+ ))}
41
+ </>
42
+ )
43
+ }
44
+
45
+ const meta: Meta<typeof RcSesSideNavLayout> = {
46
+ title: 'components/navigation/SideNav',
47
+ component: RcSesSideNavLayout,
48
+ tags: ['autodocs'],
49
+ parameters: {
50
+ docs: {
51
+ description: {
52
+ component:
53
+ 'RcSesSideNavLayout is the only supported way to use this component - it lays out the sticky nav column (a topic list on desktop, a horizontally scrollable pill bar on mobile) alongside its section children, which is what guarantees the desktop sticky behavior works. By default (no `activeItemId`) it tracks scroll position itself and scrolls the page on click - pass `activeItemId`/`onItemClick` to take full control instead. See `WithScrollSpy` for the default, self-contained behavior; `Main` demonstrates the fully-controlled mode, which is why it wires the state itself.',
54
+ },
55
+ },
56
+ },
57
+ }
58
+
59
+ export default meta
60
+
61
+ type Story = StoryObj<typeof RcSesSideNavLayout>
62
+
63
+ function ControlledDemo({
64
+ activeItemId: initialActiveItemId,
65
+ ...args
66
+ }: React.ComponentProps<typeof RcSesSideNavLayout>) {
67
+ const [activeItemId, setActiveItemId] = useState(initialActiveItemId ?? ITEMS[0].id)
68
+
69
+ return (
70
+ <RcSesSideNavLayout
71
+ {...args}
72
+ activeItemId={activeItemId}
73
+ onItemClick={setActiveItemId}
74
+ />
75
+ )
76
+ }
77
+
78
+ export const Main: Story = {
79
+ render: (args) => (
80
+ <FieldView>
81
+ <ControlledDemo {...args}>
82
+ <Sections />
83
+ </ControlledDemo>
84
+ </FieldView>
85
+ ),
86
+ args: {
87
+ items: ITEMS,
88
+ title: 'Temos',
89
+ },
90
+ }
91
+
92
+ export const WithScrollSpy: Story = {
93
+ render: () => (
94
+ <FieldView>
95
+ {/* The real page scrolls the window (as in the confirmed design), so this demo
96
+ does too, rather than nesting its own scroll container. */}
97
+ <RcSesSideNavLayout items={ITEMS} title='Temos'>
98
+ <Sections />
99
+ </RcSesSideNavLayout>
100
+ </FieldView>
101
+ ),
102
+ parameters: {
103
+ docs: {
104
+ description: {
105
+ story:
106
+ 'The default, uncontrolled mode: no `activeItemId`/`onItemClick` passed, so the nav tracks scroll position itself and scrolls to a section when its topic is clicked.',
107
+ },
108
+ },
109
+ },
110
+ }