@registrucentras/rc-ses-react-components 2.2.0 → 2.3.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.
- package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +3 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItemShell/AdvancedListItemShell.types.d.ts +31 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItemShell/index.d.ts +11 -0
- package/dist/library/index.d.ts +2 -1
- package/dist/library/types.d.ts +2 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +2775 -2619
- package/package.json +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +4 -0
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/AdvancedListItemShell.types.ts +35 -0
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.test.tsx +350 -0
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.tsx +247 -0
- package/src/library/index.ts +2 -1
- package/src/library/types.ts +10 -0
- package/src/stories/organisms/AdvancedListItem.stories.tsx +1 -1
- package/src/stories/organisms/AdvancedListItemShell.stories.tsx +866 -0
- package/src/theme/light/MuiTypography.tsx +24 -24
|
@@ -0,0 +1,866 @@
|
|
|
1
|
+
import { Avatar, Radio, Stack, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import NotePencilIcon from '@/assets/icons/NotePencilIcon'
|
|
6
|
+
import TrashIcon from '@/assets/icons/TrashIcon'
|
|
7
|
+
import AdvancedListItemShell from '@/components/common/AdvancedList/components/AdvancedListItemShell'
|
|
8
|
+
import RcSesBadge from '@/components/common/Badge'
|
|
9
|
+
import RcSesButton from '@/components/common/Button'
|
|
10
|
+
import RcSesSwitch from '@/components/common/Switch'
|
|
11
|
+
import palette from '@/theme/palette'
|
|
12
|
+
|
|
13
|
+
const ACTION_BUTTON_SX = {
|
|
14
|
+
height: 'auto',
|
|
15
|
+
padding: '0.5rem 0.25rem',
|
|
16
|
+
fontWeight: 500,
|
|
17
|
+
lineHeight: '1.25rem',
|
|
18
|
+
color: palette.primary[700],
|
|
19
|
+
} as const
|
|
20
|
+
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Organisms/AdvancedListItemShell',
|
|
23
|
+
component: AdvancedListItemShell,
|
|
24
|
+
tags: ['autodocs'],
|
|
25
|
+
argTypes: {
|
|
26
|
+
leading: { control: false },
|
|
27
|
+
content: { control: false },
|
|
28
|
+
trailing: { control: false },
|
|
29
|
+
expanded: { control: false },
|
|
30
|
+
onClick: { control: false },
|
|
31
|
+
testIds: { control: false },
|
|
32
|
+
},
|
|
33
|
+
args: {
|
|
34
|
+
content: (
|
|
35
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
36
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
37
|
+
Įrašo pavadinimas
|
|
38
|
+
</Typography>
|
|
39
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
40
|
+
a.k. 3880819****
|
|
41
|
+
</Typography>
|
|
42
|
+
</Stack>
|
|
43
|
+
),
|
|
44
|
+
state: 'rest',
|
|
45
|
+
},
|
|
46
|
+
} satisfies Meta<typeof AdvancedListItemShell>
|
|
47
|
+
|
|
48
|
+
export default meta
|
|
49
|
+
|
|
50
|
+
type Story = StoryObj<typeof meta>
|
|
51
|
+
|
|
52
|
+
export const Main: Story = {
|
|
53
|
+
parameters: {
|
|
54
|
+
docs: {
|
|
55
|
+
description: {
|
|
56
|
+
story:
|
|
57
|
+
'Only the required `content` slot is filled. `leading`, `trailing` and `expanded` are all omitted, so those are not rendered at all.',
|
|
58
|
+
},
|
|
59
|
+
source: {
|
|
60
|
+
code: `<AdvancedListItemShell
|
|
61
|
+
content={
|
|
62
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
63
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
64
|
+
Įrašo pavadinimas
|
|
65
|
+
</Typography>
|
|
66
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
67
|
+
a.k. 3880819****
|
|
68
|
+
</Typography>
|
|
69
|
+
</Stack>
|
|
70
|
+
}
|
|
71
|
+
/>`,
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export const Selected: Story = {
|
|
78
|
+
args: { state: 'selected' },
|
|
79
|
+
parameters: {
|
|
80
|
+
docs: {
|
|
81
|
+
description: {
|
|
82
|
+
story:
|
|
83
|
+
'Same slots as `Main`, but `state` is set to `selected`. The shell only changes its own border/background styling — slot content is untouched.',
|
|
84
|
+
},
|
|
85
|
+
source: {
|
|
86
|
+
code: `<AdvancedListItemShell
|
|
87
|
+
state='selected'
|
|
88
|
+
content={
|
|
89
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
90
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
91
|
+
Įrašo pavadinimas
|
|
92
|
+
</Typography>
|
|
93
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
94
|
+
a.k. 3880819****
|
|
95
|
+
</Typography>
|
|
96
|
+
</Stack>
|
|
97
|
+
}
|
|
98
|
+
/>`,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export const Disabled: Story = {
|
|
105
|
+
args: { state: 'disabled' },
|
|
106
|
+
parameters: {
|
|
107
|
+
docs: {
|
|
108
|
+
description: {
|
|
109
|
+
story:
|
|
110
|
+
'`state` is set to `disabled`. The shell dims itself, ignores `onClick`, and marks its root `inert` so any controls rendered into the slots are also removed from the tab order and assistive tech, not just visually blocked from the mouse.',
|
|
111
|
+
},
|
|
112
|
+
source: {
|
|
113
|
+
code: `<AdvancedListItemShell
|
|
114
|
+
state='disabled'
|
|
115
|
+
content={
|
|
116
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
117
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
118
|
+
Įrašo pavadinimas
|
|
119
|
+
</Typography>
|
|
120
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
121
|
+
a.k. 3880819****
|
|
122
|
+
</Typography>
|
|
123
|
+
</Stack>
|
|
124
|
+
}
|
|
125
|
+
/>`,
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const ErrorState: Story = {
|
|
132
|
+
args: { state: 'error' },
|
|
133
|
+
parameters: {
|
|
134
|
+
docs: {
|
|
135
|
+
description: {
|
|
136
|
+
story:
|
|
137
|
+
'`state` is set to `error`, which only swaps the border color token used by the shell. No slot content or layout changes are needed to represent this state.',
|
|
138
|
+
},
|
|
139
|
+
source: {
|
|
140
|
+
code: `<AdvancedListItemShell
|
|
141
|
+
state='error'
|
|
142
|
+
content={
|
|
143
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
144
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
145
|
+
Įrašo pavadinimas
|
|
146
|
+
</Typography>
|
|
147
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
148
|
+
a.k. 3880819****
|
|
149
|
+
</Typography>
|
|
150
|
+
</Stack>
|
|
151
|
+
}
|
|
152
|
+
/>`,
|
|
153
|
+
},
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export const WithLeadingAndTrailing: Story = {
|
|
159
|
+
args: {
|
|
160
|
+
leading: <Avatar>AB</Avatar>,
|
|
161
|
+
trailing: (
|
|
162
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
163
|
+
<RcSesButton
|
|
164
|
+
variant='link'
|
|
165
|
+
startIcon={<NotePencilIcon size={20} />}
|
|
166
|
+
onClick={() => {}}
|
|
167
|
+
sx={ACTION_BUTTON_SX}
|
|
168
|
+
>
|
|
169
|
+
Keisti
|
|
170
|
+
</RcSesButton>
|
|
171
|
+
<RcSesButton
|
|
172
|
+
variant='link'
|
|
173
|
+
startIcon={<TrashIcon size={20} />}
|
|
174
|
+
onClick={() => {}}
|
|
175
|
+
sx={ACTION_BUTTON_SX}
|
|
176
|
+
>
|
|
177
|
+
Pašalinti
|
|
178
|
+
</RcSesButton>
|
|
179
|
+
</Stack>
|
|
180
|
+
),
|
|
181
|
+
},
|
|
182
|
+
parameters: {
|
|
183
|
+
docs: {
|
|
184
|
+
description: {
|
|
185
|
+
story:
|
|
186
|
+
'Passes plain elements directly as the `leading` (an avatar) and `trailing` (a `Stack` of `RcSesButton` link-style action buttons, the same look `AdvancedListItem` uses for its `actions` trailing type) slots.',
|
|
187
|
+
},
|
|
188
|
+
source: {
|
|
189
|
+
code: `<AdvancedListItemShell
|
|
190
|
+
content={
|
|
191
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
192
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
193
|
+
Įrašo pavadinimas
|
|
194
|
+
</Typography>
|
|
195
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
196
|
+
a.k. 3880819****
|
|
197
|
+
</Typography>
|
|
198
|
+
</Stack>
|
|
199
|
+
}
|
|
200
|
+
leading={<Avatar>AB</Avatar>}
|
|
201
|
+
trailing={
|
|
202
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
203
|
+
<RcSesButton variant='link' startIcon={<NotePencilIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
204
|
+
Keisti
|
|
205
|
+
</RcSesButton>
|
|
206
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
207
|
+
Pašalinti
|
|
208
|
+
</RcSesButton>
|
|
209
|
+
</Stack>
|
|
210
|
+
}
|
|
211
|
+
/>`,
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export const RowContainer: Story = {
|
|
218
|
+
args: {
|
|
219
|
+
container: 'row',
|
|
220
|
+
leading: <Avatar>AB</Avatar>,
|
|
221
|
+
trailing: (
|
|
222
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
223
|
+
<RcSesButton
|
|
224
|
+
variant='link'
|
|
225
|
+
startIcon={<NotePencilIcon size={20} />}
|
|
226
|
+
onClick={() => {}}
|
|
227
|
+
sx={ACTION_BUTTON_SX}
|
|
228
|
+
>
|
|
229
|
+
Keisti
|
|
230
|
+
</RcSesButton>
|
|
231
|
+
<RcSesButton
|
|
232
|
+
variant='link'
|
|
233
|
+
startIcon={<TrashIcon size={20} />}
|
|
234
|
+
onClick={() => {}}
|
|
235
|
+
sx={ACTION_BUTTON_SX}
|
|
236
|
+
>
|
|
237
|
+
Pašalinti
|
|
238
|
+
</RcSesButton>
|
|
239
|
+
</Stack>
|
|
240
|
+
),
|
|
241
|
+
},
|
|
242
|
+
parameters: {
|
|
243
|
+
docs: {
|
|
244
|
+
description: {
|
|
245
|
+
story:
|
|
246
|
+
'`container` is set to `"row"`, the flush-list-row look: no border or corner radius, just a bottom divider in the same state-driven color the `"card"` look uses for its border. Useful when several shells are stacked directly against each other, like rows in a table.',
|
|
247
|
+
},
|
|
248
|
+
source: {
|
|
249
|
+
code: `<AdvancedListItemShell
|
|
250
|
+
container='row'
|
|
251
|
+
content={
|
|
252
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
253
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
254
|
+
Įrašo pavadinimas
|
|
255
|
+
</Typography>
|
|
256
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
257
|
+
a.k. 3880819****
|
|
258
|
+
</Typography>
|
|
259
|
+
</Stack>
|
|
260
|
+
}
|
|
261
|
+
leading={<Avatar>AB</Avatar>}
|
|
262
|
+
trailing={
|
|
263
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
264
|
+
<RcSesButton variant='link' startIcon={<NotePencilIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
265
|
+
Keisti
|
|
266
|
+
</RcSesButton>
|
|
267
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
268
|
+
Pašalinti
|
|
269
|
+
</RcSesButton>
|
|
270
|
+
</Stack>
|
|
271
|
+
}
|
|
272
|
+
/>`,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export const RowContainerSelected: Story = {
|
|
279
|
+
args: {
|
|
280
|
+
container: 'row',
|
|
281
|
+
state: 'selected',
|
|
282
|
+
leading: <Avatar>AB</Avatar>,
|
|
283
|
+
trailing: (
|
|
284
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
285
|
+
<RcSesButton
|
|
286
|
+
variant='link'
|
|
287
|
+
startIcon={<NotePencilIcon size={20} />}
|
|
288
|
+
onClick={() => {}}
|
|
289
|
+
sx={ACTION_BUTTON_SX}
|
|
290
|
+
>
|
|
291
|
+
Keisti
|
|
292
|
+
</RcSesButton>
|
|
293
|
+
<RcSesButton
|
|
294
|
+
variant='link'
|
|
295
|
+
startIcon={<TrashIcon size={20} />}
|
|
296
|
+
onClick={() => {}}
|
|
297
|
+
sx={ACTION_BUTTON_SX}
|
|
298
|
+
>
|
|
299
|
+
Pašalinti
|
|
300
|
+
</RcSesButton>
|
|
301
|
+
</Stack>
|
|
302
|
+
),
|
|
303
|
+
},
|
|
304
|
+
parameters: {
|
|
305
|
+
docs: {
|
|
306
|
+
description: {
|
|
307
|
+
story:
|
|
308
|
+
'`container` is set to `"row"` and `state` is `"selected"`. Shows the row layout with selected state styling — full border in primary color and cyan background tint.',
|
|
309
|
+
},
|
|
310
|
+
source: {
|
|
311
|
+
code: `<AdvancedListItemShell
|
|
312
|
+
container='row'
|
|
313
|
+
state='selected'
|
|
314
|
+
content={
|
|
315
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
316
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
317
|
+
Įrašo pavadinimas
|
|
318
|
+
</Typography>
|
|
319
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
320
|
+
a.k. 3880819****
|
|
321
|
+
</Typography>
|
|
322
|
+
</Stack>
|
|
323
|
+
}
|
|
324
|
+
leading={<Avatar>AB</Avatar>}
|
|
325
|
+
trailing={
|
|
326
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
327
|
+
<RcSesButton variant='link' startIcon={<NotePencilIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
328
|
+
Keisti
|
|
329
|
+
</RcSesButton>
|
|
330
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
331
|
+
Pašalinti
|
|
332
|
+
</RcSesButton>
|
|
333
|
+
</Stack>
|
|
334
|
+
}
|
|
335
|
+
/>`,
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
},
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
export const RowContainerError: Story = {
|
|
342
|
+
args: {
|
|
343
|
+
container: 'row',
|
|
344
|
+
state: 'error',
|
|
345
|
+
leading: <Avatar>AB</Avatar>,
|
|
346
|
+
trailing: (
|
|
347
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
348
|
+
<RcSesButton
|
|
349
|
+
variant='link'
|
|
350
|
+
startIcon={<NotePencilIcon size={20} />}
|
|
351
|
+
onClick={() => {}}
|
|
352
|
+
sx={ACTION_BUTTON_SX}
|
|
353
|
+
>
|
|
354
|
+
Keisti
|
|
355
|
+
</RcSesButton>
|
|
356
|
+
<RcSesButton
|
|
357
|
+
variant='link'
|
|
358
|
+
startIcon={<TrashIcon size={20} />}
|
|
359
|
+
onClick={() => {}}
|
|
360
|
+
sx={ACTION_BUTTON_SX}
|
|
361
|
+
>
|
|
362
|
+
Pašalinti
|
|
363
|
+
</RcSesButton>
|
|
364
|
+
</Stack>
|
|
365
|
+
),
|
|
366
|
+
},
|
|
367
|
+
parameters: {
|
|
368
|
+
docs: {
|
|
369
|
+
description: {
|
|
370
|
+
story:
|
|
371
|
+
'`container` is set to `"row"` and `state` is `"error"`. Shows the row layout with error state styling — full border in error color.',
|
|
372
|
+
},
|
|
373
|
+
source: {
|
|
374
|
+
code: `<AdvancedListItemShell
|
|
375
|
+
container='row'
|
|
376
|
+
state='error'
|
|
377
|
+
content={
|
|
378
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
379
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
380
|
+
Įrašo pavadinimas
|
|
381
|
+
</Typography>
|
|
382
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
383
|
+
a.k. 3880819****
|
|
384
|
+
</Typography>
|
|
385
|
+
</Stack>
|
|
386
|
+
}
|
|
387
|
+
leading={<Avatar>AB</Avatar>}
|
|
388
|
+
trailing={
|
|
389
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
390
|
+
<RcSesButton variant='link' startIcon={<NotePencilIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
391
|
+
Keisti
|
|
392
|
+
</RcSesButton>
|
|
393
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
394
|
+
Pašalinti
|
|
395
|
+
</RcSesButton>
|
|
396
|
+
</Stack>
|
|
397
|
+
}
|
|
398
|
+
/>`,
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
},
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export const RowContainerExpandable: Story = {
|
|
405
|
+
render: (args) => {
|
|
406
|
+
const [isExpanded, setIsExpanded] = useState(true)
|
|
407
|
+
|
|
408
|
+
return (
|
|
409
|
+
<AdvancedListItemShell
|
|
410
|
+
{...args}
|
|
411
|
+
isExpanded={isExpanded}
|
|
412
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
413
|
+
expanded={
|
|
414
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
415
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
416
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
417
|
+
Antra papildomos informacijos eilutė.
|
|
418
|
+
</Typography>
|
|
419
|
+
</Stack>
|
|
420
|
+
}
|
|
421
|
+
/>
|
|
422
|
+
)
|
|
423
|
+
},
|
|
424
|
+
args: {
|
|
425
|
+
container: 'row',
|
|
426
|
+
leading: <Avatar>AB</Avatar>,
|
|
427
|
+
trailing: (
|
|
428
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
429
|
+
<RcSesButton
|
|
430
|
+
variant='link'
|
|
431
|
+
startIcon={<NotePencilIcon size={20} />}
|
|
432
|
+
onClick={() => {}}
|
|
433
|
+
sx={ACTION_BUTTON_SX}
|
|
434
|
+
>
|
|
435
|
+
Keisti
|
|
436
|
+
</RcSesButton>
|
|
437
|
+
<RcSesButton
|
|
438
|
+
variant='link'
|
|
439
|
+
startIcon={<TrashIcon size={20} />}
|
|
440
|
+
onClick={() => {}}
|
|
441
|
+
sx={ACTION_BUTTON_SX}
|
|
442
|
+
>
|
|
443
|
+
Pašalinti
|
|
444
|
+
</RcSesButton>
|
|
445
|
+
</Stack>
|
|
446
|
+
),
|
|
447
|
+
},
|
|
448
|
+
parameters: {
|
|
449
|
+
docs: {
|
|
450
|
+
description: {
|
|
451
|
+
story:
|
|
452
|
+
'Combines `container="row"` with `isExpanded`/`onClick` to show a row-style expandable. Clicks the main row content to expand/collapse; clicking inside the expanded section does not collapse.',
|
|
453
|
+
},
|
|
454
|
+
source: {
|
|
455
|
+
code: `const [isExpanded, setIsExpanded] = useState(false)
|
|
456
|
+
|
|
457
|
+
<AdvancedListItemShell
|
|
458
|
+
container='row'
|
|
459
|
+
content={
|
|
460
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
461
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
462
|
+
Įrašo pavadinimas
|
|
463
|
+
</Typography>
|
|
464
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
465
|
+
a.k. 3880819****
|
|
466
|
+
</Typography>
|
|
467
|
+
</Stack>
|
|
468
|
+
}
|
|
469
|
+
leading={<Avatar>AB</Avatar>}
|
|
470
|
+
trailing={
|
|
471
|
+
<Stack direction='row' sx={{ gap: '0.5rem', alignItems: 'center' }}>
|
|
472
|
+
<RcSesButton variant='link' startIcon={<NotePencilIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
473
|
+
Keisti
|
|
474
|
+
</RcSesButton>
|
|
475
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
476
|
+
Pašalinti
|
|
477
|
+
</RcSesButton>
|
|
478
|
+
</Stack>
|
|
479
|
+
}
|
|
480
|
+
isExpanded={isExpanded}
|
|
481
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
482
|
+
expanded={
|
|
483
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
484
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
485
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
486
|
+
Antra papildomos informacijos eilutė.
|
|
487
|
+
</Typography>
|
|
488
|
+
</Stack>
|
|
489
|
+
}
|
|
490
|
+
/>`,
|
|
491
|
+
},
|
|
492
|
+
},
|
|
493
|
+
},
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export const Expandable: Story = {
|
|
497
|
+
render: (args) => {
|
|
498
|
+
const [isExpanded, setIsExpanded] = useState(false)
|
|
499
|
+
|
|
500
|
+
return (
|
|
501
|
+
<AdvancedListItemShell
|
|
502
|
+
{...args}
|
|
503
|
+
isExpanded={isExpanded}
|
|
504
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
505
|
+
expanded={
|
|
506
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
507
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
508
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
509
|
+
Antra papildomos informacijos eilutė.
|
|
510
|
+
</Typography>
|
|
511
|
+
</Stack>
|
|
512
|
+
}
|
|
513
|
+
/>
|
|
514
|
+
)
|
|
515
|
+
},
|
|
516
|
+
parameters: {
|
|
517
|
+
docs: {
|
|
518
|
+
description: {
|
|
519
|
+
story:
|
|
520
|
+
'Uses a custom `render` with local `useState` to own the `isExpanded` boolean. `onClick` toggles it and is wired to the root element by the shell; the `expanded` slot content stays the same node the whole time.',
|
|
521
|
+
},
|
|
522
|
+
source: {
|
|
523
|
+
code: `const [isExpanded, setIsExpanded] = useState(false)
|
|
524
|
+
|
|
525
|
+
<AdvancedListItemShell
|
|
526
|
+
content={
|
|
527
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
528
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
529
|
+
Įrašo pavadinimas
|
|
530
|
+
</Typography>
|
|
531
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
532
|
+
a.k. 3880819****
|
|
533
|
+
</Typography>
|
|
534
|
+
</Stack>
|
|
535
|
+
}
|
|
536
|
+
isExpanded={isExpanded}
|
|
537
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
538
|
+
expanded={
|
|
539
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
540
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
541
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
542
|
+
Antra papildomos informacijos eilutė.
|
|
543
|
+
</Typography>
|
|
544
|
+
</Stack>
|
|
545
|
+
}
|
|
546
|
+
/>`,
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
},
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Renders already expanded (no click needed) so the visual regression suite,
|
|
554
|
+
* which only screenshots each story's initial render, gets a baseline of the
|
|
555
|
+
* expanded open state.
|
|
556
|
+
*/
|
|
557
|
+
export const ExpandedOpen: Story = {
|
|
558
|
+
args: {
|
|
559
|
+
isExpanded: true,
|
|
560
|
+
expanded: (
|
|
561
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
562
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
563
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
564
|
+
Antra papildomos informacijos eilutė.
|
|
565
|
+
</Typography>
|
|
566
|
+
</Stack>
|
|
567
|
+
),
|
|
568
|
+
},
|
|
569
|
+
parameters: {
|
|
570
|
+
docs: {
|
|
571
|
+
description: {
|
|
572
|
+
story:
|
|
573
|
+
'Same `expanded` slot content as `Expandable`, but with `isExpanded` set to `true` directly in `args` instead of via local state, so the story renders open from the first paint — used as the visual-regression baseline for the expanded state.',
|
|
574
|
+
},
|
|
575
|
+
source: {
|
|
576
|
+
code: `<AdvancedListItemShell
|
|
577
|
+
content={
|
|
578
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
579
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
580
|
+
Įrašo pavadinimas
|
|
581
|
+
</Typography>
|
|
582
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
583
|
+
a.k. 3880819****
|
|
584
|
+
</Typography>
|
|
585
|
+
</Stack>
|
|
586
|
+
}
|
|
587
|
+
isExpanded
|
|
588
|
+
expanded={
|
|
589
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
590
|
+
<Typography variant='body2'>Papildoma informacija apie šį įrašą.</Typography>
|
|
591
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
592
|
+
Antra papildomos informacijos eilutė.
|
|
593
|
+
</Typography>
|
|
594
|
+
</Stack>
|
|
595
|
+
}
|
|
596
|
+
/>`,
|
|
597
|
+
},
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
export const RadioSelectionWithActions: Story = {
|
|
603
|
+
render: (args) => {
|
|
604
|
+
const [selected, setSelected] = useState(false)
|
|
605
|
+
|
|
606
|
+
return (
|
|
607
|
+
<AdvancedListItemShell
|
|
608
|
+
{...args}
|
|
609
|
+
state={selected ? 'selected' : 'rest'}
|
|
610
|
+
onClick={() => setSelected((prev) => !prev)}
|
|
611
|
+
leading={
|
|
612
|
+
<Radio
|
|
613
|
+
checked={selected}
|
|
614
|
+
onChange={() => setSelected((prev) => !prev)}
|
|
615
|
+
slotProps={{ input: { 'aria-label': 'Pažymėti elementą' } }}
|
|
616
|
+
sx={{
|
|
617
|
+
width: '1.375rem',
|
|
618
|
+
height: '1.375rem',
|
|
619
|
+
margin: 0,
|
|
620
|
+
padding: '0.0625rem',
|
|
621
|
+
'& svg': { width: '1.25rem', height: '1.25rem' },
|
|
622
|
+
}}
|
|
623
|
+
/>
|
|
624
|
+
}
|
|
625
|
+
trailing={
|
|
626
|
+
<RcSesButton
|
|
627
|
+
variant='link'
|
|
628
|
+
startIcon={<TrashIcon size={20} />}
|
|
629
|
+
onClick={() => {}}
|
|
630
|
+
sx={ACTION_BUTTON_SX}
|
|
631
|
+
>
|
|
632
|
+
Pašalinti
|
|
633
|
+
</RcSesButton>
|
|
634
|
+
}
|
|
635
|
+
/>
|
|
636
|
+
)
|
|
637
|
+
},
|
|
638
|
+
parameters: {
|
|
639
|
+
docs: {
|
|
640
|
+
description: {
|
|
641
|
+
story:
|
|
642
|
+
'`leading` is a `Radio`, `content` is a title + subtitle, and `trailing` has an action.',
|
|
643
|
+
},
|
|
644
|
+
source: {
|
|
645
|
+
code: `const [selected, setSelected] = useState(false)
|
|
646
|
+
|
|
647
|
+
<AdvancedListItemShell
|
|
648
|
+
state={selected ? 'selected' : 'rest'}
|
|
649
|
+
onClick={() => setSelected((prev) => !prev)}
|
|
650
|
+
leading={
|
|
651
|
+
<Radio
|
|
652
|
+
checked={selected}
|
|
653
|
+
onChange={() => setSelected((prev) => !prev)}
|
|
654
|
+
slotProps={{ input: { 'aria-label': 'Pažymėti elementą' } }}
|
|
655
|
+
sx={{
|
|
656
|
+
width: '1.375rem',
|
|
657
|
+
height: '1.375rem',
|
|
658
|
+
margin: 0,
|
|
659
|
+
padding: '0.0625rem',
|
|
660
|
+
'& svg': { width: '1.25rem', height: '1.25rem' },
|
|
661
|
+
}}
|
|
662
|
+
/>
|
|
663
|
+
}
|
|
664
|
+
content={
|
|
665
|
+
<Stack sx={{ gap: '0.4375rem' }}>
|
|
666
|
+
<Typography variant='body1' sx={{ fontWeight: 600 }}>
|
|
667
|
+
UAB Pavyzdys
|
|
668
|
+
</Typography>
|
|
669
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
670
|
+
Kodas 300xxxxxx
|
|
671
|
+
</Typography>
|
|
672
|
+
</Stack>
|
|
673
|
+
}
|
|
674
|
+
trailing={
|
|
675
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />} onClick={() => {}} sx={ACTION_BUTTON_SX}>
|
|
676
|
+
Pašalinti
|
|
677
|
+
</RcSesButton>
|
|
678
|
+
}
|
|
679
|
+
/>`,
|
|
680
|
+
},
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
export const ExpandableWithRadioAndSwitch: Story = {
|
|
686
|
+
render: (args) => {
|
|
687
|
+
const [isExpanded, setIsExpanded] = useState(false)
|
|
688
|
+
const [sendCopy, setSendCopy] = useState(false)
|
|
689
|
+
|
|
690
|
+
return (
|
|
691
|
+
<AdvancedListItemShell
|
|
692
|
+
{...args}
|
|
693
|
+
isExpanded={isExpanded}
|
|
694
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
695
|
+
leading={
|
|
696
|
+
<Radio
|
|
697
|
+
checked={isExpanded}
|
|
698
|
+
onChange={() => setIsExpanded((prev) => !prev)}
|
|
699
|
+
slotProps={{ input: { 'aria-label': 'Rodyti daugiau informacijos' } }}
|
|
700
|
+
sx={{
|
|
701
|
+
width: '1.375rem',
|
|
702
|
+
height: '1.375rem',
|
|
703
|
+
margin: 0,
|
|
704
|
+
padding: '0.0625rem',
|
|
705
|
+
'& svg': { width: '1.25rem', height: '1.25rem' },
|
|
706
|
+
}}
|
|
707
|
+
/>
|
|
708
|
+
}
|
|
709
|
+
content={
|
|
710
|
+
<Stack sx={{ gap: '0.25rem' }}>
|
|
711
|
+
<Typography
|
|
712
|
+
sx={{
|
|
713
|
+
fontSize: '1rem',
|
|
714
|
+
fontWeight: 500,
|
|
715
|
+
lineHeight: '1.375rem',
|
|
716
|
+
}}
|
|
717
|
+
>
|
|
718
|
+
Registrų centro savitarnoje
|
|
719
|
+
</Typography>
|
|
720
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
721
|
+
Rezultatą matysite iš karto savitarnoje
|
|
722
|
+
</Typography>
|
|
723
|
+
<Typography
|
|
724
|
+
sx={{
|
|
725
|
+
color: palette.grey[600],
|
|
726
|
+
fontSize: '0.8125rem',
|
|
727
|
+
fontWeight: 400,
|
|
728
|
+
lineHeight: '1.125rem',
|
|
729
|
+
}}
|
|
730
|
+
>
|
|
731
|
+
Nemokama
|
|
732
|
+
</Typography>
|
|
733
|
+
</Stack>
|
|
734
|
+
}
|
|
735
|
+
trailing={
|
|
736
|
+
<RcSesBadge
|
|
737
|
+
label='3 darbo dienos'
|
|
738
|
+
variant='neutral'
|
|
739
|
+
size='small'
|
|
740
|
+
showIcon={false}
|
|
741
|
+
/>
|
|
742
|
+
}
|
|
743
|
+
expanded={
|
|
744
|
+
<Stack direction='row' sx={{ alignItems: 'center', gap: '0.625rem' }}>
|
|
745
|
+
<RcSesSwitch
|
|
746
|
+
ariaLabel='Gauti kopiją į el. paštą'
|
|
747
|
+
checked={sendCopy}
|
|
748
|
+
onChange={(_, checked) => setSendCopy(checked)}
|
|
749
|
+
/>
|
|
750
|
+
<Stack sx={{ gap: '0.25rem' }}>
|
|
751
|
+
<Typography
|
|
752
|
+
sx={{
|
|
753
|
+
color: palette.grey[900],
|
|
754
|
+
fontSize: '0.875rem',
|
|
755
|
+
fontWeight: 600,
|
|
756
|
+
lineHeight: '1.25rem',
|
|
757
|
+
}}
|
|
758
|
+
>
|
|
759
|
+
Gauti kopiją į el. paštą
|
|
760
|
+
</Typography>
|
|
761
|
+
<Typography
|
|
762
|
+
sx={{
|
|
763
|
+
color: palette.grey[600],
|
|
764
|
+
fontSize: '0.875rem',
|
|
765
|
+
fontWeight: 400,
|
|
766
|
+
lineHeight: '1.25rem',
|
|
767
|
+
}}
|
|
768
|
+
>
|
|
769
|
+
Bus atsiųsta į Jūsų el. paštą vardas.pavarde@gmail.com
|
|
770
|
+
</Typography>
|
|
771
|
+
</Stack>
|
|
772
|
+
</Stack>
|
|
773
|
+
}
|
|
774
|
+
/>
|
|
775
|
+
)
|
|
776
|
+
},
|
|
777
|
+
parameters: {
|
|
778
|
+
docs: {
|
|
779
|
+
description: {
|
|
780
|
+
story:
|
|
781
|
+
'`leading` is a `Radio`, `content` is 3 text lines, `trailing` holds an `RcSesBadge` and the `expanded` slot holds an `RcSesSwitch` toggle plus explanatory text.',
|
|
782
|
+
},
|
|
783
|
+
source: {
|
|
784
|
+
code: `const [isExpanded, setIsExpanded] = useState(false)
|
|
785
|
+
const [sendCopy, setSendCopy] = useState(false)
|
|
786
|
+
|
|
787
|
+
<AdvancedListItemShell
|
|
788
|
+
isExpanded={isExpanded}
|
|
789
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
790
|
+
leading={
|
|
791
|
+
<Radio
|
|
792
|
+
checked={isExpanded}
|
|
793
|
+
onChange={() => setIsExpanded((prev) => !prev)}
|
|
794
|
+
slotProps={{ input: { 'aria-label': 'Rodyti daugiau informacijos' } }}
|
|
795
|
+
sx={{
|
|
796
|
+
width: '1.375rem',
|
|
797
|
+
height: '1.375rem',
|
|
798
|
+
margin: 0,
|
|
799
|
+
padding: '0.0625rem',
|
|
800
|
+
'& svg': { width: '1.25rem', height: '1.25rem' },
|
|
801
|
+
}}
|
|
802
|
+
/>
|
|
803
|
+
}
|
|
804
|
+
content={
|
|
805
|
+
<Stack sx={{ gap: '0.25rem' }}>
|
|
806
|
+
<Typography
|
|
807
|
+
sx={{
|
|
808
|
+
fontSize: '1rem',
|
|
809
|
+
fontWeight: 500,
|
|
810
|
+
lineHeight: '1.375rem',
|
|
811
|
+
}}
|
|
812
|
+
>
|
|
813
|
+
Registrų centro savitarnoje
|
|
814
|
+
</Typography>
|
|
815
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
816
|
+
Rezultatą matysite iš karto savitarnoje
|
|
817
|
+
</Typography>
|
|
818
|
+
<Typography
|
|
819
|
+
sx={{
|
|
820
|
+
color: palette.grey[600],
|
|
821
|
+
fontSize: '0.8125rem',
|
|
822
|
+
fontWeight: 400,
|
|
823
|
+
lineHeight: '1.125rem',
|
|
824
|
+
}}
|
|
825
|
+
>
|
|
826
|
+
Nemokama
|
|
827
|
+
</Typography>
|
|
828
|
+
</Stack>
|
|
829
|
+
}
|
|
830
|
+
trailing={<RcSesBadge label='3 darbo dienos' variant='neutral' size='small' showIcon={false} />}
|
|
831
|
+
expanded={
|
|
832
|
+
<Stack direction='row' sx={{ alignItems: 'center', gap: '0.625rem' }}>
|
|
833
|
+
<RcSesSwitch
|
|
834
|
+
ariaLabel='Gauti kopiją į el. paštą'
|
|
835
|
+
checked={sendCopy}
|
|
836
|
+
onChange={(_, checked) => setSendCopy(checked)}
|
|
837
|
+
/>
|
|
838
|
+
<Stack sx={{ gap: '0.25rem' }}>
|
|
839
|
+
<Typography
|
|
840
|
+
sx={{
|
|
841
|
+
color: palette.grey[900],
|
|
842
|
+
fontSize: '0.875rem',
|
|
843
|
+
fontWeight: 600,
|
|
844
|
+
lineHeight: '1.25rem',
|
|
845
|
+
}}
|
|
846
|
+
>
|
|
847
|
+
Gauti kopiją į el. paštą
|
|
848
|
+
</Typography>
|
|
849
|
+
<Typography
|
|
850
|
+
sx={{
|
|
851
|
+
color: palette.grey[600],
|
|
852
|
+
fontSize: '0.875rem',
|
|
853
|
+
fontWeight: 400,
|
|
854
|
+
lineHeight: '1.25rem',
|
|
855
|
+
}}
|
|
856
|
+
>
|
|
857
|
+
Bus atsiųsta į Jūsų el. paštą vardas.pavarde@gmail.com
|
|
858
|
+
</Typography>
|
|
859
|
+
</Stack>
|
|
860
|
+
</Stack>
|
|
861
|
+
}
|
|
862
|
+
/>`,
|
|
863
|
+
},
|
|
864
|
+
},
|
|
865
|
+
},
|
|
866
|
+
}
|