@eightshift/ui-components 5.6.1 → 6.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/dist/{Button-CQ5ZZJ2w.js → Button-BXjXzdW_.js} +13 -13
- package/dist/{Dialog-BMgMUQuN.js → Dialog-D8bjn-nh.js} +404 -77
- package/dist/{FieldError-B8BgFmIQ.js → FieldError-DwBG6m1U.js} +2 -2
- package/dist/{FocusScope-B5vxRkHm.js → FocusScope-BMk5oZCk.js} +8 -8
- package/dist/{Heading-B5aEynOM.js → Heading-BmRX4BRL.js} +3 -3
- package/dist/{Hidden-rE6uR-lr.js → Hidden-Rfj-STx7.js} +4 -4
- package/dist/{Input-8yja_IHC.js → Input-CNNksOWg.js} +11 -11
- package/dist/{Label-DWVaNd2E.js → Label-D8a3eYb-.js} +4 -4
- package/dist/{List-BiAnh5G5.js → List-BGHOoFf0.js} +8 -8
- package/dist/{ListBox-DggfiuO_.js → ListBox-Dd37zMvs.js} +40 -41
- package/dist/{OverlayArrow-DraDOoRn.js → OverlayArrow-DokC40S3.js} +6 -6
- package/dist/{PortalProvider---wyKpMr.js → PortalProvider-CHPnqDSH.js} +2 -2
- package/dist/RadioGroup-BVFvITWO.js +371 -0
- package/dist/{SearchField-DWGdCvnn.js → SearchField-CHYnN-jt.js} +16 -16
- package/dist/{SelectionManager-B6-b5NM2.js → SelectionManager-N8X7T_4D.js} +44 -46
- package/dist/{SharedElementTransition-fML-zIv6.js → SharedElementTransition-BDT84GtD.js} +3 -3
- package/dist/{Slider-DfU6bRtH.js → Slider-CL5CM9S8.js} +23 -23
- package/dist/{Text-AxKZjtFm.js → Text-ztX6G1zR.js} +3 -3
- package/dist/{VisuallyHidden-CgnIuZJ2.js → VisuallyHidden-DTUuKFiI.js} +4 -4
- package/dist/assets/style-admin.css +12156 -2
- package/dist/assets/style-editor.css +12156 -2
- package/dist/assets/style.css +12162 -2
- package/dist/assets/wp-overrides/allow-full-width-blocks.css +6 -0
- package/dist/assets/wp-overrides/fix-label-text-case.css +29 -0
- package/dist/assets/wp-overrides/increase-sidebar-width.css +4 -0
- package/dist/assets/wp-overrides/make-block-messages-nicer.css +155 -0
- package/dist/assets/wp-overrides/replace-fonts.css +8 -0
- package/dist/assets/wp-overrides/restyle-tooltips.css +194 -0
- package/dist/assets/wp-overrides/round-corners.css +200 -0
- package/dist/assets/wp-overrides/unify-button-sizes.css +5 -0
- package/dist/clsx-DgYk2OaC.js +16 -0
- package/dist/{Color-WxFE7lQB.js → color-swatch-CFIuSPcO.js} +124 -6
- package/dist/components/animated-visibility/animated-visibility.js +25 -17
- package/dist/components/base-control/base-control.js +8 -5
- package/dist/components/base-control/container.js +204 -0
- package/dist/components/button/button.js +249 -155
- package/dist/components/checkbox/checkbox.js +96 -37
- package/dist/components/color-pickers/color-picker.js +16 -7
- package/dist/components/color-pickers/color-swatch.js +5 -57
- package/dist/components/color-pickers/gradient-editor.js +161 -138
- package/dist/components/color-pickers/solid-color-picker.js +308 -206
- package/dist/components/component-toggle/component-toggle.js +12 -8
- package/dist/components/container-panel/container-panel.js +54 -31
- package/dist/components/draggable/draggable-handle.js +8 -7
- package/dist/components/draggable/draggable.js +2 -2
- package/dist/components/draggable-list/draggable-list-item.js +21 -12
- package/dist/components/draggable-list/draggable-list.js +19 -21
- package/dist/components/expandable/expandable.js +56 -28
- package/dist/components/index.js +7 -21
- package/dist/components/input-field/input-field.js +112 -35
- package/dist/components/item-collection/item-collection.js +1 -1
- package/dist/components/link-input/link-input.js +181 -121
- package/dist/components/matrix-align/matrix-align.js +54 -20
- package/dist/components/menu/menu.js +26 -34
- package/dist/components/modal/modal.js +31 -28
- package/dist/components/notice/notice.js +45 -28
- package/dist/components/number-picker/number-picker.js +151 -101
- package/dist/components/option-select/option-select.js +40 -4
- package/dist/components/options-panel/options-panel.js +52 -25
- package/dist/components/placeholders/file-picker-shell.js +10 -9
- package/dist/components/placeholders/file-placeholder.js +14 -6
- package/dist/components/placeholders/image-placeholder.js +14 -4
- package/dist/components/placeholders/media-placeholder.js +11 -4
- package/dist/components/popover/popover.js +14 -11
- package/dist/components/portal-provider/portal-provider.js +1 -1
- package/dist/components/radio/radio.js +118 -429
- package/dist/components/repeater/repeater-item.js +7 -10
- package/dist/components/repeater/repeater.js +9 -15
- package/dist/components/responsive/mini-responsive.js +53 -61
- package/dist/components/responsive/responsive-legacy.js +1 -1
- package/dist/components/responsive/responsive.js +27 -27
- package/dist/components/responsive-preview/responsive-preview.js +1 -1
- package/dist/components/rich-label/rich-label.js +5 -5
- package/dist/components/select/async-multi-select.js +467 -100
- package/dist/components/select/{v2/async-select.js → async-select.js} +182 -105
- package/dist/components/select/multi-select.js +437 -83
- package/dist/components/select/shared.js +14 -42
- package/dist/components/select/single-select.js +349 -54
- package/dist/components/slider/column-config-slider.js +138 -45
- package/dist/components/slider/slider.js +265 -205
- package/dist/components/slider/utils.js +32 -1
- package/dist/components/smart-image/smart-image.js +25 -4
- package/dist/components/smart-image/worker-inline.js +1 -1
- package/dist/components/spacer/spacer.js +2 -2
- package/dist/components/tabs/tabs.js +370 -101
- package/dist/components/toggle/switch.js +174 -39
- package/dist/components/toggle/toggle.js +6 -3
- package/dist/components/toggle-button/toggle-button.js +140 -56
- package/dist/components/tooltip/tooltip.js +27 -26
- package/dist/{context-DMOmz986.js → context-BQvmiUqb.js} +3 -3
- package/dist/{default-i18n-DBm-GqWM.js → default-i18n-CnQeC5Pl.js} +10 -10
- package/dist/{general-Ck8IV7xJ.js → general-B6pOveVp.js} +11 -10
- package/dist/icons/icons.js +28 -9
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/icons/spinner.js +3 -1
- package/dist/{index-Dq3gT5pW.js → index-BHpUy2Ix.js} +1 -1
- package/dist/{index-D8-Zjpbd.js → index-oFgxU4zs.js} +3 -3
- package/dist/index.js +6 -20
- package/dist/proxy-0B6wWuDe.js +7409 -0
- package/dist/{react-jsx-parser.min-VUl-CuCv.js → react-jsx-parser.min-B_hvYYa1.js} +5 -5
- package/dist/{Select-BvggcFOX.js → shared-DwjRce5e.js} +170 -36
- package/dist/{textSelection-DbCKqaw8.js → textSelection-CwHUtNVX.js} +1 -1
- package/dist/{useButton-v9ngEj50.js → useButton-DdZrS1Kz.js} +3 -3
- package/dist/{useEvent-BifIGnVS.js → useEvent-BD7Olibq.js} +1 -1
- package/dist/{useFilter-BlkUH1Ma.js → useFilter-bhxeEDg8.js} +1 -1
- package/dist/{useFocusRing-Cgm0R4Cf.js → useFocusRing-D3b7Kh4P.js} +1 -1
- package/dist/{useFormReset-yV9VVy9R.js → useFormReset-WUv2PdFO.js} +1 -1
- package/dist/{useFormValidation-CeNsUGWK.js → useFormValidation-DQeXkyLm.js} +2 -2
- package/dist/{useHover-BRDW3y7-.js → useHover-Bycb7BsD.js} +7 -7
- package/dist/{useLabel-C8umX0gk.js → useLabel-Bnv4-T24.js} +2 -2
- package/dist/{useLabels-Cdxi6JSa.js → useLabels-B49ptFDX.js} +1 -1
- package/dist/{useListState-RdLrYsMP.js → useListState-ZKhRO8ML.js} +1 -1
- package/dist/{useLocalizedStringFormatter-eaZiN2tE.js → useLocalizedStringFormatter-NETP-8H8.js} +1 -1
- package/dist/{useNumberField-D16dDfYF.js → useNumberField-D2fUHql3.js} +10 -10
- package/dist/{useNumberFormatter-BCmkV-7c.js → useNumberFormatter-DGvuRCn7.js} +1 -1
- package/dist/{usePress-DJskZBH9.js → usePress-B8OteQMu.js} +6 -6
- package/dist/{useSingleSelectListState-n0AVMr3Y.js → useSingleSelectListState-BBTu4shO.js} +2 -2
- package/dist/{useToggle-DSBDAfdw.js → useToggle-BZhaYwZl.js} +4 -4
- package/dist/{useToggleState-CzN79ary.js → useToggleState-VkXJjsru.js} +1 -1
- package/dist/utilities/general.js +1 -1
- package/dist/utilities/index.js +1 -1
- package/dist/{utils-cvK1vxO7.js → utils-DGpXyJOJ.js} +29 -42
- package/dist/workers/image-analysis.worker.js +3 -3
- package/package.json +26 -22
- package/dist/ColorSwatch-xVS3rMYS.js +0 -66
- package/dist/Select-ef7c0426.esm-CmTkSxDx.js +0 -2474
- package/dist/Separator-B-xeqOkC.js +0 -344
- package/dist/assets/wp-font-enhancements.css +0 -2
- package/dist/assets/wp-ui-enhancements.css +0 -2
- package/dist/components/select/async-single-select.js +0 -138
- 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/react-select-component-wrappers.js +0 -90
- package/dist/components/select/styles.js +0 -49
- package/dist/components/select/v2/async-multi-select.js +0 -432
- package/dist/components/select/v2/multi-select.js +0 -403
- package/dist/components/select/v2/shared.js +0 -69
- package/dist/components/select/v2/single-select.js +0 -358
- package/dist/index-641ee5b8.esm-DVp0njHa.js +0 -3139
- package/dist/modifiers.esm-BuJQPI1X.js +0 -31
- package/dist/multi-select-components-CT_W0Cy9.js +0 -3744
- package/dist/react-select-async.esm-Zl1LPaPb.js +0 -107
- package/dist/react-select.esm-Bu36HujU.js +0 -15
- package/dist/useDragAndDrop-C08ZXv4F.js +0 -3925
- package/dist/wp/wp-font-enhancements.js +0 -1
- package/dist/wp/wp-ui-enhancements.js +0 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { s as sprintf } from "../../sprintf-DmNrJSYG.js";
|
|
3
|
-
import { _ as __ } from "../../default-i18n-
|
|
3
|
+
import { _ as __ } from "../../default-i18n-CnQeC5Pl.js";
|
|
4
4
|
import { useMemo, useState } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { Button, ButtonGroup } from "../button/button.js";
|
|
6
6
|
import { icons } from "../../icons/icons.js";
|
|
7
7
|
import { SolidColorPicker } from "./solid-color-picker.js";
|
|
8
8
|
import { Slider } from "../slider/slider.js";
|
|
9
9
|
import { NumberPicker } from "../number-picker/number-picker.js";
|
|
10
|
-
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../
|
|
10
|
+
import { $ as $251c695a52d94a8d$export$cae13e90592f246a } from "../../color-swatch-CFIuSPcO.js";
|
|
11
11
|
import { Menu, MenuItem } from "../menu/menu.js";
|
|
12
12
|
import { MatrixAlign } from "../matrix-align/matrix-align.js";
|
|
13
|
-
import { Spacer } from "../spacer/spacer.js";
|
|
14
13
|
import { Toggle } from "../toggle/toggle.js";
|
|
15
14
|
import { OptionSelect } from "../option-select/option-select.js";
|
|
16
15
|
import { DraggableList } from "../draggable-list/draggable-list.js";
|
|
17
16
|
import { DraggableListItem } from "../draggable-list/draggable-list-item.js";
|
|
18
17
|
import { TriggeredPopover } from "../popover/popover.js";
|
|
19
18
|
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
19
|
+
import { ContainerGroup, Container } from "../base-control/container.js";
|
|
20
|
+
import { BaseControl } from "../base-control/base-control.js";
|
|
21
|
+
import { s as srgb, i as isColorDark } from "../../general-B6pOveVp.js";
|
|
20
22
|
function c(e, o = ",") {
|
|
21
23
|
let t = [], n = 0, i = 0;
|
|
22
24
|
o = new RegExp(o);
|
|
@@ -240,31 +242,81 @@ const GradientEditor = (props) => {
|
|
|
240
242
|
return null;
|
|
241
243
|
}
|
|
242
244
|
return /* @__PURE__ */ jsxs("div", { className: "es:w-full es:space-y-2.5", children: [
|
|
243
|
-
/* @__PURE__ */ jsx(
|
|
244
|
-
"button",
|
|
245
|
-
{
|
|
246
|
-
className: clsx(
|
|
247
|
-
"es:shadow-sm, es:mx-auto es:block es:h-40 es:cursor-pointer es:rounded-lg es:border es:border-secondary-300 es:transition-[width]",
|
|
248
|
-
squarePreview ? "es:w-40" : "es:w-full"
|
|
249
|
-
),
|
|
250
|
-
style: { backgroundImage: outputGradient },
|
|
251
|
-
onClick: () => setSquarePreview((prev) => !prev),
|
|
252
|
-
"aria-label": __("Toggle preview size", "eightshift-ui-components")
|
|
253
|
-
}
|
|
254
|
-
),
|
|
255
|
-
/* @__PURE__ */ jsx(
|
|
256
|
-
OptionSelect,
|
|
257
|
-
{
|
|
258
|
-
"aria-label": __("Gradient type", "eightshift-ui-components"),
|
|
259
|
-
value: gradientType,
|
|
260
|
-
onChange: (value2) => onChange(getGradientResult({ stops: gradientData.stops }, value2)),
|
|
261
|
-
options: gradientTypes,
|
|
262
|
-
wrapperProps: { className: "es:mx-auto es:w-fit" },
|
|
263
|
-
type: "toggleButtons"
|
|
264
|
-
}
|
|
265
|
-
),
|
|
266
|
-
gradientType === "linear" && /* @__PURE__ */ jsxs("div", { className: "es:flex es:items-center es:gap-1", children: [
|
|
245
|
+
/* @__PURE__ */ jsx(ContainerGroup, { children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
267
246
|
/* @__PURE__ */ jsx(
|
|
247
|
+
"button",
|
|
248
|
+
{
|
|
249
|
+
className: clsx(
|
|
250
|
+
"es:shadow-sm, es:mx-auto es:block es:h-40 es:cursor-pointer es:rounded-lg es:border es:border-secondary-300 es:transition-[width] es:duration-300 es:ease-spring-snappy",
|
|
251
|
+
"es:mb-2",
|
|
252
|
+
squarePreview ? "es:w-40" : "es:w-full"
|
|
253
|
+
),
|
|
254
|
+
style: { backgroundImage: outputGradient },
|
|
255
|
+
onClick: () => setSquarePreview((prev) => !prev),
|
|
256
|
+
"aria-label": __("Toggle preview size", "eightshift-ui-components")
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
Slider,
|
|
261
|
+
{
|
|
262
|
+
className: "es:mb-5",
|
|
263
|
+
"aria-label": __("Stop positions", "eightshift-ui-components"),
|
|
264
|
+
min: 0,
|
|
265
|
+
max: 100,
|
|
266
|
+
step: 1,
|
|
267
|
+
value: gradientData?.stops?.map(({ offset }, i) => {
|
|
268
|
+
if (!offset) {
|
|
269
|
+
return i * 100 / (gradientData.stops.length - 1);
|
|
270
|
+
}
|
|
271
|
+
return parseInt(offset?.value);
|
|
272
|
+
}),
|
|
273
|
+
onChange: (value2) => {
|
|
274
|
+
setGradientData({
|
|
275
|
+
...gradientData,
|
|
276
|
+
stops: gradientData.stops.map((stop, i) => {
|
|
277
|
+
return {
|
|
278
|
+
...stop,
|
|
279
|
+
offset: { value: value2[i], unit: "%" }
|
|
280
|
+
};
|
|
281
|
+
})
|
|
282
|
+
});
|
|
283
|
+
},
|
|
284
|
+
thumbContent: (index) => {
|
|
285
|
+
const colorData = srgb(gradientData.stops[index]?.color);
|
|
286
|
+
let foregroundColor = "black";
|
|
287
|
+
if (colorData.alpha >= 0.5 && isColorDark(colorData.r, colorData.g, colorData.b)) {
|
|
288
|
+
foregroundColor = "white";
|
|
289
|
+
}
|
|
290
|
+
return /* @__PURE__ */ jsx(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
className: "es:pointer-events-none es:absolute es:-bottom-4.5 es:-translate-x-1/3 es:flex es:w-3 es:items-center es:justify-center es:text-center es:text-12 es:leading-none es:py-0.25 es:rounded-sm es:font-semibold es:tabular-nums es:font-mono es:ring es:ring-accent-600",
|
|
294
|
+
style: {
|
|
295
|
+
backgroundColor: gradientData.stops[index]?.color,
|
|
296
|
+
color: foregroundColor
|
|
297
|
+
},
|
|
298
|
+
children: index + 1
|
|
299
|
+
}
|
|
300
|
+
);
|
|
301
|
+
},
|
|
302
|
+
noActiveHighlight: true,
|
|
303
|
+
tooltipContent: (value2) => `${Math.round(value2)}%`
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] }) }),
|
|
307
|
+
/* @__PURE__ */ jsxs(ContainerGroup, { children: [
|
|
308
|
+
/* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(
|
|
309
|
+
OptionSelect,
|
|
310
|
+
{
|
|
311
|
+
label: __("Type", "eightshift-ui-components"),
|
|
312
|
+
value: gradientType,
|
|
313
|
+
onChange: (value2) => onChange(getGradientResult({ stops: gradientData.stops }, value2)),
|
|
314
|
+
options: gradientTypes,
|
|
315
|
+
type: "toggleButtons",
|
|
316
|
+
inline: true
|
|
317
|
+
}
|
|
318
|
+
) }),
|
|
319
|
+
/* @__PURE__ */ jsx(Container, { hidden: gradientType !== "linear", children: /* @__PURE__ */ jsx(
|
|
268
320
|
NumberPicker,
|
|
269
321
|
{
|
|
270
322
|
inline: true,
|
|
@@ -281,40 +333,39 @@ const GradientEditor = (props) => {
|
|
|
281
333
|
});
|
|
282
334
|
},
|
|
283
335
|
suffix: "°",
|
|
284
|
-
size: "
|
|
336
|
+
size: "medium",
|
|
285
337
|
className: "es:grow",
|
|
286
|
-
placeholder: linearDirections.find(({ value: value2 }) => value2 === gradientData?.orientation?.value)?.valueDegrees ?? ""
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
tooltip: __("Presets", "eightshift-ui-components")
|
|
295
|
-
},
|
|
296
|
-
keepOpen: true,
|
|
297
|
-
children: linearDirections.map(({ label, value: value2, iconClass }) => {
|
|
298
|
-
return /* @__PURE__ */ jsx(
|
|
299
|
-
MenuItem,
|
|
300
|
-
{
|
|
301
|
-
icon: /* @__PURE__ */ jsx("div", { className: clsx("es:size-5 es:rounded-sm es:from-secondary-700 es:to-secondary-200", iconClass) }),
|
|
302
|
-
onClick: () => {
|
|
303
|
-
setGradientData({
|
|
304
|
-
...gradientData,
|
|
305
|
-
orientation: { type: "directional", value: value2 }
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
children: label
|
|
338
|
+
placeholder: linearDirections.find(({ value: value2 }) => value2 === gradientData?.orientation?.value)?.valueDegrees ?? "",
|
|
339
|
+
children: /* @__PURE__ */ jsx(
|
|
340
|
+
Menu,
|
|
341
|
+
{
|
|
342
|
+
triggerIcon: icons.sliders,
|
|
343
|
+
triggerProps: {
|
|
344
|
+
tooltip: __("Presets", "eightshift-ui-components"),
|
|
345
|
+
slot: null
|
|
309
346
|
},
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
347
|
+
keepOpen: true,
|
|
348
|
+
children: linearDirections.map(({ label, value: value2, iconClass }) => {
|
|
349
|
+
return /* @__PURE__ */ jsx(
|
|
350
|
+
MenuItem,
|
|
351
|
+
{
|
|
352
|
+
icon: /* @__PURE__ */ jsx("div", { className: clsx("es:size-5 es:rounded-sm es:from-secondary-700 es:to-secondary-200", iconClass) }),
|
|
353
|
+
onClick: () => {
|
|
354
|
+
setGradientData({
|
|
355
|
+
...gradientData,
|
|
356
|
+
orientation: { type: "directional", value: value2 }
|
|
357
|
+
});
|
|
358
|
+
},
|
|
359
|
+
children: label
|
|
360
|
+
},
|
|
361
|
+
value2
|
|
362
|
+
);
|
|
363
|
+
})
|
|
364
|
+
}
|
|
365
|
+
)
|
|
313
366
|
}
|
|
314
|
-
)
|
|
315
|
-
|
|
316
|
-
gradientType === "radial" && /* @__PURE__ */ jsxs("div", { className: "es:space-y-2", children: [
|
|
317
|
-
/* @__PURE__ */ jsx(
|
|
367
|
+
) }),
|
|
368
|
+
/* @__PURE__ */ jsx(Container, { hidden: gradientType !== "radial", children: /* @__PURE__ */ jsx(
|
|
318
369
|
OptionSelect,
|
|
319
370
|
{
|
|
320
371
|
label: __("Shape", "eightshift-ui-components"),
|
|
@@ -332,8 +383,8 @@ const GradientEditor = (props) => {
|
|
|
332
383
|
});
|
|
333
384
|
}
|
|
334
385
|
}
|
|
335
|
-
),
|
|
336
|
-
/* @__PURE__ */ jsx(
|
|
386
|
+
) }),
|
|
387
|
+
/* @__PURE__ */ jsx(Container, { hidden: gradientType !== "radial", children: /* @__PURE__ */ jsx(
|
|
337
388
|
MatrixAlign,
|
|
338
389
|
{
|
|
339
390
|
icon: icons.centerPoint,
|
|
@@ -350,10 +401,8 @@ const GradientEditor = (props) => {
|
|
|
350
401
|
});
|
|
351
402
|
}
|
|
352
403
|
}
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
gradientType === "conic" && /* @__PURE__ */ jsxs("div", { className: "es:space-y-2", children: [
|
|
356
|
-
/* @__PURE__ */ jsx(
|
|
404
|
+
) }),
|
|
405
|
+
/* @__PURE__ */ jsx(Container, { hidden: gradientType !== "conic", children: /* @__PURE__ */ jsx(
|
|
357
406
|
NumberPicker,
|
|
358
407
|
{
|
|
359
408
|
inline: true,
|
|
@@ -362,19 +411,18 @@ const GradientEditor = (props) => {
|
|
|
362
411
|
min: 0,
|
|
363
412
|
max: 360,
|
|
364
413
|
step: 1,
|
|
365
|
-
value: parseInt(gradientData?.angle
|
|
414
|
+
value: parseInt(gradientData?.angle?.replace("deg", "")),
|
|
366
415
|
onChange: (value2) => {
|
|
367
416
|
setGradientData({
|
|
368
417
|
...gradientData,
|
|
369
418
|
angle: `${value2}deg`
|
|
370
419
|
});
|
|
371
420
|
},
|
|
372
|
-
size: "
|
|
373
|
-
suffix: "°"
|
|
374
|
-
className: "es:grow"
|
|
421
|
+
size: "medium",
|
|
422
|
+
suffix: "°"
|
|
375
423
|
}
|
|
376
|
-
),
|
|
377
|
-
/* @__PURE__ */ jsx(
|
|
424
|
+
) }),
|
|
425
|
+
/* @__PURE__ */ jsx(Container, { hidden: gradientType !== "conic", children: /* @__PURE__ */ jsx(
|
|
378
426
|
MatrixAlign,
|
|
379
427
|
{
|
|
380
428
|
icon: icons.centerPoint,
|
|
@@ -387,39 +435,29 @@ const GradientEditor = (props) => {
|
|
|
387
435
|
});
|
|
388
436
|
}
|
|
389
437
|
}
|
|
390
|
-
)
|
|
438
|
+
) }),
|
|
439
|
+
/* @__PURE__ */ jsx(Container, { children: /* @__PURE__ */ jsx(
|
|
440
|
+
Toggle,
|
|
441
|
+
{
|
|
442
|
+
checked: gradientData.repeating,
|
|
443
|
+
onChange: (value2) => {
|
|
444
|
+
setGradientData({
|
|
445
|
+
...gradientData,
|
|
446
|
+
repeating: value2
|
|
447
|
+
});
|
|
448
|
+
},
|
|
449
|
+
label: __("Repeating", "eightshift-ui-components"),
|
|
450
|
+
icon: icons.gradientRepeat
|
|
451
|
+
}
|
|
452
|
+
) })
|
|
391
453
|
] }),
|
|
392
454
|
/* @__PURE__ */ jsx(
|
|
393
|
-
|
|
394
|
-
{
|
|
395
|
-
checked: gradientData.repeating,
|
|
396
|
-
onChange: (value2) => {
|
|
397
|
-
setGradientData({
|
|
398
|
-
...gradientData,
|
|
399
|
-
repeating: value2
|
|
400
|
-
});
|
|
401
|
-
},
|
|
402
|
-
label: __("Repeating", "eightshift-ui-components"),
|
|
403
|
-
icon: icons.gradientRepeat
|
|
404
|
-
}
|
|
405
|
-
),
|
|
406
|
-
/* @__PURE__ */ jsx(Spacer, { border: true }),
|
|
407
|
-
/* @__PURE__ */ jsx(
|
|
408
|
-
DraggableList,
|
|
455
|
+
BaseControl,
|
|
409
456
|
{
|
|
410
|
-
items: gradientData?.stops,
|
|
411
|
-
onChange: (items) => {
|
|
412
|
-
setGradientData({
|
|
413
|
-
...gradientData,
|
|
414
|
-
stops: items.map(({ color }, i) => ({
|
|
415
|
-
...gradientData.stops[i] ?? {},
|
|
416
|
-
color
|
|
417
|
-
}))
|
|
418
|
-
});
|
|
419
|
-
},
|
|
420
457
|
icon: icons.gradientStop,
|
|
421
458
|
label: __("Gradient stops", "eightshift-ui-components"),
|
|
422
|
-
|
|
459
|
+
inline: true,
|
|
460
|
+
children: /* @__PURE__ */ jsx(
|
|
423
461
|
Button,
|
|
424
462
|
{
|
|
425
463
|
icon: icons.add,
|
|
@@ -430,9 +468,27 @@ const GradientEditor = (props) => {
|
|
|
430
468
|
stops: [...gradientData.stops, { color: "#000000FF" }]
|
|
431
469
|
});
|
|
432
470
|
},
|
|
471
|
+
type: "simple",
|
|
433
472
|
"aria-label": __("Add stop", "eightshift-ui-components")
|
|
434
473
|
}
|
|
435
|
-
)
|
|
474
|
+
)
|
|
475
|
+
}
|
|
476
|
+
),
|
|
477
|
+
/* @__PURE__ */ jsx(ContainerGroup, { children: /* @__PURE__ */ jsx(
|
|
478
|
+
DraggableList,
|
|
479
|
+
{
|
|
480
|
+
items: gradientData?.stops,
|
|
481
|
+
onChange: (items) => {
|
|
482
|
+
setGradientData({
|
|
483
|
+
...gradientData,
|
|
484
|
+
stops: items.map(({ color }, i) => ({
|
|
485
|
+
...gradientData.stops[i] ?? {},
|
|
486
|
+
color
|
|
487
|
+
}))
|
|
488
|
+
});
|
|
489
|
+
},
|
|
490
|
+
orientation: "vertical",
|
|
491
|
+
className: "es:contents",
|
|
436
492
|
children: (item) => {
|
|
437
493
|
const { color, updateData, itemIndex } = item;
|
|
438
494
|
return /* @__PURE__ */ jsx(
|
|
@@ -447,13 +503,13 @@ const GradientEditor = (props) => {
|
|
|
447
503
|
color
|
|
448
504
|
}
|
|
449
505
|
),
|
|
450
|
-
textValue: sprintf(__("Stop %s", "eightshift-ui-components"), itemIndex + 1),
|
|
451
506
|
children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
452
507
|
/* @__PURE__ */ jsx(
|
|
453
508
|
TriggeredPopover,
|
|
454
509
|
{
|
|
455
510
|
triggerButtonIcon: icons.color,
|
|
456
|
-
triggerButtonProps: { size: "small" },
|
|
511
|
+
triggerButtonProps: { size: "small", type: "ghost" },
|
|
512
|
+
className: "es:p-2.5",
|
|
457
513
|
children: /* @__PURE__ */ jsx(
|
|
458
514
|
SolidColorPicker,
|
|
459
515
|
{
|
|
@@ -479,49 +535,16 @@ const GradientEditor = (props) => {
|
|
|
479
535
|
icon: icons.trash,
|
|
480
536
|
size: "small",
|
|
481
537
|
"aria-label": __("Delete stop", "eightshift-ui-components"),
|
|
482
|
-
disabled: gradientData.stops.length <= 2
|
|
538
|
+
disabled: gradientData.stops.length <= 2,
|
|
539
|
+
type: "dangerGhost"
|
|
483
540
|
}
|
|
484
541
|
)
|
|
485
542
|
] })
|
|
486
543
|
}
|
|
487
544
|
);
|
|
488
545
|
}
|
|
489
|
-
},
|
|
490
|
-
gradientData?.stops?.length
|
|
491
|
-
),
|
|
492
|
-
/* @__PURE__ */ jsx(
|
|
493
|
-
Slider,
|
|
494
|
-
{
|
|
495
|
-
"aria-label": __("Stop positions", "eightshift-ui-components"),
|
|
496
|
-
min: 0,
|
|
497
|
-
max: 100,
|
|
498
|
-
step: 1,
|
|
499
|
-
value: gradientData?.stops?.map(({ offset }, i) => {
|
|
500
|
-
if (!offset) {
|
|
501
|
-
return i * 100 / (gradientData.stops.length - 1);
|
|
502
|
-
}
|
|
503
|
-
return parseInt(offset?.value);
|
|
504
|
-
}),
|
|
505
|
-
onChange: (value2) => {
|
|
506
|
-
setGradientData({
|
|
507
|
-
...gradientData,
|
|
508
|
-
stops: gradientData.stops.map((stop, i) => {
|
|
509
|
-
return {
|
|
510
|
-
...stop,
|
|
511
|
-
offset: { value: value2[i], unit: "%" }
|
|
512
|
-
};
|
|
513
|
-
})
|
|
514
|
-
});
|
|
515
|
-
},
|
|
516
|
-
thumbContent: (index) => /* @__PURE__ */ jsx("div", { className: "es:pointer-events-none es:absolute es:inset-0 es:flex es:size-3 es:items-center es:justify-center es:text-center es:text-xs es:font-semibold es:text-white", children: index + 1 }),
|
|
517
|
-
trackStyle: {
|
|
518
|
-
backgroundImage: getGradientResult({ orientation: { type: "directional", value: "right" }, stops: gradientData.stops }, "linear"),
|
|
519
|
-
height: "1.125rem",
|
|
520
|
-
borderRadius: "0.5rem"
|
|
521
|
-
},
|
|
522
|
-
noActiveHighlight: true
|
|
523
546
|
}
|
|
524
|
-
)
|
|
547
|
+
) })
|
|
525
548
|
] });
|
|
526
549
|
};
|
|
527
550
|
export {
|