@eifi1/ui-kit 0.21.0 → 0.23.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 +42 -25
- package/dist/chart.d.ts +19 -14
- package/dist/components/account-chips.d.ts +10 -3
- package/dist/components/account-chips.js +5 -2
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/account-settings.d.ts +33 -2
- package/dist/components/account-settings.js +43 -21
- package/dist/components/account-settings.js.map +1 -1
- package/dist/components/amount-input.d.ts +53 -14
- package/dist/components/amount-input.js +17 -28
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.d.ts +29 -0
- package/dist/components/autocomplete.js +134 -104
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-group.d.ts +19 -14
- package/dist/components/calculator.d.ts +19 -14
- package/dist/components/checkbox-group.d.ts +104 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox-group.js.map +1 -0
- package/dist/components/checkbox.d.ts +19 -0
- package/dist/components/checkbox.js +30 -7
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip.d.ts +18 -0
- package/dist/components/chip.js +47 -10
- package/dist/components/chip.js.map +1 -1
- package/dist/components/column-mapper.d.ts +182 -0
- package/dist/components/column-mapper.js +375 -0
- package/dist/components/column-mapper.js.map +1 -0
- package/dist/components/combobox-core.d.ts +39 -2
- package/dist/components/combobox-core.js +29 -6
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox.d.ts +91 -2
- package/dist/components/combobox.js +454 -308
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog.d.ts +69 -161
- package/dist/components/confirm-dialog.js +7 -8
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button.d.ts +16 -11
- package/dist/components/country-select.d.ts +167 -0
- package/dist/components/country-select.js +293 -0
- package/dist/components/country-select.js.map +1 -0
- package/dist/components/currency-select.d.ts +17 -1
- package/dist/components/currency-select.js +56 -23
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +69 -166
- package/dist/components/danger-confirm.js +144 -50
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +1 -2
- package/dist/components/data-table-filter-popover.d.ts +1 -2
- package/dist/components/data-table-filters.d.ts +1 -2
- package/dist/components/data-table-labels.d.ts +4 -97
- package/dist/components/data-table-labels.js +9 -1
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-pagination.d.ts +3 -1
- package/dist/components/data-table.d.ts +1 -2
- package/dist/components/data-table.js +98 -3
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-picker.d.ts +66 -5
- package/dist/components/date-picker.js +378 -66
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +42 -1
- package/dist/components/entity-combobox.js +154 -113
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/facing-pair.d.ts +19 -14
- package/dist/components/field-parts.d.ts +224 -0
- package/dist/components/field-parts.js +156 -0
- package/dist/components/field-parts.js.map +1 -0
- package/dist/components/field-strip.d.ts +105 -0
- package/dist/components/field-strip.js +46 -0
- package/dist/components/field-strip.js.map +1 -0
- package/dist/components/file-button.d.ts +19 -14
- package/dist/components/file-button.js +13 -3
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +41 -15
- package/dist/components/file-dropzone.js +57 -34
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/form-actions.d.ts +18 -13
- package/dist/components/form-actions.js +69 -5
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/iban-input.d.ts +69 -0
- package/dist/components/iban-input.js +125 -0
- package/dist/components/iban-input.js.map +1 -0
- package/dist/components/icon-picker.d.ts +21 -2
- package/dist/components/icon-picker.js +19 -4
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-edit-field.d.ts +167 -0
- package/dist/components/inline-edit-field.js +293 -0
- package/dist/components/inline-edit-field.js.map +1 -0
- package/dist/components/language-select.d.ts +130 -0
- package/dist/components/language-select.js +18 -0
- package/dist/components/language-select.js.map +1 -0
- package/dist/components/line-items.d.ts +25 -3
- package/dist/components/line-items.js +55 -46
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list.d.ts +25 -0
- package/dist/components/list.js +16 -5
- package/dist/components/list.js.map +1 -1
- package/dist/components/money-field.d.ts +32 -14
- package/dist/components/money-field.js.map +1 -1
- package/dist/components/month-picker.d.ts +52 -4
- package/dist/components/month-picker.js +291 -86
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +26 -1
- package/dist/components/multi-entity-combobox.js +143 -102
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +8 -1
- package/dist/components/multi-select.js +9 -4
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-field.d.ts +34 -19
- package/dist/components/number-field.js +6 -20
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +79 -19
- package/dist/components/number-input.js +90 -38
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numpad-sheet.d.ts +19 -14
- package/dist/components/one-time-code-input.d.ts +100 -0
- package/dist/components/one-time-code-input.js +137 -0
- package/dist/components/one-time-code-input.js.map +1 -0
- package/dist/components/phone-input.d.ts +69 -0
- package/dist/components/phone-input.js +171 -0
- package/dist/components/phone-input.js.map +1 -0
- package/dist/components/reauth-dialog.d.ts +2 -2
- package/dist/components/reauth-dialog.js +6 -8
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/series-chart.d.ts +19 -14
- package/dist/components/settings-fields.d.ts +19 -14
- package/dist/components/share-card.d.ts +16 -11
- package/dist/components/sign-chip.d.ts +66 -0
- package/dist/components/sign-chip.js +39 -0
- package/dist/components/sign-chip.js.map +1 -0
- package/dist/components/swatch-picker.d.ts +43 -2
- package/dist/components/swatch-picker.js +80 -32
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/switch.d.ts +19 -0
- package/dist/components/switch.js +24 -6
- package/dist/components/switch.js.map +1 -1
- package/dist/components/text-link.d.ts +18 -13
- package/dist/components/tile-radio.d.ts +88 -13
- package/dist/components/tile-radio.js +28 -11
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +24 -15
- package/dist/components/time-input.js.map +1 -1
- package/dist/components/toggle-group.d.ts +47 -1
- package/dist/components/toggle-group.js +110 -69
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/trigger-aria.d.ts +3 -0
- package/dist/components/trigger-aria.js +3 -1
- package/dist/components/trigger-aria.js.map +1 -1
- package/dist/components/ui.d.ts +16 -11
- package/dist/components/ui.js +284 -88
- package/dist/components/ui.js.map +1 -1
- package/dist/components/use-table-state.d.ts +1 -2
- package/dist/{data-table-3mi2R3so.d.ts → data-table-labels-B7OdnM0S.d.ts} +140 -3
- package/dist/data-table.d.ts +1 -2
- package/dist/data-table.js +2 -1
- package/dist/data-table.js.map +1 -1
- package/dist/feedback/feedback-attachment.d.ts +1 -1
- package/dist/feedback/feedback-attachment.js +348 -41
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-dialog.d.ts +1 -1
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +3 -2
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +68 -253
- package/dist/feedback/feedback-thread.js +46 -10
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/{kit-labels-D1J2_jyD.d.ts → feedback-BxeQVzwq.d.ts} +1206 -20
- package/dist/{feedback-attachment-WFiXJ8We.d.ts → feedback-attachment-fGAzZPf0.d.ts} +178 -11
- package/dist/feedback.d.ts +66 -2
- package/dist/hooks/use-file-drop.d.ts +19 -14
- package/dist/i18n/defaults.d.ts +19 -14
- package/dist/i18n/defaults.js +19 -2
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +19 -14
- package/dist/i18n/german.js +84 -5
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +15 -10
- package/dist/i18n/kit-labels.js +8 -2
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +19 -14
- package/dist/i18n/locales/de-CH.d.ts +19 -14
- package/dist/i18n/locales/en.d.ts +19 -14
- package/dist/i18n/locales/en.js +16 -0
- package/dist/i18n/locales/en.js.map +1 -1
- package/dist/i18n/locales/es.d.ts +19 -14
- package/dist/i18n/locales/es.js +83 -5
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +19 -14
- package/dist/i18n/locales/fr.js +82 -5
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +19 -14
- package/dist/i18n/locales/hu.js +85 -5
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +19 -14
- package/dist/i18n/locales/it.js +84 -5
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +19 -14
- package/dist/i18n/locales/zh.js +80 -5
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.d.ts +19 -14
- package/dist/i18n/review.js +27 -1
- package/dist/i18n/review.js.map +1 -1
- package/dist/index.d.ts +21 -10
- package/dist/index.js +73 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/column-mapping.d.ts +81 -0
- package/dist/lib/column-mapping.js +108 -0
- package/dist/lib/column-mapping.js.map +1 -0
- package/dist/lib/countries.d.ts +43 -0
- package/dist/lib/countries.js +39 -0
- package/dist/lib/countries.js.map +1 -0
- package/dist/lib/decimal-marks.d.ts +46 -0
- package/dist/lib/decimal-marks.js +40 -0
- package/dist/lib/decimal-marks.js.map +1 -0
- package/dist/lib/iban.d.ts +98 -0
- package/dist/lib/iban.js +154 -0
- package/dist/lib/iban.js.map +1 -0
- package/dist/lib/isin.d.ts +30 -0
- package/dist/lib/isin.js +36 -0
- package/dist/lib/isin.js.map +1 -0
- package/dist/lib/phone.d.ts +69 -0
- package/dist/lib/phone.js +121 -0
- package/dist/lib/phone.js.map +1 -0
- package/dist/lib/table-text.d.ts +109 -1
- package/dist/lib/table-text.js +122 -1
- package/dist/lib/table-text.js.map +1 -1
- package/dist/rhf/fields.d.ts +233 -18
- package/dist/rhf/fields.js +456 -3
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form.d.ts +19 -14
- package/dist/rhf.d.ts +22 -15
- package/dist/rhf.js.map +1 -1
- package/dist/shell/app-shell.d.ts +18 -13
- package/dist/shell/top-bar-brand.d.ts +19 -14
- package/dist/shell/topbar-action-menu.d.ts +36 -3
- package/dist/shell/topbar-action-menu.js +74 -33
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell.d.ts +18 -13
- package/dist/table-text.d.ts +1 -1
- package/dist/tour/tour.js +20 -24
- package/dist/tour/tour.js.map +1 -1
- package/dist/wizard/stepper-nav.d.ts +49 -16
- package/dist/wizard/stepper-nav.js +4 -0
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard.d.ts +19 -14
- package/package.json +1 -1
- package/src/components/account-chips.tsx +17 -3
- package/src/components/account-settings.tsx +92 -26
- package/src/components/amount-input.tsx +68 -56
- package/src/components/autocomplete.tsx +198 -114
- package/src/components/checkbox-group.tsx +229 -0
- package/src/components/checkbox.tsx +72 -8
- package/src/components/chip.tsx +80 -10
- package/src/components/column-mapper.tsx +666 -0
- package/src/components/combobox-core.tsx +82 -9
- package/src/components/combobox.tsx +661 -340
- package/src/components/confirm-dialog.tsx +12 -8
- package/src/components/country-select.tsx +556 -0
- package/src/components/currency-select.tsx +109 -33
- package/src/components/danger-confirm.tsx +429 -82
- package/src/components/data-table-labels.ts +16 -1
- package/src/components/data-table.tsx +175 -6
- package/src/components/date-picker.tsx +595 -71
- package/src/components/entity-combobox.tsx +235 -124
- package/src/components/field-parts.tsx +403 -0
- package/src/components/field-strip.tsx +149 -0
- package/src/components/file-button.tsx +36 -3
- package/src/components/file-dropzone.tsx +106 -38
- package/src/components/form-actions.tsx +147 -6
- package/src/components/iban-input.tsx +231 -0
- package/src/components/icon-picker.tsx +47 -6
- package/src/components/inline-edit-field.tsx +533 -0
- package/src/components/language-select.tsx +78 -0
- package/src/components/line-items.tsx +35 -2
- package/src/components/list.tsx +55 -6
- package/src/components/money-field.tsx +13 -0
- package/src/components/month-picker.tsx +400 -63
- package/src/components/multi-entity-combobox.tsx +207 -120
- package/src/components/multi-select.tsx +80 -58
- package/src/components/number-field.tsx +28 -46
- package/src/components/number-input.tsx +210 -43
- package/src/components/one-time-code-input.tsx +288 -0
- package/src/components/phone-input.tsx +299 -0
- package/src/components/reauth-dialog.tsx +17 -18
- package/src/components/sign-chip.tsx +103 -0
- package/src/components/swatch-picker.tsx +143 -31
- package/src/components/switch.tsx +58 -7
- package/src/components/tile-radio.tsx +145 -29
- package/src/components/time-input.tsx +8 -1
- package/src/components/toggle-group.tsx +206 -73
- package/src/components/trigger-aria.ts +5 -0
- package/src/components/ui.tsx +479 -138
- package/src/data-table.ts +2 -1
- package/src/feedback/feedback-attachment.tsx +597 -46
- package/src/feedback/feedback-dialog.tsx +9 -3
- package/src/feedback/feedback-inbox.tsx +3 -2
- package/src/feedback/feedback-thread.tsx +113 -9
- package/src/i18n/defaults.ts +18 -1
- package/src/i18n/german.ts +89 -0
- package/src/i18n/kit-labels.tsx +82 -2
- package/src/i18n/locales/en.ts +36 -4
- package/src/i18n/locales/es.ts +87 -0
- package/src/i18n/locales/fr.ts +87 -0
- package/src/i18n/locales/hu.ts +83 -0
- package/src/i18n/locales/it.ts +88 -0
- package/src/i18n/locales/zh.ts +76 -0
- package/src/i18n/review.ts +26 -0
- package/src/index.ts +71 -3
- package/src/lib/column-mapping.ts +234 -0
- package/src/lib/countries.ts +91 -0
- package/src/lib/decimal-marks.ts +99 -0
- package/src/lib/iban.ts +171 -0
- package/src/lib/isin.ts +62 -0
- package/src/lib/phone.ts +211 -0
- package/src/lib/table-text.ts +271 -0
- package/src/rhf/fields.tsx +860 -9
- package/src/rhf.ts +3 -1
- package/src/shell/topbar-action-menu.tsx +134 -38
- package/src/tour/tour.tsx +66 -28
- package/src/wizard/stepper-nav.tsx +35 -1
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import '../
|
|
3
|
+
import { bj as KitLinkProps, bi as KitLinkComponent } from '../feedback-BxeQVzwq.js';
|
|
4
|
+
import '../feedback-attachment-fGAzZPf0.js';
|
|
5
|
+
import '../feedback/feedback-inbox.js';
|
|
6
|
+
import 'lucide-react';
|
|
7
|
+
import '../components/tooltip.js';
|
|
8
|
+
import '../hooks/use-anchored-rect.js';
|
|
9
|
+
import '../lib/clipping.js';
|
|
10
|
+
import '../data-table-labels-B7OdnM0S.js';
|
|
11
|
+
import '../components/data-table-sort.js';
|
|
12
|
+
import '../components/swipeable-row.js';
|
|
5
13
|
import '../components/mini-calendar.js';
|
|
6
14
|
import '../components/calendar-heatmap.js';
|
|
7
15
|
import '../components/popover.js';
|
|
8
16
|
import '../components/chip.js';
|
|
9
|
-
import 'lucide-react';
|
|
10
17
|
import '../components/field-sync.js';
|
|
11
|
-
import '../components/tooltip.js';
|
|
12
|
-
import '../hooks/use-anchored-rect.js';
|
|
13
|
-
import '../lib/clipping.js';
|
|
14
18
|
import '../wizard/types.js';
|
|
15
19
|
import '../tour/tour.js';
|
|
16
20
|
import '../search/command-palette.js';
|
|
@@ -24,7 +28,6 @@ import '../components/sparkline.js';
|
|
|
24
28
|
import '../components/stat-tile.js';
|
|
25
29
|
import '../components/signature-pad.js';
|
|
26
30
|
import '../components/password-strength.js';
|
|
27
|
-
import '../components/danger-confirm.js';
|
|
28
31
|
import '../components/swatch-picker.js';
|
|
29
32
|
import '../components/tile-radio.js';
|
|
30
33
|
import '../components/icon-picker.js';
|
|
@@ -32,11 +35,7 @@ import '../components/dialog-frame.js';
|
|
|
32
35
|
import '../components/modal.js';
|
|
33
36
|
import '../hooks/use-search-param-state.js';
|
|
34
37
|
import '../components/measured-grid.js';
|
|
35
|
-
import '../feedback-attachment-WFiXJ8We.js';
|
|
36
|
-
import '../feedback/feedback-thread.js';
|
|
37
|
-
import '../feedback/feedback-inbox.js';
|
|
38
38
|
import '../components/account-settings-labels.js';
|
|
39
|
-
import '../components/confirm-dialog.js';
|
|
40
39
|
import '../components/floating-panel.js';
|
|
41
40
|
import '../components/bulk-action-bar.js';
|
|
42
41
|
import '../components/list.js';
|
|
@@ -55,14 +54,20 @@ import '../components/write-lock.js';
|
|
|
55
54
|
import '../components/legal.js';
|
|
56
55
|
import '../components/account-chips.js';
|
|
57
56
|
import '../lib/format.js';
|
|
58
|
-
import '../data-table-3mi2R3so.js';
|
|
59
|
-
import '../components/data-table-sort.js';
|
|
60
|
-
import '../components/swipeable-row.js';
|
|
61
57
|
import '../components/reauth-dialog.js';
|
|
62
58
|
import '../components/server-wake.js';
|
|
63
59
|
import '../lib/server-wake.js';
|
|
64
60
|
import '../components/translation-review-labels.js';
|
|
65
61
|
import '../lib/translation-review.js';
|
|
62
|
+
import '../components/country-select.js';
|
|
63
|
+
import '../components/inline-edit-field.js';
|
|
64
|
+
import '../lib/iban.js';
|
|
65
|
+
import '../lib/phone.js';
|
|
66
|
+
import '../components/sign-chip.js';
|
|
67
|
+
import '../components/column-mapper.js';
|
|
68
|
+
import '../lib/column-mapping.js';
|
|
69
|
+
import '../lib/table-text.js';
|
|
70
|
+
import '../components/field-parts.js';
|
|
66
71
|
|
|
67
72
|
interface TopBarBrandProps extends Omit<KitLinkProps, "href" | "children"> {
|
|
68
73
|
/** The brand mark — an SVG, sized by the caller or `h-6 w-auto` by default. */
|
|
@@ -11,9 +11,9 @@ import '../components/chip.js';
|
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a
|
|
14
|
-
* `link` navigates via react-router,
|
|
15
|
-
* rows close the menu automatically when chosen.
|
|
16
|
-
* actions, keeping the common case terse.
|
|
14
|
+
* `link` navigates via react-router, a `divider` draws a rule, and a `heading` names
|
|
15
|
+
* the rows after it. Action and link rows close the menu automatically when chosen.
|
|
16
|
+
* `kind` may be omitted for actions, keeping the common case terse.
|
|
17
17
|
*
|
|
18
18
|
* The rows are {@link MenuItem}s, so they take its options: `tone: "danger"` for the
|
|
19
19
|
* log-out row, `checked` (+ `checkable`) for a choice, `current` for the link to the
|
|
@@ -46,6 +46,34 @@ type TopBarMenuEntry = {
|
|
|
46
46
|
} | {
|
|
47
47
|
kind: "divider";
|
|
48
48
|
key: string;
|
|
49
|
+
} | {
|
|
50
|
+
/**
|
|
51
|
+
* A group heading (0.23, keksdose's guided-tours menu): the rows after it, up to
|
|
52
|
+
* the next heading, the next `divider` or the end of `entries`, are ONE group
|
|
53
|
+
* named by `label`. keksdose files its tours by topic and separated the blocks
|
|
54
|
+
* with bare dividers — "the kit's menu has no heading row to name them with"
|
|
55
|
+
* (tour-menu.tsx) — so a sighted reader had to guess what each block was and a
|
|
56
|
+
* screen reader was told nothing at all.
|
|
57
|
+
*
|
|
58
|
+
* Not a row: it takes no focus, the arrow keys (and Home/End) pass over it, and it
|
|
59
|
+
* never closes the menu. It is announced the way the kit's other grouped lists
|
|
60
|
+
* announce theirs (`CommandPalette`): the group's rows sit in a `role="group"`
|
|
61
|
+
* whose `aria-labelledby` is this heading, so a reader says "On this page, group"
|
|
62
|
+
* when the focus enters the first row, and nothing between rows.
|
|
63
|
+
*
|
|
64
|
+
* A divider ENDS the group, so a closing row such as "All tours…" behind a rule
|
|
65
|
+
* belongs to no topic. A heading with no rows under it is not drawn — an empty
|
|
66
|
+
* group names nothing; build the list from data and it may well be empty.
|
|
67
|
+
*
|
|
68
|
+
* The menu-wide `heading` prop is the panel's title, drawn once above everything;
|
|
69
|
+
* with group headings it is usually redundant (two stacked caps lines read as one),
|
|
70
|
+
* and the trigger's `ariaLabel` already names the menu.
|
|
71
|
+
*/
|
|
72
|
+
kind: "heading";
|
|
73
|
+
key: string;
|
|
74
|
+
/** The group's name, shown above its rows and announced as the group's name. Keep
|
|
75
|
+
* it short: it is set in small caps and wraps on a narrow panel. */
|
|
76
|
+
label: ReactNode;
|
|
49
77
|
};
|
|
50
78
|
/**
|
|
51
79
|
* The non-interactive identity block at the top of an account menu — kastlan's name +
|
|
@@ -78,6 +106,11 @@ interface TopBarMenuHeader {
|
|
|
78
106
|
* It is also the ACCOUNT menu kastlan and keksdose each hand-build on `HoverMenu`: a
|
|
79
107
|
* custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a
|
|
80
108
|
* free-content `footer` (the legal links).
|
|
109
|
+
*
|
|
110
|
+
* A long menu is grouped by topic with `{ kind: "heading" }` entries (0.23) — see
|
|
111
|
+
* {@link TopBarMenuEntry}. There is no separate phone layout: the panel is the same
|
|
112
|
+
* hover panel at 390px, kept inside the viewport by `HoverMenu`, and a heading wraps
|
|
113
|
+
* rather than widening it.
|
|
81
114
|
*/
|
|
82
115
|
declare function TopBarActionMenu({ icon, iconBadge, trigger, triggerClassName, href, ariaLabel, heading, header, entries, children, footer, footerLabel, align, panelClassName, }: {
|
|
83
116
|
/** The trigger's face for the usual icon button. Ignored when `trigger` is given. */
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { useId, useLayoutEffect, useRef } from "react";
|
|
4
4
|
import { Link } from "react-router";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { HoverMenu } from "../components/hover-menu.js";
|
|
7
7
|
import { MenuItem } from "../components/menu-item.js";
|
|
8
8
|
import { StatusDot } from "../components/status-dot.js";
|
|
9
9
|
import { TOPBAR_TRIGGER_CLASS } from "./topbar-controls.js";
|
|
10
|
+
function toBlocks(entries) {
|
|
11
|
+
const blocks = [];
|
|
12
|
+
let group = null;
|
|
13
|
+
for (const entry of entries) {
|
|
14
|
+
if (entry.kind === "heading") {
|
|
15
|
+
group = { kind: "group", heading: entry, rows: [] };
|
|
16
|
+
blocks.push(group);
|
|
17
|
+
} else if (entry.kind === "divider") {
|
|
18
|
+
group = null;
|
|
19
|
+
blocks.push({ kind: "loose", entry });
|
|
20
|
+
} else if (group) {
|
|
21
|
+
group.rows.push(entry);
|
|
22
|
+
} else {
|
|
23
|
+
blocks.push({ kind: "loose", entry });
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return blocks.filter((block) => block.kind === "loose" || block.rows.length > 0);
|
|
27
|
+
}
|
|
10
28
|
const SECTION_CONTROLS = "a[href]:not([role]),button:not([role])";
|
|
11
29
|
const TABBABLE = "a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]";
|
|
12
30
|
function MenuSection({ className, children }) {
|
|
@@ -47,6 +65,7 @@ function TopBarActionMenu({
|
|
|
47
65
|
align,
|
|
48
66
|
panelClassName
|
|
49
67
|
}) {
|
|
68
|
+
const uid = useId();
|
|
50
69
|
return /* @__PURE__ */ jsx(
|
|
51
70
|
HoverMenu,
|
|
52
71
|
{
|
|
@@ -85,6 +104,35 @@ function TopBarActionMenu({
|
|
|
85
104
|
const footerBody = typeof footer === "function" ? footer(close) : footer;
|
|
86
105
|
const headerExtra = typeof header?.extra === "function" ? header.extra(close) : header?.extra;
|
|
87
106
|
const footerClass = "flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]";
|
|
107
|
+
const row = (entry) => /* @__PURE__ */ jsx("li", { children: entry.kind === "link" ? /* @__PURE__ */ jsx(
|
|
108
|
+
MenuItem,
|
|
109
|
+
{
|
|
110
|
+
href: entry.to,
|
|
111
|
+
renderLink: ({ href: href2, ...p }) => /* @__PURE__ */ jsx(Link, { to: href2, ...p }),
|
|
112
|
+
onClick: close,
|
|
113
|
+
leading: entry.icon,
|
|
114
|
+
trailing: entry.trailing,
|
|
115
|
+
tone: entry.tone,
|
|
116
|
+
current: entry.current,
|
|
117
|
+
disabled: entry.disabled,
|
|
118
|
+
children: entry.label
|
|
119
|
+
}
|
|
120
|
+
) : /* @__PURE__ */ jsx(
|
|
121
|
+
MenuItem,
|
|
122
|
+
{
|
|
123
|
+
onClick: () => {
|
|
124
|
+
entry.onSelect();
|
|
125
|
+
close();
|
|
126
|
+
},
|
|
127
|
+
leading: entry.icon,
|
|
128
|
+
trailing: entry.trailing,
|
|
129
|
+
tone: entry.tone,
|
|
130
|
+
checked: entry.checked,
|
|
131
|
+
checkable: entry.checkable,
|
|
132
|
+
disabled: entry.disabled,
|
|
133
|
+
children: entry.label
|
|
134
|
+
}
|
|
135
|
+
) }, entry.key);
|
|
88
136
|
return (
|
|
89
137
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel
|
|
90
138
|
/* @__PURE__ */ jsxs("ul", { className: cn("py-1", panelClassName), onKeyDown: keepTabInsidePanel, children: [
|
|
@@ -94,39 +142,32 @@ function TopBarActionMenu({
|
|
|
94
142
|
headerExtra != null && headerExtra !== false && /* @__PURE__ */ jsx("div", { className: "mt-1", children: headerExtra })
|
|
95
143
|
] }),
|
|
96
144
|
heading && /* @__PURE__ */ jsx("li", { className: "px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]", children: heading }),
|
|
97
|
-
entries.map((
|
|
98
|
-
if (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
MenuItem,
|
|
103
|
-
{
|
|
104
|
-
href: entry.to,
|
|
105
|
-
renderLink: ({ href: href2, ...p }) => /* @__PURE__ */ jsx(Link, { to: href2, ...p }),
|
|
106
|
-
onClick: close,
|
|
107
|
-
leading: entry.icon,
|
|
108
|
-
trailing: entry.trailing,
|
|
109
|
-
tone: entry.tone,
|
|
110
|
-
current: entry.current,
|
|
111
|
-
disabled: entry.disabled,
|
|
112
|
-
children: entry.label
|
|
145
|
+
toBlocks(entries).map((block, i, blocks) => {
|
|
146
|
+
if (block.kind === "loose") {
|
|
147
|
+
const entry = block.entry;
|
|
148
|
+
if (entry.kind === "divider") {
|
|
149
|
+
return /* @__PURE__ */ jsx("li", { className: "my-1 border-t border-[var(--border)]" }, entry.key);
|
|
113
150
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
151
|
+
return row(entry);
|
|
152
|
+
}
|
|
153
|
+
const headingId = `${uid}-group-${i}`;
|
|
154
|
+
const before = blocks[i - 1];
|
|
155
|
+
const tight = !before || before.kind === "loose" && before.entry.kind === "divider";
|
|
156
|
+
return /* @__PURE__ */ jsxs("li", { role: "none", children: [
|
|
157
|
+
/* @__PURE__ */ jsx(
|
|
158
|
+
"div",
|
|
159
|
+
{
|
|
160
|
+
id: headingId,
|
|
161
|
+
role: "presentation",
|
|
162
|
+
className: cn(
|
|
163
|
+
"px-3 pb-0.5 text-[11px] font-semibold uppercase tracking-wide text-[var(--text-muted)] [overflow-wrap:anywhere]",
|
|
164
|
+
tight ? "pt-1" : "pt-2.5"
|
|
165
|
+
),
|
|
166
|
+
children: block.heading.label
|
|
167
|
+
}
|
|
168
|
+
),
|
|
169
|
+
/* @__PURE__ */ jsx("ul", { role: "group", "aria-labelledby": headingId, children: block.rows.map(row) })
|
|
170
|
+
] }, block.heading.key);
|
|
130
171
|
}),
|
|
131
172
|
children?.(close),
|
|
132
173
|
footerBody != null && footerBody !== false && /* @__PURE__ */ jsx(MenuSection, { className: "mt-1 border-t border-[var(--border)] px-3 py-2", children: footerLabel ? /* @__PURE__ */ jsx("nav", { "aria-label": footerLabel, className: footerClass, children: footerBody }) : /* @__PURE__ */ jsx("div", { className: footerClass, children: footerBody }) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/shell/topbar-action-menu.tsx"],"sourcesContent":["import { useLayoutEffect, useRef } from \"react\";\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from \"react\";\nimport { Link } from \"react-router\";\nimport { cn } from \"../lib/cn\";\nimport { HoverMenu } from \"../components/hover-menu\";\nimport { MenuItem } from \"../components/menu-item\";\nimport type { MenuItemTone } from \"../components/menu-item\";\nimport { StatusDot } from \"../components/status-dot\";\nimport type { UserAvatarBadge } from \"../components/user-avatar\";\nimport { TOPBAR_TRIGGER_CLASS } from \"./topbar-controls\";\n\n/**\n * One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a\n * `link` navigates via react-router, and a `divider` draws a rule. Non-divider\n * rows close the menu automatically when chosen. `kind` may be omitted for\n * actions, keeping the common case terse.\n *\n * The rows are {@link MenuItem}s, so they take its options: `tone: \"danger\"` for the\n * log-out row, `checked` (+ `checkable`) for a choice, `current` for the link to the\n * page already open, `disabled`.\n */\nexport type TopBarMenuEntry =\n | {\n kind?: \"action\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n onSelect: () => void;\n tone?: MenuItemTone;\n /** Makes the row a choice (`menuitemradio`, or `menuitemcheckbox` with\n * `checkable: \"checkbox\"`) and says whether it is chosen. */\n checked?: boolean;\n checkable?: \"radio\" | \"checkbox\";\n disabled?: boolean;\n }\n | {\n kind: \"link\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n to: string;\n tone?: MenuItemTone;\n /** The link to the page already open: `aria-current=\"page\"` and a check mark. */\n current?: boolean;\n disabled?: boolean;\n }\n | { kind: \"divider\"; key: string };\n\n/**\n * The non-interactive identity block at the top of an account menu — kastlan's name +\n * role, keksdose's display name + email + role chip. It is text, not a `menuitem`: the\n * arrow keys pass over it.\n */\nexport interface TopBarMenuHeader {\n /** The first line — the user's name. */\n title: ReactNode;\n /** The muted second line — an email, a role. */\n subtitle?: ReactNode;\n /**\n * Anything below — a role chip. A link or button here stays out of the arrow keys\n * and in the Tab order, like the footer's.\n *\n * Pass a function to get `close`, as `footer` does — keksdose F7: its admin role\n * chip links to the admin area, and a router link does not unmount the menu, so\n * without `close` the panel stayed open over the page it had just navigated to.\n */\n extra?: ReactNode | ((close: () => void) => ReactNode);\n}\n\n/** What a control is, as far as `HoverMenu` is concerned, when it lives in the header\n * or the footer: not a menu row. */\nconst SECTION_CONTROLS = \"a[href]:not([role]),button:not([role])\";\nconst TABBABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]';\n\n/**\n * A header or footer inside the menu panel.\n *\n * `HoverMenu` promotes EVERY role-less button and link in its panel to a `menuitem` out\n * of the Tab order, and turns every list into `role=\"none\"` — right for the rows, wrong\n * for a footer of legal links, which would join the arrow-key cycle and drop out of Tab.\n * So before it looks (a child's layout effect runs before its parent's), the controls\n * in here get their own role spelled out, which `HoverMenu` leaves alone, and any list\n * keeps its list semantics.\n */\nfunction MenuSection({ className, children }: { className: string; children: ReactNode }) {\n const ref = useRef<HTMLLIElement>(null);\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n for (const c of el.querySelectorAll<HTMLElement>(SECTION_CONTROLS)) {\n c.setAttribute(\"role\", c.tagName === \"A\" ? \"link\" : \"button\");\n }\n for (const l of el.querySelectorAll<HTMLElement>(\"ul:not([role]),ol:not([role])\")) l.setAttribute(\"role\", \"list\");\n for (const l of el.querySelectorAll<HTMLElement>(\"li:not([role])\")) l.setAttribute(\"role\", \"listitem\");\n });\n return (\n <li ref={ref} role=\"none\" className={className}>\n {children}\n </li>\n );\n}\n\n/**\n * `HoverMenu` closes on any Tab inside the panel — right when Tab leaves it, wrong when\n * Tab is on its way from a row to a footer link, or from one footer link to the next:\n * the panel would unmount under the focus. So a Tab whose next stop is still inside the\n * panel stops here and the browser moves focus; one that leaves reaches `HoverMenu`,\n * which closes.\n */\nfunction keepTabInsidePanel(e: ReactKeyboardEvent<HTMLUListElement>) {\n if (e.key !== \"Tab\") return;\n const from = e.target as HTMLElement;\n const stops = Array.from(e.currentTarget.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (el) => el.getAttribute(\"tabindex\") !== \"-1\",\n );\n const way = e.shiftKey ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;\n if (stops.some((el) => el !== from && from.compareDocumentPosition(el) & way)) e.stopPropagation();\n}\n\n/**\n * A top-bar icon button that opens a {@link HoverMenu} of actions and/or links,\n * with an optional uppercase heading and divider rules. Generic glue over the\n * shared top-bar chrome — e.g. the feedback launcher or the guided-tours menu —\n * so those call sites describe their rows as data instead of rebuilding the\n * trigger + list markup. For a checkmarked value-switcher use\n * {@link OptionSwitcherMenu} instead.\n *\n * It is also the ACCOUNT menu kastlan and keksdose each hand-build on `HoverMenu`: a\n * custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a\n * free-content `footer` (the legal links).\n */\nexport function TopBarActionMenu({\n icon,\n iconBadge,\n trigger,\n triggerClassName,\n href,\n ariaLabel,\n heading,\n header,\n entries,\n children,\n footer,\n footerLabel,\n align,\n panelClassName,\n}: {\n /** The trigger's face for the usual icon button. Ignored when `trigger` is given. */\n icon?: ReactNode;\n /**\n * A status dot in the top-end corner of `icon` — keksdose's unread-support dot on the\n * feedback trigger. Like `UserAvatar`'s `badge`, its `label` joins the trigger's name\n * (\"Send feedback 2 unread\"), so the dot is not something only the eye is told about.\n * Ignored with `trigger`: give the face its own badge there.\n */\n iconBadge?: UserAvatarBadge | null;\n /**\n * A face of your own for the trigger — the account menu's `UserAvatar`. It is drawn\n * INSIDE the kit's button, which keeps the wiring: `aria-haspopup`, `aria-expanded`,\n * the toggle, the keyboard. `open` is there for a chevron that turns.\n *\n * The button is named by `ariaLabel` followed by any readable text in the face — a\n * `UserAvatar` `badge` label reaches a screen reader that way (\"Account menu 3\n * unread\"), where an `aria-label` on the button would have hidden it. A\n * `UserAvatar`'s initials are `aria-hidden`, so the person's name is only in the\n * name if `ariaLabel` carries it (\"Marcel Eifert, account menu\").\n */\n trigger?: (state: { open: boolean }) => ReactNode;\n /** Extra classes for the trigger button — `rounded-full` round an avatar. */\n triggerClassName?: string;\n /**\n * Make the trigger a LINK to this route (keksdose dev #585, Marcel: \"clicking on the\n * guided tours icon shall lead to the tours page like the all tours element does\").\n * A click or Enter follows it and shuts the panel; hover still opens the panel after\n * the usual delay, and ↓/↑ on the focused trigger still open it onto the first/last\n * row, so the rows stay reachable by keyboard. A tap on a touch screen follows the\n * link — so use it where the destination offers everything the menu does. Rendered as\n * an `<a>` (the router's `Link`) with `aria-haspopup=\"menu\"` and `aria-expanded`,\n * named by `ariaLabel`: a link inside the kit's button would be interactive content\n * inside interactive content.\n */\n href?: string;\n /** Names the trigger and the menu. */\n ariaLabel: string;\n heading?: string;\n /** A non-interactive identity block above the rows. */\n header?: TopBarMenuHeader;\n entries: TopBarMenuEntry[];\n /**\n * Rows the entry data cannot describe (a `Disclosure` sub-list, an app's own\n * section), after `entries`. Render `<li>`s holding `MenuItem`s or plain controls;\n * `close` shuts the menu.\n */\n children?: (close: () => void) => ReactNode;\n /**\n * Free content below the rows, behind a rule — the legal links. Its links and\n * buttons are NOT menu rows: the arrow keys skip them and Tab reaches them. Pass a\n * function to get `close` for the links' `onClick`.\n */\n footer?: ReactNode | ((close: () => void) => ReactNode);\n /** Wraps the footer in a `<nav>` with this name (\"Legal\"). Without it, a plain block. */\n footerLabel?: string;\n /** Which edge of the trigger the panel lines up with (see `HoverMenu`). Default `end`. */\n align?: \"start\" | \"end\" | \"left\" | \"right\";\n panelClassName?: string;\n}) {\n return (\n <HoverMenu\n ariaLabel={ariaLabel}\n align={align}\n trigger={({ open, toggle, close }) => {\n // One element for both kinds: the router's link when `href` is set, else the\n // kit's button. Same classes and face either way.\n const control = (className: string, children: ReactNode, label?: string) =>\n href ? (\n <Link to={href} onClick={close} aria-label={label} className={className}>\n {children}\n </Link>\n ) : (\n <button type=\"button\" onClick={toggle} aria-label={label} className={className}>\n {children}\n </button>\n );\n if (trigger) {\n return control(\n cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName),\n <>\n <span className=\"sr-only\">{ariaLabel}</span>\n {/* The space keeps the name from running into the face's text (\"Account\n menu3 unread\"); as a flex item it takes no room. */}\n {\" \"}\n {trigger({ open })}\n </>,\n );\n }\n if (iconBadge) {\n // Named by its content, like the custom-trigger branch, so the badge label is\n // part of the name; an `aria-label` would have hidden it.\n return control(\n cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName),\n <>\n <span className=\"sr-only\">{ariaLabel}</span>{\" \"}\n <span aria-hidden className=\"relative inline-flex\">\n {icon}\n <StatusDot ring tone={iconBadge.tone ?? \"danger\"} className=\"absolute -end-0.5 -top-0.5\" />\n </span>{\" \"}\n <span className=\"sr-only\">{iconBadge.label}</span>\n </>,\n );\n }\n return control(cn(TOPBAR_TRIGGER_CLASS, triggerClassName), icon, ariaLabel);\n }}\n >\n {(close) => {\n const footerBody = typeof footer === \"function\" ? footer(close) : footer;\n const headerExtra = typeof header?.extra === \"function\" ? header.extra(close) : header?.extra;\n const footerClass =\n \"flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]\";\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel\n <ul className={cn(\"py-1\", panelClassName)} onKeyDown={keepTabInsidePanel}>\n {header && (\n <MenuSection className=\"mb-1 border-b border-[var(--border)] px-3 py-2\">\n <div className=\"truncate text-sm font-medium text-[var(--text-primary)]\">{header.title}</div>\n {header.subtitle != null && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{header.subtitle}</div>\n )}\n {headerExtra != null && headerExtra !== false && <div className=\"mt-1\">{headerExtra}</div>}\n </MenuSection>\n )}\n {heading && (\n <li className=\"px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]\">\n {heading}\n </li>\n )}\n {entries.map((entry) => {\n if (entry.kind === \"divider\") {\n return <li key={entry.key} className=\"my-1 border-t border-[var(--border)]\" />;\n }\n return (\n <li key={entry.key}>\n {entry.kind === \"link\" ? (\n <MenuItem\n href={entry.to}\n renderLink={({ href, ...p }) => <Link to={href} {...p} />}\n onClick={close}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n current={entry.current}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n ) : (\n <MenuItem\n onClick={() => {\n entry.onSelect();\n close();\n }}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n checked={entry.checked}\n checkable={entry.checkable}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n )}\n </li>\n );\n })}\n {children?.(close)}\n {footerBody != null && footerBody !== false && (\n <MenuSection className=\"mt-1 border-t border-[var(--border)] px-3 py-2\">\n {footerLabel ? (\n <nav aria-label={footerLabel} className={footerClass}>\n {footerBody}\n </nav>\n ) : (\n <div className={footerClass}>{footerBody}</div>\n )}\n </MenuSection>\n )}\n </ul>\n );\n }}\n </HoverMenu>\n );\n}\n"],"mappings":";AAkGI,SAkIQ,UAlIR,KAkIQ,YAlIR;AAlGJ,SAAS,iBAAiB,cAAc;AAExC,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAE1B,SAAS,4BAA4B;AAgErC,MAAM,mBAAmB;AACzB,MAAM,WAAW;AAYjB,SAAS,YAAY,EAAE,WAAW,SAAS,GAA+C;A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,oBAAC,QAAG,WAAU,8FACX,mBACH;AAAA,YAED,QAAQ,IAAI,CAAC,UAAU;AACtB,kBAAI,MAAM,SAAS,WAAW;AAC5B,uBAAO,oBAAC,QAAmB,WAAU,0CAArB,MAAM,GAAsD;AAAA,cAC9E;AACA,qBACE,oBAAC,QACE,gBAAM,SAAS,SACd;AAAA,gBAAC;AAAA;AAAA,kBACC,MAAM,MAAM;AAAA,kBACZ,YAAY,CAAC,EAAE,MAAAC,OAAM,GAAG,EAAE,MAAM,oBAAC,QAAK,IAAIA,OAAO,GAAG,GAAG;AAAA,kBACvD,SAAS;AAAA,kBACT,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,IAEA;AAAA,gBAAC;AAAA;AAAA,kBACC,SAAS,MAAM;AACb,0BAAM,SAAS;AACf,0BAAM;AAAA,kBACR;AAAA,kBACA,SAAS,MAAM;AAAA,kBACf,UAAU,MAAM;AAAA,kBAChB,MAAM,MAAM;AAAA,kBACZ,SAAS,MAAM;AAAA,kBACf,WAAW,MAAM;AAAA,kBACjB,UAAU,MAAM;AAAA,kBAEf,gBAAM;AAAA;AAAA,cACT,KA5BK,MAAM,GA8Bf;AAAA,YAEJ,CAAC;AAAA,YACA,WAAW,KAAK;AAAA,YAChB,cAAc,QAAQ,eAAe,SACpC,oBAAC,eAAY,WAAU,kDACpB,wBACC,oBAAC,SAAI,cAAY,aAAa,WAAW,aACtC,sBACH,IAEA,oBAAC,SAAI,WAAW,aAAc,sBAAW,GAE7C;AAAA,aAEJ;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":["children","href"]}
|
|
1
|
+
{"version":3,"sources":["../../src/shell/topbar-action-menu.tsx"],"sourcesContent":["import { useId, useLayoutEffect, useRef } from \"react\";\nimport type { KeyboardEvent as ReactKeyboardEvent, ReactNode } from \"react\";\nimport { Link } from \"react-router\";\nimport { cn } from \"../lib/cn\";\nimport { HoverMenu } from \"../components/hover-menu\";\nimport { MenuItem } from \"../components/menu-item\";\nimport type { MenuItemTone } from \"../components/menu-item\";\nimport { StatusDot } from \"../components/status-dot\";\nimport type { UserAvatarBadge } from \"../components/user-avatar\";\nimport { TOPBAR_TRIGGER_CLASS } from \"./topbar-controls\";\n\n/**\n * One row of a {@link TopBarActionMenu}. An `action` (default) runs `onSelect`, a\n * `link` navigates via react-router, a `divider` draws a rule, and a `heading` names\n * the rows after it. Action and link rows close the menu automatically when chosen.\n * `kind` may be omitted for actions, keeping the common case terse.\n *\n * The rows are {@link MenuItem}s, so they take its options: `tone: \"danger\"` for the\n * log-out row, `checked` (+ `checkable`) for a choice, `current` for the link to the\n * page already open, `disabled`.\n */\nexport type TopBarMenuEntry =\n | {\n kind?: \"action\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n onSelect: () => void;\n tone?: MenuItemTone;\n /** Makes the row a choice (`menuitemradio`, or `menuitemcheckbox` with\n * `checkable: \"checkbox\"`) and says whether it is chosen. */\n checked?: boolean;\n checkable?: \"radio\" | \"checkbox\";\n disabled?: boolean;\n }\n | {\n kind: \"link\";\n key: string;\n icon?: ReactNode;\n label: ReactNode;\n trailing?: ReactNode;\n to: string;\n tone?: MenuItemTone;\n /** The link to the page already open: `aria-current=\"page\"` and a check mark. */\n current?: boolean;\n disabled?: boolean;\n }\n | { kind: \"divider\"; key: string }\n | {\n /**\n * A group heading (0.23, keksdose's guided-tours menu): the rows after it, up to\n * the next heading, the next `divider` or the end of `entries`, are ONE group\n * named by `label`. keksdose files its tours by topic and separated the blocks\n * with bare dividers — \"the kit's menu has no heading row to name them with\"\n * (tour-menu.tsx) — so a sighted reader had to guess what each block was and a\n * screen reader was told nothing at all.\n *\n * Not a row: it takes no focus, the arrow keys (and Home/End) pass over it, and it\n * never closes the menu. It is announced the way the kit's other grouped lists\n * announce theirs (`CommandPalette`): the group's rows sit in a `role=\"group\"`\n * whose `aria-labelledby` is this heading, so a reader says \"On this page, group\"\n * when the focus enters the first row, and nothing between rows.\n *\n * A divider ENDS the group, so a closing row such as \"All tours…\" behind a rule\n * belongs to no topic. A heading with no rows under it is not drawn — an empty\n * group names nothing; build the list from data and it may well be empty.\n *\n * The menu-wide `heading` prop is the panel's title, drawn once above everything;\n * with group headings it is usually redundant (two stacked caps lines read as one),\n * and the trigger's `ariaLabel` already names the menu.\n */\n kind: \"heading\";\n key: string;\n /** The group's name, shown above its rows and announced as the group's name. Keep\n * it short: it is set in small caps and wraps on a narrow panel. */\n label: ReactNode;\n };\n\ntype HeadingEntry = Extract<TopBarMenuEntry, { kind: \"heading\" }>;\ntype DividerEntry = Extract<TopBarMenuEntry, { kind: \"divider\" }>;\ntype RowEntry = Exclude<TopBarMenuEntry, HeadingEntry | DividerEntry>;\n\n/** What the panel draws from `entries`: loose rows and rules, and headed groups. */\ntype Block = { kind: \"loose\"; entry: RowEntry | DividerEntry } | { kind: \"group\"; heading: HeadingEntry; rows: RowEntry[] };\n\n/**\n * Cut `entries` into blocks: a heading opens a group that takes the rows after it until\n * the next heading or divider; everything else stands alone, as it always has.\n */\nfunction toBlocks(entries: readonly TopBarMenuEntry[]): Block[] {\n const blocks: Block[] = [];\n let group: Extract<Block, { kind: \"group\" }> | null = null;\n for (const entry of entries) {\n if (entry.kind === \"heading\") {\n group = { kind: \"group\", heading: entry, rows: [] };\n blocks.push(group);\n } else if (entry.kind === \"divider\") {\n group = null;\n blocks.push({ kind: \"loose\", entry });\n } else if (group) {\n group.rows.push(entry);\n } else {\n blocks.push({ kind: \"loose\", entry });\n }\n }\n // A heading with nothing under it names nothing: not drawn (see the `heading` kind).\n return blocks.filter((block) => block.kind === \"loose\" || block.rows.length > 0);\n}\n\n/**\n * The non-interactive identity block at the top of an account menu — kastlan's name +\n * role, keksdose's display name + email + role chip. It is text, not a `menuitem`: the\n * arrow keys pass over it.\n */\nexport interface TopBarMenuHeader {\n /** The first line — the user's name. */\n title: ReactNode;\n /** The muted second line — an email, a role. */\n subtitle?: ReactNode;\n /**\n * Anything below — a role chip. A link or button here stays out of the arrow keys\n * and in the Tab order, like the footer's.\n *\n * Pass a function to get `close`, as `footer` does — keksdose F7: its admin role\n * chip links to the admin area, and a router link does not unmount the menu, so\n * without `close` the panel stayed open over the page it had just navigated to.\n */\n extra?: ReactNode | ((close: () => void) => ReactNode);\n}\n\n/** What a control is, as far as `HoverMenu` is concerned, when it lives in the header\n * or the footer: not a menu row. */\nconst SECTION_CONTROLS = \"a[href]:not([role]),button:not([role])\";\nconst TABBABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]';\n\n/**\n * A header or footer inside the menu panel.\n *\n * `HoverMenu` promotes EVERY role-less button and link in its panel to a `menuitem` out\n * of the Tab order, and turns every list into `role=\"none\"` — right for the rows, wrong\n * for a footer of legal links, which would join the arrow-key cycle and drop out of Tab.\n * So before it looks (a child's layout effect runs before its parent's), the controls\n * in here get their own role spelled out, which `HoverMenu` leaves alone, and any list\n * keeps its list semantics.\n */\nfunction MenuSection({ className, children }: { className: string; children: ReactNode }) {\n const ref = useRef<HTMLLIElement>(null);\n useLayoutEffect(() => {\n const el = ref.current;\n if (!el) return;\n for (const c of el.querySelectorAll<HTMLElement>(SECTION_CONTROLS)) {\n c.setAttribute(\"role\", c.tagName === \"A\" ? \"link\" : \"button\");\n }\n for (const l of el.querySelectorAll<HTMLElement>(\"ul:not([role]),ol:not([role])\")) l.setAttribute(\"role\", \"list\");\n for (const l of el.querySelectorAll<HTMLElement>(\"li:not([role])\")) l.setAttribute(\"role\", \"listitem\");\n });\n return (\n <li ref={ref} role=\"none\" className={className}>\n {children}\n </li>\n );\n}\n\n/**\n * `HoverMenu` closes on any Tab inside the panel — right when Tab leaves it, wrong when\n * Tab is on its way from a row to a footer link, or from one footer link to the next:\n * the panel would unmount under the focus. So a Tab whose next stop is still inside the\n * panel stops here and the browser moves focus; one that leaves reaches `HoverMenu`,\n * which closes.\n */\nfunction keepTabInsidePanel(e: ReactKeyboardEvent<HTMLUListElement>) {\n if (e.key !== \"Tab\") return;\n const from = e.target as HTMLElement;\n const stops = Array.from(e.currentTarget.querySelectorAll<HTMLElement>(TABBABLE)).filter(\n (el) => el.getAttribute(\"tabindex\") !== \"-1\",\n );\n const way = e.shiftKey ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;\n if (stops.some((el) => el !== from && from.compareDocumentPosition(el) & way)) e.stopPropagation();\n}\n\n/**\n * A top-bar icon button that opens a {@link HoverMenu} of actions and/or links,\n * with an optional uppercase heading and divider rules. Generic glue over the\n * shared top-bar chrome — e.g. the feedback launcher or the guided-tours menu —\n * so those call sites describe their rows as data instead of rebuilding the\n * trigger + list markup. For a checkmarked value-switcher use\n * {@link OptionSwitcherMenu} instead.\n *\n * It is also the ACCOUNT menu kastlan and keksdose each hand-build on `HoverMenu`: a\n * custom `trigger` (the avatar), a `header` (name + role / email), the rows, and a\n * free-content `footer` (the legal links).\n *\n * A long menu is grouped by topic with `{ kind: \"heading\" }` entries (0.23) — see\n * {@link TopBarMenuEntry}. There is no separate phone layout: the panel is the same\n * hover panel at 390px, kept inside the viewport by `HoverMenu`, and a heading wraps\n * rather than widening it.\n */\nexport function TopBarActionMenu({\n icon,\n iconBadge,\n trigger,\n triggerClassName,\n href,\n ariaLabel,\n heading,\n header,\n entries,\n children,\n footer,\n footerLabel,\n align,\n panelClassName,\n}: {\n /** The trigger's face for the usual icon button. Ignored when `trigger` is given. */\n icon?: ReactNode;\n /**\n * A status dot in the top-end corner of `icon` — keksdose's unread-support dot on the\n * feedback trigger. Like `UserAvatar`'s `badge`, its `label` joins the trigger's name\n * (\"Send feedback 2 unread\"), so the dot is not something only the eye is told about.\n * Ignored with `trigger`: give the face its own badge there.\n */\n iconBadge?: UserAvatarBadge | null;\n /**\n * A face of your own for the trigger — the account menu's `UserAvatar`. It is drawn\n * INSIDE the kit's button, which keeps the wiring: `aria-haspopup`, `aria-expanded`,\n * the toggle, the keyboard. `open` is there for a chevron that turns.\n *\n * The button is named by `ariaLabel` followed by any readable text in the face — a\n * `UserAvatar` `badge` label reaches a screen reader that way (\"Account menu 3\n * unread\"), where an `aria-label` on the button would have hidden it. A\n * `UserAvatar`'s initials are `aria-hidden`, so the person's name is only in the\n * name if `ariaLabel` carries it (\"Marcel Eifert, account menu\").\n */\n trigger?: (state: { open: boolean }) => ReactNode;\n /** Extra classes for the trigger button — `rounded-full` round an avatar. */\n triggerClassName?: string;\n /**\n * Make the trigger a LINK to this route (keksdose dev #585, Marcel: \"clicking on the\n * guided tours icon shall lead to the tours page like the all tours element does\").\n * A click or Enter follows it and shuts the panel; hover still opens the panel after\n * the usual delay, and ↓/↑ on the focused trigger still open it onto the first/last\n * row, so the rows stay reachable by keyboard. A tap on a touch screen follows the\n * link — so use it where the destination offers everything the menu does. Rendered as\n * an `<a>` (the router's `Link`) with `aria-haspopup=\"menu\"` and `aria-expanded`,\n * named by `ariaLabel`: a link inside the kit's button would be interactive content\n * inside interactive content.\n */\n href?: string;\n /** Names the trigger and the menu. */\n ariaLabel: string;\n heading?: string;\n /** A non-interactive identity block above the rows. */\n header?: TopBarMenuHeader;\n entries: TopBarMenuEntry[];\n /**\n * Rows the entry data cannot describe (a `Disclosure` sub-list, an app's own\n * section), after `entries`. Render `<li>`s holding `MenuItem`s or plain controls;\n * `close` shuts the menu.\n */\n children?: (close: () => void) => ReactNode;\n /**\n * Free content below the rows, behind a rule — the legal links. Its links and\n * buttons are NOT menu rows: the arrow keys skip them and Tab reaches them. Pass a\n * function to get `close` for the links' `onClick`.\n */\n footer?: ReactNode | ((close: () => void) => ReactNode);\n /** Wraps the footer in a `<nav>` with this name (\"Legal\"). Without it, a plain block. */\n footerLabel?: string;\n /** Which edge of the trigger the panel lines up with (see `HoverMenu`). Default `end`. */\n align?: \"start\" | \"end\" | \"left\" | \"right\";\n panelClassName?: string;\n}) {\n // Names the groups' headings for `aria-labelledby`. Positional rather than from the\n // entry's `key`, which is the caller's text and may hold a space — and a space in\n // `aria-labelledby` is a list separator.\n const uid = useId();\n return (\n <HoverMenu\n ariaLabel={ariaLabel}\n align={align}\n trigger={({ open, toggle, close }) => {\n // One element for both kinds: the router's link when `href` is set, else the\n // kit's button. Same classes and face either way.\n const control = (className: string, children: ReactNode, label?: string) =>\n href ? (\n <Link to={href} onClick={close} aria-label={label} className={className}>\n {children}\n </Link>\n ) : (\n <button type=\"button\" onClick={toggle} aria-label={label} className={className}>\n {children}\n </button>\n );\n if (trigger) {\n return control(\n cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName),\n <>\n <span className=\"sr-only\">{ariaLabel}</span>\n {/* The space keeps the name from running into the face's text (\"Account\n menu3 unread\"); as a flex item it takes no room. */}\n {\" \"}\n {trigger({ open })}\n </>,\n );\n }\n if (iconBadge) {\n // Named by its content, like the custom-trigger branch, so the badge label is\n // part of the name; an `aria-label` would have hidden it.\n return control(\n cn(TOPBAR_TRIGGER_CLASS, \"relative\", triggerClassName),\n <>\n <span className=\"sr-only\">{ariaLabel}</span>{\" \"}\n <span aria-hidden className=\"relative inline-flex\">\n {icon}\n <StatusDot ring tone={iconBadge.tone ?? \"danger\"} className=\"absolute -end-0.5 -top-0.5\" />\n </span>{\" \"}\n <span className=\"sr-only\">{iconBadge.label}</span>\n </>,\n );\n }\n return control(cn(TOPBAR_TRIGGER_CLASS, triggerClassName), icon, ariaLabel);\n }}\n >\n {(close) => {\n const footerBody = typeof footer === \"function\" ? footer(close) : footer;\n const headerExtra = typeof header?.extra === \"function\" ? header.extra(close) : header?.extra;\n const footerClass =\n \"flex flex-wrap gap-x-3 gap-y-1 text-xs text-[var(--text-muted)] [&_a:hover]:text-[var(--text-primary)] [&_a]:rounded-sm [&_a:focus-visible]:outline-none [&_a:focus-visible]:ring-2 [&_a:focus-visible]:ring-[var(--brand)]\";\n /** One action or link row — loose, or inside a heading's group. */\n const row = (entry: RowEntry) => (\n <li key={entry.key}>\n {entry.kind === \"link\" ? (\n <MenuItem\n href={entry.to}\n renderLink={({ href, ...p }) => <Link to={href} {...p} />}\n onClick={close}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n current={entry.current}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n ) : (\n <MenuItem\n onClick={() => {\n entry.onSelect();\n close();\n }}\n leading={entry.icon}\n trailing={entry.trailing}\n tone={entry.tone}\n checked={entry.checked}\n checkable={entry.checkable}\n disabled={entry.disabled}\n >\n {entry.label}\n </MenuItem>\n )}\n </li>\n );\n return (\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions -- a Tab bubbling up from a row or footer link, see keepTabInsidePanel\n <ul className={cn(\"py-1\", panelClassName)} onKeyDown={keepTabInsidePanel}>\n {header && (\n <MenuSection className=\"mb-1 border-b border-[var(--border)] px-3 py-2\">\n <div className=\"truncate text-sm font-medium text-[var(--text-primary)]\">{header.title}</div>\n {header.subtitle != null && (\n <div className=\"truncate text-xs text-[var(--text-muted)]\">{header.subtitle}</div>\n )}\n {headerExtra != null && headerExtra !== false && <div className=\"mt-1\">{headerExtra}</div>}\n </MenuSection>\n )}\n {heading && (\n <li className=\"px-3 py-1 text-[10px] font-semibold uppercase tracking-wide text-[var(--text-placeholder)]\">\n {heading}\n </li>\n )}\n {toBlocks(entries).map((block, i, blocks) => {\n if (block.kind === \"loose\") {\n const entry = block.entry;\n if (entry.kind === \"divider\") {\n return <li key={entry.key} className=\"my-1 border-t border-[var(--border)]\" />;\n }\n return row(entry);\n }\n const headingId = `${uid}-group-${i}`;\n const before = blocks[i - 1];\n // Under a rule (or at the top of the rows) the rule's margin is the gap;\n // straight under another group's last row the heading makes its own.\n const tight = !before || (before.kind === \"loose\" && before.entry.kind === \"divider\");\n return (\n <li key={block.heading.key} role=\"none\">\n <div\n id={headingId}\n role=\"presentation\"\n className={cn(\n \"px-3 pb-0.5 text-[11px] font-semibold uppercase tracking-wide text-[var(--text-muted)] [overflow-wrap:anywhere]\",\n tight ? \"pt-1\" : \"pt-2.5\",\n )}\n >\n {block.heading.label}\n </div>\n <ul role=\"group\" aria-labelledby={headingId}>\n {block.rows.map(row)}\n </ul>\n </li>\n );\n })}\n {children?.(close)}\n {footerBody != null && footerBody !== false && (\n <MenuSection className=\"mt-1 border-t border-[var(--border)] px-3 py-2\">\n {footerLabel ? (\n <nav aria-label={footerLabel} className={footerClass}>\n {footerBody}\n </nav>\n ) : (\n <div className={footerClass}>{footerBody}</div>\n )}\n </MenuSection>\n )}\n </ul>\n );\n }}\n </HoverMenu>\n );\n}\n"],"mappings":";AA8JI,SA2IQ,UA3IR,KA2IQ,YA3IR;AA9JJ,SAAS,OAAO,iBAAiB,cAAc;AAE/C,SAAS,YAAY;AACrB,SAAS,UAAU;AACnB,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAEzB,SAAS,iBAAiB;AAE1B,SAAS,4BAA4B;AAiFrC,SAAS,SAAS,SAA8C;AAC9D,QAAM,SAAkB,CAAC;AACzB,MAAI,QAAkD;AACtD,aAAW,SAAS,SAAS;AAC3B,QAAI,MAAM,SAAS,WAAW;AAC5B,cAAQ,EAAE,MAAM,SAAS,SAAS,OAAO,MAAM,CAAC,EAAE;AAClD,aAAO,KAAK,KAAK;AAAA,IACnB,WAAW,MAAM,SAAS,WAAW;AACnC,cAAQ;AACR,aAAO,KAAK,EAAE,MAAM,SAAS,MAAM,CAAC;AAAA,IACtC,WAAW,OAAO;AAChB,YAAM,KAAK,KAAK,KAAK;AAAA,IACvB,OAAO;AACL,aAAO,KAAK,EAAE,MAAM,SAAS,MAAM,CAAC;AAAA,IACtC;AAAA,EACF;AAEA,SAAO,OAAO,OAAO,CAAC,UAAU,MAAM,SAAS,WAAW,MAAM,KAAK,SAAS,CAAC;AACjF;AAyBA,MAAM,mBAAmB;AACzB,MAAM,WAAW;AAYjB,SAAS,YAAY,EAAE,WAAW,SAAS,GAA+C;AACxF,QAAM,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AAAA,sBACT;AAAA,sBACA,QAAQ,SAAS;AAAA,oBACnB;AAAA,oBAEC,gBAAM,QAAQ;AAAA;AAAA,gBACjB;AAAA,gBACA,oBAAC,QAAG,MAAK,SAAQ,mBAAiB,WAC/B,gBAAM,KAAK,IAAI,GAAG,GACrB;AAAA,mBAbO,MAAM,QAAQ,GAcvB;AAAA,YAEJ,CAAC;AAAA,YACA,WAAW,KAAK;AAAA,YAChB,cAAc,QAAQ,eAAe,SACpC,oBAAC,eAAY,WAAU,kDACpB,wBACC,oBAAC,SAAI,cAAY,aAAa,WAAW,aACtC,sBACH,IAEA,oBAAC,SAAI,WAAW,aAAc,sBAAW,GAE7C;AAAA,aAEJ;AAAA;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;","names":["children","href"]}
|
package/dist/shell.d.ts
CHANGED
|
@@ -13,16 +13,20 @@ import './theme/theme-store.js';
|
|
|
13
13
|
import 'zustand/middleware';
|
|
14
14
|
import 'zustand';
|
|
15
15
|
import 'lucide-react';
|
|
16
|
-
import './
|
|
17
|
-
import './
|
|
16
|
+
import './feedback-BxeQVzwq.js';
|
|
17
|
+
import './feedback-attachment-fGAzZPf0.js';
|
|
18
|
+
import './feedback/feedback-inbox.js';
|
|
19
|
+
import './components/tooltip.js';
|
|
20
|
+
import './hooks/use-anchored-rect.js';
|
|
21
|
+
import './lib/clipping.js';
|
|
22
|
+
import './data-table-labels-B7OdnM0S.js';
|
|
23
|
+
import './components/data-table-sort.js';
|
|
24
|
+
import './components/swipeable-row.js';
|
|
18
25
|
import './components/mini-calendar.js';
|
|
19
26
|
import './components/calendar-heatmap.js';
|
|
20
27
|
import './components/popover.js';
|
|
21
28
|
import './components/chip.js';
|
|
22
29
|
import './components/field-sync.js';
|
|
23
|
-
import './components/tooltip.js';
|
|
24
|
-
import './hooks/use-anchored-rect.js';
|
|
25
|
-
import './lib/clipping.js';
|
|
26
30
|
import './wizard/types.js';
|
|
27
31
|
import './tour/tour.js';
|
|
28
32
|
import './search/command-palette.js';
|
|
@@ -36,7 +40,6 @@ import './components/sparkline.js';
|
|
|
36
40
|
import './components/stat-tile.js';
|
|
37
41
|
import './components/signature-pad.js';
|
|
38
42
|
import './components/password-strength.js';
|
|
39
|
-
import './components/danger-confirm.js';
|
|
40
43
|
import './components/swatch-picker.js';
|
|
41
44
|
import './components/tile-radio.js';
|
|
42
45
|
import './components/icon-picker.js';
|
|
@@ -44,11 +47,7 @@ import './components/dialog-frame.js';
|
|
|
44
47
|
import './components/modal.js';
|
|
45
48
|
import './hooks/use-search-param-state.js';
|
|
46
49
|
import './components/measured-grid.js';
|
|
47
|
-
import './feedback-attachment-WFiXJ8We.js';
|
|
48
|
-
import './feedback/feedback-thread.js';
|
|
49
|
-
import './feedback/feedback-inbox.js';
|
|
50
50
|
import './components/account-settings-labels.js';
|
|
51
|
-
import './components/confirm-dialog.js';
|
|
52
51
|
import './components/floating-panel.js';
|
|
53
52
|
import './components/bulk-action-bar.js';
|
|
54
53
|
import './components/list.js';
|
|
@@ -67,14 +66,20 @@ import './components/write-lock.js';
|
|
|
67
66
|
import './components/legal.js';
|
|
68
67
|
import './components/account-chips.js';
|
|
69
68
|
import './lib/format.js';
|
|
70
|
-
import './data-table-3mi2R3so.js';
|
|
71
|
-
import './components/data-table-sort.js';
|
|
72
|
-
import './components/swipeable-row.js';
|
|
73
69
|
import './components/reauth-dialog.js';
|
|
74
70
|
import './components/server-wake.js';
|
|
75
71
|
import './lib/server-wake.js';
|
|
76
72
|
import './components/translation-review-labels.js';
|
|
77
73
|
import './lib/translation-review.js';
|
|
74
|
+
import './components/country-select.js';
|
|
75
|
+
import './components/inline-edit-field.js';
|
|
76
|
+
import './lib/iban.js';
|
|
77
|
+
import './lib/phone.js';
|
|
78
|
+
import './components/sign-chip.js';
|
|
79
|
+
import './components/column-mapper.js';
|
|
80
|
+
import './lib/column-mapping.js';
|
|
81
|
+
import './lib/table-text.js';
|
|
82
|
+
import './components/field-parts.js';
|
|
78
83
|
import './components/menu-item.js';
|
|
79
84
|
import './components/user-avatar.js';
|
|
80
85
|
import './components/status-dot.js';
|
package/dist/table-text.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { DecimalRule, ParseTableOptions, ParsedTable, cellNumber, isCellNumber, parseRows, parseTable, splitRow } from './lib/table-text.js';
|
|
1
|
+
export { DecimalRule, ParseTableOptions, ParseTextTableOptions, ParsedTable, TableLine, TableSeparator, TextTable, cellNumber, isCellNumber, parseRows, parseTable, parseTextTable, splitRow, tableNumber } from './lib/table-text.js';
|
package/dist/tour/tour.js
CHANGED
|
@@ -117,6 +117,10 @@ function sameRect(a, b) {
|
|
|
117
117
|
if (!a || !b) return false;
|
|
118
118
|
return a.top === b.top && a.left === b.left && a.width === b.width && a.height === b.height;
|
|
119
119
|
}
|
|
120
|
+
function rectOf(el) {
|
|
121
|
+
const r = el.getBoundingClientRect();
|
|
122
|
+
return { top: r.top, left: r.left, width: r.width, height: r.height };
|
|
123
|
+
}
|
|
120
124
|
function TourOverlay({
|
|
121
125
|
steps,
|
|
122
126
|
index,
|
|
@@ -128,25 +132,21 @@ function TourOverlay({
|
|
|
128
132
|
const step = steps[index];
|
|
129
133
|
const isFirst = index === 0;
|
|
130
134
|
const isLast = index === steps.length - 1;
|
|
131
|
-
const [
|
|
132
|
-
const
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
setReady(false);
|
|
137
|
-
setRect(null);
|
|
138
|
-
}
|
|
139
|
-
const [dir, setDir] = useState(() => dirOf(null));
|
|
135
|
+
const [located, setLocated] = useState(null);
|
|
136
|
+
const current = located !== null && located.index === index && located.step === step ? located : null;
|
|
137
|
+
const ready = current !== null;
|
|
138
|
+
const rect = current?.rect ?? null;
|
|
139
|
+
const dir = current?.dir ?? "ltr";
|
|
140
140
|
const rootRef = useRef(null);
|
|
141
141
|
useEffect(() => {
|
|
142
142
|
let cancelled = false;
|
|
143
143
|
let raf = 0;
|
|
144
|
+
const settle = (el) => setLocated({ index, step, rect: el ? rectOf(el) : null, dir: dirOf(el) });
|
|
144
145
|
void (async () => {
|
|
145
146
|
await step.beforeStep?.();
|
|
146
147
|
if (cancelled) return;
|
|
147
148
|
if (!step.target) {
|
|
148
|
-
|
|
149
|
-
setReady(true);
|
|
149
|
+
settle(null);
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
152
152
|
let tries = 0;
|
|
@@ -155,17 +155,11 @@ function TourOverlay({
|
|
|
155
155
|
const el = queryVisibleTarget(step.target);
|
|
156
156
|
if (el) {
|
|
157
157
|
el.scrollIntoView({ block: "center", behavior: "smooth" });
|
|
158
|
-
|
|
159
|
-
setRect({ top: r.top, left: r.left, width: r.width, height: r.height });
|
|
160
|
-
setDir(dirOf(el));
|
|
161
|
-
setReady(true);
|
|
158
|
+
settle(el);
|
|
162
159
|
return;
|
|
163
160
|
}
|
|
164
161
|
if (tries++ < 45) raf = requestAnimationFrame(find);
|
|
165
|
-
else
|
|
166
|
-
setDir(dirOf(null));
|
|
167
|
-
setReady(true);
|
|
168
|
-
}
|
|
162
|
+
else settle(null);
|
|
169
163
|
};
|
|
170
164
|
find();
|
|
171
165
|
})();
|
|
@@ -179,9 +173,10 @@ function TourOverlay({
|
|
|
179
173
|
const update = () => {
|
|
180
174
|
const el = queryVisibleTarget(step.target);
|
|
181
175
|
if (el) {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
|
|
176
|
+
const next = rectOf(el);
|
|
177
|
+
setLocated(
|
|
178
|
+
(prev) => prev && prev.index === index && prev.step === step && !sameRect(prev.rect, next) ? { ...prev, rect: next } : prev
|
|
179
|
+
);
|
|
185
180
|
}
|
|
186
181
|
};
|
|
187
182
|
window.addEventListener("scroll", update, true);
|
|
@@ -193,14 +188,15 @@ function TourOverlay({
|
|
|
193
188
|
clearInterval(id);
|
|
194
189
|
};
|
|
195
190
|
}, [index, step]);
|
|
191
|
+
const spotted = rect !== null;
|
|
196
192
|
useEffect(() => {
|
|
197
|
-
if (!ready || !step.awaitClick || !step.target) return;
|
|
193
|
+
if (!ready || !spotted || !step.awaitClick || !step.target) return;
|
|
198
194
|
const el = queryVisibleTarget(step.target);
|
|
199
195
|
if (!el) return;
|
|
200
196
|
const onClick = () => window.setTimeout(() => onNext(), 0);
|
|
201
197
|
el.addEventListener("click", onClick, { once: true });
|
|
202
198
|
return () => el.removeEventListener("click", onClick);
|
|
203
|
-
}, [ready, index, step, onNext]);
|
|
199
|
+
}, [ready, spotted, index, step, onNext]);
|
|
204
200
|
useEffect(() => {
|
|
205
201
|
const onKey = (e) => {
|
|
206
202
|
if (e.key === "Escape") {
|