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