@nxgt/material 2.4.2 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -21
- package/dist/{_Uint8Array-DEXn42kj.js → _Uint8Array-CDlDeQmw.js} +1 -1
- package/dist/_overRest-CWIWQwDJ.js +81 -0
- package/dist/{abnfDiagram-O67JEVCF-C7NxOWqd.js → abnfDiagram-O67JEVCF-Cl4ukf6a.js} +4 -4
- package/dist/{architectureDiagram-NJMV4G6O-BIvwyzEh.js → architectureDiagram-NJMV4G6O-WmFlBQF5.js} +7 -7
- package/dist/{client-only.utils-DhcBUmau.js → async-slice-Qoen0Mqm.js} +164 -93
- package/dist/{blockDiagram-BEXU5L5S-CzgMFdtn.js → blockDiagram-BEXU5L5S-_6EVgQ2-.js} +11 -11
- package/dist/{c4Diagram-YGBWAQC7-WgqlRIL5.js → c4Diagram-YGBWAQC7-D9xSt2QO.js} +8 -8
- package/dist/{channel-Ba8pEAWx.js → channel-Dg92Hoym.js} +1 -1
- package/dist/{chunk-3FUC2YCW-DnIzetwB.js → chunk-3FUC2YCW-CRQHl-Jx.js} +8 -8
- package/dist/{chunk-5DYCD2WN-Bqi3iL5i.js → chunk-5DYCD2WN-Cja1INgd.js} +3 -3
- package/dist/{chunk-6AEJRKK7-DDXoGWDs.js → chunk-6AEJRKK7-3YWRP4aV.js} +2 -2
- package/dist/{chunk-742MDFTN-nG_ROTnT.js → chunk-742MDFTN-Cs1qGiTK.js} +2 -2
- package/dist/{chunk-7INBJB4K-Dg64CbhT.js → chunk-7INBJB4K-BY5n77ka.js} +6 -6
- package/dist/{chunk-7M6MHVWA-CPdb6LVf.js → chunk-7M6MHVWA-DqXpf6CM.js} +9 -9
- package/dist/{chunk-7PRAP22T-DIiYRAce.js → chunk-7PRAP22T-_Av9vcXz.js} +1 -1
- package/dist/{chunk-GNY47TPC-CxWZwDbp.js → chunk-GNY47TPC-BgMsLbCS.js} +11 -11
- package/dist/{chunk-GTNCS2PH-CzDYTYNy.js → chunk-GTNCS2PH-BZ9WMD1v.js} +3 -3
- package/dist/{chunk-GWA4HPMP-CmsxMX3A.js → chunk-GWA4HPMP-Co-A6dtV.js} +3 -3
- package/dist/{chunk-MBY4JIJT-IA2XBafa.js → chunk-MBY4JIJT-C3RQP_Nk.js} +4 -4
- package/dist/{chunk-NETBCI7D-Cq92-0cA.js → chunk-NETBCI7D-CsyH43bj.js} +1 -1
- package/dist/{chunk-O7XYJQB3-C87zK8E5.js → chunk-O7XYJQB3-A66QSOPA.js} +1 -1
- package/dist/{chunk-UA2S7LBM-B0LGFGu3.js → chunk-UA2S7LBM-BNeHeMx9.js} +6 -6
- package/dist/{chunk-WEXAMYUT-C-QP0DFq.js → chunk-WEXAMYUT-CucJfehv.js} +2 -2
- package/dist/{chunk-XXDRQBXY-Bq4sFnO2.js → chunk-XXDRQBXY-FgXU14Bh.js} +1 -1
- package/dist/{chunk-Z7XXMR3K-vh8Pvgr_.js → chunk-Z7XXMR3K-CoCjTVVx.js} +8 -8
- package/dist/{chunk-ZIGJFQKS-HDJ6e6OJ.js → chunk-ZIGJFQKS-C3xUAXJq.js} +3 -3
- package/dist/{classDiagram-v2-NBCMYWYE-BSyQx7Df.js → classDiagram-v2-NBCMYWYE-j4vk04t-.js} +14 -14
- package/dist/{components-C3jpOwPw.js → components-C3wIUrWw.js} +26931 -25668
- package/dist/components.js +6 -6
- package/dist/{cose-bilkent-JH36ORCC-11-T1rfk.js → cose-bilkent-JH36ORCC-DRUT3qBb.js} +2 -2
- package/dist/{cynefinDiagram-VND7K2PF-1kHi2rGa.js → cynefinDiagram-VND7K2PF-B9HrdQW8.js} +4 -4
- package/dist/{dagre-6A5THRUB-BDk37t1_.js → dagre-6A5THRUB-DXq_YBNL.js} +572 -613
- package/dist/{diagram-22UHCM2B-BvH24G-C.js → diagram-22UHCM2B-He8NDldw.js} +15 -15
- package/dist/{diagram-3UASUU5V-DAKVPT0Q.js → diagram-3UASUU5V-CeILva4U.js} +7 -7
- package/dist/{diagram-ATOU4E4O-Clju_0RY.js → diagram-ATOU4E4O-CNY-8kl0.js} +3 -3
- package/dist/{diagram-CDSNMT55-w7kkJ6MU.js → diagram-CDSNMT55-C8Mk1smi.js} +5 -5
- package/dist/{diagram-MLGK6HIB-mUOtRVmm.js → diagram-MLGK6HIB-CpfeILwW.js} +4 -4
- package/dist/{diagram-MPIPVDR6-DEUw58dq.js → diagram-MPIPVDR6-Do7bUnTd.js} +4 -4
- package/dist/{dist-gYpAi-su.js → dist-C3YK_ean.js} +1 -1
- package/dist/{dist-CeHNxLJG.js → dist-CRbPtqwD.js} +1 -1
- package/dist/dnd.js +1 -1
- package/dist/{ebnfDiagram-ZINNZB2B-BYfatie5.js → ebnfDiagram-ZINNZB2B-1GewX9Zq.js} +4 -4
- package/dist/{elk-276RUBZZ-CtsHzWCy.js → elk-276RUBZZ-DFn4kTey.js} +13 -13
- package/dist/{erDiagram-OPXOYQCR-DTrqayuU.js → erDiagram-OPXOYQCR-BzVUcUwh.js} +14 -14
- package/dist/{field-blur-EUOqpHbF.js → field-blur-BlrE9fOD.js} +1109 -1083
- package/dist/flowDiagram-KWPJA3E3-B4pJCj2Q.js +17 -0
- package/dist/{ganttDiagram-FUAMR5RP-DxWSt8R4.js → ganttDiagram-FUAMR5RP-B4A4UFFi.js} +6 -6
- package/dist/{gitGraphDiagram-X574FWY7-DcGaPSwy.js → gitGraphDiagram-X574FWY7-80yOq8dE.js} +3 -3
- package/dist/{graphlib-BOTXrGOf.js → graphlib-CQ3hLS1N.js} +103 -139
- package/dist/hooks.js +2 -2
- package/dist/{i18n-provider-XTTU9ArK.js → i18n-provider-CbYD2KxP.js} +1 -1
- package/dist/i18n.js +6 -6
- package/dist/{icon-button-Dl9PDYCE.js → icon-button-BxySFfrr.js} +581 -581
- package/dist/{infoDiagram-VRGFBTTK-Cvj167dl.js → infoDiagram-VRGFBTTK-Cboh-B9n.js} +3 -3
- package/dist/isArrayLikeObject-5rnYwEK7.js +28 -0
- package/dist/isEmpty-DChvniYe.js +53 -0
- package/dist/{ishikawaDiagram-OU5B5YK6-ChBwjCfr.js → ishikawaDiagram-OU5B5YK6-DwTd1YxL.js} +4 -4
- package/dist/{journeyDiagram-ZHPQQLJL-BycdRLE6.js → journeyDiagram-ZHPQQLJL-C91SPPkY.js} +4 -4
- package/dist/{kanban-definition-PNTS6WVX-BRoa-Yp5.js → kanban-definition-PNTS6WVX-S8plI4wn.js} +10 -10
- package/dist/lib/components/ui/actions/button/button.compound-variants.d.ts +114 -0
- package/dist/lib/components/ui/actions/button/button.d.ts +4 -7
- package/dist/lib/components/ui/actions/button/button.variants.d.ts +7 -0
- package/dist/lib/components/ui/actions/button/has-text-content.d.ts +10 -0
- package/dist/lib/components/ui/actions/icon-button/icon-button.variants.d.ts +1 -1
- package/dist/lib/components/ui/collections/data-table/data-table-context.d.ts +4 -0
- package/dist/lib/components/ui/collections/data-table/data-table-pagination.d.ts +3 -1
- package/dist/lib/components/ui/collections/data-table/data-table.d.ts +12 -2
- package/dist/lib/components/ui/collections/data-table/hooks.d.ts +13 -13
- package/dist/lib/components/ui/collections/data-table/partials/data-table-body.d.ts +9 -5
- package/dist/lib/components/ui/collections/data-table/partials/data-table-empty-row.d.ts +14 -0
- package/dist/lib/components/ui/collections/data-table/partials/data-table-skeleton-rows.d.ts +7 -0
- package/dist/lib/components/ui/collections/filter/filter-field-number-range.d.ts +15 -0
- package/dist/lib/components/ui/collections/pagination/index.d.ts +1 -1
- package/dist/lib/components/ui/collections/pagination/pagination.d.ts +9 -1
- package/dist/lib/components/ui/collections/tree/use-tree.d.ts +2 -0
- package/dist/lib/components/ui/dates/date-range-field/date-range-field-trigger.d.ts +1 -1
- package/dist/lib/components/ui/dates/date-range-field/date-range-field.d.ts +10 -1
- package/dist/lib/components/ui/dates/date-range-field/date-range-field.utils.d.ts +13 -0
- package/dist/lib/components/ui/dates/date-range-field/index.d.ts +1 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-field-content.d.ts +25 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-presets.d.ts +11 -0
- package/dist/lib/components/ui/dates/date-range-field/partials/date-range-times.d.ts +11 -0
- package/dist/lib/components/ui/dates/date-range-field/use-date-range-presets.d.ts +22 -0
- package/dist/lib/components/ui/dates/time-picker/time-picker-utils.d.ts +7 -0
- package/dist/lib/components/ui/display/chip/chip.d.ts +1 -1
- package/dist/lib/components/ui/feedback/toast/toast.d.ts +9 -4
- package/dist/lib/components/ui/fields/number-field/number-field.d.ts +3 -1
- package/dist/lib/components/ui/fields/otp-field/index.d.ts +1 -0
- package/dist/lib/components/ui/fields/otp-field/input-otp.d.ts +1 -1
- package/dist/lib/components/ui/fields/slider/slider-header.d.ts +19 -0
- package/dist/lib/components/ui/fields/slider/slider-readout.d.ts +5 -1
- package/dist/lib/components/ui/fields/slider/slider.d.ts +7 -0
- package/dist/lib/components/ui/fields/switch/switch.d.ts +7 -0
- package/dist/lib/components/ui/layout/stepper/stepper-step.d.ts +17 -0
- package/dist/lib/components/ui/media/camera/camera-content.d.ts +1 -2
- package/dist/lib/components/ui/media/camera/camera-context.d.ts +4 -0
- package/dist/lib/components/ui/media/camera/camera-provider.d.ts +2 -0
- package/dist/lib/components/ui/media/camera/camera.d.ts +6 -3
- package/dist/lib/components/ui/media/camera/capture-photo.d.ts +13 -0
- package/dist/lib/components/ui/media/camera/index.d.ts +9 -1
- package/dist/lib/components/ui/media/camera/state/camera.reducers.d.ts +1 -1
- package/dist/lib/components/ui/media/camera/state/camera.slice.d.ts +4 -9
- package/dist/lib/components/ui/media/camera/state/camera.store.d.ts +11 -5
- package/dist/lib/components/ui/media/camera/state/camera.thunks.d.ts +4 -4
- package/dist/lib/components/ui/media/camera/types.d.ts +19 -9
- package/dist/lib/components/ui/media/camera/use-camera.d.ts +5 -11
- package/dist/lib/components/ui/media/camera/utils/camera.utils.d.ts +0 -1
- package/dist/lib/components/ui/media/file-preview/file-preview-pdf.lazy.d.ts +9 -0
- package/dist/lib/components/ui/media/file-preview/file-preview.d.ts +12 -0
- package/dist/lib/components/ui/media/file-preview/index.d.ts +3 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-body.d.ts +9 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-card.d.ts +20 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-media.d.ts +11 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-pdf.d.ts +10 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-status.d.ts +17 -0
- package/dist/lib/components/ui/media/file-preview/partials/file-preview-text.d.ts +13 -0
- package/dist/lib/components/ui/media/file-preview/types.d.ts +23 -0
- package/dist/lib/components/ui/media/file-preview/use-file-preview.d.ts +22 -0
- package/dist/lib/components/ui/media/file-preview/use-text-preview.d.ts +15 -0
- package/dist/lib/components/ui/media/index.d.ts +2 -0
- package/dist/lib/components/ui/media/upload/network-upload-field/use-image-preview.d.ts +6 -0
- package/dist/lib/components/ui/overlays/dialog/dialog-outside.d.ts +5 -0
- package/dist/lib/components/ui/overlays/dialog/dialog-scroll-content.d.ts +9 -0
- package/dist/lib/components/ui/overlays/dialog/index.d.ts +1 -0
- package/dist/lib/components/ui/primitives/icon/icon-context.d.ts +1 -1
- package/dist/lib/components/ui/primitives/table/table.d.ts +6 -1
- package/dist/lib/components/ui/selection/index.d.ts +2 -0
- package/dist/lib/components/ui/selection/native-select/index.d.ts +1 -0
- package/dist/lib/components/ui/selection/native-select/native-select.d.ts +11 -0
- package/dist/lib/components/ui/selection/radio-group/radio-group.d.ts +8 -1
- package/dist/lib/components/ui/selection/tree-select-field/index.d.ts +2 -0
- package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-content.d.ts +13 -0
- package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-panel.d.ts +19 -0
- package/dist/lib/components/ui/selection/tree-select-field/partials/tree-select-trigger.d.ts +24 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select-field.d.ts +9 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select-form-field.d.ts +8 -0
- package/dist/lib/components/ui/selection/tree-select-field/tree-select.utils.d.ts +35 -0
- package/dist/lib/components/ui/selection/tree-select-field/types.d.ts +37 -0
- package/dist/lib/components/ui/selection/tree-select-field/use-tree-select-field.d.ts +20 -0
- package/dist/lib/i18n/resources/en/en.d.ts +40 -0
- package/dist/lib/i18n/resources/en/material.json.d.ts +43 -3
- package/dist/lib/i18n/resources/fr/fr.d.ts +40 -0
- package/dist/lib/i18n/resources/fr/material.json.d.ts +43 -3
- package/dist/lib/i18n/resources/resources.d.ts +80 -0
- package/dist/lib/i18n/translator.d.ts +1 -1
- package/dist/lib/lib/redux/status-slice.d.ts +1 -1
- package/dist/lib.js +295 -4
- package/dist/main.js +16 -16
- package/dist/map.js +5 -5
- package/dist/material.css +1 -1
- package/dist/merge-_Awk4ywA.js +156 -0
- package/dist/{mermaid.core-BGAQ3ZAZ.js → mermaid.core-DciYB1MV.js} +49 -49
- package/dist/{mindmap-definition-NLK3R4M7-HIqs4Eil.js → mindmap-definition-NLK3R4M7-Brf_2jIE.js} +13 -13
- package/dist/{pegDiagram-GJSIUBJH-Dcm3LCQX.js → pegDiagram-GJSIUBJH-CAO6aYvj.js} +4 -4
- package/dist/{pieDiagram-5QR66LMP-DQ6djEkW.js → pieDiagram-5QR66LMP-MPh-EWf-.js} +5 -5
- package/dist/print.js +2 -2
- package/dist/{quadrantDiagram-O4NWA36T-yUWorB72.js → quadrantDiagram-O4NWA36T-CwDeE9KB.js} +3 -3
- package/dist/{railroadDiagram-XR7U4H2S-CzOJlTUA.js → railroadDiagram-XR7U4H2S-DmKDXg8V.js} +4 -4
- package/dist/{requirementDiagram-PLB6GJNP-Cs5-8Nro.js → requirementDiagram-PLB6GJNP-CCP3YtvB.js} +13 -13
- package/dist/{sankeyDiagram-IPEJSGJF-CCqxyVoj.js → sankeyDiagram-IPEJSGJF-vgVchd2a.js} +3 -3
- package/dist/{sequenceDiagram-PO4LG4MO-DMLeIQ03.js → sequenceDiagram-PO4LG4MO-B2qb55A5.js} +5 -5
- package/dist/{sortable-provider-DuRzFvwe.js → sortable-provider-CzSnl6It.js} +17 -17
- package/dist/{src-CJ8DNrI1.js → src-C9kQSo6K.js} +1 -1
- package/dist/{stateDiagram-v2-GCMORJYK-D-8sLHg8.js → stateDiagram-v2-GCMORJYK-T-oIXh-8.js} +14 -14
- package/dist/{stored-language-BP90Ydtg.js → stored-language-DmUUhRb5.js} +90 -6
- package/dist/{swimlanes-2SLR337P-DM_lDm6v.js → swimlanes-2SLR337P-tW3_wBWO.js} +12 -12
- package/dist/swimlanesDiagram-TC7HE7FX-B1lWzHp1.js +28 -0
- package/dist/{timeline-definition-EJHVYXUP-D3Tz-JnK.js → timeline-definition-EJHVYXUP-SdA6wt2-.js} +5 -5
- package/dist/{translate-material-Ctzt0Y2N.js → translate-material-DuY12xca.js} +2 -2
- package/dist/{translator-Cfug7hC5.js → translator-CaIYjyFP.js} +1 -1
- package/dist/{use-heading-spy-DtVo2HBk.js → use-heading-spy-Crdz4OH5.js} +2 -2
- package/dist/{use-material-translation-CJswHOmK.js → use-material-translation-Od0QsFPA.js} +2 -2
- package/dist/{usecaseDiagram-POWQR4AR-Cxx8PDrr.js → usecaseDiagram-POWQR4AR-B3rBcR4E.js} +13 -13
- package/dist/{vennDiagram-UO4OBE2U-Aql8mhcy.js → vennDiagram-UO4OBE2U-CO0yFCI8.js} +4 -4
- package/dist/{wardleyDiagram-VNRHLVJA-tknlhG_t.js → wardleyDiagram-VNRHLVJA-QkwghAYo.js} +4 -4
- package/dist/{xychartDiagram-PMCCYNJV-CM0QlWD5.js → xychartDiagram-PMCCYNJV-stQWLgCx.js} +7 -7
- package/docs/components/README.md +2 -1
- package/docs/components/buttons-and-actions.md +8 -3
- package/docs/components/data-display.md +4 -4
- package/docs/components/data-table-filter-and-lists.md +100 -6
- package/docs/components/date-and-time.md +106 -6
- package/docs/components/feedback-and-status.md +4 -3
- package/docs/components/form-fields.md +55 -5
- package/docs/components/media-and-files.md +117 -8
- package/docs/components/navigation-and-layout.md +6 -1
- package/docs/components/overlays-and-menus.md +27 -2
- package/docs/components/primitives.md +34 -3
- package/docs/components/rich-widgets.md +1 -1
- package/docs/components/selection-and-choice.md +111 -8
- package/docs/guides/forms.md +2 -1
- package/docs/guides/i18n.md +58 -9
- package/docs/guides/ssr.md +3 -1
- package/docs/previews/date-time-daterangefield.webp +0 -0
- package/docs/previews/media-files-camera.webp +0 -0
- package/docs/previews/media-files-filepreview.webp +0 -0
- package/docs/previews/navigation-layout-stepper.webp +0 -0
- package/docs/previews/selection-choice-treeselectfield.webp +0 -0
- package/docs/roadmap.md +42 -3
- package/docs/troubleshooting.md +167 -0
- package/package.json +2 -2
- package/dist/flowDiagram-KWPJA3E3-B8Isvcc5.js +0 -17
- package/dist/isArrayLikeObject-CCJDO2RL.js +0 -86
- package/dist/lib/components/ui/fields/slider/slider-ticks.d.ts +0 -1
- package/dist/lib/components/ui/media/camera/camera.provider.d.ts +0 -6
- package/dist/lib/components/ui/media/camera/state/index.d.ts +0 -2
- package/dist/lib/components/ui/media/camera/utils/index.d.ts +0 -1
- package/dist/lib-DIj5dvbb.js +0 -367
- package/dist/merge-Dm-kHFxo.js +0 -172
- package/dist/swimlanesDiagram-TC7HE7FX-CbV1TsML.js +0 -28
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DateRangePresetOption, DateRangeRules, DayRange, PartialDayRange } from '@nxgt/material-core/date-range';
|
|
2
|
+
/** One entry of the preset list, resolved for this render. */
|
|
3
|
+
export type DateRangePresetItem = {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
range: DayRange;
|
|
7
|
+
/** Its range starts before `minDate`, ends after `maxDate`, or on a disabled day. */
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
/** The field's value covers the same days. */
|
|
10
|
+
active: boolean;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* The presets a `DateRangeField` lists, each with its range at this render,
|
|
14
|
+
* its label in the provider's language, and its state against the field's
|
|
15
|
+
* rules and value.
|
|
16
|
+
*/
|
|
17
|
+
export declare function useDateRangePresets({ presets, value, rules, withTime, }: {
|
|
18
|
+
presets?: readonly DateRangePresetOption[];
|
|
19
|
+
value?: PartialDayRange;
|
|
20
|
+
rules: DateRangeRules;
|
|
21
|
+
withTime?: boolean;
|
|
22
|
+
}): DateRangePresetItem[];
|
|
@@ -1,3 +1,10 @@
|
|
|
1
1
|
export declare function parseHours(value: string, period: 'AM' | 'PM'): number;
|
|
2
2
|
export declare function parseMinutes(value?: string): number;
|
|
3
3
|
export declare function formatValue(value: number): string;
|
|
4
|
+
/** The half of the day `date` is in. */
|
|
5
|
+
export declare function periodOf(date: Date): 'AM' | 'PM';
|
|
6
|
+
/**
|
|
7
|
+
* `date` moved into `period`'s half of the day, at the same hour on the
|
|
8
|
+
* 12-hour clock; a date already in it is returned unchanged (as a copy).
|
|
9
|
+
*/
|
|
10
|
+
export declare function withPeriod(date: Date, period: 'AM' | 'PM'): Date;
|
|
@@ -7,5 +7,5 @@ export type ChipProps = {
|
|
|
7
7
|
label: ReactNode;
|
|
8
8
|
active?: boolean;
|
|
9
9
|
onDismiss?: () => void;
|
|
10
|
-
} & Omit<ButtonProps, 'children' | 'type'>;
|
|
10
|
+
} & Omit<ButtonProps, 'children' | 'type' | 'size'>;
|
|
11
11
|
export declare function Chip({ label, leading, trailing, avatar, className, active, variant, onDismiss, disabled, color, onClick, ...props }: ChipProps): import("react").JSX.Element;
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ExternalToast, toast as sonnerToast, Toaster } from 'sonner';
|
|
3
|
+
/**
|
|
4
|
+
* A toast's action: a labelled button that runs `onClick` and dismisses the
|
|
5
|
+
* toast, or a render function given `dismiss` for anything else.
|
|
6
|
+
*/
|
|
7
|
+
export type ToastAction = {
|
|
8
|
+
label: ReactNode;
|
|
9
|
+
onClick?: () => void;
|
|
10
|
+
} | ((dismiss: () => void) => ReactNode);
|
|
3
11
|
export type ToastProps = {
|
|
4
12
|
id: string | number;
|
|
5
13
|
title?: ReactNode;
|
|
6
14
|
description?: ReactNode;
|
|
7
15
|
icon?: ReactNode;
|
|
8
16
|
className?: string;
|
|
9
|
-
action?:
|
|
10
|
-
label: ReactNode;
|
|
11
|
-
onClick?: () => void;
|
|
12
|
-
} | ((dismiss: () => void) => ReactNode);
|
|
17
|
+
action?: ToastAction;
|
|
13
18
|
};
|
|
14
19
|
export type ToastMethodProps = Omit<ToastProps, 'id'> & {
|
|
15
20
|
options?: ExternalToast;
|
|
@@ -20,5 +20,7 @@ export type NumberFieldProps = {
|
|
|
20
20
|
suffix?: ReactNode;
|
|
21
21
|
/** Names the input when it has no `label` of its own (a part of a larger field). */
|
|
22
22
|
'aria-label'?: string;
|
|
23
|
+
/** Names the input by another element's id (a part of a larger field). */
|
|
24
|
+
'aria-labelledby'?: string;
|
|
23
25
|
};
|
|
24
|
-
export declare function NumberField({ label, helperText, error, required, disabled, className, name, id, placeholder, value, defaultValue, onChange, onBlur, min, max, step, hideSteppers, suffix, 'aria-label': ariaLabel, }: NumberFieldProps): import("react").JSX.Element;
|
|
26
|
+
export declare function NumberField({ label, helperText, error, required, disabled, className, name, id, placeholder, value, defaultValue, onChange, onBlur, min, max, step, hideSteppers, suffix, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy, }: NumberFieldProps): import("react").JSX.Element;
|
|
@@ -7,5 +7,5 @@ declare function InputOTPGroup({ className, ...props }: React.ComponentProps<'di
|
|
|
7
7
|
declare function InputOTPSlot({ index, className, ...props }: React.ComponentProps<'div'> & {
|
|
8
8
|
index: number;
|
|
9
9
|
}): React.JSX.Element;
|
|
10
|
-
declare function InputOTPSeparator({ ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
10
|
+
declare function InputOTPSeparator({ children, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
|
|
11
11
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export type SliderHeaderProps = {
|
|
3
|
+
label?: ReactNode;
|
|
4
|
+
labelId: string;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
showReadout: boolean;
|
|
7
|
+
values: number[];
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** The Slider's own name: it names a single value's readout as it names the thumbs. */
|
|
13
|
+
ariaLabel?: string;
|
|
14
|
+
/** As `ariaLabel`, and wins over it, as on the thumbs (`sliderThumbNames`). */
|
|
15
|
+
ariaLabelledBy?: string;
|
|
16
|
+
onChange: (values: number[]) => void;
|
|
17
|
+
};
|
|
18
|
+
/** The Label and the value (editable inputs, or text) above the track. */
|
|
19
|
+
export declare function SliderHeader({ label, labelId, required, showReadout, values, min, max, step, disabled, ariaLabel, ariaLabelledBy, onChange, }: SliderHeaderProps): import("react").JSX.Element | null;
|
|
@@ -4,6 +4,10 @@ export type SliderReadoutProps = {
|
|
|
4
4
|
max: number;
|
|
5
5
|
step?: number;
|
|
6
6
|
disabled?: boolean;
|
|
7
|
+
/** What names a single value's input: an element's id (the field's Label)… */
|
|
8
|
+
labelledBy?: string;
|
|
9
|
+
/** …else this name, else "Value". */
|
|
10
|
+
label?: string;
|
|
7
11
|
onChange: (values: number[]) => void;
|
|
8
12
|
};
|
|
9
|
-
export declare function SliderReadout({ values, min, max, step, disabled, onChange, }: SliderReadoutProps): import("react").JSX.Element;
|
|
13
|
+
export declare function SliderReadout({ values, min, max, step, disabled, labelledBy, label, onChange, }: SliderReadoutProps): import("react").JSX.Element;
|
|
@@ -11,3 +11,10 @@ export type SliderProps = {
|
|
|
11
11
|
showReadout?: boolean;
|
|
12
12
|
} & Omit<ComponentProps<typeof SliderControl>, 'hiddenLabel' | 'labelId'>;
|
|
13
13
|
export declare function Slider({ leading, trailing, label, helperText, error, required, ticks, showReadout, value, defaultValue, onValueChange, min, max, step, orientation, disabled, className, ref, ...props }: SliderProps): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* The labelled `Slider` under `@nxgt/material-vue`'s name, so code reads the
|
|
16
|
+
* same in both libraries. Same component, same props. The names align fully
|
|
17
|
+
* in 3.0; `Slider` is not deprecated.
|
|
18
|
+
*/
|
|
19
|
+
export declare const SliderField: typeof Slider;
|
|
20
|
+
export type SliderFieldProps = SliderProps;
|
|
@@ -7,3 +7,10 @@ export type SwitchProps = {
|
|
|
7
7
|
placeholder?: ReactNode;
|
|
8
8
|
} & ComponentProps<typeof SwitchPrimitive.Root>;
|
|
9
9
|
export declare function Switch({ error, helperText, label, placeholder, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
10
|
+
/**
|
|
11
|
+
* The labelled `Switch` under `@nxgt/material-vue`'s name, so code reads the
|
|
12
|
+
* same in both libraries. Same component, same props. The names align fully
|
|
13
|
+
* in 3.0; `Switch` is not deprecated.
|
|
14
|
+
*/
|
|
15
|
+
export declare const SwitchField: typeof Switch;
|
|
16
|
+
export type SwitchFieldProps = SwitchProps;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StepperState } from './step-state';
|
|
3
|
+
export type StepperStepProps = {
|
|
4
|
+
id: string;
|
|
5
|
+
index: number;
|
|
6
|
+
state: StepperState;
|
|
7
|
+
current: boolean;
|
|
8
|
+
hidden: boolean;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
label: ReactNode;
|
|
11
|
+
title: ReactNode;
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
name?: string;
|
|
14
|
+
onSelect?: () => void;
|
|
15
|
+
};
|
|
16
|
+
/** One `<li>` of a `Stepper`. Internal: not exported from the barrel. */
|
|
17
|
+
export declare function StepperStep({ id, index, state, current, hidden, icon, label, title, description, name, onSelect, }: StepperStepProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { CameraContextValue } from './types';
|
|
2
|
+
export declare const CameraContext: import('react').Context<CameraContextValue | null>;
|
|
3
|
+
/** The camera's refs, state and actions; throws outside `<Camera>`. */
|
|
4
|
+
export declare function useCameraContext(): CameraContextValue;
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Webcam preview with a start / stop toggle and a still capture. It renders
|
|
3
|
+
* in the browser only, after mount (`getUserMedia` has no server side), as
|
|
4
|
+
* in `@nxgt/material-vue`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Camera: import('react').ComponentType<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CameraAlert, CameraState } from './types';
|
|
2
|
+
export type CapturePhotoResult = {
|
|
3
|
+
capturedImage?: string;
|
|
4
|
+
alert?: CameraAlert;
|
|
5
|
+
isProcessing: boolean;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Draws the current frame of `video` onto a canvas sized by
|
|
9
|
+
* `captureSettings`, mirrored when asked, and returns it as a data URL.
|
|
10
|
+
* `null` when there is nothing to capture: not streaming, no video, or no
|
|
11
|
+
* `document` (on the server).
|
|
12
|
+
*/
|
|
13
|
+
export declare function capturePhotoFromVideo(video: HTMLVideoElement | null, state: Pick<CameraState, 'isStreaming' | 'captureSettings'>): CapturePhotoResult | null;
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
export {};
|
|
1
|
+
export { Camera } from './camera';
|
|
2
|
+
export { useCameraContext } from './camera-context';
|
|
3
|
+
export type { CapturePhotoResult } from './capture-photo';
|
|
4
|
+
export { capturePhotoFromVideo } from './capture-photo';
|
|
5
|
+
export type { CameraStore } from './state/camera.store';
|
|
6
|
+
export { createCameraStore } from './state/camera.store';
|
|
7
|
+
export type { CameraActions, CameraAlert, CameraContextValue, CameraDeviceInfo, CameraProps, CameraState, CaptureSettings, ImageFormat, } from './types';
|
|
8
|
+
export { useCamera } from './use-camera';
|
|
9
|
+
export { getCameraDevices, isCameraSupported, requestCameraPermissions, } from './utils/camera.utils';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CameraReducerCreators } from './camera.slice';
|
|
2
|
-
export declare const createCapturePhotoReducer: (create: CameraReducerCreators) => import('@reduxjs/toolkit').CaseReducer<import('
|
|
2
|
+
export declare const createCapturePhotoReducer: (create: CameraReducerCreators) => import('@reduxjs/toolkit').CaseReducer<import('..').CameraState, {
|
|
3
3
|
payload: HTMLVideoElement | null;
|
|
4
4
|
type: string;
|
|
5
5
|
}> & {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ReducerCreators } from '@reduxjs/toolkit';
|
|
2
|
-
import { CameraAlert, CameraState } from '../types';
|
|
2
|
+
import { CameraAlert, CameraDeviceInfo, CameraState } from '../types';
|
|
3
3
|
export declare const cameraSlice: import('@reduxjs/toolkit').Slice<CameraState, {
|
|
4
4
|
readonly setDevices: import('@reduxjs/toolkit').CaseReducer<CameraState, {
|
|
5
|
-
payload:
|
|
5
|
+
payload: CameraDeviceInfo[];
|
|
6
6
|
type: string;
|
|
7
7
|
}> & {
|
|
8
8
|
_reducerDefinitionType: import("@reduxjs/toolkit").ReducerType.reducer;
|
|
@@ -49,7 +49,7 @@ export declare const cameraSlice: import('@reduxjs/toolkit').Slice<CameraState,
|
|
|
49
49
|
cameraSupported: false;
|
|
50
50
|
} | {
|
|
51
51
|
hasPermission: boolean;
|
|
52
|
-
devices:
|
|
52
|
+
devices: CameraDeviceInfo[];
|
|
53
53
|
cameraSupported: true;
|
|
54
54
|
}, {
|
|
55
55
|
rejectValue: {
|
|
@@ -84,7 +84,7 @@ export declare const cameraSlice: import('@reduxjs/toolkit').Slice<CameraState,
|
|
|
84
84
|
cameraSupported: false;
|
|
85
85
|
} | {
|
|
86
86
|
hasPermission: boolean;
|
|
87
|
-
devices:
|
|
87
|
+
devices: CameraDeviceInfo[];
|
|
88
88
|
cameraSupported: true;
|
|
89
89
|
}, void, {
|
|
90
90
|
rejectValue: {
|
|
@@ -140,9 +140,4 @@ export declare const cameraSlice: import('@reduxjs/toolkit').Slice<CameraState,
|
|
|
140
140
|
}>;
|
|
141
141
|
};
|
|
142
142
|
}, "camera", "camera", import('@reduxjs/toolkit').SliceSelectors<CameraState>>;
|
|
143
|
-
type CameraSliceActions = typeof cameraSlice.actions;
|
|
144
|
-
export type CameraActions = {
|
|
145
|
-
[K in keyof CameraSliceActions]: (...args: Parameters<CameraSliceActions[K]>) => void;
|
|
146
|
-
};
|
|
147
143
|
export type CameraReducerCreators = ReducerCreators<CameraState>;
|
|
148
|
-
export {};
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { CameraState } from '../types';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A store for one `Camera`. Each instance creates its own, never a module
|
|
4
|
+
* singleton: two cameras on a page, or two requests on a server, would
|
|
5
|
+
* otherwise share one state.
|
|
6
|
+
*/
|
|
7
|
+
export declare function createCameraStore(preloadedState?: Partial<CameraState>): import('@reduxjs/toolkit').EnhancedStore<CameraState, import('redux').UnknownAction, import('@reduxjs/toolkit').Tuple<[import('redux').StoreEnhancer<{
|
|
3
8
|
dispatch: import('redux-thunk').ThunkDispatch<CameraState, undefined, import('redux').UnknownAction>;
|
|
4
9
|
}>, import('redux').StoreEnhancer]>>;
|
|
10
|
+
export type CameraStore = ReturnType<typeof createCameraStore>;
|
|
5
11
|
export declare const useCameraActions: () => import('@reduxjs/toolkit').CaseReducerActions<{
|
|
6
12
|
readonly setDevices: import('@reduxjs/toolkit').CaseReducer<CameraState, {
|
|
7
|
-
payload:
|
|
13
|
+
payload: import('..').CameraDeviceInfo[];
|
|
8
14
|
type: string;
|
|
9
15
|
}> & {
|
|
10
16
|
_reducerDefinitionType: import("@reduxjs/toolkit").ReducerType.reducer;
|
|
@@ -28,7 +34,7 @@ export declare const useCameraActions: () => import('@reduxjs/toolkit').CaseRedu
|
|
|
28
34
|
_reducerDefinitionType: import("@reduxjs/toolkit").ReducerType.reducer;
|
|
29
35
|
};
|
|
30
36
|
readonly setAlert: import('@reduxjs/toolkit').CaseReducer<CameraState, {
|
|
31
|
-
payload: import('
|
|
37
|
+
payload: import('..').CameraAlert | null;
|
|
32
38
|
type: string;
|
|
33
39
|
}> & {
|
|
34
40
|
_reducerDefinitionType: import("@reduxjs/toolkit").ReducerType.reducer;
|
|
@@ -51,7 +57,7 @@ export declare const useCameraActions: () => import('@reduxjs/toolkit').CaseRedu
|
|
|
51
57
|
cameraSupported: false;
|
|
52
58
|
} | {
|
|
53
59
|
hasPermission: boolean;
|
|
54
|
-
devices: import('
|
|
60
|
+
devices: import('..').CameraDeviceInfo[];
|
|
55
61
|
cameraSupported: true;
|
|
56
62
|
}, {
|
|
57
63
|
rejectValue: {
|
|
@@ -86,7 +92,7 @@ export declare const useCameraActions: () => import('@reduxjs/toolkit').CaseRedu
|
|
|
86
92
|
cameraSupported: false;
|
|
87
93
|
} | {
|
|
88
94
|
hasPermission: boolean;
|
|
89
|
-
devices: import('
|
|
95
|
+
devices: import('..').CameraDeviceInfo[];
|
|
90
96
|
cameraSupported: true;
|
|
91
97
|
}, void, {
|
|
92
98
|
rejectValue: {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CameraReducerCreators } from './camera.slice';
|
|
2
|
-
export declare const createRequestPermissionThunk: (create: CameraReducerCreators) => import('@reduxjs/toolkit').AsyncThunkReducers<import('
|
|
2
|
+
export declare const createRequestPermissionThunk: (create: CameraReducerCreators) => import('@reduxjs/toolkit').AsyncThunkReducers<import('..').CameraState, void, {
|
|
3
3
|
hasPermission: boolean;
|
|
4
4
|
devices: never[];
|
|
5
5
|
cameraSupported: false;
|
|
6
6
|
} | {
|
|
7
7
|
hasPermission: boolean;
|
|
8
|
-
devices: import('
|
|
8
|
+
devices: import('..').CameraDeviceInfo[];
|
|
9
9
|
cameraSupported: true;
|
|
10
10
|
}, {
|
|
11
11
|
rejectValue: {
|
|
@@ -40,7 +40,7 @@ export declare const createRequestPermissionThunk: (create: CameraReducerCreator
|
|
|
40
40
|
cameraSupported: false;
|
|
41
41
|
} | {
|
|
42
42
|
hasPermission: boolean;
|
|
43
|
-
devices: import('
|
|
43
|
+
devices: import('..').CameraDeviceInfo[];
|
|
44
44
|
cameraSupported: true;
|
|
45
45
|
}, void, {
|
|
46
46
|
rejectValue: {
|
|
@@ -55,7 +55,7 @@ export declare const createRequestPermissionThunk: (create: CameraReducerCreator
|
|
|
55
55
|
rejectedMeta?: unknown;
|
|
56
56
|
}>;
|
|
57
57
|
};
|
|
58
|
-
export declare const createStartStreamThunk: (create: CameraReducerCreators) => import('@reduxjs/toolkit').AsyncThunkReducers<import('
|
|
58
|
+
export declare const createStartStreamThunk: (create: CameraReducerCreators) => import('@reduxjs/toolkit').AsyncThunkReducers<import('..').CameraState, (stream: MediaStream) => void, void, {
|
|
59
59
|
rejectValue: {
|
|
60
60
|
message: string;
|
|
61
61
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ComponentProps, RefObject } from 'react';
|
|
2
2
|
export type ImageFormat = 'png' | 'jpeg' | 'webp';
|
|
3
3
|
export type CaptureSettings = {
|
|
4
4
|
resolution: {
|
|
@@ -25,14 +25,24 @@ export type CameraState = {
|
|
|
25
25
|
captureSettings: CaptureSettings;
|
|
26
26
|
alert: CameraAlert | null;
|
|
27
27
|
};
|
|
28
|
+
/** What `useCamera()` / `useCameraContext()` hand a part of the camera. */
|
|
29
|
+
export type CameraActions = {
|
|
30
|
+
setDevices: (devices: CameraDeviceInfo[]) => void;
|
|
31
|
+
selectDevice: (deviceId: string | null) => void;
|
|
32
|
+
setPermission: (hasPermission: boolean) => void;
|
|
33
|
+
setStreaming: (isStreaming: boolean) => void;
|
|
34
|
+
setAlert: (alert: CameraAlert | null) => void;
|
|
35
|
+
setCameraSupported: (cameraSupported: boolean) => void;
|
|
36
|
+
requestPermission: () => Promise<void>;
|
|
37
|
+
startStream: () => void;
|
|
38
|
+
stopStream: () => void;
|
|
39
|
+
capturePhoto: () => void;
|
|
40
|
+
};
|
|
28
41
|
export type CameraContextValue = {
|
|
29
|
-
videoRef:
|
|
30
|
-
canvasRef:
|
|
31
|
-
streamRef:
|
|
42
|
+
videoRef: RefObject<HTMLVideoElement | null>;
|
|
43
|
+
canvasRef: RefObject<HTMLCanvasElement | null>;
|
|
44
|
+
streamRef: RefObject<MediaStream | null>;
|
|
32
45
|
state: CameraState;
|
|
33
|
-
actions:
|
|
34
|
-
capturePhoto: () => void;
|
|
35
|
-
startStream: () => void;
|
|
36
|
-
stopStream: () => void;
|
|
37
|
-
};
|
|
46
|
+
actions: CameraActions;
|
|
38
47
|
};
|
|
48
|
+
export type CameraProps = ComponentProps<'div'>;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
actions: Omit<import('./state').CameraActions, "capturePhoto" | "startStream"> & {
|
|
7
|
-
capturePhoto: () => void;
|
|
8
|
-
startStream: () => void;
|
|
9
|
-
stopStream: () => void;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
1
|
+
/**
|
|
2
|
+
* The camera's context, plus its lifecycle: asks for permission on mount
|
|
3
|
+
* and stops the stream on unmount. Inside `<Camera>` only.
|
|
4
|
+
*/
|
|
5
|
+
export declare function useCamera(): import('./types').CameraContextValue;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentType } from 'react';
|
|
2
|
+
import { PdfReaderProps } from '../pdf-viewer/types';
|
|
3
|
+
/**
|
|
4
|
+
* `PdfReader`, imported on first use: a page that previews no PDF never
|
|
5
|
+
* loads the viewer, and an import that fails (a chunk that cannot be
|
|
6
|
+
* fetched, pdf.js missing from the bundle) rejects, so `FilePreview` falls
|
|
7
|
+
* back to its file card. A failure is not cached; the next call tries again.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadPdfReader(): Promise<ComponentType<PdfReaderProps>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FilePreviewProps } from './types';
|
|
2
|
+
export type { FilePreviewProps } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Previews a file picked by its MIME type, else its extension: an image, a
|
|
5
|
+
* PDF (in `PdfReader`, loaded on demand), a video or audio file with the
|
|
6
|
+
* browser's controls, the text of a text, JSON, CSV or Markdown file, and
|
|
7
|
+
* for anything else a card with its name, size and a download link.
|
|
8
|
+
*
|
|
9
|
+
* Safe on a server: nothing is read and no object URL is made until it has
|
|
10
|
+
* mounted, and until then it renders a neutral placeholder.
|
|
11
|
+
*/
|
|
12
|
+
export declare function FilePreview({ file, type, name, maxTextBytes, onError, className, ...props }: FilePreviewProps): import("react").JSX.Element | null;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { type FileKind, FilePreviewHttpError, type FilePreviewSource, FilePreviewUnsafeUrlError, fileKind, TEXT_PREVIEW_MAX_BYTES, } from '@nxgt/material-core/file-preview';
|
|
2
|
+
export { FilePreview } from './file-preview';
|
|
3
|
+
export type { FilePreviewProps, FilePreviewStatus } from './types';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DescribedFile } from '@nxgt/material-core/file-preview';
|
|
2
|
+
import { FilePreviewState } from '../use-file-preview';
|
|
3
|
+
/** The part of `FilePreview` that depends on the file's kind and the status. */
|
|
4
|
+
export declare function FilePreviewBody({ state, described, displayName, maxTextBytes, }: {
|
|
5
|
+
state: FilePreviewState;
|
|
6
|
+
described: DescribedFile;
|
|
7
|
+
displayName: string;
|
|
8
|
+
maxTextBytes?: number;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FileKind } from '@nxgt/material-core/file-preview';
|
|
2
|
+
/**
|
|
3
|
+
* A link that saves the file under `name` (the browser's choice when `''`).
|
|
4
|
+
* Nothing until `href` is known.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FilePreviewDownload({ href, name, }: {
|
|
7
|
+
href: string | undefined;
|
|
8
|
+
name: string;
|
|
9
|
+
}): import("react").JSX.Element | null;
|
|
10
|
+
/** Any other file: its icon, name, size and type, and a download link. */
|
|
11
|
+
export declare function FilePreviewCard({ kind, name, fileName, size, type, href, }: {
|
|
12
|
+
kind: FileKind;
|
|
13
|
+
/** What the card shows. */
|
|
14
|
+
name: string;
|
|
15
|
+
/** What the download saves as. */
|
|
16
|
+
fileName: string;
|
|
17
|
+
size?: number;
|
|
18
|
+
type: string;
|
|
19
|
+
href: string | undefined;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An image, a video or an audio file in the browser's own element: `<img>`
|
|
3
|
+
* named by the file name, `<video controls>` and `<audio controls>` labelled
|
|
4
|
+
* with it. `onError` fires when the element cannot load `src`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FilePreviewMedia({ kind, src, name, onError, }: {
|
|
7
|
+
kind: 'image' | 'video' | 'audio';
|
|
8
|
+
src: string;
|
|
9
|
+
name: string;
|
|
10
|
+
onError: () => void;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A PDF in `PdfReader`, loaded lazily; `fallback` (the file card) when the
|
|
4
|
+
* viewer cannot be loaded.
|
|
5
|
+
*/
|
|
6
|
+
export declare function FilePreviewPdf({ file, fileName, fallback, }: {
|
|
7
|
+
file: Blob | string;
|
|
8
|
+
fileName: string;
|
|
9
|
+
fallback: ReactNode;
|
|
10
|
+
}): string | number | bigint | boolean | import("react").JSX.Element | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | null | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
/** The server's and the first render's box: no text, nothing to mismatch. */
|
|
3
|
+
export declare function FilePreviewPlaceholder(): import("react").JSX.Element;
|
|
4
|
+
/**
|
|
5
|
+
* The live region that announces the loading: always mounted, from the
|
|
6
|
+
* server's render on, with its text put in while loading. A region that
|
|
7
|
+
* mounted with its text already in it would not be announced.
|
|
8
|
+
*/
|
|
9
|
+
export declare function FilePreviewAnnouncer({ loading }: {
|
|
10
|
+
loading: boolean;
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
/** What is seen while loading; `FilePreviewAnnouncer` is what is heard. */
|
|
13
|
+
export declare function FilePreviewLoading(): import("react").JSX.Element;
|
|
14
|
+
/** The error message, and below it whatever can still be done (a download). */
|
|
15
|
+
export declare function FilePreviewError({ children }: {
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FileKind, TextPreview } from '@nxgt/material-core/file-preview';
|
|
2
|
+
/**
|
|
3
|
+
* A text kind's content: JSON in `JsonViewer` and Markdown rendered when the
|
|
4
|
+
* whole file was read, else (and for text and CSV) as it is, in a `<pre>`.
|
|
5
|
+
* What scrolls is a region named after the file, and takes focus so a
|
|
6
|
+
* keyboard can scroll it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function FilePreviewText({ kind, name, preview, maxBytes, }: {
|
|
9
|
+
kind: FileKind;
|
|
10
|
+
name: string;
|
|
11
|
+
preview: TextPreview;
|
|
12
|
+
maxBytes: number;
|
|
13
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FilePreviewSource } from '@nxgt/material-core/file-preview';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
/** Where a preview is: server or first render, reading, shown, failed. */
|
|
4
|
+
export type FilePreviewStatus = 'pending' | 'loading' | 'ready' | 'error';
|
|
5
|
+
export type FilePreviewProps = Omit<ComponentProps<'figure'>, 'children' | 'onError'> & {
|
|
6
|
+
/**
|
|
7
|
+
* The file: a `File` or `Blob`, or a URL. Nothing renders without one. A
|
|
8
|
+
* URL must be `http(s):`, relative, `blob:`, or a `data:` URL of an
|
|
9
|
+
* image, video, audio, plain text, CSV, Markdown, JSON or PDF; any other (`javascript:`, …) shows the error state.
|
|
10
|
+
*/
|
|
11
|
+
file: FilePreviewSource | null | undefined;
|
|
12
|
+
/** MIME type; overrides the `Blob`'s. Picks the kind before the extension does. */
|
|
13
|
+
type?: string;
|
|
14
|
+
/** Name shown, used as the image's alt text and the download's file name; overrides the `File`'s. */
|
|
15
|
+
name?: string;
|
|
16
|
+
/** How much of a text, JSON, CSV or Markdown file is read and shown. 256 KB by default. */
|
|
17
|
+
maxTextBytes?: number;
|
|
18
|
+
/**
|
|
19
|
+
* The file could not be read or shown: `FilePreviewHttpError`, a
|
|
20
|
+
* `FilePreviewUnsafeUrlError`, or an `Error` for a broken image or video.
|
|
21
|
+
*/
|
|
22
|
+
onError?: (error: unknown) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DescribedFile } from '@nxgt/material-core/file-preview';
|
|
2
|
+
import { FilePreviewProps, FilePreviewStatus } from './types';
|
|
3
|
+
import { TextPreviewState } from './use-text-preview';
|
|
4
|
+
type Options = Pick<FilePreviewProps, 'file' | 'type' | 'name' | 'maxTextBytes' | 'onError'>;
|
|
5
|
+
export type FilePreviewState = {
|
|
6
|
+
described: DescribedFile | null;
|
|
7
|
+
status: FilePreviewStatus;
|
|
8
|
+
/** What the media element and the download link point at, once known. */
|
|
9
|
+
href: string | undefined;
|
|
10
|
+
text: TextPreviewState;
|
|
11
|
+
/** For an `<img>`, `<video>` or `<audio>` that failed to load `href`. */
|
|
12
|
+
onMediaError: () => void;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Everything `FilePreview` decides: the file's kind, the object URL of a
|
|
16
|
+
* `Blob` (made after mount, revoked on change and unmount), the text of a
|
|
17
|
+
* text kind, and the status. On a server and in the first client render the
|
|
18
|
+
* status is `'pending'` and nothing is read; a URL `safePreviewUrl` refuses
|
|
19
|
+
* is `'error'` everywhere and is never used.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useFilePreview({ file, type, name, maxTextBytes, onError, }: Options): FilePreviewState;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TextPreview } from '@nxgt/material-core/file-preview';
|
|
2
|
+
export type TextPreviewState = {
|
|
3
|
+
status: 'loading';
|
|
4
|
+
} | {
|
|
5
|
+
status: 'ready';
|
|
6
|
+
preview: TextPreview;
|
|
7
|
+
} | {
|
|
8
|
+
status: 'error';
|
|
9
|
+
error: unknown;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The first `maxBytes` of `source` as text, read in an effect (never on a
|
|
13
|
+
* server). A new source aborts the previous read; `undefined` reads nothing.
|
|
14
|
+
*/
|
|
15
|
+
export declare function useTextPreview(source: Blob | string | undefined, maxBytes: number | undefined): TextPreviewState;
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object URL for `blob`, made in an effect (never on a server) and revoked
|
|
3
|
+
* when `blob` changes or the component unmounts. `undefined` until made, and
|
|
4
|
+
* never the previous blob's (already revoked) URL. `FilePreview` uses it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useBlobUrl(blob: Blob | undefined): string | undefined;
|
|
1
7
|
/** An object URL previewing `file` while it is an image, revoked on change. */
|
|
2
8
|
export declare function useImagePreview(file?: File): string | undefined;
|