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