@zenkigen-inc/component-ui 1.18.5 → 1.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +55 -3
- package/dist/index.d.ts +55 -3
- package/dist/index.js +1306 -857
- package/dist/index.mjs +1200 -742
- package/package.json +6 -5
package/dist/index.mjs
CHANGED
|
@@ -265,16 +265,707 @@ function Checkbox({
|
|
|
265
265
|
] });
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
+
// src/date-picker/date-picker.tsx
|
|
269
|
+
import "react-day-picker/style.css";
|
|
270
|
+
import {
|
|
271
|
+
Children,
|
|
272
|
+
cloneElement as cloneElement3,
|
|
273
|
+
isValidElement,
|
|
274
|
+
useCallback as useCallback3,
|
|
275
|
+
useEffect as useEffect3,
|
|
276
|
+
useId,
|
|
277
|
+
useMemo as useMemo2,
|
|
278
|
+
useRef as useRef3,
|
|
279
|
+
useState as useState2
|
|
280
|
+
} from "react";
|
|
281
|
+
import { DayPicker } from "react-day-picker";
|
|
282
|
+
|
|
283
|
+
// src/icon-button/icon-button.tsx
|
|
284
|
+
import { buttonColors as buttonColors2, focusVisible as focusVisible3 } from "@zenkigen-inc/component-theme";
|
|
285
|
+
import { clsx as clsx5 } from "clsx";
|
|
286
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
287
|
+
function IconButton({
|
|
288
|
+
icon,
|
|
289
|
+
size = "medium",
|
|
290
|
+
variant = "outline",
|
|
291
|
+
isNoPadding = false,
|
|
292
|
+
isDisabled = false,
|
|
293
|
+
isSelected = false,
|
|
294
|
+
iconAccentColor,
|
|
295
|
+
...props
|
|
296
|
+
}) {
|
|
297
|
+
const baseClasses = clsx5(
|
|
298
|
+
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
299
|
+
buttonColors2[variant].hover,
|
|
300
|
+
buttonColors2[variant].active,
|
|
301
|
+
buttonColors2[variant].disabled,
|
|
302
|
+
focusVisible3.normal,
|
|
303
|
+
{
|
|
304
|
+
"h-4 w-4": size === "small" && isNoPadding,
|
|
305
|
+
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
306
|
+
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
307
|
+
"h-10 w-10": size === "large" && !isNoPadding,
|
|
308
|
+
"inline-flex": props.isAnchor,
|
|
309
|
+
"pointer-events-none": isDisabled,
|
|
310
|
+
[buttonColors2[variant].selected]: isSelected,
|
|
311
|
+
[buttonColors2[variant].base]: !isSelected
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
const iconSize = size === "small" ? "small" : "medium";
|
|
315
|
+
const iconAccentColorProps = !isSelected && iconAccentColor ? { accentColor: iconAccentColor } : {};
|
|
316
|
+
if (props.isAnchor === true) {
|
|
317
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
318
|
+
return /* @__PURE__ */ jsx8("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ jsx8(Icon, { name: icon, size: iconSize, ...iconAccentColorProps }) });
|
|
319
|
+
} else {
|
|
320
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
321
|
+
return /* @__PURE__ */ jsx8("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ jsx8(Icon, { name: icon, size: iconSize, ...iconAccentColorProps }) });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// src/popover/popover.tsx
|
|
326
|
+
import { autoUpdate, offset, useFloating, useId as useFloatingId } from "@floating-ui/react";
|
|
327
|
+
import { useEffect as useEffect2, useMemo, useRef as useRef2 } from "react";
|
|
328
|
+
|
|
329
|
+
// src/popover/popover-content.tsx
|
|
330
|
+
import { FloatingPortal, useDismiss, useInteractions, useRole } from "@floating-ui/react";
|
|
331
|
+
import * as React from "react";
|
|
332
|
+
import { forwardRef, useCallback as useCallback2, useEffect, useRef } from "react";
|
|
333
|
+
|
|
334
|
+
// src/utils/react-utils.ts
|
|
335
|
+
function composeRefs(...refs) {
|
|
336
|
+
return (node) => {
|
|
337
|
+
for (const ref of refs) {
|
|
338
|
+
if (ref == null) {
|
|
339
|
+
continue;
|
|
340
|
+
}
|
|
341
|
+
if (typeof ref === "function") {
|
|
342
|
+
ref(node);
|
|
343
|
+
} else {
|
|
344
|
+
ref.current = node;
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
function isElement(node) {
|
|
350
|
+
return node != null && typeof node === "object" && "type" in node;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// src/popover/popover-context.ts
|
|
354
|
+
import { createContext, useContext } from "react";
|
|
355
|
+
var PopoverContext = createContext(null);
|
|
356
|
+
var usePopoverContext = () => {
|
|
357
|
+
const context = useContext(PopoverContext);
|
|
358
|
+
if (context == null) {
|
|
359
|
+
throw new Error("Popover components must be used inside <Popover.Root>");
|
|
360
|
+
}
|
|
361
|
+
return context;
|
|
362
|
+
};
|
|
363
|
+
|
|
364
|
+
// src/popover/popover-content.tsx
|
|
365
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
366
|
+
var PopoverContent = forwardRef(function PopoverContent2({ children }, ref) {
|
|
367
|
+
const { isOpen, triggerRef, floating, panelId, onClose } = usePopoverContext();
|
|
368
|
+
const shouldCloseOnOutsidePress = useCallback2(
|
|
369
|
+
(event) => {
|
|
370
|
+
const target = event.target;
|
|
371
|
+
if (!(target instanceof Element)) {
|
|
372
|
+
return true;
|
|
373
|
+
}
|
|
374
|
+
const floatingElement = floating.refs.floating.current;
|
|
375
|
+
const closestOverlay = target.closest(".z-overlay, .z-dropdown");
|
|
376
|
+
if (closestOverlay !== null && floatingElement instanceof Element) {
|
|
377
|
+
const isInsideOwnFloating = floatingElement.contains(closestOverlay);
|
|
378
|
+
return isInsideOwnFloating;
|
|
379
|
+
}
|
|
380
|
+
return true;
|
|
381
|
+
},
|
|
382
|
+
[floating.refs.floating]
|
|
383
|
+
);
|
|
384
|
+
const dismiss = useDismiss(floating.context, {
|
|
385
|
+
outsidePressEvent: "pointerdown",
|
|
386
|
+
outsidePress: shouldCloseOnOutsidePress,
|
|
387
|
+
escapeKey: false
|
|
388
|
+
});
|
|
389
|
+
const interactions = useInteractions([dismiss, useRole(floating.context, { role: "dialog" })]);
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
if (isOpen) {
|
|
392
|
+
const element = floating.refs.floating.current;
|
|
393
|
+
element?.focus?.({ preventScroll: true });
|
|
394
|
+
}
|
|
395
|
+
}, [isOpen, floating.refs.floating]);
|
|
396
|
+
const prevIsOpenRef = useRef(isOpen);
|
|
397
|
+
useEffect(() => {
|
|
398
|
+
const hasPreviouslyBeenOpen = prevIsOpenRef.current;
|
|
399
|
+
prevIsOpenRef.current = isOpen;
|
|
400
|
+
if (hasPreviouslyBeenOpen && !isOpen) {
|
|
401
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
402
|
+
}
|
|
403
|
+
}, [isOpen, triggerRef]);
|
|
404
|
+
const handleKeyDown = useCallback2(
|
|
405
|
+
(event) => {
|
|
406
|
+
if (event.key === "Escape") {
|
|
407
|
+
event.stopPropagation();
|
|
408
|
+
if (onClose != null) {
|
|
409
|
+
onClose({ reason: "escape-key-down" });
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
[onClose]
|
|
414
|
+
);
|
|
415
|
+
let wrappedChildren = children;
|
|
416
|
+
if (isElement(children)) {
|
|
417
|
+
const childProps = children.props;
|
|
418
|
+
wrappedChildren = React.cloneElement(children, {
|
|
419
|
+
...childProps,
|
|
420
|
+
...childProps.id == null && { id: panelId },
|
|
421
|
+
...childProps.role == null && { role: "dialog" }
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return /* @__PURE__ */ jsx9(FloatingPortal, { children: isOpen ? /* @__PURE__ */ jsx9(
|
|
425
|
+
"div",
|
|
426
|
+
{
|
|
427
|
+
...interactions.getFloatingProps({
|
|
428
|
+
ref: composeRefs(floating.refs.setFloating, ref),
|
|
429
|
+
tabIndex: -1,
|
|
430
|
+
onKeyDown: handleKeyDown,
|
|
431
|
+
style: {
|
|
432
|
+
position: floating.strategy,
|
|
433
|
+
top: floating.y ?? 0,
|
|
434
|
+
left: floating.x ?? 0,
|
|
435
|
+
outline: "0"
|
|
436
|
+
}
|
|
437
|
+
}),
|
|
438
|
+
children: wrappedChildren
|
|
439
|
+
}
|
|
440
|
+
) : null });
|
|
441
|
+
});
|
|
442
|
+
|
|
443
|
+
// src/popover/popover-trigger.tsx
|
|
444
|
+
import * as React2 from "react";
|
|
445
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
446
|
+
var PopoverTrigger = forwardRef2(function PopoverTrigger2({ children }, ref) {
|
|
447
|
+
const { isOpen, floating, triggerRef, anchorRef, panelId } = usePopoverContext();
|
|
448
|
+
if (!isElement(children)) {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
const handleTriggerRef = (node) => {
|
|
452
|
+
triggerRef.current = node;
|
|
453
|
+
if (anchorRef == null) {
|
|
454
|
+
floating.refs.setReference(node);
|
|
455
|
+
}
|
|
456
|
+
if (typeof ref === "function") {
|
|
457
|
+
ref(node);
|
|
458
|
+
} else if (ref != null) {
|
|
459
|
+
ref.current = node;
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
const childProps = children.props;
|
|
463
|
+
const childRef = childProps.ref;
|
|
464
|
+
return React2.cloneElement(children, {
|
|
465
|
+
...childProps,
|
|
466
|
+
ref: composeRefs(childRef, handleTriggerRef),
|
|
467
|
+
"aria-haspopup": "dialog",
|
|
468
|
+
"aria-expanded": isOpen,
|
|
469
|
+
"aria-controls": panelId
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
// src/popover/popover.tsx
|
|
474
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
475
|
+
function Popover({
|
|
476
|
+
isOpen,
|
|
477
|
+
children,
|
|
478
|
+
placement = "top",
|
|
479
|
+
offset: offsetValue = 8,
|
|
480
|
+
onClose,
|
|
481
|
+
anchorRef
|
|
482
|
+
}) {
|
|
483
|
+
const triggerRef = useRef2(null);
|
|
484
|
+
const floating = useFloating({
|
|
485
|
+
open: isOpen,
|
|
486
|
+
onOpenChange: (open) => {
|
|
487
|
+
if (!open && onClose != null) {
|
|
488
|
+
onClose({ reason: "outside-click" });
|
|
489
|
+
}
|
|
490
|
+
},
|
|
491
|
+
placement,
|
|
492
|
+
middleware: [offset(offsetValue)],
|
|
493
|
+
whileElementsMounted: autoUpdate,
|
|
494
|
+
strategy: "fixed"
|
|
495
|
+
});
|
|
496
|
+
useEffect2(() => {
|
|
497
|
+
if (anchorRef?.current) {
|
|
498
|
+
floating.refs.setReference(anchorRef.current);
|
|
499
|
+
}
|
|
500
|
+
}, [anchorRef, floating.refs]);
|
|
501
|
+
const contentId = useFloatingId() ?? "";
|
|
502
|
+
const panelId = `${contentId}-panel`;
|
|
503
|
+
const contextValue = useMemo(
|
|
504
|
+
() => ({
|
|
505
|
+
isOpen,
|
|
506
|
+
triggerRef,
|
|
507
|
+
anchorRef,
|
|
508
|
+
floating,
|
|
509
|
+
contentId,
|
|
510
|
+
panelId,
|
|
511
|
+
onClose
|
|
512
|
+
}),
|
|
513
|
+
[isOpen, triggerRef, anchorRef, floating, contentId, panelId, onClose]
|
|
514
|
+
);
|
|
515
|
+
return /* @__PURE__ */ jsx10(PopoverContext.Provider, { value: contextValue, children });
|
|
516
|
+
}
|
|
517
|
+
Popover.Trigger = PopoverTrigger;
|
|
518
|
+
Popover.Content = PopoverContent;
|
|
519
|
+
|
|
520
|
+
// src/date-picker/date-picker-context.tsx
|
|
521
|
+
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
522
|
+
var DatePickerCompoundContext = createContext2(null);
|
|
523
|
+
var useDatePickerCompoundContext = (componentName) => {
|
|
524
|
+
const context = useContext2(DatePickerCompoundContext);
|
|
525
|
+
if (context == null) {
|
|
526
|
+
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`);
|
|
527
|
+
}
|
|
528
|
+
return context;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
// src/date-picker/date-picker-day-button.tsx
|
|
532
|
+
import { focusVisible as focusVisible4 } from "@zenkigen-inc/component-theme";
|
|
533
|
+
import { clsx as clsx7 } from "clsx";
|
|
534
|
+
import { DayButton } from "react-day-picker";
|
|
535
|
+
|
|
536
|
+
// src/date-picker/date-picker-styles.ts
|
|
537
|
+
import { clsx as clsx6 } from "clsx";
|
|
538
|
+
import { getDefaultClassNames } from "react-day-picker";
|
|
539
|
+
var defaultDayPickerClassNames = getDefaultClassNames();
|
|
540
|
+
var dayPickerStyle = {
|
|
541
|
+
"--rdp-font-family": "Arial, 'Noto Sans JP', sans-serif",
|
|
542
|
+
"--rdp-nav-height": "30px",
|
|
543
|
+
"--rdp-day-font": "700 12px/1 'Arial', 'Noto Sans JP', sans-serif",
|
|
544
|
+
"--rdp-selected-font": "700 12px/1 'Arial', 'Noto Sans JP', sans-serif",
|
|
545
|
+
"--rdp-weekday-font": "700 12px/1 'Arial', 'Noto Sans JP', sans-serif",
|
|
546
|
+
"--rdp-day-width": "30px",
|
|
547
|
+
"--rdp-day-height": "30px",
|
|
548
|
+
"--rdp-day_button-width": "28px",
|
|
549
|
+
"--rdp-day_button-height": "28px",
|
|
550
|
+
"--rdp-day_button-border": "1px solid transparent",
|
|
551
|
+
"--rdp-weekday-padding": "0px"
|
|
552
|
+
};
|
|
553
|
+
var dayPickerClassNames = {
|
|
554
|
+
month: clsx6(defaultDayPickerClassNames.month, "flex flex-col px-[7px] py-2")
|
|
555
|
+
};
|
|
556
|
+
var dayButtonBaseClass = "relative grid size-full place-items-center rounded-full !border !border-solid";
|
|
557
|
+
|
|
558
|
+
// src/date-picker/date-picker-day-button.tsx
|
|
559
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
560
|
+
var CustomDayButton = ({ day, modifiers, className, ...buttonProps }) => {
|
|
561
|
+
const isSelected = Boolean(modifiers.selected);
|
|
562
|
+
const isOutside = Boolean(modifiers.outside);
|
|
563
|
+
const isMinMaxDisabled = Boolean(modifiers.minMaxDisabled);
|
|
564
|
+
const now = /* @__PURE__ */ new Date();
|
|
565
|
+
const isToday = day.date.getFullYear() === now.getFullYear() && day.date.getMonth() === now.getMonth() && day.date.getDate() === now.getDate();
|
|
566
|
+
const isDisabledDay = isMinMaxDisabled;
|
|
567
|
+
return /* @__PURE__ */ jsx11(
|
|
568
|
+
DayButton,
|
|
569
|
+
{
|
|
570
|
+
...buttonProps,
|
|
571
|
+
day,
|
|
572
|
+
modifiers,
|
|
573
|
+
className: clsx7(
|
|
574
|
+
className,
|
|
575
|
+
dayButtonBaseClass,
|
|
576
|
+
// 共通: フォーカスリング(有効な日のみ)
|
|
577
|
+
// react-day-picker の rdp-day_button クラスが outline: none を設定しているため、!important で上書き
|
|
578
|
+
!isDisabledDay && focusVisible4.normalImportant,
|
|
579
|
+
// minDate/maxDate 制限日
|
|
580
|
+
isMinMaxDisabled && "!cursor-not-allowed !border-transparent !text-disabled01",
|
|
581
|
+
// 範囲外の日(前後月)
|
|
582
|
+
isOutside && !isMinMaxDisabled && "!border-transparent !text-interactive04",
|
|
583
|
+
// 通常の日
|
|
584
|
+
!isDisabledDay && !isSelected && "!border-transparent",
|
|
585
|
+
!isDisabledDay && !isToday && "!text-interactive02 hover:!bg-hoverUi",
|
|
586
|
+
// 今日
|
|
587
|
+
!isDisabledDay && isToday && !isSelected && "!border-selectedUiBorder !bg-interactive01 !text-textOnColor",
|
|
588
|
+
// 選択された日
|
|
589
|
+
isSelected && "!border-selectedUiBorder !bg-uiBackgroundBlue"
|
|
590
|
+
)
|
|
591
|
+
}
|
|
592
|
+
);
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
// src/date-picker/date-picker-error-message.tsx
|
|
596
|
+
import { clsx as clsx8 } from "clsx";
|
|
597
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
598
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
599
|
+
var DatePickerErrorMessage = forwardRef3(
|
|
600
|
+
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
601
|
+
const { size, isError } = useDatePickerCompoundContext("DatePicker.ErrorMessage");
|
|
602
|
+
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
603
|
+
if (isError !== true) {
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
const errorMessageClassName = clsx8(typographyClass, "text-supportError");
|
|
607
|
+
return /* @__PURE__ */ jsx12("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
608
|
+
}
|
|
609
|
+
);
|
|
610
|
+
DatePickerErrorMessage.displayName = "DatePicker.ErrorMessage";
|
|
611
|
+
|
|
612
|
+
// src/date-picker/date-picker-month-caption.tsx
|
|
613
|
+
import { clsx as clsx9 } from "clsx";
|
|
614
|
+
import { useDayPicker } from "react-day-picker";
|
|
615
|
+
|
|
616
|
+
// src/date-picker/date-picker-utils.ts
|
|
617
|
+
var localDateFormatter = new Intl.DateTimeFormat("en-CA", {
|
|
618
|
+
year: "numeric",
|
|
619
|
+
month: "2-digit",
|
|
620
|
+
day: "2-digit"
|
|
621
|
+
});
|
|
622
|
+
var timeZoneFormatters = {
|
|
623
|
+
UTC: new Intl.DateTimeFormat("en-CA", {
|
|
624
|
+
timeZone: "UTC",
|
|
625
|
+
year: "numeric",
|
|
626
|
+
month: "2-digit",
|
|
627
|
+
day: "2-digit"
|
|
628
|
+
}),
|
|
629
|
+
"Asia/Tokyo": new Intl.DateTimeFormat("en-CA", {
|
|
630
|
+
timeZone: "Asia/Tokyo",
|
|
631
|
+
year: "numeric",
|
|
632
|
+
month: "2-digit",
|
|
633
|
+
day: "2-digit"
|
|
634
|
+
})
|
|
635
|
+
};
|
|
636
|
+
var toIsoOffset = (timeZone) => timeZone === "UTC" ? "Z" : "+09:00";
|
|
637
|
+
var formatDateKey = (date, timeZone) => {
|
|
638
|
+
const parts = timeZoneFormatters[timeZone].formatToParts(date);
|
|
639
|
+
const year = parts.find((p) => p.type === "year")?.value;
|
|
640
|
+
const month = parts.find((p) => p.type === "month")?.value;
|
|
641
|
+
const day = parts.find((p) => p.type === "day")?.value;
|
|
642
|
+
return `${year}-${month}-${day}`;
|
|
643
|
+
};
|
|
644
|
+
var formatLocalDateKey = (date = /* @__PURE__ */ new Date()) => {
|
|
645
|
+
return localDateFormatter.format(date);
|
|
646
|
+
};
|
|
647
|
+
var createDateFromKey = (dateKey, timeZone) => {
|
|
648
|
+
return /* @__PURE__ */ new Date(`${dateKey}T00:00:00${toIsoOffset(timeZone)}`);
|
|
649
|
+
};
|
|
650
|
+
var createLocalDateFromKey = (dateKey) => {
|
|
651
|
+
const parts = dateKey.split("-");
|
|
652
|
+
const year = parts[0];
|
|
653
|
+
const month = parts[1];
|
|
654
|
+
const day = parts[2];
|
|
655
|
+
if (year == null || month == null || day == null) {
|
|
656
|
+
throw new Error(`Invalid dateKey format: "${dateKey}". Expected "YYYY-MM-DD".`);
|
|
657
|
+
}
|
|
658
|
+
return new Date(Number(year), Number(month) - 1, Number(day));
|
|
659
|
+
};
|
|
660
|
+
var getMonthStartDate = (date, timeZone) => {
|
|
661
|
+
const parts = formatDateKey(date, timeZone).split("-");
|
|
662
|
+
const year = parts[0];
|
|
663
|
+
const month = parts[1];
|
|
664
|
+
if (year == null || month == null) {
|
|
665
|
+
throw new Error("Invalid date format from formatDateKey.");
|
|
666
|
+
}
|
|
667
|
+
return new Date(Number(year), Number(month) - 1, 1);
|
|
668
|
+
};
|
|
669
|
+
var formatDisplayDate = (date, timeZone) => {
|
|
670
|
+
const [year, month, day] = formatDateKey(date, timeZone).split("-");
|
|
671
|
+
return `${year}\u5E74${month}\u6708${day}\u65E5`;
|
|
672
|
+
};
|
|
673
|
+
var formatMonthLabel = (date) => {
|
|
674
|
+
const [year, month] = formatLocalDateKey(date).split("-");
|
|
675
|
+
return `${year}\u5E74${month}\u6708`;
|
|
676
|
+
};
|
|
677
|
+
|
|
678
|
+
// src/date-picker/date-picker-month-caption.tsx
|
|
679
|
+
import { jsx as jsx13, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
680
|
+
var CustomMonthCaption = ({ calendarMonth, className, displayIndex, ...props }) => {
|
|
681
|
+
void displayIndex;
|
|
682
|
+
const { goToMonth, nextMonth, previousMonth } = useDayPicker();
|
|
683
|
+
const captionMonth = calendarMonth.date;
|
|
684
|
+
return /* @__PURE__ */ jsxs3("div", { className: clsx9("flex items-center justify-between px-1 pb-0.5", className), ...props, children: [
|
|
685
|
+
/* @__PURE__ */ jsx13(
|
|
686
|
+
IconButton,
|
|
687
|
+
{
|
|
688
|
+
icon: "angle-left",
|
|
689
|
+
size: "small",
|
|
690
|
+
variant: "text",
|
|
691
|
+
isDisabled: !previousMonth,
|
|
692
|
+
"aria-label": "\u524D\u306E\u6708",
|
|
693
|
+
onClick: () => previousMonth && goToMonth(previousMonth)
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
/* @__PURE__ */ jsx13("span", { className: "typography-label12bold text-text02", children: formatMonthLabel(captionMonth) }),
|
|
697
|
+
/* @__PURE__ */ jsx13(
|
|
698
|
+
IconButton,
|
|
699
|
+
{
|
|
700
|
+
icon: "angle-right",
|
|
701
|
+
size: "small",
|
|
702
|
+
variant: "text",
|
|
703
|
+
isDisabled: !nextMonth,
|
|
704
|
+
"aria-label": "\u6B21\u306E\u6708",
|
|
705
|
+
onClick: () => nextMonth && goToMonth(nextMonth)
|
|
706
|
+
}
|
|
707
|
+
)
|
|
708
|
+
] });
|
|
709
|
+
};
|
|
710
|
+
|
|
711
|
+
// src/date-picker/date-picker-weekday.tsx
|
|
712
|
+
import { clsx as clsx10 } from "clsx";
|
|
713
|
+
import { jsx as jsx14 } from "react/jsx-runtime";
|
|
714
|
+
var CustomWeekday = ({ className, children, ...props }) => {
|
|
715
|
+
return /* @__PURE__ */ jsx14(
|
|
716
|
+
"th",
|
|
717
|
+
{
|
|
718
|
+
...props,
|
|
719
|
+
className: clsx10(className, "m-0 flex size-7 items-center justify-center p-0 text-center text-text02"),
|
|
720
|
+
children
|
|
721
|
+
}
|
|
722
|
+
);
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
// src/date-picker/date-picker.tsx
|
|
726
|
+
import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
727
|
+
var DatePicker = ({
|
|
728
|
+
value,
|
|
729
|
+
onChange,
|
|
730
|
+
isDisabled = false,
|
|
731
|
+
isError = false,
|
|
732
|
+
minDate,
|
|
733
|
+
maxDate,
|
|
734
|
+
placeholder = "\u65E5\u4ED8\u3092\u9078\u629E",
|
|
735
|
+
size = "medium",
|
|
736
|
+
timeZone = "Asia/Tokyo",
|
|
737
|
+
children,
|
|
738
|
+
onClick,
|
|
739
|
+
type,
|
|
740
|
+
...restProps
|
|
741
|
+
}) => {
|
|
742
|
+
const autoGeneratedId = useId();
|
|
743
|
+
const describedByBaseId = restProps.id ?? autoGeneratedId;
|
|
744
|
+
const [isOpen, setIsOpen] = useState2(false);
|
|
745
|
+
const [displayMonth, setDisplayMonth] = useState2(() => {
|
|
746
|
+
if (value == null) {
|
|
747
|
+
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
748
|
+
return createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`);
|
|
749
|
+
}
|
|
750
|
+
return getMonthStartDate(value, timeZone);
|
|
751
|
+
});
|
|
752
|
+
const calendarRef = useRef3(null);
|
|
753
|
+
const selectedKey = useMemo2(() => value == null ? null : formatDateKey(value, timeZone), [value, timeZone]);
|
|
754
|
+
const selectedDate = useMemo2(() => {
|
|
755
|
+
if (selectedKey == null) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
return createLocalDateFromKey(selectedKey);
|
|
759
|
+
}, [selectedKey]);
|
|
760
|
+
const minKey = useMemo2(() => minDate == null ? null : formatDateKey(minDate, timeZone), [minDate, timeZone]);
|
|
761
|
+
const maxKey = useMemo2(() => maxDate == null ? null : formatDateKey(maxDate, timeZone), [maxDate, timeZone]);
|
|
762
|
+
const currentMonthKey = useMemo2(() => formatLocalDateKey(displayMonth).slice(0, 7), [displayMonth]);
|
|
763
|
+
const isOutsideMonth = useCallback3(
|
|
764
|
+
(date) => formatLocalDateKey(date).slice(0, 7) !== currentMonthKey,
|
|
765
|
+
[currentMonthKey]
|
|
766
|
+
);
|
|
767
|
+
const isMinMaxDisabled = useCallback3(
|
|
768
|
+
(date) => {
|
|
769
|
+
const dateKey = formatLocalDateKey(date);
|
|
770
|
+
if (minKey != null && dateKey < minKey) {
|
|
771
|
+
return true;
|
|
772
|
+
}
|
|
773
|
+
if (maxKey != null && dateKey > maxKey) {
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
return false;
|
|
777
|
+
},
|
|
778
|
+
[maxKey, minKey]
|
|
779
|
+
);
|
|
780
|
+
const disabledDays = useCallback3(
|
|
781
|
+
(date) => {
|
|
782
|
+
if (isOutsideMonth(date)) {
|
|
783
|
+
return true;
|
|
784
|
+
}
|
|
785
|
+
return isMinMaxDisabled(date);
|
|
786
|
+
},
|
|
787
|
+
[isOutsideMonth, isMinMaxDisabled]
|
|
788
|
+
);
|
|
789
|
+
const todayForCalendar = useMemo2(() => createLocalDateFromKey(formatLocalDateKey()), []);
|
|
790
|
+
useEffect3(() => {
|
|
791
|
+
if (value == null) {
|
|
792
|
+
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
793
|
+
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
794
|
+
return;
|
|
795
|
+
}
|
|
796
|
+
setDisplayMonth(getMonthStartDate(value, timeZone));
|
|
797
|
+
}, [value, timeZone]);
|
|
798
|
+
useEffect3(() => {
|
|
799
|
+
if (!isOpen) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
const frame = requestAnimationFrame(() => {
|
|
803
|
+
const container = calendarRef.current;
|
|
804
|
+
if (!container) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
const selected = container.querySelector('button[aria-selected="true"]');
|
|
808
|
+
const today = container.querySelector('button[aria-current="date"]');
|
|
809
|
+
const focusTarget = selected ?? today;
|
|
810
|
+
focusTarget?.focus({ preventScroll: true });
|
|
811
|
+
});
|
|
812
|
+
return () => cancelAnimationFrame(frame);
|
|
813
|
+
}, [displayMonth, isOpen, value]);
|
|
814
|
+
useEffect3(() => {
|
|
815
|
+
if (isDisabled) {
|
|
816
|
+
setIsOpen(false);
|
|
817
|
+
}
|
|
818
|
+
}, [isDisabled]);
|
|
819
|
+
const handleTriggerClick = (event) => {
|
|
820
|
+
if (isDisabled) {
|
|
821
|
+
event.preventDefault();
|
|
822
|
+
return;
|
|
823
|
+
}
|
|
824
|
+
onClick?.(event);
|
|
825
|
+
setIsOpen((prev) => !prev);
|
|
826
|
+
};
|
|
827
|
+
const handleClose = () => {
|
|
828
|
+
setIsOpen(false);
|
|
829
|
+
};
|
|
830
|
+
const handleSelect = (selected) => {
|
|
831
|
+
if (!selected) {
|
|
832
|
+
return;
|
|
833
|
+
}
|
|
834
|
+
const selectedKey2 = formatLocalDateKey(selected);
|
|
835
|
+
onChange(createDateFromKey(selectedKey2, timeZone));
|
|
836
|
+
setIsOpen(false);
|
|
837
|
+
};
|
|
838
|
+
const handleClear = () => {
|
|
839
|
+
onChange(null);
|
|
840
|
+
setIsOpen(false);
|
|
841
|
+
};
|
|
842
|
+
const handleClickToday = () => {
|
|
843
|
+
const todayKey = formatLocalDateKey(/* @__PURE__ */ new Date());
|
|
844
|
+
setDisplayMonth(createLocalDateFromKey(`${todayKey.slice(0, 7)}-01`));
|
|
845
|
+
};
|
|
846
|
+
const formatters = useMemo2(() => {
|
|
847
|
+
const weekdayFormatter = new Intl.DateTimeFormat("ja-JP", { weekday: "short" });
|
|
848
|
+
return {
|
|
849
|
+
formatCaption: (date) => formatMonthLabel(date),
|
|
850
|
+
formatDay: (date) => String(date.getDate()),
|
|
851
|
+
formatWeekdayName: (date) => weekdayFormatter.format(date)
|
|
852
|
+
};
|
|
853
|
+
}, []);
|
|
854
|
+
const iconSize = size === "large" ? "medium" : "small";
|
|
855
|
+
const displayText = value ? formatDisplayDate(value, timeZone) : placeholder;
|
|
856
|
+
const displayTextClasses = "min-w-0 truncate";
|
|
857
|
+
const errorIds = [];
|
|
858
|
+
const enhancedChildren = Children.map(children, (child) => {
|
|
859
|
+
if (!isValidElement(child)) {
|
|
860
|
+
return child;
|
|
861
|
+
}
|
|
862
|
+
if (child.type === DatePickerErrorMessage && isError) {
|
|
863
|
+
const errorChild = child;
|
|
864
|
+
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
865
|
+
errorIds.push(assignedId);
|
|
866
|
+
return cloneElement3(errorChild, { id: assignedId });
|
|
867
|
+
}
|
|
868
|
+
return child;
|
|
869
|
+
});
|
|
870
|
+
const describedByFromProps = typeof restProps["aria-describedby"] === "string" ? restProps["aria-describedby"] : null;
|
|
871
|
+
const describedByList = [describedByFromProps, ...errorIds].filter(
|
|
872
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
873
|
+
);
|
|
874
|
+
const describedByProps = describedByList.length > 0 ? {
|
|
875
|
+
"aria-describedby": describedByList.join(" ")
|
|
876
|
+
} : {};
|
|
877
|
+
const shouldMarkInvalid = isError === true || errorIds.length > 0;
|
|
878
|
+
const ariaInvalidFromProps = restProps["aria-invalid"];
|
|
879
|
+
const ariaInvalidValue = ariaInvalidFromProps != null ? ariaInvalidFromProps : shouldMarkInvalid ? true : null;
|
|
880
|
+
const ariaInvalidProps = ariaInvalidValue == null ? {} : { "aria-invalid": ariaInvalidValue };
|
|
881
|
+
const mergedButtonProps = {
|
|
882
|
+
...restProps,
|
|
883
|
+
...describedByProps,
|
|
884
|
+
...ariaInvalidProps
|
|
885
|
+
};
|
|
886
|
+
const contextValue = useMemo2(
|
|
887
|
+
() => ({
|
|
888
|
+
size,
|
|
889
|
+
isError
|
|
890
|
+
}),
|
|
891
|
+
[isError, size]
|
|
892
|
+
);
|
|
893
|
+
const popoverContent = /* @__PURE__ */ jsxs4(Popover, { isOpen, placement: "bottom-start", onClose: handleClose, children: [
|
|
894
|
+
/* @__PURE__ */ jsx15(Popover.Trigger, { children: /* @__PURE__ */ jsx15(
|
|
895
|
+
InternalButton,
|
|
896
|
+
{
|
|
897
|
+
...mergedButtonProps,
|
|
898
|
+
type: type ?? "button",
|
|
899
|
+
size,
|
|
900
|
+
variant: isError ? "outlineDanger" : "outline",
|
|
901
|
+
isDisabled,
|
|
902
|
+
before: /* @__PURE__ */ jsx15(Icon, { name: "calendar", size: iconSize }),
|
|
903
|
+
justifyContent: "start",
|
|
904
|
+
onClick: handleTriggerClick,
|
|
905
|
+
children: /* @__PURE__ */ jsx15("span", { className: displayTextClasses, children: displayText })
|
|
906
|
+
}
|
|
907
|
+
) }),
|
|
908
|
+
/* @__PURE__ */ jsx15(Popover.Content, { children: /* @__PURE__ */ jsxs4("div", { ref: calendarRef, className: "rounded bg-uiBackground01 shadow-floatingShadow", "aria-label": "\u65E5\u4ED8\u9078\u629E", children: [
|
|
909
|
+
/* @__PURE__ */ jsx15(
|
|
910
|
+
DayPicker,
|
|
911
|
+
{
|
|
912
|
+
mode: "single",
|
|
913
|
+
showOutsideDays: true,
|
|
914
|
+
hideNavigation: true,
|
|
915
|
+
weekStartsOn: 0,
|
|
916
|
+
style: dayPickerStyle,
|
|
917
|
+
month: displayMonth,
|
|
918
|
+
onMonthChange: setDisplayMonth,
|
|
919
|
+
selected: selectedDate,
|
|
920
|
+
onSelect: handleSelect,
|
|
921
|
+
today: todayForCalendar,
|
|
922
|
+
disabled: disabledDays,
|
|
923
|
+
modifiers: { minMaxDisabled: isMinMaxDisabled },
|
|
924
|
+
classNames: dayPickerClassNames,
|
|
925
|
+
formatters,
|
|
926
|
+
fixedWeeks: true,
|
|
927
|
+
components: { MonthCaption: CustomMonthCaption, DayButton: CustomDayButton, Weekday: CustomWeekday }
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between border-t border-uiBorder01 px-2 py-1", children: [
|
|
931
|
+
/* @__PURE__ */ jsx15(
|
|
932
|
+
IconButton,
|
|
933
|
+
{
|
|
934
|
+
icon: "calendar-today",
|
|
935
|
+
size: "medium",
|
|
936
|
+
variant: "text",
|
|
937
|
+
"aria-label": "\u4ECA\u65E5\u306B\u623B\u308B",
|
|
938
|
+
iconAccentColor: "supportInfo",
|
|
939
|
+
onClick: handleClickToday
|
|
940
|
+
}
|
|
941
|
+
),
|
|
942
|
+
/* @__PURE__ */ jsx15(Button, { type: "button", size: "small", variant: "text", onClick: handleClear, children: "\u30AF\u30EA\u30A2" })
|
|
943
|
+
] })
|
|
944
|
+
] }) })
|
|
945
|
+
] });
|
|
946
|
+
const stackedChildren = enhancedChildren == null ? [] : Children.toArray(enhancedChildren);
|
|
947
|
+
const hasMessageChildren = stackedChildren.length > 0;
|
|
948
|
+
if (!hasMessageChildren) {
|
|
949
|
+
return /* @__PURE__ */ jsx15(DatePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx15("div", { className: "flex flex-col", children: popoverContent }) });
|
|
950
|
+
}
|
|
951
|
+
return /* @__PURE__ */ jsx15(DatePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-2", children: [
|
|
952
|
+
popoverContent,
|
|
953
|
+
stackedChildren
|
|
954
|
+
] }) });
|
|
955
|
+
};
|
|
956
|
+
DatePicker.ErrorMessage = DatePickerErrorMessage;
|
|
957
|
+
DatePicker.displayName = "DatePicker";
|
|
958
|
+
|
|
268
959
|
// src/dropdown/dropdown.tsx
|
|
269
|
-
import { buttonColors as
|
|
270
|
-
import
|
|
271
|
-
import { useCallback as
|
|
960
|
+
import { buttonColors as buttonColors3, focusVisible as focusVisible6 } from "@zenkigen-inc/component-theme";
|
|
961
|
+
import clsx13 from "clsx";
|
|
962
|
+
import { useCallback as useCallback4, useRef as useRef4, useState as useState3 } from "react";
|
|
272
963
|
import { createPortal } from "react-dom";
|
|
273
964
|
|
|
274
965
|
// src/hooks/use-outside-click.ts
|
|
275
|
-
import { useEffect } from "react";
|
|
966
|
+
import { useEffect as useEffect4 } from "react";
|
|
276
967
|
var useOutsideClick = (ref, handler, enabled = true) => {
|
|
277
|
-
|
|
968
|
+
useEffect4(() => {
|
|
278
969
|
const listener = (event) => {
|
|
279
970
|
const element = ref?.current;
|
|
280
971
|
if (element == null || Boolean(element.contains(event?.target ?? null))) {
|
|
@@ -290,8 +981,8 @@ var useOutsideClick = (ref, handler, enabled = true) => {
|
|
|
290
981
|
};
|
|
291
982
|
|
|
292
983
|
// src/dropdown/dropdown-context.ts
|
|
293
|
-
import { createContext } from "react";
|
|
294
|
-
var DropdownContext =
|
|
984
|
+
import { createContext as createContext3 } from "react";
|
|
985
|
+
var DropdownContext = createContext3({
|
|
295
986
|
isVisible: false,
|
|
296
987
|
setIsVisible: () => false,
|
|
297
988
|
isDisabled: false,
|
|
@@ -300,31 +991,31 @@ var DropdownContext = createContext({
|
|
|
300
991
|
});
|
|
301
992
|
|
|
302
993
|
// src/dropdown/dropdown-item.tsx
|
|
303
|
-
import { focusVisible as
|
|
304
|
-
import
|
|
305
|
-
import { useContext } from "react";
|
|
306
|
-
import { jsx as
|
|
994
|
+
import { focusVisible as focusVisible5 } from "@zenkigen-inc/component-theme";
|
|
995
|
+
import clsx11 from "clsx";
|
|
996
|
+
import { useContext as useContext3 } from "react";
|
|
997
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
307
998
|
function DropdownItem({ children, color = "gray", onClick }) {
|
|
308
|
-
const { setIsVisible } =
|
|
999
|
+
const { setIsVisible } = useContext3(DropdownContext);
|
|
309
1000
|
const handleClickItem = (event) => {
|
|
310
1001
|
setIsVisible(false);
|
|
311
1002
|
onClick?.(event);
|
|
312
1003
|
};
|
|
313
|
-
const itemClasses =
|
|
1004
|
+
const itemClasses = clsx11(
|
|
314
1005
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
315
|
-
|
|
1006
|
+
focusVisible5.inset,
|
|
316
1007
|
{
|
|
317
1008
|
"bg-uiBackground01 fill-icon01 text-interactive02": color === "gray",
|
|
318
1009
|
"fill-supportDanger text-supportDanger": color === "red"
|
|
319
1010
|
}
|
|
320
1011
|
);
|
|
321
|
-
return /* @__PURE__ */
|
|
1012
|
+
return /* @__PURE__ */ jsx16("li", { className: "flex w-full items-center", children: /* @__PURE__ */ jsx16("button", { className: itemClasses, type: "button", onClick: handleClickItem, children }) });
|
|
322
1013
|
}
|
|
323
1014
|
|
|
324
1015
|
// src/dropdown/dropdown-menu.tsx
|
|
325
|
-
import
|
|
326
|
-
import { useContext as
|
|
327
|
-
import { jsx as
|
|
1016
|
+
import clsx12 from "clsx";
|
|
1017
|
+
import { useContext as useContext4 } from "react";
|
|
1018
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
328
1019
|
function DropdownMenu({
|
|
329
1020
|
children,
|
|
330
1021
|
maxHeight,
|
|
@@ -332,8 +1023,8 @@ function DropdownMenu({
|
|
|
332
1023
|
verticalPosition = "bottom",
|
|
333
1024
|
horizontalAlign = "left"
|
|
334
1025
|
}) {
|
|
335
|
-
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } =
|
|
336
|
-
const wrapperClasses =
|
|
1026
|
+
const { isVisible, isDisabled, targetDimensions, variant, portalTargetRef } = useContext4(DropdownContext);
|
|
1027
|
+
const wrapperClasses = clsx12("z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 shadow-floatingShadow", {
|
|
337
1028
|
absolute: !portalTargetRef,
|
|
338
1029
|
"border-solid border border-uiBorder01": variant === "outline",
|
|
339
1030
|
"py-1": !isNoPadding,
|
|
@@ -341,7 +1032,7 @@ function DropdownMenu({
|
|
|
341
1032
|
"right-0": horizontalAlign === "right",
|
|
342
1033
|
"left-auto": horizontalAlign === "center"
|
|
343
1034
|
});
|
|
344
|
-
return isVisible && !isDisabled && /* @__PURE__ */
|
|
1035
|
+
return isVisible && !isDisabled && /* @__PURE__ */ jsx17(
|
|
345
1036
|
"ul",
|
|
346
1037
|
{
|
|
347
1038
|
className: wrapperClasses,
|
|
@@ -356,7 +1047,7 @@ function DropdownMenu({
|
|
|
356
1047
|
}
|
|
357
1048
|
|
|
358
1049
|
// src/dropdown/dropdown.tsx
|
|
359
|
-
import { jsx as
|
|
1050
|
+
import { jsx as jsx18, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
360
1051
|
function Dropdown({
|
|
361
1052
|
children,
|
|
362
1053
|
target,
|
|
@@ -369,14 +1060,14 @@ function Dropdown({
|
|
|
369
1060
|
isArrowHidden = false,
|
|
370
1061
|
portalTargetRef
|
|
371
1062
|
}) {
|
|
372
|
-
const [isVisible, setIsVisible] =
|
|
373
|
-
const [targetDimensions, setTargetDimensions] =
|
|
1063
|
+
const [isVisible, setIsVisible] = useState3(false);
|
|
1064
|
+
const [targetDimensions, setTargetDimensions] = useState3({
|
|
374
1065
|
width: 0,
|
|
375
1066
|
height: 0
|
|
376
1067
|
});
|
|
377
|
-
const targetRef =
|
|
1068
|
+
const targetRef = useRef4(null);
|
|
378
1069
|
useOutsideClick(targetRef, () => setIsVisible(false));
|
|
379
|
-
const handleToggle =
|
|
1070
|
+
const handleToggle = useCallback4(() => {
|
|
380
1071
|
if (targetRef.current === null) {
|
|
381
1072
|
return;
|
|
382
1073
|
}
|
|
@@ -392,24 +1083,24 @@ function Dropdown({
|
|
|
392
1083
|
setIsVisible(true);
|
|
393
1084
|
}
|
|
394
1085
|
}, [isVisible]);
|
|
395
|
-
const wrapperClasses =
|
|
1086
|
+
const wrapperClasses = clsx13("relative flex shrink-0 items-center gap-1 rounded", {
|
|
396
1087
|
"cursor-not-allowed": isDisabled
|
|
397
1088
|
});
|
|
398
|
-
const childrenButtonClasses =
|
|
1089
|
+
const childrenButtonClasses = clsx13(
|
|
399
1090
|
"flex items-center justify-center rounded bg-uiBackground01 p-1 hover:bg-hover02 active:bg-active02",
|
|
400
|
-
|
|
1091
|
+
focusVisible6.normal,
|
|
401
1092
|
{
|
|
402
1093
|
"pointer-events-none": isDisabled,
|
|
403
1094
|
"border border-uiBorder02": variant === "outline"
|
|
404
1095
|
}
|
|
405
1096
|
);
|
|
406
|
-
const buttonClasses =
|
|
1097
|
+
const buttonClasses = clsx13(
|
|
407
1098
|
"flex items-center rounded bg-uiBackground01",
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
1099
|
+
buttonColors3[variant].base,
|
|
1100
|
+
buttonColors3[variant].hover,
|
|
1101
|
+
buttonColors3[variant].active,
|
|
1102
|
+
buttonColors3[variant].disabled,
|
|
1103
|
+
focusVisible6.normal,
|
|
413
1104
|
{
|
|
414
1105
|
"pointer-events-none": isDisabled,
|
|
415
1106
|
"h-6 px-2": size === "x-small" || size === "small",
|
|
@@ -417,19 +1108,19 @@ function Dropdown({
|
|
|
417
1108
|
"h-10 px-4": size === "large"
|
|
418
1109
|
}
|
|
419
1110
|
);
|
|
420
|
-
const labelClasses =
|
|
1111
|
+
const labelClasses = clsx13("flex items-center", {
|
|
421
1112
|
"mr-1": !isArrowHidden && size === "x-small",
|
|
422
1113
|
"mr-2": !isArrowHidden && size !== "x-small",
|
|
423
1114
|
"typography-label12regular": size === "x-small",
|
|
424
1115
|
"typography-label14regular": size === "small" || size === "medium",
|
|
425
1116
|
"typography-label16regular": size === "large"
|
|
426
1117
|
});
|
|
427
|
-
return /* @__PURE__ */
|
|
1118
|
+
return /* @__PURE__ */ jsx18(
|
|
428
1119
|
DropdownContext.Provider,
|
|
429
1120
|
{
|
|
430
1121
|
value: { isVisible, setIsVisible, isDisabled, targetDimensions, variant, portalTargetRef },
|
|
431
|
-
children: /* @__PURE__ */
|
|
432
|
-
target ? /* @__PURE__ */
|
|
1122
|
+
children: /* @__PURE__ */ jsxs5("div", { ref: targetRef, className: wrapperClasses, children: [
|
|
1123
|
+
target ? /* @__PURE__ */ jsxs5(
|
|
433
1124
|
"button",
|
|
434
1125
|
{
|
|
435
1126
|
type: "button",
|
|
@@ -439,7 +1130,7 @@ function Dropdown({
|
|
|
439
1130
|
disabled: isDisabled,
|
|
440
1131
|
children: [
|
|
441
1132
|
target,
|
|
442
|
-
!isArrowHidden && /* @__PURE__ */
|
|
1133
|
+
!isArrowHidden && /* @__PURE__ */ jsx18("div", { className: "ml-2 flex items-center fill-icon01", children: /* @__PURE__ */ jsx18(
|
|
443
1134
|
Icon,
|
|
444
1135
|
{
|
|
445
1136
|
name: isVisible ? "angle-small-up" : "angle-small-down",
|
|
@@ -448,10 +1139,10 @@ function Dropdown({
|
|
|
448
1139
|
) })
|
|
449
1140
|
]
|
|
450
1141
|
}
|
|
451
|
-
) : /* @__PURE__ */
|
|
452
|
-
icon && /* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
!isArrowHidden && /* @__PURE__ */
|
|
1142
|
+
) : /* @__PURE__ */ jsxs5("button", { type: "button", title, className: buttonClasses, onClick: handleToggle, disabled: isDisabled, children: [
|
|
1143
|
+
icon && /* @__PURE__ */ jsx18("span", { className: "mr-1 flex", children: /* @__PURE__ */ jsx18(Icon, { name: icon, size: size === "large" ? "medium" : "small" }) }),
|
|
1144
|
+
/* @__PURE__ */ jsx18("span", { className: labelClasses, children: label }),
|
|
1145
|
+
!isArrowHidden && /* @__PURE__ */ jsx18("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx18(Icon, { name: isVisible ? "angle-small-up" : "angle-small-down", size: "small" }) })
|
|
455
1146
|
] }),
|
|
456
1147
|
!portalTargetRef ? children : portalTargetRef != null && portalTargetRef.current && createPortal(children, portalTargetRef.current)
|
|
457
1148
|
] })
|
|
@@ -463,14 +1154,14 @@ Dropdown.Item = DropdownItem;
|
|
|
463
1154
|
|
|
464
1155
|
// src/evaluation-star/evaluation-star.tsx
|
|
465
1156
|
import { iconElements as iconElements2 } from "@zenkigen-inc/component-icons";
|
|
466
|
-
import { focusVisible as
|
|
467
|
-
import
|
|
468
|
-
import { useCallback as
|
|
469
|
-
import { jsx as
|
|
1157
|
+
import { focusVisible as focusVisible7 } from "@zenkigen-inc/component-theme";
|
|
1158
|
+
import clsx14 from "clsx";
|
|
1159
|
+
import { useCallback as useCallback5, useState as useState4 } from "react";
|
|
1160
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
470
1161
|
function EvaluationStar({ value, isEditable = false, onChangeRating, size = "medium" }) {
|
|
471
1162
|
const maxRating = 5;
|
|
472
|
-
const [currentRating, setCurrentRating] =
|
|
473
|
-
const handleChangeRating =
|
|
1163
|
+
const [currentRating, setCurrentRating] = useState4(value);
|
|
1164
|
+
const handleChangeRating = useCallback5(
|
|
474
1165
|
(newRating) => {
|
|
475
1166
|
if (isEditable) {
|
|
476
1167
|
setCurrentRating(newRating);
|
|
@@ -481,72 +1172,30 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
481
1172
|
},
|
|
482
1173
|
[isEditable, onChangeRating]
|
|
483
1174
|
);
|
|
484
|
-
const starClasses =
|
|
1175
|
+
const starClasses = clsx14(focusVisible7.inset, { "w-6 h-6": size === "large", "w-4 h-4": size === "medium" });
|
|
485
1176
|
const renderStar = (rating) => {
|
|
486
1177
|
const color = rating <= currentRating ? "fill-yellow-yellow50" : "fill-icon03";
|
|
487
1178
|
const IconComponent = iconElements2["star-filled"];
|
|
488
|
-
return /* @__PURE__ */
|
|
1179
|
+
return /* @__PURE__ */ jsx19(
|
|
489
1180
|
"button",
|
|
490
1181
|
{
|
|
491
1182
|
type: "button",
|
|
492
1183
|
onClick: () => handleChangeRating(rating),
|
|
493
|
-
className:
|
|
1184
|
+
className: clsx14(color, starClasses),
|
|
494
1185
|
disabled: !isEditable,
|
|
495
|
-
children: /* @__PURE__ */
|
|
1186
|
+
children: /* @__PURE__ */ jsx19(IconComponent, {})
|
|
496
1187
|
},
|
|
497
1188
|
rating
|
|
498
1189
|
);
|
|
499
1190
|
};
|
|
500
1191
|
const ratingStars = Array.from({ length: maxRating }, (_, index) => renderStar(index + 1));
|
|
501
|
-
return /* @__PURE__ */
|
|
1192
|
+
return /* @__PURE__ */ jsx19("span", { className: "flex flex-row", children: ratingStars });
|
|
502
1193
|
}
|
|
503
1194
|
|
|
504
1195
|
// src/file-input/file-input.tsx
|
|
505
|
-
import { clsx as
|
|
506
|
-
import { forwardRef, useCallback as
|
|
507
|
-
|
|
508
|
-
// src/icon-button/icon-button.tsx
|
|
509
|
-
import { buttonColors as buttonColors3, focusVisible as focusVisible6 } from "@zenkigen-inc/component-theme";
|
|
510
|
-
import { clsx as clsx9 } from "clsx";
|
|
511
|
-
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
512
|
-
function IconButton({
|
|
513
|
-
icon,
|
|
514
|
-
size = "medium",
|
|
515
|
-
variant = "outline",
|
|
516
|
-
isNoPadding = false,
|
|
517
|
-
isDisabled = false,
|
|
518
|
-
isSelected = false,
|
|
519
|
-
...props
|
|
520
|
-
}) {
|
|
521
|
-
const baseClasses = clsx9(
|
|
522
|
-
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
523
|
-
buttonColors3[variant].hover,
|
|
524
|
-
buttonColors3[variant].active,
|
|
525
|
-
buttonColors3[variant].disabled,
|
|
526
|
-
focusVisible6.normal,
|
|
527
|
-
{
|
|
528
|
-
"h-4 w-4": size === "small" && isNoPadding,
|
|
529
|
-
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
530
|
-
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
531
|
-
"h-10 w-10": size === "large" && !isNoPadding,
|
|
532
|
-
"inline-flex": props.isAnchor,
|
|
533
|
-
"pointer-events-none": isDisabled,
|
|
534
|
-
[buttonColors3[variant].selected]: isSelected,
|
|
535
|
-
[buttonColors3[variant].base]: !isSelected
|
|
536
|
-
}
|
|
537
|
-
);
|
|
538
|
-
const iconSize = size === "small" ? "small" : "medium";
|
|
539
|
-
if (props.isAnchor === true) {
|
|
540
|
-
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
541
|
-
return /* @__PURE__ */ jsx12("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ jsx12(Icon, { name: icon, size: iconSize }) });
|
|
542
|
-
} else {
|
|
543
|
-
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
544
|
-
return /* @__PURE__ */ jsx12("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ jsx12(Icon, { name: icon, size: iconSize }) });
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
// src/file-input/file-input.tsx
|
|
549
|
-
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1196
|
+
import { clsx as clsx15 } from "clsx";
|
|
1197
|
+
import { forwardRef as forwardRef4, useCallback as useCallback6, useId as useId2, useImperativeHandle, useRef as useRef5, useState as useState5 } from "react";
|
|
1198
|
+
import { Fragment as Fragment2, jsx as jsx20, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
550
1199
|
var ERROR_TYPES = {
|
|
551
1200
|
SIZE_TOO_LARGE: "SIZE_TOO_LARGE",
|
|
552
1201
|
UNSUPPORTED_FORMAT: "UNSUPPORTED_FORMAT"
|
|
@@ -555,16 +1204,16 @@ var ERROR_MESSAGES = {
|
|
|
555
1204
|
SIZE_TOO_LARGE: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u307E\u3059\u3002",
|
|
556
1205
|
UNSUPPORTED_FORMAT: "\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002"
|
|
557
1206
|
};
|
|
558
|
-
var FileInput =
|
|
1207
|
+
var FileInput = forwardRef4(
|
|
559
1208
|
({ id, variant, accept, maxSize, isDisabled = false, isError = false, onSelect, onError, errorMessages, ...rest }, ref) => {
|
|
560
1209
|
const size = variant === "button" ? rest.size ?? "medium" : "medium";
|
|
561
|
-
const [selectedFile, setSelectedFile] =
|
|
562
|
-
const [isDragOver, setIsDragOver] =
|
|
563
|
-
const fileInputRef =
|
|
564
|
-
const errorId =
|
|
565
|
-
const fallbackId =
|
|
1210
|
+
const [selectedFile, setSelectedFile] = useState5(null);
|
|
1211
|
+
const [isDragOver, setIsDragOver] = useState5(false);
|
|
1212
|
+
const fileInputRef = useRef5(null);
|
|
1213
|
+
const errorId = useId2();
|
|
1214
|
+
const fallbackId = useId2();
|
|
566
1215
|
const inputId = id ?? fallbackId;
|
|
567
|
-
const validateFile =
|
|
1216
|
+
const validateFile = useCallback6(
|
|
568
1217
|
(file) => {
|
|
569
1218
|
const errors = [];
|
|
570
1219
|
if (maxSize != null && maxSize > 0 && file.size > maxSize) {
|
|
@@ -603,7 +1252,7 @@ var FileInput = forwardRef(
|
|
|
603
1252
|
},
|
|
604
1253
|
[accept, maxSize, onError]
|
|
605
1254
|
);
|
|
606
|
-
const handleFileSelect =
|
|
1255
|
+
const handleFileSelect = useCallback6(
|
|
607
1256
|
(file) => {
|
|
608
1257
|
if (file && !validateFile(file)) {
|
|
609
1258
|
return;
|
|
@@ -613,7 +1262,7 @@ var FileInput = forwardRef(
|
|
|
613
1262
|
},
|
|
614
1263
|
[validateFile, onSelect]
|
|
615
1264
|
);
|
|
616
|
-
const handleFileInputChange =
|
|
1265
|
+
const handleFileInputChange = useCallback6(
|
|
617
1266
|
(event) => {
|
|
618
1267
|
if (isDisabled) {
|
|
619
1268
|
return;
|
|
@@ -629,7 +1278,7 @@ var FileInput = forwardRef(
|
|
|
629
1278
|
},
|
|
630
1279
|
[isDisabled, handleFileSelect]
|
|
631
1280
|
);
|
|
632
|
-
const handleDragOver =
|
|
1281
|
+
const handleDragOver = useCallback6(
|
|
633
1282
|
(event) => {
|
|
634
1283
|
event.preventDefault();
|
|
635
1284
|
if (!isDisabled) {
|
|
@@ -638,11 +1287,11 @@ var FileInput = forwardRef(
|
|
|
638
1287
|
},
|
|
639
1288
|
[isDisabled]
|
|
640
1289
|
);
|
|
641
|
-
const handleDragLeave =
|
|
1290
|
+
const handleDragLeave = useCallback6((event) => {
|
|
642
1291
|
event.preventDefault();
|
|
643
1292
|
setIsDragOver(false);
|
|
644
1293
|
}, []);
|
|
645
|
-
const handleDrop =
|
|
1294
|
+
const handleDrop = useCallback6(
|
|
646
1295
|
(event) => {
|
|
647
1296
|
event.preventDefault();
|
|
648
1297
|
setIsDragOver(false);
|
|
@@ -654,12 +1303,12 @@ var FileInput = forwardRef(
|
|
|
654
1303
|
},
|
|
655
1304
|
[isDisabled, handleFileSelect]
|
|
656
1305
|
);
|
|
657
|
-
const handleButtonClick =
|
|
1306
|
+
const handleButtonClick = useCallback6(() => {
|
|
658
1307
|
if (!isDisabled) {
|
|
659
1308
|
fileInputRef.current?.click();
|
|
660
1309
|
}
|
|
661
1310
|
}, [isDisabled]);
|
|
662
|
-
const handleClear =
|
|
1311
|
+
const handleClear = useCallback6(() => {
|
|
663
1312
|
setSelectedFile(null);
|
|
664
1313
|
if (fileInputRef.current) {
|
|
665
1314
|
fileInputRef.current.value = "";
|
|
@@ -675,7 +1324,7 @@ var FileInput = forwardRef(
|
|
|
675
1324
|
);
|
|
676
1325
|
const hasErrorMessages = !isDisabled && errorMessages != null && errorMessages.length > 0;
|
|
677
1326
|
const hasErrors = !isDisabled && isError === true;
|
|
678
|
-
const dropzoneClasses =
|
|
1327
|
+
const dropzoneClasses = clsx15(
|
|
679
1328
|
"flex flex-1 flex-col items-center justify-center gap-4 rounded border border-dashed px-6 text-center",
|
|
680
1329
|
selectedFile ? "py-[52px]" : "py-4",
|
|
681
1330
|
{
|
|
@@ -722,8 +1371,8 @@ var FileInput = forwardRef(
|
|
|
722
1371
|
return normalized.join(", ");
|
|
723
1372
|
})();
|
|
724
1373
|
if (variant === "button") {
|
|
725
|
-
return /* @__PURE__ */
|
|
726
|
-
/* @__PURE__ */
|
|
1374
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1375
|
+
/* @__PURE__ */ jsx20("div", { className: hasErrors ? "flex-1" : "min-w-0 flex-1", children: /* @__PURE__ */ jsx20(
|
|
727
1376
|
InternalButton,
|
|
728
1377
|
{
|
|
729
1378
|
size,
|
|
@@ -731,14 +1380,14 @@ var FileInput = forwardRef(
|
|
|
731
1380
|
isDisabled,
|
|
732
1381
|
width: "100%",
|
|
733
1382
|
onClick: handleButtonClick,
|
|
734
|
-
before: /* @__PURE__ */
|
|
735
|
-
after: /* @__PURE__ */
|
|
736
|
-
children: /* @__PURE__ */
|
|
1383
|
+
before: /* @__PURE__ */ jsx20(Icon, { name: "upload", size: "small" }),
|
|
1384
|
+
after: /* @__PURE__ */ jsx20(Fragment2, { children: selectedFile ? /* @__PURE__ */ jsx20("span", { className: clsx15("typography-label12regular truncate", !isDisabled && "text-text01"), children: selectedFile.name }) : "" }),
|
|
1385
|
+
children: /* @__PURE__ */ jsx20("span", { className: "truncate", children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" })
|
|
737
1386
|
}
|
|
738
1387
|
) }),
|
|
739
|
-
selectedFile && !isDisabled && /* @__PURE__ */
|
|
740
|
-
hasErrors && hasErrorMessages && /* @__PURE__ */
|
|
741
|
-
/* @__PURE__ */
|
|
1388
|
+
selectedFile && !isDisabled && /* @__PURE__ */ jsx20("div", { className: "shrink-0", children: /* @__PURE__ */ jsx20(IconButton, { variant: "text", icon: "close", size: "small", onClick: handleClear }) }),
|
|
1389
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ jsx20("div", { id: errorId, "data-testid": "error-messages", className: "typography-label12regular text-supportError", children: errorMessages.map((message, index) => /* @__PURE__ */ jsx20("div", { className: "break-all", children: message }, index)) }),
|
|
1390
|
+
/* @__PURE__ */ jsx20(
|
|
742
1391
|
"input",
|
|
743
1392
|
{
|
|
744
1393
|
id: inputId,
|
|
@@ -753,8 +1402,8 @@ var FileInput = forwardRef(
|
|
|
753
1402
|
)
|
|
754
1403
|
] });
|
|
755
1404
|
}
|
|
756
|
-
return /* @__PURE__ */
|
|
757
|
-
/* @__PURE__ */
|
|
1405
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex min-w-[320px] flex-col gap-2", children: [
|
|
1406
|
+
/* @__PURE__ */ jsxs6(
|
|
758
1407
|
"div",
|
|
759
1408
|
{
|
|
760
1409
|
className: dropzoneClasses,
|
|
@@ -774,25 +1423,25 @@ var FileInput = forwardRef(
|
|
|
774
1423
|
"aria-disabled": isDisabled,
|
|
775
1424
|
...hasErrors && hasErrorMessages && { "aria-describedby": errorId },
|
|
776
1425
|
children: [
|
|
777
|
-
/* @__PURE__ */
|
|
778
|
-
!selectedFile && /* @__PURE__ */
|
|
1426
|
+
/* @__PURE__ */ jsx20(Icon, { name: "upload-document", size: "large", color: isDisabled ? "icon03" : "icon01" }),
|
|
1427
|
+
!selectedFile && /* @__PURE__ */ jsx20("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ jsx20("div", { className: "typography-body13regular select-none", children: /* @__PURE__ */ jsxs6(Fragment2, { children: [
|
|
779
1428
|
"\u3053\u3053\u306B\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
780
|
-
/* @__PURE__ */
|
|
1429
|
+
/* @__PURE__ */ jsx20("br", {}),
|
|
781
1430
|
"\u307E\u305F\u306F\u3001",
|
|
782
|
-
/* @__PURE__ */
|
|
1431
|
+
/* @__PURE__ */ jsx20("span", { className: clsx15(!isDisabled ? "text-link01" : ""), children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" }),
|
|
783
1432
|
"\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
784
1433
|
] }) }) }),
|
|
785
|
-
!selectedFile && /* @__PURE__ */
|
|
786
|
-
/* @__PURE__ */
|
|
787
|
-
/* @__PURE__ */
|
|
788
|
-
/* @__PURE__ */
|
|
789
|
-
/* @__PURE__ */
|
|
1434
|
+
!selectedFile && /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1", children: [
|
|
1435
|
+
/* @__PURE__ */ jsx20("div", { className: clsx15("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u5BFE\u5FDC\u5F62\u5F0F" }),
|
|
1436
|
+
/* @__PURE__ */ jsx20("div", { className: clsx15("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: acceptLabel }),
|
|
1437
|
+
/* @__PURE__ */ jsx20("div", { className: clsx15("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u30B5\u30A4\u30BA" }),
|
|
1438
|
+
/* @__PURE__ */ jsx20("div", { className: clsx15("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: maxSizeLabel })
|
|
790
1439
|
] }),
|
|
791
|
-
selectedFile && /* @__PURE__ */
|
|
792
|
-
/* @__PURE__ */
|
|
793
|
-
/* @__PURE__ */
|
|
794
|
-
/* @__PURE__ */
|
|
795
|
-
!isDisabled && /* @__PURE__ */
|
|
1440
|
+
selectedFile && /* @__PURE__ */ jsxs6("div", { className: "mt-2 flex flex-col items-center gap-1", children: [
|
|
1441
|
+
/* @__PURE__ */ jsx20("span", { className: "typography-label11regular text-text02", children: "\u30D5\u30A1\u30A4\u30EB\u540D" }),
|
|
1442
|
+
/* @__PURE__ */ jsxs6("div", { className: "flex items-center gap-2", children: [
|
|
1443
|
+
/* @__PURE__ */ jsx20("span", { className: "typography-label14regular", children: selectedFile.name }),
|
|
1444
|
+
!isDisabled && /* @__PURE__ */ jsx20(
|
|
796
1445
|
IconButton,
|
|
797
1446
|
{
|
|
798
1447
|
variant: "text",
|
|
@@ -806,7 +1455,7 @@ var FileInput = forwardRef(
|
|
|
806
1455
|
)
|
|
807
1456
|
] })
|
|
808
1457
|
] }),
|
|
809
|
-
/* @__PURE__ */
|
|
1458
|
+
/* @__PURE__ */ jsx20(
|
|
810
1459
|
"input",
|
|
811
1460
|
{
|
|
812
1461
|
id: inputId,
|
|
@@ -822,13 +1471,13 @@ var FileInput = forwardRef(
|
|
|
822
1471
|
]
|
|
823
1472
|
}
|
|
824
1473
|
),
|
|
825
|
-
hasErrors && hasErrorMessages && /* @__PURE__ */
|
|
1474
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ jsx20(
|
|
826
1475
|
"div",
|
|
827
1476
|
{
|
|
828
1477
|
id: errorId,
|
|
829
1478
|
"data-testid": "error-messages",
|
|
830
1479
|
className: "typography-body13regular flex flex-col text-supportDanger",
|
|
831
|
-
children: errorMessages.map((message, index) => /* @__PURE__ */
|
|
1480
|
+
children: errorMessages.map((message, index) => /* @__PURE__ */ jsx20("div", { children: message }, index))
|
|
832
1481
|
}
|
|
833
1482
|
)
|
|
834
1483
|
] });
|
|
@@ -838,15 +1487,15 @@ FileInput.displayName = "FileInput";
|
|
|
838
1487
|
|
|
839
1488
|
// src/heading/heading.tsx
|
|
840
1489
|
import { typography } from "@zenkigen-inc/component-theme";
|
|
841
|
-
import { clsx as
|
|
842
|
-
import { jsxs as
|
|
1490
|
+
import { clsx as clsx16 } from "clsx";
|
|
1491
|
+
import { jsxs as jsxs7 } from "react/jsx-runtime";
|
|
843
1492
|
function Heading(props) {
|
|
844
1493
|
const TagName = `h${props.level}`;
|
|
845
|
-
const classes =
|
|
1494
|
+
const classes = clsx16(`flex items-center text-text01`, typography.heading[TagName], {
|
|
846
1495
|
"gap-2": props.level === 1,
|
|
847
1496
|
"gap-1": props.level > 1
|
|
848
1497
|
});
|
|
849
|
-
return /* @__PURE__ */
|
|
1498
|
+
return /* @__PURE__ */ jsxs7(TagName, { className: classes, children: [
|
|
850
1499
|
props.before,
|
|
851
1500
|
props.children,
|
|
852
1501
|
props.after
|
|
@@ -854,22 +1503,22 @@ function Heading(props) {
|
|
|
854
1503
|
}
|
|
855
1504
|
|
|
856
1505
|
// src/hooks/use-roving-focus.ts
|
|
857
|
-
import { useCallback as
|
|
1506
|
+
import { useCallback as useCallback7, useState as useState6 } from "react";
|
|
858
1507
|
var useRovingFocus = ({
|
|
859
1508
|
values,
|
|
860
1509
|
defaultFocusedValue,
|
|
861
1510
|
isDisabled = false
|
|
862
1511
|
}) => {
|
|
863
|
-
const [focusedValue, setFocusedValue] =
|
|
1512
|
+
const [focusedValue, setFocusedValue] = useState6(
|
|
864
1513
|
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
865
1514
|
);
|
|
866
|
-
const handleFocusChange =
|
|
1515
|
+
const handleFocusChange = useCallback7((newValue) => {
|
|
867
1516
|
setFocusedValue(newValue);
|
|
868
1517
|
}, []);
|
|
869
|
-
const handleBlur =
|
|
1518
|
+
const handleBlur = useCallback7(() => {
|
|
870
1519
|
setFocusedValue(null);
|
|
871
1520
|
}, []);
|
|
872
|
-
const handleKeyDown =
|
|
1521
|
+
const handleKeyDown = useCallback7(
|
|
873
1522
|
(event) => {
|
|
874
1523
|
if (isDisabled === true || values.length === 0) return;
|
|
875
1524
|
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
@@ -924,17 +1573,17 @@ var useRovingFocus = ({
|
|
|
924
1573
|
};
|
|
925
1574
|
|
|
926
1575
|
// src/loading/loading.tsx
|
|
927
|
-
import
|
|
928
|
-
import { Fragment as Fragment3, jsx as
|
|
1576
|
+
import clsx17 from "clsx";
|
|
1577
|
+
import { Fragment as Fragment3, jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
929
1578
|
function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
930
|
-
const wrapperClasses =
|
|
931
|
-
const svgClasses =
|
|
1579
|
+
const wrapperClasses = clsx17(position, "left-0 top-0 z-20 flex w-full items-center justify-center");
|
|
1580
|
+
const svgClasses = clsx17({
|
|
932
1581
|
"h-4 w-4": size === "small",
|
|
933
1582
|
"h-8 w-8": size === "medium",
|
|
934
1583
|
"h-16 w-16": size === "large"
|
|
935
1584
|
});
|
|
936
|
-
return /* @__PURE__ */
|
|
937
|
-
size === "small" && /* @__PURE__ */
|
|
1585
|
+
return /* @__PURE__ */ jsx21(Fragment3, { children: /* @__PURE__ */ jsxs8("div", { className: wrapperClasses, style: { height }, children: [
|
|
1586
|
+
size === "small" && /* @__PURE__ */ jsx21("svg", { className: svgClasses, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21(
|
|
938
1587
|
"circle",
|
|
939
1588
|
{
|
|
940
1589
|
className: "origin-center animate-circular-small-move stroke-interactive01",
|
|
@@ -946,7 +1595,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
946
1595
|
fill: "none"
|
|
947
1596
|
}
|
|
948
1597
|
) }),
|
|
949
|
-
size === "medium" && /* @__PURE__ */
|
|
1598
|
+
size === "medium" && /* @__PURE__ */ jsx21("svg", { className: svgClasses, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21(
|
|
950
1599
|
"circle",
|
|
951
1600
|
{
|
|
952
1601
|
className: "origin-center animate-circular-medium-move stroke-interactive01",
|
|
@@ -958,7 +1607,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
958
1607
|
fill: "none"
|
|
959
1608
|
}
|
|
960
1609
|
) }),
|
|
961
|
-
size === "large" && /* @__PURE__ */
|
|
1610
|
+
size === "large" && /* @__PURE__ */ jsx21("svg", { className: svgClasses, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx21(
|
|
962
1611
|
"circle",
|
|
963
1612
|
{
|
|
964
1613
|
className: "origin-center animate-circular-large-move stroke-interactive01",
|
|
@@ -974,7 +1623,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
974
1623
|
}
|
|
975
1624
|
|
|
976
1625
|
// src/modal/modal.tsx
|
|
977
|
-
import { useEffect as
|
|
1626
|
+
import { useEffect as useEffect5, useState as useState7 } from "react";
|
|
978
1627
|
import { createPortal as createPortal2 } from "react-dom";
|
|
979
1628
|
|
|
980
1629
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -1025,34 +1674,34 @@ function restoreProperty(element, property, value) {
|
|
|
1025
1674
|
}
|
|
1026
1675
|
|
|
1027
1676
|
// src/modal/modal-body.tsx
|
|
1028
|
-
import { jsx as
|
|
1677
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
1029
1678
|
function ModalBody({ children }) {
|
|
1030
|
-
return /* @__PURE__ */
|
|
1679
|
+
return /* @__PURE__ */ jsx22("div", { className: "overflow-y-auto", children });
|
|
1031
1680
|
}
|
|
1032
1681
|
|
|
1033
1682
|
// src/modal/modal-context.ts
|
|
1034
|
-
import { createContext as
|
|
1035
|
-
var ModalContext =
|
|
1683
|
+
import { createContext as createContext4 } from "react";
|
|
1684
|
+
var ModalContext = createContext4({
|
|
1036
1685
|
onClose: () => null
|
|
1037
1686
|
});
|
|
1038
1687
|
|
|
1039
1688
|
// src/modal/modal-footer.tsx
|
|
1040
|
-
import
|
|
1041
|
-
import { jsx as
|
|
1689
|
+
import clsx18 from "clsx";
|
|
1690
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
1042
1691
|
function ModalFooter({ children, isNoBorder = false }) {
|
|
1043
|
-
const wrapperClasses =
|
|
1692
|
+
const wrapperClasses = clsx18("flex w-full shrink-0 items-center rounded-b-lg px-6 py-4", {
|
|
1044
1693
|
"border-t-[1px] border-uiBorder01": !isNoBorder
|
|
1045
1694
|
});
|
|
1046
|
-
return /* @__PURE__ */
|
|
1695
|
+
return /* @__PURE__ */ jsx23("div", { className: wrapperClasses, children });
|
|
1047
1696
|
}
|
|
1048
1697
|
|
|
1049
1698
|
// src/modal/modal-header.tsx
|
|
1050
|
-
import
|
|
1051
|
-
import { useContext as
|
|
1052
|
-
import { jsx as
|
|
1699
|
+
import clsx19 from "clsx";
|
|
1700
|
+
import { useContext as useContext5 } from "react";
|
|
1701
|
+
import { jsx as jsx24, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1053
1702
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
1054
|
-
const { onClose } =
|
|
1055
|
-
const headerClasses =
|
|
1703
|
+
const { onClose } = useContext5(ModalContext);
|
|
1704
|
+
const headerClasses = clsx19(
|
|
1056
1705
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
1057
1706
|
{
|
|
1058
1707
|
"border-b border-uiBorder01": !isNoBorder,
|
|
@@ -1060,14 +1709,14 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
1060
1709
|
"h-12": onClose
|
|
1061
1710
|
}
|
|
1062
1711
|
);
|
|
1063
|
-
return /* @__PURE__ */
|
|
1064
|
-
/* @__PURE__ */
|
|
1065
|
-
onClose && /* @__PURE__ */
|
|
1712
|
+
return /* @__PURE__ */ jsxs9("div", { className: headerClasses, children: [
|
|
1713
|
+
/* @__PURE__ */ jsx24("div", { children }),
|
|
1714
|
+
onClose && /* @__PURE__ */ jsx24(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
1066
1715
|
] });
|
|
1067
1716
|
}
|
|
1068
1717
|
|
|
1069
1718
|
// src/modal/modal.tsx
|
|
1070
|
-
import { Fragment as Fragment4, jsx as
|
|
1719
|
+
import { Fragment as Fragment4, jsx as jsx25, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1071
1720
|
var LIMIT_WIDTH = 320;
|
|
1072
1721
|
var LIMIT_HEIGHT = 184;
|
|
1073
1722
|
function Modal({
|
|
@@ -1079,16 +1728,16 @@ function Modal({
|
|
|
1079
1728
|
onClose,
|
|
1080
1729
|
portalTargetRef
|
|
1081
1730
|
}) {
|
|
1082
|
-
const [isMounted, setIsMounted] =
|
|
1731
|
+
const [isMounted, setIsMounted] = useState7(false);
|
|
1083
1732
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
1084
1733
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
1085
|
-
|
|
1734
|
+
useEffect5(() => {
|
|
1086
1735
|
setIsMounted(true);
|
|
1087
1736
|
}, []);
|
|
1088
|
-
return isMounted && isOpen ? /* @__PURE__ */
|
|
1089
|
-
/* @__PURE__ */
|
|
1737
|
+
return isMounted && isOpen ? /* @__PURE__ */ jsxs10(Fragment4, { children: [
|
|
1738
|
+
/* @__PURE__ */ jsx25(BodyScrollLock, {}),
|
|
1090
1739
|
createPortal2(
|
|
1091
|
-
/* @__PURE__ */
|
|
1740
|
+
/* @__PURE__ */ jsx25(ModalContext.Provider, { value: { onClose }, children: /* @__PURE__ */ jsx25("div", { className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4", children: /* @__PURE__ */ jsx25(
|
|
1092
1741
|
"div",
|
|
1093
1742
|
{
|
|
1094
1743
|
className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow",
|
|
@@ -1105,10 +1754,10 @@ Modal.Header = ModalHeader;
|
|
|
1105
1754
|
Modal.Footer = ModalFooter;
|
|
1106
1755
|
|
|
1107
1756
|
// src/notification-inline/notification-inline.tsx
|
|
1108
|
-
import { clsx as
|
|
1109
|
-
import { jsx as
|
|
1757
|
+
import { clsx as clsx20 } from "clsx";
|
|
1758
|
+
import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1110
1759
|
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
1111
|
-
const wrapperClasses =
|
|
1760
|
+
const wrapperClasses = clsx20("typography-body13regular flex items-center gap-1 rounded text-text01", {
|
|
1112
1761
|
"bg-uiBackgroundError": state === "attention",
|
|
1113
1762
|
"bg-uiBackgroundWarning": state === "warning",
|
|
1114
1763
|
"bg-uiBackgroundBlue": state === "information",
|
|
@@ -1117,7 +1766,7 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1117
1766
|
"p-2": size === "small",
|
|
1118
1767
|
"p-3": size === "medium"
|
|
1119
1768
|
});
|
|
1120
|
-
const iconClasses =
|
|
1769
|
+
const iconClasses = clsx20("flex items-center", {
|
|
1121
1770
|
"fill-supportError": state === "attention",
|
|
1122
1771
|
"fill-supportWarning": state === "warning",
|
|
1123
1772
|
"fill-blue-blue50": state === "information",
|
|
@@ -1133,28 +1782,28 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
1133
1782
|
small: "small",
|
|
1134
1783
|
medium: "medium"
|
|
1135
1784
|
};
|
|
1136
|
-
return /* @__PURE__ */
|
|
1137
|
-
state !== "default" && /* @__PURE__ */
|
|
1138
|
-
/* @__PURE__ */
|
|
1139
|
-
props.showClose === true && /* @__PURE__ */
|
|
1785
|
+
return /* @__PURE__ */ jsxs11("div", { className: wrapperClasses, children: [
|
|
1786
|
+
state !== "default" && /* @__PURE__ */ jsx26("div", { className: iconClasses, children: /* @__PURE__ */ jsx26(Icon, { name: iconName[state], size: iconSize[size] }) }),
|
|
1787
|
+
/* @__PURE__ */ jsx26("p", { className: "flex-1", children: props.children }),
|
|
1788
|
+
props.showClose === true && /* @__PURE__ */ jsx26("div", { className: "flex items-center", children: /* @__PURE__ */ jsx26(IconButton, { icon: "close", size: "small", variant: "text", onClick: props.onClickClose }) })
|
|
1140
1789
|
] });
|
|
1141
1790
|
}
|
|
1142
1791
|
|
|
1143
1792
|
// src/pagination/pagination-button.tsx
|
|
1144
|
-
import { clsx as
|
|
1145
|
-
import { useContext as
|
|
1793
|
+
import { clsx as clsx21 } from "clsx";
|
|
1794
|
+
import { useContext as useContext6 } from "react";
|
|
1146
1795
|
|
|
1147
1796
|
// src/pagination/pagination-context.ts
|
|
1148
|
-
import { createContext as
|
|
1149
|
-
var PaginationContext =
|
|
1797
|
+
import { createContext as createContext5 } from "react";
|
|
1798
|
+
var PaginationContext = createContext5({
|
|
1150
1799
|
currentPage: 0
|
|
1151
1800
|
});
|
|
1152
1801
|
|
|
1153
1802
|
// src/pagination/pagination-button.tsx
|
|
1154
|
-
import { jsx as
|
|
1803
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
1155
1804
|
function PaginationButton({ page, onClick }) {
|
|
1156
|
-
const { currentPage } =
|
|
1157
|
-
const buttonClasses =
|
|
1805
|
+
const { currentPage } = useContext6(PaginationContext);
|
|
1806
|
+
const buttonClasses = clsx21(
|
|
1158
1807
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
1159
1808
|
"typography-label14regular",
|
|
1160
1809
|
"text-interactive02",
|
|
@@ -1162,11 +1811,11 @@ function PaginationButton({ page, onClick }) {
|
|
|
1162
1811
|
{ "border border-uiBorder02": page === currentPage },
|
|
1163
1812
|
{ "border-transparent": page !== currentPage }
|
|
1164
1813
|
);
|
|
1165
|
-
return /* @__PURE__ */
|
|
1814
|
+
return /* @__PURE__ */ jsx27("button", { type: "button", className: buttonClasses, onClick: () => onClick(page), children: page });
|
|
1166
1815
|
}
|
|
1167
1816
|
|
|
1168
1817
|
// src/pagination/pagination.tsx
|
|
1169
|
-
import { jsx as
|
|
1818
|
+
import { jsx as jsx28, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1170
1819
|
var START_PAGE = 1;
|
|
1171
1820
|
function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick }) {
|
|
1172
1821
|
if (totalPage < START_PAGE) {
|
|
@@ -1202,14 +1851,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1202
1851
|
const hasHeadEllipsis = firstPageInList !== null && firstPageInList > START_PAGE + 1;
|
|
1203
1852
|
const hasTailEllipsis = lastPageInList !== null && lastPageInList < totalPage - 1;
|
|
1204
1853
|
const hasLastPageButton = totalPage > START_PAGE;
|
|
1205
|
-
return /* @__PURE__ */
|
|
1854
|
+
return /* @__PURE__ */ jsx28(
|
|
1206
1855
|
PaginationContext.Provider,
|
|
1207
1856
|
{
|
|
1208
1857
|
value: {
|
|
1209
1858
|
currentPage: clampedCurrentPage
|
|
1210
1859
|
},
|
|
1211
|
-
children: /* @__PURE__ */
|
|
1212
|
-
/* @__PURE__ */
|
|
1860
|
+
children: /* @__PURE__ */ jsxs12("ul", { className: "flex gap-1", children: [
|
|
1861
|
+
/* @__PURE__ */ jsx28("li", { className: "flex items-center", children: /* @__PURE__ */ jsx28(
|
|
1213
1862
|
IconButton,
|
|
1214
1863
|
{
|
|
1215
1864
|
isDisabled: isFirstPage,
|
|
@@ -1219,12 +1868,12 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1219
1868
|
onClick: () => onClick(Math.max(START_PAGE, clampedCurrentPage - 1))
|
|
1220
1869
|
}
|
|
1221
1870
|
) }),
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
hasHeadEllipsis && /* @__PURE__ */
|
|
1224
|
-
pageList.map((page, index) => /* @__PURE__ */
|
|
1225
|
-
hasTailEllipsis && /* @__PURE__ */
|
|
1226
|
-
hasLastPageButton && /* @__PURE__ */
|
|
1227
|
-
/* @__PURE__ */
|
|
1871
|
+
/* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsx28(PaginationButton, { onClick: () => onClick(START_PAGE), page: START_PAGE }) }),
|
|
1872
|
+
hasHeadEllipsis && /* @__PURE__ */ jsx28("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx28(Icon, { name: "more", size: "small" }) }),
|
|
1873
|
+
pageList.map((page, index) => /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsx28(PaginationButton, { onClick: () => onClick(page), page }) }, index)),
|
|
1874
|
+
hasTailEllipsis && /* @__PURE__ */ jsx28("li", { className: threeDotIconClasses, children: /* @__PURE__ */ jsx28(Icon, { name: "more", size: "small" }) }),
|
|
1875
|
+
hasLastPageButton && /* @__PURE__ */ jsx28("li", { children: /* @__PURE__ */ jsx28(PaginationButton, { onClick: () => onClick(totalPage), page: totalPage }) }),
|
|
1876
|
+
/* @__PURE__ */ jsx28("li", { className: "flex items-center", children: /* @__PURE__ */ jsx28(
|
|
1228
1877
|
IconButton,
|
|
1229
1878
|
{
|
|
1230
1879
|
isDisabled: isLastPage,
|
|
@@ -1240,14 +1889,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
1240
1889
|
}
|
|
1241
1890
|
|
|
1242
1891
|
// src/select/select.tsx
|
|
1243
|
-
import { autoUpdate, FloatingPortal, offset, size as sizeMiddleware, useFloating } from "@floating-ui/react";
|
|
1244
|
-
import { focusVisible as
|
|
1245
|
-
import
|
|
1246
|
-
import { useRef as
|
|
1892
|
+
import { autoUpdate as autoUpdate2, FloatingPortal as FloatingPortal2, offset as offset2, size as sizeMiddleware, useFloating as useFloating2 } from "@floating-ui/react";
|
|
1893
|
+
import { focusVisible as focusVisible10, selectColors } from "@zenkigen-inc/component-theme";
|
|
1894
|
+
import clsx24 from "clsx";
|
|
1895
|
+
import { useRef as useRef6, useState as useState8 } from "react";
|
|
1247
1896
|
|
|
1248
1897
|
// src/select/select-context.ts
|
|
1249
|
-
import { createContext as
|
|
1250
|
-
var SelectContext =
|
|
1898
|
+
import { createContext as createContext6 } from "react";
|
|
1899
|
+
var SelectContext = createContext6({
|
|
1251
1900
|
size: "medium",
|
|
1252
1901
|
setIsOptionListOpen: () => false,
|
|
1253
1902
|
variant: "outline",
|
|
@@ -1255,19 +1904,19 @@ var SelectContext = createContext4({
|
|
|
1255
1904
|
});
|
|
1256
1905
|
|
|
1257
1906
|
// src/select/select-item.tsx
|
|
1258
|
-
import { focusVisible as
|
|
1259
|
-
import
|
|
1260
|
-
import { useContext as
|
|
1261
|
-
import { jsx as
|
|
1907
|
+
import { focusVisible as focusVisible8 } from "@zenkigen-inc/component-theme";
|
|
1908
|
+
import clsx22 from "clsx";
|
|
1909
|
+
import { useContext as useContext7 } from "react";
|
|
1910
|
+
import { jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1262
1911
|
function SelectItem({ option }) {
|
|
1263
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError } =
|
|
1912
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = useContext7(SelectContext);
|
|
1264
1913
|
const handleClickItem = (option2) => {
|
|
1265
1914
|
onChange?.(option2);
|
|
1266
1915
|
setIsOptionListOpen(false);
|
|
1267
1916
|
};
|
|
1268
|
-
const itemClasses =
|
|
1917
|
+
const itemClasses = clsx22(
|
|
1269
1918
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1270
|
-
|
|
1919
|
+
focusVisible8.inset,
|
|
1271
1920
|
{
|
|
1272
1921
|
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
1273
1922
|
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
@@ -1275,20 +1924,20 @@ function SelectItem({ option }) {
|
|
|
1275
1924
|
"pr-10": option.id !== selectedOption?.id
|
|
1276
1925
|
}
|
|
1277
1926
|
);
|
|
1278
|
-
return /* @__PURE__ */
|
|
1279
|
-
option.icon && /* @__PURE__ */
|
|
1280
|
-
/* @__PURE__ */
|
|
1281
|
-
option.id === selectedOption?.id && /* @__PURE__ */
|
|
1927
|
+
return /* @__PURE__ */ jsx29("li", { className: "flex w-full items-center", "data-id": option.id, children: /* @__PURE__ */ jsxs13("button", { className: itemClasses, type: "button", onClick: () => handleClickItem(option), children: [
|
|
1928
|
+
option.icon && /* @__PURE__ */ jsx29(Icon, { name: option.icon, size: "small" }),
|
|
1929
|
+
/* @__PURE__ */ jsx29("span", { className: "ml-1 flex-1 truncate text-left", children: option.label }),
|
|
1930
|
+
option.id === selectedOption?.id && /* @__PURE__ */ jsx29("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ jsx29(Icon, { name: "check", size: "small" }) })
|
|
1282
1931
|
] }) }, option.id);
|
|
1283
1932
|
}
|
|
1284
1933
|
|
|
1285
1934
|
// src/select/select-list.tsx
|
|
1286
|
-
import { focusVisible as
|
|
1287
|
-
import
|
|
1288
|
-
import { forwardRef as
|
|
1289
|
-
import { jsx as
|
|
1290
|
-
var SelectList =
|
|
1291
|
-
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } =
|
|
1935
|
+
import { focusVisible as focusVisible9 } from "@zenkigen-inc/component-theme";
|
|
1936
|
+
import clsx23 from "clsx";
|
|
1937
|
+
import { forwardRef as forwardRef5, useContext as useContext8, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
1938
|
+
import { jsx as jsx30, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1939
|
+
var SelectList = forwardRef5(({ children, maxHeight }, ref) => {
|
|
1940
|
+
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } = useContext8(SelectContext);
|
|
1292
1941
|
const handleClickDeselect = () => {
|
|
1293
1942
|
onChange?.(null);
|
|
1294
1943
|
setIsOptionListOpen(false);
|
|
@@ -1311,22 +1960,22 @@ var SelectList = forwardRef2(({ children, maxHeight }, ref) => {
|
|
|
1311
1960
|
}
|
|
1312
1961
|
}
|
|
1313
1962
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
1314
|
-
const listClasses =
|
|
1963
|
+
const listClasses = clsx23("z-dropdown overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
1315
1964
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1316
1965
|
});
|
|
1317
|
-
const deselectButtonClasses =
|
|
1966
|
+
const deselectButtonClasses = clsx23(
|
|
1318
1967
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1319
|
-
|
|
1968
|
+
focusVisible9.inset
|
|
1320
1969
|
);
|
|
1321
|
-
return /* @__PURE__ */
|
|
1970
|
+
return /* @__PURE__ */ jsxs14("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
1322
1971
|
children,
|
|
1323
|
-
placeholder != null && selectedOption !== null && /* @__PURE__ */
|
|
1972
|
+
placeholder != null && selectedOption !== null && /* @__PURE__ */ jsx30("li", { children: /* @__PURE__ */ jsx30("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1324
1973
|
] });
|
|
1325
1974
|
});
|
|
1326
1975
|
SelectList.displayName = "SelectList";
|
|
1327
1976
|
|
|
1328
1977
|
// src/select/select.tsx
|
|
1329
|
-
import { jsx as
|
|
1978
|
+
import { jsx as jsx31, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1330
1979
|
var FLOATING_OFFSET = 4;
|
|
1331
1980
|
function Select({
|
|
1332
1981
|
children,
|
|
@@ -1343,15 +1992,15 @@ function Select({
|
|
|
1343
1992
|
onChange,
|
|
1344
1993
|
optionListMaxHeight
|
|
1345
1994
|
}) {
|
|
1346
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
1347
|
-
const targetRef =
|
|
1995
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState8(false);
|
|
1996
|
+
const targetRef = useRef6(null);
|
|
1348
1997
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1349
|
-
const { refs, floatingStyles } =
|
|
1998
|
+
const { refs, floatingStyles } = useFloating2({
|
|
1350
1999
|
open: isOptionListOpen,
|
|
1351
2000
|
onOpenChange: setIsOptionListOpen,
|
|
1352
2001
|
placement: "bottom-start",
|
|
1353
2002
|
middleware: [
|
|
1354
|
-
|
|
2003
|
+
offset2(FLOATING_OFFSET),
|
|
1355
2004
|
sizeMiddleware({
|
|
1356
2005
|
apply({ availableWidth, elements, rects }) {
|
|
1357
2006
|
const referenceWidth = rects.reference.width;
|
|
@@ -1360,23 +2009,23 @@ function Select({
|
|
|
1360
2009
|
}
|
|
1361
2010
|
})
|
|
1362
2011
|
],
|
|
1363
|
-
whileElementsMounted:
|
|
2012
|
+
whileElementsMounted: autoUpdate2
|
|
1364
2013
|
});
|
|
1365
2014
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1366
2015
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
1367
2016
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
1368
|
-
const wrapperClasses =
|
|
2017
|
+
const wrapperClasses = clsx24("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
1369
2018
|
"h-6": size === "x-small" || size === "small",
|
|
1370
2019
|
"h-8": size === "medium",
|
|
1371
2020
|
"h-10": size === "large",
|
|
1372
2021
|
"cursor-not-allowed": isDisabled
|
|
1373
2022
|
});
|
|
1374
|
-
const buttonClasses =
|
|
2023
|
+
const buttonClasses = clsx24(
|
|
1375
2024
|
"flex size-full items-center rounded",
|
|
1376
2025
|
selectColors[buttonVariant].hover,
|
|
1377
2026
|
selectColors[buttonVariant].active,
|
|
1378
2027
|
selectColors[buttonVariant].disabled,
|
|
1379
|
-
|
|
2028
|
+
focusVisible10.normal,
|
|
1380
2029
|
{
|
|
1381
2030
|
[selectColors[buttonVariant].selected]: isSelected,
|
|
1382
2031
|
[selectColors[buttonVariant].base]: !isSelected,
|
|
@@ -1386,14 +2035,14 @@ function Select({
|
|
|
1386
2035
|
"border-supportError": !isSelected && !isDisabled && isError
|
|
1387
2036
|
}
|
|
1388
2037
|
);
|
|
1389
|
-
const labelClasses =
|
|
2038
|
+
const labelClasses = clsx24("overflow-hidden", {
|
|
1390
2039
|
"mr-1": size === "x-small",
|
|
1391
2040
|
"mr-2": size !== "x-small",
|
|
1392
2041
|
"typography-label12regular": size === "x-small",
|
|
1393
2042
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1394
2043
|
"typography-label16regular": size === "large"
|
|
1395
2044
|
});
|
|
1396
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ jsx31(
|
|
1397
2046
|
SelectContext.Provider,
|
|
1398
2047
|
{
|
|
1399
2048
|
value: {
|
|
@@ -1407,8 +2056,8 @@ function Select({
|
|
|
1407
2056
|
floatingStyles,
|
|
1408
2057
|
floatingRef: refs.floating
|
|
1409
2058
|
},
|
|
1410
|
-
children: /* @__PURE__ */
|
|
1411
|
-
/* @__PURE__ */
|
|
2059
|
+
children: /* @__PURE__ */ jsxs15("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
2060
|
+
/* @__PURE__ */ jsxs15(
|
|
1412
2061
|
"button",
|
|
1413
2062
|
{
|
|
1414
2063
|
ref: refs.setReference,
|
|
@@ -1417,9 +2066,9 @@ function Select({
|
|
|
1417
2066
|
onClick: handleClickToggle,
|
|
1418
2067
|
disabled: isDisabled,
|
|
1419
2068
|
children: [
|
|
1420
|
-
selectedOption?.icon ? /* @__PURE__ */
|
|
1421
|
-
/* @__PURE__ */
|
|
1422
|
-
/* @__PURE__ */
|
|
2069
|
+
selectedOption?.icon ? /* @__PURE__ */ jsx31("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx31(Icon, { name: selectedOption.icon, size: size === "large" ? "medium" : "small" }) }) : placeholder != null && placeholderIcon && /* @__PURE__ */ jsx31("div", { className: "mr-1 flex", children: /* @__PURE__ */ jsx31(Icon, { name: placeholderIcon, size: size === "large" ? "medium" : "small" }) }),
|
|
2070
|
+
/* @__PURE__ */ jsx31("div", { className: labelClasses, children: /* @__PURE__ */ jsx31("div", { className: "truncate", children: selectedOption ? selectedOption.label : placeholder != null && placeholder }) }),
|
|
2071
|
+
/* @__PURE__ */ jsx31("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx31(
|
|
1423
2072
|
Icon,
|
|
1424
2073
|
{
|
|
1425
2074
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1429,7 +2078,7 @@ function Select({
|
|
|
1429
2078
|
]
|
|
1430
2079
|
}
|
|
1431
2080
|
),
|
|
1432
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */
|
|
2081
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx31(FloatingPortal2, { children: /* @__PURE__ */ jsx31("div", { className: "relative z-overlay", children: /* @__PURE__ */ jsx31(SelectList, { ref: refs.setFloating, maxHeight: optionListMaxHeight, children }) }) })
|
|
1433
2082
|
] })
|
|
1434
2083
|
}
|
|
1435
2084
|
);
|
|
@@ -1437,7 +2086,7 @@ function Select({
|
|
|
1437
2086
|
Select.Option = SelectItem;
|
|
1438
2087
|
|
|
1439
2088
|
// src/pagination-select/pagination-select.tsx
|
|
1440
|
-
import { jsx as
|
|
2089
|
+
import { jsx as jsx32, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1441
2090
|
function PaginationSelect({
|
|
1442
2091
|
totalSize,
|
|
1443
2092
|
currentPage,
|
|
@@ -1460,20 +2109,20 @@ function PaginationSelect({
|
|
|
1460
2109
|
});
|
|
1461
2110
|
const minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
|
|
1462
2111
|
const maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
|
|
1463
|
-
return /* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */
|
|
1465
|
-
/* @__PURE__ */
|
|
1466
|
-
/* @__PURE__ */
|
|
2112
|
+
return /* @__PURE__ */ jsxs16("nav", { "aria-label": "pagination", className: "flex items-center gap-x-1", children: [
|
|
2113
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-x-2", children: [
|
|
2114
|
+
/* @__PURE__ */ jsxs16("div", { className: "typography-label14regular flex gap-1 text-text01", children: [
|
|
2115
|
+
/* @__PURE__ */ jsxs16("span", { className: " ", children: [
|
|
1467
2116
|
minCount > 0 && `${minCount} - `,
|
|
1468
2117
|
maxCount
|
|
1469
2118
|
] }),
|
|
1470
|
-
/* @__PURE__ */
|
|
2119
|
+
/* @__PURE__ */ jsxs16("span", { children: [
|
|
1471
2120
|
"/ ",
|
|
1472
2121
|
totalSize
|
|
1473
2122
|
] }),
|
|
1474
|
-
/* @__PURE__ */
|
|
2123
|
+
/* @__PURE__ */ jsx32("span", { children: countLabel })
|
|
1475
2124
|
] }),
|
|
1476
|
-
/* @__PURE__ */
|
|
2125
|
+
/* @__PURE__ */ jsx32(
|
|
1477
2126
|
Select,
|
|
1478
2127
|
{
|
|
1479
2128
|
size: "medium",
|
|
@@ -1482,17 +2131,17 @@ function PaginationSelect({
|
|
|
1482
2131
|
optionListMaxHeight,
|
|
1483
2132
|
onChange: (option) => option && onChange(Number(option.value)),
|
|
1484
2133
|
isDisabled: pageMax === 0,
|
|
1485
|
-
children: optionsList.map((option) => /* @__PURE__ */
|
|
2134
|
+
children: optionsList.map((option) => /* @__PURE__ */ jsx32(Select.Option, { option }, option.id))
|
|
1486
2135
|
}
|
|
1487
2136
|
),
|
|
1488
|
-
/* @__PURE__ */
|
|
2137
|
+
/* @__PURE__ */ jsxs16("div", { className: "typography-label14regular text-text02", children: [
|
|
1489
2138
|
"/ ",
|
|
1490
2139
|
pageMax,
|
|
1491
2140
|
pageLabel
|
|
1492
2141
|
] })
|
|
1493
2142
|
] }),
|
|
1494
|
-
/* @__PURE__ */
|
|
1495
|
-
/* @__PURE__ */
|
|
2143
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center", children: [
|
|
2144
|
+
/* @__PURE__ */ jsx32(
|
|
1496
2145
|
IconButton,
|
|
1497
2146
|
{
|
|
1498
2147
|
variant: "text",
|
|
@@ -1502,7 +2151,7 @@ function PaginationSelect({
|
|
|
1502
2151
|
onClick: onClickPrevButton
|
|
1503
2152
|
}
|
|
1504
2153
|
),
|
|
1505
|
-
/* @__PURE__ */
|
|
2154
|
+
/* @__PURE__ */ jsx32(
|
|
1506
2155
|
IconButton,
|
|
1507
2156
|
{
|
|
1508
2157
|
variant: "text",
|
|
@@ -1517,17 +2166,17 @@ function PaginationSelect({
|
|
|
1517
2166
|
}
|
|
1518
2167
|
|
|
1519
2168
|
// src/password-input/password-input.tsx
|
|
1520
|
-
import { forwardRef as
|
|
2169
|
+
import { forwardRef as forwardRef9, useState as useState9 } from "react";
|
|
1521
2170
|
|
|
1522
2171
|
// src/text-input/text-input.tsx
|
|
1523
|
-
import { clsx as
|
|
1524
|
-
import { Children, cloneElement, forwardRef as
|
|
2172
|
+
import { clsx as clsx27 } from "clsx";
|
|
2173
|
+
import { Children as Children2, cloneElement as cloneElement4, forwardRef as forwardRef8, isValidElement as isValidElement2, useId as useId3, useMemo as useMemo3 } from "react";
|
|
1525
2174
|
|
|
1526
2175
|
// src/text-input/text-input-context.tsx
|
|
1527
|
-
import { createContext as
|
|
1528
|
-
var TextInputCompoundContext =
|
|
2176
|
+
import { createContext as createContext7, useContext as useContext9 } from "react";
|
|
2177
|
+
var TextInputCompoundContext = createContext7(null);
|
|
1529
2178
|
var useTextInputCompoundContext = (componentName) => {
|
|
1530
|
-
const context =
|
|
2179
|
+
const context = useContext9(TextInputCompoundContext);
|
|
1531
2180
|
if (context == null) {
|
|
1532
2181
|
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`);
|
|
1533
2182
|
}
|
|
@@ -1535,10 +2184,10 @@ var useTextInputCompoundContext = (componentName) => {
|
|
|
1535
2184
|
};
|
|
1536
2185
|
|
|
1537
2186
|
// src/text-input/text-input-error-message.tsx
|
|
1538
|
-
import { clsx as
|
|
1539
|
-
import { forwardRef as
|
|
1540
|
-
import { jsx as
|
|
1541
|
-
var TextInputErrorMessage =
|
|
2187
|
+
import { clsx as clsx25 } from "clsx";
|
|
2188
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
2189
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
2190
|
+
var TextInputErrorMessage = forwardRef6(
|
|
1542
2191
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
1543
2192
|
const { inputProps } = useTextInputCompoundContext("TextInput.ErrorMessage");
|
|
1544
2193
|
const typographyClass = inputProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
@@ -1546,26 +2195,26 @@ var TextInputErrorMessage = forwardRef3(
|
|
|
1546
2195
|
if (!shouldRender) {
|
|
1547
2196
|
return null;
|
|
1548
2197
|
}
|
|
1549
|
-
const errorMessageClassName =
|
|
1550
|
-
return /* @__PURE__ */
|
|
2198
|
+
const errorMessageClassName = clsx25(typographyClass, "text-supportError");
|
|
2199
|
+
return /* @__PURE__ */ jsx33("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
1551
2200
|
}
|
|
1552
2201
|
);
|
|
1553
2202
|
TextInputErrorMessage.displayName = "TextInput.ErrorMessage";
|
|
1554
2203
|
|
|
1555
2204
|
// src/text-input/text-input-helper-message.tsx
|
|
1556
|
-
import { clsx as
|
|
1557
|
-
import { forwardRef as
|
|
1558
|
-
import { jsx as
|
|
1559
|
-
var TextInputHelperMessage =
|
|
2205
|
+
import { clsx as clsx26 } from "clsx";
|
|
2206
|
+
import { forwardRef as forwardRef7 } from "react";
|
|
2207
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
2208
|
+
var TextInputHelperMessage = forwardRef7((props, ref) => {
|
|
1560
2209
|
const { inputProps } = useTextInputCompoundContext("TextInput.HelperMessage");
|
|
1561
2210
|
const typographyClass = inputProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
1562
|
-
const helperMessageClassName =
|
|
1563
|
-
return /* @__PURE__ */
|
|
2211
|
+
const helperMessageClassName = clsx26(typographyClass, "text-text02");
|
|
2212
|
+
return /* @__PURE__ */ jsx34("div", { ref, className: helperMessageClassName, ...props });
|
|
1564
2213
|
});
|
|
1565
2214
|
TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
1566
2215
|
|
|
1567
2216
|
// src/text-input/text-input.tsx
|
|
1568
|
-
import { jsx as
|
|
2217
|
+
import { jsx as jsx35, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1569
2218
|
function TextInputInner({
|
|
1570
2219
|
size = "medium",
|
|
1571
2220
|
isError = false,
|
|
@@ -1575,9 +2224,9 @@ function TextInputInner({
|
|
|
1575
2224
|
children,
|
|
1576
2225
|
...props
|
|
1577
2226
|
}, ref) {
|
|
1578
|
-
const autoGeneratedId =
|
|
2227
|
+
const autoGeneratedId = useId3();
|
|
1579
2228
|
const { className: _className, ...restInputProps } = props;
|
|
1580
|
-
const inputPropsForContext =
|
|
2229
|
+
const inputPropsForContext = useMemo3(
|
|
1581
2230
|
() => ({
|
|
1582
2231
|
...restInputProps,
|
|
1583
2232
|
size,
|
|
@@ -1588,7 +2237,7 @@ function TextInputInner({
|
|
|
1588
2237
|
}),
|
|
1589
2238
|
[restInputProps, size, isError, disabled, onClickClearButton, after]
|
|
1590
2239
|
);
|
|
1591
|
-
const contextValue =
|
|
2240
|
+
const contextValue = useMemo3(
|
|
1592
2241
|
() => ({
|
|
1593
2242
|
inputProps: inputPropsForContext,
|
|
1594
2243
|
forwardedRef: ref
|
|
@@ -1598,21 +2247,21 @@ function TextInputInner({
|
|
|
1598
2247
|
const helperMessageIds = [];
|
|
1599
2248
|
const errorIds = [];
|
|
1600
2249
|
const describedByBaseId = restInputProps.id ?? autoGeneratedId;
|
|
1601
|
-
const enhancedChildren =
|
|
1602
|
-
if (!
|
|
2250
|
+
const enhancedChildren = Children2.map(children, (child) => {
|
|
2251
|
+
if (!isValidElement2(child)) {
|
|
1603
2252
|
return child;
|
|
1604
2253
|
}
|
|
1605
2254
|
if (child.type === TextInputHelperMessage) {
|
|
1606
2255
|
const helperChild = child;
|
|
1607
2256
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
1608
2257
|
helperMessageIds.push(assignedId);
|
|
1609
|
-
return
|
|
2258
|
+
return cloneElement4(helperChild, { id: assignedId });
|
|
1610
2259
|
}
|
|
1611
2260
|
if (child.type === TextInputErrorMessage && isError) {
|
|
1612
2261
|
const errorChild = child;
|
|
1613
2262
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
1614
2263
|
errorIds.push(assignedId);
|
|
1615
|
-
return
|
|
2264
|
+
return cloneElement4(errorChild, { id: assignedId });
|
|
1616
2265
|
}
|
|
1617
2266
|
return child;
|
|
1618
2267
|
});
|
|
@@ -1635,7 +2284,7 @@ function TextInputInner({
|
|
|
1635
2284
|
};
|
|
1636
2285
|
const isShowClearButton = !!onClickClearButton && restInputProps.value.length !== 0 && !disabled;
|
|
1637
2286
|
const hasTrailingElement = isShowClearButton || after != null;
|
|
1638
|
-
const inputWrapClasses =
|
|
2287
|
+
const inputWrapClasses = clsx27("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1639
2288
|
"border-uiBorder02": !isError && !disabled,
|
|
1640
2289
|
"border-supportError": isError && !disabled,
|
|
1641
2290
|
"hover:border-hoverInput": !disabled && !isError,
|
|
@@ -1645,24 +2294,24 @@ function TextInputInner({
|
|
|
1645
2294
|
"pr-2": size === "medium" && hasTrailingElement,
|
|
1646
2295
|
"pr-3": size === "large" && hasTrailingElement
|
|
1647
2296
|
});
|
|
1648
|
-
const inputClasses =
|
|
2297
|
+
const inputClasses = clsx27("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1649
2298
|
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1650
2299
|
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1651
2300
|
"text-text01": !isError,
|
|
1652
2301
|
"text-supportError": isError,
|
|
1653
2302
|
"pr-0": hasTrailingElement
|
|
1654
2303
|
});
|
|
1655
|
-
const inputElement = /* @__PURE__ */
|
|
1656
|
-
/* @__PURE__ */
|
|
2304
|
+
const inputElement = /* @__PURE__ */ jsxs17("div", { className: inputWrapClasses, children: [
|
|
2305
|
+
/* @__PURE__ */ jsx35("input", { ref, size: 1, className: inputClasses, ...mergedInputProps }),
|
|
1657
2306
|
after,
|
|
1658
|
-
isShowClearButton && /* @__PURE__ */
|
|
2307
|
+
isShowClearButton && /* @__PURE__ */ jsx35(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1659
2308
|
] });
|
|
1660
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
2309
|
+
const stackedChildren = enhancedChildren == null ? [] : Children2.toArray(enhancedChildren);
|
|
1661
2310
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
1662
2311
|
if (!hasMessageChildren) {
|
|
1663
|
-
return /* @__PURE__ */
|
|
2312
|
+
return /* @__PURE__ */ jsx35(TextInputCompoundContext.Provider, { value: contextValue, children: inputElement });
|
|
1664
2313
|
}
|
|
1665
|
-
return /* @__PURE__ */
|
|
2314
|
+
return /* @__PURE__ */ jsx35(TextInputCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-2", children: [
|
|
1666
2315
|
inputElement,
|
|
1667
2316
|
stackedChildren
|
|
1668
2317
|
] }) });
|
|
@@ -1673,10 +2322,10 @@ var attachStatics = (component) => {
|
|
|
1673
2322
|
component.displayName = "TextInput";
|
|
1674
2323
|
return component;
|
|
1675
2324
|
};
|
|
1676
|
-
var TextInputPublic =
|
|
2325
|
+
var TextInputPublic = forwardRef8(function TextInputPublic2(props, ref) {
|
|
1677
2326
|
return TextInputInner(props, ref);
|
|
1678
2327
|
});
|
|
1679
|
-
var InternalTextInputBase =
|
|
2328
|
+
var InternalTextInputBase = forwardRef8(
|
|
1680
2329
|
function InternalTextInputBase2(props, ref) {
|
|
1681
2330
|
return TextInputInner(props, ref);
|
|
1682
2331
|
}
|
|
@@ -1685,14 +2334,14 @@ var TextInput = attachStatics(TextInputPublic);
|
|
|
1685
2334
|
var InternalTextInput = attachStatics(InternalTextInputBase);
|
|
1686
2335
|
|
|
1687
2336
|
// src/password-input/password-input.tsx
|
|
1688
|
-
import { jsx as
|
|
1689
|
-
var PasswordInputBase =
|
|
1690
|
-
const [isPasswordVisible, setIsPasswordVisible] =
|
|
2337
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
2338
|
+
var PasswordInputBase = forwardRef9(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
2339
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState9(false);
|
|
1691
2340
|
const { className: _className, ...textInputProps } = props;
|
|
1692
2341
|
const handlePasswordVisibilityToggle = () => {
|
|
1693
2342
|
setIsPasswordVisible((prev) => !prev);
|
|
1694
2343
|
};
|
|
1695
|
-
const passwordToggleButton = /* @__PURE__ */
|
|
2344
|
+
const passwordToggleButton = /* @__PURE__ */ jsx36(
|
|
1696
2345
|
IconButton,
|
|
1697
2346
|
{
|
|
1698
2347
|
variant: "text",
|
|
@@ -1703,7 +2352,7 @@ var PasswordInputBase = forwardRef6(function PasswordInput({ disabled = false, c
|
|
|
1703
2352
|
"aria-label": isPasswordVisible === true ? "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u975E\u8868\u793A\u306B\u3059\u308B" : "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8868\u793A\u3059\u308B"
|
|
1704
2353
|
}
|
|
1705
2354
|
);
|
|
1706
|
-
return /* @__PURE__ */
|
|
2355
|
+
return /* @__PURE__ */ jsx36(
|
|
1707
2356
|
InternalTextInput,
|
|
1708
2357
|
{
|
|
1709
2358
|
ref,
|
|
@@ -1721,240 +2370,48 @@ var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
|
1721
2370
|
displayName: "PasswordInput"
|
|
1722
2371
|
});
|
|
1723
2372
|
|
|
1724
|
-
// src/popover/popover.tsx
|
|
1725
|
-
import { autoUpdate as autoUpdate2, offset as offset2, useFloating as useFloating2, useId as useFloatingId } from "@floating-ui/react";
|
|
1726
|
-
import { useEffect as useEffect4, useMemo as useMemo2, useRef as useRef4 } from "react";
|
|
1727
|
-
|
|
1728
|
-
// src/popover/popover-content.tsx
|
|
1729
|
-
import { FloatingPortal as FloatingPortal2, useDismiss, useInteractions, useRole } from "@floating-ui/react";
|
|
1730
|
-
import * as React from "react";
|
|
1731
|
-
import { forwardRef as forwardRef7, useCallback as useCallback6, useEffect as useEffect3 } from "react";
|
|
1732
|
-
|
|
1733
|
-
// src/utils/react-utils.ts
|
|
1734
|
-
function composeRefs(...refs) {
|
|
1735
|
-
return (node) => {
|
|
1736
|
-
for (const ref of refs) {
|
|
1737
|
-
if (ref == null) {
|
|
1738
|
-
continue;
|
|
1739
|
-
}
|
|
1740
|
-
if (typeof ref === "function") {
|
|
1741
|
-
ref(node);
|
|
1742
|
-
} else {
|
|
1743
|
-
ref.current = node;
|
|
1744
|
-
}
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
}
|
|
1748
|
-
function isElement(node) {
|
|
1749
|
-
return node != null && typeof node === "object" && "type" in node;
|
|
1750
|
-
}
|
|
1751
|
-
|
|
1752
|
-
// src/popover/popover-context.ts
|
|
1753
|
-
import { createContext as createContext6, useContext as useContext8 } from "react";
|
|
1754
|
-
var PopoverContext = createContext6(null);
|
|
1755
|
-
var usePopoverContext = () => {
|
|
1756
|
-
const context = useContext8(PopoverContext);
|
|
1757
|
-
if (context == null) {
|
|
1758
|
-
throw new Error("Popover components must be used inside <Popover.Root>");
|
|
1759
|
-
}
|
|
1760
|
-
return context;
|
|
1761
|
-
};
|
|
1762
|
-
|
|
1763
|
-
// src/popover/popover-content.tsx
|
|
1764
|
-
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
1765
|
-
var PopoverContent = forwardRef7(function PopoverContent2({ children }, ref) {
|
|
1766
|
-
const { isOpen, triggerRef, floating, panelId, onClose } = usePopoverContext();
|
|
1767
|
-
const shouldCloseOnOutsidePress = useCallback6(
|
|
1768
|
-
(event) => {
|
|
1769
|
-
const target = event.target;
|
|
1770
|
-
if (!(target instanceof Element)) {
|
|
1771
|
-
return true;
|
|
1772
|
-
}
|
|
1773
|
-
const floatingElement = floating.refs.floating.current;
|
|
1774
|
-
const closestOverlay = target.closest(".z-overlay, .z-dropdown");
|
|
1775
|
-
if (closestOverlay !== null && floatingElement instanceof Element) {
|
|
1776
|
-
const isInsideOwnFloating = floatingElement.contains(closestOverlay);
|
|
1777
|
-
return isInsideOwnFloating;
|
|
1778
|
-
}
|
|
1779
|
-
return true;
|
|
1780
|
-
},
|
|
1781
|
-
[floating.refs.floating]
|
|
1782
|
-
);
|
|
1783
|
-
const dismiss = useDismiss(floating.context, {
|
|
1784
|
-
outsidePressEvent: "pointerdown",
|
|
1785
|
-
outsidePress: shouldCloseOnOutsidePress,
|
|
1786
|
-
escapeKey: false
|
|
1787
|
-
});
|
|
1788
|
-
const interactions = useInteractions([dismiss, useRole(floating.context, { role: "dialog" })]);
|
|
1789
|
-
useEffect3(() => {
|
|
1790
|
-
if (isOpen) {
|
|
1791
|
-
const element = floating.refs.floating.current;
|
|
1792
|
-
element?.focus?.({ preventScroll: true });
|
|
1793
|
-
}
|
|
1794
|
-
}, [isOpen, floating.refs.floating]);
|
|
1795
|
-
useEffect3(() => {
|
|
1796
|
-
if (!isOpen) {
|
|
1797
|
-
triggerRef.current?.focus({ preventScroll: true });
|
|
1798
|
-
}
|
|
1799
|
-
}, [isOpen, triggerRef]);
|
|
1800
|
-
const handleKeyDown = useCallback6(
|
|
1801
|
-
(event) => {
|
|
1802
|
-
if (event.key === "Escape") {
|
|
1803
|
-
event.stopPropagation();
|
|
1804
|
-
if (onClose != null) {
|
|
1805
|
-
onClose({ reason: "escape-key-down" });
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
},
|
|
1809
|
-
[onClose]
|
|
1810
|
-
);
|
|
1811
|
-
let wrappedChildren = children;
|
|
1812
|
-
if (isElement(children)) {
|
|
1813
|
-
const childProps = children.props;
|
|
1814
|
-
wrappedChildren = React.cloneElement(children, {
|
|
1815
|
-
...childProps,
|
|
1816
|
-
...childProps.id == null && { id: panelId },
|
|
1817
|
-
...childProps.role == null && { role: "dialog" }
|
|
1818
|
-
});
|
|
1819
|
-
}
|
|
1820
|
-
return /* @__PURE__ */ jsx30(FloatingPortal2, { children: isOpen ? /* @__PURE__ */ jsx30(
|
|
1821
|
-
"div",
|
|
1822
|
-
{
|
|
1823
|
-
...interactions.getFloatingProps({
|
|
1824
|
-
ref: composeRefs(floating.refs.setFloating, ref),
|
|
1825
|
-
tabIndex: -1,
|
|
1826
|
-
onKeyDown: handleKeyDown,
|
|
1827
|
-
style: {
|
|
1828
|
-
position: floating.strategy,
|
|
1829
|
-
top: floating.y ?? 0,
|
|
1830
|
-
left: floating.x ?? 0,
|
|
1831
|
-
outline: "0"
|
|
1832
|
-
}
|
|
1833
|
-
}),
|
|
1834
|
-
children: wrappedChildren
|
|
1835
|
-
}
|
|
1836
|
-
) : null });
|
|
1837
|
-
});
|
|
1838
|
-
|
|
1839
|
-
// src/popover/popover-trigger.tsx
|
|
1840
|
-
import * as React2 from "react";
|
|
1841
|
-
import { forwardRef as forwardRef8 } from "react";
|
|
1842
|
-
var PopoverTrigger = forwardRef8(function PopoverTrigger2({ children }, ref) {
|
|
1843
|
-
const { isOpen, floating, triggerRef, anchorRef, panelId } = usePopoverContext();
|
|
1844
|
-
if (!isElement(children)) {
|
|
1845
|
-
return null;
|
|
1846
|
-
}
|
|
1847
|
-
const handleTriggerRef = (node) => {
|
|
1848
|
-
triggerRef.current = node;
|
|
1849
|
-
if (anchorRef == null) {
|
|
1850
|
-
floating.refs.setReference(node);
|
|
1851
|
-
}
|
|
1852
|
-
if (typeof ref === "function") {
|
|
1853
|
-
ref(node);
|
|
1854
|
-
} else if (ref != null) {
|
|
1855
|
-
ref.current = node;
|
|
1856
|
-
}
|
|
1857
|
-
};
|
|
1858
|
-
const childProps = children.props;
|
|
1859
|
-
const childRef = childProps.ref;
|
|
1860
|
-
return React2.cloneElement(children, {
|
|
1861
|
-
...childProps,
|
|
1862
|
-
ref: composeRefs(childRef, handleTriggerRef),
|
|
1863
|
-
"aria-haspopup": "dialog",
|
|
1864
|
-
"aria-expanded": isOpen,
|
|
1865
|
-
"aria-controls": panelId
|
|
1866
|
-
});
|
|
1867
|
-
});
|
|
1868
|
-
|
|
1869
|
-
// src/popover/popover.tsx
|
|
1870
|
-
import { jsx as jsx31 } from "react/jsx-runtime";
|
|
1871
|
-
function Popover({
|
|
1872
|
-
isOpen,
|
|
1873
|
-
children,
|
|
1874
|
-
placement = "top",
|
|
1875
|
-
offset: offsetValue = 8,
|
|
1876
|
-
onClose,
|
|
1877
|
-
anchorRef
|
|
1878
|
-
}) {
|
|
1879
|
-
const triggerRef = useRef4(null);
|
|
1880
|
-
const floating = useFloating2({
|
|
1881
|
-
open: isOpen,
|
|
1882
|
-
onOpenChange: (open) => {
|
|
1883
|
-
if (!open && onClose != null) {
|
|
1884
|
-
onClose({ reason: "outside-click" });
|
|
1885
|
-
}
|
|
1886
|
-
},
|
|
1887
|
-
placement,
|
|
1888
|
-
middleware: [offset2(offsetValue)],
|
|
1889
|
-
whileElementsMounted: autoUpdate2,
|
|
1890
|
-
strategy: "fixed"
|
|
1891
|
-
});
|
|
1892
|
-
useEffect4(() => {
|
|
1893
|
-
if (anchorRef?.current) {
|
|
1894
|
-
floating.refs.setReference(anchorRef.current);
|
|
1895
|
-
}
|
|
1896
|
-
}, [anchorRef, floating.refs]);
|
|
1897
|
-
const contentId = useFloatingId() ?? "";
|
|
1898
|
-
const panelId = `${contentId}-panel`;
|
|
1899
|
-
const contextValue = useMemo2(
|
|
1900
|
-
() => ({
|
|
1901
|
-
isOpen,
|
|
1902
|
-
triggerRef,
|
|
1903
|
-
anchorRef,
|
|
1904
|
-
floating,
|
|
1905
|
-
contentId,
|
|
1906
|
-
panelId,
|
|
1907
|
-
onClose
|
|
1908
|
-
}),
|
|
1909
|
-
[isOpen, triggerRef, anchorRef, floating, contentId, panelId, onClose]
|
|
1910
|
-
);
|
|
1911
|
-
return /* @__PURE__ */ jsx31(PopoverContext.Provider, { value: contextValue, children });
|
|
1912
|
-
}
|
|
1913
|
-
Popover.Trigger = PopoverTrigger;
|
|
1914
|
-
Popover.Content = PopoverContent;
|
|
1915
|
-
|
|
1916
2373
|
// src/popup/popup.tsx
|
|
1917
|
-
import { useContext as
|
|
2374
|
+
import { useContext as useContext11 } from "react";
|
|
1918
2375
|
|
|
1919
2376
|
// src/popup/popup-body.tsx
|
|
1920
|
-
import { jsx as
|
|
2377
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1921
2378
|
function PopupBody({ children }) {
|
|
1922
|
-
return /* @__PURE__ */
|
|
2379
|
+
return /* @__PURE__ */ jsx37("div", { className: "overflow-y-auto", children });
|
|
1923
2380
|
}
|
|
1924
2381
|
|
|
1925
2382
|
// src/popup/popup-context.ts
|
|
1926
|
-
import { createContext as
|
|
1927
|
-
var PopupContext =
|
|
2383
|
+
import { createContext as createContext8 } from "react";
|
|
2384
|
+
var PopupContext = createContext8({
|
|
1928
2385
|
isOpen: false,
|
|
1929
2386
|
onClose: () => null
|
|
1930
2387
|
});
|
|
1931
2388
|
|
|
1932
2389
|
// src/popup/popup-footer.tsx
|
|
1933
|
-
import { jsx as
|
|
2390
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
1934
2391
|
function PopupFooter({ children }) {
|
|
1935
|
-
return /* @__PURE__ */
|
|
2392
|
+
return /* @__PURE__ */ jsx38("div", { className: "flex w-full shrink-0 items-center rounded-b-lg px-6 py-3", children });
|
|
1936
2393
|
}
|
|
1937
2394
|
|
|
1938
2395
|
// src/popup/popup-header.tsx
|
|
1939
|
-
import { useContext as
|
|
1940
|
-
import { jsx as
|
|
2396
|
+
import { useContext as useContext10 } from "react";
|
|
2397
|
+
import { jsx as jsx39, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1941
2398
|
function PopupHeader({ children, before }) {
|
|
1942
|
-
const { onClose } =
|
|
1943
|
-
return /* @__PURE__ */
|
|
1944
|
-
/* @__PURE__ */
|
|
2399
|
+
const { onClose } = useContext10(PopupContext);
|
|
2400
|
+
return /* @__PURE__ */ jsxs18("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: [
|
|
2401
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
|
|
1945
2402
|
before,
|
|
1946
2403
|
children
|
|
1947
2404
|
] }),
|
|
1948
|
-
onClose && /* @__PURE__ */
|
|
2405
|
+
onClose && /* @__PURE__ */ jsx39(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
1949
2406
|
] });
|
|
1950
2407
|
}
|
|
1951
2408
|
|
|
1952
2409
|
// src/popup/popup.tsx
|
|
1953
|
-
import { jsx as
|
|
2410
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
1954
2411
|
var LIMIT_WIDTH2 = 320;
|
|
1955
2412
|
var LIMIT_HEIGHT2 = 184;
|
|
1956
2413
|
function useOptionalPopoverContext() {
|
|
1957
|
-
return
|
|
2414
|
+
return useContext11(PopoverContext);
|
|
1958
2415
|
}
|
|
1959
2416
|
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
1960
2417
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
@@ -1965,7 +2422,7 @@ function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClos
|
|
|
1965
2422
|
if (!isOpen) {
|
|
1966
2423
|
return null;
|
|
1967
2424
|
}
|
|
1968
|
-
return /* @__PURE__ */
|
|
2425
|
+
return /* @__PURE__ */ jsx40(PopupContext.Provider, { value: { isOpen, onClose }, children: /* @__PURE__ */ jsx40(
|
|
1969
2426
|
"div",
|
|
1970
2427
|
{
|
|
1971
2428
|
className: "grid max-h-full grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-floatingShadow",
|
|
@@ -1979,29 +2436,29 @@ Popup.Header = PopupHeader;
|
|
|
1979
2436
|
Popup.Footer = PopupFooter;
|
|
1980
2437
|
|
|
1981
2438
|
// src/radio/radio.tsx
|
|
1982
|
-
import { focusVisible as
|
|
1983
|
-
import
|
|
1984
|
-
import { useCallback as
|
|
1985
|
-
import { jsx as
|
|
2439
|
+
import { focusVisible as focusVisible11 } from "@zenkigen-inc/component-theme";
|
|
2440
|
+
import clsx28 from "clsx";
|
|
2441
|
+
import { useCallback as useCallback8, useState as useState10 } from "react";
|
|
2442
|
+
import { jsx as jsx41, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1986
2443
|
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1987
|
-
const [isMouseOver, setIsMouseOver] =
|
|
1988
|
-
const handleMouseOverInput =
|
|
2444
|
+
const [isMouseOver, setIsMouseOver] = useState10(false);
|
|
2445
|
+
const handleMouseOverInput = useCallback8(() => {
|
|
1989
2446
|
setIsMouseOver(true);
|
|
1990
2447
|
}, []);
|
|
1991
|
-
const handleMouseOutInput =
|
|
2448
|
+
const handleMouseOutInput = useCallback8(() => {
|
|
1992
2449
|
setIsMouseOver(false);
|
|
1993
2450
|
}, []);
|
|
1994
|
-
const handleChange =
|
|
2451
|
+
const handleChange = useCallback8(
|
|
1995
2452
|
(e) => !isDisabled && onChange?.(e),
|
|
1996
2453
|
[isDisabled, onChange]
|
|
1997
2454
|
);
|
|
1998
|
-
const inputClasses =
|
|
2455
|
+
const inputClasses = clsx28("peer absolute z-[1] size-6 opacity-0", {
|
|
1999
2456
|
"cursor-not-allowed": isDisabled,
|
|
2000
2457
|
"cursor-pointer": !isDisabled
|
|
2001
2458
|
});
|
|
2002
|
-
const boxClasses =
|
|
2459
|
+
const boxClasses = clsx28(
|
|
2003
2460
|
"inline-flex size-5 items-center justify-center rounded-full border border-solid bg-white",
|
|
2004
|
-
|
|
2461
|
+
focusVisible11.normalPeer,
|
|
2005
2462
|
{
|
|
2006
2463
|
"border-disabled01 hover:border-disabled01": isDisabled && !isMouseOver,
|
|
2007
2464
|
"border-hoverUiBorder": !isDisabled && isMouseOver,
|
|
@@ -2010,22 +2467,22 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
2010
2467
|
"cursor-pointer": !isDisabled
|
|
2011
2468
|
}
|
|
2012
2469
|
);
|
|
2013
|
-
const afterClasses =
|
|
2470
|
+
const afterClasses = clsx28("absolute inset-0 m-auto block size-3 rounded-full", {
|
|
2014
2471
|
"bg-disabled01": isDisabled && isChecked,
|
|
2015
2472
|
"bg-activeSelectedUi": !isDisabled && isChecked,
|
|
2016
2473
|
"scale-0": !isChecked,
|
|
2017
2474
|
"scale-100": isChecked
|
|
2018
2475
|
});
|
|
2019
|
-
const hoverIndicatorClasses =
|
|
2476
|
+
const hoverIndicatorClasses = clsx28("inline-block size-3 rounded-full", {
|
|
2020
2477
|
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
2021
2478
|
});
|
|
2022
|
-
const labelClasses =
|
|
2479
|
+
const labelClasses = clsx28("typography-label14regular ml-2 flex-[1_0_0] select-none break-all", {
|
|
2023
2480
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
2024
2481
|
"cursor-pointer text-text01": !isDisabled
|
|
2025
2482
|
});
|
|
2026
|
-
return /* @__PURE__ */
|
|
2027
|
-
/* @__PURE__ */
|
|
2028
|
-
/* @__PURE__ */
|
|
2483
|
+
return /* @__PURE__ */ jsxs19("div", { className: "flex items-center", children: [
|
|
2484
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex size-6 items-center justify-center", children: [
|
|
2485
|
+
/* @__PURE__ */ jsx41(
|
|
2029
2486
|
"input",
|
|
2030
2487
|
{
|
|
2031
2488
|
type: "checkbox",
|
|
@@ -2040,32 +2497,32 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
2040
2497
|
className: inputClasses
|
|
2041
2498
|
}
|
|
2042
2499
|
),
|
|
2043
|
-
/* @__PURE__ */
|
|
2044
|
-
/* @__PURE__ */
|
|
2045
|
-
/* @__PURE__ */
|
|
2500
|
+
/* @__PURE__ */ jsx41("div", { className: boxClasses, children: /* @__PURE__ */ jsxs19("div", { className: "relative flex size-5 flex-[0_0_auto] items-center justify-center", children: [
|
|
2501
|
+
/* @__PURE__ */ jsx41("span", { className: afterClasses }),
|
|
2502
|
+
/* @__PURE__ */ jsx41("span", { className: hoverIndicatorClasses })
|
|
2046
2503
|
] }) })
|
|
2047
2504
|
] }),
|
|
2048
|
-
/* @__PURE__ */
|
|
2505
|
+
/* @__PURE__ */ jsx41("label", { htmlFor: id, className: labelClasses, children: label })
|
|
2049
2506
|
] });
|
|
2050
2507
|
}
|
|
2051
2508
|
|
|
2052
2509
|
// src/search/search.tsx
|
|
2053
|
-
import { clsx as
|
|
2054
|
-
import { forwardRef as
|
|
2055
|
-
import { jsx as
|
|
2056
|
-
var Search =
|
|
2057
|
-
const classes =
|
|
2510
|
+
import { clsx as clsx29 } from "clsx";
|
|
2511
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
2512
|
+
import { jsx as jsx42, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2513
|
+
var Search = forwardRef10(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
2514
|
+
const classes = clsx29(
|
|
2058
2515
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
2059
2516
|
{ "h-8 px-3": size === "medium" },
|
|
2060
2517
|
{ "h-10 px-4": size === "large" }
|
|
2061
2518
|
);
|
|
2062
|
-
const inputClasses =
|
|
2519
|
+
const inputClasses = clsx29("mx-2 h-full flex-1 text-text01 outline-0 placeholder:text-textPlaceholder", {
|
|
2063
2520
|
["typography-label14regular"]: size === "medium",
|
|
2064
2521
|
["typography-label16regular"]: size === "large"
|
|
2065
2522
|
});
|
|
2066
|
-
return /* @__PURE__ */
|
|
2067
|
-
/* @__PURE__ */
|
|
2068
|
-
/* @__PURE__ */
|
|
2523
|
+
return /* @__PURE__ */ jsx42("div", { className: "relative", ref, children: /* @__PURE__ */ jsx42("form", { onSubmit: props.onSubmit, children: /* @__PURE__ */ jsxs20("div", { className: classes, style: { width }, children: [
|
|
2524
|
+
/* @__PURE__ */ jsx42(Icon, { name: "search", color: "icon01", size: "medium" }),
|
|
2525
|
+
/* @__PURE__ */ jsx42(
|
|
2069
2526
|
"input",
|
|
2070
2527
|
{
|
|
2071
2528
|
type: "text",
|
|
@@ -2076,7 +2533,7 @@ var Search = forwardRef9(({ width = "100%", size = "medium", ...props }, ref) =>
|
|
|
2076
2533
|
onChange: props.onChange
|
|
2077
2534
|
}
|
|
2078
2535
|
),
|
|
2079
|
-
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */
|
|
2536
|
+
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ jsx42(
|
|
2080
2537
|
IconButton,
|
|
2081
2538
|
{
|
|
2082
2539
|
variant: "text",
|
|
@@ -2091,17 +2548,17 @@ var Search = forwardRef9(({ width = "100%", size = "medium", ...props }, ref) =>
|
|
|
2091
2548
|
Search.displayName = "Search";
|
|
2092
2549
|
|
|
2093
2550
|
// src/segmented-control/segmented-control.tsx
|
|
2094
|
-
import React4, { Children as
|
|
2551
|
+
import React4, { Children as Children3, useRef as useRef8 } from "react";
|
|
2095
2552
|
|
|
2096
2553
|
// src/segmented-control/segmented-control-context.ts
|
|
2097
|
-
import { createContext as
|
|
2098
|
-
var SegmentedControlContext =
|
|
2554
|
+
import { createContext as createContext9 } from "react";
|
|
2555
|
+
var SegmentedControlContext = createContext9(null);
|
|
2099
2556
|
|
|
2100
2557
|
// src/segmented-control/segmented-control-item.tsx
|
|
2101
|
-
import { focusVisible as
|
|
2102
|
-
import { clsx as
|
|
2103
|
-
import { useContext as
|
|
2104
|
-
import { jsx as
|
|
2558
|
+
import { focusVisible as focusVisible12 } from "@zenkigen-inc/component-theme";
|
|
2559
|
+
import { clsx as clsx30 } from "clsx";
|
|
2560
|
+
import { useContext as useContext12, useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
2561
|
+
import { jsx as jsx43, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2105
2562
|
var SegmentedControlItem = ({
|
|
2106
2563
|
label,
|
|
2107
2564
|
value,
|
|
@@ -2110,9 +2567,9 @@ var SegmentedControlItem = ({
|
|
|
2110
2567
|
"aria-label": ariaLabel,
|
|
2111
2568
|
...rest
|
|
2112
2569
|
}) => {
|
|
2113
|
-
const context =
|
|
2114
|
-
const buttonRef =
|
|
2115
|
-
const lastInteractionWasMouse =
|
|
2570
|
+
const context = useContext12(SegmentedControlContext);
|
|
2571
|
+
const buttonRef = useRef7(null);
|
|
2572
|
+
const lastInteractionWasMouse = useRef7(false);
|
|
2116
2573
|
if (context === null) {
|
|
2117
2574
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
2118
2575
|
}
|
|
@@ -2128,7 +2585,7 @@ var SegmentedControlItem = ({
|
|
|
2128
2585
|
const isSelected = value === selectedValue;
|
|
2129
2586
|
const isFocused = value === focusedValue;
|
|
2130
2587
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
2131
|
-
|
|
2588
|
+
useEffect6(() => {
|
|
2132
2589
|
if (isFocused === true && buttonRef.current !== null) {
|
|
2133
2590
|
buttonRef.current.focus();
|
|
2134
2591
|
}
|
|
@@ -2150,7 +2607,7 @@ var SegmentedControlItem = ({
|
|
|
2150
2607
|
lastInteractionWasMouse.current = false;
|
|
2151
2608
|
onBlur?.();
|
|
2152
2609
|
};
|
|
2153
|
-
const buttonClasses =
|
|
2610
|
+
const buttonClasses = clsx30("relative flex items-center justify-center gap-1 rounded", focusVisible12.normal, {
|
|
2154
2611
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
2155
2612
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
2156
2613
|
// States - Default with hover
|
|
@@ -2160,7 +2617,7 @@ var SegmentedControlItem = ({
|
|
|
2160
2617
|
// States - Disabled
|
|
2161
2618
|
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
2162
2619
|
});
|
|
2163
|
-
return /* @__PURE__ */
|
|
2620
|
+
return /* @__PURE__ */ jsxs21(
|
|
2164
2621
|
"button",
|
|
2165
2622
|
{
|
|
2166
2623
|
ref: buttonRef,
|
|
@@ -2177,25 +2634,25 @@ var SegmentedControlItem = ({
|
|
|
2177
2634
|
onMouseDown: handleMouseDown,
|
|
2178
2635
|
...rest,
|
|
2179
2636
|
children: [
|
|
2180
|
-
Boolean(icon) === true && icon && /* @__PURE__ */
|
|
2637
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ jsx43(
|
|
2181
2638
|
"span",
|
|
2182
2639
|
{
|
|
2183
|
-
className:
|
|
2640
|
+
className: clsx30("flex items-center", {
|
|
2184
2641
|
"fill-disabled01": isOptionDisabled === true,
|
|
2185
2642
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
2186
2643
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
2187
2644
|
}),
|
|
2188
|
-
children: /* @__PURE__ */
|
|
2645
|
+
children: /* @__PURE__ */ jsx43(Icon, { name: icon, size: "small" })
|
|
2189
2646
|
}
|
|
2190
2647
|
),
|
|
2191
|
-
Boolean(label) === true && /* @__PURE__ */
|
|
2648
|
+
Boolean(label) === true && /* @__PURE__ */ jsx43("span", { className: "whitespace-nowrap", children: label })
|
|
2192
2649
|
]
|
|
2193
2650
|
}
|
|
2194
2651
|
);
|
|
2195
2652
|
};
|
|
2196
2653
|
|
|
2197
2654
|
// src/segmented-control/segmented-control.tsx
|
|
2198
|
-
import { Fragment as Fragment5, jsx as
|
|
2655
|
+
import { Fragment as Fragment5, jsx as jsx44 } from "react/jsx-runtime";
|
|
2199
2656
|
var SegmentedControl = ({
|
|
2200
2657
|
children,
|
|
2201
2658
|
value,
|
|
@@ -2205,15 +2662,15 @@ var SegmentedControl = ({
|
|
|
2205
2662
|
"aria-label": ariaLabel,
|
|
2206
2663
|
...rest
|
|
2207
2664
|
}) => {
|
|
2208
|
-
const containerRef =
|
|
2209
|
-
const itemIds =
|
|
2665
|
+
const containerRef = useRef8(null);
|
|
2666
|
+
const itemIds = Children3.toArray(children).filter((child) => {
|
|
2210
2667
|
if (!React4.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
2211
2668
|
return false;
|
|
2212
2669
|
}
|
|
2213
2670
|
const props = child.props;
|
|
2214
2671
|
return props.isDisabled !== true;
|
|
2215
2672
|
}).map((child) => child.props.value);
|
|
2216
|
-
const childrenCount =
|
|
2673
|
+
const childrenCount = Children3.count(children);
|
|
2217
2674
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
2218
2675
|
const {
|
|
2219
2676
|
focusedValue,
|
|
@@ -2240,7 +2697,7 @@ var SegmentedControl = ({
|
|
|
2240
2697
|
onBlur: handleBlurRovingFocus,
|
|
2241
2698
|
values: itemIds
|
|
2242
2699
|
};
|
|
2243
|
-
return /* @__PURE__ */
|
|
2700
|
+
return /* @__PURE__ */ jsx44(Fragment5, { children: /* @__PURE__ */ jsx44(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx44(
|
|
2244
2701
|
"div",
|
|
2245
2702
|
{
|
|
2246
2703
|
ref: containerRef,
|
|
@@ -2257,37 +2714,37 @@ var SegmentedControl = ({
|
|
|
2257
2714
|
SegmentedControl.Item = SegmentedControlItem;
|
|
2258
2715
|
|
|
2259
2716
|
// src/select-sort/select-sort.tsx
|
|
2260
|
-
import { buttonColors as buttonColors4, focusVisible as
|
|
2261
|
-
import
|
|
2262
|
-
import { useCallback as
|
|
2717
|
+
import { buttonColors as buttonColors4, focusVisible as focusVisible15 } from "@zenkigen-inc/component-theme";
|
|
2718
|
+
import clsx33 from "clsx";
|
|
2719
|
+
import { useCallback as useCallback9, useRef as useRef9, useState as useState11 } from "react";
|
|
2263
2720
|
|
|
2264
2721
|
// src/select-sort/select-list.tsx
|
|
2265
|
-
import { focusVisible as
|
|
2266
|
-
import
|
|
2722
|
+
import { focusVisible as focusVisible14 } from "@zenkigen-inc/component-theme";
|
|
2723
|
+
import clsx32 from "clsx";
|
|
2267
2724
|
|
|
2268
2725
|
// src/select-sort/select-item.tsx
|
|
2269
|
-
import { focusVisible as
|
|
2270
|
-
import
|
|
2271
|
-
import { jsx as
|
|
2726
|
+
import { focusVisible as focusVisible13 } from "@zenkigen-inc/component-theme";
|
|
2727
|
+
import clsx31 from "clsx";
|
|
2728
|
+
import { jsx as jsx45, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2272
2729
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
2273
|
-
const itemClasses =
|
|
2730
|
+
const itemClasses = clsx31(
|
|
2274
2731
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
2275
|
-
|
|
2732
|
+
focusVisible13.inset,
|
|
2276
2733
|
{
|
|
2277
2734
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
2278
2735
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
2279
2736
|
}
|
|
2280
2737
|
);
|
|
2281
|
-
return /* @__PURE__ */
|
|
2282
|
-
/* @__PURE__ */
|
|
2283
|
-
isSortKey && /* @__PURE__ */
|
|
2738
|
+
return /* @__PURE__ */ jsx45("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ jsxs22("button", { className: itemClasses, type: "button", children: [
|
|
2739
|
+
/* @__PURE__ */ jsx45("span", { className: "ml-1 mr-6", children }),
|
|
2740
|
+
isSortKey && /* @__PURE__ */ jsx45("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx45(Icon, { name: "check", size: "small" }) })
|
|
2284
2741
|
] }) });
|
|
2285
2742
|
}
|
|
2286
2743
|
|
|
2287
2744
|
// src/select-sort/select-list.tsx
|
|
2288
|
-
import { jsx as
|
|
2745
|
+
import { jsx as jsx46, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2289
2746
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
2290
|
-
const listClasses =
|
|
2747
|
+
const listClasses = clsx32(
|
|
2291
2748
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
2292
2749
|
{
|
|
2293
2750
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -2296,19 +2753,19 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
2296
2753
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
2297
2754
|
}
|
|
2298
2755
|
);
|
|
2299
|
-
const deselectButtonClasses =
|
|
2756
|
+
const deselectButtonClasses = clsx32(
|
|
2300
2757
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
2301
|
-
|
|
2758
|
+
focusVisible14.inset
|
|
2302
2759
|
);
|
|
2303
|
-
return /* @__PURE__ */
|
|
2304
|
-
/* @__PURE__ */
|
|
2305
|
-
/* @__PURE__ */
|
|
2306
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */
|
|
2760
|
+
return /* @__PURE__ */ jsxs23("ul", { className: listClasses, children: [
|
|
2761
|
+
/* @__PURE__ */ jsx46(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
2762
|
+
/* @__PURE__ */ jsx46(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
2763
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ jsx46("li", { children: /* @__PURE__ */ jsx46("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
2307
2764
|
] });
|
|
2308
2765
|
}
|
|
2309
2766
|
|
|
2310
2767
|
// src/select-sort/select-sort.tsx
|
|
2311
|
-
import { jsx as
|
|
2768
|
+
import { jsx as jsx47, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
2312
2769
|
function SelectSort({
|
|
2313
2770
|
size = "medium",
|
|
2314
2771
|
variant = "outline",
|
|
@@ -2320,29 +2777,29 @@ function SelectSort({
|
|
|
2320
2777
|
onChange,
|
|
2321
2778
|
onClickDeselect
|
|
2322
2779
|
}) {
|
|
2323
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
2324
|
-
const targetRef =
|
|
2780
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState11(false);
|
|
2781
|
+
const targetRef = useRef9(null);
|
|
2325
2782
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
2326
2783
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
2327
|
-
const handleClickItem =
|
|
2784
|
+
const handleClickItem = useCallback9(
|
|
2328
2785
|
(value) => {
|
|
2329
2786
|
onChange?.(value);
|
|
2330
2787
|
setIsOptionListOpen(false);
|
|
2331
2788
|
},
|
|
2332
2789
|
[onChange]
|
|
2333
2790
|
);
|
|
2334
|
-
const wrapperClasses =
|
|
2791
|
+
const wrapperClasses = clsx33("relative flex shrink-0 items-center gap-1 rounded", {
|
|
2335
2792
|
"h-6": size === "x-small" || size === "small",
|
|
2336
2793
|
"h-8": size === "medium",
|
|
2337
2794
|
"h-10": size === "large",
|
|
2338
2795
|
"cursor-not-allowed": isDisabled
|
|
2339
2796
|
});
|
|
2340
|
-
const buttonClasses =
|
|
2797
|
+
const buttonClasses = clsx33(
|
|
2341
2798
|
"flex size-full items-center rounded",
|
|
2342
2799
|
buttonColors4[variant].hover,
|
|
2343
2800
|
buttonColors4[variant].active,
|
|
2344
2801
|
buttonColors4[variant].disabled,
|
|
2345
|
-
|
|
2802
|
+
focusVisible15.normal,
|
|
2346
2803
|
{
|
|
2347
2804
|
[buttonColors4[variant].selected]: isSortKey,
|
|
2348
2805
|
[buttonColors4[variant].base]: !isSortKey,
|
|
@@ -2351,23 +2808,23 @@ function SelectSort({
|
|
|
2351
2808
|
"pointer-events-none": isDisabled
|
|
2352
2809
|
}
|
|
2353
2810
|
);
|
|
2354
|
-
const labelClasses =
|
|
2811
|
+
const labelClasses = clsx33("truncate", {
|
|
2355
2812
|
"typography-label12regular": size === "x-small",
|
|
2356
2813
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2357
2814
|
"typography-label16regular": size === "large",
|
|
2358
2815
|
"mr-1": size === "x-small",
|
|
2359
2816
|
"mr-2": size !== "x-small"
|
|
2360
2817
|
});
|
|
2361
|
-
return /* @__PURE__ */
|
|
2362
|
-
/* @__PURE__ */
|
|
2363
|
-
/* @__PURE__ */
|
|
2364
|
-
/* @__PURE__ */
|
|
2818
|
+
return /* @__PURE__ */ jsxs24("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
2819
|
+
/* @__PURE__ */ jsxs24("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
2820
|
+
/* @__PURE__ */ jsx47("div", { className: labelClasses, children: label }),
|
|
2821
|
+
/* @__PURE__ */ jsx47("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ jsx47(
|
|
2365
2822
|
Icon,
|
|
2366
2823
|
{
|
|
2367
2824
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
2368
2825
|
size: size === "large" ? "medium" : "small"
|
|
2369
2826
|
}
|
|
2370
|
-
) : /* @__PURE__ */
|
|
2827
|
+
) : /* @__PURE__ */ jsx47(
|
|
2371
2828
|
Icon,
|
|
2372
2829
|
{
|
|
2373
2830
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -2375,7 +2832,7 @@ function SelectSort({
|
|
|
2375
2832
|
}
|
|
2376
2833
|
) })
|
|
2377
2834
|
] }),
|
|
2378
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */
|
|
2835
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx47(
|
|
2379
2836
|
SelectList2,
|
|
2380
2837
|
{
|
|
2381
2838
|
size,
|
|
@@ -2389,10 +2846,10 @@ function SelectSort({
|
|
|
2389
2846
|
}
|
|
2390
2847
|
|
|
2391
2848
|
// src/sort-button/sort-button.tsx
|
|
2392
|
-
import { buttonColors as buttonColors5, focusVisible as
|
|
2393
|
-
import
|
|
2394
|
-
import { useCallback as
|
|
2395
|
-
import { jsx as
|
|
2849
|
+
import { buttonColors as buttonColors5, focusVisible as focusVisible16 } from "@zenkigen-inc/component-theme";
|
|
2850
|
+
import clsx34 from "clsx";
|
|
2851
|
+
import { useCallback as useCallback10 } from "react";
|
|
2852
|
+
import { jsx as jsx48, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2396
2853
|
function SortButton({
|
|
2397
2854
|
size = "medium",
|
|
2398
2855
|
width,
|
|
@@ -2403,7 +2860,7 @@ function SortButton({
|
|
|
2403
2860
|
"aria-label": ariaLabel,
|
|
2404
2861
|
...rest
|
|
2405
2862
|
}) {
|
|
2406
|
-
const handleClick =
|
|
2863
|
+
const handleClick = useCallback10(() => {
|
|
2407
2864
|
if (isDisabled || !onClick) return;
|
|
2408
2865
|
onClick();
|
|
2409
2866
|
}, [isDisabled, onClick]);
|
|
@@ -2412,18 +2869,18 @@ function SortButton({
|
|
|
2412
2869
|
if (sortOrder === "descend") return "arrow-down";
|
|
2413
2870
|
return "angle-small-down";
|
|
2414
2871
|
};
|
|
2415
|
-
const wrapperClasses =
|
|
2872
|
+
const wrapperClasses = clsx34("relative flex shrink-0 items-center gap-1 rounded", {
|
|
2416
2873
|
"h-6": size === "x-small" || size === "small",
|
|
2417
2874
|
"h-8": size === "medium",
|
|
2418
2875
|
"h-10": size === "large",
|
|
2419
2876
|
"cursor-not-allowed": isDisabled
|
|
2420
2877
|
});
|
|
2421
|
-
const buttonClasses =
|
|
2878
|
+
const buttonClasses = clsx34(
|
|
2422
2879
|
"flex size-full items-center rounded",
|
|
2423
2880
|
buttonColors5.text.hover,
|
|
2424
2881
|
buttonColors5.text.active,
|
|
2425
2882
|
buttonColors5.text.disabled,
|
|
2426
|
-
|
|
2883
|
+
focusVisible16.normal,
|
|
2427
2884
|
{
|
|
2428
2885
|
[buttonColors5.text.selected]: !isDisabled && sortOrder !== null,
|
|
2429
2886
|
// ソート状態時は選択状態のスタイル
|
|
@@ -2434,14 +2891,14 @@ function SortButton({
|
|
|
2434
2891
|
"pointer-events-none": isDisabled
|
|
2435
2892
|
}
|
|
2436
2893
|
);
|
|
2437
|
-
const labelClasses =
|
|
2894
|
+
const labelClasses = clsx34("truncate", {
|
|
2438
2895
|
"typography-label12regular": size === "x-small",
|
|
2439
2896
|
"typography-label14regular": size === "small" || size === "medium",
|
|
2440
2897
|
"typography-label16regular": size === "large",
|
|
2441
2898
|
"mr-1": size === "x-small",
|
|
2442
2899
|
"mr-2": size !== "x-small"
|
|
2443
2900
|
});
|
|
2444
|
-
return /* @__PURE__ */
|
|
2901
|
+
return /* @__PURE__ */ jsx48("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ jsxs25(
|
|
2445
2902
|
"button",
|
|
2446
2903
|
{
|
|
2447
2904
|
className: buttonClasses,
|
|
@@ -2452,22 +2909,22 @@ function SortButton({
|
|
|
2452
2909
|
"aria-label": ariaLabel,
|
|
2453
2910
|
"aria-disabled": isDisabled,
|
|
2454
2911
|
children: [
|
|
2455
|
-
/* @__PURE__ */
|
|
2456
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ jsx48("div", { className: labelClasses, children: label }),
|
|
2913
|
+
/* @__PURE__ */ jsx48("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx48(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
2457
2914
|
]
|
|
2458
2915
|
}
|
|
2459
2916
|
) });
|
|
2460
2917
|
}
|
|
2461
2918
|
|
|
2462
2919
|
// src/tab/tab.tsx
|
|
2463
|
-
import { clsx as
|
|
2464
|
-
import { Children as
|
|
2920
|
+
import { clsx as clsx36 } from "clsx";
|
|
2921
|
+
import { Children as Children4 } from "react";
|
|
2465
2922
|
|
|
2466
2923
|
// src/tab/tab-item.tsx
|
|
2467
|
-
import { clsx as
|
|
2468
|
-
import { jsx as
|
|
2924
|
+
import { clsx as clsx35 } from "clsx";
|
|
2925
|
+
import { jsx as jsx49, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
2469
2926
|
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
2470
|
-
const classes =
|
|
2927
|
+
const classes = clsx35(
|
|
2471
2928
|
"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",
|
|
2472
2929
|
{
|
|
2473
2930
|
"typography-label14regular text-interactive02": !isSelected,
|
|
@@ -2475,12 +2932,12 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
2475
2932
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
2476
2933
|
}
|
|
2477
2934
|
);
|
|
2478
|
-
const iconWrapperClasses =
|
|
2935
|
+
const iconWrapperClasses = clsx35("flex shrink-0 items-center", {
|
|
2479
2936
|
"fill-disabled01": isDisabled,
|
|
2480
2937
|
"fill-interactive01": !isDisabled && isSelected,
|
|
2481
2938
|
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
2482
2939
|
});
|
|
2483
|
-
return /* @__PURE__ */
|
|
2940
|
+
return /* @__PURE__ */ jsxs26(
|
|
2484
2941
|
"button",
|
|
2485
2942
|
{
|
|
2486
2943
|
type: "button",
|
|
@@ -2490,7 +2947,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
2490
2947
|
disabled: isDisabled,
|
|
2491
2948
|
onClick: () => props.onClick(props.id),
|
|
2492
2949
|
children: [
|
|
2493
|
-
icon != null && /* @__PURE__ */
|
|
2950
|
+
icon != null && /* @__PURE__ */ jsx49("span", { className: iconWrapperClasses, children: /* @__PURE__ */ jsx49(Icon, { name: icon, size: "small" }) }),
|
|
2494
2951
|
props.children
|
|
2495
2952
|
]
|
|
2496
2953
|
}
|
|
@@ -2498,39 +2955,39 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
2498
2955
|
};
|
|
2499
2956
|
|
|
2500
2957
|
// src/tab/tab.tsx
|
|
2501
|
-
import { jsx as
|
|
2958
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
2502
2959
|
function Tab({ children, layout = "auto" }) {
|
|
2503
|
-
const childrenCount =
|
|
2960
|
+
const childrenCount = Children4.count(children);
|
|
2504
2961
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
2505
|
-
const containerClasses =
|
|
2962
|
+
const containerClasses = clsx36(
|
|
2506
2963
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
2507
2964
|
{
|
|
2508
2965
|
flex: layout === "auto",
|
|
2509
2966
|
grid: layout === "equal"
|
|
2510
2967
|
}
|
|
2511
2968
|
);
|
|
2512
|
-
return /* @__PURE__ */
|
|
2969
|
+
return /* @__PURE__ */ jsx50("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
2513
2970
|
}
|
|
2514
2971
|
Tab.Item = TabItem;
|
|
2515
2972
|
|
|
2516
2973
|
// src/table/table-cell.tsx
|
|
2517
|
-
import
|
|
2518
|
-
import { jsx as
|
|
2974
|
+
import clsx37 from "clsx";
|
|
2975
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
2519
2976
|
function TableCell({ children, className, isHeader = false }) {
|
|
2520
|
-
const classes =
|
|
2521
|
-
return /* @__PURE__ */
|
|
2977
|
+
const classes = clsx37("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
2978
|
+
return /* @__PURE__ */ jsx51("div", { className: classes, children });
|
|
2522
2979
|
}
|
|
2523
2980
|
|
|
2524
2981
|
// src/table/table-row.tsx
|
|
2525
|
-
import
|
|
2526
|
-
import { jsx as
|
|
2982
|
+
import clsx38 from "clsx";
|
|
2983
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
2527
2984
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
2528
|
-
const rowClasses =
|
|
2529
|
-
return /* @__PURE__ */
|
|
2985
|
+
const rowClasses = clsx38("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
2986
|
+
return /* @__PURE__ */ jsx52("div", { className: rowClasses, children });
|
|
2530
2987
|
}
|
|
2531
2988
|
|
|
2532
2989
|
// src/table/table.tsx
|
|
2533
|
-
import { jsx as
|
|
2990
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
2534
2991
|
function Table({
|
|
2535
2992
|
width,
|
|
2536
2993
|
templateRows,
|
|
@@ -2539,7 +2996,7 @@ function Table({
|
|
|
2539
2996
|
autoRows,
|
|
2540
2997
|
children
|
|
2541
2998
|
}) {
|
|
2542
|
-
return /* @__PURE__ */
|
|
2999
|
+
return /* @__PURE__ */ jsx53(
|
|
2543
3000
|
"div",
|
|
2544
3001
|
{
|
|
2545
3002
|
className: "grid",
|
|
@@ -2559,22 +3016,22 @@ Table.Cell = TableCell;
|
|
|
2559
3016
|
|
|
2560
3017
|
// src/tag/tag.tsx
|
|
2561
3018
|
import { tagColors, tagLightColors } from "@zenkigen-inc/component-theme";
|
|
2562
|
-
import
|
|
3019
|
+
import clsx40 from "clsx";
|
|
2563
3020
|
|
|
2564
3021
|
// src/tag/delete-icon.tsx
|
|
2565
|
-
import { focusVisible as
|
|
2566
|
-
import
|
|
2567
|
-
import { jsx as
|
|
3022
|
+
import { focusVisible as focusVisible17 } from "@zenkigen-inc/component-theme";
|
|
3023
|
+
import clsx39 from "clsx";
|
|
3024
|
+
import { jsx as jsx54 } from "react/jsx-runtime";
|
|
2568
3025
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
2569
|
-
const deleteButtonClasses =
|
|
3026
|
+
const deleteButtonClasses = clsx39(
|
|
2570
3027
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
2571
|
-
|
|
3028
|
+
focusVisible17.normal
|
|
2572
3029
|
);
|
|
2573
|
-
const deletePathClasses =
|
|
3030
|
+
const deletePathClasses = clsx39({
|
|
2574
3031
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
2575
3032
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
2576
3033
|
});
|
|
2577
|
-
return /* @__PURE__ */
|
|
3034
|
+
return /* @__PURE__ */ jsx54("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ jsx54("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx54(
|
|
2578
3035
|
"path",
|
|
2579
3036
|
{
|
|
2580
3037
|
fillRule: "evenodd",
|
|
@@ -2586,9 +3043,9 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
2586
3043
|
};
|
|
2587
3044
|
|
|
2588
3045
|
// src/tag/tag.tsx
|
|
2589
|
-
import { jsx as
|
|
3046
|
+
import { jsx as jsx55, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
2590
3047
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
2591
|
-
const wrapperClasses =
|
|
3048
|
+
const wrapperClasses = clsx40("flex", "items-center", "justify-center", {
|
|
2592
3049
|
[tagColors[color]]: variant === "normal",
|
|
2593
3050
|
[tagLightColors[color]]: variant === "light",
|
|
2594
3051
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
@@ -2600,21 +3057,21 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
2600
3057
|
"py-0.5 px-1": !isEditable,
|
|
2601
3058
|
"py-1 px-2": isEditable
|
|
2602
3059
|
});
|
|
2603
|
-
return /* @__PURE__ */
|
|
3060
|
+
return /* @__PURE__ */ jsxs27("div", { className: wrapperClasses, children: [
|
|
2604
3061
|
children,
|
|
2605
|
-
isEditable ? /* @__PURE__ */
|
|
3062
|
+
isEditable ? /* @__PURE__ */ jsx55(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
2606
3063
|
] });
|
|
2607
3064
|
}
|
|
2608
3065
|
|
|
2609
3066
|
// src/text-area/text-area.tsx
|
|
2610
|
-
import { clsx as
|
|
2611
|
-
import { Children as
|
|
3067
|
+
import { clsx as clsx43 } from "clsx";
|
|
3068
|
+
import { Children as Children5, cloneElement as cloneElement5, forwardRef as forwardRef13, isValidElement as isValidElement3, useId as useId4, useMemo as useMemo4 } from "react";
|
|
2612
3069
|
|
|
2613
3070
|
// src/text-area/text-area-context.tsx
|
|
2614
|
-
import { createContext as
|
|
2615
|
-
var TextAreaCompoundContext =
|
|
3071
|
+
import { createContext as createContext10, useContext as useContext13 } from "react";
|
|
3072
|
+
var TextAreaCompoundContext = createContext10(null);
|
|
2616
3073
|
var useTextAreaCompoundContext = (componentName) => {
|
|
2617
|
-
const context =
|
|
3074
|
+
const context = useContext13(TextAreaCompoundContext);
|
|
2618
3075
|
if (context == null) {
|
|
2619
3076
|
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`);
|
|
2620
3077
|
}
|
|
@@ -2622,10 +3079,10 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
2622
3079
|
};
|
|
2623
3080
|
|
|
2624
3081
|
// src/text-area/text-area-error-message.tsx
|
|
2625
|
-
import { clsx as
|
|
2626
|
-
import { forwardRef as
|
|
2627
|
-
import { jsx as
|
|
2628
|
-
var TextAreaErrorMessage =
|
|
3082
|
+
import { clsx as clsx41 } from "clsx";
|
|
3083
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
3084
|
+
import { jsx as jsx56 } from "react/jsx-runtime";
|
|
3085
|
+
var TextAreaErrorMessage = forwardRef11(
|
|
2629
3086
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
2630
3087
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
2631
3088
|
const typographyClass = textAreaProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
@@ -2633,26 +3090,26 @@ var TextAreaErrorMessage = forwardRef10(
|
|
|
2633
3090
|
if (!shouldRender) {
|
|
2634
3091
|
return null;
|
|
2635
3092
|
}
|
|
2636
|
-
const errorMessageClassName =
|
|
2637
|
-
return /* @__PURE__ */
|
|
3093
|
+
const errorMessageClassName = clsx41(typographyClass, "text-supportError");
|
|
3094
|
+
return /* @__PURE__ */ jsx56("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
2638
3095
|
}
|
|
2639
3096
|
);
|
|
2640
3097
|
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
2641
3098
|
|
|
2642
3099
|
// src/text-area/text-area-helper-message.tsx
|
|
2643
|
-
import { clsx as
|
|
2644
|
-
import { forwardRef as
|
|
2645
|
-
import { jsx as
|
|
2646
|
-
var TextAreaHelperMessage =
|
|
3100
|
+
import { clsx as clsx42 } from "clsx";
|
|
3101
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
3102
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
3103
|
+
var TextAreaHelperMessage = forwardRef12((props, ref) => {
|
|
2647
3104
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
2648
3105
|
const typographyClass = textAreaProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
2649
|
-
const helperMessageClassName =
|
|
2650
|
-
return /* @__PURE__ */
|
|
3106
|
+
const helperMessageClassName = clsx42(typographyClass, "text-text02");
|
|
3107
|
+
return /* @__PURE__ */ jsx57("div", { ref, className: helperMessageClassName, ...props });
|
|
2651
3108
|
});
|
|
2652
3109
|
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
2653
3110
|
|
|
2654
3111
|
// src/text-area/text-area.tsx
|
|
2655
|
-
import { jsx as
|
|
3112
|
+
import { jsx as jsx58, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
2656
3113
|
function TextAreaInner({
|
|
2657
3114
|
size = "medium",
|
|
2658
3115
|
isResizable = false,
|
|
@@ -2665,15 +3122,15 @@ function TextAreaInner({
|
|
|
2665
3122
|
className,
|
|
2666
3123
|
...props
|
|
2667
3124
|
}, ref) {
|
|
2668
|
-
const autoGeneratedId =
|
|
2669
|
-
const textAreaPropsForContext =
|
|
3125
|
+
const autoGeneratedId = useId4();
|
|
3126
|
+
const textAreaPropsForContext = useMemo4(
|
|
2670
3127
|
() => ({
|
|
2671
3128
|
size,
|
|
2672
3129
|
isError
|
|
2673
3130
|
}),
|
|
2674
3131
|
[size, isError]
|
|
2675
3132
|
);
|
|
2676
|
-
const contextValue =
|
|
3133
|
+
const contextValue = useMemo4(
|
|
2677
3134
|
() => ({
|
|
2678
3135
|
textAreaProps: textAreaPropsForContext,
|
|
2679
3136
|
forwardedRef: ref
|
|
@@ -2683,21 +3140,21 @@ function TextAreaInner({
|
|
|
2683
3140
|
const helperMessageIds = [];
|
|
2684
3141
|
const errorIds = [];
|
|
2685
3142
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
2686
|
-
const enhancedChildren =
|
|
2687
|
-
if (!
|
|
3143
|
+
const enhancedChildren = Children5.map(children, (child) => {
|
|
3144
|
+
if (!isValidElement3(child)) {
|
|
2688
3145
|
return child;
|
|
2689
3146
|
}
|
|
2690
3147
|
if (child.type === TextAreaHelperMessage) {
|
|
2691
3148
|
const helperChild = child;
|
|
2692
3149
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
2693
3150
|
helperMessageIds.push(assignedId);
|
|
2694
|
-
return
|
|
3151
|
+
return cloneElement5(helperChild, { id: assignedId });
|
|
2695
3152
|
}
|
|
2696
3153
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
2697
3154
|
const errorChild = child;
|
|
2698
3155
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
2699
3156
|
errorIds.push(assignedId);
|
|
2700
|
-
return
|
|
3157
|
+
return cloneElement5(errorChild, { id: assignedId });
|
|
2701
3158
|
}
|
|
2702
3159
|
return child;
|
|
2703
3160
|
});
|
|
@@ -2717,7 +3174,7 @@ function TextAreaInner({
|
|
|
2717
3174
|
...describedByProps,
|
|
2718
3175
|
...ariaInvalidProps
|
|
2719
3176
|
};
|
|
2720
|
-
const textAreaWrapperClassName =
|
|
3177
|
+
const textAreaWrapperClassName = clsx43(
|
|
2721
3178
|
"box-border flex w-full overflow-hidden rounded border",
|
|
2722
3179
|
{
|
|
2723
3180
|
"border-supportError": isError && !disabled,
|
|
@@ -2729,7 +3186,7 @@ function TextAreaInner({
|
|
|
2729
3186
|
},
|
|
2730
3187
|
className
|
|
2731
3188
|
);
|
|
2732
|
-
const textAreaClassName =
|
|
3189
|
+
const textAreaClassName = clsx43(
|
|
2733
3190
|
"w-full border-none bg-uiBackground01 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
2734
3191
|
{
|
|
2735
3192
|
"typography-body14regular px-2 py-2": size === "medium",
|
|
@@ -2742,7 +3199,7 @@ function TextAreaInner({
|
|
|
2742
3199
|
}
|
|
2743
3200
|
);
|
|
2744
3201
|
const hasHeight = height != null && String(height).trim().length > 0;
|
|
2745
|
-
const textAreaElement = /* @__PURE__ */
|
|
3202
|
+
const textAreaElement = /* @__PURE__ */ jsx58(
|
|
2746
3203
|
"div",
|
|
2747
3204
|
{
|
|
2748
3205
|
className: textAreaWrapperClassName,
|
|
@@ -2752,7 +3209,7 @@ function TextAreaInner({
|
|
|
2752
3209
|
...!autoHeight && hasHeight ? { height } : {},
|
|
2753
3210
|
...autoHeight && hasHeight ? { minHeight: height } : {}
|
|
2754
3211
|
},
|
|
2755
|
-
children: /* @__PURE__ */
|
|
3212
|
+
children: /* @__PURE__ */ jsx58(
|
|
2756
3213
|
"textarea",
|
|
2757
3214
|
{
|
|
2758
3215
|
ref,
|
|
@@ -2767,12 +3224,12 @@ function TextAreaInner({
|
|
|
2767
3224
|
)
|
|
2768
3225
|
}
|
|
2769
3226
|
);
|
|
2770
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
3227
|
+
const stackedChildren = enhancedChildren == null ? [] : Children5.toArray(enhancedChildren);
|
|
2771
3228
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
2772
3229
|
if (!hasMessageChildren) {
|
|
2773
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx58(TextAreaCompoundContext.Provider, { value: contextValue, children: textAreaElement });
|
|
2774
3231
|
}
|
|
2775
|
-
return /* @__PURE__ */
|
|
3232
|
+
return /* @__PURE__ */ jsx58(TextAreaCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-2", children: [
|
|
2776
3233
|
textAreaElement,
|
|
2777
3234
|
stackedChildren
|
|
2778
3235
|
] }) });
|
|
@@ -2783,15 +3240,15 @@ var attachStatics2 = (component) => {
|
|
|
2783
3240
|
component.displayName = "TextArea";
|
|
2784
3241
|
return component;
|
|
2785
3242
|
};
|
|
2786
|
-
var TextAreaBase =
|
|
3243
|
+
var TextAreaBase = forwardRef13(function TextAreaBase2(props, ref) {
|
|
2787
3244
|
return TextAreaInner(props, ref);
|
|
2788
3245
|
});
|
|
2789
3246
|
var TextArea = attachStatics2(TextAreaBase);
|
|
2790
3247
|
|
|
2791
3248
|
// src/toast/toast.tsx
|
|
2792
|
-
import
|
|
2793
|
-
import { useCallback as
|
|
2794
|
-
import { jsx as
|
|
3249
|
+
import clsx44 from "clsx";
|
|
3250
|
+
import { useCallback as useCallback11, useEffect as useEffect7, useState as useState12 } from "react";
|
|
3251
|
+
import { jsx as jsx59, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
2795
3252
|
var CLOSE_TIME_MSEC = 5e3;
|
|
2796
3253
|
function Toast({
|
|
2797
3254
|
state = "information",
|
|
@@ -2801,8 +3258,8 @@ function Toast({
|
|
|
2801
3258
|
children,
|
|
2802
3259
|
onClickClose
|
|
2803
3260
|
}) {
|
|
2804
|
-
const [isRemoving, setIsRemoving] =
|
|
2805
|
-
const handleClose =
|
|
3261
|
+
const [isRemoving, setIsRemoving] = useState12(false);
|
|
3262
|
+
const handleClose = useCallback11(() => {
|
|
2806
3263
|
if (isAnimation) {
|
|
2807
3264
|
setIsRemoving(true);
|
|
2808
3265
|
} else {
|
|
@@ -2810,17 +3267,17 @@ function Toast({
|
|
|
2810
3267
|
}
|
|
2811
3268
|
}, [isAnimation, onClickClose]);
|
|
2812
3269
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
2813
|
-
const wrapperClasses =
|
|
3270
|
+
const wrapperClasses = clsx44("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
2814
3271
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
2815
3272
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
2816
3273
|
});
|
|
2817
|
-
const iconClasses =
|
|
3274
|
+
const iconClasses = clsx44("flex items-center", {
|
|
2818
3275
|
"fill-supportSuccess": state === "success",
|
|
2819
3276
|
"fill-supportError": state === "error",
|
|
2820
3277
|
"fill-supportWarning": state === "warning",
|
|
2821
3278
|
"fill-supportInfo": state === "information"
|
|
2822
3279
|
});
|
|
2823
|
-
const textClasses =
|
|
3280
|
+
const textClasses = clsx44("typography-body13regular flex-1 pt-[3px]", {
|
|
2824
3281
|
"text-supportError": state === "error",
|
|
2825
3282
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
2826
3283
|
});
|
|
@@ -2830,7 +3287,7 @@ function Toast({
|
|
|
2830
3287
|
warning: "warning",
|
|
2831
3288
|
information: "information-filled"
|
|
2832
3289
|
};
|
|
2833
|
-
|
|
3290
|
+
useEffect7(() => {
|
|
2834
3291
|
const timer = window.setTimeout(() => {
|
|
2835
3292
|
if (isAutoClose) {
|
|
2836
3293
|
setIsRemoving(true);
|
|
@@ -2838,45 +3295,45 @@ function Toast({
|
|
|
2838
3295
|
}, CLOSE_TIME_MSEC);
|
|
2839
3296
|
return () => window.clearTimeout(timer);
|
|
2840
3297
|
}, [isAutoClose]);
|
|
2841
|
-
return /* @__PURE__ */
|
|
2842
|
-
/* @__PURE__ */
|
|
2843
|
-
/* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
3298
|
+
return /* @__PURE__ */ jsxs29("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
3299
|
+
/* @__PURE__ */ jsx59("div", { className: iconClasses, children: /* @__PURE__ */ jsx59(Icon, { name: iconName[state] }) }),
|
|
3300
|
+
/* @__PURE__ */ jsx59("p", { className: textClasses, children }),
|
|
3301
|
+
/* @__PURE__ */ jsx59(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
2845
3302
|
] });
|
|
2846
3303
|
}
|
|
2847
3304
|
|
|
2848
3305
|
// src/toast/toast-provider.tsx
|
|
2849
|
-
import { createContext as
|
|
3306
|
+
import { createContext as createContext11, useCallback as useCallback12, useContext as useContext14, useEffect as useEffect8, useState as useState13 } from "react";
|
|
2850
3307
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2851
|
-
import { jsx as
|
|
2852
|
-
var ToastContext =
|
|
3308
|
+
import { jsx as jsx60, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3309
|
+
var ToastContext = createContext11({});
|
|
2853
3310
|
var ToastProvider = ({ children }) => {
|
|
2854
|
-
const [isClientRender, setIsClientRender] =
|
|
2855
|
-
const [toasts, setToasts] =
|
|
2856
|
-
const addToast =
|
|
3311
|
+
const [isClientRender, setIsClientRender] = useState13(false);
|
|
3312
|
+
const [toasts, setToasts] = useState13([]);
|
|
3313
|
+
const addToast = useCallback12(({ message, state }) => {
|
|
2857
3314
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
2858
3315
|
}, []);
|
|
2859
|
-
const removeToast =
|
|
3316
|
+
const removeToast = useCallback12((id) => {
|
|
2860
3317
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
2861
3318
|
}, []);
|
|
2862
|
-
|
|
3319
|
+
useEffect8(() => {
|
|
2863
3320
|
setIsClientRender(true);
|
|
2864
3321
|
}, []);
|
|
2865
|
-
return /* @__PURE__ */
|
|
3322
|
+
return /* @__PURE__ */ jsxs30(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
2866
3323
|
children,
|
|
2867
3324
|
isClientRender && createPortal3(
|
|
2868
|
-
/* @__PURE__ */
|
|
3325
|
+
/* @__PURE__ */ jsx60("div", { className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-[16px]", children: toasts.map(({ id, message, state }) => /* @__PURE__ */ jsx60(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
2869
3326
|
document.body
|
|
2870
3327
|
)
|
|
2871
3328
|
] });
|
|
2872
3329
|
};
|
|
2873
3330
|
var useToast = () => {
|
|
2874
|
-
return
|
|
3331
|
+
return useContext14(ToastContext);
|
|
2875
3332
|
};
|
|
2876
3333
|
|
|
2877
3334
|
// src/toggle/toggle.tsx
|
|
2878
|
-
import
|
|
2879
|
-
import { jsx as
|
|
3335
|
+
import clsx45 from "clsx";
|
|
3336
|
+
import { jsx as jsx61, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
2880
3337
|
function Toggle({
|
|
2881
3338
|
id,
|
|
2882
3339
|
size = "medium",
|
|
@@ -2886,7 +3343,7 @@ function Toggle({
|
|
|
2886
3343
|
labelPosition = "right",
|
|
2887
3344
|
isDisabled = false
|
|
2888
3345
|
}) {
|
|
2889
|
-
const baseClasses =
|
|
3346
|
+
const baseClasses = clsx45("relative flex items-center rounded-full", {
|
|
2890
3347
|
"bg-disabledOn": isDisabled && isChecked,
|
|
2891
3348
|
"bg-disabled01": isDisabled && !isChecked,
|
|
2892
3349
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -2894,16 +3351,16 @@ function Toggle({
|
|
|
2894
3351
|
"w-8 h-4 px-[3px]": size === "small",
|
|
2895
3352
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
2896
3353
|
});
|
|
2897
|
-
const inputClasses =
|
|
3354
|
+
const inputClasses = clsx45(
|
|
2898
3355
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
2899
3356
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
2900
3357
|
);
|
|
2901
|
-
const indicatorClasses =
|
|
3358
|
+
const indicatorClasses = clsx45("rounded-full bg-iconOnColor", {
|
|
2902
3359
|
"w-2.5 h-2.5": size === "small",
|
|
2903
3360
|
"w-4 h-4": size === "medium" || size === "large",
|
|
2904
3361
|
"ml-auto": isChecked
|
|
2905
3362
|
});
|
|
2906
|
-
const labelClasses =
|
|
3363
|
+
const labelClasses = clsx45("break-all", {
|
|
2907
3364
|
"mr-2": labelPosition === "left",
|
|
2908
3365
|
"ml-2": labelPosition === "right",
|
|
2909
3366
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -2911,9 +3368,9 @@ function Toggle({
|
|
|
2911
3368
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
2912
3369
|
"cursor-pointer text-text01": !isDisabled
|
|
2913
3370
|
});
|
|
2914
|
-
return /* @__PURE__ */
|
|
2915
|
-
label != null && labelPosition === "left" && /* @__PURE__ */
|
|
2916
|
-
/* @__PURE__ */
|
|
3371
|
+
return /* @__PURE__ */ jsxs31("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
3372
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ jsx61("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
3373
|
+
/* @__PURE__ */ jsx61(
|
|
2917
3374
|
"input",
|
|
2918
3375
|
{
|
|
2919
3376
|
className: inputClasses,
|
|
@@ -2925,23 +3382,23 @@ function Toggle({
|
|
|
2925
3382
|
disabled: isDisabled
|
|
2926
3383
|
}
|
|
2927
3384
|
),
|
|
2928
|
-
/* @__PURE__ */
|
|
2929
|
-
label != null && labelPosition === "right" && /* @__PURE__ */
|
|
3385
|
+
/* @__PURE__ */ jsx61("div", { className: baseClasses, children: /* @__PURE__ */ jsx61("span", { className: indicatorClasses }) }),
|
|
3386
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ jsx61("label", { htmlFor: id, className: labelClasses, children: label })
|
|
2930
3387
|
] });
|
|
2931
3388
|
}
|
|
2932
3389
|
|
|
2933
3390
|
// src/tooltip/tooltip.tsx
|
|
2934
|
-
import { useCallback as
|
|
3391
|
+
import { useCallback as useCallback14, useEffect as useEffect9, useRef as useRef10, useState as useState14 } from "react";
|
|
2935
3392
|
import { createPortal as createPortal4 } from "react-dom";
|
|
2936
3393
|
|
|
2937
3394
|
// src/tooltip/tooltip-content.tsx
|
|
2938
|
-
import
|
|
3395
|
+
import clsx47 from "clsx";
|
|
2939
3396
|
|
|
2940
3397
|
// src/tooltip/tail-icon.tsx
|
|
2941
|
-
import
|
|
2942
|
-
import { jsx as
|
|
3398
|
+
import clsx46 from "clsx";
|
|
3399
|
+
import { jsx as jsx62 } from "react/jsx-runtime";
|
|
2943
3400
|
var TailIcon = (props) => {
|
|
2944
|
-
const tailClasses =
|
|
3401
|
+
const tailClasses = clsx46("absolute fill-uiBackgroundTooltip", {
|
|
2945
3402
|
"rotate-180": props.verticalPosition === "bottom",
|
|
2946
3403
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
2947
3404
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -2956,9 +3413,9 @@ var TailIcon = (props) => {
|
|
|
2956
3413
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
2957
3414
|
});
|
|
2958
3415
|
if (props.size === "small") {
|
|
2959
|
-
return /* @__PURE__ */
|
|
3416
|
+
return /* @__PURE__ */ jsx62("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx62("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
2960
3417
|
} else {
|
|
2961
|
-
return /* @__PURE__ */
|
|
3418
|
+
return /* @__PURE__ */ jsx62(
|
|
2962
3419
|
"svg",
|
|
2963
3420
|
{
|
|
2964
3421
|
className: tailClasses,
|
|
@@ -2967,14 +3424,14 @@ var TailIcon = (props) => {
|
|
|
2967
3424
|
viewBox: "0 0 14 8",
|
|
2968
3425
|
fill: "none",
|
|
2969
3426
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2970
|
-
children: /* @__PURE__ */
|
|
3427
|
+
children: /* @__PURE__ */ jsx62("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
2971
3428
|
}
|
|
2972
3429
|
);
|
|
2973
3430
|
}
|
|
2974
3431
|
};
|
|
2975
3432
|
|
|
2976
3433
|
// src/tooltip/tooltip-content.tsx
|
|
2977
|
-
import { jsx as
|
|
3434
|
+
import { jsx as jsx63, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
2978
3435
|
var TooltipContent = ({
|
|
2979
3436
|
content,
|
|
2980
3437
|
horizontalAlign,
|
|
@@ -2984,7 +3441,7 @@ var TooltipContent = ({
|
|
|
2984
3441
|
maxWidth,
|
|
2985
3442
|
isPortal = false
|
|
2986
3443
|
}) => {
|
|
2987
|
-
const tooltipWrapperClasses =
|
|
3444
|
+
const tooltipWrapperClasses = clsx47("absolute z-tooltip m-auto flex", {
|
|
2988
3445
|
"top-0": !isPortal && verticalPosition === "top",
|
|
2989
3446
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
2990
3447
|
"justify-start": horizontalAlign === "left",
|
|
@@ -2993,7 +3450,7 @@ var TooltipContent = ({
|
|
|
2993
3450
|
"w-[24px]": size === "small",
|
|
2994
3451
|
"w-[46px]": size !== "small"
|
|
2995
3452
|
});
|
|
2996
|
-
const tooltipBodyClasses =
|
|
3453
|
+
const tooltipBodyClasses = clsx47(
|
|
2997
3454
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
2998
3455
|
{
|
|
2999
3456
|
"typography-body12regular": size === "small",
|
|
@@ -3010,7 +3467,7 @@ var TooltipContent = ({
|
|
|
3010
3467
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
3011
3468
|
...tooltipPosition
|
|
3012
3469
|
} : {};
|
|
3013
|
-
return /* @__PURE__ */
|
|
3470
|
+
return /* @__PURE__ */ jsx63("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ jsxs32(
|
|
3014
3471
|
"div",
|
|
3015
3472
|
{
|
|
3016
3473
|
className: tooltipBodyClasses,
|
|
@@ -3019,16 +3476,16 @@ var TooltipContent = ({
|
|
|
3019
3476
|
},
|
|
3020
3477
|
children: [
|
|
3021
3478
|
content,
|
|
3022
|
-
/* @__PURE__ */
|
|
3479
|
+
/* @__PURE__ */ jsx63(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
3023
3480
|
]
|
|
3024
3481
|
}
|
|
3025
3482
|
) });
|
|
3026
3483
|
};
|
|
3027
3484
|
|
|
3028
3485
|
// src/tooltip/tooltip-hook.ts
|
|
3029
|
-
import { useCallback as
|
|
3486
|
+
import { useCallback as useCallback13 } from "react";
|
|
3030
3487
|
var useTooltip = () => {
|
|
3031
|
-
const calculatePosition =
|
|
3488
|
+
const calculatePosition = useCallback13(
|
|
3032
3489
|
(args) => {
|
|
3033
3490
|
const result = {
|
|
3034
3491
|
maxWidth: "none",
|
|
@@ -3080,7 +3537,7 @@ var useTooltip = () => {
|
|
|
3080
3537
|
};
|
|
3081
3538
|
|
|
3082
3539
|
// src/tooltip/tooltip.tsx
|
|
3083
|
-
import { jsx as
|
|
3540
|
+
import { jsx as jsx64, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3084
3541
|
function Tooltip({
|
|
3085
3542
|
children,
|
|
3086
3543
|
content,
|
|
@@ -3092,8 +3549,8 @@ function Tooltip({
|
|
|
3092
3549
|
portalTarget
|
|
3093
3550
|
}) {
|
|
3094
3551
|
const { calculatePosition } = useTooltip();
|
|
3095
|
-
const [isVisible, setIsVisible] =
|
|
3096
|
-
const [tooltipPosition, setTooltipPosition] =
|
|
3552
|
+
const [isVisible, setIsVisible] = useState14(false);
|
|
3553
|
+
const [tooltipPosition, setTooltipPosition] = useState14({
|
|
3097
3554
|
maxWidth: "none",
|
|
3098
3555
|
width: "auto",
|
|
3099
3556
|
left: "0px",
|
|
@@ -3102,23 +3559,23 @@ function Tooltip({
|
|
|
3102
3559
|
translateX: "0",
|
|
3103
3560
|
translateY: "0"
|
|
3104
3561
|
});
|
|
3105
|
-
const targetRef =
|
|
3106
|
-
const handleMouseOverWrapper =
|
|
3562
|
+
const targetRef = useRef10(null);
|
|
3563
|
+
const handleMouseOverWrapper = useCallback14(() => {
|
|
3107
3564
|
if (isDisabledHover) {
|
|
3108
3565
|
return;
|
|
3109
3566
|
}
|
|
3110
3567
|
setIsVisible(true);
|
|
3111
3568
|
}, [isDisabledHover]);
|
|
3112
|
-
const handleMouseOutWrapper =
|
|
3569
|
+
const handleMouseOutWrapper = useCallback14(() => {
|
|
3113
3570
|
setIsVisible(false);
|
|
3114
3571
|
}, []);
|
|
3115
|
-
|
|
3572
|
+
useEffect9(() => {
|
|
3116
3573
|
if (targetRef.current === null) return;
|
|
3117
3574
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
3118
3575
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
3119
3576
|
setTooltipPosition(position);
|
|
3120
3577
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
3121
|
-
return /* @__PURE__ */
|
|
3578
|
+
return /* @__PURE__ */ jsxs33(
|
|
3122
3579
|
"div",
|
|
3123
3580
|
{
|
|
3124
3581
|
ref: targetRef,
|
|
@@ -3127,7 +3584,7 @@ function Tooltip({
|
|
|
3127
3584
|
onMouseLeave: handleMouseOutWrapper,
|
|
3128
3585
|
children: [
|
|
3129
3586
|
children,
|
|
3130
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */
|
|
3587
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ jsx64(
|
|
3131
3588
|
TooltipContent,
|
|
3132
3589
|
{
|
|
3133
3590
|
content,
|
|
@@ -3138,7 +3595,7 @@ function Tooltip({
|
|
|
3138
3595
|
tooltipPosition
|
|
3139
3596
|
}
|
|
3140
3597
|
) : createPortal4(
|
|
3141
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ jsx64(
|
|
3142
3599
|
TooltipContent,
|
|
3143
3600
|
{
|
|
3144
3601
|
isPortal: true,
|
|
@@ -3161,6 +3618,7 @@ export {
|
|
|
3161
3618
|
Breadcrumb,
|
|
3162
3619
|
Button,
|
|
3163
3620
|
Checkbox,
|
|
3621
|
+
DatePicker,
|
|
3164
3622
|
Dropdown,
|
|
3165
3623
|
EvaluationStar,
|
|
3166
3624
|
FileInput,
|