@powerhousedao/document-engineering 1.29.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/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 +2 -2
- 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/examples/table-editing/table-editing.d.ts.map +1 -1
- package/dist/src/table/examples/table-editing/table-editing.js +7 -6
- 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 +26 -9
- 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 +1 -0
- package/dist/src/table/table/object-set-table.js.map +1 -1
- package/dist/src/table/table/types.d.ts +11 -2
- package/dist/src/table/table/types.d.ts.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 +14 -8
- package/dist/src/ui/components/data-entry/file-input/file-input.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/file-upload-item.d.ts +11 -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 -11
- 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/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 +4 -4
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.js +7 -11
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-file.js.map +1 -1
- 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 +5 -6
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.js +7 -11
- package/dist/src/ui/components/data-entry/file-input/sub-components/preview-image.js.map +1 -1
- package/dist/src/ui/components/data-entry/file-input/types.d.ts +6 -4
- 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 +1 -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 +7 -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 +60 -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 +5 -1
- 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 +77 -4
- 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 +6 -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 +2 -1
- 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 +8 -2
- 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 +68 -14
- 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/textarea/textarea.d.ts.map +1 -1
- package/dist/src/ui/components/data-entry/textarea/textarea.js +8 -4
- package/dist/src/ui/components/data-entry/textarea/textarea.js.map +1 -1
- package/dist/style.css +32 -2
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -26,9 +26,14 @@ const CountryCodePicker = React.forwardRef(({ label, required, value, defaultVal
|
|
|
26
26
|
: undefined,
|
|
27
27
|
}))
|
|
28
28
|
.sort((a, b) => (a.label > b.label ? 1 : a.label < b.label ? -1 : 0));
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const allowedCountriesArray = Array.isArray(allowedCountries) ? allowedCountries : undefined;
|
|
30
|
+
const excludedCountriesArray = Array.isArray(excludedCountries) ? excludedCountries : undefined;
|
|
31
|
+
const options = allowedCountriesArray || excludedCountriesArray
|
|
32
|
+
? defaultOptions.filter((option) => {
|
|
33
|
+
const isAllowedCountry = allowedCountriesArray ? allowedCountriesArray.includes(option.value) : true;
|
|
34
|
+
const isExcludedCountry = excludedCountriesArray ? !excludedCountriesArray.includes(option.value) : true;
|
|
35
|
+
return isAllowedCountry && isExcludedCountry;
|
|
36
|
+
})
|
|
32
37
|
: defaultOptions;
|
|
33
38
|
const selectedOption = options.find((option) => option.value === internalValue);
|
|
34
39
|
const baseOption = options.find((option) => option.value === baseValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country-code-picker.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/country-code-picker/country-code-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,SAA6B,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrD,MAAM,iBAAiB,GAAG,CAAC,aAAsB,EAAE,WAAmB,EAAE,EAAE;IACxE,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW;QAAE,OAAO,SAAS,CAAA;IACpD,OAAO,KAAC,UAAU,IAAC,SAAS,EAAC,QAAQ,EAAC,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,EAAE,MAA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CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAEvE,MAAM,
|
|
1
|
+
{"version":3,"file":"country-code-picker.js","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/country-code-picker/country-code-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,SAA6B,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGrD,MAAM,iBAAiB,GAAG,CAAC,aAAsB,EAAE,WAAmB,EAAE,EAAE;IACxE,IAAI,CAAC,aAAa,IAAI,CAAC,WAAW;QAAE,OAAO,SAAS,CAAA;IACpD,OAAO,KAAC,UAAU,IAAC,SAAS,EAAC,QAAQ,EAAC,WAAW,EAAE,WAAW,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE,GAAI,CAAA;AAC9F,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,KAAK,CAAC,UAAU,CACxC,CACE,EACE,KAAK,EACL,QAAQ,EACR,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GAAG,KAAK,EAC7B,YAAY,GAAG,WAAW,EAC1B,aAAa,GAAG,IAAI,EACpB,YAAY,EACZ,QAAQ,GAAG,SAAS,EACpB,SA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E,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-input.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/file-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"file-input.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/data-entry/file-input/file-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAgB,MAAM,OAAO,CAAA;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAchD,QAAA,MAAM,SAAS,yFA2Ld,CAAA;AAID,OAAO,EAAE,SAAS,EAAE,CAAA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useId } from 'react';
|
|
3
3
|
import { cn } from '../../../../scalars/lib/utils.js';
|
|
4
|
-
import { Icon } from '../../icon/icon.js';
|
|
5
4
|
import FileBackground from '../../icon-components/FileBackground.js';
|
|
6
|
-
import { Input } from '../../../../ui/components/data-entry/input/index.js';
|
|
7
|
-
import { FormLabel } from '../../../../scalars/components/fragments/form-label/form-label.js';
|
|
8
|
-
import { FormMessageList } from '../../../../scalars/components/fragments/form-message/index.js';
|
|
9
5
|
import { useDropzone } from 'react-dropzone';
|
|
10
6
|
import { formatBytes, getExtensionsFromMimeTypes } from './utils.js';
|
|
11
7
|
import { Button } from '../../../../scalars/components/fragments/button/button.js';
|
|
12
8
|
import { useFileUpload } from './useUploadFile.js';
|
|
13
9
|
import { FileUploadItem } from './sub-components/file-upload-item.js';
|
|
10
|
+
import { Icon } from '../../icon/index.js';
|
|
11
|
+
import { Input } from '../../../../ui/components/data-entry/input/index.js';
|
|
12
|
+
import { FormLabel } from '../../../../scalars/components/fragments/form-label/form-label.js';
|
|
13
|
+
import { FormMessageList } from '../../../../scalars/components/fragments/form-message/index.js';
|
|
14
14
|
const FileInput = React.forwardRef(({ name, label, description, required, disabled = false, errors = [], warnings = [], id: propId, maxFileSize, allowedFileTypes, value, defaultValue, dragAndDropEnabled = true, onChange,
|
|
15
15
|
// Item Props
|
|
16
16
|
fileName, fileSize, mimeType, progress, onCancel, onReload, showPreview = false, errorsUpload, status = 'idle', ...props }, ref) => {
|
|
@@ -19,13 +19,17 @@ fileName, fileSize, mimeType, progress, onCancel, onReload, showPreview = false,
|
|
|
19
19
|
const hasError = Array.isArray(errors) && errors.length > 0;
|
|
20
20
|
const hasWarning = Array.isArray(warnings) && warnings.length > 0;
|
|
21
21
|
const allowedFileTypesString = Array.isArray(allowedFileTypes) ? allowedFileTypes : [];
|
|
22
|
-
const { handleDrop, borderIndicator, preview
|
|
22
|
+
const { handleDrop, borderIndicator, preview, handleCancelPreview, handleOnPreview, isPreviewOpen, previewStatus, typePreview, } = useFileUpload({
|
|
23
|
+
value,
|
|
24
|
+
defaultValue,
|
|
25
|
+
onChange,
|
|
26
|
+
});
|
|
23
27
|
const { getInputProps, getRootProps, open, inputRef } = useDropzone({
|
|
24
28
|
onDropAccepted: (acceptedFiles) => {
|
|
25
29
|
handleDrop(acceptedFiles);
|
|
26
30
|
},
|
|
27
|
-
noClick:
|
|
28
|
-
noKeyboard:
|
|
31
|
+
noClick: status !== 'idle',
|
|
32
|
+
noKeyboard: status !== 'idle',
|
|
29
33
|
});
|
|
30
34
|
return (_jsxs("div", { className: "flex flex-col", children: [!!label && (_jsx(FormLabel, { htmlFor: id, id: `${id}-label`, disabled: disabled, hasError: hasError, required: required, className: cn(disabled && 'pointer-events-none'), children: label })), _jsx("div", { className: "flex flex-col w-full h-full pt-3.5 min-h-[148px]", children: _jsxs("div", { className: "relative h-[148px]", children: [_jsx("div", { className: cn('absolute z-0 h-full w-full', borderIndicator), "data-state": value ? 'selected' : 'idle', "data-testid": "file-input-border", children: _jsx(FileBackground, { className: "w-full h-full opacity-50" }) }), _jsxs("div", { ...getRootProps({
|
|
31
35
|
role: 'group',
|
|
@@ -33,7 +37,9 @@ fileName, fileSize, mimeType, progress, onCancel, onReload, showPreview = false,
|
|
|
33
37
|
// padding
|
|
34
38
|
'px-3 py-4'),
|
|
35
39
|
tabIndex: disabled ? -1 : 0,
|
|
36
|
-
}), "data-testid": "file-drop-area", children: [status === 'idle' && (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx(Icon, { name: "FileUpload", size: 40, className: "text-gray-500", "aria-hidden": "true" }), _jsx("p", { className: "text-gray-500 font-normal text-sm leading-5", children: description })] })), status !== 'idle' && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center p-4", children: _jsx("div", { className: "w-full max-w-full", children: _jsx(FileUploadItem, { errorsUpload: errorsUpload, mimeType: mimeType, fileName: fileName, fileSize: formatBytes(fileSize ?? 0, 2), progress: progress, status: status, onCancel: onCancel, onReload: onReload,
|
|
40
|
+
}), "data-testid": "file-drop-area", children: [status === 'idle' && (_jsxs("div", { className: "flex flex-col items-center justify-center gap-2", children: [_jsx(Icon, { name: "FileUpload", size: 40, className: "text-gray-500", "aria-hidden": "true" }), _jsx("p", { className: "text-gray-500 font-normal text-sm leading-5", children: description })] })), status !== 'idle' && (_jsx("div", { className: "absolute inset-0 flex items-center justify-center p-4", children: _jsx("div", { className: "w-full max-w-full", children: _jsx(FileUploadItem, { errorsUpload: errorsUpload, mimeType: mimeType, fileName: fileName, fileSize: formatBytes(fileSize ?? 0, 2), progress: progress, status: status, onCancel: onCancel, onReload: onReload,
|
|
41
|
+
// Preview Props
|
|
42
|
+
preview: preview, showPreview: showPreview, handleOnCancelPreview: handleCancelPreview, isPreviewOpen: isPreviewOpen, handleOnPreview: () => void handleOnPreview(), previewStatus: previewStatus, typePreview: typePreview }) }) })), _jsx("input", { ref: ref, type: "hidden", name: name }), _jsx(Input, { ...getInputProps({
|
|
37
43
|
id,
|
|
38
44
|
required,
|
|
39
45
|
disabled,
|
|
@@ -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,oBAAoB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,KAAK,EAAE,MAAM,qDAAqD,CAAA;AAC3E,OAAO,EAAE,SAAS,EAAE,MAAM,mEAAmE,CAAA;AAC7F,OAAO,EAAE,eAAe,EAAE,MAAM,gEAAgE,CAAA;AAEhG,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAChC,CACE,EACE,IAAI,EACJ,KAAK,EACL,WAAW,EACX,QAAQ,EACR,QAAQ,GAAG,KAAK,EAChB,MAAM,GAAG,EAAE,EACX,QAAQ,GAAG,EAAE,EACb,EAAE,EAAE,MAAM,EACV,WAAW,EACX,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,kBAAkB,GAAG,IAAI,EACz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E,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,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;
|
|
@@ -11,7 +11,15 @@ interface FileUploadItemProps {
|
|
|
11
11
|
status?: UploadFile;
|
|
12
12
|
showPreview?: boolean;
|
|
13
13
|
preview?: string;
|
|
14
|
+
isPreviewOpen?: boolean;
|
|
15
|
+
handleOnPreview?: () => void;
|
|
16
|
+
handleOnCancelPreview?: () => void;
|
|
17
|
+
previewStatus: PreviewStatus;
|
|
18
|
+
typePreview: PreviewType;
|
|
14
19
|
}
|
|
15
|
-
|
|
16
|
-
|
|
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 };
|
|
17
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":"
|
|
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,13 +1,17 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
3
2
|
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
4
|
-
import { ProgressBar } from '../../../../../scalars/components/fragments/progress-bar/
|
|
5
|
-
import { Icon } from '../../../icon/
|
|
3
|
+
import { ProgressBar } from '../../../../../scalars/components/fragments/progress-bar/index.js';
|
|
4
|
+
import { Icon } from '../../../icon/index.js';
|
|
6
5
|
import { FormMessageList } from '../../../../../scalars/components/fragments/form-message/message-list.js';
|
|
7
6
|
import { getIconKey, MESSAGES } from '../utils.js';
|
|
8
|
-
import { AlertDialog, AlertDialogContent } from '../../../confirm/alert-dialog.js';
|
|
9
|
-
|
|
10
|
-
|
|
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, }) => {
|
|
11
15
|
const showProgress = status === 'uploading' && progress !== undefined && progress >= 0 && progress < 100;
|
|
12
16
|
const showSuccess = status === 'success';
|
|
13
17
|
const showError = status === 'error';
|
|
@@ -20,10 +24,11 @@ export const FileUploadItem = ({ fileName = '', fileSize = '', progress = undefi
|
|
|
20
24
|
e.stopPropagation();
|
|
21
25
|
onReload?.(e);
|
|
22
26
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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", 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("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 && (_jsx(AlertDialog, { open: isPreviewOpen, children: _jsx(AlertDialogContent, { children: _jsx("div", { className: "flex flex-col gap-2 w-[500px] h-[600px] mt-2", children: _jsx("img", { src: preview, alt: "preview", className: "w-full h-full" }) }) }) })), 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" })] }));
|
|
28
31
|
};
|
|
32
|
+
FileUploadItem.displayName = 'FileUploadItem';
|
|
33
|
+
export { FileUploadItem };
|
|
29
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,
|
|
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,EA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AO,EAAE,OAAO,GAChB,CACH,EACA,WAAW,KAAK,SAAS,IAAI,KAAC,eAAe,IAAC,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,qBAAqB,GAAI,EACvG,WAAW,KAAK,OAAO,IAAI,sCAAoB,IAC7B,IACT,CACf,EAEA,gBAAgB,IAAI,KAAC,eAAe,IAAC,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAC,OAAO,EAAC,SAAS,EAAC,SAAS,GAAG,IAC7F,CACP,CAAA;AACH,CAAC,CAAA;AAED,cAAc,CAAC,WAAW,GAAG,gBAAgB,CAAA;AAE7C,OAAO,EAAE,cAAc,EAAE,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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AAK,SAAS,EAAC,kBAAkB,YAC/B,YAAG,SAAS,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,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ry/file-input/sub-components/place-holder-unsupported.d.ts
ADDED
|
@@ -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"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { type PreviewStatus } from '../types.js';
|
|
2
2
|
interface FilePreviewStateProps {
|
|
3
|
+
onClose?: () => void;
|
|
4
|
+
preview?: string;
|
|
5
|
+
className?: string;
|
|
3
6
|
status: PreviewStatus;
|
|
4
|
-
onClose: () => void;
|
|
5
|
-
title?: string;
|
|
6
|
-
message?: string;
|
|
7
7
|
}
|
|
8
|
-
declare const PreviewFilePreview: ({ status, onClose,
|
|
8
|
+
declare const PreviewFilePreview: ({ status, onClose, preview, className }: FilePreviewStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export default PreviewFilePreview;
|
|
10
10
|
//# sourceMappingURL=preview-file.d.ts.map
|
|
@@ -1 +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":"
|
|
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"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
-
import { Icon } from '../../../icon/index.js';
|
|
4
3
|
import { PREVIEW_STATUS } from '../types.js';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const PreviewFilePreview = ({ status, onClose
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const message = overrideMessage ?? config.message;
|
|
13
|
-
const icon = config.icon;
|
|
14
|
-
return (_jsxs("div", { className: "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 min-h-0", children: [_jsxs("header", { className: "flex justify-between items-center", children: [_jsx("span", { className: cn('text-gray-900 text-sm font-normal leading-4.5', isCorrupted && 'text-red-900'), children: "Preview" }), _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" }) })] }), _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', isLoading && 'gap-8', !isLoading && 'gap-4'), children: [_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: [title && _jsx("h3", { className: "text-xl font-bold leading-6 text-gray-500", children: title }), isLoading && _jsx(LoadingBar, { progress: 50, className: "w-[375px]" }), !isCorrupted && message && (_jsx("p", { className: "text-center text-sm text-gray-500 mx-auto max-w-[375px] whitespace-pre-line", children: message }))] })] }), isCorrupted && (_jsx("div", { className: " border-gray-200", children: _jsx("p", { className: "text-xs text-red-900 font-normal leading-4.5", children: message }) }))] }));
|
|
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) });
|
|
15
11
|
};
|
|
16
12
|
export default PreviewFilePreview;
|
|
17
13
|
//# sourceMappingURL=preview-file.js.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type ImagePreviewStatus = Exclude<PreviewStatus, typeof PREVIEW_STATUS.GENERIC_ERROR>;
|
|
1
|
+
import { type PreviewStatus } from '../types.js';
|
|
3
2
|
interface FilePreviewStateProps {
|
|
4
|
-
status:
|
|
3
|
+
status: PreviewStatus;
|
|
5
4
|
onClose: () => void;
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
className?: string;
|
|
6
|
+
preview?: string;
|
|
8
7
|
}
|
|
9
|
-
declare const PreviewImagePreview: ({ status, onClose,
|
|
8
|
+
declare const PreviewImagePreview: ({ status, onClose, className, preview }: FilePreviewStateProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
9
|
export default PreviewImagePreview;
|
|
11
10
|
//# sourceMappingURL=preview-image.d.ts.map
|
|
@@ -1 +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":"
|
|
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"}
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../../../../scalars/lib/utils.js';
|
|
3
|
-
import { Icon } from '../../../icon/index.js';
|
|
4
3
|
import { PREVIEW_STATUS } from '../types.js';
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
const PreviewImagePreview = ({ status, onClose,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const message = overrideMessage ?? config.message;
|
|
13
|
-
const icon = config.icon;
|
|
14
|
-
return (_jsxs("div", { className: "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 min-h-0", children: [_jsxs("header", { className: "flex justify-between items-center", children: [_jsx("span", { className: cn('text-gray-900 text-sm font-normal leading-4.5', isCorrupted && 'text-red-900'), children: "Image Preview" }), _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" }) })] }), _jsxs("div", { className: "flex-1 min-h-0 flex flex-col items-center justify-center bg-gray-100 w-full overflow-auto rounded-md", children: [_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: [title && _jsx("h3", { className: "text-xl font-bold leading-6 text-gray-500", children: title }), isLoading && _jsx(LoadingBar, { progress: 50, className: "w-[272px]" }), !isCorrupted && message && (_jsx("p", { className: "text-center text-sm text-gray-500 mx-auto max-w-[296px] whitespace-pre-line", children: message }))] })] }), isCorrupted && (_jsx("div", { className: " border-gray-200", children: _jsx("p", { className: "text-xs text-red-900 font-normal leading-4.5", children: message }) }))] }));
|
|
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 });
|
|
15
11
|
};
|
|
16
12
|
export default PreviewImagePreview;
|
|
17
13
|
//# sourceMappingURL=preview-image.js.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -15,20 +15,22 @@ export interface FileInputProps extends Omit<InputHTMLAttributes<HTMLInputElemen
|
|
|
15
15
|
errorsUpload?: string[];
|
|
16
16
|
status?: UploadFile;
|
|
17
17
|
showPreview?: boolean;
|
|
18
|
+
preview?: string;
|
|
18
19
|
}
|
|
19
20
|
export type UploadFile = 'idle' | 'uploading' | 'success' | 'error';
|
|
20
21
|
export declare const PREVIEW_STATUS: {
|
|
21
22
|
readonly LOADING: "loading";
|
|
22
23
|
readonly UNSUPPORTED_FORMAT: "unsupported_format";
|
|
23
|
-
readonly GENERIC_ERROR: "generic_error";
|
|
24
24
|
readonly CORRUPTED_FILE: "corrupted_file";
|
|
25
|
+
readonly SUCCESS: "success";
|
|
25
26
|
};
|
|
26
27
|
type ValueOf<T> = T[keyof T];
|
|
27
28
|
export type PreviewStatus = ValueOf<typeof PREVIEW_STATUS>;
|
|
28
29
|
export interface StatusConfig {
|
|
29
|
-
icon: IconName;
|
|
30
|
-
title
|
|
31
|
-
message
|
|
30
|
+
icon: IconName | undefined;
|
|
31
|
+
title?: string;
|
|
32
|
+
message?: string;
|
|
32
33
|
}
|
|
34
|
+
export type PreviewType = 'pdf' | 'image' | 'audio' | 'unknown';
|
|
33
35
|
export {};
|
|
34
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;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,EA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M,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"}
|