@rovula/ui 0.0.53 → 0.0.54

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.
@@ -82,7 +82,7 @@ export interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRig
82
82
  checkedId?: string[];
83
83
  loadingId?: string[];
84
84
  onExpandChange?: (id: string, expanded: boolean) => void;
85
- onCheckedChange?: (checkedId: string[], uncheckedId: string[], checkedState: Record<string, boolean>) => void;
85
+ onCheckedChange?: (checkedState: Record<string, boolean>) => void;
86
86
  onClickItem?: (id: string) => void;
87
87
  onCheckedItem?: (id: string, checked: boolean) => void;
88
88
  defaultExpandAll?: boolean;
package/dist/index.d.ts CHANGED
@@ -696,7 +696,7 @@ interface TreeProps extends Pick<TreeItemProps, "renderIcon" | "renderRightSecti
696
696
  checkedId?: string[];
697
697
  loadingId?: string[];
698
698
  onExpandChange?: (id: string, expanded: boolean) => void;
699
- onCheckedChange?: (checkedId: string[], uncheckedId: string[], checkedState: Record<string, boolean>) => void;
699
+ onCheckedChange?: (checkedState: Record<string, boolean>) => void;
700
700
  onClickItem?: (id: string) => void;
701
701
  onCheckedItem?: (id: string, checked: boolean) => void;
702
702
  defaultExpandAll?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rovula/ui",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "main": "dist/cjs/bundle.js",
5
5
  "module": "dist/esm/bundle.js",
6
6
  "types": "dist/index.d.ts",
@@ -107,16 +107,11 @@ export const Controller: StoryObj<typeof Tree> = {
107
107
  defaultExpandAll
108
108
  defaultCheckedId={checkedId}
109
109
  checkedId={checkedId}
110
- onCheckedChange={(ids: string[]) => {
111
- setSelectedSectionList(
112
- Object.keys(selectedSectionList).reduce(
113
- (prev, id) => ({
114
- ...prev,
115
- [id]: ids.includes(id),
116
- }),
117
- {}
118
- )
119
- );
110
+ onCheckedChange={(ids) => {
111
+ setSelectedSectionList((prev) => ({
112
+ ...prev,
113
+ ...ids,
114
+ }));
120
115
  }}
121
116
  />
122
117
  </div>
@@ -144,12 +144,7 @@ const Tree: FC<TreeProps> = ({
144
144
  setCheckedState(newState);
145
145
 
146
146
  if (onCheckedChange) {
147
- const checkedIds = Object.keys(newState).filter((key) => newState[key]);
148
- const uncheckedIds = Object.keys(newState).filter(
149
- (key) => !newState[key]
150
- );
151
-
152
- onCheckedChange?.(checkedIds, uncheckedIds, newState);
147
+ onCheckedChange?.(newState);
153
148
  }
154
149
  },
155
150
  [checkedState, data, onCheckedChange, hierarchicalCheck, onCheckedItem]
@@ -100,11 +100,7 @@ export interface TreeProps
100
100
  checkedId?: string[];
101
101
  loadingId?: string[];
102
102
  onExpandChange?: (id: string, expanded: boolean) => void;
103
- onCheckedChange?: (
104
- checkedId: string[],
105
- uncheckedId: string[],
106
- checkedState: Record<string, boolean>
107
- ) => void;
103
+ onCheckedChange?: (checkedState: Record<string, boolean>) => void;
108
104
  onClickItem?: (id: string) => void;
109
105
  onCheckedItem?: (id: string, checked: boolean) => void;
110
106
  defaultExpandAll?: boolean;