@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.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
|
-
|
|
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
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
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",
|