@zenkigen-inc/component-ui 1.15.1 → 1.15.2
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/index.d.mts +434 -0
- package/dist/index.d.ts +434 -27
- package/dist/index.js +1602 -1701
- package/dist/index.mjs +1915 -0
- package/package.json +18 -8
- package/tsup.config.ts +13 -0
- package/vitest.config.ts +11 -0
- package/vitest.setup.ts +1 -0
- package/dist/avatar/avatar.d.ts +0 -10
- package/dist/avatar/index.d.ts +0 -1
- package/dist/breadcrumb/breadcrumb-item.d.ts +0 -2
- package/dist/breadcrumb/breadcrumb.d.ts +0 -5
- package/dist/breadcrumb/index.d.ts +0 -1
- package/dist/button/button.d.ts +0 -22
- package/dist/button/index.d.ts +0 -1
- package/dist/checkbox/checkbox.d.ts +0 -14
- package/dist/checkbox/checked-icon.d.ts +0 -1
- package/dist/checkbox/index.d.ts +0 -1
- package/dist/checkbox/minus-icon.d.ts +0 -1
- package/dist/dropdown/dropdown-context.d.ts +0 -14
- package/dist/dropdown/dropdown-item.d.ts +0 -7
- package/dist/dropdown/dropdown-menu.d.ts +0 -10
- package/dist/dropdown/dropdown.d.ts +0 -26
- package/dist/dropdown/index.d.ts +0 -2
- package/dist/dropdown/type.d.ts +0 -9
- package/dist/evaluation-star/evaluation-star.d.ts +0 -8
- package/dist/evaluation-star/index.d.ts +0 -1
- package/dist/heading/heading.d.ts +0 -10
- package/dist/heading/index.d.ts +0 -1
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/use-outside-click.d.ts +0 -2
- package/dist/icon/icon.d.ts +0 -13
- package/dist/icon/index.d.ts +0 -1
- package/dist/icon-button/icon-button.d.ts +0 -19
- package/dist/icon-button/index.d.ts +0 -1
- package/dist/index.esm.js +0 -2147
- package/dist/index.esm.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/loading/index.d.ts +0 -1
- package/dist/loading/loading.d.ts +0 -7
- package/dist/modal/body-scroll-lock.d.ts +0 -27
- package/dist/modal/index.d.ts +0 -1
- package/dist/modal/modal-body.d.ts +0 -2
- package/dist/modal/modal-context.d.ts +0 -5
- package/dist/modal/modal-footer.d.ts +0 -7
- package/dist/modal/modal-header.d.ts +0 -6
- package/dist/modal/modal.d.ts +0 -18
- package/dist/notification-inline/index.d.ts +0 -1
- package/dist/notification-inline/notification-inline.d.ts +0 -13
- package/dist/pagination/index.d.ts +0 -1
- package/dist/pagination/pagination-button.d.ts +0 -6
- package/dist/pagination/pagination-context.d.ts +0 -6
- package/dist/pagination/pagination.d.ts +0 -12
- package/dist/pagination-select/index.d.ts +0 -1
- package/dist/pagination-select/pagination-select.d.ts +0 -22
- package/dist/radio/index.d.ts +0 -1
- package/dist/radio/radio.d.ts +0 -12
- package/dist/search/index.d.ts +0 -1
- package/dist/search/search.d.ts +0 -12
- package/dist/select/index.d.ts +0 -2
- package/dist/select/select-context.d.ts +0 -11
- package/dist/select/select-item.d.ts +0 -6
- package/dist/select/select-list.d.ts +0 -6
- package/dist/select/select.d.ts +0 -22
- package/dist/select/type.d.ts +0 -7
- package/dist/select-sort/index.d.ts +0 -2
- package/dist/select-sort/select-item.d.ts +0 -7
- package/dist/select-sort/select-list.d.ts +0 -10
- package/dist/select-sort/select-sort.d.ts +0 -15
- package/dist/select-sort/type.d.ts +0 -1
- package/dist/tab/index.d.ts +0 -2
- package/dist/tab/tab-item.d.ts +0 -10
- package/dist/tab/tab.d.ts +0 -15
- package/dist/table/index.d.ts +0 -3
- package/dist/table/table-cell.d.ts +0 -8
- package/dist/table/table-row.d.ts +0 -7
- package/dist/table/table.d.ts +0 -16
- package/dist/tag/delete-icon.d.ts +0 -8
- package/dist/tag/index.d.ts +0 -2
- package/dist/tag/tag.d.ts +0 -17
- package/dist/tag/type.d.ts +0 -3
- package/dist/text-area/index.d.ts +0 -1
- package/dist/text-area/text-area.d.ts +0 -8
- package/dist/text-input/index.d.ts +0 -1
- package/dist/text-input/text-input.d.ts +0 -7
- package/dist/toast/index.d.ts +0 -2
- package/dist/toast/toast-provider.d.ts +0 -13
- package/dist/toast/toast.d.ts +0 -12
- package/dist/toast/type.d.ts +0 -1
- package/dist/toggle/index.d.ts +0 -1
- package/dist/toggle/toggle.d.ts +0 -12
- package/dist/tooltip/index.d.ts +0 -1
- package/dist/tooltip/tail-icon.d.ts +0 -8
- package/dist/tooltip/tooltip-content.d.ts +0 -11
- package/dist/tooltip/tooltip.d.ts +0 -13
- package/dist/tooltip/tooltip.hook.d.ts +0 -11
- package/dist/tooltip/type.d.ts +0 -13
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1915 @@
|
|
|
1
|
+
// src/avatar/avatar.tsx
|
|
2
|
+
import { userColors } from "@zenkigen-inc/component-theme";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
var isAsciiString = (str) => {
|
|
6
|
+
return str.charCodeAt(0) < 256;
|
|
7
|
+
};
|
|
8
|
+
function Avatar({ size = "medium", ...props }) {
|
|
9
|
+
const classes = clsx("flex items-center justify-center rounded-full text-textOnColor", {
|
|
10
|
+
"w-16 h-16 typography-label16regular": size === "x-large",
|
|
11
|
+
"w-12 h-12 typography-label14regular": size === "large",
|
|
12
|
+
"w-10 h-10 typography-label14regular": size === "medium",
|
|
13
|
+
"w-8 h-8 typography-label11regular": size === "small",
|
|
14
|
+
"w-6 h-6 typography-label11regular": size === "x-small",
|
|
15
|
+
"bg-disabled01": props.isDisabled,
|
|
16
|
+
"bg-icon01": props.userId == null,
|
|
17
|
+
[userColors[(props.userId ?? 0) % userColors.length]]: props.userId != null && !(props.isDisabled ?? false)
|
|
18
|
+
});
|
|
19
|
+
const trimmedFirstName = props.firstName.replace("\u3000", " ").trim();
|
|
20
|
+
const trimmedLastName = props.lastName.replace("\u3000", " ").trim().trim();
|
|
21
|
+
const nameOnIcon = isAsciiString(trimmedLastName) ? trimmedFirstName.slice(0, 1).toUpperCase() + trimmedLastName.slice(0, 1).toUpperCase() : (trimmedLastName + trimmedFirstName).slice(0, 2);
|
|
22
|
+
return /* @__PURE__ */ jsx("span", { className: classes, children: nameOnIcon });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/breadcrumb/breadcrumb-item.tsx
|
|
26
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
27
|
+
var BreadcrumbItem = ({ children }) => {
|
|
28
|
+
return /* @__PURE__ */ jsx2("li", { className: "flex gap-2 after:content-['/'] last:after:content-none [&_a]:text-interactive02 [&_a]:hover:underline", children });
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
// src/breadcrumb/breadcrumb.tsx
|
|
32
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
33
|
+
function Breadcrumb({ children }) {
|
|
34
|
+
return /* @__PURE__ */ jsx3("nav", { "aria-label": "breadcrumb", children: /* @__PURE__ */ jsx3("ul", { className: "typography-label14regular flex flex-wrap gap-2 whitespace-nowrap text-text01", children }) });
|
|
35
|
+
}
|
|
36
|
+
Breadcrumb.Item = BreadcrumbItem;
|
|
37
|
+
|
|
38
|
+
// src/button/button.tsx
|
|
39
|
+
import { buttonColors, focusVisible } from "@zenkigen-inc/component-theme";
|
|
40
|
+
import { clsx as clsx2 } from "clsx";
|
|
41
|
+
import { jsxs } from "react/jsx-runtime";
|
|
42
|
+
var Button = ({
|
|
43
|
+
size = "medium",
|
|
44
|
+
variant = "fill",
|
|
45
|
+
isDisabled,
|
|
46
|
+
isSelected = false,
|
|
47
|
+
width,
|
|
48
|
+
borderRadius,
|
|
49
|
+
justifyContent = "center",
|
|
50
|
+
before,
|
|
51
|
+
after,
|
|
52
|
+
elementAs,
|
|
53
|
+
children,
|
|
54
|
+
...props
|
|
55
|
+
}) => {
|
|
56
|
+
const baseClasses = clsx2(
|
|
57
|
+
"flex shrink-0 items-center gap-1",
|
|
58
|
+
buttonColors[variant].hover,
|
|
59
|
+
buttonColors[variant].active,
|
|
60
|
+
buttonColors[variant].disabled,
|
|
61
|
+
focusVisible.normal,
|
|
62
|
+
{
|
|
63
|
+
"h-6 px-2.5": size === "small",
|
|
64
|
+
"h-8 px-3": size === "medium",
|
|
65
|
+
"h-10 px-4 leading-[24px]": size === "large",
|
|
66
|
+
"inline-flex": elementAs === "a",
|
|
67
|
+
[buttonColors[variant].selected]: isSelected,
|
|
68
|
+
[buttonColors[variant].base]: !isSelected,
|
|
69
|
+
"hover:text-textOnColor active:text-textOnColor [&:hover>*]:fill-iconOnColor [&:active>*]:fill-iconOnColor": isSelected && variant !== "outline" && variant !== "text",
|
|
70
|
+
"pointer-events-none": isDisabled,
|
|
71
|
+
"rounded-button": borderRadius == null,
|
|
72
|
+
"justify-start": justifyContent === "start",
|
|
73
|
+
"justify-center": justifyContent === "center",
|
|
74
|
+
"typography-label16regular": size === "large",
|
|
75
|
+
"typography-label14regular": size !== "large"
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
const Component = elementAs ?? "button";
|
|
79
|
+
return /* @__PURE__ */ jsxs(Component, { className: baseClasses, style: { width, borderRadius }, disabled: isDisabled, ...props, children: [
|
|
80
|
+
before,
|
|
81
|
+
children,
|
|
82
|
+
after
|
|
83
|
+
] });
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/checkbox/checkbox.tsx
|
|
87
|
+
import { focusVisible as focusVisible2 } from "@zenkigen-inc/component-theme";
|
|
88
|
+
import clsx3 from "clsx";
|
|
89
|
+
import { useCallback, useState } from "react";
|
|
90
|
+
|
|
91
|
+
// src/checkbox/checked-icon.tsx
|
|
92
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
93
|
+
var CheckedIcon = () => {
|
|
94
|
+
return /* @__PURE__ */ jsx4(
|
|
95
|
+
"svg",
|
|
96
|
+
{
|
|
97
|
+
viewBox: "0 0 20 20",
|
|
98
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
99
|
+
className: "absolute z-10 size-5 rounded-sm fill-iconOnColor hover:rounded-sm",
|
|
100
|
+
children: /* @__PURE__ */ jsx4(
|
|
101
|
+
"path",
|
|
102
|
+
{
|
|
103
|
+
fillRule: "evenodd",
|
|
104
|
+
clipRule: "evenodd",
|
|
105
|
+
d: "M16.2887 5.38099C16.0069 5.09924 15.5518 5.09924 15.2701 5.38099L7.55461 13.0893L4.72993 10.2646C4.44818 9.98283 3.99305 9.98283 3.71131 10.2646C3.42956 10.5463 3.42956 11.0014 3.71131 11.2832L7.04891 14.6208C7.1934 14.7653 7.374 14.8303 7.56183 14.8303C7.74966 14.8303 7.93027 14.7581 8.07475 14.6208L16.2887 6.40683C16.5704 6.12508 16.5704 5.66273 16.2887 5.38099Z"
|
|
106
|
+
}
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/checkbox/minus-icon.tsx
|
|
113
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
114
|
+
var MinusIcon = () => {
|
|
115
|
+
return /* @__PURE__ */ jsx5(
|
|
116
|
+
"svg",
|
|
117
|
+
{
|
|
118
|
+
viewBox: "0 0 20 20",
|
|
119
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
120
|
+
className: "absolute z-10 size-5 rounded-sm fill-iconOnColor hover:rounded-sm",
|
|
121
|
+
children: /* @__PURE__ */ jsx5("path", { d: "M4.94723 10.5028H9.49726H10.5028H15.0528C15.3293 10.5028 15.5556 10.2766 15.5556 10C15.5556 9.72352 15.3293 9.49725 15.0528 9.49725H10.5028H9.49726H4.94723C4.67071 9.49725 4.44446 9.72352 4.44446 10C4.44446 10.2766 4.67071 10.5028 4.94723 10.5028Z" })
|
|
122
|
+
}
|
|
123
|
+
);
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/checkbox/checkbox.tsx
|
|
127
|
+
import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
128
|
+
function Checkbox({
|
|
129
|
+
name,
|
|
130
|
+
value,
|
|
131
|
+
id,
|
|
132
|
+
isChecked = false,
|
|
133
|
+
isIndeterminate = false,
|
|
134
|
+
isDisabled = false,
|
|
135
|
+
onChange,
|
|
136
|
+
label,
|
|
137
|
+
color = "default"
|
|
138
|
+
}) {
|
|
139
|
+
const [isMouseOver, setIsMouseOver] = useState(false);
|
|
140
|
+
const handleMouseOverInput = useCallback(() => {
|
|
141
|
+
setIsMouseOver(true);
|
|
142
|
+
}, []);
|
|
143
|
+
const handleMouseOutInput = useCallback(() => {
|
|
144
|
+
setIsMouseOver(false);
|
|
145
|
+
}, []);
|
|
146
|
+
const handleChange = useCallback(
|
|
147
|
+
(e) => !isDisabled && onChange?.(e),
|
|
148
|
+
[isDisabled, onChange]
|
|
149
|
+
);
|
|
150
|
+
const baseInputClasses = clsx3("peer absolute z-[1] size-5 opacity-0", {
|
|
151
|
+
"cursor-not-allowed": isDisabled,
|
|
152
|
+
"cursor-pointer": !isDisabled
|
|
153
|
+
});
|
|
154
|
+
const boxClasses = clsx3(
|
|
155
|
+
"inline-flex size-5 items-center justify-center rounded-sm border bg-white",
|
|
156
|
+
focusVisible2.normalPeer,
|
|
157
|
+
{
|
|
158
|
+
"border-disabled01": isDisabled,
|
|
159
|
+
"border-hoverUiBorder": !isDisabled && isMouseOver && color === "default",
|
|
160
|
+
"border-uiBorder03": !isDisabled && !isMouseOver && color === "default",
|
|
161
|
+
"border-interactive02": !isDisabled && !isMouseOver && color === "gray",
|
|
162
|
+
"border-hoverError": !isDisabled && isMouseOver && color === "error",
|
|
163
|
+
"border-supportError": !isDisabled && !isMouseOver && color === "error"
|
|
164
|
+
}
|
|
165
|
+
);
|
|
166
|
+
const indicatorClasses = clsx3("relative flex size-5 flex-[0_0_auto] items-center justify-center", {
|
|
167
|
+
"bg-disabled01": isDisabled && isChecked,
|
|
168
|
+
"border-disabled01": isDisabled
|
|
169
|
+
});
|
|
170
|
+
const afterClasses = clsx3("absolute inset-0 m-auto block rounded-sm", {
|
|
171
|
+
"bg-disabled01": isDisabled && isChecked,
|
|
172
|
+
"bg-hover01": !(isDisabled && isChecked) && isMouseOver,
|
|
173
|
+
"bg-interactive01": !(isDisabled && isChecked) && !isMouseOver,
|
|
174
|
+
"bg-hover02Dark": !(isDisabled && isChecked) && isMouseOver && color === "gray",
|
|
175
|
+
"bg-interactive02": !(isDisabled && isChecked) && !isMouseOver && color === "gray",
|
|
176
|
+
"bg-hoverError": !(isDisabled && isChecked) && isMouseOver && color === "error",
|
|
177
|
+
"bg-supportError": !(isDisabled && isChecked) && !isMouseOver && color === "error",
|
|
178
|
+
"scale-0": !isChecked,
|
|
179
|
+
"scale-100": isChecked
|
|
180
|
+
});
|
|
181
|
+
const hoverIndicatorClasses = clsx3("inline-block size-3 rounded-[1px]", {
|
|
182
|
+
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
183
|
+
});
|
|
184
|
+
const labelClasses = clsx3("typography-label14regular ml-2 flex-[1_0_0] break-all", {
|
|
185
|
+
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
186
|
+
"cursor-pointer text-text01": !isDisabled
|
|
187
|
+
});
|
|
188
|
+
return /* @__PURE__ */ jsxs2("div", { className: "flex items-center", children: [
|
|
189
|
+
/* @__PURE__ */ jsxs2("div", { className: "relative flex size-6 items-center justify-center", children: [
|
|
190
|
+
/* @__PURE__ */ jsx6(
|
|
191
|
+
"input",
|
|
192
|
+
{
|
|
193
|
+
type: "checkbox",
|
|
194
|
+
value,
|
|
195
|
+
name,
|
|
196
|
+
id,
|
|
197
|
+
checked: isChecked,
|
|
198
|
+
disabled: isDisabled,
|
|
199
|
+
onChange: handleChange,
|
|
200
|
+
onMouseOver: handleMouseOverInput,
|
|
201
|
+
onMouseLeave: handleMouseOutInput,
|
|
202
|
+
className: baseInputClasses
|
|
203
|
+
}
|
|
204
|
+
),
|
|
205
|
+
/* @__PURE__ */ jsx6("div", { className: boxClasses, children: /* @__PURE__ */ jsxs2("div", { className: indicatorClasses, children: [
|
|
206
|
+
/* @__PURE__ */ jsxs2("span", { className: afterClasses, children: [
|
|
207
|
+
isChecked && !isIndeterminate && /* @__PURE__ */ jsx6(CheckedIcon, {}),
|
|
208
|
+
isIndeterminate && /* @__PURE__ */ jsx6(MinusIcon, {})
|
|
209
|
+
] }),
|
|
210
|
+
/* @__PURE__ */ jsx6("span", { className: hoverIndicatorClasses })
|
|
211
|
+
] }) })
|
|
212
|
+
] }),
|
|
213
|
+
label != null && /* @__PURE__ */ jsx6("label", { htmlFor: id, className: labelClasses, children: label })
|
|
214
|
+
] });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// src/dropdown/dropdown.tsx
|
|
218
|
+
import { buttonColors as buttonColors2, focusVisible as focusVisible4 } from "@zenkigen-inc/component-theme";
|
|
219
|
+
import clsx7 from "clsx";
|
|
220
|
+
import { useCallback as useCallback2, useRef, useState as useState2 } from "react";
|
|
221
|
+
import { createPortal } from "react-dom";
|
|
222
|
+
|
|
223
|
+
// src/hooks/use-outside-click.ts
|
|
224
|
+
import { useEffect } from "react";
|
|
225
|
+
var useOutsideClick = (ref, handler, enabled = true) => {
|
|
226
|
+
useEffect(() => {
|
|
227
|
+
const listener = (event) => {
|
|
228
|
+
const element = ref?.current;
|
|
229
|
+
if (element == null || Boolean(element.contains(event?.target ?? null))) {
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
handler(event);
|
|
233
|
+
};
|
|
234
|
+
if (enabled) {
|
|
235
|
+
document.addEventListener("click", listener);
|
|
236
|
+
}
|
|
237
|
+
return () => document.removeEventListener("click", listener);
|
|
238
|
+
}, [ref, enabled, handler]);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
// src/icon/icon.tsx
|
|
242
|
+
import { iconElements } from "@zenkigen-inc/component-icons";
|
|
243
|
+
import { iconColors } from "@zenkigen-inc/component-theme";
|
|
244
|
+
import { clsx as clsx4 } from "clsx";
|
|
245
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
246
|
+
var Icon = ({ size = "medium", isDisabled = false, ...props }) => {
|
|
247
|
+
const classes = clsx4(
|
|
248
|
+
"inline-block shrink-0",
|
|
249
|
+
{
|
|
250
|
+
"fill-disabled01": isDisabled,
|
|
251
|
+
[iconColors.icon01]: !isDisabled && props.color === "icon01",
|
|
252
|
+
[iconColors.icon02]: !isDisabled && props.color === "icon02",
|
|
253
|
+
[iconColors.icon03]: !isDisabled && props.color === "icon03",
|
|
254
|
+
[iconColors.iconOnColor]: !isDisabled && props.color === "iconOnColor",
|
|
255
|
+
"w-3 h-3": size === "x-small",
|
|
256
|
+
"w-4 h-4": size === "small",
|
|
257
|
+
"w-6 h-6": size === "medium",
|
|
258
|
+
"w-8 h-8": size === "large",
|
|
259
|
+
"w-10 h-10": size === "x-large"
|
|
260
|
+
},
|
|
261
|
+
props.className
|
|
262
|
+
);
|
|
263
|
+
return /* @__PURE__ */ jsx7("span", { className: classes, children: iconElements[props.name] });
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// src/dropdown/dropdown-context.ts
|
|
267
|
+
import { createContext } from "react";
|
|
268
|
+
var DropdownContext = createContext({
|
|
269
|
+
isVisible: false,
|
|
270
|
+
setIsVisible: () => false,
|
|
271
|
+
isDisabled: false,
|
|
272
|
+
targetDimensions: { width: 0, height: 0 },
|
|
273
|
+
variant: "outline"
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
// src/dropdown/dropdown-item.tsx
|
|
277
|
+
import { focusVisible as focusVisible3 } from "@zenkigen-inc/component-theme";
|
|
278
|
+
import clsx5 from "clsx";
|
|
279
|
+
import { useContext } from "react";
|
|
280
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
281
|
+
function DropdownItem({ children, color = "gray", onClick }) {
|
|
282
|
+
const { setIsVisible } = useContext(DropdownContext);
|
|
283
|
+
const handleClickItem = (event) => {
|
|
284
|
+
setIsVisible(false);
|
|
285
|
+
onClick?.(event);
|
|
286
|
+
};
|
|
287
|
+
const itemClasses = clsx5(
|
|
288
|
+
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
289
|
+
focusVisible3.inset,
|
|
290
|
+
{
|
|
291
|
+
"bg-uiBackground01 fill-icon01 text-interactive02": color === "gray",
|
|
292
|
+
"fill-supportDanger text-supportDanger": color === "red"
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
return /* @__PURE__ */ jsx8("li", { className: "flex w-full items-center", children: /* @__PURE__ */ jsx8("button", { className: itemClasses, type: "button", onClick: handleClickItem, children }) });
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// src/dropdown/dropdown-menu.tsx
|
|
299
|
+
import clsx6 from "clsx";
|
|
300
|
+
import { useContext as useContext2 } from "react";
|
|
301
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
302
|
+
function DropdownMenu({
|
|
303
|
+
children,
|
|
304
|
+
maxHeight,
|
|
305
|
+
isNoPadding = false,
|
|
306
|
+
verticalPosition = "bottom",
|
|
307
|
+
horizontalAlign = "left"
|
|
308
|
+
}) {
|
|
309
|
+
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } = useContext2(DropdownContext);
|
|
310
|
+
const wrapperClasses = clsx6("z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 shadow-floatingShadow", {
|
|
311
|
+
absolute: !portalTargetRef,
|
|
312
|
+
"border-solid border border-uiBorder01": variant === "outline",
|
|
313
|
+
"py-1": !isNoPadding,
|
|
314
|
+
"left-0": horizontalAlign === "left",
|
|
315
|
+
"right-0": horizontalAlign === "right",
|
|
316
|
+
"left-auto": horizontalAlign === "center"
|
|
317
|
+
});
|
|
318
|
+
return isVisible && !isDisabled && /* @__PURE__ */ jsx9(
|
|
319
|
+
"ul",
|
|
320
|
+
{
|
|
321
|
+
className: wrapperClasses,
|
|
322
|
+
style: {
|
|
323
|
+
top: !portalTargetRef && verticalPosition === "bottom" ? `${targetDimensions.height + 4}px` : "unset",
|
|
324
|
+
bottom: !portalTargetRef && verticalPosition === "top" ? `${targetDimensions.height + 4}px` : "unset",
|
|
325
|
+
maxHeight
|
|
326
|
+
},
|
|
327
|
+
children
|
|
328
|
+
}
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// src/dropdown/dropdown.tsx
|
|
333
|
+
import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
334
|
+
function Dropdown({
|
|
335
|
+
children,
|
|
336
|
+
target,
|
|
337
|
+
label,
|
|
338
|
+
icon,
|
|
339
|
+
size = "medium",
|
|
340
|
+
variant = "outline",
|
|
341
|
+
title,
|
|
342
|
+
isDisabled = false,
|
|
343
|
+
isArrowHidden = false,
|
|
344
|
+
portalTargetRef
|
|
345
|
+
}) {
|
|
346
|
+
const [isVisible, setIsVisible] = useState2(false);
|
|
347
|
+
const [targetDimensions, setTargetDimensions] = useState2({
|
|
348
|
+
width: 0,
|
|
349
|
+
height: 0
|
|
350
|
+
});
|
|
351
|
+
const targetRef = useRef(null);
|
|
352
|
+
useOutsideClick(targetRef, () => setIsVisible(false));
|
|
353
|
+
const handleToggle = useCallback2(() => {
|
|
354
|
+
if (targetRef.current === null) {
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (isVisible) {
|
|
358
|
+
setIsVisible(false);
|
|
359
|
+
} else {
|
|
360
|
+
const dimensions = targetRef.current.getBoundingClientRect();
|
|
361
|
+
const calculatedDimensions = {
|
|
362
|
+
width: dimensions.right - dimensions.left,
|
|
363
|
+
height: dimensions.bottom - dimensions.top
|
|
364
|
+
};
|
|
365
|
+
setTargetDimensions(calculatedDimensions);
|
|
366
|
+
setIsVisible(true);
|
|
367
|
+
}
|
|
368
|
+
}, [isVisible]);
|
|
369
|
+
const wrapperClasses = clsx7("relative flex shrink-0 items-center gap-1 rounded", {
|
|
370
|
+
"cursor-not-allowed": isDisabled
|
|
371
|
+
});
|
|
372
|
+
const childrenButtonClasses = clsx7(
|
|
373
|
+
"flex items-center justify-center rounded bg-uiBackground01 p-1 hover:bg-hover02 active:bg-active02",
|
|
374
|
+
focusVisible4.normal,
|
|
375
|
+
{
|
|
376
|
+
"pointer-events-none": isDisabled,
|
|
377
|
+
"border border-uiBorder02": variant === "outline"
|
|
378
|
+
}
|
|
379
|
+
);
|
|
380
|
+
const buttonClasses = clsx7(
|
|
381
|
+
"flex items-center rounded bg-uiBackground01",
|
|
382
|
+
buttonColors2[variant].base,
|
|
383
|
+
buttonColors2[variant].hover,
|
|
384
|
+
buttonColors2[variant].active,
|
|
385
|
+
buttonColors2[variant].disabled,
|
|
386
|
+
focusVisible4.normal,
|
|
387
|
+
{
|
|
388
|
+
"pointer-events-none": isDisabled,
|
|
389
|
+
"h-6 px-2": size === "x-small" || size === "small",
|
|
390
|
+
"h-8 px-4": size === "medium",
|
|
391
|
+
"h-10 px-4": size === "large"
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
const labelClasses = clsx7("flex items-center", {
|
|
395
|
+
"mr-1": !isArrowHidden && size === "x-small",
|
|
396
|
+
"mr-2": !isArrowHidden && size !== "x-small",
|
|
397
|
+
"typography-label12regular": size === "x-small",
|
|
398
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
399
|
+
"typography-label16regular": size === "large"
|
|
400
|
+
});
|
|
401
|
+
return /* @__PURE__ */ jsx10(
|
|
402
|
+
DropdownContext.Provider,
|
|
403
|
+
{
|
|
404
|
+
value: { isVisible, setIsVisible, isDisabled, targetDimensions, variant, portalTargetRef },
|
|
405
|
+
children: /* @__PURE__ */ jsxs3("div", { ref: targetRef, className: wrapperClasses, children: [
|
|
406
|
+
target ? /* @__PURE__ */ jsxs3(
|
|
407
|
+
"button",
|
|
408
|
+
{
|
|
409
|
+
type: "button",
|
|
410
|
+
title,
|
|
411
|
+
className: childrenButtonClasses,
|
|
412
|
+
onClick: handleToggle,
|
|
413
|
+
disabled: isDisabled,
|
|
414
|
+
children: [
|
|
415
|
+
target,
|
|
416
|
+
!isArrowHidden && /* @__PURE__ */ jsx10("div", { className: "ml-2 flex items-center fill-icon01", children: /* @__PURE__ */ jsx10(
|
|
417
|
+
Icon,
|
|
418
|
+
{
|
|
419
|
+
name: isVisible ? "angle-small-up" : "angle-small-down",
|
|
420
|
+
size: size === "large" ? "medium" : "small"
|
|
421
|
+
}
|
|
422
|
+
) })
|
|
423
|
+
]
|
|
424
|
+
}
|
|
425
|
+
) : /* @__PURE__ */ jsxs3("button", { type: "button", title, className: buttonClasses, onClick: handleToggle, disabled: isDisabled, children: [
|
|
426
|
+
icon && /* @__PURE__ */ jsx10("span", { className: "mr-1 flex", children: /* @__PURE__ */ jsx10(Icon, { name: icon, size: size === "large" ? "medium" : "small" }) }),
|
|
427
|
+
/* @__PURE__ */ jsx10("span", { className: labelClasses, children: label }),
|
|
428
|
+
!isArrowHidden && /* @__PURE__ */ jsx10("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx10(Icon, { name: isVisible ? "angle-small-up" : "angle-small-down", size: "small" }) })
|
|
429
|
+
] }),
|
|
430
|
+
!portalTargetRef ? children : portalTargetRef != null && portalTargetRef.current && createPortal(children, portalTargetRef.current)
|
|
431
|
+
] })
|
|
432
|
+
}
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
Dropdown.Menu = DropdownMenu;
|
|
436
|
+
Dropdown.Item = DropdownItem;
|
|
437
|
+
|
|
438
|
+
// src/evaluation-star/evaluation-star.tsx
|
|
439
|
+
import { iconElements as iconElements2 } from "@zenkigen-inc/component-icons";
|
|
440
|
+
import { focusVisible as focusVisible5 } from "@zenkigen-inc/component-theme";
|
|
441
|
+
import clsx8 from "clsx";
|
|
442
|
+
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
443
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
444
|
+
function EvaluationStar({ value, isEditable = false, onChangeRating, size = "medium" }) {
|
|
445
|
+
const maxRating = 5;
|
|
446
|
+
const [currentRating, setCurrentRating] = useState3(value);
|
|
447
|
+
const handleChangeRating = useCallback3(
|
|
448
|
+
(newRating) => {
|
|
449
|
+
if (isEditable) {
|
|
450
|
+
setCurrentRating(newRating);
|
|
451
|
+
if (onChangeRating) {
|
|
452
|
+
onChangeRating(newRating);
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
},
|
|
456
|
+
[isEditable, onChangeRating]
|
|
457
|
+
);
|
|
458
|
+
const starClasses = clsx8(focusVisible5.inset, { "w-6 h-6": size === "large", "w-4 h-4": size === "medium" });
|
|
459
|
+
const renderStar = (rating) => {
|
|
460
|
+
const color = rating <= currentRating ? "fill-yellow-yellow50" : "fill-icon03";
|
|
461
|
+
return /* @__PURE__ */ jsx11(
|
|
462
|
+
"button",
|
|
463
|
+
{
|
|
464
|
+
type: "button",
|
|
465
|
+
onClick: () => handleChangeRating(rating),
|
|
466
|
+
className: clsx8(color, starClasses),
|
|
467
|
+
disabled: !isEditable,
|
|
468
|
+
children: iconElements2["star-filled"]
|
|
469
|
+
},
|
|
470
|
+
rating
|
|
471
|
+
);
|
|
472
|
+
};
|
|
473
|
+
const ratingStars = Array.from({ length: maxRating }, (_, index) => renderStar(index + 1));
|
|
474
|
+
return /* @__PURE__ */ jsx11("span", { className: "flex flex-row", children: ratingStars });
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// src/heading/heading.tsx
|
|
478
|
+
import { typography } from "@zenkigen-inc/component-theme";
|
|
479
|
+
import { clsx as clsx9 } from "clsx";
|
|
480
|
+
import { jsxs as jsxs4 } from "react/jsx-runtime";
|
|
481
|
+
function Heading(props) {
|
|
482
|
+
const TagName = `h${props.level}`;
|
|
483
|
+
const classes = clsx9(`flex items-center text-text01`, typography.heading[TagName], {
|
|
484
|
+
"gap-2": props.level === 1,
|
|
485
|
+
"gap-1": props.level > 1
|
|
486
|
+
});
|
|
487
|
+
return /* @__PURE__ */ jsxs4(TagName, { className: classes, children: [
|
|
488
|
+
props.before,
|
|
489
|
+
props.children,
|
|
490
|
+
props.after
|
|
491
|
+
] });
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// src/icon-button/icon-button.tsx
|
|
495
|
+
import { buttonColors as buttonColors3, focusVisible as focusVisible6 } from "@zenkigen-inc/component-theme";
|
|
496
|
+
import { clsx as clsx10 } from "clsx";
|
|
497
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
498
|
+
function IconButton({
|
|
499
|
+
size = "medium",
|
|
500
|
+
variant = "outline",
|
|
501
|
+
isNoPadding = false,
|
|
502
|
+
isDisabled = false,
|
|
503
|
+
...props
|
|
504
|
+
}) {
|
|
505
|
+
const baseClasses = clsx10(
|
|
506
|
+
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
507
|
+
buttonColors3[variant].base,
|
|
508
|
+
buttonColors3[variant].hover,
|
|
509
|
+
buttonColors3[variant].active,
|
|
510
|
+
buttonColors3[variant].disabled,
|
|
511
|
+
focusVisible6.normal,
|
|
512
|
+
{
|
|
513
|
+
"h-4 w-4": size === "small" && isNoPadding,
|
|
514
|
+
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
515
|
+
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
516
|
+
"h-10 w-10": size === "large" && !isNoPadding,
|
|
517
|
+
"inline-flex": props.isAnchor,
|
|
518
|
+
"pointer-events-none": isDisabled
|
|
519
|
+
}
|
|
520
|
+
);
|
|
521
|
+
const iconSize = size === "small" ? "small" : "medium";
|
|
522
|
+
if (props.isAnchor === true) {
|
|
523
|
+
return /* @__PURE__ */ jsx12("a", { className: baseClasses, href: props.href, target: props.target, children: /* @__PURE__ */ jsx12(Icon, { name: props.icon, size: iconSize }) });
|
|
524
|
+
} else {
|
|
525
|
+
return /* @__PURE__ */ jsx12("button", { type: "button", className: baseClasses, disabled: isDisabled, onClick: props.onClick, children: /* @__PURE__ */ jsx12(Icon, { name: props.icon, size: iconSize }) });
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// src/loading/loading.tsx
|
|
530
|
+
import clsx11 from "clsx";
|
|
531
|
+
import { Fragment, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
532
|
+
function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
533
|
+
const wrapperClasses = clsx11(position, "left-0 top-0 z-20 flex w-full items-center justify-center");
|
|
534
|
+
const svgClasses = clsx11({
|
|
535
|
+
"h-4 w-4": size === "small",
|
|
536
|
+
"h-8 w-8": size === "medium",
|
|
537
|
+
"h-16 w-16": size === "large"
|
|
538
|
+
});
|
|
539
|
+
return /* @__PURE__ */ jsx13(Fragment, { children: /* @__PURE__ */ jsxs5("div", { className: wrapperClasses, style: { height }, children: [
|
|
540
|
+
size === "small" && /* @__PURE__ */ jsx13("svg", { className: svgClasses, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13(
|
|
541
|
+
"circle",
|
|
542
|
+
{
|
|
543
|
+
className: "origin-center animate-circular-small-move stroke-interactive01",
|
|
544
|
+
cx: "8",
|
|
545
|
+
cy: "8",
|
|
546
|
+
r: "7",
|
|
547
|
+
stroke: "currentColor",
|
|
548
|
+
strokeWidth: "1.5",
|
|
549
|
+
fill: "none"
|
|
550
|
+
}
|
|
551
|
+
) }),
|
|
552
|
+
size === "medium" && /* @__PURE__ */ jsx13("svg", { className: svgClasses, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13(
|
|
553
|
+
"circle",
|
|
554
|
+
{
|
|
555
|
+
className: "origin-center animate-circular-medium-move stroke-interactive01",
|
|
556
|
+
cx: "16",
|
|
557
|
+
cy: "16",
|
|
558
|
+
r: "15",
|
|
559
|
+
stroke: "currentColor",
|
|
560
|
+
strokeWidth: "2",
|
|
561
|
+
fill: "none"
|
|
562
|
+
}
|
|
563
|
+
) }),
|
|
564
|
+
size === "large" && /* @__PURE__ */ jsx13("svg", { className: svgClasses, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx13(
|
|
565
|
+
"circle",
|
|
566
|
+
{
|
|
567
|
+
className: "origin-center animate-circular-large-move stroke-interactive01",
|
|
568
|
+
cx: "32",
|
|
569
|
+
cy: "32",
|
|
570
|
+
r: "30",
|
|
571
|
+
stroke: "currentColor",
|
|
572
|
+
strokeWidth: "3",
|
|
573
|
+
fill: "none"
|
|
574
|
+
}
|
|
575
|
+
) })
|
|
576
|
+
] }) });
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// src/modal/modal.tsx
|
|
580
|
+
import { useEffect as useEffect2, useState as useState4 } from "react";
|
|
581
|
+
import { createPortal as createPortal2 } from "react-dom";
|
|
582
|
+
|
|
583
|
+
// src/modal/body-scroll-lock.tsx
|
|
584
|
+
import { useLayoutEffect } from "react";
|
|
585
|
+
var BodyScrollLock = () => {
|
|
586
|
+
useLayoutEffect(() => {
|
|
587
|
+
const { scrollX, scrollY } = window;
|
|
588
|
+
const { body } = document;
|
|
589
|
+
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
|
590
|
+
const scrollbarWidth = hasVerticalScrollbar ? window.innerWidth - document.documentElement.clientWidth : 0;
|
|
591
|
+
const originalInlineStyles = {
|
|
592
|
+
position: body.style.position,
|
|
593
|
+
top: body.style.top,
|
|
594
|
+
left: body.style.left,
|
|
595
|
+
width: body.style.width,
|
|
596
|
+
overflow: body.style.overflow,
|
|
597
|
+
paddingRight: body.style.paddingRight
|
|
598
|
+
};
|
|
599
|
+
body.style.position = "fixed";
|
|
600
|
+
body.style.top = `-${scrollY}px`;
|
|
601
|
+
body.style.left = `-${scrollX}px`;
|
|
602
|
+
body.style.width = "100%";
|
|
603
|
+
body.style.overflow = "hidden";
|
|
604
|
+
if (hasVerticalScrollbar && scrollbarWidth > 0) {
|
|
605
|
+
const { paddingRight } = window.getComputedStyle(body);
|
|
606
|
+
const paddingRightValue = paddingRight !== "" ? parseInt(paddingRight, 10) : 0;
|
|
607
|
+
body.style.paddingRight = `${paddingRightValue + scrollbarWidth}px`;
|
|
608
|
+
}
|
|
609
|
+
return () => {
|
|
610
|
+
const { position, top, left, width, overflow, paddingRight } = originalInlineStyles;
|
|
611
|
+
restoreProperty(body, "position", position);
|
|
612
|
+
restoreProperty(body, "top", top);
|
|
613
|
+
restoreProperty(body, "left", left);
|
|
614
|
+
restoreProperty(body, "width", width);
|
|
615
|
+
restoreProperty(body, "overflow", overflow);
|
|
616
|
+
restoreProperty(body, "padding-right", paddingRight);
|
|
617
|
+
window.scrollTo(scrollX, scrollY);
|
|
618
|
+
};
|
|
619
|
+
}, []);
|
|
620
|
+
return null;
|
|
621
|
+
};
|
|
622
|
+
function restoreProperty(element, property, value) {
|
|
623
|
+
if (value !== "") {
|
|
624
|
+
element.style.setProperty(property, value);
|
|
625
|
+
} else {
|
|
626
|
+
element.style.removeProperty(property);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
// src/modal/modal-body.tsx
|
|
631
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
632
|
+
function ModalBody({ children }) {
|
|
633
|
+
return /* @__PURE__ */ jsx14("div", { className: "overflow-y-auto", children });
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// src/modal/modal-context.ts
|
|
637
|
+
import { createContext as createContext2 } from "react";
|
|
638
|
+
var ModalContext = createContext2({
|
|
639
|
+
onClose: () => null
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
// src/modal/modal-footer.tsx
|
|
643
|
+
import clsx12 from "clsx";
|
|
644
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
645
|
+
function ModalFooter({ children, isNoBorder = false }) {
|
|
646
|
+
const wrapperClasses = clsx12("flex w-full shrink-0 items-center rounded-b-lg px-6 py-4", {
|
|
647
|
+
"border-t-[1px] border-uiBorder01": !isNoBorder
|
|
648
|
+
});
|
|
649
|
+
return /* @__PURE__ */ jsx15("div", { className: wrapperClasses, children });
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// src/modal/modal-header.tsx
|
|
653
|
+
import clsx13 from "clsx";
|
|
654
|
+
import { useContext as useContext3 } from "react";
|
|
655
|
+
import { jsx as jsx16, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
656
|
+
function ModalHeader({ children, isNoBorder = false }) {
|
|
657
|
+
const { onClose } = useContext3(ModalContext);
|
|
658
|
+
const headerClasses = clsx13(
|
|
659
|
+
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
660
|
+
{
|
|
661
|
+
"border-b border-uiBorder01": !isNoBorder,
|
|
662
|
+
"h-14": !onClose,
|
|
663
|
+
"h-12": onClose
|
|
664
|
+
}
|
|
665
|
+
);
|
|
666
|
+
return /* @__PURE__ */ jsxs6("div", { className: headerClasses, children: [
|
|
667
|
+
/* @__PURE__ */ jsx16("div", { children }),
|
|
668
|
+
onClose && /* @__PURE__ */ jsx16(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
669
|
+
] });
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// src/modal/modal.tsx
|
|
673
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
674
|
+
var LIMIT_WIDTH = 320;
|
|
675
|
+
var LIMIT_HEIGHT = 184;
|
|
676
|
+
function Modal({
|
|
677
|
+
children,
|
|
678
|
+
width = 480,
|
|
679
|
+
height,
|
|
680
|
+
maxWidth = "calc(100vw - 40px)",
|
|
681
|
+
isOpen,
|
|
682
|
+
onClose,
|
|
683
|
+
portalTargetRef
|
|
684
|
+
}) {
|
|
685
|
+
const [isMounted, setIsMounted] = useState4(false);
|
|
686
|
+
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
687
|
+
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
688
|
+
useEffect2(() => {
|
|
689
|
+
setIsMounted(true);
|
|
690
|
+
}, []);
|
|
691
|
+
return isMounted && isOpen ? /* @__PURE__ */ jsxs7(Fragment2, { children: [
|
|
692
|
+
/* @__PURE__ */ jsx17(BodyScrollLock, {}),
|
|
693
|
+
createPortal2(
|
|
694
|
+
/* @__PURE__ */ jsx17(ModalContext.Provider, { value: { onClose }, children: /* @__PURE__ */ jsx17("div", { className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4", children: /* @__PURE__ */ jsx17(
|
|
695
|
+
"div",
|
|
696
|
+
{
|
|
697
|
+
className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow",
|
|
698
|
+
style: { width: renderWidth, height: renderHeight, maxWidth },
|
|
699
|
+
children
|
|
700
|
+
}
|
|
701
|
+
) }) }),
|
|
702
|
+
portalTargetRef?.current != null ? portalTargetRef.current : document.body
|
|
703
|
+
)
|
|
704
|
+
] }) : null;
|
|
705
|
+
}
|
|
706
|
+
Modal.Body = ModalBody;
|
|
707
|
+
Modal.Header = ModalHeader;
|
|
708
|
+
Modal.Footer = ModalFooter;
|
|
709
|
+
|
|
710
|
+
// src/notification-inline/notification-inline.tsx
|
|
711
|
+
import { clsx as clsx14 } from "clsx";
|
|
712
|
+
import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
713
|
+
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
714
|
+
const wrapperClasses = clsx14("typography-body13regular flex items-center gap-1 rounded text-text01", {
|
|
715
|
+
"bg-uiBackgroundError": state === "attention",
|
|
716
|
+
"bg-uiBackgroundWarning": state === "warning",
|
|
717
|
+
"bg-uiBackgroundBlue": state === "information",
|
|
718
|
+
"bg-uiBackgroundSuccess": state === "success",
|
|
719
|
+
"bg-uiBackgroundGray": state === "default",
|
|
720
|
+
"p-2": size === "small",
|
|
721
|
+
"p-3": size === "medium"
|
|
722
|
+
});
|
|
723
|
+
const iconClasses = clsx14("flex items-center", {
|
|
724
|
+
"fill-supportError": state === "attention",
|
|
725
|
+
"fill-supportWarning": state === "warning",
|
|
726
|
+
"fill-blue-blue50": state === "information",
|
|
727
|
+
"fill-supportSuccess": state === "success"
|
|
728
|
+
});
|
|
729
|
+
const iconName = {
|
|
730
|
+
attention: "attention",
|
|
731
|
+
success: "success-filled",
|
|
732
|
+
warning: "warning",
|
|
733
|
+
information: "information-filled"
|
|
734
|
+
};
|
|
735
|
+
const iconSize = {
|
|
736
|
+
small: "small",
|
|
737
|
+
medium: "medium"
|
|
738
|
+
};
|
|
739
|
+
return /* @__PURE__ */ jsxs8("div", { className: wrapperClasses, children: [
|
|
740
|
+
state !== "default" && /* @__PURE__ */ jsx18("div", { className: iconClasses, children: /* @__PURE__ */ jsx18(Icon, { name: iconName[state], size: iconSize[size] }) }),
|
|
741
|
+
/* @__PURE__ */ jsx18("p", { className: "flex-1", children: props.children }),
|
|
742
|
+
props.showClose === true && /* @__PURE__ */ jsx18("div", { className: "flex items-center", children: /* @__PURE__ */ jsx18(IconButton, { icon: "close", size: "small", variant: "text" }) })
|
|
743
|
+
] });
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// src/pagination/pagination-button.tsx
|
|
747
|
+
import { clsx as clsx15 } from "clsx";
|
|
748
|
+
import { useContext as useContext4 } from "react";
|
|
749
|
+
|
|
750
|
+
// src/pagination/pagination-context.ts
|
|
751
|
+
import { createContext as createContext3 } from "react";
|
|
752
|
+
var PaginationContext = createContext3({
|
|
753
|
+
currentPage: 0
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
// src/pagination/pagination-button.tsx
|
|
757
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
758
|
+
function PaginationButton({ page, onClick }) {
|
|
759
|
+
const { currentPage } = useContext4(PaginationContext);
|
|
760
|
+
const buttonClasses = clsx15(
|
|
761
|
+
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
762
|
+
"typography-label14regular",
|
|
763
|
+
"text-interactive02",
|
|
764
|
+
"hover:bg-hover02",
|
|
765
|
+
{ "border border-uiBorder02": page === currentPage },
|
|
766
|
+
{ "border-transparent": page !== currentPage }
|
|
767
|
+
);
|
|
768
|
+
return /* @__PURE__ */ jsx19("button", { type: "button", className: buttonClasses, onClick: () => onClick(page), children: page });
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
// src/pagination/pagination.tsx
|
|
772
|
+
import { jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
773
|
+
var START_PAGE = 1;
|
|
774
|
+
function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick }) {
|
|
775
|
+
let center = Math.max(currentPage, START_PAGE + 1);
|
|
776
|
+
center = Math.min(center, totalPage - 1);
|
|
777
|
+
const start = Math.max(center - sideNumPagesToShow, START_PAGE + 1);
|
|
778
|
+
const end = Math.min(center + sideNumPagesToShow, totalPage - 1);
|
|
779
|
+
const offsetStart = center + sideNumPagesToShow >= totalPage ? totalPage - center - sideNumPagesToShow : 0;
|
|
780
|
+
const offsetEnd = center <= sideNumPagesToShow ? sideNumPagesToShow - center + 1 : 0;
|
|
781
|
+
const pageList = [];
|
|
782
|
+
for (let i = start + offsetStart; i <= end + offsetEnd; i++) {
|
|
783
|
+
pageList.push(i);
|
|
784
|
+
}
|
|
785
|
+
const threeDotIconClasses = "flex h-8 w-8 items-center justify-center gap-1 fill-icon01";
|
|
786
|
+
return /* @__PURE__ */ jsx20(
|
|
787
|
+
PaginationContext.Provider,
|
|
788
|
+
{
|
|
789
|
+
value: {
|
|
790
|
+
currentPage
|
|
791
|
+
},
|
|
792
|
+
children: /* @__PURE__ */ jsxs9("ul", { className: "flex gap-1", children: [
|
|
793
|
+
/* @__PURE__ */ jsx20("li", { className: "flex items-center", children: /* @__PURE__ */ jsx20(
|
|
794
|
+
IconButton,
|
|
795
|
+
{
|
|
796
|
+
isDisabled: currentPage === START_PAGE,
|
|
797
|
+
variant: "text",
|
|
798
|
+
icon: "angle-left",
|
|
799
|
+
size: "small",
|
|
800
|
+
onClick: () => onClick(currentPage - 1)
|
|
801
|
+
}
|
|
802
|
+
) }),
|
|
803
|
+
/* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(PaginationButton, { onClick: () => onClick(START_PAGE), page: START_PAGE }) }),
|
|
804
|
+
pageList.length !== 0 && pageList[0] !== 2 && /* @__PURE__ */ jsx20("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx20(Icon, { name: "more", size: "small" }) }),
|
|
805
|
+
pageList.map((page, index) => /* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(PaginationButton, { onClick: () => onClick(page), page }) }, index)),
|
|
806
|
+
pageList.length !== 0 && pageList[pageList.length - 1] !== totalPage - 1 && /* @__PURE__ */ jsx20("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx20(Icon, { name: "more", size: "small" }) }),
|
|
807
|
+
/* @__PURE__ */ jsx20("li", { children: /* @__PURE__ */ jsx20(PaginationButton, { onClick: () => onClick(totalPage), page: totalPage }) }),
|
|
808
|
+
/* @__PURE__ */ jsx20("li", { className: "flex items-center", children: /* @__PURE__ */ jsx20(
|
|
809
|
+
IconButton,
|
|
810
|
+
{
|
|
811
|
+
isDisabled: currentPage === totalPage,
|
|
812
|
+
variant: "text",
|
|
813
|
+
icon: "angle-right",
|
|
814
|
+
size: "small",
|
|
815
|
+
onClick: () => onClick(currentPage + 1)
|
|
816
|
+
}
|
|
817
|
+
) })
|
|
818
|
+
] })
|
|
819
|
+
}
|
|
820
|
+
);
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
// src/select/select.tsx
|
|
824
|
+
import { buttonColors as buttonColors4, focusVisible as focusVisible9 } from "@zenkigen-inc/component-theme";
|
|
825
|
+
import clsx18 from "clsx";
|
|
826
|
+
import { useRef as useRef3, useState as useState5 } from "react";
|
|
827
|
+
|
|
828
|
+
// src/select/select-context.ts
|
|
829
|
+
import { createContext as createContext4 } from "react";
|
|
830
|
+
var SelectContext = createContext4({
|
|
831
|
+
size: "medium",
|
|
832
|
+
setIsOptionListOpen: () => false,
|
|
833
|
+
variant: "outline"
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// src/select/select-item.tsx
|
|
837
|
+
import { focusVisible as focusVisible7 } from "@zenkigen-inc/component-theme";
|
|
838
|
+
import clsx16 from "clsx";
|
|
839
|
+
import { useContext as useContext5 } from "react";
|
|
840
|
+
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
841
|
+
function SelectItem({ option }) {
|
|
842
|
+
const { setIsOptionListOpen, selectedOption, onChange } = useContext5(SelectContext);
|
|
843
|
+
const handleClickItem = (option2) => {
|
|
844
|
+
onChange?.(option2);
|
|
845
|
+
setIsOptionListOpen(false);
|
|
846
|
+
};
|
|
847
|
+
const itemClasses = clsx16(
|
|
848
|
+
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
849
|
+
focusVisible7.inset,
|
|
850
|
+
{
|
|
851
|
+
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id,
|
|
852
|
+
"text-interactive02 fill-icon01 bg-uiBackground01": option.id !== selectedOption?.id
|
|
853
|
+
}
|
|
854
|
+
);
|
|
855
|
+
return /* @__PURE__ */ jsx21("li", { className: "flex w-full items-center", "data-id": option.id, children: /* @__PURE__ */ jsxs10("button", { className: itemClasses, type: "button", onClick: () => handleClickItem(option), children: [
|
|
856
|
+
option.icon && /* @__PURE__ */ jsx21(Icon, { name: option.icon, size: "small" }),
|
|
857
|
+
/* @__PURE__ */ jsx21("span", { className: "ml-1 mr-6", children: option.label }),
|
|
858
|
+
option.id === selectedOption?.id && /* @__PURE__ */ jsx21("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx21(Icon, { name: "check", size: "small" }) })
|
|
859
|
+
] }) }, option.id);
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// src/select/select-list.tsx
|
|
863
|
+
import { focusVisible as focusVisible8 } from "@zenkigen-inc/component-theme";
|
|
864
|
+
import clsx17 from "clsx";
|
|
865
|
+
import { useContext as useContext6, useLayoutEffect as useLayoutEffect2, useRef as useRef2 } from "react";
|
|
866
|
+
import { jsx as jsx22, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
867
|
+
function SelectList({ children, maxHeight }) {
|
|
868
|
+
const ref = useRef2(null);
|
|
869
|
+
const { size, selectedOption, setIsOptionListOpen, variant, placeholder, onChange } = useContext6(SelectContext);
|
|
870
|
+
const handleClickDeselect = () => {
|
|
871
|
+
onChange?.(null);
|
|
872
|
+
setIsOptionListOpen(false);
|
|
873
|
+
};
|
|
874
|
+
useLayoutEffect2(() => {
|
|
875
|
+
if (maxHeight != null && ref.current) {
|
|
876
|
+
const element = Array.from(ref.current.children ?? []).find(
|
|
877
|
+
(item) => item.getAttribute("data-id") === selectedOption?.id
|
|
878
|
+
);
|
|
879
|
+
if (element != null && ref.current.scroll != null) {
|
|
880
|
+
const wrapRect = ref.current.getBoundingClientRect();
|
|
881
|
+
const rect = element.getBoundingClientRect();
|
|
882
|
+
ref.current.scroll(0, rect.top - wrapRect.top - wrapRect.height / 2 + rect.height / 2);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}, []);
|
|
886
|
+
const listClasses = clsx17(
|
|
887
|
+
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
888
|
+
{
|
|
889
|
+
"top-7": size === "x-small" || size === "small",
|
|
890
|
+
"top-9": size === "medium",
|
|
891
|
+
"top-11": size === "large",
|
|
892
|
+
"border-solid border border-uiBorder01": variant === "outline"
|
|
893
|
+
}
|
|
894
|
+
);
|
|
895
|
+
const deselectButtonClasses = clsx17(
|
|
896
|
+
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
897
|
+
focusVisible8.inset
|
|
898
|
+
);
|
|
899
|
+
return /* @__PURE__ */ jsxs11("ul", { className: listClasses, style: { maxHeight }, ref, children: [
|
|
900
|
+
children,
|
|
901
|
+
placeholder != null && selectedOption !== null && /* @__PURE__ */ jsx22("li", { children: /* @__PURE__ */ jsx22("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
902
|
+
] });
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
// src/select/select.tsx
|
|
906
|
+
import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
907
|
+
function Select({
|
|
908
|
+
children,
|
|
909
|
+
size = "medium",
|
|
910
|
+
variant = "outline",
|
|
911
|
+
width,
|
|
912
|
+
maxWidth,
|
|
913
|
+
placeholder,
|
|
914
|
+
placeholderIcon,
|
|
915
|
+
selectedOption = null,
|
|
916
|
+
isDisabled = false,
|
|
917
|
+
isOptionSelected = false,
|
|
918
|
+
onChange,
|
|
919
|
+
optionListMaxHeight
|
|
920
|
+
}) {
|
|
921
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState5(false);
|
|
922
|
+
const targetRef = useRef3(null);
|
|
923
|
+
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
924
|
+
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
925
|
+
const wrapperClasses = clsx18("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
926
|
+
"h-6": size === "x-small" || size === "small",
|
|
927
|
+
"h-8": size === "medium",
|
|
928
|
+
"h-10": size === "large",
|
|
929
|
+
"cursor-not-allowed": isDisabled
|
|
930
|
+
});
|
|
931
|
+
const buttonClasses = clsx18(
|
|
932
|
+
"flex size-full items-center rounded",
|
|
933
|
+
buttonColors4[variant].hover,
|
|
934
|
+
buttonColors4[variant].active,
|
|
935
|
+
buttonColors4[variant].disabled,
|
|
936
|
+
focusVisible9.normal,
|
|
937
|
+
{
|
|
938
|
+
[buttonColors4[variant].selected]: isOptionSelected && !isDisabled && selectedOption,
|
|
939
|
+
[buttonColors4[variant].base]: !(isOptionSelected && !isDisabled && selectedOption),
|
|
940
|
+
"px-2": size === "x-small" || size === "small",
|
|
941
|
+
"px-4": size === "medium" || size === "large",
|
|
942
|
+
"pointer-events-none": isDisabled
|
|
943
|
+
}
|
|
944
|
+
);
|
|
945
|
+
const labelClasses = clsx18("overflow-hidden", {
|
|
946
|
+
"mr-1": size === "x-small",
|
|
947
|
+
"mr-2": size !== "x-small",
|
|
948
|
+
"typography-label12regular": size === "x-small",
|
|
949
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
950
|
+
"typography-label16regular": size === "large"
|
|
951
|
+
});
|
|
952
|
+
return /* @__PURE__ */ jsx23(
|
|
953
|
+
SelectContext.Provider,
|
|
954
|
+
{
|
|
955
|
+
value: {
|
|
956
|
+
size,
|
|
957
|
+
variant,
|
|
958
|
+
placeholder,
|
|
959
|
+
setIsOptionListOpen,
|
|
960
|
+
selectedOption,
|
|
961
|
+
onChange
|
|
962
|
+
},
|
|
963
|
+
children: /* @__PURE__ */ jsxs12("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
964
|
+
/* @__PURE__ */ jsxs12("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
965
|
+
selectedOption?.icon ? /* @__PURE__ */ jsx23("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx23(Icon, { name: selectedOption.icon, size: size === "large" ? "medium" : "small" }) }) : placeholder != null && placeholderIcon && /* @__PURE__ */ jsx23("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx23(Icon, { name: placeholderIcon, size: size === "large" ? "medium" : "small" }) }),
|
|
966
|
+
/* @__PURE__ */ jsx23("div", { className: labelClasses, children: /* @__PURE__ */ jsx23("div", { className: "truncate", children: selectedOption ? selectedOption.label : placeholder != null && placeholder }) }),
|
|
967
|
+
/* @__PURE__ */ jsx23("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx23(
|
|
968
|
+
Icon,
|
|
969
|
+
{
|
|
970
|
+
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
971
|
+
size: size === "large" ? "medium" : "small"
|
|
972
|
+
}
|
|
973
|
+
) })
|
|
974
|
+
] }),
|
|
975
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx23(SelectList, { maxHeight: optionListMaxHeight, children })
|
|
976
|
+
] })
|
|
977
|
+
}
|
|
978
|
+
);
|
|
979
|
+
}
|
|
980
|
+
Select.Option = SelectItem;
|
|
981
|
+
|
|
982
|
+
// src/pagination-select/pagination-select.tsx
|
|
983
|
+
import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
984
|
+
function PaginationSelect({
|
|
985
|
+
totalSize,
|
|
986
|
+
currentPage,
|
|
987
|
+
sizePerPage,
|
|
988
|
+
countLabel = "\u4EF6",
|
|
989
|
+
pageLabel = "\u30DA\u30FC\u30B8",
|
|
990
|
+
optionListMaxHeight = 190,
|
|
991
|
+
onClickPrevButton,
|
|
992
|
+
onClickNextButton,
|
|
993
|
+
onChange
|
|
994
|
+
}) {
|
|
995
|
+
const pageMax = Math.ceil(totalSize / sizePerPage);
|
|
996
|
+
const optionsList = [...Array(pageMax)].map((_, index) => {
|
|
997
|
+
const value = (index + 1).toString();
|
|
998
|
+
return {
|
|
999
|
+
id: value,
|
|
1000
|
+
value,
|
|
1001
|
+
label: value
|
|
1002
|
+
};
|
|
1003
|
+
});
|
|
1004
|
+
const minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
|
|
1005
|
+
const maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
|
|
1006
|
+
return /* @__PURE__ */ jsxs13("nav", { "aria-label": "pagination", className: "flex items-center gap-x-1", children: [
|
|
1007
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-x-2", children: [
|
|
1008
|
+
/* @__PURE__ */ jsxs13("div", { className: "typography-label14regular text-text01", children: [
|
|
1009
|
+
minCount > 0 && `${minCount} - `,
|
|
1010
|
+
maxCount,
|
|
1011
|
+
countLabel
|
|
1012
|
+
] }),
|
|
1013
|
+
/* @__PURE__ */ jsx24(
|
|
1014
|
+
Select,
|
|
1015
|
+
{
|
|
1016
|
+
size: "medium",
|
|
1017
|
+
variant: "outline",
|
|
1018
|
+
selectedOption: optionsList.find((option) => option.value === currentPage.toString()),
|
|
1019
|
+
optionListMaxHeight,
|
|
1020
|
+
onChange: (option) => option && onChange(Number(option.value)),
|
|
1021
|
+
isDisabled: pageMax === 0,
|
|
1022
|
+
children: optionsList.map((option) => /* @__PURE__ */ jsx24(Select.Option, { option }, option.id))
|
|
1023
|
+
}
|
|
1024
|
+
),
|
|
1025
|
+
/* @__PURE__ */ jsxs13("div", { className: "typography-label14regular text-text03", children: [
|
|
1026
|
+
"/ ",
|
|
1027
|
+
pageMax,
|
|
1028
|
+
pageLabel
|
|
1029
|
+
] })
|
|
1030
|
+
] }),
|
|
1031
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center", children: [
|
|
1032
|
+
/* @__PURE__ */ jsx24(
|
|
1033
|
+
IconButton,
|
|
1034
|
+
{
|
|
1035
|
+
variant: "text",
|
|
1036
|
+
icon: "angle-left",
|
|
1037
|
+
size: "small",
|
|
1038
|
+
isDisabled: currentPage === 1,
|
|
1039
|
+
onClick: onClickPrevButton
|
|
1040
|
+
}
|
|
1041
|
+
),
|
|
1042
|
+
/* @__PURE__ */ jsx24(
|
|
1043
|
+
IconButton,
|
|
1044
|
+
{
|
|
1045
|
+
variant: "text",
|
|
1046
|
+
icon: "angle-right",
|
|
1047
|
+
size: "small",
|
|
1048
|
+
isDisabled: currentPage === pageMax || pageMax === 0,
|
|
1049
|
+
onClick: onClickNextButton
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
] })
|
|
1053
|
+
] });
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
// src/radio/radio.tsx
|
|
1057
|
+
import { focusVisible as focusVisible10 } from "@zenkigen-inc/component-theme";
|
|
1058
|
+
import clsx19 from "clsx";
|
|
1059
|
+
import { useCallback as useCallback4, useState as useState6 } from "react";
|
|
1060
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1061
|
+
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1062
|
+
const [isMouseOver, setIsMouseOver] = useState6(false);
|
|
1063
|
+
const handleMouseOverInput = useCallback4(() => {
|
|
1064
|
+
setIsMouseOver(true);
|
|
1065
|
+
}, []);
|
|
1066
|
+
const handleMouseOutInput = useCallback4(() => {
|
|
1067
|
+
setIsMouseOver(false);
|
|
1068
|
+
}, []);
|
|
1069
|
+
const handleChange = useCallback4(
|
|
1070
|
+
(e) => !isDisabled && onChange?.(e),
|
|
1071
|
+
[isDisabled, onChange]
|
|
1072
|
+
);
|
|
1073
|
+
const inputClasses = clsx19("peer absolute z-[1] size-6 opacity-0", {
|
|
1074
|
+
"cursor-not-allowed": isDisabled,
|
|
1075
|
+
"cursor-pointer": !isDisabled
|
|
1076
|
+
});
|
|
1077
|
+
const boxClasses = clsx19(
|
|
1078
|
+
"inline-flex size-5 items-center justify-center rounded-full border border-solid bg-white",
|
|
1079
|
+
focusVisible10.normalPeer,
|
|
1080
|
+
{
|
|
1081
|
+
"border-disabled01 hover:border-disabled01": isDisabled && !isMouseOver,
|
|
1082
|
+
"border-hoverUiBorder": !isDisabled && isMouseOver,
|
|
1083
|
+
"border-uiBorder03": !isDisabled,
|
|
1084
|
+
"cursor-not-allowed": isDisabled,
|
|
1085
|
+
"cursor-pointer": !isDisabled
|
|
1086
|
+
}
|
|
1087
|
+
);
|
|
1088
|
+
const afterClasses = clsx19("absolute inset-0 m-auto block size-3 rounded-full", {
|
|
1089
|
+
"bg-disabled01": isDisabled && isChecked,
|
|
1090
|
+
"bg-activeSelectedUi": !isDisabled && isChecked,
|
|
1091
|
+
"scale-0": !isChecked,
|
|
1092
|
+
"scale-100": isChecked
|
|
1093
|
+
});
|
|
1094
|
+
const hoverIndicatorClasses = clsx19("inline-block size-3 rounded-full", {
|
|
1095
|
+
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
1096
|
+
});
|
|
1097
|
+
const labelClasses = clsx19("typography-label14regular ml-2 flex-[1_0_0] select-none break-all", {
|
|
1098
|
+
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1099
|
+
"cursor-pointer text-text01": !isDisabled
|
|
1100
|
+
});
|
|
1101
|
+
return /* @__PURE__ */ jsxs14("div", { className: "flex items-center", children: [
|
|
1102
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex size-6 items-center justify-center", children: [
|
|
1103
|
+
/* @__PURE__ */ jsx25(
|
|
1104
|
+
"input",
|
|
1105
|
+
{
|
|
1106
|
+
type: "checkbox",
|
|
1107
|
+
value,
|
|
1108
|
+
name,
|
|
1109
|
+
id,
|
|
1110
|
+
checked: isChecked,
|
|
1111
|
+
disabled: isDisabled,
|
|
1112
|
+
onChange: handleChange,
|
|
1113
|
+
onMouseOver: handleMouseOverInput,
|
|
1114
|
+
onMouseLeave: handleMouseOutInput,
|
|
1115
|
+
className: inputClasses
|
|
1116
|
+
}
|
|
1117
|
+
),
|
|
1118
|
+
/* @__PURE__ */ jsx25("div", { className: boxClasses, children: /* @__PURE__ */ jsxs14("div", { className: "relative flex size-5 flex-[0_0_auto] items-center justify-center", children: [
|
|
1119
|
+
/* @__PURE__ */ jsx25("span", { className: afterClasses }),
|
|
1120
|
+
/* @__PURE__ */ jsx25("span", { className: hoverIndicatorClasses })
|
|
1121
|
+
] }) })
|
|
1122
|
+
] }),
|
|
1123
|
+
/* @__PURE__ */ jsx25("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1124
|
+
] });
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
// src/search/search.tsx
|
|
1128
|
+
import { clsx as clsx20 } from "clsx";
|
|
1129
|
+
import { forwardRef } from "react";
|
|
1130
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1131
|
+
var Search = forwardRef(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
1132
|
+
const classes = clsx20(
|
|
1133
|
+
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
1134
|
+
{ "h-8 px-3": size === "medium" },
|
|
1135
|
+
{ "h-10 px-4": size === "large" }
|
|
1136
|
+
);
|
|
1137
|
+
const inputClasses = clsx20("mx-2 h-full flex-1 text-text01 outline-0 placeholder:text-textPlaceholder", {
|
|
1138
|
+
["typography-label14regular"]: size === "medium",
|
|
1139
|
+
["typography-label16regular"]: size === "large"
|
|
1140
|
+
});
|
|
1141
|
+
return /* @__PURE__ */ jsx26("div", { className: "relative", ref, children: /* @__PURE__ */ jsx26("form", { onSubmit: props.onSubmit, children: /* @__PURE__ */ jsxs15("div", { className: classes, style: { width }, children: [
|
|
1142
|
+
/* @__PURE__ */ jsx26(Icon, { name: "search", color: "icon01", size: "medium" }),
|
|
1143
|
+
/* @__PURE__ */ jsx26(
|
|
1144
|
+
"input",
|
|
1145
|
+
{
|
|
1146
|
+
type: "text",
|
|
1147
|
+
size: 1,
|
|
1148
|
+
value: props.value,
|
|
1149
|
+
className: inputClasses,
|
|
1150
|
+
placeholder: props.placeholder,
|
|
1151
|
+
onChange: props.onChange
|
|
1152
|
+
}
|
|
1153
|
+
),
|
|
1154
|
+
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ jsx26(
|
|
1155
|
+
IconButton,
|
|
1156
|
+
{
|
|
1157
|
+
variant: "text",
|
|
1158
|
+
icon: "close",
|
|
1159
|
+
size: size === "medium" ? "small" : "medium",
|
|
1160
|
+
isNoPadding: true,
|
|
1161
|
+
onClick: props.onClickClearButton
|
|
1162
|
+
}
|
|
1163
|
+
)
|
|
1164
|
+
] }) }) });
|
|
1165
|
+
});
|
|
1166
|
+
Search.displayName = "Search";
|
|
1167
|
+
|
|
1168
|
+
// src/select-sort/select-sort.tsx
|
|
1169
|
+
import { buttonColors as buttonColors5, focusVisible as focusVisible13 } from "@zenkigen-inc/component-theme";
|
|
1170
|
+
import clsx23 from "clsx";
|
|
1171
|
+
import { useCallback as useCallback5, useRef as useRef4, useState as useState7 } from "react";
|
|
1172
|
+
|
|
1173
|
+
// src/select-sort/select-list.tsx
|
|
1174
|
+
import { focusVisible as focusVisible12 } from "@zenkigen-inc/component-theme";
|
|
1175
|
+
import clsx22 from "clsx";
|
|
1176
|
+
|
|
1177
|
+
// src/select-sort/select-item.tsx
|
|
1178
|
+
import { focusVisible as focusVisible11 } from "@zenkigen-inc/component-theme";
|
|
1179
|
+
import clsx21 from "clsx";
|
|
1180
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1181
|
+
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
1182
|
+
const itemClasses = clsx21(
|
|
1183
|
+
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1184
|
+
focusVisible11.inset,
|
|
1185
|
+
{
|
|
1186
|
+
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
1187
|
+
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
1188
|
+
}
|
|
1189
|
+
);
|
|
1190
|
+
return /* @__PURE__ */ jsx27("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ jsxs16("button", { className: itemClasses, type: "button", children: [
|
|
1191
|
+
/* @__PURE__ */ jsx27("span", { className: "ml-1 mr-6", children }),
|
|
1192
|
+
isSortKey && /* @__PURE__ */ jsx27("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx27(Icon, { name: "check", size: "small" }) })
|
|
1193
|
+
] }) });
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
// src/select-sort/select-list.tsx
|
|
1197
|
+
import { jsx as jsx28, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1198
|
+
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
1199
|
+
const listClasses = clsx22(
|
|
1200
|
+
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
1201
|
+
{
|
|
1202
|
+
"top-7": size === "x-small" || size === "small",
|
|
1203
|
+
"top-9": size === "medium",
|
|
1204
|
+
"top-11": size === "large",
|
|
1205
|
+
"border-solid border border-uiBorder01": variant === "outline"
|
|
1206
|
+
}
|
|
1207
|
+
);
|
|
1208
|
+
const deselectButtonClasses = clsx22(
|
|
1209
|
+
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1210
|
+
focusVisible12.inset
|
|
1211
|
+
);
|
|
1212
|
+
return /* @__PURE__ */ jsxs17("ul", { className: listClasses, children: [
|
|
1213
|
+
/* @__PURE__ */ jsx28(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1214
|
+
/* @__PURE__ */ jsx28(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1215
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsx28("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1216
|
+
] });
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
// src/select-sort/select-sort.tsx
|
|
1220
|
+
import { jsx as jsx29, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1221
|
+
function SelectSort({
|
|
1222
|
+
size = "medium",
|
|
1223
|
+
variant = "outline",
|
|
1224
|
+
width,
|
|
1225
|
+
label,
|
|
1226
|
+
sortOrder,
|
|
1227
|
+
isDisabled = false,
|
|
1228
|
+
isSortKey = false,
|
|
1229
|
+
onChange,
|
|
1230
|
+
onClickDeselect
|
|
1231
|
+
}) {
|
|
1232
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState7(false);
|
|
1233
|
+
const targetRef = useRef4(null);
|
|
1234
|
+
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1235
|
+
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1236
|
+
const handleClickItem = useCallback5(
|
|
1237
|
+
(value) => {
|
|
1238
|
+
onChange?.(value);
|
|
1239
|
+
setIsOptionListOpen(false);
|
|
1240
|
+
},
|
|
1241
|
+
[onChange]
|
|
1242
|
+
);
|
|
1243
|
+
const wrapperClasses = clsx23("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1244
|
+
"h-6": size === "x-small" || size === "small",
|
|
1245
|
+
"h-8": size === "medium",
|
|
1246
|
+
"h-10": size === "large",
|
|
1247
|
+
"cursor-not-allowed": isDisabled
|
|
1248
|
+
});
|
|
1249
|
+
const buttonClasses = clsx23(
|
|
1250
|
+
"flex size-full items-center rounded",
|
|
1251
|
+
buttonColors5[variant].hover,
|
|
1252
|
+
buttonColors5[variant].active,
|
|
1253
|
+
buttonColors5[variant].disabled,
|
|
1254
|
+
focusVisible13.normal,
|
|
1255
|
+
{
|
|
1256
|
+
[buttonColors5[variant].selected]: isSortKey,
|
|
1257
|
+
[buttonColors5[variant].base]: !isSortKey,
|
|
1258
|
+
"px-2": size === "x-small" || size === "small",
|
|
1259
|
+
"px-4": size === "medium" || size === "large",
|
|
1260
|
+
"pointer-events-none": isDisabled
|
|
1261
|
+
}
|
|
1262
|
+
);
|
|
1263
|
+
const labelClasses = clsx23("truncate", {
|
|
1264
|
+
"typography-label12regular": size === "x-small",
|
|
1265
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
1266
|
+
"typography-label16regular": size === "large",
|
|
1267
|
+
"mr-1": size === "x-small",
|
|
1268
|
+
"mr-2": size !== "x-small"
|
|
1269
|
+
});
|
|
1270
|
+
return /* @__PURE__ */ jsxs18("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
1271
|
+
/* @__PURE__ */ jsxs18("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
1272
|
+
/* @__PURE__ */ jsx29("div", { className: labelClasses, children: label }),
|
|
1273
|
+
/* @__PURE__ */ jsx29("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ jsx29(
|
|
1274
|
+
Icon,
|
|
1275
|
+
{
|
|
1276
|
+
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
1277
|
+
size: size === "large" ? "medium" : "small"
|
|
1278
|
+
}
|
|
1279
|
+
) : /* @__PURE__ */ jsx29(
|
|
1280
|
+
Icon,
|
|
1281
|
+
{
|
|
1282
|
+
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
1283
|
+
size: size === "large" ? "medium" : "small"
|
|
1284
|
+
}
|
|
1285
|
+
) })
|
|
1286
|
+
] }),
|
|
1287
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx29(
|
|
1288
|
+
SelectList2,
|
|
1289
|
+
{
|
|
1290
|
+
size,
|
|
1291
|
+
variant,
|
|
1292
|
+
sortOrder,
|
|
1293
|
+
onClickItem: handleClickItem,
|
|
1294
|
+
onClickDeselect
|
|
1295
|
+
}
|
|
1296
|
+
)
|
|
1297
|
+
] });
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// src/tab/tab-item.tsx
|
|
1301
|
+
import { clsx as clsx24 } from "clsx";
|
|
1302
|
+
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1303
|
+
var TabItem = ({ isSelected = false, ...props }) => {
|
|
1304
|
+
const classes = clsx24(
|
|
1305
|
+
"relative z-0 flex py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-px hover:text-text01 disabled:pointer-events-none disabled:text-disabled01",
|
|
1306
|
+
{
|
|
1307
|
+
"typography-label14regular": !isSelected,
|
|
1308
|
+
"text-interactive02 hover:before:bg-uiBorder04": !isSelected,
|
|
1309
|
+
"typography-label14bold": isSelected,
|
|
1310
|
+
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
1311
|
+
}
|
|
1312
|
+
);
|
|
1313
|
+
return /* @__PURE__ */ jsx30(
|
|
1314
|
+
"button",
|
|
1315
|
+
{
|
|
1316
|
+
type: "button",
|
|
1317
|
+
role: "tab",
|
|
1318
|
+
"aria-selected": isSelected,
|
|
1319
|
+
className: classes,
|
|
1320
|
+
disabled: props.isDisabled,
|
|
1321
|
+
onClick: () => props.onClick(props.id),
|
|
1322
|
+
children: props.children
|
|
1323
|
+
}
|
|
1324
|
+
);
|
|
1325
|
+
};
|
|
1326
|
+
|
|
1327
|
+
// src/tab/tab.tsx
|
|
1328
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1329
|
+
function Tab({ children }) {
|
|
1330
|
+
return /* @__PURE__ */ jsx31(
|
|
1331
|
+
"div",
|
|
1332
|
+
{
|
|
1333
|
+
role: "tablist",
|
|
1334
|
+
className: "relative flex gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
1335
|
+
children
|
|
1336
|
+
}
|
|
1337
|
+
);
|
|
1338
|
+
}
|
|
1339
|
+
Tab.Item = TabItem;
|
|
1340
|
+
|
|
1341
|
+
// src/table/table-cell.tsx
|
|
1342
|
+
import clsx25 from "clsx";
|
|
1343
|
+
import { jsx as jsx32 } from "react/jsx-runtime";
|
|
1344
|
+
function TableCell({ children, className, isHeader = false }) {
|
|
1345
|
+
const classes = clsx25("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
1346
|
+
return /* @__PURE__ */ jsx32("div", { className: classes, children });
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
// src/table/table-row.tsx
|
|
1350
|
+
import clsx26 from "clsx";
|
|
1351
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1352
|
+
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
1353
|
+
const rowClasses = clsx26("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
1354
|
+
return /* @__PURE__ */ jsx33("div", { className: rowClasses, children });
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
// src/table/table.tsx
|
|
1358
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1359
|
+
function Table({
|
|
1360
|
+
width,
|
|
1361
|
+
templateRows,
|
|
1362
|
+
templateColumns,
|
|
1363
|
+
autoColumns,
|
|
1364
|
+
autoRows,
|
|
1365
|
+
children
|
|
1366
|
+
}) {
|
|
1367
|
+
return /* @__PURE__ */ jsx34(
|
|
1368
|
+
"div",
|
|
1369
|
+
{
|
|
1370
|
+
className: "grid",
|
|
1371
|
+
style: {
|
|
1372
|
+
width,
|
|
1373
|
+
gridTemplateRows: templateRows,
|
|
1374
|
+
gridTemplateColumns: templateColumns,
|
|
1375
|
+
gridAutoColumns: autoColumns,
|
|
1376
|
+
gridAutoRows: autoRows
|
|
1377
|
+
},
|
|
1378
|
+
children
|
|
1379
|
+
}
|
|
1380
|
+
);
|
|
1381
|
+
}
|
|
1382
|
+
Table.Row = TableRow;
|
|
1383
|
+
Table.Cell = TableCell;
|
|
1384
|
+
|
|
1385
|
+
// src/tag/tag.tsx
|
|
1386
|
+
import { tagColors, tagLightColors } from "@zenkigen-inc/component-theme";
|
|
1387
|
+
import clsx28 from "clsx";
|
|
1388
|
+
|
|
1389
|
+
// src/tag/delete-icon.tsx
|
|
1390
|
+
import { focusVisible as focusVisible14 } from "@zenkigen-inc/component-theme";
|
|
1391
|
+
import clsx27 from "clsx";
|
|
1392
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1393
|
+
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
1394
|
+
const deleteButtonClasses = clsx27(
|
|
1395
|
+
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
1396
|
+
focusVisible14.normal
|
|
1397
|
+
);
|
|
1398
|
+
const deletePathClasses = clsx27({
|
|
1399
|
+
"fill-interactive02": color === "gray" || variant === "light",
|
|
1400
|
+
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
1401
|
+
});
|
|
1402
|
+
return /* @__PURE__ */ jsx35("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ jsx35("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx35(
|
|
1403
|
+
"path",
|
|
1404
|
+
{
|
|
1405
|
+
fillRule: "evenodd",
|
|
1406
|
+
clipRule: "evenodd",
|
|
1407
|
+
d: "M19.7745 4.21818C19.384 3.82765 18.7508 3.82765 18.3603 4.21818L11.9963 10.5821L5.6324 4.21818C5.24187 3.82765 4.60871 3.82765 4.21818 4.21818C3.82766 4.6087 3.82766 5.24187 4.21818 5.63239L10.5821 11.9964L4.21818 18.3603C3.82766 18.7508 3.82766 19.384 4.21818 19.7745C4.60871 20.1651 5.24187 20.165 5.6324 19.7745L11.9963 13.4106L18.3603 19.7745C18.7508 20.165 19.384 20.1651 19.7745 19.7745C20.165 19.384 20.165 18.7508 19.7745 18.3603L13.4106 11.9964L19.7745 5.63239C20.165 5.24187 20.165 4.6087 19.7745 4.21818Z",
|
|
1408
|
+
className: deletePathClasses
|
|
1409
|
+
}
|
|
1410
|
+
) }) });
|
|
1411
|
+
};
|
|
1412
|
+
|
|
1413
|
+
// src/tag/tag.tsx
|
|
1414
|
+
import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1415
|
+
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
1416
|
+
const wrapperClasses = clsx28("flex", "items-center", "justify-center", {
|
|
1417
|
+
[tagColors[color]]: variant === "normal",
|
|
1418
|
+
[tagLightColors[color]]: variant === "light",
|
|
1419
|
+
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
1420
|
+
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
1421
|
+
"h-[18px] typography-label14regular": !isEditable && size === "medium",
|
|
1422
|
+
"h-[22px] typography-label14regular": isEditable && size === "medium",
|
|
1423
|
+
"rounded-full": isEditable,
|
|
1424
|
+
rounded: !isEditable,
|
|
1425
|
+
"py-0.5 px-1": !isEditable,
|
|
1426
|
+
"py-1 px-2": isEditable
|
|
1427
|
+
});
|
|
1428
|
+
return /* @__PURE__ */ jsxs19("div", { className: wrapperClasses, children: [
|
|
1429
|
+
children,
|
|
1430
|
+
isEditable ? /* @__PURE__ */ jsx36(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
1431
|
+
] });
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1434
|
+
// src/text-area/text-area.tsx
|
|
1435
|
+
import { clsx as clsx29 } from "clsx";
|
|
1436
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
1437
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1438
|
+
var TextArea = forwardRef2(
|
|
1439
|
+
({
|
|
1440
|
+
size = "medium",
|
|
1441
|
+
isResizable = false,
|
|
1442
|
+
autoHeight = false,
|
|
1443
|
+
maxHeight,
|
|
1444
|
+
isError = false,
|
|
1445
|
+
disabled = false,
|
|
1446
|
+
height,
|
|
1447
|
+
...props
|
|
1448
|
+
}, ref) => {
|
|
1449
|
+
const classes = clsx29(
|
|
1450
|
+
"w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
1451
|
+
{
|
|
1452
|
+
"border-supportError": isError && !disabled,
|
|
1453
|
+
"hover:border-hoverInput": !disabled && !isError,
|
|
1454
|
+
"border-uiBorder02 hover:focus-within:border-activeInput focus-within:border-activeInput text-text01": !isError,
|
|
1455
|
+
"bg-disabled02 border-disabled01": disabled,
|
|
1456
|
+
"typography-body14regular px-2 pt-1.5 pb-2": size === "medium",
|
|
1457
|
+
"text-4 leading-normal px-3.5 py-2.5": size === "large",
|
|
1458
|
+
"field-sizing-content": autoHeight,
|
|
1459
|
+
"text-supportError": isError,
|
|
1460
|
+
"resize-none": !isResizable
|
|
1461
|
+
}
|
|
1462
|
+
);
|
|
1463
|
+
return /* @__PURE__ */ jsx37("div", { className: "flex", children: /* @__PURE__ */ jsx37(
|
|
1464
|
+
"textarea",
|
|
1465
|
+
{
|
|
1466
|
+
ref,
|
|
1467
|
+
className: classes,
|
|
1468
|
+
...props,
|
|
1469
|
+
style: {
|
|
1470
|
+
...{ maxHeight },
|
|
1471
|
+
// 自動高さではない場合で、height 指定がある場合は設定する
|
|
1472
|
+
...!autoHeight && height !== null ? { height } : {},
|
|
1473
|
+
// 自動高さの場合で、height が指定されている場合は、height を minHeight に設定する
|
|
1474
|
+
...autoHeight && height !== null ? { minHeight: height } : {}
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
) });
|
|
1478
|
+
}
|
|
1479
|
+
);
|
|
1480
|
+
TextArea.displayName = "TextArea";
|
|
1481
|
+
|
|
1482
|
+
// src/text-input/text-input.tsx
|
|
1483
|
+
import { clsx as clsx30 } from "clsx";
|
|
1484
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1485
|
+
import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1486
|
+
var TextInput = forwardRef3(
|
|
1487
|
+
({ size = "medium", isError = false, disabled = false, onClickClearButton, ...props }, ref) => {
|
|
1488
|
+
const isShowClearButton = !!onClickClearButton && props.value.length !== 0 && !disabled;
|
|
1489
|
+
const inputWrapClasses = clsx30("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1490
|
+
"border-uiBorder02": !isError && !disabled,
|
|
1491
|
+
"border-supportError": isError && !disabled,
|
|
1492
|
+
"hover:border-hoverInput": !disabled && !isError,
|
|
1493
|
+
"hover:focus-within:border-activeInput": !isError,
|
|
1494
|
+
"focus-within:border-activeInput": !isError,
|
|
1495
|
+
"bg-disabled02 border-disabled01": disabled,
|
|
1496
|
+
"pr-2": size === "medium" && isShowClearButton,
|
|
1497
|
+
"pr-3": size === "large" && isShowClearButton
|
|
1498
|
+
});
|
|
1499
|
+
const inputClasses = clsx30("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1500
|
+
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1501
|
+
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1502
|
+
"text-text01": !isError,
|
|
1503
|
+
"text-supportError": isError,
|
|
1504
|
+
"pr-0": isShowClearButton
|
|
1505
|
+
});
|
|
1506
|
+
return /* @__PURE__ */ jsxs20("div", { className: inputWrapClasses, children: [
|
|
1507
|
+
/* @__PURE__ */ jsx38("input", { ref, size: 1, className: inputClasses, disabled, onChange: props.onChange, ...props }),
|
|
1508
|
+
isShowClearButton && /* @__PURE__ */ jsx38(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1509
|
+
] });
|
|
1510
|
+
}
|
|
1511
|
+
);
|
|
1512
|
+
TextInput.displayName = "TextInput";
|
|
1513
|
+
|
|
1514
|
+
// src/toast/toast.tsx
|
|
1515
|
+
import clsx31 from "clsx";
|
|
1516
|
+
import { useCallback as useCallback6, useEffect as useEffect3, useState as useState8 } from "react";
|
|
1517
|
+
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1518
|
+
var CLOSE_TIME_MSEC = 5e3;
|
|
1519
|
+
function Toast({
|
|
1520
|
+
state = "information",
|
|
1521
|
+
width = "auto",
|
|
1522
|
+
isAutoClose = false,
|
|
1523
|
+
isAnimation = false,
|
|
1524
|
+
children,
|
|
1525
|
+
onClickClose
|
|
1526
|
+
}) {
|
|
1527
|
+
const [isRemoving, setIsRemoving] = useState8(false);
|
|
1528
|
+
const handleClose = useCallback6(() => {
|
|
1529
|
+
if (isAnimation) {
|
|
1530
|
+
setIsRemoving(true);
|
|
1531
|
+
} else {
|
|
1532
|
+
onClickClose();
|
|
1533
|
+
}
|
|
1534
|
+
}, [isAnimation, onClickClose]);
|
|
1535
|
+
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
1536
|
+
const wrapperClasses = clsx31("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
1537
|
+
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
1538
|
+
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
1539
|
+
});
|
|
1540
|
+
const iconClasses = clsx31("flex items-center", {
|
|
1541
|
+
"fill-supportSuccess": state === "success",
|
|
1542
|
+
"fill-supportError": state === "error",
|
|
1543
|
+
"fill-supportWarning": state === "warning",
|
|
1544
|
+
"fill-supportInfo": state === "information"
|
|
1545
|
+
});
|
|
1546
|
+
const textClasses = clsx31("typography-body13regular flex-1 pt-[3px]", {
|
|
1547
|
+
"text-supportError": state === "error",
|
|
1548
|
+
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
1549
|
+
});
|
|
1550
|
+
const iconName = {
|
|
1551
|
+
success: "success-filled",
|
|
1552
|
+
error: "attention",
|
|
1553
|
+
warning: "warning",
|
|
1554
|
+
information: "information-filled"
|
|
1555
|
+
};
|
|
1556
|
+
useEffect3(() => {
|
|
1557
|
+
const timer = window.setTimeout(() => {
|
|
1558
|
+
if (isAutoClose) {
|
|
1559
|
+
setIsRemoving(true);
|
|
1560
|
+
}
|
|
1561
|
+
}, CLOSE_TIME_MSEC);
|
|
1562
|
+
return () => window.clearTimeout(timer);
|
|
1563
|
+
}, [isAutoClose]);
|
|
1564
|
+
return /* @__PURE__ */ jsxs21("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
1565
|
+
/* @__PURE__ */ jsx39("div", { className: iconClasses, children: /* @__PURE__ */ jsx39(Icon, { name: iconName[state] }) }),
|
|
1566
|
+
/* @__PURE__ */ jsx39("p", { className: textClasses, children }),
|
|
1567
|
+
/* @__PURE__ */ jsx39(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
1568
|
+
] });
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
// src/toast/toast-provider.tsx
|
|
1572
|
+
import { createContext as createContext5, useCallback as useCallback7, useContext as useContext7, useEffect as useEffect4, useState as useState9 } from "react";
|
|
1573
|
+
import { createPortal as createPortal3 } from "react-dom";
|
|
1574
|
+
import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1575
|
+
var ToastContext = createContext5({});
|
|
1576
|
+
var ToastProvider = ({ children }) => {
|
|
1577
|
+
const [isClientRender, setIsClientRender] = useState9(false);
|
|
1578
|
+
const [toasts, setToasts] = useState9([]);
|
|
1579
|
+
const addToast = useCallback7(({ message, state }) => {
|
|
1580
|
+
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
1581
|
+
}, []);
|
|
1582
|
+
const removeToast = useCallback7((id) => {
|
|
1583
|
+
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
1584
|
+
}, []);
|
|
1585
|
+
useEffect4(() => {
|
|
1586
|
+
setIsClientRender(true);
|
|
1587
|
+
}, []);
|
|
1588
|
+
return /* @__PURE__ */ jsxs22(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
1589
|
+
children,
|
|
1590
|
+
isClientRender && createPortal3(
|
|
1591
|
+
/* @__PURE__ */ jsx40("div", { className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-[16px]", children: toasts.map(({ id, message, state }) => /* @__PURE__ */ jsx40(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
1592
|
+
document.body
|
|
1593
|
+
)
|
|
1594
|
+
] });
|
|
1595
|
+
};
|
|
1596
|
+
var useToast = () => {
|
|
1597
|
+
return useContext7(ToastContext);
|
|
1598
|
+
};
|
|
1599
|
+
|
|
1600
|
+
// src/toggle/toggle.tsx
|
|
1601
|
+
import clsx32 from "clsx";
|
|
1602
|
+
import { jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1603
|
+
function Toggle({
|
|
1604
|
+
id,
|
|
1605
|
+
size = "medium",
|
|
1606
|
+
isChecked,
|
|
1607
|
+
onChange,
|
|
1608
|
+
label,
|
|
1609
|
+
labelPosition = "right",
|
|
1610
|
+
isDisabled = false
|
|
1611
|
+
}) {
|
|
1612
|
+
const baseClasses = clsx32("relative flex items-center rounded-full", {
|
|
1613
|
+
"bg-disabledOn": isDisabled && isChecked,
|
|
1614
|
+
"bg-disabled01": isDisabled && !isChecked,
|
|
1615
|
+
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
1616
|
+
"bg-interactive02 peer-hover:bg-hoverGray": !isDisabled && !isChecked,
|
|
1617
|
+
"w-8 h-4 px-[3px]": size === "small",
|
|
1618
|
+
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
1619
|
+
});
|
|
1620
|
+
const inputClasses = clsx32(
|
|
1621
|
+
"peer absolute inset-0 z-[1] opacity-0",
|
|
1622
|
+
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1623
|
+
);
|
|
1624
|
+
const indicatorClasses = clsx32("rounded-full bg-iconOnColor", {
|
|
1625
|
+
"w-2.5 h-2.5": size === "small",
|
|
1626
|
+
"w-4 h-4": size === "medium" || size === "large",
|
|
1627
|
+
"ml-auto": isChecked
|
|
1628
|
+
});
|
|
1629
|
+
const labelClasses = clsx32("break-all", {
|
|
1630
|
+
"mr-2": labelPosition === "left",
|
|
1631
|
+
"ml-2": labelPosition === "right",
|
|
1632
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
1633
|
+
"typography-label16regular": size === "large",
|
|
1634
|
+
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1635
|
+
"cursor-pointer text-text01": !isDisabled
|
|
1636
|
+
});
|
|
1637
|
+
return /* @__PURE__ */ jsxs23("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
1638
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ jsx41("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
1639
|
+
/* @__PURE__ */ jsx41(
|
|
1640
|
+
"input",
|
|
1641
|
+
{
|
|
1642
|
+
className: inputClasses,
|
|
1643
|
+
type: "checkbox",
|
|
1644
|
+
name: id,
|
|
1645
|
+
id,
|
|
1646
|
+
checked: isChecked,
|
|
1647
|
+
onChange,
|
|
1648
|
+
disabled: isDisabled
|
|
1649
|
+
}
|
|
1650
|
+
),
|
|
1651
|
+
/* @__PURE__ */ jsx41("div", { className: baseClasses, children: /* @__PURE__ */ jsx41("span", { className: indicatorClasses }) }),
|
|
1652
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ jsx41("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1653
|
+
] });
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
// src/tooltip/tooltip.tsx
|
|
1657
|
+
import { useCallback as useCallback9, useEffect as useEffect5, useRef as useRef5, useState as useState10 } from "react";
|
|
1658
|
+
import { createPortal as createPortal4 } from "react-dom";
|
|
1659
|
+
|
|
1660
|
+
// src/tooltip/tooltip.hook.ts
|
|
1661
|
+
import { useCallback as useCallback8 } from "react";
|
|
1662
|
+
var useTooltip = () => {
|
|
1663
|
+
const calculatePosition = useCallback8(
|
|
1664
|
+
(args) => {
|
|
1665
|
+
const result = {
|
|
1666
|
+
maxWidth: "none",
|
|
1667
|
+
width: "auto",
|
|
1668
|
+
left: "0px",
|
|
1669
|
+
top: "0px",
|
|
1670
|
+
bottom: "0px",
|
|
1671
|
+
translateX: "0",
|
|
1672
|
+
translateY: "0"
|
|
1673
|
+
};
|
|
1674
|
+
result.maxWidth = args.maxWidth ?? "none";
|
|
1675
|
+
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
1676
|
+
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
1677
|
+
const targetLeft = args.dimensions.left;
|
|
1678
|
+
const targetRight = args.dimensions.right;
|
|
1679
|
+
const targetWidth = args.dimensions.width;
|
|
1680
|
+
switch (args.horizontalAlign) {
|
|
1681
|
+
case "center":
|
|
1682
|
+
result.left = `${targetHorizontalCenter}px`;
|
|
1683
|
+
result.translateX = "-50%";
|
|
1684
|
+
break;
|
|
1685
|
+
case "left":
|
|
1686
|
+
result.left = `${targetLeft - offsetH}px`;
|
|
1687
|
+
result.translateX = `${targetWidth / 2}px`;
|
|
1688
|
+
break;
|
|
1689
|
+
case "right":
|
|
1690
|
+
result.left = `${targetRight + offsetH}px`;
|
|
1691
|
+
result.translateX = `-${targetWidth / 2}px`;
|
|
1692
|
+
break;
|
|
1693
|
+
}
|
|
1694
|
+
switch (args.verticalPosition) {
|
|
1695
|
+
case "bottom":
|
|
1696
|
+
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
1697
|
+
result.bottom = "unset";
|
|
1698
|
+
break;
|
|
1699
|
+
case "top":
|
|
1700
|
+
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
1701
|
+
result.bottom = "unset";
|
|
1702
|
+
result.translateY = "-100%";
|
|
1703
|
+
break;
|
|
1704
|
+
}
|
|
1705
|
+
return result;
|
|
1706
|
+
},
|
|
1707
|
+
[]
|
|
1708
|
+
);
|
|
1709
|
+
return {
|
|
1710
|
+
calculatePosition
|
|
1711
|
+
};
|
|
1712
|
+
};
|
|
1713
|
+
|
|
1714
|
+
// src/tooltip/tooltip-content.tsx
|
|
1715
|
+
import clsx34 from "clsx";
|
|
1716
|
+
|
|
1717
|
+
// src/tooltip/tail-icon.tsx
|
|
1718
|
+
import clsx33 from "clsx";
|
|
1719
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
1720
|
+
var TailIcon = (props) => {
|
|
1721
|
+
const tailClasses = clsx33("absolute fill-uiBackgroundTooltip", {
|
|
1722
|
+
"rotate-180": props.verticalPosition === "bottom",
|
|
1723
|
+
"rotate-0": props.verticalPosition !== "bottom",
|
|
1724
|
+
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
1725
|
+
"-top-2": props.verticalPosition === "bottom" && props.size !== "small",
|
|
1726
|
+
"-bottom-1": props.verticalPosition !== "bottom" && props.size === "small",
|
|
1727
|
+
"-bottom-2": props.verticalPosition !== "bottom" && props.size !== "small",
|
|
1728
|
+
"right-2": props.horizontalAlign === "right" && props.size === "small",
|
|
1729
|
+
"right-4": props.horizontalAlign === "right" && props.size !== "small",
|
|
1730
|
+
"left-2": props.horizontalAlign === "left" && props.size === "small",
|
|
1731
|
+
"left-4": props.horizontalAlign === "left" && props.size !== "small",
|
|
1732
|
+
"left-1/2 -translate-x-1": props.horizontalAlign === "center" && props.size === "small",
|
|
1733
|
+
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
1734
|
+
});
|
|
1735
|
+
if (props.size === "small") {
|
|
1736
|
+
return /* @__PURE__ */ jsx42("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx42("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
1737
|
+
} else {
|
|
1738
|
+
return /* @__PURE__ */ jsx42(
|
|
1739
|
+
"svg",
|
|
1740
|
+
{
|
|
1741
|
+
className: tailClasses,
|
|
1742
|
+
width: "14",
|
|
1743
|
+
height: "8",
|
|
1744
|
+
viewBox: "0 0 14 8",
|
|
1745
|
+
fill: "none",
|
|
1746
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1747
|
+
children: /* @__PURE__ */ jsx42("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
1748
|
+
}
|
|
1749
|
+
);
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
// src/tooltip/tooltip-content.tsx
|
|
1754
|
+
import { jsx as jsx43, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1755
|
+
var TooltipContent = ({
|
|
1756
|
+
content,
|
|
1757
|
+
horizontalAlign,
|
|
1758
|
+
verticalPosition,
|
|
1759
|
+
size,
|
|
1760
|
+
tooltipPosition,
|
|
1761
|
+
maxWidth,
|
|
1762
|
+
isPortal = false
|
|
1763
|
+
}) => {
|
|
1764
|
+
const tooltipWrapperClasses = clsx34("absolute z-tooltip m-auto flex", {
|
|
1765
|
+
"top-0": !isPortal && verticalPosition === "top",
|
|
1766
|
+
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
1767
|
+
"justify-start": horizontalAlign === "left",
|
|
1768
|
+
"justify-center": horizontalAlign === "center",
|
|
1769
|
+
"justify-end": horizontalAlign === "right",
|
|
1770
|
+
"w-[24px]": size === "small",
|
|
1771
|
+
"w-[46px]": size !== "small"
|
|
1772
|
+
});
|
|
1773
|
+
const tooltipBodyClasses = clsx34(
|
|
1774
|
+
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
1775
|
+
{
|
|
1776
|
+
"typography-body12regular": size === "small",
|
|
1777
|
+
"typography-body13regular": size === "medium",
|
|
1778
|
+
"px-2 pb-1 pt-1.5": size === "small",
|
|
1779
|
+
"px-4 py-3": size === "medium",
|
|
1780
|
+
"bottom-2": verticalPosition !== "bottom" && size === "small",
|
|
1781
|
+
"bottom-3": verticalPosition !== "bottom" && size === "medium",
|
|
1782
|
+
"top-2": verticalPosition === "bottom" && size === "small",
|
|
1783
|
+
"top-3": verticalPosition === "bottom" && size === "medium"
|
|
1784
|
+
}
|
|
1785
|
+
);
|
|
1786
|
+
const tooltipWrapperStyle = isPortal ? {
|
|
1787
|
+
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
1788
|
+
...tooltipPosition
|
|
1789
|
+
} : {};
|
|
1790
|
+
return /* @__PURE__ */ jsx43("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ jsxs24(
|
|
1791
|
+
"div",
|
|
1792
|
+
{
|
|
1793
|
+
className: tooltipBodyClasses,
|
|
1794
|
+
style: {
|
|
1795
|
+
maxWidth
|
|
1796
|
+
},
|
|
1797
|
+
children: [
|
|
1798
|
+
content,
|
|
1799
|
+
/* @__PURE__ */ jsx43(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
1800
|
+
]
|
|
1801
|
+
}
|
|
1802
|
+
) });
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
// src/tooltip/tooltip.tsx
|
|
1806
|
+
import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1807
|
+
function Tooltip({
|
|
1808
|
+
children,
|
|
1809
|
+
content,
|
|
1810
|
+
size = "small",
|
|
1811
|
+
maxWidth,
|
|
1812
|
+
verticalPosition = "bottom",
|
|
1813
|
+
horizontalAlign = "center",
|
|
1814
|
+
isDisabledHover = false,
|
|
1815
|
+
portalTarget
|
|
1816
|
+
}) {
|
|
1817
|
+
const { calculatePosition } = useTooltip();
|
|
1818
|
+
const [isVisible, setIsVisible] = useState10(false);
|
|
1819
|
+
const [tooltipPosition, setTooltipPosition] = useState10({
|
|
1820
|
+
maxWidth: "none",
|
|
1821
|
+
width: "auto",
|
|
1822
|
+
left: "0px",
|
|
1823
|
+
top: "0px",
|
|
1824
|
+
bottom: "0px",
|
|
1825
|
+
translateX: "0",
|
|
1826
|
+
translateY: "0"
|
|
1827
|
+
});
|
|
1828
|
+
const targetRef = useRef5(null);
|
|
1829
|
+
const handleMouseOverWrapper = useCallback9(() => {
|
|
1830
|
+
if (isDisabledHover) {
|
|
1831
|
+
return;
|
|
1832
|
+
}
|
|
1833
|
+
setIsVisible(true);
|
|
1834
|
+
}, [isDisabledHover]);
|
|
1835
|
+
const handleMouseOutWrapper = useCallback9(() => {
|
|
1836
|
+
setIsVisible(false);
|
|
1837
|
+
}, []);
|
|
1838
|
+
useEffect5(() => {
|
|
1839
|
+
if (targetRef.current === null) return;
|
|
1840
|
+
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
1841
|
+
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
1842
|
+
setTooltipPosition(position);
|
|
1843
|
+
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
1844
|
+
return /* @__PURE__ */ jsxs25(
|
|
1845
|
+
"div",
|
|
1846
|
+
{
|
|
1847
|
+
ref: targetRef,
|
|
1848
|
+
className: "relative flex items-center justify-center",
|
|
1849
|
+
onMouseOver: handleMouseOverWrapper,
|
|
1850
|
+
onMouseLeave: handleMouseOutWrapper,
|
|
1851
|
+
children: [
|
|
1852
|
+
children,
|
|
1853
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ jsx44(
|
|
1854
|
+
TooltipContent,
|
|
1855
|
+
{
|
|
1856
|
+
content,
|
|
1857
|
+
size,
|
|
1858
|
+
maxWidth,
|
|
1859
|
+
verticalPosition,
|
|
1860
|
+
horizontalAlign,
|
|
1861
|
+
tooltipPosition
|
|
1862
|
+
}
|
|
1863
|
+
) : createPortal4(
|
|
1864
|
+
/* @__PURE__ */ jsx44(
|
|
1865
|
+
TooltipContent,
|
|
1866
|
+
{
|
|
1867
|
+
isPortal: true,
|
|
1868
|
+
content,
|
|
1869
|
+
size,
|
|
1870
|
+
maxWidth,
|
|
1871
|
+
verticalPosition,
|
|
1872
|
+
horizontalAlign,
|
|
1873
|
+
tooltipPosition
|
|
1874
|
+
}
|
|
1875
|
+
),
|
|
1876
|
+
portalTarget
|
|
1877
|
+
))
|
|
1878
|
+
]
|
|
1879
|
+
}
|
|
1880
|
+
);
|
|
1881
|
+
}
|
|
1882
|
+
export {
|
|
1883
|
+
Avatar,
|
|
1884
|
+
Breadcrumb,
|
|
1885
|
+
Button,
|
|
1886
|
+
Checkbox,
|
|
1887
|
+
Dropdown,
|
|
1888
|
+
EvaluationStar,
|
|
1889
|
+
Heading,
|
|
1890
|
+
Icon,
|
|
1891
|
+
IconButton,
|
|
1892
|
+
Loading,
|
|
1893
|
+
Modal,
|
|
1894
|
+
NotificationInline,
|
|
1895
|
+
Pagination,
|
|
1896
|
+
PaginationSelect,
|
|
1897
|
+
Radio,
|
|
1898
|
+
Search,
|
|
1899
|
+
Select,
|
|
1900
|
+
SelectSort,
|
|
1901
|
+
Tab,
|
|
1902
|
+
TabItem,
|
|
1903
|
+
Table,
|
|
1904
|
+
TableCell,
|
|
1905
|
+
TableRow,
|
|
1906
|
+
Tag,
|
|
1907
|
+
TextArea,
|
|
1908
|
+
TextInput,
|
|
1909
|
+
Toast,
|
|
1910
|
+
ToastProvider,
|
|
1911
|
+
Toggle,
|
|
1912
|
+
Tooltip,
|
|
1913
|
+
useOutsideClick,
|
|
1914
|
+
useToast
|
|
1915
|
+
};
|