@powerhousedao/document-engineering 1.28.0 → 1.30.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/dist/src/scalars/components/phone-number-field/index.d.ts +3 -0
- package/dist/src/scalars/components/phone-number-field/index.d.ts.map +1 -0
- package/dist/src/scalars/components/phone-number-field/index.js +2 -0
- package/dist/src/scalars/components/phone-number-field/index.js.map +1 -0
- package/dist/src/scalars/components/phone-number-field/phone-number-field.d.ts +3 -0
- package/dist/src/scalars/components/phone-number-field/phone-number-field.d.ts.map +1 -0
- package/dist/src/scalars/components/phone-number-field/phone-number-field.js +17 -0
- package/dist/src/scalars/components/phone-number-field/phone-number-field.js.map +1 -0
- package/dist/src/scalars/components/phone-number-field/types.d.ts +5 -0
- package/dist/src/scalars/components/phone-number-field/types.d.ts.map +1 -0
- package/dist/src/scalars/components/phone-number-field/types.js +2 -0
- package/dist/src/scalars/components/phone-number-field/types.js.map +1 -0
- package/dist/src/table/components/cells/render-cell/render-cell.d.ts +2 -2
- package/dist/src/table/components/cells/render-cell/render-cell.d.ts.map +1 -1
- package/dist/src/table/components/cells/render-cell/render-cell.js +4 -4
- package/dist/src/table/components/cells/render-cell/render-cell.js.map +1 -1
- package/dist/src/table/components/cells/render-cell/use-cell-logic.d.ts +3 -4
- package/dist/src/table/components/cells/render-cell/use-cell-logic.d.ts.map +1 -1
- package/dist/src/table/components/cells/render-cell/use-cell-logic.js +3 -3
- package/dist/src/table/components/cells/render-cell/use-cell-logic.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/aid-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/aid-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/aid-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/aid-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/amount-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/amount-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/amount-editor.js +15 -0
- package/dist/src/table/components/default-cell-editors/amount-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/boolean-editor.d.ts +1 -1
- package/dist/src/table/components/default-cell-editors/boolean-editor.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-editors/boolean-editor.js +1 -1
- package/dist/src/table/components/default-cell-editors/boolean-editor.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/country-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/country-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/country-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/country-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/currency-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/currency-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/currency-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/currency-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/date-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/date-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/date-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/date-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/datetime-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/datetime-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/datetime-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/datetime-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/email-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/email-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/email-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/email-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/enum-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/enum-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/enum-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/enum-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/get-cell-editor-fn.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-editors/get-cell-editor-fn.js +44 -8
- package/dist/src/table/components/default-cell-editors/get-cell-editor-fn.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/index.d.ts +3 -3
- package/dist/src/table/components/default-cell-editors/index.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-editors/index.js +3 -3
- package/dist/src/table/components/default-cell-editors/index.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/number-editor.d.ts +1 -1
- package/dist/src/table/components/default-cell-editors/number-editor.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-editors/number-editor.js +1 -1
- package/dist/src/table/components/default-cell-editors/number-editor.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/oid-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/oid-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/oid-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/oid-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/phid-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/phid-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/phid-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/phid-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/string-editor.d.ts +1 -1
- package/dist/src/table/components/default-cell-editors/string-editor.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-editors/string-editor.js +1 -1
- package/dist/src/table/components/default-cell-editors/string-editor.js.map +1 -1
- package/dist/src/table/components/default-cell-editors/time-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/time-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/time-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/time-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-editors/url-editor.d.ts +4 -0
- package/dist/src/table/components/default-cell-editors/url-editor.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-editors/url-editor.js +12 -0
- package/dist/src/table/components/default-cell-editors/url-editor.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/aid-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/aid-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/aid-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/aid-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/amount-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/amount-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/amount-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/amount-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/country-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/country-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/country-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/country-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/currency-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/currency-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/currency-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/currency-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/date-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/date-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/date-render.js +24 -0
- package/dist/src/table/components/default-cell-renderers/date-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/datetime-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/datetime-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/datetime-render.js +24 -0
- package/dist/src/table/components/default-cell-renderers/datetime-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/email-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/email-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/email-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/email-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/enum-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/enum-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/enum-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/enum-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/get-render-fn.d.ts.map +1 -1
- package/dist/src/table/components/default-cell-renderers/get-render-fn.js +36 -0
- package/dist/src/table/components/default-cell-renderers/get-render-fn.js.map +1 -1
- package/dist/src/table/components/default-cell-renderers/oid-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/oid-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/oid-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/oid-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/phid-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/phid-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/phid-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/phid-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/time-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/time-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/time-render.js +11 -0
- package/dist/src/table/components/default-cell-renderers/time-render.js.map +1 -0
- package/dist/src/table/components/default-cell-renderers/url-render.d.ts +4 -0
- package/dist/src/table/components/default-cell-renderers/url-render.d.ts.map +1 -0
- package/dist/src/table/components/default-cell-renderers/url-render.js +12 -0
- package/dist/src/table/components/default-cell-renderers/url-render.js.map +1 -0
- package/dist/src/table/components/default-fns/default-column-config.d.ts.map +1 -1
- package/dist/src/table/components/default-fns/default-column-config.js +12 -0
- package/dist/src/table/components/default-fns/default-column-config.js.map +1 -1
- package/dist/src/table/components/default-sort-columns/default-sort-fns.d.ts.map +1 -1
- package/dist/src/table/components/default-sort-columns/default-sort-fns.js +12 -0
- package/dist/src/table/components/default-sort-columns/default-sort-fns.js.map +1 -1
- package/dist/src/table/components/rows/render-row.js +3 -3
- package/dist/src/table/components/rows/render-row.js.map +1 -1
- package/dist/src/table/components/rows/row-actions.d.ts.map +1 -1
- package/dist/src/table/components/rows/row-actions.js +5 -2
- package/dist/src/table/components/rows/row-actions.js.map +1 -1
- package/dist/src/table/components/table-provider/table-provider.d.ts.map +1 -1
- package/dist/src/table/components/table-provider/table-provider.js +2 -4
- package/dist/src/table/components/table-provider/table-provider.js.map +1 -1
- package/dist/src/table/components/table-provider/table-reducer.d.ts.map +1 -1
- package/dist/src/table/components/table-provider/table-reducer.js +0 -3
- package/dist/src/table/components/table-provider/table-reducer.js.map +1 -1
- package/dist/src/table/examples/table-editing/table-editing.d.ts.map +1 -1
- package/dist/src/table/examples/table-editing/table-editing.js +9 -7
- package/dist/src/table/examples/table-editing/table-editing.js.map +1 -1
- package/dist/src/table/hooks/useGlobalTableKeyEvents.d.ts.map +1 -1
- package/dist/src/table/hooks/useGlobalTableKeyEvents.js +20 -0
- package/dist/src/table/hooks/useGlobalTableKeyEvents.js.map +1 -1
- package/dist/src/table/index.d.ts +1 -0
- package/dist/src/table/index.d.ts.map +1 -1
- package/dist/src/table/index.js +1 -0
- package/dist/src/table/index.js.map +1 -1
- package/dist/src/table/logic/table-api.d.ts.map +1 -1
- package/dist/src/table/logic/table-api.js +43 -16
- package/dist/src/table/logic/table-api.js.map +1 -1
- package/dist/src/table/table/mock-data.d.ts +1 -0
- package/dist/src/table/table/mock-data.d.ts.map +1 -1
- package/dist/src/table/table/mock-data.js +7 -0
- package/dist/src/table/table/mock-data.js.map +1 -1
- package/dist/src/table/table/object-set-table.d.ts.map +1 -1
- package/dist/src/table/table/object-set-table.js +5 -1
- package/dist/src/table/table/object-set-table.js.map +1 -1
- package/dist/src/table/table/types.d.ts +12 -3
- package/dist/src/table/table/types.d.ts.map +1 -1
- package/dist/src/table/table/utils.js +2 -2
- package/dist/src/table/table/utils.js.map +1 -1
- package/dist/src/ui/components/data-entry/amount-input/use-amount-input.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/amount-input/use-amount-input.js +3 -2
- package/dist/src/ui/components/data-entry/amount-input/use-amount-input.js.map +1 -1
- package/dist/src/ui/components/data-entry/country-code-picker/country-code-picker.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/country-code-picker/country-code-picker.js +8 -3
- package/dist/src/ui/components/data-entry/country-code-picker/country-code-picker.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/file-input.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/file-input.js +15 -7
- package/dist/src/ui/components/data-entry/file-input/file-input.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/index.d.ts +1 -1
- package/dist/src/ui/components/data-entry/file-input/index.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.d.ts +12 -3
- package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.js +16 -8
- package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/loading-bar.d.ts +7 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/loading-bar.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/loading-bar.js +8 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/loading-bar.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-image.d.ts +9 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-image.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-image.js +13 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-image.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.d.ts +9 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.js +13 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.d.ts +8 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.js +11 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.d.ts +10 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.js +13 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-header.d.ts +9 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-header.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-header.js +9 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-header.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.d.ts +10 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.d.ts.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.js +13 -0
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.js.map +1 -0
- package/dist/src/ui/components/data-entry/file-input/types.d.ts +17 -0
- package/dist/src/ui/components/data-entry/file-input/types.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/types.js +6 -1
- package/dist/src/ui/components/data-entry/file-input/types.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/useUploadFile.d.ts +8 -0
- package/dist/src/ui/components/data-entry/file-input/useUploadFile.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/useUploadFile.js +63 -2
- package/dist/src/ui/components/data-entry/file-input/useUploadFile.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/utils.d.ts +6 -0
- package/dist/src/ui/components/data-entry/file-input/utils.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/utils.js +96 -0
- package/dist/src/ui/components/data-entry/file-input/utils.js.map +1 -1
- package/dist/src/ui/components/data-entry/phone-number-input/phone-number-input.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/phone-number-input/phone-number-input.js +7 -4
- package/dist/src/ui/components/data-entry/phone-number-input/phone-number-input.js.map +1 -1
- package/dist/src/ui/components/data-entry/phone-number-input/types.d.ts +3 -2
- package/dist/src/ui/components/data-entry/phone-number-input/types.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/phone-number-input/use-phone-number-input.d.ts +9 -1
- package/dist/src/ui/components/data-entry/phone-number-input/use-phone-number-input.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/phone-number-input/use-phone-number-input.js +192 -22
- package/dist/src/ui/components/data-entry/phone-number-input/use-phone-number-input.js.map +1 -1
- package/dist/src/ui/components/data-entry/select/command-list-item.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/select/command-list-item.js +1 -1
- package/dist/src/ui/components/data-entry/select/command-list-item.js.map +1 -1
- package/dist/src/ui/components/data-entry/textarea/textarea.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/textarea/textarea.js +23 -9
- package/dist/src/ui/components/data-entry/textarea/textarea.js.map +1 -1
- package/dist/src/ui/components/icon-components/BookOpenText.d.ts +7 -0
- package/dist/src/ui/components/icon-components/BookOpenText.d.ts.map +1 -0
- package/dist/src/ui/components/icon-components/BookOpenText.js +7 -0
- package/dist/src/ui/components/icon-components/BookOpenText.js.map +1 -0
- package/dist/src/ui/components/icon-components/BrokenImage.d.ts +7 -0
- package/dist/src/ui/components/icon-components/BrokenImage.d.ts.map +1 -0
- package/dist/src/ui/components/icon-components/BrokenImage.js +7 -0
- package/dist/src/ui/components/icon-components/BrokenImage.js.map +1 -0
- package/dist/src/ui/components/icon-components/ContentUnavailableIcon.d.ts +7 -0
- package/dist/src/ui/components/icon-components/ContentUnavailableIcon.d.ts.map +1 -0
- package/dist/src/ui/components/icon-components/ContentUnavailableIcon.js +7 -0
- package/dist/src/ui/components/icon-components/ContentUnavailableIcon.js.map +1 -0
- package/dist/src/ui/components/icon-components/Image.d.ts.map +1 -1
- package/dist/src/ui/components/icon-components/Image.js +2 -2
- package/dist/src/ui/components/icon-components/Image.js.map +1 -1
- package/dist/src/ui/components/icon-components/index.d.ts +1 -1
- package/dist/src/ui/components/icon-components/index.d.ts.map +1 -1
- package/dist/src/ui/components/icon-components/index.js +12 -0
- package/dist/src/ui/components/icon-components/index.js.map +1 -1
- package/dist/style.css +85 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-input.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/file-input.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,kCAAkC,CAAA;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"file-input.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/file-input.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAEpC,OAAO,EAAE,EAAE,EAAE,MAAM,kCAAkC,CAAA;AACrD,OAAO,cAAc,MAAM,yCAAyC,CAAA;AAEpE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,WAAW,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,2DAA2D,CAAA;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,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,GACb,IACE,EACL,MAAM,KAAK,MAAM,IAAI,CACpB,cACE,SAAS,EAAE,EAAE,CACX,+EAA+E,EAC/E,QAAQ,IAAI,qBAAqB,CAClC,YAED,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,IAAI,EACb,QAAQ,EAAE,QAAQ,gBACP,aAAa,EACxB,SAAS,EAAE,EAAE,CACX,0HAA0H;gCAC1H,UAAU;gCACV,WAAW;gCACX,QAAQ;gCACR,yDAAyD,CAC1D,4BAGM,GACL,CACP,IACG,GACF,EACN,eAAK,SAAS,EAAC,0BAA0B,aACvC,gBAAM,SAAS,EAAC,wDAAwD,2BAC3D,0BAA0B,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IACnE,EACP,gBAAM,SAAS,EAAC,wDAAwD,sBAChE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAC,IAC5B,IACH,EACN,eAAK,SAAS,EAAC,0BAA0B,aACtC,QAAQ,IAAI,KAAC,eAAe,IAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAC,OAAO,GAAG,EAC9D,UAAU,IAAI,KAAC,eAAe,IAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC,SAAS,GAAG,IACjE,IACF,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,SAAS,CAAC,WAAW,GAAG,WAAW,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UploadFile } from '../types.js';
|
|
1
|
+
import type { PreviewStatus, PreviewType, UploadFile } from '../types.js';
|
|
2
2
|
interface FileUploadItemProps {
|
|
3
3
|
fileName?: string;
|
|
4
4
|
fileSize?: string;
|
|
@@ -10,7 +10,16 @@ interface FileUploadItemProps {
|
|
|
10
10
|
errorsUpload?: string[];
|
|
11
11
|
status?: UploadFile;
|
|
12
12
|
showPreview?: boolean;
|
|
13
|
+
preview?: string;
|
|
14
|
+
isPreviewOpen?: boolean;
|
|
15
|
+
handleOnPreview?: () => void;
|
|
16
|
+
handleOnCancelPreview?: () => void;
|
|
17
|
+
previewStatus: PreviewStatus;
|
|
18
|
+
typePreview: PreviewType;
|
|
13
19
|
}
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
declare const FileUploadItem: {
|
|
21
|
+
({ fileName, fileSize, progress, onCancel, onReload, className, mimeType, errorsUpload, status, showPreview, preview, isPreviewOpen, handleOnPreview, handleOnCancelPreview, previewStatus, typePreview, }: FileUploadItemProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export { FileUploadItem };
|
|
16
25
|
//# sourceMappingURL=file-upload-item.d.ts.map
|
package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-item.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/file-upload-item.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"file-upload-item.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/file-upload-item.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAazE,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC3D,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,UAAU,CAAA;IAGnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAA;IAClC,aAAa,EAAE,aAAa,CAAA;IAC5B,WAAW,EAAE,WAAW,CAAA;CACzB;AAED,QAAA,MAAM,cAAc;gNAmBjB,mBAAmB;;CAiIrB,CAAA;AAID,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
-
import { ProgressBar } from '../../../../../scalars/components/fragments/progress-bar/
|
|
4
|
-
import { Icon } from '../../../icon/
|
|
3
|
+
import { ProgressBar } from '../../../../../scalars/components/fragments/progress-bar/index.js';
|
|
4
|
+
import { Icon } from '../../../icon/index.js';
|
|
5
5
|
import { FormMessageList } from '../../../../../scalars/components/fragments/form-message/message-list.js';
|
|
6
6
|
import { getIconKey, MESSAGES } from '../utils.js';
|
|
7
|
-
|
|
7
|
+
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogTitle, } from '../../../confirm/alert-dialog.js';
|
|
8
|
+
import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
|
|
9
|
+
import PreviewFilePreview from './preview-file.js';
|
|
10
|
+
import PreviewImagePreview from './preview-image.js';
|
|
11
|
+
import { UnsupportedFile } from './place-holder-unsupported.js';
|
|
12
|
+
const FileUploadItem = ({ fileName = '', fileSize = '', progress = undefined, onCancel, onReload, className, mimeType = '', errorsUpload, status = 'idle',
|
|
13
|
+
// Preview Props
|
|
14
|
+
showPreview, preview, isPreviewOpen, handleOnPreview, handleOnCancelPreview = () => null, previewStatus, typePreview, }) => {
|
|
8
15
|
const showProgress = status === 'uploading' && progress !== undefined && progress >= 0 && progress < 100;
|
|
9
16
|
const showSuccess = status === 'success';
|
|
10
17
|
const showError = status === 'error';
|
|
@@ -17,10 +24,11 @@ export const FileUploadItem = ({ fileName = '', fileSize = '', progress = undefi
|
|
|
17
24
|
e.stopPropagation();
|
|
18
25
|
onReload?.(e);
|
|
19
26
|
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return (_jsxs("div", { className: cn('bg-white rounded-md shadow-[0px_2px_12px_0px_rgba(37,42,52,0.10)] w-full', 'pt-2 px-2 pb-1', 'border-gray-100', className), children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsxs("div", { className: "flex flex-1 gap-2 ", children: [_jsx(Icon, { name: getIconKey(mimeType), size: 36 }), _jsxs("div", { className: "flex w-23 flex-col", children: [_jsx("span", { className: cn('text-gray-900 text-xs font-medium leading-4.5', 'truncate'), children: fileName }), _jsx("span", { className: "text-gray-500 text-xs leading-4.5 font-medium", children: fileSize })] })] }), _jsx("div", { className: "flex flex-col items-center gap-2", children: _jsxs("div", { className: "flex items-center gap-2", children: [showProgress && _jsxs("span", { className: "text-gray-600 font-medium text-xs", children: [Math.round(progress), "%"] }), status === 'error' && (_jsx("button", { type: "button", onClick: handleOnReload, className: "text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Reload upload", children: _jsx(Icon, { name: "Reload", size: 16, className: "text-gray-900" }) })), _jsx("button", { type: "button", onClick: handleOnCancel, className: "text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Cancel Upload", children: _jsx(Icon, { name: "XmarkLight", size: 16, className: "text-gray-900" }) })] }) })] }), _jsxs("div", { className: "flex flex-col mt-0.5 h-4.5", children: [showProgress && (_jsx(ProgressBar, { value: progress, className: "h-2 bg-gray-100 [&_[data-slot=progress-bar-indicator]]:bg-blue-600" })), _jsxs("div", { className: "flex flex-row justify-between", role: "status", "aria-live": "polite", "aria-atomic": "true", children: [showSuccess && _jsx("span", { className: "text-green-700 text-xs leading-4.5 font-normal", children: MESSAGES.success }), showSuccess && showPreview && (_jsx("span", { className: "text-blue-900 text-xs leading-4.5 font-normal", onClick: handleOnPreview, children: MESSAGES.preview }))] }), showError && (_jsx("div", { role: "alert", "aria-live": "assertive", "aria-atomic": "true", children: _jsx("span", { className: "text-red-900 text-xs leading-4.5 font-normal", children: MESSAGES.error }) }))] }), showErrorsUpload && _jsx(FormMessageList, { messages: errorsUpload, type: "error", className: "gap-0.5" })] }));
|
|
27
|
+
return (_jsxs("div", { className: cn('bg-white rounded-md shadow-[0px_2px_12px_0px_rgba(37,42,52,0.10)] w-full', 'pt-2 px-2 pb-1', 'border-gray-100', className), children: [_jsxs("div", { className: "flex items-start gap-2", children: [_jsxs("div", { className: "flex flex-1 gap-2 ", children: [_jsx(Icon, { name: getIconKey(mimeType), size: 36 }), _jsxs("div", { className: "flex w-23 flex-col", children: [_jsx("span", { className: cn('text-gray-900 text-xs font-medium leading-4.5', 'truncate'), children: fileName }), _jsx("span", { className: "text-gray-500 text-xs leading-4.5 font-medium", children: fileSize })] })] }), _jsx("div", { className: "flex flex-col items-center gap-2", children: _jsxs("div", { className: "flex items-center gap-2", children: [showProgress && _jsxs("span", { className: "text-gray-600 font-medium text-xs", children: [Math.round(progress), "%"] }), status === 'error' && (_jsx("button", { type: "button", onClick: handleOnReload, className: "text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Reload upload" })), _jsx("button", { type: "button", onClick: handleOnCancel, className: "text-gray-400 hover:text-gray-600 transition-colors", "aria-label": "Cancel Upload", children: _jsx(Icon, { name: "XmarkLight", size: 16, className: "text-gray-900" }) })] }) })] }), _jsxs("div", { className: "flex flex-col mt-0.5 h-4.5", children: [showProgress && (_jsx(ProgressBar, { value: progress, className: "h-2 bg-gray-100 [&_[data-slot=progress-bar-indicator]]:bg-blue-600" })), _jsxs("div", { className: "flex flex-row justify-between", role: "status", "aria-live": "polite", "aria-atomic": "true", children: [showSuccess && _jsx("span", { className: "text-green-700 text-xs leading-4.5 font-normal", children: MESSAGES.success }), showSuccess && showPreview && (_jsx("button", { type: "button", onClick: handleOnPreview, className: "text-blue-900 text-xs leading-4.5 font-normal", "aria-label": "Open preview", children: MESSAGES.preview }))] }), showError && (_jsx("div", { role: "alert", "aria-live": "assertive", "aria-atomic": "true", children: _jsx("span", { className: "text-red-900 text-xs leading-4.5 font-normal", children: MESSAGES.error }) }))] }), showPreview && (_jsxs(AlertDialog, { open: isPreviewOpen, children: [_jsx(VisuallyHidden, { children: _jsx(AlertDialogTitle, { children: "Preview" }) }), _jsx(VisuallyHidden, { children: _jsx(AlertDialogDescription, { children: "Preview of the file" }) }), _jsxs(AlertDialogContent, { className: cn('p-0 border-0 shadow-none bg-transparent max-w-none w-auto h-auto'), style: {
|
|
28
|
+
width: typePreview === 'pdf' || typePreview === 'unknown' ? '500px' : '368px',
|
|
29
|
+
height: typePreview === 'pdf' || typePreview === 'unknown' ? '652px' : '384px',
|
|
30
|
+
}, children: [typePreview === 'pdf' && (_jsx(PreviewFilePreview, { className: "w-full h-full", status: previewStatus, onClose: handleOnCancelPreview, preview: preview })), typePreview === 'image' && (_jsx(PreviewImagePreview, { className: "w-full h-full", status: previewStatus, onClose: handleOnCancelPreview, preview: preview })), typePreview === 'unknown' && _jsx(UnsupportedFile, { status: previewStatus, onClose: handleOnCancelPreview }), typePreview === 'audio' && _jsx("div", { children: "Recording" })] })] })), showErrorsUpload && _jsx(FormMessageList, { messages: errorsUpload, type: "error", className: "gap-0.5" })] }));
|
|
25
31
|
};
|
|
32
|
+
FileUploadItem.displayName = 'FileUploadItem';
|
|
33
|
+
export { FileUploadItem };
|
|
26
34
|
//# sourceMappingURL=file-upload-item.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-upload-item.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/file-upload-item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"file-upload-item.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/file-upload-item.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,mEAAmE,CAAA;AAC/F,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,0EAA0E,CAAA;AAE1G,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,kCAAkC,CAAA;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,kBAAkB,MAAM,mBAAmB,CAAA;AAClD,OAAO,mBAAmB,MAAM,oBAAoB,CAAA;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,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-bar.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/loading-bar.tsx"],"names":[],"mappings":"AAEA,UAAU,eAAe;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,QAAA,MAAM,UAAU,GAAI,yBAA8B,eAAe,KAAG,GAAG,CAAC,OAmBvE,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
+
const LoadingBar = ({ progress = 50, className }) => {
|
|
4
|
+
const valueProgress = Math.max(0, Math.min(100, progress));
|
|
5
|
+
return (_jsx("div", { className: cn('flex flex-col items-center justify-center gap-4', className), children: _jsx("progress", { value: valueProgress, max: 100, "aria-label": "Loading progress", className: cn('w-full h-[25px]', 'appearance-none overflow-hidden rounded-[100px] bg-gray-300', '[&::-webkit-progress-bar]:bg-gray-300', '[&::-webkit-progress-value]:bg-gray-500', '[&::-moz-progress-bar]:bg-gray-500') }) }));
|
|
6
|
+
};
|
|
7
|
+
export default LoadingBar;
|
|
8
|
+
//# sourceMappingURL=loading-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loading-bar.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/loading-bar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AAOxD,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,GAAG,EAAE,EAAE,SAAS,EAAmB,EAAe,EAAE;IAChF,MAAM,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE1D,OAAO,CACL,cAAK,SAAS,EAAE,EAAE,CAAC,iDAAiD,EAAE,SAAS,CAAC,YAC9E,mBACE,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,GAAG,gBACG,kBAAkB,EAC7B,SAAS,EAAE,EAAE,CACX,iBAAiB,EACjB,6DAA6D,EAC7D,uCAAuC,EACvC,yCAAyC,EACzC,oCAAoC,CACrC,GACD,GACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,UAAU,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
2
|
+
interface FilePreviewStateProps {
|
|
3
|
+
status: PreviewStatus;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PlaceHolderImage: ({ status, onClose, className }: FilePreviewStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=place-holder-image.d.ts.map
|
package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-image.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-image.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAOhE,UAAU,qBAAqB;IAC7B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,gBAAgB,GAAI,gCAAgC,qBAAqB,4CAoCrF,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PREVIEW_STATUS } from '../types.js';
|
|
3
|
+
import { STATUS_CONFIG_IMAGE } from '../utils.js';
|
|
4
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
5
|
+
import { Icon } from '../../../icon/index.js';
|
|
6
|
+
import PreviewHeader from './preview-header.js';
|
|
7
|
+
import LoadingBar from './loading-bar.js';
|
|
8
|
+
export const PlaceHolderImage = ({ status, onClose, className }) => {
|
|
9
|
+
const config = STATUS_CONFIG_IMAGE[status];
|
|
10
|
+
const icon = config.icon;
|
|
11
|
+
return (_jsxs("div", { className: cn('flex flex-col bg-white rounded-md shadow-[1px_4px_15px_0px_rgba(74,88,115,0.25)] px-6 py-4 gap-4', className), children: [_jsx(PreviewHeader, { status: status, onClose: onClose, title: "Image Preview" }), _jsxs("div", { className: "flex flex-col items-center justify-center bg-gray-100 w-full rounded-md overflow-hidden flex-1", children: [icon && (_jsx("div", { className: "relative", children: _jsx(Icon, { name: icon, size: 128, className: "text-gray-300" }) })), _jsxs("div", { className: "flex flex-col items-center justify-center gap-4", children: [config.title && _jsx("h3", { className: "text-xl font-bold leading-6 text-gray-500", children: config.title }), status === PREVIEW_STATUS.LOADING && _jsx(LoadingBar, { progress: 50, className: "w-[272px]" }), status !== PREVIEW_STATUS.CORRUPTED_FILE && config.message && (_jsx("p", { className: "text-center text-sm text-gray-500 mx-auto max-w-[296px] whitespace-pre-line", children: config.message }))] })] }), status === PREVIEW_STATUS.CORRUPTED_FILE && (_jsx("div", { className: " border-gray-200", children: _jsx("p", { className: "text-xs text-red-900 font-normal leading-4.5", children: config.message }) }))] }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=place-holder-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-image.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,mBAAmB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EAAC,8CAA8C,YAAE,MAAM,CAAC,OAAO,GAAK,GAC5E,CACP,IACG,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
2
|
+
interface PlaceHolderPdfProps {
|
|
3
|
+
status: PreviewStatus;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const PlaceHolderPdf: ({ status, onClose, className }: PlaceHolderPdfProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=place-holder-pdf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-pdf.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAMhE,UAAU,mBAAmB;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,eAAO,MAAM,cAAc,GAAI,gCAAgC,mBAAmB,4CA0CjF,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PreviewHeader from './preview-header.js';
|
|
3
|
+
import { PREVIEW_STATUS } from '../types.js';
|
|
4
|
+
import LoadingBar from './loading-bar.js';
|
|
5
|
+
import { STATUS_CONFIG_PDF } from '../utils.js';
|
|
6
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
7
|
+
import { Icon } from '../../../icon/index.js';
|
|
8
|
+
export const PlaceHolderPdf = ({ status, onClose, className }) => {
|
|
9
|
+
const config = STATUS_CONFIG_PDF[status];
|
|
10
|
+
const icon = config.icon;
|
|
11
|
+
return (_jsxs("div", { className: cn('flex flex-col bg-white rounded-md shadow-[1px_4px_15px_0px_rgba(37, 44, 56, 0.25)] px-6 py-4 gap-4 border border-gray-200 h-[652px] w-[500px]', className), children: [_jsx(PreviewHeader, { status: status, onClose: onClose }), _jsxs("div", { className: cn('flex-1 min-h-0 flex flex-col items-center justify-center bg-gray-100 w-full overflow-auto rounded-md', status === PREVIEW_STATUS.LOADING && 'gap-8', status !== PREVIEW_STATUS.LOADING && 'gap-4'), children: [icon && (_jsx("div", { className: "relative", children: _jsx(Icon, { name: icon, size: 256, className: "text-gray-300" }) })), _jsxs("div", { className: "flex flex-col items-center justify-center gap-4", children: [config.title && _jsx("h3", { className: "text-xl font-bold leading-6 text-gray-500", children: config.title }), status === PREVIEW_STATUS.LOADING && _jsx(LoadingBar, { progress: 50, className: "w-[375px]" }), status === PREVIEW_STATUS.UNSUPPORTED_FORMAT && (_jsx("p", { className: "text-center text-sm text-gray-500 mx-auto max-w-[375px] whitespace-pre-line", children: config.message }))] })] }), status === PREVIEW_STATUS.CORRUPTED_FILE && (_jsx("div", { className: " border-gray-200", children: _jsx("p", { className: "text-xs text-red-900 font-normal leading-4.5", children: config.message }) }))] }));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=place-holder-pdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-pdf.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-pdf.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAC/C,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChE,OAAO,UAAU,MAAM,kBAAkB,CAAA;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAQ7C,MAAM,CAA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0,0 +1,8 @@
|
|
|
1
|
+
import type { PreviewStatus } from '../types.js';
|
|
2
|
+
interface PlaceHolderPdfProps {
|
|
3
|
+
status: PreviewStatus;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const UnsupportedFile: ({ status, onClose }: PlaceHolderPdfProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=place-holder-unsupported.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-unsupported.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAKhD,UAAU,mBAAmB;IAC3B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,eAAO,MAAM,eAAe,GAAI,qBAAqB,mBAAmB,4CA4BvE,CAAA"}
|
package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import PreviewHeader from './preview-header.js';
|
|
3
|
+
import { STATUS_CONFIG_PDF } from '../utils.js';
|
|
4
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
5
|
+
import { Icon } from '../../../icon/index.js';
|
|
6
|
+
export const UnsupportedFile = ({ status, onClose }) => {
|
|
7
|
+
const config = STATUS_CONFIG_PDF.unsupported_format;
|
|
8
|
+
const icon = config.icon;
|
|
9
|
+
return (_jsxs("div", { className: "flex flex-col bg-white rounded-md shadow-[1px_4px_15px_0px_rgba(37, 44, 56, 0.25)] px-6 py-4 gap-4 border border-gray-200 h-[652px] w-[500px]", children: [_jsx(PreviewHeader, { status: status, onClose: onClose }), _jsxs("div", { className: cn('flex-1 min-h-0 flex flex-col items-center justify-center bg-gray-100 w-full overflow-auto rounded-md'), children: [icon && (_jsx("div", { className: "relative", children: _jsx(Icon, { name: icon, size: 256, className: "text-gray-300" }) })), _jsxs("div", { className: "flex flex-col items-center justify-center gap-4", children: [config.title && _jsx("h3", { className: "text-xl font-bold leading-6 text-gray-500", children: config.title }), _jsx("p", { className: "text-center text-sm text-gray-500 mx-auto max-w-[375px] whitespace-pre-line", children: config.message })] })] })] }));
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=place-holder-unsupported.js.map
|
package/dist/src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"place-holder-unsupported.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/place-holder-unsupported.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAO7C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAuB,EAAE,EAAE;IAC1E,MAAM,MAAM,GAAG,iBAAiB,CAAC,kBAAkB,CAAA;IACnD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;IAExB,OAAO,CACL,eAAK,SAAS,EAAC,gJAAgJ,aAC7J,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAI,EACnD,eACE,SAAS,EAAE,EAAE,CACX,sGAAsG,CACvG,aAEA,IAAI,IAAI,CACP,cAAK,SAAS,EAAC,UAAU,YACvB,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAC,eAAe,GAAG,GACrD,CACP,EAED,eAAK,SAAS,EAAC,iDAAiD,aAC7D,MAAM,CAAC,KAAK,IAAI,aAAI,SAAS,EAAC,2CAA2C,YAAE,MAAM,CAAC,KAAK,GAAM,EAE9F,YAAG,SAAS,EAAC,6EAA6E,YACvF,MAAM,CAAC,OAAO,GACb,IACA,IACF,IACF,CACP,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
2
|
+
interface FilePreviewStateProps {
|
|
3
|
+
onClose?: () => void;
|
|
4
|
+
preview?: string;
|
|
5
|
+
className?: string;
|
|
6
|
+
status: PreviewStatus;
|
|
7
|
+
}
|
|
8
|
+
declare const PreviewFilePreview: ({ status, onClose, preview, className }: FilePreviewStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default PreviewFilePreview;
|
|
10
|
+
//# sourceMappingURL=preview-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-file.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-file.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhE,UAAU,qBAAqB;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,aAAa,CAAA;CACtB;AAED,QAAA,MAAM,kBAAkB,GAAI,yCAAsD,qBAAqB,4CA2BtG,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
+
import { PREVIEW_STATUS } from '../types.js';
|
|
4
|
+
import { PlaceHolderPdf } from './place-holder-pdf.js';
|
|
5
|
+
import PreviewHeader from './preview-header.js';
|
|
6
|
+
const PreviewFilePreview = ({ status, onClose = () => null, preview, className }) => {
|
|
7
|
+
if (status === PREVIEW_STATUS.SUCCESS && preview) {
|
|
8
|
+
return (_jsxs("div", { className: cn('relative flex flex-col bg-white rounded-md shadow-[1px_4px_15px_0px_rgba(74,88,15,0.25)] px-6 py-4 gap-4 w-full h-full', className), children: [_jsx(PreviewHeader, { status: status, onClose: onClose, title: "PDF Preview" }), _jsx("div", { className: "flex-1 relative rounded-md overflow-hidden", children: _jsx("iframe", { src: `${preview}#toolbar=0&navpanes=0&scrollbar=0`, title: "Previsualizaci\u00F3n de PDF", className: "w-full h-full border-none", height: 652, width: 500, children: _jsx("p", { children: "Your browser does not support the preview." }) }) })] }));
|
|
9
|
+
}
|
|
10
|
+
return _jsx(PlaceHolderPdf, { status: status, onClose: onClose, className: cn('w-full h-full', className) });
|
|
11
|
+
};
|
|
12
|
+
export default PreviewFilePreview;
|
|
13
|
+
//# sourceMappingURL=preview-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-file.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-file.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AACtD,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAS/C,MAAM,kBAAkB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,GAAG,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,EAAyB,EAAE,EAAE;IACzG,IAAI,MAAM,KAAK,cAAc,CAAC,OAAO,IAAI,OAAO,EAAE,CAAC;QACjD,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,wHAAwH,EACxH,SAAS,CACV,aAED,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAC,aAAa,GAAG,EAEvE,cAAK,SAAS,EAAC,4CAA4C,YACzD,iBACE,GAAG,EAAE,GAAG,OAAO,mCAAmC,EAClD,KAAK,EAAC,8BAAyB,EAC/B,SAAS,EAAC,2BAA2B,EACrC,MAAM,EAAE,GAAG,EACX,KAAK,EAAE,GAAG,YAEV,qEAAiD,GAC1C,GACL,IACF,CACP,CAAA;IACH,CAAC;IAED,OAAO,KAAC,cAAc,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,GAAI,CAAA;AACxG,CAAC,CAAA;AAED,eAAe,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
2
|
+
interface PreviewHeaderProps {
|
|
3
|
+
status: PreviewStatus;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
}
|
|
7
|
+
declare const PreviewHeader: ({ status, onClose, title }: PreviewHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default PreviewHeader;
|
|
9
|
+
//# sourceMappingURL=preview-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-header.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-header.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhE,UAAU,kBAAkB;IAC1B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,QAAA,MAAM,aAAa,GAAI,4BAA6C,kBAAkB,4CAgBrF,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
+
import { Icon } from '../../../icon/index.js';
|
|
4
|
+
import { PREVIEW_STATUS } from '../types.js';
|
|
5
|
+
const PreviewHeader = ({ status, onClose, title = 'File Preview' }) => {
|
|
6
|
+
return (_jsxs("header", { className: "flex justify-between items-center", children: [_jsx("span", { className: cn('text-gray-900 text-sm font-normal leading-4.5', status === PREVIEW_STATUS.CORRUPTED_FILE && 'text-red-900'), children: title }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close preview", className: "text-gray-400 hover:text-gray-600", children: _jsx(Icon, { name: "XmarkLight", size: 16, className: "text-gray-900" }) })] }));
|
|
7
|
+
};
|
|
8
|
+
export default PreviewHeader;
|
|
9
|
+
//# sourceMappingURL=preview-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-header.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-header.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAQhE,MAAM,aAAa,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,GAAG,cAAc,EAAsB,EAAE,EAAE;IACxF,OAAO,CACL,kBAAQ,SAAS,EAAC,mCAAmC,aACnD,eACE,SAAS,EAAE,EAAE,CACX,+CAA+C,EAC/C,MAAM,KAAK,cAAc,CAAC,cAAc,IAAI,cAAc,CAC3D,YAEA,KAAK,GACD,EACP,iBAAQ,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAE,OAAO,gBAAa,eAAe,EAAC,SAAS,EAAC,mCAAmC,YAC9G,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,IAAI,EAAE,EAAE,EAAE,SAAS,EAAC,eAAe,GAAG,GACvD,IACF,CACV,CAAA;AACH,CAAC,CAAA;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
2
|
+
interface FilePreviewStateProps {
|
|
3
|
+
status: PreviewStatus;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
preview?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const PreviewImagePreview: ({ status, onClose, className, preview }: FilePreviewStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default PreviewImagePreview;
|
|
10
|
+
//# sourceMappingURL=preview-image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-image.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-image.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAA;AAIhE,UAAU,qBAAqB;IAC7B,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,QAAA,MAAM,mBAAmB,GAAI,yCAAyC,qBAAqB,4CAkB1F,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
+
import { PREVIEW_STATUS } from '../types.js';
|
|
4
|
+
import { PlaceHolderImage } from './place-holder-image.js';
|
|
5
|
+
import PreviewHeader from './preview-header.js';
|
|
6
|
+
const PreviewImagePreview = ({ status, onClose, className, preview }) => {
|
|
7
|
+
if (status === PREVIEW_STATUS.SUCCESS) {
|
|
8
|
+
return (_jsxs("div", { className: cn('flex flex-col bg-white rounded-md shadow-[1px_4px_15px_0px_rgba(74,88,115,0.25)] px-6 py-4 gap-4 w-full h-full', className), children: [_jsx(PreviewHeader, { status: status, onClose: onClose, title: "Image Preview" }), _jsx("div", { className: "flex justify-center items-center relative rounded-md overflow-hidden", children: preview && _jsx("img", { src: preview, alt: "Preview", className: "w-full h-full object-contain" }) })] }));
|
|
9
|
+
}
|
|
10
|
+
return _jsx(PlaceHolderImage, { status: status, onClose: onClose, className: className });
|
|
11
|
+
};
|
|
12
|
+
export default PreviewImagePreview;
|
|
13
|
+
//# sourceMappingURL=preview-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-image.js","sourceRoot":"","sources":["../../../../../../../src/ui/components/data-entry/file-input/sub-components/preview-image.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,qCAAqC,CAAA;AACxD,OAAO,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,aAAa,MAAM,qBAAqB,CAAA;AAS/C,MAAM,mBAAmB,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAyB,EAAE,EAAE;IAC7F,IAAI,MAAM,KAAK,cAAc,CAAC,OAAO,EAAE,CAAC;QACtC,OAAO,CACL,eACE,SAAS,EAAE,EAAE,CACX,gHAAgH,EAChH,SAAS,CACV,aAED,KAAC,aAAa,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAC,eAAe,GAAG,EACzE,cAAK,SAAS,EAAC,sEAAsE,YAClF,OAAO,IAAI,cAAK,GAAG,EAAE,OAAO,EAAE,GAAG,EAAC,SAAS,EAAC,SAAS,EAAC,8BAA8B,GAAG,GACpF,IACF,CACP,CAAA;IACH,CAAC;IAED,OAAO,KAAC,gBAAgB,IAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,GAAI,CAAA;AACrF,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { InputHTMLAttributes } from 'react';
|
|
2
2
|
import type { InputBaseProps } from '../../../../scalars/components/types.js';
|
|
3
|
+
import type { IconName } from '../../../../index.js';
|
|
3
4
|
export interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange'>, InputBaseProps<File> {
|
|
4
5
|
allowedFileTypes?: string[];
|
|
5
6
|
maxFileSize?: number;
|
|
@@ -14,6 +15,22 @@ export interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
14
15
|
errorsUpload?: string[];
|
|
15
16
|
status?: UploadFile;
|
|
16
17
|
showPreview?: boolean;
|
|
18
|
+
preview?: string;
|
|
17
19
|
}
|
|
18
20
|
export type UploadFile = 'idle' | 'uploading' | 'success' | 'error';
|
|
21
|
+
export declare const PREVIEW_STATUS: {
|
|
22
|
+
readonly LOADING: "loading";
|
|
23
|
+
readonly UNSUPPORTED_FORMAT: "unsupported_format";
|
|
24
|
+
readonly CORRUPTED_FILE: "corrupted_file";
|
|
25
|
+
readonly SUCCESS: "success";
|
|
26
|
+
};
|
|
27
|
+
type ValueOf<T> = T[keyof T];
|
|
28
|
+
export type PreviewStatus = ValueOf<typeof PREVIEW_STATUS>;
|
|
29
|
+
export interface StatusConfig {
|
|
30
|
+
icon: IconName | undefined;
|
|
31
|
+
title?: string;
|
|
32
|
+
message?: string;
|
|
33
|
+
}
|
|
34
|
+
export type PreviewType = 'pdf' | 'image' | 'audio' | 'unknown';
|
|
35
|
+
export {};
|
|
19
36
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAA;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,WAAW,cACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,CAAC,EACxF,cAAc,CAAC,IAAI,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAA;IAEtC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC3D,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC3D,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAA;AAEnE,eAAO,MAAM,cAAc;;;;;CAKjB,CAAA;AAEV,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;AAC5B,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,cAAc,CAAC,CAAA;AAE1D,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,OAAO,GAAG,OAAO,GAAG,SAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/types.ts"],"names":[],"mappings":"AA0BA,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,SAAS;IAClB,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,OAAO,EAAE,SAAS;CACV,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type PreviewStatus } from './types.js';
|
|
1
2
|
interface UseFileUploadProps {
|
|
2
3
|
value?: File | null;
|
|
3
4
|
defaultValue?: File | null;
|
|
@@ -7,6 +8,13 @@ export declare const useFileUpload: ({ value, defaultValue, onChange }: UseFileU
|
|
|
7
8
|
handleDrop: (acceptedFiles?: File[]) => void;
|
|
8
9
|
file: File | null;
|
|
9
10
|
borderIndicator: string;
|
|
11
|
+
preview: string | undefined;
|
|
12
|
+
handleCancelPreview: () => void;
|
|
13
|
+
handleOnPreview: () => Promise<void>;
|
|
14
|
+
isPreviewOpen: boolean;
|
|
15
|
+
previewStatus: PreviewStatus;
|
|
16
|
+
setPreviewStatus: import("react").Dispatch<import("react").SetStateAction<PreviewStatus>>;
|
|
17
|
+
typePreview: "audio" | "image" | "unknown" | "pdf";
|
|
10
18
|
};
|
|
11
19
|
export {};
|
|
12
20
|
//# sourceMappingURL=useUploadFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUploadFile.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/useUploadFile.ts"],"names":[],"mappings":"AACA,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAA;CACvC;
|
|
1
|
+
{"version":3,"file":"useUploadFile.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/useUploadFile.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,aAAa,EAAE,MAAM,YAAY,CAAA;AAG/D,UAAU,kBAAkB;IAC1B,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAA;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAA;CACvC;AASD,eAAO,MAAM,aAAa,GAAI,mCAAmC,kBAAkB;iCAO9D,IAAI,EAAE;;;;;;;;;;CAsE1B,CAAA"}
|
|
@@ -1,14 +1,75 @@
|
|
|
1
|
-
import { useCallback, useState } from 'react';
|
|
1
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
2
|
+
import { PREVIEW_STATUS } from './types.js';
|
|
3
|
+
import { detectPreviewType, validateImageHeader, validatePdfHeader } from './utils.js';
|
|
4
|
+
const mapValidator = {
|
|
5
|
+
['pdf']: validatePdfHeader,
|
|
6
|
+
['image']: validateImageHeader,
|
|
7
|
+
['audio']: async () => Promise.resolve(true),
|
|
8
|
+
['unknown']: async () => Promise.resolve(false),
|
|
9
|
+
};
|
|
2
10
|
export const useFileUpload = ({ value, defaultValue, onChange }) => {
|
|
3
11
|
const [file, setFile] = useState(value ?? defaultValue ?? null);
|
|
12
|
+
const [preview, setPreview] = useState(undefined);
|
|
13
|
+
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
14
|
+
const [previewStatus, setPreviewStatus] = useState(PREVIEW_STATUS.LOADING);
|
|
4
15
|
const handleDrop = useCallback((acceptedFiles) => {
|
|
5
16
|
if (!acceptedFiles || acceptedFiles.length === 0)
|
|
6
17
|
return;
|
|
7
18
|
const file = acceptedFiles[0];
|
|
19
|
+
const preview = URL.createObjectURL(file);
|
|
20
|
+
setPreview(preview);
|
|
8
21
|
setFile(file);
|
|
9
22
|
onChange?.(file);
|
|
10
23
|
}, [onChange]);
|
|
24
|
+
const handleCancelPreview = () => {
|
|
25
|
+
setIsPreviewOpen(false);
|
|
26
|
+
};
|
|
27
|
+
const typePreview = detectPreviewType(file?.type);
|
|
28
|
+
const handleOnPreview = async () => {
|
|
29
|
+
setIsPreviewOpen(true);
|
|
30
|
+
setPreviewStatus(PREVIEW_STATUS.LOADING);
|
|
31
|
+
if (!file || typePreview === 'unknown') {
|
|
32
|
+
setPreviewStatus(PREVIEW_STATUS.UNSUPPORTED_FORMAT);
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const validator = mapValidator[typePreview];
|
|
36
|
+
try {
|
|
37
|
+
const isValid = await validator(file);
|
|
38
|
+
if (!isValid) {
|
|
39
|
+
setPreviewStatus(PREVIEW_STATUS.CORRUPTED_FILE);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (!preview) {
|
|
43
|
+
setPreviewStatus(PREVIEW_STATUS.CORRUPTED_FILE);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
await new Promise((res) => setTimeout(res, 2000));
|
|
47
|
+
setPreviewStatus(PREVIEW_STATUS.SUCCESS);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
setPreviewStatus(PREVIEW_STATUS.CORRUPTED_FILE);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
return () => {
|
|
55
|
+
if (preview) {
|
|
56
|
+
URL.revokeObjectURL(preview);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}, [preview]);
|
|
11
60
|
const borderIndicator = file ? 'text-blue-900' : 'text-gray-300';
|
|
12
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
handleDrop,
|
|
63
|
+
file,
|
|
64
|
+
borderIndicator,
|
|
65
|
+
// Preview
|
|
66
|
+
preview,
|
|
67
|
+
handleCancelPreview,
|
|
68
|
+
handleOnPreview,
|
|
69
|
+
isPreviewOpen,
|
|
70
|
+
previewStatus,
|
|
71
|
+
setPreviewStatus,
|
|
72
|
+
typePreview,
|
|
73
|
+
};
|
|
13
74
|
};
|
|
14
75
|
//# sourceMappingURL=useUploadFile.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUploadFile.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/useUploadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useUploadFile.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/useUploadFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxD,OAAO,EAAE,cAAc,EAAsB,MAAM,YAAY,CAAA;AAC/D,OAAO,EAAE,iBAAiB,EAA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O,CAAC,CAAC,CAAA;IAEb,MAAM,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,eAAe,CAAA;IAEhE,OAAO;QACL,UAAU;QACV,IAAI;QACJ,eAAe;QACf,UAAU;QACV,OAAO;QACP,mBAAmB;QACnB,eAAe;QACf,aAAa;QACb,aAAa;QACb,gBAAgB;QAChB,WAAW;KACZ,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { IconName } from '../../icon-components/index.js';
|
|
2
|
+
import { type PreviewStatus, type StatusConfig } from './types.js';
|
|
2
3
|
export declare const MESSAGES: {
|
|
3
4
|
success: string;
|
|
4
5
|
error: string;
|
|
@@ -7,4 +8,9 @@ export declare const MESSAGES: {
|
|
|
7
8
|
export declare const formatBytes: (bytes?: number, decimals?: number, binaryUnits?: boolean) => string;
|
|
8
9
|
export declare function getExtensionsFromMimeTypes(mimeTypes?: string[]): string[];
|
|
9
10
|
export declare const getIconKey: (mimeType: string) => IconName;
|
|
11
|
+
export declare const STATUS_CONFIG_PDF: Record<PreviewStatus, StatusConfig>;
|
|
12
|
+
export declare const STATUS_CONFIG_IMAGE: Record<PreviewStatus, StatusConfig>;
|
|
13
|
+
export declare const detectPreviewType: (mimeType?: string) => "pdf" | "image" | "audio" | "unknown";
|
|
14
|
+
export declare const validatePdfHeader: (file: File) => Promise<boolean>;
|
|
15
|
+
export declare const validateImageHeader: (file: File) => Promise<unknown>;
|
|
10
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC9D,eAAO,MAAM,QAAQ;;;;CAIpB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,EAAE,iBAA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