@scbt-ecom/ui 0.0.30 → 0.0.31
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/client.d.ts +2 -0
- package/dist/client.js +921 -0
- package/dist/cn-uh4jkx7b.js +2892 -0
- package/dist/configs/index.d.ts +1 -0
- package/dist/configs/tailwindConfigBase.d.ts +2 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +15 -0
- package/dist/shared/constants/api.d.ts +2 -0
- package/dist/shared/constants/designSystem/colors.d.ts +120 -0
- package/dist/shared/constants/designSystem/index.d.ts +3 -0
- package/dist/shared/constants/designSystem/others.d.ts +16 -0
- package/dist/shared/constants/designSystem/typography.d.ts +75 -0
- package/dist/shared/constants/index.d.ts +2 -0
- package/dist/shared/hooks/index.d.ts +4 -0
- package/dist/shared/hooks/useBoolean.d.ts +3 -0
- package/dist/shared/hooks/useClickOutside.d.ts +2 -0
- package/dist/shared/hooks/useControlledForm.d.ts +7 -0
- package/dist/shared/hooks/useDebounce.d.ts +3 -0
- package/dist/shared/ui/Badge.d.ts +6 -0
- package/dist/shared/ui/Breadcrumbs.d.ts +15 -0
- package/dist/shared/ui/ButtonIcon.d.ts +17 -0
- package/dist/shared/ui/CustomLink.d.ts +15 -0
- package/dist/shared/ui/Document.d.ts +13 -0
- package/dist/shared/ui/Heading.d.ts +12 -0
- package/dist/shared/ui/Hint.d.ts +21 -0
- package/dist/shared/ui/Loader.d.ts +21 -0
- package/dist/shared/ui/PhoneView.d.ts +12 -0
- package/dist/shared/ui/Portal.d.ts +7 -0
- package/dist/shared/ui/ProgressBar.d.ts +18 -0
- package/dist/shared/ui/ResponsiveContainer.d.ts +6 -0
- package/dist/shared/ui/Section.d.ts +6 -0
- package/dist/shared/ui/Skeleton.d.ts +4 -0
- package/dist/shared/ui/TabsSwitcher.d.ts +33 -0
- package/dist/shared/ui/accordion/Accordion.d.ts +13 -0
- package/dist/shared/ui/accordion/index.d.ts +1 -0
- package/dist/shared/ui/accordion/model/types.d.ts +17 -0
- package/dist/shared/ui/accordion/ui/AccordionHeader.d.ts +8 -0
- package/dist/shared/ui/brandLogos.d.ts +5 -0
- package/dist/shared/ui/button/Button.d.ts +17 -0
- package/dist/shared/ui/button/index.d.ts +1 -0
- package/dist/shared/ui/button/model/helpers.d.ts +2 -0
- package/dist/shared/ui/calendar/Calendar.d.ts +20 -0
- package/dist/shared/ui/calendar/index.d.ts +1 -0
- package/dist/shared/ui/calendar/model/animation.d.ts +18 -0
- package/dist/shared/ui/calendar/model/classes.d.ts +24 -0
- package/dist/shared/ui/calendar/model/helpers.d.ts +9 -0
- package/dist/shared/ui/calendar/model/hooks/index.d.ts +2 -0
- package/dist/shared/ui/calendar/model/hooks/useCalendarDropdowns.d.ts +9 -0
- package/dist/shared/ui/calendar/model/hooks/useDatePicker.d.ts +19 -0
- package/dist/shared/ui/calendar/ui/CalendarHeader.d.ts +15 -0
- package/dist/shared/ui/calendar/ui/Dropdown.d.ts +10 -0
- package/dist/shared/ui/calendar/ui/NavigationArrows.d.ts +5 -0
- package/dist/shared/ui/calendar/ui/Weekdays.d.ts +1 -0
- package/dist/shared/ui/calendar/ui/index.d.ts +2 -0
- package/dist/shared/ui/formControlElements/CheckboxControl.d.ts +13 -0
- package/dist/shared/ui/formControlElements/FormControl.d.ts +3 -0
- package/dist/shared/ui/formControlElements/InputControl.d.ts +6 -0
- package/dist/shared/ui/formControlElements/InputControlMask.d.ts +10 -0
- package/dist/shared/ui/formControlElements/RadioControl.d.ts +26 -0
- package/dist/shared/ui/formControlElements/SelectControl.d.ts +27 -0
- package/dist/shared/ui/formControlElements/SwitchControl.d.ts +16 -0
- package/dist/shared/ui/formControlElements/TextareaControl.d.ts +11 -0
- package/dist/shared/ui/formControlElements/calendarControl/CalendarControl.d.ts +13 -0
- package/dist/shared/ui/formControlElements/calendarControl/hooks/index.d.ts +2 -0
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendar.d.ts +16 -0
- package/dist/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.d.ts +9 -0
- package/{lib/shared/ui/formControlElements/calendarControl/index.ts → dist/shared/ui/formControlElements/calendarControl/index.d.ts} +1 -1
- package/dist/shared/ui/formControlElements/calendarControl/model/helpers.d.ts +24 -0
- package/dist/shared/ui/formControlElements/calendarControl/model/types.d.ts +33 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.d.ts +10 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.d.ts +6 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/Dropdown.d.ts +11 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/Header.d.ts +14 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/Navigation.d.ts +9 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/OptionsList.d.ts +5 -0
- package/dist/shared/ui/formControlElements/calendarControl/ui/index.d.ts +4 -0
- package/dist/shared/ui/formControlElements/dadata/DadataInputControl.d.ts +14 -0
- package/{lib/shared/ui/formControlElements/dadata/index.ts → dist/shared/ui/formControlElements/dadata/index.d.ts} +1 -1
- package/dist/shared/ui/formControlElements/dadata/model/api.d.ts +2 -0
- package/dist/shared/ui/formControlElements/dadata/model/helpers.d.ts +7 -0
- package/dist/shared/ui/formControlElements/dadata/model/types.d.ts +42 -0
- package/dist/shared/ui/formControlElements/dadata/model/useDadata.d.ts +7 -0
- package/{lib/shared/ui/formControlElements/index.ts → dist/shared/ui/formControlElements/index.d.ts} +10 -10
- package/dist/shared/ui/formControlElements/model/classes-types.d.ts +18 -0
- package/dist/shared/ui/formControlElements/model/index.d.ts +2 -0
- package/dist/shared/ui/formControlElements/model/props-types.d.ts +20 -0
- package/dist/shared/ui/formControlElements/ui/FieldAttachment.d.ts +13 -0
- package/dist/shared/ui/formControlElements/ui/FieldContainer.d.ts +14 -0
- package/dist/shared/ui/formControlElements/ui/FieldWrapper.d.ts +14 -0
- package/dist/shared/ui/formControlElements/ui/MessageView.d.ts +13 -0
- package/dist/shared/ui/formControlElements/ui/index.d.ts +4 -0
- package/dist/shared/ui/icon/Icon.d.ts +10 -0
- package/{lib/shared/ui/icon/index.ts → dist/shared/ui/icon/index.d.ts} +2 -2
- package/dist/shared/ui/icon/sprite.gen.d.ts +17 -0
- package/dist/shared/ui/index.d.ts +21 -0
- package/dist/shared/ui/popover/Popover.d.ts +23 -0
- package/dist/shared/ui/popover/index.d.ts +1 -0
- package/dist/shared/ui/table/Table.d.ts +17 -0
- package/dist/shared/ui/table/index.d.ts +1 -0
- package/dist/shared/ui/table/type.d.ts +21 -0
- package/dist/shared/utils/capitalize.d.ts +1 -0
- package/dist/shared/utils/cn.d.ts +2 -0
- package/dist/shared/utils/deepCompare.d.ts +1 -0
- package/dist/shared/utils/formatToDate.d.ts +1 -0
- package/dist/shared/utils/index.d.ts +5 -0
- package/dist/shared/utils/isClient.d.ts +1 -0
- package/dist/shared/validation/index.d.ts +3 -0
- package/dist/shared/validation/messages.d.ts +12 -0
- package/dist/shared/validation/regExp.d.ts +3 -0
- package/dist/shared/validation/zodValidation/calendar.d.ts +2 -0
- package/dist/shared/validation/zodValidation/dadataFio.d.ts +6 -0
- package/dist/shared/validation/zodValidation/index.d.ts +2 -0
- package/dist/widgets/Advantages.d.ts +17 -0
- package/dist/widgets/banner/Banner.d.ts +28 -0
- package/dist/widgets/banner/index.d.ts +1 -0
- package/dist/widgets/banner/model/helpers.d.ts +4 -0
- package/dist/widgets/banner/ui/BannerButtonsGroup.d.ts +12 -0
- package/{lib/widgets/index.ts → dist/widgets/index.d.ts} +3 -3
- package/dist/widgets/pageHeader/PageHeader.d.ts +16 -0
- package/{lib/widgets/pageHeader/index.ts → dist/widgets/pageHeader/index.d.ts} +1 -1
- package/package.json +4 -1
- package/.env +0 -2
- package/.eslintrc.cjs +0 -134
- package/.github/workflows/npm-publish.yml +0 -22
- package/.github/workflows/publish.yml +0 -49
- package/.github/workflows/setup-node/action.yml +0 -22
- package/.husky/pre-commit +0 -1
- package/.prettierrc +0 -19
- package/.storybook/main.ts +0 -44
- package/.storybook/preview.tsx +0 -37
- package/chromatic.config.json +0 -5
- package/index.html +0 -13
- package/lib/client.ts +0 -80
- package/lib/configs/index.ts +0 -1
- package/lib/configs/tailwindConfigBase.ts +0 -110
- package/lib/server.ts +0 -2
- package/lib/shared/constants/api.ts +0 -2
- package/lib/shared/constants/designSystem/colors.ts +0 -117
- package/lib/shared/constants/designSystem/index.ts +0 -3
- package/lib/shared/constants/designSystem/others.ts +0 -18
- package/lib/shared/constants/designSystem/typography.ts +0 -88
- package/lib/shared/constants/index.ts +0 -2
- package/lib/shared/hooks/index.ts +0 -4
- package/lib/shared/hooks/useBoolean.ts +0 -12
- package/lib/shared/hooks/useClickOutside.ts +0 -19
- package/lib/shared/hooks/useControlledForm.ts +0 -16
- package/lib/shared/hooks/useDebounce.ts +0 -38
- package/lib/shared/style.css +0 -74
- package/lib/shared/ui/Badge.tsx +0 -20
- package/lib/shared/ui/Breadcrumbs.tsx +0 -57
- package/lib/shared/ui/ButtonIcon.tsx +0 -52
- package/lib/shared/ui/CustomLink.tsx +0 -70
- package/lib/shared/ui/Document.tsx +0 -51
- package/lib/shared/ui/Heading.tsx +0 -33
- package/lib/shared/ui/Hint.tsx +0 -62
- package/lib/shared/ui/Loader.tsx +0 -58
- package/lib/shared/ui/PhoneView.tsx +0 -23
- package/lib/shared/ui/Portal.tsx +0 -9
- package/lib/shared/ui/ProgressBar.tsx +0 -43
- package/lib/shared/ui/ResponsiveContainer.tsx +0 -11
- package/lib/shared/ui/Section.tsx +0 -15
- package/lib/shared/ui/Skeleton.tsx +0 -9
- package/lib/shared/ui/TabsSwitcher.tsx +0 -80
- package/lib/shared/ui/accordion/Accordion.tsx +0 -36
- package/lib/shared/ui/accordion/index.ts +0 -1
- package/lib/shared/ui/accordion/model/types.ts +0 -20
- package/lib/shared/ui/accordion/ui/AccordionHeader.tsx +0 -35
- package/lib/shared/ui/brandLogos.tsx +0 -14
- package/lib/shared/ui/button/Button.tsx +0 -111
- package/lib/shared/ui/button/index.ts +0 -1
- package/lib/shared/ui/button/model/helpers.ts +0 -16
- package/lib/shared/ui/calendar/Calendar.tsx +0 -228
- package/lib/shared/ui/calendar/index.ts +0 -231
- package/lib/shared/ui/calendar/model/animation.ts +0 -112
- package/lib/shared/ui/calendar/model/classes.ts +0 -34
- package/lib/shared/ui/calendar/model/helpers.ts +0 -51
- package/lib/shared/ui/calendar/model/hooks/index.ts +0 -2
- package/lib/shared/ui/calendar/model/hooks/useCalendarDropdowns.ts +0 -38
- package/lib/shared/ui/calendar/model/hooks/useDatePicker.ts +0 -103
- package/lib/shared/ui/calendar/ui/CalendarHeader.tsx +0 -54
- package/lib/shared/ui/calendar/ui/Dropdown.tsx +0 -75
- package/lib/shared/ui/calendar/ui/NavigationArrows.tsx +0 -23
- package/lib/shared/ui/calendar/ui/Weekdays.tsx +0 -16
- package/lib/shared/ui/calendar/ui/index.ts +0 -2
- package/lib/shared/ui/formControlElements/CheckboxControl.tsx +0 -92
- package/lib/shared/ui/formControlElements/FormControl.tsx +0 -5
- package/lib/shared/ui/formControlElements/InputControl.tsx +0 -68
- package/lib/shared/ui/formControlElements/InputControlMask.tsx +0 -80
- package/lib/shared/ui/formControlElements/RadioControl.tsx +0 -130
- package/lib/shared/ui/formControlElements/SelectControl.tsx +0 -185
- package/lib/shared/ui/formControlElements/SwitchControl.tsx +0 -79
- package/lib/shared/ui/formControlElements/TextareaControl.tsx +0 -92
- package/lib/shared/ui/formControlElements/calendarControl/CalendarControl.tsx +0 -175
- package/lib/shared/ui/formControlElements/calendarControl/hooks/index.ts +0 -2
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendar.tsx +0 -86
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.ts +0 -38
- package/lib/shared/ui/formControlElements/calendarControl/model/helpers.ts +0 -60
- package/lib/shared/ui/formControlElements/calendarControl/model/types.ts +0 -44
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.tsx +0 -53
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.tsx +0 -28
- package/lib/shared/ui/formControlElements/calendarControl/ui/Dropdown.tsx +0 -62
- package/lib/shared/ui/formControlElements/calendarControl/ui/Header.tsx +0 -51
- package/lib/shared/ui/formControlElements/calendarControl/ui/Navigation.tsx +0 -32
- package/lib/shared/ui/formControlElements/calendarControl/ui/OptionsList.tsx +0 -44
- package/lib/shared/ui/formControlElements/calendarControl/ui/index.ts +0 -4
- package/lib/shared/ui/formControlElements/dadata/DadataInputControl.tsx +0 -132
- package/lib/shared/ui/formControlElements/dadata/model/api.ts +0 -25
- package/lib/shared/ui/formControlElements/dadata/model/helpers.ts +0 -76
- package/lib/shared/ui/formControlElements/dadata/model/types.ts +0 -52
- package/lib/shared/ui/formControlElements/dadata/model/useDadata.ts +0 -25
- package/lib/shared/ui/formControlElements/model/classes-types.ts +0 -22
- package/lib/shared/ui/formControlElements/model/index.ts +0 -2
- package/lib/shared/ui/formControlElements/model/props-types.ts +0 -26
- package/lib/shared/ui/formControlElements/ui/FieldAttachment.tsx +0 -66
- package/lib/shared/ui/formControlElements/ui/FieldContainer.tsx +0 -36
- package/lib/shared/ui/formControlElements/ui/FieldWrapper.tsx +0 -55
- package/lib/shared/ui/formControlElements/ui/MessageView.tsx +0 -37
- package/lib/shared/ui/formControlElements/ui/index.ts +0 -4
- package/lib/shared/ui/icon/Icon.tsx +0 -43
- package/lib/shared/ui/icon/sprite.gen.ts +0 -121
- package/lib/shared/ui/index.ts +0 -56
- package/lib/shared/ui/popover/Popover.tsx +0 -77
- package/lib/shared/ui/popover/index.ts +0 -1
- package/lib/shared/ui/table/Table.tsx +0 -143
- package/lib/shared/ui/table/index.ts +0 -1
- package/lib/shared/ui/table/type.ts +0 -30
- package/lib/shared/utils/capitalize.ts +0 -6
- package/lib/shared/utils/cn.ts +0 -6
- package/lib/shared/utils/deepCompare.ts +0 -1
- package/lib/shared/utils/formatToDate.ts +0 -5
- package/lib/shared/utils/index.ts +0 -5
- package/lib/shared/utils/isClient.ts +0 -1
- package/lib/shared/validation/index.ts +0 -3
- package/lib/shared/validation/messages.ts +0 -12
- package/lib/shared/validation/regExp.ts +0 -5
- package/lib/shared/validation/zodValidation/calendar.ts +0 -32
- package/lib/shared/validation/zodValidation/dadataFio.ts +0 -67
- package/lib/shared/validation/zodValidation/index.ts +0 -2
- package/lib/vite-env.d.ts +0 -2
- package/lib/widgets/Advantages.tsx +0 -45
- package/lib/widgets/banner/Banner.tsx +0 -62
- package/lib/widgets/banner/index.ts +0 -1
- package/lib/widgets/banner/model/helpers.ts +0 -44
- package/lib/widgets/banner/money.png +0 -0
- package/lib/widgets/banner/ui/BannerButtonsGroup.tsx +0 -30
- package/lib/widgets/pageHeader/PageHeader.tsx +0 -54
- package/postcss.config.mjs +0 -8
- package/src/App.tsx +0 -9
- package/src/app/providers/RootProvider.tsx +0 -11
- package/src/app/providers/index.ts +0 -1
- package/src/app/providers/model/types.ts +0 -5
- package/src/app/providers/ui/ToasterProvider.tsx +0 -23
- package/src/app/providers/ui/index.ts +0 -1
- package/src/configs/setup.ts +0 -9
- package/src/configs/storybook.config.ts +0 -23
- package/src/main.tsx +0 -10
- package/src/stories/primitives/Accordion.stories.tsx +0 -66
- package/src/stories/primitives/Badge.stories.tsx +0 -28
- package/src/stories/primitives/Breadcrumbs.stories.tsx +0 -29
- package/src/stories/primitives/Button/Button.stories.tsx +0 -149
- package/src/stories/primitives/Button/Button.test.tsx +0 -150
- package/src/stories/primitives/ButtonIcon.stories.tsx +0 -75
- package/src/stories/primitives/CustomLink.stories.tsx +0 -64
- package/src/stories/primitives/Document.stories.tsx +0 -36
- package/src/stories/primitives/Heading.stories.tsx +0 -29
- package/src/stories/primitives/Hint.stories.tsx +0 -82
- package/src/stories/primitives/Icon.stories.tsx +0 -36
- package/src/stories/primitives/Loader.stories.tsx +0 -39
- package/src/stories/primitives/PhoneView.stories.tsx +0 -22
- package/src/stories/primitives/Popover.stories.tsx +0 -41
- package/src/stories/primitives/ProgressBar.stories.tsx +0 -68
- package/src/stories/primitives/Skeleton.stories.tsx +0 -21
- package/src/stories/primitives/Table.stories.tsx +0 -44
- package/src/stories/primitives/TabsSwitcher.stories.tsx +0 -34
- package/src/stories/primitives/formControl/Calendar.stories.tsx +0 -61
- package/src/stories/primitives/formControl/CalendarControl.stories.tsx +0 -39
- package/src/stories/primitives/formControl/CheckboxControl.stories.tsx +0 -64
- package/src/stories/primitives/formControl/DadataInputControl.stories.tsx +0 -83
- package/src/stories/primitives/formControl/FormControlAllFields.stories.tsx +0 -25
- package/src/stories/primitives/formControl/InputControl.stories.tsx +0 -77
- package/src/stories/primitives/formControl/RadioContol.stories.tsx +0 -63
- package/src/stories/primitives/formControl/SelectControl.stories.tsx +0 -117
- package/src/stories/primitives/formControl/SwitchControl.stories.tsx +0 -51
- package/src/stories/primitives/formControl/TextareaControl.stories.tsx +0 -55
- package/src/stories/primitives/formControl/inputControlMask.stories.tsx +0 -69
- package/src/stories/widgets/Advantages.stories.tsx +0 -42
- package/src/stories/widgets/Banner.stories.tsx +0 -40
- package/src/stories/widgets/PageHeader.stories.tsx +0 -33
- package/src/storybookHelpers/actions.tsx +0 -5
- package/src/storybookHelpers/index.ts +0 -2
- package/src/storybookHelpers/reactHookForm/index.ts +0 -3
- package/src/storybookHelpers/reactHookForm/model/mockData.ts +0 -21
- package/src/storybookHelpers/reactHookForm/model/mocks.tsx +0 -71
- package/src/storybookHelpers/reactHookForm/model/types.ts +0 -62
- package/src/storybookHelpers/reactHookForm/ui/StorybookFieldsMapper.tsx +0 -76
- package/src/storybookHelpers/reactHookForm/ui/StorybookFormProvider.tsx +0 -43
- package/src/storybookHelpers/reactHookForm/ui/index.ts +0 -2
- package/src/storybookHelpers/table/utils/defaultValue.ts +0 -51
- package/static/arrows/arrowCircle.svg +0 -18
- package/static/arrows/arrowLink.svg +0 -3
- package/static/arrows/arrowRight.svg +0 -3
- package/static/brandLogos/logoBlack.svg +0 -14
- package/static/brandLogos/logoBusiness.svg +0 -80
- package/static/brandLogos/logoGray.svg +0 -56
- package/static/brandLogos/logoInsurance.svg +0 -124
- package/static/brandLogos/logoMain.svg +0 -14
- package/static/brandLogos/logoWhite.svg +0 -56
- package/static/files/documentFilled.svg +0 -4
- package/static/files/documentOutline.svg +0 -4
- package/static/general/calendar.svg +0 -3
- package/static/general/check.svg +0 -6
- package/static/general/close.svg +0 -12
- package/static/info/warningCircle.svg +0 -5
- package/tailwind.config.ts +0 -9
- package/tsconfig.json +0 -33
- package/tsconfig.node.json +0 -11
- package/vite.config.ts +0 -63
- package/vitest.config.mjs +0 -12
- /package/{public → dist}/sprites/arrows.svg +0 -0
- /package/{public → dist}/sprites/brandLogos.svg +0 -0
- /package/{public → dist}/sprites/common.svg +0 -0
- /package/{public → dist}/sprites/files.svg +0 -0
- /package/{public → dist}/sprites/general.svg +0 -0
- /package/{public → dist}/sprites/info.svg +0 -0
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
3
|
-
import { TextareaControl } from '$/shared/ui'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'CONTROLLED FORM UI/TextareaControl',
|
|
7
|
-
component: TextareaControl,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered'
|
|
10
|
-
},
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => (
|
|
13
|
-
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
14
|
-
<Story />
|
|
15
|
-
</StorybookFormProvider>
|
|
16
|
-
)
|
|
17
|
-
],
|
|
18
|
-
tags: ['autodocs']
|
|
19
|
-
} satisfies Meta<typeof TextareaControl>
|
|
20
|
-
|
|
21
|
-
export default meta
|
|
22
|
-
type Story = StoryObj<typeof meta>
|
|
23
|
-
|
|
24
|
-
export const Base: Story = {
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
args: {
|
|
28
|
-
name: 'description',
|
|
29
|
-
label: 'Описание к блоку',
|
|
30
|
-
size: 'md'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const WithPlaceholder: Story = {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
args: {
|
|
38
|
-
name: 'description',
|
|
39
|
-
label: 'Описание к блоку',
|
|
40
|
-
size: 'md',
|
|
41
|
-
placeholder: 'Введите описание'
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const Disabled: Story = {
|
|
46
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
47
|
-
// @ts-ignore
|
|
48
|
-
args: {
|
|
49
|
-
name: 'description',
|
|
50
|
-
label: 'Описание к блоку',
|
|
51
|
-
size: 'md',
|
|
52
|
-
placeholder: 'Введите описание',
|
|
53
|
-
disabled: true
|
|
54
|
-
}
|
|
55
|
-
}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
3
|
-
import { Icon, InputControlMask } from '$/shared/ui'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'CONTROLLED FORM UI/InputControlMask',
|
|
7
|
-
component: InputControlMask,
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered'
|
|
10
|
-
},
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => (
|
|
13
|
-
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
14
|
-
<Story />
|
|
15
|
-
</StorybookFormProvider>
|
|
16
|
-
)
|
|
17
|
-
],
|
|
18
|
-
tags: ['autodocs']
|
|
19
|
-
} satisfies Meta<typeof InputControlMask>
|
|
20
|
-
|
|
21
|
-
export default meta
|
|
22
|
-
type Story = StoryObj<typeof meta>
|
|
23
|
-
|
|
24
|
-
export const Base: Story = {
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
args: {
|
|
28
|
-
name: 'phone',
|
|
29
|
-
label: 'Номер телефона',
|
|
30
|
-
size: 'md',
|
|
31
|
-
format: '# (###) ###-##-##'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export const WithIcon: Story = {
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
37
|
-
// @ts-ignore
|
|
38
|
-
args: {
|
|
39
|
-
name: 'phone',
|
|
40
|
-
label: 'Номер телефона',
|
|
41
|
-
format: '# (###) ###-##-##',
|
|
42
|
-
size: 'md',
|
|
43
|
-
icon: <Icon name='general/check' className='text-icon-positive-default' />
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const WithBadge: Story = {
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
args: {
|
|
51
|
-
name: 'phone',
|
|
52
|
-
label: 'Номер телефона',
|
|
53
|
-
format: '# (###) ###-##-##',
|
|
54
|
-
size: 'md',
|
|
55
|
-
badge: '+25%'
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export const WithHelperText: Story = {
|
|
60
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
61
|
-
// @ts-ignore
|
|
62
|
-
args: {
|
|
63
|
-
name: 'phone',
|
|
64
|
-
label: 'Номер телефона',
|
|
65
|
-
size: 'md',
|
|
66
|
-
format: '# (###) ###-##-##',
|
|
67
|
-
helperText: 'Введите номер телефона'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type Meta, type StoryObj } from '@storybook/react'
|
|
2
|
-
import { Advantages, type IAdvantage } from '$/widgets/Advantages'
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'WIDGETS/Advantages',
|
|
6
|
-
component: Advantages,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
parameters: {
|
|
9
|
-
layout: 'centered'
|
|
10
|
-
},
|
|
11
|
-
decorators: [
|
|
12
|
-
(Story) => (
|
|
13
|
-
<div className='min-h-screen min-w-full bg-color-blue-grey-300 flex items-center justify-center px-6'>
|
|
14
|
-
<Story />
|
|
15
|
-
</div>
|
|
16
|
-
)
|
|
17
|
-
]
|
|
18
|
-
} satisfies Meta<typeof Advantages>
|
|
19
|
-
|
|
20
|
-
export default meta
|
|
21
|
-
|
|
22
|
-
type Story = StoryObj<typeof meta>
|
|
23
|
-
|
|
24
|
-
const mockThreeCards: IAdvantage[] = [
|
|
25
|
-
{ title: 'До 5 млн ₽', description: 'сумма кредита' },
|
|
26
|
-
{ title: 'До 5 лет', description: 'срок кредита' },
|
|
27
|
-
{ title: 'От 5 минут', description: 'быстрое одобрение' }
|
|
28
|
-
]
|
|
29
|
-
|
|
30
|
-
const mockFourCards: IAdvantage[] = [...mockThreeCards, { title: 'От 15 минут', description: 'сумма одобрение' }]
|
|
31
|
-
|
|
32
|
-
export const ThreeCards: Story = {
|
|
33
|
-
args: {
|
|
34
|
-
advantagesList: mockThreeCards
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const FourCards: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
advantagesList: mockFourCards
|
|
41
|
-
}
|
|
42
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import { Banner, PageHeader } from '$/widgets'
|
|
3
|
-
import { mockBannerBase, mockBannerOnlyPrimaryButton, mockWithAdvantages } from '$/widgets/banner/model/helpers'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'WIDGETS/Banner',
|
|
7
|
-
component: Banner,
|
|
8
|
-
tags: ['autodocs']
|
|
9
|
-
} satisfies Meta<typeof Banner>
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
|
|
13
|
-
type Story = StoryObj<typeof Banner>
|
|
14
|
-
|
|
15
|
-
export const Base: Story = {
|
|
16
|
-
render: () => (
|
|
17
|
-
<>
|
|
18
|
-
<PageHeader variant='withButton' />
|
|
19
|
-
<Banner {...mockBannerBase} />
|
|
20
|
-
</>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export const OnlyPrimaryButton: Story = {
|
|
25
|
-
render: () => (
|
|
26
|
-
<>
|
|
27
|
-
<PageHeader variant='withButton' />
|
|
28
|
-
<Banner {...mockBannerOnlyPrimaryButton} />
|
|
29
|
-
</>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const WithAdvantages: Story = {
|
|
34
|
-
render: () => (
|
|
35
|
-
<>
|
|
36
|
-
<PageHeader variant='withButton' />
|
|
37
|
-
<Banner {...mockWithAdvantages} />
|
|
38
|
-
</>
|
|
39
|
-
)
|
|
40
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import { PageHeader } from '$/widgets'
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'WIDGETS/PageHeader',
|
|
6
|
-
component: PageHeader,
|
|
7
|
-
tags: ['autodocs']
|
|
8
|
-
} satisfies Meta<typeof PageHeader>
|
|
9
|
-
|
|
10
|
-
export default meta
|
|
11
|
-
|
|
12
|
-
type Story = StoryObj<typeof meta>
|
|
13
|
-
|
|
14
|
-
export const WithPhone: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
variant: 'withPhone',
|
|
17
|
-
phone: '8 800 000-00-00',
|
|
18
|
-
phoneText: 'Бесплатно по России'
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const WithButton: Story = {
|
|
23
|
-
args: {
|
|
24
|
-
variant: 'withButton'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export const WithOtherLogo: Story = {
|
|
29
|
-
args: {
|
|
30
|
-
variant: 'withButton',
|
|
31
|
-
logoType: 'business'
|
|
32
|
-
}
|
|
33
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { type IRadioGroupOption, type ISelectOption } from '$/shared/ui'
|
|
2
|
-
|
|
3
|
-
export const MOCK_SELECT_OPTIONS: ISelectOption[] = [
|
|
4
|
-
{ id: '1', optionValue: 'Кредитная' },
|
|
5
|
-
{ id: '2', optionValue: 'Февраль' },
|
|
6
|
-
{ id: '3', optionValue: 'Март' },
|
|
7
|
-
{ id: '4', optionValue: 'Апрель' },
|
|
8
|
-
{ id: '5', optionValue: 'Май' },
|
|
9
|
-
{ id: '6', optionValue: 'Июнь' },
|
|
10
|
-
{ id: '7', optionValue: 'Июль' },
|
|
11
|
-
{ id: '8', optionValue: 'Август' },
|
|
12
|
-
{ id: '9', optionValue: 'Сентябрь' },
|
|
13
|
-
{ id: '10', optionValue: 'Октябрь' },
|
|
14
|
-
{ id: '11', optionValue: 'Ноябрь' },
|
|
15
|
-
{ id: '12', optionValue: 'Декабрь' }
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
export const MOCK_RADIO_GROUP: IRadioGroupOption[] = [
|
|
19
|
-
{ label: 'Мужской', value: 'male' },
|
|
20
|
-
{ label: 'Женский', value: 'female' }
|
|
21
|
-
]
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
import { MOCK_RADIO_GROUP, MOCK_SELECT_OPTIONS } from './mockData'
|
|
3
|
-
import { EnumFieldType, type TStorybookFieldConfig } from './types'
|
|
4
|
-
import { VALIDATION_MESSAGES, zodCalendarValidate } from '$/shared/validation'
|
|
5
|
-
|
|
6
|
-
export const mockToastMessage = (values: string) => (
|
|
7
|
-
<div className='flex flex-col'>
|
|
8
|
-
<p className='desk-body-regular-l'>Форма успешно отправлена</p>
|
|
9
|
-
<code className='desk-body-regular-m text-color-tetriary'>{values}</code>
|
|
10
|
-
</div>
|
|
11
|
-
)
|
|
12
|
-
|
|
13
|
-
export const mockSchema = z.object({
|
|
14
|
-
city: z.string({ required_error: VALIDATION_MESSAGES.REQUIRED }).min(3, `${VALIDATION_MESSAGES.MIN_LENGTH} 3`),
|
|
15
|
-
phone: z.string({ required_error: VALIDATION_MESSAGES.REQUIRED }).min(7, `${VALIDATION_MESSAGES.MIN_LENGTH} 7`),
|
|
16
|
-
fio: z.string({ required_error: VALIDATION_MESSAGES.REQUIRED }),
|
|
17
|
-
condition: z.literal<boolean>(true, { errorMap: () => ({ message: VALIDATION_MESSAGES.REQUIRED }) }),
|
|
18
|
-
sex: z.string().min(2, VALIDATION_MESSAGES.REQUIRED),
|
|
19
|
-
percent: z.literal<boolean>(true, { errorMap: () => ({ message: VALIDATION_MESSAGES.REQUIRED }) }),
|
|
20
|
-
months: z.string().or(z.array(z.string())),
|
|
21
|
-
description: z.string().min(3, `${VALIDATION_MESSAGES.MIN_LENGTH} 3`),
|
|
22
|
-
birthday: zodCalendarValidate
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
export type TMockSchema = z.infer<typeof mockSchema>
|
|
26
|
-
export const mockDefaultValues: TMockSchema = {
|
|
27
|
-
city: '',
|
|
28
|
-
phone: '',
|
|
29
|
-
fio: '',
|
|
30
|
-
condition: true,
|
|
31
|
-
sex: '',
|
|
32
|
-
percent: true,
|
|
33
|
-
months: '',
|
|
34
|
-
description: '',
|
|
35
|
-
birthday: ''
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const mockFields: TStorybookFieldConfig<TMockSchema>[] = [
|
|
39
|
-
{ name: 'city', label: 'Город', fieldType: EnumFieldType.INPUT },
|
|
40
|
-
{ name: 'phone', label: 'Номер телефона', fieldType: EnumFieldType.MASK, format: '# (###) ###-##-##' },
|
|
41
|
-
{ name: 'fio', label: 'ФИО', fieldType: EnumFieldType.DADATA },
|
|
42
|
-
{
|
|
43
|
-
name: 'condition',
|
|
44
|
-
label:
|
|
45
|
-
'Выражаю согласие на обработку персональных данных и подтверждаю, что ознакомлен с Политикой обработки персональных данных',
|
|
46
|
-
fieldType: EnumFieldType.CHECKBOX
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
name: 'sex',
|
|
50
|
-
groupName: 'Выберите пол',
|
|
51
|
-
radioItemsGroup: MOCK_RADIO_GROUP,
|
|
52
|
-
fieldType: EnumFieldType.RADIO
|
|
53
|
-
},
|
|
54
|
-
{ name: 'percent', label: 'Увеличенный процент', fieldType: EnumFieldType.SWITCH },
|
|
55
|
-
{
|
|
56
|
-
name: 'months',
|
|
57
|
-
label: 'Выберите месяц',
|
|
58
|
-
fieldType: EnumFieldType.SELECT,
|
|
59
|
-
optionsList: MOCK_SELECT_OPTIONS
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
name: 'description',
|
|
63
|
-
label: 'Описание к блоку',
|
|
64
|
-
fieldType: EnumFieldType.TEXTAREA
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
name: 'birthday',
|
|
68
|
-
label: 'Дата рождения',
|
|
69
|
-
fieldType: EnumFieldType.CALENDAR
|
|
70
|
-
}
|
|
71
|
-
]
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import type { FieldValues } from 'react-hook-form'
|
|
2
|
-
import { type ICalendarControlProps } from '$/shared/ui'
|
|
3
|
-
import type {
|
|
4
|
-
ICheckboxControlProps,
|
|
5
|
-
IDadataInputControlProps,
|
|
6
|
-
InputControlMaskProps,
|
|
7
|
-
InputControlProps,
|
|
8
|
-
IRadioControlProps,
|
|
9
|
-
ISelectControlProps,
|
|
10
|
-
ISwitchControlProps,
|
|
11
|
-
ITextareaControlProps
|
|
12
|
-
} from '$/shared/ui/formControlElements'
|
|
13
|
-
|
|
14
|
-
export enum EnumFieldType {
|
|
15
|
-
INPUT = 'input',
|
|
16
|
-
MASK = 'mask',
|
|
17
|
-
DADATA = 'dadata',
|
|
18
|
-
CHECKBOX = 'checkbox',
|
|
19
|
-
RADIO = 'radio',
|
|
20
|
-
SWITCH = 'switch',
|
|
21
|
-
SELECT = 'select',
|
|
22
|
-
TEXTAREA = 'textarea',
|
|
23
|
-
CALENDAR = 'calendar'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
type TControlledInput<T extends FieldValues> = Omit<InputControlProps<T>, 'control'> & { fieldType: EnumFieldType.INPUT }
|
|
27
|
-
type TControlledInputMask<T extends FieldValues> = Omit<InputControlMaskProps<T>, 'control'> & { fieldType: EnumFieldType.MASK }
|
|
28
|
-
type TControlledInputDadata<T extends FieldValues> = Omit<IDadataInputControlProps<T>, 'control'> & {
|
|
29
|
-
fieldType: EnumFieldType.DADATA
|
|
30
|
-
}
|
|
31
|
-
type TControlledInputCheckbox<T extends FieldValues> = Omit<ICheckboxControlProps<T>, 'control'> & {
|
|
32
|
-
fieldType: EnumFieldType.CHECKBOX
|
|
33
|
-
}
|
|
34
|
-
type TControlledInputRadio<T extends FieldValues> = Omit<IRadioControlProps<T>, 'control'> & {
|
|
35
|
-
fieldType: EnumFieldType.RADIO
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type TControlledInputSwitch<T extends FieldValues> = Omit<ISwitchControlProps<T>, 'control'> & {
|
|
39
|
-
fieldType: EnumFieldType.SWITCH
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type TControlledInputSelect<T extends FieldValues> = Omit<ISelectControlProps<T>, 'control'> & {
|
|
43
|
-
fieldType: EnumFieldType.SELECT
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
type TControlledInputTextarea<T extends FieldValues> = Omit<ITextareaControlProps<T>, 'control'> & {
|
|
47
|
-
fieldType: EnumFieldType.TEXTAREA
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
type TControlledInputCalendar<T extends FieldValues> = Omit<ICalendarControlProps<T>, 'control'> & {
|
|
51
|
-
fieldType: EnumFieldType.CALENDAR
|
|
52
|
-
}
|
|
53
|
-
export type TStorybookFieldConfig<T extends FieldValues> =
|
|
54
|
-
| TControlledInputMask<T>
|
|
55
|
-
| TControlledInput<T>
|
|
56
|
-
| TControlledInputDadata<T>
|
|
57
|
-
| TControlledInputCheckbox<T>
|
|
58
|
-
| TControlledInputRadio<T>
|
|
59
|
-
| TControlledInputSwitch<T>
|
|
60
|
-
| TControlledInputSelect<T>
|
|
61
|
-
| TControlledInputTextarea<T>
|
|
62
|
-
| TControlledInputCalendar<T>
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { type Control, type DefaultValues, type FieldValues, useFormContext } from 'react-hook-form'
|
|
2
|
-
import type { Schema, TypeOf } from 'zod'
|
|
3
|
-
import { EnumFieldType, type TStorybookFieldConfig } from '../model/types'
|
|
4
|
-
import {
|
|
5
|
-
Button,
|
|
6
|
-
CalendarControl,
|
|
7
|
-
CheckboxControl,
|
|
8
|
-
DadataInputControl,
|
|
9
|
-
InputControl,
|
|
10
|
-
InputControlMask,
|
|
11
|
-
RadioControl,
|
|
12
|
-
SelectControl,
|
|
13
|
-
SwitchControl,
|
|
14
|
-
TextareaControl
|
|
15
|
-
} from '$/shared/ui'
|
|
16
|
-
|
|
17
|
-
type TStorybookFieldsMapperProps<T extends FieldValues> = {
|
|
18
|
-
fields: TStorybookFieldConfig<T>[]
|
|
19
|
-
defaultValues?: DefaultValues<TypeOf<Schema>>
|
|
20
|
-
btnSubmit?: string
|
|
21
|
-
btnReset?: string
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const renderFields = <T extends FieldValues>(fieldConfig: TStorybookFieldConfig<T>, control: Control<FieldValues>) => {
|
|
25
|
-
const { fieldType } = fieldConfig
|
|
26
|
-
switch (fieldType) {
|
|
27
|
-
case EnumFieldType.INPUT:
|
|
28
|
-
return <InputControl control={control} {...fieldConfig} />
|
|
29
|
-
case EnumFieldType.MASK:
|
|
30
|
-
return <InputControlMask control={control} {...fieldConfig} />
|
|
31
|
-
case EnumFieldType.DADATA:
|
|
32
|
-
return <DadataInputControl control={control} {...fieldConfig} />
|
|
33
|
-
case EnumFieldType.CHECKBOX:
|
|
34
|
-
return <CheckboxControl control={control} {...fieldConfig} />
|
|
35
|
-
case EnumFieldType.RADIO:
|
|
36
|
-
return <RadioControl control={control} {...fieldConfig} />
|
|
37
|
-
case EnumFieldType.SWITCH:
|
|
38
|
-
return <SwitchControl control={control} {...fieldConfig} />
|
|
39
|
-
case EnumFieldType.SELECT:
|
|
40
|
-
return <SelectControl control={control} {...fieldConfig} />
|
|
41
|
-
case EnumFieldType.TEXTAREA:
|
|
42
|
-
return <TextareaControl control={control} {...fieldConfig} />
|
|
43
|
-
case EnumFieldType.CALENDAR:
|
|
44
|
-
return <CalendarControl control={control} {...fieldConfig} />
|
|
45
|
-
default:
|
|
46
|
-
return null
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export const StorybookFieldsMapper = <T extends FieldValues>({
|
|
51
|
-
fields,
|
|
52
|
-
defaultValues,
|
|
53
|
-
btnSubmit = 'Отправить',
|
|
54
|
-
btnReset = 'Сбросить состояние'
|
|
55
|
-
}: TStorybookFieldsMapperProps<T>) => {
|
|
56
|
-
const { control, clearErrors, reset } = useFormContext()
|
|
57
|
-
|
|
58
|
-
const resetStates = () => {
|
|
59
|
-
clearErrors()
|
|
60
|
-
reset(defaultValues)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<div className='flex flex-col gap-3 w-[600px]'>
|
|
65
|
-
{fields?.map((field) => <div key={field.name}>{renderFields(field, control)}</div>)}
|
|
66
|
-
<div className='flex items-center gap-6'>
|
|
67
|
-
{btnSubmit && <Button type='submit'>{btnSubmit}</Button>}
|
|
68
|
-
{btnReset && (
|
|
69
|
-
<Button onClick={resetStates} intent='secondary'>
|
|
70
|
-
Сбросить состояние
|
|
71
|
-
</Button>
|
|
72
|
-
)}
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
75
|
-
)
|
|
76
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { type ReactNode, useEffect } from 'react'
|
|
2
|
-
import { type DefaultValues, type FieldValues, FormProvider } from 'react-hook-form'
|
|
3
|
-
import toast from 'react-hot-toast'
|
|
4
|
-
import type { TypeOf, ZodTypeAny } from 'zod'
|
|
5
|
-
import { mockToastMessage } from '../model/mocks'
|
|
6
|
-
import { useControlledForm } from '$/shared/hooks'
|
|
7
|
-
|
|
8
|
-
interface IStorybookFormProviderProps<S extends ZodTypeAny> {
|
|
9
|
-
children: ReactNode
|
|
10
|
-
validationSchema: S
|
|
11
|
-
defaultValues?: DefaultValues<TypeOf<S>>
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const StorybookFormProvider = <S extends ZodTypeAny>({
|
|
15
|
-
children,
|
|
16
|
-
validationSchema,
|
|
17
|
-
defaultValues
|
|
18
|
-
}: IStorybookFormProviderProps<S>) => {
|
|
19
|
-
const formMethods = useControlledForm({
|
|
20
|
-
mode: 'all',
|
|
21
|
-
schema: validationSchema,
|
|
22
|
-
defaultValues
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const onSubmit = <T extends FieldValues>(values: T) => {
|
|
26
|
-
toast.success(mockToastMessage(JSON.stringify(values)), {
|
|
27
|
-
position: 'top-center',
|
|
28
|
-
duration: 5000
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
formMethods.reset(defaultValues)
|
|
34
|
-
}, [defaultValues, formMethods])
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<FormProvider {...formMethods}>
|
|
38
|
-
<form className='flex flex-col gap-5' onSubmit={formMethods.handleSubmit(onSubmit)}>
|
|
39
|
-
{children}
|
|
40
|
-
</form>
|
|
41
|
-
</FormProvider>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { ITable } from '../../../../lib/shared/ui/table/Table'
|
|
2
|
-
|
|
3
|
-
export const tableValue: ITable<'twoColumns'> = {
|
|
4
|
-
columnCount: 'twoColumns',
|
|
5
|
-
headTitle: 'headTitle',
|
|
6
|
-
tableHead: ['Заголовок 1', 'Заголовок 2'],
|
|
7
|
-
tableRows: [
|
|
8
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
9
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
10
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
11
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }]
|
|
12
|
-
],
|
|
13
|
-
additionalText: 'additionalText'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export const tableValueThreeCols: ITable<'threeColumns'> = {
|
|
17
|
-
columnCount: 'threeColumns',
|
|
18
|
-
headTitle: 'headTitle',
|
|
19
|
-
tableHead: ['Заголовок 1', 'Заголовок 2', 'Заголовок 3'],
|
|
20
|
-
tableRows: [
|
|
21
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
22
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
23
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
24
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }]
|
|
25
|
-
],
|
|
26
|
-
additionalText: 'additionalText'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const tableValueWithoutTitles: ITable<'twoColumns'> = {
|
|
30
|
-
columnCount: 'twoColumns',
|
|
31
|
-
headTitle: 'headTitle',
|
|
32
|
-
tableRows: [
|
|
33
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
34
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
35
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }],
|
|
36
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }]
|
|
37
|
-
],
|
|
38
|
-
additionalText: 'additionalText'
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const tableValueThreeColsWithoutTitles: ITable<'threeColumns'> = {
|
|
42
|
-
columnCount: 'threeColumns',
|
|
43
|
-
headTitle: 'headTitle',
|
|
44
|
-
tableRows: [
|
|
45
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
46
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
47
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }],
|
|
48
|
-
[{ text: 'Текст 1' }, { text: 'Текст 2' }, { text: 'Текст 3' }]
|
|
49
|
-
],
|
|
50
|
-
additionalText: 'additionalText'
|
|
51
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<svg
|
|
2
|
-
width='32'
|
|
3
|
-
height='32'
|
|
4
|
-
viewBox='0 0 32 32'
|
|
5
|
-
fill='none'
|
|
6
|
-
xmlns='http://www.w3.org/2000/svg'
|
|
7
|
-
>
|
|
8
|
-
<rect x='0.5' y='31.5' width='31' height='31' rx='15.5' transform='rotate(-90 0.5 31.5)' stroke='#5A6E85' />
|
|
9
|
-
<path
|
|
10
|
-
d='M22.7071 18.7071C22.3166 19.0976 21.6834 19.0976 21.2929 18.7071L16 13.4142L10.7071 18.7071C10.3166 19.0976 9.68342 19.0976 9.29289 18.7071C8.90237 18.3166 8.90237 17.6834 9.29289 17.2929L15.2929 11.2929C15.6834 10.9024 16.3166 10.9024 16.7071 11.2929L22.7071 17.2929C23.0976 17.6834 23.0976 18.3166 22.7071 18.7071Z'
|
|
11
|
-
fill='#5A6E85'
|
|
12
|
-
stroke='#F3F4F7'
|
|
13
|
-
strokeWidth='0.5'
|
|
14
|
-
strokeMiterlimit='10'
|
|
15
|
-
strokeLinecap='round'
|
|
16
|
-
strokeLinejoin='round'
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M8 7C8 6.44772 8.44772 6 9 6L17 6C17.5523 6 18 6.44772 18 7V15C18 15.5523 17.5523 16 17 16C16.4477 16 16 15.5523 16 15V9.41421L7.70711 17.7071C7.31658 18.0976 6.68342 18.0976 6.29289 17.7071C5.90237 17.3166 5.90237 16.6834 6.29289 16.2929L14.5858 8L9 8C8.44772 8 8 7.55228 8 7Z" fill="white"/>
|
|
3
|
-
</svg>
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M6.19526 13.1571C5.93491 12.8967 5.93491 12.4746 6.19526 12.2143L9.72386 8.68567L6.19526 5.15708C5.93491 4.89673 5.93491 4.47462 6.19526 4.21427C6.45561 3.95392 6.87772 3.95392 7.13807 4.21427L11.1381 8.21427C11.3984 8.47462 11.3984 8.89673 11.1381 9.15708L7.13807 13.1571C6.87772 13.4174 6.45561 13.4174 6.19526 13.1571Z" fill="#003790"/>
|
|
3
|
-
</svg>
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
<svg width="194" height="32" viewBox="0 0 194 32" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M38.4223 8C41.0768 8 43.275 9.18833 44.1874 10.0796L42.6528 11.9894C41.9063 11.3103 40.2472 10.3767 38.4223 10.3767C35.0628 10.3767 32.989 12.7533 32.989 15.9788C32.989 19.2042 34.9798 21.5809 38.4638 21.5809C40.4961 21.5809 42.2381 20.4775 43.0261 19.7135L44.4778 21.7082C43.5653 22.6844 41.2841 24 38.4638 24C33.5281 24 30.5004 20.6048 30.5004 16.0212C30.4589 11.3952 33.5696 8 38.4223 8Z" fill="#292929"/>
|
|
3
|
-
<path d="M53.6856 8C58.2479 8 61.566 11.3952 61.566 15.9788C61.566 20.6048 58.2479 23.9576 53.6856 23.9576C49.1232 23.9576 45.8051 20.5623 45.8051 15.9788C45.7637 11.3952 49.0817 8 53.6856 8ZM53.6856 21.5809C56.7963 21.5809 59.0774 19.2042 59.0774 15.9788C59.0774 12.7533 56.7963 10.3767 53.6856 10.3767C50.5749 10.3767 48.2937 12.7533 48.2937 15.9788C48.2937 19.2042 50.5749 21.5809 53.6856 21.5809Z" fill="#292929"/>
|
|
4
|
-
<path d="M77.2429 19.2044C77.2429 21.4537 75.8327 23.6182 72.1828 23.6182H64.2195V8.33966H71.7266C74.7543 8.33966 76.4963 10.2495 76.4963 12.4139C76.4963 13.6447 75.9571 14.7481 74.6299 15.6394C75.9571 16.1062 77.2429 17.1248 77.2429 19.2044ZM66.6665 10.7588V14.833L71.3948 14.7906C73.0953 14.7906 73.9663 13.8145 73.9663 12.711C73.9663 11.65 73.2197 10.7588 71.7266 10.7588H66.6665ZM72.3487 21.2415C74.0907 21.2415 74.7543 20.2654 74.7543 19.2044C74.7543 18.0585 73.9663 17.1248 72.3902 17.1248H66.708V21.284H72.3487V21.2415Z" fill="#292929"/>
|
|
5
|
-
<path d="M87.073 15.766L93.7092 23.6599H90.4326L84.9163 16.9968H82.0959V23.6599H79.6488V8.38142H82.0959V14.705H84.9163L90.3081 8.38142H93.5847L87.073 15.766Z" fill="#292929"/>
|
|
6
|
-
<path d="M101.258 8C105.82 8 109.139 11.3952 109.139 15.9788C109.139 20.6048 105.82 23.9576 101.258 23.9576C96.6958 23.9576 93.3777 20.5623 93.3777 15.9788C93.3777 11.3952 96.6958 8 101.258 8ZM101.258 21.5809C104.369 21.5809 106.65 19.2042 106.65 15.9788C106.65 12.7533 104.369 10.3767 101.258 10.3767C98.1474 10.3767 95.8662 12.7533 95.8662 15.9788C95.8662 19.2042 98.1889 21.5809 101.258 21.5809Z" fill="#292929"/>
|
|
7
|
-
<path d="M125.688 8.33966H128.052V23.6182H125.605V12.2866L120.711 18.9922H119.217L114.323 12.2866V23.6606H111.876V8.3821H114.24L119.964 16.2336L125.688 8.33966Z" fill="#292929"/>
|
|
8
|
-
<path d="M139.291 14.5784C142.567 14.5784 144.351 16.5306 144.351 19.0771C144.351 21.6235 142.567 23.6182 139.457 23.6182H131.328V8.33966H142.941V10.7588H133.775V14.6208H139.291V14.5784ZM139.374 21.2415C141.074 21.2415 141.862 20.2654 141.862 19.1195C141.862 17.9736 141.074 16.9975 139.374 16.9975H133.816V21.2415H139.374Z" fill="#292929"/>
|
|
9
|
-
<path d="M158.038 23.6182L156.421 19.7985H149.37L147.752 23.6182H145.056L151.527 8.33966H154.223L160.693 23.6182H158.038ZM150.282 17.5068H155.425L152.854 11.3954L150.282 17.5068Z" fill="#292929"/>
|
|
10
|
-
<path d="M173.633 8.33966H176.08V23.6182H173.633V17.0824H165.006V23.6182H162.559V8.33966H165.006V14.6633H173.633V8.33966Z" fill="#292929"/>
|
|
11
|
-
<path d="M186.864 15.766L193.5 23.6599H190.223L184.707 16.9968H181.887V23.6599H179.44V8.38142H181.887V14.705H184.707L190.099 8.38142H193.376L186.864 15.766Z" fill="#292929"/>
|
|
12
|
-
<path d="M0.5 16C0.5 22.6221 5.87789 28 12.4999 28C12.6604 28 12.821 28 12.9815 28V23.4649H12.4999C8.4063 23.4649 5.03508 20.1338 5.03508 16C5.03508 11.9064 8.36616 8.53512 12.4999 8.53512H12.9815V4C12.821 4 12.6604 4 12.4999 4C5.87789 4 0.5 9.37793 0.5 16Z" fill="#292929"/>
|
|
13
|
-
<path d="M14.9078 4.24117V10.502H12.4998C9.44964 10.502 6.96136 12.9903 6.96136 16.0405C6.96136 19.0907 9.44964 21.579 12.4998 21.579H14.9078V27.8398C20.4061 26.7161 24.4997 21.9 24.4997 16.0806C24.5398 10.181 20.4061 5.36492 14.9078 4.24117Z" fill="#292929"/>
|
|
14
|
-
</svg>
|