@registrucentras/rc-ses-react-components 2.0.0-rc.2 → 2.0.0-rc.4
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/ArrowRightIcon.d.ts +1 -1
- 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/index.d.ts +5 -0
- package/dist/components/common/CardShell/types.d.ts +26 -0
- package/dist/components/common/IconWithSquareBackground/index.d.ts +12 -0
- package/dist/components/common/ServiceLinks/ServiceLinkItem/index.d.ts +15 -0
- package/dist/components/common/ServiceLinks/index.d.ts +3 -0
- package/dist/components/common/ServiceLinks/types.d.ts +34 -0
- package/dist/components/common/SideNav/SideNav.types.d.ts +20 -0
- package/dist/components/common/SideNav/SideNavLayout.d.ts +4 -0
- package/dist/components/common/SideNav/components/SideNavPill.d.ts +9 -0
- package/dist/components/common/SideNav/components/SideNavPillList.d.ts +9 -0
- package/dist/components/common/SideNav/components/SideNavRow.d.ts +9 -0
- package/dist/components/common/SideNav/hooks/useSideNavScrollSpy.d.ts +12 -0
- package/dist/components/common/SideNav/index.d.ts +4 -0
- package/dist/components/common/TitleBlock/index.d.ts +3 -0
- package/dist/components/common/TitleBlock/types.d.ts +73 -0
- package/dist/components/utils/normalizeSx.d.ts +4 -0
- package/dist/library/index.d.ts +10 -1
- package/dist/library/types.d.ts +8 -1
- package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
- package/dist/registrucentras-rc-ses-react-components.js +3535 -2563
- package/dist/stories/components/display/CardShell.stories.d.ts +17 -0
- package/dist/stories/components/display/SelectableCardList.stories.d.ts +1 -0
- package/dist/stories/components/display/ServiceLinks.stories.d.ts +28 -0
- package/dist/stories/components/display/TitleBlock.stories.d.ts +20 -0
- package/dist/stories/components/form/FormControlWrapper.stories.d.ts +1 -0
- package/dist/stories/components/icons/IconWithSquareBackground.stories.d.ts +7 -0
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +107 -0
- package/dist/stories/components/navigation/SideNav.stories.d.ts +7 -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/assets/icons/ArrowRightIcon.tsx +2 -1
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +8 -6
- package/src/components/common/Card/index.tsx +1 -23
- 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/index.test.tsx +137 -0
- package/src/components/common/CardShell/index.tsx +78 -0
- package/src/components/common/CardShell/types.ts +30 -0
- package/src/components/common/IconWithSquareBackground/index.test.tsx +55 -0
- package/src/components/common/IconWithSquareBackground/index.tsx +83 -0
- package/src/components/common/ServiceLinks/ServiceLinkItem/index.tsx +177 -0
- package/src/components/common/ServiceLinks/index.test.tsx +166 -0
- package/src/components/common/ServiceLinks/index.tsx +66 -0
- package/src/components/common/ServiceLinks/types.ts +37 -0
- package/src/components/common/SideNav/SideNav.types.ts +24 -0
- package/src/components/common/SideNav/SideNavLayout.test.tsx +113 -0
- package/src/components/common/SideNav/SideNavLayout.tsx +67 -0
- package/src/components/common/SideNav/components/SideNavPill.tsx +62 -0
- package/src/components/common/SideNav/components/SideNavPillList.tsx +190 -0
- package/src/components/common/SideNav/components/SideNavRow.tsx +72 -0
- package/src/components/common/SideNav/hooks/useSideNavScrollSpy.test.ts +457 -0
- package/src/components/common/SideNav/hooks/useSideNavScrollSpy.ts +154 -0
- package/src/components/common/SideNav/index.test.tsx +99 -0
- package/src/components/common/SideNav/index.tsx +83 -0
- package/src/components/common/TitleBlock/index.test.tsx +366 -0
- package/src/components/common/TitleBlock/index.tsx +144 -0
- package/src/components/common/TitleBlock/types.ts +82 -0
- package/src/components/form/inputs/Datepicker/index.test.tsx +117 -0
- package/src/components/utils/normalizeSx.ts +24 -0
- package/src/i18n/namespaces/common/en.json +4 -0
- package/src/i18n/namespaces/common/lt.json +4 -0
- package/src/library/index.ts +12 -0
- package/src/library/types.ts +38 -0
- package/src/stories/components/display/CardShell.stories.tsx +263 -0
- package/src/stories/components/display/SelectableCardList.stories.tsx +33 -1
- package/src/stories/components/display/ServiceLinks.stories.tsx +154 -0
- package/src/stories/components/display/TitleBlock.stories.tsx +506 -0
- package/src/stories/components/form/FormControlWrapper.stories.tsx +23 -0
- package/src/stories/components/icons/IconWithSquareBackground.stories.tsx +60 -0
- package/src/stories/components/inputs/DatePicker.stories.tsx +105 -9
- package/src/stories/components/navigation/SideNav.stories.tsx +110 -0
- package/src/theme/cards.ts +60 -0
- package/src/theme/light/MuiButton.tsx +6 -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,60 @@
|
|
|
1
|
+
import { Stack, Typography } from '@mui/material'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
|
|
4
|
+
import InfoFillIcon from '@/assets/icons/InfoFillIcon'
|
|
5
|
+
import RcSesIconWithSquareBackground from '@/components/common/IconWithSquareBackground'
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof RcSesIconWithSquareBackground> = {
|
|
8
|
+
title: 'components/icons/IconWithSquareBackground',
|
|
9
|
+
component: RcSesIconWithSquareBackground,
|
|
10
|
+
tags: ['autodocs'],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: {
|
|
13
|
+
control: { type: 'select' },
|
|
14
|
+
options: [40, 44],
|
|
15
|
+
},
|
|
16
|
+
variant: {
|
|
17
|
+
control: { type: 'select' },
|
|
18
|
+
options: ['solid', 'soft', 'muted'],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default meta
|
|
24
|
+
type Story = StoryObj<typeof meta>
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
Icon: InfoFillIcon,
|
|
29
|
+
size: 44,
|
|
30
|
+
variant: 'solid',
|
|
31
|
+
},
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const SIZES = [40, 44] as const
|
|
35
|
+
const VARIANTS = ['solid', 'soft', 'muted'] as const
|
|
36
|
+
|
|
37
|
+
export const AllVariantsAndSizes: Story = {
|
|
38
|
+
parameters: { controls: { disable: true } },
|
|
39
|
+
render: () => (
|
|
40
|
+
<Stack spacing={3}>
|
|
41
|
+
{SIZES.map((size) => (
|
|
42
|
+
<Stack key={size} spacing={1}>
|
|
43
|
+
<Typography variant='caption'>size: {size}</Typography>
|
|
44
|
+
<Stack direction='row' spacing={2} sx={{ alignItems: 'center' }}>
|
|
45
|
+
{VARIANTS.map((variant) => (
|
|
46
|
+
<Stack key={variant} spacing={0.5} sx={{ alignItems: 'center' }}>
|
|
47
|
+
<RcSesIconWithSquareBackground
|
|
48
|
+
Icon={InfoFillIcon}
|
|
49
|
+
size={size}
|
|
50
|
+
variant={variant}
|
|
51
|
+
/>
|
|
52
|
+
<Typography variant='caption'>{variant}</Typography>
|
|
53
|
+
</Stack>
|
|
54
|
+
))}
|
|
55
|
+
</Stack>
|
|
56
|
+
</Stack>
|
|
57
|
+
))}
|
|
58
|
+
</Stack>
|
|
59
|
+
),
|
|
60
|
+
}
|
|
@@ -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,110 @@
|
|
|
1
|
+
import { Box, Typography } from '@mui/material'
|
|
2
|
+
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
3
|
+
import { useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { RcSesSideNavItem } from '@/components/common/SideNav/SideNav.types'
|
|
6
|
+
import RcSesSideNavLayout from '@/components/common/SideNav/SideNavLayout'
|
|
7
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
8
|
+
|
|
9
|
+
const ITEMS: RcSesSideNavItem[] = [
|
|
10
|
+
{ id: 'family', label: 'Aš ir mano šeima', count: 4 },
|
|
11
|
+
{ id: 'documents', label: 'Dokumentai apie gyventoją', count: 2 },
|
|
12
|
+
{ id: 'signature', label: 'Elektroninis parašas', count: 1 },
|
|
13
|
+
{ id: 'residence', label: 'Gyvenamosios vietos deklaravimas', count: 7 },
|
|
14
|
+
{ id: 'authorizations', label: 'Įgaliojimai', count: 6 },
|
|
15
|
+
{ id: 'marriage', label: 'Santuoka ir skyrybos', count: 7 },
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
const SECTION_HEIGHT = 320
|
|
19
|
+
|
|
20
|
+
function Sections() {
|
|
21
|
+
return (
|
|
22
|
+
<>
|
|
23
|
+
{ITEMS.map((item) => (
|
|
24
|
+
<Box
|
|
25
|
+
key={item.id}
|
|
26
|
+
id={item.id}
|
|
27
|
+
sx={{
|
|
28
|
+
height: `${SECTION_HEIGHT}px`,
|
|
29
|
+
borderBottom: '1px dashed #dce0e5',
|
|
30
|
+
paddingTop: '1rem',
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
<Typography variant='h3' sx={{ fontSize: '1.25rem', fontWeight: 600 }}>
|
|
34
|
+
{item.label}
|
|
35
|
+
</Typography>
|
|
36
|
+
<Typography sx={{ color: '#6b747f' }}>
|
|
37
|
+
{item.count} paslaugos šioje temoje.
|
|
38
|
+
</Typography>
|
|
39
|
+
</Box>
|
|
40
|
+
))}
|
|
41
|
+
</>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const meta: Meta<typeof RcSesSideNavLayout> = {
|
|
46
|
+
title: 'components/navigation/SideNav',
|
|
47
|
+
component: RcSesSideNavLayout,
|
|
48
|
+
tags: ['autodocs'],
|
|
49
|
+
parameters: {
|
|
50
|
+
docs: {
|
|
51
|
+
description: {
|
|
52
|
+
component:
|
|
53
|
+
'RcSesSideNavLayout is the only supported way to use this component - it lays out the sticky nav column (a topic list on desktop, a horizontally scrollable pill bar on mobile) alongside its section children, which is what guarantees the desktop sticky behavior works. By default (no `activeItemId`) it tracks scroll position itself and scrolls the page on click - pass `activeItemId`/`onItemClick` to take full control instead. See `WithScrollSpy` for the default, self-contained behavior; `Main` demonstrates the fully-controlled mode, which is why it wires the state itself.',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export default meta
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<typeof RcSesSideNavLayout>
|
|
62
|
+
|
|
63
|
+
function ControlledDemo({
|
|
64
|
+
activeItemId: initialActiveItemId,
|
|
65
|
+
...args
|
|
66
|
+
}: React.ComponentProps<typeof RcSesSideNavLayout>) {
|
|
67
|
+
const [activeItemId, setActiveItemId] = useState(initialActiveItemId ?? ITEMS[0].id)
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<RcSesSideNavLayout
|
|
71
|
+
{...args}
|
|
72
|
+
activeItemId={activeItemId}
|
|
73
|
+
onItemClick={setActiveItemId}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export const Main: Story = {
|
|
79
|
+
render: (args) => (
|
|
80
|
+
<FieldView>
|
|
81
|
+
<ControlledDemo {...args}>
|
|
82
|
+
<Sections />
|
|
83
|
+
</ControlledDemo>
|
|
84
|
+
</FieldView>
|
|
85
|
+
),
|
|
86
|
+
args: {
|
|
87
|
+
items: ITEMS,
|
|
88
|
+
title: 'Temos',
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const WithScrollSpy: Story = {
|
|
93
|
+
render: () => (
|
|
94
|
+
<FieldView>
|
|
95
|
+
{/* The real page scrolls the window (as in the confirmed design), so this demo
|
|
96
|
+
does too, rather than nesting its own scroll container. */}
|
|
97
|
+
<RcSesSideNavLayout items={ITEMS} title='Temos'>
|
|
98
|
+
<Sections />
|
|
99
|
+
</RcSesSideNavLayout>
|
|
100
|
+
</FieldView>
|
|
101
|
+
),
|
|
102
|
+
parameters: {
|
|
103
|
+
docs: {
|
|
104
|
+
description: {
|
|
105
|
+
story:
|
|
106
|
+
'The default, uncontrolled mode: no `activeItemId`/`onItemClick` passed, so the nav tracks scroll position itself and scrolls to a section when its topic is clicked.',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
}
|
|
@@ -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', md: '1.5rem 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 }
|
|
@@ -21,6 +21,12 @@ const MuiButton: Components['MuiButton'] = {
|
|
|
21
21
|
fontSize: '.875rem',
|
|
22
22
|
fontWeight: 600,
|
|
23
23
|
height: '2.375rem',
|
|
24
|
+
// Link buttons are typographic elements — they sit flush with the
|
|
25
|
+
// surrounding text, not with contained/outlined button hit-area
|
|
26
|
+
// padding. sizeSmall/sizeLarge already opt out of the root horizontal
|
|
27
|
+
// padding; the default (medium) needs the same treatment so a
|
|
28
|
+
// any link lines up under a heading, not 20px indented.
|
|
29
|
+
padding: '.8125rem 0',
|
|
24
30
|
|
|
25
31
|
'&.Mui-disabled': {
|
|
26
32
|
opacity: 0.4,
|
|
@@ -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,
|