@registrucentras/rc-ses-react-components 1.11.0 → 1.13.0

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 (79) hide show
  1. package/README.md +5 -1
  2. package/dist/assets/icons/CaretUpBoldIcon.d.ts +3 -0
  3. package/dist/assets/icons/CaretUpIcon.d.ts +3 -0
  4. package/dist/assets/icons/ListIcon.d.ts +3 -0
  5. package/dist/assets/icons/MinusIcon.d.ts +3 -0
  6. package/dist/assets/icons/NotePencilIcon.d.ts +3 -0
  7. package/dist/assets/icons/PlusIcon.d.ts +3 -0
  8. package/dist/assets/icons/TrashIcon.d.ts +3 -0
  9. package/dist/assets/icons/UserIcon.d.ts +3 -0
  10. package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +106 -0
  11. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +12 -0
  12. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +7 -0
  13. package/dist/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.d.ts +2 -0
  14. package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +4 -0
  15. package/dist/components/common/AdvancedList/index.d.ts +11 -0
  16. package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +4 -1
  17. package/dist/components/common/SelectableCardList/index.d.ts +4 -1
  18. package/dist/components/common/Tooltip/index.d.ts +20 -0
  19. package/dist/components/form/inputs/Select/index.d.ts +1 -0
  20. package/dist/library/icons.d.ts +9 -1
  21. package/dist/library/index.d.ts +5 -0
  22. package/dist/library/types.d.ts +2 -1
  23. package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
  24. package/dist/registrucentras-rc-ses-react-components.js +4218 -3377
  25. package/dist/stories/components/display/AdvancedList.stories.d.ts +33 -0
  26. package/dist/stories/components/display/AdvancedListItem.stories.d.ts +33 -0
  27. package/dist/stories/components/display/SelectableCardList.stories.d.ts +8 -1
  28. package/dist/stories/components/display/Tooltip.stories.d.ts +48 -0
  29. package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +3 -3
  30. package/dist/theme/light/MuiTooltip.d.ts +3 -0
  31. package/dist/theme/motion.d.ts +16 -0
  32. package/package.json +1 -1
  33. package/src/assets/icons/CaretUpBoldIcon.tsx +17 -0
  34. package/src/assets/icons/CaretUpIcon.tsx +9 -0
  35. package/src/assets/icons/ListIcon.tsx +17 -0
  36. package/src/assets/icons/MinusIcon.tsx +9 -0
  37. package/src/assets/icons/NotePencilIcon.tsx +9 -0
  38. package/src/assets/icons/PlusIcon.tsx +9 -0
  39. package/src/assets/icons/TrashIcon.tsx +23 -0
  40. package/src/assets/icons/UserIcon.tsx +17 -0
  41. package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +100 -0
  42. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +214 -0
  43. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +241 -0
  44. package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.test.ts +80 -0
  45. package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.ts +28 -0
  46. package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +631 -0
  47. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +329 -0
  48. package/src/components/common/AdvancedList/index.test.tsx +97 -0
  49. package/src/components/common/AdvancedList/index.tsx +52 -0
  50. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +7 -5
  51. package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +50 -0
  52. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +34 -0
  53. package/src/components/common/SelectableCardList/index.test.tsx +56 -2
  54. package/src/components/common/SelectableCardList/index.tsx +29 -10
  55. package/src/components/common/Tooltip/index.test.tsx +85 -0
  56. package/src/components/common/Tooltip/index.tsx +167 -0
  57. package/src/components/form/inputs/FileDropzone.tsx +1 -0
  58. package/src/components/form/inputs/FileUpload.tsx +1 -0
  59. package/src/components/form/inputs/NumberStepper.tsx +1 -0
  60. package/src/components/form/inputs/RadioButtonGroup.test.tsx +71 -0
  61. package/src/components/form/inputs/RadioButtonGroup.tsx +1 -0
  62. package/src/components/form/inputs/Select/index.test.tsx +159 -0
  63. package/src/components/form/inputs/Select/index.tsx +109 -53
  64. package/src/i18n/namespaces/common/en.json +14 -0
  65. package/src/i18n/namespaces/common/lt.json +14 -0
  66. package/src/library/icons.ts +16 -0
  67. package/src/library/index.ts +5 -0
  68. package/src/library/types.ts +2 -0
  69. package/src/setupTests.ts +7 -1
  70. package/src/stories/components/display/AdvancedList.stories.tsx +660 -0
  71. package/src/stories/components/display/AdvancedListItem.stories.tsx +593 -0
  72. package/src/stories/components/display/SelectableCardList.stories.tsx +19 -0
  73. package/src/stories/components/display/Tooltip.stories.tsx +67 -0
  74. package/src/stories/components/inputs/Select.stories.tsx +38 -2
  75. package/src/theme/light/MuiAutocomplete.ts +3 -1
  76. package/src/theme/light/MuiInputBase.ts +4 -0
  77. package/src/theme/light/MuiTooltip.ts +40 -0
  78. package/src/theme/light/index.tsx +2 -0
  79. package/src/theme/motion.tsx +10 -0
@@ -0,0 +1,593 @@
1
+ import {
2
+ Avatar,
3
+ FormControl,
4
+ FormControlLabel,
5
+ FormLabel,
6
+ Radio,
7
+ RadioGroup,
8
+ Stack,
9
+ TextField,
10
+ } from '@mui/material'
11
+ import type { Meta, StoryObj } from '@storybook/react'
12
+ import { useState } from 'react'
13
+
14
+ import NotePencilIcon from '@/assets/icons/NotePencilIcon'
15
+ import TrashIcon from '@/assets/icons/TrashIcon'
16
+ import UserIcon from '@/assets/icons/UserIcon'
17
+ import AdvancedListItem from '@/components/common/AdvancedList/components/AdvancedListItem'
18
+
19
+ const meta = {
20
+ title: 'components/display/AdvancedListItem',
21
+ component: AdvancedListItem,
22
+ tags: ['autodocs'],
23
+ args: {
24
+ title: 'Įrašo pavadinimas',
25
+ subtitle: 'a.k. 3850.........',
26
+ state: 'rest',
27
+ },
28
+ } satisfies Meta<typeof AdvancedListItem>
29
+
30
+ export default meta
31
+
32
+ type Story = StoryObj<typeof meta>
33
+
34
+ export const Main: Story = {}
35
+
36
+ export const Selected: Story = {
37
+ args: {
38
+ state: 'selected',
39
+ },
40
+ }
41
+
42
+ export const Disabled: Story = {
43
+ args: {
44
+ state: 'disabled',
45
+ },
46
+ }
47
+
48
+ export const ErrorState: Story = {
49
+ args: {
50
+ state: 'error',
51
+ },
52
+ }
53
+
54
+ export const IgaliotojaiPreset: Story = {
55
+ name: 'Preset: Įgaliotojai (reorder + actions)',
56
+ render: () => (
57
+ <AdvancedListItem
58
+ title='Jonas Jonaitis'
59
+ subtitle='a.k. 3850.........'
60
+ leading={{ type: 'reorder', onMoveUp: () => {}, onMoveDown: () => {} }}
61
+ trailing={{
62
+ type: 'actions',
63
+ actions: [
64
+ { label: 'Keisti', icon: NotePencilIcon, onClick: () => {} },
65
+ { label: 'Pašalinti', icon: TrashIcon, onClick: () => {} },
66
+ ],
67
+ }}
68
+ />
69
+ ),
70
+ }
71
+
72
+ const JaAtstovaiRedaguojamaStory = () => {
73
+ const [checked, setChecked] = useState(false)
74
+
75
+ return (
76
+ <AdvancedListItem
77
+ title='Petras Petraitis'
78
+ subtitle='Vadovas'
79
+ leading={{ type: 'reorder', onMoveUp: () => {}, onMoveDown: () => {} }}
80
+ trailing={{ type: 'toggle', checked, onChange: setChecked }}
81
+ />
82
+ )
83
+ }
84
+
85
+ export const JaAtstovaiRedaguojamaPreset: Story = {
86
+ name: 'Preset: JA atstovai redaguojama (reorder + toggle)',
87
+ render: () => <JaAtstovaiRedaguojamaStory />,
88
+ }
89
+
90
+ export const JaAtstovaiPerziuraPreset: Story = {
91
+ name: 'Preset: JA atstovai peržiūra (status badge)',
92
+ render: () => (
93
+ <AdvancedListItem
94
+ title='Ona Onaitė'
95
+ subtitle='a.k. 3850.........'
96
+ trailing={{ type: 'status', label: 'Laukiama parašo', color: 'warning' }}
97
+ />
98
+ ),
99
+ }
100
+
101
+ const PasirenkamasSarasasStory = () => {
102
+ const [checked, setChecked] = useState(true)
103
+
104
+ return (
105
+ <AdvancedListItem
106
+ title='Nekilnojamasis daiktas'
107
+ subtitle='Unikalus Nr. 4400.....'
108
+ state={checked ? 'selected' : 'rest'}
109
+ leading={{ type: 'checkbox', checked, onChange: setChecked }}
110
+ />
111
+ )
112
+ }
113
+
114
+ export const PasirenkamasSarasasPreset: Story = {
115
+ name: 'Preset: Pasirenkamas sąrašas (checkbox, selected)',
116
+ render: () => <PasirenkamasSarasasStory />,
117
+ }
118
+
119
+ const PEOPLE_LIST_ITEMS = [
120
+ { id: 'rep-1', title: 'Petras Petraitis', subtitle: 'Vadovas', initials: 'PP' },
121
+ { id: 'rep-2', title: 'Ona Onaitė', subtitle: 'Prokuristė', initials: 'OO' },
122
+ ]
123
+
124
+ const LeadingMediaStory = () => {
125
+ const [checkedIds, setCheckedIds] = useState<string[]>(['rep-1'])
126
+
127
+ return (
128
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
129
+ {PEOPLE_LIST_ITEMS.map((item) => {
130
+ const checked = checkedIds.includes(item.id)
131
+
132
+ return (
133
+ <AdvancedListItem
134
+ key={item.id}
135
+ title={item.title}
136
+ subtitle={item.subtitle}
137
+ state={checked ? 'selected' : 'rest'}
138
+ leadingMedia={
139
+ <Avatar sx={{ width: '2rem', height: '2rem' }}>{item.initials}</Avatar>
140
+ }
141
+ leading={{
142
+ type: 'checkbox',
143
+ checked,
144
+ onChange: (next) =>
145
+ setCheckedIds((prev) =>
146
+ next ? [...prev, item.id] : prev.filter((id) => id !== item.id),
147
+ ),
148
+ }}
149
+ />
150
+ )
151
+ })}
152
+ </Stack>
153
+ )
154
+ }
155
+
156
+ export const CheckboxWithLeadingMedia: Story = {
157
+ name: 'Leading-media: avatar + checkbox people list',
158
+ render: () => <LeadingMediaStory />,
159
+ }
160
+
161
+ export const KrepselisPreset: Story = {
162
+ name: 'Preset: Krepšelis (price)',
163
+ render: () => (
164
+ <AdvancedListItem
165
+ title='NTR išrašas (objekto)'
166
+ subtitle='Elektroninis dokumentas (PDF)'
167
+ trailing={{ type: 'price', amount: '12,00 €', caption: 'su PVM' }}
168
+ />
169
+ ),
170
+ }
171
+
172
+ const OWNER_OPTIONS = [
173
+ { id: 'owner-individual', title: 'Savininkas fizinis asmuo' },
174
+ { id: 'owner-legal', title: 'Savininkas juridinis asmuo' },
175
+ ]
176
+
177
+ const RadioExpandStory = () => {
178
+ const [ownerId, setOwnerId] = useState(OWNER_OPTIONS[0].id)
179
+
180
+ return (
181
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
182
+ {OWNER_OPTIONS.map((option) => (
183
+ <AdvancedListItem
184
+ key={option.id}
185
+ title={option.title}
186
+ state={ownerId === option.id ? 'selected' : 'rest'}
187
+ leading={{
188
+ type: 'radio',
189
+ name: 'owner-type',
190
+ checked: ownerId === option.id,
191
+ onChange: () => setOwnerId(option.id),
192
+ }}
193
+ expanded={ownerId === option.id}
194
+ expandedContent={
195
+ option.id === 'owner-legal' ? (
196
+ <Stack gap={1.5}>
197
+ <TextField label='Įmonės pavadinimas' size='small' />
198
+ <TextField label='Įmonės kodas' size='small' />
199
+ <TextField label='Adresas' size='small' />
200
+ </Stack>
201
+ ) : undefined
202
+ }
203
+ />
204
+ ))}
205
+ </Stack>
206
+ )
207
+ }
208
+
209
+ export const RadioExpand: Story = {
210
+ name: 'GRM-12030: radio-expand (only one open at a time)',
211
+ render: () => <RadioExpandStory />,
212
+ }
213
+
214
+ const CHECKBOX_EXPAND_ITEMS = [
215
+ { id: 'rep-1', title: 'Petras Petraitis', subtitle: 'Vadovas' },
216
+ { id: 'rep-2', title: 'Ona Onaitė', subtitle: 'Prokuristė' },
217
+ ]
218
+
219
+ const CheckboxExpandStory = () => {
220
+ const [checkedIds, setCheckedIds] = useState<string[]>(['rep-1'])
221
+
222
+ return (
223
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
224
+ {CHECKBOX_EXPAND_ITEMS.map((item) => {
225
+ const checked = checkedIds.includes(item.id)
226
+
227
+ return (
228
+ <AdvancedListItem
229
+ key={item.id}
230
+ title={item.title}
231
+ subtitle={item.subtitle}
232
+ state={checked ? 'selected' : 'rest'}
233
+ leading={{
234
+ type: 'checkbox',
235
+ checked,
236
+ onChange: (next) =>
237
+ setCheckedIds((prev) =>
238
+ next ? [...prev, item.id] : prev.filter((id) => id !== item.id),
239
+ ),
240
+ }}
241
+ expanded={checked}
242
+ expandedContent={<TextField label='Kontaktinis el. paštas' size='small' />}
243
+ />
244
+ )
245
+ })}
246
+ </Stack>
247
+ )
248
+ }
249
+
250
+ export const CheckboxExpand: Story = {
251
+ name: 'GRM-12030: checkbox-expand (several open independently)',
252
+ render: () => <CheckboxExpandStory />,
253
+ }
254
+
255
+ const NestedRadioGroupStory = () => {
256
+ const [checked, setChecked] = useState(true)
257
+ const [declaration, setDeclaration] = useState('yes')
258
+
259
+ return (
260
+ <AdvancedListItem
261
+ title='Savininkas juridinis asmuo'
262
+ state={checked ? 'selected' : 'rest'}
263
+ leading={{ type: 'radio', checked, onChange: setChecked }}
264
+ expanded={checked}
265
+ expandedContent={
266
+ <Stack gap={1.5}>
267
+ <TextField label='Įmonės pavadinimas' size='small' />
268
+ <TextField label='Adresas' size='small' />
269
+ <FormControl>
270
+ <FormLabel id='declaration-label'>Deklaracija teikiama</FormLabel>
271
+ <RadioGroup
272
+ aria-labelledby='declaration-label'
273
+ value={declaration}
274
+ onChange={(e) => setDeclaration(e.target.value)}
275
+ >
276
+ <FormControlLabel value='yes' control={<Radio />} label='Taip' />
277
+ <FormControlLabel value='no' control={<Radio />} label='Ne' />
278
+ </RadioGroup>
279
+ </FormControl>
280
+ </Stack>
281
+ }
282
+ />
283
+ )
284
+ }
285
+
286
+ export const NestedRadioGroup: Story = {
287
+ name: 'GRM-12030: nested radio group inside expanded content',
288
+ render: () => <NestedRadioGroupStory />,
289
+ }
290
+
291
+ const LongExpandedContentStory = () => {
292
+ const [checked, setChecked] = useState(true)
293
+
294
+ return (
295
+ <AdvancedListItem
296
+ title='Nekilnojamasis daiktas su ilgu turiniu'
297
+ state={checked ? 'selected' : 'rest'}
298
+ leading={{ type: 'checkbox', checked, onChange: setChecked }}
299
+ expanded={checked}
300
+ expandedContent={
301
+ <Stack gap={1.5}>
302
+ {Array.from({ length: 10 }).map((_, index) => (
303
+ <TextField
304
+ // eslint-disable-next-line react/no-array-index-key
305
+ key={index}
306
+ label={`Laukas ${index + 1}`}
307
+ size='small'
308
+ />
309
+ ))}
310
+ </Stack>
311
+ }
312
+ />
313
+ )
314
+ }
315
+
316
+ export const LongExpandedContent: Story = {
317
+ name: 'GRM-12030: long expanded content (no internal scroll)',
318
+ render: () => <LongExpandedContentStory />,
319
+ }
320
+
321
+ const TrailingShowcaseStory = () => {
322
+ const [toggleChecked, setToggleChecked] = useState(false)
323
+ const [checkboxChecked, setCheckboxChecked] = useState(false)
324
+ const [radioChecked, setRadioChecked] = useState(false)
325
+ const [stepperValue, setStepperValue] = useState(1)
326
+
327
+ return (
328
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
329
+ <AdvancedListItem
330
+ title='Nėra'
331
+ subtitle='Show-trailing: nėra (trailing praleistas)'
332
+ />
333
+ <AdvancedListItem
334
+ title='Actions'
335
+ subtitle='Show-trailing: actions'
336
+ trailing={{
337
+ type: 'actions',
338
+ actions: [
339
+ { label: 'Keisti', icon: NotePencilIcon, onClick: () => {} },
340
+ { label: 'Pašalinti', icon: TrashIcon, onClick: () => {} },
341
+ ],
342
+ }}
343
+ />
344
+ <AdvancedListItem
345
+ title='Toggle'
346
+ subtitle='Show-trailing: toggle'
347
+ trailing={{ type: 'toggle', checked: toggleChecked, onChange: setToggleChecked }}
348
+ />
349
+ <AdvancedListItem
350
+ title='Status'
351
+ subtitle='Show-trailing: status'
352
+ trailing={{ type: 'status', label: 'Laukiama parašo', color: 'warning' }}
353
+ />
354
+ <AdvancedListItem
355
+ title='Checkbox'
356
+ subtitle='Show-trailing: checkbox'
357
+ trailing={{
358
+ type: 'checkbox',
359
+ checked: checkboxChecked,
360
+ onChange: setCheckboxChecked,
361
+ }}
362
+ />
363
+ <AdvancedListItem
364
+ title='Radio'
365
+ subtitle='Show-trailing: radio'
366
+ trailing={{ type: 'radio', checked: radioChecked, onChange: setRadioChecked }}
367
+ />
368
+ <AdvancedListItem
369
+ title='Chevron'
370
+ subtitle='Show-trailing: chevron'
371
+ trailing={{ type: 'chevron' }}
372
+ onClick={() => console.log('Chevron row clicked — navigate to details')}
373
+ />
374
+ <AdvancedListItem
375
+ title='Price'
376
+ subtitle='Show-trailing: price'
377
+ trailing={{ type: 'price', amount: '12,00 €', caption: 'su PVM' }}
378
+ />
379
+ <AdvancedListItem
380
+ title='Stepper'
381
+ subtitle='Show-trailing: stepper'
382
+ trailing={{
383
+ type: 'stepper',
384
+ value: stepperValue,
385
+ onChange: setStepperValue,
386
+ min: 0,
387
+ }}
388
+ />
389
+ <AdvancedListItem
390
+ title='Price (su Pašalinti)'
391
+ subtitle='Show-trailing: price + onDelete'
392
+ trailing={{
393
+ type: 'price',
394
+ amount: '12,00 €',
395
+ caption: 'su PVM',
396
+ onDelete: () => {},
397
+ }}
398
+ />
399
+ </Stack>
400
+ )
401
+ }
402
+
403
+ export const TrailingShowcase: Story = {
404
+ name: 'Preset: Show-trailing (visos trailing reikšmės)',
405
+ render: () => <TrailingShowcaseStory />,
406
+ }
407
+
408
+ const LeadingShowcaseStory = () => {
409
+ const [checked, setChecked] = useState(false)
410
+ const [selected, setSelected] = useState(false)
411
+
412
+ return (
413
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
414
+ <AdvancedListItem title='Nėra' subtitle='Show-leading: nėra (leading praleistas)' />
415
+ <AdvancedListItem
416
+ title='Reorder (abu)'
417
+ subtitle='Show-leading: reorder-both'
418
+ leading={{ type: 'reorder', onMoveUp: () => {}, onMoveDown: () => {} }}
419
+ />
420
+ <AdvancedListItem
421
+ title='Reorder (aukštyn)'
422
+ subtitle='Show-leading: reorder-up'
423
+ leading={{ type: 'reorder', onMoveUp: () => {} }}
424
+ />
425
+ <AdvancedListItem
426
+ title='Reorder (žemyn)'
427
+ subtitle='Show-leading: reorder-down'
428
+ leading={{ type: 'reorder', onMoveDown: () => {} }}
429
+ />
430
+ <AdvancedListItem
431
+ title='Checkbox'
432
+ subtitle='Show-leading: checkbox'
433
+ leading={{ type: 'checkbox', checked, onChange: setChecked }}
434
+ />
435
+ <AdvancedListItem
436
+ title='Radio'
437
+ subtitle='Show-leading: radio'
438
+ leading={{ type: 'radio', checked: selected, onChange: setSelected }}
439
+ />
440
+ <AdvancedListItem
441
+ title='Drag'
442
+ subtitle='Show-leading: drag'
443
+ leading={{ type: 'drag', 'aria-label': 'Vilkti ir pertvarkyti' }}
444
+ />
445
+ <AdvancedListItem
446
+ title='Icon'
447
+ subtitle='Show-leading: icon'
448
+ leading={{ type: 'icon', icon: UserIcon, 'aria-label': 'Naudotojas' }}
449
+ />
450
+ <AdvancedListItem
451
+ title='Avatar'
452
+ subtitle='Show-leading: avatar'
453
+ leading={{ type: 'avatar', initials: 'JP' }}
454
+ />
455
+ <AdvancedListItem
456
+ title='Index'
457
+ subtitle='Show-leading: index'
458
+ leading={{ type: 'index', index: 1 }}
459
+ />
460
+ </Stack>
461
+ )
462
+ }
463
+
464
+ export const LeadingShowcase: Story = {
465
+ name: 'Preset: Show-leading (visos leading reikšmės)',
466
+ render: () => <LeadingShowcaseStory />,
467
+ }
468
+
469
+ const UNIVERSAL_PRESET_OPTIONS = [
470
+ { id: 'with-name', title: 'Rodyti su asmens vardu, pavarde ir gimimo data' },
471
+ {
472
+ id: 'anonymised',
473
+ title: 'Nuasmenintas (be asmens vardo, pavardės, gimimo datos ir asmens kodo)',
474
+ },
475
+ ]
476
+
477
+ const UniversalPresetStory = () => {
478
+ const [selectedId, setSelectedId] = useState(UNIVERSAL_PRESET_OPTIONS[0].id)
479
+
480
+ return (
481
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
482
+ {UNIVERSAL_PRESET_OPTIONS.map((option) => (
483
+ <AdvancedListItem
484
+ key={option.id}
485
+ title={option.title}
486
+ state={selectedId === option.id ? 'selected' : 'rest'}
487
+ leading={{
488
+ type: 'radio',
489
+ name: 'universal-preset',
490
+ checked: selectedId === option.id,
491
+ onChange: () => setSelectedId(option.id),
492
+ }}
493
+ />
494
+ ))}
495
+ </Stack>
496
+ )
497
+ }
498
+
499
+ export const UniversalPreset: Story = {
500
+ name: 'Preset: pasirenkamų radijo eilučių sąrašas (universalus)',
501
+ render: () => <UniversalPresetStory />,
502
+ }
503
+
504
+ const PAYMENT_TILE_BANKS = [
505
+ { id: 'swedbank', title: 'Swedbank', initials: 'SW' },
506
+ { id: 'seb', title: 'SEB bankas', initials: 'SE' },
507
+ { id: 'luminor', title: 'Luminor', initials: 'Lu' },
508
+ ]
509
+
510
+ const PaymentTileStory = () => {
511
+ const [selectedId, setSelectedId] = useState(PAYMENT_TILE_BANKS[0].id)
512
+
513
+ return (
514
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
515
+ {PAYMENT_TILE_BANKS.map((bank) => (
516
+ <AdvancedListItem
517
+ key={bank.id}
518
+ title={bank.title}
519
+ state={selectedId === bank.id ? 'selected' : 'rest'}
520
+ leadingMedia={
521
+ <Avatar
522
+ variant='rounded'
523
+ sx={{
524
+ width: '2rem',
525
+ height: '2rem',
526
+ bgcolor: 'grey.200',
527
+ color: 'grey.700',
528
+ }}
529
+ >
530
+ {bank.initials}
531
+ </Avatar>
532
+ }
533
+ leading={{
534
+ type: 'radio',
535
+ name: 'payment-method',
536
+ checked: selectedId === bank.id,
537
+ onChange: () => setSelectedId(bank.id),
538
+ }}
539
+ />
540
+ ))}
541
+ </Stack>
542
+ )
543
+ }
544
+
545
+ export const PaymentTilePreset: Story = {
546
+ name: 'Preset: Payment tile (Card + Radio + Leading-media logo)',
547
+ render: () => <PaymentTileStory />,
548
+ }
549
+
550
+ const KREPSELIS_ITEMS = [
551
+ {
552
+ id: 'ntr-israsas',
553
+ title: 'NTR išrašas (objekto)',
554
+ subtitle: 'Reg. Nr. 4400-1234-5678',
555
+ amount: '12,00 €',
556
+ },
557
+ {
558
+ id: 'jar-israsas',
559
+ title: 'JAR išrašas',
560
+ subtitle: 'Įmonės kodas 300000000',
561
+ amount: '8,00 €',
562
+ },
563
+ {
564
+ id: 'kadastro-israsas',
565
+ title: 'Kadastro žemėlapio ištrauka',
566
+ subtitle: 'Reg. Nr. 4400-9876-5432',
567
+ amount: '5,00 €',
568
+ },
569
+ ]
570
+
571
+ const KrepselisWithDeleteStory = () => (
572
+ <Stack gap={1} sx={{ width: '100%', maxWidth: '32rem' }}>
573
+ {KREPSELIS_ITEMS.map((item) => (
574
+ <AdvancedListItem
575
+ key={item.id}
576
+ title={item.title}
577
+ subtitle={item.subtitle}
578
+ trailing={{
579
+ type: 'price',
580
+ amount: item.amount,
581
+ caption: 'su PVM',
582
+ onDelete: () => {},
583
+ deleteAriaLabel: `Pašalinti "${item.title}" iš krepšelio`,
584
+ }}
585
+ />
586
+ ))}
587
+ </Stack>
588
+ )
589
+
590
+ export const KrepselisWithDeletePreset: Story = {
591
+ name: 'Preset: Krepšelis (su trynimu)',
592
+ render: () => <KrepselisWithDeleteStory />,
593
+ }
@@ -49,12 +49,23 @@ const buildItems = (): SelectableCardListItemData[] =>
49
49
  title: `Service option ${index + 1}`,
50
50
  subtitle: index % 2 === 0 ? 'Recommended for most users' : 'Alternative flow',
51
51
  listItems: getListItems(index),
52
+ hasActionButton: index === 0,
53
+ actionButtonLabel: 'Action',
54
+ onActionButtonClick: () => {},
52
55
  }))
53
56
 
54
57
  const meta = {
55
58
  title: 'components/display/SelectableCardList',
56
59
  component: SelectableCardList,
57
60
  tags: ['autodocs'],
61
+ parameters: {
62
+ docs: {
63
+ description: {
64
+ component:
65
+ 'Paginates items client-side, showing 5 per page on desktop and 3 per page on mobile (below the `md` breakpoint). The page resets to 1 whenever the page size changes, e.g. when resizing across the breakpoint.',
66
+ },
67
+ },
68
+ },
58
69
  args: {
59
70
  items: buildItems(),
60
71
  selectedId: null,
@@ -101,6 +112,14 @@ export const Main: Story = {
101
112
  render: (args) => (
102
113
  <SelectableCardListStory {...args} onSelect={args.onSelect ?? (() => {})} />
103
114
  ),
115
+ parameters: {
116
+ docs: {
117
+ description: {
118
+ story:
119
+ 'Responsive page size: desktop shows 5 cards per page, mobile (below md) shows 3 cards per page. When page size changes across breakpoints, current page is reset to 1.',
120
+ },
121
+ },
122
+ },
104
123
  }
105
124
 
106
125
  export const Loading: Story = {
@@ -0,0 +1,67 @@
1
+ import { Button, Typography } from '@mui/material'
2
+ import type { Meta } from '@storybook/react'
3
+
4
+ import RcSesTooltip from '../../../components/common/Tooltip'
5
+
6
+ const meta = {
7
+ title: 'components/display/Tooltip',
8
+ component: RcSesTooltip,
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ tags: ['autodocs'],
13
+ argTypes: {
14
+ title: {
15
+ control: 'text',
16
+ description: 'Tooltip content',
17
+ },
18
+ placement: {
19
+ control: 'select',
20
+ options: ['top-start', 'top', 'top-end', 'bottom-start', 'bottom', 'bottom-end'],
21
+ description: 'Popper placement relative to the trigger',
22
+ },
23
+ slotProps: {
24
+ control: false,
25
+ description: 'Overrides for default trigger button',
26
+ },
27
+ children: {
28
+ control: false,
29
+ description: 'Custom trigger element, must forward ref!',
30
+ },
31
+ },
32
+ } satisfies Meta<typeof RcSesTooltip>
33
+
34
+ export default meta
35
+
36
+ export const Default = {
37
+ args: {
38
+ title:
39
+ 'Deklaruojant išvykimą iš Lietuvos nurodoma užsienio valstybė, į kurią išvykstama.',
40
+ },
41
+ render: (args: any) => (
42
+ <Typography>
43
+ Išvykimo valstybė
44
+ <RcSesTooltip {...args} />
45
+ </Typography>
46
+ ),
47
+ } as const
48
+
49
+ export const CustomTrigger = {
50
+ args: {
51
+ title: 'Papildoma informacija apie paslaugą.',
52
+ },
53
+ render: (args: any) => (
54
+ <RcSesTooltip {...args}>
55
+ <Button variant='text'>Mygtukas</Button>
56
+ </RcSesTooltip>
57
+ ),
58
+ parameters: {
59
+ docs: {
60
+ source: {
61
+ code: `<RcSesTooltip title="Papildoma informacija apie paslaugą.">
62
+ <Button variant="text">Mygtukas</Button>
63
+ </RcSesTooltip>`,
64
+ },
65
+ },
66
+ },
67
+ } as const