@cyclone-ui/state 0.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/LICENSE +187 -0
- package/README.md +302 -0
- package/dist/base/atoms/atom-with-broadcast.cjs +1 -0
- package/dist/base/atoms/atom-with-broadcast.d.cts +13 -0
- package/dist/base/atoms/atom-with-broadcast.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-broadcast.d.mts +13 -0
- package/dist/base/atoms/atom-with-broadcast.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-broadcast.mjs +2 -0
- package/dist/base/atoms/atom-with-broadcast.mjs.map +1 -0
- package/dist/base/atoms/atom-with-compare.cjs +1 -0
- package/dist/base/atoms/atom-with-compare.d.cts +5 -0
- package/dist/base/atoms/atom-with-compare.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-compare.d.mts +5 -0
- package/dist/base/atoms/atom-with-compare.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-compare.mjs +2 -0
- package/dist/base/atoms/atom-with-compare.mjs.map +1 -0
- package/dist/base/atoms/atom-with-debounce.cjs +1 -0
- package/dist/base/atoms/atom-with-debounce.d.cts +12 -0
- package/dist/base/atoms/atom-with-debounce.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-debounce.d.mts +12 -0
- package/dist/base/atoms/atom-with-debounce.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-debounce.mjs +2 -0
- package/dist/base/atoms/atom-with-debounce.mjs.map +1 -0
- package/dist/base/atoms/atom-with-effect.cjs +1 -0
- package/dist/base/atoms/atom-with-effect.d.cts +14 -0
- package/dist/base/atoms/atom-with-effect.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-effect.d.mts +14 -0
- package/dist/base/atoms/atom-with-effect.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-effect.mjs +2 -0
- package/dist/base/atoms/atom-with-effect.mjs.map +1 -0
- package/dist/base/atoms/atom-with-listeners.cjs +1 -0
- package/dist/base/atoms/atom-with-listeners.d.cts +13 -0
- package/dist/base/atoms/atom-with-listeners.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-listeners.d.mts +13 -0
- package/dist/base/atoms/atom-with-listeners.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-listeners.mjs +2 -0
- package/dist/base/atoms/atom-with-listeners.mjs.map +1 -0
- package/dist/base/atoms/atom-with-pending.cjs +1 -0
- package/dist/base/atoms/atom-with-pending.d.cts +12 -0
- package/dist/base/atoms/atom-with-pending.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-pending.d.mts +12 -0
- package/dist/base/atoms/atom-with-pending.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-pending.mjs +2 -0
- package/dist/base/atoms/atom-with-pending.mjs.map +1 -0
- package/dist/base/atoms/atom-with-refresh-and-default.cjs +1 -0
- package/dist/base/atoms/atom-with-refresh-and-default.d.cts +6 -0
- package/dist/base/atoms/atom-with-refresh-and-default.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-refresh-and-default.d.mts +6 -0
- package/dist/base/atoms/atom-with-refresh-and-default.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-refresh-and-default.mjs +2 -0
- package/dist/base/atoms/atom-with-refresh-and-default.mjs.map +1 -0
- package/dist/base/atoms/atom-with-refresh.cjs +1 -0
- package/dist/base/atoms/atom-with-refresh.d.cts +6 -0
- package/dist/base/atoms/atom-with-refresh.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-refresh.d.mts +6 -0
- package/dist/base/atoms/atom-with-refresh.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-refresh.mjs +2 -0
- package/dist/base/atoms/atom-with-refresh.mjs.map +1 -0
- package/dist/base/atoms/atom-with-toggle.cjs +1 -0
- package/dist/base/atoms/atom-with-toggle.d.cts +6 -0
- package/dist/base/atoms/atom-with-toggle.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-toggle.d.mts +6 -0
- package/dist/base/atoms/atom-with-toggle.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-toggle.mjs +2 -0
- package/dist/base/atoms/atom-with-toggle.mjs.map +1 -0
- package/dist/base/atoms/atom-with-web-storage.cjs +1 -0
- package/dist/base/atoms/atom-with-web-storage.d.cts +20 -0
- package/dist/base/atoms/atom-with-web-storage.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-web-storage.d.mts +20 -0
- package/dist/base/atoms/atom-with-web-storage.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-web-storage.mjs +2 -0
- package/dist/base/atoms/atom-with-web-storage.mjs.map +1 -0
- package/dist/base/atoms/atom-with-wrapper.cjs +1 -0
- package/dist/base/atoms/atom-with-wrapper.d.cts +18 -0
- package/dist/base/atoms/atom-with-wrapper.d.cts.map +1 -0
- package/dist/base/atoms/atom-with-wrapper.d.mts +18 -0
- package/dist/base/atoms/atom-with-wrapper.d.mts.map +1 -0
- package/dist/base/atoms/atom-with-wrapper.mjs +2 -0
- package/dist/base/atoms/atom-with-wrapper.mjs.map +1 -0
- package/dist/base/atoms/base-atom.cjs +1 -0
- package/dist/base/atoms/base-atom.mjs +2 -0
- package/dist/base/atoms/base-atom.mjs.map +1 -0
- package/dist/base/atoms/index.cjs +1 -0
- package/dist/base/atoms/index.d.cts +12 -0
- package/dist/base/atoms/index.d.mts +12 -0
- package/dist/base/atoms/index.mjs +1 -0
- package/dist/base/hooks/index.cjs +1 -0
- package/dist/base/hooks/index.d.cts +5 -0
- package/dist/base/hooks/index.d.mts +5 -0
- package/dist/base/hooks/index.mjs +1 -0
- package/dist/base/hooks/use-atom-effect.cjs +1 -0
- package/dist/base/hooks/use-atom-effect.d.cts +11 -0
- package/dist/base/hooks/use-atom-effect.d.cts.map +1 -0
- package/dist/base/hooks/use-atom-effect.d.mts +11 -0
- package/dist/base/hooks/use-atom-effect.d.mts.map +1 -0
- package/dist/base/hooks/use-atom-effect.mjs +2 -0
- package/dist/base/hooks/use-atom-effect.mjs.map +1 -0
- package/dist/base/hooks/use-hydrate-molecule.cjs +1 -0
- package/dist/base/hooks/use-hydrate-molecule.d.cts +11 -0
- package/dist/base/hooks/use-hydrate-molecule.d.cts.map +1 -0
- package/dist/base/hooks/use-hydrate-molecule.d.mts +11 -0
- package/dist/base/hooks/use-hydrate-molecule.d.mts.map +1 -0
- package/dist/base/hooks/use-hydrate-molecule.mjs +2 -0
- package/dist/base/hooks/use-hydrate-molecule.mjs.map +1 -0
- package/dist/base/hooks/use-prepare-atoms.cjs +1 -0
- package/dist/base/hooks/use-prepare-atoms.d.cts +8 -0
- package/dist/base/hooks/use-prepare-atoms.d.cts.map +1 -0
- package/dist/base/hooks/use-prepare-atoms.d.mts +8 -0
- package/dist/base/hooks/use-prepare-atoms.d.mts.map +1 -0
- package/dist/base/hooks/use-prepare-atoms.mjs +2 -0
- package/dist/base/hooks/use-prepare-atoms.mjs.map +1 -0
- package/dist/base/hooks/use-sync-molecule.cjs +1 -0
- package/dist/base/hooks/use-sync-molecule.d.cts +10 -0
- package/dist/base/hooks/use-sync-molecule.d.cts.map +1 -0
- package/dist/base/hooks/use-sync-molecule.d.mts +10 -0
- package/dist/base/hooks/use-sync-molecule.d.mts.map +1 -0
- package/dist/base/hooks/use-sync-molecule.mjs +2 -0
- package/dist/base/hooks/use-sync-molecule.mjs.map +1 -0
- package/dist/base/index.cjs +1 -0
- package/dist/base/index.d.cts +23 -0
- package/dist/base/index.d.mts +23 -0
- package/dist/base/index.mjs +1 -0
- package/dist/base/utilities/create-molecule.cjs +4 -0
- package/dist/base/utilities/create-molecule.d.cts +68 -0
- package/dist/base/utilities/create-molecule.d.cts.map +1 -0
- package/dist/base/utilities/create-molecule.d.mts +68 -0
- package/dist/base/utilities/create-molecule.d.mts.map +1 -0
- package/dist/base/utilities/create-molecule.mjs +5 -0
- package/dist/base/utilities/create-molecule.mjs.map +1 -0
- package/dist/base/utilities/create-web-storage.cjs +1 -0
- package/dist/base/utilities/create-web-storage.d.cts +6 -0
- package/dist/base/utilities/create-web-storage.d.cts.map +1 -0
- package/dist/base/utilities/create-web-storage.d.mts +6 -0
- package/dist/base/utilities/create-web-storage.d.mts.map +1 -0
- package/dist/base/utilities/create-web-storage.mjs +2 -0
- package/dist/base/utilities/create-web-storage.mjs.map +1 -0
- package/dist/base/utilities/debounce.cjs +1 -0
- package/dist/base/utilities/debounce.d.cts +19 -0
- package/dist/base/utilities/debounce.d.cts.map +1 -0
- package/dist/base/utilities/debounce.d.mts +19 -0
- package/dist/base/utilities/debounce.d.mts.map +1 -0
- package/dist/base/utilities/debounce.mjs +2 -0
- package/dist/base/utilities/debounce.mjs.map +1 -0
- package/dist/base/utilities/index.cjs +1 -0
- package/dist/base/utilities/index.d.cts +5 -0
- package/dist/base/utilities/index.d.mts +5 -0
- package/dist/base/utilities/index.mjs +1 -0
- package/dist/base/utilities/is-atom.cjs +1 -0
- package/dist/base/utilities/is-atom.mjs +2 -0
- package/dist/base/utilities/is-atom.mjs.map +1 -0
- package/dist/base/utilities/set-atom-debug.cjs +1 -0
- package/dist/base/utilities/set-atom-debug.d.cts +18 -0
- package/dist/base/utilities/set-atom-debug.d.cts.map +1 -0
- package/dist/base/utilities/set-atom-debug.d.mts +18 -0
- package/dist/base/utilities/set-atom-debug.d.mts.map +1 -0
- package/dist/base/utilities/set-atom-debug.mjs +2 -0
- package/dist/base/utilities/set-atom-debug.mjs.map +1 -0
- package/dist/client/index.cjs +1 -0
- package/dist/client/index.d.cts +8 -0
- package/dist/client/index.d.mts +8 -0
- package/dist/client/index.mjs +1 -0
- package/dist/form/atoms/atom-with-field.cjs +1 -0
- package/dist/form/atoms/atom-with-field.mjs +2 -0
- package/dist/form/atoms/atom-with-field.mjs.map +1 -0
- package/dist/form/atoms/atom-with-messages.cjs +1 -0
- package/dist/form/atoms/atom-with-messages.mjs +2 -0
- package/dist/form/atoms/atom-with-messages.mjs.map +1 -0
- package/dist/form/hooks/index.cjs +1 -0
- package/dist/form/hooks/index.d.cts +4 -0
- package/dist/form/hooks/index.d.mts +4 -0
- package/dist/form/hooks/index.mjs +1 -0
- package/dist/form/hooks/use-field-actions.cjs +1 -0
- package/dist/form/hooks/use-field-actions.d.cts +17 -0
- package/dist/form/hooks/use-field-actions.d.cts.map +1 -0
- package/dist/form/hooks/use-field-actions.d.mts +17 -0
- package/dist/form/hooks/use-field-actions.d.mts.map +1 -0
- package/dist/form/hooks/use-field-actions.mjs +2 -0
- package/dist/form/hooks/use-field-actions.mjs.map +1 -0
- package/dist/form/hooks/use-field-ref.cjs +1 -0
- package/dist/form/hooks/use-field-ref.d.cts +6 -0
- package/dist/form/hooks/use-field-ref.d.cts.map +1 -0
- package/dist/form/hooks/use-field-ref.d.mts +6 -0
- package/dist/form/hooks/use-field-ref.d.mts.map +1 -0
- package/dist/form/hooks/use-field-ref.mjs +2 -0
- package/dist/form/hooks/use-field-ref.mjs.map +1 -0
- package/dist/form/hooks/use-form-actions.cjs +1 -0
- package/dist/form/hooks/use-form-actions.d.cts +13 -0
- package/dist/form/hooks/use-form-actions.d.cts.map +1 -0
- package/dist/form/hooks/use-form-actions.d.mts +13 -0
- package/dist/form/hooks/use-form-actions.d.mts.map +1 -0
- package/dist/form/hooks/use-form-actions.mjs +2 -0
- package/dist/form/hooks/use-form-actions.mjs.map +1 -0
- package/dist/form/index.cjs +1 -0
- package/dist/form/index.d.cts +16 -0
- package/dist/form/index.d.mts +16 -0
- package/dist/form/index.mjs +1 -0
- package/dist/form/molecules/field-molecule.cjs +1 -0
- package/dist/form/molecules/field-molecule.d.cts +9 -0
- package/dist/form/molecules/field-molecule.d.cts.map +1 -0
- package/dist/form/molecules/field-molecule.d.mts +9 -0
- package/dist/form/molecules/field-molecule.d.mts.map +1 -0
- package/dist/form/molecules/field-molecule.mjs +2 -0
- package/dist/form/molecules/field-molecule.mjs.map +1 -0
- package/dist/form/molecules/form-molecule.cjs +1 -0
- package/dist/form/molecules/form-molecule.d.cts +9 -0
- package/dist/form/molecules/form-molecule.d.cts.map +1 -0
- package/dist/form/molecules/form-molecule.d.mts +9 -0
- package/dist/form/molecules/form-molecule.d.mts.map +1 -0
- package/dist/form/molecules/form-molecule.mjs +2 -0
- package/dist/form/molecules/form-molecule.mjs.map +1 -0
- package/dist/form/molecules/index.cjs +1 -0
- package/dist/form/molecules/index.d.cts +3 -0
- package/dist/form/molecules/index.d.mts +3 -0
- package/dist/form/molecules/index.mjs +1 -0
- package/dist/form/providers/FieldProvider.cjs +4 -0
- package/dist/form/providers/FieldProvider.d.cts +10 -0
- package/dist/form/providers/FieldProvider.d.cts.map +1 -0
- package/dist/form/providers/FieldProvider.d.mts +10 -0
- package/dist/form/providers/FieldProvider.d.mts.map +1 -0
- package/dist/form/providers/FieldProvider.mjs +5 -0
- package/dist/form/providers/FieldProvider.mjs.map +1 -0
- package/dist/form/providers/FormProvider.cjs +4 -0
- package/dist/form/providers/FormProvider.d.cts +10 -0
- package/dist/form/providers/FormProvider.d.cts.map +1 -0
- package/dist/form/providers/FormProvider.d.mts +10 -0
- package/dist/form/providers/FormProvider.d.mts.map +1 -0
- package/dist/form/providers/FormProvider.mjs +5 -0
- package/dist/form/providers/FormProvider.mjs.map +1 -0
- package/dist/form/providers/index.cjs +1 -0
- package/dist/form/providers/index.d.cts +3 -0
- package/dist/form/providers/index.d.mts +3 -0
- package/dist/form/providers/index.mjs +1 -0
- package/dist/form/types.cjs +1 -0
- package/dist/form/types.d.cts +288 -0
- package/dist/form/types.d.cts.map +1 -0
- package/dist/form/types.d.mts +288 -0
- package/dist/form/types.d.mts.map +1 -0
- package/dist/form/types.mjs +2 -0
- package/dist/form/types.mjs.map +1 -0
- package/dist/form/utilities/abort-error.cjs +1 -0
- package/dist/form/utilities/abort-error.d.cts +13 -0
- package/dist/form/utilities/abort-error.d.cts.map +1 -0
- package/dist/form/utilities/abort-error.d.mts +13 -0
- package/dist/form/utilities/abort-error.d.mts.map +1 -0
- package/dist/form/utilities/abort-error.mjs +2 -0
- package/dist/form/utilities/abort-error.mjs.map +1 -0
- package/dist/form/utilities/index.cjs +1 -0
- package/dist/form/utilities/index.d.cts +4 -0
- package/dist/form/utilities/index.d.mts +4 -0
- package/dist/form/utilities/index.mjs +1 -0
- package/dist/form/utilities/is-validation-results.cjs +1 -0
- package/dist/form/utilities/is-validation-results.d.cts +6 -0
- package/dist/form/utilities/is-validation-results.d.cts.map +1 -0
- package/dist/form/utilities/is-validation-results.d.mts +6 -0
- package/dist/form/utilities/is-validation-results.d.mts.map +1 -0
- package/dist/form/utilities/is-validation-results.mjs +2 -0
- package/dist/form/utilities/is-validation-results.mjs.map +1 -0
- package/dist/form/utilities/validators.cjs +1 -0
- package/dist/form/utilities/validators.d.cts +6 -0
- package/dist/form/utilities/validators.d.cts.map +1 -0
- package/dist/form/utilities/validators.d.mts +6 -0
- package/dist/form/utilities/validators.d.mts.map +1 -0
- package/dist/form/utilities/validators.mjs +2 -0
- package/dist/form/utilities/validators.mjs.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +34 -0
- package/dist/index.d.mts +34 -0
- package/dist/index.mjs +1 -0
- package/dist/message/components/MessageViewport.cjs +1 -0
- package/dist/message/components/MessageViewport.d.cts +19 -0
- package/dist/message/components/MessageViewport.d.cts.map +1 -0
- package/dist/message/components/MessageViewport.d.mts +19 -0
- package/dist/message/components/MessageViewport.d.mts.map +1 -0
- package/dist/message/components/MessageViewport.mjs +2 -0
- package/dist/message/components/MessageViewport.mjs.map +1 -0
- package/dist/message/components/index.cjs +1 -0
- package/dist/message/components/index.d.cts +2 -0
- package/dist/message/components/index.d.mts +2 -0
- package/dist/message/components/index.mjs +1 -0
- package/dist/message/hooks/index.cjs +1 -0
- package/dist/message/hooks/index.d.cts +2 -0
- package/dist/message/hooks/index.d.mts +2 -0
- package/dist/message/hooks/index.mjs +1 -0
- package/dist/message/hooks/use-message-actions.cjs +1 -0
- package/dist/message/hooks/use-message-actions.d.cts +21 -0
- package/dist/message/hooks/use-message-actions.d.cts.map +1 -0
- package/dist/message/hooks/use-message-actions.d.mts +21 -0
- package/dist/message/hooks/use-message-actions.d.mts.map +1 -0
- package/dist/message/hooks/use-message-actions.mjs +2 -0
- package/dist/message/hooks/use-message-actions.mjs.map +1 -0
- package/dist/message/index.cjs +1 -0
- package/dist/message/index.d.cts +9 -0
- package/dist/message/index.d.mts +9 -0
- package/dist/message/index.mjs +1 -0
- package/dist/message/providers/MessageProvider.cjs +1 -0
- package/dist/message/providers/MessageProvider.d.cts +21 -0
- package/dist/message/providers/MessageProvider.d.cts.map +1 -0
- package/dist/message/providers/MessageProvider.d.mts +21 -0
- package/dist/message/providers/MessageProvider.d.mts.map +1 -0
- package/dist/message/providers/MessageProvider.mjs +2 -0
- package/dist/message/providers/MessageProvider.mjs.map +1 -0
- package/dist/message/providers/index.d.cts +2 -0
- package/dist/message/providers/index.d.mts +2 -0
- package/dist/message/types.d.cts +6 -0
- package/dist/message/types.d.cts.map +1 -0
- package/dist/message/types.d.mts +6 -0
- package/dist/message/types.d.mts.map +1 -0
- package/dist/theme/hooks/index.cjs +1 -0
- package/dist/theme/hooks/index.d.cts +3 -0
- package/dist/theme/hooks/index.d.mts +3 -0
- package/dist/theme/hooks/index.mjs +1 -0
- package/dist/theme/hooks/use-theme-actions.cjs +1 -0
- package/dist/theme/hooks/use-theme-actions.d.cts +11 -0
- package/dist/theme/hooks/use-theme-actions.d.cts.map +1 -0
- package/dist/theme/hooks/use-theme-actions.d.mts +11 -0
- package/dist/theme/hooks/use-theme-actions.d.mts.map +1 -0
- package/dist/theme/hooks/use-theme-actions.mjs +2 -0
- package/dist/theme/hooks/use-theme-actions.mjs.map +1 -0
- package/dist/theme/hooks/use-theme-store.cjs +1 -0
- package/dist/theme/hooks/use-theme-store.d.cts +49 -0
- package/dist/theme/hooks/use-theme-store.d.cts.map +1 -0
- package/dist/theme/hooks/use-theme-store.d.mts +49 -0
- package/dist/theme/hooks/use-theme-store.d.mts.map +1 -0
- package/dist/theme/hooks/use-theme-store.mjs +2 -0
- package/dist/theme/hooks/use-theme-store.mjs.map +1 -0
- package/dist/theme/index.cjs +1 -0
- package/dist/theme/index.d.cts +9 -0
- package/dist/theme/index.d.mts +9 -0
- package/dist/theme/index.mjs +1 -0
- package/dist/theme/molecules/index.cjs +1 -0
- package/dist/theme/molecules/index.d.cts +2 -0
- package/dist/theme/molecules/index.d.mts +2 -0
- package/dist/theme/molecules/index.mjs +1 -0
- package/dist/theme/molecules/theme-molecule.cjs +1 -0
- package/dist/theme/molecules/theme-molecule.d.cts +14 -0
- package/dist/theme/molecules/theme-molecule.d.cts.map +1 -0
- package/dist/theme/molecules/theme-molecule.d.mts +14 -0
- package/dist/theme/molecules/theme-molecule.d.mts.map +1 -0
- package/dist/theme/molecules/theme-molecule.mjs +2 -0
- package/dist/theme/molecules/theme-molecule.mjs.map +1 -0
- package/dist/theme/providers/ThemeProvider.cjs +5 -0
- package/dist/theme/providers/ThemeProvider.d.cts +13 -0
- package/dist/theme/providers/ThemeProvider.d.cts.map +1 -0
- package/dist/theme/providers/ThemeProvider.d.mts +13 -0
- package/dist/theme/providers/ThemeProvider.d.mts.map +1 -0
- package/dist/theme/providers/ThemeProvider.mjs +6 -0
- package/dist/theme/providers/ThemeProvider.mjs.map +1 -0
- package/dist/theme/types.cjs +1 -0
- package/dist/theme/types.d.cts +41 -0
- package/dist/theme/types.d.cts.map +1 -0
- package/dist/theme/types.d.mts +41 -0
- package/dist/theme/types.d.mts.map +1 -0
- package/dist/theme/types.mjs +2 -0
- package/dist/theme/types.mjs.map +1 -0
- package/dist/theme/utilities/theme-helpers.cjs +1 -0
- package/dist/theme/utilities/theme-helpers.d.cts +55 -0
- package/dist/theme/utilities/theme-helpers.d.cts.map +1 -0
- package/dist/theme/utilities/theme-helpers.d.mts +55 -0
- package/dist/theme/utilities/theme-helpers.d.mts.map +1 -0
- package/dist/theme/utilities/theme-helpers.mjs +2 -0
- package/dist/theme/utilities/theme-helpers.mjs.map +1 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.cts +55 -0
- package/dist/types.d.cts.map +1 -0
- package/dist/types.d.mts +55 -0
- package/dist/types.d.mts.map +1 -0
- package/dist/types.mjs +0 -0
- package/package.json +146 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { AtomRecordConstraint, SetStateActionWithReset, SplitAtomAction } from "../types.cjs";
|
|
2
|
+
import { MoleculeState } from "../base/utilities/create-molecule.cjs";
|
|
3
|
+
import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
|
|
4
|
+
import { RESET } from "jotai/utils";
|
|
5
|
+
import { Ref } from "react";
|
|
6
|
+
import { MaskitoOptions } from "@maskito/core";
|
|
7
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
8
|
+
import { SelectOption, SelectOptionValue } from "@stryke/types/form";
|
|
9
|
+
import { IsPlainObject } from "@stryke/types/object";
|
|
10
|
+
import { ValidationDetail } from "@stryke/types/validations";
|
|
11
|
+
//#region src/form/types.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* "server" is only intended for SSR/SSG validation and should not execute anything
|
|
14
|
+
*/
|
|
15
|
+
type ValidationCause = "initialize" | "change" | "blur" | "submit" | "server";
|
|
16
|
+
declare const ValidationCause: {
|
|
17
|
+
INITIALIZE: ValidationCause;
|
|
18
|
+
CHANGE: ValidationCause;
|
|
19
|
+
BLUR: ValidationCause;
|
|
20
|
+
SUBMIT: ValidationCause;
|
|
21
|
+
SERVER: ValidationCause;
|
|
22
|
+
};
|
|
23
|
+
type Validator<TValue = any> = (value: TValue, previousValue: TValue, cause: ValidationCause, get: Getter, set: Setter) => MaybePromise<ValidationDetail[]>;
|
|
24
|
+
type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* The field status.
|
|
27
|
+
*/
|
|
28
|
+
type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
|
|
29
|
+
type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
|
|
30
|
+
type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
|
|
31
|
+
type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
|
|
32
|
+
type FieldChangeEventHandler<TFieldValue = any> = (event: CustomEvent<TFieldValue>) => any;
|
|
33
|
+
interface CallbackContext<TState extends AtomRecordConstraint<TState> = Record<string, Atom<unknown>>> {
|
|
34
|
+
get: Getter;
|
|
35
|
+
set: Setter;
|
|
36
|
+
atoms: MoleculeState<TState>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The form options.
|
|
40
|
+
*/
|
|
41
|
+
interface FormOptions<TFormValues extends Record<string, any> = Record<string, any>> {
|
|
42
|
+
/**
|
|
43
|
+
* The theme of the form.
|
|
44
|
+
*/
|
|
45
|
+
theme?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The disabled state value.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The initial values of the form.
|
|
54
|
+
*/
|
|
55
|
+
initialValues?: FormValuesState<TFormValues>;
|
|
56
|
+
/**
|
|
57
|
+
* The validations to run on the form when certain events occur.
|
|
58
|
+
*/
|
|
59
|
+
validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<FormValuesState<TFormValues>>[] | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* How long to debounce the `onChange` event and validation calls in milliseconds.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue 250
|
|
64
|
+
*/
|
|
65
|
+
debounceMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* A function that compares two sets of form values to determine if they are equal.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* The default `isEqual` function is provided by the `@stryke/discoveryers` package.
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `isEqual`
|
|
73
|
+
*/
|
|
74
|
+
isEqual?: (value1: FormValuesState<TFormValues>, value2: FormValuesState<TFormValues>) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The default options provided to all fields when they are created.
|
|
77
|
+
*/
|
|
78
|
+
defaultFieldOptions?: Partial<Omit<FieldOptions<TFormValues>, "name" | "mode">>;
|
|
79
|
+
/**
|
|
80
|
+
* A callback that is called when the form is initialized.
|
|
81
|
+
*/
|
|
82
|
+
onInitialize?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* A callback that is called when the form is changed.
|
|
85
|
+
*/
|
|
86
|
+
onChange?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* A callback that is called when the form is submitted.
|
|
89
|
+
*/
|
|
90
|
+
onSubmit?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
91
|
+
}
|
|
92
|
+
type FormOptionsState<TFormValues extends Record<string, any> = Record<string, any>> = FormOptions<TFormValues> & Required<Pick<FormOptions<TFormValues>, "theme" | "debounceMs" | "isEqual" | "disabled" | "initialValues" | "defaultFieldOptions">>;
|
|
93
|
+
interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any>> {
|
|
94
|
+
options: WritableAtom<FormOptionsState<TFormValues>, [SetStateActionWithReset<FormOptions<TFormValues>>], void>;
|
|
95
|
+
name: Atom<string>;
|
|
96
|
+
initialValues: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
|
|
97
|
+
previousValues: Atom<FormValuesState<TFormValues>>;
|
|
98
|
+
values: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
|
|
99
|
+
disabled: WritableAtom<boolean, [typeof RESET | SetStateAction<boolean>], void>;
|
|
100
|
+
formValidating: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
101
|
+
validationResults: WritableAtom<ValidationResults, [SetStateActionWithReset<ValidationResults>], void>;
|
|
102
|
+
submitting: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
103
|
+
submitted: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
104
|
+
submitAttempts: WritableAtom<number, [SetStateActionWithReset<number>], void>;
|
|
105
|
+
focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
106
|
+
requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
107
|
+
disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
108
|
+
touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
109
|
+
blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
110
|
+
validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
111
|
+
validationResultsFields: WritableAtom<InferFormState<TFormValues, ValidationResults>, [SetStateActionWithReset<InferFormState<TFormValues, ValidationResults>>], void>;
|
|
112
|
+
tabIndexes: WritableAtom<InferFormState<TFormValues, number>, [{
|
|
113
|
+
field: string;
|
|
114
|
+
tabIndex?: number;
|
|
115
|
+
} | SetStateActionWithReset<InferFormState<TFormValues, number>>], void>;
|
|
116
|
+
refs: WritableAtom<InferFormState<TFormValues, Ref<HTMLInputElement>>, [SetStateActionWithReset<InferFormState<TFormValues, Ref<HTMLInputElement>>>], void>;
|
|
117
|
+
dirty: Atom<boolean>;
|
|
118
|
+
pristine: Atom<boolean>;
|
|
119
|
+
blurred: Atom<boolean>;
|
|
120
|
+
touched: Atom<boolean>;
|
|
121
|
+
validating: Atom<boolean>;
|
|
122
|
+
dangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
123
|
+
warningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
124
|
+
infoMessages: Atom<ValidationDetail<"info">[]>;
|
|
125
|
+
discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
126
|
+
successMessages: Atom<ValidationDetail<"success">[]>;
|
|
127
|
+
positiveMessages: Atom<ValidationDetail<"positive">[]>;
|
|
128
|
+
negativeMessages: Atom<ValidationDetail<"negative">[]>;
|
|
129
|
+
messages: Atom<ValidationDetail[]>;
|
|
130
|
+
dangerFields: Atom<InferFieldState<TFormValues, ValidationDetail<"danger">[]>>;
|
|
131
|
+
warningFields: Atom<InferFieldState<TFormValues, ValidationDetail<"warning">[]>>;
|
|
132
|
+
infoFields: Atom<InferFieldState<TFormValues, ValidationDetail<"info">[]>>;
|
|
133
|
+
discoveryFields: Atom<InferFieldState<TFormValues, ValidationDetail<"discovery">[]>>;
|
|
134
|
+
successFields: Atom<InferFieldState<TFormValues, ValidationDetail<"success">[]>>;
|
|
135
|
+
fieldDangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
136
|
+
fieldWarningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
137
|
+
fieldInfoMessages: Atom<ValidationDetail<"info">[]>;
|
|
138
|
+
fieldHelpMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
139
|
+
fieldsSuccessMessages: Atom<ValidationDetail<"success">[]>;
|
|
140
|
+
valid: Atom<boolean>;
|
|
141
|
+
invalid: Atom<boolean>;
|
|
142
|
+
canSubmit: Atom<boolean>;
|
|
143
|
+
theme: Atom<string>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The field options.
|
|
147
|
+
*/
|
|
148
|
+
interface FieldOptions<TFieldValue> {
|
|
149
|
+
/**
|
|
150
|
+
* The default theme of the field.
|
|
151
|
+
*/
|
|
152
|
+
theme?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The default size of the field.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue "$true"
|
|
157
|
+
*/
|
|
158
|
+
size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
|
|
159
|
+
/**
|
|
160
|
+
* The default required status of the field.
|
|
161
|
+
*
|
|
162
|
+
* @defaultValue false
|
|
163
|
+
*/
|
|
164
|
+
required?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The default disabled status of the field.
|
|
167
|
+
*
|
|
168
|
+
* @defaultValue false
|
|
169
|
+
*/
|
|
170
|
+
disabled?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether the field's value can be cleared by its control.
|
|
173
|
+
*
|
|
174
|
+
* @defaultValue false
|
|
175
|
+
*/
|
|
176
|
+
clearable?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The options to be used as potential values for the field.
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* This is only used for certain fields (e.g. `Select`, `RadioGroup`, etc.).
|
|
182
|
+
*/
|
|
183
|
+
items?: Array<Partial<SelectOption> & Pick<SelectOption, "name" | "value">>;
|
|
184
|
+
/**
|
|
185
|
+
* The validations to run on the field when certain events occur.
|
|
186
|
+
*/
|
|
187
|
+
validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<TFieldValue>[] | undefined>;
|
|
188
|
+
/**
|
|
189
|
+
* How long to debounce the `onChange` event and validation calls in milliseconds.
|
|
190
|
+
*
|
|
191
|
+
* @defaultValue 250
|
|
192
|
+
*/
|
|
193
|
+
debounceMs?: number;
|
|
194
|
+
/**
|
|
195
|
+
* A function that compares two field values to determine if they are equal.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* The default `isEqual` function is provided by the `@stryke/discoveryers` package.
|
|
199
|
+
*
|
|
200
|
+
* @defaultValue `isEqual`
|
|
201
|
+
*/
|
|
202
|
+
isEqual?: (value1: TFieldValue, value2: TFieldValue) => boolean;
|
|
203
|
+
/**
|
|
204
|
+
* The options provided to the Maskito library when masking user input
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* More information can be found in the [Maskito documentation](https://maskito.dev/core-concepts/overview).
|
|
208
|
+
*
|
|
209
|
+
* API reference: https://github.com/taiga-family/maskito/blob/main/projects/core/src/lib/types/mask-options.ts
|
|
210
|
+
*/
|
|
211
|
+
mask?: MaskitoOptions;
|
|
212
|
+
/**
|
|
213
|
+
* A callback that is called when the field is initialized.
|
|
214
|
+
*/
|
|
215
|
+
onInitialize?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* A callback that is called when the field is blurred.
|
|
218
|
+
*/
|
|
219
|
+
onBlur?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* A callback that is called when the field is focused.
|
|
222
|
+
*/
|
|
223
|
+
onFocus?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* A callback that is called when the field is changed.
|
|
226
|
+
*/
|
|
227
|
+
onChange?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* A callback that is called when the field is submitted.
|
|
230
|
+
*/
|
|
231
|
+
onSubmit?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* A function that formats the field value for display.
|
|
234
|
+
*/
|
|
235
|
+
format?: (value: TFieldValue) => string;
|
|
236
|
+
/**
|
|
237
|
+
* A function that parses the field value for storage.
|
|
238
|
+
*/
|
|
239
|
+
parse?: (value: any) => TFieldValue;
|
|
240
|
+
[key: string]: any;
|
|
241
|
+
}
|
|
242
|
+
type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
|
|
243
|
+
interface FieldAtoms<TFieldValue> {
|
|
244
|
+
options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
|
|
245
|
+
form: Atom<string>;
|
|
246
|
+
name: Atom<string>;
|
|
247
|
+
path: Atom<string[]>;
|
|
248
|
+
focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
249
|
+
required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
250
|
+
disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
251
|
+
clearable: Atom<boolean>;
|
|
252
|
+
touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
253
|
+
blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
254
|
+
validating: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
255
|
+
validationResults: WritableAtom<InferFieldState<TFieldValue, ValidationResults>, [SetStateAction<InferFieldState<TFieldValue, ValidationResults>>], void>;
|
|
256
|
+
tabIndex: WritableAtom<InferFieldState<TFieldValue, number>, [SetStateAction<InferFieldState<TFieldValue, number>>], void>;
|
|
257
|
+
ref: WritableAtom<InferFieldState<TFieldValue, Ref<HTMLInputElement>>, [SetStateAction<InferFieldState<TFieldValue, Ref<HTMLInputElement>>>], void>;
|
|
258
|
+
pristine: Atom<boolean>;
|
|
259
|
+
dirty: Atom<boolean>;
|
|
260
|
+
previousValue: Atom<TFieldValue | null>;
|
|
261
|
+
initialValue: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
|
|
262
|
+
value: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
|
|
263
|
+
formattedValue: Atom<string>;
|
|
264
|
+
items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
|
|
265
|
+
itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
|
|
266
|
+
size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
|
|
267
|
+
errors: Atom<ValidationDetail<"danger">[]>;
|
|
268
|
+
warnings: Atom<ValidationDetail<"warning">[]>;
|
|
269
|
+
info: Atom<ValidationDetail<"info">[]>;
|
|
270
|
+
discovery: Atom<ValidationDetail<"discovery">[]>;
|
|
271
|
+
success: Atom<ValidationDetail<"success">[]>;
|
|
272
|
+
positive: Atom<ValidationDetail<"positive">[]>;
|
|
273
|
+
negative: Atom<ValidationDetail<"negative">[]>;
|
|
274
|
+
dangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
275
|
+
warningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
276
|
+
infoMessages: Atom<ValidationDetail<"info">[]>;
|
|
277
|
+
discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
278
|
+
successMessages: Atom<ValidationDetail<"success">[]>;
|
|
279
|
+
positiveMessages: Atom<ValidationDetail<"positive">[]>;
|
|
280
|
+
negativeMessages: Atom<ValidationDetail<"negative">[]>;
|
|
281
|
+
theme: Atom<string>;
|
|
282
|
+
messages: Atom<ValidationDetail[]>;
|
|
283
|
+
invalid: Atom<boolean>;
|
|
284
|
+
valid: Atom<boolean>;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
export { CallbackContext, FieldAtoms, FieldChangeEventHandler, FieldOptions, FieldOptionsState, FieldStatus, FormAtoms, FormOptions, FormOptionsState, FormValuesState, InferFieldState, InferFormState, ValidationCause, ValidationResults, Validator };
|
|
288
|
+
//# sourceMappingURL=types.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/form/types.ts"],"mappings":"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"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { AtomRecordConstraint, SetStateActionWithReset, SplitAtomAction } from "../types.mjs";
|
|
2
|
+
import { MoleculeState } from "../base/utilities/create-molecule.mjs";
|
|
3
|
+
import { RESET } from "jotai/utils";
|
|
4
|
+
import { Atom, Getter, PrimitiveAtom, SetStateAction, Setter, WritableAtom } from "jotai";
|
|
5
|
+
import { Ref } from "react";
|
|
6
|
+
import { MaskitoOptions } from "@maskito/core";
|
|
7
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
8
|
+
import { SelectOption, SelectOptionValue } from "@stryke/types/form";
|
|
9
|
+
import { IsPlainObject } from "@stryke/types/object";
|
|
10
|
+
import { ValidationDetail } from "@stryke/types/validations";
|
|
11
|
+
//#region src/form/types.d.ts
|
|
12
|
+
/**
|
|
13
|
+
* "server" is only intended for SSR/SSG validation and should not execute anything
|
|
14
|
+
*/
|
|
15
|
+
type ValidationCause = "initialize" | "change" | "blur" | "submit" | "server";
|
|
16
|
+
declare const ValidationCause: {
|
|
17
|
+
INITIALIZE: ValidationCause;
|
|
18
|
+
CHANGE: ValidationCause;
|
|
19
|
+
BLUR: ValidationCause;
|
|
20
|
+
SUBMIT: ValidationCause;
|
|
21
|
+
SERVER: ValidationCause;
|
|
22
|
+
};
|
|
23
|
+
type Validator<TValue = any> = (value: TValue, previousValue: TValue, cause: ValidationCause, get: Getter, set: Setter) => MaybePromise<ValidationDetail[]>;
|
|
24
|
+
type ValidationResults = Partial<Record<ValidationCause, ValidationDetail[]>>;
|
|
25
|
+
/**
|
|
26
|
+
* The field status.
|
|
27
|
+
*/
|
|
28
|
+
type FieldStatus = "primary" | "secondary" | "discovery" | "success" | "info" | "warning" | "danger" | "positive" | "negative";
|
|
29
|
+
type InferFieldState<TValues, TState> = IsPlainObject<TValues> extends true ? { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; } : TState;
|
|
30
|
+
type InferFormState<TValues extends Record<string, any>, TState> = { [TKey in keyof TValues]: InferFieldState<TValues[TKey], TState>; };
|
|
31
|
+
type FormValuesState<TValues extends Record<string, any>> = TValues & { [TKey in keyof TValues]: IsPlainObject<TValues[TKey]> extends true ? FormValuesState<TValues[TKey]> : TValues[TKey] | null; };
|
|
32
|
+
type FieldChangeEventHandler<TFieldValue = any> = (event: CustomEvent<TFieldValue>) => any;
|
|
33
|
+
interface CallbackContext<TState extends AtomRecordConstraint<TState> = Record<string, Atom<unknown>>> {
|
|
34
|
+
get: Getter;
|
|
35
|
+
set: Setter;
|
|
36
|
+
atoms: MoleculeState<TState>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The form options.
|
|
40
|
+
*/
|
|
41
|
+
interface FormOptions<TFormValues extends Record<string, any> = Record<string, any>> {
|
|
42
|
+
/**
|
|
43
|
+
* The theme of the form.
|
|
44
|
+
*/
|
|
45
|
+
theme?: string;
|
|
46
|
+
/**
|
|
47
|
+
* The disabled state value.
|
|
48
|
+
*
|
|
49
|
+
* @defaultValue false
|
|
50
|
+
*/
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* The initial values of the form.
|
|
54
|
+
*/
|
|
55
|
+
initialValues?: FormValuesState<TFormValues>;
|
|
56
|
+
/**
|
|
57
|
+
* The validations to run on the form when certain events occur.
|
|
58
|
+
*/
|
|
59
|
+
validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<FormValuesState<TFormValues>>[] | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* How long to debounce the `onChange` event and validation calls in milliseconds.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue 250
|
|
64
|
+
*/
|
|
65
|
+
debounceMs?: number;
|
|
66
|
+
/**
|
|
67
|
+
* A function that compares two sets of form values to determine if they are equal.
|
|
68
|
+
*
|
|
69
|
+
* @remarks
|
|
70
|
+
* The default `isEqual` function is provided by the `@stryke/discoveryers` package.
|
|
71
|
+
*
|
|
72
|
+
* @defaultValue `isEqual`
|
|
73
|
+
*/
|
|
74
|
+
isEqual?: (value1: FormValuesState<TFormValues>, value2: FormValuesState<TFormValues>) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* The default options provided to all fields when they are created.
|
|
77
|
+
*/
|
|
78
|
+
defaultFieldOptions?: Partial<Omit<FieldOptions<TFormValues>, "name" | "mode">>;
|
|
79
|
+
/**
|
|
80
|
+
* A callback that is called when the form is initialized.
|
|
81
|
+
*/
|
|
82
|
+
onInitialize?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* A callback that is called when the form is changed.
|
|
85
|
+
*/
|
|
86
|
+
onChange?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
87
|
+
/**
|
|
88
|
+
* A callback that is called when the form is submitted.
|
|
89
|
+
*/
|
|
90
|
+
onSubmit?: (context: CallbackContext<FormAtoms<TFormValues>>) => MaybePromise<void>;
|
|
91
|
+
}
|
|
92
|
+
type FormOptionsState<TFormValues extends Record<string, any> = Record<string, any>> = FormOptions<TFormValues> & Required<Pick<FormOptions<TFormValues>, "theme" | "debounceMs" | "isEqual" | "disabled" | "initialValues" | "defaultFieldOptions">>;
|
|
93
|
+
interface FormAtoms<TFormValues extends Record<string, any> = Record<string, any>> {
|
|
94
|
+
options: WritableAtom<FormOptionsState<TFormValues>, [SetStateActionWithReset<FormOptions<TFormValues>>], void>;
|
|
95
|
+
name: Atom<string>;
|
|
96
|
+
initialValues: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
|
|
97
|
+
previousValues: Atom<FormValuesState<TFormValues>>;
|
|
98
|
+
values: WritableAtom<FormValuesState<TFormValues>, [typeof RESET | SetStateAction<FormValuesState<TFormValues>>], void>;
|
|
99
|
+
disabled: WritableAtom<boolean, [typeof RESET | SetStateAction<boolean>], void>;
|
|
100
|
+
formValidating: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
101
|
+
validationResults: WritableAtom<ValidationResults, [SetStateActionWithReset<ValidationResults>], void>;
|
|
102
|
+
submitting: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
103
|
+
submitted: WritableAtom<boolean, [SetStateActionWithReset<boolean>], void>;
|
|
104
|
+
submitAttempts: WritableAtom<number, [SetStateActionWithReset<number>], void>;
|
|
105
|
+
focusedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
106
|
+
requiredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
107
|
+
disabledFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
108
|
+
touchedFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
109
|
+
blurredFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
110
|
+
validatingFields: WritableAtom<InferFormState<TFormValues, boolean>, [SetStateActionWithReset<InferFormState<TFormValues, boolean>>], void>;
|
|
111
|
+
validationResultsFields: WritableAtom<InferFormState<TFormValues, ValidationResults>, [SetStateActionWithReset<InferFormState<TFormValues, ValidationResults>>], void>;
|
|
112
|
+
tabIndexes: WritableAtom<InferFormState<TFormValues, number>, [{
|
|
113
|
+
field: string;
|
|
114
|
+
tabIndex?: number;
|
|
115
|
+
} | SetStateActionWithReset<InferFormState<TFormValues, number>>], void>;
|
|
116
|
+
refs: WritableAtom<InferFormState<TFormValues, Ref<HTMLInputElement>>, [SetStateActionWithReset<InferFormState<TFormValues, Ref<HTMLInputElement>>>], void>;
|
|
117
|
+
dirty: Atom<boolean>;
|
|
118
|
+
pristine: Atom<boolean>;
|
|
119
|
+
blurred: Atom<boolean>;
|
|
120
|
+
touched: Atom<boolean>;
|
|
121
|
+
validating: Atom<boolean>;
|
|
122
|
+
dangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
123
|
+
warningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
124
|
+
infoMessages: Atom<ValidationDetail<"info">[]>;
|
|
125
|
+
discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
126
|
+
successMessages: Atom<ValidationDetail<"success">[]>;
|
|
127
|
+
positiveMessages: Atom<ValidationDetail<"positive">[]>;
|
|
128
|
+
negativeMessages: Atom<ValidationDetail<"negative">[]>;
|
|
129
|
+
messages: Atom<ValidationDetail[]>;
|
|
130
|
+
dangerFields: Atom<InferFieldState<TFormValues, ValidationDetail<"danger">[]>>;
|
|
131
|
+
warningFields: Atom<InferFieldState<TFormValues, ValidationDetail<"warning">[]>>;
|
|
132
|
+
infoFields: Atom<InferFieldState<TFormValues, ValidationDetail<"info">[]>>;
|
|
133
|
+
discoveryFields: Atom<InferFieldState<TFormValues, ValidationDetail<"discovery">[]>>;
|
|
134
|
+
successFields: Atom<InferFieldState<TFormValues, ValidationDetail<"success">[]>>;
|
|
135
|
+
fieldDangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
136
|
+
fieldWarningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
137
|
+
fieldInfoMessages: Atom<ValidationDetail<"info">[]>;
|
|
138
|
+
fieldHelpMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
139
|
+
fieldsSuccessMessages: Atom<ValidationDetail<"success">[]>;
|
|
140
|
+
valid: Atom<boolean>;
|
|
141
|
+
invalid: Atom<boolean>;
|
|
142
|
+
canSubmit: Atom<boolean>;
|
|
143
|
+
theme: Atom<string>;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* The field options.
|
|
147
|
+
*/
|
|
148
|
+
interface FieldOptions<TFieldValue> {
|
|
149
|
+
/**
|
|
150
|
+
* The default theme of the field.
|
|
151
|
+
*/
|
|
152
|
+
theme?: string;
|
|
153
|
+
/**
|
|
154
|
+
* The default size of the field.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue "$true"
|
|
157
|
+
*/
|
|
158
|
+
size?: `$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`;
|
|
159
|
+
/**
|
|
160
|
+
* The default required status of the field.
|
|
161
|
+
*
|
|
162
|
+
* @defaultValue false
|
|
163
|
+
*/
|
|
164
|
+
required?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* The default disabled status of the field.
|
|
167
|
+
*
|
|
168
|
+
* @defaultValue false
|
|
169
|
+
*/
|
|
170
|
+
disabled?: boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Whether the field's value can be cleared by its control.
|
|
173
|
+
*
|
|
174
|
+
* @defaultValue false
|
|
175
|
+
*/
|
|
176
|
+
clearable?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* The options to be used as potential values for the field.
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* This is only used for certain fields (e.g. `Select`, `RadioGroup`, etc.).
|
|
182
|
+
*/
|
|
183
|
+
items?: Array<Partial<SelectOption> & Pick<SelectOption, "name" | "value">>;
|
|
184
|
+
/**
|
|
185
|
+
* The validations to run on the field when certain events occur.
|
|
186
|
+
*/
|
|
187
|
+
validate?: Record<`on${Capitalize<ValidationCause>}`, Validator<TFieldValue>[] | undefined>;
|
|
188
|
+
/**
|
|
189
|
+
* How long to debounce the `onChange` event and validation calls in milliseconds.
|
|
190
|
+
*
|
|
191
|
+
* @defaultValue 250
|
|
192
|
+
*/
|
|
193
|
+
debounceMs?: number;
|
|
194
|
+
/**
|
|
195
|
+
* A function that compares two field values to determine if they are equal.
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* The default `isEqual` function is provided by the `@stryke/discoveryers` package.
|
|
199
|
+
*
|
|
200
|
+
* @defaultValue `isEqual`
|
|
201
|
+
*/
|
|
202
|
+
isEqual?: (value1: TFieldValue, value2: TFieldValue) => boolean;
|
|
203
|
+
/**
|
|
204
|
+
* The options provided to the Maskito library when masking user input
|
|
205
|
+
*
|
|
206
|
+
* @remarks
|
|
207
|
+
* More information can be found in the [Maskito documentation](https://maskito.dev/core-concepts/overview).
|
|
208
|
+
*
|
|
209
|
+
* API reference: https://github.com/taiga-family/maskito/blob/main/projects/core/src/lib/types/mask-options.ts
|
|
210
|
+
*/
|
|
211
|
+
mask?: MaskitoOptions;
|
|
212
|
+
/**
|
|
213
|
+
* A callback that is called when the field is initialized.
|
|
214
|
+
*/
|
|
215
|
+
onInitialize?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* A callback that is called when the field is blurred.
|
|
218
|
+
*/
|
|
219
|
+
onBlur?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* A callback that is called when the field is focused.
|
|
222
|
+
*/
|
|
223
|
+
onFocus?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* A callback that is called when the field is changed.
|
|
226
|
+
*/
|
|
227
|
+
onChange?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* A callback that is called when the field is submitted.
|
|
230
|
+
*/
|
|
231
|
+
onSubmit?: (context: CallbackContext<FieldAtoms<TFieldValue>>) => MaybePromise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* A function that formats the field value for display.
|
|
234
|
+
*/
|
|
235
|
+
format?: (value: TFieldValue) => string;
|
|
236
|
+
/**
|
|
237
|
+
* A function that parses the field value for storage.
|
|
238
|
+
*/
|
|
239
|
+
parse?: (value: any) => TFieldValue;
|
|
240
|
+
[key: string]: any;
|
|
241
|
+
}
|
|
242
|
+
type FieldOptionsState<TFieldValue = any> = FieldOptions<TFieldValue> & Required<Pick<FieldOptions<TFieldValue>, "theme" | "size" | "debounceMs" | "isEqual" | "disabled" | "clearable" | "required" | "initialValue">>;
|
|
243
|
+
interface FieldAtoms<TFieldValue> {
|
|
244
|
+
options: WritableAtom<FieldOptionsState<TFieldValue>, [SetStateActionWithReset<FieldOptions<TFieldValue>>], void>;
|
|
245
|
+
form: Atom<string>;
|
|
246
|
+
name: Atom<string>;
|
|
247
|
+
path: Atom<string[]>;
|
|
248
|
+
focused: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
249
|
+
required: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
250
|
+
disabled: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
251
|
+
clearable: Atom<boolean>;
|
|
252
|
+
touched: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
253
|
+
blurred: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
254
|
+
validating: WritableAtom<InferFieldState<TFieldValue, boolean>, [SetStateAction<InferFieldState<TFieldValue, boolean>>], void>;
|
|
255
|
+
validationResults: WritableAtom<InferFieldState<TFieldValue, ValidationResults>, [SetStateAction<InferFieldState<TFieldValue, ValidationResults>>], void>;
|
|
256
|
+
tabIndex: WritableAtom<InferFieldState<TFieldValue, number>, [SetStateAction<InferFieldState<TFieldValue, number>>], void>;
|
|
257
|
+
ref: WritableAtom<InferFieldState<TFieldValue, Ref<HTMLInputElement>>, [SetStateAction<InferFieldState<TFieldValue, Ref<HTMLInputElement>>>], void>;
|
|
258
|
+
pristine: Atom<boolean>;
|
|
259
|
+
dirty: Atom<boolean>;
|
|
260
|
+
previousValue: Atom<TFieldValue | null>;
|
|
261
|
+
initialValue: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
|
|
262
|
+
value: WritableAtom<TFieldValue, [SetStateAction<TFieldValue>], void>;
|
|
263
|
+
formattedValue: Atom<string>;
|
|
264
|
+
items: WritableAtom<SelectOption<SelectOptionValue, string>[], [SetStateAction<SelectOption<SelectOptionValue, string>[]>], void>;
|
|
265
|
+
itemsAtoms: WritableAtom<PrimitiveAtom<SelectOption<SelectOptionValue, string>>[], [SplitAtomAction<SelectOption<SelectOptionValue, string>>], void>;
|
|
266
|
+
size: WritableAtom<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`, [SetStateAction<`$${string}` | `$${string}.${string}` | `$${string}.${number}` | `$${number}`>], void>;
|
|
267
|
+
errors: Atom<ValidationDetail<"danger">[]>;
|
|
268
|
+
warnings: Atom<ValidationDetail<"warning">[]>;
|
|
269
|
+
info: Atom<ValidationDetail<"info">[]>;
|
|
270
|
+
discovery: Atom<ValidationDetail<"discovery">[]>;
|
|
271
|
+
success: Atom<ValidationDetail<"success">[]>;
|
|
272
|
+
positive: Atom<ValidationDetail<"positive">[]>;
|
|
273
|
+
negative: Atom<ValidationDetail<"negative">[]>;
|
|
274
|
+
dangerMessages: Atom<ValidationDetail<"danger">[]>;
|
|
275
|
+
warningMessages: Atom<ValidationDetail<"warning">[]>;
|
|
276
|
+
infoMessages: Atom<ValidationDetail<"info">[]>;
|
|
277
|
+
discoveryMessages: Atom<ValidationDetail<"discovery">[]>;
|
|
278
|
+
successMessages: Atom<ValidationDetail<"success">[]>;
|
|
279
|
+
positiveMessages: Atom<ValidationDetail<"positive">[]>;
|
|
280
|
+
negativeMessages: Atom<ValidationDetail<"negative">[]>;
|
|
281
|
+
theme: Atom<string>;
|
|
282
|
+
messages: Atom<ValidationDetail[]>;
|
|
283
|
+
invalid: Atom<boolean>;
|
|
284
|
+
valid: Atom<boolean>;
|
|
285
|
+
}
|
|
286
|
+
//#endregion
|
|
287
|
+
export { CallbackContext, FieldAtoms, FieldChangeEventHandler, FieldOptions, FieldOptionsState, FieldStatus, FormAtoms, FormOptions, FormOptionsState, FormValuesState, InferFieldState, InferFormState, ValidationCause, ValidationResults, Validator };
|
|
288
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.mts","names":[],"sources":["../../src/form/types.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=class extends Error{name=`AbortError`;constructor(e=`Aborted`){super(e)}};exports.AbortError=e;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/form/utilities/abort-error.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error used to cancel in-flight form validation when a provider unmounts.
|
|
4
|
+
*
|
|
5
|
+
* `@stryke/async` no longer exports `AbortError`.
|
|
6
|
+
*/
|
|
7
|
+
declare class AbortError extends Error {
|
|
8
|
+
name: string;
|
|
9
|
+
constructor(message?: string);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AbortError };
|
|
13
|
+
//# sourceMappingURL=abort-error.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-error.d.cts","names":[],"sources":["../../../src/form/utilities/abort-error.ts"],"mappings":";;;;;;cAuBa,mBAAmB;EACrB;EAEG,YAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/form/utilities/abort-error.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Error used to cancel in-flight form validation when a provider unmounts.
|
|
4
|
+
*
|
|
5
|
+
* `@stryke/async` no longer exports `AbortError`.
|
|
6
|
+
*/
|
|
7
|
+
declare class AbortError extends Error {
|
|
8
|
+
name: string;
|
|
9
|
+
constructor(message?: string);
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AbortError };
|
|
13
|
+
//# sourceMappingURL=abort-error.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-error.d.mts","names":[],"sources":["../../../src/form/utilities/abort-error.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abort-error.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./is-validation-results.cjs"),t=require("./validators.cjs"),n=require("./abort-error.cjs");exports.AbortError=n.AbortError,exports.isValidationResults=e.isValidationResults,exports.requiredValidator=t.requiredValidator;
|