@registrucentras/rc-ses-react-components 2.0.0-rc.1 → 2.0.0-rc.3
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/CardShell/CardFooter/index.d.ts +3 -0
- package/dist/components/common/CardShell/CardFooter/types.d.ts +21 -0
- package/dist/components/common/CardShell/CardHeader/index.d.ts +3 -0
- package/dist/components/common/CardShell/CardHeader/types.d.ts +33 -0
- package/dist/components/common/CardShell/index.d.ts +5 -0
- package/dist/components/common/CardShell/types.d.ts +24 -0
- package/dist/components/form/inputs/Select/index.d.ts +1 -0
- package/dist/library/index.d.ts +4 -1
- package/dist/library/types.d.ts +4 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +2634 -2319
- package/dist/stories/components/display/AdvancedList.stories.d.ts +1 -0
- package/dist/stories/components/display/CardShell.stories.d.ts +17 -0
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +107 -0
- package/dist/theme/cards.d.ts +114 -0
- package/dist/theme/light/MuiPickersOutlinedInput.d.ts +8 -0
- package/package.json +1 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +6 -2
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +11 -4
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +12 -4
- package/src/components/common/Card/index.tsx +2 -2
- package/src/components/common/CardShell/CardFooter/index.test.tsx +52 -0
- package/src/components/common/CardShell/CardFooter/index.tsx +38 -0
- package/src/components/common/CardShell/CardFooter/types.ts +24 -0
- package/src/components/common/CardShell/CardHeader/index.test.tsx +207 -0
- package/src/components/common/CardShell/CardHeader/index.tsx +104 -0
- package/src/components/common/CardShell/CardHeader/types.ts +36 -0
- package/src/components/common/CardShell/index.test.tsx +137 -0
- package/src/components/common/CardShell/index.tsx +75 -0
- package/src/components/common/CardShell/types.ts +28 -0
- package/src/components/form/inputs/Datepicker/index.test.tsx +117 -0
- package/src/components/form/inputs/FileDropzone.tsx +1 -0
- package/src/components/form/inputs/FileUpload.tsx +1 -0
- package/src/components/form/inputs/NumberStepper.tsx +1 -0
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +1 -1
- package/src/components/form/inputs/RadioButtonGroup.test.tsx +71 -0
- package/src/components/form/inputs/RadioButtonGroup.tsx +1 -0
- package/src/components/form/inputs/Select/index.test.tsx +57 -0
- package/src/components/form/inputs/Select/index.tsx +2 -0
- package/src/components/layout/Footer/index.test.tsx +13 -0
- package/src/components/layout/Footer/index.tsx +5 -2
- package/src/library/index.ts +6 -0
- package/src/library/types.ts +26 -0
- package/src/stories/components/display/AdvancedList.stories.tsx +131 -0
- package/src/stories/components/display/CardShell.stories.tsx +261 -0
- package/src/stories/components/inputs/DatePicker.stories.tsx +105 -9
- package/src/theme/cards.ts +60 -0
- package/src/theme/light/MuiPickersLayout.ts +10 -1
- package/src/theme/light/MuiPickersOutlinedInput.ts +88 -0
- package/src/theme/light/index.tsx +2 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
|
|
4
|
+
import UserIcon from '@/assets/icons/UserIcon'
|
|
5
|
+
import RcSesButton from '@/components/common/Button'
|
|
6
|
+
import RcSesCardShell from '@/components/common/CardShell'
|
|
7
|
+
import RcSesCardFooter from '@/components/common/CardShell/CardFooter'
|
|
8
|
+
import RcSesCardHeader from '@/components/common/CardShell/CardHeader'
|
|
9
|
+
import RcSesIconWithCircularBackground from '@/components/common/IconWithCircularBackground'
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof RcSesCardShell> = {
|
|
12
|
+
title: 'components/display/CardShell',
|
|
13
|
+
component: RcSesCardShell,
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
parameters: {
|
|
16
|
+
docs: {
|
|
17
|
+
description: {
|
|
18
|
+
component:
|
|
19
|
+
'CardShell is a low-level building-block component for card structure and styling. It provides header, content, and footer slots with different variants (card, subcard) and themes (default, brand, sunken). Unlike a ready-to-use Card component, CardShell has no built-in content and serves as a foundation for building more complex cards.',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
viewport: {
|
|
23
|
+
options: {
|
|
24
|
+
mobile375: { name: 'Mobile 375', styles: { height: '900px', width: '375px' } },
|
|
25
|
+
tablet768: { name: 'Tablet 768', styles: { height: '900px', width: '768px' } },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
controls: {
|
|
29
|
+
include: [
|
|
30
|
+
'variant',
|
|
31
|
+
'theme',
|
|
32
|
+
'fullHeight',
|
|
33
|
+
'header',
|
|
34
|
+
'children',
|
|
35
|
+
'footer',
|
|
36
|
+
'testIds',
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
argTypes: {
|
|
41
|
+
variant: {
|
|
42
|
+
control: 'select',
|
|
43
|
+
options: ['card', 'subcard'],
|
|
44
|
+
description: 'Visual variant of the card',
|
|
45
|
+
},
|
|
46
|
+
theme: {
|
|
47
|
+
control: 'select',
|
|
48
|
+
options: ['default', 'brand', 'sunken'],
|
|
49
|
+
description: 'Color theme of the card',
|
|
50
|
+
},
|
|
51
|
+
fullHeight: {
|
|
52
|
+
control: 'boolean',
|
|
53
|
+
description: 'Whether the card should take full height of its container',
|
|
54
|
+
},
|
|
55
|
+
header: {
|
|
56
|
+
control: false,
|
|
57
|
+
description: 'Header content (ReactNode)',
|
|
58
|
+
},
|
|
59
|
+
children: {
|
|
60
|
+
control: false,
|
|
61
|
+
description: 'Main content (ReactNode)',
|
|
62
|
+
},
|
|
63
|
+
footer: {
|
|
64
|
+
control: false,
|
|
65
|
+
description: 'Footer content (ReactNode)',
|
|
66
|
+
},
|
|
67
|
+
testIds: {
|
|
68
|
+
control: false,
|
|
69
|
+
description: 'Test IDs for the card elements',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default meta
|
|
75
|
+
|
|
76
|
+
type Story = StoryObj<typeof RcSesCardShell>
|
|
77
|
+
|
|
78
|
+
const SampleHeader = () => (
|
|
79
|
+
<RcSesCardHeader
|
|
80
|
+
title='Kortelės antraštė'
|
|
81
|
+
description='Paaiškinimas apie šios kortelės turinį'
|
|
82
|
+
/>
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const SampleContent = () => (
|
|
86
|
+
<Box
|
|
87
|
+
sx={{
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
color: 'text.primary',
|
|
90
|
+
display: 'flex',
|
|
91
|
+
justifyContent: 'center',
|
|
92
|
+
minHeight: { xs: '9.625rem', md: '11.5rem' },
|
|
93
|
+
px: 3,
|
|
94
|
+
width: '100%',
|
|
95
|
+
}}
|
|
96
|
+
>
|
|
97
|
+
<Typography align='center'>Turinys (Body slot)</Typography>
|
|
98
|
+
</Box>
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
const SampleFooter = () => (
|
|
102
|
+
<RcSesCardFooter>
|
|
103
|
+
<RcSesButton color='grey' variant='outlined'>
|
|
104
|
+
Atšaukti
|
|
105
|
+
</RcSesButton>
|
|
106
|
+
<RcSesButton>Tęsti</RcSesButton>
|
|
107
|
+
</RcSesCardFooter>
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
export const Default: Story = {
|
|
111
|
+
args: {
|
|
112
|
+
variant: 'card',
|
|
113
|
+
theme: 'default',
|
|
114
|
+
header: <SampleHeader />,
|
|
115
|
+
children: <SampleContent />,
|
|
116
|
+
footer: <SampleFooter />,
|
|
117
|
+
},
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const SubcardVariant: Story = {
|
|
121
|
+
args: {
|
|
122
|
+
variant: 'subcard',
|
|
123
|
+
theme: 'default',
|
|
124
|
+
header: <SampleHeader />,
|
|
125
|
+
children: <SampleContent />,
|
|
126
|
+
footer: <SampleFooter />,
|
|
127
|
+
},
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export const BrandTheme: Story = {
|
|
131
|
+
args: {
|
|
132
|
+
variant: 'card',
|
|
133
|
+
theme: 'brand',
|
|
134
|
+
header: <SampleHeader />,
|
|
135
|
+
children: <SampleContent />,
|
|
136
|
+
footer: <SampleFooter />,
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const SunkenTheme: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
variant: 'card',
|
|
143
|
+
theme: 'sunken',
|
|
144
|
+
header: <SampleHeader />,
|
|
145
|
+
children: <SampleContent />,
|
|
146
|
+
footer: <SampleFooter />,
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const HeaderComplete: Story = {
|
|
151
|
+
args: {
|
|
152
|
+
variant: 'card',
|
|
153
|
+
theme: 'default',
|
|
154
|
+
header: (
|
|
155
|
+
<RcSesCardHeader
|
|
156
|
+
actions={
|
|
157
|
+
<RcSesButton color='grey' variant='outlined'>
|
|
158
|
+
Redaguoti
|
|
159
|
+
</RcSesButton>
|
|
160
|
+
}
|
|
161
|
+
count={4}
|
|
162
|
+
description='Paaiškinimas apie šios kortelės turinį'
|
|
163
|
+
icon={<RcSesIconWithCircularBackground Icon={UserIcon} size='medium' />}
|
|
164
|
+
title='Pasirinktos teisės'
|
|
165
|
+
/>
|
|
166
|
+
),
|
|
167
|
+
children: <SampleContent />,
|
|
168
|
+
footer: <SampleFooter />,
|
|
169
|
+
},
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export const WithoutHeader: Story = {
|
|
173
|
+
args: {
|
|
174
|
+
variant: 'card',
|
|
175
|
+
theme: 'default',
|
|
176
|
+
children: <SampleContent />,
|
|
177
|
+
footer: <SampleFooter />,
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const FooterSingleLink: Story = {
|
|
182
|
+
args: {
|
|
183
|
+
variant: 'card',
|
|
184
|
+
theme: 'default',
|
|
185
|
+
header: <SampleHeader />,
|
|
186
|
+
children: <SampleContent />,
|
|
187
|
+
footer: (
|
|
188
|
+
<RcSesCardFooter align='start' stretchOnMobile={false}>
|
|
189
|
+
<RcSesButton variant='link'>Žiūrėti visas</RcSesButton>
|
|
190
|
+
</RcSesCardFooter>
|
|
191
|
+
),
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const WithoutFooter: Story = {
|
|
196
|
+
args: {
|
|
197
|
+
variant: 'card',
|
|
198
|
+
theme: 'default',
|
|
199
|
+
header: <SampleHeader />,
|
|
200
|
+
children: <SampleContent />,
|
|
201
|
+
},
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export const ContentOnly: Story = {
|
|
205
|
+
args: {
|
|
206
|
+
variant: 'card',
|
|
207
|
+
theme: 'default',
|
|
208
|
+
children: <SampleContent />,
|
|
209
|
+
},
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
export const FullHeight: Story = {
|
|
213
|
+
args: {
|
|
214
|
+
variant: 'card',
|
|
215
|
+
theme: 'default',
|
|
216
|
+
fullHeight: true,
|
|
217
|
+
header: <SampleHeader />,
|
|
218
|
+
children: (
|
|
219
|
+
<Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'center' }}>
|
|
220
|
+
<Typography align='center'>Pilno aukščio turinys</Typography>
|
|
221
|
+
</Box>
|
|
222
|
+
),
|
|
223
|
+
footer: <SampleFooter />,
|
|
224
|
+
},
|
|
225
|
+
decorators: [
|
|
226
|
+
(Story) => (
|
|
227
|
+
<Box sx={{ height: '500px' }}>
|
|
228
|
+
<Story />
|
|
229
|
+
</Box>
|
|
230
|
+
),
|
|
231
|
+
],
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export const MobileViewport: Story = {
|
|
235
|
+
args: {
|
|
236
|
+
variant: 'card',
|
|
237
|
+
theme: 'default',
|
|
238
|
+
header: <SampleHeader />,
|
|
239
|
+
children: <SampleContent />,
|
|
240
|
+
footer: <SampleFooter />,
|
|
241
|
+
},
|
|
242
|
+
// Two separate mechanisms, deliberately: the tag sets Playwright's browser
|
|
243
|
+
// width for the baseline, the global sets the canvas iframe width for anyone
|
|
244
|
+
// reviewing in Storybook. Docs pages render stories inline at the container's
|
|
245
|
+
// width, where neither applies, so this one is kept out of the docs page
|
|
246
|
+
// rather than showing a desktop card under a mobile heading.
|
|
247
|
+
tags: ['viewport-375', '!autodocs'],
|
|
248
|
+
globals: { viewport: { value: 'mobile375' } },
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export const TabletViewport: Story = {
|
|
252
|
+
args: {
|
|
253
|
+
variant: 'card',
|
|
254
|
+
theme: 'default',
|
|
255
|
+
header: <SampleHeader />,
|
|
256
|
+
children: <SampleContent />,
|
|
257
|
+
footer: <SampleFooter />,
|
|
258
|
+
},
|
|
259
|
+
tags: ['viewport-768', '!autodocs'],
|
|
260
|
+
globals: { viewport: { value: 'tablet768' } },
|
|
261
|
+
}
|
|
@@ -27,8 +27,11 @@ const meta: Meta<typeof RcSesDatepicker> = {
|
|
|
27
27
|
|
|
28
28
|
export default meta
|
|
29
29
|
|
|
30
|
+
// Pinned so the visual baselines do not change with the calendar date.
|
|
31
|
+
const REFERENCE_DATE = new Date(2026, 0, 15)
|
|
32
|
+
|
|
30
33
|
function DatePickerDemo(args: any) {
|
|
31
|
-
const { clearable, label, open, rules } = args
|
|
34
|
+
const { clearable, datepickerProps, disabled, error, label, open, rules, value } = args
|
|
32
35
|
|
|
33
36
|
const {
|
|
34
37
|
control,
|
|
@@ -36,7 +39,7 @@ function DatePickerDemo(args: any) {
|
|
|
36
39
|
} = useForm<SingleStepFormModel>({
|
|
37
40
|
mode: 'all',
|
|
38
41
|
defaultValues: {
|
|
39
|
-
date: null,
|
|
42
|
+
date: value ?? null,
|
|
40
43
|
},
|
|
41
44
|
})
|
|
42
45
|
|
|
@@ -49,18 +52,17 @@ function DatePickerDemo(args: any) {
|
|
|
49
52
|
name='date'
|
|
50
53
|
clearable={clearable}
|
|
51
54
|
control={control}
|
|
55
|
+
disabled={disabled}
|
|
52
56
|
rules={rules}
|
|
53
57
|
label={label}
|
|
54
|
-
errors={errors?.date}
|
|
58
|
+
errors={error ? { type: 'manual', message: error } : errors?.date}
|
|
55
59
|
slotProps={
|
|
56
|
-
open
|
|
60
|
+
open || datepickerProps
|
|
57
61
|
? {
|
|
58
62
|
datepicker: {
|
|
59
|
-
open: true,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
// every month.
|
|
63
|
-
referenceDate: new Date(2026, 0, 15),
|
|
63
|
+
...(open ? { open: true } : {}),
|
|
64
|
+
referenceDate: REFERENCE_DATE,
|
|
65
|
+
...(datepickerProps ?? {}),
|
|
64
66
|
},
|
|
65
67
|
}
|
|
66
68
|
: undefined
|
|
@@ -126,9 +128,103 @@ export const CalendarOpen = {
|
|
|
126
128
|
},
|
|
127
129
|
parameters: {
|
|
128
130
|
docs: {
|
|
131
|
+
story: { inline: false, iframeHeight: 560 },
|
|
129
132
|
description: {
|
|
130
133
|
story: 'The picker with its calendar open, pinned to a fixed month.',
|
|
131
134
|
},
|
|
132
135
|
},
|
|
133
136
|
},
|
|
134
137
|
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Days past the 20th are out of range: they must read as greyed out, not merely
|
|
141
|
+
* be unclickable. Disabled weekends stay red.
|
|
142
|
+
*/
|
|
143
|
+
export const CalendarWithDisabledDates = {
|
|
144
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
145
|
+
// The calendar is portalled, so inline in the docs page it escapes this
|
|
146
|
+
// story's block and covers its neighbours. Its own iframe contains it.
|
|
147
|
+
parameters: {
|
|
148
|
+
docs: {
|
|
149
|
+
story: { inline: false, iframeHeight: 560 },
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
args: {
|
|
153
|
+
clearable: true,
|
|
154
|
+
label: 'Terminas',
|
|
155
|
+
open: true,
|
|
156
|
+
rules: { required: true },
|
|
157
|
+
datepickerProps: { maxDate: new Date(2026, 0, 20) },
|
|
158
|
+
},
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* A scattered rule rather than a range, so disabled days sit between selectable
|
|
163
|
+
* ones.
|
|
164
|
+
*/
|
|
165
|
+
export const CalendarWithDisabledRule = {
|
|
166
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
167
|
+
// The calendar is portalled, so inline in the docs page it escapes this
|
|
168
|
+
// story's block and covers its neighbours. Its own iframe contains it.
|
|
169
|
+
parameters: {
|
|
170
|
+
docs: {
|
|
171
|
+
story: { inline: false, iframeHeight: 560 },
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
args: {
|
|
175
|
+
clearable: true,
|
|
176
|
+
label: 'Terminas',
|
|
177
|
+
open: true,
|
|
178
|
+
rules: { required: true },
|
|
179
|
+
datepickerProps: {
|
|
180
|
+
shouldDisableDate: (date: Date) => [8, 9, 10, 22, 23].includes(date.getDate()),
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Covers the `Mui-selected` day styling.
|
|
187
|
+
*/
|
|
188
|
+
export const CalendarWithValue = {
|
|
189
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
190
|
+
// The calendar is portalled, so inline in the docs page it escapes this
|
|
191
|
+
// story's block and covers its neighbours. Its own iframe contains it.
|
|
192
|
+
parameters: {
|
|
193
|
+
docs: {
|
|
194
|
+
story: { inline: false, iframeHeight: 560 },
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
args: {
|
|
198
|
+
clearable: true,
|
|
199
|
+
label: 'Terminas',
|
|
200
|
+
open: true,
|
|
201
|
+
rules: { required: true },
|
|
202
|
+
value: '2026-01-15T00:00:00.000Z',
|
|
203
|
+
},
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The whole field disabled - a different state from a disabled day.
|
|
208
|
+
*/
|
|
209
|
+
export const Disabled = {
|
|
210
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
211
|
+
args: {
|
|
212
|
+
clearable: true,
|
|
213
|
+
disabled: true,
|
|
214
|
+
label: 'Terminas',
|
|
215
|
+
rules: { required: true },
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* The error state: input border and helper text.
|
|
221
|
+
*/
|
|
222
|
+
export const WithError = {
|
|
223
|
+
render: (args: any) => <DatePickerDemo {...args} />,
|
|
224
|
+
args: {
|
|
225
|
+
clearable: true,
|
|
226
|
+
error: 'Privaloma pasirinkti datą',
|
|
227
|
+
label: 'Terminas',
|
|
228
|
+
rules: { required: true },
|
|
229
|
+
},
|
|
230
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import palette, { common } from '@/theme/palette'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Card surface tokens - Figma `Cards/card/*` and `Cards/subcard/*`.
|
|
5
|
+
*
|
|
6
|
+
* The boxed surface lives here rather than in the component that draws it, so
|
|
7
|
+
* anything needing a boxed row reads the same values instead of copying them.
|
|
8
|
+
* `MuiCard` keeps its own radius until `RcSesCard` is deprecated.
|
|
9
|
+
*/
|
|
10
|
+
const borderWidth = '1px'
|
|
11
|
+
|
|
12
|
+
const card = {
|
|
13
|
+
borderRadius: '0.75rem',
|
|
14
|
+
gap: { xs: '1rem', md: '1.5rem' },
|
|
15
|
+
padding: { xs: '1.25rem 1.5rem 1.5rem', md: '1.5rem 2rem 2rem' },
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const subcard = {
|
|
19
|
+
borderRadius: '0.5rem',
|
|
20
|
+
gap: { xs: '0.75rem', md: '1rem' },
|
|
21
|
+
padding: { xs: '1rem', md: '1.25rem 1.5rem' },
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Card header values. Two of them are departures from the type scale: the title
|
|
26
|
+
* is `h6` at weight 600 rather than 500, and the description is `body2` on a
|
|
27
|
+
* 1.25rem line. The three gaps follow the surrounding components - the row gap
|
|
28
|
+
* matches the card gap and the actions gap matches the footer - rather than a
|
|
29
|
+
* measured token. All six are pending confirmation against the DS.
|
|
30
|
+
*/
|
|
31
|
+
const header = {
|
|
32
|
+
actionsGap: '0.75rem',
|
|
33
|
+
badgeGap: '0.5rem',
|
|
34
|
+
descriptionLineHeight: '1.25rem',
|
|
35
|
+
gap: '0.25rem',
|
|
36
|
+
rowGap: '1rem',
|
|
37
|
+
titleFontWeight: 600,
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const footer = {
|
|
41
|
+
gap: '0.75rem',
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const themes = {
|
|
45
|
+
brand: {
|
|
46
|
+
backgroundColor: palette.primary[50],
|
|
47
|
+
borderColor: palette.primary[200],
|
|
48
|
+
},
|
|
49
|
+
default: {
|
|
50
|
+
backgroundColor: common.white,
|
|
51
|
+
borderColor: palette.grey[300],
|
|
52
|
+
},
|
|
53
|
+
sunken: {
|
|
54
|
+
backgroundColor: palette.grey[100],
|
|
55
|
+
borderColor: palette.grey[200],
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { borderWidth, card, footer, header, subcard, themes }
|
|
60
|
+
export default { borderWidth, card, footer, header, subcard, themes }
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PickerComponents } from '@mui/x-date-pickers/themeAugmentation'
|
|
2
2
|
|
|
3
|
-
import palette from '../palette'
|
|
3
|
+
import palette, { common } from '../palette'
|
|
4
4
|
|
|
5
5
|
const MuiPickersLayout: PickerComponents['MuiPickersLayout'] = {
|
|
6
6
|
defaultProps: {},
|
|
@@ -44,8 +44,17 @@ const MuiPickersLayout: PickerComponents['MuiPickersLayout'] = {
|
|
|
44
44
|
|
|
45
45
|
'&.Mui-selected, &.Mui-selected:hover, &.Mui-selected:focus': {
|
|
46
46
|
backgroundColor: palette.primary['500'],
|
|
47
|
+
// v9 sets the contrast colour in a variant, which loses to the
|
|
48
|
+
// day colour above, so it has to be restated.
|
|
49
|
+
color: common.white,
|
|
47
50
|
fontWeight: 400,
|
|
48
51
|
},
|
|
52
|
+
|
|
53
|
+
// Same as above: v9 sets the disabled colour in a variant, which loses
|
|
54
|
+
// to the day colour. Weekends stay red, their rule is more specific.
|
|
55
|
+
'&.Mui-disabled': {
|
|
56
|
+
color: palette.grey['400'],
|
|
57
|
+
},
|
|
49
58
|
},
|
|
50
59
|
|
|
51
60
|
'.MuiPickerDay-dayOutsideMonth': {
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { decomposeColor } from '@mui/material'
|
|
2
|
+
import type { PickerComponents } from '@mui/x-date-pickers/themeAugmentation'
|
|
3
|
+
|
|
4
|
+
import palette, { common } from '../palette'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* x-date-pickers 9 gives the picker its own field components, which none of the
|
|
8
|
+
* `MuiInputBase` / `MuiOutlinedInput` slots reach. This mirrors them onto the
|
|
9
|
+
* picker slots - keep the two in step.
|
|
10
|
+
*/
|
|
11
|
+
const MuiPickersOutlinedInput: PickerComponents['MuiPickersOutlinedInput'] = {
|
|
12
|
+
styleOverrides: {
|
|
13
|
+
root: {
|
|
14
|
+
backgroundColor: common.white,
|
|
15
|
+
borderRadius: '.5rem',
|
|
16
|
+
// The value renders as sections, not an <input>, so the horizontal
|
|
17
|
+
// padding sits here and the vertical padding on the sections.
|
|
18
|
+
padding: '0 .75rem',
|
|
19
|
+
|
|
20
|
+
'.MuiPickersInputBase-sectionsContainer': {
|
|
21
|
+
color: palette.grey['900'],
|
|
22
|
+
fontSize: '.9375rem',
|
|
23
|
+
// The 18px content box MuiInputBase gives a plain input, so the row
|
|
24
|
+
// stays 44px.
|
|
25
|
+
boxSizing: 'content-box',
|
|
26
|
+
height: '1.125rem',
|
|
27
|
+
lineHeight: '1.125rem',
|
|
28
|
+
padding: '.8125rem 0',
|
|
29
|
+
},
|
|
30
|
+
|
|
31
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
32
|
+
borderColor: palette.grey['600'],
|
|
33
|
+
borderRadius: '.5rem',
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'&.Mui-error': {
|
|
37
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
38
|
+
borderColor: `${palette.error['600']} !important`,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
'&.Mui-focused': {
|
|
43
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
44
|
+
borderColor: `${palette.grey['900']} !important`,
|
|
45
|
+
borderRadius: '.5rem',
|
|
46
|
+
boxShadow: `0px 0px 0px 3px rgba(${decomposeColor(palette.grey['900']).values}, .2)`,
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
'&.Mui-error': {
|
|
50
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
51
|
+
borderColor: `${palette.error['600']} !important`,
|
|
52
|
+
borderWidth: '.125rem',
|
|
53
|
+
borderRadius: '.5rem',
|
|
54
|
+
boxShadow: `0px 0px 0px 3px rgba(${decomposeColor(palette.error['600']).values}, .2)`,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
'&.Mui-readOnly': {
|
|
60
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
61
|
+
borderColor: `${palette.grey['600']} !important`,
|
|
62
|
+
borderWidth: '1px !important',
|
|
63
|
+
boxShadow: 'none !important',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
'&.Mui-disabled': {
|
|
68
|
+
backgroundColor: `${palette.grey['100']} !important`,
|
|
69
|
+
|
|
70
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
71
|
+
borderColor: `${palette.grey['600']} !important`,
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
'.MuiPickersInputBase-sectionsContainer': {
|
|
75
|
+
color: `${palette.grey['600']} !important`,
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
|
|
79
|
+
'&:hover:not(.Mui-disabled):not(.Mui-readOnly)': {
|
|
80
|
+
'.MuiPickersOutlinedInput-notchedOutline': {
|
|
81
|
+
borderColor: palette.grey['900'],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export default MuiPickersOutlinedInput
|
|
@@ -28,6 +28,7 @@ import MuiInputBase from '@/theme/light/MuiInputBase'
|
|
|
28
28
|
import MuiLinearProgress from '@/theme/light/MuiLinearProgress'
|
|
29
29
|
import MuiOutlinedInput from '@/theme/light/MuiOutlinedInput'
|
|
30
30
|
import MuiPickersLayout from '@/theme/light/MuiPickersLayout'
|
|
31
|
+
import MuiPickersOutlinedInput from '@/theme/light/MuiPickersOutlinedInput'
|
|
31
32
|
import MuiPopover from '@/theme/light/MuiPopover'
|
|
32
33
|
import MuiRadio from '@/theme/light/MuiRadio'
|
|
33
34
|
import MuiSelect from '@/theme/light/MuiSelect'
|
|
@@ -119,6 +120,7 @@ const theme = createTheme(themePalette, ltLT, enUS, {
|
|
|
119
120
|
MuiLinearProgress,
|
|
120
121
|
MuiOutlinedInput,
|
|
121
122
|
MuiPickersLayout,
|
|
123
|
+
MuiPickersOutlinedInput,
|
|
122
124
|
MuiPagination,
|
|
123
125
|
MuiPaginationItem,
|
|
124
126
|
MuiPopover,
|