@rovula/ui 0.0.73 → 0.0.75
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 +36 -0
- package/dist/cjs/bundle.js +3 -3
- package/dist/cjs/bundle.js.map +1 -1
- package/dist/cjs/types/components/TextArea/TextArea.d.ts +38 -0
- package/dist/cjs/types/components/TextArea/TextArea.stories.d.ts +9 -0
- package/dist/cjs/types/components/TextArea/TextArea.styles.d.ts +27 -0
- package/dist/cjs/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/cjs/types/index.d.ts +2 -0
- package/dist/components/TextArea/TextArea.js +55 -0
- package/dist/components/TextArea/TextArea.stories.js +86 -0
- package/dist/components/TextArea/TextArea.styles.js +207 -0
- package/dist/components/Tree/Tree.stories.js +73 -0
- package/dist/components/Tree/TreeItem.js +1 -1
- package/dist/esm/bundle.css +36 -0
- package/dist/esm/bundle.js +3 -3
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/types/components/TextArea/TextArea.d.ts +38 -0
- package/dist/esm/types/components/TextArea/TextArea.stories.d.ts +9 -0
- package/dist/esm/types/components/TextArea/TextArea.styles.d.ts +27 -0
- package/dist/esm/types/components/Tree/Tree.stories.d.ts +1 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/index.d.ts +38 -1
- package/dist/index.js +1 -0
- package/dist/src/theme/global.css +46 -0
- package/package.json +1 -1
- package/src/components/TextArea/TextArea.stories.tsx +134 -0
- package/src/components/TextArea/TextArea.styles.ts +228 -0
- package/src/components/TextArea/TextArea.tsx +150 -0
- package/src/components/Tree/Tree.stories.tsx +100 -0
- package/src/components/Tree/TreeItem.tsx +1 -1
- package/src/index.ts +2 -0
- package/src/theme/global.css +26 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export type TextAreaProps = {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
rounded?: "none" | "normal" | "full";
|
|
7
|
+
variant?: "flat" | "outline" | "underline";
|
|
8
|
+
helperText?: string;
|
|
9
|
+
errorMessage?: string;
|
|
10
|
+
fullwidth?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
error?: boolean;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
isFloatingLabel?: boolean;
|
|
15
|
+
keepCloseIconOnValue?: boolean;
|
|
16
|
+
hasClearIcon?: boolean;
|
|
17
|
+
labelClassName?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size">;
|
|
20
|
+
export declare const TextArea: React.ForwardRefExoticComponent<{
|
|
21
|
+
id?: string;
|
|
22
|
+
label?: string;
|
|
23
|
+
size?: "sm" | "md" | "lg";
|
|
24
|
+
rounded?: "none" | "normal" | "full";
|
|
25
|
+
variant?: "flat" | "outline" | "underline";
|
|
26
|
+
helperText?: string;
|
|
27
|
+
errorMessage?: string;
|
|
28
|
+
fullwidth?: boolean;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: boolean;
|
|
31
|
+
required?: boolean;
|
|
32
|
+
isFloatingLabel?: boolean;
|
|
33
|
+
keepCloseIconOnValue?: boolean;
|
|
34
|
+
hasClearIcon?: boolean;
|
|
35
|
+
labelClassName?: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
} & Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "size"> & React.RefAttributes<HTMLTextAreaElement>>;
|
|
38
|
+
export default TextArea;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { TextArea } from "@/index";
|
|
3
|
+
declare const meta: Meta<typeof TextArea>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof TextArea>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const ErrorState: Story;
|
|
8
|
+
export declare const HelperText: Story;
|
|
9
|
+
export declare const Disabled: Story;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const textareaVariant: (props?: ({
|
|
2
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
3
|
+
rounded?: "none" | "normal" | "full" | null | undefined;
|
|
4
|
+
variant?: "outline" | "flat" | "underline" | null | undefined;
|
|
5
|
+
fullwidth?: boolean | null | undefined;
|
|
6
|
+
disabled?: boolean | null | undefined;
|
|
7
|
+
error?: boolean | null | undefined;
|
|
8
|
+
hasClearIcon?: boolean | null | undefined;
|
|
9
|
+
isFloatingLabel?: boolean | null | undefined;
|
|
10
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
11
|
+
export declare const labelVariant: (props?: ({
|
|
12
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
13
|
+
disabled?: boolean | null | undefined;
|
|
14
|
+
error?: boolean | null | undefined;
|
|
15
|
+
isFloatingLabel?: boolean | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
17
|
+
export declare const clearIconWrapperVariant: (props?: ({
|
|
18
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
19
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
20
|
+
export declare const clearIconVariant: (props?: ({
|
|
21
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
22
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
23
|
+
export declare const helperTextVariant: (props?: ({
|
|
24
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
25
|
+
disabled?: boolean | null | undefined;
|
|
26
|
+
error?: boolean | null | undefined;
|
|
27
|
+
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
@@ -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>;
|
|
@@ -2,6 +2,7 @@ import "./theme/global.css";
|
|
|
2
2
|
import "./icons/iconConfig";
|
|
3
3
|
export { default as Button } from "./components/Button/Button";
|
|
4
4
|
export { default as TextInput } from "./components/TextInput/TextInput";
|
|
5
|
+
export { default as TextArea } from "./components/TextArea/TextArea";
|
|
5
6
|
export { default as Text } from "./components/Text/Text";
|
|
6
7
|
export { default as Tabs } from "./components/Tabs/Tabs";
|
|
7
8
|
export { default as Dropdown } from "./components/Dropdown/Dropdown";
|
|
@@ -37,6 +38,7 @@ export * from "./components/FocusedScrollView/FocusedScrollView";
|
|
|
37
38
|
export * from "./components/RadioGroup/RadioGroup";
|
|
38
39
|
export type { ButtonProps } from "./components/Button/Button";
|
|
39
40
|
export type { InputProps } from "./components/TextInput/TextInput";
|
|
41
|
+
export type { TextAreaProps } from "./components/TextArea/TextArea";
|
|
40
42
|
export type { DropdownProps, Options } from "./components/Dropdown/Dropdown";
|
|
41
43
|
export type { NavbarProps } from "./components/Navbar/Navbar";
|
|
42
44
|
export type { AvatarProps } from "./components/Avatar/Avatar";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef, useImperativeHandle, useMemo, useRef } from "react";
|
|
14
|
+
import { cn } from "@/utils/cn";
|
|
15
|
+
import { textareaVariant, labelVariant as textareaLabelVariant, helperTextVariant as textareaHelperTextVariant, clearIconWrapperVariant, clearIconVariant, } from "./TextArea.styles";
|
|
16
|
+
import { XCircleIcon } from "@heroicons/react/16/solid";
|
|
17
|
+
export const TextArea = forwardRef((_a, ref) => {
|
|
18
|
+
var { id, label, size = "md", rounded = "normal", variant = "outline", helperText, errorMessage, fullwidth = true, disabled = false, error = false, required = true, isFloatingLabel = true, keepCloseIconOnValue = false, hasClearIcon = true, labelClassName, className } = _a, props = __rest(_a, ["id", "label", "size", "rounded", "variant", "helperText", "errorMessage", "fullwidth", "disabled", "error", "required", "isFloatingLabel", "keepCloseIconOnValue", "hasClearIcon", "labelClassName", "className"]);
|
|
19
|
+
const textareaRef = useRef(null);
|
|
20
|
+
const _id = id || `textarea-${label !== null && label !== void 0 ? label : ""}`;
|
|
21
|
+
useImperativeHandle(ref, () => textareaRef === null || textareaRef === void 0 ? void 0 : textareaRef.current);
|
|
22
|
+
// Reuse TextInput visual language via utility classes to stay consistent
|
|
23
|
+
const containerClassName = useMemo(() => `inline-flex flex-col ${fullwidth ? "w-full" : ""}`, [fullwidth]);
|
|
24
|
+
const textareaClassName = textareaVariant({
|
|
25
|
+
size,
|
|
26
|
+
rounded,
|
|
27
|
+
variant,
|
|
28
|
+
fullwidth,
|
|
29
|
+
disabled,
|
|
30
|
+
error,
|
|
31
|
+
hasClearIcon,
|
|
32
|
+
isFloatingLabel,
|
|
33
|
+
});
|
|
34
|
+
return (_jsxs("div", { className: containerClassName, children: [_jsxs("div", { className: "relative", children: [_jsx("textarea", Object.assign({}, props, { id: _id, ref: textareaRef, disabled: disabled, placeholder: isFloatingLabel ? " " : props.placeholder, className: cn(textareaClassName, className) })), hasClearIcon && (_jsx("div", { className: clearIconWrapperVariant({ size }), style: {
|
|
35
|
+
display: keepCloseIconOnValue && props.value ? "flex" : undefined,
|
|
36
|
+
}, children: _jsx(XCircleIcon, { type: "button", className: clearIconVariant({ size }), onMouseDown: (e) => {
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
if (textareaRef.current) {
|
|
39
|
+
const prev = textareaRef.current.value;
|
|
40
|
+
textareaRef.current.value = "";
|
|
41
|
+
if (props.onChange && prev !== "") {
|
|
42
|
+
props.onChange({ target: { value: "" } });
|
|
43
|
+
}
|
|
44
|
+
textareaRef.current.focus();
|
|
45
|
+
}
|
|
46
|
+
} }) })), label && (_jsxs("label", { htmlFor: _id, className: cn(textareaLabelVariant({
|
|
47
|
+
size,
|
|
48
|
+
disabled,
|
|
49
|
+
error,
|
|
50
|
+
isFloatingLabel,
|
|
51
|
+
}), labelClassName), children: [label, " ", required && (_jsx("span", { className: cn("text-error", {
|
|
52
|
+
"text-input-disable-text": disabled,
|
|
53
|
+
}), children: "*" }))] }))] }), (errorMessage || helperText) && (_jsx("span", { className: textareaHelperTextVariant({ size, disabled, error }), children: errorMessage || helperText }))] }));
|
|
54
|
+
});
|
|
55
|
+
export default TextArea;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TextArea } from "@/index";
|
|
3
|
+
const meta = {
|
|
4
|
+
title: "Components/TextArea",
|
|
5
|
+
component: TextArea,
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: "fullscreen",
|
|
8
|
+
},
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
decorators: [
|
|
11
|
+
(Story) => (_jsx("div", { className: "p-5 flex h-screen w-full bg-base-bg2", children: _jsx(Story, {}) })),
|
|
12
|
+
],
|
|
13
|
+
argTypes: {
|
|
14
|
+
size: {
|
|
15
|
+
control: { type: "radio" },
|
|
16
|
+
options: ["sm", "md", "lg"],
|
|
17
|
+
},
|
|
18
|
+
rounded: {
|
|
19
|
+
control: { type: "radio" },
|
|
20
|
+
options: ["none", "normal", "full"],
|
|
21
|
+
},
|
|
22
|
+
variant: {
|
|
23
|
+
control: { type: "radio" },
|
|
24
|
+
options: ["flat", "outline", "underline"],
|
|
25
|
+
},
|
|
26
|
+
isFloatingLabel: { control: "boolean" },
|
|
27
|
+
fullwidth: { control: "boolean" },
|
|
28
|
+
disabled: { control: "boolean" },
|
|
29
|
+
error: { control: "boolean" },
|
|
30
|
+
required: { control: "boolean" },
|
|
31
|
+
},
|
|
32
|
+
args: {
|
|
33
|
+
label: "Description",
|
|
34
|
+
placeholder: "Type here...",
|
|
35
|
+
size: "md",
|
|
36
|
+
rounded: "normal",
|
|
37
|
+
variant: "outline",
|
|
38
|
+
isFloatingLabel: true,
|
|
39
|
+
fullwidth: true,
|
|
40
|
+
disabled: false,
|
|
41
|
+
error: false,
|
|
42
|
+
required: true,
|
|
43
|
+
hasClearIcon: true,
|
|
44
|
+
rows: 2,
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export default meta;
|
|
48
|
+
export const Default = {
|
|
49
|
+
render: (args) => {
|
|
50
|
+
console.log("args ", args);
|
|
51
|
+
const props = Object.assign({}, args);
|
|
52
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextArea, Object.assign({ id: "1" }, props, { size: "lg" })), _jsx(TextArea, Object.assign({ id: "2" }, props, { size: "md" })), _jsx(TextArea, Object.assign({ id: "3" }, props, { size: "sm" }))] }));
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
export const ErrorState = {
|
|
56
|
+
args: {
|
|
57
|
+
error: true,
|
|
58
|
+
errorMessage: "This field is required",
|
|
59
|
+
},
|
|
60
|
+
render: (args) => {
|
|
61
|
+
console.log("args ", args);
|
|
62
|
+
const props = Object.assign({}, args);
|
|
63
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextArea, Object.assign({ id: "1" }, props, { size: "lg" })), _jsx(TextArea, Object.assign({ id: "2" }, props, { size: "md" })), _jsx(TextArea, Object.assign({ id: "3" }, props, { size: "sm" }))] }));
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
export const HelperText = {
|
|
67
|
+
args: {
|
|
68
|
+
helperText: "You can write up to 500 characters.",
|
|
69
|
+
},
|
|
70
|
+
render: (args) => {
|
|
71
|
+
console.log("args ", args);
|
|
72
|
+
const props = Object.assign({}, args);
|
|
73
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextArea, Object.assign({ id: "1" }, props, { size: "lg" })), _jsx(TextArea, Object.assign({ id: "2" }, props, { size: "md" })), _jsx(TextArea, Object.assign({ id: "3" }, props, { size: "sm" }))] }));
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export const Disabled = {
|
|
77
|
+
args: {
|
|
78
|
+
disabled: true,
|
|
79
|
+
value: "Disabled text area",
|
|
80
|
+
},
|
|
81
|
+
render: (args) => {
|
|
82
|
+
console.log("args ", args);
|
|
83
|
+
const props = Object.assign({}, args);
|
|
84
|
+
return (_jsxs("div", { className: "flex flex-row gap-4 w-full", children: [_jsx(TextArea, Object.assign({ id: "1" }, props, { size: "lg" })), _jsx(TextArea, Object.assign({ id: "2" }, props, { size: "md" })), _jsx(TextArea, Object.assign({ id: "3" }, props, { size: "sm" }))] }));
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
export const textareaVariant = cva([
|
|
3
|
+
"peer block w-full bg-transparent outline-none placeholder:text-transparent resize-y ui-scrollbar",
|
|
4
|
+
"text-input-filled-text caret-primary",
|
|
5
|
+
], {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
sm: "p-2 px-3 typography-small1",
|
|
9
|
+
md: "py-2 px-3 typography-subtitile4",
|
|
10
|
+
lg: "p-4 typography-subtitile1",
|
|
11
|
+
},
|
|
12
|
+
rounded: {
|
|
13
|
+
none: "rounded-none",
|
|
14
|
+
normal: "rounded-md",
|
|
15
|
+
full: "rounded-full",
|
|
16
|
+
},
|
|
17
|
+
variant: {
|
|
18
|
+
flat: "",
|
|
19
|
+
outline: [
|
|
20
|
+
"ring-1 ring-inset ring-input-default-stroke",
|
|
21
|
+
"hover:ring-input-active-stroke",
|
|
22
|
+
"focus:ring-1 focus:ring-inset focus:ring-input-active-stroke",
|
|
23
|
+
],
|
|
24
|
+
underline: "border-b-2 border-input-default-stroke transition-colors hover:border-input-active-stroke focus:border-input-stroke",
|
|
25
|
+
},
|
|
26
|
+
fullwidth: {
|
|
27
|
+
true: "w-full",
|
|
28
|
+
},
|
|
29
|
+
disabled: {
|
|
30
|
+
true: [
|
|
31
|
+
"bg-input-disable-bg text-input-disable-text ring-input-disable-stroke placeholder:text-input-disable-text",
|
|
32
|
+
"hover:ring-input-disable-stroke",
|
|
33
|
+
"cursor-not-allowed",
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
error: {
|
|
37
|
+
true: "ring-input-error focus:ring-input-error",
|
|
38
|
+
},
|
|
39
|
+
hasClearIcon: {
|
|
40
|
+
true: "",
|
|
41
|
+
},
|
|
42
|
+
isFloatingLabel: {
|
|
43
|
+
true: "",
|
|
44
|
+
false: "placeholder:text-input-placeholder",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
compoundVariants: [
|
|
48
|
+
{
|
|
49
|
+
variant: "underline",
|
|
50
|
+
className: "rounded-none",
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
hasClearIcon: true,
|
|
54
|
+
size: "sm",
|
|
55
|
+
class: "focus:pe-6",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
hasClearIcon: true,
|
|
59
|
+
size: "md",
|
|
60
|
+
class: "focus:pe-8",
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
hasClearIcon: true,
|
|
64
|
+
size: "lg",
|
|
65
|
+
class: "focus:pe-10",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
defaultVariants: {
|
|
69
|
+
size: "md",
|
|
70
|
+
variant: "outline",
|
|
71
|
+
rounded: "normal",
|
|
72
|
+
fullwidth: false,
|
|
73
|
+
disabled: false,
|
|
74
|
+
error: false,
|
|
75
|
+
hasClearIcon: false,
|
|
76
|
+
isFloatingLabel: true,
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
export const labelVariant = cva([
|
|
80
|
+
"absolute block duration-450 transition-all px-[2px] text-input-default-text",
|
|
81
|
+
"peer-focus:text-input-filled-text peer-focus:bg-input-label-bg",
|
|
82
|
+
], {
|
|
83
|
+
variants: {
|
|
84
|
+
size: {
|
|
85
|
+
sm: [],
|
|
86
|
+
md: [],
|
|
87
|
+
lg: [],
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
true: "text-input-default-text placeholder:text-input-default-text",
|
|
91
|
+
},
|
|
92
|
+
error: {
|
|
93
|
+
true: "ring-error",
|
|
94
|
+
},
|
|
95
|
+
isFloatingLabel: {
|
|
96
|
+
false: "hidden peer-placeholder-shown:block peer-focus:bg-transparent",
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
compoundVariants: [
|
|
100
|
+
// floating = true
|
|
101
|
+
{
|
|
102
|
+
isFloatingLabel: true,
|
|
103
|
+
size: "sm",
|
|
104
|
+
className: [
|
|
105
|
+
"left-3 -top-1.5 typography-label2 bg-input-label-bg",
|
|
106
|
+
"peer-placeholder-shown:top-2 peer-placeholder-shown:typography-small1 peer-placeholder-shown:bg-transparent",
|
|
107
|
+
"peer-focus:-top-1.5 peer-focus:typography-label2",
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
isFloatingLabel: true,
|
|
112
|
+
size: "md",
|
|
113
|
+
className: [
|
|
114
|
+
"left-3 -top-1.5 typography-label1 bg-input-label-bg",
|
|
115
|
+
"peer-placeholder-shown:top-2 peer-placeholder-shown:typography-subtitile4 peer-placeholder-shown:bg-transparent",
|
|
116
|
+
"peer-focus:-top-1.5 peer-focus:typography-label1",
|
|
117
|
+
],
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
isFloatingLabel: true,
|
|
121
|
+
size: "lg",
|
|
122
|
+
className: [
|
|
123
|
+
"left-4 -top-1.5 typography-label1 bg-input-label-bg",
|
|
124
|
+
"peer-placeholder-shown:top-4 peer-placeholder-shown:typography-subtitile1 peer-placeholder-shown:bg-transparent",
|
|
125
|
+
"peer-focus:-top-1.5 peer-focus:typography-label1",
|
|
126
|
+
],
|
|
127
|
+
},
|
|
128
|
+
// --------------
|
|
129
|
+
// floating = false
|
|
130
|
+
{
|
|
131
|
+
isFloatingLabel: false,
|
|
132
|
+
size: "sm",
|
|
133
|
+
className: [
|
|
134
|
+
"left-3 peer-placeholder-shown:top-2 peer-placeholder-shown:typography-small1",
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
isFloatingLabel: false,
|
|
139
|
+
size: "md",
|
|
140
|
+
className: [
|
|
141
|
+
"left-3 peer-placeholder-shown:top-2 peer-placeholder-shown:typography-subtitile4",
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
isFloatingLabel: false,
|
|
146
|
+
size: "lg",
|
|
147
|
+
className: [
|
|
148
|
+
"left-4 peer-placeholder-shown:top-4 peer-placeholder-shown:typography-subtitile1",
|
|
149
|
+
],
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
defaultVariants: {
|
|
153
|
+
size: "md",
|
|
154
|
+
disabled: false,
|
|
155
|
+
error: false,
|
|
156
|
+
isFloatingLabel: true,
|
|
157
|
+
},
|
|
158
|
+
});
|
|
159
|
+
export const clearIconWrapperVariant = cva([
|
|
160
|
+
"absolute inset-y-0 right-0 items-start justify-center hidden peer-focus:flex",
|
|
161
|
+
], {
|
|
162
|
+
variants: {
|
|
163
|
+
size: {
|
|
164
|
+
sm: "mr-2 pt-2",
|
|
165
|
+
md: "mr-3 pt-2",
|
|
166
|
+
lg: "mr-4 pt-4",
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
defaultVariants: {
|
|
170
|
+
size: "md",
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
export const clearIconVariant = cva([
|
|
174
|
+
"cursor-pointer z-50 fill-input-active-stroke hover:fill-input-default-text",
|
|
175
|
+
], {
|
|
176
|
+
variants: {
|
|
177
|
+
size: {
|
|
178
|
+
sm: "size-3",
|
|
179
|
+
md: "size-4",
|
|
180
|
+
lg: "size-5",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
defaultVariants: {
|
|
184
|
+
size: "md",
|
|
185
|
+
},
|
|
186
|
+
});
|
|
187
|
+
export const helperTextVariant = cva(["text-small1 flex flex-row items-center gap-1"], {
|
|
188
|
+
variants: {
|
|
189
|
+
size: {
|
|
190
|
+
sm: "mt-1",
|
|
191
|
+
md: "mt-[6px]",
|
|
192
|
+
lg: "mt-[6px]",
|
|
193
|
+
},
|
|
194
|
+
disabled: {
|
|
195
|
+
true: "text-input-disable-text",
|
|
196
|
+
},
|
|
197
|
+
error: {
|
|
198
|
+
true: "text-input-error",
|
|
199
|
+
false: "text-input-filled-text",
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
defaultVariants: {
|
|
203
|
+
size: "md",
|
|
204
|
+
disabled: false,
|
|
205
|
+
error: false,
|
|
206
|
+
},
|
|
207
|
+
});
|
|
@@ -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
|
}
|
|
@@ -1038,6 +1041,9 @@ input[type=number] {
|
|
|
1038
1041
|
.cursor-default{
|
|
1039
1042
|
cursor: default;
|
|
1040
1043
|
}
|
|
1044
|
+
.cursor-not-allowed{
|
|
1045
|
+
cursor: not-allowed;
|
|
1046
|
+
}
|
|
1041
1047
|
.cursor-pointer{
|
|
1042
1048
|
cursor: pointer;
|
|
1043
1049
|
}
|
|
@@ -1049,6 +1055,9 @@ input[type=number] {
|
|
|
1049
1055
|
-moz-user-select: none;
|
|
1050
1056
|
user-select: none;
|
|
1051
1057
|
}
|
|
1058
|
+
.resize-y{
|
|
1059
|
+
resize: vertical;
|
|
1060
|
+
}
|
|
1052
1061
|
.resize{
|
|
1053
1062
|
resize: both;
|
|
1054
1063
|
}
|
|
@@ -1214,6 +1223,9 @@ input[type=number] {
|
|
|
1214
1223
|
.whitespace-nowrap{
|
|
1215
1224
|
white-space: nowrap;
|
|
1216
1225
|
}
|
|
1226
|
+
.break-all{
|
|
1227
|
+
word-break: break-all;
|
|
1228
|
+
}
|
|
1217
1229
|
.rounded{
|
|
1218
1230
|
border-radius: 0.25rem;
|
|
1219
1231
|
}
|
|
@@ -3056,6 +3068,12 @@ input[type=number] {
|
|
|
3056
3068
|
.pr-xxl{
|
|
3057
3069
|
padding-right: var(--spacing-spacing-xxl);
|
|
3058
3070
|
}
|
|
3071
|
+
.pt-2{
|
|
3072
|
+
padding-top: 0.5rem;
|
|
3073
|
+
}
|
|
3074
|
+
.pt-4{
|
|
3075
|
+
padding-top: 1rem;
|
|
3076
|
+
}
|
|
3059
3077
|
.text-left{
|
|
3060
3078
|
text-align: left;
|
|
3061
3079
|
}
|
|
@@ -3800,6 +3818,24 @@ input[type=number] {
|
|
|
3800
3818
|
line-height: var(--button-button-ms-line-height, 22px);
|
|
3801
3819
|
font-weight: var(--button-button-ms-weight, 700);
|
|
3802
3820
|
}
|
|
3821
|
+
.ui-scrollbar::-webkit-scrollbar {
|
|
3822
|
+
height: 6px;
|
|
3823
|
+
width: 6px;
|
|
3824
|
+
background: rgba(0, 0, 0, 0.08);
|
|
3825
|
+
}
|
|
3826
|
+
.ui-scrollbar::-webkit-scrollbar-thumb {
|
|
3827
|
+
border-radius: 6px;
|
|
3828
|
+
background: rgba(121, 141, 150, 0.48);
|
|
3829
|
+
width: 6px;
|
|
3830
|
+
}
|
|
3831
|
+
.ui-scrollbar::-webkit-scrollbar-thumb:hover {
|
|
3832
|
+
background: rgba(251, 252, 253, 0.48);
|
|
3833
|
+
cursor: pointer;
|
|
3834
|
+
}
|
|
3835
|
+
.ui-scrollbar::-webkit-scrollbar-corner {
|
|
3836
|
+
display: none;
|
|
3837
|
+
/* background: transparent; */
|
|
3838
|
+
}
|
|
3803
3839
|
.placeholder\:text-input-default-text::-moz-placeholder{
|
|
3804
3840
|
--tw-text-opacity: 1;
|
|
3805
3841
|
color: color-mix(in srgb, var(--input-color-default-text) calc(100% * var(--tw-text-opacity, 1)), transparent);
|