@scbt-ecom/ui 0.4.1 → 0.4.2
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/.env +3 -0
- package/.github/workflows/publish.yml +61 -0
- package/.github/workflows/setup-node/action.yml +22 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc +20 -0
- package/.releaserc +18 -0
- package/.storybook/main.ts +44 -0
- package/.storybook/preview.tsx +37 -0
- package/chromatic.config.json +5 -0
- package/eslint.config.mjs +193 -0
- package/index.html +13 -0
- package/lib/client.ts +12 -0
- package/lib/configs/index.ts +2 -0
- package/lib/configs/tailwindConfigBase.ts +110 -0
- package/lib/configs/tailwindPresets/extendsPreset.ts +43 -0
- package/lib/configs/tailwindPresets/index.ts +2 -0
- package/lib/configs/tailwindPresets/resetPreset.ts +71 -0
- package/lib/hybrid.ts +25 -0
- package/lib/shared/constants/api.ts +2 -0
- package/lib/shared/constants/designSystem/colors.ts +121 -0
- package/lib/shared/constants/designSystem/index.ts +3 -0
- package/lib/shared/constants/designSystem/others.ts +30 -0
- package/lib/shared/constants/designSystem/typography.ts +88 -0
- package/lib/shared/constants/index.ts +2 -0
- package/lib/shared/hooks/index.ts +5 -0
- package/lib/shared/hooks/useBoolean.ts +12 -0
- package/lib/shared/hooks/useClickOutside.ts +22 -0
- package/lib/shared/hooks/useCombineRef.ts +23 -0
- package/lib/shared/hooks/useControlledForm.ts +16 -0
- package/lib/shared/hooks/useDebounce.ts +38 -0
- package/lib/shared/hooks/useMediaQuery.tsx +42 -0
- package/lib/shared/style.css +118 -0
- package/lib/shared/ui/Badge.tsx +20 -0
- package/lib/shared/ui/Breadcrumbs.tsx +57 -0
- package/lib/shared/ui/ButtonIcon.tsx +50 -0
- package/lib/shared/ui/CustomLink.tsx +76 -0
- package/lib/shared/ui/Document.tsx +51 -0
- package/lib/shared/ui/Heading.tsx +33 -0
- package/lib/shared/ui/Hint.tsx +72 -0
- package/lib/shared/ui/Loader.tsx +58 -0
- package/lib/shared/ui/PhoneView.tsx +23 -0
- package/lib/shared/ui/ProgressBar.tsx +43 -0
- package/lib/shared/ui/ResponsiveContainer.tsx +15 -0
- package/lib/shared/ui/Section.tsx +15 -0
- package/lib/shared/ui/Skeleton.tsx +9 -0
- package/lib/shared/ui/TabsSwitcher.tsx +87 -0
- package/lib/shared/ui/accordion/Accordion.tsx +36 -0
- package/lib/shared/ui/accordion/index.ts +1 -0
- package/lib/shared/ui/accordion/model/types.ts +20 -0
- package/lib/shared/ui/accordion/ui/AccordionHeader.tsx +35 -0
- package/lib/shared/ui/brandLogos.tsx +14 -0
- package/lib/shared/ui/button/Button.tsx +117 -0
- package/lib/shared/ui/button/index.ts +1 -0
- package/lib/shared/ui/button/model/helpers.ts +16 -0
- package/lib/shared/ui/formControlElements/CheckboxControl.tsx +92 -0
- package/lib/shared/ui/formControlElements/FormControl.tsx +5 -0
- package/lib/shared/ui/formControlElements/InputControlMask.tsx +90 -0
- package/lib/shared/ui/formControlElements/RadioControl.tsx +130 -0
- package/lib/shared/ui/formControlElements/SwitchControl.tsx +79 -0
- package/lib/shared/ui/formControlElements/TextareaControl.tsx +96 -0
- package/lib/shared/ui/formControlElements/calendarControl/CalendarControl.tsx +178 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/index.ts +2 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendar.tsx +86 -0
- package/lib/shared/ui/formControlElements/calendarControl/hooks/useCalendarDropdowns.ts +38 -0
- package/lib/shared/ui/formControlElements/calendarControl/index.ts +1 -0
- package/lib/shared/ui/formControlElements/calendarControl/model/helpers.ts +60 -0
- package/lib/shared/ui/formControlElements/calendarControl/model/types.ts +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfMonth.tsx +53 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/DaysOfWeek.tsx +28 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Dropdown.tsx +62 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Header.tsx +51 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/Navigation.tsx +32 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/OptionsList.tsx +44 -0
- package/lib/shared/ui/formControlElements/calendarControl/ui/index.ts +4 -0
- package/lib/shared/ui/formControlElements/comboboxControl/ComboboxControl.tsx +134 -0
- package/lib/shared/ui/formControlElements/comboboxControl/index.ts +1 -0
- package/lib/shared/ui/formControlElements/comboboxControl/model/selectClassnames.ts +51 -0
- package/lib/shared/ui/formControlElements/comboboxControl/model/types.ts +42 -0
- package/lib/shared/ui/formControlElements/comboboxControl/ui/ComboboxOption.tsx +38 -0
- package/lib/shared/ui/formControlElements/comboboxControl/ui/DropdownIndicator.tsx +23 -0
- package/lib/shared/ui/formControlElements/comboboxControl/ui/MultiValueRemove.tsx +16 -0
- package/lib/shared/ui/formControlElements/comboboxControl/ui/index.ts +3 -0
- package/lib/shared/ui/formControlElements/dadata/DadataInputControl.tsx +137 -0
- package/lib/shared/ui/formControlElements/dadata/index.ts +1 -0
- package/lib/shared/ui/formControlElements/dadata/model/api.ts +25 -0
- package/lib/shared/ui/formControlElements/dadata/model/helpers.ts +76 -0
- package/lib/shared/ui/formControlElements/dadata/model/types.ts +52 -0
- package/lib/shared/ui/formControlElements/dadata/model/useDadata.ts +25 -0
- package/lib/shared/ui/formControlElements/editorControl/EditorControl.tsx +82 -0
- package/lib/shared/ui/formControlElements/editorControl/components/conrols.tsx +136 -0
- package/lib/shared/ui/formControlElements/editorControl/components/menu.tsx +107 -0
- package/lib/shared/ui/formControlElements/editorControl/index.ts +60 -0
- package/lib/shared/ui/formControlElements/editorControl/ui/RemoveBlockButton.tsx +23 -0
- package/lib/shared/ui/formControlElements/editorControl/ui/ResetBlockType.tsx +17 -0
- package/lib/shared/ui/formControlElements/index.ts +14 -0
- package/lib/shared/ui/formControlElements/inputControl/InputControl.tsx +87 -0
- package/lib/shared/ui/formControlElements/inputControl/index.ts +1 -0
- package/lib/shared/ui/formControlElements/inputControl/model/hooks.tsx +26 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/InputControlUploader.tsx +47 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/index.ts +1 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/model/helpers.ts +18 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/model/hooks/useUploader.tsx +66 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/model/index.ts +1 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/model/types.ts +22 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/File.tsx +35 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/Filename.tsx +40 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/Files.tsx +30 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/Input.tsx +48 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/Uploader.tsx +58 -0
- package/lib/shared/ui/formControlElements/inputControlUploader/ui/index.ts +3 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/InputCurrencyControl.tsx +88 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/index.ts +1 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/model/helpers.ts +46 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/model/useInputCurrency.tsx +33 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/ui/MenuTrigger.tsx +20 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/ui/OptionList.tsx +29 -0
- package/lib/shared/ui/formControlElements/inputCurrencyControl/ui/index.ts +2 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/InputSliderControl.tsx +144 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/index.ts +1 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/dates/getEndWordMonth.ts +14 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/dates/getYearEnding.ts +13 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/dates/index.ts +2 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/formatNumber.ts +6 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/getInputSliderSuffix.ts +20 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/getStepByVariant.ts +29 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/helpers/index.ts +4 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/types.ts +1 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/model/useSlider.ts +26 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/ui/SliderControl.tsx +47 -0
- package/lib/shared/ui/formControlElements/inputSliderControl/ui/index.ts +1 -0
- package/lib/shared/ui/formControlElements/model/classes-types.ts +22 -0
- package/lib/shared/ui/formControlElements/model/index.ts +2 -0
- package/lib/shared/ui/formControlElements/model/message-view-animation.ts +6 -0
- package/lib/shared/ui/formControlElements/model/props-types.ts +31 -0
- package/lib/shared/ui/formControlElements/ui/FieldAttachment.tsx +76 -0
- package/lib/shared/ui/formControlElements/ui/FieldContainer.tsx +37 -0
- package/lib/shared/ui/formControlElements/ui/FieldWrapper.tsx +33 -0
- package/lib/shared/ui/formControlElements/ui/Label.tsx +32 -0
- package/lib/shared/ui/formControlElements/ui/MessageView.tsx +41 -0
- package/lib/shared/ui/formControlElements/ui/index.ts +4 -0
- package/lib/shared/ui/icon/Icon.tsx +41 -0
- package/lib/shared/ui/icon/index.ts +2 -0
- package/lib/shared/ui/icon/sprite.gen.ts +177 -0
- package/lib/shared/ui/index.ts +68 -0
- package/lib/shared/ui/modal/Modal.tsx +68 -0
- package/lib/shared/ui/modal/index.ts +1 -0
- package/lib/shared/ui/modal/model/helpers.ts +13 -0
- package/lib/shared/ui/modal/ui/ModalHeader.tsx +33 -0
- package/lib/shared/ui/notification/Notification.tsx +31 -0
- package/lib/shared/ui/notification/index.ts +1 -0
- package/lib/shared/ui/notification/ui/CustomToast.tsx +42 -0
- package/lib/shared/ui/popover/Popover.tsx +74 -0
- package/lib/shared/ui/popover/index.ts +1 -0
- package/lib/shared/ui/providers/NotificationProvider.tsx +29 -0
- package/lib/shared/ui/providers/index.ts +1 -0
- package/lib/shared/ui/table/Table.tsx +144 -0
- package/lib/shared/ui/table/index.ts +1 -0
- package/lib/shared/ui/table/type.ts +30 -0
- package/lib/shared/utils/capitalize.ts +6 -0
- package/lib/shared/utils/cn.ts +6 -0
- package/lib/shared/utils/deepCompare.ts +1 -0
- package/lib/shared/utils/formatToDate.ts +5 -0
- package/lib/shared/utils/index.ts +5 -0
- package/lib/shared/utils/isClient.ts +1 -0
- package/lib/shared/validation/index.ts +3 -0
- package/lib/shared/validation/messages.ts +12 -0
- package/lib/shared/validation/regExp.ts +5 -0
- package/lib/shared/validation/zodValidation/calendar.ts +32 -0
- package/lib/shared/validation/zodValidation/dadataFio.ts +67 -0
- package/lib/shared/validation/zodValidation/index.ts +2 -0
- package/lib/vite-env.d.ts +2 -0
- package/lib/widgets/Advantages.tsx +45 -0
- package/lib/widgets/banner/Banner.tsx +74 -0
- package/lib/widgets/banner/index.ts +1 -0
- package/lib/widgets/banner/model/helpers.ts +159 -0
- package/lib/widgets/banner/money.png +0 -0
- package/lib/widgets/banner/saif.jpg +0 -0
- package/lib/widgets/banner/saifMob.jpg +0 -0
- package/lib/widgets/banner/seif.jpg +0 -0
- package/lib/widgets/banner/shield.jpg +0 -0
- package/lib/widgets/banner/shield.png +0 -0
- package/lib/widgets/banner/ui/BannerButtonsGroup.tsx +44 -0
- package/lib/widgets/banner/ui/banners/BannerImageFull.tsx +82 -0
- package/lib/widgets/banner/ui/banners/BannerWithSeparateImg.tsx +60 -0
- package/lib/widgets/banner/ui/banners/index.ts +1 -0
- package/lib/widgets/footer/Footer.tsx +95 -0
- package/lib/widgets/footer/index.ts +1 -0
- package/lib/widgets/footer/model/defaultValues.tsx +105 -0
- package/lib/widgets/footer/model/types.ts +19 -0
- package/lib/widgets/footer/ui/Copyright.tsx +15 -0
- package/lib/widgets/footer/ui/Ligal.tsx +50 -0
- package/lib/widgets/footer/ui/NavLinks.tsx +41 -0
- package/lib/widgets/footer/ui/PhonesBlock.tsx +34 -0
- package/lib/widgets/footer/ui/SocialLinks.tsx +30 -0
- package/lib/widgets/footer/ui/index.ts +5 -0
- package/lib/widgets/index.ts +5 -0
- package/lib/widgets/pageHeader/PageHeader.tsx +54 -0
- package/lib/widgets/pageHeader/index.ts +1 -0
- package/lib/widgets/stepper/Stepper.tsx +43 -0
- package/lib/widgets/stepper/index.ts +1 -0
- package/lib/widgets/stepper/ui/SingleStep.tsx +42 -0
- package/package.json +1 -4
- package/postcss.config.mjs +8 -0
- package/public/sprites/arrows.svg +1 -0
- package/public/sprites/brandLogos.svg +1 -0
- package/public/sprites/files.svg +1 -0
- package/public/sprites/general.svg +1 -0
- package/public/sprites/info.svg +1 -0
- package/public/sprites/social.svg +1 -0
- package/src/App.tsx +9 -0
- package/src/app/providers/RootProvider.tsx +11 -0
- package/src/app/providers/index.ts +1 -0
- package/src/app/providers/model/types.ts +5 -0
- package/src/configs/setup.ts +9 -0
- package/src/configs/storybook.config.ts +23 -0
- package/src/main.tsx +10 -0
- package/src/stories/primitives/Accordion.stories.tsx +66 -0
- package/src/stories/primitives/Badge.stories.tsx +28 -0
- package/src/stories/primitives/Breadcrumbs.stories.tsx +29 -0
- package/src/stories/primitives/Button/Button.stories.tsx +149 -0
- package/src/stories/primitives/Button/Button.test.tsx +150 -0
- package/src/stories/primitives/ButtonIcon.stories.tsx +75 -0
- package/src/stories/primitives/CustomLink.stories.tsx +64 -0
- package/src/stories/primitives/Document.stories.tsx +36 -0
- package/src/stories/primitives/Heading.stories.tsx +29 -0
- package/src/stories/primitives/Hint.stories.tsx +82 -0
- package/src/stories/primitives/Icon.stories.tsx +36 -0
- package/src/stories/primitives/Loader.stories.tsx +39 -0
- package/src/stories/primitives/Modal.stories.tsx +106 -0
- package/src/stories/primitives/Notification.stories.tsx +102 -0
- package/src/stories/primitives/PhoneView.stories.tsx +22 -0
- package/src/stories/primitives/Popover.stories.tsx +41 -0
- package/src/stories/primitives/ProgressBar.stories.tsx +68 -0
- package/src/stories/primitives/Skeleton.stories.tsx +21 -0
- package/src/stories/primitives/Table.stories.tsx +44 -0
- package/src/stories/primitives/TabsSwitcher.stories.tsx +45 -0
- package/src/stories/primitives/formControl/CalendarControl.stories.tsx +45 -0
- package/src/stories/primitives/formControl/CheckboxControl.stories.tsx +64 -0
- package/src/stories/primitives/formControl/ComboboxControl.stories.tsx +67 -0
- package/src/stories/primitives/formControl/DadataInputControl.stories.tsx +79 -0
- package/src/stories/primitives/formControl/EditorControl.stories.tsx +31 -0
- package/src/stories/primitives/formControl/FormControlAllFields.stories.tsx +25 -0
- package/src/stories/primitives/formControl/InputControl.stories.tsx +84 -0
- package/src/stories/primitives/formControl/InputControlPassword.stories.tsx +38 -0
- package/src/stories/primitives/formControl/InputControlUploader.stories.tsx +44 -0
- package/src/stories/primitives/formControl/InputCurrencyControl.stories.tsx +73 -0
- package/src/stories/primitives/formControl/InputSliderControl.stories.tsx +62 -0
- package/src/stories/primitives/formControl/RadioContol.stories.tsx +61 -0
- package/src/stories/primitives/formControl/SwitchControl.stories.tsx +51 -0
- package/src/stories/primitives/formControl/TextareaControl.stories.tsx +55 -0
- package/src/stories/primitives/formControl/inputControlMask.stories.tsx +67 -0
- package/src/stories/widgets/Advantages.stories.tsx +42 -0
- package/src/stories/widgets/Banner.stories.tsx +94 -0
- package/src/stories/widgets/Footer.stories.tsx +36 -0
- package/src/stories/widgets/PageHeader.stories.tsx +33 -0
- package/src/stories/widgets/Stepper.stories.tsx +24 -0
- package/src/storybookHelpers/actions.tsx +5 -0
- package/src/storybookHelpers/index.ts +2 -0
- package/src/storybookHelpers/reactHookForm/index.ts +3 -0
- package/src/storybookHelpers/reactHookForm/model/mockData.ts +19 -0
- package/src/storybookHelpers/reactHookForm/model/mocks.tsx +105 -0
- package/src/storybookHelpers/reactHookForm/model/renderFields.tsx +58 -0
- package/src/storybookHelpers/reactHookForm/model/types.ts +86 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFieldsMapper.tsx +32 -0
- package/src/storybookHelpers/reactHookForm/ui/StorybookFormProvider.tsx +43 -0
- package/src/storybookHelpers/reactHookForm/ui/index.ts +2 -0
- package/src/storybookHelpers/table/utils/defaultValue.ts +51 -0
- package/static/arrows/arrowCircle.svg +18 -0
- package/static/arrows/arrowLink.svg +3 -0
- package/static/arrows/arrowRight.svg +3 -0
- package/static/brandLogos/logoBlack.svg +14 -0
- package/static/brandLogos/logoBusiness.svg +80 -0
- package/static/brandLogos/logoGray.svg +56 -0
- package/static/brandLogos/logoInsurance.svg +124 -0
- package/static/brandLogos/logoMain.svg +14 -0
- package/static/brandLogos/logoWhite.svg +56 -0
- package/static/files/border.svg +6 -0
- package/static/files/borderError.svg +6 -0
- package/static/files/documentFilled.svg +4 -0
- package/static/files/documentOutline.svg +4 -0
- package/static/files/upload.svg +3 -0
- package/static/general/calendar.svg +3 -0
- package/static/general/check.svg +6 -0
- package/static/general/close.svg +12 -0
- package/static/general/edit.svg +4 -0
- package/static/general/hiddenEye.svg +4 -0
- package/static/general/plus.svg +3 -0
- package/static/general/showEye.svg +4 -0
- package/static/info/warningCircle.svg +5 -0
- package/static/social/classmates.svg +3 -0
- package/static/social/telegram.svg +3 -0
- package/static/social/vk.svg +3 -0
- package/tailwind.config.ts +10 -0
- package/tsconfig.json +33 -0
- package/tsconfig.node.json +11 -0
- package/vite.config.ts +68 -0
- package/vitest.config.mjs +12 -0
- package/dist/scbt-ecom-ui-0.4.1.tgz +0 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
2
|
+
import { ProgressBar } from '$/shared/ui/ProgressBar'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'INTERACTIVE/ProgressBar',
|
|
6
|
+
component: ProgressBar,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered'
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs']
|
|
11
|
+
} satisfies Meta<typeof ProgressBar>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
const topContent = (
|
|
18
|
+
<>
|
|
19
|
+
<div className='desk-body-regular-l text-color-dark'>Заполните контактные данные</div>
|
|
20
|
+
<div className='desk-body-regular-l text-color-dark'>+35% к одобрению</div>
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
const bottomContent = (
|
|
25
|
+
<>
|
|
26
|
+
<div className='desk-body-regular-l text-color-dark'>
|
|
27
|
+
Шаг 1 <span className='text-color-tetriary'>из 6</span>
|
|
28
|
+
</div>
|
|
29
|
+
<div className='desk-body-regular-l text-color-tetriary'>+10% за следующий шаг</div>
|
|
30
|
+
</>
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
export const Base: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
progress: 40
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const TopContent: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
topContent,
|
|
42
|
+
progress: 40
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const BottomContent: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
bottomContent,
|
|
49
|
+
progress: 40
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const FullContent: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
topContent,
|
|
56
|
+
bottomContent,
|
|
57
|
+
progress: 40
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export const WithMaxPercent: Story = {
|
|
62
|
+
args: {
|
|
63
|
+
topContent,
|
|
64
|
+
bottomContent,
|
|
65
|
+
progress: 40,
|
|
66
|
+
maxPercent: 70
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
2
|
+
import { Skeleton } from '$/shared/ui'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Base/Skeleton',
|
|
6
|
+
component: Skeleton,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered'
|
|
9
|
+
},
|
|
10
|
+
tags: ['autodocs']
|
|
11
|
+
} satisfies Meta<typeof Skeleton>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof meta>
|
|
16
|
+
|
|
17
|
+
export const Base: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
className: 'w-[280px] h-[400px] rounded-md'
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import {
|
|
3
|
+
tableValue,
|
|
4
|
+
tableValueThreeCols,
|
|
5
|
+
tableValueThreeColsWithoutTitles,
|
|
6
|
+
tableValueWithoutTitles
|
|
7
|
+
} from '@/storybookHelpers/table/utils/defaultValue'
|
|
8
|
+
import { Table } from '$/shared/ui/'
|
|
9
|
+
|
|
10
|
+
const meta = {
|
|
11
|
+
title: 'DataBlocks/Table',
|
|
12
|
+
component: Table,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
parameters: {
|
|
15
|
+
layout: 'centered'
|
|
16
|
+
}
|
|
17
|
+
} satisfies Meta<typeof Table>
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof meta>
|
|
21
|
+
|
|
22
|
+
export const Base: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
...tableValue
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const ThreeColumns: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
...tableValueThreeCols
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const BaseWithoutTitles: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
...tableValueWithoutTitles
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const ThreeColumnsWithoutTitles: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
...tableValueThreeColsWithoutTitles
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useState } from 'react'
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
+
import { Button, type ITabRenderContent, TabsSwitcher } from '$/shared/ui'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Base/TabsSwitcher',
|
|
7
|
+
component: TabsSwitcher,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered'
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs']
|
|
12
|
+
} satisfies Meta<typeof TabsSwitcher>
|
|
13
|
+
|
|
14
|
+
export default meta
|
|
15
|
+
|
|
16
|
+
type Story = StoryObj<typeof TabsSwitcher>
|
|
17
|
+
|
|
18
|
+
const TABS_MOCKS: ITabRenderContent = {
|
|
19
|
+
triggers: [
|
|
20
|
+
{ id: '1', label: 'Условия' },
|
|
21
|
+
{ id: '2', label: 'Вклады' },
|
|
22
|
+
{ id: '3', label: 'Депозиты' }
|
|
23
|
+
],
|
|
24
|
+
contents: [
|
|
25
|
+
{ id: '1', body: <>Условия контент</>, accordion: { title: 'Обернут в аккордеон' } },
|
|
26
|
+
{ id: '2', body: <>Вклады контент</> },
|
|
27
|
+
{ id: '3', body: <>Депозиты контент</> }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const Base: Story = {
|
|
32
|
+
render: () => {
|
|
33
|
+
const [activeTab, setTab] = useState('2')
|
|
34
|
+
const changeTab = (tab: string) => setTab(tab)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<div className='flex flex-col gap-6'>
|
|
38
|
+
<Button size='sm' onClick={() => changeTab('3')}>
|
|
39
|
+
Активный таб 3
|
|
40
|
+
</Button>
|
|
41
|
+
<TabsSwitcher value={activeTab} onChangeTab={changeTab} renderContent={TABS_MOCKS} />
|
|
42
|
+
</div>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { CalendarControl, Icon } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/CalendarControl',
|
|
8
|
+
component: CalendarControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story) => (
|
|
15
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
16
|
+
<Story />
|
|
17
|
+
</StorybookFormProvider>
|
|
18
|
+
)
|
|
19
|
+
],
|
|
20
|
+
render: (args) => {
|
|
21
|
+
const { watch, control, setValue } = useFormContext()
|
|
22
|
+
const methods = { watch, control, setValue }
|
|
23
|
+
|
|
24
|
+
return <CalendarControl {...args} {...methods} />
|
|
25
|
+
}
|
|
26
|
+
} satisfies Meta<typeof CalendarControl>
|
|
27
|
+
export default meta
|
|
28
|
+
|
|
29
|
+
type Story = StoryObj<typeof CalendarControl>
|
|
30
|
+
|
|
31
|
+
export const Base: Story = {
|
|
32
|
+
args: {
|
|
33
|
+
name: 'calendar',
|
|
34
|
+
label: 'Дата рождения',
|
|
35
|
+
helperText: 'Укажите дату рождения',
|
|
36
|
+
icon: <Icon name='general/calendar' className='size-5 cursor-pointer text-icon-blue-grey-700' />,
|
|
37
|
+
size: 'md',
|
|
38
|
+
badge: '+25%',
|
|
39
|
+
swapPosition: true,
|
|
40
|
+
classes: {
|
|
41
|
+
attachmentWrapper: 'mr-2 gap-2',
|
|
42
|
+
icon: 'size-10 rounded-full bg-color-transparent transition-colors flex items-center justify-center hover:bg-color-primary-tr-hover active:bg-color-primary-tr-pressed'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { CheckboxControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/CheckboxControl',
|
|
8
|
+
component: CheckboxControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
render: ({ ...args }) => {
|
|
14
|
+
const { control } = useFormContext()
|
|
15
|
+
const methods = { control }
|
|
16
|
+
return <CheckboxControl {...args} {...methods} />
|
|
17
|
+
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (
|
|
20
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
21
|
+
<Story />
|
|
22
|
+
</StorybookFormProvider>
|
|
23
|
+
)
|
|
24
|
+
]
|
|
25
|
+
} satisfies Meta<typeof CheckboxControl>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof CheckboxControl>
|
|
29
|
+
|
|
30
|
+
const checkboxLabel = (
|
|
31
|
+
<>
|
|
32
|
+
<a href='https://sovcombank.ru/' target='_blank' rel='noreferrer' className='text-color-primary-default'>
|
|
33
|
+
Выражаю согласие
|
|
34
|
+
</a>{' '}
|
|
35
|
+
на обработку персональных данных и подтверждаю, что ознакомлен с{' '}
|
|
36
|
+
<a href='https://sovcombank.ru/' target='_blank' rel='noreferrer' className='text-color-primary-default'>
|
|
37
|
+
Политикой
|
|
38
|
+
</a>{' '}
|
|
39
|
+
обработки персональных данных
|
|
40
|
+
</>
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
export const Base: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
label: checkboxLabel,
|
|
46
|
+
name: 'condition'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const WithHelperText: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
label: checkboxLabel,
|
|
53
|
+
name: 'condition',
|
|
54
|
+
helperText: 'Утвердите согласие'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const Disabled: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
label: checkboxLabel,
|
|
61
|
+
name: 'condition',
|
|
62
|
+
disabled: true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
+
import { MOCK_SELECT_OPTIONS_REACT_SELECT, mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { ComboboxControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/ComboboxControl',
|
|
8
|
+
component: ComboboxControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
],
|
|
19
|
+
render: ({ ...args }) => {
|
|
20
|
+
const { control } = useFormContext()
|
|
21
|
+
const methods = { control }
|
|
22
|
+
return <ComboboxControl {...args} {...methods} />
|
|
23
|
+
},
|
|
24
|
+
tags: ['autodocs']
|
|
25
|
+
} satisfies Meta<typeof ComboboxControl>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof ComboboxControl>
|
|
29
|
+
|
|
30
|
+
export const Base: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
name: 'credit',
|
|
33
|
+
label: 'Выберите кредит',
|
|
34
|
+
size: 'md',
|
|
35
|
+
options: MOCK_SELECT_OPTIONS_REACT_SELECT
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const Disabled: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
name: 'credit',
|
|
42
|
+
label: 'Выберите кредит',
|
|
43
|
+
size: 'md',
|
|
44
|
+
disabled: true,
|
|
45
|
+
options: [...MOCK_SELECT_OPTIONS_REACT_SELECT]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const IsNotSearchable: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
name: 'credit',
|
|
52
|
+
label: 'Выберите кредит',
|
|
53
|
+
size: 'md',
|
|
54
|
+
options: [...MOCK_SELECT_OPTIONS_REACT_SELECT],
|
|
55
|
+
isSearchable: false
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export const Multi: Story = {
|
|
60
|
+
args: {
|
|
61
|
+
name: 'credit',
|
|
62
|
+
label: 'Выберите кредит',
|
|
63
|
+
size: 'md',
|
|
64
|
+
isMulti: true,
|
|
65
|
+
options: [...MOCK_SELECT_OPTIONS_REACT_SELECT]
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { DadataInputControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/DadataInputControl',
|
|
8
|
+
component: DadataInputControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
],
|
|
19
|
+
render: ({ ...args }) => {
|
|
20
|
+
const { control } = useFormContext()
|
|
21
|
+
const methods = { control }
|
|
22
|
+
return <DadataInputControl {...args} {...methods} />
|
|
23
|
+
},
|
|
24
|
+
tags: ['autodocs']
|
|
25
|
+
} satisfies Meta<typeof DadataInputControl>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof DadataInputControl>
|
|
29
|
+
|
|
30
|
+
export const DadataFio: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
name: 'fio',
|
|
33
|
+
label: 'ФИО',
|
|
34
|
+
size: 'lg',
|
|
35
|
+
dadataBaseUrl: 'cache',
|
|
36
|
+
badge: '+25%'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const DadataAddress: Story = {
|
|
41
|
+
args: {
|
|
42
|
+
name: 'address',
|
|
43
|
+
label: 'Адрес',
|
|
44
|
+
size: 'lg',
|
|
45
|
+
dadataType: 'address',
|
|
46
|
+
dadataBaseUrl: 'cache'
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export const DadataCountry: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
name: 'country',
|
|
53
|
+
label: 'Страна',
|
|
54
|
+
size: 'lg',
|
|
55
|
+
dadataType: 'country',
|
|
56
|
+
dadataBaseUrl: 'constants'
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const DadataAuto: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
name: 'auto',
|
|
63
|
+
label: 'Авто',
|
|
64
|
+
size: 'lg',
|
|
65
|
+
dadataType: 'auto',
|
|
66
|
+
dadataBaseUrl: 'constants'
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export const DadataOrganization: Story = {
|
|
71
|
+
args: {
|
|
72
|
+
name: 'organization',
|
|
73
|
+
label: 'Организация',
|
|
74
|
+
size: 'lg',
|
|
75
|
+
dadataType: 'party',
|
|
76
|
+
dadataBaseUrl: 'cache',
|
|
77
|
+
badge: '+25%'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { EditorControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/EditorControl',
|
|
8
|
+
component: EditorControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
decorators: [
|
|
14
|
+
(Story) => (
|
|
15
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
16
|
+
<Story />
|
|
17
|
+
</StorybookFormProvider>
|
|
18
|
+
)
|
|
19
|
+
],
|
|
20
|
+
render: ({ ...args }) => {
|
|
21
|
+
const { control } = useFormContext()
|
|
22
|
+
const methods = { control }
|
|
23
|
+
return <EditorControl {...args} {...methods} />
|
|
24
|
+
}
|
|
25
|
+
} satisfies Meta<typeof EditorControl>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof EditorControl>
|
|
29
|
+
export const Base: Story = {
|
|
30
|
+
args: {}
|
|
31
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react'
|
|
2
|
+
import { mockDefaultValues, mockFields, mockSchema, StorybookFieldsMapper, StorybookFormProvider } from '@/storybookHelpers'
|
|
3
|
+
import { FormControl } from '$/shared/ui/'
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'CONTROLLED FORM UI/FormControlAllFields',
|
|
7
|
+
component: FormControl,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'centered'
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
]
|
|
19
|
+
} satisfies Meta<typeof FormControl>
|
|
20
|
+
|
|
21
|
+
export default meta
|
|
22
|
+
|
|
23
|
+
export const FormControlAllFields = () => {
|
|
24
|
+
return <StorybookFieldsMapper fields={mockFields} defaultValues={mockDefaultValues} />
|
|
25
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { Icon, InputControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/InputControl',
|
|
8
|
+
component: InputControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
],
|
|
19
|
+
render: (args) => {
|
|
20
|
+
const { control } = useFormContext()
|
|
21
|
+
const methods = { control }
|
|
22
|
+
|
|
23
|
+
return <InputControl {...args} {...methods} />
|
|
24
|
+
},
|
|
25
|
+
tags: ['autodocs']
|
|
26
|
+
} satisfies Meta<typeof InputControl>
|
|
27
|
+
|
|
28
|
+
export default meta
|
|
29
|
+
type Story = StoryObj<typeof meta>
|
|
30
|
+
|
|
31
|
+
export const Base: Story = {
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
args: {
|
|
35
|
+
name: 'city',
|
|
36
|
+
label: 'Город',
|
|
37
|
+
size: 'md'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const WithIcon: Story = {
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
43
|
+
// @ts-ignore
|
|
44
|
+
args: {
|
|
45
|
+
name: 'city',
|
|
46
|
+
label: 'Город',
|
|
47
|
+
size: 'md',
|
|
48
|
+
icon: <Icon name='general/check' className='text-icon-positive-default' />
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const WithBadge: Story = {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
args: {
|
|
56
|
+
name: 'city',
|
|
57
|
+
label: 'Город',
|
|
58
|
+
size: 'md',
|
|
59
|
+
badge: '+25%'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const WithHelperText: Story = {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
args: {
|
|
67
|
+
name: 'city',
|
|
68
|
+
label: 'Город',
|
|
69
|
+
helperText: 'Введите город проживания',
|
|
70
|
+
size: 'md'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const Disabled: Story = {
|
|
75
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
args: {
|
|
78
|
+
name: 'city',
|
|
79
|
+
label: 'Город',
|
|
80
|
+
helperText: 'Введите город проживания',
|
|
81
|
+
size: 'md',
|
|
82
|
+
disabled: true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { InputControl } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/InputControlPassword',
|
|
8
|
+
component: InputControl,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
],
|
|
19
|
+
render: ({ ...args }) => {
|
|
20
|
+
const { control } = useFormContext()
|
|
21
|
+
const methods = { control }
|
|
22
|
+
return <InputControl {...args} {...methods} />
|
|
23
|
+
},
|
|
24
|
+
tags: ['autodocs']
|
|
25
|
+
} satisfies Meta<typeof InputControl>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof InputControl>
|
|
29
|
+
|
|
30
|
+
export const Base: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
name: 'password',
|
|
33
|
+
label: 'Пароль',
|
|
34
|
+
size: 'md',
|
|
35
|
+
helperText: 'Введите пароль',
|
|
36
|
+
variant: 'password'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { useFormContext } from 'react-hook-form'
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
3
|
+
import { mockDefaultValues, mockSchema, StorybookFormProvider } from '@/storybookHelpers'
|
|
4
|
+
import { InputControlUploader } from '$/shared/ui'
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'CONTROLLED FORM UI/InputControlUploader',
|
|
8
|
+
component: InputControlUploader,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'centered'
|
|
11
|
+
},
|
|
12
|
+
decorators: [
|
|
13
|
+
(Story) => (
|
|
14
|
+
<StorybookFormProvider validationSchema={mockSchema} defaultValues={mockDefaultValues}>
|
|
15
|
+
<Story />
|
|
16
|
+
</StorybookFormProvider>
|
|
17
|
+
)
|
|
18
|
+
],
|
|
19
|
+
render: ({ ...args }) => {
|
|
20
|
+
const { control } = useFormContext()
|
|
21
|
+
const methods = { control }
|
|
22
|
+
return <InputControlUploader {...args} {...methods} />
|
|
23
|
+
},
|
|
24
|
+
tags: ['autodocs']
|
|
25
|
+
} satisfies Meta<typeof InputControlUploader>
|
|
26
|
+
|
|
27
|
+
export default meta
|
|
28
|
+
type Story = StoryObj<typeof InputControlUploader>
|
|
29
|
+
|
|
30
|
+
export const Base: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
name: 'files',
|
|
33
|
+
label: 'Файлы',
|
|
34
|
+
helperText: 'Фотография должна быть четкой',
|
|
35
|
+
dropzoneOptions: {
|
|
36
|
+
maxSize: 1024 * 1024 * 4,
|
|
37
|
+
multiple: true,
|
|
38
|
+
accept: {
|
|
39
|
+
'image/jpeg': [],
|
|
40
|
+
'image/png': []
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|