thread-ui 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -18
- package/dist/components/form-elements/dropdown/dropdown.d.ts +14 -0
- package/dist/components/form-elements/dropdown/dropdown.d.ts.map +1 -0
- package/dist/components/form-elements/dropdown/dropdown.js +83 -0
- package/dist/components/form-elements/dropdown/dropdown.js.map +1 -0
- package/dist/components/form-elements/dropdown/dropdown.types.d.ts +24 -0
- package/dist/components/form-elements/dropdown/dropdown.types.d.ts.map +1 -0
- package/dist/components/form-elements/dropdown/dropdown.types.js +2 -0
- package/dist/components/form-elements/dropdown/dropdown.types.js.map +1 -0
- package/dist/components/form-elements/dropdown/index.d.ts +3 -0
- package/dist/components/form-elements/dropdown/index.d.ts.map +1 -0
- package/dist/components/form-elements/dropdown/index.js +2 -0
- package/dist/components/form-elements/dropdown/index.js.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-input.d.ts +2 -0
- package/dist/components/form-elements/file-upload/components/file-input.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-input.js +93 -0
- package/dist/components/form-elements/file-upload/components/file-input.js.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-upload-content.d.ts +2 -0
- package/dist/components/form-elements/file-upload/components/file-upload-content.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-upload-content.js +28 -0
- package/dist/components/form-elements/file-upload/components/file-upload-content.js.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-upload-preview.d.ts +2 -0
- package/dist/components/form-elements/file-upload/components/file-upload-preview.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/components/file-upload-preview.js +51 -0
- package/dist/components/form-elements/file-upload/components/file-upload-preview.js.map +1 -0
- package/dist/components/form-elements/file-upload/components/item-previews.d.ts +12 -0
- package/dist/components/form-elements/file-upload/components/item-previews.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/components/item-previews.js +58 -0
- package/dist/components/form-elements/file-upload/components/item-previews.js.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload-context.d.ts +3 -0
- package/dist/components/form-elements/file-upload/file-upload-context.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload-context.js +4 -0
- package/dist/components/form-elements/file-upload/file-upload-context.js.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload.d.ts +20 -0
- package/dist/components/form-elements/file-upload/file-upload.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload.js +148 -0
- package/dist/components/form-elements/file-upload/file-upload.js.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload.types.d.ts +36 -0
- package/dist/components/form-elements/file-upload/file-upload.types.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/file-upload.types.js +2 -0
- package/dist/components/form-elements/file-upload/file-upload.types.js.map +1 -0
- package/dist/components/form-elements/file-upload/index.d.ts +3 -0
- package/dist/components/form-elements/file-upload/index.d.ts.map +1 -0
- package/dist/components/form-elements/file-upload/index.js +2 -0
- package/dist/components/form-elements/file-upload/index.js.map +1 -0
- package/dist/components/form-elements/form-label/form-label.d.ts +6 -0
- package/dist/components/form-elements/form-label/form-label.d.ts.map +1 -1
- package/dist/components/form-elements/form-label/form-label.js +8 -2
- package/dist/components/form-elements/form-label/form-label.js.map +1 -1
- package/dist/components/form-elements/form-label/form-label.types.d.ts +3 -0
- package/dist/components/form-elements/form-label/form-label.types.d.ts.map +1 -1
- package/dist/components/form-elements/index.d.ts +2 -0
- package/dist/components/form-elements/index.d.ts.map +1 -1
- package/dist/components/form-elements/index.js +2 -0
- package/dist/components/form-elements/index.js.map +1 -1
- package/dist/components/form-elements/input-props.types.d.ts +10 -3
- package/dist/components/form-elements/input-props.types.d.ts.map +1 -1
- package/dist/components/form-elements/number-input/number-input.d.ts +15 -1
- package/dist/components/form-elements/number-input/number-input.d.ts.map +1 -1
- package/dist/components/form-elements/number-input/number-input.js +82 -21
- package/dist/components/form-elements/number-input/number-input.js.map +1 -1
- package/dist/components/form-elements/number-input/number-input.types.d.ts +3 -0
- package/dist/components/form-elements/number-input/number-input.types.d.ts.map +1 -1
- package/dist/components/form-elements/styles/index.d.ts.map +1 -1
- package/dist/components/form-elements/styles/index.js +3 -1
- package/dist/components/form-elements/styles/index.js.map +1 -1
- package/dist/components/form-elements/text-input/text-input.d.ts +7 -1
- package/dist/components/form-elements/text-input/text-input.d.ts.map +1 -1
- package/dist/components/form-elements/text-input/text-input.js +8 -2
- package/dist/components/form-elements/text-input/text-input.js.map +1 -1
- package/dist/components/form-elements/text-input/text-input.types.d.ts +1 -0
- package/dist/components/form-elements/text-input/text-input.types.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/layouts/column-layout/column-layout.d.ts +11 -2
- package/dist/components/layouts/column-layout/column-layout.d.ts.map +1 -1
- package/dist/components/layouts/column-layout/column-layout.js +11 -2
- package/dist/components/layouts/column-layout/column-layout.js.map +1 -1
- package/dist/components/layouts/column-layout/column-layout.types.d.ts +8 -18
- package/dist/components/layouts/column-layout/column-layout.types.d.ts.map +1 -1
- package/dist/components/layouts/column-layout/column-skeleton/column-skeleton.js +1 -1
- package/dist/components/layouts/column-layout/column-skeleton/column-skeleton.js.map +1 -1
- package/dist/components/layouts/footer/footer.d.ts +13 -1
- package/dist/components/layouts/footer/footer.d.ts.map +1 -1
- package/dist/components/layouts/footer/footer.js +14 -2
- package/dist/components/layouts/footer/footer.js.map +1 -1
- package/dist/components/layouts/footer/footer.types.d.ts +7 -0
- package/dist/components/layouts/footer/footer.types.d.ts.map +1 -1
- package/dist/components/layouts/masonry-layout/masonry-layout.d.ts +9 -0
- package/dist/components/layouts/masonry-layout/masonry-layout.d.ts.map +1 -1
- package/dist/components/layouts/masonry-layout/masonry-layout.js +12 -3
- package/dist/components/layouts/masonry-layout/masonry-layout.js.map +1 -1
- package/dist/components/layouts/masonry-layout/masonry-layout.types.d.ts +3 -0
- package/dist/components/layouts/masonry-layout/masonry-layout.types.d.ts.map +1 -1
- package/dist/components/media/image-panel/image-panel.d.ts +14 -0
- package/dist/components/media/image-panel/image-panel.d.ts.map +1 -1
- package/dist/components/media/image-panel/image-panel.js +15 -1
- package/dist/components/media/image-panel/image-panel.js.map +1 -1
- package/dist/components/media/image-panel/image-panel.types.d.ts +8 -0
- package/dist/components/media/image-panel/image-panel.types.d.ts.map +1 -1
- package/dist/components/media/info-card/info-card.d.ts +11 -0
- package/dist/components/media/info-card/info-card.d.ts.map +1 -1
- package/dist/components/media/info-card/info-card.js +13 -2
- package/dist/components/media/info-card/info-card.js.map +1 -1
- package/dist/components/media/info-card/info-card.types.d.ts +10 -0
- package/dist/components/media/info-card/info-card.types.d.ts.map +1 -1
- package/dist/components/media/media-card/media-card.d.ts +13 -0
- package/dist/components/media/media-card/media-card.d.ts.map +1 -1
- package/dist/components/media/media-card/media-card.js +21 -6
- package/dist/components/media/media-card/media-card.js.map +1 -1
- package/dist/components/media/media-card/media-card.types.d.ts +13 -0
- package/dist/components/media/media-card/media-card.types.d.ts.map +1 -1
- package/dist/components/navigation/nav-menu/items/nav-drop-down-item/nav-drop-down-item.d.ts.map +1 -1
- package/dist/components/navigation/nav-menu/items/nav-drop-down-item/nav-drop-down-item.js +10 -7
- package/dist/components/navigation/nav-menu/items/nav-drop-down-item/nav-drop-down-item.js.map +1 -1
- package/dist/components/navigation/nav-menu/nav-menu.d.ts +13 -0
- package/dist/components/navigation/nav-menu/nav-menu.d.ts.map +1 -1
- package/dist/components/navigation/nav-menu/nav-menu.js +13 -0
- package/dist/components/navigation/nav-menu/nav-menu.js.map +1 -1
- package/dist/components/navigation/nav-menu/nav-menu.types.d.ts +2 -0
- package/dist/components/navigation/nav-menu/nav-menu.types.d.ts.map +1 -1
- package/dist/components/navigation/side-nav/side-nav-item/side-nav-item.js +1 -1
- package/dist/components/navigation/side-nav/side-nav-item/side-nav-item.js.map +1 -1
- package/dist/components/navigation/side-nav/side-nav-item/side-nav-item.types.d.ts.map +1 -1
- package/dist/components/navigation/side-nav/side-nav.d.ts +8 -2
- package/dist/components/navigation/side-nav/side-nav.d.ts.map +1 -1
- package/dist/components/navigation/side-nav/side-nav.js +8 -2
- package/dist/components/navigation/side-nav/side-nav.js.map +1 -1
- package/dist/components/navigation/side-nav/side-nav.types.d.ts +4 -0
- package/dist/components/navigation/side-nav/side-nav.types.d.ts.map +1 -1
- package/dist/components/typography/page-header/page-header.d.ts +6 -0
- package/dist/components/typography/page-header/page-header.d.ts.map +1 -1
- package/dist/components/typography/page-header/page-header.js +6 -0
- package/dist/components/typography/page-header/page-header.js.map +1 -1
- package/dist/components/typography/page-header/page-header.types.d.ts +3 -0
- package/dist/components/typography/page-header/page-header.types.d.ts.map +1 -1
- package/dist/components/typography/typography.d.ts +55 -0
- package/dist/components/typography/typography.d.ts.map +1 -1
- package/dist/components/typography/typography.js +48 -0
- package/dist/components/typography/typography.js.map +1 -1
- package/dist/components/ui/button/button-recipe.d.ts.map +1 -1
- package/dist/components/ui/button/button-recipe.js +1 -0
- package/dist/components/ui/button/button-recipe.js.map +1 -1
- package/dist/components/ui/button/button.d.ts +8 -0
- package/dist/components/ui/button/button.d.ts.map +1 -1
- package/dist/components/ui/button/button.js +8 -0
- package/dist/components/ui/button/button.js.map +1 -1
- package/dist/components/ui/button/button.types.d.ts +7 -0
- package/dist/components/ui/button/button.types.d.ts.map +1 -1
- package/dist/components/ui/card/card.d.ts +8 -0
- package/dist/components/ui/card/card.d.ts.map +1 -1
- package/dist/components/ui/card/card.js +8 -0
- package/dist/components/ui/card/card.js.map +1 -1
- package/dist/components/ui/card/card.types.d.ts +8 -1
- package/dist/components/ui/card/card.types.d.ts.map +1 -1
- package/dist/components/ui/divider/divider.d.ts +6 -0
- package/dist/components/ui/divider/divider.d.ts.map +1 -1
- package/dist/components/ui/divider/divider.js +6 -0
- package/dist/components/ui/divider/divider.js.map +1 -1
- package/dist/components/ui/divider/divider.types.d.ts +3 -0
- package/dist/components/ui/divider/divider.types.d.ts.map +1 -1
- package/dist/components/ui/icon/icon.d.ts +5 -7
- package/dist/components/ui/icon/icon.d.ts.map +1 -1
- package/dist/components/ui/icon/icon.js +5 -7
- package/dist/components/ui/icon/icon.js.map +1 -1
- package/dist/components/ui/icon/icon.types.d.ts +5 -0
- package/dist/components/ui/icon/icon.types.d.ts.map +1 -1
- package/dist/components/ui/icon-button/icon-button.d.ts +8 -0
- package/dist/components/ui/icon-button/icon-button.d.ts.map +1 -1
- package/dist/components/ui/icon-button/icon-button.js +9 -1
- package/dist/components/ui/icon-button/icon-button.js.map +1 -1
- package/dist/components/ui/icon-button/icon-button.types.d.ts +3 -1
- package/dist/components/ui/icon-button/icon-button.types.d.ts.map +1 -1
- package/dist/components/ui/index.d.ts +1 -0
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/modal/components/modal-content.d.ts +2 -0
- package/dist/components/ui/modal/components/modal-content.d.ts.map +1 -0
- package/dist/components/ui/modal/components/modal-content.js +98 -0
- package/dist/components/ui/modal/components/modal-content.js.map +1 -0
- package/dist/components/ui/modal/index.d.ts +3 -0
- package/dist/components/ui/modal/index.d.ts.map +1 -0
- package/dist/components/ui/modal/index.js +2 -0
- package/dist/components/ui/modal/index.js.map +1 -0
- package/dist/components/ui/modal/modal-context.d.ts +3 -0
- package/dist/components/ui/modal/modal-context.d.ts.map +1 -0
- package/dist/components/ui/modal/modal-context.js +4 -0
- package/dist/components/ui/modal/modal-context.js.map +1 -0
- package/dist/components/ui/modal/modal.d.ts +12 -0
- package/dist/components/ui/modal/modal.d.ts.map +1 -0
- package/dist/components/ui/modal/modal.js +44 -0
- package/dist/components/ui/modal/modal.js.map +1 -0
- package/dist/components/ui/modal/modal.types.d.ts +27 -0
- package/dist/components/ui/modal/modal.types.d.ts.map +1 -0
- package/dist/components/ui/modal/modal.types.js +2 -0
- package/dist/components/ui/modal/modal.types.js.map +1 -0
- package/dist/components/ui/toggle/toggle.d.ts +6 -1
- package/dist/components/ui/toggle/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle/toggle.js +6 -1
- package/dist/components/ui/toggle/toggle.js.map +1 -1
- package/dist/components/ui/toggle/toggle.types.d.ts +3 -0
- package/dist/components/ui/toggle/toggle.types.d.ts.map +1 -1
- package/dist/styled-system/styles.css +2034 -559
- package/dist/styled-system/tokens/index.mjs +9 -9
- package/dist/styles/panda.css +1 -1877
- package/dist/styles/thread.css +18 -5
- package/dist/theme/default-theme.js +6 -6
- package/dist/theme/default-theme.js.map +1 -1
- package/dist/theme/generate-override-css.d.ts +7 -0
- package/dist/theme/generate-override-css.d.ts.map +1 -0
- package/dist/theme/generate-override-css.js +66 -0
- package/dist/theme/generate-override-css.js.map +1 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.d.ts.map +1 -1
- package/dist/theme/index.js +2 -0
- package/dist/theme/index.js.map +1 -1
- package/dist/theme/theme-mode.d.ts +6 -0
- package/dist/theme/theme-mode.d.ts.map +1 -0
- package/dist/theme/theme-mode.js +17 -0
- package/dist/theme/theme-mode.js.map +1 -0
- package/dist/theme/theme-provider.d.ts +36 -0
- package/dist/theme/theme-provider.d.ts.map +1 -0
- package/dist/theme/theme-provider.js +76 -0
- package/dist/theme/theme-provider.js.map +1 -0
- package/dist/theme/thread-script.d.ts +27 -0
- package/dist/theme/thread-script.d.ts.map +1 -0
- package/dist/theme/thread-script.js +48 -0
- package/dist/theme/thread-script.js.map +1 -0
- package/dist/utils/context/create-component-context/create-component-context.d.ts +2 -0
- package/dist/utils/context/create-component-context/create-component-context.d.ts.map +1 -0
- package/dist/utils/context/create-component-context/create-component-context.js +14 -0
- package/dist/utils/context/create-component-context/create-component-context.js.map +1 -0
- package/dist/utils/context/create-component-context/index.d.ts +2 -0
- package/dist/utils/context/create-component-context/index.d.ts.map +1 -0
- package/dist/utils/context/create-component-context/index.js +2 -0
- package/dist/utils/context/create-component-context/index.js.map +1 -0
- package/dist/utils/context/index.d.ts +2 -0
- package/dist/utils/context/index.d.ts.map +1 -0
- package/dist/utils/context/index.js +2 -0
- package/dist/utils/context/index.js.map +1 -0
- package/dist/utils/{deep-merge → data-manipulation/deep-merge}/deep-merge.d.ts +1 -1
- package/dist/utils/data-manipulation/deep-merge/deep-merge.d.ts.map +1 -0
- package/dist/utils/data-manipulation/deep-merge/deep-merge.js.map +1 -0
- package/dist/utils/data-manipulation/deep-merge/index.d.ts.map +1 -0
- package/dist/utils/data-manipulation/deep-merge/index.js.map +1 -0
- package/dist/utils/data-manipulation/index.d.ts +2 -0
- package/dist/utils/data-manipulation/index.d.ts.map +1 -0
- package/dist/utils/data-manipulation/index.js +2 -0
- package/dist/utils/data-manipulation/index.js.map +1 -0
- package/dist/utils/hooks/index.d.ts +3 -0
- package/dist/utils/hooks/index.d.ts.map +1 -0
- package/dist/utils/hooks/index.js +3 -0
- package/dist/utils/hooks/index.js.map +1 -0
- package/dist/utils/hooks/use-outside-close-click/index.d.ts +2 -0
- package/dist/utils/hooks/use-outside-close-click/index.d.ts.map +1 -0
- package/dist/utils/hooks/use-outside-close-click/index.js +2 -0
- package/dist/utils/hooks/use-outside-close-click/index.js.map +1 -0
- package/dist/utils/hooks/use-outside-close-click/use-outside-close-click.d.ts +3 -0
- package/dist/utils/hooks/use-outside-close-click/use-outside-close-click.d.ts.map +1 -0
- package/dist/utils/hooks/use-outside-close-click/use-outside-close-click.js +16 -0
- package/dist/utils/hooks/use-outside-close-click/use-outside-close-click.js.map +1 -0
- package/dist/utils/hooks/use-pathname/index.d.ts.map +1 -0
- package/dist/utils/hooks/use-pathname/index.js.map +1 -0
- package/dist/utils/hooks/use-pathname/use-pathname.d.ts.map +1 -0
- package/dist/utils/hooks/use-pathname/use-pathname.js.map +1 -0
- package/dist/utils/index.d.ts +5 -8
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +5 -8
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/misc/index.d.ts +2 -0
- package/dist/utils/misc/index.d.ts.map +1 -0
- package/dist/utils/misc/index.js +2 -0
- package/dist/utils/misc/index.js.map +1 -0
- package/dist/utils/misc/is-file-image-type/index.d.ts +2 -0
- package/dist/utils/misc/is-file-image-type/index.d.ts.map +1 -0
- package/dist/utils/misc/is-file-image-type/index.js +2 -0
- package/dist/utils/misc/is-file-image-type/index.js.map +1 -0
- package/dist/utils/misc/is-file-image-type/is-file-image-type.d.ts +2 -0
- package/dist/utils/misc/is-file-image-type/is-file-image-type.d.ts.map +1 -0
- package/dist/utils/misc/is-file-image-type/is-file-image-type.js +4 -0
- package/dist/utils/misc/is-file-image-type/is-file-image-type.js.map +1 -0
- package/dist/utils/{get-colored-text-color → theme-utilities/get-colored-text-color}/get-colored-text-color.d.ts +1 -1
- package/dist/utils/theme-utilities/get-colored-text-color/get-colored-text-color.d.ts.map +1 -0
- package/dist/utils/{get-colored-text-color → theme-utilities/get-colored-text-color}/get-colored-text-color.js +1 -1
- package/dist/utils/theme-utilities/get-colored-text-color/get-colored-text-color.js.map +1 -0
- package/dist/utils/theme-utilities/get-colored-text-color/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-colored-text-color/index.js.map +1 -0
- package/dist/utils/{get-text-color → theme-utilities/get-text-color}/get-text-color.d.ts +1 -1
- package/dist/utils/theme-utilities/get-text-color/get-text-color.d.ts.map +1 -0
- package/dist/utils/{get-text-color → theme-utilities/get-text-color}/get-text-color.js +1 -1
- package/dist/utils/theme-utilities/get-text-color/get-text-color.js.map +1 -0
- package/dist/utils/theme-utilities/get-text-color/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-text-color/index.js.map +1 -0
- package/dist/utils/{get-utility-color → theme-utilities/get-utility-color}/get-utility-color-value.d.ts +1 -1
- package/dist/utils/theme-utilities/get-utility-color/get-utility-color-value.d.ts.map +1 -0
- package/dist/utils/{get-utility-color → theme-utilities/get-utility-color}/get-utility-color-value.js +1 -1
- package/dist/utils/theme-utilities/get-utility-color/get-utility-color-value.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-color/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-color/index.js.map +1 -0
- package/dist/utils/{get-utility-font-size → theme-utilities/get-utility-font-size}/getUtilityFontSize.d.ts +1 -1
- package/dist/utils/theme-utilities/get-utility-font-size/getUtilityFontSize.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-font-size/getUtilityFontSize.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-font-size/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-font-size/index.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-icon-size/get-utility-icon-size.d.ts +4 -0
- package/dist/utils/theme-utilities/get-utility-icon-size/get-utility-icon-size.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-icon-size/get-utility-icon-size.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-icon-size/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-icon-size/index.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-size-value/get-utility-size-value.d.ts +3 -0
- package/dist/utils/theme-utilities/get-utility-size-value/get-utility-size-value.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-size-value/get-utility-size-value.js.map +1 -0
- package/dist/utils/theme-utilities/get-utility-size-value/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/get-utility-size-value/index.js.map +1 -0
- package/dist/utils/theme-utilities/index.d.ts +7 -0
- package/dist/utils/theme-utilities/index.d.ts.map +1 -0
- package/dist/utils/theme-utilities/index.js +7 -0
- package/dist/utils/theme-utilities/index.js.map +1 -0
- package/package.json +5 -5
- package/dist/client/index.d.ts +0 -2
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -2
- package/dist/client/index.js.map +0 -1
- package/dist/client/theme-provider/index.d.ts +0 -3
- package/dist/client/theme-provider/index.d.ts.map +0 -1
- package/dist/client/theme-provider/index.js +0 -2
- package/dist/client/theme-provider/index.js.map +0 -1
- package/dist/client/theme-provider/set-theme.d.ts +0 -8
- package/dist/client/theme-provider/set-theme.d.ts.map +0 -1
- package/dist/client/theme-provider/set-theme.js +0 -60
- package/dist/client/theme-provider/set-theme.js.map +0 -1
- package/dist/client/theme-provider/theme-provider.d.ts +0 -21
- package/dist/client/theme-provider/theme-provider.d.ts.map +0 -1
- package/dist/client/theme-provider/theme-provider.js +0 -196
- package/dist/client/theme-provider/theme-provider.js.map +0 -1
- package/dist/client/theme-provider/theme-provider.types.d.ts +0 -13
- package/dist/client/theme-provider/theme-provider.types.d.ts.map +0 -1
- package/dist/client/theme-provider/theme-provider.types.js +0 -2
- package/dist/client/theme-provider/theme-provider.types.js.map +0 -1
- package/dist/utils/deep-merge/deep-merge.d.ts.map +0 -1
- package/dist/utils/deep-merge/deep-merge.js.map +0 -1
- package/dist/utils/deep-merge/index.d.ts.map +0 -1
- package/dist/utils/deep-merge/index.js.map +0 -1
- package/dist/utils/get-colored-text-color/get-colored-text-color.d.ts.map +0 -1
- package/dist/utils/get-colored-text-color/get-colored-text-color.js.map +0 -1
- package/dist/utils/get-colored-text-color/index.d.ts.map +0 -1
- package/dist/utils/get-colored-text-color/index.js.map +0 -1
- package/dist/utils/get-text-color/get-text-color.d.ts.map +0 -1
- package/dist/utils/get-text-color/get-text-color.js.map +0 -1
- package/dist/utils/get-text-color/index.d.ts.map +0 -1
- package/dist/utils/get-text-color/index.js.map +0 -1
- package/dist/utils/get-utility-color/get-utility-color-value.d.ts.map +0 -1
- package/dist/utils/get-utility-color/get-utility-color-value.js.map +0 -1
- package/dist/utils/get-utility-color/index.d.ts.map +0 -1
- package/dist/utils/get-utility-color/index.js.map +0 -1
- package/dist/utils/get-utility-font-size/getUtilityFontSize.d.ts.map +0 -1
- package/dist/utils/get-utility-font-size/getUtilityFontSize.js.map +0 -1
- package/dist/utils/get-utility-font-size/index.d.ts.map +0 -1
- package/dist/utils/get-utility-font-size/index.js.map +0 -1
- package/dist/utils/get-utility-icon-size/get-utility-icon-size.d.ts +0 -4
- package/dist/utils/get-utility-icon-size/get-utility-icon-size.d.ts.map +0 -1
- package/dist/utils/get-utility-icon-size/get-utility-icon-size.js.map +0 -1
- package/dist/utils/get-utility-icon-size/index.d.ts.map +0 -1
- package/dist/utils/get-utility-icon-size/index.js.map +0 -1
- package/dist/utils/get-utility-size-value/get-utility-size-value.d.ts +0 -3
- package/dist/utils/get-utility-size-value/get-utility-size-value.d.ts.map +0 -1
- package/dist/utils/get-utility-size-value/get-utility-size-value.js.map +0 -1
- package/dist/utils/get-utility-size-value/index.d.ts.map +0 -1
- package/dist/utils/get-utility-size-value/index.js.map +0 -1
- package/dist/utils/use-pathname/index.d.ts.map +0 -1
- package/dist/utils/use-pathname/index.js.map +0 -1
- package/dist/utils/use-pathname/use-pathname.d.ts.map +0 -1
- package/dist/utils/use-pathname/use-pathname.js.map +0 -1
- /package/dist/utils/{deep-merge → data-manipulation/deep-merge}/deep-merge.js +0 -0
- /package/dist/utils/{deep-merge → data-manipulation/deep-merge}/index.d.ts +0 -0
- /package/dist/utils/{deep-merge → data-manipulation/deep-merge}/index.js +0 -0
- /package/dist/utils/{use-pathname → hooks/use-pathname}/index.d.ts +0 -0
- /package/dist/utils/{use-pathname → hooks/use-pathname}/index.js +0 -0
- /package/dist/utils/{use-pathname → hooks/use-pathname}/use-pathname.d.ts +0 -0
- /package/dist/utils/{use-pathname → hooks/use-pathname}/use-pathname.js +0 -0
- /package/dist/utils/{get-colored-text-color → theme-utilities/get-colored-text-color}/index.d.ts +0 -0
- /package/dist/utils/{get-colored-text-color → theme-utilities/get-colored-text-color}/index.js +0 -0
- /package/dist/utils/{get-text-color → theme-utilities/get-text-color}/index.d.ts +0 -0
- /package/dist/utils/{get-text-color → theme-utilities/get-text-color}/index.js +0 -0
- /package/dist/utils/{get-utility-color → theme-utilities/get-utility-color}/index.d.ts +0 -0
- /package/dist/utils/{get-utility-color → theme-utilities/get-utility-color}/index.js +0 -0
- /package/dist/utils/{get-utility-font-size → theme-utilities/get-utility-font-size}/getUtilityFontSize.js +0 -0
- /package/dist/utils/{get-utility-font-size → theme-utilities/get-utility-font-size}/index.d.ts +0 -0
- /package/dist/utils/{get-utility-font-size → theme-utilities/get-utility-font-size}/index.js +0 -0
- /package/dist/utils/{get-utility-icon-size → theme-utilities/get-utility-icon-size}/get-utility-icon-size.js +0 -0
- /package/dist/utils/{get-utility-icon-size → theme-utilities/get-utility-icon-size}/index.d.ts +0 -0
- /package/dist/utils/{get-utility-icon-size → theme-utilities/get-utility-icon-size}/index.js +0 -0
- /package/dist/utils/{get-utility-size-value → theme-utilities/get-utility-size-value}/get-utility-size-value.js +0 -0
- /package/dist/utils/{get-utility-size-value → theme-utilities/get-utility-size-value}/index.d.ts +0 -0
- /package/dist/utils/{get-utility-size-value → theme-utilities/get-utility-size-value}/index.js +0 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { FileUploadProvider } from './file-upload-context';
|
|
5
|
+
import { isFileImageType } from '../../../utils';
|
|
6
|
+
import { FileUploadContent } from './components/file-upload-content';
|
|
7
|
+
/**
|
|
8
|
+
* File upload component with drag-and-drop, file validation, image preview,
|
|
9
|
+
* and optional filename/alt text editing before saving.
|
|
10
|
+
*
|
|
11
|
+
* Validates against allowed MIME types, max file size, and max file count.
|
|
12
|
+
* Image files generate a preview; non-image files show a generic indicator.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* <FileUpload
|
|
16
|
+
* name="attachments"
|
|
17
|
+
* value={value}
|
|
18
|
+
* onChange={onChange}
|
|
19
|
+
* allowedFileTypes={['image/*', 'application/pdf']}
|
|
20
|
+
* maxFileSize={5 * 1024 * 1024}
|
|
21
|
+
* maxNumberFiles={3}
|
|
22
|
+
* />
|
|
23
|
+
*/
|
|
24
|
+
export const FileUpload = ({ title = 'Upload a File', name, id = name, value, onChange, allowedFileTypes = ['*/*'], maxFileSize, maxNumberFiles, supportedFormatsText, required, size = 'md', }) => {
|
|
25
|
+
// Init Display States
|
|
26
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
27
|
+
const [preview, setPreview] = useState(null);
|
|
28
|
+
const [status, setStatus] = useState('');
|
|
29
|
+
// Init File States
|
|
30
|
+
const [selectedFile, setSelectedFile] = useState(null);
|
|
31
|
+
const [customFilename, setCustomFilename] = useState('');
|
|
32
|
+
const [alt, setAlt] = useState('');
|
|
33
|
+
// Validate File Type
|
|
34
|
+
const isValidFileType = (file) => {
|
|
35
|
+
if (allowedFileTypes.includes('*/*'))
|
|
36
|
+
return true;
|
|
37
|
+
return allowedFileTypes.some((type) => {
|
|
38
|
+
// Handle wildcards like 'image/*'
|
|
39
|
+
if (type.endsWith('/*')) {
|
|
40
|
+
const category = type.split('/')[0];
|
|
41
|
+
return file.type.startsWith(`${category}/`);
|
|
42
|
+
}
|
|
43
|
+
return file.type === type;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
// File Submissions
|
|
47
|
+
const processFile = (file) => {
|
|
48
|
+
// Ensure Maximum is not Exceeded
|
|
49
|
+
if (maxNumberFiles && value.length >= maxNumberFiles) {
|
|
50
|
+
setStatus(`Maximum files already added`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
// Ensure File is passed
|
|
54
|
+
if (!file) {
|
|
55
|
+
setStatus('No File Selected');
|
|
56
|
+
}
|
|
57
|
+
// Ensure Valid Type
|
|
58
|
+
if (!isValidFileType(file)) {
|
|
59
|
+
setStatus(`Invalid file type. Please select a ${allowedFileTypes.join(', ')} file`);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
// Ensure Valid Size
|
|
63
|
+
if (maxFileSize && file.size > maxFileSize) {
|
|
64
|
+
setStatus(`File too large. Maximum size is ${Math.round(maxFileSize / 1024 / 1024)}MB`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
// Extract Original Filename for user Editing
|
|
68
|
+
const extension = file.name.split('.').pop() || '';
|
|
69
|
+
const originalName = file.name.replace(`.${extension}`, '');
|
|
70
|
+
setCustomFilename(originalName);
|
|
71
|
+
setSelectedFile(file);
|
|
72
|
+
setStatus('');
|
|
73
|
+
// Generate Image Preview
|
|
74
|
+
if (isFileImageType(file)) {
|
|
75
|
+
const reader = new FileReader();
|
|
76
|
+
reader.onloadend = () => {
|
|
77
|
+
const result = reader.result;
|
|
78
|
+
if (typeof result === 'string') {
|
|
79
|
+
setPreview(result);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
reader.readAsDataURL(file);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
// Clear preview for non-image files
|
|
86
|
+
setPreview(null);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
// Remove File from files
|
|
90
|
+
const handleClearFile = () => {
|
|
91
|
+
setSelectedFile(null);
|
|
92
|
+
setPreview(null);
|
|
93
|
+
setCustomFilename('');
|
|
94
|
+
setStatus('');
|
|
95
|
+
};
|
|
96
|
+
// Save Selected file
|
|
97
|
+
const saveFile = () => {
|
|
98
|
+
if (selectedFile) {
|
|
99
|
+
// Create new file with custom name
|
|
100
|
+
const extension = selectedFile.name.split('.').pop() || '';
|
|
101
|
+
const newFileName = `${customFilename}.${extension}`;
|
|
102
|
+
const renamedFile = new File([selectedFile], newFileName, {
|
|
103
|
+
type: selectedFile.type,
|
|
104
|
+
lastModified: selectedFile.lastModified,
|
|
105
|
+
});
|
|
106
|
+
// Add alt text
|
|
107
|
+
renamedFile.alt = alt;
|
|
108
|
+
onChange([...value, renamedFile]);
|
|
109
|
+
handleClearFile();
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const removeFile = (index) => {
|
|
113
|
+
// Remove File @ index
|
|
114
|
+
const updatedFiles = value.filter((_, i) => i !== index);
|
|
115
|
+
// Save Changes
|
|
116
|
+
onChange(updatedFiles);
|
|
117
|
+
};
|
|
118
|
+
return (_jsx(FileUploadProvider, { value: {
|
|
119
|
+
id,
|
|
120
|
+
title,
|
|
121
|
+
name,
|
|
122
|
+
onChange,
|
|
123
|
+
allowedFileTypes,
|
|
124
|
+
maxFileSize,
|
|
125
|
+
maxNumberFiles,
|
|
126
|
+
supportedFormatsText,
|
|
127
|
+
required,
|
|
128
|
+
size,
|
|
129
|
+
isDragging,
|
|
130
|
+
setIsDragging,
|
|
131
|
+
preview,
|
|
132
|
+
setPreview,
|
|
133
|
+
status,
|
|
134
|
+
setStatus,
|
|
135
|
+
customFilename,
|
|
136
|
+
setCustomFilename,
|
|
137
|
+
alt,
|
|
138
|
+
setAlt,
|
|
139
|
+
value,
|
|
140
|
+
selectedFile,
|
|
141
|
+
setSelectedFile,
|
|
142
|
+
processFile,
|
|
143
|
+
handleClearFile,
|
|
144
|
+
saveFile,
|
|
145
|
+
removeFile,
|
|
146
|
+
}, children: _jsx(FileUploadContent, {}) }));
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=file-upload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.js","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAC1B,KAAK,GAAG,eAAe,EACvB,IAAI,EACJ,EAAE,GAAG,IAAI,EACT,KAAK,EACL,QAAQ,EACR,gBAAgB,GAAG,CAAC,KAAK,CAAC,EAC1B,WAAW,EACX,cAAc,EACd,oBA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IAEF,OAAO,CACN,KAAC,kBAAkB,IAClB,KAAK,EAAE;YACN,EAAE;YACF,KAAK;YACL,IAAI;YACJ,QAAQ;YACR,gBAAgB;YAChB,WAAW;YACX,cAAc;YACd,oBAAoB;YACpB,QAAQ;YACR,IAAI;YACJ,UAAU;YACV,aAAa;YACb,OAAO;YACP,UAAU;YACV,MAAM;YACN,SAAS;YACT,cAAc;YACd,iBAAiB;YACjB,GAAG;YACH,MAAM;YACN,KAAK;YACL,YAAY;YACZ,eAAe;YACf,WAAW;YACX,eAAe;YACf,QAAQ;YACR,UAAU;SACV,YAED,KAAC,iBAAiB,KAAG,GACD,CACrB,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { InputProps } from '../input-props.types';
|
|
2
|
+
export type UploadableFile = File & {
|
|
3
|
+
/** Alt text for image files */
|
|
4
|
+
alt?: string;
|
|
5
|
+
};
|
|
6
|
+
export type FileUploadProps = Omit<InputProps<UploadableFile[], UploadableFile[]>, 'placeholder'> & {
|
|
7
|
+
/** MIME types accepted. Supports wildcards like `image/*` @default `['*\/*']` */
|
|
8
|
+
allowedFileTypes?: string[];
|
|
9
|
+
/** Maximum file size in bytes */
|
|
10
|
+
maxFileSize?: number;
|
|
11
|
+
/** Maximum number of files that can be uploaded */
|
|
12
|
+
maxNumberFiles?: number;
|
|
13
|
+
/** Custom text describing supported formats, shown in the upload area */
|
|
14
|
+
supportedFormatsText?: string;
|
|
15
|
+
/** Controls the size of the upload area @default `'md'` */
|
|
16
|
+
size?: 'sm' | 'md' | 'lg';
|
|
17
|
+
};
|
|
18
|
+
export type FileUploadContext = FileUploadProps & {
|
|
19
|
+
isDragging: boolean;
|
|
20
|
+
selectedFile: UploadableFile | null;
|
|
21
|
+
preview: string | null;
|
|
22
|
+
status: string;
|
|
23
|
+
customFilename: string;
|
|
24
|
+
alt: string;
|
|
25
|
+
setIsDragging: (isDragging: boolean) => void;
|
|
26
|
+
setSelectedFile: (file: UploadableFile | null) => void;
|
|
27
|
+
setPreview: (preview: string | null) => void;
|
|
28
|
+
setStatus: (status: string) => void;
|
|
29
|
+
setCustomFilename: (filename: string) => void;
|
|
30
|
+
setAlt: (alt: string) => void;
|
|
31
|
+
processFile: (file: File) => void;
|
|
32
|
+
handleClearFile: () => void;
|
|
33
|
+
saveFile: () => void;
|
|
34
|
+
removeFile: (index: number) => void;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=file-upload.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,IAAI,GAAG;IACnC,+BAA+B;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,IAAI,CACjC,UAAU,CAAC,cAAc,EAAE,EAAE,cAAc,EAAE,CAAC,EAC9C,aAAa,CACb,GAAG;IACH,iFAAiF;IACjF,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,iCAAiC;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,2DAA2D;IAC3D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,eAAe,GAAG;IAEjD,UAAU,EAAE,OAAO,CAAC;IACpB,YAAY,EAAE,cAAc,GAAG,IAAI,CAAC;IACpC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;IAGZ,aAAa,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,eAAe,EAAE,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IACvD,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAC7C,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,iBAAiB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9C,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAG9B,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAClC,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.types.js","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { FormLabelProps } from './form-label.types';
|
|
2
|
+
/**
|
|
3
|
+
* Form label linked to a control by `name`. Renders as an `H3` typographic style.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <FormLabel name="email" title="Email Address" />
|
|
7
|
+
*/
|
|
2
8
|
export declare const FormLabel: ({ name, id, title }: FormLabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
9
|
//# sourceMappingURL=form-label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-label.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,eAAO,MAAM,SAAS,GAAI,qBAA4B,cAAc,
|
|
1
|
+
{"version":3,"file":"form-label.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,qBAA4B,cAAc,4CAYnE,CAAC"}
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { css } from '../../../styled-system/css';
|
|
3
3
|
import { H3 } from '../../../components/typography';
|
|
4
|
+
/**
|
|
5
|
+
* Form label linked to a control by `name`. Renders as an `H3` typographic style.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* <FormLabel name="email" title="Email Address" />
|
|
9
|
+
*/
|
|
4
10
|
export const FormLabel = ({ name, id = name, title }) => {
|
|
5
11
|
const styles = css({
|
|
6
12
|
display: 'block',
|
|
7
13
|
alignSelf: 'flex-start',
|
|
8
|
-
marginBottom: '
|
|
14
|
+
marginBottom: '2',
|
|
9
15
|
});
|
|
10
|
-
return (_jsx("label", { id: id, htmlFor: name, className:
|
|
16
|
+
return (_jsx("label", { id: id, htmlFor: name, className: styles, children: _jsx(H3, { children: title }) }));
|
|
11
17
|
};
|
|
12
18
|
//# sourceMappingURL=form-label.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-label.js","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAE7C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAkB,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,GAAG,CAAC;QAClB,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"form-label.js","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,OAAO,EAAE,EAAE,EAAE,MAAM,yBAAyB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAkB,EAAE,EAAE;IACvE,MAAM,MAAM,GAAG,GAAG,CAAC;QAClB,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,GAAG;KACjB,CAAC,CAAC;IAEH,OAAO,CACN,gBAAO,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,YAC9C,KAAC,EAAE,cAAE,KAAK,GAAM,GACT,CACR,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export type FormLabelProps = {
|
|
2
|
+
/** Defaults to `name` if not provided */
|
|
2
3
|
id?: string;
|
|
4
|
+
/** Associates the label with its form control via `htmlFor` */
|
|
3
5
|
name: string;
|
|
6
|
+
/** Text displayed in the label */
|
|
4
7
|
title?: string;
|
|
5
8
|
};
|
|
6
9
|
//# sourceMappingURL=form-label.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-label.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;
|
|
1
|
+
{"version":3,"file":"form-label.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/form-label/form-label.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC5B,yCAAyC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,+DAA+D;IAC/D,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form-elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/form-elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/form-elements/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
export type InputProps<
|
|
1
|
+
export type InputProps<TValue, TChange = React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>> = {
|
|
2
|
+
/** Defaults to `name` if not provided */
|
|
2
3
|
id?: string;
|
|
4
|
+
/** Form field name */
|
|
3
5
|
name: string;
|
|
6
|
+
/** Label text rendered above the input */
|
|
4
7
|
title?: string;
|
|
5
|
-
value
|
|
8
|
+
/** Controlled value */
|
|
9
|
+
value: TValue;
|
|
10
|
+
/** Require value for form submission */
|
|
6
11
|
required?: boolean;
|
|
12
|
+
/** Descriptive text rendered within input */
|
|
7
13
|
placeholder?: string;
|
|
8
|
-
|
|
14
|
+
/** Called when the input value changes */
|
|
15
|
+
onChange: (e: TChange) => void | Promise<void>;
|
|
9
16
|
};
|
|
10
17
|
//# sourceMappingURL=input-props.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-props.types.d.ts","sourceRoot":"","sources":["../../../src/components/form-elements/input-props.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"input-props.types.d.ts","sourceRoot":"","sources":["../../../src/components/form-elements/input-props.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,CACrB,MAAM,EACN,OAAO,GAAG,KAAK,CAAC,WAAW,CAAC,gBAAgB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC,IACpF;IACH,yCAAyC;IACzC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sBAAsB;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6CAA6C;IAC7C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0CAA0C;IAC1C,QAAQ,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/C,CAAC"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import { NumberInputProps } from './number-input.types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Number input with increment/decrement buttons and optional min/max range enforcement.
|
|
4
|
+
* Blocks non-numeric keyboard input and respects range bounds on both direct input and stepping.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* <NumberInput
|
|
8
|
+
* name="quantity"
|
|
9
|
+
* title="Quantity"
|
|
10
|
+
* value={qty}
|
|
11
|
+
* min={1}
|
|
12
|
+
* max={99}
|
|
13
|
+
* onChange={handleChange}
|
|
14
|
+
* />
|
|
15
|
+
*/
|
|
16
|
+
export declare const NumberInput: ({ name, id, title, value, placeholder, required, dark, min, max, onChange, }: NumberInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
17
|
//# sourceMappingURL=number-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAcxD,eAAO,MAAM,WAAW,GAAI,
|
|
1
|
+
{"version":3,"file":"number-input.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAcxD;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,WAAW,GAAI,8EAWzB,gBAAgB,4CAmLlB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { Icon } from '../../../components';
|
|
|
4
4
|
import { FormLabel } from '../form-label';
|
|
5
5
|
import { InputWrapper } from '../input-wrapper';
|
|
6
6
|
import { useState, useEffect } from 'react';
|
|
7
|
-
import { css } from '../../../styled-system/css';
|
|
7
|
+
import { css, cva, cx } from '../../../styled-system/css';
|
|
8
8
|
const valueWithinRange = (value, min, max) => {
|
|
9
9
|
if (min !== undefined && value < min) {
|
|
10
10
|
return false;
|
|
@@ -14,7 +14,21 @@ const valueWithinRange = (value, min, max) => {
|
|
|
14
14
|
}
|
|
15
15
|
return true;
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Number input with increment/decrement buttons and optional min/max range enforcement.
|
|
19
|
+
* Blocks non-numeric keyboard input and respects range bounds on both direct input and stepping.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <NumberInput
|
|
23
|
+
* name="quantity"
|
|
24
|
+
* title="Quantity"
|
|
25
|
+
* value={qty}
|
|
26
|
+
* min={1}
|
|
27
|
+
* max={99}
|
|
28
|
+
* onChange={handleChange}
|
|
29
|
+
* />
|
|
30
|
+
*/
|
|
31
|
+
export const NumberInput = ({ name, id = name, title, value, placeholder, required, dark, min, max, onChange, }) => {
|
|
18
32
|
// Initialize state with the value from props or null
|
|
19
33
|
const [num, setNum] = useState(value);
|
|
20
34
|
// Update internal state
|
|
@@ -66,35 +80,82 @@ export const NumberInput = ({ name, id = name, title, value, placeholder, requir
|
|
|
66
80
|
}
|
|
67
81
|
};
|
|
68
82
|
const styles = {
|
|
69
|
-
|
|
70
|
-
|
|
83
|
+
arrowButton: cva({
|
|
84
|
+
base: {
|
|
85
|
+
backgroundColor: { base: 'gray.light', _hover: 'gray.100' },
|
|
86
|
+
borderWidth: 'md',
|
|
87
|
+
borderColor: 'gray.light',
|
|
88
|
+
_focus: {
|
|
89
|
+
ring: '2',
|
|
90
|
+
ringColor: 'gray.100',
|
|
91
|
+
outline: 'none',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
variants: {
|
|
95
|
+
direction: {
|
|
96
|
+
left: {
|
|
97
|
+
borderStartStartRadius: 'lg',
|
|
98
|
+
borderEndStartRadius: 'lg',
|
|
99
|
+
},
|
|
100
|
+
right: {
|
|
101
|
+
borderStartEndRadius: 'lg',
|
|
102
|
+
borderEndEndRadius: 'lg',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
}),
|
|
107
|
+
baseSegment: css({
|
|
108
|
+
borderWidth: 'md',
|
|
109
|
+
borderColor: 'gray.light',
|
|
110
|
+
padding: '3',
|
|
111
|
+
height: '11',
|
|
112
|
+
textAlign: 'center',
|
|
113
|
+
fontSize: 'sm',
|
|
114
|
+
}),
|
|
115
|
+
centerSegment: css({
|
|
116
|
+
color: 'text.standard',
|
|
117
|
+
width: '16',
|
|
118
|
+
appearance: 'none',
|
|
119
|
+
'&::-webkit-outer-spin-button': {
|
|
120
|
+
appearance: 'none',
|
|
121
|
+
},
|
|
122
|
+
'&::-webkit-inner-spin-button': {
|
|
123
|
+
appearance: 'none',
|
|
124
|
+
},
|
|
125
|
+
_focus: {
|
|
126
|
+
ringColor: 'blue.500',
|
|
127
|
+
borderColor: 'blue.500',
|
|
128
|
+
},
|
|
129
|
+
}),
|
|
130
|
+
container: css({
|
|
131
|
+
display: 'flex',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
alignItems: 'center',
|
|
134
|
+
alignSelf: 'start',
|
|
71
135
|
}),
|
|
72
|
-
border: 'border border-gray-300',
|
|
73
|
-
layout: 'p-3 h-11',
|
|
74
|
-
focus: 'focus:ring-gray-100 focus:ring-2 focus:outline-none',
|
|
75
|
-
dark: 'dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 dark:focus:ring-gray-700',
|
|
76
|
-
left: 'rounded-s-lg',
|
|
77
|
-
right: 'rounded-e-lg',
|
|
78
|
-
inputBorder: 'border-y border-gray-300',
|
|
79
|
-
inputBg: 'bg-gray-50',
|
|
80
|
-
text: 'text-center text-gray-900 text-sm',
|
|
81
|
-
inputFocus: 'focus:ring-blue-500 focus:border-blue-500',
|
|
82
|
-
alterInput: 'appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none [-moz-appearance:textfield]',
|
|
83
136
|
};
|
|
84
|
-
|
|
85
|
-
const bttnRight = `${styles.bttnBg} ${styles.border} ${styles.layout} ${styles.focus} ${styles.dark} ${styles.right}`;
|
|
86
|
-
return (_jsxs(InputWrapper, { children: [title && _jsx(FormLabel, { id: id, name: name, title: title }), _jsxs("div", { className: "flex self-start justify-center items-center", children: [_jsx("button", { type: "button", className: bttnLeft, onClick: handleIncrement(-1), children: _jsx(Icon, { name: "CaretLeft", color: "gray", size: 12 }) }), _jsx("input", { type: "number", id: id, name: name, placeholder: placeholder, value: num ?? '', onChange: handleInputChange, className: `w-16 ${styles.layout} ${styles.border} ${styles.text} ${styles.inputFocus} ${styles.alterInput} ${dark ? styles.inputBg : ''}`, onKeyDown: (e) => {
|
|
137
|
+
return (_jsxs(InputWrapper, { children: [title && _jsx(FormLabel, { id: id, name: name, title: title }), _jsxs("div", { className: styles.container, children: [_jsx("button", { type: "button", className: cx(styles.arrowButton({ direction: 'left' }), styles.baseSegment), onClick: handleIncrement(-1), children: _jsx(Icon, { name: "CaretLeft", color: "gray", size: 12 }) }), _jsx("input", { type: "number", id: id, name: name, placeholder: placeholder, value: num ?? '', onChange: handleInputChange, className: cx(styles.baseSegment, styles.centerSegment), onKeyDown: (e) => {
|
|
87
138
|
// Allow minus sign as first character if negative values are allowed
|
|
88
|
-
if (e.key === '-' &&
|
|
139
|
+
if (e.key === '-' &&
|
|
140
|
+
e.currentTarget.value.length === 0 &&
|
|
141
|
+
(min === undefined || min < 0)) {
|
|
89
142
|
return; // Allow the minus sign
|
|
90
143
|
}
|
|
91
144
|
// Prevent non-numeric input except allowed control keys
|
|
92
145
|
if (!/[0-9]/.test(e.key) &&
|
|
93
146
|
!e.ctrlKey &&
|
|
94
147
|
!e.metaKey &&
|
|
95
|
-
![
|
|
148
|
+
![
|
|
149
|
+
'Backspace',
|
|
150
|
+
'Delete',
|
|
151
|
+
'ArrowLeft',
|
|
152
|
+
'ArrowRight',
|
|
153
|
+
'Tab',
|
|
154
|
+
'Home',
|
|
155
|
+
'End',
|
|
156
|
+
].includes(e.key)) {
|
|
96
157
|
e.preventDefault();
|
|
97
158
|
}
|
|
98
|
-
}, required: required, min: min, max: max }), _jsx("button", { type: "button", className:
|
|
159
|
+
}, required: required, min: min, max: max }), _jsx("button", { type: "button", className: cx(styles.arrowButton({ direction: 'right' }), styles.baseSegment), onClick: handleIncrement(1), children: _jsx(Icon, { name: "CaretRight", color: "gray", size: 12 }) })] })] }));
|
|
99
160
|
};
|
|
100
161
|
//# sourceMappingURL=number-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.js","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"number-input.js","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,E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AC,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { InputProps } from '../input-props.types';
|
|
2
2
|
export type NumberInputProps = InputProps<number> & {
|
|
3
|
+
/** Applies dark styling */
|
|
3
4
|
dark?: boolean;
|
|
5
|
+
/** Minimum allowed value */
|
|
4
6
|
min?: number;
|
|
7
|
+
/** Maximum allowed value */
|
|
5
8
|
max?: number;
|
|
6
9
|
};
|
|
7
10
|
//# sourceMappingURL=number-input.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-input.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG;
|
|
1
|
+
{"version":3,"file":"number-input.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/number-input/number-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,MAAM,CAAC,GAAG;IACnD,2BAA2B;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;CACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/styles/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/styles/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;;;;;;EA6B1B,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { cva } from '../../../styled-system/css';
|
|
2
2
|
export const baseInputStyles = cva({
|
|
3
3
|
base: {
|
|
4
|
+
color: 'text.standard',
|
|
4
5
|
paddingX: '16px',
|
|
5
6
|
paddingY: '8px',
|
|
6
7
|
borderWidth: '1px',
|
|
7
8
|
borderStyle: 'solid',
|
|
8
9
|
borderColor: 'structure',
|
|
10
|
+
borderRadius: 'md',
|
|
9
11
|
transition: 'colors',
|
|
10
12
|
_focus: {
|
|
11
13
|
outline: 'none',
|
|
@@ -24,7 +26,7 @@ export const baseInputStyles = cva({
|
|
|
24
26
|
},
|
|
25
27
|
},
|
|
26
28
|
defaultVariants: {
|
|
27
|
-
alt:
|
|
29
|
+
alt: false,
|
|
28
30
|
},
|
|
29
31
|
});
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/form-elements/styles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;IAClC,IAAI,EAAE;QACL,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,WAAW;QACxB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE;YACP,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,aAAa;YAC1B,SAAS,EAAE,6BAA6B;SACxC;KACD;IACD,QAAQ,EAAE;QACT,GAAG,EAAE;YACJ,IAAI,EAAE;gBACL,KAAK,EAAE,MAAM;aACb;YACD,KAAK,EAAE;gBACN,KAAK,EAAE,MAAM;aACb;SACD;KACD;IACD,eAAe,EAAE;QAChB,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/form-elements/styles/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;IAClC,IAAI,EAAE;QACL,KAAK,EAAE,eAAe;QACtB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,KAAK;QACf,WAAW,EAAE,KAAK;QAClB,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,WAAW;QACxB,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,QAAQ;QACpB,MAAM,EAAE;YACP,OAAO,EAAE,MAAM;YACf,WAAW,EAAE,aAAa;YAC1B,SAAS,EAAE,6BAA6B;SACxC;KACD;IACD,QAAQ,EAAE;QACT,GAAG,EAAE;YACJ,IAAI,EAAE;gBACL,KAAK,EAAE,MAAM;aACb;YACD,KAAK,EAAE;gBACN,KAAK,EAAE,MAAM;aACb;SACD;KACD;IACD,eAAe,EAAE;QAChB,GAAG,EAAE,KAAK;KACV;CACD,CAAC,CAAC"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { TextInputProps } from './text-input.types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Text input that renders either a single-line `input` or a resizable `textarea`.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <TextInput name="bio" title="Bio" value={bio} multiline onChange={handleChange} />
|
|
7
|
+
*/
|
|
8
|
+
export declare const TextInput: ({ name, id, title, value, required, placeholder, multiline, onChange, }: TextInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
9
|
//# sourceMappingURL=text-input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/text-input/text-input.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,eAAO,MAAM,SAAS,GAAI,
|
|
1
|
+
{"version":3,"file":"text-input.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/text-input/text-input.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,yEASvB,cAAc,4CAkChB,CAAC"}
|
|
@@ -3,9 +3,15 @@ import { FormLabel } from '../form-label';
|
|
|
3
3
|
import { InputWrapper } from '../input-wrapper';
|
|
4
4
|
import { baseInputStyles } from '../styles';
|
|
5
5
|
import { cx, css } from '../../../styled-system/css';
|
|
6
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Text input that renders either a single-line `input` or a resizable `textarea`.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <TextInput name="bio" title="Bio" value={bio} multiline onChange={handleChange} />
|
|
11
|
+
*/
|
|
12
|
+
export const TextInput = ({ name, id = name, title, value, required, placeholder, multiline = false, onChange, }) => {
|
|
7
13
|
const style = css({
|
|
8
|
-
minHeight: '
|
|
14
|
+
minHeight: '25',
|
|
9
15
|
resize: 'vertical',
|
|
10
16
|
});
|
|
11
17
|
return (_jsxs(InputWrapper, { children: [title && _jsx(FormLabel, { id: id, name: name, title: title }), multiline ? (_jsx("textarea", { id: id, name: name, required: required, value: value, onChange: onChange, placeholder: placeholder, rows: 3, className: cx(baseInputStyles(), style) })) : (_jsx("input", { type: "text", id: id, name: name, required: required, value: value, onChange: onChange, placeholder: placeholder, className: baseInputStyles() }))] }));
|