@fab1o978/react-ui 0.2.3 → 0.2.4
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/components/ColorWheel/index.cjs +43 -63
- package/dist/components/ColorWheel/index.cjs.map +1 -1
- package/dist/components/ColorWheel/index.css +0 -2
- package/dist/components/ColorWheel/index.css.map +1 -1
- package/dist/components/ColorWheel/index.js +43 -63
- package/dist/components/ColorWheel/index.js.map +1 -1
- package/dist/index.cjs +43 -63
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +0 -2
- package/dist/index.css.map +1 -1
- package/dist/index.js +43 -63
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -270,11 +270,6 @@ var ARC_A1 = 150;
|
|
|
270
270
|
var ARC_HANDLE_R_FRAC = 152 / 380;
|
|
271
271
|
var PICKER_HEIGHT_WITH_ARC = 265;
|
|
272
272
|
var PICKER_HEIGHT_NO_ARC = 224;
|
|
273
|
-
var CHIP_SIZE = 26;
|
|
274
|
-
var CHIP_GAP = 7;
|
|
275
|
-
function recentsContentWidth(chipCount) {
|
|
276
|
-
return chipCount > 0 ? chipCount * CHIP_SIZE + (chipCount - 1) * CHIP_GAP : 0;
|
|
277
|
-
}
|
|
278
273
|
var MODES_HSV = ["h", "s", "v"];
|
|
279
274
|
var MODES_HSVA = ["h", "s", "v", "a"];
|
|
280
275
|
function ringGradient(mode, hsv) {
|
|
@@ -321,14 +316,6 @@ function ColorWheel({
|
|
|
321
316
|
const [editValue, setEditValue] = react.useState("");
|
|
322
317
|
const [eyedropperSupported, setEyedropperSupported] = react.useState(false);
|
|
323
318
|
const [removingHexes, setRemovingHexes] = react.useState(/* @__PURE__ */ new Set());
|
|
324
|
-
const [recentsGrown, setRecentsGrown] = react.useState(false);
|
|
325
|
-
const recentsGrowRaf = react.useRef(0);
|
|
326
|
-
react.useEffect(() => {
|
|
327
|
-
recentsGrowRaf.current = requestAnimationFrame(() => {
|
|
328
|
-
recentsGrowRaf.current = requestAnimationFrame(() => setRecentsGrown(true));
|
|
329
|
-
});
|
|
330
|
-
return () => cancelAnimationFrame(recentsGrowRaf.current);
|
|
331
|
-
}, []);
|
|
332
319
|
const accentVars = accent ? accentToCssVars(deriveAccent(accent), "colorwheel") : {};
|
|
333
320
|
const lastEmitted = react.useRef(value);
|
|
334
321
|
react.useEffect(() => {
|
|
@@ -546,56 +533,49 @@ function ColorWheel({
|
|
|
546
533
|
...size !== 1 ? { transform: `scale(${size})`, transformOrigin: "top center" } : void 0
|
|
547
534
|
},
|
|
548
535
|
children: [
|
|
549
|
-
(favorites.length > 0 || onFavoritesChange) && /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
"
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
]
|
|
593
|
-
},
|
|
594
|
-
hex
|
|
595
|
-
)
|
|
596
|
-
))
|
|
597
|
-
}
|
|
598
|
-
),
|
|
536
|
+
(favorites.length > 0 || onFavoritesChange) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: [ColorWheel_module_default.recents, favorites.length === 0 ? ColorWheel_module_default.recentsEmpty : ""].join(" "), children: favorites.map((hex, i) => (
|
|
537
|
+
// keyed by hex alone (not index) so an add/remove -- which
|
|
538
|
+
// shifts every other item's index -- doesn't remount and replay
|
|
539
|
+
// the entrance animation on chips that were already there; only
|
|
540
|
+
// a genuinely new hex mounts fresh and animates in
|
|
541
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
542
|
+
"div",
|
|
543
|
+
{
|
|
544
|
+
className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
|
|
545
|
+
style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
|
|
546
|
+
onAnimationEnd: (e) => {
|
|
547
|
+
if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
|
|
548
|
+
},
|
|
549
|
+
children: [
|
|
550
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
551
|
+
"button",
|
|
552
|
+
{
|
|
553
|
+
type: "button",
|
|
554
|
+
className: ColorWheel_module_default.chip,
|
|
555
|
+
style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
|
|
556
|
+
title: hex,
|
|
557
|
+
"aria-label": `Apply color ${hex}`,
|
|
558
|
+
onClick: () => applyFavorite(hex)
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
562
|
+
"button",
|
|
563
|
+
{
|
|
564
|
+
type: "button",
|
|
565
|
+
className: ColorWheel_module_default.chipRemove,
|
|
566
|
+
"aria-label": `Remove ${hex} from favorites`,
|
|
567
|
+
onClick: (e) => {
|
|
568
|
+
e.stopPropagation();
|
|
569
|
+
removeFavorite(hex);
|
|
570
|
+
},
|
|
571
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 6l12 12M18 6L6 18" }) })
|
|
572
|
+
}
|
|
573
|
+
)
|
|
574
|
+
]
|
|
575
|
+
},
|
|
576
|
+
hex
|
|
577
|
+
)
|
|
578
|
+
)) }),
|
|
599
579
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorWheel_module_default.picker, style: { height: arcVisible ? PICKER_HEIGHT_WITH_ARC : PICKER_HEIGHT_NO_ARC }, children: [
|
|
600
580
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
601
581
|
"div",
|