@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.
package/dist/index.cjs CHANGED
@@ -4886,11 +4886,6 @@ var ARC_A1 = 150;
4886
4886
  var ARC_HANDLE_R_FRAC = 152 / 380;
4887
4887
  var PICKER_HEIGHT_WITH_ARC = 265;
4888
4888
  var PICKER_HEIGHT_NO_ARC = 224;
4889
- var CHIP_SIZE = 26;
4890
- var CHIP_GAP = 7;
4891
- function recentsContentWidth(chipCount) {
4892
- return chipCount > 0 ? chipCount * CHIP_SIZE + (chipCount - 1) * CHIP_GAP : 0;
4893
- }
4894
4889
  var MODES_HSV = ["h", "s", "v"];
4895
4890
  var MODES_HSVA = ["h", "s", "v", "a"];
4896
4891
  function ringGradient(mode, hsv) {
@@ -4937,14 +4932,6 @@ function ColorWheel({
4937
4932
  const [editValue, setEditValue] = React.useState("");
4938
4933
  const [eyedropperSupported, setEyedropperSupported] = React.useState(false);
4939
4934
  const [removingHexes, setRemovingHexes] = React.useState(/* @__PURE__ */ new Set());
4940
- const [recentsGrown, setRecentsGrown] = React.useState(false);
4941
- const recentsGrowRaf = React.useRef(0);
4942
- React.useEffect(() => {
4943
- recentsGrowRaf.current = requestAnimationFrame(() => {
4944
- recentsGrowRaf.current = requestAnimationFrame(() => setRecentsGrown(true));
4945
- });
4946
- return () => cancelAnimationFrame(recentsGrowRaf.current);
4947
- }, []);
4948
4935
  const accentVars = accent ? accentToCssVars(deriveAccent(accent), "colorwheel") : {};
4949
4936
  const lastEmitted = React.useRef(value);
4950
4937
  React.useEffect(() => {
@@ -5162,56 +5149,49 @@ function ColorWheel({
5162
5149
  ...size !== 1 ? { transform: `scale(${size})`, transformOrigin: "top center" } : void 0
5163
5150
  },
5164
5151
  children: [
5165
- (favorites.length > 0 || onFavoritesChange) && /* @__PURE__ */ jsxRuntime.jsx(
5166
- "div",
5167
- {
5168
- className: [ColorWheel_module_default.recents, favorites.length === 0 ? ColorWheel_module_default.recentsEmpty : ""].join(" "),
5169
- style: { width: recentsGrown ? recentsContentWidth(favorites.length) : 0 },
5170
- children: favorites.map((hex, i) => (
5171
- // keyed by hex alone (not index) so an add/remove -- which
5172
- // shifts every other item's index -- doesn't remount and replay
5173
- // the entrance animation on chips that were already there; only
5174
- // a genuinely new hex mounts fresh and animates in
5175
- /* @__PURE__ */ jsxRuntime.jsxs(
5176
- "div",
5177
- {
5178
- className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
5179
- style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
5180
- onAnimationEnd: (e) => {
5181
- if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
5182
- },
5183
- children: [
5184
- /* @__PURE__ */ jsxRuntime.jsx(
5185
- "button",
5186
- {
5187
- type: "button",
5188
- className: ColorWheel_module_default.chip,
5189
- style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
5190
- title: hex,
5191
- "aria-label": `Apply color ${hex}`,
5192
- onClick: () => applyFavorite(hex)
5193
- }
5194
- ),
5195
- /* @__PURE__ */ jsxRuntime.jsx(
5196
- "button",
5197
- {
5198
- type: "button",
5199
- className: ColorWheel_module_default.chipRemove,
5200
- "aria-label": `Remove ${hex} from favorites`,
5201
- onClick: (e) => {
5202
- e.stopPropagation();
5203
- removeFavorite(hex);
5204
- },
5205
- 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" }) })
5206
- }
5207
- )
5208
- ]
5209
- },
5210
- hex
5211
- )
5212
- ))
5213
- }
5214
- ),
5152
+ (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) => (
5153
+ // keyed by hex alone (not index) so an add/remove -- which
5154
+ // shifts every other item's index -- doesn't remount and replay
5155
+ // the entrance animation on chips that were already there; only
5156
+ // a genuinely new hex mounts fresh and animates in
5157
+ /* @__PURE__ */ jsxRuntime.jsxs(
5158
+ "div",
5159
+ {
5160
+ className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
5161
+ style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
5162
+ onAnimationEnd: (e) => {
5163
+ if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
5164
+ },
5165
+ children: [
5166
+ /* @__PURE__ */ jsxRuntime.jsx(
5167
+ "button",
5168
+ {
5169
+ type: "button",
5170
+ className: ColorWheel_module_default.chip,
5171
+ style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
5172
+ title: hex,
5173
+ "aria-label": `Apply color ${hex}`,
5174
+ onClick: () => applyFavorite(hex)
5175
+ }
5176
+ ),
5177
+ /* @__PURE__ */ jsxRuntime.jsx(
5178
+ "button",
5179
+ {
5180
+ type: "button",
5181
+ className: ColorWheel_module_default.chipRemove,
5182
+ "aria-label": `Remove ${hex} from favorites`,
5183
+ onClick: (e) => {
5184
+ e.stopPropagation();
5185
+ removeFavorite(hex);
5186
+ },
5187
+ 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" }) })
5188
+ }
5189
+ )
5190
+ ]
5191
+ },
5192
+ hex
5193
+ )
5194
+ )) }),
5215
5195
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ColorWheel_module_default.picker, style: { height: arcVisible ? PICKER_HEIGHT_WITH_ARC : PICKER_HEIGHT_NO_ARC }, children: [
5216
5196
  /* @__PURE__ */ jsxRuntime.jsx(
5217
5197
  "div",