frontile 0.18.0-beta.2 → 0.18.0-beta.4
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/declarations/-private/control-blur.d.ts +1 -0
- package/declarations/-private/control-blur.d.ts.map +1 -0
- package/declarations/-private/deprecated-args.d.ts +1 -0
- package/declarations/-private/deprecated-args.d.ts.map +1 -0
- package/declarations/-private/dialog.d.ts +1 -0
- package/declarations/-private/dialog.d.ts.map +1 -0
- package/declarations/-private/dom.d.ts +1 -0
- package/declarations/-private/dom.d.ts.map +1 -0
- package/declarations/-private/get-config.d.ts +1 -0
- package/declarations/-private/get-config.d.ts.map +1 -0
- package/declarations/-private/icons.d.ts +23 -0
- package/declarations/-private/icons.d.ts.map +1 -0
- package/declarations/-private/manager.d.ts +1 -0
- package/declarations/-private/manager.d.ts.map +1 -0
- package/declarations/-private/notification-stack.d.ts +1 -0
- package/declarations/-private/notification-stack.d.ts.map +1 -0
- package/declarations/-private/notification.d.ts +1 -0
- package/declarations/-private/notification.d.ts.map +1 -0
- package/declarations/-private/timer.d.ts +1 -0
- package/declarations/-private/timer.d.ts.map +1 -0
- package/declarations/-private/types.d.ts +1 -0
- package/declarations/-private/types.d.ts.map +1 -0
- package/declarations/buttons.d.ts +1 -0
- package/declarations/buttons.d.ts.map +1 -0
- package/declarations/collections.d.ts +1 -0
- package/declarations/collections.d.ts.map +1 -0
- package/declarations/components/buttons/button-group.d.ts +1 -0
- package/declarations/components/buttons/button-group.d.ts.map +1 -0
- package/declarations/components/buttons/button.d.ts +1 -0
- package/declarations/components/buttons/button.d.ts.map +1 -0
- package/declarations/components/buttons/chip.d.ts +1 -0
- package/declarations/components/buttons/chip.d.ts.map +1 -0
- package/declarations/components/buttons/close-button.d.ts +1 -0
- package/declarations/components/buttons/close-button.d.ts.map +1 -0
- package/declarations/components/buttons/index.d.ts +1 -0
- package/declarations/components/buttons/index.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control/item.d.ts +1 -0
- package/declarations/components/buttons/segmented-control/item.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts +12 -1
- package/declarations/components/buttons/segmented-control/segmented-control.d.ts.map +1 -0
- package/declarations/components/buttons/segmented-control.d.ts +1 -0
- package/declarations/components/buttons/segmented-control.d.ts.map +1 -0
- package/declarations/components/buttons/toggle-button.d.ts +1 -0
- package/declarations/components/buttons/toggle-button.d.ts.map +1 -0
- package/declarations/components/collections/calendar/calendar.d.ts +9 -12
- package/declarations/components/collections/calendar/calendar.d.ts.map +1 -0
- package/declarations/components/collections/calendar/day-cell.d.ts +1 -0
- package/declarations/components/collections/calendar/day-cell.d.ts.map +1 -0
- package/declarations/components/collections/calendar/header.d.ts +1 -0
- package/declarations/components/collections/calendar/header.d.ts.map +1 -0
- package/declarations/components/collections/calendar/month-grid.d.ts +1 -0
- package/declarations/components/collections/calendar/month-grid.d.ts.map +1 -0
- package/declarations/components/collections/calendar/types.d.ts +1 -0
- package/declarations/components/collections/calendar/types.d.ts.map +1 -0
- package/declarations/components/collections/calendar/utils.d.ts +1 -0
- package/declarations/components/collections/calendar/utils.d.ts.map +1 -0
- package/declarations/components/collections/calendar/year-grid.d.ts +1 -0
- package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -0
- package/declarations/components/collections/calendar.d.ts +1 -0
- package/declarations/components/collections/calendar.d.ts.map +1 -0
- package/declarations/components/collections/command/command.d.ts +2 -11
- package/declarations/components/collections/command/command.d.ts.map +1 -0
- package/declarations/components/collections/command/dialog.d.ts +1 -0
- package/declarations/components/collections/command/dialog.d.ts.map +1 -0
- package/declarations/components/collections/command/footer.d.ts +1 -0
- package/declarations/components/collections/command/footer.d.ts.map +1 -0
- package/declarations/components/collections/command/index.d.ts +1 -0
- package/declarations/components/collections/command/index.d.ts.map +1 -0
- package/declarations/components/collections/command/input.d.ts +7 -1
- package/declarations/components/collections/command/input.d.ts.map +1 -0
- package/declarations/components/collections/command/list.d.ts +4 -0
- package/declarations/components/collections/command/list.d.ts.map +1 -0
- package/declarations/components/collections/command.d.ts +1 -0
- package/declarations/components/collections/command.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/dropdown.d.ts +61 -2
- package/declarations/components/collections/dropdown/dropdown.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/menu-context.d.ts +34 -7
- package/declarations/components/collections/dropdown/menu-context.d.ts.map +1 -0
- package/declarations/components/collections/dropdown/sub.d.ts +4 -8
- package/declarations/components/collections/dropdown/sub.d.ts.map +1 -0
- package/declarations/components/collections/dropdown.d.ts +1 -0
- package/declarations/components/collections/dropdown.d.ts.map +1 -0
- package/declarations/components/collections/index.d.ts +1 -0
- package/declarations/components/collections/index.d.ts.map +1 -0
- package/declarations/components/collections/listbox/group.d.ts +1 -0
- package/declarations/components/collections/listbox/group.d.ts.map +1 -0
- package/declarations/components/collections/listbox/item.d.ts +22 -1
- package/declarations/components/collections/listbox/item.d.ts.map +1 -0
- package/declarations/components/collections/listbox/listbox.d.ts +1 -0
- package/declarations/components/collections/listbox/listbox.d.ts.map +1 -0
- package/declarations/components/collections/listbox.d.ts +1 -0
- package/declarations/components/collections/listbox.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/body.d.ts +50 -35
- package/declarations/components/collections/simple-table/body.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/cell.d.ts +50 -35
- package/declarations/components/collections/simple-table/cell.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/column.d.ts +50 -35
- package/declarations/components/collections/simple-table/column.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/footer.d.ts +50 -35
- package/declarations/components/collections/simple-table/footer.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/header.d.ts +50 -35
- package/declarations/components/collections/simple-table/header.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/index.d.ts +50 -35
- package/declarations/components/collections/simple-table/index.d.ts.map +1 -0
- package/declarations/components/collections/simple-table/row.d.ts +50 -35
- package/declarations/components/collections/simple-table/row.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-default.d.ts +1 -0
- package/declarations/components/collections/table/cell-default.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-for.d.ts +1 -0
- package/declarations/components/collections/table/cell-for.d.ts.map +1 -0
- package/declarations/components/collections/table/cell-rendering-context.d.ts +1 -0
- package/declarations/components/collections/table/cell-rendering-context.d.ts.map +1 -0
- package/declarations/components/collections/table/checkbox.d.ts +6 -1
- package/declarations/components/collections/table/checkbox.d.ts.map +1 -0
- package/declarations/components/collections/table/column-visibility.d.ts +51 -36
- package/declarations/components/collections/table/column-visibility.d.ts.map +1 -0
- package/declarations/components/collections/table/index.d.ts +1 -0
- package/declarations/components/collections/table/index.d.ts.map +1 -0
- package/declarations/components/collections/table/sort-button.d.ts +50 -35
- package/declarations/components/collections/table/sort-button.d.ts.map +1 -0
- package/declarations/components/collections/table/table.d.ts +50 -35
- package/declarations/components/collections/table/table.d.ts.map +1 -0
- package/declarations/components/collections/table/types.d.ts +1 -0
- package/declarations/components/collections/table/types.d.ts.map +1 -0
- package/declarations/components/collections/table/utils.d.ts +1 -0
- package/declarations/components/collections/table/utils.d.ts.map +1 -0
- package/declarations/components/collections/table.d.ts +1 -0
- package/declarations/components/collections/table.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion/accordion.d.ts +8 -1
- package/declarations/components/disclosure/accordion/accordion.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion/item.d.ts +1 -0
- package/declarations/components/disclosure/accordion/item.d.ts.map +1 -0
- package/declarations/components/disclosure/accordion.d.ts +1 -0
- package/declarations/components/disclosure/accordion.d.ts.map +1 -0
- package/declarations/components/disclosure/index.d.ts +1 -0
- package/declarations/components/disclosure/index.d.ts.map +1 -0
- package/declarations/components/forms/autocomplete.d.ts +13 -23
- package/declarations/components/forms/autocomplete.d.ts.map +1 -0
- package/declarations/components/forms/checkbox-group.d.ts +8 -1
- package/declarations/components/forms/checkbox-group.d.ts.map +1 -0
- package/declarations/components/forms/checkbox.d.ts +6 -1
- package/declarations/components/forms/checkbox.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/date-picker.d.ts +13 -23
- package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/end-content.d.ts +1 -0
- package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/trigger.d.ts +1 -0
- package/declarations/components/forms/date-picker/trigger.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/types.d.ts +1 -0
- package/declarations/components/forms/date-picker/types.d.ts.map +1 -0
- package/declarations/components/forms/date-picker/value.d.ts +1 -0
- package/declarations/components/forms/date-picker/value.d.ts.map +1 -0
- package/declarations/components/forms/date-picker.d.ts +1 -0
- package/declarations/components/forms/date-picker.d.ts.map +1 -0
- package/declarations/components/forms/field-types.d.ts +2 -1
- package/declarations/components/forms/field-types.d.ts.map +1 -0
- package/declarations/components/forms/field.d.ts +1 -0
- package/declarations/components/forms/field.d.ts.map +1 -0
- package/declarations/components/forms/form-control.d.ts +1 -0
- package/declarations/components/forms/form-control.d.ts.map +1 -0
- package/declarations/components/forms/form-description.d.ts +1 -0
- package/declarations/components/forms/form-description.d.ts.map +1 -0
- package/declarations/components/forms/form-feedback.d.ts +1 -0
- package/declarations/components/forms/form-feedback.d.ts.map +1 -0
- package/declarations/components/forms/form.d.ts +2 -11
- package/declarations/components/forms/form.d.ts.map +1 -0
- package/declarations/components/forms/index.d.ts +1 -0
- package/declarations/components/forms/index.d.ts.map +1 -0
- package/declarations/components/forms/input-otp.d.ts +10 -12
- package/declarations/components/forms/input-otp.d.ts.map +1 -0
- package/declarations/components/forms/input.d.ts +12 -12
- package/declarations/components/forms/input.d.ts.map +1 -0
- package/declarations/components/forms/label.d.ts +6 -1
- package/declarations/components/forms/label.d.ts.map +1 -0
- package/declarations/components/forms/native-select.d.ts +11 -1
- package/declarations/components/forms/native-select.d.ts.map +1 -0
- package/declarations/components/forms/radio-group.d.ts +8 -1
- package/declarations/components/forms/radio-group.d.ts.map +1 -0
- package/declarations/components/forms/radio.d.ts +6 -1
- package/declarations/components/forms/radio.d.ts.map +1 -0
- package/declarations/components/forms/select/end-content.d.ts +1 -0
- package/declarations/components/forms/select/end-content.d.ts.map +1 -0
- package/declarations/components/forms/select/native-mirror.d.ts +1 -0
- package/declarations/components/forms/select/native-mirror.d.ts.map +1 -0
- package/declarations/components/forms/select/select.d.ts +15 -34
- package/declarations/components/forms/select/select.d.ts.map +1 -0
- package/declarations/components/forms/select/selected-items.d.ts +1 -0
- package/declarations/components/forms/select/selected-items.d.ts.map +1 -0
- package/declarations/components/forms/select/trigger.d.ts +1 -0
- package/declarations/components/forms/select/trigger.d.ts.map +1 -0
- package/declarations/components/forms/select/types.d.ts +1 -0
- package/declarations/components/forms/select/types.d.ts.map +1 -0
- package/declarations/components/forms/select.d.ts +1 -0
- package/declarations/components/forms/select.d.ts.map +1 -0
- package/declarations/components/forms/switch.d.ts +8 -1
- package/declarations/components/forms/switch.d.ts.map +1 -0
- package/declarations/components/forms/textarea.d.ts +11 -1
- package/declarations/components/forms/textarea.d.ts.map +1 -0
- package/declarations/components/navigation/external-link.d.ts +2 -1
- package/declarations/components/navigation/external-link.d.ts.map +1 -0
- package/declarations/components/navigation/index.d.ts +1 -0
- package/declarations/components/navigation/index.d.ts.map +1 -0
- package/declarations/components/navigation/pagination/pagination.d.ts +8 -1
- package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -0
- package/declarations/components/navigation/pagination/range.d.ts +1 -0
- package/declarations/components/navigation/pagination/range.d.ts.map +1 -0
- package/declarations/components/navigation/pagination.d.ts +1 -0
- package/declarations/components/navigation/pagination.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav/item.d.ts +1 -0
- package/declarations/components/navigation/tab-nav/item.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts +11 -1
- package/declarations/components/navigation/tab-nav/tab-nav.d.ts.map +1 -0
- package/declarations/components/navigation/tab-nav.d.ts +1 -0
- package/declarations/components/navigation/tab-nav.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/panel.d.ts +1 -0
- package/declarations/components/navigation/tabs/panel.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/tab.d.ts +1 -0
- package/declarations/components/navigation/tabs/tab.d.ts.map +1 -0
- package/declarations/components/navigation/tabs/tabs.d.ts +11 -1
- package/declarations/components/navigation/tabs/tabs.d.ts.map +1 -0
- package/declarations/components/navigation/tabs.d.ts +1 -0
- package/declarations/components/navigation/tabs.d.ts.map +1 -0
- package/declarations/components/notifications/index.d.ts +1 -0
- package/declarations/components/notifications/index.d.ts.map +1 -0
- package/declarations/components/notifications/notification-card.d.ts +2 -3
- package/declarations/components/notifications/notification-card.d.ts.map +1 -0
- package/declarations/components/notifications/notifications-container.d.ts +1 -0
- package/declarations/components/notifications/notifications-container.d.ts.map +1 -0
- package/declarations/components/overlays/backdrop.d.ts +1 -0
- package/declarations/components/overlays/backdrop.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/body.d.ts +1 -0
- package/declarations/components/overlays/drawer/body.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/drag-handle.d.ts +1 -0
- package/declarations/components/overlays/drawer/drag-handle.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/footer.d.ts +1 -0
- package/declarations/components/overlays/drawer/footer.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/header.d.ts +1 -0
- package/declarations/components/overlays/drawer/header.d.ts.map +1 -0
- package/declarations/components/overlays/drawer/selectors.d.ts +1 -0
- package/declarations/components/overlays/drawer/selectors.d.ts.map +1 -0
- package/declarations/components/overlays/drawer.d.ts +62 -54
- package/declarations/components/overlays/drawer.d.ts.map +1 -0
- package/declarations/components/overlays/index.d.ts +1 -0
- package/declarations/components/overlays/index.d.ts.map +1 -0
- package/declarations/components/overlays/modal/body.d.ts +1 -0
- package/declarations/components/overlays/modal/body.d.ts.map +1 -0
- package/declarations/components/overlays/modal/footer.d.ts +1 -0
- package/declarations/components/overlays/modal/footer.d.ts.map +1 -0
- package/declarations/components/overlays/modal/header.d.ts +1 -0
- package/declarations/components/overlays/modal/header.d.ts.map +1 -0
- package/declarations/components/overlays/modal.d.ts +18 -12
- package/declarations/components/overlays/modal.d.ts.map +1 -0
- package/declarations/components/overlays/mount-animation.d.ts +1 -0
- package/declarations/components/overlays/mount-animation.d.ts.map +1 -0
- package/declarations/components/overlays/overlay.d.ts +14 -0
- package/declarations/components/overlays/overlay.d.ts.map +1 -0
- package/declarations/components/overlays/popover.d.ts +1 -0
- package/declarations/components/overlays/popover.d.ts.map +1 -0
- package/declarations/components/overlays/portal-target.d.ts +1 -0
- package/declarations/components/overlays/portal-target.d.ts.map +1 -0
- package/declarations/components/overlays/portal.d.ts +1 -0
- package/declarations/components/overlays/portal.d.ts.map +1 -0
- package/declarations/components/overlays/tooltip.d.ts +1 -0
- package/declarations/components/overlays/tooltip.d.ts.map +1 -0
- package/declarations/components/status/alert.d.ts +2 -3
- package/declarations/components/status/alert.d.ts.map +1 -0
- package/declarations/components/status/index.d.ts +1 -0
- package/declarations/components/status/index.d.ts.map +1 -0
- package/declarations/components/status/progress-bar.d.ts +1 -0
- package/declarations/components/status/progress-bar.d.ts.map +1 -0
- package/declarations/components/utilities/avatar.d.ts +13 -7
- package/declarations/components/utilities/avatar.d.ts.map +1 -0
- package/declarations/components/utilities/collapsible.d.ts +1 -0
- package/declarations/components/utilities/collapsible.d.ts.map +1 -0
- package/declarations/components/utilities/divider.d.ts +12 -0
- package/declarations/components/utilities/divider.d.ts.map +1 -0
- package/declarations/components/utilities/index.d.ts +1 -0
- package/declarations/components/utilities/index.d.ts.map +1 -0
- package/declarations/components/utilities/kbd.d.ts +1 -0
- package/declarations/components/utilities/kbd.d.ts.map +1 -0
- package/declarations/components/utilities/skeleton.d.ts +1 -0
- package/declarations/components/utilities/skeleton.d.ts.map +1 -0
- package/declarations/components/utilities/spinner.d.ts +1 -0
- package/declarations/components/utilities/spinner.d.ts.map +1 -0
- package/declarations/components/utilities/visually-hidden.d.ts +1 -0
- package/declarations/components/utilities/visually-hidden.d.ts.map +1 -0
- package/declarations/disclosure.d.ts +1 -0
- package/declarations/disclosure.d.ts.map +1 -0
- package/declarations/forms.d.ts +1 -0
- package/declarations/forms.d.ts.map +1 -0
- package/declarations/index.d.ts +1 -0
- package/declarations/index.d.ts.map +1 -0
- package/declarations/modifiers/drag-to-dismiss.d.ts +1 -0
- package/declarations/modifiers/drag-to-dismiss.d.ts.map +1 -0
- package/declarations/modifiers/press.d.ts +1 -0
- package/declarations/modifiers/press.d.ts.map +1 -0
- package/declarations/navigation.d.ts +1 -0
- package/declarations/navigation.d.ts.map +1 -0
- package/declarations/notifications.d.ts +1 -0
- package/declarations/notifications.d.ts.map +1 -0
- package/declarations/overlays.d.ts +1 -0
- package/declarations/overlays.d.ts.map +1 -0
- package/declarations/services/notifications.d.ts +1 -0
- package/declarations/services/notifications.d.ts.map +1 -0
- package/declarations/status.d.ts +1 -0
- package/declarations/status.d.ts.map +1 -0
- package/declarations/test-support.d.ts +1 -0
- package/declarations/test-support.d.ts.map +1 -0
- package/declarations/utilities.d.ts +1 -0
- package/declarations/utilities.d.ts.map +1 -0
- package/declarations/utils/deferred-work.d.ts +1 -0
- package/declarations/utils/deferred-work.d.ts.map +1 -0
- package/declarations/utils/filter.d.ts +1 -0
- package/declarations/utils/filter.d.ts.map +1 -0
- package/declarations/utils/forms-utils-index.d.ts +1 -0
- package/declarations/utils/forms-utils-index.d.ts.map +1 -0
- package/declarations/utils/keys.d.ts +1 -0
- package/declarations/utils/keys.d.ts.map +1 -0
- package/declarations/utils/listManager.d.ts +22 -0
- package/declarations/utils/listManager.d.ts.map +1 -0
- package/declarations/utils/nested-data.d.ts +1 -0
- package/declarations/utils/nested-data.d.ts.map +1 -0
- package/declarations/utils/prefers-reduced-motion.d.ts +1 -0
- package/declarations/utils/prefers-reduced-motion.d.ts.map +1 -0
- package/declarations/utils/ref.d.ts +2 -1
- package/declarations/utils/ref.d.ts.map +1 -0
- package/declarations/utils/roving-focus.d.ts +1 -0
- package/declarations/utils/roving-focus.d.ts.map +1 -0
- package/declarations/utils/safe-area.d.ts +1 -0
- package/declarations/utils/safe-area.d.ts.map +1 -0
- package/declarations/utils/safe-styles.d.ts +1 -0
- package/declarations/utils/safe-styles.d.ts.map +1 -0
- package/declarations/utils/selection-indicator.d.ts +1 -0
- package/declarations/utils/selection-indicator.d.ts.map +1 -0
- package/declarations/utils/standard-validator.d.ts +1 -0
- package/declarations/utils/standard-validator.d.ts.map +1 -0
- package/declarations/utils/toggle.d.ts +1 -0
- package/declarations/utils/toggle.d.ts.map +1 -0
- package/dist/components/buttons/button-group.js.map +1 -1
- package/dist/components/buttons/button.js.map +1 -1
- package/dist/components/buttons/chip.js.map +1 -1
- package/dist/components/buttons/close-button.js +1 -1
- package/dist/components/buttons/close-button.js.map +1 -1
- package/dist/components/buttons/segmented-control/item.js.map +1 -1
- package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
- package/dist/components/buttons/toggle-button.js.map +1 -1
- package/dist/components/collections/calendar/calendar.js.map +1 -1
- package/dist/components/collections/calendar/day-cell.js.map +1 -1
- package/dist/components/collections/calendar/header.js +1 -2
- package/dist/components/collections/calendar/header.js.map +1 -1
- package/dist/components/collections/calendar/month-grid.js.map +1 -1
- package/dist/components/collections/calendar/utils.js.map +1 -1
- package/dist/components/collections/calendar/year-grid.js.map +1 -1
- package/dist/components/collections/command/command.js.map +1 -1
- package/dist/components/collections/command/dialog.js +0 -1
- package/dist/components/collections/command/dialog.js.map +1 -1
- package/dist/components/collections/command/footer.js.map +1 -1
- package/dist/components/collections/command/input.js.map +1 -1
- package/dist/components/collections/command/list.js.map +1 -1
- package/dist/components/collections/dropdown/dropdown.js +72 -7
- package/dist/components/collections/dropdown/dropdown.js.map +1 -1
- package/dist/components/collections/dropdown/menu-context.js +52 -1
- package/dist/components/collections/dropdown/menu-context.js.map +1 -1
- package/dist/components/collections/dropdown/sub.js +2 -9
- package/dist/components/collections/dropdown/sub.js.map +1 -1
- package/dist/components/collections/listbox/group.js.map +1 -1
- package/dist/components/collections/listbox/item.js +32 -6
- package/dist/components/collections/listbox/item.js.map +1 -1
- package/dist/components/collections/listbox/listbox.js.map +1 -1
- package/dist/components/collections/simple-table/body.js.map +1 -1
- package/dist/components/collections/simple-table/cell.js.map +1 -1
- package/dist/components/collections/simple-table/column.js.map +1 -1
- package/dist/components/collections/simple-table/footer.js.map +1 -1
- package/dist/components/collections/simple-table/header.js.map +1 -1
- package/dist/components/collections/simple-table/index.js.map +1 -1
- package/dist/components/collections/simple-table/row.js.map +1 -1
- package/dist/components/collections/table/cell-default.js.map +1 -1
- package/dist/components/collections/table/cell-for.js.map +1 -1
- package/dist/components/collections/table/cell-rendering-context.js.map +1 -1
- package/dist/components/collections/table/checkbox.js.map +1 -1
- package/dist/components/collections/table/column-visibility.js +1 -1
- package/dist/components/collections/table/column-visibility.js.map +1 -1
- package/dist/components/collections/table/sort-button.js +1 -1
- package/dist/components/collections/table/sort-button.js.map +1 -1
- package/dist/components/collections/table/table.js +1 -2
- package/dist/components/collections/table/table.js.map +1 -1
- package/dist/components/collections/table/utils.js.map +1 -1
- package/dist/components/disclosure/accordion/accordion.js.map +1 -1
- package/dist/components/disclosure/accordion/item.js +1 -1
- package/dist/components/disclosure/accordion/item.js.map +1 -1
- package/dist/components/forms/autocomplete.js +1 -1
- package/dist/components/forms/autocomplete.js.map +1 -1
- package/dist/components/forms/checkbox-group.js.map +1 -1
- package/dist/components/forms/checkbox.js.map +1 -1
- package/dist/components/forms/date-picker/date-picker.js.map +1 -1
- package/dist/components/forms/date-picker/end-content.js +1 -1
- package/dist/components/forms/date-picker/end-content.js.map +1 -1
- package/dist/components/forms/date-picker/trigger.js.map +1 -1
- package/dist/components/forms/date-picker/value.js.map +1 -1
- package/dist/components/forms/field.js.map +1 -1
- package/dist/components/forms/form-control.js.map +1 -1
- package/dist/components/forms/form-description.js.map +1 -1
- package/dist/components/forms/form-feedback.js.map +1 -1
- package/dist/components/forms/form.js.map +1 -1
- package/dist/components/forms/input-otp.js.map +1 -1
- package/dist/components/forms/input.js.map +1 -1
- package/dist/components/forms/label.js.map +1 -1
- package/dist/components/forms/native-select.js +2 -2
- package/dist/components/forms/native-select.js.map +1 -1
- package/dist/components/forms/radio-group.js.map +1 -1
- package/dist/components/forms/radio.js.map +1 -1
- package/dist/components/forms/select/end-content.js +1 -1
- package/dist/components/forms/select/end-content.js.map +1 -1
- package/dist/components/forms/select/native-mirror.js.map +1 -1
- package/dist/components/forms/select/select.js.map +1 -1
- package/dist/components/forms/select/selected-items.js.map +1 -1
- package/dist/components/forms/select/trigger.js.map +1 -1
- package/dist/components/forms/switch.js.map +1 -1
- package/dist/components/forms/textarea.js.map +1 -1
- package/dist/components/navigation/external-link.js.map +1 -1
- package/dist/components/navigation/pagination/pagination.js +1 -1
- package/dist/components/navigation/pagination/pagination.js.map +1 -1
- package/dist/components/navigation/pagination/range.js.map +1 -1
- package/dist/components/navigation/tab-nav/item.js.map +1 -1
- package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
- package/dist/components/navigation/tabs/panel.js.map +1 -1
- package/dist/components/navigation/tabs/tab.js.map +1 -1
- package/dist/components/navigation/tabs/tabs.js.map +1 -1
- package/dist/components/notifications/index.js +2 -2
- package/dist/components/notifications/notification-card.js +2 -2
- package/dist/components/notifications/notifications-container.js +1 -1
- package/dist/components/notifications/notifications-container.js.map +1 -1
- package/dist/components/overlays/backdrop.js +1 -1
- package/dist/components/overlays/backdrop.js.map +1 -1
- package/dist/components/overlays/drawer/body.js.map +1 -1
- package/dist/components/overlays/drawer/drag-handle.js.map +1 -1
- package/dist/components/overlays/drawer/footer.js.map +1 -1
- package/dist/components/overlays/drawer/header.js.map +1 -1
- package/dist/components/overlays/drawer/selectors.js.map +1 -1
- package/dist/components/overlays/drawer.js +1 -1
- package/dist/components/overlays/drawer.js.map +1 -1
- package/dist/components/overlays/modal/body.js.map +1 -1
- package/dist/components/overlays/modal/footer.js.map +1 -1
- package/dist/components/overlays/modal/header.js.map +1 -1
- package/dist/components/overlays/modal.js +1 -1
- package/dist/components/overlays/modal.js.map +1 -1
- package/dist/components/overlays/mount-animation.js.map +1 -1
- package/dist/components/overlays/overlay.js +52 -3
- package/dist/components/overlays/overlay.js.map +1 -1
- package/dist/components/overlays/popover.js +2 -2
- package/dist/components/overlays/popover.js.map +1 -1
- package/dist/components/overlays/portal-target.js.map +1 -1
- package/dist/components/overlays/portal.js.map +1 -1
- package/dist/components/overlays/tooltip.js.map +1 -1
- package/dist/components/status/alert.js +11 -6
- package/dist/components/status/alert.js.map +1 -1
- package/dist/components/status/progress-bar.js.map +1 -1
- package/dist/components/utilities/avatar.js.map +1 -1
- package/dist/components/utilities/collapsible.js.map +1 -1
- package/dist/components/utilities/divider.js +1 -1
- package/dist/components/utilities/divider.js.map +1 -1
- package/dist/components/utilities/index.js +1 -1
- package/dist/components/utilities/kbd.js.map +1 -1
- package/dist/components/utilities/skeleton.js.map +1 -1
- package/dist/components/utilities/spinner.js.map +1 -1
- package/dist/components/utilities/visually-hidden.js.map +1 -1
- package/dist/control-blur-C8OnSQR5.js.map +1 -1
- package/dist/deprecated-args-BIUjLA8y.js.map +1 -1
- package/dist/dialog-CreV7aPQ.js.map +1 -1
- package/dist/dom-cKWVvtkd.js.map +1 -1
- package/dist/icons-DZ61nCzv.js +51 -0
- package/dist/icons-DZ61nCzv.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/{manager-B-PnYqDs.js → manager-jDaRVZ5o.js} +1 -3
- package/dist/manager-jDaRVZ5o.js.map +1 -0
- package/dist/modifiers/drag-to-dismiss.js.map +1 -1
- package/dist/modifiers/press.js.map +1 -1
- package/dist/{notification-card-CYmWQ35W.js → notification-card-dz-eE6z9.js} +2 -2
- package/dist/notification-card-dz-eE6z9.js.map +1 -0
- package/dist/notifications.js +2 -2
- package/dist/runtime--fcdnjmJ-BOdRhmsS.js.map +1 -1
- package/dist/services/notifications.js +1 -1
- package/dist/services/notifications.js.map +1 -1
- package/dist/test-support.js.map +1 -1
- package/dist/utilities.js +1 -1
- package/dist/utils/deferred-work.js.map +1 -1
- package/dist/utils/filter.js.map +1 -1
- package/dist/utils/forms-utils-index.js.map +1 -1
- package/dist/utils/keys.js.map +1 -1
- package/dist/utils/listManager.js +34 -4
- package/dist/utils/listManager.js.map +1 -1
- package/dist/utils/nested-data.js.map +1 -1
- package/dist/utils/prefers-reduced-motion.js.map +1 -1
- package/dist/utils/ref.js +1 -1
- package/dist/utils/ref.js.map +1 -1
- package/dist/utils/roving-focus.js.map +1 -1
- package/dist/utils/safe-area.js.map +1 -1
- package/dist/utils/safe-styles.js.map +1 -1
- package/dist/utils/selection-indicator.js.map +1 -1
- package/dist/utils/standard-validator.js.map +1 -1
- package/dist/utils/toggle.js.map +1 -1
- package/package.json +23 -24
- package/dist/components/collections/calendar/icons.js +0 -23
- package/dist/components/collections/calendar/icons.js.map +0 -1
- package/dist/components/collections/table/icons.js +0 -19
- package/dist/components/collections/table/icons.js.map +0 -1
- package/dist/components/disclosure/icons.js +0 -13
- package/dist/components/disclosure/icons.js.map +0 -1
- package/dist/components/forms/icons.js +0 -16
- package/dist/components/forms/icons.js.map +0 -1
- package/dist/components/navigation/pagination/icons.js +0 -23
- package/dist/components/navigation/pagination/icons.js.map +0 -1
- package/dist/intent-icons-DpEViO8C.js +0 -19
- package/dist/intent-icons-DpEViO8C.js.map +0 -1
- package/dist/manager-B-PnYqDs.js.map +0 -1
- package/dist/notification-card-CYmWQ35W.js.map +0 -1
- package/dist/template-registry.js +0 -2
- package/dist/template-registry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-select.js","sources":["../../../src/components/forms/native-select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { assert } from '@ember/debug';\nimport type Owner from '@ember/owner';\nimport {\n useStyles,\n type NativeSelectSlots,\n type NativeSelectVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n ListManager,\n keyAndLabelForItem,\n type ListItem\n} from '../../utils/listManager';\nimport { IconChevronUpDown } from './icons';\nimport type { WithBoundArgs } from '@glint/template';\n\ntype ItemCompBounded = WithBoundArgs<typeof NativeSelectItem, 'manager'>;\ntype ItemCompBoundedWithItem = WithBoundArgs<\n typeof NativeSelectItem,\n 'manager' | 'item'\n>;\n\n// Base interface for shared properties\ninterface BaseArgs<T> extends FormControlSharedArgs {\n /**\n * Keys of the options that cannot be selected. Disabled options are still\n * rendered and announced, they just cannot be picked.\n */\n disabledKeys?: string[];\n\n /**\n * Renders an extra empty option, letting the user clear the selection.\n * Label it with the placeholder argument.\n *\n * @defaultValue false\n */\n allowEmpty?: boolean;\n\n /**\n * Collection used to render the options. Strings and numbers become both the\n * key and the label; objects use key or id for the key and label, value,\n * name or title for the label. Use the :item block when your data does not\n * follow those conventions.\n */\n items?: T[];\n\n /**\n * Id applied to the select element and referenced by its label. One is\n * generated when omitted.\n */\n id?: string;\n\n /**\n * Name of the select element, used when the surrounding form is submitted.\n */\n name?: string;\n\n /**\n * The size of the control.\n *\n * @defaultValue 'md'\n */\n size?: NativeSelectVariants['size'];\n\n /**\n * Per-slot class overrides: base, innerContainer, input, startContent,\n * endContent and icon.\n */\n classes?: SlotsToClasses<NativeSelectSlots>;\n\n /**\n * Placeholder text used when `allowEmpty` is set to `true`.\n */\n placeholder?: string;\n\n /**\n * Called with the key of an option whenever it is acted upon, including when\n * the same option is picked again. Use onSelectionChange to track state.\n */\n onAction?: (key: string) => void;\n\n /**\n * @internal\n */\n onItemsChange?: (items: ListItem[], action: 'add' | 'remove') => void;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * Defauled to `none` to pass the click event to the input. If your content\n * needs to capture events, consider adding `pointer-events-auto` class to that\n * element only.\n *\n * @defaultValue 'none'\n */\n endContentPointerEvents?: 'none' | 'auto';\n}\n\n// Single selection mode interface\ninterface SingleNativeSelectArgs<T> extends BaseArgs<T> {\n /**\n * Whether one option or several can be selected. Multiple renders the native\n * multi-select list box and switches to selectedKeys.\n *\n * @defaultValue 'single'\n */\n selectionMode?: 'single' | undefined;\n\n /**\n * The selected key in single selection mode. The component is controlled:\n * update this from onSelectionChange.\n */\n selectedKey?: string | null;\n\n /**\n * Not available in single selection mode; use selectedKey.\n */\n selectedKeys?: never;\n\n /**\n * Called with the newly selected key, or null when the selection is cleared\n * through the allowEmpty option.\n */\n onSelectionChange?: (key: string | null) => void;\n}\n\n// Multiple selection mode interface\ninterface MultipleNativeSelectArgs<T> extends BaseArgs<T> {\n /**\n * Whether one option or several can be selected. Multiple renders the native\n * multi-select list box and switches to selectedKeys.\n *\n * @defaultValue 'single'\n */\n selectionMode: 'multiple';\n\n /**\n * Not available in multiple selection mode; use selectedKeys.\n */\n selectedKey?: never;\n\n /**\n * The selected keys in multiple selection mode. The component is controlled:\n * update this from onSelectionChange.\n */\n selectedKeys?: string[];\n\n /**\n * Called with every selected key each time the selection changes.\n */\n onSelectionChange?: (keys: string[]) => void;\n}\n\n// Union type for the component\ntype Args<T> = SingleNativeSelectArgs<T> | MultipleNativeSelectArgs<T>;\n\ninterface NativeSelectSignature<T> {\n Args: Args<T>;\n Element: HTMLSelectElement;\n Blocks: {\n item: [\n { item: T; key: string; label: string; Item: ItemCompBoundedWithItem }\n ];\n default: [{ Item: ItemCompBounded }];\n startContent: [];\n endContent: [];\n };\n}\n\nclass NativeSelect<T = unknown> extends Component<NativeSelectSignature<T>> {\n constructor(owner: Owner, args: Args<T>) {\n super(owner, args);\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n get normalizedSelectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this.args.selectedKeys || [];\n } else {\n // Single mode: convert selectedKey to array for ListManager\n const singleArgs = this.args as SingleNativeSelectArgs<T>;\n return singleArgs.selectedKey ? [singleArgs.selectedKey] : [];\n }\n }\n\n listManager = new ListManager({\n selectionMode: this.args.selectionMode,\n selectedKeys: this.normalizedSelectedKeys,\n disabledKeys: this.args.disabledKeys,\n allowEmpty: this.args.allowEmpty,\n onSelectionChange: (keys: string[]) => this.handleSelectionChange(keys),\n onAction: this.args.onAction,\n onListItemsChange: this.args.onItemsChange\n });\n\n handleSelectionChange(keys: string[]) {\n if (this.args.selectionMode === 'multiple') {\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n }\n\n get classes() {\n const { nativeSelect } = useStyles();\n return nativeSelect({\n size: this.args.size\n });\n }\n\n get isMultiple() {\n return this.args.selectionMode === 'multiple';\n }\n\n @action\n handleOnChange(event: Event) {\n const selectElement = event.target as HTMLSelectElement;\n let newSelectedKeys: string[] = [];\n\n for (var i = 0; i < selectElement.options.length; i++) {\n const option = selectElement.options[i];\n if (option && option.selected && option.value !== '') {\n newSelectedKeys.push(option.value);\n }\n\n // handle allowEmpty\n if (\n this.args.selectionMode !== 'multiple' &&\n this.args.allowEmpty === true &&\n option &&\n option.selected &&\n option.value === ''\n ) {\n newSelectedKeys = [];\n }\n }\n\n this.handleSelectionChange(newSelectedKeys);\n }\n\n <template>\n <FormControl\n @id={{@id}}\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"native-select\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <select\n {{this.listManager.setup\n selectedKeys=this.normalizedSelectedKeys\n disabledKeys=@disabledKeys\n selectionMode=@selectionMode\n allowEmpty=@allowEmpty\n onListItemsChange=@onItemsChange\n isKeyboardEventsEnabled=false\n }}\n {{on \"change\" this.handleOnChange}}\n multiple={{this.isMultiple}}\n data-test-id=\"native-select\"\n data-part=\"input\"\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n id={{c.id}}\n name={{@name}}\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n >\n {{#if this.args.allowEmpty}}\n <NativeSelectItem @manager={{this.listManager}} @key=\"\">\n {{this.args.placeholder}}\n </NativeSelectItem>\n {{/if}}\n {{#each @items as |item|}}\n {{#let (keyAndLabelForItem item) as |keyLabel|}}\n {{#if (has-block \"item\")}}\n {{yield\n (hash\n item=item\n key=keyLabel.key\n label=keyLabel.label\n Item=(component\n NativeSelectItem manager=this.listManager item=item\n )\n )\n to=\"item\"\n }}\n {{else}}\n <NativeSelectItem\n @manager={{this.listManager}}\n @key={{keyLabel.key}}\n @item={{item}}\n >\n {{keyLabel.label}}\n </NativeSelectItem>\n {{/if}}\n {{/let}}\n {{/each}}\n\n {{yield\n (hash Item=(component NativeSelectItem manager=this.listManager))\n to=\"default\"\n }}\n </select>\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n <IconChevronUpDown\n data-part=\"icon\"\n class={{this.classes.icon class=@classes.icon}}\n />\n </div>\n </div>\n </FormControl>\n </template>\n}\n\nexport interface SelectItemSignature {\n Args: {\n /**\n * The ListManager that tracks selection for the parent select. It is bound\n * for you on the yielded Item component.\n */\n manager: ListManager;\n\n /**\n * Value of the rendered option, and the key reported by onSelectionChange,\n * selectedKey or selectedKeys, and disabledKeys.\n */\n key: string;\n\n /**\n * Text representation of the option, used for matching. Defaults to the\n * option's rendered text content.\n */\n textValue?: string;\n\n /**\n * The entry of `@items` this option renders, remembered on the registered\n * list item so a selection can hand it back. Bound for you on the Item\n * yielded from the `:item` block; block-form options have no such entry.\n */\n item?: unknown;\n };\n Element: HTMLOptionElement;\n Blocks: {\n default: [];\n selectedIcon: [];\n start: [];\n end: [];\n };\n}\n\nclass NativeSelectItem extends Component<SelectItemSignature> {\n @tracked listItem?: ListItem;\n\n get manager(): ListManager {\n assert(\n `SelectItem does not have a listManager; Missing argument @manager`,\n this.args.manager\n );\n\n return this.args.manager;\n }\n\n get key(): string {\n if (this.args.key !== '') {\n assert(\n `Argument @key is undefined or null, @key must be provided in Select.Item component`,\n this.args.key\n );\n }\n\n return this.args.key;\n }\n\n @action\n onRegister(item: ListItem) {\n this.listItem = item;\n }\n\n <template>\n <option\n {{this.manager.setupItem\n key=this.key\n textValue=@textValue\n item=@item\n onRegister=this.onRegister\n }}\n data-selected=\"{{this.listItem.isSelected}}\"\n data-key={{this.key}}\n selected={{this.listItem.isSelected}}\n value={{this.key}}\n disabled={{this.listItem.isDisabled}}\n ...attributes\n >\n {{yield}}\n </option>\n </template>\n}\n\nexport { NativeSelect, type NativeSelectSignature, type ListItem };\nexport default NativeSelect;\n"],"names":["NativeSelect","Component","constructor","owner","args","validateArgs","selectionMode","console","warn","normalizedSelectedKeys","selectedKeys","singleArgs","selectedKey","listManager","ListManager","disabledKeys","allowEmpty","onSelectionChange","keys","handleSelectionChange","onAction","onListItemsChange","onItemsChange","singleKey","length","classes","nativeSelect","useStyles","size","isMultiple","handleOnChange","event","selectElement","target","newSelectedKeys","i","options","option","selected","value","push","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","NativeSelectItem","keyAndLabelForItem","hash","IconChevronUpDown","g","tracked","manager","assert","key","onRegister","item","listItem"],"mappings":";;;;;;;;;;;;;;AAsLA,MAAMA,YAAA,SAAkCC,UAAgC;AACtEC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAa,EAAE;AACvC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb;IACA,IAAI,CAACC,YAAY,EAAA;AACnB,EAAA;AAEAA,EAAAA,YAAAA,GAAe;AACb,IAAA,IAAI,IAAI,CAACD,IAAI,CAACE,aAAa,KAAK,UAAA,EAAY;MAC1C,IACE,OAAQ,IAAI,CAACF,IAAI,CACf,aAAA,CACD,KAAK,WAAA,EACN;AACAG,QAAAA,OAAA,CAAQC,IAAI,CACV,6FAAA,CAAA;AAEJ,MAAA;AACF,IAAA,CAAA,MAAO;MACL,IACE,OAAQ,IAAI,CAACJ,IAAI,CACf,cAAA,CACD,KAAK,WAAA,EACN;AACAG,QAAAA,OAAA,CAAQC,IAAI,CACV,yFAAA,CAAA;AAEJ,MAAA;AACF,IAAA;AACF,EAAA;EAEA,IAAIC,sBAAAA,GAAmC;AACrC,IAAA,IAAI,IAAI,CAACL,IAAI,CAACE,aAAa,KAAK,UAAA,EAAY;AAC1C,MAAA,OAAO,IAAI,CAACF,IAAI,CAACM,YAAY,IAAI,EAAE;AACrC,IAAA,CAAA,MAAO;AACL;AACA,M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C,EAAA;QAAAC,gBAAA;QAAAC,kBAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAsCA,MAAMH,yBAAyBjD,SAAA,CAAU;AAAA,EAAA;IAAAqD,eAAA,CAAA,IAAA,CAAAZ,SAAA,EAAA,UAAA,EAAA,CACtCa,OAAA,CAAA,CAAA;AAAA;EAAA,SAAA,IAAApB,2BAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAA,MAAA;EAED,IAAIqB,UAAuB;IACzBC,MAAA,CACE,mEAAmE,EACnE,IAAI,CAACrD,IAAI,CAACoD,OAAO,CAAA;AAGnB,IAAA,OAAO,IAAI,CAACpD,IAAI,CAACoD,OAAO;AAC1B,EAAA;EAEA,IAAIE,GAAAA,GAAc;AAChB,IAAA,IAAI,IAAI,CAACtD,IAAI,CAACsD,GAAG,KAAK,EAAA,EAAI;MACxBD,MAAA,CACE,oFAAoF,EACpF,IAAI,CAACrD,IAAI,CAACsD,GAAG,CAAA;AAEjB,IAAA;AAEA,IAAA,OAAO,IAAI,CAACtD,IAAI,CAACsD,GAAG;AACtB,EAAA;EAGAC,UAAAA,CAAWC,IAAc,EAAE;IACzB,IAAI,CAACC,QAAQ,GAAGD,IAAA;AAClB,EAAA;AAAA,EAAA;IAAAnB,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;AAAA;AAKD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,uTAAA,EAiBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"native-select.js","sources":["../../../src/components/forms/native-select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { hash } from '@ember/helper';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { assert } from '@ember/debug';\nimport type Owner from '@ember/owner';\nimport {\n useStyles,\n type NativeSelectSlots,\n type NativeSelectVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n ListManager,\n keyAndLabelForItem,\n type ListItem\n} from '../../utils/listManager';\nimport { IconChevronUpDown } from '../../-private/icons';\nimport type { WithBoundArgs } from '@glint/template';\n\ntype ItemCompBounded = WithBoundArgs<typeof NativeSelectItem, 'manager'>;\ntype ItemCompBoundedWithItem = WithBoundArgs<\n typeof NativeSelectItem,\n 'manager' | 'item'\n>;\n\n// Base interface for shared properties\ninterface BaseArgs<T> extends FormControlSharedArgs {\n /**\n * Keys of the options that cannot be selected. Disabled options are still\n * rendered and announced, they just cannot be picked.\n */\n disabledKeys?: string[];\n\n /**\n * Renders an extra empty option, letting the user clear the selection.\n * Label it with the placeholder argument.\n *\n * @defaultValue false\n */\n allowEmpty?: boolean;\n\n /**\n * Collection used to render the options. Strings and numbers become both the\n * key and the label; objects use key or id for the key and label, value,\n * name or title for the label. Use the :item block when your data does not\n * follow those conventions.\n */\n items?: T[];\n\n /**\n * Id applied to the select element and referenced by its label. One is\n * generated when omitted.\n */\n id?: string;\n\n /**\n * Name of the select element, used when the surrounding form is submitted.\n */\n name?: string;\n\n /**\n * The size of the control.\n *\n * @defaultValue 'md'\n */\n size?: NativeSelectVariants['size'];\n\n /**\n * Per-slot class overrides: base, innerContainer, input, startContent,\n * endContent and icon.\n */\n classes?: SlotsToClasses<NativeSelectSlots>;\n\n /**\n * Placeholder text used when `allowEmpty` is set to `true`.\n */\n placeholder?: string;\n\n /**\n * Called with the key of an option whenever it is acted upon, including when\n * the same option is picked again. Use onSelectionChange to track state.\n */\n onAction?: (key: string) => void;\n\n /**\n * @internal\n */\n onItemsChange?: (items: ListItem[], action: 'add' | 'remove') => void;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * Defauled to `none` to pass the click event to the input. If your content\n * needs to capture events, consider adding `pointer-events-auto` class to that\n * element only.\n *\n * @defaultValue 'none'\n */\n endContentPointerEvents?: 'none' | 'auto';\n}\n\n// Single selection mode interface\ninterface SingleNativeSelectArgs<T> extends BaseArgs<T> {\n /**\n * Whether one option or several can be selected. Multiple renders the native\n * multi-select list box and switches to selectedKeys.\n *\n * @defaultValue 'single'\n */\n selectionMode?: 'single' | undefined;\n\n /**\n * The selected key in single selection mode. The component is controlled:\n * update this from onSelectionChange.\n */\n selectedKey?: string | null;\n\n /**\n * Not available in single selection mode; use selectedKey.\n */\n selectedKeys?: never;\n\n /**\n * Called with the newly selected key, or null when the selection is cleared\n * through the allowEmpty option.\n */\n onSelectionChange?: (key: string | null) => void;\n}\n\n// Multiple selection mode interface\ninterface MultipleNativeSelectArgs<T> extends BaseArgs<T> {\n /**\n * Whether one option or several can be selected. Multiple renders the native\n * multi-select list box and switches to selectedKeys.\n *\n * @defaultValue 'single'\n */\n selectionMode: 'multiple';\n\n /**\n * Not available in multiple selection mode; use selectedKeys.\n */\n selectedKey?: never;\n\n /**\n * The selected keys in multiple selection mode. The component is controlled:\n * update this from onSelectionChange.\n */\n selectedKeys?: string[];\n\n /**\n * Called with every selected key each time the selection changes.\n */\n onSelectionChange?: (keys: string[]) => void;\n}\n\n// Union type for the component\ntype Args<T> = SingleNativeSelectArgs<T> | MultipleNativeSelectArgs<T>;\n\ninterface NativeSelectSignature<T> {\n Args: Args<T>;\n Element: HTMLSelectElement;\n Blocks: {\n item: [\n { item: T; key: string; label: string; Item: ItemCompBoundedWithItem }\n ];\n default: [{ Item: ItemCompBounded }];\n startContent: [];\n endContent: [];\n };\n}\n\nclass NativeSelect<T = unknown> extends Component<NativeSelectSignature<T>> {\n constructor(owner: Owner, args: Args<T>) {\n super(owner, args);\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n get normalizedSelectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this.args.selectedKeys || [];\n } else {\n // Single mode: convert selectedKey to array for ListManager\n const singleArgs = this.args as SingleNativeSelectArgs<T>;\n return singleArgs.selectedKey ? [singleArgs.selectedKey] : [];\n }\n }\n\n listManager = new ListManager({\n selectionMode: this.args.selectionMode,\n selectedKeys: this.normalizedSelectedKeys,\n disabledKeys: this.args.disabledKeys,\n allowEmpty: this.args.allowEmpty,\n onSelectionChange: (keys: string[]) => this.handleSelectionChange(keys),\n onAction: this.args.onAction,\n onListItemsChange: this.args.onItemsChange\n });\n\n handleSelectionChange(keys: string[]) {\n if (this.args.selectionMode === 'multiple') {\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n }\n\n get classes() {\n const { nativeSelect } = useStyles();\n return nativeSelect({\n size: this.args.size\n });\n }\n\n get isMultiple() {\n return this.args.selectionMode === 'multiple';\n }\n\n @action\n handleOnChange(event: Event) {\n const selectElement = event.target as HTMLSelectElement;\n let newSelectedKeys: string[] = [];\n\n for (let i = 0; i < selectElement.options.length; i++) {\n const option = selectElement.options[i];\n if (option && option.selected && option.value !== '') {\n newSelectedKeys.push(option.value);\n }\n\n // handle allowEmpty\n if (\n this.args.selectionMode !== 'multiple' &&\n this.args.allowEmpty === true &&\n option &&\n option.selected &&\n option.value === ''\n ) {\n newSelectedKeys = [];\n }\n }\n\n this.handleSelectionChange(newSelectedKeys);\n }\n\n <template>\n <FormControl\n @id={{@id}}\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"native-select\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <select\n {{this.listManager.setup\n selectedKeys=this.normalizedSelectedKeys\n disabledKeys=@disabledKeys\n selectionMode=@selectionMode\n allowEmpty=@allowEmpty\n onListItemsChange=@onItemsChange\n isKeyboardEventsEnabled=false\n }}\n {{on \"change\" this.handleOnChange}}\n multiple={{this.isMultiple}}\n data-test-id=\"native-select\"\n data-part=\"input\"\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n id={{c.id}}\n name={{@name}}\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n >\n {{#if this.args.allowEmpty}}\n <NativeSelectItem @manager={{this.listManager}} @key=\"\">\n {{this.args.placeholder}}\n </NativeSelectItem>\n {{/if}}\n {{#each @items as |item|}}\n {{#let (keyAndLabelForItem item) as |keyLabel|}}\n {{#if (has-block \"item\")}}\n {{yield\n (hash\n item=item\n key=keyLabel.key\n label=keyLabel.label\n Item=(component\n NativeSelectItem manager=this.listManager item=item\n )\n )\n to=\"item\"\n }}\n {{else}}\n <NativeSelectItem\n @manager={{this.listManager}}\n @key={{keyLabel.key}}\n @item={{item}}\n >\n {{keyLabel.label}}\n </NativeSelectItem>\n {{/if}}\n {{/let}}\n {{/each}}\n\n {{yield\n (hash Item=(component NativeSelectItem manager=this.listManager))\n to=\"default\"\n }}\n </select>\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n <IconChevronUpDown\n data-part=\"icon\"\n class={{this.classes.icon class=@classes.icon}}\n />\n </div>\n </div>\n </FormControl>\n </template>\n}\n\nexport interface SelectItemSignature {\n Args: {\n /**\n * The ListManager that tracks selection for the parent select. It is bound\n * for you on the yielded Item component.\n */\n manager: ListManager;\n\n /**\n * Value of the rendered option, and the key reported by onSelectionChange,\n * selectedKey or selectedKeys, and disabledKeys.\n */\n key: string;\n\n /**\n * Text representation of the option, used for matching. Defaults to the\n * option's rendered text content.\n */\n textValue?: string;\n\n /**\n * The entry of `@items` this option renders, remembered on the registered\n * list item so a selection can hand it back. Bound for you on the Item\n * yielded from the `:item` block; block-form options have no such entry.\n */\n item?: unknown;\n };\n Element: HTMLOptionElement;\n Blocks: {\n default: [];\n selectedIcon: [];\n start: [];\n end: [];\n };\n}\n\nclass NativeSelectItem extends Component<SelectItemSignature> {\n @tracked listItem?: ListItem;\n\n get manager(): ListManager {\n assert(\n `SelectItem does not have a listManager; Missing argument @manager`,\n this.args.manager\n );\n\n return this.args.manager;\n }\n\n get key(): string {\n if (this.args.key !== '') {\n assert(\n `Argument @key is undefined or null, @key must be provided in Select.Item component`,\n this.args.key\n );\n }\n\n return this.args.key;\n }\n\n @action\n onRegister(item: ListItem) {\n this.listItem = item;\n }\n\n <template>\n <option\n {{this.manager.setupItem\n key=this.key\n textValue=@textValue\n item=@item\n onRegister=this.onRegister\n }}\n data-selected=\"{{this.listItem.isSelected}}\"\n data-key={{this.key}}\n selected={{this.listItem.isSelected}}\n value={{this.key}}\n disabled={{this.listItem.isDisabled}}\n ...attributes\n >\n {{yield}}\n </option>\n </template>\n}\n\nexport { NativeSelect, type NativeSelectSignature, type ListItem };\nexport default NativeSelect;\n"],"names":["NativeSelect","Component","constructor","owner","args","validateArgs","selectionMode","console","warn","normalizedSelectedKeys","selectedKeys","singleArgs","selectedKey","listManager","ListManager","disabledKeys","allowEmpty","onSelectionChange","keys","handleSelectionChange","onAction","onListItemsChange","onItemsChange","singleKey","length","classes","nativeSelect","useStyles","size","isMultiple","handleOnChange","event","selectElement","target","newSelectedKeys","i","options","option","selected","value","push","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","NativeSelectItem","keyAndLabelForItem","hash","IconChevronUpDown","g","tracked","manager","assert","key","onRegister","item","listItem"],"mappings":";;;;;;;;;;;;;;AAsLA,MAAMA,YAAA,SAAkCC,UAAgC;AACtEC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAa,EAAE;AACvC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;AACb;IACA,IAAI,CAACC,YAAY,EAAA;AACnB,EAAA;AAEAA,EAAAA,YAAAA,GAAe;AACb,IAAA,IAAI,IAAI,CAACD,IAAI,CAACE,aAAa,KAAK,UAAA,EAAY;MAC1C,IACE,OAAQ,IAAI,CAACF,IAAI,CACf,aAAA,CACD,KAAK,WAAA,EACN;AACAG,QAAAA,OAAA,CAAQC,IAAI,CACV,6FAAA,CAAA;AAEJ,MAAA;AACF,IAAA,CAAA,MAAO;MACL,IACE,OAAQ,IAAI,CAACJ,IAAI,CACf,cAAA,CACD,KAAK,WAAA,EACN;AACAG,QAAAA,OAAA,CAAQC,IAAI,CACV,yFAAA,CAAA;AAEJ,MAAA;AACF,IAAA;AACF,EAAA;EAEA,IAAIC,sBAAAA,GAAmC;AACrC,IAAA,IAAI,IAAI,CAACL,IAAI,CAACE,aAAa,KAAK,UAAA,EAAY;AAC1C,MAAA,OAAO,IAAI,CAACF,IAAI,CAACM,YAAY,IAAI,EAAE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AAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,EAAA;QAAAC,gBAAA;QAAAC,kBAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAsCA,MAAMH,yBAAyBjD,SAAA,CAAU;AAAA,EAAA;IAAAqD,eAAA,CAAA,IAAA,CAAAZ,SAAA,EAAA,UAAA,EAAA,CACtCa,OAAA,CAAA,CAAA;AAAA;EAAA,SAAA,IAAApB,2BAAA,CAAA,IAAA,EAAA,UAAA,CAAA,EAAA,MAAA;EAED,IAAIqB,UAAuB;IACzBC,MAAA,CACE,mEAAmE,EACnE,IAAI,CAACrD,IAAI,CAACoD,OAAO,CAAA;AAGnB,IAAA,OAAO,IAAI,CAACpD,IAAI,CAACoD,OAAO;AAC1B,EAAA;EAEA,IAAIE,GAAAA,GAAc;AAChB,IAAA,IAAI,IAAI,CAACtD,IAAI,CAACsD,GAAG,KAAK,EAAA,EAAI;MACxBD,MAAA,CACE,oFAAoF,EACpF,IAAI,CAACrD,IAAI,CAACsD,GAAG,CAAA;AAEjB,IAAA;AAEA,IAAA,OAAO,IAAI,CAACtD,IAAI,CAACsD,GAAG;AACtB,EAAA;EAGAC,UAAAA,CAAWC,IAAc,EAAE;IACzB,IAAI,CAACC,QAAQ,GAAGD,IAAA;AAClB,EAAA;AAAA,EAAA;IAAAnB,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CAHCC,MAAA,CAAA,CAAA;AAAA;AAKD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,uTAAA,EAiBA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.js","sources":["../../../src/components/forms/radio-group.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Radio, type RadioSignature } from './radio';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type RadioGroupSlots,\n type RadioVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface Args<T> extends FormControlSharedArgs {\n /**\n * The name attribute applied to every radio in the group, which is what makes\n * the browser treat them as mutually exclusive.\n */\n name?: string;\n\n /**\n * The currently selected value. Pair with `onChange` to control the group.\n */\n value?: T;\n\n /**\n * Callback when the selected radio changes, receiving the new value.\n */\n onChange?: RadioSignature<T>['Args']['onChange'];\n\n /**\n * The size applied to every radio in the group and to the group's label.\n */\n size?: RadioVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<RadioGroupSlots>;\n\n /**\n * How the radios are laid out.\n *\n * @defaultValue 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\ninterface RadioGroupSignature<T> {\n Args: Args<T>;\n Blocks: {\n default: [\n Radio: WithBoundArgs<\n typeof Radio,\n 'name' | 'onChange' | 'checkedValue' | 'isDisabled'\n >\n ];\n };\n Element: HTMLDivElement;\n}\n\nclass RadioGroup<T extends string | number | boolean> extends Component<\n RadioGroupSignature<T>\n> {\n get classes() {\n const { radioGroup } = useStyles();\n return radioGroup({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @isRequired={{@isRequired}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"radio-group\"\n data-part=\"base\"\n ...attributes\n as |c|\n >\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n\n <div\n class={{this.classes.optionsContainer class=@classes.optionsContainer}}\n data-part=\"options-container\"\n data-orientation={{if @orientation @orientation \"vertical\"}}\n >\n {{! @glint-nocheck: Radio has a type param, glint cannt handle that with WithboundArgs}}\n {{yield\n (component\n Radio\n name=@name\n onChange=@onChange\n size=@size\n checkedValue=@value\n isDisabled=@isDisabled\n )\n }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { RadioGroup, type RadioGroupSignature };\nexport default RadioGroup;\n"],"names":["RadioGroup","Component","classes","radioGroup","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Radio"],"mappings":";;;;;;;AA2DA,MAAMA,UAAA,SAAwDC,SAAA,CACxC;EAEpB,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAY,GAAGC,SAAA,EAAA;AACvB,IAAA,OAAOD,UAAA,CAAW;AAChBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,g1BAAA,EAyCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ
|
|
1
|
+
{"version":3,"file":"radio-group.js","sources":["../../../src/components/forms/radio-group.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { Radio, type RadioSignature } from './radio';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type RadioGroupSlots,\n type RadioVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport type { WithBoundArgs } from '@glint/template';\n\ninterface Args<T> extends FormControlSharedArgs {\n /**\n * The name attribute applied to every radio in the group, which is what makes\n * the browser treat them as mutually exclusive.\n */\n name?: string;\n\n /**\n * The currently selected value. Pair with `onChange` to control the group.\n */\n value?: T;\n\n /**\n * Callback when the selected radio changes, receiving the new value.\n */\n onChange?: RadioSignature<T>['Args']['onChange'];\n\n /**\n * The size applied to every radio in the group and to the group's label.\n */\n size?: RadioVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<RadioGroupSlots>;\n\n /**\n * How the radios are laid out.\n *\n * @defaultValue 'vertical'\n */\n orientation?: 'horizontal' | 'vertical';\n}\n\ninterface RadioGroupSignature<T> {\n Args: Args<T>;\n Blocks: {\n default: [\n Radio: WithBoundArgs<\n typeof Radio,\n 'name' | 'onChange' | 'checkedValue' | 'isDisabled'\n >\n ];\n };\n Element: HTMLDivElement;\n}\n\nclass RadioGroup<T extends string | number | boolean> extends Component<\n RadioGroupSignature<T>\n> {\n get classes() {\n const { radioGroup } = useStyles();\n return radioGroup({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @isRequired={{@isRequired}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"radio-group\"\n data-part=\"base\"\n ...attributes\n as |c|\n >\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n\n <div\n class={{this.classes.optionsContainer class=@classes.optionsContainer}}\n data-part=\"options-container\"\n data-orientation={{if @orientation @orientation \"vertical\"}}\n >\n {{! @glint-nocheck: Radio has a type param, glint cannt handle that with WithboundArgs}}\n {{yield\n (component\n Radio\n name=@name\n onChange=@onChange\n size=@size\n checkedValue=@value\n isDisabled=@isDisabled\n )\n }}\n </div>\n </FormControl>\n </template>\n}\n\nexport { RadioGroup, type RadioGroupSignature };\nexport default RadioGroup;\n"],"names":["RadioGroup","Component","classes","radioGroup","useStyles","size","args","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Radio"],"mappings":";;;;;;;AA2DA,MAAMA,UAAA,SAAwDC,SAAA,CACxC;EAEpB,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAY,GAAGC,SAAA,EAAA;AACvB,IAAA,OAAOD,UAAA,CAAW;AAChBE,MAAAA,IAAA,EAAM,IAAI,CAACC,IAAI,CAACD;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAE,oBAAA,CAAAC,kBAAA,CAAA,g1BAAA,EAyCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sources":["../../../src/components/forms/radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SlotsToClasses,\n type RadioVariants,\n type RadioSlots\n} from '@frontile/theme';\n\ninterface Args<T> extends FormControlSharedArgs {\n /**\n * The value this radio represents. It is passed to `onChange` when the radio\n * is selected, and compared against `checkedValue` to decide whether it is.\n */\n value: T;\n\n /**\n * The currently selected value of the group. This radio renders as checked\n * when it equals `value`. Usually supplied by RadioGroup rather than set\n * directly.\n */\n checkedValue?: T | undefined | null;\n\n /**\n * The name attribute shared by the radios in a group, which is what makes the\n * browser treat them as mutually exclusive.\n */\n name?: string;\n\n /**\n * The size of the radio and its label.\n *\n * @defaultValue 'md'\n */\n size?: RadioVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<RadioSlots>;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: T, event: Event) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface RadioSignature<T> {\n Args: Args<T>;\n Element: HTMLInputElement;\n}\n\nclass Radio<T extends string | boolean | number> extends Component<\n RadioSignature<T>\n> {\n get isChecked(): boolean {\n return this.args.checkedValue === this.args.value;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(this.args.value, event);\n }\n }\n\n @action handleBlur(): void {\n this.args.onBlur?.();\n }\n\n get classes() {\n const { radio } = useStyles();\n return radio({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"radio\"\n data-part=\"base\"\n as |c|\n >\n {{! Under ARIA 1.2 aria-invalid is not in role=radio's supported\n property set: invalidity for a radio group formally belongs on a\n role=\"radiogroup\" ancestor, which FormControl does not currently\n render (see RadioGroup). We keep it on the input anyway, because\n Radio is a public component that is usable standalone, browsers and\n screen readers do expose aria-invalid on a radio input, and\n radio-test.gts asserts it. The rule is disabled for this element\n only, so its autofixer cannot silently delete the attribute when\n someone runs pnpm lint:hbs --fix. Revisit if RadioGroup grows a real\n role=\"radiogroup\" wrapper. }}\n {{! template-lint-disable no-unsupported-role-attributes }}\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n value={{@value}}\n checked={{this.isChecked}}\n type=\"radio\"\n disabled={{@isDisabled}}\n class={{this.classes.input class=@classes.input}}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{! template-lint-enable no-unsupported-role-attributes }}\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Radio, type RadioSignature };\nexport default Radio;\n"],"names":["Radio","Component","isChecked","args","checkedValue","value","handleChange","event","preventDefault","onChange","n","prototype","action","handleBlur","onBlur","classes","radio","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AA2DA,MAAMA,KAAA,SAAmDC,SAAA,CACxC;EAEf,IAAIC,SAAAA,GAAqB;IACvB,OAAO,IAAI,CAACC,IAAI,CAACC,YAAY,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK;AACnD,EAAA;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;IAEpB,IAAI,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,KAAK,UAAA,EAAY;AAC5C,MAAA,IAAI,CAACN,IAAI,CAACM,QAAQ,CAAC,IAAI,CAACN,IAAI,CAACE,KAAK,EAAEE,KAAA,CAAA;AACtC,IAAA;AACF,EAAA;AAAA,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CANCC,MAAA,CAAA,CAAA;AAAA;AAQOC,EAAAA,UAAAA,GAAmB;AACzB,IAAA,IAAI,CAACV,IAAI,CAACW,MAAM,IAAA;AAClB,EAAA;AAAA,EAAA;IAAAJ,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CAFCC,MAAA,CAAA,CAAA;AAAA;EAID,IAAIG,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACf,IAAI,CAACe;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,21DAAA,EA2DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ
|
|
1
|
+
{"version":3,"file":"radio.js","sources":["../../../src/components/forms/radio.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SlotsToClasses,\n type RadioVariants,\n type RadioSlots\n} from '@frontile/theme';\n\ninterface Args<T> extends FormControlSharedArgs {\n /**\n * The value this radio represents. It is passed to `onChange` when the radio\n * is selected, and compared against `checkedValue` to decide whether it is.\n */\n value: T;\n\n /**\n * The currently selected value of the group. This radio renders as checked\n * when it equals `value`. Usually supplied by RadioGroup rather than set\n * directly.\n */\n checkedValue?: T | undefined | null;\n\n /**\n * The name attribute shared by the radios in a group, which is what makes the\n * browser treat them as mutually exclusive.\n */\n name?: string;\n\n /**\n * The size of the radio and its label.\n *\n * @defaultValue 'md'\n */\n size?: RadioVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<RadioSlots>;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: T, event: Event) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface RadioSignature<T> {\n Args: Args<T>;\n Element: HTMLInputElement;\n}\n\nclass Radio<T extends string | boolean | number> extends Component<\n RadioSignature<T>\n> {\n get isChecked(): boolean {\n return this.args.checkedValue === this.args.value;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(this.args.value, event);\n }\n }\n\n @action handleBlur(): void {\n this.args.onBlur?.();\n }\n\n get classes() {\n const { radio } = useStyles();\n return radio({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"radio\"\n data-part=\"base\"\n as |c|\n >\n {{! Under ARIA 1.2 aria-invalid is not in role=radio's supported\n property set: invalidity for a radio group formally belongs on a\n role=\"radiogroup\" ancestor, which FormControl does not currently\n render (see RadioGroup). We keep it on the input anyway, because\n Radio is a public component that is usable standalone, browsers and\n screen readers do expose aria-invalid on a radio input, and\n radio-test.gts asserts it. The rule is disabled for this element\n only, so its autofixer cannot silently delete the attribute when\n someone runs pnpm lint:hbs --fix. Revisit if RadioGroup grows a real\n role=\"radiogroup\" wrapper. }}\n {{! template-lint-disable no-unsupported-role-attributes }}\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n value={{@value}}\n checked={{this.isChecked}}\n type=\"radio\"\n disabled={{@isDisabled}}\n class={{this.classes.input class=@classes.input}}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{! template-lint-enable no-unsupported-role-attributes }}\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Radio, type RadioSignature };\nexport default Radio;\n"],"names":["Radio","Component","isChecked","args","checkedValue","value","handleChange","event","preventDefault","onChange","n","prototype","action","handleBlur","onBlur","classes","radio","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AA2DA,MAAMA,KAAA,SAAmDC,SAAA,CACxC;EAEf,IAAIC,SAAAA,GAAqB;IACvB,OAAO,IAAI,CAACC,IAAI,CAACC,YAAY,KAAK,IAAI,CAACD,IAAI,CAACE,KAAK;AACnD,EAAA;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;IAEpB,IAAI,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,KAAK,UAAA,EAAY;AAC5C,MAAA,IAAI,CAACN,IAAI,CAACM,QAAQ,CAAC,IAAI,CAACN,IAAI,CAACE,KAAK,EAAEE,KAAA,CAAA;AACtC,IAAA;AACF,EAAA;AAAA,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CANCC,MAAA,CAAA,CAAA;AAAA;AAQOC,EAAAA,UAAAA,GAAmB;AACzB,IAAA,IAAI,CAACV,IAAI,CAACW,MAAM,IAAA;AAClB,EAAA;AAAA,EAAA;IAAAJ,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CAFCC,MAAA,CAAA,CAAA;AAAA;EAID,IAAIG,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACf,IAAI,CAACe;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,21DAAA,EA2DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Spinner } from '../../utilities/spinner.js';
|
|
2
2
|
import { CloseButton } from '../../buttons/close-button.js';
|
|
3
|
-
import { IconChevronUpDown } from '
|
|
3
|
+
import { I as IconChevronUpDown } from '../../../icons-DZ61nCzv.js';
|
|
4
4
|
import { precompileTemplate } from '@ember/template-compilation';
|
|
5
5
|
import { setComponentTemplate } from '@ember/component';
|
|
6
6
|
import templateOnly from '@ember/component/template-only';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"end-content.js","sources":["../../../../src/components/forms/select/end-content.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport type {\n SelectSlots,\n SelectVariants,\n SlotsToClasses\n} from '@frontile/theme';\nimport { Spinner } from '../../utilities/spinner';\nimport { CloseButton } from '../../buttons/close-button';\nimport { IconChevronUpDown } from '
|
|
1
|
+
{"version":3,"file":"end-content.js","sources":["../../../../src/components/forms/select/end-content.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport type {\n SelectSlots,\n SelectVariants,\n SlotsToClasses\n} from '@frontile/theme';\nimport { Spinner } from '../../utilities/spinner';\nimport { CloseButton } from '../../buttons/close-button';\nimport { IconChevronUpDown } from '../../../-private/icons';\nimport type { SelectClasses } from './types';\n\nconst isSm = (size: SelectVariants['size']) => size === 'sm';\n\ninterface SelectEndContentSignature {\n Args: {\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /**\n * Defaults to `none` so clicks fall through to the trigger; content that\n * needs its own events opts back in per element.\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n inputSize?: SelectVariants['size'];\n isLoading?: boolean;\n\n /** Whether the clear button takes the chevron's place. */\n isClearable?: boolean;\n\n onClear: () => void;\n };\n Blocks: {\n /** Consumer content, rendered before the spinner/clear/chevron cluster. */\n default: [];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The cluster at the end of the field: any consumer content, then exactly one\n * of the loading spinner, the clear button, or the chevron.\n */\nconst SelectEndContent: TOC<SelectEndContentSignature> = <template>\n <div\n data-part=\"end-content\"\n class={{@classes.endContent\n class=@userClasses.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n ...attributes\n >\n {{yield}}\n\n {{#if @isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if @isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @class={{@classes.clearButton class=@userClasses.clearButton}}\n data-part=\"clear-button\"\n @onPress={{@onClear}}\n />\n {{else}}\n <IconChevronUpDown\n data-part=\"icon\"\n class={{@classes.icon class=@userClasses.icon}}\n />\n {{/if}}\n </div>\n</template>;\n\nexport { SelectEndContent, type SelectEndContentSignature };\nexport default SelectEndContent;\n"],"names":["isSm","size","SelectEndContent","setComponentTemplate","precompileTemplate","strictMode","scope","Spinner","CloseButton","IconChevronUpDown","templateOnly"],"mappings":";;;;;;;AAWA,MAAMA,IAAA,GAAQC,QAAiCA,IAAA,KAAS,IAAA;AA4BxD;;;AAGC;AACD,MAAMC,gBAAsB,GAAAC,oBAAA,CAA6BC,kBAAA,CAAA,onBAAA,EA+BzD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,OAAA;IAAAP,IAAA;IAAAQ,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"native-mirror.js","sources":["../../../../src/components/forms/select/native-mirror.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport {\n NativeSelect,\n type ListItem,\n type NativeSelectSignature\n} from '../native-select';\n\nconst eq = (a: unknown, b: unknown) => a === b;\n\ninterface SelectNativeMirrorSignature<T> {\n Args: {\n /**\n * The **unfiltered** collection. The mirror carries the form value, which\n * must not shrink to whatever the listbox filter currently shows, so it is\n * deliberately never handed `filteredItems`.\n */\n items?: T[];\n allowEmpty?: boolean;\n disabledKeys?: string[];\n selectionMode?: 'single' | 'multiple';\n\n /** Read in multiple selection mode. */\n selectedKeys: string[];\n /** Read in single selection mode. */\n selectedKey: string | null;\n\n /** Selection handler for multiple selection mode. */\n onSelectionChange: (keys: string[]) => void;\n /** Selection handler for single selection mode. */\n onSingleSelectionChange: (key: string | null) => void;\n\n onItemsChange: (nodes: ListItem[], action: 'add' | 'remove') => void;\n placeholder?: string;\n id?: string;\n name?: string;\n isDisabled?: boolean;\n };\n Blocks: {\n default: NativeSelectSignature<T>['Blocks']['default'];\n };\n}\n\n/**\n * The visually hidden native `<select>` that makes a Select submit with a form.\n *\n * Single and multiple selection mode differ only in three arguments, so those\n * three are curried onto the component and everything else -- the element, its\n * attributes and both blocks -- is written **once**. Two copies of this used to\n * sit side by side in `select.gts`, and a fix to the submitted value landed in\n * one of them and not the other.\n */\nclass SelectNativeMirror<T = unknown> extends Component<\n SelectNativeMirrorSignature<T>\n> {\n <template>\n {{#let\n (if\n (eq @selectionMode \"multiple\")\n (component\n NativeSelect\n selectionMode=\"multiple\"\n selectedKeys=@selectedKeys\n onSelectionChange=@onSelectionChange\n )\n (component\n NativeSelect\n selectionMode=\"single\"\n selectedKey=@selectedKey\n onSelectionChange=@onSingleSelectionChange\n )\n )\n as |Mirror|\n }}\n <Mirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @onItemsChange={{@onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{@id}}\n @name={{@name}}\n tabindex=\"-1\"\n disabled={{@isDisabled}}\n >\n <:item as |l|>\n <l.Item @key={{l.key}}>\n {{l.label}}\n </l.Item>\n </:item>\n <:default as |l|>\n {{yield l}}\n </:default>\n </Mirror>\n {{/let}}\n </template>\n}\n\nexport { SelectNativeMirror, type SelectNativeMirrorSignature };\nexport default SelectNativeMirror;\n"],"names":["eq","a","b","SelectNativeMirror","Component","setComponentTemplate","precompileTemplate","strictMode","scope","NativeSelect"],"mappings":";;;;;AAOA,MAAMA,EAAA,GAAKA,CAACC,CAAU,EAAEC,CAAU,KAAKD,CAAA,KAAMC,CAAA;AAmC7C;;;;;;;;AAQC;AACD,MAAMC,kBAAA,SAAwCC,UAChB;AAE5B,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8rBAAA,EAwCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAR,EAAA;AAAAS,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ
|
|
1
|
+
{"version":3,"file":"native-mirror.js","sources":["../../../../src/components/forms/select/native-mirror.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport {\n NativeSelect,\n type ListItem,\n type NativeSelectSignature\n} from '../native-select';\n\nconst eq = (a: unknown, b: unknown) => a === b;\n\ninterface SelectNativeMirrorSignature<T> {\n Args: {\n /**\n * The **unfiltered** collection. The mirror carries the form value, which\n * must not shrink to whatever the listbox filter currently shows, so it is\n * deliberately never handed `filteredItems`.\n */\n items?: T[];\n allowEmpty?: boolean;\n disabledKeys?: string[];\n selectionMode?: 'single' | 'multiple';\n\n /** Read in multiple selection mode. */\n selectedKeys: string[];\n /** Read in single selection mode. */\n selectedKey: string | null;\n\n /** Selection handler for multiple selection mode. */\n onSelectionChange: (keys: string[]) => void;\n /** Selection handler for single selection mode. */\n onSingleSelectionChange: (key: string | null) => void;\n\n onItemsChange: (nodes: ListItem[], action: 'add' | 'remove') => void;\n placeholder?: string;\n id?: string;\n name?: string;\n isDisabled?: boolean;\n };\n Blocks: {\n default: NativeSelectSignature<T>['Blocks']['default'];\n };\n}\n\n/**\n * The visually hidden native `<select>` that makes a Select submit with a form.\n *\n * Single and multiple selection mode differ only in three arguments, so those\n * three are curried onto the component and everything else -- the element, its\n * attributes and both blocks -- is written **once**. Two copies of this used to\n * sit side by side in `select.gts`, and a fix to the submitted value landed in\n * one of them and not the other.\n */\nclass SelectNativeMirror<T = unknown> extends Component<\n SelectNativeMirrorSignature<T>\n> {\n <template>\n {{#let\n (if\n (eq @selectionMode \"multiple\")\n (component\n NativeSelect\n selectionMode=\"multiple\"\n selectedKeys=@selectedKeys\n onSelectionChange=@onSelectionChange\n )\n (component\n NativeSelect\n selectionMode=\"single\"\n selectedKey=@selectedKey\n onSelectionChange=@onSingleSelectionChange\n )\n )\n as |Mirror|\n }}\n <Mirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @onItemsChange={{@onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{@id}}\n @name={{@name}}\n tabindex=\"-1\"\n disabled={{@isDisabled}}\n >\n <:item as |l|>\n <l.Item @key={{l.key}}>\n {{l.label}}\n </l.Item>\n </:item>\n <:default as |l|>\n {{yield l}}\n </:default>\n </Mirror>\n {{/let}}\n </template>\n}\n\nexport { SelectNativeMirror, type SelectNativeMirrorSignature };\nexport default SelectNativeMirror;\n"],"names":["eq","a","b","SelectNativeMirror","Component","setComponentTemplate","precompileTemplate","strictMode","scope","NativeSelect"],"mappings":";;;;;AAOA,MAAMA,EAAA,GAAKA,CAACC,CAAU,EAAEC,CAAU,KAAKD,CAAA,KAAMC,CAAA;AAmC7C;;;;;;;;AAQC;AACD,MAAMC,kBAAA,SAAwCC,UAChB;AAE5B,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8rBAAA,EAwCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAR,EAAA;AAAAS,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sources":["../../../../src/components/forms/select/select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport { renamedArgValue } from '../../../-private/deprecated-args';\n\nimport type { ListItem } from '../native-select';\nimport { Listbox } from '../../collections/listbox';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { Popover } from '../../overlays/popover';\nimport { FormControl } from '../form-control';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport { canDeselectKey, keyAndLabelForItem } from '../../../utils/listManager';\nimport { filterAndRankItems } from '../../../utils/filter';\n\nimport { SelectNativeMirror } from './native-mirror';\nimport { SelectTrigger } from './trigger';\nimport { SelectedChips } from './selected-items';\nimport { SelectEndContent } from './end-content';\nimport type {\n DefaultSingleSelectArgs,\n ExplicitSingleSelectArgs,\n ResolvedSelectChipOptions,\n SelectArgs,\n SelectChipOptions,\n SelectSignature,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n// Import helper function directly instead of using ember-truth-helpers\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\n\n/*\n * Internal: selection state architecture\n *\n * This component uses a **two-way data binding pattern** for managing selection state:\n *\n * ### Data Flow\n * 1. **External → Internal (Initialization & Updates)**\n * - Parent passes `@selectedKey` or `@selectedKeys` as arguments\n * - Constructor initializes internal tracked properties (`_selectedKey` or `_selectedKeys`)\n * - Modifiers (`updateSingleSelectValue`, `updateMultipleSelectValue`) sync internal state\n * when parent updates the arguments\n *\n * 2. **Internal State Management**\n * - `_selectedKey` / `_selectedKeys`: Internal tracked state (prefixed with underscore)\n * - These serve as the \"source of truth\" for rendering and reactivity\n * - Getters (`getSelectedKey`, `selectedKeys`) expose this internal state to the template\n *\n * 3. **Internal → External (User Interactions)**\n * - User interactions trigger selection change handlers\n * - Handlers update internal `_selectedKey` / `_selectedKeys` for immediate UI update\n * - Handlers call parent's `@onSelectionChange` callback to notify of state change\n * - Parent updates its state, which flows back through step 1\n *\n * ### Why Both Internal State AND Callbacks?\n * - **Internal state:** Enables immediate, responsive UI updates (`_selectedKey` / `_selectedKeys`)\n * - **Parent callback:** Enables parent to take action when changes occur (`@onSelectionChange`)\n * - This pattern provides both responsive UX and parent inclusion over state\n *\n * ### Example Flow\n * ```\n * User clicks item\n * → onSelectionChange handler\n * → Updates _selectedKey (immediate UI update)\n * → Calls parent's @onSelectionChange callback\n * → Parent updates its @selectedKey state\n * → updateSingleSelectValue modifier syncs _selectedKey with new arg value\n * ```\n */\n/**\n * A dropdown selection component: a custom listbox in a popover, backed by a\n * visually hidden native `<select>` so the value submits with a form.\n *\n * Selection can be controlled with `@selectedKey` / `@selectedKeys` plus\n * `@onSelectionChange`, or left uncontrolled.\n */\nclass Select<T = unknown> extends Component<SelectSignature<T>> {\n /**\n * Every item registered by the hidden native `<select>`, in item order.\n *\n * The hidden select is deliberately given the *unfiltered* `@items` — it\n * carries the form value, which must not shrink to the filter — so this\n * covers the whole list even while the listbox is filtered down. Chips and\n * the joined text value can therefore be resolved straight from it.\n */\n @tracked nodes: ListItem[] = [];\n\n @tracked isOpen = false;\n /**\n * Internal tracked state for single selection mode.\n * Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.\n */\n @tracked _selectedKey: string | null = null;\n\n /**\n * Internal tracked state for multiple selection mode.\n * Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.\n */\n @tracked _selectedKeys: string[] = [];\n\n /**\n * Initializes the component and sets up initial selection state.\n *\n * **Initialization:**\n * 1. Determines selection mode (single vs multiple)\n * 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state\n * 3. Logs warnings if incorrect args are used for the selection mode\n *\n * Note: After instantiation, modifiers keep internal state synced with external arguments.\n */\n constructor(owner: Owner, args: SelectArgs<T>) {\n super(owner, args);\n\n // Initialize based on mode\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = this.args.selectedKeys || [];\n } else {\n this._selectedKey =\n (this.args as ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T>)\n .selectedKey || null;\n }\n\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n @tracked filterValue?: string;\n\n containerRef = ref<HTMLDivElement>();\n triggerRef = ref<HTMLInputElement | HTMLButtonElement>();\n chipsContainerRef = ref<HTMLDivElement>();\n\n /**\n * Handles selection changes from the Listbox component.\n *\n * **Flow:**\n * 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates\n * 2. Calls parent's `@onSelectionChange` callback to notify of the change\n * 3. Parent updates its state, which flows back via modifier to complete the cycle\n *\n * **Side effects:**\n * - Clears filter value (for searchable selects)\n * - Triggers form input event for native form integration\n *\n * @param keys - Array of selected keys from Listbox (converted to single value in single mode)\n */\n onSelectionChange = (keys: string[]) => {\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = keys;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n this._selectedKey = singleKey;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n /**\n * Handles selection changes from the native <select> element.\n *\n * This is similar to `onSelectionChange` but accepts a single key directly\n * rather than an array, matching the native select's single-value API.\n *\n * **Flow:**\n * 1. Updates internal `_selectedKey` for immediate UI update\n * 2. Calls parent's `@onSelectionChange` callback\n *\n * @param key - The selected key, or null if cleared\n */\n onSingleSelectionChange = (key: string | null) => {\n this._selectedKey = key;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(key);\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n onOpenChange = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n onFilterChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.filterValue = target.value;\n };\n\n /**\n * Backspace on an empty filter removes the last chip — the familiar tag-input\n * gesture. With text in the filter, Backspace edits the text as usual.\n */\n handleFilterKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Backspace' || !this.showChips) {\n return;\n }\n const target = event.target as HTMLInputElement;\n if (target.value !== '') {\n return;\n }\n this.removeLastSelectedKey();\n };\n\n /**\n * The non-filterable counterpart of {@link handleFilterKeydown}.\n *\n * Chip close buttons are deliberately outside the tab order (they would\n * otherwise cost a Tab stop each before the combobox is reached), so\n * Backspace/Delete on the trigger is the *only* keyboard route to removing a\n * chip here. There is no text to edit on a button trigger, so both keys act\n * immediately; `preventDefault` keeps Backspace from navigating back.\n */\n handleTriggerKeydown = (event: KeyboardEvent) => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n if (event.key !== 'Backspace' && event.key !== 'Delete') {\n return;\n }\n event.preventDefault();\n this.removeLastSelectedKey();\n };\n\n /**\n * Removes the trailing chip. `removeSelectedKey` applies the same\n * `@allowEmpty` rule the chip close buttons follow, so the last required\n * selection stays put.\n */\n removeLastSelectedKey(): void {\n const items = this.selectedItems;\n const last = items[items.length - 1];\n if (last) {\n this.removeSelectedKey(last.key);\n }\n }\n\n /**\n * Returns current selection as an array for template rendering.\n *\n * Normalizes both single and multiple selection modes to a consistent array interface:\n * - Multiple mode: Returns `_selectedKeys` directly\n * - Single mode: Converts `_selectedKey` to array format (or empty array if null)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns Array of selected keys (empty array if none selected)\n */\n get selectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this._selectedKeys;\n } else {\n // Single mode: convert selectedKey to array for internal use\n const key = this.getSelectedKey;\n return key ? [key] : [];\n }\n }\n\n /**\n * Returns the selected key for single selection mode.\n *\n * **Returns:**\n * - Single mode: Returns `_selectedKey` (string or null)\n * - Multiple mode: Returns null (not applicable)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns The selected key, or null if none selected or in multiple mode\n */\n get getSelectedKey(): string | null {\n return this._selectedKey;\n }\n\n get blockScroll() {\n if (this.args.blockScroll === false) {\n return false;\n }\n return true;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n onAction = (key: string) => {\n if (typeof this.args.onAction === 'function') {\n this.args.onAction(key);\n }\n\n if (\n this.args.closeOnItemSelect !== false &&\n this.args.selectionMode !== 'multiple'\n ) {\n this.isOpen = false;\n }\n\n // Deliberately does not touch `@onBlur`. Selecting is not blurring: this\n // runs on every option click, including the ones that leave the dropdown\n // open in multiple selection mode. Focus loss is reported by\n // `blurTracker` instead, from the trigger's own `focusout`.\n };\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * dropdown -- rather than the trigger, which blurs on the way into the\n * dropdown and on every option click. See `ControlBlurTracker`.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * In chips mode the trigger is only as wide as the room left over beside the\n * chips, so the field's padding -- and the strip under the chevron -- are not\n * part of it, and with a single selection the trigger can be a narrow sliver.\n * Without this, clicking anywhere else in the field would do nothing, while\n * the same click anywhere on a non-chips field opens the dropdown (there the\n * trigger *is* the whole field). Forwards such a click to the trigger,\n * including clicks on a chip's own body, so the whole field is a click\n * target. The one exception is a chip's close button: within the chips\n * container the only `<button>` elements a chip ever renders are its close\n * button (see chip.gts / close-button.gts), so `closest('button')` combined\n * with containment against `chipsContainerRef` identifies it without relying\n * on any test-only attribute. Clicks on the trigger itself are left alone\n * too, since it already handles its own clicks.\n */\n handleFieldClick = (event: MouseEvent): void => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n\n const trigger = this.triggerRef.current;\n const target = event.target;\n\n if (!trigger || !(target instanceof Element)) {\n return;\n }\n\n // The trigger handles its own clicks; this listener also sees them bubble.\n if (trigger === target || trigger.contains(target)) {\n return;\n }\n\n const chipsContainer = this.chipsContainerRef.current;\n\n if (chipsContainer && chipsContainer.contains(target)) {\n const closeButton = target.closest('button');\n if (closeButton && chipsContainer.contains(closeButton)) {\n return;\n }\n }\n\n trigger.focus();\n trigger.click();\n };\n\n /**\n * Wipes the selection from the clear button.\n *\n * Unlike the chips and the listbox options, this deliberately does *not*\n * consult `@allowEmpty`. `@allowEmpty` governs deselecting *an option* --\n * the listbox refuses to let the last one be toggled off, and\n * `chipsRemovable` mirrors that -- whereas `@isClearable` is a separate,\n * explicit affordance the consumer opts into for exactly this purpose. It\n * also defaults to `false`, so honouring it here would render the clear\n * button dead in every default configuration. Documented as an override on\n * `@isClearable` itself; the two must keep saying the same thing.\n *\n * A disabled Select renders no clear button at all (see `isClearable`), so\n * there is nothing to guard here.\n */\n clearSelectedKeys = () => {\n this.onSelectionChange([]);\n };\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@variant` only -- never `@appearance` as well, which would make the\n * inner `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get variant() {\n return renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'subtle' } as const,\n {\n component: 'Select',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.select.appearance'\n }\n );\n }\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@color` only -- never `@intent` as well, which would make the inner\n * `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get color() {\n return renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Select',\n from: 'intent',\n to: 'color',\n id: 'frontile.select.intent'\n }\n );\n }\n\n /**\n * Resolved chip appearance: `@chip` wins, then the Select's own `@color`\n * (or deprecated `@intent`), then chip defaults tuned for sitting inside a\n * field.\n */\n get chipOptions(): ResolvedSelectChipOptions {\n const chip =\n this.args.selectionMode === 'multiple' ? this.args.chip : undefined;\n return {\n // `appearance` is passed through only when the consumer set it. Giving\n // it a default would make Chip's deprecation fire on every chip render.\n variant: chip?.variant ?? (chip?.appearance ? undefined : 'soft'),\n appearance: chip?.appearance,\n // `intent` is passed through only when the consumer (or Select's own\n // deprecated `@intent`) actually set it. Defaulting it would fire\n // Chip's `intent` deprecation on every chip render, for a prop nobody\n // wrote.\n color:\n chip?.color ??\n this.args.color ??\n ((chip?.intent ?? this.args.intent) ? undefined : 'neutral'),\n intent: chip?.intent ?? this.args.intent,\n size: chip?.size ?? 'sm',\n radius: chip?.radius,\n withDot: chip?.withDot ?? false\n };\n }\n\n /**\n * Whether chips may be removed. Mirrors the listbox: with `@allowEmpty`\n * false — the default — the final selection cannot be deselected, so its\n * chip renders without a close button rather than with a dead one.\n */\n get chipsRemovable(): boolean {\n // Asks `canDeselectKey` — the rule the listbox itself applies when an\n // already-selected option is clicked — rather than restating it, so a chip\n // and its option can never disagree about the same removal.\n //\n // Asked of `selectedItems`, the collection the chips render from, so the\n // decision cannot disagree with what is on screen either (a selected key\n // with no remembered item would otherwise be counted but never render a\n // chip at all). Every chip's key is in that collection by construction, so\n // the rule's answer is the same for all of them; it is asked of the last\n // chip, the one Backspace removes.\n const keys = this.selectedItems.map((item) => item.key);\n const lastKey = keys[keys.length - 1];\n\n // With nothing selected there is no chip, so nothing reads this today --\n // but the answer is deliberately `@allowEmpty`, not `false`. That is what\n // this getter has always returned for an empty selection, and keeping it\n // means the answer never depends on whether a chip happens to exist right\n // now. `canDeselectKey` cannot be asked here (it needs a key), so the\n // empty case is answered directly. Do not \"simplify\" this away.\n if (lastKey === undefined) {\n return this.args.allowEmpty === true;\n }\n\n return canDeselectKey(keys, lastKey, this.args.allowEmpty);\n }\n\n /**\n * Removes a single selection from a chip's close button. Routes through\n * `onSelectionChange`, which already syncs internal state, notifies the\n * parent and dispatches the form input event.\n */\n removeSelectedKey = (key: string) => {\n if (this.args.isDisabled || !this.chipsRemovable) {\n return;\n }\n this.onSelectionChange(this.selectedKeys.filter((k) => k !== key));\n };\n\n onItemsChange = (nodes: ListItem[], _: 'add' | 'remove') => {\n // `onItemsChange` runs while a modifier installs, i.e. inside a render\n // pass. Reading a tracked field here and writing it in the same\n // computation would trip Glimmer's read-then-write assertion, so `nodes`\n // is only ever written, never read, in this callback.\n this.nodes = nodes;\n };\n\n didClose = () => {\n this.filterValue = undefined;\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n /**\n * Whether selections render as chips. Chips are the default presentation for\n * multiple selection mode; `@selectedItemsDisplay=\"text\"` opts back out to the\n * comma-joined string.\n */\n get showChips(): boolean {\n return (\n this.args.selectionMode === 'multiple' &&\n this.args.selectedItemsDisplay !== 'text'\n );\n }\n\n get hasSelection(): boolean {\n return this.selectedKeys.length > 0;\n }\n\n /**\n * The accessible name for the trigger when its own text cannot supply one.\n *\n * Left to itself the trigger names itself from its own text -- the selected\n * label, or the placeholder -- and that is still what happens in the plain\n * case; see the trigger, which only applies this when it has to.\n *\n * Two cases need it:\n *\n * - **Chips mode.** The trigger renders nothing; the chips are its siblings\n * and are read separately. Naming the *control* is both enough and\n * correct here -- appending the selection would have it read twice -- so\n * this returns the bare name.\n * - **A `:selectedItem` block.** The block owns the trigger's content and may\n * render nothing readable at all (an avatar, an icon), which would leave\n * the combobox announced as an unnamed button. The selection is not\n * readable anywhere else in that case, so the name carries it: the control\n * name *and* the selected options' text.\n *\n * The two halves are composed so that the separator only appears when both\n * are there. A selected key with no registered option behind it resolves to\n * no text at all, and `\"Owner, \"` is announced as \"Owner comma\"; and with\n * neither `@label` nor `@placeholder` the only control name available is the\n * hardcoded, unlocalizable `Select options`, so the selected text is left to\n * name the control on its own rather than be prefixed by English.\n */\n get triggerAccessibleName(): string {\n const name = this.args.label || this.args.placeholder;\n\n // Chips mode names the *control* only -- the chips are read separately --\n // and has no better fallback than the literal.\n if (this.showChips) {\n return name || 'Select options';\n }\n\n const selectedText = this.hasSelection ? this.selectedTextValue : '';\n\n if (!name) {\n return selectedText || 'Select options';\n }\n\n return selectedText ? `${name}, ${selectedText}` : name;\n }\n\n /**\n * The selected options in item order (not click order) so chips do not\n * reorder underneath the user as they select.\n *\n * Resolved against `nodes`, which the hidden native `<select>` populates from\n * the unfiltered `@items`, so a chip stays put while a filter hides the item\n * it came from.\n */\n get selectedItems(): SelectedItem[] {\n const keys = this.selectedKeys;\n return this.nodes\n .filter((node) => keys.includes(node.key))\n .map((node) => ({\n key: node.key,\n textValue: node.textValue,\n item: node.item\n }));\n }\n\n /**\n * The same selection `selectedItems` describes, rendered as text.\n *\n * Chips and this string are two presentations of one thing, so they read one\n * projection: walking `nodes` a second time here is how a fix to the\n * selection's contents once landed in the chips and not in the text.\n */\n get selectedTextValue(): string {\n return this.selectedItems.map((item) => item.textValue).join(', ');\n }\n\n get backdrop() {\n if (typeof this.args.backdrop === 'undefined') {\n return 'transparent';\n }\n return this.args.backdrop;\n }\n\n get classes() {\n const { select } = useStyles();\n // Referenced here, on the always-rendered root, so `@appearance`/\n // `@variant` (and `@intent`/`@color`) raises its deprecation regardless\n // of whether the popover content (and so the internal `Listbox`) is\n // currently mounted.\n void this.variant;\n void this.color;\n return select({\n size: this.args.inputSize,\n hasChips: this.showChips,\n isFilterable: !!this.args.isFilterable\n });\n }\n\n /**\n * Whether the clear button takes the chevron's place: something to clear,\n * and a control that can act on it. A disabled Select never shows it -- the\n * end-content cluster is not pointer-transparent to it and it carries no\n * disabled state of its own, so it would otherwise be a focusable button\n * that clears a field the user is not allowed to change.\n */\n get isClearable() {\n return (\n this.args.isClearable &&\n !this.args.isDisabled &&\n this.selectedKeys &&\n this.selectedKeys.length > 0\n );\n }\n\n get filterFieldValue() {\n if (this.filterValue !== undefined) {\n return this.filterValue;\n }\n // With chips, the selection is already visible beside the input. Echoing\n // the joined text here would fill the box and block typing.\n if (this.showChips) {\n return '';\n }\n return this.selectedTextValue;\n }\n\n get filteredItems() {\n if (this.filterValue === undefined) {\n return this.args.items;\n }\n\n return filterAndRankItems(\n this.args.items,\n this.filterValue || '',\n (item) => keyAndLabelForItem(item).label,\n this.args.filter\n );\n }\n\n get showEmptyContent() {\n return this.filteredItems?.length === 0 && !this.args.hideEmptyContent;\n }\n\n get autoActivateMode(): 'first' | 'selected' {\n if (this.filterValue === undefined || this.filterValue === '') {\n return 'selected';\n }\n return 'first';\n }\n\n /**\n * Syncs internal `_selectedKeys` with external `@selectedKeys` argument.\n *\n * Runs whenever `@selectedKeys` changes:\n * - Updates `_selectedKeys` to match the new external value\n * - Normalizes undefined/null to empty array\n *\n * This enables UI updates when the external value changes.\n */\n updateMultipleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKeys]: [string[] | null | undefined]) => {\n if (selectedKeys !== undefined && selectedKeys !== null) {\n this._selectedKeys = selectedKeys;\n } else {\n // NOTE: is this the right behavior?\n this._selectedKeys = [];\n }\n }\n );\n\n /**\n * Syncs internal `_selectedKey` with external `@selectedKey` argument.\n *\n * Runs whenever `@selectedKey` changes:\n * - Updates `_selectedKey` to match the new external value\n * - Handles null values for cleared selections\n *\n * This enables UI updates when the external value changes.\n */\n updateSingleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKey]: [string | null | undefined]) => {\n if (selectedKey !== undefined) {\n this._selectedKey = selectedKey;\n }\n }\n );\n\n <template>\n <div\n {{this.updateMultipleSelectValue @selectedKeys}}\n {{this.updateSingleSelectValue @selectedKey}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"select\"\n data-part=\"base\"\n ...attributes\n >\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{this.didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <VisuallyHidden>\n <SelectNativeMirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @selectionMode={{@selectionMode}}\n @selectedKeys={{this.selectedKeys}}\n @selectedKey={{this.getSelectedKey}}\n @onSelectionChange={{this.onSelectionChange}}\n @onSingleSelectionChange={{this.onSingleSelectionChange}}\n @onItemsChange={{this.onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{c.id}}\n @name={{@name}}\n @isDisabled={{@isDisabled}}\n >\n <:default as |l|>\n {{! @glint-expect-error: the signature of the native select is not the same as the listbox}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{! The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. }}\n <div\n {{p.anchor}}\n {{p.measureWidth}}\n {{on \"click\" this.handleFieldClick}}\n data-test-id={{if this.showChips \"chips-field\"}}\n data-part=\"chips-field\"\n {{! These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. }}\n data-has-chips={{if this.showChips \"true\" \"false\"}}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n class={{this.classes.chipsField\n class=@classes.chipsField\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n >\n {{#if (and this.showChips this.hasSelection)}}\n {{! A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. }}\n <SelectedChips\n @containerRef={{this.chipsContainerRef.setup}}\n @items={{this.selectedItems}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @chipOptions={{this.chipOptions}}\n @isDisabled={{@isDisabled}}\n @isRemovable={{this.chipsRemovable}}\n @onRemove={{this.removeSelectedKey}}\n >\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger\n @isFilterable={{@isFilterable}}\n @trigger={{p.trigger}}\n @triggerRef={{this.triggerRef.setup}}\n @isDisabled={{@isDisabled}}\n @showChips={{this.showChips}}\n @accessibleName={{this.triggerAccessibleName}}\n @placeholder={{@placeholder}}\n @hasSelection={{this.hasSelection}}\n @hasStartContent={{has-block \"startContent\"}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @items={{this.selectedItems}}\n @filterValue={{this.filterFieldValue}}\n @onFilterInput={{this.onFilterChange}}\n @onFilterKeydown={{this.handleFilterKeydown}}\n @onKeydown={{this.handleTriggerKeydown}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n @hasCustomContent={{has-block \"selectedItem\"}}\n >\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @inputSize={{@inputSize}}\n @isLoading={{@isLoading}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clearSelectedKeys}}\n >\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content\n @size={{if @popoverSize @popoverSize \"trigger\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @blockScroll={{this.blockScroll}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{this.backdrop}}\n @disableTransitions={{@disableTransitions}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{@transition}}\n @preventAutoFocus={{true}}\n >\n <Listbox\n @items={{this.filteredItems}}\n @allowEmpty={{@allowEmpty}}\n @variant={{this.variant}}\n @disabledKeys={{@disabledKeys}}\n @color={{this.color}}\n @isKeyboardEventsEnabled={{true}}\n @onAction={{this.onAction}}\n @onSelectionChange={{this.onSelectionChange}}\n @selectedKeys={{this.selectedKeys}}\n @selectionMode={{if @selectionMode @selectionMode \"single\"}}\n @type=\"listbox\"\n @class={{this.classes.listbox class=@classes.listbox}}\n @elementToAddKeyboardEvents={{this.triggerRef.current}}\n @autoActivateMode={{this.autoActivateMode}}\n data-part=\"listbox\"\n >\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item\n @key={{l.key}}\n @variant={{this.variant}}\n @color={{this.color}}\n >\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div\n class={{this.classes.emptyContent class=@classes.emptyContent}}\n data-part=\"empty-content\"\n >\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport {\n Select,\n type SelectSignature,\n type SelectChipOptions,\n type SelectedItem,\n type SelectedItemBlockArg\n};\nexport default Select;\n"],"names":["and","a","b","Boolean","Select","Component","g","prototype","tracked","i","constructor","owner","args","selectionMode","_selectedKeys","selectedKeys","_selectedKey","selectedKey","validateArgs","console","warn","containerRef","ref","triggerRef","chipsContainerRef","onSelectionChange","keys","singleKey","length","filterValue","undefined","triggerFormInputEvent","current","onSingleSelectionChange","key","onOpenChange","isOpen","onFilterChange","event","target","value","handleFilterKeydown","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","preventDefault","items","selectedItems","last","removeSelectedKey","getSelectedKey","blockScroll","disableFocusTrap","onAction","closeOnItemSelect","blurTracker","ControlBlurTracker","trigger","container","isDestroyed","isDestroying","onBlur","willDestroy","cancel","handleFieldClick","Element","contains","chipsContainer","closeButton","closest","focus","click","clearSelectedKeys","variant","renamedArgValue","appearance","default","outlined","faded","component","from","to","id","n","cached","color","intent","chipOptions","chip","size","radius","withDot","chipsRemovable","map","item","lastKey","allowEmpty","canDeselectKey","filter","k","onItemsChange","nodes","_","didClose","selectedItemsDisplay","hasSelection","triggerAccessibleName","name","label","placeholder","selectedText","selectedTextValue","node","includes","textValue","join","backdrop","classes","select","useStyles","inputSize","hasChips","isFilterable","isClearable","filterFieldValue","filteredItems","filterAndRankItems","keyAndLabelForItem","showEmptyContent","hideEmptyContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent","Listbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CC;AACD,MAAME,MAAA,SAA4BC,UAA0B;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CASzDC,OAAA,C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C,aAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
|
|
1
|
+
{"version":3,"file":"select.js","sources":["../../../../src/components/forms/select/select.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport type Owner from '@ember/owner';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport { useStyles } from '@frontile/theme';\nimport { renamedArgValue } from '../../../-private/deprecated-args';\n\nimport type { ListItem } from '../native-select';\nimport { Listbox } from '../../collections/listbox';\nimport { VisuallyHidden } from '../../utilities/visually-hidden';\nimport { Popover } from '../../overlays/popover';\nimport { FormControl } from '../form-control';\nimport { ref } from '../../../utils/ref';\nimport { ControlBlurTracker } from '../../../-private/control-blur';\nimport { triggerFormInputEvent } from '../../../utils/forms-utils-index';\nimport { canDeselectKey, keyAndLabelForItem } from '../../../utils/listManager';\nimport { filterAndRankItems } from '../../../utils/filter';\n\nimport { SelectNativeMirror } from './native-mirror';\nimport { SelectTrigger } from './trigger';\nimport { SelectedChips } from './selected-items';\nimport { SelectEndContent } from './end-content';\nimport type {\n DefaultSingleSelectArgs,\n ExplicitSingleSelectArgs,\n ResolvedSelectChipOptions,\n SelectArgs,\n SelectChipOptions,\n SelectSignature,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n// Import helper function directly instead of using ember-truth-helpers\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\n\n/*\n * Internal: selection state architecture\n *\n * This component uses a **two-way data binding pattern** for managing selection state:\n *\n * ### Data Flow\n * 1. **External → Internal (Initialization & Updates)**\n * - Parent passes `@selectedKey` or `@selectedKeys` as arguments\n * - Constructor initializes internal tracked properties (`_selectedKey` or `_selectedKeys`)\n * - Modifiers (`updateSingleSelectValue`, `updateMultipleSelectValue`) sync internal state\n * when parent updates the arguments\n *\n * 2. **Internal State Management**\n * - `_selectedKey` / `_selectedKeys`: Internal tracked state (prefixed with underscore)\n * - These serve as the \"source of truth\" for rendering and reactivity\n * - Getters (`getSelectedKey`, `selectedKeys`) expose this internal state to the template\n *\n * 3. **Internal → External (User Interactions)**\n * - User interactions trigger selection change handlers\n * - Handlers update internal `_selectedKey` / `_selectedKeys` for immediate UI update\n * - Handlers call parent's `@onSelectionChange` callback to notify of state change\n * - Parent updates its state, which flows back through step 1\n *\n * ### Why Both Internal State AND Callbacks?\n * - **Internal state:** Enables immediate, responsive UI updates (`_selectedKey` / `_selectedKeys`)\n * - **Parent callback:** Enables parent to take action when changes occur (`@onSelectionChange`)\n * - This pattern provides both responsive UX and parent inclusion over state\n *\n * ### Example Flow\n * ```\n * User clicks item\n * → onSelectionChange handler\n * → Updates _selectedKey (immediate UI update)\n * → Calls parent's @onSelectionChange callback\n * → Parent updates its @selectedKey state\n * → updateSingleSelectValue modifier syncs _selectedKey with new arg value\n * ```\n */\n/**\n * A dropdown selection component: a custom listbox in a popover, backed by a\n * visually hidden native `<select>` so the value submits with a form.\n *\n * Selection can be controlled with `@selectedKey` / `@selectedKeys` plus\n * `@onSelectionChange`, or left uncontrolled.\n */\nclass Select<T = unknown> extends Component<SelectSignature<T>> {\n /**\n * Every item registered by the hidden native `<select>`, in item order.\n *\n * The hidden select is deliberately given the *unfiltered* `@items` — it\n * carries the form value, which must not shrink to the filter — so this\n * covers the whole list even while the listbox is filtered down. Chips and\n * the joined text value can therefore be resolved straight from it.\n */\n @tracked nodes: ListItem[] = [];\n\n @tracked isOpen = false;\n /**\n * Internal tracked state for single selection mode.\n * Source of truth for rendering. Synced with @selectedKey via the updateSingleSelectValue modifier.\n */\n @tracked _selectedKey: string | null = null;\n\n /**\n * Internal tracked state for multiple selection mode.\n * Source of truth for rendering. Synced with @selectedKeys via the updateMultipleSelectValue modifier.\n */\n @tracked _selectedKeys: string[] = [];\n\n /**\n * Initializes the component and sets up initial selection state.\n *\n * **Initialization:**\n * 1. Determines selection mode (single vs multiple)\n * 2. Copies external arg values (@selectedKey or @selectedKeys) to internal tracked state\n * 3. Logs warnings if incorrect args are used for the selection mode\n *\n * Note: After instantiation, modifiers keep internal state synced with external arguments.\n */\n constructor(owner: Owner, args: SelectArgs<T>) {\n super(owner, args);\n\n // Initialize based on mode\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = this.args.selectedKeys || [];\n } else {\n this._selectedKey =\n (this.args as ExplicitSingleSelectArgs<T> | DefaultSingleSelectArgs<T>)\n .selectedKey || null;\n }\n\n // Runtime warnings for incorrect API usage\n this.validateArgs();\n }\n\n validateArgs() {\n if (this.args.selectionMode === 'multiple') {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKey'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKey is not supported in multiple selection mode. Use selectedKeys instead.'\n );\n }\n } else {\n if (\n typeof (this.args as unknown as Record<string, unknown>)[\n 'selectedKeys'\n ] !== 'undefined'\n ) {\n console.warn(\n 'WARNING: selectedKeys is deprecated for single selection mode. Use selectedKey instead.'\n );\n }\n }\n }\n\n @tracked filterValue?: string;\n\n containerRef = ref<HTMLDivElement>();\n triggerRef = ref<HTMLInputElement | HTMLButtonElement>();\n chipsContainerRef = ref<HTMLDivElement>();\n\n /**\n * Handles selection changes from the Listbox component.\n *\n * **Flow:**\n * 1. Updates internal state (`_selectedKey` or `_selectedKeys`) for immediate UI updates\n * 2. Calls parent's `@onSelectionChange` callback to notify of the change\n * 3. Parent updates its state, which flows back via modifier to complete the cycle\n *\n * **Side effects:**\n * - Clears filter value (for searchable selects)\n * - Triggers form input event for native form integration\n *\n * @param keys - Array of selected keys from Listbox (converted to single value in single mode)\n */\n onSelectionChange = (keys: string[]) => {\n if (this.args.selectionMode === 'multiple') {\n this._selectedKeys = keys;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (keys: string[]) => void)(keys);\n }\n } else {\n const singleKey: string | null = keys.length > 0 ? keys[0] || null : null;\n this._selectedKey = singleKey;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(\n singleKey\n );\n }\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n /**\n * Handles selection changes from the native <select> element.\n *\n * This is similar to `onSelectionChange` but accepts a single key directly\n * rather than an array, matching the native select's single-value API.\n *\n * **Flow:**\n * 1. Updates internal `_selectedKey` for immediate UI update\n * 2. Calls parent's `@onSelectionChange` callback\n *\n * @param key - The selected key, or null if cleared\n */\n onSingleSelectionChange = (key: string | null) => {\n this._selectedKey = key;\n if (typeof this.args.onSelectionChange === 'function') {\n (this.args.onSelectionChange as (key: string | null) => void)(key);\n }\n\n this.filterValue = undefined;\n triggerFormInputEvent(this.containerRef.current);\n };\n\n onOpenChange = (isOpen: boolean) => {\n this.isOpen = isOpen;\n };\n\n onFilterChange = (event: Event) => {\n const target = event.target as HTMLInputElement;\n this.filterValue = target.value;\n };\n\n /**\n * Backspace on an empty filter removes the last chip — the familiar tag-input\n * gesture. With text in the filter, Backspace edits the text as usual.\n */\n handleFilterKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'Backspace' || !this.showChips) {\n return;\n }\n const target = event.target as HTMLInputElement;\n if (target.value !== '') {\n return;\n }\n this.removeLastSelectedKey();\n };\n\n /**\n * The non-filterable counterpart of {@link handleFilterKeydown}.\n *\n * Chip close buttons are deliberately outside the tab order (they would\n * otherwise cost a Tab stop each before the combobox is reached), so\n * Backspace/Delete on the trigger is the *only* keyboard route to removing a\n * chip here. There is no text to edit on a button trigger, so both keys act\n * immediately; `preventDefault` keeps Backspace from navigating back.\n */\n handleTriggerKeydown = (event: KeyboardEvent) => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n if (event.key !== 'Backspace' && event.key !== 'Delete') {\n return;\n }\n event.preventDefault();\n this.removeLastSelectedKey();\n };\n\n /**\n * Removes the trailing chip. `removeSelectedKey` applies the same\n * `@allowEmpty` rule the chip close buttons follow, so the last required\n * selection stays put.\n */\n removeLastSelectedKey(): void {\n const items = this.selectedItems;\n const last = items[items.length - 1];\n if (last) {\n this.removeSelectedKey(last.key);\n }\n }\n\n /**\n * Returns current selection as an array for template rendering.\n *\n * Normalizes both single and multiple selection modes to a consistent array interface:\n * - Multiple mode: Returns `_selectedKeys` directly\n * - Single mode: Converts `_selectedKey` to array format (or empty array if null)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns Array of selected keys (empty array if none selected)\n */\n get selectedKeys(): string[] {\n if (this.args.selectionMode === 'multiple') {\n return this._selectedKeys;\n } else {\n // Single mode: convert selectedKey to array for internal use\n const key = this.getSelectedKey;\n return key ? [key] : [];\n }\n }\n\n /**\n * Returns the selected key for single selection mode.\n *\n * **Returns:**\n * - Single mode: Returns `_selectedKey` (string or null)\n * - Multiple mode: Returns null (not applicable)\n *\n * Note: Always returns internal tracked state rather than arguments. External updates\n * sync through modifiers to maintain consistency.\n *\n * @returns The selected key, or null if none selected or in multiple mode\n */\n get getSelectedKey(): string | null {\n return this._selectedKey;\n }\n\n get blockScroll() {\n if (this.args.blockScroll === false) {\n return false;\n }\n return true;\n }\n\n get disableFocusTrap() {\n if (this.args.disableFocusTrap === false) {\n return false;\n }\n return true;\n }\n\n onAction = (key: string) => {\n if (typeof this.args.onAction === 'function') {\n this.args.onAction(key);\n }\n\n if (\n this.args.closeOnItemSelect !== false &&\n this.args.selectionMode !== 'multiple'\n ) {\n this.isOpen = false;\n }\n\n // Deliberately does not touch `@onBlur`. Selecting is not blurring: this\n // runs on every option click, including the ones that leave the dropdown\n // open in multiple selection mode. Focus loss is reported by\n // `blurTracker` instead, from the trigger's own `focusout`.\n };\n\n /**\n * Reports focus leaving the *whole* control -- the field and its portaled\n * dropdown -- rather than the trigger, which blurs on the way into the\n * dropdown and on every option click. See `ControlBlurTracker`.\n */\n blurTracker = new ControlBlurTracker({\n trigger: () => this.triggerRef.current,\n container: () => this.containerRef.current,\n isOpen: () => this.isOpen,\n isDestroyed: () => this.isDestroyed || this.isDestroying,\n onBlur: () => this.args.onBlur?.()\n });\n\n willDestroy(): void {\n super.willDestroy();\n // Nothing may resolve against a destroyed component.\n this.blurTracker.cancel();\n }\n\n /**\n * In chips mode the trigger is only as wide as the room left over beside the\n * chips, so the field's padding -- and the strip under the chevron -- are not\n * part of it, and with a single selection the trigger can be a narrow sliver.\n * Without this, clicking anywhere else in the field would do nothing, while\n * the same click anywhere on a non-chips field opens the dropdown (there the\n * trigger *is* the whole field). Forwards such a click to the trigger,\n * including clicks on a chip's own body, so the whole field is a click\n * target. The one exception is a chip's close button: within the chips\n * container the only `<button>` elements a chip ever renders are its close\n * button (see chip.gts / close-button.gts), so `closest('button')` combined\n * with containment against `chipsContainerRef` identifies it without relying\n * on any test-only attribute. Clicks on the trigger itself are left alone\n * too, since it already handles its own clicks.\n */\n handleFieldClick = (event: MouseEvent): void => {\n if (!this.showChips || this.args.isDisabled) {\n return;\n }\n\n const trigger = this.triggerRef.current;\n const target = event.target;\n\n if (!trigger || !(target instanceof Element)) {\n return;\n }\n\n // The trigger handles its own clicks; this listener also sees them bubble.\n if (trigger === target || trigger.contains(target)) {\n return;\n }\n\n const chipsContainer = this.chipsContainerRef.current;\n\n if (chipsContainer && chipsContainer.contains(target)) {\n const closeButton = target.closest('button');\n if (closeButton && chipsContainer.contains(closeButton)) {\n return;\n }\n }\n\n trigger.focus();\n trigger.click();\n };\n\n /**\n * Wipes the selection from the clear button.\n *\n * Unlike the chips and the listbox options, this deliberately does *not*\n * consult `@allowEmpty`. `@allowEmpty` governs deselecting *an option* --\n * the listbox refuses to let the last one be toggled off, and\n * `chipsRemovable` mirrors that -- whereas `@isClearable` is a separate,\n * explicit affordance the consumer opts into for exactly this purpose. It\n * also defaults to `false`, so honouring it here would render the clear\n * button dead in every default configuration. Documented as an override on\n * `@isClearable` itself; the two must keep saying the same thing.\n *\n * A disabled Select renders no clear button at all (see `isClearable`), so\n * there is nothing to guard here.\n */\n clearSelectedKeys = () => {\n this.onSelectionChange([]);\n };\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@variant` only -- never `@appearance` as well, which would make the\n * inner `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get variant() {\n return renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'subtle' } as const,\n {\n component: 'Select',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.select.appearance'\n }\n );\n }\n\n /**\n * Resolved once (`@cached`) and forwarded to the internal `Listbox` as\n * `@color` only -- never `@intent` as well, which would make the inner\n * `Listbox` raise its own deprecation for the same usage.\n */\n @cached\n get color() {\n return renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Select',\n from: 'intent',\n to: 'color',\n id: 'frontile.select.intent'\n }\n );\n }\n\n /**\n * Resolved chip appearance: `@chip` wins, then the Select's own `@color`\n * (or deprecated `@intent`), then chip defaults tuned for sitting inside a\n * field.\n */\n get chipOptions(): ResolvedSelectChipOptions {\n const chip =\n this.args.selectionMode === 'multiple' ? this.args.chip : undefined;\n return {\n // `appearance` is passed through only when the consumer set it. Giving\n // it a default would make Chip's deprecation fire on every chip render.\n variant: chip?.variant ?? (chip?.appearance ? undefined : 'soft'),\n appearance: chip?.appearance,\n // `intent` is passed through only when the consumer (or Select's own\n // deprecated `@intent`) actually set it. Defaulting it would fire\n // Chip's `intent` deprecation on every chip render, for a prop nobody\n // wrote.\n color:\n chip?.color ??\n this.args.color ??\n ((chip?.intent ?? this.args.intent) ? undefined : 'neutral'),\n intent: chip?.intent ?? this.args.intent,\n size: chip?.size ?? 'sm',\n radius: chip?.radius,\n withDot: chip?.withDot ?? false\n };\n }\n\n /**\n * Whether chips may be removed. Mirrors the listbox: with `@allowEmpty`\n * false — the default — the final selection cannot be deselected, so its\n * chip renders without a close button rather than with a dead one.\n */\n get chipsRemovable(): boolean {\n // Asks `canDeselectKey` — the rule the listbox itself applies when an\n // already-selected option is clicked — rather than restating it, so a chip\n // and its option can never disagree about the same removal.\n //\n // Asked of `selectedItems`, the collection the chips render from, so the\n // decision cannot disagree with what is on screen either (a selected key\n // with no remembered item would otherwise be counted but never render a\n // chip at all). Every chip's key is in that collection by construction, so\n // the rule's answer is the same for all of them; it is asked of the last\n // chip, the one Backspace removes.\n const keys = this.selectedItems.map((item) => item.key);\n const lastKey = keys[keys.length - 1];\n\n // With nothing selected there is no chip, so nothing reads this today --\n // but the answer is deliberately `@allowEmpty`, not `false`. That is what\n // this getter has always returned for an empty selection, and keeping it\n // means the answer never depends on whether a chip happens to exist right\n // now. `canDeselectKey` cannot be asked here (it needs a key), so the\n // empty case is answered directly. Do not \"simplify\" this away.\n if (lastKey === undefined) {\n return this.args.allowEmpty === true;\n }\n\n return canDeselectKey(keys, lastKey, this.args.allowEmpty);\n }\n\n /**\n * Removes a single selection from a chip's close button. Routes through\n * `onSelectionChange`, which already syncs internal state, notifies the\n * parent and dispatches the form input event.\n */\n removeSelectedKey = (key: string) => {\n if (this.args.isDisabled || !this.chipsRemovable) {\n return;\n }\n this.onSelectionChange(this.selectedKeys.filter((k) => k !== key));\n };\n\n onItemsChange = (nodes: ListItem[], _: 'add' | 'remove') => {\n // `onItemsChange` runs while a modifier installs, i.e. inside a render\n // pass. Reading a tracked field here and writing it in the same\n // computation would trip Glimmer's read-then-write assertion, so `nodes`\n // is only ever written, never read, in this callback.\n this.nodes = nodes;\n };\n\n didClose = () => {\n this.filterValue = undefined;\n if (typeof this.args.didClose === 'function') {\n this.args.didClose();\n }\n };\n\n /**\n * Whether selections render as chips. Chips are the default presentation for\n * multiple selection mode; `@selectedItemsDisplay=\"text\"` opts back out to the\n * comma-joined string.\n */\n get showChips(): boolean {\n return (\n this.args.selectionMode === 'multiple' &&\n this.args.selectedItemsDisplay !== 'text'\n );\n }\n\n get hasSelection(): boolean {\n return this.selectedKeys.length > 0;\n }\n\n /**\n * The accessible name for the trigger when its own text cannot supply one.\n *\n * Left to itself the trigger names itself from its own text -- the selected\n * label, or the placeholder -- and that is still what happens in the plain\n * case; see the trigger, which only applies this when it has to.\n *\n * Two cases need it:\n *\n * - **Chips mode.** The trigger renders nothing; the chips are its siblings\n * and are read separately. Naming the *control* is both enough and\n * correct here -- appending the selection would have it read twice -- so\n * this returns the bare name.\n * - **A `:selectedItem` block.** The block owns the trigger's content and may\n * render nothing readable at all (an avatar, an icon), which would leave\n * the combobox announced as an unnamed button. The selection is not\n * readable anywhere else in that case, so the name carries it: the control\n * name *and* the selected options' text.\n *\n * The two halves are composed so that the separator only appears when both\n * are there. A selected key with no registered option behind it resolves to\n * no text at all, and `\"Owner, \"` is announced as \"Owner comma\"; and with\n * neither `@label` nor `@placeholder` the only control name available is the\n * hardcoded, unlocalizable `Select options`, so the selected text is left to\n * name the control on its own rather than be prefixed by English.\n */\n get triggerAccessibleName(): string {\n const name = this.args.label || this.args.placeholder;\n\n // Chips mode names the *control* only -- the chips are read separately --\n // and has no better fallback than the literal.\n if (this.showChips) {\n return name || 'Select options';\n }\n\n const selectedText = this.hasSelection ? this.selectedTextValue : '';\n\n if (!name) {\n return selectedText || 'Select options';\n }\n\n return selectedText ? `${name}, ${selectedText}` : name;\n }\n\n /**\n * The selected options in item order (not click order) so chips do not\n * reorder underneath the user as they select.\n *\n * Resolved against `nodes`, which the hidden native `<select>` populates from\n * the unfiltered `@items`, so a chip stays put while a filter hides the item\n * it came from.\n */\n get selectedItems(): SelectedItem[] {\n const keys = this.selectedKeys;\n return this.nodes\n .filter((node) => keys.includes(node.key))\n .map((node) => ({\n key: node.key,\n textValue: node.textValue,\n item: node.item\n }));\n }\n\n /**\n * The same selection `selectedItems` describes, rendered as text.\n *\n * Chips and this string are two presentations of one thing, so they read one\n * projection: walking `nodes` a second time here is how a fix to the\n * selection's contents once landed in the chips and not in the text.\n */\n get selectedTextValue(): string {\n return this.selectedItems.map((item) => item.textValue).join(', ');\n }\n\n get backdrop() {\n if (typeof this.args.backdrop === 'undefined') {\n return 'transparent';\n }\n return this.args.backdrop;\n }\n\n get classes() {\n const { select } = useStyles();\n // Referenced here, on the always-rendered root, so `@appearance`/\n // `@variant` (and `@intent`/`@color`) raises its deprecation regardless\n // of whether the popover content (and so the internal `Listbox`) is\n // currently mounted.\n void this.variant;\n void this.color;\n return select({\n size: this.args.inputSize,\n hasChips: this.showChips,\n isFilterable: !!this.args.isFilterable\n });\n }\n\n /**\n * Whether the clear button takes the chevron's place: something to clear,\n * and a control that can act on it. A disabled Select never shows it -- the\n * end-content cluster is not pointer-transparent to it and it carries no\n * disabled state of its own, so it would otherwise be a focusable button\n * that clears a field the user is not allowed to change.\n */\n get isClearable() {\n return (\n this.args.isClearable &&\n !this.args.isDisabled &&\n this.selectedKeys &&\n this.selectedKeys.length > 0\n );\n }\n\n get filterFieldValue() {\n if (this.filterValue !== undefined) {\n return this.filterValue;\n }\n // With chips, the selection is already visible beside the input. Echoing\n // the joined text here would fill the box and block typing.\n if (this.showChips) {\n return '';\n }\n return this.selectedTextValue;\n }\n\n get filteredItems() {\n if (this.filterValue === undefined) {\n return this.args.items;\n }\n\n return filterAndRankItems(\n this.args.items,\n this.filterValue || '',\n (item) => keyAndLabelForItem(item).label,\n this.args.filter\n );\n }\n\n get showEmptyContent() {\n return this.filteredItems?.length === 0 && !this.args.hideEmptyContent;\n }\n\n get autoActivateMode(): 'first' | 'selected' {\n if (this.filterValue === undefined || this.filterValue === '') {\n return 'selected';\n }\n return 'first';\n }\n\n /**\n * Syncs internal `_selectedKeys` with external `@selectedKeys` argument.\n *\n * Runs whenever `@selectedKeys` changes:\n * - Updates `_selectedKeys` to match the new external value\n * - Normalizes undefined/null to empty array\n *\n * This enables UI updates when the external value changes.\n */\n updateMultipleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKeys]: [string[] | null | undefined]) => {\n if (selectedKeys !== undefined && selectedKeys !== null) {\n this._selectedKeys = selectedKeys;\n } else {\n // NOTE: is this the right behavior?\n this._selectedKeys = [];\n }\n }\n );\n\n /**\n * Syncs internal `_selectedKey` with external `@selectedKey` argument.\n *\n * Runs whenever `@selectedKey` changes:\n * - Updates `_selectedKey` to match the new external value\n * - Handles null values for cleared selections\n *\n * This enables UI updates when the external value changes.\n */\n updateSingleSelectValue = modifier(\n (_: HTMLDivElement, [selectedKey]: [string | null | undefined]) => {\n if (selectedKey !== undefined) {\n this._selectedKey = selectedKey;\n }\n }\n );\n\n <template>\n <div\n {{this.updateMultipleSelectValue @selectedKeys}}\n {{this.updateSingleSelectValue @selectedKey}}\n {{this.containerRef.setup}}\n class={{this.classes.base class=@classes.base}}\n data-component=\"select\"\n data-part=\"base\"\n ...attributes\n >\n <FormControl\n @id={{@id}}\n @size={{@inputSize}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n as |c|\n >\n <Popover\n @placement={{@placement}}\n @flipOptions={{@flipOptions}}\n @middleware={{@middleware}}\n @shiftOptions={{@shiftOptions}}\n @offsetOptions={{@offsetOptions}}\n @strategy={{@strategy}}\n @didClose={{this.didClose}}\n @isOpen={{this.isOpen}}\n @onOpenChange={{this.onOpenChange}}\n as |p|\n >\n <VisuallyHidden>\n <SelectNativeMirror\n @items={{@items}}\n @allowEmpty={{@allowEmpty}}\n @disabledKeys={{@disabledKeys}}\n @selectionMode={{@selectionMode}}\n @selectedKeys={{this.selectedKeys}}\n @selectedKey={{this.getSelectedKey}}\n @onSelectionChange={{this.onSelectionChange}}\n @onSingleSelectionChange={{this.onSingleSelectionChange}}\n @onItemsChange={{this.onItemsChange}}\n @placeholder={{@placeholder}}\n @id={{c.id}}\n @name={{@name}}\n @isDisabled={{@isDisabled}}\n >\n <:default as |l|>\n {{! @glint-expect-error: the signature of the native select is not the same as the listbox}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{! The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. }}\n <div\n {{p.anchor}}\n {{p.measureWidth}}\n {{on \"click\" this.handleFieldClick}}\n data-test-id={{if this.showChips \"chips-field\"}}\n data-part=\"chips-field\"\n {{! These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. }}\n data-has-chips={{if this.showChips \"true\" \"false\"}}\n data-invalid={{if c.isInvalid \"true\" \"false\"}}\n data-disabled={{if @isDisabled \"true\" \"false\"}}\n class={{this.classes.chipsField\n class=@classes.chipsField\n hasStartContent=(has-block \"startContent\")\n hasEndContent=true\n }}\n >\n {{#if (and this.showChips this.hasSelection)}}\n {{! A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. }}\n <SelectedChips\n @containerRef={{this.chipsContainerRef.setup}}\n @items={{this.selectedItems}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @chipOptions={{this.chipOptions}}\n @isDisabled={{@isDisabled}}\n @isRemovable={{this.chipsRemovable}}\n @onRemove={{this.removeSelectedKey}}\n >\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger\n @isFilterable={{@isFilterable}}\n @trigger={{p.trigger}}\n @triggerRef={{this.triggerRef.setup}}\n @isDisabled={{@isDisabled}}\n @showChips={{this.showChips}}\n @accessibleName={{this.triggerAccessibleName}}\n @placeholder={{@placeholder}}\n @hasSelection={{this.hasSelection}}\n @hasStartContent={{has-block \"startContent\"}}\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @items={{this.selectedItems}}\n @filterValue={{this.filterFieldValue}}\n @onFilterInput={{this.onFilterChange}}\n @onFilterKeydown={{this.handleFilterKeydown}}\n @onKeydown={{this.handleTriggerKeydown}}\n @onFocusOut={{this.blurTracker.handleFocusOut}}\n @hasCustomContent={{has-block \"selectedItem\"}}\n >\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent\n @classes={{this.classes}}\n @userClasses={{@classes}}\n @endContentPointerEvents={{@endContentPointerEvents}}\n @inputSize={{@inputSize}}\n @isLoading={{@isLoading}}\n @isClearable={{this.isClearable}}\n @onClear={{this.clearSelectedKeys}}\n >\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content\n @size={{if @popoverSize @popoverSize \"trigger\"}}\n @target={{@target}}\n @renderInPlace={{@renderInPlace}}\n @disableFocusTrap={{this.disableFocusTrap}}\n @blockScroll={{this.blockScroll}}\n @transitionDuration={{@transitionDuration}}\n @backdrop={{this.backdrop}}\n @disableTransitions={{@disableTransitions}}\n @focusTrapOptions={{@focusTrapOptions}}\n @closeOnOutsideClick={{@closeOnOutsideClick}}\n @closeOnEscapeKey={{@closeOnEscapeKey}}\n @backdropTransition={{@backdropTransition}}\n @transition={{@transition}}\n @preventAutoFocus={{true}}\n >\n <Listbox\n @items={{this.filteredItems}}\n @allowEmpty={{@allowEmpty}}\n @variant={{this.variant}}\n @disabledKeys={{@disabledKeys}}\n @color={{this.color}}\n @isKeyboardEventsEnabled={{true}}\n @onAction={{this.onAction}}\n @onSelectionChange={{this.onSelectionChange}}\n @selectedKeys={{this.selectedKeys}}\n @selectionMode={{if @selectionMode @selectionMode \"single\"}}\n @type=\"listbox\"\n @class={{this.classes.listbox class=@classes.listbox}}\n @elementToAddKeyboardEvents={{this.triggerRef.current}}\n @autoActivateMode={{this.autoActivateMode}}\n data-part=\"listbox\"\n >\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item\n @key={{l.key}}\n @variant={{this.variant}}\n @color={{this.color}}\n >\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div\n class={{this.classes.emptyContent class=@classes.emptyContent}}\n data-part=\"empty-content\"\n >\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n </div>\n </template>\n}\n\nexport {\n Select,\n type SelectSignature,\n type SelectChipOptions,\n type SelectedItem,\n type SelectedItemBlockArg\n};\nexport default Select;\n"],"names":["and","a","b","Boolean","Select","Component","g","prototype","tracked","i","constructor","owner","args","selectionMode","_selectedKeys","selectedKeys","_selectedKey","selectedKey","validateArgs","console","warn","containerRef","ref","triggerRef","chipsContainerRef","onSelectionChange","keys","singleKey","length","filterValue","undefined","triggerFormInputEvent","current","onSingleSelectionChange","key","onOpenChange","isOpen","onFilterChange","event","target","value","handleFilterKeydown","showChips","removeLastSelectedKey","handleTriggerKeydown","isDisabled","preventDefault","items","selectedItems","last","removeSelectedKey","getSelectedKey","blockScroll","disableFocusTrap","onAction","closeOnItemSelect","blurTracker","ControlBlurTracker","trigger","container","isDestroyed","isDestroying","onBlur","willDestroy","cancel","handleFieldClick","Element","contains","chipsContainer","closeButton","closest","focus","click","clearSelectedKeys","variant","renamedArgValue","appearance","default","outlined","faded","component","from","to","id","n","cached","color","intent","chipOptions","chip","size","radius","withDot","chipsRemovable","map","item","lastKey","allowEmpty","canDeselectKey","filter","k","onItemsChange","nodes","_","didClose","selectedItemsDisplay","hasSelection","triggerAccessibleName","name","label","placeholder","selectedText","selectedTextValue","node","includes","textValue","join","backdrop","classes","select","useStyles","inputSize","hasChips","isFilterable","isClearable","filterFieldValue","filteredItems","filterAndRankItems","keyAndLabelForItem","showEmptyContent","hideEmptyContent","autoActivateMode","updateMultipleSelectValue","modifier","updateSingleSelectValue","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","Popover","VisuallyHidden","SelectNativeMirror","on","SelectedChips","SelectTrigger","SelectEndContent","Listbox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAE9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4CC;AACD,MAAME,MAAA,SAA4BC,UAA0B;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,OAAA,EAAA,CASzDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA4B,EAAE;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,MAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,OAAA,CAAA,EAAA,MAAA;AAR/B;;;;;;;AAOC;AAPD,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,QAAA,EAAA,CAUCC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAiB,KAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,OAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,QAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAH,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAKjBC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAsC,IAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,aAAA,IAAAC,2BAAA,CAAA,IA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C,KAAA;AAC/D,IAAA,IAAIA,YAAA,KAAiBe,SAAA,IAAaf,YAAA,KAAiB,IAAA,EAAM;MACvD,IAAI,CAACD,aAAa,GAAGC,YAAA;AACvB,IAAA,CAAA,MAAO;AACL;MACA,IAAI,CAACD,aAAa,GAAG,EAAE;AACzB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF;;;;;;;;AAQC;EACDwH,uBAAA,GAA0BD,QAAA,CACxB,CAAC9B,CAAG,EAAgB,CAACtF,WAAA,CAAyC,KAAA;IAC5D,IAAIA,gBAAgBa,SAAA,EAAW;MAC7B,IAAI,CAACd,YAAY,GAAGC,WAAA;AACtB,IAAA;AACF,EAAA,CAAA,CAAA;AAGF,EAAA;IAAAsH,oBAAA,CAAAC,kBAAA,CAAA,q/NAAA,EAmOA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,OAAA;QAAAC,cAAA;QAAAC,kBAAA;QAAAC,EAAA;QAAA/I,GAAA;QAAAgJ,aAAA;QAAAC,aAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selected-items.js","sources":["../../../../src/components/forms/select/selected-items.gts"],"sourcesContent":["import { concat, fn } from '@ember/helper';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { Chip } from '../../buttons/chip';\nimport type {\n ResolvedSelectChipOptions,\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n/**\n * The selection rendered as text: one string, so a `<span>` holding it stays a\n * single text node.\n */\nconst joinTextValues = (items: SelectedItem[]): string =>\n items.map((item) => item.textValue).join(', ');\n\n/**\n * Maps the internal {@link SelectedItem} projection onto what the `:item`\n * block here -- and, through it, the Select's `:selectedItem` block -- is\n * handed: `{ item, key, label }`, the same shape the `:item` block of the\n * listbox yields, so markup moves between the two unchanged.\n *\n * `item` is `unknown` at this level (it comes off the registered option\n * nodes), so it is typed `never` to stay assignable to the consumer's own `T`\n * when Select re-yields it. It is optional either way: an option written in\n * block form has no collection entry behind it.\n */\nconst toBlockArg = (item: SelectedItem): SelectedItemBlockArg<never> => ({\n item: item.item as never,\n key: item.key,\n label: item.textValue\n});\n\n/** Whether a comma separator is needed before this selection. */\nconst isNotFirst = (index: number): boolean => index > 0;\n\ninterface SelectedTextSignature {\n Args: {\n /** The selection, in item order. */\n items: SelectedItem[];\n\n /**\n * Whether the `:item` block is the consumer's own content rather than the\n * fallback the Select fills it with.\n *\n * A block cannot be passed conditionally in Glimmer, so the Select always\n * supplies one; this is how the plain presentation stays *exactly* what it\n * was -- the whole selection as one joined string in a single text node --\n * instead of becoming a per-item loop that merely renders the same\n * characters.\n */\n hasCustomContent?: boolean;\n };\n Blocks: {\n /** Content for one selected option, in place of its text. */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * The selection presented as a comma-joined string, inside the trigger.\n *\n * The text presentation and the chips presentation are the two renderings of\n * one selection, so they live in one file and read the same\n * {@link SelectedItem} projection.\n */\nconst SelectedText: TOC<SelectedTextSignature> = <template>\n <span ...attributes>\n {{#if @hasCustomContent}}\n {{#each @items key=\"key\" as |item index|}}\n {{~#if (isNotFirst index)}}, {{/if~}}\n {{~yield (toBlockArg item) to=\"item\"~}}\n {{/each}}\n {{else}}\n {{joinTextValues @items}}\n {{/if}}\n </span>\n</template>;\n\ninterface SelectedChipsSignature {\n Args: {\n /** The selection, in item order, so chips do not reorder as they are picked. */\n items: SelectedItem[];\n\n /**\n * Installed on the chips container. The field click forwarder reads this\n * ref to tell a chip body apart from a chip close button structurally,\n * without depending on any attribute.\n */\n containerRef: ModifierLike<{ Element: HTMLDivElement }>;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n chipOptions: ResolvedSelectChipOptions;\n isDisabled?: boolean;\n\n /**\n * Whether a chip may be removed at all. When false the chip renders with no\n * close button rather than a dead one.\n */\n isRemovable: boolean;\n\n onRemove: (key: string) => void;\n };\n Blocks: {\n /**\n * The body of one chip, in place of the option's text. The chip chrome --\n * its appearance, its dot and its close button -- is not the block's to\n * replace, so it stays put around whatever is rendered here.\n */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The selection presented as a row of removable {@link Chip}s beside the\n * trigger.\n *\n * The close buttons are deliberately outside the tab order\n * (`@closeButtonTabIndex=\"-1\"`) so the trigger keeps the first Tab stop in the\n * field; Backspace on the field is the keyboard route to removal.\n *\n * The close button's title is built from `textValue`, never from the block, so\n * a chip whose body is purely graphical is still announced as \"Remove <label>\".\n */\nconst SelectedChips: TOC<SelectedChipsSignature> = <template>\n <div\n {{@containerRef}}\n data-part=\"chips-container\"\n class={{@classes.chipsContainer class=@userClasses.chipsContainer}}\n ...attributes\n >\n {{#each @items key=\"key\" as |item|}}\n <Chip\n data-part=\"chip\"\n data-key={{item.key}}\n @class={{@classes.chip class=@userClasses.chip}}\n @variant={{@chipOptions.variant}}\n @appearance={{@chipOptions.appearance}}\n @color={{@chipOptions.color}}\n @intent={{@chipOptions.intent}}\n @size={{@chipOptions.size}}\n @radius={{@chipOptions.radius}}\n @withDot={{@chipOptions.withDot}}\n @isDisabled={{@isDisabled}}\n @closeButtonTitle={{concat \"Remove \" item.textValue}}\n @closeButtonTabIndex=\"-1\"\n @onClose={{if @isRemovable (fn @onRemove item.key)}}\n >\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n </div>\n</template>;\n\nexport {\n SelectedChips,\n SelectedText,\n type SelectedChipsSignature,\n type SelectedTextSignature\n};\n"],"names":["joinTextValues","items","map","item","textValue","join","toBlockArg","key","label","isNotFirst","index","SelectedText","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","SelectedChips","Chip","concat","fn"],"mappings":";;;;;;AAgBA,MAAMA,cAAA,GAAkBC,KAAO,IAC7BA,KAAA,CAAMC,GAAG,CAAEC,IAAA,IAASA,IAAA,CAAKC,SAAS,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AAE3C;;;;;;;;;;;AAWA,MAAMC,aAAcH,SAAqD;EACvEA,IAAA,EAAMA,IAAA,CAAKA,IAAa;EACxBI,GAAA,EAAKJ,KAAKI,GAAG;EACbC,KAAA,EAAOL,KAAKC;AACd,CAAC,CAAA;AAED;AACA,MAAMK,UAAA,GAAcC,KAAa,IAAcA,KAAA,GAAQ,CAAA;AA0BvD;;;;;;AAMC;AACD,MAAMC,YAAkB,GAAAC,oBAAA,CAAyBC,kBAAA,CAAA,iRAAA,EAWjD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAN,UAAA;IAAAH,UAAA;AAAAN,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAgB,YAAA,EAAA;AAsCV;;;;;;;;;;AAUC;AACD,MAAMC,aAAmB,GAAAL,oBAAA,CAA0BC,kBAAA,CAAA,qvBAAA,EA4BnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAG,IAAA;IAAAC,MAAA;IAAAC,EAAA;AAAAd,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAU,YAAA,EAAA
|
|
1
|
+
{"version":3,"file":"selected-items.js","sources":["../../../../src/components/forms/select/selected-items.gts"],"sourcesContent":["import { concat, fn } from '@ember/helper';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { Chip } from '../../buttons/chip';\nimport type {\n ResolvedSelectChipOptions,\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\n/**\n * The selection rendered as text: one string, so a `<span>` holding it stays a\n * single text node.\n */\nconst joinTextValues = (items: SelectedItem[]): string =>\n items.map((item) => item.textValue).join(', ');\n\n/**\n * Maps the internal {@link SelectedItem} projection onto what the `:item`\n * block here -- and, through it, the Select's `:selectedItem` block -- is\n * handed: `{ item, key, label }`, the same shape the `:item` block of the\n * listbox yields, so markup moves between the two unchanged.\n *\n * `item` is `unknown` at this level (it comes off the registered option\n * nodes), so it is typed `never` to stay assignable to the consumer's own `T`\n * when Select re-yields it. It is optional either way: an option written in\n * block form has no collection entry behind it.\n */\nconst toBlockArg = (item: SelectedItem): SelectedItemBlockArg<never> => ({\n item: item.item as never,\n key: item.key,\n label: item.textValue\n});\n\n/** Whether a comma separator is needed before this selection. */\nconst isNotFirst = (index: number): boolean => index > 0;\n\ninterface SelectedTextSignature {\n Args: {\n /** The selection, in item order. */\n items: SelectedItem[];\n\n /**\n * Whether the `:item` block is the consumer's own content rather than the\n * fallback the Select fills it with.\n *\n * A block cannot be passed conditionally in Glimmer, so the Select always\n * supplies one; this is how the plain presentation stays *exactly* what it\n * was -- the whole selection as one joined string in a single text node --\n * instead of becoming a per-item loop that merely renders the same\n * characters.\n */\n hasCustomContent?: boolean;\n };\n Blocks: {\n /** Content for one selected option, in place of its text. */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLSpanElement;\n}\n\n/**\n * The selection presented as a comma-joined string, inside the trigger.\n *\n * The text presentation and the chips presentation are the two renderings of\n * one selection, so they live in one file and read the same\n * {@link SelectedItem} projection.\n */\nconst SelectedText: TOC<SelectedTextSignature> = <template>\n <span ...attributes>\n {{#if @hasCustomContent}}\n {{#each @items key=\"key\" as |item index|}}\n {{~#if (isNotFirst index)}}, {{/if~}}\n {{~yield (toBlockArg item) to=\"item\"~}}\n {{/each}}\n {{else}}\n {{joinTextValues @items}}\n {{/if}}\n </span>\n</template>;\n\ninterface SelectedChipsSignature {\n Args: {\n /** The selection, in item order, so chips do not reorder as they are picked. */\n items: SelectedItem[];\n\n /**\n * Installed on the chips container. The field click forwarder reads this\n * ref to tell a chip body apart from a chip close button structurally,\n * without depending on any attribute.\n */\n containerRef: ModifierLike<{ Element: HTMLDivElement }>;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n chipOptions: ResolvedSelectChipOptions;\n isDisabled?: boolean;\n\n /**\n * Whether a chip may be removed at all. When false the chip renders with no\n * close button rather than a dead one.\n */\n isRemovable: boolean;\n\n onRemove: (key: string) => void;\n };\n Blocks: {\n /**\n * The body of one chip, in place of the option's text. The chip chrome --\n * its appearance, its dot and its close button -- is not the block's to\n * replace, so it stays put around whatever is rendered here.\n */\n item: [SelectedItemBlockArg<never>];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The selection presented as a row of removable {@link Chip}s beside the\n * trigger.\n *\n * The close buttons are deliberately outside the tab order\n * (`@closeButtonTabIndex=\"-1\"`) so the trigger keeps the first Tab stop in the\n * field; Backspace on the field is the keyboard route to removal.\n *\n * The close button's title is built from `textValue`, never from the block, so\n * a chip whose body is purely graphical is still announced as \"Remove <label>\".\n */\nconst SelectedChips: TOC<SelectedChipsSignature> = <template>\n <div\n {{@containerRef}}\n data-part=\"chips-container\"\n class={{@classes.chipsContainer class=@userClasses.chipsContainer}}\n ...attributes\n >\n {{#each @items key=\"key\" as |item|}}\n <Chip\n data-part=\"chip\"\n data-key={{item.key}}\n @class={{@classes.chip class=@userClasses.chip}}\n @variant={{@chipOptions.variant}}\n @appearance={{@chipOptions.appearance}}\n @color={{@chipOptions.color}}\n @intent={{@chipOptions.intent}}\n @size={{@chipOptions.size}}\n @radius={{@chipOptions.radius}}\n @withDot={{@chipOptions.withDot}}\n @isDisabled={{@isDisabled}}\n @closeButtonTitle={{concat \"Remove \" item.textValue}}\n @closeButtonTabIndex=\"-1\"\n @onClose={{if @isRemovable (fn @onRemove item.key)}}\n >\n {{yield (toBlockArg item) to=\"item\"}}\n </Chip>\n {{/each}}\n </div>\n</template>;\n\nexport {\n SelectedChips,\n SelectedText,\n type SelectedChipsSignature,\n type SelectedTextSignature\n};\n"],"names":["joinTextValues","items","map","item","textValue","join","toBlockArg","key","label","isNotFirst","index","SelectedText","setComponentTemplate","precompileTemplate","strictMode","scope","templateOnly","SelectedChips","Chip","concat","fn"],"mappings":";;;;;;AAgBA,MAAMA,cAAA,GAAkBC,KAAO,IAC7BA,KAAA,CAAMC,GAAG,CAAEC,IAAA,IAASA,IAAA,CAAKC,SAAS,CAAA,CAAEC,IAAI,CAAC,IAAA,CAAA;AAE3C;;;;;;;;;;;AAWA,MAAMC,aAAcH,SAAqD;EACvEA,IAAA,EAAMA,IAAA,CAAKA,IAAa;EACxBI,GAAA,EAAKJ,KAAKI,GAAG;EACbC,KAAA,EAAOL,KAAKC;AACd,CAAC,CAAA;AAED;AACA,MAAMK,UAAA,GAAcC,KAAa,IAAcA,KAAA,GAAQ,CAAA;AA0BvD;;;;;;AAMC;AACD,MAAMC,YAAkB,GAAAC,oBAAA,CAAyBC,kBAAA,CAAA,iRAAA,EAWjD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAN,UAAA;IAAAH,UAAA;AAAAN,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAgB,YAAA,EAAA;AAsCV;;;;;;;;;;AAUC;AACD,MAAMC,aAAmB,GAAAL,oBAAA,CAA0BC,kBAAA,CAAA,qvBAAA,EA4BnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAG,IAAA;IAAAC,MAAA;IAAAC,EAAA;AAAAd,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAU,YAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.js","sources":["../../../../src/components/forms/select/trigger.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { SelectedText } from './selected-items';\nimport type {\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\nconst or = (a: unknown, b: unknown) => Boolean(a) || Boolean(b);\nconst valueUnless = <T,>(condition: unknown, value: T): T | undefined =>\n condition ? undefined : value;\n\ninterface SelectTriggerSignature {\n Args: {\n /** Whether the trigger is a filter input rather than a button. */\n isFilterable?: boolean;\n\n /** The popover's `trigger` modifier: what opens the dropdown. */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Records the trigger element. The field click forwarder and the listbox's\n * keyboard-event host both need the live element.\n */\n triggerRef: ModifierLike<{\n Element: HTMLInputElement | HTMLButtonElement;\n }>;\n\n isDisabled?: boolean;\n showChips: boolean;\n\n /**\n * Names the trigger when its own text cannot.\n *\n * In chips mode the trigger renders no text of its own (the chips are its\n * siblings and are read separately), so without this the combobox would be\n * announced unnamed. The same is true whenever `@hasCustomContent` is set:\n * the block may render nothing readable at all.\n */\n accessibleName: string;\n\n /**\n * Whether the consumer supplied a `:selectedItem` block, i.e. whether the\n * text inside the trigger is theirs rather than the option's label.\n *\n * Two things hang off this: the `<button>` trigger stops trusting its own\n * text content for its accessible name, and {@link SelectedText} switches\n * from the joined string to a per-selection loop. The filterable\n * `<input>` trigger ignores it -- the block never renders there, so the\n * input's own value still names it.\n */\n hasCustomContent?: boolean;\n\n placeholder?: string;\n hasSelection: boolean;\n hasStartContent: boolean;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /** The selection, for the text presentation inside a button trigger. */\n items: SelectedItem[];\n\n /** Current value of the filter input. */\n filterValue: string;\n onFilterInput: (event: Event) => void;\n onFilterKeydown: (event: KeyboardEvent) => void;\n onKeydown: (event: KeyboardEvent) => void;\n\n /**\n * Reports the trigger losing focus, as `focusout` rather than `blur`: the\n * Select decides whether focus actually left the control from the event's\n * `relatedTarget`, and browsers only guarantee that on `focusout`.\n */\n onFocusOut: (event: FocusEvent) => void;\n };\n Blocks: {\n /**\n * Content for one selected option, forwarded straight through to\n * {@link SelectedText}. Always supplied by the Select -- a block cannot be\n * passed conditionally -- so `@hasCustomContent` is what says whether it\n * holds the consumer's markup or the plain-label fallback.\n */\n selectedItem: [SelectedItemBlockArg<never>];\n };\n}\n\n/**\n * The Select's trigger: a filter `<input>` when `@isFilterable`, otherwise a\n * `<button>`.\n *\n * Both carry `data-part=\"input\"` (the Select's own `input` slot -- this is a\n * part of the `select` component, not a component of its own) and the same\n * `input` slot classes, whose `hasChips` variant is what gives the trigger a\n * hittable box when it has to share a flex line with the chips instead of\n * being the whole field.\n */\nconst SelectTrigger: TOC<SelectTriggerSignature> = <template>\n {{#if @isFilterable}}\n {{! The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. }}\n <input\n type=\"text\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if @showChips @accessibleName}}\n placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n value={{@filterValue}}\n {{on \"input\" @onFilterInput}}\n {{on \"keydown\" @onFilterKeydown}}\n {{on \"focusout\" @onFocusOut}}\n />\n {{else}}\n <button\n type=\"button\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if (or @showChips @hasCustomContent) @accessibleName}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n {{on \"keydown\" @onKeydown}}\n {{on \"focusout\" @onFocusOut}}\n >\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText\n @items={{@items}}\n @hasCustomContent={{@hasCustomContent}}\n >\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span\n data-part=\"placeholder\"\n class={{@classes.placeholder class=@userClasses.placeholder}}\n >\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n {{/if}}\n</template>;\n\nexport { SelectTrigger, type SelectTriggerSignature };\nexport default SelectTrigger;\n"],"names":["and","a","b","Boolean","or","valueUnless","condition","value","undefined","SelectTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","on","SelectedText","templateOnly"],"mappings":";;;;;;AAWA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC9D,MAAME,EAAA,GAAKA,CAACH,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC7D,MAAMG,WAAA,GAAcA,CAAKC,SAAkB,EAAEC,KAAO,KAClDD,SAAA,GAAYE,SAAA,GAAYD,KAAA;AA6E1B;;;;;;;;;AASC;AACD,MAAME,aAAmB,GAAAC,oBAAA,CAA0BC,kBAAA,CAAA,2qDAAA,EA8DnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAR,WAAA;IAAAL,GAAA;IAAAc,EAAA;IAAAV,EAAA;AAAAW,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA
|
|
1
|
+
{"version":3,"file":"trigger.js","sources":["../../../../src/components/forms/select/trigger.gts"],"sourcesContent":["import { on } from '@ember/modifier';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ModifierLike } from '@glint/template';\nimport type { SlotsToClasses, SelectSlots } from '@frontile/theme';\nimport { SelectedText } from './selected-items';\nimport type {\n SelectClasses,\n SelectedItem,\n SelectedItemBlockArg\n} from './types';\n\nconst and = (a: unknown, b: unknown) => Boolean(a) && Boolean(b);\nconst or = (a: unknown, b: unknown) => Boolean(a) || Boolean(b);\nconst valueUnless = <T,>(condition: unknown, value: T): T | undefined =>\n condition ? undefined : value;\n\ninterface SelectTriggerSignature {\n Args: {\n /** Whether the trigger is a filter input rather than a button. */\n isFilterable?: boolean;\n\n /** The popover's `trigger` modifier: what opens the dropdown. */\n trigger: ModifierLike<{ Element: HTMLElement }>;\n\n /**\n * Records the trigger element. The field click forwarder and the listbox's\n * keyboard-event host both need the live element.\n */\n triggerRef: ModifierLike<{\n Element: HTMLInputElement | HTMLButtonElement;\n }>;\n\n isDisabled?: boolean;\n showChips: boolean;\n\n /**\n * Names the trigger when its own text cannot.\n *\n * In chips mode the trigger renders no text of its own (the chips are its\n * siblings and are read separately), so without this the combobox would be\n * announced unnamed. The same is true whenever `@hasCustomContent` is set:\n * the block may render nothing readable at all.\n */\n accessibleName: string;\n\n /**\n * Whether the consumer supplied a `:selectedItem` block, i.e. whether the\n * text inside the trigger is theirs rather than the option's label.\n *\n * Two things hang off this: the `<button>` trigger stops trusting its own\n * text content for its accessible name, and {@link SelectedText} switches\n * from the joined string to a per-selection loop. The filterable\n * `<input>` trigger ignores it -- the block never renders there, so the\n * input's own value still names it.\n */\n hasCustomContent?: boolean;\n\n placeholder?: string;\n hasSelection: boolean;\n hasStartContent: boolean;\n\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /** The selection, for the text presentation inside a button trigger. */\n items: SelectedItem[];\n\n /** Current value of the filter input. */\n filterValue: string;\n onFilterInput: (event: Event) => void;\n onFilterKeydown: (event: KeyboardEvent) => void;\n onKeydown: (event: KeyboardEvent) => void;\n\n /**\n * Reports the trigger losing focus, as `focusout` rather than `blur`: the\n * Select decides whether focus actually left the control from the event's\n * `relatedTarget`, and browsers only guarantee that on `focusout`.\n */\n onFocusOut: (event: FocusEvent) => void;\n };\n Blocks: {\n /**\n * Content for one selected option, forwarded straight through to\n * {@link SelectedText}. Always supplied by the Select -- a block cannot be\n * passed conditionally -- so `@hasCustomContent` is what says whether it\n * holds the consumer's markup or the plain-label fallback.\n */\n selectedItem: [SelectedItemBlockArg<never>];\n };\n}\n\n/**\n * The Select's trigger: a filter `<input>` when `@isFilterable`, otherwise a\n * `<button>`.\n *\n * Both carry `data-part=\"input\"` (the Select's own `input` slot -- this is a\n * part of the `select` component, not a component of its own) and the same\n * `input` slot classes, whose `hasChips` variant is what gives the trigger a\n * hittable box when it has to share a flex line with the chips instead of\n * being the whole field.\n */\nconst SelectTrigger: TOC<SelectTriggerSignature> = <template>\n {{#if @isFilterable}}\n {{! The filterable trigger is an input: the selectedItem block cannot\n render here, so the input always has its own value as its accessible text.\n Naming it from the selection as well would duplicate that value and make\n the combobox name change as the user types, so only chips mode, where the\n input shows nothing of the selection, names it. }}\n <input\n type=\"text\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if @showChips @accessibleName}}\n placeholder={{valueUnless (and @showChips @hasSelection) @placeholder}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n value={{@filterValue}}\n {{on \"input\" @onFilterInput}}\n {{on \"keydown\" @onFilterKeydown}}\n {{on \"focusout\" @onFocusOut}}\n />\n {{else}}\n <button\n type=\"button\"\n {{@trigger}}\n {{@triggerRef}}\n data-part=\"input\"\n disabled={{@isDisabled}}\n aria-label={{if (or @showChips @hasCustomContent) @accessibleName}}\n class={{@classes.input\n class=@userClasses.input\n hasStartContent=@hasStartContent\n hasEndContent=true\n hasChips=@showChips\n }}\n {{on \"keydown\" @onKeydown}}\n {{on \"focusout\" @onFocusOut}}\n >\n {{#if @hasSelection}}\n {{#unless @showChips}}\n <SelectedText\n @items={{@items}}\n @hasCustomContent={{@hasCustomContent}}\n >\n <:item as |selected|>{{yield selected to=\"selectedItem\"}}</:item>\n </SelectedText>\n {{/unless}}\n {{else}}\n <span\n data-part=\"placeholder\"\n class={{@classes.placeholder class=@userClasses.placeholder}}\n >\n {{#if @placeholder}}{{@placeholder}}{{else}} {{/if}}\n </span>\n {{/if}}\n </button>\n {{/if}}\n</template>;\n\nexport { SelectTrigger, type SelectTriggerSignature };\nexport default SelectTrigger;\n"],"names":["and","a","b","Boolean","or","valueUnless","condition","value","undefined","SelectTrigger","setComponentTemplate","precompileTemplate","strictMode","scope","on","SelectedText","templateOnly"],"mappings":";;;;;;AAWA,MAAMA,GAAA,GAAMA,CAACC,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC9D,MAAME,EAAA,GAAKA,CAACH,CAAU,EAAEC,CAAU,KAAKC,OAAA,CAAQF,CAAA,CAAA,IAAME,OAAA,CAAQD,CAAA,CAAA;AAC7D,MAAMG,WAAA,GAAcA,CAAKC,SAAkB,EAAEC,KAAO,KAClDD,SAAA,GAAYE,SAAA,GAAYD,KAAA;AA6E1B;;;;;;;;;AASC;AACD,MAAME,aAAmB,GAAAC,oBAAA,CAA0BC,kBAAA,CAAA,2qDAAA,EA8DnD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAR,WAAA;IAAAL,GAAA;IAAAc,EAAA;IAAAV,EAAA;AAAAW,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sources":["../../../src/components/forms/switch.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SwitchVariants,\n type SwitchSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { tracked } from '@ember/-internals/metal';\nimport type Owner from '@ember/owner';\nimport { hash } from '@ember/helper';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Controls the current selected state of the Switch.\n * When provided a boolean value, the component operates in a controlled mode.\n */\n isSelected?: boolean;\n\n /**\n * Sets the initial selected state of the Switch when used in uncontrolled mode.\n * @defaultValue false\n */\n defaultSelected?: boolean;\n\n /**\n * The name attribute for the input element.\n * Useful for form submissions.\n */\n name?: string;\n\n /**\n * The size of the Switch.\n */\n size?: SwitchVariants['size'];\n\n /**\n * The color of the Switch.\n * @defaultValue 'primary'\n */\n color?: SwitchVariants['color'];\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * Custom classes to style different slots of the Switch component.\n */\n classes?: SlotsToClasses<SwitchSlots>;\n\n /**\n * Whether the Switch is disabled.\n * When true, user interaction is prevented.\n */\n isDisabled?: boolean;\n\n /**\n * Callback triggered when the Switch value changes.\n * Receives the new boolean value and, optionally, the triggering Event.\n */\n onChange?:\n ((value: boolean, event: Event) => void) | ((value: boolean) => void);\n\n /**\n * Callback triggered when the Switch loses focus (blur event).\n */\n onBlur?: () => void;\n}\n\ninterface SwitchSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n thumbContent: [{ isSelected: boolean }];\n endContent: [];\n };\n\n Element: HTMLInputElement;\n}\n\nclass Switch extends Component<SwitchSignature> {\n @tracked _isSelected;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n this._isSelected = this.args.defaultSelected ? true : false;\n }\n\n get isControlled(): boolean {\n return typeof this.args.isSelected === 'boolean';\n }\n\n get isSelected(): boolean {\n if (this.isControlled) {\n return !!this.args.isSelected;\n }\n return this._isSelected;\n }\n\n handleChange = (event: Event) => {\n event.preventDefault();\n\n const value = !this.isSelected;\n this._isSelected = value;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n handleBlur = (): void => {\n this.args.onBlur?.();\n };\n\n get classes() {\n const { switchInput } = useStyles();\n return switchInput({\n size: this.args.size,\n color: renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Switch',\n from: 'intent',\n to: 'color',\n id: 'frontile.switch.intent'\n }\n ),\n isDisabled: this.args.isDisabled\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"switch-input\"\n data-part=\"base\"\n data-selected=\"{{this.isSelected}}\"\n data-disabled=\"{{@isDisabled}}\"\n as |c|\n >\n <span\n class={{this.classes.wrapper class=@classes.wrapper}}\n data-part=\"wrapper\"\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isSelected}}\n class={{this.classes.hiddenInput class=@classes.hiddenInput}}\n type=\"checkbox\"\n disabled={{@isDisabled}}\n data-part=\"hidden-input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent class=@classes.startContent}}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span\n class={{this.classes.thumb class=@classes.thumb}}\n data-part=\"thumb\"\n >\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Switch, type SwitchSignature };\nexport default Switch;\n"],"names":["Switch","Component","g","prototype","tracked","i","constructor","owner","args","_isSelected","defaultSelected","isControlled","isSelected","handleChange","event","preventDefault","value","onChange","handleBlur","onBlur","classes","switchInput","useStyles","size","color","renamedArgValue","intent","default","component","from","to","id","isDisabled","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","hash"],"mappings":";;;;;;;;;;;AA2FA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAC5BC,OAAA,CAAA,CAAA;AAAA;EAAA,YAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,aAAA,CAAA,EAAA,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAU,EAAE;AACpC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IAEb,IAAI,CAACC,WAAW,GAAG,IAAI,CAACD,IAAI,CAACE,eAAe,GAAG,IAAA,GAAO,KAAA;AACxD,EAAA;EAEA,IAAIC,YAAAA,GAAwB;AAC1B,IAAA,OAAO,OAAO,IAAI,CAACH,IAAI,CAACI,UAAU,KAAK,SAAA;AACzC,EAAA;EAEA,IAAIA,UAAAA,GAAsB;IACxB,IAAI,IAAI,CAACD,YAAY,EAAE;AACrB,MAAA,OAAO,CAAC,CAAC,IAAI,CAACH,IAAI,CAACI,UAAU;AAC/B,IAAA;IACA,OAAO,IAAI,CAACH,WAAW;AACzB,EAAA;EAEAI,YAAA,GAAgBC,KAAO,IAAA;IACrBA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,KAAA,GAAQ,CAAC,IAAI,CAACJ,UAAU;IAC9B,IAAI,CAACH,WAAW,GAAGO,KAAA;IAEnB,IAAI,OAAO,IAAI,CAACR,IAAI,CAACS,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACT,IAAI,CAACS,QAAQ,CAACD,KAAA,EAAOF,KAAA,CAAA;AAC5B,IAAA;EACF,CAAA;EAEAI,UAAA,GAAaA,MAAQ;AACnB,IAAA,IAAI,CAACV,IAAI,CAACW,MAAM,IAAA;EAClB,CAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAa,GAAGC,SAAA,EAAA;AACxB,IAAA,OAAOD,WAAA,CAAY;AACjBE,MAAAA,IAAA,EAAM,IAAI,CAACf,IAAI,CAACe,IAAI;AACpBC,MAAAA,KAAA,EAAOC,eAAA,CACL,IAAI,CAACjB,IAAI,CAACgB,KAAK,EACf,IAAI,CAAChB,IAAI,CAACkB,MAAM,EAChB;AAAEC,QAAAA,OAAA,EAAS;AAAU,OAAA,EACrB;AACEC,QAAAA,SAAA,EAAW,QAAA;AACXC,QAAAA,IAAA,EAAM,QAAA;AACNC,QAAAA,EAAA,EAAI,OAAA;AACJC,QAAAA,EAAA,EAAI;AACN,OAAA,CAAA;AAEFC,MAAAA,UAAA,EAAY,IAAI,CAACxB,IAAI,CAACwB;AACxB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,o2DAAA,EAgFA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAC,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ
|
|
1
|
+
{"version":3,"file":"switch.js","sources":["../../../src/components/forms/switch.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type SwitchVariants,\n type SwitchSlots,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { tracked } from '@ember/-internals/metal';\nimport type Owner from '@ember/owner';\nimport { hash } from '@ember/helper';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Controls the current selected state of the Switch.\n * When provided a boolean value, the component operates in a controlled mode.\n */\n isSelected?: boolean;\n\n /**\n * Sets the initial selected state of the Switch when used in uncontrolled mode.\n * @defaultValue false\n */\n defaultSelected?: boolean;\n\n /**\n * The name attribute for the input element.\n * Useful for form submissions.\n */\n name?: string;\n\n /**\n * The size of the Switch.\n */\n size?: SwitchVariants['size'];\n\n /**\n * The color of the Switch.\n * @defaultValue 'primary'\n */\n color?: SwitchVariants['color'];\n\n /**\n * @deprecated Use `color`. `default` is now `neutral`.\n */\n intent?:\n | 'default'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\n\n /**\n * Custom classes to style different slots of the Switch component.\n */\n classes?: SlotsToClasses<SwitchSlots>;\n\n /**\n * Whether the Switch is disabled.\n * When true, user interaction is prevented.\n */\n isDisabled?: boolean;\n\n /**\n * Callback triggered when the Switch value changes.\n * Receives the new boolean value and, optionally, the triggering Event.\n */\n onChange?:\n ((value: boolean, event: Event) => void) | ((value: boolean) => void);\n\n /**\n * Callback triggered when the Switch loses focus (blur event).\n */\n onBlur?: () => void;\n}\n\ninterface SwitchSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n thumbContent: [{ isSelected: boolean }];\n endContent: [];\n };\n\n Element: HTMLInputElement;\n}\n\nclass Switch extends Component<SwitchSignature> {\n @tracked _isSelected;\n\n constructor(owner: Owner, args: Args) {\n super(owner, args);\n\n this._isSelected = this.args.defaultSelected ? true : false;\n }\n\n get isControlled(): boolean {\n return typeof this.args.isSelected === 'boolean';\n }\n\n get isSelected(): boolean {\n if (this.isControlled) {\n return !!this.args.isSelected;\n }\n return this._isSelected;\n }\n\n handleChange = (event: Event) => {\n event.preventDefault();\n\n const value = !this.isSelected;\n this._isSelected = value;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n handleBlur = (): void => {\n this.args.onBlur?.();\n };\n\n get classes() {\n const { switchInput } = useStyles();\n return switchInput({\n size: this.args.size,\n color: renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Switch',\n from: 'intent',\n to: 'color',\n id: 'frontile.switch.intent'\n }\n ),\n isDisabled: this.args.isDisabled\n });\n }\n\n <template>\n <FormControl\n @isInvalid={{@isInvalid}}\n @errors={{@errors}}\n @size={{@size}}\n @isRequired={{@isRequired}}\n @class={{this.classes.base class=@classes.base}}\n @preventErrorFeedback={{true}}\n data-component=\"switch-input\"\n data-part=\"base\"\n data-selected=\"{{this.isSelected}}\"\n data-disabled=\"{{@isDisabled}}\"\n as |c|\n >\n <span\n class={{this.classes.wrapper class=@classes.wrapper}}\n data-part=\"wrapper\"\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isSelected}}\n class={{this.classes.hiddenInput class=@classes.hiddenInput}}\n type=\"checkbox\"\n disabled={{@isDisabled}}\n data-part=\"hidden-input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent class=@classes.startContent}}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n\n <span\n class={{this.classes.thumb class=@classes.thumb}}\n data-part=\"thumb\"\n >\n {{#if (has-block \"thumbContent\")}}\n {{yield (hash isSelected=this.isSelected) to=\"thumbContent\"}}\n {{/if}}\n\n </span>\n {{#if (has-block \"endContent\")}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent class=@classes.endContent}}\n >\n {{yield to=\"endContent\"}}\n </div>\n {{/if}}\n </span>\n\n <div\n class={{this.classes.labelContainer class=@classes.labelContainer}}\n data-part=\"label-container\"\n >\n {{#if @label}}\n <c.Label\n @class={{this.classes.label class=@classes.label}}\n data-part=\"label\"\n >\n {{@label}}\n </c.Label>\n {{/if}}\n {{#if @description}}\n <c.Description>{{@description}}</c.Description>\n {{/if}}\n {{#if c.isInvalid}}\n <c.Feedback />\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Switch, type SwitchSignature };\nexport default Switch;\n"],"names":["Switch","Component","g","prototype","tracked","i","constructor","owner","args","_isSelected","defaultSelected","isControlled","isSelected","handleChange","event","preventDefault","value","onChange","handleBlur","onBlur","classes","switchInput","useStyles","size","color","renamedArgValue","intent","default","component","from","to","id","isDisabled","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","hash"],"mappings":";;;;;;;;;;;AA2FA,MAAMA,eAAeC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAC5BC,OAAA,CAAA,CAAA;AAAA;EAAA,YAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,aAAA,CAAA,EAAA,MAAA;AAEDC,EAAAA,WAAAA,CAAYC,KAAY,EAAEC,IAAU,EAAE;AACpC,IAAA,KAAK,CAACD,KAAA,EAAOC,IAAA,CAAA;IAEb,IAAI,CAACC,WAAW,GAAG,IAAI,CAACD,IAAI,CAACE,eAAe,GAAG,IAAA,GAAO,KAAA;AACxD,EAAA;EAEA,IAAIC,YAAAA,GAAwB;AAC1B,IAAA,OAAO,OAAO,IAAI,CAACH,IAAI,CAACI,UAAU,KAAK,SAAA;AACzC,EAAA;EAEA,IAAIA,UAAAA,GAAsB;IACxB,IAAI,IAAI,CAACD,YAAY,EAAE;AACrB,MAAA,OAAO,CAAC,CAAC,IAAI,CAACH,IAAI,CAACI,UAAU;AAC/B,IAAA;IACA,OAAO,IAAI,CAACH,WAAW;AACzB,EAAA;EAEAI,YAAA,GAAgBC,KAAO,IAAA;IACrBA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,KAAA,GAAQ,CAAC,IAAI,CAACJ,UAAU;IAC9B,IAAI,CAACH,WA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