@eifi1/ui-kit 0.34.0 → 0.36.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 +115 -41
- package/dist/admin/role-select.d.ts +3 -2
- package/dist/admin/role-select.js +2 -0
- package/dist/admin/role-select.js.map +1 -1
- package/dist/billing/billing-banner.d.ts +5 -2
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/plan-limit-notice.d.ts +5 -2
- package/dist/billing/plan-limit-notice.js.map +1 -1
- package/dist/chart.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -5
- package/dist/components/amount-input.js +2 -2
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete.js +2 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-look.d.ts +1 -1
- package/dist/components/button-look.js +9 -4
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/calculator.d.ts +1 -4
- package/dist/components/calculator.js +1 -3
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/chart-zoom.d.ts +0 -37
- package/dist/components/chart-zoom.js +1 -28
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +5 -2
- package/dist/components/checkbox-group.js +15 -4
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/chip-input.d.ts +0 -4
- package/dist/components/chip-input.js +1 -5
- package/dist/components/chip-input.js.map +1 -1
- package/dist/components/column-mapper.d.ts +5 -3
- package/dist/components/column-mapper.js +2 -0
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox.d.ts +3 -3
- package/dist/components/combobox.js +2 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/copy-button.d.ts +5 -1
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/country-select.d.ts +3 -3
- package/dist/components/country-select.js +3 -0
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-option-list.d.ts +3 -8
- package/dist/components/currency-option-list.js +1 -29
- package/dist/components/currency-option-list.js.map +1 -1
- package/dist/components/currency-select.d.ts +3 -2
- package/dist/components/currency-select.js +10 -1
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm.d.ts +3 -3
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-filter-popover.d.ts +1 -1
- package/dist/components/data-table-filter-popover.js +1 -1
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-labels.d.ts +1 -42
- package/dist/components/data-table-labels.js +2 -31
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-shared.d.ts +17 -1
- package/dist/components/data-table-shared.js +22 -0
- package/dist/components/data-table-shared.js.map +1 -1
- package/dist/components/data-table.d.ts +12 -2
- package/dist/components/data-table.js +18 -14
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-field.d.ts +2 -1
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.js +3 -0
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js +3 -0
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/dialog-frame.d.ts +3 -1
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/dropdown.d.ts +18 -15
- package/dist/components/dropdown.js +11 -3
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +3 -3
- package/dist/components/entity-combobox.js +2 -1
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/field-base.d.ts +0 -5
- package/dist/components/field-base.js +0 -5
- package/dist/components/field-base.js.map +1 -1
- package/dist/components/field-parts.d.ts +69 -22
- package/dist/components/field-parts.js +33 -19
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-strip.d.ts +9 -23
- package/dist/components/field-strip.js +26 -23
- package/dist/components/field-strip.js.map +1 -1
- package/dist/components/field-sync.d.ts +0 -4
- package/dist/components/field-sync.js +0 -4
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.d.ts +7 -6
- package/dist/components/field.js +24 -15
- package/dist/components/field.js.map +1 -1
- package/dist/components/full-bleed-dialog.js +2 -2
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/help-popover.d.ts +9 -7
- package/dist/components/help-popover.js.map +1 -1
- package/dist/components/hover-menu.d.ts +6 -13
- package/dist/components/hover-menu.js +3 -3
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/icon-picker.d.ts +3 -2
- package/dist/components/icon-picker.js +3 -0
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-entity-combobox.d.ts +3 -3
- package/dist/components/inline-entity-combobox.js +2 -1
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +2 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/modal.d.ts +9 -1
- package/dist/components/modal.js +7 -4
- package/dist/components/modal.js.map +1 -1
- package/dist/components/month-picker.d.ts +2 -1
- package/dist/components/month-picker.js +8 -1
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +2 -2
- package/dist/components/multi-entity-combobox.js +2 -1
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +7 -18
- package/dist/components/multi-select.js +8 -10
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-input.d.ts +2 -5
- package/dist/components/number-input.js +2 -4
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numeric-field.d.ts +5 -2
- package/dist/components/numeric-field.js +4 -1
- package/dist/components/numeric-field.js.map +1 -1
- package/dist/components/one-time-code-input.d.ts +2 -1
- package/dist/components/one-time-code-input.js +2 -1
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +4 -0
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popover.js +3 -3
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.d.ts +4 -3
- package/dist/components/select.js +2 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/server-wake.d.ts +0 -6
- package/dist/components/server-wake.js.map +1 -1
- package/dist/components/settings-fields.d.ts +4 -2
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/slider.d.ts +3 -2
- package/dist/components/slider.js +7 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-tile.d.ts +8 -2
- package/dist/components/stat-tile.js +2 -11
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +3 -2
- package/dist/components/swatch-picker.js +3 -0
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +2 -17
- package/dist/components/swipeable-row.js +11 -16
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/text-link.js +3 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/textarea.d.ts +2 -1
- package/dist/components/textarea.js +9 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +7 -3
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/tooltip.d.ts +9 -1
- package/dist/components/tooltip.js +20 -5
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review.d.ts +10 -2
- package/dist/components/translation-review.js +11 -3
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/use-table-state.d.ts +31 -3
- package/dist/components/use-table-state.js +53 -8
- package/dist/components/use-table-state.js.map +1 -1
- package/dist/components/user-avatar.d.ts +2 -2
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.d.ts +1 -4
- package/dist/components/wizard-stepper.js +2 -3
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/currencies.d.ts +23 -0
- package/dist/currencies.js +38 -0
- package/dist/currencies.js.map +1 -0
- package/dist/demo/demo-banner.d.ts +7 -2
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/eslint/index.d.ts +83 -0
- package/dist/eslint/index.js +69 -0
- package/dist/eslint/index.js.map +1 -0
- package/dist/eslint/role-utilities.d.ts +48 -0
- package/dist/eslint/role-utilities.generated.d.ts +2 -0
- package/dist/eslint/role-utilities.generated.js +143 -0
- package/dist/eslint/role-utilities.generated.js.map +1 -0
- package/dist/eslint/role-utilities.js +43 -0
- package/dist/eslint/role-utilities.js.map +1 -0
- package/dist/feedback/feedback-menu.d.ts +2 -2
- package/dist/feedback/feedback-menu.js.map +1 -1
- package/dist/feedback/feedback-thread.d.ts +3 -8
- package/dist/feedback/feedback-thread.js +0 -2
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +16 -3
- package/dist/hooks/use-dismiss.js +14 -2
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/i18n/defaults.js +5 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +97 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +29 -4
- package/dist/i18n/kit-labels.js +21 -1
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +104 -3
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +95 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +99 -3
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +95 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +99 -3
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +95 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +13 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +3 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +40 -2
- package/dist/index.js.map +1 -1
- package/dist/lib/device-settings.d.ts +72 -0
- package/dist/lib/device-settings.js +64 -0
- package/dist/lib/device-settings.js.map +1 -0
- package/dist/lib/plain-text.d.ts +11 -0
- package/dist/lib/plain-text.js +16 -0
- package/dist/lib/plain-text.js.map +1 -0
- package/dist/lib/refs.d.ts +13 -0
- package/dist/lib/refs.js +15 -0
- package/dist/lib/refs.js.map +1 -0
- package/dist/lib/safe-storage.d.ts +6 -0
- package/dist/lib/safe-storage.js +11 -0
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/notifications/notification-parts.d.ts +39 -0
- package/dist/notifications/notification-parts.js +47 -0
- package/dist/notifications/notification-parts.js.map +1 -0
- package/dist/notifications/notification-types-setting.d.ts +62 -0
- package/dist/notifications/notification-types-setting.js +192 -0
- package/dist/notifications/notification-types-setting.js.map +1 -0
- package/dist/notifications/notification-types.d.ts +75 -0
- package/dist/notifications/notification-types.js +2 -0
- package/dist/notifications/notification-types.js.map +1 -0
- package/dist/notifications/notifications-labels.d.ts +131 -0
- package/dist/notifications/notifications-labels.js +83 -0
- package/dist/notifications/notifications-labels.js.map +1 -0
- package/dist/notifications/push-device-setting.d.ts +37 -0
- package/dist/notifications/push-device-setting.js +164 -0
- package/dist/notifications/push-device-setting.js.map +1 -0
- package/dist/notifications/push-devices-setting.d.ts +44 -0
- package/dist/notifications/push-devices-setting.js +203 -0
- package/dist/notifications/push-devices-setting.js.map +1 -0
- package/dist/notifications/quiet-hours-setting.d.ts +47 -0
- package/dist/notifications/quiet-hours-setting.js +131 -0
- package/dist/notifications/quiet-hours-setting.js.map +1 -0
- package/dist/notifications/time-zone-select.d.ts +50 -0
- package/dist/notifications/time-zone-select.js +76 -0
- package/dist/notifications/time-zone-select.js.map +1 -0
- package/dist/notifications/unsubscribe-panel.d.ts +53 -0
- package/dist/notifications/unsubscribe-panel.js +139 -0
- package/dist/notifications/unsubscribe-panel.js.map +1 -0
- package/dist/notifications/use-push-device.d.ts +122 -0
- package/dist/notifications/use-push-device.js +230 -0
- package/dist/notifications/use-push-device.js.map +1 -0
- package/dist/rhf/fields.d.ts +36 -29
- package/dist/rhf/fields.js +51 -22
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form-core.d.ts +5 -4
- package/dist/rhf/form-core.js.map +1 -1
- package/dist/rhf/form.d.ts +7 -36
- package/dist/rhf/form.js +1 -16
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf/line-items.d.ts +1 -1
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf/use-rhf-wizard-step.js.map +1 -1
- package/dist/rhf.js.map +1 -1
- package/dist/settings/device-reset-setting-labels.d.ts +3 -0
- package/dist/settings/device-reset-setting-labels.js +15 -0
- package/dist/settings/device-reset-setting-labels.js.map +1 -0
- package/dist/settings/device-reset-setting.d.ts +58 -0
- package/dist/settings/device-reset-setting.js +51 -0
- package/dist/settings/device-reset-setting.js.map +1 -0
- package/dist/shell/app-shell.js +5 -0
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/option-switcher-menu.d.ts +5 -17
- package/dist/shell/option-switcher-menu.js +1 -3
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +1 -4
- package/dist/shell/role-switcher.js +2 -3
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +7 -19
- package/dist/shell/topbar-action-menu.js +1 -3
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +3 -12
- package/dist/shell/topbar-controls.js +6 -9
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/testing/index.js +2 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/viewport.d.ts +25 -2
- package/dist/testing/viewport.js +61 -10
- package/dist/testing/viewport.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +42 -4
- package/dist/theme/contrast-tokens.js +56 -9
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +4 -2
- package/dist/theme/contrast.js +13 -0
- package/dist/theme/contrast.js.map +1 -1
- package/dist/theme/palette-derive.d.ts +15 -1
- package/dist/theme/palette-derive.js +37 -8
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +2 -8
- package/dist/theme/palette-presets.js +5 -284
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js +6 -0
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.js +6 -0
- package/dist/theme/text-size.js.map +1 -1
- package/dist/theme/theme-store.js +6 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/dist/wizard/types.d.ts +0 -5
- package/dist/wizard/types.js +1 -5
- package/dist/wizard/types.js.map +1 -1
- package/package.json +9 -1
- package/src/admin/role-select.tsx +4 -1
- package/src/billing/billing-banner.tsx +5 -2
- package/src/billing/plan-limit-notice.tsx +5 -2
- package/src/chart.ts +5 -3
- package/src/components/amount-input.tsx +4 -7
- package/src/components/autocomplete.tsx +5 -2
- package/src/components/button-look.ts +15 -5
- package/src/components/calculator.tsx +2 -7
- package/src/components/chart-zoom.tsx +4 -47
- package/src/components/checkbox-group.tsx +22 -4
- package/src/components/chip-input.tsx +0 -7
- package/src/components/column-mapper.tsx +6 -2
- package/src/components/combobox.tsx +6 -3
- package/src/components/copy-button.tsx +5 -1
- package/src/components/country-select.tsx +6 -1
- package/src/components/currency-option-list.tsx +8 -42
- package/src/components/currency-select.tsx +12 -3
- package/src/components/danger-confirm.tsx +3 -3
- package/src/components/data-table-filter-popover.tsx +2 -1
- package/src/components/data-table-labels.ts +2 -84
- package/src/components/data-table-shared.tsx +55 -2
- package/src/components/data-table.tsx +29 -17
- package/src/components/date-field.tsx +2 -2
- package/src/components/date-picker.tsx +3 -0
- package/src/components/date-range-picker.tsx +3 -0
- package/src/components/dialog-frame.tsx +3 -1
- package/src/components/dropdown.tsx +42 -18
- package/src/components/entity-combobox.tsx +6 -3
- package/src/components/field-base.tsx +0 -11
- package/src/components/field-parts.tsx +112 -38
- package/src/components/field-strip.tsx +12 -27
- package/src/components/field-sync.tsx +0 -7
- package/src/components/field.tsx +32 -19
- package/src/components/full-bleed-dialog.tsx +4 -3
- package/src/components/help-popover.tsx +9 -7
- package/src/components/hover-menu.tsx +12 -16
- package/src/components/icon-picker.tsx +8 -3
- package/src/components/inline-entity-combobox.tsx +6 -3
- package/src/components/input.tsx +4 -2
- package/src/components/modal.tsx +20 -4
- package/src/components/month-picker.tsx +10 -3
- package/src/components/multi-entity-combobox.tsx +5 -2
- package/src/components/multi-select.tsx +19 -31
- package/src/components/number-input.tsx +5 -10
- package/src/components/numeric-field.ts +10 -2
- package/src/components/one-time-code-input.tsx +5 -3
- package/src/components/phone-input.tsx +4 -0
- package/src/components/popover.tsx +8 -4
- package/src/components/select.tsx +6 -3
- package/src/components/series-chart.tsx +1 -1
- package/src/components/server-wake.tsx +0 -6
- package/src/components/settings-fields.tsx +4 -2
- package/src/components/slider.tsx +10 -3
- package/src/components/stat-tile.tsx +11 -20
- package/src/components/swatch-picker.tsx +9 -4
- package/src/components/swipeable-row.tsx +15 -37
- package/src/components/text-link.tsx +3 -1
- package/src/components/textarea.tsx +11 -4
- package/src/components/toggle-group.tsx +21 -5
- package/src/components/tooltip.tsx +37 -6
- package/src/components/translation-review.tsx +25 -7
- package/src/components/use-table-state.ts +91 -10
- package/src/components/user-avatar.tsx +2 -2
- package/src/components/wizard-stepper.tsx +2 -6
- package/src/currencies.ts +70 -0
- package/src/demo/demo-banner.tsx +7 -2
- package/src/eslint/index.ts +161 -0
- package/src/eslint/role-utilities.generated.ts +146 -0
- package/src/eslint/role-utilities.ts +99 -0
- package/src/feedback/feedback-menu.tsx +2 -2
- package/src/feedback/feedback-thread.tsx +3 -8
- package/src/hooks/use-dismiss.ts +39 -4
- package/src/i18n/defaults.ts +4 -0
- package/src/i18n/german.ts +113 -0
- package/src/i18n/kit-labels.tsx +66 -6
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +106 -0
- package/src/i18n/locales/fr.ts +109 -2
- package/src/i18n/locales/hu.ts +104 -0
- package/src/i18n/locales/it.ts +108 -2
- package/src/i18n/locales/zh.ts +96 -0
- package/src/i18n/review.ts +13 -0
- package/src/i18n/shared-labels.ts +2 -0
- package/src/index.ts +53 -1
- package/src/lib/device-settings.ts +146 -0
- package/src/lib/plain-text.ts +22 -0
- package/src/lib/refs.ts +22 -0
- package/src/lib/safe-storage.ts +16 -0
- package/src/notifications/notification-parts.tsx +83 -0
- package/src/notifications/notification-types-setting.tsx +309 -0
- package/src/notifications/notification-types.ts +80 -0
- package/src/notifications/notifications-labels.ts +238 -0
- package/src/notifications/push-device-setting.tsx +224 -0
- package/src/notifications/push-devices-setting.tsx +306 -0
- package/src/notifications/quiet-hours-setting.tsx +185 -0
- package/src/notifications/time-zone-select.tsx +126 -0
- package/src/notifications/unsubscribe-panel.tsx +203 -0
- package/src/notifications/use-push-device.ts +392 -0
- package/src/rhf/fields.tsx +87 -39
- package/src/rhf/form-core.tsx +5 -4
- package/src/rhf/form.tsx +7 -43
- package/src/rhf/line-items.tsx +1 -1
- package/src/rhf/use-rhf-wizard-step.ts +4 -4
- package/src/rhf.ts +3 -2
- package/src/settings/device-reset-setting-labels.ts +20 -0
- package/src/settings/device-reset-setting.tsx +119 -0
- package/src/shell/app-shell.tsx +8 -0
- package/src/shell/option-switcher-menu.tsx +5 -22
- package/src/shell/role-switcher.tsx +2 -6
- package/src/shell/topbar-action-menu.tsx +7 -24
- package/src/shell/topbar-controls.tsx +6 -18
- package/src/testing/index.ts +3 -1
- package/src/testing/viewport.ts +125 -19
- package/src/theme/contrast-tokens.ts +106 -12
- package/src/theme/contrast.ts +30 -4
- package/src/theme/palette-derive.ts +68 -7
- package/src/theme/palette-presets.ts +16 -299
- package/src/theme/palette-store.ts +12 -0
- package/src/theme/text-size.ts +8 -0
- package/src/theme/theme-store.ts +10 -0
- package/src/wizard/types.ts +0 -8
- package/tokens.css +38 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode
|
|
1
|
+
import type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from "react";
|
|
2
2
|
import { type TooltipSide } from "./tooltip.js";
|
|
3
3
|
import { type CommitScope } from "./write-lock.js";
|
|
4
4
|
/**
|
|
@@ -27,15 +27,7 @@ import { type CommitScope } from "./write-lock.js";
|
|
|
27
27
|
* copy of the presence rule, for the native choice controls alone.
|
|
28
28
|
*/
|
|
29
29
|
export declare function mergeDescribedBy(...ids: Array<string | false | null | undefined>): string | undefined;
|
|
30
|
-
|
|
31
|
-
export declare function assignRef<T>(ref: Ref<T> | undefined, node: T | null): void;
|
|
32
|
-
/**
|
|
33
|
-
* One callback ref feeding several — the caller's forwarded `ref` and a field's own
|
|
34
|
-
* (DUP-11: AmountInput, FormActions, ScrollArea and SearchField each wrote this by hand).
|
|
35
|
-
* Wrap it in `useCallback` (or `useMemo`) over the same refs where a new callback every
|
|
36
|
-
* render would detach and re-attach the node.
|
|
37
|
-
*/
|
|
38
|
-
export declare function mergeRefs<T>(...refs: Array<Ref<T> | undefined>): RefCallback<T>;
|
|
30
|
+
export { assignRef, mergeRefs } from "../lib/refs.js";
|
|
39
31
|
export declare const STATIC_LABEL_TYPE = "text-caption leading-tight text-muted peer-disabled:opacity-50";
|
|
40
32
|
/**
|
|
41
33
|
* A field's label at Large and Extra large (0.33, docs/text-size-harmonization.md
|
|
@@ -118,8 +110,55 @@ export declare function FieldHint({ label, side, className, "aria-label": ariaLa
|
|
|
118
110
|
* The kit's fields call it through {@link useFieldHint} / {@link useFieldMessages}; a
|
|
119
111
|
* field that resolves its own `hint` (an app's, or one of the kit's own outside this
|
|
120
112
|
* file) calls it first and then treats the result as it treated a text hint.
|
|
113
|
+
*
|
|
114
|
+
* `withHelp` (round 0.36): the field has a `help`, whose "?" is the field's only one
|
|
115
|
+
* ({@link fieldHelpMark}) — so a FieldHint is its words at EVERY size, not only at Large
|
|
116
|
+
* and on touch.
|
|
117
|
+
*/
|
|
118
|
+
export declare function useInlineHint(hint: ReactNode, withHelp?: boolean): ReactNode;
|
|
119
|
+
/**
|
|
120
|
+
* The doc every field's `help` prop points at.
|
|
121
|
+
*
|
|
122
|
+
* A field may carry two kinds of words (§10.23): a FACT — a format, a limit, a
|
|
123
|
+
* consequence — which stays visible, and HELP — why the field exists, how to choose,
|
|
124
|
+
* what the options mean — which the field is usable without and which may sit behind a
|
|
125
|
+
* "?". Until 0.36 a field had one slot, `hint`, so a field with both had to drop one or
|
|
126
|
+
* print a paragraph (Kurvenschmiede's "How it was measured", round 0.36 H). Now:
|
|
127
|
+
*
|
|
128
|
+
* - `hint` is the fact, the caption under the field, on its `aria-describedby`;
|
|
129
|
+
* - `help` is the help, a {@link HelpPopover} "?" on the label line (an unlabelled
|
|
130
|
+
* field's at its end edge, as a hint's), named "About <label>" (`common.aboutField`,
|
|
131
|
+
* from the label's text, else the `aria-label`, else `common.help`). Pass a
|
|
132
|
+
* `HelpPopover` as `help` to name it yourself ("What do the statuses mean?").
|
|
133
|
+
*
|
|
134
|
+
* The help's "?" is then the field's ONLY "?": a `FieldHint` passed as `hint` beside it
|
|
135
|
+
* draws none of its own and shows its words as the caption at every size, as it does at
|
|
136
|
+
* Large and on touch; any other `hint` is the caption too. Two "?" side by side would
|
|
137
|
+
* look the same and open different things.
|
|
121
138
|
*/
|
|
122
|
-
export
|
|
139
|
+
export interface FieldHelpProps {
|
|
140
|
+
/**
|
|
141
|
+
* Help the field is usable without — why it exists, how to choose, what the options
|
|
142
|
+
* mean — behind the field's one "?" on its label line: a {@link HelpPopover} named
|
|
143
|
+
* "About <label>" that opens on a tap (round 0.36, docs/text-size-harmonization.md §4).
|
|
144
|
+
* Pass a `HelpPopover` to name it yourself. `hint` stays the visible fact: with `help`
|
|
145
|
+
* set it is the caption under the field at every size, a `FieldHint` included.
|
|
146
|
+
*/
|
|
147
|
+
help?: ReactNode;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A field's `help` as the "?" for its label line, or `undefined` when there is none. A
|
|
151
|
+
* {@link HelpPopover} is used as it is (it carries its own name); anything else is put
|
|
152
|
+
* in one named "About <name>" — `name` is the field's label, else its `aria-label`.
|
|
153
|
+
*/
|
|
154
|
+
export declare function fieldHelpMark(help: ReactNode, name: ReactNode): ReactNode | undefined;
|
|
155
|
+
/** What {@link useFieldHint} needs to draw a field's `help`. */
|
|
156
|
+
export interface FieldHelpSource {
|
|
157
|
+
/** The field's `help`. */
|
|
158
|
+
help?: ReactNode;
|
|
159
|
+
/** What names its "?": the field's label, else its `aria-label`. */
|
|
160
|
+
name?: ReactNode;
|
|
161
|
+
}
|
|
123
162
|
/**
|
|
124
163
|
* Whether a `hint` is a CAPTION (plain text: a non-empty string or a number) or
|
|
125
164
|
* something for the label line (a {@link FieldHint} "?", or any other node).
|
|
@@ -139,17 +178,25 @@ export interface FieldHintParts {
|
|
|
139
178
|
describedBy: string | undefined;
|
|
140
179
|
/** The caption's id while there is one. */
|
|
141
180
|
captionId: string | undefined;
|
|
142
|
-
/** The caption itself, or
|
|
143
|
-
captionText:
|
|
144
|
-
/**
|
|
145
|
-
*
|
|
181
|
+
/** The caption itself — a text hint, or any hint beside a `help` — or `undefined`. */
|
|
182
|
+
captionText: ReactNode | undefined;
|
|
183
|
+
/** What rides the label line — the `help`'s "?" ({@link fieldHelpMark}), else a
|
|
184
|
+
* non-text hint (a FieldHint) — or, on a field with no label line, the end edge
|
|
185
|
+
* outside the box. `undefined` when there is none. */
|
|
146
186
|
labelHint: ReactNode | undefined;
|
|
147
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Whether a resolved `hint` goes under the field as its caption: text always (see
|
|
190
|
+
* {@link isTextHint}); with a `help` beside it, whatever it is — the label line's "?"
|
|
191
|
+
* is the help's (round 0.36, §4).
|
|
192
|
+
*/
|
|
193
|
+
export declare function isHintCaption(hint: ReactNode, withHelp: boolean): boolean;
|
|
148
194
|
/**
|
|
149
195
|
* Split a field's `hint` into the caption under it (attached with `aria-describedby`)
|
|
150
|
-
* or the "?" on its label line. See {@link isTextHint}.
|
|
196
|
+
* or the "?" on its label line. See {@link isTextHint}. With a `help` ({@link
|
|
197
|
+
* FieldHelpProps}), the help's "?" takes the label line and the hint is the caption.
|
|
151
198
|
*/
|
|
152
|
-
export declare function useFieldHint(hintProp: ReactNode, describedBy: string | undefined): FieldHintParts;
|
|
199
|
+
export declare function useFieldHint(hintProp: ReactNode, describedBy: string | undefined, { help, name }?: FieldHelpSource): FieldHintParts;
|
|
153
200
|
/** The error line under a field — one type for every field's message (DUP-8, refactor
|
|
154
201
|
* audit 2026-10: ChipInput and FileDropzone printed theirs in `text-xs`). */
|
|
155
202
|
export declare const FIELD_ERROR_CLASS = "mt-1 text-caption leading-tight text-danger";
|
|
@@ -185,7 +232,7 @@ export declare const FIELD_ERROR_CLASS = "mt-1 text-caption leading-tight text-d
|
|
|
185
232
|
*/
|
|
186
233
|
export declare function useFieldError(error: ReactNode, invalid: boolean | undefined, describedBy: string | undefined,
|
|
187
234
|
/** The caller's own `aria-invalid`. A form library sets THIS (see `@eifi1/ui-kit/rhf`
|
|
188
|
-
* `
|
|
235
|
+
* `RhfField`), not our `invalid` prop — and a field that announces invalid should
|
|
189
236
|
* look it too. */
|
|
190
237
|
ariaInvalid?: unknown): {
|
|
191
238
|
isInvalid: boolean;
|
|
@@ -353,16 +400,16 @@ export interface FieldMessages {
|
|
|
353
400
|
describedBy: string | undefined;
|
|
354
401
|
/** The caption and the error, for under the field; `null` when there is neither. */
|
|
355
402
|
below: ReactNode;
|
|
356
|
-
/**
|
|
357
|
-
* caption
|
|
403
|
+
/** What rides the LABEL line — the `help`'s "?", else a `FieldHint` — or `undefined`
|
|
404
|
+
* when the hint is a caption and there is no help. */
|
|
358
405
|
labelHint: ReactNode;
|
|
359
406
|
}
|
|
360
407
|
/**
|
|
361
|
-
* `hint` / `error` / `invalid` resolved the way `Select` resolves them —
|
|
408
|
+
* `hint` / `help` / `error` / `invalid` resolved the way `Select` resolves them —
|
|
362
409
|
* {@link useFieldHint} and {@link useFieldError} together, for a field that draws what
|
|
363
410
|
* goes under it in one place (a picker, a group, a field built on another).
|
|
364
411
|
*/
|
|
365
|
-
export declare function useFieldMessages({ hint, error, invalid, describedBy, ariaInvalid, reasonId, }: {
|
|
412
|
+
export declare function useFieldMessages({ hint, help, name, error, invalid, describedBy, ariaInvalid, reasonId, }: FieldHelpSource & {
|
|
366
413
|
hint?: ReactNode;
|
|
367
414
|
error?: ReactNode;
|
|
368
415
|
invalid?: boolean;
|
|
@@ -4,23 +4,18 @@ import { createContext, isValidElement, useContext, useId } from "react";
|
|
|
4
4
|
import { HelpCircle } from "lucide-react";
|
|
5
5
|
import { cn } from "../lib/cn.js";
|
|
6
6
|
import { hasContent } from "../lib/presence.js";
|
|
7
|
+
import { plainText } from "../lib/plain-text.js";
|
|
8
|
+
import { DEFAULT_COMMON_LABELS, useKitLabels } from "../i18n/kit-labels.js";
|
|
7
9
|
import { useInlineFacts } from "../hooks/use-large-text.js";
|
|
8
10
|
import { FOCUS_RING } from "./focus-ring.js";
|
|
11
|
+
import { HelpPopover } from "./help-popover.js";
|
|
9
12
|
import { Tooltip } from "./tooltip.js";
|
|
10
13
|
import { useCommitReason } from "./write-lock.js";
|
|
11
14
|
function mergeDescribedBy(...ids) {
|
|
12
15
|
const list = ids.filter(Boolean);
|
|
13
16
|
return list.length ? list.join(" ") : void 0;
|
|
14
17
|
}
|
|
15
|
-
|
|
16
|
-
if (typeof ref === "function") ref(node);
|
|
17
|
-
else if (ref) ref.current = node;
|
|
18
|
-
}
|
|
19
|
-
function mergeRefs(...refs) {
|
|
20
|
-
return (node) => {
|
|
21
|
-
for (const ref of refs) assignRef(ref, node);
|
|
22
|
-
};
|
|
23
|
-
}
|
|
18
|
+
import { assignRef, mergeRefs } from "../lib/refs.js";
|
|
24
19
|
const STATIC_LABEL_TYPE = "text-caption leading-tight text-muted peer-disabled:opacity-50";
|
|
25
20
|
const LABEL_ABOVE_AT_LARGE = "large:static large:row-start-1 large:mb-1 large:max-w-none large:pointer-events-auto";
|
|
26
21
|
const LABEL_ABOVE_BOX = "large:grid large:grid-cols-[minmax(0,1fr)] large:[&>.absolute:not([data-field-label])]:row-start-2";
|
|
@@ -66,27 +61,42 @@ function FieldHint({
|
|
|
66
61
|
) })
|
|
67
62
|
);
|
|
68
63
|
}
|
|
69
|
-
function useInlineHint(hint) {
|
|
64
|
+
function useInlineHint(hint, withHelp = false) {
|
|
70
65
|
const inline = useInlineFacts();
|
|
71
|
-
if (inline && isValidElement(hint) && hint.type === FieldHint) {
|
|
66
|
+
if ((inline || withHelp) && isValidElement(hint) && hint.type === FieldHint) {
|
|
72
67
|
const words = hint.props.label;
|
|
73
68
|
if (words) return words;
|
|
74
69
|
}
|
|
75
70
|
return hint;
|
|
76
71
|
}
|
|
72
|
+
function FieldHelp({ name, children }) {
|
|
73
|
+
const common = useKitLabels("common", DEFAULT_COMMON_LABELS);
|
|
74
|
+
const text = plainText(name);
|
|
75
|
+
return /* @__PURE__ */ jsx(HelpPopover, { label: text === void 0 ? common.help : common.aboutField(text), children });
|
|
76
|
+
}
|
|
77
|
+
function fieldHelpMark(help, name) {
|
|
78
|
+
if (!hasContent(help)) return void 0;
|
|
79
|
+
if (isValidElement(help) && help.type === HelpPopover) return help;
|
|
80
|
+
return /* @__PURE__ */ jsx(FieldHelp, { name, children: help });
|
|
81
|
+
}
|
|
77
82
|
function isTextHint(hint) {
|
|
78
83
|
return typeof hint === "string" && hint !== "" || typeof hint === "number";
|
|
79
84
|
}
|
|
80
85
|
const FIELD_CAPTION_CLASS = "mt-1 text-caption leading-tight text-muted";
|
|
81
|
-
function
|
|
82
|
-
|
|
86
|
+
function isHintCaption(hint, withHelp) {
|
|
87
|
+
return isTextHint(hint) || withHelp && hasContent(hint);
|
|
88
|
+
}
|
|
89
|
+
function useFieldHint(hintProp, describedBy, { help, name } = {}) {
|
|
90
|
+
const helpMark = fieldHelpMark(help, name);
|
|
91
|
+
const withHelp = helpMark !== void 0;
|
|
92
|
+
const hint = useInlineHint(hintProp, withHelp);
|
|
83
93
|
const captionId = useId();
|
|
84
|
-
const
|
|
94
|
+
const caption = isHintCaption(hint, withHelp);
|
|
85
95
|
return {
|
|
86
|
-
describedBy:
|
|
87
|
-
captionId:
|
|
88
|
-
captionText:
|
|
89
|
-
labelHint: !
|
|
96
|
+
describedBy: caption ? mergeDescribedBy(describedBy, captionId) : describedBy,
|
|
97
|
+
captionId: caption ? captionId : void 0,
|
|
98
|
+
captionText: caption ? hint : void 0,
|
|
99
|
+
labelHint: helpMark ?? (!caption && hasContent(hint) ? hint : void 0)
|
|
90
100
|
};
|
|
91
101
|
}
|
|
92
102
|
const FIELD_ERROR_CLASS = "mt-1 text-caption leading-tight text-danger";
|
|
@@ -180,13 +190,15 @@ function DisabledReasonLine({
|
|
|
180
190
|
const RequiredStarOnLegend = createContext(false);
|
|
181
191
|
function useFieldMessages({
|
|
182
192
|
hint,
|
|
193
|
+
help,
|
|
194
|
+
name,
|
|
183
195
|
error,
|
|
184
196
|
invalid,
|
|
185
197
|
describedBy,
|
|
186
198
|
ariaInvalid,
|
|
187
199
|
reasonId
|
|
188
200
|
}) {
|
|
189
|
-
const hintParts = useFieldHint(hint, describedBy);
|
|
201
|
+
const hintParts = useFieldHint(hint, describedBy, { help, name });
|
|
190
202
|
const field = useFieldError(error, invalid, mergeDescribedBy(hintParts.describedBy, reasonId), ariaInvalid);
|
|
191
203
|
return {
|
|
192
204
|
isInvalid: field.isInvalid,
|
|
@@ -280,6 +292,8 @@ export {
|
|
|
280
292
|
STATIC_LABEL_TYPE,
|
|
281
293
|
StaticLabelRow,
|
|
282
294
|
assignRef,
|
|
295
|
+
fieldHelpMark,
|
|
296
|
+
isHintCaption,
|
|
283
297
|
isTextHint,
|
|
284
298
|
mergeDescribedBy,
|
|
285
299
|
mergeRefs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field-parts.tsx"],"sourcesContent":["import { createContext, isValidElement, useContext, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode, Ref, RefCallback } from \"react\";\nimport { HelpCircle } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { hasContent } from \"../lib/presence\";\nimport { useInlineFacts } from \"../hooks/use-large-text\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { Tooltip, type TooltipSide } from \"./tooltip\";\nimport { useCommitReason, type CommitScope } from \"./write-lock\";\n\n/**\n * The pieces of a field's anatomy the kit's fields share — the static label, the hint\n * (caption or \"?\"), the caption and the error under a field, the label strip over a\n * bare group, the write lock on a control that saves itself, and the wiring under them\n * (`aria-describedby`, refs). Private to the package — not re-exported from the barrel,\n * except `FieldLabel` and `FLOATING_LABEL_STATIC`, which the barrel names (ui.tsx did until\n * 0.34 split it).\n *\n * One file since 0.23: until then the pickers' half (`field-anatomy.tsx`: the date and\n * month pickers, whose trigger is a button in a wrapper of their own, and the groups\n * with no field box) sat beside this one with its own copies of `isTextHint` and the\n * caption class (keksdose K4: \"uniform field anatomy … today it is a patchwork\").\n *\n * Nothing here imports a field module: field-base, input, select and textarea import this, and so do the combobox family,\n * the pickers and the native choice controls — the lint's no-cycle rule holds it.\n */\n\n/* ── the wiring: descriptions and refs ─────────────────────────────────────── */\n\n/**\n * Ids to describe a control by, merged in reading order: whatever the caller already\n * pointed at (standing advice), then the caption or description, then the error (the\n * news). Merge, never replace — see {@link useFieldError}. An empty list is `undefined`,\n * never `\"\"`: a dangling attribute describes the control as nothing at all.\n *\n * Here since 0.34 (DUP-11, refactor audit 2026-10); `choice-parts.ts` held it, beside a\n * copy of the presence rule, for the native choice controls alone.\n */\nexport function mergeDescribedBy(...ids: Array<string | false | null | undefined>): string | undefined {\n const list = ids.filter(Boolean);\n return list.length ? list.join(\" \") : undefined;\n}\n\n/** Point a ref — a callback or an object — at `node`. `undefined` and `null` are no ref. */\nexport function assignRef<T>(ref: Ref<T> | undefined, node: T | null): void {\n if (typeof ref === \"function\") ref(node);\n else if (ref) (ref as { current: T | null }).current = node;\n}\n\n/**\n * One callback ref feeding several — the caller's forwarded `ref` and a field's own\n * (DUP-11: AmountInput, FormActions, ScrollArea and SearchField each wrote this by hand).\n * Wrap it in `useCallback` (or `useMemo`) over the same refs where a new callback every\n * render would detach and re-attach the node.\n */\nexport function mergeRefs<T>(...refs: Array<Ref<T> | undefined>): RefCallback<T> {\n return (node) => {\n for (const ref of refs) assignRef(ref, node);\n };\n}\n\n/* ── the static label ─────────────────────────────────────────────────────── */\n\n// The TYPE of the small static label, without any placement. Split out so the\n// label and anything sharing its line (see `hint` on {@link FloatingField}) are\n// laid out by one flex row instead of by two absolute offsets guessing at the\n// same baseline — which is what put dev#468's \"?\" three pixels above the word it\n// belongs to.\nexport const STATIC_LABEL_TYPE =\n \"text-caption leading-tight text-muted peer-disabled:opacity-50\";\n\n/**\n * A field's label at Large and Extra large (0.33, docs/text-size-harmonization.md\n * §10.17): a static label ABOVE the field — the phone card's \"label above value\" (§4) —\n * not a label squeezed into the field's top strip, where a long one ended in \"…\". It\n * stops being absolute, so it wraps like any text (`truncate-until-large` beside it); it\n * takes the pointer, since nothing of the field lies under it any more; and the field\n * no longer reserves the strip for it (`FIELD_FLOATING_PAD`). In the first row of a box\n * that is a grid at Large ({@link LABEL_ABOVE_BOX}), wherever it sits in the DOM — a\n * floating label FOLLOWS its input, for `peer-*`. `large:` classes, so it costs no\n * render and is right on the first paint; Normal keeps the floating label.\n *\n * The placement only: a label element adds `large:block` (a `<span>` or `<label>` in\n * flow), a label ROW keeps its `flex`.\n */\nexport const LABEL_ABOVE_AT_LARGE =\n \"large:static large:row-start-1 large:mb-1 large:max-w-none large:pointer-events-auto\";\n\n/**\n * The box a field's label is positioned in — {@link FloatingField}'s `relative` wrapper,\n * a date or month picker's root — at Large, while it holds a label above\n * ({@link LABEL_ABOVE_AT_LARGE}): one column, the label's row over the field's. The\n * field's own absolute parts in the box (a chevron, a clear ×, a reveal toggle, a\n * calculator) are placed in the second row, so their `top-1/2` and `inset-y-*` still\n * measure the FIELD and not label and field together; the label's own elements carry\n * `data-field-label` and stay in the first. Only on a box with a visible label: without\n * one the second row would be empty.\n */\nexport const LABEL_ABOVE_BOX =\n \"large:grid large:grid-cols-[minmax(0,1fr)] large:[&>.absolute:not([data-field-label])]:row-start-2\";\n\n// A field that always has a value (select / dropdown trigger) keeps the label\n// permanently in the floated position — small, in the top strip, value below. At Large,\n// a label above the field (LABEL_ABOVE_AT_LARGE).\nexport const FLOATING_LABEL_STATIC = cn(\n \"pointer-events-none absolute start-3 top-1\",\n STATIC_LABEL_TYPE,\n \"max-w-[calc(100%-1.5rem)] truncate-until-large\",\n LABEL_ABOVE_AT_LARGE,\n \"large:block\",\n);\n\n/**\n * The floating label for a custom-dropdown trigger (a `<span>`, since the trigger is a\n * button not a labelable input). Same placement as {@link FloatingField}'s static label,\n * so every labelled field lines up. Render inside a `relative` wrapper, before the trigger.\n */\nexport interface FieldLabelProps extends ComponentPropsWithRef<\"span\"> {\n children: ReactNode;\n}\n\nexport function FieldLabel({ children, className, ...rest }: FieldLabelProps) {\n return (\n // `data-field-label`: a label of the box it stands in, kept in the first row at Large\n // (LABEL_ABOVE_BOX).\n <span data-field-label=\"\" {...rest} className={cn(FLOATING_LABEL_STATIC, \"z-10\", className)}>\n {children}\n </span>\n );\n}\n\n/* ── hint ─────────────────────────────────────────────────────────────────── */\n\n/**\n * The \"?\" that explains a field, on the field's own label line (dev#468).\n *\n * Pass it to a labelled `Select` / `Input` as `hint`. It exists as a\n * component rather than as a snippet each form repeats because the previous\n * version was exactly that snippet — an absolutely-positioned button whose\n * `top-1.5` was one guess at where an 11px label sits — and the reporter's\n * follow-up was *\"question mark is not centered. Is it part of the hoc?\n * positioning problems seem quite frequently.\"* It was not part of the HOC. Now\n * it is, and there is one place left where the answer can be wrong.\n *\n * A `<button>` rather than a bare icon: hover alone puts the explanation out of\n * reach of a keyboard and of every touch device, and the tooltip shows on focus\n * too. The text is also its accessible name, so a screen reader gets it without\n * the bubble ever opening.\n *\n * For a FACT — a format, a limit, a consequence — which at Large and on a touch screen\n * becomes the field's caption ({@link useInlineHint}). Paragraph-long HELP the field is\n * usable without belongs in a `HelpPopover` instead (0.34, §10.23), which opens on a tap\n * and stays a \"?\" at every size.\n */\nexport interface FieldHintProps extends Omit<ComponentPropsWithRef<\"button\">, \"children\"> {\n /** The explanation. It is both the tooltip's text and, by default, the button's\n * accessible name, so a screen reader gets it without the bubble ever opening. */\n label: string;\n /** Default `\"start\"`: before the hint in the reading direction (the left in LTR, the\n * right in RTL). `left` / `right` stay physical. */\n side?: TooltipSide;\n}\n\nexport function FieldHint({\n label,\n side = \"start\",\n className,\n \"aria-label\": ariaLabel,\n ...rest\n}: FieldHintProps) {\n return (\n // `tap=\"toggle\"` (0.25): the \"?\" exists only to explain, so a tap on a phone shows\n // the bubble and the next tap hides it — the touch rule (no bubble left behind by a\n // tap) would otherwise make it show nothing at all.\n <Tooltip label={label} side={side} portal tap=\"toggle\">\n <button\n {...rest}\n // `type` after the spread, not before. These render inside forms — that is the\n // only place a field has a label line — and a hint that defaulted to `submit`\n // because a caller spread a props object at it would save the form on a click\n // meant to explain a field.\n type=\"button\"\n // The explanation names the button unless the caller says otherwise; passing\n // `aria-label` is how you shorten it for a screen reader without shortening\n // what the bubble shows.\n aria-label={ariaLabel ?? label}\n // Nothing to activate: the tooltip opens on hover and on focus, and a\n // click that did something as well would be a second, undiscoverable\n // behaviour on the same target.\n onClick={(e) => e.preventDefault()}\n // The kit's focus frame (0.32, §5): the \"?\" is a tab stop, and had no ring at all.\n className={cn(\n \"flex rounded-full text-placeholder transition-colors hover:text-secondary\",\n FOCUS_RING,\n className,\n )}\n >\n <HelpCircle className=\"size-3.5\" />\n </button>\n </Tooltip>\n );\n}\n\n/**\n * A field's `hint` as the field should draw it here (0.32, docs/text-size-harmonization.md\n * §4 \"No fact only in a tooltip\"): at Large and Extra large, and on a touch screen, a\n * {@link FieldHint} becomes its own words — so the field shows them as its CAPTION under\n * the box, where they are read without hovering or tapping a 14 px \"?\". Anywhere else,\n * and for any other hint, the hint unchanged.\n *\n * A FieldHint only, on purpose (0.34, §10.23): a FieldHint is a FACT, and a fact stays\n * visible. Paragraph-long HELP — why, how, what the options mean; the field is usable\n * without it — goes in a `HelpPopover`, which this leaves on the label line at every\n * size: printed under the field it was the longest thing in the form (keksdose K3).\n *\n * The kit's fields call it through {@link useFieldHint} / {@link useFieldMessages}; a\n * field that resolves its own `hint` (an app's, or one of the kit's own outside this\n * file) calls it first and then treats the result as it treated a text hint.\n */\nexport function useInlineHint(hint: ReactNode): ReactNode {\n const inline = useInlineFacts();\n if (inline && isValidElement(hint) && hint.type === FieldHint) {\n const words = (hint.props as FieldHintProps).label;\n if (words) return words;\n }\n return hint;\n}\n\n\n/**\n * Whether a `hint` is a CAPTION (plain text: a non-empty string or a number) or\n * something for the label line (a {@link FieldHint} \"?\", or any other node).\n *\n * The rule {@link Select} and `NumberInput` already keep: the label line is 11px of\n * strip shared with the label, and a sentence placed there ran over the label and into\n * the value; a \"?\" under the field would be a button floating free of the label it\n * explains.\n */\nexport function isTextHint(hint: ReactNode): hint is string | number {\n return (typeof hint === \"string\" && hint !== \"\") || typeof hint === \"number\";\n}\n\n/** The caption under a field — Select's and NumberInput's type, so every field's\n * standing advice reads alike. */\nexport const FIELD_CAPTION_CLASS = \"mt-1 text-caption leading-tight text-muted\";\n\nexport interface FieldHintParts {\n /** The caller's `aria-describedby` with the caption's id appended — standing\n * advice first; the error (the news) is appended after this by the field. */\n describedBy: string | undefined;\n /** The caption's id while there is one. */\n captionId: string | undefined;\n /** The caption itself, or `undefined` for a hint that is not text. */\n captionText: string | number | undefined;\n /** A non-text hint (a FieldHint) for the label line — or, on a field with no label\n * line, the end edge outside the box. `undefined` when there is none. */\n labelHint: ReactNode | undefined;\n}\n\n/**\n * Split a field's `hint` into the caption under it (attached with `aria-describedby`)\n * or the \"?\" on its label line. See {@link isTextHint}.\n */\nexport function useFieldHint(hintProp: ReactNode, describedBy: string | undefined): FieldHintParts {\n const hint = useInlineHint(hintProp);\n const captionId = useId();\n const text = isTextHint(hint);\n return {\n describedBy: text ? mergeDescribedBy(describedBy, captionId) : describedBy,\n captionId: text ? captionId : undefined,\n captionText: text ? hint : undefined,\n labelHint: !text && hasContent(hint) ? hint : undefined,\n };\n}\n\n/** The error line under a field — one type for every field's message (DUP-8, refactor\n * audit 2026-10: ChipInput and FileDropzone printed theirs in `text-xs`). */\nexport const FIELD_ERROR_CLASS = \"mt-1 text-caption leading-tight text-danger\";\n\n/**\n * The message under a field that is wrong, and the wiring that attaches it.\n *\n * `invalid` paints the field (`FIELD_INVALID`) and sets `aria-invalid`, and there it\n * stopped: a field that announces \"invalid\" and nothing else has told a screen-reader\n * user only that they are stuck. The message was always on screen — a sibling `<p>`\n * beside the field — and never in the accessibility tree, because attaching it needs an\n * id on the message and an `aria-describedby` on the control, and no caller was going to\n * mint one by hand for every field on a form.\n *\n * Two rules the wiring has to keep:\n *\n * - **Merge, never replace.** A field may already point at a hint (\"at least twelve\n * characters\"). Overwriting that reference to say the field is wrong trades one half\n * of the answer for the other — and it keeps the half the user has already read. The\n * hint stays first: it is the standing advice, the error is the news.\n * - **`invalid` keeps working alone**, for the forms whose message lives somewhere else\n * entirely (a summary at the top of a dialog). There is nothing to point at then, and\n * a dangling id describes the field as nothing at all.\n *\n * Deliberately NOT `role=\"alert\"`. `aria-describedby` is read when focus reaches the\n * control, which is where a field's own error is wanted; an alert would also interrupt\n * whatever is being read at the time, on every keystroke of a form that re-validates as\n * you type.\n *\n * Every field's since 0.34 (DUP-8, refactor audit 2026-10): it was ui.tsx's own, so the\n * combobox family restated it as `useComboboxFieldError` — without the fourth argument,\n * so Autocomplete announced a form library's `aria-invalid` and did not paint it — and\n * ten fields restated it inline.\n */\nexport function useFieldError(\n error: ReactNode,\n invalid: boolean | undefined,\n describedBy: string | undefined,\n /** The caller's own `aria-invalid`. A form library sets THIS (see `@eifi1/ui-kit/rhf`\n * `FormControl`), not our `invalid` prop — and a field that announces invalid should\n * look it too. */\n ariaInvalid?: unknown,\n): { isInvalid: boolean; describedBy: string | undefined; errorEl: ReactNode } {\n const errorId = useId();\n const hasError = hasContent(error);\n return {\n /** A field carrying a message that says what is wrong with it IS wrong. */\n isInvalid: Boolean(invalid) || hasError || ariaInvalid === true || ariaInvalid === \"true\",\n describedBy: mergeDescribedBy(describedBy, hasError && errorId),\n errorEl: hasError ? (\n <p id={errorId} className={FIELD_ERROR_CLASS}>\n {error}\n </p>\n ) : null,\n };\n}\n\n/** The caption under a field, as {@link Select} draws its own. */\nexport function FieldCaption({ parts, className }: { parts: FieldHintParts; className?: string }) {\n if (parts.captionText === undefined) return null;\n return (\n <p id={parts.captionId} className={cn(FIELD_CAPTION_CLASS, className)}>\n {parts.captionText}\n </p>\n );\n}\n\n/**\n * Classes that take a static floating label (`FLOATING_LABEL_STATIC`: `FieldLabel`,\n * `ComboboxFieldLabel`) out of its own absolute slot and into a {@link StaticLabelRow}.\n * `static` wins over `absolute` through `cn`'s merge; `min-w-0` lets it truncate in\n * the row. At Large the ROW stands above the field, so the label inside it drops the\n * margin a label above takes alone (`large:mb-0`), and stays level with its \"?\".\n */\nexport const LABEL_IN_ROW = \"static min-w-0 large:mb-0\";\n\n/**\n * A static label and its \"?\" on one line, in the top strip of a field that lays out its\n * own label — the combobox family, which cannot use {@link FloatingField} because the\n * trigger, the anchored panel and the label hang off a box of their own.\n *\n * FloatingField's static row, with one difference: it stops at `end-9`, the column the\n * chevron (or the clear \"×\") takes, so a long label truncates before it rather than\n * putting the \"?\" on top of the chevron. The hint keeps its width; the label gives way.\n */\nexport function StaticLabelRow({ hint, children }: { hint: ReactNode; children: ReactNode }) {\n return (\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute start-3 end-9 top-1 z-10 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n {children}\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/**\n * A field with no label line and a FieldHint \"?\": the hint at the end edge, OUTSIDE the\n * box, as an unlabelled {@link Select} has placed it since 0.15.5. Without a hint the\n * field is returned exactly as it was, so the wrapper costs nothing where it does not\n * apply.\n */\nexport function EndHintRow({\n hint,\n className,\n children,\n}: {\n hint: ReactNode | undefined;\n className?: string;\n children: ReactNode;\n}) {\n if (hint === undefined) return <>{children}</>;\n return (\n <div className={cn(\"flex items-center gap-1.5\", className)}>\n <div className=\"min-w-0 flex-1\">{children}</div>\n <span className=\"flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/* ── the write lock on a control that saves itself (keksdose K3) ───────────── */\n\nexport interface LockReason {\n /** The reason in force — the lock's (with `commit` under a locked\n * `WriteLockProvider`), else the control's own `disabledReason`. */\n reason: ReactNode;\n /** There is a reason: the control is locked the focusable way. */\n locked: boolean;\n /** The id of the reason's hidden copy, for the control's `aria-describedby`. */\n reasonId: string;\n}\n\n/**\n * {@link Button}'s `commit` + `disabledReason`, for a control that IS its own commit — a\n * switch, a checkbox or a select that saves on change, a list row whose click writes.\n * The lock's reason wins over the control's own (`useCommitReason`).\n */\nexport function useLockReason(commit: CommitScope | undefined, disabledReason: ReactNode): LockReason {\n const reason = useCommitReason(commit, disabledReason);\n const reasonId = useId();\n return { reason, locked: hasContent(reason), reasonId };\n}\n\n/**\n * A locked control and its reason — the kit's ONE frame for it, used by Button,\n * IconButton, Chip, Checkbox, Switch and every field that locks (DUP-3, refactor audit\n * 2026-10: Button's `ReasonFrame` and Chip's `ChipReasonFrame` were copies of it, and\n * only those two drew the line, so a field locked through `commit` kept its reason in a\n * tooltip on a phone while the Save beside it said it in words). Where it shows is\n * {@link DisabledReasonDisplay}'s: by default a LINE under the control at Large and on a\n * touch screen ({@link DisabledReasonLine}), the kit {@link Tooltip} otherwise.\n *\n * A component of its own so only a LOCKED control asks the text size and the pointer;\n * the hundreds of unlocked controls on a page subscribe to nothing.\n *\n * Tooltip form: the control in a FRAGMENT with a `hidden` copy of the reason for its\n * `aria-describedby`, so the Tooltip does not also clone its bubble's id into the\n * description — the same sentence twice would be read on every focus. Line form: the\n * line IS the description (it carries `reasonId`), and no bubble repeats what is on\n * screen.\n *\n * `className` is the wrapper's, which becomes the outermost element while locked — a\n * control moves its own layout classes here so a lock does not reflow the form.\n */\nexport function LockedReason({\n lock,\n display,\n line: lineProp,\n side,\n portal,\n className,\n lineClassName,\n children,\n}: {\n /** The reason, and the id the control's `aria-describedby` names. */\n lock: Pick<LockReason, \"reason\" | \"reasonId\">;\n /** Where the reason shows — the control's `disabledReasonDisplay`. Default `\"auto\"`. */\n display?: DisabledReasonDisplay;\n /** The answer of a caller that asked {@link useDisabledReasonLine} for its own layout\n * already (Checkbox, Switch); wins over `display`. */\n line?: boolean;\n /** The bubble's side and portal — IconButton's `tooltipSide` / `tooltipPortal`. */\n side?: TooltipSide;\n portal?: boolean;\n className?: string;\n /** Classes for the line itself — a list row's padding, so the words line up with the\n * row's. */\n lineClassName?: string;\n children: ReactNode;\n}) {\n const asked = useDisabledReasonLine(display);\n if (lineProp ?? asked) {\n return (\n <DisabledReasonLine id={lock.reasonId} reason={lock.reason} className={className} lineClassName={lineClassName}>\n {children}\n </DisabledReasonLine>\n );\n }\n return (\n <Tooltip label={lock.reason} side={side} portal={portal} className={className}>\n <>\n {children}\n <span id={lock.reasonId} hidden>\n {lock.reason}\n </span>\n </>\n </Tooltip>\n );\n}\n\n/* ── no fact only in a tooltip (0.32, docs/text-size-harmonization.md §4, §10.8) ── */\n\n/**\n * Where a control's `disabledReason` is shown (§4 \"No fact only in a tooltip\"):\n *\n * - `\"auto\"` (default): as a LINE under the control at Large and Extra large and on a\n * touch screen (`useInlineFacts`) — the reader asked for bigger type, or cannot hover\n * — and in the kit {@link Tooltip} otherwise, where a pointer can hover it open and\n * the form keeps its rhythm. Inside {@link CompactControls} (a top bar, a dense row's\n * inline actions) it stays the tooltip at every size: there is no room for a line.\n * - `\"line\"`: always the line — a form whose locked submit should say why at once.\n * - `\"tooltip\"`: always the tooltip — a place the caller knows has no room, and where\n * the reason is also said elsewhere on the screen (a banner over the form).\n *\n * Either way the reason is the control's `aria-describedby`, so a screen reader hears\n * it on focus; the line IS that description (one copy), the tooltip keeps its hidden\n * copy as before.\n */\nexport type DisabledReasonDisplay = \"auto\" | \"line\" | \"tooltip\";\n\n/**\n * Marks a region where the controls must stay compact at every text size (§4, §10.8):\n * an IconButton keeps its icon alone (its `label` stays the name and the tooltip) and a\n * `disabledReason` stays in the tooltip rather than a line. AppShell puts its top bar\n * in one (\"the top bar keeps its essential icons\"); `RowActions` its inline icons.\n *\n * For a toolbar that has no room, not for a whole page: the contract asks that the icon\n * alone be rare. A dense row's actions belong in `RowActions`, which collapses them\n * into a \"⋯\" menu at Large instead.\n */\nexport const CompactControlsContext = createContext(false);\n\nexport function CompactControls({ children, compact = true }: { children: ReactNode; compact?: boolean }) {\n return <CompactControlsContext.Provider value={compact}>{children}</CompactControlsContext.Provider>;\n}\n\n/** Whether a control's `disabledReason` is drawn as a line here — see\n * {@link DisabledReasonDisplay}. For the kit's own controls (Button, IconButton, Chip,\n * ToggleGroup) and an app's control that has a reason to give. */\nexport function useDisabledReasonLine(display: DisabledReasonDisplay = \"auto\"): boolean {\n const compact = useContext(CompactControlsContext);\n const inline = useInlineFacts();\n if (display === \"line\") return true;\n if (display === \"tooltip\") return false;\n return inline && !compact;\n}\n\n/** The reason line's type: a field caption's ({@link FIELD_CAPTION_CLASS}), so a locked\n * control's \"why\" reads like a field's standing advice. Capped, so a long reason under\n * a small control wraps rather than widening its row without end. */\nexport const DISABLED_REASON_LINE_CLASS =\n \"mt-1 block max-w-[20rem] text-caption leading-tight text-muted\";\n\n/**\n * A control and its `disabledReason` as a line under it — the `\"line\"` form of\n * {@link DisabledReasonDisplay}. The wrapper is the flex item now (`className`: the\n * control's own layout, e.g. `self-stretch`); `items-start` keeps the control its own\n * width, and a column parent still stretches the wrapper (FormActions' phone stack).\n * The line carries `id`, which the control's `aria-describedby` names.\n */\nexport function DisabledReasonLine({\n id,\n reason,\n className,\n lineClassName,\n children,\n}: {\n id: string;\n reason: ReactNode;\n className?: string;\n /** Classes for the line itself (0.34) — a list row's padding, so its words start\n * where the row's do. */\n lineClassName?: string;\n children: ReactNode;\n}) {\n return (\n <span data-slot=\"disabled-reason\" className={cn(\"inline-flex max-w-full flex-col items-start\", className)}>\n {children}\n <span id={id} className={cn(DISABLED_REASON_LINE_CLASS, lineClassName)}>\n {reason}\n </span>\n </span>\n );\n}\n\n/* ── groups ───────────────────────────────────────────────────────────────── */\n\n/**\n * Set by {@link CheckboxGroup}: its legend carries the one required star, so a box\n * inside it keeps the native `required` (a form still refuses an empty set) but draws no\n * star of its own — four stars on four languages would read as four separate demands.\n * ChoiceCardGroup's `InGroupContext`, for the plain checkbox.\n */\nexport const RequiredStarOnLegend = createContext(false);\n\n/* ── fields not built on FloatingField: pickers and bare groups ──────────── */\n\nexport interface FieldMessages {\n /** `invalid`, a message, or an `aria-invalid` from outside (a form library). */\n isInvalid: boolean;\n /** The caller's description, then the caption, then a lock's reason, then the error —\n * the standing advice before the news, as {@link useFieldError} orders them. */\n describedBy: string | undefined;\n /** The caption and the error, for under the field; `null` when there is neither. */\n below: ReactNode;\n /** The hint for the LABEL line (a `FieldHint`), or `undefined` when the hint is a\n * caption or there is none. */\n labelHint: ReactNode;\n}\n\n/**\n * `hint` / `error` / `invalid` resolved the way `Select` resolves them —\n * {@link useFieldHint} and {@link useFieldError} together, for a field that draws what\n * goes under it in one place (a picker, a group, a field built on another).\n */\nexport function useFieldMessages({\n hint,\n error,\n invalid,\n describedBy,\n ariaInvalid,\n reasonId,\n}: {\n hint?: ReactNode;\n error?: ReactNode;\n invalid?: boolean;\n describedBy?: string;\n ariaInvalid?: unknown;\n /** A lock's reason (`useLockReason`'s `reasonId`, while locked): described after the\n * caption and before the error, as on Select. */\n reasonId?: string | false;\n}): FieldMessages {\n const hintParts = useFieldHint(hint, describedBy);\n const field = useFieldError(error, invalid, mergeDescribedBy(hintParts.describedBy, reasonId), ariaInvalid);\n return {\n isInvalid: field.isInvalid,\n describedBy: field.describedBy,\n below:\n hintParts.captionText !== undefined || field.errorEl !== null ? (\n <>\n <FieldCaption parts={hintParts} />\n {field.errorEl}\n </>\n ) : null,\n labelHint: hintParts.labelHint,\n };\n}\n\n/**\n * The field and what is under it, as one box — `FieldGroup` in field-base.tsx, for the same\n * reasons written there. Nothing of its own while there is nothing under the field and\n * the caller passed no `error` key (the DOM is exactly what it was before these props);\n * once `error` is passed the box is kept even with no message, so the trigger is never\n * reparented — and remounted, losing focus — as the message comes and goes.\n */\nexport function FieldBox({\n below,\n reserve,\n children,\n}: {\n below: ReactNode;\n reserve: boolean;\n children: ReactNode;\n}) {\n if (below === null && !reserve) return <>{children}</>;\n return (\n <div>\n {children}\n {below}\n </div>\n );\n}\n\n/**\n * The static label in a trigger field's top strip — a {@link FieldLabel}, or, with a\n * `FieldHint`, the label and its \"?\" laid out on ONE flex row (dev#468: two absolute\n * offsets guessing at the same baseline put the \"?\" three pixels above its word).\n * `FloatingField`'s static-label row, except that it stops at `end-9`: the date and\n * month triggers keep that column (`pe-9`) for the calendar glyph or the clear ×, and a\n * long label truncates before it rather than putting the \"?\" on top of it.\n */\nexport function FieldLabelLine({ label, hint }: { label: ReactNode; hint?: ReactNode }) {\n if (!hasContent(hint)) return <FieldLabel>{label}</FieldLabel>;\n return (\n // `z-10` as FieldLabel has it: the trigger after it is `relative` and would paint\n // over the row (and take the \"?\"'s hover) otherwise. Above the field at Large.\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute start-3 end-9 top-1 z-10 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n <FieldLabel className={cn(LABEL_IN_ROW, \"max-w-full\")}>{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/**\n * How tall the strip over a bare group is: 20px at Normal, for every group the kit\n * draws one over — ToggleGroup's `labelPlacement=\"strip\"`, SwatchPicker, IconPicker\n * and {@link FieldStrip} (whose `pad` named two heights until 0.34).\n *\n * The label ROW, not the label, is what has to fit (keksdose dev#593, kk K4, measured in\n * headless Chromium): it sits `top-1` (4px) and is as tall as the taller of the label\n * (11px `text-caption` in a `leading-tight` line, 13.75px) and its \"?\" (a 14px icon,\n * `size-3.5`) — so it ends 18px down. The strip has to be at least that:\n *\n * label row: 4 + max(13.75, 14) = 18 ≤ strip: 20 (2px clear of the content)\n *\n * Until 0.34 a 16px strip (`\"field\"`) stood over the segmented group so that 16 + its\n * 26px box made a labelled Input's 42px (keksdose's `ClearedStatusPicker`, live #288 /\n * #431). The label and its \"?\" then crossed the group's top border by 2px — *\"the\n * question mark even interferes with it\"* (at 125 %: label row 424–438, border at 436).\n * The 4px come out of the group's segments instead (`STRIP_SEGMENT` in\n * toggle-group.tsx): 20 + 22 = 42. A tile, a map, a row of buttons — content with no\n * inset — needed the 20px already (keksdose's `FlagPicker` and location field, `pt-5`).\n *\n * Every term is rem, so the sum holds at any browser font size. At Large and Extra large\n * there is no strip: the label row stands above the content, in flow\n * ({@link LABEL_ABOVE_AT_LARGE}), and the padding goes (`large:pt-0` in\n * {@link LabelStrip}), so nothing lies under the label to cross.\n */\nexport const LABEL_STRIP_PAD = \"pt-5\";\n\n/**\n * The 11px label (and its `FieldHint`) over a group that is NOT a field — keksdose K2:\n * a segmented control or a row of swatches standing in a form row beside labelled\n * inputs, whose label must sit on the same line as theirs (`top-1`, `inset-x-3`, the\n * type of a field's static label) without the group growing a field's border round\n * it. `id` goes on the label so the group can be `aria-labelledby` it.\n *\n * `relative` is load-bearing twice over: the row is positioned against it, and a\n * caller's `sr-only` label cannot escape it (sr-only-containment).\n *\n * Any other attribute (`rest`) lands on the wrapper — {@link FieldStrip} makes it the\n * `role=\"group\"` its label names. The kit's own groups pass none, so their wrapper is\n * the bare box it was in 0.22.\n */\nexport function LabelStrip({\n labelId,\n label,\n hint,\n disabled,\n className,\n children,\n ...rest\n}: Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n labelId: string;\n label: ReactNode;\n /** What rides the label line beside the label — a resolved `labelHint`\n * ({@link useFieldMessages}), never a raw `hint`: a FieldHint is the caption at Large\n * and on touch, and the caller draws that under its group. */\n hint?: ReactNode;\n /** Dim the label with its group, as `peer-disabled:` dims a field's own. */\n disabled?: boolean;\n children: ReactNode;\n}) {\n return (\n // At Large the row is a label above the group, in flow (0.33, §10.17), and the\n // strip's padding goes: nothing lies under it any more.\n <div {...rest} className={cn(\"relative min-w-0\", LABEL_STRIP_PAD, \"large:pt-0\", className)}>\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute inset-x-3 top-1 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n {/* `static`: FieldLabel positions itself absolutely; here the ROW is\n positioned, so the label and its \"?\" are centred on one line by the flex\n layout (dev#468). */}\n <FieldLabel id={labelId} className={cn(LABEL_IN_ROW, \"max-w-full\", disabled && \"opacity-50\")}>\n {label}\n </FieldLabel>\n {hasContent(hint) && <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":";AA6HI,SAsQ6B,UAtQ7B,KA6OA,YA7OA;AA7HJ,SAAS,eAAe,gBAAgB,YAAY,aAAa;AAEjE,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,eAAiC;AAC1C,SAAS,uBAAyC;AA8B3C,SAAS,oBAAoB,KAAmE;AACrG,QAAM,OAAO,IAAI,OAAO,OAAO;AAC/B,SAAO,KAAK,SAAS,KAAK,KAAK,GAAG,IAAI;AACxC;AAGO,SAAS,UAAa,KAAyB,MAAsB;AAC1E,MAAI,OAAO,QAAQ,WAAY,KAAI,IAAI;AAAA,WAC9B,IAAK,CAAC,IAA8B,UAAU;AACzD;AAQO,SAAS,aAAgB,MAAiD;AAC/E,SA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B,iBAAiB,cAAc,SAAS,GACvF;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAiB;AAAA,UACjB,WAAW,GAAG,wEAAwE,oBAAoB;AAAA,UAK1G;AAAA,gCAAC,cAAW,IAAI,SAAS,WAAW,GAAG,cAAc,cAAc,YAAY,YAAY,GACxF,iBACH;AAAA,YACC,WAAW,IAAI,KAAK,oBAAC,UAAK,WAAU,kDAAkD,gBAAK;AAAA;AAAA;AAAA,MAC9F;AAAA,MACC;AAAA,OACH;AAAA;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/field-parts.tsx"],"sourcesContent":["import { createContext, isValidElement, useContext, useId } from \"react\";\nimport type { ComponentPropsWithoutRef, ComponentPropsWithRef, ReactNode } from \"react\";\nimport { HelpCircle } from \"lucide-react\";\nimport { cn } from \"../lib/cn\";\nimport { hasContent } from \"../lib/presence\";\nimport { plainText } from \"../lib/plain-text\";\nimport { DEFAULT_COMMON_LABELS, useKitLabels } from \"../i18n/kit-labels\";\nimport { useInlineFacts } from \"../hooks/use-large-text\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport { HelpPopover } from \"./help-popover\";\nimport { Tooltip, type TooltipSide } from \"./tooltip\";\nimport { useCommitReason, type CommitScope } from \"./write-lock\";\n\n/**\n * The pieces of a field's anatomy the kit's fields share — the static label, the hint\n * (caption or \"?\"), the caption and the error under a field, the label strip over a\n * bare group, the write lock on a control that saves itself, and the wiring under them\n * (`aria-describedby`, refs). Private to the package — not re-exported from the barrel,\n * except `FieldLabel` and `FLOATING_LABEL_STATIC`, which the barrel names (ui.tsx did until\n * 0.34 split it).\n *\n * One file since 0.23: until then the pickers' half (`field-anatomy.tsx`: the date and\n * month pickers, whose trigger is a button in a wrapper of their own, and the groups\n * with no field box) sat beside this one with its own copies of `isTextHint` and the\n * caption class (keksdose K4: \"uniform field anatomy … today it is a patchwork\").\n *\n * Nothing here imports a field module: field-base, input, select and textarea import this, and so do the combobox family,\n * the pickers and the native choice controls — the lint's no-cycle rule holds it.\n */\n\n/* ── the wiring: descriptions and refs ─────────────────────────────────────── */\n\n/**\n * Ids to describe a control by, merged in reading order: whatever the caller already\n * pointed at (standing advice), then the caption or description, then the error (the\n * news). Merge, never replace — see {@link useFieldError}. An empty list is `undefined`,\n * never `\"\"`: a dangling attribute describes the control as nothing at all.\n *\n * Here since 0.34 (DUP-11, refactor audit 2026-10); `choice-parts.ts` held it, beside a\n * copy of the presence rule, for the native choice controls alone.\n */\nexport function mergeDescribedBy(...ids: Array<string | false | null | undefined>): string | undefined {\n const list = ids.filter(Boolean);\n return list.length ? list.join(\" \") : undefined;\n}\n\n// The ref plumbing lives in ../lib/refs since round 0.35 (Tooltip needs it, and this module\n// renders a Tooltip); the fields keep importing it from here.\nexport { assignRef, mergeRefs } from \"../lib/refs\";\n\n/* ── the static label ─────────────────────────────────────────────────────── */\n\n// The TYPE of the small static label, without any placement. Split out so the\n// label and anything sharing its line (see `hint` on {@link FloatingField}) are\n// laid out by one flex row instead of by two absolute offsets guessing at the\n// same baseline — which is what put dev#468's \"?\" three pixels above the word it\n// belongs to.\nexport const STATIC_LABEL_TYPE =\n \"text-caption leading-tight text-muted peer-disabled:opacity-50\";\n\n/**\n * A field's label at Large and Extra large (0.33, docs/text-size-harmonization.md\n * §10.17): a static label ABOVE the field — the phone card's \"label above value\" (§4) —\n * not a label squeezed into the field's top strip, where a long one ended in \"…\". It\n * stops being absolute, so it wraps like any text (`truncate-until-large` beside it); it\n * takes the pointer, since nothing of the field lies under it any more; and the field\n * no longer reserves the strip for it (`FIELD_FLOATING_PAD`). In the first row of a box\n * that is a grid at Large ({@link LABEL_ABOVE_BOX}), wherever it sits in the DOM — a\n * floating label FOLLOWS its input, for `peer-*`. `large:` classes, so it costs no\n * render and is right on the first paint; Normal keeps the floating label.\n *\n * The placement only: a label element adds `large:block` (a `<span>` or `<label>` in\n * flow), a label ROW keeps its `flex`.\n */\nexport const LABEL_ABOVE_AT_LARGE =\n \"large:static large:row-start-1 large:mb-1 large:max-w-none large:pointer-events-auto\";\n\n/**\n * The box a field's label is positioned in — {@link FloatingField}'s `relative` wrapper,\n * a date or month picker's root — at Large, while it holds a label above\n * ({@link LABEL_ABOVE_AT_LARGE}): one column, the label's row over the field's. The\n * field's own absolute parts in the box (a chevron, a clear ×, a reveal toggle, a\n * calculator) are placed in the second row, so their `top-1/2` and `inset-y-*` still\n * measure the FIELD and not label and field together; the label's own elements carry\n * `data-field-label` and stay in the first. Only on a box with a visible label: without\n * one the second row would be empty.\n */\nexport const LABEL_ABOVE_BOX =\n \"large:grid large:grid-cols-[minmax(0,1fr)] large:[&>.absolute:not([data-field-label])]:row-start-2\";\n\n// A field that always has a value (select / dropdown trigger) keeps the label\n// permanently in the floated position — small, in the top strip, value below. At Large,\n// a label above the field (LABEL_ABOVE_AT_LARGE).\nexport const FLOATING_LABEL_STATIC = cn(\n \"pointer-events-none absolute start-3 top-1\",\n STATIC_LABEL_TYPE,\n \"max-w-[calc(100%-1.5rem)] truncate-until-large\",\n LABEL_ABOVE_AT_LARGE,\n \"large:block\",\n);\n\n/**\n * The floating label for a custom-dropdown trigger (a `<span>`, since the trigger is a\n * button not a labelable input). Same placement as {@link FloatingField}'s static label,\n * so every labelled field lines up. Render inside a `relative` wrapper, before the trigger.\n */\nexport interface FieldLabelProps extends ComponentPropsWithRef<\"span\"> {\n children: ReactNode;\n}\n\nexport function FieldLabel({ children, className, ...rest }: FieldLabelProps) {\n return (\n // `data-field-label`: a label of the box it stands in, kept in the first row at Large\n // (LABEL_ABOVE_BOX).\n <span data-field-label=\"\" {...rest} className={cn(FLOATING_LABEL_STATIC, \"z-10\", className)}>\n {children}\n </span>\n );\n}\n\n/* ── hint ─────────────────────────────────────────────────────────────────── */\n\n/**\n * The \"?\" that explains a field, on the field's own label line (dev#468).\n *\n * Pass it to a labelled `Select` / `Input` as `hint`. It exists as a\n * component rather than as a snippet each form repeats because the previous\n * version was exactly that snippet — an absolutely-positioned button whose\n * `top-1.5` was one guess at where an 11px label sits — and the reporter's\n * follow-up was *\"question mark is not centered. Is it part of the hoc?\n * positioning problems seem quite frequently.\"* It was not part of the HOC. Now\n * it is, and there is one place left where the answer can be wrong.\n *\n * A `<button>` rather than a bare icon: hover alone puts the explanation out of\n * reach of a keyboard and of every touch device, and the tooltip shows on focus\n * too. The text is also its accessible name, so a screen reader gets it without\n * the bubble ever opening.\n *\n * For a FACT — a format, a limit, a consequence — which at Large and on a touch screen\n * becomes the field's caption ({@link useInlineHint}). Paragraph-long HELP the field is\n * usable without belongs in a `HelpPopover` instead (0.34, §10.23), which opens on a tap\n * and stays a \"?\" at every size.\n */\nexport interface FieldHintProps extends Omit<ComponentPropsWithRef<\"button\">, \"children\"> {\n /** The explanation. It is both the tooltip's text and, by default, the button's\n * accessible name, so a screen reader gets it without the bubble ever opening. */\n label: string;\n /** Default `\"start\"`: before the hint in the reading direction (the left in LTR, the\n * right in RTL). `left` / `right` stay physical. */\n side?: TooltipSide;\n}\n\nexport function FieldHint({\n label,\n side = \"start\",\n className,\n \"aria-label\": ariaLabel,\n ...rest\n}: FieldHintProps) {\n return (\n // `tap=\"toggle\"` (0.25): the \"?\" exists only to explain, so a tap on a phone shows\n // the bubble and the next tap hides it — the touch rule (no bubble left behind by a\n // tap) would otherwise make it show nothing at all.\n <Tooltip label={label} side={side} portal tap=\"toggle\">\n <button\n {...rest}\n // `type` after the spread, not before. These render inside forms — that is the\n // only place a field has a label line — and a hint that defaulted to `submit`\n // because a caller spread a props object at it would save the form on a click\n // meant to explain a field.\n type=\"button\"\n // The explanation names the button unless the caller says otherwise; passing\n // `aria-label` is how you shorten it for a screen reader without shortening\n // what the bubble shows.\n aria-label={ariaLabel ?? label}\n // Nothing to activate: the tooltip opens on hover and on focus, and a\n // click that did something as well would be a second, undiscoverable\n // behaviour on the same target.\n onClick={(e) => e.preventDefault()}\n // The kit's focus frame (0.32, §5): the \"?\" is a tab stop, and had no ring at all.\n className={cn(\n \"flex rounded-full text-placeholder transition-colors hover:text-secondary\",\n FOCUS_RING,\n className,\n )}\n >\n <HelpCircle className=\"size-3.5\" />\n </button>\n </Tooltip>\n );\n}\n\n/**\n * A field's `hint` as the field should draw it here (0.32, docs/text-size-harmonization.md\n * §4 \"No fact only in a tooltip\"): at Large and Extra large, and on a touch screen, a\n * {@link FieldHint} becomes its own words — so the field shows them as its CAPTION under\n * the box, where they are read without hovering or tapping a 14 px \"?\". Anywhere else,\n * and for any other hint, the hint unchanged.\n *\n * A FieldHint only, on purpose (0.34, §10.23): a FieldHint is a FACT, and a fact stays\n * visible. Paragraph-long HELP — why, how, what the options mean; the field is usable\n * without it — goes in a `HelpPopover`, which this leaves on the label line at every\n * size: printed under the field it was the longest thing in the form (keksdose K3).\n *\n * The kit's fields call it through {@link useFieldHint} / {@link useFieldMessages}; a\n * field that resolves its own `hint` (an app's, or one of the kit's own outside this\n * file) calls it first and then treats the result as it treated a text hint.\n *\n * `withHelp` (round 0.36): the field has a `help`, whose \"?\" is the field's only one\n * ({@link fieldHelpMark}) — so a FieldHint is its words at EVERY size, not only at Large\n * and on touch.\n */\nexport function useInlineHint(hint: ReactNode, withHelp = false): ReactNode {\n const inline = useInlineFacts();\n if ((inline || withHelp) && isValidElement(hint) && hint.type === FieldHint) {\n const words = (hint.props as FieldHintProps).label;\n if (words) return words;\n }\n return hint;\n}\n\n/* ── help (round 0.36, docs/text-size-harmonization.md §4, §10.23) ─────────── */\n\n/**\n * The doc every field's `help` prop points at.\n *\n * A field may carry two kinds of words (§10.23): a FACT — a format, a limit, a\n * consequence — which stays visible, and HELP — why the field exists, how to choose,\n * what the options mean — which the field is usable without and which may sit behind a\n * \"?\". Until 0.36 a field had one slot, `hint`, so a field with both had to drop one or\n * print a paragraph (Kurvenschmiede's \"How it was measured\", round 0.36 H). Now:\n *\n * - `hint` is the fact, the caption under the field, on its `aria-describedby`;\n * - `help` is the help, a {@link HelpPopover} \"?\" on the label line (an unlabelled\n * field's at its end edge, as a hint's), named \"About <label>\" (`common.aboutField`,\n * from the label's text, else the `aria-label`, else `common.help`). Pass a\n * `HelpPopover` as `help` to name it yourself (\"What do the statuses mean?\").\n *\n * The help's \"?\" is then the field's ONLY \"?\": a `FieldHint` passed as `hint` beside it\n * draws none of its own and shows its words as the caption at every size, as it does at\n * Large and on touch; any other `hint` is the caption too. Two \"?\" side by side would\n * look the same and open different things.\n */\nexport interface FieldHelpProps {\n /**\n * Help the field is usable without — why it exists, how to choose, what the options\n * mean — behind the field's one \"?\" on its label line: a {@link HelpPopover} named\n * \"About <label>\" that opens on a tap (round 0.36, docs/text-size-harmonization.md §4).\n * Pass a `HelpPopover` to name it yourself. `hint` stays the visible fact: with `help`\n * set it is the caption under the field at every size, a `FieldHint` included.\n */\n help?: ReactNode;\n}\n\n/**\n * The \"?\" for a field's `help` — the field's own name, \"About <label>\", in the reader's\n * language. A component so that a field without `help` asks the labels nothing.\n */\nfunction FieldHelp({ name, children }: { name: ReactNode; children: ReactNode }) {\n const common = useKitLabels(\"common\", DEFAULT_COMMON_LABELS);\n const text = plainText(name);\n return <HelpPopover label={text === undefined ? common.help : common.aboutField(text)}>{children}</HelpPopover>;\n}\n\n/**\n * A field's `help` as the \"?\" for its label line, or `undefined` when there is none. A\n * {@link HelpPopover} is used as it is (it carries its own name); anything else is put\n * in one named \"About <name>\" — `name` is the field's label, else its `aria-label`.\n */\nexport function fieldHelpMark(help: ReactNode, name: ReactNode): ReactNode | undefined {\n if (!hasContent(help)) return undefined;\n if (isValidElement(help) && help.type === HelpPopover) return help;\n return <FieldHelp name={name}>{help}</FieldHelp>;\n}\n\n/** What {@link useFieldHint} needs to draw a field's `help`. */\nexport interface FieldHelpSource {\n /** The field's `help`. */\n help?: ReactNode;\n /** What names its \"?\": the field's label, else its `aria-label`. */\n name?: ReactNode;\n}\n\n\n/**\n * Whether a `hint` is a CAPTION (plain text: a non-empty string or a number) or\n * something for the label line (a {@link FieldHint} \"?\", or any other node).\n *\n * The rule {@link Select} and `NumberInput` already keep: the label line is 11px of\n * strip shared with the label, and a sentence placed there ran over the label and into\n * the value; a \"?\" under the field would be a button floating free of the label it\n * explains.\n */\nexport function isTextHint(hint: ReactNode): hint is string | number {\n return (typeof hint === \"string\" && hint !== \"\") || typeof hint === \"number\";\n}\n\n/** The caption under a field — Select's and NumberInput's type, so every field's\n * standing advice reads alike. */\nexport const FIELD_CAPTION_CLASS = \"mt-1 text-caption leading-tight text-muted\";\n\nexport interface FieldHintParts {\n /** The caller's `aria-describedby` with the caption's id appended — standing\n * advice first; the error (the news) is appended after this by the field. */\n describedBy: string | undefined;\n /** The caption's id while there is one. */\n captionId: string | undefined;\n /** The caption itself — a text hint, or any hint beside a `help` — or `undefined`. */\n captionText: ReactNode | undefined;\n /** What rides the label line — the `help`'s \"?\" ({@link fieldHelpMark}), else a\n * non-text hint (a FieldHint) — or, on a field with no label line, the end edge\n * outside the box. `undefined` when there is none. */\n labelHint: ReactNode | undefined;\n}\n\n/**\n * Whether a resolved `hint` goes under the field as its caption: text always (see\n * {@link isTextHint}); with a `help` beside it, whatever it is — the label line's \"?\"\n * is the help's (round 0.36, §4).\n */\nexport function isHintCaption(hint: ReactNode, withHelp: boolean): boolean {\n return isTextHint(hint) || (withHelp && hasContent(hint));\n}\n\n/**\n * Split a field's `hint` into the caption under it (attached with `aria-describedby`)\n * or the \"?\" on its label line. See {@link isTextHint}. With a `help` ({@link\n * FieldHelpProps}), the help's \"?\" takes the label line and the hint is the caption.\n */\nexport function useFieldHint(\n hintProp: ReactNode,\n describedBy: string | undefined,\n { help, name }: FieldHelpSource = {},\n): FieldHintParts {\n const helpMark = fieldHelpMark(help, name);\n const withHelp = helpMark !== undefined;\n const hint = useInlineHint(hintProp, withHelp);\n const captionId = useId();\n const caption = isHintCaption(hint, withHelp);\n return {\n describedBy: caption ? mergeDescribedBy(describedBy, captionId) : describedBy,\n captionId: caption ? captionId : undefined,\n captionText: caption ? hint : undefined,\n labelHint: helpMark ?? (!caption && hasContent(hint) ? hint : undefined),\n };\n}\n\n/** The error line under a field — one type for every field's message (DUP-8, refactor\n * audit 2026-10: ChipInput and FileDropzone printed theirs in `text-xs`). */\nexport const FIELD_ERROR_CLASS = \"mt-1 text-caption leading-tight text-danger\";\n\n/**\n * The message under a field that is wrong, and the wiring that attaches it.\n *\n * `invalid` paints the field (`FIELD_INVALID`) and sets `aria-invalid`, and there it\n * stopped: a field that announces \"invalid\" and nothing else has told a screen-reader\n * user only that they are stuck. The message was always on screen — a sibling `<p>`\n * beside the field — and never in the accessibility tree, because attaching it needs an\n * id on the message and an `aria-describedby` on the control, and no caller was going to\n * mint one by hand for every field on a form.\n *\n * Two rules the wiring has to keep:\n *\n * - **Merge, never replace.** A field may already point at a hint (\"at least twelve\n * characters\"). Overwriting that reference to say the field is wrong trades one half\n * of the answer for the other — and it keeps the half the user has already read. The\n * hint stays first: it is the standing advice, the error is the news.\n * - **`invalid` keeps working alone**, for the forms whose message lives somewhere else\n * entirely (a summary at the top of a dialog). There is nothing to point at then, and\n * a dangling id describes the field as nothing at all.\n *\n * Deliberately NOT `role=\"alert\"`. `aria-describedby` is read when focus reaches the\n * control, which is where a field's own error is wanted; an alert would also interrupt\n * whatever is being read at the time, on every keystroke of a form that re-validates as\n * you type.\n *\n * Every field's since 0.34 (DUP-8, refactor audit 2026-10): it was ui.tsx's own, so the\n * combobox family restated it as `useComboboxFieldError` — without the fourth argument,\n * so Autocomplete announced a form library's `aria-invalid` and did not paint it — and\n * ten fields restated it inline.\n */\nexport function useFieldError(\n error: ReactNode,\n invalid: boolean | undefined,\n describedBy: string | undefined,\n /** The caller's own `aria-invalid`. A form library sets THIS (see `@eifi1/ui-kit/rhf`\n * `RhfField`), not our `invalid` prop — and a field that announces invalid should\n * look it too. */\n ariaInvalid?: unknown,\n): { isInvalid: boolean; describedBy: string | undefined; errorEl: ReactNode } {\n const errorId = useId();\n const hasError = hasContent(error);\n return {\n /** A field carrying a message that says what is wrong with it IS wrong. */\n isInvalid: Boolean(invalid) || hasError || ariaInvalid === true || ariaInvalid === \"true\",\n describedBy: mergeDescribedBy(describedBy, hasError && errorId),\n errorEl: hasError ? (\n <p id={errorId} className={FIELD_ERROR_CLASS}>\n {error}\n </p>\n ) : null,\n };\n}\n\n/** The caption under a field, as {@link Select} draws its own. */\nexport function FieldCaption({ parts, className }: { parts: FieldHintParts; className?: string }) {\n if (parts.captionText === undefined) return null;\n return (\n <p id={parts.captionId} className={cn(FIELD_CAPTION_CLASS, className)}>\n {parts.captionText}\n </p>\n );\n}\n\n/**\n * Classes that take a static floating label (`FLOATING_LABEL_STATIC`: `FieldLabel`,\n * `ComboboxFieldLabel`) out of its own absolute slot and into a {@link StaticLabelRow}.\n * `static` wins over `absolute` through `cn`'s merge; `min-w-0` lets it truncate in\n * the row. At Large the ROW stands above the field, so the label inside it drops the\n * margin a label above takes alone (`large:mb-0`), and stays level with its \"?\".\n */\nexport const LABEL_IN_ROW = \"static min-w-0 large:mb-0\";\n\n/**\n * A static label and its \"?\" on one line, in the top strip of a field that lays out its\n * own label — the combobox family, which cannot use {@link FloatingField} because the\n * trigger, the anchored panel and the label hang off a box of their own.\n *\n * FloatingField's static row, with one difference: it stops at `end-9`, the column the\n * chevron (or the clear \"×\") takes, so a long label truncates before it rather than\n * putting the \"?\" on top of the chevron. The hint keeps its width; the label gives way.\n */\nexport function StaticLabelRow({ hint, children }: { hint: ReactNode; children: ReactNode }) {\n return (\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute start-3 end-9 top-1 z-10 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n {children}\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/**\n * A field with no label line and a FieldHint \"?\": the hint at the end edge, OUTSIDE the\n * box, as an unlabelled {@link Select} has placed it since 0.15.5. Without a hint the\n * field is returned exactly as it was, so the wrapper costs nothing where it does not\n * apply.\n */\nexport function EndHintRow({\n hint,\n className,\n children,\n}: {\n hint: ReactNode | undefined;\n className?: string;\n children: ReactNode;\n}) {\n if (hint === undefined) return <>{children}</>;\n return (\n <div className={cn(\"flex items-center gap-1.5\", className)}>\n <div className=\"min-w-0 flex-1\">{children}</div>\n <span className=\"flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/* ── the write lock on a control that saves itself (keksdose K3) ───────────── */\n\nexport interface LockReason {\n /** The reason in force — the lock's (with `commit` under a locked\n * `WriteLockProvider`), else the control's own `disabledReason`. */\n reason: ReactNode;\n /** There is a reason: the control is locked the focusable way. */\n locked: boolean;\n /** The id of the reason's hidden copy, for the control's `aria-describedby`. */\n reasonId: string;\n}\n\n/**\n * {@link Button}'s `commit` + `disabledReason`, for a control that IS its own commit — a\n * switch, a checkbox or a select that saves on change, a list row whose click writes.\n * The lock's reason wins over the control's own (`useCommitReason`).\n */\nexport function useLockReason(commit: CommitScope | undefined, disabledReason: ReactNode): LockReason {\n const reason = useCommitReason(commit, disabledReason);\n const reasonId = useId();\n return { reason, locked: hasContent(reason), reasonId };\n}\n\n/**\n * A locked control and its reason — the kit's ONE frame for it, used by Button,\n * IconButton, Chip, Checkbox, Switch and every field that locks (DUP-3, refactor audit\n * 2026-10: Button's `ReasonFrame` and Chip's `ChipReasonFrame` were copies of it, and\n * only those two drew the line, so a field locked through `commit` kept its reason in a\n * tooltip on a phone while the Save beside it said it in words). Where it shows is\n * {@link DisabledReasonDisplay}'s: by default a LINE under the control at Large and on a\n * touch screen ({@link DisabledReasonLine}), the kit {@link Tooltip} otherwise.\n *\n * A component of its own so only a LOCKED control asks the text size and the pointer;\n * the hundreds of unlocked controls on a page subscribe to nothing.\n *\n * Tooltip form: the control in a FRAGMENT with a `hidden` copy of the reason for its\n * `aria-describedby`, so the Tooltip does not also clone its bubble's id into the\n * description — the same sentence twice would be read on every focus. Line form: the\n * line IS the description (it carries `reasonId`), and no bubble repeats what is on\n * screen.\n *\n * `className` is the wrapper's, which becomes the outermost element while locked — a\n * control moves its own layout classes here so a lock does not reflow the form.\n */\nexport function LockedReason({\n lock,\n display,\n line: lineProp,\n side,\n portal,\n className,\n lineClassName,\n children,\n}: {\n /** The reason, and the id the control's `aria-describedby` names. */\n lock: Pick<LockReason, \"reason\" | \"reasonId\">;\n /** Where the reason shows — the control's `disabledReasonDisplay`. Default `\"auto\"`. */\n display?: DisabledReasonDisplay;\n /** The answer of a caller that asked {@link useDisabledReasonLine} for its own layout\n * already (Checkbox, Switch); wins over `display`. */\n line?: boolean;\n /** The bubble's side and portal — IconButton's `tooltipSide` / `tooltipPortal`. */\n side?: TooltipSide;\n portal?: boolean;\n className?: string;\n /** Classes for the line itself — a list row's padding, so the words line up with the\n * row's. */\n lineClassName?: string;\n children: ReactNode;\n}) {\n const asked = useDisabledReasonLine(display);\n if (lineProp ?? asked) {\n return (\n <DisabledReasonLine id={lock.reasonId} reason={lock.reason} className={className} lineClassName={lineClassName}>\n {children}\n </DisabledReasonLine>\n );\n }\n return (\n <Tooltip label={lock.reason} side={side} portal={portal} className={className}>\n <>\n {children}\n <span id={lock.reasonId} hidden>\n {lock.reason}\n </span>\n </>\n </Tooltip>\n );\n}\n\n/* ── no fact only in a tooltip (0.32, docs/text-size-harmonization.md §4, §10.8) ── */\n\n/**\n * Where a control's `disabledReason` is shown (§4 \"No fact only in a tooltip\"):\n *\n * - `\"auto\"` (default): as a LINE under the control at Large and Extra large and on a\n * touch screen (`useInlineFacts`) — the reader asked for bigger type, or cannot hover\n * — and in the kit {@link Tooltip} otherwise, where a pointer can hover it open and\n * the form keeps its rhythm. Inside {@link CompactControls} (a top bar, a dense row's\n * inline actions) it stays the tooltip at every size: there is no room for a line.\n * - `\"line\"`: always the line — a form whose locked submit should say why at once.\n * - `\"tooltip\"`: always the tooltip — a place the caller knows has no room, and where\n * the reason is also said elsewhere on the screen (a banner over the form).\n *\n * Either way the reason is the control's `aria-describedby`, so a screen reader hears\n * it on focus; the line IS that description (one copy), the tooltip keeps its hidden\n * copy as before.\n */\nexport type DisabledReasonDisplay = \"auto\" | \"line\" | \"tooltip\";\n\n/**\n * Marks a region where the controls must stay compact at every text size (§4, §10.8):\n * an IconButton keeps its icon alone (its `label` stays the name and the tooltip) and a\n * `disabledReason` stays in the tooltip rather than a line. AppShell puts its top bar\n * in one (\"the top bar keeps its essential icons\"); `RowActions` its inline icons.\n *\n * For a toolbar that has no room, not for a whole page: the contract asks that the icon\n * alone be rare. A dense row's actions belong in `RowActions`, which collapses them\n * into a \"⋯\" menu at Large instead.\n */\nexport const CompactControlsContext = createContext(false);\n\nexport function CompactControls({ children, compact = true }: { children: ReactNode; compact?: boolean }) {\n return <CompactControlsContext.Provider value={compact}>{children}</CompactControlsContext.Provider>;\n}\n\n/** Whether a control's `disabledReason` is drawn as a line here — see\n * {@link DisabledReasonDisplay}. For the kit's own controls (Button, IconButton, Chip,\n * ToggleGroup) and an app's control that has a reason to give. */\nexport function useDisabledReasonLine(display: DisabledReasonDisplay = \"auto\"): boolean {\n const compact = useContext(CompactControlsContext);\n const inline = useInlineFacts();\n if (display === \"line\") return true;\n if (display === \"tooltip\") return false;\n return inline && !compact;\n}\n\n/** The reason line's type: a field caption's ({@link FIELD_CAPTION_CLASS}), so a locked\n * control's \"why\" reads like a field's standing advice. Capped, so a long reason under\n * a small control wraps rather than widening its row without end. */\nexport const DISABLED_REASON_LINE_CLASS =\n \"mt-1 block max-w-[20rem] text-caption leading-tight text-muted\";\n\n/**\n * A control and its `disabledReason` as a line under it — the `\"line\"` form of\n * {@link DisabledReasonDisplay}. The wrapper is the flex item now (`className`: the\n * control's own layout, e.g. `self-stretch`); `items-start` keeps the control its own\n * width, and a column parent still stretches the wrapper (FormActions' phone stack).\n * The line carries `id`, which the control's `aria-describedby` names.\n */\nexport function DisabledReasonLine({\n id,\n reason,\n className,\n lineClassName,\n children,\n}: {\n id: string;\n reason: ReactNode;\n className?: string;\n /** Classes for the line itself (0.34) — a list row's padding, so its words start\n * where the row's do. */\n lineClassName?: string;\n children: ReactNode;\n}) {\n return (\n <span data-slot=\"disabled-reason\" className={cn(\"inline-flex max-w-full flex-col items-start\", className)}>\n {children}\n <span id={id} className={cn(DISABLED_REASON_LINE_CLASS, lineClassName)}>\n {reason}\n </span>\n </span>\n );\n}\n\n/* ── groups ───────────────────────────────────────────────────────────────── */\n\n/**\n * Set by {@link CheckboxGroup}: its legend carries the one required star, so a box\n * inside it keeps the native `required` (a form still refuses an empty set) but draws no\n * star of its own — four stars on four languages would read as four separate demands.\n * ChoiceCardGroup's `InGroupContext`, for the plain checkbox.\n */\nexport const RequiredStarOnLegend = createContext(false);\n\n/* ── fields not built on FloatingField: pickers and bare groups ──────────── */\n\nexport interface FieldMessages {\n /** `invalid`, a message, or an `aria-invalid` from outside (a form library). */\n isInvalid: boolean;\n /** The caller's description, then the caption, then a lock's reason, then the error —\n * the standing advice before the news, as {@link useFieldError} orders them. */\n describedBy: string | undefined;\n /** The caption and the error, for under the field; `null` when there is neither. */\n below: ReactNode;\n /** What rides the LABEL line — the `help`'s \"?\", else a `FieldHint` — or `undefined`\n * when the hint is a caption and there is no help. */\n labelHint: ReactNode;\n}\n\n/**\n * `hint` / `help` / `error` / `invalid` resolved the way `Select` resolves them —\n * {@link useFieldHint} and {@link useFieldError} together, for a field that draws what\n * goes under it in one place (a picker, a group, a field built on another).\n */\nexport function useFieldMessages({\n hint,\n help,\n name,\n error,\n invalid,\n describedBy,\n ariaInvalid,\n reasonId,\n}: FieldHelpSource & {\n hint?: ReactNode;\n error?: ReactNode;\n invalid?: boolean;\n describedBy?: string;\n ariaInvalid?: unknown;\n /** A lock's reason (`useLockReason`'s `reasonId`, while locked): described after the\n * caption and before the error, as on Select. */\n reasonId?: string | false;\n}): FieldMessages {\n const hintParts = useFieldHint(hint, describedBy, { help, name });\n const field = useFieldError(error, invalid, mergeDescribedBy(hintParts.describedBy, reasonId), ariaInvalid);\n return {\n isInvalid: field.isInvalid,\n describedBy: field.describedBy,\n below:\n hintParts.captionText !== undefined || field.errorEl !== null ? (\n <>\n <FieldCaption parts={hintParts} />\n {field.errorEl}\n </>\n ) : null,\n labelHint: hintParts.labelHint,\n };\n}\n\n/**\n * The field and what is under it, as one box — `FieldGroup` in field-base.tsx, for the same\n * reasons written there. Nothing of its own while there is nothing under the field and\n * the caller passed no `error` key (the DOM is exactly what it was before these props);\n * once `error` is passed the box is kept even with no message, so the trigger is never\n * reparented — and remounted, losing focus — as the message comes and goes.\n */\nexport function FieldBox({\n below,\n reserve,\n children,\n}: {\n below: ReactNode;\n reserve: boolean;\n children: ReactNode;\n}) {\n if (below === null && !reserve) return <>{children}</>;\n return (\n <div>\n {children}\n {below}\n </div>\n );\n}\n\n/**\n * The static label in a trigger field's top strip — a {@link FieldLabel}, or, with a\n * `FieldHint`, the label and its \"?\" laid out on ONE flex row (dev#468: two absolute\n * offsets guessing at the same baseline put the \"?\" three pixels above its word).\n * `FloatingField`'s static-label row, except that it stops at `end-9`: the date and\n * month triggers keep that column (`pe-9`) for the calendar glyph or the clear ×, and a\n * long label truncates before it rather than putting the \"?\" on top of it.\n */\nexport function FieldLabelLine({ label, hint }: { label: ReactNode; hint?: ReactNode }) {\n if (!hasContent(hint)) return <FieldLabel>{label}</FieldLabel>;\n return (\n // `z-10` as FieldLabel has it: the trigger after it is `relative` and would paint\n // over the row (and take the \"?\"'s hover) otherwise. Above the field at Large.\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute start-3 end-9 top-1 z-10 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n <FieldLabel className={cn(LABEL_IN_ROW, \"max-w-full\")}>{label}</FieldLabel>\n <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>\n </div>\n );\n}\n\n/**\n * How tall the strip over a bare group is: 20px at Normal, for every group the kit\n * draws one over — ToggleGroup's `labelPlacement=\"strip\"`, SwatchPicker, IconPicker\n * and {@link FieldStrip} (whose `pad` named two heights until 0.34).\n *\n * The label ROW, not the label, is what has to fit (keksdose dev#593, kk K4, measured in\n * headless Chromium): it sits `top-1` (4px) and is as tall as the taller of the label\n * (11px `text-caption` in a `leading-tight` line, 13.75px) and its \"?\" (a 14px icon,\n * `size-3.5`) — so it ends 18px down. The strip has to be at least that:\n *\n * label row: 4 + max(13.75, 14) = 18 ≤ strip: 20 (2px clear of the content)\n *\n * Until 0.34 a 16px strip (`\"field\"`) stood over the segmented group so that 16 + its\n * 26px box made a labelled Input's 42px (keksdose's `ClearedStatusPicker`, live #288 /\n * #431). The label and its \"?\" then crossed the group's top border by 2px — *\"the\n * question mark even interferes with it\"* (at 125 %: label row 424–438, border at 436).\n * The 4px come out of the group's segments instead (`STRIP_SEGMENT` in\n * toggle-group.tsx): 20 + 22 = 42. A tile, a map, a row of buttons — content with no\n * inset — needed the 20px already (keksdose's `FlagPicker` and location field, `pt-5`).\n *\n * Every term is rem, so the sum holds at any browser font size. At Large and Extra large\n * there is no strip: the label row stands above the content, in flow\n * ({@link LABEL_ABOVE_AT_LARGE}), and the padding goes (`large:pt-0` in\n * {@link LabelStrip}), so nothing lies under the label to cross.\n */\nexport const LABEL_STRIP_PAD = \"pt-5\";\n\n/**\n * The 11px label (and its `FieldHint`) over a group that is NOT a field — keksdose K2:\n * a segmented control or a row of swatches standing in a form row beside labelled\n * inputs, whose label must sit on the same line as theirs (`top-1`, `inset-x-3`, the\n * type of a field's static label) without the group growing a field's border round\n * it. `id` goes on the label so the group can be `aria-labelledby` it.\n *\n * `relative` is load-bearing twice over: the row is positioned against it, and a\n * caller's `sr-only` label cannot escape it (sr-only-containment).\n *\n * Any other attribute (`rest`) lands on the wrapper — {@link FieldStrip} makes it the\n * `role=\"group\"` its label names. The kit's own groups pass none, so their wrapper is\n * the bare box it was in 0.22.\n */\nexport function LabelStrip({\n labelId,\n label,\n hint,\n disabled,\n className,\n children,\n ...rest\n}: Omit<ComponentPropsWithoutRef<\"div\">, \"children\"> & {\n labelId: string;\n label: ReactNode;\n /** What rides the label line beside the label — a resolved `labelHint`\n * ({@link useFieldMessages}), never a raw `hint`: a FieldHint is the caption at Large\n * and on touch, and the caller draws that under its group. */\n hint?: ReactNode;\n /** Dim the label with its group, as `peer-disabled:` dims a field's own. */\n disabled?: boolean;\n children: ReactNode;\n}) {\n return (\n // At Large the row is a label above the group, in flow (0.33, §10.17), and the\n // strip's padding goes: nothing lies under it any more.\n <div {...rest} className={cn(\"relative min-w-0\", LABEL_STRIP_PAD, \"large:pt-0\", className)}>\n <div\n data-field-label=\"\"\n className={cn(\"pointer-events-none absolute inset-x-3 top-1 flex items-center gap-1\", LABEL_ABOVE_AT_LARGE)}\n >\n {/* `static`: FieldLabel positions itself absolutely; here the ROW is\n positioned, so the label and its \"?\" are centred on one line by the flex\n layout (dev#468). */}\n <FieldLabel id={labelId} className={cn(LABEL_IN_ROW, \"max-w-full\", disabled && \"opacity-50\")}>\n {label}\n </FieldLabel>\n {hasContent(hint) && <span className=\"pointer-events-auto flex shrink-0 items-center\">{hint}</span>}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":";AAkHI,SAyV6B,UAzV7B,KAgUA,YAhUA;AAlHJ,SAAS,eAAe,gBAAgB,YAAY,aAAa;AAEjE,SAAS,kBAAkB;AAC3B,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,iBAAiB;AAC1B,SAAS,uBAAuB,oBAAoB;AACpD,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,eAAiC;AAC1C,SAAS,uBAAyC;AA8B3C,SAAS,oBAAoB,KAAmE;AACrG,QAAM,OAAO,IAAI,OAAO,OAAO;AAC/B,SAAO,KAAK,SAAS,KAAK,KAAK,GAAG,IAAI;AACxC;AAIA,SAAS,WAAW,iBAAiB;AAS9B,MAAM,oBACX;AAgBK,MAAM,uBACX;AAYK,MAAM,kBACX;AAKK,MAAM,wBAAwB;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAWO,SAAS,WAAW,EAAE,UAAU,WAAW,GAAG,KAAK,GAAoB;AAC5E;AAAA;AAAA;AAAA,IAGE,oBAAC,U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BAAC,cAAW,WAAW,GAAG,cAAc,YAAY,GAAI,iBAAM;AAAA,UAC9D,oBAAC,UAAK,WAAU,kDAAkD,gBAAK;AAAA;AAAA;AAAA,IACzE;AAAA;AAEJ;AA2BO,MAAM,kBAAkB;AAgBxB,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAUG;AACD;AAAA;AAAA;AAAA,IAGE,qBAAC,SAAK,GAAG,MAAM,WAAW,GAAG,oBAAoB,iBAAiB,cAAc,SAAS,GACvF;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,oBAAiB;AAAA,UACjB,WAAW,GAAG,wEAAwE,oBAAoB;AAAA,UAK1G;AAAA,gCAAC,cAAW,IAAI,SAAS,WAAW,GAAG,cAAc,cAAc,YAAY,YAAY,GACxF,iBACH;AAAA,YACC,WAAW,IAAI,KAAK,oBAAC,UAAK,WAAU,kDAAkD,gBAAK;AAAA;AAAA;AAAA,MAC9F;AAAA,MACC;AAAA,OACH;AAAA;AAEJ;","names":[]}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
* How far down the content starts, under the 11px label — see {@link FieldStripProps.pad}.
|
|
4
|
-
* Since 0.34 both are the one 20px strip.
|
|
5
|
-
*/
|
|
6
|
-
export type FieldStripPad = "clear" | "field";
|
|
1
|
+
import type { ComponentPropsWithRef, ReactNode } from "react";
|
|
2
|
+
import { type FieldHelpProps } from "./field-parts.js";
|
|
7
3
|
/** What a {@link FieldStrip} hands render-prop children. */
|
|
8
4
|
export interface FieldStripIds {
|
|
9
5
|
/** The label's id — for content that names ITSELF by the label (`aria-labelledby`)
|
|
@@ -14,7 +10,12 @@ export interface FieldStripIds {
|
|
|
14
10
|
* `group={false}`, where there is no group to describe. */
|
|
15
11
|
describedBy: string | undefined;
|
|
16
12
|
}
|
|
17
|
-
|
|
13
|
+
/**
|
|
14
|
+
* A `div`'s props, `ref` included since 0.35 (round 0.35 R4, as Card and EmptyState took
|
|
15
|
+
* it in 0.34, API-2): the ref is the root — the group, or the plain box under
|
|
16
|
+
* `group={false}` — which a caller scrolls into view or measures.
|
|
17
|
+
*/
|
|
18
|
+
export interface FieldStripProps extends Omit<ComponentPropsWithRef<"div">, "children">, FieldHelpProps {
|
|
18
19
|
/** The 11px static label, on the line a labelled field's label sits on. */
|
|
19
20
|
label: ReactNode;
|
|
20
21
|
/**
|
|
@@ -32,21 +33,6 @@ export interface FieldStripProps extends Omit<ComponentPropsWithoutRef<"div">, "
|
|
|
32
33
|
* turns its map into a picture and drops its buttons, which no flag here could guess.
|
|
33
34
|
*/
|
|
34
35
|
disabled?: boolean;
|
|
35
|
-
/**
|
|
36
|
-
* @deprecated 0.34 — drop it; removed in 0.35. Both values are the same 20px strip
|
|
37
|
-
* since 0.34, and the prop does nothing; it stays so a caller that passes it still
|
|
38
|
-
* compiles.
|
|
39
|
-
*
|
|
40
|
-
* It chose between `"clear"` (20px) and `"field"` (16px: the strip plus a 26px
|
|
41
|
-
* bordered control made a labelled Input's 42px). The label row — the label and its
|
|
42
|
-
* "?" — ends 18px down, so over a 16px strip it crossed the content's top border by
|
|
43
|
-
* 2px (keksdose dev#593; the arithmetic is on `LABEL_STRIP_PAD` in field-parts.tsx).
|
|
44
|
-
* For a row of 42px fields, make the content 22px tall: 20 + 22 = 42, the shape
|
|
45
|
-
* ToggleGroup's `labelPlacement="strip"` has since 0.34.
|
|
46
|
-
*
|
|
47
|
-
* A `className` still merges after the strip's padding.
|
|
48
|
-
*/
|
|
49
|
-
pad?: FieldStripPad;
|
|
50
36
|
/**
|
|
51
37
|
* The wrapper is a `role="group"` named by the label (default), so a screen reader
|
|
52
38
|
* entering the map or the first button hears "Location, group" — what the visible
|
|
@@ -93,4 +79,4 @@ export interface FieldStripProps extends Omit<ComponentPropsWithoutRef<"div">, "
|
|
|
93
79
|
* that labels its fields that way. This is for a row whose fields float their labels
|
|
94
80
|
* inside them, where a label above would be the only one of its kind.
|
|
95
81
|
*/
|
|
96
|
-
export declare function FieldStrip({ label, hint, error, disabled,
|
|
82
|
+
export declare function FieldStrip({ label, hint, help, error, disabled, group, className, children, ...rest }: FieldStripProps): import("react").JSX.Element;
|
|
@@ -5,39 +5,42 @@ import { LabelStrip, useFieldMessages } from "./field-parts.js";
|
|
|
5
5
|
function FieldStrip({
|
|
6
6
|
label,
|
|
7
7
|
hint,
|
|
8
|
+
help,
|
|
8
9
|
error,
|
|
9
10
|
disabled = false,
|
|
10
|
-
// Taken off so it never reaches the DOM; see `pad` (deprecated, one strip since 0.34).
|
|
11
|
-
pad: _pad,
|
|
12
11
|
group = true,
|
|
13
12
|
className,
|
|
14
13
|
children,
|
|
15
14
|
...rest
|
|
16
15
|
}) {
|
|
17
16
|
const labelId = useId();
|
|
18
|
-
const messages = useFieldMessages({ hint, error });
|
|
17
|
+
const messages = useFieldMessages({ hint, help, name: label, error });
|
|
19
18
|
const content = typeof children === "function" ? children({ labelId, describedBy: messages.describedBy }) : children;
|
|
20
19
|
const groupDescribedBy = [rest["aria-describedby"], messages.describedBy].filter(Boolean).join(" ") || void 0;
|
|
21
|
-
return
|
|
22
|
-
LabelStrip
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
20
|
+
return (
|
|
21
|
+
// `rest` carries the caller's `ref` too (a plain prop in React 19): LabelStrip spreads
|
|
22
|
+
// its own rest onto the wrapper `<div>`, so the ref lands on the root.
|
|
23
|
+
/* @__PURE__ */ jsxs(
|
|
24
|
+
LabelStrip,
|
|
25
|
+
{
|
|
26
|
+
...rest,
|
|
27
|
+
...group ? {
|
|
28
|
+
role: "group",
|
|
29
|
+
// An explicit name wins, as on the kit's labelled groups.
|
|
30
|
+
"aria-labelledby": rest["aria-label"] === void 0 && rest["aria-labelledby"] === void 0 ? labelId : rest["aria-labelledby"],
|
|
31
|
+
"aria-describedby": groupDescribedBy
|
|
32
|
+
} : null,
|
|
33
|
+
labelId,
|
|
34
|
+
label,
|
|
35
|
+
hint: messages.labelHint,
|
|
36
|
+
disabled,
|
|
37
|
+
className,
|
|
38
|
+
children: [
|
|
39
|
+
content,
|
|
40
|
+
messages.below
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
)
|
|
41
44
|
);
|
|
42
45
|
}
|
|
43
46
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/field-strip.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport type {
|
|
1
|
+
{"version":3,"sources":["../../src/components/field-strip.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { LabelStrip, useFieldMessages, type FieldHelpProps } from \"./field-parts\";\n\n/** What a {@link FieldStrip} hands render-prop children. */\nexport interface FieldStripIds {\n /** The label's id — for content that names ITSELF by the label (`aria-labelledby`)\n * under `group={false}`, or anything else that has to point at it. */\n labelId: string;\n /** The ids of the caption and the error while they are on screen, else `undefined`.\n * The group is described by them already; spread this on the content under\n * `group={false}`, where there is no group to describe. */\n describedBy: string | undefined;\n}\n\n/**\n * A `div`'s props, `ref` included since 0.35 (round 0.35 R4, as Card and EmptyState took\n * it in 0.34, API-2): the ref is the root — the group, or the plain box under\n * `group={false}` — which a caller scrolls into view or measures.\n */\nexport interface FieldStripProps extends Omit<ComponentPropsWithRef<\"div\">, \"children\">, FieldHelpProps {\n /** The 11px static label, on the line a labelled field's label sits on. */\n label: ReactNode;\n /**\n * Field anatomy, as on {@link Input}: plain text is a caption under the content (and\n * describes the group); a {@link FieldHint} \"?\" rides the label line.\n */\n hint?: ReactNode;\n /** A message under the content, in `--danger`, describing the group. `null`,\n * `false` and `\"\"` are no error. The content's own controls are the caller's to\n * mark `aria-invalid`; a `group` cannot be. */\n error?: ReactNode;\n /**\n * Dims the label with the content, as a disabled field's label dims. The content is\n * the caller's: disable (or hide) its controls yourself — keksdose's location cell\n * turns its map into a picture and drops its buttons, which no flag here could guess.\n */\n disabled?: boolean;\n /**\n * The wrapper is a `role=\"group\"` named by the label (default), so a screen reader\n * entering the map or the first button hears \"Location, group\" — what the visible\n * label tells a sighted reader the content is about.\n *\n * `false` for content that is a labelled group ITSELF (a `role=\"radiogroup\"` of the\n * app's own, a TileRadioGroup's container, a fieldset): a group inside a group, both\n * named \"Pattern\", is read twice. The wrapper is then a plain box, and the content\n * takes the name from the render-prop's `labelId` (and the caption and error from\n * its `describedBy`).\n */\n group?: boolean;\n /** The content. A function receives {@link FieldStripIds}. */\n children: ReactNode | ((ids: FieldStripIds) => ReactNode);\n}\n\n/**\n * The kit's label strip for content of your own — keksdose G8.\n *\n * 0.22 gave three groups a strip label (keksdose K2): ToggleGroup's\n * `labelPlacement=\"strip\"`, SwatchPicker's and IconPicker's `label`. Each draws the\n * 11px label (and its `FieldHint`) on the same line as the labelled fields beside it,\n * over content WITHOUT a field's border round it. keksdose's transaction row has one\n * cell left that is not one of those groups: the location — a map, a \"Locate me\" and a\n * \"Search\" button — still built by hand as a `relative` cell, a floated `FieldLabel`\n * and a `pt-5` box (transaction-location-field.tsx), and so is the reconciled-status\n * stand-in (cleared-status-toggle.tsx, `ClearedStatusLocked`). This is the strip on its\n * own, the same component the three groups draw theirs with:\n *\n * ```tsx\n * <FieldStrip label={t(\"transactions.location\")} className={className}>\n * <div className=\"space-y-2\">\n * <PinMap … />\n * <div className=\"flex flex-wrap gap-2\"><Button …>Locate me</Button>…</div>\n * </div>\n * </FieldStrip>\n * ```\n *\n * The label sits where a field's static label sits (`top-1`, `inset-x-3`, 11px in a\n * `leading-tight` line); the content starts 20px down, full width, clear of the label\n * and its \"?\". `className` styles the wrapper — the grid or flex item in the caller's\n * row — and merges after the strip's padding.\n *\n * Not a {@link Field}: that one sets a 14px label ABOVE its control, in flow, for a form\n * that labels its fields that way. This is for a row whose fields float their labels\n * inside them, where a label above would be the only one of its kind.\n */\nexport function FieldStrip({\n label,\n hint,\n help,\n error,\n disabled = false,\n group = true,\n className,\n children,\n ...rest\n}: FieldStripProps) {\n const labelId = useId();\n const messages = useFieldMessages({ hint, help, name: label, error });\n const content = typeof children === \"function\" ? children({ labelId, describedBy: messages.describedBy }) : children;\n // The caller's own description first, then the caption, then the error — the order\n // every kit field reads them in.\n const groupDescribedBy = [rest[\"aria-describedby\"], messages.describedBy].filter(Boolean).join(\" \") || undefined;\n return (\n // `rest` carries the caller's `ref` too (a plain prop in React 19): LabelStrip spreads\n // its own rest onto the wrapper `<div>`, so the ref lands on the root.\n <LabelStrip\n {...rest}\n {...(group\n ? {\n role: \"group\",\n // An explicit name wins, as on the kit's labelled groups.\n \"aria-labelledby\":\n rest[\"aria-label\"] === undefined && rest[\"aria-labelledby\"] === undefined\n ? labelId\n : rest[\"aria-labelledby\"],\n \"aria-describedby\": groupDescribedBy,\n }\n : null)}\n labelId={labelId}\n label={label}\n hint={messages.labelHint}\n disabled={disabled}\n className={className}\n >\n {content}\n {messages.below}\n </LabelStrip>\n );\n}\n"],"mappings":";AAyGI;AAzGJ,SAAS,aAAa;AAEtB,SAAS,YAAY,wBAA6C;AAmF3D,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAoB;AAClB,QAAM,UAAU,MAAM;AACtB,QAAM,WAAW,iBAAiB,EAAE,MAAM,MAAM,MAAM,OAAO,MAAM,CAAC;AACpE,QAAM,UAAU,OAAO,aAAa,aAAa,SAAS,EAAE,SAAS,aAAa,SAAS,YAAY,CAAC,IAAI;AAG5G,QAAM,mBAAmB,CAAC,KAAK,kBAAkB,GAAG,SAAS,WAAW,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KAAK;AACvG;AAAA;AAAA;AAAA,IAGE;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACH,GAAI,QACD;AAAA,UACE,MAAM;AAAA;AAAA,UAEN,mBACE,KAAK,YAAY,MAAM,UAAa,KAAK,iBAAiB,MAAM,SAC5D,UACA,KAAK,iBAAiB;AAAA,UAC5B,oBAAoB;AAAA,QACtB,IACA;AAAA,QACJ;AAAA,QACA;AAAA,QACA,MAAM,SAAS;AAAA,QACf;AAAA,QACA;AAAA,QAEC;AAAA;AAAA,UACA,SAAS;AAAA;AAAA;AAAA,IACZ;AAAA;AAEJ;","names":[]}
|