@eifi1/ui-kit 0.11.0 → 0.12.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 +57 -32
- 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 +24 -4
- package/dist/components/amount-input.js +5 -2
- 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/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/chip.d.ts +2 -1
- package/dist/components/chip.js +6 -3
- 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.js +2 -0
- 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-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 +102 -12
- 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 +18 -3
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary.d.ts +92 -0
- package/dist/components/error-boundary.js +111 -0
- package/dist/components/error-boundary.js.map +1 -0
- 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/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 +23 -2
- package/dist/components/list.js +32 -13
- 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 +19 -3
- 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 +15 -4
- 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 +2 -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/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 +121 -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 +5 -2
- package/dist/components/stat-tile.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 +176 -0
- package/dist/components/text-link.js +109 -0
- package/dist/components/text-link.js.map +1 -0
- package/dist/components/time-input.d.ts +49 -1
- package/dist/components/toggle-group.d.ts +13 -0
- package/dist/components/toggle-group.js +35 -6
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +36 -3
- package/dist/components/toggle-legend.js +49 -0
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/ui.d.ts +51 -779
- package/dist/components/ui.js +215 -23
- 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-dialog.d.ts +26 -3
- package/dist/feedback/feedback-dialog.js +16 -2
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +133 -0
- package/dist/feedback/feedback-thread.js +237 -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 +156 -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 +153 -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 +153 -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 +153 -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 +153 -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 +153 -3
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/index.d.ts +37 -17
- package/dist/index.js +40 -1
- package/dist/index.js.map +1 -1
- package/dist/kit-labels-v3biUF1L.d.ts +1645 -0
- package/dist/lib/format.d.ts +144 -0
- package/dist/lib/format.js +149 -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 +241 -0
- package/dist/rhf/fields.js +601 -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/shell/app-shell.d.ts +99 -2
- package/dist/shell/app-shell.js +58 -3
- 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 +12 -1
- package/dist/shell/topbar-action-menu.js +16 -1
- 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/wizard/stepper-nav.d.ts +48 -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 +20 -5
- package/dist/wizard/wizard-step.js +16 -3
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard.d.ts +50 -3
- package/package.json +1 -1
- 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 +13 -1
- package/src/components/authed-image.tsx +190 -0
- package/src/components/breadcrumbs.tsx +8 -2
- package/src/components/button-group.tsx +7 -2
- package/src/components/calendar-heatmap.tsx +105 -10
- package/src/components/chip.tsx +8 -4
- package/src/components/choice-card.tsx +136 -25
- package/src/components/combobox-core.tsx +5 -0
- package/src/components/combobox.tsx +31 -9
- package/src/components/copy-button.tsx +3 -2
- package/src/components/data-table-cells.tsx +119 -0
- package/src/components/data-table-filters.ts +77 -0
- package/src/components/data-table-labels.ts +23 -0
- package/src/components/data-table.tsx +224 -13
- package/src/components/date-picker.tsx +19 -3
- package/src/components/description-list.tsx +52 -3
- package/src/components/entity-combobox.tsx +18 -3
- package/src/components/error-boundary.tsx +216 -0
- 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/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 +65 -16
- 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 +61 -3
- package/src/components/month-picker.tsx +181 -26
- package/src/components/multi-entity-combobox.tsx +19 -3
- package/src/components/nav-pills.tsx +8 -1
- package/src/components/number-field.tsx +15 -10
- package/src/components/number-input.tsx +16 -1
- package/src/components/passkeys-setting.tsx +331 -0
- package/src/components/picker-sheet.tsx +7 -1
- package/src/components/pie-chart-labels.ts +32 -0
- package/src/components/pie-chart.tsx +479 -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 +286 -0
- package/src/components/skeleton.tsx +21 -3
- package/src/components/stat-tile.tsx +8 -2
- package/src/components/table.tsx +102 -13
- package/src/components/text-link.tsx +248 -0
- package/src/components/toggle-group.tsx +58 -10
- package/src/components/toggle-legend.tsx +87 -2
- package/src/components/ui.tsx +426 -36
- package/src/components/use-table-state.ts +265 -33
- package/src/data-table.ts +10 -0
- package/src/feedback/feedback-dialog.tsx +42 -3
- package/src/feedback/feedback-thread.tsx +434 -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 +102 -8
- package/src/i18n/locales/de.ts +153 -0
- package/src/i18n/locales/es.ts +150 -0
- package/src/i18n/locales/fr.ts +153 -0
- package/src/i18n/locales/hu.ts +151 -0
- package/src/i18n/locales/it.ts +151 -0
- package/src/i18n/locales/zh.ts +150 -0
- package/src/index.ts +59 -0
- package/src/lib/format.ts +325 -0
- package/src/lib/qr-encode.ts +420 -0
- package/src/rhf/fields.tsx +1054 -0
- package/src/rhf/line-items.tsx +130 -0
- package/src/rhf.ts +6 -0
- package/src/shell/app-shell.tsx +147 -2
- package/src/shell/auth-layout.tsx +190 -0
- package/src/shell/top-bar-brand.tsx +76 -0
- package/src/shell/topbar-action-menu.tsx +21 -0
- package/src/shell.ts +2 -0
- package/src/wizard/wizard-context.tsx +41 -1
- package/src/wizard/wizard-step.tsx +43 -6
- package/tokens.css +12 -0
|
@@ -1,37 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
1
|
+
import 'react';
|
|
2
|
+
import '../components/data-table-labels.js';
|
|
3
|
+
import '../components/mini-calendar.js';
|
|
4
|
+
import '../components/calendar-heatmap.js';
|
|
5
|
+
import '../components/popover.js';
|
|
6
|
+
import '../components/chip.js';
|
|
7
|
+
import '../components/field-sync.js';
|
|
8
|
+
export { A as AppShellLabels, C as CalculatorLabels, v as ComboboxLabels, w as CommonLabels, D as CurrencyLabels, E as DEFAULT_APP_SHELL_LABELS, F as DEFAULT_CALCULATOR_LABELS, G as DEFAULT_COMBOBOX_LABELS, H as DEFAULT_COMMON_LABELS, J as DEFAULT_CURRENCY_LABELS, K as DEFAULT_DATE_PICKER_LABELS, L as DEFAULT_FILE_LABELS, O as DEFAULT_MULTI_SELECT_LABELS, Q as DEFAULT_PICKER_SHEET_LABELS, R as DEFAULT_SWIPEABLE_ROW_LABELS, T as DEFAULT_TOP_BAR_LABELS, U as DatePickerLabels, ac as FileLabels, ax as KitLinkComponent, ay as KitLinkProps, aA as LabelOverride, aC as MultiSelectLabels, aF as PickerSheetLabels, aK as SwipeableRowLabels, aR as TopBarLabels, aS as UiKitLabelOverrides, aT as UiKitLabels, aU as UiKitProvider, aV as UiKitProviderProps, aZ as formatFileSize, a$ as missingKitLabels, b2 as useKitFileLabels, b3 as useKitLabelOverrides, b4 as useKitLabels, b5 as useKitLink, b6 as useKitLocale, b7 as useKitWeekStart } from '../kit-labels-v3biUF1L.js';
|
|
9
|
+
import '../wizard/types.js';
|
|
10
|
+
import '../tour/tour.js';
|
|
11
|
+
import '../search/command-palette.js';
|
|
12
|
+
import '../search/global-search.js';
|
|
13
|
+
import '../components/month-picker.js';
|
|
14
|
+
import '../components/page-contents.js';
|
|
15
|
+
import '../components/series-chart-labels.js';
|
|
16
|
+
import '../components/pie-chart-labels.js';
|
|
17
|
+
import '../components/sparkline.js';
|
|
18
|
+
import '../components/stat-tile.js';
|
|
19
|
+
import '../components/signature-pad.js';
|
|
20
|
+
import '../components/password-strength.js';
|
|
21
|
+
import '../components/danger-confirm.js';
|
|
22
|
+
import '../components/swatch-picker.js';
|
|
23
|
+
import '../components/icon-picker.js';
|
|
24
|
+
import '../components/dialog-frame.js';
|
|
25
|
+
import '../components/measured-grid.js';
|
|
26
|
+
import '../feedback/feedback-attachment.js';
|
|
27
|
+
import '../feedback/feedback-dialog.js';
|
|
28
|
+
import '../feedback/feedback-thread.js';
|
|
29
|
+
import '../components/account-settings-labels.js';
|
|
30
|
+
import '../components/confirm-dialog.js';
|
|
31
|
+
import '../components/floating-panel.js';
|
|
32
|
+
import '../components/bulk-action-bar.js';
|
|
33
|
+
import '../components/list.js';
|
|
34
|
+
import '../components/breadcrumbs.js';
|
|
35
|
+
import '../components/toast.js';
|
|
36
|
+
import '../components/description-list.js';
|
|
37
|
+
import '../components/line-items.js';
|
|
38
|
+
import '../components/progress-bar.js';
|
|
39
|
+
import '../components/signed-amount.js';
|
|
40
|
+
import '../components/error-boundary.js';
|
|
41
|
+
import '../components/authed-image.js';
|
|
42
|
+
import '../components/image-grid.js';
|
|
43
|
+
import '../components/lightbox.js';
|
|
35
44
|
import 'lucide-react';
|
|
36
45
|
import '../components/tooltip.js';
|
|
37
46
|
import '../hooks/use-anchored-rect.js';
|
|
@@ -39,281 +48,6 @@ import '../lib/clipping.js';
|
|
|
39
48
|
import '../search/search-index.js';
|
|
40
49
|
import '../components/tile-radio.js';
|
|
41
50
|
import '../components/modal.js';
|
|
42
|
-
import '../
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
* EVERY string the kit renders, as one typed tree — and an optional provider that
|
|
46
|
-
* hands it to every component at once.
|
|
47
|
-
*
|
|
48
|
-
* WHY THIS EXISTS. The kit ships no catalogue and resolves no strings, and that stays
|
|
49
|
-
* true: the app supplies every word. What was wrong was HOW it had to supply them —
|
|
50
|
-
* one `labels` prop per component instance, under a different prop name per
|
|
51
|
-
* component (`labels`, `calendarLabels`, `passwordLabels`, `clearLabel`,
|
|
52
|
-
* `searchPlaceholder`, `ariaLabel` …). A translated app therefore rendered English
|
|
53
|
-
* wherever one call site forgot one prop, and nothing told it so: a German showcase
|
|
54
|
-
* still said "Rows per page", "Collapse sidebar" and "Popover" in seven languages.
|
|
55
|
-
*
|
|
56
|
-
* Now there is one key per string, addressed by a dot path (`dataTable.pageSize`,
|
|
57
|
-
* `datePicker.today`), and three sources in a fixed order of precedence:
|
|
58
|
-
*
|
|
59
|
-
* the component's own prop > <UiKitProvider labels> > English default
|
|
60
|
-
*
|
|
61
|
-
* A consumer writes its translation ONCE, as a `UiKitLabels` (or a partial of it),
|
|
62
|
-
* mounts `<UiKitProvider labels={…} locale={…}>` at the root, and every kit component
|
|
63
|
-
* below speaks that language — including the ones nested inside other kit components
|
|
64
|
-
* (the calendar inside the data table's date filter, the popover inside the date
|
|
65
|
-
* picker), which no prop at the outer call site could reach before.
|
|
66
|
-
*
|
|
67
|
-
* Messages that carry a value are FUNCTIONS of that value, never a template to fill:
|
|
68
|
-
* a number glued into an English sentence is untranslatable, because the grammar
|
|
69
|
-
* around it moves with it in most languages.
|
|
70
|
-
*/
|
|
71
|
-
/** The words several components share. A component's own namespace wins over these
|
|
72
|
-
* where both exist; these are what a new component reaches for first. */
|
|
73
|
-
interface CommonLabels {
|
|
74
|
-
close: string;
|
|
75
|
-
clear: string;
|
|
76
|
-
search: string;
|
|
77
|
-
done: string;
|
|
78
|
-
cancel: string;
|
|
79
|
-
save: string;
|
|
80
|
-
back: string;
|
|
81
|
-
next: string;
|
|
82
|
-
remove: string;
|
|
83
|
-
loading: string;
|
|
84
|
-
noResults: string;
|
|
85
|
-
/** "Name: value" — how a field's accessible name is composed with its value.
|
|
86
|
-
* A colon-and-space is not universal punctuation (French puts a space before
|
|
87
|
-
* the colon, Chinese uses a full-width one). */
|
|
88
|
-
fieldValue: (field: string, value: string) => string;
|
|
89
|
-
/** The × that puts away a banner or a notice (`AlertBanner onDismiss`). Not `close`:
|
|
90
|
-
* nothing opened, and "Close" on a banner reads as closing the page it sits on. */
|
|
91
|
-
dismiss: string;
|
|
92
|
-
}
|
|
93
|
-
/** `DatePicker` / `DateRangePicker` chrome. The calendar inside has its own
|
|
94
|
-
* namespace, `miniCalendar`. */
|
|
95
|
-
interface DatePickerLabels {
|
|
96
|
-
/** Accessible name of the popover panel the calendar opens in. */
|
|
97
|
-
panel: string;
|
|
98
|
-
/** The same, for `DateRangePicker`'s panel. */
|
|
99
|
-
rangePanel: string;
|
|
100
|
-
clear: string;
|
|
101
|
-
previousDay: string;
|
|
102
|
-
nextDay: string;
|
|
103
|
-
today: string;
|
|
104
|
-
/** `DateRangePicker commit="apply"`: the button that commits the drafted range. */
|
|
105
|
-
apply: string;
|
|
106
|
-
/** …and the one that discards it. */
|
|
107
|
-
cancel: string;
|
|
108
|
-
/** Accessible name of `DateRangePicker`'s preset column. */
|
|
109
|
-
presets: string;
|
|
110
|
-
}
|
|
111
|
-
/** The whole combobox family: `Combobox`, `EntityCombobox`,
|
|
112
|
-
* `MultiEntityCombobox`, `InlineEntityCombobox`, `Autocomplete`. */
|
|
113
|
-
interface ComboboxLabels {
|
|
114
|
-
search: string;
|
|
115
|
-
noResults: string;
|
|
116
|
-
clear: string;
|
|
117
|
-
loading: string;
|
|
118
|
-
/** The "add this" row when free entry is allowed. */
|
|
119
|
-
create: (query: string) => string;
|
|
120
|
-
/** Trigger summary once more than one value is picked. */
|
|
121
|
-
selectedCount: (count: number) => string;
|
|
122
|
-
/** An async lookup (`loadOptions`) failed. */
|
|
123
|
-
loadError: string;
|
|
124
|
-
/** Announced (live region) when the list settles on `count` > 0 rows. */
|
|
125
|
-
resultCount: (count: number) => string;
|
|
126
|
-
/** The query is shorter than the `minChars` a lookup needs. */
|
|
127
|
-
minChars: (count: number) => string;
|
|
128
|
-
}
|
|
129
|
-
interface MultiSelectLabels {
|
|
130
|
-
search: string;
|
|
131
|
-
selectAll: string;
|
|
132
|
-
clear: string;
|
|
133
|
-
/** Trigger text when nothing is picked, which a multi-select reads as "all". */
|
|
134
|
-
all: string;
|
|
135
|
-
/** Trigger summary once some (but not all) values are picked. The English
|
|
136
|
-
* default is the bare count, which is what the trigger has always shown. */
|
|
137
|
-
selectedCount: (count: number) => string;
|
|
138
|
-
}
|
|
139
|
-
/** `CalculatorButton` (desktop popover keypad) and `NumberPadSheet` (phone sheet). */
|
|
140
|
-
interface CalculatorLabels {
|
|
141
|
-
/** The button that opens the calculator. */
|
|
142
|
-
open: string;
|
|
143
|
-
/** The popover / sheet itself. */
|
|
144
|
-
panel: string;
|
|
145
|
-
calculation: string;
|
|
146
|
-
backspace: string;
|
|
147
|
-
clear: string;
|
|
148
|
-
equals: string;
|
|
149
|
-
/** The primary key of the phone pad — visible text, not an aria-label. */
|
|
150
|
-
done: string;
|
|
151
|
-
/** Names of the operator keys and the decimal key. Their glyphs are not names a
|
|
152
|
-
* screen reader agrees on — "÷" is read as "division sign", "divided by" or
|
|
153
|
-
* nothing at all depending on the reader — so each says what it does. */
|
|
154
|
-
plus: string;
|
|
155
|
-
minus: string;
|
|
156
|
-
times: string;
|
|
157
|
-
divide: string;
|
|
158
|
-
decimal: string;
|
|
159
|
-
}
|
|
160
|
-
/** `CurrencySelect` and the currency half of `AmountInput`. */
|
|
161
|
-
interface CurrencyLabels {
|
|
162
|
-
currency: string;
|
|
163
|
-
search: string;
|
|
164
|
-
}
|
|
165
|
-
interface AppShellLabels {
|
|
166
|
-
collapse: string;
|
|
167
|
-
expand: string;
|
|
168
|
-
/** Accessible name of an inline group's disclosure button (`subNav="inline"`). */
|
|
169
|
-
toggleGroup: (groupLabel: string) => string;
|
|
170
|
-
}
|
|
171
|
-
interface TopBarLabels {
|
|
172
|
-
theme: string;
|
|
173
|
-
palette: string;
|
|
174
|
-
language: string;
|
|
175
|
-
switchRole: string;
|
|
176
|
-
/** The role switcher's tooltip, given the active role's name. */
|
|
177
|
-
role: (value: string) => string;
|
|
178
|
-
}
|
|
179
|
-
interface PickerSheetLabels {
|
|
180
|
-
close: string;
|
|
181
|
-
}
|
|
182
|
-
interface SwipeableRowLabels {
|
|
183
|
-
actions: string;
|
|
184
|
-
}
|
|
185
|
-
interface FileLabels {
|
|
186
|
-
/** A file size for display, given its size in BYTES. The default uses
|
|
187
|
-
* `Intl.NumberFormat`'s unit formatting in the provider's locale. */
|
|
188
|
-
size: (bytes: number) => string;
|
|
189
|
-
}
|
|
190
|
-
/** The complete tree. `UiKitProvider` takes any partial of it. */
|
|
191
|
-
interface UiKitLabels {
|
|
192
|
-
common: CommonLabels;
|
|
193
|
-
dataTable: DataTableLabels;
|
|
194
|
-
miniCalendar: MiniCalendarLabels;
|
|
195
|
-
calendarHeatmap: CalendarHeatmapLabels;
|
|
196
|
-
datePicker: DatePickerLabels;
|
|
197
|
-
monthPicker: MonthPickerLabels;
|
|
198
|
-
popover: PopoverLabels;
|
|
199
|
-
combobox: ComboboxLabels;
|
|
200
|
-
multiSelect: MultiSelectLabels;
|
|
201
|
-
calculator: CalculatorLabels;
|
|
202
|
-
currency: CurrencyLabels;
|
|
203
|
-
chipInput: ChipInputLabels;
|
|
204
|
-
fieldSync: FieldSyncLabels;
|
|
205
|
-
passwordReveal: PasswordRevealLabels;
|
|
206
|
-
tabs: TabsLabels;
|
|
207
|
-
appShell: AppShellLabels;
|
|
208
|
-
pageContents: PageContentsLabels;
|
|
209
|
-
topBar: TopBarLabels;
|
|
210
|
-
pickerSheet: PickerSheetLabels;
|
|
211
|
-
swipeableRow: SwipeableRowLabels;
|
|
212
|
-
file: FileLabels;
|
|
213
|
-
wizard: WizardLabels;
|
|
214
|
-
tour: TourLabels;
|
|
215
|
-
commandPalette: CommandPaletteLabels;
|
|
216
|
-
globalSearch: GlobalSearchLabels;
|
|
217
|
-
seriesChart: SeriesChartLabels;
|
|
218
|
-
sparkline: SparklineLabels;
|
|
219
|
-
statTile: StatTileLabels;
|
|
220
|
-
signaturePad: SignaturePadLabels;
|
|
221
|
-
passwordStrength: PasswordStrengthLabels;
|
|
222
|
-
dangerConfirm: DangerConfirmLabels;
|
|
223
|
-
swatchPicker: SwatchPickerLabels;
|
|
224
|
-
iconPicker: IconPickerLabels;
|
|
225
|
-
dialogFrame: DialogFrameLabels;
|
|
226
|
-
filePicker: FilePickerLabels;
|
|
227
|
-
measuredGrid: MeasuredGridLabels;
|
|
228
|
-
feedbackAttachment: FeedbackAttachmentFieldLabels;
|
|
229
|
-
confirmDialog: ConfirmDialogLabels;
|
|
230
|
-
floatingPanel: FloatingPanelLabels;
|
|
231
|
-
copyButton: CopyButtonLabels;
|
|
232
|
-
bulkActionBar: BulkActionBarLabels;
|
|
233
|
-
list: ListLabels;
|
|
234
|
-
breadcrumbs: BreadcrumbsLabels;
|
|
235
|
-
toast: ToastLabels;
|
|
236
|
-
}
|
|
237
|
-
/** Any subset of the tree, one level deep — each namespace may be partial, and a
|
|
238
|
-
* namespace that holds a record (`dataTable.presets`) is merged key by key. */
|
|
239
|
-
type UiKitLabelOverrides = {
|
|
240
|
-
[K in keyof UiKitLabels]?: Partial<UiKitLabels[K]>;
|
|
241
|
-
};
|
|
242
|
-
declare const DEFAULT_COMMON_LABELS: CommonLabels;
|
|
243
|
-
declare const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels;
|
|
244
|
-
declare const DEFAULT_COMBOBOX_LABELS: ComboboxLabels;
|
|
245
|
-
declare const DEFAULT_MULTI_SELECT_LABELS: MultiSelectLabels;
|
|
246
|
-
declare const DEFAULT_CALCULATOR_LABELS: CalculatorLabels;
|
|
247
|
-
declare const DEFAULT_CURRENCY_LABELS: CurrencyLabels;
|
|
248
|
-
declare const DEFAULT_APP_SHELL_LABELS: AppShellLabels;
|
|
249
|
-
declare const DEFAULT_TOP_BAR_LABELS: TopBarLabels;
|
|
250
|
-
declare const DEFAULT_PICKER_SHEET_LABELS: PickerSheetLabels;
|
|
251
|
-
declare const DEFAULT_SWIPEABLE_ROW_LABELS: SwipeableRowLabels;
|
|
252
|
-
/** Formats with the locale the provider was given (see {@link useKitFileLabels}).
|
|
253
|
-
* This static default has no locale to hand and falls back to the runtime's. */
|
|
254
|
-
declare const DEFAULT_FILE_LABELS: FileLabels;
|
|
255
|
-
/** "12 kB", "3.4 MB" — `Intl`'s unit formatting, so the digits, the decimal mark and
|
|
256
|
-
* the unit's spelling all follow `locale`. */
|
|
257
|
-
declare function formatFileSize(bytes: number, locale?: string): string;
|
|
258
|
-
interface UiKitProviderProps {
|
|
259
|
-
/** Any part of {@link UiKitLabels}. Missing keys fall back to English. */
|
|
260
|
-
labels?: UiKitLabelOverrides;
|
|
261
|
-
/**
|
|
262
|
-
* BCP 47 tag used by every kit component that formats something — dates, numbers,
|
|
263
|
-
* month and weekday names, file sizes — when it is not handed a `locale` prop of
|
|
264
|
-
* its own. Without a provider, and without a prop, those use the runtime default.
|
|
265
|
-
*/
|
|
266
|
-
locale?: string;
|
|
267
|
-
/**
|
|
268
|
-
* The first day of the week (0 = Sunday, 1 = Monday …) for every calendar below —
|
|
269
|
-
* `MiniCalendar` and the pickers built on it — that is not handed a `weekStartsOn`
|
|
270
|
-
* of its own. Without it the week start follows `locale`'s week info.
|
|
271
|
-
*
|
|
272
|
-
* Separate from `locale` because the two are separate decisions: a German-built
|
|
273
|
-
* app running in English (`locale="en"`) would otherwise start its weeks on Sunday,
|
|
274
|
-
* and switching it to `en-GB` to get Monday changes every date and number format.
|
|
275
|
-
*/
|
|
276
|
-
weekStartsOn?: WeekDay;
|
|
277
|
-
children: ReactNode;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Hand every kit component below this point its strings and its locale.
|
|
281
|
-
*
|
|
282
|
-
* Optional: a component outside any provider behaves exactly as it did before the
|
|
283
|
-
* provider existed. Nesting works as a merge — an inner provider overrides only what
|
|
284
|
-
* it names, so a page can re-label one table's `dataTable.table` without restating
|
|
285
|
-
* the language.
|
|
286
|
-
*/
|
|
287
|
-
declare function UiKitProvider({ labels, locale, weekStartsOn, children }: UiKitProviderProps): react.JSX.Element;
|
|
288
|
-
/** What the nearest provider says about one namespace — `undefined` outside one.
|
|
289
|
-
* For a component whose own resolver does more than a merge (the data table
|
|
290
|
-
* derives `columnsCount` from `columns`): feed `{ ...overrides, ...props }` to it. */
|
|
291
|
-
declare function useKitLabelOverrides<K extends keyof UiKitLabels>(ns: K): Partial<UiKitLabels[K]> | undefined;
|
|
292
|
-
/**
|
|
293
|
-
* One namespace, resolved: `defaults`, then the provider, then the component's own
|
|
294
|
-
* `prop`. Record-valued keys are merged key by key at each step.
|
|
295
|
-
*/
|
|
296
|
-
declare function useKitLabels<K extends keyof UiKitLabels>(ns: K, defaults: UiKitLabels[K], prop?: Partial<UiKitLabels[K]>): UiKitLabels[K];
|
|
297
|
-
/** The component's own `locale` prop, else the provider's, else `undefined` (which
|
|
298
|
-
* every `Intl` API reads as "the runtime's default"). */
|
|
299
|
-
declare function useKitLocale(prop?: string): string | undefined;
|
|
300
|
-
/** The week start the nearest `<UiKitProvider weekStartsOn>` pins, else `undefined`
|
|
301
|
-
* (the caller then asks the locale). A component's own prop goes first:
|
|
302
|
-
* `prop ?? useKitWeekStart()`. */
|
|
303
|
-
declare function useKitWeekStart(): WeekDay | undefined;
|
|
304
|
-
/** {@link DEFAULT_FILE_LABELS}, but formatting in the provider's locale. */
|
|
305
|
-
declare function useKitFileLabels(prop?: Partial<FileLabels>): FileLabels;
|
|
306
|
-
/**
|
|
307
|
-
* The dot paths of every key `labels` does NOT supply — the ones a translated app is
|
|
308
|
-
* still showing in English. Assert on it in the app's own test:
|
|
309
|
-
*
|
|
310
|
-
* expect(missingKitLabels(de)).toEqual([]);
|
|
311
|
-
*
|
|
312
|
-
* `reference` is the complete tree to check against — pass
|
|
313
|
-
* {@link DEFAULT_UI_KIT_LABELS} (src/i18n/defaults.ts). It is a parameter rather than an import
|
|
314
|
-
* because the defaults live beside their components, and this module is imported BY
|
|
315
|
-
* those components.
|
|
316
|
-
*/
|
|
317
|
-
declare function missingKitLabels(labels: UiKitLabelOverrides | undefined, reference: UiKitLabels): string[];
|
|
318
|
-
|
|
319
|
-
export { type AppShellLabels, type CalculatorLabels, type ComboboxLabels, type CommonLabels, type CurrencyLabels, DEFAULT_APP_SHELL_LABELS, DEFAULT_CALCULATOR_LABELS, DEFAULT_COMBOBOX_LABELS, DEFAULT_COMMON_LABELS, DEFAULT_CURRENCY_LABELS, DEFAULT_DATE_PICKER_LABELS, DEFAULT_FILE_LABELS, DEFAULT_MULTI_SELECT_LABELS, DEFAULT_PICKER_SHEET_LABELS, DEFAULT_SWIPEABLE_ROW_LABELS, DEFAULT_TOP_BAR_LABELS, type DatePickerLabels, type FileLabels, type MultiSelectLabels, type PickerSheetLabels, type SwipeableRowLabels, type TopBarLabels, type UiKitLabelOverrides, type UiKitLabels, UiKitProvider, type UiKitProviderProps, formatFileSize, missingKitLabels, useKitFileLabels, useKitLabelOverrides, useKitLabels, useKitLocale, useKitWeekStart };
|
|
51
|
+
import '../hooks/use-search-param-state.js';
|
|
52
|
+
import '../feedback/feedback-inbox.js';
|
|
53
|
+
import '../hooks/use-authed-src.js';
|
package/dist/i18n/kit-labels.js
CHANGED
|
@@ -14,7 +14,8 @@ const DEFAULT_COMMON_LABELS = {
|
|
|
14
14
|
loading: "Loading\u2026",
|
|
15
15
|
noResults: "No results",
|
|
16
16
|
fieldValue: (field, value) => `${field}: ${value}`,
|
|
17
|
-
dismiss: "Dismiss"
|
|
17
|
+
dismiss: "Dismiss",
|
|
18
|
+
opensInNewTab: "opens in a new tab"
|
|
18
19
|
};
|
|
19
20
|
const DEFAULT_DATE_PICKER_LABELS = {
|
|
20
21
|
panel: "Choose a date",
|
|
@@ -96,28 +97,38 @@ function formatFileSize(bytes, locale) {
|
|
|
96
97
|
}).format(value);
|
|
97
98
|
}
|
|
98
99
|
const KitI18nContext = createContext({});
|
|
99
|
-
function UiKitProvider({
|
|
100
|
+
function UiKitProvider({
|
|
101
|
+
labels,
|
|
102
|
+
locale,
|
|
103
|
+
weekStartsOn,
|
|
104
|
+
linkComponent,
|
|
105
|
+
children
|
|
106
|
+
}) {
|
|
100
107
|
const outer = useContext(KitI18nContext);
|
|
101
108
|
const value = useMemo(
|
|
102
109
|
() => ({
|
|
103
110
|
locale: locale ?? outer.locale,
|
|
104
111
|
weekStartsOn: weekStartsOn ?? outer.weekStartsOn,
|
|
105
|
-
labels: mergeOverrides(outer.labels, labels)
|
|
112
|
+
labels: mergeOverrides(outer.labels, labels),
|
|
113
|
+
linkComponent: linkComponent ?? outer.linkComponent
|
|
106
114
|
}),
|
|
107
|
-
[outer, labels, locale, weekStartsOn]
|
|
115
|
+
[outer, labels, locale, weekStartsOn, linkComponent]
|
|
108
116
|
);
|
|
109
117
|
return /* @__PURE__ */ jsx(KitI18nContext.Provider, { value, children });
|
|
110
118
|
}
|
|
111
119
|
function isRecord(v) {
|
|
112
120
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
113
121
|
}
|
|
122
|
+
function isLabelRecord(v) {
|
|
123
|
+
return isRecord(v) && !("$$typeof" in v);
|
|
124
|
+
}
|
|
114
125
|
function mergeNamespace(base, over) {
|
|
115
126
|
if (!over) return base;
|
|
116
127
|
const out = { ...base };
|
|
117
128
|
for (const [k, v] of Object.entries(over)) {
|
|
118
129
|
if (v === void 0) continue;
|
|
119
130
|
const prev = out[k];
|
|
120
|
-
out[k] =
|
|
131
|
+
out[k] = isLabelRecord(prev) && isLabelRecord(v) ? mergeNamespace(prev, v) : v;
|
|
121
132
|
}
|
|
122
133
|
return out;
|
|
123
134
|
}
|
|
@@ -144,6 +155,9 @@ function useKitLocale(prop) {
|
|
|
144
155
|
const fromProvider = useContext(KitI18nContext).locale;
|
|
145
156
|
return prop ?? fromProvider;
|
|
146
157
|
}
|
|
158
|
+
function useKitLink() {
|
|
159
|
+
return useContext(KitI18nContext).linkComponent;
|
|
160
|
+
}
|
|
147
161
|
function useKitWeekStart() {
|
|
148
162
|
return useContext(KitI18nContext).weekStartsOn;
|
|
149
163
|
}
|
|
@@ -190,6 +204,7 @@ export {
|
|
|
190
204
|
useKitFileLabels,
|
|
191
205
|
useKitLabelOverrides,
|
|
192
206
|
useKitLabels,
|
|
207
|
+
useKitLink,
|
|
193
208
|
useKitLocale,
|
|
194
209
|
useKitWeekStart
|
|
195
210
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/i18n/kit-labels.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { DataTableLabels } from \"../components/data-table-labels\";\nimport type { MiniCalendarLabels, WeekDay } from \"../components/mini-calendar\";\nimport type { CalendarHeatmapLabels } from \"../components/calendar-heatmap\";\nimport type { PopoverLabels } from \"../components/popover\";\nimport type { ChipInputLabels } from \"../components/chip\";\nimport type { FieldSyncLabels } from \"../components/field-sync\";\nimport type { PasswordRevealLabels, TabsLabels } from \"../components/ui\";\nimport type { WizardLabels } from \"../wizard/types\";\nimport type { TourLabels } from \"../tour/tour\";\nimport type { CommandPaletteLabels } from \"../search/command-palette\";\nimport type { GlobalSearchLabels } from \"../search/global-search\";\nimport type { MonthPickerLabels } from \"../components/month-picker\";\nimport type { PageContentsLabels } from \"../components/page-contents\";\nimport type { SeriesChartLabels } from \"../components/series-chart-labels\";\nimport type { SparklineLabels } from \"../components/sparkline\";\nimport type { StatTileLabels } from \"../components/stat-tile\";\nimport type { SignaturePadLabels } from \"../components/signature-pad\";\nimport type { PasswordStrengthLabels } from \"../components/password-strength\";\nimport type { DangerConfirmLabels } from \"../components/danger-confirm\";\nimport type { SwatchPickerLabels } from \"../components/swatch-picker\";\nimport type { IconPickerLabels } from \"../components/icon-picker\";\nimport type { DialogFrameLabels } from \"../components/dialog-frame\";\nimport type { FilePickerLabels } from \"../components/file-button\";\nimport type { MeasuredGridLabels } from \"../components/measured-grid\";\nimport type { FeedbackAttachmentFieldLabels } from \"../feedback/feedback-attachment\";\nimport type { ConfirmDialogLabels } from \"../components/confirm-dialog\";\nimport type { FloatingPanelLabels } from \"../components/floating-panel\";\nimport type { CopyButtonLabels } from \"../components/copy-button\";\nimport type { BulkActionBarLabels } from \"../components/bulk-action-bar\";\nimport type { ListLabels } from \"../components/list\";\nimport type { BreadcrumbsLabels } from \"../components/breadcrumbs\";\nimport type { ToastLabels } from \"../components/toast\";\n\n/**\n * EVERY string the kit renders, as one typed tree — and an optional provider that\n * hands it to every component at once.\n *\n * WHY THIS EXISTS. The kit ships no catalogue and resolves no strings, and that stays\n * true: the app supplies every word. What was wrong was HOW it had to supply them —\n * one `labels` prop per component instance, under a different prop name per\n * component (`labels`, `calendarLabels`, `passwordLabels`, `clearLabel`,\n * `searchPlaceholder`, `ariaLabel` …). A translated app therefore rendered English\n * wherever one call site forgot one prop, and nothing told it so: a German showcase\n * still said \"Rows per page\", \"Collapse sidebar\" and \"Popover\" in seven languages.\n *\n * Now there is one key per string, addressed by a dot path (`dataTable.pageSize`,\n * `datePicker.today`), and three sources in a fixed order of precedence:\n *\n * the component's own prop > <UiKitProvider labels> > English default\n *\n * A consumer writes its translation ONCE, as a `UiKitLabels` (or a partial of it),\n * mounts `<UiKitProvider labels={…} locale={…}>` at the root, and every kit component\n * below speaks that language — including the ones nested inside other kit components\n * (the calendar inside the data table's date filter, the popover inside the date\n * picker), which no prop at the outer call site could reach before.\n *\n * Messages that carry a value are FUNCTIONS of that value, never a template to fill:\n * a number glued into an English sentence is untranslatable, because the grammar\n * around it moves with it in most languages.\n */\n\n/* ── Namespaces that had no labels type of their own ─────────────────────── */\n\n/** The words several components share. A component's own namespace wins over these\n * where both exist; these are what a new component reaches for first. */\nexport interface CommonLabels {\n close: string;\n clear: string;\n search: string;\n done: string;\n cancel: string;\n save: string;\n back: string;\n next: string;\n remove: string;\n loading: string;\n noResults: string;\n /** \"Name: value\" — how a field's accessible name is composed with its value.\n * A colon-and-space is not universal punctuation (French puts a space before\n * the colon, Chinese uses a full-width one). */\n fieldValue: (field: string, value: string) => string;\n /** The × that puts away a banner or a notice (`AlertBanner onDismiss`). Not `close`:\n * nothing opened, and \"Close\" on a banner reads as closing the page it sits on. */\n dismiss: string;\n}\n\n/** `DatePicker` / `DateRangePicker` chrome. The calendar inside has its own\n * namespace, `miniCalendar`. */\nexport interface DatePickerLabels {\n /** Accessible name of the popover panel the calendar opens in. */\n panel: string;\n /** The same, for `DateRangePicker`'s panel. */\n rangePanel: string;\n clear: string;\n previousDay: string;\n nextDay: string;\n today: string;\n /** `DateRangePicker commit=\"apply\"`: the button that commits the drafted range. */\n apply: string;\n /** …and the one that discards it. */\n cancel: string;\n /** Accessible name of `DateRangePicker`'s preset column. */\n presets: string;\n}\n\n/** The whole combobox family: `Combobox`, `EntityCombobox`,\n * `MultiEntityCombobox`, `InlineEntityCombobox`, `Autocomplete`. */\nexport interface ComboboxLabels {\n search: string;\n noResults: string;\n clear: string;\n loading: string;\n /** The \"add this\" row when free entry is allowed. */\n create: (query: string) => string;\n /** Trigger summary once more than one value is picked. */\n selectedCount: (count: number) => string;\n /** An async lookup (`loadOptions`) failed. */\n loadError: string;\n /** Announced (live region) when the list settles on `count` > 0 rows. */\n resultCount: (count: number) => string;\n /** The query is shorter than the `minChars` a lookup needs. */\n minChars: (count: number) => string;\n}\n\nexport interface MultiSelectLabels {\n search: string;\n selectAll: string;\n clear: string;\n /** Trigger text when nothing is picked, which a multi-select reads as \"all\". */\n all: string;\n /** Trigger summary once some (but not all) values are picked. The English\n * default is the bare count, which is what the trigger has always shown. */\n selectedCount: (count: number) => string;\n}\n\n/** `CalculatorButton` (desktop popover keypad) and `NumberPadSheet` (phone sheet). */\nexport interface CalculatorLabels {\n /** The button that opens the calculator. */\n open: string;\n /** The popover / sheet itself. */\n panel: string;\n calculation: string;\n backspace: string;\n clear: string;\n equals: string;\n /** The primary key of the phone pad — visible text, not an aria-label. */\n done: string;\n /** Names of the operator keys and the decimal key. Their glyphs are not names a\n * screen reader agrees on — \"÷\" is read as \"division sign\", \"divided by\" or\n * nothing at all depending on the reader — so each says what it does. */\n plus: string;\n minus: string;\n times: string;\n divide: string;\n decimal: string;\n}\n\n/** `CurrencySelect` and the currency half of `AmountInput`. */\nexport interface CurrencyLabels {\n currency: string;\n search: string;\n}\n\nexport interface AppShellLabels {\n collapse: string;\n expand: string;\n /** Accessible name of an inline group's disclosure button (`subNav=\"inline\"`). */\n toggleGroup: (groupLabel: string) => string;\n}\n\nexport interface TopBarLabels {\n theme: string;\n palette: string;\n language: string;\n switchRole: string;\n /** The role switcher's tooltip, given the active role's name. */\n role: (value: string) => string;\n}\n\nexport interface PickerSheetLabels {\n close: string;\n}\n\nexport interface SwipeableRowLabels {\n actions: string;\n}\n\nexport interface FileLabels {\n /** A file size for display, given its size in BYTES. The default uses\n * `Intl.NumberFormat`'s unit formatting in the provider's locale. */\n size: (bytes: number) => string;\n}\n\n/** The complete tree. `UiKitProvider` takes any partial of it. */\nexport interface UiKitLabels {\n common: CommonLabels;\n dataTable: DataTableLabels;\n miniCalendar: MiniCalendarLabels;\n calendarHeatmap: CalendarHeatmapLabels;\n datePicker: DatePickerLabels;\n monthPicker: MonthPickerLabels;\n popover: PopoverLabels;\n combobox: ComboboxLabels;\n multiSelect: MultiSelectLabels;\n calculator: CalculatorLabels;\n currency: CurrencyLabels;\n chipInput: ChipInputLabels;\n fieldSync: FieldSyncLabels;\n passwordReveal: PasswordRevealLabels;\n tabs: TabsLabels;\n appShell: AppShellLabels;\n pageContents: PageContentsLabels;\n topBar: TopBarLabels;\n pickerSheet: PickerSheetLabels;\n swipeableRow: SwipeableRowLabels;\n file: FileLabels;\n wizard: WizardLabels;\n tour: TourLabels;\n commandPalette: CommandPaletteLabels;\n globalSearch: GlobalSearchLabels;\n seriesChart: SeriesChartLabels;\n sparkline: SparklineLabels;\n statTile: StatTileLabels;\n signaturePad: SignaturePadLabels;\n passwordStrength: PasswordStrengthLabels;\n dangerConfirm: DangerConfirmLabels;\n swatchPicker: SwatchPickerLabels;\n iconPicker: IconPickerLabels;\n dialogFrame: DialogFrameLabels;\n filePicker: FilePickerLabels;\n measuredGrid: MeasuredGridLabels;\n feedbackAttachment: FeedbackAttachmentFieldLabels;\n confirmDialog: ConfirmDialogLabels;\n floatingPanel: FloatingPanelLabels;\n copyButton: CopyButtonLabels;\n bulkActionBar: BulkActionBarLabels;\n list: ListLabels;\n breadcrumbs: BreadcrumbsLabels;\n toast: ToastLabels;\n}\n\n/** Any subset of the tree, one level deep — each namespace may be partial, and a\n * namespace that holds a record (`dataTable.presets`) is merged key by key. */\nexport type UiKitLabelOverrides = { [K in keyof UiKitLabels]?: Partial<UiKitLabels[K]> };\n\n/* ── English defaults for the namespaces defined here ────────────────────── */\n\nexport const DEFAULT_COMMON_LABELS: CommonLabels = {\n close: \"Close\",\n clear: \"Clear\",\n search: \"Search\",\n done: \"Done\",\n cancel: \"Cancel\",\n save: \"Save\",\n back: \"Back\",\n next: \"Next\",\n remove: \"Remove\",\n loading: \"Loading…\",\n noResults: \"No results\",\n fieldValue: (field, value) => `${field}: ${value}`,\n dismiss: \"Dismiss\",\n};\n\nexport const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels = {\n panel: \"Choose a date\",\n rangePanel: \"Choose a date range\",\n clear: \"Clear\",\n previousDay: \"Previous day\",\n nextDay: \"Next day\",\n today: \"Today\",\n apply: \"Apply\",\n cancel: \"Cancel\",\n presets: \"Quick ranges\",\n};\n\nexport const DEFAULT_COMBOBOX_LABELS: ComboboxLabels = {\n search: \"Search\",\n noResults: \"No results\",\n clear: \"Clear\",\n loading: \"Loading…\",\n create: (query) => `Create “${query}”`,\n selectedCount: (count) => `${count} selected`,\n loadError: \"Couldn’t load results\",\n resultCount: (count) => (count === 1 ? \"1 result\" : `${count} results`),\n minChars: (count) =>\n count === 1 ? \"Type at least 1 character\" : `Type at least ${count} characters`,\n};\n\nexport const DEFAULT_MULTI_SELECT_LABELS: MultiSelectLabels = {\n search: \"Search\",\n selectAll: \"Select all\",\n clear: \"Clear\",\n all: \"All\",\n selectedCount: (count) => String(count),\n};\n\nexport const DEFAULT_CALCULATOR_LABELS: CalculatorLabels = {\n open: \"Open calculator\",\n panel: \"Calculator\",\n calculation: \"Calculation\",\n backspace: \"Backspace\",\n clear: \"Clear\",\n equals: \"Equals\",\n done: \"Done\",\n plus: \"Plus\",\n minus: \"Minus\",\n times: \"Times\",\n divide: \"Divide\",\n decimal: \"Decimal point\",\n};\n\nexport const DEFAULT_CURRENCY_LABELS: CurrencyLabels = {\n currency: \"Currency\",\n search: \"Search currency\",\n};\n\nexport const DEFAULT_APP_SHELL_LABELS: AppShellLabels = {\n collapse: \"Collapse sidebar\",\n expand: \"Expand sidebar\",\n toggleGroup: (groupLabel) => `${groupLabel}: pages`,\n};\n\nexport const DEFAULT_TOP_BAR_LABELS: TopBarLabels = {\n theme: \"Toggle theme\",\n palette: \"Appearance preset\",\n language: \"Language\",\n switchRole: \"Switch role\",\n role: (value) => `Role: ${value}`,\n};\n\nexport const DEFAULT_PICKER_SHEET_LABELS: PickerSheetLabels = { close: \"Close\" };\n\nexport const DEFAULT_SWIPEABLE_ROW_LABELS: SwipeableRowLabels = { actions: \"Row actions\" };\n\n/** Formats with the locale the provider was given (see {@link useKitFileLabels}).\n * This static default has no locale to hand and falls back to the runtime's. */\nexport const DEFAULT_FILE_LABELS: FileLabels = {\n size: (bytes) => formatFileSize(bytes),\n};\n\n/** \"12 kB\", \"3.4 MB\" — `Intl`'s unit formatting, so the digits, the decimal mark and\n * the unit's spelling all follow `locale`. */\nexport function formatFileSize(bytes: number, locale?: string): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let i = 0;\n while (value >= 1000 && i < units.length - 1) {\n value /= 1000;\n i += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[i],\n unitDisplay: i === 0 ? \"long\" : \"short\",\n maximumFractionDigits: value < 10 && i > 0 ? 1 : 0,\n }).format(value);\n}\n\n/* ── The provider ────────────────────────────────────────────────────────── */\n\ninterface KitI18n {\n labels?: UiKitLabelOverrides;\n locale?: string;\n weekStartsOn?: WeekDay;\n}\n\nconst KitI18nContext = createContext<KitI18n>({});\n\nexport interface UiKitProviderProps {\n /** Any part of {@link UiKitLabels}. Missing keys fall back to English. */\n labels?: UiKitLabelOverrides;\n /**\n * BCP 47 tag used by every kit component that formats something — dates, numbers,\n * month and weekday names, file sizes — when it is not handed a `locale` prop of\n * its own. Without a provider, and without a prop, those use the runtime default.\n */\n locale?: string;\n /**\n * The first day of the week (0 = Sunday, 1 = Monday …) for every calendar below —\n * `MiniCalendar` and the pickers built on it — that is not handed a `weekStartsOn`\n * of its own. Without it the week start follows `locale`'s week info.\n *\n * Separate from `locale` because the two are separate decisions: a German-built\n * app running in English (`locale=\"en\"`) would otherwise start its weeks on Sunday,\n * and switching it to `en-GB` to get Monday changes every date and number format.\n */\n weekStartsOn?: WeekDay;\n children: ReactNode;\n}\n\n/**\n * Hand every kit component below this point its strings and its locale.\n *\n * Optional: a component outside any provider behaves exactly as it did before the\n * provider existed. Nesting works as a merge — an inner provider overrides only what\n * it names, so a page can re-label one table's `dataTable.table` without restating\n * the language.\n */\nexport function UiKitProvider({ labels, locale, weekStartsOn, children }: UiKitProviderProps) {\n const outer = useContext(KitI18nContext);\n const value = useMemo<KitI18n>(\n () => ({\n locale: locale ?? outer.locale,\n weekStartsOn: weekStartsOn ?? outer.weekStartsOn,\n labels: mergeOverrides(outer.labels, labels),\n }),\n [outer, labels, locale, weekStartsOn],\n );\n return <KitI18nContext.Provider value={value}>{children}</KitI18nContext.Provider>;\n}\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** Two levels: namespaces, and inside a namespace a record-valued key (presets). */\nfunction mergeNamespace<T extends object>(base: T, over: Partial<T> | undefined): T {\n if (!over) return base;\n const out = { ...base } as Record<string, unknown>;\n for (const [k, v] of Object.entries(over)) {\n if (v === undefined) continue;\n const prev = out[k];\n out[k] = isRecord(prev) && isRecord(v) ? { ...prev, ...v } : v;\n }\n return out as T;\n}\n\nfunction mergeOverrides(\n a: UiKitLabelOverrides | undefined,\n b: UiKitLabelOverrides | undefined,\n): UiKitLabelOverrides | undefined {\n if (!a) return b;\n if (!b) return a;\n const out: Record<string, unknown> = { ...a };\n for (const [ns, v] of Object.entries(b)) {\n out[ns] = mergeNamespace((out[ns] as object | undefined) ?? {}, v as object);\n }\n return out as UiKitLabelOverrides;\n}\n\n/** What the nearest provider says about one namespace — `undefined` outside one.\n * For a component whose own resolver does more than a merge (the data table\n * derives `columnsCount` from `columns`): feed `{ ...overrides, ...props }` to it. */\nexport function useKitLabelOverrides<K extends keyof UiKitLabels>(\n ns: K,\n): Partial<UiKitLabels[K]> | undefined {\n return useContext(KitI18nContext).labels?.[ns] as Partial<UiKitLabels[K]> | undefined;\n}\n\n/**\n * One namespace, resolved: `defaults`, then the provider, then the component's own\n * `prop`. Record-valued keys are merged key by key at each step.\n */\nexport function useKitLabels<K extends keyof UiKitLabels>(\n ns: K,\n defaults: UiKitLabels[K],\n prop?: Partial<UiKitLabels[K]>,\n): UiKitLabels[K] {\n const fromProvider = useKitLabelOverrides(ns);\n return useMemo(\n () => mergeNamespace(mergeNamespace(defaults, fromProvider), prop),\n [defaults, fromProvider, prop],\n );\n}\n\n/** The component's own `locale` prop, else the provider's, else `undefined` (which\n * every `Intl` API reads as \"the runtime's default\"). */\nexport function useKitLocale(prop?: string): string | undefined {\n const fromProvider = useContext(KitI18nContext).locale;\n return prop ?? fromProvider;\n}\n\n/** The week start the nearest `<UiKitProvider weekStartsOn>` pins, else `undefined`\n * (the caller then asks the locale). A component's own prop goes first:\n * `prop ?? useKitWeekStart()`. */\nexport function useKitWeekStart(): WeekDay | undefined {\n return useContext(KitI18nContext).weekStartsOn;\n}\n\n/** {@link DEFAULT_FILE_LABELS}, but formatting in the provider's locale. */\nexport function useKitFileLabels(prop?: Partial<FileLabels>): FileLabels {\n const locale = useKitLocale();\n const defaults = useMemo<FileLabels>(\n () => ({ size: (bytes) => formatFileSize(bytes, locale) }),\n [locale],\n );\n return useKitLabels(\"file\", defaults, prop);\n}\n\n/**\n * The dot paths of every key `labels` does NOT supply — the ones a translated app is\n * still showing in English. Assert on it in the app's own test:\n *\n * expect(missingKitLabels(de)).toEqual([]);\n *\n * `reference` is the complete tree to check against — pass\n * {@link DEFAULT_UI_KIT_LABELS} (src/i18n/defaults.ts). It is a parameter rather than an import\n * because the defaults live beside their components, and this module is imported BY\n * those components.\n */\nexport function missingKitLabels(\n labels: UiKitLabelOverrides | undefined,\n reference: UiKitLabels,\n): string[] {\n const missing: string[] = [];\n for (const [ns, keys] of Object.entries(reference)) {\n const given = (labels as Record<string, Record<string, unknown> | undefined> | undefined)?.[ns];\n for (const [key, value] of Object.entries(keys as Record<string, unknown>)) {\n const got = given?.[key];\n if (got === undefined) {\n missing.push(`${ns}.${key}`);\n } else if (isRecord(value) && isRecord(got)) {\n for (const sub of Object.keys(value)) {\n if (got[sub] === undefined) missing.push(`${ns}.${key}.${sub}`);\n }\n }\n }\n }\n return missing;\n}\n"],"mappings":";AA0ZS;AA1ZT,SAAS,eAAe,YAAY,eAAe;AAyP5C,MAAM,wBAAsC;AAAA,EACjD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY,CAAC,OAAO,UAAU,GAAG,KAAK,KAAK,KAAK;AAAA,EAChD,SAAS;AACX;AAEO,MAAM,6BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,MAAM,0BAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ,CAAC,UAAU,gBAAW,KAAK;AAAA,EACnC,eAAe,CAAC,UAAU,GAAG,KAAK;AAAA,EA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
|
1
|
+
{"version":3,"sources":["../../src/i18n/kit-labels.tsx"],"sourcesContent":["import { createContext, useContext, useMemo } from \"react\";\nimport type { AnchorHTMLAttributes, ReactElement, Ref } from \"react\";\nimport type { ReactNode } from \"react\";\nimport type { DataTableLabels } from \"../components/data-table-labels\";\nimport type { MiniCalendarLabels, WeekDay } from \"../components/mini-calendar\";\nimport type { CalendarHeatmapLabels } from \"../components/calendar-heatmap\";\nimport type { PopoverLabels } from \"../components/popover\";\nimport type { ChipInputLabels } from \"../components/chip\";\nimport type { FieldSyncLabels } from \"../components/field-sync\";\nimport type { PasswordRevealLabels, TabsLabels } from \"../components/ui\";\nimport type { WizardLabels } from \"../wizard/types\";\nimport type { TourLabels } from \"../tour/tour\";\nimport type { CommandPaletteLabels } from \"../search/command-palette\";\nimport type { GlobalSearchLabels } from \"../search/global-search\";\nimport type { MonthPickerLabels } from \"../components/month-picker\";\nimport type { PageContentsLabels } from \"../components/page-contents\";\nimport type { SeriesChartLabels } from \"../components/series-chart-labels\";\nimport type { PieChartLabels } from \"../components/pie-chart-labels\";\nimport type { SparklineLabels } from \"../components/sparkline\";\nimport type { StatTileLabels } from \"../components/stat-tile\";\nimport type { SignaturePadLabels } from \"../components/signature-pad\";\nimport type { PasswordStrengthLabels } from \"../components/password-strength\";\nimport type { DangerConfirmLabels } from \"../components/danger-confirm\";\nimport type { SwatchPickerLabels } from \"../components/swatch-picker\";\nimport type { IconPickerLabels } from \"../components/icon-picker\";\nimport type { DialogFrameLabels } from \"../components/dialog-frame\";\nimport type { FilePickerLabels } from \"../components/file-button\";\nimport type { MeasuredGridLabels } from \"../components/measured-grid\";\nimport type { FeedbackAttachmentFieldLabels } from \"../feedback/feedback-attachment\";\nimport type { FeedbackDialogTextLabels } from \"../feedback/feedback-dialog\";\nimport type { FeedbackComposerLabels, FeedbackThreadLabels } from \"../feedback/feedback-thread\";\nimport type { AccountSettingsLabels } from \"../components/account-settings-labels\";\nimport type { ConfirmDialogLabels } from \"../components/confirm-dialog\";\nimport type { FloatingPanelLabels } from \"../components/floating-panel\";\nimport type { CopyButtonLabels } from \"../components/copy-button\";\nimport type { BulkActionBarLabels } from \"../components/bulk-action-bar\";\nimport type { ListLabels } from \"../components/list\";\nimport type { BreadcrumbsLabels } from \"../components/breadcrumbs\";\nimport type { ToastLabels } from \"../components/toast\";\nimport type { FormActionsLabels } from \"../components/form-actions\";\nimport type { DescriptionListLabels } from \"../components/description-list\";\nimport type { LineItemsLabels } from \"../components/line-items\";\nimport type { ProgressBarLabels } from \"../components/progress-bar\";\nimport type { SignedAmountLabels } from \"../components/signed-amount\";\nimport type { ErrorBoundaryLabels } from \"../components/error-boundary\";\nimport type { AuthedImageLabels } from \"../components/authed-image\";\nimport type { ImageGridLabels } from \"../components/image-grid\";\nimport type { LightboxLabels } from \"../components/lightbox\";\n\n/**\n * EVERY string the kit renders, as one typed tree — and an optional provider that\n * hands it to every component at once.\n *\n * WHY THIS EXISTS. The kit ships no catalogue and resolves no strings, and that stays\n * true: the app supplies every word. What was wrong was HOW it had to supply them —\n * one `labels` prop per component instance, under a different prop name per\n * component (`labels`, `calendarLabels`, `passwordLabels`, `clearLabel`,\n * `searchPlaceholder`, `ariaLabel` …). A translated app therefore rendered English\n * wherever one call site forgot one prop, and nothing told it so: a German showcase\n * still said \"Rows per page\", \"Collapse sidebar\" and \"Popover\" in seven languages.\n *\n * Now there is one key per string, addressed by a dot path (`dataTable.pageSize`,\n * `datePicker.today`), and three sources in a fixed order of precedence:\n *\n * the component's own prop > <UiKitProvider labels> > English default\n *\n * A consumer writes its translation ONCE, as a `UiKitLabels` (or a partial of it),\n * mounts `<UiKitProvider labels={…} locale={…}>` at the root, and every kit component\n * below speaks that language — including the ones nested inside other kit components\n * (the calendar inside the data table's date filter, the popover inside the date\n * picker), which no prop at the outer call site could reach before.\n *\n * Messages that carry a value are FUNCTIONS of that value, never a template to fill:\n * a number glued into an English sentence is untranslatable, because the grammar\n * around it moves with it in most languages.\n */\n\n/* ── Namespaces that had no labels type of their own ─────────────────────── */\n\n/** The words several components share. A component's own namespace wins over these\n * where both exist; these are what a new component reaches for first. */\nexport interface CommonLabels {\n close: string;\n clear: string;\n search: string;\n done: string;\n cancel: string;\n save: string;\n back: string;\n next: string;\n remove: string;\n loading: string;\n noResults: string;\n /** \"Name: value\" — how a field's accessible name is composed with its value.\n * A colon-and-space is not universal punctuation (French puts a space before\n * the colon, Chinese uses a full-width one). */\n fieldValue: (field: string, value: string) => string;\n /** The × that puts away a banner or a notice (`AlertBanner onDismiss`). Not `close`:\n * nothing opened, and \"Close\" on a banner reads as closing the page it sits on. */\n dismiss: string;\n /** Read after a link that opens a new tab (`<Button href external>`, TextLink):\n * nothing else tells a screen reader the page is about to change tabs. */\n opensInNewTab: string;\n}\n\n/** `DatePicker` / `DateRangePicker` chrome. The calendar inside has its own\n * namespace, `miniCalendar`. */\nexport interface DatePickerLabels {\n /** Accessible name of the popover panel the calendar opens in. */\n panel: string;\n /** The same, for `DateRangePicker`'s panel. */\n rangePanel: string;\n clear: string;\n previousDay: string;\n nextDay: string;\n today: string;\n /** `DateRangePicker commit=\"apply\"`: the button that commits the drafted range. */\n apply: string;\n /** …and the one that discards it. */\n cancel: string;\n /** Accessible name of `DateRangePicker`'s preset column. */\n presets: string;\n}\n\n/** The whole combobox family: `Combobox`, `EntityCombobox`,\n * `MultiEntityCombobox`, `InlineEntityCombobox`, `Autocomplete`. */\nexport interface ComboboxLabels {\n search: string;\n noResults: string;\n clear: string;\n loading: string;\n /** The \"add this\" row when free entry is allowed. */\n create: (query: string) => string;\n /** Trigger summary once more than one value is picked. */\n selectedCount: (count: number) => string;\n /** An async lookup (`loadOptions`) failed. */\n loadError: string;\n /** Announced (live region) when the list settles on `count` > 0 rows. */\n resultCount: (count: number) => string;\n /** The query is shorter than the `minChars` a lookup needs. */\n minChars: (count: number) => string;\n}\n\nexport interface MultiSelectLabels {\n search: string;\n selectAll: string;\n clear: string;\n /** Trigger text when nothing is picked, which a multi-select reads as \"all\". */\n all: string;\n /** Trigger summary once some (but not all) values are picked. The English\n * default is the bare count, which is what the trigger has always shown. */\n selectedCount: (count: number) => string;\n}\n\n/** `CalculatorButton` (desktop popover keypad) and `NumberPadSheet` (phone sheet). */\nexport interface CalculatorLabels {\n /** The button that opens the calculator. */\n open: string;\n /** The popover / sheet itself. */\n panel: string;\n calculation: string;\n backspace: string;\n clear: string;\n equals: string;\n /** The primary key of the phone pad — visible text, not an aria-label. */\n done: string;\n /** Names of the operator keys and the decimal key. Their glyphs are not names a\n * screen reader agrees on — \"÷\" is read as \"division sign\", \"divided by\" or\n * nothing at all depending on the reader — so each says what it does. */\n plus: string;\n minus: string;\n times: string;\n divide: string;\n decimal: string;\n}\n\n/** `CurrencySelect` and the currency half of `AmountInput`. */\nexport interface CurrencyLabels {\n currency: string;\n search: string;\n}\n\nexport interface AppShellLabels {\n collapse: string;\n expand: string;\n /** Accessible name of an inline group's disclosure button (`subNav=\"inline\"`). */\n toggleGroup: (groupLabel: string) => string;\n}\n\nexport interface TopBarLabels {\n theme: string;\n palette: string;\n language: string;\n switchRole: string;\n /** The role switcher's tooltip, given the active role's name. */\n role: (value: string) => string;\n}\n\nexport interface PickerSheetLabels {\n close: string;\n}\n\nexport interface SwipeableRowLabels {\n actions: string;\n}\n\nexport interface FileLabels {\n /** A file size for display, given its size in BYTES. The default uses\n * `Intl.NumberFormat`'s unit formatting in the provider's locale. */\n size: (bytes: number) => string;\n}\n\n/** The complete tree. `UiKitProvider` takes any partial of it. */\nexport interface UiKitLabels {\n common: CommonLabels;\n dataTable: DataTableLabels;\n miniCalendar: MiniCalendarLabels;\n calendarHeatmap: CalendarHeatmapLabels;\n datePicker: DatePickerLabels;\n monthPicker: MonthPickerLabels;\n popover: PopoverLabels;\n combobox: ComboboxLabels;\n multiSelect: MultiSelectLabels;\n calculator: CalculatorLabels;\n currency: CurrencyLabels;\n chipInput: ChipInputLabels;\n fieldSync: FieldSyncLabels;\n passwordReveal: PasswordRevealLabels;\n tabs: TabsLabels;\n appShell: AppShellLabels;\n pageContents: PageContentsLabels;\n topBar: TopBarLabels;\n pickerSheet: PickerSheetLabels;\n swipeableRow: SwipeableRowLabels;\n file: FileLabels;\n wizard: WizardLabels;\n tour: TourLabels;\n commandPalette: CommandPaletteLabels;\n globalSearch: GlobalSearchLabels;\n seriesChart: SeriesChartLabels;\n pieChart: PieChartLabels;\n sparkline: SparklineLabels;\n statTile: StatTileLabels;\n signaturePad: SignaturePadLabels;\n passwordStrength: PasswordStrengthLabels;\n dangerConfirm: DangerConfirmLabels;\n swatchPicker: SwatchPickerLabels;\n iconPicker: IconPickerLabels;\n dialogFrame: DialogFrameLabels;\n filePicker: FilePickerLabels;\n measuredGrid: MeasuredGridLabels;\n feedbackAttachment: FeedbackAttachmentFieldLabels;\n /** 0.12.0: `FeedbackDialog`'s own strings; `FeedbackThread` / `FeedbackComposer`. */\n feedbackDialog: FeedbackDialogTextLabels;\n feedbackThread: FeedbackThreadLabels;\n feedbackComposer: FeedbackComposerLabels;\n /** 0.12.0: `ProfileSetting`, `PasswordSetting`, `TwoFactorSetting`, `PasskeysSetting`\n * — one record per section. The provider takes a whole section record; the\n * components merge it key by key, as a prop. */\n accountSettings: AccountSettingsLabels;\n confirmDialog: ConfirmDialogLabels;\n floatingPanel: FloatingPanelLabels;\n copyButton: CopyButtonLabels;\n bulkActionBar: BulkActionBarLabels;\n list: ListLabels;\n breadcrumbs: BreadcrumbsLabels;\n toast: ToastLabels;\n form: FormActionsLabels;\n descriptionList: DescriptionListLabels;\n lineItems: LineItemsLabels;\n progressBar: ProgressBarLabels;\n signedAmount: SignedAmountLabels;\n errorBoundary: ErrorBoundaryLabels;\n authedImage: AuthedImageLabels;\n imageGrid: ImageGridLabels;\n lightbox: LightboxLabels;\n}\n\n/**\n * A label override, as deep as the labels go: an object of labels (a namespace, or a\n * record inside one such as `accountSettings.passkeys` or `dataTable.presets`) may be\n * partial at every level, because the provider merges it key by key at every level.\n * A leaf stays as it is: a string, a function-valued label (`(n) => …`), and anything\n * that is not purely an object (a `ReactNode` union) is given whole.\n */\nexport type LabelOverride<T> = [T] extends [(...args: never[]) => unknown]\n ? T\n : [T] extends [readonly unknown[]]\n ? T\n : [T] extends [object]\n ? { [K in keyof T]?: LabelOverride<T[K]> }\n : T;\n\n/** Any subset of the tree — each namespace may be partial, and so may any record\n * inside one (`accountSettings.passkeys`, `dataTable.presets`): they are merged key\n * by key, at every depth. */\nexport type UiKitLabelOverrides = { [K in keyof UiKitLabels]?: LabelOverride<UiKitLabels[K]> };\n\n/* ── English defaults for the namespaces defined here ────────────────────── */\n\nexport const DEFAULT_COMMON_LABELS: CommonLabels = {\n close: \"Close\",\n clear: \"Clear\",\n search: \"Search\",\n done: \"Done\",\n cancel: \"Cancel\",\n save: \"Save\",\n back: \"Back\",\n next: \"Next\",\n remove: \"Remove\",\n loading: \"Loading…\",\n noResults: \"No results\",\n fieldValue: (field, value) => `${field}: ${value}`,\n dismiss: \"Dismiss\",\n opensInNewTab: \"opens in a new tab\",\n};\n\nexport const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels = {\n panel: \"Choose a date\",\n rangePanel: \"Choose a date range\",\n clear: \"Clear\",\n previousDay: \"Previous day\",\n nextDay: \"Next day\",\n today: \"Today\",\n apply: \"Apply\",\n cancel: \"Cancel\",\n presets: \"Quick ranges\",\n};\n\nexport const DEFAULT_COMBOBOX_LABELS: ComboboxLabels = {\n search: \"Search\",\n noResults: \"No results\",\n clear: \"Clear\",\n loading: \"Loading…\",\n create: (query) => `Create “${query}”`,\n selectedCount: (count) => `${count} selected`,\n loadError: \"Couldn’t load results\",\n resultCount: (count) => (count === 1 ? \"1 result\" : `${count} results`),\n minChars: (count) =>\n count === 1 ? \"Type at least 1 character\" : `Type at least ${count} characters`,\n};\n\nexport const DEFAULT_MULTI_SELECT_LABELS: MultiSelectLabels = {\n search: \"Search\",\n selectAll: \"Select all\",\n clear: \"Clear\",\n all: \"All\",\n selectedCount: (count) => String(count),\n};\n\nexport const DEFAULT_CALCULATOR_LABELS: CalculatorLabels = {\n open: \"Open calculator\",\n panel: \"Calculator\",\n calculation: \"Calculation\",\n backspace: \"Backspace\",\n clear: \"Clear\",\n equals: \"Equals\",\n done: \"Done\",\n plus: \"Plus\",\n minus: \"Minus\",\n times: \"Times\",\n divide: \"Divide\",\n decimal: \"Decimal point\",\n};\n\nexport const DEFAULT_CURRENCY_LABELS: CurrencyLabels = {\n currency: \"Currency\",\n search: \"Search currency\",\n};\n\nexport const DEFAULT_APP_SHELL_LABELS: AppShellLabels = {\n collapse: \"Collapse sidebar\",\n expand: \"Expand sidebar\",\n toggleGroup: (groupLabel) => `${groupLabel}: pages`,\n};\n\nexport const DEFAULT_TOP_BAR_LABELS: TopBarLabels = {\n theme: \"Toggle theme\",\n palette: \"Appearance preset\",\n language: \"Language\",\n switchRole: \"Switch role\",\n role: (value) => `Role: ${value}`,\n};\n\nexport const DEFAULT_PICKER_SHEET_LABELS: PickerSheetLabels = { close: \"Close\" };\n\nexport const DEFAULT_SWIPEABLE_ROW_LABELS: SwipeableRowLabels = { actions: \"Row actions\" };\n\n/** Formats with the locale the provider was given (see {@link useKitFileLabels}).\n * This static default has no locale to hand and falls back to the runtime's. */\nexport const DEFAULT_FILE_LABELS: FileLabels = {\n size: (bytes) => formatFileSize(bytes),\n};\n\n/** \"12 kB\", \"3.4 MB\" — `Intl`'s unit formatting, so the digits, the decimal mark and\n * the unit's spelling all follow `locale`. */\nexport function formatFileSize(bytes: number, locale?: string): string {\n const units = [\"byte\", \"kilobyte\", \"megabyte\", \"gigabyte\"] as const;\n let value = bytes;\n let i = 0;\n while (value >= 1000 && i < units.length - 1) {\n value /= 1000;\n i += 1;\n }\n return new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: units[i],\n unitDisplay: i === 0 ? \"long\" : \"short\",\n maximumFractionDigits: value < 10 && i > 0 ? 1 : 0,\n }).format(value);\n}\n\n/* ── The provider ────────────────────────────────────────────────────────── */\n\ninterface KitI18n {\n labels?: UiKitLabelOverrides;\n locale?: string;\n weekStartsOn?: WeekDay;\n linkComponent?: KitLinkComponent;\n}\n\n/**\n * What every kit link receives: the anchor attributes the kit decided (href, class,\n * aria-current, handlers, children, ref). An app's router link maps them —\n * `({ href, ...p }) => <Link to={href} {...p} />` — ONCE, on the provider.\n */\nexport type KitLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n ref?: Ref<HTMLAnchorElement>;\n};\nexport type KitLinkComponent = (props: KitLinkProps) => ReactElement;\n\nconst KitI18nContext = createContext<KitI18n>({});\n\nexport interface UiKitProviderProps {\n /** Any part of {@link UiKitLabels}. Missing keys fall back to English. */\n labels?: UiKitLabelOverrides;\n /**\n * BCP 47 tag used by every kit component that formats something — dates, numbers,\n * month and weekday names, file sizes — when it is not handed a `locale` prop of\n * its own. Without a provider, and without a prop, those use the runtime default.\n */\n locale?: string;\n /**\n * The first day of the week (0 = Sunday, 1 = Monday …) for every calendar below —\n * `MiniCalendar` and the pickers built on it — that is not handed a `weekStartsOn`\n * of its own. Without it the week start follows `locale`'s week info.\n *\n * Separate from `locale` because the two are separate decisions: a German-built\n * app running in English (`locale=\"en\"`) would otherwise start its weeks on Sunday,\n * and switching it to `en-GB` to get Monday changes every date and number format.\n */\n weekStartsOn?: WeekDay;\n /**\n * The app's router link, used by every kit component that renders an in-app link\n * and was not handed its own `renderLink` — so `renderLink` stops being repeated on\n * each ListItem, Breadcrumbs, StatTile, Chip… (kastlan). A component's own\n * `renderLink` wins; external links and in-page `#anchor`s stay plain `<a>`, and a\n * hash-router `#/path` is handed to it like `/path` (see `pickLinkRenderer`).\n */\n linkComponent?: KitLinkComponent;\n children: ReactNode;\n}\n\n/**\n * Hand every kit component below this point its strings and its locale.\n *\n * Optional: a component outside any provider behaves exactly as it did before the\n * provider existed. Nesting works as a merge — an inner provider overrides only what\n * it names, so a page can re-label one table's `dataTable.table` without restating\n * the language.\n */\nexport function UiKitProvider({\n labels,\n locale,\n weekStartsOn,\n linkComponent,\n children,\n}: UiKitProviderProps) {\n const outer = useContext(KitI18nContext);\n const value = useMemo<KitI18n>(\n () => ({\n locale: locale ?? outer.locale,\n weekStartsOn: weekStartsOn ?? outer.weekStartsOn,\n labels: mergeOverrides(outer.labels, labels),\n linkComponent: linkComponent ?? outer.linkComponent,\n }),\n [outer, labels, locale, weekStartsOn, linkComponent],\n );\n return <KitI18nContext.Provider value={value}>{children}</KitI18nContext.Provider>;\n}\n\nfunction isRecord(v: unknown): v is Record<string, unknown> {\n return typeof v === \"object\" && v !== null && !Array.isArray(v);\n}\n\n/** A record of labels to merge into — not a React element, which is an object too but\n * is a label given whole. */\nfunction isLabelRecord(v: unknown): v is Record<string, unknown> {\n return isRecord(v) && !(\"$$typeof\" in v);\n}\n\n/** Merged key by key at EVERY depth — a namespace, a record inside it\n * (`accountSettings.passkeys`, `dataTable.presets`), and so on down — to match\n * {@link LabelOverride}. An `undefined` is skipped at every depth, so it never blanks\n * out what is under it. */\nfunction mergeNamespace<T extends object>(base: T, over: LabelOverride<T> | Partial<T> | undefined): T {\n if (!over) return base;\n const out = { ...base } as Record<string, unknown>;\n for (const [k, v] of Object.entries(over)) {\n if (v === undefined) continue;\n const prev = out[k];\n out[k] = isLabelRecord(prev) && isLabelRecord(v) ? mergeNamespace(prev, v) : v;\n }\n return out as T;\n}\n\nfunction mergeOverrides(\n a: UiKitLabelOverrides | undefined,\n b: UiKitLabelOverrides | undefined,\n): UiKitLabelOverrides | undefined {\n if (!a) return b;\n if (!b) return a;\n const out: Record<string, unknown> = { ...a };\n for (const [ns, v] of Object.entries(b)) {\n out[ns] = mergeNamespace((out[ns] as object | undefined) ?? {}, v as object);\n }\n return out as UiKitLabelOverrides;\n}\n\n/** What the nearest provider says about one namespace — `undefined` outside one.\n * For a component whose own resolver does more than a merge (the data table\n * derives `columnsCount` from `columns`): feed `{ ...overrides, ...props }` to it. */\nexport function useKitLabelOverrides<K extends keyof UiKitLabels>(\n ns: K,\n): Partial<UiKitLabels[K]> | undefined {\n return useContext(KitI18nContext).labels?.[ns] as Partial<UiKitLabels[K]> | undefined;\n}\n\n/**\n * One namespace, resolved: `defaults`, then the provider, then the component's own\n * `prop`. Record-valued keys are merged key by key at each step.\n */\nexport function useKitLabels<K extends keyof UiKitLabels>(\n ns: K,\n defaults: UiKitLabels[K],\n prop?: Partial<UiKitLabels[K]>,\n): UiKitLabels[K] {\n const fromProvider = useKitLabelOverrides(ns);\n return useMemo(\n () => mergeNamespace(mergeNamespace(defaults, fromProvider), prop),\n [defaults, fromProvider, prop],\n );\n}\n\n/** The component's own `locale` prop, else the provider's, else `undefined` (which\n * every `Intl` API reads as \"the runtime's default\"). */\nexport function useKitLocale(prop?: string): string | undefined {\n const fromProvider = useContext(KitI18nContext).locale;\n return prop ?? fromProvider;\n}\n\n/** The week start the nearest `<UiKitProvider weekStartsOn>` pins, else `undefined`\n * (the caller then asks the locale). A component's own prop goes first:\n * `prop ?? useKitWeekStart()`. */\n/** The provider's router link, or `undefined` — a component's own `renderLink` should\n * win over it: `const Link = renderLink ?? useKitLink()`. */\nexport function useKitLink(): KitLinkComponent | undefined {\n return useContext(KitI18nContext).linkComponent;\n}\n\nexport function useKitWeekStart(): WeekDay | undefined {\n return useContext(KitI18nContext).weekStartsOn;\n}\n\n/** {@link DEFAULT_FILE_LABELS}, but formatting in the provider's locale. */\nexport function useKitFileLabels(prop?: Partial<FileLabels>): FileLabels {\n const locale = useKitLocale();\n const defaults = useMemo<FileLabels>(\n () => ({ size: (bytes) => formatFileSize(bytes, locale) }),\n [locale],\n );\n return useKitLabels(\"file\", defaults, prop);\n}\n\n/**\n * The dot paths of every key `labels` does NOT supply — the ones a translated app is\n * still showing in English. Assert on it in the app's own test:\n *\n * expect(missingKitLabels(de)).toEqual([]);\n *\n * `reference` is the complete tree to check against — pass\n * {@link DEFAULT_UI_KIT_LABELS} (src/i18n/defaults.ts). It is a parameter rather than an import\n * because the defaults live beside their components, and this module is imported BY\n * those components.\n */\nexport function missingKitLabels(\n labels: UiKitLabelOverrides | undefined,\n reference: UiKitLabels,\n): string[] {\n const missing: string[] = [];\n for (const [ns, keys] of Object.entries(reference)) {\n const given = (labels as Record<string, Record<string, unknown> | undefined> | undefined)?.[ns];\n for (const [key, value] of Object.entries(keys as Record<string, unknown>)) {\n const got = given?.[key];\n if (got === undefined) {\n missing.push(`${ns}.${key}`);\n } else if (isRecord(value) && isRecord(got)) {\n for (const sub of Object.keys(value)) {\n if (got[sub] === undefined) missing.push(`${ns}.${key}.${sub}`);\n }\n }\n }\n }\n return missing;\n}\n"],"mappings":";AAyeS;AAzeT,SAAS,eAAe,YAAY,eAAe;AA4S5C,MAAM,wBAAsC;AAAA,EACjD,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,MAAM;AAAA,EACN,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,WAAW;AAAA,EACX,YAAY,CAAC,OAAO,UAAU,GAAG,KAAK,KAAK,KAAK;AAAA,EAChD,SAAS;AAAA,EACT,eAAe;AACjB;AAEO,MAAM,6BAA+C;AAAA,EAC1D,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,aAAa;AAAA,EACb,SAAS;AAAA,EACT,OAAO;AAAA,EACP,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,SAAS;AACX;AAEO,MAAM,0BAA0C;AAAA,EACrD,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,OAAO;AAAA,EACP,SAAS;AAAA,EACT,QAAQ,CAAC,UAAU,gBAAW,KAAK;AAAA,EACnC,eAAe,CAAC,UAAU,GAAG,KAAK;AAAA,EAClC,WAAW;AAAA,EACX,aAAa,CAAC,UAAW,UAAU,IAAI,aAAa,GAAG,KAAK;AAAA,EAC5D,UAAU,CAAC,UACT,UAAU,IAAI,8BAA8B,iBAAiB,KAAK;AACtE;AAEO,MAAM,8BAAiD;AAAA,EAC5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AACT;","names":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UiKitLabels } from '
|
|
1
|
+
import { aT as UiKitLabels } from '../../kit-labels-v3biUF1L.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
|
* Swiss Standard German, informal ("du"): the informal German labels with Swiss
|