unifyedx-storybook-new 0.1.54 → 0.1.55
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.
|
@@ -772,7 +772,6 @@ const fnv1a = (str) => {
|
|
|
772
772
|
};
|
|
773
773
|
|
|
774
774
|
const generatePastelColor = (word) => {
|
|
775
|
-
console.log(word, 'checking word');
|
|
776
775
|
const w = (word ?? "").trim().toLowerCase();
|
|
777
776
|
|
|
778
777
|
// Pull out any trailing number (e.g., "Unifyed3" -> 3)
|
|
@@ -782,10 +781,10 @@ const generatePastelColor = (word) => {
|
|
|
782
781
|
const hash = fnv1a(w);
|
|
783
782
|
|
|
784
783
|
// Distribute across channels and offset by numeric suffix
|
|
785
|
-
const hue = (hash % 360 + 37 * suffixNum) % 360;
|
|
786
|
-
const sat = 55 + ((hash >>> 8) % 20);
|
|
787
|
-
const lightText = 30 + ((hash >>> 16) % 10);
|
|
788
|
-
const lightBg = 86 + ((hash >>> 24) % 8);
|
|
784
|
+
const hue = ((hash % 360) + 37 * suffixNum) % 360; // 37 is coprime with 360
|
|
785
|
+
const sat = 55 + ((hash >>> 8) % 20); // 55–74%
|
|
786
|
+
const lightText = 30 + ((hash >>> 16) % 10); // 30–39% (text)
|
|
787
|
+
const lightBg = 86 + ((hash >>> 24) % 8); // 86–93% (pastel bg)
|
|
789
788
|
|
|
790
789
|
const backgroundColor = `hsl(${hue}, ${sat}%, ${lightBg}%)`;
|
|
791
790
|
const color = `hsl(${hue}, ${sat}%, ${lightText}%)`;
|
|
@@ -76380,7 +76379,10 @@ const ManageCollectionList = ({
|
|
|
76380
76379
|
}) => {
|
|
76381
76380
|
const [editingId, setEditingId] = useState(null);
|
|
76382
76381
|
const [draftName, setDraftName] = useState("");
|
|
76383
|
-
const [linksData, setLinksData] = useState(
|
|
76382
|
+
const [linksData, setLinksData] = useState(() => {
|
|
76383
|
+
if (Array.isArray(initialData)) return initialData;
|
|
76384
|
+
return [];
|
|
76385
|
+
});
|
|
76384
76386
|
const [draggingId, setDraggingId] = useState(null);
|
|
76385
76387
|
const [dragOverId, setDragOverId] = useState(null);
|
|
76386
76388
|
const [searchValue, setSearchValue] = useState("");
|
|
@@ -76408,6 +76410,11 @@ const ManageCollectionList = ({
|
|
|
76408
76410
|
getListData();
|
|
76409
76411
|
}
|
|
76410
76412
|
}, [initialData]);
|
|
76413
|
+
useEffect(() => {
|
|
76414
|
+
if (Array.isArray(initialData)) {
|
|
76415
|
+
setLinksData(initialData);
|
|
76416
|
+
}
|
|
76417
|
+
}, [initialData]);
|
|
76411
76418
|
const startEdit = (item) => {
|
|
76412
76419
|
if (!allowEdit) return;
|
|
76413
76420
|
setEditingId(item.id);
|
|
@@ -76447,7 +76454,7 @@ const ManageCollectionList = ({
|
|
|
76447
76454
|
if (isTemp) {
|
|
76448
76455
|
const resp = await axiosPost(endpoints.collectionCreate, {
|
|
76449
76456
|
categoryName: draftName.trim(),
|
|
76450
|
-
order: (linksData.at(-1)?.order ?? 0) + 1
|
|
76457
|
+
order: (Array.isArray(linksData) && linksData.length > 0 ? linksData.at(-1)?.order ?? 0 : 0) + 1
|
|
76451
76458
|
});
|
|
76452
76459
|
if (resp) {
|
|
76453
76460
|
setLinksData((prev) => {
|
|
@@ -76545,9 +76552,9 @@ const ManageCollectionList = ({
|
|
|
76545
76552
|
setDraggingId(null);
|
|
76546
76553
|
setDragOverId(null);
|
|
76547
76554
|
};
|
|
76548
|
-
const filteredData = linksData.filter(
|
|
76555
|
+
const filteredData = Array.isArray(linksData) ? linksData.filter(
|
|
76549
76556
|
(item) => item.categoryName?.toLowerCase().includes(searchValue.toLowerCase())
|
|
76550
|
-
);
|
|
76557
|
+
) : [];
|
|
76551
76558
|
return /* @__PURE__ */ jsxs("div", { className: `manage-collection-list ${className}`, children: [
|
|
76552
76559
|
/* @__PURE__ */ jsxs("div", { className: "flex", children: [
|
|
76553
76560
|
/* @__PURE__ */ jsxs("div", { className: "w-1/2 flex flex-col", children: [
|
|
@@ -76694,7 +76701,8 @@ const ManageCollectionListRenderer = ({ item, data, updateHandler }) => {
|
|
|
76694
76701
|
allowReorder = true,
|
|
76695
76702
|
className = ""
|
|
76696
76703
|
} = item;
|
|
76697
|
-
const
|
|
76704
|
+
const rawData = data?.[item.key] || initialData || [];
|
|
76705
|
+
const currentCollections = Array.isArray(rawData) ? rawData : [];
|
|
76698
76706
|
const handleCollectionChange = (newCollections) => {
|
|
76699
76707
|
if (updateHandler) {
|
|
76700
76708
|
updateHandler(item.key, newCollections);
|