@eifi1/ui-kit 0.33.0 → 0.34.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 +445 -283
- package/dist/account/account-parts.d.ts +6 -8
- package/dist/account/account-parts.js +1 -2
- package/dist/account/account-parts.js.map +1 -1
- package/dist/{components → account}/account-settings-labels.d.ts +16 -10
- package/dist/{components → account}/account-settings-labels.js +3 -1
- package/dist/account/account-settings-labels.js.map +1 -0
- package/dist/{components → account}/account-settings.d.ts +53 -23
- package/dist/{components → account}/account-settings.js +97 -26
- package/dist/account/account-settings.js.map +1 -0
- package/dist/account/data-export-setting-labels.d.ts +2 -0
- package/dist/account/data-export-setting-labels.js +15 -0
- package/dist/account/data-export-setting-labels.js.map +1 -0
- package/dist/account/data-export-setting.d.ts +9 -11
- package/dist/account/data-export-setting.js +11 -27
- package/dist/account/data-export-setting.js.map +1 -1
- package/dist/account/delete-account-setting-labels.d.ts +2 -0
- package/dist/account/delete-account-setting-labels.js +23 -0
- package/dist/account/delete-account-setting-labels.js.map +1 -0
- package/dist/account/delete-account-setting.d.ts +132 -100
- package/dist/account/delete-account-setting.js +7 -23
- package/dist/account/delete-account-setting.js.map +1 -1
- package/dist/account/email-change-setting-labels.d.ts +2 -0
- package/dist/account/email-change-setting-labels.js +28 -0
- package/dist/account/email-change-setting-labels.js.map +1 -0
- package/dist/account/email-change-setting.d.ts +10 -12
- package/dist/account/email-change-setting.js +11 -30
- package/dist/account/email-change-setting.js.map +1 -1
- package/dist/{components → account}/passkeys-setting.d.ts +9 -12
- package/dist/{components → account}/passkeys-setting.js +10 -7
- package/dist/account/passkeys-setting.js.map +1 -0
- package/dist/account/sessions-setting-labels.d.ts +2 -0
- package/dist/account/sessions-setting-labels.js +22 -0
- package/dist/account/sessions-setting-labels.js.map +1 -0
- package/dist/account/sessions-setting.d.ts +12 -14
- package/dist/account/sessions-setting.js +8 -23
- package/dist/account/sessions-setting.js.map +1 -1
- package/dist/admin/admin-action-confirm-labels.d.ts +2 -0
- package/dist/admin/admin-action-confirm-labels.js +16 -0
- package/dist/admin/admin-action-confirm-labels.js.map +1 -0
- package/dist/admin/admin-action-confirm.d.ts +156 -100
- package/dist/admin/admin-action-confirm.js +17 -22
- package/dist/admin/admin-action-confirm.js.map +1 -1
- package/dist/admin/admin-action-log-labels.d.ts +2 -0
- package/dist/admin/admin-action-log-labels.js +73 -0
- package/dist/admin/admin-action-log-labels.js.map +1 -0
- package/dist/admin/admin-action-log.d.ts +98 -22
- package/dist/admin/admin-action-log.js +48 -45
- package/dist/admin/admin-action-log.js.map +1 -1
- package/dist/admin/admin-parts.d.ts +7 -14
- package/dist/admin/admin-parts.js +0 -4
- package/dist/admin/admin-parts.js.map +1 -1
- package/dist/admin/invitations-panel-labels.d.ts +2 -0
- package/dist/admin/invitations-panel-labels.js +29 -0
- package/dist/admin/invitations-panel-labels.js.map +1 -0
- package/dist/admin/invitations-panel.d.ts +167 -100
- package/dist/admin/invitations-panel.js +12 -31
- package/dist/admin/invitations-panel.js.map +1 -1
- package/dist/admin/plan-change-labels.d.ts +2 -0
- package/dist/admin/plan-change-labels.js +22 -0
- package/dist/admin/plan-change-labels.js.map +1 -0
- package/dist/admin/plan-change.d.ts +244 -100
- package/dist/admin/plan-change.js +17 -23
- package/dist/admin/plan-change.js.map +1 -1
- package/dist/admin/reviewer-scope-editor-labels.d.ts +2 -0
- package/dist/admin/reviewer-scope-editor-labels.js +14 -0
- package/dist/admin/reviewer-scope-editor-labels.js.map +1 -0
- package/dist/admin/reviewer-scope-editor.d.ts +95 -100
- package/dist/admin/reviewer-scope-editor.js +5 -13
- package/dist/admin/reviewer-scope-editor.js.map +1 -1
- package/dist/admin/role-select-labels.d.ts +2 -0
- package/dist/admin/role-select-labels.js +15 -0
- package/dist/admin/role-select-labels.js.map +1 -0
- package/dist/admin/role-select.d.ts +136 -100
- package/dist/admin/role-select.js +7 -18
- package/dist/admin/role-select.js.map +1 -1
- package/dist/admin/transfer-ownership-dialog-labels.d.ts +2 -0
- package/dist/admin/transfer-ownership-dialog-labels.js +18 -0
- package/dist/admin/transfer-ownership-dialog-labels.js.map +1 -0
- package/dist/admin/transfer-ownership-dialog.d.ts +81 -100
- package/dist/admin/transfer-ownership-dialog.js +3 -15
- package/dist/admin/transfer-ownership-dialog.js.map +1 -1
- package/dist/admin/user-roster-labels.d.ts +2 -0
- package/dist/admin/user-roster-labels.js +16 -0
- package/dist/admin/user-roster-labels.js.map +1 -0
- package/dist/admin/user-roster.d.ts +225 -100
- package/dist/admin/user-roster.js +4 -14
- package/dist/admin/user-roster.js.map +1 -1
- package/dist/auth/accept-invitation-labels.d.ts +2 -0
- package/dist/auth/accept-invitation-labels.js +20 -0
- package/dist/auth/accept-invitation-labels.js.map +1 -0
- package/dist/auth/accept-invitation.d.ts +11 -13
- package/dist/auth/accept-invitation.js +3 -16
- package/dist/auth/accept-invitation.js.map +1 -1
- package/dist/auth/auth-errors.d.ts +34 -23
- package/dist/auth/auth-errors.js +8 -4
- package/dist/auth/auth-errors.js.map +1 -1
- package/dist/auth/complete-name-dialog-labels.d.ts +2 -0
- package/dist/auth/complete-name-dialog-labels.js +14 -0
- package/dist/auth/complete-name-dialog-labels.js.map +1 -0
- package/dist/auth/complete-name-dialog.d.ts +9 -11
- package/dist/auth/complete-name-dialog.js +4 -11
- package/dist/auth/complete-name-dialog.js.map +1 -1
- package/dist/auth/email-tag.d.ts +2 -4
- package/dist/auth/forgot-password-form-labels.d.ts +3 -0
- package/dist/auth/forgot-password-form-labels.js +17 -0
- package/dist/auth/forgot-password-form-labels.js.map +1 -0
- package/dist/auth/forgot-password-form.d.ts +9 -12
- package/dist/auth/forgot-password-form.js +6 -15
- package/dist/auth/forgot-password-form.js.map +1 -1
- package/dist/auth/form-rules.d.ts +5 -7
- package/dist/auth/new-password-fields.d.ts +4 -8
- package/dist/auth/new-password-fields.js +1 -1
- package/dist/auth/new-password-fields.js.map +1 -1
- package/dist/auth/not-found-page-labels.d.ts +2 -0
- package/dist/auth/not-found-page-labels.js +11 -0
- package/dist/auth/not-found-page-labels.js.map +1 -0
- package/dist/auth/not-found-page.d.ts +9 -11
- package/dist/auth/not-found-page.js +5 -10
- package/dist/auth/not-found-page.js.map +1 -1
- package/dist/auth/register-form-labels.d.ts +3 -0
- package/dist/auth/register-form-labels.js +28 -0
- package/dist/auth/register-form-labels.js.map +1 -0
- package/dist/auth/register-form.d.ts +174 -100
- package/dist/auth/register-form.js +11 -31
- package/dist/auth/register-form.js.map +1 -1
- package/dist/auth/reset-password-form-labels.d.ts +3 -0
- package/dist/auth/reset-password-form-labels.js +24 -0
- package/dist/auth/reset-password-form-labels.js.map +1 -0
- package/dist/auth/reset-password-form.d.ts +12 -15
- package/dist/auth/reset-password-form.js +6 -22
- package/dist/auth/reset-password-form.js.map +1 -1
- package/dist/auth/sign-in-form-labels.d.ts +3 -0
- package/dist/auth/sign-in-form-labels.js +42 -0
- package/dist/auth/sign-in-form-labels.js.map +1 -0
- package/dist/auth/sign-in-form.d.ts +15 -19
- package/dist/auth/sign-in-form.js +12 -46
- package/dist/auth/sign-in-form.js.map +1 -1
- package/dist/auth/status-parts.d.ts +13 -17
- package/dist/auth/status-parts.js +3 -3
- package/dist/auth/status-parts.js.map +1 -1
- package/dist/auth/verify-email-labels.d.ts +2 -0
- package/dist/auth/verify-email-labels.js +25 -0
- package/dist/auth/verify-email-labels.js.map +1 -0
- package/dist/auth/verify-email.d.ts +15 -17
- package/dist/auth/verify-email.js +4 -21
- package/dist/auth/verify-email.js.map +1 -1
- package/dist/billing/billing-banner.d.ts +8 -108
- package/dist/billing/billing-banner.js +2 -1
- package/dist/billing/billing-banner.js.map +1 -1
- package/dist/billing/billing-labels.d.ts +168 -100
- package/dist/billing/billing-labels.js.map +1 -1
- package/dist/billing/billing-lock.d.ts +10 -109
- package/dist/billing/billing-overview.d.ts +7 -108
- package/dist/billing/billing-standing.d.ts +6 -107
- package/dist/billing/checkout-processing.d.ts +8 -110
- package/dist/billing/checkout-processing.js +2 -9
- package/dist/billing/checkout-processing.js.map +1 -1
- package/dist/billing/checkout-return.d.ts +5 -7
- package/dist/billing/pay-page.d.ts +22 -119
- package/dist/billing/pay-page.js.map +1 -1
- package/dist/billing/plan-card.d.ts +14 -114
- package/dist/billing/plan-card.js +15 -13
- package/dist/billing/plan-card.js.map +1 -1
- package/dist/billing/plan-limit-notice.d.ts +8 -108
- package/dist/billing/plan-limit-notice.js +1 -1
- package/dist/billing/plan-limit-notice.js.map +1 -1
- package/dist/billing/plan-limit-toast.d.ts +6 -106
- package/dist/billing/plan-limit.d.ts +2 -4
- package/dist/billing/plan-price.d.ts +10 -12
- package/dist/billing/subscription-actions.d.ts +6 -108
- package/dist/billing/subscription-actions.js +2 -2
- package/dist/billing/subscription-actions.js.map +1 -1
- package/dist/billing/subscription-status-chip.d.ts +7 -107
- package/dist/chart.d.ts +12 -112
- package/dist/chart.js +4 -0
- package/dist/chart.js.map +1 -1
- package/dist/components/account-chips-labels.d.ts +10 -0
- package/dist/components/account-chips-labels.js +15 -0
- package/dist/components/account-chips-labels.js.map +1 -0
- package/dist/components/account-chips.d.ts +22 -44
- package/dist/components/account-chips.js +9 -14
- package/dist/components/account-chips.js.map +1 -1
- package/dist/components/alert-banner.d.ts +15 -11
- package/dist/components/alert-banner.js +28 -18
- package/dist/components/alert-banner.js.map +1 -1
- package/dist/components/amount-input.d.ts +66 -109
- package/dist/components/amount-input.js +259 -283
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/appearance-labels.d.ts +6 -10
- package/dist/components/appearance-labels.js.map +1 -1
- package/dist/components/authed-image-labels.d.ts +2 -0
- package/dist/components/authed-image-labels.js +10 -0
- package/dist/components/authed-image-labels.js.map +1 -0
- package/dist/components/authed-image.d.ts +11 -13
- package/dist/components/authed-image.js +2 -6
- package/dist/components/authed-image.js.map +1 -1
- package/dist/components/autocomplete.d.ts +13 -11
- package/dist/components/autocomplete.js +35 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/breadcrumbs-labels.d.ts +2 -0
- package/dist/components/breadcrumbs-labels.js +9 -0
- package/dist/components/breadcrumbs-labels.js.map +1 -0
- package/dist/components/breadcrumbs.d.ts +10 -12
- package/dist/components/breadcrumbs.js +7 -10
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bulk-action-bar-labels.d.ts +2 -0
- package/dist/components/bulk-action-bar-labels.js +10 -0
- package/dist/components/bulk-action-bar-labels.js.map +1 -0
- package/dist/components/bulk-action-bar.d.ts +10 -12
- package/dist/components/bulk-action-bar.js +9 -12
- package/dist/components/bulk-action-bar.js.map +1 -1
- package/dist/components/button-group.d.ts +7 -109
- package/dist/components/button-group.js +5 -5
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button-look.d.ts +88 -0
- package/dist/components/button-look.js +91 -0
- package/dist/components/button-look.js.map +1 -0
- package/dist/components/button.d.ts +153 -0
- package/dist/components/button.js +165 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/calculator.d.ts +8 -106
- package/dist/components/calculator.js +10 -7
- package/dist/components/calculator.js.map +1 -1
- package/dist/components/calendar-heatmap-labels.d.ts +3 -0
- package/dist/components/calendar-heatmap-labels.js +12 -0
- package/dist/components/calendar-heatmap-labels.js.map +1 -0
- package/dist/components/calendar-heatmap.d.ts +13 -16
- package/dist/components/calendar-heatmap.js +7 -13
- package/dist/components/calendar-heatmap.js.map +1 -1
- package/dist/components/card.d.ts +145 -0
- package/dist/components/card.js +186 -0
- package/dist/components/card.js.map +1 -0
- package/dist/components/chart-height.d.ts +4 -7
- package/dist/components/chart-zoom-core.d.ts +202 -0
- package/dist/components/chart-zoom-core.js +334 -0
- package/dist/components/chart-zoom-core.js.map +1 -0
- package/dist/components/chart-zoom.d.ts +39 -205
- package/dist/components/chart-zoom.js +15 -316
- package/dist/components/chart-zoom.js.map +1 -1
- package/dist/components/chart.d.ts +11 -15
- package/dist/components/chart.js +11 -11
- package/dist/components/chart.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +6 -10
- package/dist/components/checkbox-group.js +10 -9
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/checkbox.d.ts +8 -12
- package/dist/components/checkbox.js +20 -18
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/chip-input.d.ts +73 -0
- package/dist/components/chip-input.js +224 -0
- package/dist/components/chip-input.js.map +1 -0
- package/dist/components/chip-labels.d.ts +2 -0
- package/dist/components/chip-labels.js +12 -0
- package/dist/components/chip-labels.js.map +1 -0
- package/dist/components/chip.d.ts +18 -93
- package/dist/components/chip.js +74 -426
- package/dist/components/chip.js.map +1 -1
- package/dist/components/choice-card.d.ts +21 -18
- package/dist/components/choice-card.js +45 -45
- package/dist/components/choice-card.js.map +1 -1
- package/dist/components/column-mapper-labels.d.ts +5 -0
- package/dist/components/column-mapper-labels.js +34 -0
- package/dist/components/column-mapper-labels.js.map +1 -0
- package/dist/components/column-mapper.d.ts +15 -17
- package/dist/components/column-mapper.js +11 -37
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox-core.d.ts +79 -40
- package/dist/components/combobox-core.js +189 -122
- package/dist/components/combobox-core.js.map +1 -1
- package/dist/components/combobox-suggestions.d.ts +76 -0
- package/dist/components/combobox-suggestions.js +56 -0
- package/dist/components/combobox-suggestions.js.map +1 -0
- package/dist/components/combobox.d.ts +14 -159
- package/dist/components/combobox.js +40 -507
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/confirm-dialog-labels.d.ts +7 -0
- package/dist/components/confirm-dialog-labels.js +10 -0
- package/dist/components/confirm-dialog-labels.js.map +1 -0
- package/dist/components/confirm-dialog.d.ts +165 -100
- package/dist/components/confirm-dialog.js +2 -6
- package/dist/components/confirm-dialog.js.map +1 -1
- package/dist/components/copy-button-labels.d.ts +2 -0
- package/dist/components/copy-button-labels.js +12 -0
- package/dist/components/copy-button-labels.js.map +1 -0
- package/dist/components/copy-button.d.ts +70 -100
- package/dist/components/copy-button.js +4 -9
- package/dist/components/copy-button.js.map +1 -1
- package/dist/components/country-select-labels.d.ts +2 -0
- package/dist/components/country-select-labels.js +10 -0
- package/dist/components/country-select-labels.js.map +1 -0
- package/dist/components/country-select.d.ts +18 -15
- package/dist/components/country-select.js +49 -64
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-option-list.d.ts +63 -0
- package/dist/components/currency-option-list.js +135 -0
- package/dist/components/currency-option-list.js.map +1 -0
- package/dist/components/currency-select.d.ts +10 -30
- package/dist/components/currency-select.js +50 -133
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/danger-confirm-labels.d.ts +14 -0
- package/dist/components/danger-confirm-labels.js +17 -0
- package/dist/components/danger-confirm-labels.js.map +1 -0
- package/dist/components/danger-confirm.d.ts +448 -100
- package/dist/components/danger-confirm.js +40 -46
- package/dist/components/danger-confirm.js.map +1 -1
- package/dist/components/data-table-cells.d.ts +9 -24
- package/dist/components/data-table-cells.js +1 -1
- package/dist/components/data-table-cells.js.map +1 -1
- package/dist/components/data-table-column-settings.d.ts +16 -0
- package/dist/components/data-table-column-settings.js +119 -0
- package/dist/components/data-table-column-settings.js.map +1 -0
- package/dist/components/data-table-filter-popover.d.ts +5 -19
- package/dist/components/data-table-filter-popover.js +39 -22
- package/dist/components/data-table-filter-popover.js.map +1 -1
- package/dist/components/data-table-filters.d.ts +93 -15
- package/dist/components/data-table-filters.js +22 -7
- package/dist/components/data-table-filters.js.map +1 -1
- package/dist/components/data-table-head.d.ts +36 -0
- package/dist/components/data-table-head.js +190 -0
- package/dist/components/data-table-head.js.map +1 -0
- package/dist/components/data-table-labels.d.ts +124 -15
- package/dist/components/data-table-labels.js +9 -5
- package/dist/components/data-table-labels.js.map +1 -1
- package/dist/components/data-table-mobile.d.ts +106 -0
- package/dist/components/data-table-mobile.js +412 -0
- package/dist/components/data-table-mobile.js.map +1 -0
- package/dist/components/data-table-pagination.d.ts +6 -21
- package/dist/components/data-table-pagination.js +7 -7
- package/dist/components/data-table-pagination.js.map +1 -1
- package/dist/components/data-table-resize.d.ts +37 -0
- package/dist/components/data-table-resize.js +103 -0
- package/dist/components/data-table-resize.js.map +1 -0
- package/dist/components/data-table-row-actions.d.ts +24 -0
- package/dist/components/data-table-row-actions.js +95 -0
- package/dist/components/data-table-row-actions.js.map +1 -0
- package/dist/components/data-table-selection.d.ts +21 -0
- package/dist/components/data-table-selection.js +30 -0
- package/dist/components/data-table-selection.js.map +1 -0
- package/dist/components/data-table-shared.d.ts +77 -0
- package/dist/components/data-table-shared.js +77 -0
- package/dist/components/data-table-shared.js.map +1 -0
- package/dist/components/data-table-sort.d.ts +8 -10
- package/dist/components/data-table.d.ts +603 -15
- package/dist/components/data-table.js +134 -927
- package/dist/components/data-table.js.map +1 -1
- package/dist/components/date-field.d.ts +203 -0
- package/dist/components/date-field.js +270 -0
- package/dist/components/date-field.js.map +1 -0
- package/dist/components/date-picker.d.ts +6 -261
- package/dist/components/date-picker.js +24 -760
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.d.ts +125 -0
- package/dist/components/date-range-picker.js +261 -0
- package/dist/components/date-range-picker.js.map +1 -0
- package/dist/components/description-list-labels.d.ts +2 -0
- package/dist/components/description-list-labels.js +8 -0
- package/dist/components/description-list-labels.js.map +1 -0
- package/dist/components/description-list.d.ts +13 -15
- package/dist/components/description-list.js +17 -11
- package/dist/components/description-list.js.map +1 -1
- package/dist/components/dialog-frame-labels.d.ts +2 -0
- package/dist/components/dialog-frame-labels.js +6 -0
- package/dist/components/dialog-frame-labels.js.map +1 -0
- package/dist/components/dialog-frame.d.ts +7 -11
- package/dist/components/dialog-frame.js +6 -6
- package/dist/components/dialog-frame.js.map +1 -1
- package/dist/components/disclosure.d.ts +6 -10
- package/dist/components/disclosure.js +11 -11
- package/dist/components/disclosure.js.map +1 -1
- package/dist/components/dropdown.d.ts +55 -27
- package/dist/components/dropdown.js +62 -31
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/empty-state.d.ts +64 -0
- package/dist/components/empty-state.js +70 -0
- package/dist/components/empty-state.js.map +1 -0
- package/dist/components/entity-combobox.d.ts +10 -11
- package/dist/components/entity-combobox.js +14 -13
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/error-boundary-labels.d.ts +2 -0
- package/dist/components/error-boundary-labels.js +19 -0
- package/dist/components/error-boundary-labels.js.map +1 -0
- package/dist/components/error-boundary.d.ts +17 -17
- package/dist/components/error-boundary.js +5 -17
- package/dist/components/error-boundary.js.map +1 -1
- package/dist/components/facing-pair.d.ts +7 -115
- package/dist/components/facing-pair.js +1 -1
- package/dist/components/facing-pair.js.map +1 -1
- package/dist/components/field-base.d.ts +260 -0
- package/dist/components/field-base.js +228 -0
- package/dist/components/field-base.js.map +1 -0
- package/dist/components/field-parts.d.ts +188 -87
- package/dist/components/field-parts.js +60 -33
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-strip.d.ts +19 -28
- package/dist/components/field-strip.js +2 -2
- package/dist/components/field-strip.js.map +1 -1
- package/dist/components/field-sync-labels.d.ts +2 -0
- package/dist/components/field-sync-labels.js +12 -0
- package/dist/components/field-sync-labels.js.map +1 -0
- package/dist/components/field-sync.d.ts +20 -19
- package/dist/components/field-sync.js +4 -10
- package/dist/components/field-sync.js.map +1 -1
- package/dist/components/field.d.ts +45 -10
- package/dist/components/field.js +10 -8
- package/dist/components/field.js.map +1 -1
- package/dist/components/file-button.d.ts +85 -100
- package/dist/components/file-button.js +23 -169
- package/dist/components/file-button.js.map +1 -1
- package/dist/components/file-dropzone.d.ts +9 -109
- package/dist/components/file-dropzone.js +22 -22
- package/dist/components/file-dropzone.js.map +1 -1
- package/dist/components/floating-panel-labels.d.ts +2 -0
- package/dist/components/floating-panel-labels.js +9 -0
- package/dist/components/floating-panel-labels.js.map +1 -0
- package/dist/components/floating-panel.d.ts +17 -21
- package/dist/components/floating-panel.js +19 -18
- package/dist/components/floating-panel.js.map +1 -1
- package/dist/components/focus-ring.d.ts +9 -6
- package/dist/components/focus-ring.js +2 -2
- package/dist/components/focus-ring.js.map +1 -1
- package/dist/components/form-actions-labels.d.ts +2 -0
- package/dist/components/form-actions-labels.js +10 -0
- package/dist/components/form-actions-labels.js.map +1 -0
- package/dist/components/form-actions.d.ts +280 -100
- package/dist/components/form-actions.js +10 -20
- package/dist/components/form-actions.js.map +1 -1
- package/dist/components/full-bleed-dialog.d.ts +7 -8
- package/dist/components/full-bleed-dialog.js +14 -13
- package/dist/components/full-bleed-dialog.js.map +1 -1
- package/dist/components/grouped-picker.d.ts +21 -16
- package/dist/components/grouped-picker.js +76 -62
- package/dist/components/grouped-picker.js.map +1 -1
- package/dist/components/help-popover.d.ts +60 -0
- package/dist/components/help-popover.js +48 -0
- package/dist/components/help-popover.js.map +1 -0
- package/dist/components/hover-menu.d.ts +17 -16
- package/dist/components/hover-menu.js +18 -17
- package/dist/components/hover-menu.js.map +1 -1
- package/dist/components/iban-input-labels.d.ts +2 -0
- package/dist/components/iban-input-labels.js +13 -0
- package/dist/components/iban-input-labels.js.map +1 -0
- package/dist/components/iban-input.d.ts +73 -100
- package/dist/components/iban-input.js +22 -15
- package/dist/components/iban-input.js.map +1 -1
- package/dist/components/icon-button.d.ts +300 -0
- package/dist/components/icon-button.js +465 -0
- package/dist/components/icon-button.js.map +1 -0
- package/dist/components/icon-picker-labels.d.ts +2 -0
- package/dist/components/icon-picker-labels.js +12 -0
- package/dist/components/icon-picker-labels.js.map +1 -0
- package/dist/components/icon-picker.d.ts +13 -13
- package/dist/components/icon-picker.js +18 -17
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/image-grid-labels.d.ts +2 -0
- package/dist/components/image-grid-labels.js +10 -0
- package/dist/components/image-grid-labels.js.map +1 -0
- package/dist/components/image-grid.d.ts +12 -14
- package/dist/components/image-grid.js +6 -10
- package/dist/components/image-grid.js.map +1 -1
- package/dist/components/inline-edit-field-labels.d.ts +2 -0
- package/dist/components/inline-edit-field-labels.js +10 -0
- package/dist/components/inline-edit-field-labels.js.map +1 -0
- package/dist/components/inline-edit-field.d.ts +11 -13
- package/dist/components/inline-edit-field.js +11 -13
- package/dist/components/inline-edit-field.js.map +1 -1
- package/dist/components/inline-entity-combobox.d.ts +155 -0
- package/dist/components/inline-entity-combobox.js +467 -0
- package/dist/components/inline-entity-combobox.js.map +1 -0
- package/dist/components/input.d.ts +98 -0
- package/dist/components/input.js +219 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/jump-calendar.d.ts +8 -0
- package/dist/components/jump-calendar.js +274 -0
- package/dist/components/jump-calendar.js.map +1 -0
- package/dist/components/language-select.d.ts +20 -110
- package/dist/components/language-select.js +12 -7
- package/dist/components/language-select.js.map +1 -1
- package/dist/components/legal-labels.d.ts +2 -0
- package/dist/components/legal-labels.js +100 -0
- package/dist/components/legal-labels.js.map +1 -0
- package/dist/components/legal-page.d.ts +17 -117
- package/dist/components/legal-page.js +2 -2
- package/dist/components/legal-page.js.map +1 -1
- package/dist/components/legal.d.ts +353 -100
- package/dist/components/legal.js +7 -101
- package/dist/components/legal.js.map +1 -1
- package/dist/components/lightbox-labels.d.ts +2 -0
- package/dist/components/lightbox-labels.js +17 -0
- package/dist/components/lightbox-labels.js.map +1 -0
- package/dist/components/lightbox.d.ts +12 -14
- package/dist/components/lightbox.js +9 -19
- package/dist/components/lightbox.js.map +1 -1
- package/dist/components/line-items-labels.d.ts +2 -0
- package/dist/components/line-items-labels.js +13 -0
- package/dist/components/line-items-labels.js.map +1 -0
- package/dist/components/line-items.d.ts +16 -18
- package/dist/components/line-items.js +18 -26
- package/dist/components/line-items.js.map +1 -1
- package/dist/components/list-labels.d.ts +2 -0
- package/dist/components/list-labels.js +9 -0
- package/dist/components/list-labels.js.map +1 -0
- package/dist/components/list.d.ts +32 -21
- package/dist/components/list.js +41 -25
- package/dist/components/list.js.map +1 -1
- package/dist/components/loading-state.d.ts +5 -9
- package/dist/components/loading-state.js +2 -2
- package/dist/components/loading-state.js.map +1 -1
- package/dist/components/measured-grid-labels.d.ts +4 -0
- package/dist/components/measured-grid-labels.js +21 -0
- package/dist/components/measured-grid-labels.js.map +1 -0
- package/dist/components/measured-grid.d.ts +13 -17
- package/dist/components/measured-grid.js +31 -50
- package/dist/components/measured-grid.js.map +1 -1
- package/dist/components/menu-item.d.ts +10 -10
- package/dist/components/menu-item.js +9 -9
- package/dist/components/menu-item.js.map +1 -1
- package/dist/components/mini-calendar-labels.d.ts +4 -0
- package/dist/components/mini-calendar-labels.js +14 -0
- package/dist/components/mini-calendar-labels.js.map +1 -0
- package/dist/components/mini-calendar.d.ts +10 -14
- package/dist/components/mini-calendar.js +22 -29
- package/dist/components/mini-calendar.js.map +1 -1
- package/dist/components/modal.d.ts +26 -18
- package/dist/components/modal.js +8 -11
- package/dist/components/modal.js.map +1 -1
- package/dist/components/money-draft.d.ts +34 -0
- package/dist/components/money-draft.js +39 -0
- package/dist/components/money-draft.js.map +1 -0
- package/dist/components/money-field.d.ts +13 -110
- package/dist/components/money-field.js +6 -22
- package/dist/components/money-field.js.map +1 -1
- package/dist/components/month-picker-labels.d.ts +5 -0
- package/dist/components/month-picker-labels.js +18 -0
- package/dist/components/month-picker-labels.js.map +1 -0
- package/dist/components/month-picker.d.ts +15 -13
- package/dist/components/month-picker.js +34 -32
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +9 -11
- package/dist/components/multi-entity-combobox.js +14 -13
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +81 -21
- package/dist/components/multi-select.js +171 -197
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/nav-pills.d.ts +9 -10
- package/dist/components/nav-pills.js +53 -42
- package/dist/components/nav-pills.js.map +1 -1
- package/dist/components/number-field.d.ts +13 -110
- package/dist/components/number-field.js +2 -3
- package/dist/components/number-field.js.map +1 -1
- package/dist/components/number-input.d.ts +55 -109
- package/dist/components/number-input.js +50 -67
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numeric-field.d.ts +85 -0
- package/dist/components/numeric-field.js +71 -0
- package/dist/components/numeric-field.js.map +1 -0
- package/dist/components/numpad-sheet.d.ts +5 -107
- package/dist/components/numpad-sheet.js +7 -7
- package/dist/components/numpad-sheet.js.map +1 -1
- package/dist/components/one-time-code-input.d.ts +6 -7
- package/dist/components/one-time-code-input.js +119 -124
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/page-contents-labels.d.ts +2 -0
- package/dist/components/page-contents-labels.js +8 -0
- package/dist/components/page-contents-labels.js.map +1 -0
- package/dist/components/page-contents.d.ts +13 -15
- package/dist/components/page-contents.js +7 -9
- package/dist/components/page-contents.js.map +1 -1
- package/dist/components/page-header.d.ts +10 -10
- package/dist/components/page-header.js +3 -3
- package/dist/components/page-header.js.map +1 -1
- package/dist/components/password-strength-labels.d.ts +2 -0
- package/dist/components/password-strength-labels.js +21 -0
- package/dist/components/password-strength-labels.js.map +1 -0
- package/dist/components/password-strength.d.ts +15 -17
- package/dist/components/password-strength.js +7 -22
- package/dist/components/password-strength.js.map +1 -1
- package/dist/components/phone-input-labels.d.ts +2 -0
- package/dist/components/phone-input-labels.js +9 -0
- package/dist/components/phone-input-labels.js.map +1 -0
- package/dist/components/phone-input.d.ts +75 -100
- package/dist/components/phone-input.js +20 -23
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/picker-sheet.d.ts +20 -8
- package/dist/components/picker-sheet.js +22 -11
- package/dist/components/picker-sheet.js.map +1 -1
- package/dist/components/pie-chart-labels.d.ts +2 -4
- package/dist/components/pie-chart.d.ts +8 -11
- package/dist/components/pie-chart.js +5 -5
- package/dist/components/pie-chart.js.map +1 -1
- package/dist/components/popover-labels.d.ts +2 -0
- package/dist/components/popover-labels.js +11 -0
- package/dist/components/popover-labels.js.map +1 -0
- package/dist/components/popover.d.ts +13 -11
- package/dist/components/popover.js +21 -23
- package/dist/components/popover.js.map +1 -1
- package/dist/components/progress-bar-labels.d.ts +2 -0
- package/dist/components/progress-bar-labels.js +9 -0
- package/dist/components/progress-bar-labels.js.map +1 -0
- package/dist/components/progress-bar.d.ts +16 -15
- package/dist/components/progress-bar.js +22 -20
- package/dist/components/progress-bar.js.map +1 -1
- package/dist/components/qr-code.d.ts +4 -8
- package/dist/components/qr-code.js.map +1 -1
- package/dist/components/reauth-dialog-labels.d.ts +2 -0
- package/dist/components/reauth-dialog-labels.js +12 -0
- package/dist/components/reauth-dialog-labels.js.map +1 -0
- package/dist/components/reauth-dialog.d.ts +8 -10
- package/dist/components/reauth-dialog.js +3 -8
- package/dist/components/reauth-dialog.js.map +1 -1
- package/dist/components/row-actions-labels.d.ts +2 -0
- package/dist/components/row-actions-labels.js +9 -0
- package/dist/components/row-actions-labels.js.map +1 -0
- package/dist/components/row-actions.d.ts +224 -100
- package/dist/components/row-actions.js +4 -5
- package/dist/components/row-actions.js.map +1 -1
- package/dist/components/scroll-area.d.ts +6 -9
- package/dist/components/scroll-area.js +4 -10
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/search-field.d.ts +12 -27
- package/dist/components/search-field.js +13 -16
- package/dist/components/search-field.js.map +1 -1
- package/dist/components/select.d.ts +69 -0
- package/dist/components/select.js +164 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/separator.d.ts +3 -7
- package/dist/components/separator.js.map +1 -1
- package/dist/components/series-chart-axes.d.ts +120 -0
- package/dist/components/series-chart-axes.js +164 -0
- package/dist/components/series-chart-axes.js.map +1 -0
- package/dist/components/series-chart-budget.d.ts +8 -9
- package/dist/components/series-chart-labels.d.ts +2 -4
- package/dist/components/series-chart-thin.d.ts +34 -0
- package/dist/components/series-chart-thin.js +103 -0
- package/dist/components/series-chart-thin.js.map +1 -0
- package/dist/components/series-chart-ticks.d.ts +9 -11
- package/dist/components/series-chart.d.ts +64 -213
- package/dist/components/series-chart.js +69 -160
- package/dist/components/series-chart.js.map +1 -1
- package/dist/components/server-wake-labels.d.ts +2 -0
- package/dist/components/server-wake-labels.js +9 -0
- package/dist/components/server-wake-labels.js.map +1 -0
- package/dist/components/server-wake.d.ts +32 -23
- package/dist/components/server-wake.js +15 -35
- package/dist/components/server-wake.js.map +1 -1
- package/dist/components/settings-fields.d.ts +46 -117
- package/dist/components/settings-fields.js +13 -3
- package/dist/components/settings-fields.js.map +1 -1
- package/dist/components/share-card-labels.d.ts +2 -0
- package/dist/components/share-card-labels.js +29 -0
- package/dist/components/share-card-labels.js.map +1 -0
- package/dist/components/share-card.d.ts +188 -100
- package/dist/components/share-card.js +16 -34
- package/dist/components/share-card.js.map +1 -1
- package/dist/components/sign-chip-labels.d.ts +2 -0
- package/dist/components/sign-chip-labels.js +11 -0
- package/dist/components/sign-chip-labels.js.map +1 -0
- package/dist/components/sign-chip.d.ts +7 -9
- package/dist/components/sign-chip.js +2 -7
- package/dist/components/sign-chip.js.map +1 -1
- package/dist/components/signature-pad-labels.d.ts +2 -0
- package/dist/components/signature-pad-labels.js +23 -0
- package/dist/components/signature-pad-labels.js.map +1 -0
- package/dist/components/signature-pad.d.ts +16 -15
- package/dist/components/signature-pad.js +22 -35
- package/dist/components/signature-pad.js.map +1 -1
- package/dist/components/signed-amount-labels.d.ts +2 -0
- package/dist/components/signed-amount-labels.js +9 -0
- package/dist/components/signed-amount-labels.js.map +1 -0
- package/dist/components/signed-amount.d.ts +19 -21
- package/dist/components/signed-amount.js +12 -15
- package/dist/components/signed-amount.js.map +1 -1
- package/dist/components/skeleton.d.ts +13 -9
- package/dist/components/skeleton.js +1 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/slider.d.ts +16 -11
- package/dist/components/slider.js +23 -18
- package/dist/components/slider.js.map +1 -1
- package/dist/components/sparkline-labels.d.ts +2 -0
- package/dist/components/sparkline-labels.js +13 -0
- package/dist/components/sparkline-labels.js.map +1 -0
- package/dist/components/sparkline.d.ts +10 -12
- package/dist/components/sparkline.js +10 -17
- package/dist/components/sparkline.js.map +1 -1
- package/dist/components/spinner.d.ts +45 -0
- package/dist/components/spinner.js +39 -0
- package/dist/components/spinner.js.map +1 -0
- package/dist/components/stat-tile-labels.d.ts +2 -0
- package/dist/components/stat-tile-labels.js +14 -0
- package/dist/components/stat-tile-labels.js.map +1 -0
- package/dist/components/stat-tile.d.ts +15 -17
- package/dist/components/stat-tile.js +25 -32
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/status-dot.d.ts +8 -20
- package/dist/components/status-dot.js +13 -12
- package/dist/components/status-dot.js.map +1 -1
- package/dist/components/swatch-picker-labels.d.ts +2 -0
- package/dist/components/swatch-picker-labels.js +9 -0
- package/dist/components/swatch-picker-labels.js.map +1 -0
- package/dist/components/swatch-picker.d.ts +14 -14
- package/dist/components/swatch-picker.js +14 -8
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/swipeable-row.d.ts +14 -27
- package/dist/components/swipeable-row.js +2 -2
- package/dist/components/swipeable-row.js.map +1 -1
- package/dist/components/switch.d.ts +10 -13
- package/dist/components/switch.js +13 -12
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.d.ts +28 -31
- package/dist/components/table.js +15 -15
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.d.ts +182 -0
- package/dist/components/tabs.js +312 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/text-link.d.ts +17 -118
- package/dist/components/text-link.js +7 -7
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/text.d.ts +14 -13
- package/dist/components/text.js +5 -5
- package/dist/components/text.js.map +1 -1
- package/dist/components/textarea.d.ts +20 -0
- package/dist/components/textarea.js +161 -0
- package/dist/components/textarea.js.map +1 -0
- package/dist/components/tile-radio.d.ts +6 -10
- package/dist/components/tile-radio.js +6 -6
- package/dist/components/tile-radio.js.map +1 -1
- package/dist/components/time-input.d.ts +5 -107
- package/dist/components/time-input.js +14 -5
- package/dist/components/time-input.js.map +1 -1
- package/dist/components/toast-labels.d.ts +2 -0
- package/dist/components/toast-labels.js +11 -0
- package/dist/components/toast-labels.js.map +1 -0
- package/dist/components/toast.d.ts +21 -23
- package/dist/components/toast.js +1 -6
- package/dist/components/toast.js.map +1 -1
- package/dist/components/toggle-group.d.ts +26 -26
- package/dist/components/toggle-group.js +43 -19
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/components/toggle-legend.d.ts +18 -21
- package/dist/components/toggle-legend.js +3 -3
- package/dist/components/toggle-legend.js.map +1 -1
- package/dist/components/tooltip.d.ts +16 -15
- package/dist/components/tooltip.js +4 -9
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/translation-review-editor.d.ts +8 -10
- package/dist/components/translation-review-editor.js +6 -5
- package/dist/components/translation-review-editor.js.map +1 -1
- package/dist/components/translation-review-labels.d.ts +4 -7
- package/dist/components/translation-review-parts.d.ts +19 -28
- package/dist/components/translation-review-parts.js +4 -7
- package/dist/components/translation-review-parts.js.map +1 -1
- package/dist/components/translation-review.d.ts +26 -24
- package/dist/components/translation-review.js +13 -10
- package/dist/components/translation-review.js.map +1 -1
- package/dist/components/tree-view.d.ts +7 -11
- package/dist/components/tree-view.js +8 -8
- package/dist/components/tree-view.js.map +1 -1
- package/dist/components/treemap.d.ts +9 -13
- package/dist/components/trigger-aria.d.ts +2 -4
- package/dist/components/ui-labels.d.ts +5 -0
- package/dist/components/ui-labels.js +20 -0
- package/dist/components/ui-labels.js.map +1 -0
- package/dist/components/use-anchor-dir.d.ts +3 -6
- package/dist/components/use-mobile-reveal.d.ts +2 -6
- package/dist/components/use-table-state.d.ts +154 -15
- package/dist/components/user-avatar.d.ts +8 -21
- package/dist/components/user-avatar.js +1 -1
- package/dist/components/user-avatar.js.map +1 -1
- package/dist/components/wizard-stepper.d.ts +6 -6
- package/dist/components/wizard-stepper.js +4 -3
- package/dist/components/wizard-stepper.js.map +1 -1
- package/dist/components/write-lock-labels.d.ts +2 -0
- package/dist/components/write-lock-labels.js +8 -0
- package/dist/components/write-lock-labels.js.map +1 -0
- package/dist/components/write-lock.d.ts +16 -18
- package/dist/components/write-lock.js +4 -8
- package/dist/components/write-lock.js.map +1 -1
- package/dist/data-table.d.ts +10 -18
- package/dist/data-table.js.map +1 -1
- package/dist/demo/demo-banner.d.ts +10 -13
- package/dist/demo/demo-banner.js +5 -19
- package/dist/demo/demo-banner.js.map +1 -1
- package/dist/demo/demo-countdown.d.ts +7 -9
- package/dist/demo/demo-ended.d.ts +10 -13
- package/dist/demo/demo-ended.js +4 -4
- package/dist/demo/demo-ended.js.map +1 -1
- package/dist/demo/demo-labels.d.ts +4 -5
- package/dist/demo/demo-labels.js.map +1 -1
- package/dist/demo/demo-session.d.ts +3 -5
- package/dist/demo/demo-start.d.ts +8 -11
- package/dist/demo/demo-start.js +3 -2
- package/dist/demo/demo-start.js.map +1 -1
- package/dist/feedback/feedback-attachment-labels.d.ts +16 -0
- package/dist/feedback/feedback-attachment-labels.js +17 -0
- package/dist/feedback/feedback-attachment-labels.js.map +1 -0
- package/dist/feedback/feedback-attachment.d.ts +312 -100
- package/dist/feedback/feedback-attachment.js +31 -42
- package/dist/feedback/feedback-attachment.js.map +1 -1
- package/dist/feedback/feedback-capture.d.ts +2 -4
- package/dist/feedback/feedback-context-labels.d.ts +2 -0
- package/dist/feedback/feedback-context-labels.js +9 -0
- package/dist/feedback/feedback-context-labels.js.map +1 -0
- package/dist/feedback/feedback-context.d.ts +110 -100
- package/dist/feedback/feedback-context.js +4 -7
- package/dist/feedback/feedback-context.js.map +1 -1
- package/dist/feedback/feedback-crash.d.ts +8 -109
- package/dist/feedback/feedback-dialog-labels.d.ts +12 -0
- package/dist/feedback/feedback-dialog-labels.js +17 -0
- package/dist/feedback/feedback-dialog-labels.js.map +1 -0
- package/dist/feedback/feedback-dialog.d.ts +186 -100
- package/dist/feedback/feedback-dialog.js +8 -18
- package/dist/feedback/feedback-dialog.js.map +1 -1
- package/dist/feedback/feedback-inbox.d.ts +236 -100
- package/dist/feedback/feedback-inbox.js +31 -141
- package/dist/feedback/feedback-inbox.js.map +1 -1
- package/dist/feedback/feedback-labels.d.ts +83 -100
- package/dist/feedback/feedback-labels.js.map +1 -1
- package/dist/feedback/feedback-menu-labels.d.ts +2 -0
- package/dist/feedback/feedback-menu-labels.js +10 -0
- package/dist/feedback/feedback-menu-labels.js.map +1 -0
- package/dist/feedback/feedback-menu.d.ts +83 -100
- package/dist/feedback/feedback-menu.js +3 -7
- package/dist/feedback/feedback-menu.js.map +1 -1
- package/dist/feedback/feedback-record.d.ts +239 -100
- package/dist/feedback/feedback-record.js +7 -2
- package/dist/feedback/feedback-record.js.map +1 -1
- package/dist/feedback/feedback-row-detail-labels.d.ts +2 -0
- package/dist/feedback/feedback-row-detail-labels.js +31 -0
- package/dist/feedback/feedback-row-detail-labels.js.map +1 -0
- package/dist/feedback/feedback-row-detail.d.ts +315 -100
- package/dist/feedback/feedback-row-detail.js +11 -37
- package/dist/feedback/feedback-row-detail.js.map +1 -1
- package/dist/feedback/feedback-status-undo.d.ts +66 -100
- package/dist/feedback/feedback-status-undo.js.map +1 -1
- package/dist/feedback/feedback-submit-dialog.d.ts +39 -0
- package/dist/feedback/feedback-submit-dialog.js +66 -0
- package/dist/feedback/feedback-submit-dialog.js.map +1 -0
- package/dist/feedback/feedback-submit.d.ts +13 -108
- package/dist/feedback/feedback-submit.js +19 -40
- package/dist/feedback/feedback-submit.js.map +1 -1
- package/dist/feedback/feedback-swipe.d.ts +9 -109
- package/dist/feedback/feedback-swipe.js +1 -1
- package/dist/feedback/feedback-swipe.js.map +1 -1
- package/dist/feedback/feedback-table-labels.d.ts +2 -0
- package/dist/feedback/feedback-table-labels.js +26 -0
- package/dist/feedback/feedback-table-labels.js.map +1 -0
- package/dist/feedback/feedback-table.d.ts +314 -100
- package/dist/feedback/feedback-table.js +11 -31
- package/dist/feedback/feedback-table.js.map +1 -1
- package/dist/feedback/feedback-thread-labels.d.ts +3 -0
- package/dist/feedback/feedback-thread-labels.js +21 -0
- package/dist/feedback/feedback-thread-labels.js.map +1 -0
- package/dist/feedback/feedback-thread.d.ts +378 -100
- package/dist/feedback/feedback-thread.js +32 -35
- package/dist/feedback/feedback-thread.js.map +1 -1
- package/dist/feedback/feedback-vocabulary.d.ts +98 -0
- package/dist/feedback/feedback-vocabulary.js +143 -0
- package/dist/feedback/feedback-vocabulary.js.map +1 -0
- package/dist/feedback.d.ts +15 -104
- package/dist/hooks/use-anchored-panel.d.ts +109 -17
- package/dist/hooks/use-anchored-panel.js +38 -6
- package/dist/hooks/use-anchored-panel.js.map +1 -1
- package/dist/hooks/use-anchored-rect.d.ts +15 -6
- package/dist/hooks/use-anchored-rect.js +2 -1
- package/dist/hooks/use-anchored-rect.js.map +1 -1
- package/dist/hooks/use-announce.d.ts +4 -6
- package/dist/hooks/use-authed-src.d.ts +5 -7
- package/dist/hooks/use-authed-src.js +3 -7
- package/dist/hooks/use-authed-src.js.map +1 -1
- package/dist/hooks/use-body-scroll-lock.d.ts +1 -3
- package/dist/hooks/use-breakpoint.d.ts +16 -17
- package/dist/hooks/use-breakpoint.js.map +1 -1
- package/dist/hooks/use-close-transition.d.ts +8 -8
- package/dist/hooks/use-close-transition.js +5 -4
- package/dist/hooks/use-close-transition.js.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +5 -7
- package/dist/hooks/use-debounce.d.ts +13 -6
- package/dist/hooks/use-debounce.js.map +1 -1
- package/dist/hooks/use-dismiss.d.ts +37 -11
- package/dist/hooks/use-dismiss.js +69 -10
- package/dist/hooks/use-dismiss.js.map +1 -1
- package/dist/hooks/use-file-drop.d.ts +8 -109
- package/dist/hooks/use-file-drop.js +1 -1
- package/dist/hooks/use-file-drop.js.map +1 -1
- package/dist/hooks/use-file-picker-labels.d.ts +2 -0
- package/dist/hooks/use-file-picker-labels.js +25 -0
- package/dist/hooks/use-file-picker-labels.js.map +1 -0
- package/dist/hooks/use-file-picker.d.ts +164 -0
- package/dist/hooks/use-file-picker.js +149 -0
- package/dist/hooks/use-file-picker.js.map +1 -0
- package/dist/hooks/use-focus-trap.d.ts +10 -4
- package/dist/hooks/use-focus-trap.js +19 -12
- package/dist/hooks/use-focus-trap.js.map +1 -1
- package/dist/hooks/use-hotkey.d.ts +7 -9
- package/dist/hooks/use-large-text.d.ts +3 -5
- package/dist/hooks/use-media-query.d.ts +1 -3
- package/dist/hooks/use-noindex.d.ts +1 -3
- package/dist/hooks/use-overlay-history.d.ts +1 -3
- package/dist/hooks/use-row-swipe.d.ts +5 -8
- package/dist/hooks/use-search-param-state.d.ts +10 -11
- package/dist/hooks/use-windowed-rows.d.ts +4 -7
- package/dist/i18n/defaults.d.ts +11 -104
- package/dist/i18n/defaults.js +82 -82
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.d.ts +2 -104
- package/dist/i18n/german.js +56 -9
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +609 -100
- package/dist/i18n/kit-labels.js +22 -97
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/languages.d.ts +197 -100
- package/dist/i18n/locales/de-CH.d.ts +3 -105
- package/dist/i18n/locales/en.d.ts +4 -104
- package/dist/i18n/locales/en.js +1834 -4
- package/dist/i18n/locales/en.js.map +7 -1
- package/dist/i18n/locales/es.d.ts +3 -105
- package/dist/i18n/locales/es.js +54 -9
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.d.ts +3 -105
- package/dist/i18n/locales/fr.js +56 -9
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.d.ts +3 -105
- package/dist/i18n/locales/hu.js +56 -10
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.d.ts +3 -105
- package/dist/i18n/locales/it.js +55 -9
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.d.ts +3 -105
- package/dist/i18n/locales/zh.js +52 -8
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/plurals.d.ts +20 -3
- package/dist/i18n/plurals.js +11 -0
- package/dist/i18n/plurals.js.map +1 -1
- package/dist/i18n/review.d.ts +5 -106
- package/dist/i18n/review.js +4 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.d.ts +17 -0
- package/dist/i18n/shared-labels.js +111 -0
- package/dist/i18n/shared-labels.js.map +1 -0
- package/dist/i18n/swiss.d.ts +1 -3
- package/dist/index.d.ts +329 -249
- package/dist/index.js +188 -215
- package/dist/index.js.map +1 -1
- package/dist/landing/access.d.ts +7 -9
- package/dist/landing/access.js.map +1 -1
- package/dist/landing/landing-actions.d.ts +9 -108
- package/dist/landing/landing-actions.js +1 -1
- package/dist/landing/landing-actions.js.map +1 -1
- package/dist/landing/landing-labels.d.ts +4 -5
- package/dist/landing/landing-labels.js.map +1 -1
- package/dist/landing/landing-sections.d.ts +21 -120
- package/dist/landing/landing-sections.js +15 -15
- package/dist/landing/landing-sections.js.map +1 -1
- package/dist/landing/page-seo.d.ts +7 -9
- package/dist/landing/public-header.d.ts +10 -110
- package/dist/landing/public-header.js +1 -1
- package/dist/landing/public-header.js.map +1 -1
- package/dist/landing/routing.d.ts +16 -119
- package/dist/landing/routing.js +2 -6
- package/dist/landing/routing.js.map +1 -1
- package/dist/lib/calc.d.ts +7 -9
- package/dist/lib/chip-edge-snap.d.ts +10 -0
- package/dist/lib/chip-edge-snap.js +131 -0
- package/dist/lib/chip-edge-snap.js.map +1 -0
- package/dist/lib/clipping.d.ts +2 -4
- package/dist/lib/cn.d.ts +2 -5
- package/dist/lib/cn.js +6 -1
- package/dist/lib/cn.js.map +1 -1
- package/dist/lib/column-mapping.d.ts +10 -13
- package/dist/lib/countries.d.ts +3 -5
- package/dist/lib/dates.d.ts +25 -25
- package/dist/lib/dates.js.map +1 -1
- package/dist/lib/decimal-marks.d.ts +8 -8
- package/dist/lib/decimal-marks.js +1 -1
- package/dist/lib/decimal-marks.js.map +1 -1
- package/dist/lib/direction.d.ts +4 -6
- package/dist/lib/document-navigation.d.ts +1 -3
- package/dist/lib/download.d.ts +67 -0
- package/dist/lib/download.js +89 -0
- package/dist/lib/download.js.map +1 -0
- package/dist/lib/floating-stack.d.ts +8 -6
- package/dist/lib/floating-stack.js.map +1 -1
- package/dist/lib/format.d.ts +24 -23
- package/dist/lib/format.js +3 -3
- package/dist/lib/format.js.map +1 -1
- package/dist/lib/iban.d.ts +9 -11
- package/dist/lib/ime.d.ts +17 -0
- package/dist/lib/ime.js +13 -0
- package/dist/lib/ime.js.map +1 -0
- package/dist/lib/isin.d.ts +3 -5
- package/dist/lib/logger.d.ts +4 -6
- package/dist/lib/person-name.d.ts +3 -5
- package/dist/lib/phone.d.ts +9 -11
- package/dist/lib/presence.d.ts +15 -0
- package/dist/lib/presence.js +8 -0
- package/dist/lib/presence.js.map +1 -0
- package/dist/lib/qr-encode.d.ts +4 -6
- package/dist/lib/reduced-motion.d.ts +18 -0
- package/dist/lib/reduced-motion.js +9 -0
- package/dist/lib/reduced-motion.js.map +1 -0
- package/dist/lib/round.d.ts +22 -0
- package/dist/lib/round.js +15 -0
- package/dist/lib/round.js.map +1 -0
- package/dist/lib/safe-storage.d.ts +14 -4
- package/dist/lib/safe-storage.js +24 -9
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/lib/server-wake.d.ts +13 -14
- package/dist/lib/session-refresh.d.ts +200 -0
- package/dist/lib/session-refresh.js +187 -0
- package/dist/lib/session-refresh.js.map +1 -0
- package/dist/lib/strip-fade.d.ts +10 -13
- package/dist/lib/table-text.d.ts +14 -16
- package/dist/lib/text-match.d.ts +41 -0
- package/dist/lib/text-match.js +23 -0
- package/dist/lib/text-match.js.map +1 -0
- package/dist/lib/translation-review.d.ts +44 -45
- package/dist/lib/translation-review.js +3 -2
- package/dist/lib/translation-review.js.map +1 -1
- package/dist/rhf/fields.d.ts +123 -188
- package/dist/rhf/fields.js +46 -54
- package/dist/rhf/fields.js.map +1 -1
- package/dist/rhf/form-core.d.ts +153 -0
- package/dist/rhf/form-core.js +143 -0
- package/dist/rhf/form-core.js.map +1 -0
- package/dist/rhf/form.d.ts +38 -174
- package/dist/rhf/form.js +9 -131
- package/dist/rhf/form.js.map +1 -1
- package/dist/rhf/line-items.d.ts +40 -11
- package/dist/rhf/line-items.js.map +1 -1
- package/dist/rhf/use-rhf-wizard-step.d.ts +3 -6
- package/dist/rhf.d.ts +4 -117
- package/dist/rhf.js.map +1 -1
- package/dist/search/command-palette-labels.d.ts +2 -0
- package/dist/search/command-palette-labels.js +15 -0
- package/dist/search/command-palette-labels.js.map +1 -0
- package/dist/search/command-palette.d.ts +10 -13
- package/dist/search/command-palette.js +25 -44
- package/dist/search/command-palette.js.map +1 -1
- package/dist/search/global-search-labels.d.ts +2 -0
- package/dist/search/global-search-labels.js +12 -0
- package/dist/search/global-search-labels.js.map +1 -0
- package/dist/search/global-search.d.ts +17 -16
- package/dist/search/global-search.js +12 -12
- package/dist/search/global-search.js.map +1 -1
- package/dist/search/search-index.d.ts +13 -14
- package/dist/search/search-index.js +2 -1
- package/dist/search/search-index.js.map +1 -1
- package/dist/search/use-command-key.d.ts +9 -0
- package/dist/search/use-command-key.js +18 -0
- package/dist/search/use-command-key.js.map +1 -0
- package/dist/search.d.ts +3 -4
- package/dist/settings/settings-card-classes.d.ts +11 -0
- package/dist/settings/settings-card-classes.js +8 -0
- package/dist/settings/settings-card-classes.js.map +1 -0
- package/dist/settings/settings-catalogue.d.ts +11 -14
- package/dist/settings/settings-context.d.ts +4 -8
- package/dist/settings/settings-heading.d.ts +8 -12
- package/dist/settings/settings-heading.js +1 -1
- package/dist/settings/settings-heading.js.map +1 -1
- package/dist/settings/settings-labels.d.ts +6 -7
- package/dist/settings/settings-labels.js.map +1 -1
- package/dist/settings/settings-layout.d.ts +36 -13
- package/dist/settings/settings-layout.js +25 -4
- package/dist/settings/settings-layout.js.map +1 -1
- package/dist/settings/settings-section.d.ts +4 -106
- package/dist/settings/settings-section.js +2 -2
- package/dist/settings/settings-section.js.map +1 -1
- package/dist/settings/use-account-appearance.d.ts +11 -16
- package/dist/settings/use-account-language.d.ts +8 -10
- package/dist/settings/use-settings-focus.d.ts +3 -5
- package/dist/settings/use-settings-focus.js +2 -4
- package/dist/settings/use-settings-focus.js.map +1 -1
- package/dist/settings/use-settings-route.d.ts +11 -16
- package/dist/shell/app-shell-labels.d.ts +2 -0
- package/dist/shell/app-shell-labels.js +9 -0
- package/dist/shell/app-shell-labels.js.map +1 -0
- package/dist/shell/app-shell.d.ts +216 -100
- package/dist/shell/app-shell.js +51 -35
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/shell/auth-layout.d.ts +6 -9
- package/dist/shell/auth-layout.js +6 -6
- package/dist/shell/auth-layout.js.map +1 -1
- package/dist/shell/company-switcher-labels.d.ts +2 -0
- package/dist/shell/company-switcher-labels.js +12 -0
- package/dist/shell/company-switcher-labels.js.map +1 -0
- package/dist/shell/company-switcher.d.ts +9 -11
- package/dist/shell/company-switcher.js +3 -9
- package/dist/shell/company-switcher.js.map +1 -1
- package/dist/shell/option-switcher-menu.d.ts +19 -9
- package/dist/shell/option-switcher-menu.js +6 -4
- package/dist/shell/option-switcher-menu.js.map +1 -1
- package/dist/shell/role-switcher.d.ts +5 -6
- package/dist/shell/role-switcher.js +4 -3
- package/dist/shell/role-switcher.js.map +1 -1
- package/dist/shell/top-bar-brand.d.ts +4 -106
- package/dist/shell/top-bar-brand.js +1 -1
- package/dist/shell/top-bar-brand.js.map +1 -1
- package/dist/shell/top-bar.d.ts +6 -9
- package/dist/shell/top-bar.js +1 -1
- package/dist/shell/top-bar.js.map +1 -1
- package/dist/shell/topbar-action-menu.d.ts +30 -31
- package/dist/shell/topbar-action-menu.js +12 -10
- package/dist/shell/topbar-action-menu.js.map +1 -1
- package/dist/shell/topbar-controls.d.ts +20 -18
- package/dist/shell/topbar-controls.js +14 -11
- package/dist/shell/topbar-controls.js.map +1 -1
- package/dist/shell.d.ts +25 -115
- package/dist/shell.js.map +1 -1
- package/dist/table-text.d.ts +1 -1
- package/dist/testing/css-variables.d.ts +4 -6
- package/dist/testing/css-variables.generated.d.ts +2 -4
- package/dist/testing/index.d.ts +2 -1
- package/dist/testing/index.js +9 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/viewport.d.ts +93 -0
- package/dist/testing/viewport.js +152 -0
- package/dist/testing/viewport.js.map +1 -0
- package/dist/theme/chart-palette.d.ts +7 -9
- package/dist/theme/color.d.ts +14 -16
- package/dist/theme/color.js +2 -1
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +13 -17
- package/dist/theme/contrast.d.ts +22 -27
- package/dist/theme/palette-derive.d.ts +16 -22
- package/dist/theme/palette-derive.js +15 -7
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +25 -15
- package/dist/theme/palette-presets.js +66 -66
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.d.ts +10 -13
- package/dist/theme/text-size.d.ts +21 -26
- package/dist/theme/theme-store.d.ts +9 -14
- package/dist/tour/tour-labels.d.ts +2 -0
- package/dist/tour/tour-labels.js +13 -0
- package/dist/tour/tour-labels.js.map +1 -0
- package/dist/tour/tour.d.ts +12 -14
- package/dist/tour/tour.js +9 -20
- package/dist/tour/tour.js.map +1 -1
- package/dist/tour.d.ts +1 -2
- package/dist/wizard/stepper-nav.d.ts +8 -107
- package/dist/wizard/stepper-nav.js +15 -14
- package/dist/wizard/stepper-nav.js.map +1 -1
- package/dist/wizard/types.d.ts +18 -18
- package/dist/wizard/types.js +1 -19
- package/dist/wizard/types.js.map +1 -1
- package/dist/wizard/use-wizard.d.ts +2 -6
- package/dist/wizard/validation.d.ts +3 -7
- package/dist/wizard/wizard-context.d.ts +7 -11
- package/dist/wizard/wizard-labels.d.ts +4 -0
- package/dist/wizard/wizard-labels.js +24 -0
- package/dist/wizard/wizard-labels.js.map +1 -0
- package/dist/wizard/wizard-step.d.ts +3 -7
- package/dist/wizard/wizard-step.js +2 -2
- package/dist/wizard/wizard-step.js.map +1 -1
- package/dist/wizard/wizard-summary.d.ts +5 -8
- package/dist/wizard/wizard-summary.js +6 -5
- package/dist/wizard/wizard-summary.js.map +1 -1
- package/dist/wizard.d.ts +7 -106
- package/package.json +9 -6
- package/src/account/account-parts.ts +3 -3
- package/src/{components → account}/account-settings-labels.ts +11 -1
- package/src/{components → account}/account-settings.tsx +145 -34
- package/src/account/data-export-setting-labels.ts +20 -0
- package/src/account/data-export-setting.tsx +19 -38
- package/src/account/delete-account-setting-labels.ts +33 -0
- package/src/account/delete-account-setting.tsx +13 -35
- package/src/account/email-change-setting-labels.ts +32 -0
- package/src/account/email-change-setting.tsx +17 -36
- package/src/{components → account}/passkeys-setting.tsx +14 -9
- package/src/account/sessions-setting-labels.ts +24 -0
- package/src/account/sessions-setting.tsx +14 -28
- package/src/admin/admin-action-confirm-labels.ts +19 -0
- package/src/admin/admin-action-confirm.tsx +59 -38
- package/src/admin/admin-action-log-labels.ts +74 -0
- package/src/admin/admin-action-log.tsx +180 -54
- package/src/admin/admin-parts.ts +0 -7
- package/src/admin/invitations-panel-labels.ts +31 -0
- package/src/admin/invitations-panel.tsx +16 -34
- package/src/admin/plan-change-labels.ts +23 -0
- package/src/admin/plan-change.tsx +89 -37
- package/src/admin/reviewer-scope-editor-labels.ts +16 -0
- package/src/admin/reviewer-scope-editor.tsx +9 -15
- package/src/admin/role-select-labels.ts +16 -0
- package/src/admin/role-select.tsx +13 -23
- package/src/admin/transfer-ownership-dialog-labels.ts +20 -0
- package/src/admin/transfer-ownership-dialog.tsx +7 -17
- package/src/admin/user-roster-labels.ts +17 -0
- package/src/admin/user-roster.tsx +9 -17
- package/src/auth/accept-invitation-labels.ts +21 -0
- package/src/auth/accept-invitation.tsx +9 -20
- package/src/auth/auth-errors.ts +29 -13
- package/src/auth/complete-name-dialog-labels.ts +16 -0
- package/src/auth/complete-name-dialog.tsx +8 -13
- package/src/auth/forgot-password-form-labels.ts +20 -0
- package/src/auth/forgot-password-form.tsx +12 -20
- package/src/auth/new-password-fields.tsx +1 -1
- package/src/auth/not-found-page-labels.ts +12 -0
- package/src/auth/not-found-page.tsx +11 -14
- package/src/auth/register-form-labels.ts +31 -0
- package/src/auth/register-form.tsx +18 -38
- package/src/auth/reset-password-form-labels.ts +27 -0
- package/src/auth/reset-password-form.tsx +12 -27
- package/src/auth/sign-in-form-labels.ts +44 -0
- package/src/auth/sign-in-form.tsx +18 -51
- package/src/auth/status-parts.tsx +3 -3
- package/src/auth/verify-email-labels.ts +26 -0
- package/src/auth/verify-email.tsx +15 -30
- package/src/billing/billing-banner.tsx +2 -1
- package/src/billing/billing-labels.ts +1 -1
- package/src/billing/checkout-processing.ts +2 -12
- package/src/billing/pay-page.ts +9 -5
- package/src/billing/plan-card.tsx +26 -27
- package/src/billing/plan-limit-notice.tsx +1 -1
- package/src/billing/subscription-actions.tsx +4 -4
- package/src/chart.ts +7 -1
- package/src/components/account-chips-labels.ts +16 -0
- package/src/components/account-chips.tsx +13 -16
- package/src/components/alert-banner.tsx +39 -19
- package/src/components/amount-input.tsx +461 -405
- package/src/components/appearance-labels.ts +2 -2
- package/src/components/authed-image-labels.ts +11 -0
- package/src/components/authed-image.tsx +6 -8
- package/src/components/autocomplete.tsx +84 -80
- package/src/components/breadcrumbs-labels.ts +10 -0
- package/src/components/breadcrumbs.tsx +17 -14
- package/src/components/bulk-action-bar-labels.ts +11 -0
- package/src/components/bulk-action-bar.tsx +15 -16
- package/src/components/button-group.tsx +7 -7
- package/src/components/button-look.ts +230 -0
- package/src/components/button.tsx +339 -0
- package/src/components/calculator.tsx +18 -11
- package/src/components/calendar-heatmap-labels.ts +15 -0
- package/src/components/calendar-heatmap.tsx +13 -19
- package/src/components/card.tsx +381 -0
- package/src/components/chart-zoom-core.tsx +653 -0
- package/src/components/chart-zoom.tsx +64 -648
- package/src/components/chart.tsx +11 -11
- package/src/components/checkbox-group.tsx +13 -10
- package/src/components/checkbox.tsx +43 -42
- package/src/components/chip-input.tsx +377 -0
- package/src/components/chip-labels.ts +13 -0
- package/src/components/chip.tsx +115 -711
- package/src/components/choice-card.tsx +83 -85
- package/src/components/column-mapper-labels.ts +45 -0
- package/src/components/column-mapper.tsx +16 -51
- package/src/components/combobox-core.tsx +351 -196
- package/src/components/combobox-suggestions.tsx +129 -0
- package/src/components/combobox.tsx +69 -893
- package/src/components/confirm-dialog-labels.ts +13 -0
- package/src/components/confirm-dialog.tsx +4 -8
- package/src/components/copy-button-labels.ts +13 -0
- package/src/components/copy-button.tsx +10 -12
- package/src/components/country-select-labels.ts +11 -0
- package/src/components/country-select.tsx +74 -89
- package/src/components/currency-option-list.tsx +216 -0
- package/src/components/currency-select.tsx +85 -196
- package/src/components/danger-confirm-labels.ts +20 -0
- package/src/components/danger-confirm.tsx +69 -77
- package/src/components/data-table-cells.tsx +5 -5
- package/src/components/data-table-column-settings.tsx +137 -0
- package/src/components/data-table-filter-popover.tsx +49 -24
- package/src/components/data-table-filters.ts +48 -11
- package/src/components/data-table-head.tsx +258 -0
- package/src/components/data-table-labels.ts +43 -11
- package/src/components/data-table-mobile.tsx +594 -0
- package/src/components/data-table-pagination.tsx +11 -10
- package/src/components/data-table-resize.ts +187 -0
- package/src/components/data-table-row-actions.tsx +152 -0
- package/src/components/data-table-selection.ts +55 -0
- package/src/components/data-table-shared.tsx +172 -0
- package/src/components/data-table.tsx +178 -1300
- package/src/components/date-field.tsx +627 -0
- package/src/components/date-picker.tsx +58 -1446
- package/src/components/date-range-picker.tsx +490 -0
- package/src/components/description-list-labels.ts +9 -0
- package/src/components/description-list.tsx +31 -15
- package/src/components/dialog-frame-labels.ts +7 -0
- package/src/components/dialog-frame.tsx +8 -6
- package/src/components/disclosure.tsx +14 -14
- package/src/components/dropdown.tsx +114 -42
- package/src/components/empty-state.tsx +137 -0
- package/src/components/entity-combobox.tsx +17 -12
- package/src/components/error-boundary-labels.ts +20 -0
- package/src/components/error-boundary.tsx +10 -20
- package/src/components/facing-pair.ts +1 -1
- package/src/components/field-base.tsx +615 -0
- package/src/components/field-parts.tsx +206 -77
- package/src/components/field-strip.tsx +16 -21
- package/src/components/field-sync-labels.ts +13 -0
- package/src/components/field-sync.tsx +11 -12
- package/src/components/field.tsx +13 -11
- package/src/components/file-button.tsx +64 -412
- package/src/components/file-dropzone.tsx +36 -33
- package/src/components/floating-panel-labels.ts +10 -0
- package/src/components/floating-panel.tsx +32 -21
- package/src/components/focus-ring.ts +9 -4
- package/src/components/form-actions-labels.ts +11 -0
- package/src/components/form-actions.tsx +17 -21
- package/src/components/full-bleed-dialog.tsx +33 -25
- package/src/components/grouped-picker.tsx +118 -96
- package/src/components/help-popover.tsx +115 -0
- package/src/components/hover-menu.tsx +46 -35
- package/src/components/iban-input-labels.ts +15 -0
- package/src/components/iban-input.tsx +25 -20
- package/src/components/icon-button.tsx +945 -0
- package/src/components/icon-picker-labels.ts +13 -0
- package/src/components/icon-picker.tsx +27 -24
- package/src/components/image-grid-labels.ts +11 -0
- package/src/components/image-grid.tsx +13 -15
- package/src/components/inline-edit-field-labels.ts +11 -0
- package/src/components/inline-edit-field.tsx +20 -19
- package/src/components/inline-entity-combobox.tsx +789 -0
- package/src/components/input.tsx +380 -0
- package/src/components/jump-calendar.tsx +385 -0
- package/src/components/language-select.tsx +31 -16
- package/src/components/legal-labels.ts +99 -0
- package/src/components/legal-page.tsx +2 -2
- package/src/components/legal.tsx +11 -101
- package/src/components/lightbox-labels.ts +18 -0
- package/src/components/lightbox.tsx +13 -21
- package/src/components/line-items-labels.ts +14 -0
- package/src/components/line-items.tsx +24 -31
- package/src/components/list-labels.ts +10 -0
- package/src/components/list.tsx +98 -75
- package/src/components/loading-state.tsx +4 -4
- package/src/components/measured-grid-labels.ts +25 -0
- package/src/components/measured-grid.tsx +39 -62
- package/src/components/menu-item.tsx +29 -26
- package/src/components/mini-calendar-labels.ts +17 -0
- package/src/components/mini-calendar.tsx +38 -45
- package/src/components/modal.tsx +36 -18
- package/src/components/money-draft.ts +72 -0
- package/src/components/money-field.tsx +16 -30
- package/src/components/month-picker-labels.ts +22 -0
- package/src/components/month-picker.tsx +59 -45
- package/src/components/multi-entity-combobox.tsx +17 -12
- package/src/components/multi-select.tsx +313 -288
- package/src/components/nav-pills.tsx +19 -8
- package/src/components/number-field.tsx +14 -5
- package/src/components/number-input.tsx +125 -90
- package/src/components/numeric-field.ts +161 -0
- package/src/components/numpad-sheet.tsx +16 -16
- package/src/components/one-time-code-input.tsx +154 -169
- package/src/components/page-contents-labels.ts +9 -0
- package/src/components/page-contents.tsx +15 -15
- package/src/components/page-header.tsx +9 -5
- package/src/components/password-strength-labels.ts +23 -0
- package/src/components/password-strength.tsx +13 -27
- package/src/components/phone-input-labels.ts +10 -0
- package/src/components/phone-input.tsx +42 -57
- package/src/components/picker-sheet.tsx +47 -18
- package/src/components/pie-chart.tsx +11 -9
- package/src/components/popover-labels.ts +14 -0
- package/src/components/popover.tsx +40 -39
- package/src/components/progress-bar-labels.ts +10 -0
- package/src/components/progress-bar.tsx +32 -23
- package/src/components/qr-code.tsx +2 -2
- package/src/components/reauth-dialog-labels.ts +13 -0
- package/src/components/reauth-dialog.tsx +7 -10
- package/src/components/row-actions-labels.ts +10 -0
- package/src/components/row-actions.tsx +11 -10
- package/src/components/scroll-area.tsx +4 -10
- package/src/components/search-field.tsx +35 -49
- package/src/components/select.tsx +302 -0
- package/src/components/separator.tsx +2 -2
- package/src/components/series-chart-axes.ts +329 -0
- package/src/components/series-chart-thin.ts +180 -0
- package/src/components/series-chart.tsx +124 -325
- package/src/components/server-wake-labels.ts +11 -0
- package/src/components/server-wake.tsx +42 -63
- package/src/components/settings-fields.tsx +46 -17
- package/src/components/share-card-labels.ts +30 -0
- package/src/components/share-card.tsx +22 -37
- package/src/components/sign-chip-labels.ts +12 -0
- package/src/components/sign-chip.tsx +6 -9
- package/src/components/signature-pad-labels.ts +24 -0
- package/src/components/signature-pad.tsx +48 -57
- package/src/components/signed-amount-labels.ts +10 -0
- package/src/components/signed-amount.tsx +21 -22
- package/src/components/skeleton.tsx +11 -3
- package/src/components/slider.tsx +51 -39
- package/src/components/sparkline-labels.ts +14 -0
- package/src/components/sparkline.tsx +16 -21
- package/src/components/spinner.tsx +81 -0
- package/src/components/stat-tile-labels.ts +15 -0
- package/src/components/stat-tile.tsx +32 -37
- package/src/components/status-dot.tsx +17 -14
- package/src/components/swatch-picker-labels.ts +10 -0
- package/src/components/swatch-picker.tsx +23 -16
- package/src/components/swipeable-row.tsx +7 -7
- package/src/components/switch.tsx +33 -32
- package/src/components/table.tsx +15 -15
- package/src/components/tabs.tsx +660 -0
- package/src/components/text-link.tsx +7 -7
- package/src/components/text.tsx +10 -6
- package/src/components/textarea.tsx +323 -0
- package/src/components/tile-radio.tsx +6 -6
- package/src/components/time-input.tsx +15 -7
- package/src/components/toast-labels.ts +12 -0
- package/src/components/toast.tsx +5 -8
- package/src/components/toggle-group.tsx +105 -42
- package/src/components/toggle-legend.tsx +6 -6
- package/src/components/tooltip.tsx +10 -21
- package/src/components/translation-review-editor.tsx +8 -7
- package/src/components/translation-review-parts.tsx +9 -13
- package/src/components/translation-review.tsx +26 -14
- package/src/components/tree-view.tsx +14 -12
- package/src/components/ui-labels.ts +22 -0
- package/src/components/user-avatar.tsx +3 -3
- package/src/components/wizard-stepper.tsx +10 -5
- package/src/components/write-lock-labels.ts +9 -0
- package/src/components/write-lock.tsx +10 -12
- package/src/data-table.ts +4 -0
- package/src/demo/demo-banner.tsx +9 -25
- package/src/demo/demo-ended.tsx +8 -7
- package/src/demo/demo-labels.ts +2 -2
- package/src/demo/demo-start.tsx +7 -5
- package/src/feedback/feedback-attachment-labels.ts +36 -0
- package/src/feedback/feedback-attachment.tsx +42 -66
- package/src/feedback/feedback-context-labels.ts +10 -0
- package/src/feedback/feedback-context.tsx +8 -9
- package/src/feedback/feedback-dialog-labels.ts +28 -0
- package/src/feedback/feedback-dialog.tsx +14 -44
- package/src/feedback/feedback-inbox.tsx +49 -252
- package/src/feedback/feedback-labels.ts +5 -5
- package/src/feedback/feedback-menu-labels.ts +11 -0
- package/src/feedback/feedback-menu.tsx +13 -11
- package/src/feedback/feedback-record.ts +21 -7
- package/src/feedback/feedback-row-detail-labels.ts +33 -0
- package/src/feedback/feedback-row-detail.tsx +30 -43
- package/src/feedback/feedback-status-undo.ts +3 -2
- package/src/feedback/feedback-submit-dialog.tsx +109 -0
- package/src/feedback/feedback-submit.tsx +45 -55
- package/src/feedback/feedback-swipe.tsx +1 -1
- package/src/feedback/feedback-table-labels.ts +27 -0
- package/src/feedback/feedback-table.tsx +24 -40
- package/src/feedback/feedback-thread-labels.ts +22 -0
- package/src/feedback/feedback-thread.tsx +68 -48
- package/src/feedback/feedback-vocabulary.ts +252 -0
- package/src/hooks/use-anchored-panel.ts +155 -9
- package/src/hooks/use-anchored-rect.ts +11 -9
- package/src/hooks/use-authed-src.ts +13 -7
- package/src/hooks/use-breakpoint.ts +5 -4
- package/src/hooks/use-close-transition.ts +9 -10
- package/src/hooks/use-debounce.ts +9 -0
- package/src/hooks/use-dismiss.ts +176 -19
- package/src/hooks/use-file-drop.ts +2 -2
- package/src/hooks/use-file-picker-labels.ts +29 -0
- package/src/hooks/use-file-picker.tsx +363 -0
- package/src/hooks/use-focus-trap.ts +74 -18
- package/src/i18n/defaults.ts +91 -82
- package/src/i18n/german.ts +54 -7
- package/src/i18n/kit-labels.tsx +70 -119
- package/src/i18n/locales/en.ts +46 -0
- package/src/i18n/locales/es.ts +52 -7
- package/src/i18n/locales/fr.ts +55 -8
- package/src/i18n/locales/hu.ts +54 -8
- package/src/i18n/locales/it.ts +53 -7
- package/src/i18n/locales/zh.ts +50 -6
- package/src/i18n/plurals.ts +29 -0
- package/src/i18n/review.ts +4 -0
- package/src/i18n/shared-labels.ts +135 -0
- package/src/index.ts +412 -402
- package/src/landing/access.ts +2 -1
- package/src/landing/landing-actions.tsx +6 -5
- package/src/landing/landing-labels.ts +2 -2
- package/src/landing/landing-sections.tsx +24 -23
- package/src/landing/public-header.tsx +3 -2
- package/src/landing/routing.tsx +2 -7
- package/src/lib/chip-edge-snap.ts +212 -0
- package/src/lib/cn.ts +13 -1
- package/src/lib/dates.ts +4 -2
- package/src/lib/decimal-marks.ts +4 -2
- package/src/lib/download.ts +172 -0
- package/src/lib/floating-stack.ts +5 -1
- package/src/lib/format.ts +5 -3
- package/src/lib/ime.ts +24 -0
- package/src/lib/presence.ts +18 -0
- package/src/lib/reduced-motion.ts +21 -0
- package/src/lib/round.ts +38 -0
- package/src/lib/safe-storage.ts +35 -11
- package/src/lib/session-refresh.ts +473 -0
- package/src/lib/text-match.ts +60 -0
- package/src/lib/translation-review.ts +7 -6
- package/src/rhf/fields.tsx +131 -179
- package/src/rhf/form-core.tsx +327 -0
- package/src/rhf/form.tsx +46 -321
- package/src/rhf/line-items.tsx +1 -1
- package/src/rhf.ts +3 -2
- package/src/search/command-palette-labels.ts +16 -0
- package/src/search/command-palette.tsx +37 -50
- package/src/search/global-search-labels.ts +13 -0
- package/src/search/global-search.tsx +50 -24
- package/src/search/search-index.ts +5 -6
- package/src/search/use-command-key.ts +22 -0
- package/src/settings/settings-card-classes.ts +11 -0
- package/src/settings/settings-heading.tsx +1 -1
- package/src/settings/settings-labels.ts +2 -2
- package/src/settings/settings-layout.tsx +65 -6
- package/src/settings/settings-section.tsx +5 -5
- package/src/settings/use-settings-focus.ts +2 -5
- package/src/shell/app-shell-labels.ts +10 -0
- package/src/shell/app-shell.tsx +79 -53
- package/src/shell/auth-layout.tsx +11 -10
- package/src/shell/company-switcher-labels.ts +13 -0
- package/src/shell/company-switcher.tsx +7 -11
- package/src/shell/option-switcher-menu.tsx +25 -6
- package/src/shell/role-switcher.tsx +7 -3
- package/src/shell/top-bar-brand.tsx +1 -1
- package/src/shell/top-bar.tsx +6 -5
- package/src/shell/topbar-action-menu.tsx +39 -20
- package/src/shell/topbar-controls.tsx +24 -12
- package/src/shell.ts +1 -1
- package/src/testing/index.ts +11 -0
- package/src/testing/viewport.ts +251 -0
- package/src/theme/color.ts +7 -1
- package/src/theme/palette-derive.ts +29 -7
- package/src/theme/palette-presets.ts +81 -68
- package/src/tour/tour-labels.ts +14 -0
- package/src/tour/tour.tsx +13 -23
- package/src/wizard/stepper-nav.tsx +19 -18
- package/src/wizard/types.ts +7 -22
- package/src/wizard/wizard-labels.ts +29 -0
- package/src/wizard/wizard-step.tsx +2 -2
- package/src/wizard/wizard-summary.tsx +8 -7
- package/tokens.css +63 -14
- package/dist/components/account-settings-labels.js.map +0 -1
- package/dist/components/account-settings.js.map +0 -1
- package/dist/components/choice-parts.d.ts +0 -24
- package/dist/components/choice-parts.js +0 -18
- package/dist/components/choice-parts.js.map +0 -1
- package/dist/components/passkeys-setting.js.map +0 -1
- package/dist/components/ui.d.ts +0 -100
- package/dist/components/ui.js +0 -1955
- package/dist/components/ui.js.map +0 -1
- package/dist/data-table-labels-BJ5JE_X2.d.ts +0 -923
- package/dist/delete-account-setting-DiPX4Vue.d.ts +0 -8130
- package/src/components/choice-parts.ts +0 -33
- package/src/components/ui.tsx +0 -4233
|
@@ -6,11 +6,9 @@ import { useKitLabels } from "../i18n/kit-labels.js";
|
|
|
6
6
|
import { TILE_SIZE, TileRadioGroup } from "./tile-radio.js";
|
|
7
7
|
import { Tooltip } from "./tooltip.js";
|
|
8
8
|
import { useCommitReason } from "./write-lock.js";
|
|
9
|
-
import { hasContent
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
mixed: "Mixed: the selected items have different colours"
|
|
13
|
-
};
|
|
9
|
+
import { hasContent } from "../lib/presence.js";
|
|
10
|
+
import { LabelStrip, mergeDescribedBy, useFieldMessages } from "./field-parts.js";
|
|
11
|
+
import { DEFAULT_SWATCH_PICKER_LABELS } from "./swatch-picker-labels.js";
|
|
14
12
|
function SwatchPicker({
|
|
15
13
|
options,
|
|
16
14
|
value,
|
|
@@ -36,6 +34,11 @@ function SwatchPicker({
|
|
|
36
34
|
const disabledReason = useCommitReason(commit, ownDisabledReason);
|
|
37
35
|
const locked = hasContent(disabledReason);
|
|
38
36
|
const labelled = hasContent(label);
|
|
37
|
+
const messages = useFieldMessages({
|
|
38
|
+
hint: labelled ? hint : void 0,
|
|
39
|
+
describedBy: rest["aria-describedby"],
|
|
40
|
+
reasonId: mergeDescribedBy(mixed && mixedId, locked && reasonId)
|
|
41
|
+
});
|
|
39
42
|
const byValue = useMemo(() => new Map(options.map((o) => [o.value, o])), [options]);
|
|
40
43
|
const items = [
|
|
41
44
|
...allowNone ? [{ key: null, label: text.none }] : [],
|
|
@@ -63,7 +66,7 @@ function SwatchPicker({
|
|
|
63
66
|
// not-allowed cursor, and no hover offer on a tile that cannot be
|
|
64
67
|
// chosen. Not on the selected tile, whose frame IS its state.
|
|
65
68
|
locked && "cursor-not-allowed opacity-50",
|
|
66
|
-
locked && !selected && "hover:border-
|
|
69
|
+
locked && !selected && "hover:border-subtle hover:bg-surface",
|
|
67
70
|
tileClassName
|
|
68
71
|
) : void 0,
|
|
69
72
|
renderTile: (item) => {
|
|
@@ -90,7 +93,7 @@ function SwatchPicker({
|
|
|
90
93
|
role: "radiogroup",
|
|
91
94
|
"aria-labelledby": labelled && rest["aria-label"] === void 0 && rest["aria-labelledby"] === void 0 ? labelId : rest["aria-labelledby"],
|
|
92
95
|
"aria-disabled": disabled || locked || void 0,
|
|
93
|
-
"aria-describedby":
|
|
96
|
+
"aria-describedby": messages.describedBy,
|
|
94
97
|
className: cn("flex flex-wrap items-center gap-1.5", !labelled && className),
|
|
95
98
|
children: [
|
|
96
99
|
locked ? (
|
|
@@ -116,7 +119,10 @@ function SwatchPicker({
|
|
|
116
119
|
}
|
|
117
120
|
);
|
|
118
121
|
if (!labelled) return group;
|
|
119
|
-
return /* @__PURE__ */
|
|
122
|
+
return /* @__PURE__ */ jsxs(LabelStrip, { labelId, label, hint: messages.labelHint, disabled: disabled || locked, className, children: [
|
|
123
|
+
group,
|
|
124
|
+
messages.below
|
|
125
|
+
] });
|
|
120
126
|
}
|
|
121
127
|
export {
|
|
122
128
|
DEFAULT_SWATCH_PICKER_LABELS,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/swatch-picker.tsx"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport type { ComponentPropsWithoutRef, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels } from \"../i18n/kit-labels\";\nimport { TILE_SIZE, TileRadioGroup } from \"./tile-radio\";\nimport type { TileItem, TileSize } from \"./tile-radio\";\nimport { Tooltip } from \"./tooltip\";\nimport { useCommitReason, type CommitScope } from \"./write-lock\";\nimport { hasContent, LabelStrip } from \"./field-parts\";\n\nexport interface SwatchPickerLabels {\n /** The \"no colour\" tile's name, when `allowNone` is set. */\n none: string;\n /** Describes the group while `mixed` is set — a bulk edit over rows that disagree. */\n mixed: string;\n}\n\nexport const DEFAULT_SWATCH_PICKER_LABELS: SwatchPickerLabels = {\n none: \"No colour\",\n mixed: \"Mixed: the selected items have different colours\",\n};\n\nexport interface SwatchOption<T extends string> {\n value: T;\n /** Any CSS colour — a token (`var(--chart-3)`), a hex, an `oklch()`. Painted as an\n * inline background, so it does not have to be a class the kit's CSS knows.\n * Leave it out when `swatchClassName` paints the dot instead. For a colour that\n * must match a `StatusDot` / `Chip` hue elsewhere, `statusDotColor(\"teal\")` rather\n * than `\"var(--hue-teal)\"` written out — one table, so the two cannot drift. */\n color?: string;\n /** The colour's name, in the user's language. Shown in the bubble and read out;\n * required, because a swatch with no name is a colour only some people can read. */\n label: string;\n /** Classes for the swatch dot, for a palette that lives in classes rather than\n * values (a light/dark pair). An inline `color` would win over a class, so pass\n * one or the other. */\n swatchClassName?: string;\n /** A remark read after the name and shown under it in the bubble (\"used by\n * Groceries\"). The tile wears a dot while it has one. */\n note?: string;\n /** Out of the choice and out of reach — skipped by the arrow keys and Tab. With a\n * `disabledReason` the tile stays reachable instead and says why. */\n disabled?: boolean;\n /**\n * Why THIS colour cannot be chosen right now — the whole picker's `disabledReason`,\n * one tile at a time (the kit's later list after keksdose K3: a colour another\n * category already wears, a flag only an owner may set). {@link Button}'s rule: a tile\n * that is merely `disabled` is a dead square a keyboard never lands on, so nobody\n * learns why it is dimmed.\n *\n * The tile looks disabled but is `aria-disabled`, not `disabled`: Tab and the arrow\n * keys still reach it, its bubble shows the reason under its name, and the reason\n * describes it. Choosing it — a click, Space or Enter, or an arrow under automatic\n * activation — does nothing: the focus moves onto it and the checked colour stays\n * where it was, as under the whole-picker lock. Wins over `disabled`.\n */\n disabledReason?: ReactNode;\n}\n\n/**\n * `onChange` is the picker's own — the chosen VALUE, not a DOM event — so the div's\n * is omitted rather than shadowed, as on {@link ToggleGroup}.\n */\nexport interface SwatchPickerProps<T extends string>\n extends Omit<ComponentPropsWithoutRef<\"div\">, \"onChange\" | \"children\" | \"defaultValue\"> {\n options: SwatchOption<T>[];\n /** The chosen colour, or `null` for none. */\n value: T | null;\n onChange: (value: T | null) => void;\n /** Lead with a \"no colour\" tile whose value is `null`. Clearing a colour has to be\n * as reachable as setting one, and a radio cannot be unchecked by clicking it. */\n allowNone?: boolean;\n /**\n * \"Some of each\" — a bulk edit over rows whose colours differ. Nothing is checked\n * (not even \"none\", whatever `value` says), and the group is described as mixed.\n * Distinct from `value={null}`, which is an answer: \"no colour\".\n */\n mixed?: boolean;\n /** See {@link IconPickerProps.activation}. Default \"automatic\". */\n activation?: \"automatic\" | \"manual\";\n /** 28 / 32 / 44px tiles. Default \"md\"; \"lg\" is the touch-target size. */\n size?: TileSize;\n /**\n * Classes for every tile's frame, merged after the kit's own — so a caller's\n * `size-*` beats `size`'s. For a tile that has to follow a container query or a\n * breakpoint (keksdose grows its tiles to 40px in a narrow card:\n * `tileClassName=\"@max-md:size-10\"`) without reaching into the kit's markup with an\n * `[&_[role=radio]]` selector. The swatch dot / glyph inside keeps `size`'s\n * dimensions; the tile grows round it.\n */\n tileClassName?: string;\n disabled?: boolean;\n labels?: Partial<SwatchPickerLabels>;\n /**\n * An 11px static label in a strip over the swatches, named by it (keksdose K2): the\n * transaction row's flag picker stands between labelled fields and hand-builds this\n * (`FieldLabel` + `pt-5`, transaction-flags.tsx:155) because the picker had no label.\n * The label sits on the same line as a field's own (`top-1`, `inset-x-3`); the\n * swatches start 20px down, below its whole line box — see `LABEL_STRIP_PAD`. With a\n * label, `className` styles the wrapper, as on a labelled {@link ToggleGroup}; an\n * explicit `aria-label` / `aria-labelledby` still names the group instead.\n */\n label?: ReactNode;\n /** A {@link FieldHint} beside the label. Only with `label`. */\n hint?: ReactNode;\n /**\n * Why the colour cannot be changed right now — {@link Button}'s `disabledReason`, for\n * a picker that saves itself on change (keksdose K3, the flag picker in a row a\n * read-only viewer may see). The swatches stay reachable and the arrow keys still\n * walk them, but nothing reaches `onChange`; the reason is shown in the kit\n * {@link Tooltip} under the row (each swatch's own name bubble sits above it) and\n * describes the group. Wins over `disabled`.\n */\n disabledReason?: ReactNode;\n /** This picker COMMITS — choosing a colour saves it. Under a locked\n * {@link WriteLockProvider} it takes the `disabledReason` path with the lock's\n * reason, as {@link Button}'s `commit` does. */\n commit?: CommitScope;\n}\n\n/**\n * A row of colour swatches that is one radio group.\n *\n * Name the group with `aria-label` or `aria-labelledby` — usually the visible heading\n * above it. Each swatch is named by its `label` and shows it in a bubble on hover and\n * focus, so the name is not the screen reader's alone.\n *\n * Keyboard (the APG radio group): Tab reaches the checked swatch, or the first one\n * while nothing is checked; the arrow keys move between swatches and, by default,\n * choose as they go; Home and End jump to the ends. Left and right follow the page's\n * direction.\n */\nexport function SwatchPicker<T extends string>({\n options,\n value,\n onChange,\n allowNone = false,\n mixed = false,\n activation = \"automatic\",\n size = \"md\",\n tileClassName,\n disabled = false,\n labels,\n label,\n hint,\n disabledReason: ownDisabledReason,\n commit,\n className,\n ...rest\n}: SwatchPickerProps<T>) {\n const text = useKitLabels(\"swatchPicker\", DEFAULT_SWATCH_PICKER_LABELS, labels);\n const mixedId = useId();\n const labelId = useId();\n const reasonId = useId();\n const disabledReason = useCommitReason(commit, ownDisabledReason);\n const locked = hasContent(disabledReason);\n const labelled = hasContent(label);\n const byValue = useMemo(() => new Map(options.map((o) => [o.value, o])), [options]);\n const items: TileItem<T>[] = [\n ...(allowNone ? [{ key: null, label: text.none }] : []),\n ...options.map((o) => ({\n key: o.value,\n label: o.label,\n note: o.note,\n disabled: o.disabled,\n disabledReason: o.disabledReason,\n })),\n ];\n const tiles = (\n <TileRadioGroup\n items={items}\n checked={mixed ? undefined : value}\n // A locked picker saves on change, so the change is swallowed — the arrow keys\n // still move the focus (and, automatic, would choose), and nothing is chosen. A\n // locked TILE is refused by the tiles themselves; asked again here so a reason\n // can never become a change, whatever the tiles do.\n onSelect={(next) => {\n if (!locked && !hasContent(next === null ? undefined : byValue.get(next)?.disabledReason)) onChange(next);\n }}\n activation={activation}\n // A reason wins over `disabled`: the tiles stay in the tab order.\n disabled={disabled && !locked}\n size={size}\n tileClassName={\n tileClassName || locked\n ? (_item, selected) =>\n cn(\n // The disabled tile's look, without its `disabled`: dimmed, a\n // not-allowed cursor, and no hover offer on a tile that cannot be\n // chosen. Not on the selected tile, whose frame IS its state.\n locked && \"cursor-not-allowed opacity-50\",\n locked && !selected && \"hover:border-[var(--border)] hover:bg-[var(--bg-surface)]\",\n tileClassName,\n )\n : undefined\n }\n renderTile={(item) => {\n const opt = item.key === null ? undefined : byValue.get(item.key);\n return (\n <span\n aria-hidden\n // A hairline round the dot, drawn over whatever colour it is: a pale\n // yellow swatch on a white surface is otherwise a hole in the row.\n className={cn(\n \"rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/15\",\n TILE_SIZE[size].swatch,\n opt?.swatchClassName,\n )}\n style={{ background: opt?.color }}\n />\n );\n }}\n />\n );\n const group = (\n <div\n {...rest}\n role=\"radiogroup\"\n aria-labelledby={\n labelled && rest[\"aria-label\"] === undefined && rest[\"aria-labelledby\"] === undefined\n ? labelId\n : rest[\"aria-labelledby\"]\n }\n aria-disabled={disabled || locked || undefined}\n aria-describedby={\n [rest[\"aria-describedby\"], mixed && mixedId, locked && reasonId].filter(Boolean).join(\" \") ||\n undefined\n }\n className={cn(\"flex flex-wrap items-center gap-1.5\", !labelled && className)}\n >\n {locked ? (\n // Inside the group, round the tiles — not round the group, whose box is the\n // caller's row item. This row inherits the group's gap, wrap and alignment, so\n // the tiles sit exactly where they sit unlocked. Below the row: each tile's own\n // bubble (its colour's name) is above it.\n <Tooltip\n label={disabledReason}\n side=\"bottom\"\n className=\"flex min-w-0 flex-1 gap-[inherit] [align-items:inherit] [flex-wrap:inherit] [justify-content:inherit]\"\n >\n <>\n {tiles}\n <span id={reasonId} hidden>\n {disabledReason}\n </span>\n </>\n </Tooltip>\n ) : (\n tiles\n )}\n {/* `hidden`, not `sr-only`: a description is read from hidden text, and this\n way it takes no room in the row. */}\n {mixed && (\n <span id={mixedId} hidden>\n {text.mixed}\n </span>\n )}\n </div>\n );\n if (!labelled) return group;\n return (\n <LabelStrip labelId={labelId} label={label} hint={hint} disabled={disabled || locked} pad=\"clear\" className={className}>\n {group}\n </LabelStrip>\n );\n}\n"],"mappings":";AAuMU,SAyCA,UAzCA,KAyCA,YAzCA;AAvMV,SAAS,OAAO,eAAe;AAE/B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,WAAW,sBAAsB;AAE1C,SAAS,eAAe;AACxB,SAAS,uBAAyC;AAClD,SAAS,YAAY,kBAAkB;AAShC,MAAM,+BAAmD;AAAA,EAC9D,MAAM;AAAA,EACN,OAAO;AACT;AAgHO,SAAS,aAA+B;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,QAAM,OAAO,aAAa,gBAAgB,8BAA8B,MAAM;AAC9E,QAAM,UAAU,MAAM;AACtB,QAAM,UAAU,MAAM;AACtB,QAAM,WAAW,MAAM;AACvB,QAAM,iBAAiB,gBAAgB,QAAQ,iBAAiB;AAChE,QAAM,SAAS,WAAW,cAAc;AACxC,QAAM,WAAW,WAAW,KAAK;AACjC,QAAM,UAAU,QAAQ,MAAM,IAAI,IAAI,QAAQ,IAA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BAAiB,MAAM,SACxE,UACA,KAAK,iBAAiB;AAAA,MAE5B,iBAAe,YAAY,UAAU;AAAA,MACrC,oBACE,CAAC,KAAK,kBAAkB,GAAG,SAAS,SAAS,UAAU,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KACzF;AAAA,MAEF,WAAW,GAAG,uCAAuC,CAAC,YAAY,SAAS;AAAA,MAE1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,cACP,MAAK;AAAA,cACL,WAAU;AAAA,cAEV,2CACG;AAAA;AAAA,gBACD,oBAAC,UAAK,IAAI,UAAU,QAAM,MACvB,0BACH;AAAA,iBACF;AAAA;AAAA,UACF;AAAA,YAEA;AAAA,QAID,SACC,oBAAC,UAAK,IAAI,SAAS,QAAM,MACtB,eAAK,OACR;AAAA;AAAA;AAAA,EAEJ;AAEF,MAAI,CAAC,SAAU,QAAO;AACtB,SACE,oBAAC,cAAW,SAAkB,OAAc,MAAY,UAAU,YAAY,QAAQ,KAAI,SAAQ,WAC/F,iBACH;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/swatch-picker.tsx"],"sourcesContent":["import { useId, useMemo } from \"react\";\nimport type { ComponentPropsWithRef, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { useKitLabels, type LabelOverride } from \"../i18n/kit-labels\";\nimport { TILE_SIZE, TileRadioGroup } from \"./tile-radio\";\nimport type { TileItem, TileSize } from \"./tile-radio\";\nimport { Tooltip } from \"./tooltip\";\nimport { useCommitReason, type CommitScope } from \"./write-lock\";\nimport { hasContent } from \"../lib/presence\";\nimport { LabelStrip, mergeDescribedBy, useFieldMessages } from \"./field-parts\";\nimport { DEFAULT_SWATCH_PICKER_LABELS } from \"./swatch-picker-labels\";\n\nexport interface SwatchPickerLabels {\n /** The \"no colour\" tile's name, when `allowNone` is set. */\n none: string;\n /** Describes the group while `mixed` is set — a bulk edit over rows that disagree. */\n mixed: string;\n}\n\n// Defined in ./swatch-picker-labels, which holds no component code (0.34, KS U8).\nexport { DEFAULT_SWATCH_PICKER_LABELS };\n\nexport interface SwatchOption<T extends string> {\n value: T;\n /** Any CSS colour — a token (`var(--chart-3)`), a hex, an `oklch()`. Painted as an\n * inline background, so it does not have to be a class the kit's CSS knows.\n * Leave it out when `swatchClassName` paints the dot instead. For a colour that\n * must match a `StatusDot` / `Chip` hue elsewhere, `statusDotColor(\"teal\")` rather\n * than `\"var(--hue-teal)\"` written out — one table, so the two cannot drift. */\n color?: string;\n /** The colour's name, in the user's language. Shown in the bubble and read out;\n * required, because a swatch with no name is a colour only some people can read. */\n label: string;\n /** Classes for the swatch dot, for a palette that lives in classes rather than\n * values (a light/dark pair). An inline `color` would win over a class, so pass\n * one or the other. */\n swatchClassName?: string;\n /** A remark read after the name and shown under it in the bubble (\"used by\n * Groceries\"). The tile wears a dot while it has one. */\n note?: string;\n /** Out of the choice and out of reach — skipped by the arrow keys and Tab. With a\n * `disabledReason` the tile stays reachable instead and says why. */\n disabled?: boolean;\n /**\n * Why THIS colour cannot be chosen right now — the whole picker's `disabledReason`,\n * one tile at a time (the kit's later list after keksdose K3: a colour another\n * category already wears, a flag only an owner may set). {@link Button}'s rule: a tile\n * that is merely `disabled` is a dead square a keyboard never lands on, so nobody\n * learns why it is dimmed.\n *\n * The tile looks disabled but is `aria-disabled`, not `disabled`: Tab and the arrow\n * keys still reach it, its bubble shows the reason under its name, and the reason\n * describes it. Choosing it — a click, Space or Enter, or an arrow under automatic\n * activation — does nothing: the focus moves onto it and the checked colour stays\n * where it was, as under the whole-picker lock. Wins over `disabled`.\n */\n disabledReason?: ReactNode;\n}\n\n/**\n * `onChange` is the picker's own — the chosen VALUE, not a DOM event — so the div's\n * is omitted rather than shadowed, as on {@link ToggleGroup}.\n */\nexport interface SwatchPickerProps<T extends string>\n extends Omit<ComponentPropsWithRef<\"div\">, \"onChange\" | \"children\" | \"defaultValue\"> {\n options: SwatchOption<T>[];\n /** The chosen colour, or `null` for none. */\n value: T | null;\n onChange: (value: T | null) => void;\n /** Lead with a \"no colour\" tile whose value is `null`. Clearing a colour has to be\n * as reachable as setting one, and a radio cannot be unchecked by clicking it. */\n allowNone?: boolean;\n /**\n * \"Some of each\" — a bulk edit over rows whose colours differ. Nothing is checked\n * (not even \"none\", whatever `value` says), and the group is described as mixed.\n * Distinct from `value={null}`, which is an answer: \"no colour\".\n */\n mixed?: boolean;\n /** See {@link IconPickerProps.activation}. Default \"automatic\". */\n activation?: \"automatic\" | \"manual\";\n /** 28 / 32 / 44px tiles. Default \"md\"; \"lg\" is the touch-target size. */\n size?: TileSize;\n /**\n * Classes for every tile's frame, merged after the kit's own — so a caller's\n * `size-*` beats `size`'s. For a tile that has to follow a container query or a\n * breakpoint (keksdose grows its tiles to 40px in a narrow card:\n * `tileClassName=\"@max-md:size-10\"`) without reaching into the kit's markup with an\n * `[&_[role=radio]]` selector. The swatch dot / glyph inside keeps `size`'s\n * dimensions; the tile grows round it.\n */\n tileClassName?: string;\n disabled?: boolean;\n labels?: LabelOverride<SwatchPickerLabels>;\n /**\n * An 11px static label in a strip over the swatches, named by it (keksdose K2): the\n * transaction row's flag picker stands between labelled fields and hand-builds this\n * (`FieldLabel` + `pt-5`, transaction-flags.tsx:155) because the picker had no label.\n * The label sits on the same line as a field's own (`top-1`, `inset-x-3`); the\n * swatches start 20px down, below its whole line box — see `LABEL_STRIP_PAD`. With a\n * label, `className` styles the wrapper, as on a labelled {@link ToggleGroup}; an\n * explicit `aria-label` / `aria-labelledby` still names the group instead.\n */\n label?: ReactNode;\n /** A {@link FieldHint} beside the label. Only with `label`. {@link Select}'s rule since\n * 0.34 (DUP-2, refactor audit 2026-10): plain TEXT, and a FieldHint at Large and on a\n * touch screen (§4), is a caption under the swatches, describing the group. */\n hint?: ReactNode;\n /**\n * Why the colour cannot be changed right now — {@link Button}'s `disabledReason`, for\n * a picker that saves itself on change (keksdose K3, the flag picker in a row a\n * read-only viewer may see). The swatches stay reachable and the arrow keys still\n * walk them, but nothing reaches `onChange`; the reason is shown in the kit\n * {@link Tooltip} under the row (each swatch's own name bubble sits above it) and\n * describes the group. Wins over `disabled`.\n */\n disabledReason?: ReactNode;\n /** This picker COMMITS — choosing a colour saves it. Under a locked\n * {@link WriteLockProvider} it takes the `disabledReason` path with the lock's\n * reason, as {@link Button}'s `commit` does. */\n commit?: CommitScope;\n}\n\n/**\n * A row of colour swatches that is one radio group.\n *\n * Name the group with `aria-label` or `aria-labelledby` — usually the visible heading\n * above it. Each swatch is named by its `label` and shows it in a bubble on hover and\n * focus, so the name is not the screen reader's alone.\n *\n * Keyboard (the APG radio group): Tab reaches the checked swatch, or the first one\n * while nothing is checked; the arrow keys move between swatches and, by default,\n * choose as they go; Home and End jump to the ends. Left and right follow the page's\n * direction.\n */\nexport function SwatchPicker<T extends string>({\n options,\n value,\n onChange,\n allowNone = false,\n mixed = false,\n activation = \"automatic\",\n size = \"md\",\n tileClassName,\n disabled = false,\n labels,\n label,\n hint,\n disabledReason: ownDisabledReason,\n commit,\n className,\n ...rest\n}: SwatchPickerProps<T>) {\n const text = useKitLabels(\"swatchPicker\", DEFAULT_SWATCH_PICKER_LABELS, labels);\n const mixedId = useId();\n const labelId = useId();\n const reasonId = useId();\n const disabledReason = useCommitReason(commit, ownDisabledReason);\n const locked = hasContent(disabledReason);\n const labelled = hasContent(label);\n // The label line's \"?\", or the caption under the swatches (DUP-2). Only with a label.\n // The caller's ids, the caption, then the group's state: mixed, locked.\n const messages = useFieldMessages({\n hint: labelled ? hint : undefined,\n describedBy: rest[\"aria-describedby\"],\n reasonId: mergeDescribedBy(mixed && mixedId, locked && reasonId),\n });\n const byValue = useMemo(() => new Map(options.map((o) => [o.value, o])), [options]);\n const items: TileItem<T>[] = [\n ...(allowNone ? [{ key: null, label: text.none }] : []),\n ...options.map((o) => ({\n key: o.value,\n label: o.label,\n note: o.note,\n disabled: o.disabled,\n disabledReason: o.disabledReason,\n })),\n ];\n const tiles = (\n <TileRadioGroup\n items={items}\n checked={mixed ? undefined : value}\n // A locked picker saves on change, so the change is swallowed — the arrow keys\n // still move the focus (and, automatic, would choose), and nothing is chosen. A\n // locked TILE is refused by the tiles themselves; asked again here so a reason\n // can never become a change, whatever the tiles do.\n onSelect={(next) => {\n if (!locked && !hasContent(next === null ? undefined : byValue.get(next)?.disabledReason)) onChange(next);\n }}\n activation={activation}\n // A reason wins over `disabled`: the tiles stay in the tab order.\n disabled={disabled && !locked}\n size={size}\n tileClassName={\n tileClassName || locked\n ? (_item, selected) =>\n cn(\n // The disabled tile's look, without its `disabled`: dimmed, a\n // not-allowed cursor, and no hover offer on a tile that cannot be\n // chosen. Not on the selected tile, whose frame IS its state.\n locked && \"cursor-not-allowed opacity-50\",\n locked && !selected && \"hover:border-subtle hover:bg-surface\",\n tileClassName,\n )\n : undefined\n }\n renderTile={(item) => {\n const opt = item.key === null ? undefined : byValue.get(item.key);\n return (\n <span\n aria-hidden\n // A hairline round the dot, drawn over whatever colour it is: a pale\n // yellow swatch on a white surface is otherwise a hole in the row.\n className={cn(\n \"rounded-full ring-1 ring-inset ring-black/10 dark:ring-white/15\",\n TILE_SIZE[size].swatch,\n opt?.swatchClassName,\n )}\n style={{ background: opt?.color }}\n />\n );\n }}\n />\n );\n const group = (\n <div\n {...rest}\n role=\"radiogroup\"\n aria-labelledby={\n labelled && rest[\"aria-label\"] === undefined && rest[\"aria-labelledby\"] === undefined\n ? labelId\n : rest[\"aria-labelledby\"]\n }\n aria-disabled={disabled || locked || undefined}\n aria-describedby={messages.describedBy}\n className={cn(\"flex flex-wrap items-center gap-1.5\", !labelled && className)}\n >\n {locked ? (\n // Inside the group, round the tiles — not round the group, whose box is the\n // caller's row item. This row inherits the group's gap, wrap and alignment, so\n // the tiles sit exactly where they sit unlocked. Below the row: each tile's own\n // bubble (its colour's name) is above it.\n <Tooltip\n label={disabledReason}\n side=\"bottom\"\n className=\"flex min-w-0 flex-1 gap-[inherit] [align-items:inherit] [flex-wrap:inherit] [justify-content:inherit]\"\n >\n <>\n {tiles}\n <span id={reasonId} hidden>\n {disabledReason}\n </span>\n </>\n </Tooltip>\n ) : (\n tiles\n )}\n {/* `hidden`, not `sr-only`: a description is read from hidden text, and this\n way it takes no room in the row. */}\n {mixed && (\n <span id={mixedId} hidden>\n {text.mixed}\n </span>\n )}\n </div>\n );\n if (!labelled) return group;\n return (\n <LabelStrip labelId={labelId} label={label} hint={messages.labelHint} disabled={disabled || locked} className={className}>\n {group}\n {messages.below}\n </LabelStrip>\n );\n}\n"],"mappings":";AAgNU,SAsCA,UAtCA,KAsCA,YAtCA;AAhNV,SAAS,OAAO,eAAe;AAE/B,SAAS,UAAU;AACnB,SAAS,oBAAwC;AACjD,SAAS,WAAW,sBAAsB;AAE1C,SAAS,eAAe;AACxB,SAAS,uBAAyC;AAClD,SAAS,kBAAkB;AAC3B,SAAS,YAAY,kBAAkB,wBAAwB;AAC/D,SAAS,oCAAoC;AA4HtC,SAAS,aAA+B;AAAA,EAC7C;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAyB;AACvB,QAAM,OAAO,aAAa,gBAAgB,8BAA8B,MAAM;AAC9E,QAAM,UAAU,MAAM;AACtB,QAAM,UAAU,MAAM;AACtB,QAAM,WAAW,MAAM;AACvB,QAAM,iBAAiB,gBAAgB,QAAQ,iBAAiB;AAChE,QAAM,SAAS,WAAW,cAAc;AACxC,QAAM,WAAW,WAAW,KAAK;AAGjC,QAAM,WAAW,iBAAiB;AAAA,IAChC,MAAM,WAAW,OAAO;AAAA,IACxB,aAAa,KAAK,kBAAkB;AAAA,IACpC,UAAU,iBAAiB,SAAS,SAAS,UAAU,QAAQ;AAAA,EACj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,MAAK;AAAA,MACL,mBACE,YAAY,KAAK,YAAY,MAAM,UAAa,KAAK,iBAAiB,MAAM,SACxE,UACA,KAAK,iBAAiB;AAAA,MAE5B,iBAAe,YAAY,UAAU;AAAA,MACrC,oBAAkB,SAAS;AAAA,MAC3B,WAAW,GAAG,uCAAuC,CAAC,YAAY,SAAS;AAAA,MAE1E;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UAKC;AAAA,YAAC;AAAA;AAAA,cACC,OAAO;AAAA,cACP,MAAK;AAAA,cACL,WAAU;AAAA,cAEV,2CACG;AAAA;AAAA,gBACD,oBAAC,UAAK,IAAI,UAAU,QAAM,MACvB,0BACH;AAAA,iBACF;AAAA;AAAA,UACF;AAAA,YAEA;AAAA,QAID,SACC,oBAAC,UAAK,IAAI,SAAS,QAAM,MACtB,eAAK,OACR;AAAA;AAAA;AAAA,EAEJ;AAEF,MAAI,CAAC,SAAU,QAAO;AACtB,SACE,qBAAC,cAAW,SAAkB,OAAc,MAAM,SAAS,WAAW,UAAU,YAAY,QAAQ,WACjG;AAAA;AAAA,IACA,SAAS;AAAA,KACZ;AAEJ;","names":[]}
|
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { StatusDotTone } from './status-dot.js';
|
|
4
|
-
import './progress-bar.js';
|
|
5
|
-
import './signed-amount.js';
|
|
6
|
-
import './stat-tile.js';
|
|
7
|
-
import './chip.js';
|
|
8
|
-
import 'lucide-react';
|
|
9
|
-
import './field-parts.js';
|
|
10
|
-
import './tooltip.js';
|
|
11
|
-
import '../hooks/use-anchored-rect.js';
|
|
12
|
-
import '../lib/clipping.js';
|
|
13
|
-
import './write-lock.js';
|
|
14
|
-
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { StatusDotTone } from "./status-dot.js";
|
|
15
3
|
/**
|
|
16
4
|
* What a swipe action's panel means — the vocabulary Chip, ProgressBar and StatusDot
|
|
17
5
|
* already share, so a curtain can be "the colour of the status it produces" by name:
|
|
18
6
|
* brand, neutral, success, warning, danger, info, income, expense, and the categorical
|
|
19
7
|
* hues blue, indigo, purple, teal and orange.
|
|
20
8
|
*/
|
|
21
|
-
type SwipeTone = StatusDotTone;
|
|
9
|
+
export type SwipeTone = StatusDotTone;
|
|
22
10
|
/**
|
|
23
11
|
* An app's own fill for a documented exception (0.33, docs/colour-roles-harmonization.md
|
|
24
12
|
* §12.6) — a curtain that must be exactly its status pill's palette fill, or two
|
|
@@ -26,7 +14,7 @@ type SwipeTone = StatusDotTone;
|
|
|
26
14
|
* passes a variable it declares per theme in its own stylesheet. The kit cannot measure
|
|
27
15
|
* these, so the app's tests pin the pair.
|
|
28
16
|
*/
|
|
29
|
-
interface SwipePaint {
|
|
17
|
+
export interface SwipePaint {
|
|
30
18
|
/** The armed panel's fill; idle shows a 14 % wash of it on the card. */
|
|
31
19
|
fill: string;
|
|
32
20
|
/** The text and icon colour ON `fill`, armed. Idle text is the body ink. */
|
|
@@ -58,7 +46,7 @@ interface SwipeActionBase {
|
|
|
58
46
|
* existing call sites compile; there the label is white unless the classes set a
|
|
59
47
|
* colour, and the idle panel is still dimmed.
|
|
60
48
|
*/
|
|
61
|
-
type SwipeAction = SwipeActionBase & ({
|
|
49
|
+
export type SwipeAction = SwipeActionBase & ({
|
|
62
50
|
/** The kit paints the panel: the tone's wash idle, its fill and `-contrast` armed. */
|
|
63
51
|
tone: SwipeTone;
|
|
64
52
|
paint?: never;
|
|
@@ -74,12 +62,12 @@ type SwipeAction = SwipeActionBase & ({
|
|
|
74
62
|
} | {
|
|
75
63
|
tone?: never;
|
|
76
64
|
paint?: never;
|
|
77
|
-
/** @deprecated 0.33 — pass `tone`, or `paint` for an exception.
|
|
78
|
-
* utility class while the action is previewed but not yet armed; the
|
|
79
|
-
* dimmed then, and its text is white unless this sets a text colour. */
|
|
65
|
+
/** @deprecated 0.33 — pass `tone`, or `paint` for an exception; removed in 0.35.
|
|
66
|
+
* Background utility class while the action is previewed but not yet armed; the
|
|
67
|
+
* panel is dimmed then, and its text is white unless this sets a text colour. */
|
|
80
68
|
className: string;
|
|
81
|
-
/** @deprecated 0.33 — pass `tone`, or `paint
|
|
82
|
-
* the drag has passed this action's threshold. */
|
|
69
|
+
/** @deprecated 0.33 — pass `tone`, or `paint`; removed in 0.35. Background
|
|
70
|
+
* utility class once the drag has passed this action's threshold. */
|
|
83
71
|
armedClassName: string;
|
|
84
72
|
});
|
|
85
73
|
/**
|
|
@@ -90,7 +78,7 @@ type SwipeAction = SwipeActionBase & ({
|
|
|
90
78
|
* fill's own foreground. Measured in every shipped preset by
|
|
91
79
|
* theme/__tests__/tokens-css-audit.test.ts.
|
|
92
80
|
*/
|
|
93
|
-
declare const SWIPE_TONE: Record<SwipeTone, {
|
|
81
|
+
export declare const SWIPE_TONE: Record<SwipeTone, {
|
|
94
82
|
idle: string;
|
|
95
83
|
armed: string;
|
|
96
84
|
}>;
|
|
@@ -103,7 +91,7 @@ declare const SWIPE_TONE: Record<SwipeTone, {
|
|
|
103
91
|
* reveal panel's contents hug the physical edge being uncovered, and the keyboard
|
|
104
92
|
* buttons sit at the row's logical END.
|
|
105
93
|
*/
|
|
106
|
-
interface SwipeableRowProps {
|
|
94
|
+
export interface SwipeableRowProps {
|
|
107
95
|
/** Actions committed by dragging (physically) RIGHT, nearest threshold first. */
|
|
108
96
|
right?: SwipeAction[];
|
|
109
97
|
/** Actions committed by dragging (physically) LEFT, nearest threshold first. */
|
|
@@ -162,6 +150,5 @@ interface SwipeableRowProps {
|
|
|
162
150
|
* the eye and not from the accessibility tree, so the row also ANNOUNCES what can be
|
|
163
151
|
* done to it rather than keeping it behind a gesture nobody can hear.
|
|
164
152
|
*/
|
|
165
|
-
declare function SwipeableRow({ right, left, enabled, actionsLabel, className, children, }: SwipeableRowProps): react.JSX.Element;
|
|
166
|
-
|
|
167
|
-
export { SWIPE_TONE, type SwipeAction, type SwipePaint, type SwipeTone, SwipeableRow, type SwipeableRowProps };
|
|
153
|
+
export declare function SwipeableRow({ right, left, enabled, actionsLabel, className, children, }: SwipeableRowProps): import("react").JSX.Element;
|
|
154
|
+
export {};
|
|
@@ -137,7 +137,7 @@ function SwipeableRow({
|
|
|
137
137
|
e.stopPropagation();
|
|
138
138
|
},
|
|
139
139
|
className: cn(
|
|
140
|
-
"relative bg-
|
|
140
|
+
"relative bg-surface",
|
|
141
141
|
// A mouse drag is a supported way to swipe (use-row-swipe gates only on
|
|
142
142
|
// the button, not the pointer type), and a horizontal mouse drag over
|
|
143
143
|
// text also SELECTS that text — so committing an action left the row
|
|
@@ -165,7 +165,7 @@ function SwipeableRow({
|
|
|
165
165
|
type: "button",
|
|
166
166
|
onClick: action.onCommit,
|
|
167
167
|
className: cn(
|
|
168
|
-
"sr-only whitespace-nowrap rounded-md border-
|
|
168
|
+
"sr-only whitespace-nowrap rounded-md border-subtle bg-surface text-xs font-medium text-primary shadow-sm",
|
|
169
169
|
"focus:not-sr-only focus:pointer-events-auto focus:inline-flex focus:items-center focus:gap-1.5",
|
|
170
170
|
// The box's padding and border only once it shows (0.32.1, keksdose's
|
|
171
171
|
// 0.32 report). Unconditional, `px-2` and `border` beat `sr-only`'s
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/swipeable-row.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport type { StatusDotTone } from \"./status-dot\";\nimport { useRowSwipe, type SwipeStage } from \"../hooks/use-row-swipe\";\nimport { DEFAULT_SWIPEABLE_ROW_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/**\n * What a swipe action's panel means — the vocabulary Chip, ProgressBar and StatusDot\n * already share, so a curtain can be \"the colour of the status it produces\" by name:\n * brand, neutral, success, warning, danger, info, income, expense, and the categorical\n * hues blue, indigo, purple, teal and orange.\n */\nexport type SwipeTone = StatusDotTone;\n\n/**\n * An app's own fill for a documented exception (0.33, docs/colour-roles-harmonization.md\n * §12.6) — a curtain that must be exactly its status pill's palette fill, or two\n * strengths of one tone. CSS colours or `var()`s, the same in both themes unless the app\n * passes a variable it declares per theme in its own stylesheet. The kit cannot measure\n * these, so the app's tests pin the pair.\n */\nexport interface SwipePaint {\n /** The armed panel's fill; idle shows a 14 % wash of it on the card. */\n fill: string;\n /** The text and icon colour ON `fill`, armed. Idle text is the body ink. */\n foreground: string;\n}\n\ninterface SwipeActionBase {\n onCommit: () => void;\n label: string;\n /** Rendered inside the panel. Icons stay the consumer's choice — this package\n * ships no opinion about which icon set an app uses. */\n icon?: ReactNode;\n}\n\n/**\n * One armed swipe action: what it does, and how the reveal panel presents it.\n *\n * The panel has two states. Before the first threshold is crossed it previews the\n * nearest action IDLE, so the user can see what a little more drag will do; crossing\n * the threshold ARMS it — \"let go and this fires\".\n *\n * **`tone`** (0.33) is how the kit paints it: idle, the tone's soft wash under the\n * tone's own text colour (`bg-danger-soft text-danger`, Chip's soft look, ≥ 4.5:1);\n * armed, the tone's solid fill under its `-contrast` foreground (≥ 5:1). The soft→solid\n * step is the signal. It replaces a panel dimmed to 60 % at idle, whose label sat at\n * 2.4–4.5:1 on the kit's own swipes, and a white label that was unreadable on every\n * dark-mode pastel.\n *\n * **`paint`** follows the same rule for an app's documented exception (see\n * {@link SwipePaint}). **`className` / `armedClassName`** is the old path, kept so\n * existing call sites compile; there the label is white unless the classes set a\n * colour, and the idle panel is still dimmed.\n */\nexport type SwipeAction = SwipeActionBase &\n (\n | {\n /** The kit paints the panel: the tone's wash idle, its fill and `-contrast` armed. */\n tone: SwipeTone;\n paint?: never;\n className?: never;\n armedClassName?: never;\n }\n | {\n /** A documented app exception: idle a 14 % wash of `fill` under the body ink,\n * armed `fill` under `foreground`. */\n paint: SwipePaint;\n tone?: never;\n className?: never;\n armedClassName?: never;\n }\n | {\n tone?: never;\n paint?: never;\n /** @deprecated 0.33 — pass `tone`, or `paint` for an exception. Background\n * utility class while the action is previewed but not yet armed; the panel is\n * dimmed then, and its text is white unless this sets a text colour. */\n className: string;\n /** @deprecated 0.33 — pass `tone`, or `paint`. Background utility class once\n * the drag has passed this action's threshold. */\n armedClassName: string;\n }\n );\n\n/**\n * Each tone's panel, idle and armed. Literal class strings, because Tailwind finds a\n * class by reading the source. Idle is Chip's soft recipe for the tone (the money pair\n * takes Chip's soft money look, the well under the money colour; neutral the active\n * fill under the secondary ink); armed is the plain fill, not `-hover`, under the\n * fill's own foreground. Measured in every shipped preset by\n * theme/__tests__/tokens-css-audit.test.ts.\n */\nexport const SWIPE_TONE: Record<SwipeTone, { idle: string; armed: string }> = {\n brand: { idle: \"bg-brand-soft text-brand-muted\", armed: \"bg-brand text-brand-contrast\" },\n neutral: { idle: \"bg-active text-secondary\", armed: \"bg-neutral text-neutral-contrast\" },\n success: { idle: \"bg-success-soft text-success\", armed: \"bg-success text-success-contrast\" },\n warning: { idle: \"bg-warning-soft text-warning\", armed: \"bg-warning text-warning-contrast\" },\n danger: { idle: \"bg-danger-soft text-danger\", armed: \"bg-danger text-danger-contrast\" },\n info: { idle: \"bg-info-soft text-info\", armed: \"bg-info text-info-contrast\" },\n income: { idle: \"bg-surface-2 text-money-pos\", armed: \"bg-money-pos text-money-income-contrast\" },\n expense: { idle: \"bg-surface-2 text-money-neg\", armed: \"bg-money-neg text-money-expense-contrast\" },\n blue: { idle: \"bg-hue-blue-soft text-hue-blue\", armed: \"bg-hue-blue text-hue-blue-contrast\" },\n indigo: { idle: \"bg-hue-indigo-soft text-hue-indigo\", armed: \"bg-hue-indigo text-hue-indigo-contrast\" },\n purple: { idle: \"bg-hue-purple-soft text-hue-purple\", armed: \"bg-hue-purple text-hue-purple-contrast\" },\n teal: { idle: \"bg-hue-teal-soft text-hue-teal\", armed: \"bg-hue-teal text-hue-teal-contrast\" },\n orange: { idle: \"bg-hue-orange-soft text-hue-orange\", armed: \"bg-hue-orange text-hue-orange-contrast\" },\n};\n\n/** `paint`'s two looks, from the two custom properties the panel carries inline. The\n * idle wash is `--brand-bg`'s recipe (14 % of the fill into the card). */\nconst PAINT_IDLE = \"bg-[color-mix(in_oklab,var(--swipe-paint-fill)_14%,var(--bg-surface))] text-primary\";\nconst PAINT_ARMED = \"bg-[var(--swipe-paint-fill)] text-[var(--swipe-paint-fg)]\";\n\n/** The panel's colour classes, inline style and dimming for one action and state. */\nfunction panelLook(action: SwipeAction, armed: boolean): { className: string; style?: CSSProperties; dim: boolean } {\n if (action.tone) return { className: SWIPE_TONE[action.tone][armed ? \"armed\" : \"idle\"], dim: false };\n if (action.paint) {\n return {\n className: armed ? PAINT_ARMED : PAINT_IDLE,\n style: {\n \"--swipe-paint-fill\": action.paint.fill,\n \"--swipe-paint-fg\": action.paint.foreground,\n } as CSSProperties,\n dim: false,\n };\n }\n // The deprecated path, as it was: white text under the caller's fill, dimmed idle.\n return { className: cn(\"text-white\", armed ? action.armedClassName : action.className), dim: !armed };\n}\n\n/**\n * `right`/`left` are PHYSICAL drag directions in every writing direction, and stay so on\n * purpose: a swipe is a movement of the finger across the glass, the gesture hook\n * measures it in screen pixels, and \"which way is destructive\" is an app decision that\n * RTL guidelines do not agree on. An app that wants mirrored actions in RTL swaps the\n * two arrays itself. What the component does mirror is everything it lays out: the\n * reveal panel's contents hug the physical edge being uncovered, and the keyboard\n * buttons sit at the row's logical END.\n */\nexport interface SwipeableRowProps {\n /** Actions committed by dragging (physically) RIGHT, nearest threshold first. */\n right?: SwipeAction[];\n /** Actions committed by dragging (physically) LEFT, nearest threshold first. */\n left?: SwipeAction[];\n /** Turn the gesture off — an open editor, a pending mutation, a locked row. This\n * also withdraws the keyboard buttons below: a row that must not be acted on must\n * not be actionable by ANY input. */\n enabled?: boolean;\n /** Names the revealed action buttons as a set (\"Row actions\"), for a reader that\n * reaches the group before it reaches any one button. Default:\n * `swipeableRow.actions` from the {@link UiKitProvider}, else English. */\n actionsLabel?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** How much of the row stays on screen at full drag. A row that can be pulled\n * entirely off its own track reads as already deleted, and there is nothing left to\n * drag back; a sliver keeps the gesture reversible and the row identifiable. */\nconst PEEK_PX = 40;\n\n/**\n * A row whose horizontal drag reveals actions underneath it.\n *\n * The reveal panel spans the FULL row width (Keksdose feedback #174). It used to be\n * two half-width blocks side by side, which capped the drag at half the row so the\n * opposite panel could never be exposed — and on a row bound to three actions that\n * left ~55px between stages on a phone, close enough that the wrong one committed.\n * Only the side being dragged toward is painted now, so full width costs nothing:\n * at rest the content covers both anyway, and a drag only ever reveals one side.\n *\n * Thresholds are still not fixed pixel values — they are spread evenly across the\n * available drag, which is now the row width less a {@link PEEK_PX} sliver. A fixed\n * 72/150/228px ladder overshoots a narrow phone; a proportional one keeps every\n * action reachable and roughly doubles the room between them.\n *\n * **Whether the action will fire is stated three ways, not one** (feedback #174): the\n * panel goes from the tone's soft wash to its solid fill, the icon grows and gains a\n * filled disc, and the label turns bold — plus the existing haptic tick per newly armed\n * stage. A colour\n * shift alone is easy to miss mid-gesture, and it is invisible to anyone who cannot\n * distinguish the two tones.\n *\n * Clicks that follow a drag are swallowed in the capture phase: without that, a swipe\n * would also fire whatever click handler the row content carries (expanding it, opening\n * a dialog) on top of the action it just committed.\n *\n * ## The keyboard path is buttons, and deliberately not a typed gesture\n *\n * Every action here used to live exclusively inside a pointer drag — `onCommit` had no\n * other caller — so with a keyboard, with a screen reader, or on any input that cannot\n * express 120px of horizontal travel, the row's actions did not exist at all. That is\n * not a rough edge on a phone control: {@link DataTable} mounts this for every row of\n * its mobile layout, and the actions an app puts here are its destructive ones.\n *\n * The rejected fix was to map the gesture onto keys — arrows nudging `dx`, a chord that\n * \"swipes\". That invents a private idiom with nothing to discover it by, and it makes\n * the keyboard imitate a touchscreen instead of doing the job the touchscreen is doing.\n * So each action is ALSO a real button, `sr-only` until it takes focus and then shown at\n * the row's trailing edge, firing the identical `onCommit`: one definition of what an\n * action is, two ways to reach it, and nothing to drift apart. `sr-only` hides from\n * the eye and not from the accessibility tree, so the row also ANNOUNCES what can be\n * done to it rather than keeping it behind a gesture nobody can hear.\n */\nexport function SwipeableRow({\n right,\n left,\n enabled = true,\n actionsLabel,\n className,\n children,\n}: SwipeableRowProps) {\n const labels = useKitLabels(\"swipeableRow\", DEFAULT_SWIPEABLE_ROW_LABELS, {\n actions: actionsLabel,\n });\n const rowRef = useRef<HTMLDivElement>(null);\n const [rowWidth, setRowWidth] = useState(0);\n useEffect(() => {\n const el = rowRef.current;\n if (!el) return;\n setRowWidth(el.clientWidth);\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver((entries) => {\n for (const e of entries) setRowWidth(e.contentRect.width);\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const rightActions = right ?? [];\n const leftActions = left ?? [];\n const active = enabled && (rightActions.length > 0 || leftActions.length > 0);\n // The whole row less a sliver, not half of it (feedback #174). `Math.max` keeps a\n // very narrow row (or one measured before layout) from producing a zero or\n // negative drag, which would arm every stage at once.\n const maxDrag = rowWidth > 0 ? Math.max(96, Math.round(rowWidth - PEEK_PX)) : 200;\n const spread = (actions: SwipeAction[]): SwipeStage[] =>\n actions.map((a, i) => ({\n threshold: Math.round((maxDrag * (i + 1)) / (actions.length + 1)),\n onCommit: a.onCommit,\n }));\n\n const swipe = useRowSwipe({\n enabled: active,\n rightStages: spread(rightActions),\n leftStages: spread(leftActions),\n maxDrag,\n });\n\n // A haptic tick per newly armed threshold, so each stage is felt and not only seen.\n const armedNow = swipe.dx >= 0 ? swipe.armedRightIndex : swipe.armedLeftIndex;\n const prevArmed = useRef(-1);\n useEffect(() => {\n if (armedNow > prevArmed.current && armedNow >= 0) navigator.vibrate?.(12);\n prevArmed.current = armedNow;\n }, [armedNow]);\n\n // Index -1 (nothing armed yet) still previews the nearest action, idle-coloured.\n const dx = swipe.dx;\n // Only the side being dragged toward is painted, which is what makes a full-width\n // panel safe.\n //\n // The side has to SURVIVE the release, though, and that is what this ref is for\n // (Keksdose feedback dev#467): *\"Swiping a category to the left with no option — if\n // letting it go it gets, for the way back, the background color of the opposite\n // swipe direction where there should be no color change at all.\"* On release dx\n // snaps to 0 while the row itself slides back over 150ms, so a plain `dx < 0` read\n // \"right\" for exactly the frames where the left side was still uncovered — and\n // painted the RIGHT action's colour into the gap. With no left action at all that\n // colour was the only thing the gesture ever showed.\n //\n // Adjusted during render rather than in an effect: an effect would repaint a frame\n // later (visibly, at 150ms). State set while rendering re-renders this component\n // before anything is committed, so the released frame already has the right side.\n const [lastSide, setLastSide] = useState<\"left\" | \"right\">(\"right\");\n const side = dx === 0 ? null : dx < 0 ? \"left\" : \"right\";\n if (side && side !== lastSide) setLastSide(side);\n const draggingLeft = side ? side === \"left\" : lastSide === \"left\";\n const shown = draggingLeft\n ? leftActions[Math.max(0, swipe.armedLeftIndex)]\n : rightActions[Math.max(0, swipe.armedRightIndex)];\n const armed = draggingLeft ? swipe.armedLeftIndex >= 0 : swipe.armedRightIndex >= 0;\n const look = shown ? panelLook(shown, armed) : null;\n\n return (\n <div ref={rowRef} className={cn(\"relative overflow-hidden\", className)}>\n {/* The card under the panel. A dark theme's washes are translucent, and a tone's\n idle pair is measured as that wash ON the card — so the card is there, whatever\n the row happens to sit in. */}\n {active && shown && <div aria-hidden className=\"pointer-events-none absolute inset-0 bg-surface\" />}\n {active && shown && look && (\n <div\n className={cn(\n \"pointer-events-none absolute inset-0 flex items-center gap-2 px-4\",\n \"text-xs font-medium transition-all\",\n look.className,\n // The old path only: dimmed until the drag has passed a threshold. A tone\n // or a paint says it with the soft→solid step instead, which keeps its\n // label readable at both ends.\n look.dim && \"opacity-60\",\n // The panel is anchored to the edge the row is uncovering, so the label\n // sits where the eye already is rather than across the screen. That edge is\n // physical, while a flex row starts at the INLINE start — so in RTL the two\n // directions swap, or the label sat under the row on the covered side.\n draggingLeft ? \"flex-row-reverse rtl:flex-row\" : \"rtl:flex-row-reverse\",\n )}\n style={look.style}\n >\n {shown.icon && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-full transition-all\",\n // Armed, the icon gets a disc of its own and grows — a second,\n // non-colour signal, and the one that stays readable at a glance. In\n // the label's own colour (0.33): a white disc vanished on a dark\n // theme's pastel fill, and the label's colour works on every pair.\n armed ? \"size-8 scale-110 bg-current/20\" : \"size-7 bg-current/10\",\n )}\n >\n {shown.icon}\n </span>\n )}\n <span className={cn(\"truncate transition-all\", armed && \"text-sm font-semibold\")}>\n {shown.label}\n </span>\n </div>\n )}\n <div\n // Capture phase: the row's own click handler lives on a DESCENDANT, so a\n // bubble-phase listener here would run after it — too late to suppress.\n onClickCapture={(e) => {\n if (!swipe.consumeClick()) return;\n e.preventDefault();\n e.stopPropagation();\n }}\n className={cn(\n \"relative bg-[var(--bg-surface)]\",\n // A mouse drag is a supported way to swipe (use-row-swipe gates only on\n // the button, not the pointer type), and a horizontal mouse drag over\n // text also SELECTS that text — so committing an action left the row\n // highlighted blue. Suppressed only while dragging, so text in a row at\n // rest stays selectable.\n swipe.dragging ? \"select-none\" : \"transition-transform duration-150 motion-reduce:transition-none\",\n )}\n style={{\n transform: dx !== 0 ? `translate3d(${dx}px,0,0)` : undefined,\n touchAction: active ? \"pan-y\" : undefined,\n }}\n {...(active ? swipe.handlers : {})}\n >\n {children}\n </div>\n {active && (\n <div\n role=\"group\"\n aria-label={labels.actions}\n // OUTSIDE the sliding div on purpose: an action that travels with the row it\n // acts on is a moving target, and the drag transform would carry it off the\n // screen mid-gesture.\n //\n // `pointer-events-none` here, restored on a button only once it HAS focus: a\n // sr-only button is clipped to nothing but is still a hit target, and this\n // strip sits at the row's trailing edge — exactly where a drag toward the\n // start begins.\n //\n // `end-0`/`pe-2`, not `right-0`/`pr-2`: in RTL the right edge is where the\n // row's title starts, and a focused button there covered it.\n // A gesture that silently failed to start because it landed on an invisible\n // button is not a bug anyone would find by looking at the screen.\n className=\"pointer-events-none absolute inset-y-0 end-0 z-10 flex items-center gap-1 pe-2\"\n >\n {/* Both sides, each still nearest-threshold first, so the tab order reads in\n the order the gesture arms them. */}\n {[...rightActions, ...leftActions].map((action, i) => (\n <button\n key={`${action.label}-${i}`}\n type=\"button\"\n onClick={action.onCommit}\n className={cn(\n \"sr-only whitespace-nowrap rounded-md border-[var(--border)] bg-[var(--bg-surface)] text-xs font-medium text-[var(--text-primary)] shadow-sm\",\n \"focus:not-sr-only focus:pointer-events-auto focus:inline-flex focus:items-center focus:gap-1.5\",\n // The box's padding and border only once it shows (0.32.1, keksdose's\n // 0.32 report). Unconditional, `px-2` and `border` beat `sr-only`'s\n // `padding: 0` and `border-width: 0`, so the hidden button was a 1 px\n // box with 2 × 0.5rem of padding round it: 26 px at Extra large, running\n // past the row's end from the strip's start — invisible under its clip,\n // but counted in the page's scroll width (§4: nothing overflows).\n \"focus:border focus:px-2 focus:py-1\",\n FOCUS_RING,\n )}\n >\n {/* The label is the button's accessible name, so the caller's icon is\n decoration on top of it rather than a second reading of it. */}\n {action.icon && (\n <span aria-hidden=\"true\" className=\"[&_svg]:size-4\">\n {action.icon}\n </span>\n )}\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAoS0B,cAElB,YAFkB;AApS1B,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAE3B,SAAS,mBAAoC;AAC7C,SAAS,8BAA8B,oBAAoB;AAyFpD,MAAM,aAAiE;AAAA,EAC5E,OAAO,EAAE,MAAM,kCAAkC,OAAO,+BAA+B;AAAA,EACvF,SAAS,EAAE,MAAM,4BAA4B,OAAO,mCAAmC;AAAA,EACvF,SAAS,EAAE,MAAM,gCAAgC,OAAO,mCAAmC;AAAA,EAC3F,SAAS,EAAE,MAAM,gCAAgC,OAAO,mCAAmC;AAAA,EAC3F,QAAQ,EAAE,MAAM,8BAA8B,OAAO,iCAAiC;AAAA,EACtF,MAAM,EAAE,MAAM,0BAA0B,OAAO,6BAA6B;AAAA,EAC5E,QAAQ,EAAE,MAAM,+BAA+B,OAAO,0CAA0C;AAAA,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ACL,cAAY,OAAO;AAAA,QAcnB,WAAU;AAAA,QAIT,WAAC,GAAG,cAAc,GAAG,WAAW,EAAE,IAAI,CAAC,QAAQ,MAC9C;AAAA,UAAC;AAAA;AAAA,YAEC,MAAK;AAAA,YACL,SAAS,OAAO;AAAA,YAChB,WAAW;AAAA,cACT;AAAA,cACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAOA;AAAA,cACA;AAAA,YACF;AAAA,YAIC;AAAA,qBAAO,QACN,oBAAC,UAAK,eAAY,QAAO,WAAU,kBAChC,iBAAO,MACV;AAAA,cAED,OAAO;AAAA;AAAA;AAAA,UAvBH,GAAG,OAAO,KAAK,IAAI,CAAC;AAAA,QAwB3B,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/swipeable-row.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from \"react\";\nimport type { CSSProperties, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport type { StatusDotTone } from \"./status-dot\";\nimport { useRowSwipe, type SwipeStage } from \"../hooks/use-row-swipe\";\nimport { DEFAULT_SWIPEABLE_ROW_LABELS, useKitLabels } from \"../i18n/kit-labels\";\n\n/**\n * What a swipe action's panel means — the vocabulary Chip, ProgressBar and StatusDot\n * already share, so a curtain can be \"the colour of the status it produces\" by name:\n * brand, neutral, success, warning, danger, info, income, expense, and the categorical\n * hues blue, indigo, purple, teal and orange.\n */\nexport type SwipeTone = StatusDotTone;\n\n/**\n * An app's own fill for a documented exception (0.33, docs/colour-roles-harmonization.md\n * §12.6) — a curtain that must be exactly its status pill's palette fill, or two\n * strengths of one tone. CSS colours or `var()`s, the same in both themes unless the app\n * passes a variable it declares per theme in its own stylesheet. The kit cannot measure\n * these, so the app's tests pin the pair.\n */\nexport interface SwipePaint {\n /** The armed panel's fill; idle shows a 14 % wash of it on the card. */\n fill: string;\n /** The text and icon colour ON `fill`, armed. Idle text is the body ink. */\n foreground: string;\n}\n\ninterface SwipeActionBase {\n onCommit: () => void;\n label: string;\n /** Rendered inside the panel. Icons stay the consumer's choice — this package\n * ships no opinion about which icon set an app uses. */\n icon?: ReactNode;\n}\n\n/**\n * One armed swipe action: what it does, and how the reveal panel presents it.\n *\n * The panel has two states. Before the first threshold is crossed it previews the\n * nearest action IDLE, so the user can see what a little more drag will do; crossing\n * the threshold ARMS it — \"let go and this fires\".\n *\n * **`tone`** (0.33) is how the kit paints it: idle, the tone's soft wash under the\n * tone's own text colour (`bg-danger-soft text-danger`, Chip's soft look, ≥ 4.5:1);\n * armed, the tone's solid fill under its `-contrast` foreground (≥ 5:1). The soft→solid\n * step is the signal. It replaces a panel dimmed to 60 % at idle, whose label sat at\n * 2.4–4.5:1 on the kit's own swipes, and a white label that was unreadable on every\n * dark-mode pastel.\n *\n * **`paint`** follows the same rule for an app's documented exception (see\n * {@link SwipePaint}). **`className` / `armedClassName`** is the old path, kept so\n * existing call sites compile; there the label is white unless the classes set a\n * colour, and the idle panel is still dimmed.\n */\nexport type SwipeAction = SwipeActionBase &\n (\n | {\n /** The kit paints the panel: the tone's wash idle, its fill and `-contrast` armed. */\n tone: SwipeTone;\n paint?: never;\n className?: never;\n armedClassName?: never;\n }\n | {\n /** A documented app exception: idle a 14 % wash of `fill` under the body ink,\n * armed `fill` under `foreground`. */\n paint: SwipePaint;\n tone?: never;\n className?: never;\n armedClassName?: never;\n }\n | {\n tone?: never;\n paint?: never;\n /** @deprecated 0.33 — pass `tone`, or `paint` for an exception; removed in 0.35.\n * Background utility class while the action is previewed but not yet armed; the\n * panel is dimmed then, and its text is white unless this sets a text colour. */\n className: string;\n /** @deprecated 0.33 — pass `tone`, or `paint`; removed in 0.35. Background\n * utility class once the drag has passed this action's threshold. */\n armedClassName: string;\n }\n );\n\n/**\n * Each tone's panel, idle and armed. Literal class strings, because Tailwind finds a\n * class by reading the source. Idle is Chip's soft recipe for the tone (the money pair\n * takes Chip's soft money look, the well under the money colour; neutral the active\n * fill under the secondary ink); armed is the plain fill, not `-hover`, under the\n * fill's own foreground. Measured in every shipped preset by\n * theme/__tests__/tokens-css-audit.test.ts.\n */\nexport const SWIPE_TONE: Record<SwipeTone, { idle: string; armed: string }> = {\n brand: { idle: \"bg-brand-soft text-brand-muted\", armed: \"bg-brand text-brand-contrast\" },\n neutral: { idle: \"bg-active text-secondary\", armed: \"bg-neutral text-neutral-contrast\" },\n success: { idle: \"bg-success-soft text-success\", armed: \"bg-success text-success-contrast\" },\n warning: { idle: \"bg-warning-soft text-warning\", armed: \"bg-warning text-warning-contrast\" },\n danger: { idle: \"bg-danger-soft text-danger\", armed: \"bg-danger text-danger-contrast\" },\n info: { idle: \"bg-info-soft text-info\", armed: \"bg-info text-info-contrast\" },\n income: { idle: \"bg-surface-2 text-money-pos\", armed: \"bg-money-pos text-money-income-contrast\" },\n expense: { idle: \"bg-surface-2 text-money-neg\", armed: \"bg-money-neg text-money-expense-contrast\" },\n blue: { idle: \"bg-hue-blue-soft text-hue-blue\", armed: \"bg-hue-blue text-hue-blue-contrast\" },\n indigo: { idle: \"bg-hue-indigo-soft text-hue-indigo\", armed: \"bg-hue-indigo text-hue-indigo-contrast\" },\n purple: { idle: \"bg-hue-purple-soft text-hue-purple\", armed: \"bg-hue-purple text-hue-purple-contrast\" },\n teal: { idle: \"bg-hue-teal-soft text-hue-teal\", armed: \"bg-hue-teal text-hue-teal-contrast\" },\n orange: { idle: \"bg-hue-orange-soft text-hue-orange\", armed: \"bg-hue-orange text-hue-orange-contrast\" },\n};\n\n/** `paint`'s two looks, from the two custom properties the panel carries inline. The\n * idle wash is `--brand-bg`'s recipe (14 % of the fill into the card). */\nconst PAINT_IDLE = \"bg-[color-mix(in_oklab,var(--swipe-paint-fill)_14%,var(--bg-surface))] text-primary\";\nconst PAINT_ARMED = \"bg-[var(--swipe-paint-fill)] text-[var(--swipe-paint-fg)]\";\n\n/** The panel's colour classes, inline style and dimming for one action and state. */\nfunction panelLook(action: SwipeAction, armed: boolean): { className: string; style?: CSSProperties; dim: boolean } {\n if (action.tone) return { className: SWIPE_TONE[action.tone][armed ? \"armed\" : \"idle\"], dim: false };\n if (action.paint) {\n return {\n className: armed ? PAINT_ARMED : PAINT_IDLE,\n style: {\n \"--swipe-paint-fill\": action.paint.fill,\n \"--swipe-paint-fg\": action.paint.foreground,\n } as CSSProperties,\n dim: false,\n };\n }\n // The deprecated path, as it was: white text under the caller's fill, dimmed idle.\n return { className: cn(\"text-white\", armed ? action.armedClassName : action.className), dim: !armed };\n}\n\n/**\n * `right`/`left` are PHYSICAL drag directions in every writing direction, and stay so on\n * purpose: a swipe is a movement of the finger across the glass, the gesture hook\n * measures it in screen pixels, and \"which way is destructive\" is an app decision that\n * RTL guidelines do not agree on. An app that wants mirrored actions in RTL swaps the\n * two arrays itself. What the component does mirror is everything it lays out: the\n * reveal panel's contents hug the physical edge being uncovered, and the keyboard\n * buttons sit at the row's logical END.\n */\nexport interface SwipeableRowProps {\n /** Actions committed by dragging (physically) RIGHT, nearest threshold first. */\n right?: SwipeAction[];\n /** Actions committed by dragging (physically) LEFT, nearest threshold first. */\n left?: SwipeAction[];\n /** Turn the gesture off — an open editor, a pending mutation, a locked row. This\n * also withdraws the keyboard buttons below: a row that must not be acted on must\n * not be actionable by ANY input. */\n enabled?: boolean;\n /** Names the revealed action buttons as a set (\"Row actions\"), for a reader that\n * reaches the group before it reaches any one button. Default:\n * `swipeableRow.actions` from the {@link UiKitProvider}, else English. */\n actionsLabel?: string;\n className?: string;\n children: ReactNode;\n}\n\n/** How much of the row stays on screen at full drag. A row that can be pulled\n * entirely off its own track reads as already deleted, and there is nothing left to\n * drag back; a sliver keeps the gesture reversible and the row identifiable. */\nconst PEEK_PX = 40;\n\n/**\n * A row whose horizontal drag reveals actions underneath it.\n *\n * The reveal panel spans the FULL row width (Keksdose feedback #174). It used to be\n * two half-width blocks side by side, which capped the drag at half the row so the\n * opposite panel could never be exposed — and on a row bound to three actions that\n * left ~55px between stages on a phone, close enough that the wrong one committed.\n * Only the side being dragged toward is painted now, so full width costs nothing:\n * at rest the content covers both anyway, and a drag only ever reveals one side.\n *\n * Thresholds are still not fixed pixel values — they are spread evenly across the\n * available drag, which is now the row width less a {@link PEEK_PX} sliver. A fixed\n * 72/150/228px ladder overshoots a narrow phone; a proportional one keeps every\n * action reachable and roughly doubles the room between them.\n *\n * **Whether the action will fire is stated three ways, not one** (feedback #174): the\n * panel goes from the tone's soft wash to its solid fill, the icon grows and gains a\n * filled disc, and the label turns bold — plus the existing haptic tick per newly armed\n * stage. A colour\n * shift alone is easy to miss mid-gesture, and it is invisible to anyone who cannot\n * distinguish the two tones.\n *\n * Clicks that follow a drag are swallowed in the capture phase: without that, a swipe\n * would also fire whatever click handler the row content carries (expanding it, opening\n * a dialog) on top of the action it just committed.\n *\n * ## The keyboard path is buttons, and deliberately not a typed gesture\n *\n * Every action here used to live exclusively inside a pointer drag — `onCommit` had no\n * other caller — so with a keyboard, with a screen reader, or on any input that cannot\n * express 120px of horizontal travel, the row's actions did not exist at all. That is\n * not a rough edge on a phone control: {@link DataTable} mounts this for every row of\n * its mobile layout, and the actions an app puts here are its destructive ones.\n *\n * The rejected fix was to map the gesture onto keys — arrows nudging `dx`, a chord that\n * \"swipes\". That invents a private idiom with nothing to discover it by, and it makes\n * the keyboard imitate a touchscreen instead of doing the job the touchscreen is doing.\n * So each action is ALSO a real button, `sr-only` until it takes focus and then shown at\n * the row's trailing edge, firing the identical `onCommit`: one definition of what an\n * action is, two ways to reach it, and nothing to drift apart. `sr-only` hides from\n * the eye and not from the accessibility tree, so the row also ANNOUNCES what can be\n * done to it rather than keeping it behind a gesture nobody can hear.\n */\nexport function SwipeableRow({\n right,\n left,\n enabled = true,\n actionsLabel,\n className,\n children,\n}: SwipeableRowProps) {\n const labels = useKitLabels(\"swipeableRow\", DEFAULT_SWIPEABLE_ROW_LABELS, {\n actions: actionsLabel,\n });\n const rowRef = useRef<HTMLDivElement>(null);\n const [rowWidth, setRowWidth] = useState(0);\n useEffect(() => {\n const el = rowRef.current;\n if (!el) return;\n setRowWidth(el.clientWidth);\n if (typeof ResizeObserver === \"undefined\") return;\n const ro = new ResizeObserver((entries) => {\n for (const e of entries) setRowWidth(e.contentRect.width);\n });\n ro.observe(el);\n return () => ro.disconnect();\n }, []);\n\n const rightActions = right ?? [];\n const leftActions = left ?? [];\n const active = enabled && (rightActions.length > 0 || leftActions.length > 0);\n // The whole row less a sliver, not half of it (feedback #174). `Math.max` keeps a\n // very narrow row (or one measured before layout) from producing a zero or\n // negative drag, which would arm every stage at once.\n const maxDrag = rowWidth > 0 ? Math.max(96, Math.round(rowWidth - PEEK_PX)) : 200;\n const spread = (actions: SwipeAction[]): SwipeStage[] =>\n actions.map((a, i) => ({\n threshold: Math.round((maxDrag * (i + 1)) / (actions.length + 1)),\n onCommit: a.onCommit,\n }));\n\n const swipe = useRowSwipe({\n enabled: active,\n rightStages: spread(rightActions),\n leftStages: spread(leftActions),\n maxDrag,\n });\n\n // A haptic tick per newly armed threshold, so each stage is felt and not only seen.\n const armedNow = swipe.dx >= 0 ? swipe.armedRightIndex : swipe.armedLeftIndex;\n const prevArmed = useRef(-1);\n useEffect(() => {\n if (armedNow > prevArmed.current && armedNow >= 0) navigator.vibrate?.(12);\n prevArmed.current = armedNow;\n }, [armedNow]);\n\n // Index -1 (nothing armed yet) still previews the nearest action, idle-coloured.\n const dx = swipe.dx;\n // Only the side being dragged toward is painted, which is what makes a full-width\n // panel safe.\n //\n // The side has to SURVIVE the release, though, and that is what this ref is for\n // (Keksdose feedback dev#467): *\"Swiping a category to the left with no option — if\n // letting it go it gets, for the way back, the background color of the opposite\n // swipe direction where there should be no color change at all.\"* On release dx\n // snaps to 0 while the row itself slides back over 150ms, so a plain `dx < 0` read\n // \"right\" for exactly the frames where the left side was still uncovered — and\n // painted the RIGHT action's colour into the gap. With no left action at all that\n // colour was the only thing the gesture ever showed.\n //\n // Adjusted during render rather than in an effect: an effect would repaint a frame\n // later (visibly, at 150ms). State set while rendering re-renders this component\n // before anything is committed, so the released frame already has the right side.\n const [lastSide, setLastSide] = useState<\"left\" | \"right\">(\"right\");\n const side = dx === 0 ? null : dx < 0 ? \"left\" : \"right\";\n if (side && side !== lastSide) setLastSide(side);\n const draggingLeft = side ? side === \"left\" : lastSide === \"left\";\n const shown = draggingLeft\n ? leftActions[Math.max(0, swipe.armedLeftIndex)]\n : rightActions[Math.max(0, swipe.armedRightIndex)];\n const armed = draggingLeft ? swipe.armedLeftIndex >= 0 : swipe.armedRightIndex >= 0;\n const look = shown ? panelLook(shown, armed) : null;\n\n return (\n <div ref={rowRef} className={cn(\"relative overflow-hidden\", className)}>\n {/* The card under the panel. A dark theme's washes are translucent, and a tone's\n idle pair is measured as that wash ON the card — so the card is there, whatever\n the row happens to sit in. */}\n {active && shown && <div aria-hidden className=\"pointer-events-none absolute inset-0 bg-surface\" />}\n {active && shown && look && (\n <div\n className={cn(\n \"pointer-events-none absolute inset-0 flex items-center gap-2 px-4\",\n \"text-xs font-medium transition-all\",\n look.className,\n // The old path only: dimmed until the drag has passed a threshold. A tone\n // or a paint says it with the soft→solid step instead, which keeps its\n // label readable at both ends.\n look.dim && \"opacity-60\",\n // The panel is anchored to the edge the row is uncovering, so the label\n // sits where the eye already is rather than across the screen. That edge is\n // physical, while a flex row starts at the INLINE start — so in RTL the two\n // directions swap, or the label sat under the row on the covered side.\n draggingLeft ? \"flex-row-reverse rtl:flex-row\" : \"rtl:flex-row-reverse\",\n )}\n style={look.style}\n >\n {shown.icon && (\n <span\n className={cn(\n \"flex shrink-0 items-center justify-center rounded-full transition-all\",\n // Armed, the icon gets a disc of its own and grows — a second,\n // non-colour signal, and the one that stays readable at a glance. In\n // the label's own colour (0.33): a white disc vanished on a dark\n // theme's pastel fill, and the label's colour works on every pair.\n armed ? \"size-8 scale-110 bg-current/20\" : \"size-7 bg-current/10\",\n )}\n >\n {shown.icon}\n </span>\n )}\n <span className={cn(\"truncate transition-all\", armed && \"text-sm font-semibold\")}>\n {shown.label}\n </span>\n </div>\n )}\n <div\n // Capture phase: the row's own click handler lives on a DESCENDANT, so a\n // bubble-phase listener here would run after it — too late to suppress.\n onClickCapture={(e) => {\n if (!swipe.consumeClick()) return;\n e.preventDefault();\n e.stopPropagation();\n }}\n className={cn(\n \"relative bg-surface\",\n // A mouse drag is a supported way to swipe (use-row-swipe gates only on\n // the button, not the pointer type), and a horizontal mouse drag over\n // text also SELECTS that text — so committing an action left the row\n // highlighted blue. Suppressed only while dragging, so text in a row at\n // rest stays selectable.\n swipe.dragging ? \"select-none\" : \"transition-transform duration-150 motion-reduce:transition-none\",\n )}\n style={{\n transform: dx !== 0 ? `translate3d(${dx}px,0,0)` : undefined,\n touchAction: active ? \"pan-y\" : undefined,\n }}\n {...(active ? swipe.handlers : {})}\n >\n {children}\n </div>\n {active && (\n <div\n role=\"group\"\n aria-label={labels.actions}\n // OUTSIDE the sliding div on purpose: an action that travels with the row it\n // acts on is a moving target, and the drag transform would carry it off the\n // screen mid-gesture.\n //\n // `pointer-events-none` here, restored on a button only once it HAS focus: a\n // sr-only button is clipped to nothing but is still a hit target, and this\n // strip sits at the row's trailing edge — exactly where a drag toward the\n // start begins.\n //\n // `end-0`/`pe-2`, not `right-0`/`pr-2`: in RTL the right edge is where the\n // row's title starts, and a focused button there covered it.\n // A gesture that silently failed to start because it landed on an invisible\n // button is not a bug anyone would find by looking at the screen.\n className=\"pointer-events-none absolute inset-y-0 end-0 z-10 flex items-center gap-1 pe-2\"\n >\n {/* Both sides, each still nearest-threshold first, so the tab order reads in\n the order the gesture arms them. */}\n {[...rightActions, ...leftActions].map((action, i) => (\n <button\n key={`${action.label}-${i}`}\n type=\"button\"\n onClick={action.onCommit}\n className={cn(\n \"sr-only whitespace-nowrap rounded-md border-subtle bg-surface text-xs font-medium text-primary shadow-sm\",\n \"focus:not-sr-only focus:pointer-events-auto focus:inline-flex focus:items-center focus:gap-1.5\",\n // The box's padding and border only once it shows (0.32.1, keksdose's\n // 0.32 report). Unconditional, `px-2` and `border` beat `sr-only`'s\n // `padding: 0` and `border-width: 0`, so the hidden button was a 1 px\n // box with 2 × 0.5rem of padding round it: 26 px at Extra large, running\n // past the row's end from the strip's start — invisible under its clip,\n // but counted in the page's scroll width (§4: nothing overflows).\n \"focus:border focus:px-2 focus:py-1\",\n FOCUS_RING,\n )}\n >\n {/* The label is the button's accessible name, so the caller's icon is\n decoration on top of it rather than a second reading of it. */}\n {action.icon && (\n <span aria-hidden=\"true\" className=\"[&_svg]:size-4\">\n {action.icon}\n </span>\n )}\n {action.label}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAoS0B,cAElB,YAFkB;AApS1B,SAAS,WAAW,QAAQ,gBAAgB;AAE5C,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAE3B,SAAS,mBAAoC;AAC7C,SAAS,8BAA8B,oBAAoB;AAyFpD,MAAM,aAAiE;AAAA,EAC5E,OAAO,EAAE,MAAM,kCAAkC,OAAO,+BAA+B;AAAA,EACvF,SAAS,EAAE,MAAM,4BAA4B,OAAO,mCAAmC;AAAA,EACvF,SAAS,EAAE,MAAM,gCAAgC,OAAO,mCAAmC;AAAA,EAC3F,SAAS,EAAE,MAAM,gCAAgC,OAAO,mCAAmC;AAAA,EAC3F,QAAQ,EAAE,MAAM,8BAA8B,OAAO,iCAAiC;AAAA,EACtF,MAAM,EAAE,MAAM,0BAA0B,OAAO,6BAA6B;AAAA,EAC5E,QAAQ,EAAE,MAAM,+BAA+B,OAAO,0CAA0C;AAAA,EAChG,SAAS,EAAE,MAAM,+BAA+B,OAAO,2CAA2C;AAAA,EAClG,MAAM,EAAE,MAAM,kCAAkC,OAAO,qCAAqC;AAAA,EAC5F,QAAQ,EAAE,MAAM,sCAAsC,OAAO,yCAAyC;AAAA,EACtG,QAAQ,EAAE,MAAM,sCAAsC,OAAO,yCAAyC;AAAA,EACtG,MAAM,EAAE,MAAM,kCAAkC,OAAO,qCAAqC;AAAA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AAAA,YACF;AAAA,YAIC;AAAA,qBAAO,QACN,oBAAC,UAAK,eAAY,QAAO,WAAU,kBAChC,iBAAO,MACV;AAAA,cAED,OAAO;AAAA;AAAA;AAAA,UAvBH,GAAG,OAAO,KAAK,IAAI,CAAC;AAAA,QAwB3B,CACD;AAAA;AAAA,IACH;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { CommitScope } from './write-lock.js';
|
|
5
|
-
import './tooltip.js';
|
|
6
|
-
import '../hooks/use-anchored-rect.js';
|
|
7
|
-
import '../lib/clipping.js';
|
|
8
|
-
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode, Ref } from "react";
|
|
2
|
+
import { type DisabledReasonDisplay } from "./field-parts.js";
|
|
3
|
+
import type { CommitScope } from "./write-lock.js";
|
|
9
4
|
/**
|
|
10
5
|
* An on/off switch that is still `<input type="checkbox">`, with `role="switch"`.
|
|
11
6
|
*
|
|
@@ -33,8 +28,8 @@ declare const SIZES: {
|
|
|
33
28
|
readonly thumb: "size-4 peer-checked:start-4.5";
|
|
34
29
|
};
|
|
35
30
|
};
|
|
36
|
-
type SwitchSize = keyof typeof SIZES;
|
|
37
|
-
interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "role"> {
|
|
31
|
+
export type SwitchSize = keyof typeof SIZES;
|
|
32
|
+
export interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "role"> {
|
|
38
33
|
/** `"md"` (36×20, default) or `"sm"` (28×16) — Kastlan's `default` and `sm`. */
|
|
39
34
|
size?: SwitchSize;
|
|
40
35
|
/** The words beside the switch, as a `<label for>` — see {@link Checkbox}'s
|
|
@@ -90,6 +85,9 @@ interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"
|
|
|
90
85
|
* own). No provider, or an unlocked one: no effect. Button's `commit`, for K3.
|
|
91
86
|
*/
|
|
92
87
|
commit?: CommitScope;
|
|
88
|
+
/** The `<input type="checkbox" role="switch">`. A React 19 ref prop since 0.34 (MOD-4,
|
|
89
|
+
* refactor audit 2026-10); it was `forwardRef`. */
|
|
90
|
+
ref?: Ref<HTMLInputElement>;
|
|
93
91
|
}
|
|
94
92
|
/**
|
|
95
93
|
* A native checkbox drawn as a track and thumb, announced as a switch.
|
|
@@ -98,6 +96,5 @@ interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type"
|
|
|
98
96
|
* `onChange`/`onCheckedChange`), uncontrolled (`defaultChecked`) and in a plain
|
|
99
97
|
* `<form>` (`name`, `value`).
|
|
100
98
|
*/
|
|
101
|
-
declare
|
|
102
|
-
|
|
103
|
-
export { Switch, type SwitchProps, type SwitchSize };
|
|
99
|
+
export declare function Switch({ ref, size, label, description, switchPosition, onCheckedChange, onChange, className, inputClassName, id, disabled, required, disabledReason, disabledReasonDisplay, commit, onClick, ...rest }: SwitchProps): import("react").JSX.Element;
|
|
100
|
+
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useId } from "react";
|
|
4
4
|
import { cn } from "../lib/cn.js";
|
|
5
|
-
import {
|
|
5
|
+
import { hasContent } from "../lib/presence.js";
|
|
6
6
|
import {
|
|
7
7
|
DISABLED_REASON_LINE_CLASS,
|
|
8
8
|
LockedReason,
|
|
9
|
+
mergeDescribedBy,
|
|
9
10
|
useDisabledReasonLine,
|
|
10
11
|
useLockReason
|
|
11
12
|
} from "./field-parts.js";
|
|
@@ -17,9 +18,10 @@ const SIZES = {
|
|
|
17
18
|
// 2.25 × 1.25rem track, 1rem thumb (36×20 / 16). Checked: 2.25 − 1 − 0.125 = 1.125rem.
|
|
18
19
|
md: { track: "h-5 w-9", thumb: "size-4 peer-checked:start-4.5" }
|
|
19
20
|
};
|
|
20
|
-
const TRACK = `peer block shrink-0 cursor-pointer appearance-none rounded-full bg-[var(--border-strong)] transition-colors checked:bg-
|
|
21
|
-
const THUMB = "pointer-events-none absolute start-0.5 top-1/2 -translate-y-1/2 rounded-full bg-
|
|
22
|
-
|
|
21
|
+
const TRACK = `peer block shrink-0 cursor-pointer appearance-none rounded-full bg-[var(--border-strong)] transition-colors checked:bg-brand focus:outline-none ${FOCUS_RING} focus-visible:ring-offset-2 focus-visible:ring-offset-surface disabled:cursor-not-allowed`;
|
|
22
|
+
const THUMB = "pointer-events-none absolute start-0.5 top-1/2 -translate-y-1/2 rounded-full bg-surface shadow-sm transition-[inset-inline-start,background-color] motion-reduce:transition-none peer-checked:bg-[var(--brand-contrast)]";
|
|
23
|
+
function Switch({
|
|
24
|
+
ref,
|
|
23
25
|
size = "md",
|
|
24
26
|
label,
|
|
25
27
|
description,
|
|
@@ -36,7 +38,7 @@ const Switch = forwardRef(function Switch2({
|
|
|
36
38
|
commit,
|
|
37
39
|
onClick,
|
|
38
40
|
...rest
|
|
39
|
-
}
|
|
41
|
+
}) {
|
|
40
42
|
const generated = useId();
|
|
41
43
|
const inputId = id ?? generated;
|
|
42
44
|
const lock = useLockReason(commit, disabledReason);
|
|
@@ -44,7 +46,7 @@ const Switch = forwardRef(function Switch2({
|
|
|
44
46
|
const reasonLine = useDisabledReasonLine(disabledReasonDisplay);
|
|
45
47
|
const looksDisabled = Boolean(disabled) || locked;
|
|
46
48
|
const descriptionId = `${inputId}-description`;
|
|
47
|
-
const showDescription =
|
|
49
|
+
const showDescription = hasContent(description);
|
|
48
50
|
const bare = label === void 0 && !showDescription;
|
|
49
51
|
const geometry = SIZES[size];
|
|
50
52
|
const track = /* @__PURE__ */ jsxs("span", { className: cn("relative inline-flex shrink-0", bare && !locked && className), children: [
|
|
@@ -89,17 +91,17 @@ const Switch = forwardRef(function Switch2({
|
|
|
89
91
|
{
|
|
90
92
|
htmlFor: inputId,
|
|
91
93
|
className: cn(
|
|
92
|
-
"block text-sm leading-5 text-
|
|
94
|
+
"block text-sm leading-5 text-primary",
|
|
93
95
|
looksDisabled ? "cursor-not-allowed" : "cursor-pointer select-none",
|
|
94
96
|
dimParts && "opacity-60"
|
|
95
97
|
),
|
|
96
98
|
children: [
|
|
97
99
|
label,
|
|
98
|
-
required && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "ms-0.5 text-
|
|
100
|
+
required && /* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "ms-0.5 text-danger", children: "*" })
|
|
99
101
|
]
|
|
100
102
|
}
|
|
101
103
|
),
|
|
102
|
-
showDescription && /* @__PURE__ */ jsx("span", { id: descriptionId, className: cn("mt-0.5 block text-xs text-
|
|
104
|
+
showDescription && /* @__PURE__ */ jsx("span", { id: descriptionId, className: cn("mt-0.5 block text-xs text-muted", dimParts && "opacity-60"), children: description }),
|
|
103
105
|
lineInWords && /* @__PURE__ */ jsx("span", { id: lock.reasonId, className: DISABLED_REASON_LINE_CLASS, children: lock.reason })
|
|
104
106
|
] });
|
|
105
107
|
return /* @__PURE__ */ jsx("div", { className: cn("flex items-start gap-3", looksDisabled && !dimParts && "opacity-60", className), children: switchPosition === "end" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -109,8 +111,7 @@ const Switch = forwardRef(function Switch2({
|
|
|
109
111
|
cell,
|
|
110
112
|
words
|
|
111
113
|
] }) });
|
|
112
|
-
}
|
|
113
|
-
Switch.displayName = "Switch";
|
|
114
|
+
}
|
|
114
115
|
export {
|
|
115
116
|
Switch
|
|
116
117
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/switch.tsx"],"sourcesContent":["import { forwardRef, useId } from \"react\";\nimport type { ChangeEvent, InputHTMLAttributes, ReactNode } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { hasMessage, mergeDescribedBy } from \"./choice-parts\";\nimport {\n DISABLED_REASON_LINE_CLASS,\n LockedReason,\n useDisabledReasonLine,\n useLockReason,\n type DisabledReasonDisplay,\n} from \"./field-parts\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport type { CommitScope } from \"./write-lock\";\n\n/**\n * An on/off switch that is still `<input type=\"checkbox\">`, with `role=\"switch\"`.\n *\n * Kastlan's was a Radix `<button>`; this keeps the native element for the reasons\n * `Checkbox` gives (form submission, `required`, reset, `<label for>`), and adds the\n * one thing a checkbox is not: `role=\"switch\"`, which screen readers announce as\n * \"on/off\" rather than \"checked/not checked\". Use it for a setting that takes effect\n * the moment it is flipped; a choice that waits for a Save button is a checkbox.\n */\n\n/** Geometry per size. The thumb sits `start-0.5` (0.125rem, 2 px at Normal) in from\n * each end of the track, so its checked offset is `track width − thumb − 0.125rem`.\n * All of it in rem since 0.32 (docs/text-size-harmonization.md §3.2, §4): the track\n * and thumb already grew with the text, and a checked offset left in px (14 / 18) put\n * the thumb short of the end at 125 % and in the middle at 150 %. `start-*`, never\n * `left-*` or a `translate-x`: an inline-start offset follows the writing direction,\n * so in a right-to-left form the thumb travels right-to-left with no `rtl:` override\n * to keep in step. */\nconst SIZES = {\n // 1.75 × 1rem track, 0.75rem thumb (28×16 / 12 at Normal): the dense setting rows in\n // Kastlan's tables. Checked: 1.75 − 0.75 − 0.125 = 0.875rem.\n sm: { track: \"h-4 w-7\", thumb: \"size-3 peer-checked:start-3.5\" },\n // 2.25 × 1.25rem track, 1rem thumb (36×20 / 16). Checked: 2.25 − 1 − 0.125 = 1.125rem.\n md: { track: \"h-5 w-9\", thumb: \"size-4 peer-checked:start-4.5\" },\n} as const;\n\nexport type SwitchSize = keyof typeof SIZES;\n\n// The track IS the input — `appearance-none` and a pill — so its box is the pointer\n// target and the focus ring lands around the whole control, not the thumb alone.\n//\n// Unchecked it takes `--border-strong`, not `--border`: a hairline-coloured track on\n// a surface-coloured card is a switch you have to look for. Checked it takes the\n// brand fill, which is the only difference in COLOUR; the thumb's position is the\n// difference in SHAPE, so the state never rests on colour alone.\nconst TRACK =\n \"peer block shrink-0 cursor-pointer appearance-none rounded-full bg-[var(--border-strong)] transition-colors \" +\n \"checked:bg-[var(--brand)] \" +\n // The kit's focus frame (§5), stood off the track so it never merges with the fill.\n `focus:outline-none ${FOCUS_RING} focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--bg-surface)] ` +\n \"disabled:cursor-not-allowed\";\n\n// The thumb, laid over the input and ignoring the pointer so every click still reaches\n// the input. It swaps to `--brand-contrast` on the brand fill: the surface colour would\n// match the fill in some presets, and the contrast token is the one guaranteed to read\n// against --brand.\nconst THUMB =\n \"pointer-events-none absolute start-0.5 top-1/2 -translate-y-1/2 rounded-full bg-[var(--bg-surface)] shadow-sm \" +\n \"transition-[inset-inline-start,background-color] motion-reduce:transition-none \" +\n \"peer-checked:bg-[var(--brand-contrast)]\";\n\nexport interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\" | \"role\"> {\n /** `\"md\"` (36×20, default) or `\"sm\"` (28×16) — Kastlan's `default` and `sm`. */\n size?: SwitchSize;\n /** The words beside the switch, as a `<label for>` — see {@link Checkbox}'s\n * `label` for why it does not wrap the input. Without it, give the switch an\n * `aria-label`. */\n label?: ReactNode;\n /** Secondary text under the label, attached with `aria-describedby` (merged with\n * any the caller passed). */\n description?: ReactNode;\n /** Which end of the row the switch sits at when there is a label. `\"end\"` (the\n * default) is the settings-list shape Kastlan's profile page uses — the words at\n * the start, the control at the far end; `\"start\"` puts it before the words, like\n * a checkbox. Logical, so it follows the writing direction. */\n switchPosition?: \"start\" | \"end\";\n /** The new state as a boolean — Radix's `onCheckedChange`, so Kastlan's call sites\n * move without unwrapping the event. Fires alongside `onChange`. */\n onCheckedChange?: (checked: boolean) => void;\n /** Classes for the `<input>` (the track). `className` styles the outermost element:\n * the row when there is a label, the switch's own wrapper when there is not. */\n inputClassName?: string;\n /**\n * Must be ticked to submit — a consent, an acceptance before paying. Reaches the\n * `<input>` as the native `required` (so a `<form>` refuses to submit without it and a\n * screen reader announces \"required\"), and draws the kit's required mark after the\n * label, the same `aria-hidden` star as {@link Label}'s: the word is announced from\n * the control, so a star inside the name would only be read out as noise. Write the\n * label WITHOUT a literal \"*\". No mark without a label.\n */\n required?: boolean;\n /**\n * Why the switch cannot be flipped — {@link Button}'s `disabledReason`. A switch is\n * the control that \"takes effect the moment it is flipped\", so it is the first one\n * keksdose K3 names: its settings rows sat behind a `SaveGuard` that forced a native\n * `disabled`, out of the tab order, so the reason never reached a keyboard.\n *\n * With a reason the switch is `aria-disabled` instead: still focusable, a click or\n * Space flips nothing and fires no `onChange` / `onCheckedChange`, the reason is in\n * the kit {@link Tooltip} on the track and on its `aria-describedby`, and the row\n * fades as a disabled one does. It wins over `disabled`. Changing the lock mounts the\n * switch anew (it moves in or out of the Tooltip), as a locked Button is.\n */\n disabledReason?: ReactNode;\n /**\n * Where `disabledReason` shows (0.32, §4 \"No fact only in a tooltip\"): by default, at\n * Large and on a touch screen, as a line in the words column under the description (a\n * bare switch: under the track), and in the tooltip otherwise. See\n * {@link DisabledReasonDisplay}.\n */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This switch COMMITS — flipping it saves. Under a locked {@link WriteLockProvider} it\n * is locked the `disabledReason` way with the lock's reason (which wins over its\n * own). No provider, or an unlocked one: no effect. Button's `commit`, for K3.\n */\n commit?: CommitScope;\n}\n\n/**\n * A native checkbox drawn as a track and thumb, announced as a switch.\n *\n * Every other prop reaches the `<input>`, so it works controlled (`checked` +\n * `onChange`/`onCheckedChange`), uncontrolled (`defaultChecked`) and in a plain\n * `<form>` (`name`, `value`).\n */\nexport const Switch = forwardRef<HTMLInputElement, SwitchProps>(function Switch(\n {\n size = \"md\",\n label,\n description,\n switchPosition = \"end\",\n onCheckedChange,\n onChange,\n className,\n inputClassName,\n id,\n disabled,\n required,\n disabledReason,\n disabledReasonDisplay,\n commit,\n onClick,\n ...rest\n },\n ref,\n) {\n const generated = useId();\n const inputId = id ?? generated;\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const reasonLine = useDisabledReasonLine(disabledReasonDisplay);\n // Locked is disabled the focusable way — the row fades and the words stop inviting a\n // click, as for `disabled`.\n const looksDisabled = Boolean(disabled) || locked;\n const descriptionId = `${inputId}-description`;\n const showDescription = hasMessage(description);\n const bare = label === undefined && !showDescription;\n const geometry = SIZES[size];\n\n const track = (\n <span className={cn(\"relative inline-flex shrink-0\", bare && !locked && className)}>\n <input\n ref={ref}\n id={bare ? id : inputId}\n // A reason wins over `disabled`, as on Button: the switch stays reachable.\n disabled={locked ? undefined : disabled}\n required={required}\n {...rest}\n // After the spread: a caller's props object must not be able to turn this\n // back into a plain checkbox, or into a text field.\n type=\"checkbox\"\n role=\"switch\"\n aria-disabled={locked || rest[\"aria-disabled\"] || undefined}\n aria-describedby={mergeDescribedBy(\n rest[\"aria-describedby\"],\n showDescription && descriptionId,\n locked && lock.reasonId,\n )}\n // A locked switch's click is swallowed, as a locked Button's is.\n onClick={locked ? undefined : onClick}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (locked) {\n // Put the thumb back and report nothing — see Checkbox for why here and not\n // by cancelling the click. Label clicks and Space arrive as clicks too.\n e.currentTarget.checked = !e.currentTarget.checked;\n return;\n }\n onChange?.(e);\n onCheckedChange?.(e.target.checked);\n }}\n className={cn(TRACK, geometry.track, locked && \"cursor-not-allowed\", inputClassName)}\n />\n <span aria-hidden className={cn(THUMB, geometry.thumb)} />\n </span>\n );\n // The Tooltip goes round the track, not the row — the row is the caller's layout. A\n // bare switch hands its `className` to the wrapper, then the outermost element. With\n // words beside it, the reason LINE goes under them instead (below), so the track\n // stays where the row puts it.\n const lineInWords = locked && reasonLine && !bare;\n const control =\n locked && !lineInWords ? (\n <LockedReason lock={lock} line={reasonLine} className={cn(\"shrink-0\", bare && className)}>\n {track}\n </LockedReason>\n ) : (\n track\n );\n\n if (bare) return control;\n\n // The switch's cell is one label line tall (text-sm, 1.25rem) so it centres on the\n // FIRST line of a label that wraps, and a description underneath does not drag it\n // down to the middle of the paragraph.\n // With the reason line in the words, the row's fade moves onto its parts: the line is\n // the one thing on the row still to be read, and at 60 % it would not be.\n const dimParts = lineInWords;\n const cell = <span className={cn(\"flex h-5 shrink-0 items-center\", dimParts && \"opacity-60\")}>{control}</span>;\n const words = (\n <span className=\"min-w-0 flex-1\">\n {label !== undefined && (\n <label\n htmlFor={inputId}\n className={cn(\n \"block text-sm leading-5 text-[var(--text-primary)]\",\n looksDisabled ? \"cursor-not-allowed\" : \"cursor-pointer select-none\",\n dimParts && \"opacity-60\",\n )}\n >\n {label}\n {required && (\n <span aria-hidden className=\"ms-0.5 text-[var(--danger)]\">\n *\n </span>\n )}\n </label>\n )}\n {showDescription && (\n <span id={descriptionId} className={cn(\"mt-0.5 block text-xs text-[var(--text-muted)]\", dimParts && \"opacity-60\")}>\n {description}\n </span>\n )}\n {lineInWords && (\n <span id={lock.reasonId} className={DISABLED_REASON_LINE_CLASS}>\n {lock.reason}\n </span>\n )}\n </span>\n );\n\n return (\n <div className={cn(\"flex items-start gap-3\", looksDisabled && !dimParts && \"opacity-60\", className)}>\n {switchPosition === \"end\" ? (\n <>\n {words}\n {cell}\n </>\n ) : (\n <>\n {cell}\n {words}\n </>\n )}\n </div>\n );\n});\nSwitch.displayName = \"Switch\";\n"],"mappings":";AAqKI,SA6FI,UA5FF,KADF;AArKJ,SAAS,YAAY,aAAa;AAElC,SAAS,UAAU;AACnB,SAAS,YAAY,wBAAwB;AAC7C;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAqB3B,MAAM,QAAQ;AAAA;AAAA;AAAA,EAGZ,IAAI,EAAE,OAAO,WAAW,OAAO,gCAAgC;AAAA;AAAA,EAE/D,IAAI,EAAE,OAAO,WAAW,OAAO,gCAAgC;AACjE;AAWA,MAAM,QACJ,4JAGsB,UAAU;AAOlC,MAAM,QACJ;AAqEK,MAAM,SAAS,WAA0C,SAASA,QACvE;AAAA,EACE,OAAO;AAAA,EACP;AAAA,EACA;AA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AAG;AAAA,KAC1D;AAMF,QAAM,cAAc,UAAU,cAAc,CAAC;AAC7C,QAAM,UACJ,UAAU,CAAC,cACT,oBAAC,gBAAa,MAAY,MAAM,YAAY,WAAW,GAAG,YAAY,QAAQ,SAAS,GACpF,iBACH,IAEA;AAGJ,MAAI,KAAM,QAAO;AAOjB,QAAM,WAAW;AACjB,QAAM,OAAO,oBAAC,UAAK,WAAW,GAAG,kCAAkC,YAAY,YAAY,GAAI,mBAAQ;AACvG,QAAM,QACJ,qBAAC,UAAK,WAAU,kBACb;AAAA,cAAU,UACT;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,UACT;AAAA,UACA,gBAAgB,uBAAuB;AAAA,UACvC,YAAY;AAAA,QACd;AAAA,QAEC;AAAA;AAAA,UACA,YACC,oBAAC,UAAK,eAAW,MAAC,WAAU,+BAA8B,eAE1D;AAAA;AAAA;AAAA,IAEJ;AAAA,IAED,mBACC,oBAAC,UAAK,IAAI,eAAe,WAAW,GAAG,iDAAiD,YAAY,YAAY,GAC7G,uBACH;AAAA,IAED,eACC,oBAAC,UAAK,IAAI,KAAK,UAAU,WAAW,4BACjC,eAAK,QACR;AAAA,KAEJ;AAGF,SACE,oBAAC,SAAI,WAAW,GAAG,0BAA0B,iBAAiB,CAAC,YAAY,cAAc,SAAS,GAC/F,6BAAmB,QAClB,iCACG;AAAA;AAAA,IACA;AAAA,KACH,IAEA,iCACG;AAAA;AAAA,IACA;AAAA,KACH,GAEJ;AAEJ,CAAC;AACD,OAAO,cAAc;","names":["Switch"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/switch.tsx"],"sourcesContent":["import { useId } from \"react\";\nimport type { ChangeEvent, InputHTMLAttributes, ReactNode, Ref } from \"react\";\nimport { cn } from \"../lib/cn\";\nimport { hasContent } from \"../lib/presence\";\nimport {\n DISABLED_REASON_LINE_CLASS,\n LockedReason,\n mergeDescribedBy,\n useDisabledReasonLine,\n useLockReason,\n type DisabledReasonDisplay,\n} from \"./field-parts\";\nimport { FOCUS_RING } from \"./focus-ring\";\nimport type { CommitScope } from \"./write-lock\";\n\n/**\n * An on/off switch that is still `<input type=\"checkbox\">`, with `role=\"switch\"`.\n *\n * Kastlan's was a Radix `<button>`; this keeps the native element for the reasons\n * `Checkbox` gives (form submission, `required`, reset, `<label for>`), and adds the\n * one thing a checkbox is not: `role=\"switch\"`, which screen readers announce as\n * \"on/off\" rather than \"checked/not checked\". Use it for a setting that takes effect\n * the moment it is flipped; a choice that waits for a Save button is a checkbox.\n */\n\n/** Geometry per size. The thumb sits `start-0.5` (0.125rem, 2 px at Normal) in from\n * each end of the track, so its checked offset is `track width − thumb − 0.125rem`.\n * All of it in rem since 0.32 (docs/text-size-harmonization.md §3.2, §4): the track\n * and thumb already grew with the text, and a checked offset left in px (14 / 18) put\n * the thumb short of the end at 125 % and in the middle at 150 %. `start-*`, never\n * `left-*` or a `translate-x`: an inline-start offset follows the writing direction,\n * so in a right-to-left form the thumb travels right-to-left with no `rtl:` override\n * to keep in step. */\nconst SIZES = {\n // 1.75 × 1rem track, 0.75rem thumb (28×16 / 12 at Normal): the dense setting rows in\n // Kastlan's tables. Checked: 1.75 − 0.75 − 0.125 = 0.875rem.\n sm: { track: \"h-4 w-7\", thumb: \"size-3 peer-checked:start-3.5\" },\n // 2.25 × 1.25rem track, 1rem thumb (36×20 / 16). Checked: 2.25 − 1 − 0.125 = 1.125rem.\n md: { track: \"h-5 w-9\", thumb: \"size-4 peer-checked:start-4.5\" },\n} as const;\n\nexport type SwitchSize = keyof typeof SIZES;\n\n// The track IS the input — `appearance-none` and a pill — so its box is the pointer\n// target and the focus ring lands around the whole control, not the thumb alone.\n//\n// Unchecked it takes `--border-strong`, not `--border`: a hairline-coloured track on\n// a surface-coloured card is a switch you have to look for. Checked it takes the\n// brand fill, which is the only difference in COLOUR; the thumb's position is the\n// difference in SHAPE, so the state never rests on colour alone.\nconst TRACK =\n \"peer block shrink-0 cursor-pointer appearance-none rounded-full bg-[var(--border-strong)] transition-colors \" +\n \"checked:bg-brand \" +\n // The kit's focus frame (§5), stood off the track so it never merges with the fill.\n `focus:outline-none ${FOCUS_RING} focus-visible:ring-offset-2 focus-visible:ring-offset-surface ` +\n \"disabled:cursor-not-allowed\";\n\n// The thumb, laid over the input and ignoring the pointer so every click still reaches\n// the input. It swaps to `--brand-contrast` on the brand fill: the surface colour would\n// match the fill in some presets, and the contrast token is the one guaranteed to read\n// against --brand.\nconst THUMB =\n \"pointer-events-none absolute start-0.5 top-1/2 -translate-y-1/2 rounded-full bg-surface shadow-sm \" +\n \"transition-[inset-inline-start,background-color] motion-reduce:transition-none \" +\n \"peer-checked:bg-[var(--brand-contrast)]\";\n\nexport interface SwitchProps extends Omit<InputHTMLAttributes<HTMLInputElement>, \"type\" | \"size\" | \"role\"> {\n /** `\"md\"` (36×20, default) or `\"sm\"` (28×16) — Kastlan's `default` and `sm`. */\n size?: SwitchSize;\n /** The words beside the switch, as a `<label for>` — see {@link Checkbox}'s\n * `label` for why it does not wrap the input. Without it, give the switch an\n * `aria-label`. */\n label?: ReactNode;\n /** Secondary text under the label, attached with `aria-describedby` (merged with\n * any the caller passed). */\n description?: ReactNode;\n /** Which end of the row the switch sits at when there is a label. `\"end\"` (the\n * default) is the settings-list shape Kastlan's profile page uses — the words at\n * the start, the control at the far end; `\"start\"` puts it before the words, like\n * a checkbox. Logical, so it follows the writing direction. */\n switchPosition?: \"start\" | \"end\";\n /** The new state as a boolean — Radix's `onCheckedChange`, so Kastlan's call sites\n * move without unwrapping the event. Fires alongside `onChange`. */\n onCheckedChange?: (checked: boolean) => void;\n /** Classes for the `<input>` (the track). `className` styles the outermost element:\n * the row when there is a label, the switch's own wrapper when there is not. */\n inputClassName?: string;\n /**\n * Must be ticked to submit — a consent, an acceptance before paying. Reaches the\n * `<input>` as the native `required` (so a `<form>` refuses to submit without it and a\n * screen reader announces \"required\"), and draws the kit's required mark after the\n * label, the same `aria-hidden` star as {@link Label}'s: the word is announced from\n * the control, so a star inside the name would only be read out as noise. Write the\n * label WITHOUT a literal \"*\". No mark without a label.\n */\n required?: boolean;\n /**\n * Why the switch cannot be flipped — {@link Button}'s `disabledReason`. A switch is\n * the control that \"takes effect the moment it is flipped\", so it is the first one\n * keksdose K3 names: its settings rows sat behind a `SaveGuard` that forced a native\n * `disabled`, out of the tab order, so the reason never reached a keyboard.\n *\n * With a reason the switch is `aria-disabled` instead: still focusable, a click or\n * Space flips nothing and fires no `onChange` / `onCheckedChange`, the reason is in\n * the kit {@link Tooltip} on the track and on its `aria-describedby`, and the row\n * fades as a disabled one does. It wins over `disabled`. Changing the lock mounts the\n * switch anew (it moves in or out of the Tooltip), as a locked Button is.\n */\n disabledReason?: ReactNode;\n /**\n * Where `disabledReason` shows (0.32, §4 \"No fact only in a tooltip\"): by default, at\n * Large and on a touch screen, as a line in the words column under the description (a\n * bare switch: under the track), and in the tooltip otherwise. See\n * {@link DisabledReasonDisplay}.\n */\n disabledReasonDisplay?: DisabledReasonDisplay;\n /**\n * This switch COMMITS — flipping it saves. Under a locked {@link WriteLockProvider} it\n * is locked the `disabledReason` way with the lock's reason (which wins over its\n * own). No provider, or an unlocked one: no effect. Button's `commit`, for K3.\n */\n commit?: CommitScope;\n /** The `<input type=\"checkbox\" role=\"switch\">`. A React 19 ref prop since 0.34 (MOD-4,\n * refactor audit 2026-10); it was `forwardRef`. */\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * A native checkbox drawn as a track and thumb, announced as a switch.\n *\n * Every other prop reaches the `<input>`, so it works controlled (`checked` +\n * `onChange`/`onCheckedChange`), uncontrolled (`defaultChecked`) and in a plain\n * `<form>` (`name`, `value`).\n */\nexport function Switch({\n ref,\n size = \"md\",\n label,\n description,\n switchPosition = \"end\",\n onCheckedChange,\n onChange,\n className,\n inputClassName,\n id,\n disabled,\n required,\n disabledReason,\n disabledReasonDisplay,\n commit,\n onClick,\n ...rest\n}: SwitchProps) {\n const generated = useId();\n const inputId = id ?? generated;\n const lock = useLockReason(commit, disabledReason);\n const locked = lock.locked;\n const reasonLine = useDisabledReasonLine(disabledReasonDisplay);\n // Locked is disabled the focusable way — the row fades and the words stop inviting a\n // click, as for `disabled`.\n const looksDisabled = Boolean(disabled) || locked;\n const descriptionId = `${inputId}-description`;\n const showDescription = hasContent(description);\n const bare = label === undefined && !showDescription;\n const geometry = SIZES[size];\n\n const track = (\n <span className={cn(\"relative inline-flex shrink-0\", bare && !locked && className)}>\n <input\n ref={ref}\n id={bare ? id : inputId}\n // A reason wins over `disabled`, as on Button: the switch stays reachable.\n disabled={locked ? undefined : disabled}\n required={required}\n {...rest}\n // After the spread: a caller's props object must not be able to turn this\n // back into a plain checkbox, or into a text field.\n type=\"checkbox\"\n role=\"switch\"\n aria-disabled={locked || rest[\"aria-disabled\"] || undefined}\n aria-describedby={mergeDescribedBy(\n rest[\"aria-describedby\"],\n showDescription && descriptionId,\n locked && lock.reasonId,\n )}\n // A locked switch's click is swallowed, as a locked Button's is.\n onClick={locked ? undefined : onClick}\n onChange={(e: ChangeEvent<HTMLInputElement>) => {\n if (locked) {\n // Put the thumb back and report nothing — see Checkbox for why here and not\n // by cancelling the click. Label clicks and Space arrive as clicks too.\n e.currentTarget.checked = !e.currentTarget.checked;\n return;\n }\n onChange?.(e);\n onCheckedChange?.(e.target.checked);\n }}\n className={cn(TRACK, geometry.track, locked && \"cursor-not-allowed\", inputClassName)}\n />\n <span aria-hidden className={cn(THUMB, geometry.thumb)} />\n </span>\n );\n // The Tooltip goes round the track, not the row — the row is the caller's layout. A\n // bare switch hands its `className` to the wrapper, then the outermost element. With\n // words beside it, the reason LINE goes under them instead (below), so the track\n // stays where the row puts it.\n const lineInWords = locked && reasonLine && !bare;\n const control =\n locked && !lineInWords ? (\n <LockedReason lock={lock} line={reasonLine} className={cn(\"shrink-0\", bare && className)}>\n {track}\n </LockedReason>\n ) : (\n track\n );\n\n if (bare) return control;\n\n // The switch's cell is one label line tall (text-sm, 1.25rem) so it centres on the\n // FIRST line of a label that wraps, and a description underneath does not drag it\n // down to the middle of the paragraph.\n // With the reason line in the words, the row's fade moves onto its parts: the line is\n // the one thing on the row still to be read, and at 60 % it would not be.\n const dimParts = lineInWords;\n const cell = <span className={cn(\"flex h-5 shrink-0 items-center\", dimParts && \"opacity-60\")}>{control}</span>;\n const words = (\n <span className=\"min-w-0 flex-1\">\n {label !== undefined && (\n <label\n htmlFor={inputId}\n className={cn(\n \"block text-sm leading-5 text-primary\",\n looksDisabled ? \"cursor-not-allowed\" : \"cursor-pointer select-none\",\n dimParts && \"opacity-60\",\n )}\n >\n {label}\n {required && (\n <span aria-hidden className=\"ms-0.5 text-danger\">\n *\n </span>\n )}\n </label>\n )}\n {showDescription && (\n <span id={descriptionId} className={cn(\"mt-0.5 block text-xs text-muted\", dimParts && \"opacity-60\")}>\n {description}\n </span>\n )}\n {lineInWords && (\n <span id={lock.reasonId} className={DISABLED_REASON_LINE_CLASS}>\n {lock.reason}\n </span>\n )}\n </span>\n );\n\n return (\n <div className={cn(\"flex items-start gap-3\", looksDisabled && !dimParts && \"opacity-60\", className)}>\n {switchPosition === \"end\" ? (\n <>\n {words}\n {cell}\n </>\n ) : (\n <>\n {cell}\n {words}\n </>\n )}\n </div>\n );\n}\n"],"mappings":";AAuKI,SA6FI,UA5FF,KADF;AAvKJ,SAAS,aAAa;AAEtB,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAqB3B,MAAM,QAAQ;AAAA;AAAA;AAAA,EAGZ,IAAI,EAAE,OAAO,WAAW,OAAO,gCAAgC;AAAA;AAAA,EAE/D,IAAI,EAAE,OAAO,WAAW,OAAO,gCAAgC;AACjE;AAWA,MAAM,QACJ,mJAGsB,UAAU;AAOlC,MAAM,QACJ;AAwEK,SAAS,OAAO;AAAA,EACrB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,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