@onepercentio/one-ui 0.29.0 → 0.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils/e2e.js +2 -2
- package/dist-ts/assets/img/svg/checkbox.svg +3 -0
- package/dist-ts/assets/styles/index.scss +2 -0
- package/dist-ts/assets/styles/mixins.scss +12 -0
- package/dist-ts/assets/styles/variables.scss +49 -0
- package/dist-ts/components/AdaptiveButton/AdaptiveButton.d.ts +8 -0
- package/dist-ts/components/AdaptiveButton/AdaptiveButton.js +11 -0
- package/dist-ts/components/AdaptiveButton/AdaptiveButton.js.map +1 -0
- package/dist-ts/components/AdaptiveButton/AdaptiveButton.module.scss +7 -0
- package/dist-ts/components/AdaptiveButton/index.d.ts +1 -0
- package/dist-ts/components/AdaptiveButton/index.js +2 -0
- package/dist-ts/components/AdaptiveButton/index.js.map +1 -0
- package/dist-ts/components/AdaptiveContainer/AdaptiveContainer.d.ts +21 -0
- package/dist-ts/components/AdaptiveContainer/AdaptiveContainer.js +125 -0
- package/dist-ts/components/AdaptiveContainer/AdaptiveContainer.js.map +1 -0
- package/dist-ts/components/AdaptiveContainer/AdaptiveContainer.module.scss +53 -0
- package/dist-ts/components/AdaptiveContainer/index.d.ts +1 -0
- package/dist-ts/components/AdaptiveContainer/index.js +2 -0
- package/dist-ts/components/AdaptiveContainer/index.js.map +1 -0
- package/dist-ts/components/AdaptiveDialog/AdaptiveDialog.d.ts +16 -0
- package/dist-ts/components/AdaptiveDialog/AdaptiveDialog.js +39 -0
- package/dist-ts/components/AdaptiveDialog/AdaptiveDialog.js.map +1 -0
- package/dist-ts/components/AdaptiveDialog/AdaptiveDialog.module.scss +147 -0
- package/dist-ts/components/AdaptiveDialog/index.d.ts +1 -0
- package/dist-ts/components/AdaptiveDialog/index.js +2 -0
- package/dist-ts/components/AdaptiveDialog/index.js.map +1 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +24 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.js +43 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +49 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.sample.d.ts +1 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.sample.js +6 -0
- package/dist-ts/components/AdaptiveSidebar/AdaptiveSidebar.sample.js.map +1 -0
- package/dist-ts/components/AdaptiveSidebar/index.d.ts +1 -0
- package/dist-ts/components/AdaptiveSidebar/index.js +2 -0
- package/dist-ts/components/AdaptiveSidebar/index.js.map +1 -0
- package/dist-ts/components/AnchoredTooltip/AnchoredTooltip.d.ts +34 -0
- package/dist-ts/components/AnchoredTooltip/AnchoredTooltip.js +145 -0
- package/dist-ts/components/AnchoredTooltip/AnchoredTooltip.js.map +1 -0
- package/dist-ts/components/AnchoredTooltip/AnchoredTooltip.module.scss +64 -0
- package/dist-ts/components/AnchoredTooltip/index.d.ts +1 -0
- package/dist-ts/components/AnchoredTooltip/index.js +2 -0
- package/dist-ts/components/AnchoredTooltip/index.js.map +1 -0
- package/dist-ts/components/AnimatedEntrance/AnimatedEntrance.d.ts +18 -0
- package/dist-ts/components/AnimatedEntrance/AnimatedEntrance.js +122 -0
- package/dist-ts/components/AnimatedEntrance/AnimatedEntrance.js.map +1 -0
- package/dist-ts/components/AnimatedEntrance/AnimatedEntrance.module.scss +108 -0
- package/dist-ts/components/AnimatedEntrance/index.d.ts +1 -0
- package/dist-ts/components/AnimatedEntrance/index.js +2 -0
- package/dist-ts/components/AnimatedEntrance/index.js.map +1 -0
- package/dist-ts/components/AsyncWrapper/AsyncWrapper.d.ts +10 -0
- package/dist-ts/components/AsyncWrapper/AsyncWrapper.js +14 -0
- package/dist-ts/components/AsyncWrapper/AsyncWrapper.js.map +1 -0
- package/dist-ts/components/AsyncWrapper/index.d.ts +1 -0
- package/dist-ts/components/AsyncWrapper/index.js +2 -0
- package/dist-ts/components/AsyncWrapper/index.js.map +1 -0
- package/dist-ts/components/Avatar/Avatar.d.ts +8 -0
- package/dist-ts/components/Avatar/Avatar.js +17 -0
- package/dist-ts/components/Avatar/Avatar.js.map +1 -0
- package/dist-ts/components/Avatar/Avatar.module.scss +22 -0
- package/dist-ts/components/Avatar/index.d.ts +1 -0
- package/dist-ts/components/Avatar/index.js +2 -0
- package/dist-ts/components/Avatar/index.js.map +1 -0
- package/dist-ts/components/BucketFill/BucketFill.d.ts +12 -0
- package/dist-ts/components/BucketFill/BucketFill.js +36 -0
- package/dist-ts/components/BucketFill/BucketFill.js.map +1 -0
- package/dist-ts/components/BucketFill/BucketFill.module.scss +36 -0
- package/dist-ts/components/BucketFill/index.d.ts +1 -0
- package/dist-ts/components/BucketFill/index.js +2 -0
- package/dist-ts/components/BucketFill/index.js.map +1 -0
- package/dist-ts/components/Button/Button.d.ts +14 -0
- package/dist-ts/components/Button/Button.js +14 -0
- package/dist-ts/components/Button/Button.js.map +1 -0
- package/dist-ts/components/Button/Button.module.scss +45 -0
- package/dist-ts/components/Button/index.d.ts +1 -0
- package/dist-ts/components/Button/index.js +2 -0
- package/dist-ts/components/Button/index.js.map +1 -0
- package/dist-ts/components/Card/Card.d.ts +7 -0
- package/dist-ts/components/Card/Card.js +9 -0
- package/dist-ts/components/Card/Card.js.map +1 -0
- package/dist-ts/components/Card/Card.module.scss +12 -0
- package/dist-ts/components/Card/index.d.ts +1 -0
- package/dist-ts/components/Card/index.js +2 -0
- package/dist-ts/components/Card/index.js.map +1 -0
- package/dist-ts/components/Chart/Chart.e2e.d.ts +4 -0
- package/dist-ts/components/Chart/Chart.e2e.js +6 -0
- package/dist-ts/components/Chart/Chart.e2e.js.map +1 -0
- package/dist-ts/components/Chart/Chart.logic.d.ts +3 -0
- package/dist-ts/components/Chart/Chart.logic.js +7 -0
- package/dist-ts/components/Chart/Chart.logic.js.map +1 -0
- package/dist-ts/components/Chart/Chart.module.scss +58 -0
- package/dist-ts/components/Chart/Chart.types.d.ts +24 -0
- package/dist-ts/components/Chart/Chart.types.js +2 -0
- package/dist-ts/components/Chart/Chart.types.js.map +1 -0
- package/dist-ts/components/Chart/Chart.view.d.ts +5 -0
- package/dist-ts/components/Chart/Chart.view.js +102 -0
- package/dist-ts/components/Chart/Chart.view.js.map +1 -0
- package/dist-ts/components/Chart/index.d.ts +1 -0
- package/dist-ts/components/Chart/index.js +2 -0
- package/dist-ts/components/Chart/index.js.map +1 -0
- package/dist-ts/components/CheckBox/CheckBox.d.ts +13 -0
- package/dist-ts/components/CheckBox/CheckBox.js +14 -0
- package/dist-ts/components/CheckBox/CheckBox.js.map +1 -0
- package/dist-ts/components/CheckBox/CheckBox.module.scss +36 -0
- package/dist-ts/components/CheckBox/index.d.ts +1 -0
- package/dist-ts/components/CheckBox/index.js +2 -0
- package/dist-ts/components/CheckBox/index.js.map +1 -0
- package/dist-ts/components/CodeInput/CodeInput.d.ts +8 -0
- package/dist-ts/components/CodeInput/CodeInput.js +73 -0
- package/dist-ts/components/CodeInput/CodeInput.js.map +1 -0
- package/dist-ts/components/CodeInput/CodeInput.module.scss +5 -0
- package/dist-ts/components/CodeInput/index.d.ts +1 -0
- package/dist-ts/components/CodeInput/index.js +2 -0
- package/dist-ts/components/CodeInput/index.js.map +1 -0
- package/dist-ts/components/Collapsable/Collapsable.d.ts +49 -0
- package/dist-ts/components/Collapsable/Collapsable.js +133 -0
- package/dist-ts/components/Collapsable/Collapsable.js.map +1 -0
- package/dist-ts/components/Collapsable/Collapsable.module.scss +42 -0
- package/dist-ts/components/Collapsable/index.d.ts +1 -0
- package/dist-ts/components/Collapsable/index.js +2 -0
- package/dist-ts/components/Collapsable/index.js.map +1 -0
- package/dist-ts/components/Countdown/Countdown.d.ts +24 -0
- package/dist-ts/components/Countdown/Countdown.js +73 -0
- package/dist-ts/components/Countdown/Countdown.js.map +1 -0
- package/dist-ts/components/Countdown/index.d.ts +1 -0
- package/dist-ts/components/Countdown/index.js +2 -0
- package/dist-ts/components/Countdown/index.js.map +1 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.d.ts +7 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.hook.d.ts +6 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.hook.js +23 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.hook.js.map +1 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.js +12 -0
- package/dist-ts/components/CurrencyInput/CurrencyInput.js.map +1 -0
- package/dist-ts/components/CurrencyInput/index.d.ts +1 -0
- package/dist-ts/components/CurrencyInput/index.js +2 -0
- package/dist-ts/components/CurrencyInput/index.js.map +1 -0
- package/dist-ts/components/Divider/Divider.d.ts +6 -0
- package/dist-ts/components/Divider/Divider.js +9 -0
- package/dist-ts/components/Divider/Divider.js.map +1 -0
- package/dist-ts/components/Divider/Divider.module.scss +7 -0
- package/dist-ts/components/Divider/index.d.ts +1 -0
- package/dist-ts/components/Divider/index.js +2 -0
- package/dist-ts/components/Divider/index.js.map +1 -0
- package/dist-ts/components/EmailInput/EmailInput.d.ts +31 -0
- package/dist-ts/components/EmailInput/EmailInput.js +24 -0
- package/dist-ts/components/EmailInput/EmailInput.js.map +1 -0
- package/dist-ts/components/EmailInput/EmailInput.module.scss +0 -0
- package/dist-ts/components/EmailInput/index.d.ts +1 -0
- package/dist-ts/components/EmailInput/index.js +2 -0
- package/dist-ts/components/EmailInput/index.js.map +1 -0
- package/dist-ts/components/FadeIn/FadeIn.d.ts +15 -0
- package/dist-ts/components/FadeIn/FadeIn.js +40 -0
- package/dist-ts/components/FadeIn/FadeIn.js.map +1 -0
- package/dist-ts/components/FadeIn/FadeIn.module.scss +9 -0
- package/dist-ts/components/FadeIn/index.d.ts +1 -0
- package/dist-ts/components/FadeIn/index.js +2 -0
- package/dist-ts/components/FadeIn/index.js.map +1 -0
- package/dist-ts/components/FileInput/FileInput.d.ts +31 -0
- package/dist-ts/components/FileInput/FileInput.js +26 -0
- package/dist-ts/components/FileInput/FileInput.js.map +1 -0
- package/dist-ts/components/FileInput/FileInput.module.scss +6 -0
- package/dist-ts/components/FileInput/View/BigFactory/BigFactory.d.ts +6 -0
- package/dist-ts/components/FileInput/View/BigFactory/BigFactory.js +14 -0
- package/dist-ts/components/FileInput/View/BigFactory/BigFactory.js.map +1 -0
- package/dist-ts/components/FileInput/View/BigFactory/BigFactory.module.scss +20 -0
- package/dist-ts/components/FileInput/View/BigFactory/index.d.ts +1 -0
- package/dist-ts/components/FileInput/View/BigFactory/index.js +2 -0
- package/dist-ts/components/FileInput/View/BigFactory/index.js.map +1 -0
- package/dist-ts/components/FileInput/View/Compact/Compact.d.ts +11 -0
- package/dist-ts/components/FileInput/View/Compact/Compact.js +45 -0
- package/dist-ts/components/FileInput/View/Compact/Compact.js.map +1 -0
- package/dist-ts/components/FileInput/View/Compact/Compact.module.scss +68 -0
- package/dist-ts/components/FileInput/View/Compact/index.d.ts +1 -0
- package/dist-ts/components/FileInput/View/Compact/index.js +2 -0
- package/dist-ts/components/FileInput/View/Compact/index.js.map +1 -0
- package/dist-ts/components/FileInput/View/View.types.d.ts +8 -0
- package/dist-ts/components/FileInput/View/View.types.js +2 -0
- package/dist-ts/components/FileInput/View/View.types.js.map +1 -0
- package/dist-ts/components/FileInput/index.d.ts +1 -0
- package/dist-ts/components/FileInput/index.js +2 -0
- package/dist-ts/components/FileInput/index.js.map +1 -0
- package/dist-ts/components/FlowController/FlowController.d.ts +23 -0
- package/dist-ts/components/FlowController/FlowController.js +23 -0
- package/dist-ts/components/FlowController/FlowController.js.map +1 -0
- package/dist-ts/components/FlowController/FlowController.module.scss +47 -0
- package/dist-ts/components/FlowController/index.d.ts +1 -0
- package/dist-ts/components/FlowController/index.js +2 -0
- package/dist-ts/components/FlowController/index.js.map +1 -0
- package/dist-ts/components/Form/Form.d.ts +49 -0
- package/dist-ts/components/Form/Form.js +69 -0
- package/dist-ts/components/Form/Form.js.map +1 -0
- package/dist-ts/components/Form/index.d.ts +1 -0
- package/dist-ts/components/Form/index.js +2 -0
- package/dist-ts/components/Form/index.js.map +1 -0
- package/dist-ts/components/Form/v2/Form.d.ts +18 -0
- package/dist-ts/components/Form/v2/Form.hook.d.ts +40 -0
- package/dist-ts/components/Form/v2/Form.hook.js +222 -0
- package/dist-ts/components/Form/v2/Form.hook.js.map +1 -0
- package/dist-ts/components/Form/v2/Form.js +31 -0
- package/dist-ts/components/Form/v2/Form.js.map +1 -0
- package/dist-ts/components/Form/v2/Form.module.scss +0 -0
- package/dist-ts/components/Form/v2/Form.types.d.ts +97 -0
- package/dist-ts/components/Form/v2/Form.types.js +51 -0
- package/dist-ts/components/Form/v2/Form.types.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/DateField.d.ts +11 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/DateField.js +38 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/DateField.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/index.d.ts +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/index.js +2 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/DateField/index.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.d.ts +9 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.js +57 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/index.d.ts +1 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/index.js +2 -0
- package/dist-ts/components/Form/v2/FormField/Extensions/PhoneField/index.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/FormField.d.ts +5 -0
- package/dist-ts/components/Form/v2/FormField/FormField.js +133 -0
- package/dist-ts/components/Form/v2/FormField/FormField.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/FormField.module.scss +0 -0
- package/dist-ts/components/Form/v2/FormField/FormField.types.d.ts +90 -0
- package/dist-ts/components/Form/v2/FormField/FormField.types.js +6 -0
- package/dist-ts/components/Form/v2/FormField/FormField.types.js.map +1 -0
- package/dist-ts/components/Form/v2/FormField/index.d.ts +1 -0
- package/dist-ts/components/Form/v2/FormField/index.js +2 -0
- package/dist-ts/components/Form/v2/FormField/index.js.map +1 -0
- package/dist-ts/components/Form/v2/index.d.ts +1 -0
- package/dist-ts/components/Form/v2/index.js +2 -0
- package/dist-ts/components/Form/v2/index.js.map +1 -0
- package/dist-ts/components/Freeze/Freeze.d.ts +5 -0
- package/dist-ts/components/Freeze/Freeze.js +8 -0
- package/dist-ts/components/Freeze/Freeze.js.map +1 -0
- package/dist-ts/components/Freeze/index.d.ts +1 -0
- package/dist-ts/components/Freeze/index.js +2 -0
- package/dist-ts/components/Freeze/index.js.map +1 -0
- package/dist-ts/components/HSForms/HSForms.d.ts +8 -0
- package/dist-ts/components/HSForms/HSForms.js +46 -0
- package/dist-ts/components/HSForms/HSForms.js.map +1 -0
- package/dist-ts/components/HSForms/index.d.ts +1 -0
- package/dist-ts/components/HSForms/index.js +2 -0
- package/dist-ts/components/HSForms/index.js.map +1 -0
- package/dist-ts/components/Header/Header.d.ts +25 -0
- package/dist-ts/components/Header/Header.js +35 -0
- package/dist-ts/components/Header/Header.js.map +1 -0
- package/dist-ts/components/Header/Header.module.scss +119 -0
- package/dist-ts/components/Header/index.d.ts +1 -0
- package/dist-ts/components/Header/index.js +2 -0
- package/dist-ts/components/Header/index.js.map +1 -0
- package/dist-ts/components/HeaderCloseBtn/HeaderCloseBtn.d.ts +8 -0
- package/dist-ts/components/HeaderCloseBtn/HeaderCloseBtn.js +9 -0
- package/dist-ts/components/HeaderCloseBtn/HeaderCloseBtn.js.map +1 -0
- package/dist-ts/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +44 -0
- package/dist-ts/components/HeaderCloseBtn/index.d.ts +1 -0
- package/dist-ts/components/HeaderCloseBtn/index.js +2 -0
- package/dist-ts/components/HeaderCloseBtn/index.js.map +1 -0
- package/dist-ts/components/InfinityScroll/InfinityScroll.d.ts +21 -0
- package/dist-ts/components/InfinityScroll/InfinityScroll.js +102 -0
- package/dist-ts/components/InfinityScroll/InfinityScroll.js.map +1 -0
- package/dist-ts/components/InfinityScroll/InfinityScroll.module.scss +30 -0
- package/dist-ts/components/InfinityScroll/index.d.ts +1 -0
- package/dist-ts/components/InfinityScroll/index.js +2 -0
- package/dist-ts/components/InfinityScroll/index.js.map +1 -0
- package/dist-ts/components/Input/Input.d.ts +43 -0
- package/dist-ts/components/Input/Input.js +51 -0
- package/dist-ts/components/Input/Input.js.map +1 -0
- package/dist-ts/components/Input/Input.module.scss +71 -0
- package/dist-ts/components/Input/index.d.ts +1 -0
- package/dist-ts/components/Input/index.js +2 -0
- package/dist-ts/components/Input/index.js.map +1 -0
- package/dist-ts/components/InstantCounter/InstantCounter.d.ts +16 -0
- package/dist-ts/components/InstantCounter/InstantCounter.js +35 -0
- package/dist-ts/components/InstantCounter/InstantCounter.js.map +1 -0
- package/dist-ts/components/InstantCounter/index.d.ts +1 -0
- package/dist-ts/components/InstantCounter/index.js +2 -0
- package/dist-ts/components/InstantCounter/index.js.map +1 -0
- package/dist-ts/components/LavaLamp/LavaLamp.d.ts +12 -0
- package/dist-ts/components/LavaLamp/LavaLamp.data.d.ts +16 -0
- package/dist-ts/components/LavaLamp/LavaLamp.data.js +85 -0
- package/dist-ts/components/LavaLamp/LavaLamp.data.js.map +1 -0
- package/dist-ts/components/LavaLamp/LavaLamp.js +32 -0
- package/dist-ts/components/LavaLamp/LavaLamp.js.map +1 -0
- package/dist-ts/components/LavaLamp/LavaLamp.module.scss +26 -0
- package/dist-ts/components/LavaLamp/index.d.ts +1 -0
- package/dist-ts/components/LavaLamp/index.js +2 -0
- package/dist-ts/components/LavaLamp/index.js.map +1 -0
- package/dist-ts/components/LavaLamp/v2/LavaLamp.d.ts +4 -0
- package/dist-ts/components/LavaLamp/v2/LavaLamp.js +132 -0
- package/dist-ts/components/LavaLamp/v2/LavaLamp.js.map +1 -0
- package/dist-ts/components/LavaLamp/v2/LavaLamp.module.scss +23 -0
- package/dist-ts/components/LinkToId/LinkToId.d.ts +10 -0
- package/dist-ts/components/LinkToId/LinkToId.js +25 -0
- package/dist-ts/components/LinkToId/LinkToId.js.map +1 -0
- package/dist-ts/components/LinkToId/LinkToId.module.scss +4 -0
- package/dist-ts/components/LinkToId/index.d.ts +1 -0
- package/dist-ts/components/LinkToId/index.js +2 -0
- package/dist-ts/components/LinkToId/index.js.map +1 -0
- package/dist-ts/components/Loader/Loader.d.ts +7 -0
- package/dist-ts/components/Loader/Loader.js +9 -0
- package/dist-ts/components/Loader/Loader.js.map +1 -0
- package/dist-ts/components/Loader/Loader.module.scss +40 -0
- package/dist-ts/components/Loader/index.d.ts +1 -0
- package/dist-ts/components/Loader/index.js +2 -0
- package/dist-ts/components/Loader/index.js.map +1 -0
- package/dist-ts/components/LoaderDotsIndicator/LoaderDotsIndicator.d.ts +8 -0
- package/dist-ts/components/LoaderDotsIndicator/LoaderDotsIndicator.js +17 -0
- package/dist-ts/components/LoaderDotsIndicator/LoaderDotsIndicator.js.map +1 -0
- package/dist-ts/components/LoaderDotsIndicator/index.d.ts +1 -0
- package/dist-ts/components/LoaderDotsIndicator/index.js +2 -0
- package/dist-ts/components/LoaderDotsIndicator/index.js.map +1 -0
- package/dist-ts/components/LoopableVideo/LoopableVideo.d.ts +9 -0
- package/dist-ts/components/LoopableVideo/LoopableVideo.js +15 -0
- package/dist-ts/components/LoopableVideo/LoopableVideo.js.map +1 -0
- package/dist-ts/components/LoopableVideo/index.d.ts +1 -0
- package/dist-ts/components/LoopableVideo/index.js +2 -0
- package/dist-ts/components/LoopableVideo/index.js.map +1 -0
- package/dist-ts/components/MainGrid/MainGrid.d.ts +13 -0
- package/dist-ts/components/MainGrid/MainGrid.js +23 -0
- package/dist-ts/components/MainGrid/MainGrid.js.map +1 -0
- package/dist-ts/components/MainGrid/MainGrid.module.scss +28 -0
- package/dist-ts/components/MainGrid/index.d.ts +1 -0
- package/dist-ts/components/MainGrid/index.js +2 -0
- package/dist-ts/components/MainGrid/index.js.map +1 -0
- package/dist-ts/components/MutableHamburgerButton/MutableHamburgerButton.d.ts +8 -0
- package/dist-ts/components/MutableHamburgerButton/MutableHamburgerButton.js +10 -0
- package/dist-ts/components/MutableHamburgerButton/MutableHamburgerButton.js.map +1 -0
- package/dist-ts/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +220 -0
- package/dist-ts/components/MutableHamburgerButton/index.d.ts +1 -0
- package/dist-ts/components/MutableHamburgerButton/index.js +2 -0
- package/dist-ts/components/MutableHamburgerButton/index.js.map +1 -0
- package/dist-ts/components/Notification/Notification.d.ts +7 -0
- package/dist-ts/components/Notification/Notification.js +10 -0
- package/dist-ts/components/Notification/Notification.js.map +1 -0
- package/dist-ts/components/Notification/Notification.module.scss +25 -0
- package/dist-ts/components/Notification/index.d.ts +1 -0
- package/dist-ts/components/Notification/index.js +2 -0
- package/dist-ts/components/Notification/index.js.map +1 -0
- package/dist-ts/components/OrderableList/OrderableList.d.ts +38 -0
- package/dist-ts/components/OrderableList/OrderableList.js +407 -0
- package/dist-ts/components/OrderableList/OrderableList.js.map +1 -0
- package/dist-ts/components/OrderableList/OrderableList.module.scss +98 -0
- package/dist-ts/components/OrderableList/index.d.ts +1 -0
- package/dist-ts/components/OrderableList/index.js +2 -0
- package/dist-ts/components/OrderableList/index.js.map +1 -0
- package/dist-ts/components/PaginationIndicator/PaginationIndicator.d.ts +40 -0
- package/dist-ts/components/PaginationIndicator/PaginationIndicator.js +206 -0
- package/dist-ts/components/PaginationIndicator/PaginationIndicator.js.map +1 -0
- package/dist-ts/components/PaginationIndicator/index.d.ts +1 -0
- package/dist-ts/components/PaginationIndicator/index.js +2 -0
- package/dist-ts/components/PaginationIndicator/index.js.map +1 -0
- package/dist-ts/components/Parallax/Parallax.d.ts +18 -0
- package/dist-ts/components/Parallax/Parallax.js +132 -0
- package/dist-ts/components/Parallax/Parallax.js.map +1 -0
- package/dist-ts/components/Parallax/Parallax.module.scss +28 -0
- package/dist-ts/components/Parallax/index.d.ts +1 -0
- package/dist-ts/components/Parallax/index.js +2 -0
- package/dist-ts/components/Parallax/index.js.map +1 -0
- package/dist-ts/components/Parallax/math/helpers.d.ts +58 -0
- package/dist-ts/components/Parallax/math/helpers.js +222 -0
- package/dist-ts/components/Parallax/math/helpers.js.map +1 -0
- package/dist-ts/components/PasswordInput/PasswordInput.d.ts +48 -0
- package/dist-ts/components/PasswordInput/PasswordInput.js +74 -0
- package/dist-ts/components/PasswordInput/PasswordInput.js.map +1 -0
- package/dist-ts/components/PasswordInput/PasswordInput.module.scss +17 -0
- package/dist-ts/components/PasswordInput/index.d.ts +1 -0
- package/dist-ts/components/PasswordInput/index.js +2 -0
- package/dist-ts/components/PasswordInput/index.js.map +1 -0
- package/dist-ts/components/PingPongText/PingPongText.d.ts +6 -0
- package/dist-ts/components/PingPongText/PingPongText.js +58 -0
- package/dist-ts/components/PingPongText/PingPongText.js.map +1 -0
- package/dist-ts/components/PingPongText/PingPongText.module.scss +4 -0
- package/dist-ts/components/PingPongText/index.d.ts +1 -0
- package/dist-ts/components/PingPongText/index.js +2 -0
- package/dist-ts/components/PingPongText/index.js.map +1 -0
- package/dist-ts/components/PixelatedScan/PixelatedScan.d.ts +8 -0
- package/dist-ts/components/PixelatedScan/PixelatedScan.js +78 -0
- package/dist-ts/components/PixelatedScan/PixelatedScan.js.map +1 -0
- package/dist-ts/components/PixelatedScan/PixelatedScan.module.scss +86 -0
- package/dist-ts/components/PixelatedScan/index.d.ts +1 -0
- package/dist-ts/components/PixelatedScan/index.js +2 -0
- package/dist-ts/components/PixelatedScan/index.js.map +1 -0
- package/dist-ts/components/Portal/Portal.d.ts +11 -0
- package/dist-ts/components/Portal/Portal.js +31 -0
- package/dist-ts/components/Portal/Portal.js.map +1 -0
- package/dist-ts/components/Portal/Portal.module.scss +3 -0
- package/dist-ts/components/Portal/index.d.ts +1 -0
- package/dist-ts/components/Portal/index.js +2 -0
- package/dist-ts/components/Portal/index.js.map +1 -0
- package/dist-ts/components/ProgressBar/ProgressBar.d.ts +29 -0
- package/dist-ts/components/ProgressBar/ProgressBar.js +33 -0
- package/dist-ts/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist-ts/components/ProgressBar/ProgressBar.module.scss +44 -0
- package/dist-ts/components/ProgressBar/index.d.ts +1 -0
- package/dist-ts/components/ProgressBar/index.js +2 -0
- package/dist-ts/components/ProgressBar/index.js.map +1 -0
- package/dist-ts/components/ProgressTexts/ProgressTexts.d.ts +25 -0
- package/dist-ts/components/ProgressTexts/ProgressTexts.js +28 -0
- package/dist-ts/components/ProgressTexts/ProgressTexts.js.map +1 -0
- package/dist-ts/components/ProgressTexts/ProgressTexts.module.scss +37 -0
- package/dist-ts/components/ProgressTexts/index.d.ts +1 -0
- package/dist-ts/components/ProgressTexts/index.js +2 -0
- package/dist-ts/components/ProgressTexts/index.js.map +1 -0
- package/dist-ts/components/Radio/Radio.d.ts +13 -0
- package/dist-ts/components/Radio/Radio.js +14 -0
- package/dist-ts/components/Radio/Radio.js.map +1 -0
- package/dist-ts/components/Radio/Radio.module.scss +36 -0
- package/dist-ts/components/Radio/index.d.ts +1 -0
- package/dist-ts/components/Radio/index.js +2 -0
- package/dist-ts/components/Radio/index.js.map +1 -0
- package/dist-ts/components/SectionContainer/SectionContainer.d.ts +14 -0
- package/dist-ts/components/SectionContainer/SectionContainer.js +15 -0
- package/dist-ts/components/SectionContainer/SectionContainer.js.map +1 -0
- package/dist-ts/components/SectionContainer/SectionContainer.module.scss +30 -0
- package/dist-ts/components/SectionContainer/index.d.ts +1 -0
- package/dist-ts/components/SectionContainer/index.js +2 -0
- package/dist-ts/components/SectionContainer/index.js.map +1 -0
- package/dist-ts/components/Select/Select.d.ts +30 -0
- package/dist-ts/components/Select/Select.js +65 -0
- package/dist-ts/components/Select/Select.js.map +1 -0
- package/dist-ts/components/Select/Select.module.scss +58 -0
- package/dist-ts/components/Select/index.d.ts +1 -0
- package/dist-ts/components/Select/index.js +2 -0
- package/dist-ts/components/Select/index.js.map +1 -0
- package/dist-ts/components/Skeleton/Skeleton.d.ts +10 -0
- package/dist-ts/components/Skeleton/Skeleton.js +16 -0
- package/dist-ts/components/Skeleton/Skeleton.js.map +1 -0
- package/dist-ts/components/Skeleton/Skeleton.module.scss +21 -0
- package/dist-ts/components/Skeleton/index.d.ts +1 -0
- package/dist-ts/components/Skeleton/index.js +2 -0
- package/dist-ts/components/Skeleton/index.js.map +1 -0
- package/dist-ts/components/Spacing/Spacing.d.ts +6 -0
- package/dist-ts/components/Spacing/Spacing.js +16 -0
- package/dist-ts/components/Spacing/Spacing.js.map +1 -0
- package/dist-ts/components/Spacing/Spacing.module.scss +13 -0
- package/dist-ts/components/Spacing/index.d.ts +1 -0
- package/dist-ts/components/Spacing/index.js +2 -0
- package/dist-ts/components/Spacing/index.js.map +1 -0
- package/dist-ts/components/StaticScroller/StaticScroller.d.ts +6 -0
- package/dist-ts/components/StaticScroller/StaticScroller.js +50 -0
- package/dist-ts/components/StaticScroller/StaticScroller.js.map +1 -0
- package/dist-ts/components/StaticScroller/StaticScroller.module.scss +14 -0
- package/dist-ts/components/StaticScroller/index.d.ts +1 -0
- package/dist-ts/components/StaticScroller/index.js +2 -0
- package/dist-ts/components/StaticScroller/index.js.map +1 -0
- package/dist-ts/components/Switch/Switch.d.ts +10 -0
- package/dist-ts/components/Switch/Switch.js +9 -0
- package/dist-ts/components/Switch/Switch.js.map +1 -0
- package/dist-ts/components/Switch/Switch.module.scss +43 -0
- package/dist-ts/components/Switch/index.d.ts +1 -0
- package/dist-ts/components/Switch/index.js +2 -0
- package/dist-ts/components/Switch/index.js.map +1 -0
- package/dist-ts/components/Table/Table.d.ts +19 -0
- package/dist-ts/components/Table/Table.js +46 -0
- package/dist-ts/components/Table/Table.js.map +1 -0
- package/dist-ts/components/Table/Table.module.scss +76 -0
- package/dist-ts/components/Table/index.d.ts +1 -0
- package/dist-ts/components/Table/index.js +2 -0
- package/dist-ts/components/Table/index.js.map +1 -0
- package/dist-ts/components/Tabs/Tabs.d.ts +27 -0
- package/dist-ts/components/Tabs/Tabs.js +52 -0
- package/dist-ts/components/Tabs/Tabs.js.map +1 -0
- package/dist-ts/components/Tabs/Tabs.module.scss +40 -0
- package/dist-ts/components/Tabs/index.d.ts +1 -0
- package/dist-ts/components/Tabs/index.js +2 -0
- package/dist-ts/components/Tabs/index.js.map +1 -0
- package/dist-ts/components/Text/Text.d.ts +17 -0
- package/dist-ts/components/Text/Text.js +16 -0
- package/dist-ts/components/Text/Text.js.map +1 -0
- package/dist-ts/components/Text/Text.module.scss +81 -0
- package/dist-ts/components/Text/index.d.ts +1 -0
- package/dist-ts/components/Text/index.js +2 -0
- package/dist-ts/components/Text/index.js.map +1 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalReveal.d.ts +1 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalReveal.js +12 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalReveal.js.map +1 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalSquareToBalls.d.ts +5 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalSquareToBalls.js +30 -0
- package/dist-ts/components/Transition/MasksFactory/DiagonalSquareToBalls.js.map +1 -0
- package/dist-ts/components/Transition/MasksFactory/PhysicsSquares.d.ts +7 -0
- package/dist-ts/components/Transition/MasksFactory/PhysicsSquares.js +80 -0
- package/dist-ts/components/Transition/MasksFactory/PhysicsSquares.js.map +1 -0
- package/dist-ts/components/Transition/MasksFactory/SquareToBalls.d.ts +5 -0
- package/dist-ts/components/Transition/MasksFactory/SquareToBalls.js +22 -0
- package/dist-ts/components/Transition/MasksFactory/SquareToBalls.js.map +1 -0
- package/dist-ts/components/Transition/MasksFactory/utils.d.ts +8 -0
- package/dist-ts/components/Transition/MasksFactory/utils.js +27 -0
- package/dist-ts/components/Transition/MasksFactory/utils.js.map +1 -0
- package/dist-ts/components/Transition/Transition.d.ts +106 -0
- package/dist-ts/components/Transition/Transition.js +292 -0
- package/dist-ts/components/Transition/Transition.js.map +1 -0
- package/dist-ts/components/Transition/Transition.module.scss +211 -0
- package/dist-ts/components/Transition/index.d.ts +1 -0
- package/dist-ts/components/Transition/index.js +2 -0
- package/dist-ts/components/Transition/index.js.map +1 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.ai.md +9 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.d.ts +17 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.js +70 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.js.map +1 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.sample.d.ts +1 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.sample.js +18 -0
- package/dist-ts/components/UncontrolledTransition/UncontrolledTransition.sample.js.map +1 -0
- package/dist-ts/components/UncontrolledTransition/index.d.ts +2 -0
- package/dist-ts/components/UncontrolledTransition/index.js +3 -0
- package/dist-ts/components/UncontrolledTransition/index.js.map +1 -0
- package/dist-ts/components/WalletConnectionWrapper/WalletConnectionWrapper.d.ts +55 -0
- package/dist-ts/components/WalletConnectionWrapper/WalletConnectionWrapper.js +91 -0
- package/dist-ts/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +1 -0
- package/dist-ts/components/WalletConnectionWrapper/index.d.ts +1 -0
- package/dist-ts/components/WalletConnectionWrapper/index.js +2 -0
- package/dist-ts/components/WalletConnectionWrapper/index.js.map +1 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.d.ts +7 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +43 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js.map +1 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +5 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/index.d.ts +1 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/index.js +2 -0
- package/dist-ts/components/utilitary/ScrollAndFocusLock/index.js.map +1 -0
- package/dist-ts/context/AsyncProcess.d.ts +20 -0
- package/dist-ts/context/AsyncProcess.js +43 -0
- package/dist-ts/context/AsyncProcess.js.map +1 -0
- package/dist-ts/context/ContextAsyncControl.d.ts +24 -0
- package/dist-ts/context/ContextAsyncControl.js +50 -0
- package/dist-ts/context/ContextAsyncControl.js.map +1 -0
- package/dist-ts/context/CustomBrowserRouter.d.ts +13 -0
- package/dist-ts/context/CustomBrowserRouter.js +29 -0
- package/dist-ts/context/CustomBrowserRouter.js.map +1 -0
- package/dist-ts/context/OneUIProvider.d.ts +154 -0
- package/dist-ts/context/OneUIProvider.js +113 -0
- package/dist-ts/context/OneUIProvider.js.map +1 -0
- package/dist-ts/hooks/logs/useDependencyChangeDetection.d.ts +1 -0
- package/dist-ts/hooks/logs/useDependencyChangeDetection.js +16 -0
- package/dist-ts/hooks/logs/useDependencyChangeDetection.js.map +1 -0
- package/dist-ts/hooks/logs/useIsMounting.d.ts +1 -0
- package/dist-ts/hooks/logs/useIsMounting.js +7 -0
- package/dist-ts/hooks/logs/useIsMounting.js.map +1 -0
- package/dist-ts/hooks/persistence/useLocalStorage.d.ts +2 -0
- package/dist-ts/hooks/persistence/useLocalStorage.js +44 -0
- package/dist-ts/hooks/persistence/useLocalStorage.js.map +1 -0
- package/dist-ts/hooks/shims/ObjectWatchShim.d.ts +1 -0
- package/dist-ts/hooks/shims/ObjectWatchShim.js +52 -0
- package/dist-ts/hooks/shims/ObjectWatchShim.js.map +1 -0
- package/dist-ts/hooks/ui/useAdaptiveImage.d.ts +7 -0
- package/dist-ts/hooks/ui/useAdaptiveImage.js +36 -0
- package/dist-ts/hooks/ui/useAdaptiveImage.js.map +1 -0
- package/dist-ts/hooks/ui/useAlternating.d.ts +4 -0
- package/dist-ts/hooks/ui/useAlternating.js +21 -0
- package/dist-ts/hooks/ui/useAlternating.js.map +1 -0
- package/dist-ts/hooks/ui/useBreakpoint.d.ts +5 -0
- package/dist-ts/hooks/ui/useBreakpoint.js +19 -0
- package/dist-ts/hooks/ui/useBreakpoint.js.map +1 -0
- package/dist-ts/hooks/ui/useCustomScrollbar.d.ts +8 -0
- package/dist-ts/hooks/ui/useCustomScrollbar.js +17 -0
- package/dist-ts/hooks/ui/useCustomScrollbar.js.map +1 -0
- package/dist-ts/hooks/ui/useCustomScrollbar.module.scss +20 -0
- package/dist-ts/hooks/ui/useEffectIf.d.ts +2 -0
- package/dist-ts/hooks/ui/useEffectIf.js +9 -0
- package/dist-ts/hooks/ui/useEffectIf.js.map +1 -0
- package/dist-ts/hooks/ui/useMouseHover.d.ts +11 -0
- package/dist-ts/hooks/ui/useMouseHover.js +22 -0
- package/dist-ts/hooks/ui/useMouseHover.js.map +1 -0
- package/dist-ts/hooks/ui/usePaginationControls.d.ts +14 -0
- package/dist-ts/hooks/ui/usePaginationControls.js +122 -0
- package/dist-ts/hooks/ui/usePaginationControls.js.map +1 -0
- package/dist-ts/hooks/ui/usePaginationControls.module.scss +16 -0
- package/dist-ts/hooks/ui/useSnapToViewport.d.ts +5 -0
- package/dist-ts/hooks/ui/useSnapToViewport.js +19 -0
- package/dist-ts/hooks/ui/useSnapToViewport.js.map +1 -0
- package/dist-ts/hooks/ui/useSnapToViewport.module.scss +6 -0
- package/dist-ts/hooks/ui/useTilt.d.ts +46 -0
- package/dist-ts/hooks/ui/useTilt.js +131 -0
- package/dist-ts/hooks/ui/useTilt.js.map +1 -0
- package/dist-ts/hooks/ui/useZoomable.d.ts +6 -0
- package/dist-ts/hooks/ui/useZoomable.js +122 -0
- package/dist-ts/hooks/ui/useZoomable.js.map +1 -0
- package/dist-ts/hooks/ui/useZoomable.module.scss +34 -0
- package/dist-ts/hooks/useAsyncControl.ai.md +25 -0
- package/dist-ts/hooks/useAsyncControl.d.ts +32 -0
- package/dist-ts/hooks/useAsyncControl.js +67 -0
- package/dist-ts/hooks/useAsyncControl.js.map +1 -0
- package/dist-ts/hooks/useContainedRepositioning.d.ts +15 -0
- package/dist-ts/hooks/useContainedRepositioning.js +73 -0
- package/dist-ts/hooks/useContainedRepositioning.js.map +1 -0
- package/dist-ts/hooks/useCustomHistory.d.ts +14 -0
- package/dist-ts/hooks/useCustomHistory.js +15 -0
- package/dist-ts/hooks/useCustomHistory.js.map +1 -0
- package/dist-ts/hooks/useElementFit.d.ts +18 -0
- package/dist-ts/hooks/useElementFit.js +57 -0
- package/dist-ts/hooks/useElementFit.js.map +1 -0
- package/dist-ts/hooks/useFirestoreWatch.d.ts +12 -0
- package/dist-ts/hooks/useFirestoreWatch.js +42 -0
- package/dist-ts/hooks/useFirestoreWatch.js.map +1 -0
- package/dist-ts/hooks/useForm.d.ts +16 -0
- package/dist-ts/hooks/useForm.js +27 -0
- package/dist-ts/hooks/useForm.js.map +1 -0
- package/dist-ts/hooks/useFreeze.d.ts +5 -0
- package/dist-ts/hooks/useFreeze.js +12 -0
- package/dist-ts/hooks/useFreeze.js.map +1 -0
- package/dist-ts/hooks/useHero.d.ts +68 -0
- package/dist-ts/hooks/useHero.js +287 -0
- package/dist-ts/hooks/useHero.js.map +1 -0
- package/dist-ts/hooks/useHero.module.scss +41 -0
- package/dist-ts/hooks/useIntersection.d.ts +4 -0
- package/dist-ts/hooks/useIntersection.js +27 -0
- package/dist-ts/hooks/useIntersection.js.map +1 -0
- package/dist-ts/hooks/useMergeRefs.d.ts +9 -0
- package/dist-ts/hooks/useMergeRefs.js +26 -0
- package/dist-ts/hooks/useMergeRefs.js.map +1 -0
- package/dist-ts/hooks/useObserve.d.ts +2 -0
- package/dist-ts/hooks/useObserve.js +15 -0
- package/dist-ts/hooks/useObserve.js.map +1 -0
- package/dist-ts/hooks/usePagination.d.ts +52 -0
- package/dist-ts/hooks/usePagination.js +147 -0
- package/dist-ts/hooks/usePagination.js.map +1 -0
- package/dist-ts/hooks/usePooledOperation.d.ts +15 -0
- package/dist-ts/hooks/usePooledOperation.js +49 -0
- package/dist-ts/hooks/usePooledOperation.js.map +1 -0
- package/dist-ts/hooks/usePooling.d.ts +17 -0
- package/dist-ts/hooks/usePooling.js +38 -0
- package/dist-ts/hooks/usePooling.js.map +1 -0
- package/dist-ts/hooks/useRebound.d.ts +9 -0
- package/dist-ts/hooks/useRebound.js +21 -0
- package/dist-ts/hooks/useRebound.js.map +1 -0
- package/dist-ts/hooks/useShortIntl.ai.md +5 -0
- package/dist-ts/hooks/useShortIntl.d.ts +16 -0
- package/dist-ts/hooks/useShortIntl.js +62 -0
- package/dist-ts/hooks/useShortIntl.js.map +1 -0
- package/dist-ts/hooks/utility/useAsyncMemo.d.ts +13 -0
- package/dist-ts/hooks/utility/useAsyncMemo.js +31 -0
- package/dist-ts/hooks/utility/useAsyncMemo.js.map +1 -0
- package/dist-ts/hooks/utility/useDepChange.d.ts +1 -0
- package/dist-ts/hooks/utility/useDepChange.js +12 -0
- package/dist-ts/hooks/utility/useDepChange.js.map +1 -0
- package/dist-ts/hooks/utility/useEvents.d.ts +9 -0
- package/dist-ts/hooks/utility/useEvents.js +25 -0
- package/dist-ts/hooks/utility/useEvents.js.map +1 -0
- package/dist-ts/hooks/utility/useImmediate.d.ts +4 -0
- package/dist-ts/hooks/utility/useImmediate.js +8 -0
- package/dist-ts/hooks/utility/useImmediate.js.map +1 -0
- package/dist-ts/hooks/utility/useManualInit.d.ts +4 -0
- package/dist-ts/hooks/utility/useManualInit.js +17 -0
- package/dist-ts/hooks/utility/useManualInit.js.map +1 -0
- package/dist-ts/hooks/utility/useModule.d.ts +4 -0
- package/dist-ts/hooks/utility/useModule.js +12 -0
- package/dist-ts/hooks/utility/useModule.js.map +1 -0
- package/dist-ts/hooks/utility/useQuery.d.ts +7 -0
- package/dist-ts/hooks/utility/useQuery.js +11 -0
- package/dist-ts/hooks/utility/useQuery.js.map +1 -0
- package/dist-ts/hooks/utility/useUniqueEffect.d.ts +1 -0
- package/dist-ts/hooks/utility/useUniqueEffect.js +17 -0
- package/dist-ts/hooks/utility/useUniqueEffect.js.map +1 -0
- package/dist-ts/index.d.ts +3 -0
- package/dist-ts/index.js +4 -0
- package/dist-ts/index.js.map +1 -0
- package/dist-ts/models/DebugLogger.d.ts +1 -0
- package/dist-ts/models/DebugLogger.js +7 -0
- package/dist-ts/models/DebugLogger.js.map +1 -0
- package/dist-ts/models/GenericContract.d.ts +79 -0
- package/dist-ts/models/GenericContract.js +14 -0
- package/dist-ts/models/GenericContract.js.map +1 -0
- package/dist-ts/models/Orbs.d.ts +35 -0
- package/dist-ts/models/Orbs.js +61 -0
- package/dist-ts/models/Orbs.js.map +1 -0
- package/dist-ts/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/dist-ts/storybookUtils/index.d.ts +5 -0
- package/dist-ts/storybookUtils/index.js +33 -0
- package/dist-ts/storybookUtils/index.js.map +1 -0
- package/dist-ts/type-utils.d.ts +49 -0
- package/dist-ts/type-utils.js +2 -0
- package/dist-ts/type-utils.js.map +1 -0
- package/dist-ts/types.d.ts +79 -0
- package/dist-ts/types.js +2 -0
- package/dist-ts/types.js.map +1 -0
- package/dist-ts/utils/blockchain.d.ts +4 -0
- package/dist-ts/utils/blockchain.js +39 -0
- package/dist-ts/utils/blockchain.js.map +1 -0
- package/dist-ts/utils/e2e.d.ts +13 -0
- package/dist-ts/utils/e2e.js +25 -0
- package/dist-ts/utils/e2e.js.map +1 -0
- package/dist-ts/utils/flatten.d.ts +4 -0
- package/dist-ts/utils/flatten.js +11 -0
- package/dist-ts/utils/flatten.js.map +1 -0
- package/dist-ts/utils/formatters.d.ts +17 -0
- package/dist-ts/utils/formatters.js +33 -0
- package/dist-ts/utils/formatters.js.map +1 -0
- package/dist-ts/utils/html.utils.d.ts +1 -0
- package/dist-ts/utils/html.utils.js +4 -0
- package/dist-ts/utils/html.utils.js.map +1 -0
- package/dist-ts/utils/ownEvent.d.ts +4 -0
- package/dist-ts/utils/ownEvent.js +10 -0
- package/dist-ts/utils/ownEvent.js.map +1 -0
- package/dist-ts/utils/test.d.ts +5 -0
- package/dist-ts/utils/test.js +11 -0
- package/dist-ts/utils/test.js.map +1 -0
- package/package.json +5 -3
- package/src/utils/e2e.ts +1 -1
- package/tsconfig.prod.json +55 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { ComponentProps, FunctionComponent, RefObject } from "react";
|
|
2
|
+
import Input from "../Input";
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
import EmailInput from "../EmailInput";
|
|
5
|
+
export type BaseForm = {
|
|
6
|
+
[k: string]: string | number | any;
|
|
7
|
+
};
|
|
8
|
+
export type FormForm = {
|
|
9
|
+
[k: string]: string | number;
|
|
10
|
+
};
|
|
11
|
+
export type FieldTypes = "email" | "text" | "textarea" | "select" | "number";
|
|
12
|
+
export type FieldDefinition<M extends BaseForm, F extends keyof M, T extends FieldTypes> = {
|
|
13
|
+
validator: (v: M[F] | undefined, f: Partial<M>) => string | true;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
} & (T extends "select" ? {
|
|
16
|
+
type: "select";
|
|
17
|
+
choices: ComponentProps<typeof import("../Select")["default"]>["items"];
|
|
18
|
+
} : T extends "email" ? {
|
|
19
|
+
type: "email";
|
|
20
|
+
messages: ComponentProps<typeof EmailInput>["messages"];
|
|
21
|
+
} : T extends "textarea" ? {
|
|
22
|
+
type: "textarea";
|
|
23
|
+
lines: number;
|
|
24
|
+
} : {
|
|
25
|
+
type: "text" | "number";
|
|
26
|
+
inputProps?: ComponentProps<typeof Input>;
|
|
27
|
+
});
|
|
28
|
+
export type ClassName = string;
|
|
29
|
+
export type FormInterface = {
|
|
30
|
+
clear: () => void;
|
|
31
|
+
};
|
|
32
|
+
export type FirebaseFormProps<M extends FormForm> = {
|
|
33
|
+
ref?: RefObject<FormInterface>;
|
|
34
|
+
submitting: boolean;
|
|
35
|
+
onSubmit: (data: M) => void;
|
|
36
|
+
submited?: boolean;
|
|
37
|
+
config: {
|
|
38
|
+
[k in keyof M]: FieldDefinition<M, k, FieldTypes>;
|
|
39
|
+
};
|
|
40
|
+
submitBtn: string | {
|
|
41
|
+
label: [FunctionComponent] | [FunctionComponent, ClassName];
|
|
42
|
+
loading: [FunctionComponent] | [FunctionComponent, ClassName];
|
|
43
|
+
error: [FunctionComponent] | [FunctionComponent, ClassName];
|
|
44
|
+
success: [FunctionComponent] | [FunctionComponent, ClassName];
|
|
45
|
+
};
|
|
46
|
+
btnProps?: ComponentProps<typeof Button>;
|
|
47
|
+
};
|
|
48
|
+
declare const FirebaseForm: React.ForwardRefExoticComponent<Omit<FirebaseFormProps<BaseForm>, "ref"> & React.RefAttributes<FormInterface>>;
|
|
49
|
+
export default FirebaseForm;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { createElement as _createElement } from "react";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useImperativeHandle, useMemo, useState, } from "react";
|
|
4
|
+
import Input from "../Input";
|
|
5
|
+
import Button from "../Button";
|
|
6
|
+
import Loader from "../Loader";
|
|
7
|
+
import EmailInput from "../EmailInput";
|
|
8
|
+
import AdaptiveButton from "../AdaptiveButton";
|
|
9
|
+
function AdvancedAction({ config, submited, submitting, isValid, onClick, btnProps, }) {
|
|
10
|
+
const [key, Element, className] = submited === false
|
|
11
|
+
? ["error", ...config.error]
|
|
12
|
+
: submited === true
|
|
13
|
+
? ["success", ...config.success]
|
|
14
|
+
: submitting
|
|
15
|
+
? ["loading", ...config.loading]
|
|
16
|
+
: ["default", ...config.label];
|
|
17
|
+
const salt = useMemo(() => Date.now(), [key]);
|
|
18
|
+
return (_jsx(AdaptiveButton, { variant: "filled", className: className, disabled: !isValid, onClick: onClick, ...btnProps, children: _jsx(Element, {}, key + salt) }));
|
|
19
|
+
}
|
|
20
|
+
function _FirebaseForm({ submitting, onSubmit, submited, config, submitBtn, btnProps = {}, }, ref) {
|
|
21
|
+
const [form, setform] = useState({});
|
|
22
|
+
const isValid = useMemo(() => !Object.keys(config).some((a) => typeof config[a].validator(form[a], form) === "string"), [form]);
|
|
23
|
+
async function sendContact(_form) {
|
|
24
|
+
onSubmit(_form);
|
|
25
|
+
}
|
|
26
|
+
useImperativeHandle(ref, () => ({
|
|
27
|
+
clear: () => setform({}),
|
|
28
|
+
}), [ref]);
|
|
29
|
+
return (_jsxs(_Fragment, { children: [Object.keys(config).map((c) => {
|
|
30
|
+
const fieldConfig = config[c];
|
|
31
|
+
const invalidMessage = fieldConfig.validator(form[c], form);
|
|
32
|
+
switch (fieldConfig.type) {
|
|
33
|
+
case "select":
|
|
34
|
+
return null;
|
|
35
|
+
case "text":
|
|
36
|
+
case "number":
|
|
37
|
+
const isNumber = fieldConfig.type === "number";
|
|
38
|
+
return (_createElement(Input, { ...fieldConfig.inputProps, key: c, name: c, error: form[c] && invalidMessage !== true
|
|
39
|
+
? invalidMessage
|
|
40
|
+
: undefined, placeholder: config[c].placeholder, value: !isNumber ? form[c] || "" : undefined, hideError: "onfocus", onChange: ({ target: { value } }) => {
|
|
41
|
+
let _value = isNumber ? Number(value) : value;
|
|
42
|
+
if (isNumber && Number.isNaN(_value)) {
|
|
43
|
+
_value = undefined;
|
|
44
|
+
}
|
|
45
|
+
setform({
|
|
46
|
+
...form,
|
|
47
|
+
[c]: _value,
|
|
48
|
+
});
|
|
49
|
+
} }));
|
|
50
|
+
case "email":
|
|
51
|
+
return (_jsx(EmailInput, { ...fieldConfig, name: c, hideError: "onfocus", error: form[c] && invalidMessage !== true
|
|
52
|
+
? invalidMessage
|
|
53
|
+
: undefined, placeholder: config[c].placeholder, value: form[c] || "", onChange: (email) => setform({
|
|
54
|
+
...form,
|
|
55
|
+
[c]: email,
|
|
56
|
+
}) }, c));
|
|
57
|
+
case "textarea":
|
|
58
|
+
return (_jsx(Input, { name: c, hideError: "onfocus", error: form[c] && invalidMessage !== true
|
|
59
|
+
? invalidMessage
|
|
60
|
+
: undefined, placeholder: config[c].placeholder, value: form[c] || "", onChange: ({ target: { value } }) => setform({
|
|
61
|
+
...form,
|
|
62
|
+
[c]: value,
|
|
63
|
+
}), multiline: fieldConfig.lines }, c));
|
|
64
|
+
}
|
|
65
|
+
}), typeof submitBtn === "string" ? (_jsxs(Button, { variant: "filled", disabled: submitting || !isValid || submited !== undefined, onClick: () => sendContact(form), ...btnProps, children: [submitBtn, "\u00A0", submitting && _jsx(Loader, {})] })) : (_jsx(AdvancedAction, { config: submitBtn, isValid: isValid, onClick: () => sendContact(form), submitting: submitting, submited: submited, btnProps: btnProps }))] }));
|
|
66
|
+
}
|
|
67
|
+
const FirebaseForm = forwardRef(_FirebaseForm);
|
|
68
|
+
export default FirebaseForm;
|
|
69
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../src/components/Form/Form.tsx"],"names":[],"mappings":";;AAAA,OAAc,EAGZ,UAAU,EAGV,mBAAmB,EACnB,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,UAAU,CAAC;AAC7B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,MAAM,MAAM,WAAW,CAAC;AAC/B,OAAO,UAAU,MAAM,eAAe,CAAC;AACvC,OAAO,cAAc,MAAM,mBAAmB,CAAC;AAiC/C,SAAS,cAAc,CAAC,EACtB,MAAM,EACN,QAAQ,EACR,UAAU,EACV,OAAO,EACP,OAAO,EACP,QAAQ,GAMT;IACC,MAAM,CAAC,GAAG,EAAE,OAAO,EAAE,SAAS,CAAC,GAC7B,QAAQ,KAAK,KAAK;QAChB,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;QAC5B,CAAC,CAAC,QAAQ,KAAK,IA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,CAAC,CAAC,CAAC,CAC/B,MAAC,MAAM,IACL,OAAO,EAAC,QAAQ,EAChB,QAAQ,EAAE,UAAU,IAAI,CAAC,OAAO,IAAI,QAAQ,KAAK,SAAS,EAC1D,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAW,CAAC,KACnC,QAAQ,aAEX,SAAS,YACT,UAAU,IAAI,KAAC,MAAM,KAAG,IAClB,CACV,CAAC,CAAC,CAAC,CACF,KAAC,cAAc,IACb,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,IAAW,CAAC,EACvC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,IACA,CACJ,CAAC;AACJ,CAAC;AACD,MAAM,YAAY,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;AAC/C,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./Form";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/Form/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormViewProps } from "./Form.types";
|
|
3
|
+
import { AnswerByField, FormFieldView } from "./FormField/FormField.types";
|
|
4
|
+
export type FormRef<Q extends FormFieldView[]> = {
|
|
5
|
+
setAnswer<I extends Q[number]["id"]>(questionId: I, ans: AnswerByField<Q[number] & {
|
|
6
|
+
id: I;
|
|
7
|
+
}>): void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Brainstorm:
|
|
11
|
+
* The answers must be externalized in some way because those answers will be manipulated
|
|
12
|
+
* There must be a way to disable non validation related errors
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A new and improved version of the one-ui design form
|
|
16
|
+
**/
|
|
17
|
+
declare const _default: React.ForwardRefExoticComponent<FormViewProps<FormFieldView[]> & React.RefAttributes<FormRef<FormFieldView[]>>>;
|
|
18
|
+
export default _default;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { OneUIContextSpecs } from "../../../context/OneUIProvider";
|
|
3
|
+
import { AnswerAction, AnswerByField, FormField, FormFieldTypes, FormFieldView, FormMode } from "./FormField/FormField.types";
|
|
4
|
+
import { AnswersMap } from "./Form.types";
|
|
5
|
+
export declare function useFormAnswers<A extends AnswersMap<any> = AnswersMap>(defaultAnswers: A, mode: FormMode): {
|
|
6
|
+
answers: A;
|
|
7
|
+
setAnswers: import("react").Dispatch<import("react").SetStateAction<A>>;
|
|
8
|
+
};
|
|
9
|
+
export declare function useFormState(currentQuestions: FormFieldView[], { answers, setAnswers }: ReturnType<typeof useFormAnswers>): {
|
|
10
|
+
answers: Partial<{
|
|
11
|
+
[x: string]: any;
|
|
12
|
+
}>;
|
|
13
|
+
isQuestionsAnswered: boolean;
|
|
14
|
+
isFilesUploaded: boolean;
|
|
15
|
+
onAnswerAction: <T extends FormFieldTypes>(questionType: T, id: string, answer: AnswerAction<{
|
|
16
|
+
type: T;
|
|
17
|
+
}> | undefined) => void;
|
|
18
|
+
questions: FormFieldView[];
|
|
19
|
+
};
|
|
20
|
+
export declare function useForm(currentQuestions: FormFieldView[], defaultAnswers: AnswersMap, mode: FormMode): {
|
|
21
|
+
answers: Partial<{
|
|
22
|
+
[x: string]: any;
|
|
23
|
+
}>;
|
|
24
|
+
isQuestionsAnswered: boolean;
|
|
25
|
+
isFilesUploaded: boolean;
|
|
26
|
+
onAnswerAction: <T extends FormFieldTypes>(questionType: T, id: string, answer: AnswerAction<{
|
|
27
|
+
type: T;
|
|
28
|
+
}> | undefined) => void;
|
|
29
|
+
questions: FormFieldView[];
|
|
30
|
+
};
|
|
31
|
+
export declare function useFieldErrors<Q extends Readonly<Pick<FormField, "type" | "id" | "optional" | "validator">[]>>(currentQuestions: Q, answers: AnswersMap, showAllErrors: boolean): { [k in Q[number]["id"]]: string; };
|
|
32
|
+
export declare function areAllQuestionsAnswered(currentQuestions: FormField[], answers: AnswersMap, requiredLabel: string, extensions: OneUIContextSpecs["component"]["form"]["extensions"]): {
|
|
33
|
+
isValid: boolean;
|
|
34
|
+
};
|
|
35
|
+
export declare const isValidated: (_answer: AnswerByField<{
|
|
36
|
+
type: FormFieldTypes;
|
|
37
|
+
}>, isOptional: boolean, validator: ((val: any) => string | boolean) | undefined, requiredFieldLabel: string) => {
|
|
38
|
+
isValid: any;
|
|
39
|
+
error: any;
|
|
40
|
+
};
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { useLayoutEffect, useMemo, useState } from "react";
|
|
2
|
+
import { useOneUIConfig, } from "../../../context/OneUIProvider";
|
|
3
|
+
import { FormMode, } from "./FormField/FormField.types";
|
|
4
|
+
export function useFormAnswers(defaultAnswers, mode) {
|
|
5
|
+
const [answers, setAnswers] = useState(() => {
|
|
6
|
+
const clone = {
|
|
7
|
+
...defaultAnswers,
|
|
8
|
+
};
|
|
9
|
+
if (mode === FormMode.READ_ONLY)
|
|
10
|
+
return clone;
|
|
11
|
+
return clone;
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
answers,
|
|
15
|
+
setAnswers,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export function useFormState(currentQuestions, { answers, setAnswers }) {
|
|
19
|
+
const formConfig = useOneUIConfig("component.form");
|
|
20
|
+
const { isValid: isQuestionsAnswered } = useMemo(() => {
|
|
21
|
+
return areAllQuestionsAnswered(currentQuestions, answers, formConfig.requiredLabel, formConfig.extensions);
|
|
22
|
+
}, [answers, currentQuestions]);
|
|
23
|
+
const onAnswerAction = (questionType, id, answer) => {
|
|
24
|
+
switch (questionType) {
|
|
25
|
+
case "file":
|
|
26
|
+
const { onFileUpload } = formConfig;
|
|
27
|
+
setAnswers((prev) => {
|
|
28
|
+
const file = answer;
|
|
29
|
+
if (file)
|
|
30
|
+
return {
|
|
31
|
+
...prev,
|
|
32
|
+
[id]: onFileUpload(id, file),
|
|
33
|
+
};
|
|
34
|
+
delete prev[id];
|
|
35
|
+
return { ...prev };
|
|
36
|
+
});
|
|
37
|
+
break;
|
|
38
|
+
default:
|
|
39
|
+
setAnswers((prev) => ({
|
|
40
|
+
...prev,
|
|
41
|
+
[id]: answer,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const isFilesUploaded = useFileUploads(currentQuestions, answers);
|
|
46
|
+
return {
|
|
47
|
+
answers,
|
|
48
|
+
isQuestionsAnswered,
|
|
49
|
+
isFilesUploaded,
|
|
50
|
+
onAnswerAction,
|
|
51
|
+
questions: currentQuestions,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export function useForm(currentQuestions, defaultAnswers, mode) {
|
|
55
|
+
const answers = useFormAnswers(defaultAnswers, mode);
|
|
56
|
+
return useFormState(currentQuestions, answers);
|
|
57
|
+
}
|
|
58
|
+
function useFileUploads(questions, answers) {
|
|
59
|
+
const fileUploadQuestions = useMemo(() => questions.filter((a) => a.type === "file"), [questions]);
|
|
60
|
+
const [fileUploadStatus, setFileUploadStatus] = useState({});
|
|
61
|
+
useLayoutEffect(() => {
|
|
62
|
+
const unsubs = [];
|
|
63
|
+
for (let fileQuestion of fileUploadQuestions) {
|
|
64
|
+
const uploadTask = answers[fileQuestion.id];
|
|
65
|
+
if (!uploadTask)
|
|
66
|
+
setFileUploadStatus((prev) => ({
|
|
67
|
+
...prev,
|
|
68
|
+
[fileQuestion.id]: "running",
|
|
69
|
+
}));
|
|
70
|
+
else if (typeof uploadTask === "boolean") {
|
|
71
|
+
setFileUploadStatus((prev) => ({
|
|
72
|
+
...prev,
|
|
73
|
+
[fileQuestion.id]: "success",
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
else
|
|
77
|
+
unsubs.push(uploadTask.on("state_changed", (r) => {
|
|
78
|
+
setFileUploadStatus((prev) => ({
|
|
79
|
+
...prev,
|
|
80
|
+
[fileQuestion.id]: r.totalBytes === r.bytesTransferred ? "success" : "running",
|
|
81
|
+
}));
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
return () => {
|
|
85
|
+
unsubs.forEach((unsub) => unsub());
|
|
86
|
+
};
|
|
87
|
+
}, [answers, fileUploadQuestions]);
|
|
88
|
+
const areAllFileUploaded = useMemo(() => {
|
|
89
|
+
return fileUploadQuestions.reduce((r, question) => {
|
|
90
|
+
const uploadStatus = fileUploadStatus[question.id];
|
|
91
|
+
return r && uploadStatus === "success";
|
|
92
|
+
}, true);
|
|
93
|
+
}, [fileUploadStatus, fileUploadQuestions]);
|
|
94
|
+
return areAllFileUploaded;
|
|
95
|
+
}
|
|
96
|
+
export function useFieldErrors(currentQuestions, answers, showAllErrors) {
|
|
97
|
+
const { requiredLabel, extensions } = useOneUIConfig("component.form");
|
|
98
|
+
const errorMap = useMemo(() => {
|
|
99
|
+
const ans = (question) => answers[question.id];
|
|
100
|
+
const errorsMap = {};
|
|
101
|
+
for (let question of currentQuestions) {
|
|
102
|
+
const _isValidated = () => {
|
|
103
|
+
return isValidated(ans(question), !!question.optional, question.validator, requiredLabel);
|
|
104
|
+
};
|
|
105
|
+
const updateDefaultError = () => {
|
|
106
|
+
const validation = _isValidated();
|
|
107
|
+
errorsMap[question.id] = validation.error;
|
|
108
|
+
};
|
|
109
|
+
switch (question.type) {
|
|
110
|
+
case "check":
|
|
111
|
+
case "rawcheck":
|
|
112
|
+
updateDefaultError();
|
|
113
|
+
if (question.validator)
|
|
114
|
+
errorsMap[question.id] = question.validator(ans(question));
|
|
115
|
+
break;
|
|
116
|
+
case "number":
|
|
117
|
+
case "text":
|
|
118
|
+
case "select":
|
|
119
|
+
case "radio":
|
|
120
|
+
case "file":
|
|
121
|
+
updateDefaultError();
|
|
122
|
+
const validationResult = _isValidated();
|
|
123
|
+
if (validationResult.error)
|
|
124
|
+
errorsMap[question.id] = validationResult.error;
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
const extendedSupport = extensions?.[question.type];
|
|
128
|
+
if (extendedSupport) {
|
|
129
|
+
const validationResultExtend = extendedSupport.validator(ans(question), question);
|
|
130
|
+
if (validationResultExtend.error)
|
|
131
|
+
errorsMap[question.id] = validationResultExtend.error;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
updateDefaultError();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return errorsMap;
|
|
139
|
+
}, [currentQuestions, answers]);
|
|
140
|
+
const currentErrors = useMemo(() => {
|
|
141
|
+
return Object.entries(errorMap).reduce((r, [k, v]) => ({
|
|
142
|
+
...r,
|
|
143
|
+
[k]: showAllErrors ? v : v !== requiredLabel ? v : undefined,
|
|
144
|
+
}), {});
|
|
145
|
+
}, [showAllErrors, errorMap]);
|
|
146
|
+
return currentErrors;
|
|
147
|
+
}
|
|
148
|
+
export function areAllQuestionsAnswered(currentQuestions, answers, requiredLabel, extensions) {
|
|
149
|
+
const isValid = currentQuestions.reduce((answeredAll, question) => {
|
|
150
|
+
const ans = (question) => answers[question.id];
|
|
151
|
+
const result = answeredAll &&
|
|
152
|
+
(() => {
|
|
153
|
+
switch (question.type) {
|
|
154
|
+
case "accept":
|
|
155
|
+
const checks = ans(question) || [];
|
|
156
|
+
return question.accept.reduce((r, { optional }, idx) => r && (optional ? true : checks[idx]), true);
|
|
157
|
+
case "check":
|
|
158
|
+
case "rawcheck":
|
|
159
|
+
if (question.optional)
|
|
160
|
+
return true;
|
|
161
|
+
if (question.validator)
|
|
162
|
+
return question.validator(ans(question));
|
|
163
|
+
const checkmarks = ans(question) || [];
|
|
164
|
+
return checkmarks.includes(true);
|
|
165
|
+
case "number":
|
|
166
|
+
case "text":
|
|
167
|
+
case "select":
|
|
168
|
+
case "radio":
|
|
169
|
+
case "file":
|
|
170
|
+
if (!answers[question.id])
|
|
171
|
+
return !!question.optional;
|
|
172
|
+
const validationResult = isValidated(ans(question), !!question.optional, question.validator, requiredLabel);
|
|
173
|
+
return validationResult.isValid && answeredAll;
|
|
174
|
+
default:
|
|
175
|
+
const extendedSupport = extensions?.[question.type];
|
|
176
|
+
if (extendedSupport) {
|
|
177
|
+
const validationResultExtend = extendedSupport.validator(ans(question), question);
|
|
178
|
+
return validationResultExtend.isValid;
|
|
179
|
+
}
|
|
180
|
+
else
|
|
181
|
+
return question.validator
|
|
182
|
+
? !!question.validator(ans(question))
|
|
183
|
+
: !!ans(question);
|
|
184
|
+
}
|
|
185
|
+
})();
|
|
186
|
+
return result;
|
|
187
|
+
}, true);
|
|
188
|
+
return { isValid: !!isValid };
|
|
189
|
+
}
|
|
190
|
+
export const isValidated = (_answer, isOptional, validator, requiredFieldLabel) => {
|
|
191
|
+
const answer = Array.isArray(_answer) ? _answer[0] : _answer;
|
|
192
|
+
if (!answer && !isOptional)
|
|
193
|
+
return {
|
|
194
|
+
isValid: false,
|
|
195
|
+
error: requiredFieldLabel,
|
|
196
|
+
};
|
|
197
|
+
if (!validator)
|
|
198
|
+
if (Array.isArray(_answer)) {
|
|
199
|
+
const [_, isValid, error] = _answer;
|
|
200
|
+
return {
|
|
201
|
+
isValid,
|
|
202
|
+
error,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
return {
|
|
207
|
+
isValid: true,
|
|
208
|
+
error: "",
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
const validationResult = validator(answer);
|
|
212
|
+
if (typeof validationResult === "string")
|
|
213
|
+
return {
|
|
214
|
+
isValid: false,
|
|
215
|
+
error: validationResult,
|
|
216
|
+
};
|
|
217
|
+
return {
|
|
218
|
+
isValid: validationResult,
|
|
219
|
+
error: "",
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
//# sourceMappingURL=Form.hook.js.map
|
|
@@ -0,0 +1 @@
|
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SAAS;QACZ,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC;YACpC,OAAO;gBACL,OAAO;gBACP,KAAK;aACN,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,KAAK,EAAE,EAAE;aACV,CAAC;QACJ,CAAC;IACH,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,OAAO,gBAAgB,KAAK,QAAQ;QACtC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,KAAK,EAAE,gBAAgB;SACxB,CAAC;IACJ,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,KAAK,EAAE,EAAE;KACV,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useEffect, useImperativeHandle, } from "react";
|
|
3
|
+
import { FormMode } from "./Form.types";
|
|
4
|
+
import { useFieldErrors, useForm } from "./Form.hook";
|
|
5
|
+
import FormField from "./FormField";
|
|
6
|
+
function Form({ questions, initialAnswers = {}, ...props }, ref) {
|
|
7
|
+
const { mode = FormMode.WRITE } = props;
|
|
8
|
+
const { showAllErrors = false } = props;
|
|
9
|
+
const { answers, onAnswerAction, isQuestionsAnswered, isFilesUploaded } = useForm(questions, initialAnswers, mode);
|
|
10
|
+
const errors = useFieldErrors(questions, answers, showAllErrors);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (props.mode !== FormMode.READ_ONLY)
|
|
13
|
+
props.onFormUpdate(answers, isQuestionsAnswered && isFilesUploaded);
|
|
14
|
+
}, [answers, isQuestionsAnswered, isFilesUploaded]);
|
|
15
|
+
useImperativeHandle(ref, () => ({
|
|
16
|
+
setAnswer(id, val) {
|
|
17
|
+
onAnswerAction(questions.find((q) => q.id === id).type, id, val);
|
|
18
|
+
},
|
|
19
|
+
}), []);
|
|
20
|
+
return (_jsx(_Fragment, { children: questions.map((q) => (_jsx(FormField, { config: q, onAnswer: onAnswerAction, value: answers[q.id], error: errors[q.id], mode: mode }, q.id))) }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Brainstorm:
|
|
24
|
+
* The answers must be externalized in some way because those answers will be manipulated
|
|
25
|
+
* There must be a way to disable non validation related errors
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* A new and improved version of the one-ui design form
|
|
29
|
+
**/
|
|
30
|
+
export default forwardRef(Form);
|
|
31
|
+
//# sourceMappingURL=Form.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.js","sourceRoot":"","sources":["../../../../src/components/Form/v2/Form.tsx"],"names":[],"mappings":";AAAA,OAAc,EAEZ,UAAU,EACV,SAAS,EACT,mBAAmB,GACpB,MAAM,OAAO,CAAC;AACf,OAAO,EAAgB,QAAQ,EAAiB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,SAAS,MAAM,aAAa,CAAC;AAUpC,SAAS,IAAI,CACX,EAAE,SAAS,EAAE,cAAc,GAAG,EAAE,EAAE,GAAG,KAAK,EAAoB,EAC9D,GAA6B;IAE7B,MAAM,EAAE,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,KAAK,CAAC;IACxC,MAAM,EAAE,aAAa,GAAG,KAAK,EAAE,GAAG,KAEjC,CAAC;IACF,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,GACrE,OAAO,CAAC,SAAS,EAAE,cAAc,EAAE,IAAI,CAAC,CAAC;IAC3C,MAAM,MAAM,GAAG,cAAc,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;IAEjE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,SAAS;YACnC,KAAK,CAAC,YAAY,CAChB,OAAc,EACd,mBAAmB,IAAI,eAAe,CACvC,CAAC;IACN,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,EAAE,eAAe,CAAC,CAAC,CAAC;IAEpD,mBAAmB,CACjB,GAAG,EACH,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,CAAC,EAAE,EAAE,GAAG;YACf,cAAc,CACZ,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAE,CAAC,IAAI,EACxC,EAAE,EACF,GAAU,CACX,CAAC;QACJ,CAAC;KACF,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO,CACL,4BACG,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CACpB,KAAC,SAAS,IAER,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,CAAQ,EAC3B,KAAK,EAAG,MAAc,CAAC,CAAC,CAAC,EAAE,CAAC,EAC5B,IAAI,EAAE,IAAI,IALL,CAAC,CAAC,EAAE,CAMT,CACH,CAAC,GACD,CACJ,CAAC;AACJ,CAAC;AAED;;;;GAIG;AAEH;;IAEI;AACJ,eAAe,UAAU,CAAC,IAAI,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { AnswerByField, FormField } from "./FormField/FormField.types";
|
|
2
|
+
export type BaseQuestion = {
|
|
3
|
+
id: string;
|
|
4
|
+
type: FormField["type"];
|
|
5
|
+
};
|
|
6
|
+
export type FormState<Q extends BaseQuestion[] = []> = [
|
|
7
|
+
answers: AnswersMap<Q>,
|
|
8
|
+
isValid: boolean
|
|
9
|
+
];
|
|
10
|
+
export declare enum DataStatus {
|
|
11
|
+
/** Form is empty */
|
|
12
|
+
PENDING = 0,
|
|
13
|
+
/** Form is partially filled */
|
|
14
|
+
INCOMPLETE = 1,
|
|
15
|
+
/** Form is completed */
|
|
16
|
+
COMPLETE = 2,
|
|
17
|
+
/** Form has error */
|
|
18
|
+
ERROR = 3
|
|
19
|
+
}
|
|
20
|
+
export declare enum StepStatus {
|
|
21
|
+
/** When the data is empty and needs to be filled */
|
|
22
|
+
INCOMPLETE = 0,
|
|
23
|
+
/** When data has already been filled */
|
|
24
|
+
COMPLETED = 1,
|
|
25
|
+
/** When the step is the current selected */
|
|
26
|
+
CURRENT = 2,
|
|
27
|
+
/** When the step has error */
|
|
28
|
+
ERROR = 3
|
|
29
|
+
}
|
|
30
|
+
export declare enum FormStep {
|
|
31
|
+
PERSONAL_DATA = 0,
|
|
32
|
+
ADDITIONAL_DATA = 1,
|
|
33
|
+
DOCUMENTS = 2,
|
|
34
|
+
INVEST_PROFILE = 3,
|
|
35
|
+
CONTRACTS = 4
|
|
36
|
+
}
|
|
37
|
+
export declare enum FormMode {
|
|
38
|
+
READ_ONLY = 0,
|
|
39
|
+
WRITE = 1
|
|
40
|
+
}
|
|
41
|
+
export type FormFieldView = FormField & {
|
|
42
|
+
title: string;
|
|
43
|
+
};
|
|
44
|
+
export type FormProps = {
|
|
45
|
+
onFormSubmitted: () => void;
|
|
46
|
+
savedAnswers: Partial<{
|
|
47
|
+
[questionId: string]: AnswerByField<FormField>;
|
|
48
|
+
}>;
|
|
49
|
+
startAt: FormStep;
|
|
50
|
+
onGoBack: () => void;
|
|
51
|
+
};
|
|
52
|
+
export type StepFormProps = Pick<FormProps, "savedAnswers"> & {
|
|
53
|
+
step: FormStep;
|
|
54
|
+
} & ModeProps;
|
|
55
|
+
export type ModeProps = {
|
|
56
|
+
mode: FormMode.READ_ONLY;
|
|
57
|
+
} | {
|
|
58
|
+
mode: FormMode.WRITE;
|
|
59
|
+
onFinish: () => void;
|
|
60
|
+
onCancel: () => void;
|
|
61
|
+
};
|
|
62
|
+
export type FormViewProps<Q extends BaseQuestion[]> = {
|
|
63
|
+
questions: Q;
|
|
64
|
+
} & ({
|
|
65
|
+
mode?: FormMode.WRITE;
|
|
66
|
+
initialAnswers?: AnswersMap;
|
|
67
|
+
onFormUpdate: (...args: FormState<Q>) => void;
|
|
68
|
+
/** When provided (true) show all current errors that are blocking the completion of the form */
|
|
69
|
+
showAllErrors?: boolean;
|
|
70
|
+
} | {
|
|
71
|
+
initialAnswers: AnswersMap;
|
|
72
|
+
mode: FormMode.READ_ONLY;
|
|
73
|
+
});
|
|
74
|
+
export type AnswersMap<Q extends Readonly<BaseQuestion[]> = [
|
|
75
|
+
{
|
|
76
|
+
type: BaseQuestion["type"];
|
|
77
|
+
id: string;
|
|
78
|
+
}
|
|
79
|
+
]> = Partial<{
|
|
80
|
+
[questionId in Q[number]["id"]]: AnswerByField<Q[number] & {
|
|
81
|
+
id: questionId;
|
|
82
|
+
}>;
|
|
83
|
+
}>;
|
|
84
|
+
export declare enum INVESTOR_PROFILE {
|
|
85
|
+
/**
|
|
86
|
+
* User can only spend up to 20k
|
|
87
|
+
*/
|
|
88
|
+
RESTRICTED = 0,
|
|
89
|
+
/**
|
|
90
|
+
* User can only spend up to 10% of it's income
|
|
91
|
+
*/
|
|
92
|
+
LIMITED = 1,
|
|
93
|
+
/**
|
|
94
|
+
* User doesn't have restrictions
|
|
95
|
+
*/
|
|
96
|
+
UNLIMITED = 2
|
|
97
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export var DataStatus;
|
|
2
|
+
(function (DataStatus) {
|
|
3
|
+
/** Form is empty */
|
|
4
|
+
DataStatus[DataStatus["PENDING"] = 0] = "PENDING";
|
|
5
|
+
/** Form is partially filled */
|
|
6
|
+
DataStatus[DataStatus["INCOMPLETE"] = 1] = "INCOMPLETE";
|
|
7
|
+
/** Form is completed */
|
|
8
|
+
DataStatus[DataStatus["COMPLETE"] = 2] = "COMPLETE";
|
|
9
|
+
/** Form has error */
|
|
10
|
+
DataStatus[DataStatus["ERROR"] = 3] = "ERROR";
|
|
11
|
+
})(DataStatus || (DataStatus = {}));
|
|
12
|
+
export var StepStatus;
|
|
13
|
+
(function (StepStatus) {
|
|
14
|
+
/** When the data is empty and needs to be filled */
|
|
15
|
+
StepStatus[StepStatus["INCOMPLETE"] = 0] = "INCOMPLETE";
|
|
16
|
+
/** When data has already been filled */
|
|
17
|
+
StepStatus[StepStatus["COMPLETED"] = 1] = "COMPLETED";
|
|
18
|
+
/** When the step is the current selected */
|
|
19
|
+
StepStatus[StepStatus["CURRENT"] = 2] = "CURRENT";
|
|
20
|
+
/** When the step has error */
|
|
21
|
+
StepStatus[StepStatus["ERROR"] = 3] = "ERROR";
|
|
22
|
+
})(StepStatus || (StepStatus = {}));
|
|
23
|
+
export var FormStep;
|
|
24
|
+
(function (FormStep) {
|
|
25
|
+
FormStep[FormStep["PERSONAL_DATA"] = 0] = "PERSONAL_DATA";
|
|
26
|
+
FormStep[FormStep["ADDITIONAL_DATA"] = 1] = "ADDITIONAL_DATA";
|
|
27
|
+
FormStep[FormStep["DOCUMENTS"] = 2] = "DOCUMENTS";
|
|
28
|
+
FormStep[FormStep["INVEST_PROFILE"] = 3] = "INVEST_PROFILE";
|
|
29
|
+
FormStep[FormStep["CONTRACTS"] = 4] = "CONTRACTS";
|
|
30
|
+
})(FormStep || (FormStep = {}));
|
|
31
|
+
export var FormMode;
|
|
32
|
+
(function (FormMode) {
|
|
33
|
+
FormMode[FormMode["READ_ONLY"] = 0] = "READ_ONLY";
|
|
34
|
+
FormMode[FormMode["WRITE"] = 1] = "WRITE";
|
|
35
|
+
})(FormMode || (FormMode = {}));
|
|
36
|
+
export var INVESTOR_PROFILE;
|
|
37
|
+
(function (INVESTOR_PROFILE) {
|
|
38
|
+
/**
|
|
39
|
+
* User can only spend up to 20k
|
|
40
|
+
*/
|
|
41
|
+
INVESTOR_PROFILE[INVESTOR_PROFILE["RESTRICTED"] = 0] = "RESTRICTED";
|
|
42
|
+
/**
|
|
43
|
+
* User can only spend up to 10% of it's income
|
|
44
|
+
*/
|
|
45
|
+
INVESTOR_PROFILE[INVESTOR_PROFILE["LIMITED"] = 1] = "LIMITED";
|
|
46
|
+
/**
|
|
47
|
+
* User doesn't have restrictions
|
|
48
|
+
*/
|
|
49
|
+
INVESTOR_PROFILE[INVESTOR_PROFILE["UNLIMITED"] = 2] = "UNLIMITED";
|
|
50
|
+
})(INVESTOR_PROFILE || (INVESTOR_PROFILE = {}));
|
|
51
|
+
//# sourceMappingURL=Form.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.types.js","sourceRoot":"","sources":["../../../../src/components/Form/v2/Form.types.ts"],"names":[],"mappings":"AAgBA,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,oBAAoB;IACpB,iDAAO,CAAA;IACP,+BAA+B;IAC/B,uDAAU,CAAA;IACV,wBAAwB;IACxB,mDAAQ,CAAA;IACR,qBAAqB;IACrB,6CAAK,CAAA;AACP,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAED,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,oDAAoD;IACpD,uDAAU,CAAA;IACV,wCAAwC;IACxC,qDAAS,CAAA;IACT,4CAA4C;IAC5C,iDAAO,CAAA;IACP,8BAA8B;IAC9B,6CAAK,CAAA;AACP,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAED,MAAM,CAAN,IAAY,QAMX;AAND,WAAY,QAAQ;IAClB,yDAAa,CAAA;IACb,6DAAe,CAAA;IACf,iDAAS,CAAA;IACT,2DAAc,CAAA;IACd,iDAAS,CAAA;AACX,CAAC,EANW,QAAQ,KAAR,QAAQ,QAMnB;AAED,MAAM,CAAN,IAAY,QAGX;AAHD,WAAY,QAAQ;IAClB,iDAAS,CAAA;IACT,yCAAK,CAAA;AACP,CAAC,EAHW,QAAQ,KAAR,QAAQ,QAGnB;AAuDD,MAAM,CAAN,IAAY,gBAaX;AAbD,WAAY,gBAAgB;IAC1B;;OAEG;IACH,mEAAU,CAAA;IACV;;OAEG;IACH,6DAAO,CAAA;IACP;;OAEG;IACH,iEAAS,CAAA;AACX,CAAC,EAbW,gBAAgB,KAAhB,gBAAgB,QAa3B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AnswerByField, GenericFormFieldProps } from "../../FormField.types";
|
|
2
|
+
/**
|
|
3
|
+
* Allows inputing a date
|
|
4
|
+
**/
|
|
5
|
+
export default function dateFieldFactory(dateFormat: string): ({ onAnswer, question, value, error, }: GenericFormFieldProps<"date">) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const dateFieldValidatorFactory: (invalidDateLabel: string, requiredFieldLabel: string) => (answer: AnswerByField<{
|
|
7
|
+
type: "date";
|
|
8
|
+
}>) => {
|
|
9
|
+
isValid: any;
|
|
10
|
+
error: any;
|
|
11
|
+
};
|