@eightshift/ui-components 1.3.2 → 1.4.1
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/{Button-DTARR6Ff.js → Button-uYE9D_E3.js} +6 -5
- package/dist/{ColorSwatch-5bZ_yIMB.js → ColorSwatch-Bev-9Vbr.js} +4 -4
- package/dist/{Dialog-DJgS0mAg.js → Dialog-CGE2ficT.js} +17 -15
- package/dist/{FieldError-CviphIN5.js → FieldError-CBPJ4Xx8.js} +2 -2
- package/dist/{FocusScope-BjM5iOQC.js → FocusScope-CVd6C65L.js} +24 -8
- package/dist/{GridList-DjRnMEae.js → GridList-PBJsm70G.js} +156 -116
- package/dist/{Group-BQu67pVS.js → Group-WZgNv9RE.js} +3 -3
- package/dist/Hidden-YSmyVF_5.js +45 -0
- package/dist/{Input-DWRQF0ro.js → Input-CaS4qmLb.js} +10 -9
- package/dist/{Label-BXvY41yE.js → Label-yZgqvhXc.js} +3 -2
- package/dist/ListBox-MZyPpwvj.js +567 -0
- package/dist/{Select-49a62830.esm-BnlXlUnT.js → Select-49a62830.esm-CqLHaIei.js} +1 -1
- package/dist/{SelectionManager-JxXmb3-k.js → SelectionManager-CvRaua4m.js} +1580 -1484
- package/dist/{Separator-CX64zwq8.js → Separator-C7Few7L6.js} +80 -62
- package/dist/{Slider-Clme2C36.js → Slider-D8a63VhT.js} +14 -12
- package/dist/{Text-qjognpzK.js → Text-D8qh3_U7.js} +1 -1
- package/dist/{VisuallyHidden-BZPezMV5.js → VisuallyHidden-DD480kAb.js} +2 -2
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/{ariaHideOutside-BZ5z6iCD.js → ariaHideOutside-BzxkODNq.js} +1 -9
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp-ui-enhancements.css +1 -1
- package/dist/components/animated-visibility/animated-visibility.js +311 -198
- package/dist/components/base-control/base-control.js +1 -1
- package/dist/components/button/button.js +274 -9
- package/dist/components/checkbox/checkbox.js +171 -1
- package/dist/components/color-pickers/color-picker.js +1 -1
- package/dist/components/color-pickers/color-swatch.js +3 -3
- package/dist/components/color-pickers/gradient-editor.js +3 -3
- package/dist/components/color-pickers/solid-color-picker.js +46 -32
- package/dist/components/component-toggle/component-toggle.js +2 -2
- package/dist/components/container-panel/container-panel.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +3 -3
- package/dist/components/draggable-list/draggable-list.js +3671 -6
- package/dist/components/expandable/expandable.js +7 -4
- package/dist/components/index.js +4 -4
- package/dist/components/input-field/input-field.js +7 -7
- package/dist/components/link-input/link-input.js +1519 -489
- package/dist/components/list-box/list-box.js +2 -2
- package/dist/components/matrix-align/matrix-align.js +3 -3
- package/dist/components/menu/menu.js +164 -466
- package/dist/components/modal/modal.js +7 -7
- package/dist/components/number-picker/number-picker.js +22 -17
- package/dist/components/option-select/option-select.js +2 -2
- package/dist/components/placeholders/file-placeholder.js +1 -1
- package/dist/components/popover/popover.js +3 -3
- package/dist/components/radio/radio.js +13 -13
- package/dist/components/repeater/repeater-context.js +5 -0
- package/dist/components/repeater/repeater-item.js +46 -91
- package/dist/components/repeater/repeater.js +5130 -175
- package/dist/components/responsive/responsive-legacy.js +3 -3
- package/dist/components/responsive/responsive.js +3 -3
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/select/async-multi-select.js +3 -3
- package/dist/components/select/async-single-select.js +2 -2
- package/dist/components/select/custom-select-default-components.js +1 -1
- package/dist/components/select/multi-select-components.js +1 -1
- package/dist/components/select/multi-select.js +5 -5
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +2 -2
- package/dist/components/select/styles.js +1 -1
- package/dist/components/slider/column-config-slider.js +3 -3
- package/dist/components/slider/slider.js +3 -3
- package/dist/components/slider/utils.js +1 -1
- package/dist/components/tabs/tabs.js +46 -71
- package/dist/components/toggle/switch.js +6 -6
- package/dist/components/toggle/toggle.js +1 -1
- package/dist/components/toggle-button/toggle-button.js +7 -7
- package/dist/components/tooltip/tooltip.js +3 -3
- package/dist/{context-BG_1RnbC.js → context-Bon2Gyx5.js} +1 -1
- package/dist/{default-i18n-BqwLkgZv.js → default-i18n-BqWys-1G.js} +1 -1
- package/dist/{focusSafely-DGZ4R5fj.js → focusSafely-PMGZgZ9-.js} +33 -26
- package/dist/getScrollParent-B3XgpXBL.js +10 -0
- package/dist/icons/icons.js +205 -0
- package/dist/icons/jsx-svg.js +2 -2
- package/dist/{index-CAPcSs9K.js → index-BTCzc3zb.js} +1 -1
- package/dist/{index-a301f526.esm-ByOfDxiG.js → index-a301f526.esm-B9tWL9yi.js} +80 -603
- package/dist/index.js +4 -4
- package/dist/{intlStrings-CkuKCPkT.js → intlStrings-KQxgp5tS.js} +14 -9
- package/dist/{multi-select-components-7vKCF8dG.js → multi-select-components-DTvEidE3.js} +1 -1
- package/dist/react-jsx-parser.min-CAGfntg1.js +13425 -0
- package/dist/{react-select-async.esm-5zW9Dv9E.js → react-select-async.esm-8Rba_3KV.js} +3 -3
- package/dist/{react-select.esm-Bi6uzjbT.js → react-select.esm-DkSeQzOP.js} +3 -3
- package/dist/{textSelection-BLyBtNe2.js → textSelection-DS7-670U.js} +1 -1
- package/dist/{tooltip-DSk8I1SO.js → tooltip-C9mg1CP5.js} +54 -18
- package/dist/{useButton-EJ9c8fmq.js → useButton-BPY4yXUo.js} +3 -3
- package/dist/{useEvent-Cxq_BzP_.js → useEvent-DDLT851Z.js} +1 -1
- package/dist/{useFocusRing-Dg5Y_10S.js → useFocusRing-DsxEaA2J.js} +1 -1
- package/dist/{useFocusable-CQZyQp4q.js → useFocusable-BFKHuYS9.js} +2 -2
- package/dist/{useFormReset-DJMtIgSL.js → useFormReset-BCPbwfnH.js} +1 -1
- package/dist/{useFormValidationState-DDC_nImg.js → useFormValidationState-DC5jbhBW.js} +2 -2
- package/dist/{useHasTabbableChild-M3O3VIil.js → useHasTabbableChild-Byd7ylXD.js} +2 -2
- package/dist/{useLabel-6NqYraET.js → useLabel-DuJhImKc.js} +2 -2
- package/dist/{useLabels-D2RG7TdI.js → useLabels-JaBafrnV.js} +1 -1
- package/dist/{useListData-BpYQj7kK.js → useListData-B5Pk32vd.js} +6 -3
- package/dist/{useListState-IllYYnXV.js → useListState-Csx05BmT.js} +6 -3
- package/dist/{useLocalizedStringFormatter-Cwm_siat.js → useLocalizedStringFormatter-CVIIVTgz.js} +1 -1
- package/dist/useMenuTrigger-CMgzyMKW.js +246 -0
- package/dist/{useNumberFieldState-CVJOJnF1.js → useNumberFieldState-BVFqhboT.js} +12 -11
- package/dist/{useNumberFormatter-DVZRQXk3.js → useNumberFormatter-BEeBSV-N.js} +1 -1
- package/dist/{usePress-CiXj8dLE.js → usePress-CY8MpqYD.js} +58 -16
- package/dist/useSingleSelectListState-CzZUgAt0.js +37 -0
- package/dist/{useToggle-CV-IX6nL.js → useToggle-CJp2Fh_L.js} +4 -4
- package/dist/{useToggleState-DHIdITtQ.js → useToggleState-B4--Ski0.js} +1 -1
- package/dist/{utils-DC-UMp1n.js → utils-B4IdLYb8.js} +48 -85
- package/package.json +24 -21
- package/dist/Checkbox-CiJIVbAP.js +0 -174
- package/dist/ListBox-DTKMdjQC.js +0 -4216
- package/dist/_commonjsHelpers-DWwsNxpa.js +0 -8
- package/dist/button-IxfzzzbP.js +0 -277
- package/dist/react-jsx-parser.min-DhrYeqLL.js +0 -4563
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-
|
|
1
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "./context-Bon2Gyx5.js";
|
|
2
2
|
import { $ as $488c6ddbf4ef74c2$export$cc77c4ff7e8673c5 } from "./NumberFormatter-U_Gx0UDq.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
function $a916eb452884faea$export$b7a616150fdb9f44(options = {}) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6, a as $14c0b72509d70225$export$b0d6fa1ab32e3295, b as $14c0b72509d70225$export$16a4697467175487 } from "./textSelection-
|
|
1
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6, a as $14c0b72509d70225$export$b0d6fa1ab32e3295, b as $14c0b72509d70225$export$16a4697467175487 } from "./textSelection-DS7-670U.js";
|
|
2
2
|
import React__default, { useContext, createContext, useState, useRef, useMemo, useEffect } from "react";
|
|
3
|
-
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52,
|
|
4
|
-
import {
|
|
3
|
+
import { f as $8ae05eaa5c114e9c$export$7f54fc3180508a52, c as $3ef42575df84b30b$export$9d1611c77c2fe928, n as $ff5963eb1fccf552$export$e08e3b67e392101e } from "./utils-B4IdLYb8.js";
|
|
4
|
+
import { p as $c87311424ea30a05$export$b7d78993b74f766d, n as $c87311424ea30a05$export$9ac100e40613ea10, o as $c87311424ea30a05$export$78551043582a6a98, q as $c87311424ea30a05$export$7bef049ce92e4224, m as $7215afc6de606d6b$export$de79e2c695e052f3, r as $6a7db85432448f7f$export$29bf1b5f2c56cf63, g as $431fbd86ca7dc216$export$b204af158042fbac, s as $6a7db85432448f7f$export$60278871457622de, f as $431fbd86ca7dc216$export$f21a1ffae260145a, l as $e7801be82b4b2a53$export$4debdb1a3f0fa79e } from "./focusSafely-PMGZgZ9-.js";
|
|
5
5
|
const $ea8dcbcb9ea1b556$var$RouterContext = /* @__PURE__ */ createContext({
|
|
6
6
|
isNative: true,
|
|
7
7
|
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
|
|
@@ -55,9 +55,10 @@ function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
|
55
55
|
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
56
56
|
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link) => $ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
57
57
|
}
|
|
58
|
-
function $ea8dcbcb9ea1b556$export$
|
|
58
|
+
function $ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6(props) {
|
|
59
|
+
let router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
59
60
|
return {
|
|
60
|
-
"data-href": props.href,
|
|
61
|
+
"data-href": props.href ? router.useHref(props.href) : void 0,
|
|
61
62
|
"data-target": props.target,
|
|
62
63
|
"data-rel": props.rel,
|
|
63
64
|
"data-download": props.download,
|
|
@@ -134,12 +135,30 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
134
135
|
get shouldStopPropagation() {
|
|
135
136
|
return _class_private_field_get(this, $f6c31cce2adf654f$var$_shouldStopPropagation);
|
|
136
137
|
}
|
|
137
|
-
constructor(type, pointerType, originalEvent) {
|
|
138
|
+
constructor(type, pointerType, originalEvent, state) {
|
|
138
139
|
_class_private_field_init(this, $f6c31cce2adf654f$var$_shouldStopPropagation, {
|
|
139
140
|
writable: true,
|
|
140
141
|
value: void 0
|
|
141
142
|
});
|
|
142
143
|
_class_private_field_set(this, $f6c31cce2adf654f$var$_shouldStopPropagation, true);
|
|
144
|
+
var _state_target;
|
|
145
|
+
let currentTarget = (_state_target = state === null || state === void 0 ? void 0 : state.target) !== null && _state_target !== void 0 ? _state_target : originalEvent.currentTarget;
|
|
146
|
+
const rect = currentTarget === null || currentTarget === void 0 ? void 0 : currentTarget.getBoundingClientRect();
|
|
147
|
+
let x, y = 0;
|
|
148
|
+
let clientX, clientY = null;
|
|
149
|
+
if (originalEvent.clientX != null && originalEvent.clientY != null) {
|
|
150
|
+
clientX = originalEvent.clientX;
|
|
151
|
+
clientY = originalEvent.clientY;
|
|
152
|
+
}
|
|
153
|
+
if (rect) {
|
|
154
|
+
if (clientX != null && clientY != null) {
|
|
155
|
+
x = clientX - rect.left;
|
|
156
|
+
y = clientY - rect.top;
|
|
157
|
+
} else {
|
|
158
|
+
x = rect.width / 2;
|
|
159
|
+
y = rect.height / 2;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
143
162
|
this.type = type;
|
|
144
163
|
this.pointerType = pointerType;
|
|
145
164
|
this.target = originalEvent.currentTarget;
|
|
@@ -147,6 +166,8 @@ class $f6c31cce2adf654f$var$PressEvent {
|
|
|
147
166
|
this.metaKey = originalEvent.metaKey;
|
|
148
167
|
this.ctrlKey = originalEvent.ctrlKey;
|
|
149
168
|
this.altKey = originalEvent.altKey;
|
|
169
|
+
this.x = x;
|
|
170
|
+
this.y = y;
|
|
150
171
|
}
|
|
151
172
|
}
|
|
152
173
|
const $f6c31cce2adf654f$var$LINK_CLICKED = Symbol("linkClicked");
|
|
@@ -436,7 +457,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
436
457
|
state.pointerType = "touch";
|
|
437
458
|
if (!isDisabled && !preventFocusOnPress) $7215afc6de606d6b$export$de79e2c695e052f3(e.currentTarget);
|
|
438
459
|
if (!allowTextSelectionOnPress) $14c0b72509d70225$export$16a4697467175487(state.target);
|
|
439
|
-
let shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
460
|
+
let shouldStopPropagation = triggerPressStart($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType);
|
|
440
461
|
if (shouldStopPropagation) e.stopPropagation();
|
|
441
462
|
addGlobalListener($431fbd86ca7dc216$export$f21a1ffae260145a(e.currentTarget), "scroll", onScroll, true);
|
|
442
463
|
};
|
|
@@ -451,12 +472,12 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
451
472
|
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget)) {
|
|
452
473
|
if (!state.isOverTarget && state.pointerType != null) {
|
|
453
474
|
state.isOverTarget = true;
|
|
454
|
-
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
475
|
+
shouldStopPropagation = triggerPressStart($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType);
|
|
455
476
|
}
|
|
456
477
|
} else if (state.isOverTarget && state.pointerType != null) {
|
|
457
478
|
state.isOverTarget = false;
|
|
458
|
-
shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
|
|
459
|
-
cancelOnPointerExit(e);
|
|
479
|
+
shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
480
|
+
cancelOnPointerExit($f6c31cce2adf654f$var$createTouchEvent(state.target, e));
|
|
460
481
|
}
|
|
461
482
|
if (shouldStopPropagation) e.stopPropagation();
|
|
462
483
|
};
|
|
@@ -469,9 +490,9 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
469
490
|
let touch = $f6c31cce2adf654f$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
470
491
|
let shouldStopPropagation = true;
|
|
471
492
|
if (touch && $f6c31cce2adf654f$var$isOverTarget(touch, e.currentTarget) && state.pointerType != null) {
|
|
472
|
-
triggerPressUp(e, state.pointerType);
|
|
473
|
-
shouldStopPropagation = triggerPressEnd(e, state.pointerType);
|
|
474
|
-
} else if (state.isOverTarget && state.pointerType != null) shouldStopPropagation = triggerPressEnd(e, state.pointerType, false);
|
|
493
|
+
triggerPressUp($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType);
|
|
494
|
+
shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType);
|
|
495
|
+
} else if (state.isOverTarget && state.pointerType != null) shouldStopPropagation = triggerPressEnd($f6c31cce2adf654f$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
475
496
|
if (shouldStopPropagation) e.stopPropagation();
|
|
476
497
|
state.isPressed = false;
|
|
477
498
|
state.activePointerId = null;
|
|
@@ -483,7 +504,7 @@ function $f6c31cce2adf654f$export$45712eceda6fad21(props) {
|
|
|
483
504
|
pressProps2.onTouchCancel = (e) => {
|
|
484
505
|
if (!e.currentTarget.contains(e.target)) return;
|
|
485
506
|
e.stopPropagation();
|
|
486
|
-
if (state.isPressed) cancel(e);
|
|
507
|
+
if (state.isPressed) cancel($f6c31cce2adf654f$var$createTouchEvent(state.target, e));
|
|
487
508
|
};
|
|
488
509
|
let onScroll = (e) => {
|
|
489
510
|
if (state.isPressed && e.target.contains(state.target)) cancel({
|
|
@@ -549,13 +570,34 @@ function $f6c31cce2adf654f$var$getTouchById(event, pointerId) {
|
|
|
549
570
|
}
|
|
550
571
|
return null;
|
|
551
572
|
}
|
|
573
|
+
function $f6c31cce2adf654f$var$createTouchEvent(target, e) {
|
|
574
|
+
let clientX = 0;
|
|
575
|
+
let clientY = 0;
|
|
576
|
+
if (e.targetTouches && e.targetTouches.length === 1) {
|
|
577
|
+
clientX = e.targetTouches[0].clientX;
|
|
578
|
+
clientY = e.targetTouches[0].clientY;
|
|
579
|
+
}
|
|
580
|
+
return {
|
|
581
|
+
currentTarget: target,
|
|
582
|
+
shiftKey: e.shiftKey,
|
|
583
|
+
ctrlKey: e.ctrlKey,
|
|
584
|
+
metaKey: e.metaKey,
|
|
585
|
+
altKey: e.altKey,
|
|
586
|
+
clientX,
|
|
587
|
+
clientY
|
|
588
|
+
};
|
|
589
|
+
}
|
|
552
590
|
function $f6c31cce2adf654f$var$createEvent(target, e) {
|
|
591
|
+
let clientX = e.clientX;
|
|
592
|
+
let clientY = e.clientY;
|
|
553
593
|
return {
|
|
554
594
|
currentTarget: target,
|
|
555
595
|
shiftKey: e.shiftKey,
|
|
556
596
|
ctrlKey: e.ctrlKey,
|
|
557
597
|
metaKey: e.metaKey,
|
|
558
|
-
altKey: e.altKey
|
|
598
|
+
altKey: e.altKey,
|
|
599
|
+
clientX,
|
|
600
|
+
clientY
|
|
559
601
|
};
|
|
560
602
|
}
|
|
561
603
|
function $f6c31cce2adf654f$var$getPointClientRect(point) {
|
|
@@ -610,6 +652,6 @@ export {
|
|
|
610
652
|
$ea8dcbcb9ea1b556$export$7e924b3091a3bd18 as a,
|
|
611
653
|
$ea8dcbcb9ea1b556$export$9a302a45f65d0572 as b,
|
|
612
654
|
$ea8dcbcb9ea1b556$export$95185d699e05d4d7 as c,
|
|
613
|
-
$ea8dcbcb9ea1b556$export$
|
|
655
|
+
$ea8dcbcb9ea1b556$export$bdc77b0c0a3a85d6 as d,
|
|
614
656
|
$ae1eeba8b9eafd08$export$5165eccb35aaadb5 as e
|
|
615
657
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { $ as $e72dd72e1c76a225$export$2f645645f7bca764 } from "./useListState-Csx05BmT.js";
|
|
2
|
+
import { e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-PMGZgZ9-.js";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
function $a0d645289fe9b86b$export$e7f05e985daf4b5f(props) {
|
|
5
|
+
var _props_defaultSelectedKey;
|
|
6
|
+
let [selectedKey, setSelectedKey] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.selectedKey, (_props_defaultSelectedKey = props.defaultSelectedKey) !== null && _props_defaultSelectedKey !== void 0 ? _props_defaultSelectedKey : null, props.onSelectionChange);
|
|
7
|
+
let selectedKeys = useMemo(() => selectedKey != null ? [
|
|
8
|
+
selectedKey
|
|
9
|
+
] : [], [
|
|
10
|
+
selectedKey
|
|
11
|
+
]);
|
|
12
|
+
let { collection, disabledKeys, selectionManager } = $e72dd72e1c76a225$export$2f645645f7bca764({
|
|
13
|
+
...props,
|
|
14
|
+
selectionMode: "single",
|
|
15
|
+
disallowEmptySelection: true,
|
|
16
|
+
allowDuplicateSelectionEvents: true,
|
|
17
|
+
selectedKeys,
|
|
18
|
+
onSelectionChange: (keys) => {
|
|
19
|
+
var _keys_values_next_value;
|
|
20
|
+
let key = (_keys_values_next_value = keys.values().next().value) !== null && _keys_values_next_value !== void 0 ? _keys_values_next_value : null;
|
|
21
|
+
if (key === selectedKey && props.onSelectionChange) props.onSelectionChange(key);
|
|
22
|
+
setSelectedKey(key);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
let selectedItem = selectedKey != null ? collection.getItem(selectedKey) : null;
|
|
26
|
+
return {
|
|
27
|
+
collection,
|
|
28
|
+
disabledKeys,
|
|
29
|
+
selectionManager,
|
|
30
|
+
selectedKey,
|
|
31
|
+
setSelectedKey,
|
|
32
|
+
selectedItem
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
$a0d645289fe9b86b$export$e7f05e985daf4b5f as $
|
|
37
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-B4IdLYb8.js";
|
|
2
2
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
3
|
-
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-
|
|
4
|
-
import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c } from "./useFocusable-
|
|
5
|
-
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-
|
|
3
|
+
import { $ as $99facab73266f662$export$5add1d006293d136 } from "./useFormReset-BCPbwfnH.js";
|
|
4
|
+
import { $ as $e6afbd83fe6ebbd2$export$4c014de7c8940b4c } from "./useFocusable-BFKHuYS9.js";
|
|
5
|
+
import { $ as $f6c31cce2adf654f$export$45712eceda6fad21 } from "./usePress-CY8MpqYD.js";
|
|
6
6
|
function $d2c8e2b0480f3f34$export$cbe85ee05b554577(props, state, ref) {
|
|
7
7
|
let { isDisabled = false, isReadOnly = false, value, name, children, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, validationState = "valid", isInvalid } = props;
|
|
8
8
|
let onChange = (e) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-
|
|
1
|
+
import { e as $458b0a5536c1a7cf$export$40bfa8c7b0832715 } from "./focusSafely-PMGZgZ9-.js";
|
|
2
2
|
function $3017fa7ffdddec74$export$8042c6c013fd5226(props = {}) {
|
|
3
3
|
let { isReadOnly } = props;
|
|
4
4
|
let [isSelected, setSelected] = $458b0a5536c1a7cf$export$40bfa8c7b0832715(props.isSelected, props.defaultSelected || false, props.onChange);
|
|
@@ -1,44 +1,5 @@
|
|
|
1
|
-
import React__default, {
|
|
2
|
-
import { $ as $dbSRa$reactdom } from "./index-
|
|
3
|
-
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React__default.useLayoutEffect : () => {
|
|
4
|
-
};
|
|
5
|
-
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
6
|
-
const ref = useRef(null);
|
|
7
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
8
|
-
ref.current = fn;
|
|
9
|
-
}, [
|
|
10
|
-
fn
|
|
11
|
-
]);
|
|
12
|
-
return useCallback((...args) => {
|
|
13
|
-
const f = ref.current;
|
|
14
|
-
return f === null || f === void 0 ? void 0 : f(...args);
|
|
15
|
-
}, []);
|
|
16
|
-
}
|
|
17
|
-
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
18
|
-
let [value, setValue] = useState(defaultValue);
|
|
19
|
-
let effect = useRef(null);
|
|
20
|
-
let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
|
|
21
|
-
if (!effect.current) return;
|
|
22
|
-
let newValue = effect.current.next();
|
|
23
|
-
if (newValue.done) {
|
|
24
|
-
effect.current = null;
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (value === newValue.value) nextRef();
|
|
28
|
-
else setValue(newValue.value);
|
|
29
|
-
});
|
|
30
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
31
|
-
if (effect.current) nextRef();
|
|
32
|
-
});
|
|
33
|
-
let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52((fn) => {
|
|
34
|
-
effect.current = fn(value);
|
|
35
|
-
nextRef();
|
|
36
|
-
});
|
|
37
|
-
return [
|
|
38
|
-
value,
|
|
39
|
-
queue
|
|
40
|
-
];
|
|
41
|
-
}
|
|
1
|
+
import React__default, { useContext, useState, useRef, useCallback, useEffect, useMemo } from "react";
|
|
2
|
+
import { $ as $dbSRa$reactdom } from "./index-BTCzc3zb.js";
|
|
42
3
|
const $b5e257d569688ac6$var$defaultContext = {
|
|
43
4
|
prefix: String(Math.round(Math.random() * 1e10)),
|
|
44
5
|
current: 0
|
|
@@ -97,6 +58,45 @@ function $b5e257d569688ac6$export$535bd6ca7f90a273() {
|
|
|
97
58
|
if (typeof React__default["useSyncExternalStore"] === "function") return React__default["useSyncExternalStore"]($b5e257d569688ac6$var$subscribe, $b5e257d569688ac6$var$getSnapshot, $b5e257d569688ac6$var$getServerSnapshot);
|
|
98
59
|
return useContext($b5e257d569688ac6$var$IsSSRContext);
|
|
99
60
|
}
|
|
61
|
+
const $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c = typeof document !== "undefined" ? React__default.useLayoutEffect : () => {
|
|
62
|
+
};
|
|
63
|
+
function $8ae05eaa5c114e9c$export$7f54fc3180508a52(fn) {
|
|
64
|
+
const ref = useRef(null);
|
|
65
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
66
|
+
ref.current = fn;
|
|
67
|
+
}, [
|
|
68
|
+
fn
|
|
69
|
+
]);
|
|
70
|
+
return useCallback((...args) => {
|
|
71
|
+
const f = ref.current;
|
|
72
|
+
return f === null || f === void 0 ? void 0 : f(...args);
|
|
73
|
+
}, []);
|
|
74
|
+
}
|
|
75
|
+
function $1dbecbe27a04f9af$export$14d238f342723f25(defaultValue) {
|
|
76
|
+
let [value, setValue] = useState(defaultValue);
|
|
77
|
+
let effect = useRef(null);
|
|
78
|
+
let nextRef = $8ae05eaa5c114e9c$export$7f54fc3180508a52(() => {
|
|
79
|
+
if (!effect.current) return;
|
|
80
|
+
let newValue = effect.current.next();
|
|
81
|
+
if (newValue.done) {
|
|
82
|
+
effect.current = null;
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
if (value === newValue.value) nextRef();
|
|
86
|
+
else setValue(newValue.value);
|
|
87
|
+
});
|
|
88
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
89
|
+
if (effect.current) nextRef();
|
|
90
|
+
});
|
|
91
|
+
let queue = $8ae05eaa5c114e9c$export$7f54fc3180508a52((fn) => {
|
|
92
|
+
effect.current = fn(value);
|
|
93
|
+
nextRef();
|
|
94
|
+
});
|
|
95
|
+
return [
|
|
96
|
+
value,
|
|
97
|
+
queue
|
|
98
|
+
];
|
|
99
|
+
}
|
|
100
100
|
let $bdb11010cef70236$var$canUseDOM = Boolean(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
101
101
|
let $bdb11010cef70236$var$idsUpdaterMap = /* @__PURE__ */ new Map();
|
|
102
102
|
function $bdb11010cef70236$export$f680877a34711e37(defaultId) {
|
|
@@ -196,7 +196,7 @@ function $3ef42575df84b30b$export$9d1611c77c2fe928(...args) {
|
|
|
196
196
|
return result;
|
|
197
197
|
}
|
|
198
198
|
function $5dc95899b306f630$export$c9058316764c140e(...refs) {
|
|
199
|
-
if (refs.length === 1) return refs[0];
|
|
199
|
+
if (refs.length === 1 && refs[0]) return refs[0];
|
|
200
200
|
return (value) => {
|
|
201
201
|
for (let ref of refs) {
|
|
202
202
|
if (typeof ref === "function") ref(value);
|
|
@@ -382,40 +382,6 @@ function $64fa3d84918910a7$var$useAnimation(ref, isActive, onEnd) {
|
|
|
382
382
|
onEnd
|
|
383
383
|
]);
|
|
384
384
|
}
|
|
385
|
-
if (typeof HTMLTemplateElement !== "undefined") {
|
|
386
|
-
const getFirstChild = Object.getOwnPropertyDescriptor(Node.prototype, "firstChild").get;
|
|
387
|
-
Object.defineProperty(HTMLTemplateElement.prototype, "firstChild", {
|
|
388
|
-
configurable: true,
|
|
389
|
-
enumerable: true,
|
|
390
|
-
get: function() {
|
|
391
|
-
if (this.dataset.reactAriaHidden) return this.content.firstChild;
|
|
392
|
-
else return getFirstChild.call(this);
|
|
393
|
-
}
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
const $64fa3d84918910a7$export$94b6d0abf7d33e8c = /* @__PURE__ */ createContext(false);
|
|
397
|
-
const $64fa3d84918910a7$var$hiddenFragment = typeof DocumentFragment !== "undefined" ? new DocumentFragment() : null;
|
|
398
|
-
function $64fa3d84918910a7$export$8dc98ba7eadeaa56(props) {
|
|
399
|
-
let isHidden = useContext($64fa3d84918910a7$export$94b6d0abf7d33e8c);
|
|
400
|
-
let isSSR = $b5e257d569688ac6$export$535bd6ca7f90a273();
|
|
401
|
-
if (isHidden)
|
|
402
|
-
return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, props.children);
|
|
403
|
-
let children = /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$94b6d0abf7d33e8c.Provider, {
|
|
404
|
-
value: true
|
|
405
|
-
}, props.children);
|
|
406
|
-
return isSSR ? /* @__PURE__ */ React__default.createElement("template", {
|
|
407
|
-
"data-react-aria-hidden": true
|
|
408
|
-
}, children) : /* @__PURE__ */ $dbSRa$reactdom.createPortal(children, $64fa3d84918910a7$var$hiddenFragment);
|
|
409
|
-
}
|
|
410
|
-
function $64fa3d84918910a7$export$86427a43e3e48ebb(fn) {
|
|
411
|
-
let Wrapper = (props, ref) => {
|
|
412
|
-
let isHidden = useContext($64fa3d84918910a7$export$94b6d0abf7d33e8c);
|
|
413
|
-
if (isHidden) return null;
|
|
414
|
-
return fn(props, ref);
|
|
415
|
-
};
|
|
416
|
-
Wrapper.displayName = fn.displayName || fn.name;
|
|
417
|
-
return React__default.forwardRef(Wrapper);
|
|
418
|
-
}
|
|
419
385
|
function $64fa3d84918910a7$export$ef03459518577ad4(props) {
|
|
420
386
|
const prefix = /^(data-.*)$/;
|
|
421
387
|
let filteredProps = {};
|
|
@@ -425,9 +391,9 @@ function $64fa3d84918910a7$export$ef03459518577ad4(props) {
|
|
|
425
391
|
export {
|
|
426
392
|
$64fa3d84918910a7$export$fabf2dc03a41866e as $,
|
|
427
393
|
$64fa3d84918910a7$export$29f1550f4b0d4415 as a,
|
|
428
|
-
$64fa3d84918910a7$export$
|
|
429
|
-
$
|
|
430
|
-
$
|
|
394
|
+
$64fa3d84918910a7$export$4d86445c2cf5e3 as b,
|
|
395
|
+
$3ef42575df84b30b$export$9d1611c77c2fe928 as c,
|
|
396
|
+
$b5e257d569688ac6$export$535bd6ca7f90a273 as d,
|
|
431
397
|
$bdb11010cef70236$export$f680877a34711e37 as e,
|
|
432
398
|
$8ae05eaa5c114e9c$export$7f54fc3180508a52 as f,
|
|
433
399
|
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c as g,
|
|
@@ -438,10 +404,7 @@ export {
|
|
|
438
404
|
$df56164dff5785e2$export$4338b53315abf666 as l,
|
|
439
405
|
$5dc95899b306f630$export$c9058316764c140e as m,
|
|
440
406
|
$ff5963eb1fccf552$export$e08e3b67e392101e as n,
|
|
441
|
-
$
|
|
442
|
-
$64fa3d84918910a7$export$
|
|
443
|
-
$64fa3d84918910a7$export$
|
|
444
|
-
$64fa3d84918910a7$export$8dc98ba7eadeaa56 as r,
|
|
445
|
-
$64fa3d84918910a7$export$c62b8e45d58ddad9 as s,
|
|
446
|
-
$64fa3d84918910a7$export$94b6d0abf7d33e8c as t
|
|
407
|
+
$64fa3d84918910a7$export$45fda7c47f93fd48 as o,
|
|
408
|
+
$64fa3d84918910a7$export$6d3443f2c48bfc20 as p,
|
|
409
|
+
$64fa3d84918910a7$export$c62b8e45d58ddad9 as q
|
|
447
410
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eightshift/ui-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -36,34 +36,38 @@
|
|
|
36
36
|
"react-dom": "^18.3.1"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
+
"@dnd-kit/abstract": "^0.0.5",
|
|
40
|
+
"@dnd-kit/dom": "^0.0.5",
|
|
41
|
+
"@dnd-kit/helpers": "^0.0.5",
|
|
42
|
+
"@dnd-kit/react": "^0.0.5",
|
|
39
43
|
"react": "^18.3.1",
|
|
40
44
|
"react-dom": "^18.3.1",
|
|
41
|
-
"react-jsx-parser": "^
|
|
45
|
+
"react-jsx-parser": "^2.0.0",
|
|
42
46
|
"svg-to-jsx-string": "^0.1.1"
|
|
43
47
|
},
|
|
44
48
|
"devDependencies": {
|
|
45
|
-
"@adobe/react-spectrum": "^3.
|
|
49
|
+
"@adobe/react-spectrum": "^3.36.1",
|
|
46
50
|
"@dnd-kit/core": "^6.1.0",
|
|
47
51
|
"@dnd-kit/modifiers": "^7.0.0",
|
|
48
52
|
"@dnd-kit/sortable": "^8.0.0",
|
|
49
53
|
"@dnd-kit/utilities": "^3.2.2",
|
|
50
|
-
"@eslint/compat": "^1.1.
|
|
51
|
-
"@react-stately/collections": "^3.10.
|
|
54
|
+
"@eslint/compat": "^1.1.1",
|
|
55
|
+
"@react-stately/collections": "^3.10.9",
|
|
52
56
|
"@stylistic/eslint-plugin-js": "^2.3.0",
|
|
53
57
|
"@types/react": "^18.3.3",
|
|
54
58
|
"@types/react-dom": "^18.3.0",
|
|
55
59
|
"@vitejs/plugin-react-swc": "^3.7.0",
|
|
56
|
-
"@wordpress/i18n": "^5.
|
|
60
|
+
"@wordpress/i18n": "^5.4.0",
|
|
57
61
|
"autoprefixer": "^10.4.19",
|
|
58
62
|
"clsx": "^2.1.1",
|
|
59
63
|
"css-gradient-parser": "^0.0.16",
|
|
60
|
-
"eslint": "^9.
|
|
64
|
+
"eslint": "^9.7.0",
|
|
61
65
|
"eslint-config-prettier": "^9.1.0",
|
|
62
|
-
"eslint-plugin-jsdoc": "^48.
|
|
63
|
-
"eslint-plugin-prettier": "^5.1
|
|
64
|
-
"framer-motion": "^11.
|
|
65
|
-
"glob": "^
|
|
66
|
-
"globals": "^15.
|
|
66
|
+
"eslint-plugin-jsdoc": "^48.8.3",
|
|
67
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
68
|
+
"framer-motion": "^11.3.17",
|
|
69
|
+
"glob": "^11.0.0",
|
|
70
|
+
"globals": "^15.8.0",
|
|
67
71
|
"just-camel-case": "^6.2.0",
|
|
68
72
|
"just-debounce-it": "^3.2.0",
|
|
69
73
|
"just-has": "^2.3.0",
|
|
@@ -71,18 +75,17 @@
|
|
|
71
75
|
"just-kebab-case": "^4.2.0",
|
|
72
76
|
"just-throttle": "^4.2.0",
|
|
73
77
|
"lightningcss": "^1.25.1",
|
|
74
|
-
"postcss": "^8.4.
|
|
75
|
-
"prettier": "^3.3.
|
|
78
|
+
"postcss": "^8.4.40",
|
|
79
|
+
"prettier": "^3.3.3",
|
|
76
80
|
"prettier-plugin-tailwindcss": "^0.6.5",
|
|
77
|
-
"react-aria": "^3.
|
|
78
|
-
"react-aria-components": "^1.
|
|
81
|
+
"react-aria": "^3.34.1",
|
|
82
|
+
"react-aria-components": "^1.3.1",
|
|
79
83
|
"react-select": "^5.8.0",
|
|
80
|
-
"react-stately": "^3.
|
|
81
|
-
"tailwindcss": "^3.4.
|
|
84
|
+
"react-stately": "^3.32.1",
|
|
85
|
+
"tailwindcss": "^3.4.7",
|
|
82
86
|
"tailwindcss-animate": "^1.0.7",
|
|
83
|
-
"tailwindcss-react-aria-components": "^1.1.
|
|
84
|
-
"
|
|
85
|
-
"vite": "^5.3.2",
|
|
87
|
+
"tailwindcss-react-aria-components": "^1.1.4",
|
|
88
|
+
"vite": "^5.3.5",
|
|
86
89
|
"vite-plugin-lib-inject-css": "^2.1.1"
|
|
87
90
|
},
|
|
88
91
|
"scripts": {
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { $ as $4e85f108e88277b8$export$b085522c77523c51 } from "./RSPContexts-DQtGvvpM.js";
|
|
2
|
-
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "./utils-DC-UMp1n.js";
|
|
3
|
-
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "./Form-Cq3fu75_.js";
|
|
4
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "./filterDOMProps-EDDcM64A.js";
|
|
5
|
-
import React__default, { useEffect, useRef, forwardRef, useContext, createContext } from "react";
|
|
6
|
-
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, a as $e93e671b31057976$export$b8473d3665f3a75a, b as $e5be200c675c3b3a$export$dad6ae84456c676a, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "./useFormValidationState-DDC_nImg.js";
|
|
7
|
-
import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577 } from "./useToggle-CV-IX6nL.js";
|
|
8
|
-
import { $ as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "./useToggleState-DHIdITtQ.js";
|
|
9
|
-
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "./useFocusRing-Dg5Y_10S.js";
|
|
10
|
-
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "./focusSafely-DGZ4R5fj.js";
|
|
11
|
-
import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "./VisuallyHidden-BZPezMV5.js";
|
|
12
|
-
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
13
|
-
let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
14
|
-
...props,
|
|
15
|
-
value: state.isSelected
|
|
16
|
-
});
|
|
17
|
-
let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
|
|
18
|
-
let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
|
|
19
|
-
...props,
|
|
20
|
-
isInvalid
|
|
21
|
-
}, state, inputRef);
|
|
22
|
-
$e93e671b31057976$export$b8473d3665f3a75a(props, validationState, inputRef);
|
|
23
|
-
let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
labelProps,
|
|
29
|
-
inputProps: {
|
|
30
|
-
...inputProps,
|
|
31
|
-
checked: isSelected,
|
|
32
|
-
"aria-required": isRequired && validationBehavior === "aria" || void 0,
|
|
33
|
-
required: isRequired && validationBehavior === "native"
|
|
34
|
-
},
|
|
35
|
-
isSelected,
|
|
36
|
-
isPressed,
|
|
37
|
-
isDisabled,
|
|
38
|
-
isReadOnly,
|
|
39
|
-
isInvalid,
|
|
40
|
-
validationErrors,
|
|
41
|
-
validationDetails
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
|
|
45
|
-
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
|
|
46
|
-
const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226({
|
|
47
|
-
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
48
|
-
isSelected: state.isSelected(props.value),
|
|
49
|
-
onChange(isSelected) {
|
|
50
|
-
if (isSelected) state.addValue(props.value);
|
|
51
|
-
else state.removeValue(props.value);
|
|
52
|
-
if (props.onChange) props.onChange(isSelected);
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
let { name, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
|
|
56
|
-
var _props_validationBehavior;
|
|
57
|
-
validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
|
|
58
|
-
let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
59
|
-
...props,
|
|
60
|
-
value: toggleState.isSelected,
|
|
61
|
-
// Server validation is handled at the group level.
|
|
62
|
-
name: void 0,
|
|
63
|
-
validationBehavior: "aria"
|
|
64
|
-
});
|
|
65
|
-
let nativeValidation = useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
66
|
-
let updateValidation = () => {
|
|
67
|
-
state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
|
|
68
|
-
};
|
|
69
|
-
useEffect(updateValidation);
|
|
70
|
-
let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
|
|
71
|
-
let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
|
|
72
|
-
var _props_isRequired;
|
|
73
|
-
let res = $406796ff087fe49b$export$e375f10ce42261c5({
|
|
74
|
-
...props,
|
|
75
|
-
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
76
|
-
isDisabled: props.isDisabled || state.isDisabled,
|
|
77
|
-
name: props.name || name,
|
|
78
|
-
isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
|
|
79
|
-
validationBehavior,
|
|
80
|
-
[$e5be200c675c3b3a$export$a763b9476acd3eb]: {
|
|
81
|
-
realtimeValidation: combinedRealtimeValidation,
|
|
82
|
-
displayValidation,
|
|
83
|
-
resetValidation: state.resetValidation,
|
|
84
|
-
commitValidation: state.commitValidation,
|
|
85
|
-
updateValidation(v) {
|
|
86
|
-
nativeValidation.current = v;
|
|
87
|
-
updateValidation();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}, toggleState, inputRef);
|
|
91
|
-
return {
|
|
92
|
-
...res,
|
|
93
|
-
inputProps: {
|
|
94
|
-
...res.inputProps,
|
|
95
|
-
"aria-describedby": [
|
|
96
|
-
props["aria-describedby"],
|
|
97
|
-
state.isInvalid ? errorMessageId : null,
|
|
98
|
-
descriptionId
|
|
99
|
-
].filter(Boolean).join(" ") || void 0
|
|
100
|
-
}
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const $bc237834342dbd75$export$139c5b8563afc1fc = /* @__PURE__ */ createContext(null);
|
|
104
|
-
function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
105
|
-
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
106
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(otherProps, ref, $4e85f108e88277b8$export$b085522c77523c51);
|
|
107
|
-
let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
|
|
108
|
-
var _props_validationBehavior, _ref;
|
|
109
|
-
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
|
|
110
|
-
let groupState = useContext($bc237834342dbd75$export$139c5b8563afc1fc);
|
|
111
|
-
let inputRef = $df56164dff5785e2$export$4338b53315abf666($5dc95899b306f630$export$c9058316764c140e(userProvidedInputRef, props.inputRef !== void 0 ? props.inputRef : null));
|
|
112
|
-
let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid } = groupState ? $fba3e38d5ca8983f$export$353b32fc6898d37d({
|
|
113
|
-
...props,
|
|
114
|
-
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
115
|
-
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
116
|
-
// @ts-ignore
|
|
117
|
-
value: props.value,
|
|
118
|
-
// ReactNode type doesn't allow function children.
|
|
119
|
-
children: typeof props.children === "function" ? true : props.children
|
|
120
|
-
}, groupState, inputRef) : $406796ff087fe49b$export$e375f10ce42261c5({
|
|
121
|
-
...props,
|
|
122
|
-
children: typeof props.children === "function" ? true : props.children,
|
|
123
|
-
validationBehavior
|
|
124
|
-
}, $3017fa7ffdddec74$export$8042c6c013fd5226(props), inputRef);
|
|
125
|
-
let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
|
|
126
|
-
let isInteractionDisabled = isDisabled || isReadOnly;
|
|
127
|
-
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
128
|
-
...props,
|
|
129
|
-
isDisabled: isInteractionDisabled
|
|
130
|
-
});
|
|
131
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
132
|
-
// TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
|
|
133
|
-
...props,
|
|
134
|
-
defaultClassName: "react-aria-Checkbox",
|
|
135
|
-
values: {
|
|
136
|
-
isSelected,
|
|
137
|
-
isIndeterminate: props.isIndeterminate || false,
|
|
138
|
-
isPressed,
|
|
139
|
-
isHovered,
|
|
140
|
-
isFocused,
|
|
141
|
-
isFocusVisible,
|
|
142
|
-
isDisabled,
|
|
143
|
-
isReadOnly,
|
|
144
|
-
isInvalid,
|
|
145
|
-
isRequired: props.isRequired || false
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
149
|
-
delete DOMProps.id;
|
|
150
|
-
return /* @__PURE__ */ React__default.createElement("label", {
|
|
151
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, labelProps, hoverProps, renderProps),
|
|
152
|
-
ref,
|
|
153
|
-
slot: props.slot || void 0,
|
|
154
|
-
"data-selected": isSelected || void 0,
|
|
155
|
-
"data-indeterminate": props.isIndeterminate || void 0,
|
|
156
|
-
"data-pressed": isPressed || void 0,
|
|
157
|
-
"data-hovered": isHovered || void 0,
|
|
158
|
-
"data-focused": isFocused || void 0,
|
|
159
|
-
"data-focus-visible": isFocusVisible || void 0,
|
|
160
|
-
"data-disabled": isDisabled || void 0,
|
|
161
|
-
"data-readonly": isReadOnly || void 0,
|
|
162
|
-
"data-invalid": isInvalid || void 0,
|
|
163
|
-
"data-required": props.isRequired || void 0
|
|
164
|
-
}, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, {
|
|
165
|
-
elementType: "span"
|
|
166
|
-
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
167
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps),
|
|
168
|
-
ref: inputRef
|
|
169
|
-
})), renderProps.children);
|
|
170
|
-
}
|
|
171
|
-
const $bc237834342dbd75$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef($bc237834342dbd75$var$Checkbox);
|
|
172
|
-
export {
|
|
173
|
-
$bc237834342dbd75$export$48513f6b9f8ce62d as $
|
|
174
|
-
};
|