@edu-tosel/design 1.0.84 → 1.0.85

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edu-tosel/design",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "UI components for International TOSEL Committee",
5
5
  "keywords": [
6
6
  "jsx",
package/store/index.d.ts CHANGED
@@ -23,7 +23,7 @@ interface ActionProps<T = any> {
23
23
  setDark: () => void;
24
24
  items: T[];
25
25
  setItems: (prop: T[]) => void;
26
- updateItem: (prop: T, key: string) => void;
26
+ updateItem: (prop: T, key: string | string[]) => void;
27
27
  }
28
28
  export declare const useActionStore: import("zustand").UseBoundStore<import("zustand").StoreApi<ActionProps<any>>>;
29
29
  export {};
package/store/index.js CHANGED
@@ -70,6 +70,17 @@ export const useActionStore = create((set) => ({
70
70
  items: [],
71
71
  setItems: (prop) => set({ items: prop }),
72
72
  updateItem: (item, key) => set((state) => ({
73
- items: state.items.map((prevItem) => prevItem.id === item.id ? { ...prevItem, [key]: item[key] } : prevItem),
73
+ items: state.items.map((prevItem) => {
74
+ if (typeof key === "string")
75
+ return prevItem.id === item.id
76
+ ? { ...prevItem, [key]: item[key] }
77
+ : prevItem;
78
+ return prevItem.id === item.id
79
+ ? {
80
+ ...prevItem,
81
+ ...key.reduce((acc, cur) => ({ ...acc, [cur]: item[cur] }), {}),
82
+ }
83
+ : prevItem;
84
+ }),
74
85
  })),
75
86
  }));
package/version.txt CHANGED
@@ -1 +1 @@
1
- 1.0.84
1
+ 1.0.85