@helixui/library 3.3.1-next.115 → 3.3.1-next.117

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 (129) hide show
  1. package/custom-elements.json +182 -13
  2. package/dist/components/hx-accordion/hx-accordion-item.d.ts +35 -0
  3. package/dist/components/hx-accordion/hx-accordion-item.d.ts.map +1 -1
  4. package/dist/components/hx-checkbox/hx-checkbox.d.ts +153 -1
  5. package/dist/components/hx-checkbox/hx-checkbox.d.ts.map +1 -1
  6. package/dist/components/hx-checkbox/hx-checkbox.styles.d.ts.map +1 -1
  7. package/dist/components/hx-checkbox/index.js +1 -1
  8. package/dist/components/hx-checkbox-group/hx-checkbox-group.d.ts +151 -2
  9. package/dist/components/hx-checkbox-group/hx-checkbox-group.d.ts.map +1 -1
  10. package/dist/components/hx-checkbox-group/index.js +1 -1
  11. package/dist/components/hx-color-picker/hx-color-picker.d.ts +163 -1
  12. package/dist/components/hx-color-picker/hx-color-picker.d.ts.map +1 -1
  13. package/dist/components/hx-color-picker/hx-color-picker.styles.d.ts.map +1 -1
  14. package/dist/components/hx-color-picker/index.js +1 -1
  15. package/dist/components/hx-combobox/hx-combobox.d.ts +311 -2
  16. package/dist/components/hx-combobox/hx-combobox.d.ts.map +1 -1
  17. package/dist/components/hx-combobox/index.js +1 -1
  18. package/dist/components/hx-date-picker/hx-date-picker.d.ts +182 -56
  19. package/dist/components/hx-date-picker/hx-date-picker.d.ts.map +1 -1
  20. package/dist/components/hx-date-picker/hx-date-picker.styles.d.ts.map +1 -1
  21. package/dist/components/hx-date-picker/index.js +1 -1
  22. package/dist/components/hx-dialog/hx-dialog.d.ts +240 -0
  23. package/dist/components/hx-dialog/hx-dialog.d.ts.map +1 -1
  24. package/dist/components/hx-dialog/index.js +1 -1
  25. package/dist/components/hx-dropdown/hx-dropdown.d.ts +80 -0
  26. package/dist/components/hx-dropdown/hx-dropdown.d.ts.map +1 -1
  27. package/dist/components/hx-dropdown/index.js +1 -1
  28. package/dist/components/hx-field/hx-field.d.ts +109 -0
  29. package/dist/components/hx-field/hx-field.d.ts.map +1 -1
  30. package/dist/components/hx-field/index.js +1 -1
  31. package/dist/components/hx-popover/hx-popover.d.ts +91 -0
  32. package/dist/components/hx-popover/hx-popover.d.ts.map +1 -1
  33. package/dist/components/hx-popover/index.js +1 -1
  34. package/dist/components/hx-radio-group/hx-radio-group.d.ts +152 -1
  35. package/dist/components/hx-radio-group/hx-radio-group.d.ts.map +1 -1
  36. package/dist/components/hx-radio-group/hx-radio.d.ts +14 -0
  37. package/dist/components/hx-radio-group/hx-radio.d.ts.map +1 -1
  38. package/dist/components/hx-radio-group/index.js +1 -1
  39. package/dist/components/hx-select/hx-select.d.ts +303 -2
  40. package/dist/components/hx-select/hx-select.d.ts.map +1 -1
  41. package/dist/components/hx-select/hx-select.styles.d.ts.map +1 -1
  42. package/dist/components/hx-select/index.js +1 -1
  43. package/dist/components/hx-side-nav/hx-nav-item.styles.d.ts.map +1 -1
  44. package/dist/components/hx-side-nav/index.js +1 -1
  45. package/dist/components/hx-switch/hx-switch.d.ts +78 -1
  46. package/dist/components/hx-switch/hx-switch.d.ts.map +1 -1
  47. package/dist/components/hx-switch/hx-switch.styles.d.ts.map +1 -1
  48. package/dist/components/hx-switch/index.js +1 -1
  49. package/dist/components/hx-toggle-button/hx-toggle-button.d.ts +110 -0
  50. package/dist/components/hx-toggle-button/hx-toggle-button.d.ts.map +1 -1
  51. package/dist/components/hx-toggle-button/hx-toggle-button.styles.d.ts.map +1 -1
  52. package/dist/components/hx-toggle-button/index.js +1 -1
  53. package/dist/components/hx-tooltip/hx-tooltip.d.ts +52 -0
  54. package/dist/components/hx-tooltip/hx-tooltip.d.ts.map +1 -1
  55. package/dist/components/hx-tooltip/index.js +1 -1
  56. package/dist/css/helix-all.css +98 -1
  57. package/dist/css/helix-forms.css +98 -1
  58. package/dist/css/hx-checkbox.css +18 -0
  59. package/dist/css/hx-color-picker.css +25 -0
  60. package/dist/css/hx-date-picker.css +2 -1
  61. package/dist/css/hx-select.css +19 -0
  62. package/dist/css/hx-switch.css +17 -0
  63. package/dist/css/hx-toggle-button.css +17 -0
  64. package/dist/css/index.css +1 -1
  65. package/dist/css/manifest.json +2 -1
  66. package/dist/index.js +15 -15
  67. package/dist/shared/aria-flatten-DY6v2vah.js +22 -0
  68. package/dist/shared/aria-flatten-DY6v2vah.js.map +1 -0
  69. package/dist/shared/aria-idref-Q0yiSR3p.js +104 -0
  70. package/dist/shared/aria-idref-Q0yiSR3p.js.map +1 -0
  71. package/dist/shared/hx-accordion-ZVzgDzTG.js.map +1 -1
  72. package/dist/shared/hx-checkbox-BdgoUeWi.js +696 -0
  73. package/dist/shared/hx-checkbox-BdgoUeWi.js.map +1 -0
  74. package/dist/shared/hx-checkbox-group-LWezHrvS.js +496 -0
  75. package/dist/shared/hx-checkbox-group-LWezHrvS.js.map +1 -0
  76. package/dist/shared/hx-color-picker-DVhZl88b.js +1221 -0
  77. package/dist/shared/hx-color-picker-DVhZl88b.js.map +1 -0
  78. package/dist/shared/hx-combobox-DvlezcDV.js +1359 -0
  79. package/dist/shared/hx-combobox-DvlezcDV.js.map +1 -0
  80. package/dist/shared/{hx-date-picker-2iRG1p74.js → hx-date-picker-N-0aG5XL.js} +542 -206
  81. package/dist/shared/hx-date-picker-N-0aG5XL.js.map +1 -0
  82. package/dist/shared/hx-dialog-DzB7VytW.js +717 -0
  83. package/dist/shared/hx-dialog-DzB7VytW.js.map +1 -0
  84. package/dist/shared/{hx-dropdown-LyaRc8Rf.js → hx-dropdown-DJWlF94E.js} +130 -77
  85. package/dist/shared/hx-dropdown-DJWlF94E.js.map +1 -0
  86. package/dist/shared/{hx-field-B3Qo8OLS.js → hx-field-zw0U1KVi.js} +99 -38
  87. package/dist/shared/hx-field-zw0U1KVi.js.map +1 -0
  88. package/dist/shared/{hx-nav-item-xqRPOCWX.js → hx-nav-item-CODtUlew.js} +13 -9
  89. package/dist/shared/{hx-nav-item-xqRPOCWX.js.map → hx-nav-item-CODtUlew.js.map} +1 -1
  90. package/dist/shared/{hx-popover-B-FP3-wW.js → hx-popover-CHxWY_cd.js} +123 -66
  91. package/dist/shared/hx-popover-CHxWY_cd.js.map +1 -0
  92. package/dist/shared/hx-radio-CeGzARNk.js +822 -0
  93. package/dist/shared/hx-radio-CeGzARNk.js.map +1 -0
  94. package/dist/shared/hx-select-DrcS-YRJ.js +1089 -0
  95. package/dist/shared/hx-select-DrcS-YRJ.js.map +1 -0
  96. package/dist/shared/hx-switch-BX_8uNUs.js +540 -0
  97. package/dist/shared/hx-switch-BX_8uNUs.js.map +1 -0
  98. package/dist/shared/{hx-toggle-button-iLiYrMbD.js → hx-toggle-button-Dcz9IlUm.js} +226 -65
  99. package/dist/shared/hx-toggle-button-Dcz9IlUm.js.map +1 -0
  100. package/dist/shared/{hx-tooltip-nYOv9OLu.js → hx-tooltip-DVqtKPCD.js} +68 -46
  101. package/dist/shared/hx-tooltip-DVqtKPCD.js.map +1 -0
  102. package/dist/utils/aria-flatten.d.ts +56 -0
  103. package/dist/utils/aria-flatten.d.ts.map +1 -0
  104. package/dist/utils/aria-idref.d.ts +127 -0
  105. package/dist/utils/aria-idref.d.ts.map +1 -0
  106. package/figma-inventory.json +64 -1
  107. package/package.json +2 -2
  108. package/dist/shared/hx-checkbox-D7xma9YH.js +0 -524
  109. package/dist/shared/hx-checkbox-D7xma9YH.js.map +0 -1
  110. package/dist/shared/hx-checkbox-group-C9n315Ju.js +0 -323
  111. package/dist/shared/hx-checkbox-group-C9n315Ju.js.map +0 -1
  112. package/dist/shared/hx-color-picker-uRc865FJ.js +0 -882
  113. package/dist/shared/hx-color-picker-uRc865FJ.js.map +0 -1
  114. package/dist/shared/hx-combobox-DDzqNKEW.js +0 -924
  115. package/dist/shared/hx-combobox-DDzqNKEW.js.map +0 -1
  116. package/dist/shared/hx-date-picker-2iRG1p74.js.map +0 -1
  117. package/dist/shared/hx-dialog-DRN_1-Y-.js +0 -514
  118. package/dist/shared/hx-dialog-DRN_1-Y-.js.map +0 -1
  119. package/dist/shared/hx-dropdown-LyaRc8Rf.js.map +0 -1
  120. package/dist/shared/hx-field-B3Qo8OLS.js.map +0 -1
  121. package/dist/shared/hx-popover-B-FP3-wW.js.map +0 -1
  122. package/dist/shared/hx-radio-CJvNU2yP.js +0 -621
  123. package/dist/shared/hx-radio-CJvNU2yP.js.map +0 -1
  124. package/dist/shared/hx-select-C8fEHQhC.js +0 -807
  125. package/dist/shared/hx-select-C8fEHQhC.js.map +0 -1
  126. package/dist/shared/hx-switch-BrZFaRue.js +0 -420
  127. package/dist/shared/hx-switch-BrZFaRue.js.map +0 -1
  128. package/dist/shared/hx-toggle-button-iLiYrMbD.js.map +0 -1
  129. package/dist/shared/hx-tooltip-nYOv9OLu.js.map +0 -1
@@ -0,0 +1,696 @@
1
+ import { css as z, nothing as k, html as g } from "lit";
2
+ import { property as c, query as S, state as b, customElement as T } from "lit/decorators.js";
3
+ import { classMap as E } from "lit/directives/class-map.js";
4
+ import { ifDefined as d } from "lit/directives/if-defined.js";
5
+ import { live as y } from "lit/directives/live.js";
6
+ import { F as H } from "./FormMixin-B8PXk5RQ.js";
7
+ import { b as $ } from "./forced-colors-CTEDFRGa.js";
8
+ import { s as A, i as B, r as I } from "./aria-idref-Q0yiSR3p.js";
9
+ import { m as D } from "./aria-delegation-Doq6RRUy.js";
10
+ import { c as R } from "./id-counter-DuX8vsui.js";
11
+ import { H as q } from "./helix-element-BNEYeiys.js";
12
+ const F = z`
13
+ :host {
14
+ display: block;
15
+ }
16
+
17
+ :host([disabled]) {
18
+ opacity: var(--hx-opacity-disabled, 0.5);
19
+ pointer-events: none;
20
+ }
21
+
22
+ * {
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ .checkbox {
27
+ display: flex;
28
+ flex-direction: column;
29
+ gap: var(--hx-space-1, 0.25rem);
30
+ font-family: var(--hx-checkbox-font-family, var(--hx-font-family-sans, sans-serif));
31
+ }
32
+
33
+ /* ─── Control (checkbox + label row) ─── */
34
+
35
+ .checkbox__control {
36
+ display: inline-flex;
37
+ align-items: flex-start;
38
+ gap: var(--hx-space-2, 0.5rem);
39
+ /* WCAG 2.5.5 (healthcare mandate): minimum 44px touch target height */
40
+ min-height: var(--hx-touch-target-min, 2.75rem);
41
+ cursor: pointer;
42
+ }
43
+
44
+ :host([disabled]) .checkbox__control {
45
+ cursor: not-allowed;
46
+ }
47
+
48
+ /* ─── Hidden Native Input ─── */
49
+
50
+ .checkbox__input {
51
+ position: absolute;
52
+ width: 1px;
53
+ height: 1px;
54
+ padding: 0;
55
+ margin: -1px;
56
+ overflow: hidden;
57
+ clip-path: inset(50%);
58
+ white-space: nowrap;
59
+ border: 0;
60
+ }
61
+
62
+ /* ─── Visual Checkbox ─── */
63
+
64
+ .checkbox__box {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ justify-content: center;
68
+ flex-shrink: 0;
69
+ width: var(--hx-checkbox-size, var(--hx-size-5, 1.25rem));
70
+ height: var(--hx-checkbox-size, var(--hx-size-5, 1.25rem));
71
+ border: var(--hx-border-width-medium, 2px) solid
72
+ var(--hx-checkbox-border-color, var(--hx-color-border-strong, #66787b));
73
+ border-radius: var(--hx-checkbox-border-radius, var(--hx-border-radius-sm, 0.25rem));
74
+ background-color: var(--hx-checkbox-bg, var(--hx-color-surface-default, #ffffff));
75
+ transition:
76
+ background-color var(--hx-transition-fast, 150ms ease),
77
+ border-color var(--hx-transition-fast, 150ms ease),
78
+ box-shadow var(--hx-transition-fast, 150ms ease);
79
+ margin-top: var(--hx-space-px, 1px);
80
+ }
81
+
82
+ /* ─── Focus Ring ─── */
83
+
84
+ /*
85
+ * Host-focus path: on the modern (IDL element-references) render branch the
86
+ * host is the tabbable surface (tabindex=0) and the inner input is demoted
87
+ * to tabindex=-1. Drive the focus ring from ':host(:focus-visible)' so
88
+ * keyboard users still get a visible affordance. Codex round-11 P1.
89
+ */
90
+ :host(:focus-visible) .checkbox__box {
91
+ outline: var(--hx-checkbox-focus-ring-width, var(--hx-focus-ring-width, 2px)) solid
92
+ var(--hx-checkbox-focus-ring-color, var(--hx-focus-ring-color, #0f7078));
93
+ outline-offset: var(--hx-checkbox-focus-ring-offset, var(--hx-focus-ring-offset, 2px));
94
+ }
95
+
96
+ /*
97
+ * Fallback (no-IDL-ref) path: the host carries tabindex=-1 and the inner
98
+ * input is the tab target. The native :focus-visible on the input drives
99
+ * the same visual ring, scoped via the inner-state class.
100
+ */
101
+ .checkbox__input:focus-visible ~ .checkbox__box {
102
+ outline: var(--hx-checkbox-focus-ring-width, var(--hx-focus-ring-width, 2px)) solid
103
+ var(--hx-checkbox-focus-ring-color, var(--hx-focus-ring-color, #0f7078));
104
+ outline-offset: var(--hx-checkbox-focus-ring-offset, var(--hx-focus-ring-offset, 2px));
105
+ }
106
+
107
+ /* ─── Checked State ─── */
108
+
109
+ .checkbox--checked .checkbox__box {
110
+ background-color: var(--hx-checkbox-checked-bg, var(--hx-color-primary-500, #429797));
111
+ border-color: var(--hx-checkbox-checked-border-color, var(--hx-color-primary-500, #429797));
112
+ }
113
+
114
+ /* ─── Indeterminate State ─── */
115
+
116
+ .checkbox--indeterminate .checkbox__box {
117
+ background-color: var(--hx-checkbox-checked-bg, var(--hx-color-primary-500, #429797));
118
+ border-color: var(--hx-checkbox-checked-border-color, var(--hx-color-primary-500, #429797));
119
+ }
120
+
121
+ /* ─── Error State ─── */
122
+
123
+ .checkbox--error .checkbox__box {
124
+ border-color: var(--hx-checkbox-error-color, var(--hx-color-error-500, #e5493e));
125
+ }
126
+
127
+ .checkbox--error.checkbox--checked .checkbox__box,
128
+ .checkbox--error.checkbox--indeterminate .checkbox__box {
129
+ background-color: var(--hx-checkbox-error-color, var(--hx-color-error-500, #e5493e));
130
+ border-color: var(--hx-checkbox-error-color, var(--hx-color-error-500, #e5493e));
131
+ }
132
+
133
+ /* ─── Hover ─── */
134
+
135
+ /* P1-03: use component token so consumer overrides of --hx-checkbox-border-color work on hover */
136
+ .checkbox__control:hover .checkbox__box {
137
+ border-color: var(
138
+ --hx-checkbox-hover-border-color,
139
+ var(--hx-checkbox-border-color, var(--hx-color-primary-500, #429797))
140
+ );
141
+ }
142
+
143
+ .checkbox--checked .checkbox__control:hover .checkbox__box {
144
+ filter: brightness(var(--hx-filter-brightness-hover, 0.9));
145
+ }
146
+
147
+ .checkbox--error .checkbox__control:hover .checkbox__box {
148
+ border-color: var(--hx-checkbox-error-color, var(--hx-color-error-500, #e5493e));
149
+ }
150
+
151
+ /* ─── Checkmark Icon ─── */
152
+
153
+ .checkbox__icon {
154
+ display: none;
155
+ width: calc(var(--hx-checkbox-size, var(--hx-size-5, 1.25rem)) * 0.65);
156
+ height: calc(var(--hx-checkbox-size, var(--hx-size-5, 1.25rem)) * 0.65);
157
+ fill: none;
158
+ stroke: var(--hx-checkbox-checkmark-color, var(--hx-color-text-on-primary, #ffffff));
159
+ stroke-width: 2.5;
160
+ stroke-linecap: round;
161
+ stroke-linejoin: round;
162
+ }
163
+
164
+ .checkbox--checked .checkbox__icon--check {
165
+ display: block;
166
+ }
167
+
168
+ .checkbox--indeterminate .checkbox__icon--indeterminate {
169
+ display: block;
170
+ }
171
+
172
+ /* ─── Label ─── */
173
+
174
+ .checkbox__label {
175
+ font-size: var(--hx-font-size-sm, 0.875rem);
176
+ font-weight: var(--hx-font-weight-medium, 500);
177
+ color: var(--hx-checkbox-label-color, var(--hx-color-text-strong, #202b39));
178
+ line-height: var(--hx-line-height-normal, 1.5);
179
+ user-select: none;
180
+ -webkit-user-select: none;
181
+ }
182
+
183
+ .checkbox__required-marker {
184
+ color: var(--hx-checkbox-error-color, var(--hx-color-error-text, #c92a2a));
185
+ font-weight: var(--hx-font-weight-bold, 700);
186
+ }
187
+
188
+ /* ─── Help Text & Error Messages ─── */
189
+
190
+ .checkbox__help-text {
191
+ font-size: var(--hx-font-size-xs, 0.75rem);
192
+ color: var(--hx-checkbox-help-text-color, var(--hx-color-text-muted, #4a5362));
193
+ line-height: var(--hx-line-height-normal, 1.5);
194
+ padding-inline-start: calc(
195
+ var(--hx-checkbox-size, var(--hx-size-5, 1.25rem)) + var(--hx-space-2, 0.5rem)
196
+ );
197
+ }
198
+
199
+ .checkbox__error {
200
+ font-size: var(--hx-font-size-xs, 0.75rem);
201
+ color: var(--hx-checkbox-error-color, var(--hx-color-error-text, #c92a2a));
202
+ line-height: var(--hx-line-height-normal, 1.5);
203
+ padding-inline-start: calc(
204
+ var(--hx-checkbox-size, var(--hx-size-5, 1.25rem)) + var(--hx-space-2, 0.5rem)
205
+ );
206
+ }
207
+
208
+ /* ─── Size Variants ─── */
209
+
210
+ :host([hx-size='sm']) {
211
+ --hx-checkbox-size: var(--hx-size-4, 1rem);
212
+ }
213
+
214
+ :host([hx-size='sm']) .checkbox__label {
215
+ font-size: var(--hx-font-size-xs, 0.75rem);
216
+ }
217
+
218
+ :host([hx-size='sm']) .checkbox__help-text,
219
+ :host([hx-size='sm']) .checkbox__error {
220
+ font-size: var(--hx-font-size-xs, 0.75rem);
221
+ padding-inline-start: calc(var(--hx-size-4, 1rem) + var(--hx-space-2, 0.5rem));
222
+ }
223
+
224
+ :host([hx-size='lg']) {
225
+ --hx-checkbox-size: var(--hx-size-6, 1.5rem);
226
+ }
227
+
228
+ :host([hx-size='lg']) .checkbox__label {
229
+ font-size: var(--hx-font-size-md, 1rem);
230
+ }
231
+
232
+ :host([hx-size='lg']) .checkbox__help-text,
233
+ :host([hx-size='lg']) .checkbox__error {
234
+ font-size: var(--hx-font-size-sm, 0.875rem);
235
+ padding-inline-start: calc(var(--hx-size-6, 1.5rem) + var(--hx-space-2, 0.5rem));
236
+ }
237
+
238
+ /* ─── Reduced Motion ─── */
239
+
240
+ @media (prefers-reduced-motion: reduce) {
241
+ .checkbox__box {
242
+ transition: none;
243
+ }
244
+ }
245
+
246
+ /* ─── High Contrast Mode (forced-colors) ─── */
247
+
248
+ @media (forced-colors: active) {
249
+ .checkbox__box {
250
+ forced-color-adjust: none;
251
+ background-color: ButtonFace;
252
+ border: 2px solid ButtonText;
253
+ }
254
+
255
+ :host(:focus-visible) .checkbox__box,
256
+ .checkbox__input:focus-visible ~ .checkbox__box {
257
+ outline: 3px solid Highlight;
258
+ outline-offset: 2px;
259
+ }
260
+
261
+ .checkbox--checked .checkbox__box,
262
+ .checkbox--indeterminate .checkbox__box {
263
+ background-color: Highlight;
264
+ border-color: Highlight;
265
+ }
266
+
267
+ .checkbox__icon {
268
+ stroke: HighlightText;
269
+ }
270
+
271
+ .checkbox--error .checkbox__box {
272
+ border-color: LinkText;
273
+ }
274
+
275
+ .checkbox--error.checkbox--checked .checkbox__box,
276
+ .checkbox--error.checkbox--indeterminate .checkbox__box {
277
+ background-color: LinkText;
278
+ border-color: LinkText;
279
+ }
280
+
281
+ :host([disabled]) {
282
+ opacity: 1;
283
+ }
284
+
285
+ :host([disabled]) .checkbox__box {
286
+ border-color: GrayText;
287
+ background-color: ButtonFace;
288
+ }
289
+
290
+ :host([disabled]) .checkbox--checked .checkbox__box,
291
+ :host([disabled]) .checkbox--indeterminate .checkbox__box {
292
+ background-color: GrayText;
293
+ border-color: GrayText;
294
+ }
295
+
296
+ :host([disabled]) .checkbox__label {
297
+ color: GrayText;
298
+ }
299
+
300
+ .checkbox__label {
301
+ color: CanvasText;
302
+ }
303
+
304
+ .checkbox__help-text {
305
+ color: GrayText;
306
+ }
307
+
308
+ .checkbox__error {
309
+ color: LinkText;
310
+ }
311
+ }
312
+ `;
313
+ var M = Object.defineProperty, V = Object.getOwnPropertyDescriptor, o = (e, r, l, h) => {
314
+ for (var s = h > 1 ? void 0 : h ? V(r, l) : r, i = e.length - 1, a; i >= 0; i--)
315
+ (a = e[i]) && (s = (h ? a(r, l, s) : a(s)) || s);
316
+ return h && s && M(r, l, s), s;
317
+ };
318
+ const j = R("hx-checkbox");
319
+ let t = class extends D(H(q)) {
320
+ constructor() {
321
+ super(...arguments), this.checked = !1, this.indeterminate = !1, this.disabled = !1, this.required = !1, this.name = "", this.value = "on", this.label = "", this.error = "", this.helpText = "", this.requiredMessage = "This field is required.", this.size = "md", this.accessibleLabel = "", this._hasErrorSlot = !1, this._hasHelpTextSlot = !1, this._hasLabelSlot = !1, this.__groupedSuppress = !1, this._announcedError = "", this._hasWarnedLabelConflict = !1, this._ariaMirror = null, this._handleHostKeyDown = (e) => {
322
+ this.disabled || this._supportsIdrefRefs && e.target === this && e.key === " " && (e.preventDefault(), this._handleChange());
323
+ }, this._handleHostClick = (e) => {
324
+ this.disabled || !this._supportsIdrefRefs || e.composedPath()[0] !== this || this._handleChange();
325
+ }, this._handleInternalChange = (e) => {
326
+ if (e.stopPropagation(), this.disabled) return;
327
+ const r = e.currentTarget;
328
+ this.indeterminate = !1, this.checked = r.checked, this._updateFormValue(), this._handleInteractionInput(), this.dispatchEvent(
329
+ new CustomEvent("hx-change", {
330
+ bubbles: !0,
331
+ composed: !0,
332
+ detail: { checked: this.checked, value: this.value }
333
+ })
334
+ );
335
+ }, this._suppressInnerClick = (e) => {
336
+ e.preventDefault(), e.stopPropagation();
337
+ }, this._suppressInnerChange = (e) => {
338
+ e.stopPropagation();
339
+ }, this._fallbackAriaLabelledBy = null, this._fallbackAriaDescribedBy = null, this._supportsIdrefRefs = !0, this._internalTabindexManaged = !1, this._id = j(), this._helpTextId = `${this._id}-help`, this._errorId = `${this._id}-error`, this._labelId = `${this._id}-label`;
340
+ }
341
+ /**
342
+ * Returns the effective label for the checkbox, checking accessible-label first,
343
+ * then the aria-label attribute, falling back to empty string.
344
+ * @internal
345
+ */
346
+ get _effectiveLabel() {
347
+ var e, r;
348
+ return ((e = this.accessibleLabel) == null ? void 0 : e.trim()) || ((r = this.ariaLabel) == null ? void 0 : r.trim()) || "";
349
+ }
350
+ /**
351
+ * Set by `hx-checkbox-group` to mark this child as group-managed. While
352
+ * truthy, `_updateFormValue()` short-circuits to `setFormValue(null)`
353
+ * regardless of `name`, so the child does NOT participate in form submission
354
+ * — only the group does. This is durable against post-attach mutations to
355
+ * `cb.name` by consumers/frameworks (which would otherwise re-arm
356
+ * `_updateFormValue()` via the `name` setter and cause double-submission).
357
+ * Codex round-3 finding #1.
358
+ *
359
+ * Public via accessor for the group's exclusive use; the underscore prefix
360
+ * marks it as group-internal (not consumer API). The group sets it during
361
+ * `slotchange` and clears it (via the same setter) when a child is removed.
362
+ * @internal
363
+ */
364
+ set _groupedSuppress(e) {
365
+ this.__groupedSuppress !== e && (this.__groupedSuppress = e, this._updateFormValue());
366
+ }
367
+ get _groupedSuppress() {
368
+ return this.__groupedSuppress;
369
+ }
370
+ // ─── Slot Handlers ───
371
+ /** @internal */
372
+ _handleErrorSlotChange(e) {
373
+ const r = e.target;
374
+ this._hasErrorSlot = r.assignedNodes({ flatten: !0 }).length > 0;
375
+ }
376
+ /** @internal */
377
+ _handleHelpTextSlotChange(e) {
378
+ const r = e.target;
379
+ this._hasHelpTextSlot = r.assignedNodes({ flatten: !0 }).length > 0;
380
+ }
381
+ /** @internal */
382
+ _handleLabelSlotChange(e) {
383
+ const r = e.target;
384
+ this._hasLabelSlot = r.assignedNodes().length > 0;
385
+ }
386
+ // ─── Lifecycle ───
387
+ connectedCallback() {
388
+ if (super.connectedCallback(), this._supportsIdrefRefs = A(this._internals), this._syncHostAriaSemantics(), !this.hasAttribute("tabindex")) {
389
+ this._internalTabindexManaged = !0;
390
+ const e = this._supportsIdrefRefs ? "0" : "-1";
391
+ this.setAttribute("tabindex", this.disabled ? "-1" : e);
392
+ }
393
+ this.addEventListener("keydown", this._handleHostKeyDown), this.addEventListener("click", this._handleHostClick), this._ariaMirror = B(this, () => {
394
+ this._syncHostAriaSemantics();
395
+ });
396
+ }
397
+ disconnectedCallback() {
398
+ var e;
399
+ super.disconnectedCallback(), this.removeEventListener("keydown", this._handleHostKeyDown), this.removeEventListener("click", this._handleHostClick), (e = this._ariaMirror) == null || e.disconnect(), this._ariaMirror = null;
400
+ }
401
+ updated(e) {
402
+ var r, l, h, s;
403
+ super.updated(e), (e.has("checked") || e.has("value") || e.has("name")) && this._updateFormValue(), (e.has("disabled") || e.has("_supportsIdrefRefs")) && this._internalTabindexManaged && (this.disabled ? this.setAttribute("tabindex", "-1") : this.setAttribute("tabindex", this._supportsIdrefRefs ? "0" : "-1")), this._syncHostAriaSemantics();
404
+ {
405
+ const i = !!((r = this.accessibleLabel) != null && r.trim() || (l = this.ariaLabel) != null && l.trim()), a = !!this.label || (((s = (h = this.shadowRoot) == null ? void 0 : h.querySelector(".checkbox__label slot")) == null ? void 0 : s.assignedNodes({ flatten: !0 }).length) ?? 0) > 0;
406
+ i && a && !this._hasWarnedLabelConflict ? this._hasWarnedLabelConflict = !0 : (!i || !a) && (this._hasWarnedLabelConflict = !1);
407
+ }
408
+ e.has("error") && (e.get("error") && this.error ? (this._announcedError = "", requestAnimationFrame(() => {
409
+ this._announcedError = this.error;
410
+ })) : this._announcedError = this.error);
411
+ }
412
+ // ─── Form Integration ───
413
+ /** Returns the associated form element, if any. */
414
+ get form() {
415
+ return this._internals.form;
416
+ }
417
+ /** Returns the validation message. */
418
+ get validationMessage() {
419
+ return this._internals.validationMessage;
420
+ }
421
+ /** Returns the ValidityState object. */
422
+ get validity() {
423
+ return this._internals.validity;
424
+ }
425
+ /** @internal */
426
+ _updateValidity() {
427
+ if (this.required && !this.checked) {
428
+ const e = this._supportsIdrefRefs ? this : this._inputEl ?? void 0;
429
+ this._internals.setValidity(
430
+ { valueMissing: !0 },
431
+ this.error || this.requiredMessage,
432
+ e
433
+ );
434
+ } else
435
+ this._internals.setValidity({});
436
+ this._syncHostAriaSemantics();
437
+ }
438
+ // ─── Form Lifecycle Hooks ───
439
+ _onFormReset() {
440
+ this.checked = !1, this.indeterminate = !1, this._internals.setFormValue(null), this._resetInteractionState();
441
+ }
442
+ _onFormStateRestore(e, r) {
443
+ this.checked = typeof e == "string" && e === this.value;
444
+ }
445
+ _onFormDisabled(e) {
446
+ this.disabled = e;
447
+ }
448
+ // ─── Event Handling ───
449
+ /**
450
+ * Writes the checkbox value to ElementInternals' form value. Suppressed when
451
+ * the checkbox is grouped — `hx-checkbox-group` flips `_groupedSuppress` on
452
+ * children so the group is the sole form participant.
453
+ *
454
+ * Codex round-3 finding #1: round-2 used `cb.name = ''` as the suppression
455
+ * signal, but a consumer (or framework binding) that re-set `cb.name = 'foo'`
456
+ * after attach regained form participation through the `name` setter. The
457
+ * `_groupedSuppress` flag is a durable, name-independent kill switch.
458
+ * Stand-alone checkboxes (no parent group) are unaffected.
459
+ * @internal
460
+ */
461
+ _updateFormValue() {
462
+ if (this.__groupedSuppress || !this.name) {
463
+ this._internals.setFormValue(null);
464
+ return;
465
+ }
466
+ this._internals.setFormValue(this.checked ? this.value : null);
467
+ }
468
+ /** @internal */
469
+ _handleChange() {
470
+ this.disabled || (this.indeterminate = !1, this.checked = !this.checked, this._updateFormValue(), this._handleInteractionInput(), this.dispatchEvent(
471
+ new CustomEvent("hx-change", {
472
+ bubbles: !0,
473
+ composed: !0,
474
+ detail: { checked: this.checked, value: this.value }
475
+ })
476
+ ), this._supportsIdrefRefs && this.focus());
477
+ }
478
+ /** @internal */
479
+ _handleKeyDown(e) {
480
+ e.key === " " && (e.preventDefault(), e.stopPropagation(), this._handleChange());
481
+ }
482
+ // ─── Public Methods ───
483
+ /**
484
+ * Moves focus to the announced checkbox surface. Codex round-1 finding #1
485
+ * relocated the focus target from the inner `<input>` to the host on
486
+ * modern engines so AT only sees one announced widget. Round-7 finding #3
487
+ * extends that contract to the no-IDL-ref fallback: when the host is
488
+ * demoted (`tabindex=-1`, role/state cleared on `internals`) the inner
489
+ * `<input>` owns the announced semantics and tab order, so programmatic
490
+ * `focus()` must redirect there — otherwise scripted focus and error
491
+ * recovery land on the demoted host on unsupported engines.
492
+ */
493
+ focus(e) {
494
+ var r;
495
+ if (this._supportsIdrefRefs) {
496
+ super.focus(e);
497
+ return;
498
+ }
499
+ (r = this._inputEl) == null || r.focus(e);
500
+ }
501
+ // ─── Host ARIA Semantics (ElementInternals) ───
502
+ /**
503
+ * Mirrors checkbox semantics onto the host via ElementInternals so that
504
+ * consumer-supplied `aria-label`, `aria-labelledby`, and `aria-describedby`
505
+ * on `<hx-checkbox>` reach the announced control. Without this, those
506
+ * attributes — intercepted by `mixinDelegatesAria` and stored on the host —
507
+ * would not propagate through to the inner shadow `<input>`.
508
+ *
509
+ * Codex finding (aria-delegation, severity high): the announced semantic
510
+ * node was the inner `<input>` and the host's labelled-by tokens could not
511
+ * cross the shadow boundary.
512
+ * @internal
513
+ */
514
+ _syncHostAriaSemantics() {
515
+ var l, h, s;
516
+ const e = this._internals, r = this._effectiveLabel;
517
+ if (this._supportsIdrefRefs) {
518
+ e.role = "checkbox", e.ariaChecked = this.indeterminate ? "mixed" : this.checked ? "true" : "false", e.ariaRequired = this.required ? "true" : "false", e.ariaInvalid = e.validity.valid ? "false" : "true", e.ariaDisabled = this.disabled ? "true" : "false", e.ariaLabel = r || null;
519
+ const i = e, a = this.getAttribute("data-aria-labelledby"), m = this.getAttribute("data-aria-describedby"), x = I(this, a), p = (l = this.shadowRoot) == null ? void 0 : l.getElementById(this._labelId), v = !!this.label || this._hasLabelSlot;
520
+ x.length === 0 && !r && v && p && x.push(p), i.ariaLabelledByElements = x.length > 0 ? x : null;
521
+ const u = I(this, m), n = (h = this.shadowRoot) == null ? void 0 : h.getElementById(this._helpTextId), _ = (s = this.shadowRoot) == null ? void 0 : s.getElementById(this._errorId), f = !!(this.error || this._hasErrorSlot);
522
+ n && (this.helpText || this._hasHelpTextSlot) && !f && u.push(n), _ && f && u.push(_), i.ariaDescribedByElements = u.length > 0 ? u : null, this._fallbackAriaLabelledBy = null, this._fallbackAriaDescribedBy = null;
523
+ } else {
524
+ e.role = null, e.ariaChecked = null, e.ariaRequired = null, e.ariaInvalid = null, e.ariaDisabled = null, e.ariaLabel = null;
525
+ const i = this.getAttribute("data-aria-labelledby"), a = this.getAttribute("data-aria-describedby");
526
+ this._fallbackAriaLabelledBy = i || null, this._fallbackAriaDescribedBy = a || null;
527
+ }
528
+ }
529
+ render() {
530
+ const e = !!this.error || this._hasErrorSlot, r = !!this.helpText || this._hasHelpTextSlot, l = !!this.label || this._hasLabelSlot, h = e || this.required && !this.checked, s = {
531
+ checkbox: !0,
532
+ "checkbox--checked": this.checked,
533
+ "checkbox--indeterminate": this.indeterminate,
534
+ "checkbox--error": e,
535
+ "checkbox--disabled": this.disabled,
536
+ "checkbox--required": this.required,
537
+ "checkbox--sm": this.size === "sm",
538
+ "checkbox--md": this.size === "md",
539
+ "checkbox--lg": this.size === "lg"
540
+ }, i = [e ? null : r ? this._helpTextId : null, e ? this._errorId : null].filter(Boolean).join(" ") || void 0, a = this._effectiveLabel || void 0, m = !a && l, x = this._fallbackAriaLabelledBy, p = this._fallbackAriaDescribedBy, v = [i ?? null, p].filter(Boolean).join(" ") || void 0, u = x ?? (m ? this._labelId : void 0), n = !this._supportsIdrefRefs, _ = n && !this.disabled ? "0" : "-1", f = n ? void 0 : this._suppressInnerClick, L = n ? this._handleInternalChange : this._suppressInnerChange, w = n ? void 0 : this._handleChange, C = n ? void 0 : this._handleKeyDown;
541
+ return g`
542
+ <div class=${E(s)}>
543
+ <label part="control" class="checkbox__control" @click=${d(w)}>
544
+ <input
545
+ class="checkbox__input"
546
+ type="checkbox"
547
+ id=${this._id}
548
+ tabindex=${_}
549
+ .checked=${y(this.checked)}
550
+ .indeterminate=${y(this.indeterminate)}
551
+ ?disabled=${this.disabled}
552
+ ?required=${this.required}
553
+ name=${d(this.name || void 0)}
554
+ .value=${this.value}
555
+ aria-checked=${this.indeterminate ? "mixed" : k}
556
+ aria-invalid=${h ? "true" : k}
557
+ aria-describedby=${d(v)}
558
+ aria-label=${d(a)}
559
+ aria-labelledby=${d(u)}
560
+ aria-hidden=${n ? k : "true"}
561
+ @keydown=${d(C)}
562
+ @click=${d(f)}
563
+ @change=${L}
564
+ />
565
+
566
+ <span part="checkbox" class="checkbox__box">
567
+ <svg
568
+ part="checkmark"
569
+ class="checkbox__icon checkbox__icon--check"
570
+ viewBox="0 0 16 16"
571
+ aria-hidden="true"
572
+ >
573
+ <polyline points="3.5 8 6.5 11 12.5 5"></polyline>
574
+ </svg>
575
+ <svg
576
+ class="checkbox__icon checkbox__icon--indeterminate"
577
+ viewBox="0 0 16 16"
578
+ aria-hidden="true"
579
+ >
580
+ <line x1="4" y1="8" x2="12" y2="8"></line>
581
+ </svg>
582
+ </span>
583
+
584
+ <span part="label" class="checkbox__label" id=${this._labelId}>
585
+ <slot @slotchange=${this._handleLabelSlotChange}>${this.label}</slot>
586
+ ${this.required ? g`<span class="checkbox__required-marker" aria-hidden="true">*</span>` : k}
587
+ </span>
588
+ </label>
589
+
590
+ <!--
591
+ P0-01: wrapper div always owns _errorId so aria-describedby works
592
+ regardless of whether error content comes from the .error property
593
+ or the named slot. role="status" replaces aria-live="polite" to
594
+ avoid conflicting live-region semantics.
595
+ -->
596
+ <div
597
+ part="error"
598
+ class="checkbox__error"
599
+ id=${this._errorId}
600
+ role="status"
601
+ ?hidden=${!e}
602
+ >
603
+ <slot name="error" @slotchange=${this._handleErrorSlotChange}>
604
+ ${this._announcedError}
605
+ </slot>
606
+ </div>
607
+
608
+ <!--
609
+ Persistent help-text container. Rendered whenever the property OR
610
+ the slot has content, hidden when an error is present so guidance
611
+ does not compete with validation feedback. Always present in the
612
+ shadow tree so the host's aria-describedby chain remains stable.
613
+ -->
614
+ <div
615
+ part="help-text"
616
+ class="checkbox__help-text"
617
+ id=${this._helpTextId}
618
+ ?hidden=${!r || e}
619
+ >
620
+ <slot name="help-text" @slotchange=${this._handleHelpTextSlotChange}
621
+ >${this.helpText}</slot
622
+ >
623
+ </div>
624
+ </div>
625
+ `;
626
+ }
627
+ };
628
+ t.styles = [F, $];
629
+ t.formAssociated = !0;
630
+ o([
631
+ c({ type: Boolean, reflect: !0 })
632
+ ], t.prototype, "checked", 2);
633
+ o([
634
+ c({ type: Boolean, reflect: !0 })
635
+ ], t.prototype, "indeterminate", 2);
636
+ o([
637
+ c({ type: Boolean, reflect: !0 })
638
+ ], t.prototype, "disabled", 2);
639
+ o([
640
+ c({ type: Boolean, reflect: !0 })
641
+ ], t.prototype, "required", 2);
642
+ o([
643
+ c({ type: String, reflect: !0 })
644
+ ], t.prototype, "name", 2);
645
+ o([
646
+ c({ type: String, reflect: !0 })
647
+ ], t.prototype, "value", 2);
648
+ o([
649
+ c({ type: String })
650
+ ], t.prototype, "label", 2);
651
+ o([
652
+ c({ type: String })
653
+ ], t.prototype, "error", 2);
654
+ o([
655
+ c({ type: String, attribute: "help-text" })
656
+ ], t.prototype, "helpText", 2);
657
+ o([
658
+ c({ attribute: "required-message" })
659
+ ], t.prototype, "requiredMessage", 2);
660
+ o([
661
+ c({ type: String, attribute: "hx-size", reflect: !0 })
662
+ ], t.prototype, "size", 2);
663
+ o([
664
+ c({ type: String, attribute: "accessible-label" })
665
+ ], t.prototype, "accessibleLabel", 2);
666
+ o([
667
+ S(".checkbox__input")
668
+ ], t.prototype, "_inputEl", 2);
669
+ o([
670
+ b()
671
+ ], t.prototype, "_hasErrorSlot", 2);
672
+ o([
673
+ b()
674
+ ], t.prototype, "_hasHelpTextSlot", 2);
675
+ o([
676
+ b()
677
+ ], t.prototype, "_hasLabelSlot", 2);
678
+ o([
679
+ b()
680
+ ], t.prototype, "_announcedError", 2);
681
+ o([
682
+ b()
683
+ ], t.prototype, "_fallbackAriaLabelledBy", 2);
684
+ o([
685
+ b()
686
+ ], t.prototype, "_fallbackAriaDescribedBy", 2);
687
+ o([
688
+ b()
689
+ ], t.prototype, "_supportsIdrefRefs", 2);
690
+ t = o([
691
+ T("hx-checkbox")
692
+ ], t);
693
+ export {
694
+ t as H
695
+ };
696
+ //# sourceMappingURL=hx-checkbox-BdgoUeWi.js.map