@eightshift/ui-components 0.0.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/README.md +27 -0
- package/dist/Checkbox-BLcVbhiO.js +178 -0
- package/dist/ColorSwatch-Cmlex_kT.js +66 -0
- package/dist/FieldError-wtMA4667.js +42 -0
- package/dist/FocusScope-1u9yyfIN.js +725 -0
- package/dist/Form-Cq3fu75_.js +5 -0
- package/dist/GridList-BZPXp3_O.js +1256 -0
- package/dist/Group-DyqpTRPe.js +49 -0
- package/dist/Input-jsbb4ugq.js +130 -0
- package/dist/Label-BPzS-sR7.js +17 -0
- package/dist/ListBox-w9gDaJkV.js +4423 -0
- package/dist/LiveAnnouncer-IsokfWQ5.js +73 -0
- package/dist/NumberFormatter-LzoKy975.js +160 -0
- package/dist/RSPContexts-CrNYmadY.js +14 -0
- package/dist/Select-49a62830.esm-C-RFtLiD.js +2541 -0
- package/dist/SelectionManager-mefd0ThJ.js +2155 -0
- package/dist/Separator-DHn0CwdK.js +325 -0
- package/dist/Slider-Pyh2V4bY.js +885 -0
- package/dist/Text-BM136LvS.js +17 -0
- package/dist/VisuallyHidden-BYRI1Lfo.js +51 -0
- package/dist/_commonjsHelpers-CUmg6egw.js +6 -0
- package/dist/ariaHideOutside-ByKBPHmX.js +113 -0
- package/dist/assets/style.css +1 -0
- package/dist/button-BkkdyHfJ.js +307 -0
- package/dist/components/animated-visibility/animated-visibility.js +7165 -0
- package/dist/components/base-control/base-control.js +97 -0
- package/dist/components/breakpoint-preview/breakpoint-preview.js +218 -0
- package/dist/components/button/button.js +10 -0
- package/dist/components/checkbox/checkbox.js +119 -0
- package/dist/components/color-pickers/color-picker.js +242 -0
- package/dist/components/color-pickers/color-swatch.js +62 -0
- package/dist/components/color-pickers/gradient-editor.js +516 -0
- package/dist/components/color-pickers/solid-color-picker.js +1633 -0
- package/dist/components/component-toggle/component-toggle.js +71 -0
- package/dist/components/container-panel/container-panel.js +39 -0
- package/dist/components/expandable/expandable.js +144 -0
- package/dist/components/input-field/input-field.js +224 -0
- package/dist/components/link-input/link-input.js +937 -0
- package/dist/components/list-box/list-box.js +152 -0
- package/dist/components/matrix-align/matrix-align.js +185 -0
- package/dist/components/menu/menu.js +1608 -0
- package/dist/components/notice/notice.js +119 -0
- package/dist/components/number-picker/number-picker.js +277 -0
- package/dist/components/popover/popover.js +9 -0
- package/dist/components/radio/radio.js +552 -0
- package/dist/components/repeater/repeater-item.js +127 -0
- package/dist/components/repeater/repeater.js +248 -0
- package/dist/components/responsive/responsive-legacy.js +326 -0
- package/dist/components/responsive/responsive.js +499 -0
- package/dist/components/responsive-preview/responsive-preview.js +119 -0
- package/dist/components/rich-label/rich-label.js +56 -0
- package/dist/components/select/async-multi-select.js +144 -0
- package/dist/components/select/async-single-select.js +126 -0
- package/dist/components/select/custom-select-default-components.js +38 -0
- package/dist/components/select/multi-select-components.js +8 -0
- package/dist/components/select/multi-select.js +134 -0
- package/dist/components/select/react-select-component-wrappers.js +90 -0
- package/dist/components/select/shared.js +45 -0
- package/dist/components/select/single-select.js +116 -0
- package/dist/components/select/styles.js +55 -0
- package/dist/components/slider/column-config-slider.js +225 -0
- package/dist/components/slider/slider.js +362 -0
- package/dist/components/slider/utils.js +45 -0
- package/dist/components/spacer/spacer.js +93 -0
- package/dist/components/tabs/tabs.js +626 -0
- package/dist/components/toggle/switch.js +140 -0
- package/dist/components/toggle/toggle.js +58 -0
- package/dist/components/toggle-button/toggle-button.js +206 -0
- package/dist/components/tooltip/tooltip.js +10 -0
- package/dist/context-jMy6xdVq.js +98 -0
- package/dist/default-i18n-BhE-OUmt.js +873 -0
- package/dist/filterDOMProps-DG2RfOUr.js +30 -0
- package/dist/focusSafely-C3K8zAKj.js +743 -0
- package/dist/hooks/use-cell-edit-mode.js +35 -0
- package/dist/icons/block-icon.js +42 -0
- package/dist/icons/generic-color-swatch.js +21 -0
- package/dist/icons/icons.js +3636 -0
- package/dist/index-Bfb9bWcb.js +28844 -0
- package/dist/index-a301f526.esm-Bioi4cGX.js +3576 -0
- package/dist/index.js +109 -0
- package/dist/intlStrings-CUhoK9EN.js +2484 -0
- package/dist/isScrollable-PcyglExV.js +10 -0
- package/dist/modifiers.esm-BuJQPI1X.js +31 -0
- package/dist/multi-select-components-CjVpCNko.js +3677 -0
- package/dist/number-rWqELA8W.js +39 -0
- package/dist/popover-Dx3vKXUX.js +1061 -0
- package/dist/react-select-async.esm-TFb_ZX6C.js +111 -0
- package/dist/react-select.esm-BjRWqf0E.js +15 -0
- package/dist/style.js +1 -0
- package/dist/textSelection-BosCCRVE.js +89 -0
- package/dist/tooltip-CkCndvTI.js +1094 -0
- package/dist/useButton-CuG5UzUw.js +74 -0
- package/dist/useEvent-DHv-yhOH.js +24 -0
- package/dist/useFocusRing-Cc-4eouh.js +41 -0
- package/dist/useFocusable-5q1Gek1J.js +81 -0
- package/dist/useFormReset-Buc9YJcv.js +23 -0
- package/dist/useFormValidationState-BAPPNXic.js +238 -0
- package/dist/useHasTabbableChild-D3uUNhJ0.js +37 -0
- package/dist/useLabel-CGlkoFG0.js +28 -0
- package/dist/useLabels-Dg62M_3P.js +25 -0
- package/dist/useListData-BelKu4kx.js +211 -0
- package/dist/useListState-Domq0blV.js +137 -0
- package/dist/useLocalizedStringFormatter-Prmz0h0A.js +130 -0
- package/dist/useNumberFieldState-BLU3uhSR.js +1253 -0
- package/dist/useNumberFormatter-BLc2xjZn.js +13 -0
- package/dist/usePress-BQgVor4T.js +698 -0
- package/dist/useToggle-C9ETOBaZ.js +58 -0
- package/dist/useToggleState-DJ_z5E2S.js +21 -0
- package/dist/utilities/classnames.js +16 -0
- package/dist/utilities/text-helpers.js +79 -0
- package/dist/utils-BsiH7-5Y.js +488 -0
- package/package.json +71 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
|
|
3
|
+
import { Expandable } from "../expandable/expandable.js";
|
|
4
|
+
import { icons } from "../../icons/icons.js";
|
|
5
|
+
import { Switch } from "../toggle/switch.js";
|
|
6
|
+
import { D as DecorativeTooltip } from "../../tooltip-CkCndvTI.js";
|
|
7
|
+
/**
|
|
8
|
+
* A component that provides a nice way to toggle a component on and off, and display its content in an expandable panel.
|
|
9
|
+
*
|
|
10
|
+
* @component
|
|
11
|
+
* @param {Object} props - Component props.
|
|
12
|
+
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
13
|
+
* @param {string} props.label - Label to display.
|
|
14
|
+
* @param {string} [props.subtitle] - Subtitle to display.
|
|
15
|
+
* @param {boolean} props.useComponent - Whether the component is used. If `false`, the content is hidden.
|
|
16
|
+
* @param {Function} props.onChange - Function to run when the toggle state changes.
|
|
17
|
+
* @param {boolean} [props.noUseToggle] - If `true`, the toggle is not displayed.
|
|
18
|
+
* @param {boolean} [props.expandButtonDisabled] - If `true`, the expand button is disabled.
|
|
19
|
+
* @param {boolean} [props.controlOnly] - If `true`, only the control is displayed.
|
|
20
|
+
* @param {string} [props.contentClassName] - Classes to pass to the content container.
|
|
21
|
+
*
|
|
22
|
+
* @returns {JSX.Element} The ComponentToggle component.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* <ComponentToggle
|
|
26
|
+
* label='My component'
|
|
27
|
+
* useComponent={useComponent}
|
|
28
|
+
* onChange={setUseComponent}
|
|
29
|
+
* >
|
|
30
|
+
* ...
|
|
31
|
+
* </ComponentToggle>
|
|
32
|
+
*
|
|
33
|
+
* @preserve
|
|
34
|
+
*/
|
|
35
|
+
const ComponentToggle = (props) => {
|
|
36
|
+
const {
|
|
37
|
+
children,
|
|
38
|
+
icon,
|
|
39
|
+
label,
|
|
40
|
+
subtitle,
|
|
41
|
+
useComponent,
|
|
42
|
+
onChange,
|
|
43
|
+
noUseToggle,
|
|
44
|
+
expandButtonDisabled,
|
|
45
|
+
controlOnly,
|
|
46
|
+
contentClassName = "es-uic-space-y-2.5"
|
|
47
|
+
} = props;
|
|
48
|
+
if (controlOnly) {
|
|
49
|
+
return children;
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsx(
|
|
52
|
+
Expandable,
|
|
53
|
+
{
|
|
54
|
+
icon: icon ?? icons.componentGeneric,
|
|
55
|
+
label,
|
|
56
|
+
subtitle,
|
|
57
|
+
actions: !noUseToggle && /* @__PURE__ */ jsx(DecorativeTooltip, { text: __("Toggle component", "eightshift-ui-components"), children: /* @__PURE__ */ jsx("div", { className: "es-uic-mr-0.5 es-uic-flex es-uic-min-h-8 es-uic-items-center es-uic-border-r es-uic-border-r-gray-200 es-uic-pr-1.5", children: /* @__PURE__ */ jsx(
|
|
58
|
+
Switch,
|
|
59
|
+
{
|
|
60
|
+
checked: useComponent,
|
|
61
|
+
onChange
|
|
62
|
+
}
|
|
63
|
+
) }) }),
|
|
64
|
+
disabled: !useComponent || expandButtonDisabled,
|
|
65
|
+
children: !expandButtonDisabled && /* @__PURE__ */ jsx("div", { className: contentClassName, children })
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
export {
|
|
70
|
+
ComponentToggle
|
|
71
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { classnames } from "../../utilities/classnames.js";
|
|
3
|
+
/**
|
|
4
|
+
* Component that provides a container panel for options, with an optional title.
|
|
5
|
+
* Best used within the Gutenberg sidebar, instead of the default `PanelBody` component.
|
|
6
|
+
* Ensures that the content is spaced nicely.
|
|
7
|
+
*
|
|
8
|
+
* @component
|
|
9
|
+
* @param {Object} props - Component props.
|
|
10
|
+
* @param {string} [props.className] - Classes to pass to the container.
|
|
11
|
+
* @param {string} [props.title] - Title to display on the top of the panel.
|
|
12
|
+
*
|
|
13
|
+
* @returns {JSX.Element} The ContainerPanel component.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* <ContainerPanel title='Paragraph'>
|
|
17
|
+
* ...
|
|
18
|
+
* </ContainerPanel>
|
|
19
|
+
*
|
|
20
|
+
* @preserve
|
|
21
|
+
*/
|
|
22
|
+
const ContainerPanel = ({ children, className, title }) => {
|
|
23
|
+
return /* @__PURE__ */ jsxs(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: classnames(
|
|
27
|
+
"es-uic-space-y-2.5 es-uic-border-t es-uic-border-t-gray-200 es-uic-p-4 es-uic-pt-3",
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
children: [
|
|
31
|
+
title && /* @__PURE__ */ jsx("span", { className: "es-uic-select-none es-uic-text-[0.8125rem] es-uic-font-medium es-uic-text-gray-500", children: title }),
|
|
32
|
+
children
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
export {
|
|
38
|
+
ContainerPanel
|
|
39
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import React__default from "react";
|
|
3
|
+
import { RichLabel } from "../rich-label/rich-label.js";
|
|
4
|
+
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
5
|
+
import { B as Button } from "../../button-BkkdyHfJ.js";
|
|
6
|
+
import { icons } from "../../icons/icons.js";
|
|
7
|
+
import { classnames } from "../../utilities/classnames.js";
|
|
8
|
+
import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
|
|
9
|
+
import { $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BPzS-sR7.js";
|
|
10
|
+
import { $ as $9bf71ea28793e738$export$20e40289641fbbb6 } from "../../FocusScope-1u9yyfIN.js";
|
|
11
|
+
/**
|
|
12
|
+
* A component that allows hiding content in an expandable panel, to declutter the UI.
|
|
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.
|
|
19
|
+
* @param {string} [props.className] - Classes to pass to the container.
|
|
20
|
+
* @param {string} [props.labelClassName] - Classes to pass to the label.
|
|
21
|
+
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display in the panel header, left of the expand button.
|
|
22
|
+
* @param {boolean} [props.keepActionsOnExpand=false] - If `true`, the actions are not hidden when the panel is expanded.
|
|
23
|
+
* @param {boolean} [props.disabled] - If `true`, the expand button is disabled.
|
|
24
|
+
* @param {boolean} [props.noFocusHandling] - If `true`, the focus trapping when the item is expanded is disabled. Useful when part of another component that manages focus itself.
|
|
25
|
+
* @param {boolean} [props.open] - Whether the expandable is open.
|
|
26
|
+
* @param {Function} [props.onOpenChange] - Function is called when the panel is opened or closed.
|
|
27
|
+
*
|
|
28
|
+
* @returns {JSX.Element} The Expandable component.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* <Expandable label='My component'>
|
|
32
|
+
* ...
|
|
33
|
+
* </Expandable>
|
|
34
|
+
*
|
|
35
|
+
* @preserve
|
|
36
|
+
*/
|
|
37
|
+
const Expandable = (props) => {
|
|
38
|
+
const {
|
|
39
|
+
icon,
|
|
40
|
+
label,
|
|
41
|
+
subtitle,
|
|
42
|
+
className,
|
|
43
|
+
labelClassName,
|
|
44
|
+
actions,
|
|
45
|
+
keepActionsOnExpand = false,
|
|
46
|
+
disabled,
|
|
47
|
+
noFocusHandling,
|
|
48
|
+
children,
|
|
49
|
+
open = false,
|
|
50
|
+
onOpenChange,
|
|
51
|
+
...other
|
|
52
|
+
} = props;
|
|
53
|
+
const [isOpen, setIsOpen] = React__default.useState(open);
|
|
54
|
+
const component = /* @__PURE__ */ jsxs(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
className: classnames(
|
|
58
|
+
"es-uic-w-full es-uic-rounded-lg es-uic-border es-uic-border-gray-300 es-uic-border-opacity-0 es-uic-text-sm es-uic-transition",
|
|
59
|
+
isOpen && "es-uic-border-opacity-100 es-uic-shadow-lg",
|
|
60
|
+
className
|
|
61
|
+
),
|
|
62
|
+
...other,
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsxs(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: classnames(
|
|
68
|
+
"es-uic-flex es-uic-h-10 es-uic-items-center es-uic-gap-1 es-uic-py-1 es-uic-transition-[padding-inline]",
|
|
69
|
+
isOpen && "es-uic-pl-2 es-uic-pr-1"
|
|
70
|
+
),
|
|
71
|
+
children: [
|
|
72
|
+
/* @__PURE__ */ jsx(
|
|
73
|
+
RichLabel,
|
|
74
|
+
{
|
|
75
|
+
icon,
|
|
76
|
+
label,
|
|
77
|
+
subtitle,
|
|
78
|
+
className: labelClassName,
|
|
79
|
+
as: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
80
|
+
fullWidth: true
|
|
81
|
+
}
|
|
82
|
+
),
|
|
83
|
+
actions && !keepActionsOnExpand && /* @__PURE__ */ jsx(
|
|
84
|
+
AnimatedVisibility,
|
|
85
|
+
{
|
|
86
|
+
visible: !isOpen,
|
|
87
|
+
className: "es-uic-ml-auto es-uic-flex es-uic-gap-2",
|
|
88
|
+
transition: "scaleFade",
|
|
89
|
+
noInitial: true,
|
|
90
|
+
children: actions
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
actions && keepActionsOnExpand && /* @__PURE__ */ jsx("div", { className: "es-uic-ml-auto es-uic-flex es-uic-gap-2", children: actions }),
|
|
94
|
+
/* @__PURE__ */ jsx(
|
|
95
|
+
Button,
|
|
96
|
+
{
|
|
97
|
+
type: "ghost",
|
|
98
|
+
icon: isOpen ? icons.caretDownFill : icons.caretDown,
|
|
99
|
+
onPress: () => {
|
|
100
|
+
setIsOpen(!isOpen);
|
|
101
|
+
if (onOpenChange) {
|
|
102
|
+
onOpenChange(!isOpen);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
tooltip: isOpen ? __("Close", "eightshift-ui-components") : __("Open", "eightshift-ui-components"),
|
|
106
|
+
disabled,
|
|
107
|
+
className: classnames(
|
|
108
|
+
"[&>svg]:es-uic-transition-transform",
|
|
109
|
+
isOpen && "[&>svg]:-es-uic-scale-y-100"
|
|
110
|
+
),
|
|
111
|
+
size: "small"
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
),
|
|
117
|
+
/* @__PURE__ */ jsx(
|
|
118
|
+
AnimatedVisibility,
|
|
119
|
+
{
|
|
120
|
+
visible: isOpen,
|
|
121
|
+
className: "es-uic-space-y-2.5 es-uic-border-t es-uic-p-2",
|
|
122
|
+
transition: "slideFade",
|
|
123
|
+
noInitial: true,
|
|
124
|
+
children
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
);
|
|
130
|
+
if (noFocusHandling) {
|
|
131
|
+
return component;
|
|
132
|
+
}
|
|
133
|
+
return /* @__PURE__ */ jsx(
|
|
134
|
+
$9bf71ea28793e738$export$20e40289641fbbb6,
|
|
135
|
+
{
|
|
136
|
+
contain: isOpen,
|
|
137
|
+
autoFocus: isOpen,
|
|
138
|
+
children: component
|
|
139
|
+
}
|
|
140
|
+
);
|
|
141
|
+
};
|
|
142
|
+
export {
|
|
143
|
+
Expandable
|
|
144
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { b as $2d73ec29415bd339$export$712718f7aec83d5, $ as $3985021b0ad6602f$export$37fb8590cf2c088c, a as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-jsbb4ugq.js";
|
|
3
|
+
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-BPzS-sR7.js";
|
|
4
|
+
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, i as $64fa3d84918910a7$export$ef03459518577ad4, j as $64fa3d84918910a7$export$2881499e37b75b9a } from "../../utils-BsiH7-5Y.js";
|
|
5
|
+
import React__default, { forwardRef, createContext, useRef, useState, useCallback } from "react";
|
|
6
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456 } from "../../focusSafely-C3K8zAKj.js";
|
|
7
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-Cc-4eouh.js";
|
|
8
|
+
import { $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-wtMA4667.js";
|
|
9
|
+
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
|
|
10
|
+
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-BM136LvS.js";
|
|
11
|
+
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-DG2RfOUr.js";
|
|
12
|
+
import { BaseControl } from "../base-control/base-control.js";
|
|
13
|
+
import { classnames } from "../../utilities/classnames.js";
|
|
14
|
+
const $216918bed6669f72$export$2dc6166a7e65358c = /* @__PURE__ */ createContext({});
|
|
15
|
+
let $216918bed6669f72$var$filterHoverProps = (props) => {
|
|
16
|
+
let { onHoverStart, onHoverChange, onHoverEnd, ...otherProps } = props;
|
|
17
|
+
return otherProps;
|
|
18
|
+
};
|
|
19
|
+
function $216918bed6669f72$var$TextArea(props, ref) {
|
|
20
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $216918bed6669f72$export$2dc6166a7e65358c);
|
|
21
|
+
let { hoverProps, isHovered } = $6179b936705e76d3$export$ae780daf29e6d456(props);
|
|
22
|
+
let { isFocused, isFocusVisible, focusProps } = $f7dceffc5ad7768b$export$4e328f61c538687f({
|
|
23
|
+
isTextInput: true,
|
|
24
|
+
autoFocus: props.autoFocus
|
|
25
|
+
});
|
|
26
|
+
let isInvalid = !!props["aria-invalid"] && props["aria-invalid"] !== "false";
|
|
27
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
28
|
+
...props,
|
|
29
|
+
values: {
|
|
30
|
+
isHovered,
|
|
31
|
+
isFocused,
|
|
32
|
+
isFocusVisible,
|
|
33
|
+
isDisabled: props.disabled || false,
|
|
34
|
+
isInvalid
|
|
35
|
+
},
|
|
36
|
+
defaultClassName: "react-aria-TextArea"
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ React__default.createElement("textarea", {
|
|
39
|
+
...$3ef42575df84b30b$export$9d1611c77c2fe928($216918bed6669f72$var$filterHoverProps(props), focusProps, hoverProps),
|
|
40
|
+
...renderProps,
|
|
41
|
+
ref,
|
|
42
|
+
"data-focused": isFocused || void 0,
|
|
43
|
+
"data-disabled": props.disabled || void 0,
|
|
44
|
+
"data-hovered": isHovered || void 0,
|
|
45
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
46
|
+
"data-invalid": isInvalid || void 0
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const $216918bed6669f72$export$f5c9f3c2c4054eec = /* @__PURE__ */ forwardRef($216918bed6669f72$var$TextArea);
|
|
50
|
+
const $bcdf0525bf22703d$export$2129e27b3ef0d483 = /* @__PURE__ */ createContext(null);
|
|
51
|
+
function $bcdf0525bf22703d$var$TextField(props, ref) {
|
|
52
|
+
[props, ref] = $64fa3d84918910a7$export$29f1550f4b0d4415(props, ref, $bcdf0525bf22703d$export$2129e27b3ef0d483);
|
|
53
|
+
let { validationBehavior: formValidationBehavior } = $64fa3d84918910a7$export$fabf2dc03a41866e($d3e0e05bdfcf66bd$export$c24727297075ec6a) || {};
|
|
54
|
+
var _props_validationBehavior, _ref;
|
|
55
|
+
let validationBehavior = (_ref = (_props_validationBehavior = props.validationBehavior) !== null && _props_validationBehavior !== void 0 ? _props_validationBehavior : formValidationBehavior) !== null && _ref !== void 0 ? _ref : "native";
|
|
56
|
+
let inputRef = useRef(null);
|
|
57
|
+
let [labelRef, label] = $64fa3d84918910a7$export$9d4c57ee4c6ffdd8();
|
|
58
|
+
let [inputElementType, setInputElementType] = useState("input");
|
|
59
|
+
let { labelProps, inputProps, descriptionProps, errorMessageProps, ...validation } = $2d73ec29415bd339$export$712718f7aec83d5({
|
|
60
|
+
...$64fa3d84918910a7$export$ef03459518577ad4(props),
|
|
61
|
+
inputElementType,
|
|
62
|
+
label,
|
|
63
|
+
validationBehavior
|
|
64
|
+
}, inputRef);
|
|
65
|
+
let inputOrTextAreaRef = useCallback((el) => {
|
|
66
|
+
inputRef.current = el;
|
|
67
|
+
if (el)
|
|
68
|
+
setInputElementType(el instanceof HTMLTextAreaElement ? "textarea" : "input");
|
|
69
|
+
}, []);
|
|
70
|
+
let renderProps = $64fa3d84918910a7$export$4d86445c2cf5e3({
|
|
71
|
+
...props,
|
|
72
|
+
values: {
|
|
73
|
+
isDisabled: props.isDisabled || false,
|
|
74
|
+
isInvalid: validation.isInvalid,
|
|
75
|
+
isReadOnly: props.isReadOnly || false,
|
|
76
|
+
isRequired: props.isRequired || false
|
|
77
|
+
},
|
|
78
|
+
defaultClassName: "react-aria-TextField"
|
|
79
|
+
});
|
|
80
|
+
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props);
|
|
81
|
+
delete DOMProps.id;
|
|
82
|
+
return /* @__PURE__ */ React__default.createElement("div", {
|
|
83
|
+
...DOMProps,
|
|
84
|
+
...renderProps,
|
|
85
|
+
ref,
|
|
86
|
+
slot: props.slot || void 0,
|
|
87
|
+
"data-disabled": props.isDisabled || void 0,
|
|
88
|
+
"data-invalid": validation.isInvalid || void 0,
|
|
89
|
+
"data-readonly": props.isReadOnly || void 0,
|
|
90
|
+
"data-required": props.isRequired || void 0
|
|
91
|
+
}, /* @__PURE__ */ React__default.createElement($64fa3d84918910a7$export$2881499e37b75b9a, {
|
|
92
|
+
values: [
|
|
93
|
+
[
|
|
94
|
+
$01b77f81d0f07f68$export$75b6ee27786ba447,
|
|
95
|
+
{
|
|
96
|
+
...labelProps,
|
|
97
|
+
ref: labelRef
|
|
98
|
+
}
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
$3985021b0ad6602f$export$37fb8590cf2c088c,
|
|
102
|
+
{
|
|
103
|
+
...inputProps,
|
|
104
|
+
ref: inputOrTextAreaRef
|
|
105
|
+
}
|
|
106
|
+
],
|
|
107
|
+
[
|
|
108
|
+
$216918bed6669f72$export$2dc6166a7e65358c,
|
|
109
|
+
{
|
|
110
|
+
...inputProps,
|
|
111
|
+
ref: inputOrTextAreaRef
|
|
112
|
+
}
|
|
113
|
+
],
|
|
114
|
+
[
|
|
115
|
+
$514c0188e459b4c0$export$9afb8bc826b033ea,
|
|
116
|
+
{
|
|
117
|
+
slots: {
|
|
118
|
+
description: descriptionProps,
|
|
119
|
+
errorMessage: errorMessageProps
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
],
|
|
123
|
+
[
|
|
124
|
+
$ee014567cb39d3f0$export$ff05c3ac10437e03,
|
|
125
|
+
validation
|
|
126
|
+
]
|
|
127
|
+
]
|
|
128
|
+
}, renderProps.children));
|
|
129
|
+
}
|
|
130
|
+
const $bcdf0525bf22703d$export$2c73285ae9390cec = /* @__PURE__ */ forwardRef($bcdf0525bf22703d$var$TextField);
|
|
131
|
+
/**
|
|
132
|
+
* An input field.
|
|
133
|
+
*
|
|
134
|
+
* @component
|
|
135
|
+
* @param {Object} props - Component props.
|
|
136
|
+
* @param {JSX.Element} [props.icon] - Icon to display in the label.
|
|
137
|
+
* @param {string} [props.label] - Label to display.
|
|
138
|
+
* @param {string} [props.subtitle] - Subtitle to display.
|
|
139
|
+
* @param {string} [props.help] - Help text to display below the input.
|
|
140
|
+
* @param {JSX.Element|JSX.Element[]} [props.actions] - Actions to display to the right of the label.
|
|
141
|
+
* @param {string} [props.value] - The current value of the input.
|
|
142
|
+
* @param {Function} [props.onChange] - Function to run when the input value changes.
|
|
143
|
+
* @param {InputType} [props.type='text'] - The input type. Renders a `<textarea>` instead of `<input>` if set to 'multiline'.
|
|
144
|
+
* @param {boolean} [props.disabled] - If `true`, the input is disabled.
|
|
145
|
+
* @param {boolean} [props.readOnly] - If `true`, the input is read-only.
|
|
146
|
+
* @param {string} [props.className] - Classes to pass to the input field.
|
|
147
|
+
*
|
|
148
|
+
* @returns {JSX.Element} The InputField component.
|
|
149
|
+
*
|
|
150
|
+
* @typedef {'text' | 'search' | 'url' | 'tel' | 'email' | 'password' | 'multiline'} InputType
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* <InputField
|
|
154
|
+
* label='My input'
|
|
155
|
+
* value={inputValue}
|
|
156
|
+
* onChange={setInputValue}
|
|
157
|
+
* />
|
|
158
|
+
*
|
|
159
|
+
* @preserve
|
|
160
|
+
*/
|
|
161
|
+
const InputField = (props) => {
|
|
162
|
+
const {
|
|
163
|
+
icon,
|
|
164
|
+
label,
|
|
165
|
+
subtitle,
|
|
166
|
+
help,
|
|
167
|
+
actions,
|
|
168
|
+
value,
|
|
169
|
+
onChange,
|
|
170
|
+
type = "text",
|
|
171
|
+
disabled,
|
|
172
|
+
readOnly,
|
|
173
|
+
className,
|
|
174
|
+
...other
|
|
175
|
+
} = props;
|
|
176
|
+
return /* @__PURE__ */ jsx(
|
|
177
|
+
$bcdf0525bf22703d$export$2c73285ae9390cec,
|
|
178
|
+
{
|
|
179
|
+
value: value ?? "",
|
|
180
|
+
onChange,
|
|
181
|
+
isDisabled: disabled,
|
|
182
|
+
isReadOnly: readOnly,
|
|
183
|
+
...other,
|
|
184
|
+
children: /* @__PURE__ */ jsxs(
|
|
185
|
+
BaseControl,
|
|
186
|
+
{
|
|
187
|
+
icon,
|
|
188
|
+
label,
|
|
189
|
+
subtitle,
|
|
190
|
+
actions,
|
|
191
|
+
labelAs: $01b77f81d0f07f68$export$b04be29aa201d4f5,
|
|
192
|
+
help,
|
|
193
|
+
children: [
|
|
194
|
+
type !== "multiline" && /* @__PURE__ */ jsx(
|
|
195
|
+
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
196
|
+
{
|
|
197
|
+
...other,
|
|
198
|
+
className: classnames(
|
|
199
|
+
"es-uic-min-h-10 es-uic-w-full es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-text-sm es-uic-shadow-sm es-uic-transition selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950",
|
|
200
|
+
"focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50",
|
|
201
|
+
className
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
type === "multiline" && /* @__PURE__ */ jsx(
|
|
206
|
+
$216918bed6669f72$export$f5c9f3c2c4054eec,
|
|
207
|
+
{
|
|
208
|
+
...other,
|
|
209
|
+
className: classnames(
|
|
210
|
+
"es-uic-min-h-10 es-uic-w-full es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-text-sm es-uic-shadow-sm es-uic-transition selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950",
|
|
211
|
+
"focus:es-uic-outline-none focus-visible:es-uic-outline-none focus-visible:es-uic-ring focus-visible:es-uic-ring-teal-500 focus-visible:es-uic-ring-opacity-50",
|
|
212
|
+
className
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
)
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
)
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
export {
|
|
223
|
+
InputField
|
|
224
|
+
};
|