@fab1o978/react-ui 0.2.2 → 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.
@@ -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
- "div",
551
- {
552
- className: [ColorWheel_module_default.recents, favorites.length === 0 ? ColorWheel_module_default.recentsEmpty : ""].join(" "),
553
- style: { width: recentsGrown ? recentsContentWidth(favorites.length) : 0 },
554
- children: favorites.map((hex, i) => (
555
- // keyed by hex alone (not index) so an add/remove -- which
556
- // shifts every other item's index -- doesn't remount and replay
557
- // the entrance animation on chips that were already there; only
558
- // a genuinely new hex mounts fresh and animates in
559
- /* @__PURE__ */ jsxRuntime.jsxs(
560
- "div",
561
- {
562
- className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
563
- style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
564
- onAnimationEnd: (e) => {
565
- if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
566
- },
567
- children: [
568
- /* @__PURE__ */ jsxRuntime.jsx(
569
- "button",
570
- {
571
- type: "button",
572
- className: ColorWheel_module_default.chip,
573
- style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
574
- title: hex,
575
- "aria-label": `Apply color ${hex}`,
576
- onClick: () => applyFavorite(hex)
577
- }
578
- ),
579
- /* @__PURE__ */ jsxRuntime.jsx(
580
- "button",
581
- {
582
- type: "button",
583
- className: ColorWheel_module_default.chipRemove,
584
- "aria-label": `Remove ${hex} from favorites`,
585
- onClick: (e) => {
586
- e.stopPropagation();
587
- removeFavorite(hex);
588
- },
589
- 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" }) })
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",