@helpdice/ui 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-complete/auto-complete-context.d.ts +10 -0
- package/dist/auto-complete/auto-complete-dropdown.d.ts +12 -0
- package/dist/auto-complete/auto-complete-empty.d.ts +8 -0
- package/dist/auto-complete/auto-complete-item.d.ts +8 -0
- package/dist/auto-complete/auto-complete-searching.d.ts +38 -0
- package/dist/auto-complete/auto-complete.d.ts +32 -0
- package/dist/auto-complete/index.d.ts +13 -0
- package/dist/auto-complete/index.js +2334 -0
- package/dist/avatar/avatar-group.d.ts +43 -0
- package/dist/avatar/avatar.d.ts +43 -0
- package/dist/avatar/index.d.ts +9 -0
- package/dist/avatar/index.js +1192 -0
- package/dist/badge/badge-anchor.d.ts +11 -0
- package/dist/badge/badge.d.ts +46 -0
- package/dist/badge/index.d.ts +9 -0
- package/dist/badge/index.js +1290 -0
- package/dist/breadcrumbs/breadcrumbs-item.d.ts +15 -0
- package/dist/breadcrumbs/breadcrumbs-separator.d.ts +42 -0
- package/dist/breadcrumbs/breadcrumbs.d.ts +43 -0
- package/dist/breadcrumbs/index.d.ts +12 -0
- package/dist/breadcrumbs/index.js +1366 -0
- package/dist/button/button-icon.d.ts +10 -0
- package/dist/button/button-loading.d.ts +6 -0
- package/dist/button/button.d.ts +55 -0
- package/dist/button/button.drip.d.ts +10 -0
- package/dist/button/index.d.ts +4 -0
- package/dist/button/index.js +1679 -0
- package/dist/button/styles.d.ts +18 -0
- package/dist/button/utils.d.ts +8 -0
- package/dist/button-dropdown/button-dropdown-context.d.ts +10 -0
- package/dist/button-dropdown/button-dropdown-item.d.ts +13 -0
- package/dist/button-dropdown/button-dropdown.d.ts +49 -0
- package/dist/button-dropdown/icon.d.ts +7 -0
- package/dist/button-dropdown/index.d.ts +9 -0
- package/dist/button-dropdown/index.js +1474 -0
- package/dist/button-dropdown/styles.d.ts +11 -0
- package/dist/button-group/button-group-context.d.ts +10 -0
- package/dist/button-group/button-group.d.ts +47 -0
- package/dist/button-group/index.d.ts +4 -0
- package/dist/button-group/index.js +1183 -0
- package/dist/capacity/capacity.d.ts +43 -0
- package/dist/capacity/index.d.ts +3 -0
- package/dist/capacity/index.js +1186 -0
- package/dist/card/card-content.d.ts +42 -0
- package/dist/card/card-footer.d.ts +43 -0
- package/dist/card/card.d.ts +46 -0
- package/dist/card/index.d.ts +15 -0
- package/dist/card/index.js +1637 -0
- package/dist/card/styles.d.ts +8 -0
- package/dist/cart/index.d.ts +72 -0
- package/dist/cart/useLocalStorage.d.ts +1 -0
- package/dist/checkbox/checkbox-context.d.ts +9 -0
- package/dist/checkbox/checkbox-group.d.ts +45 -0
- package/dist/checkbox/checkbox.d.ts +57 -0
- package/dist/checkbox/checkbox.icon.d.ts +9 -0
- package/dist/checkbox/index.d.ts +9 -0
- package/dist/checkbox/index.js +1410 -0
- package/dist/checkbox/styles.d.ts +7 -0
- package/dist/code/code.d.ts +45 -0
- package/dist/code/index.d.ts +3 -0
- package/dist/code/index.js +1205 -0
- package/dist/code-block/index.d.ts +10 -0
- package/dist/col/index.js +567 -0
- package/dist/collapse/collapse-context.d.ts +7 -0
- package/dist/collapse/collapse-group.d.ts +43 -0
- package/dist/collapse/collapse-icon.d.ts +6 -0
- package/dist/collapse/collapse.d.ts +47 -0
- package/dist/collapse/index.d.ts +9 -0
- package/dist/collapse/index.js +1513 -0
- package/dist/css-baseline/css-baseline.d.ts +11 -0
- package/dist/css-baseline/index.d.ts +1 -0
- package/dist/css-baseline/index.js +839 -0
- package/dist/description/description.d.ts +42 -0
- package/dist/description/index.d.ts +3 -0
- package/dist/description/index.js +1149 -0
- package/dist/display/display.d.ts +44 -0
- package/dist/display/index.d.ts +3 -0
- package/dist/display/index.js +1153 -0
- package/dist/divider/divider.d.ts +46 -0
- package/dist/divider/index.d.ts +4 -0
- package/dist/divider/index.js +1172 -0
- package/dist/dot/dot.d.ts +45 -0
- package/dist/dot/index.d.ts +3 -0
- package/dist/dot/index.js +1159 -0
- package/dist/drawer/drawer-wrapper.d.ts +10 -0
- package/dist/drawer/drawer.d.ts +15 -0
- package/dist/drawer/helper.d.ts +9 -0
- package/dist/drawer/index.d.ts +13 -0
- package/dist/drawer/index.js +1839 -0
- package/dist/fieldset/fieldset-content.d.ts +42 -0
- package/dist/fieldset/fieldset-context.d.ts +12 -0
- package/dist/fieldset/fieldset-footer.d.ts +42 -0
- package/dist/fieldset/fieldset-group.d.ts +44 -0
- package/dist/fieldset/fieldset-subtitle.d.ts +8 -0
- package/dist/fieldset/fieldset-title.d.ts +8 -0
- package/dist/fieldset/fieldset.d.ts +46 -0
- package/dist/fieldset/index.d.ts +22 -0
- package/dist/fieldset/index.js +1444 -0
- package/dist/form/ErrorMessage.d.ts +17 -0
- package/dist/form/Field.d.ts +53 -0
- package/dist/form/FormWrapper.d.ts +62 -0
- package/dist/form/FormikContext.d.ts +6 -0
- package/dist/form/connect.d.ts +12 -0
- package/dist/form/constants.d.ts +1 -0
- package/dist/form/index.d.ts +9 -0
- package/dist/form/types.d.ts +249 -0
- package/dist/form/utils.d.ts +68 -0
- package/dist/form/withFormik.d.ts +68 -0
- package/dist/grid/basic-item.d.ts +19 -0
- package/dist/grid/grid-container.d.ts +299 -0
- package/dist/grid/grid-types.d.ts +11 -0
- package/dist/grid/grid.d.ts +296 -0
- package/dist/grid/index.d.ts +11 -0
- package/dist/grid/index.js +1262 -0
- package/dist/image/helpers.d.ts +2 -0
- package/dist/image/image-browser-https-icon.d.ts +3 -0
- package/dist/image/image-browser.d.ts +47 -0
- package/dist/image/image.d.ts +43 -0
- package/dist/image/image.skeleton.d.ts +7 -0
- package/dist/image/index.d.ts +9 -0
- package/dist/image/index.js +1470 -0
- package/dist/image/styles.d.ts +9 -0
- package/dist/index.d.ts +130 -0
- package/dist/index.js +34412 -0
- package/dist/input/index.d.ts +13 -0
- package/dist/input/index.js +1629 -0
- package/dist/input/input-block-label.d.ts +5 -0
- package/dist/input/input-icon-clear.d.ts +8 -0
- package/dist/input/input-icon.d.ts +8 -0
- package/dist/input/input-label.d.ts +6 -0
- package/dist/input/input-props.d.ts +29 -0
- package/dist/input/input.d.ts +38 -0
- package/dist/input/password-icon.d.ts +6 -0
- package/dist/input/password.d.ts +51 -0
- package/dist/input/styles.d.ts +8 -0
- package/dist/keyboard/index.d.ts +3 -0
- package/dist/keyboard/index.js +1127 -0
- package/dist/keyboard/keyboard.d.ts +46 -0
- package/dist/link/icon.d.ts +4 -0
- package/dist/link/index.d.ts +3 -0
- package/dist/link/index.js +1260 -0
- package/dist/link/link.d.ts +45 -0
- package/dist/loading/index.d.ts +3 -0
- package/dist/loading/index.js +1170 -0
- package/dist/loading/loading.d.ts +47 -0
- package/dist/login-with/LoginSocialAmazon/index.d.ts +19 -0
- package/dist/login-with/LoginSocialApple/index.d.ts +14 -0
- package/dist/login-with/LoginSocialFacebook/index.d.ts +26 -0
- package/dist/login-with/LoginSocialGithub/index.d.ts +21 -0
- package/dist/login-with/LoginSocialGoogle/index.d.ts +25 -0
- package/dist/login-with/LoginSocialInstagram/index.d.ts +22 -0
- package/dist/login-with/LoginSocialLinkedin/index.d.ts +20 -0
- package/dist/login-with/LoginSocialMicrosoft/index.d.ts +24 -0
- package/dist/login-with/LoginSocialPinterest/index.d.ts +19 -0
- package/dist/login-with/LoginSocialTiktok/index.d.ts +16 -0
- package/dist/login-with/LoginSocialTwitter/index.d.ts +20 -0
- package/dist/login-with/index.d.ts +18 -0
- package/dist/modal/index.d.ts +18 -0
- package/dist/modal/index.js +2440 -0
- package/dist/modal/modal-action.d.ts +46 -0
- package/dist/modal/modal-actions.d.ts +5 -0
- package/dist/modal/modal-content.d.ts +42 -0
- package/dist/modal/modal-context.d.ts +6 -0
- package/dist/modal/modal-subtitle.d.ts +42 -0
- package/dist/modal/modal-title.d.ts +42 -0
- package/dist/modal/modal-wrapper.d.ts +8 -0
- package/dist/modal/modal.d.ts +50 -0
- package/dist/note/index.d.ts +3 -0
- package/dist/note/index.js +1177 -0
- package/dist/note/note.d.ts +48 -0
- package/dist/page/index.d.ts +16 -0
- package/dist/page/index.js +1313 -0
- package/dist/page/page-content.d.ts +42 -0
- package/dist/page/page-footer.d.ts +42 -0
- package/dist/page/page-header.d.ts +43 -0
- package/dist/page/page.d.ts +51 -0
- package/dist/pagination/index.d.ts +12 -0
- package/dist/pagination/index.js +1563 -0
- package/dist/pagination/pagination-context.d.ts +11 -0
- package/dist/pagination/pagination-ellipsis.d.ts +7 -0
- package/dist/pagination/pagination-item.d.ts +10 -0
- package/dist/pagination/pagination-next.d.ts +4 -0
- package/dist/pagination/pagination-pages.d.ts +9 -0
- package/dist/pagination/pagination-previous.d.ts +4 -0
- package/dist/pagination/pagination.d.ts +47 -0
- package/dist/popover/index.d.ts +10 -0
- package/dist/popover/index.js +1849 -0
- package/dist/popover/popover-context.d.ts +7 -0
- package/dist/popover/popover-item.d.ts +45 -0
- package/dist/popover/popover.d.ts +52 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +1208 -0
- package/dist/progress/progress.d.ts +51 -0
- package/dist/radio/index.d.ts +13 -0
- package/dist/radio/index.js +1392 -0
- package/dist/radio/radio-context.d.ts +9 -0
- package/dist/radio/radio-description.d.ts +42 -0
- package/dist/radio/radio-group.d.ts +47 -0
- package/dist/radio/radio.d.ts +58 -0
- package/dist/radio/styles.d.ts +8 -0
- package/dist/rating/index.d.ts +3 -0
- package/dist/rating/index.js +1297 -0
- package/dist/rating/rating-icon.d.ts +3 -0
- package/dist/rating/rating.d.ts +54 -0
- package/dist/row/index.js +895 -0
- package/dist/search-bar/index.js +1176 -0
- package/dist/select/index.d.ts +9 -0
- package/dist/select/index.js +2125 -0
- package/dist/select/select-context.d.ts +11 -0
- package/dist/select/select-dropdown.d.ts +14 -0
- package/dist/select/select-icon-clear.d.ts +6 -0
- package/dist/select/select-icon.d.ts +3 -0
- package/dist/select/select-input.d.ts +8 -0
- package/dist/select/select-multiple-value.d.ts +7 -0
- package/dist/select/select-option.d.ts +47 -0
- package/dist/select/select.d.ts +62 -0
- package/dist/select/styles.d.ts +9 -0
- package/dist/shared/backdrop.d.ts +14 -0
- package/dist/shared/css-transition.d.ts +12 -0
- package/dist/shared/dropdown.d.ts +9 -0
- package/dist/shared/ellipsis.d.ts +6 -0
- package/dist/shared/expand.d.ts +7 -0
- package/dist/shared/highlight.d.ts +13 -0
- package/dist/skeleton/index.d.ts +14 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/index.js +1461 -0
- package/dist/slider/slider-dot.d.ts +12 -0
- package/dist/slider/slider-mark.d.ts +10 -0
- package/dist/slider/slider.d.ts +54 -0
- package/dist/slider/styles.d.ts +6 -0
- package/dist/snippet/index.d.ts +4 -0
- package/dist/snippet/index.js +1547 -0
- package/dist/snippet/snippet-icon.d.ts +3 -0
- package/dist/snippet/snippet.d.ts +51 -0
- package/dist/snippet/styles.d.ts +8 -0
- package/dist/spacer/index.d.ts +3 -0
- package/dist/spacer/index.js +1109 -0
- package/dist/spacer/spacer.d.ts +41 -0
- package/dist/spinner/index.d.ts +3 -0
- package/dist/spinner/index.js +1166 -0
- package/dist/spinner/spinner.d.ts +40 -0
- package/dist/styled-jsx.cjs.js +748 -0
- package/dist/table/index.d.ts +5 -0
- package/dist/table/index.js +1486 -0
- package/dist/table/table-body.d.ts +18 -0
- package/dist/table/table-cell.d.ts +18 -0
- package/dist/table/table-column.d.ts +14 -0
- package/dist/table/table-context.d.ts +8 -0
- package/dist/table/table-head.d.ts +14 -0
- package/dist/table/table-types.d.ts +14 -0
- package/dist/table/table.d.ts +57 -0
- package/dist/tabs/index.d.ts +9 -0
- package/dist/tabs/index.js +1488 -0
- package/dist/tabs/tabs-context.d.ts +21 -0
- package/dist/tabs/tabs-item.d.ts +44 -0
- package/dist/tabs/tabs.d.ts +54 -0
- package/dist/tag/index.d.ts +3 -0
- package/dist/tag/index.js +1155 -0
- package/dist/tag/tag.d.ts +51 -0
- package/dist/text/child.d.ts +11 -0
- package/dist/text/index.d.ts +3 -0
- package/dist/text/index.js +1251 -0
- package/dist/text/text.d.ts +59 -0
- package/dist/textarea/index.d.ts +3 -0
- package/dist/textarea/index.js +1298 -0
- package/dist/textarea/textarea.d.ts +54 -0
- package/dist/themes/index.d.ts +4 -0
- package/dist/themes/index.js +302 -0
- package/dist/themes/presets/dark.d.ts +8 -0
- package/dist/themes/presets/default.d.ts +8 -0
- package/dist/themes/presets/index.d.ts +90 -0
- package/dist/themes/presets/shared.d.ts +4 -0
- package/dist/themes/themes.d.ts +18 -0
- package/dist/toggle/index.d.ts +3 -0
- package/dist/toggle/index.js +1245 -0
- package/dist/toggle/styles.d.ts +6 -0
- package/dist/toggle/toggle.d.ts +60 -0
- package/dist/tooltip/helper.d.ts +10 -0
- package/dist/tooltip/index.d.ts +3 -0
- package/dist/tooltip/index.js +1709 -0
- package/dist/tooltip/placement.d.ts +29 -0
- package/dist/tooltip/styles.d.ts +7 -0
- package/dist/tooltip/tooltip-content.d.ts +18 -0
- package/dist/tooltip/tooltip-icon.d.ts +8 -0
- package/dist/tooltip/tooltip.d.ts +59 -0
- package/dist/tree/index.d.ts +10 -0
- package/dist/tree/index.js +1410 -0
- package/dist/tree/tree-context.d.ts +8 -0
- package/dist/tree/tree-file-icon.d.ts +8 -0
- package/dist/tree/tree-file.d.ts +12 -0
- package/dist/tree/tree-folder-icon.d.ts +8 -0
- package/dist/tree/tree-folder.d.ts +12 -0
- package/dist/tree/tree-help.d.ts +4 -0
- package/dist/tree/tree-indents.d.ts +6 -0
- package/dist/tree/tree-status-icon.d.ts +9 -0
- package/dist/tree/tree.d.ts +18 -0
- package/dist/ui-provider/index.d.ts +3 -0
- package/dist/ui-provider/index.js +2155 -0
- package/dist/ui-provider/theme-provider.d.ts +8 -0
- package/dist/ui-provider/ui-provider.d.ts +8 -0
- package/dist/use-all-themes/all-themes-context.d.ts +7 -0
- package/dist/use-all-themes/index.d.ts +3 -0
- package/dist/use-all-themes/index.js +318 -0
- package/dist/use-body-scroll/index.d.ts +3 -0
- package/dist/use-body-scroll/index.js +158 -0
- package/dist/use-body-scroll/use-body-scroll.d.ts +11 -0
- package/dist/use-classes/index.d.ts +2 -0
- package/dist/use-classes/index.js +47 -0
- package/dist/use-classes/use-classes.d.ts +4 -0
- package/dist/use-click-away/index.d.ts +2 -0
- package/dist/use-click-away/index.js +26 -0
- package/dist/use-click-away/use-click-away.d.ts +4 -0
- package/dist/use-clipboard/index.d.ts +3 -0
- package/dist/use-clipboard/index.js +158 -0
- package/dist/use-clipboard/use-clipboard.d.ts +8 -0
- package/dist/use-current-state/index.d.ts +2 -0
- package/dist/use-current-state/index.js +76 -0
- package/dist/use-current-state/use-current-state.d.ts +4 -0
- package/dist/use-input/index.d.ts +3 -0
- package/dist/use-input/index.js +112 -0
- package/dist/use-input/use-input.d.ts +13 -0
- package/dist/use-keyboard/codes.d.ts +92 -0
- package/dist/use-keyboard/helper.d.ts +3 -0
- package/dist/use-keyboard/index.d.ts +5 -0
- package/dist/use-keyboard/index.js +203 -0
- package/dist/use-keyboard/use-keyboard.d.ts +22 -0
- package/dist/use-media-query/index.d.ts +3 -0
- package/dist/use-media-query/index.js +455 -0
- package/dist/use-media-query/use-media-query.d.ts +12 -0
- package/dist/use-modal/index.d.ts +3 -0
- package/dist/use-modal/index.js +97 -0
- package/dist/use-modal/use-modal.d.ts +10 -0
- package/dist/use-scale/index.d.ts +6 -0
- package/dist/use-scale/index.js +592 -0
- package/dist/use-scale/scale-context.d.ts +50 -0
- package/dist/use-scale/utils.d.ts +68 -0
- package/dist/use-scale/with-scale.d.ts +35 -0
- package/dist/use-tabs/index.d.ts +2 -0
- package/dist/use-tabs/index.js +96 -0
- package/dist/use-tabs/use-tabs.d.ts +11 -0
- package/dist/use-theme/index.d.ts +2 -0
- package/dist/use-theme/index.js +316 -0
- package/dist/use-theme/theme-context.d.ts +4 -0
- package/dist/use-toasts/helpers.d.ts +17 -0
- package/dist/use-toasts/index.d.ts +3 -0
- package/dist/use-toasts/index.js +207 -0
- package/dist/use-toasts/toast-container.d.ts +3 -0
- package/dist/use-toasts/toast-item.d.ts +8 -0
- package/dist/use-toasts/use-toast.d.ts +40 -0
- package/dist/user/index.d.ts +8 -0
- package/dist/user/index.js +1392 -0
- package/dist/user/user-link.d.ts +11 -0
- package/dist/user/user.d.ts +46 -0
- package/dist/utils/calculations.d.ts +10 -0
- package/dist/utils/collections.d.ts +15 -0
- package/dist/utils/color.d.ts +2 -0
- package/dist/utils/layouts.d.ts +20 -0
- package/dist/utils/prop-types.d.ts +19 -0
- package/dist/utils/types.d.ts +3 -0
- package/dist/utils/use-body-scroll.d.ts +2 -0
- package/dist/utils/use-click-anywhere.d.ts +2 -0
- package/dist/utils/use-click-away.d.ts +2 -0
- package/dist/utils/use-clipboard.d.ts +2 -0
- package/dist/utils/use-current-state.d.ts +2 -0
- package/dist/utils/use-dom-observer.d.ts +3 -0
- package/dist/utils/use-drag.d.ts +8 -0
- package/dist/utils/use-hd-ui-context.d.ts +16 -0
- package/dist/utils/use-portal.d.ts +2 -0
- package/dist/utils/use-previous.d.ts +2 -0
- package/dist/utils/use-real-shape.d.ts +9 -0
- package/dist/utils/use-resize.d.ts +2 -0
- package/dist/utils/use-ssr.d.ts +6 -0
- package/dist/utils/use-warning.d.ts +2 -0
- package/esm/auto-complete/auto-complete-context.d.ts +10 -0
- package/esm/auto-complete/auto-complete-context.js +8 -0
- package/esm/auto-complete/auto-complete-dropdown.d.ts +12 -0
- package/esm/auto-complete/auto-complete-dropdown.js +43 -0
- package/esm/auto-complete/auto-complete-empty.d.ts +8 -0
- package/esm/auto-complete/auto-complete-empty.js +15 -0
- package/esm/auto-complete/auto-complete-item.d.ts +8 -0
- package/esm/auto-complete/auto-complete-item.js +45 -0
- package/esm/auto-complete/auto-complete-searching.d.ts +38 -0
- package/esm/auto-complete/auto-complete-searching.js +25 -0
- package/esm/auto-complete/auto-complete.d.ts +32 -0
- package/esm/auto-complete/auto-complete.js +197 -0
- package/esm/auto-complete/index.d.ts +13 -0
- package/esm/auto-complete/index.js +11 -0
- package/esm/avatar/avatar-group.d.ts +43 -0
- package/esm/avatar/avatar-group.js +25 -0
- package/esm/avatar/avatar.d.ts +43 -0
- package/esm/avatar/avatar.js +54 -0
- package/esm/avatar/index.d.ts +9 -0
- package/esm/avatar/index.js +6 -0
- package/esm/badge/badge-anchor.d.ts +11 -0
- package/esm/badge/badge-anchor.js +64 -0
- package/esm/badge/badge.d.ts +46 -0
- package/esm/badge/badge.js +50 -0
- package/esm/badge/index.d.ts +9 -0
- package/esm/badge/index.js +6 -0
- package/esm/breadcrumbs/breadcrumbs-item.d.ts +15 -0
- package/esm/breadcrumbs/breadcrumbs-item.js +43 -0
- package/esm/breadcrumbs/breadcrumbs-separator.d.ts +42 -0
- package/esm/breadcrumbs/breadcrumbs-separator.js +21 -0
- package/esm/breadcrumbs/breadcrumbs.d.ts +43 -0
- package/esm/breadcrumbs/breadcrumbs.js +41 -0
- package/esm/breadcrumbs/index.d.ts +12 -0
- package/esm/breadcrumbs/index.js +8 -0
- package/esm/button/button-icon.d.ts +10 -0
- package/esm/button/button-icon.js +26 -0
- package/esm/button/button-loading.d.ts +6 -0
- package/esm/button/button-loading.js +15 -0
- package/esm/button/button.d.ts +55 -0
- package/esm/button/button.drip.d.ts +10 -0
- package/esm/button/button.drip.js +58 -0
- package/esm/button/button.js +132 -0
- package/esm/button/index.d.ts +4 -0
- package/esm/button/index.js +4 -0
- package/esm/button/styles.d.ts +18 -0
- package/esm/button/styles.js +188 -0
- package/esm/button/utils.d.ts +8 -0
- package/esm/button/utils.js +40 -0
- package/esm/button-dropdown/button-dropdown-context.d.ts +10 -0
- package/esm/button-dropdown/button-dropdown-context.js +11 -0
- package/esm/button-dropdown/button-dropdown-item.d.ts +13 -0
- package/esm/button-dropdown/button-dropdown-item.js +47 -0
- package/esm/button-dropdown/button-dropdown.d.ts +49 -0
- package/esm/button-dropdown/button-dropdown.js +105 -0
- package/esm/button-dropdown/icon.d.ts +7 -0
- package/esm/button-dropdown/icon.js +28 -0
- package/esm/button-dropdown/index.d.ts +9 -0
- package/esm/button-dropdown/index.js +6 -0
- package/esm/button-dropdown/styles.d.ts +11 -0
- package/esm/button-dropdown/styles.js +46 -0
- package/esm/button-group/button-group-context.d.ts +10 -0
- package/esm/button-group/button-group-context.js +9 -0
- package/esm/button-group/button-group.d.ts +47 -0
- package/esm/button-group/button-group.js +63 -0
- package/esm/button-group/index.d.ts +4 -0
- package/esm/button-group/index.js +4 -0
- package/esm/capacity/capacity.d.ts +43 -0
- package/esm/capacity/capacity.js +46 -0
- package/esm/capacity/index.d.ts +3 -0
- package/esm/capacity/index.js +4 -0
- package/esm/card/card-content.d.ts +42 -0
- package/esm/card/card-content.js +24 -0
- package/esm/card/card-footer.d.ts +43 -0
- package/esm/card/card-footer.js +31 -0
- package/esm/card/card.d.ts +46 -0
- package/esm/card/card.js +57 -0
- package/esm/card/index.d.ts +15 -0
- package/esm/card/index.js +10 -0
- package/esm/card/styles.d.ts +8 -0
- package/esm/card/styles.js +53 -0
- package/esm/cart/index.d.ts +72 -0
- package/esm/cart/index.js +266 -0
- package/esm/cart/useLocalStorage.d.ts +1 -0
- package/esm/cart/useLocalStorage.js +28 -0
- package/esm/checkbox/checkbox-context.d.ts +9 -0
- package/esm/checkbox/checkbox-context.js +10 -0
- package/esm/checkbox/checkbox-group.d.ts +45 -0
- package/esm/checkbox/checkbox-group.js +64 -0
- package/esm/checkbox/checkbox.d.ts +57 -0
- package/esm/checkbox/checkbox.icon.d.ts +9 -0
- package/esm/checkbox/checkbox.icon.js +46 -0
- package/esm/checkbox/checkbox.js +103 -0
- package/esm/checkbox/index.d.ts +9 -0
- package/esm/checkbox/index.js +6 -0
- package/esm/checkbox/styles.d.ts +7 -0
- package/esm/checkbox/styles.js +27 -0
- package/esm/code/code.d.ts +45 -0
- package/esm/code/code.js +51 -0
- package/esm/code/index.d.ts +3 -0
- package/esm/code/index.js +4 -0
- package/esm/code-block/index.d.ts +10 -0
- package/esm/code-block/index.js +28 -0
- package/esm/col/col.js +26 -0
- package/esm/col/index.js +4 -0
- package/esm/collapse/collapse-context.d.ts +7 -0
- package/esm/collapse/collapse-context.js +8 -0
- package/esm/collapse/collapse-group.d.ts +43 -0
- package/esm/collapse/collapse-group.js +68 -0
- package/esm/collapse/collapse-icon.d.ts +6 -0
- package/esm/collapse/collapse-icon.js +26 -0
- package/esm/collapse/collapse.d.ts +47 -0
- package/esm/collapse/collapse.js +83 -0
- package/esm/collapse/index.d.ts +9 -0
- package/esm/collapse/index.js +6 -0
- package/esm/css-baseline/css-baseline.d.ts +11 -0
- package/esm/css-baseline/css-baseline.js +24 -0
- package/esm/css-baseline/index.d.ts +1 -0
- package/esm/css-baseline/index.js +3 -0
- package/esm/description/description.d.ts +42 -0
- package/esm/description/description.js +34 -0
- package/esm/description/index.d.ts +3 -0
- package/esm/description/index.js +4 -0
- package/esm/display/display.d.ts +44 -0
- package/esm/display/display.js +38 -0
- package/esm/display/index.d.ts +3 -0
- package/esm/display/index.js +4 -0
- package/esm/divider/divider.d.ts +46 -0
- package/esm/divider/divider.js +57 -0
- package/esm/divider/index.d.ts +4 -0
- package/esm/divider/index.js +4 -0
- package/esm/dot/dot.d.ts +45 -0
- package/esm/dot/dot.js +44 -0
- package/esm/dot/index.d.ts +3 -0
- package/esm/dot/index.js +4 -0
- package/esm/drawer/drawer-wrapper.d.ts +10 -0
- package/esm/drawer/drawer-wrapper.js +80 -0
- package/esm/drawer/drawer.d.ts +15 -0
- package/esm/drawer/drawer.js +73 -0
- package/esm/drawer/helper.d.ts +9 -0
- package/esm/drawer/helper.js +27 -0
- package/esm/drawer/index.d.ts +13 -0
- package/esm/drawer/index.js +10 -0
- package/esm/fieldset/fieldset-content.d.ts +42 -0
- package/esm/fieldset/fieldset-content.js +25 -0
- package/esm/fieldset/fieldset-context.d.ts +12 -0
- package/esm/fieldset/fieldset-context.js +9 -0
- package/esm/fieldset/fieldset-footer.d.ts +42 -0
- package/esm/fieldset/fieldset-footer.js +25 -0
- package/esm/fieldset/fieldset-group.d.ts +44 -0
- package/esm/fieldset/fieldset-group.js +79 -0
- package/esm/fieldset/fieldset-subtitle.d.ts +8 -0
- package/esm/fieldset/fieldset-subtitle.js +18 -0
- package/esm/fieldset/fieldset-title.d.ts +8 -0
- package/esm/fieldset/fieldset-title.js +20 -0
- package/esm/fieldset/fieldset.d.ts +46 -0
- package/esm/fieldset/fieldset.js +84 -0
- package/esm/fieldset/index.d.ts +22 -0
- package/esm/fieldset/index.js +15 -0
- package/esm/form/ErrorMessage.d.ts +17 -0
- package/esm/form/ErrorMessage.js +45 -0
- package/esm/form/FastField.js +147 -0
- package/esm/form/Field.d.ts +53 -0
- package/esm/form/Field.js +137 -0
- package/esm/form/FieldArray.js +281 -0
- package/esm/form/Form.js +23 -0
- package/esm/form/FormWrapper.d.ts +62 -0
- package/esm/form/FormWrapper.js +977 -0
- package/esm/form/FormikContext.d.ts +6 -0
- package/esm/form/FormikContext.js +11 -0
- package/esm/form/connect.d.ts +12 -0
- package/esm/form/connect.js +30 -0
- package/esm/form/constants.d.ts +1 -0
- package/esm/form/constants.js +1 -0
- package/esm/form/index.d.ts +9 -0
- package/esm/form/index.js +15 -0
- package/esm/form/types.d.ts +249 -0
- package/esm/form/types.js +1 -0
- package/esm/form/utils.d.ts +68 -0
- package/esm/form/utils.js +179 -0
- package/esm/form/withFormik.d.ts +68 -0
- package/esm/form/withFormik.js +107 -0
- package/esm/formik-native/src/index.js +12 -0
- package/esm/formik-native/test/blah.test.js +5 -0
- package/esm/grid/basic-item.d.ts +19 -0
- package/esm/grid/basic-item.js +87 -0
- package/esm/grid/grid-container.d.ts +299 -0
- package/esm/grid/grid-container.js +40 -0
- package/esm/grid/grid-types.d.ts +11 -0
- package/esm/grid/grid-types.js +8 -0
- package/esm/grid/grid.d.ts +296 -0
- package/esm/grid/grid.js +34 -0
- package/esm/grid/index.d.ts +11 -0
- package/esm/grid/index.js +6 -0
- package/esm/image/helpers.d.ts +2 -0
- package/esm/image/helpers.js +14 -0
- package/esm/image/image-browser-https-icon.d.ts +3 -0
- package/esm/image/image-browser-https-icon.js +21 -0
- package/esm/image/image-browser.d.ts +47 -0
- package/esm/image/image-browser.js +80 -0
- package/esm/image/image.d.ts +43 -0
- package/esm/image/image.js +82 -0
- package/esm/image/image.skeleton.d.ts +7 -0
- package/esm/image/image.skeleton.js +20 -0
- package/esm/image/index.d.ts +9 -0
- package/esm/image/index.js +4 -0
- package/esm/image/styles.d.ts +9 -0
- package/esm/image/styles.js +15 -0
- package/esm/index.d.ts +130 -0
- package/esm/index.js +78 -0
- package/esm/input/index.d.ts +13 -0
- package/esm/input/index.js +8 -0
- package/esm/input/input-block-label.d.ts +5 -0
- package/esm/input/input-block-label.js +16 -0
- package/esm/input/input-icon-clear.d.ts +8 -0
- package/esm/input/input-icon-clear.js +43 -0
- package/esm/input/input-icon.d.ts +8 -0
- package/esm/input/input-icon.js +18 -0
- package/esm/input/input-label.d.ts +6 -0
- package/esm/input/input-label.js +16 -0
- package/esm/input/input-props.d.ts +29 -0
- package/esm/input/input-props.js +1 -0
- package/esm/input/input.d.ts +38 -0
- package/esm/input/input.js +184 -0
- package/esm/input/password-icon.d.ts +6 -0
- package/esm/input/password-icon.js +28 -0
- package/esm/input/password.d.ts +51 -0
- package/esm/input/password.js +54 -0
- package/esm/input/styles.d.ts +8 -0
- package/esm/input/styles.js +31 -0
- package/esm/keyboard/index.d.ts +3 -0
- package/esm/keyboard/index.js +4 -0
- package/esm/keyboard/keyboard.d.ts +46 -0
- package/esm/keyboard/keyboard.js +43 -0
- package/esm/link/icon.d.ts +4 -0
- package/esm/link/icon.js +30 -0
- package/esm/link/index.d.ts +3 -0
- package/esm/link/index.js +2 -0
- package/esm/link/link.d.ts +45 -0
- package/esm/link/link.js +47 -0
- package/esm/loading/index.d.ts +3 -0
- package/esm/loading/index.js +2 -0
- package/esm/loading/loading.d.ts +47 -0
- package/esm/loading/loading.js +55 -0
- package/esm/login-with/LoginSocialAmazon/index.d.ts +19 -0
- package/esm/login-with/LoginSocialAmazon/index.js +142 -0
- package/esm/login-with/LoginSocialApple/index.d.ts +14 -0
- package/esm/login-with/LoginSocialApple/index.js +141 -0
- package/esm/login-with/LoginSocialFacebook/index.d.ts +26 -0
- package/esm/login-with/LoginSocialFacebook/index.js +148 -0
- package/esm/login-with/LoginSocialGithub/index.d.ts +21 -0
- package/esm/login-with/LoginSocialGithub/index.js +163 -0
- package/esm/login-with/LoginSocialGoogle/index.d.ts +25 -0
- package/esm/login-with/LoginSocialGoogle/index.js +206 -0
- package/esm/login-with/LoginSocialInstagram/index.d.ts +22 -0
- package/esm/login-with/LoginSocialInstagram/index.js +145 -0
- package/esm/login-with/LoginSocialLinkedin/index.d.ts +20 -0
- package/esm/login-with/LoginSocialLinkedin/index.js +151 -0
- package/esm/login-with/LoginSocialMicrosoft/index.d.ts +24 -0
- package/esm/login-with/LoginSocialMicrosoft/index.js +154 -0
- package/esm/login-with/LoginSocialPinterest/index.d.ts +19 -0
- package/esm/login-with/LoginSocialPinterest/index.js +171 -0
- package/esm/login-with/LoginSocialTiktok/index.d.ts +16 -0
- package/esm/login-with/LoginSocialTiktok/index.js +152 -0
- package/esm/login-with/LoginSocialTwitter/index.d.ts +20 -0
- package/esm/login-with/LoginSocialTwitter/index.js +177 -0
- package/esm/login-with/helper/signature.js +142 -0
- package/esm/login-with/index.d.ts +18 -0
- package/esm/login-with/index.js +11 -0
- package/esm/modal/index.d.ts +18 -0
- package/esm/modal/index.js +10 -0
- package/esm/modal/modal-action.d.ts +46 -0
- package/esm/modal/modal-action.js +69 -0
- package/esm/modal/modal-actions.d.ts +5 -0
- package/esm/modal/modal-actions.js +36 -0
- package/esm/modal/modal-content.d.ts +42 -0
- package/esm/modal/modal-content.js +24 -0
- package/esm/modal/modal-context.d.ts +6 -0
- package/esm/modal/modal-context.js +6 -0
- package/esm/modal/modal-subtitle.d.ts +42 -0
- package/esm/modal/modal-subtitle.js +25 -0
- package/esm/modal/modal-title.d.ts +42 -0
- package/esm/modal/modal-title.js +25 -0
- package/esm/modal/modal-wrapper.d.ts +8 -0
- package/esm/modal/modal-wrapper.js +74 -0
- package/esm/modal/modal.d.ts +50 -0
- package/esm/modal/modal.js +94 -0
- package/esm/note/index.d.ts +3 -0
- package/esm/note/index.js +2 -0
- package/esm/note/note.d.ts +48 -0
- package/esm/note/note.js +62 -0
- package/esm/page/index.d.ts +16 -0
- package/esm/page/index.js +9 -0
- package/esm/page/page-content.d.ts +42 -0
- package/esm/page/page-content.js +23 -0
- package/esm/page/page-footer.d.ts +42 -0
- package/esm/page/page-footer.js +21 -0
- package/esm/page/page-header.d.ts +43 -0
- package/esm/page/page-header.js +29 -0
- package/esm/page/page.d.ts +51 -0
- package/esm/page/page.js +80 -0
- package/esm/pagination/index.d.ts +12 -0
- package/esm/pagination/index.js +6 -0
- package/esm/pagination/pagination-context.d.ts +11 -0
- package/esm/pagination/pagination-context.js +8 -0
- package/esm/pagination/pagination-ellipsis.d.ts +7 -0
- package/esm/pagination/pagination-ellipsis.js +69 -0
- package/esm/pagination/pagination-item.d.ts +10 -0
- package/esm/pagination/pagination-item.js +43 -0
- package/esm/pagination/pagination-next.d.ts +4 -0
- package/esm/pagination/pagination-next.js +21 -0
- package/esm/pagination/pagination-pages.d.ts +9 -0
- package/esm/pagination/pagination-pages.js +86 -0
- package/esm/pagination/pagination-previous.d.ts +4 -0
- package/esm/pagination/pagination-previous.js +21 -0
- package/esm/pagination/pagination.d.ts +47 -0
- package/esm/pagination/pagination.js +96 -0
- package/esm/popover/index.d.ts +10 -0
- package/esm/popover/index.js +7 -0
- package/esm/popover/popover-context.d.ts +7 -0
- package/esm/popover/popover-context.js +9 -0
- package/esm/popover/popover-item.d.ts +45 -0
- package/esm/popover/popover-item.js +55 -0
- package/esm/popover/popover.d.ts +52 -0
- package/esm/popover/popover.js +86 -0
- package/esm/progress/index.d.ts +3 -0
- package/esm/progress/index.js +2 -0
- package/esm/progress/progress.d.ts +51 -0
- package/esm/progress/progress.js +68 -0
- package/esm/radio/index.d.ts +13 -0
- package/esm/radio/index.js +7 -0
- package/esm/radio/radio-context.d.ts +9 -0
- package/esm/radio/radio-context.js +9 -0
- package/esm/radio/radio-description.d.ts +42 -0
- package/esm/radio/radio-description.js +25 -0
- package/esm/radio/radio-group.d.ts +47 -0
- package/esm/radio/radio-group.js +57 -0
- package/esm/radio/radio.d.ts +58 -0
- package/esm/radio/radio.js +109 -0
- package/esm/radio/styles.d.ts +8 -0
- package/esm/radio/styles.js +31 -0
- package/esm/rating/index.d.ts +3 -0
- package/esm/rating/index.js +2 -0
- package/esm/rating/rating-icon.d.ts +3 -0
- package/esm/rating/rating-icon.js +18 -0
- package/esm/rating/rating.d.ts +54 -0
- package/esm/rating/rating.js +101 -0
- package/esm/row/index.js +2 -0
- package/esm/row/row.js +51 -0
- package/esm/search-bar/components/ClearIcon.js +42 -0
- package/esm/search-bar/components/Results.js +87 -0
- package/esm/search-bar/components/SearchIcon.js +24 -0
- package/esm/search-bar/components/SearchInput.js +75 -0
- package/esm/search-bar/components/index.js +302 -0
- package/esm/search-bar/config/config.js +26 -0
- package/esm/search-bar/index.js +2 -0
- package/esm/search-bar/utils/utils.js +14 -0
- package/esm/select/index.d.ts +9 -0
- package/esm/select/index.js +4 -0
- package/esm/select/select-context.d.ts +11 -0
- package/esm/select/select-context.js +9 -0
- package/esm/select/select-dropdown.d.ts +14 -0
- package/esm/select/select-dropdown.js +41 -0
- package/esm/select/select-icon-clear.d.ts +6 -0
- package/esm/select/select-icon-clear.js +37 -0
- package/esm/select/select-icon.d.ts +3 -0
- package/esm/select/select-icon.js +21 -0
- package/esm/select/select-input.d.ts +8 -0
- package/esm/select/select-input.js +35 -0
- package/esm/select/select-multiple-value.d.ts +7 -0
- package/esm/select/select-multiple-value.js +21 -0
- package/esm/select/select-option.d.ts +47 -0
- package/esm/select/select-option.js +86 -0
- package/esm/select/select.d.ts +62 -0
- package/esm/select/select.js +211 -0
- package/esm/select/styles.d.ts +9 -0
- package/esm/select/styles.js +36 -0
- package/esm/shared/backdrop.d.ts +14 -0
- package/esm/shared/backdrop.js +66 -0
- package/esm/shared/css-transition.d.ts +12 -0
- package/esm/shared/css-transition.js +65 -0
- package/esm/shared/dropdown.d.ts +9 -0
- package/esm/shared/dropdown.js +99 -0
- package/esm/shared/ellipsis.d.ts +6 -0
- package/esm/shared/ellipsis.js +13 -0
- package/esm/shared/expand.d.ts +7 -0
- package/esm/shared/expand.js +86 -0
- package/esm/shared/highlight.d.ts +13 -0
- package/esm/shared/highlight.js +46 -0
- package/esm/skeleton/index.d.ts +14 -0
- package/esm/skeleton/index.js +48 -0
- package/esm/slider/index.d.ts +3 -0
- package/esm/slider/index.js +2 -0
- package/esm/slider/slider-dot.d.ts +12 -0
- package/esm/slider/slider-dot.js +27 -0
- package/esm/slider/slider-mark.d.ts +10 -0
- package/esm/slider/slider-mark.js +35 -0
- package/esm/slider/slider.d.ts +54 -0
- package/esm/slider/slider.js +146 -0
- package/esm/slider/styles.d.ts +6 -0
- package/esm/slider/styles.js +21 -0
- package/esm/snippet/index.d.ts +4 -0
- package/esm/snippet/index.js +2 -0
- package/esm/snippet/snippet-icon.d.ts +3 -0
- package/esm/snippet/snippet-icon.js +25 -0
- package/esm/snippet/snippet.d.ts +51 -0
- package/esm/snippet/snippet.js +93 -0
- package/esm/snippet/styles.d.ts +8 -0
- package/esm/snippet/styles.js +48 -0
- package/esm/spacer/index.d.ts +3 -0
- package/esm/spacer/index.js +2 -0
- package/esm/spacer/spacer.d.ts +41 -0
- package/esm/spacer/spacer.js +24 -0
- package/esm/spinner/index.d.ts +3 -0
- package/esm/spinner/index.js +2 -0
- package/esm/spinner/spinner.d.ts +40 -0
- package/esm/spinner/spinner.js +40 -0
- package/esm/styled-jsx-server.es.js +5 -0
- package/esm/styled-jsx.es.js +737 -0
- package/esm/table/index.d.ts +5 -0
- package/esm/table/index.js +2 -0
- package/esm/table/table-body.d.ts +18 -0
- package/esm/table/table-body.js +45 -0
- package/esm/table/table-cell.d.ts +18 -0
- package/esm/table/table-cell.js +25 -0
- package/esm/table/table-column.d.ts +14 -0
- package/esm/table/table-column.js +33 -0
- package/esm/table/table-context.d.ts +8 -0
- package/esm/table/table-context.js +9 -0
- package/esm/table/table-head.d.ts +14 -0
- package/esm/table/table-head.js +51 -0
- package/esm/table/table-types.d.ts +14 -0
- package/esm/table/table-types.js +1 -0
- package/esm/table/table.d.ts +57 -0
- package/esm/table/table.js +104 -0
- package/esm/tabs/index.d.ts +9 -0
- package/esm/tabs/index.js +7 -0
- package/esm/tabs/tabs-context.d.ts +21 -0
- package/esm/tabs/tabs-context.js +8 -0
- package/esm/tabs/tabs-item.d.ts +44 -0
- package/esm/tabs/tabs-item.js +71 -0
- package/esm/tabs/tabs.d.ts +54 -0
- package/esm/tabs/tabs.js +138 -0
- package/esm/tag/index.d.ts +3 -0
- package/esm/tag/index.js +4 -0
- package/esm/tag/tag.d.ts +51 -0
- package/esm/tag/tag.js +71 -0
- package/esm/text/child.d.ts +11 -0
- package/esm/text/child.js +70 -0
- package/esm/text/index.d.ts +3 -0
- package/esm/text/index.js +4 -0
- package/esm/text/text.d.ts +59 -0
- package/esm/text/text.js +103 -0
- package/esm/textarea/index.d.ts +3 -0
- package/esm/textarea/index.js +2 -0
- package/esm/textarea/textarea.d.ts +54 -0
- package/esm/textarea/textarea.js +105 -0
- package/esm/themes/index.d.ts +4 -0
- package/esm/themes/index.js +2 -0
- package/esm/themes/presets/dark.d.ts +8 -0
- package/esm/themes/presets/dark.js +64 -0
- package/esm/themes/presets/default.d.ts +8 -0
- package/esm/themes/presets/default.js +64 -0
- package/esm/themes/presets/index.d.ts +90 -0
- package/esm/themes/presets/index.js +1 -0
- package/esm/themes/presets/shared.d.ts +4 -0
- package/esm/themes/presets/shared.js +42 -0
- package/esm/themes/themes.d.ts +18 -0
- package/esm/themes/themes.js +76 -0
- package/esm/toggle/index.d.ts +3 -0
- package/esm/toggle/index.js +2 -0
- package/esm/toggle/styles.d.ts +6 -0
- package/esm/toggle/styles.js +21 -0
- package/esm/toggle/toggle.d.ts +60 -0
- package/esm/toggle/toggle.js +76 -0
- package/esm/tooltip/__test__/index.test.js +168 -0
- package/esm/tooltip/helper.d.ts +10 -0
- package/esm/tooltip/helper.js +21 -0
- package/esm/tooltip/index.d.ts +3 -0
- package/esm/tooltip/index.js +2 -0
- package/esm/tooltip/placement.d.ts +29 -0
- package/esm/tooltip/placement.js +160 -0
- package/esm/tooltip/styles.d.ts +7 -0
- package/esm/tooltip/styles.js +16 -0
- package/esm/tooltip/tooltip-content.d.ts +18 -0
- package/esm/tooltip/tooltip-content.js +75 -0
- package/esm/tooltip/tooltip-icon.d.ts +8 -0
- package/esm/tooltip/tooltip-icon.js +28 -0
- package/esm/tooltip/tooltip.d.ts +59 -0
- package/esm/tooltip/tooltip.js +120 -0
- package/esm/tree/index.d.ts +10 -0
- package/esm/tree/index.js +6 -0
- package/esm/tree/tree-context.d.ts +8 -0
- package/esm/tree/tree-context.js +9 -0
- package/esm/tree/tree-file-icon.d.ts +8 -0
- package/esm/tree/tree-file-icon.js +34 -0
- package/esm/tree/tree-file.d.ts +12 -0
- package/esm/tree/tree-file.js +52 -0
- package/esm/tree/tree-folder-icon.d.ts +8 -0
- package/esm/tree/tree-folder-icon.js +31 -0
- package/esm/tree/tree-folder.d.ts +12 -0
- package/esm/tree/tree-folder.js +81 -0
- package/esm/tree/tree-help.d.ts +4 -0
- package/esm/tree/tree-help.js +16 -0
- package/esm/tree/tree-indents.d.ts +6 -0
- package/esm/tree/tree-indents.js +22 -0
- package/esm/tree/tree-status-icon.d.ts +9 -0
- package/esm/tree/tree-status-icon.js +44 -0
- package/esm/tree/tree.d.ts +18 -0
- package/esm/tree/tree.js +62 -0
- package/esm/ui-provider/index.d.ts +3 -0
- package/esm/ui-provider/index.js +2 -0
- package/esm/ui-provider/theme-provider.d.ts +8 -0
- package/esm/ui-provider/theme-provider.js +45 -0
- package/esm/ui-provider/ui-provider.d.ts +8 -0
- package/esm/ui-provider/ui-provider.js +55 -0
- package/esm/use-all-themes/all-themes-context.d.ts +7 -0
- package/esm/use-all-themes/all-themes-context.js +9 -0
- package/esm/use-all-themes/index.d.ts +3 -0
- package/esm/use-all-themes/index.js +2 -0
- package/esm/use-body-scroll/index.d.ts +3 -0
- package/esm/use-body-scroll/index.js +2 -0
- package/esm/use-body-scroll/use-body-scroll.d.ts +11 -0
- package/esm/use-body-scroll/use-body-scroll.js +63 -0
- package/esm/use-classes/index.d.ts +2 -0
- package/esm/use-classes/index.js +2 -0
- package/esm/use-classes/use-classes.d.ts +4 -0
- package/esm/use-classes/use-classes.js +32 -0
- package/esm/use-click-away/index.d.ts +2 -0
- package/esm/use-click-away/index.js +2 -0
- package/esm/use-click-away/use-click-away.d.ts +4 -0
- package/esm/use-click-away/use-click-away.js +21 -0
- package/esm/use-clipboard/index.d.ts +3 -0
- package/esm/use-clipboard/index.js +2 -0
- package/esm/use-clipboard/use-clipboard.d.ts +8 -0
- package/esm/use-clipboard/use-clipboard.js +39 -0
- package/esm/use-current-state/index.d.ts +2 -0
- package/esm/use-current-state/index.js +2 -0
- package/esm/use-current-state/use-current-state.d.ts +4 -0
- package/esm/use-current-state/use-current-state.js +23 -0
- package/esm/use-input/index.d.ts +3 -0
- package/esm/use-input/index.js +2 -0
- package/esm/use-input/use-input.d.ts +13 -0
- package/esm/use-input/use-input.js +29 -0
- package/esm/use-keyboard/codes.d.ts +92 -0
- package/esm/use-keyboard/codes.js +95 -0
- package/esm/use-keyboard/helper.d.ts +3 -0
- package/esm/use-keyboard/helper.js +26 -0
- package/esm/use-keyboard/index.d.ts +5 -0
- package/esm/use-keyboard/index.js +4 -0
- package/esm/use-keyboard/use-keyboard.d.ts +22 -0
- package/esm/use-keyboard/use-keyboard.js +70 -0
- package/esm/use-media-query/index.d.ts +3 -0
- package/esm/use-media-query/index.js +2 -0
- package/esm/use-media-query/use-media-query.d.ts +12 -0
- package/esm/use-media-query/use-media-query.js +81 -0
- package/esm/use-modal/index.d.ts +3 -0
- package/esm/use-modal/index.js +2 -0
- package/esm/use-modal/use-modal.d.ts +10 -0
- package/esm/use-modal/use-modal.js +22 -0
- package/esm/use-scale/index.d.ts +6 -0
- package/esm/use-scale/index.js +8 -0
- package/esm/use-scale/scale-context.d.ts +50 -0
- package/esm/use-scale/scale-context.js +37 -0
- package/esm/use-scale/utils.d.ts +68 -0
- package/esm/use-scale/utils.js +49 -0
- package/esm/use-scale/with-scale.d.ts +35 -0
- package/esm/use-scale/with-scale.js +102 -0
- package/esm/use-tabs/index.d.ts +2 -0
- package/esm/use-tabs/index.js +2 -0
- package/esm/use-tabs/use-tabs.d.ts +11 -0
- package/esm/use-tabs/use-tabs.js +21 -0
- package/esm/use-theme/index.d.ts +2 -0
- package/esm/use-theme/index.js +2 -0
- package/esm/use-theme/theme-context.d.ts +4 -0
- package/esm/use-theme/theme-context.js +9 -0
- package/esm/use-toasts/helpers.d.ts +17 -0
- package/esm/use-toasts/helpers.js +68 -0
- package/esm/use-toasts/index.d.ts +3 -0
- package/esm/use-toasts/index.js +2 -0
- package/esm/use-toasts/toast-container.d.ts +3 -0
- package/esm/use-toasts/toast-container.js +120 -0
- package/esm/use-toasts/toast-item.d.ts +8 -0
- package/esm/use-toasts/toast-item.js +43 -0
- package/esm/use-toasts/use-toast.d.ts +40 -0
- package/esm/use-toasts/use-toast.js +103 -0
- package/esm/user/index.d.ts +8 -0
- package/esm/user/index.js +4 -0
- package/esm/user/user-link.d.ts +11 -0
- package/esm/user/user-link.js +26 -0
- package/esm/user/user.d.ts +46 -0
- package/esm/user/user.js +44 -0
- package/esm/utils/calculations.d.ts +10 -0
- package/esm/utils/calculations.js +27 -0
- package/esm/utils/collections.d.ts +15 -0
- package/esm/utils/collections.js +126 -0
- package/esm/utils/color.d.ts +2 -0
- package/esm/utils/color.js +35 -0
- package/esm/utils/layouts.d.ts +20 -0
- package/esm/utils/layouts.js +73 -0
- package/esm/utils/prop-types.d.ts +19 -0
- package/esm/utils/prop-types.js +20 -0
- package/esm/utils/types.d.ts +3 -0
- package/esm/utils/types.js +1 -0
- package/esm/utils/use-body-scroll.d.ts +2 -0
- package/esm/utils/use-body-scroll.js +2 -0
- package/esm/utils/use-click-anywhere.d.ts +2 -0
- package/esm/utils/use-click-anywhere.js +15 -0
- package/esm/utils/use-click-away.d.ts +2 -0
- package/esm/utils/use-click-away.js +2 -0
- package/esm/utils/use-clipboard.d.ts +2 -0
- package/esm/utils/use-clipboard.js +2 -0
- package/esm/utils/use-context-state/create-geist-context.js +50 -0
- package/esm/utils/use-context-state/use-context-state.js +40 -0
- package/esm/utils/use-current-state.d.ts +2 -0
- package/esm/utils/use-current-state.js +2 -0
- package/esm/utils/use-default-props.js +17 -0
- package/esm/utils/use-dom-observer.d.ts +3 -0
- package/esm/utils/use-dom-observer.js +26 -0
- package/esm/utils/use-drag.d.ts +8 -0
- package/esm/utils/use-drag.js +66 -0
- package/esm/utils/use-hd-ui-context.d.ts +16 -0
- package/esm/utils/use-hd-ui-context.js +27 -0
- package/esm/utils/use-portal.d.ts +2 -0
- package/esm/utils/use-portal.js +34 -0
- package/esm/utils/use-previous.d.ts +2 -0
- package/esm/utils/use-previous.js +11 -0
- package/esm/utils/use-real-shape.d.ts +9 -0
- package/esm/utils/use-real-shape.js +47 -0
- package/esm/utils/use-resize.d.ts +2 -0
- package/esm/utils/use-resize.js +19 -0
- package/esm/utils/use-ssr.d.ts +6 -0
- package/esm/utils/use-ssr.js +19 -0
- package/esm/utils/use-warning.d.ts +2 -0
- package/esm/utils/use-warning.js +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,977 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
4
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
5
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
6
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
7
|
+
var _excluded = ["validateOnChange", "validateOnBlur", "validateOnMount", "isInitialValid", "enableReinitialize", "onSubmit"];
|
|
8
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
12
|
+
import deepmerge from 'deepmerge';
|
|
13
|
+
import isPlainObject from 'lodash/isPlainObject';
|
|
14
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
15
|
+
import * as React from 'react';
|
|
16
|
+
import isEqual from 'react-fast-compare';
|
|
17
|
+
import invariant from 'tiny-warning';
|
|
18
|
+
import { FormikProvider } from './FormikContext';
|
|
19
|
+
import { getActiveElement, getIn, isEmptyChildren, isFunction, isObject, isPromise, isString, setIn, setNestedObjectValues } from './utils';
|
|
20
|
+
import { __DEV__ } from './constants';
|
|
21
|
+
// State reducer
|
|
22
|
+
function formikReducer(state, msg) {
|
|
23
|
+
switch (msg.type) {
|
|
24
|
+
case 'SET_VALUES':
|
|
25
|
+
return _extends({}, state, {
|
|
26
|
+
values: msg.payload
|
|
27
|
+
});
|
|
28
|
+
case 'SET_TOUCHED':
|
|
29
|
+
return _extends({}, state, {
|
|
30
|
+
touched: msg.payload
|
|
31
|
+
});
|
|
32
|
+
case 'SET_ERRORS':
|
|
33
|
+
if (isEqual(state.errors, msg.payload)) {
|
|
34
|
+
return state;
|
|
35
|
+
}
|
|
36
|
+
return _extends({}, state, {
|
|
37
|
+
errors: msg.payload
|
|
38
|
+
});
|
|
39
|
+
case 'SET_STATUS':
|
|
40
|
+
return _extends({}, state, {
|
|
41
|
+
status: msg.payload
|
|
42
|
+
});
|
|
43
|
+
case 'SET_ISSUBMITTING':
|
|
44
|
+
return _extends({}, state, {
|
|
45
|
+
isSubmitting: msg.payload
|
|
46
|
+
});
|
|
47
|
+
case 'SET_ISVALIDATING':
|
|
48
|
+
return _extends({}, state, {
|
|
49
|
+
isValidating: msg.payload
|
|
50
|
+
});
|
|
51
|
+
case 'SET_FIELD_VALUE':
|
|
52
|
+
return _extends({}, state, {
|
|
53
|
+
values: setIn(state.values, msg.payload.field, msg.payload.value)
|
|
54
|
+
});
|
|
55
|
+
case 'SET_FIELD_TOUCHED':
|
|
56
|
+
return _extends({}, state, {
|
|
57
|
+
touched: setIn(state.touched, msg.payload.field, msg.payload.value)
|
|
58
|
+
});
|
|
59
|
+
case 'SET_FIELD_ERROR':
|
|
60
|
+
return _extends({}, state, {
|
|
61
|
+
errors: setIn(state.errors, msg.payload.field, msg.payload.value)
|
|
62
|
+
});
|
|
63
|
+
case 'RESET_FORM':
|
|
64
|
+
return _extends({}, state, msg.payload);
|
|
65
|
+
case 'SET_FORMIK_STATE':
|
|
66
|
+
return msg.payload(state);
|
|
67
|
+
case 'SUBMIT_ATTEMPT':
|
|
68
|
+
return _extends({}, state, {
|
|
69
|
+
touched: setNestedObjectValues(state.values, true),
|
|
70
|
+
isSubmitting: true,
|
|
71
|
+
submitCount: state.submitCount + 1
|
|
72
|
+
});
|
|
73
|
+
case 'SUBMIT_FAILURE':
|
|
74
|
+
return _extends({}, state, {
|
|
75
|
+
isSubmitting: false
|
|
76
|
+
});
|
|
77
|
+
case 'SUBMIT_SUCCESS':
|
|
78
|
+
return _extends({}, state, {
|
|
79
|
+
isSubmitting: false
|
|
80
|
+
});
|
|
81
|
+
default:
|
|
82
|
+
return state;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Initial empty states // objects
|
|
87
|
+
var emptyErrors = {};
|
|
88
|
+
var emptyTouched = {};
|
|
89
|
+
|
|
90
|
+
// This is an object that contains a map of all registered fields
|
|
91
|
+
// and their validate functions
|
|
92
|
+
|
|
93
|
+
export function useFormik(_ref) {
|
|
94
|
+
var _ref$validateOnChange = _ref.validateOnChange,
|
|
95
|
+
validateOnChange = _ref$validateOnChange === void 0 ? true : _ref$validateOnChange,
|
|
96
|
+
_ref$validateOnBlur = _ref.validateOnBlur,
|
|
97
|
+
validateOnBlur = _ref$validateOnBlur === void 0 ? true : _ref$validateOnBlur,
|
|
98
|
+
_ref$validateOnMount = _ref.validateOnMount,
|
|
99
|
+
validateOnMount = _ref$validateOnMount === void 0 ? false : _ref$validateOnMount,
|
|
100
|
+
isInitialValid = _ref.isInitialValid,
|
|
101
|
+
_ref$enableReinitiali = _ref.enableReinitialize,
|
|
102
|
+
enableReinitialize = _ref$enableReinitiali === void 0 ? false : _ref$enableReinitiali,
|
|
103
|
+
onSubmit = _ref.onSubmit,
|
|
104
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
105
|
+
var props = _extends({
|
|
106
|
+
validateOnChange: validateOnChange,
|
|
107
|
+
validateOnBlur: validateOnBlur,
|
|
108
|
+
validateOnMount: validateOnMount,
|
|
109
|
+
onSubmit: onSubmit
|
|
110
|
+
}, rest);
|
|
111
|
+
var initialValues = React.useRef(props.initialValues);
|
|
112
|
+
var initialErrors = React.useRef(props.initialErrors || emptyErrors);
|
|
113
|
+
var initialTouched = React.useRef(props.initialTouched || emptyTouched);
|
|
114
|
+
var initialStatus = React.useRef(props.initialStatus);
|
|
115
|
+
var isMounted = React.useRef(false);
|
|
116
|
+
var fieldRegistry = React.useRef({});
|
|
117
|
+
if (__DEV__) {
|
|
118
|
+
React.useEffect(function () {
|
|
119
|
+
invariant(typeof isInitialValid === 'undefined', 'isInitialValid has been deprecated and will be removed in future versions of Formik. Please use initialErrors or validateOnMount instead.');
|
|
120
|
+
// eslint-disable-next-line
|
|
121
|
+
}, []);
|
|
122
|
+
}
|
|
123
|
+
React.useEffect(function () {
|
|
124
|
+
isMounted.current = true;
|
|
125
|
+
return function () {
|
|
126
|
+
isMounted.current = false;
|
|
127
|
+
};
|
|
128
|
+
}, []);
|
|
129
|
+
var _React$useState = React.useState(0),
|
|
130
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
131
|
+
setIteration = _React$useState2[1];
|
|
132
|
+
var stateRef = React.useRef({
|
|
133
|
+
values: cloneDeep(props.initialValues),
|
|
134
|
+
errors: cloneDeep(props.initialErrors) || emptyErrors,
|
|
135
|
+
touched: cloneDeep(props.initialTouched) || emptyTouched,
|
|
136
|
+
status: cloneDeep(props.initialStatus),
|
|
137
|
+
isSubmitting: false,
|
|
138
|
+
isValidating: false,
|
|
139
|
+
submitCount: 0
|
|
140
|
+
});
|
|
141
|
+
var state = stateRef.current;
|
|
142
|
+
var dispatch = React.useCallback(function (action) {
|
|
143
|
+
var prev = stateRef.current;
|
|
144
|
+
stateRef.current = formikReducer(prev, action);
|
|
145
|
+
|
|
146
|
+
// force rerender
|
|
147
|
+
if (prev !== stateRef.current) setIteration(function (x) {
|
|
148
|
+
return x + 1;
|
|
149
|
+
});
|
|
150
|
+
}, []);
|
|
151
|
+
var runValidateHandler = React.useCallback(function (values, field) {
|
|
152
|
+
return new Promise(function (resolve, reject) {
|
|
153
|
+
var maybePromisedErrors = props.validate(values, field);
|
|
154
|
+
if (maybePromisedErrors == null) {
|
|
155
|
+
// use loose null check here on purpose
|
|
156
|
+
resolve(emptyErrors);
|
|
157
|
+
} else if (isPromise(maybePromisedErrors)) {
|
|
158
|
+
maybePromisedErrors.then(function (errors) {
|
|
159
|
+
resolve(errors || emptyErrors);
|
|
160
|
+
}, function (actualException) {
|
|
161
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
162
|
+
console.warn("Warning: An unhandled error was caught during validation in <Formik validate />", actualException);
|
|
163
|
+
}
|
|
164
|
+
reject(actualException);
|
|
165
|
+
});
|
|
166
|
+
} else {
|
|
167
|
+
resolve(maybePromisedErrors);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}, [props.validate]);
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Run validation against a Yup schema and optionally run a function if successful
|
|
174
|
+
*/
|
|
175
|
+
var runValidationSchema = React.useCallback(function (values, field) {
|
|
176
|
+
var validationSchema = props.validationSchema;
|
|
177
|
+
var schema = isFunction(validationSchema) ? validationSchema(field) : validationSchema;
|
|
178
|
+
var promise = field && schema.validateAt ? schema.validateAt(field, values) : validateYupSchema(values, schema);
|
|
179
|
+
return new Promise(function (resolve, reject) {
|
|
180
|
+
promise.then(function () {
|
|
181
|
+
resolve(emptyErrors);
|
|
182
|
+
}, function (err) {
|
|
183
|
+
// Yup will throw a validation error if validation fails. We catch those and
|
|
184
|
+
// resolve them into Formik errors. We can sniff if something is a Yup error
|
|
185
|
+
// by checking error.name.
|
|
186
|
+
// @see https://github.com/jquense/yup#validationerrorerrors-string--arraystring-value-any-path-string
|
|
187
|
+
if (err.name === 'ValidationError') {
|
|
188
|
+
resolve(yupToFormErrors(err));
|
|
189
|
+
} else {
|
|
190
|
+
// We throw any other errors
|
|
191
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
192
|
+
console.warn("Warning: An unhandled error was caught during validation in <Formik validationSchema />", err);
|
|
193
|
+
}
|
|
194
|
+
reject(err);
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}, [props.validationSchema]);
|
|
199
|
+
var runSingleFieldLevelValidation = React.useCallback(function (field, value) {
|
|
200
|
+
return new Promise(function (resolve) {
|
|
201
|
+
return resolve(fieldRegistry.current[field].validate(value));
|
|
202
|
+
});
|
|
203
|
+
}, []);
|
|
204
|
+
var runFieldLevelValidations = React.useCallback(function (values) {
|
|
205
|
+
var fieldKeysWithValidation = Object.keys(fieldRegistry.current).filter(function (f) {
|
|
206
|
+
return isFunction(fieldRegistry.current[f].validate);
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// Construct an array with all of the field validation functions
|
|
210
|
+
var fieldValidations = fieldKeysWithValidation.length > 0 ? fieldKeysWithValidation.map(function (f) {
|
|
211
|
+
return runSingleFieldLevelValidation(f, getIn(values, f));
|
|
212
|
+
}) : [Promise.resolve('DO_NOT_DELETE_YOU_WILL_BE_FIRED')]; // use special case ;)
|
|
213
|
+
|
|
214
|
+
return Promise.all(fieldValidations).then(function (fieldErrorsList) {
|
|
215
|
+
return fieldErrorsList.reduce(function (prev, curr, index) {
|
|
216
|
+
if (curr === 'DO_NOT_DELETE_YOU_WILL_BE_FIRED') {
|
|
217
|
+
return prev;
|
|
218
|
+
}
|
|
219
|
+
if (curr) {
|
|
220
|
+
prev = setIn(prev, fieldKeysWithValidation[index], curr);
|
|
221
|
+
}
|
|
222
|
+
return prev;
|
|
223
|
+
}, {});
|
|
224
|
+
});
|
|
225
|
+
}, [runSingleFieldLevelValidation]);
|
|
226
|
+
|
|
227
|
+
// Run all validations and return the result
|
|
228
|
+
var runAllValidations = React.useCallback( /*#__PURE__*/function () {
|
|
229
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(values) {
|
|
230
|
+
var _yield$Promise$all, _yield$Promise$all2, fieldErrors, schemaErrors, validateErrors, combinedErrors;
|
|
231
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
232
|
+
while (1) switch (_context.prev = _context.next) {
|
|
233
|
+
case 0:
|
|
234
|
+
_context.next = 2;
|
|
235
|
+
return Promise.all([runFieldLevelValidations(values), props.validationSchema ? runValidationSchema(values) : {}, props.validate ? runValidateHandler(values) : {}]);
|
|
236
|
+
case 2:
|
|
237
|
+
_yield$Promise$all = _context.sent;
|
|
238
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
239
|
+
fieldErrors = _yield$Promise$all2[0];
|
|
240
|
+
schemaErrors = _yield$Promise$all2[1];
|
|
241
|
+
validateErrors = _yield$Promise$all2[2];
|
|
242
|
+
combinedErrors = deepmerge.all([fieldErrors, schemaErrors, validateErrors], {
|
|
243
|
+
arrayMerge: arrayMerge
|
|
244
|
+
});
|
|
245
|
+
return _context.abrupt("return", combinedErrors);
|
|
246
|
+
case 9:
|
|
247
|
+
case "end":
|
|
248
|
+
return _context.stop();
|
|
249
|
+
}
|
|
250
|
+
}, _callee);
|
|
251
|
+
}));
|
|
252
|
+
return function (_x) {
|
|
253
|
+
return _ref2.apply(this, arguments);
|
|
254
|
+
};
|
|
255
|
+
}(), [props.validate, props.validationSchema, runFieldLevelValidations, runValidateHandler, runValidationSchema]);
|
|
256
|
+
|
|
257
|
+
// Run all validations methods and update state accordingly
|
|
258
|
+
var validateFormWithHighPriority = useEventCallback(function () {
|
|
259
|
+
var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : state.values;
|
|
260
|
+
dispatch({
|
|
261
|
+
type: 'SET_ISVALIDATING',
|
|
262
|
+
payload: true
|
|
263
|
+
});
|
|
264
|
+
return runAllValidations(values).then(function (combinedErrors) {
|
|
265
|
+
if (!!isMounted.current) {
|
|
266
|
+
dispatch({
|
|
267
|
+
type: 'SET_ISVALIDATING',
|
|
268
|
+
payload: false
|
|
269
|
+
});
|
|
270
|
+
dispatch({
|
|
271
|
+
type: 'SET_ERRORS',
|
|
272
|
+
payload: combinedErrors
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
return combinedErrors;
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
React.useEffect(function () {
|
|
279
|
+
if (validateOnMount && isMounted.current === true && isEqual(initialValues.current, props.initialValues)) {
|
|
280
|
+
validateFormWithHighPriority(initialValues.current);
|
|
281
|
+
}
|
|
282
|
+
}, [validateOnMount, validateFormWithHighPriority]);
|
|
283
|
+
var resetForm = React.useCallback(function (nextState) {
|
|
284
|
+
var values = nextState && nextState.values ? nextState.values : initialValues.current;
|
|
285
|
+
var errors = nextState && nextState.errors ? nextState.errors : initialErrors.current ? initialErrors.current : props.initialErrors || {};
|
|
286
|
+
var touched = nextState && nextState.touched ? nextState.touched : initialTouched.current ? initialTouched.current : props.initialTouched || {};
|
|
287
|
+
var status = nextState && nextState.status ? nextState.status : initialStatus.current ? initialStatus.current : props.initialStatus;
|
|
288
|
+
initialValues.current = values;
|
|
289
|
+
initialErrors.current = errors;
|
|
290
|
+
initialTouched.current = touched;
|
|
291
|
+
initialStatus.current = status;
|
|
292
|
+
var dispatchFn = function dispatchFn() {
|
|
293
|
+
dispatch({
|
|
294
|
+
type: 'RESET_FORM',
|
|
295
|
+
payload: {
|
|
296
|
+
isSubmitting: !!nextState && !!nextState.isSubmitting,
|
|
297
|
+
errors: errors,
|
|
298
|
+
touched: touched,
|
|
299
|
+
status: status,
|
|
300
|
+
values: values,
|
|
301
|
+
isValidating: !!nextState && !!nextState.isValidating,
|
|
302
|
+
submitCount: !!nextState && !!nextState.submitCount && typeof nextState.submitCount === 'number' ? nextState.submitCount : 0
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
};
|
|
306
|
+
if (props.onReset) {
|
|
307
|
+
var maybePromisedOnReset = props.onReset(state.values, imperativeMethods);
|
|
308
|
+
if (isPromise(maybePromisedOnReset)) {
|
|
309
|
+
maybePromisedOnReset.then(dispatchFn);
|
|
310
|
+
} else {
|
|
311
|
+
dispatchFn();
|
|
312
|
+
}
|
|
313
|
+
} else {
|
|
314
|
+
dispatchFn();
|
|
315
|
+
}
|
|
316
|
+
}, [props.initialErrors, props.initialStatus, props.initialTouched, props.onReset]);
|
|
317
|
+
React.useEffect(function () {
|
|
318
|
+
if (isMounted.current === true && !isEqual(initialValues.current, props.initialValues)) {
|
|
319
|
+
if (enableReinitialize) {
|
|
320
|
+
initialValues.current = props.initialValues;
|
|
321
|
+
resetForm();
|
|
322
|
+
if (validateOnMount) {
|
|
323
|
+
validateFormWithHighPriority(initialValues.current);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}, [enableReinitialize, props.initialValues, resetForm, validateOnMount, validateFormWithHighPriority]);
|
|
328
|
+
React.useEffect(function () {
|
|
329
|
+
if (enableReinitialize && isMounted.current === true && !isEqual(initialErrors.current, props.initialErrors)) {
|
|
330
|
+
initialErrors.current = props.initialErrors || emptyErrors;
|
|
331
|
+
dispatch({
|
|
332
|
+
type: 'SET_ERRORS',
|
|
333
|
+
payload: props.initialErrors || emptyErrors
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}, [enableReinitialize, props.initialErrors]);
|
|
337
|
+
React.useEffect(function () {
|
|
338
|
+
if (enableReinitialize && isMounted.current === true && !isEqual(initialTouched.current, props.initialTouched)) {
|
|
339
|
+
initialTouched.current = props.initialTouched || emptyTouched;
|
|
340
|
+
dispatch({
|
|
341
|
+
type: 'SET_TOUCHED',
|
|
342
|
+
payload: props.initialTouched || emptyTouched
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}, [enableReinitialize, props.initialTouched]);
|
|
346
|
+
React.useEffect(function () {
|
|
347
|
+
if (enableReinitialize && isMounted.current === true && !isEqual(initialStatus.current, props.initialStatus)) {
|
|
348
|
+
initialStatus.current = props.initialStatus;
|
|
349
|
+
dispatch({
|
|
350
|
+
type: 'SET_STATUS',
|
|
351
|
+
payload: props.initialStatus
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
}, [enableReinitialize, props.initialStatus, props.initialTouched]);
|
|
355
|
+
var validateField = useEventCallback(function (name) {
|
|
356
|
+
// This will efficiently validate a single field by avoiding state
|
|
357
|
+
// changes if the validation function is synchronous. It's different from
|
|
358
|
+
// what is called when using validateForm.
|
|
359
|
+
|
|
360
|
+
if (fieldRegistry.current[name] && isFunction(fieldRegistry.current[name].validate)) {
|
|
361
|
+
var value = getIn(state.values, name);
|
|
362
|
+
var maybePromise = fieldRegistry.current[name].validate(value);
|
|
363
|
+
if (isPromise(maybePromise)) {
|
|
364
|
+
// Only flip isValidating if the function is async.
|
|
365
|
+
dispatch({
|
|
366
|
+
type: 'SET_ISVALIDATING',
|
|
367
|
+
payload: true
|
|
368
|
+
});
|
|
369
|
+
return maybePromise.then(function (x) {
|
|
370
|
+
return x;
|
|
371
|
+
}).then(function (error) {
|
|
372
|
+
dispatch({
|
|
373
|
+
type: 'SET_FIELD_ERROR',
|
|
374
|
+
payload: {
|
|
375
|
+
field: name,
|
|
376
|
+
value: error
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
dispatch({
|
|
380
|
+
type: 'SET_ISVALIDATING',
|
|
381
|
+
payload: false
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
} else {
|
|
385
|
+
dispatch({
|
|
386
|
+
type: 'SET_FIELD_ERROR',
|
|
387
|
+
payload: {
|
|
388
|
+
field: name,
|
|
389
|
+
value: maybePromise
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
return Promise.resolve(maybePromise);
|
|
393
|
+
}
|
|
394
|
+
} else if (props.validationSchema) {
|
|
395
|
+
dispatch({
|
|
396
|
+
type: 'SET_ISVALIDATING',
|
|
397
|
+
payload: true
|
|
398
|
+
});
|
|
399
|
+
return runValidationSchema(state.values, name).then(function (x) {
|
|
400
|
+
return x;
|
|
401
|
+
}).then(function (error) {
|
|
402
|
+
dispatch({
|
|
403
|
+
type: 'SET_FIELD_ERROR',
|
|
404
|
+
payload: {
|
|
405
|
+
field: name,
|
|
406
|
+
value: getIn(error, name)
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
dispatch({
|
|
410
|
+
type: 'SET_ISVALIDATING',
|
|
411
|
+
payload: false
|
|
412
|
+
});
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
return Promise.resolve();
|
|
416
|
+
});
|
|
417
|
+
var registerField = React.useCallback(function (name, _ref3) {
|
|
418
|
+
var validate = _ref3.validate;
|
|
419
|
+
fieldRegistry.current[name] = {
|
|
420
|
+
validate: validate
|
|
421
|
+
};
|
|
422
|
+
}, []);
|
|
423
|
+
var unregisterField = React.useCallback(function (name) {
|
|
424
|
+
delete fieldRegistry.current[name];
|
|
425
|
+
}, []);
|
|
426
|
+
var setTouched = useEventCallback(function (touched, shouldValidate) {
|
|
427
|
+
dispatch({
|
|
428
|
+
type: 'SET_TOUCHED',
|
|
429
|
+
payload: touched
|
|
430
|
+
});
|
|
431
|
+
var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;
|
|
432
|
+
return willValidate ? validateFormWithHighPriority(state.values) : Promise.resolve();
|
|
433
|
+
});
|
|
434
|
+
var setErrors = React.useCallback(function (errors) {
|
|
435
|
+
dispatch({
|
|
436
|
+
type: 'SET_ERRORS',
|
|
437
|
+
payload: errors
|
|
438
|
+
});
|
|
439
|
+
}, []);
|
|
440
|
+
var setValues = useEventCallback(function (values, shouldValidate) {
|
|
441
|
+
var resolvedValues = isFunction(values) ? values(state.values) : values;
|
|
442
|
+
dispatch({
|
|
443
|
+
type: 'SET_VALUES',
|
|
444
|
+
payload: resolvedValues
|
|
445
|
+
});
|
|
446
|
+
var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;
|
|
447
|
+
return willValidate ? validateFormWithHighPriority(resolvedValues) : Promise.resolve();
|
|
448
|
+
});
|
|
449
|
+
var setFieldError = React.useCallback(function (field, value) {
|
|
450
|
+
dispatch({
|
|
451
|
+
type: 'SET_FIELD_ERROR',
|
|
452
|
+
payload: {
|
|
453
|
+
field: field,
|
|
454
|
+
value: value
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
}, []);
|
|
458
|
+
var setFieldValue = useEventCallback(function (field, value, shouldValidate) {
|
|
459
|
+
dispatch({
|
|
460
|
+
type: 'SET_FIELD_VALUE',
|
|
461
|
+
payload: {
|
|
462
|
+
field: field,
|
|
463
|
+
value: value
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
var willValidate = shouldValidate === undefined ? validateOnChange : shouldValidate;
|
|
467
|
+
return willValidate ? validateFormWithHighPriority(setIn(state.values, field, value)) : Promise.resolve();
|
|
468
|
+
});
|
|
469
|
+
var executeChange = React.useCallback(function (eventOrTextValue, maybePath) {
|
|
470
|
+
// By default, assume that the first argument is a string. This allows us to use
|
|
471
|
+
// handleChange with React Native and React Native Web's onChangeText prop which
|
|
472
|
+
// provides just the value of the input.
|
|
473
|
+
var field = maybePath;
|
|
474
|
+
var val = eventOrTextValue;
|
|
475
|
+
var parsed;
|
|
476
|
+
// If the first argument is not a string though, it has to be a synthetic React Event (or a fake one),
|
|
477
|
+
// so we handle like we would a normal HTML change event.
|
|
478
|
+
if (!isString(eventOrTextValue)) {
|
|
479
|
+
// If we can, persist the event
|
|
480
|
+
// @see https://reactjs.org/docs/events.html#event-pooling
|
|
481
|
+
if (eventOrTextValue.persist) {
|
|
482
|
+
eventOrTextValue.persist();
|
|
483
|
+
}
|
|
484
|
+
var target = eventOrTextValue.target ? eventOrTextValue.target : eventOrTextValue.currentTarget;
|
|
485
|
+
var type = target.type,
|
|
486
|
+
name = target.name,
|
|
487
|
+
id = target.id,
|
|
488
|
+
value = target.value,
|
|
489
|
+
checked = target.checked,
|
|
490
|
+
outerHTML = target.outerHTML,
|
|
491
|
+
options = target.options,
|
|
492
|
+
multiple = target.multiple;
|
|
493
|
+
field = maybePath ? maybePath : name ? name : id;
|
|
494
|
+
if (!field && __DEV__) {
|
|
495
|
+
warnAboutMissingIdentifier({
|
|
496
|
+
htmlContent: outerHTML,
|
|
497
|
+
documentationAnchorLink: 'handlechange-e-reactchangeeventany--void',
|
|
498
|
+
handlerName: 'handleChange'
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
val = /number|range/.test(type) ? (parsed = parseFloat(value), isNaN(parsed) ? '' : parsed) : /checkbox/.test(type) // checkboxes
|
|
502
|
+
? getValueForCheckbox(getIn(state.values, field), checked, value) : options && multiple // <select multiple>
|
|
503
|
+
? getSelectedValues(options) : value;
|
|
504
|
+
}
|
|
505
|
+
if (field) {
|
|
506
|
+
// Set form fields by name
|
|
507
|
+
setFieldValue(field, val);
|
|
508
|
+
}
|
|
509
|
+
}, [setFieldValue, state.values]);
|
|
510
|
+
var handleChange = useEventCallback(function (eventOrPath) {
|
|
511
|
+
if (isString(eventOrPath)) {
|
|
512
|
+
return function (event) {
|
|
513
|
+
return executeChange(event, eventOrPath);
|
|
514
|
+
};
|
|
515
|
+
} else {
|
|
516
|
+
executeChange(eventOrPath);
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
var setFieldTouched = useEventCallback(function (field) {
|
|
520
|
+
var touched = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
521
|
+
var shouldValidate = arguments.length > 2 ? arguments[2] : undefined;
|
|
522
|
+
dispatch({
|
|
523
|
+
type: 'SET_FIELD_TOUCHED',
|
|
524
|
+
payload: {
|
|
525
|
+
field: field,
|
|
526
|
+
value: touched
|
|
527
|
+
}
|
|
528
|
+
});
|
|
529
|
+
var willValidate = shouldValidate === undefined ? validateOnBlur : shouldValidate;
|
|
530
|
+
return willValidate ? validateFormWithHighPriority(state.values) : Promise.resolve();
|
|
531
|
+
});
|
|
532
|
+
var executeBlur = React.useCallback(function (e, path) {
|
|
533
|
+
if (e.persist) {
|
|
534
|
+
e.persist();
|
|
535
|
+
}
|
|
536
|
+
var _e$target = e.target,
|
|
537
|
+
name = _e$target.name,
|
|
538
|
+
id = _e$target.id,
|
|
539
|
+
outerHTML = _e$target.outerHTML;
|
|
540
|
+
var field = path ? path : name ? name : id;
|
|
541
|
+
if (!field && __DEV__) {
|
|
542
|
+
warnAboutMissingIdentifier({
|
|
543
|
+
htmlContent: outerHTML,
|
|
544
|
+
documentationAnchorLink: 'handleblur-e-any--void',
|
|
545
|
+
handlerName: 'handleBlur'
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
setFieldTouched(field, true);
|
|
549
|
+
}, [setFieldTouched]);
|
|
550
|
+
var handleBlur = useEventCallback(function (eventOrString) {
|
|
551
|
+
if (isString(eventOrString)) {
|
|
552
|
+
return function (event) {
|
|
553
|
+
return executeBlur(event, eventOrString);
|
|
554
|
+
};
|
|
555
|
+
} else {
|
|
556
|
+
executeBlur(eventOrString);
|
|
557
|
+
}
|
|
558
|
+
});
|
|
559
|
+
var setFormikState = React.useCallback(function (stateOrCb) {
|
|
560
|
+
if (isFunction(stateOrCb)) {
|
|
561
|
+
dispatch({
|
|
562
|
+
type: 'SET_FORMIK_STATE',
|
|
563
|
+
payload: stateOrCb
|
|
564
|
+
});
|
|
565
|
+
} else {
|
|
566
|
+
dispatch({
|
|
567
|
+
type: 'SET_FORMIK_STATE',
|
|
568
|
+
payload: function payload() {
|
|
569
|
+
return stateOrCb;
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
}, []);
|
|
574
|
+
var setStatus = React.useCallback(function (status) {
|
|
575
|
+
dispatch({
|
|
576
|
+
type: 'SET_STATUS',
|
|
577
|
+
payload: status
|
|
578
|
+
});
|
|
579
|
+
}, []);
|
|
580
|
+
var setSubmitting = React.useCallback(function (isSubmitting) {
|
|
581
|
+
dispatch({
|
|
582
|
+
type: 'SET_ISSUBMITTING',
|
|
583
|
+
payload: isSubmitting
|
|
584
|
+
});
|
|
585
|
+
}, []);
|
|
586
|
+
var submitForm = useEventCallback(function () {
|
|
587
|
+
dispatch({
|
|
588
|
+
type: 'SUBMIT_ATTEMPT'
|
|
589
|
+
});
|
|
590
|
+
return validateFormWithHighPriority().then(function (combinedErrors) {
|
|
591
|
+
// In case an error was thrown and passed to the resolved Promise,
|
|
592
|
+
// `combinedErrors` can be an instance of an Error. We need to check
|
|
593
|
+
// that and abort the submit.
|
|
594
|
+
// If we don't do that, calling `Object.keys(new Error())` yields an
|
|
595
|
+
// empty array, which causes the validation to pass and the form
|
|
596
|
+
// to be submitted.
|
|
597
|
+
|
|
598
|
+
var isInstanceOfError = combinedErrors instanceof Error;
|
|
599
|
+
var isActuallyValid = !isInstanceOfError && Object.keys(combinedErrors).length === 0;
|
|
600
|
+
if (isActuallyValid) {
|
|
601
|
+
// Proceed with submit...
|
|
602
|
+
//
|
|
603
|
+
// To respect sync submit fns, we can't simply wrap executeSubmit in a promise and
|
|
604
|
+
// _always_ dispatch SUBMIT_SUCCESS because isSubmitting would then always be false.
|
|
605
|
+
// This would be fine in simple cases, but make it impossible to disable submit
|
|
606
|
+
// buttons where people use callbacks or promises as side effects (which is basically
|
|
607
|
+
// all of v1 Formik code). Instead, recall that we are inside of a promise chain already,
|
|
608
|
+
// so we can try/catch executeSubmit(), if it returns undefined, then just bail.
|
|
609
|
+
// If there are errors, throw em. Otherwise, wrap executeSubmit in a promise and handle
|
|
610
|
+
// cleanup of isSubmitting on behalf of the consumer.
|
|
611
|
+
var promiseOrUndefined;
|
|
612
|
+
try {
|
|
613
|
+
promiseOrUndefined = executeSubmit();
|
|
614
|
+
// Bail if it's sync, consumer is responsible for cleaning up
|
|
615
|
+
// via setSubmitting(false)
|
|
616
|
+
if (promiseOrUndefined === undefined) {
|
|
617
|
+
return;
|
|
618
|
+
}
|
|
619
|
+
} catch (error) {
|
|
620
|
+
throw error;
|
|
621
|
+
}
|
|
622
|
+
return Promise.resolve(promiseOrUndefined).then(function (result) {
|
|
623
|
+
if (!!isMounted.current) {
|
|
624
|
+
dispatch({
|
|
625
|
+
type: 'SUBMIT_SUCCESS'
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
return result;
|
|
629
|
+
})["catch"](function (_errors) {
|
|
630
|
+
if (!!isMounted.current) {
|
|
631
|
+
dispatch({
|
|
632
|
+
type: 'SUBMIT_FAILURE'
|
|
633
|
+
});
|
|
634
|
+
// This is a legit error rejected by the onSubmit fn
|
|
635
|
+
// so we don't want to break the promise chain
|
|
636
|
+
throw _errors;
|
|
637
|
+
}
|
|
638
|
+
});
|
|
639
|
+
} else if (!!isMounted.current) {
|
|
640
|
+
// ^^^ Make sure Formik is still mounted before updating state
|
|
641
|
+
dispatch({
|
|
642
|
+
type: 'SUBMIT_FAILURE'
|
|
643
|
+
});
|
|
644
|
+
// throw combinedErrors;
|
|
645
|
+
if (isInstanceOfError) {
|
|
646
|
+
throw combinedErrors;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
return;
|
|
650
|
+
});
|
|
651
|
+
});
|
|
652
|
+
var handleSubmit = useEventCallback(function (e) {
|
|
653
|
+
if (e && e.preventDefault && isFunction(e.preventDefault)) {
|
|
654
|
+
e.preventDefault();
|
|
655
|
+
}
|
|
656
|
+
if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
|
|
657
|
+
e.stopPropagation();
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
// Warn if form submission is triggered by a <button> without a
|
|
661
|
+
// specified `type` attribute during development. This mitigates
|
|
662
|
+
// a common gotcha in forms with both reset and submit buttons,
|
|
663
|
+
// where the dev forgets to add type="button" to the reset button.
|
|
664
|
+
if (__DEV__ && typeof document !== 'undefined') {
|
|
665
|
+
// Safely get the active element (works with IE)
|
|
666
|
+
var activeElement = getActiveElement();
|
|
667
|
+
if (activeElement !== null && activeElement instanceof HTMLButtonElement) {
|
|
668
|
+
invariant(activeElement.attributes && activeElement.attributes.getNamedItem('type'), 'You submitted a Formik form using a button with an unspecified `type` attribute. Most browsers default button elements to `type="submit"`. If this is not a submit button, please add `type="button"`.');
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
submitForm()["catch"](function (reason) {
|
|
672
|
+
console.warn("Warning: An unhandled error was caught from submitForm()", reason);
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
var imperativeMethods = {
|
|
676
|
+
resetForm: resetForm,
|
|
677
|
+
validateForm: validateFormWithHighPriority,
|
|
678
|
+
validateField: validateField,
|
|
679
|
+
setErrors: setErrors,
|
|
680
|
+
setFieldError: setFieldError,
|
|
681
|
+
setFieldTouched: setFieldTouched,
|
|
682
|
+
setFieldValue: setFieldValue,
|
|
683
|
+
setStatus: setStatus,
|
|
684
|
+
setSubmitting: setSubmitting,
|
|
685
|
+
setTouched: setTouched,
|
|
686
|
+
setValues: setValues,
|
|
687
|
+
setFormikState: setFormikState,
|
|
688
|
+
submitForm: submitForm
|
|
689
|
+
};
|
|
690
|
+
var executeSubmit = useEventCallback(function () {
|
|
691
|
+
return onSubmit(state.values, imperativeMethods);
|
|
692
|
+
});
|
|
693
|
+
var handleReset = useEventCallback(function (e) {
|
|
694
|
+
if (e && e.preventDefault && isFunction(e.preventDefault)) {
|
|
695
|
+
e.preventDefault();
|
|
696
|
+
}
|
|
697
|
+
if (e && e.stopPropagation && isFunction(e.stopPropagation)) {
|
|
698
|
+
e.stopPropagation();
|
|
699
|
+
}
|
|
700
|
+
resetForm();
|
|
701
|
+
});
|
|
702
|
+
var getFieldMeta = React.useCallback(function (name) {
|
|
703
|
+
return {
|
|
704
|
+
value: getIn(state.values, name),
|
|
705
|
+
error: getIn(state.errors, name),
|
|
706
|
+
touched: !!getIn(state.touched, name),
|
|
707
|
+
initialValue: getIn(initialValues.current, name),
|
|
708
|
+
initialTouched: !!getIn(initialTouched.current, name),
|
|
709
|
+
initialError: getIn(initialErrors.current, name)
|
|
710
|
+
};
|
|
711
|
+
}, [state.errors, state.touched, state.values]);
|
|
712
|
+
var getFieldHelpers = React.useCallback(function (name) {
|
|
713
|
+
return {
|
|
714
|
+
setValue: function setValue(value, shouldValidate) {
|
|
715
|
+
return setFieldValue(name, value, shouldValidate);
|
|
716
|
+
},
|
|
717
|
+
setTouched: function setTouched(value, shouldValidate) {
|
|
718
|
+
return setFieldTouched(name, value, shouldValidate);
|
|
719
|
+
},
|
|
720
|
+
setError: function setError(value) {
|
|
721
|
+
return setFieldError(name, value);
|
|
722
|
+
}
|
|
723
|
+
};
|
|
724
|
+
}, [setFieldValue, setFieldTouched, setFieldError]);
|
|
725
|
+
var getFieldProps = React.useCallback(function (nameOrOptions) {
|
|
726
|
+
var isAnObject = isObject(nameOrOptions);
|
|
727
|
+
var name = isAnObject ? nameOrOptions.name : nameOrOptions;
|
|
728
|
+
var valueState = getIn(state.values, name);
|
|
729
|
+
var field = {
|
|
730
|
+
name: name,
|
|
731
|
+
value: valueState,
|
|
732
|
+
onChange: handleChange,
|
|
733
|
+
onBlur: handleBlur
|
|
734
|
+
};
|
|
735
|
+
if (isAnObject) {
|
|
736
|
+
var _ref4 = nameOrOptions,
|
|
737
|
+
type = _ref4.type,
|
|
738
|
+
valueProp = _ref4.value,
|
|
739
|
+
is = _ref4.as,
|
|
740
|
+
multiple = _ref4.multiple;
|
|
741
|
+
if (type === 'checkbox') {
|
|
742
|
+
if (valueProp === undefined) {
|
|
743
|
+
field.checked = !!valueState;
|
|
744
|
+
} else {
|
|
745
|
+
field.checked = !!(Array.isArray(valueState) && ~valueState.indexOf(valueProp));
|
|
746
|
+
field.value = valueProp;
|
|
747
|
+
}
|
|
748
|
+
} else if (type === 'radio') {
|
|
749
|
+
field.checked = valueState === valueProp;
|
|
750
|
+
field.value = valueProp;
|
|
751
|
+
} else if (is === 'select' && multiple) {
|
|
752
|
+
field.value = field.value || [];
|
|
753
|
+
field.multiple = true;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return field;
|
|
757
|
+
}, [handleBlur, handleChange, state.values]);
|
|
758
|
+
var dirty = React.useMemo(function () {
|
|
759
|
+
return !isEqual(initialValues.current, state.values);
|
|
760
|
+
}, [initialValues.current, state.values]);
|
|
761
|
+
var isValid = React.useMemo(function () {
|
|
762
|
+
return typeof isInitialValid !== 'undefined' ? dirty ? state.errors && Object.keys(state.errors).length === 0 : isInitialValid !== false && isFunction(isInitialValid) ? isInitialValid(props) : isInitialValid : state.errors && Object.keys(state.errors).length === 0;
|
|
763
|
+
}, [isInitialValid, dirty, state.errors, props]);
|
|
764
|
+
var ctx = _extends({}, state, {
|
|
765
|
+
initialValues: initialValues.current,
|
|
766
|
+
initialErrors: initialErrors.current,
|
|
767
|
+
initialTouched: initialTouched.current,
|
|
768
|
+
initialStatus: initialStatus.current,
|
|
769
|
+
handleBlur: handleBlur,
|
|
770
|
+
handleChange: handleChange,
|
|
771
|
+
handleReset: handleReset,
|
|
772
|
+
handleSubmit: handleSubmit,
|
|
773
|
+
resetForm: resetForm,
|
|
774
|
+
setErrors: setErrors,
|
|
775
|
+
setFormikState: setFormikState,
|
|
776
|
+
setFieldTouched: setFieldTouched,
|
|
777
|
+
setFieldValue: setFieldValue,
|
|
778
|
+
setFieldError: setFieldError,
|
|
779
|
+
setStatus: setStatus,
|
|
780
|
+
setSubmitting: setSubmitting,
|
|
781
|
+
setTouched: setTouched,
|
|
782
|
+
setValues: setValues,
|
|
783
|
+
submitForm: submitForm,
|
|
784
|
+
validateForm: validateFormWithHighPriority,
|
|
785
|
+
validateField: validateField,
|
|
786
|
+
isValid: isValid,
|
|
787
|
+
dirty: dirty,
|
|
788
|
+
unregisterField: unregisterField,
|
|
789
|
+
registerField: registerField,
|
|
790
|
+
getFieldProps: getFieldProps,
|
|
791
|
+
getFieldMeta: getFieldMeta,
|
|
792
|
+
getFieldHelpers: getFieldHelpers,
|
|
793
|
+
validateOnBlur: validateOnBlur,
|
|
794
|
+
validateOnChange: validateOnChange,
|
|
795
|
+
validateOnMount: validateOnMount
|
|
796
|
+
});
|
|
797
|
+
return ctx;
|
|
798
|
+
}
|
|
799
|
+
export function FormWrapper(props) {
|
|
800
|
+
var formikbag = useFormik(props);
|
|
801
|
+
var component = props.component,
|
|
802
|
+
children = props.children,
|
|
803
|
+
render = props.render,
|
|
804
|
+
innerRef = props.innerRef;
|
|
805
|
+
|
|
806
|
+
// This allows folks to pass a ref to <Formik />
|
|
807
|
+
React.useImperativeHandle(innerRef, function () {
|
|
808
|
+
return formikbag;
|
|
809
|
+
});
|
|
810
|
+
if (__DEV__) {
|
|
811
|
+
React.useEffect(function () {
|
|
812
|
+
invariant(!props.render, "<Formik render> has been deprecated and will be removed in future versions of Formik. Please use a child callback function instead. To get rid of this warning, replace <Formik render={(props) => ...} /> with <Formik>{(props) => ...}</Formik>");
|
|
813
|
+
}, []);
|
|
814
|
+
}
|
|
815
|
+
return /*#__PURE__*/React.createElement(FormikProvider, {
|
|
816
|
+
value: formikbag
|
|
817
|
+
}, component ? /*#__PURE__*/React.createElement(component, formikbag) : render ? render(formikbag) : children // children come last, always called
|
|
818
|
+
? isFunction(children) ? children(formikbag) : !isEmptyChildren(children) ? React.Children.only(children) : null : null);
|
|
819
|
+
}
|
|
820
|
+
function warnAboutMissingIdentifier(_ref5) {
|
|
821
|
+
var htmlContent = _ref5.htmlContent,
|
|
822
|
+
documentationAnchorLink = _ref5.documentationAnchorLink,
|
|
823
|
+
handlerName = _ref5.handlerName;
|
|
824
|
+
console.warn("Warning: Formik called `".concat(handlerName, "`, but you forgot to pass an `id` or `name` attribute to your input:\n ").concat(htmlContent, "\n Formik cannot determine which value to update. For more info see https://formik.org/docs/api/formik#").concat(documentationAnchorLink, "\n "));
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Transform Yup ValidationError to a more usable object
|
|
829
|
+
*/
|
|
830
|
+
export function yupToFormErrors(yupError) {
|
|
831
|
+
var errors = {};
|
|
832
|
+
if (yupError.inner) {
|
|
833
|
+
if (yupError.inner.length === 0) {
|
|
834
|
+
return setIn(errors, yupError.path, yupError.message);
|
|
835
|
+
}
|
|
836
|
+
var _iterator = _createForOfIteratorHelper(yupError.inner),
|
|
837
|
+
_step;
|
|
838
|
+
try {
|
|
839
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
840
|
+
var err = _step.value;
|
|
841
|
+
if (!getIn(errors, err.path)) {
|
|
842
|
+
errors = setIn(errors, err.path, err.message);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
} catch (err) {
|
|
846
|
+
_iterator.e(err);
|
|
847
|
+
} finally {
|
|
848
|
+
_iterator.f();
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
return errors;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/**
|
|
855
|
+
* Validate a yup schema.
|
|
856
|
+
*/
|
|
857
|
+
export function validateYupSchema(values, schema) {
|
|
858
|
+
var sync = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
859
|
+
var context = arguments.length > 3 ? arguments[3] : undefined;
|
|
860
|
+
var normalizedValues = prepareDataForValidation(values);
|
|
861
|
+
return schema[sync ? 'validateSync' : 'validate'](normalizedValues, {
|
|
862
|
+
abortEarly: false,
|
|
863
|
+
context: context || normalizedValues
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Recursively prepare values.
|
|
869
|
+
*/
|
|
870
|
+
export function prepareDataForValidation(values) {
|
|
871
|
+
var data = Array.isArray(values) ? [] : {};
|
|
872
|
+
for (var k in values) {
|
|
873
|
+
if (Object.prototype.hasOwnProperty.call(values, k)) {
|
|
874
|
+
var key = String(k);
|
|
875
|
+
if (Array.isArray(values[key]) === true) {
|
|
876
|
+
data[key] = values[key].map(function (value) {
|
|
877
|
+
if (Array.isArray(value) === true || isPlainObject(value)) {
|
|
878
|
+
return prepareDataForValidation(value);
|
|
879
|
+
} else {
|
|
880
|
+
return value !== '' ? value : undefined;
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
} else if (isPlainObject(values[key])) {
|
|
884
|
+
data[key] = prepareDataForValidation(values[key]);
|
|
885
|
+
} else {
|
|
886
|
+
data[key] = values[key] !== '' ? values[key] : undefined;
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
return data;
|
|
891
|
+
}
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* deepmerge array merging algorithm
|
|
895
|
+
* https://github.com/KyleAMathews/deepmerge#combine-array
|
|
896
|
+
*/
|
|
897
|
+
function arrayMerge(target, source, options) {
|
|
898
|
+
var destination = target.slice();
|
|
899
|
+
source.forEach(function merge(e, i) {
|
|
900
|
+
if (typeof destination[i] === 'undefined') {
|
|
901
|
+
var cloneRequested = options.clone !== false;
|
|
902
|
+
var shouldClone = cloneRequested && options.isMergeableObject(e);
|
|
903
|
+
destination[i] = shouldClone ? deepmerge({}, e, options) : e;
|
|
904
|
+
} else if (options.isMergeableObject(e)) {
|
|
905
|
+
destination[i] = deepmerge(target[i], e, options);
|
|
906
|
+
} else if (target.indexOf(e) === -1) {
|
|
907
|
+
destination.push(e);
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
return destination;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/** Return multi select values based on an array of options */
|
|
914
|
+
function getSelectedValues(options) {
|
|
915
|
+
return Array.from(options).filter(function (el) {
|
|
916
|
+
return el.selected;
|
|
917
|
+
}).map(function (el) {
|
|
918
|
+
return el.value;
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/** Return the next value for a checkbox */
|
|
923
|
+
function getValueForCheckbox(currentValue, checked, valueProp) {
|
|
924
|
+
// If the current value was a boolean, return a boolean
|
|
925
|
+
if (typeof currentValue === 'boolean') {
|
|
926
|
+
return Boolean(checked);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
// If the currentValue was not a boolean we want to return an array
|
|
930
|
+
var currentArrayOfValues = [];
|
|
931
|
+
var isValueInArray = false;
|
|
932
|
+
var index = -1;
|
|
933
|
+
if (!Array.isArray(currentValue)) {
|
|
934
|
+
// eslint-disable-next-line eqeqeq
|
|
935
|
+
if (!valueProp || valueProp == 'true' || valueProp == 'false') {
|
|
936
|
+
return Boolean(checked);
|
|
937
|
+
}
|
|
938
|
+
} else {
|
|
939
|
+
// If the current value is already an array, use it
|
|
940
|
+
currentArrayOfValues = currentValue;
|
|
941
|
+
index = currentValue.indexOf(valueProp);
|
|
942
|
+
isValueInArray = index >= 0;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// If the checkbox was checked and the value is not already present in the aray we want to add the new value to the array of values
|
|
946
|
+
if (checked && valueProp && !isValueInArray) {
|
|
947
|
+
return currentArrayOfValues.concat(valueProp);
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
// If the checkbox was unchecked and the value is not in the array, simply return the already existing array of values
|
|
951
|
+
if (!isValueInArray) {
|
|
952
|
+
return currentArrayOfValues;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// If the checkbox was unchecked and the value is in the array, remove the value and return the array
|
|
956
|
+
return currentArrayOfValues.slice(0, index).concat(currentArrayOfValues.slice(index + 1));
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
// React currently throws a warning when using useLayoutEffect on the server.
|
|
960
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
961
|
+
// useLayoutEffect in the browser.
|
|
962
|
+
// @see https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85
|
|
963
|
+
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? React.useLayoutEffect : React.useEffect;
|
|
964
|
+
function useEventCallback(fn) {
|
|
965
|
+
var ref = React.useRef(fn);
|
|
966
|
+
|
|
967
|
+
// we copy a ref to the callback scoped to the current state/props on each render
|
|
968
|
+
useIsomorphicLayoutEffect(function () {
|
|
969
|
+
ref.current = fn;
|
|
970
|
+
});
|
|
971
|
+
return React.useCallback(function () {
|
|
972
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
973
|
+
args[_key] = arguments[_key];
|
|
974
|
+
}
|
|
975
|
+
return ref.current.apply(void 0, args);
|
|
976
|
+
}, []);
|
|
977
|
+
}
|