@zenkigen-inc/component-ui 1.15.3 → 1.16.1
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 +120 -50
- package/dist/index.d.ts +120 -50
- package/dist/index.js +581 -248
- package/dist/index.mjs +552 -222
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -171,7 +171,7 @@ function Checkbox({
|
|
|
171
171
|
"bg-disabled01": isDisabled && isChecked,
|
|
172
172
|
"bg-hover01": !(isDisabled && isChecked) && isMouseOver,
|
|
173
173
|
"bg-interactive01": !(isDisabled && isChecked) && !isMouseOver,
|
|
174
|
-
"bg-
|
|
174
|
+
"bg-hoverGray": !(isDisabled && isChecked) && isMouseOver && color === "gray",
|
|
175
175
|
"bg-interactive02": !(isDisabled && isChecked) && !isMouseOver && color === "gray",
|
|
176
176
|
"bg-hoverError": !(isDisabled && isChecked) && isMouseOver && color === "error",
|
|
177
177
|
"bg-supportError": !(isDisabled && isChecked) && !isMouseOver && color === "error",
|
|
@@ -491,20 +491,91 @@ function Heading(props) {
|
|
|
491
491
|
] });
|
|
492
492
|
}
|
|
493
493
|
|
|
494
|
+
// src/hooks/use-roving-focus.ts
|
|
495
|
+
import { useCallback as useCallback4, useState as useState4 } from "react";
|
|
496
|
+
var useRovingFocus = ({
|
|
497
|
+
values,
|
|
498
|
+
defaultFocusedValue,
|
|
499
|
+
isDisabled = false
|
|
500
|
+
}) => {
|
|
501
|
+
const [focusedValue, setFocusedValue] = useState4(
|
|
502
|
+
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
503
|
+
);
|
|
504
|
+
const handleFocusChange = useCallback4((newValue) => {
|
|
505
|
+
setFocusedValue(newValue);
|
|
506
|
+
}, []);
|
|
507
|
+
const handleBlur = useCallback4(() => {
|
|
508
|
+
setFocusedValue(null);
|
|
509
|
+
}, []);
|
|
510
|
+
const handleKeyDown = useCallback4(
|
|
511
|
+
(event) => {
|
|
512
|
+
if (isDisabled === true || values.length === 0) return;
|
|
513
|
+
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
514
|
+
let newIndex;
|
|
515
|
+
let targetValue;
|
|
516
|
+
switch (event.key) {
|
|
517
|
+
case "ArrowLeft":
|
|
518
|
+
case "ArrowUp":
|
|
519
|
+
event.preventDefault();
|
|
520
|
+
newIndex = currentIndex > 0 ? currentIndex - 1 : values.length - 1;
|
|
521
|
+
targetValue = values[newIndex];
|
|
522
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
523
|
+
handleFocusChange(targetValue);
|
|
524
|
+
}
|
|
525
|
+
break;
|
|
526
|
+
case "ArrowRight":
|
|
527
|
+
case "ArrowDown":
|
|
528
|
+
event.preventDefault();
|
|
529
|
+
newIndex = currentIndex < values.length - 1 ? currentIndex + 1 : 0;
|
|
530
|
+
targetValue = values[newIndex];
|
|
531
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
532
|
+
handleFocusChange(targetValue);
|
|
533
|
+
}
|
|
534
|
+
break;
|
|
535
|
+
case "Home":
|
|
536
|
+
event.preventDefault();
|
|
537
|
+
targetValue = values[0];
|
|
538
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
539
|
+
handleFocusChange(targetValue);
|
|
540
|
+
}
|
|
541
|
+
break;
|
|
542
|
+
case "End":
|
|
543
|
+
event.preventDefault();
|
|
544
|
+
targetValue = values[values.length - 1];
|
|
545
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
546
|
+
handleFocusChange(targetValue);
|
|
547
|
+
}
|
|
548
|
+
break;
|
|
549
|
+
default:
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
[focusedValue, values, isDisabled, handleFocusChange]
|
|
554
|
+
);
|
|
555
|
+
return {
|
|
556
|
+
focusedValue,
|
|
557
|
+
handleFocusChange,
|
|
558
|
+
handleKeyDown,
|
|
559
|
+
handleBlur,
|
|
560
|
+
setFocusedValue
|
|
561
|
+
};
|
|
562
|
+
};
|
|
563
|
+
|
|
494
564
|
// src/icon-button/icon-button.tsx
|
|
495
565
|
import { buttonColors as buttonColors3, focusVisible as focusVisible6 } from "@zenkigen-inc/component-theme";
|
|
496
566
|
import { clsx as clsx10 } from "clsx";
|
|
497
567
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
498
568
|
function IconButton({
|
|
569
|
+
icon,
|
|
499
570
|
size = "medium",
|
|
500
571
|
variant = "outline",
|
|
501
572
|
isNoPadding = false,
|
|
502
573
|
isDisabled = false,
|
|
574
|
+
isSelected = false,
|
|
503
575
|
...props
|
|
504
576
|
}) {
|
|
505
577
|
const baseClasses = clsx10(
|
|
506
578
|
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
507
|
-
buttonColors3[variant].base,
|
|
508
579
|
buttonColors3[variant].hover,
|
|
509
580
|
buttonColors3[variant].active,
|
|
510
581
|
buttonColors3[variant].disabled,
|
|
@@ -515,14 +586,20 @@ function IconButton({
|
|
|
515
586
|
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
516
587
|
"h-10 w-10": size === "large" && !isNoPadding,
|
|
517
588
|
"inline-flex": props.isAnchor,
|
|
518
|
-
"pointer-events-none": isDisabled
|
|
589
|
+
"pointer-events-none": isDisabled,
|
|
590
|
+
[buttonColors3[variant].selected]: isSelected,
|
|
591
|
+
[buttonColors3[variant].base]: !isSelected
|
|
519
592
|
}
|
|
520
593
|
);
|
|
521
594
|
const iconSize = size === "small" ? "small" : "medium";
|
|
522
595
|
if (props.isAnchor === true) {
|
|
523
|
-
|
|
596
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
597
|
+
return /* @__PURE__ */ jsx12("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ jsx12(Icon, { name: icon, size: iconSize }) });
|
|
524
598
|
} else {
|
|
525
|
-
|
|
599
|
+
const buttonProps = Object.fromEntries(
|
|
600
|
+
Object.entries(props).filter(([key]) => key !== "isAnchor" && key !== "onClick")
|
|
601
|
+
);
|
|
602
|
+
return /* @__PURE__ */ jsx12("button", { type: "button", className: baseClasses, disabled: isDisabled, onClick: props.onClick, ...buttonProps, children: /* @__PURE__ */ jsx12(Icon, { name: icon, size: iconSize }) });
|
|
526
603
|
}
|
|
527
604
|
}
|
|
528
605
|
|
|
@@ -577,7 +654,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
577
654
|
}
|
|
578
655
|
|
|
579
656
|
// src/modal/modal.tsx
|
|
580
|
-
import { useEffect as useEffect2, useState as
|
|
657
|
+
import { useEffect as useEffect2, useState as useState5 } from "react";
|
|
581
658
|
import { createPortal as createPortal2 } from "react-dom";
|
|
582
659
|
|
|
583
660
|
// src/modal/body-scroll-lock.tsx
|
|
@@ -682,7 +759,7 @@ function Modal({
|
|
|
682
759
|
onClose,
|
|
683
760
|
portalTargetRef
|
|
684
761
|
}) {
|
|
685
|
-
const [isMounted, setIsMounted] =
|
|
762
|
+
const [isMounted, setIsMounted] = useState5(false);
|
|
686
763
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
687
764
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
688
765
|
useEffect2(() => {
|
|
@@ -821,16 +898,17 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
821
898
|
}
|
|
822
899
|
|
|
823
900
|
// src/select/select.tsx
|
|
824
|
-
import {
|
|
901
|
+
import { focusVisible as focusVisible9, selectColors } from "@zenkigen-inc/component-theme";
|
|
825
902
|
import clsx18 from "clsx";
|
|
826
|
-
import { useRef as useRef3, useState as
|
|
903
|
+
import { useRef as useRef3, useState as useState6 } from "react";
|
|
827
904
|
|
|
828
905
|
// src/select/select-context.ts
|
|
829
906
|
import { createContext as createContext4 } from "react";
|
|
830
907
|
var SelectContext = createContext4({
|
|
831
908
|
size: "medium",
|
|
832
909
|
setIsOptionListOpen: () => false,
|
|
833
|
-
variant: "outline"
|
|
910
|
+
variant: "outline",
|
|
911
|
+
isError: false
|
|
834
912
|
});
|
|
835
913
|
|
|
836
914
|
// src/select/select-item.tsx
|
|
@@ -839,7 +917,7 @@ import clsx16 from "clsx";
|
|
|
839
917
|
import { useContext as useContext5 } from "react";
|
|
840
918
|
import { jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
841
919
|
function SelectItem({ option }) {
|
|
842
|
-
const { setIsOptionListOpen, selectedOption, onChange } = useContext5(SelectContext);
|
|
920
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = useContext5(SelectContext);
|
|
843
921
|
const handleClickItem = (option2) => {
|
|
844
922
|
onChange?.(option2);
|
|
845
923
|
setIsOptionListOpen(false);
|
|
@@ -848,7 +926,8 @@ function SelectItem({ option }) {
|
|
|
848
926
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
849
927
|
focusVisible7.inset,
|
|
850
928
|
{
|
|
851
|
-
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id,
|
|
929
|
+
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
930
|
+
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
852
931
|
"text-interactive02 fill-icon01 bg-uiBackground01": option.id !== selectedOption?.id
|
|
853
932
|
}
|
|
854
933
|
);
|
|
@@ -914,14 +993,17 @@ function Select({
|
|
|
914
993
|
placeholderIcon,
|
|
915
994
|
selectedOption = null,
|
|
916
995
|
isDisabled = false,
|
|
996
|
+
isError = false,
|
|
917
997
|
isOptionSelected = false,
|
|
918
998
|
onChange,
|
|
919
999
|
optionListMaxHeight
|
|
920
1000
|
}) {
|
|
921
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
1001
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState6(false);
|
|
922
1002
|
const targetRef = useRef3(null);
|
|
923
1003
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
924
1004
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1005
|
+
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
1006
|
+
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
925
1007
|
const wrapperClasses = clsx18("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
926
1008
|
"h-6": size === "x-small" || size === "small",
|
|
927
1009
|
"h-8": size === "medium",
|
|
@@ -930,16 +1012,17 @@ function Select({
|
|
|
930
1012
|
});
|
|
931
1013
|
const buttonClasses = clsx18(
|
|
932
1014
|
"flex size-full items-center rounded",
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1015
|
+
selectColors[buttonVariant].hover,
|
|
1016
|
+
selectColors[buttonVariant].active,
|
|
1017
|
+
selectColors[buttonVariant].disabled,
|
|
936
1018
|
focusVisible9.normal,
|
|
937
1019
|
{
|
|
938
|
-
[
|
|
939
|
-
[
|
|
1020
|
+
[selectColors[buttonVariant].selected]: isSelected,
|
|
1021
|
+
[selectColors[buttonVariant].base]: !isSelected,
|
|
940
1022
|
"px-2": size === "x-small" || size === "small",
|
|
941
1023
|
"px-4": size === "medium" || size === "large",
|
|
942
|
-
"pointer-events-none": isDisabled
|
|
1024
|
+
"pointer-events-none": isDisabled,
|
|
1025
|
+
"border-supportError": !isSelected && !isDisabled && isError
|
|
943
1026
|
}
|
|
944
1027
|
);
|
|
945
1028
|
const labelClasses = clsx18("overflow-hidden", {
|
|
@@ -958,7 +1041,8 @@ function Select({
|
|
|
958
1041
|
placeholder,
|
|
959
1042
|
setIsOptionListOpen,
|
|
960
1043
|
selectedOption,
|
|
961
|
-
onChange
|
|
1044
|
+
onChange,
|
|
1045
|
+
isError
|
|
962
1046
|
},
|
|
963
1047
|
children: /* @__PURE__ */ jsxs12("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
964
1048
|
/* @__PURE__ */ jsxs12("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
@@ -1056,17 +1140,17 @@ function PaginationSelect({
|
|
|
1056
1140
|
// src/radio/radio.tsx
|
|
1057
1141
|
import { focusVisible as focusVisible10 } from "@zenkigen-inc/component-theme";
|
|
1058
1142
|
import clsx19 from "clsx";
|
|
1059
|
-
import { useCallback as
|
|
1143
|
+
import { useCallback as useCallback5, useState as useState7 } from "react";
|
|
1060
1144
|
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1061
1145
|
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1062
|
-
const [isMouseOver, setIsMouseOver] =
|
|
1063
|
-
const handleMouseOverInput =
|
|
1146
|
+
const [isMouseOver, setIsMouseOver] = useState7(false);
|
|
1147
|
+
const handleMouseOverInput = useCallback5(() => {
|
|
1064
1148
|
setIsMouseOver(true);
|
|
1065
1149
|
}, []);
|
|
1066
|
-
const handleMouseOutInput =
|
|
1150
|
+
const handleMouseOutInput = useCallback5(() => {
|
|
1067
1151
|
setIsMouseOver(false);
|
|
1068
1152
|
}, []);
|
|
1069
|
-
const handleChange =
|
|
1153
|
+
const handleChange = useCallback5(
|
|
1070
1154
|
(e) => !isDisabled && onChange?.(e),
|
|
1071
1155
|
[isDisabled, onChange]
|
|
1072
1156
|
);
|
|
@@ -1165,38 +1249,204 @@ var Search = forwardRef(({ width = "100%", size = "medium", ...props }, ref) =>
|
|
|
1165
1249
|
});
|
|
1166
1250
|
Search.displayName = "Search";
|
|
1167
1251
|
|
|
1252
|
+
// src/segmented-control/segmented-control.tsx
|
|
1253
|
+
import React2, { Children, useRef as useRef5 } from "react";
|
|
1254
|
+
|
|
1255
|
+
// src/segmented-control/segmented-control-context.ts
|
|
1256
|
+
import { createContext as createContext5 } from "react";
|
|
1257
|
+
var SegmentedControlContext = createContext5(null);
|
|
1258
|
+
|
|
1259
|
+
// src/segmented-control/segmented-control-item.tsx
|
|
1260
|
+
import { focusVisible as focusVisible11 } from "@zenkigen-inc/component-theme";
|
|
1261
|
+
import { clsx as clsx21 } from "clsx";
|
|
1262
|
+
import { useContext as useContext7, useEffect as useEffect3, useRef as useRef4 } from "react";
|
|
1263
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1264
|
+
var SegmentedControlItem = ({
|
|
1265
|
+
label,
|
|
1266
|
+
value,
|
|
1267
|
+
icon,
|
|
1268
|
+
isDisabled: itemDisabled,
|
|
1269
|
+
"aria-label": ariaLabel,
|
|
1270
|
+
...rest
|
|
1271
|
+
}) => {
|
|
1272
|
+
const context = useContext7(SegmentedControlContext);
|
|
1273
|
+
const buttonRef = useRef4(null);
|
|
1274
|
+
const lastInteractionWasMouse = useRef4(false);
|
|
1275
|
+
if (context === null) {
|
|
1276
|
+
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
1277
|
+
}
|
|
1278
|
+
const {
|
|
1279
|
+
value: selectedValue,
|
|
1280
|
+
onChange,
|
|
1281
|
+
size,
|
|
1282
|
+
isDisabled: isContextDisabled,
|
|
1283
|
+
focusedValue,
|
|
1284
|
+
onFocusChange,
|
|
1285
|
+
onBlur
|
|
1286
|
+
} = context;
|
|
1287
|
+
const isSelected = value === selectedValue;
|
|
1288
|
+
const isFocused = value === focusedValue;
|
|
1289
|
+
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
1290
|
+
useEffect3(() => {
|
|
1291
|
+
if (isFocused === true && buttonRef.current !== null) {
|
|
1292
|
+
buttonRef.current.focus();
|
|
1293
|
+
}
|
|
1294
|
+
}, [isFocused]);
|
|
1295
|
+
const handleClick = () => {
|
|
1296
|
+
if (!isOptionDisabled) {
|
|
1297
|
+
onChange?.(value);
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
const handleFocus = () => {
|
|
1301
|
+
if (!lastInteractionWasMouse.current && !isOptionDisabled) {
|
|
1302
|
+
onFocusChange?.(value);
|
|
1303
|
+
}
|
|
1304
|
+
};
|
|
1305
|
+
const handleMouseDown = () => {
|
|
1306
|
+
lastInteractionWasMouse.current = true;
|
|
1307
|
+
};
|
|
1308
|
+
const handleBlur = () => {
|
|
1309
|
+
lastInteractionWasMouse.current = false;
|
|
1310
|
+
onBlur?.();
|
|
1311
|
+
};
|
|
1312
|
+
const buttonClasses = clsx21("relative flex items-center justify-center gap-1 rounded", focusVisible11.normal, {
|
|
1313
|
+
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
1314
|
+
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
1315
|
+
// States - Default with hover
|
|
1316
|
+
"bg-transparent text-text01 hover:bg-hover02": isSelected === false && isOptionDisabled === false,
|
|
1317
|
+
// States - Selected
|
|
1318
|
+
"bg-uiBackground01 text-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1319
|
+
// States - Disabled
|
|
1320
|
+
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
1321
|
+
});
|
|
1322
|
+
return /* @__PURE__ */ jsxs16(
|
|
1323
|
+
"button",
|
|
1324
|
+
{
|
|
1325
|
+
ref: buttonRef,
|
|
1326
|
+
type: "button",
|
|
1327
|
+
role: "tab",
|
|
1328
|
+
"aria-selected": isSelected,
|
|
1329
|
+
"aria-label": ariaLabel,
|
|
1330
|
+
disabled: isOptionDisabled,
|
|
1331
|
+
tabIndex: isFocused === true || isSelected === true && focusedValue === null ? 0 : -1,
|
|
1332
|
+
className: buttonClasses,
|
|
1333
|
+
onClick: handleClick,
|
|
1334
|
+
onFocus: handleFocus,
|
|
1335
|
+
onBlur: handleBlur,
|
|
1336
|
+
onMouseDown: handleMouseDown,
|
|
1337
|
+
...rest,
|
|
1338
|
+
children: [
|
|
1339
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ jsx27(
|
|
1340
|
+
"span",
|
|
1341
|
+
{
|
|
1342
|
+
className: clsx21("flex items-center", {
|
|
1343
|
+
"fill-disabled01": isOptionDisabled === true,
|
|
1344
|
+
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1345
|
+
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
1346
|
+
}),
|
|
1347
|
+
children: /* @__PURE__ */ jsx27(Icon, { name: icon, size: "small" })
|
|
1348
|
+
}
|
|
1349
|
+
),
|
|
1350
|
+
Boolean(label) === true && /* @__PURE__ */ jsx27("span", { className: "whitespace-nowrap", children: label })
|
|
1351
|
+
]
|
|
1352
|
+
}
|
|
1353
|
+
);
|
|
1354
|
+
};
|
|
1355
|
+
|
|
1356
|
+
// src/segmented-control/segmented-control.tsx
|
|
1357
|
+
import { Fragment as Fragment3, jsx as jsx28 } from "react/jsx-runtime";
|
|
1358
|
+
var SegmentedControl = ({
|
|
1359
|
+
children,
|
|
1360
|
+
value,
|
|
1361
|
+
onChange,
|
|
1362
|
+
size = "medium",
|
|
1363
|
+
isDisabled = false,
|
|
1364
|
+
"aria-label": ariaLabel,
|
|
1365
|
+
...rest
|
|
1366
|
+
}) => {
|
|
1367
|
+
const containerRef = useRef5(null);
|
|
1368
|
+
const itemIds = Children.toArray(children).filter((child) => {
|
|
1369
|
+
if (!React2.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
1370
|
+
return false;
|
|
1371
|
+
}
|
|
1372
|
+
const props = child.props;
|
|
1373
|
+
return props.isDisabled !== true;
|
|
1374
|
+
}).map((child) => child.props.value);
|
|
1375
|
+
const childrenCount = Children.count(children);
|
|
1376
|
+
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
1377
|
+
const {
|
|
1378
|
+
focusedValue,
|
|
1379
|
+
handleFocusChange,
|
|
1380
|
+
handleKeyDown,
|
|
1381
|
+
handleBlur: handleBlurRovingFocus
|
|
1382
|
+
} = useRovingFocus({
|
|
1383
|
+
values: itemIds,
|
|
1384
|
+
isDisabled
|
|
1385
|
+
});
|
|
1386
|
+
const handleFocusAndChange = (newValue) => {
|
|
1387
|
+
handleFocusChange(newValue);
|
|
1388
|
+
if (!isDisabled && typeof onChange === "function" && newValue !== value) {
|
|
1389
|
+
onChange(newValue);
|
|
1390
|
+
}
|
|
1391
|
+
};
|
|
1392
|
+
const contextValue = {
|
|
1393
|
+
value,
|
|
1394
|
+
onChange,
|
|
1395
|
+
size,
|
|
1396
|
+
isDisabled,
|
|
1397
|
+
focusedValue,
|
|
1398
|
+
onFocusChange: handleFocusAndChange,
|
|
1399
|
+
onBlur: handleBlurRovingFocus,
|
|
1400
|
+
values: itemIds
|
|
1401
|
+
};
|
|
1402
|
+
return /* @__PURE__ */ jsx28(Fragment3, { children: /* @__PURE__ */ jsx28(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx28(
|
|
1403
|
+
"div",
|
|
1404
|
+
{
|
|
1405
|
+
ref: containerRef,
|
|
1406
|
+
className: "grid gap-1 rounded-lg bg-uiBackground02 p-1",
|
|
1407
|
+
style: containerStyle,
|
|
1408
|
+
role: "tablist",
|
|
1409
|
+
"aria-label": ariaLabel,
|
|
1410
|
+
onKeyDown: handleKeyDown,
|
|
1411
|
+
...rest,
|
|
1412
|
+
children
|
|
1413
|
+
}
|
|
1414
|
+
) }) });
|
|
1415
|
+
};
|
|
1416
|
+
SegmentedControl.Item = SegmentedControlItem;
|
|
1417
|
+
|
|
1168
1418
|
// src/select-sort/select-sort.tsx
|
|
1169
|
-
import { buttonColors as
|
|
1170
|
-
import
|
|
1171
|
-
import { useCallback as
|
|
1419
|
+
import { buttonColors as buttonColors4, focusVisible as focusVisible14 } from "@zenkigen-inc/component-theme";
|
|
1420
|
+
import clsx24 from "clsx";
|
|
1421
|
+
import { useCallback as useCallback6, useRef as useRef6, useState as useState8 } from "react";
|
|
1172
1422
|
|
|
1173
1423
|
// src/select-sort/select-list.tsx
|
|
1174
|
-
import { focusVisible as
|
|
1175
|
-
import
|
|
1424
|
+
import { focusVisible as focusVisible13 } from "@zenkigen-inc/component-theme";
|
|
1425
|
+
import clsx23 from "clsx";
|
|
1176
1426
|
|
|
1177
1427
|
// src/select-sort/select-item.tsx
|
|
1178
|
-
import { focusVisible as
|
|
1179
|
-
import
|
|
1180
|
-
import { jsx as
|
|
1428
|
+
import { focusVisible as focusVisible12 } from "@zenkigen-inc/component-theme";
|
|
1429
|
+
import clsx22 from "clsx";
|
|
1430
|
+
import { jsx as jsx29, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1181
1431
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
1182
|
-
const itemClasses =
|
|
1432
|
+
const itemClasses = clsx22(
|
|
1183
1433
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1184
|
-
|
|
1434
|
+
focusVisible12.inset,
|
|
1185
1435
|
{
|
|
1186
1436
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
1187
1437
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
1188
1438
|
}
|
|
1189
1439
|
);
|
|
1190
|
-
return /* @__PURE__ */
|
|
1191
|
-
/* @__PURE__ */
|
|
1192
|
-
isSortKey && /* @__PURE__ */
|
|
1440
|
+
return /* @__PURE__ */ jsx29("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ jsxs17("button", { className: itemClasses, type: "button", children: [
|
|
1441
|
+
/* @__PURE__ */ jsx29("span", { className: "ml-1 mr-6", children }),
|
|
1442
|
+
isSortKey && /* @__PURE__ */ jsx29("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx29(Icon, { name: "check", size: "small" }) })
|
|
1193
1443
|
] }) });
|
|
1194
1444
|
}
|
|
1195
1445
|
|
|
1196
1446
|
// src/select-sort/select-list.tsx
|
|
1197
|
-
import { jsx as
|
|
1447
|
+
import { jsx as jsx30, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1198
1448
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
1199
|
-
const listClasses =
|
|
1449
|
+
const listClasses = clsx23(
|
|
1200
1450
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
1201
1451
|
{
|
|
1202
1452
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -1205,19 +1455,19 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
1205
1455
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1206
1456
|
}
|
|
1207
1457
|
);
|
|
1208
|
-
const deselectButtonClasses =
|
|
1458
|
+
const deselectButtonClasses = clsx23(
|
|
1209
1459
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1210
|
-
|
|
1460
|
+
focusVisible13.inset
|
|
1211
1461
|
);
|
|
1212
|
-
return /* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
1214
|
-
/* @__PURE__ */
|
|
1215
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */
|
|
1462
|
+
return /* @__PURE__ */ jsxs18("ul", { className: listClasses, children: [
|
|
1463
|
+
/* @__PURE__ */ jsx30(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1464
|
+
/* @__PURE__ */ jsx30(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1465
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ jsx30("li", { children: /* @__PURE__ */ jsx30("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1216
1466
|
] });
|
|
1217
1467
|
}
|
|
1218
1468
|
|
|
1219
1469
|
// src/select-sort/select-sort.tsx
|
|
1220
|
-
import { jsx as
|
|
1470
|
+
import { jsx as jsx31, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1221
1471
|
function SelectSort({
|
|
1222
1472
|
size = "medium",
|
|
1223
1473
|
variant = "outline",
|
|
@@ -1229,54 +1479,54 @@ function SelectSort({
|
|
|
1229
1479
|
onChange,
|
|
1230
1480
|
onClickDeselect
|
|
1231
1481
|
}) {
|
|
1232
|
-
const [isOptionListOpen, setIsOptionListOpen] =
|
|
1233
|
-
const targetRef =
|
|
1482
|
+
const [isOptionListOpen, setIsOptionListOpen] = useState8(false);
|
|
1483
|
+
const targetRef = useRef6(null);
|
|
1234
1484
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1235
1485
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1236
|
-
const handleClickItem =
|
|
1486
|
+
const handleClickItem = useCallback6(
|
|
1237
1487
|
(value) => {
|
|
1238
1488
|
onChange?.(value);
|
|
1239
1489
|
setIsOptionListOpen(false);
|
|
1240
1490
|
},
|
|
1241
1491
|
[onChange]
|
|
1242
1492
|
);
|
|
1243
|
-
const wrapperClasses =
|
|
1493
|
+
const wrapperClasses = clsx24("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1244
1494
|
"h-6": size === "x-small" || size === "small",
|
|
1245
1495
|
"h-8": size === "medium",
|
|
1246
1496
|
"h-10": size === "large",
|
|
1247
1497
|
"cursor-not-allowed": isDisabled
|
|
1248
1498
|
});
|
|
1249
|
-
const buttonClasses =
|
|
1499
|
+
const buttonClasses = clsx24(
|
|
1250
1500
|
"flex size-full items-center rounded",
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1501
|
+
buttonColors4[variant].hover,
|
|
1502
|
+
buttonColors4[variant].active,
|
|
1503
|
+
buttonColors4[variant].disabled,
|
|
1504
|
+
focusVisible14.normal,
|
|
1255
1505
|
{
|
|
1256
|
-
[
|
|
1257
|
-
[
|
|
1506
|
+
[buttonColors4[variant].selected]: isSortKey,
|
|
1507
|
+
[buttonColors4[variant].base]: !isSortKey,
|
|
1258
1508
|
"px-2": size === "x-small" || size === "small",
|
|
1259
1509
|
"px-4": size === "medium" || size === "large",
|
|
1260
1510
|
"pointer-events-none": isDisabled
|
|
1261
1511
|
}
|
|
1262
1512
|
);
|
|
1263
|
-
const labelClasses =
|
|
1513
|
+
const labelClasses = clsx24("truncate", {
|
|
1264
1514
|
"typography-label12regular": size === "x-small",
|
|
1265
1515
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1266
1516
|
"typography-label16regular": size === "large",
|
|
1267
1517
|
"mr-1": size === "x-small",
|
|
1268
1518
|
"mr-2": size !== "x-small"
|
|
1269
1519
|
});
|
|
1270
|
-
return /* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1273
|
-
/* @__PURE__ */
|
|
1520
|
+
return /* @__PURE__ */ jsxs19("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
1521
|
+
/* @__PURE__ */ jsxs19("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
1522
|
+
/* @__PURE__ */ jsx31("div", { className: labelClasses, children: label }),
|
|
1523
|
+
/* @__PURE__ */ jsx31("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ jsx31(
|
|
1274
1524
|
Icon,
|
|
1275
1525
|
{
|
|
1276
1526
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
1277
1527
|
size: size === "large" ? "medium" : "small"
|
|
1278
1528
|
}
|
|
1279
|
-
) : /* @__PURE__ */
|
|
1529
|
+
) : /* @__PURE__ */ jsx31(
|
|
1280
1530
|
Icon,
|
|
1281
1531
|
{
|
|
1282
1532
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1284,7 +1534,7 @@ function SelectSort({
|
|
|
1284
1534
|
}
|
|
1285
1535
|
) })
|
|
1286
1536
|
] }),
|
|
1287
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */
|
|
1537
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ jsx31(
|
|
1288
1538
|
SelectList2,
|
|
1289
1539
|
{
|
|
1290
1540
|
size,
|
|
@@ -1297,12 +1547,87 @@ function SelectSort({
|
|
|
1297
1547
|
] });
|
|
1298
1548
|
}
|
|
1299
1549
|
|
|
1550
|
+
// src/sort-button/sort-button.tsx
|
|
1551
|
+
import { buttonColors as buttonColors5, focusVisible as focusVisible15 } from "@zenkigen-inc/component-theme";
|
|
1552
|
+
import clsx25 from "clsx";
|
|
1553
|
+
import { useCallback as useCallback7 } from "react";
|
|
1554
|
+
import { jsx as jsx32, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
1555
|
+
function SortButton({
|
|
1556
|
+
size = "medium",
|
|
1557
|
+
width,
|
|
1558
|
+
label,
|
|
1559
|
+
sortOrder,
|
|
1560
|
+
isDisabled = false,
|
|
1561
|
+
onClick,
|
|
1562
|
+
"aria-label": ariaLabel,
|
|
1563
|
+
...rest
|
|
1564
|
+
}) {
|
|
1565
|
+
const handleClick = useCallback7(() => {
|
|
1566
|
+
if (isDisabled || !onClick) return;
|
|
1567
|
+
onClick();
|
|
1568
|
+
}, [isDisabled, onClick]);
|
|
1569
|
+
const getIconName = () => {
|
|
1570
|
+
if (sortOrder === "ascend") return "arrow-up";
|
|
1571
|
+
if (sortOrder === "descend") return "arrow-down";
|
|
1572
|
+
return "angle-small-down";
|
|
1573
|
+
};
|
|
1574
|
+
const wrapperClasses = clsx25("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1575
|
+
"h-6": size === "x-small" || size === "small",
|
|
1576
|
+
"h-8": size === "medium",
|
|
1577
|
+
"h-10": size === "large",
|
|
1578
|
+
"cursor-not-allowed": isDisabled
|
|
1579
|
+
});
|
|
1580
|
+
const buttonClasses = clsx25(
|
|
1581
|
+
"flex size-full items-center rounded",
|
|
1582
|
+
buttonColors5.text.hover,
|
|
1583
|
+
buttonColors5.text.active,
|
|
1584
|
+
buttonColors5.text.disabled,
|
|
1585
|
+
focusVisible15.normal,
|
|
1586
|
+
{
|
|
1587
|
+
[buttonColors5.text.selected]: !isDisabled && sortOrder !== null,
|
|
1588
|
+
// ソート状態時は選択状態のスタイル
|
|
1589
|
+
[buttonColors5.text.base]: sortOrder === null,
|
|
1590
|
+
// ソートなし時は通常のスタイル
|
|
1591
|
+
"px-2": size === "x-small" || size === "small",
|
|
1592
|
+
"px-4": size === "medium" || size === "large",
|
|
1593
|
+
"pointer-events-none": isDisabled
|
|
1594
|
+
}
|
|
1595
|
+
);
|
|
1596
|
+
const labelClasses = clsx25("truncate", {
|
|
1597
|
+
"typography-label12regular": size === "x-small",
|
|
1598
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
1599
|
+
"typography-label16regular": size === "large",
|
|
1600
|
+
"mr-1": size === "x-small",
|
|
1601
|
+
"mr-2": size !== "x-small"
|
|
1602
|
+
});
|
|
1603
|
+
return /* @__PURE__ */ jsx32("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ jsxs20(
|
|
1604
|
+
"button",
|
|
1605
|
+
{
|
|
1606
|
+
className: buttonClasses,
|
|
1607
|
+
...rest,
|
|
1608
|
+
type: "button",
|
|
1609
|
+
onClick: handleClick,
|
|
1610
|
+
disabled: isDisabled,
|
|
1611
|
+
"aria-label": ariaLabel,
|
|
1612
|
+
"aria-disabled": isDisabled,
|
|
1613
|
+
children: [
|
|
1614
|
+
/* @__PURE__ */ jsx32("div", { className: labelClasses, children: label }),
|
|
1615
|
+
/* @__PURE__ */ jsx32("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ jsx32(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
1616
|
+
]
|
|
1617
|
+
}
|
|
1618
|
+
) });
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
// src/tab/tab.tsx
|
|
1622
|
+
import { clsx as clsx27 } from "clsx";
|
|
1623
|
+
import { Children as Children2 } from "react";
|
|
1624
|
+
|
|
1300
1625
|
// src/tab/tab-item.tsx
|
|
1301
|
-
import { clsx as
|
|
1302
|
-
import { jsx as
|
|
1626
|
+
import { clsx as clsx26 } from "clsx";
|
|
1627
|
+
import { jsx as jsx33 } from "react/jsx-runtime";
|
|
1303
1628
|
var TabItem = ({ isSelected = false, ...props }) => {
|
|
1304
|
-
const classes =
|
|
1305
|
-
"relative z-0 flex py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-px hover:text-text01 disabled:pointer-events-none disabled:text-disabled01",
|
|
1629
|
+
const classes = clsx26(
|
|
1630
|
+
"relative z-0 flex justify-center py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-px hover:text-text01 disabled:pointer-events-none disabled:text-disabled01",
|
|
1306
1631
|
{
|
|
1307
1632
|
"typography-label14regular": !isSelected,
|
|
1308
1633
|
"text-interactive02 hover:before:bg-uiBorder04": !isSelected,
|
|
@@ -1310,7 +1635,7 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1310
1635
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
1311
1636
|
}
|
|
1312
1637
|
);
|
|
1313
|
-
return /* @__PURE__ */
|
|
1638
|
+
return /* @__PURE__ */ jsx33(
|
|
1314
1639
|
"button",
|
|
1315
1640
|
{
|
|
1316
1641
|
type: "button",
|
|
@@ -1325,37 +1650,39 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1325
1650
|
};
|
|
1326
1651
|
|
|
1327
1652
|
// src/tab/tab.tsx
|
|
1328
|
-
import { jsx as
|
|
1329
|
-
function Tab({ children }) {
|
|
1330
|
-
|
|
1331
|
-
|
|
1653
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
1654
|
+
function Tab({ children, layout = "auto" }) {
|
|
1655
|
+
const childrenCount = Children2.count(children);
|
|
1656
|
+
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
1657
|
+
const containerClasses = clsx27(
|
|
1658
|
+
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
1332
1659
|
{
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
children
|
|
1660
|
+
flex: layout === "auto",
|
|
1661
|
+
grid: layout === "equal"
|
|
1336
1662
|
}
|
|
1337
1663
|
);
|
|
1664
|
+
return /* @__PURE__ */ jsx34("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
1338
1665
|
}
|
|
1339
1666
|
Tab.Item = TabItem;
|
|
1340
1667
|
|
|
1341
1668
|
// src/table/table-cell.tsx
|
|
1342
|
-
import
|
|
1343
|
-
import { jsx as
|
|
1669
|
+
import clsx28 from "clsx";
|
|
1670
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
1344
1671
|
function TableCell({ children, className, isHeader = false }) {
|
|
1345
|
-
const classes =
|
|
1346
|
-
return /* @__PURE__ */
|
|
1672
|
+
const classes = clsx28("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
1673
|
+
return /* @__PURE__ */ jsx35("div", { className: classes, children });
|
|
1347
1674
|
}
|
|
1348
1675
|
|
|
1349
1676
|
// src/table/table-row.tsx
|
|
1350
|
-
import
|
|
1351
|
-
import { jsx as
|
|
1677
|
+
import clsx29 from "clsx";
|
|
1678
|
+
import { jsx as jsx36 } from "react/jsx-runtime";
|
|
1352
1679
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
1353
|
-
const rowClasses =
|
|
1354
|
-
return /* @__PURE__ */
|
|
1680
|
+
const rowClasses = clsx29("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
1681
|
+
return /* @__PURE__ */ jsx36("div", { className: rowClasses, children });
|
|
1355
1682
|
}
|
|
1356
1683
|
|
|
1357
1684
|
// src/table/table.tsx
|
|
1358
|
-
import { jsx as
|
|
1685
|
+
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
1359
1686
|
function Table({
|
|
1360
1687
|
width,
|
|
1361
1688
|
templateRows,
|
|
@@ -1364,7 +1691,7 @@ function Table({
|
|
|
1364
1691
|
autoRows,
|
|
1365
1692
|
children
|
|
1366
1693
|
}) {
|
|
1367
|
-
return /* @__PURE__ */
|
|
1694
|
+
return /* @__PURE__ */ jsx37(
|
|
1368
1695
|
"div",
|
|
1369
1696
|
{
|
|
1370
1697
|
className: "grid",
|
|
@@ -1384,22 +1711,22 @@ Table.Cell = TableCell;
|
|
|
1384
1711
|
|
|
1385
1712
|
// src/tag/tag.tsx
|
|
1386
1713
|
import { tagColors, tagLightColors } from "@zenkigen-inc/component-theme";
|
|
1387
|
-
import
|
|
1714
|
+
import clsx31 from "clsx";
|
|
1388
1715
|
|
|
1389
1716
|
// src/tag/delete-icon.tsx
|
|
1390
|
-
import { focusVisible as
|
|
1391
|
-
import
|
|
1392
|
-
import { jsx as
|
|
1717
|
+
import { focusVisible as focusVisible16 } from "@zenkigen-inc/component-theme";
|
|
1718
|
+
import clsx30 from "clsx";
|
|
1719
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
1393
1720
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
1394
|
-
const deleteButtonClasses =
|
|
1721
|
+
const deleteButtonClasses = clsx30(
|
|
1395
1722
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
1396
|
-
|
|
1723
|
+
focusVisible16.normal
|
|
1397
1724
|
);
|
|
1398
|
-
const deletePathClasses =
|
|
1725
|
+
const deletePathClasses = clsx30({
|
|
1399
1726
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
1400
1727
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
1401
1728
|
});
|
|
1402
|
-
return /* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ jsx38("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ jsx38("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx38(
|
|
1403
1730
|
"path",
|
|
1404
1731
|
{
|
|
1405
1732
|
fillRule: "evenodd",
|
|
@@ -1411,9 +1738,9 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
1411
1738
|
};
|
|
1412
1739
|
|
|
1413
1740
|
// src/tag/tag.tsx
|
|
1414
|
-
import { jsx as
|
|
1741
|
+
import { jsx as jsx39, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
1415
1742
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
1416
|
-
const wrapperClasses =
|
|
1743
|
+
const wrapperClasses = clsx31("flex", "items-center", "justify-center", {
|
|
1417
1744
|
[tagColors[color]]: variant === "normal",
|
|
1418
1745
|
[tagLightColors[color]]: variant === "light",
|
|
1419
1746
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
@@ -1425,16 +1752,16 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
1425
1752
|
"py-0.5 px-1": !isEditable,
|
|
1426
1753
|
"py-1 px-2": isEditable
|
|
1427
1754
|
});
|
|
1428
|
-
return /* @__PURE__ */
|
|
1755
|
+
return /* @__PURE__ */ jsxs21("div", { className: wrapperClasses, children: [
|
|
1429
1756
|
children,
|
|
1430
|
-
isEditable ? /* @__PURE__ */
|
|
1757
|
+
isEditable ? /* @__PURE__ */ jsx39(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
1431
1758
|
] });
|
|
1432
1759
|
}
|
|
1433
1760
|
|
|
1434
1761
|
// src/text-area/text-area.tsx
|
|
1435
|
-
import { clsx as
|
|
1762
|
+
import { clsx as clsx32 } from "clsx";
|
|
1436
1763
|
import { forwardRef as forwardRef2 } from "react";
|
|
1437
|
-
import { jsx as
|
|
1764
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
1438
1765
|
var TextArea = forwardRef2(
|
|
1439
1766
|
({
|
|
1440
1767
|
size = "medium",
|
|
@@ -1446,7 +1773,7 @@ var TextArea = forwardRef2(
|
|
|
1446
1773
|
height,
|
|
1447
1774
|
...props
|
|
1448
1775
|
}, ref) => {
|
|
1449
|
-
const classes =
|
|
1776
|
+
const classes = clsx32(
|
|
1450
1777
|
"w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
1451
1778
|
{
|
|
1452
1779
|
"border-supportError": isError && !disabled,
|
|
@@ -1460,7 +1787,7 @@ var TextArea = forwardRef2(
|
|
|
1460
1787
|
"resize-none": !isResizable
|
|
1461
1788
|
}
|
|
1462
1789
|
);
|
|
1463
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ jsx40("div", { className: "flex", children: /* @__PURE__ */ jsx40(
|
|
1464
1791
|
"textarea",
|
|
1465
1792
|
{
|
|
1466
1793
|
ref,
|
|
@@ -1481,13 +1808,13 @@ var TextArea = forwardRef2(
|
|
|
1481
1808
|
TextArea.displayName = "TextArea";
|
|
1482
1809
|
|
|
1483
1810
|
// src/text-input/text-input.tsx
|
|
1484
|
-
import { clsx as
|
|
1811
|
+
import { clsx as clsx33 } from "clsx";
|
|
1485
1812
|
import { forwardRef as forwardRef3 } from "react";
|
|
1486
|
-
import { jsx as
|
|
1813
|
+
import { jsx as jsx41, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
1487
1814
|
var TextInput = forwardRef3(
|
|
1488
1815
|
({ size = "medium", isError = false, disabled = false, onClickClearButton, ...props }, ref) => {
|
|
1489
1816
|
const isShowClearButton = !!onClickClearButton && props.value.length !== 0 && !disabled;
|
|
1490
|
-
const inputWrapClasses =
|
|
1817
|
+
const inputWrapClasses = clsx33("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1491
1818
|
"border-uiBorder02": !isError && !disabled,
|
|
1492
1819
|
"border-supportError": isError && !disabled,
|
|
1493
1820
|
"hover:border-hoverInput": !disabled && !isError,
|
|
@@ -1497,25 +1824,25 @@ var TextInput = forwardRef3(
|
|
|
1497
1824
|
"pr-2": size === "medium" && isShowClearButton,
|
|
1498
1825
|
"pr-3": size === "large" && isShowClearButton
|
|
1499
1826
|
});
|
|
1500
|
-
const inputClasses =
|
|
1827
|
+
const inputClasses = clsx33("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1501
1828
|
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1502
1829
|
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1503
1830
|
"text-text01": !isError,
|
|
1504
1831
|
"text-supportError": isError,
|
|
1505
1832
|
"pr-0": isShowClearButton
|
|
1506
1833
|
});
|
|
1507
|
-
return /* @__PURE__ */
|
|
1508
|
-
/* @__PURE__ */
|
|
1509
|
-
isShowClearButton && /* @__PURE__ */
|
|
1834
|
+
return /* @__PURE__ */ jsxs22("div", { className: inputWrapClasses, children: [
|
|
1835
|
+
/* @__PURE__ */ jsx41("input", { ref, size: 1, className: inputClasses, disabled, onChange: props.onChange, ...props }),
|
|
1836
|
+
isShowClearButton && /* @__PURE__ */ jsx41(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1510
1837
|
] });
|
|
1511
1838
|
}
|
|
1512
1839
|
);
|
|
1513
1840
|
TextInput.displayName = "TextInput";
|
|
1514
1841
|
|
|
1515
1842
|
// src/toast/toast.tsx
|
|
1516
|
-
import
|
|
1517
|
-
import { useCallback as
|
|
1518
|
-
import { jsx as
|
|
1843
|
+
import clsx34 from "clsx";
|
|
1844
|
+
import { useCallback as useCallback8, useEffect as useEffect4, useState as useState9 } from "react";
|
|
1845
|
+
import { jsx as jsx42, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1519
1846
|
var CLOSE_TIME_MSEC = 5e3;
|
|
1520
1847
|
function Toast({
|
|
1521
1848
|
state = "information",
|
|
@@ -1525,8 +1852,8 @@ function Toast({
|
|
|
1525
1852
|
children,
|
|
1526
1853
|
onClickClose
|
|
1527
1854
|
}) {
|
|
1528
|
-
const [isRemoving, setIsRemoving] =
|
|
1529
|
-
const handleClose =
|
|
1855
|
+
const [isRemoving, setIsRemoving] = useState9(false);
|
|
1856
|
+
const handleClose = useCallback8(() => {
|
|
1530
1857
|
if (isAnimation) {
|
|
1531
1858
|
setIsRemoving(true);
|
|
1532
1859
|
} else {
|
|
@@ -1534,17 +1861,17 @@ function Toast({
|
|
|
1534
1861
|
}
|
|
1535
1862
|
}, [isAnimation, onClickClose]);
|
|
1536
1863
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
1537
|
-
const wrapperClasses =
|
|
1864
|
+
const wrapperClasses = clsx34("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
1538
1865
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
1539
1866
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
1540
1867
|
});
|
|
1541
|
-
const iconClasses =
|
|
1868
|
+
const iconClasses = clsx34("flex items-center", {
|
|
1542
1869
|
"fill-supportSuccess": state === "success",
|
|
1543
1870
|
"fill-supportError": state === "error",
|
|
1544
1871
|
"fill-supportWarning": state === "warning",
|
|
1545
1872
|
"fill-supportInfo": state === "information"
|
|
1546
1873
|
});
|
|
1547
|
-
const textClasses =
|
|
1874
|
+
const textClasses = clsx34("typography-body13regular flex-1 pt-[3px]", {
|
|
1548
1875
|
"text-supportError": state === "error",
|
|
1549
1876
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
1550
1877
|
});
|
|
@@ -1554,7 +1881,7 @@ function Toast({
|
|
|
1554
1881
|
warning: "warning",
|
|
1555
1882
|
information: "information-filled"
|
|
1556
1883
|
};
|
|
1557
|
-
|
|
1884
|
+
useEffect4(() => {
|
|
1558
1885
|
const timer = window.setTimeout(() => {
|
|
1559
1886
|
if (isAutoClose) {
|
|
1560
1887
|
setIsRemoving(true);
|
|
@@ -1562,45 +1889,45 @@ function Toast({
|
|
|
1562
1889
|
}, CLOSE_TIME_MSEC);
|
|
1563
1890
|
return () => window.clearTimeout(timer);
|
|
1564
1891
|
}, [isAutoClose]);
|
|
1565
|
-
return /* @__PURE__ */
|
|
1566
|
-
/* @__PURE__ */
|
|
1567
|
-
/* @__PURE__ */
|
|
1568
|
-
/* @__PURE__ */
|
|
1892
|
+
return /* @__PURE__ */ jsxs23("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
1893
|
+
/* @__PURE__ */ jsx42("div", { className: iconClasses, children: /* @__PURE__ */ jsx42(Icon, { name: iconName[state] }) }),
|
|
1894
|
+
/* @__PURE__ */ jsx42("p", { className: textClasses, children }),
|
|
1895
|
+
/* @__PURE__ */ jsx42(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
1569
1896
|
] });
|
|
1570
1897
|
}
|
|
1571
1898
|
|
|
1572
1899
|
// src/toast/toast-provider.tsx
|
|
1573
|
-
import { createContext as
|
|
1900
|
+
import { createContext as createContext6, useCallback as useCallback9, useContext as useContext8, useEffect as useEffect5, useState as useState10 } from "react";
|
|
1574
1901
|
import { createPortal as createPortal3 } from "react-dom";
|
|
1575
|
-
import { jsx as
|
|
1576
|
-
var ToastContext =
|
|
1902
|
+
import { jsx as jsx43, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
1903
|
+
var ToastContext = createContext6({});
|
|
1577
1904
|
var ToastProvider = ({ children }) => {
|
|
1578
|
-
const [isClientRender, setIsClientRender] =
|
|
1579
|
-
const [toasts, setToasts] =
|
|
1580
|
-
const addToast =
|
|
1905
|
+
const [isClientRender, setIsClientRender] = useState10(false);
|
|
1906
|
+
const [toasts, setToasts] = useState10([]);
|
|
1907
|
+
const addToast = useCallback9(({ message, state }) => {
|
|
1581
1908
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
1582
1909
|
}, []);
|
|
1583
|
-
const removeToast =
|
|
1910
|
+
const removeToast = useCallback9((id) => {
|
|
1584
1911
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
1585
1912
|
}, []);
|
|
1586
|
-
|
|
1913
|
+
useEffect5(() => {
|
|
1587
1914
|
setIsClientRender(true);
|
|
1588
1915
|
}, []);
|
|
1589
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsxs24(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
1590
1917
|
children,
|
|
1591
1918
|
isClientRender && createPortal3(
|
|
1592
|
-
/* @__PURE__ */
|
|
1919
|
+
/* @__PURE__ */ jsx43("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__ */ jsx43(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
1593
1920
|
document.body
|
|
1594
1921
|
)
|
|
1595
1922
|
] });
|
|
1596
1923
|
};
|
|
1597
1924
|
var useToast = () => {
|
|
1598
|
-
return
|
|
1925
|
+
return useContext8(ToastContext);
|
|
1599
1926
|
};
|
|
1600
1927
|
|
|
1601
1928
|
// src/toggle/toggle.tsx
|
|
1602
|
-
import
|
|
1603
|
-
import { jsx as
|
|
1929
|
+
import clsx35 from "clsx";
|
|
1930
|
+
import { jsx as jsx44, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
1604
1931
|
function Toggle({
|
|
1605
1932
|
id,
|
|
1606
1933
|
size = "medium",
|
|
@@ -1610,7 +1937,7 @@ function Toggle({
|
|
|
1610
1937
|
labelPosition = "right",
|
|
1611
1938
|
isDisabled = false
|
|
1612
1939
|
}) {
|
|
1613
|
-
const baseClasses =
|
|
1940
|
+
const baseClasses = clsx35("relative flex items-center rounded-full", {
|
|
1614
1941
|
"bg-disabledOn": isDisabled && isChecked,
|
|
1615
1942
|
"bg-disabled01": isDisabled && !isChecked,
|
|
1616
1943
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -1618,16 +1945,16 @@ function Toggle({
|
|
|
1618
1945
|
"w-8 h-4 px-[3px]": size === "small",
|
|
1619
1946
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
1620
1947
|
});
|
|
1621
|
-
const inputClasses =
|
|
1948
|
+
const inputClasses = clsx35(
|
|
1622
1949
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
1623
1950
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1624
1951
|
);
|
|
1625
|
-
const indicatorClasses =
|
|
1952
|
+
const indicatorClasses = clsx35("rounded-full bg-iconOnColor", {
|
|
1626
1953
|
"w-2.5 h-2.5": size === "small",
|
|
1627
1954
|
"w-4 h-4": size === "medium" || size === "large",
|
|
1628
1955
|
"ml-auto": isChecked
|
|
1629
1956
|
});
|
|
1630
|
-
const labelClasses =
|
|
1957
|
+
const labelClasses = clsx35("break-all", {
|
|
1631
1958
|
"mr-2": labelPosition === "left",
|
|
1632
1959
|
"ml-2": labelPosition === "right",
|
|
1633
1960
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -1635,9 +1962,9 @@ function Toggle({
|
|
|
1635
1962
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1636
1963
|
"cursor-pointer text-text01": !isDisabled
|
|
1637
1964
|
});
|
|
1638
|
-
return /* @__PURE__ */
|
|
1639
|
-
label != null && labelPosition === "left" && /* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1965
|
+
return /* @__PURE__ */ jsxs25("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
1966
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ jsx44("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
1967
|
+
/* @__PURE__ */ jsx44(
|
|
1641
1968
|
"input",
|
|
1642
1969
|
{
|
|
1643
1970
|
className: inputClasses,
|
|
@@ -1649,77 +1976,23 @@ function Toggle({
|
|
|
1649
1976
|
disabled: isDisabled
|
|
1650
1977
|
}
|
|
1651
1978
|
),
|
|
1652
|
-
/* @__PURE__ */
|
|
1653
|
-
label != null && labelPosition === "right" && /* @__PURE__ */
|
|
1979
|
+
/* @__PURE__ */ jsx44("div", { className: baseClasses, children: /* @__PURE__ */ jsx44("span", { className: indicatorClasses }) }),
|
|
1980
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ jsx44("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1654
1981
|
] });
|
|
1655
1982
|
}
|
|
1656
1983
|
|
|
1657
1984
|
// src/tooltip/tooltip.tsx
|
|
1658
|
-
import { useCallback as
|
|
1985
|
+
import { useCallback as useCallback11, useEffect as useEffect6, useRef as useRef7, useState as useState11 } from "react";
|
|
1659
1986
|
import { createPortal as createPortal4 } from "react-dom";
|
|
1660
1987
|
|
|
1661
|
-
// src/tooltip/tooltip.hook.ts
|
|
1662
|
-
import { useCallback as useCallback8 } from "react";
|
|
1663
|
-
var useTooltip = () => {
|
|
1664
|
-
const calculatePosition = useCallback8(
|
|
1665
|
-
(args) => {
|
|
1666
|
-
const result = {
|
|
1667
|
-
maxWidth: "none",
|
|
1668
|
-
width: "auto",
|
|
1669
|
-
left: "0px",
|
|
1670
|
-
top: "0px",
|
|
1671
|
-
bottom: "0px",
|
|
1672
|
-
translateX: "0",
|
|
1673
|
-
translateY: "0"
|
|
1674
|
-
};
|
|
1675
|
-
result.maxWidth = args.maxWidth ?? "none";
|
|
1676
|
-
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
1677
|
-
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
1678
|
-
const targetLeft = args.dimensions.left;
|
|
1679
|
-
const targetRight = args.dimensions.right;
|
|
1680
|
-
const targetWidth = args.dimensions.width;
|
|
1681
|
-
switch (args.horizontalAlign) {
|
|
1682
|
-
case "center":
|
|
1683
|
-
result.left = `${targetHorizontalCenter}px`;
|
|
1684
|
-
result.translateX = "-50%";
|
|
1685
|
-
break;
|
|
1686
|
-
case "left":
|
|
1687
|
-
result.left = `${targetLeft - offsetH}px`;
|
|
1688
|
-
result.translateX = `${targetWidth / 2}px`;
|
|
1689
|
-
break;
|
|
1690
|
-
case "right":
|
|
1691
|
-
result.left = `${targetRight + offsetH}px`;
|
|
1692
|
-
result.translateX = `-${targetWidth / 2}px`;
|
|
1693
|
-
break;
|
|
1694
|
-
}
|
|
1695
|
-
switch (args.verticalPosition) {
|
|
1696
|
-
case "bottom":
|
|
1697
|
-
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
1698
|
-
result.bottom = "unset";
|
|
1699
|
-
break;
|
|
1700
|
-
case "top":
|
|
1701
|
-
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
1702
|
-
result.bottom = "unset";
|
|
1703
|
-
result.translateY = "-100%";
|
|
1704
|
-
break;
|
|
1705
|
-
}
|
|
1706
|
-
return result;
|
|
1707
|
-
},
|
|
1708
|
-
[]
|
|
1709
|
-
);
|
|
1710
|
-
return {
|
|
1711
|
-
calculatePosition
|
|
1712
|
-
};
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
1988
|
// src/tooltip/tooltip-content.tsx
|
|
1716
|
-
import
|
|
1989
|
+
import clsx37 from "clsx";
|
|
1717
1990
|
|
|
1718
1991
|
// src/tooltip/tail-icon.tsx
|
|
1719
|
-
import
|
|
1720
|
-
import { jsx as
|
|
1992
|
+
import clsx36 from "clsx";
|
|
1993
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
1721
1994
|
var TailIcon = (props) => {
|
|
1722
|
-
const tailClasses =
|
|
1995
|
+
const tailClasses = clsx36("absolute fill-uiBackgroundTooltip", {
|
|
1723
1996
|
"rotate-180": props.verticalPosition === "bottom",
|
|
1724
1997
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
1725
1998
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -1734,9 +2007,9 @@ var TailIcon = (props) => {
|
|
|
1734
2007
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
1735
2008
|
});
|
|
1736
2009
|
if (props.size === "small") {
|
|
1737
|
-
return /* @__PURE__ */
|
|
2010
|
+
return /* @__PURE__ */ jsx45("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsx45("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
1738
2011
|
} else {
|
|
1739
|
-
return /* @__PURE__ */
|
|
2012
|
+
return /* @__PURE__ */ jsx45(
|
|
1740
2013
|
"svg",
|
|
1741
2014
|
{
|
|
1742
2015
|
className: tailClasses,
|
|
@@ -1745,14 +2018,14 @@ var TailIcon = (props) => {
|
|
|
1745
2018
|
viewBox: "0 0 14 8",
|
|
1746
2019
|
fill: "none",
|
|
1747
2020
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1748
|
-
children: /* @__PURE__ */
|
|
2021
|
+
children: /* @__PURE__ */ jsx45("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
1749
2022
|
}
|
|
1750
2023
|
);
|
|
1751
2024
|
}
|
|
1752
2025
|
};
|
|
1753
2026
|
|
|
1754
2027
|
// src/tooltip/tooltip-content.tsx
|
|
1755
|
-
import { jsx as
|
|
2028
|
+
import { jsx as jsx46, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
1756
2029
|
var TooltipContent = ({
|
|
1757
2030
|
content,
|
|
1758
2031
|
horizontalAlign,
|
|
@@ -1762,7 +2035,7 @@ var TooltipContent = ({
|
|
|
1762
2035
|
maxWidth,
|
|
1763
2036
|
isPortal = false
|
|
1764
2037
|
}) => {
|
|
1765
|
-
const tooltipWrapperClasses =
|
|
2038
|
+
const tooltipWrapperClasses = clsx37("absolute z-tooltip m-auto flex", {
|
|
1766
2039
|
"top-0": !isPortal && verticalPosition === "top",
|
|
1767
2040
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
1768
2041
|
"justify-start": horizontalAlign === "left",
|
|
@@ -1771,7 +2044,7 @@ var TooltipContent = ({
|
|
|
1771
2044
|
"w-[24px]": size === "small",
|
|
1772
2045
|
"w-[46px]": size !== "small"
|
|
1773
2046
|
});
|
|
1774
|
-
const tooltipBodyClasses =
|
|
2047
|
+
const tooltipBodyClasses = clsx37(
|
|
1775
2048
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
1776
2049
|
{
|
|
1777
2050
|
"typography-body12regular": size === "small",
|
|
@@ -1788,7 +2061,7 @@ var TooltipContent = ({
|
|
|
1788
2061
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
1789
2062
|
...tooltipPosition
|
|
1790
2063
|
} : {};
|
|
1791
|
-
return /* @__PURE__ */
|
|
2064
|
+
return /* @__PURE__ */ jsx46("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ jsxs26(
|
|
1792
2065
|
"div",
|
|
1793
2066
|
{
|
|
1794
2067
|
className: tooltipBodyClasses,
|
|
@@ -1797,14 +2070,68 @@ var TooltipContent = ({
|
|
|
1797
2070
|
},
|
|
1798
2071
|
children: [
|
|
1799
2072
|
content,
|
|
1800
|
-
/* @__PURE__ */
|
|
2073
|
+
/* @__PURE__ */ jsx46(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
1801
2074
|
]
|
|
1802
2075
|
}
|
|
1803
2076
|
) });
|
|
1804
2077
|
};
|
|
1805
2078
|
|
|
2079
|
+
// src/tooltip/tooltip-hook.ts
|
|
2080
|
+
import { useCallback as useCallback10 } from "react";
|
|
2081
|
+
var useTooltip = () => {
|
|
2082
|
+
const calculatePosition = useCallback10(
|
|
2083
|
+
(args) => {
|
|
2084
|
+
const result = {
|
|
2085
|
+
maxWidth: "none",
|
|
2086
|
+
width: "auto",
|
|
2087
|
+
left: "0px",
|
|
2088
|
+
top: "0px",
|
|
2089
|
+
bottom: "0px",
|
|
2090
|
+
translateX: "0",
|
|
2091
|
+
translateY: "0"
|
|
2092
|
+
};
|
|
2093
|
+
result.maxWidth = args.maxWidth ?? "none";
|
|
2094
|
+
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
2095
|
+
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
2096
|
+
const targetLeft = args.dimensions.left;
|
|
2097
|
+
const targetRight = args.dimensions.right;
|
|
2098
|
+
const targetWidth = args.dimensions.width;
|
|
2099
|
+
switch (args.horizontalAlign) {
|
|
2100
|
+
case "center":
|
|
2101
|
+
result.left = `${targetHorizontalCenter}px`;
|
|
2102
|
+
result.translateX = "-50%";
|
|
2103
|
+
break;
|
|
2104
|
+
case "left":
|
|
2105
|
+
result.left = `${targetLeft - offsetH}px`;
|
|
2106
|
+
result.translateX = `${targetWidth / 2}px`;
|
|
2107
|
+
break;
|
|
2108
|
+
case "right":
|
|
2109
|
+
result.left = `${targetRight + offsetH}px`;
|
|
2110
|
+
result.translateX = `-${targetWidth / 2}px`;
|
|
2111
|
+
break;
|
|
2112
|
+
}
|
|
2113
|
+
switch (args.verticalPosition) {
|
|
2114
|
+
case "bottom":
|
|
2115
|
+
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
2116
|
+
result.bottom = "unset";
|
|
2117
|
+
break;
|
|
2118
|
+
case "top":
|
|
2119
|
+
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
2120
|
+
result.bottom = "unset";
|
|
2121
|
+
result.translateY = "-100%";
|
|
2122
|
+
break;
|
|
2123
|
+
}
|
|
2124
|
+
return result;
|
|
2125
|
+
},
|
|
2126
|
+
[]
|
|
2127
|
+
);
|
|
2128
|
+
return {
|
|
2129
|
+
calculatePosition
|
|
2130
|
+
};
|
|
2131
|
+
};
|
|
2132
|
+
|
|
1806
2133
|
// src/tooltip/tooltip.tsx
|
|
1807
|
-
import { jsx as
|
|
2134
|
+
import { jsx as jsx47, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
1808
2135
|
function Tooltip({
|
|
1809
2136
|
children,
|
|
1810
2137
|
content,
|
|
@@ -1816,8 +2143,8 @@ function Tooltip({
|
|
|
1816
2143
|
portalTarget
|
|
1817
2144
|
}) {
|
|
1818
2145
|
const { calculatePosition } = useTooltip();
|
|
1819
|
-
const [isVisible, setIsVisible] =
|
|
1820
|
-
const [tooltipPosition, setTooltipPosition] =
|
|
2146
|
+
const [isVisible, setIsVisible] = useState11(false);
|
|
2147
|
+
const [tooltipPosition, setTooltipPosition] = useState11({
|
|
1821
2148
|
maxWidth: "none",
|
|
1822
2149
|
width: "auto",
|
|
1823
2150
|
left: "0px",
|
|
@@ -1826,23 +2153,23 @@ function Tooltip({
|
|
|
1826
2153
|
translateX: "0",
|
|
1827
2154
|
translateY: "0"
|
|
1828
2155
|
});
|
|
1829
|
-
const targetRef =
|
|
1830
|
-
const handleMouseOverWrapper =
|
|
2156
|
+
const targetRef = useRef7(null);
|
|
2157
|
+
const handleMouseOverWrapper = useCallback11(() => {
|
|
1831
2158
|
if (isDisabledHover) {
|
|
1832
2159
|
return;
|
|
1833
2160
|
}
|
|
1834
2161
|
setIsVisible(true);
|
|
1835
2162
|
}, [isDisabledHover]);
|
|
1836
|
-
const handleMouseOutWrapper =
|
|
2163
|
+
const handleMouseOutWrapper = useCallback11(() => {
|
|
1837
2164
|
setIsVisible(false);
|
|
1838
2165
|
}, []);
|
|
1839
|
-
|
|
2166
|
+
useEffect6(() => {
|
|
1840
2167
|
if (targetRef.current === null) return;
|
|
1841
2168
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
1842
2169
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
1843
2170
|
setTooltipPosition(position);
|
|
1844
2171
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
1845
|
-
return /* @__PURE__ */
|
|
2172
|
+
return /* @__PURE__ */ jsxs27(
|
|
1846
2173
|
"div",
|
|
1847
2174
|
{
|
|
1848
2175
|
ref: targetRef,
|
|
@@ -1851,7 +2178,7 @@ function Tooltip({
|
|
|
1851
2178
|
onMouseLeave: handleMouseOutWrapper,
|
|
1852
2179
|
children: [
|
|
1853
2180
|
children,
|
|
1854
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */
|
|
2181
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ jsx47(
|
|
1855
2182
|
TooltipContent,
|
|
1856
2183
|
{
|
|
1857
2184
|
content,
|
|
@@ -1862,7 +2189,7 @@ function Tooltip({
|
|
|
1862
2189
|
tooltipPosition
|
|
1863
2190
|
}
|
|
1864
2191
|
) : createPortal4(
|
|
1865
|
-
/* @__PURE__ */
|
|
2192
|
+
/* @__PURE__ */ jsx47(
|
|
1866
2193
|
TooltipContent,
|
|
1867
2194
|
{
|
|
1868
2195
|
isPortal: true,
|
|
@@ -1897,8 +2224,10 @@ export {
|
|
|
1897
2224
|
PaginationSelect,
|
|
1898
2225
|
Radio,
|
|
1899
2226
|
Search,
|
|
2227
|
+
SegmentedControl,
|
|
1900
2228
|
Select,
|
|
1901
2229
|
SelectSort,
|
|
2230
|
+
SortButton,
|
|
1902
2231
|
Tab,
|
|
1903
2232
|
TabItem,
|
|
1904
2233
|
Table,
|
|
@@ -1912,5 +2241,6 @@ export {
|
|
|
1912
2241
|
Toggle,
|
|
1913
2242
|
Tooltip,
|
|
1914
2243
|
useOutsideClick,
|
|
2244
|
+
useRovingFocus,
|
|
1915
2245
|
useToast
|
|
1916
2246
|
};
|