@zenkigen-inc/component-ui 1.23.1 → 1.24.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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +251 -176
- package/dist/index.mjs +138 -63
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1544,6 +1544,9 @@ function isElement(node) {
|
|
|
1544
1544
|
return node != null && typeof node === "object" && "type" in node;
|
|
1545
1545
|
}
|
|
1546
1546
|
|
|
1547
|
+
// src/utils/top-layer.ts
|
|
1548
|
+
var TOP_LAYER_ATTRIBUTE = "data-zenkigen-top-layer";
|
|
1549
|
+
|
|
1547
1550
|
// src/popover/popover-context.ts
|
|
1548
1551
|
import { createContext as createContext5, useContext as useContext5 } from "react";
|
|
1549
1552
|
var PopoverContext = createContext5(null);
|
|
@@ -2895,7 +2898,8 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
2895
2898
|
}
|
|
2896
2899
|
|
|
2897
2900
|
// src/modal/modal.tsx
|
|
2898
|
-
import {
|
|
2901
|
+
import { FloatingFocusManager, useFloating as useFloating3 } from "@floating-ui/react";
|
|
2902
|
+
import { useEffect as useEffect10, useId as useId5, useLayoutEffect as useLayoutEffect3, useRef as useRef11, useState as useState9 } from "react";
|
|
2899
2903
|
import { createPortal as createPortal2 } from "react-dom";
|
|
2900
2904
|
|
|
2901
2905
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -2969,10 +2973,16 @@ function ModalFooter({ children, isNoBorder = false }) {
|
|
|
2969
2973
|
|
|
2970
2974
|
// src/modal/modal-header.tsx
|
|
2971
2975
|
import clsx28 from "clsx";
|
|
2972
|
-
import { useContext as useContext9 } from "react";
|
|
2976
|
+
import { useContext as useContext9, useLayoutEffect as useLayoutEffect2 } from "react";
|
|
2973
2977
|
import { jsx as jsx36, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2974
2978
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
2975
|
-
const { onClose } = useContext9(ModalContext);
|
|
2979
|
+
const { onClose, titleId, setHasTitle } = useContext9(ModalContext);
|
|
2980
|
+
useLayoutEffect2(() => {
|
|
2981
|
+
setHasTitle?.(true);
|
|
2982
|
+
return () => {
|
|
2983
|
+
setHasTitle?.(false);
|
|
2984
|
+
};
|
|
2985
|
+
}, [setHasTitle]);
|
|
2976
2986
|
const headerClasses = clsx28(
|
|
2977
2987
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
2978
2988
|
{
|
|
@@ -2982,7 +2992,7 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
2982
2992
|
}
|
|
2983
2993
|
);
|
|
2984
2994
|
return /* @__PURE__ */ jsxs13("div", { className: headerClasses, children: [
|
|
2985
|
-
/* @__PURE__ */ jsx36("div", { children }),
|
|
2995
|
+
/* @__PURE__ */ jsx36("div", { id: titleId, children }),
|
|
2986
2996
|
onClose && /* @__PURE__ */ jsx36(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
2987
2997
|
] });
|
|
2988
2998
|
}
|
|
@@ -2991,6 +3001,9 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
2991
3001
|
import { Fragment as Fragment5, jsx as jsx37, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2992
3002
|
var LIMIT_WIDTH = 320;
|
|
2993
3003
|
var LIMIT_HEIGHT = 184;
|
|
3004
|
+
var MODAL_OVERLAY_ATTRIBUTE = "data-zenkigen-modal-overlay";
|
|
3005
|
+
var FOLLOWING_INSIDE_SELECTOR = `[data-floating-ui-portal],[${MODAL_OVERLAY_ATTRIBUTE}],[data-floating-ui-focus-guard]`;
|
|
3006
|
+
var isFollowing = (base, target) => (base.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
|
2994
3007
|
function Modal({
|
|
2995
3008
|
children,
|
|
2996
3009
|
width = 480,
|
|
@@ -3001,6 +3014,26 @@ function Modal({
|
|
|
3001
3014
|
portalTargetRef
|
|
3002
3015
|
}) {
|
|
3003
3016
|
const [isMounted, setIsMounted] = useState9(false);
|
|
3017
|
+
const overlayRef = useRef11(null);
|
|
3018
|
+
const titleId = useId5();
|
|
3019
|
+
const [hasTitle, setHasTitle] = useState9(false);
|
|
3020
|
+
const { refs, context } = useFloating3({ open: isOpen });
|
|
3021
|
+
const returnFocusRef = useRef11(null);
|
|
3022
|
+
useLayoutEffect3(() => {
|
|
3023
|
+
if (isOpen) {
|
|
3024
|
+
returnFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
3025
|
+
}
|
|
3026
|
+
}, [isOpen]);
|
|
3027
|
+
const getInsideElements = () => {
|
|
3028
|
+
const overlay = overlayRef.current;
|
|
3029
|
+
const topLayers = Array.from(document.querySelectorAll(`[${TOP_LAYER_ATTRIBUTE}]`));
|
|
3030
|
+
const following = overlay == null ? [] : Array.from(document.querySelectorAll(FOLLOWING_INSIDE_SELECTOR)).filter(
|
|
3031
|
+
(element) => isFollowing(overlay, element)
|
|
3032
|
+
);
|
|
3033
|
+
return [...topLayers, ...following].filter(
|
|
3034
|
+
(element) => element !== document.body && element !== document.documentElement
|
|
3035
|
+
);
|
|
3036
|
+
};
|
|
3004
3037
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
3005
3038
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
3006
3039
|
useEffect10(() => {
|
|
@@ -3014,16 +3047,36 @@ function Modal({
|
|
|
3014
3047
|
return isMounted && isOpen ? /* @__PURE__ */ jsxs14(Fragment5, { children: [
|
|
3015
3048
|
/* @__PURE__ */ jsx37(BodyScrollLock, {}),
|
|
3016
3049
|
createPortal2(
|
|
3017
|
-
/* @__PURE__ */ jsx37(ModalContext.Provider, { value: { onClose
|
|
3018
|
-
|
|
3050
|
+
/* @__PURE__ */ jsx37(ModalContext.Provider, { value: { onClose, titleId, setHasTitle }, children: /* @__PURE__ */ jsx37(
|
|
3051
|
+
FloatingFocusManager,
|
|
3019
3052
|
{
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3053
|
+
context,
|
|
3054
|
+
initialFocus: refs.floating,
|
|
3055
|
+
returnFocus: returnFocusRef,
|
|
3056
|
+
outsideElementsInert: true,
|
|
3057
|
+
getInsideElements,
|
|
3058
|
+
children: /* @__PURE__ */ jsx37(
|
|
3059
|
+
"div",
|
|
3060
|
+
{
|
|
3061
|
+
ref: overlayRef,
|
|
3062
|
+
...{ [MODAL_OVERLAY_ATTRIBUTE]: "" },
|
|
3063
|
+
className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4",
|
|
3064
|
+
children: /* @__PURE__ */ jsx37(
|
|
3065
|
+
"div",
|
|
3066
|
+
{
|
|
3067
|
+
ref: refs.setFloating,
|
|
3068
|
+
role: "dialog",
|
|
3069
|
+
"aria-modal": "true",
|
|
3070
|
+
...hasTitle && { "aria-labelledby": titleId },
|
|
3071
|
+
className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow outline-none",
|
|
3072
|
+
style: { width: renderWidth, height: renderHeight, maxWidth },
|
|
3073
|
+
children
|
|
3074
|
+
}
|
|
3075
|
+
)
|
|
3076
|
+
}
|
|
3077
|
+
)
|
|
3025
3078
|
}
|
|
3026
|
-
) })
|
|
3079
|
+
) }),
|
|
3027
3080
|
portalTargetRef?.current != null ? portalTargetRef.current : document.body
|
|
3028
3081
|
)
|
|
3029
3082
|
] }) : null;
|
|
@@ -3062,7 +3115,8 @@ function NotificationInline({ state = "default", size = "medium", variant = "def
|
|
|
3062
3115
|
"fill-supportSuccess": state === "success"
|
|
3063
3116
|
});
|
|
3064
3117
|
const textClasses = clsx29("flex-1", {
|
|
3065
|
-
"pt-[
|
|
3118
|
+
"pt-[3px]": size === "medium" && state !== "default",
|
|
3119
|
+
"pt-[1px]": size === "small" && state !== "default"
|
|
3066
3120
|
});
|
|
3067
3121
|
const iconName = {
|
|
3068
3122
|
attention: "attention",
|
|
@@ -3183,15 +3237,16 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
3183
3237
|
}
|
|
3184
3238
|
|
|
3185
3239
|
// src/select/select.tsx
|
|
3186
|
-
import { autoUpdate as autoUpdate3, FloatingPortal as FloatingPortal3, offset as offset3, size as sizeMiddleware2, useFloating as
|
|
3240
|
+
import { autoUpdate as autoUpdate3, FloatingPortal as FloatingPortal3, offset as offset3, size as sizeMiddleware2, useFloating as useFloating4 } from "@floating-ui/react";
|
|
3187
3241
|
import { focusVisible as focusVisible11, selectColors } from "@zenkigen-inc/component-theme";
|
|
3188
3242
|
import clsx33 from "clsx";
|
|
3189
|
-
import { useRef as
|
|
3243
|
+
import { useRef as useRef12, useState as useState10 } from "react";
|
|
3190
3244
|
|
|
3191
3245
|
// src/select/select-context.ts
|
|
3192
3246
|
import { createContext as createContext10 } from "react";
|
|
3193
3247
|
var SelectContext = createContext10({
|
|
3194
3248
|
size: "medium",
|
|
3249
|
+
isDeselectVisible: false,
|
|
3195
3250
|
setIsOptionListOpen: () => false,
|
|
3196
3251
|
variant: "outline",
|
|
3197
3252
|
isError: false
|
|
@@ -3230,31 +3285,43 @@ function SelectItem({ option }) {
|
|
|
3230
3285
|
// src/select/select-list.tsx
|
|
3231
3286
|
import { focusVisible as focusVisible10 } from "@zenkigen-inc/component-theme";
|
|
3232
3287
|
import clsx32 from "clsx";
|
|
3233
|
-
import { forwardRef as forwardRef10, useContext as useContext12, useLayoutEffect as
|
|
3288
|
+
import { forwardRef as forwardRef10, useContext as useContext12, useLayoutEffect as useLayoutEffect4 } from "react";
|
|
3234
3289
|
import { jsx as jsx42, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
3235
3290
|
var SelectList = forwardRef10(({ children, maxHeight }, ref) => {
|
|
3236
|
-
const {
|
|
3291
|
+
const {
|
|
3292
|
+
selectedOption,
|
|
3293
|
+
setIsOptionListOpen,
|
|
3294
|
+
variant,
|
|
3295
|
+
isDeselectVisible,
|
|
3296
|
+
onChange,
|
|
3297
|
+
floatingStyles,
|
|
3298
|
+
floatingRef,
|
|
3299
|
+
size
|
|
3300
|
+
} = useContext12(SelectContext);
|
|
3237
3301
|
const handleClickDeselect = () => {
|
|
3238
3302
|
onChange?.(null);
|
|
3239
3303
|
setIsOptionListOpen(false);
|
|
3240
3304
|
};
|
|
3241
|
-
|
|
3242
|
-
if (
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
container.scrollTo({
|
|
3253
|
-
top: Math.max(0, scrollTop)
|
|
3254
|
-
});
|
|
3255
|
-
}
|
|
3256
|
-
}
|
|
3305
|
+
useLayoutEffect4(() => {
|
|
3306
|
+
if (selectedOption == null) {
|
|
3307
|
+
return;
|
|
3308
|
+
}
|
|
3309
|
+
const container = floatingRef?.current;
|
|
3310
|
+
if (container == null || container.scrollHeight <= container.clientHeight) {
|
|
3311
|
+
return;
|
|
3312
|
+
}
|
|
3313
|
+
const element = container.querySelector(`[data-id="${selectedOption.id}"]`);
|
|
3314
|
+
if (element == null) {
|
|
3315
|
+
return;
|
|
3257
3316
|
}
|
|
3317
|
+
const htmlElement = element;
|
|
3318
|
+
const elementTop = htmlElement.offsetTop;
|
|
3319
|
+
const elementHeight = htmlElement.offsetHeight;
|
|
3320
|
+
const containerHeight = container.clientHeight;
|
|
3321
|
+
const scrollTop = elementTop - (containerHeight - elementHeight) / 2;
|
|
3322
|
+
container.scrollTo({
|
|
3323
|
+
top: Math.max(0, scrollTop)
|
|
3324
|
+
});
|
|
3258
3325
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
3259
3326
|
const listClasses = clsx32("overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
3260
3327
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
@@ -3269,7 +3336,7 @@ var SelectList = forwardRef10(({ children, maxHeight }, ref) => {
|
|
|
3269
3336
|
);
|
|
3270
3337
|
return /* @__PURE__ */ jsxs18("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
3271
3338
|
children,
|
|
3272
|
-
|
|
3339
|
+
isDeselectVisible && selectedOption !== null && /* @__PURE__ */ jsx42("li", { children: /* @__PURE__ */ jsx42("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
3273
3340
|
] });
|
|
3274
3341
|
});
|
|
3275
3342
|
SelectList.displayName = "SelectList";
|
|
@@ -3277,6 +3344,10 @@ SelectList.displayName = "SelectList";
|
|
|
3277
3344
|
// src/select/select.tsx
|
|
3278
3345
|
import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3279
3346
|
var FLOATING_OFFSET2 = 4;
|
|
3347
|
+
var OPTION_HEIGHT_PX = { "x-small": 32, small: 32, medium: 32, large: 40 };
|
|
3348
|
+
var DEFAULT_VISIBLE_OPTION_COUNT = 8.5;
|
|
3349
|
+
var LIST_VERTICAL_CHROME_PX = 10;
|
|
3350
|
+
var getDefaultOptionListMaxHeight = (size) => OPTION_HEIGHT_PX[size] * DEFAULT_VISIBLE_OPTION_COUNT + LIST_VERTICAL_CHROME_PX;
|
|
3280
3351
|
function Select({
|
|
3281
3352
|
children,
|
|
3282
3353
|
size = "medium",
|
|
@@ -3289,6 +3360,7 @@ function Select({
|
|
|
3289
3360
|
isDisabled = false,
|
|
3290
3361
|
isError = false,
|
|
3291
3362
|
isOptionSelected = false,
|
|
3363
|
+
hasDeselectButton,
|
|
3292
3364
|
onChange,
|
|
3293
3365
|
optionListMaxHeight,
|
|
3294
3366
|
matchListToTrigger = false,
|
|
@@ -3296,14 +3368,14 @@ function Select({
|
|
|
3296
3368
|
"aria-describedby": ariaDescribedby
|
|
3297
3369
|
}) {
|
|
3298
3370
|
const [isOptionListOpen, setIsOptionListOpen] = useState10(false);
|
|
3299
|
-
const targetRef =
|
|
3371
|
+
const targetRef = useRef12(null);
|
|
3300
3372
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
3301
3373
|
useDismissOnModalOpen(() => {
|
|
3302
3374
|
if (isOptionListOpen) {
|
|
3303
3375
|
setIsOptionListOpen(false);
|
|
3304
3376
|
}
|
|
3305
3377
|
});
|
|
3306
|
-
const { refs, floatingStyles } =
|
|
3378
|
+
const { refs, floatingStyles } = useFloating4({
|
|
3307
3379
|
open: isOptionListOpen,
|
|
3308
3380
|
onOpenChange: setIsOptionListOpen,
|
|
3309
3381
|
placement: "bottom-start",
|
|
@@ -3324,8 +3396,10 @@ function Select({
|
|
|
3324
3396
|
whileElementsMounted: autoUpdate3
|
|
3325
3397
|
});
|
|
3326
3398
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
3399
|
+
const resolvedOptionListMaxHeight = optionListMaxHeight ?? getDefaultOptionListMaxHeight(size);
|
|
3327
3400
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
3328
3401
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
3402
|
+
const isDeselectVisible = hasDeselectButton ?? placeholder != null;
|
|
3329
3403
|
const wrapperClasses = clsx33("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
3330
3404
|
"h-6": size === "x-small" || size === "small",
|
|
3331
3405
|
"h-8": size === "medium",
|
|
@@ -3361,7 +3435,7 @@ function Select({
|
|
|
3361
3435
|
value: {
|
|
3362
3436
|
size,
|
|
3363
3437
|
variant,
|
|
3364
|
-
|
|
3438
|
+
isDeselectVisible,
|
|
3365
3439
|
setIsOptionListOpen,
|
|
3366
3440
|
selectedOption,
|
|
3367
3441
|
onChange,
|
|
@@ -3394,7 +3468,7 @@ function Select({
|
|
|
3394
3468
|
]
|
|
3395
3469
|
}
|
|
3396
3470
|
),
|
|
3397
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx43(FloatingPortal3, { children: /* @__PURE__ */ jsx43("div", { className: "relative z-popover", children: /* @__PURE__ */ jsx43(SelectList, { ref: refs.setFloating, maxHeight:
|
|
3471
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx43(FloatingPortal3, { children: /* @__PURE__ */ jsx43("div", { className: "relative z-popover", children: /* @__PURE__ */ jsx43(SelectList, { ref: refs.setFloating, maxHeight: resolvedOptionListMaxHeight, children }) }) })
|
|
3398
3472
|
] })
|
|
3399
3473
|
}
|
|
3400
3474
|
);
|
|
@@ -3688,7 +3762,7 @@ function Radio({
|
|
|
3688
3762
|
}
|
|
3689
3763
|
|
|
3690
3764
|
// src/radio-card/radio-card.tsx
|
|
3691
|
-
import { Children as Children5, cloneElement as cloneElement5, isValidElement as isValidElement5, useId as
|
|
3765
|
+
import { Children as Children5, cloneElement as cloneElement5, isValidElement as isValidElement5, useId as useId7, useMemo as useMemo6 } from "react";
|
|
3692
3766
|
|
|
3693
3767
|
// src/radio-card/radio-card-context.ts
|
|
3694
3768
|
import { createContext as createContext12, useContext as useContext15 } from "react";
|
|
@@ -3734,11 +3808,11 @@ RadioCardGroup.displayName = "RadioCard.Group";
|
|
|
3734
3808
|
// src/radio-card/radio-card-item.tsx
|
|
3735
3809
|
import { focusVisible as focusVisible13 } from "@zenkigen-inc/component-theme";
|
|
3736
3810
|
import clsx35 from "clsx";
|
|
3737
|
-
import { useId as
|
|
3811
|
+
import { useId as useId6 } from "react";
|
|
3738
3812
|
import { jsx as jsx53, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3739
3813
|
function RadioCardItem({ value, label, description, isDisabled: itemDisabled = false, id }) {
|
|
3740
3814
|
const context = useRadioCardContext("RadioCard.Item");
|
|
3741
|
-
const autoId =
|
|
3815
|
+
const autoId = useId6();
|
|
3742
3816
|
const inputId = id ?? autoId;
|
|
3743
3817
|
const labelId = `${inputId}-label`;
|
|
3744
3818
|
const descriptionId = `${inputId}-description`;
|
|
@@ -3832,8 +3906,8 @@ function RadioCardRoot({
|
|
|
3832
3906
|
"aria-label": ariaLabel,
|
|
3833
3907
|
"aria-labelledby": ariaLabelledby
|
|
3834
3908
|
}) {
|
|
3835
|
-
const autoName =
|
|
3836
|
-
const baseId =
|
|
3909
|
+
const autoName = useId7();
|
|
3910
|
+
const baseId = useId7();
|
|
3837
3911
|
const resolvedName = name ?? autoName;
|
|
3838
3912
|
const errorIds = [];
|
|
3839
3913
|
const enhancedChildren = Children5.map(children, (child) => {
|
|
@@ -3913,7 +3987,7 @@ var Search = forwardRef12(({ width = "100%", size = "medium", ...props }, ref) =
|
|
|
3913
3987
|
Search.displayName = "Search";
|
|
3914
3988
|
|
|
3915
3989
|
// src/segmented-control/segmented-control.tsx
|
|
3916
|
-
import React4, { Children as Children6, useRef as
|
|
3990
|
+
import React4, { Children as Children6, useRef as useRef14 } from "react";
|
|
3917
3991
|
|
|
3918
3992
|
// src/segmented-control/segmented-control-context.ts
|
|
3919
3993
|
import { createContext as createContext13 } from "react";
|
|
@@ -3922,7 +3996,7 @@ var SegmentedControlContext = createContext13(null);
|
|
|
3922
3996
|
// src/segmented-control/segmented-control-item.tsx
|
|
3923
3997
|
import { focusVisible as focusVisible14 } from "@zenkigen-inc/component-theme";
|
|
3924
3998
|
import { clsx as clsx37 } from "clsx";
|
|
3925
|
-
import { useContext as useContext16, useEffect as useEffect11, useRef as
|
|
3999
|
+
import { useContext as useContext16, useEffect as useEffect11, useRef as useRef13 } from "react";
|
|
3926
4000
|
import { jsx as jsx56, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
3927
4001
|
var SegmentedControlItem = ({
|
|
3928
4002
|
label,
|
|
@@ -3933,8 +4007,8 @@ var SegmentedControlItem = ({
|
|
|
3933
4007
|
...rest
|
|
3934
4008
|
}) => {
|
|
3935
4009
|
const context = useContext16(SegmentedControlContext);
|
|
3936
|
-
const buttonRef =
|
|
3937
|
-
const lastInteractionWasMouse =
|
|
4010
|
+
const buttonRef = useRef13(null);
|
|
4011
|
+
const lastInteractionWasMouse = useRef13(false);
|
|
3938
4012
|
if (context === null) {
|
|
3939
4013
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
3940
4014
|
}
|
|
@@ -4027,7 +4101,7 @@ var SegmentedControl = ({
|
|
|
4027
4101
|
"aria-label": ariaLabel,
|
|
4028
4102
|
...rest
|
|
4029
4103
|
}) => {
|
|
4030
|
-
const containerRef =
|
|
4104
|
+
const containerRef = useRef14(null);
|
|
4031
4105
|
const itemIds = Children6.toArray(children).filter((child) => {
|
|
4032
4106
|
if (!React4.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
4033
4107
|
return false;
|
|
@@ -4081,7 +4155,7 @@ SegmentedControl.Item = SegmentedControlItem;
|
|
|
4081
4155
|
// src/select-sort/select-sort.tsx
|
|
4082
4156
|
import { buttonColors as buttonColors4, focusVisible as focusVisible17 } from "@zenkigen-inc/component-theme";
|
|
4083
4157
|
import clsx40 from "clsx";
|
|
4084
|
-
import { useCallback as useCallback13, useRef as
|
|
4158
|
+
import { useCallback as useCallback13, useRef as useRef15, useState as useState13 } from "react";
|
|
4085
4159
|
|
|
4086
4160
|
// src/select-sort/select-list.tsx
|
|
4087
4161
|
import { focusVisible as focusVisible16 } from "@zenkigen-inc/component-theme";
|
|
@@ -4149,7 +4223,7 @@ function SelectSort({
|
|
|
4149
4223
|
onClickDeselect
|
|
4150
4224
|
}) {
|
|
4151
4225
|
const [isOptionListOpen, setIsOptionListOpen] = useState13(false);
|
|
4152
|
-
const targetRef =
|
|
4226
|
+
const targetRef = useRef15(null);
|
|
4153
4227
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
4154
4228
|
useDismissOnModalOpen(() => {
|
|
4155
4229
|
if (isOptionListOpen) {
|
|
@@ -4294,7 +4368,7 @@ function SortButton({
|
|
|
4294
4368
|
|
|
4295
4369
|
// src/steps/steps.tsx
|
|
4296
4370
|
import { clsx as clsx44 } from "clsx";
|
|
4297
|
-
import { Children as Children7, Fragment as Fragment7, isValidElement as isValidElement6, useId as
|
|
4371
|
+
import { Children as Children7, Fragment as Fragment7, isValidElement as isValidElement6, useId as useId8, useMemo as useMemo7, useState as useState14 } from "react";
|
|
4298
4372
|
|
|
4299
4373
|
// src/steps/steps-context.ts
|
|
4300
4374
|
import { createContext as createContext14, useContext as useContext17 } from "react";
|
|
@@ -4479,7 +4553,7 @@ function StepsRoot({
|
|
|
4479
4553
|
variant = "solid",
|
|
4480
4554
|
"aria-label": ariaLabel
|
|
4481
4555
|
}) {
|
|
4482
|
-
const baseId =
|
|
4556
|
+
const baseId = useId8();
|
|
4483
4557
|
const [internalStep] = useState14(defaultCurrentStep ?? 0);
|
|
4484
4558
|
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4485
4559
|
const itemElements = useMemo7(() => collectStepsItems(children), [children]);
|
|
@@ -4683,7 +4757,7 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
4683
4757
|
|
|
4684
4758
|
// src/text-area/text-area.tsx
|
|
4685
4759
|
import { clsx as clsx53 } from "clsx";
|
|
4686
|
-
import { Children as Children9, cloneElement as cloneElement6, forwardRef as forwardRef15, isValidElement as isValidElement7, useId as
|
|
4760
|
+
import { Children as Children9, cloneElement as cloneElement6, forwardRef as forwardRef15, isValidElement as isValidElement7, useId as useId9, useMemo as useMemo8 } from "react";
|
|
4687
4761
|
|
|
4688
4762
|
// src/text-area/text-area-context.tsx
|
|
4689
4763
|
import { createContext as createContext16, useContext as useContext19 } from "react";
|
|
@@ -4744,7 +4818,7 @@ function TextAreaInner({
|
|
|
4744
4818
|
maxLength,
|
|
4745
4819
|
...props
|
|
4746
4820
|
}, ref) {
|
|
4747
|
-
const autoGeneratedId =
|
|
4821
|
+
const autoGeneratedId = useId9();
|
|
4748
4822
|
const textAreaPropsForContext = useMemo8(
|
|
4749
4823
|
() => ({
|
|
4750
4824
|
size,
|
|
@@ -4907,7 +4981,7 @@ var TextArea = attachStatics2(TextAreaBase);
|
|
|
4907
4981
|
|
|
4908
4982
|
// src/time-picker/time-picker.tsx
|
|
4909
4983
|
import { clsx as clsx55 } from "clsx";
|
|
4910
|
-
import { Children as Children10, cloneElement as cloneElement7, Fragment as Fragment8, isValidElement as isValidElement8, useId as
|
|
4984
|
+
import { Children as Children10, cloneElement as cloneElement7, Fragment as Fragment8, isValidElement as isValidElement8, useId as useId10, useMemo as useMemo9 } from "react";
|
|
4911
4985
|
|
|
4912
4986
|
// src/time-picker/time-picker-context.tsx
|
|
4913
4987
|
import { createContext as createContext17, useContext as useContext20 } from "react";
|
|
@@ -5047,7 +5121,7 @@ var TimePicker = ({
|
|
|
5047
5121
|
isError = false,
|
|
5048
5122
|
children
|
|
5049
5123
|
}) => {
|
|
5050
|
-
const autoGeneratedId =
|
|
5124
|
+
const autoGeneratedId = useId10();
|
|
5051
5125
|
const hourOptions = useMemo9(() => generateHourOptions(minuteStep, minTime, maxTime), [minuteStep, minTime, maxTime]);
|
|
5052
5126
|
const minuteOptions = useMemo9(
|
|
5053
5127
|
() => generateMinuteOptions(minuteStep, value.hour, minTime, maxTime),
|
|
@@ -5139,7 +5213,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
5139
5213
|
|
|
5140
5214
|
// src/toast/toast.tsx
|
|
5141
5215
|
import { clsx as clsx56 } from "clsx";
|
|
5142
|
-
import { useCallback as useCallback15, useEffect as useEffect12, useRef as
|
|
5216
|
+
import { useCallback as useCallback15, useEffect as useEffect12, useRef as useRef16, useState as useState15 } from "react";
|
|
5143
5217
|
import { jsx as jsx77, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
5144
5218
|
var CLOSE_TIME_MSEC = 5e3;
|
|
5145
5219
|
var REMOVAL_FALLBACK_MSEC = 1e3;
|
|
@@ -5156,11 +5230,11 @@ function Toast({
|
|
|
5156
5230
|
onClickClose
|
|
5157
5231
|
}) {
|
|
5158
5232
|
const [isRemoving, setIsRemoving] = useState15(false);
|
|
5159
|
-
const onClickCloseRef =
|
|
5233
|
+
const onClickCloseRef = useRef16(onClickClose);
|
|
5160
5234
|
useEffect12(() => {
|
|
5161
5235
|
onClickCloseRef.current = onClickClose;
|
|
5162
5236
|
}, [onClickClose]);
|
|
5163
|
-
const hasNotifiedCloseRef =
|
|
5237
|
+
const hasNotifiedCloseRef = useRef16(false);
|
|
5164
5238
|
const notifyClose = useCallback15(() => {
|
|
5165
5239
|
if (hasNotifiedCloseRef.current) {
|
|
5166
5240
|
return;
|
|
@@ -5240,14 +5314,14 @@ function Toast({
|
|
|
5240
5314
|
}
|
|
5241
5315
|
|
|
5242
5316
|
// src/toast/toast-provider.tsx
|
|
5243
|
-
import { createContext as createContext18, useCallback as useCallback16, useContext as useContext21, useEffect as useEffect13, useRef as
|
|
5317
|
+
import { createContext as createContext18, useCallback as useCallback16, useContext as useContext21, useEffect as useEffect13, useRef as useRef17, useState as useState16 } from "react";
|
|
5244
5318
|
import { createPortal as createPortal3 } from "react-dom";
|
|
5245
5319
|
import { jsx as jsx78, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
5246
5320
|
var ToastContext = createContext18({});
|
|
5247
5321
|
var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
5248
5322
|
const [isClientRender, setIsClientRender] = useState16(false);
|
|
5249
5323
|
const [toasts, setToasts] = useState16([]);
|
|
5250
|
-
const nextIdRef =
|
|
5324
|
+
const nextIdRef = useRef17(0);
|
|
5251
5325
|
const addToast = useCallback16(
|
|
5252
5326
|
(args) => {
|
|
5253
5327
|
nextIdRef.current += 1;
|
|
@@ -5278,6 +5352,7 @@ var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
|
5278
5352
|
/* @__PURE__ */ jsx78(
|
|
5279
5353
|
"div",
|
|
5280
5354
|
{
|
|
5355
|
+
...{ [TOP_LAYER_ATTRIBUTE]: "" },
|
|
5281
5356
|
role: "region",
|
|
5282
5357
|
"aria-label": "\u901A\u77E5",
|
|
5283
5358
|
className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-4",
|
|
@@ -5361,7 +5436,7 @@ function Toggle({
|
|
|
5361
5436
|
}
|
|
5362
5437
|
|
|
5363
5438
|
// src/tooltip/tooltip.tsx
|
|
5364
|
-
import { useCallback as useCallback18, useEffect as useEffect14, useRef as
|
|
5439
|
+
import { useCallback as useCallback18, useEffect as useEffect14, useRef as useRef18, useState as useState17 } from "react";
|
|
5365
5440
|
import { createPortal as createPortal4 } from "react-dom";
|
|
5366
5441
|
|
|
5367
5442
|
// src/tooltip/tooltip-content.tsx
|
|
@@ -5532,7 +5607,7 @@ function Tooltip({
|
|
|
5532
5607
|
translateX: "0",
|
|
5533
5608
|
translateY: "0"
|
|
5534
5609
|
});
|
|
5535
|
-
const targetRef =
|
|
5610
|
+
const targetRef = useRef18(null);
|
|
5536
5611
|
const handleMouseOverWrapper = useCallback18(() => {
|
|
5537
5612
|
if (isDisabledHover) {
|
|
5538
5613
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenkigen-inc/component-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"repository": "https://github.com/zenkigen/zenkigen-component",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@floating-ui/react": "0.27.20",
|
|
41
|
-
"@zenkigen-inc/component-config": "1.
|
|
42
|
-
"@zenkigen-inc/component-icons": "1.
|
|
43
|
-
"@zenkigen-inc/component-theme": "1.
|
|
41
|
+
"@zenkigen-inc/component-config": "1.24.0",
|
|
42
|
+
"@zenkigen-inc/component-icons": "1.24.0",
|
|
43
|
+
"@zenkigen-inc/component-theme": "1.24.0",
|
|
44
44
|
"clsx": "2.1.1",
|
|
45
45
|
"react-day-picker": "9.14.0"
|
|
46
46
|
}
|