@proyecto-viviana/solidaria 0.0.2 → 0.0.4
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.
- package/dist/index.js +161 -192
- package/dist/index.js.map +1 -1
- package/package.json +52 -51
package/dist/index.js
CHANGED
|
@@ -1,36 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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";
|
|
1
|
+
import { onCleanup, createSignal, onMount, useContext, createContext, createEffect, createMemo, untrack, createUniqueId } from 'solid-js';
|
|
2
|
+
import { isServer } from 'solid-js/web';
|
|
3
|
+
|
|
14
4
|
class PressEvent {
|
|
5
|
+
type;
|
|
6
|
+
pointerType;
|
|
7
|
+
target;
|
|
8
|
+
shiftKey;
|
|
9
|
+
ctrlKey;
|
|
10
|
+
metaKey;
|
|
11
|
+
altKey;
|
|
12
|
+
x;
|
|
13
|
+
y;
|
|
14
|
+
#shouldStopPropagation = true;
|
|
15
15
|
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
16
|
this.type = type;
|
|
27
17
|
this.pointerType = pointerType;
|
|
28
18
|
this.target = target;
|
|
29
19
|
const e = originalEvent;
|
|
30
|
-
this.shiftKey =
|
|
31
|
-
this.ctrlKey =
|
|
32
|
-
this.metaKey =
|
|
33
|
-
this.altKey =
|
|
20
|
+
this.shiftKey = e?.shiftKey ?? false;
|
|
21
|
+
this.ctrlKey = e?.ctrlKey ?? false;
|
|
22
|
+
this.metaKey = e?.metaKey ?? false;
|
|
23
|
+
this.altKey = e?.altKey ?? false;
|
|
34
24
|
this.x = 0;
|
|
35
25
|
this.y = 0;
|
|
36
26
|
if (originalEvent && "clientX" in originalEvent && target) {
|
|
@@ -48,28 +38,27 @@ class PressEvent {
|
|
|
48
38
|
* By default, press events stop propagation.
|
|
49
39
|
*/
|
|
50
40
|
continuePropagation() {
|
|
51
|
-
|
|
41
|
+
this.#shouldStopPropagation = false;
|
|
52
42
|
}
|
|
53
43
|
/**
|
|
54
44
|
* Whether the event should stop propagation.
|
|
55
45
|
* Used internally by the press handler.
|
|
56
46
|
*/
|
|
57
47
|
get shouldStopPropagation() {
|
|
58
|
-
return
|
|
48
|
+
return this.#shouldStopPropagation;
|
|
59
49
|
}
|
|
60
50
|
}
|
|
61
|
-
_shouldStopPropagation = new WeakMap();
|
|
62
51
|
function createPressEvent(type, pointerType, originalEvent, target) {
|
|
63
52
|
return new PressEvent(type, pointerType, originalEvent, target);
|
|
64
53
|
}
|
|
54
|
+
|
|
65
55
|
function mergeProps(...args) {
|
|
66
|
-
var _a;
|
|
67
56
|
const result = {};
|
|
68
57
|
for (const props of args) {
|
|
69
58
|
for (const key in props) {
|
|
70
59
|
const value = props[key];
|
|
71
60
|
const existingValue = result[key];
|
|
72
|
-
if (typeof existingValue === "function" && typeof value === "function" && key.startsWith("on") && key[2] ===
|
|
61
|
+
if (typeof existingValue === "function" && typeof value === "function" && key.startsWith("on") && key[2] === key[2]?.toUpperCase()) {
|
|
73
62
|
result[key] = chainHandlers(existingValue, value);
|
|
74
63
|
} else if (key === "class" || key === "className") {
|
|
75
64
|
result[key] = mergeClassNames(existingValue, value);
|
|
@@ -91,6 +80,7 @@ function chainHandlers(existingHandler, newHandler) {
|
|
|
91
80
|
function mergeClassNames(...classes) {
|
|
92
81
|
return classes.filter(Boolean).join(" ");
|
|
93
82
|
}
|
|
83
|
+
|
|
94
84
|
const DOMPropNames = /* @__PURE__ */ new Set(["id"]);
|
|
95
85
|
const labelablePropNames = /* @__PURE__ */ new Set([
|
|
96
86
|
"aria-label",
|
|
@@ -149,21 +139,22 @@ function filterDOMProps(props, opts = {}) {
|
|
|
149
139
|
const { labelable, isLink, global, events = global, propNames } = opts;
|
|
150
140
|
const filteredProps = {};
|
|
151
141
|
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))) ||
|
|
142
|
+
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
143
|
filteredProps[prop] = props[prop];
|
|
154
144
|
}
|
|
155
145
|
}
|
|
156
146
|
return filteredProps;
|
|
157
147
|
}
|
|
148
|
+
|
|
158
149
|
function access$1(value) {
|
|
159
150
|
return typeof value === "function" ? value() : value;
|
|
160
151
|
}
|
|
161
152
|
function isAccessor(value) {
|
|
162
153
|
return typeof value === "function";
|
|
163
154
|
}
|
|
155
|
+
|
|
164
156
|
function testPlatform(re) {
|
|
165
|
-
|
|
166
|
-
return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform || ((_a = window.navigator.userAgentData) == null ? void 0 : _a.platform) || "") : false;
|
|
157
|
+
return typeof window !== "undefined" && window.navigator != null ? re.test(window.navigator.platform || window.navigator.userAgentData?.platform || "") : false;
|
|
167
158
|
}
|
|
168
159
|
function isMac() {
|
|
169
160
|
return testPlatform(/^Mac/i);
|
|
@@ -177,8 +168,9 @@ function isIPad() {
|
|
|
177
168
|
function isIOS() {
|
|
178
169
|
return isIPhone() || isIPad();
|
|
179
170
|
}
|
|
171
|
+
|
|
180
172
|
function getOwnerDocument(el) {
|
|
181
|
-
return
|
|
173
|
+
return el?.ownerDocument ?? document;
|
|
182
174
|
}
|
|
183
175
|
function nodeContains(parent, child) {
|
|
184
176
|
if (!parent || !child) {
|
|
@@ -279,14 +271,15 @@ function shouldPreventDefaultKeyboard(target, key) {
|
|
|
279
271
|
function openLink(target, event, allowOpener = false) {
|
|
280
272
|
const { href, target: linkTarget, rel } = target;
|
|
281
273
|
const keyEvent = event;
|
|
282
|
-
const shouldOpenInNewTab = linkTarget === "_blank" ||
|
|
274
|
+
const shouldOpenInNewTab = linkTarget === "_blank" || keyEvent?.metaKey || keyEvent?.ctrlKey || keyEvent?.shiftKey || keyEvent?.altKey;
|
|
283
275
|
if (shouldOpenInNewTab) {
|
|
284
|
-
const features = !allowOpener &&
|
|
276
|
+
const features = !allowOpener && rel?.includes("noopener") ? "noopener" : void 0;
|
|
285
277
|
window.open(href, linkTarget || "_blank", features);
|
|
286
278
|
} else {
|
|
287
279
|
window.location.href = href;
|
|
288
280
|
}
|
|
289
281
|
}
|
|
282
|
+
|
|
290
283
|
function areRectanglesOverlapping(a, b) {
|
|
291
284
|
if (a.left > b.right || b.left > a.right) {
|
|
292
285
|
return false;
|
|
@@ -349,6 +342,7 @@ function getTouchById(event, pointerId) {
|
|
|
349
342
|
}
|
|
350
343
|
return null;
|
|
351
344
|
}
|
|
345
|
+
|
|
352
346
|
function isVirtualClick(event) {
|
|
353
347
|
if (event.mozInputSource === 0 && event.isTrusted) {
|
|
354
348
|
return true;
|
|
@@ -377,6 +371,7 @@ function setEventTarget(event, target) {
|
|
|
377
371
|
configurable: true
|
|
378
372
|
});
|
|
379
373
|
}
|
|
374
|
+
|
|
380
375
|
let state = "default";
|
|
381
376
|
let savedUserSelect = "";
|
|
382
377
|
let modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
@@ -444,6 +439,7 @@ function runAfterTransition(callback) {
|
|
|
444
439
|
transitionTimeout = null;
|
|
445
440
|
}, 0);
|
|
446
441
|
}
|
|
442
|
+
|
|
447
443
|
function focusWithoutScrolling(element) {
|
|
448
444
|
if (!element) return;
|
|
449
445
|
try {
|
|
@@ -483,13 +479,13 @@ let preventFocusTimeout = null;
|
|
|
483
479
|
function preventFocus(target) {
|
|
484
480
|
const focusableAncestor = findFocusableAncestor(target);
|
|
485
481
|
if (!focusableAncestor) return;
|
|
486
|
-
const
|
|
487
|
-
const activeElement =
|
|
482
|
+
const document = getOwnerDocument(target);
|
|
483
|
+
const activeElement = document.activeElement;
|
|
488
484
|
ignoreFocus = true;
|
|
489
485
|
const onFocus = (e) => {
|
|
490
486
|
if (ignoreFocus) {
|
|
491
487
|
e.stopImmediatePropagation();
|
|
492
|
-
if (activeElement && activeElement !==
|
|
488
|
+
if (activeElement && activeElement !== document.body) {
|
|
493
489
|
activeElement.focus();
|
|
494
490
|
}
|
|
495
491
|
}
|
|
@@ -527,10 +523,11 @@ function findFocusableAncestor(element) {
|
|
|
527
523
|
return element;
|
|
528
524
|
}
|
|
529
525
|
const focusSafely = focusWithoutScrolling;
|
|
526
|
+
|
|
530
527
|
function createGlobalListeners() {
|
|
531
528
|
const listeners = [];
|
|
532
529
|
function addGlobalListener(type, handler, options) {
|
|
533
|
-
const target =
|
|
530
|
+
const target = options?.isWindow ? window : document;
|
|
534
531
|
const listenerOptions = options ? {
|
|
535
532
|
capture: options.capture,
|
|
536
533
|
passive: options.passive,
|
|
@@ -540,16 +537,13 @@ function createGlobalListeners() {
|
|
|
540
537
|
listeners.push({ target, type, handler, options: listenerOptions });
|
|
541
538
|
}
|
|
542
539
|
function removeGlobalListener(type, handler, options) {
|
|
543
|
-
const target =
|
|
540
|
+
const target = options?.isWindow ? window : document;
|
|
544
541
|
const listenerOptions = options ? {
|
|
545
542
|
capture: options.capture
|
|
546
543
|
} : void 0;
|
|
547
544
|
target.removeEventListener(type, handler, listenerOptions);
|
|
548
545
|
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
|
-
}
|
|
546
|
+
(l) => l.target === target && l.type === type && l.handler === handler && l.options?.capture === listenerOptions?.capture
|
|
553
547
|
);
|
|
554
548
|
if (index !== -1) {
|
|
555
549
|
listeners.splice(index, 1);
|
|
@@ -568,6 +562,7 @@ function createGlobalListeners() {
|
|
|
568
562
|
removeAllGlobalListeners
|
|
569
563
|
};
|
|
570
564
|
}
|
|
565
|
+
|
|
571
566
|
function isDisabledValue$2(isDisabled) {
|
|
572
567
|
if (typeof isDisabled === "function") {
|
|
573
568
|
return isDisabled();
|
|
@@ -943,16 +938,15 @@ function createPress(props = {}) {
|
|
|
943
938
|
addGlobalListener("keyup", onKeyUp, { capture: true });
|
|
944
939
|
};
|
|
945
940
|
const onKeyUp = (e) => {
|
|
946
|
-
var _a, _b;
|
|
947
941
|
if (!pressState.isPressed || pressState.pointerType !== "keyboard") {
|
|
948
942
|
return;
|
|
949
943
|
}
|
|
950
944
|
if (!isValidKeyboardEvent(e, pressState.target)) {
|
|
951
945
|
return;
|
|
952
946
|
}
|
|
953
|
-
if (isMac() && e.key === "Meta" &&
|
|
947
|
+
if (isMac() && e.key === "Meta" && pressState.metaKeyEvents?.size) {
|
|
954
948
|
for (const [key, event] of pressState.metaKeyEvents) {
|
|
955
|
-
|
|
949
|
+
pressState.target?.dispatchEvent(
|
|
956
950
|
new KeyboardEvent("keyup", {
|
|
957
951
|
key,
|
|
958
952
|
code: event.code,
|
|
@@ -1060,6 +1054,7 @@ function createPress(props = {}) {
|
|
|
1060
1054
|
pressProps
|
|
1061
1055
|
};
|
|
1062
1056
|
}
|
|
1057
|
+
|
|
1063
1058
|
function createSyntheticBlurHandler(onBlur) {
|
|
1064
1059
|
let isFocused = false;
|
|
1065
1060
|
let observer = null;
|
|
@@ -1079,7 +1074,7 @@ function createSyntheticBlurHandler(onBlur) {
|
|
|
1079
1074
|
target.addEventListener("focusout", onBlurHandler, { once: true });
|
|
1080
1075
|
observer = new MutationObserver(() => {
|
|
1081
1076
|
if (isFocused && target.disabled) {
|
|
1082
|
-
observer
|
|
1077
|
+
observer?.disconnect();
|
|
1083
1078
|
const relatedTarget = target === document.activeElement ? null : document.activeElement;
|
|
1084
1079
|
target.dispatchEvent(new FocusEvent("blur", { relatedTarget }));
|
|
1085
1080
|
target.dispatchEvent(new FocusEvent("focusout", { bubbles: true, relatedTarget }));
|
|
@@ -1117,7 +1112,7 @@ function createFocus(props = {}) {
|
|
|
1117
1112
|
};
|
|
1118
1113
|
const onFocus = (e) => {
|
|
1119
1114
|
const ownerDocument = getOwnerDocument(e.target);
|
|
1120
|
-
const activeElement = ownerDocument
|
|
1115
|
+
const activeElement = ownerDocument?.activeElement;
|
|
1121
1116
|
if (e.target === e.currentTarget && activeElement === getEventTarget(e)) {
|
|
1122
1117
|
if (onFocusProp) {
|
|
1123
1118
|
onFocusProp(e);
|
|
@@ -1141,6 +1136,7 @@ function createFocus(props = {}) {
|
|
|
1141
1136
|
}
|
|
1142
1137
|
};
|
|
1143
1138
|
}
|
|
1139
|
+
|
|
1144
1140
|
function createFocusWithin(props = {}) {
|
|
1145
1141
|
const { isDisabled, onBlurWithin, onFocusWithin, onFocusWithinChange } = props;
|
|
1146
1142
|
let isFocusWithin = false;
|
|
@@ -1168,7 +1164,7 @@ function createFocusWithin(props = {}) {
|
|
|
1168
1164
|
return;
|
|
1169
1165
|
}
|
|
1170
1166
|
const ownerDocument = getOwnerDocument(e.target);
|
|
1171
|
-
const activeElement = ownerDocument
|
|
1167
|
+
const activeElement = ownerDocument?.activeElement;
|
|
1172
1168
|
if (!isFocusWithin && activeElement === getEventTarget(e)) {
|
|
1173
1169
|
if (onFocusWithin) {
|
|
1174
1170
|
onFocusWithin(e);
|
|
@@ -1182,9 +1178,9 @@ function createFocusWithin(props = {}) {
|
|
|
1182
1178
|
"focus",
|
|
1183
1179
|
(focusEvent) => {
|
|
1184
1180
|
if (isFocusWithin && !nodeContains(currentTarget, focusEvent.target)) {
|
|
1185
|
-
const
|
|
1186
|
-
if (
|
|
1187
|
-
const nativeEvent = new
|
|
1181
|
+
const window = ownerDocument?.defaultView;
|
|
1182
|
+
if (window) {
|
|
1183
|
+
const nativeEvent = new window.FocusEvent("blur", {
|
|
1188
1184
|
relatedTarget: focusEvent.target
|
|
1189
1185
|
});
|
|
1190
1186
|
setEventTarget(nativeEvent, currentTarget);
|
|
@@ -1218,6 +1214,7 @@ function createFocusWithin(props = {}) {
|
|
|
1218
1214
|
}
|
|
1219
1215
|
};
|
|
1220
1216
|
}
|
|
1217
|
+
|
|
1221
1218
|
function createEventHandler(handler) {
|
|
1222
1219
|
if (!handler) {
|
|
1223
1220
|
return void 0;
|
|
@@ -1248,6 +1245,7 @@ function createKeyboard(props = {}) {
|
|
|
1248
1245
|
}
|
|
1249
1246
|
};
|
|
1250
1247
|
}
|
|
1248
|
+
|
|
1251
1249
|
const FocusableContext = createContext(null);
|
|
1252
1250
|
function useFocusableContext(setRef) {
|
|
1253
1251
|
const context = useContext(FocusableContext) || {};
|
|
@@ -1268,7 +1266,7 @@ function createFocusable(props = {}, ref) {
|
|
|
1268
1266
|
let autoFocusDone = false;
|
|
1269
1267
|
const setRef = (el) => {
|
|
1270
1268
|
elementRef = el;
|
|
1271
|
-
ref
|
|
1269
|
+
ref?.(el);
|
|
1272
1270
|
};
|
|
1273
1271
|
const { focusProps } = createFocus({
|
|
1274
1272
|
isDisabled: isDisabledValue$1(props.isDisabled),
|
|
@@ -1306,6 +1304,7 @@ function createFocusable(props = {}, ref) {
|
|
|
1306
1304
|
focusableProps
|
|
1307
1305
|
};
|
|
1308
1306
|
}
|
|
1307
|
+
|
|
1309
1308
|
let currentModality = null;
|
|
1310
1309
|
let hasSetupGlobalListeners = false;
|
|
1311
1310
|
let changeHandlers = /* @__PURE__ */ new Set();
|
|
@@ -1372,6 +1371,7 @@ function createFocusRing(props = {}) {
|
|
|
1372
1371
|
focusProps: focusResult.focusProps
|
|
1373
1372
|
};
|
|
1374
1373
|
}
|
|
1374
|
+
|
|
1375
1375
|
let globalIgnoreEmulatedMouseEvents = false;
|
|
1376
1376
|
let hoverCount = 0;
|
|
1377
1377
|
function setGlobalIgnoreEmulatedMouseEvents() {
|
|
@@ -1413,7 +1413,7 @@ function setupGlobalTouchEvents() {
|
|
|
1413
1413
|
function createHover(props = {}) {
|
|
1414
1414
|
const getProps = () => access$1(props);
|
|
1415
1415
|
const [isHovered, setIsHovered] = createSignal(false);
|
|
1416
|
-
let
|
|
1416
|
+
let state = {
|
|
1417
1417
|
isHovered: false,
|
|
1418
1418
|
ignoreEmulatedMouseEvents: false,
|
|
1419
1419
|
pointerType: "",
|
|
@@ -1425,42 +1425,40 @@ function createHover(props = {}) {
|
|
|
1425
1425
|
});
|
|
1426
1426
|
createEffect(() => {
|
|
1427
1427
|
const p = getProps();
|
|
1428
|
-
if (p.isDisabled &&
|
|
1429
|
-
triggerHoverEnd(
|
|
1428
|
+
if (p.isDisabled && state.isHovered) {
|
|
1429
|
+
triggerHoverEnd(state.target, state.pointerType);
|
|
1430
1430
|
}
|
|
1431
1431
|
});
|
|
1432
1432
|
function triggerHoverStart(target, pointerType) {
|
|
1433
|
-
var _a, _b;
|
|
1434
1433
|
const p = getProps();
|
|
1435
|
-
|
|
1436
|
-
if (p.isDisabled ||
|
|
1434
|
+
state.pointerType = pointerType;
|
|
1435
|
+
if (p.isDisabled || state.isHovered) {
|
|
1437
1436
|
return;
|
|
1438
1437
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1438
|
+
state.isHovered = true;
|
|
1439
|
+
state.target = target;
|
|
1440
|
+
p.onHoverStart?.({
|
|
1442
1441
|
type: "hoverstart",
|
|
1443
1442
|
target,
|
|
1444
1443
|
pointerType
|
|
1445
1444
|
});
|
|
1446
|
-
|
|
1445
|
+
p.onHoverChange?.(true);
|
|
1447
1446
|
setIsHovered(true);
|
|
1448
1447
|
}
|
|
1449
1448
|
function triggerHoverEnd(target, pointerType) {
|
|
1450
|
-
var _a, _b;
|
|
1451
1449
|
const p = getProps();
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
if (!
|
|
1450
|
+
state.pointerType = "";
|
|
1451
|
+
state.target = null;
|
|
1452
|
+
if (!state.isHovered || !target) {
|
|
1455
1453
|
return;
|
|
1456
1454
|
}
|
|
1457
|
-
|
|
1458
|
-
|
|
1455
|
+
state.isHovered = false;
|
|
1456
|
+
p.onHoverEnd?.({
|
|
1459
1457
|
type: "hoverend",
|
|
1460
1458
|
target,
|
|
1461
1459
|
pointerType
|
|
1462
1460
|
});
|
|
1463
|
-
|
|
1461
|
+
p.onHoverChange?.(false);
|
|
1464
1462
|
setIsHovered(false);
|
|
1465
1463
|
}
|
|
1466
1464
|
const hoverProps = createMemo(() => {
|
|
@@ -1485,10 +1483,10 @@ function createHover(props = {}) {
|
|
|
1485
1483
|
}
|
|
1486
1484
|
return {
|
|
1487
1485
|
onMouseEnter: (e) => {
|
|
1488
|
-
if (!
|
|
1486
|
+
if (!state.ignoreEmulatedMouseEvents && !globalIgnoreEmulatedMouseEvents) {
|
|
1489
1487
|
triggerHoverStart(e.currentTarget, "mouse");
|
|
1490
1488
|
}
|
|
1491
|
-
|
|
1489
|
+
state.ignoreEmulatedMouseEvents = false;
|
|
1492
1490
|
},
|
|
1493
1491
|
onMouseLeave: (e) => {
|
|
1494
1492
|
const p = getProps();
|
|
@@ -1503,6 +1501,7 @@ function createHover(props = {}) {
|
|
|
1503
1501
|
isHovered
|
|
1504
1502
|
};
|
|
1505
1503
|
}
|
|
1504
|
+
|
|
1506
1505
|
function isDisabledValue(isDisabled) {
|
|
1507
1506
|
if (typeof isDisabled === "function") {
|
|
1508
1507
|
return isDisabled();
|
|
@@ -1592,6 +1591,7 @@ function createButton(props = {}) {
|
|
|
1592
1591
|
isPressed
|
|
1593
1592
|
};
|
|
1594
1593
|
}
|
|
1594
|
+
|
|
1595
1595
|
function getSelectedValue(isSelected) {
|
|
1596
1596
|
if (typeof isSelected === "function") {
|
|
1597
1597
|
return isSelected();
|
|
@@ -1610,17 +1610,15 @@ function createToggleButton(props = {}) {
|
|
|
1610
1610
|
return uncontrolledSelected();
|
|
1611
1611
|
};
|
|
1612
1612
|
const toggleSelection = () => {
|
|
1613
|
-
var _a;
|
|
1614
1613
|
const newValue = !isSelected();
|
|
1615
1614
|
if (!isControlled) {
|
|
1616
1615
|
setUncontrolledSelected(newValue);
|
|
1617
1616
|
}
|
|
1618
|
-
|
|
1617
|
+
props.onChange?.(newValue);
|
|
1619
1618
|
};
|
|
1620
1619
|
const onPress = (e) => {
|
|
1621
|
-
var _a;
|
|
1622
1620
|
toggleSelection();
|
|
1623
|
-
|
|
1621
|
+
props.onPress?.(e);
|
|
1624
1622
|
};
|
|
1625
1623
|
const { buttonProps: baseButtonProps, isPressed } = createButton(
|
|
1626
1624
|
mergeProps(props, {
|
|
@@ -1639,6 +1637,7 @@ function createToggleButton(props = {}) {
|
|
|
1639
1637
|
isSelected
|
|
1640
1638
|
};
|
|
1641
1639
|
}
|
|
1640
|
+
|
|
1642
1641
|
function access(value) {
|
|
1643
1642
|
return typeof value === "function" ? value() : value;
|
|
1644
1643
|
}
|
|
@@ -1801,7 +1800,7 @@ function createRadioGroupState(props = {}) {
|
|
|
1801
1800
|
function setLastFocusedValue(value) {
|
|
1802
1801
|
setLastFocusedValueInternal(value);
|
|
1803
1802
|
}
|
|
1804
|
-
const
|
|
1803
|
+
const state = {
|
|
1805
1804
|
name,
|
|
1806
1805
|
selectedValue,
|
|
1807
1806
|
defaultSelectedValue: initialProps.defaultValue ?? null,
|
|
@@ -1821,10 +1820,11 @@ function createRadioGroupState(props = {}) {
|
|
|
1821
1820
|
return isInvalid();
|
|
1822
1821
|
}
|
|
1823
1822
|
};
|
|
1824
|
-
radioGroupSyncVersion.set(
|
|
1825
|
-
return
|
|
1823
|
+
radioGroupSyncVersion.set(state, syncVersion);
|
|
1824
|
+
return state;
|
|
1826
1825
|
}
|
|
1827
|
-
|
|
1826
|
+
|
|
1827
|
+
function createToggle(props, state, ref) {
|
|
1828
1828
|
const getProps = () => access$1(props);
|
|
1829
1829
|
const isDisabled = () => getProps().isDisabled ?? false;
|
|
1830
1830
|
const isReadOnly = () => getProps().isReadOnly ?? false;
|
|
@@ -1865,10 +1865,9 @@ function createToggle(props, state2, ref) {
|
|
|
1865
1865
|
return getProps().onPressUp;
|
|
1866
1866
|
},
|
|
1867
1867
|
onPress(e) {
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
(_c = ref()) == null ? void 0 : _c.focus();
|
|
1868
|
+
getProps().onPress?.(e);
|
|
1869
|
+
state.toggle();
|
|
1870
|
+
ref()?.focus();
|
|
1872
1871
|
},
|
|
1873
1872
|
get isDisabled() {
|
|
1874
1873
|
return isDisabled() || isReadOnly();
|
|
@@ -1905,10 +1904,10 @@ function createToggle(props, state2, ref) {
|
|
|
1905
1904
|
const onChange = (e) => {
|
|
1906
1905
|
e.stopPropagation();
|
|
1907
1906
|
if (isReadOnly()) {
|
|
1908
|
-
e.currentTarget.checked =
|
|
1907
|
+
e.currentTarget.checked = state.isSelected();
|
|
1909
1908
|
return;
|
|
1910
1909
|
}
|
|
1911
|
-
|
|
1910
|
+
state.setSelected(e.currentTarget.checked);
|
|
1912
1911
|
};
|
|
1913
1912
|
createEffect(() => {
|
|
1914
1913
|
const p = getProps();
|
|
@@ -1942,16 +1941,17 @@ function createToggle(props, state2, ref) {
|
|
|
1942
1941
|
onClick: (e) => e.stopPropagation()
|
|
1943
1942
|
});
|
|
1944
1943
|
},
|
|
1945
|
-
isSelected:
|
|
1944
|
+
isSelected: state.isSelected,
|
|
1946
1945
|
isPressed: combinedIsPressed,
|
|
1947
1946
|
isDisabled: isDisabled(),
|
|
1948
1947
|
isReadOnly: isReadOnly(),
|
|
1949
1948
|
isInvalid: isInvalid()
|
|
1950
1949
|
};
|
|
1951
1950
|
}
|
|
1952
|
-
|
|
1951
|
+
|
|
1952
|
+
function createCheckbox(props, state, inputRef) {
|
|
1953
1953
|
const getProps = () => access$1(props);
|
|
1954
|
-
const toggleResult = createToggle(props,
|
|
1954
|
+
const toggleResult = createToggle(props, state, inputRef);
|
|
1955
1955
|
const {
|
|
1956
1956
|
labelProps: baseLabelProps,
|
|
1957
1957
|
isSelected,
|
|
@@ -2000,6 +2000,7 @@ function createCheckbox(props, state2, inputRef) {
|
|
|
2000
2000
|
isInvalid
|
|
2001
2001
|
};
|
|
2002
2002
|
}
|
|
2003
|
+
|
|
2003
2004
|
function createIsSSR() {
|
|
2004
2005
|
return isServer;
|
|
2005
2006
|
}
|
|
@@ -2010,6 +2011,7 @@ function createId(defaultId) {
|
|
|
2010
2011
|
return `solidaria-${createUniqueId()}`;
|
|
2011
2012
|
}
|
|
2012
2013
|
const canUseDOM = !isServer;
|
|
2014
|
+
|
|
2013
2015
|
function createLabels(props, defaultLabel) {
|
|
2014
2016
|
let {
|
|
2015
2017
|
id,
|
|
@@ -2032,6 +2034,7 @@ function createLabels(props, defaultLabel) {
|
|
|
2032
2034
|
"aria-labelledby": labelledBy
|
|
2033
2035
|
};
|
|
2034
2036
|
}
|
|
2037
|
+
|
|
2035
2038
|
function createLabel(props) {
|
|
2036
2039
|
const getProps = () => access$1(props);
|
|
2037
2040
|
const id = createId(getProps().id);
|
|
@@ -2075,6 +2078,7 @@ function createLabel(props) {
|
|
|
2075
2078
|
}
|
|
2076
2079
|
};
|
|
2077
2080
|
}
|
|
2081
|
+
|
|
2078
2082
|
function createField(props) {
|
|
2079
2083
|
const getProps = () => access$1(props);
|
|
2080
2084
|
const { labelProps, fieldProps: baseLabelFieldProps } = createLabel(props);
|
|
@@ -2131,10 +2135,11 @@ function createField(props) {
|
|
|
2131
2135
|
}
|
|
2132
2136
|
};
|
|
2133
2137
|
}
|
|
2138
|
+
|
|
2134
2139
|
const checkboxGroupData = /* @__PURE__ */ new WeakMap();
|
|
2135
|
-
function createCheckboxGroup(props,
|
|
2140
|
+
function createCheckboxGroup(props, state) {
|
|
2136
2141
|
const getProps = () => access$1(props);
|
|
2137
|
-
const isInvalid = () =>
|
|
2142
|
+
const isInvalid = () => state.isInvalid;
|
|
2138
2143
|
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField({
|
|
2139
2144
|
get label() {
|
|
2140
2145
|
return getProps().label;
|
|
@@ -2164,7 +2169,7 @@ function createCheckboxGroup(props, state2) {
|
|
|
2164
2169
|
// shouldn't be labeled by a <label> element.
|
|
2165
2170
|
labelElementType: "span"
|
|
2166
2171
|
});
|
|
2167
|
-
checkboxGroupData.set(
|
|
2172
|
+
checkboxGroupData.set(state, {
|
|
2168
2173
|
name: getProps().name,
|
|
2169
2174
|
form: getProps().form,
|
|
2170
2175
|
descriptionId: descriptionProps.id,
|
|
@@ -2187,7 +2192,7 @@ function createCheckboxGroup(props, state2) {
|
|
|
2187
2192
|
get groupProps() {
|
|
2188
2193
|
return mergeProps(domProps(), {
|
|
2189
2194
|
role: "group",
|
|
2190
|
-
"aria-disabled":
|
|
2195
|
+
"aria-disabled": state.isDisabled || void 0,
|
|
2191
2196
|
...fieldProps,
|
|
2192
2197
|
...focusWithinProps
|
|
2193
2198
|
});
|
|
@@ -2206,37 +2211,37 @@ function createCheckboxGroup(props, state2) {
|
|
|
2206
2211
|
}
|
|
2207
2212
|
};
|
|
2208
2213
|
}
|
|
2209
|
-
|
|
2214
|
+
|
|
2215
|
+
function createCheckboxGroupItem(props, state, inputRef) {
|
|
2210
2216
|
const getProps = () => access$1(props);
|
|
2211
2217
|
const toggleState = {
|
|
2212
|
-
isSelected: () =>
|
|
2213
|
-
defaultSelected:
|
|
2218
|
+
isSelected: () => state.isSelected(getProps().value),
|
|
2219
|
+
defaultSelected: state.defaultValue.includes(getProps().value),
|
|
2214
2220
|
setSelected(isSelected) {
|
|
2215
|
-
var _a, _b;
|
|
2216
2221
|
const value = getProps().value;
|
|
2217
2222
|
if (isSelected) {
|
|
2218
|
-
|
|
2223
|
+
state.addValue(value);
|
|
2219
2224
|
} else {
|
|
2220
|
-
|
|
2225
|
+
state.removeValue(value);
|
|
2221
2226
|
}
|
|
2222
|
-
|
|
2227
|
+
getProps().onChange?.(isSelected);
|
|
2223
2228
|
},
|
|
2224
2229
|
toggle() {
|
|
2225
|
-
|
|
2230
|
+
state.toggleValue(getProps().value);
|
|
2226
2231
|
}
|
|
2227
2232
|
};
|
|
2228
|
-
const getGroupData = () => checkboxGroupData.get(
|
|
2233
|
+
const getGroupData = () => checkboxGroupData.get(state);
|
|
2229
2234
|
const checkboxProps = () => {
|
|
2230
2235
|
const p = getProps();
|
|
2231
2236
|
const groupData = getGroupData();
|
|
2232
2237
|
return {
|
|
2233
2238
|
...p,
|
|
2234
|
-
isReadOnly: p.isReadOnly ??
|
|
2235
|
-
isDisabled: p.isDisabled ??
|
|
2236
|
-
name: p.name ??
|
|
2237
|
-
form: p.form ??
|
|
2238
|
-
isRequired: p.isRequired ??
|
|
2239
|
-
validationBehavior: p.validationBehavior ??
|
|
2239
|
+
isReadOnly: p.isReadOnly ?? state.isReadOnly,
|
|
2240
|
+
isDisabled: p.isDisabled ?? state.isDisabled,
|
|
2241
|
+
name: p.name ?? groupData?.name,
|
|
2242
|
+
form: p.form ?? groupData?.form,
|
|
2243
|
+
isRequired: p.isRequired ?? state.isRequired(),
|
|
2244
|
+
validationBehavior: p.validationBehavior ?? groupData?.validationBehavior ?? "aria"
|
|
2240
2245
|
};
|
|
2241
2246
|
};
|
|
2242
2247
|
const result = createCheckbox(checkboxProps, toggleState, inputRef);
|
|
@@ -2250,10 +2255,10 @@ function createCheckboxGroupItem(props, state2, inputRef) {
|
|
|
2250
2255
|
if (propsDescribedBy) {
|
|
2251
2256
|
describedByIds.push(propsDescribedBy);
|
|
2252
2257
|
}
|
|
2253
|
-
if (
|
|
2258
|
+
if (state.isInvalid && groupData?.errorMessageId) {
|
|
2254
2259
|
describedByIds.push(groupData.errorMessageId);
|
|
2255
2260
|
}
|
|
2256
|
-
if (groupData
|
|
2261
|
+
if (groupData?.descriptionId) {
|
|
2257
2262
|
describedByIds.push(groupData.descriptionId);
|
|
2258
2263
|
}
|
|
2259
2264
|
const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(" ") : void 0;
|
|
@@ -2264,8 +2269,9 @@ function createCheckboxGroupItem(props, state2, inputRef) {
|
|
|
2264
2269
|
}
|
|
2265
2270
|
};
|
|
2266
2271
|
}
|
|
2272
|
+
|
|
2267
2273
|
const radioGroupData = /* @__PURE__ */ new WeakMap();
|
|
2268
|
-
function createRadioGroup(props,
|
|
2274
|
+
function createRadioGroup(props, state) {
|
|
2269
2275
|
const getProps = () => access$1(props);
|
|
2270
2276
|
const orientation = () => getProps().orientation ?? "vertical";
|
|
2271
2277
|
const isReadOnly = () => getProps().isReadOnly ?? false;
|
|
@@ -2283,7 +2289,7 @@ function createRadioGroup(props, state2) {
|
|
|
2283
2289
|
return getProps().errorMessage;
|
|
2284
2290
|
},
|
|
2285
2291
|
get isInvalid() {
|
|
2286
|
-
return
|
|
2292
|
+
return state.isInvalid;
|
|
2287
2293
|
},
|
|
2288
2294
|
// Radio group is not an HTML input element so it
|
|
2289
2295
|
// shouldn't be labeled by a <label> element.
|
|
@@ -2291,24 +2297,17 @@ function createRadioGroup(props, state2) {
|
|
|
2291
2297
|
});
|
|
2292
2298
|
const { focusWithinProps } = createFocusWithin({
|
|
2293
2299
|
onBlurWithin(e) {
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
state2.setLastFocusedValue(null);
|
|
2300
|
+
getProps().onBlur?.(e);
|
|
2301
|
+
if (!state.selectedValue()) {
|
|
2302
|
+
state.setLastFocusedValue(null);
|
|
2298
2303
|
}
|
|
2299
2304
|
},
|
|
2300
|
-
onFocusWithin: (e) =>
|
|
2301
|
-
|
|
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
|
-
}
|
|
2305
|
+
onFocusWithin: (e) => getProps().onFocus?.(e),
|
|
2306
|
+
onFocusWithinChange: (isFocused) => getProps().onFocusChange?.(isFocused)
|
|
2308
2307
|
});
|
|
2309
2308
|
const domProps = () => filterDOMProps(getProps(), { labelable: true });
|
|
2310
2309
|
const groupName = getProps().name ?? createId();
|
|
2311
|
-
radioGroupData.set(
|
|
2310
|
+
radioGroupData.set(state, {
|
|
2312
2311
|
name: groupName,
|
|
2313
2312
|
form: getProps().form,
|
|
2314
2313
|
descriptionId: descriptionProps.id,
|
|
@@ -2325,7 +2324,7 @@ function createRadioGroup(props, state2) {
|
|
|
2325
2324
|
{
|
|
2326
2325
|
role: "radiogroup",
|
|
2327
2326
|
onKeyDown,
|
|
2328
|
-
"aria-invalid":
|
|
2327
|
+
"aria-invalid": state.isInvalid || void 0,
|
|
2329
2328
|
"aria-errormessage": getProps()["aria-errormessage"],
|
|
2330
2329
|
"aria-readonly": isReadOnly() || void 0,
|
|
2331
2330
|
"aria-required": isRequired() || void 0,
|
|
@@ -2339,7 +2338,7 @@ function createRadioGroup(props, state2) {
|
|
|
2339
2338
|
descriptionProps,
|
|
2340
2339
|
errorMessageProps,
|
|
2341
2340
|
get isInvalid() {
|
|
2342
|
-
return
|
|
2341
|
+
return state.isInvalid;
|
|
2343
2342
|
},
|
|
2344
2343
|
get validationErrors() {
|
|
2345
2344
|
return [];
|
|
@@ -2349,12 +2348,13 @@ function createRadioGroup(props, state2) {
|
|
|
2349
2348
|
}
|
|
2350
2349
|
};
|
|
2351
2350
|
}
|
|
2352
|
-
|
|
2351
|
+
|
|
2352
|
+
function createRadio(props, state, ref) {
|
|
2353
2353
|
const getProps = () => access$1(props);
|
|
2354
|
-
const isDisabled = () => getProps().isDisabled ||
|
|
2354
|
+
const isDisabled = () => getProps().isDisabled || state.isDisabled;
|
|
2355
2355
|
const value = () => getProps().value;
|
|
2356
2356
|
const isSelected = () => {
|
|
2357
|
-
const selected =
|
|
2357
|
+
const selected = state.selectedValue();
|
|
2358
2358
|
const v = value();
|
|
2359
2359
|
return selected === v;
|
|
2360
2360
|
};
|
|
@@ -2369,8 +2369,8 @@ function createRadio(props, state2, ref) {
|
|
|
2369
2369
|
createEffect(() => {
|
|
2370
2370
|
const inputEl = ref();
|
|
2371
2371
|
if (!inputEl) return;
|
|
2372
|
-
const syncVersion = radioGroupSyncVersion.get(
|
|
2373
|
-
syncVersion
|
|
2372
|
+
const syncVersion = radioGroupSyncVersion.get(state);
|
|
2373
|
+
syncVersion?.();
|
|
2374
2374
|
const shouldBeChecked = isSelected();
|
|
2375
2375
|
if (inputEl.checked !== shouldBeChecked) {
|
|
2376
2376
|
inputEl.checked = shouldBeChecked;
|
|
@@ -2383,7 +2383,7 @@ function createRadio(props, state2, ref) {
|
|
|
2383
2383
|
target.checked = isSelected();
|
|
2384
2384
|
return;
|
|
2385
2385
|
}
|
|
2386
|
-
|
|
2386
|
+
state.setSelectedValue(value());
|
|
2387
2387
|
target.focus();
|
|
2388
2388
|
target.checked = isSelected();
|
|
2389
2389
|
};
|
|
@@ -2421,10 +2421,9 @@ function createRadio(props, state2, ref) {
|
|
|
2421
2421
|
return getProps().onPressUp;
|
|
2422
2422
|
},
|
|
2423
2423
|
onPress(e) {
|
|
2424
|
-
|
|
2425
|
-
(
|
|
2426
|
-
|
|
2427
|
-
(_c = ref()) == null ? void 0 : _c.focus();
|
|
2424
|
+
getProps().onPress?.(e);
|
|
2425
|
+
state.setSelectedValue(value());
|
|
2426
|
+
ref()?.focus();
|
|
2428
2427
|
},
|
|
2429
2428
|
get isDisabled() {
|
|
2430
2429
|
return isDisabled();
|
|
@@ -2438,9 +2437,8 @@ function createRadio(props, state2, ref) {
|
|
|
2438
2437
|
return getProps().autoFocus;
|
|
2439
2438
|
},
|
|
2440
2439
|
onFocus(e) {
|
|
2441
|
-
|
|
2442
|
-
(
|
|
2443
|
-
state2.setLastFocusedValue(value());
|
|
2440
|
+
getProps().onFocus?.(e);
|
|
2441
|
+
state.setLastFocusedValue(value());
|
|
2444
2442
|
},
|
|
2445
2443
|
get onBlur() {
|
|
2446
2444
|
return getProps().onBlur;
|
|
@@ -2461,8 +2459,8 @@ function createRadio(props, state2, ref) {
|
|
|
2461
2459
|
if (isDisabled()) {
|
|
2462
2460
|
return void 0;
|
|
2463
2461
|
}
|
|
2464
|
-
const selected =
|
|
2465
|
-
const lastFocused =
|
|
2462
|
+
const selected = state.selectedValue();
|
|
2463
|
+
const lastFocused = state.lastFocusedValue();
|
|
2466
2464
|
const currentValue = value();
|
|
2467
2465
|
if (selected != null) {
|
|
2468
2466
|
if (selected === currentValue) {
|
|
@@ -2476,7 +2474,7 @@ function createRadio(props, state2, ref) {
|
|
|
2476
2474
|
return -1;
|
|
2477
2475
|
}
|
|
2478
2476
|
};
|
|
2479
|
-
const getGroupData = () => radioGroupData.get(
|
|
2477
|
+
const getGroupData = () => radioGroupData.get(state);
|
|
2480
2478
|
const combinedIsPressed = () => isPressed() || isLabelPressed();
|
|
2481
2479
|
return {
|
|
2482
2480
|
labelProps: mergeProps(labelPressProps, {
|
|
@@ -2490,20 +2488,20 @@ function createRadio(props, state2, ref) {
|
|
|
2490
2488
|
if (p["aria-describedby"]) {
|
|
2491
2489
|
describedByIds.push(p["aria-describedby"]);
|
|
2492
2490
|
}
|
|
2493
|
-
if (
|
|
2491
|
+
if (state.isInvalid && groupData?.errorMessageId) {
|
|
2494
2492
|
describedByIds.push(groupData.errorMessageId);
|
|
2495
2493
|
}
|
|
2496
|
-
if (groupData
|
|
2494
|
+
if (groupData?.descriptionId) {
|
|
2497
2495
|
describedByIds.push(groupData.descriptionId);
|
|
2498
2496
|
}
|
|
2499
2497
|
const ariaDescribedBy = describedByIds.length > 0 ? describedByIds.join(" ") : void 0;
|
|
2500
2498
|
return mergeProps(domProps(), interactions, {
|
|
2501
2499
|
type: "radio",
|
|
2502
|
-
name: groupData
|
|
2503
|
-
form: groupData
|
|
2500
|
+
name: groupData?.name,
|
|
2501
|
+
form: groupData?.form,
|
|
2504
2502
|
tabIndex: getTabIndex(),
|
|
2505
2503
|
disabled: isDisabled(),
|
|
2506
|
-
required:
|
|
2504
|
+
required: state.isRequired && groupData?.validationBehavior === "native",
|
|
2507
2505
|
checked: isSelected(),
|
|
2508
2506
|
value: value(),
|
|
2509
2507
|
onChange,
|
|
@@ -2515,8 +2513,9 @@ function createRadio(props, state2, ref) {
|
|
|
2515
2513
|
isPressed: combinedIsPressed
|
|
2516
2514
|
};
|
|
2517
2515
|
}
|
|
2518
|
-
|
|
2519
|
-
|
|
2516
|
+
|
|
2517
|
+
function createSwitch(props, state, ref) {
|
|
2518
|
+
const toggle = createToggle(props, state, ref);
|
|
2520
2519
|
return {
|
|
2521
2520
|
labelProps: toggle.labelProps,
|
|
2522
2521
|
get inputProps() {
|
|
@@ -2533,6 +2532,7 @@ function createSwitch(props, state2, ref) {
|
|
|
2533
2532
|
isReadOnly: toggle.isReadOnly
|
|
2534
2533
|
};
|
|
2535
2534
|
}
|
|
2535
|
+
|
|
2536
2536
|
function createLink(props = {}) {
|
|
2537
2537
|
const getProps = () => access$1(props);
|
|
2538
2538
|
const isDisabled = () => getProps().isDisabled ?? false;
|
|
@@ -2606,12 +2606,11 @@ function createLink(props = {}) {
|
|
|
2606
2606
|
ariaProps["aria-describedby"] = p["aria-describedby"];
|
|
2607
2607
|
}
|
|
2608
2608
|
const onClick = (e) => {
|
|
2609
|
-
var _a;
|
|
2610
2609
|
if (disabled) {
|
|
2611
2610
|
e.preventDefault();
|
|
2612
2611
|
return;
|
|
2613
2612
|
}
|
|
2614
|
-
|
|
2613
|
+
p.onClick?.(e);
|
|
2615
2614
|
};
|
|
2616
2615
|
return mergeProps(
|
|
2617
2616
|
filterDOMProps(p, { labelable: true }),
|
|
@@ -2629,6 +2628,7 @@ function createLink(props = {}) {
|
|
|
2629
2628
|
isPressed
|
|
2630
2629
|
};
|
|
2631
2630
|
}
|
|
2631
|
+
|
|
2632
2632
|
function createTextField(props, ref) {
|
|
2633
2633
|
const getProps = () => access$1(props);
|
|
2634
2634
|
const { labelProps, fieldProps, descriptionProps, errorMessageProps } = createField(props);
|
|
@@ -2663,9 +2663,8 @@ function createTextField(props, ref) {
|
|
|
2663
2663
|
"aria-invalid": isInvalid || void 0,
|
|
2664
2664
|
value: p.value ?? p.defaultValue ?? "",
|
|
2665
2665
|
onChange: (e) => {
|
|
2666
|
-
var _a;
|
|
2667
2666
|
const target = e.target;
|
|
2668
|
-
|
|
2667
|
+
p.onChange?.(target.value);
|
|
2669
2668
|
},
|
|
2670
2669
|
// Don't include type and pattern for textarea elements
|
|
2671
2670
|
type: isTextarea ? void 0 : p.type ?? "text",
|
|
@@ -2718,6 +2717,7 @@ function createTextField(props, ref) {
|
|
|
2718
2717
|
}
|
|
2719
2718
|
};
|
|
2720
2719
|
}
|
|
2720
|
+
|
|
2721
2721
|
function clamp(value, min, max) {
|
|
2722
2722
|
return Math.min(Math.max(value, min), max);
|
|
2723
2723
|
}
|
|
@@ -2774,6 +2774,7 @@ function createProgressBar(props = {}) {
|
|
|
2774
2774
|
}
|
|
2775
2775
|
};
|
|
2776
2776
|
}
|
|
2777
|
+
|
|
2777
2778
|
function createSeparator(props = {}) {
|
|
2778
2779
|
const getSeparatorProps = () => {
|
|
2779
2780
|
const p = access$1(props);
|
|
@@ -2797,38 +2798,6 @@ function createSeparator(props = {}) {
|
|
|
2797
2798
|
}
|
|
2798
2799
|
};
|
|
2799
2800
|
}
|
|
2800
|
-
|
|
2801
|
-
|
|
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
|
-
};
|
|
2801
|
+
|
|
2802
|
+
export { access$1 as access, canUseDOM, checkboxGroupData, createButton, createCheckbox, createCheckboxGroup, createCheckboxGroupItem, createCheckboxGroupState, createField, createFocusRing, createFocusable, createHover, createId, createIsSSR, createLabel, createLabels, createLink, createPress, createProgressBar, createRadio, createRadioGroup, createRadioGroupState, createSeparator, createSwitch, createTextField, createToggle, createToggleButton, createToggleState, filterDOMProps, isAccessor, mergeProps, radioGroupData };
|
|
2834
2803
|
//# sourceMappingURL=index.js.map
|