@zenkigen-inc/component-ui 1.21.0 → 1.22.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 +146 -5
- package/dist/index.d.ts +146 -5
- package/dist/index.js +737 -294
- package/dist/index.mjs +683 -244
- package/package.json +4 -4
- package/vitest.setup.ts +6 -0
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
PopoverTrigger: () => PopoverTrigger,
|
|
56
56
|
Popup: () => Popup,
|
|
57
57
|
Radio: () => Radio,
|
|
58
|
+
RadioCard: () => RadioCard,
|
|
58
59
|
Search: () => Search,
|
|
59
60
|
SegmentedControl: () => SegmentedControl,
|
|
60
61
|
Select: () => Select,
|
|
@@ -69,10 +70,13 @@ __export(index_exports, {
|
|
|
69
70
|
Tag: () => Tag,
|
|
70
71
|
TextArea: () => TextArea,
|
|
71
72
|
TextInput: () => TextInput,
|
|
73
|
+
TimePicker: () => TimePicker,
|
|
72
74
|
Toast: () => Toast,
|
|
73
75
|
ToastProvider: () => ToastProvider,
|
|
74
76
|
Toggle: () => Toggle,
|
|
75
77
|
Tooltip: () => Tooltip,
|
|
78
|
+
formatTime: () => formatTime,
|
|
79
|
+
parseTime: () => parseTime,
|
|
76
80
|
useOutsideClick: () => useOutsideClick,
|
|
77
81
|
useRovingFocus: () => useRovingFocus,
|
|
78
82
|
useToast: () => useToast
|
|
@@ -746,9 +750,9 @@ function ComboboxInput({ autoFocus, children }) {
|
|
|
746
750
|
setInputElementRef,
|
|
747
751
|
handleKeyDown,
|
|
748
752
|
handleInputBlur,
|
|
749
|
-
|
|
753
|
+
onClickClearButton
|
|
750
754
|
} = useComboboxContext("Combobox.Input");
|
|
751
|
-
const isClearButtonVisible = inputValue.length > 0 && !isDisabled;
|
|
755
|
+
const isClearButtonVisible = onClickClearButton != null && inputValue.length > 0 && !isDisabled;
|
|
752
756
|
const isEffectivelyOpen = isOpen && hasOpenableContent2;
|
|
753
757
|
const activeItem = activeIndex !== null ? items[activeIndex] : null;
|
|
754
758
|
const activeId = activeItem != null ? `${baseId}-option-${activeItem.value}` : null;
|
|
@@ -767,8 +771,8 @@ function ComboboxInput({ autoFocus, children }) {
|
|
|
767
771
|
inputRef.current?.focus();
|
|
768
772
|
}, [isOpen, setIsOpen, inputRef]);
|
|
769
773
|
const handleClear = (0, import_react10.useCallback)(() => {
|
|
770
|
-
|
|
771
|
-
}, [
|
|
774
|
+
onClickClearButton?.();
|
|
775
|
+
}, [onClickClearButton]);
|
|
772
776
|
const setRef = (0, import_react10.useCallback)(
|
|
773
777
|
(node) => {
|
|
774
778
|
setInputElementRef(node);
|
|
@@ -1260,14 +1264,12 @@ function useCombobox(params) {
|
|
|
1260
1264
|
},
|
|
1261
1265
|
[setIsOpen]
|
|
1262
1266
|
);
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
inputRef.current?.focus();
|
|
1270
|
-
}, []);
|
|
1267
|
+
(0, import_react17.useEffect)(() => {
|
|
1268
|
+
if (params.inputValue === "" && params.value === null) {
|
|
1269
|
+
setActiveIndexState(null);
|
|
1270
|
+
activeValueRef.current = null;
|
|
1271
|
+
}
|
|
1272
|
+
}, [params.inputValue, params.value]);
|
|
1271
1273
|
const moveActive = (0, import_react17.useCallback)((direction) => {
|
|
1272
1274
|
const currentItems = itemsRef.current;
|
|
1273
1275
|
const enabledIndices = currentItems.flatMap((item, i) => item.isDisabled ? [] : [i]);
|
|
@@ -1365,7 +1367,6 @@ function useCombobox(params) {
|
|
|
1365
1367
|
items,
|
|
1366
1368
|
setItems,
|
|
1367
1369
|
selectValue,
|
|
1368
|
-
clearValue,
|
|
1369
1370
|
revertInputToCommitted,
|
|
1370
1371
|
inputRef,
|
|
1371
1372
|
handleKeyDown
|
|
@@ -1389,6 +1390,7 @@ function ComboboxBase({
|
|
|
1389
1390
|
onChange,
|
|
1390
1391
|
inputValue,
|
|
1391
1392
|
onInputChange,
|
|
1393
|
+
onClickClearButton,
|
|
1392
1394
|
isOpen: isOpenProp,
|
|
1393
1395
|
onOpenChange,
|
|
1394
1396
|
size = "medium",
|
|
@@ -1507,7 +1509,7 @@ function ComboboxBase({
|
|
|
1507
1509
|
setIsOpen,
|
|
1508
1510
|
selectedValue: value,
|
|
1509
1511
|
selectValue: combobox.selectValue,
|
|
1510
|
-
|
|
1512
|
+
onClickClearButton,
|
|
1511
1513
|
activeIndex: combobox.activeIndex,
|
|
1512
1514
|
setActiveIndex: combobox.setActiveIndex,
|
|
1513
1515
|
inputMode: combobox.inputMode,
|
|
@@ -1538,7 +1540,7 @@ function ComboboxBase({
|
|
|
1538
1540
|
setIsOpen,
|
|
1539
1541
|
value,
|
|
1540
1542
|
combobox.selectValue,
|
|
1541
|
-
|
|
1543
|
+
onClickClearButton,
|
|
1542
1544
|
combobox.activeIndex,
|
|
1543
1545
|
combobox.setActiveIndex,
|
|
1544
1546
|
combobox.inputMode,
|
|
@@ -3041,22 +3043,35 @@ Modal.Footer = ModalFooter;
|
|
|
3041
3043
|
// src/notification-inline/notification-inline.tsx
|
|
3042
3044
|
var import_clsx29 = require("clsx");
|
|
3043
3045
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3044
|
-
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
3045
|
-
const
|
|
3046
|
+
function NotificationInline({ state = "default", size = "medium", variant = "default", ...props }) {
|
|
3047
|
+
const isOutline = variant === "outline";
|
|
3048
|
+
const wrapperClasses = (0, import_clsx29.clsx)("typography-body13regular flex items-center gap-1 rounded border text-text01", {
|
|
3046
3049
|
"bg-uiBackgroundError": state === "attention",
|
|
3047
3050
|
"bg-uiBackgroundWarning": state === "warning",
|
|
3048
3051
|
"bg-uiBackgroundBlue": state === "information",
|
|
3049
3052
|
"bg-uiBackgroundSuccess": state === "success",
|
|
3050
3053
|
"bg-uiBackgroundGray": state === "default",
|
|
3051
|
-
|
|
3052
|
-
|
|
3054
|
+
// 1 行時の高さの基準は small が閉じるボタン(24px)、medium がアイコン(24px)。
|
|
3055
|
+
// showClose / state によらず高さが変わらないよう、両サイズとも最小高を確保する
|
|
3056
|
+
"min-h-12 p-[calc(0.75rem_-_1px)]": size === "small",
|
|
3057
|
+
"min-h-14 p-[calc(1rem_-_1px)]": size === "medium",
|
|
3058
|
+
"border-transparent": !isOutline,
|
|
3059
|
+
"border-supportError": isOutline && state === "attention",
|
|
3060
|
+
"border-supportWarning": isOutline && state === "warning",
|
|
3061
|
+
"border-supportInfo": isOutline && state === "information",
|
|
3062
|
+
"border-supportSuccess": isOutline && state === "success",
|
|
3063
|
+
"border-uiBorder04": isOutline && state === "default"
|
|
3053
3064
|
});
|
|
3054
|
-
const iconClasses = (0, import_clsx29.clsx)("flex items-center", {
|
|
3065
|
+
const iconClasses = (0, import_clsx29.clsx)("flex shrink-0 items-center", {
|
|
3066
|
+
"h-5": size === "small",
|
|
3055
3067
|
"fill-supportError": state === "attention",
|
|
3056
3068
|
"fill-supportWarning": state === "warning",
|
|
3057
3069
|
"fill-blue-blue50": state === "information",
|
|
3058
3070
|
"fill-supportSuccess": state === "success"
|
|
3059
3071
|
});
|
|
3072
|
+
const textClasses = (0, import_clsx29.clsx)("flex-1", {
|
|
3073
|
+
"pt-[2px]": size === "medium" && state !== "default"
|
|
3074
|
+
});
|
|
3060
3075
|
const iconName = {
|
|
3061
3076
|
attention: "attention",
|
|
3062
3077
|
success: "success-filled",
|
|
@@ -3068,9 +3083,11 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
3068
3083
|
medium: "medium"
|
|
3069
3084
|
};
|
|
3070
3085
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: wrapperClasses, children: [
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3086
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex flex-1 items-start gap-1", children: [
|
|
3087
|
+
state !== "default" && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: iconName[state], size: iconSize[size] }) }),
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: textClasses, children: props.children })
|
|
3089
|
+
] }),
|
|
3090
|
+
props.showClose === true && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "ml-2 flex shrink-0 items-center", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(IconButton, { icon: "close", size: "small", variant: "text", onClick: props.onClickClose }) })
|
|
3074
3091
|
] });
|
|
3075
3092
|
}
|
|
3076
3093
|
|
|
@@ -3282,7 +3299,9 @@ function Select({
|
|
|
3282
3299
|
isOptionSelected = false,
|
|
3283
3300
|
onChange,
|
|
3284
3301
|
optionListMaxHeight,
|
|
3285
|
-
matchListToTrigger = false
|
|
3302
|
+
matchListToTrigger = false,
|
|
3303
|
+
"aria-label": ariaLabel,
|
|
3304
|
+
"aria-describedby": ariaDescribedby
|
|
3286
3305
|
}) {
|
|
3287
3306
|
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react47.useState)(false);
|
|
3288
3307
|
const targetRef = (0, import_react47.useRef)(null);
|
|
@@ -3343,6 +3362,7 @@ function Select({
|
|
|
3343
3362
|
"typography-label14regular": size === "small" || size === "medium",
|
|
3344
3363
|
"typography-label16regular": size === "large"
|
|
3345
3364
|
});
|
|
3365
|
+
const ariaInvalidProps = isError ? { "aria-invalid": true } : {};
|
|
3346
3366
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3347
3367
|
SelectContext.Provider,
|
|
3348
3368
|
{
|
|
@@ -3364,6 +3384,9 @@ function Select({
|
|
|
3364
3384
|
ref: refs.setReference,
|
|
3365
3385
|
className: buttonClasses,
|
|
3366
3386
|
type: "button",
|
|
3387
|
+
"aria-label": ariaLabel,
|
|
3388
|
+
"aria-describedby": ariaDescribedby,
|
|
3389
|
+
...ariaInvalidProps,
|
|
3367
3390
|
onClick: handleClickToggle,
|
|
3368
3391
|
disabled: isDisabled,
|
|
3369
3392
|
children: [
|
|
@@ -3672,23 +3695,207 @@ function Radio({
|
|
|
3672
3695
|
] });
|
|
3673
3696
|
}
|
|
3674
3697
|
|
|
3675
|
-
// src/
|
|
3676
|
-
var
|
|
3698
|
+
// src/radio-card/radio-card.tsx
|
|
3699
|
+
var import_react55 = require("react");
|
|
3700
|
+
|
|
3701
|
+
// src/radio-card/radio-card-context.ts
|
|
3677
3702
|
var import_react53 = require("react");
|
|
3703
|
+
var RadioCardContext = (0, import_react53.createContext)(null);
|
|
3704
|
+
function useRadioCardContext(componentName) {
|
|
3705
|
+
const context = (0, import_react53.useContext)(RadioCardContext);
|
|
3706
|
+
if (context === null) {
|
|
3707
|
+
throw new Error(`<${componentName}> \u306F <RadioCard> \u306E\u5185\u90E8\u3067\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3708
|
+
}
|
|
3709
|
+
return context;
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
// src/radio-card/radio-card-error-message.tsx
|
|
3678
3713
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3679
|
-
|
|
3680
|
-
const
|
|
3714
|
+
function RadioCardErrorMessage({ children, id }) {
|
|
3715
|
+
const { isError } = useRadioCardContext("RadioCard.ErrorMessage");
|
|
3716
|
+
if (!isError) {
|
|
3717
|
+
return null;
|
|
3718
|
+
}
|
|
3719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { id, className: "typography-label13regular text-supportError", "aria-live": "assertive", children });
|
|
3720
|
+
}
|
|
3721
|
+
RadioCardErrorMessage.displayName = "RadioCard.ErrorMessage";
|
|
3722
|
+
|
|
3723
|
+
// src/radio-card/radio-card-group.tsx
|
|
3724
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
3725
|
+
function RadioCardGroup({ children }) {
|
|
3726
|
+
const { ariaLabel, ariaLabelledby, errorDescribedBy } = useRadioCardContext("RadioCard.Group");
|
|
3727
|
+
const describedByProps = errorDescribedBy != null ? { "aria-describedby": errorDescribedBy } : {};
|
|
3728
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
3729
|
+
"div",
|
|
3730
|
+
{
|
|
3731
|
+
role: "radiogroup",
|
|
3732
|
+
"aria-label": ariaLabel,
|
|
3733
|
+
"aria-labelledby": ariaLabelledby,
|
|
3734
|
+
className: "flex flex-col gap-4",
|
|
3735
|
+
...describedByProps,
|
|
3736
|
+
children
|
|
3737
|
+
}
|
|
3738
|
+
);
|
|
3739
|
+
}
|
|
3740
|
+
RadioCardGroup.displayName = "RadioCard.Group";
|
|
3741
|
+
|
|
3742
|
+
// src/radio-card/radio-card-item.tsx
|
|
3743
|
+
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
3744
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
3745
|
+
var import_react54 = require("react");
|
|
3746
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3747
|
+
function RadioCardItem({ value, label, description, isDisabled: itemDisabled = false, id }) {
|
|
3748
|
+
const context = useRadioCardContext("RadioCard.Item");
|
|
3749
|
+
const autoId = (0, import_react54.useId)();
|
|
3750
|
+
const inputId = id ?? autoId;
|
|
3751
|
+
const labelId = `${inputId}-label`;
|
|
3752
|
+
const descriptionId = `${inputId}-description`;
|
|
3753
|
+
const isChecked = context.value === value;
|
|
3754
|
+
const isDisabled = context.isDisabled || itemDisabled;
|
|
3755
|
+
const isError = context.isError && !isDisabled;
|
|
3756
|
+
const hasDescription = description != null && description !== "";
|
|
3757
|
+
const describedByProps = hasDescription ? { "aria-describedby": descriptionId } : {};
|
|
3758
|
+
const ariaInvalidProps = isError ? { "aria-invalid": true } : {};
|
|
3759
|
+
const handleChange = () => {
|
|
3760
|
+
if (!isDisabled) {
|
|
3761
|
+
context.onChange(value);
|
|
3762
|
+
}
|
|
3763
|
+
};
|
|
3764
|
+
const cardClasses = (0, import_clsx35.default)(
|
|
3765
|
+
"pointer-events-none flex flex-col gap-2 rounded border border-solid px-4 py-3",
|
|
3766
|
+
import_component_theme15.focusVisible.normalPeer,
|
|
3767
|
+
{
|
|
3768
|
+
"border-uiBorder02 bg-uiBackground01": isDisabled,
|
|
3769
|
+
"border-supportError bg-uiBackground01 group-hover:bg-hoverUi02": isError,
|
|
3770
|
+
"border-selectedUiBorder bg-selectedUi group-hover:bg-hoverUi02": !isDisabled && !isError && isChecked,
|
|
3771
|
+
"border-uiBorder02 bg-uiBackground01 group-hover:bg-hoverUi02": !isDisabled && !isError && !isChecked
|
|
3772
|
+
}
|
|
3773
|
+
);
|
|
3774
|
+
const boxClasses = (0, import_clsx35.default)(
|
|
3775
|
+
"relative inline-flex size-5 shrink-0 items-center justify-center rounded-full border border-solid bg-white",
|
|
3776
|
+
{
|
|
3777
|
+
"border-disabled01": isDisabled,
|
|
3778
|
+
"border-supportError group-hover:border-hoverError": !isDisabled && isError,
|
|
3779
|
+
"border-uiBorder04 group-hover:border-hoverUiBorder": !isDisabled && !isError
|
|
3780
|
+
}
|
|
3781
|
+
);
|
|
3782
|
+
const dotClasses = (0, import_clsx35.default)("absolute inset-0 m-auto size-3 rounded-full", {
|
|
3783
|
+
"scale-100": isChecked,
|
|
3784
|
+
"scale-0": !isChecked,
|
|
3785
|
+
"bg-disabled01": isDisabled && isChecked,
|
|
3786
|
+
"bg-supportError": !isDisabled && isError && isChecked,
|
|
3787
|
+
"bg-activeSelectedUi": !isDisabled && !isError && isChecked
|
|
3788
|
+
});
|
|
3789
|
+
const hoverDotClasses = (0, import_clsx35.default)("size-3 rounded-full bg-transparent", {
|
|
3790
|
+
"group-hover:bg-hoverUi": !isDisabled && !isChecked
|
|
3791
|
+
});
|
|
3792
|
+
const labelClasses = (0, import_clsx35.default)("typography-label14regular ml-2 select-none break-all", {
|
|
3793
|
+
"text-disabled01": isDisabled,
|
|
3794
|
+
"text-text01": !isDisabled
|
|
3795
|
+
});
|
|
3796
|
+
const descriptionClasses = (0, import_clsx35.default)("typography-body12regular pl-7", {
|
|
3797
|
+
"text-disabled01": isDisabled,
|
|
3798
|
+
"text-text02": !isDisabled
|
|
3799
|
+
});
|
|
3800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "group relative", children: [
|
|
3801
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
3802
|
+
"input",
|
|
3803
|
+
{
|
|
3804
|
+
type: "radio",
|
|
3805
|
+
id: inputId,
|
|
3806
|
+
name: context.name,
|
|
3807
|
+
value,
|
|
3808
|
+
checked: isChecked,
|
|
3809
|
+
disabled: isDisabled,
|
|
3810
|
+
onChange: handleChange,
|
|
3811
|
+
"aria-labelledby": labelId,
|
|
3812
|
+
className: "peer absolute inset-0 size-full cursor-pointer opacity-0 disabled:cursor-not-allowed",
|
|
3813
|
+
...describedByProps,
|
|
3814
|
+
...ariaInvalidProps
|
|
3815
|
+
}
|
|
3816
|
+
),
|
|
3817
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: cardClasses, children: [
|
|
3818
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex items-center", children: [
|
|
3819
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: boxClasses, "aria-hidden": "true", children: [
|
|
3820
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: dotClasses }),
|
|
3821
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { className: hoverDotClasses })
|
|
3822
|
+
] }),
|
|
3823
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { id: labelId, className: labelClasses, children: label })
|
|
3824
|
+
] }),
|
|
3825
|
+
hasDescription ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("p", { id: descriptionId, className: descriptionClasses, children: description }) : null
|
|
3826
|
+
] })
|
|
3827
|
+
] });
|
|
3828
|
+
}
|
|
3829
|
+
RadioCardItem.displayName = "RadioCard.Item";
|
|
3830
|
+
|
|
3831
|
+
// src/radio-card/radio-card.tsx
|
|
3832
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3833
|
+
function RadioCardRoot({
|
|
3834
|
+
children,
|
|
3835
|
+
value,
|
|
3836
|
+
onChange,
|
|
3837
|
+
name,
|
|
3838
|
+
isDisabled = false,
|
|
3839
|
+
isError = false,
|
|
3840
|
+
"aria-label": ariaLabel,
|
|
3841
|
+
"aria-labelledby": ariaLabelledby
|
|
3842
|
+
}) {
|
|
3843
|
+
const autoName = (0, import_react55.useId)();
|
|
3844
|
+
const baseId = (0, import_react55.useId)();
|
|
3845
|
+
const resolvedName = name ?? autoName;
|
|
3846
|
+
const errorIds = [];
|
|
3847
|
+
const enhancedChildren = import_react55.Children.map(children, (child) => {
|
|
3848
|
+
if (!(0, import_react55.isValidElement)(child)) {
|
|
3849
|
+
return child;
|
|
3850
|
+
}
|
|
3851
|
+
if (child.type === RadioCardErrorMessage && isError) {
|
|
3852
|
+
const errorChild = child;
|
|
3853
|
+
const assignedId = errorChild.props.id ?? `${baseId}-error-${errorIds.length + 1}`;
|
|
3854
|
+
errorIds.push(assignedId);
|
|
3855
|
+
return (0, import_react55.cloneElement)(errorChild, { id: assignedId });
|
|
3856
|
+
}
|
|
3857
|
+
return child;
|
|
3858
|
+
});
|
|
3859
|
+
const errorDescribedBy = errorIds.length > 0 ? errorIds.join(" ") : null;
|
|
3860
|
+
const contextValue = (0, import_react55.useMemo)(
|
|
3861
|
+
() => ({
|
|
3862
|
+
value,
|
|
3863
|
+
onChange,
|
|
3864
|
+
name: resolvedName,
|
|
3865
|
+
isDisabled,
|
|
3866
|
+
isError,
|
|
3867
|
+
errorDescribedBy,
|
|
3868
|
+
ariaLabel,
|
|
3869
|
+
ariaLabelledby
|
|
3870
|
+
}),
|
|
3871
|
+
[value, onChange, resolvedName, isDisabled, isError, errorDescribedBy, ariaLabel, ariaLabelledby]
|
|
3872
|
+
);
|
|
3873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(RadioCardContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex flex-col gap-2", children: enhancedChildren }) });
|
|
3874
|
+
}
|
|
3875
|
+
var RadioCard = Object.assign(RadioCardRoot, {
|
|
3876
|
+
Group: RadioCardGroup,
|
|
3877
|
+
Item: RadioCardItem,
|
|
3878
|
+
ErrorMessage: RadioCardErrorMessage,
|
|
3879
|
+
displayName: "RadioCard"
|
|
3880
|
+
});
|
|
3881
|
+
|
|
3882
|
+
// src/search/search.tsx
|
|
3883
|
+
var import_clsx36 = require("clsx");
|
|
3884
|
+
var import_react56 = require("react");
|
|
3885
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3886
|
+
var Search = (0, import_react56.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
3887
|
+
const classes = (0, import_clsx36.clsx)(
|
|
3681
3888
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
3682
3889
|
{ "h-8 px-3": size === "medium" },
|
|
3683
3890
|
{ "h-10 px-4": size === "large" }
|
|
3684
3891
|
);
|
|
3685
|
-
const inputClasses = (0,
|
|
3892
|
+
const inputClasses = (0, import_clsx36.clsx)("mx-2 h-full flex-1 text-text01 outline-none placeholder:text-textPlaceholder", {
|
|
3686
3893
|
["typography-label14regular"]: size === "medium",
|
|
3687
3894
|
["typography-label16regular"]: size === "large"
|
|
3688
3895
|
});
|
|
3689
|
-
return /* @__PURE__ */ (0,
|
|
3690
|
-
/* @__PURE__ */ (0,
|
|
3691
|
-
/* @__PURE__ */ (0,
|
|
3896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "relative", ref, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("form", { onSubmit: props.onSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: classes, style: { width }, children: [
|
|
3897
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(Icon, { name: "search", color: "icon01", size: "medium" }),
|
|
3898
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3692
3899
|
"input",
|
|
3693
3900
|
{
|
|
3694
3901
|
type: "text",
|
|
@@ -3699,7 +3906,7 @@ var Search = (0, import_react53.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3699
3906
|
onChange: props.onChange
|
|
3700
3907
|
}
|
|
3701
3908
|
),
|
|
3702
|
-
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ (0,
|
|
3909
|
+
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
3703
3910
|
IconButton,
|
|
3704
3911
|
{
|
|
3705
3912
|
variant: "text",
|
|
@@ -3714,17 +3921,17 @@ var Search = (0, import_react53.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3714
3921
|
Search.displayName = "Search";
|
|
3715
3922
|
|
|
3716
3923
|
// src/segmented-control/segmented-control.tsx
|
|
3717
|
-
var
|
|
3924
|
+
var import_react59 = __toESM(require("react"));
|
|
3718
3925
|
|
|
3719
3926
|
// src/segmented-control/segmented-control-context.ts
|
|
3720
|
-
var
|
|
3721
|
-
var SegmentedControlContext = (0,
|
|
3927
|
+
var import_react57 = require("react");
|
|
3928
|
+
var SegmentedControlContext = (0, import_react57.createContext)(null);
|
|
3722
3929
|
|
|
3723
3930
|
// src/segmented-control/segmented-control-item.tsx
|
|
3724
|
-
var
|
|
3725
|
-
var
|
|
3726
|
-
var
|
|
3727
|
-
var
|
|
3931
|
+
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
3932
|
+
var import_clsx37 = require("clsx");
|
|
3933
|
+
var import_react58 = require("react");
|
|
3934
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3728
3935
|
var SegmentedControlItem = ({
|
|
3729
3936
|
label,
|
|
3730
3937
|
value,
|
|
@@ -3733,9 +3940,9 @@ var SegmentedControlItem = ({
|
|
|
3733
3940
|
"aria-label": ariaLabel,
|
|
3734
3941
|
...rest
|
|
3735
3942
|
}) => {
|
|
3736
|
-
const context = (0,
|
|
3737
|
-
const buttonRef = (0,
|
|
3738
|
-
const lastInteractionWasMouse = (0,
|
|
3943
|
+
const context = (0, import_react58.useContext)(SegmentedControlContext);
|
|
3944
|
+
const buttonRef = (0, import_react58.useRef)(null);
|
|
3945
|
+
const lastInteractionWasMouse = (0, import_react58.useRef)(false);
|
|
3739
3946
|
if (context === null) {
|
|
3740
3947
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
3741
3948
|
}
|
|
@@ -3751,7 +3958,7 @@ var SegmentedControlItem = ({
|
|
|
3751
3958
|
const isSelected = value === selectedValue;
|
|
3752
3959
|
const isFocused = value === focusedValue;
|
|
3753
3960
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
3754
|
-
(0,
|
|
3961
|
+
(0, import_react58.useEffect)(() => {
|
|
3755
3962
|
if (isFocused === true && buttonRef.current !== null) {
|
|
3756
3963
|
buttonRef.current.focus();
|
|
3757
3964
|
}
|
|
@@ -3773,7 +3980,7 @@ var SegmentedControlItem = ({
|
|
|
3773
3980
|
lastInteractionWasMouse.current = false;
|
|
3774
3981
|
onBlur?.();
|
|
3775
3982
|
};
|
|
3776
|
-
const buttonClasses = (0,
|
|
3983
|
+
const buttonClasses = (0, import_clsx37.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme16.focusVisible.normal, {
|
|
3777
3984
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
3778
3985
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
3779
3986
|
// States - Default with hover
|
|
@@ -3783,7 +3990,7 @@ var SegmentedControlItem = ({
|
|
|
3783
3990
|
// States - Disabled
|
|
3784
3991
|
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
3785
3992
|
});
|
|
3786
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
3787
3994
|
"button",
|
|
3788
3995
|
{
|
|
3789
3996
|
ref: buttonRef,
|
|
@@ -3800,25 +4007,25 @@ var SegmentedControlItem = ({
|
|
|
3800
4007
|
onMouseDown: handleMouseDown,
|
|
3801
4008
|
...rest,
|
|
3802
4009
|
children: [
|
|
3803
|
-
Boolean(icon) === true && icon && /* @__PURE__ */ (0,
|
|
4010
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3804
4011
|
"span",
|
|
3805
4012
|
{
|
|
3806
|
-
className: (0,
|
|
4013
|
+
className: (0, import_clsx37.clsx)("flex items-center", {
|
|
3807
4014
|
"fill-disabled01": isOptionDisabled === true,
|
|
3808
4015
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
3809
4016
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
3810
4017
|
}),
|
|
3811
|
-
children: /* @__PURE__ */ (0,
|
|
4018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { name: icon, size: "small" })
|
|
3812
4019
|
}
|
|
3813
4020
|
),
|
|
3814
|
-
Boolean(label) === true && /* @__PURE__ */ (0,
|
|
4021
|
+
Boolean(label) === true && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
3815
4022
|
]
|
|
3816
4023
|
}
|
|
3817
4024
|
);
|
|
3818
4025
|
};
|
|
3819
4026
|
|
|
3820
4027
|
// src/segmented-control/segmented-control.tsx
|
|
3821
|
-
var
|
|
4028
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3822
4029
|
var SegmentedControl = ({
|
|
3823
4030
|
children,
|
|
3824
4031
|
value,
|
|
@@ -3828,15 +4035,15 @@ var SegmentedControl = ({
|
|
|
3828
4035
|
"aria-label": ariaLabel,
|
|
3829
4036
|
...rest
|
|
3830
4037
|
}) => {
|
|
3831
|
-
const containerRef = (0,
|
|
3832
|
-
const itemIds =
|
|
3833
|
-
if (!
|
|
4038
|
+
const containerRef = (0, import_react59.useRef)(null);
|
|
4039
|
+
const itemIds = import_react59.Children.toArray(children).filter((child) => {
|
|
4040
|
+
if (!import_react59.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
3834
4041
|
return false;
|
|
3835
4042
|
}
|
|
3836
4043
|
const props = child.props;
|
|
3837
4044
|
return props.isDisabled !== true;
|
|
3838
4045
|
}).map((child) => child.props.value);
|
|
3839
|
-
const childrenCount =
|
|
4046
|
+
const childrenCount = import_react59.Children.count(children);
|
|
3840
4047
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
3841
4048
|
const {
|
|
3842
4049
|
focusedValue,
|
|
@@ -3863,7 +4070,7 @@ var SegmentedControl = ({
|
|
|
3863
4070
|
onBlur: handleBlurRovingFocus,
|
|
3864
4071
|
values: itemIds
|
|
3865
4072
|
};
|
|
3866
|
-
return /* @__PURE__ */ (0,
|
|
4073
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3867
4074
|
"div",
|
|
3868
4075
|
{
|
|
3869
4076
|
ref: containerRef,
|
|
@@ -3880,22 +4087,22 @@ var SegmentedControl = ({
|
|
|
3880
4087
|
SegmentedControl.Item = SegmentedControlItem;
|
|
3881
4088
|
|
|
3882
4089
|
// src/select-sort/select-sort.tsx
|
|
4090
|
+
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
4091
|
+
var import_clsx40 = __toESM(require("clsx"));
|
|
4092
|
+
var import_react60 = require("react");
|
|
4093
|
+
|
|
4094
|
+
// src/select-sort/select-list.tsx
|
|
3883
4095
|
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
3884
4096
|
var import_clsx39 = __toESM(require("clsx"));
|
|
3885
|
-
var import_react57 = require("react");
|
|
3886
4097
|
|
|
3887
|
-
// src/select-sort/select-
|
|
4098
|
+
// src/select-sort/select-item.tsx
|
|
3888
4099
|
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
3889
4100
|
var import_clsx38 = __toESM(require("clsx"));
|
|
3890
|
-
|
|
3891
|
-
// src/select-sort/select-item.tsx
|
|
3892
|
-
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
3893
|
-
var import_clsx37 = __toESM(require("clsx"));
|
|
3894
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4101
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3895
4102
|
function SelectItem2({ children, isSortKey, size, onClickItem }) {
|
|
3896
|
-
const itemClasses = (0,
|
|
4103
|
+
const itemClasses = (0, import_clsx38.default)(
|
|
3897
4104
|
"typography-label14regular flex w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
3898
|
-
|
|
4105
|
+
import_component_theme17.focusVisible.inset,
|
|
3899
4106
|
{
|
|
3900
4107
|
"h-8": size !== "large",
|
|
3901
4108
|
"h-10": size === "large",
|
|
@@ -3903,16 +4110,16 @@ function SelectItem2({ children, isSortKey, size, onClickItem }) {
|
|
|
3903
4110
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
3904
4111
|
}
|
|
3905
4112
|
);
|
|
3906
|
-
return /* @__PURE__ */ (0,
|
|
3907
|
-
/* @__PURE__ */ (0,
|
|
3908
|
-
isSortKey && /* @__PURE__ */ (0,
|
|
4113
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("button", { className: itemClasses, type: "button", children: [
|
|
4114
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "ml-1 mr-6", children }),
|
|
4115
|
+
isSortKey && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Icon, { name: "check", size: "small" }) })
|
|
3909
4116
|
] }) });
|
|
3910
4117
|
}
|
|
3911
4118
|
|
|
3912
4119
|
// src/select-sort/select-list.tsx
|
|
3913
|
-
var
|
|
4120
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3914
4121
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
3915
|
-
const listClasses = (0,
|
|
4122
|
+
const listClasses = (0, import_clsx39.default)(
|
|
3916
4123
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
3917
4124
|
{
|
|
3918
4125
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -3921,23 +4128,23 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
3921
4128
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
3922
4129
|
}
|
|
3923
4130
|
);
|
|
3924
|
-
const deselectButtonClasses = (0,
|
|
4131
|
+
const deselectButtonClasses = (0, import_clsx39.default)(
|
|
3925
4132
|
"typography-label14regular flex w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
3926
|
-
|
|
4133
|
+
import_component_theme18.focusVisible.inset,
|
|
3927
4134
|
{
|
|
3928
4135
|
"h-8": size !== "large",
|
|
3929
4136
|
"h-10": size === "large"
|
|
3930
4137
|
}
|
|
3931
4138
|
);
|
|
3932
|
-
return /* @__PURE__ */ (0,
|
|
3933
|
-
/* @__PURE__ */ (0,
|
|
3934
|
-
/* @__PURE__ */ (0,
|
|
3935
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0,
|
|
4139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("ul", { className: listClasses, children: [
|
|
4140
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem2, { size, isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
4141
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(SelectItem2, { size, isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
4142
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
3936
4143
|
] });
|
|
3937
4144
|
}
|
|
3938
4145
|
|
|
3939
4146
|
// src/select-sort/select-sort.tsx
|
|
3940
|
-
var
|
|
4147
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3941
4148
|
function SelectSort({
|
|
3942
4149
|
size = "medium",
|
|
3943
4150
|
variant = "outline",
|
|
@@ -3949,8 +4156,8 @@ function SelectSort({
|
|
|
3949
4156
|
onChange,
|
|
3950
4157
|
onClickDeselect
|
|
3951
4158
|
}) {
|
|
3952
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
3953
|
-
const targetRef = (0,
|
|
4159
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react60.useState)(false);
|
|
4160
|
+
const targetRef = (0, import_react60.useRef)(null);
|
|
3954
4161
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
3955
4162
|
useDismissOnModalOpen(() => {
|
|
3956
4163
|
if (isOptionListOpen) {
|
|
@@ -3958,50 +4165,50 @@ function SelectSort({
|
|
|
3958
4165
|
}
|
|
3959
4166
|
});
|
|
3960
4167
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
3961
|
-
const handleClickItem = (0,
|
|
4168
|
+
const handleClickItem = (0, import_react60.useCallback)(
|
|
3962
4169
|
(value) => {
|
|
3963
4170
|
onChange?.(value);
|
|
3964
4171
|
setIsOptionListOpen(false);
|
|
3965
4172
|
},
|
|
3966
4173
|
[onChange]
|
|
3967
4174
|
);
|
|
3968
|
-
const wrapperClasses = (0,
|
|
4175
|
+
const wrapperClasses = (0, import_clsx40.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
3969
4176
|
"h-6": size === "x-small" || size === "small",
|
|
3970
4177
|
"h-8": size === "medium",
|
|
3971
4178
|
"h-10": size === "large",
|
|
3972
4179
|
"cursor-not-allowed": isDisabled
|
|
3973
4180
|
});
|
|
3974
|
-
const buttonClasses = (0,
|
|
4181
|
+
const buttonClasses = (0, import_clsx40.default)(
|
|
3975
4182
|
"flex size-full items-center rounded",
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
|
|
4183
|
+
import_component_theme19.buttonColors[variant].hover,
|
|
4184
|
+
import_component_theme19.buttonColors[variant].active,
|
|
4185
|
+
import_component_theme19.buttonColors[variant].disabled,
|
|
4186
|
+
import_component_theme19.focusVisible.normal,
|
|
3980
4187
|
{
|
|
3981
|
-
[
|
|
3982
|
-
[
|
|
4188
|
+
[import_component_theme19.buttonColors[variant].selected]: isSortKey,
|
|
4189
|
+
[import_component_theme19.buttonColors[variant].base]: !isSortKey,
|
|
3983
4190
|
"px-2": size === "x-small" || size === "small",
|
|
3984
4191
|
"px-4": size === "medium" || size === "large",
|
|
3985
4192
|
"pointer-events-none": isDisabled
|
|
3986
4193
|
}
|
|
3987
4194
|
);
|
|
3988
|
-
const labelClasses = (0,
|
|
4195
|
+
const labelClasses = (0, import_clsx40.default)("truncate", {
|
|
3989
4196
|
"typography-label12regular": size === "x-small",
|
|
3990
4197
|
"typography-label14regular": size === "small" || size === "medium",
|
|
3991
4198
|
"typography-label16regular": size === "large",
|
|
3992
4199
|
"mr-1": size === "x-small",
|
|
3993
4200
|
"mr-2": size !== "x-small"
|
|
3994
4201
|
});
|
|
3995
|
-
return /* @__PURE__ */ (0,
|
|
3996
|
-
/* @__PURE__ */ (0,
|
|
3997
|
-
/* @__PURE__ */ (0,
|
|
3998
|
-
/* @__PURE__ */ (0,
|
|
4202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
4203
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
4204
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: labelClasses, children: label }),
|
|
4205
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
3999
4206
|
Icon,
|
|
4000
4207
|
{
|
|
4001
4208
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
4002
4209
|
size: size === "large" ? "medium" : "small"
|
|
4003
4210
|
}
|
|
4004
|
-
) : /* @__PURE__ */ (0,
|
|
4211
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4005
4212
|
Icon,
|
|
4006
4213
|
{
|
|
4007
4214
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -4009,7 +4216,7 @@ function SelectSort({
|
|
|
4009
4216
|
}
|
|
4010
4217
|
) })
|
|
4011
4218
|
] }),
|
|
4012
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
4219
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4013
4220
|
SelectList2,
|
|
4014
4221
|
{
|
|
4015
4222
|
size,
|
|
@@ -4023,10 +4230,10 @@ function SelectSort({
|
|
|
4023
4230
|
}
|
|
4024
4231
|
|
|
4025
4232
|
// src/sort-button/sort-button.tsx
|
|
4026
|
-
var
|
|
4027
|
-
var
|
|
4028
|
-
var
|
|
4029
|
-
var
|
|
4233
|
+
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
4234
|
+
var import_clsx41 = __toESM(require("clsx"));
|
|
4235
|
+
var import_react61 = require("react");
|
|
4236
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4030
4237
|
function SortButton({
|
|
4031
4238
|
size = "medium",
|
|
4032
4239
|
width,
|
|
@@ -4037,7 +4244,7 @@ function SortButton({
|
|
|
4037
4244
|
"aria-label": ariaLabel,
|
|
4038
4245
|
...rest
|
|
4039
4246
|
}) {
|
|
4040
|
-
const handleClick = (0,
|
|
4247
|
+
const handleClick = (0, import_react61.useCallback)(() => {
|
|
4041
4248
|
if (isDisabled || !onClick) return;
|
|
4042
4249
|
onClick();
|
|
4043
4250
|
}, [isDisabled, onClick]);
|
|
@@ -4046,36 +4253,36 @@ function SortButton({
|
|
|
4046
4253
|
if (sortOrder === "descend") return "arrow-down";
|
|
4047
4254
|
return "angle-small-down";
|
|
4048
4255
|
};
|
|
4049
|
-
const wrapperClasses = (0,
|
|
4256
|
+
const wrapperClasses = (0, import_clsx41.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
4050
4257
|
"h-6": size === "x-small" || size === "small",
|
|
4051
4258
|
"h-8": size === "medium",
|
|
4052
4259
|
"h-10": size === "large",
|
|
4053
4260
|
"cursor-not-allowed": isDisabled
|
|
4054
4261
|
});
|
|
4055
|
-
const buttonClasses = (0,
|
|
4262
|
+
const buttonClasses = (0, import_clsx41.default)(
|
|
4056
4263
|
"flex size-full items-center rounded",
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4264
|
+
import_component_theme20.buttonColors.text.hover,
|
|
4265
|
+
import_component_theme20.buttonColors.text.active,
|
|
4266
|
+
import_component_theme20.buttonColors.text.disabled,
|
|
4267
|
+
import_component_theme20.focusVisible.normal,
|
|
4061
4268
|
{
|
|
4062
|
-
[
|
|
4269
|
+
[import_component_theme20.buttonColors.text.selected]: !isDisabled && sortOrder !== null,
|
|
4063
4270
|
// ソート状態時は選択状態のスタイル
|
|
4064
|
-
[
|
|
4271
|
+
[import_component_theme20.buttonColors.text.base]: sortOrder === null,
|
|
4065
4272
|
// ソートなし時は通常のスタイル
|
|
4066
4273
|
"px-2": size === "x-small" || size === "small",
|
|
4067
4274
|
"px-4": size === "medium" || size === "large",
|
|
4068
4275
|
"pointer-events-none": isDisabled
|
|
4069
4276
|
}
|
|
4070
4277
|
);
|
|
4071
|
-
const labelClasses = (0,
|
|
4278
|
+
const labelClasses = (0, import_clsx41.default)("truncate", {
|
|
4072
4279
|
"typography-label12regular": size === "x-small",
|
|
4073
4280
|
"typography-label14regular": size === "small" || size === "medium",
|
|
4074
4281
|
"typography-label16regular": size === "large",
|
|
4075
4282
|
"mr-1": size === "x-small",
|
|
4076
4283
|
"mr-2": size !== "x-small"
|
|
4077
4284
|
});
|
|
4078
|
-
return /* @__PURE__ */ (0,
|
|
4285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
4079
4286
|
"button",
|
|
4080
4287
|
{
|
|
4081
4288
|
className: buttonClasses,
|
|
@@ -4086,22 +4293,22 @@ function SortButton({
|
|
|
4086
4293
|
"aria-label": ariaLabel,
|
|
4087
4294
|
"aria-disabled": isDisabled,
|
|
4088
4295
|
children: [
|
|
4089
|
-
/* @__PURE__ */ (0,
|
|
4090
|
-
/* @__PURE__ */ (0,
|
|
4296
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: labelClasses, children: label }),
|
|
4297
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
4091
4298
|
]
|
|
4092
4299
|
}
|
|
4093
4300
|
) });
|
|
4094
4301
|
}
|
|
4095
4302
|
|
|
4096
4303
|
// src/steps/steps.tsx
|
|
4097
|
-
var
|
|
4098
|
-
var
|
|
4304
|
+
var import_clsx44 = require("clsx");
|
|
4305
|
+
var import_react64 = require("react");
|
|
4099
4306
|
|
|
4100
4307
|
// src/steps/steps-context.ts
|
|
4101
|
-
var
|
|
4102
|
-
var StepsContext = (0,
|
|
4308
|
+
var import_react62 = require("react");
|
|
4309
|
+
var StepsContext = (0, import_react62.createContext)(null);
|
|
4103
4310
|
function useStepsContext() {
|
|
4104
|
-
const context = (0,
|
|
4311
|
+
const context = (0, import_react62.useContext)(StepsContext);
|
|
4105
4312
|
if (context === null) {
|
|
4106
4313
|
throw new Error("Steps.Item must be used within <Steps>");
|
|
4107
4314
|
}
|
|
@@ -4109,13 +4316,13 @@ function useStepsContext() {
|
|
|
4109
4316
|
}
|
|
4110
4317
|
|
|
4111
4318
|
// src/steps/steps-item.tsx
|
|
4112
|
-
var
|
|
4319
|
+
var import_clsx43 = require("clsx");
|
|
4113
4320
|
|
|
4114
4321
|
// src/steps/steps-item-context.ts
|
|
4115
|
-
var
|
|
4116
|
-
var StepsItemContext = (0,
|
|
4322
|
+
var import_react63 = require("react");
|
|
4323
|
+
var StepsItemContext = (0, import_react63.createContext)(null);
|
|
4117
4324
|
function useStepsItemContext() {
|
|
4118
|
-
const context = (0,
|
|
4325
|
+
const context = (0, import_react63.useContext)(StepsItemContext);
|
|
4119
4326
|
if (context === null) {
|
|
4120
4327
|
throw new Error("Steps.Item must be rendered inside a <Steps> component");
|
|
4121
4328
|
}
|
|
@@ -4123,34 +4330,34 @@ function useStepsItemContext() {
|
|
|
4123
4330
|
}
|
|
4124
4331
|
|
|
4125
4332
|
// src/steps/steps-separator.tsx
|
|
4126
|
-
var
|
|
4127
|
-
var
|
|
4333
|
+
var import_clsx42 = require("clsx");
|
|
4334
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4128
4335
|
function StepsSeparator({ progress }) {
|
|
4129
4336
|
const { orientation } = useStepsContext();
|
|
4130
4337
|
const isVerticalLine = orientation === "vertical";
|
|
4131
4338
|
const colorClass = progress === "completed" ? "bg-interactive01" : "bg-uiBorder01";
|
|
4132
4339
|
if (isVerticalLine) {
|
|
4133
|
-
return /* @__PURE__ */ (0,
|
|
4340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "aria-hidden": "true", className: (0, import_clsx42.clsx)("mx-auto h-full min-h-2 w-px", colorClass) });
|
|
4134
4341
|
}
|
|
4135
|
-
return /* @__PURE__ */ (0,
|
|
4342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { "aria-hidden": "true", className: (0, import_clsx42.clsx)("h-px flex-1", colorClass) });
|
|
4136
4343
|
}
|
|
4137
4344
|
|
|
4138
4345
|
// src/steps/steps-item.tsx
|
|
4139
|
-
var
|
|
4346
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4140
4347
|
var progressSrOnlyLabel = {
|
|
4141
4348
|
completed: "\u5B8C\u4E86: ",
|
|
4142
4349
|
current: "\u73FE\u5728\u306E\u30B9\u30C6\u30C3\u30D7: ",
|
|
4143
4350
|
upcoming: "\u672A\u7740\u624B: "
|
|
4144
4351
|
};
|
|
4145
4352
|
function getCircleSizeClass(size) {
|
|
4146
|
-
return (0,
|
|
4353
|
+
return (0, import_clsx43.clsx)({
|
|
4147
4354
|
"size-6 typography-label12regular": size === "small",
|
|
4148
4355
|
"size-8 typography-label12regular": size === "medium",
|
|
4149
4356
|
"size-10 typography-label16regular": size === "large"
|
|
4150
4357
|
});
|
|
4151
4358
|
}
|
|
4152
4359
|
function getCircleVariantProgressClass(variant, progress) {
|
|
4153
|
-
return (0,
|
|
4360
|
+
return (0, import_clsx43.clsx)({
|
|
4154
4361
|
// subtle(全 state border-transparent で box-sizing を揃える)
|
|
4155
4362
|
"bg-uiBackground02 text-text01 border-transparent": variant === "subtle" && progress === "upcoming",
|
|
4156
4363
|
"bg-activeUi text-text01 border-transparent": variant === "subtle" && progress === "current",
|
|
@@ -4162,7 +4369,7 @@ function getCircleVariantProgressClass(variant, progress) {
|
|
|
4162
4369
|
});
|
|
4163
4370
|
}
|
|
4164
4371
|
function getCircleClasses(size, variant, state) {
|
|
4165
|
-
return (0,
|
|
4372
|
+
return (0, import_clsx43.clsx)(
|
|
4166
4373
|
"box-border flex items-center justify-center rounded-full border-2",
|
|
4167
4374
|
getCircleSizeClass(size),
|
|
4168
4375
|
getCircleVariantProgressClass(variant, state.progress)
|
|
@@ -4180,65 +4387,65 @@ function StepsItem({ label, description }) {
|
|
|
4180
4387
|
const { state, index, isLast, id } = useStepsItemContext();
|
|
4181
4388
|
const isCircleFilled = state.progress === "completed";
|
|
4182
4389
|
const circleClasses = getCircleClasses(size, variant, state);
|
|
4183
|
-
const checkIcon = variant === "solid" ? /* @__PURE__ */ (0,
|
|
4184
|
-
const circle = /* @__PURE__ */ (0,
|
|
4185
|
-
const labelBlock = /* @__PURE__ */ (0,
|
|
4186
|
-
/* @__PURE__ */ (0,
|
|
4390
|
+
const checkIcon = variant === "solid" ? /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon, { name: "check", size: getIconSize(size), color: "iconOnColor" }) : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon, { name: "check", size: getIconSize(size), className: "fill-gray-gray100" });
|
|
4391
|
+
const circle = /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { "aria-hidden": "true", className: circleClasses, children: isCircleFilled ? checkIcon : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { children: index + 1 }) });
|
|
4392
|
+
const labelBlock = /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("span", { className: (0, import_clsx43.clsx)("flex flex-col", textOrientation === "horizontal" ? "gap-1" : "items-center text-center"), children: [
|
|
4393
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4187
4394
|
"span",
|
|
4188
4395
|
{
|
|
4189
|
-
className: (0,
|
|
4396
|
+
className: (0, import_clsx43.clsx)(
|
|
4190
4397
|
"whitespace-nowrap text-text01",
|
|
4191
4398
|
size === "large" ? "typography-body16regular" : "typography-body14regular"
|
|
4192
4399
|
),
|
|
4193
4400
|
children: [
|
|
4194
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: progressSrOnlyLabel[state.progress] }),
|
|
4195
4402
|
label
|
|
4196
4403
|
]
|
|
4197
4404
|
}
|
|
4198
4405
|
),
|
|
4199
|
-
description != null && /* @__PURE__ */ (0,
|
|
4406
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "typography-label12regular whitespace-nowrap text-text02", children: description })
|
|
4200
4407
|
] });
|
|
4201
4408
|
const ariaCurrentProps = state.progress === "current" ? { "aria-current": "step" } : {};
|
|
4202
4409
|
if (orientation === "horizontal" && textOrientation === "horizontal") {
|
|
4203
|
-
return /* @__PURE__ */ (0,
|
|
4410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("li", { ...ariaCurrentProps, id, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4204
4411
|
circle,
|
|
4205
4412
|
labelBlock
|
|
4206
4413
|
] }) });
|
|
4207
4414
|
}
|
|
4208
4415
|
if (orientation === "horizontal" && textOrientation === "vertical") {
|
|
4209
|
-
return /* @__PURE__ */ (0,
|
|
4416
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("li", { ...ariaCurrentProps, id, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("div", { className: "flex flex-col items-center gap-1", children: [
|
|
4210
4417
|
circle,
|
|
4211
4418
|
labelBlock
|
|
4212
4419
|
] }) });
|
|
4213
4420
|
}
|
|
4214
4421
|
if (orientation === "vertical" && textOrientation === "horizontal") {
|
|
4215
|
-
return /* @__PURE__ */ (0,
|
|
4422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4216
4423
|
"li",
|
|
4217
4424
|
{
|
|
4218
4425
|
...ariaCurrentProps,
|
|
4219
|
-
className: (0,
|
|
4426
|
+
className: (0, import_clsx43.clsx)(
|
|
4220
4427
|
"grid grid-cols-[min-content_1fr] grid-rows-[auto_1fr] items-center gap-x-2",
|
|
4221
4428
|
!isLast && "flex-1"
|
|
4222
4429
|
),
|
|
4223
4430
|
id,
|
|
4224
4431
|
children: [
|
|
4225
|
-
/* @__PURE__ */ (0,
|
|
4226
|
-
/* @__PURE__ */ (0,
|
|
4227
|
-
!isLast && /* @__PURE__ */ (0,
|
|
4432
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "col-start-1 row-start-1 flex items-center", children: circle }),
|
|
4433
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "col-start-2 row-start-1 flex items-center", children: labelBlock }),
|
|
4434
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "col-start-1 row-start-2 flex items-stretch justify-center self-stretch py-2", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(StepsSeparator, { progress: state.progress }) })
|
|
4228
4435
|
]
|
|
4229
4436
|
}
|
|
4230
4437
|
);
|
|
4231
4438
|
}
|
|
4232
|
-
return /* @__PURE__ */ (0,
|
|
4439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)("li", { ...ariaCurrentProps, className: (0, import_clsx43.clsx)("flex flex-col items-center gap-1", !isLast && "flex-1"), id, children: [
|
|
4233
4440
|
circle,
|
|
4234
4441
|
labelBlock,
|
|
4235
|
-
!isLast && /* @__PURE__ */ (0,
|
|
4442
|
+
!isLast && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("div", { className: "flex flex-1 items-stretch self-stretch py-2", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(StepsSeparator, { progress: state.progress }) })
|
|
4236
4443
|
] });
|
|
4237
4444
|
}
|
|
4238
4445
|
StepsItem.displayName = "Steps.Item";
|
|
4239
4446
|
|
|
4240
4447
|
// src/steps/steps.tsx
|
|
4241
|
-
var
|
|
4448
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4242
4449
|
function getSeparatorCellHeightClass(size) {
|
|
4243
4450
|
if (size === "small") return "h-6";
|
|
4244
4451
|
if (size === "medium") return "h-8";
|
|
@@ -4251,19 +4458,19 @@ function HorizontalSeparatorCell({
|
|
|
4251
4458
|
}) {
|
|
4252
4459
|
const heightClass = getSeparatorCellHeightClass(size);
|
|
4253
4460
|
const alignClass = textOrientation === "vertical" ? "self-start" : "";
|
|
4254
|
-
return /* @__PURE__ */ (0,
|
|
4461
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("li", { "aria-hidden": "true", className: (0, import_clsx44.clsx)("flex items-center", heightClass, alignClass), role: "presentation", children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StepsSeparator, { progress }) });
|
|
4255
4462
|
}
|
|
4256
4463
|
function collectStepsItems(children) {
|
|
4257
4464
|
const result = [];
|
|
4258
|
-
|
|
4259
|
-
if (!(0,
|
|
4465
|
+
import_react64.Children.toArray(children).forEach((child) => {
|
|
4466
|
+
if (!(0, import_react64.isValidElement)(child)) {
|
|
4260
4467
|
return;
|
|
4261
4468
|
}
|
|
4262
4469
|
if (child.type === StepsItem) {
|
|
4263
4470
|
result.push(child);
|
|
4264
4471
|
return;
|
|
4265
4472
|
}
|
|
4266
|
-
if (child.type ===
|
|
4473
|
+
if (child.type === import_react64.Fragment) {
|
|
4267
4474
|
const fragmentChildren = child.props.children;
|
|
4268
4475
|
result.push(...collectStepsItems(fragmentChildren));
|
|
4269
4476
|
}
|
|
@@ -4280,12 +4487,12 @@ function StepsRoot({
|
|
|
4280
4487
|
variant = "solid",
|
|
4281
4488
|
"aria-label": ariaLabel
|
|
4282
4489
|
}) {
|
|
4283
|
-
const baseId = (0,
|
|
4284
|
-
const [internalStep] = (0,
|
|
4490
|
+
const baseId = (0, import_react64.useId)();
|
|
4491
|
+
const [internalStep] = (0, import_react64.useState)(defaultCurrentStep ?? 0);
|
|
4285
4492
|
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4286
|
-
const itemElements = (0,
|
|
4493
|
+
const itemElements = (0, import_react64.useMemo)(() => collectStepsItems(children), [children]);
|
|
4287
4494
|
const stepsCount = itemElements.length;
|
|
4288
|
-
const contextValue = (0,
|
|
4495
|
+
const contextValue = (0, import_react64.useMemo)(
|
|
4289
4496
|
() => ({
|
|
4290
4497
|
size,
|
|
4291
4498
|
orientation,
|
|
@@ -4304,13 +4511,13 @@ function StepsRoot({
|
|
|
4304
4511
|
const state = states[index] ?? { progress: "upcoming" };
|
|
4305
4512
|
const isLast = index === stepsCount - 1;
|
|
4306
4513
|
const id = `${baseId}-item-${index}`;
|
|
4307
|
-
return /* @__PURE__ */ (0,
|
|
4514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StepsItemContext.Provider, { value: { index, state, isLast, id }, children: item }, item.key ?? `item-${index}`);
|
|
4308
4515
|
};
|
|
4309
4516
|
const renderedChildren = orientation === "horizontal" ? itemElements.flatMap((item, index) => {
|
|
4310
4517
|
const nodes = [wrapItem(item, index)];
|
|
4311
4518
|
if (index < stepsCount - 1) {
|
|
4312
4519
|
nodes.push(
|
|
4313
|
-
/* @__PURE__ */ (0,
|
|
4520
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
4314
4521
|
HorizontalSeparatorCell,
|
|
4315
4522
|
{
|
|
4316
4523
|
progress: states[index]?.progress ?? "upcoming",
|
|
@@ -4323,7 +4530,7 @@ function StepsRoot({
|
|
|
4323
4530
|
}
|
|
4324
4531
|
return nodes;
|
|
4325
4532
|
}) : itemElements.map((item, index) => wrapItem(item, index));
|
|
4326
|
-
const listClassName = (0,
|
|
4533
|
+
const listClassName = (0, import_clsx44.clsx)(
|
|
4327
4534
|
orientation === "horizontal" ? ["grid w-full gap-x-2", textOrientation === "vertical" ? "items-start" : "items-center"] : "flex flex-col items-stretch"
|
|
4328
4535
|
);
|
|
4329
4536
|
const horizontalGridTemplate = Array.from(
|
|
@@ -4331,20 +4538,20 @@ function StepsRoot({
|
|
|
4331
4538
|
(_unused, index) => index === stepsCount - 1 ? "max-content" : "max-content minmax(8px, 1fr)"
|
|
4332
4539
|
).join(" ");
|
|
4333
4540
|
const listStyleProps = orientation === "horizontal" ? { style: { gridTemplateColumns: horizontalGridTemplate } } : {};
|
|
4334
|
-
return /* @__PURE__ */ (0,
|
|
4541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StepsContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)("ol", { "aria-label": ariaLabel, className: listClassName, role: "list", ...listStyleProps, children: renderedChildren }) });
|
|
4335
4542
|
}
|
|
4336
4543
|
var Steps = StepsRoot;
|
|
4337
4544
|
Steps.Item = StepsItem;
|
|
4338
4545
|
|
|
4339
4546
|
// src/tab/tab.tsx
|
|
4340
|
-
var
|
|
4341
|
-
var
|
|
4547
|
+
var import_clsx46 = require("clsx");
|
|
4548
|
+
var import_react65 = require("react");
|
|
4342
4549
|
|
|
4343
4550
|
// src/tab/tab-item.tsx
|
|
4344
|
-
var
|
|
4345
|
-
var
|
|
4551
|
+
var import_clsx45 = require("clsx");
|
|
4552
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4346
4553
|
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
4347
|
-
const classes = (0,
|
|
4554
|
+
const classes = (0, import_clsx45.clsx)(
|
|
4348
4555
|
"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",
|
|
4349
4556
|
{
|
|
4350
4557
|
"typography-label14regular text-interactive02": !isSelected,
|
|
@@ -4352,12 +4559,12 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4352
4559
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
4353
4560
|
}
|
|
4354
4561
|
);
|
|
4355
|
-
const iconWrapperClasses = (0,
|
|
4562
|
+
const iconWrapperClasses = (0, import_clsx45.clsx)("flex shrink-0 items-center", {
|
|
4356
4563
|
"fill-disabled01": isDisabled,
|
|
4357
4564
|
"fill-interactive01": !isDisabled && isSelected,
|
|
4358
4565
|
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
4359
4566
|
});
|
|
4360
|
-
return /* @__PURE__ */ (0,
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
4361
4568
|
"button",
|
|
4362
4569
|
{
|
|
4363
4570
|
type: "button",
|
|
@@ -4367,7 +4574,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4367
4574
|
disabled: isDisabled,
|
|
4368
4575
|
onClick: () => props.onClick(props.id),
|
|
4369
4576
|
children: [
|
|
4370
|
-
icon != null && /* @__PURE__ */ (0,
|
|
4577
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("span", { className: iconWrapperClasses, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(Icon, { name: icon, size: "small" }) }),
|
|
4371
4578
|
props.children
|
|
4372
4579
|
]
|
|
4373
4580
|
}
|
|
@@ -4375,39 +4582,39 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4375
4582
|
};
|
|
4376
4583
|
|
|
4377
4584
|
// src/tab/tab.tsx
|
|
4378
|
-
var
|
|
4585
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4379
4586
|
function Tab({ children, layout = "auto" }) {
|
|
4380
|
-
const childrenCount =
|
|
4587
|
+
const childrenCount = import_react65.Children.count(children);
|
|
4381
4588
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
4382
|
-
const containerClasses = (0,
|
|
4589
|
+
const containerClasses = (0, import_clsx46.clsx)(
|
|
4383
4590
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
4384
4591
|
{
|
|
4385
4592
|
flex: layout === "auto",
|
|
4386
4593
|
grid: layout === "equal"
|
|
4387
4594
|
}
|
|
4388
4595
|
);
|
|
4389
|
-
return /* @__PURE__ */ (0,
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
4390
4597
|
}
|
|
4391
4598
|
Tab.Item = TabItem;
|
|
4392
4599
|
|
|
4393
4600
|
// src/table/table-cell.tsx
|
|
4394
|
-
var
|
|
4395
|
-
var
|
|
4601
|
+
var import_clsx47 = __toESM(require("clsx"));
|
|
4602
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4396
4603
|
function TableCell({ children, className, isHeader = false }) {
|
|
4397
|
-
const classes = (0,
|
|
4398
|
-
return /* @__PURE__ */ (0,
|
|
4604
|
+
const classes = (0, import_clsx47.default)("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
4605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: classes, children });
|
|
4399
4606
|
}
|
|
4400
4607
|
|
|
4401
4608
|
// src/table/table-row.tsx
|
|
4402
|
-
var
|
|
4403
|
-
var
|
|
4609
|
+
var import_clsx48 = __toESM(require("clsx"));
|
|
4610
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4404
4611
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
4405
|
-
const rowClasses = (0,
|
|
4406
|
-
return /* @__PURE__ */ (0,
|
|
4612
|
+
const rowClasses = (0, import_clsx48.default)("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
4613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: rowClasses, children });
|
|
4407
4614
|
}
|
|
4408
4615
|
|
|
4409
4616
|
// src/table/table.tsx
|
|
4410
|
-
var
|
|
4617
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4411
4618
|
function Table({
|
|
4412
4619
|
width,
|
|
4413
4620
|
templateRows,
|
|
@@ -4416,7 +4623,7 @@ function Table({
|
|
|
4416
4623
|
autoRows,
|
|
4417
4624
|
children
|
|
4418
4625
|
}) {
|
|
4419
|
-
return /* @__PURE__ */ (0,
|
|
4626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4420
4627
|
"div",
|
|
4421
4628
|
{
|
|
4422
4629
|
className: "grid",
|
|
@@ -4435,23 +4642,23 @@ Table.Row = TableRow;
|
|
|
4435
4642
|
Table.Cell = TableCell;
|
|
4436
4643
|
|
|
4437
4644
|
// src/tag/tag.tsx
|
|
4438
|
-
var
|
|
4439
|
-
var
|
|
4645
|
+
var import_component_theme22 = require("@zenkigen-inc/component-theme");
|
|
4646
|
+
var import_clsx50 = __toESM(require("clsx"));
|
|
4440
4647
|
|
|
4441
4648
|
// src/tag/delete-icon.tsx
|
|
4442
|
-
var
|
|
4443
|
-
var
|
|
4444
|
-
var
|
|
4649
|
+
var import_component_theme21 = require("@zenkigen-inc/component-theme");
|
|
4650
|
+
var import_clsx49 = __toESM(require("clsx"));
|
|
4651
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
4445
4652
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
4446
|
-
const deleteButtonClasses = (0,
|
|
4653
|
+
const deleteButtonClasses = (0, import_clsx49.default)(
|
|
4447
4654
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
4448
|
-
|
|
4655
|
+
import_component_theme21.focusVisible.normal
|
|
4449
4656
|
);
|
|
4450
|
-
const deletePathClasses = (0,
|
|
4657
|
+
const deletePathClasses = (0, import_clsx49.default)({
|
|
4451
4658
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
4452
4659
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
4453
4660
|
});
|
|
4454
|
-
return /* @__PURE__ */ (0,
|
|
4661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
4455
4662
|
"path",
|
|
4456
4663
|
{
|
|
4457
4664
|
fillRule: "evenodd",
|
|
@@ -4463,11 +4670,11 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
4463
4670
|
};
|
|
4464
4671
|
|
|
4465
4672
|
// src/tag/tag.tsx
|
|
4466
|
-
var
|
|
4673
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4467
4674
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
4468
|
-
const wrapperClasses = (0,
|
|
4469
|
-
[
|
|
4470
|
-
[
|
|
4675
|
+
const wrapperClasses = (0, import_clsx50.default)("flex", "items-center", "justify-center", {
|
|
4676
|
+
[import_component_theme22.tagColors[color]]: variant === "normal",
|
|
4677
|
+
[import_component_theme22.tagLightColors[color]]: variant === "light",
|
|
4471
4678
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
4472
4679
|
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
4473
4680
|
"h-5 typography-label14regular": size === "medium",
|
|
@@ -4476,21 +4683,21 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
4476
4683
|
"px-1": !isEditable,
|
|
4477
4684
|
"px-2": isEditable
|
|
4478
4685
|
});
|
|
4479
|
-
return /* @__PURE__ */ (0,
|
|
4686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: wrapperClasses, children: [
|
|
4480
4687
|
children,
|
|
4481
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
4688
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
4482
4689
|
] });
|
|
4483
4690
|
}
|
|
4484
4691
|
|
|
4485
4692
|
// src/text-area/text-area.tsx
|
|
4486
|
-
var
|
|
4487
|
-
var
|
|
4693
|
+
var import_clsx53 = require("clsx");
|
|
4694
|
+
var import_react69 = require("react");
|
|
4488
4695
|
|
|
4489
4696
|
// src/text-area/text-area-context.tsx
|
|
4490
|
-
var
|
|
4491
|
-
var TextAreaCompoundContext = (0,
|
|
4697
|
+
var import_react66 = require("react");
|
|
4698
|
+
var TextAreaCompoundContext = (0, import_react66.createContext)(null);
|
|
4492
4699
|
var useTextAreaCompoundContext = (componentName) => {
|
|
4493
|
-
const context = (0,
|
|
4700
|
+
const context = (0, import_react66.useContext)(TextAreaCompoundContext);
|
|
4494
4701
|
if (context == null) {
|
|
4495
4702
|
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`);
|
|
4496
4703
|
}
|
|
@@ -4498,10 +4705,10 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
4498
4705
|
};
|
|
4499
4706
|
|
|
4500
4707
|
// src/text-area/text-area-error-message.tsx
|
|
4501
|
-
var
|
|
4502
|
-
var
|
|
4503
|
-
var
|
|
4504
|
-
var TextAreaErrorMessage = (0,
|
|
4708
|
+
var import_clsx51 = require("clsx");
|
|
4709
|
+
var import_react67 = require("react");
|
|
4710
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4711
|
+
var TextAreaErrorMessage = (0, import_react67.forwardRef)(
|
|
4505
4712
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4506
4713
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
4507
4714
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -4509,26 +4716,26 @@ var TextAreaErrorMessage = (0, import_react64.forwardRef)(
|
|
|
4509
4716
|
if (!shouldRender) {
|
|
4510
4717
|
return null;
|
|
4511
4718
|
}
|
|
4512
|
-
const errorMessageClassName = (0,
|
|
4513
|
-
return /* @__PURE__ */ (0,
|
|
4719
|
+
const errorMessageClassName = (0, import_clsx51.clsx)(typographyClass, "text-supportError");
|
|
4720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
4514
4721
|
}
|
|
4515
4722
|
);
|
|
4516
4723
|
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
4517
4724
|
|
|
4518
4725
|
// src/text-area/text-area-helper-message.tsx
|
|
4519
|
-
var
|
|
4520
|
-
var
|
|
4521
|
-
var
|
|
4522
|
-
var TextAreaHelperMessage = (0,
|
|
4726
|
+
var import_clsx52 = require("clsx");
|
|
4727
|
+
var import_react68 = require("react");
|
|
4728
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4729
|
+
var TextAreaHelperMessage = (0, import_react68.forwardRef)((props, ref) => {
|
|
4523
4730
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
4524
4731
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
4525
|
-
const helperMessageClassName = (0,
|
|
4526
|
-
return /* @__PURE__ */ (0,
|
|
4732
|
+
const helperMessageClassName = (0, import_clsx52.clsx)(typographyClass, "text-text02");
|
|
4733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { ref, className: helperMessageClassName, ...props });
|
|
4527
4734
|
});
|
|
4528
4735
|
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
4529
4736
|
|
|
4530
4737
|
// src/text-area/text-area.tsx
|
|
4531
|
-
var
|
|
4738
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
4532
4739
|
function TextAreaInner({
|
|
4533
4740
|
size = "medium",
|
|
4534
4741
|
variant = "outline",
|
|
@@ -4545,8 +4752,8 @@ function TextAreaInner({
|
|
|
4545
4752
|
maxLength,
|
|
4546
4753
|
...props
|
|
4547
4754
|
}, ref) {
|
|
4548
|
-
const autoGeneratedId = (0,
|
|
4549
|
-
const textAreaPropsForContext = (0,
|
|
4755
|
+
const autoGeneratedId = (0, import_react69.useId)();
|
|
4756
|
+
const textAreaPropsForContext = (0, import_react69.useMemo)(
|
|
4550
4757
|
() => ({
|
|
4551
4758
|
size,
|
|
4552
4759
|
variant,
|
|
@@ -4554,7 +4761,7 @@ function TextAreaInner({
|
|
|
4554
4761
|
}),
|
|
4555
4762
|
[size, variant, isError]
|
|
4556
4763
|
);
|
|
4557
|
-
const contextValue = (0,
|
|
4764
|
+
const contextValue = (0, import_react69.useMemo)(
|
|
4558
4765
|
() => ({
|
|
4559
4766
|
textAreaProps: textAreaPropsForContext,
|
|
4560
4767
|
forwardedRef: ref
|
|
@@ -4564,21 +4771,21 @@ function TextAreaInner({
|
|
|
4564
4771
|
const helperMessageIds = [];
|
|
4565
4772
|
const errorIds = [];
|
|
4566
4773
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
4567
|
-
const enhancedChildren =
|
|
4568
|
-
if (!(0,
|
|
4774
|
+
const enhancedChildren = import_react69.Children.map(children, (child) => {
|
|
4775
|
+
if (!(0, import_react69.isValidElement)(child)) {
|
|
4569
4776
|
return child;
|
|
4570
4777
|
}
|
|
4571
4778
|
if (child.type === TextAreaHelperMessage) {
|
|
4572
4779
|
const helperChild = child;
|
|
4573
4780
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
4574
4781
|
helperMessageIds.push(assignedId);
|
|
4575
|
-
return (0,
|
|
4782
|
+
return (0, import_react69.cloneElement)(helperChild, { id: assignedId });
|
|
4576
4783
|
}
|
|
4577
4784
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
4578
4785
|
const errorChild = child;
|
|
4579
4786
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
4580
4787
|
errorIds.push(assignedId);
|
|
4581
|
-
return (0,
|
|
4788
|
+
return (0, import_react69.cloneElement)(errorChild, { id: assignedId });
|
|
4582
4789
|
}
|
|
4583
4790
|
return child;
|
|
4584
4791
|
});
|
|
@@ -4605,7 +4812,7 @@ function TextAreaInner({
|
|
|
4605
4812
|
...maxLengthProps
|
|
4606
4813
|
};
|
|
4607
4814
|
const isBorderless = variant === "text";
|
|
4608
|
-
const textAreaWrapperClassName = (0,
|
|
4815
|
+
const textAreaWrapperClassName = (0, import_clsx53.clsx)(
|
|
4609
4816
|
"box-border flex w-full overflow-hidden rounded border",
|
|
4610
4817
|
{
|
|
4611
4818
|
// outline variant
|
|
@@ -4621,7 +4828,7 @@ function TextAreaInner({
|
|
|
4621
4828
|
// className は variant="outline" のみ受け入れ、後方互換のため wrapper の末尾に合成(@deprecated)
|
|
4622
4829
|
!isBorderless && className
|
|
4623
4830
|
);
|
|
4624
|
-
const textAreaClassName = (0,
|
|
4831
|
+
const textAreaClassName = (0, import_clsx53.clsx)("w-full border-none bg-uiBackground01 outline-none", {
|
|
4625
4832
|
// outline: 従来の padding
|
|
4626
4833
|
"typography-body14regular px-2 py-2": !isBorderless && size === "medium",
|
|
4627
4834
|
"typography-body16regular px-3 py-2": !isBorderless && size === "large",
|
|
@@ -4640,7 +4847,7 @@ function TextAreaInner({
|
|
|
4640
4847
|
"resize-none": !isResizable
|
|
4641
4848
|
});
|
|
4642
4849
|
const hasHeight = height != null && String(height).trim().length > 0;
|
|
4643
|
-
const textAreaElement = /* @__PURE__ */ (0,
|
|
4850
|
+
const textAreaElement = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4644
4851
|
"div",
|
|
4645
4852
|
{
|
|
4646
4853
|
className: textAreaWrapperClassName,
|
|
@@ -4651,7 +4858,7 @@ function TextAreaInner({
|
|
|
4651
4858
|
...!autoHeight && hasHeight && !isResizable ? { height } : {},
|
|
4652
4859
|
...autoHeight && hasHeight ? { minHeight: height } : {}
|
|
4653
4860
|
},
|
|
4654
|
-
children: /* @__PURE__ */ (0,
|
|
4861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4655
4862
|
"textarea",
|
|
4656
4863
|
{
|
|
4657
4864
|
ref,
|
|
@@ -4667,11 +4874,11 @@ function TextAreaInner({
|
|
|
4667
4874
|
)
|
|
4668
4875
|
}
|
|
4669
4876
|
);
|
|
4670
|
-
const counterElement = isCounterVisible ? /* @__PURE__ */ (0,
|
|
4877
|
+
const counterElement = isCounterVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4671
4878
|
"div",
|
|
4672
4879
|
{
|
|
4673
4880
|
id: counterId,
|
|
4674
|
-
className: (0,
|
|
4881
|
+
className: (0, import_clsx53.clsx)(
|
|
4675
4882
|
"shrink-0",
|
|
4676
4883
|
size === "large" ? "typography-label13regular" : "typography-label12regular",
|
|
4677
4884
|
!disabled && isExceeded ? "text-supportError" : "text-text02"
|
|
@@ -4680,17 +4887,17 @@ function TextAreaInner({
|
|
|
4680
4887
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
4681
4888
|
}
|
|
4682
4889
|
) : null;
|
|
4683
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
4890
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react69.Children.toArray(enhancedChildren);
|
|
4684
4891
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
4685
4892
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
4686
4893
|
if (!hasBottomContent) {
|
|
4687
|
-
return /* @__PURE__ */ (0,
|
|
4894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TextAreaCompoundContext.Provider, { value: contextValue, children: textAreaElement });
|
|
4688
4895
|
}
|
|
4689
|
-
return /* @__PURE__ */ (0,
|
|
4896
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TextAreaCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
4690
4897
|
textAreaElement,
|
|
4691
|
-
/* @__PURE__ */ (0,
|
|
4692
|
-
hasMessageChildren && /* @__PURE__ */ (0,
|
|
4693
|
-
!hasMessageChildren && counterElement != null && /* @__PURE__ */ (0,
|
|
4898
|
+
/* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4899
|
+
hasMessageChildren && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex min-w-0 flex-1 flex-col gap-2", children: stackedChildren }),
|
|
4900
|
+
!hasMessageChildren && counterElement != null && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { className: "flex-1" }),
|
|
4694
4901
|
counterElement
|
|
4695
4902
|
] })
|
|
4696
4903
|
] }) });
|
|
@@ -4701,15 +4908,247 @@ var attachStatics2 = (component) => {
|
|
|
4701
4908
|
component.displayName = "TextArea";
|
|
4702
4909
|
return component;
|
|
4703
4910
|
};
|
|
4704
|
-
var TextAreaBase = (0,
|
|
4911
|
+
var TextAreaBase = (0, import_react69.forwardRef)(function TextAreaBase2(props, ref) {
|
|
4705
4912
|
return TextAreaInner(props, ref);
|
|
4706
4913
|
});
|
|
4707
4914
|
var TextArea = attachStatics2(TextAreaBase);
|
|
4708
4915
|
|
|
4916
|
+
// src/time-picker/time-picker.tsx
|
|
4917
|
+
var import_clsx55 = require("clsx");
|
|
4918
|
+
var import_react72 = require("react");
|
|
4919
|
+
|
|
4920
|
+
// src/time-picker/time-picker-context.tsx
|
|
4921
|
+
var import_react70 = require("react");
|
|
4922
|
+
var TimePickerCompoundContext = (0, import_react70.createContext)(null);
|
|
4923
|
+
var useTimePickerCompoundContext = (componentName) => {
|
|
4924
|
+
const context = (0, import_react70.useContext)(TimePickerCompoundContext);
|
|
4925
|
+
if (context == null) {
|
|
4926
|
+
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TimePicker \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
4927
|
+
}
|
|
4928
|
+
return context;
|
|
4929
|
+
};
|
|
4930
|
+
|
|
4931
|
+
// src/time-picker/time-picker-error-message.tsx
|
|
4932
|
+
var import_clsx54 = require("clsx");
|
|
4933
|
+
var import_react71 = require("react");
|
|
4934
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
4935
|
+
var TimePickerErrorMessage = (0, import_react71.forwardRef)(
|
|
4936
|
+
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4937
|
+
const { size, isError } = useTimePickerCompoundContext("TimePicker.ErrorMessage");
|
|
4938
|
+
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
4939
|
+
if (isError !== true) {
|
|
4940
|
+
return null;
|
|
4941
|
+
}
|
|
4942
|
+
const errorMessageClassName = (0, import_clsx54.clsx)(typographyClass, "text-supportError");
|
|
4943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
4944
|
+
}
|
|
4945
|
+
);
|
|
4946
|
+
TimePickerErrorMessage.displayName = "TimePicker.ErrorMessage";
|
|
4947
|
+
|
|
4948
|
+
// src/time-picker/time-picker-utils.ts
|
|
4949
|
+
var MIN_HOUR = 0;
|
|
4950
|
+
var MAX_HOUR = 23;
|
|
4951
|
+
var MIN_MINUTE = 0;
|
|
4952
|
+
var MAX_MINUTE = 59;
|
|
4953
|
+
var MINUTES_PER_HOUR = 60;
|
|
4954
|
+
var padZero = (value) => String(value).padStart(2, "0");
|
|
4955
|
+
var toTotalMinutes = (hour, minute) => hour * MINUTES_PER_HOUR + minute;
|
|
4956
|
+
var createHourOption = (hour) => ({
|
|
4957
|
+
id: `hour-${hour}`,
|
|
4958
|
+
value: String(hour),
|
|
4959
|
+
label: padZero(hour)
|
|
4960
|
+
});
|
|
4961
|
+
var createMinuteOption = (minute) => ({
|
|
4962
|
+
id: `minute-${minute}`,
|
|
4963
|
+
value: String(minute),
|
|
4964
|
+
label: padZero(minute)
|
|
4965
|
+
});
|
|
4966
|
+
var parseTime = (time) => {
|
|
4967
|
+
const match = /^(\d{1,2}):(\d{1,2})$/.exec(time);
|
|
4968
|
+
if (match == null) {
|
|
4969
|
+
return null;
|
|
4970
|
+
}
|
|
4971
|
+
const hour = Number(match[1]);
|
|
4972
|
+
const minute = Number(match[2]);
|
|
4973
|
+
if (Number.isNaN(hour) || Number.isNaN(minute)) {
|
|
4974
|
+
return null;
|
|
4975
|
+
}
|
|
4976
|
+
if (hour < MIN_HOUR || hour > MAX_HOUR || minute < MIN_MINUTE || minute > MAX_MINUTE) {
|
|
4977
|
+
return null;
|
|
4978
|
+
}
|
|
4979
|
+
return { hour, minute };
|
|
4980
|
+
};
|
|
4981
|
+
var formatTime = (value) => {
|
|
4982
|
+
if (value.hour == null || value.minute == null) {
|
|
4983
|
+
return null;
|
|
4984
|
+
}
|
|
4985
|
+
return `${padZero(value.hour)}:${padZero(value.minute)}`;
|
|
4986
|
+
};
|
|
4987
|
+
var isTimeInRange = (hour, minute, minTime, maxTime) => {
|
|
4988
|
+
const total = toTotalMinutes(hour, minute);
|
|
4989
|
+
const min = minTime != null ? parseTime(minTime) : null;
|
|
4990
|
+
const max = maxTime != null ? parseTime(maxTime) : null;
|
|
4991
|
+
if (min != null && total < toTotalMinutes(min.hour, min.minute)) {
|
|
4992
|
+
return false;
|
|
4993
|
+
}
|
|
4994
|
+
if (max != null && total > toTotalMinutes(max.hour, max.minute)) {
|
|
4995
|
+
return false;
|
|
4996
|
+
}
|
|
4997
|
+
return true;
|
|
4998
|
+
};
|
|
4999
|
+
var isMinuteAvailableForAnyHour = (minute, minTime, maxTime) => {
|
|
5000
|
+
for (let hour = MIN_HOUR; hour <= MAX_HOUR; hour += 1) {
|
|
5001
|
+
if (isTimeInRange(hour, minute, minTime, maxTime)) {
|
|
5002
|
+
return true;
|
|
5003
|
+
}
|
|
5004
|
+
}
|
|
5005
|
+
return false;
|
|
5006
|
+
};
|
|
5007
|
+
var generateMinuteOptions = (minuteStep, selectedHour, minTime, maxTime) => {
|
|
5008
|
+
const min = minTime != null ? parseTime(minTime) : null;
|
|
5009
|
+
const max = maxTime != null ? parseTime(maxTime) : null;
|
|
5010
|
+
const shouldFilterByRange = min != null || max != null;
|
|
5011
|
+
const options = [];
|
|
5012
|
+
for (let minute = MIN_MINUTE; minute <= MAX_MINUTE; minute += minuteStep) {
|
|
5013
|
+
if (shouldFilterByRange) {
|
|
5014
|
+
const isAvailable = selectedHour != null ? isTimeInRange(selectedHour, minute, minTime, maxTime) : isMinuteAvailableForAnyHour(minute, minTime, maxTime);
|
|
5015
|
+
if (!isAvailable) {
|
|
5016
|
+
continue;
|
|
5017
|
+
}
|
|
5018
|
+
}
|
|
5019
|
+
options.push(createMinuteOption(minute));
|
|
5020
|
+
}
|
|
5021
|
+
return options;
|
|
5022
|
+
};
|
|
5023
|
+
var generateHourOptions = (minuteStep, minTime, maxTime) => {
|
|
5024
|
+
const options = [];
|
|
5025
|
+
for (let hour = MIN_HOUR; hour <= MAX_HOUR; hour += 1) {
|
|
5026
|
+
if (generateMinuteOptions(minuteStep, hour, minTime, maxTime).length === 0) {
|
|
5027
|
+
continue;
|
|
5028
|
+
}
|
|
5029
|
+
options.push(createHourOption(hour));
|
|
5030
|
+
}
|
|
5031
|
+
return options;
|
|
5032
|
+
};
|
|
5033
|
+
|
|
5034
|
+
// src/time-picker/time-picker.tsx
|
|
5035
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
5036
|
+
var SELECT_WIDTH_BY_SIZE = {
|
|
5037
|
+
"x-small": 80,
|
|
5038
|
+
small: 80,
|
|
5039
|
+
medium: 80,
|
|
5040
|
+
large: 88
|
|
5041
|
+
};
|
|
5042
|
+
var PLACEHOLDER = "--";
|
|
5043
|
+
var HOUR_ARIA_LABEL = "\u6642";
|
|
5044
|
+
var MINUTE_ARIA_LABEL = "\u5206";
|
|
5045
|
+
var createTriggerAriaLabel = (baseLabel, selectedOption) => selectedOption != null ? `${baseLabel} ${selectedOption.label}` : baseLabel;
|
|
5046
|
+
var OPTION_LIST_MAX_HEIGHT = "250px";
|
|
5047
|
+
var TimePicker = ({
|
|
5048
|
+
value,
|
|
5049
|
+
onChange,
|
|
5050
|
+
size = "medium",
|
|
5051
|
+
minuteStep = 1,
|
|
5052
|
+
minTime,
|
|
5053
|
+
maxTime,
|
|
5054
|
+
isDisabled = false,
|
|
5055
|
+
isError = false,
|
|
5056
|
+
children
|
|
5057
|
+
}) => {
|
|
5058
|
+
const autoGeneratedId = (0, import_react72.useId)();
|
|
5059
|
+
const hourOptions = (0, import_react72.useMemo)(() => generateHourOptions(minuteStep, minTime, maxTime), [minuteStep, minTime, maxTime]);
|
|
5060
|
+
const minuteOptions = (0, import_react72.useMemo)(
|
|
5061
|
+
() => generateMinuteOptions(minuteStep, value.hour, minTime, maxTime),
|
|
5062
|
+
[minuteStep, value.hour, minTime, maxTime]
|
|
5063
|
+
);
|
|
5064
|
+
const selectedHourOption = value.hour != null ? createHourOption(value.hour) : null;
|
|
5065
|
+
const selectedMinuteOption = value.minute != null ? createMinuteOption(value.minute) : null;
|
|
5066
|
+
const handleHourChange = (option) => {
|
|
5067
|
+
const nextHour = option != null ? Number(option.value) : null;
|
|
5068
|
+
const shouldResetMinute = nextHour != null && value.minute != null && !isTimeInRange(nextHour, value.minute, minTime, maxTime);
|
|
5069
|
+
onChange({ hour: nextHour, minute: shouldResetMinute ? null : value.minute });
|
|
5070
|
+
};
|
|
5071
|
+
const handleMinuteChange = (option) => {
|
|
5072
|
+
onChange({ hour: value.hour, minute: option != null ? Number(option.value) : null });
|
|
5073
|
+
};
|
|
5074
|
+
const errorIds = [];
|
|
5075
|
+
const assignErrorIds = (nodes) => import_react72.Children.map(nodes, (child) => {
|
|
5076
|
+
if (!(0, import_react72.isValidElement)(child)) {
|
|
5077
|
+
return child;
|
|
5078
|
+
}
|
|
5079
|
+
if (child.type === import_react72.Fragment) {
|
|
5080
|
+
const fragmentChild = child;
|
|
5081
|
+
return (0, import_react72.cloneElement)(fragmentChild, {}, assignErrorIds(fragmentChild.props.children));
|
|
5082
|
+
}
|
|
5083
|
+
if (child.type === TimePickerErrorMessage && isError) {
|
|
5084
|
+
const errorChild = child;
|
|
5085
|
+
const assignedId = errorChild.props.id ?? `${autoGeneratedId}-error-${errorIds.length + 1}`;
|
|
5086
|
+
errorIds.push(assignedId);
|
|
5087
|
+
return (0, import_react72.cloneElement)(errorChild, { id: assignedId });
|
|
5088
|
+
}
|
|
5089
|
+
return child;
|
|
5090
|
+
});
|
|
5091
|
+
const enhancedChildren = assignErrorIds(children);
|
|
5092
|
+
const sharedAriaProps = errorIds.length > 0 ? { "aria-describedby": errorIds.join(" ") } : {};
|
|
5093
|
+
const separatorClasses = (0, import_clsx55.clsx)("text-text02", {
|
|
5094
|
+
"typography-label12regular": size === "x-small",
|
|
5095
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
5096
|
+
"typography-label16regular": size === "large"
|
|
5097
|
+
});
|
|
5098
|
+
const selectWidth = SELECT_WIDTH_BY_SIZE[size];
|
|
5099
|
+
const contextValue = (0, import_react72.useMemo)(() => ({ size, isError }), [size, isError]);
|
|
5100
|
+
const timeInputs = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5101
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5102
|
+
Select,
|
|
5103
|
+
{
|
|
5104
|
+
size,
|
|
5105
|
+
width: selectWidth,
|
|
5106
|
+
placeholder: PLACEHOLDER,
|
|
5107
|
+
selectedOption: selectedHourOption,
|
|
5108
|
+
isDisabled,
|
|
5109
|
+
isError,
|
|
5110
|
+
optionListMaxHeight: OPTION_LIST_MAX_HEIGHT,
|
|
5111
|
+
"aria-label": createTriggerAriaLabel(HOUR_ARIA_LABEL, selectedHourOption),
|
|
5112
|
+
...sharedAriaProps,
|
|
5113
|
+
onChange: handleHourChange,
|
|
5114
|
+
children: hourOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Select.Option, { option }, option.id))
|
|
5115
|
+
}
|
|
5116
|
+
),
|
|
5117
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { className: separatorClasses, children: ":" }),
|
|
5118
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5119
|
+
Select,
|
|
5120
|
+
{
|
|
5121
|
+
size,
|
|
5122
|
+
width: selectWidth,
|
|
5123
|
+
placeholder: PLACEHOLDER,
|
|
5124
|
+
selectedOption: selectedMinuteOption,
|
|
5125
|
+
isDisabled,
|
|
5126
|
+
isError,
|
|
5127
|
+
optionListMaxHeight: OPTION_LIST_MAX_HEIGHT,
|
|
5128
|
+
"aria-label": createTriggerAriaLabel(MINUTE_ARIA_LABEL, selectedMinuteOption),
|
|
5129
|
+
...sharedAriaProps,
|
|
5130
|
+
onChange: handleMinuteChange,
|
|
5131
|
+
children: minuteOptions.map((option) => /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Select.Option, { option }, option.id))
|
|
5132
|
+
}
|
|
5133
|
+
)
|
|
5134
|
+
] });
|
|
5135
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react72.Children.toArray(enhancedChildren);
|
|
5136
|
+
const hasMessageChildren = stackedChildren.length > 0;
|
|
5137
|
+
if (!hasMessageChildren) {
|
|
5138
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TimePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "flex flex-col", children: timeInputs }) });
|
|
5139
|
+
}
|
|
5140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(TimePickerCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
5141
|
+
timeInputs,
|
|
5142
|
+
stackedChildren
|
|
5143
|
+
] }) });
|
|
5144
|
+
};
|
|
5145
|
+
TimePicker.ErrorMessage = TimePickerErrorMessage;
|
|
5146
|
+
TimePicker.displayName = "TimePicker";
|
|
5147
|
+
|
|
4709
5148
|
// src/toast/toast.tsx
|
|
4710
|
-
var
|
|
4711
|
-
var
|
|
4712
|
-
var
|
|
5149
|
+
var import_clsx56 = __toESM(require("clsx"));
|
|
5150
|
+
var import_react73 = require("react");
|
|
5151
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
4713
5152
|
var CLOSE_TIME_MSEC = 5e3;
|
|
4714
5153
|
function Toast({
|
|
4715
5154
|
state = "information",
|
|
@@ -4719,8 +5158,8 @@ function Toast({
|
|
|
4719
5158
|
children,
|
|
4720
5159
|
onClickClose
|
|
4721
5160
|
}) {
|
|
4722
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
4723
|
-
const handleClose = (0,
|
|
5161
|
+
const [isRemoving, setIsRemoving] = (0, import_react73.useState)(false);
|
|
5162
|
+
const handleClose = (0, import_react73.useCallback)(() => {
|
|
4724
5163
|
if (isAnimation) {
|
|
4725
5164
|
setIsRemoving(true);
|
|
4726
5165
|
} else {
|
|
@@ -4728,17 +5167,17 @@ function Toast({
|
|
|
4728
5167
|
}
|
|
4729
5168
|
}, [isAnimation, onClickClose]);
|
|
4730
5169
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
4731
|
-
const wrapperClasses = (0,
|
|
5170
|
+
const wrapperClasses = (0, import_clsx56.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
4732
5171
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
4733
5172
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
4734
5173
|
});
|
|
4735
|
-
const iconClasses = (0,
|
|
5174
|
+
const iconClasses = (0, import_clsx56.default)("flex items-center", {
|
|
4736
5175
|
"fill-supportSuccess": state === "success",
|
|
4737
5176
|
"fill-supportError": state === "error",
|
|
4738
5177
|
"fill-supportWarning": state === "warning",
|
|
4739
5178
|
"fill-supportInfo": state === "information"
|
|
4740
5179
|
});
|
|
4741
|
-
const textClasses = (0,
|
|
5180
|
+
const textClasses = (0, import_clsx56.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
4742
5181
|
"text-supportError": state === "error",
|
|
4743
5182
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
4744
5183
|
});
|
|
@@ -4748,7 +5187,7 @@ function Toast({
|
|
|
4748
5187
|
warning: "warning",
|
|
4749
5188
|
information: "information-filled"
|
|
4750
5189
|
};
|
|
4751
|
-
(0,
|
|
5190
|
+
(0, import_react73.useEffect)(() => {
|
|
4752
5191
|
const timer = window.setTimeout(() => {
|
|
4753
5192
|
if (isAutoClose) {
|
|
4754
5193
|
setIsRemoving(true);
|
|
@@ -4756,45 +5195,45 @@ function Toast({
|
|
|
4756
5195
|
}, CLOSE_TIME_MSEC);
|
|
4757
5196
|
return () => window.clearTimeout(timer);
|
|
4758
5197
|
}, [isAutoClose]);
|
|
4759
|
-
return /* @__PURE__ */ (0,
|
|
4760
|
-
/* @__PURE__ */ (0,
|
|
4761
|
-
/* @__PURE__ */ (0,
|
|
4762
|
-
/* @__PURE__ */ (0,
|
|
5198
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
5199
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Icon, { name: iconName[state] }) }),
|
|
5200
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("p", { className: textClasses, children }),
|
|
5201
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
4763
5202
|
] });
|
|
4764
5203
|
}
|
|
4765
5204
|
|
|
4766
5205
|
// src/toast/toast-provider.tsx
|
|
4767
|
-
var
|
|
5206
|
+
var import_react74 = require("react");
|
|
4768
5207
|
var import_react_dom3 = require("react-dom");
|
|
4769
|
-
var
|
|
4770
|
-
var ToastContext = (0,
|
|
5208
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5209
|
+
var ToastContext = (0, import_react74.createContext)({});
|
|
4771
5210
|
var ToastProvider = ({ children }) => {
|
|
4772
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
4773
|
-
const [toasts, setToasts] = (0,
|
|
4774
|
-
const addToast = (0,
|
|
5211
|
+
const [isClientRender, setIsClientRender] = (0, import_react74.useState)(false);
|
|
5212
|
+
const [toasts, setToasts] = (0, import_react74.useState)([]);
|
|
5213
|
+
const addToast = (0, import_react74.useCallback)(({ message, state }) => {
|
|
4775
5214
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
4776
5215
|
}, []);
|
|
4777
|
-
const removeToast = (0,
|
|
5216
|
+
const removeToast = (0, import_react74.useCallback)((id) => {
|
|
4778
5217
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
4779
5218
|
}, []);
|
|
4780
|
-
(0,
|
|
5219
|
+
(0, import_react74.useEffect)(() => {
|
|
4781
5220
|
setIsClientRender(true);
|
|
4782
5221
|
}, []);
|
|
4783
|
-
return /* @__PURE__ */ (0,
|
|
5222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
4784
5223
|
children,
|
|
4785
5224
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
4786
|
-
/* @__PURE__ */ (0,
|
|
5225
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("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__ */ (0, import_jsx_runtime80.jsx)(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
4787
5226
|
document.body
|
|
4788
5227
|
)
|
|
4789
5228
|
] });
|
|
4790
5229
|
};
|
|
4791
5230
|
var useToast = () => {
|
|
4792
|
-
return (0,
|
|
5231
|
+
return (0, import_react74.useContext)(ToastContext);
|
|
4793
5232
|
};
|
|
4794
5233
|
|
|
4795
5234
|
// src/toggle/toggle.tsx
|
|
4796
|
-
var
|
|
4797
|
-
var
|
|
5235
|
+
var import_clsx57 = __toESM(require("clsx"));
|
|
5236
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
4798
5237
|
function Toggle({
|
|
4799
5238
|
id,
|
|
4800
5239
|
size = "medium",
|
|
@@ -4804,7 +5243,7 @@ function Toggle({
|
|
|
4804
5243
|
labelPosition = "right",
|
|
4805
5244
|
isDisabled = false
|
|
4806
5245
|
}) {
|
|
4807
|
-
const baseClasses = (0,
|
|
5246
|
+
const baseClasses = (0, import_clsx57.default)("relative flex items-center rounded-full", {
|
|
4808
5247
|
"bg-disabledOn": isDisabled && isChecked,
|
|
4809
5248
|
"bg-disabled01": isDisabled && !isChecked,
|
|
4810
5249
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -4812,16 +5251,16 @@ function Toggle({
|
|
|
4812
5251
|
"w-8 h-4 px-[3px]": size === "small",
|
|
4813
5252
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
4814
5253
|
});
|
|
4815
|
-
const inputClasses = (0,
|
|
5254
|
+
const inputClasses = (0, import_clsx57.default)(
|
|
4816
5255
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
4817
5256
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
4818
5257
|
);
|
|
4819
|
-
const indicatorClasses = (0,
|
|
5258
|
+
const indicatorClasses = (0, import_clsx57.default)("rounded-full bg-iconOnColor", {
|
|
4820
5259
|
"w-2.5 h-2.5": size === "small",
|
|
4821
5260
|
"w-4 h-4": size === "medium" || size === "large",
|
|
4822
5261
|
"ml-auto": isChecked
|
|
4823
5262
|
});
|
|
4824
|
-
const labelClasses = (0,
|
|
5263
|
+
const labelClasses = (0, import_clsx57.default)("break-all", {
|
|
4825
5264
|
"mr-2": labelPosition === "left",
|
|
4826
5265
|
"ml-2": labelPosition === "right",
|
|
4827
5266
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -4829,9 +5268,9 @@ function Toggle({
|
|
|
4829
5268
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
4830
5269
|
"cursor-pointer text-text01": !isDisabled
|
|
4831
5270
|
});
|
|
4832
|
-
return /* @__PURE__ */ (0,
|
|
4833
|
-
label != null && labelPosition === "left" && /* @__PURE__ */ (0,
|
|
4834
|
-
/* @__PURE__ */ (0,
|
|
5271
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
5272
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
5273
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
4835
5274
|
"input",
|
|
4836
5275
|
{
|
|
4837
5276
|
className: inputClasses,
|
|
@@ -4843,23 +5282,23 @@ function Toggle({
|
|
|
4843
5282
|
disabled: isDisabled
|
|
4844
5283
|
}
|
|
4845
5284
|
),
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4847
|
-
label != null && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
5285
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { className: baseClasses, children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: indicatorClasses }) }),
|
|
5286
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
4848
5287
|
] });
|
|
4849
5288
|
}
|
|
4850
5289
|
|
|
4851
5290
|
// src/tooltip/tooltip.tsx
|
|
4852
|
-
var
|
|
5291
|
+
var import_react76 = require("react");
|
|
4853
5292
|
var import_react_dom4 = require("react-dom");
|
|
4854
5293
|
|
|
4855
5294
|
// src/tooltip/tooltip-content.tsx
|
|
4856
|
-
var
|
|
5295
|
+
var import_clsx59 = __toESM(require("clsx"));
|
|
4857
5296
|
|
|
4858
5297
|
// src/tooltip/tail-icon.tsx
|
|
4859
|
-
var
|
|
4860
|
-
var
|
|
5298
|
+
var import_clsx58 = __toESM(require("clsx"));
|
|
5299
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4861
5300
|
var TailIcon = (props) => {
|
|
4862
|
-
const tailClasses = (0,
|
|
5301
|
+
const tailClasses = (0, import_clsx58.default)("absolute fill-uiBackgroundTooltip", {
|
|
4863
5302
|
"rotate-180": props.verticalPosition === "bottom",
|
|
4864
5303
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
4865
5304
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -4874,9 +5313,9 @@ var TailIcon = (props) => {
|
|
|
4874
5313
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
4875
5314
|
});
|
|
4876
5315
|
if (props.size === "small") {
|
|
4877
|
-
return /* @__PURE__ */ (0,
|
|
5316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
4878
5317
|
} else {
|
|
4879
|
-
return /* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4880
5319
|
"svg",
|
|
4881
5320
|
{
|
|
4882
5321
|
className: tailClasses,
|
|
@@ -4885,14 +5324,14 @@ var TailIcon = (props) => {
|
|
|
4885
5324
|
viewBox: "0 0 14 8",
|
|
4886
5325
|
fill: "none",
|
|
4887
5326
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4888
|
-
children: /* @__PURE__ */ (0,
|
|
5327
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
4889
5328
|
}
|
|
4890
5329
|
);
|
|
4891
5330
|
}
|
|
4892
5331
|
};
|
|
4893
5332
|
|
|
4894
5333
|
// src/tooltip/tooltip-content.tsx
|
|
4895
|
-
var
|
|
5334
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
4896
5335
|
var TooltipContent = ({
|
|
4897
5336
|
content,
|
|
4898
5337
|
horizontalAlign,
|
|
@@ -4902,7 +5341,7 @@ var TooltipContent = ({
|
|
|
4902
5341
|
maxWidth,
|
|
4903
5342
|
isPortal = false
|
|
4904
5343
|
}) => {
|
|
4905
|
-
const tooltipWrapperClasses = (0,
|
|
5344
|
+
const tooltipWrapperClasses = (0, import_clsx59.default)("absolute z-tooltip m-auto flex", {
|
|
4906
5345
|
"top-0": !isPortal && verticalPosition === "top",
|
|
4907
5346
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
4908
5347
|
"justify-start": horizontalAlign === "left",
|
|
@@ -4911,7 +5350,7 @@ var TooltipContent = ({
|
|
|
4911
5350
|
"w-[24px]": size === "small",
|
|
4912
5351
|
"w-[46px]": size !== "small"
|
|
4913
5352
|
});
|
|
4914
|
-
const tooltipBodyClasses = (0,
|
|
5353
|
+
const tooltipBodyClasses = (0, import_clsx59.default)(
|
|
4915
5354
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
4916
5355
|
{
|
|
4917
5356
|
"typography-body12regular": size === "small",
|
|
@@ -4928,7 +5367,7 @@ var TooltipContent = ({
|
|
|
4928
5367
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
4929
5368
|
...tooltipPosition
|
|
4930
5369
|
} : {};
|
|
4931
|
-
return /* @__PURE__ */ (0,
|
|
5370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
4932
5371
|
"div",
|
|
4933
5372
|
{
|
|
4934
5373
|
className: tooltipBodyClasses,
|
|
@@ -4937,16 +5376,16 @@ var TooltipContent = ({
|
|
|
4937
5376
|
},
|
|
4938
5377
|
children: [
|
|
4939
5378
|
content,
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
5379
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
4941
5380
|
]
|
|
4942
5381
|
}
|
|
4943
5382
|
) });
|
|
4944
5383
|
};
|
|
4945
5384
|
|
|
4946
5385
|
// src/tooltip/tooltip-hook.ts
|
|
4947
|
-
var
|
|
5386
|
+
var import_react75 = require("react");
|
|
4948
5387
|
var useTooltip = () => {
|
|
4949
|
-
const calculatePosition = (0,
|
|
5388
|
+
const calculatePosition = (0, import_react75.useCallback)(
|
|
4950
5389
|
(args) => {
|
|
4951
5390
|
const result = {
|
|
4952
5391
|
maxWidth: "none",
|
|
@@ -4998,7 +5437,7 @@ var useTooltip = () => {
|
|
|
4998
5437
|
};
|
|
4999
5438
|
|
|
5000
5439
|
// src/tooltip/tooltip.tsx
|
|
5001
|
-
var
|
|
5440
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5002
5441
|
function Tooltip({
|
|
5003
5442
|
children,
|
|
5004
5443
|
content,
|
|
@@ -5010,8 +5449,8 @@ function Tooltip({
|
|
|
5010
5449
|
portalTarget
|
|
5011
5450
|
}) {
|
|
5012
5451
|
const { calculatePosition } = useTooltip();
|
|
5013
|
-
const [isVisible, setIsVisible] = (0,
|
|
5014
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
5452
|
+
const [isVisible, setIsVisible] = (0, import_react76.useState)(false);
|
|
5453
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react76.useState)({
|
|
5015
5454
|
maxWidth: "none",
|
|
5016
5455
|
width: "auto",
|
|
5017
5456
|
left: "0px",
|
|
@@ -5020,8 +5459,8 @@ function Tooltip({
|
|
|
5020
5459
|
translateX: "0",
|
|
5021
5460
|
translateY: "0"
|
|
5022
5461
|
});
|
|
5023
|
-
const targetRef = (0,
|
|
5024
|
-
const handleMouseOverWrapper = (0,
|
|
5462
|
+
const targetRef = (0, import_react76.useRef)(null);
|
|
5463
|
+
const handleMouseOverWrapper = (0, import_react76.useCallback)(() => {
|
|
5025
5464
|
if (isDisabledHover) {
|
|
5026
5465
|
return;
|
|
5027
5466
|
}
|
|
@@ -5038,16 +5477,16 @@ function Tooltip({
|
|
|
5038
5477
|
}
|
|
5039
5478
|
setIsVisible(true);
|
|
5040
5479
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5041
|
-
const handleMouseOutWrapper = (0,
|
|
5480
|
+
const handleMouseOutWrapper = (0, import_react76.useCallback)(() => {
|
|
5042
5481
|
setIsVisible(false);
|
|
5043
5482
|
}, []);
|
|
5044
|
-
(0,
|
|
5483
|
+
(0, import_react76.useEffect)(() => {
|
|
5045
5484
|
if (targetRef.current === null) return;
|
|
5046
5485
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
5047
5486
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
5048
5487
|
setTooltipPosition(position);
|
|
5049
5488
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
5050
|
-
(0,
|
|
5489
|
+
(0, import_react76.useEffect)(() => {
|
|
5051
5490
|
if (!isVisible) return;
|
|
5052
5491
|
const updatePosition = () => {
|
|
5053
5492
|
if (targetRef.current === null) return;
|
|
@@ -5068,7 +5507,7 @@ function Tooltip({
|
|
|
5068
5507
|
window.removeEventListener("resize", updatePosition);
|
|
5069
5508
|
};
|
|
5070
5509
|
}, [isVisible, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5071
|
-
return /* @__PURE__ */ (0,
|
|
5510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
5072
5511
|
"div",
|
|
5073
5512
|
{
|
|
5074
5513
|
ref: targetRef,
|
|
@@ -5077,7 +5516,7 @@ function Tooltip({
|
|
|
5077
5516
|
onMouseLeave: handleMouseOutWrapper,
|
|
5078
5517
|
children: [
|
|
5079
5518
|
children,
|
|
5080
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */ (0,
|
|
5519
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5081
5520
|
TooltipContent,
|
|
5082
5521
|
{
|
|
5083
5522
|
content,
|
|
@@ -5088,7 +5527,7 @@ function Tooltip({
|
|
|
5088
5527
|
tooltipPosition
|
|
5089
5528
|
}
|
|
5090
5529
|
) : (0, import_react_dom4.createPortal)(
|
|
5091
|
-
/* @__PURE__ */ (0,
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5092
5531
|
TooltipContent,
|
|
5093
5532
|
{
|
|
5094
5533
|
isPortal: true,
|
|
@@ -5133,6 +5572,7 @@ function Tooltip({
|
|
|
5133
5572
|
PopoverTrigger,
|
|
5134
5573
|
Popup,
|
|
5135
5574
|
Radio,
|
|
5575
|
+
RadioCard,
|
|
5136
5576
|
Search,
|
|
5137
5577
|
SegmentedControl,
|
|
5138
5578
|
Select,
|
|
@@ -5147,10 +5587,13 @@ function Tooltip({
|
|
|
5147
5587
|
Tag,
|
|
5148
5588
|
TextArea,
|
|
5149
5589
|
TextInput,
|
|
5590
|
+
TimePicker,
|
|
5150
5591
|
Toast,
|
|
5151
5592
|
ToastProvider,
|
|
5152
5593
|
Toggle,
|
|
5153
5594
|
Tooltip,
|
|
5595
|
+
formatTime,
|
|
5596
|
+
parseTime,
|
|
5154
5597
|
useOutsideClick,
|
|
5155
5598
|
useRovingFocus,
|
|
5156
5599
|
useToast
|