@eightshift/ui-components 4.0.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +101 -101
- package/dist/Button-CvzGKGCo.js +0 -185
- package/dist/Collection-ddre1L5v.js +0 -2332
- package/dist/Color-MV5kBVXr.js +0 -2452
- package/dist/ColorSwatch-BqQfVu4L.js +0 -64
- package/dist/ComboBox-jQ-dk95U.js +0 -1906
- package/dist/Dialog-DX1aiYyE.js +0 -2300
- package/dist/FieldError-52GVSGgC.js +0 -42
- package/dist/FocusScope-Cri5BFRz.js +0 -831
- package/dist/Form-Cq3fu75_.js +0 -5
- package/dist/Group-_emcIVxI.js +0 -48
- package/dist/Heading-B2153VXe.js +0 -16
- package/dist/Hidden-rE6uR-lr.js +0 -41
- package/dist/Input-BxpFEIXV.js +0 -133
- package/dist/Label-icmbmNdI.js +0 -17
- package/dist/List-BYNHbol3.js +0 -593
- package/dist/ListBox-mJ4nQaL7.js +0 -581
- package/dist/NumberFormatter-DA8u1Ot7.js +0 -140
- package/dist/OverlayArrow-BB0CWwdq.js +0 -629
- package/dist/RSPContexts-2lR5GG9p.js +0 -14
- package/dist/Select-aab027f3.esm--EmXjiL3.js +0 -2469
- package/dist/Separator-D9moUgP8.js +0 -322
- package/dist/Slider-rz2XRMGm.js +0 -853
- package/dist/Text-DVSAPY-K.js +0 -16
- package/dist/VisuallyHidden-f9zX67a_.js +0 -48
- package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
- package/dist/assets/index.css +0 -37
- package/dist/assets/style-admin.css +0 -5255
- package/dist/assets/style-editor.css +0 -5255
- package/dist/assets/style.css +0 -5261
- package/dist/assets/wp-font-enhancements.css +0 -8
- package/dist/assets/wp-ui-enhancements.css +0 -299
- package/dist/components/animated-visibility/animated-visibility.js +0 -105
- package/dist/components/base-control/base-control.js +0 -86
- package/dist/components/breakpoint-preview/breakpoint-preview.js +0 -161
- package/dist/components/button/button.js +0 -387
- package/dist/components/checkbox/checkbox.js +0 -320
- package/dist/components/color-pickers/color-picker.js +0 -272
- package/dist/components/color-pickers/color-swatch.js +0 -58
- package/dist/components/color-pickers/gradient-editor.js +0 -534
- package/dist/components/color-pickers/solid-color-picker.js +0 -1567
- package/dist/components/component-toggle/component-toggle.js +0 -158
- package/dist/components/container-panel/container-panel.js +0 -131
- package/dist/components/draggable/draggable-context.js +0 -5
- package/dist/components/draggable/draggable-handle.js +0 -46
- package/dist/components/draggable/draggable.js +0 -6207
- package/dist/components/draggable-list/draggable-list-context.js +0 -5
- package/dist/components/draggable-list/draggable-list-item.js +0 -77
- package/dist/components/draggable-list/draggable-list.js +0 -151
- package/dist/components/expandable/expandable.js +0 -342
- package/dist/components/index.js +0 -137
- package/dist/components/input-field/input-field.js +0 -231
- package/dist/components/item-collection/item-collection.js +0 -59
- package/dist/components/layout/hstack.js +0 -30
- package/dist/components/layout/vstack.js +0 -30
- package/dist/components/link-input/link-input.js +0 -293
- package/dist/components/matrix-align/matrix-align.js +0 -134
- package/dist/components/menu/menu.js +0 -285
- package/dist/components/modal/modal.js +0 -305
- package/dist/components/notice/notice.js +0 -123
- package/dist/components/number-picker/number-picker.js +0 -292
- package/dist/components/option-select/option-select.js +0 -264
- package/dist/components/options-panel/options-panel.js +0 -158
- package/dist/components/placeholders/file-placeholder.js +0 -42
- package/dist/components/placeholders/image-placeholder.js +0 -88
- package/dist/components/placeholders/media-placeholder.js +0 -63
- package/dist/components/popover/popover.js +0 -207
- package/dist/components/radio/radio.js +0 -579
- package/dist/components/repeater/repeater-context.js +0 -5
- package/dist/components/repeater/repeater-item.js +0 -119
- package/dist/components/repeater/repeater.js +0 -280
- package/dist/components/responsive/mini-responsive.js +0 -498
- package/dist/components/responsive/responsive-legacy.js +0 -343
- package/dist/components/responsive/responsive.js +0 -580
- package/dist/components/responsive-preview/responsive-preview.js +0 -123
- package/dist/components/rich-label/rich-label.js +0 -66
- package/dist/components/select/async-multi-select.js +0 -157
- package/dist/components/select/async-single-select.js +0 -137
- package/dist/components/select/custom-select-default-components.js +0 -38
- package/dist/components/select/multi-select-components.js +0 -8
- package/dist/components/select/multi-select.js +0 -151
- package/dist/components/select/react-select-component-wrappers.js +0 -90
- package/dist/components/select/shared.js +0 -26
- package/dist/components/select/single-select.js +0 -131
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-select.js +0 -297
- package/dist/components/select/v2/shared.js +0 -24
- package/dist/components/select/v2/single-select.js +0 -990
- package/dist/components/slider/column-config-slider.js +0 -210
- package/dist/components/slider/slider.js +0 -343
- package/dist/components/slider/utils.js +0 -84
- package/dist/components/spacer/spacer.js +0 -97
- package/dist/components/tabs/tabs.js +0 -702
- package/dist/components/toggle/switch.js +0 -155
- package/dist/components/toggle/toggle.js +0 -64
- package/dist/components/toggle-button/toggle-button.js +0 -324
- package/dist/components/tooltip/tooltip.js +0 -525
- package/dist/context-D2KUdwNL.js +0 -92
- package/dist/default-i18n-CT_oS1Fy.js +0 -922
- package/dist/filterDOMProps-EDDcM64A.js +0 -28
- package/dist/icons/block-icon.js +0 -42
- package/dist/icons/generic-color-swatch.js +0 -113
- package/dist/icons/icons.js +0 -30371
- package/dist/icons/index.js +0 -11
- package/dist/icons/jsx-svg.js +0 -50
- package/dist/index-641ee5b8.esm-BPz6U6sJ.js +0 -3137
- package/dist/index-BKGQ6jGS.js +0 -44
- package/dist/index-BYHhzLf-.js +0 -444
- package/dist/index.js +0 -139
- package/dist/lite-DVmmD_-j.js +0 -7
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-BlZZoNXC.js +0 -3744
- package/dist/number-GajL10e1.js +0 -36
- package/dist/react-jsx-parser.min-DZCiis5V.js +0 -11753
- package/dist/react-select-async.esm-CwUoej5h.js +0 -107
- package/dist/react-select.esm-DcwYxadV.js +0 -15
- package/dist/style-admin.js +0 -1
- package/dist/style-editor.js +0 -1
- package/dist/style.js +0 -1
- package/dist/textSelection-0UUS8Yfg.js +0 -46
- package/dist/useButton-BpOKDWEN.js +0 -71
- package/dist/useEvent-B0b-6KBr.js +0 -23
- package/dist/useFocusRing-CV5l3lf6.js +0 -107
- package/dist/useFormReset-C5OggHsw.js +0 -22
- package/dist/useFormValidation-DhDNSjws.js +0 -224
- package/dist/useHover-DwDr6ozG.js +0 -900
- package/dist/useLabel-D7HkNEHT.js +0 -27
- package/dist/useLabels-D8cxd1Z8.js +0 -23
- package/dist/useListState-UGlN5-7P.js +0 -161
- package/dist/useLocalizedStringFormatter-CFP1YZWQ.js +0 -121
- package/dist/useNumberField-CEAj7Mrj.js +0 -1204
- package/dist/useNumberFormatter-321rAb4J.js +0 -13
- package/dist/usePress-DNW8qpY6.js +0 -664
- package/dist/useSingleSelectListState-DC0wWTUM.js +0 -38
- package/dist/useToggle-BrpmSOB-.js +0 -59
- package/dist/useToggleState-CmQX3SoX.js +0 -19
- package/dist/utilities/array-helpers.js +0 -56
- package/dist/utilities/debounce-throttle.js +0 -123
- package/dist/utilities/es-dash.js +0 -376
- package/dist/utilities/index.js +0 -27
- package/dist/utilities/text-helpers.js +0 -136
- package/dist/utils-DkCSC521.js +0 -370
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $d2b4bc8c273e7be6$export$353f5b6fc5456de1 } from "../../Button-CvzGKGCo.js";
|
|
3
|
-
import { k as $f0a04ccd8dbdd83b$export$e5c5a5f917a5871c, a as $64fa3d84918910a7$export$29f1550f4b0d4415, b as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928, l as $df56164dff5785e2$export$4338b53315abf666 } from "../../utils-DkCSC521.js";
|
|
4
|
-
import { $ as $9bf71ea28793e738$export$c5251b9e124bf29 } from "../../FocusScope-Cri5BFRz.js";
|
|
5
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
6
|
-
import React__default, { useState, useRef, forwardRef, createContext } from "react";
|
|
7
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-D2KUdwNL.js";
|
|
8
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
9
|
-
import { c as cva } from "../../index-BKGQ6jGS.js";
|
|
10
|
-
import { Tooltip } from "../tooltip/tooltip.js";
|
|
11
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
12
|
-
function $2680b1829e803644$export$fa142eb1681c520(props, ref) {
|
|
13
|
-
const { "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, orientation = "horizontal" } = props;
|
|
14
|
-
let [isInToolbar, setInToolbar] = useState(false);
|
|
15
|
-
$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(() => {
|
|
16
|
-
var _ref_current_parentElement;
|
|
17
|
-
setInToolbar(!!(ref.current && ((_ref_current_parentElement = ref.current.parentElement) === null || _ref_current_parentElement === void 0 ? void 0 : _ref_current_parentElement.closest('[role="toolbar"]'))));
|
|
18
|
-
});
|
|
19
|
-
const { direction } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
20
|
-
const shouldReverse = direction === "rtl" && orientation === "horizontal";
|
|
21
|
-
let focusManager = $9bf71ea28793e738$export$c5251b9e124bf29(ref);
|
|
22
|
-
const onKeyDown = (e) => {
|
|
23
|
-
if (!e.currentTarget.contains(e.target)) return;
|
|
24
|
-
if (orientation === "horizontal" && e.key === "ArrowRight" || orientation === "vertical" && e.key === "ArrowDown") {
|
|
25
|
-
if (shouldReverse) focusManager.focusPrevious();
|
|
26
|
-
else focusManager.focusNext();
|
|
27
|
-
} else if (orientation === "horizontal" && e.key === "ArrowLeft" || orientation === "vertical" && e.key === "ArrowUp") {
|
|
28
|
-
if (shouldReverse) focusManager.focusNext();
|
|
29
|
-
else focusManager.focusPrevious();
|
|
30
|
-
} else if (e.key === "Tab") {
|
|
31
|
-
e.stopPropagation();
|
|
32
|
-
lastFocused.current = document.activeElement;
|
|
33
|
-
if (e.shiftKey) focusManager.focusFirst();
|
|
34
|
-
else focusManager.focusLast();
|
|
35
|
-
return;
|
|
36
|
-
} else
|
|
37
|
-
return;
|
|
38
|
-
e.stopPropagation();
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
};
|
|
41
|
-
const lastFocused = useRef(null);
|
|
42
|
-
const onBlur = (e) => {
|
|
43
|
-
if (!e.currentTarget.contains(e.relatedTarget) && !lastFocused.current) lastFocused.current = e.target;
|
|
44
|
-
};
|
|
45
|
-
const onFocus = (e) => {
|
|
46
|
-
var _ref_current;
|
|
47
|
-
if (lastFocused.current && !e.currentTarget.contains(e.relatedTarget) && ((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.contains(e.target))) {
|
|
48
|
-
var _lastFocused_current;
|
|
49
|
-
(_lastFocused_current = lastFocused.current) === null || _lastFocused_current === void 0 ? void 0 : _lastFocused_current.focus();
|
|
50
|
-
lastFocused.current = null;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
return {
|
|
54
|
-
toolbarProps: {
|
|
55
|
-
...$65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
56
|
-
labelable: true
|
|
57
|
-
}),
|
|
58
|
-
role: !isInToolbar ? "toolbar" : "group",
|
|
59
|
-
"aria-orientation": orientation,
|
|
60
|
-
"aria-label": ariaLabel,
|
|
61
|
-
"aria-labelledby": ariaLabel == null ? ariaLabelledBy : void 0,
|
|
62
|
-
onKeyDownCapture: !isInToolbar ? onKeyDown : void 0,
|
|
63
|
-
onFocusCapture: !isInToolbar ? onFocus : void 0,
|
|
64
|
-
onBlurCapture: !isInToolbar ? onBlur : void 0
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
const $13c3c67164f4d5be$export$6311e7ab80ef752f = /* @__PURE__ */ createContext({});
|
|
69
|
-
const $13c3c67164f4d5be$export$4c260019440d418f = /* @__PURE__ */ forwardRef(function Toolbar(props, ref) {
|
|
70
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $13c3c67164f4d5be$export$6311e7ab80ef752f);
|
|
71
|
-
let { toolbarProps } = $2680b1829e803644$export$fa142eb1681c520(props, ref);
|
|
72
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
73
|
-
...props,
|
|
74
|
-
values: {
|
|
75
|
-
orientation: props.orientation || "horizontal"
|
|
76
|
-
},
|
|
77
|
-
defaultClassName: "react-aria-Toolbar"
|
|
78
|
-
});
|
|
79
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
80
|
-
delete DOMProps.id;
|
|
81
|
-
return /* @__PURE__ */ React__default.createElement("div", {
|
|
82
|
-
...$3ef42575df84b30b$export$9d1611c77c2fe928(toolbarProps, DOMProps),
|
|
83
|
-
...renderProps,
|
|
84
|
-
ref,
|
|
85
|
-
slot: props.slot || void 0,
|
|
86
|
-
"data-orientation": props.orientation || "horizontal"
|
|
87
|
-
}, renderProps.children);
|
|
88
|
-
});
|
|
89
|
-
/**
|
|
90
|
-
* A simple button component.
|
|
91
|
-
*
|
|
92
|
-
* @component
|
|
93
|
-
* @param {Object} props - Component props.
|
|
94
|
-
* @param {JSX.Element} [props.icon] - Icon to display within the button.
|
|
95
|
-
* @param {ButtonSize} [props.size='default'] - The size of the button.
|
|
96
|
-
* @param {ButtonType} [props.type='default'] - The type of the button.
|
|
97
|
-
* @param {boolean} [props.disabled] - If `true`, the button is disabled.
|
|
98
|
-
* @param {string} [props.className] - Classes to pass to the button.
|
|
99
|
-
* @param {string|boolean} [props.tooltip] - Tooltip text to display on hover. If set to `true` and an `aria-label` is not provided, the tooltip text will be used as the `aria-label`.
|
|
100
|
-
* @param {Function} [props.onPress] - Function to run when the button is pressed.
|
|
101
|
-
* @param {React.Ref} [props.forwardedRef] - Ref to forward to the button. Use the same as the `ref` prop.
|
|
102
|
-
* @param {string} [props.wrapperClassName] - Classes to pass to the tooltip wrapper.
|
|
103
|
-
* @param {Object} [props.tooltipProps] - Props to pass to the tooltip.
|
|
104
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
105
|
-
*
|
|
106
|
-
* @returns {JSX.Element} The Button component.
|
|
107
|
-
*
|
|
108
|
-
* @typedef {'small' | 'default' | 'large'} ButtonSize
|
|
109
|
-
* @typedef {'default' | 'selected' | 'ghost' | 'danger' | 'dangerGhost'} ButtonType
|
|
110
|
-
*
|
|
111
|
-
* @example
|
|
112
|
-
* <Button onPress={() => console.log('Hi!')} icon={icons.myIcon} />
|
|
113
|
-
*
|
|
114
|
-
* <Button onPress={() => console.log('Hi!')} icon={icons.myIcon}>My button</Button>
|
|
115
|
-
*
|
|
116
|
-
* @preserve
|
|
117
|
-
*/
|
|
118
|
-
const Button = (props) => {
|
|
119
|
-
const {
|
|
120
|
-
children,
|
|
121
|
-
icon,
|
|
122
|
-
size = "default",
|
|
123
|
-
type = "default",
|
|
124
|
-
disabled,
|
|
125
|
-
className,
|
|
126
|
-
tooltip: rawTooltip,
|
|
127
|
-
onPress,
|
|
128
|
-
forwardedRef,
|
|
129
|
-
wrapperClassName,
|
|
130
|
-
tooltipProps,
|
|
131
|
-
"aria-label": ariaLabel = typeof children === "string" ? children : __("Menu item", "eightshift-ui-components"),
|
|
132
|
-
hidden,
|
|
133
|
-
...other
|
|
134
|
-
} = props;
|
|
135
|
-
let tooltip = rawTooltip;
|
|
136
|
-
if (rawTooltip === true && (ariaLabel == null ? void 0 : ariaLabel.length) > 0) {
|
|
137
|
-
tooltip = ariaLabel;
|
|
138
|
-
}
|
|
139
|
-
const objRef = $df56164dff5785e2$export$4338b53315abf666(forwardedRef);
|
|
140
|
-
if (hidden) {
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
const componentClasses = cva(
|
|
144
|
-
[
|
|
145
|
-
"es:flex es:items-center es:gap-1",
|
|
146
|
-
"es:transition es:duration-300 es:border es:text-sm",
|
|
147
|
-
"es:any-focus:outline-hidden es:focus-visible:z-10",
|
|
148
|
-
"es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
|
|
149
|
-
"es:focus-visible:border-accent-500",
|
|
150
|
-
"es:btn-group-mid:rounded-none",
|
|
151
|
-
"es:btn-group-h-start:rounded-r-none es:btn-group-v-start:rounded-b-none",
|
|
152
|
-
"es:btn-group-h-end:rounded-l-none es:btn-group-v-end:rounded-t-none",
|
|
153
|
-
"es:not-disabled:cursor-pointer",
|
|
154
|
-
"es:shrink-0",
|
|
155
|
-
icon && children ? "es:justify-start" : "es:justify-center",
|
|
156
|
-
className
|
|
157
|
-
],
|
|
158
|
-
{
|
|
159
|
-
variants: {
|
|
160
|
-
size: {
|
|
161
|
-
small: "es:icon:size-4.5 es:rounded-md",
|
|
162
|
-
default: "es:icon:size-5.5 es:rounded-lg",
|
|
163
|
-
large: "es:icon:size-6 es:rounded-lg"
|
|
164
|
-
},
|
|
165
|
-
type: {
|
|
166
|
-
default: "es:bg-radial-[at_50%_125%] es:inset-ring es:inset-shadow-xs",
|
|
167
|
-
selected: "es:bg-radial-[at_50%_125%] es:inset-ring es:inset-shadow-xs",
|
|
168
|
-
danger: "es:bg-radial-[at_50%_125%] es:inset-ring es:inset-shadow-xs",
|
|
169
|
-
ghost: "es:border-transparent es:text-secondary-700 es:not-disabled:hover:bg-secondary-100 es:disabled:border-transparent!",
|
|
170
|
-
dangerGhost: [
|
|
171
|
-
"es:border-transparent es:text-red-600",
|
|
172
|
-
"es:not-disabled:hover:bg-red-500/5",
|
|
173
|
-
"es:focus-visible:text-red-700",
|
|
174
|
-
"es:focus-visible:ring-red-500/30 es:focus-visible:border-red-600 es:focus-visible:inset-ring-red-100",
|
|
175
|
-
"es:disabled:border-transparent!"
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
compoundVariants: [
|
|
180
|
-
// Styles.
|
|
181
|
-
{
|
|
182
|
-
type: "default",
|
|
183
|
-
disabled: false,
|
|
184
|
-
class: [
|
|
185
|
-
"es:text-black",
|
|
186
|
-
"es:from-secondary-50 es:to-white",
|
|
187
|
-
"es:border-secondary-300",
|
|
188
|
-
"es:inset-ring-secondary-100",
|
|
189
|
-
"es:inset-shadow-secondary-100/50",
|
|
190
|
-
"es:shadow-xs",
|
|
191
|
-
"es:hover:inset-shadow-secondary-100 es:hover:to-secondary-100 es:hover:inset-ring-secondary-100",
|
|
192
|
-
"es:hover:text-accent-950",
|
|
193
|
-
"es:focus-visible:text-accent-950"
|
|
194
|
-
]
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
type: "selected",
|
|
198
|
-
disabled: false,
|
|
199
|
-
class: [
|
|
200
|
-
"es:text-white",
|
|
201
|
-
"es:from-accent-500 es:to-accent-600",
|
|
202
|
-
"es:border-accent-700",
|
|
203
|
-
"es:inset-ring es:inset-ring-accent-600",
|
|
204
|
-
"es:inset-shadow-xs es:inset-shadow-accent-400/75",
|
|
205
|
-
"es:focus-visible:border-accent-700",
|
|
206
|
-
"es:focus-visible:inset-ring es:focus-visible:inset-ring-accent-600",
|
|
207
|
-
"es:focus-visible:inset-shadow-xs es:focus-visible:inset-shadow-accent-400",
|
|
208
|
-
"es:shadow es:shadow-accent-600/30"
|
|
209
|
-
]
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
type: "danger",
|
|
213
|
-
disabled: false,
|
|
214
|
-
class: [
|
|
215
|
-
"es:text-red-800",
|
|
216
|
-
"es:from-red-50/75 es:to-white",
|
|
217
|
-
"es:border-red-600/50",
|
|
218
|
-
"es:inset-ring-red-100",
|
|
219
|
-
"es:inset-shadow-red-50",
|
|
220
|
-
"es:hover:inset-shadow-red-100 es:hover:inset-ring-red-100 es:hover:text-red-800 es:hover:border-red-600",
|
|
221
|
-
"es:focus-visible:text-red-900",
|
|
222
|
-
"es:focus-visible:ring-red-500/30 es:focus-visible:border-red-600 es:focus-visible:inset-ring-red-100",
|
|
223
|
-
"es:shadow"
|
|
224
|
-
]
|
|
225
|
-
},
|
|
226
|
-
{
|
|
227
|
-
disabled: true,
|
|
228
|
-
class: "es:disabled:border-zinc-300 es:disabled:text-zinc-400 es:border es:shadow-none es:disabled:inset-shadow-transparent es:disabled:inset-ring-0"
|
|
229
|
-
},
|
|
230
|
-
// Sizes.
|
|
231
|
-
{
|
|
232
|
-
size: "small",
|
|
233
|
-
iconOnly: false,
|
|
234
|
-
class: "es:h-7 es:min-w-7"
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
size: "small",
|
|
238
|
-
iconOnly: true,
|
|
239
|
-
class: "es:size-7"
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
size: "small",
|
|
243
|
-
hasIcon: false,
|
|
244
|
-
iconOnly: false,
|
|
245
|
-
class: "es:px-2"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
size: "small",
|
|
249
|
-
hasIcon: true,
|
|
250
|
-
iconOnly: false,
|
|
251
|
-
class: "es:px-1"
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
size: "default",
|
|
255
|
-
iconOnly: false,
|
|
256
|
-
class: "es:h-9 es:min-w-9"
|
|
257
|
-
},
|
|
258
|
-
{
|
|
259
|
-
size: "default",
|
|
260
|
-
iconOnly: true,
|
|
261
|
-
class: "es:size-9"
|
|
262
|
-
},
|
|
263
|
-
{
|
|
264
|
-
size: "default",
|
|
265
|
-
hasIcon: false,
|
|
266
|
-
iconOnly: false,
|
|
267
|
-
class: "es:px-2"
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
size: "default",
|
|
271
|
-
hasIcon: true,
|
|
272
|
-
iconOnly: false,
|
|
273
|
-
class: "es:px-1.5"
|
|
274
|
-
},
|
|
275
|
-
{
|
|
276
|
-
size: "large",
|
|
277
|
-
iconOnly: false,
|
|
278
|
-
class: "es:h-10 es:min-w-10"
|
|
279
|
-
},
|
|
280
|
-
{
|
|
281
|
-
size: "large",
|
|
282
|
-
iconOnly: true,
|
|
283
|
-
class: "es:size-10"
|
|
284
|
-
},
|
|
285
|
-
{
|
|
286
|
-
size: "large",
|
|
287
|
-
hasIcon: false,
|
|
288
|
-
iconOnly: false,
|
|
289
|
-
class: "es:px-4"
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
size: "large",
|
|
293
|
-
hasIcon: true,
|
|
294
|
-
iconOnly: false,
|
|
295
|
-
class: "es:px-2"
|
|
296
|
-
}
|
|
297
|
-
],
|
|
298
|
-
defaultVariants: {
|
|
299
|
-
disabled: false
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
const component = /* @__PURE__ */ jsxs(
|
|
304
|
-
$d2b4bc8c273e7be6$export$353f5b6fc5456de1,
|
|
305
|
-
{
|
|
306
|
-
onPress,
|
|
307
|
-
isDisabled: disabled,
|
|
308
|
-
className: componentClasses({
|
|
309
|
-
disabled,
|
|
310
|
-
hasIcon: Boolean(icon),
|
|
311
|
-
iconOnly: Boolean(icon && !children),
|
|
312
|
-
size,
|
|
313
|
-
type
|
|
314
|
-
}),
|
|
315
|
-
ref: objRef,
|
|
316
|
-
"aria-label": ariaLabel,
|
|
317
|
-
...other,
|
|
318
|
-
children: [
|
|
319
|
-
icon,
|
|
320
|
-
children
|
|
321
|
-
]
|
|
322
|
-
}
|
|
323
|
-
);
|
|
324
|
-
if (!tooltip) {
|
|
325
|
-
return component;
|
|
326
|
-
}
|
|
327
|
-
return /* @__PURE__ */ jsx(
|
|
328
|
-
Tooltip,
|
|
329
|
-
{
|
|
330
|
-
text: tooltip,
|
|
331
|
-
wrapperClassName,
|
|
332
|
-
...tooltipProps,
|
|
333
|
-
children: component
|
|
334
|
-
}
|
|
335
|
-
);
|
|
336
|
-
};
|
|
337
|
-
/**
|
|
338
|
-
* A wrapper for `Button` or `ToggleButton` components that visually groups them and ensures proper keyboard navigation.
|
|
339
|
-
*
|
|
340
|
-
* **Note**: Only intended for horizontal groups of buttons that don't wrap.
|
|
341
|
-
*
|
|
342
|
-
* @component
|
|
343
|
-
* @param {Object} props - Component props.
|
|
344
|
-
* @param {string} [props.className] - Classes to pass to the button group container.
|
|
345
|
-
* @param {boolean} [props.vertical] - If `true`, the buttons are displayed vertically.
|
|
346
|
-
* @param {ButtonGroupType} [props.type='segmented'] - The way the button group is laid out.
|
|
347
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
348
|
-
*
|
|
349
|
-
* @returns {JSX.Element} The ButtonGroup component.
|
|
350
|
-
*
|
|
351
|
-
* @typedef {'segmented' | 'split'} ButtonGroupType
|
|
352
|
-
*
|
|
353
|
-
* @example
|
|
354
|
-
* <ButtonGroup>
|
|
355
|
-
* <Button />
|
|
356
|
-
* <Button />
|
|
357
|
-
* <Button />
|
|
358
|
-
* </ButtonGroup>
|
|
359
|
-
*
|
|
360
|
-
* @preserve
|
|
361
|
-
*/
|
|
362
|
-
const ButtonGroup = ({ children, className, vertical, hidden, type = "segmented", ...rest }) => {
|
|
363
|
-
if (hidden) {
|
|
364
|
-
return null;
|
|
365
|
-
}
|
|
366
|
-
return /* @__PURE__ */ jsx(
|
|
367
|
-
$13c3c67164f4d5be$export$4c260019440d418f,
|
|
368
|
-
{
|
|
369
|
-
className: clsx(
|
|
370
|
-
"es:flex",
|
|
371
|
-
vertical && "es:flex-col",
|
|
372
|
-
type === "segmented" && vertical && "es-button-group-v es:-space-y-px!",
|
|
373
|
-
type === "segmented" && !vertical && "es-button-group-h es:-space-x-px!",
|
|
374
|
-
type === "split" && vertical && "es:space-y-1",
|
|
375
|
-
type === "split" && !vertical && "es:space-x-1.5",
|
|
376
|
-
className
|
|
377
|
-
),
|
|
378
|
-
orientation: vertical ? "vertical" : "horizontal",
|
|
379
|
-
...rest,
|
|
380
|
-
children
|
|
381
|
-
}
|
|
382
|
-
);
|
|
383
|
-
};
|
|
384
|
-
export {
|
|
385
|
-
Button,
|
|
386
|
-
ButtonGroup
|
|
387
|
-
};
|