@zenkigen-inc/component-ui 1.15.3 → 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 +558 -238
- package/dist/index.mjs +529 -212
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -46,8 +46,10 @@ __export(index_exports, {
|
|
|
46
46
|
PaginationSelect: () => PaginationSelect,
|
|
47
47
|
Radio: () => Radio,
|
|
48
48
|
Search: () => Search,
|
|
49
|
+
SegmentedControl: () => SegmentedControl,
|
|
49
50
|
Select: () => Select,
|
|
50
51
|
SelectSort: () => SelectSort,
|
|
52
|
+
SortButton: () => SortButton,
|
|
51
53
|
Tab: () => Tab,
|
|
52
54
|
TabItem: () => TabItem,
|
|
53
55
|
Table: () => Table,
|
|
@@ -61,6 +63,7 @@ __export(index_exports, {
|
|
|
61
63
|
Toggle: () => Toggle,
|
|
62
64
|
Tooltip: () => Tooltip,
|
|
63
65
|
useOutsideClick: () => useOutsideClick,
|
|
66
|
+
useRovingFocus: () => useRovingFocus,
|
|
64
67
|
useToast: () => useToast
|
|
65
68
|
});
|
|
66
69
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -238,7 +241,7 @@ function Checkbox({
|
|
|
238
241
|
"bg-disabled01": isDisabled && isChecked,
|
|
239
242
|
"bg-hover01": !(isDisabled && isChecked) && isMouseOver,
|
|
240
243
|
"bg-interactive01": !(isDisabled && isChecked) && !isMouseOver,
|
|
241
|
-
"bg-
|
|
244
|
+
"bg-hoverGray": !(isDisabled && isChecked) && isMouseOver && color === "gray",
|
|
242
245
|
"bg-interactive02": !(isDisabled && isChecked) && !isMouseOver && color === "gray",
|
|
243
246
|
"bg-hoverError": !(isDisabled && isChecked) && isMouseOver && color === "error",
|
|
244
247
|
"bg-supportError": !(isDisabled && isChecked) && !isMouseOver && color === "error",
|
|
@@ -558,6 +561,76 @@ function Heading(props) {
|
|
|
558
561
|
] });
|
|
559
562
|
}
|
|
560
563
|
|
|
564
|
+
// src/hooks/use-roving-focus.ts
|
|
565
|
+
var import_react8 = require("react");
|
|
566
|
+
var useRovingFocus = ({
|
|
567
|
+
values,
|
|
568
|
+
defaultFocusedValue,
|
|
569
|
+
isDisabled = false
|
|
570
|
+
}) => {
|
|
571
|
+
const [focusedValue, setFocusedValue] = (0, import_react8.useState)(
|
|
572
|
+
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
573
|
+
);
|
|
574
|
+
const handleFocusChange = (0, import_react8.useCallback)((newValue) => {
|
|
575
|
+
setFocusedValue(newValue);
|
|
576
|
+
}, []);
|
|
577
|
+
const handleBlur = (0, import_react8.useCallback)(() => {
|
|
578
|
+
setFocusedValue(null);
|
|
579
|
+
}, []);
|
|
580
|
+
const handleKeyDown = (0, import_react8.useCallback)(
|
|
581
|
+
(event) => {
|
|
582
|
+
if (isDisabled === true || values.length === 0) return;
|
|
583
|
+
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
584
|
+
let newIndex;
|
|
585
|
+
let targetValue;
|
|
586
|
+
switch (event.key) {
|
|
587
|
+
case "ArrowLeft":
|
|
588
|
+
case "ArrowUp":
|
|
589
|
+
event.preventDefault();
|
|
590
|
+
newIndex = currentIndex > 0 ? currentIndex - 1 : values.length - 1;
|
|
591
|
+
targetValue = values[newIndex];
|
|
592
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
593
|
+
handleFocusChange(targetValue);
|
|
594
|
+
}
|
|
595
|
+
break;
|
|
596
|
+
case "ArrowRight":
|
|
597
|
+
case "ArrowDown":
|
|
598
|
+
event.preventDefault();
|
|
599
|
+
newIndex = currentIndex < values.length - 1 ? currentIndex + 1 : 0;
|
|
600
|
+
targetValue = values[newIndex];
|
|
601
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
602
|
+
handleFocusChange(targetValue);
|
|
603
|
+
}
|
|
604
|
+
break;
|
|
605
|
+
case "Home":
|
|
606
|
+
event.preventDefault();
|
|
607
|
+
targetValue = values[0];
|
|
608
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
609
|
+
handleFocusChange(targetValue);
|
|
610
|
+
}
|
|
611
|
+
break;
|
|
612
|
+
case "End":
|
|
613
|
+
event.preventDefault();
|
|
614
|
+
targetValue = values[values.length - 1];
|
|
615
|
+
if (typeof targetValue !== "undefined" && targetValue !== null && targetValue !== "") {
|
|
616
|
+
handleFocusChange(targetValue);
|
|
617
|
+
}
|
|
618
|
+
break;
|
|
619
|
+
default:
|
|
620
|
+
break;
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
[focusedValue, values, isDisabled, handleFocusChange]
|
|
624
|
+
);
|
|
625
|
+
return {
|
|
626
|
+
focusedValue,
|
|
627
|
+
handleFocusChange,
|
|
628
|
+
handleKeyDown,
|
|
629
|
+
handleBlur,
|
|
630
|
+
setFocusedValue
|
|
631
|
+
};
|
|
632
|
+
};
|
|
633
|
+
|
|
561
634
|
// src/icon-button/icon-button.tsx
|
|
562
635
|
var import_component_theme9 = require("@zenkigen-inc/component-theme");
|
|
563
636
|
var import_clsx10 = require("clsx");
|
|
@@ -644,13 +717,13 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
644
717
|
}
|
|
645
718
|
|
|
646
719
|
// src/modal/modal.tsx
|
|
647
|
-
var
|
|
720
|
+
var import_react12 = require("react");
|
|
648
721
|
var import_react_dom2 = require("react-dom");
|
|
649
722
|
|
|
650
723
|
// src/modal/body-scroll-lock.tsx
|
|
651
|
-
var
|
|
724
|
+
var import_react9 = require("react");
|
|
652
725
|
var BodyScrollLock = () => {
|
|
653
|
-
(0,
|
|
726
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
654
727
|
const { scrollX, scrollY } = window;
|
|
655
728
|
const { body } = document;
|
|
656
729
|
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
|
@@ -701,8 +774,8 @@ function ModalBody({ children }) {
|
|
|
701
774
|
}
|
|
702
775
|
|
|
703
776
|
// src/modal/modal-context.ts
|
|
704
|
-
var
|
|
705
|
-
var ModalContext = (0,
|
|
777
|
+
var import_react10 = require("react");
|
|
778
|
+
var ModalContext = (0, import_react10.createContext)({
|
|
706
779
|
onClose: () => null
|
|
707
780
|
});
|
|
708
781
|
|
|
@@ -718,10 +791,10 @@ function ModalFooter({ children, isNoBorder = false }) {
|
|
|
718
791
|
|
|
719
792
|
// src/modal/modal-header.tsx
|
|
720
793
|
var import_clsx13 = __toESM(require("clsx"));
|
|
721
|
-
var
|
|
794
|
+
var import_react11 = require("react");
|
|
722
795
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
723
796
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
724
|
-
const { onClose } = (0,
|
|
797
|
+
const { onClose } = (0, import_react11.useContext)(ModalContext);
|
|
725
798
|
const headerClasses = (0, import_clsx13.default)(
|
|
726
799
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
727
800
|
{
|
|
@@ -749,10 +822,10 @@ function Modal({
|
|
|
749
822
|
onClose,
|
|
750
823
|
portalTargetRef
|
|
751
824
|
}) {
|
|
752
|
-
const [isMounted, setIsMounted] = (0,
|
|
825
|
+
const [isMounted, setIsMounted] = (0, import_react12.useState)(false);
|
|
753
826
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
754
827
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
755
|
-
(0,
|
|
828
|
+
(0, import_react12.useEffect)(() => {
|
|
756
829
|
setIsMounted(true);
|
|
757
830
|
}, []);
|
|
758
831
|
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
@@ -812,18 +885,18 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
812
885
|
|
|
813
886
|
// src/pagination/pagination-button.tsx
|
|
814
887
|
var import_clsx15 = require("clsx");
|
|
815
|
-
var
|
|
888
|
+
var import_react14 = require("react");
|
|
816
889
|
|
|
817
890
|
// src/pagination/pagination-context.ts
|
|
818
|
-
var
|
|
819
|
-
var PaginationContext = (0,
|
|
891
|
+
var import_react13 = require("react");
|
|
892
|
+
var PaginationContext = (0, import_react13.createContext)({
|
|
820
893
|
currentPage: 0
|
|
821
894
|
});
|
|
822
895
|
|
|
823
896
|
// src/pagination/pagination-button.tsx
|
|
824
897
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
825
898
|
function PaginationButton({ page, onClick }) {
|
|
826
|
-
const { currentPage } = (0,
|
|
899
|
+
const { currentPage } = (0, import_react14.useContext)(PaginationContext);
|
|
827
900
|
const buttonClasses = (0, import_clsx15.clsx)(
|
|
828
901
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
829
902
|
"typography-label14regular",
|
|
@@ -890,23 +963,24 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
890
963
|
// src/select/select.tsx
|
|
891
964
|
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
892
965
|
var import_clsx18 = __toESM(require("clsx"));
|
|
893
|
-
var
|
|
966
|
+
var import_react18 = require("react");
|
|
894
967
|
|
|
895
968
|
// src/select/select-context.ts
|
|
896
|
-
var
|
|
897
|
-
var SelectContext = (0,
|
|
969
|
+
var import_react15 = require("react");
|
|
970
|
+
var SelectContext = (0, import_react15.createContext)({
|
|
898
971
|
size: "medium",
|
|
899
972
|
setIsOptionListOpen: () => false,
|
|
900
|
-
variant: "outline"
|
|
973
|
+
variant: "outline",
|
|
974
|
+
isError: false
|
|
901
975
|
});
|
|
902
976
|
|
|
903
977
|
// src/select/select-item.tsx
|
|
904
978
|
var import_component_theme10 = require("@zenkigen-inc/component-theme");
|
|
905
979
|
var import_clsx16 = __toESM(require("clsx"));
|
|
906
|
-
var
|
|
980
|
+
var import_react16 = require("react");
|
|
907
981
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
908
982
|
function SelectItem({ option }) {
|
|
909
|
-
const { setIsOptionListOpen, selectedOption, onChange } = (0,
|
|
983
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0, import_react16.useContext)(SelectContext);
|
|
910
984
|
const handleClickItem = (option2) => {
|
|
911
985
|
onChange?.(option2);
|
|
912
986
|
setIsOptionListOpen(false);
|
|
@@ -915,7 +989,8 @@ function SelectItem({ option }) {
|
|
|
915
989
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
916
990
|
import_component_theme10.focusVisible.inset,
|
|
917
991
|
{
|
|
918
|
-
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id,
|
|
992
|
+
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
993
|
+
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
919
994
|
"text-interactive02 fill-icon01 bg-uiBackground01": option.id !== selectedOption?.id
|
|
920
995
|
}
|
|
921
996
|
);
|
|
@@ -929,16 +1004,16 @@ function SelectItem({ option }) {
|
|
|
929
1004
|
// src/select/select-list.tsx
|
|
930
1005
|
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
931
1006
|
var import_clsx17 = __toESM(require("clsx"));
|
|
932
|
-
var
|
|
1007
|
+
var import_react17 = require("react");
|
|
933
1008
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
934
1009
|
function SelectList({ children, maxHeight }) {
|
|
935
|
-
const ref = (0,
|
|
936
|
-
const { size, selectedOption, setIsOptionListOpen, variant, placeholder, onChange } = (0,
|
|
1010
|
+
const ref = (0, import_react17.useRef)(null);
|
|
1011
|
+
const { size, selectedOption, setIsOptionListOpen, variant, placeholder, onChange } = (0, import_react17.useContext)(SelectContext);
|
|
937
1012
|
const handleClickDeselect = () => {
|
|
938
1013
|
onChange?.(null);
|
|
939
1014
|
setIsOptionListOpen(false);
|
|
940
1015
|
};
|
|
941
|
-
(0,
|
|
1016
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
942
1017
|
if (maxHeight != null && ref.current) {
|
|
943
1018
|
const element = Array.from(ref.current.children ?? []).find(
|
|
944
1019
|
(item) => item.getAttribute("data-id") === selectedOption?.id
|
|
@@ -981,14 +1056,17 @@ function Select({
|
|
|
981
1056
|
placeholderIcon,
|
|
982
1057
|
selectedOption = null,
|
|
983
1058
|
isDisabled = false,
|
|
1059
|
+
isError = false,
|
|
984
1060
|
isOptionSelected = false,
|
|
985
1061
|
onChange,
|
|
986
1062
|
optionListMaxHeight
|
|
987
1063
|
}) {
|
|
988
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
989
|
-
const targetRef = (0,
|
|
1064
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react18.useState)(false);
|
|
1065
|
+
const targetRef = (0, import_react18.useRef)(null);
|
|
990
1066
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
991
1067
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1068
|
+
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
1069
|
+
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
992
1070
|
const wrapperClasses = (0, import_clsx18.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
993
1071
|
"h-6": size === "x-small" || size === "small",
|
|
994
1072
|
"h-8": size === "medium",
|
|
@@ -997,16 +1075,17 @@ function Select({
|
|
|
997
1075
|
});
|
|
998
1076
|
const buttonClasses = (0, import_clsx18.default)(
|
|
999
1077
|
"flex size-full items-center rounded",
|
|
1000
|
-
import_component_theme12.
|
|
1001
|
-
import_component_theme12.
|
|
1002
|
-
import_component_theme12.
|
|
1078
|
+
import_component_theme12.selectColors[buttonVariant].hover,
|
|
1079
|
+
import_component_theme12.selectColors[buttonVariant].active,
|
|
1080
|
+
import_component_theme12.selectColors[buttonVariant].disabled,
|
|
1003
1081
|
import_component_theme12.focusVisible.normal,
|
|
1004
1082
|
{
|
|
1005
|
-
[import_component_theme12.
|
|
1006
|
-
[import_component_theme12.
|
|
1083
|
+
[import_component_theme12.selectColors[buttonVariant].selected]: isSelected,
|
|
1084
|
+
[import_component_theme12.selectColors[buttonVariant].base]: !isSelected,
|
|
1007
1085
|
"px-2": size === "x-small" || size === "small",
|
|
1008
1086
|
"px-4": size === "medium" || size === "large",
|
|
1009
|
-
"pointer-events-none": isDisabled
|
|
1087
|
+
"pointer-events-none": isDisabled,
|
|
1088
|
+
"border-supportError": !isSelected && !isDisabled && isError
|
|
1010
1089
|
}
|
|
1011
1090
|
);
|
|
1012
1091
|
const labelClasses = (0, import_clsx18.default)("overflow-hidden", {
|
|
@@ -1025,7 +1104,8 @@ function Select({
|
|
|
1025
1104
|
placeholder,
|
|
1026
1105
|
setIsOptionListOpen,
|
|
1027
1106
|
selectedOption,
|
|
1028
|
-
onChange
|
|
1107
|
+
onChange,
|
|
1108
|
+
isError
|
|
1029
1109
|
},
|
|
1030
1110
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
1031
1111
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
@@ -1123,17 +1203,17 @@ function PaginationSelect({
|
|
|
1123
1203
|
// src/radio/radio.tsx
|
|
1124
1204
|
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
1125
1205
|
var import_clsx19 = __toESM(require("clsx"));
|
|
1126
|
-
var
|
|
1206
|
+
var import_react19 = require("react");
|
|
1127
1207
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1128
1208
|
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1129
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
1130
|
-
const handleMouseOverInput = (0,
|
|
1209
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react19.useState)(false);
|
|
1210
|
+
const handleMouseOverInput = (0, import_react19.useCallback)(() => {
|
|
1131
1211
|
setIsMouseOver(true);
|
|
1132
1212
|
}, []);
|
|
1133
|
-
const handleMouseOutInput = (0,
|
|
1213
|
+
const handleMouseOutInput = (0, import_react19.useCallback)(() => {
|
|
1134
1214
|
setIsMouseOver(false);
|
|
1135
1215
|
}, []);
|
|
1136
|
-
const handleChange = (0,
|
|
1216
|
+
const handleChange = (0, import_react19.useCallback)(
|
|
1137
1217
|
(e) => !isDisabled && onChange?.(e),
|
|
1138
1218
|
[isDisabled, onChange]
|
|
1139
1219
|
);
|
|
@@ -1193,9 +1273,9 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
1193
1273
|
|
|
1194
1274
|
// src/search/search.tsx
|
|
1195
1275
|
var import_clsx20 = require("clsx");
|
|
1196
|
-
var
|
|
1276
|
+
var import_react20 = require("react");
|
|
1197
1277
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1198
|
-
var Search = (0,
|
|
1278
|
+
var Search = (0, import_react20.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
1199
1279
|
const classes = (0, import_clsx20.clsx)(
|
|
1200
1280
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
1201
1281
|
{ "h-8 px-3": size === "medium" },
|
|
@@ -1232,38 +1312,204 @@ var Search = (0, import_react19.forwardRef)(({ width = "100%", size = "medium",
|
|
|
1232
1312
|
});
|
|
1233
1313
|
Search.displayName = "Search";
|
|
1234
1314
|
|
|
1315
|
+
// src/segmented-control/segmented-control.tsx
|
|
1316
|
+
var import_react23 = __toESM(require("react"));
|
|
1317
|
+
|
|
1318
|
+
// src/segmented-control/segmented-control-context.ts
|
|
1319
|
+
var import_react21 = require("react");
|
|
1320
|
+
var SegmentedControlContext = (0, import_react21.createContext)(null);
|
|
1321
|
+
|
|
1322
|
+
// src/segmented-control/segmented-control-item.tsx
|
|
1323
|
+
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
1324
|
+
var import_clsx21 = require("clsx");
|
|
1325
|
+
var import_react22 = require("react");
|
|
1326
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1327
|
+
var SegmentedControlItem = ({
|
|
1328
|
+
label,
|
|
1329
|
+
value,
|
|
1330
|
+
icon,
|
|
1331
|
+
isDisabled: itemDisabled,
|
|
1332
|
+
"aria-label": ariaLabel,
|
|
1333
|
+
...rest
|
|
1334
|
+
}) => {
|
|
1335
|
+
const context = (0, import_react22.useContext)(SegmentedControlContext);
|
|
1336
|
+
const buttonRef = (0, import_react22.useRef)(null);
|
|
1337
|
+
const lastInteractionWasMouse = (0, import_react22.useRef)(false);
|
|
1338
|
+
if (context === null) {
|
|
1339
|
+
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
1340
|
+
}
|
|
1341
|
+
const {
|
|
1342
|
+
value: selectedValue,
|
|
1343
|
+
onChange,
|
|
1344
|
+
size,
|
|
1345
|
+
isDisabled: isContextDisabled,
|
|
1346
|
+
focusedValue,
|
|
1347
|
+
onFocusChange,
|
|
1348
|
+
onBlur
|
|
1349
|
+
} = context;
|
|
1350
|
+
const isSelected = value === selectedValue;
|
|
1351
|
+
const isFocused = value === focusedValue;
|
|
1352
|
+
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
1353
|
+
(0, import_react22.useEffect)(() => {
|
|
1354
|
+
if (isFocused === true && buttonRef.current !== null) {
|
|
1355
|
+
buttonRef.current.focus();
|
|
1356
|
+
}
|
|
1357
|
+
}, [isFocused]);
|
|
1358
|
+
const handleClick = () => {
|
|
1359
|
+
if (!isOptionDisabled) {
|
|
1360
|
+
onChange?.(value);
|
|
1361
|
+
}
|
|
1362
|
+
};
|
|
1363
|
+
const handleFocus = () => {
|
|
1364
|
+
if (!lastInteractionWasMouse.current && !isOptionDisabled) {
|
|
1365
|
+
onFocusChange?.(value);
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
const handleMouseDown = () => {
|
|
1369
|
+
lastInteractionWasMouse.current = true;
|
|
1370
|
+
};
|
|
1371
|
+
const handleBlur = () => {
|
|
1372
|
+
lastInteractionWasMouse.current = false;
|
|
1373
|
+
onBlur?.();
|
|
1374
|
+
};
|
|
1375
|
+
const buttonClasses = (0, import_clsx21.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme14.focusVisible.normal, {
|
|
1376
|
+
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
1377
|
+
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
1378
|
+
// States - Default with hover
|
|
1379
|
+
"bg-transparent text-text01 hover:bg-hover02": isSelected === false && isOptionDisabled === false,
|
|
1380
|
+
// States - Selected
|
|
1381
|
+
"bg-uiBackground01 text-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1382
|
+
// States - Disabled
|
|
1383
|
+
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
1384
|
+
});
|
|
1385
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1386
|
+
"button",
|
|
1387
|
+
{
|
|
1388
|
+
ref: buttonRef,
|
|
1389
|
+
type: "button",
|
|
1390
|
+
role: "tab",
|
|
1391
|
+
"aria-selected": isSelected,
|
|
1392
|
+
"aria-label": ariaLabel,
|
|
1393
|
+
disabled: isOptionDisabled,
|
|
1394
|
+
tabIndex: isFocused === true || isSelected === true && focusedValue === null ? 0 : -1,
|
|
1395
|
+
className: buttonClasses,
|
|
1396
|
+
onClick: handleClick,
|
|
1397
|
+
onFocus: handleFocus,
|
|
1398
|
+
onBlur: handleBlur,
|
|
1399
|
+
onMouseDown: handleMouseDown,
|
|
1400
|
+
...rest,
|
|
1401
|
+
children: [
|
|
1402
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1403
|
+
"span",
|
|
1404
|
+
{
|
|
1405
|
+
className: (0, import_clsx21.clsx)("flex items-center", {
|
|
1406
|
+
"fill-disabled01": isOptionDisabled === true,
|
|
1407
|
+
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1408
|
+
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
1409
|
+
}),
|
|
1410
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: icon, size: "small" })
|
|
1411
|
+
}
|
|
1412
|
+
),
|
|
1413
|
+
Boolean(label) === true && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
1414
|
+
]
|
|
1415
|
+
}
|
|
1416
|
+
);
|
|
1417
|
+
};
|
|
1418
|
+
|
|
1419
|
+
// src/segmented-control/segmented-control.tsx
|
|
1420
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1421
|
+
var SegmentedControl = ({
|
|
1422
|
+
children,
|
|
1423
|
+
value,
|
|
1424
|
+
onChange,
|
|
1425
|
+
size = "medium",
|
|
1426
|
+
isDisabled = false,
|
|
1427
|
+
"aria-label": ariaLabel,
|
|
1428
|
+
...rest
|
|
1429
|
+
}) => {
|
|
1430
|
+
const containerRef = (0, import_react23.useRef)(null);
|
|
1431
|
+
const itemIds = import_react23.Children.toArray(children).filter((child) => {
|
|
1432
|
+
if (!import_react23.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
1433
|
+
return false;
|
|
1434
|
+
}
|
|
1435
|
+
const props = child.props;
|
|
1436
|
+
return props.isDisabled !== true;
|
|
1437
|
+
}).map((child) => child.props.value);
|
|
1438
|
+
const childrenCount = import_react23.Children.count(children);
|
|
1439
|
+
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
1440
|
+
const {
|
|
1441
|
+
focusedValue,
|
|
1442
|
+
handleFocusChange,
|
|
1443
|
+
handleKeyDown,
|
|
1444
|
+
handleBlur: handleBlurRovingFocus
|
|
1445
|
+
} = useRovingFocus({
|
|
1446
|
+
values: itemIds,
|
|
1447
|
+
isDisabled
|
|
1448
|
+
});
|
|
1449
|
+
const handleFocusAndChange = (newValue) => {
|
|
1450
|
+
handleFocusChange(newValue);
|
|
1451
|
+
if (!isDisabled && typeof onChange === "function" && newValue !== value) {
|
|
1452
|
+
onChange(newValue);
|
|
1453
|
+
}
|
|
1454
|
+
};
|
|
1455
|
+
const contextValue = {
|
|
1456
|
+
value,
|
|
1457
|
+
onChange,
|
|
1458
|
+
size,
|
|
1459
|
+
isDisabled,
|
|
1460
|
+
focusedValue,
|
|
1461
|
+
onFocusChange: handleFocusAndChange,
|
|
1462
|
+
onBlur: handleBlurRovingFocus,
|
|
1463
|
+
values: itemIds
|
|
1464
|
+
};
|
|
1465
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_jsx_runtime30.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1466
|
+
"div",
|
|
1467
|
+
{
|
|
1468
|
+
ref: containerRef,
|
|
1469
|
+
className: "grid gap-1 rounded-lg bg-uiBackground02 p-1",
|
|
1470
|
+
style: containerStyle,
|
|
1471
|
+
role: "tablist",
|
|
1472
|
+
"aria-label": ariaLabel,
|
|
1473
|
+
onKeyDown: handleKeyDown,
|
|
1474
|
+
...rest,
|
|
1475
|
+
children
|
|
1476
|
+
}
|
|
1477
|
+
) }) });
|
|
1478
|
+
};
|
|
1479
|
+
SegmentedControl.Item = SegmentedControlItem;
|
|
1480
|
+
|
|
1235
1481
|
// src/select-sort/select-sort.tsx
|
|
1482
|
+
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
1483
|
+
var import_clsx24 = __toESM(require("clsx"));
|
|
1484
|
+
var import_react24 = require("react");
|
|
1485
|
+
|
|
1486
|
+
// src/select-sort/select-list.tsx
|
|
1236
1487
|
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
1237
1488
|
var import_clsx23 = __toESM(require("clsx"));
|
|
1238
|
-
var import_react20 = require("react");
|
|
1239
1489
|
|
|
1240
|
-
// src/select-sort/select-
|
|
1490
|
+
// src/select-sort/select-item.tsx
|
|
1241
1491
|
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
1242
1492
|
var import_clsx22 = __toESM(require("clsx"));
|
|
1243
|
-
|
|
1244
|
-
// src/select-sort/select-item.tsx
|
|
1245
|
-
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
1246
|
-
var import_clsx21 = __toESM(require("clsx"));
|
|
1247
|
-
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1493
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1248
1494
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
1249
|
-
const itemClasses = (0,
|
|
1495
|
+
const itemClasses = (0, import_clsx22.default)(
|
|
1250
1496
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1251
|
-
|
|
1497
|
+
import_component_theme15.focusVisible.inset,
|
|
1252
1498
|
{
|
|
1253
1499
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
1254
1500
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
1255
1501
|
}
|
|
1256
1502
|
);
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
isSortKey && /* @__PURE__ */ (0,
|
|
1503
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("button", { className: itemClasses, type: "button", children: [
|
|
1504
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ml-1 mr-6", children }),
|
|
1505
|
+
isSortKey && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "check", size: "small" }) })
|
|
1260
1506
|
] }) });
|
|
1261
1507
|
}
|
|
1262
1508
|
|
|
1263
1509
|
// src/select-sort/select-list.tsx
|
|
1264
|
-
var
|
|
1510
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1265
1511
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
1266
|
-
const listClasses = (0,
|
|
1512
|
+
const listClasses = (0, import_clsx23.default)(
|
|
1267
1513
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
1268
1514
|
{
|
|
1269
1515
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -1272,19 +1518,19 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
1272
1518
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1273
1519
|
}
|
|
1274
1520
|
);
|
|
1275
|
-
const deselectButtonClasses = (0,
|
|
1521
|
+
const deselectButtonClasses = (0, import_clsx23.default)(
|
|
1276
1522
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1277
|
-
|
|
1523
|
+
import_component_theme16.focusVisible.inset
|
|
1278
1524
|
);
|
|
1279
|
-
return /* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
/* @__PURE__ */ (0,
|
|
1282
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0,
|
|
1525
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { className: listClasses, children: [
|
|
1526
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1527
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1528
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1283
1529
|
] });
|
|
1284
1530
|
}
|
|
1285
1531
|
|
|
1286
1532
|
// src/select-sort/select-sort.tsx
|
|
1287
|
-
var
|
|
1533
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1288
1534
|
function SelectSort({
|
|
1289
1535
|
size = "medium",
|
|
1290
1536
|
variant = "outline",
|
|
@@ -1296,54 +1542,54 @@ function SelectSort({
|
|
|
1296
1542
|
onChange,
|
|
1297
1543
|
onClickDeselect
|
|
1298
1544
|
}) {
|
|
1299
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
1300
|
-
const targetRef = (0,
|
|
1545
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react24.useState)(false);
|
|
1546
|
+
const targetRef = (0, import_react24.useRef)(null);
|
|
1301
1547
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1302
1548
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1303
|
-
const handleClickItem = (0,
|
|
1549
|
+
const handleClickItem = (0, import_react24.useCallback)(
|
|
1304
1550
|
(value) => {
|
|
1305
1551
|
onChange?.(value);
|
|
1306
1552
|
setIsOptionListOpen(false);
|
|
1307
1553
|
},
|
|
1308
1554
|
[onChange]
|
|
1309
1555
|
);
|
|
1310
|
-
const wrapperClasses = (0,
|
|
1556
|
+
const wrapperClasses = (0, import_clsx24.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1311
1557
|
"h-6": size === "x-small" || size === "small",
|
|
1312
1558
|
"h-8": size === "medium",
|
|
1313
1559
|
"h-10": size === "large",
|
|
1314
1560
|
"cursor-not-allowed": isDisabled
|
|
1315
1561
|
});
|
|
1316
|
-
const buttonClasses = (0,
|
|
1562
|
+
const buttonClasses = (0, import_clsx24.default)(
|
|
1317
1563
|
"flex size-full items-center rounded",
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1564
|
+
import_component_theme17.buttonColors[variant].hover,
|
|
1565
|
+
import_component_theme17.buttonColors[variant].active,
|
|
1566
|
+
import_component_theme17.buttonColors[variant].disabled,
|
|
1567
|
+
import_component_theme17.focusVisible.normal,
|
|
1322
1568
|
{
|
|
1323
|
-
[
|
|
1324
|
-
[
|
|
1569
|
+
[import_component_theme17.buttonColors[variant].selected]: isSortKey,
|
|
1570
|
+
[import_component_theme17.buttonColors[variant].base]: !isSortKey,
|
|
1325
1571
|
"px-2": size === "x-small" || size === "small",
|
|
1326
1572
|
"px-4": size === "medium" || size === "large",
|
|
1327
1573
|
"pointer-events-none": isDisabled
|
|
1328
1574
|
}
|
|
1329
1575
|
);
|
|
1330
|
-
const labelClasses = (0,
|
|
1576
|
+
const labelClasses = (0, import_clsx24.default)("truncate", {
|
|
1331
1577
|
"typography-label12regular": size === "x-small",
|
|
1332
1578
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1333
1579
|
"typography-label16regular": size === "large",
|
|
1334
1580
|
"mr-1": size === "x-small",
|
|
1335
1581
|
"mr-2": size !== "x-small"
|
|
1336
1582
|
});
|
|
1337
|
-
return /* @__PURE__ */ (0,
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1340
|
-
/* @__PURE__ */ (0,
|
|
1583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
1584
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
1585
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: labelClasses, children: label }),
|
|
1586
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1341
1587
|
Icon,
|
|
1342
1588
|
{
|
|
1343
1589
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
1344
1590
|
size: size === "large" ? "medium" : "small"
|
|
1345
1591
|
}
|
|
1346
|
-
) : /* @__PURE__ */ (0,
|
|
1592
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1347
1593
|
Icon,
|
|
1348
1594
|
{
|
|
1349
1595
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1351,7 +1597,7 @@ function SelectSort({
|
|
|
1351
1597
|
}
|
|
1352
1598
|
) })
|
|
1353
1599
|
] }),
|
|
1354
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
1600
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1355
1601
|
SelectList2,
|
|
1356
1602
|
{
|
|
1357
1603
|
size,
|
|
@@ -1364,11 +1610,82 @@ function SelectSort({
|
|
|
1364
1610
|
] });
|
|
1365
1611
|
}
|
|
1366
1612
|
|
|
1613
|
+
// src/sort-button/sort-button.tsx
|
|
1614
|
+
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
1615
|
+
var import_clsx25 = __toESM(require("clsx"));
|
|
1616
|
+
var import_react25 = require("react");
|
|
1617
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1618
|
+
function SortButton({
|
|
1619
|
+
size = "medium",
|
|
1620
|
+
width,
|
|
1621
|
+
label,
|
|
1622
|
+
sortOrder,
|
|
1623
|
+
isDisabled = false,
|
|
1624
|
+
onClick,
|
|
1625
|
+
"aria-label": ariaLabel,
|
|
1626
|
+
...rest
|
|
1627
|
+
}) {
|
|
1628
|
+
const handleClick = (0, import_react25.useCallback)(() => {
|
|
1629
|
+
if (isDisabled || !onClick) return;
|
|
1630
|
+
onClick();
|
|
1631
|
+
}, [isDisabled, onClick]);
|
|
1632
|
+
const getIconName = () => {
|
|
1633
|
+
if (sortOrder === "ascend") return "arrow-up";
|
|
1634
|
+
if (sortOrder === "descend") return "arrow-down";
|
|
1635
|
+
return "angle-small-down";
|
|
1636
|
+
};
|
|
1637
|
+
const wrapperClasses = (0, import_clsx25.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1638
|
+
"h-6": size === "x-small" || size === "small",
|
|
1639
|
+
"h-8": size === "medium",
|
|
1640
|
+
"h-10": size === "large",
|
|
1641
|
+
"cursor-not-allowed": isDisabled
|
|
1642
|
+
});
|
|
1643
|
+
const buttonClasses = (0, import_clsx25.default)(
|
|
1644
|
+
"flex size-full items-center rounded",
|
|
1645
|
+
import_component_theme18.buttonColors.text.hover,
|
|
1646
|
+
import_component_theme18.buttonColors.text.active,
|
|
1647
|
+
import_component_theme18.buttonColors.text.disabled,
|
|
1648
|
+
import_component_theme18.focusVisible.normal,
|
|
1649
|
+
{
|
|
1650
|
+
[import_component_theme18.buttonColors.text.selected]: !isDisabled && sortOrder !== null,
|
|
1651
|
+
// ソート状態時は選択状態のスタイル
|
|
1652
|
+
[import_component_theme18.buttonColors.text.base]: sortOrder === null,
|
|
1653
|
+
// ソートなし時は通常のスタイル
|
|
1654
|
+
"px-2": size === "x-small" || size === "small",
|
|
1655
|
+
"px-4": size === "medium" || size === "large",
|
|
1656
|
+
"pointer-events-none": isDisabled
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
const labelClasses = (0, import_clsx25.default)("truncate", {
|
|
1660
|
+
"typography-label12regular": size === "x-small",
|
|
1661
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
1662
|
+
"typography-label16regular": size === "large",
|
|
1663
|
+
"mr-1": size === "x-small",
|
|
1664
|
+
"mr-2": size !== "x-small"
|
|
1665
|
+
});
|
|
1666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1667
|
+
"button",
|
|
1668
|
+
{
|
|
1669
|
+
className: buttonClasses,
|
|
1670
|
+
...rest,
|
|
1671
|
+
type: "button",
|
|
1672
|
+
onClick: handleClick,
|
|
1673
|
+
disabled: isDisabled,
|
|
1674
|
+
"aria-label": ariaLabel,
|
|
1675
|
+
"aria-disabled": isDisabled,
|
|
1676
|
+
children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: labelClasses, children: label }),
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
1679
|
+
]
|
|
1680
|
+
}
|
|
1681
|
+
) });
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1367
1684
|
// src/tab/tab-item.tsx
|
|
1368
|
-
var
|
|
1369
|
-
var
|
|
1685
|
+
var import_clsx26 = require("clsx");
|
|
1686
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1370
1687
|
var TabItem = ({ isSelected = false, ...props }) => {
|
|
1371
|
-
const classes = (0,
|
|
1688
|
+
const classes = (0, import_clsx26.clsx)(
|
|
1372
1689
|
"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",
|
|
1373
1690
|
{
|
|
1374
1691
|
"typography-label14regular": !isSelected,
|
|
@@ -1377,7 +1694,7 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1377
1694
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
1378
1695
|
}
|
|
1379
1696
|
);
|
|
1380
|
-
return /* @__PURE__ */ (0,
|
|
1697
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1381
1698
|
"button",
|
|
1382
1699
|
{
|
|
1383
1700
|
type: "button",
|
|
@@ -1392,9 +1709,9 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1392
1709
|
};
|
|
1393
1710
|
|
|
1394
1711
|
// src/tab/tab.tsx
|
|
1395
|
-
var
|
|
1712
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1396
1713
|
function Tab({ children }) {
|
|
1397
|
-
return /* @__PURE__ */ (0,
|
|
1714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1398
1715
|
"div",
|
|
1399
1716
|
{
|
|
1400
1717
|
role: "tablist",
|
|
@@ -1406,23 +1723,23 @@ function Tab({ children }) {
|
|
|
1406
1723
|
Tab.Item = TabItem;
|
|
1407
1724
|
|
|
1408
1725
|
// src/table/table-cell.tsx
|
|
1409
|
-
var
|
|
1410
|
-
var
|
|
1726
|
+
var import_clsx27 = __toESM(require("clsx"));
|
|
1727
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1411
1728
|
function TableCell({ children, className, isHeader = false }) {
|
|
1412
|
-
const classes = (0,
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1729
|
+
const classes = (0, import_clsx27.default)("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
1730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: classes, children });
|
|
1414
1731
|
}
|
|
1415
1732
|
|
|
1416
1733
|
// src/table/table-row.tsx
|
|
1417
|
-
var
|
|
1418
|
-
var
|
|
1734
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
1735
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1419
1736
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
1420
|
-
const rowClasses = (0,
|
|
1421
|
-
return /* @__PURE__ */ (0,
|
|
1737
|
+
const rowClasses = (0, import_clsx28.default)("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
1738
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: rowClasses, children });
|
|
1422
1739
|
}
|
|
1423
1740
|
|
|
1424
1741
|
// src/table/table.tsx
|
|
1425
|
-
var
|
|
1742
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1426
1743
|
function Table({
|
|
1427
1744
|
width,
|
|
1428
1745
|
templateRows,
|
|
@@ -1431,7 +1748,7 @@ function Table({
|
|
|
1431
1748
|
autoRows,
|
|
1432
1749
|
children
|
|
1433
1750
|
}) {
|
|
1434
|
-
return /* @__PURE__ */ (0,
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1435
1752
|
"div",
|
|
1436
1753
|
{
|
|
1437
1754
|
className: "grid",
|
|
@@ -1450,23 +1767,23 @@ Table.Row = TableRow;
|
|
|
1450
1767
|
Table.Cell = TableCell;
|
|
1451
1768
|
|
|
1452
1769
|
// src/tag/tag.tsx
|
|
1453
|
-
var
|
|
1454
|
-
var
|
|
1770
|
+
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
1771
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
1455
1772
|
|
|
1456
1773
|
// src/tag/delete-icon.tsx
|
|
1457
|
-
var
|
|
1458
|
-
var
|
|
1459
|
-
var
|
|
1774
|
+
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
1775
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
1776
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1460
1777
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
1461
|
-
const deleteButtonClasses = (0,
|
|
1778
|
+
const deleteButtonClasses = (0, import_clsx29.default)(
|
|
1462
1779
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
1463
|
-
|
|
1780
|
+
import_component_theme19.focusVisible.normal
|
|
1464
1781
|
);
|
|
1465
|
-
const deletePathClasses = (0,
|
|
1782
|
+
const deletePathClasses = (0, import_clsx29.default)({
|
|
1466
1783
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
1467
1784
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
1468
1785
|
});
|
|
1469
|
-
return /* @__PURE__ */ (0,
|
|
1786
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1470
1787
|
"path",
|
|
1471
1788
|
{
|
|
1472
1789
|
fillRule: "evenodd",
|
|
@@ -1478,11 +1795,11 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
1478
1795
|
};
|
|
1479
1796
|
|
|
1480
1797
|
// src/tag/tag.tsx
|
|
1481
|
-
var
|
|
1798
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1482
1799
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
1483
|
-
const wrapperClasses = (0,
|
|
1484
|
-
[
|
|
1485
|
-
[
|
|
1800
|
+
const wrapperClasses = (0, import_clsx30.default)("flex", "items-center", "justify-center", {
|
|
1801
|
+
[import_component_theme20.tagColors[color]]: variant === "normal",
|
|
1802
|
+
[import_component_theme20.tagLightColors[color]]: variant === "light",
|
|
1486
1803
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
1487
1804
|
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
1488
1805
|
"h-[18px] typography-label14regular": !isEditable && size === "medium",
|
|
@@ -1492,17 +1809,17 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
1492
1809
|
"py-0.5 px-1": !isEditable,
|
|
1493
1810
|
"py-1 px-2": isEditable
|
|
1494
1811
|
});
|
|
1495
|
-
return /* @__PURE__ */ (0,
|
|
1812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: wrapperClasses, children: [
|
|
1496
1813
|
children,
|
|
1497
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
1814
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
1498
1815
|
] });
|
|
1499
1816
|
}
|
|
1500
1817
|
|
|
1501
1818
|
// src/text-area/text-area.tsx
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
1504
|
-
var
|
|
1505
|
-
var TextArea = (0,
|
|
1819
|
+
var import_clsx31 = require("clsx");
|
|
1820
|
+
var import_react26 = require("react");
|
|
1821
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1822
|
+
var TextArea = (0, import_react26.forwardRef)(
|
|
1506
1823
|
({
|
|
1507
1824
|
size = "medium",
|
|
1508
1825
|
isResizable = false,
|
|
@@ -1513,7 +1830,7 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1513
1830
|
height,
|
|
1514
1831
|
...props
|
|
1515
1832
|
}, ref) => {
|
|
1516
|
-
const classes = (0,
|
|
1833
|
+
const classes = (0, import_clsx31.clsx)(
|
|
1517
1834
|
"w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
1518
1835
|
{
|
|
1519
1836
|
"border-supportError": isError && !disabled,
|
|
@@ -1527,7 +1844,7 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1527
1844
|
"resize-none": !isResizable
|
|
1528
1845
|
}
|
|
1529
1846
|
);
|
|
1530
|
-
return /* @__PURE__ */ (0,
|
|
1847
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1531
1848
|
"textarea",
|
|
1532
1849
|
{
|
|
1533
1850
|
ref,
|
|
@@ -1548,13 +1865,13 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1548
1865
|
TextArea.displayName = "TextArea";
|
|
1549
1866
|
|
|
1550
1867
|
// src/text-input/text-input.tsx
|
|
1551
|
-
var
|
|
1552
|
-
var
|
|
1553
|
-
var
|
|
1554
|
-
var TextInput = (0,
|
|
1868
|
+
var import_clsx32 = require("clsx");
|
|
1869
|
+
var import_react27 = require("react");
|
|
1870
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1871
|
+
var TextInput = (0, import_react27.forwardRef)(
|
|
1555
1872
|
({ size = "medium", isError = false, disabled = false, onClickClearButton, ...props }, ref) => {
|
|
1556
1873
|
const isShowClearButton = !!onClickClearButton && props.value.length !== 0 && !disabled;
|
|
1557
|
-
const inputWrapClasses = (0,
|
|
1874
|
+
const inputWrapClasses = (0, import_clsx32.clsx)("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1558
1875
|
"border-uiBorder02": !isError && !disabled,
|
|
1559
1876
|
"border-supportError": isError && !disabled,
|
|
1560
1877
|
"hover:border-hoverInput": !disabled && !isError,
|
|
@@ -1564,25 +1881,25 @@ var TextInput = (0, import_react22.forwardRef)(
|
|
|
1564
1881
|
"pr-2": size === "medium" && isShowClearButton,
|
|
1565
1882
|
"pr-3": size === "large" && isShowClearButton
|
|
1566
1883
|
});
|
|
1567
|
-
const inputClasses = (0,
|
|
1884
|
+
const inputClasses = (0, import_clsx32.clsx)("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1568
1885
|
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1569
1886
|
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1570
1887
|
"text-text01": !isError,
|
|
1571
1888
|
"text-supportError": isError,
|
|
1572
1889
|
"pr-0": isShowClearButton
|
|
1573
1890
|
});
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
isShowClearButton && /* @__PURE__ */ (0,
|
|
1891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: inputWrapClasses, children: [
|
|
1892
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { ref, size: 1, className: inputClasses, disabled, onChange: props.onChange, ...props }),
|
|
1893
|
+
isShowClearButton && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1577
1894
|
] });
|
|
1578
1895
|
}
|
|
1579
1896
|
);
|
|
1580
1897
|
TextInput.displayName = "TextInput";
|
|
1581
1898
|
|
|
1582
1899
|
// src/toast/toast.tsx
|
|
1583
|
-
var
|
|
1584
|
-
var
|
|
1585
|
-
var
|
|
1900
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
1901
|
+
var import_react28 = require("react");
|
|
1902
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1586
1903
|
var CLOSE_TIME_MSEC = 5e3;
|
|
1587
1904
|
function Toast({
|
|
1588
1905
|
state = "information",
|
|
@@ -1592,8 +1909,8 @@ function Toast({
|
|
|
1592
1909
|
children,
|
|
1593
1910
|
onClickClose
|
|
1594
1911
|
}) {
|
|
1595
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
1596
|
-
const handleClose = (0,
|
|
1912
|
+
const [isRemoving, setIsRemoving] = (0, import_react28.useState)(false);
|
|
1913
|
+
const handleClose = (0, import_react28.useCallback)(() => {
|
|
1597
1914
|
if (isAnimation) {
|
|
1598
1915
|
setIsRemoving(true);
|
|
1599
1916
|
} else {
|
|
@@ -1601,17 +1918,17 @@ function Toast({
|
|
|
1601
1918
|
}
|
|
1602
1919
|
}, [isAnimation, onClickClose]);
|
|
1603
1920
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
1604
|
-
const wrapperClasses = (0,
|
|
1921
|
+
const wrapperClasses = (0, import_clsx33.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
1605
1922
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
1606
1923
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
1607
1924
|
});
|
|
1608
|
-
const iconClasses = (0,
|
|
1925
|
+
const iconClasses = (0, import_clsx33.default)("flex items-center", {
|
|
1609
1926
|
"fill-supportSuccess": state === "success",
|
|
1610
1927
|
"fill-supportError": state === "error",
|
|
1611
1928
|
"fill-supportWarning": state === "warning",
|
|
1612
1929
|
"fill-supportInfo": state === "information"
|
|
1613
1930
|
});
|
|
1614
|
-
const textClasses = (0,
|
|
1931
|
+
const textClasses = (0, import_clsx33.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
1615
1932
|
"text-supportError": state === "error",
|
|
1616
1933
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
1617
1934
|
});
|
|
@@ -1621,7 +1938,7 @@ function Toast({
|
|
|
1621
1938
|
warning: "warning",
|
|
1622
1939
|
information: "information-filled"
|
|
1623
1940
|
};
|
|
1624
|
-
(0,
|
|
1941
|
+
(0, import_react28.useEffect)(() => {
|
|
1625
1942
|
const timer = window.setTimeout(() => {
|
|
1626
1943
|
if (isAutoClose) {
|
|
1627
1944
|
setIsRemoving(true);
|
|
@@ -1629,45 +1946,45 @@ function Toast({
|
|
|
1629
1946
|
}, CLOSE_TIME_MSEC);
|
|
1630
1947
|
return () => window.clearTimeout(timer);
|
|
1631
1948
|
}, [isAutoClose]);
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1633
|
-
/* @__PURE__ */ (0,
|
|
1634
|
-
/* @__PURE__ */ (0,
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1949
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
1950
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: iconName[state] }) }),
|
|
1951
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: textClasses, children }),
|
|
1952
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
1636
1953
|
] });
|
|
1637
1954
|
}
|
|
1638
1955
|
|
|
1639
1956
|
// src/toast/toast-provider.tsx
|
|
1640
|
-
var
|
|
1957
|
+
var import_react29 = require("react");
|
|
1641
1958
|
var import_react_dom3 = require("react-dom");
|
|
1642
|
-
var
|
|
1643
|
-
var ToastContext = (0,
|
|
1959
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1960
|
+
var ToastContext = (0, import_react29.createContext)({});
|
|
1644
1961
|
var ToastProvider = ({ children }) => {
|
|
1645
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
1646
|
-
const [toasts, setToasts] = (0,
|
|
1647
|
-
const addToast = (0,
|
|
1962
|
+
const [isClientRender, setIsClientRender] = (0, import_react29.useState)(false);
|
|
1963
|
+
const [toasts, setToasts] = (0, import_react29.useState)([]);
|
|
1964
|
+
const addToast = (0, import_react29.useCallback)(({ message, state }) => {
|
|
1648
1965
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
1649
1966
|
}, []);
|
|
1650
|
-
const removeToast = (0,
|
|
1967
|
+
const removeToast = (0, import_react29.useCallback)((id) => {
|
|
1651
1968
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
1652
1969
|
}, []);
|
|
1653
|
-
(0,
|
|
1970
|
+
(0, import_react29.useEffect)(() => {
|
|
1654
1971
|
setIsClientRender(true);
|
|
1655
1972
|
}, []);
|
|
1656
|
-
return /* @__PURE__ */ (0,
|
|
1973
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
1657
1974
|
children,
|
|
1658
1975
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
1659
|
-
/* @__PURE__ */ (0,
|
|
1976
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "pointer-events-none fixed bottom-0 left-0 z-toast mb-4 ml-4 flex w-full flex-col-reverse gap-[16px]", children: toasts.map(({ id, message, state }) => /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
1660
1977
|
document.body
|
|
1661
1978
|
)
|
|
1662
1979
|
] });
|
|
1663
1980
|
};
|
|
1664
1981
|
var useToast = () => {
|
|
1665
|
-
return (0,
|
|
1982
|
+
return (0, import_react29.useContext)(ToastContext);
|
|
1666
1983
|
};
|
|
1667
1984
|
|
|
1668
1985
|
// src/toggle/toggle.tsx
|
|
1669
|
-
var
|
|
1670
|
-
var
|
|
1986
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
1987
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1671
1988
|
function Toggle({
|
|
1672
1989
|
id,
|
|
1673
1990
|
size = "medium",
|
|
@@ -1677,7 +1994,7 @@ function Toggle({
|
|
|
1677
1994
|
labelPosition = "right",
|
|
1678
1995
|
isDisabled = false
|
|
1679
1996
|
}) {
|
|
1680
|
-
const baseClasses = (0,
|
|
1997
|
+
const baseClasses = (0, import_clsx34.default)("relative flex items-center rounded-full", {
|
|
1681
1998
|
"bg-disabledOn": isDisabled && isChecked,
|
|
1682
1999
|
"bg-disabled01": isDisabled && !isChecked,
|
|
1683
2000
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -1685,16 +2002,16 @@ function Toggle({
|
|
|
1685
2002
|
"w-8 h-4 px-[3px]": size === "small",
|
|
1686
2003
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
1687
2004
|
});
|
|
1688
|
-
const inputClasses = (0,
|
|
2005
|
+
const inputClasses = (0, import_clsx34.default)(
|
|
1689
2006
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
1690
2007
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1691
2008
|
);
|
|
1692
|
-
const indicatorClasses = (0,
|
|
2009
|
+
const indicatorClasses = (0, import_clsx34.default)("rounded-full bg-iconOnColor", {
|
|
1693
2010
|
"w-2.5 h-2.5": size === "small",
|
|
1694
2011
|
"w-4 h-4": size === "medium" || size === "large",
|
|
1695
2012
|
"ml-auto": isChecked
|
|
1696
2013
|
});
|
|
1697
|
-
const labelClasses = (0,
|
|
2014
|
+
const labelClasses = (0, import_clsx34.default)("break-all", {
|
|
1698
2015
|
"mr-2": labelPosition === "left",
|
|
1699
2016
|
"ml-2": labelPosition === "right",
|
|
1700
2017
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -1702,9 +2019,9 @@ function Toggle({
|
|
|
1702
2019
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1703
2020
|
"cursor-pointer text-text01": !isDisabled
|
|
1704
2021
|
});
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
1706
|
-
label != null && labelPosition === "left" && /* @__PURE__ */ (0,
|
|
1707
|
-
/* @__PURE__ */ (0,
|
|
2022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
2023
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
2024
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1708
2025
|
"input",
|
|
1709
2026
|
{
|
|
1710
2027
|
className: inputClasses,
|
|
@@ -1716,77 +2033,23 @@ function Toggle({
|
|
|
1716
2033
|
disabled: isDisabled
|
|
1717
2034
|
}
|
|
1718
2035
|
),
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1720
|
-
label != null && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2036
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: baseClasses, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: indicatorClasses }) }),
|
|
2037
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1721
2038
|
] });
|
|
1722
2039
|
}
|
|
1723
2040
|
|
|
1724
2041
|
// src/tooltip/tooltip.tsx
|
|
1725
|
-
var
|
|
2042
|
+
var import_react31 = require("react");
|
|
1726
2043
|
var import_react_dom4 = require("react-dom");
|
|
1727
2044
|
|
|
1728
|
-
// src/tooltip/tooltip.hook.ts
|
|
1729
|
-
var import_react25 = require("react");
|
|
1730
|
-
var useTooltip = () => {
|
|
1731
|
-
const calculatePosition = (0, import_react25.useCallback)(
|
|
1732
|
-
(args) => {
|
|
1733
|
-
const result = {
|
|
1734
|
-
maxWidth: "none",
|
|
1735
|
-
width: "auto",
|
|
1736
|
-
left: "0px",
|
|
1737
|
-
top: "0px",
|
|
1738
|
-
bottom: "0px",
|
|
1739
|
-
translateX: "0",
|
|
1740
|
-
translateY: "0"
|
|
1741
|
-
};
|
|
1742
|
-
result.maxWidth = args.maxWidth ?? "none";
|
|
1743
|
-
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
1744
|
-
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
1745
|
-
const targetLeft = args.dimensions.left;
|
|
1746
|
-
const targetRight = args.dimensions.right;
|
|
1747
|
-
const targetWidth = args.dimensions.width;
|
|
1748
|
-
switch (args.horizontalAlign) {
|
|
1749
|
-
case "center":
|
|
1750
|
-
result.left = `${targetHorizontalCenter}px`;
|
|
1751
|
-
result.translateX = "-50%";
|
|
1752
|
-
break;
|
|
1753
|
-
case "left":
|
|
1754
|
-
result.left = `${targetLeft - offsetH}px`;
|
|
1755
|
-
result.translateX = `${targetWidth / 2}px`;
|
|
1756
|
-
break;
|
|
1757
|
-
case "right":
|
|
1758
|
-
result.left = `${targetRight + offsetH}px`;
|
|
1759
|
-
result.translateX = `-${targetWidth / 2}px`;
|
|
1760
|
-
break;
|
|
1761
|
-
}
|
|
1762
|
-
switch (args.verticalPosition) {
|
|
1763
|
-
case "bottom":
|
|
1764
|
-
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
1765
|
-
result.bottom = "unset";
|
|
1766
|
-
break;
|
|
1767
|
-
case "top":
|
|
1768
|
-
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
1769
|
-
result.bottom = "unset";
|
|
1770
|
-
result.translateY = "-100%";
|
|
1771
|
-
break;
|
|
1772
|
-
}
|
|
1773
|
-
return result;
|
|
1774
|
-
},
|
|
1775
|
-
[]
|
|
1776
|
-
);
|
|
1777
|
-
return {
|
|
1778
|
-
calculatePosition
|
|
1779
|
-
};
|
|
1780
|
-
};
|
|
1781
|
-
|
|
1782
2045
|
// src/tooltip/tooltip-content.tsx
|
|
1783
|
-
var
|
|
2046
|
+
var import_clsx36 = __toESM(require("clsx"));
|
|
1784
2047
|
|
|
1785
2048
|
// src/tooltip/tail-icon.tsx
|
|
1786
|
-
var
|
|
1787
|
-
var
|
|
2049
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
2050
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
1788
2051
|
var TailIcon = (props) => {
|
|
1789
|
-
const tailClasses = (0,
|
|
2052
|
+
const tailClasses = (0, import_clsx35.default)("absolute fill-uiBackgroundTooltip", {
|
|
1790
2053
|
"rotate-180": props.verticalPosition === "bottom",
|
|
1791
2054
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
1792
2055
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -1801,9 +2064,9 @@ var TailIcon = (props) => {
|
|
|
1801
2064
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
1802
2065
|
});
|
|
1803
2066
|
if (props.size === "small") {
|
|
1804
|
-
return /* @__PURE__ */ (0,
|
|
2067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("svg", { className: tailClasses, width: "8", height: "4", viewBox: "0 0 8 4", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
1805
2068
|
} else {
|
|
1806
|
-
return /* @__PURE__ */ (0,
|
|
2069
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
1807
2070
|
"svg",
|
|
1808
2071
|
{
|
|
1809
2072
|
className: tailClasses,
|
|
@@ -1812,14 +2075,14 @@ var TailIcon = (props) => {
|
|
|
1812
2075
|
viewBox: "0 0 14 8",
|
|
1813
2076
|
fill: "none",
|
|
1814
2077
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1815
|
-
children: /* @__PURE__ */ (0,
|
|
2078
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
1816
2079
|
}
|
|
1817
2080
|
);
|
|
1818
2081
|
}
|
|
1819
2082
|
};
|
|
1820
2083
|
|
|
1821
2084
|
// src/tooltip/tooltip-content.tsx
|
|
1822
|
-
var
|
|
2085
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1823
2086
|
var TooltipContent = ({
|
|
1824
2087
|
content,
|
|
1825
2088
|
horizontalAlign,
|
|
@@ -1829,7 +2092,7 @@ var TooltipContent = ({
|
|
|
1829
2092
|
maxWidth,
|
|
1830
2093
|
isPortal = false
|
|
1831
2094
|
}) => {
|
|
1832
|
-
const tooltipWrapperClasses = (0,
|
|
2095
|
+
const tooltipWrapperClasses = (0, import_clsx36.default)("absolute z-tooltip m-auto flex", {
|
|
1833
2096
|
"top-0": !isPortal && verticalPosition === "top",
|
|
1834
2097
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
1835
2098
|
"justify-start": horizontalAlign === "left",
|
|
@@ -1838,7 +2101,7 @@ var TooltipContent = ({
|
|
|
1838
2101
|
"w-[24px]": size === "small",
|
|
1839
2102
|
"w-[46px]": size !== "small"
|
|
1840
2103
|
});
|
|
1841
|
-
const tooltipBodyClasses = (0,
|
|
2104
|
+
const tooltipBodyClasses = (0, import_clsx36.default)(
|
|
1842
2105
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
1843
2106
|
{
|
|
1844
2107
|
"typography-body12regular": size === "small",
|
|
@@ -1855,7 +2118,7 @@ var TooltipContent = ({
|
|
|
1855
2118
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
1856
2119
|
...tooltipPosition
|
|
1857
2120
|
} : {};
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
2121
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
1859
2122
|
"div",
|
|
1860
2123
|
{
|
|
1861
2124
|
className: tooltipBodyClasses,
|
|
@@ -1864,14 +2127,68 @@ var TooltipContent = ({
|
|
|
1864
2127
|
},
|
|
1865
2128
|
children: [
|
|
1866
2129
|
content,
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
2130
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
1868
2131
|
]
|
|
1869
2132
|
}
|
|
1870
2133
|
) });
|
|
1871
2134
|
};
|
|
1872
2135
|
|
|
2136
|
+
// src/tooltip/tooltip-hook.ts
|
|
2137
|
+
var import_react30 = require("react");
|
|
2138
|
+
var useTooltip = () => {
|
|
2139
|
+
const calculatePosition = (0, import_react30.useCallback)(
|
|
2140
|
+
(args) => {
|
|
2141
|
+
const result = {
|
|
2142
|
+
maxWidth: "none",
|
|
2143
|
+
width: "auto",
|
|
2144
|
+
left: "0px",
|
|
2145
|
+
top: "0px",
|
|
2146
|
+
bottom: "0px",
|
|
2147
|
+
translateX: "0",
|
|
2148
|
+
translateY: "0"
|
|
2149
|
+
};
|
|
2150
|
+
result.maxWidth = args.maxWidth ?? "none";
|
|
2151
|
+
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
2152
|
+
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
2153
|
+
const targetLeft = args.dimensions.left;
|
|
2154
|
+
const targetRight = args.dimensions.right;
|
|
2155
|
+
const targetWidth = args.dimensions.width;
|
|
2156
|
+
switch (args.horizontalAlign) {
|
|
2157
|
+
case "center":
|
|
2158
|
+
result.left = `${targetHorizontalCenter}px`;
|
|
2159
|
+
result.translateX = "-50%";
|
|
2160
|
+
break;
|
|
2161
|
+
case "left":
|
|
2162
|
+
result.left = `${targetLeft - offsetH}px`;
|
|
2163
|
+
result.translateX = `${targetWidth / 2}px`;
|
|
2164
|
+
break;
|
|
2165
|
+
case "right":
|
|
2166
|
+
result.left = `${targetRight + offsetH}px`;
|
|
2167
|
+
result.translateX = `-${targetWidth / 2}px`;
|
|
2168
|
+
break;
|
|
2169
|
+
}
|
|
2170
|
+
switch (args.verticalPosition) {
|
|
2171
|
+
case "bottom":
|
|
2172
|
+
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
2173
|
+
result.bottom = "unset";
|
|
2174
|
+
break;
|
|
2175
|
+
case "top":
|
|
2176
|
+
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
2177
|
+
result.bottom = "unset";
|
|
2178
|
+
result.translateY = "-100%";
|
|
2179
|
+
break;
|
|
2180
|
+
}
|
|
2181
|
+
return result;
|
|
2182
|
+
},
|
|
2183
|
+
[]
|
|
2184
|
+
);
|
|
2185
|
+
return {
|
|
2186
|
+
calculatePosition
|
|
2187
|
+
};
|
|
2188
|
+
};
|
|
2189
|
+
|
|
1873
2190
|
// src/tooltip/tooltip.tsx
|
|
1874
|
-
var
|
|
2191
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1875
2192
|
function Tooltip({
|
|
1876
2193
|
children,
|
|
1877
2194
|
content,
|
|
@@ -1883,8 +2200,8 @@ function Tooltip({
|
|
|
1883
2200
|
portalTarget
|
|
1884
2201
|
}) {
|
|
1885
2202
|
const { calculatePosition } = useTooltip();
|
|
1886
|
-
const [isVisible, setIsVisible] = (0,
|
|
1887
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
2203
|
+
const [isVisible, setIsVisible] = (0, import_react31.useState)(false);
|
|
2204
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react31.useState)({
|
|
1888
2205
|
maxWidth: "none",
|
|
1889
2206
|
width: "auto",
|
|
1890
2207
|
left: "0px",
|
|
@@ -1893,23 +2210,23 @@ function Tooltip({
|
|
|
1893
2210
|
translateX: "0",
|
|
1894
2211
|
translateY: "0"
|
|
1895
2212
|
});
|
|
1896
|
-
const targetRef = (0,
|
|
1897
|
-
const handleMouseOverWrapper = (0,
|
|
2213
|
+
const targetRef = (0, import_react31.useRef)(null);
|
|
2214
|
+
const handleMouseOverWrapper = (0, import_react31.useCallback)(() => {
|
|
1898
2215
|
if (isDisabledHover) {
|
|
1899
2216
|
return;
|
|
1900
2217
|
}
|
|
1901
2218
|
setIsVisible(true);
|
|
1902
2219
|
}, [isDisabledHover]);
|
|
1903
|
-
const handleMouseOutWrapper = (0,
|
|
2220
|
+
const handleMouseOutWrapper = (0, import_react31.useCallback)(() => {
|
|
1904
2221
|
setIsVisible(false);
|
|
1905
2222
|
}, []);
|
|
1906
|
-
(0,
|
|
2223
|
+
(0, import_react31.useEffect)(() => {
|
|
1907
2224
|
if (targetRef.current === null) return;
|
|
1908
2225
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
1909
2226
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
1910
2227
|
setTooltipPosition(position);
|
|
1911
2228
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
2229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
1913
2230
|
"div",
|
|
1914
2231
|
{
|
|
1915
2232
|
ref: targetRef,
|
|
@@ -1918,7 +2235,7 @@ function Tooltip({
|
|
|
1918
2235
|
onMouseLeave: handleMouseOutWrapper,
|
|
1919
2236
|
children: [
|
|
1920
2237
|
children,
|
|
1921
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */ (0,
|
|
2238
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
1922
2239
|
TooltipContent,
|
|
1923
2240
|
{
|
|
1924
2241
|
content,
|
|
@@ -1929,7 +2246,7 @@ function Tooltip({
|
|
|
1929
2246
|
tooltipPosition
|
|
1930
2247
|
}
|
|
1931
2248
|
) : (0, import_react_dom4.createPortal)(
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2249
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
1933
2250
|
TooltipContent,
|
|
1934
2251
|
{
|
|
1935
2252
|
isPortal: true,
|
|
@@ -1965,8 +2282,10 @@ function Tooltip({
|
|
|
1965
2282
|
PaginationSelect,
|
|
1966
2283
|
Radio,
|
|
1967
2284
|
Search,
|
|
2285
|
+
SegmentedControl,
|
|
1968
2286
|
Select,
|
|
1969
2287
|
SelectSort,
|
|
2288
|
+
SortButton,
|
|
1970
2289
|
Tab,
|
|
1971
2290
|
TabItem,
|
|
1972
2291
|
Table,
|
|
@@ -1980,5 +2299,6 @@ function Tooltip({
|
|
|
1980
2299
|
Toggle,
|
|
1981
2300
|
Tooltip,
|
|
1982
2301
|
useOutsideClick,
|
|
2302
|
+
useRovingFocus,
|
|
1983
2303
|
useToast
|
|
1984
2304
|
});
|