@registrucentras/rc-ses-react-components 2.0.0-rc.3 → 2.0.0-rc.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 (80) hide show
  1. package/dist/assets/icons/ArrowRightIcon.d.ts +1 -1
  2. package/dist/assets/icons/WarningCircleIcon.d.ts +1 -1
  3. package/dist/components/common/Alert/index.d.ts +8 -2
  4. package/dist/components/common/CardShell/index.d.ts +1 -1
  5. package/dist/components/common/CardShell/types.d.ts +3 -1
  6. package/dist/components/common/IconWithSquareBackground/index.d.ts +12 -0
  7. package/dist/components/common/ServiceLinks/ServiceLinkItem/index.d.ts +15 -0
  8. package/dist/components/common/ServiceLinks/index.d.ts +3 -0
  9. package/dist/components/common/ServiceLinks/types.d.ts +34 -0
  10. package/dist/components/common/SideNav/SideNav.types.d.ts +20 -0
  11. package/dist/components/common/SideNav/SideNavLayout.d.ts +4 -0
  12. package/dist/components/common/SideNav/components/SideNavPill.d.ts +9 -0
  13. package/dist/components/common/SideNav/components/SideNavPillList.d.ts +9 -0
  14. package/dist/components/common/SideNav/components/SideNavRow.d.ts +9 -0
  15. package/dist/components/common/SideNav/hooks/useSideNavScrollSpy.d.ts +12 -0
  16. package/dist/components/common/SideNav/index.d.ts +4 -0
  17. package/dist/components/common/TitleBlock/index.d.ts +3 -0
  18. package/dist/components/common/TitleBlock/types.d.ts +73 -0
  19. package/dist/components/utils/normalizeSx.d.ts +4 -0
  20. package/dist/library/index.d.ts +8 -2
  21. package/dist/library/types.d.ts +6 -2
  22. package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
  23. package/dist/registrucentras-rc-ses-react-components.js +3489 -2703
  24. package/dist/stories/components/display/CardShell.stories.d.ts +1 -1
  25. package/dist/stories/components/display/SelectableCardList.stories.d.ts +1 -0
  26. package/dist/stories/components/display/ServiceLinks.stories.d.ts +28 -0
  27. package/dist/stories/components/display/TitleBlock.stories.d.ts +20 -0
  28. package/dist/stories/components/feedback/Alert.stories.d.ts +4 -0
  29. package/dist/stories/components/form/FormControlWrapper.stories.d.ts +1 -0
  30. package/dist/stories/components/icons/IconWithSquareBackground.stories.d.ts +7 -0
  31. package/dist/stories/components/navigation/SideNav.stories.d.ts +7 -0
  32. package/package.json +1 -1
  33. package/src/assets/icons/ArrowRightIcon.tsx +2 -1
  34. package/src/assets/icons/WarningCircleIcon.tsx +8 -2
  35. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +8 -6
  36. package/src/components/common/Alert/index.test.tsx +157 -2
  37. package/src/components/common/Alert/index.tsx +144 -10
  38. package/src/components/common/Card/index.tsx +1 -23
  39. package/src/components/common/CardShell/index.tsx +4 -1
  40. package/src/components/common/CardShell/types.ts +3 -1
  41. package/src/components/common/IconWithSquareBackground/index.test.tsx +55 -0
  42. package/src/components/common/IconWithSquareBackground/index.tsx +83 -0
  43. package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +177 -0
  44. package/src/components/common/ServiceLinks/index.test.tsx +166 -0
  45. package/src/components/common/ServiceLinks/index.tsx +66 -0
  46. package/src/components/common/ServiceLinks/types.ts +37 -0
  47. package/src/components/common/SideNav/SideNav.types.ts +24 -0
  48. package/src/components/common/SideNav/SideNavLayout.test.tsx +113 -0
  49. package/src/components/common/SideNav/SideNavLayout.tsx +67 -0
  50. package/src/components/common/SideNav/components/SideNavPill.tsx +62 -0
  51. package/src/components/common/SideNav/components/SideNavPillList.tsx +190 -0
  52. package/src/components/common/SideNav/components/SideNavRow.tsx +72 -0
  53. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.test.ts +457 -0
  54. package/src/components/common/SideNav/hooks/useSideNavScrollSpy.ts +154 -0
  55. package/src/components/common/SideNav/index.test.tsx +99 -0
  56. package/src/components/common/SideNav/index.tsx +83 -0
  57. package/src/components/common/TitleBlock/index.test.tsx +366 -0
  58. package/src/components/common/TitleBlock/index.tsx +144 -0
  59. package/src/components/common/TitleBlock/types.ts +82 -0
  60. package/src/components/utils/normalizeSx.ts +24 -0
  61. package/src/i18n/namespaces/common/en.json +4 -0
  62. package/src/i18n/namespaces/common/lt.json +4 -0
  63. package/src/library/index.ts +8 -2
  64. package/src/library/types.ts +20 -8
  65. package/src/stories/components/display/CardShell.stories.tsx +14 -12
  66. package/src/stories/components/display/SelectableCardList.stories.tsx +33 -1
  67. package/src/stories/components/display/ServiceLinks.stories.tsx +154 -0
  68. package/src/stories/components/display/TitleBlock.stories.tsx +506 -0
  69. package/src/stories/components/feedback/Alert.stories.tsx +135 -4
  70. package/src/stories/components/form/FormControlWrapper.stories.tsx +23 -0
  71. package/src/stories/components/icons/IconWithSquareBackground.stories.tsx +60 -0
  72. package/src/stories/components/navigation/SideNav.stories.tsx +110 -0
  73. package/src/theme/cards.ts +1 -1
  74. package/src/theme/light/MuiAlert.tsx +28 -20
  75. package/src/theme/light/MuiButton.tsx +6 -0
  76. package/dist/components/common/CardShell/CardHeader/index.d.ts +0 -3
  77. package/dist/components/common/CardShell/CardHeader/types.d.ts +0 -33
  78. package/src/components/common/CardShell/CardHeader/index.test.tsx +0 -207
  79. package/src/components/common/CardShell/CardHeader/index.tsx +0 -104
  80. 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
+ }
@@ -1,4 +1,6 @@
1
- import { Meta, StoryObj } from '@storybook/react-vite'
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+ import { useState } from 'react'
3
+ import { fn } from 'storybook/test'
2
4
 
3
5
  import RcSesAlert from '@/components/common/Alert'
4
6
  import FieldPreview from '@/components/storybook/FieldPreview'
@@ -9,12 +11,40 @@ import PreviewTitle from '@/components/storybook/PreviewTitle'
9
11
  const lorem =
10
12
  "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard."
11
13
 
12
- const severities = ['info', 'warning', 'error', 'success'] as const
14
+ const severities: Array<'grey' | 'info' | 'success' | 'warning' | 'error'> = [
15
+ 'grey',
16
+ 'info',
17
+ 'success',
18
+ 'warning',
19
+ 'error',
20
+ ]
13
21
 
14
22
  const meta: Meta<typeof RcSesAlert> = {
15
23
  title: 'components/feedback/Alert',
16
24
  component: RcSesAlert,
17
25
  tags: ['autodocs'],
26
+ argTypes: {
27
+ severity: {
28
+ options: severities,
29
+ control: { type: 'select' },
30
+ },
31
+ variant: {
32
+ options: ['outlined', 'filled', 'standard'],
33
+ control: { type: 'select' },
34
+ },
35
+ showIcon: {
36
+ control: 'boolean',
37
+ },
38
+ showAction: {
39
+ control: 'boolean',
40
+ },
41
+ showClose: {
42
+ control: 'boolean',
43
+ },
44
+ actionLabel: {
45
+ control: 'text',
46
+ },
47
+ },
18
48
  }
19
49
 
20
50
  export default meta
@@ -34,7 +64,7 @@ export const Main: Story = {
34
64
  <FieldPreview>
35
65
  <PreviewTitle>State previews</PreviewTitle>
36
66
  {severities.map((severity) => (
37
- <RcSesAlert key={severity} severity={severity}>
67
+ <RcSesAlert key={severity} severity={severity} sx={{ mb: 1 }}>
38
68
  {lorem}
39
69
  </RcSesAlert>
40
70
  ))}
@@ -44,6 +74,9 @@ export const Main: Story = {
44
74
  args: {
45
75
  children: lorem,
46
76
  severity: 'info',
77
+ actionLabel: 'Veiksmas',
78
+ onActionClick: fn(),
79
+ onClose: fn(),
47
80
  },
48
81
  }
49
82
 
@@ -54,7 +87,7 @@ export const Main: Story = {
54
87
  const renderVariants: Story['render'] = (args) => (
55
88
  <>
56
89
  {severities.map((severity) => (
57
- <RcSesAlert key={severity} {...args} severity={severity}>
90
+ <RcSesAlert key={severity} {...args} severity={severity} sx={{ mb: 1 }}>
58
91
  {lorem}
59
92
  </RcSesAlert>
60
93
  ))}
@@ -76,6 +109,104 @@ export const Standard: Story = {
76
109
  args: { variant: 'standard' },
77
110
  }
78
111
 
112
+ // ---------------------------------------------------------------------------
113
+ // Action & close — buttons wired up, but not removing the alert on close
114
+ // (see Dismissible below for that). Clicks are logged in the Actions panel.
115
+ // ---------------------------------------------------------------------------
116
+
117
+ export const WithActionAndClose: Story = {
118
+ render: renderVariants,
119
+ args: {
120
+ actionLabel: 'Veiksmas',
121
+ onActionClick: fn(),
122
+ onClose: fn(),
123
+ },
124
+ }
125
+
126
+ export const WithoutActionAndClose: Story = {
127
+ render: renderVariants,
128
+ }
129
+
130
+ // ---------------------------------------------------------------------------
131
+ // Toggles — Type × showIcon/showAction/showClose combinations
132
+ // ---------------------------------------------------------------------------
133
+
134
+ export const Toggles: Story = {
135
+ render: () => (
136
+ <>
137
+ <PreviewTitle>showIcon = false</PreviewTitle>
138
+ {severities.map((severity) => (
139
+ <RcSesAlert key={severity} severity={severity} showIcon={false} sx={{ mb: 1 }}>
140
+ {lorem}
141
+ </RcSesAlert>
142
+ ))}
143
+
144
+ <PreviewTitle>action only (showClose = false)</PreviewTitle>
145
+ {severities.map((severity) => (
146
+ <RcSesAlert
147
+ key={severity}
148
+ severity={severity}
149
+ actionLabel='Veiksmas'
150
+ onActionClick={fn()}
151
+ onClose={fn()}
152
+ showClose={false}
153
+ sx={{ mb: 1 }}
154
+ >
155
+ {lorem}
156
+ </RcSesAlert>
157
+ ))}
158
+
159
+ <PreviewTitle>close only (showAction = false)</PreviewTitle>
160
+ {severities.map((severity) => (
161
+ <RcSesAlert
162
+ key={severity}
163
+ severity={severity}
164
+ actionLabel='Veiksmas'
165
+ onActionClick={fn()}
166
+ onClose={fn()}
167
+ showAction={false}
168
+ sx={{ mb: 1 }}
169
+ >
170
+ {lorem}
171
+ </RcSesAlert>
172
+ ))}
173
+ </>
174
+ ),
175
+ }
176
+
177
+ // ---------------------------------------------------------------------------
178
+ // Dismissible — action logs to the console, close actually removes the alert
179
+ // ---------------------------------------------------------------------------
180
+
181
+ function DismissibleTemplate() {
182
+ const [visibleSeverities, setVisibleSeverities] = useState<
183
+ Array<(typeof severities)[number]>
184
+ >([...severities])
185
+
186
+ return (
187
+ <>
188
+ {visibleSeverities.map((severity) => (
189
+ <RcSesAlert
190
+ key={severity}
191
+ severity={severity}
192
+ actionLabel='Veiksmas'
193
+ onActionClick={() => console.log(`${severity} alert action clicked`)}
194
+ onClose={() =>
195
+ setVisibleSeverities((prev) => prev.filter((item) => item !== severity))
196
+ }
197
+ sx={{ mb: 1 }}
198
+ >
199
+ {lorem}
200
+ </RcSesAlert>
201
+ ))}
202
+ </>
203
+ )
204
+ }
205
+
206
+ export const Dismissible: Story = {
207
+ render: () => <DismissibleTemplate />,
208
+ }
209
+
79
210
  // ---------------------------------------------------------------------------
80
211
  // Container — full-bleed banner keeping content width-constrained
81
212
  // ---------------------------------------------------------------------------