@itcase/ui 1.2.18 → 1.2.20

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 (207) hide show
  1. package/dist/{Group-BDuYmoBK.js → Group-B2oTJg0t.js} +1 -1
  2. package/dist/{Group-12uup5mu.js → Group-CVUfaHaS.js} +1 -1
  3. package/dist/cjs/components/Accordion.js +3 -2
  4. package/dist/cjs/components/Choice.js +11 -3
  5. package/dist/cjs/components/CookiesWarning.js +1 -1
  6. package/dist/cjs/components/Group.js +1 -1
  7. package/dist/cjs/components/InputPassword.js +6 -6
  8. package/dist/cjs/components/Panel.js +1 -1
  9. package/dist/cjs/components/Radio.js +85 -8
  10. package/dist/cjs/components/Response.js +1 -1
  11. package/dist/cjs/components/Select.js +1 -1
  12. package/dist/cjs/components/Switch.js +12 -8
  13. package/dist/cjs/components/Tile.js +3 -3
  14. package/dist/cjs/constants/componentProps/textColor.js +1 -1
  15. package/dist/cjs/constants/componentProps/textColorHover.js +1 -1
  16. package/dist/cjs/hooks/useViewportFix.js +43 -0
  17. package/dist/components/Accordion.js +3 -2
  18. package/dist/components/Choice.js +11 -3
  19. package/dist/components/CookiesWarning.js +1 -1
  20. package/dist/components/Group.js +1 -1
  21. package/dist/components/InputPassword.js +6 -6
  22. package/dist/components/Panel.js +1 -1
  23. package/dist/components/Radio.js +86 -5
  24. package/dist/components/Response.js +1 -1
  25. package/dist/components/Select.js +1 -1
  26. package/dist/components/Switch.js +12 -4
  27. package/dist/components/Tile.js +3 -3
  28. package/dist/constants/componentProps/textColor.js +1 -1
  29. package/dist/constants/componentProps/textColorHover.js +1 -1
  30. package/dist/css/components/Accordion/Accordion.css +1 -0
  31. package/dist/css/components/Choice/Choice.css +14 -0
  32. package/dist/css/components/DatePicker/DatePicker.css +12 -12
  33. package/dist/css/components/Icon/Icon.css +14 -8
  34. package/dist/css/components/Select/Select.css +1 -1
  35. package/dist/css/components/Select/css/__input-container/select__input-container.css +1 -1
  36. package/dist/css/mixins/mixin_animation.css +1 -1
  37. package/dist/css/mixins/mixin_elevation.css +0 -2
  38. package/dist/css/mixins/mixin_typography.css +105 -84
  39. package/dist/css/mixins/mixin_utils.css +1 -1
  40. package/dist/css/styles/border-color/border-color.css +4 -2
  41. package/dist/css/styles/text-gradient/text-gradient.css +9 -4
  42. package/dist/css/styles/width/width.css +1 -1
  43. package/dist/css/tokens/colors.css +105 -0
  44. package/dist/css/tokens/elevation.css +10 -0
  45. package/dist/css/tokens/settings.css +31 -0
  46. package/dist/css/tokens/typography.css +127 -0
  47. package/dist/hooks/useViewportFix.js +41 -0
  48. package/dist/stories/Accordion.mdx +11 -0
  49. package/dist/stories/Accordion.stories.js +49 -32
  50. package/dist/stories/AccordionItem.mdx +15 -0
  51. package/dist/stories/AccordionItem.stories.js +69 -69
  52. package/dist/stories/AlignContent.mdx +85 -0
  53. package/dist/stories/AlignItems.mdx +74 -0
  54. package/dist/stories/AlignItems.stories.js +88 -0
  55. package/dist/stories/AlignSelf.mdx +85 -0
  56. package/dist/stories/AlignSelf.stories.js +101 -0
  57. package/dist/stories/Appearance.mdx +35 -0
  58. package/dist/stories/Appearance.stories.js +101 -0
  59. package/dist/stories/Avatar.mdx +23 -0
  60. package/dist/stories/Avatar.stories.js +69 -64
  61. package/dist/stories/Badge.mdx +20 -0
  62. package/dist/stories/Badge.stories.js +43 -44
  63. package/dist/stories/Button.mdx +48 -0
  64. package/dist/stories/Button.stories.js +26 -186
  65. package/dist/stories/Cell.mdx +23 -0
  66. package/dist/stories/Cell.stories.js +119 -119
  67. package/dist/stories/Checkbox.mdx +24 -0
  68. package/dist/stories/Checkbox.stories.js +42 -34
  69. package/dist/stories/Chips.mdx +31 -0
  70. package/dist/stories/Chips.stories.js +22 -67
  71. package/dist/stories/Choice.mdx +11 -0
  72. package/dist/stories/Choice.stories.js +59 -61
  73. package/dist/stories/Code.mdx +11 -0
  74. package/dist/stories/Code.stories.js +37 -40
  75. package/dist/stories/Columns.mdx +51 -0
  76. package/dist/stories/Columns.stories.js +80 -0
  77. package/dist/stories/Configure.mdx +364 -0
  78. package/dist/stories/DatePicker.mdx +31 -0
  79. package/dist/stories/DatePicker.stories.js +58 -59
  80. package/dist/stories/Dev.mdx +9 -0
  81. package/dist/stories/DevMode.mdx +8 -0
  82. package/dist/stories/Direction.mdx +84 -0
  83. package/dist/stories/Direction.stories.js +93 -0
  84. package/dist/stories/Divider.mdx +35 -0
  85. package/dist/stories/Divider.stories.js +28 -29
  86. package/dist/stories/Dot.mdx +19 -0
  87. package/dist/stories/Dot.stories.js +38 -39
  88. package/dist/stories/Drawer.mdx +11 -0
  89. package/dist/stories/Drawer.stories.js +75 -0
  90. package/dist/stories/Dropdown.mdx +12 -0
  91. package/dist/stories/Dropdown.stories.js +30 -29
  92. package/dist/stories/DropdownItem.mdx +19 -0
  93. package/dist/stories/DropdownItem.stories.js +76 -78
  94. package/dist/stories/Flex.stories.js +47 -0
  95. package/dist/stories/FlexAlignContent.stories.js +102 -0
  96. package/dist/stories/FlexAlignItems.stories.js +91 -0
  97. package/dist/stories/FlexAlignSelf.stories.js +97 -0
  98. package/dist/stories/FlexDirection.stories.js +112 -0
  99. package/dist/stories/FlexGrow.stories.js +69 -0
  100. package/dist/stories/FlexJustifyContent.stories.js +98 -0
  101. package/dist/stories/FlexOrder.stories.js +76 -0
  102. package/dist/stories/FlexWrap.stories.js +89 -0
  103. package/dist/stories/Grid.stories.js +202 -0
  104. package/dist/stories/Group.mdx +9 -0
  105. package/dist/stories/{Tab.group.stories.js → Group.stories.js} +60 -56
  106. package/dist/stories/Grow.mdx +40 -0
  107. package/dist/stories/Header.stories.js +29 -0
  108. package/dist/stories/Icon.mdx +15 -0
  109. package/dist/stories/Icon.stories.js +84 -82
  110. package/dist/stories/Image.mdx +15 -0
  111. package/dist/stories/Image.stories.js +134 -0
  112. package/dist/stories/Input.mdx +31 -0
  113. package/dist/stories/Input.stories.js +26 -26
  114. package/dist/stories/InputPassword.mdx +15 -0
  115. package/dist/stories/InputPassword.stories.js +32 -34
  116. package/dist/stories/JustifyContent.mdx +89 -0
  117. package/dist/stories/JustifyContent.stories.js +96 -0
  118. package/dist/stories/Label.mdx +31 -0
  119. package/dist/stories/Label.stories.js +63 -53
  120. package/dist/stories/Loader.mdx +31 -0
  121. package/dist/stories/Loader.stories.js +26 -28
  122. package/dist/stories/Logo.mdx +19 -0
  123. package/dist/stories/Logo.stories.js +28 -28
  124. package/dist/stories/MenuItem.mdx +15 -0
  125. package/dist/stories/MenuItem.stories.js +156 -91
  126. package/dist/stories/Message.mdx +12 -0
  127. package/dist/stories/Message.stories.js +34 -0
  128. package/dist/stories/ModalConfirm.stories.js +48 -47
  129. package/dist/stories/ModalDefault.stories.js +21 -20
  130. package/dist/stories/Notification.mdx +23 -0
  131. package/dist/stories/Notification.stories.js +24 -47
  132. package/dist/stories/Order.mdx +52 -0
  133. package/dist/stories/Overview.mdx +11 -0
  134. package/dist/stories/Page.stories.js +28 -0
  135. package/dist/stories/Pagination.mdx +11 -0
  136. package/dist/stories/Pagination.stories.js +24 -27
  137. package/dist/stories/Playground.mdx +10 -0
  138. package/dist/stories/Radio.mdx +29 -0
  139. package/dist/stories/Radio.stories.js +32 -33
  140. package/dist/stories/Response.mdx +18 -0
  141. package/dist/stories/Response.stories.js +66 -0
  142. package/dist/stories/SearchInput.mdx +19 -0
  143. package/dist/stories/{Search-input.stories.js → SearchInput.stories.js} +79 -62
  144. package/dist/stories/Segmented.mdx +11 -0
  145. package/dist/stories/Segmented.stories.js +49 -50
  146. package/dist/stories/Select.stories.js +155 -155
  147. package/dist/stories/Size.mdx +35 -0
  148. package/dist/stories/Size.stories.js +101 -0
  149. package/dist/stories/Skeleton.mdx +9 -0
  150. package/dist/stories/State.mdx +19 -0
  151. package/dist/stories/State.stories.js +70 -0
  152. package/dist/stories/Switch.mdx +23 -0
  153. package/dist/stories/Switch.stories.js +23 -23
  154. package/dist/stories/Text.mdx +35 -0
  155. package/dist/stories/Text.stories.js +172 -0
  156. package/dist/stories/Textarea.mdx +15 -0
  157. package/dist/stories/Textarea.stories.js +27 -27
  158. package/dist/stories/Tile.mdx +19 -0
  159. package/dist/stories/Tile.stories.js +112 -97
  160. package/dist/stories/Title.mdx +31 -0
  161. package/dist/stories/Title.stories.js +168 -0
  162. package/dist/stories/Tooltip.mdx +19 -0
  163. package/dist/stories/Tooltip.stories.js +164 -0
  164. package/dist/stories/WithTooltip.mdx +9 -0
  165. package/dist/stories/Wrap.mdx +52 -0
  166. package/dist/stories/Wrap.stories.js +74 -0
  167. package/dist/types/components/Accordion/Accordion.interface.d.ts +4 -0
  168. package/dist/types/components/Choice/Choice.interface.d.ts +2 -2
  169. package/dist/types/components/InputPassword/InputPassword.interface.d.ts +10 -8
  170. package/dist/types/components/Tile/Tile.d.ts +1 -1
  171. package/dist/types/components/Tile/Tile.interface.d.ts +3 -1
  172. package/dist/types/config/forms/datepicker.d.ts +18 -0
  173. package/dist/types/config/forms/index.d.ts +4 -0
  174. package/dist/types/config/forms/input.d.ts +14 -0
  175. package/dist/types/config/forms/select.d.ts +50 -0
  176. package/dist/types/hooks/useViewportFix.d.ts +2 -0
  177. package/dist/types/types/componentProps/flexWrap.d.ts +1 -1
  178. package/dist/types/types/componentProps/wrap.d.ts +1 -1
  179. package/package.json +38 -22
  180. package/dist/Radio-BQo97TZL.js +0 -89
  181. package/dist/Radio-oMf0vN7T.js +0 -86
  182. package/dist/Switch-B5yVEqxz.js +0 -14
  183. package/dist/Switch-DEXsrPCo.js +0 -12
  184. package/dist/cjs/components/FormField.js +0 -122
  185. package/dist/components/FormField.js +0 -116
  186. package/dist/css/mixins/mixin.css +0 -73
  187. package/dist/stories/FormFieldCheckbox.stories.js +0 -77
  188. package/dist/stories/FormFieldChoice.stories.js +0 -75
  189. package/dist/stories/FormFieldDatepicker.stories.js +0 -51
  190. package/dist/stories/FormFieldFileInput.stories.js +0 -58
  191. package/dist/stories/FormFieldInput.stories.js +0 -66
  192. package/dist/stories/FormFieldInputPassword.stories.js +0 -66
  193. package/dist/stories/FormFieldMultiBadgeSelect.stories.js +0 -132
  194. package/dist/stories/FormFieldMultiSelect.stories.js +0 -127
  195. package/dist/stories/FormFieldSelect.stories.js +0 -99
  196. package/dist/stories/FormFieldSelectGroup.stories.js +0 -84
  197. package/dist/stories/NotFound.stories.js +0 -93
  198. package/dist/stories/Tab.appearance.stories.js +0 -260
  199. package/dist/stories/Tab.size.stories.js +0 -259
  200. package/dist/stories/Tab.state.stories.js +0 -227
  201. package/dist/types/components/FormField/ChoiceField.d.ts +0 -8
  202. package/dist/types/components/FormField/FormField.d.ts +0 -9
  203. package/dist/types/components/FormField/FormFiled.interface.d.ts +0 -77
  204. package/dist/types/components/FormField/PasswordField.d.ts +0 -9
  205. package/dist/types/components/FormField/SelectField.d.ts +0 -9
  206. package/dist/types/components/FormField/SwitchField.d.ts +0 -8
  207. package/dist/types/components/FormField/index.d.ts +0 -6
@@ -1,58 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / File Input',
9
- component: Form,
10
- }
11
-
12
- const Template = (args) => {
13
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
14
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
15
-
16
- // Create validation schema with rules for form fields
17
- const validationSchema = yup.object().shape({
18
- formFieldInput: yup
19
- .string()
20
- .test('formFieldInput', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
21
- .required(DEFAULT_REQUIRED_MESSAGE),
22
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
23
- })
24
-
25
- // Add "requiredFields" as new param to schema
26
- if (!('requiredFields' in validationSchema)) {
27
- addRequiredFieldsParamToSchema(validationSchema)
28
- }
29
-
30
- // Create form config with fields
31
- const config = {
32
- formFieldInput: {
33
- type: formTypes.fileInput,
34
- isRequired: true,
35
- isPreviews: true,
36
- showFilename: true,
37
- size: 'normal',
38
- name: 'formFieldInput',
39
- hintTitle: 'Перетащите изображение или выберите файл с компьютера ',
40
- hintTitleTextSize: 'm',
41
- hintTitleTextColor: 'surfaceTextPrimary',
42
- fill: 'surfacePrimary',
43
- fillHover: 'surfacePrimaryHover',
44
- borderColor: 'surfaceBorderTertiary',
45
- thumbNameTextSize: 'm',
46
- thumbNameTextColor: 'surfaceTextPrimary',
47
- removeThumbText: 'удалить',
48
- removeThumbTextSize: 's',
49
- removeThumbTextColor: 'errorTextPrimary',
50
- removeThumbTextHoverColor: 'errorTextPrimaryHover',
51
- thumbBorderWidth: 1,
52
- thumbBorderColor: 'surfaceBorderTertiary',
53
- },
54
- }
55
- return <Form config={config} validationSchema={validationSchema} />
56
- }
57
-
58
- export const Normal = Template.bind({})
@@ -1,66 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / Input',
9
- component: Form,
10
- }
11
-
12
- const Template = (args) => {
13
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
14
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
15
-
16
- // Create validation schema with rules for form fields
17
- const validationSchema = yup.object().shape({
18
- formFieldInput: yup
19
- .string()
20
- .test('formFieldInput', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
21
- .required(DEFAULT_REQUIRED_MESSAGE),
22
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
23
- })
24
-
25
- // Add "requiredFields" as new param to schema
26
- if (!('requiredFields' in validationSchema)) {
27
- addRequiredFieldsParamToSchema(validationSchema)
28
- }
29
-
30
- // Create form config with fields
31
- const config = {
32
- formFieldInput: {
33
- type: formTypes.text,
34
- isRequired: true,
35
- name: 'formFieldInput',
36
- fieldProps: {
37
- type: 'normal',
38
- width: 'fill',
39
- direction: 'vertical',
40
- dividerFill: 'errorPrimary',
41
- fill: 'surfacePrimary',
42
- label: 'Title',
43
- labelTextSize: 'm',
44
- labelTextColor: 'surfaceTextPrimary',
45
- message: 'Help Text',
46
- messageTextSize: 'xs',
47
- messageTextColor: 'surfaceTextSecondary',
48
- errorMessageTextSize: 'xs',
49
- errorMessageTextColor: 'errorTextPrimary',
50
- },
51
- inputProps: {
52
- width: 'fill',
53
- caret: 'secondaryItemSecondary',
54
- placeholder: 'Placeholder',
55
- placeholderTextColor: 'surfaceTextSecondary',
56
- shape: 'rounded',
57
- borderColor: 'surfaceBorderQuaternary',
58
- textColor: 'surfaceTextPrimary',
59
- textSize: 'm',
60
- },
61
- },
62
- }
63
- return <Form config={config} validationSchema={validationSchema} />
64
- }
65
-
66
- export const Normal = Template.bind({})
@@ -1,66 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / Password',
9
- component: Form,
10
- }
11
-
12
- const Template = (args) => {
13
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
14
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
15
-
16
- // Create validation schema with rules for form fields
17
- const validationSchema = yup.object().shape({
18
- formFieldInput: yup
19
- .string()
20
- .test('formFieldInput', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
21
- .required(DEFAULT_REQUIRED_MESSAGE),
22
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
23
- })
24
-
25
- // Add "requiredFields" as new param to schema
26
- if (!('requiredFields' in validationSchema)) {
27
- addRequiredFieldsParamToSchema(validationSchema)
28
- }
29
-
30
- // Create form config with fields
31
- const config = {
32
- formFieldInput: {
33
- type: formTypes.text,
34
- isRequired: true,
35
- name: 'formFieldInput',
36
- fieldProps: {
37
- type: 'normal',
38
- width: 'fill',
39
- direction: 'vertical',
40
- dividerFill: 'errorPrimary',
41
- fill: 'surfacePrimary',
42
- label: 'Title',
43
- labelTextSize: 'm',
44
- labelTextColor: 'surfaceTextPrimary',
45
- message: 'Help Text',
46
- messageTextSize: 'xs',
47
- messageTextColor: 'surfaceTextSecondary',
48
- errorMessageTextSize: 'xs',
49
- errorMessageTextColor: 'errorTextPrimary',
50
- },
51
- inputProps: {
52
- width: 'fill',
53
- caret: 'secondaryItemSecondary',
54
- placeholder: 'Placeholder',
55
- placeholderTextColor: 'surfaceTextSecondary',
56
- shape: 'rounded',
57
- borderColor: 'surfaceBorderQuaternary',
58
- textColor: 'surfaceTextPrimary',
59
- textSize: 'm',
60
- },
61
- },
62
- }
63
- return <Form config={config} validationSchema={validationSchema} />
64
- }
65
-
66
- export const Normal = Template.bind({})
@@ -1,132 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / SelectBadgeMulti',
9
- component: Form,
10
- }
11
-
12
- import { icon16, icon24 } from '../../../icons'
13
-
14
- const Template = (args) => {
15
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
16
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
17
-
18
- // Create validation schema with rules for form fields
19
- const validationSchema = yup.object().shape({
20
- formFieldSelect: yup
21
- .string()
22
- .test('formFieldSelect', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
23
- .required(DEFAULT_REQUIRED_MESSAGE),
24
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
25
- })
26
-
27
- // Add "requiredFields" as new param to schema
28
- if (!('requiredFields' in validationSchema)) {
29
- addRequiredFieldsParamToSchema(validationSchema)
30
- }
31
-
32
- // Create form config with fields
33
- const config = {
34
- formFieldSelect: {
35
- type: formTypes.select,
36
- name: 'types',
37
- fieldProps: {
38
- type: 'normal',
39
- width: 'fill',
40
- direction: 'vertical',
41
- dividerFill: 'errorPrimary',
42
- fill: 'surfacePrimary',
43
- label: 'Title',
44
- labelTextSize: 'm',
45
- labelTextColor: 'surfaceTextPrimary',
46
- message: 'Help Text',
47
- messageTextSize: 'xs',
48
- messageTextColor: 'surfaceTextSecondary',
49
- errorMessageTextSize: 'xs',
50
- errorMessageTextColor: 'errorTextPrimary',
51
- },
52
- selectProps: {
53
- elevation: 8,
54
- showDivider: true,
55
- dividerDirection: 'horizontal',
56
- dividerFill: 'surfaceTertiary',
57
- dividerSize: 'xxs',
58
- size: 'normal',
59
- optionFill: 'surfacePrimary',
60
- optionFillHover: 'surfacePrimaryHover',
61
- optionBorder: 'none',
62
- optionShape: 'rounded',
63
- optionTextColor: 'surfaceTextPrimary',
64
- optionTextSize: 'm',
65
- inputFill: 'surfacePrimary',
66
- inputTextSize: 'm',
67
- inputTextColor: 'surfaceTextPrimary',
68
- inputCaretColor: 'secondaryItemPrimary',
69
- inputShape: 'rounded',
70
- inputBorderColor: 'surfaceBorderTertiary',
71
-
72
- multipleItemFill: 'accentPrimary',
73
- multipleItemFillHover: 'accentPrimaryHover',
74
- multipleItemTextSize: 'm',
75
- multipleItemTextColor: 'accentTextPrimary',
76
-
77
- multipleItemIcon: icon16.Remove,
78
- multipleItemIconFill: 'accentItemPrimary',
79
-
80
- showBadge: true,
81
- badgeAppearance: 'accent',
82
- badgeSize: 'm',
83
- badgeTextSize: 'm',
84
-
85
- clearIcon: icon24.Clear,
86
- clearIconFill: 'surfaceItemPrimary',
87
-
88
- dropdownIcon: icon24.ChevronDownSmall,
89
- dropdownIconFill: 'surfaceItemPrimary',
90
-
91
- placeholder: 'Выбрать...',
92
- placeholderTextSize: 'm',
93
- placeholderTextColor: 'surfaceTextPrimary',
94
-
95
- noOptionsText: 'Ничего не найдено...',
96
- noOptionsTextSize: 'm',
97
- noOptionsTextColor: 'surfaceTextPrimary',
98
- isClearable: true,
99
-
100
- isMulti: true,
101
- isSearchable: false,
102
- closeMenuOnSelect: false,
103
- },
104
-
105
- options: [
106
- {
107
- label: 'Администратор',
108
- value: 'admin',
109
- },
110
- {
111
- label: 'Менеджер',
112
- value: 'manager',
113
- },
114
- {
115
- label: 'Модератор',
116
- value: 'moderator',
117
- },
118
- {
119
- label: 'Участник',
120
- value: 'participant',
121
- },
122
- {
123
- label: 'Сотрудник службы безопасности',
124
- value: 'security',
125
- },
126
- ],
127
- },
128
- }
129
- return <Form config={config} validationSchema={validationSchema} />
130
- }
131
-
132
- export const Normal = Template.bind({})
@@ -1,127 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / SelectMulti',
9
- component: Form,
10
- }
11
-
12
- import { icon16, icon24 } from '../../../icons'
13
-
14
- const Template = (args) => {
15
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
16
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
17
-
18
- // Create validation schema with rules for form fields
19
- const validationSchema = yup.object().shape({
20
- formFieldSelect: yup
21
- .string()
22
- .test('formFieldSelect', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
23
- .required(DEFAULT_REQUIRED_MESSAGE),
24
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
25
- })
26
-
27
- // Add "requiredFields" as new param to schema
28
- if (!('requiredFields' in validationSchema)) {
29
- addRequiredFieldsParamToSchema(validationSchema)
30
- }
31
-
32
- // Create form config with fields
33
- const config = {
34
- formFieldSelect: {
35
- type: formTypes.select,
36
- name: 'types',
37
- fieldProps: {
38
- type: 'normal',
39
- width: 'fill',
40
- direction: 'vertical',
41
- dividerFill: 'errorPrimary',
42
- fill: 'surfacePrimary',
43
- label: 'Title',
44
- labelTextSize: 'm',
45
- labelTextColor: 'surfaceTextPrimary',
46
- message: 'Help Text',
47
- messageTextSize: 'xs',
48
- messageTextColor: 'surfaceTextSecondary',
49
- errorMessageTextSize: 'xs',
50
- errorMessageTextColor: 'errorTextPrimary',
51
- },
52
- selectProps: {
53
- elevation: 8,
54
- showDivider: true,
55
- dividerDirection: 'horizontal',
56
- dividerFill: 'surfaceTertiary',
57
- dividerSize: 'xxs',
58
- size: 'normal',
59
- optionFill: 'surfacePrimary',
60
- optionFillHover: 'surfacePrimaryHover',
61
- optionBorder: 'none',
62
- optionShape: 'rounded',
63
- optionTextColor: 'surfaceTextPrimary',
64
- optionTextSize: 'm',
65
- inputFill: 'surfacePrimary',
66
- inputTextSize: 'm',
67
- inputTextColor: 'surfaceTextPrimary',
68
- inputCaretColor: 'secondaryItemPrimary',
69
- inputShape: 'rounded',
70
- inputBorderColor: 'surfaceBorderTertiary',
71
-
72
- multipleItemFill: 'accentPrimary',
73
- multipleItemFillHover: 'accentPrimaryHover',
74
- multipleItemTextSize: 'm',
75
- multipleItemTextColor: 'accentTextPrimary',
76
-
77
- multipleItemIcon: icon16.Remove,
78
- multipleItemIconFill: 'accentItemPrimary',
79
-
80
- clearIcon: icon24.Clear,
81
- clearIconFill: 'surfaceItemPrimary',
82
-
83
- dropdownIcon: icon24.ChevronDownSmall,
84
- dropdownIconFill: 'surfaceItemPrimary',
85
-
86
- placeholder: 'Выбрать...',
87
- placeholderTextSize: 'm',
88
- placeholderTextColor: 'surfaceTextPrimary',
89
-
90
- noOptionsText: 'Ничего не найдено...',
91
- noOptionsTextSize: 'm',
92
- noOptionsTextColor: 'surfaceTextPrimary',
93
- isClearable: true,
94
-
95
- isMulti: true,
96
- isSearchable: false,
97
- closeMenuOnSelect: false,
98
- },
99
-
100
- options: [
101
- {
102
- label: 'Администратор',
103
- value: 'admin',
104
- },
105
- {
106
- label: 'Менеджер',
107
- value: 'manager',
108
- },
109
- {
110
- label: 'Модератор',
111
- value: 'moderator',
112
- },
113
- {
114
- label: 'Участник',
115
- value: 'participant',
116
- },
117
- {
118
- label: 'Сотрудник службы безопасности',
119
- value: 'security',
120
- },
121
- ],
122
- },
123
- }
124
- return <Form config={config} validationSchema={validationSchema} />
125
- }
126
-
127
- export const Normal = Template.bind({})
@@ -1,99 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / Select',
9
- component: Form,
10
- }
11
-
12
- import { icon24 } from '../../../icons'
13
-
14
- const Template = (args) => {
15
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
16
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
17
-
18
- // Create validation schema with rules for form fields
19
- const validationSchema = yup.object().shape({
20
- formFieldSelect: yup
21
- .string()
22
- .test('formFieldSelect', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
23
- .required(DEFAULT_REQUIRED_MESSAGE),
24
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
25
- })
26
-
27
- // Add "requiredFields" as new param to schema
28
- if (!('requiredFields' in validationSchema)) {
29
- addRequiredFieldsParamToSchema(validationSchema)
30
- }
31
-
32
- // Create form config with fields
33
- const config = {
34
- formFieldSelect: {
35
- type: formTypes.select,
36
- isRequired: true,
37
- name: 'formFieldSelect',
38
- fieldProps: {
39
- type: 'normal',
40
- width: 'fill',
41
- direction: 'vertical',
42
- dividerFill: 'errorPrimary',
43
- fill: 'surfacePrimary',
44
- label: 'Title',
45
- labelTextSize: 'm',
46
- labelTextColor: 'surfaceTextPrimary',
47
- message: 'Help Text',
48
- messageTextSize: 'xs',
49
- messageTextColor: 'surfaceTextSecondary',
50
- errorMessageTextSize: 'xs',
51
- errorMessageTextColor: 'errorTextPrimary',
52
- },
53
- selectProps: {
54
- elevation: 8,
55
- showDivider: true,
56
- dividerDirection: 'horizontal',
57
- dividerFill: 'surfaceTertiary',
58
- dividerSize: 'xxs',
59
- size: 'normal',
60
- optionFill: 'surfacePrimary',
61
- optionFillHover: 'surfacePrimaryHover',
62
- optionBorder: 'none',
63
- optionShape: 'rounded',
64
- optionTextColor: 'surfaceTextPrimary',
65
- optionTextSize: 'm',
66
- inputFill: 'surfacePrimary',
67
- inputTextSize: 'm',
68
- inputTextColor: 'surfaceTextPrimary',
69
- inputCaretColor: 'secondaryItemPrimary',
70
- inputShape: 'rounded',
71
- inputBorderColor: 'surfaceBorderTertiary',
72
-
73
- clearIcon: icon24.Clear,
74
- clearIconFill: 'surfaceItemPrimary',
75
-
76
- dropdownIcon: icon24.ChevronDownSmall,
77
- dropdownIconFill: 'surfaceItemPrimary',
78
-
79
- placeholder: 'Выбрать...',
80
- placeholderTextSize: 'm',
81
- placeholderTextColor: 'surfaceTextPrimary',
82
-
83
- noOptionsText: 'Ничего не найдено...',
84
- noOptionsTextSize: 'm',
85
- noOptionsTextColor: 'surfaceTextPrimary',
86
- isClearable: true,
87
- isSearchable: true,
88
- },
89
- options: [
90
- { value: 'Категория 1', label: 'Категория 1' },
91
- { value: 'Категория 2', label: 'Категория 2' },
92
- { value: 'Категория 3', label: 'Категория 3', editable: true },
93
- ],
94
- },
95
- }
96
- return <Form config={config} validationSchema={validationSchema} />
97
- }
98
-
99
- export const Normal = Template.bind({})
@@ -1,84 +0,0 @@
1
- import React from 'react'
2
- import { formTypes, emailValidation, addRequiredFieldsParamToSchema } from '@itcase/forms'
3
- import * as yup from 'yup'
4
-
5
- import Form from './form.js'
6
-
7
- export default {
8
- title: 'Form Field / SelectGroup',
9
- component: Form,
10
- }
11
-
12
- import { defaultSelectProps, defaultFieldProps } from 'src/config/forms'
13
-
14
- import { icon24 } from '../../../icons'
15
-
16
- const Template = (args) => {
17
- const DEFAULT_REQUIRED_MESSAGE = 'This field is required'
18
- const DEFAULT_INVALID_EMAIL_MESSAGE = 'Username must be a valid email'
19
-
20
- // Create validation schema with rules for form fields
21
- const validationSchema = yup.object().shape({
22
- formFieldSelect: yup
23
- .string()
24
- .test('formFieldSelect', DEFAULT_INVALID_EMAIL_MESSAGE, emailValidation)
25
- .required(DEFAULT_REQUIRED_MESSAGE),
26
- password: yup.string().trim().required(DEFAULT_REQUIRED_MESSAGE),
27
- })
28
-
29
- // Add "requiredFields" as new param to schema
30
- if (!('requiredFields' in validationSchema)) {
31
- addRequiredFieldsParamToSchema(validationSchema)
32
- }
33
-
34
- const colourOptions = [
35
- { value: 'ocean', label: 'Ocean', color: '#00B8D9' },
36
- { value: 'blue', label: 'Blue', color: '#0052CC' },
37
- { value: 'purple', label: 'Purple', color: '#5243AA' },
38
- { value: 'red', label: 'Red', color: '#FF5630' },
39
- { value: 'orange', label: 'Orange', color: '#FF8B00' },
40
- { value: 'yellow', label: 'Yellow', color: '#FFC400' },
41
- { value: 'green', label: 'Green', color: '#36B37E' },
42
- { value: 'forest', label: 'Forest', color: '#00875A' },
43
- { value: 'slate', label: 'Slate', color: '#253858' },
44
- { value: 'silver', label: 'Silver', color: '#666666' },
45
- ]
46
-
47
- const flavourOptions = [
48
- { value: 'vanilla', label: 'Vanilla', rating: 'safe' },
49
- { value: 'chocolate', label: 'Chocolate', rating: 'good' },
50
- { value: 'strawberry', label: 'Strawberry', rating: 'wild' },
51
- { value: 'salted-caramel', label: 'Salted Caramel', rating: 'crazy' },
52
- ]
53
-
54
- // Create form config with fields
55
- const config = {
56
- formFieldSelect: {
57
- type: formTypes.select,
58
- isRequired: true,
59
- name: 'formFieldSelect',
60
- fieldProps: {
61
- ...defaultFieldProps,
62
- label: 'Title',
63
- message: 'Help Text',
64
- },
65
- selectProps: {
66
- ...defaultSelectProps
67
- },
68
-
69
- options: [
70
- {
71
- label: '5555555',
72
- options: colourOptions,
73
- },
74
- {
75
- label: '7777777',
76
- options: flavourOptions,
77
- },
78
- ],
79
- },
80
- }
81
- return <Form config={config} validationSchema={validationSchema} />
82
- }
83
-
84
- export const Normal = Template.bind({})