@4sh/ui-kit 0.16.0 → 0.17.1

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 (219) hide show
  1. package/README.fr.md +10 -10
  2. package/README.md +10 -10
  3. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs +542 -150
  4. package/fesm2022/4sh-ui-kit-actions-ui-button-split.mjs.map +1 -1
  5. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs +622 -248
  6. package/fesm2022/4sh-ui-kit-actions-ui-button.mjs.map +1 -1
  7. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs +385 -152
  8. package/fesm2022/4sh-ui-kit-actions-ui-link.mjs.map +1 -1
  9. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs +748 -433
  10. package/fesm2022/4sh-ui-kit-actions-ui-speed-dial.mjs.map +1 -1
  11. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs +227 -135
  12. package/fesm2022/4sh-ui-kit-base-ui-icon.mjs.map +1 -1
  13. package/fesm2022/4sh-ui-kit-base-ui-image.mjs +1200 -633
  14. package/fesm2022/4sh-ui-kit-base-ui-image.mjs.map +1 -1
  15. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs +1675 -1000
  16. package/fesm2022/4sh-ui-kit-forms-ui-autocomplete.mjs.map +1 -1
  17. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs +243 -117
  18. package/fesm2022/4sh-ui-kit-forms-ui-checkbox.mjs.map +1 -1
  19. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs +2294 -2048
  20. package/fesm2022/4sh-ui-kit-forms-ui-datepicker.mjs.map +1 -1
  21. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs +1058 -1113
  22. package/fesm2022/4sh-ui-kit-forms-ui-editor.mjs.map +1 -1
  23. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs +1108 -0
  24. package/fesm2022/4sh-ui-kit-forms-ui-field-sign.mjs.map +1 -0
  25. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs +397 -141
  26. package/fesm2022/4sh-ui-kit-forms-ui-field.mjs.map +1 -1
  27. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs +1529 -583
  28. package/fesm2022/4sh-ui-kit-forms-ui-file-upload.mjs.map +1 -1
  29. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs +383 -224
  30. package/fesm2022/4sh-ui-kit-forms-ui-input-date.mjs.map +1 -1
  31. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs +345 -177
  32. package/fesm2022/4sh-ui-kit-forms-ui-input-group.mjs.map +1 -1
  33. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs +280 -138
  34. package/fesm2022/4sh-ui-kit-forms-ui-input-mask.mjs.map +1 -1
  35. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs +507 -257
  36. package/fesm2022/4sh-ui-kit-forms-ui-input-number.mjs.map +1 -1
  37. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs +401 -312
  38. package/fesm2022/4sh-ui-kit-forms-ui-input-otp.mjs.map +1 -1
  39. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs +1277 -697
  40. package/fesm2022/4sh-ui-kit-forms-ui-input-tags.mjs.map +1 -1
  41. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs +467 -199
  42. package/fesm2022/4sh-ui-kit-forms-ui-input.mjs.map +1 -1
  43. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs +394 -270
  44. package/fesm2022/4sh-ui-kit-forms-ui-knob.mjs.map +1 -1
  45. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs +140 -60
  46. package/fesm2022/4sh-ui-kit-forms-ui-label.mjs.map +1 -1
  47. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs +386 -167
  48. package/fesm2022/4sh-ui-kit-forms-ui-nudger.mjs.map +1 -1
  49. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs +150 -87
  50. package/fesm2022/4sh-ui-kit-forms-ui-radio.mjs.map +1 -1
  51. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs +345 -180
  52. package/fesm2022/4sh-ui-kit-forms-ui-rating.mjs.map +1 -1
  53. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs +582 -392
  54. package/fesm2022/4sh-ui-kit-forms-ui-segment-control.mjs.map +1 -1
  55. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs +1552 -888
  56. package/fesm2022/4sh-ui-kit-forms-ui-select.mjs.map +1 -1
  57. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs +485 -338
  58. package/fesm2022/4sh-ui-kit-forms-ui-slider.mjs.map +1 -1
  59. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs +503 -311
  60. package/fesm2022/4sh-ui-kit-forms-ui-swatch-picker.mjs.map +1 -1
  61. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs +271 -137
  62. package/fesm2022/4sh-ui-kit-forms-ui-textarea.mjs.map +1 -1
  63. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs +457 -214
  64. package/fesm2022/4sh-ui-kit-forms-ui-toggle-block.mjs.map +1 -1
  65. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs +711 -371
  66. package/fesm2022/4sh-ui-kit-forms-ui-toggle-button.mjs.map +1 -1
  67. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs +235 -121
  68. package/fesm2022/4sh-ui-kit-forms-ui-toggle.mjs.map +1 -1
  69. package/fesm2022/4sh-ui-kit-forms.mjs +721 -638
  70. package/fesm2022/4sh-ui-kit-forms.mjs.map +1 -1
  71. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs +546 -242
  72. package/fesm2022/4sh-ui-kit-informative-ui-accordion.mjs.map +1 -1
  73. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs +335 -157
  74. package/fesm2022/4sh-ui-kit-informative-ui-alert.mjs.map +1 -1
  75. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs +53 -33
  76. package/fesm2022/4sh-ui-kit-informative-ui-avatar-group.mjs.map +1 -1
  77. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs +218 -121
  78. package/fesm2022/4sh-ui-kit-informative-ui-avatar.mjs.map +1 -1
  79. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs +192 -100
  80. package/fesm2022/4sh-ui-kit-informative-ui-badge.mjs.map +1 -1
  81. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs +456 -204
  82. package/fesm2022/4sh-ui-kit-informative-ui-chip.mjs.map +1 -1
  83. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs +314 -147
  84. package/fesm2022/4sh-ui-kit-informative-ui-empty-state.mjs.map +1 -1
  85. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs +179 -82
  86. package/fesm2022/4sh-ui-kit-informative-ui-helper.mjs.map +1 -1
  87. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs +268 -123
  88. package/fesm2022/4sh-ui-kit-informative-ui-progress-bar.mjs.map +1 -1
  89. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs +391 -146
  90. package/fesm2022/4sh-ui-kit-informative-ui-read-only.mjs.map +1 -1
  91. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs +158 -76
  92. package/fesm2022/4sh-ui-kit-informative-ui-separator.mjs.map +1 -1
  93. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs +159 -80
  94. package/fesm2022/4sh-ui-kit-informative-ui-skeleton.mjs.map +1 -1
  95. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs +295 -131
  96. package/fesm2022/4sh-ui-kit-informative-ui-spinner.mjs.map +1 -1
  97. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs +211 -83
  98. package/fesm2022/4sh-ui-kit-informative-ui-tag.mjs.map +1 -1
  99. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs +784 -414
  100. package/fesm2022/4sh-ui-kit-informative-ui-toast.mjs.map +1 -1
  101. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs +822 -476
  102. package/fesm2022/4sh-ui-kit-informative-ui-tooltip.mjs.map +1 -1
  103. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs +1014 -599
  104. package/fesm2022/4sh-ui-kit-layout-ui-bottom-sheet.mjs.map +1 -1
  105. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs +403 -189
  106. package/fesm2022/4sh-ui-kit-layout-ui-card.mjs.map +1 -1
  107. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs +707 -272
  108. package/fesm2022/4sh-ui-kit-layout-ui-drawer.mjs.map +1 -1
  109. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs +1146 -568
  110. package/fesm2022/4sh-ui-kit-layout-ui-modal.mjs.map +1 -1
  111. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs +519 -308
  112. package/fesm2022/4sh-ui-kit-layout-ui-popover.mjs.map +1 -1
  113. package/fesm2022/4sh-ui-kit-motion.mjs +252 -150
  114. package/fesm2022/4sh-ui-kit-motion.mjs.map +1 -1
  115. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs +793 -341
  116. package/fesm2022/4sh-ui-kit-navigation-ui-bottom-tab-bar.mjs.map +1 -1
  117. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs +351 -194
  118. package/fesm2022/4sh-ui-kit-navigation-ui-breadcrumb.mjs.map +1 -1
  119. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs +511 -220
  120. package/fesm2022/4sh-ui-kit-navigation-ui-context-menu.mjs.map +1 -1
  121. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs +910 -548
  122. package/fesm2022/4sh-ui-kit-navigation-ui-menu.mjs.map +1 -1
  123. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs +1128 -555
  124. package/fesm2022/4sh-ui-kit-navigation-ui-sidebar.mjs.map +1 -1
  125. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs +915 -470
  126. package/fesm2022/4sh-ui-kit-navigation-ui-stepper.mjs.map +1 -1
  127. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs +931 -474
  128. package/fesm2022/4sh-ui-kit-navigation-ui-tabs.mjs.map +1 -1
  129. package/fesm2022/4sh-ui-kit-overlay.mjs +26 -109
  130. package/fesm2022/4sh-ui-kit-overlay.mjs.map +1 -1
  131. package/fesm2022/4sh-ui-kit-ripple.mjs +329 -290
  132. package/fesm2022/4sh-ui-kit-ripple.mjs.map +1 -1
  133. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs +709 -248
  134. package/fesm2022/4sh-ui-kit-table-ui-paginator.mjs.map +1 -1
  135. package/fesm2022/4sh-ui-kit-table-ui-table.mjs +2633 -1370
  136. package/fesm2022/4sh-ui-kit-table-ui-table.mjs.map +1 -1
  137. package/fesm2022/4sh-ui-kit-theming.mjs +112 -113
  138. package/fesm2022/4sh-ui-kit-theming.mjs.map +1 -1
  139. package/fesm2022/4sh-ui-kit-types.mjs +0 -12
  140. package/fesm2022/4sh-ui-kit.mjs +3 -15
  141. package/fesm2022/4sh-ui-kit.mjs.map +1 -1
  142. package/mcp/data/component-api.json +299 -2
  143. package/mcp/data/text-search-docs.json +149 -9
  144. package/mcp/data/ui-config.json +378 -1
  145. package/mcp/index.js +8190 -2876
  146. package/mcp/package.json +1 -1
  147. package/package.json +5 -1
  148. package/styles/component-vars.scss +22 -1
  149. package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
  150. package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
  151. package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
  152. package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
  153. package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
  154. package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
  155. package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +573 -376
  156. package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
  157. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
  158. package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
  159. package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
  160. package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
  161. package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
  162. package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
  163. package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
  164. package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -59
  165. package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -96
  166. package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -104
  167. package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
  168. package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -118
  169. package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
  170. package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
  171. package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
  172. package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
  173. package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
  174. package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
  175. package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
  176. package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
  177. package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
  178. package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -56
  179. package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
  180. package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
  181. package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
  182. package/types/4sh-ui-kit-forms.d.ts +275 -194
  183. package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
  184. package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
  185. package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
  186. package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
  187. package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
  188. package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
  189. package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
  190. package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
  191. package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
  192. package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
  193. package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
  194. package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
  195. package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
  196. package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
  197. package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
  198. package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
  199. package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
  200. package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
  201. package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
  202. package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
  203. package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
  204. package/types/4sh-ui-kit-motion.d.ts +117 -67
  205. package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
  206. package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
  207. package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
  208. package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
  209. package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
  210. package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
  211. package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
  212. package/types/4sh-ui-kit-overlay.d.ts +6 -6
  213. package/types/4sh-ui-kit-ripple.d.ts +99 -74
  214. package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
  215. package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
  216. package/types/4sh-ui-kit-theming.d.ts +27 -29
  217. package/types/4sh-ui-kit-types.d.ts +6 -5
  218. package/types/4sh-ui-kit.d.ts +4 -3
  219. package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"4sh-ui-kit-forms-ui-swatch-picker.mjs","sources":["../../../projects/ui-kit/forms/ui-swatch-picker/src/lib/ui-swatch-picker.ts","../../../projects/ui-kit/forms/ui-swatch-picker/src/lib/ui-swatch-picker.html","../../../projects/ui-kit/forms/ui-swatch-picker/src/public-api.ts","../../../projects/ui-kit/forms/ui-swatch-picker/src/4sh-ui-kit-forms-ui-swatch-picker.ts"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { DOCUMENT, NgTemplateOutlet } from '@angular/common';\nimport { CdkConnectedOverlay, ConnectedPosition, OverlayModule } from '@angular/cdk/overlay';\nimport { UiIcon } from '@4sh/ui-kit/base/ui-icon';\nimport { UiMotion } from '@4sh/ui-kit/motion';\nimport { closeOnNavigation } from '@4sh/ui-kit/overlay';\n\n/** Density: `default`, or `small` for compact toolbars/popups. */\nexport type SwatchPickerSize = 'default' | 'small';\n\n/** One selectable color entry. */\nexport interface UiSwatch {\n /** Stable identifier, also the value carried by `value`/`swatchSelect`. */\n key: string;\n /** CSS variable rendering the swatch (e.g. `--primitives-red-500`). */\n cssVar: string;\n /** Accessible name (never just the color: sighted/non-sighted parity). */\n label: string;\n}\n\n/** A labeled section of the grid (rendered as consecutive cells, same columns). */\nexport interface UiSwatchGroup {\n /** Section label (rendered for screen readers via `aria-label` on the group). */\n label: string;\n /** Swatches of the section, in row-major (left-to-right, top-to-bottom) order. */\n swatches: UiSwatch[];\n}\n\n/** @ignore Internal flat entry (real swatch, or the synthetic \"no color\" one). */\ninterface FlatSwatch {\n key: string | null;\n cssVar: string | null;\n label: string;\n}\n\n/** Hue columns of the default palette, dark → light rows. */\nconst DEFAULT_HUES: { key: string; label: string }[] = [\n { key: 'primary', label: 'Primaire' },\n { key: 'secondary', label: 'Secondaire' },\n { key: 'green', label: 'Vert' },\n { key: 'orange', label: 'Orange' },\n { key: 'red', label: 'Rouge' },\n { key: 'slate', label: 'Ardoise' },\n { key: 'grey', label: 'Gris' },\n];\nconst DEFAULT_STEPS = [900, 700, 500, 300, 100];\n\n/**\n * Default palette: a 7×5 grid (7 hues × 5 shades, dark → light) derived from\n * the `primitives.*` tokens, plus `black`/`white`. Never hardcode a hex here —\n * every swatch is a semantic pointer to a `--primitives-*` CSS variable, so a\n * brand rebind (Brand 2 / Brand 3) changes what the grid shows for free.\n */\nexport const DEFAULT_SWATCH_PALETTE: UiSwatchGroup[] = [\n {\n label: 'Couleurs',\n swatches: [\n ...DEFAULT_STEPS.flatMap((step) =>\n DEFAULT_HUES.map(\n (hue): UiSwatch => ({\n key: `${hue.key}-${step}`,\n cssVar: `--primitives-${hue.key}-${step}`,\n label: `${hue.label} ${step}`,\n }),\n ),\n ),\n { key: 'black', cssVar: '--primitives-black-base', label: 'Noir' },\n { key: 'white', cssVar: '--primitives-white-base', label: 'Blanc' },\n ],\n },\n];\n\n/** Number of columns of the grid — tuned to the default 7-hue palette; a\n * custom palette wraps onto the same column count. */\nconst GRID_COLUMNS = 7;\n\n/** Trigger ↔ panel gap — keep aligned with `$overlay-panel-offset` (ui-config). */\nconst OVERLAY_OFFSET = 8;\n\n/** Process-wide counter for unique picker ids (aria wiring). */\nlet nextUid = 0;\n\n/**\n * ui-swatch-picker — headless color grid, static or popup, for a single-value\n * choice among a `UiSwatchGroup[]` palette (see {@link DEFAULT_SWATCH_PALETTE}).\n *\n * No trigger button of its own — same composition contract as {@link UiMenu}:\n * a caller wires its own `ui-button` to `toggle(event)` / `show(event)` and\n * reads the selection from `value` (two-way) or `swatchSelect`. Reuses\n * `ui-menu`'s overlay mechanics (`CdkConnectedOverlay`, auto-flip, scroll\n * re-position) and the shared `overlay-panel` shell.\n *\n * Every swatch is a real `<button>` (`role=\"option\"`, `aria-selected`) inside\n * a `role=\"listbox\"`; 2D roving-tabindex keyboard navigation (arrows,\n * Home/End) mirrors `ui-menu`'s roving focus, adapted to a grid.\n */\n@Component({\n selector: 'ui-swatch-picker',\n imports: [NgTemplateOutlet, OverlayModule, UiIcon, UiMotion],\n templateUrl: './ui-swatch-picker.html',\n styleUrl: './ui-swatch-picker.scss',\n host: {\n '[style.display]': \"popup() ? 'contents' : 'block'\",\n },\n})\nexport class UiSwatchPicker {\n /** Palette rendered as sections of swatches (see {@link UiSwatchGroup}). */\n palette = input<UiSwatchGroup[]>(DEFAULT_SWATCH_PALETTE);\n /** Selected swatch `key` (two-way bindable), or `null` for \"no color\". */\n value = model<string | null>(null);\n /** Popup mode: the panel opens in an overlay via `toggle(event)` / `show(event)`. */\n popup = input(false, { transform: booleanAttribute });\n /** Density: `default`, or `small` for compact toolbars/popups. */\n size = input<SwatchPickerSize>('small');\n /** Renders a \"no color\" swatch at the start of the grid, emitting `null`. */\n allowClear = input(true, { transform: booleanAttribute });\n /** Accessible name of the grid (`aria-label` on `role=\"listbox\"`). */\n ariaLabel = input<string>();\n\n /** Emitted on user selection (`null` when the \"no color\" swatch is picked). */\n swatchSelect = output<UiSwatch | null>();\n /** Emitted when the popup opens. */\n opened = output<void>();\n /** Emitted when the popup closes. */\n closed = output<void>();\n\n /** @ignore Panel root (overlay or inline) — keyboard focus queries. */\n private readonly panelEl = viewChild<ElementRef<HTMLElement>>('panel');\n /** @ignore The popup's overlay (repositioning on scroll). */\n private readonly connectedOverlay = viewChild(CdkConnectedOverlay);\n /** @ignore */\n private readonly doc = inject(DOCUMENT);\n\n /** Unique id of the panel (public: wire the trigger's `aria-controls` to it). */\n readonly uid = `ui-swatch-picker-${nextUid++}`;\n /** @ignore Popup open state. */\n protected readonly popupOpen = signal(false);\n /** @ignore Element the overlay is anchored to (the `toggle(event)` trigger). */\n protected readonly overlayOrigin = signal<Element | null>(null);\n /** @ignore Key of the swatch owning the roving tabindex (`''` = the clear\n * swatch, `undefined` = nothing focused yet). */\n private readonly focusedKey = signal<string | undefined>(undefined);\n\n constructor() {\n // A picker declared in an app shell outlives the routed view: dismiss it\n // rather than carrying it over to the next page.\n closeOnNavigation(() => this.hide());\n\n // Keep the floating panel GLUED to its scrolling anchor: while the popup\n // is open, re-apply the overlay position on any scroll (the CDK\n // reposition scroll strategy proved unreliable in zoneless contexts).\n effect((onCleanup) => {\n if (!this.popupOpen() || typeof window === 'undefined') return;\n const handler = () =>\n setTimeout(() => {\n // The trigger can be gone while the picker lives on: re-positioning\n // on a detached origin measures 0×0 and snaps to the top-left corner.\n if (this.overlayOrigin()?.isConnected === false) {\n this.hide();\n return;\n }\n this.overlayRef()?.updatePosition();\n });\n this.doc.addEventListener('scroll', handler, { capture: true, passive: true });\n onCleanup(() => this.doc.removeEventListener('scroll', handler, true));\n });\n }\n\n /** @ignore */\n private overlayRef() {\n return this.connectedOverlay()?.overlayRef;\n }\n\n /** @ignore Below the trigger, flipping above when space is lacking. */\n protected readonly overlayPositions: ConnectedPosition[] = [\n {\n originX: 'start',\n originY: 'bottom',\n overlayX: 'start',\n overlayY: 'top',\n offsetY: OVERLAY_OFFSET,\n },\n {\n originX: 'start',\n originY: 'top',\n overlayX: 'start',\n overlayY: 'bottom',\n offsetY: -OVERLAY_OFFSET,\n },\n ];\n\n /** @ignore Flat, render-ready swatch list (the synthetic \"no color\" one first). */\n protected readonly flatSwatches = computed<FlatSwatch[]>(() => {\n const list: FlatSwatch[] = [];\n if (this.allowClear()) list.push({ key: null, cssVar: null, label: 'Aucune couleur' });\n for (const group of this.palette()) {\n for (const swatch of group.swatches) list.push(swatch);\n }\n return list;\n });\n\n /** @ignore Keys of the focusable entries, in grid order (roving focus path). Uses `''` as the clear swatch's key (`null` is reserved for \"nothing focused\"). */\n private readonly focusableKeys = computed<string[]>(() =>\n this.flatSwatches().map((s) => s.key ?? ''),\n );\n\n /** @ignore Key owning the tab stop: last focused, else the selected value, else first. */\n protected readonly tabStopKey = computed<string | null>(() => {\n const keys = this.focusableKeys();\n if (!keys.length) return null;\n const focused = this.focusedKey();\n if (focused !== undefined && keys.includes(focused ?? '')) return focused ?? '';\n const selected = this.value() ?? '';\n return keys.includes(selected) ? selected : keys[0];\n });\n\n /** @ignore */\n protected readonly panelClasses = computed(() => {\n const c = ['ui-swatch-picker'];\n if (this.size() !== 'default') c.push(`_${this.size()}`);\n if (this.popup()) c.push('_popup');\n return c.join(' ');\n });\n\n // --- Popup ------------------------------------------------------------\n\n /** Toggles the popup relative to the event's `currentTarget`. */\n toggle(event: Event): void {\n this.popupOpen() ? this.hide() : this.show(event);\n }\n\n /** Opens the popup anchored to the event's `currentTarget`. */\n show(event: Event): void {\n if (!this.popup() || this.popupOpen()) return;\n this.overlayOrigin.set((event.currentTarget ?? event.target) as Element);\n this.popupOpen.set(true);\n this.opened.emit();\n this.queueFocusTabStop();\n }\n\n /** Closes the popup. */\n hide(focusTrigger = false): void {\n if (!this.popupOpen()) return;\n this.popupOpen.set(false);\n this.focusedKey.set(undefined);\n this.closed.emit();\n if (focusTrigger) (this.overlayOrigin() as HTMLElement | null)?.focus?.();\n }\n\n // --- Interactions -------------------------------------------------------\n\n /** @ignore Swatch key used as `data-key` / DOM id (empty string for \"no color\"). */\n protected swatchKey(swatch: FlatSwatch): string {\n return swatch.key ?? '';\n }\n\n /** @ignore Selection state of a swatch. */\n protected isSelected(swatch: FlatSwatch): boolean {\n return this.value() === swatch.key;\n }\n\n /** @ignore Activation (click / Enter / Space): select, emit, popup auto-close. */\n protected onSwatchClick(swatch: FlatSwatch): void {\n this.focusedKey.set(swatch.key ?? '');\n this.value.set(swatch.key);\n this.swatchSelect.emit(\n swatch.key === null || swatch.cssVar === null\n ? null\n : { key: swatch.key, cssVar: swatch.cssVar, label: swatch.label },\n );\n if (this.popup()) this.hide(true);\n }\n\n /** @ignore */\n protected onSwatchFocus(swatch: FlatSwatch): void {\n this.focusedKey.set(swatch.key ?? '');\n }\n\n /** @ignore 2D roving keyboard navigation (arrow grid, Home/End). */\n protected onGridKeydown(event: KeyboardEvent): void {\n const keys = this.focusableKeys();\n if (!keys.length) return;\n const currentKey = this.currentFocusKey(event);\n const index = currentKey !== null ? keys.indexOf(currentKey) : -1;\n const columns = Math.min(GRID_COLUMNS, keys.length);\n\n switch (event.key) {\n case 'ArrowRight':\n event.preventDefault();\n this.focusByKey(keys[Math.min(index + 1, keys.length - 1)]);\n break;\n case 'ArrowLeft':\n event.preventDefault();\n this.focusByKey(keys[Math.max(index - 1, 0)]);\n break;\n case 'ArrowDown':\n event.preventDefault();\n this.focusByKey(keys[Math.min(index + columns, keys.length - 1)]);\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.focusByKey(keys[Math.max(index - columns, 0)]);\n break;\n case 'Home':\n event.preventDefault();\n this.focusByKey(keys[0]);\n break;\n case 'End':\n event.preventDefault();\n this.focusByKey(keys[keys.length - 1]);\n break;\n case 'Escape':\n if (this.popup()) {\n event.preventDefault();\n this.hide(true);\n }\n break;\n }\n }\n\n /** @ignore Popup outside interaction. */\n protected onPopupOutsideClick(): void {\n this.hide();\n }\n\n // --- Internals ----------------------------------------------------------\n\n /** @ignore Key of the entry currently holding DOM focus. */\n private currentFocusKey(event: KeyboardEvent): string | null {\n const el = (event.target as HTMLElement).closest?.('[data-key]');\n return el?.getAttribute('data-key') ?? this.focusedKey() ?? null;\n }\n\n /** @ignore Move DOM focus (and the tab stop) to the entry with the given key. */\n private focusByKey(key: string | undefined): void {\n if (key === undefined) return;\n this.focusedKey.set(key);\n this.panelEl()\n ?.nativeElement.querySelector<HTMLElement>(`[data-key=\"${CSS.escape(key)}\"]`)\n ?.focus();\n }\n\n /** @ignore Focus the roving tab stop once the panel is rendered\n * (macrotask, not rAF: rAF never fires in throttled/background tabs). */\n private queueFocusTabStop(): void {\n setTimeout(() => this.focusByKey(this.tabStopKey() ?? undefined));\n }\n}\n","<!-- Picker panel: shared between inline render and the CDK overlay popup. -->\n<ng-template #panelTpl>\n <div\n #panel\n [class]=\"panelClasses()\"\n [attr.id]=\"uid\"\n [uiMotion]=\"'slide-down'\"\n [motionOnInsert]=\"popup()\"\n >\n <!-- ARIA listbox pattern: keyboard delegated to the container, focus lives\n on the options (roving tabindex). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ui-swatch-picker-grid\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onGridKeydown($event)\"\n >\n @for (swatch of flatSwatches(); track swatchKey(swatch)) {\n <button\n type=\"button\"\n class=\"ui-swatch-picker-swatch\"\n [class._selected]=\"isSelected(swatch)\"\n [class._clear]=\"swatch.key === null\"\n role=\"option\"\n [attr.data-key]=\"swatchKey(swatch)\"\n [attr.aria-selected]=\"isSelected(swatch)\"\n [attr.aria-label]=\"swatch.label\"\n [attr.title]=\"swatch.label\"\n [style.--ui-swatch-picker-swatch-color]=\"swatch.cssVar ? 'var(' + swatch.cssVar + ')' : null\"\n [attr.tabindex]=\"swatchKey(swatch) === tabStopKey() ? 0 : -1\"\n (click)=\"onSwatchClick(swatch)\"\n (focus)=\"onSwatchFocus(swatch)\"\n >\n @if (swatch.key === null) {\n <ui-icon class=\"ui-swatch-picker-clear-icon\" name=\"slash\" size=\"sm\" />\n }\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (popup()) {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"popupOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"hide()\"\n (overlayOutsideClick)=\"onPopupOutsideClick()\"\n (detach)=\"hide()\"\n >\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n </ng-template>\n} @else {\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n}\n","/*\n * Public API Surface of ui-kit/ui-swatch-picker\n */\n\nexport * from './lib/ui-swatch-picker';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;AA+CA;AACA,MAAM,YAAY,GAAqC;AACrD,IAAA,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE;AACrC,IAAA,EAAE,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,EAAE;AACzC,IAAA,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE;AAC/B,IAAA,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;AAClC,IAAA,EAAE,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE;AAC9B,IAAA,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE;AAClC,IAAA,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;CAC/B;AACD,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;AAE/C;;;;;AAKG;AACI,MAAM,sBAAsB,GAAoB;AACrD,IAAA;AACE,QAAA,KAAK,EAAE,UAAU;AACjB,QAAA,QAAQ,EAAE;AACR,YAAA,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC,IAAI,KAC5B,YAAY,CAAC,GAAG,CACd,CAAC,GAAG,MAAgB;AAClB,gBAAA,GAAG,EAAE,CAAA,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[],"sources":["../../../projects/ui-kit/forms/ui-swatch-picker/src/lib/ui-swatch-picker.ts","../../../projects/ui-kit/forms/ui-swatch-picker/src/lib/ui-swatch-picker.html"],"sourcesContent":["import {\n booleanAttribute,\n Component,\n computed,\n effect,\n ElementRef,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { DOCUMENT, NgTemplateOutlet } from '@angular/common';\nimport { CdkConnectedOverlay, ConnectedPosition, OverlayModule } from '@angular/cdk/overlay';\nimport { UiIcon } from '@4sh/ui-kit/base/ui-icon';\nimport { UiMotion } from '@4sh/ui-kit/motion';\nimport { closeOnNavigation } from '@4sh/ui-kit/overlay';\n\n/** Density: `default`, or `small` for compact toolbars/popups. */\nexport type SwatchPickerSize = 'default' | 'small';\n\n/** One selectable color entry. */\nexport interface UiSwatch {\n /** Stable identifier, also the value carried by `value`/`swatchSelect`. */\n key: string;\n /** CSS variable rendering the swatch (e.g. `--primitives-red-500`). */\n cssVar: string;\n /** Accessible name (never just the color: sighted/non-sighted parity). */\n label: string;\n}\n\n/** A labeled section of the grid (rendered as consecutive cells, same columns). */\nexport interface UiSwatchGroup {\n /** Section label (rendered for screen readers via `aria-label` on the group). */\n label: string;\n /** Swatches of the section, in row-major (left-to-right, top-to-bottom) order. */\n swatches: UiSwatch[];\n}\n\n/** @ignore Internal flat entry (real swatch, or the synthetic \"no color\" one). */\ninterface FlatSwatch {\n key: string | null;\n cssVar: string | null;\n label: string;\n}\n\n/** Hue columns of the default palette, dark → light rows. */\nconst DEFAULT_HUES: { key: string; label: string }[] = [\n { key: 'primary', label: 'Primaire' },\n { key: 'secondary', label: 'Secondaire' },\n { key: 'green', label: 'Vert' },\n { key: 'orange', label: 'Orange' },\n { key: 'red', label: 'Rouge' },\n { key: 'slate', label: 'Ardoise' },\n { key: 'grey', label: 'Gris' },\n];\nconst DEFAULT_STEPS = [900, 700, 500, 300, 100];\n\n/**\n * Default palette: a 7×5 grid (7 hues × 5 shades, dark → light) derived from\n * the `primitives.*` tokens, plus `black`/`white`. Never hardcode a hex here —\n * every swatch is a semantic pointer to a `--primitives-*` CSS variable, so a\n * brand rebind (Brand 2 / Brand 3) changes what the grid shows for free.\n */\nexport const DEFAULT_SWATCH_PALETTE: UiSwatchGroup[] = [\n {\n label: 'Couleurs',\n swatches: [\n ...DEFAULT_STEPS.flatMap((step) =>\n DEFAULT_HUES.map(\n (hue): UiSwatch => ({\n key: `${hue.key}-${step}`,\n cssVar: `--primitives-${hue.key}-${step}`,\n label: `${hue.label} ${step}`,\n }),\n ),\n ),\n { key: 'black', cssVar: '--primitives-black-base', label: 'Noir' },\n { key: 'white', cssVar: '--primitives-white-base', label: 'Blanc' },\n ],\n },\n];\n\n/** Number of columns of the grid — tuned to the default 7-hue palette; a\n * custom palette wraps onto the same column count. */\nconst GRID_COLUMNS = 7;\n\n/** Trigger ↔ panel gap — keep aligned with `$overlay-panel-offset` (ui-config). */\nconst OVERLAY_OFFSET = 8;\n\n/** Process-wide counter for unique picker ids (aria wiring). */\nlet nextUid = 0;\n\n/**\n * ui-swatch-picker — headless color grid, static or popup, for a single-value\n * choice among a `UiSwatchGroup[]` palette (see {@link DEFAULT_SWATCH_PALETTE}).\n *\n * No trigger button of its own — same composition contract as {@link UiMenu}:\n * a caller wires its own `ui-button` to `toggle(event)` / `show(event)` and\n * reads the selection from `value` (two-way) or `swatchSelect`. Reuses\n * `ui-menu`'s overlay mechanics (`CdkConnectedOverlay`, auto-flip, scroll\n * re-position) and the shared `overlay-panel` shell.\n *\n * Every swatch is a real `<button>` (`role=\"option\"`, `aria-selected`) inside\n * a `role=\"listbox\"`; 2D roving-tabindex keyboard navigation (arrows,\n * Home/End) mirrors `ui-menu`'s roving focus, adapted to a grid.\n */\n@Component({\n selector: 'ui-swatch-picker',\n imports: [NgTemplateOutlet, OverlayModule, UiIcon, UiMotion],\n templateUrl: './ui-swatch-picker.html',\n styleUrl: './ui-swatch-picker.scss',\n host: {\n '[style.display]': \"popup() ? 'contents' : 'block'\",\n },\n})\nexport class UiSwatchPicker {\n /** Palette rendered as sections of swatches (see {@link UiSwatchGroup}). */\n palette = input<UiSwatchGroup[]>(DEFAULT_SWATCH_PALETTE);\n /** Selected swatch `key` (two-way bindable), or `null` for \"no color\". */\n value = model<string | null>(null);\n /** Popup mode: the panel opens in an overlay via `toggle(event)` / `show(event)`. */\n popup = input(false, { transform: booleanAttribute });\n /** Density: `default`, or `small` for compact toolbars/popups. */\n size = input<SwatchPickerSize>('small');\n /** Renders a \"no color\" swatch at the start of the grid, emitting `null`. */\n allowClear = input(true, { transform: booleanAttribute });\n /** Accessible name of the grid (`aria-label` on `role=\"listbox\"`). */\n ariaLabel = input<string>();\n\n /** Emitted on user selection (`null` when the \"no color\" swatch is picked). */\n swatchSelect = output<UiSwatch | null>();\n /** Emitted when the popup opens. */\n opened = output<void>();\n /** Emitted when the popup closes. */\n closed = output<void>();\n\n /** @ignore Panel root (overlay or inline) — keyboard focus queries. */\n private readonly panelEl = viewChild<ElementRef<HTMLElement>>('panel');\n /** @ignore The popup's overlay (repositioning on scroll). */\n private readonly connectedOverlay = viewChild(CdkConnectedOverlay);\n /** @ignore */\n private readonly doc = inject(DOCUMENT);\n\n /** Unique id of the panel (public: wire the trigger's `aria-controls` to it). */\n readonly uid = `ui-swatch-picker-${nextUid++}`;\n /** @ignore Popup open state. */\n protected readonly popupOpen = signal(false);\n /** @ignore Element the overlay is anchored to (the `toggle(event)` trigger). */\n protected readonly overlayOrigin = signal<Element | null>(null);\n /** @ignore Key of the swatch owning the roving tabindex (`''` = the clear\n * swatch, `undefined` = nothing focused yet). */\n private readonly focusedKey = signal<string | undefined>(undefined);\n\n constructor() {\n // A picker declared in an app shell outlives the routed view: dismiss it\n // rather than carrying it over to the next page.\n closeOnNavigation(() => this.hide());\n\n // Keep the floating panel GLUED to its scrolling anchor: while the popup\n // is open, re-apply the overlay position on any scroll (the CDK\n // reposition scroll strategy proved unreliable in zoneless contexts).\n effect((onCleanup) => {\n if (!this.popupOpen() || typeof window === 'undefined') return;\n const handler = () =>\n setTimeout(() => {\n // The trigger can be gone while the picker lives on: re-positioning\n // on a detached origin measures 0×0 and snaps to the top-left corner.\n if (this.overlayOrigin()?.isConnected === false) {\n this.hide();\n return;\n }\n this.overlayRef()?.updatePosition();\n });\n this.doc.addEventListener('scroll', handler, { capture: true, passive: true });\n onCleanup(() => this.doc.removeEventListener('scroll', handler, true));\n });\n }\n\n /** @ignore */\n private overlayRef() {\n return this.connectedOverlay()?.overlayRef;\n }\n\n /** @ignore Below the trigger, flipping above when space is lacking. */\n protected readonly overlayPositions: ConnectedPosition[] = [\n {\n originX: 'start',\n originY: 'bottom',\n overlayX: 'start',\n overlayY: 'top',\n offsetY: OVERLAY_OFFSET,\n },\n {\n originX: 'start',\n originY: 'top',\n overlayX: 'start',\n overlayY: 'bottom',\n offsetY: -OVERLAY_OFFSET,\n },\n ];\n\n /** @ignore Flat, render-ready swatch list (the synthetic \"no color\" one first). */\n protected readonly flatSwatches = computed<FlatSwatch[]>(() => {\n const list: FlatSwatch[] = [];\n if (this.allowClear()) list.push({ key: null, cssVar: null, label: 'Aucune couleur' });\n for (const group of this.palette()) {\n for (const swatch of group.swatches) list.push(swatch);\n }\n return list;\n });\n\n /** @ignore Keys of the focusable entries, in grid order (roving focus path). Uses `''` as the clear swatch's key (`null` is reserved for \"nothing focused\"). */\n private readonly focusableKeys = computed<string[]>(() =>\n this.flatSwatches().map((s) => s.key ?? ''),\n );\n\n /** @ignore Key owning the tab stop: last focused, else the selected value, else first. */\n protected readonly tabStopKey = computed<string | null>(() => {\n const keys = this.focusableKeys();\n if (!keys.length) return null;\n const focused = this.focusedKey();\n if (focused !== undefined && keys.includes(focused ?? '')) return focused ?? '';\n const selected = this.value() ?? '';\n return keys.includes(selected) ? selected : keys[0];\n });\n\n /** @ignore */\n protected readonly panelClasses = computed(() => {\n const c = ['ui-swatch-picker'];\n if (this.size() !== 'default') c.push(`_${this.size()}`);\n if (this.popup()) c.push('_popup');\n return c.join(' ');\n });\n\n // --- Popup ------------------------------------------------------------\n\n /** Toggles the popup relative to the event's `currentTarget`. */\n toggle(event: Event): void {\n this.popupOpen() ? this.hide() : this.show(event);\n }\n\n /** Opens the popup anchored to the event's `currentTarget`. */\n show(event: Event): void {\n if (!this.popup() || this.popupOpen()) return;\n this.overlayOrigin.set((event.currentTarget ?? event.target) as Element);\n this.popupOpen.set(true);\n this.opened.emit();\n this.queueFocusTabStop();\n }\n\n /** Closes the popup. */\n hide(focusTrigger = false): void {\n if (!this.popupOpen()) return;\n this.popupOpen.set(false);\n this.focusedKey.set(undefined);\n this.closed.emit();\n if (focusTrigger) (this.overlayOrigin() as HTMLElement | null)?.focus?.();\n }\n\n // --- Interactions -------------------------------------------------------\n\n /** @ignore Swatch key used as `data-key` / DOM id (empty string for \"no color\"). */\n protected swatchKey(swatch: FlatSwatch): string {\n return swatch.key ?? '';\n }\n\n /** @ignore Selection state of a swatch. */\n protected isSelected(swatch: FlatSwatch): boolean {\n return this.value() === swatch.key;\n }\n\n /** @ignore Activation (click / Enter / Space): select, emit, popup auto-close. */\n protected onSwatchClick(swatch: FlatSwatch): void {\n this.focusedKey.set(swatch.key ?? '');\n this.value.set(swatch.key);\n this.swatchSelect.emit(\n swatch.key === null || swatch.cssVar === null\n ? null\n : { key: swatch.key, cssVar: swatch.cssVar, label: swatch.label },\n );\n if (this.popup()) this.hide(true);\n }\n\n /** @ignore */\n protected onSwatchFocus(swatch: FlatSwatch): void {\n this.focusedKey.set(swatch.key ?? '');\n }\n\n /** @ignore 2D roving keyboard navigation (arrow grid, Home/End). */\n protected onGridKeydown(event: KeyboardEvent): void {\n const keys = this.focusableKeys();\n if (!keys.length) return;\n const currentKey = this.currentFocusKey(event);\n const index = currentKey !== null ? keys.indexOf(currentKey) : -1;\n const columns = Math.min(GRID_COLUMNS, keys.length);\n\n switch (event.key) {\n case 'ArrowRight':\n event.preventDefault();\n this.focusByKey(keys[Math.min(index + 1, keys.length - 1)]);\n break;\n case 'ArrowLeft':\n event.preventDefault();\n this.focusByKey(keys[Math.max(index - 1, 0)]);\n break;\n case 'ArrowDown':\n event.preventDefault();\n this.focusByKey(keys[Math.min(index + columns, keys.length - 1)]);\n break;\n case 'ArrowUp':\n event.preventDefault();\n this.focusByKey(keys[Math.max(index - columns, 0)]);\n break;\n case 'Home':\n event.preventDefault();\n this.focusByKey(keys[0]);\n break;\n case 'End':\n event.preventDefault();\n this.focusByKey(keys[keys.length - 1]);\n break;\n case 'Escape':\n if (this.popup()) {\n event.preventDefault();\n this.hide(true);\n }\n break;\n }\n }\n\n /** @ignore Popup outside interaction. */\n protected onPopupOutsideClick(): void {\n this.hide();\n }\n\n // --- Internals ----------------------------------------------------------\n\n /** @ignore Key of the entry currently holding DOM focus. */\n private currentFocusKey(event: KeyboardEvent): string | null {\n const el = (event.target as HTMLElement).closest?.('[data-key]');\n return el?.getAttribute('data-key') ?? this.focusedKey() ?? null;\n }\n\n /** @ignore Move DOM focus (and the tab stop) to the entry with the given key. */\n private focusByKey(key: string | undefined): void {\n if (key === undefined) return;\n this.focusedKey.set(key);\n this.panelEl()\n ?.nativeElement.querySelector<HTMLElement>(`[data-key=\"${CSS.escape(key)}\"]`)\n ?.focus();\n }\n\n /** @ignore Focus the roving tab stop once the panel is rendered\n * (macrotask, not rAF: rAF never fires in throttled/background tabs). */\n private queueFocusTabStop(): void {\n setTimeout(() => this.focusByKey(this.tabStopKey() ?? undefined));\n }\n}\n","<!-- Picker panel: shared between inline render and the CDK overlay popup. -->\n<ng-template #panelTpl>\n <div\n #panel\n [class]=\"panelClasses()\"\n [attr.id]=\"uid\"\n [uiMotion]=\"'slide-down'\"\n [motionOnInsert]=\"popup()\"\n >\n <!-- ARIA listbox pattern: keyboard delegated to the container, focus lives\n on the options (roving tabindex). -->\n <!-- eslint-disable-next-line @angular-eslint/template/interactive-supports-focus -->\n <div\n class=\"ui-swatch-picker-grid\"\n role=\"listbox\"\n [attr.aria-label]=\"ariaLabel() || null\"\n (keydown)=\"onGridKeydown($event)\"\n >\n @for (swatch of flatSwatches(); track swatchKey(swatch)) {\n <button\n type=\"button\"\n class=\"ui-swatch-picker-swatch\"\n [class._selected]=\"isSelected(swatch)\"\n [class._clear]=\"swatch.key === null\"\n role=\"option\"\n [attr.data-key]=\"swatchKey(swatch)\"\n [attr.aria-selected]=\"isSelected(swatch)\"\n [attr.aria-label]=\"swatch.label\"\n [attr.title]=\"swatch.label\"\n [style.--ui-swatch-picker-swatch-color]=\"swatch.cssVar ? 'var(' + swatch.cssVar + ')' : null\"\n [attr.tabindex]=\"swatchKey(swatch) === tabStopKey() ? 0 : -1\"\n (click)=\"onSwatchClick(swatch)\"\n (focus)=\"onSwatchFocus(swatch)\"\n >\n @if (swatch.key === null) {\n <ui-icon class=\"ui-swatch-picker-clear-icon\" name=\"slash\" size=\"sm\" />\n }\n </button>\n }\n </div>\n </div>\n</ng-template>\n\n@if (popup()) {\n <ng-template\n cdkConnectedOverlay\n [cdkConnectedOverlayOrigin]=\"overlayOrigin()!\"\n [cdkConnectedOverlayOpen]=\"popupOpen()\"\n [cdkConnectedOverlayPositions]=\"overlayPositions\"\n [cdkConnectedOverlayHasBackdrop]=\"true\"\n cdkConnectedOverlayBackdropClass=\"cdk-overlay-transparent-backdrop\"\n (backdropClick)=\"hide()\"\n (overlayOutsideClick)=\"onPopupOutsideClick()\"\n (detach)=\"hide()\"\n >\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n </ng-template>\n} @else {\n <ng-container [ngTemplateOutlet]=\"panelTpl\" />\n}\n"],"mappings":";;;;;;;;AAgDA,MAAM,eAAiD;CACrD;EAAE,KAAK;EAAW,OAAO;CAAU;CACnC;EAAE,KAAK;EAAa,OAAO;CAAY;CACvC;EAAE,KAAK;EAAS,OAAO;CAAM;CAC7B;EAAE,KAAK;EAAU,OAAO;CAAQ;CAChC;EAAE,KAAK;EAAO,OAAO;CAAO;CAC5B;EAAE,KAAK;EAAS,OAAO;CAAS;CAChC;EAAE,KAAK;EAAQ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AAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,QAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,QAAA;EAAA,CAAA;EAAA,SAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,SAAO,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;EAAA,kBAAA,CAAA;GAAA,MAAA,GAAA;GAAA,MAAA,CAAA,GAAA,iBAEvB,mBAAmB,GAAA,EAAA,UAAA,KAAA,CAAA;EAAA,CAAA;CAAA;AAAA,CAAA"}
@@ -1,138 +1,272 @@
1
- import * as i0 from '@angular/core';
2
- import { input, booleanAttribute, output, viewChild, computed, effect, forwardRef, Component } from '@angular/core';
3
- import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
- import { BaseFormField, UiBrowserFill } from '@4sh/ui-kit/forms';
5
- import { UiField } from '@4sh/ui-kit/forms/ui-field';
6
-
7
- /**
8
- * ui-textarea — headless multiline text field, built on the `ui-field` shell
9
- * (label + box + helper) in **multiline** mode + a native `<textarea>`.
10
- *
11
- * The native `<textarea>` provides the resize grip (`resize: vertical`, the
12
- * Figma "resizer" affordance). `autoResize` grows the box with the content and
13
- * disables the manual grip.
14
- *
15
- * Standalone, `[(ngModel)]` or reactive forms (ControlValueAccessor via BaseFormField).
16
- */
17
- class UiTextarea extends BaseFormField {
18
- constructor() {
19
- super();
20
- /** Native placeholder. */
21
- this.placeholder = input(/* @ts-ignore */
22
- ...(ngDevMode ? [undefined, { debugName: "placeholder" }] : /* istanbul ignore next */ []));
23
- /** Initial number of visible text rows. */
24
- this.rows = input(3, /* @ts-ignore */
25
- ...(ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []));
26
- /** Native maxlength (caps the character count). */
27
- this.maxlength = input(/* @ts-ignore */
28
- ...(ngDevMode ? [undefined, { debugName: "maxlength" }] : /* istanbul ignore next */ []));
29
- /** Grows the box height with the content (disables the manual resize grip). */
30
- this.autoResize = input(false, { ...(ngDevMode ? { debugName: "autoResize" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
31
- /** Manual resize axis (`vertical` by default; ignored when `autoResize`). */
32
- this.resize = input('vertical', /* @ts-ignore */
33
- ...(ngDevMode ? [{ debugName: "resize" }] : /* istanbul ignore next */ []));
34
- /** Shows a character counter under the field (`count` or `count / maxlength`). */
35
- this.showCount = input(false, { ...(ngDevMode ? { debugName: "showCount" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
36
- /** Emitted on each input with the new value. */
37
- this.valueChange = output();
38
- /** Emitted when the textarea receives focus. */
39
- this.textareaFocus = output();
40
- /** Emitted when the textarea loses focus. */
41
- this.textareaBlur = output();
42
- /** @ignore */
43
- this.textareaEl = viewChild('textareaEl', /* @ts-ignore */
44
- ...(ngDevMode ? [{ debugName: "textareaEl" }] : /* istanbul ignore next */ []));
45
- /** @ignore Effective resize axis (`none` while auto-resizing). */
46
- this.effectiveResize = computed(() => this.autoResize() ? 'none' : this.resize(), /* @ts-ignore */
47
- ...(ngDevMode ? [{ debugName: "effectiveResize" }] : /* istanbul ignore next */ []));
48
- /** @ignore Current character count. */
49
- this.charCount = computed(() => (this.modelValue() ?? '').length, /* @ts-ignore */
50
- ...(ngDevMode ? [{ debugName: "charCount" }] : /* istanbul ignore next */ []));
51
- /** @ignore Keeps a floating label raised once focus leaves. */
52
- this.isFilled = computed(() => this.charCount() > 0, /* @ts-ignore */
53
- ...(ngDevMode ? [{ debugName: "isFilled" }] : /* istanbul ignore next */ []));
54
- /** @ignore At rest the floating label already holds that spot. */
55
- this.effectivePlaceholder = computed(() => this.hasFloatLabel() ? '' : (this.placeholder() ?? ''), /* @ts-ignore */
56
- ...(ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []));
57
- /** @ignore Over the maxlength (only reachable programmatically). */
58
- this.overLimit = computed(() => {
59
- const max = this.maxlength();
60
- return max != null && this.charCount() > max;
61
- }, /* @ts-ignore */
62
- ...(ngDevMode ? [{ debugName: "overLimit" }] : /* istanbul ignore next */ []));
63
- /** @ignore id of the character counter (for `aria-describedby`). */
64
- this.countId = computed(() => `${this.resolvedId()}-count`, /* @ts-ignore */
65
- ...(ngDevMode ? [{ debugName: "countId" }] : /* istanbul ignore next */ []));
66
- /** @ignore `aria-describedby` combines the message and the counter, whichever are shown. */
67
- this.describedByIds = computed(() => {
68
- const ids = [
69
- this.displayMessage() ? this.messageId() : null,
70
- this.showCount() ? this.countId() : null,
71
- ].filter(Boolean);
72
- return ids.length ? ids.join(' ') : null;
73
- }, /* @ts-ignore */
74
- ...(ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []));
75
- // Keep the height in sync when the value changes programmatically (forms).
76
- effect(() => {
77
- this.modelValue();
78
- if (this.autoResize())
79
- this.resizeToContent();
80
- });
81
- }
82
- /** Focuses the textarea. */
83
- focus(options) {
84
- this.textareaEl()?.nativeElement.focus(options);
85
- }
86
- /** @ignore Input: single source of the value (view → form). */
87
- onInput() {
88
- const el = this.textareaEl()?.nativeElement;
89
- if (!el)
90
- return;
91
- const value = el.value;
92
- this.modelValue.set(value);
93
- this.emitChange(value);
94
- this.valueChange.emit(value);
95
- if (this.autoResize())
96
- this.resizeToContent();
97
- }
98
- /** @ignore Value written by the browser without an `input` event. */
99
- onBrowserFill() {
100
- const el = this.textareaEl()?.nativeElement;
101
- if (el && el.value !== this.displayValue())
102
- this.onInput();
103
- }
104
- /** @ignore */
105
- onBlur(event) {
106
- this.emitTouch();
107
- this.textareaBlur.emit(event);
108
- }
109
- /** @ignore Recomputes the height to fit the content. */
110
- resizeToContent() {
111
- const el = this.textareaEl()?.nativeElement;
112
- if (!el)
113
- return;
114
- el.style.height = 'auto';
115
- el.style.height = `${el.scrollHeight}px`;
116
- }
117
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiTextarea, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
118
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiTextarea, isStandalone: true, selector: "ui-textarea", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, maxlength: { classPropertyName: "maxlength", publicName: "maxlength", isSignal: true, isRequired: false, transformFunction: null }, autoResize: { classPropertyName: "autoResize", publicName: "autoResize", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null }, showCount: { classPropertyName: "showCount", publicName: "showCount", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", textareaFocus: "textareaFocus", textareaBlur: "textareaBlur" }, providers: [
119
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },
120
- ], viewQueries: [{ propertyName: "textareaEl", first: true, predicate: ["textareaEl"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n &nbsp;/&nbsp;{{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"], dependencies: [{ kind: "component", type: UiField, selector: "ui-field", inputs: ["label", "for", "required", "size", "level", "floatLabel", "filled", "disabled", "readonly", "multiline", "autoHeight", "message", "messageId", "showMessageIcon", "messageIcon", "hasFooter", "hasPrefix"] }, { kind: "directive", type: UiBrowserFill, selector: "[uiBrowserFill]", outputs: ["browserFill"] }] }); }
121
- }
122
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiTextarea, decorators: [{
123
- type: Component,
124
- args: [{ selector: 'ui-textarea', imports: [UiField, UiBrowserFill], providers: [
125
- { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => UiTextarea), multi: true },
126
- ], template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n &nbsp;/&nbsp;{{ max }}\n }\n </span>\n }\n</ui-field>\n", styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"] }]
127
- }], ctorParameters: () => [], propDecorators: { placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], maxlength: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxlength", required: false }] }], autoResize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autoResize", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }], showCount: [{ type: i0.Input, args: [{ isSignal: true, alias: "showCount", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], textareaFocus: [{ type: i0.Output, args: ["textareaFocus"] }], textareaBlur: [{ type: i0.Output, args: ["textareaBlur"] }], textareaEl: [{ type: i0.ViewChild, args: ['textareaEl', { isSignal: true }] }] } });
128
-
129
- /*
130
- * Public API Surface of ui-kit/ui-textarea
131
- */
132
-
133
- /**
134
- * Generated bundle index. Do not edit.
135
- */
136
-
1
+ import * as i0 from "@angular/core";
2
+ import { Component, booleanAttribute, computed, effect, forwardRef, input, output, viewChild } from "@angular/core";
3
+ import { NG_VALUE_ACCESSOR } from "@angular/forms";
4
+ import { BaseFormField, UiBrowserFill } from "@4sh/ui-kit/forms";
5
+ import { UiField } from "@4sh/ui-kit/forms/ui-field";
6
+ var UiTextarea = class UiTextarea extends BaseFormField {
7
+ constructor() {
8
+ super();
9
+ this.placeholder = input(...ngDevMode ? [void 0, { debugName: "placeholder" }] : /* istanbul ignore next */ []);
10
+ this.rows = input(3, ...ngDevMode ? [{ debugName: "rows" }] : /* istanbul ignore next */ []);
11
+ this.maxlength = input(...ngDevMode ? [void 0, { debugName: "maxlength" }] : /* istanbul ignore next */ []);
12
+ this.autoResize = input(false, {
13
+ ...ngDevMode ? { debugName: "autoResize" } : /* istanbul ignore next */ {},
14
+ transform: booleanAttribute
15
+ });
16
+ this.resize = input("vertical", ...ngDevMode ? [{ debugName: "resize" }] : /* istanbul ignore next */ []);
17
+ this.showCount = input(false, {
18
+ ...ngDevMode ? { debugName: "showCount" } : /* istanbul ignore next */ {},
19
+ transform: booleanAttribute
20
+ });
21
+ this.valueChange = output();
22
+ this.textareaFocus = output();
23
+ this.textareaBlur = output();
24
+ this.textareaEl = viewChild("textareaEl", ...ngDevMode ? [{ debugName: "textareaEl" }] : /* istanbul ignore next */ []);
25
+ this.effectiveResize = computed(() => this.autoResize() ? "none" : this.resize(), ...ngDevMode ? [{ debugName: "effectiveResize" }] : /* istanbul ignore next */ []);
26
+ this.charCount = computed(() => (this.modelValue() ?? "").length, ...ngDevMode ? [{ debugName: "charCount" }] : /* istanbul ignore next */ []);
27
+ this.isFilled = computed(() => this.charCount() > 0, ...ngDevMode ? [{ debugName: "isFilled" }] : /* istanbul ignore next */ []);
28
+ this.effectivePlaceholder = computed(() => this.hasFloatLabel() ? "" : this.placeholder() ?? "", ...ngDevMode ? [{ debugName: "effectivePlaceholder" }] : /* istanbul ignore next */ []);
29
+ this.overLimit = computed(() => {
30
+ const max = this.maxlength();
31
+ return max != null && this.charCount() > max;
32
+ }, ...ngDevMode ? [{ debugName: "overLimit" }] : /* istanbul ignore next */ []);
33
+ this.countId = computed(() => `${this.resolvedId()}-count`, ...ngDevMode ? [{ debugName: "countId" }] : /* istanbul ignore next */ []);
34
+ this.describedByIds = computed(() => {
35
+ const ids = [this.displayMessage() ? this.messageId() : null, this.showCount() ? this.countId() : null].filter(Boolean);
36
+ return ids.length ? ids.join(" ") : null;
37
+ }, ...ngDevMode ? [{ debugName: "describedByIds" }] : /* istanbul ignore next */ []);
38
+ effect(() => {
39
+ this.modelValue();
40
+ if (this.autoResize()) this.resizeToContent();
41
+ });
42
+ }
43
+ focus(options) {
44
+ this.textareaEl()?.nativeElement.focus(options);
45
+ }
46
+ onInput() {
47
+ const el = this.textareaEl()?.nativeElement;
48
+ if (!el) return;
49
+ const value = el.value;
50
+ this.modelValue.set(value);
51
+ this.emitChange(value);
52
+ this.valueChange.emit(value);
53
+ if (this.autoResize()) this.resizeToContent();
54
+ }
55
+ onBrowserFill() {
56
+ const el = this.textareaEl()?.nativeElement;
57
+ if (el && el.value !== this.displayValue()) this.onInput();
58
+ }
59
+ onBlur(event) {
60
+ this.emitTouch();
61
+ this.textareaBlur.emit(event);
62
+ }
63
+ resizeToContent() {
64
+ const el = this.textareaEl()?.nativeElement;
65
+ if (!el) return;
66
+ el.style.height = "auto";
67
+ el.style.height = `${el.scrollHeight}px`;
68
+ }
69
+ static {
70
+ this.ɵfac = i0.ɵɵngDeclareFactory({
71
+ minVersion: "12.0.0",
72
+ version: "22.3.0",
73
+ ngImport: i0,
74
+ type: UiTextarea,
75
+ deps: [],
76
+ target: i0.ɵɵFactoryTarget.Component
77
+ });
78
+ }
79
+ static {
80
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
81
+ minVersion: "17.0.0",
82
+ version: "22.3.0",
83
+ type: UiTextarea,
84
+ isStandalone: true,
85
+ selector: "ui-textarea",
86
+ inputs: {
87
+ placeholder: {
88
+ classPropertyName: "placeholder",
89
+ publicName: "placeholder",
90
+ isSignal: true,
91
+ isRequired: false,
92
+ transformFunction: null
93
+ },
94
+ rows: {
95
+ classPropertyName: "rows",
96
+ publicName: "rows",
97
+ isSignal: true,
98
+ isRequired: false,
99
+ transformFunction: null
100
+ },
101
+ maxlength: {
102
+ classPropertyName: "maxlength",
103
+ publicName: "maxlength",
104
+ isSignal: true,
105
+ isRequired: false,
106
+ transformFunction: null
107
+ },
108
+ autoResize: {
109
+ classPropertyName: "autoResize",
110
+ publicName: "autoResize",
111
+ isSignal: true,
112
+ isRequired: false,
113
+ transformFunction: null
114
+ },
115
+ resize: {
116
+ classPropertyName: "resize",
117
+ publicName: "resize",
118
+ isSignal: true,
119
+ isRequired: false,
120
+ transformFunction: null
121
+ },
122
+ showCount: {
123
+ classPropertyName: "showCount",
124
+ publicName: "showCount",
125
+ isSignal: true,
126
+ isRequired: false,
127
+ transformFunction: null
128
+ }
129
+ },
130
+ outputs: {
131
+ valueChange: "valueChange",
132
+ textareaFocus: "textareaFocus",
133
+ textareaBlur: "textareaBlur"
134
+ },
135
+ providers: [{
136
+ provide: NG_VALUE_ACCESSOR,
137
+ useExisting: forwardRef(() => UiTextarea),
138
+ multi: true
139
+ }],
140
+ viewQueries: [{
141
+ propertyName: "textareaEl",
142
+ first: true,
143
+ predicate: ["textareaEl"],
144
+ descendants: true,
145
+ isSignal: true
146
+ }],
147
+ usesInheritance: true,
148
+ ngImport: i0,
149
+ template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n &nbsp;/&nbsp;{{ max }}\n }\n </span>\n }\n</ui-field>\n",
150
+ styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"],
151
+ dependencies: [{
152
+ kind: "component",
153
+ type: UiField,
154
+ selector: "ui-field",
155
+ inputs: [
156
+ "label",
157
+ "for",
158
+ "required",
159
+ "size",
160
+ "level",
161
+ "floatLabel",
162
+ "filled",
163
+ "disabled",
164
+ "readonly",
165
+ "multiline",
166
+ "autoHeight",
167
+ "message",
168
+ "messageId",
169
+ "showMessageIcon",
170
+ "messageIcon",
171
+ "hasFooter",
172
+ "hasPrefix"
173
+ ]
174
+ }, {
175
+ kind: "directive",
176
+ type: UiBrowserFill,
177
+ selector: "[uiBrowserFill]",
178
+ outputs: ["browserFill"]
179
+ }]
180
+ });
181
+ }
182
+ };
183
+ i0.ɵɵngDeclareClassMetadata({
184
+ minVersion: "12.0.0",
185
+ version: "22.3.0",
186
+ ngImport: i0,
187
+ type: UiTextarea,
188
+ decorators: [{
189
+ type: Component,
190
+ args: [{
191
+ selector: "ui-textarea",
192
+ imports: [UiField, UiBrowserFill],
193
+ providers: [{
194
+ provide: NG_VALUE_ACCESSOR,
195
+ useExisting: forwardRef(() => UiTextarea),
196
+ multi: true
197
+ }],
198
+ template: "<ui-field\n multiline\n [label]=\"label()\"\n [for]=\"resolvedId()\"\n [required]=\"required()\"\n [size]=\"size()\"\n [level]=\"effectiveLevel()\"\n [floatLabel]=\"floatLabel()\"\n [filled]=\"isFilled()\"\n [disabled]=\"isDisabled()\"\n [readonly]=\"readonly()\"\n [message]=\"displayMessage()\"\n [messageId]=\"messageId()\"\n [showMessageIcon]=\"showMessageIcon()\"\n [messageIcon]=\"messageIcon()\"\n [hasFooter]=\"showCount()\"\n>\n <textarea\n #textareaEl\n uiBrowserFill\n class=\"ui-textarea-native\"\n [class._small]=\"size() === 'small'\"\n [class._auto-resize]=\"autoResize()\"\n [style.resize]=\"effectiveResize()\"\n [id]=\"resolvedId()\"\n [value]=\"displayValue()\"\n [rows]=\"rows()\"\n [placeholder]=\"effectivePlaceholder()\"\n [disabled]=\"isDisabled()\"\n [readOnly]=\"readonly()\"\n [required]=\"required()\"\n [attr.name]=\"name() || null\"\n [attr.tabindex]=\"tabindex()\"\n [attr.maxlength]=\"maxlength()\"\n [attr.aria-label]=\"label() ? null : ariaLabel() || null\"\n [attr.aria-labelledby]=\"ariaLabelledBy() || null\"\n [attr.aria-describedby]=\"describedByIds()\"\n [attr.aria-invalid]=\"effectiveLevel() === 'error' ? 'true' : null\"\n (input)=\"onInput()\"\n (browserFill)=\"onBrowserFill()\"\n (focus)=\"textareaFocus.emit($event)\"\n (blur)=\"onBlur($event)\"\n ></textarea>\n\n @if (showCount()) {\n <span\n uiFieldFooter\n class=\"ui-textarea-count\"\n [class._small]=\"size() === 'small'\"\n [class._disabled]=\"isDisabled()\"\n [class._over]=\"overLimit()\"\n [attr.id]=\"countId()\"\n >\n {{ charCount() }}\n @if (maxlength(); as max) {\n &nbsp;/&nbsp;{{ max }}\n }\n </span>\n }\n</ui-field>\n",
199
+ styles: ["@keyframes ui-browser-fill{0%{opacity:1}}.ui-browser-fill:-webkit-autofill{animation:ui-browser-fill 0s}.ui-textarea-native{flex:1 1 auto;align-self:stretch;min-width:0;margin:0;padding:0;border:none;border-radius:inherit;background:transparent;outline:none;font-family:var(--ui-form-field-font-family, var(--fontfamily-base));font-size:var(--size-typography-text-default);color:var(--ui-form-field-color, var(--form-high-content-default))}.ui-textarea-native:first-child{padding-inline-start:var(--_field-inset-inline-start, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native:last-child{padding-inline-end:var(--_field-inset-inline-end, var(--ui-textarea-padding-x, var(--ui-form-field-padding-x, var(--units-md))))}.ui-textarea-native{padding-block-start:calc(0px + var(--_field-inset-block-start, 0px))}.ui-textarea-native::placeholder{color:var(--ui-form-field-placeholder-color, var(--form-low-content-default));opacity:1}.ui-textarea-native:disabled{cursor:not-allowed;color:var(--ui-form-field-color-disabled, var(--form-high-content-disabled))}.ui-textarea-native{box-sizing:border-box;width:100%;min-height:var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm)));line-height:var(--ui-textarea-line-height, 1.5);padding-block:var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2));max-width:100%;padding-block-start:calc(var(--ui-textarea-padding-block, calc((var(--ui-textarea-min-height, var(--ui-form-textarea-min-height, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._small{min-height:var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm)));padding-block:var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2));font-size:var(--ui-textarea-font-size-small, var(--size-typography-text-md));padding-block-start:calc(var(--ui-textarea-padding-block-small, calc((var(--ui-textarea-min-height-small, var(--ui-form-textarea-min-height-small, var(--size-components-sm))) - 1.5em) / 2)) + var(--_field-inset-block-start, 0px))}.ui-textarea-native._auto-resize{overflow:hidden}.ui-textarea-count{margin-left:auto;flex-shrink:0;font-family:var(--ui-textarea-font-family, var(--fontfamily-base));font-size:var(--ui-textarea-count-font-size, var(--size-typography-text-md));color:var(--ui-textarea-count-color, var(--form-low-content-default));-webkit-user-select:none;user-select:none}.ui-textarea-count._small{font-size:var(--ui-textarea-count-font-size-small, var(--size-typography-text-sm))}.ui-textarea-count._over{color:var(--ui-textarea-count-color-over, var(--form-error-content-default))}.ui-textarea-count._disabled{color:var(--ui-textarea-count-color-disabled, var(--form-high-content-disabled))}\n"]
200
+ }]
201
+ }],
202
+ ctorParameters: () => [],
203
+ propDecorators: {
204
+ placeholder: [{
205
+ type: i0.Input,
206
+ args: [{
207
+ isSignal: true,
208
+ alias: "placeholder",
209
+ required: false
210
+ }]
211
+ }],
212
+ rows: [{
213
+ type: i0.Input,
214
+ args: [{
215
+ isSignal: true,
216
+ alias: "rows",
217
+ required: false
218
+ }]
219
+ }],
220
+ maxlength: [{
221
+ type: i0.Input,
222
+ args: [{
223
+ isSignal: true,
224
+ alias: "maxlength",
225
+ required: false
226
+ }]
227
+ }],
228
+ autoResize: [{
229
+ type: i0.Input,
230
+ args: [{
231
+ isSignal: true,
232
+ alias: "autoResize",
233
+ required: false
234
+ }]
235
+ }],
236
+ resize: [{
237
+ type: i0.Input,
238
+ args: [{
239
+ isSignal: true,
240
+ alias: "resize",
241
+ required: false
242
+ }]
243
+ }],
244
+ showCount: [{
245
+ type: i0.Input,
246
+ args: [{
247
+ isSignal: true,
248
+ alias: "showCount",
249
+ required: false
250
+ }]
251
+ }],
252
+ valueChange: [{
253
+ type: i0.Output,
254
+ args: ["valueChange"]
255
+ }],
256
+ textareaFocus: [{
257
+ type: i0.Output,
258
+ args: ["textareaFocus"]
259
+ }],
260
+ textareaBlur: [{
261
+ type: i0.Output,
262
+ args: ["textareaBlur"]
263
+ }],
264
+ textareaEl: [{
265
+ type: i0.ViewChild,
266
+ args: ["textareaEl", { isSignal: true }]
267
+ }]
268
+ }
269
+ });
137
270
  export { UiTextarea };
138
- //# sourceMappingURL=4sh-ui-kit-forms-ui-textarea.mjs.map
271
+
272
+ //# sourceMappingURL=4sh-ui-kit-forms-ui-textarea.mjs.map