@4sh/ui-kit 0.15.0 → 0.17.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 (220) hide show
  1. package/README.fr.md +18 -10
  2. package/README.md +18 -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 -953
  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 -2039
  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 -130
  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 -246
  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 -291
  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 -194
  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 -131
  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 +723 -596
  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 +313 -2
  143. package/mcp/data/text-search-docs.json +177 -17
  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/styles/utils/_mixins.scss +11 -0
  150. package/types/4sh-ui-kit-actions-ui-button-split.d.ts +198 -87
  151. package/types/4sh-ui-kit-actions-ui-button.d.ts +240 -116
  152. package/types/4sh-ui-kit-actions-ui-link.d.ts +136 -67
  153. package/types/4sh-ui-kit-actions-ui-speed-dial.d.ts +287 -180
  154. package/types/4sh-ui-kit-base-ui-icon.d.ts +92 -58
  155. package/types/4sh-ui-kit-base-ui-image.d.ts +406 -205
  156. package/types/4sh-ui-kit-forms-ui-autocomplete.d.ts +577 -367
  157. package/types/4sh-ui-kit-forms-ui-checkbox.d.ts +77 -42
  158. package/types/4sh-ui-kit-forms-ui-datepicker.d.ts +953 -700
  159. package/types/4sh-ui-kit-forms-ui-editor.d.ts +374 -340
  160. package/types/4sh-ui-kit-forms-ui-field-sign.d.ts +325 -0
  161. package/types/4sh-ui-kit-forms-ui-field.d.ts +150 -64
  162. package/types/4sh-ui-kit-forms-ui-file-upload.d.ts +583 -241
  163. package/types/4sh-ui-kit-forms-ui-input-date.d.ts +152 -103
  164. package/types/4sh-ui-kit-forms-ui-input-group.d.ts +109 -63
  165. package/types/4sh-ui-kit-forms-ui-input-mask.d.ts +93 -57
  166. package/types/4sh-ui-kit-forms-ui-input-number.d.ts +171 -93
  167. package/types/4sh-ui-kit-forms-ui-input-otp.d.ts +137 -100
  168. package/types/4sh-ui-kit-forms-ui-input-tags.d.ts +469 -309
  169. package/types/4sh-ui-kit-forms-ui-input.d.ts +198 -116
  170. package/types/4sh-ui-kit-forms-ui-knob.d.ts +132 -80
  171. package/types/4sh-ui-kit-forms-ui-label.d.ts +47 -22
  172. package/types/4sh-ui-kit-forms-ui-nudger.d.ts +134 -67
  173. package/types/4sh-ui-kit-forms-ui-radio.d.ts +48 -33
  174. package/types/4sh-ui-kit-forms-ui-rating.d.ts +120 -86
  175. package/types/4sh-ui-kit-forms-ui-segment-control.d.ts +221 -147
  176. package/types/4sh-ui-kit-forms-ui-select.d.ts +561 -357
  177. package/types/4sh-ui-kit-forms-ui-slider.d.ts +156 -105
  178. package/types/4sh-ui-kit-forms-ui-swatch-picker.d.ts +133 -97
  179. package/types/4sh-ui-kit-forms-ui-textarea.d.ts +90 -54
  180. package/types/4sh-ui-kit-forms-ui-toggle-block.d.ts +158 -94
  181. package/types/4sh-ui-kit-forms-ui-toggle-button.d.ts +314 -178
  182. package/types/4sh-ui-kit-forms-ui-toggle.d.ts +88 -54
  183. package/types/4sh-ui-kit-forms.d.ts +291 -186
  184. package/types/4sh-ui-kit-informative-ui-accordion.d.ts +162 -92
  185. package/types/4sh-ui-kit-informative-ui-alert.d.ts +128 -62
  186. package/types/4sh-ui-kit-informative-ui-avatar-group.d.ts +8 -8
  187. package/types/4sh-ui-kit-informative-ui-avatar.d.ts +81 -44
  188. package/types/4sh-ui-kit-informative-ui-badge.d.ts +71 -41
  189. package/types/4sh-ui-kit-informative-ui-chip.d.ts +194 -99
  190. package/types/4sh-ui-kit-informative-ui-empty-state.d.ts +105 -65
  191. package/types/4sh-ui-kit-informative-ui-helper.d.ts +64 -34
  192. package/types/4sh-ui-kit-informative-ui-progress-bar.d.ts +120 -65
  193. package/types/4sh-ui-kit-informative-ui-read-only.d.ts +147 -67
  194. package/types/4sh-ui-kit-informative-ui-separator.d.ts +65 -35
  195. package/types/4sh-ui-kit-informative-ui-skeleton.d.ts +62 -32
  196. package/types/4sh-ui-kit-informative-ui-spinner.d.ts +111 -50
  197. package/types/4sh-ui-kit-informative-ui-tag.d.ts +77 -37
  198. package/types/4sh-ui-kit-informative-ui-toast.d.ts +300 -180
  199. package/types/4sh-ui-kit-informative-ui-tooltip.d.ts +269 -141
  200. package/types/4sh-ui-kit-layout-ui-bottom-sheet.d.ts +360 -221
  201. package/types/4sh-ui-kit-layout-ui-card.d.ts +119 -79
  202. package/types/4sh-ui-kit-layout-ui-drawer.d.ts +244 -120
  203. package/types/4sh-ui-kit-layout-ui-modal.d.ts +409 -222
  204. package/types/4sh-ui-kit-layout-ui-popover.d.ts +149 -91
  205. package/types/4sh-ui-kit-motion.d.ts +117 -67
  206. package/types/4sh-ui-kit-navigation-ui-bottom-tab-bar.d.ts +279 -145
  207. package/types/4sh-ui-kit-navigation-ui-breadcrumb.d.ts +134 -96
  208. package/types/4sh-ui-kit-navigation-ui-context-menu.d.ts +148 -89
  209. package/types/4sh-ui-kit-navigation-ui-menu.d.ts +282 -201
  210. package/types/4sh-ui-kit-navigation-ui-sidebar.d.ts +425 -261
  211. package/types/4sh-ui-kit-navigation-ui-stepper.d.ts +279 -183
  212. package/types/4sh-ui-kit-navigation-ui-tabs.d.ts +275 -173
  213. package/types/4sh-ui-kit-overlay.d.ts +6 -6
  214. package/types/4sh-ui-kit-ripple.d.ts +99 -74
  215. package/types/4sh-ui-kit-table-ui-paginator.d.ts +237 -133
  216. package/types/4sh-ui-kit-table-ui-table.d.ts +769 -470
  217. package/types/4sh-ui-kit-theming.d.ts +27 -29
  218. package/types/4sh-ui-kit-types.d.ts +6 -5
  219. package/types/4sh-ui-kit.d.ts +4 -3
  220. package/fesm2022/4sh-ui-kit-types.mjs.map +0 -1
@@ -1,317 +1,509 @@
1
- import * as i0 from '@angular/core';
2
- import { input, model, booleanAttribute, output, viewChild, inject, signal, computed, effect, Component } from '@angular/core';
3
- import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
4
- import * as i1 from '@angular/cdk/overlay';
5
- import { CdkConnectedOverlay, OverlayModule } from '@angular/cdk/overlay';
6
- import { UiIcon } from '@4sh/ui-kit/base/ui-icon';
7
- import { UiMotion } from '@4sh/ui-kit/motion';
8
- import { closeOnNavigation } from '@4sh/ui-kit/overlay';
9
-
10
- /** Hue columns of the default palette, dark → light rows. */
1
+ import * as i0 from "@angular/core";
2
+ import { Component, booleanAttribute, computed, effect, inject, input, model, output, signal, viewChild } from "@angular/core";
3
+ import { DOCUMENT, NgTemplateOutlet } from "@angular/common";
4
+ import * as i1 from "@angular/cdk/overlay";
5
+ import { CdkConnectedOverlay, OverlayModule } from "@angular/cdk/overlay";
6
+ import { UiIcon } from "@4sh/ui-kit/base/ui-icon";
7
+ import { UiMotion } from "@4sh/ui-kit/motion";
8
+ import { closeOnNavigation } from "@4sh/ui-kit/overlay";
11
9
  const DEFAULT_HUES = [
12
- { key: 'primary', label: 'Primaire' },
13
- { key: 'secondary', label: 'Secondaire' },
14
- { key: 'green', label: 'Vert' },
15
- { key: 'orange', label: 'Orange' },
16
- { key: 'red', label: 'Rouge' },
17
- { key: 'slate', label: 'Ardoise' },
18
- { key: 'grey', label: 'Gris' },
19
- ];
20
- const DEFAULT_STEPS = [900, 700, 500, 300, 100];
21
- /**
22
- * Default palette: a 7×5 grid (7 hues × 5 shades, dark → light) derived from
23
- * the `primitives.*` tokens, plus `black`/`white`. Never hardcode a hex here —
24
- * every swatch is a semantic pointer to a `--primitives-*` CSS variable, so a
25
- * brand rebind (Brand 2 / Brand 3) changes what the grid shows for free.
26
- */
27
- const DEFAULT_SWATCH_PALETTE = [
28
- {
29
- label: 'Couleurs',
30
- swatches: [
31
- ...DEFAULT_STEPS.flatMap((step) => DEFAULT_HUES.map((hue) => ({
32
- key: `${hue.key}-${step}`,
33
- cssVar: `--primitives-${hue.key}-${step}`,
34
- label: `${hue.label} ${step}`,
35
- }))),
36
- { key: 'black', cssVar: '--primitives-black-base', label: 'Noir' },
37
- { key: 'white', cssVar: '--primitives-white-base', label: 'Blanc' },
38
- ],
39
- },
10
+ {
11
+ key: "primary",
12
+ label: "Primaire"
13
+ },
14
+ {
15
+ key: "secondary",
16
+ label: "Secondaire"
17
+ },
18
+ {
19
+ key: "green",
20
+ label: "Vert"
21
+ },
22
+ {
23
+ key: "orange",
24
+ label: "Orange"
25
+ },
26
+ {
27
+ key: "red",
28
+ label: "Rouge"
29
+ },
30
+ {
31
+ key: "slate",
32
+ label: "Ardoise"
33
+ },
34
+ {
35
+ key: "grey",
36
+ label: "Gris"
37
+ }
40
38
  ];
41
- /** Number of columns of the grid — tuned to the default 7-hue palette; a
42
- * custom palette wraps onto the same column count. */
39
+ const DEFAULT_SWATCH_PALETTE = [{
40
+ label: "Couleurs",
41
+ swatches: [
42
+ ...[
43
+ 900,
44
+ 700,
45
+ 500,
46
+ 300,
47
+ 100
48
+ ].flatMap((step) => DEFAULT_HUES.map((hue) => ({
49
+ key: `${hue.key}-${step}`,
50
+ cssVar: `--primitives-${hue.key}-${step}`,
51
+ label: `${hue.label} ${step}`
52
+ }))),
53
+ {
54
+ key: "black",
55
+ cssVar: "--primitives-black-base",
56
+ label: "Noir"
57
+ },
58
+ {
59
+ key: "white",
60
+ cssVar: "--primitives-white-base",
61
+ label: "Blanc"
62
+ }
63
+ ]
64
+ }];
43
65
  const GRID_COLUMNS = 7;
44
- /** Trigger ↔ panel gap — keep aligned with `$overlay-panel-offset` (ui-config). */
45
66
  const OVERLAY_OFFSET = 8;
46
- /** Process-wide counter for unique picker ids (aria wiring). */
47
67
  let nextUid = 0;
48
- /**
49
- * ui-swatch-picker — headless color grid, static or popup, for a single-value
50
- * choice among a `UiSwatchGroup[]` palette (see {@link DEFAULT_SWATCH_PALETTE}).
51
- *
52
- * No trigger button of its own — same composition contract as {@link UiMenu}:
53
- * a caller wires its own `ui-button` to `toggle(event)` / `show(event)` and
54
- * reads the selection from `value` (two-way) or `swatchSelect`. Reuses
55
- * `ui-menu`'s overlay mechanics (`CdkConnectedOverlay`, auto-flip, scroll
56
- * re-position) and the shared `overlay-panel` shell.
57
- *
58
- * Every swatch is a real `<button>` (`role="option"`, `aria-selected`) inside
59
- * a `role="listbox"`; 2D roving-tabindex keyboard navigation (arrows,
60
- * Home/End) mirrors `ui-menu`'s roving focus, adapted to a grid.
61
- */
62
- class UiSwatchPicker {
63
- constructor() {
64
- /** Palette rendered as sections of swatches (see {@link UiSwatchGroup}). */
65
- this.palette = input(DEFAULT_SWATCH_PALETTE, /* @ts-ignore */
66
- ...(ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []));
67
- /** Selected swatch `key` (two-way bindable), or `null` for "no color". */
68
- this.value = model(null, /* @ts-ignore */
69
- ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
70
- /** Popup mode: the panel opens in an overlay via `toggle(event)` / `show(event)`. */
71
- this.popup = input(false, { ...(ngDevMode ? { debugName: "popup" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
72
- /** Density: `default`, or `small` for compact toolbars/popups. */
73
- this.size = input('small', /* @ts-ignore */
74
- ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
75
- /** Renders a "no color" swatch at the start of the grid, emitting `null`. */
76
- this.allowClear = input(true, { ...(ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
77
- /** Accessible name of the grid (`aria-label` on `role="listbox"`). */
78
- this.ariaLabel = input(/* @ts-ignore */
79
- ...(ngDevMode ? [undefined, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
80
- /** Emitted on user selection (`null` when the "no color" swatch is picked). */
81
- this.swatchSelect = output();
82
- /** Emitted when the popup opens. */
83
- this.opened = output();
84
- /** Emitted when the popup closes. */
85
- this.closed = output();
86
- /** @ignore Panel root (overlay or inline) — keyboard focus queries. */
87
- this.panelEl = viewChild('panel', /* @ts-ignore */
88
- ...(ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []));
89
- /** @ignore The popup's overlay (repositioning on scroll). */
90
- this.connectedOverlay = viewChild(CdkConnectedOverlay, /* @ts-ignore */
91
- ...(ngDevMode ? [{ debugName: "connectedOverlay" }] : /* istanbul ignore next */ []));
92
- /** @ignore */
93
- this.doc = inject(DOCUMENT);
94
- /** Unique id of the panel (public: wire the trigger's `aria-controls` to it). */
95
- this.uid = `ui-swatch-picker-${nextUid++}`;
96
- /** @ignore Popup open state. */
97
- this.popupOpen = signal(false, /* @ts-ignore */
98
- ...(ngDevMode ? [{ debugName: "popupOpen" }] : /* istanbul ignore next */ []));
99
- /** @ignore Element the overlay is anchored to (the `toggle(event)` trigger). */
100
- this.overlayOrigin = signal(null, /* @ts-ignore */
101
- ...(ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []));
102
- /** @ignore Key of the swatch owning the roving tabindex (`''` = the clear
103
- * swatch, `undefined` = nothing focused yet). */
104
- this.focusedKey = signal(undefined, /* @ts-ignore */
105
- ...(ngDevMode ? [{ debugName: "focusedKey" }] : /* istanbul ignore next */ []));
106
- /** @ignore Below the trigger, flipping above when space is lacking. */
107
- this.overlayPositions = [
108
- {
109
- originX: 'start',
110
- originY: 'bottom',
111
- overlayX: 'start',
112
- overlayY: 'top',
113
- offsetY: OVERLAY_OFFSET,
114
- },
115
- {
116
- originX: 'start',
117
- originY: 'top',
118
- overlayX: 'start',
119
- overlayY: 'bottom',
120
- offsetY: -OVERLAY_OFFSET,
121
- },
122
- ];
123
- /** @ignore Flat, render-ready swatch list (the synthetic "no color" one first). */
124
- this.flatSwatches = computed(() => {
125
- const list = [];
126
- if (this.allowClear())
127
- list.push({ key: null, cssVar: null, label: 'Aucune couleur' });
128
- for (const group of this.palette()) {
129
- for (const swatch of group.swatches)
130
- list.push(swatch);
131
- }
132
- return list;
133
- }, /* @ts-ignore */
134
- ...(ngDevMode ? [{ debugName: "flatSwatches" }] : /* istanbul ignore next */ []));
135
- /** @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"). */
136
- this.focusableKeys = computed(() => this.flatSwatches().map((s) => s.key ?? ''), /* @ts-ignore */
137
- ...(ngDevMode ? [{ debugName: "focusableKeys" }] : /* istanbul ignore next */ []));
138
- /** @ignore Key owning the tab stop: last focused, else the selected value, else first. */
139
- this.tabStopKey = computed(() => {
140
- const keys = this.focusableKeys();
141
- if (!keys.length)
142
- return null;
143
- const focused = this.focusedKey();
144
- if (focused !== undefined && keys.includes(focused ?? ''))
145
- return focused ?? '';
146
- const selected = this.value() ?? '';
147
- return keys.includes(selected) ? selected : keys[0];
148
- }, /* @ts-ignore */
149
- ...(ngDevMode ? [{ debugName: "tabStopKey" }] : /* istanbul ignore next */ []));
150
- /** @ignore */
151
- this.panelClasses = computed(() => {
152
- const c = ['ui-swatch-picker'];
153
- if (this.size() !== 'default')
154
- c.push(`_${this.size()}`);
155
- if (this.popup())
156
- c.push('_popup');
157
- return c.join(' ');
158
- }, /* @ts-ignore */
159
- ...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
160
- // A picker declared in an app shell outlives the routed view: dismiss it
161
- // rather than carrying it over to the next page.
162
- closeOnNavigation(() => this.hide());
163
- // Keep the floating panel GLUED to its scrolling anchor: while the popup
164
- // is open, re-apply the overlay position on any scroll (the CDK
165
- // reposition scroll strategy proved unreliable in zoneless contexts).
166
- effect((onCleanup) => {
167
- if (!this.popupOpen() || typeof window === 'undefined')
168
- return;
169
- const handler = () => setTimeout(() => {
170
- // The trigger can be gone while the picker lives on: re-positioning
171
- // on a detached origin measures 0×0 and snaps to the top-left corner.
172
- if (this.overlayOrigin()?.isConnected === false) {
173
- this.hide();
174
- return;
175
- }
176
- this.overlayRef()?.updatePosition();
177
- });
178
- this.doc.addEventListener('scroll', handler, { capture: true, passive: true });
179
- onCleanup(() => this.doc.removeEventListener('scroll', handler, true));
180
- });
181
- }
182
- /** @ignore */
183
- overlayRef() {
184
- return this.connectedOverlay()?.overlayRef;
185
- }
186
- // --- Popup ------------------------------------------------------------
187
- /** Toggles the popup relative to the event's `currentTarget`. */
188
- toggle(event) {
189
- this.popupOpen() ? this.hide() : this.show(event);
190
- }
191
- /** Opens the popup anchored to the event's `currentTarget`. */
192
- show(event) {
193
- if (!this.popup() || this.popupOpen())
194
- return;
195
- this.overlayOrigin.set((event.currentTarget ?? event.target));
196
- this.popupOpen.set(true);
197
- this.opened.emit();
198
- this.queueFocusTabStop();
199
- }
200
- /** Closes the popup. */
201
- hide(focusTrigger = false) {
202
- if (!this.popupOpen())
203
- return;
204
- this.popupOpen.set(false);
205
- this.focusedKey.set(undefined);
206
- this.closed.emit();
207
- if (focusTrigger)
208
- this.overlayOrigin()?.focus?.();
209
- }
210
- // --- Interactions -------------------------------------------------------
211
- /** @ignore Swatch key used as `data-key` / DOM id (empty string for "no color"). */
212
- swatchKey(swatch) {
213
- return swatch.key ?? '';
214
- }
215
- /** @ignore Selection state of a swatch. */
216
- isSelected(swatch) {
217
- return this.value() === swatch.key;
218
- }
219
- /** @ignore Activation (click / Enter / Space): select, emit, popup auto-close. */
220
- onSwatchClick(swatch) {
221
- this.focusedKey.set(swatch.key ?? '');
222
- this.value.set(swatch.key);
223
- this.swatchSelect.emit(swatch.key === null || swatch.cssVar === null
224
- ? null
225
- : { key: swatch.key, cssVar: swatch.cssVar, label: swatch.label });
226
- if (this.popup())
227
- this.hide(true);
228
- }
229
- /** @ignore */
230
- onSwatchFocus(swatch) {
231
- this.focusedKey.set(swatch.key ?? '');
232
- }
233
- /** @ignore 2D roving keyboard navigation (arrow grid, Home/End). */
234
- onGridKeydown(event) {
235
- const keys = this.focusableKeys();
236
- if (!keys.length)
237
- return;
238
- const currentKey = this.currentFocusKey(event);
239
- const index = currentKey !== null ? keys.indexOf(currentKey) : -1;
240
- const columns = Math.min(GRID_COLUMNS, keys.length);
241
- switch (event.key) {
242
- case 'ArrowRight':
243
- event.preventDefault();
244
- this.focusByKey(keys[Math.min(index + 1, keys.length - 1)]);
245
- break;
246
- case 'ArrowLeft':
247
- event.preventDefault();
248
- this.focusByKey(keys[Math.max(index - 1, 0)]);
249
- break;
250
- case 'ArrowDown':
251
- event.preventDefault();
252
- this.focusByKey(keys[Math.min(index + columns, keys.length - 1)]);
253
- break;
254
- case 'ArrowUp':
255
- event.preventDefault();
256
- this.focusByKey(keys[Math.max(index - columns, 0)]);
257
- break;
258
- case 'Home':
259
- event.preventDefault();
260
- this.focusByKey(keys[0]);
261
- break;
262
- case 'End':
263
- event.preventDefault();
264
- this.focusByKey(keys[keys.length - 1]);
265
- break;
266
- case 'Escape':
267
- if (this.popup()) {
268
- event.preventDefault();
269
- this.hide(true);
270
- }
271
- break;
272
- }
273
- }
274
- /** @ignore Popup outside interaction. */
275
- onPopupOutsideClick() {
276
- this.hide();
277
- }
278
- // --- Internals ----------------------------------------------------------
279
- /** @ignore Key of the entry currently holding DOM focus. */
280
- currentFocusKey(event) {
281
- const el = event.target.closest?.('[data-key]');
282
- return el?.getAttribute('data-key') ?? this.focusedKey() ?? null;
283
- }
284
- /** @ignore Move DOM focus (and the tab stop) to the entry with the given key. */
285
- focusByKey(key) {
286
- if (key === undefined)
287
- return;
288
- this.focusedKey.set(key);
289
- this.panelEl()
290
- ?.nativeElement.querySelector(`[data-key="${CSS.escape(key)}"]`)
291
- ?.focus();
292
- }
293
- /** @ignore Focus the roving tab stop once the panel is rendered
294
- * (macrotask, not rAF: rAF never fires in throttled/background tabs). */
295
- queueFocusTabStop() {
296
- setTimeout(() => this.focusByKey(this.tabStopKey() ?? undefined));
297
- }
298
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiSwatchPicker, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
299
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.7", type: UiSwatchPicker, isStandalone: true, selector: "ui-swatch-picker", inputs: { palette: { classPropertyName: "palette", publicName: "palette", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, popup: { classPropertyName: "popup", publicName: "popup", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", swatchSelect: "swatchSelect", opened: "opened", closed: "closed" }, host: { properties: { "style.display": "popup() ? 'contents' : 'block'" } }, viewQueries: [{ propertyName: "panelEl", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "connectedOverlay", first: true, predicate: CdkConnectedOverlay, descendants: true, isSignal: true }], ngImport: i0, template: "<!-- 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", styles: [".ui-swatch-picker{display:flex;flex-direction:column;padding:var(--ui-swatch-picker-panel-padding, var(--ui-overlay-panel-padding, var(--units-sm)));box-sizing:border-box;border:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-overlay-stroke, transparent);border-radius:var(--ui-overlay-radius, var(--ui-overlay-panel-radius, var(--radius-default)));background-color:var(--ui-overlay-surface, var(--ui-swatch-picker-panel-surface, var(--global-background-default)));box-shadow:var(--ui-overlay-shadow, var(--ui-overlay-panel-shadow, var(--shadow-default-md)));font-family:var(--ui-overlay-panel-font-family, var(--fontfamily-base));border:none}.ui-swatch-picker._popup{width:max-content;max-width:calc(100vw - var(--units-lg));max-height:calc(100vh - var(--units-lg));overflow:auto}.ui-swatch-picker-grid{display:grid;grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size, 2rem));gap:var(--ui-swatch-picker-gap, var(--units-xs))}.ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size, 2rem);height:var(--ui-swatch-picker-cell-size, 2rem)}.ui-swatch-picker._small .ui-swatch-picker-grid{grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size-small, 1.5rem));gap:var(--ui-swatch-picker-gap-small, var(--units-2xs))}.ui-swatch-picker._small .ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size-small, 1.5rem);height:var(--ui-swatch-picker-cell-size-small, 1.5rem)}.ui-swatch-picker-swatch{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0;border:var(--ui-swatch-picker-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-swatch-picker-swatch-stroke, var(--global-border-default));border-radius:var(--ui-swatch-picker-swatch-radius, var(--radius-xs));background-color:var(--ui-swatch-picker-swatch-color, transparent);cursor:pointer;transition:box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-swatch-picker-swatch:hover:not(:disabled){border-color:var(--ui-swatch-picker-swatch-stroke-hover, var(--global-border-default-hover))}.ui-swatch-picker-swatch:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked))}.ui-swatch-picker-swatch:focus-visible._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked)),0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._clear{background-color:transparent;color:var(--ui-swatch-picker-clear-color, var(--global-text-muted))}.ui-swatch-picker-clear-icon{line-height:0}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation", "cdkConnectedOverlayUsePopover", "cdkConnectedOverlayMatchWidth", "cdkConnectedOverlay"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "component", type: UiIcon, selector: "ui-icon", inputs: ["name", "size", "type", "family", "decorative", "ariaLabel"] }, { kind: "directive", type: UiMotion, selector: "[uiMotion]", inputs: ["uiMotion", "motionDuration", "motionDelay", "motionEasing", "motionEnterEasing", "motionLeaveEasing", "motionDistance", "motionScale", "motionDisabled", "motionOnInsert"], exportAs: ["uiMotion"] }] }); }
300
- }
301
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.7", ngImport: i0, type: UiSwatchPicker, decorators: [{
302
- type: Component,
303
- args: [{ selector: 'ui-swatch-picker', imports: [NgTemplateOutlet, OverlayModule, UiIcon, UiMotion], host: {
304
- '[style.display]': "popup() ? 'contents' : 'block'",
305
- }, template: "<!-- 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", styles: [".ui-swatch-picker{display:flex;flex-direction:column;padding:var(--ui-swatch-picker-panel-padding, var(--ui-overlay-panel-padding, var(--units-sm)));box-sizing:border-box;border:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-overlay-stroke, transparent);border-radius:var(--ui-overlay-radius, var(--ui-overlay-panel-radius, var(--radius-default)));background-color:var(--ui-overlay-surface, var(--ui-swatch-picker-panel-surface, var(--global-background-default)));box-shadow:var(--ui-overlay-shadow, var(--ui-overlay-panel-shadow, var(--shadow-default-md)));font-family:var(--ui-overlay-panel-font-family, var(--fontfamily-base));border:none}.ui-swatch-picker._popup{width:max-content;max-width:calc(100vw - var(--units-lg));max-height:calc(100vh - var(--units-lg));overflow:auto}.ui-swatch-picker-grid{display:grid;grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size, 2rem));gap:var(--ui-swatch-picker-gap, var(--units-xs))}.ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size, 2rem);height:var(--ui-swatch-picker-cell-size, 2rem)}.ui-swatch-picker._small .ui-swatch-picker-grid{grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size-small, 1.5rem));gap:var(--ui-swatch-picker-gap-small, var(--units-2xs))}.ui-swatch-picker._small .ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size-small, 1.5rem);height:var(--ui-swatch-picker-cell-size-small, 1.5rem)}.ui-swatch-picker-swatch{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0;border:var(--ui-swatch-picker-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-swatch-picker-swatch-stroke, var(--global-border-default));border-radius:var(--ui-swatch-picker-swatch-radius, var(--radius-xs));background-color:var(--ui-swatch-picker-swatch-color, transparent);cursor:pointer;transition:box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-swatch-picker-swatch:hover:not(:disabled){border-color:var(--ui-swatch-picker-swatch-stroke-hover, var(--global-border-default-hover))}.ui-swatch-picker-swatch:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked))}.ui-swatch-picker-swatch:focus-visible._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked)),0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._clear{background-color:transparent;color:var(--ui-swatch-picker-clear-color, var(--global-text-muted))}.ui-swatch-picker-clear-icon{line-height:0}\n"] }]
306
- }], ctorParameters: () => [], propDecorators: { palette: [{ type: i0.Input, args: [{ isSignal: true, alias: "palette", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], popup: [{ type: i0.Input, args: [{ isSignal: true, alias: "popup", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], allowClear: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowClear", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], swatchSelect: [{ type: i0.Output, args: ["swatchSelect"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], panelEl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], connectedOverlay: [{ type: i0.ViewChild, args: [i0.forwardRef(() => CdkConnectedOverlay), { isSignal: true }] }] } });
307
-
308
- /*
309
- * Public API Surface of ui-kit/ui-swatch-picker
310
- */
311
-
312
- /**
313
- * Generated bundle index. Do not edit.
314
- */
315
-
68
+ var UiSwatchPicker = class UiSwatchPicker {
69
+ constructor() {
70
+ this.palette = input(DEFAULT_SWATCH_PALETTE, ...ngDevMode ? [{ debugName: "palette" }] : /* istanbul ignore next */ []);
71
+ this.value = model(null, ...ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []);
72
+ this.popup = input(false, {
73
+ ...ngDevMode ? { debugName: "popup" } : /* istanbul ignore next */ {},
74
+ transform: booleanAttribute
75
+ });
76
+ this.size = input("small", ...ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []);
77
+ this.allowClear = input(true, {
78
+ ...ngDevMode ? { debugName: "allowClear" } : /* istanbul ignore next */ {},
79
+ transform: booleanAttribute
80
+ });
81
+ this.ariaLabel = input(...ngDevMode ? [void 0, { debugName: "ariaLabel" }] : /* istanbul ignore next */ []);
82
+ this.swatchSelect = output();
83
+ this.opened = output();
84
+ this.closed = output();
85
+ this.panelEl = viewChild("panel", ...ngDevMode ? [{ debugName: "panelEl" }] : /* istanbul ignore next */ []);
86
+ this.connectedOverlay = viewChild(CdkConnectedOverlay, ...ngDevMode ? [{ debugName: "connectedOverlay" }] : /* istanbul ignore next */ []);
87
+ this.doc = inject(DOCUMENT);
88
+ this.uid = `ui-swatch-picker-${nextUid++}`;
89
+ this.popupOpen = signal(false, ...ngDevMode ? [{ debugName: "popupOpen" }] : /* istanbul ignore next */ []);
90
+ this.overlayOrigin = signal(null, ...ngDevMode ? [{ debugName: "overlayOrigin" }] : /* istanbul ignore next */ []);
91
+ this.focusedKey = signal(void 0, ...ngDevMode ? [{ debugName: "focusedKey" }] : /* istanbul ignore next */ []);
92
+ this.overlayPositions = [{
93
+ originX: "start",
94
+ originY: "bottom",
95
+ overlayX: "start",
96
+ overlayY: "top",
97
+ offsetY: OVERLAY_OFFSET
98
+ }, {
99
+ originX: "start",
100
+ originY: "top",
101
+ overlayX: "start",
102
+ overlayY: "bottom",
103
+ offsetY: -8
104
+ }];
105
+ this.flatSwatches = computed(() => {
106
+ const list = [];
107
+ if (this.allowClear()) list.push({
108
+ key: null,
109
+ cssVar: null,
110
+ label: "Aucune couleur"
111
+ });
112
+ for (const group of this.palette()) for (const swatch of group.swatches) list.push(swatch);
113
+ return list;
114
+ }, ...ngDevMode ? [{ debugName: "flatSwatches" }] : /* istanbul ignore next */ []);
115
+ this.focusableKeys = computed(() => this.flatSwatches().map((s) => s.key ?? ""), ...ngDevMode ? [{ debugName: "focusableKeys" }] : /* istanbul ignore next */ []);
116
+ this.tabStopKey = computed(() => {
117
+ const keys = this.focusableKeys();
118
+ if (!keys.length) return null;
119
+ const focused = this.focusedKey();
120
+ if (focused !== void 0 && keys.includes(focused ?? "")) return focused ?? "";
121
+ const selected = this.value() ?? "";
122
+ return keys.includes(selected) ? selected : keys[0];
123
+ }, ...ngDevMode ? [{ debugName: "tabStopKey" }] : /* istanbul ignore next */ []);
124
+ this.panelClasses = computed(() => {
125
+ const c = ["ui-swatch-picker"];
126
+ if (this.size() !== "default") c.push(`_${this.size()}`);
127
+ if (this.popup()) c.push("_popup");
128
+ return c.join(" ");
129
+ }, ...ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []);
130
+ closeOnNavigation(() => this.hide());
131
+ effect((onCleanup) => {
132
+ if (!this.popupOpen() || typeof window === "undefined") return;
133
+ const handler = () => setTimeout(() => {
134
+ if (this.overlayOrigin()?.isConnected === false) {
135
+ this.hide();
136
+ return;
137
+ }
138
+ this.overlayRef()?.updatePosition();
139
+ });
140
+ this.doc.addEventListener("scroll", handler, {
141
+ capture: true,
142
+ passive: true
143
+ });
144
+ onCleanup(() => this.doc.removeEventListener("scroll", handler, true));
145
+ });
146
+ }
147
+ overlayRef() {
148
+ return this.connectedOverlay()?.overlayRef;
149
+ }
150
+ toggle(event) {
151
+ this.popupOpen() ? this.hide() : this.show(event);
152
+ }
153
+ show(event) {
154
+ if (!this.popup() || this.popupOpen()) return;
155
+ this.overlayOrigin.set(event.currentTarget ?? event.target);
156
+ this.popupOpen.set(true);
157
+ this.opened.emit();
158
+ this.queueFocusTabStop();
159
+ }
160
+ hide(focusTrigger = false) {
161
+ if (!this.popupOpen()) return;
162
+ this.popupOpen.set(false);
163
+ this.focusedKey.set(void 0);
164
+ this.closed.emit();
165
+ if (focusTrigger) this.overlayOrigin()?.focus?.();
166
+ }
167
+ swatchKey(swatch) {
168
+ return swatch.key ?? "";
169
+ }
170
+ isSelected(swatch) {
171
+ return this.value() === swatch.key;
172
+ }
173
+ onSwatchClick(swatch) {
174
+ this.focusedKey.set(swatch.key ?? "");
175
+ this.value.set(swatch.key);
176
+ this.swatchSelect.emit(swatch.key === null || swatch.cssVar === null ? null : {
177
+ key: swatch.key,
178
+ cssVar: swatch.cssVar,
179
+ label: swatch.label
180
+ });
181
+ if (this.popup()) this.hide(true);
182
+ }
183
+ onSwatchFocus(swatch) {
184
+ this.focusedKey.set(swatch.key ?? "");
185
+ }
186
+ onGridKeydown(event) {
187
+ const keys = this.focusableKeys();
188
+ if (!keys.length) return;
189
+ const currentKey = this.currentFocusKey(event);
190
+ const index = currentKey !== null ? keys.indexOf(currentKey) : -1;
191
+ const columns = Math.min(GRID_COLUMNS, keys.length);
192
+ switch (event.key) {
193
+ case "ArrowRight":
194
+ event.preventDefault();
195
+ this.focusByKey(keys[Math.min(index + 1, keys.length - 1)]);
196
+ break;
197
+ case "ArrowLeft":
198
+ event.preventDefault();
199
+ this.focusByKey(keys[Math.max(index - 1, 0)]);
200
+ break;
201
+ case "ArrowDown":
202
+ event.preventDefault();
203
+ this.focusByKey(keys[Math.min(index + columns, keys.length - 1)]);
204
+ break;
205
+ case "ArrowUp":
206
+ event.preventDefault();
207
+ this.focusByKey(keys[Math.max(index - columns, 0)]);
208
+ break;
209
+ case "Home":
210
+ event.preventDefault();
211
+ this.focusByKey(keys[0]);
212
+ break;
213
+ case "End":
214
+ event.preventDefault();
215
+ this.focusByKey(keys[keys.length - 1]);
216
+ break;
217
+ case "Escape": if (this.popup()) {
218
+ event.preventDefault();
219
+ this.hide(true);
220
+ }
221
+ }
222
+ }
223
+ onPopupOutsideClick() {
224
+ this.hide();
225
+ }
226
+ currentFocusKey(event) {
227
+ return (event.target.closest?.("[data-key]"))?.getAttribute("data-key") ?? this.focusedKey() ?? null;
228
+ }
229
+ focusByKey(key) {
230
+ if (key === void 0) return;
231
+ this.focusedKey.set(key);
232
+ this.panelEl()?.nativeElement.querySelector(`[data-key="${CSS.escape(key)}"]`)?.focus();
233
+ }
234
+ queueFocusTabStop() {
235
+ setTimeout(() => this.focusByKey(this.tabStopKey() ?? void 0));
236
+ }
237
+ static {
238
+ this.ɵfac = i0.ɵɵngDeclareFactory({
239
+ minVersion: "12.0.0",
240
+ version: "22.3.0",
241
+ ngImport: i0,
242
+ type: UiSwatchPicker,
243
+ deps: [],
244
+ target: i0.ɵɵFactoryTarget.Component
245
+ });
246
+ }
247
+ static {
248
+ this.ɵcmp = i0.ɵɵngDeclareComponent({
249
+ minVersion: "17.0.0",
250
+ version: "22.3.0",
251
+ type: UiSwatchPicker,
252
+ isStandalone: true,
253
+ selector: "ui-swatch-picker",
254
+ inputs: {
255
+ palette: {
256
+ classPropertyName: "palette",
257
+ publicName: "palette",
258
+ isSignal: true,
259
+ isRequired: false,
260
+ transformFunction: null
261
+ },
262
+ value: {
263
+ classPropertyName: "value",
264
+ publicName: "value",
265
+ isSignal: true,
266
+ isRequired: false,
267
+ transformFunction: null
268
+ },
269
+ popup: {
270
+ classPropertyName: "popup",
271
+ publicName: "popup",
272
+ isSignal: true,
273
+ isRequired: false,
274
+ transformFunction: null
275
+ },
276
+ size: {
277
+ classPropertyName: "size",
278
+ publicName: "size",
279
+ isSignal: true,
280
+ isRequired: false,
281
+ transformFunction: null
282
+ },
283
+ allowClear: {
284
+ classPropertyName: "allowClear",
285
+ publicName: "allowClear",
286
+ isSignal: true,
287
+ isRequired: false,
288
+ transformFunction: null
289
+ },
290
+ ariaLabel: {
291
+ classPropertyName: "ariaLabel",
292
+ publicName: "ariaLabel",
293
+ isSignal: true,
294
+ isRequired: false,
295
+ transformFunction: null
296
+ }
297
+ },
298
+ outputs: {
299
+ value: "valueChange",
300
+ swatchSelect: "swatchSelect",
301
+ opened: "opened",
302
+ closed: "closed"
303
+ },
304
+ host: { properties: { "style.display": "popup() ? 'contents' : 'block'" } },
305
+ viewQueries: [{
306
+ propertyName: "panelEl",
307
+ first: true,
308
+ predicate: ["panel"],
309
+ descendants: true,
310
+ isSignal: true
311
+ }, {
312
+ propertyName: "connectedOverlay",
313
+ first: true,
314
+ predicate: CdkConnectedOverlay,
315
+ descendants: true,
316
+ isSignal: true
317
+ }],
318
+ ngImport: i0,
319
+ template: "<!-- 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",
320
+ styles: [".ui-swatch-picker{display:flex;flex-direction:column;padding:var(--ui-swatch-picker-panel-padding, var(--ui-overlay-panel-padding, var(--units-sm)));box-sizing:border-box;border:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-overlay-stroke, transparent);border-radius:var(--ui-overlay-radius, var(--ui-overlay-panel-radius, var(--radius-default)));background-color:var(--ui-overlay-surface, var(--ui-swatch-picker-panel-surface, var(--global-background-default)));box-shadow:var(--ui-overlay-shadow, var(--ui-overlay-panel-shadow, var(--shadow-default-md)));font-family:var(--ui-overlay-panel-font-family, var(--fontfamily-base));border:none}.ui-swatch-picker._popup{width:max-content;max-width:calc(100vw - var(--units-lg));max-height:calc(100vh - var(--units-lg));overflow:auto}.ui-swatch-picker-grid{display:grid;grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size, 2rem));gap:var(--ui-swatch-picker-gap, var(--units-xs))}.ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size, 2rem);height:var(--ui-swatch-picker-cell-size, 2rem)}.ui-swatch-picker._small .ui-swatch-picker-grid{grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size-small, 1.5rem));gap:var(--ui-swatch-picker-gap-small, var(--units-2xs))}.ui-swatch-picker._small .ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size-small, 1.5rem);height:var(--ui-swatch-picker-cell-size-small, 1.5rem)}.ui-swatch-picker-swatch{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0;border:var(--ui-swatch-picker-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-swatch-picker-swatch-stroke, var(--global-border-default));border-radius:var(--ui-swatch-picker-swatch-radius, var(--radius-xs));background-color:var(--ui-swatch-picker-swatch-color, transparent);cursor:pointer;transition:box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-swatch-picker-swatch:hover:not(:disabled){border-color:var(--ui-swatch-picker-swatch-stroke-hover, var(--global-border-default-hover))}.ui-swatch-picker-swatch:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked))}.ui-swatch-picker-swatch:focus-visible._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked)),0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._clear{background-color:transparent;color:var(--ui-swatch-picker-clear-color, var(--global-text-muted))}.ui-swatch-picker-clear-icon{line-height:0}\n"],
321
+ dependencies: [
322
+ {
323
+ kind: "directive",
324
+ type: NgTemplateOutlet,
325
+ selector: "[ngTemplateOutlet]",
326
+ inputs: [
327
+ "ngTemplateOutletContext",
328
+ "ngTemplateOutlet",
329
+ "ngTemplateOutletInjector"
330
+ ]
331
+ },
332
+ {
333
+ kind: "ngmodule",
334
+ type: OverlayModule
335
+ },
336
+ {
337
+ kind: "directive",
338
+ type: i1.CdkConnectedOverlay,
339
+ selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]",
340
+ inputs: [
341
+ "cdkConnectedOverlayOrigin",
342
+ "cdkConnectedOverlayPositions",
343
+ "cdkConnectedOverlayPositionStrategy",
344
+ "cdkConnectedOverlayOffsetX",
345
+ "cdkConnectedOverlayOffsetY",
346
+ "cdkConnectedOverlayWidth",
347
+ "cdkConnectedOverlayHeight",
348
+ "cdkConnectedOverlayMinWidth",
349
+ "cdkConnectedOverlayMinHeight",
350
+ "cdkConnectedOverlayBackdropClass",
351
+ "cdkConnectedOverlayPanelClass",
352
+ "cdkConnectedOverlayViewportMargin",
353
+ "cdkConnectedOverlayScrollStrategy",
354
+ "cdkConnectedOverlayOpen",
355
+ "cdkConnectedOverlayDisableClose",
356
+ "cdkConnectedOverlayTransformOriginOn",
357
+ "cdkConnectedOverlayHasBackdrop",
358
+ "cdkConnectedOverlayLockPosition",
359
+ "cdkConnectedOverlayFlexibleDimensions",
360
+ "cdkConnectedOverlayGrowAfterOpen",
361
+ "cdkConnectedOverlayPush",
362
+ "cdkConnectedOverlayDisposeOnNavigation",
363
+ "cdkConnectedOverlayUsePopover",
364
+ "cdkConnectedOverlayMatchWidth",
365
+ "cdkConnectedOverlay"
366
+ ],
367
+ outputs: [
368
+ "backdropClick",
369
+ "positionChange",
370
+ "attach",
371
+ "detach",
372
+ "overlayKeydown",
373
+ "overlayOutsideClick"
374
+ ],
375
+ exportAs: ["cdkConnectedOverlay"]
376
+ },
377
+ {
378
+ kind: "component",
379
+ type: UiIcon,
380
+ selector: "ui-icon",
381
+ inputs: [
382
+ "name",
383
+ "size",
384
+ "type",
385
+ "family",
386
+ "decorative",
387
+ "ariaLabel"
388
+ ]
389
+ },
390
+ {
391
+ kind: "directive",
392
+ type: UiMotion,
393
+ selector: "[uiMotion]",
394
+ inputs: [
395
+ "uiMotion",
396
+ "motionDuration",
397
+ "motionDelay",
398
+ "motionEasing",
399
+ "motionEnterEasing",
400
+ "motionLeaveEasing",
401
+ "motionDistance",
402
+ "motionScale",
403
+ "motionDisabled",
404
+ "motionOnInsert"
405
+ ],
406
+ exportAs: ["uiMotion"]
407
+ }
408
+ ]
409
+ });
410
+ }
411
+ };
412
+ i0.ɵɵngDeclareClassMetadata({
413
+ minVersion: "12.0.0",
414
+ version: "22.3.0",
415
+ ngImport: i0,
416
+ type: UiSwatchPicker,
417
+ decorators: [{
418
+ type: Component,
419
+ args: [{
420
+ selector: "ui-swatch-picker",
421
+ imports: [
422
+ NgTemplateOutlet,
423
+ OverlayModule,
424
+ UiIcon,
425
+ UiMotion
426
+ ],
427
+ host: { "[style.display]": "popup() ? 'contents' : 'block'" },
428
+ template: "<!-- 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",
429
+ styles: [".ui-swatch-picker{display:flex;flex-direction:column;padding:var(--ui-swatch-picker-panel-padding, var(--ui-overlay-panel-padding, var(--units-sm)));box-sizing:border-box;border:var(--ui-control-stroke-width, var(--stroke-default)) solid var(--ui-overlay-stroke, transparent);border-radius:var(--ui-overlay-radius, var(--ui-overlay-panel-radius, var(--radius-default)));background-color:var(--ui-overlay-surface, var(--ui-swatch-picker-panel-surface, var(--global-background-default)));box-shadow:var(--ui-overlay-shadow, var(--ui-overlay-panel-shadow, var(--shadow-default-md)));font-family:var(--ui-overlay-panel-font-family, var(--fontfamily-base));border:none}.ui-swatch-picker._popup{width:max-content;max-width:calc(100vw - var(--units-lg));max-height:calc(100vh - var(--units-lg));overflow:auto}.ui-swatch-picker-grid{display:grid;grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size, 2rem));gap:var(--ui-swatch-picker-gap, var(--units-xs))}.ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size, 2rem);height:var(--ui-swatch-picker-cell-size, 2rem)}.ui-swatch-picker._small .ui-swatch-picker-grid{grid-template-columns:repeat(7,var(--ui-swatch-picker-cell-size-small, 1.5rem));gap:var(--ui-swatch-picker-gap-small, var(--units-2xs))}.ui-swatch-picker._small .ui-swatch-picker-grid .ui-swatch-picker-swatch{width:var(--ui-swatch-picker-cell-size-small, 1.5rem);height:var(--ui-swatch-picker-cell-size-small, 1.5rem)}.ui-swatch-picker-swatch{display:flex;align-items:center;justify-content:center;box-sizing:border-box;padding:0;border:var(--ui-swatch-picker-stroke-width, var(--ui-control-stroke-width, var(--stroke-default))) solid var(--ui-swatch-picker-swatch-stroke, var(--global-border-default));border-radius:var(--ui-swatch-picker-swatch-radius, var(--radius-xs));background-color:var(--ui-swatch-picker-swatch-color, transparent);cursor:pointer;transition:box-shadow var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout))),border-color var(--ui-control-transition-duration, var(--motion-hover-duration, var(--transition-default))) var(--ui-control-transition-easing, var(--motion-hover-easing, var(--transition-easeinout)))}.ui-swatch-picker-swatch:hover:not(:disabled){border-color:var(--ui-swatch-picker-swatch-stroke-hover, var(--global-border-default-hover))}.ui-swatch-picker-swatch:focus-visible{outline:none;box-shadow:0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked))}.ui-swatch-picker-swatch:focus-visible._selected{box-shadow:inset 0 0 0 var(--ui-swatch-picker-selected-ring-width, var(--stroke-lg)) var(--ui-swatch-picker-selected-ring-color, var(--form-high-stroke-checked)),0 0 0 var(--ui-swatch-picker-focus-ring-width, var(--ui-focus-ring-width, var(--units-2xs))) var(--ui-swatch-picker-focus-ring-color, var(--global-border-focus))}.ui-swatch-picker-swatch._clear{background-color:transparent;color:var(--ui-swatch-picker-clear-color, var(--global-text-muted))}.ui-swatch-picker-clear-icon{line-height:0}\n"]
430
+ }]
431
+ }],
432
+ ctorParameters: () => [],
433
+ propDecorators: {
434
+ palette: [{
435
+ type: i0.Input,
436
+ args: [{
437
+ isSignal: true,
438
+ alias: "palette",
439
+ required: false
440
+ }]
441
+ }],
442
+ value: [{
443
+ type: i0.Input,
444
+ args: [{
445
+ isSignal: true,
446
+ alias: "value",
447
+ required: false
448
+ }]
449
+ }, {
450
+ type: i0.Output,
451
+ args: ["valueChange"]
452
+ }],
453
+ popup: [{
454
+ type: i0.Input,
455
+ args: [{
456
+ isSignal: true,
457
+ alias: "popup",
458
+ required: false
459
+ }]
460
+ }],
461
+ size: [{
462
+ type: i0.Input,
463
+ args: [{
464
+ isSignal: true,
465
+ alias: "size",
466
+ required: false
467
+ }]
468
+ }],
469
+ allowClear: [{
470
+ type: i0.Input,
471
+ args: [{
472
+ isSignal: true,
473
+ alias: "allowClear",
474
+ required: false
475
+ }]
476
+ }],
477
+ ariaLabel: [{
478
+ type: i0.Input,
479
+ args: [{
480
+ isSignal: true,
481
+ alias: "ariaLabel",
482
+ required: false
483
+ }]
484
+ }],
485
+ swatchSelect: [{
486
+ type: i0.Output,
487
+ args: ["swatchSelect"]
488
+ }],
489
+ opened: [{
490
+ type: i0.Output,
491
+ args: ["opened"]
492
+ }],
493
+ closed: [{
494
+ type: i0.Output,
495
+ args: ["closed"]
496
+ }],
497
+ panelEl: [{
498
+ type: i0.ViewChild,
499
+ args: ["panel", { isSignal: true }]
500
+ }],
501
+ connectedOverlay: [{
502
+ type: i0.ViewChild,
503
+ args: [i0.forwardRef(() => CdkConnectedOverlay), { isSignal: true }]
504
+ }]
505
+ }
506
+ });
316
507
  export { DEFAULT_SWATCH_PALETTE, UiSwatchPicker };
317
- //# sourceMappingURL=4sh-ui-kit-forms-ui-swatch-picker.mjs.map
508
+
509
+ //# sourceMappingURL=4sh-ui-kit-forms-ui-swatch-picker.mjs.map