@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.
Files changed (50) hide show
  1. package/dist/components/common/CardShell/CardFooter/index.d.ts +3 -0
  2. package/dist/components/common/CardShell/CardFooter/types.d.ts +21 -0
  3. package/dist/components/common/CardShell/CardHeader/index.d.ts +3 -0
  4. package/dist/components/common/CardShell/CardHeader/types.d.ts +33 -0
  5. package/dist/components/common/CardShell/index.d.ts +5 -0
  6. package/dist/components/common/CardShell/types.d.ts +24 -0
  7. package/dist/components/form/inputs/Select/index.d.ts +1 -0
  8. package/dist/library/index.d.ts +4 -1
  9. package/dist/library/types.d.ts +4 -1
  10. package/dist/registrucentras-rc-ses-react-components.cjs +1 -1
  11. package/dist/registrucentras-rc-ses-react-components.js +2634 -2319
  12. package/dist/stories/components/display/AdvancedList.stories.d.ts +1 -0
  13. package/dist/stories/components/display/CardShell.stories.d.ts +17 -0
  14. package/dist/stories/components/inputs/DatePicker.stories.d.ts +107 -0
  15. package/dist/theme/cards.d.ts +114 -0
  16. package/dist/theme/light/MuiPickersOutlinedInput.d.ts +8 -0
  17. package/package.json +1 -1
  18. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +6 -2
  19. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +11 -4
  20. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +12 -4
  21. package/src/components/common/Card/index.tsx +2 -2
  22. package/src/components/common/CardShell/CardFooter/index.test.tsx +52 -0
  23. package/src/components/common/CardShell/CardFooter/index.tsx +38 -0
  24. package/src/components/common/CardShell/CardFooter/types.ts +24 -0
  25. package/src/components/common/CardShell/CardHeader/index.test.tsx +207 -0
  26. package/src/components/common/CardShell/CardHeader/index.tsx +104 -0
  27. package/src/components/common/CardShell/CardHeader/types.ts +36 -0
  28. package/src/components/common/CardShell/index.test.tsx +137 -0
  29. package/src/components/common/CardShell/index.tsx +75 -0
  30. package/src/components/common/CardShell/types.ts +28 -0
  31. package/src/components/form/inputs/Datepicker/index.test.tsx +117 -0
  32. package/src/components/form/inputs/FileDropzone.tsx +1 -0
  33. package/src/components/form/inputs/FileUpload.tsx +1 -0
  34. package/src/components/form/inputs/NumberStepper.tsx +1 -0
  35. package/src/components/form/inputs/PhoneInputFormControl/index.tsx +1 -1
  36. package/src/components/form/inputs/RadioButtonGroup.test.tsx +71 -0
  37. package/src/components/form/inputs/RadioButtonGroup.tsx +1 -0
  38. package/src/components/form/inputs/Select/index.test.tsx +57 -0
  39. package/src/components/form/inputs/Select/index.tsx +2 -0
  40. package/src/components/layout/Footer/index.test.tsx +13 -0
  41. package/src/components/layout/Footer/index.tsx +5 -2
  42. package/src/library/index.ts +6 -0
  43. package/src/library/types.ts +26 -0
  44. package/src/stories/components/display/AdvancedList.stories.tsx +131 -0
  45. package/src/stories/components/display/CardShell.stories.tsx +261 -0
  46. package/src/stories/components/inputs/DatePicker.stories.tsx +105 -9
  47. package/src/theme/cards.ts +60 -0
  48. package/src/theme/light/MuiPickersLayout.ts +10 -1
  49. package/src/theme/light/MuiPickersOutlinedInput.ts +88 -0
  50. package/src/theme/light/index.tsx +2 -0
@@ -23,6 +23,7 @@ export declare const Main: Story;
23
23
  export declare const Error: Story;
24
24
  export declare const KitchenSink: Story;
25
25
  export declare const OwnerTypeExpand: Story;
26
+ export declare const RadioBranchForm: Story;
26
27
  export declare const FigmaAnatomy: Story;
27
28
  export declare const LeadingOptions: Story;
28
29
  export declare const TrailingOptions: Story;
@@ -0,0 +1,17 @@
1
+ import { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { default as RcSesCardShell } from '../../../components/common/CardShell';
3
+ declare const meta: Meta<typeof RcSesCardShell>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RcSesCardShell>;
6
+ export declare const Default: Story;
7
+ export declare const SubcardVariant: Story;
8
+ export declare const BrandTheme: Story;
9
+ export declare const SunkenTheme: Story;
10
+ export declare const HeaderComplete: Story;
11
+ export declare const WithoutHeader: Story;
12
+ export declare const FooterSingleLink: Story;
13
+ export declare const WithoutFooter: Story;
14
+ export declare const ContentOnly: Story;
15
+ export declare const FullHeight: Story;
16
+ export declare const MobileViewport: Story;
17
+ export declare const TabletViewport: Story;
@@ -37,9 +37,116 @@ export declare const CalendarOpen: {
37
37
  };
38
38
  parameters: {
39
39
  docs: {
40
+ story: {
41
+ inline: boolean;
42
+ iframeHeight: number;
43
+ };
40
44
  description: {
41
45
  story: string;
42
46
  };
43
47
  };
44
48
  };
45
49
  };
50
+ /**
51
+ * Days past the 20th are out of range: they must read as greyed out, not merely
52
+ * be unclickable. Disabled weekends stay red.
53
+ */
54
+ export declare const CalendarWithDisabledDates: {
55
+ render: (args: any) => import("react").JSX.Element;
56
+ parameters: {
57
+ docs: {
58
+ story: {
59
+ inline: boolean;
60
+ iframeHeight: number;
61
+ };
62
+ };
63
+ };
64
+ args: {
65
+ clearable: boolean;
66
+ label: string;
67
+ open: boolean;
68
+ rules: {
69
+ required: boolean;
70
+ };
71
+ datepickerProps: {
72
+ maxDate: Date;
73
+ };
74
+ };
75
+ };
76
+ /**
77
+ * A scattered rule rather than a range, so disabled days sit between selectable
78
+ * ones.
79
+ */
80
+ export declare const CalendarWithDisabledRule: {
81
+ render: (args: any) => import("react").JSX.Element;
82
+ parameters: {
83
+ docs: {
84
+ story: {
85
+ inline: boolean;
86
+ iframeHeight: number;
87
+ };
88
+ };
89
+ };
90
+ args: {
91
+ clearable: boolean;
92
+ label: string;
93
+ open: boolean;
94
+ rules: {
95
+ required: boolean;
96
+ };
97
+ datepickerProps: {
98
+ shouldDisableDate: (date: Date) => boolean;
99
+ };
100
+ };
101
+ };
102
+ /**
103
+ * Covers the `Mui-selected` day styling.
104
+ */
105
+ export declare const CalendarWithValue: {
106
+ render: (args: any) => import("react").JSX.Element;
107
+ parameters: {
108
+ docs: {
109
+ story: {
110
+ inline: boolean;
111
+ iframeHeight: number;
112
+ };
113
+ };
114
+ };
115
+ args: {
116
+ clearable: boolean;
117
+ label: string;
118
+ open: boolean;
119
+ rules: {
120
+ required: boolean;
121
+ };
122
+ value: string;
123
+ };
124
+ };
125
+ /**
126
+ * The whole field disabled - a different state from a disabled day.
127
+ */
128
+ export declare const Disabled: {
129
+ render: (args: any) => import("react").JSX.Element;
130
+ args: {
131
+ clearable: boolean;
132
+ disabled: boolean;
133
+ label: string;
134
+ rules: {
135
+ required: boolean;
136
+ };
137
+ };
138
+ };
139
+ /**
140
+ * The error state: input border and helper text.
141
+ */
142
+ export declare const WithError: {
143
+ render: (args: any) => import("react").JSX.Element;
144
+ args: {
145
+ clearable: boolean;
146
+ error: string;
147
+ label: string;
148
+ rules: {
149
+ required: boolean;
150
+ };
151
+ };
152
+ };
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Card surface tokens - Figma `Cards/card/*` and `Cards/subcard/*`.
3
+ *
4
+ * The boxed surface lives here rather than in the component that draws it, so
5
+ * anything needing a boxed row reads the same values instead of copying them.
6
+ * `MuiCard` keeps its own radius until `RcSesCard` is deprecated.
7
+ */
8
+ declare const borderWidth = "1px";
9
+ declare const card: {
10
+ borderRadius: string;
11
+ gap: {
12
+ xs: string;
13
+ md: string;
14
+ };
15
+ padding: {
16
+ xs: string;
17
+ md: string;
18
+ };
19
+ };
20
+ declare const subcard: {
21
+ borderRadius: string;
22
+ gap: {
23
+ xs: string;
24
+ md: string;
25
+ };
26
+ padding: {
27
+ xs: string;
28
+ md: string;
29
+ };
30
+ };
31
+ /**
32
+ * Card header values. Two of them are departures from the type scale: the title
33
+ * is `h6` at weight 600 rather than 500, and the description is `body2` on a
34
+ * 1.25rem line. The three gaps follow the surrounding components - the row gap
35
+ * matches the card gap and the actions gap matches the footer - rather than a
36
+ * measured token. All six are pending confirmation against the DS.
37
+ */
38
+ declare const header: {
39
+ actionsGap: string;
40
+ badgeGap: string;
41
+ descriptionLineHeight: string;
42
+ gap: string;
43
+ rowGap: string;
44
+ titleFontWeight: number;
45
+ };
46
+ declare const footer: {
47
+ gap: string;
48
+ };
49
+ declare const themes: {
50
+ brand: {
51
+ backgroundColor: string;
52
+ borderColor: string;
53
+ };
54
+ default: {
55
+ backgroundColor: string;
56
+ borderColor: string;
57
+ };
58
+ sunken: {
59
+ backgroundColor: string;
60
+ borderColor: string;
61
+ };
62
+ };
63
+ export { borderWidth, card, footer, header, subcard, themes };
64
+ declare const _default: {
65
+ borderWidth: string;
66
+ card: {
67
+ borderRadius: string;
68
+ gap: {
69
+ xs: string;
70
+ md: string;
71
+ };
72
+ padding: {
73
+ xs: string;
74
+ md: string;
75
+ };
76
+ };
77
+ footer: {
78
+ gap: string;
79
+ };
80
+ header: {
81
+ actionsGap: string;
82
+ badgeGap: string;
83
+ descriptionLineHeight: string;
84
+ gap: string;
85
+ rowGap: string;
86
+ titleFontWeight: number;
87
+ };
88
+ subcard: {
89
+ borderRadius: string;
90
+ gap: {
91
+ xs: string;
92
+ md: string;
93
+ };
94
+ padding: {
95
+ xs: string;
96
+ md: string;
97
+ };
98
+ };
99
+ themes: {
100
+ brand: {
101
+ backgroundColor: string;
102
+ borderColor: string;
103
+ };
104
+ default: {
105
+ backgroundColor: string;
106
+ borderColor: string;
107
+ };
108
+ sunken: {
109
+ backgroundColor: string;
110
+ borderColor: string;
111
+ };
112
+ };
113
+ };
114
+ export default _default;
@@ -0,0 +1,8 @@
1
+ import { PickerComponents } from '@mui/x-date-pickers/themeAugmentation';
2
+ /**
3
+ * x-date-pickers 9 gives the picker its own field components, which none of the
4
+ * `MuiInputBase` / `MuiOutlinedInput` slots reach. This mirrors them onto the
5
+ * picker slots - keep the two in step.
6
+ */
7
+ declare const MuiPickersOutlinedInput: PickerComponents['MuiPickersOutlinedInput'];
8
+ export default MuiPickersOutlinedInput;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@registrucentras/rc-ses-react-components",
3
3
  "author": "VĮ REGISTRŲ CENTRAS",
4
- "version": "2.0.0-rc.1",
4
+ "version": "2.0.0-rc.3",
5
5
  "description": "RC SES React komponentų biblioteka",
6
6
  "type": "module",
7
7
  "private": false,
@@ -157,8 +157,12 @@ const AdvancedListItemLeading = ({
157
157
  >
158
158
  <Typography
159
159
  variant='body2'
160
- sx={{ fontSize: '0.9375rem', fontWeight: 400, lineHeight: '1.375rem' }}
161
- color={palette.grey[600]}
160
+ sx={{
161
+ color: palette.grey[600],
162
+ fontSize: '0.9375rem',
163
+ fontWeight: 400,
164
+ lineHeight: '1.375rem',
165
+ }}
162
166
  >
163
167
  {leading.index}
164
168
  </Typography>
@@ -146,16 +146,23 @@ const AdvancedListItemTrailing = ({ trailing, disabled }: Props) => {
146
146
  <Box sx={PRICE_BLOCK_SX}>
147
147
  <Typography
148
148
  variant='body1'
149
- sx={{ fontSize: '1rem', fontWeight: 600, lineHeight: '1.375rem' }}
150
- color={palette.grey[900]}
149
+ sx={{
150
+ color: palette.grey[900],
151
+ fontSize: '1rem',
152
+ fontWeight: 600,
153
+ lineHeight: '1.375rem',
154
+ }}
151
155
  >
152
156
  {trailing.amount}
153
157
  </Typography>
154
158
  {!!trailing.caption && (
155
159
  <Typography
156
160
  variant='caption'
157
- sx={{ fontSize: '0.8125rem', lineHeight: '1.125rem' }}
158
- color={palette.grey[600]}
161
+ sx={{
162
+ color: palette.grey[600],
163
+ fontSize: '0.8125rem',
164
+ lineHeight: '1.125rem',
165
+ }}
159
166
  >
160
167
  {trailing.caption}
161
168
  </Typography>
@@ -265,8 +265,12 @@ const AdvancedListItem = ({
265
265
  <Typography
266
266
  id={titleId}
267
267
  variant='h3'
268
- sx={{ fontSize: '1rem', fontWeight: 600, lineHeight: '1.375rem' }}
269
- color={palette.grey[900]}
268
+ sx={{
269
+ color: palette.grey[900],
270
+ fontSize: '1rem',
271
+ fontWeight: 600,
272
+ lineHeight: '1.375rem',
273
+ }}
270
274
  >
271
275
  {title}
272
276
  </Typography>
@@ -276,8 +280,12 @@ const AdvancedListItem = ({
276
280
  {!!subtitle && (
277
281
  <Typography
278
282
  variant='body2'
279
- sx={{ fontSize: '0.875rem', fontWeight: 400, lineHeight: '1.25rem' }}
280
- color={palette.grey[600]}
283
+ sx={{
284
+ color: palette.grey[600],
285
+ fontSize: '0.875rem',
286
+ fontWeight: 400,
287
+ lineHeight: '1.25rem',
288
+ }}
281
289
  >
282
290
  {subtitle}
283
291
  </Typography>
@@ -162,12 +162,12 @@ function RcSesCard({
162
162
  ]}
163
163
  >
164
164
  <Typography
165
- color={palette.grey[900]}
166
165
  data-testid={testIds?.title}
167
166
  variant='h5'
168
167
  {...titleProps}
169
168
  sx={[
170
169
  {
170
+ color: palette.grey[900],
171
171
  lineHeight: '1.75rem',
172
172
  ...(centered ? { textAlign: 'center' } : {}),
173
173
  },
@@ -179,12 +179,12 @@ function RcSesCard({
179
179
 
180
180
  {!!description && (
181
181
  <Typography
182
- color={palette.grey[800]}
183
182
  data-testid={testIds?.description}
184
183
  variant='body2'
185
184
  {...descriptionProps}
186
185
  sx={[
187
186
  {
187
+ color: palette.grey[800],
188
188
  fontWeight: 300,
189
189
  lineHeight: '1.25rem',
190
190
  ...(centered ? { textAlign: 'center' } : {}),
@@ -0,0 +1,52 @@
1
+ import { ThemeProvider } from '@mui/material/styles'
2
+ import '@testing-library/jest-dom'
3
+ import { render, screen } from '@testing-library/react'
4
+ import { type ReactElement } from 'react'
5
+ import { describe, expect, test } from 'vitest'
6
+
7
+ import theme from '@/theme/light'
8
+
9
+ import RcSesCardFooter from '.'
10
+
11
+ const renderCardFooter = (ui: ReactElement) =>
12
+ render(<ThemeProvider theme={theme}>{ui}</ThemeProvider>)
13
+
14
+ describe('RcSesCardFooter', () => {
15
+ test('renders its children', () => {
16
+ renderCardFooter(
17
+ <RcSesCardFooter>
18
+ <button type='button'>Atšaukti</button>
19
+ <button type='button'>Tęsti</button>
20
+ </RcSesCardFooter>,
21
+ )
22
+
23
+ expect(screen.getByRole('button', { name: 'Atšaukti' })).toBeInTheDocument()
24
+ expect(screen.getByRole('button', { name: 'Tęsti' })).toBeInTheDocument()
25
+ })
26
+
27
+ test('defaults to pushing the first and last child apart', () => {
28
+ renderCardFooter(
29
+ <RcSesCardFooter testIds={{ root: 'footer' }}>
30
+ <button type='button'>Tęsti</button>
31
+ </RcSesCardFooter>,
32
+ )
33
+
34
+ expect(screen.getByTestId('footer')).toHaveStyle({
35
+ justifyContent: 'space-between',
36
+ })
37
+ })
38
+
39
+ test.each([
40
+ ['start', 'flex-start'],
41
+ ['between', 'space-between'],
42
+ ['end', 'flex-end'],
43
+ ] as const)('align="%s" maps to justify-content %s', (align, expected) => {
44
+ renderCardFooter(
45
+ <RcSesCardFooter align={align} testIds={{ root: 'footer' }}>
46
+ <button type='button'>Tęsti</button>
47
+ </RcSesCardFooter>,
48
+ )
49
+
50
+ expect(screen.getByTestId('footer')).toHaveStyle({ justifyContent: expected })
51
+ })
52
+ })
@@ -0,0 +1,38 @@
1
+ import { Stack } from '@mui/material'
2
+
3
+ import cards from '@/theme/cards'
4
+
5
+ import { CardFooterAlign, RcSesCardFooterProps } from './types'
6
+
7
+ const justifyContent: Record<CardFooterAlign, string> = {
8
+ between: 'space-between',
9
+ end: 'flex-end',
10
+ start: 'flex-start',
11
+ }
12
+
13
+ function RcSesCardFooter({
14
+ children,
15
+ align = 'between',
16
+ stretchOnMobile = true,
17
+ className,
18
+ testIds,
19
+ }: RcSesCardFooterProps) {
20
+ return (
21
+ <Stack
22
+ className={className}
23
+ data-testid={testIds?.root}
24
+ direction={{ xs: 'column', sm: 'row' }}
25
+ spacing={cards.footer.gap}
26
+ sx={{
27
+ alignItems: 'center',
28
+ justifyContent: justifyContent[align],
29
+ width: '100%',
30
+ ...(stretchOnMobile ? { '& > *': { width: { xs: '100%', sm: 'auto' } } } : {}),
31
+ }}
32
+ >
33
+ {children}
34
+ </Stack>
35
+ )
36
+ }
37
+
38
+ export default RcSesCardFooter
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from 'react'
2
+
3
+ export type CardFooterAlign = 'start' | 'between' | 'end'
4
+
5
+ export type RcSesCardFooterTestIds = {
6
+ root?: string
7
+ }
8
+
9
+ export type RcSesCardFooterProps = {
10
+ children?: ReactNode
11
+ /**
12
+ * Horizontal distribution of the row. `between` pushes the first and last
13
+ * child apart, which is the cancel/continue pattern; `end` is the single
14
+ * primary action; `start` is a lone link such as "Žiūrėti visas".
15
+ */
16
+ align?: CardFooterAlign
17
+ /**
18
+ * Whether direct children stretch to the full width once the row stacks.
19
+ * Right for buttons, wrong for a text link, which is why it is a prop.
20
+ */
21
+ stretchOnMobile?: boolean
22
+ className?: string
23
+ testIds?: RcSesCardFooterTestIds
24
+ }