@prokodo/ui 0.0.26 → 0.0.28
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 +89 -45
- package/dist/_virtual/_commonjsHelpers.js +6 -3
- package/dist/_virtual/index.js +5 -5
- package/dist/_virtual/index2.js +2 -2
- package/dist/_virtual/index3.js +2 -2
- package/dist/_virtual/react-is.development.js +2 -2
- package/dist/_virtual/react-is.production.min.js +2 -2
- package/dist/assets/images/card_background_primary_1.webp.js +2 -2
- package/dist/assets/images/card_background_primary_2.webp.js +2 -2
- package/dist/assets/images/card_background_primary_3.webp.js +2 -2
- package/dist/assets/images/card_background_primary_4.webp.js +2 -2
- package/dist/assets/images/card_background_secondary_1.webp.js +2 -2
- package/dist/assets/images/card_background_secondary_2.webp.js +2 -2
- package/dist/assets/images/card_background_secondary_3.webp.js +2 -2
- package/dist/assets/images/card_background_secondary_4.webp.js +2 -2
- package/dist/components/accordion/Accordion.js +82 -74
- package/dist/components/accordion/Accordion.module.scss.js +11 -8
- package/dist/components/accordion/index.js +2 -2
- package/dist/components/animated/Animated.js +61 -40
- package/dist/components/animated/Animated.module.scss.js +8 -6
- package/dist/components/animated/index.js +2 -2
- package/dist/components/animatedText/AnimatedText.js +36 -27
- package/dist/components/animatedText/index.js +2 -2
- package/dist/components/avatar/Avatar.js +62 -54
- package/dist/components/avatar/Avatar.module.scss.js +8 -6
- package/dist/components/avatar/index.js +2 -2
- package/dist/components/base-link/BaseLink.js +39 -27
- package/dist/components/base-link/index.js +2 -2
- package/dist/components/button/Button.client.js +100 -0
- package/dist/components/button/Button.js +15 -82
- package/dist/components/button/Button.lazy.js +20 -0
- package/dist/components/button/Button.module.scss.js +8 -6
- package/dist/components/button/Button.server.js +77 -0
- package/dist/components/button/index.js +2 -2
- package/dist/components/calendly/Calendly.js +99 -60
- package/dist/components/calendly/index.js +2 -2
- package/dist/components/card/Card.js +167 -141
- package/dist/components/card/Card.module.scss.js +11 -8
- package/dist/components/card/index.js +2 -2
- package/dist/components/carousel/Carousel.js +209 -145
- package/dist/components/carousel/Carousel.module.scss.js +8 -6
- package/dist/components/carousel/Carousel.services.js +39 -20
- package/dist/components/carousel/index.js +2 -2
- package/dist/components/chip/Chip.js +44 -36
- package/dist/components/chip/Chip.module.scss.js +8 -6
- package/dist/components/chip/index.js +2 -2
- package/dist/components/datePicker/DatePicker.js +106 -69
- package/dist/components/datePicker/index.js +2 -2
- package/dist/components/dialog/Dialog.js +106 -93
- package/dist/components/dialog/Dialog.module.scss.js +8 -6
- package/dist/components/dialog/index.js +2 -2
- package/dist/components/drawer/Drawer.js +78 -64
- package/dist/components/drawer/Drawer.module.scss.js +20 -14
- package/dist/components/drawer/index.js +4 -4
- package/dist/components/form/Form.js +229 -165
- package/dist/components/form/Form.module.scss.js +8 -6
- package/dist/components/form/FormField.js +63 -60
- package/dist/components/form/FormField.module.scss.js +8 -6
- package/dist/components/form/FormResponse.js +37 -41
- package/dist/components/form/FormResponse.module.scss.js +8 -6
- package/dist/components/form/index.js +4 -4
- package/dist/components/grid/Grid.js +14 -11
- package/dist/components/grid/Grid.module.scss.js +8 -6
- package/dist/components/grid/GridRow.js +20 -17
- package/dist/components/grid/GridRow.module.scss.js +8 -6
- package/dist/components/grid/index.js +4 -4
- package/dist/components/headline/Headline.client.js +85 -0
- package/dist/components/headline/Headline.module.scss.js +8 -6
- package/dist/components/headline/Headline.server.js +73 -0
- package/dist/components/headline/Headline.variants.js +9 -0
- package/dist/components/headline/index.js +4 -3
- package/dist/components/icon/Icon.js +27 -22
- package/dist/components/icon/Icon.module.scss.js +8 -6
- package/dist/components/icon/index.js +3 -3
- package/dist/components/image/Image.js +30 -24
- package/dist/components/image/Image.module.scss.js +8 -6
- package/dist/components/image/index.js +2 -2
- package/dist/components/image-text/ImageText.js +80 -81
- package/dist/components/image-text/ImageText.module.scss.js +8 -6
- package/dist/components/image-text/index.js +2 -2
- package/dist/components/input/Input.js +147 -131
- package/dist/components/input/Input.module.scss.js +11 -8
- package/dist/components/input/InputValidation.js +50 -31
- package/dist/components/input/index.js +2 -2
- package/dist/components/inputOTP/InputOTP.js +90 -57
- package/dist/components/inputOTP/InputOTP.module.scss.js +8 -6
- package/dist/components/inputOTP/index.js +2 -2
- package/dist/components/label/Label.js +64 -63
- package/dist/components/label/Label.module.scss.js +8 -6
- package/dist/components/label/index.js +2 -2
- package/dist/components/link/Link.js +53 -48
- package/dist/components/link/Link.module.scss.js +8 -6
- package/dist/components/link/index.js +2 -2
- package/dist/components/list/List.js +120 -104
- package/dist/components/list/List.module.scss.js +8 -6
- package/dist/components/list/index.js +2 -2
- package/dist/components/loading/Loading.js +21 -20
- package/dist/components/loading/Loading.module.scss.js +11 -8
- package/dist/components/loading/index.js +2 -2
- package/dist/components/lottie/Lottie.js +47 -37
- package/dist/components/lottie/Lottie.module.scss.js +8 -6
- package/dist/components/lottie/LottieAnimations.js +2 -2
- package/dist/components/lottie/index.js +2 -2
- package/dist/components/map/Map.js +59 -42
- package/dist/components/map/index.js +2 -2
- package/dist/components/post-item/PostItem.js +81 -76
- package/dist/components/post-item/PostItem.module.scss.js +8 -6
- package/dist/components/post-item/PostItemAuthor.js +24 -23
- package/dist/components/post-item/PostItemAuthor.module.scss.js +8 -6
- package/dist/components/post-item/index.js +4 -4
- package/dist/components/post-teaser/PostTeaser.js +96 -92
- package/dist/components/post-teaser/PostTeaser.module.scss.js +8 -6
- package/dist/components/post-teaser/index.js +2 -2
- package/dist/components/post-widget/PostWidget.js +81 -80
- package/dist/components/post-widget/PostWidget.module.scss.js +8 -6
- package/dist/components/post-widget/index.js +2 -2
- package/dist/components/post-widget-carousel/PostWidgetCarousel.js +96 -90
- package/dist/components/post-widget-carousel/PostWidgetCarousel.module.scss.js +8 -6
- package/dist/components/post-widget-carousel/index.js +2 -2
- package/dist/components/quote/Quote.js +48 -47
- package/dist/components/quote/Quote.module.scss.js +8 -6
- package/dist/components/quote/index.js +2 -2
- package/dist/components/rich-text/RichText.js +114 -100
- package/dist/components/rich-text/RichText.module.scss.js +8 -6
- package/dist/components/rich-text/index.js +2 -2
- package/dist/components/select/Select.js +148 -127
- package/dist/components/select/Select.module.scss.js +17 -12
- package/dist/components/select/index.js +2 -2
- package/dist/components/skeleton/Skeleton.js +21 -18
- package/dist/components/skeleton/Skeleton.module.scss.js +8 -6
- package/dist/components/skeleton/index.js +2 -2
- package/dist/components/slider/Slider.js +74 -65
- package/dist/components/slider/Slider.module.scss.js +8 -6
- package/dist/components/slider/index.js +2 -2
- package/dist/components/stepper/Stepper.js +85 -69
- package/dist/components/stepper/Stepper.module.scss.js +8 -6
- package/dist/components/stepper/index.js +2 -2
- package/dist/components/switch/Switch.js +69 -63
- package/dist/components/switch/Switch.module.scss.js +8 -6
- package/dist/components/switch/index.js +2 -2
- package/dist/components/table/Table.js +48 -45
- package/dist/components/table/Table.module.scss.js +8 -6
- package/dist/components/table/index.js +2 -2
- package/dist/components/teaser/Teaser.js +66 -65
- package/dist/components/teaser/Teaser.module.scss.js +8 -6
- package/dist/components/teaser/index.js +2 -2
- package/dist/constants/project.js +2 -2
- package/dist/helpers/bem.js +17 -9
- package/dist/helpers/calculation.js +4 -2
- package/dist/helpers/validations.js +12 -6
- package/dist/hooks/useGoogleMaps.js +19 -14
- package/dist/hooks/useHydrationReady.js +26 -0
- package/dist/index.js +84 -84
- package/dist/node_modules/.pnpm/@floating-ui_core@1.7.0/node_modules/@floating-ui/core/dist/floating-ui.core.js +354 -251
- package/dist/node_modules/.pnpm/@floating-ui_dom@1.7.0/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +555 -309
- package/dist/node_modules/.pnpm/@floating-ui_react-dom@2.1.2_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +221 -141
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +167 -109
- package/dist/node_modules/.pnpm/@floating-ui_utils@0.2.9/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +130 -88
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Option/Option.js +91 -77
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Option/optionClasses.js +10 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Portal/Portal.js +54 -40
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Select/Select.js +192 -163
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Select/selectClasses.js +10 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Slider/Slider.js +287 -242
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Slider/sliderClasses.js +10 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Switch/Switch.js +112 -97
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Switch/switchClasses.js +10 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Unstable_Popup/Popup.js +135 -115
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Unstable_Popup/PopupContext.js +6 -4
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/Unstable_Popup/popupClasses.js +10 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/generateUtilityClass/index.js +15 -10
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/generateUtilityClasses/index.js +11 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useButton/useButton.js +160 -73
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useCompound/useCompoundItem.js +25 -18
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useCompound/useCompoundParent.js +63 -36
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useList/ListContext.js +6 -4
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useList/listActions.types.js +2 -2
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useList/listReducer.js +233 -138
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useList/useList.js +189 -128
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useList/useListItem.js +72 -52
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useOption/useOption.js +72 -53
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useOption/useOptionContextStabilizer.js +30 -22
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSelect/SelectProvider.js +34 -28
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSelect/defaultOptionStringifier.js +15 -7
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSelect/selectReducer.js +49 -40
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSelect/useSelect.js +341 -222
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSelect/useSelect.types.js +2 -2
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSlider/useSlider.js +550 -353
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useSwitch/useSwitch.js +79 -50
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useTransition/TransitionContext.js +6 -4
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/useTransition/useTransitionTrigger.js +51 -23
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/ClassNameConfigurator.js +21 -10
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/areArraysEqual.js +6 -3
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/combineHooksSlotProps.js +14 -10
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/isHostComponent.js +6 -3
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/resolveComponentProps.js +9 -3
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/useControllableReducer.js +91 -60
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/useRootElementName.js +20 -12
- package/dist/node_modules/.pnpm/@mui_base@5.0.0-beta.58_@types_react@19.1.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@mui/base/utils/useTextNavigation.js +21 -10
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/HTMLElementType/HTMLElementType.js +16 -5
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/appendOwnerState/appendOwnerState.js +13 -7
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/chainPropTypes/chainPropTypes.js +11 -5
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/clamp/clamp.js +6 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/composeClasses/composeClasses.js +19 -11
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/exactProp/exactProp.js +17 -8
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/extractEventHandlers/extractEventHandlers.js +12 -7
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/generateUtilityClass/generateUtilityClass.js +2 -2
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/getReactNodeRef/getReactNodeRef.js +11 -5
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js +11 -7
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/isHostComponent/isHostComponent.js +6 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/mergeSlotProps/mergeSlotProps.js +61 -38
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/omitEventHandlers/omitEventHandlers.js +12 -7
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/ownerDocument/ownerDocument.js +6 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/resolveComponentProps/resolveComponentProps.js +9 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/setRef/setRef.js +10 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useControlled/useControlled.js +31 -22
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useEnhancedEffect/useEnhancedEffect.js +3 -3
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useEventCallback/useEventCallback.js +13 -9
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useForkRef/useForkRef.js +17 -9
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useId/useId.js +23 -14
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/useSlotProps/useSlotProps.js +30 -23
- package/dist/node_modules/.pnpm/@mui_utils@6.0.0-rc.0_@types_react@19.1.0_react@19.1.0/node_modules/@mui/utils/esm/visuallyHidden/visuallyHidden.js +2 -2
- package/dist/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.js +17 -13
- package/dist/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +67 -38
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +55 -37
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +56 -43
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +404 -243
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +20 -14
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +12 -7
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +11 -4
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +170 -82
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +91 -58
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +17 -7
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/components/button/Button.client.d.ts +3 -0
- package/dist/types/components/button/Button.d.ts +3 -3
- package/dist/types/components/button/Button.lazy.d.ts +3 -0
- package/dist/types/components/button/Button.server.d.ts +3 -0
- package/dist/types/components/button/index.d.ts +1 -1
- package/dist/types/components/form/FormResponse.d.ts +1 -1
- package/dist/types/components/headline/Headline.client.d.ts +3 -0
- package/dist/types/components/headline/Headline.model.d.ts +1 -0
- package/dist/types/components/headline/Headline.server.d.ts +3 -0
- package/dist/types/components/headline/Headline.variants.d.ts +2 -0
- package/dist/types/components/headline/index.d.ts +2 -1
- package/dist/types/components/label/Label.d.ts +1 -1
- package/dist/types/hooks/useHydrationReady.d.ts +5 -0
- package/dist/ui.css +9592 -1
- package/package.json +1 -1
- package/dist/components/headline/Headline.js +0 -71
- package/dist/types/components/headline/Headline.d.ts +0 -4
|
@@ -1,194 +1,258 @@
|
|
|
1
|
-
import { jsx
|
|
2
|
-
import { memo
|
|
3
|
-
import { create
|
|
4
|
-
import { isArray
|
|
5
|
-
import
|
|
6
|
-
import { FormField
|
|
7
|
-
import { FormResponse
|
|
8
|
-
import { Grid
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
const
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useState, useEffect, useCallback, useMemo, Fragment } from "react";
|
|
3
|
+
import { create } from "../../helpers/bem.js";
|
|
4
|
+
import { isArray, isString } from "../../helpers/validations.js";
|
|
5
|
+
import styles from "./Form.module.scss.js";
|
|
6
|
+
import { FormField } from "./FormField.js";
|
|
7
|
+
import { FormResponse } from "./FormResponse.js";
|
|
8
|
+
import { Grid } from "../grid/Grid.js";
|
|
9
|
+
import { Button } from "../button/Button.js";
|
|
10
|
+
import { Headline } from "../headline/Headline.server.js";
|
|
11
|
+
const bem = create(styles, "Form");
|
|
12
|
+
const Form = memo(
|
|
12
13
|
({
|
|
13
|
-
variant
|
|
14
|
-
action
|
|
15
|
-
label
|
|
16
|
-
className
|
|
17
|
-
fields
|
|
18
|
-
disableFields
|
|
19
|
-
hideResponse
|
|
20
|
-
defaultFields
|
|
21
|
-
messages
|
|
22
|
-
messagesFields
|
|
23
|
-
button
|
|
24
|
-
children
|
|
25
|
-
onSubmit
|
|
26
|
-
onChangeForm
|
|
27
|
-
...
|
|
14
|
+
variant = "primary",
|
|
15
|
+
action,
|
|
16
|
+
label,
|
|
17
|
+
className,
|
|
18
|
+
fields,
|
|
19
|
+
disableFields,
|
|
20
|
+
hideResponse,
|
|
21
|
+
defaultFields,
|
|
22
|
+
messages,
|
|
23
|
+
messagesFields,
|
|
24
|
+
button,
|
|
25
|
+
children,
|
|
26
|
+
onSubmit,
|
|
27
|
+
onChangeForm,
|
|
28
|
+
...props
|
|
28
29
|
}) => {
|
|
29
|
-
const [
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
30
|
+
const [form, setForm] = useState(fields ?? []);
|
|
31
|
+
const [formMessages, setFormMessages] = useState(
|
|
32
|
+
messages
|
|
33
|
+
);
|
|
34
|
+
const [hp, setHp] = useState("");
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (messages !== void 0) {
|
|
37
|
+
setFormMessages(messages);
|
|
38
|
+
}
|
|
39
|
+
}, [messages]);
|
|
40
|
+
const updateFormState = useCallback(
|
|
41
|
+
(index, props2) => {
|
|
42
|
+
setForm((prevData) => {
|
|
43
|
+
const newArray = [...prevData];
|
|
44
|
+
newArray[index] = {
|
|
45
|
+
...newArray[index],
|
|
46
|
+
...props2
|
|
47
|
+
};
|
|
48
|
+
return newArray;
|
|
46
49
|
});
|
|
50
|
+
if (onChangeForm) {
|
|
51
|
+
onChangeForm({
|
|
52
|
+
...form[index],
|
|
53
|
+
...props2
|
|
54
|
+
});
|
|
55
|
+
}
|
|
47
56
|
},
|
|
48
|
-
[
|
|
49
|
-
)
|
|
50
|
-
|
|
57
|
+
[form, onChangeForm]
|
|
58
|
+
);
|
|
59
|
+
const filterConditions = useCallback(
|
|
60
|
+
(conditions, value) => conditions.filter((e) => {
|
|
61
|
+
if (value === void 0 || e.equalTo === void 0 || typeof e.equalTo === "boolean" && e.equalTo === value)
|
|
62
|
+
return true;
|
|
63
|
+
if (typeof e.equalTo === "string") {
|
|
64
|
+
return e.equalTo === value;
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(e.equalTo) && typeof value === "string") {
|
|
67
|
+
return e.equalTo.includes(value);
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
}),
|
|
51
71
|
[]
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
);
|
|
73
|
+
const handleFilterConditions = useCallback(
|
|
74
|
+
(conditions, value) => {
|
|
75
|
+
if (value !== void 0 && isArray(value)) {
|
|
76
|
+
return value.flatMap(
|
|
77
|
+
(val) => filterConditions(conditions, val)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return filterConditions(conditions, value);
|
|
81
|
+
},
|
|
82
|
+
[filterConditions]
|
|
83
|
+
);
|
|
84
|
+
const getFieldIndex = useCallback(
|
|
85
|
+
(field) => form.findIndex((e) => (e == null ? void 0 : e.name) === (field == null ? void 0 : field.name)),
|
|
86
|
+
[form]
|
|
87
|
+
);
|
|
88
|
+
const resetFieldConditions = useCallback(
|
|
89
|
+
(changedField) => {
|
|
90
|
+
var _a, _b;
|
|
91
|
+
const fieldIndex = form.findIndex(
|
|
92
|
+
(field) => (field == null ? void 0 : field.name) === (changedField == null ? void 0 : changedField.name)
|
|
65
93
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
const defaultField = defaultFields == null ? void 0 : defaultFields[fieldIndex];
|
|
95
|
+
if (defaultField === void 0) return;
|
|
96
|
+
(_b = (_a = defaultFields == null ? void 0 : defaultFields[fieldIndex]) == null ? void 0 : _a.conditions) == null ? void 0 : _b.forEach((con) => {
|
|
97
|
+
const index = defaultFields.findIndex(
|
|
98
|
+
(field) => (field == null ? void 0 : field.name) === (con == null ? void 0 : con.fieldId)
|
|
69
99
|
);
|
|
70
|
-
|
|
71
|
-
|
|
100
|
+
if (defaultFields[index] === void 0) return;
|
|
101
|
+
updateFormState(index, defaultFields[index]);
|
|
102
|
+
});
|
|
103
|
+
return;
|
|
72
104
|
},
|
|
73
|
-
[
|
|
74
|
-
)
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
105
|
+
[defaultFields, form, updateFormState]
|
|
106
|
+
);
|
|
107
|
+
const handleChangeField = useCallback(
|
|
108
|
+
(field, value) => {
|
|
109
|
+
const conditions = field == null ? void 0 : field.conditions;
|
|
110
|
+
if (!conditions || (conditions == null ? void 0 : conditions.length) <= 0) {
|
|
111
|
+
const index2 = getFieldIndex(field);
|
|
112
|
+
updateFormState(index2, { value });
|
|
80
113
|
return;
|
|
81
114
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
115
|
+
resetFieldConditions(field);
|
|
116
|
+
handleFilterConditions(conditions, value).forEach((con) => {
|
|
117
|
+
const conditionalFieldIndex = form.findIndex(
|
|
118
|
+
(field2) => (field2 == null ? void 0 : field2.name) === (con == null ? void 0 : con.fieldId)
|
|
85
119
|
);
|
|
86
|
-
|
|
120
|
+
updateFormState(conditionalFieldIndex, con.updateProps);
|
|
87
121
|
});
|
|
88
|
-
const
|
|
89
|
-
|
|
122
|
+
const index = getFieldIndex(field);
|
|
123
|
+
updateFormState(index, { value });
|
|
90
124
|
},
|
|
91
125
|
[
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
form,
|
|
127
|
+
getFieldIndex,
|
|
128
|
+
resetFieldConditions,
|
|
129
|
+
handleFilterConditions,
|
|
130
|
+
updateFormState
|
|
97
131
|
]
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
132
|
+
);
|
|
133
|
+
const handleValidationField = useCallback(
|
|
134
|
+
(field, errorText) => {
|
|
135
|
+
const fieldIndex = form.findIndex((e) => (e == null ? void 0 : e.name) === (field == null ? void 0 : field.name));
|
|
136
|
+
updateFormState(fieldIndex, {
|
|
137
|
+
errorText
|
|
103
138
|
});
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
const label2 = (field == null ? void 0 : field.label) ?? "";
|
|
140
|
+
setFormMessages((prevState) => {
|
|
141
|
+
const updatedErrors = { ...prevState == null ? void 0 : prevState.errors };
|
|
142
|
+
const newErrors = errorText !== void 0 ? [errorText] : [];
|
|
143
|
+
if (newErrors.length > 0) {
|
|
144
|
+
updatedErrors[label2] = newErrors;
|
|
145
|
+
} else {
|
|
146
|
+
delete updatedErrors[label2];
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...prevState,
|
|
150
|
+
errors: Object.keys(updatedErrors).length > 0 ? updatedErrors : void 0
|
|
110
151
|
// Only keep errors if there are any
|
|
111
152
|
};
|
|
112
153
|
});
|
|
113
154
|
},
|
|
114
|
-
[
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
155
|
+
[form, updateFormState]
|
|
156
|
+
);
|
|
157
|
+
const renderField = useCallback(
|
|
158
|
+
(field) => /* @__PURE__ */ jsx(
|
|
159
|
+
FormField,
|
|
118
160
|
{
|
|
119
|
-
...
|
|
120
|
-
"aria-labelledby": `${
|
|
121
|
-
"aria-required":
|
|
122
|
-
messagesFields
|
|
123
|
-
variant
|
|
124
|
-
disabled:
|
|
125
|
-
onChange:
|
|
126
|
-
onValidate:
|
|
161
|
+
...field,
|
|
162
|
+
"aria-labelledby": `${field == null ? void 0 : field.label}-label`,
|
|
163
|
+
"aria-required": Boolean(field == null ? void 0 : field.required) ? "true" : void 0,
|
|
164
|
+
messagesFields,
|
|
165
|
+
variant,
|
|
166
|
+
disabled: disableFields !== void 0 ? disableFields : field == null ? void 0 : field.disabled,
|
|
167
|
+
onChange: handleChangeField,
|
|
168
|
+
onValidate: handleValidationField
|
|
127
169
|
}
|
|
128
170
|
),
|
|
129
171
|
[
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
172
|
+
variant,
|
|
173
|
+
disableFields,
|
|
174
|
+
messagesFields,
|
|
175
|
+
handleChangeField,
|
|
176
|
+
handleValidationField
|
|
135
177
|
]
|
|
136
|
-
)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
178
|
+
);
|
|
179
|
+
const handleValidationForm = useCallback(() => {
|
|
180
|
+
var _a;
|
|
181
|
+
const errors = {};
|
|
182
|
+
for (const field of form) {
|
|
183
|
+
const { required, visible, value, label: label2, fieldType } = field;
|
|
184
|
+
if (label2 === void 0) {
|
|
142
185
|
continue;
|
|
143
|
-
|
|
144
|
-
|
|
186
|
+
}
|
|
187
|
+
if (!errors[label2]) {
|
|
188
|
+
errors[label2] = [];
|
|
189
|
+
}
|
|
190
|
+
const hasErrorText = fieldType !== "slider" && fieldType !== "switch" && isString(field == null ? void 0 : field.errorText);
|
|
191
|
+
if (hasErrorText) {
|
|
192
|
+
errors[label2].push(field == null ? void 0 : field.errorText);
|
|
145
193
|
continue;
|
|
146
194
|
}
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
195
|
+
if (Boolean(required) && (value === void 0 || value === "") && visible !== false) {
|
|
196
|
+
errors[label2].push(
|
|
197
|
+
((_a = messagesFields == null ? void 0 : messagesFields.errors) == null ? void 0 : _a.required) ?? "This field is required. Please fill it out."
|
|
198
|
+
);
|
|
199
|
+
}
|
|
150
200
|
}
|
|
151
|
-
const
|
|
201
|
+
const cleanedErrors = Object.keys(errors).reduce((acc, key) => {
|
|
202
|
+
if (errors[key] && errors[key].length > 0) {
|
|
203
|
+
acc[key] = errors[key];
|
|
204
|
+
}
|
|
205
|
+
return acc;
|
|
206
|
+
}, {});
|
|
152
207
|
return {
|
|
153
|
-
errors: Object.keys(
|
|
208
|
+
errors: Object.keys(cleanedErrors).length > 0 ? cleanedErrors : void 0
|
|
154
209
|
};
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
210
|
+
}, [form, messagesFields]);
|
|
211
|
+
const handleSubmitForm = useCallback(
|
|
212
|
+
(e) => {
|
|
213
|
+
e.preventDefault();
|
|
214
|
+
const { errors } = handleValidationForm();
|
|
215
|
+
setFormMessages({
|
|
216
|
+
errors: errors !== void 0 ? errors : void 0
|
|
217
|
+
});
|
|
218
|
+
if (errors === void 0) {
|
|
219
|
+
onSubmit == null ? void 0 : onSubmit(form);
|
|
220
|
+
}
|
|
162
221
|
},
|
|
163
|
-
[
|
|
164
|
-
)
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
222
|
+
[form, handleValidationForm, onSubmit]
|
|
223
|
+
);
|
|
224
|
+
const handleHpChange = useCallback(
|
|
225
|
+
(e) => {
|
|
226
|
+
var _a;
|
|
227
|
+
return setHp((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value);
|
|
168
228
|
},
|
|
169
229
|
[]
|
|
170
|
-
), X = R(
|
|
171
|
-
() => x ? s.every((r) => {
|
|
172
|
-
const { value: o } = r;
|
|
173
|
-
return !(r != null && r.required && (o === void 0 || o === "" || Array.isArray(o) && (o == null ? void 0 : o.length) <= 0) && (r == null ? void 0 : r.visible) !== !1);
|
|
174
|
-
}) : !0,
|
|
175
|
-
[s, x]
|
|
176
230
|
);
|
|
177
|
-
|
|
231
|
+
const isFormValid = useMemo(
|
|
232
|
+
() => Boolean(hideResponse) ? form.every((field) => {
|
|
233
|
+
const { value } = field;
|
|
234
|
+
if (Boolean(field == null ? void 0 : field.required) && (value === void 0 || value === "" || Array.isArray(value) && (value == null ? void 0 : value.length) <= 0) && (field == null ? void 0 : field.visible) !== false) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
return true;
|
|
238
|
+
}) : true,
|
|
239
|
+
[form, hideResponse]
|
|
240
|
+
);
|
|
241
|
+
return /* @__PURE__ */ jsxs(
|
|
178
242
|
"form",
|
|
179
243
|
{
|
|
180
|
-
...
|
|
181
|
-
noValidate:
|
|
182
|
-
action
|
|
244
|
+
...props,
|
|
245
|
+
noValidate: true,
|
|
246
|
+
action,
|
|
183
247
|
"aria-labelledby": "form-heading",
|
|
184
|
-
className:
|
|
185
|
-
onSubmit:
|
|
248
|
+
className: bem(void 0, void 0, className),
|
|
249
|
+
onSubmit: action === void 0 ? handleSubmitForm : void 0,
|
|
186
250
|
children: [
|
|
187
|
-
/* @__PURE__ */
|
|
188
|
-
/* @__PURE__ */
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
251
|
+
/* @__PURE__ */ jsx(Headline, { className: bem("label"), id: "form-heading", type: "h2", children: label }),
|
|
252
|
+
/* @__PURE__ */ jsxs(Grid, { spacing: 2, children: [
|
|
253
|
+
isArray(form) && form.map((field) => /* @__PURE__ */ jsx(Fragment, { children: renderField(field) }, `form-input-${field.name}`)),
|
|
254
|
+
children,
|
|
255
|
+
renderField({
|
|
192
256
|
fieldType: "input",
|
|
193
257
|
label: "Do not fill this field",
|
|
194
258
|
labelProps: {
|
|
@@ -198,22 +262,22 @@ const y = f(rr, "Form"), er = Y(
|
|
|
198
262
|
id: "hp",
|
|
199
263
|
"aria-hidden": "true",
|
|
200
264
|
// Hide honeypot field from assistive technology
|
|
201
|
-
className:
|
|
202
|
-
value:
|
|
203
|
-
onChange:
|
|
265
|
+
className: bem("hp"),
|
|
266
|
+
value: hp,
|
|
267
|
+
onChange: handleHpChange
|
|
204
268
|
})
|
|
205
269
|
] }),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
(
|
|
208
|
-
(
|
|
209
|
-
|
|
270
|
+
/* @__PURE__ */ jsxs("div", { className: bem("footer"), children: [
|
|
271
|
+
(hideResponse === false || hideResponse === void 0) && /* @__PURE__ */ jsx(FormResponse, { messages: formMessages }),
|
|
272
|
+
(hp == null ? void 0 : hp.length) <= 0 && /* @__PURE__ */ jsx(
|
|
273
|
+
Button,
|
|
210
274
|
{
|
|
211
275
|
"aria-label": "Submit form",
|
|
212
|
-
className:
|
|
213
|
-
color:
|
|
276
|
+
className: bem("footer__submit"),
|
|
277
|
+
color: variant,
|
|
214
278
|
type: "submit",
|
|
215
|
-
...
|
|
216
|
-
disabled: (
|
|
279
|
+
...button,
|
|
280
|
+
disabled: (formMessages == null ? void 0 : formMessages.errors) !== void 0 || !isFormValid
|
|
217
281
|
}
|
|
218
282
|
)
|
|
219
283
|
] })
|
|
@@ -222,7 +286,7 @@ const y = f(rr, "Form"), er = Y(
|
|
|
222
286
|
);
|
|
223
287
|
}
|
|
224
288
|
);
|
|
225
|
-
|
|
289
|
+
Form.displayName = "Form";
|
|
226
290
|
export {
|
|
227
|
-
|
|
291
|
+
Form
|
|
228
292
|
};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const gradientMove = "gradientMove";
|
|
2
|
+
const fadeInKeyframe = "fadeInKeyframe";
|
|
3
|
+
const styles = {
|
|
2
4
|
"prokodo-Form__label": "prokodo-Form__label",
|
|
3
5
|
"prokodo-Form__hp": "prokodo-Form__hp",
|
|
4
6
|
"prokodo-Form__footer": "prokodo-Form__footer",
|
|
5
7
|
"prokodo-Form__footer__submit": "prokodo-Form__footer__submit",
|
|
6
|
-
gradientMove
|
|
7
|
-
fadeInKeyframe
|
|
8
|
+
gradientMove,
|
|
9
|
+
fadeInKeyframe
|
|
8
10
|
};
|
|
9
11
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
styles as default,
|
|
13
|
+
fadeInKeyframe,
|
|
14
|
+
gradientMove
|
|
13
15
|
};
|
|
@@ -1,87 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { memo, useCallback } from "react";
|
|
5
|
+
import { create } from "../../helpers/bem.js";
|
|
6
|
+
import styles from "./FormField.module.scss.js";
|
|
7
|
+
import { GridRow } from "../grid/GridRow.js";
|
|
8
|
+
import { DatePicker } from "../datePicker/DatePicker.js";
|
|
9
|
+
import { Select } from "../select/Select.js";
|
|
10
|
+
import { Slider } from "../slider/Slider.js";
|
|
11
|
+
import { Switch } from "../switch/Switch.js";
|
|
12
|
+
import { Input } from "../input/Input.js";
|
|
13
|
+
const bem = create(styles, "FormField");
|
|
14
|
+
const FormField = memo(
|
|
12
15
|
({
|
|
13
|
-
fieldType
|
|
14
|
-
visible
|
|
15
|
-
variant
|
|
16
|
-
messagesFields
|
|
17
|
-
onChange
|
|
18
|
-
onValidate
|
|
19
|
-
...
|
|
16
|
+
fieldType,
|
|
17
|
+
visible,
|
|
18
|
+
variant = "primary",
|
|
19
|
+
messagesFields,
|
|
20
|
+
onChange,
|
|
21
|
+
onValidate,
|
|
22
|
+
...props
|
|
20
23
|
}) => {
|
|
21
|
-
var
|
|
22
|
-
const
|
|
23
|
-
(
|
|
24
|
+
var _a, _b;
|
|
25
|
+
const renderFieldContainer = useCallback(
|
|
26
|
+
(children) => /* @__PURE__ */ jsx(GridRow, { className: bem(), xs: 12, children }),
|
|
24
27
|
[]
|
|
25
28
|
);
|
|
26
|
-
if (
|
|
27
|
-
switch (
|
|
29
|
+
if (visible === false) return null;
|
|
30
|
+
switch (fieldType) {
|
|
28
31
|
case "switch":
|
|
29
|
-
return
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
|
|
32
|
+
return renderFieldContainer(
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
Switch,
|
|
32
35
|
{
|
|
33
|
-
color:
|
|
34
|
-
...
|
|
35
|
-
onChange: (
|
|
36
|
+
color: variant,
|
|
37
|
+
...props,
|
|
38
|
+
onChange: /* @__PURE__ */ __name((_, checked) => onChange == null ? void 0 : onChange(props, checked), "onChange")
|
|
36
39
|
}
|
|
37
40
|
)
|
|
38
41
|
);
|
|
39
42
|
case "slider":
|
|
40
|
-
return
|
|
41
|
-
/* @__PURE__ */
|
|
42
|
-
|
|
43
|
+
return renderFieldContainer(
|
|
44
|
+
/* @__PURE__ */ jsx(
|
|
45
|
+
Slider,
|
|
43
46
|
{
|
|
44
|
-
...
|
|
45
|
-
onChange: (
|
|
47
|
+
...props,
|
|
48
|
+
onChange: /* @__PURE__ */ __name((_, value) => onChange == null ? void 0 : onChange(props, value == null ? void 0 : value.toString()), "onChange")
|
|
46
49
|
}
|
|
47
50
|
)
|
|
48
51
|
);
|
|
49
52
|
case "select":
|
|
50
|
-
return
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
|
|
53
|
+
return renderFieldContainer(
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
Select,
|
|
53
56
|
{
|
|
54
|
-
color:
|
|
55
|
-
...
|
|
56
|
-
onChange: (
|
|
57
|
+
color: variant,
|
|
58
|
+
...props,
|
|
59
|
+
onChange: /* @__PURE__ */ __name((_, value) => onChange == null ? void 0 : onChange(props, value ?? void 0), "onChange")
|
|
57
60
|
}
|
|
58
61
|
)
|
|
59
62
|
);
|
|
60
63
|
case "input":
|
|
61
|
-
return
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
+
return renderFieldContainer(
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
Input,
|
|
64
67
|
{
|
|
65
|
-
color:
|
|
66
|
-
errorTranslations: (
|
|
67
|
-
onValidate: (
|
|
68
|
-
onChange: (
|
|
69
|
-
...
|
|
68
|
+
color: variant,
|
|
69
|
+
errorTranslations: (_a = messagesFields == null ? void 0 : messagesFields.errors) == null ? void 0 : _a.input,
|
|
70
|
+
onValidate: /* @__PURE__ */ __name((_, err) => onValidate == null ? void 0 : onValidate(props, err), "onValidate"),
|
|
71
|
+
onChange: /* @__PURE__ */ __name((e) => onChange == null ? void 0 : onChange(props, e.target.value), "onChange"),
|
|
72
|
+
...props
|
|
70
73
|
}
|
|
71
74
|
)
|
|
72
75
|
);
|
|
73
76
|
case "date":
|
|
74
|
-
return
|
|
75
|
-
/* @__PURE__ */
|
|
76
|
-
|
|
77
|
+
return renderFieldContainer(
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
DatePicker,
|
|
77
80
|
{
|
|
78
|
-
...
|
|
79
|
-
errorTranslations: (
|
|
80
|
-
onValidate: (
|
|
81
|
-
onChange: (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
)
|
|
81
|
+
...props,
|
|
82
|
+
errorTranslations: (_b = messagesFields == null ? void 0 : messagesFields.errors) == null ? void 0 : _b.date,
|
|
83
|
+
onValidate: /* @__PURE__ */ __name((_, err) => onValidate == null ? void 0 : onValidate(props, err), "onValidate"),
|
|
84
|
+
onChange: /* @__PURE__ */ __name((value) => onChange == null ? void 0 : onChange(
|
|
85
|
+
props,
|
|
86
|
+
value == null ? void 0 : value.format("YYYY-MM-DDTHH:mm:ssZ")
|
|
87
|
+
), "onChange")
|
|
85
88
|
}
|
|
86
89
|
)
|
|
87
90
|
);
|
|
@@ -90,7 +93,7 @@ const G = T(b, "FormField"), I = y(
|
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
);
|
|
93
|
-
|
|
96
|
+
FormField.displayName = "FormField";
|
|
94
97
|
export {
|
|
95
|
-
|
|
98
|
+
FormField
|
|
96
99
|
};
|