@proyecto-viviana/solidaria 0.0.2 → 0.0.3

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 (110) hide show
  1. package/dist/index.d.ts +1214 -15
  2. package/dist/index.js +178 -382
  3. package/dist/index.jsx +2717 -0
  4. package/package.json +7 -5
  5. package/dist/button/createButton.d.ts +0 -29
  6. package/dist/button/createButton.d.ts.map +0 -1
  7. package/dist/button/createToggleButton.d.ts +0 -41
  8. package/dist/button/createToggleButton.d.ts.map +0 -1
  9. package/dist/button/index.d.ts +0 -5
  10. package/dist/button/index.d.ts.map +0 -1
  11. package/dist/button/types.d.ts +0 -66
  12. package/dist/button/types.d.ts.map +0 -1
  13. package/dist/checkbox/createCheckbox.d.ts +0 -56
  14. package/dist/checkbox/createCheckbox.d.ts.map +0 -1
  15. package/dist/checkbox/createCheckboxGroup.d.ts +0 -53
  16. package/dist/checkbox/createCheckboxGroup.d.ts.map +0 -1
  17. package/dist/checkbox/createCheckboxGroupItem.d.ts +0 -25
  18. package/dist/checkbox/createCheckboxGroupItem.d.ts.map +0 -1
  19. package/dist/checkbox/createCheckboxGroupState.d.ts +0 -71
  20. package/dist/checkbox/createCheckboxGroupState.d.ts.map +0 -1
  21. package/dist/checkbox/index.d.ts +0 -9
  22. package/dist/checkbox/index.d.ts.map +0 -1
  23. package/dist/index.d.ts.map +0 -1
  24. package/dist/index.js.map +0 -1
  25. package/dist/interactions/FocusableProvider.d.ts +0 -26
  26. package/dist/interactions/FocusableProvider.d.ts.map +0 -1
  27. package/dist/interactions/PressEvent.d.ts +0 -63
  28. package/dist/interactions/PressEvent.d.ts.map +0 -1
  29. package/dist/interactions/createFocus.d.ts +0 -31
  30. package/dist/interactions/createFocus.d.ts.map +0 -1
  31. package/dist/interactions/createFocusRing.d.ts +0 -37
  32. package/dist/interactions/createFocusRing.d.ts.map +0 -1
  33. package/dist/interactions/createFocusWithin.d.ts +0 -27
  34. package/dist/interactions/createFocusWithin.d.ts.map +0 -1
  35. package/dist/interactions/createFocusable.d.ts +0 -65
  36. package/dist/interactions/createFocusable.d.ts.map +0 -1
  37. package/dist/interactions/createHover.d.ts +0 -41
  38. package/dist/interactions/createHover.d.ts.map +0 -1
  39. package/dist/interactions/createKeyboard.d.ts +0 -35
  40. package/dist/interactions/createKeyboard.d.ts.map +0 -1
  41. package/dist/interactions/createPress.d.ts +0 -49
  42. package/dist/interactions/createPress.d.ts.map +0 -1
  43. package/dist/interactions/index.d.ts +0 -10
  44. package/dist/interactions/index.d.ts.map +0 -1
  45. package/dist/label/createField.d.ts +0 -51
  46. package/dist/label/createField.d.ts.map +0 -1
  47. package/dist/label/createLabel.d.ts +0 -49
  48. package/dist/label/createLabel.d.ts.map +0 -1
  49. package/dist/label/createLabels.d.ts +0 -16
  50. package/dist/label/createLabels.d.ts.map +0 -1
  51. package/dist/label/index.d.ts +0 -6
  52. package/dist/label/index.d.ts.map +0 -1
  53. package/dist/link/createLink.d.ts +0 -65
  54. package/dist/link/createLink.d.ts.map +0 -1
  55. package/dist/link/index.d.ts +0 -2
  56. package/dist/link/index.d.ts.map +0 -1
  57. package/dist/progress/createProgressBar.d.ts +0 -47
  58. package/dist/progress/createProgressBar.d.ts.map +0 -1
  59. package/dist/progress/index.d.ts +0 -2
  60. package/dist/progress/index.d.ts.map +0 -1
  61. package/dist/radio/createRadio.d.ts +0 -68
  62. package/dist/radio/createRadio.d.ts.map +0 -1
  63. package/dist/radio/createRadioGroup.d.ts +0 -85
  64. package/dist/radio/createRadioGroup.d.ts.map +0 -1
  65. package/dist/radio/createRadioGroupState.d.ts +0 -77
  66. package/dist/radio/createRadioGroupState.d.ts.map +0 -1
  67. package/dist/radio/index.d.ts +0 -4
  68. package/dist/radio/index.d.ts.map +0 -1
  69. package/dist/separator/createSeparator.d.ts +0 -38
  70. package/dist/separator/createSeparator.d.ts.map +0 -1
  71. package/dist/separator/index.d.ts +0 -2
  72. package/dist/separator/index.d.ts.map +0 -1
  73. package/dist/ssr/index.d.ts +0 -24
  74. package/dist/ssr/index.d.ts.map +0 -1
  75. package/dist/switch/createSwitch.d.ts +0 -34
  76. package/dist/switch/createSwitch.d.ts.map +0 -1
  77. package/dist/switch/index.d.ts +0 -2
  78. package/dist/switch/index.d.ts.map +0 -1
  79. package/dist/textfield/createTextField.d.ts +0 -73
  80. package/dist/textfield/createTextField.d.ts.map +0 -1
  81. package/dist/textfield/index.d.ts +0 -2
  82. package/dist/textfield/index.d.ts.map +0 -1
  83. package/dist/toggle/createToggle.d.ts +0 -94
  84. package/dist/toggle/createToggle.d.ts.map +0 -1
  85. package/dist/toggle/createToggleState.d.ts +0 -34
  86. package/dist/toggle/createToggleState.d.ts.map +0 -1
  87. package/dist/toggle/index.d.ts +0 -5
  88. package/dist/toggle/index.d.ts.map +0 -1
  89. package/dist/utils/dom.d.ts +0 -51
  90. package/dist/utils/dom.d.ts.map +0 -1
  91. package/dist/utils/events.d.ts +0 -29
  92. package/dist/utils/events.d.ts.map +0 -1
  93. package/dist/utils/filterDOMProps.d.ts +0 -29
  94. package/dist/utils/filterDOMProps.d.ts.map +0 -1
  95. package/dist/utils/focus.d.ts +0 -20
  96. package/dist/utils/focus.d.ts.map +0 -1
  97. package/dist/utils/geometry.d.ts +0 -40
  98. package/dist/utils/geometry.d.ts.map +0 -1
  99. package/dist/utils/globalListeners.d.ts +0 -36
  100. package/dist/utils/globalListeners.d.ts.map +0 -1
  101. package/dist/utils/index.d.ts +0 -11
  102. package/dist/utils/index.d.ts.map +0 -1
  103. package/dist/utils/mergeProps.d.ts +0 -8
  104. package/dist/utils/mergeProps.d.ts.map +0 -1
  105. package/dist/utils/platform.d.ts +0 -14
  106. package/dist/utils/platform.d.ts.map +0 -1
  107. package/dist/utils/reactivity.d.ts +0 -28
  108. package/dist/utils/reactivity.d.ts.map +0 -1
  109. package/dist/utils/textSelection.d.ts +0 -19
  110. package/dist/utils/textSelection.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,36 +1,31 @@
1
- var __defProp = Object.defineProperty;
2
- var __typeError = (msg) => {
3
- throw TypeError(msg);
4
- };
5
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
7
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
8
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
9
- var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
10
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
11
- var _shouldStopPropagation;
12
- import { onCleanup, createSignal, onMount, useContext, createContext, createEffect, createMemo, createUniqueId, untrack } from "solid-js";
13
- import { isServer } from "solid-js/web";
14
- class PressEvent {
1
+ import { createContext, createSignal, onCleanup, onMount, createEffect, createMemo, createUniqueId, useContext } from 'solid-js';
2
+ import { radioGroupSyncVersion } from '@proyecto-viviana/solid-stately';
3
+ export { createCheckboxGroupState, createRadioGroupState, createToggleState } from '@proyecto-viviana/solid-stately';
4
+ import { isServer } from 'solid-js/web';
5
+
6
+ // src/interactions/createPress.ts
7
+
8
+ // src/interactions/PressEvent.ts
9
+ var PressEvent = class {
10
+ type;
11
+ pointerType;
12
+ target;
13
+ shiftKey;
14
+ ctrlKey;
15
+ metaKey;
16
+ altKey;
17
+ x;
18
+ y;
19
+ #shouldStopPropagation = true;
15
20
  constructor(type, pointerType, originalEvent, target) {
16
- __publicField(this, "type");
17
- __publicField(this, "pointerType");
18
- __publicField(this, "target");
19
- __publicField(this, "shiftKey");
20
- __publicField(this, "ctrlKey");
21
- __publicField(this, "metaKey");
22
- __publicField(this, "altKey");
23
- __publicField(this, "x");
24
- __publicField(this, "y");
25
- __privateAdd(this, _shouldStopPropagation, true);
26
21
  this.type = type;
27
22
  this.pointerType = pointerType;
28
23
  this.target = target;
29
24
  const e = originalEvent;
30
- this.shiftKey = (e == null ? void 0 : e.shiftKey) ?? false;
31
- this.ctrlKey = (e == null ? void 0 : e.ctrlKey) ?? false;
32
- this.metaKey = (e == null ? void 0 : e.metaKey) ?? false;
33
- this.altKey = (e == null ? void 0 : e.altKey) ?? false;
25
+ this.shiftKey = e?.shiftKey ?? false;
26
+ this.ctrlKey = e?.ctrlKey ?? false;
27
+ this.metaKey = e?.metaKey ?? false;
28
+ this.altKey = e?.altKey ?? false;
34
29
  this.x = 0;
35
30
  this.y = 0;
36
31
  if (originalEvent && "clientX" in originalEvent && target) {
@@ -48,28 +43,28 @@ class PressEvent {
48
43
  * By default, press events stop propagation.
49
44
  */
50
45
  continuePropagation() {
51
- __privateSet(this, _shouldStopPropagation, false);
46
+ this.#shouldStopPropagation = false;
52
47
  }
53
48
  /**
54
49
  * Whether the event should stop propagation.
55
50
  * Used internally by the press handler.
56
51
  */
57
52
  get shouldStopPropagation() {
58
- return __privateGet(this, _shouldStopPropagation);
53
+ return this.#shouldStopPropagation;
59
54
  }
60
- }
61
- _shouldStopPropagation = new WeakMap();
55
+ };
62
56
  function createPressEvent(type, pointerType, originalEvent, target) {
63
57
  return new PressEvent(type, pointerType, originalEvent, target);
64
58
  }
59
+
60
+ // src/utils/mergeProps.ts
65
61
  function mergeProps(...args) {
66
- var _a;
67
62
  const result = {};
68
63
  for (const props of args) {
69
64
  for (const key in props) {
70
65
  const value = props[key];
71
66
  const existingValue = result[key];
72
- if (typeof existingValue === "function" && typeof value === "function" && key.startsWith("on") && key[2] === ((_a = key[2]) == null ? void 0 : _a.toUpperCase())) {
67
+ if (typeof existingValue === "function" && typeof value === "function" && key.startsWith("on") && key[2] === key[2]?.toUpperCase()) {
73
68
  result[key] = chainHandlers(existingValue, value);
74
69
  } else if (key === "class" || key === "className") {
75
70
  result[key] = mergeClassNames(existingValue, value);
@@ -91,14 +86,16 @@ function chainHandlers(existingHandler, newHandler) {
91
86
  function mergeClassNames(...classes) {
92
87
  return classes.filter(Boolean).join(" ");
93
88
  }
94
- const DOMPropNames = /* @__PURE__ */ new Set(["id"]);
95
- const labelablePropNames = /* @__PURE__ */ new Set([
89
+
90
+ // src/utils/filterDOMProps.ts
91
+ var DOMPropNames = /* @__PURE__ */ new Set(["id"]);
92
+ var labelablePropNames = /* @__PURE__ */ new Set([
96
93
  "aria-label",
97
94
  "aria-labelledby",
98
95
  "aria-describedby",
99
96
  "aria-details"
100
97
  ]);
101
- const linkPropNames = /* @__PURE__ */ new Set([
98
+ var linkPropNames = /* @__PURE__ */ new Set([
102
99
  "href",
103
100
  "hrefLang",
104
101
  "target",
@@ -107,8 +104,8 @@ const linkPropNames = /* @__PURE__ */ new Set([
107
104
  "ping",
108
105
  "referrerPolicy"
109
106
  ]);
110
- const globalAttrs = /* @__PURE__ */ new Set(["dir", "lang", "hidden", "inert", "translate"]);
111
- const globalEvents = /* @__PURE__ */ new Set([
107
+ var globalAttrs = /* @__PURE__ */ new Set(["dir", "lang", "hidden", "inert", "translate"]);
108
+ var globalEvents = /* @__PURE__ */ new Set([
112
109
  "onClick",
113
110
  "onAuxClick",
114
111
  "onContextMenu",
@@ -144,26 +141,29 @@ const globalEvents = /* @__PURE__ */ new Set([
144
141
  "onTransitionRun",
145
142
  "onTransitionStart"
146
143
  ]);
147
- const propRe = /^(data-.*)$/;
144
+ var propRe = /^(data-.*)$/;
148
145
  function filterDOMProps(props, opts = {}) {
149
146
  const { labelable, isLink, global, events = global, propNames } = opts;
150
147
  const filteredProps = {};
151
148
  for (const prop in props) {
152
- if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || labelable && labelablePropNames.has(prop) || isLink && linkPropNames.has(prop) || global && globalAttrs.has(prop) || events && (globalEvents.has(prop) || prop.endsWith("Capture") && globalEvents.has(prop.slice(0, -7))) || (propNames == null ? void 0 : propNames.has(prop)) || propRe.test(prop))) {
149
+ if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || labelable && labelablePropNames.has(prop) || isLink && linkPropNames.has(prop) || global && globalAttrs.has(prop) || events && (globalEvents.has(prop) || prop.endsWith("Capture") && globalEvents.has(prop.slice(0, -7))) || propNames?.has(prop) || propRe.test(prop))) {
153
150
  filteredProps[prop] = props[prop];
154
151
  }
155
152
  }
156
153
  return filteredProps;
157
154
  }
158
- function access$1(value) {
155
+
156
+ // src/utils/reactivity.ts
157
+ function access(value) {
159
158
  return typeof value === "function" ? value() : value;
160
159
  }
161
160
  function isAccessor(value) {
162
161
  return typeof value === "function";
163
162
  }
163
+
164
+ // src/utils/platform.ts
164
165
  function testPlatform(re) {
165
- var _a;
166
- return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform || ((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || "") : false;
166
+ return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform || window.navigator.userAgentData?.platform || "") : false;
167
167
  }
168
168
  function isMac() {
169
169
  return testPlatform(/^Mac/i);
@@ -177,8 +177,10 @@ function isIPad() {
177
177
  function isIOS() {
178
178
  return isIPhone() || isIPad();
179
179
  }
180
+
181
+ // src/utils/dom.ts
180
182
  function getOwnerDocument(el) {
181
- return (el == null ? void 0 : el.ownerDocument) ?? document;
183
+ return el?.ownerDocument ?? document;
182
184
  }
183
185
  function nodeContains(parent, child) {
184
186
  if (!parent || !child) {
@@ -279,14 +281,16 @@ function shouldPreventDefaultKeyboard(target, key) {
279
281
  function openLink(target, event, allowOpener = false) {
280
282
  const { href, target: linkTarget, rel } = target;
281
283
  const keyEvent = event;
282
- const shouldOpenInNewTab = linkTarget === "_blank" || (keyEvent == null ? void 0 : keyEvent.metaKey) || (keyEvent == null ? void 0 : keyEvent.ctrlKey) || (keyEvent == null ? void 0 : keyEvent.shiftKey) || (keyEvent == null ? void 0 : keyEvent.altKey);
284
+ const shouldOpenInNewTab = linkTarget === "_blank" || keyEvent?.metaKey || keyEvent?.ctrlKey || keyEvent?.shiftKey || keyEvent?.altKey;
283
285
  if (shouldOpenInNewTab) {
284
- const features = !allowOpener && (rel == null ? void 0 : rel.includes("noopener")) ? "noopener" : void 0;
286
+ const features = !allowOpener && rel?.includes("noopener") ? "noopener" : void 0;
285
287
  window.open(href, linkTarget || "_blank", features);
286
288
  } else {
287
289
  window.location.href = href;
288
290
  }
289
291
  }
292
+
293
+ // src/utils/geometry.ts
290
294
  function areRectanglesOverlapping(a, b) {
291
295
  if (a.left > b.right || b.left > a.right) {
292
296
  return false;
@@ -349,6 +353,8 @@ function getTouchById(event, pointerId) {
349
353
  }
350
354
  return null;
351
355
  }
356
+
357
+ // src/utils/events.ts
352
358
  function isVirtualClick(event) {
353
359
  if (event.mozInputSource === 0 && event.isTrusted) {
354
360
  return true;
@@ -377,9 +383,11 @@ function setEventTarget(event, target) {
377
383
  configurable: true
378
384
  });
379
385
  }
380
- let state = "default";
381
- let savedUserSelect = "";
382
- let modifiedElementMap = /* @__PURE__ */ new WeakMap();
386
+
387
+ // src/utils/textSelection.ts
388
+ var state = "default";
389
+ var savedUserSelect = "";
390
+ var modifiedElementMap = /* @__PURE__ */ new WeakMap();
383
391
  function disableTextSelection(target) {
384
392
  if (isIOS()) {
385
393
  if (state === "default") {
@@ -429,8 +437,8 @@ function restoreTextSelection(target) {
429
437
  }
430
438
  }
431
439
  }
432
- const pendingTransitions = /* @__PURE__ */ new Set();
433
- let transitionTimeout = null;
440
+ var pendingTransitions = /* @__PURE__ */ new Set();
441
+ var transitionTimeout = null;
434
442
  function runAfterTransition(callback) {
435
443
  pendingTransitions.add(callback);
436
444
  if (transitionTimeout != null) {
@@ -444,6 +452,8 @@ function runAfterTransition(callback) {
444
452
  transitionTimeout = null;
445
453
  }, 0);
446
454
  }
455
+
456
+ // src/utils/focus.ts
447
457
  function focusWithoutScrolling(element) {
448
458
  if (!element) return;
449
459
  try {
@@ -478,8 +488,8 @@ function getScrollableAncestors(element) {
478
488
  ancestors.push(doc.documentElement);
479
489
  return ancestors;
480
490
  }
481
- let ignoreFocus = false;
482
- let preventFocusTimeout = null;
491
+ var ignoreFocus = false;
492
+ var preventFocusTimeout = null;
483
493
  function preventFocus(target) {
484
494
  const focusableAncestor = findFocusableAncestor(target);
485
495
  if (!focusableAncestor) return;
@@ -526,11 +536,11 @@ function findFocusableAncestor(element) {
526
536
  }
527
537
  return element;
528
538
  }
529
- const focusSafely = focusWithoutScrolling;
539
+ var focusSafely = focusWithoutScrolling;
530
540
  function createGlobalListeners() {
531
541
  const listeners = [];
532
542
  function addGlobalListener(type, handler, options) {
533
- const target = (options == null ? void 0 : options.isWindow) ? window : document;
543
+ const target = options?.isWindow ? window : document;
534
544
  const listenerOptions = options ? {
535
545
  capture: options.capture,
536
546
  passive: options.passive,
@@ -540,16 +550,13 @@ function createGlobalListeners() {
540
550
  listeners.push({ target, type, handler, options: listenerOptions });
541
551
  }
542
552
  function removeGlobalListener(type, handler, options) {
543
- const target = (options == null ? void 0 : options.isWindow) ? window : document;
553
+ const target = options?.isWindow ? window : document;
544
554
  const listenerOptions = options ? {
545
555
  capture: options.capture
546
556
  } : void 0;
547
557
  target.removeEventListener(type, handler, listenerOptions);
548
558
  const index = listeners.findIndex(
549
- (l) => {
550
- var _a;
551
- return l.target === target && l.type === type && l.handler === handler && ((_a = l.options) == null ? void 0 : _a.capture) === (listenerOptions == null ? void 0 : listenerOptions.capture);
552
- }
559
+ (l) => l.target === target && l.type === type && l.handler === handler && l.options?.capture === listenerOptions?.capture
553
560
  );
554
561
  if (index !== -1) {
555
562
  listeners.splice(index, 1);
@@ -568,7 +575,9 @@ function createGlobalListeners() {
568
575
  removeAllGlobalListeners
569
576
  };
570
577
  }
571
- function isDisabledValue$2(isDisabled) {
578
+
579
+ // src/interactions/createPress.ts
580
+ function isDisabledValue(isDisabled) {
572
581
  if (typeof isDisabled === "function") {
573
582
  return isDisabled();
574
583
  }
@@ -580,8 +589,8 @@ function isPressedValue(isPressed) {
580
589
  }
581
590
  return isPressed ?? false;
582
591
  }
583
- const LINK_CLICKED = Symbol("linkClicked");
584
- let pressableCSSInjected = false;
592
+ var LINK_CLICKED = Symbol("linkClicked");
593
+ var pressableCSSInjected = false;
585
594
  function injectPressableCSS() {
586
595
  if (pressableCSSInjected || typeof document === "undefined") return;
587
596
  const style = document.createElement("style");
@@ -620,7 +629,7 @@ function createPress(props = {}) {
620
629
  const { addGlobalListener, removeAllGlobalListeners } = createGlobalListeners();
621
630
  injectPressableCSS();
622
631
  const triggerPressStart = (originalEvent, pointerType) => {
623
- if (isDisabledValue$2(props.isDisabled) || pressState.didFirePressStart) {
632
+ if (isDisabledValue(props.isDisabled) || pressState.didFirePressStart) {
624
633
  return false;
625
634
  }
626
635
  let shouldStopPropagation = true;
@@ -653,7 +662,7 @@ function createPress(props = {}) {
653
662
  props.onPressChange(false);
654
663
  }
655
664
  setInternalIsPressed(false);
656
- if (wasPressed && !isDisabledValue$2(props.isDisabled)) {
665
+ if (wasPressed && !isDisabledValue(props.isDisabled)) {
657
666
  if (props.onPress) {
658
667
  const event = createPressEvent("press", pointerType, originalEvent, pressState.target);
659
668
  props.onPress(event);
@@ -662,7 +671,7 @@ function createPress(props = {}) {
662
671
  pressState.isTriggeringEvent = false;
663
672
  };
664
673
  const triggerPressUp = (originalEvent, pointerType) => {
665
- if (isDisabledValue$2(props.isDisabled)) {
674
+ if (isDisabledValue(props.isDisabled)) {
666
675
  return;
667
676
  }
668
677
  if (props.onPressUp) {
@@ -783,7 +792,7 @@ function createPress(props = {}) {
783
792
  }
784
793
  };
785
794
  const onTouchStart = (e) => {
786
- if (isDisabledValue$2(props.isDisabled)) {
795
+ if (isDisabledValue(props.isDisabled)) {
787
796
  return;
788
797
  }
789
798
  if (pressState.isPressed) {
@@ -909,7 +918,7 @@ function createPress(props = {}) {
909
918
  }
910
919
  };
911
920
  const onKeyDown = (e) => {
912
- if (isDisabledValue$2(props.isDisabled)) {
921
+ if (isDisabledValue(props.isDisabled)) {
913
922
  return;
914
923
  }
915
924
  if (!isValidKeyboardEvent(e, e.currentTarget)) {
@@ -943,16 +952,15 @@ function createPress(props = {}) {
943
952
  addGlobalListener("keyup", onKeyUp, { capture: true });
944
953
  };
945
954
  const onKeyUp = (e) => {
946
- var _a, _b;
947
955
  if (!pressState.isPressed || pressState.pointerType !== "keyboard") {
948
956
  return;
949
957
  }
950
958
  if (!isValidKeyboardEvent(e, pressState.target)) {
951
959
  return;
952
960
  }
953
- if (isMac() && e.key === "Meta" && ((_a = pressState.metaKeyEvents) == null ? void 0 : _a.size)) {
961
+ if (isMac() && e.key === "Meta" && pressState.metaKeyEvents?.size) {
954
962
  for (const [key, event] of pressState.metaKeyEvents) {
955
- (_b = pressState.target) == null ? void 0 : _b.dispatchEvent(
963
+ pressState.target?.dispatchEvent(
956
964
  new KeyboardEvent("keyup", {
957
965
  key,
958
966
  code: event.code,
@@ -987,7 +995,7 @@ function createPress(props = {}) {
987
995
  return;
988
996
  }
989
997
  if (e.button === 0 && !pressState.isTriggeringEvent) {
990
- if (isDisabledValue$2(props.isDisabled)) {
998
+ if (isDisabledValue(props.isDisabled)) {
991
999
  e.preventDefault();
992
1000
  return;
993
1001
  }
@@ -1079,7 +1087,7 @@ function createSyntheticBlurHandler(onBlur) {
1079
1087
  target.addEventListener("focusout", onBlurHandler, { once: true });
1080
1088
  observer = new MutationObserver(() => {
1081
1089
  if (isFocused && target.disabled) {
1082
- observer == null ? void 0 : observer.disconnect();
1090
+ observer?.disconnect();
1083
1091
  const relatedTarget = target === document.activeElement ? null : document.activeElement;
1084
1092
  target.dispatchEvent(new FocusEvent("blur", { relatedTarget }));
1085
1093
  target.dispatchEvent(new FocusEvent("focusout", { bubbles: true, relatedTarget }));
@@ -1117,7 +1125,7 @@ function createFocus(props = {}) {
1117
1125
  };
1118
1126
  const onFocus = (e) => {
1119
1127
  const ownerDocument = getOwnerDocument(e.target);
1120
- const activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement;
1128
+ const activeElement = ownerDocument?.activeElement;
1121
1129
  if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {
1122
1130
  if (onFocusProp) {
1123
1131
  onFocusProp(e);
@@ -1168,7 +1176,7 @@ function createFocusWithin(props = {}) {
1168
1176
  return;
1169
1177
  }
1170
1178
  const ownerDocument = getOwnerDocument(e.target);
1171
- const activeElement = ownerDocument == null ? void 0 : ownerDocument.activeElement;
1179
+ const activeElement = ownerDocument?.activeElement;
1172
1180
  if (!isFocusWithin && activeElement === getEventTarget(e)) {
1173
1181
  if (onFocusWithin) {
1174
1182
  onFocusWithin(e);
@@ -1182,7 +1190,7 @@ function createFocusWithin(props = {}) {
1182
1190
  "focus",
1183
1191
  (focusEvent) => {
1184
1192
  if (isFocusWithin && !nodeContains(currentTarget, focusEvent.target)) {
1185
- const window2 = ownerDocument == null ? void 0 : ownerDocument.defaultView;
1193
+ const window2 = ownerDocument?.defaultView;
1186
1194
  if (window2) {
1187
1195
  const nativeEvent = new window2.FocusEvent("blur", {
1188
1196
  relatedTarget: focusEvent.target
@@ -1218,6 +1226,8 @@ function createFocusWithin(props = {}) {
1218
1226
  }
1219
1227
  };
1220
1228
  }
1229
+
1230
+ // src/interactions/createKeyboard.ts
1221
1231
  function createEventHandler(handler) {
1222
1232
  if (!handler) {
1223
1233
  return void 0;
@@ -1248,16 +1258,15 @@ function createKeyboard(props = {}) {
1248
1258
  }
1249
1259
  };
1250
1260
  }
1251
- const FocusableContext = createContext(null);
1261
+
1262
+ // src/interactions/createFocusable.ts
1263
+ var FocusableContext = createContext(null);
1252
1264
  function useFocusableContext(setRef) {
1253
1265
  const context = useContext(FocusableContext) || {};
1254
- if (context.ref) {
1255
- context.ref;
1256
- }
1257
1266
  const { ref: _, ...otherProps } = context;
1258
1267
  return otherProps;
1259
1268
  }
1260
- function isDisabledValue$1(isDisabled) {
1269
+ function isDisabledValue2(isDisabled) {
1261
1270
  if (typeof isDisabled === "function") {
1262
1271
  return isDisabled();
1263
1272
  }
@@ -1268,22 +1277,22 @@ function createFocusable(props = {}, ref) {
1268
1277
  let autoFocusDone = false;
1269
1278
  const setRef = (el) => {
1270
1279
  elementRef = el;
1271
- ref == null ? void 0 : ref(el);
1280
+ ref?.(el);
1272
1281
  };
1273
1282
  const { focusProps } = createFocus({
1274
- isDisabled: isDisabledValue$1(props.isDisabled),
1283
+ isDisabled: isDisabledValue2(props.isDisabled),
1275
1284
  onFocus: props.onFocus,
1276
1285
  onBlur: props.onBlur,
1277
1286
  onFocusChange: props.onFocusChange
1278
1287
  });
1279
1288
  const { keyboardProps } = createKeyboard({
1280
- isDisabled: isDisabledValue$1(props.isDisabled),
1289
+ isDisabled: isDisabledValue2(props.isDisabled),
1281
1290
  onKeyDown: props.onKeyDown,
1282
1291
  onKeyUp: props.onKeyUp
1283
1292
  });
1284
1293
  const interactions = mergeProps(focusProps, keyboardProps);
1285
1294
  const contextProps = useFocusableContext();
1286
- const interactionProps = isDisabledValue$1(props.isDisabled) ? {} : contextProps;
1295
+ const interactionProps = isDisabledValue2(props.isDisabled) ? {} : contextProps;
1287
1296
  onMount(() => {
1288
1297
  if (props.autoFocus && elementRef && !autoFocusDone) {
1289
1298
  focusSafely(elementRef);
@@ -1291,7 +1300,7 @@ function createFocusable(props = {}, ref) {
1291
1300
  }
1292
1301
  });
1293
1302
  let tabIndex = props.excludeFromTabOrder ? -1 : 0;
1294
- if (isDisabledValue$1(props.isDisabled)) {
1303
+ if (isDisabledValue2(props.isDisabled)) {
1295
1304
  tabIndex = void 0;
1296
1305
  }
1297
1306
  const focusableProps = mergeProps(
@@ -1306,9 +1315,9 @@ function createFocusable(props = {}, ref) {
1306
1315
  focusableProps
1307
1316
  };
1308
1317
  }
1309
- let currentModality = null;
1310
- let hasSetupGlobalListeners = false;
1311
- let changeHandlers = /* @__PURE__ */ new Set();
1318
+ var currentModality = null;
1319
+ var hasSetupGlobalListeners = false;
1320
+ var changeHandlers = /* @__PURE__ */ new Set();
1312
1321
  function triggerChangeHandlers(modality) {
1313
1322
  currentModality = modality;
1314
1323
  for (const handler of changeHandlers) {
@@ -1372,8 +1381,8 @@ function createFocusRing(props = {}) {
1372
1381
  focusProps: focusResult.focusProps
1373
1382
  };
1374
1383
  }
1375
- let globalIgnoreEmulatedMouseEvents = false;
1376
- let hoverCount = 0;
1384
+ var globalIgnoreEmulatedMouseEvents = false;
1385
+ var hoverCount = 0;
1377
1386
  function setGlobalIgnoreEmulatedMouseEvents() {
1378
1387
  globalIgnoreEmulatedMouseEvents = true;
1379
1388
  setTimeout(() => {
@@ -1393,8 +1402,6 @@ function setupGlobalTouchEvents() {
1393
1402
  if (hoverCount === 0) {
1394
1403
  if (typeof PointerEvent !== "undefined") {
1395
1404
  document.addEventListener("pointerup", handleGlobalPointerEvent);
1396
- } else if (process.env.NODE_ENV === "test") {
1397
- document.addEventListener("touchend", setGlobalIgnoreEmulatedMouseEvents);
1398
1405
  }
1399
1406
  }
1400
1407
  hoverCount++;
@@ -1405,13 +1412,11 @@ function setupGlobalTouchEvents() {
1405
1412
  }
1406
1413
  if (typeof PointerEvent !== "undefined") {
1407
1414
  document.removeEventListener("pointerup", handleGlobalPointerEvent);
1408
- } else if (process.env.NODE_ENV === "test") {
1409
- document.removeEventListener("touchend", setGlobalIgnoreEmulatedMouseEvents);
1410
1415
  }
1411
1416
  };
1412
1417
  }
1413
1418
  function createHover(props = {}) {
1414
- const getProps = () => access$1(props);
1419
+ const getProps = () => access(props);
1415
1420
  const [isHovered, setIsHovered] = createSignal(false);
1416
1421
  let state2 = {
1417
1422
  isHovered: false,
@@ -1430,7 +1435,6 @@ function createHover(props = {}) {
1430
1435
  }
1431
1436
  });
1432
1437
  function triggerHoverStart(target, pointerType) {
1433
- var _a, _b;
1434
1438
  const p = getProps();
1435
1439
  state2.pointerType = pointerType;
1436
1440
  if (p.isDisabled || state2.isHovered) {
@@ -1438,16 +1442,15 @@ function createHover(props = {}) {
1438
1442
  }
1439
1443
  state2.isHovered = true;
1440
1444
  state2.target = target;
1441
- (_a = p.onHoverStart) == null ? void 0 : _a.call(p, {
1445
+ p.onHoverStart?.({
1442
1446
  type: "hoverstart",
1443
1447
  target,
1444
1448
  pointerType
1445
1449
  });
1446
- (_b = p.onHoverChange) == null ? void 0 : _b.call(p, true);
1450
+ p.onHoverChange?.(true);
1447
1451
  setIsHovered(true);
1448
1452
  }
1449
1453
  function triggerHoverEnd(target, pointerType) {
1450
- var _a, _b;
1451
1454
  const p = getProps();
1452
1455
  state2.pointerType = "";
1453
1456
  state2.target = null;
@@ -1455,12 +1458,12 @@ function createHover(props = {}) {
1455
1458
  return;
1456
1459
  }
1457
1460
  state2.isHovered = false;
1458
- (_a = p.onHoverEnd) == null ? void 0 : _a.call(p, {
1461
+ p.onHoverEnd?.({
1459
1462
  type: "hoverend",
1460
1463
  target,
1461
1464
  pointerType
1462
1465
  });
1463
- (_b = p.onHoverChange) == null ? void 0 : _b.call(p, false);
1466
+ p.onHoverChange?.(false);
1464
1467
  setIsHovered(false);
1465
1468
  }
1466
1469
  const hoverProps = createMemo(() => {
@@ -1503,7 +1506,9 @@ function createHover(props = {}) {
1503
1506
  isHovered
1504
1507
  };
1505
1508
  }
1506
- function isDisabledValue(isDisabled) {
1509
+
1510
+ // src/button/createButton.ts
1511
+ function isDisabledValue3(isDisabled) {
1507
1512
  if (typeof isDisabled === "function") {
1508
1513
  return isDisabled();
1509
1514
  }
@@ -1527,7 +1532,7 @@ function createButton(props = {}) {
1527
1532
  });
1528
1533
  const isNativeButton = elementType === "button" || elementType === "input";
1529
1534
  const isLink = elementType === "a";
1530
- const disabled = isDisabledValue(props.isDisabled);
1535
+ const disabled = isDisabledValue3(props.isDisabled);
1531
1536
  let additionalProps = {};
1532
1537
  if (isNativeButton) {
1533
1538
  additionalProps = {
@@ -1610,17 +1615,15 @@ function createToggleButton(props = {}) {
1610
1615
  return uncontrolledSelected();
1611
1616
  };
1612
1617
  const toggleSelection = () => {
1613
- var _a;
1614
1618
  const newValue = !isSelected();
1615
1619
  if (!isControlled) {
1616
1620
  setUncontrolledSelected(newValue);
1617
1621
  }
1618
- (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
1622
+ props.onChange?.(newValue);
1619
1623
  };
1620
1624
  const onPress = (e) => {
1621
- var _a;
1622
1625
  toggleSelection();
1623
- (_a = props.onPress) == null ? void 0 : _a.call(props, e);
1626
+ props.onPress?.(e);
1624
1627
  };
1625
1628
  const { buttonProps: baseButtonProps, isPressed } = createButton(
1626
1629
  mergeProps(props, {
@@ -1639,193 +1642,8 @@ function createToggleButton(props = {}) {
1639
1642
  isSelected
1640
1643
  };
1641
1644
  }
1642
- function access(value) {
1643
- return typeof value === "function" ? value() : value;
1644
- }
1645
- function createToggleState(props = {}) {
1646
- const getProps = () => access(props);
1647
- const initialProps = getProps();
1648
- const initialSelected = initialProps.isSelected ?? initialProps.defaultSelected ?? false;
1649
- const [internalSelected, setInternalSelected] = createSignal(initialSelected);
1650
- const isControlled = () => getProps().isSelected !== void 0;
1651
- const isSelected = () => {
1652
- const p = getProps();
1653
- return isControlled() ? p.isSelected ?? false : internalSelected();
1654
- };
1655
- function setSelected(value) {
1656
- var _a;
1657
- const p = getProps();
1658
- if (p.isReadOnly) {
1659
- return;
1660
- }
1661
- if (!isControlled()) {
1662
- setInternalSelected(value);
1663
- }
1664
- (_a = p.onChange) == null ? void 0 : _a.call(p, value);
1665
- }
1666
- function toggle() {
1667
- const p = getProps();
1668
- if (p.isReadOnly) {
1669
- return;
1670
- }
1671
- setSelected(!isSelected());
1672
- }
1673
- return {
1674
- isSelected,
1675
- defaultSelected: initialProps.defaultSelected ?? initialSelected,
1676
- setSelected,
1677
- toggle
1678
- };
1679
- }
1680
- function createCheckboxGroupState(props = {}) {
1681
- const getProps = () => access(props);
1682
- const initialProps = getProps();
1683
- const initialValue = initialProps.value ?? initialProps.defaultValue ?? [];
1684
- const [internalValue, setInternalValue] = createSignal(initialValue);
1685
- const isControlled = () => getProps().value !== void 0;
1686
- const value = () => {
1687
- const p = getProps();
1688
- return isControlled() ? p.value ?? [] : internalValue();
1689
- };
1690
- const isRequired = () => {
1691
- const p = getProps();
1692
- return !!p.isRequired && value().length === 0;
1693
- };
1694
- const isInvalid = () => {
1695
- return getProps().isInvalid ?? false;
1696
- };
1697
- function setValue(newValue) {
1698
- var _a;
1699
- const p = getProps();
1700
- if (p.isReadOnly || p.isDisabled) {
1701
- return;
1702
- }
1703
- if (!isControlled()) {
1704
- setInternalValue(newValue);
1705
- }
1706
- (_a = p.onChange) == null ? void 0 : _a.call(p, newValue);
1707
- }
1708
- function isSelected(checkValue) {
1709
- return value().includes(checkValue);
1710
- }
1711
- function addValue(addVal) {
1712
- const p = getProps();
1713
- if (p.isReadOnly || p.isDisabled) {
1714
- return;
1715
- }
1716
- const current = value();
1717
- if (!current.includes(addVal)) {
1718
- setValue([...current, addVal]);
1719
- }
1720
- }
1721
- function removeValue(removeVal) {
1722
- const p = getProps();
1723
- if (p.isReadOnly || p.isDisabled) {
1724
- return;
1725
- }
1726
- const current = value();
1727
- if (current.includes(removeVal)) {
1728
- setValue(current.filter((v) => v !== removeVal));
1729
- }
1730
- }
1731
- function toggleValue(toggleVal) {
1732
- const p = getProps();
1733
- if (p.isReadOnly || p.isDisabled) {
1734
- return;
1735
- }
1736
- const current = value();
1737
- if (current.includes(toggleVal)) {
1738
- setValue(current.filter((v) => v !== toggleVal));
1739
- } else {
1740
- setValue([...current, toggleVal]);
1741
- }
1742
- }
1743
- return {
1744
- value,
1745
- defaultValue: initialProps.defaultValue ?? initialValue,
1746
- get isDisabled() {
1747
- return getProps().isDisabled ?? false;
1748
- },
1749
- get isReadOnly() {
1750
- return getProps().isReadOnly ?? false;
1751
- },
1752
- get isInvalid() {
1753
- return isInvalid();
1754
- },
1755
- isRequired,
1756
- isSelected,
1757
- setValue,
1758
- addValue,
1759
- removeValue,
1760
- toggleValue
1761
- };
1762
- }
1763
- function createId$1(defaultId) {
1764
- return `solid-stately-${createUniqueId()}`;
1765
- }
1766
- const radioGroupSyncVersion = /* @__PURE__ */ new WeakMap();
1767
- function createRadioGroupState(props = {}) {
1768
- const getProps = () => access(props);
1769
- const initialProps = untrack(() => getProps());
1770
- const name = initialProps.name || `radio-group-${createId$1()}`;
1771
- const [internalValue, setInternalValue] = createSignal(
1772
- initialProps.defaultValue ?? null
1773
- );
1774
- const [lastFocusedValue, setLastFocusedValueInternal] = createSignal(null);
1775
- const [syncVersion, setSyncVersion] = createSignal(0);
1776
- const isControlled = () => getProps().value !== void 0;
1777
- const selectedValue = () => {
1778
- const p = getProps();
1779
- if (p.value !== void 0) {
1780
- return p.value ?? null;
1781
- }
1782
- return internalValue();
1783
- };
1784
- const isInvalid = () => {
1785
- return getProps().isInvalid ?? false;
1786
- };
1787
- function setSelectedValue(value) {
1788
- var _a;
1789
- const p = getProps();
1790
- if (p.isReadOnly || p.isDisabled) {
1791
- return;
1792
- }
1793
- setSyncVersion((v) => v + 1);
1794
- if (!isControlled()) {
1795
- setInternalValue(value);
1796
- }
1797
- if (value != null) {
1798
- (_a = p.onChange) == null ? void 0 : _a.call(p, value);
1799
- }
1800
- }
1801
- function setLastFocusedValue(value) {
1802
- setLastFocusedValueInternal(value);
1803
- }
1804
- const state2 = {
1805
- name,
1806
- selectedValue,
1807
- defaultSelectedValue: initialProps.defaultValue ?? null,
1808
- setSelectedValue,
1809
- lastFocusedValue,
1810
- setLastFocusedValue,
1811
- get isDisabled() {
1812
- return getProps().isDisabled ?? false;
1813
- },
1814
- get isReadOnly() {
1815
- return getProps().isReadOnly ?? false;
1816
- },
1817
- get isRequired() {
1818
- return getProps().isRequired ?? false;
1819
- },
1820
- get isInvalid() {
1821
- return isInvalid();
1822
- }
1823
- };
1824
- radioGroupSyncVersion.set(state2, syncVersion);
1825
- return state2;
1826
- }
1827
1645
  function createToggle(props, state2, ref) {
1828
- const getProps = () => access$1(props);
1646
+ const getProps = () => access(props);
1829
1647
  const isDisabled = () => getProps().isDisabled ?? false;
1830
1648
  const isReadOnly = () => getProps().isReadOnly ?? false;
1831
1649
  const isInvalid = () => {
@@ -1865,10 +1683,9 @@ function createToggle(props, state2, ref) {
1865
1683
  return getProps().onPressUp;
1866
1684
  },
1867
1685
  onPress(e) {
1868
- var _a, _b, _c;
1869
- (_b = (_a = getProps()).onPress) == null ? void 0 : _b.call(_a, e);
1686
+ getProps().onPress?.(e);
1870
1687
  state2.toggle();
1871
- (_c = ref()) == null ? void 0 : _c.focus();
1688
+ ref()?.focus();
1872
1689
  },
1873
1690
  get isDisabled() {
1874
1691
  return isDisabled() || isReadOnly();
@@ -1914,7 +1731,7 @@ function createToggle(props, state2, ref) {
1914
1731
  const p = getProps();
1915
1732
  const hasChildren = p.children != null;
1916
1733
  const hasAriaLabel = p["aria-label"] != null || p["aria-labelledby"] != null;
1917
- if (!hasChildren && !hasAriaLabel && process.env.NODE_ENV !== "production") {
1734
+ if (!hasChildren && !hasAriaLabel && true) {
1918
1735
  console.warn("If you do not provide children, you must specify an aria-label for accessibility");
1919
1736
  }
1920
1737
  });
@@ -1949,8 +1766,10 @@ function createToggle(props, state2, ref) {
1949
1766
  isInvalid: isInvalid()
1950
1767
  };
1951
1768
  }
1769
+
1770
+ // src/checkbox/createCheckbox.ts
1952
1771
  function createCheckbox(props, state2, inputRef) {
1953
- const getProps = () => access$1(props);
1772
+ const getProps = () => access(props);
1954
1773
  const toggleResult = createToggle(props, state2, inputRef);
1955
1774
  const {
1956
1775
  labelProps: baseLabelProps,
@@ -2009,7 +1828,9 @@ function createId(defaultId) {
2009
1828
  }
2010
1829
  return `solidaria-${createUniqueId()}`;
2011
1830
  }
2012
- const canUseDOM = !isServer;
1831
+ var canUseDOM = !isServer;
1832
+
1833
+ // src/label/createLabels.ts
2013
1834
  function createLabels(props, defaultLabel) {
2014
1835
  let {
2015
1836
  id,
@@ -2032,8 +1853,10 @@ function createLabels(props, defaultLabel) {
2032
1853
  "aria-labelledby": labelledBy
2033
1854
  };
2034
1855
  }
1856
+
1857
+ // src/label/createLabel.ts
2035
1858
  function createLabel(props) {
2036
- const getProps = () => access$1(props);
1859
+ const getProps = () => access(props);
2037
1860
  const id = createId(getProps().id);
2038
1861
  const labelId = createId();
2039
1862
  const getLabelProps = () => {
@@ -2055,7 +1878,7 @@ function createLabel(props) {
2055
1878
  let labelledBy = ariaLabelledby;
2056
1879
  if (label) {
2057
1880
  labelledBy = ariaLabelledby ? `${labelId} ${ariaLabelledby}` : labelId;
2058
- } else if (!ariaLabelledby && !ariaLabel && process.env.NODE_ENV !== "production") {
1881
+ } else if (!ariaLabelledby && !ariaLabel && true) {
2059
1882
  console.warn(
2060
1883
  "If you do not provide a visible label, you must specify an aria-label or aria-labelledby attribute for accessibility"
2061
1884
  );
@@ -2075,8 +1898,10 @@ function createLabel(props) {
2075
1898
  }
2076
1899
  };
2077
1900
  }
1901
+
1902
+ // src/label/createField.ts
2078
1903
  function createField(props) {
2079
- const getProps = () => access$1(props);
1904
+ const getProps = () => access(props);
2080
1905
  const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);
2081
1906
  const descriptionId = createId();
2082
1907
  const errorMessageId = createId();
@@ -2131,9 +1956,11 @@ function createField(props) {
2131
1956
  }
2132
1957
  };
2133
1958
  }
2134
- const checkboxGroupData = /* @__PURE__ */ new WeakMap();
1959
+
1960
+ // src/checkbox/createCheckboxGroup.ts
1961
+ var checkboxGroupData = /* @__PURE__ */ new WeakMap();
2135
1962
  function createCheckboxGroup(props, state2) {
2136
- const getProps = () => access$1(props);
1963
+ const getProps = () => access(props);
2137
1964
  const isInvalid = () => state2.isInvalid;
2138
1965
  const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({
2139
1966
  get label() {
@@ -2206,20 +2033,21 @@ function createCheckboxGroup(props, state2) {
2206
2033
  }
2207
2034
  };
2208
2035
  }
2036
+
2037
+ // src/checkbox/createCheckboxGroupItem.ts
2209
2038
  function createCheckboxGroupItem(props, state2, inputRef) {
2210
- const getProps = () => access$1(props);
2039
+ const getProps = () => access(props);
2211
2040
  const toggleState = {
2212
2041
  isSelected: () => state2.isSelected(getProps().value),
2213
2042
  defaultSelected: state2.defaultValue.includes(getProps().value),
2214
2043
  setSelected(isSelected) {
2215
- var _a, _b;
2216
2044
  const value = getProps().value;
2217
2045
  if (isSelected) {
2218
2046
  state2.addValue(value);
2219
2047
  } else {
2220
2048
  state2.removeValue(value);
2221
2049
  }
2222
- (_b = (_a = getProps()).onChange) == null ? void 0 : _b.call(_a, isSelected);
2050
+ getProps().onChange?.(isSelected);
2223
2051
  },
2224
2052
  toggle() {
2225
2053
  state2.toggleValue(getProps().value);
@@ -2233,10 +2061,10 @@ function createCheckboxGroupItem(props, state2, inputRef) {
2233
2061
  ...p,
2234
2062
  isReadOnly: p.isReadOnly ?? state2.isReadOnly,
2235
2063
  isDisabled: p.isDisabled ?? state2.isDisabled,
2236
- name: p.name ?? (groupData == null ? void 0 : groupData.name),
2237
- form: p.form ?? (groupData == null ? void 0 : groupData.form),
2064
+ name: p.name ?? groupData?.name,
2065
+ form: p.form ?? groupData?.form,
2238
2066
  isRequired: p.isRequired ?? state2.isRequired(),
2239
- validationBehavior: p.validationBehavior ?? (groupData == null ? void 0 : groupData.validationBehavior) ?? "aria"
2067
+ validationBehavior: p.validationBehavior ?? groupData?.validationBehavior ?? "aria"
2240
2068
  };
2241
2069
  };
2242
2070
  const result = createCheckbox(checkboxProps, toggleState, inputRef);
@@ -2250,10 +2078,10 @@ function createCheckboxGroupItem(props, state2, inputRef) {
2250
2078
  if (propsDescribedBy) {
2251
2079
  describedByIds.push(propsDescribedBy);
2252
2080
  }
2253
- if (state2.isInvalid && (groupData == null ? void 0 : groupData.errorMessageId)) {
2081
+ if (state2.isInvalid && groupData?.errorMessageId) {
2254
2082
  describedByIds.push(groupData.errorMessageId);
2255
2083
  }
2256
- if (groupData == null ? void 0 : groupData.descriptionId) {
2084
+ if (groupData?.descriptionId) {
2257
2085
  describedByIds.push(groupData.descriptionId);
2258
2086
  }
2259
2087
  const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(" ") : void 0;
@@ -2264,9 +2092,11 @@ function createCheckboxGroupItem(props, state2, inputRef) {
2264
2092
  }
2265
2093
  };
2266
2094
  }
2267
- const radioGroupData = /* @__PURE__ */ new WeakMap();
2095
+
2096
+ // src/radio/createRadioGroup.ts
2097
+ var radioGroupData = /* @__PURE__ */ new WeakMap();
2268
2098
  function createRadioGroup(props, state2) {
2269
- const getProps = () => access$1(props);
2099
+ const getProps = () => access(props);
2270
2100
  const orientation = () => getProps().orientation ?? "vertical";
2271
2101
  const isReadOnly = () => getProps().isReadOnly ?? false;
2272
2102
  const isRequired = () => getProps().isRequired ?? false;
@@ -2291,20 +2121,13 @@ function createRadioGroup(props, state2) {
2291
2121
  });
2292
2122
  const { focusWithinProps } = createFocusWithin({
2293
2123
  onBlurWithin(e) {
2294
- var _a, _b;
2295
- (_b = (_a = getProps()).onBlur) == null ? void 0 : _b.call(_a, e);
2124
+ getProps().onBlur?.(e);
2296
2125
  if (!state2.selectedValue()) {
2297
2126
  state2.setLastFocusedValue(null);
2298
2127
  }
2299
2128
  },
2300
- onFocusWithin: (e) => {
2301
- var _a, _b;
2302
- return (_b = (_a = getProps()).onFocus) == null ? void 0 : _b.call(_a, e);
2303
- },
2304
- onFocusWithinChange: (isFocused) => {
2305
- var _a, _b;
2306
- return (_b = (_a = getProps()).onFocusChange) == null ? void 0 : _b.call(_a, isFocused);
2307
- }
2129
+ onFocusWithin: (e) => getProps().onFocus?.(e),
2130
+ onFocusWithinChange: (isFocused) => getProps().onFocusChange?.(isFocused)
2308
2131
  });
2309
2132
  const domProps = () => filterDOMProps(getProps(), { labelable: true });
2310
2133
  const groupName = getProps().name ?? createId();
@@ -2350,7 +2173,7 @@ function createRadioGroup(props, state2) {
2350
2173
  };
2351
2174
  }
2352
2175
  function createRadio(props, state2, ref) {
2353
- const getProps = () => access$1(props);
2176
+ const getProps = () => access(props);
2354
2177
  const isDisabled = () => getProps().isDisabled || state2.isDisabled;
2355
2178
  const value = () => getProps().value;
2356
2179
  const isSelected = () => {
@@ -2362,7 +2185,7 @@ function createRadio(props, state2, ref) {
2362
2185
  const p = getProps();
2363
2186
  const hasChildren = p.children != null;
2364
2187
  const hasAriaLabel = p["aria-label"] != null || p["aria-labelledby"] != null;
2365
- if (!hasChildren && !hasAriaLabel && process.env.NODE_ENV !== "production") {
2188
+ if (!hasChildren && !hasAriaLabel && true) {
2366
2189
  console.warn("If you do not provide children, you must specify an aria-label for accessibility");
2367
2190
  }
2368
2191
  });
@@ -2370,7 +2193,7 @@ function createRadio(props, state2, ref) {
2370
2193
  const inputEl = ref();
2371
2194
  if (!inputEl) return;
2372
2195
  const syncVersion = radioGroupSyncVersion.get(state2);
2373
- syncVersion == null ? void 0 : syncVersion();
2196
+ syncVersion?.();
2374
2197
  const shouldBeChecked = isSelected();
2375
2198
  if (inputEl.checked !== shouldBeChecked) {
2376
2199
  inputEl.checked = shouldBeChecked;
@@ -2421,10 +2244,9 @@ function createRadio(props, state2, ref) {
2421
2244
  return getProps().onPressUp;
2422
2245
  },
2423
2246
  onPress(e) {
2424
- var _a, _b, _c;
2425
- (_b = (_a = getProps()).onPress) == null ? void 0 : _b.call(_a, e);
2247
+ getProps().onPress?.(e);
2426
2248
  state2.setSelectedValue(value());
2427
- (_c = ref()) == null ? void 0 : _c.focus();
2249
+ ref()?.focus();
2428
2250
  },
2429
2251
  get isDisabled() {
2430
2252
  return isDisabled();
@@ -2438,8 +2260,7 @@ function createRadio(props, state2, ref) {
2438
2260
  return getProps().autoFocus;
2439
2261
  },
2440
2262
  onFocus(e) {
2441
- var _a, _b;
2442
- (_b = (_a = getProps()).onFocus) == null ? void 0 : _b.call(_a, e);
2263
+ getProps().onFocus?.(e);
2443
2264
  state2.setLastFocusedValue(value());
2444
2265
  },
2445
2266
  get onBlur() {
@@ -2490,20 +2311,20 @@ function createRadio(props, state2, ref) {
2490
2311
  if (p["aria-describedby"]) {
2491
2312
  describedByIds.push(p["aria-describedby"]);
2492
2313
  }
2493
- if (state2.isInvalid && (groupData == null ? void 0 : groupData.errorMessageId)) {
2314
+ if (state2.isInvalid && groupData?.errorMessageId) {
2494
2315
  describedByIds.push(groupData.errorMessageId);
2495
2316
  }
2496
- if (groupData == null ? void 0 : groupData.descriptionId) {
2317
+ if (groupData?.descriptionId) {
2497
2318
  describedByIds.push(groupData.descriptionId);
2498
2319
  }
2499
2320
  const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(" ") : void 0;
2500
2321
  return mergeProps(domProps(), interactions, {
2501
2322
  type: "radio",
2502
- name: groupData == null ? void 0 : groupData.name,
2503
- form: groupData == null ? void 0 : groupData.form,
2323
+ name: groupData?.name,
2324
+ form: groupData?.form,
2504
2325
  tabIndex: getTabIndex(),
2505
2326
  disabled: isDisabled(),
2506
- required: state2.isRequired && (groupData == null ? void 0 : groupData.validationBehavior) === "native",
2327
+ required: state2.isRequired && groupData?.validationBehavior === "native",
2507
2328
  checked: isSelected(),
2508
2329
  value: value(),
2509
2330
  onChange,
@@ -2515,6 +2336,8 @@ function createRadio(props, state2, ref) {
2515
2336
  isPressed: combinedIsPressed
2516
2337
  };
2517
2338
  }
2339
+
2340
+ // src/switch/createSwitch.ts
2518
2341
  function createSwitch(props, state2, ref) {
2519
2342
  const toggle = createToggle(props, state2, ref);
2520
2343
  return {
@@ -2533,8 +2356,10 @@ function createSwitch(props, state2, ref) {
2533
2356
  isReadOnly: toggle.isReadOnly
2534
2357
  };
2535
2358
  }
2359
+
2360
+ // src/link/createLink.ts
2536
2361
  function createLink(props = {}) {
2537
- const getProps = () => access$1(props);
2362
+ const getProps = () => access(props);
2538
2363
  const isDisabled = () => getProps().isDisabled ?? false;
2539
2364
  const elementType = () => getProps().elementType ?? "a";
2540
2365
  const { pressProps, isPressed } = createPress({
@@ -2606,12 +2431,11 @@ function createLink(props = {}) {
2606
2431
  ariaProps["aria-describedby"] = p["aria-describedby"];
2607
2432
  }
2608
2433
  const onClick = (e) => {
2609
- var _a;
2610
2434
  if (disabled) {
2611
2435
  e.preventDefault();
2612
2436
  return;
2613
2437
  }
2614
- (_a = p.onClick) == null ? void 0 : _a.call(p, e);
2438
+ p.onClick?.(e);
2615
2439
  };
2616
2440
  return mergeProps(
2617
2441
  filterDOMProps(p, { labelable: true }),
@@ -2629,8 +2453,10 @@ function createLink(props = {}) {
2629
2453
  isPressed
2630
2454
  };
2631
2455
  }
2456
+
2457
+ // src/textfield/createTextField.ts
2632
2458
  function createTextField(props, ref) {
2633
- const getProps = () => access$1(props);
2459
+ const getProps = () => access(props);
2634
2460
  const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField(props);
2635
2461
  const { focusableProps } = createFocusable(
2636
2462
  {
@@ -2663,9 +2489,8 @@ function createTextField(props, ref) {
2663
2489
  "aria-invalid": isInvalid || void 0,
2664
2490
  value: p.value ?? p.defaultValue ?? "",
2665
2491
  onChange: (e) => {
2666
- var _a;
2667
2492
  const target = e.target;
2668
- (_a = p.onChange) == null ? void 0 : _a.call(p, target.value);
2493
+ p.onChange?.(target.value);
2669
2494
  },
2670
2495
  // Don't include type and pattern for textarea elements
2671
2496
  type: isTextarea ? void 0 : p.type ?? "text",
@@ -2718,11 +2543,13 @@ function createTextField(props, ref) {
2718
2543
  }
2719
2544
  };
2720
2545
  }
2546
+
2547
+ // src/progress/createProgressBar.ts
2721
2548
  function clamp(value, min, max) {
2722
2549
  return Math.min(Math.max(value, min), max);
2723
2550
  }
2724
2551
  function createProgressBar(props = {}) {
2725
- const getProps = () => access$1(props);
2552
+ const getProps = () => access(props);
2726
2553
  const { labelProps, fieldProps } = createLabel({
2727
2554
  get label() {
2728
2555
  return getProps().label;
@@ -2774,9 +2601,11 @@ function createProgressBar(props = {}) {
2774
2601
  }
2775
2602
  };
2776
2603
  }
2604
+
2605
+ // src/separator/createSeparator.ts
2777
2606
  function createSeparator(props = {}) {
2778
2607
  const getSeparatorProps = () => {
2779
- const p = access$1(props);
2608
+ const p = access(props);
2780
2609
  const domProps = filterDOMProps(p, { labelable: true });
2781
2610
  let ariaOrientation;
2782
2611
  if (p.orientation === "vertical") {
@@ -2797,38 +2626,5 @@ function createSeparator(props = {}) {
2797
2626
  }
2798
2627
  };
2799
2628
  }
2800
- export {
2801
- access$1 as access,
2802
- canUseDOM,
2803
- checkboxGroupData,
2804
- createButton,
2805
- createCheckbox,
2806
- createCheckboxGroup,
2807
- createCheckboxGroupItem,
2808
- createCheckboxGroupState,
2809
- createField,
2810
- createFocusRing,
2811
- createFocusable,
2812
- createHover,
2813
- createId,
2814
- createIsSSR,
2815
- createLabel,
2816
- createLabels,
2817
- createLink,
2818
- createPress,
2819
- createProgressBar,
2820
- createRadio,
2821
- createRadioGroup,
2822
- createRadioGroupState,
2823
- createSeparator,
2824
- createSwitch,
2825
- createTextField,
2826
- createToggle,
2827
- createToggleButton,
2828
- createToggleState,
2829
- filterDOMProps,
2830
- isAccessor,
2831
- mergeProps,
2832
- radioGroupData
2833
- };
2834
- //# sourceMappingURL=index.js.map
2629
+
2630
+ export { access, canUseDOM, checkboxGroupData, createButton, createCheckbox, createCheckboxGroup, createCheckboxGroupItem, createField, createFocusRing, createFocusable, createHover, createId, createIsSSR, createLabel, createLabels, createLink, createPress, createProgressBar, createRadio, createRadioGroup, createSeparator, createSwitch, createTextField, createToggle, createToggleButton, filterDOMProps, isAccessor, mergeProps, radioGroupData };