@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/components/ColorWheel/index.cjs +43 -63
- package/dist/components/ColorWheel/index.cjs.map +1 -1
- package/dist/components/ColorWheel/index.css +0 -1
- 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 -1
- 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
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
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
"
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
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",
|