@registrucentras/rc-ses-react-components 1.8.0 → 1.10.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.
Files changed (44) hide show
  1. package/dist/assets/icons/PencilSimpleLineIcon.d.ts +1 -1
  2. package/dist/components/common/SegmentedControl/components/SegmentButton/index.d.ts +19 -0
  3. package/dist/components/common/SegmentedControl/index.d.ts +14 -0
  4. package/dist/components/form/inputs/SearchInput/index.d.ts +10 -0
  5. package/dist/components/loaders/FullPageLoader/index.d.ts +9 -0
  6. package/dist/components/loaders/Loader/index.d.ts +26 -0
  7. package/dist/library/index.d.ts +6 -2
  8. package/dist/library/types.d.ts +6 -2
  9. package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
  10. package/dist/registrucentras-rc-ses-react-components.js +2569 -2277
  11. package/dist/stories/components/display/SegmentedControl.stories.d.ts +202 -0
  12. package/dist/stories/components/loaders/FullPageLoader.stories.d.ts +37 -0
  13. package/dist/stories/components/loaders/Loader.stories.d.ts +36 -0
  14. package/dist/stories/components/{spinner → loaders}/LoadingSpinner.stories.d.ts +4 -4
  15. package/package.json +1 -1
  16. package/src/assets/icons/PencilSimpleLineIcon.tsx +8 -2
  17. package/src/components/common/Button/index.tsx +1 -3
  18. package/src/components/common/SegmentedControl/components/SegmentButton/index.test.tsx +85 -0
  19. package/src/components/common/SegmentedControl/components/SegmentButton/index.tsx +110 -0
  20. package/src/components/common/SegmentedControl/index.test.tsx +164 -0
  21. package/src/components/common/SegmentedControl/index.tsx +188 -0
  22. package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +74 -1
  23. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +16 -1
  24. package/src/components/common/Snackbar/index.test.tsx +10 -4
  25. package/src/components/form/inputs/CheckboxFormControl.test.tsx +11 -7
  26. package/src/components/form/inputs/SearchInput/index.test.tsx +68 -2
  27. package/src/components/form/inputs/SearchInput/index.tsx +24 -13
  28. package/src/components/loaders/FullPageLoader/index.test.tsx +80 -0
  29. package/src/components/loaders/FullPageLoader/index.tsx +68 -0
  30. package/src/components/loaders/Loader/index.test.tsx +58 -0
  31. package/src/components/loaders/Loader/index.tsx +65 -0
  32. package/src/components/{LoadingSpinner/LoadingSpinner.test.tsx → loaders/LoadingSpinner/index.test.tsx} +1 -1
  33. package/src/components/{LoadingSpinner/LoadingSpinner.tsx → loaders/LoadingSpinner/index.tsx} +1 -1
  34. package/src/components/overlays/Dialog/index.test.tsx +1 -1
  35. package/src/i18n/namespaces/common/en.json +7 -0
  36. package/src/i18n/namespaces/common/lt.json +7 -0
  37. package/src/library/index.ts +7 -1
  38. package/src/library/types.ts +21 -4
  39. package/src/setupTests.ts +13 -0
  40. package/src/stories/components/display/SegmentedControl.stories.tsx +311 -0
  41. package/src/stories/components/loaders/FullPageLoader.stories.tsx +126 -0
  42. package/src/stories/components/loaders/Loader.stories.tsx +76 -0
  43. package/src/stories/components/{spinner → loaders}/LoadingSpinner.stories.tsx +2 -2
  44. /package/dist/components/{LoadingSpinner/LoadingSpinner.d.ts → loaders/LoadingSpinner/index.d.ts} +0 -0
@@ -0,0 +1,311 @@
1
+ import type { Meta } from '@storybook/react'
2
+ import { useState } from 'react'
3
+
4
+ import RcSesSegmentedControl from '../../../components/common/SegmentedControl'
5
+
6
+ const meta = {
7
+ title: 'components/display/SegmentedControl',
8
+ component: RcSesSegmentedControl,
9
+ parameters: {
10
+ layout: 'centered',
11
+ },
12
+ tags: ['autodocs'],
13
+ argTypes: {
14
+ options: {
15
+ control: false,
16
+ description: 'Array of options to display',
17
+ },
18
+ value: {
19
+ control: 'text',
20
+ description: 'Currently selected option ID',
21
+ },
22
+ onChange: {
23
+ control: false,
24
+ description: 'Callback when selection changes',
25
+ },
26
+ size: {
27
+ control: 'radio',
28
+ options: ['small', 'regular'],
29
+ description: 'Size of the segmented control',
30
+ },
31
+ role: {
32
+ control: 'radio',
33
+ options: ['radiogroup', 'tablist'],
34
+ description: 'ARIA role for accessibility',
35
+ },
36
+ disableBg: {
37
+ control: 'boolean',
38
+ description: 'Disable container background',
39
+ },
40
+ },
41
+ } satisfies Meta<typeof RcSesSegmentedControl>
42
+
43
+ export default meta
44
+
45
+ const DefaultComponent = ({
46
+ options,
47
+ value: initialValue,
48
+ onChange,
49
+ size,
50
+ role,
51
+ disableBg,
52
+ }: any) => {
53
+ const [value, setValue] = useState(initialValue)
54
+ return (
55
+ <RcSesSegmentedControl
56
+ options={options}
57
+ value={value}
58
+ onChange={(newValue) => {
59
+ setValue(newValue)
60
+ onChange?.(newValue)
61
+ }}
62
+ size={size}
63
+ role={role}
64
+ disableBg={disableBg}
65
+ />
66
+ )
67
+ }
68
+
69
+ export const Default = {
70
+ args: {
71
+ options: [
72
+ { id: '1', label: 'Fizinis asmuo' },
73
+ { id: '2', label: 'Juridinis asmuo' },
74
+ { id: '3', label: 'Advokatas' },
75
+ ],
76
+ value: '1',
77
+ onChange: () => {},
78
+ size: 'regular' as const,
79
+ role: 'radiogroup' as const,
80
+ disableBg: false,
81
+ },
82
+ render: ({ options, value: initialValue, onChange, size, role, disableBg }: any) => (
83
+ <DefaultComponent
84
+ options={options}
85
+ value={initialValue}
86
+ onChange={onChange}
87
+ size={size}
88
+ role={role}
89
+ disableBg={disableBg}
90
+ />
91
+ ),
92
+ } as const
93
+
94
+ export const RegularTwoOptions = {
95
+ args: {
96
+ options: [
97
+ { id: '1', label: 'Fizinis asmuo' },
98
+ { id: '2', label: 'Juridinis asmuo' },
99
+ ],
100
+ value: '1',
101
+ size: 'regular',
102
+ },
103
+ render: (args: any) => <DefaultComponent {...args} />,
104
+ parameters: {
105
+ docs: {
106
+ source: {
107
+ code: `const [value, setValue] = useState('1');
108
+
109
+ <RcSesSegmentedControl
110
+ options={[
111
+ { id: '1', label: 'Fizinis asmuo' },
112
+ { id: '2', label: 'Juridinis asmuo' },
113
+ ]}
114
+ value={value}
115
+ onChange={(newValue) => setValue(newValue)}
116
+ size="regular"
117
+ />`,
118
+ },
119
+ },
120
+ },
121
+ } as const
122
+
123
+ export const RegularFourOptions = {
124
+ args: {
125
+ options: [
126
+ { id: '1', label: 'Fizinis asmuo' },
127
+ { id: '2', label: 'Juridinis asmuo' },
128
+ { id: '3', label: 'Advokatas' },
129
+ { id: '4', label: 'Labai ilgas tekstas, netelpantis į vieną eilutę' },
130
+ ],
131
+ value: '1',
132
+ size: 'regular',
133
+ },
134
+ render: (args: any) => <DefaultComponent {...args} />,
135
+ parameters: {
136
+ docs: {
137
+ source: {
138
+ code: `const [value, setValue] = useState('1');
139
+
140
+ <RcSesSegmentedControl
141
+ options={[
142
+ { id: '1', label: 'Fizinis asmuo' },
143
+ { id: '2', label: 'Juridinis asmuo' },
144
+ { id: '3', label: 'Advokatas' },
145
+ { id: '4', label: 'Labai ilgas tekstas, netelpantis į vieną eilutę' },
146
+ ]}
147
+ value={value}
148
+ onChange={(newValue) => setValue(newValue)}
149
+ size="regular"
150
+ />`,
151
+ },
152
+ },
153
+ },
154
+ }
155
+
156
+ export const RegularWithDisabled = {
157
+ args: {
158
+ options: [
159
+ { id: '1', label: 'Fizinis asmuo' },
160
+ { id: '2', label: 'Juridinis asmuo (Disabled)', disabled: true },
161
+ { id: '3', label: 'Advokatas' },
162
+ ],
163
+ value: '1',
164
+ size: 'regular',
165
+ },
166
+ render: (args: any) => <DefaultComponent {...args} />,
167
+ parameters: {
168
+ docs: {
169
+ source: {
170
+ code: `const [value, setValue] = useState('1');
171
+
172
+ <RcSesSegmentedControl
173
+ options={[
174
+ { id: '1', label: 'Fizinis asmuo' },
175
+ { id: '2', label: 'Juridinis asmuo', disabled: true },
176
+ { id: '3', label: 'Advokatas' },
177
+ ]}
178
+ value={value}
179
+ onChange={(newValue) => setValue(newValue)}
180
+ size="regular"
181
+ />`,
182
+ },
183
+ },
184
+ },
185
+ }
186
+
187
+ export const SmallTwoOptions = {
188
+ args: {
189
+ options: [
190
+ { id: '1', label: 'Fizinis asmuo' },
191
+ { id: '2', label: 'Juridinis asmuo' },
192
+ ],
193
+ value: '1',
194
+ size: 'small',
195
+ },
196
+ render: (args: any) => <DefaultComponent {...args} />,
197
+ parameters: {
198
+ docs: {
199
+ source: {
200
+ code: `const [value, setValue] = useState('1');
201
+
202
+ <RcSesSegmentedControl
203
+ options={[
204
+ { id: '1', label: 'Fizinis asmuo' },
205
+ { id: '2', label: 'Juridinis asmuo' },
206
+ ]}
207
+ value={value}
208
+ onChange={(newValue) => setValue(newValue)}
209
+ size="small"
210
+ />`,
211
+ },
212
+ },
213
+ },
214
+ } as const
215
+
216
+ export const SmallFourOptions = {
217
+ args: {
218
+ options: [
219
+ { id: '1', label: 'Fizinis asmuo' },
220
+ { id: '2', label: 'Juridinis asmuo' },
221
+ { id: '3', label: 'Advokatas' },
222
+ { id: '4', label: 'Kita' },
223
+ ],
224
+ value: '1',
225
+ size: 'small',
226
+ },
227
+ render: (args: any) => <DefaultComponent {...args} />,
228
+ parameters: {
229
+ docs: {
230
+ source: {
231
+ code: `const [value, setValue] = useState('1');
232
+
233
+ <RcSesSegmentedControl
234
+ options={[
235
+ { id: '1', label: 'Fizinis asmuo' },
236
+ { id: '2', label: 'Juridinis asmuo' },
237
+ { id: '3', label: 'Advokatas' },
238
+ { id: '4', label: 'Kita' },
239
+ ]}
240
+ value={value}
241
+ onChange={(newValue) => setValue(newValue)}
242
+ size="small"
243
+ />`,
244
+ },
245
+ },
246
+ },
247
+ }
248
+
249
+ export const SmallWithDisabled = {
250
+ args: {
251
+ options: [
252
+ { id: '1', label: 'Fizinis asmuo' },
253
+ { id: '2', label: 'Juridinis asmuo (Disabled)', disabled: true },
254
+ { id: '3', label: 'Advokatas' },
255
+ ],
256
+ value: '1',
257
+ size: 'small',
258
+ },
259
+ render: (args: any) => <DefaultComponent {...args} />,
260
+ parameters: {
261
+ docs: {
262
+ source: {
263
+ code: `const [value, setValue] = useState('1');
264
+
265
+ <RcSesSegmentedControl
266
+ options={[
267
+ { id: '1', label: 'Fizinis asmuo' },
268
+ { id: '2', label: 'Juridinis asmuo', disabled: true },
269
+ { id: '3', label: 'Advokatas' },
270
+ ]}
271
+ value={value}
272
+ onChange={(newValue) => setValue(newValue)}
273
+ size="small"
274
+ />`,
275
+ },
276
+ },
277
+ },
278
+ }
279
+
280
+ export const RegularNoBackground = {
281
+ args: {
282
+ options: [
283
+ { id: '1', label: 'Fizinis asmuo' },
284
+ { id: '2', label: 'Juridinis asmuo' },
285
+ { id: '3', label: 'Advokatas' },
286
+ ],
287
+ value: '1',
288
+ size: 'regular',
289
+ disableBg: true,
290
+ },
291
+ render: (args: any) => <DefaultComponent {...args} />,
292
+ parameters: {
293
+ docs: {
294
+ source: {
295
+ code: `const [value, setValue] = useState('1');
296
+
297
+ <RcSesSegmentedControl
298
+ options={[
299
+ { id: '1', label: 'Fizinis asmuo' },
300
+ { id: '2', label: 'Juridinis asmuo' },
301
+ { id: '3', label: 'Advokatas' },
302
+ ]}
303
+ value={value}
304
+ onChange={(newValue) => setValue(newValue)}
305
+ size="regular"
306
+ disableBg
307
+ />`,
308
+ },
309
+ },
310
+ },
311
+ }
@@ -0,0 +1,126 @@
1
+ import { Box, Stack } from '@mui/material'
2
+ import type { Meta, StoryObj } from '@storybook/react'
3
+
4
+ import RcSesFullPageLoader from '@/components/loaders/FullPageLoader'
5
+
6
+ const meta = {
7
+ title: 'components/loaders/FullPageLoader/FullPageLoader',
8
+ component: RcSesFullPageLoader,
9
+ tags: ['autodocs'],
10
+ parameters: {
11
+ controls: {
12
+ include: ['backdrop', 'label', 'showLabel'],
13
+ },
14
+ docs: {
15
+ story: {
16
+ inline: false,
17
+ height: 400,
18
+ },
19
+ description: {
20
+ component:
21
+ 'Full-page loader overlay built on top of RcSesLoader with two backdrop variants: dark and light.',
22
+ },
23
+ },
24
+ },
25
+ argTypes: {
26
+ backdrop: {
27
+ control: 'radio',
28
+ options: ['dark', 'light'],
29
+ },
30
+ label: {
31
+ control: 'text',
32
+ },
33
+ showLabel: {
34
+ control: 'boolean',
35
+ },
36
+ },
37
+ } satisfies Meta<typeof RcSesFullPageLoader>
38
+
39
+ export default meta
40
+
41
+ type Story = StoryObj<typeof meta>
42
+
43
+ const FULL_PAGE_LOADER_USAGE_EXAMPLE =
44
+ "<RcSesFullPageLoader label='Kraunama...' showLabel />"
45
+
46
+ const FULL_PAGE_LOADER_DARK_USAGE_EXAMPLE =
47
+ "<RcSesFullPageLoader backdrop='dark' label='Kraunama...' showLabel />"
48
+
49
+ function PageMock() {
50
+ return (
51
+ <Stack spacing={2} sx={{ p: 4 }}>
52
+ <Box
53
+ sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '35%' }}
54
+ />
55
+ <Box
56
+ sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '48%' }}
57
+ />
58
+ <Box
59
+ sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 12, width: '42%' }}
60
+ />
61
+ <Box
62
+ sx={{
63
+ backgroundColor: 'grey.200',
64
+ borderRadius: 1,
65
+ height: 112,
66
+ mt: 1,
67
+ width: '100%',
68
+ }}
69
+ />
70
+ <Box
71
+ sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 88, width: '100%' }}
72
+ />
73
+ <Box
74
+ sx={{ backgroundColor: 'grey.200', borderRadius: 1, height: 56, width: '65%' }}
75
+ />
76
+ </Stack>
77
+ )
78
+ }
79
+
80
+ const renderPreview: Story['render'] = (args) => (
81
+ <Stack spacing={1.5} sx={{ width: '100%' }}>
82
+ <Box
83
+ sx={{
84
+ backgroundColor: '#f4f6f8',
85
+ borderRadius: 1,
86
+ minHeight: 360,
87
+ overflow: 'hidden',
88
+ position: 'relative',
89
+ width: '100%',
90
+ }}
91
+ >
92
+ <PageMock />
93
+ <RcSesFullPageLoader {...args} />
94
+ </Box>
95
+ </Stack>
96
+ )
97
+
98
+ export const Default: Story = {
99
+ render: renderPreview,
100
+ parameters: {
101
+ docs: {
102
+ source: {
103
+ code: FULL_PAGE_LOADER_USAGE_EXAMPLE,
104
+ },
105
+ },
106
+ },
107
+ args: {
108
+ label: 'Kraunama...',
109
+ showLabel: true,
110
+ },
111
+ }
112
+
113
+ export const DarkBackdrop: Story = {
114
+ render: renderPreview,
115
+ parameters: {
116
+ docs: {
117
+ source: {
118
+ code: FULL_PAGE_LOADER_DARK_USAGE_EXAMPLE,
119
+ },
120
+ },
121
+ },
122
+ args: {
123
+ backdrop: 'dark',
124
+ label: 'Kraunama...',
125
+ },
126
+ }
@@ -0,0 +1,76 @@
1
+ import type { Meta, StoryObj } from '@storybook/react'
2
+
3
+ import RcSesLoader from '@/components/loaders/Loader'
4
+
5
+ const meta = {
6
+ title: 'components/loaders/Loader/Loader',
7
+ component: RcSesLoader,
8
+ tags: ['autodocs'],
9
+ parameters: {
10
+ controls: {
11
+ include: ['label', 'showLabel', 'size'],
12
+ },
13
+ docs: {
14
+ description: {
15
+ component:
16
+ 'Reusable loader built on top of RcSesLoadingSpinner. Supports three standard sizes for inline (small), section (medium), and full-page (large) loading states.',
17
+ },
18
+ },
19
+ },
20
+ argTypes: {
21
+ label: {
22
+ control: 'text',
23
+ },
24
+ showLabel: {
25
+ control: 'boolean',
26
+ },
27
+ size: {
28
+ control: 'radio',
29
+ options: ['small', 'medium', 'large'],
30
+ },
31
+ },
32
+ } satisfies Meta<typeof RcSesLoader>
33
+
34
+ export default meta
35
+
36
+ type Story = StoryObj<typeof meta>
37
+
38
+ export const Default: Story = {
39
+ args: {
40
+ label: 'Kraunama...',
41
+ showLabel: true,
42
+ size: 'medium',
43
+ },
44
+ }
45
+
46
+ export const Small: Story = {
47
+ args: {
48
+ label: 'Kraunama...',
49
+ showLabel: true,
50
+ size: 'small',
51
+ },
52
+ }
53
+
54
+ export const Medium: Story = {
55
+ args: {
56
+ label: 'Kraunama...',
57
+ showLabel: true,
58
+ size: 'medium',
59
+ },
60
+ }
61
+
62
+ export const Large: Story = {
63
+ args: {
64
+ label: 'Kraunama...',
65
+ showLabel: true,
66
+ size: 'large',
67
+ },
68
+ }
69
+
70
+ export const WithoutLabel: Story = {
71
+ args: {
72
+ label: 'Kraunama...',
73
+ showLabel: false,
74
+ size: 'medium',
75
+ },
76
+ }
@@ -2,7 +2,7 @@ import type { Meta, StoryObj } from '@storybook/react'
2
2
 
3
3
  import RcSesLoadingSpinner, {
4
4
  RcSesSpinnerColor,
5
- } from '@/components/LoadingSpinner/LoadingSpinner'
5
+ } from '@/components/loaders/LoadingSpinner'
6
6
 
7
7
  const colorOptions: RcSesSpinnerColor[] = [
8
8
  'primary',
@@ -17,7 +17,7 @@ const colorOptions: RcSesSpinnerColor[] = [
17
17
  const sizeOptions = ['small', 'medium', 'large']
18
18
 
19
19
  const meta = {
20
- title: 'components/actions/LoadingSpinner',
20
+ title: 'components/loaders/LoadingSpinner/LoadingSpinner',
21
21
  component: RcSesLoadingSpinner,
22
22
  parameters: {
23
23
  layout: 'centered',