ngwr 16.0.0 → 16.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (268) hide show
  1. package/badge/styles/_tag.scss +8 -4
  2. package/button/styles/_index.scss +13 -7
  3. package/cascader/styles/_rules.scss +4 -2
  4. package/checkbox/styles/_index.scss +4 -2
  5. package/date-picker/styles/_index.scss +6 -2
  6. package/date-stamp/styles/_index.scss +38 -0
  7. package/dialog/styles/_index.scss +38 -0
  8. package/fesm2022/internal-CVLvP9b_.mjs +33 -0
  9. package/fesm2022/internal-CVLvP9b_.mjs.map +1 -0
  10. package/fesm2022/ngwr-alert.mjs +11 -7
  11. package/fesm2022/ngwr-alert.mjs.map +1 -1
  12. package/fesm2022/ngwr-avatar.mjs +11 -7
  13. package/fesm2022/ngwr-avatar.mjs.map +1 -1
  14. package/fesm2022/ngwr-back-top.mjs +10 -6
  15. package/fesm2022/ngwr-back-top.mjs.map +1 -1
  16. package/fesm2022/ngwr-badge.mjs +18 -6
  17. package/fesm2022/ngwr-badge.mjs.map +1 -1
  18. package/fesm2022/ngwr-burger.mjs +9 -6
  19. package/fesm2022/ngwr-burger.mjs.map +1 -1
  20. package/fesm2022/ngwr-button.mjs +8 -4
  21. package/fesm2022/ngwr-button.mjs.map +1 -1
  22. package/fesm2022/ngwr-calendar.mjs +19 -8
  23. package/fesm2022/ngwr-calendar.mjs.map +1 -1
  24. package/fesm2022/ngwr-card.mjs +9 -5
  25. package/fesm2022/ngwr-card.mjs.map +1 -1
  26. package/fesm2022/ngwr-cascader.mjs +11 -5
  27. package/fesm2022/ngwr-cascader.mjs.map +1 -1
  28. package/fesm2022/ngwr-charts-calendar-heatmap.mjs +5 -2
  29. package/fesm2022/ngwr-charts-calendar-heatmap.mjs.map +1 -1
  30. package/fesm2022/ngwr-checkbox.mjs +10 -6
  31. package/fesm2022/ngwr-checkbox.mjs.map +1 -1
  32. package/fesm2022/ngwr-clipboard.mjs +2 -1
  33. package/fesm2022/ngwr-clipboard.mjs.map +1 -1
  34. package/fesm2022/ngwr-collapse.mjs +9 -5
  35. package/fesm2022/ngwr-collapse.mjs.map +1 -1
  36. package/fesm2022/ngwr-color-picker.mjs +4 -2
  37. package/fesm2022/ngwr-color-picker.mjs.map +1 -1
  38. package/fesm2022/ngwr-comment.mjs +13 -7
  39. package/fesm2022/ngwr-comment.mjs.map +1 -1
  40. package/fesm2022/ngwr-compare.mjs +9 -3
  41. package/fesm2022/ngwr-compare.mjs.map +1 -1
  42. package/fesm2022/ngwr-context-menu.mjs +4 -2
  43. package/fesm2022/ngwr-context-menu.mjs.map +1 -1
  44. package/fesm2022/ngwr-copy-value.mjs +11 -6
  45. package/fesm2022/ngwr-copy-value.mjs.map +1 -1
  46. package/fesm2022/ngwr-date-picker.mjs +86 -30
  47. package/fesm2022/ngwr-date-picker.mjs.map +1 -1
  48. package/fesm2022/ngwr-date-stamp-testing.mjs +34 -0
  49. package/fesm2022/ngwr-date-stamp-testing.mjs.map +1 -0
  50. package/fesm2022/ngwr-date-stamp.mjs +149 -0
  51. package/fesm2022/ngwr-date-stamp.mjs.map +1 -0
  52. package/fesm2022/ngwr-date.mjs +279 -50
  53. package/fesm2022/ngwr-date.mjs.map +1 -1
  54. package/fesm2022/ngwr-descriptions.mjs +9 -5
  55. package/fesm2022/ngwr-descriptions.mjs.map +1 -1
  56. package/fesm2022/ngwr-dialog-testing.mjs +23 -2
  57. package/fesm2022/ngwr-dialog-testing.mjs.map +1 -1
  58. package/fesm2022/ngwr-dialog.mjs +45 -16
  59. package/fesm2022/ngwr-dialog.mjs.map +1 -1
  60. package/fesm2022/ngwr-directives.mjs +102 -11
  61. package/fesm2022/ngwr-directives.mjs.map +1 -1
  62. package/fesm2022/ngwr-divider.mjs +4 -2
  63. package/fesm2022/ngwr-divider.mjs.map +1 -1
  64. package/fesm2022/ngwr-drawer.mjs +29 -3
  65. package/fesm2022/ngwr-drawer.mjs.map +1 -1
  66. package/fesm2022/ngwr-dropdown.mjs +4 -2
  67. package/fesm2022/ngwr-dropdown.mjs.map +1 -1
  68. package/fesm2022/ngwr-editor.mjs +5 -2
  69. package/fesm2022/ngwr-editor.mjs.map +1 -1
  70. package/fesm2022/ngwr-event-calendar.mjs +4 -2
  71. package/fesm2022/ngwr-event-calendar.mjs.map +1 -1
  72. package/fesm2022/ngwr-file-upload.mjs +9 -3
  73. package/fesm2022/ngwr-file-upload.mjs.map +1 -1
  74. package/fesm2022/ngwr-form.mjs +18 -6
  75. package/fesm2022/ngwr-form.mjs.map +1 -1
  76. package/fesm2022/ngwr-i18n-ar.mjs +2 -0
  77. package/fesm2022/ngwr-i18n-ar.mjs.map +1 -1
  78. package/fesm2022/ngwr-i18n-cs.mjs +2 -0
  79. package/fesm2022/ngwr-i18n-cs.mjs.map +1 -1
  80. package/fesm2022/ngwr-i18n-de.mjs +2 -0
  81. package/fesm2022/ngwr-i18n-de.mjs.map +1 -1
  82. package/fesm2022/ngwr-i18n-en.mjs +2 -0
  83. package/fesm2022/ngwr-i18n-en.mjs.map +1 -1
  84. package/fesm2022/ngwr-i18n-es.mjs +2 -0
  85. package/fesm2022/ngwr-i18n-es.mjs.map +1 -1
  86. package/fesm2022/ngwr-i18n-fr.mjs +2 -0
  87. package/fesm2022/ngwr-i18n-fr.mjs.map +1 -1
  88. package/fesm2022/ngwr-i18n-he.mjs +2 -0
  89. package/fesm2022/ngwr-i18n-he.mjs.map +1 -1
  90. package/fesm2022/ngwr-i18n-hi.mjs +2 -0
  91. package/fesm2022/ngwr-i18n-hi.mjs.map +1 -1
  92. package/fesm2022/ngwr-i18n-id.mjs +2 -0
  93. package/fesm2022/ngwr-i18n-id.mjs.map +1 -1
  94. package/fesm2022/ngwr-i18n-it.mjs +2 -0
  95. package/fesm2022/ngwr-i18n-it.mjs.map +1 -1
  96. package/fesm2022/ngwr-i18n-ja.mjs +2 -0
  97. package/fesm2022/ngwr-i18n-ja.mjs.map +1 -1
  98. package/fesm2022/ngwr-i18n-ko.mjs +2 -0
  99. package/fesm2022/ngwr-i18n-ko.mjs.map +1 -1
  100. package/fesm2022/ngwr-i18n-nl.mjs +2 -0
  101. package/fesm2022/ngwr-i18n-nl.mjs.map +1 -1
  102. package/fesm2022/ngwr-i18n-pl.mjs +2 -0
  103. package/fesm2022/ngwr-i18n-pl.mjs.map +1 -1
  104. package/fesm2022/ngwr-i18n-pt.mjs +2 -0
  105. package/fesm2022/ngwr-i18n-pt.mjs.map +1 -1
  106. package/fesm2022/ngwr-i18n-ru.mjs +2 -0
  107. package/fesm2022/ngwr-i18n-ru.mjs.map +1 -1
  108. package/fesm2022/ngwr-i18n-sv.mjs +2 -0
  109. package/fesm2022/ngwr-i18n-sv.mjs.map +1 -1
  110. package/fesm2022/ngwr-i18n-tr.mjs +2 -0
  111. package/fesm2022/ngwr-i18n-tr.mjs.map +1 -1
  112. package/fesm2022/ngwr-i18n-uk.mjs +2 -0
  113. package/fesm2022/ngwr-i18n-uk.mjs.map +1 -1
  114. package/fesm2022/ngwr-i18n-vi.mjs +2 -0
  115. package/fesm2022/ngwr-i18n-vi.mjs.map +1 -1
  116. package/fesm2022/ngwr-i18n-zh-tw.mjs +2 -0
  117. package/fesm2022/ngwr-i18n-zh-tw.mjs.map +1 -1
  118. package/fesm2022/ngwr-i18n-zh.mjs +2 -0
  119. package/fesm2022/ngwr-i18n-zh.mjs.map +1 -1
  120. package/fesm2022/ngwr-i18n.mjs +34 -8
  121. package/fesm2022/ngwr-i18n.mjs.map +1 -1
  122. package/fesm2022/ngwr-input-number.mjs +9 -3
  123. package/fesm2022/ngwr-input-number.mjs.map +1 -1
  124. package/fesm2022/ngwr-input-otp.mjs +4 -2
  125. package/fesm2022/ngwr-input-otp.mjs.map +1 -1
  126. package/fesm2022/ngwr-input.mjs +20 -10
  127. package/fesm2022/ngwr-input.mjs.map +1 -1
  128. package/fesm2022/ngwr-keyboard.mjs +9 -3
  129. package/fesm2022/ngwr-keyboard.mjs.map +1 -1
  130. package/fesm2022/ngwr-knob.mjs +9 -3
  131. package/fesm2022/ngwr-knob.mjs.map +1 -1
  132. package/fesm2022/ngwr-layout.mjs +13 -5
  133. package/fesm2022/ngwr-layout.mjs.map +1 -1
  134. package/fesm2022/ngwr-lightbox.mjs +9 -5
  135. package/fesm2022/ngwr-lightbox.mjs.map +1 -1
  136. package/fesm2022/ngwr-list.mjs +13 -5
  137. package/fesm2022/ngwr-list.mjs.map +1 -1
  138. package/fesm2022/ngwr-load-state.mjs +9 -5
  139. package/fesm2022/ngwr-load-state.mjs.map +1 -1
  140. package/fesm2022/ngwr-overlay.mjs +84 -1
  141. package/fesm2022/ngwr-overlay.mjs.map +1 -1
  142. package/fesm2022/ngwr-pagination.mjs +3 -2
  143. package/fesm2022/ngwr-pagination.mjs.map +1 -1
  144. package/fesm2022/ngwr-pipes.mjs +21 -5
  145. package/fesm2022/ngwr-pipes.mjs.map +1 -1
  146. package/fesm2022/ngwr-popover.mjs +93 -4
  147. package/fesm2022/ngwr-popover.mjs.map +1 -1
  148. package/fesm2022/ngwr-progress.mjs +4 -2
  149. package/fesm2022/ngwr-progress.mjs.map +1 -1
  150. package/fesm2022/ngwr-radio.mjs +9 -5
  151. package/fesm2022/ngwr-radio.mjs.map +1 -1
  152. package/fesm2022/ngwr-rating.mjs +9 -3
  153. package/fesm2022/ngwr-rating.mjs.map +1 -1
  154. package/fesm2022/ngwr-resizable.mjs +503 -0
  155. package/fesm2022/ngwr-resizable.mjs.map +1 -0
  156. package/fesm2022/ngwr-result.mjs +9 -5
  157. package/fesm2022/ngwr-result.mjs.map +1 -1
  158. package/fesm2022/ngwr-segmented.mjs +4 -2
  159. package/fesm2022/ngwr-segmented.mjs.map +1 -1
  160. package/fesm2022/ngwr-select.mjs +13 -5
  161. package/fesm2022/ngwr-select.mjs.map +1 -1
  162. package/fesm2022/ngwr-skeleton.mjs +4 -2
  163. package/fesm2022/ngwr-skeleton.mjs.map +1 -1
  164. package/fesm2022/ngwr-slider.mjs +4 -2
  165. package/fesm2022/ngwr-slider.mjs.map +1 -1
  166. package/fesm2022/ngwr-speed-dial.mjs +4 -2
  167. package/fesm2022/ngwr-speed-dial.mjs.map +1 -1
  168. package/fesm2022/ngwr-spinner.mjs +4 -2
  169. package/fesm2022/ngwr-spinner.mjs.map +1 -1
  170. package/fesm2022/ngwr-splitter.mjs +17 -21
  171. package/fesm2022/ngwr-splitter.mjs.map +1 -1
  172. package/fesm2022/ngwr-stepper.mjs +9 -3
  173. package/fesm2022/ngwr-stepper.mjs.map +1 -1
  174. package/fesm2022/ngwr-switch.mjs +9 -5
  175. package/fesm2022/ngwr-switch.mjs.map +1 -1
  176. package/fesm2022/ngwr-table-testing.mjs +5 -1
  177. package/fesm2022/ngwr-table-testing.mjs.map +1 -1
  178. package/fesm2022/ngwr-table.mjs +167 -10
  179. package/fesm2022/ngwr-table.mjs.map +1 -1
  180. package/fesm2022/ngwr-textarea.mjs +9 -3
  181. package/fesm2022/ngwr-textarea.mjs.map +1 -1
  182. package/fesm2022/ngwr-timeline.mjs +18 -8
  183. package/fesm2022/ngwr-timeline.mjs.map +1 -1
  184. package/fesm2022/ngwr-toast-testing.mjs +6 -1
  185. package/fesm2022/ngwr-toast-testing.mjs.map +1 -1
  186. package/fesm2022/ngwr-toast.mjs +529 -104
  187. package/fesm2022/ngwr-toast.mjs.map +1 -1
  188. package/fesm2022/ngwr-transfer.mjs +4 -2
  189. package/fesm2022/ngwr-transfer.mjs.map +1 -1
  190. package/fesm2022/ngwr-tree.mjs +4 -2
  191. package/fesm2022/ngwr-tree.mjs.map +1 -1
  192. package/fesm2022/ngwr-typography.mjs +9 -3
  193. package/fesm2022/ngwr-typography.mjs.map +1 -1
  194. package/fesm2022/ngwr-utils-router.mjs +18 -2
  195. package/fesm2022/ngwr-utils-router.mjs.map +1 -1
  196. package/fesm2022/ngwr-utils.mjs +9 -2
  197. package/fesm2022/ngwr-utils.mjs.map +1 -1
  198. package/fesm2022/ngwr-version.mjs +1 -1
  199. package/fesm2022/ngwr-version.mjs.map +1 -1
  200. package/fesm2022/ngwr-window.mjs +7 -4
  201. package/fesm2022/ngwr-window.mjs.map +1 -1
  202. package/fesm2022/ngwr.mjs.map +1 -1
  203. package/i18n/ar.json +6 -0
  204. package/i18n/cs.json +6 -0
  205. package/i18n/de.json +6 -0
  206. package/i18n/en.json +6 -0
  207. package/i18n/es.json +6 -0
  208. package/i18n/fr.json +6 -0
  209. package/i18n/he.json +6 -0
  210. package/i18n/hi.json +6 -0
  211. package/i18n/id.json +6 -0
  212. package/i18n/it.json +6 -0
  213. package/i18n/ja.json +6 -0
  214. package/i18n/ko.json +6 -0
  215. package/i18n/nl.json +6 -0
  216. package/i18n/pl.json +6 -0
  217. package/i18n/pt.json +6 -0
  218. package/i18n/ru.json +6 -0
  219. package/i18n/sv.json +6 -0
  220. package/i18n/tr.json +6 -0
  221. package/i18n/uk.json +6 -0
  222. package/i18n/vi.json +6 -0
  223. package/i18n/zh-TW.json +6 -0
  224. package/i18n/zh.json +6 -0
  225. package/input/styles/_index.scss +10 -5
  226. package/input-number/styles/_index.scss +6 -3
  227. package/input-otp/styles/_index.scss +4 -2
  228. package/llms-full.txt +29 -10
  229. package/llms.txt +8 -4
  230. package/package.json +15 -1
  231. package/radio/styles/_index.scss +4 -2
  232. package/resizable/styles/_index.scss +154 -0
  233. package/schematics/use/rule.js +1 -0
  234. package/schematics/use/symbol-map.json +4 -0
  235. package/select/styles/_index.scss +6 -3
  236. package/skills/ngwr/SKILL.md +1 -1
  237. package/skills/ngwr/references/catalog.md +4 -1
  238. package/skills/ngwr/references/setup.md +3 -0
  239. package/switch/styles/_index.scss +4 -2
  240. package/table/styles/_index.scss +53 -0
  241. package/textarea/styles/_index.scss +4 -2
  242. package/theme/styles/_motion.scss +6 -0
  243. package/toast/styles/_index.scss +19 -0
  244. package/types/ngwr-burger.d.ts +0 -1
  245. package/types/ngwr-calendar.d.ts +7 -0
  246. package/types/ngwr-charts-calendar-heatmap.d.ts +2 -1
  247. package/types/ngwr-clipboard.d.ts +7 -0
  248. package/types/ngwr-date-picker.d.ts +9 -2
  249. package/types/ngwr-date-stamp-testing.d.ts +47 -0
  250. package/types/ngwr-date-stamp.d.ts +81 -0
  251. package/types/ngwr-date.d.ts +135 -24
  252. package/types/ngwr-dialog-testing.d.ts +10 -0
  253. package/types/ngwr-dialog.d.ts +72 -4
  254. package/types/ngwr-directives.d.ts +36 -1
  255. package/types/ngwr-drawer.d.ts +21 -0
  256. package/types/ngwr-i18n.d.ts +44 -14
  257. package/types/ngwr-overlay.d.ts +36 -0
  258. package/types/ngwr-pipes.d.ts +15 -0
  259. package/types/ngwr-popover.d.ts +39 -1
  260. package/types/ngwr-resizable.d.ts +228 -0
  261. package/types/ngwr-table-testing.d.ts +3 -1
  262. package/types/ngwr-table.d.ts +120 -4
  263. package/types/ngwr-toast-testing.d.ts +12 -1
  264. package/types/ngwr-toast.d.ts +215 -18
  265. package/types/ngwr-utils-router.d.ts +22 -0
  266. package/types/ngwr-utils.d.ts +8 -1
  267. package/types/ngwr-version.d.ts +1 -1
  268. package/types/ngwr.d.ts +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-checkbox.mjs","names":[],"sources":["../../../projects/lib/checkbox/tokens/checkbox-group.token.ts","../../../projects/lib/checkbox/checkbox.ts","../../../projects/lib/checkbox/checkbox.html","../../../projects/lib/checkbox/checkbox-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCheckboxGroupContext } from '../types';\n\n/**\n * Token a `<wr-checkbox>` injects to read selection state from — and\n * toggle values in — its parent `<wr-checkbox-group>` (when present).\n *\n * @internal\n */\nexport const WR_CHECKBOX_GROUP = new InjectionToken<WrCheckboxGroupContext>('WR_CHECKBOX_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\n\n/**\n * Two-state checkbox.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone, and\n * classic `[(ngModel)]` / reactive forms keep working through Angular's bridge.\n *\n * @example\n * ```html\n * <wr-checkbox [(checked)]=\"agree\">I agree</wr-checkbox>\n * <wr-checkbox [formField]=\"form.agree\">I agree</wr-checkbox>\n * ```\n *\n * **Inside `<wr-checkbox-group>`** — the checkbox's `checkboxValue` is added to\n * or removed from the group's array, and the group is the native form control.\n * (The identity input is `checkboxValue`, not `value`, because\n * `FormCheckboxControl` reserves `value` — its form state is the boolean\n * `checked`.)\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\nexport type WrCheckboxSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-checkbox',\n templateUrl: './checkbox.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element. A static\n // `id=\"x\"` in a consumer's template is written to the host as a plain\n // attribute AS WELL as fed to the input, which put two elements with the\n // same id in the document and made `<label for>` resolve through\n // `getElementById` to the host — not a labelable element, so `input.labels`\n // went from 1 to 0 and `document.getElementById(id)` returned the wrong node.\n '[attr.id]': 'null',\n // The group identity, reflected so a HARNESS can read it. It is the only\n // way: `checkboxValue` is an `unknown`-typed TypeScript value that reaches\n // no attribute otherwise, and `WrCheckboxHarness.getCheckboxValue()` read\n // `value` off the inner `<input>` — which nothing writes, so it answered\n // `null` for every checkbox in every state. A harness method that answers\n // the same for a working component and a broken one is the one thing the\n // harness rules forbid outright.\n //\n // `data-`, deliberately, and NOT `value`: a leftover static `value=\"x\"` from\n // before v9 still lands on this host as a plain attribute, so reading\n // `value` here would report the identity a consumer THOUGHT they set while\n // the component used `null`. That is the exact confusion migration-v9\n // exists to end.\n '[attr.data-checkbox-value]': 'reflectedValue()',\n },\n imports: [WrIcon],\n})\nexport class WrCheckbox implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('checkbox');\n }\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n *\n * @default Randomly generated\n */\n readonly id = input<string>(wrRandomId('wr-checkbox'));\n\n /**\n * This checkbox's identity when inside a `<wr-checkbox-group>` — the value\n * added to / removed from the group's array. Ignored in standalone mode.\n * (Named `checkboxValue`, not `value`, because `FormCheckboxControl` reserves\n * `value`.)\n */\n readonly checkboxValue = input<unknown>(null);\n\n /**\n * `checkboxValue` as an attribute, when it can be one.\n *\n * A primitive round-trips through the DOM and is what a group identity is in\n * practice. Anything else — an object, an array — has no honest attribute\n * form, so the attribute is ABSENT rather than `[object Object]`: a harness\n * reading it then gets `null`, which is true, instead of a string that looks\n * like data and identifies nothing.\n */\n protected readonly reflectedValue = computed(() => {\n const value = this.checkboxValue();\n // Narrowed inline rather than through a `typeof` held in a variable, which\n // TypeScript does not follow — and the linter is right to refuse it: the\n // point of this guard is that `String()` never sees an object.\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n return null;\n });\n\n /**\n * Accessible name for a checkbox used WITHOUT projected text — a selection\n * cell in a table, say. The wrapping `<label>` names the control whenever\n * content is projected; with none, the native input has no name, and an\n * `aria-label` put on the host lands on a `<wr-checkbox>` element that no\n * screen reader ever announces.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Ids of the elements that name this checkbox, space-separated, for a box\n * whose name is already on screen somewhere else — a table row's label cell,\n * say, joined to an action word. Lands on the inner `<input>` as\n * `aria-labelledby`, which wins over `ariaLabel` and over projected text.\n *\n * The ids have to resolve in the same document; one that matches nothing is\n * skipped, and with none left the box falls back to `ariaLabel`.\n *\n * @default null\n */\n readonly ariaLabelledby = input<string | null>(null);\n\n /**\n * Checked state — the form value. Bound by `[formField]`, two-way via\n * `[(checked)]`, or `[(ngModel)]`. Ignored inside a `<wr-checkbox-group>`,\n * where the group's array is the source of truth.\n */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /**\n * Disable the checkbox. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native `<input type=\"checkbox\">` ignores the `readonly` attribute, so this\n * cancels the click's activation behaviour instead — which covers Space too,\n * since a checkbox turns Space into a click — and mirrors the state as\n * `aria-readonly`, which role `checkbox` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCheckboxSize>('md');\n\n /**\n * Optional icon name rendered inside the box when checked, in place of the\n * default checkmark. Use any registered NGWR icon.\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Show the indeterminate (\"mixed\") state — a dash instead of a check. Visual\n * only and controlled: set it yourself for a parent \"select all\" whose\n * children are partly checked, and clear it on the next toggle. Takes visual\n * precedence over `checked`; the native input reports `aria-checked=\"mixed\"`.\n * A click the host does not answer still toggles `checked` underneath, and the\n * dash and the mixed state both stay until the binding turns `false`.\n *\n * @default false\n */\n readonly indeterminate = input(false, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_CHECKBOX_GROUP, { optional: true });\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n\n /** Rendered \"is checked\" — reads the group when grouped, else the `checked` model. */\n protected readonly isChecked = computed(() =>\n this.group ? this.group.isSelected(this.checkboxValue()) : this.checked()\n );\n\n /** Effective disabled — the `disabled` input wins, then the group. */\n protected readonly effectiveDisabled = computed(() => {\n if (this.disabled()) return true;\n return this.group ? this.group.isDisabled() : false;\n });\n\n /** Effective readonly — this box's own `readonly` input, or the group's. */\n protected readonly effectiveReadonly = computed(() => {\n if (this.readonly()) return true;\n return this.group ? this.group.isReadonly() : false;\n });\n\n /**\n * The surrounding `<wr-form-field>`'s error state, mirrored onto the native\n * input. Inside a `<wr-checkbox-group>` the GROUP is the bound control and\n * carries the state, so a grouped box shields itself and stays silent — nine\n * boxes each announcing the group's one error is noise, not information.\n */\n private readonly fieldAria = useFormFieldAria();\n protected readonly ariaInvalid = computed(() => (this.group ? null : this.fieldAria.ariaInvalid()));\n protected readonly describedBy = computed(() => (this.group ? null : this.fieldAria.describedBy()));\n\n protected readonly classes = computed(() => {\n const parts = ['wr-checkbox'];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-checkbox--${size}`);\n if (this.indeterminate()) parts.push('wr-checkbox--indeterminate');\n else if (this.isChecked()) parts.push('wr-checkbox--checked');\n if (this.effectiveDisabled()) parts.push('wr-checkbox--disabled');\n else if (this.effectiveReadonly()) parts.push('wr-checkbox--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the checkbox — what Signal Forms calls to focus this control. The\n * native input takes it, since the host has no tab stop of its own; a disabled\n * box refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space\n * paths need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.effectiveReadonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n const inputEl = event.target as HTMLInputElement;\n // Activating a checkbox clears its own `indeterminate` before `change` fires,\n // and the `[indeterminate]` binding never writes again while the bound value\n // stays `true` — so the box kept painting the dash while the accessibility\n // tree announced \"checked\". The input is controlled: the mixed state holds\n // until the host clears it, and a host that does clears it through the\n // binding on the next change detection.\n inputEl.indeterminate = this.indeterminate();\n\n if (this.effectiveReadonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n inputEl.checked = this.isChecked();\n return;\n }\n if (this.group) {\n this.group.toggle(this.checkboxValue());\n return;\n }\n this.checked.set(inputEl.checked);\n }\n\n protected onInputBlur(): void {\n // Inside a group the GROUP is the bound control, and its own `touch` is\n // what a form listens to; the child's output is wired to nothing there.\n if (this.group) this.group.blurred();\n this.touch.emit();\n }\n}\n","<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [checked]=\"isChecked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"effectiveDisabled()\"\n [attr.aria-readonly]=\"effectiveReadonly() || null\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n } @else if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n HostAttributeToken,\n ViewEncapsulation,\n computed,\n forwardRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\nimport type { WrCheckboxGroupContext } from './types';\n\n/**\n * Manages a group of `<wr-checkbox>` children as a single form value — an\n * array of the checked items' **`checkboxValue`** inputs, not their `value`.\n * `FormCheckboxControl` reserves `value` for the form value, so a child's\n * boolean state is `checked` and its group identity is `checkboxValue`; a\n * leftover static `value=\"x\"` lands on the host as a plain DOM attribute, and\n * every box in the group keeps the default identity `null` and toggles\n * together.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown[]>`,\n * so `[formField]` binds to its `value` model. `[(value)]` works standalone,\n * and classic `[(ngModel)]` / reactive forms keep working through the bridge.\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * <wr-checkbox checkboxValue=\"darkmode\">Dark mode</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\n@Component({\n selector: 'wr-checkbox-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-checkbox-group',\n role: 'group',\n // `<label for>` binds only to a labelable element, which a `role=\"group\"`\n // is not, so the field's own label reached this host through nothing and\n // the group announced no name at all. Same call `wr-radio-group` and\n // `wr-rating` already make.\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-invalid]': 'fieldAria.ariaInvalid()',\n '[attr.aria-describedby]': 'fieldAria.describedBy()',\n },\n providers: [\n {\n provide: WR_CHECKBOX_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckboxGroup),\n },\n ],\n})\nexport class WrCheckboxGroup implements FormValueControl<unknown[]>, WrCheckboxGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('checkbox');\n }\n\n /**\n * Disable every child checkbox. Bound automatically from the field's\n * disabled state when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits on every child while they stay focusable and the value still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * No `aria-readonly` on the host: role `group` does not support it (the state\n * is not global), so each child box mirrors its own instead.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /** The checked items' values. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<unknown[]>([]);\n\n /** Emitted when a child toggles so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n // The current selection as a guaranteed array — a classic-forms binding can\n // write null even though the type is `unknown[]`, so normalise every read.\n private readonly selected = computed<readonly unknown[]>(() => {\n const v = this.value();\n return Array.isArray(v) ? v : [];\n });\n\n /** Effective disabled state (WrCheckboxGroupContext). */\n readonly isDisabled = computed(() => this.disabled());\n\n /** Effective readonly state (WrCheckboxGroupContext). */\n readonly isReadonly = computed(() => this.readonly());\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Focus the group — what Signal Forms calls to focus this control. The first\n * enabled box takes it, which is where Tab lands: the host is a `role=\"group\"`\n * with no tab stop of its own, and a disabled box has none either.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLInputElement>('.wr-checkbox__input:not(:disabled)')?.focus(options);\n }\n\n // WrCheckboxGroupContext\n\n isSelected(value: unknown): boolean {\n return this.selected().includes(value);\n }\n\n toggle(value: unknown): void {\n if (this.isDisabled() || this.isReadonly()) return;\n const current = this.selected();\n const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];\n this.value.set(next);\n this.touch.emit();\n }\n\n /** @internal A child checkbox lost focus — see {@link WrCheckboxGroupContext.blurred}. */\n blurred(): void {\n this.touch.emit();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,oBAAoB,IAAI,eAAuC,mBAAmB;;;;;;;ACwE/F,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAQS,KAAK,MAAc,WAAW,aAAa,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;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,2BAA2B;GAC5B;GACD,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,eAAgB;GAC9C,CACF;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-checkbox.mjs","names":[],"sources":["../../../projects/lib/checkbox/tokens/checkbox-group.token.ts","../../../projects/lib/checkbox/checkbox.ts","../../../projects/lib/checkbox/checkbox.html","../../../projects/lib/checkbox/checkbox-group.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCheckboxGroupContext } from '../types';\n\n/**\n * Token a `<wr-checkbox>` injects to read selection state from — and\n * toggle values in — its parent `<wr-checkbox-group>` (when present).\n *\n * @internal\n */\nexport const WR_CHECKBOX_GROUP = new InjectionToken<WrCheckboxGroupContext>('WR_CHECKBOX_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n type ElementRef,\n ViewEncapsulation,\n computed,\n inject,\n input,\n model,\n output,\n viewChild,\n} from '@angular/core';\nimport type { FormCheckboxControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { WrIcon, type WrIconName } from 'ngwr/icon';\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\n\n/**\n * Two-state checkbox.\n *\n * A signal-forms native control: it implements `FormCheckboxControl`, so\n * `[formField]` binds straight to its `checked` model — no\n * `ControlValueAccessor` in between. `[(checked)]` works standalone, and\n * classic `[(ngModel)]` / reactive forms keep working through Angular's bridge.\n *\n * @example\n * ```html\n * <wr-checkbox [(checked)]=\"agree\">I agree</wr-checkbox>\n * <wr-checkbox [formField]=\"form.agree\">I agree</wr-checkbox>\n * ```\n *\n * **Inside `<wr-checkbox-group>`** — the checkbox's `checkboxValue` is added to\n * or removed from the group's array, and the group is the native form control.\n * (The identity input is `checkboxValue`, not `value`, because\n * `FormCheckboxControl` reserves `value` — its form state is the boolean\n * `checked`.)\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\nexport type WrCheckboxSize = 'sm' | 'md' | 'lg';\n\n@Component({\n selector: 'wr-checkbox',\n templateUrl: './checkbox.html',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-checkbox',\n '[class]': 'classes()',\n // The `id` input belongs to the native input, not to this element. A static\n // `id=\"x\"` in a consumer's template is written to the host as a plain\n // attribute AS WELL as fed to the input, which put two elements with the\n // same id in the document and made `<label for>` resolve through\n // `getElementById` to the host — not a labelable element, so `input.labels`\n // went from 1 to 0 and `document.getElementById(id)` returned the wrong node.\n '[attr.id]': 'null',\n // The group identity, reflected so a HARNESS can read it. It is the only\n // way: `checkboxValue` is an `unknown`-typed TypeScript value that reaches\n // no attribute otherwise, and `WrCheckboxHarness.getCheckboxValue()` read\n // `value` off the inner `<input>` — which nothing writes, so it answered\n // `null` for every checkbox in every state. A harness method that answers\n // the same for a working component and a broken one is the one thing the\n // harness rules forbid outright.\n //\n // `data-`, deliberately, and NOT `value`: a leftover static `value=\"x\"` from\n // before v9 still lands on this host as a plain attribute, so reading\n // `value` here would report the identity a consumer THOUGHT they set while\n // the component used `null`. That is the exact confusion migration-v9\n // exists to end.\n '[attr.data-checkbox-value]': 'reflectedValue()',\n },\n imports: [WrIcon],\n})\nexport class WrCheckbox implements FormCheckboxControl {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('checkbox');\n }\n\n /**\n * Stable id used to associate the native input with its label. Lands on the\n * inner `<input>`; the host never keeps it.\n *\n * @default Randomly generated\n */\n readonly id = input<string>(wrRandomId('wr-checkbox'));\n\n /**\n * This checkbox's identity when inside a `<wr-checkbox-group>` — the value\n * added to / removed from the group's array. Ignored in standalone mode.\n * (Named `checkboxValue`, not `value`, because `FormCheckboxControl` reserves\n * `value`.)\n */\n readonly checkboxValue = input<unknown>(null);\n\n /**\n * `checkboxValue` as an attribute, when it can be one.\n *\n * A primitive round-trips through the DOM and is what a group identity is in\n * practice. Anything else — an object, an array — has no honest attribute\n * form, so the attribute is ABSENT rather than `[object Object]`: a harness\n * reading it then gets `null`, which is true, instead of a string that looks\n * like data and identifies nothing.\n */\n protected readonly reflectedValue = computed(() => {\n const value = this.checkboxValue();\n // Narrowed inline rather than through a `typeof` held in a variable, which\n // TypeScript does not follow — and the linter is right to refuse it: the\n // point of this guard is that `String()` never sees an object.\n if (typeof value === 'string') return value;\n if (typeof value === 'number' || typeof value === 'boolean') return String(value);\n return null;\n });\n\n /**\n * Accessible name for a checkbox used WITHOUT projected text — a selection\n * cell in a table, say. The wrapping `<label>` names the control whenever\n * content is projected; with none, the native input has no name, and an\n * `aria-label` put on the host lands on a `<wr-checkbox>` element that no\n * screen reader ever announces.\n */\n readonly ariaLabel = input<string | null>(null);\n\n /**\n * Ids of the elements that name this checkbox, space-separated, for a box\n * whose name is already on screen somewhere else — a table row's label cell,\n * say, joined to an action word. Lands on the inner `<input>` as\n * `aria-labelledby`, which wins over `ariaLabel` and over projected text.\n *\n * The ids have to resolve in the same document; one that matches nothing is\n * skipped, and with none left the box falls back to `ariaLabel`.\n *\n * @default null\n */\n readonly ariaLabelledby = input<string | null>(null);\n\n /**\n * Checked state — the form value. Bound by `[formField]`, two-way via\n * `[(checked)]`, or `[(ngModel)]`. Ignored inside a `<wr-checkbox-group>`,\n * where the group's array is the source of truth.\n */\n readonly checked = model<boolean>(false);\n\n /** Emitted on blur so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n /**\n * Disable the checkbox. Bound automatically from the field's disabled state\n * when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits while staying focusable and submittable. Bound automatically\n * from the field's readonly state when used with `[formField]`.\n *\n * A native `<input type=\"checkbox\">` ignores the `readonly` attribute, so this\n * cancels the click's activation behaviour instead — which covers Space too,\n * since a checkbox turns Space into a click — and mirrors the state as\n * `aria-readonly`, which role `checkbox` supports.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** Control size — shares the `--wr-control-*` contract. @default 'md' */\n readonly size = input<WrCheckboxSize>('md');\n\n /**\n * Optional icon name rendered inside the box when checked, in place of the\n * default checkmark. Use any registered NGWR icon.\n */\n readonly icon = input<WrIconName | null>(null);\n\n /**\n * Show the indeterminate (\"mixed\") state — a dash instead of a check. Visual\n * only and controlled: set it yourself for a parent \"select all\" whose\n * children are partly checked, and clear it on the next toggle. Takes visual\n * precedence over `checked`; the native input reports `aria-checked=\"mixed\"`.\n * A click the host does not answer still toggles `checked` underneath, and the\n * dash and the mixed state both stay until the binding turns `false`.\n *\n * @default false\n */\n readonly indeterminate = input(false, { transform: coerceBooleanProperty });\n\n private readonly group = inject(WR_CHECKBOX_GROUP, { optional: true });\n\n private readonly native = viewChild.required<ElementRef<HTMLInputElement>>('native');\n\n /** Rendered \"is checked\" — reads the group when grouped, else the `checked` model. */\n protected readonly isChecked = computed(() =>\n this.group ? this.group.isSelected(this.checkboxValue()) : this.checked()\n );\n\n /** Effective disabled — the `disabled` input wins, then the group. */\n protected readonly effectiveDisabled = computed(() => {\n if (this.disabled()) return true;\n return this.group ? this.group.isDisabled() : false;\n });\n\n /** Effective readonly — this box's own `readonly` input, or the group's. */\n protected readonly effectiveReadonly = computed(() => {\n if (this.readonly()) return true;\n return this.group ? this.group.isReadonly() : false;\n });\n\n /**\n * The surrounding `<wr-form-field>`'s error state, mirrored onto the native\n * input. Inside a `<wr-checkbox-group>` the GROUP is the bound control and\n * carries the state, so a grouped box shields itself and stays silent — nine\n * boxes each announcing the group's one error is noise, not information.\n */\n private readonly fieldAria = useFormFieldAria();\n protected readonly ariaInvalid = computed(() => (this.group ? null : this.fieldAria.ariaInvalid()));\n protected readonly describedBy = computed(() => (this.group ? null : this.fieldAria.describedBy()));\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n const size = this.size();\n if (size !== 'md') parts.push(`wr-checkbox--${size}`);\n if (this.indeterminate()) parts.push('wr-checkbox--indeterminate');\n else if (this.isChecked()) parts.push('wr-checkbox--checked');\n if (this.effectiveDisabled()) parts.push('wr-checkbox--disabled');\n else if (this.effectiveReadonly()) parts.push('wr-checkbox--readonly');\n return parts.join(' ');\n });\n\n /**\n * Focus the checkbox — what Signal Forms calls to focus this control. The\n * native input takes it, since the host has no tab stop of its own; a disabled\n * box refuses, as a disabled input always does.\n */\n focus(options?: FocusOptions): void {\n this.native().nativeElement.focus(options);\n }\n\n // Template handlers\n\n /**\n * Cancel the toggle while readonly. `change` never fires for a click whose\n * default was prevented, so this is the only guard the pointer and Space\n * paths need; `onInputChange` keeps its own for a synthetic `change`.\n */\n protected onInputClick(event: Event): void {\n if (this.effectiveReadonly()) event.preventDefault();\n }\n\n protected onInputChange(event: Event): void {\n const inputEl = event.target as HTMLInputElement;\n // Activating a checkbox clears its own `indeterminate` before `change` fires,\n // and the `[indeterminate]` binding never writes again while the bound value\n // stays `true` — so the box kept painting the dash while the accessibility\n // tree announced \"checked\". The input is controlled: the mixed state holds\n // until the host clears it, and a host that does clears it through the\n // binding on the next change detection.\n inputEl.indeterminate = this.indeterminate();\n\n if (this.effectiveReadonly()) {\n // A synthetic `change` cannot be prevented — put the DOM back instead.\n inputEl.checked = this.isChecked();\n return;\n }\n if (this.group) {\n this.group.toggle(this.checkboxValue());\n return;\n }\n this.checked.set(inputEl.checked);\n }\n\n protected onInputBlur(): void {\n // Inside a group the GROUP is the bound control, and its own `touch` is\n // what a form listens to; the child's output is wired to nothing there.\n if (this.group) this.group.blurred();\n this.touch.emit();\n }\n}\n","<label class=\"wr-checkbox__label\" [for]=\"id()\">\n <input\n #native\n class=\"wr-checkbox__input\"\n type=\"checkbox\"\n [id]=\"id()\"\n [attr.aria-label]=\"ariaLabel()\"\n [attr.aria-labelledby]=\"ariaLabelledby()\"\n [checked]=\"isChecked()\"\n [indeterminate]=\"indeterminate()\"\n [disabled]=\"effectiveDisabled()\"\n [attr.aria-readonly]=\"effectiveReadonly() || null\"\n [attr.aria-invalid]=\"ariaInvalid()\"\n [attr.aria-describedby]=\"describedBy()\"\n (click)=\"onInputClick($event)\"\n (change)=\"onInputChange($event)\"\n (blur)=\"onInputBlur()\"\n />\n\n <span class=\"wr-checkbox__box\" aria-hidden=\"true\">\n @if (indeterminate()) {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__dash\">\n <line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" />\n </svg>\n } @else if (icon(); as iconName) {\n <wr-icon class=\"wr-checkbox__icon\" [name]=\"iconName\" />\n } @else {\n <svg viewBox=\"0 0 16 16\" class=\"wr-checkbox__mark\">\n <polyline\n points=\"3.5 8.5 6.5 11.5 12.5 5\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n />\n </svg>\n }\n </span>\n\n <span class=\"wr-checkbox__text\">\n <ng-content />\n </span>\n</label>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport {\n Component,\n ElementRef,\n HostAttributeToken,\n ViewEncapsulation,\n computed,\n forwardRef,\n inject,\n input,\n model,\n output,\n} from '@angular/core';\nimport type { FormValueControl } from '@angular/forms/signals';\n\nimport { useFormFieldAria } from 'ngwr/form';\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_CHECKBOX_GROUP } from './tokens';\nimport type { WrCheckboxGroupContext } from './types';\n\n/**\n * Manages a group of `<wr-checkbox>` children as a single form value — an\n * array of the checked items' **`checkboxValue`** inputs, not their `value`.\n * `FormCheckboxControl` reserves `value` for the form value, so a child's\n * boolean state is `checked` and its group identity is `checkboxValue`; a\n * leftover static `value=\"x\"` lands on the host as a plain DOM attribute, and\n * every box in the group keeps the default identity `null` and toggles\n * together.\n *\n * A signal-forms native control: it implements `FormValueControl<unknown[]>`,\n * so `[formField]` binds to its `value` model. `[(value)]` works standalone,\n * and classic `[(ngModel)]` / reactive forms keep working through the bridge.\n *\n * @example\n * ```html\n * <wr-checkbox-group [formField]=\"form.features\">\n * <wr-checkbox checkboxValue=\"autosave\">Autosave</wr-checkbox>\n * <wr-checkbox checkboxValue=\"notifications\">Notifications</wr-checkbox>\n * <wr-checkbox checkboxValue=\"darkmode\">Dark mode</wr-checkbox>\n * </wr-checkbox-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/checkbox\n */\n@Component({\n selector: 'wr-checkbox-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: {\n class: 'wr-checkbox-group',\n role: 'group',\n // `<label for>` binds only to a labelable element, which a `role=\"group\"`\n // is not, so the field's own label reached this host through nothing and\n // the group announced no name at all. Same call `wr-radio-group` and\n // `wr-rating` already make.\n '[attr.aria-labelledby]': 'labelledBy()',\n '[attr.aria-invalid]': 'fieldAria.ariaInvalid()',\n '[attr.aria-describedby]': 'fieldAria.describedBy()',\n },\n providers: [\n {\n provide: WR_CHECKBOX_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCheckboxGroup),\n },\n ],\n})\nexport class WrCheckboxGroup implements FormValueControl<unknown[]>, WrCheckboxGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('checkbox');\n }\n\n /**\n * Disable every child checkbox. Bound automatically from the field's\n * disabled state when used with `[formField]`.\n *\n * @default false\n */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Refuse edits on every child while they stay focusable and the value still\n * submits. Bound automatically from the field's readonly state when used with\n * `[formField]`.\n *\n * No `aria-readonly` on the host: role `group` does not support it (the state\n * is not global), so each child box mirrors its own instead.\n *\n * @default false\n */\n readonly readonly = input(false, { transform: coerceBooleanProperty });\n\n /** The surrounding `<wr-form-field>`'s error state. @internal */\n protected readonly fieldAria = useFormFieldAria();\n /**\n * The author's own `aria-labelledby`, read as a static host attribute.\n *\n * A host binding WRITES the attribute, so binding the field's label\n * unconditionally would REMOVE a reference the consumer put there by hand:\n * `<wr-segmented aria-labelledby=\"range-question\">` went nameless the moment\n * the field's label was `null`, which a harness spec caught one commit after\n * it was introduced. `HostAttributeToken` reads it at construction without\n * touching the DOM, so this stays SSR-safe, and the author's own reference\n * wins — the same precedence `[ariaLabel]` has everywhere else.\n */\n private readonly ownLabelledBy = inject(new HostAttributeToken('aria-labelledby'), { optional: true });\n\n /** The surrounding field's label, unless the author named the control. */\n protected readonly labelledBy = computed(() => this.ownLabelledBy ?? this.fieldAria.labelledBy());\n\n /** The checked items' values. Bound by `[formField]`, or two-way via `[(value)]`. */\n readonly value = model<unknown[]>([]);\n\n /** Emitted when a child toggles so a bound field can mark itself touched. */\n readonly touch = output<void>();\n\n // The current selection as a guaranteed array — a classic-forms binding can\n // write null even though the type is `unknown[]`, so normalise every read.\n private readonly selected = computed<readonly unknown[]>(() => {\n const v = this.value();\n return Array.isArray(v) ? v : [];\n });\n\n /** Effective disabled state (WrCheckboxGroupContext). */\n readonly isDisabled = computed(() => this.disabled());\n\n /** Effective readonly state (WrCheckboxGroupContext). */\n readonly isReadonly = computed(() => this.readonly());\n\n private readonly host = inject<ElementRef<HTMLElement>>(ElementRef);\n\n /**\n * Focus the group — what Signal Forms calls to focus this control. The first\n * enabled box takes it, which is where Tab lands: the host is a `role=\"group\"`\n * with no tab stop of its own, and a disabled box has none either.\n */\n focus(options?: FocusOptions): void {\n this.host.nativeElement.querySelector<HTMLInputElement>('.wr-checkbox__input:not(:disabled)')?.focus(options);\n }\n\n // WrCheckboxGroupContext\n\n isSelected(value: unknown): boolean {\n return this.selected().includes(value);\n }\n\n toggle(value: unknown): void {\n if (this.isDisabled() || this.isReadonly()) return;\n const current = this.selected();\n const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];\n this.value.set(next);\n this.touch.emit();\n }\n\n /** @internal A child checkbox lost focus — see {@link WrCheckboxGroupContext.blurred}. */\n blurred(): void {\n this.touch.emit();\n }\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,oBAAoB,IAAI,eAAuC,mBAAmB;;;;;;;ACyE/F,IAAa,aAAb,MAAa,WAAU;CACrB,cAAA;EACE,IAAI,OAAO,cAAc,eAAe,WAAW,cAAc,UAAU;CAC7E;CAQS,KAAK,MAAc,WAAW,aAAa,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,KAAA,CAAA,+BAAA,CAAA,CAAA;CAQ7C,gBAAgB,MAAe,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,gBAAA,CAAA,+BAAA,CAAA,CAAA;CAW1B,iBAAiB,eAAc;EAChD,MAAM,QAAQ,KAAK,cAAa;EAIhC,IAAI,OAAO,UAAU,UAAU,OAAO;EACtC,IAAI,OAAO,UAAU,YAAY,OAAO,UAAU,WAAW,OAAO,OAAO,KAAK;EAChF,OAAO;CACT,GAAE,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CASO,YAAY,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAatC,iBAAiB,MAAqB,MAAK,GAAA,YAAA,CAAA,EAAA,WAAA,iBAAA,CAAA,+BAAA,CAAA,CAAA;CAO3C,UAAU,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,UAAA,CAAA,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IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;GAAA,OAAA;IAAA,mBAAA;IAAA,YAAA;IAAA,UAAA;IAAA,YAAA;IAAA,mBAAA;GAAA;EAAA;EAAA,SAAA;GAAA,OAAA;GAAA,OAAA;EAAA;EAAA,MAAA;GAAA,YAAA,EAAA,QAAA,QAAA;GAAA,YAAA;IAAA,wBAAA;IAAA,qBAAA;IAAA,yBAAA;GAAA;GAAA,gBAAA;EAAA;EAAA,WARf,CACT;GACE,SAAS;GAET,aAAa,iBAAiB,eAAe;EAC9C,CACF;EAAA,UAAA;EAAA,UAnBS;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAqBf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAe,YAAA,CAAA;EAvB3B,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM;IACJ,OAAO;IACP,MAAM;IAKN,0BAA0B;IAC1B,uBAAuB;IACvB,2BAA2B;GAC5B;GACD,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,eAAgB;GAC9C,CACF;EACF,CAAA"}
@@ -9,6 +9,7 @@ import { FocusMonitor } from "@angular/cdk/a11y";
9
9
  * Use of this source code is governed by an MIT-style license that can be
10
10
  * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE
11
11
  */
12
+ const WR_COPIED_DURATION = 1500;
12
13
  var WrClipboard = class WrClipboard {
13
14
  focusMonitor = inject(FocusMonitor);
14
15
  doc = inject(DOCUMENT$1);
@@ -95,6 +96,6 @@ i0.ɵɵngDeclareClassMetadata({
95
96
  type: WrClipboard,
96
97
  decorators: [{ type: Service }]
97
98
  });
98
- export { WrClipboard };
99
+ export { WR_COPIED_DURATION, WrClipboard };
99
100
 
100
101
  //# sourceMappingURL=ngwr-clipboard.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-clipboard.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/clipboard/clipboard.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport { wrRestoreFocus } from 'ngwr/utils';\n\nimport type { WrClipboardPermission } from './types';\n\n/**\n * Programmatic clipboard read / write.\n *\n * - **Write** uses `navigator.clipboard.writeText` with a hidden\n * `<textarea>` + `execCommand('copy')` fallback for non-secure contexts.\n * - **Read** uses `navigator.clipboard.readText` (no fallback — older\n * browsers expose no equivalent).\n * - **Available** / **permission** check what the current browser allows\n * so UI can disable the action when it would silently no-op.\n *\n * SSR-safe: every method short-circuits when there's no `document.defaultView`.\n *\n * @example\n * ```ts\n * const clip = inject(WrClipboard);\n *\n * await clip.write('Hello'); // resolves to true on success\n * const text = await clip.read(); // string | null\n * clip.available(); // boolean\n * await clip.permission('write'); // 'granted' | 'denied' | 'prompt' | 'unsupported'\n * ```\n *\n * @see https://ngwr.dev/reference/services/clipboard\n */\n@Service()\nexport class WrClipboard {\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly doc = inject(DOCUMENT);\n\n /** Is any clipboard write path available (async API or `execCommand`)? */\n available(): boolean {\n const view = this.doc.defaultView;\n if (!view) return false;\n if (view.navigator?.clipboard) return true;\n return typeof this.doc.execCommand === 'function';\n }\n\n /**\n * Write text. Resolves to `true` on success, `false` on failure (denied\n * permission, no clipboard, etc).\n */\n async write(text: string): Promise<boolean> {\n const view = this.doc.defaultView;\n if (!view) return false;\n\n try {\n if (view.navigator?.clipboard) {\n await view.navigator.clipboard.writeText(text);\n return true;\n }\n return this.legacyWrite(text);\n } catch {\n return this.legacyWrite(text);\n }\n }\n\n /**\n * Read text from the clipboard. Returns `null` when unsupported or\n * when the user denied the permission prompt.\n */\n async read(): Promise<string | null> {\n const view = this.doc.defaultView;\n if (!view?.navigator?.clipboard?.readText) return null;\n try {\n return await view.navigator.clipboard.readText();\n } catch {\n return null;\n }\n }\n\n /**\n * Report whether clipboard read / write is available and, when the\n * browser exposes it, what the user has granted.\n *\n * The answer is grounded in the actual Clipboard API capability\n * (`writeText` / `readText`), then refined by the Permissions API when\n * it can speak for the requested name. `clipboard-read` / `clipboard-write`\n * are not recognised everywhere — Firefox and Safari throw on the query —\n * so a missing or throwing Permissions API is treated as \"supported,\n * will resolve at use time\" (`'prompt'`), not `'unsupported'`. We only\n * return `'unsupported'` when the capability genuinely isn't there.\n */\n async permission(name: 'read' | 'write'): Promise<WrClipboardPermission> {\n const view = this.doc.defaultView;\n if (!view) return 'unsupported';\n\n const clipboard = view.navigator?.clipboard;\n const capable =\n name === 'write'\n ? typeof clipboard?.writeText === 'function' || typeof this.doc.execCommand === 'function'\n : typeof clipboard?.readText === 'function';\n if (!capable) return 'unsupported';\n\n // Capability exists; ask the Permissions API to refine the state when it can.\n if (typeof view.navigator?.permissions?.query !== 'function') return 'prompt';\n try {\n const status = await view.navigator.permissions.query({\n name: `clipboard-${name}` as PermissionName,\n });\n return status.state;\n } catch {\n // Name not recognised by this browser — capability is still present.\n return 'prompt';\n }\n }\n\n // Internals\n\n /**\n * Hidden-textarea + `execCommand('copy')` write. Synchronous, no permissions.\n *\n * `select()` takes focus, and the textarea is removed a moment later — so\n * without putting focus back, every copy on a non-secure origin (plain\n * `http://`, which is exactly where the async clipboard is missing) leaves\n * focus on `<body>` and the user's next Tab restarts from the top of the page.\n */\n private legacyWrite(text: string): boolean {\n const previouslyFocused = this.doc.activeElement;\n const node = this.doc.createElement('textarea');\n node.value = text;\n node.setAttribute('readonly', '');\n node.style.position = 'fixed';\n node.style.top = '0';\n node.style.left = '0';\n node.style.opacity = '0';\n node.style.pointerEvents = 'none';\n this.doc.body.appendChild(node);\n node.select();\n try {\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n this.doc.body.removeChild(node);\n // Guarded on `isConnected`: the copy handler may well have re-rendered\n // whatever was focused, and focusing a detached node throws focus away\n // just as thoroughly as not restoring it.\n if (previouslyFocused instanceof HTMLElement && previouslyFocused.isConnected) {\n wrRestoreFocus(previouslyFocused, this.focusMonitor);\n }\n }\n }\n}\n\nexport type { WrClipboardPermission } from './types';\n"],"mappings":";;;;;;;;;;;AAwCA,IAAa,cAAb,MAAa,YAAW;CACL,eAAe,OAAO,YAAY;CAClC,MAAM,OAAOA,UAAQ;CAGtC,YAAS;EACP,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAClB,IAAI,KAAK,WAAW,WAAW,OAAO;EACtC,OAAO,OAAO,KAAK,IAAI,gBAAgB;CACzC;CAMA,MAAM,MAAM,MAAY;EACtB,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAElB,IAAI;GACF,IAAI,KAAK,WAAW,WAAW;IAC7B,MAAM,KAAK,UAAU,UAAU,UAAU,IAAI;IAC7C,OAAO;GACT;GACA,OAAO,KAAK,YAAY,IAAI;EAC9B,QAAQ;GACN,OAAO,KAAK,YAAY,IAAI;EAC9B;CACF;CAMA,MAAM,OAAI;EACR,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,WAAW,WAAW,UAAU,OAAO;EAClD,IAAI;GACF,OAAO,MAAM,KAAK,UAAU,UAAU,SAAQ;EAChD,QAAQ;GACN,OAAO;EACT;CACF;CAcA,MAAM,WAAW,MAAsB;EACrC,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAElB,MAAM,YAAY,KAAK,WAAW;EAKlC,IAAI,EAHF,SAAS,UACL,OAAO,WAAW,cAAc,cAAc,OAAO,KAAK,IAAI,gBAAgB,aAC9E,OAAO,WAAW,aAAa,aACvB,OAAO;EAGrB,IAAI,OAAO,KAAK,WAAW,aAAa,UAAU,YAAY,OAAO;EACrE,IAAI;GAIF,QAAO,MAHc,KAAK,UAAU,YAAY,MAAM,EACpD,MAAM,aAAa,OACpB,CAAA,EACM,CAAO;EAChB,QAAQ;GAEN,OAAO;EACT;CACF;CAYQ,YAAY,MAAY;EAC9B,MAAM,oBAAoB,KAAK,IAAI;EACnC,MAAM,OAAO,KAAK,IAAI,cAAc,UAAU;EAC9C,KAAK,QAAQ;EACb,KAAK,aAAa,YAAY,EAAE;EAChC,KAAK,MAAM,WAAW;EACtB,KAAK,MAAM,MAAM;EACjB,KAAK,MAAM,OAAO;EAClB,KAAK,MAAM,UAAU;EACrB,KAAK,MAAM,gBAAgB;EAC3B,KAAK,IAAI,KAAK,YAAY,IAAI;EAC9B,KAAK,OAAM;EACX,IAAI;GACF,OAAO,KAAK,IAAI,YAAY,MAAM;EACpC,QAAQ;GACN,OAAO;EACT,UAAU;GACR,KAAK,IAAI,KAAK,YAAY,IAAI;GAI9B,IAAI,6BAA6B,eAAe,kBAAkB,aAChE,eAAe,mBAAmB,KAAK,YAAY;EAEvD;CACF;CApHW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAW,CAAA;;AAAX,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA,EADvB,MAAA,Q"}
1
+ {"version":3,"file":"ngwr-clipboard.mjs","names":["DOCUMENT"],"sources":["../../../projects/lib/clipboard/clipboard.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { FocusMonitor } from '@angular/cdk/a11y';\nimport { DOCUMENT } from '@angular/common';\nimport { Service, inject } from '@angular/core';\n\nimport { wrRestoreFocus } from 'ngwr/utils';\n\nimport type { WrClipboardPermission } from './types';\n\n/**\n * How long a \"Copied\" confirmation stays, in ms: `<wr-copy-value>` and\n * `[wrCopyToClipboard]` share it.\n *\n * @internal\n */\nexport const WR_COPIED_DURATION = 1500;\n\n/**\n * Programmatic clipboard read / write.\n *\n * - **Write** uses `navigator.clipboard.writeText` with a hidden\n * `<textarea>` + `execCommand('copy')` fallback for non-secure contexts.\n * - **Read** uses `navigator.clipboard.readText` (no fallback — older\n * browsers expose no equivalent).\n * - **Available** / **permission** check what the current browser allows\n * so UI can disable the action when it would silently no-op.\n *\n * SSR-safe: every method short-circuits when there's no `document.defaultView`.\n *\n * @example\n * ```ts\n * const clip = inject(WrClipboard);\n *\n * await clip.write('Hello'); // resolves to true on success\n * const text = await clip.read(); // string | null\n * clip.available(); // boolean\n * await clip.permission('write'); // 'granted' | 'denied' | 'prompt' | 'unsupported'\n * ```\n *\n * @see https://ngwr.dev/reference/services/clipboard\n */\n@Service()\nexport class WrClipboard {\n private readonly focusMonitor = inject(FocusMonitor);\n private readonly doc = inject(DOCUMENT);\n\n /** Is any clipboard write path available (async API or `execCommand`)? */\n available(): boolean {\n const view = this.doc.defaultView;\n if (!view) return false;\n if (view.navigator?.clipboard) return true;\n return typeof this.doc.execCommand === 'function';\n }\n\n /**\n * Write text. Resolves to `true` on success, `false` on failure (denied\n * permission, no clipboard, etc).\n */\n async write(text: string): Promise<boolean> {\n const view = this.doc.defaultView;\n if (!view) return false;\n\n try {\n if (view.navigator?.clipboard) {\n await view.navigator.clipboard.writeText(text);\n return true;\n }\n return this.legacyWrite(text);\n } catch {\n return this.legacyWrite(text);\n }\n }\n\n /**\n * Read text from the clipboard. Returns `null` when unsupported or\n * when the user denied the permission prompt.\n */\n async read(): Promise<string | null> {\n const view = this.doc.defaultView;\n if (!view?.navigator?.clipboard?.readText) return null;\n try {\n return await view.navigator.clipboard.readText();\n } catch {\n return null;\n }\n }\n\n /**\n * Report whether clipboard read / write is available and, when the\n * browser exposes it, what the user has granted.\n *\n * The answer is grounded in the actual Clipboard API capability\n * (`writeText` / `readText`), then refined by the Permissions API when\n * it can speak for the requested name. `clipboard-read` / `clipboard-write`\n * are not recognised everywhere — Firefox and Safari throw on the query —\n * so a missing or throwing Permissions API is treated as \"supported,\n * will resolve at use time\" (`'prompt'`), not `'unsupported'`. We only\n * return `'unsupported'` when the capability genuinely isn't there.\n */\n async permission(name: 'read' | 'write'): Promise<WrClipboardPermission> {\n const view = this.doc.defaultView;\n if (!view) return 'unsupported';\n\n const clipboard = view.navigator?.clipboard;\n const capable =\n name === 'write'\n ? typeof clipboard?.writeText === 'function' || typeof this.doc.execCommand === 'function'\n : typeof clipboard?.readText === 'function';\n if (!capable) return 'unsupported';\n\n // Capability exists; ask the Permissions API to refine the state when it can.\n if (typeof view.navigator?.permissions?.query !== 'function') return 'prompt';\n try {\n const status = await view.navigator.permissions.query({\n name: `clipboard-${name}` as PermissionName,\n });\n return status.state;\n } catch {\n // Name not recognised by this browser — capability is still present.\n return 'prompt';\n }\n }\n\n // Internals\n\n /**\n * Hidden-textarea + `execCommand('copy')` write. Synchronous, no permissions.\n *\n * `select()` takes focus, and the textarea is removed a moment later — so\n * without putting focus back, every copy on a non-secure origin (plain\n * `http://`, which is exactly where the async clipboard is missing) leaves\n * focus on `<body>` and the user's next Tab restarts from the top of the page.\n */\n private legacyWrite(text: string): boolean {\n const previouslyFocused = this.doc.activeElement;\n const node = this.doc.createElement('textarea');\n node.value = text;\n node.setAttribute('readonly', '');\n node.style.position = 'fixed';\n node.style.top = '0';\n node.style.left = '0';\n node.style.opacity = '0';\n node.style.pointerEvents = 'none';\n this.doc.body.appendChild(node);\n node.select();\n try {\n return this.doc.execCommand('copy');\n } catch {\n return false;\n } finally {\n this.doc.body.removeChild(node);\n // Guarded on `isConnected`: the copy handler may well have re-rendered\n // whatever was focused, and focusing a detached node throws focus away\n // just as thoroughly as not restoring it.\n if (previouslyFocused instanceof HTMLElement && previouslyFocused.isConnected) {\n wrRestoreFocus(previouslyFocused, this.focusMonitor);\n }\n }\n }\n}\n\nexport type { WrClipboardPermission } from './types';\n"],"mappings":";;;;;;;;;;;AAqBA,MAAa,qBAAqB;AA2BlC,IAAa,cAAb,MAAa,YAAW;CACL,eAAe,OAAO,YAAY;CAClC,MAAM,OAAOA,UAAQ;CAGtC,YAAS;EACP,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAClB,IAAI,KAAK,WAAW,WAAW,OAAO;EACtC,OAAO,OAAO,KAAK,IAAI,gBAAgB;CACzC;CAMA,MAAM,MAAM,MAAY;EACtB,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAElB,IAAI;GACF,IAAI,KAAK,WAAW,WAAW;IAC7B,MAAM,KAAK,UAAU,UAAU,UAAU,IAAI;IAC7C,OAAO;GACT;GACA,OAAO,KAAK,YAAY,IAAI;EAC9B,QAAQ;GACN,OAAO,KAAK,YAAY,IAAI;EAC9B;CACF;CAMA,MAAM,OAAI;EACR,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,WAAW,WAAW,UAAU,OAAO;EAClD,IAAI;GACF,OAAO,MAAM,KAAK,UAAU,UAAU,SAAQ;EAChD,QAAQ;GACN,OAAO;EACT;CACF;CAcA,MAAM,WAAW,MAAsB;EACrC,MAAM,OAAO,KAAK,IAAI;EACtB,IAAI,CAAC,MAAM,OAAO;EAElB,MAAM,YAAY,KAAK,WAAW;EAKlC,IAAI,EAHF,SAAS,UACL,OAAO,WAAW,cAAc,cAAc,OAAO,KAAK,IAAI,gBAAgB,aAC9E,OAAO,WAAW,aAAa,aACvB,OAAO;EAGrB,IAAI,OAAO,KAAK,WAAW,aAAa,UAAU,YAAY,OAAO;EACrE,IAAI;GAIF,QAAO,MAHc,KAAK,UAAU,YAAY,MAAM,EACpD,MAAM,aAAa,OACpB,CAAA,EACM,CAAO;EAChB,QAAQ;GAEN,OAAO;EACT;CACF;CAYQ,YAAY,MAAY;EAC9B,MAAM,oBAAoB,KAAK,IAAI;EACnC,MAAM,OAAO,KAAK,IAAI,cAAc,UAAU;EAC9C,KAAK,QAAQ;EACb,KAAK,aAAa,YAAY,EAAE;EAChC,KAAK,MAAM,WAAW;EACtB,KAAK,MAAM,MAAM;EACjB,KAAK,MAAM,OAAO;EAClB,KAAK,MAAM,UAAU;EACrB,KAAK,MAAM,gBAAgB;EAC3B,KAAK,IAAI,KAAK,YAAY,IAAI;EAC9B,KAAK,OAAM;EACX,IAAI;GACF,OAAO,KAAK,IAAI,YAAY,MAAM;EACpC,QAAQ;GACN,OAAO;EACT,UAAU;GACR,KAAK,IAAI,KAAK,YAAY,IAAI;GAI9B,IAAI,6BAA6B,eAAe,kBAAkB,aAChE,eAAe,mBAAmB,KAAK,YAAY;EAEvD;CACF;CApHW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,QAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;CAAW,CAAA;;AAAX,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA,EADvB,MAAA,Q"}
@@ -32,7 +32,7 @@ var WrCollapse = class WrCollapse {
32
32
  group = inject(WR_COLLAPSE_GROUP, { optional: true });
33
33
  destroyRef = inject(DestroyRef);
34
34
  classes = computed(() => {
35
- const parts = ["wr-collapse"];
35
+ const parts = [];
36
36
  if (this.open()) parts.push("wr-collapse--open");
37
37
  if (!this.bordered()) parts.push("wr-collapse--flat");
38
38
  if (this.disabled()) parts.push("wr-collapse--disabled");
@@ -114,10 +114,13 @@ var WrCollapse = class WrCollapse {
114
114
  }
115
115
  },
116
116
  outputs: { open: "openChange" },
117
- host: { properties: {
118
- "class": "classes()",
119
- "attr.title": "null"
120
- } },
117
+ host: {
118
+ properties: {
119
+ "class": "classes()",
120
+ "attr.title": "null"
121
+ },
122
+ classAttribute: "wr-collapse"
123
+ },
121
124
  ngImport: i0,
122
125
  template: "<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n @if (indicator() === 'plus') {\n <svg\n class=\"wr-icon__svg wr-collapse__plus\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M5 12h14\" />\n <path class=\"wr-collapse__plus-bar\" d=\"M12 5v14\" />\n </svg>\n } @else {\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n }\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n",
123
126
  encapsulation: i0.ViewEncapsulation.None
@@ -134,6 +137,7 @@ i0.ɵɵngDeclareClassMetadata({
134
137
  selector: "wr-collapse",
135
138
  encapsulation: ViewEncapsulation.None,
136
139
  host: {
140
+ class: "wr-collapse",
137
141
  "[class]": "classes()",
138
142
  "[attr.title]": "null"
139
143
  },
@@ -1 +1 @@
1
- {"version":3,"file":"ngwr-collapse.mjs","names":[],"sources":["../../../projects/lib/collapse/tokens/collapse-group.token.ts","../../../projects/lib/collapse/collapse.ts","../../../projects/lib/collapse/collapse.html","../../../projects/lib/collapse/collapse-group.ts","../../../projects/lib/collapse/accordion.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCollapseGroupContext } from '../types';\n\n/**\n * Token a `<wr-collapse>` injects to register itself with — and notify of\n * open events — its parent `<wr-collapse-group>`. Drives the accordion\n * behaviour when the group has `accordion` enabled.\n *\n * @internal\n */\nexport const WR_COLLAPSE_GROUP = new InjectionToken<WrCollapseGroupContext>('WR_COLLAPSE_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseIndicator } from './types';\n\n/**\n * Expandable panel with a clickable header. Two-way binds the `open`\n * state. When wrapped in `<wr-collapse-group accordion>`, only one\n * sibling can be open at a time.\n *\n * @example\n * ```html\n * <wr-collapse title=\"Section title\">\n * Section body…\n * </wr-collapse>\n *\n * <wr-collapse-group accordion>\n * <wr-collapse title=\"A\">…</wr-collapse>\n * <wr-collapse title=\"B\">…</wr-collapse>\n * </wr-collapse-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-collapse',\n templateUrl: './collapse.html',\n encapsulation: ViewEncapsulation.None,\n // See `WrAlert`: a static `title=` feeds the input AND lands on the host,\n // where the browser draws it as a tooltip over the whole component.\n host: { '[class]': 'classes()', '[attr.title]': 'null' },\n})\nexport class WrCollapse {\n /** Header text. */\n readonly title = input.required<string>();\n\n /** Two-way bindable open/closed state. @default false */\n readonly open = model<boolean>(false);\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draws the frame, the panel background and the rounded corners. Turn it off for a\n * flat list: no frame, rows split by a divider line between neighbours.\n * @default true\n */\n readonly bordered = input(true, { transform: coerceBooleanProperty });\n\n /**\n * The header glyph: `chevron` turns over, `plus` becomes a minus while open.\n * @default 'chevron'\n */\n readonly indicator = input<WrCollapseIndicator>('chevron');\n\n /** Identity used by the parent group when tracking children. @internal */\n readonly id = { name: wrRandomId('wr-collapse') };\n\n /** DOM id for the body element, referenced by header's `aria-controls`. */\n protected readonly bodyId = `wr-collapse-body-${this.id.name}`;\n\n private readonly group = inject(WR_COLLAPSE_GROUP, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts = ['wr-collapse'];\n if (this.open()) parts.push('wr-collapse--open');\n if (!this.bordered()) parts.push('wr-collapse--flat');\n if (this.disabled()) parts.push('wr-collapse--disabled');\n return parts.join(' ');\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n if (this.group) {\n this.group.register({ id: this.id, close: () => this.open.set(false) });\n this.destroyRef.onDestroy(() => this.group?.unregister(this.id));\n\n // Tell the group whenever we open — group decides whether to close siblings.\n effect(() => {\n if (this.open()) this.group?.notifyOpened(this.id);\n });\n }\n }\n\n /** Open the panel. */\n openPanel(): void {\n if (this.disabled()) return;\n this.open.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.open.set(false);\n }\n\n /** Toggle the panel. */\n toggle(): void {\n if (this.disabled()) return;\n this.open.update(v => !v);\n }\n}\n","<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n @if (indicator() === 'plus') {\n <svg\n class=\"wr-icon__svg wr-collapse__plus\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M5 12h14\" />\n <path class=\"wr-collapse__plus-bar\" d=\"M12 5v14\" />\n </svg>\n } @else {\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n }\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseGroupContext, WrCollapseGroupMember } from './types';\n\n/**\n * Visual + behavioral grouping of `<wr-collapse>` children. When\n * `accordion` is true, opening one child closes the others.\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-collapse-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-collapse-group' },\n providers: [\n {\n provide: WR_COLLAPSE_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCollapseGroup),\n },\n ],\n})\nexport class WrCollapseGroup implements WrCollapseGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n }\n\n /** When true, only one child may be open at a time. @default false */\n readonly accordion = input(false, { transform: coerceBooleanProperty });\n\n private readonly members = new Map<object, WrCollapseGroupMember>();\n\n register(member: WrCollapseGroupMember): void {\n this.members.set(member.id, member);\n }\n\n unregister(memberId: object): void {\n this.members.delete(memberId);\n }\n\n notifyOpened(opener: object): void {\n if (!this.accordion()) return;\n for (const [id, member] of this.members) {\n if (id !== opener) member.close();\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, forwardRef, signal } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseGroupContext, WrCollapseGroupMember } from './types';\n\n/**\n * Accordion — a `<wr-collapse>` container that enforces single-open\n * behavior: opening a child closes its siblings.\n *\n * Use `<wr-collapse-group>` when you only need visual grouping without\n * the mutually-exclusive open semantics.\n *\n * @example\n * ```html\n * <wr-accordion>\n * <wr-collapse title=\"Profile\">…</wr-collapse>\n * <wr-collapse title=\"Security\">…</wr-collapse>\n * <wr-collapse title=\"Notifications\">…</wr-collapse>\n * </wr-accordion>\n * ```\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-accordion',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-collapse-group wr-collapse-group--accordion' },\n providers: [\n {\n provide: WR_COLLAPSE_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrAccordion),\n },\n ],\n})\nexport class WrAccordion implements WrCollapseGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n }\n\n /** Always behaves as an accordion. Provided for context-interface symmetry. */\n readonly accordion = signal(true).asReadonly();\n\n private readonly members = new Map<object, WrCollapseGroupMember>();\n\n register(member: WrCollapseGroupMember): void {\n this.members.set(member.id, member);\n }\n\n unregister(memberId: object): void {\n this.members.delete(memberId);\n }\n\n notifyOpened(opener: object): void {\n for (const [id, member] of this.members) {\n if (id !== opener) member.close();\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,oBAAoB,IAAI,eAAuC,mBAAmB;;;;;;;ACwB/F,IAAa,aAAb,MAAa,WAAU;CAEZ,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGhC,OAAO,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAG5B,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAO1D,WAAW,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAMzD,YAAY,MAA2B,WAAU,GAAA,YAAA,CAAA,EAAA,WAAA,YAAA,CAAA,+BAAA,CAAA,CAAA;CAGjD,KAAK,EAAE,MAAM,WAAW,aAAa,EAAC;CAG5B,SAAS,oBAAoB,KAAK,GAAG;CAEvC,QAAQ,OAAO,mBAAmB,EAAE,UAAU,KAAI,CAAE;CACpD,aAAa,OAAO,UAAU;CAE5B,UAAU,eAAc;EACzC,MAAM,QAAQ,CAAC,aAAa;EAC5B,IAAI,KAAK,KAAI,GAAI,MAAM,KAAK,mBAAmB;EAC/C,IAAI,CAAC,KAAK,SAAQ,GAAI,MAAM,KAAK,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AAA;EAAA,MAAA,EAAA,gBAAA,iDAAA;EAAA,WARX,CACT;GACE,SAAS;GAET,aAAa,iBAAiB,WAAW;EAC1C,CACF;EAAA,UAAA;EAAA,UATS;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAWf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA;EAbvB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM,EAAE,OAAO,iDAAgD;GAC/D,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,WAAY;GAC1C,CACF;EACF,CAAA"}
1
+ {"version":3,"file":"ngwr-collapse.mjs","names":[],"sources":["../../../projects/lib/collapse/tokens/collapse-group.token.ts","../../../projects/lib/collapse/collapse.ts","../../../projects/lib/collapse/collapse.html","../../../projects/lib/collapse/collapse-group.ts","../../../projects/lib/collapse/accordion.ts"],"sourcesContent":["/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { InjectionToken } from '@angular/core';\n\nimport type { WrCollapseGroupContext } from '../types';\n\n/**\n * Token a `<wr-collapse>` injects to register itself with — and notify of\n * open events — its parent `<wr-collapse-group>`. Drives the accordion\n * behaviour when the group has `accordion` enabled.\n *\n * @internal\n */\nexport const WR_COLLAPSE_GROUP = new InjectionToken<WrCollapseGroupContext>('WR_COLLAPSE_GROUP');\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, DestroyRef, ViewEncapsulation, computed, effect, inject, input, model } from '@angular/core';\n\nimport { wrRandomId, wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseIndicator } from './types';\n\n/**\n * Expandable panel with a clickable header. Two-way binds the `open`\n * state. When wrapped in `<wr-collapse-group accordion>`, only one\n * sibling can be open at a time.\n *\n * @example\n * ```html\n * <wr-collapse title=\"Section title\">\n * Section body…\n * </wr-collapse>\n *\n * <wr-collapse-group accordion>\n * <wr-collapse title=\"A\">…</wr-collapse>\n * <wr-collapse title=\"B\">…</wr-collapse>\n * </wr-collapse-group>\n * ```\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-collapse',\n templateUrl: './collapse.html',\n encapsulation: ViewEncapsulation.None,\n // See `WrAlert`: a static `title=` feeds the input AND lands on the host,\n // where the browser draws it as a tooltip over the whole component.\n host: { class: 'wr-collapse', '[class]': 'classes()', '[attr.title]': 'null' },\n})\nexport class WrCollapse {\n /** Header text. */\n readonly title = input.required<string>();\n\n /** Two-way bindable open/closed state. @default false */\n readonly open = model<boolean>(false);\n\n /** Disable interaction. @default false */\n readonly disabled = input(false, { transform: coerceBooleanProperty });\n\n /**\n * Draws the frame, the panel background and the rounded corners. Turn it off for a\n * flat list: no frame, rows split by a divider line between neighbours.\n * @default true\n */\n readonly bordered = input(true, { transform: coerceBooleanProperty });\n\n /**\n * The header glyph: `chevron` turns over, `plus` becomes a minus while open.\n * @default 'chevron'\n */\n readonly indicator = input<WrCollapseIndicator>('chevron');\n\n /** Identity used by the parent group when tracking children. @internal */\n readonly id = { name: wrRandomId('wr-collapse') };\n\n /** DOM id for the body element, referenced by header's `aria-controls`. */\n protected readonly bodyId = `wr-collapse-body-${this.id.name}`;\n\n private readonly group = inject(WR_COLLAPSE_GROUP, { optional: true });\n private readonly destroyRef = inject(DestroyRef);\n\n protected readonly classes = computed(() => {\n const parts: string[] = [];\n if (this.open()) parts.push('wr-collapse--open');\n if (!this.bordered()) parts.push('wr-collapse--flat');\n if (this.disabled()) parts.push('wr-collapse--disabled');\n return parts.join(' ');\n });\n\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n if (this.group) {\n this.group.register({ id: this.id, close: () => this.open.set(false) });\n this.destroyRef.onDestroy(() => this.group?.unregister(this.id));\n\n // Tell the group whenever we open — group decides whether to close siblings.\n effect(() => {\n if (this.open()) this.group?.notifyOpened(this.id);\n });\n }\n }\n\n /** Open the panel. */\n openPanel(): void {\n if (this.disabled()) return;\n this.open.set(true);\n }\n\n /** Close the panel. */\n close(): void {\n this.open.set(false);\n }\n\n /** Toggle the panel. */\n toggle(): void {\n if (this.disabled()) return;\n this.open.update(v => !v);\n }\n}\n","<button\n type=\"button\"\n class=\"wr-collapse__header\"\n [attr.aria-expanded]=\"open()\"\n [attr.aria-controls]=\"bodyId\"\n [disabled]=\"disabled()\"\n (click)=\"toggle()\"\n>\n <span class=\"wr-collapse__title\">{{ title() }}</span>\n @if (indicator() === 'plus') {\n <svg\n class=\"wr-icon__svg wr-collapse__plus\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"M5 12h14\" />\n <path class=\"wr-collapse__plus-bar\" d=\"M12 5v14\" />\n </svg>\n } @else {\n <svg\n class=\"wr-icon__svg wr-collapse__chevron\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n aria-hidden=\"true\"\n >\n <path d=\"m6 9 6 6 6-6\" />\n </svg>\n }\n</button>\n\n<div\n class=\"wr-collapse__body\"\n [attr.id]=\"bodyId\"\n [class.wr-collapse__body--open]=\"open()\"\n [attr.aria-hidden]=\"!open()\"\n [attr.inert]=\"!open() ? '' : null\"\n>\n <div class=\"wr-collapse__content\">\n <div class=\"wr-collapse__inner\">\n <ng-content />\n </div>\n </div>\n</div>\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { coerceBooleanProperty } from '@angular/cdk/coercion';\nimport { Component, ViewEncapsulation, forwardRef, input } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseGroupContext, WrCollapseGroupMember } from './types';\n\n/**\n * Visual + behavioral grouping of `<wr-collapse>` children. When\n * `accordion` is true, opening one child closes the others.\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-collapse-group',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-collapse-group' },\n providers: [\n {\n provide: WR_COLLAPSE_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrCollapseGroup),\n },\n ],\n})\nexport class WrCollapseGroup implements WrCollapseGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n }\n\n /** When true, only one child may be open at a time. @default false */\n readonly accordion = input(false, { transform: coerceBooleanProperty });\n\n private readonly members = new Map<object, WrCollapseGroupMember>();\n\n register(member: WrCollapseGroupMember): void {\n this.members.set(member.id, member);\n }\n\n unregister(memberId: object): void {\n this.members.delete(memberId);\n }\n\n notifyOpened(opener: object): void {\n if (!this.accordion()) return;\n for (const [id, member] of this.members) {\n if (id !== opener) member.close();\n }\n }\n}\n","/**\n * @license\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://github.com/thekhegay/ngwr/blob/main/LICENSE\n */\n\nimport { Component, ViewEncapsulation, forwardRef, signal } from '@angular/core';\n\nimport { wrCheckStyles } from 'ngwr/utils';\n\nimport { WR_COLLAPSE_GROUP } from './tokens';\nimport type { WrCollapseGroupContext, WrCollapseGroupMember } from './types';\n\n/**\n * Accordion — a `<wr-collapse>` container that enforces single-open\n * behavior: opening a child closes its siblings.\n *\n * Use `<wr-collapse-group>` when you only need visual grouping without\n * the mutually-exclusive open semantics.\n *\n * @example\n * ```html\n * <wr-accordion>\n * <wr-collapse title=\"Profile\">…</wr-collapse>\n * <wr-collapse title=\"Security\">…</wr-collapse>\n * <wr-collapse title=\"Notifications\">…</wr-collapse>\n * </wr-accordion>\n * ```\n *\n * @see https://ngwr.dev/reference/components/collapse\n */\n@Component({\n selector: 'wr-accordion',\n template: '<ng-content />',\n encapsulation: ViewEncapsulation.None,\n host: { class: 'wr-collapse-group wr-collapse-group--accordion' },\n providers: [\n {\n provide: WR_COLLAPSE_GROUP,\n // eslint-disable-next-line @angular-eslint/no-forward-ref\n useExisting: forwardRef(() => WrAccordion),\n },\n ],\n})\nexport class WrAccordion implements WrCollapseGroupContext {\n constructor() {\n if (typeof ngDevMode === 'undefined' || ngDevMode) wrCheckStyles('collapse');\n }\n\n /** Always behaves as an accordion. Provided for context-interface symmetry. */\n readonly accordion = signal(true).asReadonly();\n\n private readonly members = new Map<object, WrCollapseGroupMember>();\n\n register(member: WrCollapseGroupMember): void {\n this.members.set(member.id, member);\n }\n\n unregister(memberId: object): void {\n this.members.delete(memberId);\n }\n\n notifyOpened(opener: object): void {\n for (const [id, member] of this.members) {\n if (id !== opener) member.close();\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAa,oBAAoB,IAAI,eAAuC,mBAAmB;;;;;;;ACwB/F,IAAa,aAAb,MAAa,WAAU;CAEZ,QAAQ,MAAM,SAAkB,GAAA,YAAA,CAAA,EAAA,WAAA,QAAA,CAAA,+BAAA,CAAA,CAAA;CAGhC,OAAO,MAAe,OAAM,GAAA,YAAA,CAAA,EAAA,WAAA,OAAA,CAAA,+BAAA,CAAA,CAAA;CAG5B,WAAW,MAAM,OAAK;EAAA,GAAA,YAAA,EAAA,WAAA,WAAA,+BAAA,CAAA;EAAI,WAAW;CAAqB,CAAA;CAO1D,WAAW,MAAM,MAAI;EAAA,GAAA,YAAA,EAAA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,IAAG;CAElC,SAAS,QAA6B;EACpC,KAAK,QAAQ,IAAI,OAAO,IAAI,MAAM;CACpC;CAEA,WAAW,UAAgB;EACzB,KAAK,QAAQ,OAAO,QAAQ;CAC9B;CAEA,aAAa,QAAc;EACzB,KAAK,MAAM,CAAC,IAAI,WAAW,KAAK,SAC9B,IAAI,OAAO,QAAQ,OAAO,MAAK;CAEnC;CAtBW,OAAA,OAAA,GAAA,mBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,UAAA;EAAA,MAAA;EAAW,MAAA,CAAA;EAAA,QAAA,GAAA,gBAAA;CAAA,CAAA;CAAX,OAAA,OAAA,GAAA,qBAAA;EAAA,YAAA;EAAA,SAAA;EAAA,MAAA;EAAW,cAAA;EAAA,UAAA;EAAA,MAAA,EAAA,gBAAA,iDAAA;EAAA,WARX,CACT;GACE,SAAS;GAET,aAAa,iBAAiB,WAAW;EAC1C,CACF;EAAA,UAAA;EAAA,UATS;EAAgB,UAAA;EAAA,eAAA,GAAA,kBAAA;CAAA,CAAA;;AAWf,GAAA,yBAAA;CAAA,YAAA;CAAA,SAAA;CAAA,UAAA;CAAA,MAAA;CAAW,YAAA,CAAA;EAbvB,MAAA;EAAU,MAAA,CAAA;GACT,UAAU;GACV,UAAU;GACV,eAAe,kBAAkB;GACjC,MAAM,EAAE,OAAO,iDAAgD;GAC/D,WAAW,CACT;IACE,SAAS;IAET,aAAa,iBAAgB,WAAY;GAC1C,CACF;EACF,CAAA"}
@@ -340,7 +340,7 @@ var WrColorPicker = class WrColorPicker {
340
340
  }
341
341
  ], ...ngDevMode ? [{ debugName: "tabOptions" }] : /* istanbul ignore next */ []);
342
342
  classes = computed(() => {
343
- const parts = ["wr-color-picker"];
343
+ const parts = [];
344
344
  if (this.alpha()) parts.push("wr-color-picker--alpha");
345
345
  if (this.disabled()) parts.push("wr-color-picker--disabled");
346
346
  else if (this.readonly()) parts.push("wr-color-picker--readonly");
@@ -626,7 +626,8 @@ var WrColorPicker = class WrColorPicker {
626
626
  "attr.aria-labelledby": "labelledBy()",
627
627
  "style.--wr-color-picker-hue": "hueCss()",
628
628
  "style.--wr-color-picker-color": "opaqueCss()"
629
- }
629
+ },
630
+ classAttribute: "wr-color-picker"
630
631
  },
631
632
  providers: [{
632
633
  provide: WR_FORM_FIELD,
@@ -672,6 +673,7 @@ i0.ɵɵngDeclareClassMetadata({
672
673
  selector: "wr-color-picker",
673
674
  encapsulation: ViewEncapsulation.None,
674
675
  host: {
676
+ class: "wr-color-picker",
675
677
  "[class]": "classes()",
676
678
  role: "group",
677
679
  "[attr.aria-labelledby]": "labelledBy()",