@eifi1/ui-kit 0.11.0 → 0.13.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 +59 -34
- package/dist/chart.d.ts +3 -1
- package/dist/chart.js +2 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/account-settings-labels.d.ts +105 -0
- package/dist/components/account-settings-labels.js +81 -0
- package/dist/components/account-settings-labels.js.map +1 -0
- package/dist/components/account-settings.d.ts +36 -52
- package/dist/components/account-settings.js +44 -8
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/amount-input.d.ts +40 -4
- package/dist/components/amount-input.js +50 -12
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/authed-image.d.ts +68 -0
- package/dist/components/authed-image.js +117 -0
- package/dist/components/authed-image.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +2 -1
- package/dist/components/breadcrumbs.js +5 -2
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar.d.ts +10 -2
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +51 -2
- package/dist/components/button-group.js +5 -1
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/calculator.d.ts +15 -4
- package/dist/components/calendar-heatmap.d.ts +41 -3
- package/dist/components/calendar-heatmap.js +48 -7
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/chart.js +14 -8
- package/dist/components/chart.js.map +1 -1
- package/dist/components/chip.d.ts +2 -1
- package/dist/components/chip.js +26 -18
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +35 -3
- package/dist/components/choice-card.js +83 -25
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/combobox-core.d.ts +3 -1
- package/dist/components/combobox-core.js +18 -5
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +2 -2
- package/dist/components/combobox.js +31 -9
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/copy-button.d.ts +51 -70
- package/dist/components/copy-button.js +1 -1
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +63 -0
- package/dist/components/data-table-cells.js +64 -0
- package/dist/components/data-table-cells.js.map +1 -0
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +8 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +1 -1
- package/dist/components/data-table-filters.js +31 -1
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-labels.d.ts +13 -0
- package/dist/components/data-table-labels.js +8 -1
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table.d.ts +1 -1
- package/dist/components/data-table.js +125 -27
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +3 -1
- package/dist/components/date-picker.js +15 -2
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/description-list.d.ts +23 -3
- package/dist/components/description-list.js +23 -3
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +1 -0
- package/dist/components/entity-combobox.d.ts +1 -1
- package/dist/components/entity-combobox.js +40 -20
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary.d.ts +281 -0
- package/dist/components/error-boundary.js +302 -0
- package/dist/components/error-boundary.js.map +1 -0
- package/dist/components/field-sync.js +90 -83
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.d.ts +30 -4
- package/dist/components/field.js +40 -17
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +50 -208
- package/dist/components/file-dropzone.d.ts +49 -2
- package/dist/components/floating-panel.d.ts +13 -4
- package/dist/components/floating-panel.js +7 -3
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/form-actions.d.ts +53 -0
- package/dist/components/form-actions.js +98 -0
- package/dist/components/form-actions.js.map +1 -0
- package/dist/components/full-bleed-dialog.js +4 -0
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/hover-menu.js +64 -56
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/image-grid.d.ts +67 -0
- package/dist/components/image-grid.js +112 -0
- package/dist/components/image-grid.js.map +1 -0
- package/dist/components/lightbox.d.ts +104 -0
- package/dist/components/lightbox.js +229 -0
- package/dist/components/lightbox.js.map +1 -0
- package/dist/components/line-items.d.ts +114 -0
- package/dist/components/line-items.js +238 -0
- package/dist/components/line-items.js.map +1 -0
- package/dist/components/list.d.ts +37 -4
- package/dist/components/list.js +35 -14
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-state.d.ts +24 -0
- package/dist/components/loading-state.js +32 -0
- package/dist/components/loading-state.js.map +1 -0
- package/dist/components/menu-item.d.ts +2 -1
- package/dist/components/menu-item.js +5 -1
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar.d.ts +13 -1
- package/dist/components/mini-calendar.js +46 -2
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +20 -1
- package/dist/components/modal.js +26 -2
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +21 -1
- package/dist/components/month-picker.js +139 -26
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +1 -1
- package/dist/components/multi-entity-combobox.js +42 -20
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/nav-pills.d.ts +2 -1
- package/dist/components/nav-pills.js +5 -1
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +24 -5
- package/dist/components/number-field.js +5 -7
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +25 -5
- package/dist/components/number-input.js +7 -1
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +20 -5
- package/dist/components/numpad-sheet.js +3 -2
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/page-header.d.ts +35 -6
- package/dist/components/page-header.js +7 -1
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/passkeys-setting.d.ts +67 -0
- package/dist/components/passkeys-setting.js +214 -0
- package/dist/components/passkeys-setting.js.map +1 -0
- package/dist/components/picker-sheet.js +5 -1
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart-labels.d.ts +20 -0
- package/dist/components/pie-chart-labels.js +12 -0
- package/dist/components/pie-chart-labels.js.map +1 -0
- package/dist/components/pie-chart.d.ts +101 -0
- package/dist/components/pie-chart.js +283 -0
- package/dist/components/pie-chart.js.map +1 -0
- package/dist/components/popover.js +3 -0
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar.d.ts +44 -3
- package/dist/components/progress-bar.js +58 -22
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.d.ts +34 -0
- package/dist/components/qr-code.js +57 -0
- package/dist/components/qr-code.js.map +1 -0
- package/dist/components/search-field.d.ts +15 -3
- package/dist/components/search-field.js +5 -1
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/settings-fields.d.ts +49 -1
- package/dist/components/signed-amount.d.ts +122 -0
- package/dist/components/signed-amount.js +152 -0
- package/dist/components/signed-amount.js.map +1 -0
- package/dist/components/skeleton.d.ts +10 -3
- package/dist/components/skeleton.js +12 -2
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/stat-tile.d.ts +2 -1
- package/dist/components/stat-tile.js +6 -3
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swipeable-row.js +4 -3
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/table.d.ts +39 -5
- package/dist/components/table.js +45 -11
- package/dist/components/table.js.map +1 -1
- package/dist/components/text-link.d.ts +238 -0
- package/dist/components/text-link.js +144 -0
- package/dist/components/text-link.js.map +1 -0
- package/dist/components/text.d.ts +26 -2
- package/dist/components/text.js +16 -2
- package/dist/components/text.js.map +1 -1
- package/dist/components/time-input.d.ts +49 -1
- package/dist/components/toggle-group.d.ts +35 -0
- package/dist/components/toggle-group.js +43 -14
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +53 -3
- package/dist/components/toggle-legend.js +54 -1
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.d.ts +51 -1
- package/dist/components/tooltip.js +59 -35
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/ui.d.ts +51 -779
- package/dist/components/ui.js +364 -34
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +3 -52
- package/dist/components/use-table-state.js +128 -30
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/{data-table-filters-Dh9uF_S-.d.ts → data-table-Drun8Fk9.d.ts} +305 -61
- package/dist/data-table.d.ts +2 -1
- package/dist/data-table.js +5 -1
- package/dist/data-table.js.map +1 -1
- package/dist/feedback/feedback-attachment.js +4 -6
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +26 -3
- package/dist/feedback/feedback-dialog.js +21 -5
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.js +86 -75
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +173 -0
- package/dist/feedback/feedback-thread.js +264 -0
- package/dist/feedback/feedback-thread.js.map +1 -0
- package/dist/feedback.d.ts +2 -1
- package/dist/feedback.js +1 -0
- package/dist/feedback.js.map +1 -1
- package/dist/hooks/use-authed-src.d.ts +71 -0
- package/dist/hooks/use-authed-src.js +63 -0
- package/dist/hooks/use-authed-src.js.map +1 -0
- package/dist/hooks/use-file-drop.d.ts +49 -2
- package/dist/hooks/use-hotkey.d.ts +59 -0
- package/dist/hooks/use-hotkey.js +105 -0
- package/dist/hooks/use-hotkey.js.map +1 -0
- package/dist/hooks/use-search-param-state.d.ts +83 -0
- package/dist/hooks/use-search-param-state.js +94 -0
- package/dist/hooks/use-search-param-state.js.map +1 -0
- package/dist/i18n/defaults.d.ts +15 -4
- package/dist/i18n/defaults.js +31 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +46 -312
- package/dist/i18n/kit-labels.js +20 -5
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/de-CH-informal.d.ts +15 -4
- package/dist/i18n/locales/de-CH.d.ts +15 -4
- package/dist/i18n/locales/de-informal.d.ts +15 -4
- package/dist/i18n/locales/de.d.ts +15 -4
- package/dist/i18n/locales/de.js +164 -3
- package/dist/i18n/locales/de.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +15 -4
- package/dist/i18n/locales/es.js +161 -3
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +15 -4
- package/dist/i18n/locales/fr.js +161 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +15 -4
- package/dist/i18n/locales/hu.js +161 -3
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +15 -4
- package/dist/i18n/locales/it.js +161 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +15 -4
- package/dist/i18n/locales/zh.js +161 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +39 -19
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/kit-labels-Mz8zZHIF.d.ts +1744 -0
- package/dist/lib/format.d.ts +162 -0
- package/dist/lib/format.js +151 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/qr-encode.d.ts +44 -0
- package/dist/lib/qr-encode.js +338 -0
- package/dist/lib/qr-encode.js.map +1 -0
- package/dist/rhf/fields.d.ts +283 -0
- package/dist/rhf/fields.js +631 -0
- package/dist/rhf/fields.js.map +1 -0
- package/dist/rhf/form.d.ts +49 -1
- package/dist/rhf/line-items.d.ts +31 -0
- package/dist/rhf/line-items.js +59 -0
- package/dist/rhf/line-items.js.map +1 -0
- package/dist/rhf.d.ts +61 -1
- package/dist/rhf.js +2 -0
- package/dist/rhf.js.map +1 -1
- package/dist/search/command-palette.js +20 -14
- package/dist/search/command-palette.js.map +1 -1
- package/dist/shell/app-shell.d.ts +99 -2
- package/dist/shell/app-shell.js +120 -57
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.d.ts +74 -0
- package/dist/shell/auth-layout.js +97 -0
- package/dist/shell/auth-layout.js.map +1 -0
- package/dist/shell/top-bar-brand.d.ts +81 -0
- package/dist/shell/top-bar-brand.js +47 -0
- package/dist/shell/top-bar-brand.js.map +1 -0
- package/dist/shell/topbar-action-menu.d.ts +21 -4
- package/dist/shell/topbar-action-menu.js +18 -2
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +56 -1
- package/dist/shell.js +2 -0
- package/dist/shell.js.map +1 -1
- package/dist/tour/tour.js +10 -4
- package/dist/tour/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +48 -1
- package/dist/wizard/use-wizard.js +4 -2
- package/dist/wizard/use-wizard.js.map +1 -1
- package/dist/wizard/wizard-context.d.ts +24 -1
- package/dist/wizard/wizard-context.js +19 -2
- package/dist/wizard/wizard-context.js.map +1 -1
- package/dist/wizard/wizard-step.d.ts +30 -5
- package/dist/wizard/wizard-step.js +34 -3
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard.d.ts +50 -3
- package/package.json +6 -6
- package/src/chart.ts +4 -0
- package/src/components/account-settings-labels.ts +190 -0
- package/src/components/account-settings.tsx +110 -63
- package/src/components/amount-input.tsx +109 -10
- package/src/components/authed-image.tsx +190 -0
- package/src/components/breadcrumbs.tsx +8 -2
- package/src/components/bulk-action-bar.tsx +16 -3
- package/src/components/button-group.tsx +7 -2
- package/src/components/calendar-heatmap.tsx +105 -10
- package/src/components/chart.tsx +19 -8
- package/src/components/chip.tsx +14 -4
- package/src/components/choice-card.tsx +136 -25
- package/src/components/combobox-core.tsx +33 -9
- package/src/components/combobox.tsx +33 -9
- package/src/components/copy-button.tsx +3 -2
- package/src/components/data-table-cells.tsx +119 -0
- package/src/components/data-table-filter-popover.tsx +13 -5
- package/src/components/data-table-filters.ts +77 -0
- package/src/components/data-table-labels.ts +23 -0
- package/src/components/data-table.tsx +230 -13
- package/src/components/date-picker.tsx +19 -3
- package/src/components/description-list.tsx +52 -3
- package/src/components/entity-combobox.tsx +25 -7
- package/src/components/error-boundary.tsx +640 -0
- package/src/components/field-sync.tsx +48 -40
- package/src/components/field.tsx +56 -5
- package/src/components/floating-panel.tsx +20 -7
- package/src/components/form-actions.tsx +191 -0
- package/src/components/full-bleed-dialog.tsx +4 -0
- package/src/components/hover-menu.tsx +26 -17
- package/src/components/image-grid.tsx +181 -0
- package/src/components/lightbox.tsx +374 -0
- package/src/components/line-items.tsx +385 -0
- package/src/components/list.tsx +82 -19
- package/src/components/loading-state.tsx +47 -0
- package/src/components/menu-item.tsx +7 -2
- package/src/components/mini-calendar.tsx +72 -3
- package/src/components/modal.tsx +65 -3
- package/src/components/month-picker.tsx +181 -26
- package/src/components/multi-entity-combobox.tsx +27 -7
- package/src/components/nav-pills.tsx +8 -1
- package/src/components/number-field.tsx +15 -10
- package/src/components/number-input.tsx +17 -1
- package/src/components/numpad-sheet.tsx +6 -1
- package/src/components/page-header.tsx +42 -5
- package/src/components/passkeys-setting.tsx +331 -0
- package/src/components/picker-sheet.tsx +10 -1
- package/src/components/pie-chart-labels.ts +32 -0
- package/src/components/pie-chart.tsx +479 -0
- package/src/components/popover.tsx +3 -0
- package/src/components/progress-bar.tsx +129 -19
- package/src/components/qr-code.tsx +83 -0
- package/src/components/search-field.tsx +20 -4
- package/src/components/signed-amount.tsx +295 -0
- package/src/components/skeleton.tsx +21 -3
- package/src/components/stat-tile.tsx +11 -3
- package/src/components/swipeable-row.tsx +7 -7
- package/src/components/table.tsx +102 -13
- package/src/components/text-link.tsx +356 -0
- package/src/components/text.tsx +46 -2
- package/src/components/toggle-group.tsx +93 -20
- package/src/components/toggle-legend.tsx +108 -2
- package/src/components/tooltip.tsx +79 -8
- package/src/components/ui.tsx +707 -49
- package/src/components/use-table-state.ts +265 -33
- package/src/data-table.ts +10 -0
- package/src/feedback/feedback-attachment.tsx +10 -7
- package/src/feedback/feedback-dialog.tsx +49 -7
- package/src/feedback/feedback-inbox.tsx +7 -0
- package/src/feedback/feedback-thread.tsx +510 -0
- package/src/feedback.ts +1 -0
- package/src/hooks/use-authed-src.ts +161 -0
- package/src/hooks/use-hotkey.ts +172 -0
- package/src/hooks/use-search-param-state.ts +187 -0
- package/src/i18n/defaults.ts +30 -0
- package/src/i18n/kit-labels.tsx +118 -8
- package/src/i18n/locales/de.ts +161 -0
- package/src/i18n/locales/es.ts +158 -0
- package/src/i18n/locales/fr.ts +161 -0
- package/src/i18n/locales/hu.ts +159 -0
- package/src/i18n/locales/it.ts +159 -0
- package/src/i18n/locales/zh.ts +158 -0
- package/src/index.ts +59 -0
- package/src/lib/format.ts +348 -0
- package/src/lib/qr-encode.ts +420 -0
- package/src/rhf/fields.tsx +1135 -0
- package/src/rhf/line-items.tsx +130 -0
- package/src/rhf.ts +6 -0
- package/src/search/command-palette.tsx +29 -19
- package/src/shell/app-shell.tsx +153 -3
- package/src/shell/auth-layout.tsx +190 -0
- package/src/shell/top-bar-brand.tsx +76 -0
- package/src/shell/topbar-action-menu.tsx +32 -4
- package/src/shell.ts +2 -0
- package/src/tour/tour.tsx +16 -5
- package/src/wizard/use-wizard.ts +8 -4
- package/src/wizard/wizard-context.tsx +41 -1
- package/src/wizard/wizard-step.tsx +75 -6
- package/tokens.css +12 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-authed-src.ts"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from \"react\";\n\n/**\n * Fetch a file with the app's own credentials and hand back an object URL for it.\n *\n * A plain `<img src=\"/api/v1/…\">` cannot carry a Bearer token, so the browser gets a\n * 401 and the image — and any \"open it\" link built on the same path — fails. Both apps\n * solved this once each, by hand: kastlan's `shared/components/authed-image.tsx` (ported\n * from keksdose) and its `useDocumentBlobUrl` for floor plans. This is that code, once,\n * with the two things neither copy did: a loading/error state a caller can render, and\n * an abort when the URL changes mid-flight (a stale response used to overwrite the new\n * one's object URL — and leak the old one, since nothing revoked it).\n *\n * The kit does no auth of its own: the caller hands over a {@link AuthedFetcher} — its\n * axios client, its `fetch` with the header — and the kit only manages the blob's life:\n *\n * - created when the bytes arrive,\n * - revoked when the URL changes, the fetcher reports an error, or the component\n * unmounts — so a long gallery session does not accumulate blobs,\n * - never exposed as a token-bearing URL: the object URL is `blob:` and local.\n */\n\n/**\n * The app's authenticated GET. Resolve to the file's bytes: a `Blob` (axios with\n * `responseType: \"blob\"`), or a `Response` (plain `fetch`), whose `ok` is checked here.\n *\n * Honour `signal` if you can — a thumbnail scrolled past, or a lightbox paged on, then\n * stops downloading. Ignoring it is safe; the result of a superseded call is discarded\n * either way.\n */\nexport type AuthedFetcher = (url: string, init: { signal: AbortSignal }) => Promise<Blob | Response>;\n\n/** `idle`: no URL. `loading`: the fetch is in flight. `ready`: `src` is usable.\n * `error`: the fetch failed (see `error`). */\nexport type AuthedSrcStatus = \"idle\" | \"loading\" | \"ready\" | \"error\";\n\nexport interface UseAuthedSrcOptions {\n /**\n * How to fetch. Left out (or `null`), the URL is used as it is — `src` is the URL and\n * the status `ready` at once — so a component that takes an OPTIONAL fetcher (the\n * image grid, the lightbox) has one code path for public and protected images.\n */\n fetcher?: AuthedFetcher | null;\n /** `false` holds the fetch — a lightbox slide that is not on screen. Default `true`. */\n enabled?: boolean;\n}\n\nexport interface UseAuthedSrcResult {\n /** The object URL (or, without a fetcher, the URL itself); `null` until ready. */\n src: string | null;\n status: AuthedSrcStatus;\n /** What the fetcher threw, when `status` is `error`. */\n error: unknown;\n /** The blob's MIME type, once fetched (`\"\"` when the server sent none). `undefined`\n * without a fetcher — nothing was fetched to ask. Lets a caller that does not know\n * whether a URL is an image or a PDF find out. */\n type: string | undefined;\n /** Fetch again — after an `error`, or to pick up a changed file at the same URL. */\n retry: () => void;\n}\n\ninterface State {\n /** Which request this state belongs to — see the effect. */\n key: string | null;\n src: string | null;\n status: AuthedSrcStatus;\n error: unknown;\n type: string | undefined;\n}\n\nasync function toBlob(res: Blob | Response): Promise<Blob> {\n if (typeof Response !== \"undefined\" && res instanceof Response) {\n if (!res.ok) throw new Error(`HTTP ${res.status}`);\n return res.blob();\n }\n return res as Blob;\n}\n\n/**\n * `useAuthedSrc(url, { fetcher })` — see the module note.\n *\n * ```tsx\n * const fetcher: AuthedFetcher = (url, { signal }) =>\n * apiClient.get(url, { responseType: \"blob\", signal }).then((r) => r.data);\n * const { src, status } = useAuthedSrc(photo.file_path, { fetcher });\n * ```\n *\n * The fetcher is read through a ref, so an inline arrow does not refetch on every\n * render; a change of `url` (or `retry`) does.\n */\nexport function useAuthedSrc(\n url: string | null | undefined,\n { fetcher, enabled = true }: UseAuthedSrcOptions = {},\n): UseAuthedSrcResult {\n const fetcherRef = useRef(fetcher);\n useEffect(() => {\n fetcherRef.current = fetcher;\n });\n const hasFetcher = !!fetcher;\n const [attempt, setAttempt] = useState(0);\n const key = url && enabled && hasFetcher ? `${attempt}|${url}` : null;\n const [state, setState] = useState<State>({\n key: null,\n src: null,\n status: \"idle\",\n error: undefined,\n type: undefined,\n });\n\n useEffect(() => {\n const fetchFn = fetcherRef.current;\n if (!key || !url || !fetchFn) return;\n const controller = new AbortController();\n let created: string | null = null;\n let active = true;\n // Settled: the response is in (or failed). Aborting then would signal a request\n // that is long over — a fetcher that listens for `abort` (to log, to cancel a\n // retry it scheduled, to count cancellations) would see a cancellation that\n // never happened on every URL change and unmount.\n let settled = false;\n // No \"loading\" state is set here: a key the state does not describe yet already\n // reads as loading (see the end of the hook).\n fetchFn(url, { signal: controller.signal })\n .then(toBlob)\n .then((blob) => {\n settled = true;\n if (!active) return;\n created = URL.createObjectURL(blob);\n setState({ key, src: created, status: \"ready\", error: undefined, type: blob.type });\n })\n .catch((error: unknown) => {\n settled = true;\n if (!active) return;\n setState({ key, src: null, status: \"error\", error, type: undefined });\n });\n return () => {\n // `active` first: an in-flight response that lands after this must neither set\n // state on an unmounted component nor create a blob nobody will revoke.\n active = false;\n // Only a request still in flight is aborted; `active` above is the stale-response\n // guard either way.\n if (!settled) controller.abort();\n if (created) URL.revokeObjectURL(created);\n };\n }, [key, url]);\n\n const retry = useCallback(() => setAttempt((n) => n + 1), []);\n\n if (!url || !enabled) {\n return { src: null, status: \"idle\", error: undefined, type: undefined, retry };\n }\n if (!hasFetcher) {\n return { src: url, status: \"ready\", error: undefined, type: undefined, retry };\n }\n // Until the effect for THIS key has run, the state still describes the previous URL\n // — a render in between must not show the old picture under the new name.\n if (state.key !== key) {\n return { src: null, status: \"loading\", error: undefined, type: undefined, retry };\n }\n return { src: state.src, status: state.status, error: state.error, type: state.type, retry };\n}\n"],"mappings":";AAAA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAsEzD,eAAe,OAAO,KAAqC;AACzD,MAAI,OAAO,aAAa,eAAe,eAAe,UAAU;AAC9D,QAAI,CAAC,IAAI,GAAI,OAAM,IAAI,MAAM,QAAQ,IAAI,MAAM,EAAE;AACjD,WAAO,IAAI,KAAK;AAAA,EAClB;AACA,SAAO;AACT;AAcO,SAAS,aACd,KACA,EAAE,SAAS,UAAU,KAAK,IAAyB,CAAC,GAChC;AACpB,QAAM,aAAa,OAAO,OAAO;AACjC,YAAU,MAAM;AACd,eAAW,UAAU;AAAA,EACvB,CAAC;AACD,QAAM,aAAa,CAAC,CAAC;AACrB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAS,CAAC;AACxC,QAAM,MAAM,OAAO,WAAW,aAAa,GAAG,OAAO,IAAI,GAAG,KAAK;AACjE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgB;AAAA,IACxC,KAAK;AAAA,IACL,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR,CAAC;AAED,YAAU,MAAM;AACd,UAAM,UAAU,WAAW;AAC3B,QAAI,CAAC,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[]}
|
|
@@ -1,9 +1,56 @@
|
|
|
1
1
|
import { DragEvent, ReactElement } from 'react';
|
|
2
|
-
import { UseFilePickerOptions } from '../
|
|
3
|
-
import '../components/
|
|
2
|
+
import { aY as UseFilePickerOptions } from '../kit-labels-Mz8zZHIF.js';
|
|
3
|
+
import '../components/data-table-labels.js';
|
|
4
|
+
import '../components/mini-calendar.js';
|
|
5
|
+
import '../components/calendar-heatmap.js';
|
|
6
|
+
import '../components/popover.js';
|
|
7
|
+
import '../components/chip.js';
|
|
8
|
+
import 'lucide-react';
|
|
9
|
+
import '../components/field-sync.js';
|
|
4
10
|
import '../components/tooltip.js';
|
|
5
11
|
import './use-anchored-rect.js';
|
|
6
12
|
import '../lib/clipping.js';
|
|
13
|
+
import '../wizard/types.js';
|
|
14
|
+
import '../tour/tour.js';
|
|
15
|
+
import '../search/command-palette.js';
|
|
16
|
+
import '../search/global-search.js';
|
|
17
|
+
import '../search/search-index.js';
|
|
18
|
+
import '../components/month-picker.js';
|
|
19
|
+
import '../components/page-contents.js';
|
|
20
|
+
import '../components/series-chart-labels.js';
|
|
21
|
+
import '../components/pie-chart-labels.js';
|
|
22
|
+
import '../components/sparkline.js';
|
|
23
|
+
import '../components/stat-tile.js';
|
|
24
|
+
import '../components/signature-pad.js';
|
|
25
|
+
import '../components/password-strength.js';
|
|
26
|
+
import '../components/danger-confirm.js';
|
|
27
|
+
import '../components/swatch-picker.js';
|
|
28
|
+
import '../components/tile-radio.js';
|
|
29
|
+
import '../components/icon-picker.js';
|
|
30
|
+
import '../components/dialog-frame.js';
|
|
31
|
+
import '../components/modal.js';
|
|
32
|
+
import './use-search-param-state.js';
|
|
33
|
+
import '../components/measured-grid.js';
|
|
34
|
+
import '../feedback/feedback-attachment.js';
|
|
35
|
+
import '../feedback/feedback-dialog.js';
|
|
36
|
+
import '../feedback/feedback-thread.js';
|
|
37
|
+
import '../feedback/feedback-inbox.js';
|
|
38
|
+
import '../components/account-settings-labels.js';
|
|
39
|
+
import '../components/confirm-dialog.js';
|
|
40
|
+
import '../components/floating-panel.js';
|
|
41
|
+
import '../components/bulk-action-bar.js';
|
|
42
|
+
import '../components/list.js';
|
|
43
|
+
import '../components/breadcrumbs.js';
|
|
44
|
+
import '../components/toast.js';
|
|
45
|
+
import '../components/description-list.js';
|
|
46
|
+
import '../components/line-items.js';
|
|
47
|
+
import '../components/progress-bar.js';
|
|
48
|
+
import '../components/signed-amount.js';
|
|
49
|
+
import '../components/error-boundary.js';
|
|
50
|
+
import '../components/authed-image.js';
|
|
51
|
+
import './use-authed-src.js';
|
|
52
|
+
import '../components/image-grid.js';
|
|
53
|
+
import '../components/lightbox.js';
|
|
7
54
|
|
|
8
55
|
/**
|
|
9
56
|
* Turn ANY element into a file drop target — kastlan's ask, for the document list of
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A key combination: modifiers and one key, joined by "+", case-insensitive —
|
|
3
|
+
* `"Ctrl+Shift+F"`, `"Mod+K"`, `"Alt+ArrowUp"`, `"Escape"`, `"?"`.
|
|
4
|
+
*
|
|
5
|
+
* Modifiers: `Ctrl` (`Control`), `Meta` (`Cmd`, `Command`), `Shift`, `Alt` (`Option`),
|
|
6
|
+
* and `Mod` — Cmd on Apple platforms, Ctrl everywhere else, the one to use for an
|
|
7
|
+
* app shortcut. The key is `KeyboardEvent.key` ("f", "Enter", "ArrowUp", "/"), or a
|
|
8
|
+
* `KeyboardEvent.code` ("KeyF", "Digit1") when the physical key is what matters.
|
|
9
|
+
* Several combos: pass an array.
|
|
10
|
+
*/
|
|
11
|
+
type Hotkey = string;
|
|
12
|
+
interface UseHotkeyOptions {
|
|
13
|
+
/** Off while `false` (default `true`). */
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
/** Call `preventDefault()` on a match (default `true`): Ctrl+Shift+F must not also
|
|
16
|
+
* open the browser's own dialog. */
|
|
17
|
+
preventDefault?: boolean;
|
|
18
|
+
/** Where to listen. Default `document`. A ref, an element, or `window`. */
|
|
19
|
+
target?: EventTarget | null | {
|
|
20
|
+
current: EventTarget | null;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Fire while the focus is in a text field, select or contenteditable too. Default
|
|
24
|
+
* `false`: a shortcut must not steal the letters someone is typing. A combo with Ctrl,
|
|
25
|
+
* Meta or Alt is not typing — those still fire unless this is `"never"`.
|
|
26
|
+
*/
|
|
27
|
+
allowInInputs?: boolean | "never";
|
|
28
|
+
/** `keydown` (default) or `keyup`. */
|
|
29
|
+
event?: "keydown" | "keyup";
|
|
30
|
+
}
|
|
31
|
+
interface ParsedHotkey {
|
|
32
|
+
ctrl: boolean;
|
|
33
|
+
meta: boolean;
|
|
34
|
+
shift: boolean;
|
|
35
|
+
alt: boolean;
|
|
36
|
+
key: string;
|
|
37
|
+
}
|
|
38
|
+
/** Whether this is an Apple platform, where `Mod` means Cmd. */
|
|
39
|
+
declare function isApplePlatform(): boolean;
|
|
40
|
+
/** Parse one combo. `apple` decides what `Mod` is. Throws on an empty key. */
|
|
41
|
+
declare function parseHotkey(combo: Hotkey, apple?: boolean): ParsedHotkey;
|
|
42
|
+
/** Whether `e` is `combo` — every modifier as named (no more, no fewer), and the key. */
|
|
43
|
+
declare function matchesHotkey(e: KeyboardEvent, combo: ParsedHotkey): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Call `handler` when `combo` is pressed — kastlan's feedback button (Ctrl+Shift+F,
|
|
46
|
+
* feedback-button:60) wired it by hand, and so will every next shortcut.
|
|
47
|
+
*
|
|
48
|
+
* - `Mod` is Cmd on a Mac and Ctrl elsewhere, read once per mount.
|
|
49
|
+
* - Modifiers match EXACTLY: `"Ctrl+K"` does not fire on Ctrl+Shift+K.
|
|
50
|
+
* - Typing in a field is left alone unless `allowInInputs`, except for a combo with
|
|
51
|
+
* Ctrl / Meta / Alt, which no one types as text.
|
|
52
|
+
* - A key held down fires once, not on every repeat.
|
|
53
|
+
* - The newest `handler` is always called; changing it does not re-attach the listener.
|
|
54
|
+
*
|
|
55
|
+
* `useCommandKey` (the ⌘K palette hook) is unchanged; this is its general form.
|
|
56
|
+
*/
|
|
57
|
+
declare function useHotkey(combo: Hotkey | ReadonlyArray<Hotkey>, handler: (event: KeyboardEvent) => void, options?: UseHotkeyOptions): void;
|
|
58
|
+
|
|
59
|
+
export { type Hotkey, type ParsedHotkey, type UseHotkeyOptions, isApplePlatform, matchesHotkey, parseHotkey, useHotkey };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect, useRef } from "react";
|
|
3
|
+
function isApplePlatform() {
|
|
4
|
+
if (typeof navigator === "undefined") return false;
|
|
5
|
+
const nav = navigator;
|
|
6
|
+
return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform || nav.platform || nav.userAgent);
|
|
7
|
+
}
|
|
8
|
+
function parseHotkey(combo, apple = isApplePlatform()) {
|
|
9
|
+
const parts = combo.split("+").map((p) => p.trim()).map((p, i, all) => p === "" && i === all.length - 1 ? "+" : p).filter((p) => p !== "");
|
|
10
|
+
const out = { ctrl: false, meta: false, shift: false, alt: false, key: "" };
|
|
11
|
+
for (const part of parts) {
|
|
12
|
+
switch (part.toLowerCase()) {
|
|
13
|
+
case "ctrl":
|
|
14
|
+
case "control":
|
|
15
|
+
out.ctrl = true;
|
|
16
|
+
break;
|
|
17
|
+
case "meta":
|
|
18
|
+
case "cmd":
|
|
19
|
+
case "command":
|
|
20
|
+
out.meta = true;
|
|
21
|
+
break;
|
|
22
|
+
case "mod":
|
|
23
|
+
if (apple) out.meta = true;
|
|
24
|
+
else out.ctrl = true;
|
|
25
|
+
break;
|
|
26
|
+
case "shift":
|
|
27
|
+
out.shift = true;
|
|
28
|
+
break;
|
|
29
|
+
case "alt":
|
|
30
|
+
case "option":
|
|
31
|
+
out.alt = true;
|
|
32
|
+
break;
|
|
33
|
+
default:
|
|
34
|
+
out.key = part;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (!out.key) throw new Error(`useHotkey: "${combo}" names no key`);
|
|
38
|
+
return out;
|
|
39
|
+
}
|
|
40
|
+
const KEY_ALIASES = {
|
|
41
|
+
esc: "escape",
|
|
42
|
+
space: " ",
|
|
43
|
+
del: "delete",
|
|
44
|
+
up: "arrowup",
|
|
45
|
+
down: "arrowdown",
|
|
46
|
+
left: "arrowleft",
|
|
47
|
+
right: "arrowright"
|
|
48
|
+
};
|
|
49
|
+
function matchesHotkey(e, combo) {
|
|
50
|
+
if (e.ctrlKey !== combo.ctrl || e.metaKey !== combo.meta || e.altKey !== combo.alt) return false;
|
|
51
|
+
const want = KEY_ALIASES[combo.key.toLowerCase()] ?? combo.key.toLowerCase();
|
|
52
|
+
const key = (e.key ?? "").toLowerCase();
|
|
53
|
+
const code = (e.code ?? "").toLowerCase();
|
|
54
|
+
const keyMatches = key === want || code === want;
|
|
55
|
+
if (!keyMatches) return false;
|
|
56
|
+
const symbol = want.length === 1 && !/[a-z0-9]/.test(want);
|
|
57
|
+
return symbol && !combo.shift ? true : e.shiftKey === combo.shift;
|
|
58
|
+
}
|
|
59
|
+
function isTypingTarget(target) {
|
|
60
|
+
if (!(target instanceof HTMLElement)) return false;
|
|
61
|
+
if (target.isContentEditable) return true;
|
|
62
|
+
if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return true;
|
|
63
|
+
if (target instanceof HTMLInputElement) {
|
|
64
|
+
return !["button", "checkbox", "radio", "submit", "reset", "range", "color", "file", "image"].includes(target.type);
|
|
65
|
+
}
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
function useHotkey(combo, handler, options = {}) {
|
|
69
|
+
const { enabled = true, preventDefault = true, target, allowInInputs = false, event = "keydown" } = options;
|
|
70
|
+
const handlerRef = useRef(handler);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
handlerRef.current = handler;
|
|
73
|
+
});
|
|
74
|
+
const key = typeof combo === "string" ? combo : combo.join("\0");
|
|
75
|
+
const targetEl = target && "current" in target ? void 0 : target;
|
|
76
|
+
const targetRef = target && "current" in target ? target : void 0;
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!enabled) return;
|
|
79
|
+
const node = targetRef?.current ?? targetEl ?? (typeof document === "undefined" ? null : document);
|
|
80
|
+
if (!node) return;
|
|
81
|
+
const apple = isApplePlatform();
|
|
82
|
+
const parsed = key.split("\0").map((c) => parseHotkey(c, apple));
|
|
83
|
+
const listener = (raw) => {
|
|
84
|
+
const e = raw;
|
|
85
|
+
if (e.repeat) return;
|
|
86
|
+
const hit = parsed.find((p) => matchesHotkey(e, p));
|
|
87
|
+
if (!hit) return;
|
|
88
|
+
if (allowInInputs !== true && isTypingTarget(e.target)) {
|
|
89
|
+
const chorded = hit.ctrl || hit.meta || hit.alt;
|
|
90
|
+
if (allowInInputs === "never" || !chorded) return;
|
|
91
|
+
}
|
|
92
|
+
if (preventDefault) e.preventDefault();
|
|
93
|
+
handlerRef.current(e);
|
|
94
|
+
};
|
|
95
|
+
node.addEventListener(event, listener);
|
|
96
|
+
return () => node.removeEventListener(event, listener);
|
|
97
|
+
}, [key, enabled, preventDefault, allowInInputs, event, targetEl, targetRef]);
|
|
98
|
+
}
|
|
99
|
+
export {
|
|
100
|
+
isApplePlatform,
|
|
101
|
+
matchesHotkey,
|
|
102
|
+
parseHotkey,
|
|
103
|
+
useHotkey
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=use-hotkey.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-hotkey.ts"],"sourcesContent":["import { useEffect, useRef } from \"react\";\n\n/**\n * A key combination: modifiers and one key, joined by \"+\", case-insensitive —\n * `\"Ctrl+Shift+F\"`, `\"Mod+K\"`, `\"Alt+ArrowUp\"`, `\"Escape\"`, `\"?\"`.\n *\n * Modifiers: `Ctrl` (`Control`), `Meta` (`Cmd`, `Command`), `Shift`, `Alt` (`Option`),\n * and `Mod` — Cmd on Apple platforms, Ctrl everywhere else, the one to use for an\n * app shortcut. The key is `KeyboardEvent.key` (\"f\", \"Enter\", \"ArrowUp\", \"/\"), or a\n * `KeyboardEvent.code` (\"KeyF\", \"Digit1\") when the physical key is what matters.\n * Several combos: pass an array.\n */\nexport type Hotkey = string;\n\nexport interface UseHotkeyOptions {\n /** Off while `false` (default `true`). */\n enabled?: boolean;\n /** Call `preventDefault()` on a match (default `true`): Ctrl+Shift+F must not also\n * open the browser's own dialog. */\n preventDefault?: boolean;\n /** Where to listen. Default `document`. A ref, an element, or `window`. */\n target?: EventTarget | null | { current: EventTarget | null };\n /**\n * Fire while the focus is in a text field, select or contenteditable too. Default\n * `false`: a shortcut must not steal the letters someone is typing. A combo with Ctrl,\n * Meta or Alt is not typing — those still fire unless this is `\"never\"`.\n */\n allowInInputs?: boolean | \"never\";\n /** `keydown` (default) or `keyup`. */\n event?: \"keydown\" | \"keyup\";\n}\n\nexport interface ParsedHotkey {\n ctrl: boolean;\n meta: boolean;\n shift: boolean;\n alt: boolean;\n key: string;\n}\n\n/** Whether this is an Apple platform, where `Mod` means Cmd. */\nexport function isApplePlatform(): boolean {\n if (typeof navigator === \"undefined\") return false;\n const nav = navigator as Navigator & { userAgentData?: { platform?: string } };\n return /mac|iphone|ipad|ipod/i.test(nav.userAgentData?.platform || nav.platform || nav.userAgent);\n}\n\n/** Parse one combo. `apple` decides what `Mod` is. Throws on an empty key. */\nexport function parseHotkey(combo: Hotkey, apple = isApplePlatform()): ParsedHotkey {\n const parts = combo\n .split(\"+\")\n .map((p) => p.trim())\n // \"Ctrl++\" is Ctrl and \"+\": an empty part after a \"+\" is the plus key itself.\n .map((p, i, all) => (p === \"\" && i === all.length - 1 ? \"+\" : p))\n .filter((p) => p !== \"\");\n const out: ParsedHotkey = { ctrl: false, meta: false, shift: false, alt: false, key: \"\" };\n for (const part of parts) {\n switch (part.toLowerCase()) {\n case \"ctrl\":\n case \"control\":\n out.ctrl = true;\n break;\n case \"meta\":\n case \"cmd\":\n case \"command\":\n out.meta = true;\n break;\n case \"mod\":\n if (apple) out.meta = true;\n else out.ctrl = true;\n break;\n case \"shift\":\n out.shift = true;\n break;\n case \"alt\":\n case \"option\":\n out.alt = true;\n break;\n default:\n out.key = part;\n }\n }\n if (!out.key) throw new Error(`useHotkey: \"${combo}\" names no key`);\n return out;\n}\n\nconst KEY_ALIASES: Record<string, string> = {\n esc: \"escape\",\n space: \" \",\n del: \"delete\",\n up: \"arrowup\",\n down: \"arrowdown\",\n left: \"arrowleft\",\n right: \"arrowright\",\n};\n\n/** Whether `e` is `combo` — every modifier as named (no more, no fewer), and the key. */\nexport function matchesHotkey(e: KeyboardEvent, combo: ParsedHotkey): boolean {\n if (e.ctrlKey !== combo.ctrl || e.metaKey !== combo.meta || e.altKey !== combo.alt) return false;\n const want = KEY_ALIASES[combo.key.toLowerCase()] ?? combo.key.toLowerCase();\n const key = (e.key ?? \"\").toLowerCase();\n const code = (e.code ?? \"\").toLowerCase();\n const keyMatches = key === want || code === want;\n if (!keyMatches) return false;\n // Shift must match exactly for a letter or a named key; for a symbol it is how the\n // symbol is typed (\"?\" is Shift+/ on a US layout, a plain key on others), so an\n // unnamed Shift is not held against it.\n const symbol = want.length === 1 && !/[a-z0-9]/.test(want);\n return symbol && !combo.shift ? true : e.shiftKey === combo.shift;\n}\n\n/** Is the focus somewhere that takes typed characters? */\nfunction isTypingTarget(target: EventTarget | null): boolean {\n if (!(target instanceof HTMLElement)) return false;\n if (target.isContentEditable) return true;\n if (target instanceof HTMLTextAreaElement || target instanceof HTMLSelectElement) return true;\n if (target instanceof HTMLInputElement) {\n return ![\"button\", \"checkbox\", \"radio\", \"submit\", \"reset\", \"range\", \"color\", \"file\", \"image\"].includes(target.type);\n }\n return false;\n}\n\n/**\n * Call `handler` when `combo` is pressed — kastlan's feedback button (Ctrl+Shift+F,\n * feedback-button:60) wired it by hand, and so will every next shortcut.\n *\n * - `Mod` is Cmd on a Mac and Ctrl elsewhere, read once per mount.\n * - Modifiers match EXACTLY: `\"Ctrl+K\"` does not fire on Ctrl+Shift+K.\n * - Typing in a field is left alone unless `allowInInputs`, except for a combo with\n * Ctrl / Meta / Alt, which no one types as text.\n * - A key held down fires once, not on every repeat.\n * - The newest `handler` is always called; changing it does not re-attach the listener.\n *\n * `useCommandKey` (the ⌘K palette hook) is unchanged; this is its general form.\n */\nexport function useHotkey(\n combo: Hotkey | ReadonlyArray<Hotkey>,\n handler: (event: KeyboardEvent) => void,\n options: UseHotkeyOptions = {},\n): void {\n const { enabled = true, preventDefault = true, target, allowInInputs = false, event = \"keydown\" } = options;\n const handlerRef = useRef(handler);\n useEffect(() => {\n handlerRef.current = handler;\n });\n const key = typeof combo === \"string\" ? combo : combo.join(\"\\u0000\");\n const targetEl = target && \"current\" in target ? undefined : target;\n const targetRef = target && \"current\" in target ? target : undefined;\n\n useEffect(() => {\n if (!enabled) return;\n const node: EventTarget | null =\n targetRef?.current ?? targetEl ?? (typeof document === \"undefined\" ? null : document);\n if (!node) return;\n const apple = isApplePlatform();\n const parsed = key.split(\"\\u0000\").map((c) => parseHotkey(c, apple));\n const listener = (raw: Event) => {\n const e = raw as KeyboardEvent;\n if (e.repeat) return;\n const hit = parsed.find((p) => matchesHotkey(e, p));\n if (!hit) return;\n if (allowInInputs !== true && isTypingTarget(e.target)) {\n const chorded = hit.ctrl || hit.meta || hit.alt;\n if (allowInInputs === \"never\" || !chorded) return;\n }\n if (preventDefault) e.preventDefault();\n handlerRef.current(e);\n };\n node.addEventListener(event, listener);\n return () => node.removeEventListener(event, listener);\n }, [key, enabled, preventDefault, allowInInputs, event, targetEl, targetRef]);\n}\n"],"mappings":";AAAA,SAAS,WAAW,cAAc;AAyC3B,SAAS,kBAA2B;AACzC,MAAI,OAAO,cAAc,YAAa,QAAO;AAC7C,QAAM,MAAM;AACZ,SAAO,wBAAwB,KAAK,IAAI,eAAe,YAAY,IAAI,YAAY,IAAI,SAAS;AAClG;AAGO,SAAS,YAAY,OAAe,QAAQ,gBAAgB,GAAiB;AAClF,QAAM,QAAQ,MACX,MAAM,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BAAkB,QAAQ,eAAe,EAAE,MAAM,GAAG;AACtD,cAAM,UAAU,IAAI,QAAQ,IAAI,QAAQ,IAAI;AAC5C,YAAI,kBAAkB,WAAW,CAAC,QAAS;AAAA,MAC7C;AACA,UAAI,eAAgB,GAAE,eAAe;AACrC,iBAAW,QAAQ,CAAC;AAAA,IACtB;AACA,SAAK,iBAAiB,OAAO,QAAQ;AACrC,WAAO,MAAM,KAAK,oBAAoB,OAAO,QAAQ;AAAA,EACvD,GAAG,CAAC,KAAK,SAAS,gBAAgB,eAAe,OAAO,UAAU,SAAS,CAAC;AAC9E;","names":[]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
type Updater<T> = T | ((prev: T) => T);
|
|
2
|
+
interface SearchParamStateOptions<T> {
|
|
3
|
+
/**
|
|
4
|
+
* The value of a param that IS present. Return `undefined` (or throw) for a value
|
|
5
|
+
* that does not parse — a hand-edited or stale link — and the default is used.
|
|
6
|
+
* Default: the raw string.
|
|
7
|
+
*/
|
|
8
|
+
parse?: (raw: string) => T | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* The param for a value, or `null` to remove it. Default: `String(value)`, and
|
|
11
|
+
* `null` for `null` / `undefined`. A value that serialises the same as the default
|
|
12
|
+
* removes the param too, so the default is always the clean URL.
|
|
13
|
+
*/
|
|
14
|
+
serialize?: (value: T) => string | null;
|
|
15
|
+
/** Shorthand for `history: "replace"`. */
|
|
16
|
+
replace?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* What a change does to the browser history:
|
|
19
|
+
* - `"push"` (default): a new entry, so Back undoes the change.
|
|
20
|
+
* - `"replace"`: the current entry is rewritten — a tab, a sort, a view toggle,
|
|
21
|
+
* which are not steps anyone wants Back to walk through.
|
|
22
|
+
* - `"replace-on-clear"`: push when a value is set, replace when it is cleared (the
|
|
23
|
+
* "open a form, close it" pattern).
|
|
24
|
+
*/
|
|
25
|
+
history?: "push" | "replace" | "replace-on-clear";
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* One URL search param as React state: `const [view, setView] = useSearchParamState("view", "list")`.
|
|
29
|
+
*
|
|
30
|
+
* Replaces the hand-rolled `setParams((prev) => { const p = new URLSearchParams(prev);
|
|
31
|
+
* …set/delete…; return p })` blocks that keksdose had in a dozen pages and kastlan ported
|
|
32
|
+
* as its own copy of this hook (shared/hooks/use-search-param-state.ts, both apps). The
|
|
33
|
+
* kit's version takes the DEFAULT as an argument rather than inside `parse`, so the
|
|
34
|
+
* two rules that follow from it cannot be forgotten at a call site:
|
|
35
|
+
*
|
|
36
|
+
* * an absent or unparseable param reads as the default, and
|
|
37
|
+
* * setting the default removes the param — the default view is the clean URL.
|
|
38
|
+
*
|
|
39
|
+
* Every other param in the query string is left as it is. Two updates in one tick do
|
|
40
|
+
* not compose — react-router resolves each against the params of the last render.
|
|
41
|
+
* Requires a react-router Router.
|
|
42
|
+
*/
|
|
43
|
+
declare function useSearchParamState<T = string>(key: string, defaultValue: T, options?: SearchParamStateOptions<T>): [T, (next: Updater<T>) => void];
|
|
44
|
+
/**
|
|
45
|
+
* The active tab in `?tab=` (or `key`), with the default tab as the clean URL, for the
|
|
46
|
+
* kit's `Tabs`:
|
|
47
|
+
*
|
|
48
|
+
* const [tab, setTab] = useTabParam("overview", { tabs: ["overview", "history"] });
|
|
49
|
+
* <Tabs tabs={…} active={tab} onChange={setTab} />
|
|
50
|
+
*
|
|
51
|
+
* Switching tabs REPLACES the history entry — a tab is a view of this page, not a
|
|
52
|
+
* place Back should step through. `tabs`, when given, turns a param naming no tab (a
|
|
53
|
+
* renamed tab, an old link) into the default rather than into a blank panel.
|
|
54
|
+
* kastlan's use-tab-param.ts, with the validation it did not have.
|
|
55
|
+
*/
|
|
56
|
+
declare function useTabParam<T extends string>(defaultTab: T, options?: {
|
|
57
|
+
key?: string;
|
|
58
|
+
tabs?: readonly T[];
|
|
59
|
+
}): [T, (tab: T) => void];
|
|
60
|
+
/** Where a dialog's open state lives: a param's presence (`"edit"` → `?edit=1`), or one
|
|
61
|
+
* value of a shared param (`{ key: "dialog", value: "create-lease" }`). */
|
|
62
|
+
type DialogParam = string | {
|
|
63
|
+
key: string;
|
|
64
|
+
value: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* A dialog's open state in the URL, for `Modal`'s `urlParam` and anything else that
|
|
68
|
+
* opens one: `const [open, setOpen] = useDialogParam({ key: "dialog", value: "create" })`.
|
|
69
|
+
*
|
|
70
|
+
* * **Opening pushes** an entry, so the platform Back gesture closes the dialog — by
|
|
71
|
+
* leaving the entry — and Forward opens it again, like any other step.
|
|
72
|
+
* * **Closing goes back** over that entry when this hook pushed it, so a closed dialog
|
|
73
|
+
* leaves no dead entry behind. A dialog that arrived OPEN (a deep link, a reload, a
|
|
74
|
+
* plain `<Link>` to it) has nothing of ours to go back over, and its close removes the
|
|
75
|
+
* param in place instead — Back from there leaves the page, as it should.
|
|
76
|
+
*
|
|
77
|
+
* That is why it is not `useSearchParamState`: going back is the only close that
|
|
78
|
+
* leaves the history as it was before the dialog, and only the opener knows whether it
|
|
79
|
+
* may.
|
|
80
|
+
*/
|
|
81
|
+
declare function useDialogParam(param: DialogParam): [boolean, (open: boolean) => void];
|
|
82
|
+
|
|
83
|
+
export { type DialogParam, type SearchParamStateOptions, useDialogParam, useSearchParamState, useTabParam };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLocation, useNavigate, useSearchParams } from "react-router";
|
|
3
|
+
const defaultSerialize = (value) => value === null || value === void 0 ? null : String(value);
|
|
4
|
+
function carriedState(state) {
|
|
5
|
+
return state && typeof state === "object" ? state : void 0;
|
|
6
|
+
}
|
|
7
|
+
function useSearchParamState(key, defaultValue, options = {}) {
|
|
8
|
+
const { parse, serialize = defaultSerialize } = options;
|
|
9
|
+
const history = options.history ?? (options.replace ? "replace" : "push");
|
|
10
|
+
const [params, setParams] = useSearchParams();
|
|
11
|
+
const location = useLocation();
|
|
12
|
+
const read = (raw) => {
|
|
13
|
+
if (raw === null) return defaultValue;
|
|
14
|
+
if (!parse) return raw;
|
|
15
|
+
try {
|
|
16
|
+
const parsed = parse(raw);
|
|
17
|
+
return parsed === void 0 ? defaultValue : parsed;
|
|
18
|
+
} catch {
|
|
19
|
+
return defaultValue;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const value = read(params.get(key));
|
|
23
|
+
const defaultSerialized = serialize(defaultValue);
|
|
24
|
+
const toParam = (v) => {
|
|
25
|
+
const s = serialize(v);
|
|
26
|
+
return s === defaultSerialized ? null : s;
|
|
27
|
+
};
|
|
28
|
+
const setValue = (next) => {
|
|
29
|
+
const preview = typeof next === "function" ? next(value) : next;
|
|
30
|
+
const replace = history === "replace" || history === "replace-on-clear" && toParam(preview) === null;
|
|
31
|
+
setParams(
|
|
32
|
+
(prev) => {
|
|
33
|
+
const p = new URLSearchParams(prev);
|
|
34
|
+
const resolved = typeof next === "function" ? next(read(p.get(key))) : next;
|
|
35
|
+
const serialized = toParam(resolved);
|
|
36
|
+
if (serialized === null) p.delete(key);
|
|
37
|
+
else p.set(key, serialized);
|
|
38
|
+
return p;
|
|
39
|
+
},
|
|
40
|
+
replace ? { replace, state: carriedState(location.state) } : void 0
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
return [value, setValue];
|
|
44
|
+
}
|
|
45
|
+
function useTabParam(defaultTab, options = {}) {
|
|
46
|
+
const { key = "tab", tabs } = options;
|
|
47
|
+
return useSearchParamState(key, defaultTab, {
|
|
48
|
+
parse: (raw) => !tabs || tabs.includes(raw) ? raw : void 0,
|
|
49
|
+
history: "replace"
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
const OPENED_BY_KIT = "__uiKitDialogParam";
|
|
53
|
+
function useDialogParam(param) {
|
|
54
|
+
const { key, value } = typeof param === "string" ? { key: param, value: "1" } : param;
|
|
55
|
+
const [params, setParams] = useSearchParams();
|
|
56
|
+
const location = useLocation();
|
|
57
|
+
const navigate = useNavigate();
|
|
58
|
+
const open = typeof param === "string" ? params.has(key) : params.get(key) === value;
|
|
59
|
+
const mark = `${key}=${value}`;
|
|
60
|
+
const setOpen = (next) => {
|
|
61
|
+
if (next === open) return;
|
|
62
|
+
const state = carriedState(location.state);
|
|
63
|
+
if (next) {
|
|
64
|
+
setParams(
|
|
65
|
+
(prev) => {
|
|
66
|
+
const p = new URLSearchParams(prev);
|
|
67
|
+
p.set(key, value);
|
|
68
|
+
return p;
|
|
69
|
+
},
|
|
70
|
+
{ state: { ...state, [OPENED_BY_KIT]: mark } }
|
|
71
|
+
);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (state?.[OPENED_BY_KIT] === mark) {
|
|
75
|
+
void navigate(-1);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
setParams(
|
|
79
|
+
(prev) => {
|
|
80
|
+
const p = new URLSearchParams(prev);
|
|
81
|
+
p.delete(key);
|
|
82
|
+
return p;
|
|
83
|
+
},
|
|
84
|
+
{ replace: true, state }
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
return [open, setOpen];
|
|
88
|
+
}
|
|
89
|
+
export {
|
|
90
|
+
useDialogParam,
|
|
91
|
+
useSearchParamState,
|
|
92
|
+
useTabParam
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=use-search-param-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-search-param-state.ts"],"sourcesContent":["import { useLocation, useNavigate, useSearchParams } from \"react-router\";\n\ntype Updater<T> = T | ((prev: T) => T);\n\nexport interface SearchParamStateOptions<T> {\n /**\n * The value of a param that IS present. Return `undefined` (or throw) for a value\n * that does not parse — a hand-edited or stale link — and the default is used.\n * Default: the raw string.\n */\n parse?: (raw: string) => T | undefined;\n /**\n * The param for a value, or `null` to remove it. Default: `String(value)`, and\n * `null` for `null` / `undefined`. A value that serialises the same as the default\n * removes the param too, so the default is always the clean URL.\n */\n serialize?: (value: T) => string | null;\n /** Shorthand for `history: \"replace\"`. */\n replace?: boolean;\n /**\n * What a change does to the browser history:\n * - `\"push\"` (default): a new entry, so Back undoes the change.\n * - `\"replace\"`: the current entry is rewritten — a tab, a sort, a view toggle,\n * which are not steps anyone wants Back to walk through.\n * - `\"replace-on-clear\"`: push when a value is set, replace when it is cleared (the\n * \"open a form, close it\" pattern).\n */\n history?: \"push\" | \"replace\" | \"replace-on-clear\";\n}\n\nconst defaultSerialize = (value: unknown): string | null =>\n value === null || value === undefined ? null : String(value);\n\n/** The route state of the current entry, carried over a `replace` so a query rewrite\n * does not drop what a navigation put there (a dialog's opener mark, below). */\nfunction carriedState(state: unknown): Record<string, unknown> | undefined {\n return state && typeof state === \"object\" ? (state as Record<string, unknown>) : undefined;\n}\n\n/**\n * One URL search param as React state: `const [view, setView] = useSearchParamState(\"view\", \"list\")`.\n *\n * Replaces the hand-rolled `setParams((prev) => { const p = new URLSearchParams(prev);\n * …set/delete…; return p })` blocks that keksdose had in a dozen pages and kastlan ported\n * as its own copy of this hook (shared/hooks/use-search-param-state.ts, both apps). The\n * kit's version takes the DEFAULT as an argument rather than inside `parse`, so the\n * two rules that follow from it cannot be forgotten at a call site:\n *\n * * an absent or unparseable param reads as the default, and\n * * setting the default removes the param — the default view is the clean URL.\n *\n * Every other param in the query string is left as it is. Two updates in one tick do\n * not compose — react-router resolves each against the params of the last render.\n * Requires a react-router Router.\n */\nexport function useSearchParamState<T = string>(\n key: string,\n defaultValue: T,\n options: SearchParamStateOptions<T> = {},\n): [T, (next: Updater<T>) => void] {\n const { parse, serialize = defaultSerialize as (value: T) => string | null } = options;\n const history = options.history ?? (options.replace ? \"replace\" : \"push\");\n const [params, setParams] = useSearchParams();\n const location = useLocation();\n\n const read = (raw: string | null): T => {\n if (raw === null) return defaultValue;\n if (!parse) return raw as unknown as T;\n try {\n const parsed = parse(raw);\n return parsed === undefined ? defaultValue : parsed;\n } catch {\n return defaultValue;\n }\n };\n const value = read(params.get(key));\n const defaultSerialized = serialize(defaultValue);\n const toParam = (v: T): string | null => {\n const s = serialize(v);\n return s === defaultSerialized ? null : s;\n };\n\n const setValue = (next: Updater<T>) => {\n // Resolved against the rendered value only to choose the history mode; the write\n // resolves again inside react-router's updater, against the params it hands over.\n const preview = typeof next === \"function\" ? (next as (prev: T) => T)(value) : next;\n const replace = history === \"replace\" || (history === \"replace-on-clear\" && toParam(preview) === null);\n setParams(\n (prev) => {\n const p = new URLSearchParams(prev);\n const resolved = typeof next === \"function\" ? (next as (prev: T) => T)(read(p.get(key))) : next;\n const serialized = toParam(resolved);\n if (serialized === null) p.delete(key);\n else p.set(key, serialized);\n return p;\n },\n replace ? { replace, state: carriedState(location.state) } : undefined,\n );\n };\n\n return [value, setValue];\n}\n\n/**\n * The active tab in `?tab=` (or `key`), with the default tab as the clean URL, for the\n * kit's `Tabs`:\n *\n * const [tab, setTab] = useTabParam(\"overview\", { tabs: [\"overview\", \"history\"] });\n * <Tabs tabs={…} active={tab} onChange={setTab} />\n *\n * Switching tabs REPLACES the history entry — a tab is a view of this page, not a\n * place Back should step through. `tabs`, when given, turns a param naming no tab (a\n * renamed tab, an old link) into the default rather than into a blank panel.\n * kastlan's use-tab-param.ts, with the validation it did not have.\n */\nexport function useTabParam<T extends string>(\n defaultTab: T,\n options: { key?: string; tabs?: readonly T[] } = {},\n): [T, (tab: T) => void] {\n const { key = \"tab\", tabs } = options;\n return useSearchParamState<T>(key, defaultTab, {\n parse: (raw) => (!tabs || (tabs as readonly string[]).includes(raw) ? (raw as T) : undefined),\n history: \"replace\",\n });\n}\n\n/** Where a dialog's open state lives: a param's presence (`\"edit\"` → `?edit=1`), or one\n * value of a shared param (`{ key: \"dialog\", value: \"create-lease\" }`). */\nexport type DialogParam = string | { key: string; value: string };\n\n/** The route-state mark an opener leaves on the entry it pushes, so the close knows it\n * may go BACK over it rather than add a second entry. */\nconst OPENED_BY_KIT = \"__uiKitDialogParam\";\n\n/**\n * A dialog's open state in the URL, for `Modal`'s `urlParam` and anything else that\n * opens one: `const [open, setOpen] = useDialogParam({ key: \"dialog\", value: \"create\" })`.\n *\n * * **Opening pushes** an entry, so the platform Back gesture closes the dialog — by\n * leaving the entry — and Forward opens it again, like any other step.\n * * **Closing goes back** over that entry when this hook pushed it, so a closed dialog\n * leaves no dead entry behind. A dialog that arrived OPEN (a deep link, a reload, a\n * plain `<Link>` to it) has nothing of ours to go back over, and its close removes the\n * param in place instead — Back from there leaves the page, as it should.\n *\n * That is why it is not `useSearchParamState`: going back is the only close that\n * leaves the history as it was before the dialog, and only the opener knows whether it\n * may.\n */\nexport function useDialogParam(param: DialogParam): [boolean, (open: boolean) => void] {\n const { key, value } = typeof param === \"string\" ? { key: param, value: \"1\" } : param;\n const [params, setParams] = useSearchParams();\n const location = useLocation();\n const navigate = useNavigate();\n const open = typeof param === \"string\" ? params.has(key) : params.get(key) === value;\n const mark = `${key}=${value}`;\n\n const setOpen = (next: boolean) => {\n if (next === open) return;\n const state = carriedState(location.state);\n if (next) {\n setParams(\n (prev) => {\n const p = new URLSearchParams(prev);\n p.set(key, value);\n return p;\n },\n { state: { ...state, [OPENED_BY_KIT]: mark } },\n );\n return;\n }\n if (state?.[OPENED_BY_KIT] === mark) {\n void navigate(-1);\n return;\n }\n setParams(\n (prev) => {\n const p = new URLSearchParams(prev);\n p.delete(key);\n return p;\n },\n { replace: true, state },\n );\n };\n\n return [open, setOpen];\n}\n"],"mappings":";AAAA,SAAS,aAAa,aAAa,uBAAuB;AA8B1D,MAAM,mBAAmB,CAAC,UACxB,UAAU,QAAQ,UAAU,SAAY,OAAO,OAAO,KAAK;AAI7D,SAAS,aAAa,OAAqD;AACzE,SAAO,SAAS,OAAO,UAAU,WAAY,QAAoC;AACnF;AAkBO,SAAS,oBACd,KACA,cACA,UAAsC,CAAC,GACN;AACjC,QAAM,EAAE,OAAO,YAAY,iBAAgD,IAAI;AAC/E,QAAM,UAAU,QAAQ,YAAY,QAAQ,UAAU,YAAY;AAClE,QAAM,CAAC,QAAQ,SAAS,IAA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AC;AACH;AAQA,MAAM,gBAAgB;AAiBf,SAAS,eAAe,OAAwD;AACrF,QAAM,EAAE,KAAK,MAAM,IAAI,OAAO,UAAU,WAAW,EAAE,KAAK,OAAO,OAAO,IAAI,IAAI;AAChF,QAAM,CAAC,QAAQ,SAAS,IAAI,gBAAgB;AAC5C,QAAM,WAAW,YAAY;AAC7B,QAAM,WAAW,YAAY;AAC7B,QAAM,OAAO,OAAO,UAAU,WAAW,OAAO,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,MAAM;AAC/E,QAAM,OAAO,GAAG,GAAG,IAAI,KAAK;AAE5B,QAAM,UAAU,CAAC,SAAkB;AACjC,QAAI,SAAS,KAAM;AACnB,UAAM,QAAQ,aAAa,SAAS,KAAK;AACzC,QAAI,MAAM;AACR;AAAA,QACE,CAAC,SAAS;AACR,gBAAM,IAAI,IAAI,gBAAgB,IAAI;AAClC,YAAE,IAAI,KAAK,KAAK;AAChB,iBAAO;AAAA,QACT;AAAA,QACA,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,aAAa,GAAG,KAAK,EAAE;AAAA,MAC/C;AACA;AAAA,IACF;AACA,QAAI,QAAQ,aAAa,MAAM,MAAM;AACnC,WAAK,SAAS,EAAE;AAChB;AAAA,IACF;AACA;AAAA,MACE,CAAC,SAAS;AACR,cAAM,IAAI,IAAI,gBAAgB,IAAI;AAClC,UAAE,OAAO,GAAG;AACZ,eAAO;AAAA,MACT;AAAA,MACA,EAAE,SAAS,MAAM,MAAM;AAAA,IACzB;AAAA,EACF;AAEA,SAAO,CAAC,MAAM,OAAO;AACvB;","names":[]}
|
package/dist/i18n/defaults.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UiKitLabels } from '
|
|
1
|
+
import { aV as UiKitLabels } from '../kit-labels-Mz8zZHIF.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../components/data-table-labels.js';
|
|
4
4
|
import '../components/mini-calendar.js';
|
|
@@ -7,7 +7,6 @@ import '../components/popover.js';
|
|
|
7
7
|
import '../components/chip.js';
|
|
8
8
|
import 'lucide-react';
|
|
9
9
|
import '../components/field-sync.js';
|
|
10
|
-
import '../components/ui.js';
|
|
11
10
|
import '../components/tooltip.js';
|
|
12
11
|
import '../hooks/use-anchored-rect.js';
|
|
13
12
|
import '../lib/clipping.js';
|
|
@@ -19,6 +18,7 @@ import '../search/search-index.js';
|
|
|
19
18
|
import '../components/month-picker.js';
|
|
20
19
|
import '../components/page-contents.js';
|
|
21
20
|
import '../components/series-chart-labels.js';
|
|
21
|
+
import '../components/pie-chart-labels.js';
|
|
22
22
|
import '../components/sparkline.js';
|
|
23
23
|
import '../components/stat-tile.js';
|
|
24
24
|
import '../components/signature-pad.js';
|
|
@@ -29,17 +29,28 @@ import '../components/tile-radio.js';
|
|
|
29
29
|
import '../components/icon-picker.js';
|
|
30
30
|
import '../components/dialog-frame.js';
|
|
31
31
|
import '../components/modal.js';
|
|
32
|
-
import '../
|
|
32
|
+
import '../hooks/use-search-param-state.js';
|
|
33
33
|
import '../components/measured-grid.js';
|
|
34
34
|
import '../feedback/feedback-attachment.js';
|
|
35
35
|
import '../feedback/feedback-dialog.js';
|
|
36
|
+
import '../feedback/feedback-thread.js';
|
|
37
|
+
import '../feedback/feedback-inbox.js';
|
|
38
|
+
import '../components/account-settings-labels.js';
|
|
36
39
|
import '../components/confirm-dialog.js';
|
|
37
40
|
import '../components/floating-panel.js';
|
|
38
|
-
import '../components/copy-button.js';
|
|
39
41
|
import '../components/bulk-action-bar.js';
|
|
40
42
|
import '../components/list.js';
|
|
41
43
|
import '../components/breadcrumbs.js';
|
|
42
44
|
import '../components/toast.js';
|
|
45
|
+
import '../components/description-list.js';
|
|
46
|
+
import '../components/line-items.js';
|
|
47
|
+
import '../components/progress-bar.js';
|
|
48
|
+
import '../components/signed-amount.js';
|
|
49
|
+
import '../components/error-boundary.js';
|
|
50
|
+
import '../components/authed-image.js';
|
|
51
|
+
import '../hooks/use-authed-src.js';
|
|
52
|
+
import '../components/image-grid.js';
|
|
53
|
+
import '../components/lightbox.js';
|
|
43
54
|
|
|
44
55
|
/**
|
|
45
56
|
* The whole English tree in one object: what a translation is written against, and
|
package/dist/i18n/defaults.js
CHANGED
|
@@ -13,6 +13,7 @@ import { DEFAULT_TOUR_LABELS } from "../tour/tour.js";
|
|
|
13
13
|
import { DEFAULT_COMMAND_PALETTE_LABELS } from "../search/command-palette.js";
|
|
14
14
|
import { DEFAULT_GLOBAL_SEARCH_LABELS } from "../search/global-search.js";
|
|
15
15
|
import { DEFAULT_SERIES_CHART_LABELS } from "../components/series-chart-labels.js";
|
|
16
|
+
import { DEFAULT_PIE_CHART_LABELS } from "../components/pie-chart-labels.js";
|
|
16
17
|
import { DEFAULT_SPARKLINE_LABELS } from "../components/sparkline.js";
|
|
17
18
|
import { DEFAULT_STAT_TILE_LABELS } from "../components/stat-tile.js";
|
|
18
19
|
import { DEFAULT_SIGNATURE_PAD_LABELS } from "../components/signature-pad.js";
|
|
@@ -26,11 +27,26 @@ import { DEFAULT_MEASURED_GRID_LABELS } from "../components/measured-grid.js";
|
|
|
26
27
|
import { DEFAULT_CONFIRM_DIALOG_LABELS } from "../components/confirm-dialog.js";
|
|
27
28
|
import { DEFAULT_FLOATING_PANEL_LABELS } from "../components/floating-panel.js";
|
|
28
29
|
import { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from "../feedback/feedback-attachment.js";
|
|
30
|
+
import { DEFAULT_FEEDBACK_DIALOG_LABELS } from "../feedback/feedback-dialog.js";
|
|
31
|
+
import {
|
|
32
|
+
DEFAULT_FEEDBACK_COMPOSER_LABELS,
|
|
33
|
+
DEFAULT_FEEDBACK_THREAD_LABELS
|
|
34
|
+
} from "../feedback/feedback-thread.js";
|
|
35
|
+
import { DEFAULT_ACCOUNT_SETTINGS_LABELS } from "../components/account-settings-labels.js";
|
|
29
36
|
import { DEFAULT_COPY_BUTTON_LABELS } from "../components/copy-button.js";
|
|
30
37
|
import { DEFAULT_BULK_ACTION_BAR_LABELS } from "../components/bulk-action-bar.js";
|
|
31
38
|
import { DEFAULT_LIST_LABELS } from "../components/list.js";
|
|
32
39
|
import { DEFAULT_BREADCRUMBS_LABELS } from "../components/breadcrumbs.js";
|
|
33
40
|
import { DEFAULT_TOAST_LABELS } from "../components/toast.js";
|
|
41
|
+
import { DEFAULT_FORM_ACTIONS_LABELS } from "../components/form-actions.js";
|
|
42
|
+
import { DEFAULT_DESCRIPTION_LIST_LABELS } from "../components/description-list.js";
|
|
43
|
+
import { DEFAULT_LINE_ITEMS_LABELS } from "../components/line-items.js";
|
|
44
|
+
import { DEFAULT_PROGRESS_BAR_LABELS } from "../components/progress-bar.js";
|
|
45
|
+
import { DEFAULT_SIGNED_AMOUNT_LABELS } from "../components/signed-amount.js";
|
|
46
|
+
import { DEFAULT_ERROR_BOUNDARY_LABELS } from "../components/error-boundary.js";
|
|
47
|
+
import { DEFAULT_AUTHED_IMAGE_LABELS } from "../components/authed-image.js";
|
|
48
|
+
import { DEFAULT_IMAGE_GRID_LABELS } from "../components/image-grid.js";
|
|
49
|
+
import { DEFAULT_LIGHTBOX_LABELS } from "../components/lightbox.js";
|
|
34
50
|
import {
|
|
35
51
|
DEFAULT_APP_SHELL_LABELS,
|
|
36
52
|
DEFAULT_CALCULATOR_LABELS,
|
|
@@ -71,6 +87,7 @@ const DEFAULT_UI_KIT_LABELS = {
|
|
|
71
87
|
commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,
|
|
72
88
|
globalSearch: DEFAULT_GLOBAL_SEARCH_LABELS,
|
|
73
89
|
seriesChart: DEFAULT_SERIES_CHART_LABELS,
|
|
90
|
+
pieChart: DEFAULT_PIE_CHART_LABELS,
|
|
74
91
|
sparkline: DEFAULT_SPARKLINE_LABELS,
|
|
75
92
|
statTile: DEFAULT_STAT_TILE_LABELS,
|
|
76
93
|
signaturePad: DEFAULT_SIGNATURE_PAD_LABELS,
|
|
@@ -82,13 +99,26 @@ const DEFAULT_UI_KIT_LABELS = {
|
|
|
82
99
|
filePicker: DEFAULT_FILE_PICKER_LABELS,
|
|
83
100
|
measuredGrid: DEFAULT_MEASURED_GRID_LABELS,
|
|
84
101
|
feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,
|
|
102
|
+
feedbackDialog: DEFAULT_FEEDBACK_DIALOG_LABELS,
|
|
103
|
+
feedbackThread: DEFAULT_FEEDBACK_THREAD_LABELS,
|
|
104
|
+
feedbackComposer: DEFAULT_FEEDBACK_COMPOSER_LABELS,
|
|
105
|
+
accountSettings: DEFAULT_ACCOUNT_SETTINGS_LABELS,
|
|
85
106
|
confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,
|
|
86
107
|
floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,
|
|
87
108
|
copyButton: DEFAULT_COPY_BUTTON_LABELS,
|
|
88
109
|
bulkActionBar: DEFAULT_BULK_ACTION_BAR_LABELS,
|
|
89
110
|
list: DEFAULT_LIST_LABELS,
|
|
90
111
|
breadcrumbs: DEFAULT_BREADCRUMBS_LABELS,
|
|
91
|
-
toast: DEFAULT_TOAST_LABELS
|
|
112
|
+
toast: DEFAULT_TOAST_LABELS,
|
|
113
|
+
form: DEFAULT_FORM_ACTIONS_LABELS,
|
|
114
|
+
descriptionList: DEFAULT_DESCRIPTION_LIST_LABELS,
|
|
115
|
+
lineItems: DEFAULT_LINE_ITEMS_LABELS,
|
|
116
|
+
progressBar: DEFAULT_PROGRESS_BAR_LABELS,
|
|
117
|
+
signedAmount: DEFAULT_SIGNED_AMOUNT_LABELS,
|
|
118
|
+
errorBoundary: DEFAULT_ERROR_BOUNDARY_LABELS,
|
|
119
|
+
authedImage: DEFAULT_AUTHED_IMAGE_LABELS,
|
|
120
|
+
imageGrid: DEFAULT_IMAGE_GRID_LABELS,
|
|
121
|
+
lightbox: DEFAULT_LIGHTBOX_LABELS
|
|
92
122
|
};
|
|
93
123
|
export {
|
|
94
124
|
DEFAULT_UI_KIT_LABELS
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i18n/defaults.ts"],"sourcesContent":["import { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { DEFAULT_MINI_CALENDAR_LABELS } from \"../components/mini-calendar\";\nimport { DEFAULT_CALENDAR_HEATMAP_LABELS } from \"../components/calendar-heatmap\";\nimport { DEFAULT_MONTH_PICKER_LABELS } from \"../components/month-picker\";\nimport { DEFAULT_PAGE_CONTENTS_LABELS } from \"../components/page-contents\";\nimport { DEFAULT_POPOVER_LABELS } from \"../components/popover\";\nimport { DEFAULT_CHIP_INPUT_LABELS } from \"../components/chip\";\nimport { DEFAULT_FIELD_SYNC_LABELS } from \"../components/field-sync\";\nimport { DEFAULT_PASSWORD_REVEAL_LABELS, DEFAULT_TABS_LABELS } from \"../components/ui\";\nimport { DEFAULT_WIZARD_LABELS } from \"../wizard/types\";\nimport { DEFAULT_TOUR_LABELS } from \"../tour/tour\";\nimport { DEFAULT_COMMAND_PALETTE_LABELS } from \"../search/command-palette\";\nimport { DEFAULT_GLOBAL_SEARCH_LABELS } from \"../search/global-search\";\nimport { DEFAULT_SERIES_CHART_LABELS } from \"../components/series-chart-labels\";\nimport { DEFAULT_SPARKLINE_LABELS } from \"../components/sparkline\";\nimport { DEFAULT_STAT_TILE_LABELS } from \"../components/stat-tile\";\nimport { DEFAULT_SIGNATURE_PAD_LABELS } from \"../components/signature-pad\";\nimport { DEFAULT_PASSWORD_STRENGTH_LABELS } from \"../components/password-strength\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS } from \"../components/danger-confirm\";\nimport { DEFAULT_SWATCH_PICKER_LABELS } from \"../components/swatch-picker\";\nimport { DEFAULT_ICON_PICKER_LABELS } from \"../components/icon-picker\";\nimport { DEFAULT_DIALOG_FRAME_LABELS } from \"../components/dialog-frame\";\nimport { DEFAULT_FILE_PICKER_LABELS } from \"../components/file-button\";\nimport { DEFAULT_MEASURED_GRID_LABELS } from \"../components/measured-grid\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"../components/confirm-dialog\";\nimport { DEFAULT_FLOATING_PANEL_LABELS } from \"../components/floating-panel\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from \"../feedback/feedback-attachment\";\nimport { DEFAULT_COPY_BUTTON_LABELS } from \"../components/copy-button\";\nimport { DEFAULT_BULK_ACTION_BAR_LABELS } from \"../components/bulk-action-bar\";\nimport { DEFAULT_LIST_LABELS } from \"../components/list\";\nimport { DEFAULT_BREADCRUMBS_LABELS } from \"../components/breadcrumbs\";\nimport { DEFAULT_TOAST_LABELS } from \"../components/toast\";\nimport {\n DEFAULT_APP_SHELL_LABELS,\n DEFAULT_CALCULATOR_LABELS,\n DEFAULT_COMBOBOX_LABELS,\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n DEFAULT_DATE_PICKER_LABELS,\n DEFAULT_FILE_LABELS,\n DEFAULT_MULTI_SELECT_LABELS,\n DEFAULT_PICKER_SHEET_LABELS,\n DEFAULT_SWIPEABLE_ROW_LABELS,\n DEFAULT_TOP_BAR_LABELS,\n} from \"./kit-labels\";\nimport type { UiKitLabels } from \"./kit-labels\";\n\n/**\n * The whole English tree in one object: what a translation is written against, and\n * the `reference` for {@link missingKitLabels}.\n *\n * A separate module from the provider on purpose. Components import the provider's\n * hooks; this file imports the components' defaults. Kept together they would be an\n * import cycle through every component in the kit.\n */\nexport const DEFAULT_UI_KIT_LABELS: UiKitLabels = {\n common: DEFAULT_COMMON_LABELS,\n dataTable: DEFAULT_DATA_TABLE_LABELS,\n miniCalendar: DEFAULT_MINI_CALENDAR_LABELS,\n calendarHeatmap: DEFAULT_CALENDAR_HEATMAP_LABELS,\n datePicker: DEFAULT_DATE_PICKER_LABELS,\n monthPicker: DEFAULT_MONTH_PICKER_LABELS,\n popover: DEFAULT_POPOVER_LABELS,\n combobox: DEFAULT_COMBOBOX_LABELS,\n multiSelect: DEFAULT_MULTI_SELECT_LABELS,\n calculator: DEFAULT_CALCULATOR_LABELS,\n currency: DEFAULT_CURRENCY_LABELS,\n chipInput: DEFAULT_CHIP_INPUT_LABELS,\n fieldSync: DEFAULT_FIELD_SYNC_LABELS,\n passwordReveal: DEFAULT_PASSWORD_REVEAL_LABELS,\n tabs: DEFAULT_TABS_LABELS,\n appShell: DEFAULT_APP_SHELL_LABELS,\n pageContents: DEFAULT_PAGE_CONTENTS_LABELS,\n topBar: DEFAULT_TOP_BAR_LABELS,\n pickerSheet: DEFAULT_PICKER_SHEET_LABELS,\n swipeableRow: DEFAULT_SWIPEABLE_ROW_LABELS,\n file: DEFAULT_FILE_LABELS,\n wizard: DEFAULT_WIZARD_LABELS,\n tour: DEFAULT_TOUR_LABELS,\n commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,\n globalSearch: DEFAULT_GLOBAL_SEARCH_LABELS,\n seriesChart: DEFAULT_SERIES_CHART_LABELS,\n sparkline: DEFAULT_SPARKLINE_LABELS,\n statTile: DEFAULT_STAT_TILE_LABELS,\n signaturePad: DEFAULT_SIGNATURE_PAD_LABELS,\n passwordStrength: DEFAULT_PASSWORD_STRENGTH_LABELS,\n dangerConfirm: DEFAULT_DANGER_CONFIRM_LABELS,\n swatchPicker: DEFAULT_SWATCH_PICKER_LABELS,\n iconPicker: DEFAULT_ICON_PICKER_LABELS,\n dialogFrame: DEFAULT_DIALOG_FRAME_LABELS,\n filePicker: DEFAULT_FILE_PICKER_LABELS,\n measuredGrid: DEFAULT_MEASURED_GRID_LABELS,\n feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,\n floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,\n copyButton: DEFAULT_COPY_BUTTON_LABELS,\n bulkActionBar: DEFAULT_BULK_ACTION_BAR_LABELS,\n list: DEFAULT_LIST_LABELS,\n breadcrumbs: DEFAULT_BREADCRUMBS_LABELS,\n toast: DEFAULT_TOAST_LABELS,\n};\n"],"mappings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AAAA,EACR,MAAM;AAAA,EACN,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,aAAa;AAAA,EACb,WAAW;AAAA,EACX,UAAU;AAAA,EACV,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,eAAe;AAAA,EACf,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,MAAM;AAAA,EACN,aAAa;AAAA,EACb,OAAO;
|
|
1
|
+
{"version":3,"sources":["../../src/i18n/defaults.ts"],"sourcesContent":["import { DEFAULT_DATA_TABLE_LABELS } from \"../components/data-table-labels\";\nimport { DEFAULT_MINI_CALENDAR_LABELS } from \"../components/mini-calendar\";\nimport { DEFAULT_CALENDAR_HEATMAP_LABELS } from \"../components/calendar-heatmap\";\nimport { DEFAULT_MONTH_PICKER_LABELS } from \"../components/month-picker\";\nimport { DEFAULT_PAGE_CONTENTS_LABELS } from \"../components/page-contents\";\nimport { DEFAULT_POPOVER_LABELS } from \"../components/popover\";\nimport { DEFAULT_CHIP_INPUT_LABELS } from \"../components/chip\";\nimport { DEFAULT_FIELD_SYNC_LABELS } from \"../components/field-sync\";\nimport { DEFAULT_PASSWORD_REVEAL_LABELS, DEFAULT_TABS_LABELS } from \"../components/ui\";\nimport { DEFAULT_WIZARD_LABELS } from \"../wizard/types\";\nimport { DEFAULT_TOUR_LABELS } from \"../tour/tour\";\nimport { DEFAULT_COMMAND_PALETTE_LABELS } from \"../search/command-palette\";\nimport { DEFAULT_GLOBAL_SEARCH_LABELS } from \"../search/global-search\";\nimport { DEFAULT_SERIES_CHART_LABELS } from \"../components/series-chart-labels\";\nimport { DEFAULT_PIE_CHART_LABELS } from \"../components/pie-chart-labels\";\nimport { DEFAULT_SPARKLINE_LABELS } from \"../components/sparkline\";\nimport { DEFAULT_STAT_TILE_LABELS } from \"../components/stat-tile\";\nimport { DEFAULT_SIGNATURE_PAD_LABELS } from \"../components/signature-pad\";\nimport { DEFAULT_PASSWORD_STRENGTH_LABELS } from \"../components/password-strength\";\nimport { DEFAULT_DANGER_CONFIRM_LABELS } from \"../components/danger-confirm\";\nimport { DEFAULT_SWATCH_PICKER_LABELS } from \"../components/swatch-picker\";\nimport { DEFAULT_ICON_PICKER_LABELS } from \"../components/icon-picker\";\nimport { DEFAULT_DIALOG_FRAME_LABELS } from \"../components/dialog-frame\";\nimport { DEFAULT_FILE_PICKER_LABELS } from \"../components/file-button\";\nimport { DEFAULT_MEASURED_GRID_LABELS } from \"../components/measured-grid\";\nimport { DEFAULT_CONFIRM_DIALOG_LABELS } from \"../components/confirm-dialog\";\nimport { DEFAULT_FLOATING_PANEL_LABELS } from \"../components/floating-panel\";\nimport { DEFAULT_FEEDBACK_ATTACHMENT_LABELS } from \"../feedback/feedback-attachment\";\nimport { DEFAULT_FEEDBACK_DIALOG_LABELS } from \"../feedback/feedback-dialog\";\nimport {\n DEFAULT_FEEDBACK_COMPOSER_LABELS,\n DEFAULT_FEEDBACK_THREAD_LABELS,\n} from \"../feedback/feedback-thread\";\nimport { DEFAULT_ACCOUNT_SETTINGS_LABELS } from \"../components/account-settings-labels\";\nimport { DEFAULT_COPY_BUTTON_LABELS } from \"../components/copy-button\";\nimport { DEFAULT_BULK_ACTION_BAR_LABELS } from \"../components/bulk-action-bar\";\nimport { DEFAULT_LIST_LABELS } from \"../components/list\";\nimport { DEFAULT_BREADCRUMBS_LABELS } from \"../components/breadcrumbs\";\nimport { DEFAULT_TOAST_LABELS } from \"../components/toast\";\nimport { DEFAULT_FORM_ACTIONS_LABELS } from \"../components/form-actions\";\nimport { DEFAULT_DESCRIPTION_LIST_LABELS } from \"../components/description-list\";\nimport { DEFAULT_LINE_ITEMS_LABELS } from \"../components/line-items\";\nimport { DEFAULT_PROGRESS_BAR_LABELS } from \"../components/progress-bar\";\nimport { DEFAULT_SIGNED_AMOUNT_LABELS } from \"../components/signed-amount\";\nimport { DEFAULT_ERROR_BOUNDARY_LABELS } from \"../components/error-boundary\";\nimport { DEFAULT_AUTHED_IMAGE_LABELS } from \"../components/authed-image\";\nimport { DEFAULT_IMAGE_GRID_LABELS } from \"../components/image-grid\";\nimport { DEFAULT_LIGHTBOX_LABELS } from \"../components/lightbox\";\nimport {\n DEFAULT_APP_SHELL_LABELS,\n DEFAULT_CALCULATOR_LABELS,\n DEFAULT_COMBOBOX_LABELS,\n DEFAULT_COMMON_LABELS,\n DEFAULT_CURRENCY_LABELS,\n DEFAULT_DATE_PICKER_LABELS,\n DEFAULT_FILE_LABELS,\n DEFAULT_MULTI_SELECT_LABELS,\n DEFAULT_PICKER_SHEET_LABELS,\n DEFAULT_SWIPEABLE_ROW_LABELS,\n DEFAULT_TOP_BAR_LABELS,\n} from \"./kit-labels\";\nimport type { UiKitLabels } from \"./kit-labels\";\n\n/**\n * The whole English tree in one object: what a translation is written against, and\n * the `reference` for {@link missingKitLabels}.\n *\n * A separate module from the provider on purpose. Components import the provider's\n * hooks; this file imports the components' defaults. Kept together they would be an\n * import cycle through every component in the kit.\n */\nexport const DEFAULT_UI_KIT_LABELS: UiKitLabels = {\n common: DEFAULT_COMMON_LABELS,\n dataTable: DEFAULT_DATA_TABLE_LABELS,\n miniCalendar: DEFAULT_MINI_CALENDAR_LABELS,\n calendarHeatmap: DEFAULT_CALENDAR_HEATMAP_LABELS,\n datePicker: DEFAULT_DATE_PICKER_LABELS,\n monthPicker: DEFAULT_MONTH_PICKER_LABELS,\n popover: DEFAULT_POPOVER_LABELS,\n combobox: DEFAULT_COMBOBOX_LABELS,\n multiSelect: DEFAULT_MULTI_SELECT_LABELS,\n calculator: DEFAULT_CALCULATOR_LABELS,\n currency: DEFAULT_CURRENCY_LABELS,\n chipInput: DEFAULT_CHIP_INPUT_LABELS,\n fieldSync: DEFAULT_FIELD_SYNC_LABELS,\n passwordReveal: DEFAULT_PASSWORD_REVEAL_LABELS,\n tabs: DEFAULT_TABS_LABELS,\n appShell: DEFAULT_APP_SHELL_LABELS,\n pageContents: DEFAULT_PAGE_CONTENTS_LABELS,\n topBar: DEFAULT_TOP_BAR_LABELS,\n pickerSheet: DEFAULT_PICKER_SHEET_LABELS,\n swipeableRow: DEFAULT_SWIPEABLE_ROW_LABELS,\n file: DEFAULT_FILE_LABELS,\n wizard: DEFAULT_WIZARD_LABELS,\n tour: DEFAULT_TOUR_LABELS,\n commandPalette: DEFAULT_COMMAND_PALETTE_LABELS,\n globalSearch: DEFAULT_GLOBAL_SEARCH_LABELS,\n seriesChart: DEFAULT_SERIES_CHART_LABELS,\n pieChart: DEFAULT_PIE_CHART_LABELS,\n sparkline: DEFAULT_SPARKLINE_LABELS,\n statTile: DEFAULT_STAT_TILE_LABELS,\n signaturePad: DEFAULT_SIGNATURE_PAD_LABELS,\n passwordStrength: DEFAULT_PASSWORD_STRENGTH_LABELS,\n dangerConfirm: DEFAULT_DANGER_CONFIRM_LABELS,\n swatchPicker: DEFAULT_SWATCH_PICKER_LABELS,\n iconPicker: DEFAULT_ICON_PICKER_LABELS,\n dialogFrame: DEFAULT_DIALOG_FRAME_LABELS,\n filePicker: DEFAULT_FILE_PICKER_LABELS,\n measuredGrid: DEFAULT_MEASURED_GRID_LABELS,\n feedbackAttachment: DEFAULT_FEEDBACK_ATTACHMENT_LABELS,\n feedbackDialog: DEFAULT_FEEDBACK_DIALOG_LABELS,\n feedbackThread: DEFAULT_FEEDBACK_THREAD_LABELS,\n feedbackComposer: DEFAULT_FEEDBACK_COMPOSER_LABELS,\n accountSettings: DEFAULT_ACCOUNT_SETTINGS_LABELS,\n confirmDialog: DEFAULT_CONFIRM_DIALOG_LABELS,\n floatingPanel: DEFAULT_FLOATING_PANEL_LABELS,\n copyButton: DEFAULT_COPY_BUTTON_LABELS,\n bulkActionBar: DEFAULT_BULK_ACTION_BAR_LABELS,\n list: DEFAULT_LIST_LABELS,\n breadcrumbs: DEFAULT_BREADCRUMBS_LABELS,\n toast: DEFAULT_TOAST_LABELS,\n form: DEFAULT_FORM_ACTIONS_LABELS,\n descriptionList: DEFAULT_DESCRIPTION_LIST_LABELS,\n lineItems: DEFAULT_LINE_ITEMS_LABELS,\n progressBar: DEFAULT_PROGRESS_BAR_LABELS,\n signedAmount: DEFAULT_SIGNED_AMOUNT_LABELS,\n errorBoundary: DEFAULT_ERROR_BOUNDARY_LABELS,\n authedImage: DEFAULT_AUTHED_IMAGE_LABELS,\n imageGrid: DEFAULT_IMAGE_GRID_LABELS,\n lightbox: DEFAULT_LIGHTBOX_LABELS,\n};\n"],"mappings":";AAAA,SAAS,iCAAiC;AAC1C,SAAS,oCAAoC;AAC7C,SAAS,uCAAuC;AAChD,SAAS,mCAAmC;AAC5C,SAAS,oCAAoC;AAC7C,SAAS,8BAA8B;AACvC,SAAS,iCAAiC;AAC1C,SAAS,iCAAiC;AAC1C,SAAS,gCAAgC,2BAA2B;AACpE,SAAS,6BAA6B;AACtC,SAAS,2BAA2B;AACpC,SAAS,sCAAsC;AAC/C,SAAS,oCAAoC;AAC7C,SAAS,mCAAmC;AAC5C,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,gCAAgC;AACzC,SAAS,oCAAoC;AAC7C,SAAS,wCAAwC;AACjD,SAAS,qCAAqC;AAC9C,SAAS,oCAAoC;AAC7C,SAAS,kCAAkC;AAC3C,SAAS,mCAAmC;AAC5C,SAAS,kCAAkC;AAC3C,SAAS,oCAAoC;AAC7C,SAAS,qCAAqC;AAC9C,SAAS,qCAAqC;AAC9C,SAAS,0CAA0C;AACnD,SAAS,sCAAsC;AAC/C;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,uCAAuC;AAChD,SAAS,kCAAkC;AAC3C,SAAS,sCAAsC;AAC/C,SAAS,2BAA2B;AACpC,SAAS,kCAAkC;AAC3C,SAAS,4BAA4B;AACrC,SAAS,mCAAmC;AAC5C,SAAS,uCAAuC;AAChD,SAAS,iCAAiC;A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