@eightshift/ui-components 1.5.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Dialog-DSquJZb-.js → Dialog-BdtBguys.js} +1 -1
- package/dist/Heading-DGnF6JDc.js +17 -0
- package/dist/List-Bx2anbX-.js +583 -0
- package/dist/{RSPContexts-DQtGvvpM.js → RSPContexts-2lR5GG9p.js} +2 -2
- package/dist/{Select-49a62830.esm-D8voKavK.js → Select-c7902d94.esm-DtzFQzf-.js} +6 -4
- package/dist/assets/style.css +1 -1
- package/dist/components/animated-visibility/animated-visibility.js +139 -118
- package/dist/components/checkbox/checkbox.js +1 -1
- package/dist/components/color-pickers/color-picker.js +18 -11
- package/dist/components/color-pickers/solid-color-picker.js +1 -1
- package/dist/components/component-toggle/component-toggle.js +1 -0
- package/dist/components/draggable/draggable-handle.js +45 -0
- package/dist/components/draggable/draggable.js +5138 -96
- package/dist/components/draggable-list/draggable-list-item.js +16 -25
- package/dist/components/draggable-list/draggable-list.js +54 -86
- package/dist/components/expandable/expandable.js +63 -40
- package/dist/components/index.js +6 -4
- package/dist/components/link-input/link-input.js +2 -2
- package/dist/components/menu/menu.js +2 -2
- package/dist/components/modal/modal.js +4 -15
- package/dist/components/options-panel/options-panel.js +55 -1
- package/dist/components/popover/popover.js +1 -1
- package/dist/components/repeater/repeater-item.js +76 -27
- package/dist/components/repeater/repeater.js +72 -5110
- package/dist/components/select/async-multi-select.js +1 -1
- package/dist/components/select/async-single-select.js +1 -1
- package/dist/components/select/multi-select.js +1 -1
- package/dist/components/select/single-select.js +1 -1
- package/dist/icons/jsx-svg.js +1 -1
- package/dist/index.js +6 -4
- package/dist/{react-jsx-parser.min-CAGfntg1.js → react-jsx-parser.min-sPC96O_U.js} +124 -85
- package/dist/{react-select-async.esm-DY-cP0QK.js → react-select-async.esm-CxA8wpeT.js} +1 -1
- package/dist/{react-select.esm-DNlXj0hV.js → react-select.esm-CeE7o5M9.js} +1 -1
- package/dist/{useMenuTrigger-BbwpSVmh.js → useMenuTrigger-CT2-BFLo.js} +1 -1
- package/package.json +14 -14
- package/dist/components/draggable/draggable-item.js +0 -66
- package/dist/swapy-qb4t7itb.js +0 -3059
|
@@ -244,11 +244,11 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
244
244
|
isProcessing: false
|
|
245
245
|
};
|
|
246
246
|
const flagRunNextFrame = () => runNextFrame = true;
|
|
247
|
-
const
|
|
247
|
+
const steps = stepsOrder.reduce((acc, key) => {
|
|
248
248
|
acc[key] = createRenderStep(flagRunNextFrame);
|
|
249
249
|
return acc;
|
|
250
250
|
}, {});
|
|
251
|
-
const { read, resolveKeyframes, update, preRender, render, postRender } =
|
|
251
|
+
const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
|
|
252
252
|
const processBatch = () => {
|
|
253
253
|
const timestamp = performance.now();
|
|
254
254
|
runNextFrame = false;
|
|
@@ -275,7 +275,7 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
275
275
|
}
|
|
276
276
|
};
|
|
277
277
|
const schedule = stepsOrder.reduce((acc, key) => {
|
|
278
|
-
const step =
|
|
278
|
+
const step = steps[key];
|
|
279
279
|
acc[key] = (process2, keepAlive = false, immediate = false) => {
|
|
280
280
|
if (!runNextFrame)
|
|
281
281
|
wake();
|
|
@@ -285,12 +285,45 @@ function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
|
285
285
|
}, {});
|
|
286
286
|
const cancel = (process2) => {
|
|
287
287
|
for (let i = 0; i < stepsOrder.length; i++) {
|
|
288
|
-
|
|
288
|
+
steps[stepsOrder[i]].cancel(process2);
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
|
-
return { schedule, cancel, state, steps
|
|
291
|
+
return { schedule, cancel, state, steps };
|
|
292
292
|
}
|
|
293
|
-
const { schedule: frame, cancel: cancelFrame, state: frameData, steps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
293
|
+
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
294
|
+
const calcBezier = (t, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t + (3 * a2 - 6 * a1)) * t + 3 * a1) * t;
|
|
295
|
+
const subdivisionPrecision = 1e-7;
|
|
296
|
+
const subdivisionMaxIterations = 12;
|
|
297
|
+
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
|
|
298
|
+
let currentX;
|
|
299
|
+
let currentT;
|
|
300
|
+
let i = 0;
|
|
301
|
+
do {
|
|
302
|
+
currentT = lowerBound + (upperBound - lowerBound) / 2;
|
|
303
|
+
currentX = calcBezier(currentT, mX1, mX2) - x;
|
|
304
|
+
if (currentX > 0) {
|
|
305
|
+
upperBound = currentT;
|
|
306
|
+
} else {
|
|
307
|
+
lowerBound = currentT;
|
|
308
|
+
}
|
|
309
|
+
} while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations);
|
|
310
|
+
return currentT;
|
|
311
|
+
}
|
|
312
|
+
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
313
|
+
if (mX1 === mY1 && mX2 === mY2)
|
|
314
|
+
return noop;
|
|
315
|
+
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
316
|
+
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
|
|
317
|
+
}
|
|
318
|
+
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
|
319
|
+
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
|
|
320
|
+
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
321
|
+
const backIn = /* @__PURE__ */ reverseEasing(backOut);
|
|
322
|
+
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
|
|
323
|
+
const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
|
324
|
+
const circIn = (p) => 1 - Math.sin(Math.acos(p));
|
|
325
|
+
const circOut = reverseEasing(circIn);
|
|
326
|
+
const circInOut = mirrorEasing(circIn);
|
|
294
327
|
const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v);
|
|
295
328
|
function isNone(value) {
|
|
296
329
|
if (typeof value === "number") {
|
|
@@ -974,6 +1007,9 @@ function memo(callback) {
|
|
|
974
1007
|
return result;
|
|
975
1008
|
};
|
|
976
1009
|
}
|
|
1010
|
+
function isGenerator(type) {
|
|
1011
|
+
return typeof type === "function";
|
|
1012
|
+
}
|
|
977
1013
|
let now;
|
|
978
1014
|
function clearTime() {
|
|
979
1015
|
now = void 0;
|
|
@@ -1024,7 +1060,7 @@ function canAnimate(keyframes2, name, type, velocity) {
|
|
|
1024
1060
|
if (!isOriginAnimatable || !isTargetAnimatable) {
|
|
1025
1061
|
return false;
|
|
1026
1062
|
}
|
|
1027
|
-
return hasKeyframesChanged(keyframes2) || type === "spring" && velocity;
|
|
1063
|
+
return hasKeyframesChanged(keyframes2) || (type === "spring" || isGenerator(type)) && velocity;
|
|
1028
1064
|
}
|
|
1029
1065
|
const MAX_RESOLVE_DELAY = 40;
|
|
1030
1066
|
class BaseAnimation {
|
|
@@ -1077,8 +1113,8 @@ class BaseAnimation {
|
|
|
1077
1113
|
onKeyframesResolved(keyframes2, finalKeyframe) {
|
|
1078
1114
|
this.resolvedAt = time.now();
|
|
1079
1115
|
this.hasAttemptedResolve = true;
|
|
1080
|
-
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator } = this.options;
|
|
1081
|
-
if (!
|
|
1116
|
+
const { name, type, velocity, delay: delay2, onComplete, onUpdate, isGenerator: isGenerator2 } = this.options;
|
|
1117
|
+
if (!isGenerator2 && !canAnimate(keyframes2, name, type, velocity)) {
|
|
1082
1118
|
if (!delay2) {
|
|
1083
1119
|
onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes2, this.options, finalKeyframe));
|
|
1084
1120
|
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
|
|
@@ -1333,45 +1369,12 @@ function inertia({ keyframes: keyframes2, velocity = 0, power = 0.8, timeConstan
|
|
|
1333
1369
|
}
|
|
1334
1370
|
};
|
|
1335
1371
|
}
|
|
1336
|
-
const calcBezier = (t, a1, a2) => (((1 - 3 * a2 + 3 * a1) * t + (3 * a2 - 6 * a1)) * t + 3 * a1) * t;
|
|
1337
|
-
const subdivisionPrecision = 1e-7;
|
|
1338
|
-
const subdivisionMaxIterations = 12;
|
|
1339
|
-
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
|
|
1340
|
-
let currentX;
|
|
1341
|
-
let currentT;
|
|
1342
|
-
let i = 0;
|
|
1343
|
-
do {
|
|
1344
|
-
currentT = lowerBound + (upperBound - lowerBound) / 2;
|
|
1345
|
-
currentX = calcBezier(currentT, mX1, mX2) - x;
|
|
1346
|
-
if (currentX > 0) {
|
|
1347
|
-
upperBound = currentT;
|
|
1348
|
-
} else {
|
|
1349
|
-
lowerBound = currentT;
|
|
1350
|
-
}
|
|
1351
|
-
} while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations);
|
|
1352
|
-
return currentT;
|
|
1353
|
-
}
|
|
1354
|
-
function cubicBezier(mX1, mY1, mX2, mY2) {
|
|
1355
|
-
if (mX1 === mY1 && mX2 === mY2)
|
|
1356
|
-
return noop;
|
|
1357
|
-
const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
|
|
1358
|
-
return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
|
|
1359
|
-
}
|
|
1360
1372
|
const easeIn = /* @__PURE__ */ cubicBezier(0.42, 0, 1, 1);
|
|
1361
1373
|
const easeOut = /* @__PURE__ */ cubicBezier(0, 0, 0.58, 1);
|
|
1362
1374
|
const easeInOut = /* @__PURE__ */ cubicBezier(0.42, 0, 0.58, 1);
|
|
1363
1375
|
const isEasingArray = (ease2) => {
|
|
1364
1376
|
return Array.isArray(ease2) && typeof ease2[0] !== "number";
|
|
1365
1377
|
};
|
|
1366
|
-
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;
|
|
1367
|
-
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);
|
|
1368
|
-
const circIn = (p) => 1 - Math.sin(Math.acos(p));
|
|
1369
|
-
const circOut = reverseEasing(circIn);
|
|
1370
|
-
const circInOut = mirrorEasing(circIn);
|
|
1371
|
-
const backOut = /* @__PURE__ */ cubicBezier(0.33, 1.53, 0.69, 0.99);
|
|
1372
|
-
const backIn = /* @__PURE__ */ reverseEasing(backOut);
|
|
1373
|
-
const backInOut = /* @__PURE__ */ mirrorEasing(backIn);
|
|
1374
|
-
const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));
|
|
1375
1378
|
const easingLookup = {
|
|
1376
1379
|
linear: noop,
|
|
1377
1380
|
easeIn,
|
|
@@ -1701,7 +1704,7 @@ class MainThreadAnimation extends BaseAnimation {
|
|
|
1701
1704
|
}
|
|
1702
1705
|
initPlayback(keyframes$1) {
|
|
1703
1706
|
const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0 } = this.options;
|
|
1704
|
-
const generatorFactory = generators[type] || keyframes;
|
|
1707
|
+
const generatorFactory = isGenerator(type) ? type : generators[type] || keyframes;
|
|
1705
1708
|
let mapPercentToKeyframes;
|
|
1706
1709
|
let mirroredGenerator;
|
|
1707
1710
|
if (generatorFactory !== keyframes && typeof keyframes$1[0] !== "number") {
|
|
@@ -1930,8 +1933,35 @@ const acceleratedValues = /* @__PURE__ */ new Set([
|
|
|
1930
1933
|
// "background-color"
|
|
1931
1934
|
]);
|
|
1932
1935
|
const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";
|
|
1936
|
+
const resolution = 10;
|
|
1937
|
+
const generateLinearEasing = (easing, duration) => {
|
|
1938
|
+
let points = "";
|
|
1939
|
+
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
1940
|
+
for (let i = 0; i < numPoints; i++) {
|
|
1941
|
+
points += easing(progress(0, numPoints - 1, i)) + ", ";
|
|
1942
|
+
}
|
|
1943
|
+
return `linear(${points.substring(0, points.length - 2)})`;
|
|
1944
|
+
};
|
|
1945
|
+
const supportsFlags = {
|
|
1946
|
+
linearEasing: void 0
|
|
1947
|
+
};
|
|
1948
|
+
function memoSupports(callback, supportsFlag) {
|
|
1949
|
+
const memoized = memo(callback);
|
|
1950
|
+
return () => {
|
|
1951
|
+
var _a;
|
|
1952
|
+
return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
|
|
1953
|
+
};
|
|
1954
|
+
}
|
|
1955
|
+
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
1956
|
+
try {
|
|
1957
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
1958
|
+
} catch (e) {
|
|
1959
|
+
return false;
|
|
1960
|
+
}
|
|
1961
|
+
return true;
|
|
1962
|
+
}, "linearEasing");
|
|
1933
1963
|
function isWaapiSupportedEasing(easing) {
|
|
1934
|
-
return Boolean(!easing || typeof easing === "string" && easing in supportedWaapiEasing || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
1964
|
+
return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
1935
1965
|
}
|
|
1936
1966
|
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
1937
1967
|
const supportedWaapiEasing = {
|
|
@@ -1945,16 +1975,15 @@ const supportedWaapiEasing = {
|
|
|
1945
1975
|
backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
1946
1976
|
backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
|
|
1947
1977
|
};
|
|
1948
|
-
function
|
|
1949
|
-
return mapEasingToNativeEasing(easing) || supportedWaapiEasing.easeOut;
|
|
1950
|
-
}
|
|
1951
|
-
function mapEasingToNativeEasing(easing) {
|
|
1978
|
+
function mapEasingToNativeEasing(easing, duration) {
|
|
1952
1979
|
if (!easing) {
|
|
1953
1980
|
return void 0;
|
|
1981
|
+
} else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
1982
|
+
return generateLinearEasing(easing, duration);
|
|
1954
1983
|
} else if (isBezierDefinition(easing)) {
|
|
1955
1984
|
return cubicBezierAsString(easing);
|
|
1956
1985
|
} else if (Array.isArray(easing)) {
|
|
1957
|
-
return easing.map(
|
|
1986
|
+
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
|
|
1958
1987
|
} else {
|
|
1959
1988
|
return supportedWaapiEasing[easing];
|
|
1960
1989
|
}
|
|
@@ -1963,7 +1992,7 @@ function animateStyle(element, valueName, keyframes2, { delay: delay2 = 0, durat
|
|
|
1963
1992
|
const keyframeOptions = { [valueName]: keyframes2 };
|
|
1964
1993
|
if (times)
|
|
1965
1994
|
keyframeOptions.offset = times;
|
|
1966
|
-
const easing = mapEasingToNativeEasing(ease2);
|
|
1995
|
+
const easing = mapEasingToNativeEasing(ease2, duration);
|
|
1967
1996
|
if (Array.isArray(easing))
|
|
1968
1997
|
keyframeOptions.easing = easing;
|
|
1969
1998
|
return element.animate(keyframeOptions, {
|
|
@@ -1979,7 +2008,7 @@ const supportsWaapi = /* @__PURE__ */ memo(() => Object.hasOwnProperty.call(Elem
|
|
|
1979
2008
|
const sampleDelta = 10;
|
|
1980
2009
|
const maxDuration = 2e4;
|
|
1981
2010
|
function requiresPregeneratedKeyframes(options) {
|
|
1982
|
-
return options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
2011
|
+
return isGenerator(options.type) || options.type === "spring" || !isWaapiSupportedEasing(options.ease);
|
|
1983
2012
|
}
|
|
1984
2013
|
function pregenerateKeyframes(keyframes2, options) {
|
|
1985
2014
|
const sampleAnimation = new MainThreadAnimation({
|
|
@@ -2004,6 +2033,14 @@ function pregenerateKeyframes(keyframes2, options) {
|
|
|
2004
2033
|
ease: "linear"
|
|
2005
2034
|
};
|
|
2006
2035
|
}
|
|
2036
|
+
const unsupportedEasingFunctions = {
|
|
2037
|
+
anticipate,
|
|
2038
|
+
backInOut,
|
|
2039
|
+
circInOut
|
|
2040
|
+
};
|
|
2041
|
+
function isUnsupportedEase(key) {
|
|
2042
|
+
return key in unsupportedEasingFunctions;
|
|
2043
|
+
}
|
|
2007
2044
|
class AcceleratedAnimation extends BaseAnimation {
|
|
2008
2045
|
constructor(options) {
|
|
2009
2046
|
super(options);
|
|
@@ -2017,6 +2054,9 @@ class AcceleratedAnimation extends BaseAnimation {
|
|
|
2017
2054
|
if (!((_a = motionValue2.owner) === null || _a === void 0 ? void 0 : _a.current)) {
|
|
2018
2055
|
return false;
|
|
2019
2056
|
}
|
|
2057
|
+
if (typeof ease2 === "string" && supportsLinearEasing() && isUnsupportedEase(ease2)) {
|
|
2058
|
+
ease2 = unsupportedEasingFunctions[ease2];
|
|
2059
|
+
}
|
|
2020
2060
|
if (requiresPregeneratedKeyframes(this.options)) {
|
|
2021
2061
|
const { onComplete, onUpdate, motionValue: motionValue3, element, ...options } = this.options;
|
|
2022
2062
|
const pregeneratedAnimation = pregenerateKeyframes(keyframes2, options);
|
|
@@ -2281,7 +2321,7 @@ class GroupPlaybackControls {
|
|
|
2281
2321
|
this.runAll("complete");
|
|
2282
2322
|
}
|
|
2283
2323
|
}
|
|
2284
|
-
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff
|
|
2324
|
+
const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
|
|
2285
2325
|
const valueTransition = getValueTransition(transition, name) || {};
|
|
2286
2326
|
const delay2 = valueTransition.delay || transition.delay || 0;
|
|
2287
2327
|
let { elapsed = 0 } = transition;
|
|
@@ -2299,9 +2339,7 @@ const animateMotionValue = (name, value, target, transition = {}, element, isHan
|
|
|
2299
2339
|
onComplete: () => {
|
|
2300
2340
|
onComplete();
|
|
2301
2341
|
valueTransition.onComplete && valueTransition.onComplete();
|
|
2302
|
-
onEnd && onEnd();
|
|
2303
2342
|
},
|
|
2304
|
-
onStop: onEnd,
|
|
2305
2343
|
name,
|
|
2306
2344
|
motionValue: value,
|
|
2307
2345
|
element: isHandoff ? void 0 : element
|
|
@@ -2401,7 +2439,7 @@ class MotionValue {
|
|
|
2401
2439
|
* @internal
|
|
2402
2440
|
*/
|
|
2403
2441
|
constructor(init, options = {}) {
|
|
2404
|
-
this.version = "11.
|
|
2442
|
+
this.version = "11.8.0";
|
|
2405
2443
|
this.canTrackVelocity = null;
|
|
2406
2444
|
this.events = {};
|
|
2407
2445
|
this.updateAndNotify = (v, render = true) => {
|
|
@@ -2685,34 +2723,17 @@ function getWillChangeName(name) {
|
|
|
2685
2723
|
class WillChangeMotionValue extends MotionValue {
|
|
2686
2724
|
constructor() {
|
|
2687
2725
|
super(...arguments);
|
|
2688
|
-
this.
|
|
2689
|
-
this.counts = /* @__PURE__ */ new Map();
|
|
2726
|
+
this.values = [];
|
|
2690
2727
|
}
|
|
2691
2728
|
add(name) {
|
|
2692
2729
|
const styleName = getWillChangeName(name);
|
|
2693
|
-
if (
|
|
2694
|
-
|
|
2695
|
-
const prevCount = this.counts.get(styleName) || 0;
|
|
2696
|
-
this.counts.set(styleName, prevCount + 1);
|
|
2697
|
-
if (prevCount === 0) {
|
|
2698
|
-
this.output.push(styleName);
|
|
2730
|
+
if (styleName) {
|
|
2731
|
+
addUniqueItem(this.values, styleName);
|
|
2699
2732
|
this.update();
|
|
2700
2733
|
}
|
|
2701
|
-
let hasRemoved = false;
|
|
2702
|
-
return () => {
|
|
2703
|
-
if (hasRemoved)
|
|
2704
|
-
return;
|
|
2705
|
-
hasRemoved = true;
|
|
2706
|
-
const newCount = this.counts.get(styleName) - 1;
|
|
2707
|
-
this.counts.set(styleName, newCount);
|
|
2708
|
-
if (newCount === 0) {
|
|
2709
|
-
removeItem(this.output, styleName);
|
|
2710
|
-
this.update();
|
|
2711
|
-
}
|
|
2712
|
-
};
|
|
2713
2734
|
}
|
|
2714
2735
|
update() {
|
|
2715
|
-
this.set(this.
|
|
2736
|
+
this.set(this.values.length ? this.values.join(", ") : "auto");
|
|
2716
2737
|
}
|
|
2717
2738
|
}
|
|
2718
2739
|
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
@@ -2765,7 +2786,8 @@ function animateTarget(visualElement, targetAndTransition, { delay: delay2 = 0,
|
|
|
2765
2786
|
}
|
|
2766
2787
|
}
|
|
2767
2788
|
}
|
|
2768
|
-
|
|
2789
|
+
addValueToWillChange(visualElement, key);
|
|
2790
|
+
value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key) ? { type: false } : valueTransition, visualElement, isHandoff));
|
|
2769
2791
|
const animation = value.animation;
|
|
2770
2792
|
if (animation) {
|
|
2771
2793
|
animations2.push(animation);
|
|
@@ -2832,6 +2854,27 @@ function animateVisualElement(visualElement, definition, options = {}) {
|
|
|
2832
2854
|
visualElement.notify("AnimationComplete", definition);
|
|
2833
2855
|
});
|
|
2834
2856
|
}
|
|
2857
|
+
const numVariantProps = variantProps.length;
|
|
2858
|
+
function getVariantContext(visualElement) {
|
|
2859
|
+
if (!visualElement)
|
|
2860
|
+
return void 0;
|
|
2861
|
+
if (!visualElement.isControllingVariants) {
|
|
2862
|
+
const context2 = visualElement.parent ? getVariantContext(visualElement.parent) || {} : {};
|
|
2863
|
+
if (visualElement.props.initial !== void 0) {
|
|
2864
|
+
context2.initial = visualElement.props.initial;
|
|
2865
|
+
}
|
|
2866
|
+
return context2;
|
|
2867
|
+
}
|
|
2868
|
+
const context = {};
|
|
2869
|
+
for (let i = 0; i < numVariantProps; i++) {
|
|
2870
|
+
const name = variantProps[i];
|
|
2871
|
+
const prop = visualElement.props[name];
|
|
2872
|
+
if (isVariantLabel(prop) || prop === false) {
|
|
2873
|
+
context[name] = prop;
|
|
2874
|
+
}
|
|
2875
|
+
}
|
|
2876
|
+
return context;
|
|
2877
|
+
}
|
|
2835
2878
|
const reversePriorityOrder = [...variantPriorityOrder].reverse();
|
|
2836
2879
|
const numAnimationTypes = variantPriorityOrder.length;
|
|
2837
2880
|
function animateList(visualElement) {
|
|
@@ -2854,8 +2897,8 @@ function createAnimationState(visualElement) {
|
|
|
2854
2897
|
animate = makeAnimator(visualElement);
|
|
2855
2898
|
}
|
|
2856
2899
|
function animateChanges(changedActiveType) {
|
|
2857
|
-
const props = visualElement
|
|
2858
|
-
const context = visualElement.
|
|
2900
|
+
const { props } = visualElement;
|
|
2901
|
+
const context = getVariantContext(visualElement.parent) || {};
|
|
2859
2902
|
const animations2 = [];
|
|
2860
2903
|
const removedKeys = /* @__PURE__ */ new Set();
|
|
2861
2904
|
let encounteredKeys = {};
|
|
@@ -2937,7 +2980,9 @@ function createAnimationState(visualElement) {
|
|
|
2937
2980
|
if (isInitialRender && visualElement.blockInitialAnimation) {
|
|
2938
2981
|
shouldAnimateType = false;
|
|
2939
2982
|
}
|
|
2940
|
-
|
|
2983
|
+
const willAnimateViaParent = isInherited && variantDidChange;
|
|
2984
|
+
const needsAnimating = !willAnimateViaParent || handledRemovedValues;
|
|
2985
|
+
if (shouldAnimateType && needsAnimating) {
|
|
2941
2986
|
animations2.push(...definitionList.map((animation) => ({
|
|
2942
2987
|
animation,
|
|
2943
2988
|
options: { type }
|
|
@@ -3574,7 +3619,6 @@ class VisualElementDragControls {
|
|
|
3574
3619
|
}
|
|
3575
3620
|
};
|
|
3576
3621
|
const onStart = (event, info) => {
|
|
3577
|
-
var _a;
|
|
3578
3622
|
const { drag: drag2, dragPropagation, onDragStart } = this.getProps();
|
|
3579
3623
|
if (drag2 && !dragPropagation) {
|
|
3580
3624
|
if (this.openGlobalLock)
|
|
@@ -3607,8 +3651,7 @@ class VisualElementDragControls {
|
|
|
3607
3651
|
if (onDragStart) {
|
|
3608
3652
|
frame.postRender(() => onDragStart(event, info));
|
|
3609
3653
|
}
|
|
3610
|
-
(
|
|
3611
|
-
this.removeWillChange = addValueToWillChange(this.visualElement, "transform");
|
|
3654
|
+
addValueToWillChange(this.visualElement, "transform");
|
|
3612
3655
|
const { animationState } = this.visualElement;
|
|
3613
3656
|
animationState && animationState.setActive("whileDrag", true);
|
|
3614
3657
|
};
|
|
@@ -3648,8 +3691,6 @@ class VisualElementDragControls {
|
|
|
3648
3691
|
});
|
|
3649
3692
|
}
|
|
3650
3693
|
stop(event, info) {
|
|
3651
|
-
var _a;
|
|
3652
|
-
(_a = this.removeWillChange) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
3653
3694
|
const isDragging = this.isDragging;
|
|
3654
3695
|
this.cancel();
|
|
3655
3696
|
if (!isDragging)
|
|
@@ -3761,7 +3802,8 @@ class VisualElementDragControls {
|
|
|
3761
3802
|
}
|
|
3762
3803
|
startAxisValueAnimation(axis, transition) {
|
|
3763
3804
|
const axisValue = this.getAxisMotionValue(axis);
|
|
3764
|
-
|
|
3805
|
+
addValueToWillChange(this.visualElement, axis);
|
|
3806
|
+
return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));
|
|
3765
3807
|
}
|
|
3766
3808
|
stopAnimation() {
|
|
3767
3809
|
eachAxis((axis) => this.getAxisMotionValue(axis).stop());
|
|
@@ -4693,9 +4735,9 @@ function createProjectionNode$1({ attachResizeListener, defaultParent, measureSc
|
|
|
4693
4735
|
frameData.delta = clamp(0, 1e3 / 60, now2 - frameData.timestamp);
|
|
4694
4736
|
frameData.timestamp = now2;
|
|
4695
4737
|
frameData.isProcessing = true;
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4738
|
+
frameSteps.update.process(frameData);
|
|
4739
|
+
frameSteps.preRender.process(frameData);
|
|
4740
|
+
frameSteps.render.process(frameData);
|
|
4699
4741
|
frameData.isProcessing = false;
|
|
4700
4742
|
}
|
|
4701
4743
|
didUpdate() {
|
|
@@ -6561,7 +6603,7 @@ function updateMotionValuesFromProps(element, next, prev) {
|
|
|
6561
6603
|
if (isMotionValue(nextValue)) {
|
|
6562
6604
|
element.addValue(key, nextValue);
|
|
6563
6605
|
if (process.env.NODE_ENV === "development") {
|
|
6564
|
-
warnOnce(nextValue.version === "11.
|
|
6606
|
+
warnOnce(nextValue.version === "11.8.0", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.8.0 may not work as expected.`);
|
|
6565
6607
|
}
|
|
6566
6608
|
} else if (isMotionValue(prevValue)) {
|
|
6567
6609
|
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
@@ -6597,7 +6639,6 @@ const propEventHandlers = [
|
|
|
6597
6639
|
"LayoutAnimationStart",
|
|
6598
6640
|
"LayoutAnimationComplete"
|
|
6599
6641
|
];
|
|
6600
|
-
const numVariantProps = variantProps.length;
|
|
6601
6642
|
class VisualElement {
|
|
6602
6643
|
/**
|
|
6603
6644
|
* This method takes React props and returns found MotionValues. For example, HTML
|
|
@@ -6625,16 +6666,16 @@ class VisualElement {
|
|
|
6625
6666
|
this.propEventSubscriptions = {};
|
|
6626
6667
|
this.notifyUpdate = () => this.notify("Update", this.latestValues);
|
|
6627
6668
|
this.render = () => {
|
|
6628
|
-
this.isRenderScheduled = false;
|
|
6629
6669
|
if (!this.current)
|
|
6630
6670
|
return;
|
|
6631
6671
|
this.triggerBuild();
|
|
6632
6672
|
this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
|
|
6633
6673
|
};
|
|
6634
|
-
this.
|
|
6674
|
+
this.renderScheduledAt = 0;
|
|
6635
6675
|
this.scheduleRender = () => {
|
|
6636
|
-
|
|
6637
|
-
|
|
6676
|
+
const now2 = time.now();
|
|
6677
|
+
if (this.renderScheduledAt < now2) {
|
|
6678
|
+
this.renderScheduledAt = now2;
|
|
6638
6679
|
frame.render(this.render, false, true);
|
|
6639
6680
|
}
|
|
6640
6681
|
};
|
|
@@ -6826,27 +6867,6 @@ class VisualElement {
|
|
|
6826
6867
|
getClosestVariantNode() {
|
|
6827
6868
|
return this.isVariantNode ? this : this.parent ? this.parent.getClosestVariantNode() : void 0;
|
|
6828
6869
|
}
|
|
6829
|
-
getVariantContext(startAtParent = false) {
|
|
6830
|
-
if (startAtParent) {
|
|
6831
|
-
return this.parent ? this.parent.getVariantContext() : void 0;
|
|
6832
|
-
}
|
|
6833
|
-
if (!this.isControllingVariants) {
|
|
6834
|
-
const context2 = this.parent ? this.parent.getVariantContext() || {} : {};
|
|
6835
|
-
if (this.props.initial !== void 0) {
|
|
6836
|
-
context2.initial = this.props.initial;
|
|
6837
|
-
}
|
|
6838
|
-
return context2;
|
|
6839
|
-
}
|
|
6840
|
-
const context = {};
|
|
6841
|
-
for (let i = 0; i < numVariantProps; i++) {
|
|
6842
|
-
const name = variantProps[i];
|
|
6843
|
-
const prop = this.props[name];
|
|
6844
|
-
if (isVariantLabel(prop) || prop === false) {
|
|
6845
|
-
context[name] = prop;
|
|
6846
|
-
}
|
|
6847
|
-
}
|
|
6848
|
-
return context;
|
|
6849
|
-
}
|
|
6850
6870
|
/**
|
|
6851
6871
|
* Add a child visual element to our set of children.
|
|
6852
6872
|
*/
|
|
@@ -7281,9 +7301,9 @@ const AnimatedVisibility = (props) => {
|
|
|
7281
7301
|
exit: { opacity: 0, scale: 0.9 }
|
|
7282
7302
|
},
|
|
7283
7303
|
scaleRotateFade: {
|
|
7284
|
-
initial: { opacity: 0, scale: 0.95, rotate: "-
|
|
7304
|
+
initial: { opacity: 0, scale: 0.95, rotate: "-10deg" },
|
|
7285
7305
|
animate: { opacity: 1, scale: 1, rotate: "0deg" },
|
|
7286
|
-
exit: { opacity: 0, scale: 0.95, rotate: "-
|
|
7306
|
+
exit: { opacity: 0, scale: 0.95, rotate: "-10deg" }
|
|
7287
7307
|
}
|
|
7288
7308
|
};
|
|
7289
7309
|
return /* @__PURE__ */ jsx(AnimatePresence, { initial: !noInitial, children: visible && /* @__PURE__ */ jsx(
|
|
@@ -7292,6 +7312,7 @@ const AnimatedVisibility = (props) => {
|
|
|
7292
7312
|
initial: transitions[transition].initial,
|
|
7293
7313
|
animate: transitions[transition].animate,
|
|
7294
7314
|
exit: transitions[transition].exit,
|
|
7315
|
+
transition: { type: "spring", damping: 15, stiffness: 225 },
|
|
7295
7316
|
className,
|
|
7296
7317
|
...other,
|
|
7297
7318
|
children
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { a as $4e85f108e88277b8$export$b085522c77523c51 } from "../../RSPContexts-2lR5GG9p.js";
|
|
3
3
|
import { a as $64fa3d84918910a7$export$29f1550f4b0d4415, $ as $64fa3d84918910a7$export$fabf2dc03a41866e, l as $df56164dff5785e2$export$4338b53315abf666, m as $5dc95899b306f630$export$c9058316764c140e, b as $64fa3d84918910a7$export$4d86445c2cf5e3, c as $3ef42575df84b30b$export$9d1611c77c2fe928 } from "../../utils-Du2x3YVu.js";
|
|
4
4
|
import { $ as $d3e0e05bdfcf66bd$export$c24727297075ec6a } from "../../Form-Cq3fu75_.js";
|
|
5
5
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { _ as __ } from "../../default-i18n-BqWys-1G.js";
|
|
3
|
-
import { Menu,
|
|
3
|
+
import { Menu, MenuItem, MenuSeparator, MenuSection } 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";
|
|
@@ -24,10 +24,11 @@ import { icons } from "../../icons/icons.js";
|
|
|
24
24
|
* @param {boolean} [props.showColorCode] - If `true`, the HEX color code is shown below the color name.
|
|
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
|
-
* @param {boolean} [props.clearable] - If `true`, the color can be
|
|
27
|
+
* @param {boolean} [props.clearable] - If `true`, the picked color can be removed.
|
|
28
28
|
* @param {boolean} [props.stacked] - If `true`, the control is not rendered inline.
|
|
29
29
|
* @param {boolean} [props.hidden] - If `true`, the component is not rendered.
|
|
30
30
|
* @param {string} [props.tooltip] - If provided, overrides the default tooltip text. If there is no label, the value will still be shown within the tooltip.
|
|
31
|
+
* @param {string} [props.clearItemLabel] - Label for the "None" item, if `clearable` is enabled.
|
|
31
32
|
*
|
|
32
33
|
* @returns {JSX.Element} The ColorPicker component.
|
|
33
34
|
*
|
|
@@ -64,6 +65,7 @@ const ColorPicker = (props) => {
|
|
|
64
65
|
type = "default",
|
|
65
66
|
stacked,
|
|
66
67
|
clearable,
|
|
68
|
+
clearItemLabel = __("None", "eightshift-ui-components"),
|
|
67
69
|
hidden,
|
|
68
70
|
tooltip,
|
|
69
71
|
...rest
|
|
@@ -117,15 +119,8 @@ const ColorPicker = (props) => {
|
|
|
117
119
|
color
|
|
118
120
|
}
|
|
119
121
|
),
|
|
120
|
-
onClick: () =>
|
|
121
|
-
|
|
122
|
-
onChange(void 0);
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
onChange(slug);
|
|
126
|
-
},
|
|
127
|
-
checked: clearable ? value === slug : null,
|
|
128
|
-
selected: !clearable ? value === slug : null,
|
|
122
|
+
onClick: () => onChange(slug),
|
|
123
|
+
selected: value === slug,
|
|
129
124
|
children: [
|
|
130
125
|
!showColorCode && name,
|
|
131
126
|
showColorCode && /* @__PURE__ */ jsx(
|
|
@@ -215,6 +210,18 @@ const ColorPicker = (props) => {
|
|
|
215
210
|
},
|
|
216
211
|
...rest,
|
|
217
212
|
children: [
|
|
213
|
+
clearable && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
MenuItem,
|
|
216
|
+
{
|
|
217
|
+
onClick: () => onChange(void 0),
|
|
218
|
+
selected: typeof value === "undefined",
|
|
219
|
+
endIcon: /* @__PURE__ */ jsx(ColorSwatch, { className: "!es-uic-size-5.5" }),
|
|
220
|
+
children: clearItemLabel
|
|
221
|
+
}
|
|
222
|
+
),
|
|
223
|
+
/* @__PURE__ */ jsx(MenuSeparator, {})
|
|
224
|
+
] }),
|
|
218
225
|
(noColorGroups || !hasColorGroups) && colors.map((color) => /* @__PURE__ */ jsx(
|
|
219
226
|
SingleItem,
|
|
220
227
|
{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import React__default, { forwardRef, useContext, createContext, useMemo, useRef, useState, useCallback } from "react";
|
|
3
|
-
import { b as $4e85f108e88277b8$export$ebe63fadcdce34ed, c as $4e85f108e88277b8$export$44644b8a16031b5b, d as $4e85f108e88277b8$export$717b2c0a523a0b53 } from "../../RSPContexts-
|
|
3
|
+
import { b as $4e85f108e88277b8$export$ebe63fadcdce34ed, c as $4e85f108e88277b8$export$44644b8a16031b5b, d as $4e85f108e88277b8$export$717b2c0a523a0b53 } from "../../RSPContexts-2lR5GG9p.js";
|
|
4
4
|
import { b as $64fa3d84918910a7$export$4d86445c2cf5e3, c as $3ef42575df84b30b$export$9d1611c77c2fe928, e as $bdb11010cef70236$export$f680877a34711e37, a as $64fa3d84918910a7$export$29f1550f4b0d4415, i as $64fa3d84918910a7$export$2881499e37b75b9a, g as $64fa3d84918910a7$export$9d4c57ee4c6ffdd8, h as $64fa3d84918910a7$export$ef03459518577ad4 } from "../../utils-Du2x3YVu.js";
|
|
5
5
|
import { $ as $65484d02dcb7eb3e$export$457c3d6518dd4c6f } from "../../filterDOMProps-EDDcM64A.js";
|
|
6
6
|
import { $ as $f7dceffc5ad7768b$export$4e328f61c538687f } from "../../useFocusRing-rz8eyzby.js";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { c as clsx } from "../../lite-DVmmD_-j.js";
|
|
3
|
+
import "../../default-i18n-BqWys-1G.js";
|
|
4
|
+
import { DraggableContext } from "./draggable-context.js";
|
|
5
|
+
import { useContext } from "react";
|
|
6
|
+
import { icons } from "../../icons/icons.js";
|
|
7
|
+
import "../../react-jsx-parser.min-sPC96O_U.js";
|
|
8
|
+
/**
|
|
9
|
+
* A Draggable item handle.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {Object} props - Component props.
|
|
13
|
+
* @param {string} [props.className] - Classes to pass to the handle.
|
|
14
|
+
*
|
|
15
|
+
* @returns {JSX.Element} The DraggableHandle component.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <DraggableHandle />
|
|
19
|
+
*
|
|
20
|
+
* @preserve
|
|
21
|
+
*/
|
|
22
|
+
const DraggableHandle = (props) => {
|
|
23
|
+
const { className, children, ...rest } = props;
|
|
24
|
+
const { handleRef, status } = useContext(DraggableContext);
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
className: clsx(
|
|
29
|
+
"es-uic-flex es-uic-h-5 es-uic-w-4 es-uic-cursor-pointer es-uic-items-center es-uic-justify-center es-uic-rounded es-uic-border es-uic-border-gray-200 es-uic-bg-white es-uic-text-gray-400 es-uic-transition",
|
|
30
|
+
"[&>svg]:es-uic-size-4 [&>svg]:es-uic-shrink-0",
|
|
31
|
+
"active:es-uic-border-teal-500/30 active:es-uic-bg-teal-50 active:es-uic-text-teal-500",
|
|
32
|
+
"focus:es-uic-outline-none focus-visible:es-uic-border-teal-500 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",
|
|
33
|
+
"hover:es-uic-text-teal-500",
|
|
34
|
+
status === "dragging" && "!es-uic-border-teal-600 !es-uic-bg-teal-500 !es-uic-text-white es-uic-shadow-sm es-uic-shadow-teal-500/30",
|
|
35
|
+
className
|
|
36
|
+
),
|
|
37
|
+
ref: handleRef,
|
|
38
|
+
...rest,
|
|
39
|
+
children: children ?? icons.reorderGrabberV
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
DraggableHandle
|
|
45
|
+
};
|