@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.js CHANGED
@@ -4878,11 +4878,6 @@ var ARC_A1 = 150;
4878
4878
  var ARC_HANDLE_R_FRAC = 152 / 380;
4879
4879
  var PICKER_HEIGHT_WITH_ARC = 265;
4880
4880
  var PICKER_HEIGHT_NO_ARC = 224;
4881
- var CHIP_SIZE = 26;
4882
- var CHIP_GAP = 7;
4883
- function recentsContentWidth(chipCount) {
4884
- return chipCount > 0 ? chipCount * CHIP_SIZE + (chipCount - 1) * CHIP_GAP : 0;
4885
- }
4886
4881
  var MODES_HSV = ["h", "s", "v"];
4887
4882
  var MODES_HSVA = ["h", "s", "v", "a"];
4888
4883
  function ringGradient(mode, hsv) {
@@ -4929,14 +4924,6 @@ function ColorWheel({
4929
4924
  const [editValue, setEditValue] = useState("");
4930
4925
  const [eyedropperSupported, setEyedropperSupported] = useState(false);
4931
4926
  const [removingHexes, setRemovingHexes] = useState(/* @__PURE__ */ new Set());
4932
- const [recentsGrown, setRecentsGrown] = useState(false);
4933
- const recentsGrowRaf = useRef(0);
4934
- useEffect(() => {
4935
- recentsGrowRaf.current = requestAnimationFrame(() => {
4936
- recentsGrowRaf.current = requestAnimationFrame(() => setRecentsGrown(true));
4937
- });
4938
- return () => cancelAnimationFrame(recentsGrowRaf.current);
4939
- }, []);
4940
4927
  const accentVars = accent ? accentToCssVars(deriveAccent(accent), "colorwheel") : {};
4941
4928
  const lastEmitted = useRef(value);
4942
4929
  useEffect(() => {
@@ -5154,56 +5141,49 @@ function ColorWheel({
5154
5141
  ...size !== 1 ? { transform: `scale(${size})`, transformOrigin: "top center" } : void 0
5155
5142
  },
5156
5143
  children: [
5157
- (favorites.length > 0 || onFavoritesChange) && /* @__PURE__ */ jsx(
5158
- "div",
5159
- {
5160
- className: [ColorWheel_module_default.recents, favorites.length === 0 ? ColorWheel_module_default.recentsEmpty : ""].join(" "),
5161
- style: { width: recentsGrown ? recentsContentWidth(favorites.length) : 0 },
5162
- children: favorites.map((hex, i) => (
5163
- // keyed by hex alone (not index) so an add/remove -- which
5164
- // shifts every other item's index -- doesn't remount and replay
5165
- // the entrance animation on chips that were already there; only
5166
- // a genuinely new hex mounts fresh and animates in
5167
- /* @__PURE__ */ jsxs(
5168
- "div",
5169
- {
5170
- className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
5171
- style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
5172
- onAnimationEnd: (e) => {
5173
- if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
5174
- },
5175
- children: [
5176
- /* @__PURE__ */ jsx(
5177
- "button",
5178
- {
5179
- type: "button",
5180
- className: ColorWheel_module_default.chip,
5181
- style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
5182
- title: hex,
5183
- "aria-label": `Apply color ${hex}`,
5184
- onClick: () => applyFavorite(hex)
5185
- }
5186
- ),
5187
- /* @__PURE__ */ jsx(
5188
- "button",
5189
- {
5190
- type: "button",
5191
- className: ColorWheel_module_default.chipRemove,
5192
- "aria-label": `Remove ${hex} from favorites`,
5193
- onClick: (e) => {
5194
- e.stopPropagation();
5195
- removeFavorite(hex);
5196
- },
5197
- children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "M6 6l12 12M18 6L6 18" }) })
5198
- }
5199
- )
5200
- ]
5201
- },
5202
- hex
5203
- )
5204
- ))
5205
- }
5206
- ),
5144
+ (favorites.length > 0 || onFavoritesChange) && /* @__PURE__ */ jsx("div", { className: [ColorWheel_module_default.recents, favorites.length === 0 ? ColorWheel_module_default.recentsEmpty : ""].join(" "), children: favorites.map((hex, i) => (
5145
+ // keyed by hex alone (not index) so an add/remove -- which
5146
+ // shifts every other item's index -- doesn't remount and replay
5147
+ // the entrance animation on chips that were already there; only
5148
+ // a genuinely new hex mounts fresh and animates in
5149
+ /* @__PURE__ */ jsxs(
5150
+ "div",
5151
+ {
5152
+ className: [ColorWheel_module_default.chipWrap, removingHexes.has(hex) ? ColorWheel_module_default.chipWrapRemoving : ""].join(" "),
5153
+ style: { animationDelay: removingHexes.has(hex) ? void 0 : `${i * 0.05}s` },
5154
+ onAnimationEnd: (e) => {
5155
+ if (e.target === e.currentTarget && e.animationName.includes("chipOut")) handleChipRemoveEnd(hex);
5156
+ },
5157
+ children: [
5158
+ /* @__PURE__ */ jsx(
5159
+ "button",
5160
+ {
5161
+ type: "button",
5162
+ className: ColorWheel_module_default.chip,
5163
+ style: { background: hex.length > 7 ? hex.slice(0, 7) : hex },
5164
+ title: hex,
5165
+ "aria-label": `Apply color ${hex}`,
5166
+ onClick: () => applyFavorite(hex)
5167
+ }
5168
+ ),
5169
+ /* @__PURE__ */ jsx(
5170
+ "button",
5171
+ {
5172
+ type: "button",
5173
+ className: ColorWheel_module_default.chipRemove,
5174
+ "aria-label": `Remove ${hex} from favorites`,
5175
+ onClick: (e) => {
5176
+ e.stopPropagation();
5177
+ removeFavorite(hex);
5178
+ },
5179
+ children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 3, strokeLinecap: "round", children: /* @__PURE__ */ jsx("path", { d: "M6 6l12 12M18 6L6 18" }) })
5180
+ }
5181
+ )
5182
+ ]
5183
+ },
5184
+ hex
5185
+ )
5186
+ )) }),
5207
5187
  /* @__PURE__ */ jsxs("div", { className: ColorWheel_module_default.picker, style: { height: arcVisible ? PICKER_HEIGHT_WITH_ARC : PICKER_HEIGHT_NO_ARC }, children: [
5208
5188
  /* @__PURE__ */ jsx(
5209
5189
  "div",