@rovula/ui 0.0.73 → 0.0.74
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/cjs/bundle.css +6 -0
- package/dist/cjs/bundle.js +1 -1
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/components/Tree/Tree.stories.js +73 -0
- package/dist/components/Tree/TreeItem.js +1 -1
- package/dist/esm/bundle.css +6 -0
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/src/theme/global.css +8 -0
- package/package.json +1 -1
- package/src/components/Tree/Tree.stories.tsx +100 -0
- package/src/components/Tree/TreeItem.tsx +1 -1
|
@@ -16,3 +16,4 @@ export declare const Leaf: StoryObj<typeof Tree>;
|
|
|
16
16
|
export declare const HideCheckboxMode: StoryObj<typeof Tree>;
|
|
17
17
|
export declare const RadioMode: StoryObj<typeof Tree>;
|
|
18
18
|
export declare const CheckAll: StoryObj<typeof Tree>;
|
|
19
|
+
export declare const LongText: StoryObj<typeof Tree>;
|
|
@@ -222,3 +222,76 @@ export const CheckAll = {
|
|
|
222
222
|
} }))] }));
|
|
223
223
|
},
|
|
224
224
|
};
|
|
225
|
+
export const LongText = {
|
|
226
|
+
args: {
|
|
227
|
+
data: [
|
|
228
|
+
{
|
|
229
|
+
id: "2699d80b-6772-4878-9639-75e370786e79",
|
|
230
|
+
title: "Level1 RUNLINE_LV_2_00000000000000000000000000000000000000000000000000000000",
|
|
231
|
+
children: [
|
|
232
|
+
{
|
|
233
|
+
id: "9b4511f4-ad9a-42e0-8376-60d5edbeffb3",
|
|
234
|
+
title: "Level1 RUNLINE_LV_3_0000000000000000000000000000000000000000000000000000",
|
|
235
|
+
children: [
|
|
236
|
+
{
|
|
237
|
+
id: "c8d5dfb5-6c61-482b-88fe-186eb7685479",
|
|
238
|
+
title: "2025-07-27_05-25-53",
|
|
239
|
+
children: [],
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "81ff1dd0-b283-4f60-864e-5d814e99d903",
|
|
243
|
+
title: "2025-07-27_06-05-53",
|
|
244
|
+
children: [],
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: "ad79c17b-2861-431a-af0e-3f1c73164508",
|
|
252
|
+
title: "RUNLINE_LV_2",
|
|
253
|
+
children: [
|
|
254
|
+
{
|
|
255
|
+
id: "46ee87c4-4ea7-48f8-9ed9-14833e4dacc2",
|
|
256
|
+
title: "2025-07-27_06-25-53",
|
|
257
|
+
children: [],
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
id: "1379b081-9f7f-4d82-8470-8321d9b7de0c",
|
|
261
|
+
title: "RUNLINE_LV_3",
|
|
262
|
+
children: [
|
|
263
|
+
{
|
|
264
|
+
id: "cf9145d4-ad06-4433-8384-4c10d266a6aa",
|
|
265
|
+
title: "2025-07-26_19-01-31",
|
|
266
|
+
children: [],
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: "f247313c-01cb-4363-a390-a72b889c72d3",
|
|
270
|
+
title: "2025-07-26_19-11-31",
|
|
271
|
+
children: [],
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
id: "0b7c650a-0d78-4e6e-8399-5dbaeb510751",
|
|
275
|
+
title: "Lv4",
|
|
276
|
+
children: [
|
|
277
|
+
{
|
|
278
|
+
id: "88d89572-462d-46c9-b4d0-4df736117799",
|
|
279
|
+
title: "Lv 5",
|
|
280
|
+
children: [],
|
|
281
|
+
},
|
|
282
|
+
],
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
},
|
|
288
|
+
],
|
|
289
|
+
},
|
|
290
|
+
render: (args) => {
|
|
291
|
+
const [isCheckedAll, setIsCheckedAll] = useState(false);
|
|
292
|
+
const [checkedId, onCheckedId] = useState([]);
|
|
293
|
+
return (_jsxs("div", { className: "flex flex-col gap-4 w-full", children: [_jsxs("div", { className: "flex gap-2", children: [_jsxs(Button, { variant: "outline", onClick: () => setIsCheckedAll(!isCheckedAll), children: [isCheckedAll ? "Unchecked" : "Checked", " All"] }), _jsx(Button, { variant: "outline", onClick: () => onCheckedId([]), children: "Clear" })] }), _jsx("div", { className: "w-full max-w-[300px]", children: _jsx(Tree, Object.assign({}, args, { hierarchicalCheck: true, checkedAll: isCheckedAll, checkedId: checkedId, onCheckedChange: (state) => {
|
|
294
|
+
onCheckedId(Object.keys(state).filter((key) => state === null || state === void 0 ? void 0 : state[key]));
|
|
295
|
+
} })) })] }));
|
|
296
|
+
},
|
|
297
|
+
};
|
|
@@ -85,6 +85,6 @@ const TreeItem = ({ id, title, classes, children, isFirstLevel = false, isLeaf =
|
|
|
85
85
|
!isLastItem &&
|
|
86
86
|
((isExpanded && (hasChildren || isLoading)) || !isExpanded) && (_jsx("div", { className: cn("flex w-[2px] h-1/2 bg-grey-150", classes === null || classes === void 0 ? void 0 : classes.branch), style: styles.branch }))] }), _jsxs("div", { className: cn("flex flex-1 items-center py-2 min-h-10", classes === null || classes === void 0 ? void 0 : classes.itemContainer), children: [!isFirstLevel && (_jsx("div", { className: cn("bg-grey-150", classes === null || classes === void 0 ? void 0 : classes.horizontalLine), style: styles.horizontalLine })), isFirstLevel && !shouldExpandButton && (_jsx("div", { className: cn("flex mr-[2px]", classes === null || classes === void 0 ? void 0 : classes.expandButton), style: styles.expandButton })), shouldExpandButton && (_jsx("div", { className: cn("flex mr-[2px]", classes === null || classes === void 0 ? void 0 : classes.expandButton), style: styles.expandButton, onClick: !isLoading && handleExpandToggle, children: _jsx(ActionButton, { variant: "icon", size: "sm", children: isLoading ? (_jsx(Loading, {})) : (_jsx(Icon, { name: isExpanded ? "chevron-down" : "chevron-right" })) }) })), shouldShowCheckbox ? (_jsx(Checkbox, { id: id, className: cn("size-[16px]", classes === null || classes === void 0 ? void 0 : classes.checkbox), checked: isChecked, disabled: disabled, onCheckedChange: (newChecked) => onCheckedChange === null || onCheckedChange === void 0 ? void 0 : onCheckedChange(id, newChecked, itemData) })) : (_jsx("div", { className: isFirstLevel && checkable
|
|
87
87
|
? cn("size-[16px]", classes === null || classes === void 0 ? void 0 : classes.checkbox)
|
|
88
|
-
: "" })), _jsxs("div", { className: cn("ml-2 gap-1 flex flex-1 items-center text-foreground", classes === null || classes === void 0 ? void 0 : classes.item), onClick: handleOnClickItem, children: [showIcon ? customIcon || defaultIcon : null, _jsx("div", { className: cn("flex flex-1 cursor-pointer text-subtitle5 text-ellipsis", classes === null || classes === void 0 ? void 0 : classes.title), children: titleContent })] }), rightIcon] })] }), isExpanded && hasChildren && currentLevel < (maxLevel || Infinity) && (_jsxs("div", { className: cn("flex flex-row overflow-hidden", classes === null || classes === void 0 ? void 0 : classes.expandedChildrenWrapper), children: [!isFirstLevel && !isLastItem && (_jsx("div", { className: cn("flex w-[2px] h-full bg-grey-150", classes === null || classes === void 0 ? void 0 : classes.branch), style: styles.branch })), _jsx("div", { className: cn("flex flex-col overflow-hidden", classes === null || classes === void 0 ? void 0 : classes.expandedChildrenWrapperInner), style: styles.childPadding, children: children === null || children === void 0 ? void 0 : children.map((child, idx) => (_jsx(TreeItem, Object.assign({ classes: classes, isLastItem: idx === children.length - 1, checkIsExpanded: checkIsExpanded, checkIsChecked: checkIsChecked, checkAutoDisabled: checkAutoDisabled, checkIsLoading: checkIsLoading, onExpandChange: onExpandChange, onCheckedChange: onCheckedChange, renderIcon: renderIcon, renderElement: renderElement, renderTitle: renderTitle, disabled: checkAutoDisabled(child.id), showIcon: showIcon, lineSize: lineSize, horizontalLineWidth: horizontalLineWidth, expandButtonSize: expandButtonSize, spacing: spacing, notifyClickItem: notifyClickItem, maxLevel: maxLevel, currentLevel: currentLevel + 1, checkable: checkable }, child), child.id))) })] })), enableSeparatorLine && isFirstLevel && !isLastItem && (_jsx("div", { className: cn("bg-grey-150 w-full h-[2px] rounded", classes === null || classes === void 0 ? void 0 : classes.separatorLine) }))] }) }));
|
|
88
|
+
: "" })), _jsxs("div", { className: cn("ml-2 gap-1 flex flex-1 items-center text-foreground", classes === null || classes === void 0 ? void 0 : classes.item), onClick: handleOnClickItem, children: [showIcon ? customIcon || defaultIcon : null, _jsx("div", { className: cn("flex flex-1 cursor-pointer text-subtitle5 text-ellipsis overflow-hidden break-all text-left", classes === null || classes === void 0 ? void 0 : classes.title), children: titleContent })] }), rightIcon] })] }), isExpanded && hasChildren && currentLevel < (maxLevel || Infinity) && (_jsxs("div", { className: cn("flex flex-row overflow-hidden", classes === null || classes === void 0 ? void 0 : classes.expandedChildrenWrapper), children: [!isFirstLevel && !isLastItem && (_jsx("div", { className: cn("flex w-[2px] h-full bg-grey-150", classes === null || classes === void 0 ? void 0 : classes.branch), style: styles.branch })), _jsx("div", { className: cn("flex flex-col overflow-hidden", classes === null || classes === void 0 ? void 0 : classes.expandedChildrenWrapperInner), style: styles.childPadding, children: children === null || children === void 0 ? void 0 : children.map((child, idx) => (_jsx(TreeItem, Object.assign({ classes: classes, isLastItem: idx === children.length - 1, checkIsExpanded: checkIsExpanded, checkIsChecked: checkIsChecked, checkAutoDisabled: checkAutoDisabled, checkIsLoading: checkIsLoading, onExpandChange: onExpandChange, onCheckedChange: onCheckedChange, renderIcon: renderIcon, renderElement: renderElement, renderTitle: renderTitle, disabled: checkAutoDisabled(child.id), showIcon: showIcon, lineSize: lineSize, horizontalLineWidth: horizontalLineWidth, expandButtonSize: expandButtonSize, spacing: spacing, notifyClickItem: notifyClickItem, maxLevel: maxLevel, currentLevel: currentLevel + 1, checkable: checkable }, child), child.id))) })] })), enableSeparatorLine && isFirstLevel && !isLastItem && (_jsx("div", { className: cn("bg-grey-150 w-full h-[2px] rounded", classes === null || classes === void 0 ? void 0 : classes.separatorLine) }))] }) }));
|
|
89
89
|
};
|
|
90
90
|
export default TreeItem;
|
package/dist/esm/bundle.css
CHANGED
|
@@ -987,6 +987,9 @@ input[type=number] {
|
|
|
987
987
|
min-width: -moz-fit-content;
|
|
988
988
|
min-width: fit-content;
|
|
989
989
|
}
|
|
990
|
+
.max-w-\[300px\]{
|
|
991
|
+
max-width: 300px;
|
|
992
|
+
}
|
|
990
993
|
.max-w-full{
|
|
991
994
|
max-width: 100%;
|
|
992
995
|
}
|
|
@@ -1214,6 +1217,9 @@ input[type=number] {
|
|
|
1214
1217
|
.whitespace-nowrap{
|
|
1215
1218
|
white-space: nowrap;
|
|
1216
1219
|
}
|
|
1220
|
+
.break-all{
|
|
1221
|
+
word-break: break-all;
|
|
1222
|
+
}
|
|
1217
1223
|
.rounded{
|
|
1218
1224
|
border-radius: 0.25rem;
|
|
1219
1225
|
}
|