@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,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../Text-
|
|
2
|
+
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../Text-D8qh3_U7.js";
|
|
3
3
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
4
4
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
5
5
|
/**
|
|
@@ -1,11 +1,276 @@
|
|
|
1
|
-
import "react/jsx-runtime";
|
|
2
|
-
import "../../Button-
|
|
3
|
-
import {
|
|
4
|
-
import "../../
|
|
5
|
-
import "
|
|
6
|
-
import "../../
|
|
7
|
-
import "../../
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { a as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-uYE9D_E3.js";
|
|
3
|
+
import { g as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, a as $64fa3d84918910a7$export$29f1550f4b0d4415, b as $64fa3d84918910a7$export$4d86445c2cf5e3, c as $3ef42575df84b30b$export$9d1611c77c2fe928, l as $df56164dff5785e2$export$4338b53315abf666 } from "../../utils-B4IdLYb8.js";
|
|
4
|
+
import { b as $9bf71ea28793e738$export$c5251b9e124bf29 } from "../../FocusScope-CVd6C65L.js";
|
|
5
|
+
import React__default, { useState, useRef, forwardRef, createContext } from "react";
|
|
6
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-Bon2Gyx5.js";
|
|
7
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
8
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
9
|
+
import { T as Tooltip } from "../../tooltip-C9mg1CP5.js";
|
|
10
|
+
import { _ as __ } from "../../default-i18n-BqWys-1G.js";
|
|
11
|
+
function $2680b1829e803644$export$fa142eb1681c520(props, ref) {
|
|
12
|
+
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, orientation = "horizontal" } = props;
|
|
13
|
+
let [isInToolbar, setInToolbar] = useState(false);
|
|
14
|
+
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
15
|
+
var _ref_current_parentElement;
|
|
16
|
+
setInToolbar(!!(ref.current && ((_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.closest('[role="toolbar"]'))));
|
|
17
|
+
});
|
|
18
|
+
const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
19
|
+
const shouldReverse = direction === "rtl" && orientation === "horizontal";
|
|
20
|
+
let focusManager = $9bf71ea28793e738$export$c5251b9e124bf29(ref);
|
|
21
|
+
const onKeyDown = (e) => {
|
|
22
|
+
if (!e.currentTarget.contains(e.target)) return;
|
|
23
|
+
if (orientation === "horizontal" && e.key === "ArrowRight" || orientation === "vertical" && e.key === "ArrowDown") {
|
|
24
|
+
if (shouldReverse) focusManager.focusPrevious();
|
|
25
|
+
else focusManager.focusNext();
|
|
26
|
+
} else if (orientation === "horizontal" && e.key === "ArrowLeft" || orientation === "vertical" && e.key === "ArrowUp") {
|
|
27
|
+
if (shouldReverse) focusManager.focusNext();
|
|
28
|
+
else focusManager.focusPrevious();
|
|
29
|
+
} else if (e.key === "Tab") {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
lastFocused.current = document.activeElement;
|
|
32
|
+
if (e.shiftKey) focusManager.focusFirst();
|
|
33
|
+
else focusManager.focusLast();
|
|
34
|
+
return;
|
|
35
|
+
} else
|
|
36
|
+
return;
|
|
37
|
+
e.stopPropagation();
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
};
|
|
40
|
+
const lastFocused = useRef(null);
|
|
41
|
+
const onBlur = (e) => {
|
|
42
|
+
if (!e.currentTarget.contains(e.relatedTarget) && !lastFocused.current) lastFocused.current = e.target;
|
|
43
|
+
};
|
|
44
|
+
const onFocus = (e) => {
|
|
45
|
+
var _ref_current;
|
|
46
|
+
if (lastFocused.current && !e.currentTarget.contains(e.relatedTarget) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e.target))) {
|
|
47
|
+
var _lastFocused_current;
|
|
48
|
+
(_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.focus();
|
|
49
|
+
lastFocused.current = null;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
toolbarProps: {
|
|
54
|
+
role: !isInToolbar ? "toolbar" : "group",
|
|
55
|
+
"aria-orientation": orientation,
|
|
56
|
+
"aria-label": ariaLabel,
|
|
57
|
+
"aria-labelledby": ariaLabel == null ? ariaLabelledBy : void 0,
|
|
58
|
+
onKeyDownCapture: !isInToolbar ? onKeyDown : void 0,
|
|
59
|
+
onFocusCapture: !isInToolbar ? onFocus : void 0,
|
|
60
|
+
onBlurCapture: !isInToolbar ? onBlur : void 0
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
const $13c3c67164f4d5be$export$6311e7ab80ef752f = /* @__PURE__ */ createContext({});
|
|
65
|
+
function $13c3c67164f4d5be$var$Toolbar(props, ref) {
|
|
66
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $13c3c67164f4d5be$export$6311e7ab80ef752f);
|
|
67
|
+
let { toolbarProps } = $2680b1829e803644$export$fa142eb1681c520(props, ref);
|
|
68
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
69
|
+
...props,
|
|
70
|
+
values: {
|
|
71
|
+
orientation: props.orientation || "horizontal"
|
|
72
|
+
},
|
|
73
|
+
defaultClassName: "react-aria-Toolbar"
|
|
74
|
+
});
|
|
75
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
76
|
+
delete DOMProps.id;
|
|
77
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
78
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(toolbarProps, DOMProps),
|
|
79
|
+
...renderProps,
|
|
80
|
+
ref,
|
|
81
|
+
slot: props.slot || void 0,
|
|
82
|
+
"data-orientation": props.orientation || "horizontal"
|
|
83
|
+
}, renderProps.children);
|
|
84
|
+
}
|
|
85
|
+
const $13c3c67164f4d5be$export$4c260019440d418f = /* @__PURE__ */ forwardRef($13c3c67164f4d5be$var$Toolbar);
|
|
86
|
+
/**
|
|
87
|
+
* A simple button component.
|
|
88
|
+
*
|
|
89
|
+
* @component
|
|
90
|
+
* @param {Object} props - Component props.
|
|
91
|
+
* @param {JSX.Element} [props.icon] - Icon to display within the button.
|
|
92
|
+
* @param {ButtonSize} [props.size='default'] - The size of the button.
|
|
93
|
+
* @param {ButtonType} [props.type='default'] - The type of the button.
|
|
94
|
+
* @param {boolean} [props.disabled] - If `true`, the button is disabled.
|
|
95
|
+
* @param {string} [props.className] - Classes to pass to the button.
|
|
96
|
+
* @param {string} [props.tooltip] - Tooltip text to display on hover.
|
|
97
|
+
* @param {Function} [props.onPress] - Function to run when the button is pressed.
|
|
98
|
+
* @param {React.Ref} [props.forwardedRef] - Ref to forward to the button. Use the same as the `ref` prop.
|
|
99
|
+
* @param {string} [props.wrapperClassName] - Classes to pass to the tooltip wrapper.
|
|
100
|
+
* @param {Object} [props.tooltipProps] - Props to pass to the tooltip.
|
|
101
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
102
|
+
*
|
|
103
|
+
* @returns {JSX.Element} The Button component.
|
|
104
|
+
*
|
|
105
|
+
* @typedef {'small' | 'default' | 'large'} ButtonSize
|
|
106
|
+
* @typedef {'default' | 'selected' | 'ghost' | 'danger'} ButtonType
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* <Button onPress={() => console.log('Hi!')} icon={icons.myIcon} />
|
|
110
|
+
*
|
|
111
|
+
* <Button onPress={() => console.log('Hi!')} icon={icons.myIcon}>My button</Button>
|
|
112
|
+
*
|
|
113
|
+
* @preserve
|
|
114
|
+
*/
|
|
115
|
+
const Button = (props) => {
|
|
116
|
+
var _a, _b, _c, _d;
|
|
117
|
+
const {
|
|
118
|
+
children,
|
|
119
|
+
icon,
|
|
120
|
+
size = "default",
|
|
121
|
+
type = "default",
|
|
122
|
+
disabled,
|
|
123
|
+
className,
|
|
124
|
+
tooltip,
|
|
125
|
+
onPress,
|
|
126
|
+
forwardedRef,
|
|
127
|
+
wrapperClassName,
|
|
128
|
+
tooltipProps,
|
|
129
|
+
"aria-label": ariaLabel = typeof children === "string" ? children : __("Menu item", "eightshift-ui-components"),
|
|
130
|
+
hidden,
|
|
131
|
+
...other
|
|
132
|
+
} = props;
|
|
133
|
+
const objRef = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
|
|
134
|
+
if (hidden) {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
const sizes = {
|
|
138
|
+
small: {
|
|
139
|
+
iconButton: "es-uic-size-7",
|
|
140
|
+
button: "es-uic-h-7 es-uic-min-w-7",
|
|
141
|
+
iconButtonPadding: "es-uic-px-1",
|
|
142
|
+
buttonPadding: "es-uic-px-2",
|
|
143
|
+
iconSize: "[&>svg]:es-uic-size-4.5"
|
|
144
|
+
},
|
|
145
|
+
default: {
|
|
146
|
+
iconButton: "es-uic-size-9",
|
|
147
|
+
button: "es-uic-h-9 es-uic-min-w-9",
|
|
148
|
+
iconButtonPadding: "es-uic-px-1.5",
|
|
149
|
+
buttonPadding: "es-uic-px-2",
|
|
150
|
+
iconSize: "[&>svg]:es-uic-size-5.5"
|
|
151
|
+
},
|
|
152
|
+
large: {
|
|
153
|
+
iconButton: "es-uic-size-10",
|
|
154
|
+
button: "es-uic-h-10 es-uic-min-w-10",
|
|
155
|
+
iconButtonPadding: "es-uic-px-2",
|
|
156
|
+
buttonPadding: "es-uic-px-4",
|
|
157
|
+
iconSize: "[&>svg]:es-uic-size-6"
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
const themes = {
|
|
161
|
+
default: {
|
|
162
|
+
regular: "es-uic-text-gray-700 es-uic-shadow-sm es-uic-border es-uic-border-gray-300 es-uic-bg-white",
|
|
163
|
+
hover: "hover:es-uic-border-gray-300 hover:es-uic-bg-gray-100",
|
|
164
|
+
disabled: "disabled:es-uic-border-gray-300 disabled:es-uic-bg-gray-50/50 disabled:es-uic-text-gray-300 es-uic-border",
|
|
165
|
+
focus: "focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50"
|
|
166
|
+
},
|
|
167
|
+
selected: {
|
|
168
|
+
regular: "es-uic-bg-teal-600 es-uic-text-white es-uic-border-teal-600 after:es-uic-opacity-45 es-uic-border es-uic-shadow-md es-uic-shadow-teal-500/25",
|
|
169
|
+
hover: "hover:es-uic-shadow-teal-600/50 hover:after:es-uic-opacity-60"
|
|
170
|
+
},
|
|
171
|
+
ghost: {
|
|
172
|
+
regular: "es-uic-border-transparent es-uic-text-gray-700",
|
|
173
|
+
hover: "hover:es-uic-bg-gray-100",
|
|
174
|
+
disabled: "disabled:es-uic-text-gray-300 disabled:es-uic-border-transparent"
|
|
175
|
+
},
|
|
176
|
+
danger: {
|
|
177
|
+
regular: "es-uic-border-red-300 es-uic-text-gray-700 es-uic-text-gray-900 es-uic-shadow-red-300/30 [&>svg]:es-uic-text-red-500 es-uic-shadow-sm es-uic-border",
|
|
178
|
+
hover: "hover:es-uic-border-red-400 hover:es-uic-bg-red-50 hover:es-uic-text-red-500 hover:es-uic-shadow-red-300/75",
|
|
179
|
+
focus: "focus-visible:es-uic-ring-red-500 focus-visible:es-uic-ring-opacity-50"
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
const component = /* @__PURE__ */ jsxs(
|
|
183
|
+
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
184
|
+
{
|
|
185
|
+
onPress,
|
|
186
|
+
isDisabled: disabled,
|
|
187
|
+
className: clsx(
|
|
188
|
+
"es-uic-flex es-uic-items-center es-uic-gap-1 es-uic-rounded-md es-uic-transition es-uic-duration-300",
|
|
189
|
+
icon && children && "es-uic-justify-start",
|
|
190
|
+
icon && !children && "es-uic-justify-center",
|
|
191
|
+
!icon && children && "es-uic-justify-center",
|
|
192
|
+
!disabled && (((_a = themes[type]) == null ? void 0 : _a.regular) ?? themes.default.regular),
|
|
193
|
+
!disabled && (((_b = themes[type]) == null ? void 0 : _b.hover) ?? themes.default.hover),
|
|
194
|
+
"disabled:es-uic-shadow-none",
|
|
195
|
+
disabled && (((_c = themes[type]) == null ? void 0 : _c.disabled) ?? themes.default.disabled),
|
|
196
|
+
"focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring",
|
|
197
|
+
((_d = themes[type]) == null ? void 0 : _d.focus) ?? themes.default.focus,
|
|
198
|
+
icon && !children && sizes[size].iconButton,
|
|
199
|
+
children && "es-uic-text-sm",
|
|
200
|
+
children && sizes[size].button,
|
|
201
|
+
children && icon && sizes[size].iconButtonPadding,
|
|
202
|
+
children && !icon && sizes[size].buttonPadding,
|
|
203
|
+
"[.es-uic-button-group-h_&:not(:first-child)]:es-uic-rounded-l-none [.es-uic-button-group-h_&:not(:last-child)]:-es-uic-mr-px [.es-uic-button-group-h_&:not(:last-child)]:es-uic-rounded-r-none",
|
|
204
|
+
"[.es-uic-button-group-h_div:not(:first-child)_>_&]:es-uic-rounded-l-none [.es-uic-button-group-h_div:not(:last-child)_>_&]:-es-uic-mr-px [.es-uic-button-group-h_div:not(:last-child)_>_&]:es-uic-rounded-r-none",
|
|
205
|
+
sizes[size].iconSize,
|
|
206
|
+
type === "selected" && 'es-uic-relative es-uic-isolate after:es-uic-absolute after:es-uic-inset-0 after:-es-uic-z-10 after:es-uic-rounded-[0.3125rem] after:es-uic-bg-gradient-to-br after:es-uic-from-teal-100/40 after:es-uic-via-transparent after:es-uic-to-teal-200/50 after:es-uic-opacity-0 after:es-uic-transition-opacity after:es-uic-content-[""]',
|
|
207
|
+
type === "selected" && "[.es-uic-button-group-h_&:not(:first-child)]:after:es-uic-rounded-l-none [.es-uic-button-group-h_&:not(:last-child)]:after:es-uic-rounded-r-none",
|
|
208
|
+
type === "selected" && "[.es-uic-button-group-h_div:not(:first-child)_>_&]:after:es-uic-rounded-l-none [.es-uic-button-group-h_div:not(:last-child)_>_&]:after:es-uic-rounded-r-none",
|
|
209
|
+
"[.es-uic-button-group-v_&:not(:first-child)]:es-uic-rounded-t-none [.es-uic-button-group-v_&:not(:last-child)]:-es-uic-mb-px [.es-uic-button-group-v_&:not(:last-child)]:es-uic-rounded-b-none",
|
|
210
|
+
"[.es-uic-button-group-v_div:not(:first-child)_>_&]:es-uic-rounded-t-none [.es-uic-button-group-v_div:not(:last-child)_>_&]:-es-uic-mb-px [.es-uic-button-group-v_div:not(:last-child)_>_&]:es-uic-rounded-b-none",
|
|
211
|
+
type === "selected" && "[.es-uic-button-group-v_&:not(:first-child)]:after:es-uic-rounded-t-none [.es-uic-button-group-v_&:not(:last-child)]:after:es-uic-rounded-b-none",
|
|
212
|
+
type === "selected" && "[.es-uic-button-group-v_div:not(:first-child)_>_&]:after:es-uic-rounded-t-none [.es-uic-button-group-v_div:not(:last-child)_>_&]:after:es-uic-rounded-b-none",
|
|
213
|
+
className
|
|
214
|
+
),
|
|
215
|
+
ref: objRef,
|
|
216
|
+
"aria-label": ariaLabel,
|
|
217
|
+
...other,
|
|
218
|
+
children: [
|
|
219
|
+
icon,
|
|
220
|
+
children
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
if (!tooltip) {
|
|
225
|
+
return component;
|
|
226
|
+
}
|
|
227
|
+
return /* @__PURE__ */ jsx(
|
|
228
|
+
Tooltip,
|
|
229
|
+
{
|
|
230
|
+
text: tooltip,
|
|
231
|
+
wrapperClassName,
|
|
232
|
+
...tooltipProps,
|
|
233
|
+
children: component
|
|
234
|
+
}
|
|
235
|
+
);
|
|
236
|
+
};
|
|
237
|
+
/**
|
|
238
|
+
* A wrapper for `Button` or `ToggleButton` components that visually groups them and ensures proper keyboard navigation.
|
|
239
|
+
*
|
|
240
|
+
* **Note**: Only intended for horizontal groups of buttons that don't wrap.
|
|
241
|
+
*
|
|
242
|
+
* @component
|
|
243
|
+
* @param {Object} props - Component props.
|
|
244
|
+
* @param {string} [props.className] - Classes to pass to the button group container.
|
|
245
|
+
* @param {boolean} [props.vertical] - If `true`, the buttons are displayed vertically.
|
|
246
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
247
|
+
*
|
|
248
|
+
* @returns {JSX.Element} The ButtonGroup component.
|
|
249
|
+
*
|
|
250
|
+
* @example
|
|
251
|
+
* <ButtonGroup>
|
|
252
|
+
* <Button ... />
|
|
253
|
+
* <Button ... />
|
|
254
|
+
* <Button ... />
|
|
255
|
+
* </ButtonGroup>
|
|
256
|
+
*
|
|
257
|
+
* @preserve
|
|
258
|
+
*/
|
|
259
|
+
const ButtonGroup = ({ children, className, vertical, hidden, ...rest }) => {
|
|
260
|
+
if (hidden) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
return /* @__PURE__ */ jsx(
|
|
264
|
+
$13c3c67164f4d5be$export$4c260019440d418f,
|
|
265
|
+
{
|
|
266
|
+
className: clsx("es-uic-flex", vertical ? "es-uic-button-group-v es-uic-flex-col" : "es-uic-button-group-h", className),
|
|
267
|
+
orientation: vertical ? "vertical" : "horizontal",
|
|
268
|
+
...rest,
|
|
269
|
+
children
|
|
270
|
+
}
|
|
271
|
+
);
|
|
272
|
+
};
|
|
8
273
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
274
|
+
Button,
|
|
275
|
+
ButtonGroup
|
|
11
276
|
};
|
|
@@ -1,9 +1,179 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $
|
|
2
|
+
import { $ as $4e85f108e88277b8$export$b085522c77523c51 } from "../../RSPContexts-DQtGvvpM.js";
|
|
3
|
+
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, b as $64fa3d84918910a7$export$4d86445c2cf5e3, c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "../../utils-B4IdLYb8.js";
|
|
4
|
+
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
|
|
5
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
6
|
+
import React__default, { useEffect, useRef, forwardRef, useContext, createContext } from "react";
|
|
7
|
+
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, a as $e93e671b31057976$export$b8473d3665f3a75a, b as $e5be200c675c3b3a$export$dad6ae84456c676a, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "../../useFormValidationState-DC5jbhBW.js";
|
|
8
|
+
import { $ as $d2c8e2b0480f3f34$export$cbe85ee05b554577 } from "../../useToggle-CJp2Fh_L.js";
|
|
9
|
+
import { $ as $3017fa7ffdddec74$export$8042c6c013fd5226 } from "../../useToggleState-B4--Ski0.js";
|
|
10
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-DsxEaA2J.js";
|
|
11
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../focusSafely-PMGZgZ9-.js";
|
|
12
|
+
import { $ as $5c3e21d68f1c4674$export$439d29a4e110a164 } from "../../VisuallyHidden-DD480kAb.js";
|
|
3
13
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
4
14
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
5
15
|
import { icons } from "../../icons/icons.js";
|
|
6
16
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
17
|
+
function $406796ff087fe49b$export$e375f10ce42261c5(props, state, inputRef) {
|
|
18
|
+
let validationState = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
19
|
+
...props,
|
|
20
|
+
value: state.isSelected
|
|
21
|
+
});
|
|
22
|
+
let { isInvalid, validationErrors, validationDetails } = validationState.displayValidation;
|
|
23
|
+
let { labelProps, inputProps, isSelected, isPressed, isDisabled, isReadOnly } = $d2c8e2b0480f3f34$export$cbe85ee05b554577({
|
|
24
|
+
...props,
|
|
25
|
+
isInvalid
|
|
26
|
+
}, state, inputRef);
|
|
27
|
+
$e93e671b31057976$export$b8473d3665f3a75a(props, validationState, inputRef);
|
|
28
|
+
let { isIndeterminate, isRequired, validationBehavior = "aria" } = props;
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (inputRef.current) inputRef.current.indeterminate = !!isIndeterminate;
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
labelProps,
|
|
34
|
+
inputProps: {
|
|
35
|
+
...inputProps,
|
|
36
|
+
checked: isSelected,
|
|
37
|
+
"aria-required": isRequired && validationBehavior === "aria" || void 0,
|
|
38
|
+
required: isRequired && validationBehavior === "native"
|
|
39
|
+
},
|
|
40
|
+
isSelected,
|
|
41
|
+
isPressed,
|
|
42
|
+
isDisabled,
|
|
43
|
+
isReadOnly,
|
|
44
|
+
isInvalid,
|
|
45
|
+
validationErrors,
|
|
46
|
+
validationDetails
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const $1ae600c947479353$export$ec98120685d4f57d = /* @__PURE__ */ new WeakMap();
|
|
50
|
+
function $fba3e38d5ca8983f$export$353b32fc6898d37d(props, state, inputRef) {
|
|
51
|
+
const toggleState = $3017fa7ffdddec74$export$8042c6c013fd5226({
|
|
52
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
53
|
+
isSelected: state.isSelected(props.value),
|
|
54
|
+
onChange(isSelected) {
|
|
55
|
+
if (isSelected) state.addValue(props.value);
|
|
56
|
+
else state.removeValue(props.value);
|
|
57
|
+
if (props.onChange) props.onChange(isSelected);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
let { name, descriptionId, errorMessageId, validationBehavior } = $1ae600c947479353$export$ec98120685d4f57d.get(state);
|
|
61
|
+
var _props_validationBehavior;
|
|
62
|
+
validationBehavior = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : validationBehavior;
|
|
63
|
+
let { realtimeValidation } = $e5be200c675c3b3a$export$fc1a364ae1f3ff10({
|
|
64
|
+
...props,
|
|
65
|
+
value: toggleState.isSelected,
|
|
66
|
+
// Server validation is handled at the group level.
|
|
67
|
+
name: void 0,
|
|
68
|
+
validationBehavior: "aria"
|
|
69
|
+
});
|
|
70
|
+
let nativeValidation = useRef($e5be200c675c3b3a$export$dad6ae84456c676a);
|
|
71
|
+
let updateValidation = () => {
|
|
72
|
+
state.setInvalid(props.value, realtimeValidation.isInvalid ? realtimeValidation : nativeValidation.current);
|
|
73
|
+
};
|
|
74
|
+
useEffect(updateValidation);
|
|
75
|
+
let combinedRealtimeValidation = state.realtimeValidation.isInvalid ? state.realtimeValidation : realtimeValidation;
|
|
76
|
+
let displayValidation = validationBehavior === "native" ? state.displayValidation : combinedRealtimeValidation;
|
|
77
|
+
var _props_isRequired;
|
|
78
|
+
let res = $406796ff087fe49b$export$e375f10ce42261c5({
|
|
79
|
+
...props,
|
|
80
|
+
isReadOnly: props.isReadOnly || state.isReadOnly,
|
|
81
|
+
isDisabled: props.isDisabled || state.isDisabled,
|
|
82
|
+
name: props.name || name,
|
|
83
|
+
isRequired: (_props_isRequired = props.isRequired) !== null && _props_isRequired !== void 0 ? _props_isRequired : state.isRequired,
|
|
84
|
+
validationBehavior,
|
|
85
|
+
[$e5be200c675c3b3a$export$a763b9476acd3eb]: {
|
|
86
|
+
realtimeValidation: combinedRealtimeValidation,
|
|
87
|
+
displayValidation,
|
|
88
|
+
resetValidation: state.resetValidation,
|
|
89
|
+
commitValidation: state.commitValidation,
|
|
90
|
+
updateValidation(v) {
|
|
91
|
+
nativeValidation.current = v;
|
|
92
|
+
updateValidation();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}, toggleState, inputRef);
|
|
96
|
+
return {
|
|
97
|
+
...res,
|
|
98
|
+
inputProps: {
|
|
99
|
+
...res.inputProps,
|
|
100
|
+
"aria-describedby": [
|
|
101
|
+
props["aria-describedby"],
|
|
102
|
+
state.isInvalid ? errorMessageId : null,
|
|
103
|
+
descriptionId
|
|
104
|
+
].filter(Boolean).join(" ") || void 0
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
const $bc237834342dbd75$export$139c5b8563afc1fc = /* @__PURE__ */ createContext(null);
|
|
109
|
+
function $bc237834342dbd75$var$Checkbox(props, ref) {
|
|
110
|
+
let { inputRef: userProvidedInputRef = null, ...otherProps } = props;
|
|
111
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(otherProps, ref, $4e85f108e88277b8$export$b085522c77523c51);
|
|
112
|
+
let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
|
|
113
|
+
var _props_validationBehavior, _ref;
|
|
114
|
+
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
|
|
115
|
+
let groupState = useContext($bc237834342dbd75$export$139c5b8563afc1fc);
|
|
116
|
+
let inputRef = $df56164dff5785e2$export$4338b53315abf666($5dc95899b306f630$export$c9058316764c140e(userProvidedInputRef, props.inputRef !== void 0 ? props.inputRef : null));
|
|
117
|
+
let { labelProps, inputProps, isSelected, isDisabled, isReadOnly, isPressed, isInvalid } = groupState ? $fba3e38d5ca8983f$export$353b32fc6898d37d({
|
|
118
|
+
...props,
|
|
119
|
+
// Value is optional for standalone checkboxes, but required for CheckboxGroup items;
|
|
120
|
+
// it's passed explicitly here to avoid typescript error (requires ignore).
|
|
121
|
+
// @ts-ignore
|
|
122
|
+
value: props.value,
|
|
123
|
+
// ReactNode type doesn't allow function children.
|
|
124
|
+
children: typeof props.children === "function" ? true : props.children
|
|
125
|
+
}, groupState, inputRef) : $406796ff087fe49b$export$e375f10ce42261c5({
|
|
126
|
+
...props,
|
|
127
|
+
children: typeof props.children === "function" ? true : props.children,
|
|
128
|
+
validationBehavior
|
|
129
|
+
}, $3017fa7ffdddec74$export$8042c6c013fd5226(props), inputRef);
|
|
130
|
+
let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f();
|
|
131
|
+
let isInteractionDisabled = isDisabled || isReadOnly;
|
|
132
|
+
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456({
|
|
133
|
+
...props,
|
|
134
|
+
isDisabled: isInteractionDisabled
|
|
135
|
+
});
|
|
136
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
137
|
+
// TODO: should data attrs go on the label or on the <input>? useCheckbox passes them to the input...
|
|
138
|
+
...props,
|
|
139
|
+
defaultClassName: "react-aria-Checkbox",
|
|
140
|
+
values: {
|
|
141
|
+
isSelected,
|
|
142
|
+
isIndeterminate: props.isIndeterminate || false,
|
|
143
|
+
isPressed,
|
|
144
|
+
isHovered,
|
|
145
|
+
isFocused,
|
|
146
|
+
isFocusVisible,
|
|
147
|
+
isDisabled,
|
|
148
|
+
isReadOnly,
|
|
149
|
+
isInvalid,
|
|
150
|
+
isRequired: props.isRequired || false
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
154
|
+
delete DOMProps.id;
|
|
155
|
+
return /* @__PURE__ */ React__default.createElement("label", {
|
|
156
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(DOMProps, labelProps, hoverProps, renderProps),
|
|
157
|
+
ref,
|
|
158
|
+
slot: props.slot || void 0,
|
|
159
|
+
"data-selected": isSelected || void 0,
|
|
160
|
+
"data-indeterminate": props.isIndeterminate || void 0,
|
|
161
|
+
"data-pressed": isPressed || void 0,
|
|
162
|
+
"data-hovered": isHovered || void 0,
|
|
163
|
+
"data-focused": isFocused || void 0,
|
|
164
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
165
|
+
"data-disabled": isDisabled || void 0,
|
|
166
|
+
"data-readonly": isReadOnly || void 0,
|
|
167
|
+
"data-invalid": isInvalid || void 0,
|
|
168
|
+
"data-required": props.isRequired || void 0
|
|
169
|
+
}, /* @__PURE__ */ React__default.createElement($5c3e21d68f1c4674$export$439d29a4e110a164, {
|
|
170
|
+
elementType: "span"
|
|
171
|
+
}, /* @__PURE__ */ React__default.createElement("input", {
|
|
172
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928(inputProps, focusProps),
|
|
173
|
+
ref: inputRef
|
|
174
|
+
})), renderProps.children);
|
|
175
|
+
}
|
|
176
|
+
const $bc237834342dbd75$export$48513f6b9f8ce62d = /* @__PURE__ */ forwardRef($bc237834342dbd75$var$Checkbox);
|
|
7
177
|
/**
|
|
8
178
|
* A simple checkbox.
|
|
9
179
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __ } from "../../default-i18n-
|
|
2
|
+
import { _ as __ } from "../../default-i18n-BqWys-1G.js";
|
|
3
3
|
import { Menu, MenuSection, MenuItem } from "../menu/menu.js";
|
|
4
4
|
import { ColorSwatch } from "./color-swatch.js";
|
|
5
5
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-
|
|
3
|
-
import { $ as $799cddbef784668f$export$6e865ea70d7724f } from "../../intlStrings-
|
|
2
|
+
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-Bev-9Vbr.js";
|
|
3
|
+
import { $ as $799cddbef784668f$export$6e865ea70d7724f } from "../../intlStrings-KQxgp5tS.js";
|
|
4
4
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
5
|
-
import { _ as __ } from "../../default-i18n-
|
|
5
|
+
import { _ as __ } from "../../default-i18n-BqWys-1G.js";
|
|
6
6
|
/**
|
|
7
7
|
* A simple color/gradient swatch.
|
|
8
8
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __, s as sprintf } from "../../default-i18n-
|
|
2
|
+
import { _ as __, s as sprintf } from "../../default-i18n-BqWys-1G.js";
|
|
3
3
|
import { useMemo, useState } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { Button, ButtonGroup } from "../button/button.js";
|
|
5
5
|
import { icons } from "../../icons/icons.js";
|
|
6
6
|
import { SolidColorPicker } from "./solid-color-picker.js";
|
|
7
7
|
import { Slider } from "../slider/slider.js";
|
|
8
8
|
import { NumberPicker } from "../number-picker/number-picker.js";
|
|
9
|
-
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-
|
|
9
|
+
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-Bev-9Vbr.js";
|
|
10
10
|
import { Menu, MenuItem } from "../menu/menu.js";
|
|
11
11
|
import { MatrixAlign } from "../matrix-align/matrix-align.js";
|
|
12
12
|
import { Spacer } from "../spacer/spacer.js";
|