@zenkigen-inc/component-ui 1.20.3 → 1.20.4
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 +20 -9
- package/dist/index.d.ts +20 -9
- package/dist/index.js +600 -479
- package/dist/index.mjs +359 -238
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -77,12 +77,11 @@ __export(index_exports, {
|
|
|
77
77
|
module.exports = __toCommonJS(index_exports);
|
|
78
78
|
|
|
79
79
|
// src/avatar/avatar.tsx
|
|
80
|
-
var
|
|
80
|
+
var import_component_theme = require("@zenkigen-inc/component-theme");
|
|
81
81
|
var import_clsx2 = require("clsx");
|
|
82
82
|
|
|
83
83
|
// src/icon/icon.tsx
|
|
84
84
|
var import_component_icons = require("@zenkigen-inc/component-icons");
|
|
85
|
-
var import_component_theme = require("@zenkigen-inc/component-theme");
|
|
86
85
|
var import_clsx = require("clsx");
|
|
87
86
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
88
87
|
var Icon = ({ size = "medium", isDisabled = false, ...props }) => {
|
|
@@ -90,10 +89,7 @@ var Icon = ({ size = "medium", isDisabled = false, ...props }) => {
|
|
|
90
89
|
"inline-block shrink-0",
|
|
91
90
|
{
|
|
92
91
|
"fill-disabled01": isDisabled,
|
|
93
|
-
[
|
|
94
|
-
[import_component_theme.iconColors.icon02]: !isDisabled && props.color === "icon02",
|
|
95
|
-
[import_component_theme.iconColors.icon03]: !isDisabled && props.color === "icon03",
|
|
96
|
-
[import_component_theme.iconColors.iconOnColor]: !isDisabled && props.color === "iconOnColor",
|
|
92
|
+
[`fill-${props.color}`]: !isDisabled && props.color != null,
|
|
97
93
|
"w-3 h-3": size === "x-small",
|
|
98
94
|
"w-4 h-4": size === "small",
|
|
99
95
|
"w-6 h-6": size === "medium",
|
|
@@ -125,7 +121,7 @@ function Avatar({ size = "medium", ...props }) {
|
|
|
125
121
|
"w-6 h-6 typography-label11regular": size === "x-small",
|
|
126
122
|
"bg-disabled01": props.isDisabled,
|
|
127
123
|
"bg-icon01": props.userId == null,
|
|
128
|
-
[
|
|
124
|
+
[import_component_theme.userColors[(props.userId ?? 0) % import_component_theme.userColors.length]]: props.userId != null && !(props.isDisabled ?? false)
|
|
129
125
|
});
|
|
130
126
|
const hasName = props.firstName != null && props.firstName.trim() !== "" || props.lastName != null && props.lastName.trim() !== "";
|
|
131
127
|
if (hasName === false) {
|
|
@@ -158,7 +154,7 @@ function Breadcrumb({ children }) {
|
|
|
158
154
|
Breadcrumb.Item = BreadcrumbItem;
|
|
159
155
|
|
|
160
156
|
// src/button/button.tsx
|
|
161
|
-
var
|
|
157
|
+
var import_component_theme2 = require("@zenkigen-inc/component-theme");
|
|
162
158
|
var import_clsx3 = require("clsx");
|
|
163
159
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
164
160
|
var createButton = (props) => {
|
|
@@ -178,24 +174,25 @@ var createButton = (props) => {
|
|
|
178
174
|
} = props;
|
|
179
175
|
const baseClasses = (0, import_clsx3.clsx)(
|
|
180
176
|
"flex shrink-0 items-center gap-1",
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
177
|
+
import_component_theme2.buttonColors[variant].hover,
|
|
178
|
+
import_component_theme2.buttonColors[variant].active,
|
|
179
|
+
import_component_theme2.buttonColors[variant].disabled,
|
|
180
|
+
import_component_theme2.focusVisible.normal,
|
|
185
181
|
{
|
|
186
182
|
"h-6 px-2": size === "small",
|
|
187
183
|
"h-8 px-3": size === "medium",
|
|
188
184
|
"h-10 px-4 leading-[24px]": size === "large",
|
|
185
|
+
"h-12 px-4 leading-[24px]": size === "x-large",
|
|
189
186
|
"inline-flex": elementAs === "a",
|
|
190
|
-
[
|
|
191
|
-
[
|
|
187
|
+
[import_component_theme2.buttonColors[variant].selected]: isSelected,
|
|
188
|
+
[import_component_theme2.buttonColors[variant].base]: !isSelected,
|
|
192
189
|
"hover:text-textOnColor active:text-textOnColor [&:hover>*]:fill-iconOnColor [&:active>*]:fill-iconOnColor": isSelected && variant !== "outline" && variant !== "text" && variant !== "outlineDanger",
|
|
193
190
|
"pointer-events-none": isDisabled,
|
|
194
191
|
"rounded-button": borderRadius == null,
|
|
195
192
|
"justify-start": justifyContent === "start",
|
|
196
193
|
"justify-center": justifyContent === "center",
|
|
197
|
-
"typography-label16regular": size === "large",
|
|
198
|
-
"typography-label14regular": size !== "large"
|
|
194
|
+
"typography-label16regular": size === "large" || size === "x-large",
|
|
195
|
+
"typography-label14regular": size !== "large" && size !== "x-large"
|
|
199
196
|
}
|
|
200
197
|
);
|
|
201
198
|
const Component = elementAs ?? "button";
|
|
@@ -213,19 +210,23 @@ var InternalButton = (props) => {
|
|
|
213
210
|
};
|
|
214
211
|
|
|
215
212
|
// src/checkbox/checkbox.tsx
|
|
216
|
-
var
|
|
217
|
-
var
|
|
213
|
+
var import_component_theme3 = require("@zenkigen-inc/component-theme");
|
|
214
|
+
var import_clsx6 = __toESM(require("clsx"));
|
|
218
215
|
var import_react = require("react");
|
|
219
216
|
|
|
220
217
|
// src/checkbox/checked-icon.tsx
|
|
218
|
+
var import_clsx4 = __toESM(require("clsx"));
|
|
221
219
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
222
|
-
var CheckedIcon = () => {
|
|
220
|
+
var CheckedIcon = ({ size = "medium" }) => {
|
|
223
221
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
224
222
|
"svg",
|
|
225
223
|
{
|
|
226
224
|
viewBox: "0 0 20 20",
|
|
227
225
|
xmlns: "http://www.w3.org/2000/svg",
|
|
228
|
-
className: "absolute z-10
|
|
226
|
+
className: (0, import_clsx4.default)("absolute z-10 rounded-sm fill-iconOnColor hover:rounded-sm", {
|
|
227
|
+
"size-5": size === "medium",
|
|
228
|
+
"size-6": size === "large"
|
|
229
|
+
}),
|
|
229
230
|
children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
230
231
|
"path",
|
|
231
232
|
{
|
|
@@ -239,14 +240,18 @@ var CheckedIcon = () => {
|
|
|
239
240
|
};
|
|
240
241
|
|
|
241
242
|
// src/checkbox/minus-icon.tsx
|
|
243
|
+
var import_clsx5 = __toESM(require("clsx"));
|
|
242
244
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
243
|
-
var MinusIcon = () => {
|
|
245
|
+
var MinusIcon = ({ size = "medium" }) => {
|
|
244
246
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
245
247
|
"svg",
|
|
246
248
|
{
|
|
247
249
|
viewBox: "0 0 20 20",
|
|
248
250
|
xmlns: "http://www.w3.org/2000/svg",
|
|
249
|
-
className: "absolute z-10
|
|
251
|
+
className: (0, import_clsx5.default)("absolute z-10 rounded-sm fill-iconOnColor hover:rounded-sm", {
|
|
252
|
+
"size-5": size === "medium",
|
|
253
|
+
"size-6": size === "large"
|
|
254
|
+
}),
|
|
250
255
|
children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("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" })
|
|
251
256
|
}
|
|
252
257
|
);
|
|
@@ -263,7 +268,8 @@ function Checkbox({
|
|
|
263
268
|
isDisabled = false,
|
|
264
269
|
onChange,
|
|
265
270
|
label,
|
|
266
|
-
color = "default"
|
|
271
|
+
color = "default",
|
|
272
|
+
size = "medium"
|
|
267
273
|
}) {
|
|
268
274
|
const [isMouseOver, setIsMouseOver] = (0, import_react.useState)(false);
|
|
269
275
|
const handleMouseOverInput = (0, import_react.useCallback)(() => {
|
|
@@ -276,13 +282,15 @@ function Checkbox({
|
|
|
276
282
|
(e) => !isDisabled && onChange?.(e),
|
|
277
283
|
[isDisabled, onChange]
|
|
278
284
|
);
|
|
279
|
-
const
|
|
285
|
+
const sizeBox = size === "large" ? "size-6" : "size-5";
|
|
286
|
+
const baseInputClasses = (0, import_clsx6.default)("peer absolute inset-0 z-[1] opacity-0", {
|
|
280
287
|
"cursor-not-allowed": isDisabled,
|
|
281
288
|
"cursor-pointer": !isDisabled
|
|
282
289
|
});
|
|
283
|
-
const boxClasses = (0,
|
|
284
|
-
"inline-flex
|
|
285
|
-
|
|
290
|
+
const boxClasses = (0, import_clsx6.default)(
|
|
291
|
+
"inline-flex items-center justify-center rounded-sm border bg-white",
|
|
292
|
+
sizeBox,
|
|
293
|
+
import_component_theme3.focusVisible.normalPeer,
|
|
286
294
|
{
|
|
287
295
|
"border-disabled01": isDisabled,
|
|
288
296
|
"border-hoverUiBorder": !isDisabled && isMouseOver && color === "default",
|
|
@@ -292,11 +300,11 @@ function Checkbox({
|
|
|
292
300
|
"border-supportError": !isDisabled && !isMouseOver && color === "error"
|
|
293
301
|
}
|
|
294
302
|
);
|
|
295
|
-
const indicatorClasses = (0,
|
|
303
|
+
const indicatorClasses = (0, import_clsx6.default)("relative flex flex-[0_0_auto] items-center justify-center", sizeBox, {
|
|
296
304
|
"bg-disabled01": isDisabled && isChecked,
|
|
297
305
|
"border-disabled01": isDisabled
|
|
298
306
|
});
|
|
299
|
-
const afterClasses = (0,
|
|
307
|
+
const afterClasses = (0, import_clsx6.default)("absolute inset-0 m-auto block rounded-sm", {
|
|
300
308
|
"bg-disabled01": isDisabled && isChecked,
|
|
301
309
|
"bg-hover01": !(isDisabled && isChecked) && isMouseOver,
|
|
302
310
|
"bg-interactive01": !(isDisabled && isChecked) && !isMouseOver,
|
|
@@ -307,15 +315,23 @@ function Checkbox({
|
|
|
307
315
|
"scale-0": !isChecked,
|
|
308
316
|
"scale-100": isChecked
|
|
309
317
|
});
|
|
310
|
-
const hoverIndicatorClasses = (0,
|
|
318
|
+
const hoverIndicatorClasses = (0, import_clsx6.default)("inline-block rounded-[1px]", {
|
|
319
|
+
"size-3": size === "medium",
|
|
320
|
+
"size-4": size === "large",
|
|
311
321
|
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
312
322
|
});
|
|
313
|
-
const labelClasses = (0,
|
|
323
|
+
const labelClasses = (0, import_clsx6.default)("ml-2 flex-[1_0_0] break-all", {
|
|
324
|
+
"typography-label14regular": size === "medium",
|
|
325
|
+
"typography-label16regular": size === "large",
|
|
314
326
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
315
327
|
"cursor-pointer text-text01": !isDisabled
|
|
316
328
|
});
|
|
329
|
+
const outerWrapperClasses = (0, import_clsx6.default)("relative flex items-center justify-center", {
|
|
330
|
+
"size-6": size === "medium",
|
|
331
|
+
"h-8 w-7": size === "large"
|
|
332
|
+
});
|
|
317
333
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex items-center", children: [
|
|
318
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className:
|
|
334
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: outerWrapperClasses, children: [
|
|
319
335
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
320
336
|
"input",
|
|
321
337
|
{
|
|
@@ -333,8 +349,8 @@ function Checkbox({
|
|
|
333
349
|
),
|
|
334
350
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: boxClasses, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: indicatorClasses, children: [
|
|
335
351
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { className: afterClasses, children: [
|
|
336
|
-
isChecked && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckedIcon, {}),
|
|
337
|
-
isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MinusIcon, {})
|
|
352
|
+
isChecked && !isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckedIcon, { size }),
|
|
353
|
+
isIndeterminate && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MinusIcon, { size })
|
|
338
354
|
] }),
|
|
339
355
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: hoverIndicatorClasses })
|
|
340
356
|
] }) })
|
|
@@ -345,12 +361,12 @@ function Checkbox({
|
|
|
345
361
|
|
|
346
362
|
// src/date-picker/date-picker.tsx
|
|
347
363
|
var import_style = require("react-day-picker/style.css");
|
|
348
|
-
var
|
|
364
|
+
var import_react11 = require("react");
|
|
349
365
|
var import_react_day_picker4 = require("react-day-picker");
|
|
350
366
|
|
|
351
367
|
// src/icon-button/icon-button.tsx
|
|
352
|
-
var
|
|
353
|
-
var
|
|
368
|
+
var import_component_theme4 = require("@zenkigen-inc/component-theme");
|
|
369
|
+
var import_clsx7 = require("clsx");
|
|
354
370
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
355
371
|
function IconButton({
|
|
356
372
|
icon,
|
|
@@ -359,15 +375,16 @@ function IconButton({
|
|
|
359
375
|
isNoPadding = false,
|
|
360
376
|
isDisabled = false,
|
|
361
377
|
isSelected = false,
|
|
378
|
+
iconColor,
|
|
362
379
|
iconAccentColor,
|
|
363
380
|
...props
|
|
364
381
|
}) {
|
|
365
|
-
const baseClasses = (0,
|
|
382
|
+
const baseClasses = (0, import_clsx7.clsx)(
|
|
366
383
|
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
384
|
+
import_component_theme4.buttonColors[variant].hover,
|
|
385
|
+
import_component_theme4.buttonColors[variant].active,
|
|
386
|
+
import_component_theme4.buttonColors[variant].disabled,
|
|
387
|
+
import_component_theme4.focusVisible.normal,
|
|
371
388
|
{
|
|
372
389
|
"h-4 w-4": size === "small" && isNoPadding,
|
|
373
390
|
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
@@ -375,29 +392,45 @@ function IconButton({
|
|
|
375
392
|
"h-10 w-10": size === "large" && !isNoPadding,
|
|
376
393
|
"inline-flex": props.isAnchor,
|
|
377
394
|
"pointer-events-none": isDisabled,
|
|
378
|
-
[
|
|
379
|
-
[
|
|
395
|
+
[import_component_theme4.buttonColors[variant].selected]: isSelected,
|
|
396
|
+
[import_component_theme4.buttonColors[variant].base]: !isSelected
|
|
380
397
|
}
|
|
381
398
|
);
|
|
382
399
|
const iconSize = size === "small" ? "small" : "medium";
|
|
400
|
+
const iconColorProps = !isSelected && iconColor ? { color: iconColor } : {};
|
|
383
401
|
const iconAccentColorProps = !isSelected && iconAccentColor ? { accentColor: iconAccentColor } : {};
|
|
384
402
|
if (props.isAnchor === true) {
|
|
385
403
|
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
386
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: iconSize, ...iconAccentColorProps }) });
|
|
404
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: iconSize, ...iconColorProps, ...iconAccentColorProps }) });
|
|
387
405
|
} else {
|
|
388
406
|
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
389
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: iconSize, ...iconAccentColorProps }) });
|
|
407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Icon, { name: icon, size: iconSize, ...iconColorProps, ...iconAccentColorProps }) });
|
|
390
408
|
}
|
|
391
409
|
}
|
|
392
410
|
|
|
393
411
|
// src/popover/popover.tsx
|
|
394
|
-
var
|
|
395
|
-
var
|
|
412
|
+
var import_react7 = require("@floating-ui/react");
|
|
413
|
+
var import_react8 = require("react");
|
|
396
414
|
|
|
397
415
|
// src/popover/popover-content.tsx
|
|
398
|
-
var
|
|
416
|
+
var import_react4 = require("@floating-ui/react");
|
|
399
417
|
var React = __toESM(require("react"));
|
|
400
|
-
var
|
|
418
|
+
var import_react5 = require("react");
|
|
419
|
+
|
|
420
|
+
// src/hooks/use-dismiss-on-modal-open.ts
|
|
421
|
+
var import_react2 = require("react");
|
|
422
|
+
var MODAL_OPEN_EVENT = "zenkigen-modal-open";
|
|
423
|
+
var useDismissOnModalOpen = (dismiss) => {
|
|
424
|
+
const dismissRef = (0, import_react2.useRef)(dismiss);
|
|
425
|
+
dismissRef.current = dismiss;
|
|
426
|
+
(0, import_react2.useEffect)(() => {
|
|
427
|
+
const handler = () => {
|
|
428
|
+
dismissRef.current();
|
|
429
|
+
};
|
|
430
|
+
window.addEventListener(MODAL_OPEN_EVENT, handler);
|
|
431
|
+
return () => window.removeEventListener(MODAL_OPEN_EVENT, handler);
|
|
432
|
+
}, []);
|
|
433
|
+
};
|
|
401
434
|
|
|
402
435
|
// src/utils/react-utils.ts
|
|
403
436
|
function composeRefs(...refs) {
|
|
@@ -419,10 +452,10 @@ function isElement(node) {
|
|
|
419
452
|
}
|
|
420
453
|
|
|
421
454
|
// src/popover/popover-context.ts
|
|
422
|
-
var
|
|
423
|
-
var PopoverContext = (0,
|
|
455
|
+
var import_react3 = require("react");
|
|
456
|
+
var PopoverContext = (0, import_react3.createContext)(null);
|
|
424
457
|
var usePopoverContext = () => {
|
|
425
|
-
const context = (0,
|
|
458
|
+
const context = (0, import_react3.useContext)(PopoverContext);
|
|
426
459
|
if (context == null) {
|
|
427
460
|
throw new Error("Popover components must be used inside <Popover.Root>");
|
|
428
461
|
}
|
|
@@ -431,16 +464,16 @@ var usePopoverContext = () => {
|
|
|
431
464
|
|
|
432
465
|
// src/popover/popover-content.tsx
|
|
433
466
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
434
|
-
var PopoverContent = (0,
|
|
467
|
+
var PopoverContent = (0, import_react5.forwardRef)(function PopoverContent2({ children }, ref) {
|
|
435
468
|
const { isOpen, triggerRef, floating, panelId, onClose } = usePopoverContext();
|
|
436
|
-
const shouldCloseOnOutsidePress = (0,
|
|
469
|
+
const shouldCloseOnOutsidePress = (0, import_react5.useCallback)(
|
|
437
470
|
(event) => {
|
|
438
471
|
const target = event.target;
|
|
439
472
|
if (!(target instanceof Element)) {
|
|
440
473
|
return true;
|
|
441
474
|
}
|
|
442
475
|
const floatingElement = floating.refs.floating.current;
|
|
443
|
-
const closestOverlay = target.closest(".z-
|
|
476
|
+
const closestOverlay = target.closest(".z-popover, .z-dropdown");
|
|
444
477
|
if (closestOverlay !== null && floatingElement instanceof Element) {
|
|
445
478
|
const isInsideOwnFloating = floatingElement.contains(closestOverlay);
|
|
446
479
|
return isInsideOwnFloating;
|
|
@@ -449,27 +482,32 @@ var PopoverContent = (0, import_react4.forwardRef)(function PopoverContent2({ ch
|
|
|
449
482
|
},
|
|
450
483
|
[floating.refs.floating]
|
|
451
484
|
);
|
|
452
|
-
const dismiss = (0,
|
|
485
|
+
const dismiss = (0, import_react4.useDismiss)(floating.context, {
|
|
453
486
|
outsidePressEvent: "pointerdown",
|
|
454
487
|
outsidePress: shouldCloseOnOutsidePress,
|
|
455
488
|
escapeKey: false
|
|
456
489
|
});
|
|
457
|
-
const interactions = (0,
|
|
458
|
-
(
|
|
490
|
+
const interactions = (0, import_react4.useInteractions)([dismiss, (0, import_react4.useRole)(floating.context, { role: "dialog" })]);
|
|
491
|
+
useDismissOnModalOpen(() => {
|
|
492
|
+
if (isOpen && onClose != null) {
|
|
493
|
+
onClose({ reason: "modal-open" });
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
(0, import_react5.useEffect)(() => {
|
|
459
497
|
if (isOpen) {
|
|
460
498
|
const element = floating.refs.floating.current;
|
|
461
499
|
element?.focus?.({ preventScroll: true });
|
|
462
500
|
}
|
|
463
501
|
}, [isOpen, floating.refs.floating]);
|
|
464
|
-
const prevIsOpenRef = (0,
|
|
465
|
-
(0,
|
|
502
|
+
const prevIsOpenRef = (0, import_react5.useRef)(isOpen);
|
|
503
|
+
(0, import_react5.useEffect)(() => {
|
|
466
504
|
const hasPreviouslyBeenOpen = prevIsOpenRef.current;
|
|
467
505
|
prevIsOpenRef.current = isOpen;
|
|
468
506
|
if (hasPreviouslyBeenOpen && !isOpen) {
|
|
469
507
|
triggerRef.current?.focus({ preventScroll: true });
|
|
470
508
|
}
|
|
471
509
|
}, [isOpen, triggerRef]);
|
|
472
|
-
const handleKeyDown = (0,
|
|
510
|
+
const handleKeyDown = (0, import_react5.useCallback)(
|
|
473
511
|
(event) => {
|
|
474
512
|
if (event.key === "Escape") {
|
|
475
513
|
event.stopPropagation();
|
|
@@ -489,7 +527,7 @@ var PopoverContent = (0, import_react4.forwardRef)(function PopoverContent2({ ch
|
|
|
489
527
|
...childProps.role == null && { role: "dialog" }
|
|
490
528
|
});
|
|
491
529
|
}
|
|
492
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
530
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react4.FloatingPortal, { children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
493
531
|
"div",
|
|
494
532
|
{
|
|
495
533
|
...interactions.getFloatingProps({
|
|
@@ -511,8 +549,8 @@ var PopoverContent = (0, import_react4.forwardRef)(function PopoverContent2({ ch
|
|
|
511
549
|
|
|
512
550
|
// src/popover/popover-trigger.tsx
|
|
513
551
|
var React2 = __toESM(require("react"));
|
|
514
|
-
var
|
|
515
|
-
var PopoverTrigger = (0,
|
|
552
|
+
var import_react6 = require("react");
|
|
553
|
+
var PopoverTrigger = (0, import_react6.forwardRef)(function PopoverTrigger2({ children }, ref) {
|
|
516
554
|
const { isOpen, floating, triggerRef, anchorRef, panelId } = usePopoverContext();
|
|
517
555
|
if (!isElement(children)) {
|
|
518
556
|
return null;
|
|
@@ -549,8 +587,8 @@ function Popover({
|
|
|
549
587
|
onClose,
|
|
550
588
|
anchorRef
|
|
551
589
|
}) {
|
|
552
|
-
const triggerRef = (0,
|
|
553
|
-
const floating = (0,
|
|
590
|
+
const triggerRef = (0, import_react8.useRef)(null);
|
|
591
|
+
const floating = (0, import_react7.useFloating)({
|
|
554
592
|
open: isOpen,
|
|
555
593
|
onOpenChange: (open) => {
|
|
556
594
|
if (!open && onClose != null) {
|
|
@@ -558,18 +596,18 @@ function Popover({
|
|
|
558
596
|
}
|
|
559
597
|
},
|
|
560
598
|
placement,
|
|
561
|
-
middleware: [(0,
|
|
562
|
-
whileElementsMounted:
|
|
599
|
+
middleware: [(0, import_react7.offset)(offsetValue)],
|
|
600
|
+
whileElementsMounted: import_react7.autoUpdate,
|
|
563
601
|
strategy: "fixed"
|
|
564
602
|
});
|
|
565
|
-
(0,
|
|
603
|
+
(0, import_react8.useEffect)(() => {
|
|
566
604
|
if (anchorRef?.current) {
|
|
567
605
|
floating.refs.setReference(anchorRef.current);
|
|
568
606
|
}
|
|
569
607
|
}, [anchorRef, floating.refs]);
|
|
570
|
-
const contentId = (0,
|
|
608
|
+
const contentId = (0, import_react7.useId)() ?? "";
|
|
571
609
|
const panelId = `${contentId}-panel`;
|
|
572
|
-
const contextValue = (0,
|
|
610
|
+
const contextValue = (0, import_react8.useMemo)(
|
|
573
611
|
() => ({
|
|
574
612
|
isOpen,
|
|
575
613
|
triggerRef,
|
|
@@ -587,10 +625,10 @@ Popover.Trigger = PopoverTrigger;
|
|
|
587
625
|
Popover.Content = PopoverContent;
|
|
588
626
|
|
|
589
627
|
// src/date-picker/date-picker-context.tsx
|
|
590
|
-
var
|
|
591
|
-
var DatePickerCompoundContext = (0,
|
|
628
|
+
var import_react9 = require("react");
|
|
629
|
+
var DatePickerCompoundContext = (0, import_react9.createContext)(null);
|
|
592
630
|
var useDatePickerCompoundContext = (componentName) => {
|
|
593
|
-
const context = (0,
|
|
631
|
+
const context = (0, import_react9.useContext)(DatePickerCompoundContext);
|
|
594
632
|
if (context == null) {
|
|
595
633
|
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`);
|
|
596
634
|
}
|
|
@@ -598,12 +636,12 @@ var useDatePickerCompoundContext = (componentName) => {
|
|
|
598
636
|
};
|
|
599
637
|
|
|
600
638
|
// src/date-picker/date-picker-day-button.tsx
|
|
601
|
-
var
|
|
602
|
-
var
|
|
639
|
+
var import_component_theme5 = require("@zenkigen-inc/component-theme");
|
|
640
|
+
var import_clsx9 = require("clsx");
|
|
603
641
|
var import_react_day_picker2 = require("react-day-picker");
|
|
604
642
|
|
|
605
643
|
// src/date-picker/date-picker-styles.ts
|
|
606
|
-
var
|
|
644
|
+
var import_clsx8 = require("clsx");
|
|
607
645
|
var import_react_day_picker = require("react-day-picker");
|
|
608
646
|
var defaultDayPickerClassNames = (0, import_react_day_picker.getDefaultClassNames)();
|
|
609
647
|
var DAY_PICKER_FONT_SIZE = "12px";
|
|
@@ -620,7 +658,7 @@ var dayPickerStyle = {
|
|
|
620
658
|
fontWeight: 700
|
|
621
659
|
};
|
|
622
660
|
var dayPickerClassNames = {
|
|
623
|
-
month: (0,
|
|
661
|
+
month: (0, import_clsx8.clsx)(defaultDayPickerClassNames.month, "flex flex-col px-[7px] py-2")
|
|
624
662
|
};
|
|
625
663
|
var dayButtonBaseClass = "relative grid size-full place-items-center rounded-full !border !border-solid";
|
|
626
664
|
|
|
@@ -640,12 +678,12 @@ var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) =>
|
|
|
640
678
|
day,
|
|
641
679
|
modifiers,
|
|
642
680
|
style: { ...style, fontSize: DAY_PICKER_FONT_SIZE },
|
|
643
|
-
className: (0,
|
|
681
|
+
className: (0, import_clsx9.clsx)(
|
|
644
682
|
className,
|
|
645
683
|
dayButtonBaseClass,
|
|
646
684
|
// 共通: フォーカスリング(有効な日のみ)
|
|
647
685
|
// react-day-picker の rdp-day_button クラスが outline: none を設定しているため、!important で上書き
|
|
648
|
-
!isDisabledDay &&
|
|
686
|
+
!isDisabledDay && import_component_theme5.focusVisible.normalImportant,
|
|
649
687
|
// minDate/maxDate 制限日
|
|
650
688
|
isMinMaxDisabled && "!cursor-not-allowed !border-transparent !text-disabled01",
|
|
651
689
|
// 範囲外の日(前後月)
|
|
@@ -663,24 +701,24 @@ var CustomDayButton = ({ day, modifiers, className, style, ...buttonProps }) =>
|
|
|
663
701
|
};
|
|
664
702
|
|
|
665
703
|
// src/date-picker/date-picker-error-message.tsx
|
|
666
|
-
var
|
|
667
|
-
var
|
|
704
|
+
var import_clsx10 = require("clsx");
|
|
705
|
+
var import_react10 = require("react");
|
|
668
706
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
669
|
-
var DatePickerErrorMessage = (0,
|
|
707
|
+
var DatePickerErrorMessage = (0, import_react10.forwardRef)(
|
|
670
708
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
671
709
|
const { size, isError } = useDatePickerCompoundContext("DatePicker.ErrorMessage");
|
|
672
710
|
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
673
711
|
if (isError !== true) {
|
|
674
712
|
return null;
|
|
675
713
|
}
|
|
676
|
-
const errorMessageClassName = (0,
|
|
714
|
+
const errorMessageClassName = (0, import_clsx10.clsx)(typographyClass, "text-supportError");
|
|
677
715
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
678
716
|
}
|
|
679
717
|
);
|
|
680
718
|
DatePickerErrorMessage.displayName = "DatePicker.ErrorMessage";
|
|
681
719
|
|
|
682
720
|
// src/date-picker/date-picker-month-caption.tsx
|
|
683
|
-
var
|
|
721
|
+
var import_clsx11 = require("clsx");
|
|
684
722
|
var import_react_day_picker3 = require("react-day-picker");
|
|
685
723
|
|
|
686
724
|
// src/date-picker/date-picker-utils.ts
|
|
@@ -754,7 +792,7 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
754
792
|
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
755
793
|
"div",
|
|
756
794
|
{
|
|
757
|
-
className: (0,
|
|
795
|
+
className: (0, import_clsx11.clsx)("flex items-center justify-between px-1 pb-0.5", className),
|
|
758
796
|
style: { ...style, fontSize: "inherit", fontWeight: "inherit" },
|
|
759
797
|
...props,
|
|
760
798
|
children: [
|
|
@@ -787,14 +825,14 @@ var CustomMonthCaption = ({ calendarMonth, className, displayIndex, style, ...pr
|
|
|
787
825
|
};
|
|
788
826
|
|
|
789
827
|
// src/date-picker/date-picker-weekday.tsx
|
|
790
|
-
var
|
|
828
|
+
var import_clsx12 = require("clsx");
|
|
791
829
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
792
830
|
var CustomWeekday = ({ className, children, style, ...props }) => {
|
|
793
831
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
794
832
|
"th",
|
|
795
833
|
{
|
|
796
834
|
...props,
|
|
797
|
-
className: (0,
|
|
835
|
+
className: (0, import_clsx12.clsx)(className, "m-0 size-7 p-0 text-center align-middle text-text02"),
|
|
798
836
|
style: { ...style, fontSize: "inherit", fontWeight: "bold" },
|
|
799
837
|
children
|
|
800
838
|
}
|
|
@@ -818,32 +856,32 @@ var DatePicker = ({
|
|
|
818
856
|
type,
|
|
819
857
|
...restProps
|
|
820
858
|
}) => {
|
|
821
|
-
const autoGeneratedId = (0,
|
|
859
|
+
const autoGeneratedId = (0, import_react11.useId)();
|
|
822
860
|
const describedByBaseId = restProps.id ?? autoGeneratedId;
|
|
823
|
-
const [isOpen, setIsOpen] = (0,
|
|
824
|
-
const [displayMonth, setDisplayMonth] = (0,
|
|
861
|
+
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
862
|
+
const [displayMonth, setDisplayMonth] = (0, import_react11.useState)(() => {
|
|
825
863
|
if (value == null) {
|
|
826
864
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
827
865
|
return createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`);
|
|
828
866
|
}
|
|
829
867
|
return getMonthStartDate(value, timeZone);
|
|
830
868
|
});
|
|
831
|
-
const calendarRef = (0,
|
|
832
|
-
const selectedKey = (0,
|
|
833
|
-
const selectedDate = (0,
|
|
869
|
+
const calendarRef = (0, import_react11.useRef)(null);
|
|
870
|
+
const selectedKey = (0, import_react11.useMemo)(() => value == null ? null : formatDateKey(value, timeZone), [value, timeZone]);
|
|
871
|
+
const selectedDate = (0, import_react11.useMemo)(() => {
|
|
834
872
|
if (selectedKey == null) {
|
|
835
873
|
return;
|
|
836
874
|
}
|
|
837
875
|
return createLocalDateFromKey(selectedKey);
|
|
838
876
|
}, [selectedKey]);
|
|
839
|
-
const minKey = (0,
|
|
840
|
-
const maxKey = (0,
|
|
841
|
-
const currentMonthKey = (0,
|
|
842
|
-
const isOutsideMonth = (0,
|
|
877
|
+
const minKey = (0, import_react11.useMemo)(() => minDate == null ? null : formatDateKey(minDate, timeZone), [minDate, timeZone]);
|
|
878
|
+
const maxKey = (0, import_react11.useMemo)(() => maxDate == null ? null : formatDateKey(maxDate, timeZone), [maxDate, timeZone]);
|
|
879
|
+
const currentMonthKey = (0, import_react11.useMemo)(() => formatLocalDateKey(displayMonth).slice(0, 7), [displayMonth]);
|
|
880
|
+
const isOutsideMonth = (0, import_react11.useCallback)(
|
|
843
881
|
(date) => formatLocalDateKey(date).slice(0, 7) !== currentMonthKey,
|
|
844
882
|
[currentMonthKey]
|
|
845
883
|
);
|
|
846
|
-
const isMinMaxDisabled = (0,
|
|
884
|
+
const isMinMaxDisabled = (0, import_react11.useCallback)(
|
|
847
885
|
(date) => {
|
|
848
886
|
const dateKey = formatLocalDateKey(date);
|
|
849
887
|
if (minKey != null && dateKey < minKey) {
|
|
@@ -856,7 +894,7 @@ var DatePicker = ({
|
|
|
856
894
|
},
|
|
857
895
|
[maxKey, minKey]
|
|
858
896
|
);
|
|
859
|
-
const disabledDays = (0,
|
|
897
|
+
const disabledDays = (0, import_react11.useCallback)(
|
|
860
898
|
(date) => {
|
|
861
899
|
if (isOutsideMonth(date)) {
|
|
862
900
|
return true;
|
|
@@ -865,8 +903,8 @@ var DatePicker = ({
|
|
|
865
903
|
},
|
|
866
904
|
[isOutsideMonth, isMinMaxDisabled]
|
|
867
905
|
);
|
|
868
|
-
const todayForCalendar = (0,
|
|
869
|
-
(0,
|
|
906
|
+
const todayForCalendar = (0, import_react11.useMemo)(() => createLocalDateFromKey(formatLocalDateKey()), []);
|
|
907
|
+
(0, import_react11.useEffect)(() => {
|
|
870
908
|
if (value == null) {
|
|
871
909
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
872
910
|
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
@@ -874,7 +912,7 @@ var DatePicker = ({
|
|
|
874
912
|
}
|
|
875
913
|
setDisplayMonth(getMonthStartDate(value, timeZone));
|
|
876
914
|
}, [value, timeZone]);
|
|
877
|
-
(0,
|
|
915
|
+
(0, import_react11.useEffect)(() => {
|
|
878
916
|
if (!isOpen) {
|
|
879
917
|
return;
|
|
880
918
|
}
|
|
@@ -890,7 +928,7 @@ var DatePicker = ({
|
|
|
890
928
|
});
|
|
891
929
|
return () => cancelAnimationFrame(frame);
|
|
892
930
|
}, [displayMonth, isOpen, value]);
|
|
893
|
-
(0,
|
|
931
|
+
(0, import_react11.useEffect)(() => {
|
|
894
932
|
if (isDisabled) {
|
|
895
933
|
setIsOpen(false);
|
|
896
934
|
}
|
|
@@ -921,7 +959,7 @@ var DatePicker = ({
|
|
|
921
959
|
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
922
960
|
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
923
961
|
};
|
|
924
|
-
const formatters = (0,
|
|
962
|
+
const formatters = (0, import_react11.useMemo)(() => {
|
|
925
963
|
const weekdayFormatter = new Intl.DateTimeFormat("ja-JP", { weekday: "short" });
|
|
926
964
|
return {
|
|
927
965
|
formatCaption: (date) => formatMonthLabel(date),
|
|
@@ -933,15 +971,15 @@ var DatePicker = ({
|
|
|
933
971
|
const displayText = value ? formatDisplayDate(value, timeZone) : placeholder;
|
|
934
972
|
const displayTextClasses = "min-w-0 truncate";
|
|
935
973
|
const errorIds = [];
|
|
936
|
-
const enhancedChildren =
|
|
937
|
-
if (!(0,
|
|
974
|
+
const enhancedChildren = import_react11.Children.map(children, (child) => {
|
|
975
|
+
if (!(0, import_react11.isValidElement)(child)) {
|
|
938
976
|
return child;
|
|
939
977
|
}
|
|
940
978
|
if (child.type === DatePickerErrorMessage && isError) {
|
|
941
979
|
const errorChild = child;
|
|
942
980
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
943
981
|
errorIds.push(assignedId);
|
|
944
|
-
return (0,
|
|
982
|
+
return (0, import_react11.cloneElement)(errorChild, { id: assignedId });
|
|
945
983
|
}
|
|
946
984
|
return child;
|
|
947
985
|
});
|
|
@@ -961,7 +999,7 @@ var DatePicker = ({
|
|
|
961
999
|
...describedByProps,
|
|
962
1000
|
...ariaInvalidProps
|
|
963
1001
|
};
|
|
964
|
-
const contextValue = (0,
|
|
1002
|
+
const contextValue = (0, import_react11.useMemo)(
|
|
965
1003
|
() => ({
|
|
966
1004
|
size,
|
|
967
1005
|
isError
|
|
@@ -1021,7 +1059,7 @@ var DatePicker = ({
|
|
|
1021
1059
|
] })
|
|
1022
1060
|
] }) })
|
|
1023
1061
|
] });
|
|
1024
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
1062
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react11.Children.toArray(enhancedChildren);
|
|
1025
1063
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
1026
1064
|
if (!hasMessageChildren) {
|
|
1027
1065
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DatePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "flex flex-col", children: popoverContent }) });
|
|
@@ -1041,15 +1079,15 @@ function Divider() {
|
|
|
1041
1079
|
}
|
|
1042
1080
|
|
|
1043
1081
|
// src/dropdown/dropdown.tsx
|
|
1044
|
-
var
|
|
1045
|
-
var
|
|
1046
|
-
var
|
|
1082
|
+
var import_component_theme7 = require("@zenkigen-inc/component-theme");
|
|
1083
|
+
var import_clsx15 = __toESM(require("clsx"));
|
|
1084
|
+
var import_react16 = require("react");
|
|
1047
1085
|
var import_react_dom = require("react-dom");
|
|
1048
1086
|
|
|
1049
1087
|
// src/hooks/use-outside-click.ts
|
|
1050
|
-
var
|
|
1088
|
+
var import_react12 = require("react");
|
|
1051
1089
|
var useOutsideClick = (ref, handler, enabled = true) => {
|
|
1052
|
-
(0,
|
|
1090
|
+
(0, import_react12.useEffect)(() => {
|
|
1053
1091
|
const listener = (event) => {
|
|
1054
1092
|
const element = ref?.current;
|
|
1055
1093
|
const target = event.target;
|
|
@@ -1069,8 +1107,8 @@ var useOutsideClick = (ref, handler, enabled = true) => {
|
|
|
1069
1107
|
};
|
|
1070
1108
|
|
|
1071
1109
|
// src/dropdown/dropdown-context.ts
|
|
1072
|
-
var
|
|
1073
|
-
var DropdownContext = (0,
|
|
1110
|
+
var import_react13 = require("react");
|
|
1111
|
+
var DropdownContext = (0, import_react13.createContext)({
|
|
1074
1112
|
isVisible: false,
|
|
1075
1113
|
setIsVisible: () => false,
|
|
1076
1114
|
isDisabled: false,
|
|
@@ -1079,19 +1117,19 @@ var DropdownContext = (0, import_react12.createContext)({
|
|
|
1079
1117
|
});
|
|
1080
1118
|
|
|
1081
1119
|
// src/dropdown/dropdown-item.tsx
|
|
1082
|
-
var
|
|
1083
|
-
var
|
|
1084
|
-
var
|
|
1120
|
+
var import_component_theme6 = require("@zenkigen-inc/component-theme");
|
|
1121
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
1122
|
+
var import_react14 = require("react");
|
|
1085
1123
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1086
1124
|
function DropdownItem({ children, color = "gray", onClick }) {
|
|
1087
|
-
const { setIsVisible } = (0,
|
|
1125
|
+
const { setIsVisible } = (0, import_react14.useContext)(DropdownContext);
|
|
1088
1126
|
const handleClickItem = (event) => {
|
|
1089
1127
|
setIsVisible(false);
|
|
1090
1128
|
onClick?.(event);
|
|
1091
1129
|
};
|
|
1092
|
-
const itemClasses = (0,
|
|
1130
|
+
const itemClasses = (0, import_clsx13.default)(
|
|
1093
1131
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1094
|
-
|
|
1132
|
+
import_component_theme6.focusVisible.inset,
|
|
1095
1133
|
{
|
|
1096
1134
|
"bg-uiBackground01 fill-icon01 text-interactive02": color === "gray",
|
|
1097
1135
|
"fill-supportDanger text-supportDanger": color === "red"
|
|
@@ -1101,8 +1139,8 @@ function DropdownItem({ children, color = "gray", onClick }) {
|
|
|
1101
1139
|
}
|
|
1102
1140
|
|
|
1103
1141
|
// src/dropdown/dropdown-menu.tsx
|
|
1104
|
-
var
|
|
1105
|
-
var
|
|
1142
|
+
var import_clsx14 = __toESM(require("clsx"));
|
|
1143
|
+
var import_react15 = require("react");
|
|
1106
1144
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1107
1145
|
function DropdownMenu({
|
|
1108
1146
|
children,
|
|
@@ -1111,8 +1149,8 @@ function DropdownMenu({
|
|
|
1111
1149
|
verticalPosition = "bottom",
|
|
1112
1150
|
horizontalAlign = "left"
|
|
1113
1151
|
}) {
|
|
1114
|
-
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } = (0,
|
|
1115
|
-
const wrapperClasses = (0,
|
|
1152
|
+
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } = (0, import_react15.useContext)(DropdownContext);
|
|
1153
|
+
const wrapperClasses = (0, import_clsx14.default)("z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 shadow-floatingShadow", {
|
|
1116
1154
|
absolute: !portalTargetRef,
|
|
1117
1155
|
"border-solid border border-uiBorder01": variant === "outline",
|
|
1118
1156
|
"py-1": !isNoPadding,
|
|
@@ -1148,14 +1186,19 @@ function Dropdown({
|
|
|
1148
1186
|
isArrowHidden = false,
|
|
1149
1187
|
portalTargetRef
|
|
1150
1188
|
}) {
|
|
1151
|
-
const [isVisible, setIsVisible] = (0,
|
|
1152
|
-
const [targetDimensions, setTargetDimensions] = (0,
|
|
1189
|
+
const [isVisible, setIsVisible] = (0, import_react16.useState)(false);
|
|
1190
|
+
const [targetDimensions, setTargetDimensions] = (0, import_react16.useState)({
|
|
1153
1191
|
width: 0,
|
|
1154
1192
|
height: 0
|
|
1155
1193
|
});
|
|
1156
|
-
const targetRef = (0,
|
|
1194
|
+
const targetRef = (0, import_react16.useRef)(null);
|
|
1157
1195
|
useOutsideClick(targetRef, () => setIsVisible(false));
|
|
1158
|
-
|
|
1196
|
+
useDismissOnModalOpen(() => {
|
|
1197
|
+
if (isVisible) {
|
|
1198
|
+
setIsVisible(false);
|
|
1199
|
+
}
|
|
1200
|
+
});
|
|
1201
|
+
const handleToggle = (0, import_react16.useCallback)(() => {
|
|
1159
1202
|
if (targetRef.current === null) {
|
|
1160
1203
|
return;
|
|
1161
1204
|
}
|
|
@@ -1171,24 +1214,24 @@ function Dropdown({
|
|
|
1171
1214
|
setIsVisible(true);
|
|
1172
1215
|
}
|
|
1173
1216
|
}, [isVisible]);
|
|
1174
|
-
const wrapperClasses = (0,
|
|
1217
|
+
const wrapperClasses = (0, import_clsx15.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1175
1218
|
"cursor-not-allowed": isDisabled
|
|
1176
1219
|
});
|
|
1177
|
-
const childrenButtonClasses = (0,
|
|
1220
|
+
const childrenButtonClasses = (0, import_clsx15.default)(
|
|
1178
1221
|
"flex items-center justify-center rounded bg-uiBackground01 p-1 hover:bg-hover02 active:bg-active02",
|
|
1179
|
-
|
|
1222
|
+
import_component_theme7.focusVisible.normal,
|
|
1180
1223
|
{
|
|
1181
1224
|
"pointer-events-none": isDisabled,
|
|
1182
1225
|
"border border-uiBorder02": variant === "outline"
|
|
1183
1226
|
}
|
|
1184
1227
|
);
|
|
1185
|
-
const buttonClasses = (0,
|
|
1228
|
+
const buttonClasses = (0, import_clsx15.default)(
|
|
1186
1229
|
"flex items-center rounded bg-uiBackground01",
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1230
|
+
import_component_theme7.buttonColors[variant].base,
|
|
1231
|
+
import_component_theme7.buttonColors[variant].hover,
|
|
1232
|
+
import_component_theme7.buttonColors[variant].active,
|
|
1233
|
+
import_component_theme7.buttonColors[variant].disabled,
|
|
1234
|
+
import_component_theme7.focusVisible.normal,
|
|
1192
1235
|
{
|
|
1193
1236
|
"pointer-events-none": isDisabled,
|
|
1194
1237
|
"h-6 px-2": size === "x-small" || size === "small",
|
|
@@ -1196,7 +1239,7 @@ function Dropdown({
|
|
|
1196
1239
|
"h-10 px-4": size === "large"
|
|
1197
1240
|
}
|
|
1198
1241
|
);
|
|
1199
|
-
const labelClasses = (0,
|
|
1242
|
+
const labelClasses = (0, import_clsx15.default)("flex items-center", {
|
|
1200
1243
|
"mr-1": !isArrowHidden && size === "x-small",
|
|
1201
1244
|
"mr-2": !isArrowHidden && size !== "x-small",
|
|
1202
1245
|
"typography-label12regular": size === "x-small",
|
|
@@ -1242,14 +1285,14 @@ Dropdown.Item = DropdownItem;
|
|
|
1242
1285
|
|
|
1243
1286
|
// src/evaluation-star/evaluation-star.tsx
|
|
1244
1287
|
var import_component_icons2 = require("@zenkigen-inc/component-icons");
|
|
1245
|
-
var
|
|
1246
|
-
var
|
|
1247
|
-
var
|
|
1288
|
+
var import_component_theme8 = require("@zenkigen-inc/component-theme");
|
|
1289
|
+
var import_clsx16 = __toESM(require("clsx"));
|
|
1290
|
+
var import_react17 = require("react");
|
|
1248
1291
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1249
1292
|
function EvaluationStar({ value, isEditable = false, onChangeRating, size = "medium" }) {
|
|
1250
1293
|
const maxRating = 5;
|
|
1251
|
-
const [currentRating, setCurrentRating] = (0,
|
|
1252
|
-
const handleChangeRating = (0,
|
|
1294
|
+
const [currentRating, setCurrentRating] = (0, import_react17.useState)(value);
|
|
1295
|
+
const handleChangeRating = (0, import_react17.useCallback)(
|
|
1253
1296
|
(newRating) => {
|
|
1254
1297
|
if (isEditable) {
|
|
1255
1298
|
setCurrentRating(newRating);
|
|
@@ -1260,7 +1303,7 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
1260
1303
|
},
|
|
1261
1304
|
[isEditable, onChangeRating]
|
|
1262
1305
|
);
|
|
1263
|
-
const starClasses = (0,
|
|
1306
|
+
const starClasses = (0, import_clsx16.default)(import_component_theme8.focusVisible.inset, { "w-6 h-6": size === "large", "w-4 h-4": size === "medium" });
|
|
1264
1307
|
const renderStar = (rating) => {
|
|
1265
1308
|
const color = rating <= currentRating ? "fill-yellow-yellow50" : "fill-icon03";
|
|
1266
1309
|
const IconComponent = import_component_icons2.iconElements["star-filled"];
|
|
@@ -1269,7 +1312,7 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
1269
1312
|
{
|
|
1270
1313
|
type: "button",
|
|
1271
1314
|
onClick: () => handleChangeRating(rating),
|
|
1272
|
-
className: (0,
|
|
1315
|
+
className: (0, import_clsx16.default)(color, starClasses),
|
|
1273
1316
|
disabled: !isEditable,
|
|
1274
1317
|
children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconComponent, {})
|
|
1275
1318
|
},
|
|
@@ -1281,8 +1324,8 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
1281
1324
|
}
|
|
1282
1325
|
|
|
1283
1326
|
// src/file-input/file-input.tsx
|
|
1284
|
-
var
|
|
1285
|
-
var
|
|
1327
|
+
var import_clsx17 = require("clsx");
|
|
1328
|
+
var import_react18 = require("react");
|
|
1286
1329
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1287
1330
|
var ERROR_TYPES = {
|
|
1288
1331
|
SIZE_TOO_LARGE: "SIZE_TOO_LARGE",
|
|
@@ -1292,16 +1335,16 @@ var ERROR_MESSAGES = {
|
|
|
1292
1335
|
SIZE_TOO_LARGE: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u307E\u3059\u3002",
|
|
1293
1336
|
UNSUPPORTED_FORMAT: "\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002"
|
|
1294
1337
|
};
|
|
1295
|
-
var FileInput = (0,
|
|
1338
|
+
var FileInput = (0, import_react18.forwardRef)(
|
|
1296
1339
|
({ id, variant, accept, maxSize, isDisabled = false, isError = false, onSelect, onError, errorMessages, ...rest }, ref) => {
|
|
1297
1340
|
const size = variant === "button" ? rest.size ?? "medium" : "medium";
|
|
1298
|
-
const [selectedFile, setSelectedFile] = (0,
|
|
1299
|
-
const [isDragOver, setIsDragOver] = (0,
|
|
1300
|
-
const fileInputRef = (0,
|
|
1301
|
-
const errorId = (0,
|
|
1302
|
-
const fallbackId = (0,
|
|
1341
|
+
const [selectedFile, setSelectedFile] = (0, import_react18.useState)(null);
|
|
1342
|
+
const [isDragOver, setIsDragOver] = (0, import_react18.useState)(false);
|
|
1343
|
+
const fileInputRef = (0, import_react18.useRef)(null);
|
|
1344
|
+
const errorId = (0, import_react18.useId)();
|
|
1345
|
+
const fallbackId = (0, import_react18.useId)();
|
|
1303
1346
|
const inputId = id ?? fallbackId;
|
|
1304
|
-
const validateFile = (0,
|
|
1347
|
+
const validateFile = (0, import_react18.useCallback)(
|
|
1305
1348
|
(file) => {
|
|
1306
1349
|
const errors = [];
|
|
1307
1350
|
if (maxSize != null && maxSize > 0 && file.size > maxSize) {
|
|
@@ -1340,7 +1383,7 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1340
1383
|
},
|
|
1341
1384
|
[accept, maxSize, onError]
|
|
1342
1385
|
);
|
|
1343
|
-
const handleFileSelect = (0,
|
|
1386
|
+
const handleFileSelect = (0, import_react18.useCallback)(
|
|
1344
1387
|
(file) => {
|
|
1345
1388
|
if (file && !validateFile(file)) {
|
|
1346
1389
|
return;
|
|
@@ -1350,7 +1393,7 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1350
1393
|
},
|
|
1351
1394
|
[validateFile, onSelect]
|
|
1352
1395
|
);
|
|
1353
|
-
const handleFileInputChange = (0,
|
|
1396
|
+
const handleFileInputChange = (0, import_react18.useCallback)(
|
|
1354
1397
|
(event) => {
|
|
1355
1398
|
if (isDisabled) {
|
|
1356
1399
|
return;
|
|
@@ -1366,7 +1409,7 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1366
1409
|
},
|
|
1367
1410
|
[isDisabled, handleFileSelect]
|
|
1368
1411
|
);
|
|
1369
|
-
const handleDragOver = (0,
|
|
1412
|
+
const handleDragOver = (0, import_react18.useCallback)(
|
|
1370
1413
|
(event) => {
|
|
1371
1414
|
event.preventDefault();
|
|
1372
1415
|
if (!isDisabled) {
|
|
@@ -1375,11 +1418,11 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1375
1418
|
},
|
|
1376
1419
|
[isDisabled]
|
|
1377
1420
|
);
|
|
1378
|
-
const handleDragLeave = (0,
|
|
1421
|
+
const handleDragLeave = (0, import_react18.useCallback)((event) => {
|
|
1379
1422
|
event.preventDefault();
|
|
1380
1423
|
setIsDragOver(false);
|
|
1381
1424
|
}, []);
|
|
1382
|
-
const handleDrop = (0,
|
|
1425
|
+
const handleDrop = (0, import_react18.useCallback)(
|
|
1383
1426
|
(event) => {
|
|
1384
1427
|
event.preventDefault();
|
|
1385
1428
|
setIsDragOver(false);
|
|
@@ -1391,19 +1434,19 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1391
1434
|
},
|
|
1392
1435
|
[isDisabled, handleFileSelect]
|
|
1393
1436
|
);
|
|
1394
|
-
const handleButtonClick = (0,
|
|
1437
|
+
const handleButtonClick = (0, import_react18.useCallback)(() => {
|
|
1395
1438
|
if (!isDisabled) {
|
|
1396
1439
|
fileInputRef.current?.click();
|
|
1397
1440
|
}
|
|
1398
1441
|
}, [isDisabled]);
|
|
1399
|
-
const handleClear = (0,
|
|
1442
|
+
const handleClear = (0, import_react18.useCallback)(() => {
|
|
1400
1443
|
setSelectedFile(null);
|
|
1401
1444
|
if (fileInputRef.current) {
|
|
1402
1445
|
fileInputRef.current.value = "";
|
|
1403
1446
|
}
|
|
1404
1447
|
onSelect?.(null);
|
|
1405
1448
|
}, [onSelect]);
|
|
1406
|
-
(0,
|
|
1449
|
+
(0, import_react18.useImperativeHandle)(
|
|
1407
1450
|
ref,
|
|
1408
1451
|
() => ({
|
|
1409
1452
|
reset: handleClear
|
|
@@ -1412,7 +1455,7 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1412
1455
|
);
|
|
1413
1456
|
const hasErrorMessages = !isDisabled && errorMessages != null && errorMessages.length > 0;
|
|
1414
1457
|
const hasErrors = !isDisabled && isError === true;
|
|
1415
|
-
const dropzoneClasses = (0,
|
|
1458
|
+
const dropzoneClasses = (0, import_clsx17.clsx)(
|
|
1416
1459
|
"flex flex-1 flex-col items-center justify-center gap-4 rounded border border-dashed px-6 text-center",
|
|
1417
1460
|
selectedFile ? "py-[52px]" : "py-4",
|
|
1418
1461
|
{
|
|
@@ -1469,7 +1512,7 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1469
1512
|
width: "100%",
|
|
1470
1513
|
onClick: handleButtonClick,
|
|
1471
1514
|
before: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "upload", size: "small" }),
|
|
1472
|
-
after: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: selectedFile ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0,
|
|
1515
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_jsx_runtime22.Fragment, { children: selectedFile ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx17.clsx)("typography-label12regular truncate", !isDisabled && "text-text01"), children: selectedFile.name }) : "" }),
|
|
1473
1516
|
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "truncate", children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" })
|
|
1474
1517
|
}
|
|
1475
1518
|
) }),
|
|
@@ -1516,14 +1559,14 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1516
1559
|
"\u3053\u3053\u306B\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
1517
1560
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("br", {}),
|
|
1518
1561
|
"\u307E\u305F\u306F\u3001",
|
|
1519
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0,
|
|
1562
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: (0, import_clsx17.clsx)(!isDisabled ? "text-link01" : ""), children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" }),
|
|
1520
1563
|
"\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
1521
1564
|
] }) }) }),
|
|
1522
1565
|
!selectedFile && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
1523
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0,
|
|
1524
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0,
|
|
1525
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0,
|
|
1526
|
-
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0,
|
|
1566
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx17.clsx)("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u5BFE\u5FDC\u5F62\u5F0F" }),
|
|
1567
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx17.clsx)("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: acceptLabel }),
|
|
1568
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx17.clsx)("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u30B5\u30A4\u30BA" }),
|
|
1569
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: (0, import_clsx17.clsx)("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: maxSizeLabel })
|
|
1527
1570
|
] }),
|
|
1528
1571
|
selectedFile && /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("div", { className: "mt-2 flex flex-col items-center gap-1", children: [
|
|
1529
1572
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { className: "typography-label11regular text-text02", children: "\u30D5\u30A1\u30A4\u30EB\u540D" }),
|
|
@@ -1574,12 +1617,12 @@ var FileInput = (0, import_react17.forwardRef)(
|
|
|
1574
1617
|
FileInput.displayName = "FileInput";
|
|
1575
1618
|
|
|
1576
1619
|
// src/heading/heading.tsx
|
|
1577
|
-
var
|
|
1578
|
-
var
|
|
1620
|
+
var import_component_theme9 = require("@zenkigen-inc/component-theme");
|
|
1621
|
+
var import_clsx18 = require("clsx");
|
|
1579
1622
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1580
1623
|
function Heading(props) {
|
|
1581
1624
|
const TagName = `h${props.level}`;
|
|
1582
|
-
const classes = (0,
|
|
1625
|
+
const classes = (0, import_clsx18.clsx)(`flex items-center text-text01`, import_component_theme9.typography.heading[TagName], {
|
|
1583
1626
|
"gap-2": props.level === 1,
|
|
1584
1627
|
"gap-1": props.level > 1
|
|
1585
1628
|
});
|
|
@@ -1591,22 +1634,22 @@ function Heading(props) {
|
|
|
1591
1634
|
}
|
|
1592
1635
|
|
|
1593
1636
|
// src/hooks/use-roving-focus.ts
|
|
1594
|
-
var
|
|
1637
|
+
var import_react19 = require("react");
|
|
1595
1638
|
var useRovingFocus = ({
|
|
1596
1639
|
values,
|
|
1597
1640
|
defaultFocusedValue,
|
|
1598
1641
|
isDisabled = false
|
|
1599
1642
|
}) => {
|
|
1600
|
-
const [focusedValue, setFocusedValue] = (0,
|
|
1643
|
+
const [focusedValue, setFocusedValue] = (0, import_react19.useState)(
|
|
1601
1644
|
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
1602
1645
|
);
|
|
1603
|
-
const handleFocusChange = (0,
|
|
1646
|
+
const handleFocusChange = (0, import_react19.useCallback)((newValue) => {
|
|
1604
1647
|
setFocusedValue(newValue);
|
|
1605
1648
|
}, []);
|
|
1606
|
-
const handleBlur = (0,
|
|
1649
|
+
const handleBlur = (0, import_react19.useCallback)(() => {
|
|
1607
1650
|
setFocusedValue(null);
|
|
1608
1651
|
}, []);
|
|
1609
|
-
const handleKeyDown = (0,
|
|
1652
|
+
const handleKeyDown = (0, import_react19.useCallback)(
|
|
1610
1653
|
(event) => {
|
|
1611
1654
|
if (isDisabled === true || values.length === 0) return;
|
|
1612
1655
|
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
@@ -1661,11 +1704,11 @@ var useRovingFocus = ({
|
|
|
1661
1704
|
};
|
|
1662
1705
|
|
|
1663
1706
|
// src/loading/loading.tsx
|
|
1664
|
-
var
|
|
1707
|
+
var import_clsx19 = __toESM(require("clsx"));
|
|
1665
1708
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1666
1709
|
function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
1667
|
-
const wrapperClasses = (0,
|
|
1668
|
-
const svgClasses = (0,
|
|
1710
|
+
const wrapperClasses = (0, import_clsx19.default)(position, "left-0 top-0 z-20 flex w-full items-center justify-center");
|
|
1711
|
+
const svgClasses = (0, import_clsx19.default)({
|
|
1669
1712
|
"h-4 w-4": size === "small",
|
|
1670
1713
|
"h-8 w-8": size === "medium",
|
|
1671
1714
|
"h-16 w-16": size === "large"
|
|
@@ -1711,13 +1754,13 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
1711
1754
|
}
|
|
1712
1755
|
|
|
1713
1756
|
// src/modal/modal.tsx
|
|
1714
|
-
var
|
|
1757
|
+
var import_react23 = require("react");
|
|
1715
1758
|
var import_react_dom2 = require("react-dom");
|
|
1716
1759
|
|
|
1717
1760
|
// src/modal/body-scroll-lock.tsx
|
|
1718
|
-
var
|
|
1761
|
+
var import_react20 = require("react");
|
|
1719
1762
|
var BodyScrollLock = () => {
|
|
1720
|
-
(0,
|
|
1763
|
+
(0, import_react20.useLayoutEffect)(() => {
|
|
1721
1764
|
const { scrollX, scrollY } = window;
|
|
1722
1765
|
const { body } = document;
|
|
1723
1766
|
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
|
@@ -1768,28 +1811,28 @@ function ModalBody({ children }) {
|
|
|
1768
1811
|
}
|
|
1769
1812
|
|
|
1770
1813
|
// src/modal/modal-context.ts
|
|
1771
|
-
var
|
|
1772
|
-
var ModalContext = (0,
|
|
1814
|
+
var import_react21 = require("react");
|
|
1815
|
+
var ModalContext = (0, import_react21.createContext)({
|
|
1773
1816
|
onClose: () => null
|
|
1774
1817
|
});
|
|
1775
1818
|
|
|
1776
1819
|
// src/modal/modal-footer.tsx
|
|
1777
|
-
var
|
|
1820
|
+
var import_clsx20 = __toESM(require("clsx"));
|
|
1778
1821
|
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1779
1822
|
function ModalFooter({ children, isNoBorder = false }) {
|
|
1780
|
-
const wrapperClasses = (0,
|
|
1823
|
+
const wrapperClasses = (0, import_clsx20.default)("flex w-full shrink-0 items-center rounded-b-lg px-6 py-4", {
|
|
1781
1824
|
"border-t-[1px] border-uiBorder01": !isNoBorder
|
|
1782
1825
|
});
|
|
1783
1826
|
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: wrapperClasses, children });
|
|
1784
1827
|
}
|
|
1785
1828
|
|
|
1786
1829
|
// src/modal/modal-header.tsx
|
|
1787
|
-
var
|
|
1788
|
-
var
|
|
1830
|
+
var import_clsx21 = __toESM(require("clsx"));
|
|
1831
|
+
var import_react22 = require("react");
|
|
1789
1832
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1790
1833
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
1791
|
-
const { onClose } = (0,
|
|
1792
|
-
const headerClasses = (0,
|
|
1834
|
+
const { onClose } = (0, import_react22.useContext)(ModalContext);
|
|
1835
|
+
const headerClasses = (0, import_clsx21.default)(
|
|
1793
1836
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
1794
1837
|
{
|
|
1795
1838
|
"border-b border-uiBorder01": !isNoBorder,
|
|
@@ -1816,12 +1859,17 @@ function Modal({
|
|
|
1816
1859
|
onClose,
|
|
1817
1860
|
portalTargetRef
|
|
1818
1861
|
}) {
|
|
1819
|
-
const [isMounted, setIsMounted] = (0,
|
|
1862
|
+
const [isMounted, setIsMounted] = (0, import_react23.useState)(false);
|
|
1820
1863
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
1821
1864
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
1822
|
-
(0,
|
|
1865
|
+
(0, import_react23.useEffect)(() => {
|
|
1823
1866
|
setIsMounted(true);
|
|
1824
1867
|
}, []);
|
|
1868
|
+
(0, import_react23.useEffect)(() => {
|
|
1869
|
+
if (isOpen) {
|
|
1870
|
+
window.dispatchEvent(new CustomEvent(MODAL_OPEN_EVENT));
|
|
1871
|
+
}
|
|
1872
|
+
}, [isOpen]);
|
|
1825
1873
|
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
1826
1874
|
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(BodyScrollLock, {}),
|
|
1827
1875
|
(0, import_react_dom2.createPortal)(
|
|
@@ -1844,10 +1892,10 @@ Modal.Header = ModalHeader;
|
|
|
1844
1892
|
Modal.Footer = ModalFooter;
|
|
1845
1893
|
|
|
1846
1894
|
// src/notification-inline/notification-inline.tsx
|
|
1847
|
-
var
|
|
1895
|
+
var import_clsx22 = require("clsx");
|
|
1848
1896
|
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1849
1897
|
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
1850
|
-
const wrapperClasses = (0,
|
|
1898
|
+
const wrapperClasses = (0, import_clsx22.clsx)("typography-body13regular flex items-center gap-1 rounded text-text01", {
|
|
1851
1899
|
"bg-uiBackgroundError": state === "attention",
|
|
1852
1900
|
"bg-uiBackgroundWarning": state === "warning",
|
|
1853
1901
|
"bg-uiBackgroundBlue": state === "information",
|
|
@@ -1856,7 +1904,7 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1856
1904
|
"p-2": size === "small",
|
|
1857
1905
|
"p-3": size === "medium"
|
|
1858
1906
|
});
|
|
1859
|
-
const iconClasses = (0,
|
|
1907
|
+
const iconClasses = (0, import_clsx22.clsx)("flex items-center", {
|
|
1860
1908
|
"fill-supportError": state === "attention",
|
|
1861
1909
|
"fill-supportWarning": state === "warning",
|
|
1862
1910
|
"fill-blue-blue50": state === "information",
|
|
@@ -1880,20 +1928,20 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1880
1928
|
}
|
|
1881
1929
|
|
|
1882
1930
|
// src/pagination/pagination-button.tsx
|
|
1883
|
-
var
|
|
1884
|
-
var
|
|
1931
|
+
var import_clsx23 = require("clsx");
|
|
1932
|
+
var import_react25 = require("react");
|
|
1885
1933
|
|
|
1886
1934
|
// src/pagination/pagination-context.ts
|
|
1887
|
-
var
|
|
1888
|
-
var PaginationContext = (0,
|
|
1935
|
+
var import_react24 = require("react");
|
|
1936
|
+
var PaginationContext = (0, import_react24.createContext)({
|
|
1889
1937
|
currentPage: 0
|
|
1890
1938
|
});
|
|
1891
1939
|
|
|
1892
1940
|
// src/pagination/pagination-button.tsx
|
|
1893
1941
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1894
1942
|
function PaginationButton({ page, onClick }) {
|
|
1895
|
-
const { currentPage } = (0,
|
|
1896
|
-
const buttonClasses = (0,
|
|
1943
|
+
const { currentPage } = (0, import_react25.useContext)(PaginationContext);
|
|
1944
|
+
const buttonClasses = (0, import_clsx23.clsx)(
|
|
1897
1945
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
1898
1946
|
"typography-label14regular",
|
|
1899
1947
|
"text-interactive02",
|
|
@@ -1979,14 +2027,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1979
2027
|
}
|
|
1980
2028
|
|
|
1981
2029
|
// src/select/select.tsx
|
|
1982
|
-
var
|
|
1983
|
-
var
|
|
1984
|
-
var
|
|
1985
|
-
var
|
|
2030
|
+
var import_react29 = require("@floating-ui/react");
|
|
2031
|
+
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
2032
|
+
var import_clsx26 = __toESM(require("clsx"));
|
|
2033
|
+
var import_react30 = require("react");
|
|
1986
2034
|
|
|
1987
2035
|
// src/select/select-context.ts
|
|
1988
|
-
var
|
|
1989
|
-
var SelectContext = (0,
|
|
2036
|
+
var import_react26 = require("react");
|
|
2037
|
+
var SelectContext = (0, import_react26.createContext)({
|
|
1990
2038
|
size: "medium",
|
|
1991
2039
|
setIsOptionListOpen: () => false,
|
|
1992
2040
|
variant: "outline",
|
|
@@ -1994,19 +2042,19 @@ var SelectContext = (0, import_react25.createContext)({
|
|
|
1994
2042
|
});
|
|
1995
2043
|
|
|
1996
2044
|
// src/select/select-item.tsx
|
|
1997
|
-
var
|
|
1998
|
-
var
|
|
1999
|
-
var
|
|
2045
|
+
var import_component_theme10 = require("@zenkigen-inc/component-theme");
|
|
2046
|
+
var import_clsx24 = __toESM(require("clsx"));
|
|
2047
|
+
var import_react27 = require("react");
|
|
2000
2048
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
2001
2049
|
function SelectItem({ option }) {
|
|
2002
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0,
|
|
2050
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0, import_react27.useContext)(SelectContext);
|
|
2003
2051
|
const handleClickItem = (option2) => {
|
|
2004
2052
|
onChange?.(option2);
|
|
2005
2053
|
setIsOptionListOpen(false);
|
|
2006
2054
|
};
|
|
2007
|
-
const itemClasses = (0,
|
|
2055
|
+
const itemClasses = (0, import_clsx24.default)(
|
|
2008
2056
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
2009
|
-
|
|
2057
|
+
import_component_theme10.focusVisible.inset,
|
|
2010
2058
|
{
|
|
2011
2059
|
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
2012
2060
|
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
@@ -2022,17 +2070,17 @@ function SelectItem({ option }) {
|
|
|
2022
2070
|
}
|
|
2023
2071
|
|
|
2024
2072
|
// src/select/select-list.tsx
|
|
2025
|
-
var
|
|
2026
|
-
var
|
|
2027
|
-
var
|
|
2073
|
+
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
2074
|
+
var import_clsx25 = __toESM(require("clsx"));
|
|
2075
|
+
var import_react28 = require("react");
|
|
2028
2076
|
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
2029
|
-
var SelectList = (0,
|
|
2030
|
-
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } = (0,
|
|
2077
|
+
var SelectList = (0, import_react28.forwardRef)(({ children, maxHeight }, ref) => {
|
|
2078
|
+
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } = (0, import_react28.useContext)(SelectContext);
|
|
2031
2079
|
const handleClickDeselect = () => {
|
|
2032
2080
|
onChange?.(null);
|
|
2033
2081
|
setIsOptionListOpen(false);
|
|
2034
2082
|
};
|
|
2035
|
-
(0,
|
|
2083
|
+
(0, import_react28.useLayoutEffect)(() => {
|
|
2036
2084
|
if (maxHeight != null && selectedOption != null) {
|
|
2037
2085
|
const container = floatingRef?.current;
|
|
2038
2086
|
if (container != null) {
|
|
@@ -2050,12 +2098,12 @@ var SelectList = (0, import_react27.forwardRef)(({ children, maxHeight }, ref) =
|
|
|
2050
2098
|
}
|
|
2051
2099
|
}
|
|
2052
2100
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
2053
|
-
const listClasses = (0,
|
|
2101
|
+
const listClasses = (0, import_clsx25.default)("overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
2054
2102
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
2055
2103
|
});
|
|
2056
|
-
const deselectButtonClasses = (0,
|
|
2104
|
+
const deselectButtonClasses = (0, import_clsx25.default)(
|
|
2057
2105
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
2058
|
-
|
|
2106
|
+
import_component_theme11.focusVisible.inset
|
|
2059
2107
|
);
|
|
2060
2108
|
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
2061
2109
|
children,
|
|
@@ -2083,16 +2131,21 @@ function Select({
|
|
|
2083
2131
|
optionListMaxHeight,
|
|
2084
2132
|
matchListToTrigger = false
|
|
2085
2133
|
}) {
|
|
2086
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
2087
|
-
const targetRef = (0,
|
|
2134
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react30.useState)(false);
|
|
2135
|
+
const targetRef = (0, import_react30.useRef)(null);
|
|
2088
2136
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
2089
|
-
|
|
2137
|
+
useDismissOnModalOpen(() => {
|
|
2138
|
+
if (isOptionListOpen) {
|
|
2139
|
+
setIsOptionListOpen(false);
|
|
2140
|
+
}
|
|
2141
|
+
});
|
|
2142
|
+
const { refs, floatingStyles } = (0, import_react29.useFloating)({
|
|
2090
2143
|
open: isOptionListOpen,
|
|
2091
2144
|
onOpenChange: setIsOptionListOpen,
|
|
2092
2145
|
placement: "bottom-start",
|
|
2093
2146
|
middleware: [
|
|
2094
|
-
(0,
|
|
2095
|
-
(0,
|
|
2147
|
+
(0, import_react29.offset)(FLOATING_OFFSET),
|
|
2148
|
+
(0, import_react29.size)({
|
|
2096
2149
|
apply({ availableWidth, elements, rects }) {
|
|
2097
2150
|
const referenceWidth = rects.reference.width;
|
|
2098
2151
|
if (matchListToTrigger) {
|
|
@@ -2104,33 +2157,33 @@ function Select({
|
|
|
2104
2157
|
}
|
|
2105
2158
|
})
|
|
2106
2159
|
],
|
|
2107
|
-
whileElementsMounted:
|
|
2160
|
+
whileElementsMounted: import_react29.autoUpdate
|
|
2108
2161
|
});
|
|
2109
2162
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
2110
2163
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
2111
2164
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
2112
|
-
const wrapperClasses = (0,
|
|
2165
|
+
const wrapperClasses = (0, import_clsx26.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
2113
2166
|
"h-6": size === "x-small" || size === "small",
|
|
2114
2167
|
"h-8": size === "medium",
|
|
2115
2168
|
"h-10": size === "large",
|
|
2116
2169
|
"cursor-not-allowed": isDisabled
|
|
2117
2170
|
});
|
|
2118
|
-
const buttonClasses = (0,
|
|
2171
|
+
const buttonClasses = (0, import_clsx26.default)(
|
|
2119
2172
|
"flex size-full items-center rounded",
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2173
|
+
import_component_theme12.selectColors[buttonVariant].hover,
|
|
2174
|
+
import_component_theme12.selectColors[buttonVariant].active,
|
|
2175
|
+
import_component_theme12.selectColors[buttonVariant].disabled,
|
|
2176
|
+
import_component_theme12.focusVisible.normal,
|
|
2124
2177
|
{
|
|
2125
|
-
[
|
|
2126
|
-
[
|
|
2178
|
+
[import_component_theme12.selectColors[buttonVariant].selected]: isSelected,
|
|
2179
|
+
[import_component_theme12.selectColors[buttonVariant].base]: !isSelected,
|
|
2127
2180
|
"px-2": size === "x-small" || size === "small",
|
|
2128
2181
|
"px-4": size === "medium" || size === "large",
|
|
2129
2182
|
"pointer-events-none": isDisabled,
|
|
2130
2183
|
"border-supportError": !isSelected && !isDisabled && isError
|
|
2131
2184
|
}
|
|
2132
2185
|
);
|
|
2133
|
-
const labelClasses = (0,
|
|
2186
|
+
const labelClasses = (0, import_clsx26.default)("overflow-hidden", {
|
|
2134
2187
|
"mr-1": size === "x-small",
|
|
2135
2188
|
"mr-2": size !== "x-small",
|
|
2136
2189
|
"typography-label12regular": size === "x-small",
|
|
@@ -2173,7 +2226,7 @@ function Select({
|
|
|
2173
2226
|
]
|
|
2174
2227
|
}
|
|
2175
2228
|
),
|
|
2176
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
2229
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_react29.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "relative z-popover", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SelectList, { ref: refs.setFloating, maxHeight: optionListMaxHeight, children }) }) })
|
|
2177
2230
|
] })
|
|
2178
2231
|
}
|
|
2179
2232
|
);
|
|
@@ -2261,17 +2314,17 @@ function PaginationSelect({
|
|
|
2261
2314
|
}
|
|
2262
2315
|
|
|
2263
2316
|
// src/password-input/password-input.tsx
|
|
2264
|
-
var
|
|
2317
|
+
var import_react35 = require("react");
|
|
2265
2318
|
|
|
2266
2319
|
// src/text-input/text-input.tsx
|
|
2267
|
-
var
|
|
2268
|
-
var
|
|
2320
|
+
var import_clsx29 = require("clsx");
|
|
2321
|
+
var import_react34 = require("react");
|
|
2269
2322
|
|
|
2270
2323
|
// src/text-input/text-input-context.tsx
|
|
2271
|
-
var
|
|
2272
|
-
var TextInputCompoundContext = (0,
|
|
2324
|
+
var import_react31 = require("react");
|
|
2325
|
+
var TextInputCompoundContext = (0, import_react31.createContext)(null);
|
|
2273
2326
|
var useTextInputCompoundContext = (componentName) => {
|
|
2274
|
-
const context = (0,
|
|
2327
|
+
const context = (0, import_react31.useContext)(TextInputCompoundContext);
|
|
2275
2328
|
if (context == null) {
|
|
2276
2329
|
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`);
|
|
2277
2330
|
}
|
|
@@ -2279,10 +2332,10 @@ var useTextInputCompoundContext = (componentName) => {
|
|
|
2279
2332
|
};
|
|
2280
2333
|
|
|
2281
2334
|
// src/text-input/text-input-error-message.tsx
|
|
2282
|
-
var
|
|
2283
|
-
var
|
|
2335
|
+
var import_clsx27 = require("clsx");
|
|
2336
|
+
var import_react32 = require("react");
|
|
2284
2337
|
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2285
|
-
var TextInputErrorMessage = (0,
|
|
2338
|
+
var TextInputErrorMessage = (0, import_react32.forwardRef)(
|
|
2286
2339
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
2287
2340
|
const { inputProps } = useTextInputCompoundContext("TextInput.ErrorMessage");
|
|
2288
2341
|
const typographyClass = inputProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -2290,20 +2343,20 @@ var TextInputErrorMessage = (0, import_react31.forwardRef)(
|
|
|
2290
2343
|
if (!shouldRender) {
|
|
2291
2344
|
return null;
|
|
2292
2345
|
}
|
|
2293
|
-
const errorMessageClassName = (0,
|
|
2346
|
+
const errorMessageClassName = (0, import_clsx27.clsx)(typographyClass, "text-supportError");
|
|
2294
2347
|
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
2295
2348
|
}
|
|
2296
2349
|
);
|
|
2297
2350
|
TextInputErrorMessage.displayName = "TextInput.ErrorMessage";
|
|
2298
2351
|
|
|
2299
2352
|
// src/text-input/text-input-helper-message.tsx
|
|
2300
|
-
var
|
|
2301
|
-
var
|
|
2353
|
+
var import_clsx28 = require("clsx");
|
|
2354
|
+
var import_react33 = require("react");
|
|
2302
2355
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2303
|
-
var TextInputHelperMessage = (0,
|
|
2356
|
+
var TextInputHelperMessage = (0, import_react33.forwardRef)((props, ref) => {
|
|
2304
2357
|
const { inputProps } = useTextInputCompoundContext("TextInput.HelperMessage");
|
|
2305
2358
|
const typographyClass = inputProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
2306
|
-
const helperMessageClassName = (0,
|
|
2359
|
+
const helperMessageClassName = (0, import_clsx28.clsx)(typographyClass, "text-text02");
|
|
2307
2360
|
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { ref, className: helperMessageClassName, ...props });
|
|
2308
2361
|
});
|
|
2309
2362
|
TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
@@ -2312,6 +2365,7 @@ TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
|
2312
2365
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
2313
2366
|
function TextInputInner({
|
|
2314
2367
|
size = "medium",
|
|
2368
|
+
variant = "outline",
|
|
2315
2369
|
isError = false,
|
|
2316
2370
|
disabled = false,
|
|
2317
2371
|
onClickClearButton,
|
|
@@ -2319,9 +2373,9 @@ function TextInputInner({
|
|
|
2319
2373
|
children,
|
|
2320
2374
|
...props
|
|
2321
2375
|
}, ref) {
|
|
2322
|
-
const autoGeneratedId = (0,
|
|
2376
|
+
const autoGeneratedId = (0, import_react34.useId)();
|
|
2323
2377
|
const { className: _className, ...restInputProps } = props;
|
|
2324
|
-
const inputPropsForContext = (0,
|
|
2378
|
+
const inputPropsForContext = (0, import_react34.useMemo)(
|
|
2325
2379
|
() => ({
|
|
2326
2380
|
...restInputProps,
|
|
2327
2381
|
size,
|
|
@@ -2332,7 +2386,7 @@ function TextInputInner({
|
|
|
2332
2386
|
}),
|
|
2333
2387
|
[restInputProps, size, isError, disabled, onClickClearButton, after]
|
|
2334
2388
|
);
|
|
2335
|
-
const contextValue = (0,
|
|
2389
|
+
const contextValue = (0, import_react34.useMemo)(
|
|
2336
2390
|
() => ({
|
|
2337
2391
|
inputProps: inputPropsForContext,
|
|
2338
2392
|
forwardedRef: ref
|
|
@@ -2342,21 +2396,21 @@ function TextInputInner({
|
|
|
2342
2396
|
const helperMessageIds = [];
|
|
2343
2397
|
const errorIds = [];
|
|
2344
2398
|
const describedByBaseId = restInputProps.id ?? autoGeneratedId;
|
|
2345
|
-
const enhancedChildren =
|
|
2346
|
-
if (!(0,
|
|
2399
|
+
const enhancedChildren = import_react34.Children.map(children, (child) => {
|
|
2400
|
+
if (!(0, import_react34.isValidElement)(child)) {
|
|
2347
2401
|
return child;
|
|
2348
2402
|
}
|
|
2349
2403
|
if (child.type === TextInputHelperMessage) {
|
|
2350
2404
|
const helperChild = child;
|
|
2351
2405
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
2352
2406
|
helperMessageIds.push(assignedId);
|
|
2353
|
-
return (0,
|
|
2407
|
+
return (0, import_react34.cloneElement)(helperChild, { id: assignedId });
|
|
2354
2408
|
}
|
|
2355
2409
|
if (child.type === TextInputErrorMessage && isError) {
|
|
2356
2410
|
const errorChild = child;
|
|
2357
2411
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
2358
2412
|
errorIds.push(assignedId);
|
|
2359
|
-
return (0,
|
|
2413
|
+
return (0, import_react34.cloneElement)(errorChild, { id: assignedId });
|
|
2360
2414
|
}
|
|
2361
2415
|
return child;
|
|
2362
2416
|
});
|
|
@@ -2379,21 +2433,37 @@ function TextInputInner({
|
|
|
2379
2433
|
};
|
|
2380
2434
|
const isShowClearButton = !!onClickClearButton && restInputProps.value.length !== 0 && !disabled;
|
|
2381
2435
|
const hasTrailingElement = isShowClearButton || after != null;
|
|
2382
|
-
const
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
"
|
|
2386
|
-
"
|
|
2387
|
-
"
|
|
2388
|
-
"
|
|
2389
|
-
"
|
|
2390
|
-
"
|
|
2436
|
+
const isBorderless = variant === "text";
|
|
2437
|
+
const inputWrapClasses = (0, import_clsx29.clsx)("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
2438
|
+
// outline variant
|
|
2439
|
+
"border-uiBorder02": !isBorderless && !isError && !disabled,
|
|
2440
|
+
"border-supportError": !isBorderless && isError && !disabled,
|
|
2441
|
+
"hover:border-hoverInput": !isBorderless && !disabled && !isError,
|
|
2442
|
+
"hover:focus-within:border-activeInput": !isBorderless && !isError,
|
|
2443
|
+
"focus-within:border-activeInput": !isBorderless && !isError,
|
|
2444
|
+
"bg-disabled02 border-disabled01": !isBorderless && disabled,
|
|
2445
|
+
// text variant
|
|
2446
|
+
"border-transparent": isBorderless,
|
|
2447
|
+
// 共通
|
|
2448
|
+
"bg-uiBackground01": !disabled || isBorderless,
|
|
2449
|
+
"pr-2": !isBorderless && size === "medium" && hasTrailingElement,
|
|
2450
|
+
"pr-3": !isBorderless && size === "large" && hasTrailingElement
|
|
2391
2451
|
});
|
|
2392
|
-
const inputClasses = (0,
|
|
2393
|
-
|
|
2394
|
-
|
|
2452
|
+
const inputClasses = (0, import_clsx29.clsx)("flex-1 bg-transparent outline-none", {
|
|
2453
|
+
"disabled:text-textPlaceholder": !isBorderless,
|
|
2454
|
+
"disabled:text-disabled01": isBorderless,
|
|
2455
|
+
// outline: 従来の padding
|
|
2456
|
+
"typography-label14regular min-h-8 px-2": !isBorderless && size === "medium",
|
|
2457
|
+
"typography-label16regular min-h-10 px-3": !isBorderless && size === "large",
|
|
2458
|
+
// text: padding なし
|
|
2459
|
+
"typography-label14regular min-h-8": isBorderless && size === "medium",
|
|
2460
|
+
"typography-label16regular min-h-10": isBorderless && size === "large",
|
|
2461
|
+
// テキスト色
|
|
2395
2462
|
"text-text01": !isError,
|
|
2396
2463
|
"text-supportError": isError,
|
|
2464
|
+
// placeholder 色(text variant エラー時のみ上書き)
|
|
2465
|
+
"placeholder:text-textPlaceholder": !(isBorderless && isError && !disabled),
|
|
2466
|
+
"placeholder:text-supportErrorLight": isBorderless && isError && !disabled,
|
|
2397
2467
|
"pr-0": hasTrailingElement
|
|
2398
2468
|
});
|
|
2399
2469
|
const inputElement = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: inputWrapClasses, children: [
|
|
@@ -2401,7 +2471,7 @@ function TextInputInner({
|
|
|
2401
2471
|
after,
|
|
2402
2472
|
isShowClearButton && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
2403
2473
|
] });
|
|
2404
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
2474
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react34.Children.toArray(enhancedChildren);
|
|
2405
2475
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
2406
2476
|
if (!hasMessageChildren) {
|
|
2407
2477
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TextInputCompoundContext.Provider, { value: contextValue, children: inputElement });
|
|
@@ -2417,10 +2487,10 @@ var attachStatics = (component) => {
|
|
|
2417
2487
|
component.displayName = "TextInput";
|
|
2418
2488
|
return component;
|
|
2419
2489
|
};
|
|
2420
|
-
var TextInputPublic = (0,
|
|
2490
|
+
var TextInputPublic = (0, import_react34.forwardRef)(function TextInputPublic2(props, ref) {
|
|
2421
2491
|
return TextInputInner(props, ref);
|
|
2422
2492
|
});
|
|
2423
|
-
var InternalTextInputBase = (0,
|
|
2493
|
+
var InternalTextInputBase = (0, import_react34.forwardRef)(
|
|
2424
2494
|
function InternalTextInputBase2(props, ref) {
|
|
2425
2495
|
return TextInputInner(props, ref);
|
|
2426
2496
|
}
|
|
@@ -2430,8 +2500,8 @@ var InternalTextInput = attachStatics(InternalTextInputBase);
|
|
|
2430
2500
|
|
|
2431
2501
|
// src/password-input/password-input.tsx
|
|
2432
2502
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2433
|
-
var PasswordInputBase = (0,
|
|
2434
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
2503
|
+
var PasswordInputBase = (0, import_react35.forwardRef)(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
2504
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react35.useState)(false);
|
|
2435
2505
|
const { className: _className, ...textInputProps } = props;
|
|
2436
2506
|
const handlePasswordVisibilityToggle = () => {
|
|
2437
2507
|
setIsPasswordVisible((prev) => !prev);
|
|
@@ -2466,7 +2536,7 @@ var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
|
2466
2536
|
});
|
|
2467
2537
|
|
|
2468
2538
|
// src/popup/popup.tsx
|
|
2469
|
-
var
|
|
2539
|
+
var import_react38 = require("react");
|
|
2470
2540
|
|
|
2471
2541
|
// src/popup/popup-body.tsx
|
|
2472
2542
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
@@ -2475,8 +2545,8 @@ function PopupBody({ children }) {
|
|
|
2475
2545
|
}
|
|
2476
2546
|
|
|
2477
2547
|
// src/popup/popup-context.ts
|
|
2478
|
-
var
|
|
2479
|
-
var PopupContext = (0,
|
|
2548
|
+
var import_react36 = require("react");
|
|
2549
|
+
var PopupContext = (0, import_react36.createContext)({
|
|
2480
2550
|
isOpen: false,
|
|
2481
2551
|
onClose: () => null
|
|
2482
2552
|
});
|
|
@@ -2488,10 +2558,10 @@ function PopupFooter({ children }) {
|
|
|
2488
2558
|
}
|
|
2489
2559
|
|
|
2490
2560
|
// src/popup/popup-header.tsx
|
|
2491
|
-
var
|
|
2561
|
+
var import_react37 = require("react");
|
|
2492
2562
|
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2493
2563
|
function PopupHeader({ children, before }) {
|
|
2494
|
-
const { onClose } = (0,
|
|
2564
|
+
const { onClose } = (0, import_react37.useContext)(PopupContext);
|
|
2495
2565
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("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: [
|
|
2496
2566
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2497
2567
|
before,
|
|
@@ -2506,7 +2576,7 @@ var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
|
2506
2576
|
var LIMIT_WIDTH2 = 320;
|
|
2507
2577
|
var LIMIT_HEIGHT2 = 184;
|
|
2508
2578
|
function useOptionalPopoverContext() {
|
|
2509
|
-
return (0,
|
|
2579
|
+
return (0, import_react38.useContext)(PopoverContext);
|
|
2510
2580
|
}
|
|
2511
2581
|
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
2512
2582
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
@@ -2531,29 +2601,42 @@ Popup.Header = PopupHeader;
|
|
|
2531
2601
|
Popup.Footer = PopupFooter;
|
|
2532
2602
|
|
|
2533
2603
|
// src/radio/radio.tsx
|
|
2534
|
-
var
|
|
2535
|
-
var
|
|
2536
|
-
var
|
|
2604
|
+
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
2605
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
2606
|
+
var import_react39 = require("react");
|
|
2537
2607
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2538
|
-
function Radio({
|
|
2539
|
-
|
|
2540
|
-
|
|
2608
|
+
function Radio({
|
|
2609
|
+
name,
|
|
2610
|
+
value,
|
|
2611
|
+
id,
|
|
2612
|
+
label,
|
|
2613
|
+
isChecked = false,
|
|
2614
|
+
isDisabled = false,
|
|
2615
|
+
size = "medium",
|
|
2616
|
+
onChange
|
|
2617
|
+
}) {
|
|
2618
|
+
const isLarge = size === "large";
|
|
2619
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react39.useState)(false);
|
|
2620
|
+
const handleMouseOverInput = (0, import_react39.useCallback)(() => {
|
|
2541
2621
|
setIsMouseOver(true);
|
|
2542
2622
|
}, []);
|
|
2543
|
-
const handleMouseOutInput = (0,
|
|
2623
|
+
const handleMouseOutInput = (0, import_react39.useCallback)(() => {
|
|
2544
2624
|
setIsMouseOver(false);
|
|
2545
2625
|
}, []);
|
|
2546
|
-
const handleChange = (0,
|
|
2626
|
+
const handleChange = (0, import_react39.useCallback)(
|
|
2547
2627
|
(e) => !isDisabled && onChange?.(e),
|
|
2548
2628
|
[isDisabled, onChange]
|
|
2549
2629
|
);
|
|
2550
|
-
const inputClasses = (0,
|
|
2630
|
+
const inputClasses = (0, import_clsx30.default)("peer absolute z-[1] opacity-0", {
|
|
2631
|
+
"size-6": !isLarge,
|
|
2632
|
+
"size-8": isLarge,
|
|
2551
2633
|
"cursor-not-allowed": isDisabled,
|
|
2552
2634
|
"cursor-pointer": !isDisabled
|
|
2553
2635
|
});
|
|
2554
|
-
const boxClasses = (0,
|
|
2555
|
-
"inline-flex
|
|
2556
|
-
|
|
2636
|
+
const boxClasses = (0, import_clsx30.default)(
|
|
2637
|
+
"inline-flex items-center justify-center rounded-full border border-solid bg-white",
|
|
2638
|
+
{ "size-5": !isLarge, "size-7": isLarge },
|
|
2639
|
+
import_component_theme13.focusVisible.normalPeer,
|
|
2557
2640
|
{
|
|
2558
2641
|
"border-disabled01 hover:border-disabled01": isDisabled && !isMouseOver,
|
|
2559
2642
|
"border-hoverUiBorder": !isDisabled && isMouseOver,
|
|
@@ -2562,21 +2645,31 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
2562
2645
|
"cursor-pointer": !isDisabled
|
|
2563
2646
|
}
|
|
2564
2647
|
);
|
|
2565
|
-
const afterClasses = (0,
|
|
2566
|
-
"
|
|
2567
|
-
"
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2648
|
+
const afterClasses = (0, import_clsx30.default)(
|
|
2649
|
+
"absolute inset-0 m-auto block rounded-full",
|
|
2650
|
+
{ "size-3": !isLarge, "size-4": isLarge },
|
|
2651
|
+
{
|
|
2652
|
+
"bg-disabled01": isDisabled && isChecked,
|
|
2653
|
+
"bg-activeSelectedUi": !isDisabled && isChecked,
|
|
2654
|
+
"scale-0": !isChecked,
|
|
2655
|
+
"scale-100": isChecked
|
|
2656
|
+
}
|
|
2657
|
+
);
|
|
2658
|
+
const hoverIndicatorClasses = (0, import_clsx30.default)(
|
|
2659
|
+
"inline-block rounded-full",
|
|
2660
|
+
{ "size-3": !isLarge, "size-4": isLarge },
|
|
2661
|
+
{
|
|
2662
|
+
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
2663
|
+
}
|
|
2664
|
+
);
|
|
2665
|
+
const labelClasses = (0, import_clsx30.default)("ml-2 flex-[1_0_0] select-none break-all", {
|
|
2666
|
+
"typography-label14regular": !isLarge,
|
|
2667
|
+
"typography-label16regular": isLarge,
|
|
2575
2668
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
2576
2669
|
"cursor-pointer text-text01": !isDisabled
|
|
2577
2670
|
});
|
|
2578
2671
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex items-center", children: [
|
|
2579
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: "flex
|
|
2672
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: (0, import_clsx30.default)("relative flex items-center justify-center", { "size-6": !isLarge, "size-8": isLarge }), children: [
|
|
2580
2673
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2581
2674
|
"input",
|
|
2582
2675
|
{
|
|
@@ -2592,26 +2685,35 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
2592
2685
|
className: inputClasses
|
|
2593
2686
|
}
|
|
2594
2687
|
),
|
|
2595
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: boxClasses, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2688
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: boxClasses, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
2689
|
+
"div",
|
|
2690
|
+
{
|
|
2691
|
+
className: (0, import_clsx30.default)("relative flex flex-[0_0_auto] items-center justify-center", {
|
|
2692
|
+
"size-5": !isLarge,
|
|
2693
|
+
"size-7": isLarge
|
|
2694
|
+
}),
|
|
2695
|
+
children: [
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: afterClasses }),
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: hoverIndicatorClasses })
|
|
2698
|
+
]
|
|
2699
|
+
}
|
|
2700
|
+
) })
|
|
2599
2701
|
] }),
|
|
2600
2702
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
2601
2703
|
] });
|
|
2602
2704
|
}
|
|
2603
2705
|
|
|
2604
2706
|
// src/search/search.tsx
|
|
2605
|
-
var
|
|
2606
|
-
var
|
|
2707
|
+
var import_clsx31 = require("clsx");
|
|
2708
|
+
var import_react40 = require("react");
|
|
2607
2709
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2608
|
-
var Search = (0,
|
|
2609
|
-
const classes = (0,
|
|
2710
|
+
var Search = (0, import_react40.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
2711
|
+
const classes = (0, import_clsx31.clsx)(
|
|
2610
2712
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
2611
2713
|
{ "h-8 px-3": size === "medium" },
|
|
2612
2714
|
{ "h-10 px-4": size === "large" }
|
|
2613
2715
|
);
|
|
2614
|
-
const inputClasses = (0,
|
|
2716
|
+
const inputClasses = (0, import_clsx31.clsx)("mx-2 h-full flex-1 text-text01 outline-none placeholder:text-textPlaceholder", {
|
|
2615
2717
|
["typography-label14regular"]: size === "medium",
|
|
2616
2718
|
["typography-label16regular"]: size === "large"
|
|
2617
2719
|
});
|
|
@@ -2643,16 +2745,16 @@ var Search = (0, import_react39.forwardRef)(({ width = "100%", size = "medium",
|
|
|
2643
2745
|
Search.displayName = "Search";
|
|
2644
2746
|
|
|
2645
2747
|
// src/segmented-control/segmented-control.tsx
|
|
2646
|
-
var
|
|
2748
|
+
var import_react43 = __toESM(require("react"));
|
|
2647
2749
|
|
|
2648
2750
|
// src/segmented-control/segmented-control-context.ts
|
|
2649
|
-
var
|
|
2650
|
-
var SegmentedControlContext = (0,
|
|
2751
|
+
var import_react41 = require("react");
|
|
2752
|
+
var SegmentedControlContext = (0, import_react41.createContext)(null);
|
|
2651
2753
|
|
|
2652
2754
|
// src/segmented-control/segmented-control-item.tsx
|
|
2653
|
-
var
|
|
2654
|
-
var
|
|
2655
|
-
var
|
|
2755
|
+
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
2756
|
+
var import_clsx32 = require("clsx");
|
|
2757
|
+
var import_react42 = require("react");
|
|
2656
2758
|
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2657
2759
|
var SegmentedControlItem = ({
|
|
2658
2760
|
label,
|
|
@@ -2662,9 +2764,9 @@ var SegmentedControlItem = ({
|
|
|
2662
2764
|
"aria-label": ariaLabel,
|
|
2663
2765
|
...rest
|
|
2664
2766
|
}) => {
|
|
2665
|
-
const context = (0,
|
|
2666
|
-
const buttonRef = (0,
|
|
2667
|
-
const lastInteractionWasMouse = (0,
|
|
2767
|
+
const context = (0, import_react42.useContext)(SegmentedControlContext);
|
|
2768
|
+
const buttonRef = (0, import_react42.useRef)(null);
|
|
2769
|
+
const lastInteractionWasMouse = (0, import_react42.useRef)(false);
|
|
2668
2770
|
if (context === null) {
|
|
2669
2771
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
2670
2772
|
}
|
|
@@ -2680,7 +2782,7 @@ var SegmentedControlItem = ({
|
|
|
2680
2782
|
const isSelected = value === selectedValue;
|
|
2681
2783
|
const isFocused = value === focusedValue;
|
|
2682
2784
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
2683
|
-
(0,
|
|
2785
|
+
(0, import_react42.useEffect)(() => {
|
|
2684
2786
|
if (isFocused === true && buttonRef.current !== null) {
|
|
2685
2787
|
buttonRef.current.focus();
|
|
2686
2788
|
}
|
|
@@ -2702,7 +2804,7 @@ var SegmentedControlItem = ({
|
|
|
2702
2804
|
lastInteractionWasMouse.current = false;
|
|
2703
2805
|
onBlur?.();
|
|
2704
2806
|
};
|
|
2705
|
-
const buttonClasses = (0,
|
|
2807
|
+
const buttonClasses = (0, import_clsx32.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme14.focusVisible.normal, {
|
|
2706
2808
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
2707
2809
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
2708
2810
|
// States - Default with hover
|
|
@@ -2732,7 +2834,7 @@ var SegmentedControlItem = ({
|
|
|
2732
2834
|
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
2733
2835
|
"span",
|
|
2734
2836
|
{
|
|
2735
|
-
className: (0,
|
|
2837
|
+
className: (0, import_clsx32.clsx)("flex items-center", {
|
|
2736
2838
|
"fill-disabled01": isOptionDisabled === true,
|
|
2737
2839
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
2738
2840
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
@@ -2757,15 +2859,15 @@ var SegmentedControl = ({
|
|
|
2757
2859
|
"aria-label": ariaLabel,
|
|
2758
2860
|
...rest
|
|
2759
2861
|
}) => {
|
|
2760
|
-
const containerRef = (0,
|
|
2761
|
-
const itemIds =
|
|
2762
|
-
if (!
|
|
2862
|
+
const containerRef = (0, import_react43.useRef)(null);
|
|
2863
|
+
const itemIds = import_react43.Children.toArray(children).filter((child) => {
|
|
2864
|
+
if (!import_react43.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
2763
2865
|
return false;
|
|
2764
2866
|
}
|
|
2765
2867
|
const props = child.props;
|
|
2766
2868
|
return props.isDisabled !== true;
|
|
2767
2869
|
}).map((child) => child.props.value);
|
|
2768
|
-
const childrenCount =
|
|
2870
|
+
const childrenCount = import_react43.Children.count(children);
|
|
2769
2871
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
2770
2872
|
const {
|
|
2771
2873
|
focusedValue,
|
|
@@ -2809,22 +2911,22 @@ var SegmentedControl = ({
|
|
|
2809
2911
|
SegmentedControl.Item = SegmentedControlItem;
|
|
2810
2912
|
|
|
2811
2913
|
// src/select-sort/select-sort.tsx
|
|
2812
|
-
var
|
|
2813
|
-
var
|
|
2814
|
-
var
|
|
2914
|
+
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
2915
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
2916
|
+
var import_react44 = require("react");
|
|
2815
2917
|
|
|
2816
2918
|
// src/select-sort/select-list.tsx
|
|
2817
|
-
var
|
|
2818
|
-
var
|
|
2919
|
+
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
2920
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
2819
2921
|
|
|
2820
2922
|
// src/select-sort/select-item.tsx
|
|
2821
|
-
var
|
|
2822
|
-
var
|
|
2923
|
+
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
2924
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
2823
2925
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2824
2926
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
2825
|
-
const itemClasses = (0,
|
|
2927
|
+
const itemClasses = (0, import_clsx33.default)(
|
|
2826
2928
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
2827
|
-
|
|
2929
|
+
import_component_theme15.focusVisible.inset,
|
|
2828
2930
|
{
|
|
2829
2931
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
2830
2932
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
@@ -2839,7 +2941,7 @@ function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
|
2839
2941
|
// src/select-sort/select-list.tsx
|
|
2840
2942
|
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2841
2943
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
2842
|
-
const listClasses = (0,
|
|
2944
|
+
const listClasses = (0, import_clsx34.default)(
|
|
2843
2945
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
2844
2946
|
{
|
|
2845
2947
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -2848,9 +2950,9 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
2848
2950
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
2849
2951
|
}
|
|
2850
2952
|
);
|
|
2851
|
-
const deselectButtonClasses = (0,
|
|
2953
|
+
const deselectButtonClasses = (0, import_clsx34.default)(
|
|
2852
2954
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
2853
|
-
|
|
2955
|
+
import_component_theme16.focusVisible.inset
|
|
2854
2956
|
);
|
|
2855
2957
|
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("ul", { className: listClasses, children: [
|
|
2856
2958
|
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
@@ -2872,38 +2974,43 @@ function SelectSort({
|
|
|
2872
2974
|
onChange,
|
|
2873
2975
|
onClickDeselect
|
|
2874
2976
|
}) {
|
|
2875
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
2876
|
-
const targetRef = (0,
|
|
2977
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react44.useState)(false);
|
|
2978
|
+
const targetRef = (0, import_react44.useRef)(null);
|
|
2877
2979
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
2980
|
+
useDismissOnModalOpen(() => {
|
|
2981
|
+
if (isOptionListOpen) {
|
|
2982
|
+
setIsOptionListOpen(false);
|
|
2983
|
+
}
|
|
2984
|
+
});
|
|
2878
2985
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
2879
|
-
const handleClickItem = (0,
|
|
2986
|
+
const handleClickItem = (0, import_react44.useCallback)(
|
|
2880
2987
|
(value) => {
|
|
2881
2988
|
onChange?.(value);
|
|
2882
2989
|
setIsOptionListOpen(false);
|
|
2883
2990
|
},
|
|
2884
2991
|
[onChange]
|
|
2885
2992
|
);
|
|
2886
|
-
const wrapperClasses = (0,
|
|
2993
|
+
const wrapperClasses = (0, import_clsx35.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
2887
2994
|
"h-6": size === "x-small" || size === "small",
|
|
2888
2995
|
"h-8": size === "medium",
|
|
2889
2996
|
"h-10": size === "large",
|
|
2890
2997
|
"cursor-not-allowed": isDisabled
|
|
2891
2998
|
});
|
|
2892
|
-
const buttonClasses = (0,
|
|
2999
|
+
const buttonClasses = (0, import_clsx35.default)(
|
|
2893
3000
|
"flex size-full items-center rounded",
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
3001
|
+
import_component_theme17.buttonColors[variant].hover,
|
|
3002
|
+
import_component_theme17.buttonColors[variant].active,
|
|
3003
|
+
import_component_theme17.buttonColors[variant].disabled,
|
|
3004
|
+
import_component_theme17.focusVisible.normal,
|
|
2898
3005
|
{
|
|
2899
|
-
[
|
|
2900
|
-
[
|
|
3006
|
+
[import_component_theme17.buttonColors[variant].selected]: isSortKey,
|
|
3007
|
+
[import_component_theme17.buttonColors[variant].base]: !isSortKey,
|
|
2901
3008
|
"px-2": size === "x-small" || size === "small",
|
|
2902
3009
|
"px-4": size === "medium" || size === "large",
|
|
2903
3010
|
"pointer-events-none": isDisabled
|
|
2904
3011
|
}
|
|
2905
3012
|
);
|
|
2906
|
-
const labelClasses = (0,
|
|
3013
|
+
const labelClasses = (0, import_clsx35.default)("truncate", {
|
|
2907
3014
|
"typography-label12regular": size === "x-small",
|
|
2908
3015
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2909
3016
|
"typography-label16regular": size === "large",
|
|
@@ -2941,9 +3048,9 @@ function SelectSort({
|
|
|
2941
3048
|
}
|
|
2942
3049
|
|
|
2943
3050
|
// src/sort-button/sort-button.tsx
|
|
2944
|
-
var
|
|
2945
|
-
var
|
|
2946
|
-
var
|
|
3051
|
+
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
3052
|
+
var import_clsx36 = __toESM(require("clsx"));
|
|
3053
|
+
var import_react45 = require("react");
|
|
2947
3054
|
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2948
3055
|
function SortButton({
|
|
2949
3056
|
size = "medium",
|
|
@@ -2955,7 +3062,7 @@ function SortButton({
|
|
|
2955
3062
|
"aria-label": ariaLabel,
|
|
2956
3063
|
...rest
|
|
2957
3064
|
}) {
|
|
2958
|
-
const handleClick = (0,
|
|
3065
|
+
const handleClick = (0, import_react45.useCallback)(() => {
|
|
2959
3066
|
if (isDisabled || !onClick) return;
|
|
2960
3067
|
onClick();
|
|
2961
3068
|
}, [isDisabled, onClick]);
|
|
@@ -2964,29 +3071,29 @@ function SortButton({
|
|
|
2964
3071
|
if (sortOrder === "descend") return "arrow-down";
|
|
2965
3072
|
return "angle-small-down";
|
|
2966
3073
|
};
|
|
2967
|
-
const wrapperClasses = (0,
|
|
3074
|
+
const wrapperClasses = (0, import_clsx36.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
2968
3075
|
"h-6": size === "x-small" || size === "small",
|
|
2969
3076
|
"h-8": size === "medium",
|
|
2970
3077
|
"h-10": size === "large",
|
|
2971
3078
|
"cursor-not-allowed": isDisabled
|
|
2972
3079
|
});
|
|
2973
|
-
const buttonClasses = (0,
|
|
3080
|
+
const buttonClasses = (0, import_clsx36.default)(
|
|
2974
3081
|
"flex size-full items-center rounded",
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
3082
|
+
import_component_theme18.buttonColors.text.hover,
|
|
3083
|
+
import_component_theme18.buttonColors.text.active,
|
|
3084
|
+
import_component_theme18.buttonColors.text.disabled,
|
|
3085
|
+
import_component_theme18.focusVisible.normal,
|
|
2979
3086
|
{
|
|
2980
|
-
[
|
|
3087
|
+
[import_component_theme18.buttonColors.text.selected]: !isDisabled && sortOrder !== null,
|
|
2981
3088
|
// ソート状態時は選択状態のスタイル
|
|
2982
|
-
[
|
|
3089
|
+
[import_component_theme18.buttonColors.text.base]: sortOrder === null,
|
|
2983
3090
|
// ソートなし時は通常のスタイル
|
|
2984
3091
|
"px-2": size === "x-small" || size === "small",
|
|
2985
3092
|
"px-4": size === "medium" || size === "large",
|
|
2986
3093
|
"pointer-events-none": isDisabled
|
|
2987
3094
|
}
|
|
2988
3095
|
);
|
|
2989
|
-
const labelClasses = (0,
|
|
3096
|
+
const labelClasses = (0, import_clsx36.default)("truncate", {
|
|
2990
3097
|
"typography-label12regular": size === "x-small",
|
|
2991
3098
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2992
3099
|
"typography-label16regular": size === "large",
|
|
@@ -3012,14 +3119,14 @@ function SortButton({
|
|
|
3012
3119
|
}
|
|
3013
3120
|
|
|
3014
3121
|
// src/tab/tab.tsx
|
|
3015
|
-
var
|
|
3016
|
-
var
|
|
3122
|
+
var import_clsx38 = require("clsx");
|
|
3123
|
+
var import_react46 = require("react");
|
|
3017
3124
|
|
|
3018
3125
|
// src/tab/tab-item.tsx
|
|
3019
|
-
var
|
|
3126
|
+
var import_clsx37 = require("clsx");
|
|
3020
3127
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3021
3128
|
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
3022
|
-
const classes = (0,
|
|
3129
|
+
const classes = (0, import_clsx37.clsx)(
|
|
3023
3130
|
"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",
|
|
3024
3131
|
{
|
|
3025
3132
|
"typography-label14regular text-interactive02": !isSelected,
|
|
@@ -3027,7 +3134,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
3027
3134
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
3028
3135
|
}
|
|
3029
3136
|
);
|
|
3030
|
-
const iconWrapperClasses = (0,
|
|
3137
|
+
const iconWrapperClasses = (0, import_clsx37.clsx)("flex shrink-0 items-center", {
|
|
3031
3138
|
"fill-disabled01": isDisabled,
|
|
3032
3139
|
"fill-interactive01": !isDisabled && isSelected,
|
|
3033
3140
|
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
@@ -3052,9 +3159,9 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
3052
3159
|
// src/tab/tab.tsx
|
|
3053
3160
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3054
3161
|
function Tab({ children, layout = "auto" }) {
|
|
3055
|
-
const childrenCount =
|
|
3162
|
+
const childrenCount = import_react46.Children.count(children);
|
|
3056
3163
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
3057
|
-
const containerClasses = (0,
|
|
3164
|
+
const containerClasses = (0, import_clsx38.clsx)(
|
|
3058
3165
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
3059
3166
|
{
|
|
3060
3167
|
flex: layout === "auto",
|
|
@@ -3066,18 +3173,18 @@ function Tab({ children, layout = "auto" }) {
|
|
|
3066
3173
|
Tab.Item = TabItem;
|
|
3067
3174
|
|
|
3068
3175
|
// src/table/table-cell.tsx
|
|
3069
|
-
var
|
|
3176
|
+
var import_clsx39 = __toESM(require("clsx"));
|
|
3070
3177
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3071
3178
|
function TableCell({ children, className, isHeader = false }) {
|
|
3072
|
-
const classes = (0,
|
|
3179
|
+
const classes = (0, import_clsx39.default)("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
3073
3180
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: classes, children });
|
|
3074
3181
|
}
|
|
3075
3182
|
|
|
3076
3183
|
// src/table/table-row.tsx
|
|
3077
|
-
var
|
|
3184
|
+
var import_clsx40 = __toESM(require("clsx"));
|
|
3078
3185
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3079
3186
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
3080
|
-
const rowClasses = (0,
|
|
3187
|
+
const rowClasses = (0, import_clsx40.default)("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
3081
3188
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: rowClasses, children });
|
|
3082
3189
|
}
|
|
3083
3190
|
|
|
@@ -3110,19 +3217,19 @@ Table.Row = TableRow;
|
|
|
3110
3217
|
Table.Cell = TableCell;
|
|
3111
3218
|
|
|
3112
3219
|
// src/tag/tag.tsx
|
|
3113
|
-
var
|
|
3114
|
-
var
|
|
3220
|
+
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
3221
|
+
var import_clsx42 = __toESM(require("clsx"));
|
|
3115
3222
|
|
|
3116
3223
|
// src/tag/delete-icon.tsx
|
|
3117
|
-
var
|
|
3118
|
-
var
|
|
3224
|
+
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
3225
|
+
var import_clsx41 = __toESM(require("clsx"));
|
|
3119
3226
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3120
3227
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
3121
|
-
const deleteButtonClasses = (0,
|
|
3228
|
+
const deleteButtonClasses = (0, import_clsx41.default)(
|
|
3122
3229
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
3123
|
-
|
|
3230
|
+
import_component_theme19.focusVisible.normal
|
|
3124
3231
|
);
|
|
3125
|
-
const deletePathClasses = (0,
|
|
3232
|
+
const deletePathClasses = (0, import_clsx41.default)({
|
|
3126
3233
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
3127
3234
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
3128
3235
|
});
|
|
@@ -3140,17 +3247,16 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
3140
3247
|
// src/tag/tag.tsx
|
|
3141
3248
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3142
3249
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
3143
|
-
const wrapperClasses = (0,
|
|
3144
|
-
[
|
|
3145
|
-
[
|
|
3250
|
+
const wrapperClasses = (0, import_clsx42.default)("flex", "items-center", "justify-center", {
|
|
3251
|
+
[import_component_theme20.tagColors[color]]: variant === "normal",
|
|
3252
|
+
[import_component_theme20.tagLightColors[color]]: variant === "light",
|
|
3146
3253
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
3147
3254
|
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
3148
|
-
"h-
|
|
3149
|
-
"h-[22px] typography-label14regular": isEditable && size === "medium",
|
|
3255
|
+
"h-5 typography-label14regular": size === "medium",
|
|
3150
3256
|
"rounded-full": isEditable,
|
|
3151
3257
|
rounded: !isEditable,
|
|
3152
|
-
"
|
|
3153
|
-
"
|
|
3258
|
+
"px-1": !isEditable,
|
|
3259
|
+
"px-2": isEditable
|
|
3154
3260
|
});
|
|
3155
3261
|
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: wrapperClasses, children: [
|
|
3156
3262
|
children,
|
|
@@ -3159,14 +3265,14 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
3159
3265
|
}
|
|
3160
3266
|
|
|
3161
3267
|
// src/text-area/text-area.tsx
|
|
3162
|
-
var
|
|
3163
|
-
var
|
|
3268
|
+
var import_clsx45 = require("clsx");
|
|
3269
|
+
var import_react50 = require("react");
|
|
3164
3270
|
|
|
3165
3271
|
// src/text-area/text-area-context.tsx
|
|
3166
|
-
var
|
|
3167
|
-
var TextAreaCompoundContext = (0,
|
|
3272
|
+
var import_react47 = require("react");
|
|
3273
|
+
var TextAreaCompoundContext = (0, import_react47.createContext)(null);
|
|
3168
3274
|
var useTextAreaCompoundContext = (componentName) => {
|
|
3169
|
-
const context = (0,
|
|
3275
|
+
const context = (0, import_react47.useContext)(TextAreaCompoundContext);
|
|
3170
3276
|
if (context == null) {
|
|
3171
3277
|
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`);
|
|
3172
3278
|
}
|
|
@@ -3174,10 +3280,10 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
3174
3280
|
};
|
|
3175
3281
|
|
|
3176
3282
|
// src/text-area/text-area-error-message.tsx
|
|
3177
|
-
var
|
|
3178
|
-
var
|
|
3283
|
+
var import_clsx43 = require("clsx");
|
|
3284
|
+
var import_react48 = require("react");
|
|
3179
3285
|
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3180
|
-
var TextAreaErrorMessage = (0,
|
|
3286
|
+
var TextAreaErrorMessage = (0, import_react48.forwardRef)(
|
|
3181
3287
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
3182
3288
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
3183
3289
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -3185,20 +3291,20 @@ var TextAreaErrorMessage = (0, import_react47.forwardRef)(
|
|
|
3185
3291
|
if (!shouldRender) {
|
|
3186
3292
|
return null;
|
|
3187
3293
|
}
|
|
3188
|
-
const errorMessageClassName = (0,
|
|
3294
|
+
const errorMessageClassName = (0, import_clsx43.clsx)(typographyClass, "text-supportError");
|
|
3189
3295
|
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
3190
3296
|
}
|
|
3191
3297
|
);
|
|
3192
3298
|
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
3193
3299
|
|
|
3194
3300
|
// src/text-area/text-area-helper-message.tsx
|
|
3195
|
-
var
|
|
3196
|
-
var
|
|
3301
|
+
var import_clsx44 = require("clsx");
|
|
3302
|
+
var import_react49 = require("react");
|
|
3197
3303
|
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3198
|
-
var TextAreaHelperMessage = (0,
|
|
3304
|
+
var TextAreaHelperMessage = (0, import_react49.forwardRef)((props, ref) => {
|
|
3199
3305
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
3200
3306
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
3201
|
-
const helperMessageClassName = (0,
|
|
3307
|
+
const helperMessageClassName = (0, import_clsx44.clsx)(typographyClass, "text-text02");
|
|
3202
3308
|
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { ref, className: helperMessageClassName, ...props });
|
|
3203
3309
|
});
|
|
3204
3310
|
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
@@ -3207,6 +3313,7 @@ TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
|
3207
3313
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3208
3314
|
function TextAreaInner({
|
|
3209
3315
|
size = "medium",
|
|
3316
|
+
variant = "outline",
|
|
3210
3317
|
isResizable = false,
|
|
3211
3318
|
autoHeight = false,
|
|
3212
3319
|
maxHeight,
|
|
@@ -3220,15 +3327,16 @@ function TextAreaInner({
|
|
|
3220
3327
|
maxLength,
|
|
3221
3328
|
...props
|
|
3222
3329
|
}, ref) {
|
|
3223
|
-
const autoGeneratedId = (0,
|
|
3224
|
-
const textAreaPropsForContext = (0,
|
|
3330
|
+
const autoGeneratedId = (0, import_react50.useId)();
|
|
3331
|
+
const textAreaPropsForContext = (0, import_react50.useMemo)(
|
|
3225
3332
|
() => ({
|
|
3226
3333
|
size,
|
|
3334
|
+
variant,
|
|
3227
3335
|
isError
|
|
3228
3336
|
}),
|
|
3229
|
-
[size, isError]
|
|
3337
|
+
[size, variant, isError]
|
|
3230
3338
|
);
|
|
3231
|
-
const contextValue = (0,
|
|
3339
|
+
const contextValue = (0, import_react50.useMemo)(
|
|
3232
3340
|
() => ({
|
|
3233
3341
|
textAreaProps: textAreaPropsForContext,
|
|
3234
3342
|
forwardedRef: ref
|
|
@@ -3238,21 +3346,21 @@ function TextAreaInner({
|
|
|
3238
3346
|
const helperMessageIds = [];
|
|
3239
3347
|
const errorIds = [];
|
|
3240
3348
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
3241
|
-
const enhancedChildren =
|
|
3242
|
-
if (!(0,
|
|
3349
|
+
const enhancedChildren = import_react50.Children.map(children, (child) => {
|
|
3350
|
+
if (!(0, import_react50.isValidElement)(child)) {
|
|
3243
3351
|
return child;
|
|
3244
3352
|
}
|
|
3245
3353
|
if (child.type === TextAreaHelperMessage) {
|
|
3246
3354
|
const helperChild = child;
|
|
3247
3355
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
3248
3356
|
helperMessageIds.push(assignedId);
|
|
3249
|
-
return (0,
|
|
3357
|
+
return (0, import_react50.cloneElement)(helperChild, { id: assignedId });
|
|
3250
3358
|
}
|
|
3251
3359
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
3252
3360
|
const errorChild = child;
|
|
3253
3361
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
3254
3362
|
errorIds.push(assignedId);
|
|
3255
|
-
return (0,
|
|
3363
|
+
return (0, import_react50.cloneElement)(errorChild, { id: assignedId });
|
|
3256
3364
|
}
|
|
3257
3365
|
return child;
|
|
3258
3366
|
});
|
|
@@ -3278,30 +3386,41 @@ function TextAreaInner({
|
|
|
3278
3386
|
...ariaInvalidProps,
|
|
3279
3387
|
...maxLengthProps
|
|
3280
3388
|
};
|
|
3281
|
-
const
|
|
3389
|
+
const isBorderless = variant === "text";
|
|
3390
|
+
const textAreaWrapperClassName = (0, import_clsx45.clsx)(
|
|
3282
3391
|
"box-border flex w-full overflow-hidden rounded border",
|
|
3283
3392
|
{
|
|
3284
|
-
|
|
3285
|
-
"border-
|
|
3286
|
-
"
|
|
3287
|
-
"hover:
|
|
3288
|
-
"focus-within:border-activeInput": !isError,
|
|
3289
|
-
"
|
|
3393
|
+
// outline variant
|
|
3394
|
+
"border-supportError": !isBorderless && isError && !disabled,
|
|
3395
|
+
"border-uiBorder02": !isBorderless && !isError && !disabled,
|
|
3396
|
+
"hover:border-hoverInput": !isBorderless && !disabled && !isError,
|
|
3397
|
+
"hover:focus-within:border-activeInput": !isBorderless && !isError,
|
|
3398
|
+
"focus-within:border-activeInput": !isBorderless && !isError,
|
|
3399
|
+
"bg-disabled02 border-disabled01": !isBorderless && disabled,
|
|
3400
|
+
// text variant
|
|
3401
|
+
"border-transparent": isBorderless
|
|
3290
3402
|
},
|
|
3291
|
-
className
|
|
3292
|
-
|
|
3293
|
-
const textAreaClassName = (0, import_clsx43.clsx)(
|
|
3294
|
-
"w-full border-none bg-uiBackground01 outline-none placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
3295
|
-
{
|
|
3296
|
-
"typography-body14regular px-2 py-2": size === "medium",
|
|
3297
|
-
"typography-body16regular px-3 py-2": size === "large",
|
|
3298
|
-
"field-sizing-content": autoHeight,
|
|
3299
|
-
"text-text01": !isError,
|
|
3300
|
-
"text-supportError": isError,
|
|
3301
|
-
"bg-disabled02": disabled,
|
|
3302
|
-
"resize-none": !isResizable
|
|
3303
|
-
}
|
|
3403
|
+
// className は variant="outline" のみ受け入れ、後方互換のため wrapper の末尾に合成(@deprecated)
|
|
3404
|
+
!isBorderless && className
|
|
3304
3405
|
);
|
|
3406
|
+
const textAreaClassName = (0, import_clsx45.clsx)("w-full border-none bg-uiBackground01 outline-none", {
|
|
3407
|
+
// outline: 従来の padding
|
|
3408
|
+
"typography-body14regular px-2 py-2": !isBorderless && size === "medium",
|
|
3409
|
+
"typography-body16regular px-3 py-2": !isBorderless && size === "large",
|
|
3410
|
+
// text: padding なし
|
|
3411
|
+
"typography-body14regular": isBorderless && size === "medium",
|
|
3412
|
+
"typography-body16regular": isBorderless && size === "large",
|
|
3413
|
+
"disabled:text-textPlaceholder": !isBorderless,
|
|
3414
|
+
"disabled:text-disabled01": isBorderless,
|
|
3415
|
+
"field-sizing-content": autoHeight,
|
|
3416
|
+
"text-text01": !isError,
|
|
3417
|
+
"text-supportError": isError,
|
|
3418
|
+
// placeholder 色(text variant エラー時のみ上書き)
|
|
3419
|
+
"placeholder:text-textPlaceholder": !(isBorderless && isError && !disabled),
|
|
3420
|
+
"placeholder:text-supportErrorLight": isBorderless && isError && !disabled,
|
|
3421
|
+
"bg-disabled02": !isBorderless && disabled,
|
|
3422
|
+
"resize-none": !isResizable
|
|
3423
|
+
});
|
|
3305
3424
|
const hasHeight = height != null && String(height).trim().length > 0;
|
|
3306
3425
|
const textAreaElement = /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3307
3426
|
"div",
|
|
@@ -3310,7 +3429,8 @@ function TextAreaInner({
|
|
|
3310
3429
|
style: {
|
|
3311
3430
|
...{ maxHeight },
|
|
3312
3431
|
// height/minHeight はラッパに適用し、外形を揃える
|
|
3313
|
-
|
|
3432
|
+
// isResizable 時はラッパに固定高さを設定しない(textarea のリサイズに追従させるため)
|
|
3433
|
+
...!autoHeight && hasHeight && !isResizable ? { height } : {},
|
|
3314
3434
|
...autoHeight && hasHeight ? { minHeight: height } : {}
|
|
3315
3435
|
},
|
|
3316
3436
|
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
@@ -3321,7 +3441,8 @@ function TextAreaInner({
|
|
|
3321
3441
|
...mergedTextAreaProps,
|
|
3322
3442
|
disabled,
|
|
3323
3443
|
style: {
|
|
3324
|
-
|
|
3444
|
+
// isResizable 時は height を textarea の初期高さとして直接設定し、リサイズ起点にする
|
|
3445
|
+
height: autoHeight ? "auto" : isResizable && hasHeight ? height : "100%",
|
|
3325
3446
|
minHeight: autoHeight && hasHeight ? "100%" : "auto"
|
|
3326
3447
|
}
|
|
3327
3448
|
}
|
|
@@ -3332,7 +3453,7 @@ function TextAreaInner({
|
|
|
3332
3453
|
"div",
|
|
3333
3454
|
{
|
|
3334
3455
|
id: counterId,
|
|
3335
|
-
className: (0,
|
|
3456
|
+
className: (0, import_clsx45.clsx)(
|
|
3336
3457
|
"shrink-0",
|
|
3337
3458
|
size === "large" ? "typography-label13regular" : "typography-label12regular",
|
|
3338
3459
|
!disabled && isExceeded ? "text-supportError" : "text-text02"
|
|
@@ -3341,7 +3462,7 @@ function TextAreaInner({
|
|
|
3341
3462
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
3342
3463
|
}
|
|
3343
3464
|
) : null;
|
|
3344
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
3465
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react50.Children.toArray(enhancedChildren);
|
|
3345
3466
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
3346
3467
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
3347
3468
|
if (!hasBottomContent) {
|
|
@@ -3362,14 +3483,14 @@ var attachStatics2 = (component) => {
|
|
|
3362
3483
|
component.displayName = "TextArea";
|
|
3363
3484
|
return component;
|
|
3364
3485
|
};
|
|
3365
|
-
var TextAreaBase = (0,
|
|
3486
|
+
var TextAreaBase = (0, import_react50.forwardRef)(function TextAreaBase2(props, ref) {
|
|
3366
3487
|
return TextAreaInner(props, ref);
|
|
3367
3488
|
});
|
|
3368
3489
|
var TextArea = attachStatics2(TextAreaBase);
|
|
3369
3490
|
|
|
3370
3491
|
// src/toast/toast.tsx
|
|
3371
|
-
var
|
|
3372
|
-
var
|
|
3492
|
+
var import_clsx46 = __toESM(require("clsx"));
|
|
3493
|
+
var import_react51 = require("react");
|
|
3373
3494
|
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3374
3495
|
var CLOSE_TIME_MSEC = 5e3;
|
|
3375
3496
|
function Toast({
|
|
@@ -3380,8 +3501,8 @@ function Toast({
|
|
|
3380
3501
|
children,
|
|
3381
3502
|
onClickClose
|
|
3382
3503
|
}) {
|
|
3383
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
3384
|
-
const handleClose = (0,
|
|
3504
|
+
const [isRemoving, setIsRemoving] = (0, import_react51.useState)(false);
|
|
3505
|
+
const handleClose = (0, import_react51.useCallback)(() => {
|
|
3385
3506
|
if (isAnimation) {
|
|
3386
3507
|
setIsRemoving(true);
|
|
3387
3508
|
} else {
|
|
@@ -3389,17 +3510,17 @@ function Toast({
|
|
|
3389
3510
|
}
|
|
3390
3511
|
}, [isAnimation, onClickClose]);
|
|
3391
3512
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
3392
|
-
const wrapperClasses = (0,
|
|
3513
|
+
const wrapperClasses = (0, import_clsx46.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
3393
3514
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
3394
3515
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
3395
3516
|
});
|
|
3396
|
-
const iconClasses = (0,
|
|
3517
|
+
const iconClasses = (0, import_clsx46.default)("flex items-center", {
|
|
3397
3518
|
"fill-supportSuccess": state === "success",
|
|
3398
3519
|
"fill-supportError": state === "error",
|
|
3399
3520
|
"fill-supportWarning": state === "warning",
|
|
3400
3521
|
"fill-supportInfo": state === "information"
|
|
3401
3522
|
});
|
|
3402
|
-
const textClasses = (0,
|
|
3523
|
+
const textClasses = (0, import_clsx46.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
3403
3524
|
"text-supportError": state === "error",
|
|
3404
3525
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
3405
3526
|
});
|
|
@@ -3409,7 +3530,7 @@ function Toast({
|
|
|
3409
3530
|
warning: "warning",
|
|
3410
3531
|
information: "information-filled"
|
|
3411
3532
|
};
|
|
3412
|
-
(0,
|
|
3533
|
+
(0, import_react51.useEffect)(() => {
|
|
3413
3534
|
const timer = window.setTimeout(() => {
|
|
3414
3535
|
if (isAutoClose) {
|
|
3415
3536
|
setIsRemoving(true);
|
|
@@ -3425,20 +3546,20 @@ function Toast({
|
|
|
3425
3546
|
}
|
|
3426
3547
|
|
|
3427
3548
|
// src/toast/toast-provider.tsx
|
|
3428
|
-
var
|
|
3549
|
+
var import_react52 = require("react");
|
|
3429
3550
|
var import_react_dom3 = require("react-dom");
|
|
3430
3551
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
3431
|
-
var ToastContext = (0,
|
|
3552
|
+
var ToastContext = (0, import_react52.createContext)({});
|
|
3432
3553
|
var ToastProvider = ({ children }) => {
|
|
3433
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
3434
|
-
const [toasts, setToasts] = (0,
|
|
3435
|
-
const addToast = (0,
|
|
3554
|
+
const [isClientRender, setIsClientRender] = (0, import_react52.useState)(false);
|
|
3555
|
+
const [toasts, setToasts] = (0, import_react52.useState)([]);
|
|
3556
|
+
const addToast = (0, import_react52.useCallback)(({ message, state }) => {
|
|
3436
3557
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
3437
3558
|
}, []);
|
|
3438
|
-
const removeToast = (0,
|
|
3559
|
+
const removeToast = (0, import_react52.useCallback)((id) => {
|
|
3439
3560
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
3440
3561
|
}, []);
|
|
3441
|
-
(0,
|
|
3562
|
+
(0, import_react52.useEffect)(() => {
|
|
3442
3563
|
setIsClientRender(true);
|
|
3443
3564
|
}, []);
|
|
3444
3565
|
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
@@ -3450,11 +3571,11 @@ var ToastProvider = ({ children }) => {
|
|
|
3450
3571
|
] });
|
|
3451
3572
|
};
|
|
3452
3573
|
var useToast = () => {
|
|
3453
|
-
return (0,
|
|
3574
|
+
return (0, import_react52.useContext)(ToastContext);
|
|
3454
3575
|
};
|
|
3455
3576
|
|
|
3456
3577
|
// src/toggle/toggle.tsx
|
|
3457
|
-
var
|
|
3578
|
+
var import_clsx47 = __toESM(require("clsx"));
|
|
3458
3579
|
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
3459
3580
|
function Toggle({
|
|
3460
3581
|
id,
|
|
@@ -3465,7 +3586,7 @@ function Toggle({
|
|
|
3465
3586
|
labelPosition = "right",
|
|
3466
3587
|
isDisabled = false
|
|
3467
3588
|
}) {
|
|
3468
|
-
const baseClasses = (0,
|
|
3589
|
+
const baseClasses = (0, import_clsx47.default)("relative flex items-center rounded-full", {
|
|
3469
3590
|
"bg-disabledOn": isDisabled && isChecked,
|
|
3470
3591
|
"bg-disabled01": isDisabled && !isChecked,
|
|
3471
3592
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -3473,16 +3594,16 @@ function Toggle({
|
|
|
3473
3594
|
"w-8 h-4 px-[3px]": size === "small",
|
|
3474
3595
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
3475
3596
|
});
|
|
3476
|
-
const inputClasses = (0,
|
|
3597
|
+
const inputClasses = (0, import_clsx47.default)(
|
|
3477
3598
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
3478
3599
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
3479
3600
|
);
|
|
3480
|
-
const indicatorClasses = (0,
|
|
3601
|
+
const indicatorClasses = (0, import_clsx47.default)("rounded-full bg-iconOnColor", {
|
|
3481
3602
|
"w-2.5 h-2.5": size === "small",
|
|
3482
3603
|
"w-4 h-4": size === "medium" || size === "large",
|
|
3483
3604
|
"ml-auto": isChecked
|
|
3484
3605
|
});
|
|
3485
|
-
const labelClasses = (0,
|
|
3606
|
+
const labelClasses = (0, import_clsx47.default)("break-all", {
|
|
3486
3607
|
"mr-2": labelPosition === "left",
|
|
3487
3608
|
"ml-2": labelPosition === "right",
|
|
3488
3609
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -3510,17 +3631,17 @@ function Toggle({
|
|
|
3510
3631
|
}
|
|
3511
3632
|
|
|
3512
3633
|
// src/tooltip/tooltip.tsx
|
|
3513
|
-
var
|
|
3634
|
+
var import_react54 = require("react");
|
|
3514
3635
|
var import_react_dom4 = require("react-dom");
|
|
3515
3636
|
|
|
3516
3637
|
// src/tooltip/tooltip-content.tsx
|
|
3517
|
-
var
|
|
3638
|
+
var import_clsx49 = __toESM(require("clsx"));
|
|
3518
3639
|
|
|
3519
3640
|
// src/tooltip/tail-icon.tsx
|
|
3520
|
-
var
|
|
3641
|
+
var import_clsx48 = __toESM(require("clsx"));
|
|
3521
3642
|
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
3522
3643
|
var TailIcon = (props) => {
|
|
3523
|
-
const tailClasses = (0,
|
|
3644
|
+
const tailClasses = (0, import_clsx48.default)("absolute fill-uiBackgroundTooltip", {
|
|
3524
3645
|
"rotate-180": props.verticalPosition === "bottom",
|
|
3525
3646
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
3526
3647
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -3563,7 +3684,7 @@ var TooltipContent = ({
|
|
|
3563
3684
|
maxWidth,
|
|
3564
3685
|
isPortal = false
|
|
3565
3686
|
}) => {
|
|
3566
|
-
const tooltipWrapperClasses = (0,
|
|
3687
|
+
const tooltipWrapperClasses = (0, import_clsx49.default)("absolute z-tooltip m-auto flex", {
|
|
3567
3688
|
"top-0": !isPortal && verticalPosition === "top",
|
|
3568
3689
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
3569
3690
|
"justify-start": horizontalAlign === "left",
|
|
@@ -3572,7 +3693,7 @@ var TooltipContent = ({
|
|
|
3572
3693
|
"w-[24px]": size === "small",
|
|
3573
3694
|
"w-[46px]": size !== "small"
|
|
3574
3695
|
});
|
|
3575
|
-
const tooltipBodyClasses = (0,
|
|
3696
|
+
const tooltipBodyClasses = (0, import_clsx49.default)(
|
|
3576
3697
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
3577
3698
|
{
|
|
3578
3699
|
"typography-body12regular": size === "small",
|
|
@@ -3605,9 +3726,9 @@ var TooltipContent = ({
|
|
|
3605
3726
|
};
|
|
3606
3727
|
|
|
3607
3728
|
// src/tooltip/tooltip-hook.ts
|
|
3608
|
-
var
|
|
3729
|
+
var import_react53 = require("react");
|
|
3609
3730
|
var useTooltip = () => {
|
|
3610
|
-
const calculatePosition = (0,
|
|
3731
|
+
const calculatePosition = (0, import_react53.useCallback)(
|
|
3611
3732
|
(args) => {
|
|
3612
3733
|
const result = {
|
|
3613
3734
|
maxWidth: "none",
|
|
@@ -3671,8 +3792,8 @@ function Tooltip({
|
|
|
3671
3792
|
portalTarget
|
|
3672
3793
|
}) {
|
|
3673
3794
|
const { calculatePosition } = useTooltip();
|
|
3674
|
-
const [isVisible, setIsVisible] = (0,
|
|
3675
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
3795
|
+
const [isVisible, setIsVisible] = (0, import_react54.useState)(false);
|
|
3796
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react54.useState)({
|
|
3676
3797
|
maxWidth: "none",
|
|
3677
3798
|
width: "auto",
|
|
3678
3799
|
left: "0px",
|
|
@@ -3681,8 +3802,8 @@ function Tooltip({
|
|
|
3681
3802
|
translateX: "0",
|
|
3682
3803
|
translateY: "0"
|
|
3683
3804
|
});
|
|
3684
|
-
const targetRef = (0,
|
|
3685
|
-
const handleMouseOverWrapper = (0,
|
|
3805
|
+
const targetRef = (0, import_react54.useRef)(null);
|
|
3806
|
+
const handleMouseOverWrapper = (0, import_react54.useCallback)(() => {
|
|
3686
3807
|
if (isDisabledHover) {
|
|
3687
3808
|
return;
|
|
3688
3809
|
}
|
|
@@ -3699,16 +3820,16 @@ function Tooltip({
|
|
|
3699
3820
|
}
|
|
3700
3821
|
setIsVisible(true);
|
|
3701
3822
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
3702
|
-
const handleMouseOutWrapper = (0,
|
|
3823
|
+
const handleMouseOutWrapper = (0, import_react54.useCallback)(() => {
|
|
3703
3824
|
setIsVisible(false);
|
|
3704
3825
|
}, []);
|
|
3705
|
-
(0,
|
|
3826
|
+
(0, import_react54.useEffect)(() => {
|
|
3706
3827
|
if (targetRef.current === null) return;
|
|
3707
3828
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
3708
3829
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
3709
3830
|
setTooltipPosition(position);
|
|
3710
3831
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
3711
|
-
(0,
|
|
3832
|
+
(0, import_react54.useEffect)(() => {
|
|
3712
3833
|
if (!isVisible) return;
|
|
3713
3834
|
const updatePosition = () => {
|
|
3714
3835
|
if (targetRef.current === null) return;
|