praxis-kit 6.1.1 → 6.2.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.
@@ -3,6 +3,19 @@ function defineContractComponent(options) {
3
3
  return (factory) => factory(options);
4
4
  }
5
5
 
6
+ // ../../lib/primitive/src/tag/resolve-tag.ts
7
+ function makeResolveTag(defaultTag) {
8
+ return function tag(as) {
9
+ return as ?? defaultTag;
10
+ };
11
+ }
12
+
13
+ // ../../lib/primitive/src/merge/constants.ts
14
+ var EVENT_HANDLER_RE = /^on[A-Z]/;
15
+
16
+ // ../../lib/primitive/src/rule/rule-brand.ts
17
+ var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
18
+
6
19
  // ../../lib/primitive/src/guards/foundational/is-defined.ts
7
20
  function isUndefined(value) {
8
21
  return value === void 0;
@@ -36,408 +49,20 @@ function isPlainObject(value) {
36
49
  return proto === Object.prototype || proto === null;
37
50
  }
38
51
 
39
- // ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
40
- var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
41
- "aria-atomic",
42
- "aria-busy",
43
- "aria-controls",
44
- "aria-current",
45
- "aria-describedby",
46
- "aria-details",
47
- "aria-disabled",
48
- "aria-errormessage",
49
- "aria-flowto",
50
- "aria-hidden",
51
- "aria-keyshortcuts",
52
- "aria-label",
53
- "aria-labelledby",
54
- "aria-live",
55
- "aria-owns",
56
- "aria-relevant",
57
- "aria-roledescription"
58
- ]);
52
+ // ../../lib/primitive/src/rule/is-dynamic-rule.ts
53
+ function isDynamicRule(rule) {
54
+ return isObject(rule, true) && rule[RULE_BRAND] === true;
55
+ }
59
56
 
60
- // ../../lib/primitive/src/constants/aria/implicit-role-record.ts
61
- var IMPLICIT_ROLE_RECORD = Object.freeze({
62
- // Landmarks
63
- article: "article",
64
- aside: "complementary",
65
- footer: "contentinfo",
66
- header: "banner",
67
- main: "main",
68
- nav: "navigation",
69
- // Interactive
70
- a: "link",
71
- button: "button",
72
- select: "listbox",
73
- textarea: "textbox",
74
- // Headings
75
- h1: "heading",
76
- h2: "heading",
77
- h3: "heading",
78
- h4: "heading",
79
- h5: "heading",
80
- h6: "heading",
81
- // Lists
82
- ul: "list",
83
- ol: "list",
84
- li: "listitem",
85
- // Tables
86
- table: "table",
87
- tr: "row",
88
- td: "cell",
89
- th: "columnheader",
90
- // Structural / semantic
91
- dialog: "dialog",
92
- fieldset: "group",
93
- figure: "figure",
94
- meter: "meter",
95
- output: "status",
96
- progress: "progressbar"
97
- });
98
- var INPUT_TYPE_ROLE_MAP = Object.freeze({
99
- checkbox: "checkbox",
100
- radio: "radio",
101
- range: "slider",
102
- number: "spinbutton",
103
- search: "searchbox",
104
- text: "textbox",
105
- email: "textbox",
106
- tel: "textbox",
107
- url: "textbox",
108
- button: "button",
109
- submit: "button",
110
- reset: "button",
111
- image: "button"
112
- });
113
- var STRONG_ROLES = Object.freeze([
114
- "main",
115
- "navigation",
116
- "complementary",
117
- "contentinfo",
118
- "banner"
119
- ]);
120
- var STANDALONE_ROLES = Object.freeze([
121
- "article"
122
- ]);
123
- var STRONG_ROLES_SET = new Set(STRONG_ROLES);
124
- var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
57
+ // ../../lib/primitive/src/rule/resolve-rule.ts
58
+ function resolveRule(rule, context) {
59
+ return isDynamicRule(rule) ? rule.resolve(context) : rule;
60
+ }
125
61
 
126
- // ../../lib/primitive/src/constants/aria/known-aria-roles.ts
127
- var KNOWN_ARIA_ROLES = Object.freeze([
128
- "alert",
129
- "alertdialog",
130
- "application",
131
- "article",
132
- "banner",
133
- "blockquote",
134
- "button",
135
- "caption",
136
- "cell",
137
- "checkbox",
138
- "code",
139
- "columnheader",
140
- "combobox",
141
- "complementary",
142
- "contentinfo",
143
- "definition",
144
- "deletion",
145
- "dialog",
146
- "document",
147
- "emphasis",
148
- "feed",
149
- "figure",
150
- "form",
151
- "generic",
152
- "grid",
153
- "gridcell",
154
- "group",
155
- "heading",
156
- "img",
157
- "insertion",
158
- "link",
159
- "list",
160
- "listbox",
161
- "listitem",
162
- "log",
163
- "main",
164
- "marquee",
165
- "math",
166
- "menu",
167
- "menubar",
168
- "menuitem",
169
- "menuitemcheckbox",
170
- "menuitemradio",
171
- "meter",
172
- "navigation",
173
- "none",
174
- "note",
175
- "option",
176
- "paragraph",
177
- "presentation",
178
- "progressbar",
179
- "radio",
180
- "radiogroup",
181
- "region",
182
- "row",
183
- "rowgroup",
184
- "rowheader",
185
- "scrollbar",
186
- "search",
187
- "searchbox",
188
- "separator",
189
- "slider",
190
- "spinbutton",
191
- "status",
192
- "strong",
193
- "subscript",
194
- "superscript",
195
- "switch",
196
- "tab",
197
- "table",
198
- "tablist",
199
- "tabpanel",
200
- "term",
201
- "textbox",
202
- "time",
203
- "timer",
204
- "toolbar",
205
- "tooltip",
206
- "tree",
207
- "treegrid",
208
- "treeitem"
209
- ]);
210
- var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
211
-
212
- // ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
213
- var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
214
- [
215
- "aria-activedescendant",
216
- /* @__PURE__ */ new Set([
217
- "application",
218
- "combobox",
219
- "grid",
220
- "group",
221
- "listbox",
222
- "menu",
223
- "menubar",
224
- "radiogroup",
225
- "spinbutton",
226
- "tablist",
227
- "toolbar",
228
- "textbox",
229
- "tree",
230
- "treegrid"
231
- ])
232
- ],
233
- ["aria-autocomplete", /* @__PURE__ */ new Set(["combobox", "searchbox", "textbox"])],
234
- [
235
- "aria-checked",
236
- /* @__PURE__ */ new Set(["checkbox", "menuitemcheckbox", "option", "radio", "switch", "treeitem"])
237
- ],
238
- ["aria-colcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
239
- ["aria-colindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
240
- ["aria-colspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
241
- [
242
- "aria-expanded",
243
- /* @__PURE__ */ new Set([
244
- "button",
245
- "combobox",
246
- "gridcell",
247
- "listbox",
248
- "menuitem",
249
- "menuitemcheckbox",
250
- "menuitemradio",
251
- "row",
252
- "rowheader",
253
- "tab",
254
- "treeitem"
255
- ])
256
- ],
257
- [
258
- "aria-haspopup",
259
- /* @__PURE__ */ new Set([
260
- "button",
261
- "combobox",
262
- "gridcell",
263
- "listbox",
264
- "menuitem",
265
- "menuitemcheckbox",
266
- "menuitemradio",
267
- "tab",
268
- "treeitem"
269
- ])
270
- ],
271
- ["aria-level", /* @__PURE__ */ new Set(["heading", "listitem", "row", "treeitem"])],
272
- ["aria-modal", /* @__PURE__ */ new Set(["alertdialog", "dialog"])],
273
- ["aria-multiline", /* @__PURE__ */ new Set(["textbox"])],
274
- ["aria-multiselectable", /* @__PURE__ */ new Set(["grid", "listbox", "tablist", "tree", "treegrid"])],
275
- [
276
- "aria-orientation",
277
- /* @__PURE__ */ new Set(["scrollbar", "select", "separator", "slider", "tablist", "toolbar", "tree"])
278
- ],
279
- ["aria-placeholder", /* @__PURE__ */ new Set(["searchbox", "textbox"])],
280
- [
281
- "aria-posinset",
282
- /* @__PURE__ */ new Set([
283
- "article",
284
- "listitem",
285
- "menuitem",
286
- "menuitemcheckbox",
287
- "menuitemradio",
288
- "option",
289
- "radio",
290
- "row",
291
- "tab"
292
- ])
293
- ],
294
- ["aria-pressed", /* @__PURE__ */ new Set(["button"])],
295
- [
296
- "aria-readonly",
297
- /* @__PURE__ */ new Set([
298
- "combobox",
299
- "grid",
300
- "gridcell",
301
- "listbox",
302
- "radiogroup",
303
- "slider",
304
- "spinbutton",
305
- "textbox",
306
- "tree",
307
- "treegrid"
308
- ])
309
- ],
310
- [
311
- "aria-required",
312
- /* @__PURE__ */ new Set([
313
- "combobox",
314
- "gridcell",
315
- "listbox",
316
- "radiogroup",
317
- "spinbutton",
318
- "textbox",
319
- "tree",
320
- "treegrid"
321
- ])
322
- ],
323
- ["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
324
- ["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
325
- ["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
326
- [
327
- "aria-selected",
328
- /* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
329
- ],
330
- [
331
- "aria-setsize",
332
- /* @__PURE__ */ new Set([
333
- "article",
334
- "listitem",
335
- "menuitem",
336
- "menuitemcheckbox",
337
- "menuitemradio",
338
- "option",
339
- "radio",
340
- "row",
341
- "tab"
342
- ])
343
- ],
344
- ["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
345
- [
346
- "aria-valuemax",
347
- /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
348
- ],
349
- [
350
- "aria-valuemin",
351
- /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
352
- ],
353
- [
354
- "aria-valuenow",
355
- /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
356
- ],
357
- [
358
- "aria-valuetext",
359
- /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
360
- ]
361
- ]);
362
-
363
- // ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
364
- function isGlobalAriaAttribute(attr) {
365
- return GLOBAL_ARIA_ATTRIBUTES.has(attr);
366
- }
367
- function isAriaAttributeValidForRole(attr, role) {
368
- const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
369
- if (isUndefined(allowedRoles)) return true;
370
- if (isUndefined(role)) return false;
371
- return allowedRoles.has(role);
372
- }
373
-
374
- // ../../lib/primitive/src/constants/primitive/slot-name.ts
375
- var SLOT_NAME = "Slot";
376
-
377
- // ../../lib/primitive/src/guards/aria/is-aria-role.ts
378
- function isStrongImplicitRole(tag) {
379
- if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
380
- return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
381
- }
382
- function isStandaloneTag(tag) {
383
- if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
384
- return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
385
- }
386
- function getInputImplicitRole(type) {
387
- if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
388
- return INPUT_TYPE_ROLE_MAP[type];
389
- }
390
- function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
391
- const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
392
- if (!isNamed) return void 0;
393
- if (tag === "section") return "region";
394
- if (tag === "form") return "form";
395
- return void 0;
396
- }
397
-
398
- // ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
399
- function isKnownAriaRole(value) {
400
- return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
401
- }
402
-
403
- // ../../lib/contract/src/aria/aria-role-policy.ts
404
- function getImplicitRole(tag, props) {
405
- if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
406
- if (tag === "input") return getInputImplicitRole(props?.type);
407
- if (tag === "img") return props?.alt === "" ? "none" : "img";
408
- if (tag === "section" || tag === "form") {
409
- return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
410
- }
411
- return void 0;
412
- }
413
-
414
- // ../../lib/primitive/src/tag/resolve-tag.ts
415
- function makeResolveTag(defaultTag) {
416
- return function tag(as) {
417
- return as ?? defaultTag;
418
- };
419
- }
420
-
421
- // ../../lib/primitive/src/merge/constants.ts
422
- var EVENT_HANDLER_RE = /^on[A-Z]/;
423
-
424
- // ../../lib/primitive/src/rule/rule-brand.ts
425
- var RULE_BRAND = /* @__PURE__ */ Symbol("praxis-kit/dynamic-rule");
426
-
427
- // ../../lib/primitive/src/rule/is-dynamic-rule.ts
428
- function isDynamicRule(rule) {
429
- return isObject(rule, true) && rule[RULE_BRAND] === true;
430
- }
431
-
432
- // ../../lib/primitive/src/rule/resolve-rule.ts
433
- function resolveRule(rule, context) {
434
- return isDynamicRule(rule) ? rule.resolve(context) : rule;
435
- }
436
-
437
- // ../../lib/primitive/src/utils/assert-never.ts
438
- function assertNever(value) {
439
- throw new Error(`Unexpected value: ${String(value)}`);
440
- }
62
+ // ../../lib/primitive/src/utils/assert-never.ts
63
+ function assertNever(value) {
64
+ throw new Error(`Unexpected value: ${String(value)}`);
65
+ }
441
66
 
442
67
  // ../../lib/primitive/src/utils/cn.ts
443
68
  import { clsx } from "clsx";
@@ -576,119 +201,483 @@ function forEachEntry(object, callback) {
576
201
  callback(key, value);
577
202
  }
578
203
  }
579
- function forEachKey(object, callback) {
580
- for (const key of keys(object)) {
581
- callback(key);
582
- }
204
+ function forEachKey(object, callback) {
205
+ for (const key of keys(object)) {
206
+ callback(key);
207
+ }
208
+ }
209
+ function forEachValue(object, callback) {
210
+ for (const value of values(object)) {
211
+ callback(value);
212
+ }
213
+ }
214
+ function forEachSet(s, callback) {
215
+ for (const value of s) {
216
+ callback(value);
217
+ }
218
+ }
219
+ var iterate = Object.freeze({
220
+ entries,
221
+ filter,
222
+ find,
223
+ findLast,
224
+ forEach,
225
+ forEachEntry,
226
+ forEachKey,
227
+ forEachSet,
228
+ forEachValue,
229
+ items,
230
+ keys,
231
+ map,
232
+ mapEntries,
233
+ mapValues,
234
+ nodeList,
235
+ reduce,
236
+ collect,
237
+ set,
238
+ some,
239
+ every,
240
+ values
241
+ });
242
+
243
+ // ../../lib/primitive/src/utils/lazy.ts
244
+ function lazy(factory) {
245
+ let initialized = false;
246
+ let value;
247
+ return () => {
248
+ if (!initialized) {
249
+ value = factory();
250
+ initialized = true;
251
+ }
252
+ return value;
253
+ };
254
+ }
255
+
256
+ // ../../lib/primitive/src/utils/lru-cache.ts
257
+ var LRUCache = class {
258
+ #maxSize;
259
+ #store = /* @__PURE__ */ new Map();
260
+ constructor(maxSize) {
261
+ if (!Number.isInteger(maxSize) || maxSize < 1) {
262
+ throw new RangeError("LRUCache maxSize must be a positive integer.");
263
+ }
264
+ this.#maxSize = maxSize;
265
+ }
266
+ get(key) {
267
+ if (!this.#store.has(key)) return void 0;
268
+ const value = this.#store.get(key);
269
+ this.#store.delete(key);
270
+ this.#store.set(key, value);
271
+ return value;
272
+ }
273
+ set(key, value) {
274
+ this.#store.delete(key);
275
+ this.#store.set(key, value);
276
+ if (this.#store.size > this.#maxSize) {
277
+ const lru = this.#store.keys().next().value;
278
+ if (lru !== void 0) this.#store.delete(lru);
279
+ }
280
+ }
281
+ has(key) {
282
+ return this.#store.has(key);
283
+ }
284
+ delete(key) {
285
+ return this.#store.delete(key);
286
+ }
287
+ get size() {
288
+ return this.#store.size;
289
+ }
290
+ clear() {
291
+ this.#store.clear();
292
+ }
293
+ };
294
+
295
+ // ../../lib/primitive/src/utils/merge-refs.ts
296
+ function mergeRefsCore(...refs) {
297
+ const resolvedRefs = refs.filter((r) => r != null);
298
+ if (resolvedRefs.length === 0) return null;
299
+ if (resolvedRefs.length === 1) return resolvedRefs[0] ?? null;
300
+ return (value) => {
301
+ iterate.forEach(resolvedRefs, (ref) => {
302
+ if (isFunction(ref)) {
303
+ ref(value);
304
+ } else {
305
+ ref.current = value;
306
+ }
307
+ });
308
+ };
309
+ }
310
+
311
+ // ../../lib/primitive/src/utils/merge-props.ts
312
+ function mergeProps(defaultProps, props) {
313
+ return {
314
+ ...defaultProps ?? {},
315
+ ...props
316
+ };
317
+ }
318
+
319
+ // ../../lib/primitive/src/constants/aria/global-aria-attributes.ts
320
+ var GLOBAL_ARIA_ATTRIBUTES = /* @__PURE__ */ new Set([
321
+ "aria-atomic",
322
+ "aria-busy",
323
+ "aria-controls",
324
+ "aria-current",
325
+ "aria-describedby",
326
+ "aria-details",
327
+ "aria-disabled",
328
+ "aria-errormessage",
329
+ "aria-flowto",
330
+ "aria-hidden",
331
+ "aria-keyshortcuts",
332
+ "aria-label",
333
+ "aria-labelledby",
334
+ "aria-live",
335
+ "aria-owns",
336
+ "aria-relevant",
337
+ "aria-roledescription"
338
+ ]);
339
+
340
+ // ../../lib/primitive/src/constants/aria/implicit-role-record.ts
341
+ var IMPLICIT_ROLE_RECORD = Object.freeze({
342
+ // Landmarks
343
+ article: "article",
344
+ aside: "complementary",
345
+ footer: "contentinfo",
346
+ header: "banner",
347
+ main: "main",
348
+ nav: "navigation",
349
+ // Interactive
350
+ a: "link",
351
+ button: "button",
352
+ select: "listbox",
353
+ textarea: "textbox",
354
+ // Headings
355
+ h1: "heading",
356
+ h2: "heading",
357
+ h3: "heading",
358
+ h4: "heading",
359
+ h5: "heading",
360
+ h6: "heading",
361
+ // Lists
362
+ ul: "list",
363
+ ol: "list",
364
+ li: "listitem",
365
+ // Tables
366
+ table: "table",
367
+ tr: "row",
368
+ td: "cell",
369
+ th: "columnheader",
370
+ // Structural / semantic
371
+ dialog: "dialog",
372
+ fieldset: "group",
373
+ figure: "figure",
374
+ meter: "meter",
375
+ output: "status",
376
+ progress: "progressbar"
377
+ });
378
+ var INPUT_TYPE_ROLE_MAP = Object.freeze({
379
+ checkbox: "checkbox",
380
+ radio: "radio",
381
+ range: "slider",
382
+ number: "spinbutton",
383
+ search: "searchbox",
384
+ text: "textbox",
385
+ email: "textbox",
386
+ tel: "textbox",
387
+ url: "textbox",
388
+ button: "button",
389
+ submit: "button",
390
+ reset: "button",
391
+ image: "button"
392
+ });
393
+ var STRONG_ROLES = Object.freeze([
394
+ "main",
395
+ "navigation",
396
+ "complementary",
397
+ "contentinfo",
398
+ "banner"
399
+ ]);
400
+ var STANDALONE_ROLES = Object.freeze([
401
+ "article"
402
+ ]);
403
+ var STRONG_ROLES_SET = new Set(STRONG_ROLES);
404
+ var STANDALONE_ROLES_SET = new Set(STANDALONE_ROLES);
405
+
406
+ // ../../lib/primitive/src/constants/aria/known-aria-roles.ts
407
+ var KNOWN_ARIA_ROLES = Object.freeze([
408
+ "alert",
409
+ "alertdialog",
410
+ "application",
411
+ "article",
412
+ "banner",
413
+ "blockquote",
414
+ "button",
415
+ "caption",
416
+ "cell",
417
+ "checkbox",
418
+ "code",
419
+ "columnheader",
420
+ "combobox",
421
+ "complementary",
422
+ "contentinfo",
423
+ "definition",
424
+ "deletion",
425
+ "dialog",
426
+ "document",
427
+ "emphasis",
428
+ "feed",
429
+ "figure",
430
+ "form",
431
+ "generic",
432
+ "grid",
433
+ "gridcell",
434
+ "group",
435
+ "heading",
436
+ "img",
437
+ "insertion",
438
+ "link",
439
+ "list",
440
+ "listbox",
441
+ "listitem",
442
+ "log",
443
+ "main",
444
+ "marquee",
445
+ "math",
446
+ "menu",
447
+ "menubar",
448
+ "menuitem",
449
+ "menuitemcheckbox",
450
+ "menuitemradio",
451
+ "meter",
452
+ "navigation",
453
+ "none",
454
+ "note",
455
+ "option",
456
+ "paragraph",
457
+ "presentation",
458
+ "progressbar",
459
+ "radio",
460
+ "radiogroup",
461
+ "region",
462
+ "row",
463
+ "rowgroup",
464
+ "rowheader",
465
+ "scrollbar",
466
+ "search",
467
+ "searchbox",
468
+ "separator",
469
+ "slider",
470
+ "spinbutton",
471
+ "status",
472
+ "strong",
473
+ "subscript",
474
+ "superscript",
475
+ "switch",
476
+ "tab",
477
+ "table",
478
+ "tablist",
479
+ "tabpanel",
480
+ "term",
481
+ "textbox",
482
+ "time",
483
+ "timer",
484
+ "toolbar",
485
+ "tooltip",
486
+ "tree",
487
+ "treegrid",
488
+ "treeitem"
489
+ ]);
490
+ var KNOWN_ARIA_ROLES_SET = new Set(KNOWN_ARIA_ROLES);
491
+
492
+ // ../../lib/primitive/src/constants/aria/role-restricted-attributes.ts
493
+ var ROLE_RESTRICTED_ATTRIBUTES = /* @__PURE__ */ new Map([
494
+ [
495
+ "aria-activedescendant",
496
+ /* @__PURE__ */ new Set([
497
+ "application",
498
+ "combobox",
499
+ "grid",
500
+ "group",
501
+ "listbox",
502
+ "menu",
503
+ "menubar",
504
+ "radiogroup",
505
+ "spinbutton",
506
+ "tablist",
507
+ "toolbar",
508
+ "textbox",
509
+ "tree",
510
+ "treegrid"
511
+ ])
512
+ ],
513
+ ["aria-autocomplete", /* @__PURE__ */ new Set(["combobox", "searchbox", "textbox"])],
514
+ [
515
+ "aria-checked",
516
+ /* @__PURE__ */ new Set(["checkbox", "menuitemcheckbox", "option", "radio", "switch", "treeitem"])
517
+ ],
518
+ ["aria-colcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
519
+ ["aria-colindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
520
+ ["aria-colspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
521
+ [
522
+ "aria-expanded",
523
+ /* @__PURE__ */ new Set([
524
+ "button",
525
+ "combobox",
526
+ "gridcell",
527
+ "listbox",
528
+ "menuitem",
529
+ "menuitemcheckbox",
530
+ "menuitemradio",
531
+ "row",
532
+ "rowheader",
533
+ "tab",
534
+ "treeitem"
535
+ ])
536
+ ],
537
+ [
538
+ "aria-haspopup",
539
+ /* @__PURE__ */ new Set([
540
+ "button",
541
+ "combobox",
542
+ "gridcell",
543
+ "listbox",
544
+ "menuitem",
545
+ "menuitemcheckbox",
546
+ "menuitemradio",
547
+ "tab",
548
+ "treeitem"
549
+ ])
550
+ ],
551
+ ["aria-level", /* @__PURE__ */ new Set(["heading", "listitem", "row", "treeitem"])],
552
+ ["aria-modal", /* @__PURE__ */ new Set(["alertdialog", "dialog"])],
553
+ ["aria-multiline", /* @__PURE__ */ new Set(["textbox"])],
554
+ ["aria-multiselectable", /* @__PURE__ */ new Set(["grid", "listbox", "tablist", "tree", "treegrid"])],
555
+ [
556
+ "aria-orientation",
557
+ /* @__PURE__ */ new Set(["scrollbar", "select", "separator", "slider", "tablist", "toolbar", "tree"])
558
+ ],
559
+ ["aria-placeholder", /* @__PURE__ */ new Set(["searchbox", "textbox"])],
560
+ [
561
+ "aria-posinset",
562
+ /* @__PURE__ */ new Set([
563
+ "article",
564
+ "listitem",
565
+ "menuitem",
566
+ "menuitemcheckbox",
567
+ "menuitemradio",
568
+ "option",
569
+ "radio",
570
+ "row",
571
+ "tab"
572
+ ])
573
+ ],
574
+ ["aria-pressed", /* @__PURE__ */ new Set(["button"])],
575
+ [
576
+ "aria-readonly",
577
+ /* @__PURE__ */ new Set([
578
+ "combobox",
579
+ "grid",
580
+ "gridcell",
581
+ "listbox",
582
+ "radiogroup",
583
+ "slider",
584
+ "spinbutton",
585
+ "textbox",
586
+ "tree",
587
+ "treegrid"
588
+ ])
589
+ ],
590
+ [
591
+ "aria-required",
592
+ /* @__PURE__ */ new Set([
593
+ "combobox",
594
+ "gridcell",
595
+ "listbox",
596
+ "radiogroup",
597
+ "spinbutton",
598
+ "textbox",
599
+ "tree",
600
+ "treegrid"
601
+ ])
602
+ ],
603
+ ["aria-rowcount", /* @__PURE__ */ new Set(["grid", "table", "treegrid"])],
604
+ ["aria-rowindex", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "row", "rowheader"])],
605
+ ["aria-rowspan", /* @__PURE__ */ new Set(["cell", "columnheader", "gridcell", "rowheader"])],
606
+ [
607
+ "aria-selected",
608
+ /* @__PURE__ */ new Set(["columnheader", "gridcell", "option", "row", "rowheader", "tab", "treeitem"])
609
+ ],
610
+ [
611
+ "aria-setsize",
612
+ /* @__PURE__ */ new Set([
613
+ "article",
614
+ "listitem",
615
+ "menuitem",
616
+ "menuitemcheckbox",
617
+ "menuitemradio",
618
+ "option",
619
+ "radio",
620
+ "row",
621
+ "tab"
622
+ ])
623
+ ],
624
+ ["aria-sort", /* @__PURE__ */ new Set(["columnheader", "rowheader"])],
625
+ [
626
+ "aria-valuemax",
627
+ /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
628
+ ],
629
+ [
630
+ "aria-valuemin",
631
+ /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
632
+ ],
633
+ [
634
+ "aria-valuenow",
635
+ /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
636
+ ],
637
+ [
638
+ "aria-valuetext",
639
+ /* @__PURE__ */ new Set(["meter", "progressbar", "scrollbar", "separator", "slider", "spinbutton"])
640
+ ]
641
+ ]);
642
+
643
+ // ../../lib/primitive/src/constants/primitive/slot-name.ts
644
+ var SLOT_NAME = "Slot";
645
+
646
+ // ../../lib/primitive/src/guards/aria/is-aria-attribute.ts
647
+ function isGlobalAriaAttribute(attr) {
648
+ return GLOBAL_ARIA_ATTRIBUTES.has(attr);
649
+ }
650
+ function isAriaAttributeValidForRole(attr, role) {
651
+ const allowedRoles = ROLE_RESTRICTED_ATTRIBUTES.get(attr);
652
+ if (isUndefined(allowedRoles)) return true;
653
+ if (isUndefined(role)) return false;
654
+ return allowedRoles.has(role);
583
655
  }
584
- function forEachValue(object, callback) {
585
- for (const value of values(object)) {
586
- callback(value);
587
- }
656
+
657
+ // ../../lib/primitive/src/guards/aria/is-aria-role.ts
658
+ function isStrongImplicitRole(tag) {
659
+ if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
660
+ return STRONG_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
588
661
  }
589
- function forEachSet(s, callback) {
590
- for (const value of s) {
591
- callback(value);
592
- }
662
+ function isStandaloneTag(tag) {
663
+ if (!(tag in IMPLICIT_ROLE_RECORD)) return false;
664
+ return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
593
665
  }
594
- var iterate = Object.freeze({
595
- entries,
596
- filter,
597
- find,
598
- findLast,
599
- forEach,
600
- forEachEntry,
601
- forEachKey,
602
- forEachSet,
603
- forEachValue,
604
- items,
605
- keys,
606
- map,
607
- mapEntries,
608
- mapValues,
609
- nodeList,
610
- reduce,
611
- collect,
612
- set,
613
- some,
614
- every,
615
- values
616
- });
617
-
618
- // ../../lib/primitive/src/utils/lazy.ts
619
- function lazy(factory) {
620
- let initialized = false;
621
- let value;
622
- return () => {
623
- if (!initialized) {
624
- value = factory();
625
- initialized = true;
626
- }
627
- return value;
628
- };
666
+ function getInputImplicitRole(type) {
667
+ if (!isString(type) || !(type in INPUT_TYPE_ROLE_MAP)) return void 0;
668
+ return INPUT_TYPE_ROLE_MAP[type];
629
669
  }
630
-
631
- // ../../lib/primitive/src/utils/lru-cache.ts
632
- var LRUCache = class {
633
- #maxSize;
634
- #store = /* @__PURE__ */ new Map();
635
- constructor(maxSize) {
636
- if (!Number.isInteger(maxSize) || maxSize < 1) {
637
- throw new RangeError("LRUCache maxSize must be a positive integer.");
638
- }
639
- this.#maxSize = maxSize;
640
- }
641
- get(key) {
642
- if (!this.#store.has(key)) return void 0;
643
- const value = this.#store.get(key);
644
- this.#store.delete(key);
645
- this.#store.set(key, value);
646
- return value;
647
- }
648
- set(key, value) {
649
- this.#store.delete(key);
650
- this.#store.set(key, value);
651
- if (this.#store.size > this.#maxSize) {
652
- const lru = this.#store.keys().next().value;
653
- if (lru !== void 0) this.#store.delete(lru);
654
- }
655
- }
656
- has(key) {
657
- return this.#store.has(key);
658
- }
659
- delete(key) {
660
- return this.#store.delete(key);
661
- }
662
- get size() {
663
- return this.#store.size;
664
- }
665
- clear() {
666
- this.#store.clear();
667
- }
668
- };
669
-
670
- // ../../lib/primitive/src/utils/merge-refs.ts
671
- function mergeRefsCore(...refs) {
672
- const resolvedRefs = refs.filter((r) => r != null);
673
- if (resolvedRefs.length === 0) return null;
674
- if (resolvedRefs.length === 1) return resolvedRefs[0] ?? null;
675
- return (value) => {
676
- iterate.forEach(resolvedRefs, (ref) => {
677
- if (isFunction(ref)) {
678
- ref(value);
679
- } else {
680
- ref.current = value;
681
- }
682
- });
683
- };
670
+ function getConditionalImplicitRole(tag, ariaLabel, ariaLabelledBy) {
671
+ const isNamed = isString(ariaLabel) || isString(ariaLabelledBy);
672
+ if (!isNamed) return void 0;
673
+ if (tag === "section") return "region";
674
+ if (tag === "form") return "form";
675
+ return void 0;
684
676
  }
685
677
 
686
- // ../../lib/primitive/src/utils/merge-props.ts
687
- function mergeProps(defaultProps, props) {
688
- return {
689
- ...defaultProps ?? {},
690
- ...props
691
- };
678
+ // ../../lib/primitive/src/guards/aria/is-known-aria-role.ts
679
+ function isKnownAriaRole(value) {
680
+ return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
692
681
  }
693
682
 
694
683
  // ../../lib/primitive/src/guards/children/component-id.ts
@@ -728,6 +717,17 @@ function isTag(...args) {
728
717
  return tag !== void 0 && set2.has(tag);
729
718
  }
730
719
 
720
+ // ../../lib/contract/src/aria/aria-role-policy.ts
721
+ function getImplicitRole(tag, props) {
722
+ if (tag in IMPLICIT_ROLE_RECORD) return IMPLICIT_ROLE_RECORD[tag];
723
+ if (tag === "input") return getInputImplicitRole(props?.type);
724
+ if (tag === "img") return props?.alt === "" ? "none" : "img";
725
+ if (tag === "section" || tag === "form") {
726
+ return getConditionalImplicitRole(tag, props?.["aria-label"], props?.["aria-labelledby"]);
727
+ }
728
+ return void 0;
729
+ }
730
+
731
731
  // ../../lib/contract/src/diagnostics/aria.ts
732
732
  import { DiagnosticCategory, DiagnosticCode } from "./_shared/diagnostics.js";
733
733
  var AriaDiagnostics = {
@@ -2543,7 +2543,10 @@ function resolveFactoryOptions(options = {}) {
2543
2543
  const variantKeys = styling?.variants === void 0 ? EMPTY_VARIANT_KEYS : new Set(Object.keys(styling.variants));
2544
2544
  return Object.freeze({
2545
2545
  defaultTag: options.tag ?? "div",
2546
- diagnostics: resolveDiagnostics(enforcement?.diagnostics, silentDiagnostics),
2546
+ diagnostics: resolveDiagnostics(
2547
+ enforcement?.diagnostics,
2548
+ options.diagnostics ?? silentDiagnostics
2549
+ ),
2547
2550
  variantKeys,
2548
2551
  ...whenDefined("displayName", options.name),
2549
2552
  ...whenDefined("defaultProps", options.defaults),