@zenkigen-inc/component-ui 1.21.1 → 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 +139 -4
- package/dist/index.d.ts +139 -4
- package/dist/index.js +724 -279
- package/dist/index.mjs +670 -229
- 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
|
|
@@ -3039,22 +3043,35 @@ Modal.Footer = ModalFooter;
|
|
|
3039
3043
|
// src/notification-inline/notification-inline.tsx
|
|
3040
3044
|
var import_clsx29 = require("clsx");
|
|
3041
3045
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3042
|
-
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
3043
|
-
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", {
|
|
3044
3049
|
"bg-uiBackgroundError": state === "attention",
|
|
3045
3050
|
"bg-uiBackgroundWarning": state === "warning",
|
|
3046
3051
|
"bg-uiBackgroundBlue": state === "information",
|
|
3047
3052
|
"bg-uiBackgroundSuccess": state === "success",
|
|
3048
3053
|
"bg-uiBackgroundGray": state === "default",
|
|
3049
|
-
|
|
3050
|
-
|
|
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"
|
|
3051
3064
|
});
|
|
3052
|
-
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",
|
|
3053
3067
|
"fill-supportError": state === "attention",
|
|
3054
3068
|
"fill-supportWarning": state === "warning",
|
|
3055
3069
|
"fill-blue-blue50": state === "information",
|
|
3056
3070
|
"fill-supportSuccess": state === "success"
|
|
3057
3071
|
});
|
|
3072
|
+
const textClasses = (0, import_clsx29.clsx)("flex-1", {
|
|
3073
|
+
"pt-[2px]": size === "medium" && state !== "default"
|
|
3074
|
+
});
|
|
3058
3075
|
const iconName = {
|
|
3059
3076
|
attention: "attention",
|
|
3060
3077
|
success: "success-filled",
|
|
@@ -3066,9 +3083,11 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
3066
3083
|
medium: "medium"
|
|
3067
3084
|
};
|
|
3068
3085
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: wrapperClasses, children: [
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
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 }) })
|
|
3072
3091
|
] });
|
|
3073
3092
|
}
|
|
3074
3093
|
|
|
@@ -3280,7 +3299,9 @@ function Select({
|
|
|
3280
3299
|
isOptionSelected = false,
|
|
3281
3300
|
onChange,
|
|
3282
3301
|
optionListMaxHeight,
|
|
3283
|
-
matchListToTrigger = false
|
|
3302
|
+
matchListToTrigger = false,
|
|
3303
|
+
"aria-label": ariaLabel,
|
|
3304
|
+
"aria-describedby": ariaDescribedby
|
|
3284
3305
|
}) {
|
|
3285
3306
|
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react47.useState)(false);
|
|
3286
3307
|
const targetRef = (0, import_react47.useRef)(null);
|
|
@@ -3341,6 +3362,7 @@ function Select({
|
|
|
3341
3362
|
"typography-label14regular": size === "small" || size === "medium",
|
|
3342
3363
|
"typography-label16regular": size === "large"
|
|
3343
3364
|
});
|
|
3365
|
+
const ariaInvalidProps = isError ? { "aria-invalid": true } : {};
|
|
3344
3366
|
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3345
3367
|
SelectContext.Provider,
|
|
3346
3368
|
{
|
|
@@ -3362,6 +3384,9 @@ function Select({
|
|
|
3362
3384
|
ref: refs.setReference,
|
|
3363
3385
|
className: buttonClasses,
|
|
3364
3386
|
type: "button",
|
|
3387
|
+
"aria-label": ariaLabel,
|
|
3388
|
+
"aria-describedby": ariaDescribedby,
|
|
3389
|
+
...ariaInvalidProps,
|
|
3365
3390
|
onClick: handleClickToggle,
|
|
3366
3391
|
disabled: isDisabled,
|
|
3367
3392
|
children: [
|
|
@@ -3670,23 +3695,207 @@ function Radio({
|
|
|
3670
3695
|
] });
|
|
3671
3696
|
}
|
|
3672
3697
|
|
|
3673
|
-
// src/
|
|
3674
|
-
var
|
|
3698
|
+
// src/radio-card/radio-card.tsx
|
|
3699
|
+
var import_react55 = require("react");
|
|
3700
|
+
|
|
3701
|
+
// src/radio-card/radio-card-context.ts
|
|
3675
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
|
|
3676
3713
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
3677
|
-
|
|
3678
|
-
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)(
|
|
3679
3888
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
3680
3889
|
{ "h-8 px-3": size === "medium" },
|
|
3681
3890
|
{ "h-10 px-4": size === "large" }
|
|
3682
3891
|
);
|
|
3683
|
-
const inputClasses = (0,
|
|
3892
|
+
const inputClasses = (0, import_clsx36.clsx)("mx-2 h-full flex-1 text-text01 outline-none placeholder:text-textPlaceholder", {
|
|
3684
3893
|
["typography-label14regular"]: size === "medium",
|
|
3685
3894
|
["typography-label16regular"]: size === "large"
|
|
3686
3895
|
});
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3688
|
-
/* @__PURE__ */ (0,
|
|
3689
|
-
/* @__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)(
|
|
3690
3899
|
"input",
|
|
3691
3900
|
{
|
|
3692
3901
|
type: "text",
|
|
@@ -3697,7 +3906,7 @@ var Search = (0, import_react53.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3697
3906
|
onChange: props.onChange
|
|
3698
3907
|
}
|
|
3699
3908
|
),
|
|
3700
|
-
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)(
|
|
3701
3910
|
IconButton,
|
|
3702
3911
|
{
|
|
3703
3912
|
variant: "text",
|
|
@@ -3712,17 +3921,17 @@ var Search = (0, import_react53.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3712
3921
|
Search.displayName = "Search";
|
|
3713
3922
|
|
|
3714
3923
|
// src/segmented-control/segmented-control.tsx
|
|
3715
|
-
var
|
|
3924
|
+
var import_react59 = __toESM(require("react"));
|
|
3716
3925
|
|
|
3717
3926
|
// src/segmented-control/segmented-control-context.ts
|
|
3718
|
-
var
|
|
3719
|
-
var SegmentedControlContext = (0,
|
|
3927
|
+
var import_react57 = require("react");
|
|
3928
|
+
var SegmentedControlContext = (0, import_react57.createContext)(null);
|
|
3720
3929
|
|
|
3721
3930
|
// src/segmented-control/segmented-control-item.tsx
|
|
3722
|
-
var
|
|
3723
|
-
var
|
|
3724
|
-
var
|
|
3725
|
-
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");
|
|
3726
3935
|
var SegmentedControlItem = ({
|
|
3727
3936
|
label,
|
|
3728
3937
|
value,
|
|
@@ -3731,9 +3940,9 @@ var SegmentedControlItem = ({
|
|
|
3731
3940
|
"aria-label": ariaLabel,
|
|
3732
3941
|
...rest
|
|
3733
3942
|
}) => {
|
|
3734
|
-
const context = (0,
|
|
3735
|
-
const buttonRef = (0,
|
|
3736
|
-
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);
|
|
3737
3946
|
if (context === null) {
|
|
3738
3947
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
3739
3948
|
}
|
|
@@ -3749,7 +3958,7 @@ var SegmentedControlItem = ({
|
|
|
3749
3958
|
const isSelected = value === selectedValue;
|
|
3750
3959
|
const isFocused = value === focusedValue;
|
|
3751
3960
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
3752
|
-
(0,
|
|
3961
|
+
(0, import_react58.useEffect)(() => {
|
|
3753
3962
|
if (isFocused === true && buttonRef.current !== null) {
|
|
3754
3963
|
buttonRef.current.focus();
|
|
3755
3964
|
}
|
|
@@ -3771,7 +3980,7 @@ var SegmentedControlItem = ({
|
|
|
3771
3980
|
lastInteractionWasMouse.current = false;
|
|
3772
3981
|
onBlur?.();
|
|
3773
3982
|
};
|
|
3774
|
-
const buttonClasses = (0,
|
|
3983
|
+
const buttonClasses = (0, import_clsx37.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme16.focusVisible.normal, {
|
|
3775
3984
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
3776
3985
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
3777
3986
|
// States - Default with hover
|
|
@@ -3781,7 +3990,7 @@ var SegmentedControlItem = ({
|
|
|
3781
3990
|
// States - Disabled
|
|
3782
3991
|
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
3783
3992
|
});
|
|
3784
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
3785
3994
|
"button",
|
|
3786
3995
|
{
|
|
3787
3996
|
ref: buttonRef,
|
|
@@ -3798,25 +4007,25 @@ var SegmentedControlItem = ({
|
|
|
3798
4007
|
onMouseDown: handleMouseDown,
|
|
3799
4008
|
...rest,
|
|
3800
4009
|
children: [
|
|
3801
|
-
Boolean(icon) === true && icon && /* @__PURE__ */ (0,
|
|
4010
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3802
4011
|
"span",
|
|
3803
4012
|
{
|
|
3804
|
-
className: (0,
|
|
4013
|
+
className: (0, import_clsx37.clsx)("flex items-center", {
|
|
3805
4014
|
"fill-disabled01": isOptionDisabled === true,
|
|
3806
4015
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
3807
4016
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
3808
4017
|
}),
|
|
3809
|
-
children: /* @__PURE__ */ (0,
|
|
4018
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Icon, { name: icon, size: "small" })
|
|
3810
4019
|
}
|
|
3811
4020
|
),
|
|
3812
|
-
Boolean(label) === true && /* @__PURE__ */ (0,
|
|
4021
|
+
Boolean(label) === true && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
3813
4022
|
]
|
|
3814
4023
|
}
|
|
3815
4024
|
);
|
|
3816
4025
|
};
|
|
3817
4026
|
|
|
3818
4027
|
// src/segmented-control/segmented-control.tsx
|
|
3819
|
-
var
|
|
4028
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3820
4029
|
var SegmentedControl = ({
|
|
3821
4030
|
children,
|
|
3822
4031
|
value,
|
|
@@ -3826,15 +4035,15 @@ var SegmentedControl = ({
|
|
|
3826
4035
|
"aria-label": ariaLabel,
|
|
3827
4036
|
...rest
|
|
3828
4037
|
}) => {
|
|
3829
|
-
const containerRef = (0,
|
|
3830
|
-
const itemIds =
|
|
3831
|
-
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)) {
|
|
3832
4041
|
return false;
|
|
3833
4042
|
}
|
|
3834
4043
|
const props = child.props;
|
|
3835
4044
|
return props.isDisabled !== true;
|
|
3836
4045
|
}).map((child) => child.props.value);
|
|
3837
|
-
const childrenCount =
|
|
4046
|
+
const childrenCount = import_react59.Children.count(children);
|
|
3838
4047
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
3839
4048
|
const {
|
|
3840
4049
|
focusedValue,
|
|
@@ -3861,7 +4070,7 @@ var SegmentedControl = ({
|
|
|
3861
4070
|
onBlur: handleBlurRovingFocus,
|
|
3862
4071
|
values: itemIds
|
|
3863
4072
|
};
|
|
3864
|
-
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)(
|
|
3865
4074
|
"div",
|
|
3866
4075
|
{
|
|
3867
4076
|
ref: containerRef,
|
|
@@ -3878,22 +4087,22 @@ var SegmentedControl = ({
|
|
|
3878
4087
|
SegmentedControl.Item = SegmentedControlItem;
|
|
3879
4088
|
|
|
3880
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
|
|
3881
4095
|
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
3882
4096
|
var import_clsx39 = __toESM(require("clsx"));
|
|
3883
|
-
var import_react57 = require("react");
|
|
3884
4097
|
|
|
3885
|
-
// src/select-sort/select-
|
|
4098
|
+
// src/select-sort/select-item.tsx
|
|
3886
4099
|
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
3887
4100
|
var import_clsx38 = __toESM(require("clsx"));
|
|
3888
|
-
|
|
3889
|
-
// src/select-sort/select-item.tsx
|
|
3890
|
-
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
3891
|
-
var import_clsx37 = __toESM(require("clsx"));
|
|
3892
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
4101
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3893
4102
|
function SelectItem2({ children, isSortKey, size, onClickItem }) {
|
|
3894
|
-
const itemClasses = (0,
|
|
4103
|
+
const itemClasses = (0, import_clsx38.default)(
|
|
3895
4104
|
"typography-label14regular flex w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
3896
|
-
|
|
4105
|
+
import_component_theme17.focusVisible.inset,
|
|
3897
4106
|
{
|
|
3898
4107
|
"h-8": size !== "large",
|
|
3899
4108
|
"h-10": size === "large",
|
|
@@ -3901,16 +4110,16 @@ function SelectItem2({ children, isSortKey, size, onClickItem }) {
|
|
|
3901
4110
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
3902
4111
|
}
|
|
3903
4112
|
);
|
|
3904
|
-
return /* @__PURE__ */ (0,
|
|
3905
|
-
/* @__PURE__ */ (0,
|
|
3906
|
-
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" }) })
|
|
3907
4116
|
] }) });
|
|
3908
4117
|
}
|
|
3909
4118
|
|
|
3910
4119
|
// src/select-sort/select-list.tsx
|
|
3911
|
-
var
|
|
4120
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3912
4121
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
3913
|
-
const listClasses = (0,
|
|
4122
|
+
const listClasses = (0, import_clsx39.default)(
|
|
3914
4123
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
3915
4124
|
{
|
|
3916
4125
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -3919,23 +4128,23 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
3919
4128
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
3920
4129
|
}
|
|
3921
4130
|
);
|
|
3922
|
-
const deselectButtonClasses = (0,
|
|
4131
|
+
const deselectButtonClasses = (0, import_clsx39.default)(
|
|
3923
4132
|
"typography-label14regular flex w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
3924
|
-
|
|
4133
|
+
import_component_theme18.focusVisible.inset,
|
|
3925
4134
|
{
|
|
3926
4135
|
"h-8": size !== "large",
|
|
3927
4136
|
"h-10": size === "large"
|
|
3928
4137
|
}
|
|
3929
4138
|
);
|
|
3930
|
-
return /* @__PURE__ */ (0,
|
|
3931
|
-
/* @__PURE__ */ (0,
|
|
3932
|
-
/* @__PURE__ */ (0,
|
|
3933
|
-
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" }) })
|
|
3934
4143
|
] });
|
|
3935
4144
|
}
|
|
3936
4145
|
|
|
3937
4146
|
// src/select-sort/select-sort.tsx
|
|
3938
|
-
var
|
|
4147
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
3939
4148
|
function SelectSort({
|
|
3940
4149
|
size = "medium",
|
|
3941
4150
|
variant = "outline",
|
|
@@ -3947,8 +4156,8 @@ function SelectSort({
|
|
|
3947
4156
|
onChange,
|
|
3948
4157
|
onClickDeselect
|
|
3949
4158
|
}) {
|
|
3950
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
3951
|
-
const targetRef = (0,
|
|
4159
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react60.useState)(false);
|
|
4160
|
+
const targetRef = (0, import_react60.useRef)(null);
|
|
3952
4161
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
3953
4162
|
useDismissOnModalOpen(() => {
|
|
3954
4163
|
if (isOptionListOpen) {
|
|
@@ -3956,50 +4165,50 @@ function SelectSort({
|
|
|
3956
4165
|
}
|
|
3957
4166
|
});
|
|
3958
4167
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
3959
|
-
const handleClickItem = (0,
|
|
4168
|
+
const handleClickItem = (0, import_react60.useCallback)(
|
|
3960
4169
|
(value) => {
|
|
3961
4170
|
onChange?.(value);
|
|
3962
4171
|
setIsOptionListOpen(false);
|
|
3963
4172
|
},
|
|
3964
4173
|
[onChange]
|
|
3965
4174
|
);
|
|
3966
|
-
const wrapperClasses = (0,
|
|
4175
|
+
const wrapperClasses = (0, import_clsx40.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
3967
4176
|
"h-6": size === "x-small" || size === "small",
|
|
3968
4177
|
"h-8": size === "medium",
|
|
3969
4178
|
"h-10": size === "large",
|
|
3970
4179
|
"cursor-not-allowed": isDisabled
|
|
3971
4180
|
});
|
|
3972
|
-
const buttonClasses = (0,
|
|
4181
|
+
const buttonClasses = (0, import_clsx40.default)(
|
|
3973
4182
|
"flex size-full items-center rounded",
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
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,
|
|
3978
4187
|
{
|
|
3979
|
-
[
|
|
3980
|
-
[
|
|
4188
|
+
[import_component_theme19.buttonColors[variant].selected]: isSortKey,
|
|
4189
|
+
[import_component_theme19.buttonColors[variant].base]: !isSortKey,
|
|
3981
4190
|
"px-2": size === "x-small" || size === "small",
|
|
3982
4191
|
"px-4": size === "medium" || size === "large",
|
|
3983
4192
|
"pointer-events-none": isDisabled
|
|
3984
4193
|
}
|
|
3985
4194
|
);
|
|
3986
|
-
const labelClasses = (0,
|
|
4195
|
+
const labelClasses = (0, import_clsx40.default)("truncate", {
|
|
3987
4196
|
"typography-label12regular": size === "x-small",
|
|
3988
4197
|
"typography-label14regular": size === "small" || size === "medium",
|
|
3989
4198
|
"typography-label16regular": size === "large",
|
|
3990
4199
|
"mr-1": size === "x-small",
|
|
3991
4200
|
"mr-2": size !== "x-small"
|
|
3992
4201
|
});
|
|
3993
|
-
return /* @__PURE__ */ (0,
|
|
3994
|
-
/* @__PURE__ */ (0,
|
|
3995
|
-
/* @__PURE__ */ (0,
|
|
3996
|
-
/* @__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)(
|
|
3997
4206
|
Icon,
|
|
3998
4207
|
{
|
|
3999
4208
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
4000
4209
|
size: size === "large" ? "medium" : "small"
|
|
4001
4210
|
}
|
|
4002
|
-
) : /* @__PURE__ */ (0,
|
|
4211
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4003
4212
|
Icon,
|
|
4004
4213
|
{
|
|
4005
4214
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -4007,7 +4216,7 @@ function SelectSort({
|
|
|
4007
4216
|
}
|
|
4008
4217
|
) })
|
|
4009
4218
|
] }),
|
|
4010
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
4219
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
4011
4220
|
SelectList2,
|
|
4012
4221
|
{
|
|
4013
4222
|
size,
|
|
@@ -4021,10 +4230,10 @@ function SelectSort({
|
|
|
4021
4230
|
}
|
|
4022
4231
|
|
|
4023
4232
|
// src/sort-button/sort-button.tsx
|
|
4024
|
-
var
|
|
4025
|
-
var
|
|
4026
|
-
var
|
|
4027
|
-
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");
|
|
4028
4237
|
function SortButton({
|
|
4029
4238
|
size = "medium",
|
|
4030
4239
|
width,
|
|
@@ -4035,7 +4244,7 @@ function SortButton({
|
|
|
4035
4244
|
"aria-label": ariaLabel,
|
|
4036
4245
|
...rest
|
|
4037
4246
|
}) {
|
|
4038
|
-
const handleClick = (0,
|
|
4247
|
+
const handleClick = (0, import_react61.useCallback)(() => {
|
|
4039
4248
|
if (isDisabled || !onClick) return;
|
|
4040
4249
|
onClick();
|
|
4041
4250
|
}, [isDisabled, onClick]);
|
|
@@ -4044,36 +4253,36 @@ function SortButton({
|
|
|
4044
4253
|
if (sortOrder === "descend") return "arrow-down";
|
|
4045
4254
|
return "angle-small-down";
|
|
4046
4255
|
};
|
|
4047
|
-
const wrapperClasses = (0,
|
|
4256
|
+
const wrapperClasses = (0, import_clsx41.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
4048
4257
|
"h-6": size === "x-small" || size === "small",
|
|
4049
4258
|
"h-8": size === "medium",
|
|
4050
4259
|
"h-10": size === "large",
|
|
4051
4260
|
"cursor-not-allowed": isDisabled
|
|
4052
4261
|
});
|
|
4053
|
-
const buttonClasses = (0,
|
|
4262
|
+
const buttonClasses = (0, import_clsx41.default)(
|
|
4054
4263
|
"flex size-full items-center rounded",
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
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,
|
|
4059
4268
|
{
|
|
4060
|
-
[
|
|
4269
|
+
[import_component_theme20.buttonColors.text.selected]: !isDisabled && sortOrder !== null,
|
|
4061
4270
|
// ソート状態時は選択状態のスタイル
|
|
4062
|
-
[
|
|
4271
|
+
[import_component_theme20.buttonColors.text.base]: sortOrder === null,
|
|
4063
4272
|
// ソートなし時は通常のスタイル
|
|
4064
4273
|
"px-2": size === "x-small" || size === "small",
|
|
4065
4274
|
"px-4": size === "medium" || size === "large",
|
|
4066
4275
|
"pointer-events-none": isDisabled
|
|
4067
4276
|
}
|
|
4068
4277
|
);
|
|
4069
|
-
const labelClasses = (0,
|
|
4278
|
+
const labelClasses = (0, import_clsx41.default)("truncate", {
|
|
4070
4279
|
"typography-label12regular": size === "x-small",
|
|
4071
4280
|
"typography-label14regular": size === "small" || size === "medium",
|
|
4072
4281
|
"typography-label16regular": size === "large",
|
|
4073
4282
|
"mr-1": size === "x-small",
|
|
4074
4283
|
"mr-2": size !== "x-small"
|
|
4075
4284
|
});
|
|
4076
|
-
return /* @__PURE__ */ (0,
|
|
4285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
4077
4286
|
"button",
|
|
4078
4287
|
{
|
|
4079
4288
|
className: buttonClasses,
|
|
@@ -4084,22 +4293,22 @@ function SortButton({
|
|
|
4084
4293
|
"aria-label": ariaLabel,
|
|
4085
4294
|
"aria-disabled": isDisabled,
|
|
4086
4295
|
children: [
|
|
4087
|
-
/* @__PURE__ */ (0,
|
|
4088
|
-
/* @__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" }) })
|
|
4089
4298
|
]
|
|
4090
4299
|
}
|
|
4091
4300
|
) });
|
|
4092
4301
|
}
|
|
4093
4302
|
|
|
4094
4303
|
// src/steps/steps.tsx
|
|
4095
|
-
var
|
|
4096
|
-
var
|
|
4304
|
+
var import_clsx44 = require("clsx");
|
|
4305
|
+
var import_react64 = require("react");
|
|
4097
4306
|
|
|
4098
4307
|
// src/steps/steps-context.ts
|
|
4099
|
-
var
|
|
4100
|
-
var StepsContext = (0,
|
|
4308
|
+
var import_react62 = require("react");
|
|
4309
|
+
var StepsContext = (0, import_react62.createContext)(null);
|
|
4101
4310
|
function useStepsContext() {
|
|
4102
|
-
const context = (0,
|
|
4311
|
+
const context = (0, import_react62.useContext)(StepsContext);
|
|
4103
4312
|
if (context === null) {
|
|
4104
4313
|
throw new Error("Steps.Item must be used within <Steps>");
|
|
4105
4314
|
}
|
|
@@ -4107,13 +4316,13 @@ function useStepsContext() {
|
|
|
4107
4316
|
}
|
|
4108
4317
|
|
|
4109
4318
|
// src/steps/steps-item.tsx
|
|
4110
|
-
var
|
|
4319
|
+
var import_clsx43 = require("clsx");
|
|
4111
4320
|
|
|
4112
4321
|
// src/steps/steps-item-context.ts
|
|
4113
|
-
var
|
|
4114
|
-
var StepsItemContext = (0,
|
|
4322
|
+
var import_react63 = require("react");
|
|
4323
|
+
var StepsItemContext = (0, import_react63.createContext)(null);
|
|
4115
4324
|
function useStepsItemContext() {
|
|
4116
|
-
const context = (0,
|
|
4325
|
+
const context = (0, import_react63.useContext)(StepsItemContext);
|
|
4117
4326
|
if (context === null) {
|
|
4118
4327
|
throw new Error("Steps.Item must be rendered inside a <Steps> component");
|
|
4119
4328
|
}
|
|
@@ -4121,34 +4330,34 @@ function useStepsItemContext() {
|
|
|
4121
4330
|
}
|
|
4122
4331
|
|
|
4123
4332
|
// src/steps/steps-separator.tsx
|
|
4124
|
-
var
|
|
4125
|
-
var
|
|
4333
|
+
var import_clsx42 = require("clsx");
|
|
4334
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
4126
4335
|
function StepsSeparator({ progress }) {
|
|
4127
4336
|
const { orientation } = useStepsContext();
|
|
4128
4337
|
const isVerticalLine = orientation === "vertical";
|
|
4129
4338
|
const colorClass = progress === "completed" ? "bg-interactive01" : "bg-uiBorder01";
|
|
4130
4339
|
if (isVerticalLine) {
|
|
4131
|
-
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) });
|
|
4132
4341
|
}
|
|
4133
|
-
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) });
|
|
4134
4343
|
}
|
|
4135
4344
|
|
|
4136
4345
|
// src/steps/steps-item.tsx
|
|
4137
|
-
var
|
|
4346
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
4138
4347
|
var progressSrOnlyLabel = {
|
|
4139
4348
|
completed: "\u5B8C\u4E86: ",
|
|
4140
4349
|
current: "\u73FE\u5728\u306E\u30B9\u30C6\u30C3\u30D7: ",
|
|
4141
4350
|
upcoming: "\u672A\u7740\u624B: "
|
|
4142
4351
|
};
|
|
4143
4352
|
function getCircleSizeClass(size) {
|
|
4144
|
-
return (0,
|
|
4353
|
+
return (0, import_clsx43.clsx)({
|
|
4145
4354
|
"size-6 typography-label12regular": size === "small",
|
|
4146
4355
|
"size-8 typography-label12regular": size === "medium",
|
|
4147
4356
|
"size-10 typography-label16regular": size === "large"
|
|
4148
4357
|
});
|
|
4149
4358
|
}
|
|
4150
4359
|
function getCircleVariantProgressClass(variant, progress) {
|
|
4151
|
-
return (0,
|
|
4360
|
+
return (0, import_clsx43.clsx)({
|
|
4152
4361
|
// subtle(全 state border-transparent で box-sizing を揃える)
|
|
4153
4362
|
"bg-uiBackground02 text-text01 border-transparent": variant === "subtle" && progress === "upcoming",
|
|
4154
4363
|
"bg-activeUi text-text01 border-transparent": variant === "subtle" && progress === "current",
|
|
@@ -4160,7 +4369,7 @@ function getCircleVariantProgressClass(variant, progress) {
|
|
|
4160
4369
|
});
|
|
4161
4370
|
}
|
|
4162
4371
|
function getCircleClasses(size, variant, state) {
|
|
4163
|
-
return (0,
|
|
4372
|
+
return (0, import_clsx43.clsx)(
|
|
4164
4373
|
"box-border flex items-center justify-center rounded-full border-2",
|
|
4165
4374
|
getCircleSizeClass(size),
|
|
4166
4375
|
getCircleVariantProgressClass(variant, state.progress)
|
|
@@ -4178,65 +4387,65 @@ function StepsItem({ label, description }) {
|
|
|
4178
4387
|
const { state, index, isLast, id } = useStepsItemContext();
|
|
4179
4388
|
const isCircleFilled = state.progress === "completed";
|
|
4180
4389
|
const circleClasses = getCircleClasses(size, variant, state);
|
|
4181
|
-
const checkIcon = variant === "solid" ? /* @__PURE__ */ (0,
|
|
4182
|
-
const circle = /* @__PURE__ */ (0,
|
|
4183
|
-
const labelBlock = /* @__PURE__ */ (0,
|
|
4184
|
-
/* @__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)(
|
|
4185
4394
|
"span",
|
|
4186
4395
|
{
|
|
4187
|
-
className: (0,
|
|
4396
|
+
className: (0, import_clsx43.clsx)(
|
|
4188
4397
|
"whitespace-nowrap text-text01",
|
|
4189
4398
|
size === "large" ? "typography-body16regular" : "typography-body14regular"
|
|
4190
4399
|
),
|
|
4191
4400
|
children: [
|
|
4192
|
-
/* @__PURE__ */ (0,
|
|
4401
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: progressSrOnlyLabel[state.progress] }),
|
|
4193
4402
|
label
|
|
4194
4403
|
]
|
|
4195
4404
|
}
|
|
4196
4405
|
),
|
|
4197
|
-
description != null && /* @__PURE__ */ (0,
|
|
4406
|
+
description != null && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "typography-label12regular whitespace-nowrap text-text02", children: description })
|
|
4198
4407
|
] });
|
|
4199
4408
|
const ariaCurrentProps = state.progress === "current" ? { "aria-current": "step" } : {};
|
|
4200
4409
|
if (orientation === "horizontal" && textOrientation === "horizontal") {
|
|
4201
|
-
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: [
|
|
4202
4411
|
circle,
|
|
4203
4412
|
labelBlock
|
|
4204
4413
|
] }) });
|
|
4205
4414
|
}
|
|
4206
4415
|
if (orientation === "horizontal" && textOrientation === "vertical") {
|
|
4207
|
-
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: [
|
|
4208
4417
|
circle,
|
|
4209
4418
|
labelBlock
|
|
4210
4419
|
] }) });
|
|
4211
4420
|
}
|
|
4212
4421
|
if (orientation === "vertical" && textOrientation === "horizontal") {
|
|
4213
|
-
return /* @__PURE__ */ (0,
|
|
4422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
4214
4423
|
"li",
|
|
4215
4424
|
{
|
|
4216
4425
|
...ariaCurrentProps,
|
|
4217
|
-
className: (0,
|
|
4426
|
+
className: (0, import_clsx43.clsx)(
|
|
4218
4427
|
"grid grid-cols-[min-content_1fr] grid-rows-[auto_1fr] items-center gap-x-2",
|
|
4219
4428
|
!isLast && "flex-1"
|
|
4220
4429
|
),
|
|
4221
4430
|
id,
|
|
4222
4431
|
children: [
|
|
4223
|
-
/* @__PURE__ */ (0,
|
|
4224
|
-
/* @__PURE__ */ (0,
|
|
4225
|
-
!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 }) })
|
|
4226
4435
|
]
|
|
4227
4436
|
}
|
|
4228
4437
|
);
|
|
4229
4438
|
}
|
|
4230
|
-
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: [
|
|
4231
4440
|
circle,
|
|
4232
4441
|
labelBlock,
|
|
4233
|
-
!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 }) })
|
|
4234
4443
|
] });
|
|
4235
4444
|
}
|
|
4236
4445
|
StepsItem.displayName = "Steps.Item";
|
|
4237
4446
|
|
|
4238
4447
|
// src/steps/steps.tsx
|
|
4239
|
-
var
|
|
4448
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
4240
4449
|
function getSeparatorCellHeightClass(size) {
|
|
4241
4450
|
if (size === "small") return "h-6";
|
|
4242
4451
|
if (size === "medium") return "h-8";
|
|
@@ -4249,19 +4458,19 @@ function HorizontalSeparatorCell({
|
|
|
4249
4458
|
}) {
|
|
4250
4459
|
const heightClass = getSeparatorCellHeightClass(size);
|
|
4251
4460
|
const alignClass = textOrientation === "vertical" ? "self-start" : "";
|
|
4252
|
-
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 }) });
|
|
4253
4462
|
}
|
|
4254
4463
|
function collectStepsItems(children) {
|
|
4255
4464
|
const result = [];
|
|
4256
|
-
|
|
4257
|
-
if (!(0,
|
|
4465
|
+
import_react64.Children.toArray(children).forEach((child) => {
|
|
4466
|
+
if (!(0, import_react64.isValidElement)(child)) {
|
|
4258
4467
|
return;
|
|
4259
4468
|
}
|
|
4260
4469
|
if (child.type === StepsItem) {
|
|
4261
4470
|
result.push(child);
|
|
4262
4471
|
return;
|
|
4263
4472
|
}
|
|
4264
|
-
if (child.type ===
|
|
4473
|
+
if (child.type === import_react64.Fragment) {
|
|
4265
4474
|
const fragmentChildren = child.props.children;
|
|
4266
4475
|
result.push(...collectStepsItems(fragmentChildren));
|
|
4267
4476
|
}
|
|
@@ -4278,12 +4487,12 @@ function StepsRoot({
|
|
|
4278
4487
|
variant = "solid",
|
|
4279
4488
|
"aria-label": ariaLabel
|
|
4280
4489
|
}) {
|
|
4281
|
-
const baseId = (0,
|
|
4282
|
-
const [internalStep] = (0,
|
|
4490
|
+
const baseId = (0, import_react64.useId)();
|
|
4491
|
+
const [internalStep] = (0, import_react64.useState)(defaultCurrentStep ?? 0);
|
|
4283
4492
|
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4284
|
-
const itemElements = (0,
|
|
4493
|
+
const itemElements = (0, import_react64.useMemo)(() => collectStepsItems(children), [children]);
|
|
4285
4494
|
const stepsCount = itemElements.length;
|
|
4286
|
-
const contextValue = (0,
|
|
4495
|
+
const contextValue = (0, import_react64.useMemo)(
|
|
4287
4496
|
() => ({
|
|
4288
4497
|
size,
|
|
4289
4498
|
orientation,
|
|
@@ -4302,13 +4511,13 @@ function StepsRoot({
|
|
|
4302
4511
|
const state = states[index] ?? { progress: "upcoming" };
|
|
4303
4512
|
const isLast = index === stepsCount - 1;
|
|
4304
4513
|
const id = `${baseId}-item-${index}`;
|
|
4305
|
-
return /* @__PURE__ */ (0,
|
|
4514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(StepsItemContext.Provider, { value: { index, state, isLast, id }, children: item }, item.key ?? `item-${index}`);
|
|
4306
4515
|
};
|
|
4307
4516
|
const renderedChildren = orientation === "horizontal" ? itemElements.flatMap((item, index) => {
|
|
4308
4517
|
const nodes = [wrapItem(item, index)];
|
|
4309
4518
|
if (index < stepsCount - 1) {
|
|
4310
4519
|
nodes.push(
|
|
4311
|
-
/* @__PURE__ */ (0,
|
|
4520
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
|
|
4312
4521
|
HorizontalSeparatorCell,
|
|
4313
4522
|
{
|
|
4314
4523
|
progress: states[index]?.progress ?? "upcoming",
|
|
@@ -4321,7 +4530,7 @@ function StepsRoot({
|
|
|
4321
4530
|
}
|
|
4322
4531
|
return nodes;
|
|
4323
4532
|
}) : itemElements.map((item, index) => wrapItem(item, index));
|
|
4324
|
-
const listClassName = (0,
|
|
4533
|
+
const listClassName = (0, import_clsx44.clsx)(
|
|
4325
4534
|
orientation === "horizontal" ? ["grid w-full gap-x-2", textOrientation === "vertical" ? "items-start" : "items-center"] : "flex flex-col items-stretch"
|
|
4326
4535
|
);
|
|
4327
4536
|
const horizontalGridTemplate = Array.from(
|
|
@@ -4329,20 +4538,20 @@ function StepsRoot({
|
|
|
4329
4538
|
(_unused, index) => index === stepsCount - 1 ? "max-content" : "max-content minmax(8px, 1fr)"
|
|
4330
4539
|
).join(" ");
|
|
4331
4540
|
const listStyleProps = orientation === "horizontal" ? { style: { gridTemplateColumns: horizontalGridTemplate } } : {};
|
|
4332
|
-
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 }) });
|
|
4333
4542
|
}
|
|
4334
4543
|
var Steps = StepsRoot;
|
|
4335
4544
|
Steps.Item = StepsItem;
|
|
4336
4545
|
|
|
4337
4546
|
// src/tab/tab.tsx
|
|
4338
|
-
var
|
|
4339
|
-
var
|
|
4547
|
+
var import_clsx46 = require("clsx");
|
|
4548
|
+
var import_react65 = require("react");
|
|
4340
4549
|
|
|
4341
4550
|
// src/tab/tab-item.tsx
|
|
4342
|
-
var
|
|
4343
|
-
var
|
|
4551
|
+
var import_clsx45 = require("clsx");
|
|
4552
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
4344
4553
|
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
4345
|
-
const classes = (0,
|
|
4554
|
+
const classes = (0, import_clsx45.clsx)(
|
|
4346
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",
|
|
4347
4556
|
{
|
|
4348
4557
|
"typography-label14regular text-interactive02": !isSelected,
|
|
@@ -4350,12 +4559,12 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4350
4559
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
4351
4560
|
}
|
|
4352
4561
|
);
|
|
4353
|
-
const iconWrapperClasses = (0,
|
|
4562
|
+
const iconWrapperClasses = (0, import_clsx45.clsx)("flex shrink-0 items-center", {
|
|
4354
4563
|
"fill-disabled01": isDisabled,
|
|
4355
4564
|
"fill-interactive01": !isDisabled && isSelected,
|
|
4356
4565
|
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
4357
4566
|
});
|
|
4358
|
-
return /* @__PURE__ */ (0,
|
|
4567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
|
|
4359
4568
|
"button",
|
|
4360
4569
|
{
|
|
4361
4570
|
type: "button",
|
|
@@ -4365,7 +4574,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4365
4574
|
disabled: isDisabled,
|
|
4366
4575
|
onClick: () => props.onClick(props.id),
|
|
4367
4576
|
children: [
|
|
4368
|
-
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" }) }),
|
|
4369
4578
|
props.children
|
|
4370
4579
|
]
|
|
4371
4580
|
}
|
|
@@ -4373,39 +4582,39 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4373
4582
|
};
|
|
4374
4583
|
|
|
4375
4584
|
// src/tab/tab.tsx
|
|
4376
|
-
var
|
|
4585
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4377
4586
|
function Tab({ children, layout = "auto" }) {
|
|
4378
|
-
const childrenCount =
|
|
4587
|
+
const childrenCount = import_react65.Children.count(children);
|
|
4379
4588
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
4380
|
-
const containerClasses = (0,
|
|
4589
|
+
const containerClasses = (0, import_clsx46.clsx)(
|
|
4381
4590
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
4382
4591
|
{
|
|
4383
4592
|
flex: layout === "auto",
|
|
4384
4593
|
grid: layout === "equal"
|
|
4385
4594
|
}
|
|
4386
4595
|
);
|
|
4387
|
-
return /* @__PURE__ */ (0,
|
|
4596
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
4388
4597
|
}
|
|
4389
4598
|
Tab.Item = TabItem;
|
|
4390
4599
|
|
|
4391
4600
|
// src/table/table-cell.tsx
|
|
4392
|
-
var
|
|
4393
|
-
var
|
|
4601
|
+
var import_clsx47 = __toESM(require("clsx"));
|
|
4602
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
4394
4603
|
function TableCell({ children, className, isHeader = false }) {
|
|
4395
|
-
const classes = (0,
|
|
4396
|
-
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 });
|
|
4397
4606
|
}
|
|
4398
4607
|
|
|
4399
4608
|
// src/table/table-row.tsx
|
|
4400
|
-
var
|
|
4401
|
-
var
|
|
4609
|
+
var import_clsx48 = __toESM(require("clsx"));
|
|
4610
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
4402
4611
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
4403
|
-
const rowClasses = (0,
|
|
4404
|
-
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 });
|
|
4405
4614
|
}
|
|
4406
4615
|
|
|
4407
4616
|
// src/table/table.tsx
|
|
4408
|
-
var
|
|
4617
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
4409
4618
|
function Table({
|
|
4410
4619
|
width,
|
|
4411
4620
|
templateRows,
|
|
@@ -4414,7 +4623,7 @@ function Table({
|
|
|
4414
4623
|
autoRows,
|
|
4415
4624
|
children
|
|
4416
4625
|
}) {
|
|
4417
|
-
return /* @__PURE__ */ (0,
|
|
4626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
4418
4627
|
"div",
|
|
4419
4628
|
{
|
|
4420
4629
|
className: "grid",
|
|
@@ -4433,23 +4642,23 @@ Table.Row = TableRow;
|
|
|
4433
4642
|
Table.Cell = TableCell;
|
|
4434
4643
|
|
|
4435
4644
|
// src/tag/tag.tsx
|
|
4436
|
-
var
|
|
4437
|
-
var
|
|
4645
|
+
var import_component_theme22 = require("@zenkigen-inc/component-theme");
|
|
4646
|
+
var import_clsx50 = __toESM(require("clsx"));
|
|
4438
4647
|
|
|
4439
4648
|
// src/tag/delete-icon.tsx
|
|
4440
|
-
var
|
|
4441
|
-
var
|
|
4442
|
-
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");
|
|
4443
4652
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
4444
|
-
const deleteButtonClasses = (0,
|
|
4653
|
+
const deleteButtonClasses = (0, import_clsx49.default)(
|
|
4445
4654
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
4446
|
-
|
|
4655
|
+
import_component_theme21.focusVisible.normal
|
|
4447
4656
|
);
|
|
4448
|
-
const deletePathClasses = (0,
|
|
4657
|
+
const deletePathClasses = (0, import_clsx49.default)({
|
|
4449
4658
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
4450
4659
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
4451
4660
|
});
|
|
4452
|
-
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)(
|
|
4453
4662
|
"path",
|
|
4454
4663
|
{
|
|
4455
4664
|
fillRule: "evenodd",
|
|
@@ -4461,11 +4670,11 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
4461
4670
|
};
|
|
4462
4671
|
|
|
4463
4672
|
// src/tag/tag.tsx
|
|
4464
|
-
var
|
|
4673
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
4465
4674
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
4466
|
-
const wrapperClasses = (0,
|
|
4467
|
-
[
|
|
4468
|
-
[
|
|
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",
|
|
4469
4678
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
4470
4679
|
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
4471
4680
|
"h-5 typography-label14regular": size === "medium",
|
|
@@ -4474,21 +4683,21 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
4474
4683
|
"px-1": !isEditable,
|
|
4475
4684
|
"px-2": isEditable
|
|
4476
4685
|
});
|
|
4477
|
-
return /* @__PURE__ */ (0,
|
|
4686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsxs)("div", { className: wrapperClasses, children: [
|
|
4478
4687
|
children,
|
|
4479
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
4688
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
4480
4689
|
] });
|
|
4481
4690
|
}
|
|
4482
4691
|
|
|
4483
4692
|
// src/text-area/text-area.tsx
|
|
4484
|
-
var
|
|
4485
|
-
var
|
|
4693
|
+
var import_clsx53 = require("clsx");
|
|
4694
|
+
var import_react69 = require("react");
|
|
4486
4695
|
|
|
4487
4696
|
// src/text-area/text-area-context.tsx
|
|
4488
|
-
var
|
|
4489
|
-
var TextAreaCompoundContext = (0,
|
|
4697
|
+
var import_react66 = require("react");
|
|
4698
|
+
var TextAreaCompoundContext = (0, import_react66.createContext)(null);
|
|
4490
4699
|
var useTextAreaCompoundContext = (componentName) => {
|
|
4491
|
-
const context = (0,
|
|
4700
|
+
const context = (0, import_react66.useContext)(TextAreaCompoundContext);
|
|
4492
4701
|
if (context == null) {
|
|
4493
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`);
|
|
4494
4703
|
}
|
|
@@ -4496,10 +4705,10 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
4496
4705
|
};
|
|
4497
4706
|
|
|
4498
4707
|
// src/text-area/text-area-error-message.tsx
|
|
4499
|
-
var
|
|
4500
|
-
var
|
|
4501
|
-
var
|
|
4502
|
-
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)(
|
|
4503
4712
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4504
4713
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
4505
4714
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -4507,26 +4716,26 @@ var TextAreaErrorMessage = (0, import_react64.forwardRef)(
|
|
|
4507
4716
|
if (!shouldRender) {
|
|
4508
4717
|
return null;
|
|
4509
4718
|
}
|
|
4510
|
-
const errorMessageClassName = (0,
|
|
4511
|
-
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 });
|
|
4512
4721
|
}
|
|
4513
4722
|
);
|
|
4514
4723
|
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
4515
4724
|
|
|
4516
4725
|
// src/text-area/text-area-helper-message.tsx
|
|
4517
|
-
var
|
|
4518
|
-
var
|
|
4519
|
-
var
|
|
4520
|
-
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) => {
|
|
4521
4730
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
4522
4731
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
4523
|
-
const helperMessageClassName = (0,
|
|
4524
|
-
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 });
|
|
4525
4734
|
});
|
|
4526
4735
|
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
4527
4736
|
|
|
4528
4737
|
// src/text-area/text-area.tsx
|
|
4529
|
-
var
|
|
4738
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
4530
4739
|
function TextAreaInner({
|
|
4531
4740
|
size = "medium",
|
|
4532
4741
|
variant = "outline",
|
|
@@ -4543,8 +4752,8 @@ function TextAreaInner({
|
|
|
4543
4752
|
maxLength,
|
|
4544
4753
|
...props
|
|
4545
4754
|
}, ref) {
|
|
4546
|
-
const autoGeneratedId = (0,
|
|
4547
|
-
const textAreaPropsForContext = (0,
|
|
4755
|
+
const autoGeneratedId = (0, import_react69.useId)();
|
|
4756
|
+
const textAreaPropsForContext = (0, import_react69.useMemo)(
|
|
4548
4757
|
() => ({
|
|
4549
4758
|
size,
|
|
4550
4759
|
variant,
|
|
@@ -4552,7 +4761,7 @@ function TextAreaInner({
|
|
|
4552
4761
|
}),
|
|
4553
4762
|
[size, variant, isError]
|
|
4554
4763
|
);
|
|
4555
|
-
const contextValue = (0,
|
|
4764
|
+
const contextValue = (0, import_react69.useMemo)(
|
|
4556
4765
|
() => ({
|
|
4557
4766
|
textAreaProps: textAreaPropsForContext,
|
|
4558
4767
|
forwardedRef: ref
|
|
@@ -4562,21 +4771,21 @@ function TextAreaInner({
|
|
|
4562
4771
|
const helperMessageIds = [];
|
|
4563
4772
|
const errorIds = [];
|
|
4564
4773
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
4565
|
-
const enhancedChildren =
|
|
4566
|
-
if (!(0,
|
|
4774
|
+
const enhancedChildren = import_react69.Children.map(children, (child) => {
|
|
4775
|
+
if (!(0, import_react69.isValidElement)(child)) {
|
|
4567
4776
|
return child;
|
|
4568
4777
|
}
|
|
4569
4778
|
if (child.type === TextAreaHelperMessage) {
|
|
4570
4779
|
const helperChild = child;
|
|
4571
4780
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
4572
4781
|
helperMessageIds.push(assignedId);
|
|
4573
|
-
return (0,
|
|
4782
|
+
return (0, import_react69.cloneElement)(helperChild, { id: assignedId });
|
|
4574
4783
|
}
|
|
4575
4784
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
4576
4785
|
const errorChild = child;
|
|
4577
4786
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
4578
4787
|
errorIds.push(assignedId);
|
|
4579
|
-
return (0,
|
|
4788
|
+
return (0, import_react69.cloneElement)(errorChild, { id: assignedId });
|
|
4580
4789
|
}
|
|
4581
4790
|
return child;
|
|
4582
4791
|
});
|
|
@@ -4603,7 +4812,7 @@ function TextAreaInner({
|
|
|
4603
4812
|
...maxLengthProps
|
|
4604
4813
|
};
|
|
4605
4814
|
const isBorderless = variant === "text";
|
|
4606
|
-
const textAreaWrapperClassName = (0,
|
|
4815
|
+
const textAreaWrapperClassName = (0, import_clsx53.clsx)(
|
|
4607
4816
|
"box-border flex w-full overflow-hidden rounded border",
|
|
4608
4817
|
{
|
|
4609
4818
|
// outline variant
|
|
@@ -4619,7 +4828,7 @@ function TextAreaInner({
|
|
|
4619
4828
|
// className は variant="outline" のみ受け入れ、後方互換のため wrapper の末尾に合成(@deprecated)
|
|
4620
4829
|
!isBorderless && className
|
|
4621
4830
|
);
|
|
4622
|
-
const textAreaClassName = (0,
|
|
4831
|
+
const textAreaClassName = (0, import_clsx53.clsx)("w-full border-none bg-uiBackground01 outline-none", {
|
|
4623
4832
|
// outline: 従来の padding
|
|
4624
4833
|
"typography-body14regular px-2 py-2": !isBorderless && size === "medium",
|
|
4625
4834
|
"typography-body16regular px-3 py-2": !isBorderless && size === "large",
|
|
@@ -4638,7 +4847,7 @@ function TextAreaInner({
|
|
|
4638
4847
|
"resize-none": !isResizable
|
|
4639
4848
|
});
|
|
4640
4849
|
const hasHeight = height != null && String(height).trim().length > 0;
|
|
4641
|
-
const textAreaElement = /* @__PURE__ */ (0,
|
|
4850
|
+
const textAreaElement = /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4642
4851
|
"div",
|
|
4643
4852
|
{
|
|
4644
4853
|
className: textAreaWrapperClassName,
|
|
@@ -4649,7 +4858,7 @@ function TextAreaInner({
|
|
|
4649
4858
|
...!autoHeight && hasHeight && !isResizable ? { height } : {},
|
|
4650
4859
|
...autoHeight && hasHeight ? { minHeight: height } : {}
|
|
4651
4860
|
},
|
|
4652
|
-
children: /* @__PURE__ */ (0,
|
|
4861
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4653
4862
|
"textarea",
|
|
4654
4863
|
{
|
|
4655
4864
|
ref,
|
|
@@ -4665,11 +4874,11 @@ function TextAreaInner({
|
|
|
4665
4874
|
)
|
|
4666
4875
|
}
|
|
4667
4876
|
);
|
|
4668
|
-
const counterElement = isCounterVisible ? /* @__PURE__ */ (0,
|
|
4877
|
+
const counterElement = isCounterVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(
|
|
4669
4878
|
"div",
|
|
4670
4879
|
{
|
|
4671
4880
|
id: counterId,
|
|
4672
|
-
className: (0,
|
|
4881
|
+
className: (0, import_clsx53.clsx)(
|
|
4673
4882
|
"shrink-0",
|
|
4674
4883
|
size === "large" ? "typography-label13regular" : "typography-label12regular",
|
|
4675
4884
|
!disabled && isExceeded ? "text-supportError" : "text-text02"
|
|
@@ -4678,17 +4887,17 @@ function TextAreaInner({
|
|
|
4678
4887
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
4679
4888
|
}
|
|
4680
4889
|
) : null;
|
|
4681
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
4890
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react69.Children.toArray(enhancedChildren);
|
|
4682
4891
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
4683
4892
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
4684
4893
|
if (!hasBottomContent) {
|
|
4685
|
-
return /* @__PURE__ */ (0,
|
|
4894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(TextAreaCompoundContext.Provider, { value: contextValue, children: textAreaElement });
|
|
4686
4895
|
}
|
|
4687
|
-
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: [
|
|
4688
4897
|
textAreaElement,
|
|
4689
|
-
/* @__PURE__ */ (0,
|
|
4690
|
-
hasMessageChildren && /* @__PURE__ */ (0,
|
|
4691
|
-
!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" }),
|
|
4692
4901
|
counterElement
|
|
4693
4902
|
] })
|
|
4694
4903
|
] }) });
|
|
@@ -4699,15 +4908,247 @@ var attachStatics2 = (component) => {
|
|
|
4699
4908
|
component.displayName = "TextArea";
|
|
4700
4909
|
return component;
|
|
4701
4910
|
};
|
|
4702
|
-
var TextAreaBase = (0,
|
|
4911
|
+
var TextAreaBase = (0, import_react69.forwardRef)(function TextAreaBase2(props, ref) {
|
|
4703
4912
|
return TextAreaInner(props, ref);
|
|
4704
4913
|
});
|
|
4705
4914
|
var TextArea = attachStatics2(TextAreaBase);
|
|
4706
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
|
+
|
|
4707
5148
|
// src/toast/toast.tsx
|
|
4708
|
-
var
|
|
4709
|
-
var
|
|
4710
|
-
var
|
|
5149
|
+
var import_clsx56 = __toESM(require("clsx"));
|
|
5150
|
+
var import_react73 = require("react");
|
|
5151
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
4711
5152
|
var CLOSE_TIME_MSEC = 5e3;
|
|
4712
5153
|
function Toast({
|
|
4713
5154
|
state = "information",
|
|
@@ -4717,8 +5158,8 @@ function Toast({
|
|
|
4717
5158
|
children,
|
|
4718
5159
|
onClickClose
|
|
4719
5160
|
}) {
|
|
4720
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
4721
|
-
const handleClose = (0,
|
|
5161
|
+
const [isRemoving, setIsRemoving] = (0, import_react73.useState)(false);
|
|
5162
|
+
const handleClose = (0, import_react73.useCallback)(() => {
|
|
4722
5163
|
if (isAnimation) {
|
|
4723
5164
|
setIsRemoving(true);
|
|
4724
5165
|
} else {
|
|
@@ -4726,17 +5167,17 @@ function Toast({
|
|
|
4726
5167
|
}
|
|
4727
5168
|
}, [isAnimation, onClickClose]);
|
|
4728
5169
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
4729
|
-
const wrapperClasses = (0,
|
|
5170
|
+
const wrapperClasses = (0, import_clsx56.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
4730
5171
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
4731
5172
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
4732
5173
|
});
|
|
4733
|
-
const iconClasses = (0,
|
|
5174
|
+
const iconClasses = (0, import_clsx56.default)("flex items-center", {
|
|
4734
5175
|
"fill-supportSuccess": state === "success",
|
|
4735
5176
|
"fill-supportError": state === "error",
|
|
4736
5177
|
"fill-supportWarning": state === "warning",
|
|
4737
5178
|
"fill-supportInfo": state === "information"
|
|
4738
5179
|
});
|
|
4739
|
-
const textClasses = (0,
|
|
5180
|
+
const textClasses = (0, import_clsx56.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
4740
5181
|
"text-supportError": state === "error",
|
|
4741
5182
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
4742
5183
|
});
|
|
@@ -4746,7 +5187,7 @@ function Toast({
|
|
|
4746
5187
|
warning: "warning",
|
|
4747
5188
|
information: "information-filled"
|
|
4748
5189
|
};
|
|
4749
|
-
(0,
|
|
5190
|
+
(0, import_react73.useEffect)(() => {
|
|
4750
5191
|
const timer = window.setTimeout(() => {
|
|
4751
5192
|
if (isAutoClose) {
|
|
4752
5193
|
setIsRemoving(true);
|
|
@@ -4754,45 +5195,45 @@ function Toast({
|
|
|
4754
5195
|
}, CLOSE_TIME_MSEC);
|
|
4755
5196
|
return () => window.clearTimeout(timer);
|
|
4756
5197
|
}, [isAutoClose]);
|
|
4757
|
-
return /* @__PURE__ */ (0,
|
|
4758
|
-
/* @__PURE__ */ (0,
|
|
4759
|
-
/* @__PURE__ */ (0,
|
|
4760
|
-
/* @__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 })
|
|
4761
5202
|
] });
|
|
4762
5203
|
}
|
|
4763
5204
|
|
|
4764
5205
|
// src/toast/toast-provider.tsx
|
|
4765
|
-
var
|
|
5206
|
+
var import_react74 = require("react");
|
|
4766
5207
|
var import_react_dom3 = require("react-dom");
|
|
4767
|
-
var
|
|
4768
|
-
var ToastContext = (0,
|
|
5208
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5209
|
+
var ToastContext = (0, import_react74.createContext)({});
|
|
4769
5210
|
var ToastProvider = ({ children }) => {
|
|
4770
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
4771
|
-
const [toasts, setToasts] = (0,
|
|
4772
|
-
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 }) => {
|
|
4773
5214
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
4774
5215
|
}, []);
|
|
4775
|
-
const removeToast = (0,
|
|
5216
|
+
const removeToast = (0, import_react74.useCallback)((id) => {
|
|
4776
5217
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
4777
5218
|
}, []);
|
|
4778
|
-
(0,
|
|
5219
|
+
(0, import_react74.useEffect)(() => {
|
|
4779
5220
|
setIsClientRender(true);
|
|
4780
5221
|
}, []);
|
|
4781
|
-
return /* @__PURE__ */ (0,
|
|
5222
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
4782
5223
|
children,
|
|
4783
5224
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
4784
|
-
/* @__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)) }),
|
|
4785
5226
|
document.body
|
|
4786
5227
|
)
|
|
4787
5228
|
] });
|
|
4788
5229
|
};
|
|
4789
5230
|
var useToast = () => {
|
|
4790
|
-
return (0,
|
|
5231
|
+
return (0, import_react74.useContext)(ToastContext);
|
|
4791
5232
|
};
|
|
4792
5233
|
|
|
4793
5234
|
// src/toggle/toggle.tsx
|
|
4794
|
-
var
|
|
4795
|
-
var
|
|
5235
|
+
var import_clsx57 = __toESM(require("clsx"));
|
|
5236
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
4796
5237
|
function Toggle({
|
|
4797
5238
|
id,
|
|
4798
5239
|
size = "medium",
|
|
@@ -4802,7 +5243,7 @@ function Toggle({
|
|
|
4802
5243
|
labelPosition = "right",
|
|
4803
5244
|
isDisabled = false
|
|
4804
5245
|
}) {
|
|
4805
|
-
const baseClasses = (0,
|
|
5246
|
+
const baseClasses = (0, import_clsx57.default)("relative flex items-center rounded-full", {
|
|
4806
5247
|
"bg-disabledOn": isDisabled && isChecked,
|
|
4807
5248
|
"bg-disabled01": isDisabled && !isChecked,
|
|
4808
5249
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -4810,16 +5251,16 @@ function Toggle({
|
|
|
4810
5251
|
"w-8 h-4 px-[3px]": size === "small",
|
|
4811
5252
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
4812
5253
|
});
|
|
4813
|
-
const inputClasses = (0,
|
|
5254
|
+
const inputClasses = (0, import_clsx57.default)(
|
|
4814
5255
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
4815
5256
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
4816
5257
|
);
|
|
4817
|
-
const indicatorClasses = (0,
|
|
5258
|
+
const indicatorClasses = (0, import_clsx57.default)("rounded-full bg-iconOnColor", {
|
|
4818
5259
|
"w-2.5 h-2.5": size === "small",
|
|
4819
5260
|
"w-4 h-4": size === "medium" || size === "large",
|
|
4820
5261
|
"ml-auto": isChecked
|
|
4821
5262
|
});
|
|
4822
|
-
const labelClasses = (0,
|
|
5263
|
+
const labelClasses = (0, import_clsx57.default)("break-all", {
|
|
4823
5264
|
"mr-2": labelPosition === "left",
|
|
4824
5265
|
"ml-2": labelPosition === "right",
|
|
4825
5266
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -4827,9 +5268,9 @@ function Toggle({
|
|
|
4827
5268
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
4828
5269
|
"cursor-pointer text-text01": !isDisabled
|
|
4829
5270
|
});
|
|
4830
|
-
return /* @__PURE__ */ (0,
|
|
4831
|
-
label != null && labelPosition === "left" && /* @__PURE__ */ (0,
|
|
4832
|
-
/* @__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)(
|
|
4833
5274
|
"input",
|
|
4834
5275
|
{
|
|
4835
5276
|
className: inputClasses,
|
|
@@ -4841,23 +5282,23 @@ function Toggle({
|
|
|
4841
5282
|
disabled: isDisabled
|
|
4842
5283
|
}
|
|
4843
5284
|
),
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
4845
|
-
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 })
|
|
4846
5287
|
] });
|
|
4847
5288
|
}
|
|
4848
5289
|
|
|
4849
5290
|
// src/tooltip/tooltip.tsx
|
|
4850
|
-
var
|
|
5291
|
+
var import_react76 = require("react");
|
|
4851
5292
|
var import_react_dom4 = require("react-dom");
|
|
4852
5293
|
|
|
4853
5294
|
// src/tooltip/tooltip-content.tsx
|
|
4854
|
-
var
|
|
5295
|
+
var import_clsx59 = __toESM(require("clsx"));
|
|
4855
5296
|
|
|
4856
5297
|
// src/tooltip/tail-icon.tsx
|
|
4857
|
-
var
|
|
4858
|
-
var
|
|
5298
|
+
var import_clsx58 = __toESM(require("clsx"));
|
|
5299
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
4859
5300
|
var TailIcon = (props) => {
|
|
4860
|
-
const tailClasses = (0,
|
|
5301
|
+
const tailClasses = (0, import_clsx58.default)("absolute fill-uiBackgroundTooltip", {
|
|
4861
5302
|
"rotate-180": props.verticalPosition === "bottom",
|
|
4862
5303
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
4863
5304
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -4872,9 +5313,9 @@ var TailIcon = (props) => {
|
|
|
4872
5313
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
4873
5314
|
});
|
|
4874
5315
|
if (props.size === "small") {
|
|
4875
|
-
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" }) });
|
|
4876
5317
|
} else {
|
|
4877
|
-
return /* @__PURE__ */ (0,
|
|
5318
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
4878
5319
|
"svg",
|
|
4879
5320
|
{
|
|
4880
5321
|
className: tailClasses,
|
|
@@ -4883,14 +5324,14 @@ var TailIcon = (props) => {
|
|
|
4883
5324
|
viewBox: "0 0 14 8",
|
|
4884
5325
|
fill: "none",
|
|
4885
5326
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4886
|
-
children: /* @__PURE__ */ (0,
|
|
5327
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
4887
5328
|
}
|
|
4888
5329
|
);
|
|
4889
5330
|
}
|
|
4890
5331
|
};
|
|
4891
5332
|
|
|
4892
5333
|
// src/tooltip/tooltip-content.tsx
|
|
4893
|
-
var
|
|
5334
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
4894
5335
|
var TooltipContent = ({
|
|
4895
5336
|
content,
|
|
4896
5337
|
horizontalAlign,
|
|
@@ -4900,7 +5341,7 @@ var TooltipContent = ({
|
|
|
4900
5341
|
maxWidth,
|
|
4901
5342
|
isPortal = false
|
|
4902
5343
|
}) => {
|
|
4903
|
-
const tooltipWrapperClasses = (0,
|
|
5344
|
+
const tooltipWrapperClasses = (0, import_clsx59.default)("absolute z-tooltip m-auto flex", {
|
|
4904
5345
|
"top-0": !isPortal && verticalPosition === "top",
|
|
4905
5346
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
4906
5347
|
"justify-start": horizontalAlign === "left",
|
|
@@ -4909,7 +5350,7 @@ var TooltipContent = ({
|
|
|
4909
5350
|
"w-[24px]": size === "small",
|
|
4910
5351
|
"w-[46px]": size !== "small"
|
|
4911
5352
|
});
|
|
4912
|
-
const tooltipBodyClasses = (0,
|
|
5353
|
+
const tooltipBodyClasses = (0, import_clsx59.default)(
|
|
4913
5354
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
4914
5355
|
{
|
|
4915
5356
|
"typography-body12regular": size === "small",
|
|
@@ -4926,7 +5367,7 @@ var TooltipContent = ({
|
|
|
4926
5367
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
4927
5368
|
...tooltipPosition
|
|
4928
5369
|
} : {};
|
|
4929
|
-
return /* @__PURE__ */ (0,
|
|
5370
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(
|
|
4930
5371
|
"div",
|
|
4931
5372
|
{
|
|
4932
5373
|
className: tooltipBodyClasses,
|
|
@@ -4935,16 +5376,16 @@ var TooltipContent = ({
|
|
|
4935
5376
|
},
|
|
4936
5377
|
children: [
|
|
4937
5378
|
content,
|
|
4938
|
-
/* @__PURE__ */ (0,
|
|
5379
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
4939
5380
|
]
|
|
4940
5381
|
}
|
|
4941
5382
|
) });
|
|
4942
5383
|
};
|
|
4943
5384
|
|
|
4944
5385
|
// src/tooltip/tooltip-hook.ts
|
|
4945
|
-
var
|
|
5386
|
+
var import_react75 = require("react");
|
|
4946
5387
|
var useTooltip = () => {
|
|
4947
|
-
const calculatePosition = (0,
|
|
5388
|
+
const calculatePosition = (0, import_react75.useCallback)(
|
|
4948
5389
|
(args) => {
|
|
4949
5390
|
const result = {
|
|
4950
5391
|
maxWidth: "none",
|
|
@@ -4996,7 +5437,7 @@ var useTooltip = () => {
|
|
|
4996
5437
|
};
|
|
4997
5438
|
|
|
4998
5439
|
// src/tooltip/tooltip.tsx
|
|
4999
|
-
var
|
|
5440
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
5000
5441
|
function Tooltip({
|
|
5001
5442
|
children,
|
|
5002
5443
|
content,
|
|
@@ -5008,8 +5449,8 @@ function Tooltip({
|
|
|
5008
5449
|
portalTarget
|
|
5009
5450
|
}) {
|
|
5010
5451
|
const { calculatePosition } = useTooltip();
|
|
5011
|
-
const [isVisible, setIsVisible] = (0,
|
|
5012
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
5452
|
+
const [isVisible, setIsVisible] = (0, import_react76.useState)(false);
|
|
5453
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react76.useState)({
|
|
5013
5454
|
maxWidth: "none",
|
|
5014
5455
|
width: "auto",
|
|
5015
5456
|
left: "0px",
|
|
@@ -5018,8 +5459,8 @@ function Tooltip({
|
|
|
5018
5459
|
translateX: "0",
|
|
5019
5460
|
translateY: "0"
|
|
5020
5461
|
});
|
|
5021
|
-
const targetRef = (0,
|
|
5022
|
-
const handleMouseOverWrapper = (0,
|
|
5462
|
+
const targetRef = (0, import_react76.useRef)(null);
|
|
5463
|
+
const handleMouseOverWrapper = (0, import_react76.useCallback)(() => {
|
|
5023
5464
|
if (isDisabledHover) {
|
|
5024
5465
|
return;
|
|
5025
5466
|
}
|
|
@@ -5036,16 +5477,16 @@ function Tooltip({
|
|
|
5036
5477
|
}
|
|
5037
5478
|
setIsVisible(true);
|
|
5038
5479
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5039
|
-
const handleMouseOutWrapper = (0,
|
|
5480
|
+
const handleMouseOutWrapper = (0, import_react76.useCallback)(() => {
|
|
5040
5481
|
setIsVisible(false);
|
|
5041
5482
|
}, []);
|
|
5042
|
-
(0,
|
|
5483
|
+
(0, import_react76.useEffect)(() => {
|
|
5043
5484
|
if (targetRef.current === null) return;
|
|
5044
5485
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
5045
5486
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
5046
5487
|
setTooltipPosition(position);
|
|
5047
5488
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
5048
|
-
(0,
|
|
5489
|
+
(0, import_react76.useEffect)(() => {
|
|
5049
5490
|
if (!isVisible) return;
|
|
5050
5491
|
const updatePosition = () => {
|
|
5051
5492
|
if (targetRef.current === null) return;
|
|
@@ -5066,7 +5507,7 @@ function Tooltip({
|
|
|
5066
5507
|
window.removeEventListener("resize", updatePosition);
|
|
5067
5508
|
};
|
|
5068
5509
|
}, [isVisible, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5069
|
-
return /* @__PURE__ */ (0,
|
|
5510
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
5070
5511
|
"div",
|
|
5071
5512
|
{
|
|
5072
5513
|
ref: targetRef,
|
|
@@ -5075,7 +5516,7 @@ function Tooltip({
|
|
|
5075
5516
|
onMouseLeave: handleMouseOutWrapper,
|
|
5076
5517
|
children: [
|
|
5077
5518
|
children,
|
|
5078
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */ (0,
|
|
5519
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5079
5520
|
TooltipContent,
|
|
5080
5521
|
{
|
|
5081
5522
|
content,
|
|
@@ -5086,7 +5527,7 @@ function Tooltip({
|
|
|
5086
5527
|
tooltipPosition
|
|
5087
5528
|
}
|
|
5088
5529
|
) : (0, import_react_dom4.createPortal)(
|
|
5089
|
-
/* @__PURE__ */ (0,
|
|
5530
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
5090
5531
|
TooltipContent,
|
|
5091
5532
|
{
|
|
5092
5533
|
isPortal: true,
|
|
@@ -5131,6 +5572,7 @@ function Tooltip({
|
|
|
5131
5572
|
PopoverTrigger,
|
|
5132
5573
|
Popup,
|
|
5133
5574
|
Radio,
|
|
5575
|
+
RadioCard,
|
|
5134
5576
|
Search,
|
|
5135
5577
|
SegmentedControl,
|
|
5136
5578
|
Select,
|
|
@@ -5145,10 +5587,13 @@ function Tooltip({
|
|
|
5145
5587
|
Tag,
|
|
5146
5588
|
TextArea,
|
|
5147
5589
|
TextInput,
|
|
5590
|
+
TimePicker,
|
|
5148
5591
|
Toast,
|
|
5149
5592
|
ToastProvider,
|
|
5150
5593
|
Toggle,
|
|
5151
5594
|
Tooltip,
|
|
5595
|
+
formatTime,
|
|
5596
|
+
parseTime,
|
|
5152
5597
|
useOutsideClick,
|
|
5153
5598
|
useRovingFocus,
|
|
5154
5599
|
useToast
|