@registrucentras/rc-ses-react-components 2.4.0 → 2.5.1
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/assets/icons/phosphorIcons.d.ts +4 -0
- package/dist/components/common/Badge/index.d.ts +1 -0
- package/dist/components/overlays/Drawer/Drawer.types.d.ts +30 -0
- package/dist/components/overlays/Drawer/index.d.ts +9 -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 +2054 -1866
- package/package.json +5 -5
- package/src/assets/icons/phosphorIcons.ts +2 -0
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.test.tsx +23 -0
- package/src/components/common/AdvancedList/components/AdvancedListItemShell/index.tsx +6 -0
- package/src/components/common/Badge/index.test.tsx +16 -0
- package/src/components/common/Badge/index.tsx +34 -10
- package/src/components/form/inputs/Select/index.tsx +3 -1
- package/src/components/overlays/Drawer/Drawer.types.ts +32 -0
- package/src/components/overlays/Drawer/index.test.tsx +174 -0
- package/src/components/overlays/Drawer/index.tsx +192 -0
- package/src/i18n/namespaces/common/en.json +3 -0
- package/src/i18n/namespaces/common/lt.json +3 -0
- package/src/library/index.ts +2 -0
- package/src/library/types.ts +2 -0
- package/src/stories/atoms/Badge.stories.tsx +40 -0
- package/src/stories/atoms/Icons.stories.tsx +133 -226
- package/src/stories/foundations/ThemedMuiComponents.stories.tsx +31 -0
- package/src/stories/organisms/AdvancedListItemShell.stories.tsx +93 -3
- package/src/stories/organisms/Drawer.stories.tsx +90 -0
- package/src/theme/light/MuiAutocomplete.ts +5 -1
|
@@ -2,6 +2,7 @@ import { Box, Typography } from '@mui/material'
|
|
|
2
2
|
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
3
|
import { Fragment } from 'react'
|
|
4
4
|
|
|
5
|
+
import { CheckIcon, ClockIcon } from '@/assets/icons/phosphorIcons'
|
|
5
6
|
import RcSesBadge, { RcSesBadgeProps } from '@/components/common/Badge'
|
|
6
7
|
import FieldPreview from '@/components/storybook/FieldPreview'
|
|
7
8
|
import FieldView from '@/components/storybook/FieldView'
|
|
@@ -139,6 +140,45 @@ export const AllCombinations: Story = {
|
|
|
139
140
|
),
|
|
140
141
|
}
|
|
141
142
|
|
|
143
|
+
// ---------------------------------------------------------------------------
|
|
144
|
+
// Custom Icon
|
|
145
|
+
// ---------------------------------------------------------------------------
|
|
146
|
+
|
|
147
|
+
export const WithCustomIcon: Story = {
|
|
148
|
+
render: () => (
|
|
149
|
+
<Fields>
|
|
150
|
+
<FieldView>
|
|
151
|
+
<PreviewTitle>With custom icon (Clock)</PreviewTitle>
|
|
152
|
+
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
|
|
153
|
+
{variants.map((variant) => (
|
|
154
|
+
<RcSesBadge
|
|
155
|
+
key={variant}
|
|
156
|
+
label={variant}
|
|
157
|
+
variant={variant}
|
|
158
|
+
size='regular'
|
|
159
|
+
icon={<ClockIcon />}
|
|
160
|
+
/>
|
|
161
|
+
))}
|
|
162
|
+
</Box>
|
|
163
|
+
</FieldView>
|
|
164
|
+
<FieldPreview>
|
|
165
|
+
<PreviewTitle>With custom icon (Check)</PreviewTitle>
|
|
166
|
+
<Box sx={{ display: 'flex', gap: 2, flexWrap: 'wrap' }}>
|
|
167
|
+
{variants.map((variant) => (
|
|
168
|
+
<RcSesBadge
|
|
169
|
+
key={variant}
|
|
170
|
+
label={variant}
|
|
171
|
+
variant={variant}
|
|
172
|
+
size='regular'
|
|
173
|
+
icon={<CheckIcon />}
|
|
174
|
+
/>
|
|
175
|
+
))}
|
|
176
|
+
</Box>
|
|
177
|
+
</FieldPreview>
|
|
178
|
+
</Fields>
|
|
179
|
+
),
|
|
180
|
+
}
|
|
181
|
+
|
|
142
182
|
// ---------------------------------------------------------------------------
|
|
143
183
|
// Edge cases
|
|
144
184
|
// ---------------------------------------------------------------------------
|
|
@@ -1,63 +1,27 @@
|
|
|
1
|
-
import { Box, FormControl, MenuItem, Select, Typography } from '@mui/material'
|
|
1
|
+
import { Box, FormControl, MenuItem, Select, Stack, Typography } from '@mui/material'
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
3
|
import { useMemo, useState } from 'react'
|
|
4
|
-
import type {
|
|
4
|
+
import type { ComponentType, ReactNode } from 'react'
|
|
5
5
|
|
|
6
6
|
import type IconProps from '@/assets/IconProps'
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
7
|
+
import RcSesButton from '@/components/common/Button'
|
|
8
|
+
import RcSesIconWithSquareBackground from '@/components/common/IconWithSquareBackground'
|
|
9
|
+
import ListWithIcons from '@/components/common/ListWithIcons'
|
|
10
|
+
import * as libraryIcons from '@/library/icons'
|
|
10
11
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
CaretDownBoldIcon,
|
|
19
|
-
CaretDownFill,
|
|
20
|
-
CaretDownIcon,
|
|
21
|
-
CaretLeftBoldIcon,
|
|
22
|
-
CaretLeftIcon,
|
|
23
|
-
CaretRightBoldIcon,
|
|
24
|
-
CheckBoldIcon,
|
|
25
|
-
CheckCircleFillIcon,
|
|
26
|
-
CheckIcon,
|
|
27
|
-
CheckUncheckedBoldIcon,
|
|
28
|
-
CircleFilledIcon,
|
|
29
|
-
CloseIcon,
|
|
30
|
-
CollapseChevronsIcon,
|
|
31
|
-
CopyIcon,
|
|
32
|
-
ExpandChevronsIcon,
|
|
33
|
-
InfoFillIcon,
|
|
34
|
-
MagnifyingGlassIcon,
|
|
35
|
-
MapPinAreaIcon,
|
|
36
|
-
MinusBoldIcon,
|
|
37
|
-
PencilSimpleLineIcon,
|
|
38
|
-
PlusBoldIcon,
|
|
39
|
-
QuestionFillIcon,
|
|
40
|
-
QuestionIcon,
|
|
41
|
-
ScalesIcon,
|
|
42
|
-
ScrollIcon,
|
|
43
|
-
SpinnerGapBoldIcon,
|
|
44
|
-
UploadSimpleIcon,
|
|
45
|
-
WarningCircleIcon,
|
|
46
|
-
WarningDiamondFillIcon,
|
|
47
|
-
WarningFillIcon,
|
|
48
|
-
XCircleFillIcon,
|
|
49
|
-
} from '@/assets/icons/phosphorIcons'
|
|
12
|
+
EnvelopeSimpleIcon,
|
|
13
|
+
InfoIcon,
|
|
14
|
+
MapPinIcon,
|
|
15
|
+
PhoneIcon,
|
|
16
|
+
TrashIcon,
|
|
17
|
+
UserListIcon,
|
|
18
|
+
} from '@/library/icons'
|
|
50
19
|
import palette from '@/theme/palette'
|
|
51
20
|
|
|
52
21
|
// import resolvePaletteColorPath from '@/assets/resolvePaletteColorPath'
|
|
53
22
|
|
|
54
23
|
type StoryArgs = IconProps
|
|
55
24
|
|
|
56
|
-
interface IconStoryItem {
|
|
57
|
-
name: string
|
|
58
|
-
render: (args: StoryArgs) => ReactElement
|
|
59
|
-
}
|
|
60
|
-
|
|
61
25
|
type PaletteColorOptions = Record<string, string | undefined>
|
|
62
26
|
type PaletteColorLabels = Record<string, string>
|
|
63
27
|
|
|
@@ -97,182 +61,27 @@ const resolveTokenNameByColor = (color: string | undefined): string => {
|
|
|
97
61
|
return resolvedTokenName ?? 'default'
|
|
98
62
|
}
|
|
99
63
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
render: renderIcon(ArrowLeftIcon),
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
name: 'ArrowRightIcon',
|
|
113
|
-
render: renderIcon(ArrowRightIcon),
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 'ArrowsClockwiseIcon',
|
|
117
|
-
render: renderIcon(ArrowsClockwiseIcon),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'BarcodeIcon',
|
|
121
|
-
render: renderIcon(BarcodeIcon),
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 'CalendarBlankIcon',
|
|
125
|
-
render: renderIcon(CalendarBlankIcon),
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
name: 'CaretDoubleLeftBoldIcon',
|
|
129
|
-
render: renderIcon(CaretDoubleLeftBoldIcon),
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 'CaretDoubleRightBoldIcon',
|
|
133
|
-
render: renderIcon(CaretDoubleRightBoldIcon),
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
name: 'CaretDownBoldIcon',
|
|
137
|
-
render: renderIcon(CaretDownBoldIcon),
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
name: 'CaretDownFill',
|
|
141
|
-
render: renderIcon(CaretDownFill),
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
name: 'CaretDownIcon',
|
|
145
|
-
render: renderIcon(CaretDownIcon),
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'CaretLeftBoldIcon',
|
|
149
|
-
render: renderIcon(CaretLeftBoldIcon),
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
name: 'CaretLeftIcon',
|
|
153
|
-
render: renderIcon(CaretLeftIcon),
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 'CaretRightBoldIcon',
|
|
157
|
-
render: renderIcon(CaretRightBoldIcon),
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
name: 'CheckBoldIcon',
|
|
161
|
-
render: renderIcon(CheckBoldIcon),
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: 'CheckCircleFillIcon',
|
|
165
|
-
render: renderIcon(CheckCircleFillIcon),
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: 'CheckIcon',
|
|
169
|
-
render: renderIcon(CheckIcon),
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
name: 'CheckUncheckedBoldIcon',
|
|
173
|
-
render: renderIcon(CheckUncheckedBoldIcon),
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
name: 'CircleFilledIcon',
|
|
177
|
-
render: renderIcon(CircleFilledIcon),
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
name: 'CloseIcon',
|
|
181
|
-
render: renderIcon(CloseIcon),
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
name: 'CollapseChevronsIcon',
|
|
185
|
-
render: renderIcon(CollapseChevronsIcon),
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: 'CopyIcon',
|
|
189
|
-
render: renderIcon(CopyIcon),
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
name: 'DotCircleFilledIcon',
|
|
193
|
-
render: renderIcon(DotCircleFilledIcon),
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: 'ExpandChevronsIcon',
|
|
197
|
-
render: renderIcon(ExpandChevronsIcon),
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
name: 'InfoFillIcon',
|
|
201
|
-
render: renderIcon(InfoFillIcon),
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: 'MagnifyingGlassIcon',
|
|
205
|
-
render: renderIcon(MagnifyingGlassIcon),
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: 'MapPinAreaIcon',
|
|
209
|
-
render: renderIcon(MapPinAreaIcon),
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: 'MinusBoldIcon',
|
|
213
|
-
render: renderIcon(MinusBoldIcon),
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: 'PencilSimpleLineIcon',
|
|
217
|
-
render: renderIcon(PencilSimpleLineIcon),
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'PlusBoldIcon',
|
|
221
|
-
render: renderIcon(PlusBoldIcon),
|
|
222
|
-
},
|
|
223
|
-
{
|
|
224
|
-
name: 'QuestionFillIcon',
|
|
225
|
-
render: renderIcon(QuestionFillIcon),
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: 'QuestionIcon',
|
|
229
|
-
render: renderIcon(QuestionIcon),
|
|
230
|
-
},
|
|
231
|
-
{
|
|
232
|
-
name: 'ScalesIcon',
|
|
233
|
-
render: renderIcon(ScalesIcon),
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: 'ScrollIcon',
|
|
237
|
-
render: renderIcon(ScrollIcon),
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
name: 'SearchHelpIcon',
|
|
241
|
-
render: renderIcon(SearchHelpIcon),
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
name: 'SearchXIcon',
|
|
245
|
-
render: renderIcon(SearchXIcon),
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: 'SpinnerGapBoldIcon',
|
|
249
|
-
render: renderIcon(SpinnerGapBoldIcon),
|
|
250
|
-
},
|
|
251
|
-
{
|
|
252
|
-
name: 'UploadSimpleIcon',
|
|
253
|
-
render: renderIcon(UploadSimpleIcon),
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
name: 'WarningCircleIcon',
|
|
257
|
-
render: renderIcon(WarningCircleIcon),
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
name: 'WarningDiamondFillIcon',
|
|
261
|
-
render: renderIcon(WarningDiamondFillIcon),
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
name: 'WarningFillIcon',
|
|
265
|
-
render: renderIcon(WarningFillIcon),
|
|
266
|
-
},
|
|
267
|
-
{
|
|
268
|
-
name: 'XCircleFillIcon',
|
|
269
|
-
render: renderIcon(XCircleFillIcon),
|
|
270
|
-
},
|
|
271
|
-
]
|
|
64
|
+
// Every icon the package exports, so a newly added icon shows up here without
|
|
65
|
+
// touching this story
|
|
66
|
+
const iconItems = Object.entries(libraryIcons)
|
|
67
|
+
.filter(([name]) => name !== 'RcSesLogo')
|
|
68
|
+
.map(([name, Component]) => ({
|
|
69
|
+
name,
|
|
70
|
+
Component: Component as ComponentType<IconProps>,
|
|
71
|
+
}))
|
|
72
|
+
.sort((a, b) => a.name.localeCompare(b.name))
|
|
272
73
|
|
|
273
74
|
const meta: Meta<StoryArgs> = {
|
|
274
75
|
title: 'Atoms/Icons',
|
|
275
76
|
tags: ['autodocs'],
|
|
77
|
+
parameters: {
|
|
78
|
+
docs: {
|
|
79
|
+
description: {
|
|
80
|
+
component:
|
|
81
|
+
"Icons are exported from the package root, e.g. `import { TrashIcon } from '@registrucentras/rc-ses-react-components'`. Every icon takes `fillColor` (defaults to the current text color), `size` (px) and `weight` (`thin`, `light`, `regular`, `bold`, `fill`, `duotone`), plus any SVG attribute such as `className` or `aria-hidden`. **Usage** shows the common patterns; **Gallery** lists every icon.",
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
276
85
|
args: {
|
|
277
86
|
className: '',
|
|
278
87
|
fillColor: undefined,
|
|
@@ -327,11 +136,11 @@ const GalleryComponent = ({ className, size, fillColor }: StoryArgs) => {
|
|
|
327
136
|
p: 1.5,
|
|
328
137
|
}}
|
|
329
138
|
>
|
|
330
|
-
|
|
331
|
-
className
|
|
332
|
-
fillColor
|
|
333
|
-
size
|
|
334
|
-
|
|
139
|
+
<icon.Component
|
|
140
|
+
className={className}
|
|
141
|
+
fillColor={selectedFillColor}
|
|
142
|
+
size={size}
|
|
143
|
+
/>
|
|
335
144
|
<Typography
|
|
336
145
|
align='center'
|
|
337
146
|
sx={{
|
|
@@ -390,8 +199,106 @@ const GalleryComponent = ({ className, size, fillColor }: StoryArgs) => {
|
|
|
390
199
|
)
|
|
391
200
|
}
|
|
392
201
|
|
|
202
|
+
const UsageSection = ({ title, children }: { title: string; children: ReactNode }) => (
|
|
203
|
+
<Stack sx={{ gap: 1 }}>
|
|
204
|
+
<Typography sx={{ color: 'text.secondary', fontSize: '0.75rem' }}>{title}</Typography>
|
|
205
|
+
<Stack direction='row' sx={{ alignItems: 'center', flexWrap: 'wrap', gap: 2 }}>
|
|
206
|
+
{children}
|
|
207
|
+
</Stack>
|
|
208
|
+
</Stack>
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
const usageCode = `import {
|
|
212
|
+
EnvelopeSimpleIcon,
|
|
213
|
+
InfoIcon,
|
|
214
|
+
ListWithIcons,
|
|
215
|
+
MapPinIcon,
|
|
216
|
+
PhoneIcon,
|
|
217
|
+
RcSesButton,
|
|
218
|
+
RcSesIconWithSquareBackground,
|
|
219
|
+
RcSesPalette,
|
|
220
|
+
TrashIcon,
|
|
221
|
+
UserListIcon,
|
|
222
|
+
} from '@registrucentras/rc-ses-react-components'
|
|
223
|
+
|
|
224
|
+
// On its own: 24px, regular weight and the current text color unless told otherwise
|
|
225
|
+
<UserListIcon />
|
|
226
|
+
<UserListIcon size={16} fillColor={RcSesPalette.grey[600]} />
|
|
227
|
+
<TrashIcon weight='bold' aria-hidden='true' />
|
|
228
|
+
<InfoIcon weight='fill' fillColor={RcSesPalette.primary[500]} />
|
|
229
|
+
|
|
230
|
+
// Inside a button
|
|
231
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />}>
|
|
232
|
+
Pašalinti
|
|
233
|
+
</RcSesButton>
|
|
234
|
+
|
|
235
|
+
// ListWithIcons and the icon tiles size and color the icon themselves,
|
|
236
|
+
// so pass the component (PhoneIcon), not an element (<PhoneIcon />)
|
|
237
|
+
<ListWithIcons
|
|
238
|
+
layout='horizontal'
|
|
239
|
+
items={[
|
|
240
|
+
{ icon: UserListIcon, text: '3890615****' },
|
|
241
|
+
{ icon: PhoneIcon, text: '+370 600 00000' },
|
|
242
|
+
{ icon: EnvelopeSimpleIcon, text: 'vardenis.pavardenis@example.lt' },
|
|
243
|
+
{ icon: MapPinIcon, text: 'Vilnius, Gedimino pr. 1' },
|
|
244
|
+
]}
|
|
245
|
+
/>
|
|
246
|
+
<RcSesIconWithSquareBackground Icon={PhoneIcon} variant='soft' />`
|
|
247
|
+
|
|
248
|
+
const UsageComponent = () => (
|
|
249
|
+
<Stack sx={{ gap: 3 }}>
|
|
250
|
+
<UsageSection title='On its own'>
|
|
251
|
+
<UserListIcon />
|
|
252
|
+
<UserListIcon size={16} fillColor={palette.grey[600]} />
|
|
253
|
+
<TrashIcon weight='bold' aria-hidden='true' />
|
|
254
|
+
<InfoIcon weight='fill' fillColor={palette.primary[500]} />
|
|
255
|
+
</UsageSection>
|
|
256
|
+
<UsageSection title='Inside a button'>
|
|
257
|
+
<RcSesButton variant='link' startIcon={<TrashIcon size={20} />}>
|
|
258
|
+
Pašalinti
|
|
259
|
+
</RcSesButton>
|
|
260
|
+
</UsageSection>
|
|
261
|
+
<UsageSection title='In ListWithIcons (pass the component)'>
|
|
262
|
+
<ListWithIcons
|
|
263
|
+
layout='horizontal'
|
|
264
|
+
items={[
|
|
265
|
+
{ icon: UserListIcon, text: '3890615****' },
|
|
266
|
+
{ icon: PhoneIcon, text: '+370 600 00000' },
|
|
267
|
+
{ icon: EnvelopeSimpleIcon, text: 'vardenis.pavardenis@example.lt' },
|
|
268
|
+
{ icon: MapPinIcon, text: 'Vilnius, Gedimino pr. 1' },
|
|
269
|
+
]}
|
|
270
|
+
/>
|
|
271
|
+
</UsageSection>
|
|
272
|
+
<UsageSection title='In an icon tile (pass the component)'>
|
|
273
|
+
<RcSesIconWithSquareBackground Icon={PhoneIcon} variant='soft' />
|
|
274
|
+
</UsageSection>
|
|
275
|
+
</Stack>
|
|
276
|
+
)
|
|
277
|
+
|
|
393
278
|
type Story = StoryObj<StoryArgs>
|
|
394
279
|
|
|
280
|
+
export const Usage: Story = {
|
|
281
|
+
render: () => <UsageComponent />,
|
|
282
|
+
parameters: {
|
|
283
|
+
controls: { disable: true },
|
|
284
|
+
docs: {
|
|
285
|
+
description: {
|
|
286
|
+
story:
|
|
287
|
+
'How a consumer uses the icons: on their own, inside a button, and in components that take an icon component.',
|
|
288
|
+
},
|
|
289
|
+
source: { code: usageCode, language: 'tsx' },
|
|
290
|
+
},
|
|
291
|
+
},
|
|
292
|
+
}
|
|
293
|
+
|
|
395
294
|
export const Gallery: Story = {
|
|
396
295
|
render: (args) => <GalleryComponent {...args} />,
|
|
296
|
+
parameters: {
|
|
297
|
+
docs: {
|
|
298
|
+
description: {
|
|
299
|
+
story:
|
|
300
|
+
'Every icon the package exports. Use the controls to try `size` and the select below to try `fillColor`.',
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
},
|
|
397
304
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
Autocomplete,
|
|
2
3
|
Box,
|
|
3
4
|
Card,
|
|
4
5
|
CardContent,
|
|
@@ -11,6 +12,7 @@ import {
|
|
|
11
12
|
TableContainer,
|
|
12
13
|
TableHead,
|
|
13
14
|
TableRow,
|
|
15
|
+
TextField,
|
|
14
16
|
Tooltip,
|
|
15
17
|
Typography,
|
|
16
18
|
} from '@mui/material'
|
|
@@ -29,6 +31,9 @@ import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
|
29
31
|
* 2. **The wrapper never shows it open.** `MuiTooltip` is styled through
|
|
30
32
|
* `RcSesTooltip`, but that component owns its open state internally and no
|
|
31
33
|
* story can force it, so the popper never reaches a baseline.
|
|
34
|
+
* 3. **The wrappers restyle it.** `RcSesSelect` and `PhoneInput` lay their
|
|
35
|
+
* `MuiAutocomplete` options out as rows, so the theme's own option layout -
|
|
36
|
+
* what a consumer's plain Autocomplete gets - is covered by nothing else.
|
|
32
37
|
*
|
|
33
38
|
* Either way these render the plain MUI component under the theme, so a broken
|
|
34
39
|
* or silently dead override surfaces as a pixel diff.
|
|
@@ -175,3 +180,29 @@ export const TooltipSlots: Story = {
|
|
|
175
180
|
</Stack>
|
|
176
181
|
),
|
|
177
182
|
}
|
|
183
|
+
|
|
184
|
+
const autocompleteOptions = [
|
|
185
|
+
{ group: 'Paslaugos', label: 'Išrašo užsakymas' },
|
|
186
|
+
{
|
|
187
|
+
group: 'Paslaugos',
|
|
188
|
+
label:
|
|
189
|
+
'Nekilnojamojo turto registro duomenų teikimo leidžiamosios kreipties būdu naudojantis saityno paslauga',
|
|
190
|
+
},
|
|
191
|
+
{ group: 'Puslapiai', label: 'Kontaktai' },
|
|
192
|
+
]
|
|
193
|
+
|
|
194
|
+
export const AutocompleteSlots: Story = {
|
|
195
|
+
name: 'Autocomplete',
|
|
196
|
+
// Short options next to one that wraps, so a change to the theme's option
|
|
197
|
+
// alignment shows: the short ones move while the wrapping one cannot.
|
|
198
|
+
render: () => (
|
|
199
|
+
<Box sx={{ pb: '16rem', width: 480 }}>
|
|
200
|
+
<Autocomplete
|
|
201
|
+
groupBy={(option) => option.group}
|
|
202
|
+
open
|
|
203
|
+
options={autocompleteOptions}
|
|
204
|
+
renderInput={(params) => <TextField {...params} label='Paieška' />}
|
|
205
|
+
/>
|
|
206
|
+
</Box>
|
|
207
|
+
),
|
|
208
|
+
}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { Avatar, Radio, Stack, Typography } from '@mui/material'
|
|
2
2
|
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
3
|
import { useState } from 'react'
|
|
4
|
+
import { useForm } from 'react-hook-form'
|
|
4
5
|
|
|
5
|
-
import { NotePencilIcon, TrashIcon } from '@/assets/icons/phosphorIcons'
|
|
6
|
+
import { ClockIcon, NotePencilIcon, TrashIcon } from '@/assets/icons/phosphorIcons'
|
|
6
7
|
import AdvancedListItemShell from '@/components/common/AdvancedList/components/AdvancedListItemShell'
|
|
7
8
|
import RcSesBadge from '@/components/common/Badge'
|
|
8
9
|
import RcSesButton from '@/components/common/Button'
|
|
9
10
|
import RcSesSwitch from '@/components/common/Switch'
|
|
11
|
+
import RcSesSelect from '@/components/form/inputs/Select'
|
|
12
|
+
import RcSesSimpleCheckbox from '@/components/form/inputs/SimpleCheckbox'
|
|
10
13
|
import palette from '@/theme/palette'
|
|
11
14
|
|
|
12
15
|
const ACTION_BUTTON_SX = {
|
|
@@ -736,7 +739,8 @@ export const ExpandableWithRadioAndSwitch: Story = {
|
|
|
736
739
|
label='3 darbo dienos'
|
|
737
740
|
variant='neutral'
|
|
738
741
|
size='small'
|
|
739
|
-
showIcon
|
|
742
|
+
showIcon
|
|
743
|
+
icon={<ClockIcon />}
|
|
740
744
|
/>
|
|
741
745
|
}
|
|
742
746
|
expanded={
|
|
@@ -826,7 +830,7 @@ const [sendCopy, setSendCopy] = useState(false)
|
|
|
826
830
|
</Typography>
|
|
827
831
|
</Stack>
|
|
828
832
|
}
|
|
829
|
-
trailing={<RcSesBadge label='3 darbo dienos' variant='neutral' size='small' showIcon={
|
|
833
|
+
trailing={<RcSesBadge label='3 darbo dienos' variant='neutral' size='small' showIcon icon={<ClockIcon />} />}
|
|
830
834
|
expanded={
|
|
831
835
|
<Stack direction='row' sx={{ alignItems: 'center', gap: '0.625rem' }}>
|
|
832
836
|
<RcSesSwitch
|
|
@@ -863,3 +867,89 @@ const [sendCopy, setSendCopy] = useState(false)
|
|
|
863
867
|
},
|
|
864
868
|
},
|
|
865
869
|
}
|
|
870
|
+
|
|
871
|
+
const DOCUMENT_OPTIONS = [
|
|
872
|
+
{ value: 'ak', label: 'Asmens tapatybės kortelė AK12345' },
|
|
873
|
+
{ value: 'pasas', label: 'Pasas LT9876543' },
|
|
874
|
+
]
|
|
875
|
+
|
|
876
|
+
export const ExpandableWithDropdown: Story = {
|
|
877
|
+
render: (args) => {
|
|
878
|
+
const [isExpanded, setIsExpanded] = useState(true)
|
|
879
|
+
const { control } = useForm<{ documentType: string }>({
|
|
880
|
+
defaultValues: { documentType: '' },
|
|
881
|
+
})
|
|
882
|
+
|
|
883
|
+
return (
|
|
884
|
+
<AdvancedListItemShell
|
|
885
|
+
{...args}
|
|
886
|
+
isExpanded={isExpanded}
|
|
887
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
888
|
+
leading={
|
|
889
|
+
<RcSesSimpleCheckbox
|
|
890
|
+
checked={isExpanded}
|
|
891
|
+
onChange={() => setIsExpanded((prev) => !prev)}
|
|
892
|
+
slotProps={{ input: { 'aria-label': 'Įtraukti įrašą' } }}
|
|
893
|
+
/>
|
|
894
|
+
}
|
|
895
|
+
expanded={
|
|
896
|
+
<RcSesSelect
|
|
897
|
+
id='expandable-with-dropdown-document'
|
|
898
|
+
control={control}
|
|
899
|
+
name='documentType'
|
|
900
|
+
label='Asmens dokumentas'
|
|
901
|
+
options={DOCUMENT_OPTIONS}
|
|
902
|
+
/>
|
|
903
|
+
}
|
|
904
|
+
/>
|
|
905
|
+
)
|
|
906
|
+
},
|
|
907
|
+
parameters: {
|
|
908
|
+
docs: {
|
|
909
|
+
description: {
|
|
910
|
+
story:
|
|
911
|
+
'A checkbox row with a dropdown inside the `expanded` slot. Its menu is portalled to `document.body`, but React still bubbles the click. Selecting an option must leave the row expanded.',
|
|
912
|
+
},
|
|
913
|
+
source: {
|
|
914
|
+
code: `const [isExpanded, setIsExpanded] = useState(true)
|
|
915
|
+
const { control } = useForm<{ documentType: string }>({
|
|
916
|
+
defaultValues: { documentType: '' },
|
|
917
|
+
})
|
|
918
|
+
|
|
919
|
+
<AdvancedListItemShell
|
|
920
|
+
content={
|
|
921
|
+
<Stack sx={{ gap: '0.5rem' }}>
|
|
922
|
+
<Typography variant='body2' sx={{ fontWeight: 600 }}>
|
|
923
|
+
Įrašo pavadinimas
|
|
924
|
+
</Typography>
|
|
925
|
+
<Typography variant='body2' sx={{ color: palette.grey[600] }}>
|
|
926
|
+
a.k. 3880819****
|
|
927
|
+
</Typography>
|
|
928
|
+
</Stack>
|
|
929
|
+
}
|
|
930
|
+
isExpanded={isExpanded}
|
|
931
|
+
onClick={() => setIsExpanded((prev) => !prev)}
|
|
932
|
+
leading={
|
|
933
|
+
<RcSesSimpleCheckbox
|
|
934
|
+
checked={isExpanded}
|
|
935
|
+
onChange={() => setIsExpanded((prev) => !prev)}
|
|
936
|
+
slotProps={{ input: { 'aria-label': 'Įtraukti įrašą' } }}
|
|
937
|
+
/>
|
|
938
|
+
}
|
|
939
|
+
expanded={
|
|
940
|
+
<RcSesSelect
|
|
941
|
+
id='expandable-with-dropdown-document'
|
|
942
|
+
control={control}
|
|
943
|
+
name='documentType'
|
|
944
|
+
label='Asmens dokumentas'
|
|
945
|
+
options={[
|
|
946
|
+
{ value: 'ak', label: 'Asmens tapatybės kortelė AK12345' },
|
|
947
|
+
{ value: 'pasas', label: 'Pasas LT9876543' },
|
|
948
|
+
]}
|
|
949
|
+
/>
|
|
950
|
+
}
|
|
951
|
+
/>`,
|
|
952
|
+
},
|
|
953
|
+
},
|
|
954
|
+
},
|
|
955
|
+
}
|