@registrucentras/rc-ses-react-components 2.0.0 → 2.2.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/README.md +4 -0
- package/dist/assets/icons/ShoppingCartIcon.d.ts +3 -0
- package/dist/components/common/CardShell/index.d.ts +1 -1
- package/dist/components/common/CardShell/types.d.ts +10 -0
- package/dist/components/common/ListWithIcons/ListWithIcons.types.d.ts +4 -1
- package/dist/components/common/StepCard/StepCardFooter/index.d.ts +34 -0
- package/dist/components/common/StepCard/index.d.ts +3 -0
- package/dist/components/common/StepCard/types.d.ts +39 -0
- package/dist/components/common/TitleBlock/types.d.ts +1 -1
- package/dist/components/form/inputs/Select/Select.utils.d.ts +9 -0
- package/dist/components/form/inputs/Select/components/OptionCheckbox.d.ts +5 -0
- package/dist/components/form/inputs/Select/index.d.ts +18 -8
- package/dist/components/layout/ServiceFormContainer/CardFormContainer/index.d.ts +3 -0
- package/dist/components/loaders/LoadingSpinner/index.d.ts +1 -4
- package/dist/components/overlays/BottomSheet/index.d.ts +17 -0
- package/dist/components/overlays/BottomSheet/useSwipeToDismiss.d.ts +17 -0
- package/dist/library/icons.d.ts +2 -1
- package/dist/library/index.d.ts +3 -1
- package/dist/library/types.d.ts +6 -3
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +3903 -3289
- package/dist/theme/cards.d.ts +12 -12
- package/dist/theme/light/MuiTypography.d.ts +14 -0
- package/dist/theme/palette.d.ts +124 -124
- package/dist/theme/spacing.d.ts +4 -0
- package/package.json +2 -1
- package/src/assets/icons/ShoppingCartIcon.tsx +16 -0
- package/src/components/common/Button/index.test.tsx +20 -11
- package/src/components/common/Button/index.tsx +8 -44
- package/src/components/common/CardShell/index.tsx +6 -2
- package/src/components/common/CardShell/types.ts +10 -0
- package/src/components/common/ListWithIcons/ListWithIcons.types.ts +22 -1
- package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +13 -4
- package/src/components/common/ListWithIcons/index.test.tsx +42 -0
- package/src/components/common/StepCard/StepCardFooter/index.test.tsx +162 -0
- package/src/components/common/StepCard/StepCardFooter/index.tsx +120 -0
- package/src/components/common/StepCard/index.test.tsx +120 -0
- package/src/components/common/StepCard/index.tsx +74 -0
- package/src/components/common/StepCard/types.ts +45 -0
- package/src/components/common/TitleBlock/types.ts +1 -1
- package/src/components/form/inputs/SearchableField.test.tsx +1 -1
- package/src/components/form/inputs/Select/Select.utils.ts +24 -0
- package/src/components/form/inputs/Select/components/OptionCheckbox.tsx +46 -0
- package/src/components/form/inputs/Select/index.test.tsx +127 -0
- package/src/components/form/inputs/Select/index.tsx +426 -181
- package/src/components/layout/ServiceFormContainer/CardFormContainer/index.tsx +3 -0
- package/src/components/loaders/LoadingSpinner/index.tsx +3 -26
- package/src/components/overlays/BottomSheet/index.test.tsx +256 -0
- package/src/components/overlays/BottomSheet/index.tsx +242 -0
- package/src/components/overlays/BottomSheet/useSwipeToDismiss.test.ts +295 -0
- package/src/components/overlays/BottomSheet/useSwipeToDismiss.ts +138 -0
- package/src/examples/ListWithPagination/index.tsx +2 -1
- package/src/i18n/namespaces/common/en.json +7 -0
- package/src/i18n/namespaces/common/lt.json +7 -0
- package/src/i18n/namespaces/input/en.json +11 -0
- package/src/i18n/namespaces/input/lt.json +11 -0
- package/src/library/icons.ts +2 -0
- package/src/library/index.ts +4 -0
- package/src/library/types.ts +19 -2
- package/src/stories/atoms/Button.stories.tsx +202 -497
- package/src/stories/atoms/Select.stories.tsx +33 -5
- package/src/stories/foundations/ThemedMuiComponents.stories.tsx +2 -2
- package/src/stories/molecules/CardShell.stories.tsx +36 -2
- package/src/stories/molecules/DatePicker.stories.tsx +1 -2
- package/src/stories/molecules/ListWithIcons.stories.tsx +26 -0
- package/src/stories/molecules/Popover.stories.tsx +1 -1
- package/src/stories/molecules/StepCard.stories.tsx +181 -0
- package/src/stories/molecules/TitleBlock.stories.tsx +2 -2
- package/src/stories/organisms/AdvancedListItem.stories.tsx +80 -0
- package/src/stories/organisms/BottomSheet.stories.tsx +291 -0
- package/src/stories/organisms/CardFormContainer.stories.tsx +1 -1
- package/src/stories/organisms/Dialog.stories.tsx +1 -2
- package/src/theme/light/MuiAutocomplete.ts +43 -19
- package/src/theme/light/MuiButton.tsx +54 -0
- package/src/theme/light/MuiCard.tsx +9 -7
- package/src/theme/light/MuiTypography.tsx +17 -0
- package/src/theme/palette.tsx +7 -7
- package/src/theme/spacing.ts +5 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import {
|
|
2
|
+
List,
|
|
3
|
+
ListItemButton,
|
|
4
|
+
ListItemText,
|
|
5
|
+
Typography,
|
|
6
|
+
useMediaQuery,
|
|
7
|
+
} from '@mui/material'
|
|
8
|
+
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
9
|
+
import { useState } from 'react'
|
|
10
|
+
|
|
11
|
+
import RcSesButton from '@/components/common/Button'
|
|
12
|
+
import RcSesBottomSheet, {
|
|
13
|
+
RcSesBottomSheetProps,
|
|
14
|
+
} from '@/components/overlays/BottomSheet'
|
|
15
|
+
|
|
16
|
+
const meta: Meta<typeof RcSesBottomSheet> = {
|
|
17
|
+
component: RcSesBottomSheet,
|
|
18
|
+
title: 'Organisms/BottomSheet',
|
|
19
|
+
parameters: {
|
|
20
|
+
layout: 'centered',
|
|
21
|
+
docs: {
|
|
22
|
+
description: {
|
|
23
|
+
component:
|
|
24
|
+
'A standalone sheet-as-modal, unrelated to RcSesDialog/RcSesModal: optional title, ' +
|
|
25
|
+
'a free-form content slot, and up to two labeled action buttons. There is no desktop ' +
|
|
26
|
+
'presentation - "inherits the Modal contract" only means scrim + focus trap + Esc ' +
|
|
27
|
+
'while the sheet is open. See the Composition story for how a consumer decides when ' +
|
|
28
|
+
'to show it versus rendering the same content inline.',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
viewport: {
|
|
32
|
+
options: {
|
|
33
|
+
mobile375: { name: 'Mobile 375', styles: { height: '900px', width: '375px' } },
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
tags: ['autodocs', 'no-snapshot'],
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default meta
|
|
41
|
+
type Story = StoryObj<typeof RcSesBottomSheet>
|
|
42
|
+
|
|
43
|
+
const BRANCHES = [
|
|
44
|
+
'Vilniaus padalinys',
|
|
45
|
+
'Kauno padalinys',
|
|
46
|
+
'Klaipėdos padalinys',
|
|
47
|
+
'Šiaulių padalinys',
|
|
48
|
+
'Panevėžio padalinys',
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
function BranchList({
|
|
52
|
+
branches,
|
|
53
|
+
onSelect,
|
|
54
|
+
}: {
|
|
55
|
+
branches: string[]
|
|
56
|
+
onSelect: (branch: string) => void
|
|
57
|
+
}) {
|
|
58
|
+
return (
|
|
59
|
+
<List disablePadding>
|
|
60
|
+
{branches.map((branch, index) => (
|
|
61
|
+
// Demo data has no stable id and can repeat when the list is padded for the scroll story.
|
|
62
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
63
|
+
<ListItemButton key={`${branch}-${index}`} onClick={() => onSelect(branch)}>
|
|
64
|
+
<ListItemText primary={branch} />
|
|
65
|
+
</ListItemButton>
|
|
66
|
+
))}
|
|
67
|
+
</List>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function BottomSheetDemo(
|
|
72
|
+
args: Partial<RcSesBottomSheetProps> & { longContent?: boolean },
|
|
73
|
+
) {
|
|
74
|
+
const { longContent, ...sheetArgs } = args
|
|
75
|
+
const [open, setOpen] = useState(false)
|
|
76
|
+
const branches = longContent ? [...BRANCHES, ...BRANCHES, ...BRANCHES] : BRANCHES
|
|
77
|
+
|
|
78
|
+
return (
|
|
79
|
+
<>
|
|
80
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
81
|
+
Pasirinkti padalinį
|
|
82
|
+
</RcSesButton>
|
|
83
|
+
<RcSesBottomSheet
|
|
84
|
+
title='Pasirinkite padalinį'
|
|
85
|
+
{...sheetArgs}
|
|
86
|
+
open={open}
|
|
87
|
+
onClose={() => setOpen(false)}
|
|
88
|
+
>
|
|
89
|
+
<BranchList branches={branches} onSelect={() => setOpen(false)} />
|
|
90
|
+
</RcSesBottomSheet>
|
|
91
|
+
</>
|
|
92
|
+
)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export const Default: Story = {
|
|
96
|
+
render: (args) => <BottomSheetDemo {...args} />,
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export const WithActions: Story = {
|
|
100
|
+
render: (args) => <BottomSheetDemo {...args} />,
|
|
101
|
+
args: {
|
|
102
|
+
primaryActionLabel: 'Taikyti',
|
|
103
|
+
secondaryActionLabel: 'Atšaukti',
|
|
104
|
+
},
|
|
105
|
+
parameters: {
|
|
106
|
+
docs: {
|
|
107
|
+
description: {
|
|
108
|
+
story:
|
|
109
|
+
'Up to two labeled buttons - both optional, and independent of each other.',
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const WithoutTitle: Story = {
|
|
116
|
+
render: (args) => <BottomSheetDemo {...args} title={undefined} />,
|
|
117
|
+
parameters: {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story:
|
|
121
|
+
'The header itself is optional: with no `title` and no `showBack`, only the handle and content render.',
|
|
122
|
+
},
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const MediumWidth: Story = {
|
|
128
|
+
render: (args) => <BottomSheetDemo {...args} />,
|
|
129
|
+
args: {
|
|
130
|
+
size: 'md',
|
|
131
|
+
},
|
|
132
|
+
parameters: {
|
|
133
|
+
docs: {
|
|
134
|
+
description: {
|
|
135
|
+
story:
|
|
136
|
+
'`size="md"` caps and centers the sheet width instead of the `sm` full-bleed ' +
|
|
137
|
+
'default - the consumer picks this based on where the sheet is used, the component ' +
|
|
138
|
+
'never infers it from the viewport.',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export const ScrollableContent: Story = {
|
|
145
|
+
render: (args) => <BottomSheetDemo {...args} longContent />,
|
|
146
|
+
parameters: {
|
|
147
|
+
docs: {
|
|
148
|
+
description: {
|
|
149
|
+
story:
|
|
150
|
+
'A long list scrolls inside the content slot; the handle, header and footer stay put.',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export const WithoutBackdropClose: Story = {
|
|
157
|
+
render: (args) => <BottomSheetDemo {...args} />,
|
|
158
|
+
args: {
|
|
159
|
+
disableBackdropClose: true,
|
|
160
|
+
},
|
|
161
|
+
parameters: {
|
|
162
|
+
docs: {
|
|
163
|
+
description: {
|
|
164
|
+
story:
|
|
165
|
+
'Tapping the backdrop no longer closes the sheet. Esc and the drag handle still do.',
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function WithBackDemo() {
|
|
172
|
+
const [open, setOpen] = useState(false)
|
|
173
|
+
const [selectedBranch, setSelectedBranch] = useState<string | null>(null)
|
|
174
|
+
|
|
175
|
+
const handleClose = () => {
|
|
176
|
+
setOpen(false)
|
|
177
|
+
setSelectedBranch(null)
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return (
|
|
181
|
+
<>
|
|
182
|
+
<RcSesButton onClick={() => setOpen(true)} variant='contained'>
|
|
183
|
+
Pasirinkti padalinį
|
|
184
|
+
</RcSesButton>
|
|
185
|
+
<RcSesBottomSheet
|
|
186
|
+
open={open}
|
|
187
|
+
onClose={handleClose}
|
|
188
|
+
title={selectedBranch || 'Pasirinkite padalinį'}
|
|
189
|
+
showBack={!!selectedBranch}
|
|
190
|
+
onBack={() => setSelectedBranch(null)}
|
|
191
|
+
>
|
|
192
|
+
{selectedBranch ? (
|
|
193
|
+
<Typography variant='body1'>Adresas, darbo laikas ir kontaktai.</Typography>
|
|
194
|
+
) : (
|
|
195
|
+
<BranchList branches={BRANCHES} onSelect={setSelectedBranch} />
|
|
196
|
+
)}
|
|
197
|
+
</RcSesBottomSheet>
|
|
198
|
+
</>
|
|
199
|
+
)
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export const WithBack: Story = {
|
|
203
|
+
render: () => <WithBackDemo />,
|
|
204
|
+
parameters: {
|
|
205
|
+
docs: {
|
|
206
|
+
description: {
|
|
207
|
+
story:
|
|
208
|
+
'`showBack` is for a multi-step sheet: selecting a branch drills into a detail step, ' +
|
|
209
|
+
'and "Atgal" returns to the list without closing the sheet.',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function CompositionDemo() {
|
|
216
|
+
const isMobile = useMediaQuery('(max-width:599.95px)')
|
|
217
|
+
const [open, setOpen] = useState(false)
|
|
218
|
+
const [selectedBranch, setSelectedBranch] = useState<string | null>(null)
|
|
219
|
+
|
|
220
|
+
if (!isMobile) {
|
|
221
|
+
return (
|
|
222
|
+
<List disablePadding sx={{ width: 360 }}>
|
|
223
|
+
{BRANCHES.map((branch) => (
|
|
224
|
+
<ListItemButton
|
|
225
|
+
key={branch}
|
|
226
|
+
selected={branch === selectedBranch}
|
|
227
|
+
onClick={() => setSelectedBranch(branch)}
|
|
228
|
+
>
|
|
229
|
+
<ListItemText primary={branch} />
|
|
230
|
+
</ListItemButton>
|
|
231
|
+
))}
|
|
232
|
+
</List>
|
|
233
|
+
)
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<>
|
|
238
|
+
<RcSesButton onClick={() => setOpen(true)} variant='outlined'>
|
|
239
|
+
{selectedBranch ?? 'Pasirinkti padalinį'}
|
|
240
|
+
</RcSesButton>
|
|
241
|
+
<RcSesBottomSheet
|
|
242
|
+
open={open}
|
|
243
|
+
onClose={() => setOpen(false)}
|
|
244
|
+
title='Pasirinkite padalinį'
|
|
245
|
+
>
|
|
246
|
+
<BranchList
|
|
247
|
+
branches={BRANCHES}
|
|
248
|
+
onSelect={(branch) => {
|
|
249
|
+
setSelectedBranch(branch)
|
|
250
|
+
setOpen(false)
|
|
251
|
+
}}
|
|
252
|
+
/>
|
|
253
|
+
</RcSesBottomSheet>
|
|
254
|
+
</>
|
|
255
|
+
)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export const Composition: Story = {
|
|
259
|
+
render: () => <CompositionDemo />,
|
|
260
|
+
tags: ['!no-snapshot'],
|
|
261
|
+
parameters: {
|
|
262
|
+
docs: {
|
|
263
|
+
description: {
|
|
264
|
+
story:
|
|
265
|
+
'How a consumer composes this: desktop renders the branch list inline (no overlay ' +
|
|
266
|
+
'at all); resize below 600px and the same picker becomes a "Pasirinkti padalinį" ' +
|
|
267
|
+
'trigger that opens the sheet. There is no desktop version of the sheet itself - the ' +
|
|
268
|
+
'switch happens at the page-composition level, not inside the component.',
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// The stories above all start closed, so their baselines only capture the
|
|
275
|
+
// trigger. This one renders the sheet open at 375 so the visual suite has a
|
|
276
|
+
// reference for the sheet itself.
|
|
277
|
+
export const OpenMobileViewport: Story = {
|
|
278
|
+
render: () => (
|
|
279
|
+
<RcSesBottomSheet
|
|
280
|
+
open
|
|
281
|
+
onClose={() => undefined}
|
|
282
|
+
title='Pasirinkite padalinį'
|
|
283
|
+
primaryActionLabel='Taikyti'
|
|
284
|
+
secondaryActionLabel='Atšaukti'
|
|
285
|
+
>
|
|
286
|
+
<BranchList branches={BRANCHES} onSelect={() => undefined} />
|
|
287
|
+
</RcSesBottomSheet>
|
|
288
|
+
),
|
|
289
|
+
tags: ['viewport-375', '!autodocs', '!no-snapshot'],
|
|
290
|
+
globals: { viewport: { value: 'mobile375' } },
|
|
291
|
+
}
|
|
@@ -24,7 +24,7 @@ const longSteps: StepItem[] = [
|
|
|
24
24
|
const meta: Meta<typeof RcSesCardFormContainer> = {
|
|
25
25
|
title: 'Organisms/CardFormContainer',
|
|
26
26
|
component: RcSesCardFormContainer,
|
|
27
|
-
tags: ['autodocs'],
|
|
27
|
+
tags: ['autodocs', 'deprecated'],
|
|
28
28
|
argTypes: {
|
|
29
29
|
steps: { table: { disable: true } },
|
|
30
30
|
onStepClick: { table: { disable: true } },
|
|
@@ -104,8 +104,7 @@ export function BasicDialog() {
|
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* Every other story here starts closed behind a trigger button, so the dialog
|
|
107
|
-
* itself never reached a visual baseline
|
|
108
|
-
* it open.
|
|
107
|
+
* itself never reached a visual baseline. This one renders it open.
|
|
109
108
|
*/
|
|
110
109
|
export const Open: Story = {
|
|
111
110
|
render: (args) => (
|
|
@@ -29,59 +29,83 @@ const MuiAutocomplete: Components['MuiAutocomplete'] = {
|
|
|
29
29
|
},
|
|
30
30
|
paper: {
|
|
31
31
|
backgroundColor: 'white',
|
|
32
|
-
|
|
32
|
+
border: `1px solid ${palette.grey['200']}`,
|
|
33
|
+
borderRadius: '.75rem',
|
|
34
|
+
boxShadow: '0px 4px 16px 0px rgba(0, 0, 0, 0.08)',
|
|
33
35
|
fontSize: '.9375rem',
|
|
34
|
-
lineHeight: '1.
|
|
36
|
+
lineHeight: '1.375rem',
|
|
35
37
|
|
|
36
38
|
'.MuiAutocomplete-listbox': {
|
|
37
39
|
'.MuiAutocomplete-groupLabel': {
|
|
38
|
-
color: palette.
|
|
40
|
+
color: palette.grey['900'],
|
|
39
41
|
fontFamily: '"Public Sans", sans-serif',
|
|
40
|
-
fontSize: '.
|
|
42
|
+
fontSize: '.875rem',
|
|
41
43
|
fontStyle: 'normal',
|
|
42
|
-
fontWeight:
|
|
43
|
-
letterSpacing: '
|
|
44
|
-
lineHeight: '
|
|
45
|
-
padding: '.
|
|
46
|
-
textTransform: '
|
|
44
|
+
fontWeight: 600,
|
|
45
|
+
letterSpacing: 'normal',
|
|
46
|
+
lineHeight: '1.25rem',
|
|
47
|
+
padding: '.75rem 1rem',
|
|
48
|
+
textTransform: 'none',
|
|
47
49
|
},
|
|
48
50
|
|
|
49
51
|
'.MuiAutocomplete-option': {
|
|
50
|
-
alignItems: '
|
|
52
|
+
alignItems: 'center',
|
|
51
53
|
backgroundColor: 'transparent',
|
|
52
|
-
borderRadius:
|
|
54
|
+
borderRadius: 0,
|
|
53
55
|
color: palette.grey['900'],
|
|
54
56
|
flexDirection: 'column',
|
|
55
|
-
margin:
|
|
56
|
-
|
|
57
|
+
margin: 0,
|
|
58
|
+
minHeight: '3rem',
|
|
59
|
+
padding: '.75rem 1rem',
|
|
57
60
|
transition: 'background-color 150ms cubic-bezier(0.4, 0, 0.2, 1)',
|
|
58
61
|
|
|
59
62
|
'&:hover': {
|
|
60
63
|
backgroundColor: palette.grey['100'],
|
|
61
64
|
},
|
|
62
65
|
|
|
63
|
-
'&.Mui-focused': {
|
|
64
|
-
backgroundColor:
|
|
66
|
+
'&.Mui-focused:not(:hover)': {
|
|
67
|
+
backgroundColor: 'transparent',
|
|
68
|
+
boxShadow: `inset 0 0 0 2px ${palette.primary.main}`,
|
|
65
69
|
},
|
|
66
70
|
|
|
67
71
|
'&.Mui-selected': {
|
|
68
|
-
backgroundColor: '
|
|
72
|
+
backgroundColor: palette.primary['50'],
|
|
69
73
|
|
|
70
74
|
'&:hover, &.Mui-focused': {
|
|
71
|
-
backgroundColor: palette.
|
|
75
|
+
backgroundColor: palette.primary['50'],
|
|
72
76
|
},
|
|
73
77
|
},
|
|
74
78
|
|
|
75
79
|
'&[aria-selected="true"]': {
|
|
76
|
-
backgroundColor: '
|
|
80
|
+
backgroundColor: palette.primary['50'],
|
|
77
81
|
},
|
|
78
82
|
|
|
79
83
|
'&[aria-selected="true"].Mui-focused, &[aria-selected="true"]:hover': {
|
|
80
|
-
backgroundColor: palette.
|
|
84
|
+
backgroundColor: palette.primary['50'],
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
'&.Mui-disabled': {
|
|
88
|
+
color: palette.grey['500'],
|
|
89
|
+
opacity: 1,
|
|
90
|
+
},
|
|
91
|
+
|
|
92
|
+
'&.rc-ses-select-option--indent-single': {
|
|
93
|
+
paddingLeft: '2.5rem',
|
|
94
|
+
},
|
|
95
|
+
'&.rc-ses-select-option--indent-multi': {
|
|
96
|
+
paddingLeft: '2rem',
|
|
97
|
+
},
|
|
98
|
+
|
|
99
|
+
'&.Mui-selected .rc-ses-select-option-label': {
|
|
100
|
+
color: palette.primary['700'],
|
|
81
101
|
},
|
|
82
102
|
|
|
83
103
|
'.rc-ses-select-option-label': {
|
|
84
104
|
display: 'block',
|
|
105
|
+
fontFamily: '"Public Sans", sans-serif',
|
|
106
|
+
fontSize: '.9375rem',
|
|
107
|
+
fontWeight: 400,
|
|
108
|
+
lineHeight: '1.375rem',
|
|
85
109
|
overflowWrap: 'anywhere',
|
|
86
110
|
},
|
|
87
111
|
'.rc-ses-select-option-description': {
|
|
@@ -94,6 +94,20 @@ const MuiButton: Components['MuiButton'] = {
|
|
|
94
94
|
'.MuiButton-endIcon': {
|
|
95
95
|
marginLeft: '.25rem',
|
|
96
96
|
},
|
|
97
|
+
|
|
98
|
+
// MUI absolutely positions the start/end loading indicator at
|
|
99
|
+
// `left/right: 14px` to sit inside the root's default horizontal
|
|
100
|
+
// padding. Link variant has zero horizontal padding, so 14px lands
|
|
101
|
+
// on top of the label. Reserve room on the loading side and pin the
|
|
102
|
+
// indicator to the edge so spinner and label sit side by side.
|
|
103
|
+
'&.MuiButton-loadingPositionStart.MuiButton-loading': {
|
|
104
|
+
paddingLeft: '1.5rem',
|
|
105
|
+
'.MuiButton-loadingIndicatorStart': { left: 0 },
|
|
106
|
+
},
|
|
107
|
+
'&.MuiButton-loadingPositionEnd.MuiButton-loading': {
|
|
108
|
+
paddingRight: '1.5rem',
|
|
109
|
+
'.MuiButton-loadingIndicatorEnd': { right: 0 },
|
|
110
|
+
},
|
|
97
111
|
},
|
|
98
112
|
},
|
|
99
113
|
{
|
|
@@ -147,6 +161,22 @@ const MuiButton: Components['MuiButton'] = {
|
|
|
147
161
|
position: 'relative',
|
|
148
162
|
textTransform: 'none',
|
|
149
163
|
|
|
164
|
+
// MUI hard-codes the centered loading indicator to
|
|
165
|
+
// `palette.action.disabled` (rgba(0,0,0,0.26)) which fails WCAG 1.4.11
|
|
166
|
+
// on every light-surface variant (~1.85:1). Override to grey[600] here —
|
|
167
|
+
// (0,3,0) specificity beats MUI's single-class rule, while the more
|
|
168
|
+
// specific colorLight / colorGhost blocks below still win on dark
|
|
169
|
+
// surfaces. The `.Mui-disabled` half is dropped: `loadingPositionCenter`
|
|
170
|
+
// is only applied while `loading` is truthy.
|
|
171
|
+
'&.MuiButton-loadingPositionCenter.MuiButton-loading': {
|
|
172
|
+
color: 'transparent !important',
|
|
173
|
+
'& .MuiButton-startIcon, & .MuiButton-endIcon': {
|
|
174
|
+
visibility: 'hidden',
|
|
175
|
+
},
|
|
176
|
+
'& .MuiButton-loadingIndicator': {
|
|
177
|
+
color: grey[600],
|
|
178
|
+
},
|
|
179
|
+
},
|
|
150
180
|
'&.MuiButton-contained:focus-visible:not(:active)::before, &.MuiButton-outlined:focus-visible:not(:active)::before':
|
|
151
181
|
{
|
|
152
182
|
background: 'transparent',
|
|
@@ -378,6 +408,14 @@ const MuiButton: Components['MuiButton'] = {
|
|
|
378
408
|
'&.Mui-disabled': {
|
|
379
409
|
borderColor: `${grey[500]} !important`,
|
|
380
410
|
color: `${grey[500]} !important`,
|
|
411
|
+
// Same reasoning as ghost - MUI hard-codes the loading indicator to
|
|
412
|
+
// `palette.action.disabled` which is invisible on dark surfaces.
|
|
413
|
+
'& .MuiButton-loadingIndicator': {
|
|
414
|
+
color: grey[500],
|
|
415
|
+
},
|
|
416
|
+
'&.MuiButton-loadingPositionCenter': {
|
|
417
|
+
color: 'transparent !important',
|
|
418
|
+
},
|
|
381
419
|
},
|
|
382
420
|
},
|
|
383
421
|
|
|
@@ -394,6 +432,22 @@ const MuiButton: Components['MuiButton'] = {
|
|
|
394
432
|
},
|
|
395
433
|
'&.Mui-disabled': {
|
|
396
434
|
borderColor: `transparent !important`,
|
|
435
|
+
// Ghost buttons live on dark surfaces; the root outlined
|
|
436
|
+
// `.Mui-disabled` rule paints text `grey[600]`, which disappears on
|
|
437
|
+
// a near-black background. Keep the light color and, importantly,
|
|
438
|
+
// override MUI's `.MuiButton-loadingIndicator { color: action.disabled }`
|
|
439
|
+
// (dark grey ~ #0000000042) so the spinner stays visible while loading.
|
|
440
|
+
color: `${grey[300]} !important`,
|
|
441
|
+
'& .MuiButton-loadingIndicator': {
|
|
442
|
+
color: grey[300],
|
|
443
|
+
},
|
|
444
|
+
// The root `.MuiButton-loadingPositionCenter` transparent rule loses
|
|
445
|
+
// the specificity fight against the color override above (nested
|
|
446
|
+
// inside `.MuiButton-colorGhost`), so re-apply it here to hide the
|
|
447
|
+
// label/icon while the centered spinner shows.
|
|
448
|
+
'&.MuiButton-loadingPositionCenter': {
|
|
449
|
+
color: 'transparent !important',
|
|
450
|
+
},
|
|
397
451
|
},
|
|
398
452
|
},
|
|
399
453
|
},
|
|
@@ -10,16 +10,18 @@ const MuiCard: Components['MuiCard'] = {
|
|
|
10
10
|
styleOverrides: {
|
|
11
11
|
root: {
|
|
12
12
|
borderRadius: '1rem',
|
|
13
|
+
// Paint the default outlined border on the root instead of a
|
|
14
|
+
// `variants[{ variant: 'outlined' }]` entry. `styleOverrides` deep-
|
|
15
|
+
// merges when a consumer calls `createTheme(RcSesTheme, {...})`, but
|
|
16
|
+
// arrays like `variants` are replaced wholesale - so a consumer theme
|
|
17
|
+
// that declares its own MuiCard variants would otherwise strip our
|
|
18
|
+
// outlined-border rule and leave every card borderless.
|
|
19
|
+
borderWidth: 1,
|
|
20
|
+
borderStyle: 'solid',
|
|
21
|
+
borderColor: Colors.grey['300'],
|
|
13
22
|
},
|
|
14
23
|
},
|
|
15
24
|
variants: [
|
|
16
|
-
{
|
|
17
|
-
props: { variant: 'outlined' },
|
|
18
|
-
style: {
|
|
19
|
-
border: '1px solid',
|
|
20
|
-
borderColor: Colors.grey['300'],
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
25
|
{
|
|
24
26
|
props: { variant: 'elevation' },
|
|
25
27
|
style: {
|
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
import { Components } from '@mui/material'
|
|
2
2
|
|
|
3
|
+
import palette from '@/theme/palette'
|
|
4
|
+
|
|
5
|
+
export const typography = {
|
|
6
|
+
bodyRegularMuted: {
|
|
7
|
+
color: palette.grey[500],
|
|
8
|
+
fontSize: '0.9375rem',
|
|
9
|
+
fontWeight: 400,
|
|
10
|
+
lineHeight: '1.375rem',
|
|
11
|
+
},
|
|
12
|
+
priceEmphasis: {
|
|
13
|
+
color: palette.grey[900],
|
|
14
|
+
fontSize: '1.125rem',
|
|
15
|
+
fontWeight: 500,
|
|
16
|
+
lineHeight: '1.5rem',
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
3
20
|
const MuiTypography: Components['MuiTypography'] = {
|
|
4
21
|
styleOverrides: {
|
|
5
22
|
root: {},
|
package/src/theme/palette.tsx
CHANGED
|
@@ -11,7 +11,7 @@ const primary = {
|
|
|
11
11
|
'900': '#164763',
|
|
12
12
|
'950': '#082d44',
|
|
13
13
|
main: '#06a0d4',
|
|
14
|
-
}
|
|
14
|
+
} as const
|
|
15
15
|
|
|
16
16
|
const secondary = {
|
|
17
17
|
'50': '#ecfdf6',
|
|
@@ -26,7 +26,7 @@ const secondary = {
|
|
|
26
26
|
'900': '#004e3d',
|
|
27
27
|
'950': '#002c24',
|
|
28
28
|
main: '#00c288',
|
|
29
|
-
}
|
|
29
|
+
} as const
|
|
30
30
|
|
|
31
31
|
const grey = {
|
|
32
32
|
'50': '#f9fafb',
|
|
@@ -41,7 +41,7 @@ const grey = {
|
|
|
41
41
|
'900': '#1f2733',
|
|
42
42
|
'950': '#10161f',
|
|
43
43
|
main: '#8e959e',
|
|
44
|
-
}
|
|
44
|
+
} as const
|
|
45
45
|
|
|
46
46
|
const warning = {
|
|
47
47
|
'50': '#fef9ef',
|
|
@@ -56,7 +56,7 @@ const warning = {
|
|
|
56
56
|
'900': '#4a3504',
|
|
57
57
|
'950': '#312303',
|
|
58
58
|
main: '#f9b311',
|
|
59
|
-
}
|
|
59
|
+
} as const
|
|
60
60
|
|
|
61
61
|
const error = {
|
|
62
62
|
'50': '#fef4f2',
|
|
@@ -71,17 +71,17 @@ const error = {
|
|
|
71
71
|
'900': '#4a1a14',
|
|
72
72
|
'950': '#31110d',
|
|
73
73
|
main: '#fa5a46',
|
|
74
|
-
}
|
|
74
|
+
} as const
|
|
75
75
|
|
|
76
76
|
const overlays = {
|
|
77
77
|
'200': '#ffffff14',
|
|
78
78
|
'300': '#ffffff29',
|
|
79
79
|
main: '#ffffff14',
|
|
80
|
-
}
|
|
80
|
+
} as const
|
|
81
81
|
|
|
82
82
|
const common = {
|
|
83
83
|
white: '#ffffff',
|
|
84
|
-
}
|
|
84
|
+
} as const
|
|
85
85
|
|
|
86
86
|
export { primary, secondary, grey, warning, error, overlays, common }
|
|
87
87
|
export default { primary, secondary, grey, warning, error }
|