@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.js
CHANGED
|
@@ -1619,6 +1619,9 @@ function isElement(node) {
|
|
|
1619
1619
|
return node != null && typeof node === "object" && "type" in node;
|
|
1620
1620
|
}
|
|
1621
1621
|
|
|
1622
|
+
// src/utils/top-layer.ts
|
|
1623
|
+
var TOP_LAYER_ATTRIBUTE = "data-zenkigen-top-layer";
|
|
1624
|
+
|
|
1622
1625
|
// src/popover/popover-context.ts
|
|
1623
1626
|
var import_react21 = require("react");
|
|
1624
1627
|
var PopoverContext = (0, import_react21.createContext)(null);
|
|
@@ -2970,7 +2973,8 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
2970
2973
|
}
|
|
2971
2974
|
|
|
2972
2975
|
// src/modal/modal.tsx
|
|
2973
|
-
var import_react40 = require("react");
|
|
2976
|
+
var import_react40 = require("@floating-ui/react");
|
|
2977
|
+
var import_react41 = require("react");
|
|
2974
2978
|
var import_react_dom2 = require("react-dom");
|
|
2975
2979
|
|
|
2976
2980
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -3047,7 +3051,13 @@ var import_clsx28 = __toESM(require("clsx"));
|
|
|
3047
3051
|
var import_react39 = require("react");
|
|
3048
3052
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3049
3053
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
3050
|
-
const { onClose } = (0, import_react39.useContext)(ModalContext);
|
|
3054
|
+
const { onClose, titleId, setHasTitle } = (0, import_react39.useContext)(ModalContext);
|
|
3055
|
+
(0, import_react39.useLayoutEffect)(() => {
|
|
3056
|
+
setHasTitle?.(true);
|
|
3057
|
+
return () => {
|
|
3058
|
+
setHasTitle?.(false);
|
|
3059
|
+
};
|
|
3060
|
+
}, [setHasTitle]);
|
|
3051
3061
|
const headerClasses = (0, import_clsx28.default)(
|
|
3052
3062
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
3053
3063
|
{
|
|
@@ -3057,7 +3067,7 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
3057
3067
|
}
|
|
3058
3068
|
);
|
|
3059
3069
|
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: headerClasses, children: [
|
|
3060
|
-
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { children }),
|
|
3070
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { id: titleId, children }),
|
|
3061
3071
|
onClose && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
3062
3072
|
] });
|
|
3063
3073
|
}
|
|
@@ -3066,6 +3076,9 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
3066
3076
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3067
3077
|
var LIMIT_WIDTH = 320;
|
|
3068
3078
|
var LIMIT_HEIGHT = 184;
|
|
3079
|
+
var MODAL_OVERLAY_ATTRIBUTE = "data-zenkigen-modal-overlay";
|
|
3080
|
+
var FOLLOWING_INSIDE_SELECTOR = `[data-floating-ui-portal],[${MODAL_OVERLAY_ATTRIBUTE}],[data-floating-ui-focus-guard]`;
|
|
3081
|
+
var isFollowing = (base, target) => (base.compareDocumentPosition(target) & Node.DOCUMENT_POSITION_FOLLOWING) !== 0;
|
|
3069
3082
|
function Modal({
|
|
3070
3083
|
children,
|
|
3071
3084
|
width = 480,
|
|
@@ -3075,13 +3088,33 @@ function Modal({
|
|
|
3075
3088
|
onClose,
|
|
3076
3089
|
portalTargetRef
|
|
3077
3090
|
}) {
|
|
3078
|
-
const [isMounted, setIsMounted] = (0,
|
|
3091
|
+
const [isMounted, setIsMounted] = (0, import_react41.useState)(false);
|
|
3092
|
+
const overlayRef = (0, import_react41.useRef)(null);
|
|
3093
|
+
const titleId = (0, import_react41.useId)();
|
|
3094
|
+
const [hasTitle, setHasTitle] = (0, import_react41.useState)(false);
|
|
3095
|
+
const { refs, context } = (0, import_react40.useFloating)({ open: isOpen });
|
|
3096
|
+
const returnFocusRef = (0, import_react41.useRef)(null);
|
|
3097
|
+
(0, import_react41.useLayoutEffect)(() => {
|
|
3098
|
+
if (isOpen) {
|
|
3099
|
+
returnFocusRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
3100
|
+
}
|
|
3101
|
+
}, [isOpen]);
|
|
3102
|
+
const getInsideElements = () => {
|
|
3103
|
+
const overlay = overlayRef.current;
|
|
3104
|
+
const topLayers = Array.from(document.querySelectorAll(`[${TOP_LAYER_ATTRIBUTE}]`));
|
|
3105
|
+
const following = overlay == null ? [] : Array.from(document.querySelectorAll(FOLLOWING_INSIDE_SELECTOR)).filter(
|
|
3106
|
+
(element) => isFollowing(overlay, element)
|
|
3107
|
+
);
|
|
3108
|
+
return [...topLayers, ...following].filter(
|
|
3109
|
+
(element) => element !== document.body && element !== document.documentElement
|
|
3110
|
+
);
|
|
3111
|
+
};
|
|
3079
3112
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
3080
3113
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
3081
|
-
(0,
|
|
3114
|
+
(0, import_react41.useEffect)(() => {
|
|
3082
3115
|
setIsMounted(true);
|
|
3083
3116
|
}, []);
|
|
3084
|
-
(0,
|
|
3117
|
+
(0, import_react41.useEffect)(() => {
|
|
3085
3118
|
if (isOpen) {
|
|
3086
3119
|
window.dispatchEvent(new CustomEvent(MODAL_OPEN_EVENT));
|
|
3087
3120
|
}
|
|
@@ -3089,16 +3122,36 @@ function Modal({
|
|
|
3089
3122
|
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [
|
|
3090
3123
|
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(BodyScrollLock, {}),
|
|
3091
3124
|
(0, import_react_dom2.createPortal)(
|
|
3092
|
-
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ModalContext.Provider, { value: { onClose
|
|
3093
|
-
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(ModalContext.Provider, { value: { onClose, titleId, setHasTitle }, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3126
|
+
import_react40.FloatingFocusManager,
|
|
3094
3127
|
{
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3128
|
+
context,
|
|
3129
|
+
initialFocus: refs.floating,
|
|
3130
|
+
returnFocus: returnFocusRef,
|
|
3131
|
+
outsideElementsInert: true,
|
|
3132
|
+
getInsideElements,
|
|
3133
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3134
|
+
"div",
|
|
3135
|
+
{
|
|
3136
|
+
ref: overlayRef,
|
|
3137
|
+
...{ [MODAL_OVERLAY_ATTRIBUTE]: "" },
|
|
3138
|
+
className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4",
|
|
3139
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3140
|
+
"div",
|
|
3141
|
+
{
|
|
3142
|
+
ref: refs.setFloating,
|
|
3143
|
+
role: "dialog",
|
|
3144
|
+
"aria-modal": "true",
|
|
3145
|
+
...hasTitle && { "aria-labelledby": titleId },
|
|
3146
|
+
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",
|
|
3147
|
+
style: { width: renderWidth, height: renderHeight, maxWidth },
|
|
3148
|
+
children
|
|
3149
|
+
}
|
|
3150
|
+
)
|
|
3151
|
+
}
|
|
3152
|
+
)
|
|
3100
3153
|
}
|
|
3101
|
-
) })
|
|
3154
|
+
) }),
|
|
3102
3155
|
portalTargetRef?.current != null ? portalTargetRef.current : document.body
|
|
3103
3156
|
)
|
|
3104
3157
|
] }) : null;
|
|
@@ -3137,7 +3190,8 @@ function NotificationInline({ state = "default", size = "medium", variant = "def
|
|
|
3137
3190
|
"fill-supportSuccess": state === "success"
|
|
3138
3191
|
});
|
|
3139
3192
|
const textClasses = (0, import_clsx29.clsx)("flex-1", {
|
|
3140
|
-
"pt-[
|
|
3193
|
+
"pt-[3px]": size === "medium" && state !== "default",
|
|
3194
|
+
"pt-[1px]": size === "small" && state !== "default"
|
|
3141
3195
|
});
|
|
3142
3196
|
const iconName = {
|
|
3143
3197
|
attention: "attention",
|
|
@@ -3160,18 +3214,18 @@ function NotificationInline({ state = "default", size = "medium", variant = "def
|
|
|
3160
3214
|
|
|
3161
3215
|
// src/pagination/pagination-button.tsx
|
|
3162
3216
|
var import_clsx30 = require("clsx");
|
|
3163
|
-
var
|
|
3217
|
+
var import_react43 = require("react");
|
|
3164
3218
|
|
|
3165
3219
|
// src/pagination/pagination-context.ts
|
|
3166
|
-
var
|
|
3167
|
-
var PaginationContext = (0,
|
|
3220
|
+
var import_react42 = require("react");
|
|
3221
|
+
var PaginationContext = (0, import_react42.createContext)({
|
|
3168
3222
|
currentPage: 0
|
|
3169
3223
|
});
|
|
3170
3224
|
|
|
3171
3225
|
// src/pagination/pagination-button.tsx
|
|
3172
3226
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3173
3227
|
function PaginationButton({ page, onClick }) {
|
|
3174
|
-
const { currentPage } = (0,
|
|
3228
|
+
const { currentPage } = (0, import_react43.useContext)(PaginationContext);
|
|
3175
3229
|
const buttonClasses = (0, import_clsx30.clsx)(
|
|
3176
3230
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
3177
3231
|
"typography-label14regular",
|
|
@@ -3258,15 +3312,16 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
3258
3312
|
}
|
|
3259
3313
|
|
|
3260
3314
|
// src/select/select.tsx
|
|
3261
|
-
var
|
|
3315
|
+
var import_react47 = require("@floating-ui/react");
|
|
3262
3316
|
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
3263
3317
|
var import_clsx33 = __toESM(require("clsx"));
|
|
3264
|
-
var
|
|
3318
|
+
var import_react48 = require("react");
|
|
3265
3319
|
|
|
3266
3320
|
// src/select/select-context.ts
|
|
3267
|
-
var
|
|
3268
|
-
var SelectContext = (0,
|
|
3321
|
+
var import_react44 = require("react");
|
|
3322
|
+
var SelectContext = (0, import_react44.createContext)({
|
|
3269
3323
|
size: "medium",
|
|
3324
|
+
isDeselectVisible: false,
|
|
3270
3325
|
setIsOptionListOpen: () => false,
|
|
3271
3326
|
variant: "outline",
|
|
3272
3327
|
isError: false
|
|
@@ -3275,10 +3330,10 @@ var SelectContext = (0, import_react43.createContext)({
|
|
|
3275
3330
|
// src/select/select-item.tsx
|
|
3276
3331
|
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
3277
3332
|
var import_clsx31 = __toESM(require("clsx"));
|
|
3278
|
-
var
|
|
3333
|
+
var import_react45 = require("react");
|
|
3279
3334
|
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
3280
3335
|
function SelectItem({ option }) {
|
|
3281
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError, size } = (0,
|
|
3336
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError, size } = (0, import_react45.useContext)(SelectContext);
|
|
3282
3337
|
const handleClickItem = (option2) => {
|
|
3283
3338
|
onChange?.(option2);
|
|
3284
3339
|
setIsOptionListOpen(false);
|
|
@@ -3305,31 +3360,43 @@ function SelectItem({ option }) {
|
|
|
3305
3360
|
// src/select/select-list.tsx
|
|
3306
3361
|
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
3307
3362
|
var import_clsx32 = __toESM(require("clsx"));
|
|
3308
|
-
var
|
|
3363
|
+
var import_react46 = require("react");
|
|
3309
3364
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
3310
|
-
var SelectList = (0,
|
|
3311
|
-
const {
|
|
3365
|
+
var SelectList = (0, import_react46.forwardRef)(({ children, maxHeight }, ref) => {
|
|
3366
|
+
const {
|
|
3367
|
+
selectedOption,
|
|
3368
|
+
setIsOptionListOpen,
|
|
3369
|
+
variant,
|
|
3370
|
+
isDeselectVisible,
|
|
3371
|
+
onChange,
|
|
3372
|
+
floatingStyles,
|
|
3373
|
+
floatingRef,
|
|
3374
|
+
size
|
|
3375
|
+
} = (0, import_react46.useContext)(SelectContext);
|
|
3312
3376
|
const handleClickDeselect = () => {
|
|
3313
3377
|
onChange?.(null);
|
|
3314
3378
|
setIsOptionListOpen(false);
|
|
3315
3379
|
};
|
|
3316
|
-
(0,
|
|
3317
|
-
if (
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
container.scrollTo({
|
|
3328
|
-
top: Math.max(0, scrollTop)
|
|
3329
|
-
});
|
|
3330
|
-
}
|
|
3331
|
-
}
|
|
3380
|
+
(0, import_react46.useLayoutEffect)(() => {
|
|
3381
|
+
if (selectedOption == null) {
|
|
3382
|
+
return;
|
|
3383
|
+
}
|
|
3384
|
+
const container = floatingRef?.current;
|
|
3385
|
+
if (container == null || container.scrollHeight <= container.clientHeight) {
|
|
3386
|
+
return;
|
|
3387
|
+
}
|
|
3388
|
+
const element = container.querySelector(`[data-id="${selectedOption.id}"]`);
|
|
3389
|
+
if (element == null) {
|
|
3390
|
+
return;
|
|
3332
3391
|
}
|
|
3392
|
+
const htmlElement = element;
|
|
3393
|
+
const elementTop = htmlElement.offsetTop;
|
|
3394
|
+
const elementHeight = htmlElement.offsetHeight;
|
|
3395
|
+
const containerHeight = container.clientHeight;
|
|
3396
|
+
const scrollTop = elementTop - (containerHeight - elementHeight) / 2;
|
|
3397
|
+
container.scrollTo({
|
|
3398
|
+
top: Math.max(0, scrollTop)
|
|
3399
|
+
});
|
|
3333
3400
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
3334
3401
|
const listClasses = (0, import_clsx32.default)("overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
3335
3402
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
@@ -3344,7 +3411,7 @@ var SelectList = (0, import_react45.forwardRef)(({ children, maxHeight }, ref) =
|
|
|
3344
3411
|
);
|
|
3345
3412
|
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
3346
3413
|
children,
|
|
3347
|
-
|
|
3414
|
+
isDeselectVisible && selectedOption !== null && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
3348
3415
|
] });
|
|
3349
3416
|
});
|
|
3350
3417
|
SelectList.displayName = "SelectList";
|
|
@@ -3352,6 +3419,10 @@ SelectList.displayName = "SelectList";
|
|
|
3352
3419
|
// src/select/select.tsx
|
|
3353
3420
|
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
3354
3421
|
var FLOATING_OFFSET2 = 4;
|
|
3422
|
+
var OPTION_HEIGHT_PX = { "x-small": 32, small: 32, medium: 32, large: 40 };
|
|
3423
|
+
var DEFAULT_VISIBLE_OPTION_COUNT = 8.5;
|
|
3424
|
+
var LIST_VERTICAL_CHROME_PX = 10;
|
|
3425
|
+
var getDefaultOptionListMaxHeight = (size) => OPTION_HEIGHT_PX[size] * DEFAULT_VISIBLE_OPTION_COUNT + LIST_VERTICAL_CHROME_PX;
|
|
3355
3426
|
function Select({
|
|
3356
3427
|
children,
|
|
3357
3428
|
size = "medium",
|
|
@@ -3364,27 +3435,28 @@ function Select({
|
|
|
3364
3435
|
isDisabled = false,
|
|
3365
3436
|
isError = false,
|
|
3366
3437
|
isOptionSelected = false,
|
|
3438
|
+
hasDeselectButton,
|
|
3367
3439
|
onChange,
|
|
3368
3440
|
optionListMaxHeight,
|
|
3369
3441
|
matchListToTrigger = false,
|
|
3370
3442
|
"aria-label": ariaLabel,
|
|
3371
3443
|
"aria-describedby": ariaDescribedby
|
|
3372
3444
|
}) {
|
|
3373
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
3374
|
-
const targetRef = (0,
|
|
3445
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react48.useState)(false);
|
|
3446
|
+
const targetRef = (0, import_react48.useRef)(null);
|
|
3375
3447
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
3376
3448
|
useDismissOnModalOpen(() => {
|
|
3377
3449
|
if (isOptionListOpen) {
|
|
3378
3450
|
setIsOptionListOpen(false);
|
|
3379
3451
|
}
|
|
3380
3452
|
});
|
|
3381
|
-
const { refs, floatingStyles } = (0,
|
|
3453
|
+
const { refs, floatingStyles } = (0, import_react47.useFloating)({
|
|
3382
3454
|
open: isOptionListOpen,
|
|
3383
3455
|
onOpenChange: setIsOptionListOpen,
|
|
3384
3456
|
placement: "bottom-start",
|
|
3385
3457
|
middleware: [
|
|
3386
|
-
(0,
|
|
3387
|
-
(0,
|
|
3458
|
+
(0, import_react47.offset)(FLOATING_OFFSET2),
|
|
3459
|
+
(0, import_react47.size)({
|
|
3388
3460
|
apply({ availableWidth, elements, rects }) {
|
|
3389
3461
|
const referenceWidth = rects.reference.width;
|
|
3390
3462
|
if (matchListToTrigger) {
|
|
@@ -3396,11 +3468,13 @@ function Select({
|
|
|
3396
3468
|
}
|
|
3397
3469
|
})
|
|
3398
3470
|
],
|
|
3399
|
-
whileElementsMounted:
|
|
3471
|
+
whileElementsMounted: import_react47.autoUpdate
|
|
3400
3472
|
});
|
|
3401
3473
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
3474
|
+
const resolvedOptionListMaxHeight = optionListMaxHeight ?? getDefaultOptionListMaxHeight(size);
|
|
3402
3475
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
3403
3476
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
3477
|
+
const isDeselectVisible = hasDeselectButton ?? placeholder != null;
|
|
3404
3478
|
const wrapperClasses = (0, import_clsx33.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
3405
3479
|
"h-6": size === "x-small" || size === "small",
|
|
3406
3480
|
"h-8": size === "medium",
|
|
@@ -3436,7 +3510,7 @@ function Select({
|
|
|
3436
3510
|
value: {
|
|
3437
3511
|
size,
|
|
3438
3512
|
variant,
|
|
3439
|
-
|
|
3513
|
+
isDeselectVisible,
|
|
3440
3514
|
setIsOptionListOpen,
|
|
3441
3515
|
selectedOption,
|
|
3442
3516
|
onChange,
|
|
@@ -3469,7 +3543,7 @@ function Select({
|
|
|
3469
3543
|
]
|
|
3470
3544
|
}
|
|
3471
3545
|
),
|
|
3472
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
3546
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_react47.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "relative z-popover", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(SelectList, { ref: refs.setFloating, maxHeight: resolvedOptionListMaxHeight, children }) }) })
|
|
3473
3547
|
] })
|
|
3474
3548
|
}
|
|
3475
3549
|
);
|
|
@@ -3557,10 +3631,10 @@ function PaginationSelect({
|
|
|
3557
3631
|
}
|
|
3558
3632
|
|
|
3559
3633
|
// src/password-input/password-input.tsx
|
|
3560
|
-
var
|
|
3634
|
+
var import_react49 = require("react");
|
|
3561
3635
|
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
3562
|
-
var PasswordInputBase = (0,
|
|
3563
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
3636
|
+
var PasswordInputBase = (0, import_react49.forwardRef)(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
3637
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react49.useState)(false);
|
|
3564
3638
|
const { className: _className, ...textInputProps } = props;
|
|
3565
3639
|
const handlePasswordVisibilityToggle = () => {
|
|
3566
3640
|
setIsPasswordVisible((prev) => !prev);
|
|
@@ -3595,7 +3669,7 @@ var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
|
3595
3669
|
});
|
|
3596
3670
|
|
|
3597
3671
|
// src/popup/popup.tsx
|
|
3598
|
-
var
|
|
3672
|
+
var import_react52 = require("react");
|
|
3599
3673
|
|
|
3600
3674
|
// src/popup/popup-body.tsx
|
|
3601
3675
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
@@ -3604,8 +3678,8 @@ function PopupBody({ children }) {
|
|
|
3604
3678
|
}
|
|
3605
3679
|
|
|
3606
3680
|
// src/popup/popup-context.ts
|
|
3607
|
-
var
|
|
3608
|
-
var PopupContext = (0,
|
|
3681
|
+
var import_react50 = require("react");
|
|
3682
|
+
var PopupContext = (0, import_react50.createContext)({
|
|
3609
3683
|
isOpen: false,
|
|
3610
3684
|
onClose: () => null
|
|
3611
3685
|
});
|
|
@@ -3617,10 +3691,10 @@ function PopupFooter({ children }) {
|
|
|
3617
3691
|
}
|
|
3618
3692
|
|
|
3619
3693
|
// src/popup/popup-header.tsx
|
|
3620
|
-
var
|
|
3694
|
+
var import_react51 = require("react");
|
|
3621
3695
|
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3622
3696
|
function PopupHeader({ children, before }) {
|
|
3623
|
-
const { onClose } = (0,
|
|
3697
|
+
const { onClose } = (0, import_react51.useContext)(PopupContext);
|
|
3624
3698
|
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "typography-h5 flex h-12 w-full shrink-0 items-start justify-between rounded-t-lg px-6 pt-3 text-text01", children: [
|
|
3625
3699
|
/* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
3626
3700
|
before,
|
|
@@ -3635,7 +3709,7 @@ var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
|
3635
3709
|
var LIMIT_WIDTH2 = 320;
|
|
3636
3710
|
var LIMIT_HEIGHT2 = 184;
|
|
3637
3711
|
function useOptionalPopoverContext() {
|
|
3638
|
-
return (0,
|
|
3712
|
+
return (0, import_react52.useContext)(PopoverContext);
|
|
3639
3713
|
}
|
|
3640
3714
|
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
3641
3715
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
@@ -3662,7 +3736,7 @@ Popup.Footer = PopupFooter;
|
|
|
3662
3736
|
// src/radio/radio.tsx
|
|
3663
3737
|
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
3664
3738
|
var import_clsx34 = __toESM(require("clsx"));
|
|
3665
|
-
var
|
|
3739
|
+
var import_react53 = require("react");
|
|
3666
3740
|
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
3667
3741
|
function Radio({
|
|
3668
3742
|
name,
|
|
@@ -3675,14 +3749,14 @@ function Radio({
|
|
|
3675
3749
|
onChange
|
|
3676
3750
|
}) {
|
|
3677
3751
|
const isLarge = size === "large";
|
|
3678
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
3679
|
-
const handleMouseOverInput = (0,
|
|
3752
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react53.useState)(false);
|
|
3753
|
+
const handleMouseOverInput = (0, import_react53.useCallback)(() => {
|
|
3680
3754
|
setIsMouseOver(true);
|
|
3681
3755
|
}, []);
|
|
3682
|
-
const handleMouseOutInput = (0,
|
|
3756
|
+
const handleMouseOutInput = (0, import_react53.useCallback)(() => {
|
|
3683
3757
|
setIsMouseOver(false);
|
|
3684
3758
|
}, []);
|
|
3685
|
-
const handleChange = (0,
|
|
3759
|
+
const handleChange = (0, import_react53.useCallback)(
|
|
3686
3760
|
(e) => !isDisabled && onChange?.(e),
|
|
3687
3761
|
[isDisabled, onChange]
|
|
3688
3762
|
);
|
|
@@ -3763,13 +3837,13 @@ function Radio({
|
|
|
3763
3837
|
}
|
|
3764
3838
|
|
|
3765
3839
|
// src/radio-card/radio-card.tsx
|
|
3766
|
-
var
|
|
3840
|
+
var import_react56 = require("react");
|
|
3767
3841
|
|
|
3768
3842
|
// src/radio-card/radio-card-context.ts
|
|
3769
|
-
var
|
|
3770
|
-
var RadioCardContext = (0,
|
|
3843
|
+
var import_react54 = require("react");
|
|
3844
|
+
var RadioCardContext = (0, import_react54.createContext)(null);
|
|
3771
3845
|
function useRadioCardContext(componentName) {
|
|
3772
|
-
const context = (0,
|
|
3846
|
+
const context = (0, import_react54.useContext)(RadioCardContext);
|
|
3773
3847
|
if (context === null) {
|
|
3774
3848
|
throw new Error(`<${componentName}> \u306F <RadioCard> \u306E\u5185\u90E8\u3067\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044`);
|
|
3775
3849
|
}
|
|
@@ -3809,11 +3883,11 @@ RadioCardGroup.displayName = "RadioCard.Group";
|
|
|
3809
3883
|
// src/radio-card/radio-card-item.tsx
|
|
3810
3884
|
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
3811
3885
|
var import_clsx35 = __toESM(require("clsx"));
|
|
3812
|
-
var
|
|
3886
|
+
var import_react55 = require("react");
|
|
3813
3887
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3814
3888
|
function RadioCardItem({ value, label, description, isDisabled: itemDisabled = false, id }) {
|
|
3815
3889
|
const context = useRadioCardContext("RadioCard.Item");
|
|
3816
|
-
const autoId = (0,
|
|
3890
|
+
const autoId = (0, import_react55.useId)();
|
|
3817
3891
|
const inputId = id ?? autoId;
|
|
3818
3892
|
const labelId = `${inputId}-label`;
|
|
3819
3893
|
const descriptionId = `${inputId}-description`;
|
|
@@ -3907,24 +3981,24 @@ function RadioCardRoot({
|
|
|
3907
3981
|
"aria-label": ariaLabel,
|
|
3908
3982
|
"aria-labelledby": ariaLabelledby
|
|
3909
3983
|
}) {
|
|
3910
|
-
const autoName = (0,
|
|
3911
|
-
const baseId = (0,
|
|
3984
|
+
const autoName = (0, import_react56.useId)();
|
|
3985
|
+
const baseId = (0, import_react56.useId)();
|
|
3912
3986
|
const resolvedName = name ?? autoName;
|
|
3913
3987
|
const errorIds = [];
|
|
3914
|
-
const enhancedChildren =
|
|
3915
|
-
if (!(0,
|
|
3988
|
+
const enhancedChildren = import_react56.Children.map(children, (child) => {
|
|
3989
|
+
if (!(0, import_react56.isValidElement)(child)) {
|
|
3916
3990
|
return child;
|
|
3917
3991
|
}
|
|
3918
3992
|
if (child.type === RadioCardErrorMessage && isError) {
|
|
3919
3993
|
const errorChild = child;
|
|
3920
3994
|
const assignedId = errorChild.props.id ?? `${baseId}-error-${errorIds.length + 1}`;
|
|
3921
3995
|
errorIds.push(assignedId);
|
|
3922
|
-
return (0,
|
|
3996
|
+
return (0, import_react56.cloneElement)(errorChild, { id: assignedId });
|
|
3923
3997
|
}
|
|
3924
3998
|
return child;
|
|
3925
3999
|
});
|
|
3926
4000
|
const errorDescribedBy = errorIds.length > 0 ? errorIds.join(" ") : null;
|
|
3927
|
-
const contextValue = (0,
|
|
4001
|
+
const contextValue = (0, import_react56.useMemo)(
|
|
3928
4002
|
() => ({
|
|
3929
4003
|
value,
|
|
3930
4004
|
onChange,
|
|
@@ -3948,9 +4022,9 @@ var RadioCard = Object.assign(RadioCardRoot, {
|
|
|
3948
4022
|
|
|
3949
4023
|
// src/search/search.tsx
|
|
3950
4024
|
var import_clsx36 = require("clsx");
|
|
3951
|
-
var
|
|
4025
|
+
var import_react57 = require("react");
|
|
3952
4026
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
3953
|
-
var Search = (0,
|
|
4027
|
+
var Search = (0, import_react57.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
3954
4028
|
const classes = (0, import_clsx36.clsx)(
|
|
3955
4029
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
3956
4030
|
{ "h-8 px-3": size === "medium" },
|
|
@@ -3988,16 +4062,16 @@ var Search = (0, import_react56.forwardRef)(({ width = "100%", size = "medium",
|
|
|
3988
4062
|
Search.displayName = "Search";
|
|
3989
4063
|
|
|
3990
4064
|
// src/segmented-control/segmented-control.tsx
|
|
3991
|
-
var
|
|
4065
|
+
var import_react60 = __toESM(require("react"));
|
|
3992
4066
|
|
|
3993
4067
|
// src/segmented-control/segmented-control-context.ts
|
|
3994
|
-
var
|
|
3995
|
-
var SegmentedControlContext = (0,
|
|
4068
|
+
var import_react58 = require("react");
|
|
4069
|
+
var SegmentedControlContext = (0, import_react58.createContext)(null);
|
|
3996
4070
|
|
|
3997
4071
|
// src/segmented-control/segmented-control-item.tsx
|
|
3998
4072
|
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
3999
4073
|
var import_clsx37 = require("clsx");
|
|
4000
|
-
var
|
|
4074
|
+
var import_react59 = require("react");
|
|
4001
4075
|
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
4002
4076
|
var SegmentedControlItem = ({
|
|
4003
4077
|
label,
|
|
@@ -4007,9 +4081,9 @@ var SegmentedControlItem = ({
|
|
|
4007
4081
|
"aria-label": ariaLabel,
|
|
4008
4082
|
...rest
|
|
4009
4083
|
}) => {
|
|
4010
|
-
const context = (0,
|
|
4011
|
-
const buttonRef = (0,
|
|
4012
|
-
const lastInteractionWasMouse = (0,
|
|
4084
|
+
const context = (0, import_react59.useContext)(SegmentedControlContext);
|
|
4085
|
+
const buttonRef = (0, import_react59.useRef)(null);
|
|
4086
|
+
const lastInteractionWasMouse = (0, import_react59.useRef)(false);
|
|
4013
4087
|
if (context === null) {
|
|
4014
4088
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
4015
4089
|
}
|
|
@@ -4025,7 +4099,7 @@ var SegmentedControlItem = ({
|
|
|
4025
4099
|
const isSelected = value === selectedValue;
|
|
4026
4100
|
const isFocused = value === focusedValue;
|
|
4027
4101
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
4028
|
-
(0,
|
|
4102
|
+
(0, import_react59.useEffect)(() => {
|
|
4029
4103
|
if (isFocused === true && buttonRef.current !== null) {
|
|
4030
4104
|
buttonRef.current.focus();
|
|
4031
4105
|
}
|
|
@@ -4102,15 +4176,15 @@ var SegmentedControl = ({
|
|
|
4102
4176
|
"aria-label": ariaLabel,
|
|
4103
4177
|
...rest
|
|
4104
4178
|
}) => {
|
|
4105
|
-
const containerRef = (0,
|
|
4106
|
-
const itemIds =
|
|
4107
|
-
if (!
|
|
4179
|
+
const containerRef = (0, import_react60.useRef)(null);
|
|
4180
|
+
const itemIds = import_react60.Children.toArray(children).filter((child) => {
|
|
4181
|
+
if (!import_react60.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
4108
4182
|
return false;
|
|
4109
4183
|
}
|
|
4110
4184
|
const props = child.props;
|
|
4111
4185
|
return props.isDisabled !== true;
|
|
4112
4186
|
}).map((child) => child.props.value);
|
|
4113
|
-
const childrenCount =
|
|
4187
|
+
const childrenCount = import_react60.Children.count(children);
|
|
4114
4188
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
4115
4189
|
const {
|
|
4116
4190
|
focusedValue,
|
|
@@ -4156,7 +4230,7 @@ SegmentedControl.Item = SegmentedControlItem;
|
|
|
4156
4230
|
// src/select-sort/select-sort.tsx
|
|
4157
4231
|
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
4158
4232
|
var import_clsx40 = __toESM(require("clsx"));
|
|
4159
|
-
var
|
|
4233
|
+
var import_react61 = require("react");
|
|
4160
4234
|
|
|
4161
4235
|
// src/select-sort/select-list.tsx
|
|
4162
4236
|
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
@@ -4223,8 +4297,8 @@ function SelectSort({
|
|
|
4223
4297
|
onChange,
|
|
4224
4298
|
onClickDeselect
|
|
4225
4299
|
}) {
|
|
4226
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
4227
|
-
const targetRef = (0,
|
|
4300
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react61.useState)(false);
|
|
4301
|
+
const targetRef = (0, import_react61.useRef)(null);
|
|
4228
4302
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
4229
4303
|
useDismissOnModalOpen(() => {
|
|
4230
4304
|
if (isOptionListOpen) {
|
|
@@ -4232,7 +4306,7 @@ function SelectSort({
|
|
|
4232
4306
|
}
|
|
4233
4307
|
});
|
|
4234
4308
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
4235
|
-
const handleClickItem = (0,
|
|
4309
|
+
const handleClickItem = (0, import_react61.useCallback)(
|
|
4236
4310
|
(value) => {
|
|
4237
4311
|
onChange?.(value);
|
|
4238
4312
|
setIsOptionListOpen(false);
|
|
@@ -4299,7 +4373,7 @@ function SelectSort({
|
|
|
4299
4373
|
// src/sort-button/sort-button.tsx
|
|
4300
4374
|
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
4301
4375
|
var import_clsx41 = __toESM(require("clsx"));
|
|
4302
|
-
var
|
|
4376
|
+
var import_react62 = require("react");
|
|
4303
4377
|
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
4304
4378
|
function SortButton({
|
|
4305
4379
|
size = "medium",
|
|
@@ -4311,7 +4385,7 @@ function SortButton({
|
|
|
4311
4385
|
"aria-label": ariaLabel,
|
|
4312
4386
|
...rest
|
|
4313
4387
|
}) {
|
|
4314
|
-
const handleClick = (0,
|
|
4388
|
+
const handleClick = (0, import_react62.useCallback)(() => {
|
|
4315
4389
|
if (isDisabled || !onClick) return;
|
|
4316
4390
|
onClick();
|
|
4317
4391
|
}, [isDisabled, onClick]);
|
|
@@ -4369,13 +4443,13 @@ function SortButton({
|
|
|
4369
4443
|
|
|
4370
4444
|
// src/steps/steps.tsx
|
|
4371
4445
|
var import_clsx44 = require("clsx");
|
|
4372
|
-
var
|
|
4446
|
+
var import_react65 = require("react");
|
|
4373
4447
|
|
|
4374
4448
|
// src/steps/steps-context.ts
|
|
4375
|
-
var
|
|
4376
|
-
var StepsContext = (0,
|
|
4449
|
+
var import_react63 = require("react");
|
|
4450
|
+
var StepsContext = (0, import_react63.createContext)(null);
|
|
4377
4451
|
function useStepsContext() {
|
|
4378
|
-
const context = (0,
|
|
4452
|
+
const context = (0, import_react63.useContext)(StepsContext);
|
|
4379
4453
|
if (context === null) {
|
|
4380
4454
|
throw new Error("Steps.Item must be used within <Steps>");
|
|
4381
4455
|
}
|
|
@@ -4386,10 +4460,10 @@ function useStepsContext() {
|
|
|
4386
4460
|
var import_clsx43 = require("clsx");
|
|
4387
4461
|
|
|
4388
4462
|
// src/steps/steps-item-context.ts
|
|
4389
|
-
var
|
|
4390
|
-
var StepsItemContext = (0,
|
|
4463
|
+
var import_react64 = require("react");
|
|
4464
|
+
var StepsItemContext = (0, import_react64.createContext)(null);
|
|
4391
4465
|
function useStepsItemContext() {
|
|
4392
|
-
const context = (0,
|
|
4466
|
+
const context = (0, import_react64.useContext)(StepsItemContext);
|
|
4393
4467
|
if (context === null) {
|
|
4394
4468
|
throw new Error("Steps.Item must be rendered inside a <Steps> component");
|
|
4395
4469
|
}
|
|
@@ -4529,15 +4603,15 @@ function HorizontalSeparatorCell({
|
|
|
4529
4603
|
}
|
|
4530
4604
|
function collectStepsItems(children) {
|
|
4531
4605
|
const result = [];
|
|
4532
|
-
|
|
4533
|
-
if (!(0,
|
|
4606
|
+
import_react65.Children.toArray(children).forEach((child) => {
|
|
4607
|
+
if (!(0, import_react65.isValidElement)(child)) {
|
|
4534
4608
|
return;
|
|
4535
4609
|
}
|
|
4536
4610
|
if (child.type === StepsItem) {
|
|
4537
4611
|
result.push(child);
|
|
4538
4612
|
return;
|
|
4539
4613
|
}
|
|
4540
|
-
if (child.type ===
|
|
4614
|
+
if (child.type === import_react65.Fragment) {
|
|
4541
4615
|
const fragmentChildren = child.props.children;
|
|
4542
4616
|
result.push(...collectStepsItems(fragmentChildren));
|
|
4543
4617
|
}
|
|
@@ -4554,12 +4628,12 @@ function StepsRoot({
|
|
|
4554
4628
|
variant = "solid",
|
|
4555
4629
|
"aria-label": ariaLabel
|
|
4556
4630
|
}) {
|
|
4557
|
-
const baseId = (0,
|
|
4558
|
-
const [internalStep] = (0,
|
|
4631
|
+
const baseId = (0, import_react65.useId)();
|
|
4632
|
+
const [internalStep] = (0, import_react65.useState)(defaultCurrentStep ?? 0);
|
|
4559
4633
|
const resolvedCurrentStep = currentStep ?? internalStep;
|
|
4560
|
-
const itemElements = (0,
|
|
4634
|
+
const itemElements = (0, import_react65.useMemo)(() => collectStepsItems(children), [children]);
|
|
4561
4635
|
const stepsCount = itemElements.length;
|
|
4562
|
-
const contextValue = (0,
|
|
4636
|
+
const contextValue = (0, import_react65.useMemo)(
|
|
4563
4637
|
() => ({
|
|
4564
4638
|
size,
|
|
4565
4639
|
orientation,
|
|
@@ -4612,7 +4686,7 @@ Steps.Item = StepsItem;
|
|
|
4612
4686
|
|
|
4613
4687
|
// src/tab/tab.tsx
|
|
4614
4688
|
var import_clsx46 = require("clsx");
|
|
4615
|
-
var
|
|
4689
|
+
var import_react66 = require("react");
|
|
4616
4690
|
|
|
4617
4691
|
// src/tab/tab-item.tsx
|
|
4618
4692
|
var import_clsx45 = require("clsx");
|
|
@@ -4651,7 +4725,7 @@ var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
|
4651
4725
|
// src/tab/tab.tsx
|
|
4652
4726
|
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
4653
4727
|
function Tab({ children, layout = "auto" }) {
|
|
4654
|
-
const childrenCount =
|
|
4728
|
+
const childrenCount = import_react66.Children.count(children);
|
|
4655
4729
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
4656
4730
|
const containerClasses = (0, import_clsx46.clsx)(
|
|
4657
4731
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
@@ -4758,13 +4832,13 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
4758
4832
|
|
|
4759
4833
|
// src/text-area/text-area.tsx
|
|
4760
4834
|
var import_clsx53 = require("clsx");
|
|
4761
|
-
var
|
|
4835
|
+
var import_react70 = require("react");
|
|
4762
4836
|
|
|
4763
4837
|
// src/text-area/text-area-context.tsx
|
|
4764
|
-
var
|
|
4765
|
-
var TextAreaCompoundContext = (0,
|
|
4838
|
+
var import_react67 = require("react");
|
|
4839
|
+
var TextAreaCompoundContext = (0, import_react67.createContext)(null);
|
|
4766
4840
|
var useTextAreaCompoundContext = (componentName) => {
|
|
4767
|
-
const context = (0,
|
|
4841
|
+
const context = (0, import_react67.useContext)(TextAreaCompoundContext);
|
|
4768
4842
|
if (context == null) {
|
|
4769
4843
|
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`);
|
|
4770
4844
|
}
|
|
@@ -4773,9 +4847,9 @@ var useTextAreaCompoundContext = (componentName) => {
|
|
|
4773
4847
|
|
|
4774
4848
|
// src/text-area/text-area-error-message.tsx
|
|
4775
4849
|
var import_clsx51 = require("clsx");
|
|
4776
|
-
var
|
|
4850
|
+
var import_react68 = require("react");
|
|
4777
4851
|
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
4778
|
-
var TextAreaErrorMessage = (0,
|
|
4852
|
+
var TextAreaErrorMessage = (0, import_react68.forwardRef)(
|
|
4779
4853
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
4780
4854
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
4781
4855
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
@@ -4791,9 +4865,9 @@ TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
|
4791
4865
|
|
|
4792
4866
|
// src/text-area/text-area-helper-message.tsx
|
|
4793
4867
|
var import_clsx52 = require("clsx");
|
|
4794
|
-
var
|
|
4868
|
+
var import_react69 = require("react");
|
|
4795
4869
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
4796
|
-
var TextAreaHelperMessage = (0,
|
|
4870
|
+
var TextAreaHelperMessage = (0, import_react69.forwardRef)((props, ref) => {
|
|
4797
4871
|
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
4798
4872
|
const typographyClass = textAreaProps.size === "large" ? "typography-label13regular" : "typography-label12regular";
|
|
4799
4873
|
const helperMessageClassName = (0, import_clsx52.clsx)(typographyClass, "text-text02");
|
|
@@ -4819,8 +4893,8 @@ function TextAreaInner({
|
|
|
4819
4893
|
maxLength,
|
|
4820
4894
|
...props
|
|
4821
4895
|
}, ref) {
|
|
4822
|
-
const autoGeneratedId = (0,
|
|
4823
|
-
const textAreaPropsForContext = (0,
|
|
4896
|
+
const autoGeneratedId = (0, import_react70.useId)();
|
|
4897
|
+
const textAreaPropsForContext = (0, import_react70.useMemo)(
|
|
4824
4898
|
() => ({
|
|
4825
4899
|
size,
|
|
4826
4900
|
variant,
|
|
@@ -4828,7 +4902,7 @@ function TextAreaInner({
|
|
|
4828
4902
|
}),
|
|
4829
4903
|
[size, variant, isError]
|
|
4830
4904
|
);
|
|
4831
|
-
const contextValue = (0,
|
|
4905
|
+
const contextValue = (0, import_react70.useMemo)(
|
|
4832
4906
|
() => ({
|
|
4833
4907
|
textAreaProps: textAreaPropsForContext,
|
|
4834
4908
|
forwardedRef: ref
|
|
@@ -4838,21 +4912,21 @@ function TextAreaInner({
|
|
|
4838
4912
|
const helperMessageIds = [];
|
|
4839
4913
|
const errorIds = [];
|
|
4840
4914
|
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
4841
|
-
const enhancedChildren =
|
|
4842
|
-
if (!(0,
|
|
4915
|
+
const enhancedChildren = import_react70.Children.map(children, (child) => {
|
|
4916
|
+
if (!(0, import_react70.isValidElement)(child)) {
|
|
4843
4917
|
return child;
|
|
4844
4918
|
}
|
|
4845
4919
|
if (child.type === TextAreaHelperMessage) {
|
|
4846
4920
|
const helperChild = child;
|
|
4847
4921
|
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
4848
4922
|
helperMessageIds.push(assignedId);
|
|
4849
|
-
return (0,
|
|
4923
|
+
return (0, import_react70.cloneElement)(helperChild, { id: assignedId });
|
|
4850
4924
|
}
|
|
4851
4925
|
if (child.type === TextAreaErrorMessage && isError) {
|
|
4852
4926
|
const errorChild = child;
|
|
4853
4927
|
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
4854
4928
|
errorIds.push(assignedId);
|
|
4855
|
-
return (0,
|
|
4929
|
+
return (0, import_react70.cloneElement)(errorChild, { id: assignedId });
|
|
4856
4930
|
}
|
|
4857
4931
|
return child;
|
|
4858
4932
|
});
|
|
@@ -4954,7 +5028,7 @@ function TextAreaInner({
|
|
|
4954
5028
|
children: counterLimit != null ? `${currentLength}/${counterLimit}\u6587\u5B57` : `${currentLength}\u6587\u5B57`
|
|
4955
5029
|
}
|
|
4956
5030
|
) : null;
|
|
4957
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
5031
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react70.Children.toArray(enhancedChildren);
|
|
4958
5032
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
4959
5033
|
const hasBottomContent = hasMessageChildren || counterElement != null;
|
|
4960
5034
|
if (!hasBottomContent) {
|
|
@@ -4975,20 +5049,20 @@ var attachStatics2 = (component) => {
|
|
|
4975
5049
|
component.displayName = "TextArea";
|
|
4976
5050
|
return component;
|
|
4977
5051
|
};
|
|
4978
|
-
var TextAreaBase = (0,
|
|
5052
|
+
var TextAreaBase = (0, import_react70.forwardRef)(function TextAreaBase2(props, ref) {
|
|
4979
5053
|
return TextAreaInner(props, ref);
|
|
4980
5054
|
});
|
|
4981
5055
|
var TextArea = attachStatics2(TextAreaBase);
|
|
4982
5056
|
|
|
4983
5057
|
// src/time-picker/time-picker.tsx
|
|
4984
5058
|
var import_clsx55 = require("clsx");
|
|
4985
|
-
var
|
|
5059
|
+
var import_react73 = require("react");
|
|
4986
5060
|
|
|
4987
5061
|
// src/time-picker/time-picker-context.tsx
|
|
4988
|
-
var
|
|
4989
|
-
var TimePickerCompoundContext = (0,
|
|
5062
|
+
var import_react71 = require("react");
|
|
5063
|
+
var TimePickerCompoundContext = (0, import_react71.createContext)(null);
|
|
4990
5064
|
var useTimePickerCompoundContext = (componentName) => {
|
|
4991
|
-
const context = (0,
|
|
5065
|
+
const context = (0, import_react71.useContext)(TimePickerCompoundContext);
|
|
4992
5066
|
if (context == null) {
|
|
4993
5067
|
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`);
|
|
4994
5068
|
}
|
|
@@ -4997,9 +5071,9 @@ var useTimePickerCompoundContext = (componentName) => {
|
|
|
4997
5071
|
|
|
4998
5072
|
// src/time-picker/time-picker-error-message.tsx
|
|
4999
5073
|
var import_clsx54 = require("clsx");
|
|
5000
|
-
var
|
|
5074
|
+
var import_react72 = require("react");
|
|
5001
5075
|
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
5002
|
-
var TimePickerErrorMessage = (0,
|
|
5076
|
+
var TimePickerErrorMessage = (0, import_react72.forwardRef)(
|
|
5003
5077
|
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
5004
5078
|
const { size, isError } = useTimePickerCompoundContext("TimePicker.ErrorMessage");
|
|
5005
5079
|
const typographyClass = size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
@@ -5122,9 +5196,9 @@ var TimePicker = ({
|
|
|
5122
5196
|
isError = false,
|
|
5123
5197
|
children
|
|
5124
5198
|
}) => {
|
|
5125
|
-
const autoGeneratedId = (0,
|
|
5126
|
-
const hourOptions = (0,
|
|
5127
|
-
const minuteOptions = (0,
|
|
5199
|
+
const autoGeneratedId = (0, import_react73.useId)();
|
|
5200
|
+
const hourOptions = (0, import_react73.useMemo)(() => generateHourOptions(minuteStep, minTime, maxTime), [minuteStep, minTime, maxTime]);
|
|
5201
|
+
const minuteOptions = (0, import_react73.useMemo)(
|
|
5128
5202
|
() => generateMinuteOptions(minuteStep, value.hour, minTime, maxTime),
|
|
5129
5203
|
[minuteStep, value.hour, minTime, maxTime]
|
|
5130
5204
|
);
|
|
@@ -5139,19 +5213,19 @@ var TimePicker = ({
|
|
|
5139
5213
|
onChange({ hour: value.hour, minute: option != null ? Number(option.value) : null });
|
|
5140
5214
|
};
|
|
5141
5215
|
const errorIds = [];
|
|
5142
|
-
const assignErrorIds = (nodes) =>
|
|
5143
|
-
if (!(0,
|
|
5216
|
+
const assignErrorIds = (nodes) => import_react73.Children.map(nodes, (child) => {
|
|
5217
|
+
if (!(0, import_react73.isValidElement)(child)) {
|
|
5144
5218
|
return child;
|
|
5145
5219
|
}
|
|
5146
|
-
if (child.type ===
|
|
5220
|
+
if (child.type === import_react73.Fragment) {
|
|
5147
5221
|
const fragmentChild = child;
|
|
5148
|
-
return (0,
|
|
5222
|
+
return (0, import_react73.cloneElement)(fragmentChild, {}, assignErrorIds(fragmentChild.props.children));
|
|
5149
5223
|
}
|
|
5150
5224
|
if (child.type === TimePickerErrorMessage && isError) {
|
|
5151
5225
|
const errorChild = child;
|
|
5152
5226
|
const assignedId = errorChild.props.id ?? `${autoGeneratedId}-error-${errorIds.length + 1}`;
|
|
5153
5227
|
errorIds.push(assignedId);
|
|
5154
|
-
return (0,
|
|
5228
|
+
return (0, import_react73.cloneElement)(errorChild, { id: assignedId });
|
|
5155
5229
|
}
|
|
5156
5230
|
return child;
|
|
5157
5231
|
});
|
|
@@ -5163,7 +5237,7 @@ var TimePicker = ({
|
|
|
5163
5237
|
"typography-label16regular": size === "large"
|
|
5164
5238
|
});
|
|
5165
5239
|
const selectWidth = SELECT_WIDTH_BY_SIZE[size];
|
|
5166
|
-
const contextValue = (0,
|
|
5240
|
+
const contextValue = (0, import_react73.useMemo)(() => ({ size, isError }), [size, isError]);
|
|
5167
5241
|
const timeInputs = /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5168
5242
|
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
5169
5243
|
Select,
|
|
@@ -5199,7 +5273,7 @@ var TimePicker = ({
|
|
|
5199
5273
|
}
|
|
5200
5274
|
)
|
|
5201
5275
|
] });
|
|
5202
|
-
const stackedChildren = enhancedChildren == null ? [] :
|
|
5276
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react73.Children.toArray(enhancedChildren);
|
|
5203
5277
|
const hasMessageChildren = stackedChildren.length > 0;
|
|
5204
5278
|
if (!hasMessageChildren) {
|
|
5205
5279
|
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 }) });
|
|
@@ -5214,7 +5288,7 @@ TimePicker.displayName = "TimePicker";
|
|
|
5214
5288
|
|
|
5215
5289
|
// src/toast/toast.tsx
|
|
5216
5290
|
var import_clsx56 = require("clsx");
|
|
5217
|
-
var
|
|
5291
|
+
var import_react74 = require("react");
|
|
5218
5292
|
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
5219
5293
|
var CLOSE_TIME_MSEC = 5e3;
|
|
5220
5294
|
var REMOVAL_FALLBACK_MSEC = 1e3;
|
|
@@ -5230,20 +5304,20 @@ function Toast({
|
|
|
5230
5304
|
children,
|
|
5231
5305
|
onClickClose
|
|
5232
5306
|
}) {
|
|
5233
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
5234
|
-
const onClickCloseRef = (0,
|
|
5235
|
-
(0,
|
|
5307
|
+
const [isRemoving, setIsRemoving] = (0, import_react74.useState)(false);
|
|
5308
|
+
const onClickCloseRef = (0, import_react74.useRef)(onClickClose);
|
|
5309
|
+
(0, import_react74.useEffect)(() => {
|
|
5236
5310
|
onClickCloseRef.current = onClickClose;
|
|
5237
5311
|
}, [onClickClose]);
|
|
5238
|
-
const hasNotifiedCloseRef = (0,
|
|
5239
|
-
const notifyClose = (0,
|
|
5312
|
+
const hasNotifiedCloseRef = (0, import_react74.useRef)(false);
|
|
5313
|
+
const notifyClose = (0, import_react74.useCallback)(() => {
|
|
5240
5314
|
if (hasNotifiedCloseRef.current) {
|
|
5241
5315
|
return;
|
|
5242
5316
|
}
|
|
5243
5317
|
hasNotifiedCloseRef.current = true;
|
|
5244
5318
|
onClickCloseRef.current();
|
|
5245
5319
|
}, []);
|
|
5246
|
-
const handleClose = (0,
|
|
5320
|
+
const handleClose = (0, import_react74.useCallback)(() => {
|
|
5247
5321
|
if (isAnimation) {
|
|
5248
5322
|
setIsRemoving(true);
|
|
5249
5323
|
} else {
|
|
@@ -5258,7 +5332,7 @@ function Toast({
|
|
|
5258
5332
|
notifyClose();
|
|
5259
5333
|
}
|
|
5260
5334
|
};
|
|
5261
|
-
(0,
|
|
5335
|
+
(0, import_react74.useEffect)(() => {
|
|
5262
5336
|
if (!isAutoClose) {
|
|
5263
5337
|
return;
|
|
5264
5338
|
}
|
|
@@ -5271,7 +5345,7 @@ function Toast({
|
|
|
5271
5345
|
}, CLOSE_TIME_MSEC);
|
|
5272
5346
|
return () => window.clearTimeout(timer);
|
|
5273
5347
|
}, [isAutoClose, isAnimation, notifyClose]);
|
|
5274
|
-
(0,
|
|
5348
|
+
(0, import_react74.useEffect)(() => {
|
|
5275
5349
|
if (!isRemoving) {
|
|
5276
5350
|
return;
|
|
5277
5351
|
}
|
|
@@ -5315,15 +5389,15 @@ function Toast({
|
|
|
5315
5389
|
}
|
|
5316
5390
|
|
|
5317
5391
|
// src/toast/toast-provider.tsx
|
|
5318
|
-
var
|
|
5392
|
+
var import_react75 = require("react");
|
|
5319
5393
|
var import_react_dom3 = require("react-dom");
|
|
5320
5394
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
5321
|
-
var ToastContext = (0,
|
|
5395
|
+
var ToastContext = (0, import_react75.createContext)({});
|
|
5322
5396
|
var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
5323
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
5324
|
-
const [toasts, setToasts] = (0,
|
|
5325
|
-
const nextIdRef = (0,
|
|
5326
|
-
const addToast = (0,
|
|
5397
|
+
const [isClientRender, setIsClientRender] = (0, import_react75.useState)(false);
|
|
5398
|
+
const [toasts, setToasts] = (0, import_react75.useState)([]);
|
|
5399
|
+
const nextIdRef = (0, import_react75.useRef)(0);
|
|
5400
|
+
const addToast = (0, import_react75.useCallback)(
|
|
5327
5401
|
(args) => {
|
|
5328
5402
|
nextIdRef.current += 1;
|
|
5329
5403
|
const id = nextIdRef.current;
|
|
@@ -5341,10 +5415,10 @@ var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
|
5341
5415
|
},
|
|
5342
5416
|
[hasCloseButton]
|
|
5343
5417
|
);
|
|
5344
|
-
const removeToast = (0,
|
|
5418
|
+
const removeToast = (0, import_react75.useCallback)((id) => {
|
|
5345
5419
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
5346
5420
|
}, []);
|
|
5347
|
-
(0,
|
|
5421
|
+
(0, import_react75.useEffect)(() => {
|
|
5348
5422
|
setIsClientRender(true);
|
|
5349
5423
|
}, []);
|
|
5350
5424
|
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
@@ -5353,6 +5427,7 @@ var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
|
5353
5427
|
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
5354
5428
|
"div",
|
|
5355
5429
|
{
|
|
5430
|
+
...{ [TOP_LAYER_ATTRIBUTE]: "" },
|
|
5356
5431
|
role: "region",
|
|
5357
5432
|
"aria-label": "\u901A\u77E5",
|
|
5358
5433
|
className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-4",
|
|
@@ -5376,7 +5451,7 @@ var ToastProvider = ({ children, hasCloseButton = false }) => {
|
|
|
5376
5451
|
] });
|
|
5377
5452
|
};
|
|
5378
5453
|
var useToast = () => {
|
|
5379
|
-
return (0,
|
|
5454
|
+
return (0, import_react75.useContext)(ToastContext);
|
|
5380
5455
|
};
|
|
5381
5456
|
|
|
5382
5457
|
// src/toggle/toggle.tsx
|
|
@@ -5436,7 +5511,7 @@ function Toggle({
|
|
|
5436
5511
|
}
|
|
5437
5512
|
|
|
5438
5513
|
// src/tooltip/tooltip.tsx
|
|
5439
|
-
var
|
|
5514
|
+
var import_react77 = require("react");
|
|
5440
5515
|
var import_react_dom4 = require("react-dom");
|
|
5441
5516
|
|
|
5442
5517
|
// src/tooltip/tooltip-content.tsx
|
|
@@ -5531,9 +5606,9 @@ var TooltipContent = ({
|
|
|
5531
5606
|
};
|
|
5532
5607
|
|
|
5533
5608
|
// src/tooltip/tooltip-hook.ts
|
|
5534
|
-
var
|
|
5609
|
+
var import_react76 = require("react");
|
|
5535
5610
|
var useTooltip = () => {
|
|
5536
|
-
const calculatePosition = (0,
|
|
5611
|
+
const calculatePosition = (0, import_react76.useCallback)(
|
|
5537
5612
|
(args) => {
|
|
5538
5613
|
const result = {
|
|
5539
5614
|
maxWidth: "none",
|
|
@@ -5597,8 +5672,8 @@ function Tooltip({
|
|
|
5597
5672
|
portalTarget
|
|
5598
5673
|
}) {
|
|
5599
5674
|
const { calculatePosition } = useTooltip();
|
|
5600
|
-
const [isVisible, setIsVisible] = (0,
|
|
5601
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
5675
|
+
const [isVisible, setIsVisible] = (0, import_react77.useState)(false);
|
|
5676
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react77.useState)({
|
|
5602
5677
|
maxWidth: "none",
|
|
5603
5678
|
width: "auto",
|
|
5604
5679
|
left: "0px",
|
|
@@ -5607,8 +5682,8 @@ function Tooltip({
|
|
|
5607
5682
|
translateX: "0",
|
|
5608
5683
|
translateY: "0"
|
|
5609
5684
|
});
|
|
5610
|
-
const targetRef = (0,
|
|
5611
|
-
const handleMouseOverWrapper = (0,
|
|
5685
|
+
const targetRef = (0, import_react77.useRef)(null);
|
|
5686
|
+
const handleMouseOverWrapper = (0, import_react77.useCallback)(() => {
|
|
5612
5687
|
if (isDisabledHover) {
|
|
5613
5688
|
return;
|
|
5614
5689
|
}
|
|
@@ -5625,16 +5700,16 @@ function Tooltip({
|
|
|
5625
5700
|
}
|
|
5626
5701
|
setIsVisible(true);
|
|
5627
5702
|
}, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
|
|
5628
|
-
const handleMouseOutWrapper = (0,
|
|
5703
|
+
const handleMouseOutWrapper = (0, import_react77.useCallback)(() => {
|
|
5629
5704
|
setIsVisible(false);
|
|
5630
5705
|
}, []);
|
|
5631
|
-
(0,
|
|
5706
|
+
(0, import_react77.useEffect)(() => {
|
|
5632
5707
|
if (targetRef.current === null) return;
|
|
5633
5708
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
5634
5709
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
5635
5710
|
setTooltipPosition(position);
|
|
5636
5711
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
5637
|
-
(0,
|
|
5712
|
+
(0, import_react77.useEffect)(() => {
|
|
5638
5713
|
if (!isVisible) return;
|
|
5639
5714
|
const updatePosition = () => {
|
|
5640
5715
|
if (targetRef.current === null) return;
|