frontile 0.18.0-beta.1 → 0.18.0-beta.2

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 (164) hide show
  1. package/declarations/-private/deprecated-args.d.ts +18 -0
  2. package/declarations/-private/notification.d.ts +4 -4
  3. package/declarations/-private/types.d.ts +10 -8
  4. package/declarations/components/buttons/button-group.d.ts +3 -1
  5. package/declarations/components/buttons/button.d.ts +12 -3
  6. package/declarations/components/buttons/chip.d.ts +15 -8
  7. package/declarations/components/buttons/close-button.d.ts +5 -2
  8. package/declarations/components/buttons/segmented-control/segmented-control.d.ts +9 -9
  9. package/declarations/components/buttons/toggle-button.d.ts +9 -1
  10. package/declarations/components/collections/calendar/calendar.d.ts +49 -49
  11. package/declarations/components/collections/calendar/utils.d.ts +1 -0
  12. package/declarations/components/collections/dropdown/dropdown.d.ts +13 -2
  13. package/declarations/components/collections/dropdown/menu-context.d.ts +3 -3
  14. package/declarations/components/collections/listbox/group.d.ts +7 -2
  15. package/declarations/components/collections/listbox/item.d.ts +27 -6
  16. package/declarations/components/collections/listbox/listbox.d.ts +31 -4
  17. package/declarations/components/collections/simple-table/body.d.ts +68 -68
  18. package/declarations/components/collections/simple-table/cell.d.ts +68 -68
  19. package/declarations/components/collections/simple-table/column.d.ts +68 -68
  20. package/declarations/components/collections/simple-table/footer.d.ts +68 -68
  21. package/declarations/components/collections/simple-table/header.d.ts +68 -68
  22. package/declarations/components/collections/simple-table/index.d.ts +68 -68
  23. package/declarations/components/collections/simple-table/row.d.ts +68 -68
  24. package/declarations/components/collections/table/column-visibility.d.ts +68 -68
  25. package/declarations/components/collections/table/sort-button.d.ts +68 -68
  26. package/declarations/components/collections/table/table.d.ts +68 -68
  27. package/declarations/components/disclosure/accordion/accordion.d.ts +23 -23
  28. package/declarations/components/forms/autocomplete.d.ts +24 -12
  29. package/declarations/components/forms/date-picker/date-picker.d.ts +268 -0
  30. package/declarations/components/forms/date-picker/end-content.d.ts +29 -0
  31. package/declarations/components/forms/date-picker/trigger.d.ts +40 -0
  32. package/declarations/components/forms/date-picker/types.d.ts +149 -0
  33. package/declarations/components/forms/date-picker/value.d.ts +43 -0
  34. package/declarations/components/forms/date-picker.d.ts +3 -0
  35. package/declarations/components/forms/field.d.ts +5 -0
  36. package/declarations/components/forms/form-control.d.ts +1 -1
  37. package/declarations/components/forms/form-feedback.d.ts +17 -2
  38. package/declarations/components/forms/icons.d.ts +4 -1
  39. package/declarations/components/forms/index.d.ts +2 -0
  40. package/declarations/components/forms/input.d.ts +10 -10
  41. package/declarations/components/forms/native-select.d.ts +7 -7
  42. package/declarations/components/forms/select/select.d.ts +30 -17
  43. package/declarations/components/forms/select/types.d.ts +42 -12
  44. package/declarations/components/forms/switch.d.ts +22 -18
  45. package/declarations/components/forms/textarea.d.ts +6 -6
  46. package/declarations/components/navigation/pagination/pagination.d.ts +18 -18
  47. package/declarations/components/navigation/tab-nav/tab-nav.d.ts +12 -12
  48. package/declarations/components/navigation/tabs/tabs.d.ts +12 -12
  49. package/declarations/components/notifications/index.d.ts +2 -2
  50. package/declarations/components/notifications/notification-card.d.ts +5 -5
  51. package/declarations/components/notifications/notifications-container.d.ts +2 -2
  52. package/declarations/components/overlays/drawer.d.ts +32 -32
  53. package/declarations/components/overlays/popover.d.ts +1 -1
  54. package/declarations/components/overlays/tooltip.d.ts +2 -2
  55. package/declarations/components/status/alert.d.ts +10 -10
  56. package/declarations/components/status/progress-bar.d.ts +5 -1
  57. package/declarations/components/utilities/kbd.d.ts +4 -4
  58. package/declarations/components/utilities/spinner.d.ts +14 -7
  59. package/declarations/index.d.ts +1 -1
  60. package/declarations/template-registry.d.ts +2 -1
  61. package/dist/components/buttons/button-group.js +26 -1
  62. package/dist/components/buttons/button-group.js.map +1 -1
  63. package/dist/components/buttons/button.js +21 -2
  64. package/dist/components/buttons/button.js.map +1 -1
  65. package/dist/components/buttons/chip.js +19 -2
  66. package/dist/components/buttons/chip.js.map +1 -1
  67. package/dist/components/buttons/close-button.js +17 -1
  68. package/dist/components/buttons/close-button.js.map +1 -1
  69. package/dist/components/buttons/segmented-control/segmented-control.js +1 -1
  70. package/dist/components/buttons/segmented-control/segmented-control.js.map +1 -1
  71. package/dist/components/buttons/toggle-button.js +36 -2
  72. package/dist/components/buttons/toggle-button.js.map +1 -1
  73. package/dist/components/collections/calendar/calendar.js +36 -3
  74. package/dist/components/collections/calendar/calendar.js.map +1 -1
  75. package/dist/components/collections/calendar/utils.js +1 -1
  76. package/dist/components/collections/calendar/utils.js.map +1 -1
  77. package/dist/components/collections/command/footer.js +1 -1
  78. package/dist/components/collections/command/footer.js.map +1 -1
  79. package/dist/components/collections/command/list.js +1 -1
  80. package/dist/components/collections/command/list.js.map +1 -1
  81. package/dist/components/collections/dropdown/dropdown.js +45 -7
  82. package/dist/components/collections/dropdown/dropdown.js.map +1 -1
  83. package/dist/components/collections/dropdown/menu-context.js.map +1 -1
  84. package/dist/components/collections/listbox/group.js +1 -1
  85. package/dist/components/collections/listbox/group.js.map +1 -1
  86. package/dist/components/collections/listbox/item.js +47 -8
  87. package/dist/components/collections/listbox/item.js.map +1 -1
  88. package/dist/components/collections/listbox/listbox.js +53 -2
  89. package/dist/components/collections/listbox/listbox.js.map +1 -1
  90. package/dist/components/collections/table/column-visibility.js +1 -1
  91. package/dist/components/collections/table/column-visibility.js.map +1 -1
  92. package/dist/components/disclosure/accordion/accordion.js.map +1 -1
  93. package/dist/components/forms/autocomplete.js +47 -2
  94. package/dist/components/forms/autocomplete.js.map +1 -1
  95. package/dist/components/forms/date-picker/date-picker.js +301 -0
  96. package/dist/components/forms/date-picker/date-picker.js.map +1 -0
  97. package/dist/components/forms/date-picker/end-content.js +21 -0
  98. package/dist/components/forms/date-picker/end-content.js.map +1 -0
  99. package/dist/components/forms/date-picker/trigger.js +14 -0
  100. package/dist/components/forms/date-picker/trigger.js.map +1 -0
  101. package/dist/components/forms/date-picker/types.js +2 -0
  102. package/dist/components/forms/date-picker/types.js.map +1 -0
  103. package/dist/components/forms/date-picker/value.js +97 -0
  104. package/dist/components/forms/date-picker/value.js.map +1 -0
  105. package/dist/components/forms/date-picker.js +2 -0
  106. package/dist/components/forms/date-picker.js.map +1 -0
  107. package/dist/components/forms/field.js +3 -1
  108. package/dist/components/forms/field.js.map +1 -1
  109. package/dist/components/forms/form-control.js +1 -1
  110. package/dist/components/forms/form-control.js.map +1 -1
  111. package/dist/components/forms/form-feedback.js +25 -2
  112. package/dist/components/forms/form-feedback.js.map +1 -1
  113. package/dist/components/forms/icons.js +4 -1
  114. package/dist/components/forms/icons.js.map +1 -1
  115. package/dist/components/forms/index.js +2 -0
  116. package/dist/components/forms/index.js.map +1 -1
  117. package/dist/components/forms/input.js +1 -1
  118. package/dist/components/forms/input.js.map +1 -1
  119. package/dist/components/forms/select/end-content.js +1 -1
  120. package/dist/components/forms/select/end-content.js.map +1 -1
  121. package/dist/components/forms/select/select.js +61 -7
  122. package/dist/components/forms/select/select.js.map +1 -1
  123. package/dist/components/forms/select/selected-items.js +1 -1
  124. package/dist/components/forms/select/selected-items.js.map +1 -1
  125. package/dist/components/forms/switch.js +9 -1
  126. package/dist/components/forms/switch.js.map +1 -1
  127. package/dist/components/navigation/pagination/pagination.js +1 -1
  128. package/dist/components/navigation/pagination/pagination.js.map +1 -1
  129. package/dist/components/navigation/tab-nav/tab-nav.js +1 -1
  130. package/dist/components/navigation/tab-nav/tab-nav.js.map +1 -1
  131. package/dist/components/navigation/tabs/tabs.js +1 -1
  132. package/dist/components/navigation/tabs/tabs.js.map +1 -1
  133. package/dist/components/notifications/index.js +2 -2
  134. package/dist/components/notifications/notification-card.js +1 -1
  135. package/dist/components/notifications/notifications-container.js +1 -1
  136. package/dist/components/notifications/notifications-container.js.map +1 -1
  137. package/dist/components/overlays/drawer.js +3 -3
  138. package/dist/components/overlays/drawer.js.map +1 -1
  139. package/dist/components/overlays/popover.js.map +1 -1
  140. package/dist/components/overlays/tooltip.js +1 -1
  141. package/dist/components/overlays/tooltip.js.map +1 -1
  142. package/dist/components/status/alert.js +19 -15
  143. package/dist/components/status/alert.js.map +1 -1
  144. package/dist/components/status/progress-bar.js +9 -1
  145. package/dist/components/status/progress-bar.js.map +1 -1
  146. package/dist/components/utilities/kbd.js +2 -2
  147. package/dist/components/utilities/kbd.js.map +1 -1
  148. package/dist/components/utilities/spinner.js +26 -7
  149. package/dist/components/utilities/spinner.js.map +1 -1
  150. package/dist/deprecated-args-BIUjLA8y.js +32 -0
  151. package/dist/deprecated-args-BIUjLA8y.js.map +1 -0
  152. package/dist/forms.js +2 -0
  153. package/dist/forms.js.map +1 -1
  154. package/dist/index.js +4 -2
  155. package/dist/index.js.map +1 -1
  156. package/dist/{manager-CDIZzrQ9.js → manager-B-PnYqDs.js} +28 -22
  157. package/dist/manager-B-PnYqDs.js.map +1 -0
  158. package/dist/{notification-card-BHTra4Zh.js → notification-card-CYmWQ35W.js} +25 -22
  159. package/dist/notification-card-CYmWQ35W.js.map +1 -0
  160. package/dist/notifications.js +2 -2
  161. package/dist/services/notifications.js +1 -1
  162. package/package.json +3 -3
  163. package/dist/manager-CDIZzrQ9.js.map +0 -1
  164. package/dist/notification-card-BHTra4Zh.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"field.js","sources":["../../../src/components/forms/field.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { action, get } from '@ember/object';\nimport { debounce } from '@ember/runloop';\nimport Checkbox from './checkbox';\nimport CheckboxGroup from './checkbox-group';\nimport Input from './input';\nimport InputOtp from './input-otp';\nimport Radio from './radio';\nimport RadioGroup from './radio-group';\nimport Select from './select';\nimport Switch from './switch';\nimport Textarea from './textarea';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { FormDataCompiled, FormErrors } from './form';\nimport type { SelectSignature } from './select';\nimport type { WithBoundArgsForSignature } from './field-types';\n\ntype BoundSingleSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'name' | 'errors' | 'selectedKey' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundMultiSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'selectionMode' | 'name' | 'errors' | 'selectedKeys' | 'onBlur' | 'isDisabled'\n>;\n\ninterface FieldSignature<T extends Record<string, unknown> = FormDataCompiled> {\n Element: HTMLElement;\n Args: {\n /** The name of the form field. */\n name: string;\n /** The validation errors for the form, keyed by field name. */\n errors?: FormErrors;\n /** The form data as key/value pairs. */\n formData?: T;\n /** Whether the field should be disabled. */\n disabled?: boolean;\n /** When to run validation. */\n validateOn?: ('change' | 'input' | 'blur')[];\n /** Function to validate a single field by name. */\n validateField?: (data: T, name: string) => Promise<FormErrors | undefined>;\n };\n Blocks: {\n default: [\n {\n Checkbox: WithBoundArgs<\n typeof Checkbox,\n 'name' | 'errors' | 'checked' | 'onChange' | 'onBlur' | 'isDisabled'\n >;\n CheckboxGroup: WithBoundArgs<\n typeof CheckboxGroup,\n 'name' | 'errors' | 'isDisabled'\n >;\n Input: WithBoundArgs<\n typeof Input,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n InputOtp: WithBoundArgs<\n typeof InputOtp,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n Radio: WithBoundArgs<\n typeof Radio,\n | 'name'\n | 'errors'\n | 'checkedValue'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n RadioGroup: WithBoundArgs<\n typeof RadioGroup,\n 'name' | 'errors' | 'value' | 'onChange' | 'isDisabled'\n >;\n SingleSelect: BoundSingleSelect;\n MultiSelect: BoundMultiSelect;\n Switch: WithBoundArgs<\n typeof Switch,\n | 'name'\n | 'errors'\n | 'isSelected'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n Textarea: WithBoundArgs<\n typeof Textarea,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n }\n ];\n };\n}\n\n/**\n * Field is a component wrapper that provides conveniences for form fields.\n * It automatically binds the appropriate form errors by name to yielded\n * components.\n */\nclass Field<\n T extends Record<string, unknown> = FormDataCompiled\n> extends Component<FieldSignature<T>> {\n /**\n * Returns the validation errors for the field.\n * Supports dotted field names (e.g., 'profile.email').\n */\n get fieldErrors() {\n return this.args.errors?.[this.args.name];\n }\n\n /** The events on which validation should run. Defaults to ['change']. */\n get validateOn(): ('change' | 'input' | 'blur')[] {\n return this.args.validateOn ?? ['change'];\n }\n\n /**\n * Returns the current value for the field from formData.\n * Supports both flat and dotted field names (e.g., 'email' or 'profile.email').\n * Uses Ember's get() which handles both flat keys and dotted paths.\n */\n get fieldValue() {\n if (!this.args.formData) return undefined;\n\n // Ember's get() handles both flat keys and dotted paths correctly\n return get(this.args.formData, this.args.name);\n }\n\n /**\n * Validates the field by calling the validateField function passed in args.\n */\n validateField() {\n this.args.validateField?.(this.args.formData as T, this.args.name);\n }\n\n /**\n * Validates the field on change if change validation is enabled.\n */\n @action\n handleChange() {\n if (this.validateOn?.includes('change')) {\n this.validateField();\n }\n }\n\n /**\n * Validates the field on input if input validation is enabled.\n * Debounces validation to avoid excessive validation calls on every keystroke.\n */\n @action\n handleInput() {\n if (this.validateOn?.includes('input')) {\n debounce(this, this.validateField, 300);\n }\n }\n\n /**\n * Validates the field on blur if blur validation is enabled.\n */\n @action\n handleBlur() {\n if (this.validateOn.includes('blur')) {\n this.validateField();\n }\n }\n\n <template>\n {{! @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite }}\n {{yield\n (hash\n Checkbox=(component\n Checkbox\n name=@name\n errors=this.fieldErrors\n checked=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n CheckboxGroup=(component\n CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled\n )\n Input=(component\n Input\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n InputOtp=(component\n InputOtp\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n Radio=(component\n Radio\n name=@name\n errors=this.fieldErrors\n checkedValue=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n RadioGroup=(component\n RadioGroup\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n )\n SingleSelect=(component\n Select\n name=@name\n errors=this.fieldErrors\n selectedKey=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n MultiSelect=(component\n Select\n selectionMode=\"multiple\"\n name=@name\n errors=this.fieldErrors\n selectedKeys=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n Switch=(component\n Switch\n name=@name\n errors=this.fieldErrors\n isSelected=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n Textarea=(component\n Textarea\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n )\n to=\"default\"\n }}\n </template>\n}\n\nexport { Field, type FieldSignature };\nexport default Field;\n"],"names":["Field","Component","fieldErrors","args","errors","name","validateOn","fieldValue","formData","undefined","get","validateField","handleChange","includes","n","prototype","action","handleInput","debounce","handleBlur","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Checkbox","CheckboxGroup","Input","InputOtp","Radio","RadioGroup","Select","Switch","Textarea"],"mappings":";;;;;;;;;;;;;;;;;AAmHA;;;;;AAKA,MAAMA,KAAA,SAEIC,SAAA,CAAyB;AACjC;;;AAGC;EACD,IAAIC,WAAAA,GAAc;IAChB,OAAO,IAAI,CAAC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C,MAAA,CAAA,EAAS;MACpC,IAAI,CAACF,aAAa,EAAA;AACpB,IAAA;AACF,EAAA;AAAA,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CALCC,MAAA,CAAA,CAAA;AAAA;AAOD,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,4sDAAA,EA4FA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,QAAA;QAAAC,aAAA;QAAAC,KAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,UAAA;QAAAC,MAAA;QAAAC,MAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"field.js","sources":["../../../src/components/forms/field.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { hash } from '@ember/helper';\nimport { action, get } from '@ember/object';\nimport { debounce } from '@ember/runloop';\nimport Checkbox from './checkbox';\nimport CheckboxGroup from './checkbox-group';\nimport DatePicker from './date-picker';\nimport Input from './input';\nimport InputOtp from './input-otp';\nimport Radio from './radio';\nimport RadioGroup from './radio-group';\nimport Select from './select';\nimport Switch from './switch';\nimport Textarea from './textarea';\n\nimport type { WithBoundArgs } from '@glint/template';\nimport type { FormDataCompiled, FormErrors } from './form';\nimport type { DatePickerSignature } from './date-picker';\nimport type { SelectSignature } from './select';\nimport type { WithBoundArgsForSignature } from './field-types';\n\ntype BoundSingleSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'name' | 'errors' | 'selectedKey' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundMultiSelect<S = unknown> = WithBoundArgsForSignature<\n SelectSignature<S>,\n 'selectionMode' | 'name' | 'errors' | 'selectedKeys' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDatePicker = WithBoundArgsForSignature<\n DatePickerSignature<'single'>,\n 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ntype BoundDateRangePicker = WithBoundArgsForSignature<\n DatePickerSignature<'range'>,\n 'mode' | 'name' | 'errors' | 'value' | 'onBlur' | 'isDisabled'\n>;\n\ninterface FieldSignature<T extends Record<string, unknown> = FormDataCompiled> {\n Element: HTMLElement;\n Args: {\n /** The name of the form field. */\n name: string;\n /** The validation errors for the form, keyed by field name. */\n errors?: FormErrors;\n /** The form data as key/value pairs. */\n formData?: T;\n /** Whether the field should be disabled. */\n disabled?: boolean;\n /** When to run validation. */\n validateOn?: ('change' | 'input' | 'blur')[];\n /** Function to validate a single field by name. */\n validateField?: (data: T, name: string) => Promise<FormErrors | undefined>;\n };\n Blocks: {\n default: [\n {\n Checkbox: WithBoundArgs<\n typeof Checkbox,\n 'name' | 'errors' | 'checked' | 'onChange' | 'onBlur' | 'isDisabled'\n >;\n CheckboxGroup: WithBoundArgs<\n typeof CheckboxGroup,\n 'name' | 'errors' | 'isDisabled'\n >;\n Input: WithBoundArgs<\n typeof Input,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n InputOtp: WithBoundArgs<\n typeof InputOtp,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n Radio: WithBoundArgs<\n typeof Radio,\n | 'name'\n | 'errors'\n | 'checkedValue'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n RadioGroup: WithBoundArgs<\n typeof RadioGroup,\n 'name' | 'errors' | 'value' | 'onChange' | 'isDisabled'\n >;\n SingleSelect: BoundSingleSelect;\n MultiSelect: BoundMultiSelect;\n DatePicker: BoundDatePicker;\n DateRangePicker: BoundDateRangePicker;\n Switch: WithBoundArgs<\n typeof Switch,\n | 'name'\n | 'errors'\n | 'isSelected'\n | 'onChange'\n | 'onBlur'\n | 'isDisabled'\n >;\n Textarea: WithBoundArgs<\n typeof Textarea,\n | 'name'\n | 'errors'\n | 'value'\n | 'onChange'\n | 'onInput'\n | 'onBlur'\n | 'isDisabled'\n >;\n }\n ];\n };\n}\n\n/**\n * Field is a component wrapper that provides conveniences for form fields.\n * It automatically binds the appropriate form errors by name to yielded\n * components.\n */\nclass Field<\n T extends Record<string, unknown> = FormDataCompiled\n> extends Component<FieldSignature<T>> {\n /**\n * Returns the validation errors for the field.\n * Supports dotted field names (e.g., 'profile.email').\n */\n get fieldErrors() {\n return this.args.errors?.[this.args.name];\n }\n\n /** The events on which validation should run. Defaults to ['change']. */\n get validateOn(): ('change' | 'input' | 'blur')[] {\n return this.args.validateOn ?? ['change'];\n }\n\n /**\n * Returns the current value for the field from formData.\n * Supports both flat and dotted field names (e.g., 'email' or 'profile.email').\n * Uses Ember's get() which handles both flat keys and dotted paths.\n */\n get fieldValue() {\n if (!this.args.formData) return undefined;\n\n // Ember's get() handles both flat keys and dotted paths correctly\n return get(this.args.formData, this.args.name);\n }\n\n /**\n * Validates the field by calling the validateField function passed in args.\n */\n validateField() {\n this.args.validateField?.(this.args.formData as T, this.args.name);\n }\n\n /**\n * Validates the field on change if change validation is enabled.\n */\n @action\n handleChange() {\n if (this.validateOn?.includes('change')) {\n this.validateField();\n }\n }\n\n /**\n * Validates the field on input if input validation is enabled.\n * Debounces validation to avoid excessive validation calls on every keystroke.\n */\n @action\n handleInput() {\n if (this.validateOn?.includes('input')) {\n debounce(this, this.validateField, 300);\n }\n }\n\n /**\n * Validates the field on blur if blur validation is enabled.\n */\n @action\n handleBlur() {\n if (this.validateOn.includes('blur')) {\n this.validateField();\n }\n }\n\n <template>\n {{! @glint-nocheck component generics (radio, radio-group, select) trigger: type instantiation is excessively deep and possibly infinite }}\n {{yield\n (hash\n Checkbox=(component\n Checkbox\n name=@name\n errors=this.fieldErrors\n checked=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n CheckboxGroup=(component\n CheckboxGroup name=@name errors=this.fieldErrors isDisabled=@disabled\n )\n Input=(component\n Input\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n InputOtp=(component\n InputOtp\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n Radio=(component\n Radio\n name=@name\n errors=this.fieldErrors\n checkedValue=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n RadioGroup=(component\n RadioGroup\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n )\n SingleSelect=(component\n Select\n name=@name\n errors=this.fieldErrors\n selectedKey=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n MultiSelect=(component\n Select\n selectionMode=\"multiple\"\n name=@name\n errors=this.fieldErrors\n selectedKeys=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DatePicker=(component\n DatePicker\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n DateRangePicker=(component\n DatePicker\n mode=\"range\"\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onBlur=this.handleBlur\n )\n Switch=(component\n Switch\n name=@name\n errors=this.fieldErrors\n isSelected=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onBlur=this.handleBlur\n )\n Textarea=(component\n Textarea\n name=@name\n errors=this.fieldErrors\n value=this.fieldValue\n isDisabled=@disabled\n onChange=this.handleChange\n onInput=this.handleInput\n onBlur=this.handleBlur\n )\n )\n to=\"default\"\n }}\n </template>\n}\n\nexport { Field, type FieldSignature };\nexport default Field;\n"],"names":["Field","Component","fieldErrors","args","errors","name","validateOn","fieldValue","formData","undefined","get","validateField","handleChange","includes","n","prototype","action","handleInput","debounce","handleBlur","setComponentTemplate","precompileTemplate","strictMode","scope","hash","Checkbox","CheckboxGroup","Input","InputOtp","Radio","RadioGroup","Select","DatePicker","Switch","Textarea"],"mappings":";;;;;;;;;;;;;;;;;;AAiIA;;;;;AAKA,MAAMA,KAAA,SAEIC,SAAA,CAAyB;AACjC;;;AAGC;EACD,IAAIC,WAAAA,GAAc;IAChB,OAAO,IAAI,CAACC,IAAI,CAACC,MAAM,GAAG,IAAI,CAACD,IAAI,CAACE,IAAI,CAAC;AAC3C,EAAA;AAEA;EACA,IAAIC,UAAAA,GAA8C;IAChD,OAAO,IAAI,CAACH,IAAI,CAACG,UAAU,IAAI,CAAC,QAAA,CAAS;AAC3C,EAAA;AAEA;;;;AAIC;EACD,IAAIC,UAAAA,GAAa;IACf,IAAI,CAAC,IAAI,CAACJ,IAAI,CAACK,QAAQ,EAAE,OAAOC,SAAA;AAEhC;AACA,IAAA,OAAOC,GAAA,CAAI,IAAI,CAACP,IAAI,CAACK,QAAQ,EAAE,IAAI,CAACL,IAAI,CAACE,IAAI,CAAA;AAC/C,EAAA;AAEA;;AAEC;AACDM,EAAAA,aAAAA,GAAgB;AACd,IAAA,IAAI,CAACR,IAAI,CAACQ,aAAa,GAAG,IAAI,CAACR,IAAI,CAACK,QAAQ,EAAO,IAAI,CAACL,IAAI,CAACE,IAAI,CAAA;AACnE,EAAA;AAEA;;AAEC;AAEDO,EAAAA,YAAAA,GAAe;IACb,IAAI,IAAI,CAACN,UAAU,EAAEO,SAAS,QAAA,CAAA,EAAW;MACvC,IAAI,CAACF,aAAa,EAAA;AACpB,IAAA;AACF,EAAA;AAEA;;;AAGC;AAHD,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;AAYDC,EAAAA,WAAAA,GAAc;IACZ,IAAI,IAAI,CAACX,UAAU,EAAEO,SAAS,OAAA,CAAA,EAAU;MACtCK,QAAA,CAAS,IAAI,EAAE,IAAI,CAACP,aAAa,EAAE,GAAA,CAAA;AACrC,IAAA;AACF,EAAA;AAEA;;AAEC;AAFD,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,aAAA,EAAA,CAPCC,MAAA,CAAA,CAAA;AAAA;AAWDG,EAAAA,UAAAA,GAAa;IACX,IAAI,IAAI,CAACb,UAAU,CAACO,QAAQ,CAAC,MAAA,CAAA,EAAS;MACpC,IAAI,CAACF,aAAa,EAAA;AACpB,IAAA;AACF,EAAA;AAAA,EAAA;IAAAG,gBAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,YAAA,EAAA,CALCC,MAAA,CAAA,CAAA;AAAA;AAOD,EAAA;IAAAI,oBAAA,CAAAC,kBAAA,CAAA,8+DAAA,EA6GA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,IAAA;QAAAC,QAAA;QAAAC,aAAA;QAAAC,KAAA;QAAAC,QAAA;QAAAC,KAAA;QAAAC,UAAA;QAAAC,MAAA;QAAAC,UAAA;QAAAC,MAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -52,7 +52,7 @@ class FormControl extends Component {
52
52
  return false;
53
53
  }
54
54
  static {
55
- setComponentTemplate(precompileTemplate("<div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield (hash id=this.id isInvalid=this.isInvalid describedBy=this.describedBy Label=(component Label for=this.id size=@size isRequired=@isRequired) Description=(component Description id=this.descriptionId size=@size) Feedback=(component Feedback id=this.feedbackId size=@size messages=@errors intent=\"danger\" announce=false)) to=\"default\"}}\n\n {{#if this.showErrorFeedback}}\n <Feedback @id={{this.feedbackId}} @size={{@size}} @messages={{@errors}} @intent=\"danger\" @announce={{false}} />\n {{/if}}\n\n {{!--\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n --}}\n <VisuallyHidden aria-live=\"assertive\" data-test-id=\"form-feedback-live-region\">{{this.errorMessageText}}</VisuallyHidden>\n</div>", {
55
+ setComponentTemplate(precompileTemplate("<div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield (hash id=this.id isInvalid=this.isInvalid describedBy=this.describedBy Label=(component Label for=this.id size=@size isRequired=@isRequired) Description=(component Description id=this.descriptionId size=@size) Feedback=(component Feedback id=this.feedbackId size=@size messages=@errors status=\"danger\" announce=false)) to=\"default\"}}\n\n {{#if this.showErrorFeedback}}\n <Feedback @id={{this.feedbackId}} @size={{@size}} @messages={{@errors}} @status=\"danger\" @announce={{false}} />\n {{/if}}\n\n {{!--\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n --}}\n <VisuallyHidden aria-live=\"assertive\" data-test-id=\"form-feedback-live-region\">{{this.errorMessageText}}</VisuallyHidden>\n</div>", {
56
56
  strictMode: true,
57
57
  scope: () => ({
58
58
  or,
@@ -1 +1 @@
1
- {"version":3,"file":"form-control.js","sources":["../../../src/components/forms/form-control.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport Feedback, {\n feedbackMessageText,\n type FormFeedbackSignature\n} from './form-feedback';\nimport Description, { type FormDescriptionSignature } from './form-description';\nimport Label, { type LabelSignature } from './label';\nimport VisuallyHidden from '../utilities/visually-hidden';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n /**\n * The label text rendered above the control and associated with it via `for`.\n * Use the `:label` block instead when the label needs markup.\n */\n label?: string;\n\n /**\n * Whether the field is required. Adds an asterisk to the label; it does not\n * set the `required` attribute on the control itself.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n\n /**\n * Help text rendered between the label and the control, and referenced by the\n * ids `describedBy` returns.\n */\n description?: string;\n\n /**\n * Validation messages for the field. A non-empty value also marks the control\n * invalid, and an array is joined with `; ` when displayed.\n */\n errors?: string[] | string;\n\n /**\n * Marks the control invalid without supplying messages, for validation that is\n * reported elsewhere.\n *\n * @defaultValue false\n */\n isInvalid?: boolean;\n\n /**\n * Whether the field is disabled. FormControl passes this through for styling;\n * the control it wraps is responsible for the `disabled` attribute.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The id given to the control, and the base for the description and feedback\n * ids. Generated when omitted, so pass one only when something outside the\n * block has to reference it.\n */\n id?: string;\n\n /**\n * The size of the label, description and feedback text.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Suppresses the automatic error feedback, for when the block renders the\n * yielded `Feedback` itself or places messages elsewhere.\n *\n * @defaultValue false\n */\n preventErrorFeedback?: boolean;\n\n /**\n * Class names for the wrapping element.\n */\n class?: string;\n}\n\ninterface FormControlSignature {\n Args: Args;\n Blocks: {\n default: [\n {\n id: string;\n isInvalid: boolean;\n describedBy: (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ) => string | undefined;\n Label: WithBoundArgs<\n ComponentLike<LabelSignature>,\n 'for' | 'size' | 'isRequired'\n >;\n Description: WithBoundArgs<\n ComponentLike<FormDescriptionSignature>,\n 'id' | 'size'\n >;\n Feedback: WithBoundArgs<\n ComponentLike<FormFeedbackSignature>,\n 'id' | 'size' | 'messages' | 'intent'\n >;\n }\n ];\n label: [];\n description: [];\n };\n Element: HTMLDivElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass FormControl extends Component<FormControlSignature> {\n id = this.args.id || guidFor(this);\n\n get descriptionId(): string {\n return this.id + '-description';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\n describedBy = (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ): string | undefined => {\n const ids = [];\n\n if (hasDescription) {\n ids.push(this.descriptionId);\n }\n\n if (hasFeedback) {\n ids.push(this.feedbackId);\n }\n\n if (ids.length > 0) {\n return ids.join(' ');\n }\n };\n\n get isInvalid(): boolean {\n if (\n this.args.isInvalid ||\n (this.args.errors && this.args.errors.length > 0)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * The error messages as a single string, used by the persistent live region.\n * Uses `FormFeedback`'s own join, so both render the same separator.\n */\n get errorMessageText(): string {\n return feedbackMessageText(this.args.errors);\n }\n\n get showErrorFeedback(): boolean {\n if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {\n return true;\n }\n return false;\n }\n\n <template>\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield\n (hash\n id=this.id\n isInvalid=this.isInvalid\n describedBy=this.describedBy\n Label=(component Label for=this.id size=@size isRequired=@isRequired)\n Description=(component Description id=this.descriptionId size=@size)\n Feedback=(component\n Feedback\n id=this.feedbackId\n size=@size\n messages=@errors\n intent=\"danger\"\n announce=false\n )\n )\n to=\"default\"\n }}\n\n {{#if this.showErrorFeedback}}\n <Feedback\n @id={{this.feedbackId}}\n @size={{@size}}\n @messages={{@errors}}\n @intent=\"danger\"\n @announce={{false}}\n />\n {{/if}}\n\n {{!\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n }}\n <VisuallyHidden\n aria-live=\"assertive\"\n data-test-id=\"form-feedback-live-region\"\n >{{this.errorMessageText}}</VisuallyHidden>\n </div>\n </template>\n}\n\nexport { FormControl, type FormControlSignature, type FormControlSharedArgs };\nexport default FormControl;\n"],"names":["or","arg1","arg2","FormControl","Component","id","args","guidFor","descriptionId","feedbackId","describedBy","hasDescription","hasFeedback","ids","push","length","join","isInvalid","errors","errorMessageText","feedbackMessageText","showErrorFeedback","preventErrorFeedback","setComponentTemplate","precompileTemplate","strictMode","scope","Label","Description","hash","Feedback","VisuallyHidden"],"mappings":";;;;;;;;;;AAoHA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,oBAAoBC,SAAA,CAAU;EAClCC,EAAA,GAAK,IAAI,CAACC,IAAI,CAACD,EAAE,IAAIE,OAAA,CAAQ,IAAI,CAAA;EAEjC,IAAIC,aAAAA,GAAwB;AAC1B,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,cAAA;AACnB,EAAA;EAEA,IAAII,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACJ,EAAE,GAAG,WAAA;AACnB,EAAA;AAEAK,EAAAA,WAAA,GAAcA,CACZC,cAAiC,EACjCC,WAA8B,KACX;IACnB,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"version":3,"file":"form-control.js","sources":["../../../src/components/forms/form-control.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { guidFor } from '@ember/object/internals';\nimport { hash } from '@ember/helper';\nimport Feedback, {\n feedbackMessageText,\n type FormFeedbackSignature\n} from './form-feedback';\nimport Description, { type FormDescriptionSignature } from './form-description';\nimport Label, { type LabelSignature } from './label';\nimport VisuallyHidden from '../utilities/visually-hidden';\nimport type { ComponentLike, WithBoundArgs } from '@glint/template';\n\ninterface FormControlSharedArgs {\n /**\n * The label text rendered above the control and associated with it via `for`.\n * Use the `:label` block instead when the label needs markup.\n */\n label?: string;\n\n /**\n * Whether the field is required. Adds an asterisk to the label; it does not\n * set the `required` attribute on the control itself.\n *\n * @defaultValue false\n */\n isRequired?: boolean;\n\n /**\n * Help text rendered between the label and the control, and referenced by the\n * ids `describedBy` returns.\n */\n description?: string;\n\n /**\n * Validation messages for the field. A non-empty value also marks the control\n * invalid, and an array is joined with `; ` when displayed.\n */\n errors?: string[] | string;\n\n /**\n * Marks the control invalid without supplying messages, for validation that is\n * reported elsewhere.\n *\n * @defaultValue false\n */\n isInvalid?: boolean;\n\n /**\n * Whether the field is disabled. FormControl passes this through for styling;\n * the control it wraps is responsible for the `disabled` attribute.\n *\n * @defaultValue false\n */\n isDisabled?: boolean;\n}\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The id given to the control, and the base for the description and feedback\n * ids. Generated when omitted, so pass one only when something outside the\n * block has to reference it.\n */\n id?: string;\n\n /**\n * The size of the label, description and feedback text.\n *\n * @defaultValue 'md'\n */\n size?: 'sm' | 'md' | 'lg';\n\n /**\n * Suppresses the automatic error feedback, for when the block renders the\n * yielded `Feedback` itself or places messages elsewhere.\n *\n * @defaultValue false\n */\n preventErrorFeedback?: boolean;\n\n /**\n * Class names for the wrapping element.\n */\n class?: string;\n}\n\ninterface FormControlSignature {\n Args: Args;\n Blocks: {\n default: [\n {\n id: string;\n isInvalid: boolean;\n describedBy: (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ) => string | undefined;\n Label: WithBoundArgs<\n ComponentLike<LabelSignature>,\n 'for' | 'size' | 'isRequired'\n >;\n Description: WithBoundArgs<\n ComponentLike<FormDescriptionSignature>,\n 'id' | 'size'\n >;\n Feedback: WithBoundArgs<\n ComponentLike<FormFeedbackSignature>,\n 'id' | 'size' | 'messages' | 'status'\n >;\n }\n ];\n label: [];\n description: [];\n };\n Element: HTMLDivElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass FormControl extends Component<FormControlSignature> {\n id = this.args.id || guidFor(this);\n\n get descriptionId(): string {\n return this.id + '-description';\n }\n\n get feedbackId(): string {\n return this.id + '-feedback';\n }\n\n describedBy = (\n hasDescription?: string | boolean,\n hasFeedback?: string | boolean\n ): string | undefined => {\n const ids = [];\n\n if (hasDescription) {\n ids.push(this.descriptionId);\n }\n\n if (hasFeedback) {\n ids.push(this.feedbackId);\n }\n\n if (ids.length > 0) {\n return ids.join(' ');\n }\n };\n\n get isInvalid(): boolean {\n if (\n this.args.isInvalid ||\n (this.args.errors && this.args.errors.length > 0)\n ) {\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * The error messages as a single string, used by the persistent live region.\n * Uses `FormFeedback`'s own join, so both render the same separator.\n */\n get errorMessageText(): string {\n return feedbackMessageText(this.args.errors);\n }\n\n get showErrorFeedback(): boolean {\n if (!(this.args.preventErrorFeedback === true) && this.isInvalid) {\n return true;\n }\n return false;\n }\n\n <template>\n <div class={{@class}} ...attributes>\n {{#if (or @label (has-block \"label\"))}}\n <Label @for={{this.id}} @isRequired={{@isRequired}} @size={{@size}}>\n {{@label}}\n {{yield to=\"label\"}}\n </Label>\n {{/if}}\n\n {{#if (or @description (has-block \"description\"))}}\n <Description @id={{this.descriptionId}} @size={{@size}}>\n {{@description}}\n {{yield to=\"description\"}}\n </Description>\n {{/if}}\n\n {{yield\n (hash\n id=this.id\n isInvalid=this.isInvalid\n describedBy=this.describedBy\n Label=(component Label for=this.id size=@size isRequired=@isRequired)\n Description=(component Description id=this.descriptionId size=@size)\n Feedback=(component\n Feedback\n id=this.feedbackId\n size=@size\n messages=@errors\n status=\"danger\"\n announce=false\n )\n )\n to=\"default\"\n }}\n\n {{#if this.showErrorFeedback}}\n <Feedback\n @id={{this.feedbackId}}\n @size={{@size}}\n @messages={{@errors}}\n @status=\"danger\"\n @announce={{false}}\n />\n {{/if}}\n\n {{!\n The visible feedback is only rendered once the field is invalid, and a\n live region that appears at the same moment as its content is not\n reliably announced. This region is always in the DOM, visually hidden\n and empty, so assistive technology is already observing it when the\n messages arrive. It is intentionally not part of describedBy; the\n visible feedback is what describes the control.\n }}\n <VisuallyHidden\n aria-live=\"assertive\"\n data-test-id=\"form-feedback-live-region\"\n >{{this.errorMessageText}}</VisuallyHidden>\n </div>\n </template>\n}\n\nexport { FormControl, type FormControlSignature, type FormControlSharedArgs };\nexport default FormControl;\n"],"names":["or","arg1","arg2","FormControl","Component","id","args","guidFor","descriptionId","feedbackId","describedBy","hasDescription","hasFeedback","ids","push","length","join","isInvalid","errors","errorMessageText","feedbackMessageText","showErrorFeedback","preventErrorFeedback","setComponentTemplate","precompileTemplate","strictMode","scope","Label","Description","hash","Feedback","VisuallyHidden"],"mappings":";;;;;;;;;;AAoHA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,oBAAoBC,SAAA,CAAU;EAClCC,EAAA,GAAK,IAAI,CAACC,IAAI,CAACD,EAAE,IAAIE,OAAA,CAAQ,IAAI,CAAA;EAEjC,IAAIC,aAAAA,GAAwB;AAC1B,IAAA,OAAO,IAAI,CAACH,EAAE,GAAG,cAAA;AACnB,EAAA;EAEA,IAAII,UAAAA,GAAqB;AACvB,IAAA,OAAO,IAAI,CAACJ,EAAE,GAAG,WAAA;AACnB,EAAA;AAEAK,EAAAA,WAAA,GAAcA,CAC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AAW,CAAA;AAAD;AACZ;;;;"}
@@ -1,7 +1,10 @@
1
1
  import Component from '@glimmer/component';
2
+ import { cached } from '@glimmer/tracking';
2
3
  import { useStyles } from '@frontile/theme';
4
+ import { r as renamedArgValue } from '../../deprecated-args-BIUjLA8y.js';
3
5
  import { precompileTemplate } from '@ember/template-compilation';
4
6
  import { setComponentTemplate } from '@ember/component';
7
+ import { a as decorateMethodV2 } from '../../runtime--fcdnjmJ-BOdRhmsS.js';
5
8
 
6
9
  /**
7
10
  * Renders feedback messages as a single string. An array is joined with `; `.
@@ -17,8 +20,28 @@ function feedbackMessageText(messages) {
17
20
  return typeof messages === 'string' ? messages : messages.join('; ');
18
21
  }
19
22
  class FormFeedback extends Component {
23
+ /**
24
+ * Resolved once so `isError` and `classes` agree, and so the deprecation
25
+ * fires once per render rather than per reader.
26
+ */
27
+ get status() {
28
+ return renamedArgValue(this.args.status, this.args.intent, {}, {
29
+ component: 'FormFeedback',
30
+ from: 'intent',
31
+ to: 'status',
32
+ id: 'frontile.form-feedback.intent'
33
+ });
34
+ }
35
+ /**
36
+ * Drives `aria-live="assertive"`. The default is `danger`, so the ABSENCE
37
+ * of the arg must stay assertive -- a missing value must never quietly
38
+ * downgrade an error announcement to polite.
39
+ */
40
+ static {
41
+ decorateMethodV2(this.prototype, "status", [cached]);
42
+ }
20
43
  get isError() {
21
- return typeof this.args.messages !== 'undefined' && (this.args.intent === 'danger' || typeof this.args.intent === 'undefined');
44
+ return typeof this.args.messages !== 'undefined' && (this.status === 'danger' || typeof this.status === 'undefined');
22
45
  }
23
46
  get classes() {
24
47
  const {
@@ -26,7 +49,7 @@ class FormFeedback extends Component {
26
49
  } = useStyles();
27
50
  return formFeedback({
28
51
  size: this.args.size || 'md',
29
- intent: this.args.intent || 'danger',
52
+ status: this.status || 'danger',
30
53
  class: this.args.class
31
54
  });
32
55
  }
@@ -1 +1 @@
1
- {"version":3,"file":"form-feedback.js","sources":["../../../src/components/forms/form-feedback.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { useStyles, type FormFeedbackVariants } from '@frontile/theme';\n\ninterface FormFeedbackSignature {\n Args: {\n /**\n * The id of the feedback element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * A list of messages or a single message string. An array is joined with `; `.\n */\n messages?: string[] | string;\n\n /**\n * The intent of the feedback, which also decides whether it is announced\n * assertively (`danger`) or politely.\n *\n * @defaultValue 'danger'\n */\n intent?: FormFeedbackVariants['intent'];\n\n /**\n * The size of the feedback text.\n *\n * @defaultValue 'md'\n */\n size?: FormFeedbackVariants['size'];\n\n /**\n * Whether the element is itself an `aria-live` region. Set this to `false`\n * when something else (such as `FormControl`, which keeps a persistent\n * live region in the DOM) already announces the messages, so they are not\n * announced twice.\n *\n * @defaultValue true\n */\n announce?: boolean;\n\n /**\n * Class names for the feedback element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\n/**\n * Renders feedback messages as a single string. An array is joined with `; `.\n *\n * Shared with `FormControl`, whose persistent live region announces the same\n * text, so both render an identical separator.\n *\n * @param messages A list of messages or a single message string.\n * @returns The messages as one string, or an empty string when there are none.\n */\nfunction feedbackMessageText(messages: string[] | string | undefined): string {\n if (!messages) return '';\n\n return typeof messages === 'string' ? messages : messages.join('; ');\n}\n\nclass FormFeedback extends Component<FormFeedbackSignature> {\n get isError(): boolean {\n return (\n typeof this.args.messages !== 'undefined' &&\n (this.args.intent === 'danger' || typeof this.args.intent === 'undefined')\n );\n }\n\n get classes() {\n const { formFeedback } = useStyles();\n\n return formFeedback({\n size: this.args.size || 'md',\n intent: this.args.intent || 'danger',\n class: this.args.class\n });\n }\n\n get announce(): boolean {\n return this.args.announce !== false;\n }\n\n get ariaLive(): string | undefined {\n if (!this.announce) {\n return undefined;\n }\n return this.isError ? 'assertive' : 'polite';\n }\n\n get messageText(): string {\n return feedbackMessageText(this.args.messages);\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-feedback\"\n data-part=\"base\"\n aria-live={{this.ariaLive}}\n ...attributes\n >\n {{this.messageText}}\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormFeedback, feedbackMessageText, type FormFeedbackSignature };\nexport default FormFeedback;\n"],"names":["feedbackMessageText","messages","join","FormFeedback","Component","isError","args","intent","classes","formFeedback","useStyles","size","class","announce","ariaLive","undefined","messageText","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;AAoDA;;;;;;;;;AASA,SAASA,oBAAoBC,QAAuC,EAAS;AAC3E,EAAA,IAAI,CAACA,UAAU,OAAO,EAAA;AAEtB,EAAA,OAAO,OAAOA,QAAA,KAAa,QAAA,GAAWA,QAAA,GAAWA,QAAA,CAASC,IAAI,CAAC,IAAA,CAAA;AACjE;AAEA,MAAMC,qBAAqBC,SAAA,CAAU;EACnC,IAAIC,OAAAA,GAAmB;IACrB,OACE,OAAO,IAAI,CAACC,IAAI,CAACL,QAAQ,KAAK,WAAA,KAC7B,IAAI,CAACK,IAAI,CAACC,MAAM,KAAK,QAAA,IAAY,OAAO,IAAI,CAACD,IAAI,CAACC,MAAM,KAAK,WAAW,CAC3E;AACF,EAAA;EAEA,IAAIC,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAc,GAAGC,SAAA,EAAA;AAEzB,IAAA,OAAOD,YAAA,CAAa;AAClBE,MAAAA,IAAA,EAAM,IAAI,CAACL,IAAI,CAACK,IAAI,IAAI,IAAA;AACxBJ,MAAAA,MAAA,EAAQ,IAAI,CAACD,IAAI,CAACC,MAAM,IAAI,QAAA;AAC5BK,MAAAA,KAAA,EAAO,IAAI,CAACN,IAAI,CAACM;AACnB,KAAA,CAAA;AACF,EAAA;EAEA,IAAIC,QAAAA,GAAoB;AACtB,IAAA,OAAO,IAAI,CAACP,IAAI,CAACO,QAAQ,KAAK,KAAA;AAChC,EAAA;EAEA,IAAIC,QAAAA,GAA+B;AACjC,IAAA,IAAI,CAAC,IAAI,CAACD,QAAQ,EAAE;AAClB,MAAA,OAAOE,SAAA;AACT,IAAA;AACA,IAAA,OAAO,IAAI,CAACV,OAAO,GAAG,WAAA,GAAc,QAAA;AACtC,EAAA;EAEA,IAAIW,WAAAA,GAAsB;AACxB,IAAA,OAAOhB,mBAAA,CAAoB,IAAI,CAACM,IAAI,CAACL,QAAQ,CAAA;AAC/C,EAAA;AAEA,EAAA;IAAAgB,oBAAA,CAAAC,kBAAA,CAAA,oLAAA,EAYA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"form-feedback.js","sources":["../../../src/components/forms/form-feedback.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { cached } from '@glimmer/tracking';\nimport { useStyles, type FormFeedbackVariants } from '@frontile/theme';\nimport { renamedArgValue } from '../../-private/deprecated-args';\n\ninterface FormFeedbackSignature {\n Args: {\n /**\n * The id of the feedback element, referenced by the control's\n * `aria-describedby`.\n */\n id?: string;\n\n /**\n * A list of messages or a single message string. An array is joined with `; `.\n */\n messages?: string[] | string;\n\n /**\n * The status of the feedback, which also decides whether it is announced\n * assertively (`danger`) or politely.\n *\n * @defaultValue 'danger'\n */\n status?: FormFeedbackVariants['status'];\n\n /**\n * @deprecated Use `status`. The name changed because this value also\n * decides whether the message is announced assertively.\n */\n intent?: FormFeedbackVariants['status'];\n\n /**\n * The size of the feedback text.\n *\n * @defaultValue 'md'\n */\n size?: FormFeedbackVariants['size'];\n\n /**\n * Whether the element is itself an `aria-live` region. Set this to `false`\n * when something else (such as `FormControl`, which keeps a persistent\n * live region in the DOM) already announces the messages, so they are not\n * announced twice.\n *\n * @defaultValue true\n */\n announce?: boolean;\n\n /**\n * Class names for the feedback element, merged with the theme's.\n */\n class?: string;\n };\n Element: HTMLDivElement;\n Blocks: {\n default: [];\n };\n}\n\n/**\n * Renders feedback messages as a single string. An array is joined with `; `.\n *\n * Shared with `FormControl`, whose persistent live region announces the same\n * text, so both render an identical separator.\n *\n * @param messages A list of messages or a single message string.\n * @returns The messages as one string, or an empty string when there are none.\n */\nfunction feedbackMessageText(messages: string[] | string | undefined): string {\n if (!messages) return '';\n\n return typeof messages === 'string' ? messages : messages.join('; ');\n}\n\nclass FormFeedback extends Component<FormFeedbackSignature> {\n /**\n * Resolved once so `isError` and `classes` agree, and so the deprecation\n * fires once per render rather than per reader.\n */\n @cached\n get status(): FormFeedbackVariants['status'] {\n return renamedArgValue(this.args.status, this.args.intent, {} as const, {\n component: 'FormFeedback',\n from: 'intent',\n to: 'status',\n id: 'frontile.form-feedback.intent'\n });\n }\n\n /**\n * Drives `aria-live=\"assertive\"`. The default is `danger`, so the ABSENCE\n * of the arg must stay assertive -- a missing value must never quietly\n * downgrade an error announcement to polite.\n */\n get isError(): boolean {\n return (\n typeof this.args.messages !== 'undefined' &&\n (this.status === 'danger' || typeof this.status === 'undefined')\n );\n }\n\n get classes() {\n const { formFeedback } = useStyles();\n\n return formFeedback({\n size: this.args.size || 'md',\n status: this.status || 'danger',\n class: this.args.class\n });\n }\n\n get announce(): boolean {\n return this.args.announce !== false;\n }\n\n get ariaLive(): string | undefined {\n if (!this.announce) {\n return undefined;\n }\n return this.isError ? 'assertive' : 'polite';\n }\n\n get messageText(): string {\n return feedbackMessageText(this.args.messages);\n }\n\n <template>\n <div\n id={{@id}}\n class={{this.classes}}\n data-component=\"form-feedback\"\n data-part=\"base\"\n aria-live={{this.ariaLive}}\n ...attributes\n >\n {{this.messageText}}\n {{yield}}\n </div>\n </template>\n}\n\nexport { FormFeedback, feedbackMessageText, type FormFeedbackSignature };\nexport default FormFeedback;\n"],"names":["feedbackMessageText","messages","join","FormFeedback","Component","status","renamedArgValue","args","intent","component","from","to","id","n","prototype","cached","isError","classes","formFeedback","useStyles","size","class","announce","ariaLive","undefined","messageText","setComponentTemplate","precompileTemplate","strictMode"],"mappings":";;;;;;;;AA4DA;;;;;;;;;AASA,SAASA,oBAAoBC,QAAuC,EAAS;AAC3E,EAAA,IAA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I,CAAC,IAAI,CAACD,QAAQ,EAAE;AAClB,MAAA,OAAOE,SAAA;AACT,IAAA;AACA,IAAA,OAAO,IAAI,CAACR,OAAO,GAAG,WAAA,GAAc,QAAA;AACtC,EAAA;EAEA,IAAIS,WAAAA,GAAsB;AACxB,IAAA,OAAOzB,mBAAA,CAAoB,IAAI,CAACO,IAAI,CAACN,QAAQ,CAAA;AAC/C,EAAA;AAEA,EAAA;IAAAyB,oBAAA,CAAAC,kBAAA,CAAA,oLAAA,EAYA;MAAAC,UAAA,EAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -5,9 +5,12 @@ import templateOnly from '@ember/component/template-only';
5
5
  const IconChevronUpDown = setComponentTemplate(precompileTemplate("<svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\" aria-hidden=\"true\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9\" />\n</svg>", {
6
6
  strictMode: true
7
7
  }), templateOnly());
8
+ const IconCalendar = setComponentTemplate(precompileTemplate("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" aria-hidden=\"true\" ...attributes>\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0V11.25A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5\" />\n</svg>", {
9
+ strictMode: true
10
+ }), templateOnly());
8
11
  var icons = setComponentTemplate(precompileTemplate("@frontile/froms Icons component is empty, use template imports.", {
9
12
  strictMode: true
10
13
  }), templateOnly());
11
14
 
12
- export { IconChevronUpDown, icons as default };
15
+ export { IconCalendar, IconChevronUpDown, icons as default };
13
16
  //# sourceMappingURL=icons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"icons.js","sources":["../../../src/components/forms/icons.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\n\nconst IconChevronUpDown: 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 aria-hidden=\"true\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9\"\n />\n </svg>\n</template>;\n\nexport { IconChevronUpDown };\n\n<template>\n @frontile/froms Icons component is empty, use template imports.\n</template>\n"],"names":["IconChevronUpDown","setComponentTemplate","precompileTemplate","strictMode","templateOnly"],"mappings":";;;;AAEA,MAAMA,iBAED,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,+RAAA,EAgBL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAIV,YAAAH,oBAAA,CAAAC,kBAAA,CAAA,iEAAA,EAEA;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;;;"}
1
+ {"version":3,"file":"icons.js","sources":["../../../src/components/forms/icons.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\n\nconst IconChevronUpDown: 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 aria-hidden=\"true\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M8.25 15 12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9\"\n />\n </svg>\n</template>;\n\nconst IconCalendar: TOC<{\n Element: SVGElement;\n}> = <template>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"1.5\"\n aria-hidden=\"true\"\n ...attributes\n >\n <path\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n d=\"M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 0 1 2.25-2.25h13.5A2.25 2.25 0 0 1 21 7.5v11.25m-18 0A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75m-18 0V11.25A2.25 2.25 0 0 1 5.25 9h13.5A2.25 2.25 0 0 1 21 11.25v7.5\"\n />\n </svg>\n</template>;\n\nexport { IconChevronUpDown, IconCalendar };\n\n<template>\n @frontile/froms Icons component is empty, use template imports.\n</template>\n"],"names":["IconChevronUpDown","setComponentTemplate","precompileTemplate","strictMode","templateOnly","IconCalendar"],"mappings":";;;;AAEA,MAAMA,iBAED,GAAAC,oBAAA,CAAAC,kBAAA,CAAA,+RAAA,EAgBL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAEV,MAAMC,YAED,GAAAJ,oBAAA,CAAAC,kBAAA,CAAA,gdAAA,EAgBL;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;AAIV,YAAAH,oBAAA,CAAAC,kBAAA,CAAA,iEAAA,EAEA;EAAAC,UAAA,EAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA,CAAA;;;;"}
@@ -15,6 +15,8 @@ export { Radio } from './radio.js';
15
15
  export { RadioGroup } from './radio-group.js';
16
16
  export { FormControl } from './form-control.js';
17
17
  export { Switch } from './switch.js';
18
+ export { DatePicker } from './date-picker/date-picker.js';
19
+ export { formatValue, isEmptyValue, parseDate, parseRange, toWire } from './date-picker/value.js';
18
20
  export { StandardValidator } from '../../utils/standard-validator.js';
19
21
  export { deepEqual, flattenData, hasNestedData, unflattenData } from '../../utils/nested-data.js';
20
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -121,7 +121,7 @@ class Input extends Component {
121
121
  });
122
122
  }
123
123
  static {
124
- setComponentTemplate(precompileTemplate("<FormControl @size={{@size}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} data-component=\"input\" data-part=\"base\" as |c|>\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n {{#if (has-block \"startContent\")}}\n <div data-part=\"start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input {{this.inputRef.setup}} {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} {{on \"blur\" this.handleOnBlur}} id={{c.id}} name={{@name}} value={{this.value}} type={{this.type}} disabled={{@isDisabled}} class={{this.classes.input class=@classes.input hasStartContent=(has-block \"startContent\") hasEndContent=(or (has-block \"endContent\") this.isClearable)}} data-part=\"input\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div data-part=\"end-content\" class={{this.classes.endContent class=@classes.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"auto\")}}>\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"subtle\" @size=\"xs\" @onPress={{this.clearValue}} />\n {{/if}}\n </div>\n {{/if}}\n </div>\n</FormControl>", {
124
+ setComponentTemplate(precompileTemplate("<FormControl @size={{@size}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} @class={{this.classes.base class=@classes.base}} data-component=\"input\" data-part=\"base\" as |c|>\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n {{#if (has-block \"startContent\")}}\n <div data-part=\"start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input {{this.inputRef.setup}} {{on \"input\" this.handleOnInput}} {{on \"change\" this.handleOnChange}} {{on \"blur\" this.handleOnBlur}} id={{c.id}} name={{@name}} value={{this.value}} type={{this.type}} disabled={{@isDisabled}} class={{this.classes.input class=@classes.input hasStartContent=(has-block \"startContent\") hasEndContent=(or (has-block \"endContent\") this.isClearable)}} data-part=\"input\" aria-invalid={{if c.isInvalid \"true\"}} aria-describedby={{c.describedBy @description c.isInvalid}} ...attributes />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div data-part=\"end-content\" class={{this.classes.endContent class=@classes.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"auto\")}}>\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @onPress={{this.clearValue}} />\n {{/if}}\n </div>\n {{/if}}\n </div>\n</FormControl>", {
125
125
  strictMode: true,
126
126
  scope: () => ({
127
127
  FormControl,
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","sources":["../../../src/components/forms/input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport {\n useStyles,\n type InputSlots,\n type InputVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { triggerFormInputEvent } from '../../utils/forms-utils-index';\nimport { ref } from '../../utils/ref';\nimport { CloseButton } from '../buttons/close-button';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The type attribute of the underlying input element.\n *\n * @defaultValue 'text'\n */\n type?: string;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the element track its own value.\n */\n value?: string;\n\n /**\n * The name attribute of the underlying input, used when the input is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the input and its label.\n *\n * @defaultValue 'md'\n */\n size?: InputVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputSlots>;\n\n /**\n * Whether to include a clear button\n */\n isClearable?: boolean;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Callback when oninput is triggered\n */\n onInput?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface InputSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n endContent: [];\n };\n Element: HTMLInputElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass Input extends Component<InputSignature> {\n @tracked uncontrolledValue: string = this.args.value || '';\n\n /**\n * What the element itself currently holds. A controlled parent does not\n * always feed the value back through `@value` — `<Form>`, for one, reads it\n * off the DOM instead — so the argument alone cannot tell us whether there\n * is anything to clear.\n */\n @tracked elementValue: string = this.args.value || '';\n\n inputRef = ref<HTMLInputElement>();\n\n get isControlled() {\n return (\n typeof this.args.onChange === 'function' ||\n typeof this.args.onInput === 'function'\n );\n }\n\n get value(): string | undefined {\n return this.isControlled ? this.args.value : this.uncontrolledValue;\n }\n\n /**\n * The value in the field regardless of who owns it: the argument when the\n * parent feeds one back, the element's own value otherwise.\n */\n get currentValue(): string | undefined {\n if (!this.isControlled) {\n return this.uncontrolledValue;\n }\n\n return typeof this.args.value === 'undefined'\n ? this.elementValue\n : this.args.value;\n }\n\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n\n @action handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onInput?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onChange?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnBlur(): void {\n this.args.onBlur?.();\n }\n\n @action clearValue(): void {\n // Clear the element first: a parent that owns the value may derive it from\n // the DOM (as `<Form>` does via FormData), in which case notifying it\n // before the element is empty would just hand back the stale value.\n if (this.inputRef.current) {\n this.inputRef.current.value = '';\n }\n this.elementValue = '';\n\n if (this.isControlled) {\n this.args.onChange?.('');\n this.args.onInput?.('');\n } else {\n this.uncontrolledValue = '';\n }\n\n this.inputRef.current?.focus();\n triggerFormInputEvent(this.inputRef.current);\n }\n\n get isClearable(): boolean {\n if (\n this.args.isClearable === true &&\n this.currentValue !== '' &&\n typeof this.currentValue !== 'undefined'\n ) {\n return true;\n }\n return false;\n }\n\n get classes() {\n const { input } = useStyles();\n return input({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input\n {{this.inputRef.setup}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n value={{this.value}}\n type={{this.type}}\n disabled={{@isDisabled}}\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=(or (has-block \"endContent\") this.isClearable)\n }}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"subtle\"\n @size=\"xs\"\n @onPress={{this.clearValue}}\n />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Input, type InputSignature };\nexport default Input;\n"],"names":["or","arg1","arg2","Input","Component","g","prototype","tracked","args","value","i","inputRef","ref","isControlled","onChange","onInput","uncontrolledValue","currentValue","elementValue","type","handleOnInput","event","target","n","action","handleOnChange","handleOnBlur","onBlur","clearValue","current","focus","triggerFormInputEvent","isClearable","classes","input","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","CloseButton"],"mappings":";;;;;;;;;;;;;AA6FA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,O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A,EAAAA,OAAA;QAAAC,WAAA;QAAAzC,EAAA;QAAA0C,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
1
+ {"version":3,"file":"input.js","sources":["../../../src/components/forms/input.gts"],"sourcesContent":["import Component from '@glimmer/component';\nimport { tracked } from '@glimmer/tracking';\nimport { action } from '@ember/object';\nimport { on } from '@ember/modifier';\nimport {\n useStyles,\n type InputSlots,\n type InputVariants,\n type SlotsToClasses\n} from '@frontile/theme';\nimport { FormControl, type FormControlSharedArgs } from './form-control';\nimport { triggerFormInputEvent } from '../../utils/forms-utils-index';\nimport { ref } from '../../utils/ref';\nimport { CloseButton } from '../buttons/close-button';\n\ninterface Args extends FormControlSharedArgs {\n /**\n * The type attribute of the underlying input element.\n *\n * @defaultValue 'text'\n */\n type?: string;\n\n /**\n * The value of the input. Pair with `onInput` or `onChange` to control the\n * input; leave it unset to let the element track its own value.\n */\n value?: string;\n\n /**\n * The name attribute of the underlying input, used when the input is\n * submitted as part of a form.\n */\n name?: string;\n\n /**\n * The size of the input and its label.\n *\n * @defaultValue 'md'\n */\n size?: InputVariants['size'];\n\n /**\n * Class names for each slot of the component, merged with the theme's.\n */\n classes?: SlotsToClasses<InputSlots>;\n\n /**\n * Whether to include a clear button\n */\n isClearable?: boolean;\n\n /**\n * Controls pointer-events property of startContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n startContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Controls pointer-events property of endContent.\n * If you want to pass the click event to the input, set it to `none`.\n *\n * @defaultValue 'auto'\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n /**\n * Callback when oninput is triggered\n */\n onInput?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onchange is triggered\n */\n onChange?: (value: string, event?: InputEvent) => void;\n\n /**\n * Callback when onblur is triggered\n */\n onBlur?: () => void;\n}\n\ninterface InputSignature {\n Args: Args;\n Blocks: {\n startContent: [];\n endContent: [];\n };\n Element: HTMLInputElement;\n}\n\nfunction or(arg1: unknown, arg2: unknown): boolean {\n return !!(arg1 || arg2);\n}\n\nclass Input extends Component<InputSignature> {\n @tracked uncontrolledValue: string = this.args.value || '';\n\n /**\n * What the element itself currently holds. A controlled parent does not\n * always feed the value back through `@value` — `<Form>`, for one, reads it\n * off the DOM instead — so the argument alone cannot tell us whether there\n * is anything to clear.\n */\n @tracked elementValue: string = this.args.value || '';\n\n inputRef = ref<HTMLInputElement>();\n\n get isControlled() {\n return (\n typeof this.args.onChange === 'function' ||\n typeof this.args.onInput === 'function'\n );\n }\n\n get value(): string | undefined {\n return this.isControlled ? this.args.value : this.uncontrolledValue;\n }\n\n /**\n * The value in the field regardless of who owns it: the argument when the\n * parent feeds one back, the element's own value otherwise.\n */\n get currentValue(): string | undefined {\n if (!this.isControlled) {\n return this.uncontrolledValue;\n }\n\n return typeof this.args.value === 'undefined'\n ? this.elementValue\n : this.args.value;\n }\n\n get type(): string {\n if (typeof this.args.type === 'string') {\n return this.args.type;\n }\n return 'text';\n }\n\n @action handleOnInput(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onInput?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnChange(event: Event): void {\n const value = (event.target as HTMLInputElement).value;\n this.elementValue = value;\n\n if (this.isControlled) {\n this.args.onChange?.(value, event as InputEvent);\n } else {\n this.uncontrolledValue = value;\n }\n }\n\n @action handleOnBlur(): void {\n this.args.onBlur?.();\n }\n\n @action clearValue(): void {\n // Clear the element first: a parent that owns the value may derive it from\n // the DOM (as `<Form>` does via FormData), in which case notifying it\n // before the element is empty would just hand back the stale value.\n if (this.inputRef.current) {\n this.inputRef.current.value = '';\n }\n this.elementValue = '';\n\n if (this.isControlled) {\n this.args.onChange?.('');\n this.args.onInput?.('');\n } else {\n this.uncontrolledValue = '';\n }\n\n this.inputRef.current?.focus();\n triggerFormInputEvent(this.inputRef.current);\n }\n\n get isClearable(): boolean {\n if (\n this.args.isClearable === true &&\n this.currentValue !== '' &&\n typeof this.currentValue !== 'undefined'\n ) {\n return true;\n }\n return false;\n }\n\n get classes() {\n const { input } = useStyles();\n return input({\n size: this.args.size\n });\n }\n\n <template>\n <FormControl\n @size={{@size}}\n @label={{@label}}\n @isRequired={{@isRequired}}\n @description={{@description}}\n @errors={{@errors}}\n @isInvalid={{@isInvalid}}\n @class={{this.classes.base class=@classes.base}}\n data-component=\"input\"\n data-part=\"base\"\n as |c|\n >\n <div\n class={{this.classes.innerContainer class=@classes.innerContainer}}\n data-part=\"inner-container\"\n >\n {{#if (has-block \"startContent\")}}\n <div\n data-part=\"start-content\"\n class={{this.classes.startContent\n class=@classes.startContent\n startContentPointerEvents=(if\n @startContentPointerEvents @startContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n <input\n {{this.inputRef.setup}}\n {{on \"input\" this.handleOnInput}}\n {{on \"change\" this.handleOnChange}}\n {{on \"blur\" this.handleOnBlur}}\n id={{c.id}}\n name={{@name}}\n value={{this.value}}\n type={{this.type}}\n disabled={{@isDisabled}}\n class={{this.classes.input\n class=@classes.input\n hasStartContent=(has-block \"startContent\")\n hasEndContent=(or (has-block \"endContent\") this.isClearable)\n }}\n data-part=\"input\"\n aria-invalid={{if c.isInvalid \"true\"}}\n aria-describedby={{c.describedBy @description c.isInvalid}}\n ...attributes\n />\n {{#if (or (has-block \"endContent\") this.isClearable)}}\n <div\n data-part=\"end-content\"\n class={{this.classes.endContent\n class=@classes.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"auto\"\n )\n }}\n >\n {{yield to=\"endContent\"}}\n\n {{#if this.isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @onPress={{this.clearValue}}\n />\n {{/if}}\n </div>\n {{/if}}\n </div>\n </FormControl>\n </template>\n}\n\nexport { Input, type InputSignature };\nexport default Input;\n"],"names":["or","arg1","arg2","Input","Component","g","prototype","tracked","args","value","i","inputRef","ref","isControlled","onChange","onInput","uncontrolledValue","currentValue","elementValue","type","handleOnInput","event","target","n","action","handleOnChange","handleOnBlur","onBlur","clearValue","current","focus","triggerFormInputEvent","isClearable","classes","input","useStyles","size","setComponentTemplate","precompileTemplate","strictMode","scope","FormControl","on","CloseButton"],"mappings":";;;;;;;;;;;;;AA6FA,SAASA,GAAGC,IAAa,EAAEC,IAAa,EAAU;AAChD,EAAA,OAAO,CAAC,EAAED,IAAA,IAAQC,IAAI,CAAA;AACxB;AAEA,MAAMC,cAAcC,SAAA,CAAU;AAAA,EAAA;IAAAC,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,mBAAA,EAAA,CAC3BC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAAoC,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,EAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,kBAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,mBAAA,CAAA,EAAA,MAAA;AAAA,EAAA;IAAAL,eAAA,CAAA,IAAA,CAAAC,SAAA,EAAA,cAAA,EAAA,CAQvDC,OAAA,CAAA,EAAA,YAAA;AAAA,MAAA,OAA+B,IAAI,CAACC,IAAI,CAACC,KAAK,IAAI,EAAA;AAAA,IAAA,CAAA,CAAA;AAAA;EAAA,aAAA,IAAAC,2BAAA,CAAA,IAAA,EAAA,cAAA,CAAA,EAAA,MAAA;AANnD;;;;;AAKC;EAGDC,QAAA,GAAWC,KAAI;EAEf,IAAIC,YAAAA,GAAe;AACjB,IAAA,OACE,OAAO,IAAI,CAACL,IAAI,CAACM,QAAQ,KAAK,UAAA,IAC9B,OAAO,IAAI,CAACN,IAAI,CAACO,OAAO,KAAK,UAC/B;AACF,EAAA;EAEA,IAAIN,KAAAA,GAA4B;AAC9B,IAAA,OAAO,IAAI,CAACI,YAAY,GAA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AO,IAAA;AACT,IAAA;AACA,IAAA,OAAO,KAAA;AACT,EAAA;EAEA,IAAIgB,OAAAA,GAAU;IACZ,MAAM;AAAEC,MAAAA;KAAO,GAAGC,SAAA,EAAA;AAClB,IAAA,OAAOD,KAAA,CAAM;AACXE,MAAAA,IAAA,EAAM,IAAI,CAAC5B,IAAI,CAAC4B;AAClB,KAAA,CAAA;AACF,EAAA;AAEA,EAAA;IAAAC,oBAAA,CAAAC,kBAAA,CAAA,+pDAAA,EA0EA;MAAAC,UAAA,EAAA,IAAA;AAAAC,MAAAA,KAAA,EAAAA,OAAA;QAAAC,WAAA;QAAAzC,EAAA;QAAA0C,EAAA;AAAAC,QAAAA;AAAA,OAAA;KAAU,CAAA,EAAV,IAAW,CAAA;AAAD;AACZ;;;;"}
@@ -10,7 +10,7 @@ const isSm = size => size === 'sm';
10
10
  * The cluster at the end of the field: any consumer content, then exactly one
11
11
  * of the loading spinner, the clear button, or the chevron.
12
12
  */
13
- const SelectEndContent = setComponentTemplate(precompileTemplate("<div data-part=\"end-content\" class={{@classes.endContent class=@userClasses.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"none\")}} ...attributes>\n {{yield}}\n\n {{#if @isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if @isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"subtle\" @size=\"xs\" @class={{@classes.clearButton class=@userClasses.clearButton}} data-part=\"clear-button\" @onPress={{@onClear}} />\n {{else}}\n <IconChevronUpDown data-part=\"icon\" class={{@classes.icon class=@userClasses.icon}} />\n {{/if}}\n</div>", {
13
+ const SelectEndContent = setComponentTemplate(precompileTemplate("<div data-part=\"end-content\" class={{@classes.endContent class=@userClasses.endContent endContentPointerEvents=(if @endContentPointerEvents @endContentPointerEvents \"none\")}} ...attributes>\n {{yield}}\n\n {{#if @isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if @isClearable}}\n <CloseButton @title=\"Clear\" @variant=\"soft\" @size=\"xs\" @class={{@classes.clearButton class=@userClasses.clearButton}} data-part=\"clear-button\" @onPress={{@onClear}} />\n {{else}}\n <IconChevronUpDown data-part=\"icon\" class={{@classes.icon class=@userClasses.icon}} />\n {{/if}}\n</div>", {
14
14
  strictMode: true,
15
15
  scope: () => ({
16
16
  Spinner,
@@ -1 +1 @@
1
- {"version":3,"file":"end-content.js","sources":["../../../../src/components/forms/select/end-content.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport type {\n SelectSlots,\n SelectVariants,\n SlotsToClasses\n} from '@frontile/theme';\nimport { Spinner } from '../../utilities/spinner';\nimport { CloseButton } from '../../buttons/close-button';\nimport { IconChevronUpDown } from '../icons';\nimport type { SelectClasses } from './types';\n\nconst isSm = (size: SelectVariants['size']) => size === 'sm';\n\ninterface SelectEndContentSignature {\n Args: {\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /**\n * Defaults to `none` so clicks fall through to the trigger; content that\n * needs its own events opts back in per element.\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n inputSize?: SelectVariants['size'];\n isLoading?: boolean;\n\n /** Whether the clear button takes the chevron's place. */\n isClearable?: boolean;\n\n onClear: () => void;\n };\n Blocks: {\n /** Consumer content, rendered before the spinner/clear/chevron cluster. */\n default: [];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The cluster at the end of the field: any consumer content, then exactly one\n * of the loading spinner, the clear button, or the chevron.\n */\nconst SelectEndContent: TOC<SelectEndContentSignature> = <template>\n <div\n data-part=\"end-content\"\n class={{@classes.endContent\n class=@userClasses.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n ...attributes\n >\n {{yield}}\n\n {{#if @isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if @isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"subtle\"\n @size=\"xs\"\n @class={{@classes.clearButton class=@userClasses.clearButton}}\n data-part=\"clear-button\"\n @onPress={{@onClear}}\n />\n {{else}}\n <IconChevronUpDown\n data-part=\"icon\"\n class={{@classes.icon class=@userClasses.icon}}\n />\n {{/if}}\n </div>\n</template>;\n\nexport { SelectEndContent, type SelectEndContentSignature };\nexport default SelectEndContent;\n"],"names":["isSm","size","SelectEndContent","setComponentTemplate","precompileTemplate","strictMode","scope","Spinner","CloseButton","IconChevronUpDown","templateOnly"],"mappings":";;;;;;;AAWA,MAAMA,IAAA,GAAQC,QAAiCA,IAAA,KAAS,IAAA;AA4BxD;;;AAGC;AACD,MAAMC,gBAAsB,GAAAC,oBAAA,CAA6BC,kBAAA,CAAA,snBAAA,EA+BzD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,OAAA;IAAAP,IAAA;IAAAQ,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
1
+ {"version":3,"file":"end-content.js","sources":["../../../../src/components/forms/select/end-content.gts"],"sourcesContent":["import type { TOC } from '@ember/component/template-only';\nimport type {\n SelectSlots,\n SelectVariants,\n SlotsToClasses\n} from '@frontile/theme';\nimport { Spinner } from '../../utilities/spinner';\nimport { CloseButton } from '../../buttons/close-button';\nimport { IconChevronUpDown } from '../icons';\nimport type { SelectClasses } from './types';\n\nconst isSm = (size: SelectVariants['size']) => size === 'sm';\n\ninterface SelectEndContentSignature {\n Args: {\n classes: SelectClasses;\n userClasses?: SlotsToClasses<SelectSlots>;\n\n /**\n * Defaults to `none` so clicks fall through to the trigger; content that\n * needs its own events opts back in per element.\n */\n endContentPointerEvents?: 'none' | 'auto';\n\n inputSize?: SelectVariants['size'];\n isLoading?: boolean;\n\n /** Whether the clear button takes the chevron's place. */\n isClearable?: boolean;\n\n onClear: () => void;\n };\n Blocks: {\n /** Consumer content, rendered before the spinner/clear/chevron cluster. */\n default: [];\n };\n Element: HTMLDivElement;\n}\n\n/**\n * The cluster at the end of the field: any consumer content, then exactly one\n * of the loading spinner, the clear button, or the chevron.\n */\nconst SelectEndContent: TOC<SelectEndContentSignature> = <template>\n <div\n data-part=\"end-content\"\n class={{@classes.endContent\n class=@userClasses.endContent\n endContentPointerEvents=(if\n @endContentPointerEvents @endContentPointerEvents \"none\"\n )\n }}\n ...attributes\n >\n {{yield}}\n\n {{#if @isLoading}}\n <Spinner @size={{if (isSm @inputSize) \"xs\" \"sm\"}} />\n {{else if @isClearable}}\n <CloseButton\n @title=\"Clear\"\n @variant=\"soft\"\n @size=\"xs\"\n @class={{@classes.clearButton class=@userClasses.clearButton}}\n data-part=\"clear-button\"\n @onPress={{@onClear}}\n />\n {{else}}\n <IconChevronUpDown\n data-part=\"icon\"\n class={{@classes.icon class=@userClasses.icon}}\n />\n {{/if}}\n </div>\n</template>;\n\nexport { SelectEndContent, type SelectEndContentSignature };\nexport default SelectEndContent;\n"],"names":["isSm","size","SelectEndContent","setComponentTemplate","precompileTemplate","strictMode","scope","Spinner","CloseButton","IconChevronUpDown","templateOnly"],"mappings":";;;;;;;AAWA,MAAMA,IAAA,GAAQC,QAAiCA,IAAA,KAAS,IAAA;AA4BxD;;;AAGC;AACD,MAAMC,gBAAsB,GAAAC,oBAAA,CAA6BC,kBAAA,CAAA,onBAAA,EA+BzD;EAAAC,UAAA,EAAA,IAAA;AAAAC,EAAAA,KAAA,EAAAA,OAAA;IAAAC,OAAA;IAAAP,IAAA;IAAAQ,WAAA;AAAAC,IAAAA;AAAA,GAAA;AAAU,CAAA,CAAA,EAAAC,YAAA,EAAA;;;;"}
@@ -1,8 +1,9 @@
1
1
  import Component from '@glimmer/component';
2
- import { tracked } from '@glimmer/tracking';
2
+ import { tracked, cached } from '@glimmer/tracking';
3
3
  import { on } from '@ember/modifier';
4
4
  import { modifier } from 'ember-modifier';
5
5
  import { useStyles } from '@frontile/theme';
6
+ import { r as renamedArgValue } from '../../../deprecated-args-BIUjLA8y.js';
6
7
  import { Listbox } from '../../collections/listbox/listbox.js';
7
8
  import { VisuallyHidden } from '../../utilities/visually-hidden.js';
8
9
  import { Popover } from '../../overlays/popover.js';
@@ -18,7 +19,7 @@ import { SelectedChips } from './selected-items.js';
18
19
  import { SelectEndContent } from './end-content.js';
19
20
  import { precompileTemplate } from '@ember/template-compilation';
20
21
  import { setComponentTemplate } from '@ember/component';
21
- import { d as decorateFieldV2, i as initializeDeferredDecorator } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
22
+ import { d as decorateFieldV2, i as initializeDeferredDecorator, a as decorateMethodV2 } from '../../../runtime--fcdnjmJ-BOdRhmsS.js';
22
23
 
23
24
  const and = (a, b) => Boolean(a) && Boolean(b);
24
25
  /*
@@ -381,14 +382,61 @@ class Select extends Component {
381
382
  this.onSelectionChange([]);
382
383
  };
383
384
  /**
384
- * Resolved chip appearance: `@chip` wins, then the Select's own `@intent`,
385
- * then chip defaults tuned for sitting inside a field.
385
+ * Resolved once (`@cached`) and forwarded to the internal `Listbox` as
386
+ * `@variant` only -- never `@appearance` as well, which would make the
387
+ * inner `Listbox` raise its own deprecation for the same usage.
386
388
  */
389
+ get variant() {
390
+ return renamedArgValue(this.args.variant, this.args.appearance, {
391
+ default: 'solid',
392
+ outlined: 'outline',
393
+ faded: 'subtle'
394
+ }, {
395
+ component: 'Select',
396
+ from: 'appearance',
397
+ to: 'variant',
398
+ id: 'frontile.select.appearance'
399
+ });
400
+ }
401
+ /**
402
+ * Resolved once (`@cached`) and forwarded to the internal `Listbox` as
403
+ * `@color` only -- never `@intent` as well, which would make the inner
404
+ * `Listbox` raise its own deprecation for the same usage.
405
+ */
406
+ static {
407
+ decorateMethodV2(this.prototype, "variant", [cached]);
408
+ }
409
+ get color() {
410
+ return renamedArgValue(this.args.color, this.args.intent, {
411
+ default: 'neutral'
412
+ }, {
413
+ component: 'Select',
414
+ from: 'intent',
415
+ to: 'color',
416
+ id: 'frontile.select.intent'
417
+ });
418
+ }
419
+ /**
420
+ * Resolved chip appearance: `@chip` wins, then the Select's own `@color`
421
+ * (or deprecated `@intent`), then chip defaults tuned for sitting inside a
422
+ * field.
423
+ */
424
+ static {
425
+ decorateMethodV2(this.prototype, "color", [cached]);
426
+ }
387
427
  get chipOptions() {
388
428
  const chip = this.args.selectionMode === 'multiple' ? this.args.chip : undefined;
389
429
  return {
390
- appearance: chip?.appearance ?? 'faded',
391
- intent: chip?.intent ?? this.args.intent ?? 'default',
430
+ // `appearance` is passed through only when the consumer set it. Giving
431
+ // it a default would make Chip's deprecation fire on every chip render.
432
+ variant: chip?.variant ?? (chip?.appearance ? undefined : 'soft'),
433
+ appearance: chip?.appearance,
434
+ // `intent` is passed through only when the consumer (or Select's own
435
+ // deprecated `@intent`) actually set it. Defaulting it would fire
436
+ // Chip's `intent` deprecation on every chip render, for a prop nobody
437
+ // wrote.
438
+ color: chip?.color ?? this.args.color ?? (chip?.intent ?? this.args.intent ? undefined : 'neutral'),
439
+ intent: chip?.intent ?? this.args.intent,
392
440
  size: chip?.size ?? 'sm',
393
441
  radius: chip?.radius,
394
442
  withDot: chip?.withDot ?? false
@@ -533,6 +581,12 @@ class Select extends Component {
533
581
  const {
534
582
  select
535
583
  } = useStyles();
584
+ // Referenced here, on the always-rendered root, so `@appearance`/
585
+ // `@variant` (and `@intent`/`@color`) raises its deprecation regardless
586
+ // of whether the popover content (and so the internal `Listbox`) is
587
+ // currently mounted.
588
+ void this.variant;
589
+ void this.color;
536
590
  return select({
537
591
  size: this.args.inputSize,
538
592
  hasChips: this.showChips,
@@ -607,7 +661,7 @@ class Select extends Component {
607
661
  }
608
662
  });
609
663
  static {
610
- setComponentTemplate(precompileTemplate("<div {{this.updateMultipleSelectValue @selectedKeys}} {{this.updateSingleSelectValue @selectedKey}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"select\" data-part=\"base\" ...attributes>\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{this.didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <VisuallyHidden>\n <SelectNativeMirror @items={{@items}} @allowEmpty={{@allowEmpty}} @disabledKeys={{@disabledKeys}} @selectionMode={{@selectionMode}} @selectedKeys={{this.selectedKeys}} @selectedKey={{this.getSelectedKey}} @onSelectionChange={{this.onSelectionChange}} @onSingleSelectionChange={{this.onSingleSelectionChange}} @onItemsChange={{this.onItemsChange}} @placeholder={{@placeholder}} @id={{c.id}} @name={{@name}} @isDisabled={{@isDisabled}}>\n <:default as |l|>\n {{!-- @glint-expect-error: the signature of the native select is not the same as the listbox--}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n {{#if (has-block \"startContent\")}}\n <div data-part=\"start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{!-- The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. --}}\n <div {{p.anchor}} {{p.measureWidth}} {{on \"click\" this.handleFieldClick}} data-test-id={{if this.showChips \"chips-field\"}} data-part=\"chips-field\" {{!-- These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. --}} data-has-chips={{if this.showChips \"true\" \"false\"}} data-invalid={{if c.isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}} class={{this.classes.chipsField class=@classes.chipsField hasStartContent=(has-block \"startContent\") hasEndContent=true}}>\n {{#if (and this.showChips this.hasSelection)}}\n {{!-- A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. --}}\n <SelectedChips @containerRef={{this.chipsContainerRef.setup}} @items={{this.selectedItems}} @classes={{this.classes}} @userClasses={{@classes}} @chipOptions={{this.chipOptions}} @isDisabled={{@isDisabled}} @isRemovable={{this.chipsRemovable}} @onRemove={{this.removeSelectedKey}}>\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger @isFilterable={{@isFilterable}} @trigger={{p.trigger}} @triggerRef={{this.triggerRef.setup}} @isDisabled={{@isDisabled}} @showChips={{this.showChips}} @accessibleName={{this.triggerAccessibleName}} @placeholder={{@placeholder}} @hasSelection={{this.hasSelection}} @hasStartContent={{has-block \"startContent\"}} @classes={{this.classes}} @userClasses={{@classes}} @items={{this.selectedItems}} @filterValue={{this.filterFieldValue}} @onFilterInput={{this.onFilterChange}} @onFilterKeydown={{this.handleFilterKeydown}} @onKeydown={{this.handleTriggerKeydown}} @onFocusOut={{this.blurTracker.handleFocusOut}} @hasCustomContent={{has-block \"selectedItem\"}}>\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent @classes={{this.classes}} @userClasses={{@classes}} @endContentPointerEvents={{@endContentPointerEvents}} @inputSize={{@inputSize}} @isLoading={{@isLoading}} @isClearable={{this.isClearable}} @onClear={{this.clearSelectedKeys}}>\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content @size={{if @popoverSize @popoverSize \"trigger\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @disableFocusTrap={{this.disableFocusTrap}} @blockScroll={{this.blockScroll}} @transitionDuration={{@transitionDuration}} @backdrop={{this.backdrop}} @disableTransitions={{@disableTransitions}} @focusTrapOptions={{@focusTrapOptions}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @backdropTransition={{@backdropTransition}} @transition={{@transition}} @preventAutoFocus={{true}}>\n <Listbox @items={{this.filteredItems}} @allowEmpty={{@allowEmpty}} @appearance={{@appearance}} @disabledKeys={{@disabledKeys}} @intent={{@intent}} @isKeyboardEventsEnabled={{true}} @onAction={{this.onAction}} @onSelectionChange={{this.onSelectionChange}} @selectedKeys={{this.selectedKeys}} @selectionMode={{if @selectionMode @selectionMode \"single\"}} @type=\"listbox\" @class={{this.classes.listbox class=@classes.listbox}} @elementToAddKeyboardEvents={{this.triggerRef.current}} @autoActivateMode={{this.autoActivateMode}} data-part=\"listbox\">\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item @key={{l.key}} @appearance={{@appearance}} @intent={{@intent}}>\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div class={{this.classes.emptyContent class=@classes.emptyContent}} data-part=\"empty-content\">\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
664
+ setComponentTemplate(precompileTemplate("<div {{this.updateMultipleSelectValue @selectedKeys}} {{this.updateSingleSelectValue @selectedKey}} {{this.containerRef.setup}} class={{this.classes.base class=@classes.base}} data-component=\"select\" data-part=\"base\" ...attributes>\n <FormControl @id={{@id}} @size={{@inputSize}} @label={{@label}} @isRequired={{@isRequired}} @description={{@description}} @errors={{@errors}} @isInvalid={{@isInvalid}} as |c|>\n <Popover @placement={{@placement}} @flipOptions={{@flipOptions}} @middleware={{@middleware}} @shiftOptions={{@shiftOptions}} @offsetOptions={{@offsetOptions}} @strategy={{@strategy}} @didClose={{this.didClose}} @isOpen={{this.isOpen}} @onOpenChange={{this.onOpenChange}} as |p|>\n <VisuallyHidden>\n <SelectNativeMirror @items={{@items}} @allowEmpty={{@allowEmpty}} @disabledKeys={{@disabledKeys}} @selectionMode={{@selectionMode}} @selectedKeys={{this.selectedKeys}} @selectedKey={{this.getSelectedKey}} @onSelectionChange={{this.onSelectionChange}} @onSingleSelectionChange={{this.onSingleSelectionChange}} @onItemsChange={{this.onItemsChange}} @placeholder={{@placeholder}} @id={{c.id}} @name={{@name}} @isDisabled={{@isDisabled}}>\n <:default as |l|>\n {{!-- @glint-expect-error: the signature of the native select is not the same as the listbox--}}\n {{yield l to=\"default\"}}\n </:default>\n </SelectNativeMirror>\n </VisuallyHidden>\n\n <div class={{this.classes.innerContainer class=@classes.innerContainer}} data-part=\"inner-container\">\n {{#if (has-block \"startContent\")}}\n <div data-part=\"start-content\" class={{this.classes.startContent class=@classes.startContent startContentPointerEvents=(if @startContentPointerEvents @startContentPointerEvents \"auto\")}}>\n {{yield to=\"startContent\"}}\n </div>\n {{/if}}\n {{!-- The wrapper, not the trigger, is the popover's width reference:\n in chips mode the trigger is only as wide as the space left over\n inside the field. The wrapper is a real full-width box in both\n modes, so the dropdown matches the field either way. --}}\n <div {{p.anchor}} {{p.measureWidth}} {{on \"click\" this.handleFieldClick}} data-test-id={{if this.showChips \"chips-field\"}} data-part=\"chips-field\" {{!-- These flags are stringified rather than handed the boolean.\n Glimmer renders a true boolean attribute as an empty value, so\n passing isInvalid straight through produced an empty data-invalid\n and the theme selector keyed on the value true never matched. --}} data-has-chips={{if this.showChips \"true\" \"false\"}} data-invalid={{if c.isInvalid \"true\" \"false\"}} data-disabled={{if @isDisabled \"true\" \"false\"}} class={{this.classes.chipsField class=@classes.chipsField hasStartContent=(has-block \"startContent\") hasEndContent=true}}>\n {{#if (and this.showChips this.hasSelection)}}\n {{!-- A block cannot be passed conditionally in Glimmer, so the\n :item block below is always supplied and the branch lives\n inside it: with no :selectedItem block from the consumer, both\n it and the trigger render exactly what they rendered before. --}}\n <SelectedChips @containerRef={{this.chipsContainerRef.setup}} @items={{this.selectedItems}} @classes={{this.classes}} @userClasses={{@classes}} @chipOptions={{this.chipOptions}} @isDisabled={{@isDisabled}} @isRemovable={{this.chipsRemovable}} @onRemove={{this.removeSelectedKey}}>\n <:item as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:item>\n </SelectedChips>\n {{/if}}\n <SelectTrigger @isFilterable={{@isFilterable}} @trigger={{p.trigger}} @triggerRef={{this.triggerRef.setup}} @isDisabled={{@isDisabled}} @showChips={{this.showChips}} @accessibleName={{this.triggerAccessibleName}} @placeholder={{@placeholder}} @hasSelection={{this.hasSelection}} @hasStartContent={{has-block \"startContent\"}} @classes={{this.classes}} @userClasses={{@classes}} @items={{this.selectedItems}} @filterValue={{this.filterFieldValue}} @onFilterInput={{this.onFilterChange}} @onFilterKeydown={{this.handleFilterKeydown}} @onKeydown={{this.handleTriggerKeydown}} @onFocusOut={{this.blurTracker.handleFocusOut}} @hasCustomContent={{has-block \"selectedItem\"}}>\n <:selectedItem as |selected|>\n {{~#if (has-block \"selectedItem\")~}}\n {{~yield selected to=\"selectedItem\"~}}\n {{~else~}}\n {{~selected.label~}}\n {{~/if~}}\n </:selectedItem>\n </SelectTrigger>\n </div>\n <SelectEndContent @classes={{this.classes}} @userClasses={{@classes}} @endContentPointerEvents={{@endContentPointerEvents}} @inputSize={{@inputSize}} @isLoading={{@isLoading}} @isClearable={{this.isClearable}} @onClear={{this.clearSelectedKeys}}>\n {{yield to=\"endContent\"}}\n </SelectEndContent>\n </div>\n\n <p.Content @size={{if @popoverSize @popoverSize \"trigger\"}} @target={{@target}} @renderInPlace={{@renderInPlace}} @disableFocusTrap={{this.disableFocusTrap}} @blockScroll={{this.blockScroll}} @transitionDuration={{@transitionDuration}} @backdrop={{this.backdrop}} @disableTransitions={{@disableTransitions}} @focusTrapOptions={{@focusTrapOptions}} @closeOnOutsideClick={{@closeOnOutsideClick}} @closeOnEscapeKey={{@closeOnEscapeKey}} @backdropTransition={{@backdropTransition}} @transition={{@transition}} @preventAutoFocus={{true}}>\n <Listbox @items={{this.filteredItems}} @allowEmpty={{@allowEmpty}} @variant={{this.variant}} @disabledKeys={{@disabledKeys}} @color={{this.color}} @isKeyboardEventsEnabled={{true}} @onAction={{this.onAction}} @onSelectionChange={{this.onSelectionChange}} @selectedKeys={{this.selectedKeys}} @selectionMode={{if @selectionMode @selectionMode \"single\"}} @type=\"listbox\" @class={{this.classes.listbox class=@classes.listbox}} @elementToAddKeyboardEvents={{this.triggerRef.current}} @autoActivateMode={{this.autoActivateMode}} data-part=\"listbox\">\n <:item as |l|>\n {{#if (has-block \"item\")}}\n {{yield l to=\"item\"}}\n {{else}}\n <l.Item @key={{l.key}} @variant={{this.variant}} @color={{this.color}}>\n {{l.label}}\n </l.Item>\n {{/if}}\n </:item>\n <:default as |l|>\n {{yield l to=\"default\"}}\n </:default>\n </Listbox>\n {{#if this.showEmptyContent}}\n <div class={{this.classes.emptyContent class=@classes.emptyContent}} data-part=\"empty-content\">\n {{#if (has-block \"emptyContent\")}}\n {{yield to=\"emptyContent\"}}\n {{else}}\n No results found.\n {{/if}}\n </div>\n {{/if}}\n </p.Content>\n </Popover>\n </FormControl>\n</div>", {
611
665
  strictMode: true,
612
666
  scope: () => ({
613
667
  FormControl,