@registrucentras/rc-ses-react-components 1.6.4 → 1.6.6
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/IconProps.d.ts +2 -0
- package/dist/assets/icons/ArrowsClockwiseIcon.d.ts +3 -0
- package/dist/assets/icons/CheckIcon.d.ts +3 -0
- package/dist/assets/icons/PencilSimpleLineIcon.d.ts +3 -0
- package/dist/components/common/Card/index.d.ts +4 -1
- package/dist/components/form/inputs/SearchInput/index.d.ts +27 -0
- package/dist/components/form/inputs/Select/Select.types.d.ts +5 -0
- package/dist/components/form/inputs/Select/hooks/useFilteredOptions.d.ts +3 -0
- package/dist/components/form/inputs/Select/hooks/useSelectAllLogic.d.ts +7 -0
- package/dist/components/form/inputs/{Select.d.ts → Select/index.d.ts} +12 -12
- package/dist/library/icons.d.ts +3 -1
- package/dist/library/index.d.ts +2 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +11 -11
- package/dist/registrucentras-rc-ses-react-components.js +3346 -2752
- package/dist/stories/components/display/Card.stories.d.ts +6 -47
- package/dist/stories/components/display/ImageCard.stories.d.ts +6 -6
- package/dist/stories/components/feedback/Alert.stories.d.ts +7 -16
- package/dist/stories/components/form/CardFormContainer.stories.d.ts +5 -5
- package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +3 -23
- package/dist/stories/components/form/ServiceFormActions.stories.d.ts +3 -9
- package/dist/stories/components/icons/Icons.stories.d.ts +3 -2
- package/dist/stories/components/inputs/FileDropzone.stories.d.ts +3 -29
- package/dist/stories/components/inputs/NumberStepper.stories.d.ts +3 -31
- package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +4 -32
- package/dist/stories/components/inputs/SearchInput.stories.d.ts +11 -0
- package/dist/stories/components/inputs/SearchableField.stories.d.ts +3 -332
- package/dist/stories/components/inputs/Select.stories.d.ts +4 -871
- package/dist/stories/components/inputs/TextField.stories.d.ts +3 -610
- package/dist/stories/components/layout/Footer.stories.d.ts +3 -5
- package/dist/stories/components/navigation/Breadcrumbs.stories.d.ts +4 -6
- package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +5 -5
- package/dist/theme/light/MuiOutlinedInput.d.ts +3 -0
- package/package.json +1 -1
- package/src/assets/IconProps.ts +2 -0
- package/src/assets/icons/ArrowsClockwiseIcon.tsx +16 -0
- package/src/assets/icons/CheckIcon.tsx +23 -0
- package/src/assets/icons/PencilSimpleLineIcon.tsx +17 -0
- package/src/components/common/Card/index.test.tsx +8 -0
- package/src/components/common/Card/index.tsx +64 -25
- package/src/components/common/SelectableCardList/index.tsx +2 -1
- package/src/components/form/components/FormControlWrapper/index.tsx +6 -1
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +11 -3
- package/src/components/form/inputs/SearchInput/index.test.tsx +203 -0
- package/src/components/form/inputs/SearchInput/index.tsx +282 -0
- package/src/components/form/inputs/Select/Select.types.ts +5 -0
- package/src/components/form/inputs/Select/hooks/useFilteredOptions.ts +18 -0
- package/src/components/form/inputs/Select/hooks/useSelectAllLogic.ts +22 -0
- package/src/components/form/inputs/Select/index.tsx +494 -0
- package/src/i18n/namespaces/input/en.json +5 -0
- package/src/i18n/namespaces/input/lt.json +5 -0
- package/src/library/icons.ts +4 -0
- package/src/library/index.ts +2 -0
- package/src/stories/components/display/Card.stories.tsx +64 -47
- package/src/stories/components/display/ImageCard.stories.tsx +29 -27
- package/src/stories/components/feedback/Alert.stories.tsx +59 -50
- package/src/stories/components/form/CardFormContainer.stories.tsx +77 -63
- package/src/stories/components/form/CheckboxFormControl.stories.tsx +29 -71
- package/src/stories/components/form/ServiceFormActions.stories.tsx +18 -21
- package/src/stories/components/form/ServiceFormContainer.stories.tsx +1 -1
- package/src/stories/components/icons/Icons.stories.tsx +6 -2
- package/src/stories/components/inputs/FileDropzone.stories.tsx +17 -34
- package/src/stories/components/inputs/NumberStepper.stories.tsx +32 -60
- package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +22 -20
- package/src/stories/components/inputs/SearchInput.stories.tsx +134 -0
- package/src/stories/components/inputs/SearchableField.stories.tsx +16 -14
- package/src/stories/components/inputs/Select.stories.tsx +245 -13
- package/src/stories/components/inputs/TextField.stories.tsx +47 -47
- package/src/stories/components/layout/Footer.stories.tsx +6 -6
- package/src/stories/components/navigation/Breadcrumbs.stories.tsx +6 -8
- package/src/stories/components/navigation/ServiceWizardStepper.stories.tsx +29 -22
- package/src/theme/light/MuiAutocomplete.ts +52 -3
- package/src/theme/light/MuiOutlinedInput.ts +15 -0
- package/src/theme/light/index.tsx +2 -0
- package/src/components/form/inputs/Select.tsx +0 -152
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
1
|
+
import { Meta, StoryContext, StoryObj } from '@storybook/react'
|
|
3
2
|
import { useForm } from 'react-hook-form'
|
|
4
3
|
|
|
5
4
|
import RcSesNumberStepper from '@/components/form/inputs/NumberStepper'
|
|
@@ -18,48 +17,22 @@ const meta: Meta<typeof RcSesNumberStepper> = {
|
|
|
18
17
|
title: 'components/inputs/NumberStepper',
|
|
19
18
|
component: RcSesNumberStepper,
|
|
20
19
|
argTypes: {
|
|
21
|
-
id: {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
disable: true,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
control: {
|
|
32
|
-
table: {
|
|
33
|
-
disable: true,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
errors: {
|
|
37
|
-
table: {
|
|
38
|
-
disable: true,
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
onChange: {
|
|
42
|
-
table: {
|
|
43
|
-
disable: true,
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
onBlur: {
|
|
47
|
-
table: {
|
|
48
|
-
disable: true,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
rules: {
|
|
52
|
-
table: {
|
|
53
|
-
disable: true,
|
|
54
|
-
},
|
|
55
|
-
},
|
|
20
|
+
id: { table: { disable: true } },
|
|
21
|
+
name: { table: { disable: true } },
|
|
22
|
+
control: { table: { disable: true } },
|
|
23
|
+
errors: { table: { disable: true } },
|
|
24
|
+
onChange: { table: { disable: true } },
|
|
25
|
+
onBlur: { table: { disable: true } },
|
|
26
|
+
rules: { table: { disable: true } },
|
|
56
27
|
},
|
|
57
28
|
tags: ['autodocs'],
|
|
58
29
|
}
|
|
59
30
|
|
|
60
31
|
export default meta
|
|
61
32
|
|
|
62
|
-
|
|
33
|
+
type Story = StoryObj<typeof RcSesNumberStepper>
|
|
34
|
+
|
|
35
|
+
function NumberStepperDemo(args: any) {
|
|
63
36
|
const { control } = useForm<FormModel>({
|
|
64
37
|
mode: 'all',
|
|
65
38
|
defaultValues: { countable: 0, countable2: 0, countable3: 0 },
|
|
@@ -113,9 +86,7 @@ const Template: StoryFn<typeof RcSesNumberStepper> = (args) => {
|
|
|
113
86
|
}
|
|
114
87
|
|
|
115
88
|
const codeBlock = (args: any) => {
|
|
116
|
-
|
|
117
|
-
const { label, disabled, min, max, step, displayStepperControls, slotProps, name, id } =
|
|
118
|
-
args
|
|
89
|
+
const { label, disabled, min, max, step, name, id } = args
|
|
119
90
|
return `
|
|
120
91
|
import RcSesNumberStepper from '@/components/form/inputs/NumberStepper'
|
|
121
92
|
|
|
@@ -138,25 +109,26 @@ const codeBlock = (args: any) => {
|
|
|
138
109
|
);`
|
|
139
110
|
}
|
|
140
111
|
|
|
141
|
-
export const Main =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
112
|
+
export const Main: Story = {
|
|
113
|
+
render: (args) => <NumberStepperDemo {...args} />,
|
|
114
|
+
args: {
|
|
115
|
+
label: 'Label',
|
|
116
|
+
disabled: false,
|
|
117
|
+
min: 0,
|
|
118
|
+
max: 100,
|
|
119
|
+
step: 1,
|
|
120
|
+
displayStepperControls: true,
|
|
121
|
+
slotProps: { wrapper: { labelSubtitle: 'optional' } },
|
|
122
|
+
id: 'countable',
|
|
123
|
+
name: 'countable',
|
|
124
|
+
},
|
|
125
|
+
parameters: {
|
|
126
|
+
docs: {
|
|
127
|
+
source: {
|
|
128
|
+
type: 'dynamic',
|
|
129
|
+
transform: (_code: string, storyContext: StoryContext) =>
|
|
130
|
+
codeBlock(storyContext.args),
|
|
131
|
+
},
|
|
160
132
|
},
|
|
161
133
|
},
|
|
162
134
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
1
|
+
import { Meta, StoryContext, StoryObj } from '@storybook/react'
|
|
3
2
|
import { useForm } from 'react-hook-form'
|
|
4
3
|
|
|
5
4
|
import RcSesRadioButtonGroup from '@/components/form/inputs/RadioButtonGroup'
|
|
@@ -31,7 +30,9 @@ const meta: Meta<typeof RcSesRadioButtonGroup> = {
|
|
|
31
30
|
|
|
32
31
|
export default meta
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
type Story = StoryObj<typeof RcSesRadioButtonGroup>
|
|
34
|
+
|
|
35
|
+
function RadioButtonGroupDemo(args: any) {
|
|
35
36
|
const {
|
|
36
37
|
control,
|
|
37
38
|
formState: { errors },
|
|
@@ -133,23 +134,24 @@ const codeBlock = (args: any) => {
|
|
|
133
134
|
);`
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
export const Main =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
137
|
+
export const Main: Story = {
|
|
138
|
+
render: (args) => <RadioButtonGroupDemo {...args} />,
|
|
139
|
+
args: {
|
|
140
|
+
label: 'Label',
|
|
141
|
+
options: [
|
|
142
|
+
{ label: 'Pick 1', value: 'pick1' },
|
|
143
|
+
{ label: 'Pick 2', value: 'pick2' },
|
|
144
|
+
{ label: 'Pick 3', value: 'pick3' },
|
|
145
|
+
{ label: 'Pick 4', value: 'pick4' },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
parameters: {
|
|
149
|
+
docs: {
|
|
150
|
+
source: {
|
|
151
|
+
type: 'dynamic',
|
|
152
|
+
transform: (_code: string, storyContext: StoryContext) =>
|
|
153
|
+
codeBlock(storyContext.args),
|
|
154
|
+
},
|
|
153
155
|
},
|
|
154
156
|
},
|
|
155
157
|
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import { fn } from '@storybook/test'
|
|
3
|
+
import React, { useState } from 'react'
|
|
4
|
+
import { useForm } from 'react-hook-form'
|
|
5
|
+
|
|
6
|
+
import RcSesSearchInput from '@/components/form/inputs/SearchInput'
|
|
7
|
+
import SingleStepFormModel from '@/examples/SingleStepForm/types/SingleStepFormModel'
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof RcSesSearchInput> = {
|
|
10
|
+
title: 'components/inputs/SearchInput',
|
|
11
|
+
component: RcSesSearchInput,
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
label: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
},
|
|
17
|
+
labelSubtitle: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
},
|
|
20
|
+
required: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
},
|
|
23
|
+
placeholder: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
},
|
|
26
|
+
onlyNumbers: {
|
|
27
|
+
control: 'boolean',
|
|
28
|
+
},
|
|
29
|
+
sideLabel: {
|
|
30
|
+
control: 'boolean',
|
|
31
|
+
},
|
|
32
|
+
showSearchButton: {
|
|
33
|
+
control: 'boolean',
|
|
34
|
+
},
|
|
35
|
+
searchButtonLabel: {
|
|
36
|
+
control: 'text',
|
|
37
|
+
},
|
|
38
|
+
slotProps: {
|
|
39
|
+
control: 'object',
|
|
40
|
+
},
|
|
41
|
+
disabled: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default meta
|
|
48
|
+
|
|
49
|
+
type Story = StoryObj<typeof RcSesSearchInput>
|
|
50
|
+
|
|
51
|
+
const StoryTemplate = (args: React.ComponentProps<typeof RcSesSearchInput>) => {
|
|
52
|
+
const { onSearch, slotProps, ...restArgs } = args
|
|
53
|
+
const [lastSearchValue, setLastSearchValue] = useState('')
|
|
54
|
+
const [searchCount, setSearchCount] = useState(0)
|
|
55
|
+
const {
|
|
56
|
+
control,
|
|
57
|
+
formState: { errors },
|
|
58
|
+
} = useForm<SingleStepFormModel>({
|
|
59
|
+
mode: 'all',
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const handleSearch = (value: string) => {
|
|
63
|
+
const newCount = searchCount + 1
|
|
64
|
+
setLastSearchValue(value)
|
|
65
|
+
setSearchCount(newCount)
|
|
66
|
+
onSearch(value)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<div>
|
|
71
|
+
<RcSesSearchInput
|
|
72
|
+
{...restArgs}
|
|
73
|
+
control={control}
|
|
74
|
+
id='searchable'
|
|
75
|
+
errors={errors?.searchable}
|
|
76
|
+
name='searchable'
|
|
77
|
+
onSearch={handleSearch}
|
|
78
|
+
slotProps={slotProps}
|
|
79
|
+
/>
|
|
80
|
+
<p style={{ marginTop: 12 }}>
|
|
81
|
+
Searches: {searchCount} | Last value: {lastSearchValue || '-'}
|
|
82
|
+
</p>
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Main: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
label: 'Search Input Field',
|
|
90
|
+
placeholder: 'Type to search',
|
|
91
|
+
onSearch: fn(),
|
|
92
|
+
},
|
|
93
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export const OnlyRequired: Story = {
|
|
97
|
+
args: {
|
|
98
|
+
onSearch: fn(),
|
|
99
|
+
},
|
|
100
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export const WithoutButton: Story = {
|
|
104
|
+
args: {
|
|
105
|
+
...Main.args,
|
|
106
|
+
showSearchButton: false,
|
|
107
|
+
},
|
|
108
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export const WithoutLabel: Story = {
|
|
112
|
+
args: {
|
|
113
|
+
...Main.args,
|
|
114
|
+
label: undefined,
|
|
115
|
+
},
|
|
116
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export const SideLabel: Story = {
|
|
120
|
+
args: {
|
|
121
|
+
...Main.args,
|
|
122
|
+
sideLabel: true,
|
|
123
|
+
},
|
|
124
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export const OnlyNumbers: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
...Main.args,
|
|
130
|
+
onlyNumbers: true,
|
|
131
|
+
placeholder: 'Only numbers allowed',
|
|
132
|
+
},
|
|
133
|
+
render: (args) => <StoryTemplate {...args} />,
|
|
134
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
1
|
+
import { Meta, StoryContext, StoryObj } from '@storybook/react'
|
|
3
2
|
import { useForm } from 'react-hook-form'
|
|
4
3
|
|
|
5
4
|
import RcSesSearchableField from '@/components/form/inputs/SearchableField'
|
|
@@ -14,7 +13,9 @@ const meta: Meta<typeof RcSesSearchableField> = {
|
|
|
14
13
|
|
|
15
14
|
export default meta
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
type Story = StoryObj<typeof RcSesSearchableField>
|
|
17
|
+
|
|
18
|
+
function SearchableFieldDemo(args: any) {
|
|
18
19
|
const { label } = args
|
|
19
20
|
const {
|
|
20
21
|
control,
|
|
@@ -74,17 +75,18 @@ const codeBlock = (args: any) => {
|
|
|
74
75
|
);`
|
|
75
76
|
}
|
|
76
77
|
|
|
77
|
-
export const Main =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
78
|
+
export const Main: Story = {
|
|
79
|
+
render: (args) => <SearchableFieldDemo {...args} />,
|
|
80
|
+
args: {
|
|
81
|
+
label: 'This is label',
|
|
82
|
+
},
|
|
83
|
+
parameters: {
|
|
84
|
+
docs: {
|
|
85
|
+
source: {
|
|
86
|
+
type: 'dynamic',
|
|
87
|
+
transform: (_code: string, storyContext: StoryContext) =>
|
|
88
|
+
codeBlock(storyContext.args),
|
|
89
|
+
},
|
|
88
90
|
},
|
|
89
91
|
},
|
|
90
92
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/function-component-definition */
|
|
2
|
-
import {
|
|
2
|
+
import { Box, Typography } from '@mui/material'
|
|
3
|
+
import { Meta, StoryContext, StoryObj } from '@storybook/react'
|
|
3
4
|
import { useForm } from 'react-hook-form'
|
|
4
5
|
|
|
6
|
+
import RcSesPhoneInput from '@/components/form/inputs/PhoneInput'
|
|
5
7
|
import RcSesSelect from '@/components/form/inputs/Select'
|
|
6
8
|
import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
|
|
7
9
|
import FieldView from '@/components/storybook/FieldView'
|
|
@@ -67,7 +69,9 @@ const meta: Meta<typeof RcSesSelect> = {
|
|
|
67
69
|
|
|
68
70
|
export default meta
|
|
69
71
|
|
|
70
|
-
|
|
72
|
+
type Story = StoryObj<typeof RcSesSelect>
|
|
73
|
+
|
|
74
|
+
function SelectDemo(args: any) {
|
|
71
75
|
const {
|
|
72
76
|
control,
|
|
73
77
|
formState: { errors },
|
|
@@ -208,19 +212,247 @@ const codeBlock = (args: any) => {
|
|
|
208
212
|
);`
|
|
209
213
|
}
|
|
210
214
|
|
|
211
|
-
export const Main =
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
215
|
+
export const Main: Story = {
|
|
216
|
+
render: (args: any) => <SelectDemo {...args} />,
|
|
217
|
+
args: {
|
|
218
|
+
label: 'Label',
|
|
219
|
+
disabled: false,
|
|
220
|
+
slotProps: { wrapper: { labelOnTop: false } },
|
|
221
|
+
},
|
|
222
|
+
parameters: {
|
|
223
|
+
docs: {
|
|
224
|
+
source: {
|
|
225
|
+
type: 'dynamic',
|
|
226
|
+
transform: (_code: string, storyContext: StoryContext) =>
|
|
227
|
+
codeBlock(storyContext.args),
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
},
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
type VariantsFormModel = {
|
|
234
|
+
singleSelect: string | null
|
|
235
|
+
groupedSelect: string | null
|
|
236
|
+
singleSearchSelect: string | null
|
|
237
|
+
descriptionSelect: string | null
|
|
238
|
+
multiSelect: string[]
|
|
239
|
+
multiSearchSelect: string[]
|
|
240
|
+
phoneInput: string
|
|
216
241
|
}
|
|
217
242
|
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
243
|
+
const variantOptions = [
|
|
244
|
+
{ value: 'option-1', label: '1st option' },
|
|
245
|
+
{ value: 'option-2', label: '2st option' },
|
|
246
|
+
{ value: 'option-3', label: '3rd option' },
|
|
247
|
+
{ value: 'option-4', label: '4th option' },
|
|
248
|
+
{ value: 'option-5', label: '5th option' },
|
|
249
|
+
]
|
|
250
|
+
|
|
251
|
+
const groupedVariantOptions: Array<
|
|
252
|
+
{
|
|
253
|
+
group: string
|
|
254
|
+
} & {
|
|
255
|
+
value: string
|
|
256
|
+
label: string
|
|
257
|
+
}
|
|
258
|
+
> = [
|
|
259
|
+
{ value: 'group-1-option-1', label: '1st option', group: 'GROUP 1' },
|
|
260
|
+
{ value: 'group-1-option-2', label: '2st option', group: 'GROUP 1' },
|
|
261
|
+
{ value: 'group-1-option-3', label: '3rd option', group: 'GROUP 1' },
|
|
262
|
+
{ value: 'group-2-option-4', label: '4th option', group: 'GROUP 2' },
|
|
263
|
+
{ value: 'group-2-option-5', label: '5th option', group: 'GROUP 2' },
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
const optionsWithDescriptions = [
|
|
267
|
+
{
|
|
268
|
+
value: 'option-1',
|
|
269
|
+
label: '1st option',
|
|
270
|
+
description:
|
|
271
|
+
'Lorem ipsum is simply dummy text of the printing and typesetting industry.',
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
value: 'option-2',
|
|
275
|
+
label: '2st option',
|
|
276
|
+
description:
|
|
277
|
+
'Lorem ipsum is simply dummy text of the printing and typesetting industry. Lorem ipsum has been the industry standard.',
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
value: 'option-3',
|
|
281
|
+
label: '3rd option',
|
|
282
|
+
description: 'Lorem ipsum is simply dummy text has been the industry standard.',
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
value: 'option-4',
|
|
286
|
+
label: '4th option',
|
|
287
|
+
description: 'Lorem ipsum has been the industry standard.',
|
|
288
|
+
},
|
|
289
|
+
]
|
|
290
|
+
|
|
291
|
+
const VariantCard = ({
|
|
292
|
+
title,
|
|
293
|
+
description,
|
|
294
|
+
children,
|
|
295
|
+
}: {
|
|
296
|
+
title: string
|
|
297
|
+
description: string
|
|
298
|
+
children: React.ReactNode
|
|
299
|
+
}) => (
|
|
300
|
+
<Box>
|
|
301
|
+
<Typography sx={{ fontWeight: 700, fontSize: '1rem', mb: '.25rem' }}>
|
|
302
|
+
{title}
|
|
303
|
+
</Typography>
|
|
304
|
+
<Typography
|
|
305
|
+
sx={{ color: '#667085', fontSize: '.75rem', mb: '1rem', minHeight: '2rem' }}
|
|
306
|
+
>
|
|
307
|
+
{description}
|
|
308
|
+
</Typography>
|
|
309
|
+
{children}
|
|
310
|
+
</Box>
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
export const AllVariants: Story = {
|
|
314
|
+
render: () => {
|
|
315
|
+
const { control } = useForm<VariantsFormModel>({
|
|
316
|
+
mode: 'all',
|
|
317
|
+
defaultValues: {
|
|
318
|
+
singleSelect: null,
|
|
319
|
+
groupedSelect: null,
|
|
320
|
+
singleSearchSelect: null,
|
|
321
|
+
descriptionSelect: 'option-3',
|
|
322
|
+
multiSelect: ['option-1', 'option-3'],
|
|
323
|
+
multiSearchSelect: ['option-1', 'option-3', 'option-4', 'option-5'],
|
|
324
|
+
phoneInput: '',
|
|
325
|
+
},
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
return (
|
|
329
|
+
<Box sx={{ p: '1rem 0' }}>
|
|
330
|
+
<Box
|
|
331
|
+
sx={{
|
|
332
|
+
display: 'grid',
|
|
333
|
+
gap: '2rem',
|
|
334
|
+
gridTemplateColumns: {
|
|
335
|
+
xs: '1fr',
|
|
336
|
+
sm: 'repeat(2, minmax(0, 1fr))',
|
|
337
|
+
xl: 'repeat(4, minmax(0, 1fr))',
|
|
338
|
+
},
|
|
339
|
+
}}
|
|
340
|
+
>
|
|
341
|
+
<VariantCard
|
|
342
|
+
title='Basic'
|
|
343
|
+
description='Bazinis variantas skirtas iprastiems atvejams.'
|
|
344
|
+
>
|
|
345
|
+
<RcSesSelect
|
|
346
|
+
id='single-select'
|
|
347
|
+
name='singleSelect'
|
|
348
|
+
control={control}
|
|
349
|
+
label='Pasirinkti'
|
|
350
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
351
|
+
options={variantOptions}
|
|
352
|
+
/>
|
|
353
|
+
</VariantCard>
|
|
354
|
+
|
|
355
|
+
<VariantCard
|
|
356
|
+
title='Wide + descriptions'
|
|
357
|
+
description='Didesnis variantas su aprasymais kiekvienai opcijai.'
|
|
358
|
+
>
|
|
359
|
+
<RcSesSelect
|
|
360
|
+
id='description-select'
|
|
361
|
+
name='descriptionSelect'
|
|
362
|
+
control={control}
|
|
363
|
+
label='Pasirinkti'
|
|
364
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
365
|
+
options={optionsWithDescriptions}
|
|
366
|
+
/>
|
|
367
|
+
</VariantCard>
|
|
368
|
+
|
|
369
|
+
<VariantCard
|
|
370
|
+
title='Grouped'
|
|
371
|
+
description='Sugrupuotos parinktys pagal kategorijas.'
|
|
372
|
+
>
|
|
373
|
+
<RcSesSelect
|
|
374
|
+
id='grouped-select'
|
|
375
|
+
name='groupedSelect'
|
|
376
|
+
control={control}
|
|
377
|
+
label='Pasirinkti'
|
|
378
|
+
slotProps={{
|
|
379
|
+
wrapper: { labelOnTop: true },
|
|
380
|
+
field: {
|
|
381
|
+
groupBy: (option) =>
|
|
382
|
+
groupedVariantOptions.find(
|
|
383
|
+
(groupedOption) => groupedOption.value === option.value,
|
|
384
|
+
)?.group ?? '',
|
|
385
|
+
},
|
|
386
|
+
}}
|
|
387
|
+
options={groupedVariantOptions}
|
|
388
|
+
/>
|
|
389
|
+
</VariantCard>
|
|
390
|
+
|
|
391
|
+
<VariantCard title='Basic + search' description='Bazinis variantas su paieska.'>
|
|
392
|
+
<RcSesSelect
|
|
393
|
+
id='single-search-select'
|
|
394
|
+
name='singleSearchSelect'
|
|
395
|
+
control={control}
|
|
396
|
+
label='Pasirinkti'
|
|
397
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
398
|
+
dropdownSearch
|
|
399
|
+
dropdownSearchPlaceholder='Ieškoti'
|
|
400
|
+
options={variantOptions}
|
|
401
|
+
/>
|
|
402
|
+
</VariantCard>
|
|
403
|
+
|
|
404
|
+
<VariantCard
|
|
405
|
+
title='Multi select'
|
|
406
|
+
description='Variantas kai galima pasirinkti kelias reiksmes.'
|
|
407
|
+
>
|
|
408
|
+
<RcSesSelect
|
|
409
|
+
id='multi-select'
|
|
410
|
+
name='multiSelect'
|
|
411
|
+
control={control}
|
|
412
|
+
label='Pasirinkti'
|
|
413
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
414
|
+
multiple
|
|
415
|
+
options={variantOptions}
|
|
416
|
+
/>
|
|
417
|
+
</VariantCard>
|
|
418
|
+
|
|
419
|
+
<VariantCard
|
|
420
|
+
title='Multi select + search'
|
|
421
|
+
description='Daugybinis pasirinkimas su paieska ir select all.'
|
|
422
|
+
>
|
|
423
|
+
<RcSesSelect
|
|
424
|
+
id='multi-search-select'
|
|
425
|
+
name='multiSearchSelect'
|
|
426
|
+
control={control}
|
|
427
|
+
label='Pasirinkti'
|
|
428
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
429
|
+
multiple
|
|
430
|
+
dropdownSearch
|
|
431
|
+
selectAll
|
|
432
|
+
dropdownSearchPlaceholder='Ieškoti'
|
|
433
|
+
options={variantOptions}
|
|
434
|
+
/>
|
|
435
|
+
</VariantCard>
|
|
436
|
+
|
|
437
|
+
<VariantCard
|
|
438
|
+
title='Phone input'
|
|
439
|
+
description='Telefono numerio įvesties laukas su šalies kodo pasirinkimu.'
|
|
440
|
+
>
|
|
441
|
+
<RcSesPhoneInput
|
|
442
|
+
id='phone-input'
|
|
443
|
+
name='phoneInput'
|
|
444
|
+
control={control}
|
|
445
|
+
label='Phone number'
|
|
446
|
+
slotProps={{ wrapper: { labelOnTop: true } }}
|
|
447
|
+
/>
|
|
448
|
+
</VariantCard>
|
|
449
|
+
</Box>
|
|
450
|
+
</Box>
|
|
451
|
+
)
|
|
452
|
+
},
|
|
453
|
+
parameters: {
|
|
454
|
+
controls: {
|
|
455
|
+
disable: true,
|
|
224
456
|
},
|
|
225
457
|
},
|
|
226
458
|
}
|