frontile 0.18.1 → 0.18.3

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.
Files changed (151) hide show
  1. package/declarations/-private/get-config.d.ts.map +1 -1
  2. package/declarations/-private/timer.d.ts +3 -3
  3. package/declarations/-private/timer.d.ts.map +1 -1
  4. package/declarations/components/buttons/close-button.d.ts +2 -2
  5. package/declarations/components/buttons/close-button.d.ts.map +1 -1
  6. package/declarations/components/collections/calendar/calendar.d.ts +7 -1
  7. package/declarations/components/collections/calendar/calendar.d.ts.map +1 -1
  8. package/declarations/components/collections/calendar/header.d.ts +2 -0
  9. package/declarations/components/collections/calendar/header.d.ts.map +1 -1
  10. package/declarations/components/collections/calendar/types.d.ts +15 -0
  11. package/declarations/components/collections/calendar/types.d.ts.map +1 -1
  12. package/declarations/components/collections/calendar/year-grid.d.ts +2 -0
  13. package/declarations/components/collections/calendar/year-grid.d.ts.map +1 -1
  14. package/declarations/components/collections/listbox/item.d.ts +2 -2
  15. package/declarations/components/collections/listbox/item.d.ts.map +1 -1
  16. package/declarations/components/collections/simple-table/column.d.ts +6 -0
  17. package/declarations/components/collections/simple-table/column.d.ts.map +1 -1
  18. package/declarations/components/collections/simple-table/footer.d.ts +2 -1
  19. package/declarations/components/collections/simple-table/footer.d.ts.map +1 -1
  20. package/declarations/components/collections/simple-table/header.d.ts +2 -1
  21. package/declarations/components/collections/simple-table/header.d.ts.map +1 -1
  22. package/declarations/components/collections/simple-table/index.d.ts +1 -1
  23. package/declarations/components/collections/simple-table/index.d.ts.map +1 -1
  24. package/declarations/components/collections/table/checkbox.d.ts +1 -1
  25. package/declarations/components/collections/table/checkbox.d.ts.map +1 -1
  26. package/declarations/components/collections/table/column-visibility.d.ts +2 -2
  27. package/declarations/components/collections/table/column-visibility.d.ts.map +1 -1
  28. package/declarations/components/collections/table/table.d.ts +9 -7
  29. package/declarations/components/collections/table/table.d.ts.map +1 -1
  30. package/declarations/components/forms/checkbox.d.ts +2 -2
  31. package/declarations/components/forms/checkbox.d.ts.map +1 -1
  32. package/declarations/components/forms/date-input/clipboard.d.ts.map +1 -1
  33. package/declarations/components/forms/date-input/date-input.d.ts +5 -2
  34. package/declarations/components/forms/date-input/date-input.d.ts.map +1 -1
  35. package/declarations/components/forms/date-input/segment-group.d.ts +2 -0
  36. package/declarations/components/forms/date-input/segment-group.d.ts.map +1 -1
  37. package/declarations/components/forms/date-input/segments.d.ts +30 -4
  38. package/declarations/components/forms/date-input/segments.d.ts.map +1 -1
  39. package/declarations/components/forms/date-input/types.d.ts +60 -5
  40. package/declarations/components/forms/date-input/types.d.ts.map +1 -1
  41. package/declarations/components/forms/date-picker/date-picker.d.ts +19 -2
  42. package/declarations/components/forms/date-picker/date-picker.d.ts.map +1 -1
  43. package/declarations/components/forms/date-picker/end-content.d.ts +3 -1
  44. package/declarations/components/forms/date-picker/end-content.d.ts.map +1 -1
  45. package/declarations/components/forms/date-picker/types.d.ts +42 -4
  46. package/declarations/components/forms/date-picker/types.d.ts.map +1 -1
  47. package/declarations/components/forms/date-picker/value.d.ts +21 -5
  48. package/declarations/components/forms/date-picker/value.d.ts.map +1 -1
  49. package/declarations/components/forms/field.d.ts +4 -5
  50. package/declarations/components/forms/field.d.ts.map +1 -1
  51. package/declarations/components/forms/form.d.ts +5 -5
  52. package/declarations/components/forms/form.d.ts.map +1 -1
  53. package/declarations/components/forms/input-otp.d.ts +5 -5
  54. package/declarations/components/forms/input-otp.d.ts.map +1 -1
  55. package/declarations/components/forms/input.d.ts +4 -4
  56. package/declarations/components/forms/input.d.ts.map +1 -1
  57. package/declarations/components/forms/native-select.d.ts +2 -2
  58. package/declarations/components/forms/native-select.d.ts.map +1 -1
  59. package/declarations/components/forms/radio.d.ts +2 -2
  60. package/declarations/components/forms/radio.d.ts.map +1 -1
  61. package/declarations/components/forms/textarea.d.ts +3 -3
  62. package/declarations/components/forms/textarea.d.ts.map +1 -1
  63. package/declarations/components/navigation/pagination/pagination.d.ts +32 -1
  64. package/declarations/components/navigation/pagination/pagination.d.ts.map +1 -1
  65. package/declarations/components/overlays/overlay.d.ts +4 -4
  66. package/declarations/components/overlays/overlay.d.ts.map +1 -1
  67. package/declarations/components/utilities/avatar.d.ts +1 -1
  68. package/declarations/components/utilities/avatar.d.ts.map +1 -1
  69. package/declarations/components/utilities/collapsible.d.ts +16 -0
  70. package/declarations/components/utilities/collapsible.d.ts.map +1 -1
  71. package/declarations/utils/forms-utils-index.d.ts +1 -1
  72. package/declarations/utils/forms-utils-index.d.ts.map +1 -1
  73. package/declarations/utils/nested-data.d.ts +17 -0
  74. package/declarations/utils/nested-data.d.ts.map +1 -1
  75. package/dist/components/buttons/close-button.js +5 -12
  76. package/dist/components/buttons/close-button.js.map +1 -1
  77. package/dist/components/collections/calendar/calendar.js +13 -1
  78. package/dist/components/collections/calendar/calendar.js.map +1 -1
  79. package/dist/components/collections/calendar/header.js +1 -1
  80. package/dist/components/collections/calendar/header.js.map +1 -1
  81. package/dist/components/collections/calendar/year-grid.js +1 -1
  82. package/dist/components/collections/calendar/year-grid.js.map +1 -1
  83. package/dist/components/collections/listbox/item.js +4 -11
  84. package/dist/components/collections/listbox/item.js.map +1 -1
  85. package/dist/components/collections/simple-table/column.js +2 -2
  86. package/dist/components/collections/simple-table/column.js.map +1 -1
  87. package/dist/components/collections/simple-table/footer.js +1 -1
  88. package/dist/components/collections/simple-table/footer.js.map +1 -1
  89. package/dist/components/collections/simple-table/header.js +1 -1
  90. package/dist/components/collections/simple-table/header.js.map +1 -1
  91. package/dist/components/collections/simple-table/index.js +1 -1
  92. package/dist/components/collections/simple-table/index.js.map +1 -1
  93. package/dist/components/collections/table/checkbox.js +2 -7
  94. package/dist/components/collections/table/checkbox.js.map +1 -1
  95. package/dist/components/collections/table/column-visibility.js +2 -7
  96. package/dist/components/collections/table/column-visibility.js.map +1 -1
  97. package/dist/components/forms/checkbox.js +4 -12
  98. package/dist/components/forms/checkbox.js.map +1 -1
  99. package/dist/components/forms/date-input/clipboard.js +74 -5
  100. package/dist/components/forms/date-input/clipboard.js.map +1 -1
  101. package/dist/components/forms/date-input/date-input.js +24 -5
  102. package/dist/components/forms/date-input/date-input.js.map +1 -1
  103. package/dist/components/forms/date-input/segment-group.js +26 -5
  104. package/dist/components/forms/date-input/segment-group.js.map +1 -1
  105. package/dist/components/forms/date-input/segments.js +203 -20
  106. package/dist/components/forms/date-input/segments.js.map +1 -1
  107. package/dist/components/forms/date-input.js +1 -1
  108. package/dist/components/forms/date-picker/date-picker.js +76 -11
  109. package/dist/components/forms/date-picker/date-picker.js.map +1 -1
  110. package/dist/components/forms/date-picker/end-content.js +1 -3
  111. package/dist/components/forms/date-picker/end-content.js.map +1 -1
  112. package/dist/components/forms/date-picker/value.js +44 -6
  113. package/dist/components/forms/date-picker/value.js.map +1 -1
  114. package/dist/components/forms/field.js +8 -19
  115. package/dist/components/forms/field.js.map +1 -1
  116. package/dist/components/forms/form.js +11 -27
  117. package/dist/components/forms/form.js.map +1 -1
  118. package/dist/components/forms/index.js +3 -3
  119. package/dist/components/forms/input-otp.js +10 -26
  120. package/dist/components/forms/input-otp.js.map +1 -1
  121. package/dist/components/forms/input.js +9 -22
  122. package/dist/components/forms/input.js.map +1 -1
  123. package/dist/components/forms/native-select.js +5 -12
  124. package/dist/components/forms/native-select.js.map +1 -1
  125. package/dist/components/forms/radio.js +4 -12
  126. package/dist/components/forms/radio.js.map +1 -1
  127. package/dist/components/forms/textarea.js +6 -17
  128. package/dist/components/forms/textarea.js.map +1 -1
  129. package/dist/components/navigation/pagination/pagination.js +18 -2
  130. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  131. package/dist/components/notifications/index.js +1 -1
  132. package/dist/components/overlays/overlay.js +8 -21
  133. package/dist/components/overlays/overlay.js.map +1 -1
  134. package/dist/components/utilities/avatar.js +3 -7
  135. package/dist/components/utilities/avatar.js.map +1 -1
  136. package/dist/components/utilities/collapsible.js +47 -3
  137. package/dist/components/utilities/collapsible.js.map +1 -1
  138. package/dist/forms.js +3 -3
  139. package/dist/index.js +4 -4
  140. package/dist/{manager-jDaRVZ5o.js → manager-Dge4r8Vn.js} +9 -19
  141. package/dist/manager-Dge4r8Vn.js.map +1 -0
  142. package/dist/notifications.js +1 -1
  143. package/dist/services/notifications.js +1 -1
  144. package/dist/test-support.js +400 -365
  145. package/dist/test-support.js.map +1 -1
  146. package/dist/utils/forms-utils-index.js +1 -1
  147. package/dist/utils/forms-utils-index.js.map +1 -1
  148. package/dist/utils/nested-data.js +28 -1
  149. package/dist/utils/nested-data.js.map +1 -1
  150. package/package.json +10 -10
  151. package/dist/manager-jDaRVZ5o.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"item.js","sources":["../../../../src/components/collections/listbox/item.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { assert } from '@ember/debug';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\nimport { Divider } from '../../utilities/divider';\nimport { Kbd } from '../../utilities/kbd';\nimport type { KbdSignature } from '../../utilities/kbd';\nimport { guidFor } from '@ember/object/internals';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ListManager, ListItem } from '../../../utils/listManager';\nimport { renamedArgValue } from '../../../-private/deprecated-args';\n\nexport interface ListboxItemSignature {\n Args: {\n manager: ListManager;\n key: string;\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 description?: string;\n\n /**\n * A keyboard shortcut shown at the end of the option, rendered by `Kbd`.\n * Accepts named keys (`\"mod+k\"`) or a literal string (`\"⌘K\"`).\n */\n shortcut?: string;\n\n /**\n * The variant of the rendered shortcut. Defaults to `inherit`, so the\n * keycap follows the option's own colour on active and filled rows.\n *\n * @defaultValue 'inherit'\n */\n shortcutVariant?: KbdSignature['Args']['variant'];\n onClick?: () => void;\n class?: string;\n withDivider?: boolean;\n\n /**\n * The variant of each item.\n *\n * @defaultValue 'solid'\n */\n variant?: 'solid' | 'outline' | 'subtle';\n\n /**\n * @deprecated Use `variant`. `default` is now `solid`, `outlined` is\n * `outline`, and `faded` is `subtle`.\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The color of each item\n */\n color?:\n | 'neutral'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\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 type?: 'menu' | 'listbox';\n\n /**\n * Marks this option as the trigger for a submenu.\n *\n * It stops the option selecting: opening a submenu is not choosing\n * anything, so `onAction` and `onSelectionChange` must not fire for it.\n * The option still registers with the `ListManager` and so still takes\n * part in arrow navigation, type-ahead and the roving tab stop.\n *\n * Renders `aria-haspopup=\"menu\"` and a trailing chevron, unless an `:end`\n * block supplies its own trailing content.\n */\n hasSubmenu?: boolean;\n\n /**\n * Whether this option's submenu is currently open. Only meaningful\n * alongside `@hasSubmenu`; drives `aria-expanded` and the highlighted\n * resting state via `data-submenu-open`.\n */\n isSubmenuOpen?: boolean;\n\n /**\n * The id of the `role=\"menu\"` element this option opens, for\n * `aria-controls`. Only meaningful alongside `@hasSubmenu`.\n */\n submenuId?: string;\n };\n Element: HTMLLIElement;\n Blocks: {\n default: [];\n selectedIcon: [];\n start: [];\n end: [];\n };\n}\n\nclass ListboxItem extends Component<ListboxItemSignature> {\n // Stable element id so consumers (e.g. Autocomplete) can reference the\n // option via aria-activedescendant.\n itemId = `${guidFor(this)}-option`;\n labelId = guidFor(this);\n @tracked listItem?: ListItem;\n\n get manager(): ListManager {\n assert(\n `ListboxItem 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 assert(\n `Argument @key is undefined or null, @key must be provided in Listbox.Item component`,\n this.args.key\n );\n\n return this.args.key;\n }\n\n @action\n onRegister(item: ListItem) {\n this.listItem = item;\n }\n\n @action\n onClick(): void {\n if (this.listItem?.isDisabled) {\n return;\n }\n\n // Opening a submenu is not choosing anything, so a sub-trigger must not\n // reach `selectItem` -- that is what fires `onAction` and\n // `onSelectionChange`. It still registers as an item, so arrow\n // navigation, type-ahead and the roving tab stop are unaffected.\n if (!this.args.hasSubmenu) {\n this.manager.selectItem(this.listItem);\n }\n\n if (typeof this.args.onClick === 'function') {\n this.args.onClick();\n }\n }\n\n /**\n * A roving tabindex: the manager nominates one option as the composite's tab\n * stop and every other option stays out of the tab order, as the ARIA\n * listbox pattern requires. Giving a `0` to each active *or selected* option\n * turned a multi-select with eight selections into eight tab stops.\n */\n get tabindex() {\n return this.manager.isTabStop(this.key) ? 0 : -1;\n }\n\n /**\n * Resolved once per render (`@cached`) so referencing it from both\n * `classNames` and `submenuIndicatorClass` does not fire the deprecation\n * twice for the same item.\n */\n @cached\n get variant(): 'solid' | 'outline' | 'subtle' {\n return (\n renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'subtle' } as const,\n {\n component: 'Listbox',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.listbox.appearance'\n }\n ) || 'solid'\n );\n }\n\n /**\n * Resolved once per render (`@cached`) so referencing it from both\n * `classNames` and `submenuIndicatorClass` does not fire the deprecation\n * twice for the same item.\n */\n @cached\n get color(): NonNullable<ListboxItemSignature['Args']['color']> {\n return (\n renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Listbox',\n from: 'intent',\n to: 'color',\n id: 'frontile.listbox.intent'\n }\n ) || 'neutral'\n );\n }\n\n get classNames() {\n const { listboxItem } = useStyles();\n\n const { base, descriptionWrapper, label, description, selectedIcon } =\n listboxItem({\n variant: this.variant,\n color: this.color,\n isDisabled: this.listItem?.isDisabled,\n isSelected: this.listItem?.isSelected,\n isActive: this.listItem?.isActive,\n withDivider: this.args.withDivider\n });\n\n return {\n base: base({ class: this.args.class }),\n descriptionWrapper: descriptionWrapper(),\n label: label(),\n description: description(),\n selectedIcon: selectedIcon()\n };\n }\n\n /**\n * The `submenuIndicator` slot is only ever rendered on a sub-trigger, so it\n * is looked up here rather than in `classNames`, and only when\n * `@hasSubmenu` is set — a plain item never pays for it.\n *\n * `registerCustomStyles` (`packages/theme/src/index.ts`) shallow-replaces:\n * a consumer supplying their own `listboxItem` via `tv({...})` swaps out\n * the whole config, not just the slots they mention. `tv()` in turn only\n * produces a function for a slot it was actually given. So a third-party\n * override written before this slot existed has no `submenuIndicator` key\n * at all, and calling it would throw. A published component library must\n * not crash a consumer's app over a stale override, so this stays\n * defensive — but the check now only runs for sub-triggers, not for every\n * item on every render.\n */\n get submenuIndicatorClass(): string | undefined {\n if (!this.args.hasSubmenu) {\n return undefined;\n }\n\n const { listboxItem } = useStyles();\n const { submenuIndicator } = listboxItem({\n variant: this.variant,\n color: this.color,\n isDisabled: this.listItem?.isDisabled,\n isSelected: this.listItem?.isSelected,\n isActive: this.listItem?.isActive,\n withDivider: this.args.withDivider\n });\n\n return typeof submenuIndicator === 'function'\n ? submenuIndicator()\n : undefined;\n }\n\n get shortcutVariant() {\n return this.args.shortcutVariant ?? 'inherit';\n }\n\n /**\n * Whether this row carries selection state of its own.\n *\n * A row that opens a submenu never does, whatever the level selects:\n * activating it reveals another menu rather than toggling a value. Both\n * `role` and `ariaChecked` hang off this one question, so they cannot\n * disagree about it.\n */\n get isCheckableMenuRow(): boolean {\n return (\n this.args.type === 'menu' &&\n !this.args.hasSubmenu &&\n this.manager.selectionMode !== 'none'\n );\n }\n\n get role() {\n if (this.args.type !== 'menu') {\n return 'option';\n }\n\n if (!this.isCheckableMenuRow) {\n return 'menuitem';\n }\n\n return this.manager.selectionMode === 'multiple'\n ? 'menuitemcheckbox'\n : 'menuitemradio';\n }\n\n /**\n * `aria-selected` belongs on `option`, and only there — a plain `menuitem`\n * that carries it is invalid ARIA, since menu items convey state through\n * `aria-checked` and only as `menuitemcheckbox`/`menuitemradio`. Returning\n * undefined omits the attribute rather than rendering an empty one.\n */\n get ariaSelected(): 'true' | 'false' | undefined {\n return this.role === 'option' ? this.selectedState : undefined;\n }\n\n /** Selection as an ARIA attribute value, for whichever attribute carries it. */\n private get selectedState(): 'true' | 'false' {\n return this.listItem?.isSelected ? 'true' : 'false';\n }\n\n /**\n * The menu counterpart to `aria-selected`.\n *\n * Rendered only for the two checkable menu roles: `aria-checked` on a plain\n * `menuitem` is invalid ARIA, and a checkable row that omits it announces no\n * state at all, which is how a selectable menu ends up sounding identical to\n * a list of commands.\n */\n get ariaChecked(): 'true' | 'false' | undefined {\n return this.isCheckableMenuRow ? this.selectedState : undefined;\n }\n\n /**\n * `aria-haspopup=\"menu\"` rather than the bare `\"true\"`: both are valid, but\n * the explicit role tells a screen reader what is about to open.\n */\n get ariaHasPopup(): 'menu' | undefined {\n return this.args.hasSubmenu ? 'menu' : undefined;\n }\n\n /**\n * Only a row that owns a popup has an expanded state. Rendering\n * `aria-expanded` on a plain `menuitem` would be invalid ARIA, so this is\n * undefined -- and therefore omitted -- unless `@hasSubmenu` is set.\n */\n /**\n * `aria-expanded` and `data-submenu-open` share this same value — one is\n * the ARIA state for assistive tech, the other a styling hook for the\n * template's own resting/hover state — so both getters delegate here.\n */\n get submenuOpenState(): 'true' | 'false' | undefined {\n if (!this.args.hasSubmenu) {\n return undefined;\n }\n return this.args.isSubmenuOpen ? 'true' : 'false';\n }\n\n get ariaExpanded(): 'true' | 'false' | undefined {\n return this.submenuOpenState;\n }\n\n get dataSubmenuOpen(): 'true' | 'false' | undefined {\n return this.submenuOpenState;\n }\n\n <template>\n <li\n {{this.manager.setupItem\n key=this.key\n textValue=@textValue\n item=@item\n onRegister=this.onRegister\n }}\n {{on \"click\" this.onClick}}\n id={{this.itemId}}\n role={{this.role}}\n aria-labelledby={{this.labelId}}\n aria-selected={{this.ariaSelected}}\n aria-checked={{this.ariaChecked}}\n aria-haspopup={{this.ariaHasPopup}}\n aria-expanded={{this.ariaExpanded}}\n aria-controls={{if @hasSubmenu @submenuId}}\n data-submenu-open={{this.dataSubmenuOpen}}\n tabindex={{this.tabindex}}\n data-active=\"{{this.listItem.isActive}}\"\n data-selected=\"{{this.listItem.isSelected}}\"\n data-component=\"listbox-item\"\n data-part=\"base\"\n data-key={{this.key}}\n aria-disabled={{if this.listItem.isDisabled \"true\"}}\n class={{this.classNames.base}}\n ...attributes\n >\n {{yield to=\"start\"}}\n\n {{#if @description}}\n <div\n data-part=\"description-wrapper\"\n class={{this.classNames.descriptionWrapper}}\n >\n <span\n data-part=\"label\"\n class={{this.classNames.label}}\n id={{this.labelId}}\n >{{yield}}</span>\n <span\n data-part=\"description\"\n class={{this.classNames.description}}\n >{{@description}}</span>\n </div>\n {{else}}\n <span\n data-part=\"label\"\n class={{this.classNames.label}}\n id={{this.labelId}}\n >{{yield}}</span>\n {{/if}}\n\n {{#if @shortcut}}\n <Kbd\n @keys={{@shortcut}}\n @size=\"sm\"\n @variant={{this.shortcutVariant}}\n data-test-id=\"listbox-item-shortcut\"\n />\n {{/if}}\n\n {{#if this.listItem.isSelected}}\n <span data-part=\"selected-icon\" class={{this.classNames.selectedIcon}}>\n {{#if (has-block \"selectedIcon\")}}\n {{yield to=\"selectedIcon\"}}\n {{else}}\n <CheckIcon class=\"h-full w-full\" />\n {{/if}}\n </span>\n {{/if}}\n\n {{#if @hasSubmenu}}\n {{#unless (has-block \"end\")}}\n <span\n data-part=\"submenu-indicator\"\n class={{this.submenuIndicatorClass}}\n >\n <ChevronRightIcon class=\"h-full w-full\" />\n </span>\n {{/unless}}\n {{/if}}\n\n {{yield to=\"end\"}}\n </li>\n {{#if @withDivider}}\n <Divider @as=\"li\" />\n {{/if}}\n </template>\n}\n\nconst CheckIcon: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"m4.5 12.75 6 6 9-13.5\"\n />\n </svg>\n</template>;\n\nconst ChevronRightIcon: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"m8.25 4.5 7.5 7.5-7.5 7.5\"\n />\n </svg>\n</template>;\n\nexport { ListboxItem };\n"],"names":["ListboxItem","Component","itemId","guidFor","labelId","g","prototype","tracked","i","manager","assert","args","key","onRegister","item","listItem","n","action","onClick","isDisabled","hasSubmenu","selectItem","tabindex","isTabStop","variant","renamedArgValue","appearance","default","outlined","faded","component","from","to","id","cached","color","intent","classNames","listboxItem","useStyles","base","descriptionWrapper","label","description","selectedIcon","isSelected","isActive","withDivider","class","submenuIndicatorClass","undefined","submenuIndicator","shortcutVariant","isCheckableMenuRow","type","selectionMode","role","ariaSelected","selectedState","ariaChecked","ariaHasPopup","submenuOpenState","isSubmenuOpen","ariaExpanded","dataSubmenuOpen","setComponentTemplate","precompileTemplate","strictMode","scope","on","Kbd","CheckIcon","ChevronRightIcon","Divider","templateOnly"],"mappings":";;;;;;;;;;;;;;;AAwHA,MAAMA,oBAAoBC,SAAA,CAAU;AAClC;AACA;AACAC,EAAAA,MAAA,GAAS,CAAA,EAAGC,OAAA,CAAQ,IAAI,CAAA,CAAA,OAAA,CAAU;AAClCC,EAAAA,OAAA,GAAUD,OAAA,CAAQ,IAAI,CAAA;AAAE,EAAA;IAAAE,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,UAAA,EAAA,CACvBC,OAAA,CAAA,CAAA;AAAA;EAAA,SAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,UAAA,CAAA,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AA,GAA6C;IAC/C,OAAO,IAAI,CAACF,gBAAgB;AAC9B,EAAA;EAEA,IAAIG,eAAAA,GAAgD;IAClD,OAAO,IAAI,CAACH,gBAAgB;AAC9B,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,w8DAAA,EAwFA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAEA,MAAMF,SAED,GAAAN,oBAAA,CAAAC,kBAAA,CAAA,8OAAA,EAeL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAO,YAAA,EAAA,CAAA;AAEV,MAAMF,gBAED,GAAAP,oBAAA,CAAAC,kBAAA,CAAA,kPAAA,EAeL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAO,YAAA,EAAA,CAAA;;"}
1
+ {"version":3,"file":"item.js","sources":["../../../../src/components/collections/listbox/item.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked, cached } from '@glimmer/tracking';\nimport { assert } from '@ember/debug';\nimport { on } from '@ember/modifier';\nimport { useStyles } from '@frontile/theme';\nimport { Divider } from '../../utilities/divider';\nimport { Kbd } from '../../utilities/kbd';\nimport type { KbdSignature } from '../../utilities/kbd';\nimport { guidFor } from '@ember/object/internals';\nimport type { TOC } from '@ember/component/template-only';\nimport type { ListManager, ListItem } from '../../../utils/listManager';\nimport { renamedArgValue } from '../../../-private/deprecated-args';\n\nexport interface ListboxItemSignature {\n Args: {\n manager: ListManager;\n key: string;\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 description?: string;\n\n /**\n * A keyboard shortcut shown at the end of the option, rendered by `Kbd`.\n * Accepts named keys (`\"mod+k\"`) or a literal string (`\"⌘K\"`).\n */\n shortcut?: string;\n\n /**\n * The variant of the rendered shortcut. Defaults to `inherit`, so the\n * keycap follows the option's own colour on active and filled rows.\n *\n * @defaultValue 'inherit'\n */\n shortcutVariant?: KbdSignature['Args']['variant'];\n onClick?: () => void;\n class?: string;\n withDivider?: boolean;\n\n /**\n * The variant of each item.\n *\n * @defaultValue 'solid'\n */\n variant?: 'solid' | 'outline' | 'subtle';\n\n /**\n * @deprecated Use `variant`. `default` is now `solid`, `outlined` is\n * `outline`, and `faded` is `subtle`.\n */\n appearance?: 'default' | 'outlined' | 'faded';\n\n /**\n * The color of each item\n */\n color?:\n | 'neutral'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'warning'\n | 'danger';\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 type?: 'menu' | 'listbox';\n\n /**\n * Marks this option as the trigger for a submenu.\n *\n * It stops the option selecting: opening a submenu is not choosing\n * anything, so `onAction` and `onSelectionChange` must not fire for it.\n * The option still registers with the `ListManager` and so still takes\n * part in arrow navigation, type-ahead and the roving tab stop.\n *\n * Renders `aria-haspopup=\"menu\"` and a trailing chevron, unless an `:end`\n * block supplies its own trailing content.\n */\n hasSubmenu?: boolean;\n\n /**\n * Whether this option's submenu is currently open. Only meaningful\n * alongside `@hasSubmenu`; drives `aria-expanded` and the highlighted\n * resting state via `data-submenu-open`.\n */\n isSubmenuOpen?: boolean;\n\n /**\n * The id of the `role=\"menu\"` element this option opens, for\n * `aria-controls`. Only meaningful alongside `@hasSubmenu`.\n */\n submenuId?: string;\n };\n Element: HTMLLIElement;\n Blocks: {\n default: [];\n selectedIcon: [];\n start: [];\n end: [];\n };\n}\n\nclass ListboxItem extends Component<ListboxItemSignature> {\n // Stable element id so consumers (e.g. Autocomplete) can reference the\n // option via aria-activedescendant.\n itemId = `${guidFor(this)}-option`;\n labelId = guidFor(this);\n @tracked listItem?: ListItem;\n\n get manager(): ListManager {\n assert(\n `ListboxItem 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 assert(\n `Argument @key is undefined or null, @key must be provided in Listbox.Item component`,\n this.args.key\n );\n\n return this.args.key;\n }\n\n onRegister = (item: ListItem) => {\n this.listItem = item;\n };\n\n onClick = (): void => {\n if (this.listItem?.isDisabled) {\n return;\n }\n\n // Opening a submenu is not choosing anything, so a sub-trigger must not\n // reach `selectItem` -- that is what fires `onAction` and\n // `onSelectionChange`. It still registers as an item, so arrow\n // navigation, type-ahead and the roving tab stop are unaffected.\n if (!this.args.hasSubmenu) {\n this.manager.selectItem(this.listItem);\n }\n\n if (typeof this.args.onClick === 'function') {\n this.args.onClick();\n }\n };\n\n /**\n * A roving tabindex: the manager nominates one option as the composite's tab\n * stop and every other option stays out of the tab order, as the ARIA\n * listbox pattern requires. Giving a `0` to each active *or selected* option\n * turned a multi-select with eight selections into eight tab stops.\n */\n get tabindex() {\n return this.manager.isTabStop(this.key) ? 0 : -1;\n }\n\n /**\n * Resolved once per render (`@cached`) so referencing it from both\n * `classNames` and `submenuIndicatorClass` does not fire the deprecation\n * twice for the same item.\n */\n @cached\n get variant(): 'solid' | 'outline' | 'subtle' {\n return (\n renamedArgValue(\n this.args.variant,\n this.args.appearance,\n { default: 'solid', outlined: 'outline', faded: 'subtle' } as const,\n {\n component: 'Listbox',\n from: 'appearance',\n to: 'variant',\n id: 'frontile.listbox.appearance'\n }\n ) || 'solid'\n );\n }\n\n /**\n * Resolved once per render (`@cached`) so referencing it from both\n * `classNames` and `submenuIndicatorClass` does not fire the deprecation\n * twice for the same item.\n */\n @cached\n get color(): NonNullable<ListboxItemSignature['Args']['color']> {\n return (\n renamedArgValue(\n this.args.color,\n this.args.intent,\n { default: 'neutral' } as const,\n {\n component: 'Listbox',\n from: 'intent',\n to: 'color',\n id: 'frontile.listbox.intent'\n }\n ) || 'neutral'\n );\n }\n\n get classNames() {\n const { listboxItem } = useStyles();\n\n const { base, descriptionWrapper, label, description, selectedIcon } =\n listboxItem({\n variant: this.variant,\n color: this.color,\n isDisabled: this.listItem?.isDisabled,\n isSelected: this.listItem?.isSelected,\n isActive: this.listItem?.isActive,\n withDivider: this.args.withDivider\n });\n\n return {\n base: base({ class: this.args.class }),\n descriptionWrapper: descriptionWrapper(),\n label: label(),\n description: description(),\n selectedIcon: selectedIcon()\n };\n }\n\n /**\n * The `submenuIndicator` slot is only ever rendered on a sub-trigger, so it\n * is looked up here rather than in `classNames`, and only when\n * `@hasSubmenu` is set — a plain item never pays for it.\n *\n * `registerCustomStyles` (`packages/theme/src/index.ts`) shallow-replaces:\n * a consumer supplying their own `listboxItem` via `tv({...})` swaps out\n * the whole config, not just the slots they mention. `tv()` in turn only\n * produces a function for a slot it was actually given. So a third-party\n * override written before this slot existed has no `submenuIndicator` key\n * at all, and calling it would throw. A published component library must\n * not crash a consumer's app over a stale override, so this stays\n * defensive — but the check now only runs for sub-triggers, not for every\n * item on every render.\n */\n get submenuIndicatorClass(): string | undefined {\n if (!this.args.hasSubmenu) {\n return undefined;\n }\n\n const { listboxItem } = useStyles();\n const { submenuIndicator } = listboxItem({\n variant: this.variant,\n color: this.color,\n isDisabled: this.listItem?.isDisabled,\n isSelected: this.listItem?.isSelected,\n isActive: this.listItem?.isActive,\n withDivider: this.args.withDivider\n });\n\n return typeof submenuIndicator === 'function'\n ? submenuIndicator()\n : undefined;\n }\n\n get shortcutVariant() {\n return this.args.shortcutVariant ?? 'inherit';\n }\n\n /**\n * Whether this row carries selection state of its own.\n *\n * A row that opens a submenu never does, whatever the level selects:\n * activating it reveals another menu rather than toggling a value. Both\n * `role` and `ariaChecked` hang off this one question, so they cannot\n * disagree about it.\n */\n get isCheckableMenuRow(): boolean {\n return (\n this.args.type === 'menu' &&\n !this.args.hasSubmenu &&\n this.manager.selectionMode !== 'none'\n );\n }\n\n get role() {\n if (this.args.type !== 'menu') {\n return 'option';\n }\n\n if (!this.isCheckableMenuRow) {\n return 'menuitem';\n }\n\n return this.manager.selectionMode === 'multiple'\n ? 'menuitemcheckbox'\n : 'menuitemradio';\n }\n\n /**\n * `aria-selected` belongs on `option`, and only there — a plain `menuitem`\n * that carries it is invalid ARIA, since menu items convey state through\n * `aria-checked` and only as `menuitemcheckbox`/`menuitemradio`. Returning\n * undefined omits the attribute rather than rendering an empty one.\n */\n get ariaSelected(): 'true' | 'false' | undefined {\n return this.role === 'option' ? this.selectedState : undefined;\n }\n\n /** Selection as an ARIA attribute value, for whichever attribute carries it. */\n private get selectedState(): 'true' | 'false' {\n return this.listItem?.isSelected ? 'true' : 'false';\n }\n\n /**\n * The menu counterpart to `aria-selected`.\n *\n * Rendered only for the two checkable menu roles: `aria-checked` on a plain\n * `menuitem` is invalid ARIA, and a checkable row that omits it announces no\n * state at all, which is how a selectable menu ends up sounding identical to\n * a list of commands.\n */\n get ariaChecked(): 'true' | 'false' | undefined {\n return this.isCheckableMenuRow ? this.selectedState : undefined;\n }\n\n /**\n * `aria-haspopup=\"menu\"` rather than the bare `\"true\"`: both are valid, but\n * the explicit role tells a screen reader what is about to open.\n */\n get ariaHasPopup(): 'menu' | undefined {\n return this.args.hasSubmenu ? 'menu' : undefined;\n }\n\n /**\n * Only a row that owns a popup has an expanded state. Rendering\n * `aria-expanded` on a plain `menuitem` would be invalid ARIA, so this is\n * undefined -- and therefore omitted -- unless `@hasSubmenu` is set.\n */\n /**\n * `aria-expanded` and `data-submenu-open` share this same value — one is\n * the ARIA state for assistive tech, the other a styling hook for the\n * template's own resting/hover state — so both getters delegate here.\n */\n get submenuOpenState(): 'true' | 'false' | undefined {\n if (!this.args.hasSubmenu) {\n return undefined;\n }\n return this.args.isSubmenuOpen ? 'true' : 'false';\n }\n\n get ariaExpanded(): 'true' | 'false' | undefined {\n return this.submenuOpenState;\n }\n\n get dataSubmenuOpen(): 'true' | 'false' | undefined {\n return this.submenuOpenState;\n }\n\n <template>\n <li\n {{this.manager.setupItem\n key=this.key\n textValue=@textValue\n item=@item\n onRegister=this.onRegister\n }}\n {{on \"click\" this.onClick}}\n id={{this.itemId}}\n role={{this.role}}\n aria-labelledby={{this.labelId}}\n aria-selected={{this.ariaSelected}}\n aria-checked={{this.ariaChecked}}\n aria-haspopup={{this.ariaHasPopup}}\n aria-expanded={{this.ariaExpanded}}\n aria-controls={{if @hasSubmenu @submenuId}}\n data-submenu-open={{this.dataSubmenuOpen}}\n tabindex={{this.tabindex}}\n data-active=\"{{this.listItem.isActive}}\"\n data-selected=\"{{this.listItem.isSelected}}\"\n data-component=\"listbox-item\"\n data-part=\"base\"\n data-key={{this.key}}\n aria-disabled={{if this.listItem.isDisabled \"true\"}}\n class={{this.classNames.base}}\n ...attributes\n >\n {{yield to=\"start\"}}\n\n {{#if @description}}\n <div\n data-part=\"description-wrapper\"\n class={{this.classNames.descriptionWrapper}}\n >\n <span\n data-part=\"label\"\n class={{this.classNames.label}}\n id={{this.labelId}}\n >{{yield}}</span>\n <span\n data-part=\"description\"\n class={{this.classNames.description}}\n >{{@description}}</span>\n </div>\n {{else}}\n <span\n data-part=\"label\"\n class={{this.classNames.label}}\n id={{this.labelId}}\n >{{yield}}</span>\n {{/if}}\n\n {{#if @shortcut}}\n <Kbd\n @keys={{@shortcut}}\n @size=\"sm\"\n @variant={{this.shortcutVariant}}\n data-test-id=\"listbox-item-shortcut\"\n />\n {{/if}}\n\n {{#if this.listItem.isSelected}}\n <span data-part=\"selected-icon\" class={{this.classNames.selectedIcon}}>\n {{#if (has-block \"selectedIcon\")}}\n {{yield to=\"selectedIcon\"}}\n {{else}}\n <CheckIcon class=\"h-full w-full\" />\n {{/if}}\n </span>\n {{/if}}\n\n {{#if @hasSubmenu}}\n {{#unless (has-block \"end\")}}\n <span\n data-part=\"submenu-indicator\"\n class={{this.submenuIndicatorClass}}\n >\n <ChevronRightIcon class=\"h-full w-full\" />\n </span>\n {{/unless}}\n {{/if}}\n\n {{yield to=\"end\"}}\n </li>\n {{#if @withDivider}}\n <Divider @as=\"li\" />\n {{/if}}\n </template>\n}\n\nconst CheckIcon: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"m4.5 12.75 6 6 9-13.5\"\n />\n </svg>\n</template>;\n\nconst ChevronRightIcon: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke-width=\"1.5\"\n stroke=\"currentColor\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"m8.25 4.5 7.5 7.5-7.5 7.5\"\n />\n </svg>\n</template>;\n\nexport { ListboxItem };\n"],"names":["ListboxItem","Component","itemId","guidFor","labelId","g","prototype","tracked","i","manager","assert","args","key","onRegister","item","listItem","onClick","isDisabled","hasSubmenu","selectItem","tabindex","isTabStop","variant","renamedArgValue","appearance","default","outlined","faded","component","from","to","id","n","cached","color","intent","classNames","listboxItem","useStyles","base","descriptionWrapper","label","description","selectedIcon","isSelected","isActive","withDivider","class","submenuIndicatorClass","undefined","submenuIndicator","shortcutVariant","isCheckableMenuRow","type","selectionMode","role","ariaSelected","selectedState","ariaChecked","ariaHasPopup","submenuOpenState","isSubmenuOpen","ariaExpanded","dataSubmenuOpen","setComponentTemplate","precompileTemplate","strictMode","scope","on","Kbd","CheckIcon","ChevronRightIcon","Divider","templateOnly"],"mappings":";;;;;;;;;;;;;;AAuHA,MAAMA,oBAAoBC,SAAA,CAAU;AAClC;AACA;AACAC,EAAAA,MAAA,GAAS,CAAA,EAAGC,OAAA,CAAQ,IAAI,CAAA,CAAA,OAAA,CAAU;AAClCC,EAAA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C;IAC/C,OAAO,IAAI,CAACF,gBAAgB;AAC9B,EAAA;EAEA,IAAIG,eAAAA,GAAgD;IAClD,OAAO,IAAI,CAACH,gBAAgB;AAC9B,EAAA;AAEA,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,w8DAAA,EAwFA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,EAAA;QAAAC,GAAA;QAAAC,SAAA;QAAAC,gBAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;AAEA,MAAMF,SAED,GAAAN,oBAAA,CAAAC,kBAAA,CAAA,8OAAA,EAeL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAO,YAAA,EAAA,CAAA;AAEV,MAAMF,gBAED,GAAAP,oBAAA,CAAAC,kBAAA,CAAA,kPAAA,EAeL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAO,YAAA,EAAA,CAAA;;"}
@@ -1,5 +1,5 @@
1
1
  import Component from '@glimmer/component';
2
- import { useStyles } from '@frontile/theme';
2
+ import { useStyles, twMerge } from '@frontile/theme';
3
3
  import { precompileTemplate } from '@ember/template-compilation';
4
4
  import { setComponentTemplate } from '@ember/component';
5
5
 
@@ -11,7 +11,7 @@ class SimpleTableColumn extends Component {
11
11
  const options = {
12
12
  isSticky: this.args.isSticky || false,
13
13
  stickyPosition: this.args.isSticky ? this.args.stickyPosition || 'left' : undefined,
14
- class: this.args.class
14
+ class: twMerge(this.args.class || '', this.args.classes?.th || '')
15
15
  };
16
16
  return this.styles.th(options);
17
17
  }
@@ -1 +1 @@
1
- {"version":3,"file":"column.js","sources":["../../../../src/components/collections/simple-table/column.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\n\ninterface SimpleTableColumnSignature {\n Args: {\n /** Additional CSS class to apply to the header cell */\n class?: string;\n /** Whether this column should be sticky during horizontal scrolling */\n isSticky?: boolean;\n /** Position where the sticky column should stick. @default 'left' */\n stickyPosition?: 'left' | 'right';\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n };\n Element: HTMLTableCellElement;\n Blocks: {\n default: [];\n };\n}\n\nclass SimpleTableColumn extends Component<SimpleTableColumnSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky\n ? (this.args.stickyPosition as 'left' | 'right') || 'left'\n : undefined,\n class: this.args.class\n };\n\n return this.styles.th(options);\n }\n\n <template>\n <th data-part=\"th\" scope=\"col\" class={{this.classNames}} ...attributes>\n {{yield}}\n </th>\n </template>\n}\n\nexport { SimpleTableColumn, type SimpleTableColumnSignature };\nexport default SimpleTableColumn;\n"],"names":["SimpleTableColumn","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","th","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAuBA,MAAMA,0BAA0BC,SAAA,CAAU;EACxC,IAAIC,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAIC,YAAYC,KAAK,EAAA;AAChD,EAAA;EAEA,IAAIC,UAAAA,GAAa;AACf,IAAA,MAAMC,OAAA,GAAU;AACdC,MAAAA,QAAA,EAAU,IAAI,CAACN,IAAI,CAACM,QAAQ,IAAI,KAAA;AAChCC,MAAAA,cAAA,EAAgB,IAAI,CAACP,IAAI,CAACM,QAAQ,GAC7B,IAAI,CAACN,IAAI,CAACO,cAAc,IAAyB,MAAA,GAClDC,SAAA;AACJC,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACS;KACnB;AAEA,IAAA,OAAO,IAAI,CAACV,MAAM,CAACW,EAAE,CAACL,OAAA,CAAA;AACxB,EAAA;AAEA,EAAA;IAAAM,oBAAA,CAAAC,kBAAA,CAAA,iGAAA,EAIA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"column.js","sources":["../../../../src/components/collections/simple-table/column.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, twMerge } from '@frontile/theme';\nimport type { SlotsToClasses, TableSlots } from '../table/types';\n\ninterface SimpleTableColumnSignature {\n Args: {\n /** Additional CSS class to apply to the header cell */\n class?: string;\n /** Whether this column should be sticky during horizontal scrolling */\n isSticky?: boolean;\n /** Position where the sticky column should stick. @default 'left' */\n stickyPosition?: 'left' | 'right';\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n /**\n * @internal Classes object from SimpleTable component\n * @ignore\n */\n classes?: SlotsToClasses<TableSlots>;\n };\n Element: HTMLTableCellElement;\n Blocks: {\n default: [];\n };\n}\n\nclass SimpleTableColumn extends Component<SimpleTableColumnSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky\n ? (this.args.stickyPosition as 'left' | 'right') || 'left'\n : undefined,\n class: twMerge(this.args.class || '', this.args.classes?.th || '')\n };\n\n return this.styles.th(options);\n }\n\n <template>\n <th data-part=\"th\" scope=\"col\" class={{this.classNames}} ...attributes>\n {{yield}}\n </th>\n </template>\n}\n\nexport { SimpleTableColumn, type SimpleTableColumnSignature };\nexport default SimpleTableColumn;\n"],"names":["SimpleTableColumn","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","twMerge","classes","th","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AA6BA,MAAMA,0BAA0BC,SAAA,CAAU;EACxC,IAAIC,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAIC,YAAYC,KAAK,EAAA;AAChD,EAAA;EAEA,IAAIC,UAAAA,GAAa;AACf,IAAA,MAAMC,OAAA,GAAU;AACdC,MAAAA,QAAA,EAAU,IAAI,CAACN,IAAI,CAACM,QAAQ,IAAI,KAAA;AAChCC,MAAAA,cAAA,EAAgB,IAAI,CAACP,IAAI,CAACM,QAAQ,GAC7B,IAAI,CAACN,IAAI,CAACO,cAAc,IAAyB,MAAA,GAClDC,SAAA;AACJC,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,CAACV,IAAI,CAACS,KAAK,IAAI,EAAA,EAAI,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEC,EAAA,IAAM,EAAA;KACjE;AAEA,IAAA,OAAO,IAAI,CAACb,MAAM,CAACa,EAAE,CAACP,OAAA,CAAA;AACxB,EAAA;AAEA,EAAA;IAAAQ,oBAAA,CAAAC,kBAAA,CAAA,iGAAA,EAIA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -30,7 +30,7 @@ class SimpleTableFooter extends Component {
30
30
  });
31
31
  }
32
32
  static {
33
- setComponentTemplate(precompileTemplate("<tfoot data-part=\"tfoot\" class={{this.classNames}} ...attributes>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n</tfoot>", {
33
+ setComponentTemplate(precompileTemplate("<tfoot data-part=\"tfoot\" class={{this.classNames}} ...attributes>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=(component SimpleTableColumn styleFns=this.styles classes=@classes))}}\n </tr>\n</tfoot>", {
34
34
  strictMode: true,
35
35
  scope: () => ({
36
36
  hash,
@@ -1 +1 @@
1
- {"version":3,"file":"footer.js","sources":["../../../../src/components/collections/simple-table/footer.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles, twMerge } from '@frontile/theme';\nimport { SimpleTableColumn } from './column';\nimport type { SlotsToClasses, TableSlots } from '../table/types';\n\ninterface SimpleTableFooterSignature {\n Args: {\n /** Additional CSS class to apply to the footer element */\n class?: string;\n /** Whether this footer should be sticky during vertical scrolling */\n isSticky?: boolean;\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n /**\n * @internal Classes object from SimpleTable component\n * @ignore\n */\n classes?: SlotsToClasses<TableSlots>;\n };\n Element: HTMLTableSectionElement;\n Blocks: {\n default: [\n {\n Column: typeof SimpleTableColumn;\n }\n ];\n };\n}\n\nclass SimpleTableFooter extends Component<SimpleTableFooterSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky ? ('bottom' as const) : undefined,\n class: twMerge(this.args.class, this.args.classes?.tfoot)\n };\n\n return this.styles.tfoot(options);\n }\n\n get rowClassNames() {\n const options = {\n class: twMerge('', this.args.classes?.tr || ''),\n isSticky: false\n };\n return this.styles.tr(options);\n }\n\n get separatorClassNames() {\n return this.styles.separator({\n class: this.args.classes?.separator\n });\n }\n\n <template>\n <tfoot data-part=\"tfoot\" class={{this.classNames}} ...attributes>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n </tfoot>\n </template>\n}\n\nexport { SimpleTableFooter, type SimpleTableFooterSignature };\nexport default SimpleTableFooter;\n"],"names":["SimpleTableFooter","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","twMerge","classes","tfoot","rowClassNames","tr","separatorClassNames","separator","setComponentTemplate","precompileTemplate","strictMode","scope","hash","SimpleTableColumn"],"mappings":";;;;;;;AAiCA,MAAMA,0BAA0BC,SAAA,CAAU;EACxC,IAAIC,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAIC,YAAYC,KAAK,EAAA;AAChD,EAAA;EAEA,IAAIC,UAAAA,GAAa;AACf,IAAA,MAAMC,OAAA,GAAU;AACdC,MAAAA,QAAA,EAAU,IAAI,CAACN,IAAI,CAACM,QAAQ,IAAI,KAAA;MAChCC,cAAA,EAAgB,IAAI,CAACP,IAAI,CAACM,QAAQ,GAAI,WAAqBE,SAAA;AAC3DC,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,CAACV,IAAI,CAACS,KAAK,EAAE,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEC,KAAA;KACrD;AAEA,IAAA,OAAO,IAAI,CAACb,MAAM,CAACa,KAAK,CAACP,OAAA,CAAA;AAC3B,EAAA;EAEA,IAAIQ,aAAAA,GAAgB;AAClB,IAAA,MAAMR,OAAA,GAAU;AACdI,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,IAAI,CAACV,IAAI,CAACW,OAAO,EAAEG,EAAA,IAAM,EAAA,CAAA;AAC5CR,MAAAA,QAAA,EAAU;KACZ;AACA,IAAA,OAAO,IAAI,CAACP,MAAM,CAACe,EAAE,CAACT,OAAA,CAAA;AACxB,EAAA;EAEA,IAAIU,mBAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAAChB,MAAM,CAACiB,SAAS,CAAC;AAC3BP,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEK;AAC5B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,kQAAA,EAOA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"footer.js","sources":["../../../../src/components/collections/simple-table/footer.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport type { WithBoundArgs } from '@glint/template';\nimport { useStyles, twMerge } from '@frontile/theme';\nimport { SimpleTableColumn } from './column';\nimport type { SlotsToClasses, TableSlots } from '../table/types';\n\ninterface SimpleTableFooterSignature {\n Args: {\n /** Additional CSS class to apply to the footer element */\n class?: string;\n /** Whether this footer should be sticky during vertical scrolling */\n isSticky?: boolean;\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n /**\n * @internal Classes object from SimpleTable component\n * @ignore\n */\n classes?: SlotsToClasses<TableSlots>;\n };\n Element: HTMLTableSectionElement;\n Blocks: {\n default: [\n {\n Column: WithBoundArgs<typeof SimpleTableColumn, 'styleFns' | 'classes'>;\n }\n ];\n };\n}\n\nclass SimpleTableFooter extends Component<SimpleTableFooterSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky ? ('bottom' as const) : undefined,\n class: twMerge(this.args.class, this.args.classes?.tfoot)\n };\n\n return this.styles.tfoot(options);\n }\n\n get rowClassNames() {\n const options = {\n class: twMerge('', this.args.classes?.tr || ''),\n isSticky: false\n };\n return this.styles.tr(options);\n }\n\n get separatorClassNames() {\n return this.styles.separator({\n class: this.args.classes?.separator\n });\n }\n\n <template>\n <tfoot data-part=\"tfoot\" class={{this.classNames}} ...attributes>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield\n (hash\n Column=(component\n SimpleTableColumn styleFns=this.styles classes=@classes\n )\n )\n }}\n </tr>\n </tfoot>\n </template>\n}\n\nexport { SimpleTableFooter, type SimpleTableFooterSignature };\nexport default SimpleTableFooter;\n"],"names":["SimpleTableFooter","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","twMerge","classes","tfoot","rowClassNames","tr","separatorClassNames","separator","setComponentT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CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -30,7 +30,7 @@ class SimpleTableHeader extends Component {
30
30
  });
31
31
  }
32
32
  static {
33
- setComponentTemplate(precompileTemplate("<thead data-part=\"thead\" class={{this.classNames}} ...attributes>\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n</thead>", {
33
+ setComponentTemplate(precompileTemplate("<thead data-part=\"thead\" class={{this.classNames}} ...attributes>\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=(component SimpleTableColumn styleFns=this.styles classes=@classes))}}\n </tr>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n</thead>", {
34
34
  strictMode: true,
35
35
  scope: () => ({
36
36
  hash,
@@ -1 +1 @@
1
- {"version":3,"file":"header.js","sources":["../../../../src/components/collections/simple-table/header.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles, twMerge } from '@frontile/theme';\nimport { SimpleTableColumn } from './column';\nimport type { SlotsToClasses, TableSlots } from '../table/types';\n\ninterface SimpleTableHeaderSignature {\n Args: {\n /** Additional CSS class to apply to the header section */\n class?: string;\n /** Whether the header should be sticky during vertical scrolling */\n isSticky?: boolean;\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n /**\n * @internal Classes object from SimpleTable component\n * @ignore\n */\n classes?: SlotsToClasses<TableSlots>;\n };\n Element: HTMLTableSectionElement;\n Blocks: {\n default: [\n {\n Column: typeof SimpleTableColumn;\n }\n ];\n };\n}\n\nclass SimpleTableHeader extends Component<SimpleTableHeaderSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky ? ('top' as const) : undefined,\n class: twMerge(this.args.class, this.args.classes?.thead)\n };\n\n return this.styles.thead(options);\n }\n\n get rowClassNames() {\n const options = {\n class: twMerge('', this.args.classes?.tr || ''),\n isSticky: false\n };\n return this.styles.tr(options);\n }\n\n get separatorClassNames() {\n return this.styles.separator({\n class: this.args.classes?.separator\n });\n }\n\n <template>\n <thead data-part=\"thead\" class={{this.classNames}} ...attributes>\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield (hash Column=SimpleTableColumn)}}\n </tr>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n </thead>\n </template>\n}\n\nexport { SimpleTableHeader, type SimpleTableHeaderSignature };\nexport default SimpleTableHeader;\n"],"names":["SimpleTableHeader","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","twMerge","classes","thead","rowClassNames","tr","separatorClassNames","separator","setComponentTemplate","precompileTemplate","strictMode","scope","hash","SimpleTableColumn"],"mappings":";;;;;;;AAiCA,MAAMA,0BAA0BC,SAAA,CAAU;EACxC,IAAIC,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAIC,YAAYC,KAAK,EAAA;AAChD,EAAA;EAEA,IAAIC,UAAAA,GAAa;AACf,IAAA,MAAMC,OAAA,GAAU;AACdC,MAAAA,QAAA,EAAU,IAAI,CAACN,IAAI,CAACM,QAAQ,IAAI,KAAA;MAChCC,cAAA,EAAgB,IAAI,CAACP,IAAI,CAACM,QAAQ,GAAI,QAAkBE,SAAA;AACxDC,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,CAACV,IAAI,CAACS,KAAK,EAAE,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEC,KAAA;KACrD;AAEA,IAAA,OAAO,IAAI,CAACb,MAAM,CAACa,KAAK,CAACP,OAAA,CAAA;AAC3B,EAAA;EAEA,IAAIQ,aAAAA,GAAgB;AAClB,IAAA,MAAMR,OAAA,GAAU;AACdI,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,IAAI,CAACV,IAAI,CAACW,OAAO,EAAEG,EAAA,IAAM,EAAA,CAAA;AAC5CR,MAAAA,QAAA,EAAU;KACZ;AACA,IAAA,OAAO,IAAI,CAACP,MAAM,CAACe,EAAE,CAACT,OAAA,CAAA;AACxB,EAAA;EAEA,IAAIU,mBAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAAChB,MAAM,CAACiB,SAAS,CAAC;AAC3BP,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEK;AAC5B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,kQAAA,EAOA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"header.js","sources":["../../../../src/components/collections/simple-table/header.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport type { WithBoundArgs } from '@glint/template';\nimport { useStyles, twMerge } from '@frontile/theme';\nimport { SimpleTableColumn } from './column';\nimport type { SlotsToClasses, TableSlots } from '../table/types';\n\ninterface SimpleTableHeaderSignature {\n Args: {\n /** Additional CSS class to apply to the header section */\n class?: string;\n /** Whether the header should be sticky during vertical scrolling */\n isSticky?: boolean;\n /**\n * @internal Style functions object from SimpleTable component\n * @ignore\n */\n styleFns?: ReturnType<ReturnType<typeof useStyles>['table']>;\n /**\n * @internal Classes object from SimpleTable component\n * @ignore\n */\n classes?: SlotsToClasses<TableSlots>;\n };\n Element: HTMLTableSectionElement;\n Blocks: {\n default: [\n {\n Column: WithBoundArgs<typeof SimpleTableColumn, 'styleFns' | 'classes'>;\n }\n ];\n };\n}\n\nclass SimpleTableHeader extends Component<SimpleTableHeaderSignature> {\n get styles() {\n return this.args.styleFns || useStyles().table();\n }\n\n get classNames() {\n const options = {\n isSticky: this.args.isSticky || false,\n stickyPosition: this.args.isSticky ? ('top' as const) : undefined,\n class: twMerge(this.args.class, this.args.classes?.thead)\n };\n\n return this.styles.thead(options);\n }\n\n get rowClassNames() {\n const options = {\n class: twMerge('', this.args.classes?.tr || ''),\n isSticky: false\n };\n return this.styles.tr(options);\n }\n\n get separatorClassNames() {\n return this.styles.separator({\n class: this.args.classes?.separator\n });\n }\n\n <template>\n <thead data-part=\"thead\" class={{this.classNames}} ...attributes>\n <tr data-part=\"tr\" class={{this.rowClassNames}}>\n {{yield\n (hash\n Column=(component\n SimpleTableColumn styleFns=this.styles classes=@classes\n )\n )\n }}\n </tr>\n <tr data-part=\"separator\" class={{this.separatorClassNames}} />\n </thead>\n </template>\n}\n\nexport { SimpleTableHeader, type SimpleTableHeaderSignature };\nexport default SimpleTableHeader;\n"],"names":["SimpleTableHeader","Component","styles","args","styleFns","useStyles","table","classNames","options","isSticky","stickyPosition","undefined","class","twMerge","classes","thead","rowClassNames","tr","separatorClassNames","separator","setComponentTemplate","precompileTemplate","strictMode","scope","hash","SimpleTableColumn"],"mappings":";;;;;;;AAkCA,MAAMA,0BAA0BC,SAAA,CAAU;EACxC,IAAIC,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACC,IAAI,CAACC,QAAQ,IAAIC,YAAYC,KAAK,EAAA;AAChD,EAAA;EAEA,IAAIC,UAAAA,GAAa;AACf,IAAA,MAAMC,OAAA,GAAU;AACdC,MAAAA,QAAA,EAAU,IAAI,CAACN,IAAI,CAACM,QAAQ,IAAI,KAAA;MAChCC,cAAA,EAAgB,IAAI,CAACP,IAAI,CAACM,QAAQ,GAAI,QAAkBE,SAAA;AACxDC,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,CAACV,IAAI,CAACS,KAAK,EAAE,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEC,KAAA;KACrD;AAEA,IAAA,OAAO,IAAI,CAACb,MAAM,CAACa,KAAK,CAACP,OAAA,CAAA;AAC3B,EAAA;EAEA,IAAIQ,aAAAA,GAAgB;AAClB,IAAA,MAAMR,OAAA,GAAU;AACdI,MAAAA,KAAA,EAAOC,OAAA,CAAQ,IAAI,IAAI,CAACV,IAAI,CAACW,OAAO,EAAEG,EAAA,IAAM,EAAA,CAAA;AAC5CR,MAAAA,QAAA,EAAU;KACZ;AACA,IAAA,OAAO,IAAI,CAACP,MAAM,CAACe,EAAE,CAACT,OAAA,CAAA;AACxB,EAAA;EAEA,IAAIU,mBAAAA,GAAsB;AACxB,IAAA,OAAO,IAAI,CAAChB,MAAM,CAACiB,SAAS,CAAC;AAC3BP,MAAAA,KAAA,EAAO,IAAI,CAACT,IAAI,CAACW,OAAO,EAAEK;AAC5B,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,oTAAA,EAaA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -43,7 +43,7 @@ class SimpleTable extends Component {
43
43
  });
44
44
  }
45
45
  static {
46
- setComponentTemplate(precompileTemplate("{{#if this.hasWrapper}}\n <div data-part=\"wrapper\" class={{this.wrapperClassNames}}>\n <table data-component={{if this.isRoot \"table\"}} data-part=\"table\" class={{this.tableClassNames}} data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n </div>\n{{else}}\n <table data-component={{if this.isRoot \"table\"}} data-part=\"table\" class={{this.tableClassNames}} data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n{{/if}}", {
46
+ setComponentTemplate(precompileTemplate("{{#if this.hasWrapper}}\n <div data-part=\"wrapper\" class={{this.wrapperClassNames}}>\n <table data-component={{if this.isRoot \"table\"}} data-part=\"table\" class={{this.tableClassNames}} data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles classes=this.args.classes) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n </div>\n{{else}}\n <table data-component={{if this.isRoot \"table\"}} data-part=\"table\" class={{this.tableClassNames}} data-loading={{if this.args.isLoading \"true\" \"false\"}} ...attributes>\n {{yield (hash Header=(component SimpleTableHeader styleFns=this.styles classes=this.args.classes) Body=(component SimpleTableBody styleFns=this.styles classes=this.args.classes) Footer=(component SimpleTableFooter styleFns=this.styles classes=this.args.classes) Column=(component SimpleTableColumn styleFns=this.styles classes=this.args.classes) Row=(component SimpleTableRow styleFns=this.styles classes=this.args.classes) Cell=(component SimpleTableCell styleFns=this.styles classes=this.args.classes))}}\n </table>\n{{/if}}", {
47
47
  strictMode: true,
48
48
  scope: () => ({
49
49
  hash,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/collections/simple-table/index.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { SimpleTableHeader, type SimpleTableHeaderSignature } from './header';\nimport { SimpleTableBody, type SimpleTableBodySignature } from './body';\nimport { SimpleTableFooter, type SimpleTableFooterSignature } from './footer';\nimport { SimpleTableColumn, type SimpleTableColumnSignature } from './column';\nimport { SimpleTableRow, type SimpleTableRowSignature } from './row';\nimport { SimpleTableCell, type SimpleTableCellSignature } from './cell';\n\nimport type { TableVariants, TableSlots, SlotsToClasses } from '../table/types';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface SimpleTableSignature {\n Args: {\n /** Custom CSS classes for different table elements (wrapper, table, th, td, etc.) */\n classes?: SlotsToClasses<TableSlots>;\n /** Size variant for table cells and headers. @defaultValue 'md' */\n size?: TableVariants['size'];\n /** Table layout algorithm - 'auto' sizes columns by content, 'fixed' uses first row for sizing. @defaultValue 'auto' */\n layout?: TableVariants['layout'];\n /** Enable striped rows (alternating background colors) */\n isStriped?: TableVariants['striped'];\n /** Enable scrolling for the table container */\n isScrollable?: boolean;\n /** Whether to render the wrapper div. @defaultValue true */\n hasWrapper?: boolean;\n /** Enable loading state styling and behavior */\n isLoading?: boolean;\n /** Color variant for loading animation. @defaultValue 'default' */\n loadingColor?: TableVariants['loadingColor'];\n /** Color variant for selection highlight. @defaultValue 'primary' */\n selectionColor?: TableVariants['selectionColor'];\n /** Whether a custom loading block is provided (disables CSS loading indicator) */\n hasCustomLoading?: boolean;\n /**\n * @internal Whether this instance owns the \"table\" anatomy root\n * (`data-component=\"table\"`). Defaults to `true` for standalone/public\n * usage. `Table` sets this to `false` when it composes `SimpleTable`\n * internally, since `Table`'s own outer wrapper is already the anatomy\n * root for that combined instance -- without this, the `<table>` element\n * rendered here would be a second, nested `data-component=\"table\"`\n * inside Table's own root, breaking the one-root-per-instance contract.\n * @ignore\n */\n isRoot?: boolean;\n };\n Element: HTMLTableElement;\n Blocks: {\n default: [\n {\n Header: WithBoundArgs<\n ComponentLike<SimpleTableHeaderSignature>,\n 'styleFns' | 'classes'\n >;\n Body: WithBoundArgs<\n ComponentLike<SimpleTableBodySignature>,\n 'styleFns' | 'classes'\n >;\n Footer: WithBoundArgs<\n ComponentLike<SimpleTableFooterSignature>,\n 'styleFns' | 'classes'\n >;\n Column: WithBoundArgs<\n ComponentLike<SimpleTableColumnSignature>,\n 'styleFns'\n >;\n Row: WithBoundArgs<\n ComponentLike<SimpleTableRowSignature>,\n 'styleFns' | 'classes'\n >;\n Cell: WithBoundArgs<\n ComponentLike<SimpleTableCellSignature>,\n 'styleFns' | 'classes'\n >;\n }\n ];\n };\n}\n\nclass SimpleTable extends Component<SimpleTableSignature> {\n get hasWrapper() {\n return this.args.hasWrapper ?? true;\n }\n\n get isRoot() {\n return this.args.isRoot ?? true;\n }\n\n get styles() {\n const { table } = useStyles();\n return table({\n size: this.args.size,\n layout: this.args.layout,\n striped: this.args.isStriped,\n isScrollable: this.args.isScrollable || false,\n hasStickyHeader: false,\n isLoading: this.args.hasCustomLoading\n ? false\n : this.args.isLoading || false,\n loadingColor: this.args.loadingColor,\n selectionColor: this.args.selectionColor\n // No `class: this.args.classes?.base` here: `table` has no `base`\n // slot (deleted -- it was never rendered by anything, see\n // packages/theme/src/components/table.ts), so passing a class here\n // was already a no-op.\n });\n }\n\n get wrapperClassNames() {\n return this.styles.wrapper({\n class: this.args.classes?.wrapper\n });\n }\n\n get tableClassNames() {\n return this.styles.table({ class: this.args.classes?.table });\n }\n\n <template>\n {{#if this.hasWrapper}}\n <div data-part=\"wrapper\" class={{this.wrapperClassNames}}>\n <table\n data-component={{if this.isRoot \"table\"}}\n data-part=\"table\"\n class={{this.tableClassNames}}\n data-loading={{if this.args.isLoading \"true\" \"false\"}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component\n SimpleTableHeader styleFns=this.styles classes=this.args.classes\n )\n Body=(component\n SimpleTableBody styleFns=this.styles classes=this.args.classes\n )\n Footer=(component\n SimpleTableFooter styleFns=this.styles classes=this.args.classes\n )\n Column=(component SimpleTableColumn styleFns=this.styles)\n Row=(component\n SimpleTableRow styleFns=this.styles classes=this.args.classes\n )\n Cell=(component\n SimpleTableCell styleFns=this.styles classes=this.args.classes\n )\n )\n }}\n </table>\n </div>\n {{else}}\n <table\n data-component={{if this.isRoot \"table\"}}\n data-part=\"table\"\n class={{this.tableClassNames}}\n data-loading={{if this.args.isLoading \"true\" \"false\"}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component\n SimpleTableHeader styleFns=this.styles classes=this.args.classes\n )\n Body=(component\n SimpleTableBody styleFns=this.styles classes=this.args.classes\n )\n Footer=(component\n SimpleTableFooter styleFns=this.styles classes=this.args.classes\n )\n Column=(component SimpleTableColumn styleFns=this.styles)\n Row=(component\n SimpleTableRow styleFns=this.styles classes=this.args.classes\n )\n Cell=(component\n SimpleTableCell styleFns=this.styles classes=this.args.classes\n )\n )\n }}\n </table>\n {{/if}}\n </template>\n}\n\nexport { SimpleTable, type SimpleTableSignature };\nexport default SimpleTable;\n"],"names":["SimpleTable","Component","hasWrapper","args","isRoot","styles","table","useStyles","size","layout","striped","isStriped","isScrollable","hasStickyHeader","isLoading","hasCustomLoading","loadingColor","selectionColor","wrapperClassNames","wrapper","class","classes","tableClassNames","setComponentTemplate","precompileTemplate","strictMode","scope","hash","SimpleTableHeader","SimpleTableBody","SimpleTableFooter","SimpleTableColumn","SimpleTableRow","SimpleTableCell"],"mappings":";;;;;;;;;;;;AAgFA,MAAMA,oBAAoBC,SAAA,CAAU;EAClC,IAAIC,UAAAA,GAAa;AACf,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,UAAU,IAAI,IAAA;AACjC,EAAA;EAEA,IAAIE,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,IAAI,IAAA;AAC7B,EAAA;EAEA,IAAIC,MAAAA,GAAS;IACX,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAACL,IAAI,CAACK,IAAI;AACpBC,MAAAA,MAAA,EAAQ,IAAI,CAACN,IAAI,CAACM,MAAM;AACxBC,MAAAA,OAAA,EAAS,IAAI,CAACP,IAAI,CAACQ,SAAS;AAC5BC,MAAAA,YAAA,EAAc,IAAI,CAACT,IAAI,CAACS,YAAY,IAAI,KAAA;AACxCC,MAAAA,eAAA,EAAiB,KAAA;AACjBC,MAAAA,SAAA,EAAW,IAAI,CAACX,IAAI,CAACY,gBAAgB,GACjC,KAAA,GACA,IAAI,CAACZ,IAAI,CAACW,SAAS,IAAI,KAAA;AAC3BE,MAAAA,YAAA,EAAc,IAAI,CAACb,IAAI,CAACa,YAAY;AACpCC,MAAAA,cAAA,EAAgB,IAAI,CAACd,IAAI,CAACc;AAK5B,KAAA,CAAA;AACF,EAAA;EAEA,IAAIC,iBAAAA,GAAoB;AACtB,IAAA,OAAO,IAAI,CAACb,MAAM,CAACc,OAAO,CAAC;AACzBC,MAAAA,KAAA,EAAO,IAAI,CAACjB,IAAI,CAACkB,OAAO,EAAEF;AAC5B,KAAA,CAAA;AACF,EAAA;EAEA,IAAIG,eAAAA,GAAkB;AACpB,IAAA,OAAO,IAAI,CAACjB,MAAM,CAACC,KAAK,CAAC;AAAEc,MAAAA,KAAA,EAAO,IAAI,CAACjB,IAAI,CAACkB,OAAO,EAAEf;AAAM,KAAA,CAAA;AAC7D,EAAA;AAEA,EAAA;IAAAiB,oBAAA,CAAAC,kBAAA,CAAA,s8CAAA,EA8DA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,iBAAA;QAAAC,eAAA;QAAAC,iBAAA;QAAAC,iBAAA;QAAAC,cAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/collections/simple-table/index.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { useStyles } from '@frontile/theme';\nimport { SimpleTableHeader, type SimpleTableHeaderSignature } from './header';\nimport { SimpleTableBody, type SimpleTableBodySignature } from './body';\nimport { SimpleTableFooter, type SimpleTableFooterSignature } from './footer';\nimport { SimpleTableColumn, type SimpleTableColumnSignature } from './column';\nimport { SimpleTableRow, type SimpleTableRowSignature } from './row';\nimport { SimpleTableCell, type SimpleTableCellSignature } from './cell';\n\nimport type { TableVariants, TableSlots, SlotsToClasses } from '../table/types';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface SimpleTableSignature {\n Args: {\n /** Custom CSS classes for different table elements (wrapper, table, th, td, etc.) */\n classes?: SlotsToClasses<TableSlots>;\n /** Size variant for table cells and headers. @defaultValue 'md' */\n size?: TableVariants['size'];\n /** Table layout algorithm - 'auto' sizes columns by content, 'fixed' uses first row for sizing. @defaultValue 'auto' */\n layout?: TableVariants['layout'];\n /** Enable striped rows (alternating background colors) */\n isStriped?: TableVariants['striped'];\n /** Enable scrolling for the table container */\n isScrollable?: boolean;\n /** Whether to render the wrapper div. @defaultValue true */\n hasWrapper?: boolean;\n /** Enable loading state styling and behavior */\n isLoading?: boolean;\n /** Color variant for loading animation. @defaultValue 'default' */\n loadingColor?: TableVariants['loadingColor'];\n /** Color variant for selection highlight. @defaultValue 'primary' */\n selectionColor?: TableVariants['selectionColor'];\n /** Whether a custom loading block is provided (disables CSS loading indicator) */\n hasCustomLoading?: boolean;\n /**\n * @internal Whether this instance owns the \"table\" anatomy root\n * (`data-component=\"table\"`). Defaults to `true` for standalone/public\n * usage. `Table` sets this to `false` when it composes `SimpleTable`\n * internally, since `Table`'s own outer wrapper is already the anatomy\n * root for that combined instance -- without this, the `<table>` element\n * rendered here would be a second, nested `data-component=\"table\"`\n * inside Table's own root, breaking the one-root-per-instance contract.\n * @ignore\n */\n isRoot?: boolean;\n };\n Element: HTMLTableElement;\n Blocks: {\n default: [\n {\n Header: WithBoundArgs<\n ComponentLike<SimpleTableHeaderSignature>,\n 'styleFns' | 'classes'\n >;\n Body: WithBoundArgs<\n ComponentLike<SimpleTableBodySignature>,\n 'styleFns' | 'classes'\n >;\n Footer: WithBoundArgs<\n ComponentLike<SimpleTableFooterSignature>,\n 'styleFns' | 'classes'\n >;\n Column: WithBoundArgs<\n ComponentLike<SimpleTableColumnSignature>,\n 'styleFns' | 'classes'\n >;\n Row: WithBoundArgs<\n ComponentLike<SimpleTableRowSignature>,\n 'styleFns' | 'classes'\n >;\n Cell: WithBoundArgs<\n ComponentLike<SimpleTableCellSignature>,\n 'styleFns' | 'classes'\n >;\n }\n ];\n };\n}\n\nclass SimpleTable extends Component<SimpleTableSignature> {\n get hasWrapper() {\n return this.args.hasWrapper ?? true;\n }\n\n get isRoot() {\n return this.args.isRoot ?? true;\n }\n\n get styles() {\n const { table } = useStyles();\n return table({\n size: this.args.size,\n layout: this.args.layout,\n striped: this.args.isStriped,\n isScrollable: this.args.isScrollable || false,\n hasStickyHeader: false,\n isLoading: this.args.hasCustomLoading\n ? false\n : this.args.isLoading || false,\n loadingColor: this.args.loadingColor,\n selectionColor: this.args.selectionColor\n // No `class: this.args.classes?.base` here: `table` has no `base`\n // slot (deleted -- it was never rendered by anything, see\n // packages/theme/src/components/table.ts), so passing a class here\n // was already a no-op.\n });\n }\n\n get wrapperClassNames() {\n return this.styles.wrapper({\n class: this.args.classes?.wrapper\n });\n }\n\n get tableClassNames() {\n return this.styles.table({ class: this.args.classes?.table });\n }\n\n <template>\n {{#if this.hasWrapper}}\n <div data-part=\"wrapper\" class={{this.wrapperClassNames}}>\n <table\n data-component={{if this.isRoot \"table\"}}\n data-part=\"table\"\n class={{this.tableClassNames}}\n data-loading={{if this.args.isLoading \"true\" \"false\"}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component\n SimpleTableHeader styleFns=this.styles classes=this.args.classes\n )\n Body=(component\n SimpleTableBody styleFns=this.styles classes=this.args.classes\n )\n Footer=(component\n SimpleTableFooter styleFns=this.styles classes=this.args.classes\n )\n Column=(component\n SimpleTableColumn styleFns=this.styles classes=this.args.classes\n )\n Row=(component\n SimpleTableRow styleFns=this.styles classes=this.args.classes\n )\n Cell=(component\n SimpleTableCell styleFns=this.styles classes=this.args.classes\n )\n )\n }}\n </table>\n </div>\n {{else}}\n <table\n data-component={{if this.isRoot \"table\"}}\n data-part=\"table\"\n class={{this.tableClassNames}}\n data-loading={{if this.args.isLoading \"true\" \"false\"}}\n ...attributes\n >\n {{yield\n (hash\n Header=(component\n SimpleTableHeader styleFns=this.styles classes=this.args.classes\n )\n Body=(component\n SimpleTableBody styleFns=this.styles classes=this.args.classes\n )\n Footer=(component\n SimpleTableFooter styleFns=this.styles classes=this.args.classes\n )\n Column=(component\n SimpleTableColumn styleFns=this.styles classes=this.args.classes\n )\n Row=(component\n SimpleTableRow styleFns=this.styles classes=this.args.classes\n )\n Cell=(component\n SimpleTableCell styleFns=this.styles classes=this.args.classes\n )\n )\n }}\n </table>\n {{/if}}\n </template>\n}\n\nexport { SimpleTable, type SimpleTableSignature };\nexport default SimpleTable;\n"],"names":["SimpleTable","Component","hasWrapper","args","isRoot","styles","table","useStyles","size","layout","striped","isStriped","isScrollable","hasStickyHeader","isLoading","hasCustomLoading","loadingColor","selectionColor","wrapperClassNames","wrapper","class","classes","tableClassNames","setComponentTemplate","precompileTemplate","strictMode","scope","hash","SimpleTableHeader","SimpleTableBody","SimpleTableFooter","SimpleTableColumn","SimpleTableRow","SimpleTableCell"],"mappings":";;;;;;;;;;;;AAgFA,MAAMA,oBAAoBC,SAAA,CAAU;EAClC,IAAIC,UAAAA,GAAa;AACf,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,UAAU,IAAI,IAAA;AACjC,EAAA;EAEA,IAAIE,MAAAA,GAAS;AACX,IAAA,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,IAAI,IAAA;AAC7B,EAAA;EAEA,IAAIC,MAAAA,GAAS;IACX,MAAM;AA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Z;;"}
@@ -1,11 +1,9 @@
1
1
  import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
2
  import { on } from '@ember/modifier';
4
3
  import { modifier } from 'ember-modifier';
5
4
  import { useStyles } from '@frontile/theme';
6
5
  import { precompileTemplate } from '@ember/template-compilation';
7
6
  import { setComponentTemplate } from '@ember/component';
8
- import { a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
9
7
 
10
8
  /**
11
9
  * Internal checkbox component for table selection.
@@ -15,7 +13,7 @@ class Checkbox extends Component {
15
13
  get isChecked() {
16
14
  return !!this.args.checked;
17
15
  }
18
- handleChange(event) {
16
+ handleChange = event => {
19
17
  if (this.args.disabled) {
20
18
  return;
21
19
  }
@@ -24,10 +22,7 @@ class Checkbox extends Component {
24
22
  if (typeof this.args.onChange === 'function') {
25
23
  this.args.onChange(value, event);
26
24
  }
27
- }
28
- static {
29
- decorateMethodV2(this.prototype, "handleChange", [action]);
30
- }
25
+ };
31
26
  get classes() {
32
27
  const {
33
28
  checkbox
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../../../src/components/collections/table/checkbox.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport {\n useStyles,\n type CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface CheckboxSignature {\n Args: {\n checked?: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n onChange?: (checked: boolean, event: Event) => void;\n size?: CheckboxVariants['size'];\n classes?: SlotsToClasses<CheckboxSlots>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n };\n Element: HTMLInputElement;\n}\n\n/**\n * Internal checkbox component for table selection.\n * Simplified version without FormControl wrapper.\n */\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n @action handleChange(event: Event): void {\n if (this.args.disabled) {\n return;\n }\n\n const target = event.target as HTMLInputElement;\n const value = target.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\n size: this.args.size\n });\n }\n\n setIndeterminate = modifier(\n (element: HTMLInputElement, [indeterminate]: [boolean | undefined]) => {\n element.indeterminate = !!indeterminate;\n }\n );\n\n <template>\n <input\n {{on \"change\" this.handleChange}}\n {{this.setIndeterminate @indeterminate}}\n type=\"checkbox\"\n checked={{this.isChecked}}\n disabled={{@disabled}}\n class={{this.classes.input class=@classes.input}}\n data-component=\"checkbox\"\n data-part=\"input\"\n aria-label={{@ariaLabel}}\n aria-labelledby={{@ariaLabelledby}}\n aria-checked={{if\n @indeterminate\n \"mixed\"\n (if this.isChecked \"true\" \"false\")\n }}\n ...attributes\n />\n </template>\n}\n\nexport { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","disabled","target","value","onChange","n","prototype","action","classes","checkbox","useStyles","size","setIndeterminate","modifier","element","indeterminate","setComponentTemplate","precompileTemplate","strictMode","scope","on"],"mappings":";;;;;;;;;AAyBA;;;;AAIA,MAAMA,iBAAiBC,SAAA,CAAU;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B,EAAA;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;AACvC,IAAA,IAAI,IAAI,CAACH,IAAI,CAACI,QAAQ,EAAE;AACtB,MAAA;AACF,IAAA;AAEA,IAAA,MAAMC,MAAA,GAASF,KAAA,CAAME,MAAU;AAC/B,IAAA,MAAMC,KAAA,GAAQD,OAAOJ,OAAO;IAE5B,IAAI,OAAO,IAAI,CAACD,IAAI,CAACO,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACP,IAAI,CAACO,QAAQ,CAACD,KAAA,EAAOH,KAAA,CAAA;AAC5B,IAAA;AACF,EAAA;AAAA,EAAA;IAAAK,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAXCC,MAAA,CAAA,CAAA;AAAA;EAaD,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAA,CAAS;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACd,IAAI,CAACc;AAClB,KAAA,CAAA;AACF,EAAA;EAEAC,gBAAA,GAAmBC,QAAA,CACjB,CAACC,OAAS,EAAkB,CAACC,aAAA,CAAqC,KAAA;AAChED,IAAAA,OAAA,CAAQC,aAAa,GAAG,CAAC,CAACA,aAAA;AAC5B,EAAA,CAAA,CAAA;AAGF,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8ZAAA,EAmBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"checkbox.js","sources":["../../../../src/components/collections/table/checkbox.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { modifier } from 'ember-modifier';\nimport {\n useStyles,\n type CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface CheckboxSignature {\n Args: {\n checked?: boolean;\n indeterminate?: boolean;\n disabled?: boolean;\n onChange?: (checked: boolean, event: Event) => void;\n size?: CheckboxVariants['size'];\n classes?: SlotsToClasses<CheckboxSlots>;\n ariaLabel?: string;\n ariaLabelledby?: string;\n };\n Element: HTMLInputElement;\n}\n\n/**\n * Internal checkbox component for table selection.\n * Simplified version without FormControl wrapper.\n */\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n handleChange = (event: Event): void => {\n if (this.args.disabled) {\n return;\n }\n\n const target = event.target as HTMLInputElement;\n const value = target.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n };\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\n size: this.args.size\n });\n }\n\n setIndeterminate = modifier(\n (element: HTMLInputElement, [indeterminate]: [boolean | undefined]) => {\n element.indeterminate = !!indeterminate;\n }\n );\n\n <template>\n <input\n {{on \"change\" this.handleChange}}\n {{this.setIndeterminate @indeterminate}}\n type=\"checkbox\"\n checked={{this.isChecked}}\n disabled={{@disabled}}\n class={{this.classes.input class=@classes.input}}\n data-component=\"checkbox\"\n data-part=\"input\"\n aria-label={{@ariaLabel}}\n aria-labelledby={{@ariaLabelledby}}\n aria-checked={{if\n @indeterminate\n \"mixed\"\n (if this.isChecked \"true\" \"false\")\n }}\n ...attributes\n />\n </template>\n}\n\nexport { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","disabled","target","value","onChange","classes","checkbox","useStyles","size","setIndeterminate","modifier","element","indeterminate","setComponentTemplate","precompileTemplate","strictMode","scope","on"],"mappings":";;;;;;;AAwBA;;;;AAIA,MAAMA,iBAAiBC,SAAA,CAAU;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B,EAAA;EAEAC,YAAA,GAAgBC,KAAO,IAAY;AACjC,IAAA,IAAI,IAAI,CAACH,IAAI,CAACI,QAAQ,EAAE;AACtB,MAAA;AACF,IAAA;AAEA,IAAA,MAAMC,MAAA,GAASF,KAAA,CAAME,MAAU;AAC/B,IAAA,MAAMC,KAAA,GAAQD,OAAOJ,OAAO;IAE5B,IAAI,OAAO,IAAI,CAACD,IAAI,CAACO,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACP,IAAI,CAACO,QAAQ,CAACD,KAAA,EAAOH,KAAA,CAAA;AAC5B,IAAA;EACF,CAAA;EAEA,IAAIK,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAA,CAAS;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACX,IAAI,CAACW;AAClB,KAAA,CAAA;AACF,EAAA;EAEAC,gBAAA,GAAmBC,QAAA,CACjB,CAACC,OAAS,EAAkB,CAACC,aAAA,CAAqC,KAAA;AAChED,IAAAA,OAAA,CAAQC,aAAa,GAAG,CAAC,CAACA,aAAA;AAC5B,EAAA,CAAA,CAAA;AAGF,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,8ZAAA,EAmBA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1,12 +1,10 @@
1
1
  import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
2
  import { useStyles } from '@frontile/theme';
4
3
  import { Dropdown } from '../dropdown/dropdown.js';
5
4
  import { isVisible, show, hide } from '@universal-ember/table/plugins/column-visibility';
6
5
  import { C as ColumnVisibilityIcon } from '../../../icons-DZ61nCzv.js';
7
6
  import { precompileTemplate } from '@ember/template-compilation';
8
7
  import { setComponentTemplate } from '@ember/component';
9
- import { a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
10
8
 
11
9
  class ColumnVisibility extends Component {
12
10
  get styles() {
@@ -27,7 +25,7 @@ class ColumnVisibility extends Component {
27
25
  get allColumnKeys() {
28
26
  return this.columns.map(column => column.key);
29
27
  }
30
- handleSelectionChange(selectedKeys) {
28
+ handleSelectionChange = selectedKeys => {
31
29
  this.columns.forEach(column => {
32
30
  if (selectedKeys.includes(column.key)) {
33
31
  if (!isVisible(column)) {
@@ -39,10 +37,7 @@ class ColumnVisibility extends Component {
39
37
  }
40
38
  }
41
39
  });
42
- }
43
- static {
44
- decorateMethodV2(this.prototype, "handleSelectionChange", [action]);
45
- }
40
+ };
46
41
  static {
47
42
  setComponentTemplate(precompileTemplate("<Dropdown @closeOnItemSelect={{false}} ...attributes>\n <:default as |d|>\n <d.Trigger data-part=\"column-visibility-button\" @color=\"neutral\" @size={{this.size}} @class={{(this.styles.columnVisibilityButton)}}>\n\n {{#if (has-block \"icon\")}}\n {{yield to=\"icon\"}}\n {{else}}\n <ColumnVisibilityIcon data-part=\"column-visibility-icon\" class={{(this.styles.columnVisibilityIcon)}} />\n {{/if}}\n {{yield}}\n </d.Trigger>\n\n <d.Menu @selectionMode=\"multiple\" @selectedKeys={{this.selectedKeys}} @onSelectionChange={{this.handleSelectionChange}} as |Item|>\n {{#each @tableInstance.columns as |column|}}\n <Item @key={{column.key}}>\n {{column.name}}\n </Item>\n {{/each}}\n </d.Menu>\n </:default>\n</Dropdown>", {
48
43
  strictMode: true,
@@ -1 +1 @@
1
- {"version":3,"file":"column-visibility.js","sources":["../../../../src/components/collections/table/column-visibility.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { action } from '@ember/object';\nimport { useStyles } from '@frontile/theme';\nimport { Dropdown } from '../dropdown';\nimport {\n hide,\n show,\n isVisible\n} from '@universal-ember/table/plugins/column-visibility';\nimport { ColumnVisibilityIcon } from '../../../-private/icons';\nimport type { Table, Column } from './types';\n\ninterface ColumnVisibilitySignature<T> {\n Args: {\n /** Universal-ember table instance */\n tableInstance?: Table<T>;\n /** Size of the column visibility button. @defaultValue 'xs' */\n size?: 'xs' | 'sm' | 'lg' | 'xl';\n };\n Element: HTMLUListElement;\n Blocks: {\n default: [];\n icon: [];\n };\n}\n\nexport default class ColumnVisibility<T> extends Component<\n ColumnVisibilitySignature<T>\n> {\n get styles() {\n const { table } = useStyles();\n return table();\n }\n\n get size() {\n return this.args.size ?? 'xs';\n }\n\n get columns() {\n return this.args.tableInstance?.columns.values() || [];\n }\n\n get selectedKeys() {\n return this.columns\n .filter((column: Column<T>) => isVisible(column))\n .map((column: Column<T>) => column.key);\n }\n\n get allColumnKeys() {\n return this.columns.map((column: Column<T>) => column.key);\n }\n\n @action\n handleSelectionChange(selectedKeys: string[]) {\n this.columns.forEach((column: Column<T>) => {\n if (selectedKeys.includes(column.key)) {\n if (!isVisible(column)) {\n show(column);\n }\n } else {\n if (isVisible(column)) {\n hide(column);\n }\n }\n });\n }\n\n <template>\n <Dropdown @closeOnItemSelect={{false}} ...attributes>\n <:default as |d|>\n <d.Trigger\n data-part=\"column-visibility-button\"\n @color=\"neutral\"\n @size={{this.size}}\n @class={{(this.styles.columnVisibilityButton)}}\n >\n\n {{#if (has-block \"icon\")}}\n {{yield to=\"icon\"}}\n {{else}}\n <ColumnVisibilityIcon\n data-part=\"column-visibility-icon\"\n class={{(this.styles.columnVisibilityIcon)}}\n />\n {{/if}}\n {{yield}}\n </d.Trigger>\n\n <d.Menu\n @selectionMode=\"multiple\"\n @selectedKeys={{this.selectedKeys}}\n @onSelectionChange={{this.handleSelectionChange}}\n as |Item|\n >\n {{#each @tableInstance.columns as |column|}}\n <Item @key={{column.key}}>\n {{column.name}}\n </Item>\n {{/each}}\n </d.Menu>\n </:default>\n </Dropdown>\n </template>\n}\n"],"names":["ColumnVisibility","Component","styles","table","useStyles","size","args","columns","tableInstance","values","selectedKeys","filter","column","isVisible","map","key","allColumnKeys","handleSelectionChange","forEach","includes","show","hide","n","prototype","action","setComponentTemplate","precompileTemplate","strictMode","scope","Dropdown","ColumnVisibilityIcon"],"mappings":";;;;;;;;;;AA0Be,MAAMA,gBAAA,SAA4BC,SAAA,CACrB;EAE1B,IAAIC,MAAAA,GAAS;IACX,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;IAClB,OAAOD,KAAA,EAAA;AACT,EAAA;EAEA,IAAIE,IAAAA,GAAO;AACT,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,IAAA;AAC3B,EAAA;EAEA,IAAIE,OAAAA,GAAU;AACZ,IAAA,OAAO,IAAI,CAACD,IAAI,CAACE,aAAa,EAAED,OAAA,CAAQE,YAAY,EAAE;AACxD,EAAA;EAEA,IAAIC,YAAAA,GAAe;IACjB,OAAO,IAAI,CAACH,OAAO,CAChBI,MAAM,CAAEC,UAAsBC,SAAA,CAAUD,MAAA,CAAA,CAAA,CACxCE,GAAG,CAAEF,MAAe,IAAOA,OAAOG,GAAG,CAAA;AAC1C,EAAA;EAEA,IAAIC,aAAAA,GAAgB;IAClB,OAAO,IAAI,CAACT,OAAO,CAACO,GAAG,CAAEF,MAAe,IAAOA,MAAA,CAAOG,GAAG,CAAA;AAC3D,EAAA;EAGAE,qBAAAA,CAAsBP,YAAsB,EAAE;AAC5C,IAAA,IAAI,CAACH,OAAO,CAACW,OAAO,CAAEN,MAAe,IAAA;MACnC,IAAIF,YAAA,CAAaS,QAAQ,CAACP,MAAA,CAAOG,GAAG,CAAA,EAAG;AACrC,QAAA,IAAI,CAACF,UAAUD,MAAA,CAAA,EAAS;UACtBQ,IAAA,CAAKR,MAAA,CAAA;AACP,QAAA;AACF,MAAA,CAAA,MAAO;AACL,QAAA,IAAIC,UAAUD,MAAA,CAAA,EAAS;UACrBS,IAAA,CAAKT,MAAA,CAAA;AACP,QAAA;AACF,MAAA;AACF,IAAA,CAAA,CAAA;AACF,EAAA;AAAA,EAAA;IAAAU,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,uBAAA,EAAA,CAbCC,MAAA,CAAA,CAAA;AAAA;AAeD,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,kyBAAA,EAmCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,QAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
1
+ {"version":3,"file":"column-visibility.js","sources":["../../../../src/components/collections/table/column-visibility.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles } from '@frontile/theme';\nimport { Dropdown } from '../dropdown';\nimport {\n hide,\n show,\n isVisible\n} from '@universal-ember/table/plugins/column-visibility';\nimport { ColumnVisibilityIcon } from '../../../-private/icons';\nimport type { Table, Column } from './types';\n\ninterface ColumnVisibilitySignature<T> {\n Args: {\n /** Universal-ember table instance */\n tableInstance?: Table<T>;\n /** Size of the column visibility button. @defaultValue 'xs' */\n size?: 'xs' | 'sm' | 'lg' | 'xl';\n };\n Element: HTMLUListElement;\n Blocks: {\n default: [];\n icon: [];\n };\n}\n\nexport default class ColumnVisibility<T> extends Component<\n ColumnVisibilitySignature<T>\n> {\n get styles() {\n const { table } = useStyles();\n return table();\n }\n\n get size() {\n return this.args.size ?? 'xs';\n }\n\n get columns() {\n return this.args.tableInstance?.columns.values() || [];\n }\n\n get selectedKeys() {\n return this.columns\n .filter((column: Column<T>) => isVisible(column))\n .map((column: Column<T>) => column.key);\n }\n\n get allColumnKeys() {\n return this.columns.map((column: Column<T>) => column.key);\n }\n\n handleSelectionChange = (selectedKeys: string[]) => {\n this.columns.forEach((column: Column<T>) => {\n if (selectedKeys.includes(column.key)) {\n if (!isVisible(column)) {\n show(column);\n }\n } else {\n if (isVisible(column)) {\n hide(column);\n }\n }\n });\n };\n\n <template>\n <Dropdown @closeOnItemSelect={{false}} ...attributes>\n <:default as |d|>\n <d.Trigger\n data-part=\"column-visibility-button\"\n @color=\"neutral\"\n @size={{this.size}}\n @class={{(this.styles.columnVisibilityButton)}}\n >\n\n {{#if (has-block \"icon\")}}\n {{yield to=\"icon\"}}\n {{else}}\n <ColumnVisibilityIcon\n data-part=\"column-visibility-icon\"\n class={{(this.styles.columnVisibilityIcon)}}\n />\n {{/if}}\n {{yield}}\n </d.Trigger>\n\n <d.Menu\n @selectionMode=\"multiple\"\n @selectedKeys={{this.selectedKeys}}\n @onSelectionChange={{this.handleSelectionChange}}\n as |Item|\n >\n {{#each @tableInstance.columns as |column|}}\n <Item @key={{column.key}}>\n {{column.name}}\n </Item>\n {{/each}}\n </d.Menu>\n </:default>\n </Dropdown>\n </template>\n}\n"],"names":["ColumnVisibility","Component","styles","table","useStyles","size","args","columns","tableInstance","values","selectedKeys","filter","column","isVisible","map","key","allColumnKeys","handleSelectionChange","forEach","includes","show","hide","setComponentTemplate","precompileTemplate","strictMode","scope","Dropdown","ColumnVisibilityIcon"],"mappings":";;;;;;;;AAyBe,MAAMA,gBAAA,SAA4BC,SAAA,CACrB;EAE1B,IAAIC,MAAAA,GAAS;IACX,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;IAClB,OAAOD,KAAA,EAAA;AACT,EAAA;EAEA,IAAIE,IAAAA,GAAO;AACT,IAAA,OAAO,IAAI,CAACC,IAAI,CAACD,IAAI,IAAI,IAAA;AAC3B,EAAA;EAEA,IAAIE,OAAAA,GAAU;AACZ,IAAA,OAAO,IAAI,CAACD,IAAI,CAACE,aAAa,EAAED,OAAA,CAAQE,YAAY,EAAE;AACxD,EAAA;EAEA,IAAIC,YAAAA,GAAe;IACjB,OAAO,IAAI,CAACH,OAAO,CAChBI,MAAM,CAAEC,UAAsBC,SAAA,CAAUD,MAAA,CAAA,CAAA,CACxCE,GAAG,CAAEF,MAAe,IAAOA,OAAOG,GAAG,CAAA;AAC1C,EAAA;EAEA,IAAIC,aAAAA,GAAgB;IAClB,OAAO,IAAI,CAACT,OAAO,CAACO,GAAG,CAAEF,MAAe,IAAOA,MAAA,CAAOG,GAAG,CAAA;AAC3D,EAAA;EAEAE,qBAAA,GAAyBP,YAAoB,IAAA;AAC3C,IAAA,IAAI,CAACH,OAAO,CAACW,OAAO,CAAEN,MAAe,IAAA;MACnC,IAAIF,YAAA,CAAaS,QAAQ,CAACP,MAAA,CAAOG,GAAG,CAAA,EAAG;AACrC,QAAA,IAAI,CAACF,UAAUD,MAAA,CAAA,EAAS;UACtBQ,IAAA,CAAKR,MAAA,CAAA;AACP,QAAA;AACF,MAAA,CAAA,MAAO;AACL,QAAA,IAAIC,UAAUD,MAAA,CAAA,EAAS;UACrBS,IAAA,CAAKT,MAAA,CAAA;AACP,QAAA;AACF,MAAA;AACF,IAAA,CAAA,CAAA;EACF,CAAA;AAEA,EAAA;IAAAU,oBAAA,CAAAC,kBAAA,CAAA,kyBAAA,EAmCA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,QAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;"}
@@ -1,32 +1,24 @@
1
1
  import Component from '@glimmer/component';
2
- import { action } from '@ember/object';
3
2
  import { on } from '@ember/modifier';
4
3
  import { FormControl } from './form-control.js';
5
4
  import { useStyles } from '@frontile/theme';
6
5
  import { precompileTemplate } from '@ember/template-compilation';
7
6
  import { setComponentTemplate } from '@ember/component';
8
- import { a as decorateMethodV2 } from '../../runtime--fcdnjmJ-BOdRhmsS.js';
9
7
 
10
8
  class Checkbox extends Component {
11
9
  get isChecked() {
12
10
  return !!this.args.checked;
13
11
  }
14
- handleChange(event) {
12
+ handleChange = event => {
15
13
  event.preventDefault();
16
14
  const value = !this.args.checked;
17
15
  if (typeof this.args.onChange === 'function') {
18
16
  this.args.onChange(value, event);
19
17
  }
20
- }
21
- static {
22
- decorateMethodV2(this.prototype, "handleChange", [action]);
23
- }
24
- handleBlur() {
18
+ };
19
+ handleBlur = () => {
25
20
  this.args.onBlur?.();
26
- }
27
- static {
28
- decorateMethodV2(this.prototype, "handleBlur", [action]);
29
- }
21
+ };
30
22
  get classes() {
31
23
  const {
32
24
  checkbox
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sources":["../../../src/components/forms/checkbox.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 CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Whether the checkbox is checked. Pair with `onChange` to control the\n * checkbox; leave it unset to let the element track its own state.\n */\n checked?: boolean;\n\n /**\n * The name attribute of the underlying input, used when the checkbox is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the checkbox and its label.\n *\n * @defaultValue 'md'\n */\n size?: CheckboxVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<CheckboxSlots>;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: boolean, event: Event) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface CheckboxSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n @action handleChange(event: Event): void {\n event.preventDefault();\n\n const value = !this.args.checked;\n\n if (typeof this.args.onChange === 'function') {\n this.args.onChange(value, event);\n }\n }\n\n @action handleBlur(): void {\n this.args.onBlur?.();\n }\n\n get classes() {\n const { checkbox } = useStyles();\n return checkbox({\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=\"checkbox\"\n data-part=\"base\"\n as |c|\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\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 <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 { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","preventDefault","value","onChange","n","prototype","action","handleBlur","onBlur","classes","checkbox","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;;;AAoDA,MAAMA,iBAAiBC,SAAA,CAAU;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B,EAAA;EAEQC,YAAAA,CAAaC,KAAY,EAAQ;IACvCA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,QAAQ,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,KAAA,EAAOF,KAAA,CAAA;AAC5B,IAAA;AACF,EAAA;AAAA,EAAA;IAAAI,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CARCC,MAAA,CAAA,CAAA;AAAA;AAUOC,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;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAA,CAAS;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACf,IAAI,CAACe;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,whCAAA,EA8CA;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":"checkbox.js","sources":["../../../src/components/forms/checkbox.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { on } from '@ember/modifier';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport {\n useStyles,\n type CheckboxVariants,\n type CheckboxSlots,\n type SlotsToClasses\n} from '@frontile/theme';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * Whether the checkbox is checked. Pair with `onChange` to control the\n * checkbox; leave it unset to let the element track its own state.\n */\n checked?: boolean;\n\n /**\n * The name attribute of the underlying input, used when the checkbox is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the checkbox and its label.\n *\n * @defaultValue 'md'\n */\n size?: CheckboxVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<CheckboxSlots>;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: boolean, event: Event) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface CheckboxSignature {\n Args: Args;\n Element: HTMLInputElement;\n}\n\nclass Checkbox extends Component<CheckboxSignature> {\n get isChecked(): boolean {\n return !!this.args.checked;\n }\n\n handleChange = (event: Event): void => {\n event.preventDefault();\n\n const value = !this.args.checked;\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 { checkbox } = useStyles();\n return checkbox({\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=\"checkbox\"\n data-part=\"base\"\n as |c|\n >\n <input\n {{on \"change\" this.handleChange}}\n {{on \"blur\" this.handleBlur}}\n id={{c.id}}\n name={{@name}}\n checked={{this.isChecked}}\n type=\"checkbox\"\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 <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 { Checkbox, type CheckboxSignature };\nexport default Checkbox;\n"],"names":["Checkbox","Component","isChecked","args","checked","handleChange","event","preventDefault","value","onChange","handleBlur","onBlur","classes","checkbox","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on"],"mappings":";;;;;;;AAmDA,MAAMA,iBAAiBC,SAAA,CAAU;EAC/B,IAAIC,SAAAA,GAAqB;AACvB,IAAA,OAAO,CAAC,CAAC,IAAI,CAACC,IAAI,CAACC,OAAO;AAC5B,EAAA;EAEAC,YAAA,GAAgBC,KAAO,IAAY;IACjCA,KAAA,CAAMC,cAAc,EAAA;AAEpB,IAAA,MAAMC,QAAQ,CAAC,IAAI,CAACL,IAAI,CAACC,OAAO;IAEhC,IAAI,OAAO,IAAI,CAACD,IAAI,CAACM,QAAQ,KAAK,UAAA,EAAY;MAC5C,IAAI,CAACN,IAAI,CAACM,QAAQ,CAACD,KAAA,EAAOF,KAAA,CAAA;AAC5B,IAAA;EACF,CAAA;EAEAI,UAAA,GAAaA,MAAQ;AACnB,IAAA,IAAI,CAACP,IAAI,CAACQ,MAAM,IAAA;EAClB,CAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAU,GAAGC,SAAA,EAAA;AACrB,IAAA,OAAOD,QAAA,CAAS;AACdE,MAAAA,IAAA,EAAM,IAAI,CAACZ,IAAI,CAACY;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,whCAAA,EA8CA;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,7 @@
1
- import { isSegment, displaySegment, resolveTwoDigitYear, withValue } from './segments.js';
1
+ import { isSegment, displaySegment, resolveTwoDigitYear, withValue, findSegment, hourOnCycle } from './segments.js';
2
2
 
3
3
  const ISO_DAY = /^(\d{4})-(\d{2})-(\d{2})$/;
4
+ const ISO_DATE_TIME = /^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::\d{2}(?:\.\d+)?)?$/;
4
5
 
5
6
  /** The digits destined for each segment, keyed by type. */
6
7
 
@@ -47,6 +48,59 @@ function fill(parts, digits) {
47
48
  return filled === 0 ? null : next;
48
49
  }
49
50
 
51
+ /**
52
+ * The time segments' digits for a 0-23 hour and a minute, as this field's
53
+ * hour cycle counts them. Segments the field does not have get nothing.
54
+ */
55
+ function clockDigits(parts, hours, minutes) {
56
+ const hour = findSegment(parts, 'hour');
57
+ if (!hour) return {};
58
+ return {
59
+ hour: String(hourOnCycle(hours, hour.hourCycle ?? 'h23')),
60
+ minute: String(minutes),
61
+ dayPeriod: hours < 12 ? '0' : '1'
62
+ };
63
+ }
64
+
65
+ /**
66
+ * Which of a textual segment's labels the text names -- AM or PM -- as its
67
+ * value, or `undefined`. Besides the locale's own labels, a Latin `am`/`pm`
68
+ * (dotted or not) is understood, which is how most pasted times spell it.
69
+ */
70
+ function dayPeriodIn(text, segment) {
71
+ const lower = text.toLocaleLowerCase();
72
+ const index = (segment.labels ?? []).findIndex(label => label !== '' && lower.includes(label.toLocaleLowerCase()));
73
+ if (index !== -1) return String(index);
74
+ const latin = /(?:^|[^a-z])([ap])\.?\s*m\.?(?![a-z])/i.exec(text);
75
+ if (latin) return latin[1]?.toLowerCase() === 'a' ? '0' : '1';
76
+ return undefined;
77
+ }
78
+
79
+ /**
80
+ * Settles AM/PM for a positional paste. The text's own AM/PM wins; failing
81
+ * that, an hour past the 12-hour clock's end is read as a 24-hour one, so
82
+ * `21:30` pasted into an en-US field lands as 9:30 PM rather than refused.
83
+ */
84
+ function withDayPeriod(text, parts, digits) {
85
+ const dayPeriod = findSegment(parts, 'dayPeriod');
86
+ const hour = findSegment(parts, 'hour');
87
+ if (!dayPeriod) return digits;
88
+ const named = dayPeriodIn(text, dayPeriod);
89
+ if (named !== undefined) return {
90
+ ...digits,
91
+ dayPeriod: named
92
+ };
93
+ const typed = digits.hour === undefined ? NaN : Number(digits.hour);
94
+ if (hour && typed > hour.max && typed <= 23) {
95
+ return {
96
+ ...digits,
97
+ hour: String(hourOnCycle(typed, hour.hourCycle ?? 'h12')),
98
+ dayPeriod: '1'
99
+ };
100
+ }
101
+ return digits;
102
+ }
103
+
50
104
  /** Maps digit groups onto the segments in their rendered order. */
51
105
  function byPosition(segments, groups) {
52
106
  if (groups.length === 0 || groups.length > segments.length) return null;
@@ -71,7 +125,19 @@ function parsePasted(text, parts) {
71
125
  const trimmed = text.trim();
72
126
  if (trimmed === '') return null;
73
127
 
74
- // 1. ISO, which is unambiguous and so outranks the locale's own order.
128
+ // 1. ISO, which is unambiguous and so outranks the locale's own order. A
129
+ // day alone fills the date and leaves any time as it was.
130
+ const isoTime = ISO_DATE_TIME.exec(trimmed);
131
+ if (isoTime) {
132
+ const [, year, month, day, hours, minutes] = isoTime;
133
+ if (Number(hours) > 23 || Number(minutes) > 59) return null;
134
+ return fill(parts, {
135
+ year,
136
+ month,
137
+ day,
138
+ ...clockDigits(parts, Number(hours), Number(minutes))
139
+ });
140
+ }
75
141
  const iso = ISO_DAY.exec(trimmed);
76
142
  if (iso) {
77
143
  const [, year, month, day] = iso;
@@ -81,7 +147,10 @@ function parsePasted(text, parts) {
81
147
  day
82
148
  });
83
149
  }
84
- const segments = parts.filter(isSegment);
150
+
151
+ // Positional reading maps digits, so only the numeric segments take part;
152
+ // AM/PM is read from the text's words afterwards.
153
+ const segments = parts.filter(isSegment).filter(s => !s.labels);
85
154
 
86
155
  // 2. A bare digit run, split by each segment's width. Checked before the
87
156
  // separated form, because an unseparated run also splits into a single
@@ -99,14 +168,14 @@ function parsePasted(text, parts) {
99
168
  // where the last number was meant to stop.
100
169
  if (at !== trimmed.length) return null;
101
170
  const digits = byPosition(segments, widths);
102
- return digits ? fill(parts, digits) : null;
171
+ return digits ? fill(parts, withDayPeriod(trimmed, parts, digits)) : null;
103
172
  }
104
173
 
105
174
  // 3. Separated numbers, mapped positionally onto the locale's order. Fewer
106
175
  // groups than segments is a partial date and fills a prefix of them.
107
176
  const groups = trimmed.split(/\D+/).filter(Boolean);
108
177
  const digits = byPosition(segments, groups);
109
- if (digits) return fill(parts, digits);
178
+ if (digits) return fill(parts, withDayPeriod(trimmed, parts, digits));
110
179
  return null;
111
180
  }
112
181