@zenkigen-inc/component-ui 1.20.4 → 1.21.0
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 +136 -10
- package/dist/index.d.ts +136 -10
- package/dist/index.js +2245 -1024
- package/dist/index.mjs +2157 -939
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
import { userColors } from "@zenkigen-inc/component-theme";
|
|
3
3
|
import { clsx as clsx2 } from "clsx";
|
|
4
4
|
|
|
5
|
+
// src/avatar-group/avatar-group-context.ts
|
|
6
|
+
import { createContext, useContext } from "react";
|
|
7
|
+
var AvatarGroupContext = createContext(null);
|
|
8
|
+
function useAvatarGroupSize() {
|
|
9
|
+
const context = useContext(AvatarGroupContext);
|
|
10
|
+
return context?.size ?? null;
|
|
11
|
+
}
|
|
12
|
+
|
|
5
13
|
// src/icon/icon.tsx
|
|
6
14
|
import { iconElements } from "@zenkigen-inc/component-icons";
|
|
7
15
|
import { clsx } from "clsx";
|
|
@@ -34,7 +42,9 @@ import { jsx as jsx2 } from "react/jsx-runtime";
|
|
|
34
42
|
var isAsciiString = (str) => {
|
|
35
43
|
return str.charCodeAt(0) < 256;
|
|
36
44
|
};
|
|
37
|
-
function Avatar({ size = "medium", ...props }) {
|
|
45
|
+
function Avatar({ size: sizeProp = "medium", ...props }) {
|
|
46
|
+
const groupSize = useAvatarGroupSize();
|
|
47
|
+
const size = groupSize ?? sizeProp;
|
|
38
48
|
const classes = clsx2("flex items-center justify-center rounded-full text-textOnColor", {
|
|
39
49
|
"w-16 h-16 typography-label16regular": size === "x-large",
|
|
40
50
|
"w-12 h-12 typography-label14regular": size === "large",
|
|
@@ -62,23 +72,101 @@ function Avatar({ size = "medium", ...props }) {
|
|
|
62
72
|
return /* @__PURE__ */ jsx2("span", { className: classes, children: nameOnIcon });
|
|
63
73
|
}
|
|
64
74
|
|
|
75
|
+
// src/avatar-group/avatar-group.tsx
|
|
76
|
+
import { clsx as clsx3 } from "clsx";
|
|
77
|
+
import { Children, isValidElement } from "react";
|
|
78
|
+
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
79
|
+
var OVERLAP_CLASSES = {
|
|
80
|
+
"x-small": "-ml-1.5",
|
|
81
|
+
small: "-ml-2",
|
|
82
|
+
medium: "-ml-2.5",
|
|
83
|
+
large: "-ml-3",
|
|
84
|
+
"x-large": "-ml-4"
|
|
85
|
+
};
|
|
86
|
+
var BORDER_CLASSES = {
|
|
87
|
+
"x-small": "border border-white",
|
|
88
|
+
small: "border border-white",
|
|
89
|
+
medium: "border-2 border-white",
|
|
90
|
+
large: "border-2 border-white",
|
|
91
|
+
"x-large": "border-[3px] border-white"
|
|
92
|
+
};
|
|
93
|
+
var COUNTER_SIZE_CLASSES = {
|
|
94
|
+
"x-small": "h-6 w-6 typography-label11regular",
|
|
95
|
+
small: "h-8 w-8 typography-label11regular",
|
|
96
|
+
medium: "h-10 w-10 typography-label14regular",
|
|
97
|
+
large: "h-12 w-12 typography-label14regular",
|
|
98
|
+
"x-large": "h-16 w-16 typography-label16regular"
|
|
99
|
+
};
|
|
100
|
+
function DefaultSurplus({ remain, size }) {
|
|
101
|
+
return /* @__PURE__ */ jsxs(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
className: clsx3(
|
|
105
|
+
"flex items-center justify-center rounded-full bg-uiBackground02 text-text02",
|
|
106
|
+
COUNTER_SIZE_CLASSES[size]
|
|
107
|
+
),
|
|
108
|
+
"aria-label": `\u6B8B\u308A${remain}\u4EBA`,
|
|
109
|
+
children: [
|
|
110
|
+
"+",
|
|
111
|
+
remain
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
function AvatarGroup({
|
|
117
|
+
children,
|
|
118
|
+
size = "medium",
|
|
119
|
+
max: maxProp = 5,
|
|
120
|
+
total,
|
|
121
|
+
renderSurplus,
|
|
122
|
+
"aria-label": ariaLabel
|
|
123
|
+
}) {
|
|
124
|
+
const max = Math.max(1, maxProp);
|
|
125
|
+
const avatarNodes = Children.toArray(children).filter(isValidElement);
|
|
126
|
+
const childrenCount = avatarNodes.length;
|
|
127
|
+
const displayedTotal = total ?? childrenCount;
|
|
128
|
+
const remain = Math.max(displayedTotal - max, 0);
|
|
129
|
+
const visibleAvatars = avatarNodes.slice(0, max);
|
|
130
|
+
const defaultBadge = remain > 0 ? /* @__PURE__ */ jsx3(DefaultSurplus, { remain, size }) : null;
|
|
131
|
+
const surplusNode = remain > 0 ? typeof renderSurplus === "function" ? renderSurplus({ remain, total: displayedTotal, defaultBadge }) : defaultBadge : null;
|
|
132
|
+
return /* @__PURE__ */ jsx3(AvatarGroupContext.Provider, { value: { size }, children: /* @__PURE__ */ jsxs("div", { role: "group", "aria-label": ariaLabel, className: "flex items-center", children: [
|
|
133
|
+
visibleAvatars.map((child, index) => /* @__PURE__ */ jsx3(
|
|
134
|
+
"div",
|
|
135
|
+
{
|
|
136
|
+
className: clsx3("relative rounded-full", BORDER_CLASSES[size], index > 0 && OVERLAP_CLASSES[size]),
|
|
137
|
+
style: { zIndex: index + 1 },
|
|
138
|
+
children: child
|
|
139
|
+
},
|
|
140
|
+
index
|
|
141
|
+
)),
|
|
142
|
+
surplusNode != null && /* @__PURE__ */ jsx3(
|
|
143
|
+
"div",
|
|
144
|
+
{
|
|
145
|
+
className: clsx3("relative rounded-full", BORDER_CLASSES[size], OVERLAP_CLASSES[size]),
|
|
146
|
+
style: { zIndex: visibleAvatars.length + 1 },
|
|
147
|
+
children: surplusNode
|
|
148
|
+
}
|
|
149
|
+
)
|
|
150
|
+
] }) });
|
|
151
|
+
}
|
|
152
|
+
|
|
65
153
|
// src/breadcrumb/breadcrumb-item.tsx
|
|
66
|
-
import { jsx as
|
|
154
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
67
155
|
var BreadcrumbItem = ({ children }) => {
|
|
68
|
-
return /* @__PURE__ */
|
|
156
|
+
return /* @__PURE__ */ jsx4("li", { className: "flex gap-2 after:content-['/'] last:after:content-none [&_a]:text-interactive02 [&_a]:hover:underline [&_a]:active:text-activeLink02 [&_a]:active:underline", children });
|
|
69
157
|
};
|
|
70
158
|
|
|
71
159
|
// src/breadcrumb/breadcrumb.tsx
|
|
72
|
-
import { jsx as
|
|
160
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
73
161
|
function Breadcrumb({ children }) {
|
|
74
|
-
return /* @__PURE__ */
|
|
162
|
+
return /* @__PURE__ */ jsx5("nav", { "aria-label": "breadcrumb", children: /* @__PURE__ */ jsx5("ul", { className: "typography-label14regular flex flex-wrap gap-2 whitespace-nowrap text-text01", children }) });
|
|
75
163
|
}
|
|
76
164
|
Breadcrumb.Item = BreadcrumbItem;
|
|
77
165
|
|
|
78
166
|
// src/button/button.tsx
|
|
79
167
|
import { buttonColors, focusVisible } from "@zenkigen-inc/component-theme";
|
|
80
|
-
import { clsx as
|
|
81
|
-
import { jsxs } from "react/jsx-runtime";
|
|
168
|
+
import { clsx as clsx4 } from "clsx";
|
|
169
|
+
import { jsxs as jsxs2 } from "react/jsx-runtime";
|
|
82
170
|
var createButton = (props) => {
|
|
83
171
|
const {
|
|
84
172
|
size = "medium",
|
|
@@ -94,7 +182,7 @@ var createButton = (props) => {
|
|
|
94
182
|
children,
|
|
95
183
|
...restProps
|
|
96
184
|
} = props;
|
|
97
|
-
const baseClasses =
|
|
185
|
+
const baseClasses = clsx4(
|
|
98
186
|
"flex shrink-0 items-center gap-1",
|
|
99
187
|
buttonColors[variant].hover,
|
|
100
188
|
buttonColors[variant].active,
|
|
@@ -118,7 +206,7 @@ var createButton = (props) => {
|
|
|
118
206
|
}
|
|
119
207
|
);
|
|
120
208
|
const Component = elementAs ?? "button";
|
|
121
|
-
return /* @__PURE__ */
|
|
209
|
+
return /* @__PURE__ */ jsxs2(Component, { className: baseClasses, style: { width, borderRadius }, disabled: isDisabled, ...restProps, children: [
|
|
122
210
|
before,
|
|
123
211
|
children,
|
|
124
212
|
after
|
|
@@ -133,23 +221,23 @@ var InternalButton = (props) => {
|
|
|
133
221
|
|
|
134
222
|
// src/checkbox/checkbox.tsx
|
|
135
223
|
import { focusVisible as focusVisible2 } from "@zenkigen-inc/component-theme";
|
|
136
|
-
import
|
|
224
|
+
import clsx7 from "clsx";
|
|
137
225
|
import { useCallback, useState } from "react";
|
|
138
226
|
|
|
139
227
|
// src/checkbox/checked-icon.tsx
|
|
140
|
-
import
|
|
141
|
-
import { jsx as
|
|
228
|
+
import clsx5 from "clsx";
|
|
229
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
142
230
|
var CheckedIcon = ({ size = "medium" }) => {
|
|
143
|
-
return /* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ jsx6(
|
|
144
232
|
"svg",
|
|
145
233
|
{
|
|
146
234
|
viewBox: "0 0 20 20",
|
|
147
235
|
xmlns: "http://www.w3.org/2000/svg",
|
|
148
|
-
className:
|
|
236
|
+
className: clsx5("absolute z-10 rounded-sm fill-iconOnColor hover:rounded-sm", {
|
|
149
237
|
"size-5": size === "medium",
|
|
150
238
|
"size-6": size === "large"
|
|
151
239
|
}),
|
|
152
|
-
children: /* @__PURE__ */
|
|
240
|
+
children: /* @__PURE__ */ jsx6(
|
|
153
241
|
"path",
|
|
154
242
|
{
|
|
155
243
|
fillRule: "evenodd",
|
|
@@ -162,25 +250,25 @@ var CheckedIcon = ({ size = "medium" }) => {
|
|
|
162
250
|
};
|
|
163
251
|
|
|
164
252
|
// src/checkbox/minus-icon.tsx
|
|
165
|
-
import
|
|
166
|
-
import { jsx as
|
|
253
|
+
import clsx6 from "clsx";
|
|
254
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
167
255
|
var MinusIcon = ({ size = "medium" }) => {
|
|
168
|
-
return /* @__PURE__ */
|
|
256
|
+
return /* @__PURE__ */ jsx7(
|
|
169
257
|
"svg",
|
|
170
258
|
{
|
|
171
259
|
viewBox: "0 0 20 20",
|
|
172
260
|
xmlns: "http://www.w3.org/2000/svg",
|
|
173
|
-
className:
|
|
261
|
+
className: clsx6("absolute z-10 rounded-sm fill-iconOnColor hover:rounded-sm", {
|
|
174
262
|
"size-5": size === "medium",
|
|
175
263
|
"size-6": size === "large"
|
|
176
264
|
}),
|
|
177
|
-
children: /* @__PURE__ */
|
|
265
|
+
children: /* @__PURE__ */ jsx7("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" })
|
|
178
266
|
}
|
|
179
267
|
);
|
|
180
268
|
};
|
|
181
269
|
|
|
182
270
|
// src/checkbox/checkbox.tsx
|
|
183
|
-
import { jsx as
|
|
271
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
184
272
|
function Checkbox({
|
|
185
273
|
name,
|
|
186
274
|
value,
|
|
@@ -205,11 +293,11 @@ function Checkbox({
|
|
|
205
293
|
[isDisabled, onChange]
|
|
206
294
|
);
|
|
207
295
|
const sizeBox = size === "large" ? "size-6" : "size-5";
|
|
208
|
-
const baseInputClasses =
|
|
296
|
+
const baseInputClasses = clsx7("peer absolute inset-0 z-[1] opacity-0", {
|
|
209
297
|
"cursor-not-allowed": isDisabled,
|
|
210
298
|
"cursor-pointer": !isDisabled
|
|
211
299
|
});
|
|
212
|
-
const boxClasses =
|
|
300
|
+
const boxClasses = clsx7(
|
|
213
301
|
"inline-flex items-center justify-center rounded-sm border bg-white",
|
|
214
302
|
sizeBox,
|
|
215
303
|
focusVisible2.normalPeer,
|
|
@@ -222,11 +310,11 @@ function Checkbox({
|
|
|
222
310
|
"border-supportError": !isDisabled && !isMouseOver && color === "error"
|
|
223
311
|
}
|
|
224
312
|
);
|
|
225
|
-
const indicatorClasses =
|
|
313
|
+
const indicatorClasses = clsx7("relative flex flex-[0_0_auto] items-center justify-center", sizeBox, {
|
|
226
314
|
"bg-disabled01": isDisabled && isChecked,
|
|
227
315
|
"border-disabled01": isDisabled
|
|
228
316
|
});
|
|
229
|
-
const afterClasses =
|
|
317
|
+
const afterClasses = clsx7("absolute inset-0 m-auto block rounded-sm", {
|
|
230
318
|
"bg-disabled01": isDisabled && isChecked,
|
|
231
319
|
"bg-hover01": !(isDisabled && isChecked) && isMouseOver,
|
|
232
320
|
"bg-interactive01": !(isDisabled && isChecked) && !isMouseOver,
|
|
@@ -237,24 +325,24 @@ function Checkbox({
|
|
|
237
325
|
"scale-0": !isChecked,
|
|
238
326
|
"scale-100": isChecked
|
|
239
327
|
});
|
|
240
|
-
const hoverIndicatorClasses =
|
|
328
|
+
const hoverIndicatorClasses = clsx7("inline-block rounded-[1px]", {
|
|
241
329
|
"size-3": size === "medium",
|
|
242
330
|
"size-4": size === "large",
|
|
243
331
|
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
244
332
|
});
|
|
245
|
-
const labelClasses =
|
|
333
|
+
const labelClasses = clsx7("ml-2 flex-[1_0_0] break-all", {
|
|
246
334
|
"typography-label14regular": size === "medium",
|
|
247
335
|
"typography-label16regular": size === "large",
|
|
248
336
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
249
337
|
"cursor-pointer text-text01": !isDisabled
|
|
250
338
|
});
|
|
251
|
-
const outerWrapperClasses =
|
|
339
|
+
const outerWrapperClasses = clsx7("relative flex items-center justify-center", {
|
|
252
340
|
"size-6": size === "medium",
|
|
253
341
|
"h-8 w-7": size === "large"
|
|
254
342
|
});
|
|
255
|
-
return /* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
343
|
+
return /* @__PURE__ */ jsxs3("div", { className: "flex items-center", children: [
|
|
344
|
+
/* @__PURE__ */ jsxs3("div", { className: outerWrapperClasses, children: [
|
|
345
|
+
/* @__PURE__ */ jsx8(
|
|
258
346
|
"input",
|
|
259
347
|
{
|
|
260
348
|
type: "checkbox",
|
|
@@ -269,37 +357,111 @@ function Checkbox({
|
|
|
269
357
|
className: baseInputClasses
|
|
270
358
|
}
|
|
271
359
|
),
|
|
272
|
-
/* @__PURE__ */
|
|
273
|
-
/* @__PURE__ */
|
|
274
|
-
isChecked && !isIndeterminate && /* @__PURE__ */
|
|
275
|
-
isIndeterminate && /* @__PURE__ */
|
|
360
|
+
/* @__PURE__ */ jsx8("div", { className: boxClasses, children: /* @__PURE__ */ jsxs3("div", { className: indicatorClasses, children: [
|
|
361
|
+
/* @__PURE__ */ jsxs3("span", { className: afterClasses, children: [
|
|
362
|
+
isChecked && !isIndeterminate && /* @__PURE__ */ jsx8(CheckedIcon, { size }),
|
|
363
|
+
isIndeterminate && /* @__PURE__ */ jsx8(MinusIcon, { size })
|
|
276
364
|
] }),
|
|
277
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ jsx8("span", { className: hoverIndicatorClasses })
|
|
278
366
|
] }) })
|
|
279
367
|
] }),
|
|
280
|
-
label != null && /* @__PURE__ */
|
|
368
|
+
label != null && /* @__PURE__ */ jsx8("label", { htmlFor: id, className: labelClasses, children: label })
|
|
281
369
|
] });
|
|
282
370
|
}
|
|
283
371
|
|
|
284
|
-
// src/
|
|
285
|
-
import "
|
|
286
|
-
import {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
useEffect
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
}
|
|
297
|
-
|
|
372
|
+
// src/combobox/combobox.tsx
|
|
373
|
+
import { autoUpdate, flip, offset, size as sizeMiddleware, useFloating } from "@floating-ui/react";
|
|
374
|
+
import { useCallback as useCallback5, useEffect as useEffect5, useMemo as useMemo3, useRef as useRef4, useState as useState3 } from "react";
|
|
375
|
+
|
|
376
|
+
// src/hooks/use-outside-click.ts
|
|
377
|
+
import { useEffect } from "react";
|
|
378
|
+
var useOutsideClick = (ref, handler, enabled = true) => {
|
|
379
|
+
useEffect(() => {
|
|
380
|
+
const listener = (event) => {
|
|
381
|
+
const element = ref?.current;
|
|
382
|
+
if (element == null) {
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
const target = event.target;
|
|
386
|
+
if (target instanceof Node && Boolean(element.contains(target))) {
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
const path = typeof event.composedPath === "function" ? event.composedPath() : [];
|
|
390
|
+
const isInsideViaPath = path.some((node) => node instanceof Node && Boolean(element.contains(node)));
|
|
391
|
+
if (isInsideViaPath) {
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
handler(event);
|
|
395
|
+
};
|
|
396
|
+
if (enabled) {
|
|
397
|
+
document.addEventListener("click", listener);
|
|
398
|
+
}
|
|
399
|
+
return () => document.removeEventListener("click", listener);
|
|
400
|
+
}, [ref, enabled, handler]);
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
// src/text-input/text-input-error-message.tsx
|
|
404
|
+
import { clsx as clsx8 } from "clsx";
|
|
405
|
+
import { forwardRef } from "react";
|
|
406
|
+
|
|
407
|
+
// src/text-input/text-input-context.tsx
|
|
408
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
409
|
+
var TextInputCompoundContext = createContext2(null);
|
|
410
|
+
var useTextInputCompoundContext = (componentName) => {
|
|
411
|
+
const context = useContext2(TextInputCompoundContext);
|
|
412
|
+
if (context == null) {
|
|
413
|
+
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextInput \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
414
|
+
}
|
|
415
|
+
return context;
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
// src/text-input/text-input-error-message.tsx
|
|
419
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
420
|
+
var TextInputErrorMessage = forwardRef(
|
|
421
|
+
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
422
|
+
const { inputProps } = useTextInputCompoundContext("TextInput.ErrorMessage");
|
|
423
|
+
const typographyClass = inputProps.size === "large" || inputProps.size === "x-large" ? "typography-label13regular" : "typography-label12regular";
|
|
424
|
+
const shouldRender = inputProps.isError === true;
|
|
425
|
+
if (!shouldRender) {
|
|
426
|
+
return null;
|
|
427
|
+
}
|
|
428
|
+
const errorMessageClassName = clsx8(typographyClass, "text-supportError");
|
|
429
|
+
return /* @__PURE__ */ jsx9("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
430
|
+
}
|
|
431
|
+
);
|
|
432
|
+
TextInputErrorMessage.displayName = "TextInput.ErrorMessage";
|
|
433
|
+
|
|
434
|
+
// src/text-input/text-input-helper-message.tsx
|
|
435
|
+
import { clsx as clsx9 } from "clsx";
|
|
436
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
437
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
438
|
+
var TextInputHelperMessage = forwardRef2((props, ref) => {
|
|
439
|
+
const { inputProps } = useTextInputCompoundContext("TextInput.HelperMessage");
|
|
440
|
+
const typographyClass = inputProps.size === "large" || inputProps.size === "x-large" ? "typography-label13regular" : "typography-label12regular";
|
|
441
|
+
const helperMessageClassName = clsx9(typographyClass, "text-text02");
|
|
442
|
+
return /* @__PURE__ */ jsx10("div", { ref, className: helperMessageClassName, ...props });
|
|
443
|
+
});
|
|
444
|
+
TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
445
|
+
|
|
446
|
+
// src/combobox/combobox-context.ts
|
|
447
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
448
|
+
var ComboboxContext = createContext3(null);
|
|
449
|
+
var ComboboxContextProvider = ComboboxContext.Provider;
|
|
450
|
+
function useComboboxContext(componentName) {
|
|
451
|
+
const ctx = useContext3(ComboboxContext);
|
|
452
|
+
if (ctx === null) {
|
|
453
|
+
throw new Error(`<${componentName}> must be used inside <Combobox>`);
|
|
454
|
+
}
|
|
455
|
+
return ctx;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// src/combobox/combobox-input.tsx
|
|
459
|
+
import { useCallback as useCallback2 } from "react";
|
|
298
460
|
|
|
299
461
|
// src/icon-button/icon-button.tsx
|
|
300
462
|
import { buttonColors as buttonColors2, focusVisible as focusVisible3 } from "@zenkigen-inc/component-theme";
|
|
301
|
-
import { clsx as
|
|
302
|
-
import { jsx as
|
|
463
|
+
import { clsx as clsx10 } from "clsx";
|
|
464
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
303
465
|
function IconButton({
|
|
304
466
|
icon,
|
|
305
467
|
size = "medium",
|
|
@@ -311,7 +473,7 @@ function IconButton({
|
|
|
311
473
|
iconAccentColor,
|
|
312
474
|
...props
|
|
313
475
|
}) {
|
|
314
|
-
const baseClasses =
|
|
476
|
+
const baseClasses = clsx10(
|
|
315
477
|
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
316
478
|
buttonColors2[variant].hover,
|
|
317
479
|
buttonColors2[variant].active,
|
|
@@ -333,61 +495,1062 @@ function IconButton({
|
|
|
333
495
|
const iconAccentColorProps = !isSelected && iconAccentColor ? { accentColor: iconAccentColor } : {};
|
|
334
496
|
if (props.isAnchor === true) {
|
|
335
497
|
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
336
|
-
return /* @__PURE__ */
|
|
498
|
+
return /* @__PURE__ */ jsx11("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ jsx11(Icon, { name: icon, size: iconSize, ...iconColorProps, ...iconAccentColorProps }) });
|
|
337
499
|
} else {
|
|
338
500
|
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
339
|
-
return /* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ jsx11("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ jsx11(Icon, { name: icon, size: iconSize, ...iconColorProps, ...iconAccentColorProps }) });
|
|
340
502
|
}
|
|
341
503
|
}
|
|
342
504
|
|
|
343
|
-
// src/
|
|
344
|
-
import {
|
|
345
|
-
import {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
505
|
+
// src/text-input/text-input.tsx
|
|
506
|
+
import { clsx as clsx11 } from "clsx";
|
|
507
|
+
import { Children as Children2, cloneElement, forwardRef as forwardRef3, isValidElement as isValidElement2, useId, useMemo } from "react";
|
|
508
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
509
|
+
function TextInputInner({
|
|
510
|
+
size = "medium",
|
|
511
|
+
variant = "outline",
|
|
512
|
+
isError = false,
|
|
513
|
+
disabled = false,
|
|
514
|
+
onClickClearButton,
|
|
515
|
+
after,
|
|
516
|
+
children,
|
|
517
|
+
...props
|
|
518
|
+
}, ref) {
|
|
519
|
+
const autoGeneratedId = useId();
|
|
520
|
+
const { className: _className, ...restInputProps } = props;
|
|
521
|
+
const inputPropsForContext = useMemo(
|
|
522
|
+
() => ({
|
|
523
|
+
...restInputProps,
|
|
524
|
+
size,
|
|
525
|
+
isError,
|
|
526
|
+
disabled,
|
|
527
|
+
onClickClearButton,
|
|
528
|
+
after
|
|
529
|
+
}),
|
|
530
|
+
[restInputProps, size, isError, disabled, onClickClearButton, after]
|
|
531
|
+
);
|
|
532
|
+
const contextValue = useMemo(
|
|
533
|
+
() => ({
|
|
534
|
+
inputProps: inputPropsForContext,
|
|
535
|
+
forwardedRef: ref
|
|
536
|
+
}),
|
|
537
|
+
[inputPropsForContext, ref]
|
|
538
|
+
);
|
|
539
|
+
const helperMessageIds = [];
|
|
540
|
+
const errorIds = [];
|
|
541
|
+
const describedByBaseId = restInputProps.id ?? autoGeneratedId;
|
|
542
|
+
const enhancedChildren = Children2.map(children, (child) => {
|
|
543
|
+
if (!isValidElement2(child)) {
|
|
544
|
+
return child;
|
|
545
|
+
}
|
|
546
|
+
if (child.type === TextInputHelperMessage) {
|
|
547
|
+
const helperChild = child;
|
|
548
|
+
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
549
|
+
helperMessageIds.push(assignedId);
|
|
550
|
+
return cloneElement(helperChild, { id: assignedId });
|
|
379
551
|
}
|
|
552
|
+
if (child.type === TextInputErrorMessage && isError) {
|
|
553
|
+
const errorChild = child;
|
|
554
|
+
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
555
|
+
errorIds.push(assignedId);
|
|
556
|
+
return cloneElement(errorChild, { id: assignedId });
|
|
557
|
+
}
|
|
558
|
+
return child;
|
|
559
|
+
});
|
|
560
|
+
const describedByFromProps = typeof restInputProps["aria-describedby"] === "string" ? restInputProps["aria-describedby"] : null;
|
|
561
|
+
const describedByList = [describedByFromProps, ...helperMessageIds, ...errorIds].filter(
|
|
562
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
563
|
+
);
|
|
564
|
+
const describedByProps = describedByList.length > 0 ? {
|
|
565
|
+
"aria-describedby": describedByList.join(" ")
|
|
566
|
+
} : {};
|
|
567
|
+
const shouldMarkInvalid = isError === true || errorIds.length > 0;
|
|
568
|
+
const ariaInvalidFromProps = restInputProps["aria-invalid"];
|
|
569
|
+
const ariaInvalidValue = ariaInvalidFromProps != null ? ariaInvalidFromProps : shouldMarkInvalid ? true : null;
|
|
570
|
+
const ariaInvalidProps = ariaInvalidValue == null ? {} : { "aria-invalid": ariaInvalidValue };
|
|
571
|
+
const mergedInputProps = {
|
|
572
|
+
...restInputProps,
|
|
573
|
+
...describedByProps,
|
|
574
|
+
...ariaInvalidProps,
|
|
575
|
+
disabled
|
|
380
576
|
};
|
|
577
|
+
const isShowClearButton = !!onClickClearButton && restInputProps.value.length !== 0 && !disabled;
|
|
578
|
+
const hasTrailingElement = isShowClearButton || after != null;
|
|
579
|
+
const isBorderless = variant === "text";
|
|
580
|
+
const inputWrapClasses = clsx11("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
581
|
+
// outline variant
|
|
582
|
+
"border-uiBorder02": !isBorderless && !isError && !disabled,
|
|
583
|
+
"border-supportError": !isBorderless && isError && !disabled,
|
|
584
|
+
"hover:border-hoverInput": !isBorderless && !disabled && !isError,
|
|
585
|
+
"hover:focus-within:border-activeInput": !isBorderless && !isError,
|
|
586
|
+
"focus-within:border-activeInput": !isBorderless && !isError,
|
|
587
|
+
"bg-disabled02 border-disabled01": !isBorderless && disabled,
|
|
588
|
+
// text variant
|
|
589
|
+
"border-transparent": isBorderless,
|
|
590
|
+
// 共通
|
|
591
|
+
"bg-uiBackground01": !disabled || isBorderless,
|
|
592
|
+
"pr-2": !isBorderless && size === "medium" && hasTrailingElement,
|
|
593
|
+
"pr-3": !isBorderless && (size === "large" || size === "x-large") && hasTrailingElement
|
|
594
|
+
});
|
|
595
|
+
const inputClasses = clsx11("flex-1 bg-transparent outline-none", {
|
|
596
|
+
"disabled:text-textPlaceholder": !isBorderless,
|
|
597
|
+
"disabled:text-disabled01": isBorderless,
|
|
598
|
+
// outline: 従来の padding
|
|
599
|
+
"typography-label14regular min-h-8 px-2": !isBorderless && size === "medium",
|
|
600
|
+
"typography-label16regular min-h-10 px-3": !isBorderless && size === "large",
|
|
601
|
+
"typography-label16regular min-h-12 px-3": !isBorderless && size === "x-large",
|
|
602
|
+
// text: padding なし
|
|
603
|
+
"typography-label14regular min-h-8": isBorderless && size === "medium",
|
|
604
|
+
"typography-label16regular min-h-10": isBorderless && size === "large",
|
|
605
|
+
"typography-label16regular min-h-12": isBorderless && size === "x-large",
|
|
606
|
+
// テキスト色
|
|
607
|
+
"text-text01": !isError,
|
|
608
|
+
"text-supportError": isError,
|
|
609
|
+
// placeholder 色(text variant エラー時のみ上書き)
|
|
610
|
+
"placeholder:text-textPlaceholder": !(isBorderless && isError && !disabled),
|
|
611
|
+
"placeholder:text-supportErrorLight": isBorderless && isError && !disabled,
|
|
612
|
+
"pr-0": hasTrailingElement
|
|
613
|
+
});
|
|
614
|
+
const inputElement = /* @__PURE__ */ jsxs4("div", { className: inputWrapClasses, children: [
|
|
615
|
+
/* @__PURE__ */ jsx12("input", { ref, size: 1, className: inputClasses, ...mergedInputProps }),
|
|
616
|
+
after,
|
|
617
|
+
isShowClearButton && /* @__PURE__ */ jsx12(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
618
|
+
] });
|
|
619
|
+
const stackedChildren = enhancedChildren == null ? [] : Children2.toArray(enhancedChildren);
|
|
620
|
+
const hasMessageChildren = stackedChildren.length > 0;
|
|
621
|
+
if (!hasMessageChildren) {
|
|
622
|
+
return /* @__PURE__ */ jsx12(TextInputCompoundContext.Provider, { value: contextValue, children: inputElement });
|
|
623
|
+
}
|
|
624
|
+
return /* @__PURE__ */ jsx12(TextInputCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2", children: [
|
|
625
|
+
inputElement,
|
|
626
|
+
stackedChildren
|
|
627
|
+
] }) });
|
|
381
628
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
var
|
|
629
|
+
var attachStatics = (component) => {
|
|
630
|
+
component.HelperMessage = TextInputHelperMessage;
|
|
631
|
+
component.ErrorMessage = TextInputErrorMessage;
|
|
632
|
+
component.displayName = "TextInput";
|
|
633
|
+
return component;
|
|
634
|
+
};
|
|
635
|
+
var TextInputPublic = forwardRef3(function TextInputPublic2(props, ref) {
|
|
636
|
+
return TextInputInner(props, ref);
|
|
637
|
+
});
|
|
638
|
+
var InternalTextInputBase = forwardRef3(
|
|
639
|
+
function InternalTextInputBase2(props, ref) {
|
|
640
|
+
return TextInputInner(props, ref);
|
|
641
|
+
}
|
|
642
|
+
);
|
|
643
|
+
var TextInput = attachStatics(TextInputPublic);
|
|
644
|
+
var InternalTextInput = attachStatics(InternalTextInputBase);
|
|
645
|
+
|
|
646
|
+
// src/combobox/combobox-input.tsx
|
|
647
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
648
|
+
function ComboboxInput({ autoFocus, children }) {
|
|
649
|
+
const {
|
|
650
|
+
baseId,
|
|
651
|
+
listId,
|
|
652
|
+
size,
|
|
653
|
+
variant,
|
|
654
|
+
isError,
|
|
655
|
+
isDisabled,
|
|
656
|
+
placeholder,
|
|
657
|
+
inputValue,
|
|
658
|
+
onInputChange,
|
|
659
|
+
isOpen,
|
|
660
|
+
setIsOpen,
|
|
661
|
+
activeIndex,
|
|
662
|
+
items,
|
|
663
|
+
hasOpenableContent: hasOpenableContent2,
|
|
664
|
+
inputRef,
|
|
665
|
+
setInputElementRef,
|
|
666
|
+
handleKeyDown,
|
|
667
|
+
handleInputBlur,
|
|
668
|
+
clearValue
|
|
669
|
+
} = useComboboxContext("Combobox.Input");
|
|
670
|
+
const isClearButtonVisible = inputValue.length > 0 && !isDisabled;
|
|
671
|
+
const isEffectivelyOpen = isOpen && hasOpenableContent2;
|
|
672
|
+
const activeItem = activeIndex !== null ? items[activeIndex] : null;
|
|
673
|
+
const activeId = activeItem != null ? `${baseId}-option-${activeItem.value}` : null;
|
|
674
|
+
const conditionalAriaProps = {
|
|
675
|
+
...isEffectivelyOpen ? { "aria-controls": listId } : {},
|
|
676
|
+
...activeId !== null ? { "aria-activedescendant": activeId } : {}
|
|
677
|
+
};
|
|
678
|
+
const preventBlur = useCallback2((event) => {
|
|
679
|
+
event.preventDefault();
|
|
680
|
+
}, []);
|
|
681
|
+
const handleFocus = useCallback2(() => {
|
|
682
|
+
setIsOpen(true);
|
|
683
|
+
}, [setIsOpen]);
|
|
684
|
+
const handleToggle = useCallback2(() => {
|
|
685
|
+
setIsOpen(!isOpen);
|
|
686
|
+
inputRef.current?.focus();
|
|
687
|
+
}, [isOpen, setIsOpen, inputRef]);
|
|
688
|
+
const handleClear = useCallback2(() => {
|
|
689
|
+
clearValue();
|
|
690
|
+
}, [clearValue]);
|
|
691
|
+
const setRef = useCallback2(
|
|
692
|
+
(node) => {
|
|
693
|
+
setInputElementRef(node);
|
|
694
|
+
},
|
|
695
|
+
[setInputElementRef]
|
|
696
|
+
);
|
|
697
|
+
const handleChange = useCallback2(
|
|
698
|
+
(event) => {
|
|
699
|
+
onInputChange(event.target.value);
|
|
700
|
+
if (!isOpen) {
|
|
701
|
+
setIsOpen(true);
|
|
702
|
+
}
|
|
703
|
+
},
|
|
704
|
+
[onInputChange, isOpen, setIsOpen]
|
|
705
|
+
);
|
|
706
|
+
return /* @__PURE__ */ jsx13(
|
|
707
|
+
InternalTextInput,
|
|
708
|
+
{
|
|
709
|
+
ref: setRef,
|
|
710
|
+
size,
|
|
711
|
+
variant,
|
|
712
|
+
value: inputValue,
|
|
713
|
+
onChange: handleChange,
|
|
714
|
+
onFocus: handleFocus,
|
|
715
|
+
onKeyDown: handleKeyDown,
|
|
716
|
+
onBlur: handleInputBlur,
|
|
717
|
+
isError,
|
|
718
|
+
disabled: isDisabled,
|
|
719
|
+
placeholder,
|
|
720
|
+
role: "combobox",
|
|
721
|
+
"aria-expanded": isEffectivelyOpen,
|
|
722
|
+
"aria-autocomplete": "list",
|
|
723
|
+
...conditionalAriaProps,
|
|
724
|
+
autoFocus,
|
|
725
|
+
autoComplete: "off",
|
|
726
|
+
after: /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
727
|
+
isClearButtonVisible && /* @__PURE__ */ jsx13(
|
|
728
|
+
IconButton,
|
|
729
|
+
{
|
|
730
|
+
variant: "text",
|
|
731
|
+
icon: "close",
|
|
732
|
+
size: "small",
|
|
733
|
+
onClick: handleClear,
|
|
734
|
+
onMouseDown: preventBlur,
|
|
735
|
+
"aria-label": "\u5165\u529B\u3092\u30AF\u30EA\u30A2",
|
|
736
|
+
tabIndex: -1
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
/* @__PURE__ */ jsx13(
|
|
740
|
+
IconButton,
|
|
741
|
+
{
|
|
742
|
+
variant: "text",
|
|
743
|
+
icon: isOpen ? "angle-up" : "angle-down",
|
|
744
|
+
size: "small",
|
|
745
|
+
onClick: handleToggle,
|
|
746
|
+
onMouseDown: preventBlur,
|
|
747
|
+
"aria-label": isOpen ? "\u5019\u88DC\u3092\u9589\u3058\u308B" : "\u5019\u88DC\u3092\u8868\u793A",
|
|
748
|
+
tabIndex: -1,
|
|
749
|
+
isDisabled: isDisabled || !hasOpenableContent2
|
|
750
|
+
}
|
|
751
|
+
)
|
|
752
|
+
] }),
|
|
753
|
+
children
|
|
754
|
+
}
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/combobox/combobox-item.tsx
|
|
759
|
+
import { useEffect as useEffect2, useRef } from "react";
|
|
760
|
+
|
|
761
|
+
// src/list/list-option-item.tsx
|
|
762
|
+
import { focusVisible as focusVisible4 } from "@zenkigen-inc/component-theme";
|
|
763
|
+
import clsx12 from "clsx";
|
|
764
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
765
|
+
|
|
766
|
+
// src/list/list-context.ts
|
|
767
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
768
|
+
var ListContext = createContext4(null);
|
|
769
|
+
var ListContextProvider = ListContext.Provider;
|
|
770
|
+
function useListContext(componentName) {
|
|
771
|
+
const ctx = useContext4(ListContext);
|
|
772
|
+
if (ctx === null) {
|
|
773
|
+
throw new Error(`<${componentName}> must be used inside <List>`);
|
|
774
|
+
}
|
|
775
|
+
return ctx;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// src/list/list-option-item.tsx
|
|
779
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
780
|
+
var ListOptionItem = forwardRef4(function ListOptionItem2({
|
|
781
|
+
children,
|
|
782
|
+
id,
|
|
783
|
+
isActive = false,
|
|
784
|
+
isSelected = false,
|
|
785
|
+
isDisabled = false,
|
|
786
|
+
isError = false,
|
|
787
|
+
onClick,
|
|
788
|
+
onMouseEnter,
|
|
789
|
+
"aria-selected": ariaSelected,
|
|
790
|
+
"aria-disabled": ariaDisabled
|
|
791
|
+
}, ref) {
|
|
792
|
+
const { size, selectionIndicator } = useListContext("List.OptionItem");
|
|
793
|
+
const classes = clsx12(
|
|
794
|
+
"flex w-full items-center gap-1 border-l-2 border-solid border-l-transparent pl-2.5 pr-3",
|
|
795
|
+
focusVisible4.inset,
|
|
796
|
+
{
|
|
797
|
+
// sizes
|
|
798
|
+
"h-8 typography-label14regular": size === "medium",
|
|
799
|
+
"h-10 typography-label16regular": size === "large",
|
|
800
|
+
// disabled (最優先)
|
|
801
|
+
"cursor-not-allowed bg-uiBackground01 text-disabled01 fill-disabled01": isDisabled,
|
|
802
|
+
// selected + error
|
|
803
|
+
"cursor-pointer bg-uiBackgroundError text-supportError fill-supportError": !isDisabled && isSelected && isError,
|
|
804
|
+
// selected (default)
|
|
805
|
+
"cursor-pointer bg-selectedUi text-interactive01 fill-interactive01": !isDisabled && isSelected && !isError,
|
|
806
|
+
// active only (not selected): bg-hover02
|
|
807
|
+
"cursor-pointer bg-hover02 text-interactive02 fill-icon01": !isDisabled && !isSelected && isActive,
|
|
808
|
+
// base + hover
|
|
809
|
+
"cursor-pointer bg-uiBackground01 text-interactive02 fill-icon01 hover:bg-hover02 active:bg-active02": !isDisabled && !isSelected && !isActive,
|
|
810
|
+
// active accent border(selected と同時成立可)
|
|
811
|
+
"border-l-interactive03": !isDisabled && isActive
|
|
812
|
+
}
|
|
813
|
+
);
|
|
814
|
+
const handleMouseDown = (event) => {
|
|
815
|
+
event.preventDefault();
|
|
816
|
+
};
|
|
817
|
+
const handleClick = (event) => {
|
|
818
|
+
if (isDisabled) {
|
|
819
|
+
return;
|
|
820
|
+
}
|
|
821
|
+
onClick?.(event);
|
|
822
|
+
};
|
|
823
|
+
const handleMouseEnter = () => {
|
|
824
|
+
if (isDisabled) {
|
|
825
|
+
return;
|
|
826
|
+
}
|
|
827
|
+
onMouseEnter?.();
|
|
828
|
+
};
|
|
829
|
+
const indicator = selectionIndicator === "none" ? null : /* @__PURE__ */ jsx14(
|
|
830
|
+
"span",
|
|
831
|
+
{
|
|
832
|
+
className: clsx12("flex size-4 shrink-0 items-center justify-center", {
|
|
833
|
+
"ml-auto": selectionIndicator === "right"
|
|
834
|
+
}),
|
|
835
|
+
"aria-hidden": "true",
|
|
836
|
+
"data-selection-indicator": true,
|
|
837
|
+
children: isSelected && !isDisabled && /* @__PURE__ */ jsx14(Icon, { name: "check", size: "small" })
|
|
838
|
+
}
|
|
839
|
+
);
|
|
840
|
+
const isPrimitiveChildren = typeof children === "string" || typeof children === "number";
|
|
841
|
+
const renderedChildren = isPrimitiveChildren ? /* @__PURE__ */ jsx14("span", { className: "min-w-0 flex-1 truncate", children }) : children;
|
|
842
|
+
return /* @__PURE__ */ jsxs6(
|
|
843
|
+
"li",
|
|
844
|
+
{
|
|
845
|
+
ref,
|
|
846
|
+
id,
|
|
847
|
+
role: "option",
|
|
848
|
+
"aria-selected": ariaSelected ?? isSelected,
|
|
849
|
+
"aria-disabled": ariaDisabled ?? isDisabled,
|
|
850
|
+
onMouseDown: handleMouseDown,
|
|
851
|
+
onClick: handleClick,
|
|
852
|
+
onMouseEnter: handleMouseEnter,
|
|
853
|
+
className: classes,
|
|
854
|
+
children: [
|
|
855
|
+
selectionIndicator === "left" && indicator,
|
|
856
|
+
renderedChildren,
|
|
857
|
+
selectionIndicator === "right" && indicator
|
|
858
|
+
]
|
|
859
|
+
}
|
|
860
|
+
);
|
|
861
|
+
});
|
|
862
|
+
|
|
863
|
+
// src/combobox/combobox-item.tsx
|
|
864
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
865
|
+
function ComboboxItem({ value, label, isDisabled = false }) {
|
|
866
|
+
const { baseId, items, activeIndex, selectedValue, selectValue, setActiveIndex, inputMode, setInputMode } = useComboboxContext("Combobox.Item");
|
|
867
|
+
const index = items.findIndex((item) => item.value === value);
|
|
868
|
+
const isActive = index !== -1 && activeIndex === index;
|
|
869
|
+
const isSelected = selectedValue === value;
|
|
870
|
+
const id = `${baseId}-option-${value}`;
|
|
871
|
+
const liRef = useRef(null);
|
|
872
|
+
useEffect2(() => {
|
|
873
|
+
if (!isActive) {
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
876
|
+
if (inputMode === "mouse") {
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
liRef.current?.scrollIntoView({ block: "nearest" });
|
|
880
|
+
}, [isActive, inputMode]);
|
|
881
|
+
const handleClick = () => {
|
|
882
|
+
if (isDisabled) {
|
|
883
|
+
return;
|
|
884
|
+
}
|
|
885
|
+
selectValue(value, label);
|
|
886
|
+
};
|
|
887
|
+
const handleMouseEnter = () => {
|
|
888
|
+
if (isDisabled) {
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
setInputMode("mouse");
|
|
892
|
+
if (index !== -1) {
|
|
893
|
+
setActiveIndex(index);
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
return /* @__PURE__ */ jsx15(
|
|
897
|
+
ListOptionItem,
|
|
898
|
+
{
|
|
899
|
+
ref: liRef,
|
|
900
|
+
id,
|
|
901
|
+
isActive,
|
|
902
|
+
isSelected,
|
|
903
|
+
isDisabled,
|
|
904
|
+
"aria-selected": isSelected,
|
|
905
|
+
onClick: handleClick,
|
|
906
|
+
onMouseEnter: handleMouseEnter,
|
|
907
|
+
children: /* @__PURE__ */ jsx15("span", { className: "min-w-0 flex-1 truncate", children: label })
|
|
908
|
+
}
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
|
|
912
|
+
// src/combobox/combobox-list.tsx
|
|
913
|
+
import { FloatingPortal } from "@floating-ui/react";
|
|
914
|
+
import { Children as Children3, isValidElement as isValidElement3, useCallback as useCallback3, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
915
|
+
|
|
916
|
+
// src/list/list.tsx
|
|
917
|
+
import clsx13 from "clsx";
|
|
918
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
919
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
920
|
+
var ListBase = forwardRef5(function List({
|
|
921
|
+
children,
|
|
922
|
+
size = "medium",
|
|
923
|
+
variant = "outline",
|
|
924
|
+
maxHeight,
|
|
925
|
+
width,
|
|
926
|
+
style,
|
|
927
|
+
className,
|
|
928
|
+
role = "listbox",
|
|
929
|
+
id,
|
|
930
|
+
"aria-label": ariaLabel,
|
|
931
|
+
"aria-labelledby": ariaLabelledby,
|
|
932
|
+
containerRef,
|
|
933
|
+
selectionIndicator = "none"
|
|
934
|
+
}, ref) {
|
|
935
|
+
const wrapperClasses = clsx13(
|
|
936
|
+
"flex flex-col overflow-hidden rounded bg-uiBackground01 shadow-floatingShadow",
|
|
937
|
+
{
|
|
938
|
+
"border border-solid border-uiBorder01": variant === "outline"
|
|
939
|
+
},
|
|
940
|
+
className
|
|
941
|
+
);
|
|
942
|
+
return /* @__PURE__ */ jsx16(ListContextProvider, { value: { size, variant, selectionIndicator }, children: /* @__PURE__ */ jsx16("div", { ref: containerRef, style: { maxHeight, width, ...style }, className: wrapperClasses, children: /* @__PURE__ */ jsx16(
|
|
943
|
+
"ul",
|
|
944
|
+
{
|
|
945
|
+
ref,
|
|
946
|
+
role,
|
|
947
|
+
id,
|
|
948
|
+
"aria-label": ariaLabel,
|
|
949
|
+
"aria-labelledby": ariaLabelledby,
|
|
950
|
+
className: "min-h-0 flex-1 overflow-y-auto py-2",
|
|
951
|
+
children
|
|
952
|
+
}
|
|
953
|
+
) }) });
|
|
954
|
+
});
|
|
955
|
+
var List2 = Object.assign(ListBase, {
|
|
956
|
+
OptionItem: ListOptionItem,
|
|
957
|
+
displayName: "List"
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
// src/combobox/combobox-status.tsx
|
|
961
|
+
import clsx14 from "clsx";
|
|
962
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
963
|
+
function StatusItem({ children, componentName }) {
|
|
964
|
+
const { size } = useComboboxContext(componentName);
|
|
965
|
+
const liClasses = clsx14("flex w-full items-center px-3 text-text02", {
|
|
966
|
+
"h-8": size === "medium",
|
|
967
|
+
"h-10": size === "large"
|
|
968
|
+
});
|
|
969
|
+
const textClasses = clsx14("min-w-0 flex-1 truncate text-center", {
|
|
970
|
+
"typography-label14regular": size === "medium",
|
|
971
|
+
"typography-label16regular": size === "large"
|
|
972
|
+
});
|
|
973
|
+
return /* @__PURE__ */ jsx17("li", { role: "presentation", className: liClasses, children: /* @__PURE__ */ jsx17("span", { className: textClasses, children }) });
|
|
974
|
+
}
|
|
975
|
+
var DEFAULT_LOADING_MESSAGE = "\u8AAD\u307F\u8FBC\u307F\u4E2D...";
|
|
976
|
+
function ComboboxLoading() {
|
|
977
|
+
return /* @__PURE__ */ jsx17(StatusItem, { componentName: "Combobox.Loading", children: DEFAULT_LOADING_MESSAGE });
|
|
978
|
+
}
|
|
979
|
+
var DEFAULT_EMPTY_MESSAGE = "\u4E00\u81F4\u3059\u308B\u60C5\u5831\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093";
|
|
980
|
+
function ComboboxEmpty() {
|
|
981
|
+
return /* @__PURE__ */ jsx17(StatusItem, { componentName: "Combobox.Empty", children: DEFAULT_EMPTY_MESSAGE });
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
// src/combobox/combobox-list.tsx
|
|
985
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
986
|
+
function extractItems(children) {
|
|
987
|
+
const result = [];
|
|
988
|
+
Children3.forEach(children, (child) => {
|
|
989
|
+
if (!isValidElement3(child)) {
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
if (child.type === ComboboxItem) {
|
|
993
|
+
const props = child.props;
|
|
994
|
+
result.push({
|
|
995
|
+
value: props.value,
|
|
996
|
+
label: props.label,
|
|
997
|
+
isDisabled: props.isDisabled ?? false
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
return result;
|
|
1002
|
+
}
|
|
1003
|
+
function hasOpenableContent(children) {
|
|
1004
|
+
let isFound = false;
|
|
1005
|
+
Children3.forEach(children, (child) => {
|
|
1006
|
+
if (!isValidElement3(child)) {
|
|
1007
|
+
return;
|
|
1008
|
+
}
|
|
1009
|
+
if (child.type === ComboboxItem || child.type === ComboboxLoading || child.type === ComboboxEmpty) {
|
|
1010
|
+
isFound = true;
|
|
1011
|
+
}
|
|
1012
|
+
});
|
|
1013
|
+
return isFound;
|
|
1014
|
+
}
|
|
1015
|
+
function ComboboxList({ children, maxHeight: maxHeightProp }) {
|
|
1016
|
+
const { listId, isOpen, setItems, setHasOpenableContent, setListRef, floatingStyles, listMaxHeight, variant, size } = useComboboxContext("Combobox.List");
|
|
1017
|
+
const items = useMemo2(() => extractItems(children), [children]);
|
|
1018
|
+
const hasContent = useMemo2(() => hasOpenableContent(children), [children]);
|
|
1019
|
+
useEffect3(() => {
|
|
1020
|
+
setItems(items);
|
|
1021
|
+
}, [items, setItems]);
|
|
1022
|
+
useEffect3(() => {
|
|
1023
|
+
setHasOpenableContent(hasContent);
|
|
1024
|
+
}, [hasContent, setHasOpenableContent]);
|
|
1025
|
+
const ulRef = useRef2(null);
|
|
1026
|
+
const mergedContainerRef = useCallback3(
|
|
1027
|
+
(node) => {
|
|
1028
|
+
setListRef(node);
|
|
1029
|
+
},
|
|
1030
|
+
[setListRef]
|
|
1031
|
+
);
|
|
1032
|
+
const prevOpenRef = useRef2(isOpen);
|
|
1033
|
+
useEffect3(() => {
|
|
1034
|
+
if (!prevOpenRef.current && isOpen && ulRef.current != null) {
|
|
1035
|
+
ulRef.current.scrollTop = 0;
|
|
1036
|
+
}
|
|
1037
|
+
prevOpenRef.current = isOpen;
|
|
1038
|
+
}, [isOpen]);
|
|
1039
|
+
const isVisible = isOpen && hasContent;
|
|
1040
|
+
return /* @__PURE__ */ jsx18(FloatingPortal, { children: /* @__PURE__ */ jsx18(
|
|
1041
|
+
List2,
|
|
1042
|
+
{
|
|
1043
|
+
ref: ulRef,
|
|
1044
|
+
containerRef: mergedContainerRef,
|
|
1045
|
+
id: listId,
|
|
1046
|
+
size,
|
|
1047
|
+
variant: variant === "outline" ? "outline" : "borderless",
|
|
1048
|
+
selectionIndicator: "right",
|
|
1049
|
+
maxHeight: maxHeightProp ?? listMaxHeight,
|
|
1050
|
+
"aria-label": "\u5019\u88DC\u4E00\u89A7",
|
|
1051
|
+
className: "z-popover",
|
|
1052
|
+
style: {
|
|
1053
|
+
...floatingStyles,
|
|
1054
|
+
visibility: isVisible ? "visible" : "hidden",
|
|
1055
|
+
pointerEvents: isVisible ? "auto" : "none"
|
|
1056
|
+
},
|
|
1057
|
+
children
|
|
1058
|
+
}
|
|
1059
|
+
) });
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
// src/combobox/use-combobox.ts
|
|
1063
|
+
import { useCallback as useCallback4, useEffect as useEffect4, useId as useId2, useRef as useRef3, useState as useState2 } from "react";
|
|
1064
|
+
function useCombobox(params) {
|
|
1065
|
+
const baseId = useId2();
|
|
1066
|
+
const listId = `${baseId}-list`;
|
|
1067
|
+
const paramsRef = useRef3(params);
|
|
1068
|
+
paramsRef.current = params;
|
|
1069
|
+
const isOpenControlled = params.isOpen != null;
|
|
1070
|
+
const [isOpenInternal, setIsOpenInternal] = useState2(false);
|
|
1071
|
+
const isOpen = isOpenControlled ? params.isOpen === true : isOpenInternal;
|
|
1072
|
+
const openStateRef = useRef3(isOpen);
|
|
1073
|
+
openStateRef.current = isOpen;
|
|
1074
|
+
const setIsOpen = useCallback4(
|
|
1075
|
+
(next) => {
|
|
1076
|
+
if (openStateRef.current === next) {
|
|
1077
|
+
return;
|
|
1078
|
+
}
|
|
1079
|
+
openStateRef.current = next;
|
|
1080
|
+
if (!isOpenControlled) {
|
|
1081
|
+
setIsOpenInternal(next);
|
|
1082
|
+
}
|
|
1083
|
+
paramsRef.current.onOpenChange?.(next);
|
|
1084
|
+
},
|
|
1085
|
+
[isOpenControlled]
|
|
1086
|
+
);
|
|
1087
|
+
const committedInputValueRef = useRef3(params.value === null ? "" : params.inputValue);
|
|
1088
|
+
useEffect4(() => {
|
|
1089
|
+
committedInputValueRef.current = paramsRef.current.value === null ? "" : paramsRef.current.inputValue;
|
|
1090
|
+
}, [params.value]);
|
|
1091
|
+
const revertInputToCommitted = useCallback4(() => {
|
|
1092
|
+
const committed = committedInputValueRef.current;
|
|
1093
|
+
if (paramsRef.current.inputValue !== committed) {
|
|
1094
|
+
paramsRef.current.onInputChange(committed);
|
|
1095
|
+
}
|
|
1096
|
+
}, []);
|
|
1097
|
+
const [activeIndex, setActiveIndexState] = useState2(null);
|
|
1098
|
+
const [items, setItemsState] = useState2([]);
|
|
1099
|
+
const itemsRef = useRef3(items);
|
|
1100
|
+
itemsRef.current = items;
|
|
1101
|
+
const activeValueRef = useRef3(null);
|
|
1102
|
+
const hasInitializedActiveRef = useRef3(false);
|
|
1103
|
+
const [inputMode, setInputMode] = useState2("keyboard");
|
|
1104
|
+
const setActiveIndex = useCallback4((index) => {
|
|
1105
|
+
setActiveIndexState(index);
|
|
1106
|
+
if (index === null) {
|
|
1107
|
+
activeValueRef.current = null;
|
|
1108
|
+
} else {
|
|
1109
|
+
const item = itemsRef.current[index];
|
|
1110
|
+
activeValueRef.current = item?.value ?? null;
|
|
1111
|
+
}
|
|
1112
|
+
}, []);
|
|
1113
|
+
const setItems = useCallback4((next) => {
|
|
1114
|
+
setItemsState((prev) => {
|
|
1115
|
+
if (prev.length === next.length && prev.every(
|
|
1116
|
+
(p, i) => p.value === next[i]?.value && p.label === next[i]?.label && p.isDisabled === next[i]?.isDisabled
|
|
1117
|
+
)) {
|
|
1118
|
+
return prev;
|
|
1119
|
+
}
|
|
1120
|
+
return next;
|
|
1121
|
+
});
|
|
1122
|
+
}, []);
|
|
1123
|
+
useEffect4(() => {
|
|
1124
|
+
if (isOpen) {
|
|
1125
|
+
setInputMode("keyboard");
|
|
1126
|
+
} else {
|
|
1127
|
+
hasInitializedActiveRef.current = false;
|
|
1128
|
+
activeValueRef.current = null;
|
|
1129
|
+
setActiveIndexState(null);
|
|
1130
|
+
}
|
|
1131
|
+
}, [isOpen]);
|
|
1132
|
+
useEffect4(() => {
|
|
1133
|
+
if (!isOpen) {
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (items.length === 0) {
|
|
1137
|
+
setActiveIndexState(null);
|
|
1138
|
+
activeValueRef.current = null;
|
|
1139
|
+
return;
|
|
1140
|
+
}
|
|
1141
|
+
const firstEnabledIdx = items.findIndex((item) => !item.isDisabled);
|
|
1142
|
+
const fallbackToFirstEnabled = () => {
|
|
1143
|
+
if (firstEnabledIdx === -1) {
|
|
1144
|
+
setActiveIndexState(null);
|
|
1145
|
+
activeValueRef.current = null;
|
|
1146
|
+
} else {
|
|
1147
|
+
setActiveIndexState(firstEnabledIdx);
|
|
1148
|
+
activeValueRef.current = items[firstEnabledIdx]?.value ?? null;
|
|
1149
|
+
}
|
|
1150
|
+
};
|
|
1151
|
+
if (!hasInitializedActiveRef.current) {
|
|
1152
|
+
const selectedIdx = items.findIndex((item) => item.value === paramsRef.current.value && !item.isDisabled);
|
|
1153
|
+
if (selectedIdx !== -1) {
|
|
1154
|
+
setActiveIndexState(selectedIdx);
|
|
1155
|
+
activeValueRef.current = items[selectedIdx]?.value ?? null;
|
|
1156
|
+
} else {
|
|
1157
|
+
fallbackToFirstEnabled();
|
|
1158
|
+
}
|
|
1159
|
+
hasInitializedActiveRef.current = true;
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
const currentActiveValue = activeValueRef.current;
|
|
1163
|
+
if (currentActiveValue !== null) {
|
|
1164
|
+
const newIdx = items.findIndex((item) => item.value === currentActiveValue && !item.isDisabled);
|
|
1165
|
+
if (newIdx !== -1) {
|
|
1166
|
+
setActiveIndexState(newIdx);
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
}
|
|
1170
|
+
fallbackToFirstEnabled();
|
|
1171
|
+
}, [items, isOpen]);
|
|
1172
|
+
const inputRef = useRef3(null);
|
|
1173
|
+
const selectValue = useCallback4(
|
|
1174
|
+
(value, label) => {
|
|
1175
|
+
committedInputValueRef.current = label;
|
|
1176
|
+
paramsRef.current.onChange(value, { label });
|
|
1177
|
+
paramsRef.current.onInputChange(label);
|
|
1178
|
+
setIsOpen(false);
|
|
1179
|
+
},
|
|
1180
|
+
[setIsOpen]
|
|
1181
|
+
);
|
|
1182
|
+
const clearValue = useCallback4(() => {
|
|
1183
|
+
committedInputValueRef.current = "";
|
|
1184
|
+
paramsRef.current.onChange(null, null);
|
|
1185
|
+
paramsRef.current.onInputChange("");
|
|
1186
|
+
setActiveIndexState(null);
|
|
1187
|
+
activeValueRef.current = null;
|
|
1188
|
+
inputRef.current?.focus();
|
|
1189
|
+
}, []);
|
|
1190
|
+
const moveActive = useCallback4((direction) => {
|
|
1191
|
+
const currentItems = itemsRef.current;
|
|
1192
|
+
const enabledIndices = currentItems.flatMap((item, i) => item.isDisabled ? [] : [i]);
|
|
1193
|
+
if (enabledIndices.length === 0) {
|
|
1194
|
+
return;
|
|
1195
|
+
}
|
|
1196
|
+
setActiveIndexState((prev) => {
|
|
1197
|
+
const currentPos = prev === null ? -1 : enabledIndices.indexOf(prev);
|
|
1198
|
+
let nextIndex;
|
|
1199
|
+
if (direction === "next") {
|
|
1200
|
+
const nextPos = currentPos < 0 ? 0 : (currentPos + 1) % enabledIndices.length;
|
|
1201
|
+
nextIndex = enabledIndices[nextPos] ?? null;
|
|
1202
|
+
} else {
|
|
1203
|
+
const nextPos = currentPos <= 0 ? enabledIndices.length - 1 : currentPos - 1;
|
|
1204
|
+
nextIndex = enabledIndices[nextPos] ?? null;
|
|
1205
|
+
}
|
|
1206
|
+
if (nextIndex === null) {
|
|
1207
|
+
activeValueRef.current = null;
|
|
1208
|
+
} else {
|
|
1209
|
+
activeValueRef.current = currentItems[nextIndex]?.value ?? null;
|
|
1210
|
+
}
|
|
1211
|
+
return nextIndex;
|
|
1212
|
+
});
|
|
1213
|
+
}, []);
|
|
1214
|
+
const handleKeyDown = useCallback4(
|
|
1215
|
+
(event) => {
|
|
1216
|
+
if (paramsRef.current.isDisabled === true) {
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
if (event.altKey && event.key === "ArrowDown") {
|
|
1220
|
+
event.preventDefault();
|
|
1221
|
+
setInputMode("keyboard");
|
|
1222
|
+
setIsOpen(true);
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
if (event.altKey && event.key === "ArrowUp") {
|
|
1226
|
+
event.preventDefault();
|
|
1227
|
+
setIsOpen(false);
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
if (event.key === "ArrowDown") {
|
|
1231
|
+
event.preventDefault();
|
|
1232
|
+
setInputMode("keyboard");
|
|
1233
|
+
if (!isOpen) {
|
|
1234
|
+
setIsOpen(true);
|
|
1235
|
+
return;
|
|
1236
|
+
}
|
|
1237
|
+
moveActive("next");
|
|
1238
|
+
return;
|
|
1239
|
+
}
|
|
1240
|
+
if (event.key === "ArrowUp") {
|
|
1241
|
+
event.preventDefault();
|
|
1242
|
+
setInputMode("keyboard");
|
|
1243
|
+
if (!isOpen) {
|
|
1244
|
+
setIsOpen(true);
|
|
1245
|
+
return;
|
|
1246
|
+
}
|
|
1247
|
+
moveActive("prev");
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
if (event.key === "Enter") {
|
|
1251
|
+
if (event.nativeEvent.isComposing === true || event.nativeEvent.keyCode === 229) {
|
|
1252
|
+
return;
|
|
1253
|
+
}
|
|
1254
|
+
if (!isOpen || activeIndex === null) {
|
|
1255
|
+
return;
|
|
1256
|
+
}
|
|
1257
|
+
event.preventDefault();
|
|
1258
|
+
const item = items[activeIndex];
|
|
1259
|
+
if (item != null && !item.isDisabled) {
|
|
1260
|
+
selectValue(item.value, item.label);
|
|
1261
|
+
}
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
if (event.key === "Escape") {
|
|
1265
|
+
if (isOpen) {
|
|
1266
|
+
event.preventDefault();
|
|
1267
|
+
event.stopPropagation();
|
|
1268
|
+
setIsOpen(false);
|
|
1269
|
+
revertInputToCommitted();
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
},
|
|
1273
|
+
[isOpen, activeIndex, items, moveActive, setIsOpen, selectValue, revertInputToCommitted]
|
|
1274
|
+
);
|
|
1275
|
+
return {
|
|
1276
|
+
baseId,
|
|
1277
|
+
listId,
|
|
1278
|
+
isOpen,
|
|
1279
|
+
setIsOpen,
|
|
1280
|
+
activeIndex,
|
|
1281
|
+
setActiveIndex,
|
|
1282
|
+
inputMode,
|
|
1283
|
+
setInputMode,
|
|
1284
|
+
items,
|
|
1285
|
+
setItems,
|
|
1286
|
+
selectValue,
|
|
1287
|
+
clearValue,
|
|
1288
|
+
revertInputToCommitted,
|
|
1289
|
+
inputRef,
|
|
1290
|
+
handleKeyDown
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
// src/combobox/combobox.tsx
|
|
1295
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1296
|
+
var FLOATING_OFFSET = 4;
|
|
1297
|
+
var FLOATING_VIEWPORT_PADDING = 8;
|
|
1298
|
+
function parseListMaxHeight(value) {
|
|
1299
|
+
if (value == null || value === "") {
|
|
1300
|
+
return null;
|
|
1301
|
+
}
|
|
1302
|
+
const numeric = typeof value === "number" ? value : parseFloat(value);
|
|
1303
|
+
return Number.isFinite(numeric) ? numeric : null;
|
|
1304
|
+
}
|
|
1305
|
+
function ComboboxBase({
|
|
1306
|
+
children,
|
|
1307
|
+
value,
|
|
1308
|
+
onChange,
|
|
1309
|
+
inputValue,
|
|
1310
|
+
onInputChange,
|
|
1311
|
+
isOpen: isOpenProp,
|
|
1312
|
+
onOpenChange,
|
|
1313
|
+
size = "medium",
|
|
1314
|
+
variant = "outline",
|
|
1315
|
+
placeholder,
|
|
1316
|
+
isError = false,
|
|
1317
|
+
isDisabled = false,
|
|
1318
|
+
width,
|
|
1319
|
+
maxWidth,
|
|
1320
|
+
listMaxHeight,
|
|
1321
|
+
matchListToTrigger = false
|
|
1322
|
+
}) {
|
|
1323
|
+
const combobox = useCombobox({
|
|
1324
|
+
value,
|
|
1325
|
+
onChange,
|
|
1326
|
+
inputValue,
|
|
1327
|
+
onInputChange,
|
|
1328
|
+
isOpen: isOpenProp,
|
|
1329
|
+
onOpenChange,
|
|
1330
|
+
isDisabled
|
|
1331
|
+
});
|
|
1332
|
+
const wrapperRef = useRef4(null);
|
|
1333
|
+
const [hasOpenableContent2, setHasOpenableContent] = useState3(false);
|
|
1334
|
+
const listMaxHeightRef = useRef4(listMaxHeight);
|
|
1335
|
+
listMaxHeightRef.current = listMaxHeight;
|
|
1336
|
+
const matchListToTriggerRef = useRef4(matchListToTrigger);
|
|
1337
|
+
matchListToTriggerRef.current = matchListToTrigger;
|
|
1338
|
+
const middleware = useMemo3(
|
|
1339
|
+
() => [
|
|
1340
|
+
offset(FLOATING_OFFSET),
|
|
1341
|
+
flip({ padding: FLOATING_VIEWPORT_PADDING }),
|
|
1342
|
+
sizeMiddleware({
|
|
1343
|
+
padding: FLOATING_VIEWPORT_PADDING,
|
|
1344
|
+
apply({ availableHeight, availableWidth, elements, rects }) {
|
|
1345
|
+
const referenceWidth = rects.reference.width;
|
|
1346
|
+
const numericLimit = parseListMaxHeight(listMaxHeightRef.current);
|
|
1347
|
+
const allowedHeight = numericLimit == null ? availableHeight : Math.min(availableHeight, numericLimit);
|
|
1348
|
+
if (matchListToTriggerRef.current) {
|
|
1349
|
+
elements.floating.style.width = `${referenceWidth}px`;
|
|
1350
|
+
} else {
|
|
1351
|
+
elements.floating.style.minWidth = `${referenceWidth}px`;
|
|
1352
|
+
elements.floating.style.maxWidth = `${availableWidth}px`;
|
|
1353
|
+
}
|
|
1354
|
+
elements.floating.style.maxHeight = `${allowedHeight}px`;
|
|
1355
|
+
}
|
|
1356
|
+
})
|
|
1357
|
+
],
|
|
1358
|
+
[]
|
|
1359
|
+
);
|
|
1360
|
+
const { refs, floatingStyles, update } = useFloating({
|
|
1361
|
+
open: combobox.isOpen,
|
|
1362
|
+
onOpenChange: combobox.setIsOpen,
|
|
1363
|
+
placement: "bottom-start",
|
|
1364
|
+
whileElementsMounted: autoUpdate,
|
|
1365
|
+
middleware
|
|
1366
|
+
});
|
|
1367
|
+
useEffect5(() => {
|
|
1368
|
+
update();
|
|
1369
|
+
}, [listMaxHeight, matchListToTrigger, update]);
|
|
1370
|
+
const refsRef = useRef4(refs);
|
|
1371
|
+
refsRef.current = refs;
|
|
1372
|
+
const setInputElementRef = useCallback5(
|
|
1373
|
+
(node) => {
|
|
1374
|
+
combobox.inputRef.current = node;
|
|
1375
|
+
refsRef.current.setReference(node?.parentElement ?? null);
|
|
1376
|
+
},
|
|
1377
|
+
[combobox.inputRef]
|
|
1378
|
+
);
|
|
1379
|
+
const listElementRef = useRef4(null);
|
|
1380
|
+
const setListRef = useCallback5((node) => {
|
|
1381
|
+
listElementRef.current = node;
|
|
1382
|
+
refsRef.current.setFloating(node);
|
|
1383
|
+
}, []);
|
|
1384
|
+
const { setIsOpen } = combobox;
|
|
1385
|
+
const handleOutsideClick = useCallback5(
|
|
1386
|
+
(event) => {
|
|
1387
|
+
const floatingElement = listElementRef.current;
|
|
1388
|
+
const target = event.target;
|
|
1389
|
+
if (floatingElement != null && target instanceof Node && Boolean(floatingElement.contains(target))) {
|
|
1390
|
+
return;
|
|
1391
|
+
}
|
|
1392
|
+
setIsOpen(false);
|
|
1393
|
+
},
|
|
1394
|
+
[setIsOpen]
|
|
1395
|
+
);
|
|
1396
|
+
useOutsideClick(wrapperRef, handleOutsideClick);
|
|
1397
|
+
const { revertInputToCommitted } = combobox;
|
|
1398
|
+
const handleInputBlur = useCallback5(
|
|
1399
|
+
(event) => {
|
|
1400
|
+
const next = event.relatedTarget;
|
|
1401
|
+
if (next instanceof Node) {
|
|
1402
|
+
if (wrapperRef.current?.contains(next) === true) {
|
|
1403
|
+
return;
|
|
1404
|
+
}
|
|
1405
|
+
if (listElementRef.current?.contains(next) === true) {
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
setIsOpen(false);
|
|
1410
|
+
revertInputToCommitted();
|
|
1411
|
+
},
|
|
1412
|
+
[setIsOpen, revertInputToCommitted]
|
|
1413
|
+
);
|
|
1414
|
+
const contextValue = useMemo3(
|
|
1415
|
+
() => ({
|
|
1416
|
+
baseId: combobox.baseId,
|
|
1417
|
+
listId: combobox.listId,
|
|
1418
|
+
size,
|
|
1419
|
+
variant,
|
|
1420
|
+
isError,
|
|
1421
|
+
isDisabled,
|
|
1422
|
+
placeholder,
|
|
1423
|
+
inputValue,
|
|
1424
|
+
onInputChange,
|
|
1425
|
+
isOpen: combobox.isOpen,
|
|
1426
|
+
setIsOpen,
|
|
1427
|
+
selectedValue: value,
|
|
1428
|
+
selectValue: combobox.selectValue,
|
|
1429
|
+
clearValue: combobox.clearValue,
|
|
1430
|
+
activeIndex: combobox.activeIndex,
|
|
1431
|
+
setActiveIndex: combobox.setActiveIndex,
|
|
1432
|
+
inputMode: combobox.inputMode,
|
|
1433
|
+
setInputMode: combobox.setInputMode,
|
|
1434
|
+
items: combobox.items,
|
|
1435
|
+
setItems: combobox.setItems,
|
|
1436
|
+
hasOpenableContent: hasOpenableContent2,
|
|
1437
|
+
setHasOpenableContent,
|
|
1438
|
+
inputRef: combobox.inputRef,
|
|
1439
|
+
setInputElementRef,
|
|
1440
|
+
setListRef,
|
|
1441
|
+
floatingStyles,
|
|
1442
|
+
listMaxHeight,
|
|
1443
|
+
handleKeyDown: combobox.handleKeyDown,
|
|
1444
|
+
handleInputBlur
|
|
1445
|
+
}),
|
|
1446
|
+
[
|
|
1447
|
+
combobox.baseId,
|
|
1448
|
+
combobox.listId,
|
|
1449
|
+
size,
|
|
1450
|
+
variant,
|
|
1451
|
+
isError,
|
|
1452
|
+
isDisabled,
|
|
1453
|
+
placeholder,
|
|
1454
|
+
inputValue,
|
|
1455
|
+
onInputChange,
|
|
1456
|
+
combobox.isOpen,
|
|
1457
|
+
setIsOpen,
|
|
1458
|
+
value,
|
|
1459
|
+
combobox.selectValue,
|
|
1460
|
+
combobox.clearValue,
|
|
1461
|
+
combobox.activeIndex,
|
|
1462
|
+
combobox.setActiveIndex,
|
|
1463
|
+
combobox.inputMode,
|
|
1464
|
+
combobox.setInputMode,
|
|
1465
|
+
combobox.items,
|
|
1466
|
+
combobox.setItems,
|
|
1467
|
+
hasOpenableContent2,
|
|
1468
|
+
setHasOpenableContent,
|
|
1469
|
+
combobox.inputRef,
|
|
1470
|
+
setInputElementRef,
|
|
1471
|
+
setListRef,
|
|
1472
|
+
floatingStyles,
|
|
1473
|
+
listMaxHeight,
|
|
1474
|
+
combobox.handleKeyDown,
|
|
1475
|
+
handleInputBlur
|
|
1476
|
+
]
|
|
1477
|
+
);
|
|
1478
|
+
return /* @__PURE__ */ jsx19(ComboboxContextProvider, { value: contextValue, children: /* @__PURE__ */ jsx19("div", { ref: wrapperRef, style: { width, maxWidth }, children }) });
|
|
1479
|
+
}
|
|
1480
|
+
var Combobox = Object.assign(ComboboxBase, {
|
|
1481
|
+
Input: ComboboxInput,
|
|
1482
|
+
List: ComboboxList,
|
|
1483
|
+
Item: ComboboxItem,
|
|
1484
|
+
Loading: ComboboxLoading,
|
|
1485
|
+
Empty: ComboboxEmpty,
|
|
1486
|
+
HelperMessage: TextInputHelperMessage,
|
|
1487
|
+
ErrorMessage: TextInputErrorMessage,
|
|
1488
|
+
displayName: "Combobox"
|
|
1489
|
+
});
|
|
1490
|
+
|
|
1491
|
+
// src/date-picker/date-picker.tsx
|
|
1492
|
+
import "react-day-picker/style.css";
|
|
1493
|
+
import {
|
|
1494
|
+
Children as Children4,
|
|
1495
|
+
cloneElement as cloneElement4,
|
|
1496
|
+
isValidElement as isValidElement4,
|
|
1497
|
+
useCallback as useCallback7,
|
|
1498
|
+
useEffect as useEffect9,
|
|
1499
|
+
useId as useId3,
|
|
1500
|
+
useMemo as useMemo5,
|
|
1501
|
+
useRef as useRef8,
|
|
1502
|
+
useState as useState4
|
|
1503
|
+
} from "react";
|
|
1504
|
+
import { DayPicker } from "react-day-picker";
|
|
1505
|
+
|
|
1506
|
+
// src/popover/popover.tsx
|
|
1507
|
+
import { autoUpdate as autoUpdate2, offset as offset2, useFloating as useFloating2, useId as useFloatingId } from "@floating-ui/react";
|
|
1508
|
+
import { useEffect as useEffect8, useMemo as useMemo4, useRef as useRef7 } from "react";
|
|
1509
|
+
|
|
1510
|
+
// src/popover/popover-content.tsx
|
|
1511
|
+
import { FloatingPortal as FloatingPortal2, useDismiss, useInteractions, useRole } from "@floating-ui/react";
|
|
1512
|
+
import * as React from "react";
|
|
1513
|
+
import { forwardRef as forwardRef6, useCallback as useCallback6, useEffect as useEffect7, useRef as useRef6 } from "react";
|
|
1514
|
+
|
|
1515
|
+
// src/hooks/use-dismiss-on-modal-open.ts
|
|
1516
|
+
import { useEffect as useEffect6, useRef as useRef5 } from "react";
|
|
1517
|
+
var MODAL_OPEN_EVENT = "zenkigen-modal-open";
|
|
1518
|
+
var useDismissOnModalOpen = (dismiss) => {
|
|
1519
|
+
const dismissRef = useRef5(dismiss);
|
|
1520
|
+
dismissRef.current = dismiss;
|
|
1521
|
+
useEffect6(() => {
|
|
1522
|
+
const handler = () => {
|
|
1523
|
+
dismissRef.current();
|
|
1524
|
+
};
|
|
1525
|
+
window.addEventListener(MODAL_OPEN_EVENT, handler);
|
|
1526
|
+
return () => window.removeEventListener(MODAL_OPEN_EVENT, handler);
|
|
1527
|
+
}, []);
|
|
1528
|
+
};
|
|
1529
|
+
|
|
1530
|
+
// src/utils/react-utils.ts
|
|
1531
|
+
function composeRefs(...refs) {
|
|
1532
|
+
return (node) => {
|
|
1533
|
+
for (const ref of refs) {
|
|
1534
|
+
if (ref == null) {
|
|
1535
|
+
continue;
|
|
1536
|
+
}
|
|
1537
|
+
if (typeof ref === "function") {
|
|
1538
|
+
ref(node);
|
|
1539
|
+
} else {
|
|
1540
|
+
ref.current = node;
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
};
|
|
1544
|
+
}
|
|
1545
|
+
function isElement(node) {
|
|
1546
|
+
return node != null && typeof node === "object" && "type" in node;
|
|
1547
|
+
}
|
|
1548
|
+
|
|
1549
|
+
// src/popover/popover-context.ts
|
|
1550
|
+
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1551
|
+
var PopoverContext = createContext5(null);
|
|
389
1552
|
var usePopoverContext = () => {
|
|
390
|
-
const context =
|
|
1553
|
+
const context = useContext5(PopoverContext);
|
|
391
1554
|
if (context == null) {
|
|
392
1555
|
throw new Error("Popover components must be used inside <Popover.Root>");
|
|
393
1556
|
}
|
|
@@ -395,10 +1558,10 @@ var usePopoverContext = () => {
|
|
|
395
1558
|
};
|
|
396
1559
|
|
|
397
1560
|
// src/popover/popover-content.tsx
|
|
398
|
-
import { jsx as
|
|
399
|
-
var PopoverContent =
|
|
1561
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
1562
|
+
var PopoverContent = forwardRef6(function PopoverContent2({ children }, ref) {
|
|
400
1563
|
const { isOpen, triggerRef, floating, panelId, onClose } = usePopoverContext();
|
|
401
|
-
const shouldCloseOnOutsidePress =
|
|
1564
|
+
const shouldCloseOnOutsidePress = useCallback6(
|
|
402
1565
|
(event) => {
|
|
403
1566
|
const target = event.target;
|
|
404
1567
|
if (!(target instanceof Element)) {
|
|
@@ -425,21 +1588,21 @@ var PopoverContent = forwardRef(function PopoverContent2({ children }, ref) {
|
|
|
425
1588
|
onClose({ reason: "modal-open" });
|
|
426
1589
|
}
|
|
427
1590
|
});
|
|
428
|
-
|
|
1591
|
+
useEffect7(() => {
|
|
429
1592
|
if (isOpen) {
|
|
430
1593
|
const element = floating.refs.floating.current;
|
|
431
1594
|
element?.focus?.({ preventScroll: true });
|
|
432
1595
|
}
|
|
433
1596
|
}, [isOpen, floating.refs.floating]);
|
|
434
|
-
const prevIsOpenRef =
|
|
435
|
-
|
|
1597
|
+
const prevIsOpenRef = useRef6(isOpen);
|
|
1598
|
+
useEffect7(() => {
|
|
436
1599
|
const hasPreviouslyBeenOpen = prevIsOpenRef.current;
|
|
437
1600
|
prevIsOpenRef.current = isOpen;
|
|
438
1601
|
if (hasPreviouslyBeenOpen && !isOpen) {
|
|
439
1602
|
triggerRef.current?.focus({ preventScroll: true });
|
|
440
1603
|
}
|
|
441
1604
|
}, [isOpen, triggerRef]);
|
|
442
|
-
const handleKeyDown =
|
|
1605
|
+
const handleKeyDown = useCallback6(
|
|
443
1606
|
(event) => {
|
|
444
1607
|
if (event.key === "Escape") {
|
|
445
1608
|
event.stopPropagation();
|
|
@@ -459,7 +1622,7 @@ var PopoverContent = forwardRef(function PopoverContent2({ children }, ref) {
|
|
|
459
1622
|
...childProps.role == null && { role: "dialog" }
|
|
460
1623
|
});
|
|
461
1624
|
}
|
|
462
|
-
return /* @__PURE__ */
|
|
1625
|
+
return /* @__PURE__ */ jsx20(FloatingPortal2, { children: isOpen ? /* @__PURE__ */ jsx20(
|
|
463
1626
|
"div",
|
|
464
1627
|
{
|
|
465
1628
|
...interactions.getFloatingProps({
|
|
@@ -481,8 +1644,8 @@ var PopoverContent = forwardRef(function PopoverContent2({ children }, ref) {
|
|
|
481
1644
|
|
|
482
1645
|
// src/popover/popover-trigger.tsx
|
|
483
1646
|
import * as React2 from "react";
|
|
484
|
-
import { forwardRef as
|
|
485
|
-
var PopoverTrigger =
|
|
1647
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
1648
|
+
var PopoverTrigger = forwardRef7(function PopoverTrigger2({ children }, ref) {
|
|
486
1649
|
const { isOpen, floating, triggerRef, anchorRef, panelId } = usePopoverContext();
|
|
487
1650
|
if (!isElement(children)) {
|
|
488
1651
|
return null;
|
|
@@ -510,7 +1673,7 @@ var PopoverTrigger = forwardRef2(function PopoverTrigger2({ children }, ref) {
|
|
|
510
1673
|
});
|
|
511
1674
|
|
|
512
1675
|
// src/popover/popover.tsx
|
|
513
|
-
import { jsx as
|
|
1676
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
514
1677
|
function Popover({
|
|
515
1678
|
isOpen,
|
|
516
1679
|
children,
|
|
@@ -519,8 +1682,8 @@ function Popover({
|
|
|
519
1682
|
onClose,
|
|
520
1683
|
anchorRef
|
|
521
1684
|
}) {
|
|
522
|
-
const triggerRef =
|
|
523
|
-
const floating =
|
|
1685
|
+
const triggerRef = useRef7(null);
|
|
1686
|
+
const floating = useFloating2({
|
|
524
1687
|
open: isOpen,
|
|
525
1688
|
onOpenChange: (open) => {
|
|
526
1689
|
if (!open && onClose != null) {
|
|
@@ -528,18 +1691,18 @@ function Popover({
|
|
|
528
1691
|
}
|
|
529
1692
|
},
|
|
530
1693
|
placement,
|
|
531
|
-
middleware: [
|
|
532
|
-
whileElementsMounted:
|
|
1694
|
+
middleware: [offset2(offsetValue)],
|
|
1695
|
+
whileElementsMounted: autoUpdate2,
|
|
533
1696
|
strategy: "fixed"
|
|
534
1697
|
});
|
|
535
|
-
|
|
1698
|
+
useEffect8(() => {
|
|
536
1699
|
if (anchorRef?.current) {
|
|
537
1700
|
floating.refs.setReference(anchorRef.current);
|
|
538
1701
|
}
|
|
539
1702
|
}, [anchorRef, floating.refs]);
|
|
540
1703
|
const contentId = useFloatingId() ?? "";
|
|
541
1704
|
const panelId = `${contentId}-panel`;
|
|
542
|
-
const contextValue =
|
|
1705
|
+
const contextValue = useMemo4(
|
|
543
1706
|
() => ({
|
|
544
1707
|
isOpen,
|
|
545
1708
|
triggerRef,
|
|
@@ -551,16 +1714,16 @@ function Popover({
|
|
|
551
1714
|
}),
|
|
552
1715
|
[isOpen, triggerRef, anchorRef, floating, contentId, panelId, onClose]
|
|
553
1716
|
);
|
|
554
|
-
return /* @__PURE__ */
|
|
1717
|
+
return /* @__PURE__ */ jsx21(PopoverContext.Provider, { value: contextValue, children });
|
|
555
1718
|
}
|
|
556
1719
|
Popover.Trigger = PopoverTrigger;
|
|
557
1720
|
Popover.Content = PopoverContent;
|
|
558
1721
|
|
|
559
1722
|
// src/date-picker/date-picker-context.tsx
|
|
560
|
-
import { createContext as
|
|
561
|
-
var DatePickerCompoundContext =
|
|
1723
|
+
import { createContext as createContext6, useContext as useContext6 } from "react";
|
|
1724
|
+
var DatePickerCompoundContext = createContext6(null);
|
|
562
1725
|
var useDatePickerCompoundContext = (componentName) => {
|
|
563
|
-
const context =
|
|
1726
|
+
const context = useContext6(DatePickerCompoundContext);
|
|
564
1727
|
if (context == null) {
|
|
565
1728
|
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F DatePicker \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
566
1729
|
}
|
|
@@ -568,12 +1731,12 @@ var useDatePickerCompoundContext = (componentName) => {
|
|
|
568
1731
|
};
|
|
569
1732
|
|
|
570
1733
|
// src/date-picker/date-picker-day-button.tsx
|
|
571
|
-
import { focusVisible as
|
|
572
|
-
import { clsx as
|
|
1734
|
+
import { focusVisible as focusVisible5 } from "@zenkigen-inc/component-theme";
|
|
1735
|
+
import { clsx as clsx16 } from "clsx";
|
|
573
1736
|
import { DayButton } from "react-day-picker";
|
|
574
1737
|
|
|
575
1738
|
// src/date-picker/date-picker-styles.ts
|
|
576
|
-
import { clsx as
|
|
1739
|
+
import { clsx as clsx15 } from "clsx";
|
|
577
1740
|
import { getDefaultClassNames } from "react-day-picker";
|
|
578
1741
|
var defaultDayPickerClassNames = getDefaultClassNames();
|
|
579
1742
|
var DAY_PICKER_FONT_SIZE = "12px";
|
|
@@ -590,12 +1753,12 @@ var dayPickerStyle = {
|
|
|
590
1753
|
fontWeight: 700
|
|
591
1754
|
};
|
|
592
1755
|
var dayPickerClassNames = {
|
|
593
|
-
month:
|
|
1756
|
+
month: clsx15(defaultDayPickerClassNames.month, "flex flex-col px-[7px] py-2")
|
|
594
1757
|
};
|
|
595
1758
|
var dayButtonBaseClass = "relative grid size-full place-items-center rounded-full !border !border-solid";
|
|
596
1759
|
|
|
597
1760
|
// src/date-picker/date-picker-day-button.tsx
|
|
598
|
-
import { jsx as
|
|
1761
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
599
1762
|
var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) => {
|
|
600
1763
|
const isSelected = Boolean(modifiers.selected);
|
|
601
1764
|
const isOutside = Boolean(modifiers.outside);
|
|
@@ -603,19 +1766,19 @@ var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) =>
|
|
|
603
1766
|
const now = /* @__PURE__ */ new Date();
|
|
604
1767
|
const isToday = day.date.getFullYear() === now.getFullYear() && day.date.getMonth() === now.getMonth() && day.date.getDate() === now.getDate();
|
|
605
1768
|
const isDisabledDay = isMinMaxDisabled;
|
|
606
|
-
return /* @__PURE__ */
|
|
1769
|
+
return /* @__PURE__ */ jsx22(
|
|
607
1770
|
DayButton,
|
|
608
1771
|
{
|
|
609
1772
|
...buttonProps,
|
|
610
1773
|
day,
|
|
611
1774
|
modifiers,
|
|
612
1775
|
style: { ...style, fontSize: DAY_PICKER_FONT_SIZE },
|
|
613
|
-
className:
|
|
1776
|
+
className: clsx16(
|
|
614
1777
|
className,
|
|
615
1778
|
dayButtonBaseClass,
|
|
616
1779
|
// 共通: フォーカスリング(有効な日のみ)
|
|
617
1780
|
// react-day-picker の rdp-day_button クラスが outline: none を設定しているため、!important で上書き
|
|
618
|
-
!isDisabledDay &&
|
|
1781
|
+
!isDisabledDay && focusVisible5.normalImportant,
|
|
619
1782
|
// minDate/maxDate 制限日
|
|
620
1783
|
isMinMaxDisabled && "!cursor-not-allowed !border-transparent !text-disabled01",
|
|
621
1784
|
// 範囲外の日(前後月)
|
|
@@ -633,24 +1796,24 @@ var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) =>
|
|
|
633
1796
|
};
|
|
634
1797
|
|
|
635
1798
|
// src/date-picker/date-picker-error-message.tsx
|
|
636
|
-
import { clsx as
|
|
637
|
-
import { forwardRef as
|
|
638
|
-
import { jsx as
|
|
639
|
-
var DatePickerErrorMessage =
|
|
1799
|
+
import { clsx as clsx17 } from "clsx";
|
|
1800
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
1801
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1802
|
+
var DatePickerErrorMessage = forwardRef8(
|
|
640
1803
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
641
1804
|
const { size, isError } = useDatePickerCompoundContext("DatePicker.ErrorMessage");
|
|
642
1805
|
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
643
1806
|
if (isError !== true) {
|
|
644
1807
|
return null;
|
|
645
1808
|
}
|
|
646
|
-
const errorMessageClassName =
|
|
647
|
-
return /* @__PURE__ */
|
|
1809
|
+
const errorMessageClassName = clsx17(typographyClass, "text-supportError");
|
|
1810
|
+
return /* @__PURE__ */ jsx23("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
648
1811
|
}
|
|
649
1812
|
);
|
|
650
1813
|
DatePickerErrorMessage.displayName = "DatePicker.ErrorMessage";
|
|
651
1814
|
|
|
652
1815
|
// src/date-picker/date-picker-month-caption.tsx
|
|
653
|
-
import { clsx as
|
|
1816
|
+
import { clsx as clsx18 } from "clsx";
|
|
654
1817
|
import { useDayPicker } from "react-day-picker";
|
|
655
1818
|
|
|
656
1819
|
// src/date-picker/date-picker-utils.ts
|
|
@@ -716,19 +1879,19 @@ var formatMonthLabel = (date) => {
|
|
|
716
1879
|
};
|
|
717
1880
|
|
|
718
1881
|
// src/date-picker/date-picker-month-caption.tsx
|
|
719
|
-
import { jsx as
|
|
1882
|
+
import { jsx as jsx24, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
720
1883
|
var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...props }) => {
|
|
721
1884
|
void displayIndex;
|
|
722
1885
|
const { goToMonth, nextMonth, previousMonth } = useDayPicker();
|
|
723
1886
|
const captionMonth = calendarMonth.date;
|
|
724
|
-
return /* @__PURE__ */
|
|
1887
|
+
return /* @__PURE__ */ jsxs7(
|
|
725
1888
|
"div",
|
|
726
1889
|
{
|
|
727
|
-
className:
|
|
1890
|
+
className: clsx18("flex items-center justify-between px-1 pb-0.5", className),
|
|
728
1891
|
style: { ...style, fontSize: "inherit", fontWeight: "inherit" },
|
|
729
1892
|
...props,
|
|
730
1893
|
children: [
|
|
731
|
-
/* @__PURE__ */
|
|
1894
|
+
/* @__PURE__ */ jsx24(
|
|
732
1895
|
IconButton,
|
|
733
1896
|
{
|
|
734
1897
|
icon: "angle-left",
|
|
@@ -739,8 +1902,8 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
739
1902
|
onClick: () => previousMonth && goToMonth(previousMonth)
|
|
740
1903
|
}
|
|
741
1904
|
),
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
1905
|
+
/* @__PURE__ */ jsx24("span", { className: "typography-label12bold text-text02", children: formatMonthLabel(captionMonth) }),
|
|
1906
|
+
/* @__PURE__ */ jsx24(
|
|
744
1907
|
IconButton,
|
|
745
1908
|
{
|
|
746
1909
|
icon: "angle-right",
|
|
@@ -757,14 +1920,14 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
757
1920
|
};
|
|
758
1921
|
|
|
759
1922
|
// src/date-picker/date-picker-weekday.tsx
|
|
760
|
-
import { clsx as
|
|
761
|
-
import { jsx as
|
|
1923
|
+
import { clsx as clsx19 } from "clsx";
|
|
1924
|
+
import { jsx as jsx25 } from "react/jsx-runtime";
|
|
762
1925
|
var CustomWeekday = ({ className, children, style, ...props }) => {
|
|
763
|
-
return /* @__PURE__ */
|
|
1926
|
+
return /* @__PURE__ */ jsx25(
|
|
764
1927
|
"th",
|
|
765
1928
|
{
|
|
766
1929
|
...props,
|
|
767
|
-
className:
|
|
1930
|
+
className: clsx19(className, "m-0 size-7 p-0 text-center align-middle text-text02"),
|
|
768
1931
|
style: { ...style, fontSize: "inherit", fontWeight: "bold" },
|
|
769
1932
|
children
|
|
770
1933
|
}
|
|
@@ -772,7 +1935,7 @@ var CustomWeekday = ({ className, children, style, ...props }) => {
|
|
|
772
1935
|
};
|
|
773
1936
|
|
|
774
1937
|
// src/date-picker/date-picker.tsx
|
|
775
|
-
import { jsx as
|
|
1938
|
+
import { jsx as jsx26, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
776
1939
|
var DatePicker = ({
|
|
777
1940
|
value,
|
|
778
1941
|
onChange,
|
|
@@ -788,32 +1951,32 @@ var DatePicker = ({
|
|
|
788
1951
|
type,
|
|
789
1952
|
...restProps
|
|
790
1953
|
}) => {
|
|
791
|
-
const autoGeneratedId =
|
|
1954
|
+
const autoGeneratedId = useId3();
|
|
792
1955
|
const describedByBaseId = restProps.id ?? autoGeneratedId;
|
|
793
|
-
const [isOpen, setIsOpen] =
|
|
794
|
-
const [displayMonth, setDisplayMonth] =
|
|
1956
|
+
const [isOpen, setIsOpen] = useState4(false);
|
|
1957
|
+
const [displayMonth, setDisplayMonth] = useState4(() => {
|
|
795
1958
|
if (value == null) {
|
|
796
1959
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
797
1960
|
return createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`);
|
|
798
1961
|
}
|
|
799
1962
|
return getMonthStartDate(value, timeZone);
|
|
800
1963
|
});
|
|
801
|
-
const calendarRef =
|
|
802
|
-
const selectedKey =
|
|
803
|
-
const selectedDate =
|
|
1964
|
+
const calendarRef = useRef8(null);
|
|
1965
|
+
const selectedKey = useMemo5(() => value == null ? null : formatDateKey(value, timeZone), [value, timeZone]);
|
|
1966
|
+
const selectedDate = useMemo5(() => {
|
|
804
1967
|
if (selectedKey == null) {
|
|
805
1968
|
return;
|
|
806
1969
|
}
|
|
807
1970
|
return createLocalDateFromKey(selectedKey);
|
|
808
1971
|
}, [selectedKey]);
|
|
809
|
-
const minKey =
|
|
810
|
-
const maxKey =
|
|
811
|
-
const currentMonthKey =
|
|
812
|
-
const isOutsideMonth =
|
|
1972
|
+
const minKey = useMemo5(() => minDate == null ? null : formatDateKey(minDate, timeZone), [minDate, timeZone]);
|
|
1973
|
+
const maxKey = useMemo5(() => maxDate == null ? null : formatDateKey(maxDate, timeZone), [maxDate, timeZone]);
|
|
1974
|
+
const currentMonthKey = useMemo5(() => formatLocalDateKey(displayMonth).slice(0, 7), [displayMonth]);
|
|
1975
|
+
const isOutsideMonth = useCallback7(
|
|
813
1976
|
(date) => formatLocalDateKey(date).slice(0, 7) !== currentMonthKey,
|
|
814
1977
|
[currentMonthKey]
|
|
815
1978
|
);
|
|
816
|
-
const isMinMaxDisabled =
|
|
1979
|
+
const isMinMaxDisabled = useCallback7(
|
|
817
1980
|
(date) => {
|
|
818
1981
|
const dateKey = formatLocalDateKey(date);
|
|
819
1982
|
if (minKey != null && dateKey < minKey) {
|
|
@@ -826,7 +1989,7 @@ var DatePicker = ({
|
|
|
826
1989
|
},
|
|
827
1990
|
[maxKey, minKey]
|
|
828
1991
|
);
|
|
829
|
-
const disabledDays =
|
|
1992
|
+
const disabledDays = useCallback7(
|
|
830
1993
|
(date) => {
|
|
831
1994
|
if (isOutsideMonth(date)) {
|
|
832
1995
|
return true;
|
|
@@ -835,8 +1998,8 @@ var DatePicker = ({
|
|
|
835
1998
|
},
|
|
836
1999
|
[isOutsideMonth, isMinMaxDisabled]
|
|
837
2000
|
);
|
|
838
|
-
const todayForCalendar =
|
|
839
|
-
|
|
2001
|
+
const todayForCalendar = useMemo5(() => createLocalDateFromKey(formatLocalDateKey()), []);
|
|
2002
|
+
useEffect9(() => {
|
|
840
2003
|
if (value == null) {
|
|
841
2004
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
842
2005
|
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
@@ -844,7 +2007,7 @@ var DatePicker = ({
|
|
|
844
2007
|
}
|
|
845
2008
|
setDisplayMonth(getMonthStartDate(value, timeZone));
|
|
846
2009
|
}, [value, timeZone]);
|
|
847
|
-
|
|
2010
|
+
useEffect9(() => {
|
|
848
2011
|
if (!isOpen) {
|
|
849
2012
|
return;
|
|
850
2013
|
}
|
|
@@ -860,7 +2023,7 @@ var DatePicker = ({
|
|
|
860
2023
|
});
|
|
861
2024
|
return () => cancelAnimationFrame(frame);
|
|
862
2025
|
}, [displayMonth, isOpen, value]);
|
|
863
|
-
|
|
2026
|
+
useEffect9(() => {
|
|
864
2027
|
if (isDisabled) {
|
|
865
2028
|
setIsOpen(false);
|
|
866
2029
|
}
|
|
@@ -891,7 +2054,7 @@ var DatePicker = ({
|
|
|
891
2054
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
892
2055
|
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
893
2056
|
};
|
|
894
|
-
const formatters =
|
|
2057
|
+
const formatters = useMemo5(() => {
|
|
895
2058
|
const weekdayFormatter = new Intl.DateTimeFormat("ja-JP", { weekday: "short" });
|
|
896
2059
|
return {
|
|
897
2060
|
formatCaption: (date) => formatMonthLabel(date),
|
|
@@ -903,15 +2066,15 @@ var DatePicker = ({
|
|
|
903
2066
|
const displayText = value ? formatDisplayDate(value, timeZone) : placeholder;
|
|
904
2067
|
const displayTextClasses = "min-w-0 truncate";
|
|
905
2068
|
const errorIds = [];
|
|
906
|
-
const enhancedChildren =
|
|
907
|
-
if (!
|
|
2069
|
+
const enhancedChildren = Children4.map(children, (child) => {
|
|
2070
|
+
if (!isValidElement4(child)) {
|
|
908
2071
|
return child;
|
|
909
2072
|
}
|
|
910
2073
|
if (child.type === DatePickerErrorMessage && isError) {
|
|
911
2074
|
const errorChild = child;
|
|
912
2075
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
913
2076
|
errorIds.push(assignedId);
|
|
914
|
-
return
|
|
2077
|
+
return cloneElement4(errorChild, { id: assignedId });
|
|
915
2078
|
}
|
|
916
2079
|
return child;
|
|
917
2080
|
});
|
|
@@ -931,15 +2094,15 @@ var DatePicker = ({
|
|
|
931
2094
|
...describedByProps,
|
|
932
2095
|
...ariaInvalidProps
|
|
933
2096
|
};
|
|
934
|
-
const contextValue =
|
|
2097
|
+
const contextValue = useMemo5(
|
|
935
2098
|
() => ({
|
|
936
2099
|
size,
|
|
937
2100
|
isError
|
|
938
2101
|
}),
|
|
939
2102
|
[isError, size]
|
|
940
2103
|
);
|
|
941
|
-
const popoverContent = /* @__PURE__ */
|
|
942
|
-
/* @__PURE__ */
|
|
2104
|
+
const popoverContent = /* @__PURE__ */ jsxs8(Popover, { isOpen, placement: "bottom-start", onClose: handleClose, children: [
|
|
2105
|
+
/* @__PURE__ */ jsx26(Popover.Trigger, { children: /* @__PURE__ */ jsx26(
|
|
943
2106
|
InternalButton,
|
|
944
2107
|
{
|
|
945
2108
|
...mergedButtonProps,
|
|
@@ -947,14 +2110,14 @@ var DatePicker = ({
|
|
|
947
2110
|
size,
|
|
948
2111
|
variant: isError ? "outlineDanger" : "outline",
|
|
949
2112
|
isDisabled,
|
|
950
|
-
before: /* @__PURE__ */
|
|
2113
|
+
before: /* @__PURE__ */ jsx26(Icon, { name: "calendar", size: iconSize }),
|
|
951
2114
|
justifyContent: "start",
|
|
952
2115
|
onClick: handleTriggerClick,
|
|
953
|
-
children: /* @__PURE__ */
|
|
2116
|
+
children: /* @__PURE__ */ jsx26("span", { className: displayTextClasses, children: displayText })
|
|
954
2117
|
}
|
|
955
2118
|
) }),
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsx26(Popover.Content, { children: /* @__PURE__ */ jsxs8("div", { ref: calendarRef, className: "rounded bg-uiBackground01 shadow-floatingShadow", "aria-label": "\u65E5\u4ED8\u9078\u629E", children: [
|
|
2120
|
+
/* @__PURE__ */ jsx26(
|
|
958
2121
|
DayPicker,
|
|
959
2122
|
{
|
|
960
2123
|
mode: "single",
|
|
@@ -975,8 +2138,8 @@ var DatePicker = ({
|
|
|
975
2138
|
components: { MonthCaption: CustomMonthCaption, DayButton: CustomDayButton, Weekday: CustomWeekday }
|
|
976
2139
|
}
|
|
977
2140
|
),
|
|
978
|
-
/* @__PURE__ */
|
|
979
|
-
/* @__PURE__ */
|
|
2141
|
+
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between border-t border-uiBorder01 px-2 py-1", children: [
|
|
2142
|
+
/* @__PURE__ */ jsx26(
|
|
980
2143
|
IconButton,
|
|
981
2144
|
{
|
|
982
2145
|
icon: "calendar-today",
|
|
@@ -987,16 +2150,16 @@ var DatePicker = ({
|
|
|
987
2150
|
onClick: handleClickToday
|
|
988
2151
|
}
|
|
989
2152
|
),
|
|
990
|
-
/* @__PURE__ */
|
|
2153
|
+
/* @__PURE__ */ jsx26(Button, { type: "button", size: "small", variant: "text", onClick: handleClear, children: "\u30AF\u30EA\u30A2" })
|
|
991
2154
|
] })
|
|
992
2155
|
] }) })
|
|
993
2156
|
] });
|
|
994
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
2157
|
+
const stackedChildren = enhancedChildren == null ? [] : Children4.toArray(enhancedChildren);
|
|
995
2158
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
996
2159
|
if (!hasMessageChildren) {
|
|
997
|
-
return /* @__PURE__ */
|
|
2160
|
+
return /* @__PURE__ */ jsx26(DatePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx26("div", { className: "flex flex-col", children: popoverContent }) });
|
|
998
2161
|
}
|
|
999
|
-
return /* @__PURE__ */
|
|
2162
|
+
return /* @__PURE__ */ jsx26(DatePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-2", children: [
|
|
1000
2163
|
popoverContent,
|
|
1001
2164
|
stackedChildren
|
|
1002
2165
|
] }) });
|
|
@@ -1005,75 +2168,56 @@ DatePicker.ErrorMessage = DatePickerErrorMessage;
|
|
|
1005
2168
|
DatePicker.displayName = "DatePicker";
|
|
1006
2169
|
|
|
1007
2170
|
// src/divider/divider.tsx
|
|
1008
|
-
import { jsx as
|
|
2171
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1009
2172
|
function Divider() {
|
|
1010
|
-
return /* @__PURE__ */
|
|
2173
|
+
return /* @__PURE__ */ jsx27("hr", { className: "h-px w-full border-0 bg-uiBorder01" });
|
|
1011
2174
|
}
|
|
1012
2175
|
|
|
1013
2176
|
// src/dropdown/dropdown.tsx
|
|
1014
|
-
import { buttonColors as buttonColors3, focusVisible as
|
|
1015
|
-
import
|
|
1016
|
-
import { useCallback as
|
|
2177
|
+
import { buttonColors as buttonColors3, focusVisible as focusVisible7 } from "@zenkigen-inc/component-theme";
|
|
2178
|
+
import clsx22 from "clsx";
|
|
2179
|
+
import { useCallback as useCallback8, useRef as useRef9, useState as useState5 } from "react";
|
|
1017
2180
|
import { createPortal } from "react-dom";
|
|
1018
2181
|
|
|
1019
|
-
// src/hooks/use-outside-click.ts
|
|
1020
|
-
import { useEffect as useEffect5 } from "react";
|
|
1021
|
-
var useOutsideClick = (ref, handler, enabled = true) => {
|
|
1022
|
-
useEffect5(() => {
|
|
1023
|
-
const listener = (event) => {
|
|
1024
|
-
const element = ref?.current;
|
|
1025
|
-
const target = event.target;
|
|
1026
|
-
if (target instanceof Node && target.isConnected === false) {
|
|
1027
|
-
return;
|
|
1028
|
-
}
|
|
1029
|
-
if (element == null || Boolean(element.contains(target ?? null))) {
|
|
1030
|
-
return;
|
|
1031
|
-
}
|
|
1032
|
-
handler(event);
|
|
1033
|
-
};
|
|
1034
|
-
if (enabled) {
|
|
1035
|
-
document.addEventListener("click", listener);
|
|
1036
|
-
}
|
|
1037
|
-
return () => document.removeEventListener("click", listener);
|
|
1038
|
-
}, [ref, enabled, handler]);
|
|
1039
|
-
};
|
|
1040
|
-
|
|
1041
2182
|
// src/dropdown/dropdown-context.ts
|
|
1042
|
-
import { createContext as
|
|
1043
|
-
var DropdownContext =
|
|
2183
|
+
import { createContext as createContext7 } from "react";
|
|
2184
|
+
var DropdownContext = createContext7({
|
|
1044
2185
|
isVisible: false,
|
|
1045
2186
|
setIsVisible: () => false,
|
|
1046
2187
|
isDisabled: false,
|
|
1047
2188
|
targetDimensions: { width: 0, height: 0 },
|
|
1048
|
-
variant: "outline"
|
|
2189
|
+
variant: "outline",
|
|
2190
|
+
size: "medium"
|
|
1049
2191
|
});
|
|
1050
2192
|
|
|
1051
2193
|
// src/dropdown/dropdown-item.tsx
|
|
1052
|
-
import { focusVisible as
|
|
1053
|
-
import
|
|
1054
|
-
import { useContext as
|
|
1055
|
-
import { jsx as
|
|
2194
|
+
import { focusVisible as focusVisible6 } from "@zenkigen-inc/component-theme";
|
|
2195
|
+
import clsx20 from "clsx";
|
|
2196
|
+
import { useContext as useContext7 } from "react";
|
|
2197
|
+
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
1056
2198
|
function DropdownItem({ children, color = "gray", onClick }) {
|
|
1057
|
-
const { setIsVisible } =
|
|
2199
|
+
const { setIsVisible, size } = useContext7(DropdownContext);
|
|
1058
2200
|
const handleClickItem = (event) => {
|
|
1059
2201
|
setIsVisible(false);
|
|
1060
2202
|
onClick?.(event);
|
|
1061
2203
|
};
|
|
1062
|
-
const itemClasses =
|
|
1063
|
-
"typography-label14regular flex
|
|
1064
|
-
|
|
2204
|
+
const itemClasses = clsx20(
|
|
2205
|
+
"typography-label14regular flex w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
2206
|
+
focusVisible6.inset,
|
|
1065
2207
|
{
|
|
2208
|
+
"h-8": size !== "large",
|
|
2209
|
+
"h-10": size === "large",
|
|
1066
2210
|
"bg-uiBackground01 fill-icon01 text-interactive02": color === "gray",
|
|
1067
2211
|
"fill-supportDanger text-supportDanger": color === "red"
|
|
1068
2212
|
}
|
|
1069
2213
|
);
|
|
1070
|
-
return /* @__PURE__ */
|
|
2214
|
+
return /* @__PURE__ */ jsx28("li", { className: "flex w-full items-center", children: /* @__PURE__ */ jsx28("button", { className: itemClasses, type: "button", onClick: handleClickItem, children }) });
|
|
1071
2215
|
}
|
|
1072
2216
|
|
|
1073
2217
|
// src/dropdown/dropdown-menu.tsx
|
|
1074
|
-
import
|
|
1075
|
-
import { useContext as
|
|
1076
|
-
import { jsx as
|
|
2218
|
+
import clsx21 from "clsx";
|
|
2219
|
+
import { useContext as useContext8 } from "react";
|
|
2220
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
1077
2221
|
function DropdownMenu({
|
|
1078
2222
|
children,
|
|
1079
2223
|
maxHeight,
|
|
@@ -1081,8 +2225,8 @@ function DropdownMenu({
|
|
|
1081
2225
|
verticalPosition = "bottom",
|
|
1082
2226
|
horizontalAlign = "left"
|
|
1083
2227
|
}) {
|
|
1084
|
-
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } =
|
|
1085
|
-
const wrapperClasses =
|
|
2228
|
+
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } = useContext8(DropdownContext);
|
|
2229
|
+
const wrapperClasses = clsx21("z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 shadow-floatingShadow", {
|
|
1086
2230
|
absolute: !portalTargetRef,
|
|
1087
2231
|
"border-solid border border-uiBorder01": variant === "outline",
|
|
1088
2232
|
"py-1": !isNoPadding,
|
|
@@ -1090,7 +2234,7 @@ function DropdownMenu({
|
|
|
1090
2234
|
"right-0": horizontalAlign === "right",
|
|
1091
2235
|
"left-auto": horizontalAlign === "center"
|
|
1092
2236
|
});
|
|
1093
|
-
return isVisible && !isDisabled && /* @__PURE__ */
|
|
2237
|
+
return isVisible && !isDisabled && /* @__PURE__ */ jsx29(
|
|
1094
2238
|
"ul",
|
|
1095
2239
|
{
|
|
1096
2240
|
className: wrapperClasses,
|
|
@@ -1105,7 +2249,7 @@ function DropdownMenu({
|
|
|
1105
2249
|
}
|
|
1106
2250
|
|
|
1107
2251
|
// src/dropdown/dropdown.tsx
|
|
1108
|
-
import { jsx as
|
|
2252
|
+
import { jsx as jsx30, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1109
2253
|
function Dropdown({
|
|
1110
2254
|
children,
|
|
1111
2255
|
target,
|
|
@@ -1118,19 +2262,19 @@ function Dropdown({
|
|
|
1118
2262
|
isArrowHidden = false,
|
|
1119
2263
|
portalTargetRef
|
|
1120
2264
|
}) {
|
|
1121
|
-
const [isVisible, setIsVisible] =
|
|
1122
|
-
const [targetDimensions, setTargetDimensions] =
|
|
2265
|
+
const [isVisible, setIsVisible] = useState5(false);
|
|
2266
|
+
const [targetDimensions, setTargetDimensions] = useState5({
|
|
1123
2267
|
width: 0,
|
|
1124
2268
|
height: 0
|
|
1125
2269
|
});
|
|
1126
|
-
const targetRef =
|
|
2270
|
+
const targetRef = useRef9(null);
|
|
1127
2271
|
useOutsideClick(targetRef, () => setIsVisible(false));
|
|
1128
2272
|
useDismissOnModalOpen(() => {
|
|
1129
2273
|
if (isVisible) {
|
|
1130
2274
|
setIsVisible(false);
|
|
1131
2275
|
}
|
|
1132
2276
|
});
|
|
1133
|
-
const handleToggle =
|
|
2277
|
+
const handleToggle = useCallback8(() => {
|
|
1134
2278
|
if (targetRef.current === null) {
|
|
1135
2279
|
return;
|
|
1136
2280
|
}
|
|
@@ -1146,24 +2290,24 @@ function Dropdown({
|
|
|
1146
2290
|
setIsVisible(true);
|
|
1147
2291
|
}
|
|
1148
2292
|
}, [isVisible]);
|
|
1149
|
-
const wrapperClasses =
|
|
2293
|
+
const wrapperClasses = clsx22("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1150
2294
|
"cursor-not-allowed": isDisabled
|
|
1151
2295
|
});
|
|
1152
|
-
const childrenButtonClasses =
|
|
2296
|
+
const childrenButtonClasses = clsx22(
|
|
1153
2297
|
"flex items-center justify-center rounded bg-uiBackground01 p-1 hover:bg-hover02 active:bg-active02",
|
|
1154
|
-
|
|
2298
|
+
focusVisible7.normal,
|
|
1155
2299
|
{
|
|
1156
2300
|
"pointer-events-none": isDisabled,
|
|
1157
2301
|
"border border-uiBorder02": variant === "outline"
|
|
1158
2302
|
}
|
|
1159
2303
|
);
|
|
1160
|
-
const buttonClasses =
|
|
2304
|
+
const buttonClasses = clsx22(
|
|
1161
2305
|
"flex items-center rounded bg-uiBackground01",
|
|
1162
2306
|
buttonColors3[variant].base,
|
|
1163
2307
|
buttonColors3[variant].hover,
|
|
1164
2308
|
buttonColors3[variant].active,
|
|
1165
2309
|
buttonColors3[variant].disabled,
|
|
1166
|
-
|
|
2310
|
+
focusVisible7.normal,
|
|
1167
2311
|
{
|
|
1168
2312
|
"pointer-events-none": isDisabled,
|
|
1169
2313
|
"h-6 px-2": size === "x-small" || size === "small",
|
|
@@ -1171,19 +2315,19 @@ function Dropdown({
|
|
|
1171
2315
|
"h-10 px-4": size === "large"
|
|
1172
2316
|
}
|
|
1173
2317
|
);
|
|
1174
|
-
const labelClasses =
|
|
2318
|
+
const labelClasses = clsx22("flex items-center", {
|
|
1175
2319
|
"mr-1": !isArrowHidden && size === "x-small",
|
|
1176
2320
|
"mr-2": !isArrowHidden && size !== "x-small",
|
|
1177
2321
|
"typography-label12regular": size === "x-small",
|
|
1178
2322
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1179
2323
|
"typography-label16regular": size === "large"
|
|
1180
2324
|
});
|
|
1181
|
-
return /* @__PURE__ */
|
|
2325
|
+
return /* @__PURE__ */ jsx30(
|
|
1182
2326
|
DropdownContext.Provider,
|
|
1183
2327
|
{
|
|
1184
|
-
value: { isVisible, setIsVisible, isDisabled, targetDimensions, variant, portalTargetRef },
|
|
1185
|
-
children: /* @__PURE__ */
|
|
1186
|
-
target ? /* @__PURE__ */
|
|
2328
|
+
value: { isVisible, setIsVisible, isDisabled, targetDimensions, variant, size, portalTargetRef },
|
|
2329
|
+
children: /* @__PURE__ */ jsxs9("div", { ref: targetRef, className: wrapperClasses, children: [
|
|
2330
|
+
target ? /* @__PURE__ */ jsxs9(
|
|
1187
2331
|
"button",
|
|
1188
2332
|
{
|
|
1189
2333
|
type: "button",
|
|
@@ -1193,7 +2337,7 @@ function Dropdown({
|
|
|
1193
2337
|
disabled: isDisabled,
|
|
1194
2338
|
children: [
|
|
1195
2339
|
target,
|
|
1196
|
-
!isArrowHidden && /* @__PURE__ */
|
|
2340
|
+
!isArrowHidden && /* @__PURE__ */ jsx30("div", { className: "ml-2 flex items-center fill-icon01", children: /* @__PURE__ */ jsx30(
|
|
1197
2341
|
Icon,
|
|
1198
2342
|
{
|
|
1199
2343
|
name: isVisible ? "angle-small-up" : "angle-small-down",
|
|
@@ -1202,10 +2346,10 @@ function Dropdown({
|
|
|
1202
2346
|
) })
|
|
1203
2347
|
]
|
|
1204
2348
|
}
|
|
1205
|
-
) : /* @__PURE__ */
|
|
1206
|
-
icon && /* @__PURE__ */
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
!isArrowHidden && /* @__PURE__ */
|
|
2349
|
+
) : /* @__PURE__ */ jsxs9("button", { type: "button", title, className: buttonClasses, onClick: handleToggle, disabled: isDisabled, children: [
|
|
2350
|
+
icon && /* @__PURE__ */ jsx30("span", { className: "mr-1 flex", children: /* @__PURE__ */ jsx30(Icon, { name: icon, size: size === "large" ? "medium" : "small" }) }),
|
|
2351
|
+
/* @__PURE__ */ jsx30("span", { className: labelClasses, children: label }),
|
|
2352
|
+
!isArrowHidden && /* @__PURE__ */ jsx30("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx30(Icon, { name: isVisible ? "angle-small-up" : "angle-small-down", size: "small" }) })
|
|
1209
2353
|
] }),
|
|
1210
2354
|
!portalTargetRef ? children : portalTargetRef != null && portalTargetRef.current && createPortal(children, portalTargetRef.current)
|
|
1211
2355
|
] })
|
|
@@ -1217,14 +2361,14 @@ Dropdown.Item = DropdownItem;
|
|
|
1217
2361
|
|
|
1218
2362
|
// src/evaluation-star/evaluation-star.tsx
|
|
1219
2363
|
import { iconElements as iconElements2 } from "@zenkigen-inc/component-icons";
|
|
1220
|
-
import { focusVisible as
|
|
1221
|
-
import
|
|
1222
|
-
import { useCallback as
|
|
1223
|
-
import { jsx as
|
|
2364
|
+
import { focusVisible as focusVisible8 } from "@zenkigen-inc/component-theme";
|
|
2365
|
+
import clsx23 from "clsx";
|
|
2366
|
+
import { useCallback as useCallback9, useState as useState6 } from "react";
|
|
2367
|
+
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1224
2368
|
function EvaluationStar({ value, isEditable = false, onChangeRating, size = "medium" }) {
|
|
1225
2369
|
const maxRating = 5;
|
|
1226
|
-
const [currentRating, setCurrentRating] =
|
|
1227
|
-
const handleChangeRating =
|
|
2370
|
+
const [currentRating, setCurrentRating] = useState6(value);
|
|
2371
|
+
const handleChangeRating = useCallback9(
|
|
1228
2372
|
(newRating) => {
|
|
1229
2373
|
if (isEditable) {
|
|
1230
2374
|
setCurrentRating(newRating);
|
|
@@ -1235,30 +2379,30 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
1235
2379
|
},
|
|
1236
2380
|
[isEditable, onChangeRating]
|
|
1237
2381
|
);
|
|
1238
|
-
const starClasses =
|
|
2382
|
+
const starClasses = clsx23(focusVisible8.inset, { "w-6 h-6": size === "large", "w-4 h-4": size === "medium" });
|
|
1239
2383
|
const renderStar = (rating) => {
|
|
1240
2384
|
const color = rating <= currentRating ? "fill-yellow-yellow50" : "fill-icon03";
|
|
1241
2385
|
const IconComponent = iconElements2["star-filled"];
|
|
1242
|
-
return /* @__PURE__ */
|
|
2386
|
+
return /* @__PURE__ */ jsx31(
|
|
1243
2387
|
"button",
|
|
1244
2388
|
{
|
|
1245
2389
|
type: "button",
|
|
1246
2390
|
onClick: () => handleChangeRating(rating),
|
|
1247
|
-
className:
|
|
2391
|
+
className: clsx23(color, starClasses),
|
|
1248
2392
|
disabled: !isEditable,
|
|
1249
|
-
children: /* @__PURE__ */
|
|
2393
|
+
children: /* @__PURE__ */ jsx31(IconComponent, {})
|
|
1250
2394
|
},
|
|
1251
2395
|
rating
|
|
1252
2396
|
);
|
|
1253
2397
|
};
|
|
1254
2398
|
const ratingStars = Array.from({ length: maxRating }, (_, index) => renderStar(index + 1));
|
|
1255
|
-
return /* @__PURE__ */
|
|
2399
|
+
return /* @__PURE__ */ jsx31("span", { className: "flex flex-row", children: ratingStars });
|
|
1256
2400
|
}
|
|
1257
2401
|
|
|
1258
2402
|
// src/file-input/file-input.tsx
|
|
1259
|
-
import { clsx as
|
|
1260
|
-
import { forwardRef as
|
|
1261
|
-
import { Fragment as
|
|
2403
|
+
import { clsx as clsx24 } from "clsx";
|
|
2404
|
+
import { forwardRef as forwardRef9, useCallback as useCallback10, useId as useId4, useImperativeHandle, useRef as useRef10, useState as useState7 } from "react";
|
|
2405
|
+
import { Fragment as Fragment3, jsx as jsx32, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1262
2406
|
var ERROR_TYPES = {
|
|
1263
2407
|
SIZE_TOO_LARGE: "SIZE_TOO_LARGE",
|
|
1264
2408
|
UNSUPPORTED_FORMAT: "UNSUPPORTED_FORMAT"
|
|
@@ -1267,16 +2411,16 @@ var ERROR_MESSAGES = {
|
|
|
1267
2411
|
SIZE_TOO_LARGE: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u307E\u3059\u3002",
|
|
1268
2412
|
UNSUPPORTED_FORMAT: "\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002"
|
|
1269
2413
|
};
|
|
1270
|
-
var FileInput =
|
|
2414
|
+
var FileInput = forwardRef9(
|
|
1271
2415
|
({ id, variant, accept, maxSize, isDisabled = false, isError = false, onSelect, onError, errorMessages, ...rest }, ref) => {
|
|
1272
2416
|
const size = variant === "button" ? rest.size ?? "medium" : "medium";
|
|
1273
|
-
const [selectedFile, setSelectedFile] =
|
|
1274
|
-
const [isDragOver, setIsDragOver] =
|
|
1275
|
-
const fileInputRef =
|
|
1276
|
-
const errorId =
|
|
1277
|
-
const fallbackId =
|
|
2417
|
+
const [selectedFile, setSelectedFile] = useState7(null);
|
|
2418
|
+
const [isDragOver, setIsDragOver] = useState7(false);
|
|
2419
|
+
const fileInputRef = useRef10(null);
|
|
2420
|
+
const errorId = useId4();
|
|
2421
|
+
const fallbackId = useId4();
|
|
1278
2422
|
const inputId = id ?? fallbackId;
|
|
1279
|
-
const validateFile =
|
|
2423
|
+
const validateFile = useCallback10(
|
|
1280
2424
|
(file) => {
|
|
1281
2425
|
const errors = [];
|
|
1282
2426
|
if (maxSize != null && maxSize > 0 && file.size > maxSize) {
|
|
@@ -1315,7 +2459,7 @@ var FileInput = forwardRef4(
|
|
|
1315
2459
|
},
|
|
1316
2460
|
[accept, maxSize, onError]
|
|
1317
2461
|
);
|
|
1318
|
-
const handleFileSelect =
|
|
2462
|
+
const handleFileSelect = useCallback10(
|
|
1319
2463
|
(file) => {
|
|
1320
2464
|
if (file && !validateFile(file)) {
|
|
1321
2465
|
return;
|
|
@@ -1325,7 +2469,7 @@ var FileInput = forwardRef4(
|
|
|
1325
2469
|
},
|
|
1326
2470
|
[validateFile, onSelect]
|
|
1327
2471
|
);
|
|
1328
|
-
const handleFileInputChange =
|
|
2472
|
+
const handleFileInputChange = useCallback10(
|
|
1329
2473
|
(event) => {
|
|
1330
2474
|
if (isDisabled) {
|
|
1331
2475
|
return;
|
|
@@ -1341,7 +2485,7 @@ var FileInput = forwardRef4(
|
|
|
1341
2485
|
},
|
|
1342
2486
|
[isDisabled, handleFileSelect]
|
|
1343
2487
|
);
|
|
1344
|
-
const handleDragOver =
|
|
2488
|
+
const handleDragOver = useCallback10(
|
|
1345
2489
|
(event) => {
|
|
1346
2490
|
event.preventDefault();
|
|
1347
2491
|
if (!isDisabled) {
|
|
@@ -1350,11 +2494,11 @@ var FileInput = forwardRef4(
|
|
|
1350
2494
|
},
|
|
1351
2495
|
[isDisabled]
|
|
1352
2496
|
);
|
|
1353
|
-
const handleDragLeave =
|
|
2497
|
+
const handleDragLeave = useCallback10((event) => {
|
|
1354
2498
|
event.preventDefault();
|
|
1355
2499
|
setIsDragOver(false);
|
|
1356
2500
|
}, []);
|
|
1357
|
-
const handleDrop =
|
|
2501
|
+
const handleDrop = useCallback10(
|
|
1358
2502
|
(event) => {
|
|
1359
2503
|
event.preventDefault();
|
|
1360
2504
|
setIsDragOver(false);
|
|
@@ -1366,12 +2510,12 @@ var FileInput = forwardRef4(
|
|
|
1366
2510
|
},
|
|
1367
2511
|
[isDisabled, handleFileSelect]
|
|
1368
2512
|
);
|
|
1369
|
-
const handleButtonClick =
|
|
2513
|
+
const handleButtonClick = useCallback10(() => {
|
|
1370
2514
|
if (!isDisabled) {
|
|
1371
2515
|
fileInputRef.current?.click();
|
|
1372
2516
|
}
|
|
1373
2517
|
}, [isDisabled]);
|
|
1374
|
-
const handleClear =
|
|
2518
|
+
const handleClear = useCallback10(() => {
|
|
1375
2519
|
setSelectedFile(null);
|
|
1376
2520
|
if (fileInputRef.current) {
|
|
1377
2521
|
fileInputRef.current.value = "";
|
|
@@ -1387,7 +2531,7 @@ var FileInput = forwardRef4(
|
|
|
1387
2531
|
);
|
|
1388
2532
|
const hasErrorMessages = !isDisabled && errorMessages != null && errorMessages.length > 0;
|
|
1389
2533
|
const hasErrors = !isDisabled && isError === true;
|
|
1390
|
-
const dropzoneClasses =
|
|
2534
|
+
const dropzoneClasses = clsx24(
|
|
1391
2535
|
"flex flex-1 flex-col items-center justify-center gap-4 rounded border border-dashed px-6 text-center",
|
|
1392
2536
|
selectedFile ? "py-[52px]" : "py-4",
|
|
1393
2537
|
{
|
|
@@ -1434,8 +2578,8 @@ var FileInput = forwardRef4(
|
|
|
1434
2578
|
return normalized.join(", ");
|
|
1435
2579
|
})();
|
|
1436
2580
|
if (variant === "button") {
|
|
1437
|
-
return /* @__PURE__ */
|
|
1438
|
-
/* @__PURE__ */
|
|
2581
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2582
|
+
/* @__PURE__ */ jsx32("div", { className: hasErrors ? "flex-1" : "min-w-0 flex-1", children: /* @__PURE__ */ jsx32(
|
|
1439
2583
|
InternalButton,
|
|
1440
2584
|
{
|
|
1441
2585
|
size,
|
|
@@ -1443,14 +2587,14 @@ var FileInput = forwardRef4(
|
|
|
1443
2587
|
isDisabled,
|
|
1444
2588
|
width: "100%",
|
|
1445
2589
|
onClick: handleButtonClick,
|
|
1446
|
-
before: /* @__PURE__ */
|
|
1447
|
-
after: /* @__PURE__ */
|
|
1448
|
-
children: /* @__PURE__ */
|
|
2590
|
+
before: /* @__PURE__ */ jsx32(Icon, { name: "upload", size: "small" }),
|
|
2591
|
+
after: /* @__PURE__ */ jsx32(Fragment3, { children: selectedFile ? /* @__PURE__ */ jsx32("span", { className: clsx24("typography-label12regular truncate", !isDisabled && "text-text01"), children: selectedFile.name }) : "" }),
|
|
2592
|
+
children: /* @__PURE__ */ jsx32("span", { className: "truncate", children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" })
|
|
1449
2593
|
}
|
|
1450
2594
|
) }),
|
|
1451
|
-
selectedFile && !isDisabled && /* @__PURE__ */
|
|
1452
|
-
hasErrors && hasErrorMessages && /* @__PURE__ */
|
|
1453
|
-
/* @__PURE__ */
|
|
2595
|
+
selectedFile && !isDisabled && /* @__PURE__ */ jsx32("div", { className: "shrink-0", children: /* @__PURE__ */ jsx32(IconButton, { variant: "text", icon: "close", size: "small", onClick: handleClear }) }),
|
|
2596
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ jsx32("div", { id: errorId, "data-testid": "error-messages", className: "typography-label12regular text-supportError", children: errorMessages.map((message, index) => /* @__PURE__ */ jsx32("div", { className: "break-all", children: message }, index)) }),
|
|
2597
|
+
/* @__PURE__ */ jsx32(
|
|
1454
2598
|
"input",
|
|
1455
2599
|
{
|
|
1456
2600
|
id: inputId,
|
|
@@ -1465,8 +2609,8 @@ var FileInput = forwardRef4(
|
|
|
1465
2609
|
)
|
|
1466
2610
|
] });
|
|
1467
2611
|
}
|
|
1468
|
-
return /* @__PURE__ */
|
|
1469
|
-
/* @__PURE__ */
|
|
2612
|
+
return /* @__PURE__ */ jsxs10("div", { className: "flex min-w-[320px] flex-col gap-2", children: [
|
|
2613
|
+
/* @__PURE__ */ jsxs10(
|
|
1470
2614
|
"div",
|
|
1471
2615
|
{
|
|
1472
2616
|
className: dropzoneClasses,
|
|
@@ -1486,25 +2630,25 @@ var FileInput = forwardRef4(
|
|
|
1486
2630
|
"aria-disabled": isDisabled,
|
|
1487
2631
|
...hasErrors && hasErrorMessages && { "aria-describedby": errorId },
|
|
1488
2632
|
children: [
|
|
1489
|
-
/* @__PURE__ */
|
|
1490
|
-
!selectedFile && /* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ jsx32(Icon, { name: "upload-document", size: "large", color: isDisabled ? "icon03" : "icon01" }),
|
|
2634
|
+
!selectedFile && /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx32("div", { className: "typography-body13regular select-none", children: /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
1491
2635
|
"\u3053\u3053\u306B\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1492
|
-
/* @__PURE__ */
|
|
2636
|
+
/* @__PURE__ */ jsx32("br", {}),
|
|
1493
2637
|
"\u307E\u305F\u306F\u3001",
|
|
1494
|
-
/* @__PURE__ */
|
|
2638
|
+
/* @__PURE__ */ jsx32("span", { className: clsx24(!isDisabled ? "text-link01" : ""), children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" }),
|
|
1495
2639
|
"\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
1496
2640
|
] }) }) }),
|
|
1497
|
-
!selectedFile && /* @__PURE__ */
|
|
1498
|
-
/* @__PURE__ */
|
|
1499
|
-
/* @__PURE__ */
|
|
1500
|
-
/* @__PURE__ */
|
|
1501
|
-
/* @__PURE__ */
|
|
2641
|
+
!selectedFile && /* @__PURE__ */ jsxs10("div", { className: "flex flex-col gap-1", children: [
|
|
2642
|
+
/* @__PURE__ */ jsx32("div", { className: clsx24("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u5BFE\u5FDC\u5F62\u5F0F" }),
|
|
2643
|
+
/* @__PURE__ */ jsx32("div", { className: clsx24("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: acceptLabel }),
|
|
2644
|
+
/* @__PURE__ */ jsx32("div", { className: clsx24("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u30B5\u30A4\u30BA" }),
|
|
2645
|
+
/* @__PURE__ */ jsx32("div", { className: clsx24("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: maxSizeLabel })
|
|
1502
2646
|
] }),
|
|
1503
|
-
selectedFile && /* @__PURE__ */
|
|
1504
|
-
/* @__PURE__ */
|
|
1505
|
-
/* @__PURE__ */
|
|
1506
|
-
/* @__PURE__ */
|
|
1507
|
-
!isDisabled && /* @__PURE__ */
|
|
2647
|
+
selectedFile && /* @__PURE__ */ jsxs10("div", { className: "mt-2 flex flex-col items-center gap-1", children: [
|
|
2648
|
+
/* @__PURE__ */ jsx32("span", { className: "typography-label11regular text-text02", children: "\u30D5\u30A1\u30A4\u30EB\u540D" }),
|
|
2649
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2650
|
+
/* @__PURE__ */ jsx32("span", { className: "typography-label14regular", children: selectedFile.name }),
|
|
2651
|
+
!isDisabled && /* @__PURE__ */ jsx32(
|
|
1508
2652
|
IconButton,
|
|
1509
2653
|
{
|
|
1510
2654
|
variant: "text",
|
|
@@ -1518,7 +2662,7 @@ var FileInput = forwardRef4(
|
|
|
1518
2662
|
)
|
|
1519
2663
|
] })
|
|
1520
2664
|
] }),
|
|
1521
|
-
/* @__PURE__ */
|
|
2665
|
+
/* @__PURE__ */ jsx32(
|
|
1522
2666
|
"input",
|
|
1523
2667
|
{
|
|
1524
2668
|
id: inputId,
|
|
@@ -1534,13 +2678,13 @@ var FileInput = forwardRef4(
|
|
|
1534
2678
|
]
|
|
1535
2679
|
}
|
|
1536
2680
|
),
|
|
1537
|
-
hasErrors && hasErrorMessages && /* @__PURE__ */
|
|
2681
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ jsx32(
|
|
1538
2682
|
"div",
|
|
1539
2683
|
{
|
|
1540
2684
|
id: errorId,
|
|
1541
2685
|
"data-testid": "error-messages",
|
|
1542
2686
|
className: "typography-body13regular flex flex-col text-supportDanger",
|
|
1543
|
-
children: errorMessages.map((message, index) => /* @__PURE__ */
|
|
2687
|
+
children: errorMessages.map((message, index) => /* @__PURE__ */ jsx32("div", { children: message }, index))
|
|
1544
2688
|
}
|
|
1545
2689
|
)
|
|
1546
2690
|
] });
|
|
@@ -1550,15 +2694,15 @@ FileInput.displayName = "FileInput";
|
|
|
1550
2694
|
|
|
1551
2695
|
// src/heading/heading.tsx
|
|
1552
2696
|
import { typography } from "@zenkigen-inc/component-theme";
|
|
1553
|
-
import { clsx as
|
|
1554
|
-
import { jsxs as
|
|
2697
|
+
import { clsx as clsx25 } from "clsx";
|
|
2698
|
+
import { jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1555
2699
|
function Heading(props) {
|
|
1556
2700
|
const TagName = `h${props.level}`;
|
|
1557
|
-
const classes =
|
|
2701
|
+
const classes = clsx25(`flex items-center text-text01`, typography.heading[TagName], {
|
|
1558
2702
|
"gap-2": props.level === 1,
|
|
1559
2703
|
"gap-1": props.level > 1
|
|
1560
2704
|
});
|
|
1561
|
-
return /* @__PURE__ */
|
|
2705
|
+
return /* @__PURE__ */ jsxs11(TagName, { className: classes, children: [
|
|
1562
2706
|
props.before,
|
|
1563
2707
|
props.children,
|
|
1564
2708
|
props.after
|
|
@@ -1566,22 +2710,22 @@ function Heading(props) {
|
|
|
1566
2710
|
}
|
|
1567
2711
|
|
|
1568
2712
|
// src/hooks/use-roving-focus.ts
|
|
1569
|
-
import { useCallback as
|
|
2713
|
+
import { useCallback as useCallback11, useState as useState8 } from "react";
|
|
1570
2714
|
var useRovingFocus = ({
|
|
1571
2715
|
values,
|
|
1572
2716
|
defaultFocusedValue,
|
|
1573
2717
|
isDisabled = false
|
|
1574
2718
|
}) => {
|
|
1575
|
-
const [focusedValue, setFocusedValue] =
|
|
2719
|
+
const [focusedValue, setFocusedValue] = useState8(
|
|
1576
2720
|
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
1577
2721
|
);
|
|
1578
|
-
const handleFocusChange =
|
|
2722
|
+
const handleFocusChange = useCallback11((newValue) => {
|
|
1579
2723
|
setFocusedValue(newValue);
|
|
1580
2724
|
}, []);
|
|
1581
|
-
const handleBlur =
|
|
2725
|
+
const handleBlur = useCallback11(() => {
|
|
1582
2726
|
setFocusedValue(null);
|
|
1583
2727
|
}, []);
|
|
1584
|
-
const handleKeyDown =
|
|
2728
|
+
const handleKeyDown = useCallback11(
|
|
1585
2729
|
(event) => {
|
|
1586
2730
|
if (isDisabled === true || values.length === 0) return;
|
|
1587
2731
|
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
@@ -1636,17 +2780,17 @@ var useRovingFocus = ({
|
|
|
1636
2780
|
};
|
|
1637
2781
|
|
|
1638
2782
|
// src/loading/loading.tsx
|
|
1639
|
-
import
|
|
1640
|
-
import { Fragment as
|
|
2783
|
+
import clsx26 from "clsx";
|
|
2784
|
+
import { Fragment as Fragment4, jsx as jsx33, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1641
2785
|
function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
1642
|
-
const wrapperClasses =
|
|
1643
|
-
const svgClasses =
|
|
2786
|
+
const wrapperClasses = clsx26(position, "left-0 top-0 z-20 flex w-full items-center justify-center");
|
|
2787
|
+
const svgClasses = clsx26({
|
|
1644
2788
|
"h-4 w-4": size === "small",
|
|
1645
2789
|
"h-8 w-8": size === "medium",
|
|
1646
2790
|
"h-16 w-16": size === "large"
|
|
1647
2791
|
});
|
|
1648
|
-
return /* @__PURE__ */
|
|
1649
|
-
size === "small" && /* @__PURE__ */
|
|
2792
|
+
return /* @__PURE__ */ jsx33(Fragment4, { children: /* @__PURE__ */ jsxs12("div", { className: wrapperClasses, style: { height }, children: [
|
|
2793
|
+
size === "small" && /* @__PURE__ */ jsx33("svg", { className: svgClasses, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx33(
|
|
1650
2794
|
"circle",
|
|
1651
2795
|
{
|
|
1652
2796
|
className: "origin-center animate-circular-small-move stroke-interactive01",
|
|
@@ -1658,7 +2802,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
1658
2802
|
fill: "none"
|
|
1659
2803
|
}
|
|
1660
2804
|
) }),
|
|
1661
|
-
size === "medium" && /* @__PURE__ */
|
|
2805
|
+
size === "medium" && /* @__PURE__ */ jsx33("svg", { className: svgClasses, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx33(
|
|
1662
2806
|
"circle",
|
|
1663
2807
|
{
|
|
1664
2808
|
className: "origin-center animate-circular-medium-move stroke-interactive01",
|
|
@@ -1670,7 +2814,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
1670
2814
|
fill: "none"
|
|
1671
2815
|
}
|
|
1672
2816
|
) }),
|
|
1673
|
-
size === "large" && /* @__PURE__ */
|
|
2817
|
+
size === "large" && /* @__PURE__ */ jsx33("svg", { className: svgClasses, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx33(
|
|
1674
2818
|
"circle",
|
|
1675
2819
|
{
|
|
1676
2820
|
className: "origin-center animate-circular-large-move stroke-interactive01",
|
|
@@ -1686,7 +2830,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
1686
2830
|
}
|
|
1687
2831
|
|
|
1688
2832
|
// src/modal/modal.tsx
|
|
1689
|
-
import { useEffect as
|
|
2833
|
+
import { useEffect as useEffect10, useState as useState9 } from "react";
|
|
1690
2834
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1691
2835
|
|
|
1692
2836
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -1737,34 +2881,34 @@ function restoreProperty(element, property, value) {
|
|
|
1737
2881
|
}
|
|
1738
2882
|
|
|
1739
2883
|
// src/modal/modal-body.tsx
|
|
1740
|
-
import { jsx as
|
|
2884
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1741
2885
|
function ModalBody({ children }) {
|
|
1742
|
-
return /* @__PURE__ */
|
|
2886
|
+
return /* @__PURE__ */ jsx34("div", { className: "overflow-y-auto", children });
|
|
1743
2887
|
}
|
|
1744
2888
|
|
|
1745
2889
|
// src/modal/modal-context.ts
|
|
1746
|
-
import { createContext as
|
|
1747
|
-
var ModalContext =
|
|
2890
|
+
import { createContext as createContext8 } from "react";
|
|
2891
|
+
var ModalContext = createContext8({
|
|
1748
2892
|
onClose: () => null
|
|
1749
2893
|
});
|
|
1750
2894
|
|
|
1751
2895
|
// src/modal/modal-footer.tsx
|
|
1752
|
-
import
|
|
1753
|
-
import { jsx as
|
|
2896
|
+
import clsx27 from "clsx";
|
|
2897
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1754
2898
|
function ModalFooter({ children, isNoBorder = false }) {
|
|
1755
|
-
const wrapperClasses =
|
|
2899
|
+
const wrapperClasses = clsx27("flex w-full shrink-0 items-center rounded-b-lg px-6 py-4", {
|
|
1756
2900
|
"border-t-[1px] border-uiBorder01": !isNoBorder
|
|
1757
2901
|
});
|
|
1758
|
-
return /* @__PURE__ */
|
|
2902
|
+
return /* @__PURE__ */ jsx35("div", { className: wrapperClasses, children });
|
|
1759
2903
|
}
|
|
1760
2904
|
|
|
1761
2905
|
// src/modal/modal-header.tsx
|
|
1762
|
-
import
|
|
1763
|
-
import { useContext as
|
|
1764
|
-
import { jsx as
|
|
2906
|
+
import clsx28 from "clsx";
|
|
2907
|
+
import { useContext as useContext9 } from "react";
|
|
2908
|
+
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1765
2909
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
1766
|
-
const { onClose } =
|
|
1767
|
-
const headerClasses =
|
|
2910
|
+
const { onClose } = useContext9(ModalContext);
|
|
2911
|
+
const headerClasses = clsx28(
|
|
1768
2912
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
1769
2913
|
{
|
|
1770
2914
|
"border-b border-uiBorder01": !isNoBorder,
|
|
@@ -1772,14 +2916,14 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
1772
2916
|
"h-12": onClose
|
|
1773
2917
|
}
|
|
1774
2918
|
);
|
|
1775
|
-
return /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */
|
|
1777
|
-
onClose && /* @__PURE__ */
|
|
2919
|
+
return /* @__PURE__ */ jsxs13("div", { className: headerClasses, children: [
|
|
2920
|
+
/* @__PURE__ */ jsx36("div", { children }),
|
|
2921
|
+
onClose && /* @__PURE__ */ jsx36(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
1778
2922
|
] });
|
|
1779
2923
|
}
|
|
1780
2924
|
|
|
1781
2925
|
// src/modal/modal.tsx
|
|
1782
|
-
import { Fragment as
|
|
2926
|
+
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1783
2927
|
var LIMIT_WIDTH = 320;
|
|
1784
2928
|
var LIMIT_HEIGHT = 184;
|
|
1785
2929
|
function Modal({
|
|
@@ -1791,21 +2935,21 @@ function Modal({
|
|
|
1791
2935
|
onClose,
|
|
1792
2936
|
portalTargetRef
|
|
1793
2937
|
}) {
|
|
1794
|
-
const [isMounted, setIsMounted] =
|
|
2938
|
+
const [isMounted, setIsMounted] = useState9(false);
|
|
1795
2939
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
1796
2940
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
1797
|
-
|
|
2941
|
+
useEffect10(() => {
|
|
1798
2942
|
setIsMounted(true);
|
|
1799
2943
|
}, []);
|
|
1800
|
-
|
|
2944
|
+
useEffect10(() => {
|
|
1801
2945
|
if (isOpen) {
|
|
1802
2946
|
window.dispatchEvent(new CustomEvent(MODAL_OPEN_EVENT));
|
|
1803
2947
|
}
|
|
1804
2948
|
}, [isOpen]);
|
|
1805
|
-
return isMounted && isOpen ? /* @__PURE__ */
|
|
1806
|
-
/* @__PURE__ */
|
|
2949
|
+
return isMounted && isOpen ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
2950
|
+
/* @__PURE__ */ jsx37(BodyScrollLock, {}),
|
|
1807
2951
|
createPortal2(
|
|
1808
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx37(ModalContext.Provider, { value: { onClose }, children: /* @__PURE__ */ jsx37("div", { className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4", children: /* @__PURE__ */ jsx37(
|
|
1809
2953
|
"div",
|
|
1810
2954
|
{
|
|
1811
2955
|
role: "dialog",
|
|
@@ -1824,10 +2968,10 @@ Modal.Header = ModalHeader;
|
|
|
1824
2968
|
Modal.Footer = ModalFooter;
|
|
1825
2969
|
|
|
1826
2970
|
// src/notification-inline/notification-inline.tsx
|
|
1827
|
-
import { clsx as
|
|
1828
|
-
import { jsx as
|
|
2971
|
+
import { clsx as clsx29 } from "clsx";
|
|
2972
|
+
import { jsx as jsx38, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1829
2973
|
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
1830
|
-
const wrapperClasses =
|
|
2974
|
+
const wrapperClasses = clsx29("typography-body13regular flex items-center gap-1 rounded text-text01", {
|
|
1831
2975
|
"bg-uiBackgroundError": state === "attention",
|
|
1832
2976
|
"bg-uiBackgroundWarning": state === "warning",
|
|
1833
2977
|
"bg-uiBackgroundBlue": state === "information",
|
|
@@ -1836,7 +2980,7 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1836
2980
|
"p-2": size === "small",
|
|
1837
2981
|
"p-3": size === "medium"
|
|
1838
2982
|
});
|
|
1839
|
-
const iconClasses =
|
|
2983
|
+
const iconClasses = clsx29("flex items-center", {
|
|
1840
2984
|
"fill-supportError": state === "attention",
|
|
1841
2985
|
"fill-supportWarning": state === "warning",
|
|
1842
2986
|
"fill-blue-blue50": state === "information",
|
|
@@ -1852,28 +2996,28 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1852
2996
|
small: "small",
|
|
1853
2997
|
medium: "medium"
|
|
1854
2998
|
};
|
|
1855
|
-
return /* @__PURE__ */
|
|
1856
|
-
state !== "default" && /* @__PURE__ */
|
|
1857
|
-
/* @__PURE__ */
|
|
1858
|
-
props.showClose === true && /* @__PURE__ */
|
|
2999
|
+
return /* @__PURE__ */ jsxs15("div", { className: wrapperClasses, children: [
|
|
3000
|
+
state !== "default" && /* @__PURE__ */ jsx38("div", { className: iconClasses, children: /* @__PURE__ */ jsx38(Icon, { name: iconName[state], size: iconSize[size] }) }),
|
|
3001
|
+
/* @__PURE__ */ jsx38("p", { className: "flex-1", children: props.children }),
|
|
3002
|
+
props.showClose === true && /* @__PURE__ */ jsx38("div", { className: "flex items-center", children: /* @__PURE__ */ jsx38(IconButton, { icon: "close", size: "small", variant: "text", onClick: props.onClickClose }) })
|
|
1859
3003
|
] });
|
|
1860
3004
|
}
|
|
1861
3005
|
|
|
1862
3006
|
// src/pagination/pagination-button.tsx
|
|
1863
|
-
import { clsx as
|
|
1864
|
-
import { useContext as
|
|
3007
|
+
import { clsx as clsx30 } from "clsx";
|
|
3008
|
+
import { useContext as useContext10 } from "react";
|
|
1865
3009
|
|
|
1866
3010
|
// src/pagination/pagination-context.ts
|
|
1867
|
-
import { createContext as
|
|
1868
|
-
var PaginationContext =
|
|
3011
|
+
import { createContext as createContext9 } from "react";
|
|
3012
|
+
var PaginationContext = createContext9({
|
|
1869
3013
|
currentPage: 0
|
|
1870
3014
|
});
|
|
1871
3015
|
|
|
1872
3016
|
// src/pagination/pagination-button.tsx
|
|
1873
|
-
import { jsx as
|
|
3017
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
1874
3018
|
function PaginationButton({ page, onClick }) {
|
|
1875
|
-
const { currentPage } =
|
|
1876
|
-
const buttonClasses =
|
|
3019
|
+
const { currentPage } = useContext10(PaginationContext);
|
|
3020
|
+
const buttonClasses = clsx30(
|
|
1877
3021
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
1878
3022
|
"typography-label14regular",
|
|
1879
3023
|
"text-interactive02",
|
|
@@ -1881,11 +3025,11 @@ function PaginationButton({ page, onClick }) {
|
|
|
1881
3025
|
{ "border border-uiBorder02": page === currentPage },
|
|
1882
3026
|
{ "border-transparent": page !== currentPage }
|
|
1883
3027
|
);
|
|
1884
|
-
return /* @__PURE__ */
|
|
3028
|
+
return /* @__PURE__ */ jsx39("button", { type: "button", className: buttonClasses, onClick: () => onClick(page), children: page });
|
|
1885
3029
|
}
|
|
1886
3030
|
|
|
1887
3031
|
// src/pagination/pagination.tsx
|
|
1888
|
-
import { jsx as
|
|
3032
|
+
import { jsx as jsx40, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1889
3033
|
var START_PAGE = 1;
|
|
1890
3034
|
function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick }) {
|
|
1891
3035
|
if (totalPage < START_PAGE) {
|
|
@@ -1921,14 +3065,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1921
3065
|
const hasHeadEllipsis = firstPageInList !== null && firstPageInList > START_PAGE + 1;
|
|
1922
3066
|
const hasTailEllipsis = lastPageInList !== null && lastPageInList < totalPage - 1;
|
|
1923
3067
|
const hasLastPageButton = totalPage > START_PAGE;
|
|
1924
|
-
return /* @__PURE__ */
|
|
3068
|
+
return /* @__PURE__ */ jsx40(
|
|
1925
3069
|
PaginationContext.Provider,
|
|
1926
3070
|
{
|
|
1927
3071
|
value: {
|
|
1928
3072
|
currentPage: clampedCurrentPage
|
|
1929
3073
|
},
|
|
1930
|
-
children: /* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
3074
|
+
children: /* @__PURE__ */ jsxs16("ul", { className: "flex gap-1", children: [
|
|
3075
|
+
/* @__PURE__ */ jsx40("li", { className: "flex items-center", children: /* @__PURE__ */ jsx40(
|
|
1932
3076
|
IconButton,
|
|
1933
3077
|
{
|
|
1934
3078
|
isDisabled: isFirstPage,
|
|
@@ -1938,12 +3082,12 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1938
3082
|
onClick: () => onClick(Math.max(START_PAGE, clampedCurrentPage - 1))
|
|
1939
3083
|
}
|
|
1940
3084
|
) }),
|
|
1941
|
-
/* @__PURE__ */
|
|
1942
|
-
hasHeadEllipsis && /* @__PURE__ */
|
|
1943
|
-
pageList.map((page, index) => /* @__PURE__ */
|
|
1944
|
-
hasTailEllipsis && /* @__PURE__ */
|
|
1945
|
-
hasLastPageButton && /* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
3085
|
+
/* @__PURE__ */ jsx40("li", { children: /* @__PURE__ */ jsx40(PaginationButton, { onClick: () => onClick(START_PAGE), page: START_PAGE }) }),
|
|
3086
|
+
hasHeadEllipsis && /* @__PURE__ */ jsx40("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx40(Icon, { name: "more", size: "small" }) }),
|
|
3087
|
+
pageList.map((page, index) => /* @__PURE__ */ jsx40("li", { children: /* @__PURE__ */ jsx40(PaginationButton, { onClick: () => onClick(page), page }) }, index)),
|
|
3088
|
+
hasTailEllipsis && /* @__PURE__ */ jsx40("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx40(Icon, { name: "more", size: "small" }) }),
|
|
3089
|
+
hasLastPageButton && /* @__PURE__ */ jsx40("li", { children: /* @__PURE__ */ jsx40(PaginationButton, { onClick: () => onClick(totalPage), page: totalPage }) }),
|
|
3090
|
+
/* @__PURE__ */ jsx40("li", { className: "flex items-center", children: /* @__PURE__ */ jsx40(
|
|
1947
3091
|
IconButton,
|
|
1948
3092
|
{
|
|
1949
3093
|
isDisabled: isLastPage,
|
|
@@ -1959,14 +3103,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1959
3103
|
}
|
|
1960
3104
|
|
|
1961
3105
|
// src/select/select.tsx
|
|
1962
|
-
import { autoUpdate as
|
|
1963
|
-
import { focusVisible as
|
|
1964
|
-
import
|
|
1965
|
-
import { useRef as
|
|
3106
|
+
import { autoUpdate as autoUpdate3, FloatingPortal as FloatingPortal3, offset as offset3, size as sizeMiddleware2, useFloating as useFloating3 } from "@floating-ui/react";
|
|
3107
|
+
import { focusVisible as focusVisible11, selectColors } from "@zenkigen-inc/component-theme";
|
|
3108
|
+
import clsx33 from "clsx";
|
|
3109
|
+
import { useRef as useRef11, useState as useState10 } from "react";
|
|
1966
3110
|
|
|
1967
3111
|
// src/select/select-context.ts
|
|
1968
|
-
import { createContext as
|
|
1969
|
-
var SelectContext =
|
|
3112
|
+
import { createContext as createContext10 } from "react";
|
|
3113
|
+
var SelectContext = createContext10({
|
|
1970
3114
|
size: "medium",
|
|
1971
3115
|
setIsOptionListOpen: () => false,
|
|
1972
3116
|
variant: "outline",
|
|
@@ -1974,40 +3118,42 @@ var SelectContext = createContext6({
|
|
|
1974
3118
|
});
|
|
1975
3119
|
|
|
1976
3120
|
// src/select/select-item.tsx
|
|
1977
|
-
import { focusVisible as
|
|
1978
|
-
import
|
|
1979
|
-
import { useContext as
|
|
1980
|
-
import { jsx as
|
|
3121
|
+
import { focusVisible as focusVisible9 } from "@zenkigen-inc/component-theme";
|
|
3122
|
+
import clsx31 from "clsx";
|
|
3123
|
+
import { useContext as useContext11 } from "react";
|
|
3124
|
+
import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1981
3125
|
function SelectItem({ option }) {
|
|
1982
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError } =
|
|
3126
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError, size } = useContext11(SelectContext);
|
|
1983
3127
|
const handleClickItem = (option2) => {
|
|
1984
3128
|
onChange?.(option2);
|
|
1985
3129
|
setIsOptionListOpen(false);
|
|
1986
3130
|
};
|
|
1987
|
-
const itemClasses =
|
|
1988
|
-
"typography-label14regular flex
|
|
1989
|
-
|
|
3131
|
+
const itemClasses = clsx31(
|
|
3132
|
+
"typography-label14regular flex w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
3133
|
+
focusVisible9.inset,
|
|
1990
3134
|
{
|
|
3135
|
+
"h-8": size !== "large",
|
|
3136
|
+
"h-10": size === "large",
|
|
1991
3137
|
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
1992
3138
|
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
1993
3139
|
"text-interactive02 fill-icon01 bg-uiBackground01": option.id !== selectedOption?.id,
|
|
1994
3140
|
"pr-10": option.id !== selectedOption?.id
|
|
1995
3141
|
}
|
|
1996
3142
|
);
|
|
1997
|
-
return /* @__PURE__ */
|
|
1998
|
-
option.icon && /* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
2000
|
-
option.id === selectedOption?.id && /* @__PURE__ */
|
|
3143
|
+
return /* @__PURE__ */ jsx41("li", { className: "flex w-full items-center", "data-id": option.id, children: /* @__PURE__ */ jsxs17("button", { className: itemClasses, type: "button", onClick: () => handleClickItem(option), children: [
|
|
3144
|
+
option.icon && /* @__PURE__ */ jsx41(Icon, { name: option.icon, size: "small" }),
|
|
3145
|
+
/* @__PURE__ */ jsx41("span", { className: "ml-1 flex-1 truncate text-left", children: option.label }),
|
|
3146
|
+
option.id === selectedOption?.id && /* @__PURE__ */ jsx41("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ jsx41(Icon, { name: "check", size: "small" }) })
|
|
2001
3147
|
] }) }, option.id);
|
|
2002
3148
|
}
|
|
2003
3149
|
|
|
2004
3150
|
// src/select/select-list.tsx
|
|
2005
|
-
import { focusVisible as
|
|
2006
|
-
import
|
|
2007
|
-
import { forwardRef as
|
|
2008
|
-
import { jsx as
|
|
2009
|
-
var SelectList =
|
|
2010
|
-
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } =
|
|
3151
|
+
import { focusVisible as focusVisible10 } from "@zenkigen-inc/component-theme";
|
|
3152
|
+
import clsx32 from "clsx";
|
|
3153
|
+
import { forwardRef as forwardRef10, useContext as useContext12, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
3154
|
+
import { jsx as jsx42, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3155
|
+
var SelectList = forwardRef10(({ children, maxHeight }, ref) => {
|
|
3156
|
+
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef, size } = useContext12(SelectContext);
|
|
2011
3157
|
const handleClickDeselect = () => {
|
|
2012
3158
|
onChange?.(null);
|
|
2013
3159
|
setIsOptionListOpen(false);
|
|
@@ -2030,23 +3176,27 @@ var SelectList = forwardRef5(({ children, maxHeight }, ref) => {
|
|
|
2030
3176
|
}
|
|
2031
3177
|
}
|
|
2032
3178
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
2033
|
-
const listClasses =
|
|
3179
|
+
const listClasses = clsx32("overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
2034
3180
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
2035
3181
|
});
|
|
2036
|
-
const deselectButtonClasses =
|
|
2037
|
-
"typography-label14regular flex
|
|
2038
|
-
|
|
3182
|
+
const deselectButtonClasses = clsx32(
|
|
3183
|
+
"typography-label14regular flex w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
3184
|
+
focusVisible10.inset,
|
|
3185
|
+
{
|
|
3186
|
+
"h-8": size !== "large",
|
|
3187
|
+
"h-10": size === "large"
|
|
3188
|
+
}
|
|
2039
3189
|
);
|
|
2040
|
-
return /* @__PURE__ */
|
|
3190
|
+
return /* @__PURE__ */ jsxs18("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
2041
3191
|
children,
|
|
2042
|
-
placeholder != null && selectedOption !== null && /* @__PURE__ */
|
|
3192
|
+
placeholder != null && selectedOption !== null && /* @__PURE__ */ jsx42("li", { children: /* @__PURE__ */ jsx42("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
2043
3193
|
] });
|
|
2044
3194
|
});
|
|
2045
3195
|
SelectList.displayName = "SelectList";
|
|
2046
3196
|
|
|
2047
3197
|
// src/select/select.tsx
|
|
2048
|
-
import { jsx as
|
|
2049
|
-
var
|
|
3198
|
+
import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3199
|
+
var FLOATING_OFFSET2 = 4;
|
|
2050
3200
|
function Select({
|
|
2051
3201
|
children,
|
|
2052
3202
|
size = "medium",
|
|
@@ -2063,21 +3213,21 @@ function Select({
|
|
|
2063
3213
|
optionListMaxHeight,
|
|
2064
3214
|
matchListToTrigger = false
|
|
2065
3215
|
}) {
|
|
2066
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
2067
|
-
const targetRef =
|
|
3216
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState10(false);
|
|
3217
|
+
const targetRef = useRef11(null);
|
|
2068
3218
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
2069
3219
|
useDismissOnModalOpen(() => {
|
|
2070
3220
|
if (isOptionListOpen) {
|
|
2071
3221
|
setIsOptionListOpen(false);
|
|
2072
3222
|
}
|
|
2073
3223
|
});
|
|
2074
|
-
const { refs, floatingStyles } =
|
|
3224
|
+
const { refs, floatingStyles } = useFloating3({
|
|
2075
3225
|
open: isOptionListOpen,
|
|
2076
3226
|
onOpenChange: setIsOptionListOpen,
|
|
2077
3227
|
placement: "bottom-start",
|
|
2078
3228
|
middleware: [
|
|
2079
|
-
|
|
2080
|
-
|
|
3229
|
+
offset3(FLOATING_OFFSET2),
|
|
3230
|
+
sizeMiddleware2({
|
|
2081
3231
|
apply({ availableWidth, elements, rects }) {
|
|
2082
3232
|
const referenceWidth = rects.reference.width;
|
|
2083
3233
|
if (matchListToTrigger) {
|
|
@@ -2089,23 +3239,23 @@ function Select({
|
|
|
2089
3239
|
}
|
|
2090
3240
|
})
|
|
2091
3241
|
],
|
|
2092
|
-
whileElementsMounted:
|
|
3242
|
+
whileElementsMounted: autoUpdate3
|
|
2093
3243
|
});
|
|
2094
3244
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
2095
3245
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
2096
3246
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
2097
|
-
const wrapperClasses =
|
|
3247
|
+
const wrapperClasses = clsx33("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
2098
3248
|
"h-6": size === "x-small" || size === "small",
|
|
2099
3249
|
"h-8": size === "medium",
|
|
2100
3250
|
"h-10": size === "large",
|
|
2101
3251
|
"cursor-not-allowed": isDisabled
|
|
2102
3252
|
});
|
|
2103
|
-
const buttonClasses =
|
|
3253
|
+
const buttonClasses = clsx33(
|
|
2104
3254
|
"flex size-full items-center rounded",
|
|
2105
3255
|
selectColors[buttonVariant].hover,
|
|
2106
3256
|
selectColors[buttonVariant].active,
|
|
2107
3257
|
selectColors[buttonVariant].disabled,
|
|
2108
|
-
|
|
3258
|
+
focusVisible11.normal,
|
|
2109
3259
|
{
|
|
2110
3260
|
[selectColors[buttonVariant].selected]: isSelected,
|
|
2111
3261
|
[selectColors[buttonVariant].base]: !isSelected,
|
|
@@ -2115,14 +3265,14 @@ function Select({
|
|
|
2115
3265
|
"border-supportError": !isSelected && !isDisabled && isError
|
|
2116
3266
|
}
|
|
2117
3267
|
);
|
|
2118
|
-
const labelClasses =
|
|
3268
|
+
const labelClasses = clsx33("overflow-hidden", {
|
|
2119
3269
|
"mr-1": size === "x-small",
|
|
2120
3270
|
"mr-2": size !== "x-small",
|
|
2121
3271
|
"typography-label12regular": size === "x-small",
|
|
2122
3272
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2123
3273
|
"typography-label16regular": size === "large"
|
|
2124
3274
|
});
|
|
2125
|
-
return /* @__PURE__ */
|
|
3275
|
+
return /* @__PURE__ */ jsx43(
|
|
2126
3276
|
SelectContext.Provider,
|
|
2127
3277
|
{
|
|
2128
3278
|
value: {
|
|
@@ -2136,8 +3286,8 @@ function Select({
|
|
|
2136
3286
|
floatingStyles,
|
|
2137
3287
|
floatingRef: refs.floating
|
|
2138
3288
|
},
|
|
2139
|
-
children: /* @__PURE__ */
|
|
2140
|
-
/* @__PURE__ */
|
|
3289
|
+
children: /* @__PURE__ */ jsxs19("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
3290
|
+
/* @__PURE__ */ jsxs19(
|
|
2141
3291
|
"button",
|
|
2142
3292
|
{
|
|
2143
3293
|
ref: refs.setReference,
|
|
@@ -2146,9 +3296,9 @@ function Select({
|
|
|
2146
3296
|
onClick: handleClickToggle,
|
|
2147
3297
|
disabled: isDisabled,
|
|
2148
3298
|
children: [
|
|
2149
|
-
selectedOption?.icon ? /* @__PURE__ */
|
|
2150
|
-
/* @__PURE__ */
|
|
2151
|
-
/* @__PURE__ */
|
|
3299
|
+
selectedOption?.icon ? /* @__PURE__ */ jsx43("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx43(Icon, { name: selectedOption.icon, size: size === "large" ? "medium" : "small" }) }) : placeholder != null && placeholderIcon && /* @__PURE__ */ jsx43("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx43(Icon, { name: placeholderIcon, size: size === "large" ? "medium" : "small" }) }),
|
|
3300
|
+
/* @__PURE__ */ jsx43("div", { className: labelClasses, children: /* @__PURE__ */ jsx43("div", { className: "truncate", children: selectedOption ? selectedOption.label : placeholder != null && placeholder }) }),
|
|
3301
|
+
/* @__PURE__ */ jsx43("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx43(
|
|
2152
3302
|
Icon,
|
|
2153
3303
|
{
|
|
2154
3304
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -2158,287 +3308,103 @@ function Select({
|
|
|
2158
3308
|
]
|
|
2159
3309
|
}
|
|
2160
3310
|
),
|
|
2161
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */
|
|
2162
|
-
] })
|
|
2163
|
-
}
|
|
2164
|
-
);
|
|
2165
|
-
}
|
|
2166
|
-
Select.Option = SelectItem;
|
|
2167
|
-
|
|
2168
|
-
// src/pagination-select/pagination-select.tsx
|
|
2169
|
-
import { jsx as jsx33, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2170
|
-
function PaginationSelect({
|
|
2171
|
-
totalSize,
|
|
2172
|
-
currentPage,
|
|
2173
|
-
sizePerPage,
|
|
2174
|
-
countLabel = "\u4EF6",
|
|
2175
|
-
pageLabel = "\u30DA\u30FC\u30B8",
|
|
2176
|
-
optionListMaxHeight = 190,
|
|
2177
|
-
onClickPrevButton,
|
|
2178
|
-
onClickNextButton,
|
|
2179
|
-
onChange
|
|
2180
|
-
}) {
|
|
2181
|
-
const pageMax = Math.ceil(totalSize / sizePerPage);
|
|
2182
|
-
const optionsList = [...Array(pageMax)].map((_, index) => {
|
|
2183
|
-
const value = (index + 1).toString();
|
|
2184
|
-
return {
|
|
2185
|
-
id: value,
|
|
2186
|
-
value,
|
|
2187
|
-
label: value
|
|
2188
|
-
};
|
|
2189
|
-
});
|
|
2190
|
-
const minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
|
|
2191
|
-
const maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
|
|
2192
|
-
return /* @__PURE__ */ jsxs16("nav", { "aria-label": "pagination", className: "flex items-center gap-x-1", children: [
|
|
2193
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-x-2", children: [
|
|
2194
|
-
/* @__PURE__ */ jsxs16("div", { className: "typography-label14regular flex gap-1 text-text01", children: [
|
|
2195
|
-
/* @__PURE__ */ jsxs16("span", { className: " ", children: [
|
|
2196
|
-
minCount > 0 && `${minCount} - `,
|
|
2197
|
-
maxCount
|
|
2198
|
-
] }),
|
|
2199
|
-
/* @__PURE__ */ jsxs16("span", { children: [
|
|
2200
|
-
"/ ",
|
|
2201
|
-
totalSize
|
|
2202
|
-
] }),
|
|
2203
|
-
/* @__PURE__ */ jsx33("span", { children: countLabel })
|
|
2204
|
-
] }),
|
|
2205
|
-
/* @__PURE__ */ jsx33(
|
|
2206
|
-
Select,
|
|
2207
|
-
{
|
|
2208
|
-
size: "medium",
|
|
2209
|
-
variant: "outline",
|
|
2210
|
-
selectedOption: optionsList.find((option) => option.value === currentPage.toString()),
|
|
2211
|
-
optionListMaxHeight,
|
|
2212
|
-
onChange: (option) => option && onChange(Number(option.value)),
|
|
2213
|
-
isDisabled: pageMax === 0,
|
|
2214
|
-
children: optionsList.map((option) => /* @__PURE__ */ jsx33(Select.Option, { option }, option.id))
|
|
2215
|
-
}
|
|
2216
|
-
),
|
|
2217
|
-
/* @__PURE__ */ jsxs16("div", { className: "typography-label14regular text-text02", children: [
|
|
2218
|
-
"/ ",
|
|
2219
|
-
pageMax,
|
|
2220
|
-
pageLabel
|
|
2221
|
-
] })
|
|
2222
|
-
] }),
|
|
2223
|
-
/* @__PURE__ */ jsxs16("div", { className: "flex items-center", children: [
|
|
2224
|
-
/* @__PURE__ */ jsx33(
|
|
2225
|
-
IconButton,
|
|
2226
|
-
{
|
|
2227
|
-
variant: "text",
|
|
2228
|
-
icon: "angle-left",
|
|
2229
|
-
size: "small",
|
|
2230
|
-
isDisabled: currentPage === 1,
|
|
2231
|
-
onClick: onClickPrevButton
|
|
2232
|
-
}
|
|
2233
|
-
),
|
|
2234
|
-
/* @__PURE__ */ jsx33(
|
|
2235
|
-
IconButton,
|
|
2236
|
-
{
|
|
2237
|
-
variant: "text",
|
|
2238
|
-
icon: "angle-right",
|
|
2239
|
-
size: "small",
|
|
2240
|
-
isDisabled: currentPage === pageMax || pageMax === 0,
|
|
2241
|
-
onClick: onClickNextButton
|
|
2242
|
-
}
|
|
2243
|
-
)
|
|
2244
|
-
] })
|
|
2245
|
-
] });
|
|
2246
|
-
}
|
|
2247
|
-
|
|
2248
|
-
// src/password-input/password-input.tsx
|
|
2249
|
-
import { forwardRef as forwardRef9, useState as useState9 } from "react";
|
|
2250
|
-
|
|
2251
|
-
// src/text-input/text-input.tsx
|
|
2252
|
-
import { clsx as clsx29 } from "clsx";
|
|
2253
|
-
import { Children as Children2, cloneElement as cloneElement4, forwardRef as forwardRef8, isValidElement as isValidElement2, useId as useId3, useMemo as useMemo3 } from "react";
|
|
2254
|
-
|
|
2255
|
-
// src/text-input/text-input-context.tsx
|
|
2256
|
-
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
2257
|
-
var TextInputCompoundContext = createContext7(null);
|
|
2258
|
-
var useTextInputCompoundContext = (componentName) => {
|
|
2259
|
-
const context = useContext9(TextInputCompoundContext);
|
|
2260
|
-
if (context == null) {
|
|
2261
|
-
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextInput \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
2262
|
-
}
|
|
2263
|
-
return context;
|
|
2264
|
-
};
|
|
2265
|
-
|
|
2266
|
-
// src/text-input/text-input-error-message.tsx
|
|
2267
|
-
import { clsx as clsx27 } from "clsx";
|
|
2268
|
-
import { forwardRef as forwardRef6 } from "react";
|
|
2269
|
-
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2270
|
-
var TextInputErrorMessage = forwardRef6(
|
|
2271
|
-
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
2272
|
-
const { inputProps } = useTextInputCompoundContext("TextInput.ErrorMessage");
|
|
2273
|
-
const typographyClass = inputProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
2274
|
-
const shouldRender = inputProps.isError === true;
|
|
2275
|
-
if (!shouldRender) {
|
|
2276
|
-
return null;
|
|
2277
|
-
}
|
|
2278
|
-
const errorMessageClassName = clsx27(typographyClass, "text-supportError");
|
|
2279
|
-
return /* @__PURE__ */ jsx34("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
2280
|
-
}
|
|
2281
|
-
);
|
|
2282
|
-
TextInputErrorMessage.displayName = "TextInput.ErrorMessage";
|
|
2283
|
-
|
|
2284
|
-
// src/text-input/text-input-helper-message.tsx
|
|
2285
|
-
import { clsx as clsx28 } from "clsx";
|
|
2286
|
-
import { forwardRef as forwardRef7 } from "react";
|
|
2287
|
-
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
2288
|
-
var TextInputHelperMessage = forwardRef7((props, ref) => {
|
|
2289
|
-
const { inputProps } = useTextInputCompoundContext("TextInput.HelperMessage");
|
|
2290
|
-
const typographyClass = inputProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
2291
|
-
const helperMessageClassName = clsx28(typographyClass, "text-text02");
|
|
2292
|
-
return /* @__PURE__ */ jsx35("div", { ref, className: helperMessageClassName, ...props });
|
|
2293
|
-
});
|
|
2294
|
-
TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
2295
|
-
|
|
2296
|
-
// src/text-input/text-input.tsx
|
|
2297
|
-
import { jsx as jsx36, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
2298
|
-
function TextInputInner({
|
|
2299
|
-
size = "medium",
|
|
2300
|
-
variant = "outline",
|
|
2301
|
-
isError = false,
|
|
2302
|
-
disabled = false,
|
|
2303
|
-
onClickClearButton,
|
|
2304
|
-
after,
|
|
2305
|
-
children,
|
|
2306
|
-
...props
|
|
2307
|
-
}, ref) {
|
|
2308
|
-
const autoGeneratedId = useId3();
|
|
2309
|
-
const { className: _className, ...restInputProps } = props;
|
|
2310
|
-
const inputPropsForContext = useMemo3(
|
|
2311
|
-
() => ({
|
|
2312
|
-
...restInputProps,
|
|
2313
|
-
size,
|
|
2314
|
-
isError,
|
|
2315
|
-
disabled,
|
|
2316
|
-
onClickClearButton,
|
|
2317
|
-
after
|
|
2318
|
-
}),
|
|
2319
|
-
[restInputProps, size, isError, disabled, onClickClearButton, after]
|
|
2320
|
-
);
|
|
2321
|
-
const contextValue = useMemo3(
|
|
2322
|
-
() => ({
|
|
2323
|
-
inputProps: inputPropsForContext,
|
|
2324
|
-
forwardedRef: ref
|
|
2325
|
-
}),
|
|
2326
|
-
[inputPropsForContext, ref]
|
|
2327
|
-
);
|
|
2328
|
-
const helperMessageIds = [];
|
|
2329
|
-
const errorIds = [];
|
|
2330
|
-
const describedByBaseId = restInputProps.id ?? autoGeneratedId;
|
|
2331
|
-
const enhancedChildren = Children2.map(children, (child) => {
|
|
2332
|
-
if (!isValidElement2(child)) {
|
|
2333
|
-
return child;
|
|
2334
|
-
}
|
|
2335
|
-
if (child.type === TextInputHelperMessage) {
|
|
2336
|
-
const helperChild = child;
|
|
2337
|
-
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
2338
|
-
helperMessageIds.push(assignedId);
|
|
2339
|
-
return cloneElement4(helperChild, { id: assignedId });
|
|
2340
|
-
}
|
|
2341
|
-
if (child.type === TextInputErrorMessage && isError) {
|
|
2342
|
-
const errorChild = child;
|
|
2343
|
-
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
2344
|
-
errorIds.push(assignedId);
|
|
2345
|
-
return cloneElement4(errorChild, { id: assignedId });
|
|
2346
|
-
}
|
|
2347
|
-
return child;
|
|
2348
|
-
});
|
|
2349
|
-
const describedByFromProps = typeof restInputProps["aria-describedby"] === "string" ? restInputProps["aria-describedby"] : null;
|
|
2350
|
-
const describedByList = [describedByFromProps, ...helperMessageIds, ...errorIds].filter(
|
|
2351
|
-
(id) => typeof id === "string" && id.trim().length > 0
|
|
3311
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx43(FloatingPortal3, { children: /* @__PURE__ */ jsx43("div", { className: "relative z-popover", children: /* @__PURE__ */ jsx43(SelectList, { ref: refs.setFloating, maxHeight: optionListMaxHeight, children }) }) })
|
|
3312
|
+
] })
|
|
3313
|
+
}
|
|
2352
3314
|
);
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
const
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
// text variant
|
|
2378
|
-
"border-transparent": isBorderless,
|
|
2379
|
-
// 共通
|
|
2380
|
-
"bg-uiBackground01": !disabled || isBorderless,
|
|
2381
|
-
"pr-2": !isBorderless && size === "medium" && hasTrailingElement,
|
|
2382
|
-
"pr-3": !isBorderless && size === "large" && hasTrailingElement
|
|
2383
|
-
});
|
|
2384
|
-
const inputClasses = clsx29("flex-1 bg-transparent outline-none", {
|
|
2385
|
-
"disabled:text-textPlaceholder": !isBorderless,
|
|
2386
|
-
"disabled:text-disabled01": isBorderless,
|
|
2387
|
-
// outline: 従来の padding
|
|
2388
|
-
"typography-label14regular min-h-8 px-2": !isBorderless && size === "medium",
|
|
2389
|
-
"typography-label16regular min-h-10 px-3": !isBorderless && size === "large",
|
|
2390
|
-
// text: padding なし
|
|
2391
|
-
"typography-label14regular min-h-8": isBorderless && size === "medium",
|
|
2392
|
-
"typography-label16regular min-h-10": isBorderless && size === "large",
|
|
2393
|
-
// テキスト色
|
|
2394
|
-
"text-text01": !isError,
|
|
2395
|
-
"text-supportError": isError,
|
|
2396
|
-
// placeholder 色(text variant エラー時のみ上書き)
|
|
2397
|
-
"placeholder:text-textPlaceholder": !(isBorderless && isError && !disabled),
|
|
2398
|
-
"placeholder:text-supportErrorLight": isBorderless && isError && !disabled,
|
|
2399
|
-
"pr-0": hasTrailingElement
|
|
3315
|
+
}
|
|
3316
|
+
Select.Option = SelectItem;
|
|
3317
|
+
|
|
3318
|
+
// src/pagination-select/pagination-select.tsx
|
|
3319
|
+
import { jsx as jsx44, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
3320
|
+
function PaginationSelect({
|
|
3321
|
+
totalSize,
|
|
3322
|
+
currentPage,
|
|
3323
|
+
sizePerPage,
|
|
3324
|
+
countLabel = "\u4EF6",
|
|
3325
|
+
pageLabel = "\u30DA\u30FC\u30B8",
|
|
3326
|
+
optionListMaxHeight = 190,
|
|
3327
|
+
onClickPrevButton,
|
|
3328
|
+
onClickNextButton,
|
|
3329
|
+
onChange
|
|
3330
|
+
}) {
|
|
3331
|
+
const pageMax = Math.ceil(totalSize / sizePerPage);
|
|
3332
|
+
const optionsList = [...Array(pageMax)].map((_, index) => {
|
|
3333
|
+
const value = (index + 1).toString();
|
|
3334
|
+
return {
|
|
3335
|
+
id: value,
|
|
3336
|
+
value,
|
|
3337
|
+
label: value
|
|
3338
|
+
};
|
|
2400
3339
|
});
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
3340
|
+
const minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
|
|
3341
|
+
const maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
|
|
3342
|
+
return /* @__PURE__ */ jsxs20("nav", { "aria-label": "pagination", className: "flex items-center gap-x-1", children: [
|
|
3343
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-x-2", children: [
|
|
3344
|
+
/* @__PURE__ */ jsxs20("div", { className: "typography-label14regular flex gap-1 text-text01", children: [
|
|
3345
|
+
/* @__PURE__ */ jsxs20("span", { className: " ", children: [
|
|
3346
|
+
minCount > 0 && `${minCount} - `,
|
|
3347
|
+
maxCount
|
|
3348
|
+
] }),
|
|
3349
|
+
/* @__PURE__ */ jsxs20("span", { children: [
|
|
3350
|
+
"/ ",
|
|
3351
|
+
totalSize
|
|
3352
|
+
] }),
|
|
3353
|
+
/* @__PURE__ */ jsx44("span", { children: countLabel })
|
|
3354
|
+
] }),
|
|
3355
|
+
/* @__PURE__ */ jsx44(
|
|
3356
|
+
Select,
|
|
3357
|
+
{
|
|
3358
|
+
size: "medium",
|
|
3359
|
+
variant: "outline",
|
|
3360
|
+
selectedOption: optionsList.find((option) => option.value === currentPage.toString()),
|
|
3361
|
+
optionListMaxHeight,
|
|
3362
|
+
onChange: (option) => option && onChange(Number(option.value)),
|
|
3363
|
+
isDisabled: pageMax === 0,
|
|
3364
|
+
children: optionsList.map((option) => /* @__PURE__ */ jsx44(Select.Option, { option }, option.id))
|
|
3365
|
+
}
|
|
3366
|
+
),
|
|
3367
|
+
/* @__PURE__ */ jsxs20("div", { className: "typography-label14regular text-text02", children: [
|
|
3368
|
+
"/ ",
|
|
3369
|
+
pageMax,
|
|
3370
|
+
pageLabel
|
|
3371
|
+
] })
|
|
3372
|
+
] }),
|
|
3373
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-center", children: [
|
|
3374
|
+
/* @__PURE__ */ jsx44(
|
|
3375
|
+
IconButton,
|
|
3376
|
+
{
|
|
3377
|
+
variant: "text",
|
|
3378
|
+
icon: "angle-left",
|
|
3379
|
+
size: "small",
|
|
3380
|
+
isDisabled: currentPage === 1,
|
|
3381
|
+
onClick: onClickPrevButton
|
|
3382
|
+
}
|
|
3383
|
+
),
|
|
3384
|
+
/* @__PURE__ */ jsx44(
|
|
3385
|
+
IconButton,
|
|
3386
|
+
{
|
|
3387
|
+
variant: "text",
|
|
3388
|
+
icon: "angle-right",
|
|
3389
|
+
size: "small",
|
|
3390
|
+
isDisabled: currentPage === pageMax || pageMax === 0,
|
|
3391
|
+
onClick: onClickNextButton
|
|
3392
|
+
}
|
|
3393
|
+
)
|
|
3394
|
+
] })
|
|
2405
3395
|
] });
|
|
2406
|
-
const stackedChildren = enhancedChildren == null ? [] : Children2.toArray(enhancedChildren);
|
|
2407
|
-
const hasMessageChildren = stackedChildren.length > 0;
|
|
2408
|
-
if (!hasMessageChildren) {
|
|
2409
|
-
return /* @__PURE__ */ jsx36(TextInputCompoundContext.Provider, { value: contextValue, children: inputElement });
|
|
2410
|
-
}
|
|
2411
|
-
return /* @__PURE__ */ jsx36(TextInputCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
|
|
2412
|
-
inputElement,
|
|
2413
|
-
stackedChildren
|
|
2414
|
-
] }) });
|
|
2415
3396
|
}
|
|
2416
|
-
var attachStatics = (component) => {
|
|
2417
|
-
component.HelperMessage = TextInputHelperMessage;
|
|
2418
|
-
component.ErrorMessage = TextInputErrorMessage;
|
|
2419
|
-
component.displayName = "TextInput";
|
|
2420
|
-
return component;
|
|
2421
|
-
};
|
|
2422
|
-
var TextInputPublic = forwardRef8(function TextInputPublic2(props, ref) {
|
|
2423
|
-
return TextInputInner(props, ref);
|
|
2424
|
-
});
|
|
2425
|
-
var InternalTextInputBase = forwardRef8(
|
|
2426
|
-
function InternalTextInputBase2(props, ref) {
|
|
2427
|
-
return TextInputInner(props, ref);
|
|
2428
|
-
}
|
|
2429
|
-
);
|
|
2430
|
-
var TextInput = attachStatics(TextInputPublic);
|
|
2431
|
-
var InternalTextInput = attachStatics(InternalTextInputBase);
|
|
2432
3397
|
|
|
2433
3398
|
// src/password-input/password-input.tsx
|
|
2434
|
-
import {
|
|
2435
|
-
|
|
2436
|
-
|
|
3399
|
+
import { forwardRef as forwardRef11, useState as useState11 } from "react";
|
|
3400
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
3401
|
+
var PasswordInputBase = forwardRef11(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
3402
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState11(false);
|
|
2437
3403
|
const { className: _className, ...textInputProps } = props;
|
|
2438
3404
|
const handlePasswordVisibilityToggle = () => {
|
|
2439
3405
|
setIsPasswordVisible((prev) => !prev);
|
|
2440
3406
|
};
|
|
2441
|
-
const passwordToggleButton = /* @__PURE__ */
|
|
3407
|
+
const passwordToggleButton = /* @__PURE__ */ jsx45(
|
|
2442
3408
|
IconButton,
|
|
2443
3409
|
{
|
|
2444
3410
|
variant: "text",
|
|
@@ -2449,7 +3415,7 @@ var PasswordInputBase = forwardRef9(function PasswordInput({ disabled = false, c
|
|
|
2449
3415
|
"aria-label": isPasswordVisible === true ? "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u975E\u8868\u793A\u306B\u3059\u308B" : "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8868\u793A\u3059\u308B"
|
|
2450
3416
|
}
|
|
2451
3417
|
);
|
|
2452
|
-
return /* @__PURE__ */
|
|
3418
|
+
return /* @__PURE__ */ jsx45(
|
|
2453
3419
|
InternalTextInput,
|
|
2454
3420
|
{
|
|
2455
3421
|
ref,
|
|
@@ -2468,47 +3434,47 @@ var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
|
2468
3434
|
});
|
|
2469
3435
|
|
|
2470
3436
|
// src/popup/popup.tsx
|
|
2471
|
-
import { useContext as
|
|
3437
|
+
import { useContext as useContext14 } from "react";
|
|
2472
3438
|
|
|
2473
3439
|
// src/popup/popup-body.tsx
|
|
2474
|
-
import { jsx as
|
|
3440
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
2475
3441
|
function PopupBody({ children }) {
|
|
2476
|
-
return /* @__PURE__ */
|
|
3442
|
+
return /* @__PURE__ */ jsx46("div", { className: "overflow-y-auto", children });
|
|
2477
3443
|
}
|
|
2478
3444
|
|
|
2479
3445
|
// src/popup/popup-context.ts
|
|
2480
|
-
import { createContext as
|
|
2481
|
-
var PopupContext =
|
|
3446
|
+
import { createContext as createContext11 } from "react";
|
|
3447
|
+
var PopupContext = createContext11({
|
|
2482
3448
|
isOpen: false,
|
|
2483
3449
|
onClose: () => null
|
|
2484
3450
|
});
|
|
2485
3451
|
|
|
2486
3452
|
// src/popup/popup-footer.tsx
|
|
2487
|
-
import { jsx as
|
|
3453
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
2488
3454
|
function PopupFooter({ children }) {
|
|
2489
|
-
return /* @__PURE__ */
|
|
3455
|
+
return /* @__PURE__ */ jsx47("div", { className: "flex w-full shrink-0 items-center rounded-b-lg px-6 py-3", children });
|
|
2490
3456
|
}
|
|
2491
3457
|
|
|
2492
3458
|
// src/popup/popup-header.tsx
|
|
2493
|
-
import { useContext as
|
|
2494
|
-
import { jsx as
|
|
3459
|
+
import { useContext as useContext13 } from "react";
|
|
3460
|
+
import { jsx as jsx48, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2495
3461
|
function PopupHeader({ children, before }) {
|
|
2496
|
-
const { onClose } =
|
|
2497
|
-
return /* @__PURE__ */
|
|
2498
|
-
/* @__PURE__ */
|
|
3462
|
+
const { onClose } = useContext13(PopupContext);
|
|
3463
|
+
return /* @__PURE__ */ jsxs21("div", { className: "typography-h5 flex h-12 w-full shrink-0 items-start justify-between rounded-t-lg px-6 pt-3 text-text01", children: [
|
|
3464
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1", children: [
|
|
2499
3465
|
before,
|
|
2500
3466
|
children
|
|
2501
3467
|
] }),
|
|
2502
|
-
onClose && /* @__PURE__ */
|
|
3468
|
+
onClose && /* @__PURE__ */ jsx48(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
2503
3469
|
] });
|
|
2504
3470
|
}
|
|
2505
3471
|
|
|
2506
3472
|
// src/popup/popup.tsx
|
|
2507
|
-
import { jsx as
|
|
3473
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
2508
3474
|
var LIMIT_WIDTH2 = 320;
|
|
2509
3475
|
var LIMIT_HEIGHT2 = 184;
|
|
2510
3476
|
function useOptionalPopoverContext() {
|
|
2511
|
-
return
|
|
3477
|
+
return useContext14(PopoverContext);
|
|
2512
3478
|
}
|
|
2513
3479
|
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
2514
3480
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
@@ -2519,7 +3485,7 @@ function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClos
|
|
|
2519
3485
|
if (!isOpen) {
|
|
2520
3486
|
return null;
|
|
2521
3487
|
}
|
|
2522
|
-
return /* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsx49(PopupContext.Provider, { value: { isOpen, onClose }, children: /* @__PURE__ */ jsx49(
|
|
2523
3489
|
"div",
|
|
2524
3490
|
{
|
|
2525
3491
|
className: "grid max-h-full grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-floatingShadow",
|
|
@@ -2533,10 +3499,10 @@ Popup.Header = PopupHeader;
|
|
|
2533
3499
|
Popup.Footer = PopupFooter;
|
|
2534
3500
|
|
|
2535
3501
|
// src/radio/radio.tsx
|
|
2536
|
-
import { focusVisible as
|
|
2537
|
-
import
|
|
2538
|
-
import { useCallback as
|
|
2539
|
-
import { jsx as
|
|
3502
|
+
import { focusVisible as focusVisible12 } from "@zenkigen-inc/component-theme";
|
|
3503
|
+
import clsx34 from "clsx";
|
|
3504
|
+
import { useCallback as useCallback12, useState as useState12 } from "react";
|
|
3505
|
+
import { jsx as jsx50, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2540
3506
|
function Radio({
|
|
2541
3507
|
name,
|
|
2542
3508
|
value,
|
|
@@ -2548,27 +3514,27 @@ function Radio({
|
|
|
2548
3514
|
onChange
|
|
2549
3515
|
}) {
|
|
2550
3516
|
const isLarge = size === "large";
|
|
2551
|
-
const [isMouseOver, setIsMouseOver] =
|
|
2552
|
-
const handleMouseOverInput =
|
|
3517
|
+
const [isMouseOver, setIsMouseOver] = useState12(false);
|
|
3518
|
+
const handleMouseOverInput = useCallback12(() => {
|
|
2553
3519
|
setIsMouseOver(true);
|
|
2554
3520
|
}, []);
|
|
2555
|
-
const handleMouseOutInput =
|
|
3521
|
+
const handleMouseOutInput = useCallback12(() => {
|
|
2556
3522
|
setIsMouseOver(false);
|
|
2557
3523
|
}, []);
|
|
2558
|
-
const handleChange =
|
|
3524
|
+
const handleChange = useCallback12(
|
|
2559
3525
|
(e) => !isDisabled && onChange?.(e),
|
|
2560
3526
|
[isDisabled, onChange]
|
|
2561
3527
|
);
|
|
2562
|
-
const inputClasses =
|
|
3528
|
+
const inputClasses = clsx34("peer absolute z-[1] opacity-0", {
|
|
2563
3529
|
"size-6": !isLarge,
|
|
2564
3530
|
"size-8": isLarge,
|
|
2565
3531
|
"cursor-not-allowed": isDisabled,
|
|
2566
3532
|
"cursor-pointer": !isDisabled
|
|
2567
3533
|
});
|
|
2568
|
-
const boxClasses =
|
|
3534
|
+
const boxClasses = clsx34(
|
|
2569
3535
|
"inline-flex items-center justify-center rounded-full border border-solid bg-white",
|
|
2570
3536
|
{ "size-5": !isLarge, "size-7": isLarge },
|
|
2571
|
-
|
|
3537
|
+
focusVisible12.normalPeer,
|
|
2572
3538
|
{
|
|
2573
3539
|
"border-disabled01 hover:border-disabled01": isDisabled && !isMouseOver,
|
|
2574
3540
|
"border-hoverUiBorder": !isDisabled && isMouseOver,
|
|
@@ -2577,7 +3543,7 @@ function Radio({
|
|
|
2577
3543
|
"cursor-pointer": !isDisabled
|
|
2578
3544
|
}
|
|
2579
3545
|
);
|
|
2580
|
-
const afterClasses =
|
|
3546
|
+
const afterClasses = clsx34(
|
|
2581
3547
|
"absolute inset-0 m-auto block rounded-full",
|
|
2582
3548
|
{ "size-3": !isLarge, "size-4": isLarge },
|
|
2583
3549
|
{
|
|
@@ -2587,22 +3553,22 @@ function Radio({
|
|
|
2587
3553
|
"scale-100": isChecked
|
|
2588
3554
|
}
|
|
2589
3555
|
);
|
|
2590
|
-
const hoverIndicatorClasses =
|
|
3556
|
+
const hoverIndicatorClasses = clsx34(
|
|
2591
3557
|
"inline-block rounded-full",
|
|
2592
3558
|
{ "size-3": !isLarge, "size-4": isLarge },
|
|
2593
3559
|
{
|
|
2594
3560
|
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
2595
3561
|
}
|
|
2596
3562
|
);
|
|
2597
|
-
const labelClasses =
|
|
3563
|
+
const labelClasses = clsx34("ml-2 flex-[1_0_0] select-none break-all", {
|
|
2598
3564
|
"typography-label14regular": !isLarge,
|
|
2599
3565
|
"typography-label16regular": isLarge,
|
|
2600
3566
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
2601
3567
|
"cursor-pointer text-text01": !isDisabled
|
|
2602
3568
|
});
|
|
2603
|
-
return /* @__PURE__ */
|
|
2604
|
-
/* @__PURE__ */
|
|
2605
|
-
/* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsxs22("div", { className: "flex items-center", children: [
|
|
3570
|
+
/* @__PURE__ */ jsxs22("div", { className: clsx34("relative flex items-center justify-center", { "size-6": !isLarge, "size-8": isLarge }), children: [
|
|
3571
|
+
/* @__PURE__ */ jsx50(
|
|
2606
3572
|
"input",
|
|
2607
3573
|
{
|
|
2608
3574
|
type: "checkbox",
|
|
@@ -2617,41 +3583,41 @@ function Radio({
|
|
|
2617
3583
|
className: inputClasses
|
|
2618
3584
|
}
|
|
2619
3585
|
),
|
|
2620
|
-
/* @__PURE__ */
|
|
3586
|
+
/* @__PURE__ */ jsx50("div", { className: boxClasses, children: /* @__PURE__ */ jsxs22(
|
|
2621
3587
|
"div",
|
|
2622
3588
|
{
|
|
2623
|
-
className:
|
|
3589
|
+
className: clsx34("relative flex flex-[0_0_auto] items-center justify-center", {
|
|
2624
3590
|
"size-5": !isLarge,
|
|
2625
3591
|
"size-7": isLarge
|
|
2626
3592
|
}),
|
|
2627
3593
|
children: [
|
|
2628
|
-
/* @__PURE__ */
|
|
2629
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx50("span", { className: afterClasses }),
|
|
3595
|
+
/* @__PURE__ */ jsx50("span", { className: hoverIndicatorClasses })
|
|
2630
3596
|
]
|
|
2631
3597
|
}
|
|
2632
3598
|
) })
|
|
2633
3599
|
] }),
|
|
2634
|
-
/* @__PURE__ */
|
|
3600
|
+
/* @__PURE__ */ jsx50("label", { htmlFor: id, className: labelClasses, children: label })
|
|
2635
3601
|
] });
|
|
2636
3602
|
}
|
|
2637
3603
|
|
|
2638
3604
|
// src/search/search.tsx
|
|
2639
|
-
import { clsx as
|
|
2640
|
-
import { forwardRef as
|
|
2641
|
-
import { jsx as
|
|
2642
|
-
var Search =
|
|
2643
|
-
const classes =
|
|
3605
|
+
import { clsx as clsx35 } from "clsx";
|
|
3606
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
3607
|
+
import { jsx as jsx51, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3608
|
+
var Search = forwardRef12(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
3609
|
+
const classes = clsx35(
|
|
2644
3610
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
2645
3611
|
{ "h-8 px-3": size === "medium" },
|
|
2646
3612
|
{ "h-10 px-4": size === "large" }
|
|
2647
3613
|
);
|
|
2648
|
-
const inputClasses =
|
|
3614
|
+
const inputClasses = clsx35("mx-2 h-full flex-1 text-text01 outline-none placeholder:text-textPlaceholder", {
|
|
2649
3615
|
["typography-label14regular"]: size === "medium",
|
|
2650
3616
|
["typography-label16regular"]: size === "large"
|
|
2651
3617
|
});
|
|
2652
|
-
return /* @__PURE__ */
|
|
2653
|
-
/* @__PURE__ */
|
|
2654
|
-
/* @__PURE__ */
|
|
3618
|
+
return /* @__PURE__ */ jsx51("div", { className: "relative", ref, children: /* @__PURE__ */ jsx51("form", { onSubmit: props.onSubmit, children: /* @__PURE__ */ jsxs23("div", { className: classes, style: { width }, children: [
|
|
3619
|
+
/* @__PURE__ */ jsx51(Icon, { name: "search", color: "icon01", size: "medium" }),
|
|
3620
|
+
/* @__PURE__ */ jsx51(
|
|
2655
3621
|
"input",
|
|
2656
3622
|
{
|
|
2657
3623
|
type: "text",
|
|
@@ -2662,7 +3628,7 @@ var Search = forwardRef10(({ width = "100%", size = "medium", ...props }, ref) =
|
|
|
2662
3628
|
onChange: props.onChange
|
|
2663
3629
|
}
|
|
2664
3630
|
),
|
|
2665
|
-
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */
|
|
3631
|
+
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ jsx51(
|
|
2666
3632
|
IconButton,
|
|
2667
3633
|
{
|
|
2668
3634
|
variant: "text",
|
|
@@ -2677,17 +3643,17 @@ var Search = forwardRef10(({ width = "100%", size = "medium", ...props }, ref) =
|
|
|
2677
3643
|
Search.displayName = "Search";
|
|
2678
3644
|
|
|
2679
3645
|
// src/segmented-control/segmented-control.tsx
|
|
2680
|
-
import React4, { Children as
|
|
3646
|
+
import React4, { Children as Children5, useRef as useRef13 } from "react";
|
|
2681
3647
|
|
|
2682
3648
|
// src/segmented-control/segmented-control-context.ts
|
|
2683
|
-
import { createContext as
|
|
2684
|
-
var SegmentedControlContext =
|
|
3649
|
+
import { createContext as createContext12 } from "react";
|
|
3650
|
+
var SegmentedControlContext = createContext12(null);
|
|
2685
3651
|
|
|
2686
3652
|
// src/segmented-control/segmented-control-item.tsx
|
|
2687
|
-
import { focusVisible as
|
|
2688
|
-
import { clsx as
|
|
2689
|
-
import { useContext as
|
|
2690
|
-
import { jsx as
|
|
3653
|
+
import { focusVisible as focusVisible13 } from "@zenkigen-inc/component-theme";
|
|
3654
|
+
import { clsx as clsx36 } from "clsx";
|
|
3655
|
+
import { useContext as useContext15, useEffect as useEffect11, useRef as useRef12 } from "react";
|
|
3656
|
+
import { jsx as jsx52, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2691
3657
|
var SegmentedControlItem = ({
|
|
2692
3658
|
label,
|
|
2693
3659
|
value,
|
|
@@ -2696,9 +3662,9 @@ var SegmentedControlItem = ({
|
|
|
2696
3662
|
"aria-label": ariaLabel,
|
|
2697
3663
|
...rest
|
|
2698
3664
|
}) => {
|
|
2699
|
-
const context =
|
|
2700
|
-
const buttonRef =
|
|
2701
|
-
const lastInteractionWasMouse =
|
|
3665
|
+
const context = useContext15(SegmentedControlContext);
|
|
3666
|
+
const buttonRef = useRef12(null);
|
|
3667
|
+
const lastInteractionWasMouse = useRef12(false);
|
|
2702
3668
|
if (context === null) {
|
|
2703
3669
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
2704
3670
|
}
|
|
@@ -2714,7 +3680,7 @@ var SegmentedControlItem = ({
|
|
|
2714
3680
|
const isSelected = value === selectedValue;
|
|
2715
3681
|
const isFocused = value === focusedValue;
|
|
2716
3682
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
2717
|
-
|
|
3683
|
+
useEffect11(() => {
|
|
2718
3684
|
if (isFocused === true && buttonRef.current !== null) {
|
|
2719
3685
|
buttonRef.current.focus();
|
|
2720
3686
|
}
|
|
@@ -2736,7 +3702,7 @@ var SegmentedControlItem = ({
|
|
|
2736
3702
|
lastInteractionWasMouse.current = false;
|
|
2737
3703
|
onBlur?.();
|
|
2738
3704
|
};
|
|
2739
|
-
const buttonClasses =
|
|
3705
|
+
const buttonClasses = clsx36("relative flex items-center justify-center gap-1 rounded", focusVisible13.normal, {
|
|
2740
3706
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
2741
3707
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
2742
3708
|
// States - Default with hover
|
|
@@ -2746,7 +3712,7 @@ var SegmentedControlItem = ({
|
|
|
2746
3712
|
// States - Disabled
|
|
2747
3713
|
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
2748
3714
|
});
|
|
2749
|
-
return /* @__PURE__ */
|
|
3715
|
+
return /* @__PURE__ */ jsxs24(
|
|
2750
3716
|
"button",
|
|
2751
3717
|
{
|
|
2752
3718
|
ref: buttonRef,
|
|
@@ -2763,25 +3729,25 @@ var SegmentedControlItem = ({
|
|
|
2763
3729
|
onMouseDown: handleMouseDown,
|
|
2764
3730
|
...rest,
|
|
2765
3731
|
children: [
|
|
2766
|
-
Boolean(icon) === true && icon && /* @__PURE__ */
|
|
3732
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ jsx52(
|
|
2767
3733
|
"span",
|
|
2768
3734
|
{
|
|
2769
|
-
className:
|
|
3735
|
+
className: clsx36("flex items-center", {
|
|
2770
3736
|
"fill-disabled01": isOptionDisabled === true,
|
|
2771
3737
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
2772
3738
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
2773
3739
|
}),
|
|
2774
|
-
children: /* @__PURE__ */
|
|
3740
|
+
children: /* @__PURE__ */ jsx52(Icon, { name: icon, size: "small" })
|
|
2775
3741
|
}
|
|
2776
3742
|
),
|
|
2777
|
-
Boolean(label) === true && /* @__PURE__ */
|
|
3743
|
+
Boolean(label) === true && /* @__PURE__ */ jsx52("span", { className: "whitespace-nowrap", children: label })
|
|
2778
3744
|
]
|
|
2779
3745
|
}
|
|
2780
3746
|
);
|
|
2781
3747
|
};
|
|
2782
3748
|
|
|
2783
3749
|
// src/segmented-control/segmented-control.tsx
|
|
2784
|
-
import { Fragment as
|
|
3750
|
+
import { Fragment as Fragment6, jsx as jsx53 } from "react/jsx-runtime";
|
|
2785
3751
|
var SegmentedControl = ({
|
|
2786
3752
|
children,
|
|
2787
3753
|
value,
|
|
@@ -2791,15 +3757,15 @@ var SegmentedControl = ({
|
|
|
2791
3757
|
"aria-label": ariaLabel,
|
|
2792
3758
|
...rest
|
|
2793
3759
|
}) => {
|
|
2794
|
-
const containerRef =
|
|
2795
|
-
const itemIds =
|
|
3760
|
+
const containerRef = useRef13(null);
|
|
3761
|
+
const itemIds = Children5.toArray(children).filter((child) => {
|
|
2796
3762
|
if (!React4.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
2797
3763
|
return false;
|
|
2798
3764
|
}
|
|
2799
3765
|
const props = child.props;
|
|
2800
3766
|
return props.isDisabled !== true;
|
|
2801
3767
|
}).map((child) => child.props.value);
|
|
2802
|
-
const childrenCount =
|
|
3768
|
+
const childrenCount = Children5.count(children);
|
|
2803
3769
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
2804
3770
|
const {
|
|
2805
3771
|
focusedValue,
|
|
@@ -2826,7 +3792,7 @@ var SegmentedControl = ({
|
|
|
2826
3792
|
onBlur: handleBlurRovingFocus,
|
|
2827
3793
|
values: itemIds
|
|
2828
3794
|
};
|
|
2829
|
-
return /* @__PURE__ */
|
|
3795
|
+
return /* @__PURE__ */ jsx53(Fragment6, { children: /* @__PURE__ */ jsx53(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx53(
|
|
2830
3796
|
"div",
|
|
2831
3797
|
{
|
|
2832
3798
|
ref: containerRef,
|
|
@@ -2843,37 +3809,39 @@ var SegmentedControl = ({
|
|
|
2843
3809
|
SegmentedControl.Item = SegmentedControlItem;
|
|
2844
3810
|
|
|
2845
3811
|
// src/select-sort/select-sort.tsx
|
|
2846
|
-
import { buttonColors as buttonColors4, focusVisible as
|
|
2847
|
-
import
|
|
2848
|
-
import { useCallback as
|
|
3812
|
+
import { buttonColors as buttonColors4, focusVisible as focusVisible16 } from "@zenkigen-inc/component-theme";
|
|
3813
|
+
import clsx39 from "clsx";
|
|
3814
|
+
import { useCallback as useCallback13, useRef as useRef14, useState as useState13 } from "react";
|
|
2849
3815
|
|
|
2850
3816
|
// src/select-sort/select-list.tsx
|
|
2851
|
-
import { focusVisible as
|
|
2852
|
-
import
|
|
3817
|
+
import { focusVisible as focusVisible15 } from "@zenkigen-inc/component-theme";
|
|
3818
|
+
import clsx38 from "clsx";
|
|
2853
3819
|
|
|
2854
3820
|
// src/select-sort/select-item.tsx
|
|
2855
|
-
import { focusVisible as
|
|
2856
|
-
import
|
|
2857
|
-
import { jsx as
|
|
2858
|
-
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
2859
|
-
const itemClasses =
|
|
2860
|
-
"typography-label14regular flex
|
|
2861
|
-
|
|
3821
|
+
import { focusVisible as focusVisible14 } from "@zenkigen-inc/component-theme";
|
|
3822
|
+
import clsx37 from "clsx";
|
|
3823
|
+
import { jsx as jsx54, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3824
|
+
function SelectItem2({ children, isSortKey, size, onClickItem }) {
|
|
3825
|
+
const itemClasses = clsx37(
|
|
3826
|
+
"typography-label14regular flex w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
3827
|
+
focusVisible14.inset,
|
|
2862
3828
|
{
|
|
3829
|
+
"h-8": size !== "large",
|
|
3830
|
+
"h-10": size === "large",
|
|
2863
3831
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
2864
3832
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
2865
3833
|
}
|
|
2866
3834
|
);
|
|
2867
|
-
return /* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2869
|
-
isSortKey && /* @__PURE__ */
|
|
3835
|
+
return /* @__PURE__ */ jsx54("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ jsxs25("button", { className: itemClasses, type: "button", children: [
|
|
3836
|
+
/* @__PURE__ */ jsx54("span", { className: "ml-1 mr-6", children }),
|
|
3837
|
+
isSortKey && /* @__PURE__ */ jsx54("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx54(Icon, { name: "check", size: "small" }) })
|
|
2870
3838
|
] }) });
|
|
2871
3839
|
}
|
|
2872
3840
|
|
|
2873
3841
|
// src/select-sort/select-list.tsx
|
|
2874
|
-
import { jsx as
|
|
3842
|
+
import { jsx as jsx55, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2875
3843
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
2876
|
-
const listClasses =
|
|
3844
|
+
const listClasses = clsx38(
|
|
2877
3845
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
2878
3846
|
{
|
|
2879
3847
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -2882,19 +3850,23 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
2882
3850
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
2883
3851
|
}
|
|
2884
3852
|
);
|
|
2885
|
-
const deselectButtonClasses =
|
|
2886
|
-
"typography-label14regular flex
|
|
2887
|
-
|
|
3853
|
+
const deselectButtonClasses = clsx38(
|
|
3854
|
+
"typography-label14regular flex w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
3855
|
+
focusVisible15.inset,
|
|
3856
|
+
{
|
|
3857
|
+
"h-8": size !== "large",
|
|
3858
|
+
"h-10": size === "large"
|
|
3859
|
+
}
|
|
2888
3860
|
);
|
|
2889
|
-
return /* @__PURE__ */
|
|
2890
|
-
/* @__PURE__ */
|
|
2891
|
-
/* @__PURE__ */
|
|
2892
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */
|
|
3861
|
+
return /* @__PURE__ */ jsxs26("ul", { className: listClasses, children: [
|
|
3862
|
+
/* @__PURE__ */ jsx55(SelectItem2, { size, isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
3863
|
+
/* @__PURE__ */ jsx55(SelectItem2, { size, isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
3864
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ jsx55("li", { children: /* @__PURE__ */ jsx55("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
2893
3865
|
] });
|
|
2894
3866
|
}
|
|
2895
3867
|
|
|
2896
3868
|
// src/select-sort/select-sort.tsx
|
|
2897
|
-
import { jsx as
|
|
3869
|
+
import { jsx as jsx56, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2898
3870
|
function SelectSort({
|
|
2899
3871
|
size = "medium",
|
|
2900
3872
|
variant = "outline",
|
|
@@ -2906,8 +3878,8 @@ function SelectSort({
|
|
|
2906
3878
|
onChange,
|
|
2907
3879
|
onClickDeselect
|
|
2908
3880
|
}) {
|
|
2909
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
2910
|
-
const targetRef =
|
|
3881
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState13(false);
|
|
3882
|
+
const targetRef = useRef14(null);
|
|
2911
3883
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
2912
3884
|
useDismissOnModalOpen(() => {
|
|
2913
3885
|
if (isOptionListOpen) {
|
|
@@ -2915,25 +3887,25 @@ function SelectSort({
|
|
|
2915
3887
|
}
|
|
2916
3888
|
});
|
|
2917
3889
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
2918
|
-
const handleClickItem =
|
|
3890
|
+
const handleClickItem = useCallback13(
|
|
2919
3891
|
(value) => {
|
|
2920
3892
|
onChange?.(value);
|
|
2921
3893
|
setIsOptionListOpen(false);
|
|
2922
3894
|
},
|
|
2923
3895
|
[onChange]
|
|
2924
3896
|
);
|
|
2925
|
-
const wrapperClasses =
|
|
3897
|
+
const wrapperClasses = clsx39("relative flex shrink-0 items-center gap-1 rounded", {
|
|
2926
3898
|
"h-6": size === "x-small" || size === "small",
|
|
2927
3899
|
"h-8": size === "medium",
|
|
2928
3900
|
"h-10": size === "large",
|
|
2929
3901
|
"cursor-not-allowed": isDisabled
|
|
2930
3902
|
});
|
|
2931
|
-
const buttonClasses =
|
|
3903
|
+
const buttonClasses = clsx39(
|
|
2932
3904
|
"flex size-full items-center rounded",
|
|
2933
3905
|
buttonColors4[variant].hover,
|
|
2934
3906
|
buttonColors4[variant].active,
|
|
2935
3907
|
buttonColors4[variant].disabled,
|
|
2936
|
-
|
|
3908
|
+
focusVisible16.normal,
|
|
2937
3909
|
{
|
|
2938
3910
|
[buttonColors4[variant].selected]: isSortKey,
|
|
2939
3911
|
[buttonColors4[variant].base]: !isSortKey,
|
|
@@ -2942,23 +3914,23 @@ function SelectSort({
|
|
|
2942
3914
|
"pointer-events-none": isDisabled
|
|
2943
3915
|
}
|
|
2944
3916
|
);
|
|
2945
|
-
const labelClasses =
|
|
3917
|
+
const labelClasses = clsx39("truncate", {
|
|
2946
3918
|
"typography-label12regular": size === "x-small",
|
|
2947
3919
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2948
3920
|
"typography-label16regular": size === "large",
|
|
2949
3921
|
"mr-1": size === "x-small",
|
|
2950
3922
|
"mr-2": size !== "x-small"
|
|
2951
3923
|
});
|
|
2952
|
-
return /* @__PURE__ */
|
|
2953
|
-
/* @__PURE__ */
|
|
2954
|
-
/* @__PURE__ */
|
|
2955
|
-
/* @__PURE__ */
|
|
3924
|
+
return /* @__PURE__ */ jsxs27("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
3925
|
+
/* @__PURE__ */ jsxs27("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
3926
|
+
/* @__PURE__ */ jsx56("div", { className: labelClasses, children: label }),
|
|
3927
|
+
/* @__PURE__ */ jsx56("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ jsx56(
|
|
2956
3928
|
Icon,
|
|
2957
3929
|
{
|
|
2958
3930
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
2959
3931
|
size: size === "large" ? "medium" : "small"
|
|
2960
3932
|
}
|
|
2961
|
-
) : /* @__PURE__ */
|
|
3933
|
+
) : /* @__PURE__ */ jsx56(
|
|
2962
3934
|
Icon,
|
|
2963
3935
|
{
|
|
2964
3936
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -2966,7 +3938,7 @@ function SelectSort({
|
|
|
2966
3938
|
}
|
|
2967
3939
|
) })
|
|
2968
3940
|
] }),
|
|
2969
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */
|
|
3941
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx56(
|
|
2970
3942
|
SelectList2,
|
|
2971
3943
|
{
|
|
2972
3944
|
size,
|
|
@@ -2980,10 +3952,10 @@ function SelectSort({
|
|
|
2980
3952
|
}
|
|
2981
3953
|
|
|
2982
3954
|
// src/sort-button/sort-button.tsx
|
|
2983
|
-
import { buttonColors as buttonColors5, focusVisible as
|
|
2984
|
-
import
|
|
2985
|
-
import { useCallback as
|
|
2986
|
-
import { jsx as
|
|
3955
|
+
import { buttonColors as buttonColors5, focusVisible as focusVisible17 } from "@zenkigen-inc/component-theme";
|
|
3956
|
+
import clsx40 from "clsx";
|
|
3957
|
+
import { useCallback as useCallback14 } from "react";
|
|
3958
|
+
import { jsx as jsx57, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2987
3959
|
function SortButton({
|
|
2988
3960
|
size = "medium",
|
|
2989
3961
|
width,
|
|
@@ -2994,7 +3966,7 @@ function SortButton({
|
|
|
2994
3966
|
"aria-label": ariaLabel,
|
|
2995
3967
|
...rest
|
|
2996
3968
|
}) {
|
|
2997
|
-
const handleClick =
|
|
3969
|
+
const handleClick = useCallback14(() => {
|
|
2998
3970
|
if (isDisabled || !onClick) return;
|
|
2999
3971
|
onClick();
|
|
3000
3972
|
}, [isDisabled, onClick]);
|
|
@@ -3003,18 +3975,18 @@ function SortButton({
|
|
|
3003
3975
|
if (sortOrder === "descend") return "arrow-down";
|
|
3004
3976
|
return "angle-small-down";
|
|
3005
3977
|
};
|
|
3006
|
-
const wrapperClasses =
|
|
3978
|
+
const wrapperClasses = clsx40("relative flex shrink-0 items-center gap-1 rounded", {
|
|
3007
3979
|
"h-6": size === "x-small" || size === "small",
|
|
3008
3980
|
"h-8": size === "medium",
|
|
3009
3981
|
"h-10": size === "large",
|
|
3010
3982
|
"cursor-not-allowed": isDisabled
|
|
3011
3983
|
});
|
|
3012
|
-
const buttonClasses =
|
|
3984
|
+
const buttonClasses = clsx40(
|
|
3013
3985
|
"flex size-full items-center rounded",
|
|
3014
3986
|
buttonColors5.text.hover,
|
|
3015
3987
|
buttonColors5.text.active,
|
|
3016
3988
|
buttonColors5.text.disabled,
|
|
3017
|
-
|
|
3989
|
+
focusVisible17.normal,
|
|
3018
3990
|
{
|
|
3019
3991
|
[buttonColors5.text.selected]: !isDisabled && sortOrder !== null,
|
|
3020
3992
|
// ソート状態時は選択状態のスタイル
|
|
@@ -3025,14 +3997,14 @@ function SortButton({
|
|
|
3025
3997
|
"pointer-events-none": isDisabled
|
|
3026
3998
|
}
|
|
3027
3999
|
);
|
|
3028
|
-
const labelClasses =
|
|
4000
|
+
const labelClasses = clsx40("truncate", {
|
|
3029
4001
|
"typography-label12regular": size === "x-small",
|
|
3030
4002
|
"typography-label14regular": size === "small" || size === "medium",
|
|
3031
4003
|
"typography-label16regular": size === "large",
|
|
3032
4004
|
"mr-1": size === "x-small",
|
|
3033
4005
|
"mr-2": size !== "x-small"
|
|
3034
4006
|
});
|
|
3035
|
-
return /* @__PURE__ */
|
|
4007
|
+
return /* @__PURE__ */ jsx57("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ jsxs28(
|
|
3036
4008
|
"button",
|
|
3037
4009
|
{
|
|
3038
4010
|
className: buttonClasses,
|
|
@@ -3043,22 +4015,265 @@ function SortButton({
|
|
|
3043
4015
|
"aria-label": ariaLabel,
|
|
3044
4016
|
"aria-disabled": isDisabled,
|
|
3045
4017
|
children: [
|
|
3046
|
-
/* @__PURE__ */
|
|
3047
|
-
/* @__PURE__ */
|
|
4018
|
+
/* @__PURE__ */ jsx57("div", { className: labelClasses, children: label }),
|
|
4019
|
+
/* @__PURE__ */ jsx57("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx57(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
3048
4020
|
]
|
|
3049
4021
|
}
|
|
3050
4022
|
) });
|
|
3051
4023
|
}
|
|
3052
4024
|
|
|
4025
|
+
// src/steps/steps.tsx
|
|
4026
|
+
import { clsx as clsx43 } from "clsx";
|
|
4027
|
+
import { Children as Children6, Fragment as Fragment7, isValidElement as isValidElement5, useId as useId5, useMemo as useMemo6, useState as useState14 } from "react";
|
|
4028
|
+
|
|
4029
|
+
// src/steps/steps-context.ts
|
|
4030
|
+
import { createContext as createContext13, useContext as useContext16 } from "react";
|
|
4031
|
+
var StepsContext = createContext13(null);
|
|
4032
|
+
function useStepsContext() {
|
|
4033
|
+
const context = useContext16(StepsContext);
|
|
4034
|
+
if (context === null) {
|
|
4035
|
+
throw new Error("Steps.Item must be used within <Steps>");
|
|
4036
|
+
}
|
|
4037
|
+
return context;
|
|
4038
|
+
}
|
|
4039
|
+
|
|
4040
|
+
// src/steps/steps-item.tsx
|
|
4041
|
+
import { clsx as clsx42 } from "clsx";
|
|
4042
|
+
|
|
4043
|
+
// src/steps/steps-item-context.ts
|
|
4044
|
+
import { createContext as createContext14, useContext as useContext17 } from "react";
|
|
4045
|
+
var StepsItemContext = createContext14(null);
|
|
4046
|
+
function useStepsItemContext() {
|
|
4047
|
+
const context = useContext17(StepsItemContext);
|
|
4048
|
+
if (context === null) {
|
|
4049
|
+
throw new Error("Steps.Item must be rendered inside a <Steps> component");
|
|
4050
|
+
}
|
|
4051
|
+
return context;
|
|
4052
|
+
}
|
|
4053
|
+
|
|
4054
|
+
// src/steps/steps-separator.tsx
|
|
4055
|
+
import { clsx as clsx41 } from "clsx";
|
|
4056
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
4057
|
+
function StepsSeparator({ progress }) {
|
|
4058
|
+
const { orientation } = useStepsContext();
|
|
4059
|
+
const isVerticalLine = orientation === "vertical";
|
|
4060
|
+
const colorClass = progress === "completed" ? "bg-interactive01" : "bg-uiBorder01";
|
|
4061
|
+
if (isVerticalLine) {
|
|
4062
|
+
return /* @__PURE__ */ jsx58("div", { "aria-hidden": "true", className: clsx41("mx-auto h-full min-h-2 w-px", colorClass) });
|
|
4063
|
+
}
|
|
4064
|
+
return /* @__PURE__ */ jsx58("div", { "aria-hidden": "true", className: clsx41("h-px flex-1", colorClass) });
|
|
4065
|
+
}
|
|
4066
|
+
|
|
4067
|
+
// src/steps/steps-item.tsx
|
|
4068
|
+
import { jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
4069
|
+
var progressSrOnlyLabel = {
|
|
4070
|
+
completed: "\u5B8C\u4E86: ",
|
|
4071
|
+
current: "\u73FE\u5728\u306E\u30B9\u30C6\u30C3\u30D7: ",
|
|
4072
|
+
upcoming: "\u672A\u7740\u624B: "
|
|
4073
|
+
};
|
|
4074
|
+
function getCircleSizeClass(size) {
|
|
4075
|
+
return clsx42({
|
|
4076
|
+
"size-6 typography-label12regular": size === "small",
|
|
4077
|
+
"size-8 typography-label12regular": size === "medium",
|
|
4078
|
+
"size-10 typography-label16regular": size === "large"
|
|
4079
|
+
});
|
|
4080
|
+
}
|
|
4081
|
+
function getCircleVariantProgressClass(variant, progress) {
|
|
4082
|
+
return clsx42({
|
|
4083
|
+
// subtle(全 state border-transparent で box-sizing を揃える)
|
|
4084
|
+
"bg-uiBackground02 text-text01 border-transparent": variant === "subtle" && progress === "upcoming",
|
|
4085
|
+
"bg-activeUi text-text01 border-transparent": variant === "subtle" && progress === "current",
|
|
4086
|
+
"bg-supportInfoLight text-text01 border-transparent": variant === "subtle" && progress === "completed",
|
|
4087
|
+
// solid
|
|
4088
|
+
"bg-uiBackground01 text-text01 border-uiBorder01": variant === "solid" && progress === "upcoming",
|
|
4089
|
+
"bg-activeUi text-text01 border-interactive01": variant === "solid" && progress === "current",
|
|
4090
|
+
"bg-interactive01 text-iconOnColor border-transparent": variant === "solid" && progress === "completed"
|
|
4091
|
+
});
|
|
4092
|
+
}
|
|
4093
|
+
function getCircleClasses(size, variant, state) {
|
|
4094
|
+
return clsx42(
|
|
4095
|
+
"box-border flex items-center justify-center rounded-full border-2",
|
|
4096
|
+
getCircleSizeClass(size),
|
|
4097
|
+
getCircleVariantProgressClass(variant, state.progress)
|
|
4098
|
+
// 将来追加: state.isError && getCircleErrorOverlay(variant)
|
|
4099
|
+
// 将来追加: state.isDisabled && getCircleDisabledOverlay()
|
|
4100
|
+
);
|
|
4101
|
+
}
|
|
4102
|
+
function getIconSize(size) {
|
|
4103
|
+
if (size === "small") return "medium";
|
|
4104
|
+
if (size === "medium") return "large";
|
|
4105
|
+
return "x-large";
|
|
4106
|
+
}
|
|
4107
|
+
function StepsItem({ label, description }) {
|
|
4108
|
+
const { size, orientation, textOrientation, variant } = useStepsContext();
|
|
4109
|
+
const { state, index, isLast, id } = useStepsItemContext();
|
|
4110
|
+
const isCircleFilled = state.progress === "completed";
|
|
4111
|
+
const circleClasses = getCircleClasses(size, variant, state);
|
|
4112
|
+
const checkIcon = variant === "solid" ? /* @__PURE__ */ jsx59(Icon, { name: "check", size: getIconSize(size), color: "iconOnColor" }) : /* @__PURE__ */ jsx59(Icon, { name: "check", size: getIconSize(size), className: "fill-gray-gray100" });
|
|
4113
|
+
const circle = /* @__PURE__ */ jsx59("span", { "aria-hidden": "true", className: circleClasses, children: isCircleFilled ? checkIcon : /* @__PURE__ */ jsx59("span", { children: index + 1 }) });
|
|
4114
|
+
const labelBlock = /* @__PURE__ */ jsxs29("span", { className: clsx42("flex flex-col", textOrientation === "horizontal" ? "gap-1" : "items-center text-center"), children: [
|
|
4115
|
+
/* @__PURE__ */ jsxs29(
|
|
4116
|
+
"span",
|
|
4117
|
+
{
|
|
4118
|
+
className: clsx42(
|
|
4119
|
+
"whitespace-nowrap text-text01",
|
|
4120
|
+
size === "large" ? "typography-body16regular" : "typography-body14regular"
|
|
4121
|
+
),
|
|
4122
|
+
children: [
|
|
4123
|
+
/* @__PURE__ */ jsx59("span", { className: "sr-only", children: progressSrOnlyLabel[state.progress] }),
|
|
4124
|
+
label
|
|
4125
|
+
]
|
|
4126
|
+
}
|
|
4127
|
+
),
|
|
4128
|
+
description != null && /* @__PURE__ */ jsx59("span", { className: "typography-label12regular whitespace-nowrap text-text02", children: description })
|
|
4129
|
+
] });
|
|
4130
|
+
const ariaCurrentProps = state.progress === "current" ? { "aria-current": "step" } : {};
|
|
4131
|
+
if (orientation === "horizontal" && textOrientation === "horizontal") {
|
|
4132
|
+
return /* @__PURE__ */ jsx59("li", { ...ariaCurrentProps, id, children: /* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-2", children: [
|
|
4133
|
+
circle,
|
|
4134
|
+
labelBlock
|
|
4135
|
+
] }) });
|
|
4136
|
+
}
|
|
4137
|
+
if (orientation === "horizontal" && textOrientation === "vertical") {
|
|
4138
|
+
return /* @__PURE__ */ jsx59("li", { ...ariaCurrentProps, id, children: /* @__PURE__ */ jsxs29("div", { className: "flex flex-col items-center gap-1", children: [
|
|
4139
|
+
circle,
|
|
4140
|
+
labelBlock
|
|
4141
|
+
] }) });
|
|
4142
|
+
}
|
|
4143
|
+
if (orientation === "vertical" && textOrientation === "horizontal") {
|
|
4144
|
+
return /* @__PURE__ */ jsxs29(
|
|
4145
|
+
"li",
|
|
4146
|
+
{
|
|
4147
|
+
...ariaCurrentProps,
|
|
4148
|
+
className: clsx42(
|
|
4149
|
+
"grid grid-cols-[min-content_1fr] grid-rows-[auto_1fr] items-center gap-x-2",
|
|
4150
|
+
!isLast && "flex-1"
|
|
4151
|
+
),
|
|
4152
|
+
id,
|
|
4153
|
+
children: [
|
|
4154
|
+
/* @__PURE__ */ jsx59("div", { className: "col-start-1 row-start-1 flex items-center", children: circle }),
|
|
4155
|
+
/* @__PURE__ */ jsx59("div", { className: "col-start-2 row-start-1 flex items-center", children: labelBlock }),
|
|
4156
|
+
!isLast && /* @__PURE__ */ jsx59("div", { className: "col-start-1 row-start-2 flex items-stretch justify-center self-stretch py-2", children: /* @__PURE__ */ jsx59(StepsSeparator, { progress: state.progress }) })
|
|
4157
|
+
]
|
|
4158
|
+
}
|
|
4159
|
+
);
|
|
4160
|
+
}
|
|
4161
|
+
return /* @__PURE__ */ jsxs29("li", { ...ariaCurrentProps, className: clsx42("flex flex-col items-center gap-1", !isLast && "flex-1"), id, children: [
|
|
4162
|
+
circle,
|
|
4163
|
+
labelBlock,
|
|
4164
|
+
!isLast && /* @__PURE__ */ jsx59("div", { className: "flex flex-1 items-stretch self-stretch py-2", children: /* @__PURE__ */ jsx59(StepsSeparator, { progress: state.progress }) })
|
|
4165
|
+
] });
|
|
4166
|
+
}
|
|
4167
|
+
StepsItem.displayName = "Steps.Item";
|
|
4168
|
+
|
|
4169
|
+
// src/steps/steps.tsx
|
|
4170
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
4171
|
+
function getSeparatorCellHeightClass(size) {
|
|
4172
|
+
if (size === "small") return "h-6";
|
|
4173
|
+
if (size === "medium") return "h-8";
|
|
4174
|
+
return "h-10";
|
|
4175
|
+
}
|
|
4176
|
+
function HorizontalSeparatorCell({
|
|
4177
|
+
progress,
|
|
4178
|
+
size,
|
|
4179
|
+
textOrientation
|
|
4180
|
+
}) {
|
|
4181
|
+
const heightClass = getSeparatorCellHeightClass(size);
|
|
4182
|
+
const alignClass = textOrientation === "vertical" ? "self-start" : "";
|
|
4183
|
+
return /* @__PURE__ */ jsx60("li", { "aria-hidden": "true", className: clsx43("flex items-center", heightClass, alignClass), role: "presentation", children: /* @__PURE__ */ jsx60(StepsSeparator, { progress }) });
|
|
4184
|
+
}
|
|
4185
|
+
function collectStepsItems(children) {
|
|
4186
|
+
const result = [];
|
|
4187
|
+
Children6.toArray(children).forEach((child) => {
|
|
4188
|
+
if (!isValidElement5(child)) {
|
|
4189
|
+
return;
|
|
4190
|
+
}
|
|
4191
|
+
if (child.type === StepsItem) {
|
|
4192
|
+
result.push(child);
|
|
4193
|
+
return;
|
|
4194
|
+
}
|
|
4195
|
+
if (child.type === Fragment7) {
|
|
4196
|
+
const fragmentChildren = child.props.children;
|
|
4197
|
+
result.push(...collectStepsItems(fragmentChildren));
|
|
4198
|
+
}
|
|
4199
|
+
});
|
|
4200
|
+
return result;
|
|
4201
|
+
}
|
|
4202
|
+
function StepsRoot({
|
|
4203
|
+
children,
|
|
4204
|
+
currentStep,
|
|
4205
|
+
defaultCurrentStep,
|
|
4206
|
+
size = "medium",
|
|
4207
|
+
orientation = "horizontal",
|
|
4208
|
+
textOrientation = "horizontal",
|
|
4209
|
+
variant = "solid",
|
|
4210
|
+
"aria-label": ariaLabel
|
|
4211
|
+
}) {
|
|
4212
|
+
const baseId = useId5();
|
|
4213
|
+
const [internalStep] = useState14(defaultCurrentStep ?? 0);
|
|
4214
|
+
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4215
|
+
const itemElements = useMemo6(() => collectStepsItems(children), [children]);
|
|
4216
|
+
const stepsCount = itemElements.length;
|
|
4217
|
+
const contextValue = useMemo6(
|
|
4218
|
+
() => ({
|
|
4219
|
+
size,
|
|
4220
|
+
orientation,
|
|
4221
|
+
textOrientation,
|
|
4222
|
+
variant
|
|
4223
|
+
}),
|
|
4224
|
+
[size, orientation, textOrientation, variant]
|
|
4225
|
+
);
|
|
4226
|
+
if (stepsCount === 0) {
|
|
4227
|
+
return null;
|
|
4228
|
+
}
|
|
4229
|
+
const states = itemElements.map((_item, index) => ({
|
|
4230
|
+
progress: index < resolvedCurrentStep ? "completed" : index === resolvedCurrentStep ? "current" : "upcoming"
|
|
4231
|
+
}));
|
|
4232
|
+
const wrapItem = (item, index) => {
|
|
4233
|
+
const state = states[index] ?? { progress: "upcoming" };
|
|
4234
|
+
const isLast = index === stepsCount - 1;
|
|
4235
|
+
const id = `${baseId}-item-${index}`;
|
|
4236
|
+
return /* @__PURE__ */ jsx60(StepsItemContext.Provider, { value: { index, state, isLast, id }, children: item }, item.key ?? `item-${index}`);
|
|
4237
|
+
};
|
|
4238
|
+
const renderedChildren = orientation === "horizontal" ? itemElements.flatMap((item, index) => {
|
|
4239
|
+
const nodes = [wrapItem(item, index)];
|
|
4240
|
+
if (index < stepsCount - 1) {
|
|
4241
|
+
nodes.push(
|
|
4242
|
+
/* @__PURE__ */ jsx60(
|
|
4243
|
+
HorizontalSeparatorCell,
|
|
4244
|
+
{
|
|
4245
|
+
progress: states[index]?.progress ?? "upcoming",
|
|
4246
|
+
size,
|
|
4247
|
+
textOrientation
|
|
4248
|
+
},
|
|
4249
|
+
`sep-${index}`
|
|
4250
|
+
)
|
|
4251
|
+
);
|
|
4252
|
+
}
|
|
4253
|
+
return nodes;
|
|
4254
|
+
}) : itemElements.map((item, index) => wrapItem(item, index));
|
|
4255
|
+
const listClassName = clsx43(
|
|
4256
|
+
orientation === "horizontal" ? ["grid w-full gap-x-2", textOrientation === "vertical" ? "items-start" : "items-center"] : "flex flex-col items-stretch"
|
|
4257
|
+
);
|
|
4258
|
+
const horizontalGridTemplate = Array.from(
|
|
4259
|
+
{ length: stepsCount },
|
|
4260
|
+
(_unused, index) => index === stepsCount - 1 ? "max-content" : "max-content minmax(8px, 1fr)"
|
|
4261
|
+
).join(" ");
|
|
4262
|
+
const listStyleProps = orientation === "horizontal" ? { style: { gridTemplateColumns: horizontalGridTemplate } } : {};
|
|
4263
|
+
return /* @__PURE__ */ jsx60(StepsContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx60("ol", { "aria-label": ariaLabel, className: listClassName, role: "list", ...listStyleProps, children: renderedChildren }) });
|
|
4264
|
+
}
|
|
4265
|
+
var Steps = StepsRoot;
|
|
4266
|
+
Steps.Item = StepsItem;
|
|
4267
|
+
|
|
3053
4268
|
// src/tab/tab.tsx
|
|
3054
|
-
import { clsx as
|
|
3055
|
-
import { Children as
|
|
4269
|
+
import { clsx as clsx45 } from "clsx";
|
|
4270
|
+
import { Children as Children7 } from "react";
|
|
3056
4271
|
|
|
3057
4272
|
// src/tab/tab-item.tsx
|
|
3058
|
-
import { clsx as
|
|
3059
|
-
import { jsx as
|
|
4273
|
+
import { clsx as clsx44 } from "clsx";
|
|
4274
|
+
import { jsx as jsx61, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3060
4275
|
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
3061
|
-
const classes =
|
|
4276
|
+
const classes = clsx44(
|
|
3062
4277
|
"group relative z-0 flex items-center justify-center gap-1 py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-[2px] hover:text-interactive01 disabled:pointer-events-none disabled:text-disabled01",
|
|
3063
4278
|
{
|
|
3064
4279
|
"typography-label14regular text-interactive02": !isSelected,
|
|
@@ -3066,12 +4281,12 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
3066
4281
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
3067
4282
|
}
|
|
3068
4283
|
);
|
|
3069
|
-
const iconWrapperClasses =
|
|
4284
|
+
const iconWrapperClasses = clsx44("flex shrink-0 items-center", {
|
|
3070
4285
|
"fill-disabled01": isDisabled,
|
|
3071
4286
|
"fill-interactive01": !isDisabled && isSelected,
|
|
3072
4287
|
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
3073
4288
|
});
|
|
3074
|
-
return /* @__PURE__ */
|
|
4289
|
+
return /* @__PURE__ */ jsxs30(
|
|
3075
4290
|
"button",
|
|
3076
4291
|
{
|
|
3077
4292
|
type: "button",
|
|
@@ -3081,7 +4296,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
3081
4296
|
disabled: isDisabled,
|
|
3082
4297
|
onClick: () => props.onClick(props.id),
|
|
3083
4298
|
children: [
|
|
3084
|
-
icon != null && /* @__PURE__ */
|
|
4299
|
+
icon != null && /* @__PURE__ */ jsx61("span", { className: iconWrapperClasses, children: /* @__PURE__ */ jsx61(Icon, { name: icon, size: "small" }) }),
|
|
3085
4300
|
props.children
|
|
3086
4301
|
]
|
|
3087
4302
|
}
|
|
@@ -3089,39 +4304,39 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
3089
4304
|
};
|
|
3090
4305
|
|
|
3091
4306
|
// src/tab/tab.tsx
|
|
3092
|
-
import { jsx as
|
|
4307
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
3093
4308
|
function Tab({ children, layout = "auto" }) {
|
|
3094
|
-
const childrenCount =
|
|
4309
|
+
const childrenCount = Children7.count(children);
|
|
3095
4310
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
3096
|
-
const containerClasses =
|
|
4311
|
+
const containerClasses = clsx45(
|
|
3097
4312
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
3098
4313
|
{
|
|
3099
4314
|
flex: layout === "auto",
|
|
3100
4315
|
grid: layout === "equal"
|
|
3101
4316
|
}
|
|
3102
4317
|
);
|
|
3103
|
-
return /* @__PURE__ */
|
|
4318
|
+
return /* @__PURE__ */ jsx62("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
3104
4319
|
}
|
|
3105
4320
|
Tab.Item = TabItem;
|
|
3106
4321
|
|
|
3107
4322
|
// src/table/table-cell.tsx
|
|
3108
|
-
import
|
|
3109
|
-
import { jsx as
|
|
4323
|
+
import clsx46 from "clsx";
|
|
4324
|
+
import { jsx as jsx63 } from "react/jsx-runtime";
|
|
3110
4325
|
function TableCell({ children, className, isHeader = false }) {
|
|
3111
|
-
const classes =
|
|
3112
|
-
return /* @__PURE__ */
|
|
4326
|
+
const classes = clsx46("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
4327
|
+
return /* @__PURE__ */ jsx63("div", { className: classes, children });
|
|
3113
4328
|
}
|
|
3114
4329
|
|
|
3115
4330
|
// src/table/table-row.tsx
|
|
3116
|
-
import
|
|
3117
|
-
import { jsx as
|
|
4331
|
+
import clsx47 from "clsx";
|
|
4332
|
+
import { jsx as jsx64 } from "react/jsx-runtime";
|
|
3118
4333
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
3119
|
-
const rowClasses =
|
|
3120
|
-
return /* @__PURE__ */
|
|
4334
|
+
const rowClasses = clsx47("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
4335
|
+
return /* @__PURE__ */ jsx64("div", { className: rowClasses, children });
|
|
3121
4336
|
}
|
|
3122
4337
|
|
|
3123
4338
|
// src/table/table.tsx
|
|
3124
|
-
import { jsx as
|
|
4339
|
+
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
3125
4340
|
function Table({
|
|
3126
4341
|
width,
|
|
3127
4342
|
templateRows,
|
|
@@ -3130,7 +4345,7 @@ function Table({
|
|
|
3130
4345
|
autoRows,
|
|
3131
4346
|
children
|
|
3132
4347
|
}) {
|
|
3133
|
-
return /* @__PURE__ */
|
|
4348
|
+
return /* @__PURE__ */ jsx65(
|
|
3134
4349
|
"div",
|
|
3135
4350
|
{
|
|
3136
4351
|
className: "grid",
|
|
@@ -3150,22 +4365,22 @@ Table.Cell = TableCell;
|
|
|
3150
4365
|
|
|
3151
4366
|
// src/tag/tag.tsx
|
|
3152
4367
|
import { tagColors, tagLightColors } from "@zenkigen-inc/component-theme";
|
|
3153
|
-
import
|
|
4368
|
+
import clsx49 from "clsx";
|
|
3154
4369
|
|
|
3155
4370
|
// src/tag/delete-icon.tsx
|
|
3156
|
-
import { focusVisible as
|
|
3157
|
-
import
|
|
3158
|
-
import { jsx as
|
|
4371
|
+
import { focusVisible as focusVisible18 } from "@zenkigen-inc/component-theme";
|
|
4372
|
+
import clsx48 from "clsx";
|
|
4373
|
+
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
3159
4374
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
3160
|
-
const deleteButtonClasses =
|
|
4375
|
+
const deleteButtonClasses = clsx48(
|
|
3161
4376
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
3162
|
-
|
|
4377
|
+
focusVisible18.normal
|
|
3163
4378
|
);
|
|
3164
|
-
const deletePathClasses =
|
|
4379
|
+
const deletePathClasses = clsx48({
|
|
3165
4380
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
3166
4381
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
3167
4382
|
});
|
|
3168
|
-
return /* @__PURE__ */
|
|
4383
|
+
return /* @__PURE__ */ jsx66("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ jsx66("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx66(
|
|
3169
4384
|
"path",
|
|
3170
4385
|
{
|
|
3171
4386
|
fillRule: "evenodd",
|
|
@@ -3177,9 +4392,9 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
3177
4392
|
};
|
|
3178
4393
|
|
|
3179
4394
|
// src/tag/tag.tsx
|
|
3180
|
-
import { jsx as
|
|
4395
|
+
import { jsx as jsx67, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3181
4396
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
3182
|
-
const wrapperClasses =
|
|
4397
|
+
const wrapperClasses = clsx49("flex", "items-center", "justify-center", {
|
|
3183
4398
|
[tagColors[color]]: variant === "normal",
|
|
3184
4399
|
[tagLightColors[color]]: variant === "light",
|
|
3185
4400
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
@@ -3190,21 +4405,21 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
3190
4405
|
"px-1": !isEditable,
|
|
3191
4406
|
"px-2": isEditable
|
|
3192
4407
|
});
|
|
3193
|
-
return /* @__PURE__ */
|
|
4408
|
+
return /* @__PURE__ */ jsxs31("div", { className: wrapperClasses, children: [
|
|
3194
4409
|
children,
|
|
3195
|
-
isEditable ? /* @__PURE__ */
|
|
4410
|
+
isEditable ? /* @__PURE__ */ jsx67(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
3196
4411
|
] });
|
|
3197
4412
|
}
|
|
3198
4413
|
|
|
3199
4414
|
// src/text-area/text-area.tsx
|
|
3200
|
-
import { clsx as
|
|
3201
|
-
import { Children as
|
|
4415
|
+
import { clsx as clsx52 } from "clsx";
|
|
4416
|
+
import { Children as Children8, cloneElement as cloneElement5, forwardRef as forwardRef15, isValidElement as isValidElement6, useId as useId6, useMemo as useMemo7 } from "react";
|
|
3202
4417
|
|
|
3203
4418
|
// src/text-area/text-area-context.tsx
|
|
3204
|
-
import { createContext as
|
|
3205
|
-
var TextAreaCompoundContext =
|
|
4419
|
+
import { createContext as createContext15, useContext as useContext18 } from "react";
|
|
4420
|
+
var TextAreaCompoundContext = createContext15(null);
|
|
3206
4421
|
var useTextAreaCompoundContext = (componentName) => {
|
|
3207
|
-
const context =
|
|
4422
|
+
const context = useContext18(TextAreaCompoundContext);
|
|
3208
4423
|
if (context == null) {
|
|
3209
4424
|
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextArea \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
3210
4425
|
}
|
|
@@ -3212,10 +4427,10 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
3212
4427
|
};
|
|
3213
4428
|
|
|
3214
4429
|
// src/text-area/text-area-error-message.tsx
|
|
3215
|
-
import { clsx as
|
|
3216
|
-
import { forwardRef as
|
|
3217
|
-
import { jsx as
|
|
3218
|
-
var TextAreaErrorMessage =
|
|
4430
|
+
import { clsx as clsx50 } from "clsx";
|
|
4431
|
+
import { forwardRef as forwardRef13 } from "react";
|
|
4432
|
+
import { jsx as jsx68 } from "react/jsx-runtime";
|
|
4433
|
+
var TextAreaErrorMessage = forwardRef13(
|
|
3219
4434
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
3220
4435
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
3221
4436
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -3223,26 +4438,26 @@ var TextAreaErrorMessage = forwardRef11(
|
|
|
3223
4438
|
if (!shouldRender) {
|
|
3224
4439
|
return null;
|
|
3225
4440
|
}
|
|
3226
|
-
const errorMessageClassName =
|
|
3227
|
-
return /* @__PURE__ */
|
|
4441
|
+
const errorMessageClassName = clsx50(typographyClass, "text-supportError");
|
|
4442
|
+
return /* @__PURE__ */ jsx68("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
3228
4443
|
}
|
|
3229
4444
|
);
|
|
3230
4445
|
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
3231
4446
|
|
|
3232
4447
|
// src/text-area/text-area-helper-message.tsx
|
|
3233
|
-
import { clsx as
|
|
3234
|
-
import { forwardRef as
|
|
3235
|
-
import { jsx as
|
|
3236
|
-
var TextAreaHelperMessage =
|
|
4448
|
+
import { clsx as clsx51 } from "clsx";
|
|
4449
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
4450
|
+
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
4451
|
+
var TextAreaHelperMessage = forwardRef14((props, ref) => {
|
|
3237
4452
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
3238
4453
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
3239
|
-
const helperMessageClassName =
|
|
3240
|
-
return /* @__PURE__ */
|
|
4454
|
+
const helperMessageClassName = clsx51(typographyClass, "text-text02");
|
|
4455
|
+
return /* @__PURE__ */ jsx69("div", { ref, className: helperMessageClassName, ...props });
|
|
3241
4456
|
});
|
|
3242
4457
|
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
3243
4458
|
|
|
3244
4459
|
// src/text-area/text-area.tsx
|
|
3245
|
-
import { jsx as
|
|
4460
|
+
import { jsx as jsx70, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3246
4461
|
function TextAreaInner({
|
|
3247
4462
|
size = "medium",
|
|
3248
4463
|
variant = "outline",
|
|
@@ -3259,8 +4474,8 @@ function TextAreaInner({
|
|
|
3259
4474
|
maxLength,
|
|
3260
4475
|
...props
|
|
3261
4476
|
}, ref) {
|
|
3262
|
-
const autoGeneratedId =
|
|
3263
|
-
const textAreaPropsForContext =
|
|
4477
|
+
const autoGeneratedId = useId6();
|
|
4478
|
+
const textAreaPropsForContext = useMemo7(
|
|
3264
4479
|
() => ({
|
|
3265
4480
|
size,
|
|
3266
4481
|
variant,
|
|
@@ -3268,7 +4483,7 @@ function TextAreaInner({
|
|
|
3268
4483
|
}),
|
|
3269
4484
|
[size, variant, isError]
|
|
3270
4485
|
);
|
|
3271
|
-
const contextValue =
|
|
4486
|
+
const contextValue = useMemo7(
|
|
3272
4487
|
() => ({
|
|
3273
4488
|
textAreaProps: textAreaPropsForContext,
|
|
3274
4489
|
forwardedRef: ref
|
|
@@ -3278,8 +4493,8 @@ function TextAreaInner({
|
|
|
3278
4493
|
const helperMessageIds = [];
|
|
3279
4494
|
const errorIds = [];
|
|
3280
4495
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
3281
|
-
const enhancedChildren =
|
|
3282
|
-
if (!
|
|
4496
|
+
const enhancedChildren = Children8.map(children, (child) => {
|
|
4497
|
+
if (!isValidElement6(child)) {
|
|
3283
4498
|
return child;
|
|
3284
4499
|
}
|
|
3285
4500
|
if (child.type === TextAreaHelperMessage) {
|
|
@@ -3319,7 +4534,7 @@ function TextAreaInner({
|
|
|
3319
4534
|
...maxLengthProps
|
|
3320
4535
|
};
|
|
3321
4536
|
const isBorderless = variant === "text";
|
|
3322
|
-
const textAreaWrapperClassName =
|
|
4537
|
+
const textAreaWrapperClassName = clsx52(
|
|
3323
4538
|
"box-border flex w-full overflow-hidden rounded border",
|
|
3324
4539
|
{
|
|
3325
4540
|
// outline variant
|
|
@@ -3335,7 +4550,7 @@ function TextAreaInner({
|
|
|
3335
4550
|
// className は variant="outline" のみ受け入れ、後方互換のため wrapper の末尾に合成(@deprecated)
|
|
3336
4551
|
!isBorderless && className
|
|
3337
4552
|
);
|
|
3338
|
-
const textAreaClassName =
|
|
4553
|
+
const textAreaClassName = clsx52("w-full border-none bg-uiBackground01 outline-none", {
|
|
3339
4554
|
// outline: 従来の padding
|
|
3340
4555
|
"typography-body14regular px-2 py-2": !isBorderless && size === "medium",
|
|
3341
4556
|
"typography-body16regular px-3 py-2": !isBorderless && size === "large",
|
|
@@ -3354,7 +4569,7 @@ function TextAreaInner({
|
|
|
3354
4569
|
"resize-none": !isResizable
|
|
3355
4570
|
});
|
|
3356
4571
|
const hasHeight = height != null && String(height).trim().length > 0;
|
|
3357
|
-
const textAreaElement = /* @__PURE__ */
|
|
4572
|
+
const textAreaElement = /* @__PURE__ */ jsx70(
|
|
3358
4573
|
"div",
|
|
3359
4574
|
{
|
|
3360
4575
|
className: textAreaWrapperClassName,
|
|
@@ -3365,7 +4580,7 @@ function TextAreaInner({
|
|
|
3365
4580
|
...!autoHeight && hasHeight && !isResizable ? { height } : {},
|
|
3366
4581
|
...autoHeight && hasHeight ? { minHeight: height } : {}
|
|
3367
4582
|
},
|
|
3368
|
-
children: /* @__PURE__ */
|
|
4583
|
+
children: /* @__PURE__ */ jsx70(
|
|
3369
4584
|
"textarea",
|
|
3370
4585
|
{
|
|
3371
4586
|
ref,
|
|
@@ -3381,11 +4596,11 @@ function TextAreaInner({
|
|
|
3381
4596
|
)
|
|
3382
4597
|
}
|
|
3383
4598
|
);
|
|
3384
|
-
const counterElement = isCounterVisible ? /* @__PURE__ */
|
|
4599
|
+
const counterElement = isCounterVisible ? /* @__PURE__ */ jsx70(
|
|
3385
4600
|
"div",
|
|
3386
4601
|
{
|
|
3387
4602
|
id: counterId,
|
|
3388
|
-
className:
|
|
4603
|
+
className: clsx52(
|
|
3389
4604
|
"shrink-0",
|
|
3390
4605
|
size === "large" ? "typography-label13regular" : "typography-label12regular",
|
|
3391
4606
|
!disabled && isExceeded ? "text-supportError" : "text-text02"
|
|
@@ -3394,17 +4609,17 @@ function TextAreaInner({
|
|
|
3394
4609
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
3395
4610
|
}
|
|
3396
4611
|
) : null;
|
|
3397
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
4612
|
+
const stackedChildren = enhancedChildren == null ? [] : Children8.toArray(enhancedChildren);
|
|
3398
4613
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
3399
4614
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
3400
4615
|
if (!hasBottomContent) {
|
|
3401
|
-
return /* @__PURE__ */
|
|
4616
|
+
return /* @__PURE__ */ jsx70(TextAreaCompoundContext.Provider, { value: contextValue, children: textAreaElement });
|
|
3402
4617
|
}
|
|
3403
|
-
return /* @__PURE__ */
|
|
4618
|
+
return /* @__PURE__ */ jsx70(TextAreaCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2", children: [
|
|
3404
4619
|
textAreaElement,
|
|
3405
|
-
/* @__PURE__ */
|
|
3406
|
-
hasMessageChildren && /* @__PURE__ */
|
|
3407
|
-
!hasMessageChildren && counterElement != null && /* @__PURE__ */
|
|
4620
|
+
/* @__PURE__ */ jsxs32("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4621
|
+
hasMessageChildren && /* @__PURE__ */ jsx70("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: stackedChildren }),
|
|
4622
|
+
!hasMessageChildren && counterElement != null && /* @__PURE__ */ jsx70("div", { className: "flex-1" }),
|
|
3408
4623
|
counterElement
|
|
3409
4624
|
] })
|
|
3410
4625
|
] }) });
|
|
@@ -3415,15 +4630,15 @@ var attachStatics2 = (component) => {
|
|
|
3415
4630
|
component.displayName = "TextArea";
|
|
3416
4631
|
return component;
|
|
3417
4632
|
};
|
|
3418
|
-
var TextAreaBase =
|
|
4633
|
+
var TextAreaBase = forwardRef15(function TextAreaBase2(props, ref) {
|
|
3419
4634
|
return TextAreaInner(props, ref);
|
|
3420
4635
|
});
|
|
3421
4636
|
var TextArea = attachStatics2(TextAreaBase);
|
|
3422
4637
|
|
|
3423
4638
|
// src/toast/toast.tsx
|
|
3424
|
-
import
|
|
3425
|
-
import { useCallback as
|
|
3426
|
-
import { jsx as
|
|
4639
|
+
import clsx53 from "clsx";
|
|
4640
|
+
import { useCallback as useCallback15, useEffect as useEffect12, useState as useState15 } from "react";
|
|
4641
|
+
import { jsx as jsx71, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3427
4642
|
var CLOSE_TIME_MSEC = 5e3;
|
|
3428
4643
|
function Toast({
|
|
3429
4644
|
state = "information",
|
|
@@ -3433,8 +4648,8 @@ function Toast({
|
|
|
3433
4648
|
children,
|
|
3434
4649
|
onClickClose
|
|
3435
4650
|
}) {
|
|
3436
|
-
const [isRemoving, setIsRemoving] =
|
|
3437
|
-
const handleClose =
|
|
4651
|
+
const [isRemoving, setIsRemoving] = useState15(false);
|
|
4652
|
+
const handleClose = useCallback15(() => {
|
|
3438
4653
|
if (isAnimation) {
|
|
3439
4654
|
setIsRemoving(true);
|
|
3440
4655
|
} else {
|
|
@@ -3442,17 +4657,17 @@ function Toast({
|
|
|
3442
4657
|
}
|
|
3443
4658
|
}, [isAnimation, onClickClose]);
|
|
3444
4659
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
3445
|
-
const wrapperClasses =
|
|
4660
|
+
const wrapperClasses = clsx53("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
3446
4661
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
3447
4662
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
3448
4663
|
});
|
|
3449
|
-
const iconClasses =
|
|
4664
|
+
const iconClasses = clsx53("flex items-center", {
|
|
3450
4665
|
"fill-supportSuccess": state === "success",
|
|
3451
4666
|
"fill-supportError": state === "error",
|
|
3452
4667
|
"fill-supportWarning": state === "warning",
|
|
3453
4668
|
"fill-supportInfo": state === "information"
|
|
3454
4669
|
});
|
|
3455
|
-
const textClasses =
|
|
4670
|
+
const textClasses = clsx53("typography-body13regular flex-1 pt-[3px]", {
|
|
3456
4671
|
"text-supportError": state === "error",
|
|
3457
4672
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
3458
4673
|
});
|
|
@@ -3462,7 +4677,7 @@ function Toast({
|
|
|
3462
4677
|
warning: "warning",
|
|
3463
4678
|
information: "information-filled"
|
|
3464
4679
|
};
|
|
3465
|
-
|
|
4680
|
+
useEffect12(() => {
|
|
3466
4681
|
const timer = window.setTimeout(() => {
|
|
3467
4682
|
if (isAutoClose) {
|
|
3468
4683
|
setIsRemoving(true);
|
|
@@ -3470,45 +4685,45 @@ function Toast({
|
|
|
3470
4685
|
}, CLOSE_TIME_MSEC);
|
|
3471
4686
|
return () => window.clearTimeout(timer);
|
|
3472
4687
|
}, [isAutoClose]);
|
|
3473
|
-
return /* @__PURE__ */
|
|
3474
|
-
/* @__PURE__ */
|
|
3475
|
-
/* @__PURE__ */
|
|
3476
|
-
/* @__PURE__ */
|
|
4688
|
+
return /* @__PURE__ */ jsxs33("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
4689
|
+
/* @__PURE__ */ jsx71("div", { className: iconClasses, children: /* @__PURE__ */ jsx71(Icon, { name: iconName[state] }) }),
|
|
4690
|
+
/* @__PURE__ */ jsx71("p", { className: textClasses, children }),
|
|
4691
|
+
/* @__PURE__ */ jsx71(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
3477
4692
|
] });
|
|
3478
4693
|
}
|
|
3479
4694
|
|
|
3480
4695
|
// src/toast/toast-provider.tsx
|
|
3481
|
-
import { createContext as
|
|
4696
|
+
import { createContext as createContext16, useCallback as useCallback16, useContext as useContext19, useEffect as useEffect13, useState as useState16 } from "react";
|
|
3482
4697
|
import { createPortal as createPortal3 } from "react-dom";
|
|
3483
|
-
import { jsx as
|
|
3484
|
-
var ToastContext =
|
|
4698
|
+
import { jsx as jsx72, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
4699
|
+
var ToastContext = createContext16({});
|
|
3485
4700
|
var ToastProvider = ({ children }) => {
|
|
3486
|
-
const [isClientRender, setIsClientRender] =
|
|
3487
|
-
const [toasts, setToasts] =
|
|
3488
|
-
const addToast =
|
|
4701
|
+
const [isClientRender, setIsClientRender] = useState16(false);
|
|
4702
|
+
const [toasts, setToasts] = useState16([]);
|
|
4703
|
+
const addToast = useCallback16(({ message, state }) => {
|
|
3489
4704
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
3490
4705
|
}, []);
|
|
3491
|
-
const removeToast =
|
|
4706
|
+
const removeToast = useCallback16((id) => {
|
|
3492
4707
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
3493
4708
|
}, []);
|
|
3494
|
-
|
|
4709
|
+
useEffect13(() => {
|
|
3495
4710
|
setIsClientRender(true);
|
|
3496
4711
|
}, []);
|
|
3497
|
-
return /* @__PURE__ */
|
|
4712
|
+
return /* @__PURE__ */ jsxs34(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
3498
4713
|
children,
|
|
3499
4714
|
isClientRender && createPortal3(
|
|
3500
|
-
/* @__PURE__ */
|
|
4715
|
+
/* @__PURE__ */ jsx72("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__ */ jsx72(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
3501
4716
|
document.body
|
|
3502
4717
|
)
|
|
3503
4718
|
] });
|
|
3504
4719
|
};
|
|
3505
4720
|
var useToast = () => {
|
|
3506
|
-
return
|
|
4721
|
+
return useContext19(ToastContext);
|
|
3507
4722
|
};
|
|
3508
4723
|
|
|
3509
4724
|
// src/toggle/toggle.tsx
|
|
3510
|
-
import
|
|
3511
|
-
import { jsx as
|
|
4725
|
+
import clsx54 from "clsx";
|
|
4726
|
+
import { jsx as jsx73, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3512
4727
|
function Toggle({
|
|
3513
4728
|
id,
|
|
3514
4729
|
size = "medium",
|
|
@@ -3518,7 +4733,7 @@ function Toggle({
|
|
|
3518
4733
|
labelPosition = "right",
|
|
3519
4734
|
isDisabled = false
|
|
3520
4735
|
}) {
|
|
3521
|
-
const baseClasses =
|
|
4736
|
+
const baseClasses = clsx54("relative flex items-center rounded-full", {
|
|
3522
4737
|
"bg-disabledOn": isDisabled && isChecked,
|
|
3523
4738
|
"bg-disabled01": isDisabled && !isChecked,
|
|
3524
4739
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -3526,16 +4741,16 @@ function Toggle({
|
|
|
3526
4741
|
"w-8 h-4 px-[3px]": size === "small",
|
|
3527
4742
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
3528
4743
|
});
|
|
3529
|
-
const inputClasses =
|
|
4744
|
+
const inputClasses = clsx54(
|
|
3530
4745
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
3531
4746
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
3532
4747
|
);
|
|
3533
|
-
const indicatorClasses =
|
|
4748
|
+
const indicatorClasses = clsx54("rounded-full bg-iconOnColor", {
|
|
3534
4749
|
"w-2.5 h-2.5": size === "small",
|
|
3535
4750
|
"w-4 h-4": size === "medium" || size === "large",
|
|
3536
4751
|
"ml-auto": isChecked
|
|
3537
4752
|
});
|
|
3538
|
-
const labelClasses =
|
|
4753
|
+
const labelClasses = clsx54("break-all", {
|
|
3539
4754
|
"mr-2": labelPosition === "left",
|
|
3540
4755
|
"ml-2": labelPosition === "right",
|
|
3541
4756
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -3543,9 +4758,9 @@ function Toggle({
|
|
|
3543
4758
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
3544
4759
|
"cursor-pointer text-text01": !isDisabled
|
|
3545
4760
|
});
|
|
3546
|
-
return /* @__PURE__ */
|
|
3547
|
-
label != null && labelPosition === "left" && /* @__PURE__ */
|
|
3548
|
-
/* @__PURE__ */
|
|
4761
|
+
return /* @__PURE__ */ jsxs35("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
4762
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ jsx73("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
4763
|
+
/* @__PURE__ */ jsx73(
|
|
3549
4764
|
"input",
|
|
3550
4765
|
{
|
|
3551
4766
|
className: inputClasses,
|
|
@@ -3557,23 +4772,23 @@ function Toggle({
|
|
|
3557
4772
|
disabled: isDisabled
|
|
3558
4773
|
}
|
|
3559
4774
|
),
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
label != null && labelPosition === "right" && /* @__PURE__ */
|
|
4775
|
+
/* @__PURE__ */ jsx73("div", { className: baseClasses, children: /* @__PURE__ */ jsx73("span", { className: indicatorClasses }) }),
|
|
4776
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ jsx73("label", { htmlFor: id, className: labelClasses, children: label })
|
|
3562
4777
|
] });
|
|
3563
4778
|
}
|
|
3564
4779
|
|
|
3565
4780
|
// src/tooltip/tooltip.tsx
|
|
3566
|
-
import { useCallback as
|
|
4781
|
+
import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef15, useState as useState17 } from "react";
|
|
3567
4782
|
import { createPortal as createPortal4 } from "react-dom";
|
|
3568
4783
|
|
|
3569
4784
|
// src/tooltip/tooltip-content.tsx
|
|
3570
|
-
import
|
|
4785
|
+
import clsx56 from "clsx";
|
|
3571
4786
|
|
|
3572
4787
|
// src/tooltip/tail-icon.tsx
|
|
3573
|
-
import
|
|
3574
|
-
import { jsx as
|
|
4788
|
+
import clsx55 from "clsx";
|
|
4789
|
+
import { jsx as jsx74 } from "react/jsx-runtime";
|
|
3575
4790
|
var TailIcon = (props) => {
|
|
3576
|
-
const tailClasses =
|
|
4791
|
+
const tailClasses = clsx55("absolute fill-uiBackgroundTooltip", {
|
|
3577
4792
|
"rotate-180": props.verticalPosition === "bottom",
|
|
3578
4793
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
3579
4794
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -3588,9 +4803,9 @@ var TailIcon = (props) => {
|
|
|
3588
4803
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
3589
4804
|
});
|
|
3590
4805
|
if (props.size === "small") {
|
|
3591
|
-
return /* @__PURE__ */
|
|
4806
|
+
return /* @__PURE__ */ jsx74("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx74("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
3592
4807
|
} else {
|
|
3593
|
-
return /* @__PURE__ */
|
|
4808
|
+
return /* @__PURE__ */ jsx74(
|
|
3594
4809
|
"svg",
|
|
3595
4810
|
{
|
|
3596
4811
|
className: tailClasses,
|
|
@@ -3599,14 +4814,14 @@ var TailIcon = (props) => {
|
|
|
3599
4814
|
viewBox: "0 0 14 8",
|
|
3600
4815
|
fill: "none",
|
|
3601
4816
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3602
|
-
children: /* @__PURE__ */
|
|
4817
|
+
children: /* @__PURE__ */ jsx74("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
3603
4818
|
}
|
|
3604
4819
|
);
|
|
3605
4820
|
}
|
|
3606
4821
|
};
|
|
3607
4822
|
|
|
3608
4823
|
// src/tooltip/tooltip-content.tsx
|
|
3609
|
-
import { jsx as
|
|
4824
|
+
import { jsx as jsx75, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3610
4825
|
var TooltipContent = ({
|
|
3611
4826
|
content,
|
|
3612
4827
|
horizontalAlign,
|
|
@@ -3616,7 +4831,7 @@ var TooltipContent = ({
|
|
|
3616
4831
|
maxWidth,
|
|
3617
4832
|
isPortal = false
|
|
3618
4833
|
}) => {
|
|
3619
|
-
const tooltipWrapperClasses =
|
|
4834
|
+
const tooltipWrapperClasses = clsx56("absolute z-tooltip m-auto flex", {
|
|
3620
4835
|
"top-0": !isPortal && verticalPosition === "top",
|
|
3621
4836
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
3622
4837
|
"justify-start": horizontalAlign === "left",
|
|
@@ -3625,7 +4840,7 @@ var TooltipContent = ({
|
|
|
3625
4840
|
"w-[24px]": size === "small",
|
|
3626
4841
|
"w-[46px]": size !== "small"
|
|
3627
4842
|
});
|
|
3628
|
-
const tooltipBodyClasses =
|
|
4843
|
+
const tooltipBodyClasses = clsx56(
|
|
3629
4844
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
3630
4845
|
{
|
|
3631
4846
|
"typography-body12regular": size === "small",
|
|
@@ -3642,7 +4857,7 @@ var TooltipContent = ({
|
|
|
3642
4857
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
3643
4858
|
...tooltipPosition
|
|
3644
4859
|
} : {};
|
|
3645
|
-
return /* @__PURE__ */
|
|
4860
|
+
return /* @__PURE__ */ jsx75("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ jsxs36(
|
|
3646
4861
|
"div",
|
|
3647
4862
|
{
|
|
3648
4863
|
className: tooltipBodyClasses,
|
|
@@ -3651,16 +4866,16 @@ var TooltipContent = ({
|
|
|
3651
4866
|
},
|
|
3652
4867
|
children: [
|
|
3653
4868
|
content,
|
|
3654
|
-
/* @__PURE__ */
|
|
4869
|
+
/* @__PURE__ */ jsx75(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
3655
4870
|
]
|
|
3656
4871
|
}
|
|
3657
4872
|
) });
|
|
3658
4873
|
};
|
|
3659
4874
|
|
|
3660
4875
|
// src/tooltip/tooltip-hook.ts
|
|
3661
|
-
import { useCallback as
|
|
4876
|
+
import { useCallback as useCallback17 } from "react";
|
|
3662
4877
|
var useTooltip = () => {
|
|
3663
|
-
const calculatePosition =
|
|
4878
|
+
const calculatePosition = useCallback17(
|
|
3664
4879
|
(args) => {
|
|
3665
4880
|
const result = {
|
|
3666
4881
|
maxWidth: "none",
|
|
@@ -3712,7 +4927,7 @@ var useTooltip = () => {
|
|
|
3712
4927
|
};
|
|
3713
4928
|
|
|
3714
4929
|
// src/tooltip/tooltip.tsx
|
|
3715
|
-
import { jsx as
|
|
4930
|
+
import { jsx as jsx76, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3716
4931
|
function Tooltip({
|
|
3717
4932
|
children,
|
|
3718
4933
|
content,
|
|
@@ -3724,8 +4939,8 @@ function Tooltip({
|
|
|
3724
4939
|
portalTarget
|
|
3725
4940
|
}) {
|
|
3726
4941
|
const { calculatePosition } = useTooltip();
|
|
3727
|
-
const [isVisible, setIsVisible] =
|
|
3728
|
-
const [tooltipPosition, setTooltipPosition] =
|
|
4942
|
+
const [isVisible, setIsVisible] = useState17(false);
|
|
4943
|
+
const [tooltipPosition, setTooltipPosition] = useState17({
|
|
3729
4944
|
maxWidth: "none",
|
|
3730
4945
|
width: "auto",
|
|
3731
4946
|
left: "0px",
|
|
@@ -3734,8 +4949,8 @@ function Tooltip({
|
|
|
3734
4949
|
translateX: "0",
|
|
3735
4950
|
translateY: "0"
|
|
3736
4951
|
});
|
|
3737
|
-
const targetRef =
|
|
3738
|
-
const handleMouseOverWrapper =
|
|
4952
|
+
const targetRef = useRef15(null);
|
|
4953
|
+
const handleMouseOverWrapper = useCallback18(() => {
|
|
3739
4954
|
if (isDisabledHover) {
|
|
3740
4955
|
return;
|
|
3741
4956
|
}
|
|
@@ -3752,16 +4967,16 @@ function Tooltip({
|
|
|
3752
4967
|
}
|
|
3753
4968
|
setIsVisible(true);
|
|
3754
4969
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
3755
|
-
const handleMouseOutWrapper =
|
|
4970
|
+
const handleMouseOutWrapper = useCallback18(() => {
|
|
3756
4971
|
setIsVisible(false);
|
|
3757
4972
|
}, []);
|
|
3758
|
-
|
|
4973
|
+
useEffect14(() => {
|
|
3759
4974
|
if (targetRef.current === null) return;
|
|
3760
4975
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
3761
4976
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
3762
4977
|
setTooltipPosition(position);
|
|
3763
4978
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
3764
|
-
|
|
4979
|
+
useEffect14(() => {
|
|
3765
4980
|
if (!isVisible) return;
|
|
3766
4981
|
const updatePosition = () => {
|
|
3767
4982
|
if (targetRef.current === null) return;
|
|
@@ -3782,7 +4997,7 @@ function Tooltip({
|
|
|
3782
4997
|
window.removeEventListener("resize", updatePosition);
|
|
3783
4998
|
};
|
|
3784
4999
|
}, [isVisible, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
3785
|
-
return /* @__PURE__ */
|
|
5000
|
+
return /* @__PURE__ */ jsxs37(
|
|
3786
5001
|
"div",
|
|
3787
5002
|
{
|
|
3788
5003
|
ref: targetRef,
|
|
@@ -3791,7 +5006,7 @@ function Tooltip({
|
|
|
3791
5006
|
onMouseLeave: handleMouseOutWrapper,
|
|
3792
5007
|
children: [
|
|
3793
5008
|
children,
|
|
3794
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */
|
|
5009
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ jsx76(
|
|
3795
5010
|
TooltipContent,
|
|
3796
5011
|
{
|
|
3797
5012
|
content,
|
|
@@ -3802,7 +5017,7 @@ function Tooltip({
|
|
|
3802
5017
|
tooltipPosition
|
|
3803
5018
|
}
|
|
3804
5019
|
) : createPortal4(
|
|
3805
|
-
/* @__PURE__ */
|
|
5020
|
+
/* @__PURE__ */ jsx76(
|
|
3806
5021
|
TooltipContent,
|
|
3807
5022
|
{
|
|
3808
5023
|
isPortal: true,
|
|
@@ -3822,9 +5037,11 @@ function Tooltip({
|
|
|
3822
5037
|
}
|
|
3823
5038
|
export {
|
|
3824
5039
|
Avatar,
|
|
5040
|
+
AvatarGroup,
|
|
3825
5041
|
Breadcrumb,
|
|
3826
5042
|
Button,
|
|
3827
5043
|
Checkbox,
|
|
5044
|
+
Combobox,
|
|
3828
5045
|
DatePicker,
|
|
3829
5046
|
Divider,
|
|
3830
5047
|
Dropdown,
|
|
@@ -3849,6 +5066,7 @@ export {
|
|
|
3849
5066
|
Select,
|
|
3850
5067
|
SelectSort,
|
|
3851
5068
|
SortButton,
|
|
5069
|
+
Steps,
|
|
3852
5070
|
Tab,
|
|
3853
5071
|
TabItem,
|
|
3854
5072
|
Table,
|