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
package/README.md
CHANGED
|
@@ -1,30 +1,75 @@
|
|
|
1
1
|
# Thread UI
|
|
2
2
|
|
|
3
|
-
Thread is a
|
|
3
|
+
Thread is a React component library I built to create my [personal website](https://fisherandrew.org). It's designed around a clean, token-based theme system with full SSR support, dark mode, and easy customization.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
## Get Started
|
|
6
6
|
|
|
7
|
-
All components work out of the box.
|
|
7
|
+
All components work out of the box. Full documentation coming soon at thread.fisherandrew.org.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
npm install thread-ui
|
|
11
|
+
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
## Features
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
### Custom Themes
|
|
16
16
|
|
|
17
|
-
Thread
|
|
17
|
+
Thread supports custom themes that override the default design tokens, including when using SSR. Wrap your app in `ThemeProvider` and pass a partial `ThemeConfig` — customize as much or as little as you want.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
```tsx
|
|
20
|
+
const customTheme: ThemeConfig = {
|
|
21
|
+
primary: {
|
|
22
|
+
light: '#4f46e5',
|
|
23
|
+
main: '#4338ca',
|
|
24
|
+
dark: '#3730a3',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
20
27
|
|
|
28
|
+
return <ThemeProvider theme={customTheme}>{children}</ThemeProvider>;
|
|
21
29
|
```
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
|
|
31
|
+
### Dark Mode
|
|
32
|
+
|
|
33
|
+
Thread includes a built-in light/dark/system mode system. The `ThreadScript` component injects an inline script into your `<head>` that reads the user's saved preference from `localStorage` and sets `data-theme` on `:root` before the first paint — eliminating any flash of wrong-mode content.
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
// Next.js App Router
|
|
37
|
+
<html suppressHydrationWarning>
|
|
38
|
+
<head>
|
|
39
|
+
<ThreadScript defaultMode="system" />
|
|
40
|
+
</head>
|
|
41
|
+
<body>
|
|
42
|
+
<ThemeProvider>{children}</ThemeProvider>
|
|
43
|
+
</body>
|
|
44
|
+
</html>
|
|
30
45
|
```
|
|
46
|
+
|
|
47
|
+
### SSR Compatible
|
|
48
|
+
|
|
49
|
+
Component CSS is pre-generated using Panda CSS, so components render correctly server-side without any runtime style injection. Most components are SSR compatible, and all work out of the box with `Next.js`.
|
|
50
|
+
|
|
51
|
+
## Components
|
|
52
|
+
|
|
53
|
+
### UI Elements
|
|
54
|
+
|
|
55
|
+
`Button` `Card` `Divider` `Icon` `IconButton` `Modal` `Toggle`
|
|
56
|
+
|
|
57
|
+
### Media Display
|
|
58
|
+
|
|
59
|
+
`ImagePanel` `InfoCard` `MediaCard`
|
|
60
|
+
|
|
61
|
+
### Typography Elements
|
|
62
|
+
|
|
63
|
+
`Title` `H1` `H2` `H3` `Text` `Subtitle` `List` `OrderedList` `PageHeader`
|
|
64
|
+
|
|
65
|
+
### Navigation Components
|
|
66
|
+
|
|
67
|
+
`NavMenu` `SideNav`
|
|
68
|
+
|
|
69
|
+
### Form Elements
|
|
70
|
+
|
|
71
|
+
`Dropdown` `FileUpload` `FormLabel` `NumberInput` `TextInput`
|
|
72
|
+
|
|
73
|
+
### Layout Components
|
|
74
|
+
|
|
75
|
+
`ColumnLayout` `Footer` `MasonryLayout`
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DropdownProps } from './dropdown.types';
|
|
2
|
+
/**
|
|
3
|
+
* Single-select dropdown with an option list and outside-click dismissal.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* <Dropdown
|
|
7
|
+
* title="Status"
|
|
8
|
+
* value={status}
|
|
9
|
+
* options={[{ label: 'Active', value: 'active' }, { label: 'Inactive', value: 'inactive' }]}
|
|
10
|
+
* onSelect={(val) => setStatus(val)}
|
|
11
|
+
* />
|
|
12
|
+
*/
|
|
13
|
+
export declare const Dropdown: ({ id, title, value, options, onSelect, placeholder, }: DropdownProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=dropdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/dropdown.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQjE;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,GAAI,uDAOtB,aAAa,4CAgGf,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useState } from 'react';
|
|
4
|
+
import { InputWrapper } from '../input-wrapper';
|
|
5
|
+
import { FormLabel } from '../form-label';
|
|
6
|
+
import { Icon } from '../../../components/ui';
|
|
7
|
+
import { css, cva, cx } from '../../../styled-system/css';
|
|
8
|
+
import { baseInputStyles } from '../styles';
|
|
9
|
+
import { useOutsideCloseClick } from '../../../utils';
|
|
10
|
+
/**
|
|
11
|
+
* Single-select dropdown with an option list and outside-click dismissal.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <Dropdown
|
|
15
|
+
* title="Status"
|
|
16
|
+
* value={status}
|
|
17
|
+
* options={[{ label: 'Active', value: 'active' }, { label: 'Inactive', value: 'inactive' }]}
|
|
18
|
+
* onSelect={(val) => setStatus(val)}
|
|
19
|
+
* />
|
|
20
|
+
*/
|
|
21
|
+
export const Dropdown = ({ id, title, value, options, onSelect, placeholder = 'Select an option...', }) => {
|
|
22
|
+
// UI State Controls
|
|
23
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
24
|
+
const dropdownRef = useRef(null);
|
|
25
|
+
// Map Value to Dropdown Option
|
|
26
|
+
const selected = options.find((opt) => opt.value === value);
|
|
27
|
+
// User Actions
|
|
28
|
+
const handleSelect = (option) => {
|
|
29
|
+
onSelect(option.value);
|
|
30
|
+
setIsOpen(false);
|
|
31
|
+
};
|
|
32
|
+
const toggleDropdown = () => setIsOpen(!isOpen);
|
|
33
|
+
useOutsideCloseClick(true, dropdownRef, isOpen, () => setIsOpen(false));
|
|
34
|
+
// Styles
|
|
35
|
+
const styles = {
|
|
36
|
+
container: css({
|
|
37
|
+
width: '100%',
|
|
38
|
+
color: 'text.standard',
|
|
39
|
+
}),
|
|
40
|
+
interior: css({
|
|
41
|
+
width: '100%',
|
|
42
|
+
position: 'relative',
|
|
43
|
+
}),
|
|
44
|
+
surfaceButton: css({
|
|
45
|
+
width: '100%',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'space-between',
|
|
48
|
+
alignItems: 'center',
|
|
49
|
+
}),
|
|
50
|
+
list: css({
|
|
51
|
+
backgroundColor: 'background',
|
|
52
|
+
position: 'absolute',
|
|
53
|
+
width: '100%',
|
|
54
|
+
borderWidth: 'md',
|
|
55
|
+
borderColor: 'structure',
|
|
56
|
+
borderRadius: 'md',
|
|
57
|
+
marginTop: '1',
|
|
58
|
+
boxShadow: 'lg',
|
|
59
|
+
zIndex: '10',
|
|
60
|
+
maxHeight: '60',
|
|
61
|
+
overflow: 'auto',
|
|
62
|
+
}),
|
|
63
|
+
item: cva({
|
|
64
|
+
base: {
|
|
65
|
+
cursor: 'pointer',
|
|
66
|
+
paddingX: '4',
|
|
67
|
+
paddingY: '2',
|
|
68
|
+
_hover: { backgroundColor: 'surface' },
|
|
69
|
+
},
|
|
70
|
+
variants: {
|
|
71
|
+
isSelected: {
|
|
72
|
+
true: {
|
|
73
|
+
backgroundColor: 'elevated',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
return (_jsx("div", { id: id, className: styles.container, children: _jsxs(InputWrapper, { children: [title && _jsx(FormLabel, { name: title, title: title }), _jsxs("div", { className: styles.interior, children: [_jsxs("button", { className: cx(styles.surfaceButton, baseInputStyles({ alt: true })), onClick: toggleDropdown, type: "button", children: [_jsx("span", { children: selected ? selected.label : placeholder }), _jsx(Icon, { name: isOpen ? 'CaretUp' : 'CaretDown', size: 16, color: "black" })] }), isOpen && (_jsx("ul", { className: styles.list, ref: dropdownRef, children: options.map((option, index) => (_jsx("li", { className: styles.item({
|
|
80
|
+
isSelected: option.value === selected?.value,
|
|
81
|
+
}), onClick: () => handleSelect(option), children: option.label }, index))) }))] })] }) }));
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=dropdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,M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AW,GAAQ,EACtD,KAAC,IAAI,IAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,OAAO,GAAG,IAChE,EACR,MAAM,IAAI,CACV,aAAI,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,WAAW,YAC1C,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAC/B,aAEC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC;oCACtB,UAAU,EAAE,MAAM,CAAC,KAAK,KAAK,QAAQ,EAAE,KAAK;iCAC5C,CAAC,EACF,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,YAElC,MAAM,CAAC,KAAK,IANR,KAAK,CAON,CACL,CAAC,GACE,CACL,IACI,IACQ,GACV,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type DropdownProps = {
|
|
2
|
+
/** Dropdown ID */
|
|
3
|
+
id?: string;
|
|
4
|
+
/** Optional title rendered above the dropdown */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** Currently selected value — matched against `options` to display the selected label */
|
|
7
|
+
value?: string | number | null;
|
|
8
|
+
/** List of options to display */
|
|
9
|
+
options: DropdownOption[];
|
|
10
|
+
/** Called with the selected option's value when the user makes a selection */
|
|
11
|
+
onSelect: (value: string | number) => void;
|
|
12
|
+
/** Placeholder text shown when no value is selected @default 'Select an option...' */
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A single option in the Dropdown list.
|
|
17
|
+
*/
|
|
18
|
+
export type DropdownOption = {
|
|
19
|
+
/** Display text shown in the list */
|
|
20
|
+
label: string;
|
|
21
|
+
/** Value passed to `onSelect` when this option is chosen */
|
|
22
|
+
value: string | number;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=dropdown.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.types.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/dropdown.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC3B,kBAAkB;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAC/B,iCAAiC;IACjC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,8EAA8E;IAC9E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC5B,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown.types.js","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/dropdown.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/form-elements/dropdown/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-input.d.ts","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-input.tsx"],"names":[],"mappings":"AA8DA,eAAO,MAAM,SAAS,2DA0FrB,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useRef } from 'react';
|
|
4
|
+
import { Icon } from '../../../../components/ui';
|
|
5
|
+
import { useFileUploadContext } from '../file-upload-context';
|
|
6
|
+
import { css, cva, cx } from '../../../../styled-system/css';
|
|
7
|
+
import { Text } from '../../../../components/typography';
|
|
8
|
+
// Styles
|
|
9
|
+
const styles = {
|
|
10
|
+
dropzone: cva({
|
|
11
|
+
base: {
|
|
12
|
+
border: '2px dashed',
|
|
13
|
+
mx: 'auto',
|
|
14
|
+
rounded: 'lg',
|
|
15
|
+
textAlign: 'center',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
borderColor: 'gray.300',
|
|
19
|
+
},
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
sm: { flexDirection: 'row', justifyContent: 'center', gap: '7', p: '3' },
|
|
23
|
+
md: { flexDirection: 'row', justifyContent: 'center', gap: '7', p: '8' },
|
|
24
|
+
lg: { flexDirection: 'column', p: '8' },
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
isDragging: css({ borderColor: 'blue.500', bg: 'surface' }),
|
|
29
|
+
contents: cva({
|
|
30
|
+
base: {
|
|
31
|
+
display: 'flex',
|
|
32
|
+
gap: '2',
|
|
33
|
+
flexDirection: 'column',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
size: {
|
|
38
|
+
sm: { flexDirection: 'row' },
|
|
39
|
+
md: {},
|
|
40
|
+
lg: {},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
}),
|
|
44
|
+
button: cva({
|
|
45
|
+
base: {
|
|
46
|
+
color: 'info.main',
|
|
47
|
+
cursor: 'pointer',
|
|
48
|
+
_hover: { textDecoration: 'underline' },
|
|
49
|
+
},
|
|
50
|
+
variants: {
|
|
51
|
+
size: {
|
|
52
|
+
sm: { fontSize: 'xs' },
|
|
53
|
+
md: {},
|
|
54
|
+
lg: {},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}),
|
|
58
|
+
input: css({
|
|
59
|
+
display: 'none',
|
|
60
|
+
}),
|
|
61
|
+
};
|
|
62
|
+
export const FileInput = () => {
|
|
63
|
+
// Extract Context
|
|
64
|
+
const { id, name, allowedFileTypes, value, maxNumberFiles, isDragging, required, setIsDragging, size, status, supportedFormatsText, processFile, } = useFileUploadContext();
|
|
65
|
+
const fileInputRef = useRef(null);
|
|
66
|
+
// Drag UI Reactions
|
|
67
|
+
const handleDragOver = useCallback((e) => {
|
|
68
|
+
e.preventDefault();
|
|
69
|
+
setIsDragging(true);
|
|
70
|
+
}, []);
|
|
71
|
+
const handleDragLeave = useCallback((e) => {
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
setIsDragging(false);
|
|
74
|
+
}, []);
|
|
75
|
+
const handleDrop = useCallback((e) => {
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
setIsDragging(false);
|
|
78
|
+
const file = e.dataTransfer.files[0];
|
|
79
|
+
processFile(file);
|
|
80
|
+
}, []);
|
|
81
|
+
const handleFileUpload = (e) => {
|
|
82
|
+
const file = e.target.files?.[0];
|
|
83
|
+
if (file) {
|
|
84
|
+
processFile(file);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
// If Maximum FIles Reached, return empty
|
|
88
|
+
if (maxNumberFiles !== undefined && value.length >= maxNumberFiles) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
return (_jsxs("div", { className: cx(styles.dropzone({ size }), isDragging && styles.isDragging), onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, children: [_jsx(Icon, { name: "UploadSimple", size: size === 'sm' ? 24 : 48, color: "gray" }), _jsxs("div", { className: styles.contents({ size }), children: [_jsxs("span", { children: [!(size === 'sm') && _jsx(Text, { align: "center", children: "Drag and drop your file here" }), supportedFormatsText && (_jsx(Text, { align: "center", color: "text-secondary", size: "xxs", children: supportedFormatsText })), status && (_jsx(Text, { align: "center", color: "error", size: "xxs", children: status }))] }), _jsx("input", { type: "file", id: id, name: name, className: styles.input, accept: allowedFileTypes?.join(','), onChange: handleFileUpload, required: required, ref: fileInputRef }), _jsx("button", { className: styles.button({ size }), type: "button", onClick: () => fileInputRef.current?.click(), children: "Select a File" })] })] }));
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=file-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-input.js","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-input.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,SAAS;AACT,MAAM,MAAM,GAAG;IACd,QAAQ,EAAE,GAAG,CAAC;QACb,IAAI,EAAE;YACL,MAAM,EAAE,YAAY;YACpB,EAAE,EAAE,MAAM;YACV,OAAO,EAAE,IAAI;YACb,SAAS,EAAE,QAAQ;YACnB,OAAO,EAAE,MAAM;YACf,UAAU,EAAE,QAAQ;YACpB,WAAW,EAAE,UAAU;SACvB;QACD,QAAQ,EAAE;YACT,IAAI,EAAE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1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-content.d.ts","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-upload-content.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,+CAiD7B,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { css } from '../../../../styled-system/css';
|
|
4
|
+
import { FormLabel } from '../../form-label';
|
|
5
|
+
import { useFileUploadContext } from '../file-upload-context';
|
|
6
|
+
import { Divider, IconButton } from '../../../../components/ui';
|
|
7
|
+
import { FileInput } from './file-input';
|
|
8
|
+
import { FilePreview } from './item-previews';
|
|
9
|
+
import { FileUploadPreview } from './file-upload-preview';
|
|
10
|
+
export const FileUploadContent = () => {
|
|
11
|
+
const { value, name, title, removeFile, selectedFile } = useFileUploadContext();
|
|
12
|
+
const styles = {
|
|
13
|
+
container: css({
|
|
14
|
+
width: '100%',
|
|
15
|
+
padding: '1',
|
|
16
|
+
}),
|
|
17
|
+
fileWrapper: css({
|
|
18
|
+
marginBottom: '2',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
gap: '1',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
}),
|
|
23
|
+
};
|
|
24
|
+
return (_jsxs("div", { className: styles.container, children: [_jsx(FormLabel, { name: name, title: title }), _jsx(Divider, { width: "100%", marginY: "2px" }), _jsxs("div", { children: [value && (_jsx("div", { className: styles.fileWrapper, children: value.map((file, index) => (_jsx(FilePreview, { file: file, actions: _jsx(IconButton, { onClick: () => removeFile(index), name: "XSquare", size: "sm", color: "error" }) }, index))) })), !selectedFile ? (_jsx(FileInput, {})) : (
|
|
25
|
+
// Preview Selected File
|
|
26
|
+
_jsx(FileUploadPreview, {}))] })] }));
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=file-upload-content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-content.js","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-upload-content.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAEhF,MAAM,MAAM,GAAG;QACd,SAAS,EAAE,GAAG,CAAC;YACd,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,GAAG;SACZ,CAAC;QACF,WAAW,EAAE,GAAG,CAAC;YAChB,YAAY,EAAE,GAAG;YACjB,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,GAAG;YACR,aAAa,EAAE,QAAQ;SACvB,CAAC;KACF,CAAC;IAEF,OAAO,CACN,eAAK,SAAS,EAAE,MAAM,CAAC,SAAS,aAC/B,KAAC,SAAS,IAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,GAAI,EACvC,KAAC,OAAO,IAAC,KAAK,EAAC,MAAM,EAAC,OAAO,EAAC,KAAK,GAAG,EACtC,0BAEE,KAAK,IAAI,CACT,cAAK,SAAS,EAAE,MAAM,CAAC,WAAW,YAChC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC3B,KAAC,WAAW,IAEX,IAAI,EAAE,IAAI,EACV,OAAO,EACN,KAAC,UAAU,IACV,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAChC,IAAI,EAAC,SAAS,EACd,IAAI,EAAC,IAAI,EACT,KAAK,EAAC,OAAO,GACZ,IARE,KAAK,CAUT,CACF,CAAC,GACG,CACN,EACA,CAAC,YAAY,CAAC,CAAC,CAAC,CAChB,KAAC,SAAS,KAAG,CACb,CAAC,CAAC,CAAC;oBACH,wBAAwB;oBACxB,KAAC,iBAAiB,KAAG,CACrB,IACI,IACD,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-preview.d.ts","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-upload-preview.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,2DA4F7B,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { isFileImageType } from '../../../../utils';
|
|
4
|
+
import { TextInput } from '../../text-input';
|
|
5
|
+
import { useFileUploadContext } from '../file-upload-context';
|
|
6
|
+
import { FilePreview, ImageDisplay } from './item-previews';
|
|
7
|
+
import { Button } from '../../../../components/ui';
|
|
8
|
+
import { css } from '../../../../styled-system/css';
|
|
9
|
+
import { Text } from '../../../../components/typography';
|
|
10
|
+
export const FileUploadPreview = () => {
|
|
11
|
+
const { selectedFile, preview, customFilename, setCustomFilename, alt, setAlt, handleClearFile, saveFile, } = useFileUploadContext();
|
|
12
|
+
if (!selectedFile) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const styles = {
|
|
16
|
+
container: css({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
gap: '4',
|
|
19
|
+
flexDirection: 'column',
|
|
20
|
+
width: '100%',
|
|
21
|
+
marginX: 'auto',
|
|
22
|
+
justifyContent: {
|
|
23
|
+
base: 'normal',
|
|
24
|
+
md: 'space-between',
|
|
25
|
+
},
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
}),
|
|
28
|
+
contents: css({
|
|
29
|
+
width: '100%',
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
justifyContent: 'start',
|
|
33
|
+
gap: '2',
|
|
34
|
+
}),
|
|
35
|
+
item: css({
|
|
36
|
+
width: '100%',
|
|
37
|
+
}),
|
|
38
|
+
actionBlock: css({
|
|
39
|
+
alignSelf: 'flex-end',
|
|
40
|
+
display: 'flex',
|
|
41
|
+
gap: '3',
|
|
42
|
+
flexDirection: 'column',
|
|
43
|
+
}),
|
|
44
|
+
actionContent: css({
|
|
45
|
+
display: 'flex',
|
|
46
|
+
gap: '2',
|
|
47
|
+
}),
|
|
48
|
+
};
|
|
49
|
+
return (_jsxs("div", { className: styles.container, children: [preview ? _jsx(ImageDisplay, { src: preview }) : _jsx(FilePreview, { file: selectedFile }), _jsxs("div", { className: styles.contents, children: [_jsxs("div", { className: styles.item, children: [_jsx(TextInput, { name: "filename", title: "Filename:", value: customFilename, onChange: (e) => setCustomFilename(e.target.value), required: true }), _jsxs(Text, { color: "text-secondary", size: "xs", children: ["Extension: .", selectedFile.name.split('.').pop()] })] }), isFileImageType(selectedFile) && (_jsx("div", { className: styles.item, children: _jsx(TextInput, { name: "alt", title: "Alt Text:", value: alt, onChange: (e) => setAlt(e.target.value) }) }))] }), _jsx("div", { className: styles.actionBlock, children: _jsx("div", { className: styles.actionContent, children: _jsxs(_Fragment, { children: [_jsx(Button, { type: "button", color: "error", onClick: handleClearFile, children: "Remove" }), _jsx(Button, { type: "button", onClick: saveFile, fullWidth: true, children: "Add File" })] }) }) })] }));
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=file-upload-preview.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-preview.js","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/file-upload-preview.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACrC,MAAM,EACL,YAAY,EACZ,OAAO,EACP,cAAc,EACd,iBAAiB,EACjB,GAAG,EACH,MAAM,EACN,eAAe,EACf,QAAQ,GACR,GAAG,oBAAoB,EAAE,CAAC;IAE3B,IAAI,CAAC,YAAY,EAAE,CAAC;QACnB,OAAO;IACR,CAAC;IAED,MAAM,MAAM,GAAG;QACd,SAAS,EAAE,GAAG,CAAC;YACd,OAAO,EAAE,MAAM;YACf,GAAG,EAAE,GAAG;YACR,aAAa,EAAE,QAAQ;YACvB,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,MAAM;YACf,cAAc,EAAE;gBACf,IAAI,EAAE,QAAQ;gBACd,EAAE,EAAE,eAAe;aACnB;YACD,UAAU,EAAE,QAAQ;SACpB,CAAC;QACF,QAAQ,EAAE,GAAG,CAAC;YACb,KAAK,EAAE,MAAM;YACb,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,OAAO;YACvB,GAAG,EAAE,GAAG;SACR,CAAC;QACF,IAAI,EAAE,GAAG,CAAC;YACT,KAAK,EAAE,MAAM;SACb,CAAC;QAC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nC,8BACC,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,OAAO,EAAC,OAAO,EAAE,eAAe,uBAEnD,EACT,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,+BAEzC,IACP,GACE,GACD,IACD,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type ImageDisplayProps = {
|
|
3
|
+
src: string;
|
|
4
|
+
action?: () => void;
|
|
5
|
+
};
|
|
6
|
+
export declare const ImageDisplay: ({ src, action }: ImageDisplayProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export type FilePreviewProps = {
|
|
8
|
+
file: File;
|
|
9
|
+
actions?: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
export declare const FilePreview: ({ file, actions }: FilePreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=item-previews.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-previews.d.ts","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/item-previews.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,iBAAiB,iBAAiB,4CAmC9D,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,IAAI,CAAC;IACX,OAAO,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,mBAAmB,gBAAgB,4CAoC9D,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '../../../../components/typography';
|
|
3
|
+
import { Icon, IconButton } from '../../../../components/ui';
|
|
4
|
+
import { css } from '../../../../styled-system/css';
|
|
5
|
+
import { isFileImageType } from '../../../../utils';
|
|
6
|
+
export const ImageDisplay = ({ src, action }) => {
|
|
7
|
+
const styles = {
|
|
8
|
+
image: css({
|
|
9
|
+
width: '100%',
|
|
10
|
+
height: '100%',
|
|
11
|
+
objectFit: 'cover',
|
|
12
|
+
borderRadius: 'md',
|
|
13
|
+
maxHeight: '6rem',
|
|
14
|
+
maxWidth: '6rem',
|
|
15
|
+
}),
|
|
16
|
+
wrapper: css({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'row',
|
|
19
|
+
justifyContent: 'center',
|
|
20
|
+
gap: '3',
|
|
21
|
+
}),
|
|
22
|
+
};
|
|
23
|
+
const fixedImageStyles = {
|
|
24
|
+
height: 'auto',
|
|
25
|
+
width: 'auto',
|
|
26
|
+
maxWidth: '256px',
|
|
27
|
+
maxHeight: '400px',
|
|
28
|
+
};
|
|
29
|
+
if (action) {
|
|
30
|
+
return (_jsxs("div", { className: styles.wrapper, children: [_jsx("img", { src: src, alt: "Preview", className: styles.image }), _jsx(IconButton, { onClick: action, name: "XSquare", size: "md", color: "error" })] }));
|
|
31
|
+
}
|
|
32
|
+
return _jsx("img", { src: src, alt: "Preview", className: styles.image, style: fixedImageStyles });
|
|
33
|
+
};
|
|
34
|
+
export const FilePreview = ({ file, actions }) => {
|
|
35
|
+
const styles = {
|
|
36
|
+
container: css({
|
|
37
|
+
width: '100%',
|
|
38
|
+
display: 'flex',
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'space-between',
|
|
41
|
+
borderRadius: 'md',
|
|
42
|
+
backgroundColor: 'gray.light',
|
|
43
|
+
paddingY: '2',
|
|
44
|
+
paddingX: '5',
|
|
45
|
+
}),
|
|
46
|
+
innerWrapper: css({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
gap: '2',
|
|
49
|
+
}),
|
|
50
|
+
content: css({
|
|
51
|
+
overflow: 'hidden',
|
|
52
|
+
textOverflow: 'ellipsis',
|
|
53
|
+
whiteSpace: 'nowrap',
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
return (_jsxs("div", { className: styles.container, children: [_jsxs("div", { className: styles.innerWrapper, children: [_jsx(Icon, { name: isFileImageType(file) ? 'Image' : 'FileText', size: 48, color: "gray" }), _jsxs("div", { className: styles.content, children: [_jsx(Text, { size: "sm", children: file.name }), _jsxs(Text, { size: "xs", color: "text-secondary", children: [(file.size / 1024).toFixed(1), " KB"] })] })] }), actions && actions] }));
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=item-previews.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"item-previews.js","sourceRoot":"","sources":["../../../../../src/components/form-elements/file-upload/components/item-previews.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAQ1C,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAE,GAAG,EAAE,MAAM,EAAqB,EAAE,EAAE;IAClE,MAAM,MAAM,GAAG;QACd,KAAK,EAAE,GAAG,CAAC;YACV,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,OAAO;YAClB,YAAY,EAAE,IAAI;YAClB,SAAS,EAAE,MAAM;YACjB,QAAQ,EAAE,MAAM;SAChB,CAAC;QACF,OAAO,EAAE,GAAG,CAAC;YACZ,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,KAAK;YACpB,cAAc,EAAE,QAAQ;YACxB,GAAG,EAAE,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,MAAM,CAAC,SAAS,aAC/B,eAAK,SAAS,EAAE,MAAM,CAAC,YAAY,aAClC,KAAC,IAAI,IAAC,IAAI,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAC,MAAM,GAAG,EACnF,eAAK,SAAS,EAAE,MAAM,CAAC,OAAO,aAC7B,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,YAAE,IAAI,CAAC,IAAI,GAAQ,EAClC,MAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,gBAAgB,aACpC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WACxB,IACF,IACD,EACL,OAAO,IAAI,OAAO,IACd,CACN,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-context.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload-context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAO,MAAO,kBAAkB,2DAAE,oBAAoB,sCACE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload-context.js","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload-context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AAGjD,MAAM,CAAC,MAAM,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,GACtD,sBAAsB,CAAoB,YAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FileUploadProps } from './file-upload.types';
|
|
2
|
+
/**
|
|
3
|
+
* File upload component with drag-and-drop, file validation, image preview,
|
|
4
|
+
* and optional filename/alt text editing before saving.
|
|
5
|
+
*
|
|
6
|
+
* Validates against allowed MIME types, max file size, and max file count.
|
|
7
|
+
* Image files generate a preview; non-image files show a generic indicator.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <FileUpload
|
|
11
|
+
* name="attachments"
|
|
12
|
+
* value={value}
|
|
13
|
+
* onChange={onChange}
|
|
14
|
+
* allowedFileTypes={['image/*', 'application/pdf']}
|
|
15
|
+
* maxFileSize={5 * 1024 * 1024}
|
|
16
|
+
* maxNumberFiles={3}
|
|
17
|
+
* />
|
|
18
|
+
*/
|
|
19
|
+
export declare const FileUpload: ({ title, name, id, value, onChange, allowedFileTypes, maxFileSize, maxNumberFiles, supportedFormatsText, required, size, }: FileUploadProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=file-upload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-upload.d.ts","sourceRoot":"","sources":["../../../../src/components/form-elements/file-upload/file-upload.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAkB,MAAM,qBAAqB,CAAC;AAKtE;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,GAAI,4HAYxB,eAAe,4CA+IjB,CAAC"}
|