@registrucentras/rc-ses-react-components 2.0.0-rc.0 → 2.0.0-rc.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/README.md +5 -1
- package/dist/assets/icons/CaretUpBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretUpIcon.d.ts +3 -0
- package/dist/assets/icons/ListIcon.d.ts +3 -0
- package/dist/assets/icons/MinusIcon.d.ts +3 -0
- package/dist/assets/icons/NotePencilIcon.d.ts +3 -0
- package/dist/assets/icons/PlusIcon.d.ts +3 -0
- package/dist/assets/icons/TrashIcon.d.ts +3 -0
- package/dist/assets/icons/UserIcon.d.ts +3 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +106 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +12 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +7 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +4 -0
- package/dist/components/common/AdvancedList/index.d.ts +11 -0
- package/dist/components/common/Button/index.d.ts +13 -3
- package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +4 -1
- package/dist/components/common/SelectableCardList/index.d.ts +4 -1
- package/dist/components/common/Tooltip/index.d.ts +20 -0
- package/dist/library/icons.d.ts +9 -1
- package/dist/library/index.d.ts +5 -0
- package/dist/library/types.d.ts +2 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +4107 -3246
- package/dist/stories/components/actions/Button.stories.d.ts +4 -3
- package/dist/stories/components/display/AdvancedList.stories.d.ts +32 -0
- package/dist/stories/components/display/AdvancedListItem.stories.d.ts +33 -0
- package/dist/stories/components/display/SelectableCardList.stories.d.ts +8 -1
- package/dist/stories/components/display/Tooltip.stories.d.ts +48 -0
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +23 -0
- package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +3 -3
- package/dist/stories/components/overlays/Dialog.stories.d.ts +6 -0
- package/dist/stories/components/overlays/Popover.stories.d.ts +12 -0
- package/dist/stories/theme/ThemedMuiComponents.stories.d.ts +25 -0
- package/dist/theme/light/MuiTooltip.d.ts +3 -0
- package/dist/theme/motion.d.ts +16 -0
- package/package.json +2 -1
- package/src/assets/icons/CaretUpBoldIcon.tsx +17 -0
- package/src/assets/icons/CaretUpIcon.tsx +9 -0
- package/src/assets/icons/ListIcon.tsx +17 -0
- package/src/assets/icons/MinusIcon.tsx +9 -0
- package/src/assets/icons/NotePencilIcon.tsx +9 -0
- package/src/assets/icons/PlusIcon.tsx +9 -0
- package/src/assets/icons/TrashIcon.tsx +23 -0
- package/src/assets/icons/UserIcon.tsx +17 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +100 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +224 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +263 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.test.ts +80 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.ts +28 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +631 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +332 -0
- package/src/components/common/AdvancedList/index.test.tsx +97 -0
- package/src/components/common/AdvancedList/index.tsx +52 -0
- package/src/components/common/Button/index.tsx +15 -1
- package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +7 -5
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +50 -0
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +34 -0
- package/src/components/common/SelectableCardList/index.test.tsx +56 -2
- package/src/components/common/SelectableCardList/index.tsx +29 -10
- package/src/components/common/Tooltip/index.test.tsx +85 -0
- package/src/components/common/Tooltip/index.tsx +168 -0
- package/src/components/form/inputs/Select/index.test.tsx +102 -0
- package/src/components/form/inputs/Select/index.tsx +105 -52
- package/src/i18n/namespaces/common/en.json +14 -0
- package/src/i18n/namespaces/common/lt.json +14 -0
- package/src/library/icons.ts +16 -0
- package/src/library/index.ts +5 -0
- package/src/library/types.ts +2 -0
- package/src/setupTests.ts +7 -1
- package/src/stories/components/display/AdvancedList.stories.tsx +529 -0
- package/src/stories/components/display/AdvancedListItem.stories.tsx +653 -0
- package/src/stories/components/display/SelectableCardList.stories.tsx +19 -0
- package/src/stories/components/display/Tooltip.stories.tsx +67 -0
- package/src/stories/components/inputs/DatePicker.stories.tsx +36 -1
- package/src/stories/components/inputs/Select.stories.tsx +38 -2
- package/src/stories/components/overlays/Dialog.stories.tsx +34 -0
- package/src/stories/components/overlays/Popover.stories.tsx +65 -0
- package/src/stories/theme/ThemedMuiComponents.stories.tsx +177 -0
- package/src/theme/light/MuiAutocomplete.ts +3 -1
- package/src/theme/light/MuiInputBase.ts +4 -0
- package/src/theme/light/MuiTooltip.ts +40 -0
- package/src/theme/light/index.tsx +2 -0
- package/src/theme/motion.tsx +10 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Button, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta } from '@storybook/react-vite'
|
|
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
|
|
@@ -28,7 +28,7 @@ const meta: Meta<typeof RcSesDatepicker> = {
|
|
|
28
28
|
export default meta
|
|
29
29
|
|
|
30
30
|
function DatePickerDemo(args: any) {
|
|
31
|
-
const { clearable, label, rules } = args
|
|
31
|
+
const { clearable, label, open, rules } = args
|
|
32
32
|
|
|
33
33
|
const {
|
|
34
34
|
control,
|
|
@@ -52,6 +52,19 @@ function DatePickerDemo(args: any) {
|
|
|
52
52
|
rules={rules}
|
|
53
53
|
label={label}
|
|
54
54
|
errors={errors?.date}
|
|
55
|
+
slotProps={
|
|
56
|
+
open
|
|
57
|
+
? {
|
|
58
|
+
datepicker: {
|
|
59
|
+
open: true,
|
|
60
|
+
// Pinned month: without it the calendar follows the
|
|
61
|
+
// current date and the visual baseline would change
|
|
62
|
+
// every month.
|
|
63
|
+
referenceDate: new Date(2026, 0, 15),
|
|
64
|
+
},
|
|
65
|
+
}
|
|
66
|
+
: undefined
|
|
67
|
+
}
|
|
55
68
|
/>
|
|
56
69
|
</LocalizationProvider>
|
|
57
70
|
</FieldView>
|
|
@@ -97,3 +110,25 @@ export const Main = {
|
|
|
97
110
|
},
|
|
98
111
|
},
|
|
99
112
|
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The calendar popup carries the `MuiPickersLayout` theme overrides, and it only
|
|
116
|
+
* mounts once the picker is opened - so nothing covered them until this story
|
|
117
|
+
* (SAV-5648 / LIB-02).
|
|
118
|
+
*/
|
|
119
|
+
export const CalendarOpen = {
|
|
120
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
121
|
+
args: {
|
|
122
|
+
clearable: true,
|
|
123
|
+
label: 'Terminas',
|
|
124
|
+
open: true,
|
|
125
|
+
rules: { required: true },
|
|
126
|
+
},
|
|
127
|
+
parameters: {
|
|
128
|
+
docs: {
|
|
129
|
+
description: {
|
|
130
|
+
story: 'The picker with its calendar open, pinned to a fixed month.',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
}
|
|
@@ -76,7 +76,7 @@ function SelectDemo(args: any) {
|
|
|
76
76
|
formState: { errors },
|
|
77
77
|
} = useForm<SingleStepFormModel>({ mode: 'all', defaultValues: { selection: '' } })
|
|
78
78
|
|
|
79
|
-
const { label, disabled, slotProps } = args
|
|
79
|
+
const { label, disabled, placeholder, slotProps } = args
|
|
80
80
|
|
|
81
81
|
return (
|
|
82
82
|
<Fields>
|
|
@@ -87,6 +87,7 @@ function SelectDemo(args: any) {
|
|
|
87
87
|
control={control}
|
|
88
88
|
label={label}
|
|
89
89
|
disabled={disabled}
|
|
90
|
+
placeholder={placeholder}
|
|
90
91
|
slotProps={slotProps}
|
|
91
92
|
options={[
|
|
92
93
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -103,6 +104,7 @@ function SelectDemo(args: any) {
|
|
|
103
104
|
control={control}
|
|
104
105
|
rules={{ required: true }}
|
|
105
106
|
label='Active'
|
|
107
|
+
placeholder={placeholder}
|
|
106
108
|
errors={errors?.selection}
|
|
107
109
|
options={[
|
|
108
110
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -116,6 +118,7 @@ function SelectDemo(args: any) {
|
|
|
116
118
|
rules={{ required: true }}
|
|
117
119
|
label='Disabled'
|
|
118
120
|
disabled
|
|
121
|
+
placeholder={placeholder}
|
|
119
122
|
errors={errors?.selection}
|
|
120
123
|
options={[
|
|
121
124
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -128,6 +131,7 @@ function SelectDemo(args: any) {
|
|
|
128
131
|
control={control}
|
|
129
132
|
rules={{ required: true }}
|
|
130
133
|
label='Error'
|
|
134
|
+
placeholder={placeholder}
|
|
131
135
|
errors={{ message: 'Error Message', type: 'required' }}
|
|
132
136
|
options={[
|
|
133
137
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -145,6 +149,7 @@ function SelectDemo(args: any) {
|
|
|
145
149
|
rules={{ required: true }}
|
|
146
150
|
label='Active'
|
|
147
151
|
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
152
|
+
placeholder={placeholder}
|
|
148
153
|
errors={errors?.selection}
|
|
149
154
|
options={[
|
|
150
155
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -159,6 +164,7 @@ function SelectDemo(args: any) {
|
|
|
159
164
|
label='Disabled'
|
|
160
165
|
disabled
|
|
161
166
|
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
167
|
+
placeholder={placeholder}
|
|
162
168
|
errors={errors?.selection}
|
|
163
169
|
options={[
|
|
164
170
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -172,6 +178,7 @@ function SelectDemo(args: any) {
|
|
|
172
178
|
rules={{ required: true }}
|
|
173
179
|
label='Error'
|
|
174
180
|
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
181
|
+
placeholder={placeholder}
|
|
175
182
|
errors={{ message: 'Error', type: 'required' }}
|
|
176
183
|
options={[
|
|
177
184
|
{ value: 'pasirinkimas-1', label: 'Pasirinkimas #1' },
|
|
@@ -184,7 +191,7 @@ function SelectDemo(args: any) {
|
|
|
184
191
|
}
|
|
185
192
|
|
|
186
193
|
const codeBlock = (args: any) => {
|
|
187
|
-
const { label, disabled, slotProps } = args
|
|
194
|
+
const { label, disabled, placeholder, slotProps } = args
|
|
188
195
|
return `
|
|
189
196
|
import RcSesSelect from '@/components/form/inputs/Select'
|
|
190
197
|
|
|
@@ -200,6 +207,7 @@ const codeBlock = (args: any) => {
|
|
|
200
207
|
rules={{ required: true }}
|
|
201
208
|
label="${label}"
|
|
202
209
|
disabled={${disabled}}
|
|
210
|
+
placeholder="${placeholder ?? ''}"
|
|
203
211
|
errors={errors?.selection}
|
|
204
212
|
slotProps=${slotProps.wrapper.labelOnTop ? '{{ wrapper: { labelOnTop: true } }}' : '{{ wrapper: { labelOnTop: false} }}'}
|
|
205
213
|
options={[
|
|
@@ -235,6 +243,7 @@ type VariantsFormModel = {
|
|
|
235
243
|
singleSearchSelect: string | null
|
|
236
244
|
descriptionSelect: string | null
|
|
237
245
|
multiSelect: string[]
|
|
246
|
+
limitedMultiSelect: string[]
|
|
238
247
|
multiSearchSelect: string[]
|
|
239
248
|
phoneInput: string
|
|
240
249
|
}
|
|
@@ -245,6 +254,16 @@ const variantOptions = [
|
|
|
245
254
|
{ value: 'option-3', label: '3rd option' },
|
|
246
255
|
{ value: 'option-4', label: '4th option' },
|
|
247
256
|
{ value: 'option-5', label: '5th option' },
|
|
257
|
+
{
|
|
258
|
+
value: 'long-option-1',
|
|
259
|
+
label:
|
|
260
|
+
'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
value: 'long-option-2',
|
|
264
|
+
label:
|
|
265
|
+
'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.',
|
|
266
|
+
},
|
|
248
267
|
]
|
|
249
268
|
|
|
250
269
|
const groupedVariantOptions: Array<
|
|
@@ -319,6 +338,7 @@ export const AllVariants: Story = {
|
|
|
319
338
|
singleSearchSelect: null,
|
|
320
339
|
descriptionSelect: 'option-3',
|
|
321
340
|
multiSelect: ['option-1', 'option-3'],
|
|
341
|
+
limitedMultiSelect: ['option-1', 'option-2', 'option-3'],
|
|
322
342
|
multiSearchSelect: ['option-1', 'option-3', 'option-4', 'option-5'],
|
|
323
343
|
phoneInput: '',
|
|
324
344
|
},
|
|
@@ -415,6 +435,22 @@ export const AllVariants: Story = {
|
|
|
415
435
|
/>
|
|
416
436
|
</VariantCard>
|
|
417
437
|
|
|
438
|
+
<VariantCard
|
|
439
|
+
title='Multi select + limit tags'
|
|
440
|
+
description='Daugybinis pasirinkimas su limitTags={1}, kai pertekliniai pasirinkimai sutraukiami i +N.'
|
|
441
|
+
>
|
|
442
|
+
<RcSesSelect
|
|
443
|
+
id='limited-multi-select'
|
|
444
|
+
name='limitedMultiSelect'
|
|
445
|
+
control={control}
|
|
446
|
+
label='Pasirinkti'
|
|
447
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
448
|
+
multiple
|
|
449
|
+
limitTags={1}
|
|
450
|
+
options={variantOptions}
|
|
451
|
+
/>
|
|
452
|
+
</VariantCard>
|
|
453
|
+
|
|
418
454
|
<VariantCard
|
|
419
455
|
title='Multi select + search'
|
|
420
456
|
description='Daugybinis pasirinkimas su paieska ir select all.'
|
|
@@ -102,6 +102,40 @@ export function BasicDialog() {
|
|
|
102
102
|
},
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Every other story here starts closed behind a trigger button, so the dialog
|
|
107
|
+
* itself never reached a visual baseline (SAV-5648 / LIB-02). This one renders
|
|
108
|
+
* it open.
|
|
109
|
+
*/
|
|
110
|
+
export const Open: Story = {
|
|
111
|
+
render: (args) => (
|
|
112
|
+
<RcSesDialog
|
|
113
|
+
{...args}
|
|
114
|
+
actions={
|
|
115
|
+
<>
|
|
116
|
+
<RcSesButton color='grey' variant='outlined'>
|
|
117
|
+
Cancel
|
|
118
|
+
</RcSesButton>
|
|
119
|
+
<RcSesButton variant='contained'>Confirm</RcSesButton>
|
|
120
|
+
</>
|
|
121
|
+
}
|
|
122
|
+
open
|
|
123
|
+
>
|
|
124
|
+
<Typography>Are you sure you want to proceed?</Typography>
|
|
125
|
+
</RcSesDialog>
|
|
126
|
+
),
|
|
127
|
+
args: {
|
|
128
|
+
dialogTitle: 'Confirm Action',
|
|
129
|
+
},
|
|
130
|
+
parameters: {
|
|
131
|
+
docs: {
|
|
132
|
+
description: {
|
|
133
|
+
story: 'The dialog in its open state, without a trigger.',
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
}
|
|
138
|
+
|
|
105
139
|
export const SmallDialog: Story = {
|
|
106
140
|
render: (args) => (
|
|
107
141
|
<DialogStory {...args}>
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Box } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
import { ReactNode, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import RcSesPopover from '@/components/common/Popover'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* `RcSesButtonWithPopover` owns the popover's open state internally and starts
|
|
9
|
+
* closed, so `MuiPopover` never reached a visual baseline (SAV-5648 / LIB-02).
|
|
10
|
+
* These stories render the popover itself, already open against a fixed anchor.
|
|
11
|
+
*/
|
|
12
|
+
const meta: Meta<typeof RcSesPopover> = {
|
|
13
|
+
title: 'components/overlays/Popover',
|
|
14
|
+
component: RcSesPopover,
|
|
15
|
+
tags: ['autodocs'],
|
|
16
|
+
argTypes: {
|
|
17
|
+
header: { control: 'text' },
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
type Story = StoryObj<typeof RcSesPopover>
|
|
23
|
+
|
|
24
|
+
function OpenPopover({ children, header }: { children: ReactNode; header?: ReactNode }) {
|
|
25
|
+
// A callback ref rather than an effect: the popover needs a mounted anchor
|
|
26
|
+
// element, and assigning one from an effect trips react-hooks/set-state-in-effect.
|
|
27
|
+
const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box sx={{ pb: '12rem' }}>
|
|
31
|
+
<Box
|
|
32
|
+
ref={setAnchorEl}
|
|
33
|
+
sx={{
|
|
34
|
+
border: '1px dashed',
|
|
35
|
+
borderColor: 'divider',
|
|
36
|
+
borderRadius: 1,
|
|
37
|
+
display: 'inline-block',
|
|
38
|
+
px: 1.5,
|
|
39
|
+
py: 1,
|
|
40
|
+
}}
|
|
41
|
+
>
|
|
42
|
+
Anchor
|
|
43
|
+
</Box>
|
|
44
|
+
|
|
45
|
+
<RcSesPopover anchorEl={anchorEl} header={header} open={Boolean(anchorEl)}>
|
|
46
|
+
{children}
|
|
47
|
+
</RcSesPopover>
|
|
48
|
+
</Box>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const Default: Story = {
|
|
53
|
+
args: {
|
|
54
|
+
header: 'Information',
|
|
55
|
+
children: 'Hover or click the question icon to see this popover content',
|
|
56
|
+
},
|
|
57
|
+
render: (args) => <OpenPopover header={args.header}>{args.children}</OpenPopover>,
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const WithoutHeader: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
children: 'Tinkami formatai: .doc, .xdoc, .pdf, .pages',
|
|
63
|
+
},
|
|
64
|
+
render: (args) => <OpenPopover>{args.children}</OpenPopover>,
|
|
65
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Box,
|
|
3
|
+
Card,
|
|
4
|
+
CardContent,
|
|
5
|
+
CardHeader,
|
|
6
|
+
LinearProgress,
|
|
7
|
+
Stack,
|
|
8
|
+
Table,
|
|
9
|
+
TableBody,
|
|
10
|
+
TableCell,
|
|
11
|
+
TableContainer,
|
|
12
|
+
TableHead,
|
|
13
|
+
TableRow,
|
|
14
|
+
Tooltip,
|
|
15
|
+
Typography,
|
|
16
|
+
} from '@mui/material'
|
|
17
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Coverage stories for theme slots no other story puts on the page
|
|
21
|
+
* (SAV-5648 / LIB-02). `visual/theme-slots.spec.ts` fails if one is missing.
|
|
22
|
+
*
|
|
23
|
+
* Two reasons a slot ends up here:
|
|
24
|
+
*
|
|
25
|
+
* 1. **No `RcSes*` wrapper renders it.** `MuiTable`, `MuiTableCell`,
|
|
26
|
+
* `MuiCardHeader`, `MuiCardContent` and `MuiLinearProgress` ship to consumers
|
|
27
|
+
* and are exercised by nothing - `RcSesCard` builds its own header and
|
|
28
|
+
* content out of Stack/Box rather than MUI's slots.
|
|
29
|
+
* 2. **The wrapper never shows it open.** `MuiTooltip` is styled through
|
|
30
|
+
* `RcSesTooltip`, but that component owns its open state internally and no
|
|
31
|
+
* story can force it, so the popper never reaches a baseline.
|
|
32
|
+
*
|
|
33
|
+
* Either way these render the plain MUI component under the theme, so a broken
|
|
34
|
+
* or silently dead override surfaces as a pixel diff.
|
|
35
|
+
*/
|
|
36
|
+
const meta: Meta = {
|
|
37
|
+
title: 'theme/Themed MUI components',
|
|
38
|
+
parameters: {
|
|
39
|
+
docs: {
|
|
40
|
+
description: {
|
|
41
|
+
component:
|
|
42
|
+
'Plain MUI components the theme styles that no other story renders - either because this library does not wrap them, or because the wrapper never shows them open. They exist so the visual baselines cover every slot in `src/theme/light/`.',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default meta
|
|
49
|
+
type Story = StoryObj
|
|
50
|
+
|
|
51
|
+
const objects = [
|
|
52
|
+
{
|
|
53
|
+
address: 'Vilniaus g. 1, Vilnius',
|
|
54
|
+
regNo: '10/123456',
|
|
55
|
+
type: 'Butas',
|
|
56
|
+
uniqueIdentifier: '4400-1234-5678',
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
address: 'Kauno g. 12-3, Kaunas',
|
|
60
|
+
regNo: '20/654321',
|
|
61
|
+
type: 'Gyvenamasis namas',
|
|
62
|
+
uniqueIdentifier: '4400-8765-4321',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
address: 'Klaipėdos g. 7, Klaipėda',
|
|
66
|
+
regNo: '30/112233',
|
|
67
|
+
type: 'Žemės sklypas',
|
|
68
|
+
uniqueIdentifier: '4400-1122-3344',
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
export const TableSlots: Story = {
|
|
73
|
+
name: 'Table',
|
|
74
|
+
render: () => (
|
|
75
|
+
<TableContainer sx={{ maxWidth: 760 }}>
|
|
76
|
+
<Table>
|
|
77
|
+
<TableHead>
|
|
78
|
+
<TableRow>
|
|
79
|
+
<TableCell>Reg. Nr.</TableCell>
|
|
80
|
+
<TableCell>Daiktas</TableCell>
|
|
81
|
+
<TableCell>Unikalus Nr.</TableCell>
|
|
82
|
+
<TableCell>Adresas</TableCell>
|
|
83
|
+
</TableRow>
|
|
84
|
+
</TableHead>
|
|
85
|
+
<TableBody>
|
|
86
|
+
{objects.map((object) => (
|
|
87
|
+
<TableRow key={object.regNo}>
|
|
88
|
+
<TableCell component='th' scope='row'>
|
|
89
|
+
{object.regNo}
|
|
90
|
+
</TableCell>
|
|
91
|
+
<TableCell>{object.type}</TableCell>
|
|
92
|
+
<TableCell>{object.uniqueIdentifier}</TableCell>
|
|
93
|
+
<TableCell>{object.address}</TableCell>
|
|
94
|
+
</TableRow>
|
|
95
|
+
))}
|
|
96
|
+
</TableBody>
|
|
97
|
+
</Table>
|
|
98
|
+
</TableContainer>
|
|
99
|
+
),
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export const CardSlots: Story = {
|
|
103
|
+
name: 'Card',
|
|
104
|
+
// MuiCardContent's override carries `.side` and `.full` padding variants on
|
|
105
|
+
// top of its default, so all three are rendered - a variant that stops
|
|
106
|
+
// matching is invisible unless something uses it.
|
|
107
|
+
render: () => (
|
|
108
|
+
<Stack direction='row' spacing={2} sx={{ alignItems: 'flex-start' }}>
|
|
109
|
+
<Card sx={{ width: 240 }}>
|
|
110
|
+
<CardHeader title='Numatytasis' subheader='MuiCardContent-root' />
|
|
111
|
+
<CardContent>
|
|
112
|
+
<Typography variant='body2'>padding: 1.25rem 1.5rem</Typography>
|
|
113
|
+
</CardContent>
|
|
114
|
+
</Card>
|
|
115
|
+
|
|
116
|
+
<Card sx={{ width: 240 }}>
|
|
117
|
+
<CardHeader title='Šoninis' subheader='.side' />
|
|
118
|
+
<CardContent className='side'>
|
|
119
|
+
<Typography variant='body2'>padding: 1.25rem</Typography>
|
|
120
|
+
</CardContent>
|
|
121
|
+
</Card>
|
|
122
|
+
|
|
123
|
+
<Card sx={{ width: 240 }}>
|
|
124
|
+
<CardHeader title='Pilnas' subheader='.full' />
|
|
125
|
+
<CardContent className='full'>
|
|
126
|
+
<Typography variant='body2'>padding: 1.5rem</Typography>
|
|
127
|
+
</CardContent>
|
|
128
|
+
</Card>
|
|
129
|
+
</Stack>
|
|
130
|
+
),
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export const LinearProgressSlots: Story = {
|
|
134
|
+
name: 'LinearProgress',
|
|
135
|
+
// Both variants matter: the override hides the `bar1` slot only while the
|
|
136
|
+
// root carries the indeterminate class, which is the v9 replacement for the
|
|
137
|
+
// removed `bar1Indeterminate` key.
|
|
138
|
+
render: () => (
|
|
139
|
+
<Stack spacing={3} sx={{ width: 360 }}>
|
|
140
|
+
<Stack spacing={1}>
|
|
141
|
+
<Typography variant='body2'>determinate (40 %)</Typography>
|
|
142
|
+
<LinearProgress aria-label='determinate' value={40} variant='determinate' />
|
|
143
|
+
</Stack>
|
|
144
|
+
|
|
145
|
+
<Stack spacing={1}>
|
|
146
|
+
<Typography variant='body2'>indeterminate</Typography>
|
|
147
|
+
<LinearProgress aria-label='indeterminate' />
|
|
148
|
+
</Stack>
|
|
149
|
+
</Stack>
|
|
150
|
+
),
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const TooltipSlots: Story = {
|
|
154
|
+
name: 'Tooltip',
|
|
155
|
+
// `arrow` and the bottom placement are both deliberate: the override styles
|
|
156
|
+
// the `arrow` slot separately, and shifts the tooltip via a
|
|
157
|
+
// [data-popper-placement*="bottom"] selector that only applies below.
|
|
158
|
+
render: () => (
|
|
159
|
+
<Stack
|
|
160
|
+
direction='row'
|
|
161
|
+
spacing={8}
|
|
162
|
+
sx={{ alignItems: 'center', justifyContent: 'center', py: '6rem' }}
|
|
163
|
+
>
|
|
164
|
+
<Tooltip arrow open placement='top' title='Paaiškinimas viršuje'>
|
|
165
|
+
<Box component='span' sx={{ border: '1px dashed', borderColor: 'divider', p: 1 }}>
|
|
166
|
+
top
|
|
167
|
+
</Box>
|
|
168
|
+
</Tooltip>
|
|
169
|
+
|
|
170
|
+
<Tooltip arrow open placement='bottom' title='Paaiškinimas apačioje'>
|
|
171
|
+
<Box component='span' sx={{ border: '1px dashed', borderColor: 'divider', p: 1 }}>
|
|
172
|
+
bottom
|
|
173
|
+
</Box>
|
|
174
|
+
</Tooltip>
|
|
175
|
+
</Stack>
|
|
176
|
+
),
|
|
177
|
+
}
|
|
@@ -82,15 +82,17 @@ const MuiAutocomplete: Components['MuiAutocomplete'] = {
|
|
|
82
82
|
|
|
83
83
|
'.rc-ses-select-option-label': {
|
|
84
84
|
display: 'block',
|
|
85
|
+
overflowWrap: 'anywhere',
|
|
85
86
|
},
|
|
86
87
|
'.rc-ses-select-option-description': {
|
|
87
88
|
color: palette.grey['600'],
|
|
88
89
|
display: 'block',
|
|
89
90
|
fontSize: '.75rem',
|
|
90
91
|
fontStyle: 'italic',
|
|
92
|
+
fontWeight: 500,
|
|
91
93
|
lineHeight: '1rem',
|
|
92
94
|
marginTop: '.25rem',
|
|
93
|
-
|
|
95
|
+
overflowWrap: 'anywhere',
|
|
94
96
|
},
|
|
95
97
|
},
|
|
96
98
|
},
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Components } from '@mui/material'
|
|
2
|
+
|
|
3
|
+
import palette, { common } from '../palette'
|
|
4
|
+
|
|
5
|
+
const MuiTooltip: Components['MuiTooltip'] = {
|
|
6
|
+
styleOverrides: {
|
|
7
|
+
tooltip: {
|
|
8
|
+
backgroundColor: common.white,
|
|
9
|
+
color: palette.grey['900'],
|
|
10
|
+
maxWidth: 480,
|
|
11
|
+
padding: '12px 16px',
|
|
12
|
+
fontSize: '.875rem',
|
|
13
|
+
fontWeight: 400,
|
|
14
|
+
lineHeight: 1.5,
|
|
15
|
+
borderRadius: '8px',
|
|
16
|
+
boxShadow: 'none',
|
|
17
|
+
filter: 'drop-shadow(0 6px 24px rgba(0, 0, 0, 0.16))',
|
|
18
|
+
|
|
19
|
+
'@keyframes rcses-tooltip': {
|
|
20
|
+
from: { transform: 'translate3d(0, var(--rcses-tooltip-shift, 6px), 0)' },
|
|
21
|
+
to: { transform: 'none' },
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
'@media (prefers-reduced-motion: no-preference)': {
|
|
25
|
+
animation: 'rcses-tooltip 160ms ease-out',
|
|
26
|
+
},
|
|
27
|
+
|
|
28
|
+
'[data-popper-placement*="bottom"] &': {
|
|
29
|
+
'--rcses-tooltip-shift': '-6px',
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
arrow: {
|
|
34
|
+
color: common.white,
|
|
35
|
+
fontSize: '1rem',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default MuiTooltip
|
|
@@ -39,6 +39,7 @@ import MuiTable from '@/theme/light/MuiTable'
|
|
|
39
39
|
import MuiTableCell from '@/theme/light/MuiTableCell'
|
|
40
40
|
import MuiTabs from '@/theme/light/MuiTabs'
|
|
41
41
|
import MuiTextField from '@/theme/light/MuiTextField'
|
|
42
|
+
import MuiTooltip from '@/theme/light/MuiTooltip'
|
|
42
43
|
import MuiTypography from '@/theme/light/MuiTypography'
|
|
43
44
|
import themePalette from '@/theme/light/themePalette'
|
|
44
45
|
|
|
@@ -131,6 +132,7 @@ const theme = createTheme(themePalette, ltLT, enUS, {
|
|
|
131
132
|
MuiTable,
|
|
132
133
|
MuiTableCell,
|
|
133
134
|
MuiTextField,
|
|
135
|
+
MuiTooltip,
|
|
134
136
|
MuiTypography,
|
|
135
137
|
},
|
|
136
138
|
})
|