@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,123 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
3
|
-
import { icons } from "../../icons/icons.js";
|
|
4
|
-
/**
|
|
5
|
-
* A simple notice component.
|
|
6
|
-
*
|
|
7
|
-
* @component
|
|
8
|
-
* @param {Object} props - Component props.
|
|
9
|
-
* @param {JSX.Element} [props.icon] - Icon to display within the notice.
|
|
10
|
-
* @param {string} [props.label] - The label of the notice.
|
|
11
|
-
* @param {string} [props.subtitle] - The subtitle of the notice.
|
|
12
|
-
* @param {string} [props.className] - Classes to pass to the notice.
|
|
13
|
-
* @param {NoticeType} [props.type='default'] - The type of the notice.
|
|
14
|
-
* @param {boolean} [props.alignIconToTitle=false] - If `true`, the icon will be aligned to the first row of title, instead of vertically centered.
|
|
15
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
16
|
-
*
|
|
17
|
-
* @returns {JSX.Element} The Notice component.
|
|
18
|
-
*
|
|
19
|
-
* @typedef {'info' | 'success' | 'warning' | 'error' | 'placeholder' | 'default'} NoticeType
|
|
20
|
-
*
|
|
21
|
-
* @example
|
|
22
|
-
* <Notice label='This is a notice' />
|
|
23
|
-
*
|
|
24
|
-
* @preserve
|
|
25
|
-
*/
|
|
26
|
-
const Notice = (props) => {
|
|
27
|
-
const { icon, label, subtitle, className, type = "default", alignIconToTitle = false, hidden } = props;
|
|
28
|
-
if (hidden) {
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
const styles = {
|
|
32
|
-
info: {
|
|
33
|
-
icon: icons.infoCircle,
|
|
34
|
-
className: "es:border-blue-400 es:shadow-blue-500/15 es:bg-blue-100/5",
|
|
35
|
-
iconColor: "es:text-blue-400",
|
|
36
|
-
textColor: "es:text-blue-900",
|
|
37
|
-
subtitleColor: "es:text-blue-950/60"
|
|
38
|
-
},
|
|
39
|
-
success: {
|
|
40
|
-
icon: icons.checkSquare,
|
|
41
|
-
className: "es:border-green-500 es:shadow-green-500/15 es:bg-green-100/5",
|
|
42
|
-
iconColor: "es:text-green-500",
|
|
43
|
-
textColor: "es:text-green-900",
|
|
44
|
-
subtitleColor: "es:text-green-950/60"
|
|
45
|
-
},
|
|
46
|
-
warning: {
|
|
47
|
-
icon: icons.warning,
|
|
48
|
-
className: "es:border-amber-500 es:shadow-amber-500/15 es:bg-amber-100/5",
|
|
49
|
-
iconColor: "es:text-amber-500",
|
|
50
|
-
textColor: "es:text-amber-900",
|
|
51
|
-
subtitleColor: "es:text-amber-950/60"
|
|
52
|
-
},
|
|
53
|
-
error: {
|
|
54
|
-
icon: icons.errorCircle,
|
|
55
|
-
className: "es:border-red-400 es:shadow-red-500/15 es:bg-red-100/5",
|
|
56
|
-
iconColor: "es:text-red-400",
|
|
57
|
-
textColor: "es:text-red-900",
|
|
58
|
-
subtitleColor: "es:text-red-950/60"
|
|
59
|
-
},
|
|
60
|
-
placeholder: {
|
|
61
|
-
icon: icons.componentGeneric,
|
|
62
|
-
className: "es:border-secondary-400 es:shadow-secondary-300/25 es:border-dashed es:bg-secondary-200/5",
|
|
63
|
-
iconColor: "es:text-secondary-400",
|
|
64
|
-
textColor: "es:text-secondary-900",
|
|
65
|
-
subtitleColor: "es:text-secondary-500"
|
|
66
|
-
},
|
|
67
|
-
default: {
|
|
68
|
-
className: "es:border-secondary-300 es:shadow-secondary-300/25 es:bg-secondary-200/5",
|
|
69
|
-
iconColor: "es:text-secondary-400",
|
|
70
|
-
textColor: "es:text-secondary-900",
|
|
71
|
-
subtitleColor: "es:text-secondary-500"
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
className: clsx(
|
|
78
|
-
"es:grid es:grid-cols-[auto_1fr] es:grid-rows-[auto_auto] es:rounded-md es:border es:bg-linear-to-tr es:shadow-sm",
|
|
79
|
-
styles[type].className,
|
|
80
|
-
icon || styles[type].icon ? "es:gap-x-1.5 es:p-1.5" : "es:px-2 es:py-1.5",
|
|
81
|
-
className
|
|
82
|
-
),
|
|
83
|
-
children: [
|
|
84
|
-
(icon || styles[type].icon) && /* @__PURE__ */ jsx(
|
|
85
|
-
"span",
|
|
86
|
-
{
|
|
87
|
-
className: clsx(
|
|
88
|
-
"es:col-span-1 es:col-start-1 es:row-span-2 es:row-start-1 es:shrink-0 es:icon:size-7",
|
|
89
|
-
alignIconToTitle ? "es:self-baseline" : "es:self-center",
|
|
90
|
-
styles[type].iconColor
|
|
91
|
-
),
|
|
92
|
-
children: icon ?? styles[type].icon
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
label && /* @__PURE__ */ jsx(
|
|
96
|
-
"span",
|
|
97
|
-
{
|
|
98
|
-
className: clsx(
|
|
99
|
-
"es:col-span-2 es:col-start-2 es:text-balance es:text-sm es:leading-tight",
|
|
100
|
-
subtitle ? "es:self-end" : "es:row-span-2 es:self-center",
|
|
101
|
-
styles[type].textColor
|
|
102
|
-
),
|
|
103
|
-
children: label
|
|
104
|
-
}
|
|
105
|
-
),
|
|
106
|
-
subtitle && /* @__PURE__ */ jsx(
|
|
107
|
-
"span",
|
|
108
|
-
{
|
|
109
|
-
className: clsx(
|
|
110
|
-
"es:col-span-2 es:col-start-2 es:text-balance es:text-xs es:leading-tight",
|
|
111
|
-
styles[type].subtitleColor,
|
|
112
|
-
label ? "es:self-start" : "es:row-span-2 es:self-center"
|
|
113
|
-
),
|
|
114
|
-
children: subtitle
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
]
|
|
118
|
-
}
|
|
119
|
-
) });
|
|
120
|
-
};
|
|
121
|
-
export {
|
|
122
|
-
Notice
|
|
123
|
-
};
|
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import React__default, { forwardRef, createContext, useRef, useState, cloneElement } from "react";
|
|
3
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
4
|
-
import { a as $a049562f99e7db0e$export$f9c6924e160136d1, $ as $a049562f99e7db0e$export$eb2fcfdbd7ba97d4 } from "../../Group-_emcIVxI.js";
|
|
5
|
-
import { a as $3985021b0ad6602f$export$37fb8590cf2c088c, $ as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-BxpFEIXV.js";
|
|
6
|
-
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-icmbmNdI.js";
|
|
7
|
-
import { a as $d2b4bc8c273e7be6$export$24d547caef80ccd1 } from "../../Button-CvzGKGCo.js";
|
|
8
|
-
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, g as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, h as $64fa3d84918910a7$export$ef03459518577ad4, b as $64fa3d84918910a7$export$4d86445c2cf5e3, i as $64fa3d84918910a7$export$2881499e37b75b9a } from "../../utils-DkCSC521.js";
|
|
9
|
-
import { $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-52GVSGgC.js";
|
|
10
|
-
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
|
|
11
|
-
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-DVSAPY-K.js";
|
|
12
|
-
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
13
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-D2KUdwNL.js";
|
|
14
|
-
import { $ as $de67e98908f0c6ee$export$7f629e9dc1ecf37c, a as $81397a9303501bda$export$23f548e970bdf099 } from "../../useNumberField-CEAj7Mrj.js";
|
|
15
|
-
import { Button } from "../button/button.js";
|
|
16
|
-
import { icons } from "../../icons/icons.js";
|
|
17
|
-
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
18
|
-
import { BaseControl } from "../base-control/base-control.js";
|
|
19
|
-
const $b91743d66a0ed188$export$b414a48cf5dcbc11 = /* @__PURE__ */ createContext(null);
|
|
20
|
-
const $b91743d66a0ed188$export$6cc906c6cff9bec5 = /* @__PURE__ */ createContext(null);
|
|
21
|
-
const $b91743d66a0ed188$export$63c5fa0b2fdccd2e = /* @__PURE__ */ forwardRef(function NumberField(props, ref) {
|
|
22
|
-
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $b91743d66a0ed188$export$b414a48cf5dcbc11);
|
|
23
|
-
let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
|
|
24
|
-
var _props_validationBehavior, _ref;
|
|
25
|
-
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
|
|
26
|
-
let { locale } = $18f2051aff69b9bf$export$43bb16f9c6d9e3f7();
|
|
27
|
-
let state = $de67e98908f0c6ee$export$7f629e9dc1ecf37c({
|
|
28
|
-
...props,
|
|
29
|
-
locale,
|
|
30
|
-
validationBehavior
|
|
31
|
-
});
|
|
32
|
-
let inputRef = useRef(null);
|
|
33
|
-
let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8(!props["aria-label"] && !props["aria-labelledby"]);
|
|
34
|
-
let { labelProps, groupProps, inputProps, incrementButtonProps, decrementButtonProps, descriptionProps, errorMessageProps, ...validation } = $81397a9303501bda$export$23f548e970bdf099({
|
|
35
|
-
...$64fa3d84918910a7$export$ef03459518577ad4(props),
|
|
36
|
-
label,
|
|
37
|
-
validationBehavior
|
|
38
|
-
}, state, inputRef);
|
|
39
|
-
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
40
|
-
...props,
|
|
41
|
-
values: {
|
|
42
|
-
state,
|
|
43
|
-
isDisabled: props.isDisabled || false,
|
|
44
|
-
isInvalid: validation.isInvalid || false,
|
|
45
|
-
isRequired: props.isRequired || false
|
|
46
|
-
},
|
|
47
|
-
defaultClassName: "react-aria-NumberField"
|
|
48
|
-
});
|
|
49
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
50
|
-
delete DOMProps.id;
|
|
51
|
-
return /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
52
|
-
values: [
|
|
53
|
-
[
|
|
54
|
-
$b91743d66a0ed188$export$6cc906c6cff9bec5,
|
|
55
|
-
state
|
|
56
|
-
],
|
|
57
|
-
[
|
|
58
|
-
$a049562f99e7db0e$export$f9c6924e160136d1,
|
|
59
|
-
groupProps
|
|
60
|
-
],
|
|
61
|
-
[
|
|
62
|
-
$3985021b0ad6602f$export$37fb8590cf2c088c,
|
|
63
|
-
{
|
|
64
|
-
...inputProps,
|
|
65
|
-
ref: inputRef
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
[
|
|
69
|
-
$01b77f81d0f07f68$export$75b6ee27786ba447,
|
|
70
|
-
{
|
|
71
|
-
...labelProps,
|
|
72
|
-
ref: labelRef
|
|
73
|
-
}
|
|
74
|
-
],
|
|
75
|
-
[
|
|
76
|
-
$d2b4bc8c273e7be6$export$24d547caef80ccd1,
|
|
77
|
-
{
|
|
78
|
-
slots: {
|
|
79
|
-
increment: incrementButtonProps,
|
|
80
|
-
decrement: decrementButtonProps
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
],
|
|
84
|
-
[
|
|
85
|
-
$514c0188e459b4c0$export$9afb8bc826b033ea,
|
|
86
|
-
{
|
|
87
|
-
slots: {
|
|
88
|
-
description: descriptionProps,
|
|
89
|
-
errorMessage: errorMessageProps
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
],
|
|
93
|
-
[
|
|
94
|
-
$ee014567cb39d3f0$export$ff05c3ac10437e03,
|
|
95
|
-
validation
|
|
96
|
-
]
|
|
97
|
-
]
|
|
98
|
-
}, /* @__PURE__ */ React__default.createElement("div", {
|
|
99
|
-
...DOMProps,
|
|
100
|
-
...renderProps,
|
|
101
|
-
ref,
|
|
102
|
-
slot: props.slot || void 0,
|
|
103
|
-
"data-disabled": props.isDisabled || void 0,
|
|
104
|
-
"data-required": props.isRequired || void 0,
|
|
105
|
-
"data-invalid": validation.isInvalid || void 0
|
|
106
|
-
}), props.name && /* @__PURE__ */ React__default.createElement("input", {
|
|
107
|
-
type: "hidden",
|
|
108
|
-
name: props.name,
|
|
109
|
-
value: isNaN(state.numberValue) ? "" : state.numberValue
|
|
110
|
-
}));
|
|
111
|
-
});
|
|
112
|
-
/**
|
|
113
|
-
* A number picker component.
|
|
114
|
-
*
|
|
115
|
-
* @component
|
|
116
|
-
* @param {Object} props - Component props.
|
|
117
|
-
* @param {number} props.value - The current value of the number picker.
|
|
118
|
-
* @param {Function} props.onChange - Function to run when the value changes.
|
|
119
|
-
* @param {number} [props.min=0] - The minimum value of the number picker.
|
|
120
|
-
* @param {number} [props.max] - The maximum value of the number picker.
|
|
121
|
-
* @param {number} [props.step=1] - The step value of the number picker.
|
|
122
|
-
* @param {string} [props.label] - The label of the number picker.
|
|
123
|
-
* @param {JSX.Element} [props.icon] - Icon to display within the number picker.
|
|
124
|
-
* @param {string} [props.subtitle] - The subtitle of the number picker.
|
|
125
|
-
* @param {string} [props.help] - The help text shown below the number picker.
|
|
126
|
-
* @param {boolean} [props.readOnly] - If `true`, the number picker is read-only.
|
|
127
|
-
* @param {boolean} [props.disabled] - If `true`, the number picker is disabled.
|
|
128
|
-
* @param {string} [props.placeholder] - Placeholder text to display in the number picker.
|
|
129
|
-
* @param {JSX.Element} [props.prefix] - Element to display to the left of the number picker.
|
|
130
|
-
* @param {JSX.Element} [props.suffix] - Element to display to the right of the number picker.
|
|
131
|
-
* @param {number} [props.fixedWidth] - If passed, sets the width of the input field to the provided number of characters. Useful if you have e.g. value from 1 to 1000, but you don't want the input field to change size when on lower values.
|
|
132
|
-
* @param {boolean} [props.inline] - If `true`, the number picker is displayed inline.
|
|
133
|
-
* @param {boolean} [props.noScrollToChange=false] - If `true`, the number picker does not change value when scrolling.
|
|
134
|
-
* @param {NumberPickerSize} [props.size='default'] - Determines the input field size.
|
|
135
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
136
|
-
*
|
|
137
|
-
* @returns {JSX.Element} The NumberPicker component.
|
|
138
|
-
*
|
|
139
|
-
* @typedef {'compact' | 'small' | 'default'} NumberPickerSize
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
142
|
-
* <NumberPicker
|
|
143
|
-
* value={value}
|
|
144
|
-
* onChange={setValue}
|
|
145
|
-
* />
|
|
146
|
-
*
|
|
147
|
-
* @preserve
|
|
148
|
-
*/
|
|
149
|
-
const NumberPicker = ({
|
|
150
|
-
value,
|
|
151
|
-
onChange,
|
|
152
|
-
min = 0,
|
|
153
|
-
max,
|
|
154
|
-
step = 1,
|
|
155
|
-
label,
|
|
156
|
-
icon,
|
|
157
|
-
subtitle,
|
|
158
|
-
help,
|
|
159
|
-
readOnly,
|
|
160
|
-
disabled,
|
|
161
|
-
placeholder,
|
|
162
|
-
prefix,
|
|
163
|
-
fixedWidth = null,
|
|
164
|
-
suffix,
|
|
165
|
-
children,
|
|
166
|
-
inline,
|
|
167
|
-
noScrollToChange = false,
|
|
168
|
-
size = "default",
|
|
169
|
-
"aria-label": ariaLabel,
|
|
170
|
-
hidden,
|
|
171
|
-
...props
|
|
172
|
-
}) => {
|
|
173
|
-
var _a, _b, _c, _d, _e;
|
|
174
|
-
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
175
|
-
if (hidden) {
|
|
176
|
-
return null;
|
|
177
|
-
}
|
|
178
|
-
const sizes = {
|
|
179
|
-
compact: {
|
|
180
|
-
field: "es:min-h-5",
|
|
181
|
-
noPrefixPadding: "es:pl-1.5",
|
|
182
|
-
extraContentSeparator: "es:h-[1.875rem]"
|
|
183
|
-
},
|
|
184
|
-
small: {
|
|
185
|
-
field: "es:min-h-9",
|
|
186
|
-
noPrefixPadding: "es:pl-2",
|
|
187
|
-
extraContentSeparator: "es:h-[2.125rem]"
|
|
188
|
-
},
|
|
189
|
-
default: {
|
|
190
|
-
field: "es:min-h-10",
|
|
191
|
-
noPrefixPadding: "es:pl-2",
|
|
192
|
-
extraContentSeparator: "es:h-[2.375rem]"
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
return /* @__PURE__ */ jsx(
|
|
196
|
-
$b91743d66a0ed188$export$63c5fa0b2fdccd2e,
|
|
197
|
-
{
|
|
198
|
-
value,
|
|
199
|
-
onChange,
|
|
200
|
-
isDisabled: disabled,
|
|
201
|
-
isReadOnly: readOnly,
|
|
202
|
-
minValue: min,
|
|
203
|
-
maxValue: max,
|
|
204
|
-
step,
|
|
205
|
-
isWheelDisabled: noScrollToChange,
|
|
206
|
-
...props,
|
|
207
|
-
children: /* @__PURE__ */ jsx(
|
|
208
|
-
BaseControl,
|
|
209
|
-
{
|
|
210
|
-
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
211
|
-
icon,
|
|
212
|
-
label,
|
|
213
|
-
subtitle,
|
|
214
|
-
help,
|
|
215
|
-
inline,
|
|
216
|
-
className: "es:text-sm",
|
|
217
|
-
children: /* @__PURE__ */ jsxs(
|
|
218
|
-
$a049562f99e7db0e$export$eb2fcfdbd7ba97d4,
|
|
219
|
-
{
|
|
220
|
-
className: clsx(
|
|
221
|
-
"es:group es:flex es:w-fit es:items-center es:rounded-lg es:border es:border-secondary-300 es:pl-1 es:pr-0.5 es:shadow-xs es:transition",
|
|
222
|
-
"es:inset-ring es:inset-ring-secondary-100",
|
|
223
|
-
isInputFocused && "es:outline-hidden es:focus-visible:border-accent-500 es:focus-visible:ring-2 es:focus-visible:ring-accent-500/50",
|
|
224
|
-
!prefix && (((_a = sizes == null ? void 0 : sizes[size]) == null ? void 0 : _a.noPrefixPadding) ?? sizes.default.noPrefixPadding),
|
|
225
|
-
((_b = sizes == null ? void 0 : sizes[size]) == null ? void 0 : _b.field) ?? sizes.default.field,
|
|
226
|
-
"es:disabled:shadow-none es:disabled:border-secondary-200 es:disabled:bg-secondary-50 es:disabled:text-secondary-500 es:disabled:cursor-default es:readonly:bg-secondary-50"
|
|
227
|
-
),
|
|
228
|
-
children: [
|
|
229
|
-
prefix && /* @__PURE__ */ jsx(
|
|
230
|
-
"span",
|
|
231
|
-
{
|
|
232
|
-
slot: "prefix",
|
|
233
|
-
className: "es:col-start-1 es:row-span-2 es:mr-0.5 es:select-none es:self-center es:text-sm es:text-secondary-400",
|
|
234
|
-
children: prefix
|
|
235
|
-
}
|
|
236
|
-
),
|
|
237
|
-
/* @__PURE__ */ jsx(
|
|
238
|
-
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
239
|
-
{
|
|
240
|
-
onFocus: () => setIsInputFocused(true),
|
|
241
|
-
onBlur: () => setIsInputFocused(false),
|
|
242
|
-
className: "es:col-start-2 es:row-span-2 es:border-none! es:bg-transparent es:px-0! es:py-1! es:text-sm es:tabular-nums es:shadow-none! es:outline-hidden! es:selection:bg-accent-500/20 es:selection:text-accent-950 es:focus:shadow-none! es:any-focus:outline-hidden",
|
|
243
|
-
placeholder,
|
|
244
|
-
style: {
|
|
245
|
-
width: fixedWidth ? `${fixedWidth}ch` : `calc(${min < 0 ? "0.75ch + " : ""}${(_d = (_c = max ?? 1e3) == null ? void 0 : _c.toString()) == null ? void 0 : _d.length} * 1ch)`
|
|
246
|
-
},
|
|
247
|
-
"aria-label": ariaLabel ?? __("Enter a number", "eightshift-ui-components")
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
/* @__PURE__ */ jsxs("div", { className: clsx("es:opacity-0 es:group-hover:opacity-100 es:group-focus-visible:opacity-100 es:transition-opacity", disabled && "es:invisible"), children: [
|
|
251
|
-
/* @__PURE__ */ jsx(
|
|
252
|
-
Button,
|
|
253
|
-
{
|
|
254
|
-
type: "ghost",
|
|
255
|
-
className: "es:col-start-4 es:h-3 es:w-4 es:text-secondary-500! es:disabled:text-secondary-300! es:icon:size-[0.8rem]",
|
|
256
|
-
slot: "increment",
|
|
257
|
-
icon: icons.caretUpFill
|
|
258
|
-
}
|
|
259
|
-
),
|
|
260
|
-
/* @__PURE__ */ jsx(
|
|
261
|
-
Button,
|
|
262
|
-
{
|
|
263
|
-
type: "ghost",
|
|
264
|
-
className: "es:col-start-4 es:h-3 es:w-4 es:text-secondary-500! es:disabled:text-secondary-300! es:icon:size-[0.8rem]",
|
|
265
|
-
slot: "decrement",
|
|
266
|
-
icon: icons.caretDownFill
|
|
267
|
-
}
|
|
268
|
-
)
|
|
269
|
-
] }),
|
|
270
|
-
suffix && /* @__PURE__ */ jsx(
|
|
271
|
-
"span",
|
|
272
|
-
{
|
|
273
|
-
slot: "suffix",
|
|
274
|
-
className: "es:col-start-3 es:row-span-2 es:select-none es:self-center es:text-sm es:text-secondary-400 es:mr-0.5",
|
|
275
|
-
children: suffix
|
|
276
|
-
}
|
|
277
|
-
),
|
|
278
|
-
children && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
279
|
-
/* @__PURE__ */ jsx("div", { className: clsx("es:w-px es:bg-secondary-300", ((_e = sizes == null ? void 0 : sizes[size]) == null ? void 0 : _e.extraContentSeparator) ?? sizes.default.extraContentSeparator) }),
|
|
280
|
-
/* @__PURE__ */ jsx("div", { className: "es:p-0.5 es:pr-0", children: Array.isArray(children) ? children.map((child) => cloneElement(child, { slot: null })) : cloneElement(children, { slot: null }) })
|
|
281
|
-
] })
|
|
282
|
-
]
|
|
283
|
-
}
|
|
284
|
-
)
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
}
|
|
288
|
-
);
|
|
289
|
-
};
|
|
290
|
-
export {
|
|
291
|
-
NumberPicker
|
|
292
|
-
};
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from "react";
|
|
3
|
-
import { icons } from "../../icons/icons.js";
|
|
4
|
-
import { BaseControl } from "../base-control/base-control.js";
|
|
5
|
-
import { ButtonGroup } from "../button/button.js";
|
|
6
|
-
import { Menu, MenuSeparator, MenuItem } from "../menu/menu.js";
|
|
7
|
-
import { RadioButtonGroup, RadioButton } from "../radio/radio.js";
|
|
8
|
-
import { RichLabel } from "../rich-label/rich-label.js";
|
|
9
|
-
import { ToggleButton } from "../toggle-button/toggle-button.js";
|
|
10
|
-
import { _ as __ } from "../../default-i18n-CT_oS1Fy.js";
|
|
11
|
-
/**
|
|
12
|
-
* A component that allows the user to select an option from a list of options.
|
|
13
|
-
*
|
|
14
|
-
* @component
|
|
15
|
-
* @param {Object} props - Component props.
|
|
16
|
-
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
17
|
-
* @param {string} props.label - Label to display.
|
|
18
|
-
* @param {string} [props.subtitle] - Subtitle to display below the label.
|
|
19
|
-
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to show to the right of the label.
|
|
20
|
-
* @param {string} [props.help] - Help text to show below the component.
|
|
21
|
-
* @param {boolean} [props.inline] - If `true`, the component is displayed inline - icon/label/subtitle are on the left, the passed content is on the right. **Note:** not compatible with `actions`.
|
|
22
|
-
* @param {string} props.value - The currently selected value.
|
|
23
|
-
* @param {Function} props.onChange - Function to run when the selected value changes.
|
|
24
|
-
* @param {{label: string, value: any, tooltip: string|JSX.Element, icon: JSX.Element|string, ariaLabel: string, subtitle:string|JSX.Element }[]} props.options - The list of options to choose from.
|
|
25
|
-
* @param {string} [props.disabled] - If `true`, the option select component is disabled.
|
|
26
|
-
* @param {boolean} [props.vertical] - If `true`, the options are displayed vertically. Not applicable to the `menu` type.
|
|
27
|
-
* @param {OptionSelectType} [props.type='toggleButton'] - The type of the option select component.
|
|
28
|
-
* @param {string} [props.className] - Classes to pass to the main element wrapper.
|
|
29
|
-
* @param {string} [props.itemClassName] - Classes to pass to each item.
|
|
30
|
-
* @param {Object} [props.wrapperProps] - Props to pass to the wrapper.
|
|
31
|
-
* @param {Object} [props.itemProps] - Props to pass to each item.
|
|
32
|
-
* @param {boolean} [props.noTriggerLabel] - Whether the trigger label should be hidden. Applies only to the `menu` type.
|
|
33
|
-
* @param {boolean} [props.noTriggerIcon] - Whether the trigger icon should be hidden. Applies only to the `menu` type.
|
|
34
|
-
* @param {string|boolean} [props.tooltip] - If provided, overrides the default tooltip text. If there is no label, the value will still be shown within the tooltip. Applies only to the `menu` type. If `true` is set and an `aria-label` is provided, the tooltip will show the same text as the `aria-label`.
|
|
35
|
-
* @param {boolean} [props.noItemLabel] - Whether the option label should be hidden.
|
|
36
|
-
* @param {boolean} [props.noItemIcon] - Whether the option icon should be hidden.
|
|
37
|
-
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
38
|
-
*
|
|
39
|
-
* @returns {JSX.Element} The OptionSelect component.
|
|
40
|
-
*
|
|
41
|
-
* @typedef {'toggleButtons' | 'toggleButtonsSplit' | 'radios' | 'radiosSegmented' | 'menu'} OptionSelectType
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* <OptionSelect
|
|
45
|
-
* label='My component'
|
|
46
|
-
* icon={icons.myIcon}
|
|
47
|
-
* value={value}
|
|
48
|
-
* onChange={setValue}
|
|
49
|
-
* options={[
|
|
50
|
-
* { label: 'Option 1', value: 'option1' },
|
|
51
|
-
* { label: 'Option 2', value: 'option2' },
|
|
52
|
-
* ]}
|
|
53
|
-
* />
|
|
54
|
-
*
|
|
55
|
-
* @preserve
|
|
56
|
-
*/
|
|
57
|
-
const OptionSelect = (props) => {
|
|
58
|
-
var _a;
|
|
59
|
-
const {
|
|
60
|
-
icon,
|
|
61
|
-
label,
|
|
62
|
-
subtitle,
|
|
63
|
-
actions,
|
|
64
|
-
help,
|
|
65
|
-
inline,
|
|
66
|
-
value,
|
|
67
|
-
onChange,
|
|
68
|
-
options,
|
|
69
|
-
disabled,
|
|
70
|
-
vertical,
|
|
71
|
-
type = "toggleButtons",
|
|
72
|
-
className,
|
|
73
|
-
itemClassName,
|
|
74
|
-
wrapperProps,
|
|
75
|
-
itemProps,
|
|
76
|
-
noTriggerLabel,
|
|
77
|
-
noTriggerIcon,
|
|
78
|
-
tooltip: rawTooltip,
|
|
79
|
-
noItemLabel,
|
|
80
|
-
noItemIcon,
|
|
81
|
-
children,
|
|
82
|
-
hidden,
|
|
83
|
-
"aria-label": ariaLabel,
|
|
84
|
-
...rest
|
|
85
|
-
} = props;
|
|
86
|
-
if (hidden) {
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
let tooltip = rawTooltip;
|
|
90
|
-
if (rawTooltip === true && (ariaLabel == null ? void 0 : ariaLabel.length) > 0) {
|
|
91
|
-
tooltip = ariaLabel;
|
|
92
|
-
}
|
|
93
|
-
const currentItem = options == null ? void 0 : options.find(({ value: optionValue }) => optionValue === value);
|
|
94
|
-
const notSetLabel = /* @__PURE__ */ jsx("span", { className: "es:leading-3 es:opacity-50", children: __("Not set", "eightshift-ui-components") });
|
|
95
|
-
let radioDesign = "default";
|
|
96
|
-
if (type === "radiosSegmented") {
|
|
97
|
-
radioDesign = "segmented";
|
|
98
|
-
}
|
|
99
|
-
return /* @__PURE__ */ jsxs(
|
|
100
|
-
BaseControl,
|
|
101
|
-
{
|
|
102
|
-
icon,
|
|
103
|
-
label,
|
|
104
|
-
subtitle,
|
|
105
|
-
actions,
|
|
106
|
-
help,
|
|
107
|
-
inline,
|
|
108
|
-
className,
|
|
109
|
-
...rest,
|
|
110
|
-
children: [
|
|
111
|
-
["toggleButtons", "toggleButtonsSplit"].includes(type) && /* @__PURE__ */ jsx(
|
|
112
|
-
ButtonGroup,
|
|
113
|
-
{
|
|
114
|
-
vertical,
|
|
115
|
-
"aria-label": typeof label !== "undefined" ? null : ariaLabel,
|
|
116
|
-
type: type === "toggleButtonsSplit" ? "split" : "segmented",
|
|
117
|
-
...wrapperProps,
|
|
118
|
-
children: options.map(
|
|
119
|
-
({
|
|
120
|
-
label: optionLabel,
|
|
121
|
-
value: optionValue,
|
|
122
|
-
icon: optionIcon,
|
|
123
|
-
tooltip: optionTooltip,
|
|
124
|
-
ariaLabel: optionAriaLabel,
|
|
125
|
-
subtitle: optionSubtitle,
|
|
126
|
-
disabled: optionDisabled
|
|
127
|
-
}) => {
|
|
128
|
-
var _a2;
|
|
129
|
-
return /* @__PURE__ */ jsxs(
|
|
130
|
-
ToggleButton,
|
|
131
|
-
{
|
|
132
|
-
selected: optionValue === value,
|
|
133
|
-
onChange: () => onChange(optionValue),
|
|
134
|
-
disabled: optionDisabled || disabled,
|
|
135
|
-
className: itemClassName,
|
|
136
|
-
icon: !noItemIcon && (typeof optionIcon === "string" ? (_a2 = icons) == null ? void 0 : _a2[optionIcon] : optionIcon),
|
|
137
|
-
tooltip: optionTooltip ?? optionAriaLabel ?? (noItemLabel && optionLabel),
|
|
138
|
-
"aria-label": optionAriaLabel ?? optionLabel ?? optionTooltip,
|
|
139
|
-
...itemProps,
|
|
140
|
-
children: [
|
|
141
|
-
!noItemLabel && !optionSubtitle && optionLabel,
|
|
142
|
-
!noItemLabel && optionSubtitle && /* @__PURE__ */ jsx(
|
|
143
|
-
RichLabel,
|
|
144
|
-
{
|
|
145
|
-
label: optionLabel,
|
|
146
|
-
subtitle: optionSubtitle,
|
|
147
|
-
noColor: true
|
|
148
|
-
}
|
|
149
|
-
)
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
optionValue
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
)
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
(type === "radios" || type === "radiosSegmented") && /* @__PURE__ */ jsx(
|
|
159
|
-
RadioButtonGroup,
|
|
160
|
-
{
|
|
161
|
-
orientation: vertical ? "vertical" : "horizontal",
|
|
162
|
-
onChange: (v) => onChange(v),
|
|
163
|
-
design: radioDesign,
|
|
164
|
-
"aria-label": typeof label !== "undefined" ? null : ariaLabel,
|
|
165
|
-
value,
|
|
166
|
-
...wrapperProps,
|
|
167
|
-
children: options.map(({ label: optionLabel, value: optionValue, icon: optionIcon, ariaLabel: optionAriaLabel, subtitle: optionSubtitle, disabled: optionDisabled }) => {
|
|
168
|
-
var _a2;
|
|
169
|
-
return /* @__PURE__ */ jsx(
|
|
170
|
-
RadioButton,
|
|
171
|
-
{
|
|
172
|
-
value: optionValue,
|
|
173
|
-
disabled: optionDisabled || disabled,
|
|
174
|
-
className: itemClassName,
|
|
175
|
-
subtitle: !noItemLabel && optionSubtitle,
|
|
176
|
-
icon: !noItemIcon && (typeof optionIcon === "string" ? (_a2 = icons) == null ? void 0 : _a2[optionIcon] : optionIcon),
|
|
177
|
-
"aria-label": optionAriaLabel ?? optionLabel,
|
|
178
|
-
label: !noItemLabel && optionLabel,
|
|
179
|
-
...itemProps
|
|
180
|
-
},
|
|
181
|
-
optionValue
|
|
182
|
-
);
|
|
183
|
-
})
|
|
184
|
-
}
|
|
185
|
-
),
|
|
186
|
-
type === "menu" && /* @__PURE__ */ jsxs(
|
|
187
|
-
Menu,
|
|
188
|
-
{
|
|
189
|
-
triggerLabel: noTriggerLabel ? null : (currentItem == null ? void 0 : currentItem.label) ?? notSetLabel,
|
|
190
|
-
triggerIcon: !noTriggerIcon && // eslint-disable-next-line no-nested-ternary
|
|
191
|
-
(currentItem ? typeof (currentItem == null ? void 0 : currentItem.icon) === "string" ? (_a = icons) == null ? void 0 : _a[currentItem == null ? void 0 : currentItem.icon] : currentItem == null ? void 0 : currentItem.icon : (noTriggerLabel || noTriggerIcon) && notSetLabel),
|
|
192
|
-
tooltip: noTriggerLabel ? /* @__PURE__ */ jsx(
|
|
193
|
-
RichLabel,
|
|
194
|
-
{
|
|
195
|
-
label: tooltip ? tooltip : (currentItem == null ? void 0 : currentItem.tooltip) ?? (currentItem == null ? void 0 : currentItem.label),
|
|
196
|
-
subtitle: tooltip && ((currentItem == null ? void 0 : currentItem.tooltip) ?? (currentItem == null ? void 0 : currentItem.label)),
|
|
197
|
-
noColor: true
|
|
198
|
-
}
|
|
199
|
-
) : tooltip,
|
|
200
|
-
triggerProps: {
|
|
201
|
-
...wrapperProps == null ? void 0 : wrapperProps.triggerProps,
|
|
202
|
-
"aria-label": typeof label !== "undefined" ? null : ariaLabel ?? label ?? tooltip
|
|
203
|
-
},
|
|
204
|
-
keepOpen: true,
|
|
205
|
-
"aria-label": ariaLabel ?? label ?? tooltip ?? __("Menu", "eightshift-ui-components"),
|
|
206
|
-
...wrapperProps,
|
|
207
|
-
children: [
|
|
208
|
-
options.map(
|
|
209
|
-
({
|
|
210
|
-
label: optionLabel,
|
|
211
|
-
value: optionValue,
|
|
212
|
-
icon: optionIcon,
|
|
213
|
-
endIcon: optionEndIcon,
|
|
214
|
-
ariaLabel: optionAriaLabel,
|
|
215
|
-
subtitle: optionSubtitle,
|
|
216
|
-
separator: optionHasSeparator,
|
|
217
|
-
sectionTitle: optionSectionTitle,
|
|
218
|
-
shortcut: optionShortcut,
|
|
219
|
-
disabled: optionDisabled
|
|
220
|
-
}) => {
|
|
221
|
-
var _a2, _b;
|
|
222
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
223
|
-
(optionHasSeparator === true || optionHasSeparator === "above") && /* @__PURE__ */ jsx(MenuSeparator, {}),
|
|
224
|
-
optionSectionTitle && /* @__PURE__ */ jsx(MenuItem, { disabled: true, children: optionSectionTitle }),
|
|
225
|
-
/* @__PURE__ */ jsxs(
|
|
226
|
-
MenuItem,
|
|
227
|
-
{
|
|
228
|
-
selected: value === optionValue,
|
|
229
|
-
disabled: optionDisabled || disabled,
|
|
230
|
-
className: itemClassName,
|
|
231
|
-
icon: !noItemIcon && (typeof optionIcon === "string" ? (_a2 = icons) == null ? void 0 : _a2[optionIcon] : optionIcon),
|
|
232
|
-
endIcon: !noItemIcon && (typeof optionEndIcon === "string" ? (_b = icons) == null ? void 0 : _b[optionEndIcon] : optionEndIcon),
|
|
233
|
-
"aria-label": optionAriaLabel ?? optionLabel,
|
|
234
|
-
onClick: () => onChange(optionValue),
|
|
235
|
-
shortcut: optionShortcut,
|
|
236
|
-
...itemProps,
|
|
237
|
-
children: [
|
|
238
|
-
!noItemLabel && !optionSubtitle && optionLabel,
|
|
239
|
-
!noItemLabel && optionSubtitle && /* @__PURE__ */ jsx(
|
|
240
|
-
RichLabel,
|
|
241
|
-
{
|
|
242
|
-
label: optionLabel,
|
|
243
|
-
subtitle: optionSubtitle,
|
|
244
|
-
noColor: true
|
|
245
|
-
}
|
|
246
|
-
)
|
|
247
|
-
]
|
|
248
|
-
}
|
|
249
|
-
),
|
|
250
|
-
optionHasSeparator === "below" && /* @__PURE__ */ jsx(MenuSeparator, {})
|
|
251
|
-
] }, optionValue);
|
|
252
|
-
}
|
|
253
|
-
),
|
|
254
|
-
children
|
|
255
|
-
]
|
|
256
|
-
}
|
|
257
|
-
)
|
|
258
|
-
]
|
|
259
|
-
}
|
|
260
|
-
);
|
|
261
|
-
};
|
|
262
|
-
export {
|
|
263
|
-
OptionSelect
|
|
264
|
-
};
|