@registrucentras/rc-ses-react-components 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -0
- package/dist/assets/IconProps.d.ts +4 -0
- package/dist/assets/Logo.d.ts +3 -0
- package/dist/assets/ThemeColors.d.ts +6 -0
- package/dist/assets/icons/ArrowRightIcon.d.ts +3 -0
- package/dist/assets/icons/CalendarBlankIcon.d.ts +3 -0
- package/dist/assets/icons/CaretDoubleLeftBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretDoubleRightBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretDownBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretDownFill.d.ts +3 -0
- package/dist/assets/icons/CaretDownIcon.d.ts +3 -0
- package/dist/assets/icons/CaretLeftBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretLeftIcon.d.ts +3 -0
- package/dist/assets/icons/CaretRightBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CheckBoldDisabledIcon.d.ts +3 -0
- package/dist/assets/icons/CheckBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CheckCircleFillIcon.d.ts +3 -0
- package/dist/assets/icons/CheckUncheckedBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CloseIcon.d.ts +3 -0
- package/dist/assets/icons/CollapseChevronsIcon.d.ts +3 -0
- package/dist/assets/icons/ExpandChevronsIcon.d.ts +3 -0
- package/dist/assets/icons/InfoFillIcon.d.ts +3 -0
- package/dist/assets/icons/MagnifyingGlassIcon.d.ts +3 -0
- package/dist/assets/icons/MinusBoldIcon.d.ts +3 -0
- package/dist/assets/icons/PlusBoldIcon.d.ts +3 -0
- package/dist/assets/icons/QuestionFillIcon.d.ts +3 -0
- package/dist/assets/icons/QuestionIcon.d.ts +3 -0
- package/dist/assets/icons/ScrollIcon.d.ts +3 -0
- package/dist/assets/icons/SpinnerGapBoldIcon.d.ts +3 -0
- package/dist/assets/icons/UploadSimpleIcon.d.ts +3 -0
- package/dist/assets/icons/WarningDiamondFillIcon.d.ts +3 -0
- package/dist/assets/icons/WarningFillIcon.d.ts +3 -0
- package/dist/assets/icons/XCircleFillIcon.d.ts +3 -0
- package/dist/assets/resolvePaletteColorPath.d.ts +3 -0
- package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +11 -0
- package/dist/components/common/Accordion/index.d.ts +9 -0
- package/dist/components/common/Accordion/types/AccordionControllerState.d.ts +8 -0
- package/dist/components/common/Alert/index.d.ts +3 -0
- package/dist/components/common/Breadcrumbs/index.d.ts +9 -0
- package/dist/components/common/Button/ButtonWithPopover.d.ts +12 -0
- package/dist/components/common/Button/index.d.ts +6 -0
- package/dist/components/common/IconWithCircularBackground.d.ts +14 -0
- package/dist/components/common/Popover/index.d.ts +6 -0
- package/dist/components/common/Tabs/Tab.d.ts +3 -0
- package/dist/components/common/Tabs/TabPanel.d.ts +8 -0
- package/dist/components/common/Tabs/Tabs.d.ts +3 -0
- package/dist/components/common/Tabs/TabsWrapper.d.ts +7 -0
- package/dist/components/form/components/FormControlWrapper/components/FieldSuffix.d.ts +7 -0
- package/dist/components/form/components/FormControlWrapper/const/FormControlLayoutVariables.d.ts +2 -0
- package/dist/components/form/components/FormControlWrapper/index.d.ts +17 -0
- package/dist/components/form/inputs/Checkbox.d.ts +23 -0
- package/dist/components/form/inputs/CheckboxFormControl.d.ts +23 -0
- package/dist/components/form/inputs/Datepicker/components/RcSesDatepickerActionBar.d.ts +3 -0
- package/dist/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.d.ts +3 -0
- package/dist/components/form/inputs/Datepicker/index.d.ts +16 -0
- package/dist/components/form/inputs/FileDropzone.d.ts +21 -0
- package/dist/components/form/inputs/FileUpload.d.ts +19 -0
- package/dist/components/form/inputs/NumberStepper.d.ts +23 -0
- package/dist/components/form/inputs/PhoneInput.d.ts +3 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.d.ts +3 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.d.ts +3 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/OuterElementType.d.ts +5 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/PopperComponent.d.ts +7 -0
- package/dist/components/form/inputs/PhoneInputFormControl/components/RowComponent.d.ts +3 -0
- package/dist/components/form/inputs/PhoneInputFormControl/hooks/useResetCache.d.ts +4 -0
- package/dist/components/form/inputs/PhoneInputFormControl/index.d.ts +22 -0
- package/dist/components/form/inputs/PhoneInputFormControl/types/Country.d.ts +7 -0
- package/dist/components/form/inputs/RadioButtonGroup.d.ts +25 -0
- package/dist/components/form/inputs/SearchableField.d.ts +23 -0
- package/dist/components/form/inputs/Select.d.ts +27 -0
- package/dist/components/form/inputs/TextField.d.ts +16 -0
- package/dist/components/layout/ServiceFormActions.d.ts +9 -0
- package/dist/components/layout/ServiceFormContainer/components/AccordionCollapseControls.d.ts +6 -0
- package/dist/components/layout/ServiceFormContainer/index.d.ts +14 -0
- package/dist/components/layout/ServiceHeader.d.ts +9 -0
- package/dist/components/layout/ServicePage.d.ts +5 -0
- package/dist/components/layout/ServiceWizardStepper/components/ActiveStepIcon.d.ts +2 -0
- package/dist/components/layout/ServiceWizardStepper/components/CompletedStepIcon.d.ts +2 -0
- package/dist/components/layout/ServiceWizardStepper/components/PendingStepIcon.d.ts +2 -0
- package/dist/components/layout/ServiceWizardStepper/index.d.ts +6 -0
- package/dist/components/shared/storage/CookieStorage.d.ts +9 -0
- package/dist/components/storybook/FieldPreview.d.ts +8 -0
- package/dist/components/storybook/FieldPreviewRow.d.ts +8 -0
- package/dist/components/storybook/FieldView.d.ts +8 -0
- package/dist/components/storybook/Fields.d.ts +8 -0
- package/dist/components/storybook/PreviewTitle.d.ts +8 -0
- package/dist/env.d.ts +3 -0
- package/dist/i18n/@mui/x-date-pickers/ltLT.d.ts +133 -0
- package/dist/i18n/i18n.d.ts +6 -0
- package/dist/library/icons.d.ts +14 -0
- package/dist/library/index.d.ts +65 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +48 -0
- package/dist/registrucentras-rc-ses-react-components.js +7288 -0
- package/dist/stories/components/Accordion.stories.d.ts +30 -0
- package/dist/stories/components/Alert.stories.d.ts +7 -0
- package/dist/stories/components/Breadcrumbs.stories.d.ts +8 -0
- package/dist/stories/components/buttons/Button.stories.d.ts +65 -0
- package/dist/stories/components/form/CheckboxFormControl.stories.d.ts +26 -0
- package/dist/stories/components/form/ServiceFormActions.stories.d.ts +12 -0
- package/dist/stories/components/form/ServiceFormContainer.stories.d.ts +16 -0
- package/dist/stories/components/inputs/Checkbox.stories.d.ts +26 -0
- package/dist/stories/components/inputs/DatePicker.stories.d.ts +24 -0
- package/dist/stories/components/inputs/FileUpload.stories.d.ts +30 -0
- package/dist/stories/components/inputs/NumberStepper.stories.d.ts +34 -0
- package/dist/stories/components/inputs/RadioButtonGroup.stories.d.ts +34 -0
- package/dist/stories/components/inputs/SearchableField.stories.d.ts +335 -0
- package/dist/stories/components/inputs/Select.stories.d.ts +874 -0
- package/dist/stories/components/inputs/TextField.stories.d.ts +613 -0
- package/dist/theme/light/MuiAccordion.d.ts +3 -0
- package/dist/theme/light/MuiAccordionDetails.d.ts +3 -0
- package/dist/theme/light/MuiAccordionSummary.d.ts +3 -0
- package/dist/theme/light/MuiAlert.d.ts +3 -0
- package/dist/theme/light/MuiAutocomplete.d.ts +3 -0
- package/dist/theme/light/MuiBreadcrumbs.d.ts +3 -0
- package/dist/theme/light/MuiButton.d.ts +3 -0
- package/dist/theme/light/MuiButtonBase.d.ts +3 -0
- package/dist/theme/light/MuiCard.d.ts +3 -0
- package/dist/theme/light/MuiCardContent.d.ts +3 -0
- package/dist/theme/light/MuiCardHeader.d.ts +3 -0
- package/dist/theme/light/MuiCheckbox.d.ts +3 -0
- package/dist/theme/light/MuiChip.d.ts +3 -0
- package/dist/theme/light/MuiDialog.d.ts +3 -0
- package/dist/theme/light/MuiDivider.d.ts +3 -0
- package/dist/theme/light/MuiFormControl.d.ts +3 -0
- package/dist/theme/light/MuiFormControlLabel.d.ts +3 -0
- package/dist/theme/light/MuiFormGroup.d.ts +3 -0
- package/dist/theme/light/MuiFormHelperText.d.ts +3 -0
- package/dist/theme/light/MuiFormLabel.d.ts +3 -0
- package/dist/theme/light/MuiIconButton.d.ts +3 -0
- package/dist/theme/light/MuiInputBase.d.ts +3 -0
- package/dist/theme/light/MuiLinearProgress.d.ts +3 -0
- package/dist/theme/light/MuiPagination.d.ts +3 -0
- package/dist/theme/light/MuiPickersLayout.d.ts +3 -0
- package/dist/theme/light/MuiPopover.d.ts +3 -0
- package/dist/theme/light/MuiRadio.d.ts +3 -0
- package/dist/theme/light/MuiSelect.d.ts +3 -0
- package/dist/theme/light/MuiStepper.d.ts +3 -0
- package/dist/theme/light/MuiSvgIcon.d.ts +3 -0
- package/dist/theme/light/MuiTab.d.ts +3 -0
- package/dist/theme/light/MuiTable.d.ts +3 -0
- package/dist/theme/light/MuiTableCell.d.ts +3 -0
- package/dist/theme/light/MuiTabs.d.ts +3 -0
- package/dist/theme/light/MuiTextField.d.ts +3 -0
- package/dist/theme/light/MuiTypography.d.ts +3 -0
- package/dist/theme/light/index.d.ts +36 -0
- package/dist/theme/light/themePalette.d.ts +3 -0
- package/dist/theme/palette.d.ts +144 -0
- package/package.json +126 -0
- package/src/App.tsx +42 -0
- package/src/assets/IconProps.ts +5 -0
- package/src/assets/Logo.tsx +111 -0
- package/src/assets/ThemeColors.ts +7 -0
- package/src/assets/icons/ArrowRightIcon.tsx +21 -0
- package/src/assets/icons/CalendarBlankIcon.tsx +21 -0
- package/src/assets/icons/CaretDoubleLeftBoldIcon.tsx +20 -0
- package/src/assets/icons/CaretDoubleRightBoldIcon.tsx +20 -0
- package/src/assets/icons/CaretDownBoldIcon.tsx +20 -0
- package/src/assets/icons/CaretDownFill.tsx +16 -0
- package/src/assets/icons/CaretDownIcon.tsx +21 -0
- package/src/assets/icons/CaretLeftBoldIcon.tsx +20 -0
- package/src/assets/icons/CaretLeftIcon.tsx +21 -0
- package/src/assets/icons/CaretRightBoldIcon.tsx +20 -0
- package/src/assets/icons/CheckBoldDisabledIcon.tsx +32 -0
- package/src/assets/icons/CheckBoldIcon.tsx +32 -0
- package/src/assets/icons/CheckCircleFillIcon.tsx +21 -0
- package/src/assets/icons/CheckUncheckedBoldIcon.tsx +28 -0
- package/src/assets/icons/CloseIcon.tsx +21 -0
- package/src/assets/icons/CollapseChevronsIcon.tsx +21 -0
- package/src/assets/icons/ExpandChevronsIcon.tsx +21 -0
- package/src/assets/icons/InfoFillIcon.tsx +21 -0
- package/src/assets/icons/MagnifyingGlassIcon.tsx +16 -0
- package/src/assets/icons/MinusBoldIcon.tsx +21 -0
- package/src/assets/icons/PlusBoldIcon.tsx +21 -0
- package/src/assets/icons/QuestionFillIcon.tsx +21 -0
- package/src/assets/icons/QuestionIcon.tsx +21 -0
- package/src/assets/icons/ScrollIcon.tsx +21 -0
- package/src/assets/icons/SpinnerGapBoldIcon.tsx +20 -0
- package/src/assets/icons/UploadSimpleIcon.tsx +21 -0
- package/src/assets/icons/WarningDiamondFillIcon.tsx +21 -0
- package/src/assets/icons/WarningFillIcon.tsx +20 -0
- package/src/assets/icons/XCircleFillIcon.tsx +16 -0
- package/src/assets/resolvePaletteColorPath.ts +13 -0
- package/src/components/common/Accordion/hooks/useAccordionController.tsx +42 -0
- package/src/components/common/Accordion/index.tsx +52 -0
- package/src/components/common/Accordion/types/AccordionControllerState.ts +9 -0
- package/src/components/common/Alert/index.tsx +21 -0
- package/src/components/common/Breadcrumbs/index.tsx +21 -0
- package/src/components/common/Button/ButtonWithPopover.tsx +80 -0
- package/src/components/common/Button/index.tsx +21 -0
- package/src/components/common/IconWithCircularBackground.tsx +73 -0
- package/src/components/common/Popover/index.tsx +20 -0
- package/src/components/common/Tabs/Tab.tsx +9 -0
- package/src/components/common/Tabs/TabPanel.tsx +28 -0
- package/src/components/common/Tabs/Tabs.tsx +9 -0
- package/src/components/common/Tabs/TabsWrapper.tsx +33 -0
- package/src/components/form/components/FormControlWrapper/components/FieldSuffix.tsx +14 -0
- package/src/components/form/components/FormControlWrapper/const/FormControlLayoutVariables.ts +4 -0
- package/src/components/form/components/FormControlWrapper/index.tsx +137 -0
- package/src/components/form/inputs/Checkbox.tsx +52 -0
- package/src/components/form/inputs/CheckboxFormControl.tsx +135 -0
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerActionBar.tsx +37 -0
- package/src/components/form/inputs/Datepicker/components/RcSesDatepickerCalendarHeader.tsx +96 -0
- package/src/components/form/inputs/Datepicker/index.tsx +149 -0
- package/src/components/form/inputs/FileDropzone.tsx +215 -0
- package/src/components/form/inputs/FileUpload.tsx +143 -0
- package/src/components/form/inputs/NumberStepper.tsx +209 -0
- package/src/components/form/inputs/PhoneInput.tsx +28 -0
- package/src/components/form/inputs/PhoneInputFormControl/components/AutocompleteInput.tsx +40 -0
- package/src/components/form/inputs/PhoneInputFormControl/components/ListboxComponent.tsx +53 -0
- package/src/components/form/inputs/PhoneInputFormControl/components/OuterElementType.tsx +13 -0
- package/src/components/form/inputs/PhoneInputFormControl/components/PopperComponent.tsx +37 -0
- package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +46 -0
- package/src/components/form/inputs/PhoneInputFormControl/hooks/useResetCache.ts +14 -0
- package/src/components/form/inputs/PhoneInputFormControl/index.test.tsx +47 -0
- package/src/components/form/inputs/PhoneInputFormControl/index.tsx +238 -0
- package/src/components/form/inputs/PhoneInputFormControl/styles/styles.css +253 -0
- package/src/components/form/inputs/PhoneInputFormControl/types/Country.ts +9 -0
- package/src/components/form/inputs/RadioButtonGroup.tsx +112 -0
- package/src/components/form/inputs/SearchableField.tsx +120 -0
- package/src/components/form/inputs/Select.tsx +152 -0
- package/src/components/form/inputs/TextField.tsx +59 -0
- package/src/components/layout/ServiceFormActions.tsx +90 -0
- package/src/components/layout/ServiceFormContainer/components/AccordionCollapseControls.tsx +43 -0
- package/src/components/layout/ServiceFormContainer/index.tsx +69 -0
- package/src/components/layout/ServiceHeader.tsx +65 -0
- package/src/components/layout/ServicePage.tsx +10 -0
- package/src/components/layout/ServiceWizardStepper/components/ActiveStepIcon.tsx +15 -0
- package/src/components/layout/ServiceWizardStepper/components/CompletedStepIcon.tsx +19 -0
- package/src/components/layout/ServiceWizardStepper/components/PendingStepIcon.tsx +15 -0
- package/src/components/layout/ServiceWizardStepper/index.tsx +44 -0
- package/src/components/shared/storage/CookieStorage.ts +42 -0
- package/src/components/storybook/FieldPreview.tsx +12 -0
- package/src/components/storybook/FieldPreviewRow.tsx +16 -0
- package/src/components/storybook/FieldView.tsx +9 -0
- package/src/components/storybook/Fields.tsx +9 -0
- package/src/components/storybook/PreviewTitle.tsx +15 -0
- package/src/env.tsx +61 -0
- package/src/examples/MultipleStepForm/components/AdditionalServicesForm.tsx +29 -0
- package/src/examples/MultipleStepForm/components/BasicInformationForm.tsx +5 -0
- package/src/examples/MultipleStepForm/components/ServiceDetailsForm.tsx +152 -0
- package/src/examples/MultipleStepForm/components/ServiceIssuanceForm.tsx +104 -0
- package/src/examples/MultipleStepForm/components/TermsAndConditionsForm.tsx +59 -0
- package/src/examples/MultipleStepForm/index.tsx +104 -0
- package/src/examples/MultipleStepForm/types/MultiStepFormModel.ts +10 -0
- package/src/examples/SingleStepForm/components/ObjectIdentifierSearchModal.tsx +187 -0
- package/src/examples/SingleStepForm/index.tsx +347 -0
- package/src/examples/SingleStepForm/types/SingleStepFormModel.ts +23 -0
- package/src/i18n/@mui/x-date-pickers/ltLT.ts +82 -0
- package/src/i18n/i18n.ts +44 -0
- package/src/i18n/namespaces/common/en.json +9 -0
- package/src/i18n/namespaces/common/lt.json +9 -0
- package/src/i18n/namespaces/input/en.json +53 -0
- package/src/i18n/namespaces/input/lt.json +53 -0
- package/src/library/icons.ts +25 -0
- package/src/library/index.ts +88 -0
- package/src/main.tsx +47 -0
- package/src/setupTests.ts +1 -0
- package/src/stories/components/Accordion.stories.tsx +93 -0
- package/src/stories/components/Alert.stories.tsx +40 -0
- package/src/stories/components/Breadcrumbs.stories.tsx +32 -0
- package/src/stories/components/buttons/Button.stories.tsx +206 -0
- package/src/stories/components/buttons/Button.test.ts +17 -0
- package/src/stories/components/form/CheckboxFormControl.stories.tsx +160 -0
- package/src/stories/components/form/ServiceFormActions.stories.tsx +44 -0
- package/src/stories/components/form/ServiceFormContainer.stories.tsx +178 -0
- package/src/stories/components/inputs/Checkbox.stories.tsx +214 -0
- package/src/stories/components/inputs/DatePicker.stories.tsx +99 -0
- package/src/stories/components/inputs/FileUpload.stories.tsx +159 -0
- package/src/stories/components/inputs/NumberStepper.stories.tsx +162 -0
- package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +155 -0
- package/src/stories/components/inputs/SearchableField.stories.tsx +90 -0
- package/src/stories/components/inputs/Select.stories.tsx +226 -0
- package/src/stories/components/inputs/TextField.stories.tsx +77 -0
- package/src/stubs/Component.tsx +9 -0
- package/src/styles/index.css +12 -0
- package/src/theme/light/MuiAccordion.tsx +50 -0
- package/src/theme/light/MuiAccordionDetails.ts +17 -0
- package/src/theme/light/MuiAccordionSummary.tsx +35 -0
- package/src/theme/light/MuiAlert.tsx +254 -0
- package/src/theme/light/MuiAutocomplete.ts +55 -0
- package/src/theme/light/MuiBreadcrumbs.tsx +42 -0
- package/src/theme/light/MuiButton.tsx +393 -0
- package/src/theme/light/MuiButtonBase.tsx +15 -0
- package/src/theme/light/MuiCard.tsx +18 -0
- package/src/theme/light/MuiCardContent.tsx +19 -0
- package/src/theme/light/MuiCardHeader.tsx +15 -0
- package/src/theme/light/MuiCheckbox.ts +26 -0
- package/src/theme/light/MuiChip.tsx +13 -0
- package/src/theme/light/MuiDialog.ts +25 -0
- package/src/theme/light/MuiDivider.tsx +12 -0
- package/src/theme/light/MuiFormControl.ts +28 -0
- package/src/theme/light/MuiFormControlLabel.ts +48 -0
- package/src/theme/light/MuiFormGroup.ts +83 -0
- package/src/theme/light/MuiFormHelperText.ts +18 -0
- package/src/theme/light/MuiFormLabel.ts +48 -0
- package/src/theme/light/MuiIconButton.ts +30 -0
- package/src/theme/light/MuiInputBase.ts +99 -0
- package/src/theme/light/MuiLinearProgress.ts +17 -0
- package/src/theme/light/MuiPagination.ts +31 -0
- package/src/theme/light/MuiPickersLayout.ts +68 -0
- package/src/theme/light/MuiPopover.ts +29 -0
- package/src/theme/light/MuiRadio.tsx +65 -0
- package/src/theme/light/MuiSelect.tsx +8 -0
- package/src/theme/light/MuiStepper.ts +52 -0
- package/src/theme/light/MuiSvgIcon.ts +17 -0
- package/src/theme/light/MuiTab.tsx +53 -0
- package/src/theme/light/MuiTable.ts +20 -0
- package/src/theme/light/MuiTableCell.ts +40 -0
- package/src/theme/light/MuiTabs.tsx +34 -0
- package/src/theme/light/MuiTextField.tsx +12 -0
- package/src/theme/light/MuiTypography.tsx +57 -0
- package/src/theme/light/index.tsx +138 -0
- package/src/theme/light/themePalette.tsx +23 -0
- package/src/theme/palette.tsx +77 -0
- package/src/types/assets/IconProps.tsx +19 -0
- package/src/types/buttons/ButtonProps.tsx +3 -0
- package/src/types/cards/CardServiceProps.tsx +9 -0
- package/src/types/common/ColorType.tsx +20 -0
- package/src/types/common/QuickLinkType.tsx +5 -0
- package/src/types/inputs/InputIconProps.tsx +5 -0
- package/src/types/lists/ListNewsItemType.tsx +5 -0
- package/src/types/lists/ListServicesItemType.tsx +8 -0
- package/src/types/order/OrderItemStatusType.tsx +3 -0
- package/src/vite-env.d.ts +79 -0
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/* eslint-disable react/function-component-definition */
|
|
2
|
+
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
3
|
+
import { useForm } from 'react-hook-form'
|
|
4
|
+
|
|
5
|
+
import RcSesCheckboxFormControl from '@/components/form/inputs/CheckboxFormControl'
|
|
6
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
7
|
+
import Fields from '@/components/storybook/Fields'
|
|
8
|
+
|
|
9
|
+
const variants = ['outlined', 'flat']
|
|
10
|
+
|
|
11
|
+
const meta: Meta<typeof RcSesCheckboxFormControl> = {
|
|
12
|
+
title: 'components/common/form/CheckboxFormControl',
|
|
13
|
+
component: RcSesCheckboxFormControl,
|
|
14
|
+
argTypes: {
|
|
15
|
+
variant: {
|
|
16
|
+
options: variants,
|
|
17
|
+
mapping: variants,
|
|
18
|
+
table: {
|
|
19
|
+
defaultValue: { summary: 'outlined' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
slotProps: {
|
|
23
|
+
table: {
|
|
24
|
+
disable: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
loading: {
|
|
28
|
+
table: {
|
|
29
|
+
disable: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
id: {
|
|
33
|
+
table: {
|
|
34
|
+
disable: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
errors: {
|
|
38
|
+
table: {
|
|
39
|
+
disable: true,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
onBlur: {
|
|
43
|
+
table: {
|
|
44
|
+
disable: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
onChange: {
|
|
48
|
+
table: {
|
|
49
|
+
disable: true,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
rules: {
|
|
53
|
+
table: {
|
|
54
|
+
disable: true,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
control: {
|
|
58
|
+
table: {
|
|
59
|
+
disable: true,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
name: {
|
|
63
|
+
table: {
|
|
64
|
+
disable: true,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
disabled: {
|
|
68
|
+
table: {
|
|
69
|
+
disable: true,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
label: {
|
|
73
|
+
table: {
|
|
74
|
+
disable: true,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
tags: ['autodocs'],
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
type FormModel = {
|
|
82
|
+
agreement: string
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default meta
|
|
86
|
+
|
|
87
|
+
const Template: StoryFn<typeof RcSesCheckboxFormControl> = (args) => {
|
|
88
|
+
const { variant, children } = args
|
|
89
|
+
const {
|
|
90
|
+
control,
|
|
91
|
+
formState: { errors },
|
|
92
|
+
} = useForm<FormModel>({
|
|
93
|
+
mode: 'all',
|
|
94
|
+
defaultValues: {
|
|
95
|
+
agreement: '',
|
|
96
|
+
},
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
return (
|
|
100
|
+
<Fields>
|
|
101
|
+
<FieldView>
|
|
102
|
+
<RcSesCheckboxFormControl
|
|
103
|
+
id='agreement'
|
|
104
|
+
name='agreement'
|
|
105
|
+
control={control}
|
|
106
|
+
errors={errors?.agreement}
|
|
107
|
+
variant={variant}
|
|
108
|
+
>
|
|
109
|
+
{children}
|
|
110
|
+
</RcSesCheckboxFormControl>
|
|
111
|
+
</FieldView>
|
|
112
|
+
</Fields>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const codeBlock = (args: any) => {
|
|
117
|
+
const { variant, children } = args
|
|
118
|
+
return `
|
|
119
|
+
import RcSesCheckboxFormControl from '@/components/form/inputs/CheckboxFormControl';
|
|
120
|
+
|
|
121
|
+
const MyComponent = () => (
|
|
122
|
+
|
|
123
|
+
const {
|
|
124
|
+
control,
|
|
125
|
+
formState: { errors },
|
|
126
|
+
} = useForm<FormModel>({
|
|
127
|
+
mode: 'all',
|
|
128
|
+
defaultValues: {
|
|
129
|
+
agreement: '',
|
|
130
|
+
},
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
<RcSesCheckboxFormControl
|
|
134
|
+
id='agreement'
|
|
135
|
+
name='agreement'
|
|
136
|
+
control={control}
|
|
137
|
+
errors={errors?.agreement}
|
|
138
|
+
variant="${variant}"
|
|
139
|
+
>
|
|
140
|
+
${children}
|
|
141
|
+
</RcSesCheckboxFormControl>
|
|
142
|
+
);`
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export const Main = Template.bind({})
|
|
146
|
+
Main.args = {
|
|
147
|
+
label: 'This is label',
|
|
148
|
+
children: 'This is body',
|
|
149
|
+
variant: 'outlined',
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
Main.parameters = {
|
|
153
|
+
docs: {
|
|
154
|
+
source: {
|
|
155
|
+
type: 'dynamic',
|
|
156
|
+
transform: (code: string, storyContext: StoryContext) =>
|
|
157
|
+
codeBlock(storyContext.args),
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
|
|
3
|
+
/* eslint-disable react/function-component-definition */
|
|
4
|
+
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
5
|
+
|
|
6
|
+
import RcSesServiceFormActions from '@/components/layout/ServiceFormActions'
|
|
7
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
8
|
+
import Fields from '@/components/storybook/Fields'
|
|
9
|
+
|
|
10
|
+
const meta: Meta<typeof RcSesServiceFormActions> = {
|
|
11
|
+
title: 'components/common/form/ServiceFormActions',
|
|
12
|
+
component: RcSesServiceFormActions,
|
|
13
|
+
tags: ['autodocs'],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export default meta
|
|
17
|
+
|
|
18
|
+
const Template: StoryFn<typeof RcSesServiceFormActions> = (args) => (
|
|
19
|
+
<Fields>
|
|
20
|
+
<FieldView>
|
|
21
|
+
<RcSesServiceFormActions {...args} />
|
|
22
|
+
</FieldView>
|
|
23
|
+
</Fields>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
const codeBlock = (args: any) => `
|
|
27
|
+
import RcSesServiceFormActions from '@/components/layout/ServiceFormActions'
|
|
28
|
+
|
|
29
|
+
const MyComponent = () => (
|
|
30
|
+
<RcSesServiceFormActions/>
|
|
31
|
+
);`
|
|
32
|
+
|
|
33
|
+
export const Main = Template.bind({})
|
|
34
|
+
Main.args = {}
|
|
35
|
+
|
|
36
|
+
Main.parameters = {
|
|
37
|
+
docs: {
|
|
38
|
+
source: {
|
|
39
|
+
type: 'dynamic',
|
|
40
|
+
transform: (code: string, storyContext: StoryContext) =>
|
|
41
|
+
codeBlock(storyContext.args),
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
|
|
3
|
+
/* eslint-disable react/function-component-definition */
|
|
4
|
+
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
5
|
+
|
|
6
|
+
import RcSesAccordion from '@/components/common/Accordion'
|
|
7
|
+
import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
|
|
8
|
+
import RcSesServiceFormContainer from '@/components/layout/ServiceFormContainer'
|
|
9
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
10
|
+
import Fields from '@/components/storybook/Fields'
|
|
11
|
+
import BasicInformationForm from '@/examples/MultipleStepForm/components/BasicInformationForm'
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof RcSesServiceFormContainer> = {
|
|
14
|
+
title: 'components/common/form/ServiceFormContainer',
|
|
15
|
+
component: RcSesServiceFormContainer,
|
|
16
|
+
argTypes: {
|
|
17
|
+
accordionController: {
|
|
18
|
+
table: {
|
|
19
|
+
disable: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
showAccordionCollapseControls: {
|
|
23
|
+
table: {
|
|
24
|
+
disable: true,
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
showProgressStepper: {
|
|
28
|
+
table: {
|
|
29
|
+
disable: true,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
slotProps: {
|
|
33
|
+
table: {
|
|
34
|
+
disable: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
tags: ['autodocs'],
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default meta
|
|
42
|
+
|
|
43
|
+
const Template: StoryFn<typeof RcSesServiceFormContainer> = (args) => {
|
|
44
|
+
const accordionController = useAccordionController({
|
|
45
|
+
initialState: {
|
|
46
|
+
basicInformation: {
|
|
47
|
+
expanded: false,
|
|
48
|
+
state: 'completed',
|
|
49
|
+
title: 'Bazinė informacija',
|
|
50
|
+
},
|
|
51
|
+
serviceDetails: {
|
|
52
|
+
expanded: true,
|
|
53
|
+
state: 'active',
|
|
54
|
+
title: 'Paslaugos užsakymas',
|
|
55
|
+
},
|
|
56
|
+
serviceIssuance: {
|
|
57
|
+
expanded: false,
|
|
58
|
+
state: 'pending',
|
|
59
|
+
title: 'Išdavimas',
|
|
60
|
+
},
|
|
61
|
+
additionalServices: {
|
|
62
|
+
expanded: false,
|
|
63
|
+
state: 'pending',
|
|
64
|
+
title: 'Reikalingos papildomos paslaugos',
|
|
65
|
+
},
|
|
66
|
+
termsAndConditions: {
|
|
67
|
+
expanded: false,
|
|
68
|
+
state: 'pending',
|
|
69
|
+
title: 'Terminai ir sąlygos',
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
return (
|
|
75
|
+
<Fields>
|
|
76
|
+
<FieldView>
|
|
77
|
+
<RcSesServiceFormContainer
|
|
78
|
+
accordionController={accordionController}
|
|
79
|
+
slotProps={{ container: { maxWidth: 'md' } }}
|
|
80
|
+
>
|
|
81
|
+
<RcSesAccordion id='basicInformation' controller={accordionController}>
|
|
82
|
+
<BasicInformationForm />
|
|
83
|
+
</RcSesAccordion>
|
|
84
|
+
|
|
85
|
+
<RcSesAccordion id='serviceDetails' controller={accordionController}>
|
|
86
|
+
<BasicInformationForm />
|
|
87
|
+
</RcSesAccordion>
|
|
88
|
+
|
|
89
|
+
<RcSesAccordion id='serviceIssuance' controller={accordionController}>
|
|
90
|
+
<BasicInformationForm />
|
|
91
|
+
</RcSesAccordion>
|
|
92
|
+
|
|
93
|
+
<RcSesAccordion id='additionalServices' controller={accordionController}>
|
|
94
|
+
<BasicInformationForm />
|
|
95
|
+
</RcSesAccordion>
|
|
96
|
+
|
|
97
|
+
<RcSesAccordion id='termsAndConditions' controller={accordionController}>
|
|
98
|
+
<BasicInformationForm />
|
|
99
|
+
</RcSesAccordion>
|
|
100
|
+
</RcSesServiceFormContainer>
|
|
101
|
+
</FieldView>
|
|
102
|
+
</Fields>
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const codeBlock = (args: any) => `
|
|
107
|
+
import RcSesSelect from '@/components/form/inputs/Select'
|
|
108
|
+
|
|
109
|
+
const MyComponent = () => (
|
|
110
|
+
|
|
111
|
+
const accordionController = useAccordionController({
|
|
112
|
+
initialState: {
|
|
113
|
+
basicInformation: {
|
|
114
|
+
expanded: false,
|
|
115
|
+
state: 'completed',
|
|
116
|
+
title: 'Bazinė informacija',
|
|
117
|
+
},
|
|
118
|
+
serviceDetails: {
|
|
119
|
+
expanded: true,
|
|
120
|
+
state: 'active',
|
|
121
|
+
title: 'Paslaugos užsakymas',
|
|
122
|
+
},
|
|
123
|
+
serviceIssuance: {
|
|
124
|
+
expanded: false,
|
|
125
|
+
state: 'pending',
|
|
126
|
+
title: 'Išdavimas',
|
|
127
|
+
},
|
|
128
|
+
additionalServices: {
|
|
129
|
+
expanded: false,
|
|
130
|
+
state: 'pending',
|
|
131
|
+
title: 'Reikalingos papildomos paslaugos',
|
|
132
|
+
},
|
|
133
|
+
termsAndConditions: {
|
|
134
|
+
expanded: false,
|
|
135
|
+
state: 'pending',
|
|
136
|
+
title: 'Terminai ir sąlygos',
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
})
|
|
140
|
+
|
|
141
|
+
<RcSesServiceFormContainer
|
|
142
|
+
accordionController={accordionController}
|
|
143
|
+
slotProps={{ container: { maxWidth: 'md' } }}
|
|
144
|
+
>
|
|
145
|
+
<RcSesAccordion id='basicInformation' controller={accordionController}>
|
|
146
|
+
<BasicInformationForm />
|
|
147
|
+
</RcSesAccordion>
|
|
148
|
+
|
|
149
|
+
<RcSesAccordion id='serviceDetails' controller={accordionController}>
|
|
150
|
+
<BasicInformationForm />
|
|
151
|
+
</RcSesAccordion>
|
|
152
|
+
|
|
153
|
+
<RcSesAccordion id='serviceIssuance' controller={accordionController}>
|
|
154
|
+
<BasicInformationForm />
|
|
155
|
+
</RcSesAccordion>
|
|
156
|
+
|
|
157
|
+
<RcSesAccordion id='additionalServices' controller={accordionController}>
|
|
158
|
+
<BasicInformationForm />
|
|
159
|
+
</RcSesAccordion>
|
|
160
|
+
|
|
161
|
+
<RcSesAccordion id='termsAndConditions' controller={accordionController}>
|
|
162
|
+
<BasicInformationForm />
|
|
163
|
+
</RcSesAccordion>
|
|
164
|
+
</RcSesServiceFormContainer>
|
|
165
|
+
);`
|
|
166
|
+
|
|
167
|
+
export const Main = Template.bind({})
|
|
168
|
+
Main.args = {}
|
|
169
|
+
|
|
170
|
+
Main.parameters = {
|
|
171
|
+
docs: {
|
|
172
|
+
source: {
|
|
173
|
+
type: 'dynamic',
|
|
174
|
+
transform: (code: string, storyContext: StoryContext) =>
|
|
175
|
+
codeBlock(storyContext.args),
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/* eslint-disable react/function-component-definition */
|
|
2
|
+
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
3
|
+
import { useForm } from 'react-hook-form'
|
|
4
|
+
|
|
5
|
+
import RcSesCheckbox from '@/components/form/inputs/Checkbox'
|
|
6
|
+
import FieldPreviewRow from '@/components/storybook/FieldPreviewRow'
|
|
7
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
8
|
+
import Fields from '@/components/storybook/Fields'
|
|
9
|
+
import PreviewTitle from '@/components/storybook/PreviewTitle'
|
|
10
|
+
|
|
11
|
+
const variants = ['outlined', 'flat']
|
|
12
|
+
|
|
13
|
+
const lorem = 'Lorem Ipsum has been the standard.'
|
|
14
|
+
|
|
15
|
+
type FormModel = {
|
|
16
|
+
agreement: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const meta: Meta<typeof RcSesCheckbox> = {
|
|
20
|
+
title: 'components/common/inputs/Checkbox',
|
|
21
|
+
component: RcSesCheckbox,
|
|
22
|
+
argTypes: {
|
|
23
|
+
variant: {
|
|
24
|
+
options: variants,
|
|
25
|
+
mapping: variants,
|
|
26
|
+
table: {
|
|
27
|
+
defaultValue: { summary: 'flat' },
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
control: {
|
|
31
|
+
table: {
|
|
32
|
+
disable: true,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
rules: {
|
|
36
|
+
table: {
|
|
37
|
+
disable: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
name: {
|
|
41
|
+
table: {
|
|
42
|
+
disable: true,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
slotProps: {
|
|
46
|
+
table: {
|
|
47
|
+
disable: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
loading: {
|
|
51
|
+
table: {
|
|
52
|
+
disable: true,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
id: {
|
|
56
|
+
table: {
|
|
57
|
+
disable: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
onChange: {
|
|
61
|
+
table: {
|
|
62
|
+
disable: true,
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
errors: {
|
|
66
|
+
table: {
|
|
67
|
+
disable: true,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
tags: ['autodocs'],
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default meta
|
|
75
|
+
|
|
76
|
+
const Template: StoryFn<typeof RcSesCheckbox> = (args) => {
|
|
77
|
+
const {
|
|
78
|
+
control,
|
|
79
|
+
formState: { errors },
|
|
80
|
+
} = useForm<FormModel>({
|
|
81
|
+
mode: 'all',
|
|
82
|
+
defaultValues: {
|
|
83
|
+
agreement: '',
|
|
84
|
+
},
|
|
85
|
+
})
|
|
86
|
+
const { label, disabled, variant } = args
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Fields>
|
|
90
|
+
<FieldView>
|
|
91
|
+
<RcSesCheckbox
|
|
92
|
+
id='agreement'
|
|
93
|
+
name='agreement'
|
|
94
|
+
control={control}
|
|
95
|
+
errors={errors?.agreement}
|
|
96
|
+
label={label}
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
variant={variant}
|
|
99
|
+
rules={{ required: true }}
|
|
100
|
+
>
|
|
101
|
+
{lorem}
|
|
102
|
+
</RcSesCheckbox>
|
|
103
|
+
</FieldView>
|
|
104
|
+
|
|
105
|
+
<FieldPreviewRow>
|
|
106
|
+
<PreviewTitle>State previews outlined</PreviewTitle>
|
|
107
|
+
<RcSesCheckbox
|
|
108
|
+
id='active'
|
|
109
|
+
name='active'
|
|
110
|
+
control={control}
|
|
111
|
+
errors={errors?.agreement}
|
|
112
|
+
label='Active'
|
|
113
|
+
rules={{ required: true }}
|
|
114
|
+
>
|
|
115
|
+
{lorem}
|
|
116
|
+
</RcSesCheckbox>
|
|
117
|
+
<RcSesCheckbox
|
|
118
|
+
id='disabled'
|
|
119
|
+
name='disabled'
|
|
120
|
+
control={control}
|
|
121
|
+
errors={errors?.agreement}
|
|
122
|
+
label='Disabled'
|
|
123
|
+
rules={{ required: true }}
|
|
124
|
+
disabled
|
|
125
|
+
>
|
|
126
|
+
{lorem}
|
|
127
|
+
</RcSesCheckbox>
|
|
128
|
+
<RcSesCheckbox
|
|
129
|
+
id='error'
|
|
130
|
+
name='error'
|
|
131
|
+
control={control}
|
|
132
|
+
errors={{ message: 'Error Message', type: 'required' }}
|
|
133
|
+
label='Error'
|
|
134
|
+
rules={{ required: true }}
|
|
135
|
+
>
|
|
136
|
+
{lorem}
|
|
137
|
+
</RcSesCheckbox>
|
|
138
|
+
</FieldPreviewRow>
|
|
139
|
+
<FieldPreviewRow>
|
|
140
|
+
<PreviewTitle>State previews flat</PreviewTitle>
|
|
141
|
+
<RcSesCheckbox
|
|
142
|
+
id='flatActive'
|
|
143
|
+
name='flatActive'
|
|
144
|
+
control={control}
|
|
145
|
+
errors={errors?.agreement}
|
|
146
|
+
label='Active'
|
|
147
|
+
variant='flat'
|
|
148
|
+
>
|
|
149
|
+
{lorem}
|
|
150
|
+
</RcSesCheckbox>
|
|
151
|
+
<RcSesCheckbox
|
|
152
|
+
id='flatDisabled'
|
|
153
|
+
name='flatDisabled'
|
|
154
|
+
control={control}
|
|
155
|
+
errors={errors?.agreement}
|
|
156
|
+
label='Disabled'
|
|
157
|
+
variant='flat'
|
|
158
|
+
>
|
|
159
|
+
{lorem}
|
|
160
|
+
</RcSesCheckbox>
|
|
161
|
+
<RcSesCheckbox
|
|
162
|
+
id='flatError'
|
|
163
|
+
name='flatError'
|
|
164
|
+
control={control}
|
|
165
|
+
errors={errors?.agreement}
|
|
166
|
+
label='Error'
|
|
167
|
+
variant='flat'
|
|
168
|
+
>
|
|
169
|
+
{lorem}
|
|
170
|
+
</RcSesCheckbox>
|
|
171
|
+
</FieldPreviewRow>
|
|
172
|
+
</Fields>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
const codeBlock = (args: any) => {
|
|
177
|
+
const { variant, label, children, disabled } = args
|
|
178
|
+
return `
|
|
179
|
+
import RcSesCheckbox from '@/components/form/inputs/Checkbox'
|
|
180
|
+
|
|
181
|
+
const MyComponent = () => (
|
|
182
|
+
|
|
183
|
+
const {control,formState: { errors }} = useForm<FormModel>({mode: 'all', defaultValues: {agreement: ''}})
|
|
184
|
+
|
|
185
|
+
<RcSesCheckbox
|
|
186
|
+
id='agreement'
|
|
187
|
+
name='agreement'
|
|
188
|
+
control={control}
|
|
189
|
+
errors={errors?.agreement}
|
|
190
|
+
label="${label}"
|
|
191
|
+
variant="${variant}"
|
|
192
|
+
children="${children}"
|
|
193
|
+
disabled="${disabled}"
|
|
194
|
+
/>
|
|
195
|
+
);`
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export const Main = Template.bind({})
|
|
199
|
+
Main.args = {
|
|
200
|
+
label: 'Click Me',
|
|
201
|
+
variant: 'outlined',
|
|
202
|
+
children: 'This is content',
|
|
203
|
+
disabled: false,
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
Main.parameters = {
|
|
207
|
+
docs: {
|
|
208
|
+
source: {
|
|
209
|
+
type: 'dynamic',
|
|
210
|
+
transform: (code: string, storyContext: StoryContext) =>
|
|
211
|
+
codeBlock(storyContext.args),
|
|
212
|
+
},
|
|
213
|
+
},
|
|
214
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/* eslint-disable react/function-component-definition */
|
|
2
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFnsV3'
|
|
3
|
+
import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'
|
|
4
|
+
import { Meta, StoryContext, StoryFn } from '@storybook/react'
|
|
5
|
+
import { lt } from 'date-fns/locale/lt'
|
|
6
|
+
import { useForm } from 'react-hook-form'
|
|
7
|
+
|
|
8
|
+
import RcSesDatepicker from '@/components/form/inputs/Datepicker'
|
|
9
|
+
import FieldView from '@/components/storybook/FieldView'
|
|
10
|
+
import Fields from '@/components/storybook/Fields'
|
|
11
|
+
import SingleStepFormModel from '@/examples/SingleStepForm/types/SingleStepFormModel'
|
|
12
|
+
|
|
13
|
+
const meta: Meta<typeof RcSesDatepicker> = {
|
|
14
|
+
title: 'components/common/inputs/DatePicker',
|
|
15
|
+
component: RcSesDatepicker,
|
|
16
|
+
argTypes: {
|
|
17
|
+
clearable: {
|
|
18
|
+
control: {
|
|
19
|
+
type: 'boolean',
|
|
20
|
+
},
|
|
21
|
+
table: {
|
|
22
|
+
defaultValue: {},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
tags: ['autodocs'],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default meta
|
|
30
|
+
|
|
31
|
+
const Template: StoryFn<typeof RcSesDatepicker> = (args) => {
|
|
32
|
+
const { clearable, label, rules } = args
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
control,
|
|
36
|
+
formState: { errors },
|
|
37
|
+
} = useForm<SingleStepFormModel>({
|
|
38
|
+
mode: 'all',
|
|
39
|
+
defaultValues: {
|
|
40
|
+
date: null,
|
|
41
|
+
},
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<Fields>
|
|
46
|
+
<FieldView>
|
|
47
|
+
<LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={lt}>
|
|
48
|
+
<RcSesDatepicker
|
|
49
|
+
id='date'
|
|
50
|
+
name='date'
|
|
51
|
+
clearable={clearable}
|
|
52
|
+
control={control}
|
|
53
|
+
rules={rules}
|
|
54
|
+
label={label}
|
|
55
|
+
errors={errors?.date}
|
|
56
|
+
/>
|
|
57
|
+
</LocalizationProvider>
|
|
58
|
+
</FieldView>
|
|
59
|
+
</Fields>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
const codeBlock = (args: any) => {
|
|
63
|
+
const { clearable, label, rules } = args
|
|
64
|
+
return `
|
|
65
|
+
import RcSesDatepicker from '@/components/form/inputs/Datepicker'
|
|
66
|
+
|
|
67
|
+
const MyComponent = () => (
|
|
68
|
+
|
|
69
|
+
const {control,formState: { errors }} = useForm<SingleStepFormModel>({mode: 'all',defaultValues: {date: null}})
|
|
70
|
+
|
|
71
|
+
<RcSesDatepicker
|
|
72
|
+
id='date'
|
|
73
|
+
name='date'
|
|
74
|
+
clearable=${clearable}
|
|
75
|
+
control={control}
|
|
76
|
+
rules=${rules.required ? '{{ required: true }}' : '{{ required: false }}'}
|
|
77
|
+
label='${label}'
|
|
78
|
+
errors={errors?.date}
|
|
79
|
+
/>
|
|
80
|
+
|
|
81
|
+
);`
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export const Main = Template.bind({})
|
|
85
|
+
Main.args = {
|
|
86
|
+
clearable: true,
|
|
87
|
+
label: 'Terminas',
|
|
88
|
+
rules: { required: true },
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
Main.parameters = {
|
|
92
|
+
docs: {
|
|
93
|
+
source: {
|
|
94
|
+
type: 'dynamic',
|
|
95
|
+
transform: (code: string, storyContext: StoryContext) =>
|
|
96
|
+
codeBlock(storyContext.args),
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
}
|