@eightshift/ui-components 0.0.1 → 0.0.2
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 +0 -1
- package/dist/Button-eebLs4cp.js +54 -0
- package/dist/{Checkbox-BLcVbhiO.js → Checkbox-BN0TEda-.js} +7 -7
- package/dist/{ColorSwatch-Cmlex_kT.js → ColorSwatch-BrowHhTG.js} +4 -4
- package/dist/{FieldError-wtMA4667.js → FieldError-ILxgMZy5.js} +2 -2
- package/dist/{FocusScope-1u9yyfIN.js → FocusScope-B9b0VMib.js} +2 -2
- package/dist/GeistMonoVF.woff2 +0 -0
- package/dist/GeistVF.woff2 +0 -0
- package/dist/{GridList-BZPXp3_O.js → GridList-CzpWxJsS.js} +18 -18
- package/dist/{Group-DyqpTRPe.js → Group-Dkdm2-E7.js} +3 -3
- package/dist/{Input-jsbb4ugq.js → Input-BJA4rmIo.js} +7 -7
- package/dist/{Label-BPzS-sR7.js → Label-9x5iLJ-Y.js} +1 -1
- package/dist/{ListBox-w9gDaJkV.js → ListBox-D3Vr4vvC.js} +18 -18
- package/dist/{Select-49a62830.esm-C-RFtLiD.js → Select-49a62830.esm-CKPmlkza.js} +1 -1
- package/dist/{SelectionManager-mefd0ThJ.js → SelectionManager-sedvcM-1.js} +8 -8
- package/dist/{Separator-DHn0CwdK.js → Separator-B6rnDabE.js} +3 -3
- package/dist/{Slider-Pyh2V4bY.js → Slider-C5U5N7uM.js} +11 -11
- package/dist/{Text-BM136LvS.js → Text-Cyxp9ewv.js} +1 -1
- package/dist/{VisuallyHidden-BYRI1Lfo.js → VisuallyHidden-BPJVSUyp.js} +2 -2
- package/dist/_commonjsHelpers-DWwsNxpa.js +8 -0
- package/dist/assets/fonts.css +1 -0
- package/dist/assets/style.css +1 -1
- package/dist/assets/wp.css +1 -0
- package/dist/{button-BkkdyHfJ.js → button-idVI4jmd.js} +45 -64
- package/dist/components/base-control/base-control.js +29 -39
- package/dist/components/breakpoint-preview/breakpoint-preview.js +7 -7
- package/dist/components/button/button.js +6 -5
- package/dist/components/checkbox/checkbox.js +9 -7
- package/dist/components/color-pickers/color-picker.js +27 -36
- package/dist/components/color-pickers/color-swatch.js +6 -6
- package/dist/components/color-pickers/gradient-editor.js +10 -6
- package/dist/components/color-pickers/solid-color-picker.js +35 -38
- package/dist/components/component-toggle/component-toggle.js +52 -6
- package/dist/components/container-panel/container-panel.js +55 -6
- package/dist/components/draggable-list/draggable-list-item.js +74 -0
- package/dist/components/draggable-list/draggable-list.js +157 -0
- package/dist/components/expandable/expandable.js +19 -12
- package/dist/components/input-field/input-field.js +15 -10
- package/dist/components/layout/hstack.js +40 -0
- package/dist/components/layout/vstack.js +40 -0
- package/dist/components/link-input/link-input.js +35 -31
- package/dist/components/list-box/list-box.js +11 -6
- package/dist/components/matrix-align/matrix-align.js +12 -7
- package/dist/components/menu/menu.js +26 -21
- package/dist/components/notice/notice.js +11 -7
- package/dist/components/number-picker/number-picker.js +19 -13
- package/dist/components/option-select/option-select.js +231 -0
- package/dist/components/placeholders/file-placeholder.js +53 -0
- package/dist/components/placeholders/image-placeholder.js +88 -0
- package/dist/components/placeholders/media-placeholder.js +62 -0
- package/dist/components/popover/popover.js +4 -4
- package/dist/components/radio/radio.js +56 -38
- package/dist/components/repeater/repeater-item.js +46 -39
- package/dist/components/repeater/repeater.js +83 -56
- package/dist/components/responsive/responsive-legacy.js +17 -12
- package/dist/components/responsive/responsive.js +227 -160
- package/dist/components/responsive-preview/responsive-preview.js +5 -3
- package/dist/components/rich-label/rich-label.js +12 -8
- package/dist/components/select/async-multi-select.js +9 -6
- package/dist/components/select/async-single-select.js +7 -2
- package/dist/components/select/custom-select-default-components.js +3 -3
- package/dist/components/select/multi-select-components.js +2 -2
- package/dist/components/select/multi-select.js +9 -6
- package/dist/components/select/react-select-component-wrappers.js +1 -1
- package/dist/components/select/single-select.js +7 -2
- package/dist/components/select/styles.js +4 -4
- package/dist/components/slider/column-config-slider.js +18 -34
- package/dist/components/slider/slider.js +19 -26
- package/dist/components/slider/utils.js +44 -1
- package/dist/components/spacer/spacer.js +21 -11
- package/dist/components/tabs/tabs.js +21 -20
- package/dist/components/toggle/switch.js +18 -12
- package/dist/components/toggle/toggle.js +8 -2
- package/dist/components/toggle-button/toggle-button.js +25 -13
- package/dist/components/tooltip/tooltip.js +4 -4
- package/dist/{context-jMy6xdVq.js → context-BAcFg5GO.js} +1 -1
- package/dist/{default-i18n-BhE-OUmt.js → default-i18n-Bk1GxDHz.js} +1 -1
- package/dist/{focusSafely-C3K8zAKj.js → focusSafely-B0hyd-S4.js} +1 -1
- package/dist/fonts.js +1 -0
- package/dist/icons/icons.js +184 -164
- package/dist/icons/jsx-svg.js +4957 -0
- package/dist/{index-Bfb9bWcb.js → index-BDk0TPWz.js} +1 -1
- package/dist/{index-a301f526.esm-Bioi4cGX.js → index-a301f526.esm-BzTuHLdr.js} +1 -1
- package/dist/index.js +30 -4
- package/dist/{intlStrings-CUhoK9EN.js → intlStrings-Ctkp0HDc.js} +1 -1
- package/dist/lite-pbIeT7tm.js +8 -0
- package/dist/{multi-select-components-CjVpCNko.js → multi-select-components-nORKdJ-2.js} +3 -3
- package/dist/{popover-Dx3vKXUX.js → popover-o2Q28Ljn.js} +19 -14
- package/dist/{react-select-async.esm-TFb_ZX6C.js → react-select-async.esm-CLj9uZTq.js} +3 -3
- package/dist/{react-select.esm-BjRWqf0E.js → react-select.esm-3tyTZmrx.js} +3 -3
- package/dist/{textSelection-BosCCRVE.js → textSelection-BRZdHY-4.js} +1 -1
- package/dist/{tooltip-CkCndvTI.js → tooltip-T6H9uF-Z.js} +10 -10
- package/dist/{useButton-CuG5UzUw.js → useButton-D-xACzEY.js} +3 -3
- package/dist/{useEvent-DHv-yhOH.js → useEvent-XlYPKgwX.js} +1 -1
- package/dist/{useFocusRing-Cc-4eouh.js → useFocusRing-CRx_hYC4.js} +1 -1
- package/dist/{useFocusable-5q1Gek1J.js → useFocusable-CHfpEdlE.js} +2 -2
- package/dist/{useFormReset-Buc9YJcv.js → useFormReset-aHn6-wRk.js} +1 -1
- package/dist/{useFormValidationState-BAPPNXic.js → useFormValidationState-CdYmOaXI.js} +2 -2
- package/dist/{useHasTabbableChild-D3uUNhJ0.js → useHasTabbableChild-domoFB7A.js} +2 -2
- package/dist/{useLabel-CGlkoFG0.js → useLabel-DVhXVhtH.js} +2 -2
- package/dist/{useLabels-Dg62M_3P.js → useLabels-C7E5SkOi.js} +1 -1
- package/dist/{useListState-Domq0blV.js → useListState-BRsq7O1C.js} +1 -1
- package/dist/{useLocalizedStringFormatter-Prmz0h0A.js → useLocalizedStringFormatter-WsEL47qR.js} +1 -1
- package/dist/{useNumberFieldState-BLU3uhSR.js → useNumberFieldState-ZH2Qyyxh.js} +9 -9
- package/dist/{useNumberFormatter-BLc2xjZn.js → useNumberFormatter-mhdYLxWQ.js} +1 -1
- package/dist/{usePress-BQgVor4T.js → usePress-B42RawCH.js} +3 -3
- package/dist/{useToggle-C9ETOBaZ.js → useToggle-CExfZM8x.js} +4 -4
- package/dist/{useToggleState-DJ_z5E2S.js → useToggleState-DghG5ImG.js} +1 -1
- package/dist/utilities/array-helpers.js +30 -0
- package/dist/utilities/index.js +8 -0
- package/dist/utilities/text-helpers.js +30 -4
- package/dist/{utils-BsiH7-5Y.js → utils-DIBzm1e4.js} +1 -1
- package/dist/wp.js +1 -0
- package/package.json +11 -4
- package/dist/_commonjsHelpers-CUmg6egw.js +0 -6
- package/dist/utilities/classnames.js +0 -16
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../Text-
|
|
3
|
-
import {
|
|
2
|
+
import { $ as $514c0188e459b4c0$export$5f1af8db9871e1d6 } from "../../Text-Cyxp9ewv.js";
|
|
3
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
4
4
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
5
5
|
/**
|
|
6
6
|
* Component that allows wrapping components with a common layout that includes a label and optional icon, subtitle, actions, and help text.
|
|
@@ -17,6 +17,7 @@ import { RichLabel } from "../rich-label/rich-label.js";
|
|
|
17
17
|
* @param {string} [props.controlContainerClassName] - Classes to pass to the control container.
|
|
18
18
|
* @param {boolean} [props.fullWidthLabel] - If `true`, the label expands to fill up the whole width, instead of taking up only the space it needs.
|
|
19
19
|
* @param {JSX.Element} [props.labelAs] - If provided, the label (includes icon and subtitle) will be rendered as this element.
|
|
20
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
20
21
|
*
|
|
21
22
|
* @returns {JSX.Element} The BaseControl component.
|
|
22
23
|
*
|
|
@@ -39,53 +40,42 @@ const BaseControl = (props) => {
|
|
|
39
40
|
className,
|
|
40
41
|
controlContainerClassName,
|
|
41
42
|
fullWidthLabel,
|
|
42
|
-
labelAs
|
|
43
|
+
labelAs,
|
|
44
|
+
hidden
|
|
43
45
|
} = props;
|
|
44
|
-
if (!children) {
|
|
46
|
+
if (!children || hidden) {
|
|
45
47
|
return null;
|
|
46
48
|
}
|
|
47
49
|
if (!(label || icon || subtitle)) {
|
|
48
50
|
return children;
|
|
49
51
|
}
|
|
50
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
51
|
-
/* @__PURE__ */ jsxs(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
className: classnames(
|
|
73
|
-
"es-uic-ml-auto es-uic-flex es-uic-items-center es-uic-gap-1",
|
|
74
|
-
controlContainerClassName
|
|
75
|
-
),
|
|
76
|
-
children
|
|
77
|
-
}
|
|
78
|
-
),
|
|
79
|
-
!inline && actions && /* @__PURE__ */ jsx("div", { className: classnames("es-uic-flex es-uic-items-center es-uic-gap-1", !inline && "es-uic-ml-auto"), children: actions })
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
),
|
|
83
|
-
!inline && Array.isArray(children) && children.filter(Boolean).length > 1 && /* @__PURE__ */ jsx("div", { className: classnames("es-uic-space-y-1", controlContainerClassName), children }),
|
|
52
|
+
return /* @__PURE__ */ jsxs("div", { className: clsx("es-uic-space-y-1", className), children: [
|
|
53
|
+
/* @__PURE__ */ jsxs("div", { className: clsx("es-uic-flex es-uic-items-center es-uic-gap-1", !inline && !icon && "es-uic-pb-0.5"), children: [
|
|
54
|
+
(label || icon || subtitle) && /* @__PURE__ */ jsx(
|
|
55
|
+
RichLabel,
|
|
56
|
+
{
|
|
57
|
+
icon,
|
|
58
|
+
label,
|
|
59
|
+
subtitle,
|
|
60
|
+
fullWidth: fullWidthLabel,
|
|
61
|
+
as: labelAs
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
inline && /* @__PURE__ */ jsx(
|
|
65
|
+
"div",
|
|
66
|
+
{
|
|
67
|
+
className: clsx("es-uic-ml-auto es-uic-flex es-uic-items-center es-uic-gap-1", controlContainerClassName),
|
|
68
|
+
children
|
|
69
|
+
}
|
|
70
|
+
),
|
|
71
|
+
!inline && actions && /* @__PURE__ */ jsx("div", { className: clsx("es-uic-flex es-uic-items-center es-uic-gap-1", !inline && "es-uic-ml-auto"), children: actions })
|
|
72
|
+
] }),
|
|
73
|
+
!inline && Array.isArray(children) && children.filter(Boolean).length > 1 && /* @__PURE__ */ jsx("div", { className: clsx("es-uic-space-y-1", controlContainerClassName), children }),
|
|
84
74
|
!inline && (!Array.isArray(children) || children.filter(Boolean).length < 2) && children,
|
|
85
75
|
help && /* @__PURE__ */ jsx(
|
|
86
76
|
$514c0188e459b4c0$export$5f1af8db9871e1d6,
|
|
87
77
|
{
|
|
88
|
-
className: "es-uic-text-sm es-uic-text-gray-400",
|
|
78
|
+
className: "es-uic-inline-block es-uic-text-sm es-uic-text-gray-400",
|
|
89
79
|
slot: "description",
|
|
90
80
|
children: help
|
|
91
81
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment as Fragment$1 } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
4
4
|
import { upperFirst } from "../../utilities/text-helpers.js";
|
|
5
5
|
/**
|
|
6
6
|
* Component that renders a preview of the breakpoints to help users visualize the options they set.
|
|
@@ -101,7 +101,7 @@ const BreakpointPreview = (props) => {
|
|
|
101
101
|
return /* @__PURE__ */ jsxs(
|
|
102
102
|
"div",
|
|
103
103
|
{
|
|
104
|
-
className:
|
|
104
|
+
className: clsx(
|
|
105
105
|
"es-uic-grid es-uic-w-fit es-uic-mx-auto es-uic-shrink-0 es-uic-auto-cols-auto es-uic-grid-rows-[auto,_auto] es-uic-gap-x-2 es-uic-gap-y-0.5"
|
|
106
106
|
),
|
|
107
107
|
children: [
|
|
@@ -133,7 +133,7 @@ const BreakpointPreview = (props) => {
|
|
|
133
133
|
dotsStart2 && /* @__PURE__ */ jsxs(
|
|
134
134
|
"div",
|
|
135
135
|
{
|
|
136
|
-
className:
|
|
136
|
+
className: clsx(
|
|
137
137
|
"es-uic-flex es-uic-gap-0.5",
|
|
138
138
|
active ? activeTextColor : "text-gray-300"
|
|
139
139
|
),
|
|
@@ -148,7 +148,7 @@ const BreakpointPreview = (props) => {
|
|
|
148
148
|
/* @__PURE__ */ jsx(
|
|
149
149
|
"div",
|
|
150
150
|
{
|
|
151
|
-
className:
|
|
151
|
+
className: clsx(
|
|
152
152
|
"es-uic-grow es-uic-rounded",
|
|
153
153
|
active ? "es-uic-h-0.5" : "es-uic-h-px es-uic-bg-gray-300",
|
|
154
154
|
active && activeBgColor
|
|
@@ -159,7 +159,7 @@ const BreakpointPreview = (props) => {
|
|
|
159
159
|
dotsEnd2 && /* @__PURE__ */ jsxs(
|
|
160
160
|
"div",
|
|
161
161
|
{
|
|
162
|
-
className:
|
|
162
|
+
className: clsx(
|
|
163
163
|
"es-uic-flex es-uic-gap-0.5",
|
|
164
164
|
active ? activeTextColor : "es-uic-text-gray-300"
|
|
165
165
|
),
|
|
@@ -175,7 +175,7 @@ const BreakpointPreview = (props) => {
|
|
|
175
175
|
/* @__PURE__ */ jsx(
|
|
176
176
|
"span",
|
|
177
177
|
{
|
|
178
|
-
className:
|
|
178
|
+
className: clsx(
|
|
179
179
|
"es-uic-rounded es-uic-px-1 es-uic-py-0.5",
|
|
180
180
|
hasActive && active && "es-uic-text-white",
|
|
181
181
|
hasActive && active && activeBgColor,
|
|
@@ -189,7 +189,7 @@ const BreakpointPreview = (props) => {
|
|
|
189
189
|
value && /* @__PURE__ */ jsx(
|
|
190
190
|
"span",
|
|
191
191
|
{
|
|
192
|
-
className:
|
|
192
|
+
className: clsx(
|
|
193
193
|
"-es-uic-mt-0.5 es-uic-px-1",
|
|
194
194
|
active ? "es-uic-text-gray-400" : "es-uic-text-gray-400",
|
|
195
195
|
alignEnd && "es-uic-ml-auto"
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import "../../
|
|
4
|
-
import "../../
|
|
5
|
-
import "../../
|
|
6
|
-
import "../../
|
|
2
|
+
import "../../Button-eebLs4cp.js";
|
|
3
|
+
import { B, a } from "../../button-idVI4jmd.js";
|
|
4
|
+
import "../../lite-pbIeT7tm.js";
|
|
5
|
+
import "../../tooltip-T6H9uF-Z.js";
|
|
6
|
+
import "../../default-i18n-Bk1GxDHz.js";
|
|
7
|
+
import "../../utils-DIBzm1e4.js";
|
|
7
8
|
export {
|
|
8
9
|
B as Button,
|
|
9
10
|
a as ButtonGroup
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { $ as $bc237834342dbd75$export$48513f6b9f8ce62d } from "../../Checkbox-
|
|
3
|
-
import {
|
|
2
|
+
import { $ as $bc237834342dbd75$export$48513f6b9f8ce62d } from "../../Checkbox-BN0TEda-.js";
|
|
3
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
4
4
|
import { AnimatedVisibility } from "../animated-visibility/animated-visibility.js";
|
|
5
5
|
import { icons } from "../../icons/icons.js";
|
|
6
6
|
import { RichLabel } from "../rich-label/rich-label.js";
|
|
@@ -20,6 +20,7 @@ import { RichLabel } from "../rich-label/rich-label.js";
|
|
|
20
20
|
* @param {string} [props.className] - Additional classes to add to the checkbox container.
|
|
21
21
|
* @param {string} [props.labelClassName] - Additional classes to add to the label container.
|
|
22
22
|
* @param {boolean} [props.alignEnd] - Whether the label should be aligned to the end.
|
|
23
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
23
24
|
*
|
|
24
25
|
* @returns {JSX.Element} The Checkbox component.
|
|
25
26
|
*
|
|
@@ -46,8 +47,12 @@ const Checkbox = (props) => {
|
|
|
46
47
|
labelClassName,
|
|
47
48
|
alignEnd,
|
|
48
49
|
children,
|
|
50
|
+
hidden,
|
|
49
51
|
...other
|
|
50
52
|
} = props;
|
|
53
|
+
if (hidden) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
51
56
|
return /* @__PURE__ */ jsx(
|
|
52
57
|
$bc237834342dbd75$export$48513f6b9f8ce62d,
|
|
53
58
|
{
|
|
@@ -56,10 +61,7 @@ const Checkbox = (props) => {
|
|
|
56
61
|
isReadOnly: readOnly,
|
|
57
62
|
isSelected: checked ?? false,
|
|
58
63
|
onChange,
|
|
59
|
-
className:
|
|
60
|
-
"es-uic-flex es-uic-w-full es-uic-items-center es-uic-gap-1.5 es-uic-text-sm",
|
|
61
|
-
className
|
|
62
|
-
),
|
|
64
|
+
className: clsx("es-uic-flex es-uic-w-full es-uic-items-center es-uic-gap-1.5 es-uic-text-sm", className),
|
|
63
65
|
...other,
|
|
64
66
|
children: ({ isIndeterminate, isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
65
67
|
(icon || alignEnd) && (label || subtitle) && /* @__PURE__ */ jsx(
|
|
@@ -75,7 +77,7 @@ const Checkbox = (props) => {
|
|
|
75
77
|
/* @__PURE__ */ jsxs(
|
|
76
78
|
"div",
|
|
77
79
|
{
|
|
78
|
-
className:
|
|
80
|
+
className: clsx(
|
|
79
81
|
"es-uic-flex es-uic-size-5 es-uic-items-center es-uic-justify-center es-uic-rounded-md es-uic-border es-uic-text-gray-600 es-uic-shadow-sm es-uic-transition",
|
|
80
82
|
isSelected ? "es-uic-border-teal-600 es-uic-bg-teal-600 es-uic-text-white" : "es-uic-border-gray-300"
|
|
81
83
|
),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { _ as __ } from "../../default-i18n-
|
|
2
|
+
import { _ as __ } from "../../default-i18n-Bk1GxDHz.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";
|
|
6
6
|
import { BaseControl } from "../base-control/base-control.js";
|
|
7
|
-
import {
|
|
7
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
8
8
|
import { icons } from "../../icons/icons.js";
|
|
9
9
|
/**
|
|
10
10
|
* Color picker.
|
|
@@ -14,7 +14,7 @@ import { icons } from "../../icons/icons.js";
|
|
|
14
14
|
* @param {string} [props.icon] - Icon to display.
|
|
15
15
|
* @param {string} [props.label] - Label to display.
|
|
16
16
|
* @param {string} [props.subtitle] - Subtitle to display.
|
|
17
|
-
* @param {string} [props.labelClassName] - Additional
|
|
17
|
+
* @param {string} [props.labelClassName] - Additional clsx passed to the label.
|
|
18
18
|
* @param {string} props.value - Selected value.
|
|
19
19
|
* @param {Function} props.onChange - Function to run when the value changes.
|
|
20
20
|
* @param {Object[]} props.colors - Colors to display.
|
|
@@ -25,10 +25,12 @@ import { icons } from "../../icons/icons.js";
|
|
|
25
25
|
* @param {boolean} [props.noColorGroups] - If `true`, colors won't be grouped by shades.
|
|
26
26
|
* @param {ColorPickerType} props.type - Type of the color picker. Affects the icon and tooltip.
|
|
27
27
|
* @param {boolean} [props.clearable] - If `true`, the color can be deselected.
|
|
28
|
+
* @param {boolean} [props.stacked] - If `true`, the control is not rendered inline.
|
|
29
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
28
30
|
*
|
|
29
31
|
* @returns {JSX.Element} The ColorPicker component.
|
|
30
32
|
*
|
|
31
|
-
* @typedef {'default' | 'fillColor' | 'textColor' | 'textHighlightColor'} ColorPickerType
|
|
33
|
+
* @typedef {'default' | 'fillColor' | 'textColor' | 'textHighlightColor' | 'listMarkerColor'} ColorPickerType
|
|
32
34
|
*
|
|
33
35
|
* @example
|
|
34
36
|
* <ColorPicker
|
|
@@ -59,9 +61,14 @@ const ColorPicker = (props) => {
|
|
|
59
61
|
showColorCode,
|
|
60
62
|
noColorGroups,
|
|
61
63
|
type = "default",
|
|
64
|
+
stacked,
|
|
62
65
|
clearable,
|
|
66
|
+
hidden,
|
|
63
67
|
...rest
|
|
64
68
|
} = props;
|
|
69
|
+
if (hidden) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
65
72
|
const currentColor = (_a = colors == null ? void 0 : colors.find(({ slug }) => slug === value)) == null ? void 0 : _a.color;
|
|
66
73
|
const colorSuffixRegex = /(?!^.+)(-?(?:50|100|200|300|400|500|600|700|800|900|950|10|20|30|40|50|60|70|80|90){1})$/gi;
|
|
67
74
|
const hasColorGroups = !noColorGroups && (colors == null ? void 0 : colors.some(({ slug }) => colorSuffixRegex.test(slug)));
|
|
@@ -130,14 +137,21 @@ const ColorPicker = (props) => {
|
|
|
130
137
|
}
|
|
131
138
|
);
|
|
132
139
|
let tooltipText;
|
|
133
|
-
|
|
140
|
+
let menuTriggerIcon;
|
|
141
|
+
if (type === "default") {
|
|
134
142
|
tooltipText = __("Color", "eightshift-ui-components");
|
|
135
|
-
} else if (
|
|
143
|
+
} else if (type === "fillColor") {
|
|
136
144
|
tooltipText = __("Fill color", "eightshift-ui-components");
|
|
137
|
-
|
|
145
|
+
menuTriggerIcon = icons.colorPickerFill;
|
|
146
|
+
} else if (type === "textColor") {
|
|
138
147
|
tooltipText = __("Text color", "eightshift-ui-components");
|
|
139
|
-
|
|
148
|
+
menuTriggerIcon = icons.colorPickerText;
|
|
149
|
+
} else if (type === "textHighlightColor") {
|
|
140
150
|
tooltipText = __("Text highlight color", "eightshift-ui-components");
|
|
151
|
+
menuTriggerIcon = icons.colorPickerTextHighlight;
|
|
152
|
+
} else if (type === "listMarkerColor") {
|
|
153
|
+
tooltipText = __("List marker color", "eightshift-ui-components");
|
|
154
|
+
menuTriggerIcon = icons.colorPickerListMarker;
|
|
141
155
|
}
|
|
142
156
|
return /* @__PURE__ */ jsx(
|
|
143
157
|
BaseControl,
|
|
@@ -145,8 +159,8 @@ const ColorPicker = (props) => {
|
|
|
145
159
|
icon,
|
|
146
160
|
label,
|
|
147
161
|
subtitle,
|
|
148
|
-
className:
|
|
149
|
-
inline:
|
|
162
|
+
className: clsx("es-uic-w-full", labelClassName),
|
|
163
|
+
inline: !stacked,
|
|
150
164
|
children: /* @__PURE__ */ jsxs(
|
|
151
165
|
Menu,
|
|
152
166
|
{
|
|
@@ -158,28 +172,8 @@ const ColorPicker = (props) => {
|
|
|
158
172
|
className: "!es-uic-size-6 !es-uic-shadow-none"
|
|
159
173
|
}
|
|
160
174
|
),
|
|
161
|
-
!icon && type
|
|
162
|
-
|
|
163
|
-
/* @__PURE__ */ jsx(
|
|
164
|
-
ColorSwatch,
|
|
165
|
-
{
|
|
166
|
-
color: currentColor,
|
|
167
|
-
className: "es-uic-absolute -es-uic-bottom-0.5 es-uic-left-0 !es-uic-h-2 !es-uic-shadow-none"
|
|
168
|
-
}
|
|
169
|
-
)
|
|
170
|
-
] }),
|
|
171
|
-
!icon && type === "textColor" && /* @__PURE__ */ jsxs("div", { className: "es-uic-relative es-uic-size-6 [&>svg]:es-uic-absolute [&>svg]:-es-uic-top-[0.25rem] [&>svg]:es-uic-left-0 [&>svg]:es-uic-size-6", children: [
|
|
172
|
-
icons.textAbc,
|
|
173
|
-
/* @__PURE__ */ jsx(
|
|
174
|
-
ColorSwatch,
|
|
175
|
-
{
|
|
176
|
-
color: currentColor,
|
|
177
|
-
className: "es-uic-absolute -es-uic-bottom-0.5 es-uic-left-0 !es-uic-h-2 !es-uic-shadow-none"
|
|
178
|
-
}
|
|
179
|
-
)
|
|
180
|
-
] }),
|
|
181
|
-
!icon && type === "textHighlightColor" && /* @__PURE__ */ jsxs("div", { className: "es-uic-relative es-uic-size-6 [&>svg]:es-uic-absolute [&>svg]:-es-uic-top-[0.325rem] [&>svg]:es-uic-left-0 [&>svg]:es-uic-size-6", children: [
|
|
182
|
-
icons.titleGeneric,
|
|
175
|
+
!icon && type !== "default" && /* @__PURE__ */ jsxs("div", { className: "es-uic-relative es-uic-size-6 [&>svg]:es-uic-absolute [&>svg]:es-uic-inset-0 [&>svg]:es-uic-size-full", children: [
|
|
176
|
+
menuTriggerIcon,
|
|
183
177
|
/* @__PURE__ */ jsx(
|
|
184
178
|
ColorSwatch,
|
|
185
179
|
{
|
|
@@ -190,10 +184,7 @@ const ColorPicker = (props) => {
|
|
|
190
184
|
] })
|
|
191
185
|
] }),
|
|
192
186
|
keepOpen: true,
|
|
193
|
-
|
|
194
|
-
tooltip: tooltipText,
|
|
195
|
-
...rest.triggerProps
|
|
196
|
-
},
|
|
187
|
+
tooltip: !label && tooltipText,
|
|
197
188
|
...rest,
|
|
198
189
|
children: [
|
|
199
190
|
(noColorGroups || !hasColorGroups) && colors.map((color) => /* @__PURE__ */ jsx(
|
|
@@ -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-
|
|
4
|
-
import {
|
|
5
|
-
import { _ as __ } from "../../default-i18n-
|
|
2
|
+
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-BrowHhTG.js";
|
|
3
|
+
import { $ as $799cddbef784668f$export$6e865ea70d7724f } from "../../intlStrings-Ctkp0HDc.js";
|
|
4
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
5
|
+
import { _ as __ } from "../../default-i18n-Bk1GxDHz.js";
|
|
6
6
|
/**
|
|
7
7
|
* A simple color/gradient swatch.
|
|
8
8
|
*
|
|
@@ -10,7 +10,7 @@ import { _ as __ } from "../../default-i18n-BhE-OUmt.js";
|
|
|
10
10
|
* @param {Object} props - Component props.
|
|
11
11
|
* @param {string} [props.color] - The color to display.
|
|
12
12
|
* @param {string} [props.gradient] - The gradient to display.
|
|
13
|
-
* @param {string} [props.className] - Additional
|
|
13
|
+
* @param {string} [props.className] - Additional clsx to apply.
|
|
14
14
|
* @param {string} [props.colorName] - The name of the color. Should be auto-generated for colors.
|
|
15
15
|
*
|
|
16
16
|
* @returns {JSX.Element} The ColorSwatch component.
|
|
@@ -46,7 +46,7 @@ const ColorSwatch = (props) => {
|
|
|
46
46
|
style: {
|
|
47
47
|
background: (color || gradient) && backgroundGradient
|
|
48
48
|
},
|
|
49
|
-
className: () =>
|
|
49
|
+
className: () => clsx(
|
|
50
50
|
"es-uic-size-6 es-uic-rounded es-uic-border es-uic-border-gray-300 es-uic-shadow-sm",
|
|
51
51
|
!color && !gradient && "es-uic-bg-white",
|
|
52
52
|
className
|
|
@@ -1,7 +1,7 @@
|
|
|
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-Bk1GxDHz.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { a as ButtonGroup } from "../../button-
|
|
4
|
+
import { a as ButtonGroup } from "../../button-idVI4jmd.js";
|
|
5
5
|
import { ToggleButton } from "../toggle-button/toggle-button.js";
|
|
6
6
|
import { Repeater } from "../repeater/repeater.js";
|
|
7
7
|
import { RepeaterItem } from "../repeater/repeater-item.js";
|
|
@@ -9,13 +9,13 @@ import { icons } from "../../icons/icons.js";
|
|
|
9
9
|
import { SolidColorPicker } from "./solid-color-picker.js";
|
|
10
10
|
import { Slider } from "../slider/slider.js";
|
|
11
11
|
import { NumberPicker } from "../number-picker/number-picker.js";
|
|
12
|
-
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-
|
|
12
|
+
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../ColorSwatch-BrowHhTG.js";
|
|
13
13
|
import { Menu, MenuItem } from "../menu/menu.js";
|
|
14
14
|
import { BaseControl } from "../base-control/base-control.js";
|
|
15
15
|
import { MatrixAlign } from "../matrix-align/matrix-align.js";
|
|
16
16
|
import { Spacer } from "../spacer/spacer.js";
|
|
17
17
|
import { Toggle } from "../toggle/toggle.js";
|
|
18
|
-
import {
|
|
18
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
19
19
|
function c(e, o = ",") {
|
|
20
20
|
let t = [], n = 0, i = 0;
|
|
21
21
|
o = new RegExp(o);
|
|
@@ -200,6 +200,7 @@ const linearDirections = [
|
|
|
200
200
|
* @param {Object} props - Component props.
|
|
201
201
|
* @param {string} props.value - The gradient definition.
|
|
202
202
|
* @param {Function} props.onChange - Function to run when the gradient changes.
|
|
203
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
203
204
|
*
|
|
204
205
|
* @returns {JSX.Element} The GradientEditor component.
|
|
205
206
|
*
|
|
@@ -213,7 +214,7 @@ const linearDirections = [
|
|
|
213
214
|
*/
|
|
214
215
|
const GradientEditor = (props) => {
|
|
215
216
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
216
|
-
const { value, onChange } = props;
|
|
217
|
+
const { value, onChange, hidden } = props;
|
|
217
218
|
const gradientData = useMemo(() => {
|
|
218
219
|
if ((value == null ? void 0 : value.startsWith("radial-gradient")) || (value == null ? void 0 : value.startsWith("repeating-radial-gradient"))) {
|
|
219
220
|
return K(value ?? "");
|
|
@@ -239,6 +240,9 @@ const GradientEditor = (props) => {
|
|
|
239
240
|
() => getGradientResult(gradientData, gradientType),
|
|
240
241
|
[gradientData, gradientType]
|
|
241
242
|
);
|
|
243
|
+
if (hidden) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
242
246
|
return /* @__PURE__ */ jsxs("div", { className: "es-uic-w-full es-uic-space-y-2.5", children: [
|
|
243
247
|
/* @__PURE__ */ jsx(
|
|
244
248
|
"div",
|
|
@@ -295,7 +299,7 @@ const GradientEditor = (props) => {
|
|
|
295
299
|
return /* @__PURE__ */ jsx(
|
|
296
300
|
MenuItem,
|
|
297
301
|
{
|
|
298
|
-
icon: /* @__PURE__ */ jsx("div", { className:
|
|
302
|
+
icon: /* @__PURE__ */ jsx("div", { className: clsx("es-uic-size-5 es-uic-from-gray-700 es-uic-to-gray-200 es-uic-rounded-sm", iconClass) }),
|
|
299
303
|
onClick: () => {
|
|
300
304
|
setGradientData({
|
|
301
305
|
...gradientData,
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { forwardRef, useContext, createContext, useMemo, useRef, useState, useCallback } from "react";
|
|
3
3
|
import { a as $4e85f108e88277b8$export$ebe63fadcdce34ed, b as $4e85f108e88277b8$export$44644b8a16031b5b, c as $4e85f108e88277b8$export$717b2c0a523a0b53 } from "../../RSPContexts-CrNYmadY.js";
|
|
4
|
-
import { c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, j as $64fa3d84918910a7$export$2881499e37b75b9a, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, i as $64fa3d84918910a7$export$ef03459518577ad4 } from "../../utils-
|
|
4
|
+
import { c as $64fa3d84918910a7$export$4d86445c2cf5e3, d as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, j as $64fa3d84918910a7$export$2881499e37b75b9a, h as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, i as $64fa3d84918910a7$export$ef03459518577ad4 } from "../../utils-DIBzm1e4.js";
|
|
5
5
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-DG2RfOUr.js";
|
|
6
|
-
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-
|
|
7
|
-
import { $ as $6179b936705e76d3$export$ae780daf29e6d456, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, m as $7215afc6de606d6b$export$de79e2c695e052f3, d as $9ab94262bd0047c7$export$420e68273165f4ec, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, j as $c87311424ea30a05$export$fedb369cb70207f1, u as $c87311424ea30a05$export$a11b0059900ceec8 } from "../../focusSafely-
|
|
8
|
-
import { $ as $799cddbef784668f$export$6e865ea70d7724f, b as $799cddbef784668f$export$4cde5df63f53f473, a as $3493a52097159720$exports } from "../../intlStrings-
|
|
6
|
+
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-CRx_hYC4.js";
|
|
7
|
+
import { $ as $6179b936705e76d3$export$ae780daf29e6d456, e as $458b0a5536c1a7cf$export$40bfa8c7b0832715, m as $7215afc6de606d6b$export$de79e2c695e052f3, d as $9ab94262bd0047c7$export$420e68273165f4ec, c as $a1ea59d68270f0dd$export$f8168d8dd8fd66e6, j as $c87311424ea30a05$export$fedb369cb70207f1, u as $c87311424ea30a05$export$a11b0059900ceec8 } from "../../focusSafely-B0hyd-S4.js";
|
|
8
|
+
import { $ as $799cddbef784668f$export$6e865ea70d7724f, b as $799cddbef784668f$export$4cde5df63f53f473, a as $3493a52097159720$exports } from "../../intlStrings-Ctkp0HDc.js";
|
|
9
9
|
import { a as $9446cca9a3875146$export$cb6e0bb50bc19463, $ as $9446cca9a3875146$export$7d15b64cf5a3a4c4 } from "../../number-rWqELA8W.js";
|
|
10
|
-
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "../../textSelection-
|
|
11
|
-
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-
|
|
12
|
-
import { $ as $99facab73266f662$export$5add1d006293d136 } from "../../useFormReset-
|
|
13
|
-
import { a as $46d819fcbaf35654$export$8f71654801c2f7cd } from "../../useFocusable-
|
|
14
|
-
import { e as $28f99e3e86e6ec45$export$e5fda3247f5d67f9, f as $e8a7022cf87cba2a$export$36da96379f79f245, g as $bcca50147b47f54d$export$56b2c08e277f365, h as $47b897dc8cdb026b$export$8d15029008292ae, d as $6f909507e6374d18$export$1e7083018727fa60, i as $6f909507e6374d18$export$f1fce0420cc6d8ee, j as $6f909507e6374d18$export$6189c2744041d8f8, a as $6f909507e6374d18$export$105594979f116971 } from "../../Slider-
|
|
15
|
-
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-
|
|
16
|
-
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "../../useLocalizedStringFormatter-
|
|
17
|
-
import { a as $5c3e21d68f1c4674$export$a966af930f325cab } from "../../VisuallyHidden-
|
|
18
|
-
import { $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-
|
|
19
|
-
import { $ as $3985021b0ad6602f$export$37fb8590cf2c088c, a as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-
|
|
20
|
-
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-
|
|
21
|
-
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-
|
|
22
|
-
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "../../useFormValidationState-
|
|
23
|
-
import { $ as $de67e98908f0c6ee$export$7f629e9dc1ecf37c, b as $d2e8511e6f209edf$export$e908e06f4b8e3402, c as $7d0a636d7a4dcefd$export$2123ff2b87c81ca, d as $d841c8010a73d545$export$4f384c9210e583c3, a as $81397a9303501bda$export$23f548e970bdf099 } from "../../useNumberFieldState-
|
|
24
|
-
import {
|
|
10
|
+
import { $ as $03deb23ff14920c4$export$4eaf04e54aa8eed6 } from "../../textSelection-BRZdHY-4.js";
|
|
11
|
+
import { $ as $313b98861ee5dd6c$export$d6875122194c7b44 } from "../../useLabels-C7E5SkOi.js";
|
|
12
|
+
import { $ as $99facab73266f662$export$5add1d006293d136 } from "../../useFormReset-aHn6-wRk.js";
|
|
13
|
+
import { a as $46d819fcbaf35654$export$8f71654801c2f7cd } from "../../useFocusable-CHfpEdlE.js";
|
|
14
|
+
import { e as $28f99e3e86e6ec45$export$e5fda3247f5d67f9, f as $e8a7022cf87cba2a$export$36da96379f79f245, g as $bcca50147b47f54d$export$56b2c08e277f365, h as $47b897dc8cdb026b$export$8d15029008292ae, d as $6f909507e6374d18$export$1e7083018727fa60, i as $6f909507e6374d18$export$f1fce0420cc6d8ee, j as $6f909507e6374d18$export$6189c2744041d8f8, a as $6f909507e6374d18$export$105594979f116971 } from "../../Slider-C5U5N7uM.js";
|
|
15
|
+
import { $ as $18f2051aff69b9bf$export$43bb16f9c6d9e3f7 } from "../../context-BAcFg5GO.js";
|
|
16
|
+
import { $ as $fca6afa0e843324b$export$f12b703ca79dfbb1 } from "../../useLocalizedStringFormatter-WsEL47qR.js";
|
|
17
|
+
import { a as $5c3e21d68f1c4674$export$a966af930f325cab } from "../../VisuallyHidden-BPJVSUyp.js";
|
|
18
|
+
import { $ as $ee014567cb39d3f0$export$ff05c3ac10437e03 } from "../../FieldError-ILxgMZy5.js";
|
|
19
|
+
import { $ as $3985021b0ad6602f$export$37fb8590cf2c088c, a as $3985021b0ad6602f$export$f5b8910cec6cf069 } from "../../Input-BJA4rmIo.js";
|
|
20
|
+
import { a as $01b77f81d0f07f68$export$75b6ee27786ba447, $ as $01b77f81d0f07f68$export$b04be29aa201d4f5 } from "../../Label-9x5iLJ-Y.js";
|
|
21
|
+
import { a as $514c0188e459b4c0$export$9afb8bc826b033ea } from "../../Text-Cyxp9ewv.js";
|
|
22
|
+
import { $ as $e5be200c675c3b3a$export$fc1a364ae1f3ff10, c as $e5be200c675c3b3a$export$a763b9476acd3eb } from "../../useFormValidationState-CdYmOaXI.js";
|
|
23
|
+
import { $ as $de67e98908f0c6ee$export$7f629e9dc1ecf37c, b as $d2e8511e6f209edf$export$e908e06f4b8e3402, c as $7d0a636d7a4dcefd$export$2123ff2b87c81ca, d as $d841c8010a73d545$export$4f384c9210e583c3, a as $81397a9303501bda$export$23f548e970bdf099 } from "../../useNumberFieldState-ZH2Qyyxh.js";
|
|
24
|
+
import { c as clsx } from "../../lite-pbIeT7tm.js";
|
|
25
25
|
import { BaseControl } from "../base-control/base-control.js";
|
|
26
|
-
import { _ as __ } from "../../default-i18n-
|
|
27
|
-
import { T as TriggeredPopover } from "../../popover-
|
|
26
|
+
import { _ as __ } from "../../default-i18n-Bk1GxDHz.js";
|
|
27
|
+
import { T as TriggeredPopover } from "../../popover-o2Q28Ljn.js";
|
|
28
28
|
import { icons } from "../../icons/icons.js";
|
|
29
29
|
import { Spacer } from "../spacer/spacer.js";
|
|
30
30
|
const $e2b71ec1d6016406$export$c80c0ea2ca5cb846 = /* @__PURE__ */ createContext(null);
|
|
@@ -1294,6 +1294,7 @@ const $1cca5300a3c2e7f9$export$44fd664bcca5b6fb = /* @__PURE__ */ forwardRef($1c
|
|
|
1294
1294
|
* @param {Function} [props.onChangeEnd] - The change end handler.
|
|
1295
1295
|
* @param {boolean} [props.allowTransparency=false] - Whether the color picker allows transparency.
|
|
1296
1296
|
* @param {import('react-aria-components').ColorFormat} [props.outputFormat] - The output format. Default is 'hex' (or 'hexa' if `allowTransparency` is true).
|
|
1297
|
+
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
1297
1298
|
*
|
|
1298
1299
|
* @returns {JSX.Element} The ButtonGroup component.
|
|
1299
1300
|
*
|
|
@@ -1303,18 +1304,14 @@ const $1cca5300a3c2e7f9$export$44fd664bcca5b6fb = /* @__PURE__ */ forwardRef($1c
|
|
|
1303
1304
|
* @preserve
|
|
1304
1305
|
*/
|
|
1305
1306
|
const SolidColorPicker = (props) => {
|
|
1306
|
-
const {
|
|
1307
|
-
value: rawValue,
|
|
1308
|
-
onChange,
|
|
1309
|
-
disabled,
|
|
1310
|
-
onChangeEnd,
|
|
1311
|
-
allowTransparency = false,
|
|
1312
|
-
outputFormat
|
|
1313
|
-
} = props;
|
|
1307
|
+
const { value: rawValue, onChange, disabled, onChangeEnd, allowTransparency = false, outputFormat, hidden } = props;
|
|
1314
1308
|
const value = rawValue == null ? void 0 : rawValue.replace("transparent", "rgba(0, 0, 0, 0)");
|
|
1315
1309
|
const defaultColor = $799cddbef784668f$export$6e865ea70d7724f("#00000000").toFormat(allowTransparency ? "hsla" : "hsl");
|
|
1316
1310
|
const modifiedValue = value && (value == null ? void 0 : value.length) > 1 ? $799cddbef784668f$export$6e865ea70d7724f(value) : defaultColor;
|
|
1317
1311
|
const [color, setColor] = useState(modifiedValue.toFormat(allowTransparency ? "hsla" : "hsl"));
|
|
1312
|
+
if (hidden) {
|
|
1313
|
+
return null;
|
|
1314
|
+
}
|
|
1318
1315
|
let handleChangeEnd;
|
|
1319
1316
|
if (onChangeEnd) {
|
|
1320
1317
|
handleChangeEnd = (color2) => {
|
|
@@ -1326,7 +1323,7 @@ const SolidColorPicker = (props) => {
|
|
|
1326
1323
|
setColor(color2 ?? defaultColor);
|
|
1327
1324
|
onChange(color2 == null ? void 0 : color2.toString(outputFormat ?? (allowTransparency ? "hexa" : "hex")));
|
|
1328
1325
|
};
|
|
1329
|
-
const valueInputClassName =
|
|
1326
|
+
const valueInputClassName = clsx(
|
|
1330
1327
|
"es-uic-h-8 es-uic-w-12 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-tabular-nums es-uic-text-sm es-uic-shadow-sm es-uic-transition es-uic-text-right selection:es-uic-bg-teal-500/20 selection:es-uic-text-teal-950",
|
|
1331
1328
|
"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"
|
|
1332
1329
|
);
|
|
@@ -1337,7 +1334,7 @@ const SolidColorPicker = (props) => {
|
|
|
1337
1334
|
value: color,
|
|
1338
1335
|
xChannel: "saturation",
|
|
1339
1336
|
yChannel: "lightness",
|
|
1340
|
-
className:
|
|
1337
|
+
className: clsx(
|
|
1341
1338
|
"es-uic-size-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm es-uic-transition",
|
|
1342
1339
|
'[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
|
|
1343
1340
|
"disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
|
|
@@ -1348,7 +1345,7 @@ const SolidColorPicker = (props) => {
|
|
|
1348
1345
|
children: /* @__PURE__ */ jsx(
|
|
1349
1346
|
$e2b71ec1d6016406$export$a3cc47cee1c1ccc,
|
|
1350
1347
|
{
|
|
1351
|
-
className:
|
|
1348
|
+
className: clsx(
|
|
1352
1349
|
"es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
|
|
1353
1350
|
"dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
|
|
1354
1351
|
"focus-visible:!-es-uic-translate-x-1/2 focus-visible:!-es-uic-translate-y-1/2 focus-visible:!es-uic-scale-125",
|
|
@@ -1368,7 +1365,7 @@ const SolidColorPicker = (props) => {
|
|
|
1368
1365
|
children: /* @__PURE__ */ jsx(
|
|
1369
1366
|
$6f909507e6374d18$export$105594979f116971,
|
|
1370
1367
|
{
|
|
1371
|
-
className:
|
|
1368
|
+
className: clsx(
|
|
1372
1369
|
"es-uic-h-7 es-uic-w-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm",
|
|
1373
1370
|
'[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
|
|
1374
1371
|
"disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
|
|
@@ -1376,7 +1373,7 @@ const SolidColorPicker = (props) => {
|
|
|
1376
1373
|
children: /* @__PURE__ */ jsx(
|
|
1377
1374
|
$e2b71ec1d6016406$export$a3cc47cee1c1ccc,
|
|
1378
1375
|
{
|
|
1379
|
-
className:
|
|
1376
|
+
className: clsx(
|
|
1380
1377
|
"es-uic-top-3.25",
|
|
1381
1378
|
"es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
|
|
1382
1379
|
"dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
|
|
@@ -1399,7 +1396,7 @@ const SolidColorPicker = (props) => {
|
|
|
1399
1396
|
children: /* @__PURE__ */ jsx(
|
|
1400
1397
|
$6f909507e6374d18$export$105594979f116971,
|
|
1401
1398
|
{
|
|
1402
|
-
className:
|
|
1399
|
+
className: clsx(
|
|
1403
1400
|
"es-uic-h-7 es-uic-w-48 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-shadow-sm",
|
|
1404
1401
|
'[&:has(>_[data-focus-visible="true"])]:es-uic-ring [&:has(>_[data-focus-visible="true"])]:es-uic-ring-teal-500 [&:has(>_[data-focus-visible="true"])]:es-uic-ring-opacity-50',
|
|
1405
1402
|
"disabled:!es-uic-bg-gradient-to-r disabled:es-uic-from-white disabled:es-uic-to-gray-100"
|
|
@@ -1414,7 +1411,7 @@ const SolidColorPicker = (props) => {
|
|
|
1414
1411
|
children: /* @__PURE__ */ jsx(
|
|
1415
1412
|
$e2b71ec1d6016406$export$a3cc47cee1c1ccc,
|
|
1416
1413
|
{
|
|
1417
|
-
className:
|
|
1414
|
+
className: clsx(
|
|
1418
1415
|
"es-uic-top-3.25",
|
|
1419
1416
|
"es-uic-size-5 es-uic-rounded-full es-uic-border es-uic-border-white es-uic-shadow-[0_0_0_1px_black] es-uic-transition",
|
|
1420
1417
|
"dragging:!-es-uic-translate-x-1/2 dragging:!-es-uic-translate-y-1/2 dragging:!es-uic-scale-110",
|
|
@@ -1438,8 +1435,8 @@ const SolidColorPicker = (props) => {
|
|
|
1438
1435
|
children: /* @__PURE__ */ jsx(
|
|
1439
1436
|
$3985021b0ad6602f$export$f5b8910cec6cf069,
|
|
1440
1437
|
{
|
|
1441
|
-
className:
|
|
1442
|
-
"es-uic-h-9 es-uic-w-20 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-
|
|
1438
|
+
className: clsx(
|
|
1439
|
+
"es-uic-h-9 es-uic-w-20 es-uic-rounded-md es-uic-border es-uic-border-gray-300 es-uic-p-2 es-uic-text-sm es-uic-tabular-nums es-uic-shadow-sm es-uic-transition",
|
|
1443
1440
|
"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"
|
|
1444
1441
|
)
|
|
1445
1442
|
}
|