@zenkigen-inc/component-ui 1.15.3 → 1.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +120 -50
- package/dist/index.d.ts +120 -50
- package/dist/index.js +581 -248
- package/dist/index.mjs +552 -222
- package/package.json +3 -3
package/dist/index.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,20 +561,91 @@ 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");
|
|
564
637
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
565
638
|
function IconButton({
|
|
639
|
+
icon,
|
|
566
640
|
size = "medium",
|
|
567
641
|
variant = "outline",
|
|
568
642
|
isNoPadding = false,
|
|
569
643
|
isDisabled = false,
|
|
644
|
+
isSelected = false,
|
|
570
645
|
...props
|
|
571
646
|
}) {
|
|
572
647
|
const baseClasses = (0, import_clsx10.clsx)(
|
|
573
648
|
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
574
|
-
import_component_theme9.buttonColors[variant].base,
|
|
575
649
|
import_component_theme9.buttonColors[variant].hover,
|
|
576
650
|
import_component_theme9.buttonColors[variant].active,
|
|
577
651
|
import_component_theme9.buttonColors[variant].disabled,
|
|
@@ -582,14 +656,20 @@ function IconButton({
|
|
|
582
656
|
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
583
657
|
"h-10 w-10": size === "large" && !isNoPadding,
|
|
584
658
|
"inline-flex": props.isAnchor,
|
|
585
|
-
"pointer-events-none": isDisabled
|
|
659
|
+
"pointer-events-none": isDisabled,
|
|
660
|
+
[import_component_theme9.buttonColors[variant].selected]: isSelected,
|
|
661
|
+
[import_component_theme9.buttonColors[variant].base]: !isSelected
|
|
586
662
|
}
|
|
587
663
|
);
|
|
588
664
|
const iconSize = size === "small" ? "small" : "medium";
|
|
589
665
|
if (props.isAnchor === true) {
|
|
590
|
-
|
|
666
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: icon, size: iconSize }) });
|
|
591
668
|
} else {
|
|
592
|
-
|
|
669
|
+
const buttonProps = Object.fromEntries(
|
|
670
|
+
Object.entries(props).filter(([key]) => key !== "isAnchor" && key !== "onClick")
|
|
671
|
+
);
|
|
672
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", className: baseClasses, disabled: isDisabled, onClick: props.onClick, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: icon, size: iconSize }) });
|
|
593
673
|
}
|
|
594
674
|
}
|
|
595
675
|
|
|
@@ -644,13 +724,13 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
644
724
|
}
|
|
645
725
|
|
|
646
726
|
// src/modal/modal.tsx
|
|
647
|
-
var
|
|
727
|
+
var import_react12 = require("react");
|
|
648
728
|
var import_react_dom2 = require("react-dom");
|
|
649
729
|
|
|
650
730
|
// src/modal/body-scroll-lock.tsx
|
|
651
|
-
var
|
|
731
|
+
var import_react9 = require("react");
|
|
652
732
|
var BodyScrollLock = () => {
|
|
653
|
-
(0,
|
|
733
|
+
(0, import_react9.useLayoutEffect)(() => {
|
|
654
734
|
const { scrollX, scrollY } = window;
|
|
655
735
|
const { body } = document;
|
|
656
736
|
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
|
@@ -701,8 +781,8 @@ function ModalBody({ children }) {
|
|
|
701
781
|
}
|
|
702
782
|
|
|
703
783
|
// src/modal/modal-context.ts
|
|
704
|
-
var
|
|
705
|
-
var ModalContext = (0,
|
|
784
|
+
var import_react10 = require("react");
|
|
785
|
+
var ModalContext = (0, import_react10.createContext)({
|
|
706
786
|
onClose: () => null
|
|
707
787
|
});
|
|
708
788
|
|
|
@@ -718,10 +798,10 @@ function ModalFooter({ children, isNoBorder = false }) {
|
|
|
718
798
|
|
|
719
799
|
// src/modal/modal-header.tsx
|
|
720
800
|
var import_clsx13 = __toESM(require("clsx"));
|
|
721
|
-
var
|
|
801
|
+
var import_react11 = require("react");
|
|
722
802
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
723
803
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
724
|
-
const { onClose } = (0,
|
|
804
|
+
const { onClose } = (0, import_react11.useContext)(ModalContext);
|
|
725
805
|
const headerClasses = (0, import_clsx13.default)(
|
|
726
806
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
727
807
|
{
|
|
@@ -749,10 +829,10 @@ function Modal({
|
|
|
749
829
|
onClose,
|
|
750
830
|
portalTargetRef
|
|
751
831
|
}) {
|
|
752
|
-
const [isMounted, setIsMounted] = (0,
|
|
832
|
+
const [isMounted, setIsMounted] = (0, import_react12.useState)(false);
|
|
753
833
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
754
834
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
755
|
-
(0,
|
|
835
|
+
(0, import_react12.useEffect)(() => {
|
|
756
836
|
setIsMounted(true);
|
|
757
837
|
}, []);
|
|
758
838
|
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
@@ -812,18 +892,18 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
812
892
|
|
|
813
893
|
// src/pagination/pagination-button.tsx
|
|
814
894
|
var import_clsx15 = require("clsx");
|
|
815
|
-
var
|
|
895
|
+
var import_react14 = require("react");
|
|
816
896
|
|
|
817
897
|
// src/pagination/pagination-context.ts
|
|
818
|
-
var
|
|
819
|
-
var PaginationContext = (0,
|
|
898
|
+
var import_react13 = require("react");
|
|
899
|
+
var PaginationContext = (0, import_react13.createContext)({
|
|
820
900
|
currentPage: 0
|
|
821
901
|
});
|
|
822
902
|
|
|
823
903
|
// src/pagination/pagination-button.tsx
|
|
824
904
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
825
905
|
function PaginationButton({ page, onClick }) {
|
|
826
|
-
const { currentPage } = (0,
|
|
906
|
+
const { currentPage } = (0, import_react14.useContext)(PaginationContext);
|
|
827
907
|
const buttonClasses = (0, import_clsx15.clsx)(
|
|
828
908
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
829
909
|
"typography-label14regular",
|
|
@@ -890,23 +970,24 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
890
970
|
// src/select/select.tsx
|
|
891
971
|
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
892
972
|
var import_clsx18 = __toESM(require("clsx"));
|
|
893
|
-
var
|
|
973
|
+
var import_react18 = require("react");
|
|
894
974
|
|
|
895
975
|
// src/select/select-context.ts
|
|
896
|
-
var
|
|
897
|
-
var SelectContext = (0,
|
|
976
|
+
var import_react15 = require("react");
|
|
977
|
+
var SelectContext = (0, import_react15.createContext)({
|
|
898
978
|
size: "medium",
|
|
899
979
|
setIsOptionListOpen: () => false,
|
|
900
|
-
variant: "outline"
|
|
980
|
+
variant: "outline",
|
|
981
|
+
isError: false
|
|
901
982
|
});
|
|
902
983
|
|
|
903
984
|
// src/select/select-item.tsx
|
|
904
985
|
var import_component_theme10 = require("@zenkigen-inc/component-theme");
|
|
905
986
|
var import_clsx16 = __toESM(require("clsx"));
|
|
906
|
-
var
|
|
987
|
+
var import_react16 = require("react");
|
|
907
988
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
908
989
|
function SelectItem({ option }) {
|
|
909
|
-
const { setIsOptionListOpen, selectedOption, onChange } = (0,
|
|
990
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0, import_react16.useContext)(SelectContext);
|
|
910
991
|
const handleClickItem = (option2) => {
|
|
911
992
|
onChange?.(option2);
|
|
912
993
|
setIsOptionListOpen(false);
|
|
@@ -915,7 +996,8 @@ function SelectItem({ option }) {
|
|
|
915
996
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
916
997
|
import_component_theme10.focusVisible.inset,
|
|
917
998
|
{
|
|
918
|
-
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id,
|
|
999
|
+
"text-interactive01 fill-interactive01 bg-selectedUi": option.id === selectedOption?.id && !(isError ?? false),
|
|
1000
|
+
"text-supportError fill-supportError bg-uiBackgroundError": option.id === selectedOption?.id && isError,
|
|
919
1001
|
"text-interactive02 fill-icon01 bg-uiBackground01": option.id !== selectedOption?.id
|
|
920
1002
|
}
|
|
921
1003
|
);
|
|
@@ -929,16 +1011,16 @@ function SelectItem({ option }) {
|
|
|
929
1011
|
// src/select/select-list.tsx
|
|
930
1012
|
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
931
1013
|
var import_clsx17 = __toESM(require("clsx"));
|
|
932
|
-
var
|
|
1014
|
+
var import_react17 = require("react");
|
|
933
1015
|
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
934
1016
|
function SelectList({ children, maxHeight }) {
|
|
935
|
-
const ref = (0,
|
|
936
|
-
const { size, selectedOption, setIsOptionListOpen, variant, placeholder, onChange } = (0,
|
|
1017
|
+
const ref = (0, import_react17.useRef)(null);
|
|
1018
|
+
const { size, selectedOption, setIsOptionListOpen, variant, placeholder, onChange } = (0, import_react17.useContext)(SelectContext);
|
|
937
1019
|
const handleClickDeselect = () => {
|
|
938
1020
|
onChange?.(null);
|
|
939
1021
|
setIsOptionListOpen(false);
|
|
940
1022
|
};
|
|
941
|
-
(0,
|
|
1023
|
+
(0, import_react17.useLayoutEffect)(() => {
|
|
942
1024
|
if (maxHeight != null && ref.current) {
|
|
943
1025
|
const element = Array.from(ref.current.children ?? []).find(
|
|
944
1026
|
(item) => item.getAttribute("data-id") === selectedOption?.id
|
|
@@ -981,14 +1063,17 @@ function Select({
|
|
|
981
1063
|
placeholderIcon,
|
|
982
1064
|
selectedOption = null,
|
|
983
1065
|
isDisabled = false,
|
|
1066
|
+
isError = false,
|
|
984
1067
|
isOptionSelected = false,
|
|
985
1068
|
onChange,
|
|
986
1069
|
optionListMaxHeight
|
|
987
1070
|
}) {
|
|
988
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
989
|
-
const targetRef = (0,
|
|
1071
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react18.useState)(false);
|
|
1072
|
+
const targetRef = (0, import_react18.useRef)(null);
|
|
990
1073
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
991
1074
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1075
|
+
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
1076
|
+
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
992
1077
|
const wrapperClasses = (0, import_clsx18.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
993
1078
|
"h-6": size === "x-small" || size === "small",
|
|
994
1079
|
"h-8": size === "medium",
|
|
@@ -997,16 +1082,17 @@ function Select({
|
|
|
997
1082
|
});
|
|
998
1083
|
const buttonClasses = (0, import_clsx18.default)(
|
|
999
1084
|
"flex size-full items-center rounded",
|
|
1000
|
-
import_component_theme12.
|
|
1001
|
-
import_component_theme12.
|
|
1002
|
-
import_component_theme12.
|
|
1085
|
+
import_component_theme12.selectColors[buttonVariant].hover,
|
|
1086
|
+
import_component_theme12.selectColors[buttonVariant].active,
|
|
1087
|
+
import_component_theme12.selectColors[buttonVariant].disabled,
|
|
1003
1088
|
import_component_theme12.focusVisible.normal,
|
|
1004
1089
|
{
|
|
1005
|
-
[import_component_theme12.
|
|
1006
|
-
[import_component_theme12.
|
|
1090
|
+
[import_component_theme12.selectColors[buttonVariant].selected]: isSelected,
|
|
1091
|
+
[import_component_theme12.selectColors[buttonVariant].base]: !isSelected,
|
|
1007
1092
|
"px-2": size === "x-small" || size === "small",
|
|
1008
1093
|
"px-4": size === "medium" || size === "large",
|
|
1009
|
-
"pointer-events-none": isDisabled
|
|
1094
|
+
"pointer-events-none": isDisabled,
|
|
1095
|
+
"border-supportError": !isSelected && !isDisabled && isError
|
|
1010
1096
|
}
|
|
1011
1097
|
);
|
|
1012
1098
|
const labelClasses = (0, import_clsx18.default)("overflow-hidden", {
|
|
@@ -1025,7 +1111,8 @@ function Select({
|
|
|
1025
1111
|
placeholder,
|
|
1026
1112
|
setIsOptionListOpen,
|
|
1027
1113
|
selectedOption,
|
|
1028
|
-
onChange
|
|
1114
|
+
onChange,
|
|
1115
|
+
isError
|
|
1029
1116
|
},
|
|
1030
1117
|
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
1031
1118
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
@@ -1123,17 +1210,17 @@ function PaginationSelect({
|
|
|
1123
1210
|
// src/radio/radio.tsx
|
|
1124
1211
|
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
1125
1212
|
var import_clsx19 = __toESM(require("clsx"));
|
|
1126
|
-
var
|
|
1213
|
+
var import_react19 = require("react");
|
|
1127
1214
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1128
1215
|
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1129
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
1130
|
-
const handleMouseOverInput = (0,
|
|
1216
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react19.useState)(false);
|
|
1217
|
+
const handleMouseOverInput = (0, import_react19.useCallback)(() => {
|
|
1131
1218
|
setIsMouseOver(true);
|
|
1132
1219
|
}, []);
|
|
1133
|
-
const handleMouseOutInput = (0,
|
|
1220
|
+
const handleMouseOutInput = (0, import_react19.useCallback)(() => {
|
|
1134
1221
|
setIsMouseOver(false);
|
|
1135
1222
|
}, []);
|
|
1136
|
-
const handleChange = (0,
|
|
1223
|
+
const handleChange = (0, import_react19.useCallback)(
|
|
1137
1224
|
(e) => !isDisabled && onChange?.(e),
|
|
1138
1225
|
[isDisabled, onChange]
|
|
1139
1226
|
);
|
|
@@ -1193,9 +1280,9 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
1193
1280
|
|
|
1194
1281
|
// src/search/search.tsx
|
|
1195
1282
|
var import_clsx20 = require("clsx");
|
|
1196
|
-
var
|
|
1283
|
+
var import_react20 = require("react");
|
|
1197
1284
|
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1198
|
-
var Search = (0,
|
|
1285
|
+
var Search = (0, import_react20.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
1199
1286
|
const classes = (0, import_clsx20.clsx)(
|
|
1200
1287
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
1201
1288
|
{ "h-8 px-3": size === "medium" },
|
|
@@ -1232,38 +1319,204 @@ var Search = (0, import_react19.forwardRef)(({ width = "100%", size = "medium",
|
|
|
1232
1319
|
});
|
|
1233
1320
|
Search.displayName = "Search";
|
|
1234
1321
|
|
|
1322
|
+
// src/segmented-control/segmented-control.tsx
|
|
1323
|
+
var import_react23 = __toESM(require("react"));
|
|
1324
|
+
|
|
1325
|
+
// src/segmented-control/segmented-control-context.ts
|
|
1326
|
+
var import_react21 = require("react");
|
|
1327
|
+
var SegmentedControlContext = (0, import_react21.createContext)(null);
|
|
1328
|
+
|
|
1329
|
+
// src/segmented-control/segmented-control-item.tsx
|
|
1330
|
+
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
1331
|
+
var import_clsx21 = require("clsx");
|
|
1332
|
+
var import_react22 = require("react");
|
|
1333
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1334
|
+
var SegmentedControlItem = ({
|
|
1335
|
+
label,
|
|
1336
|
+
value,
|
|
1337
|
+
icon,
|
|
1338
|
+
isDisabled: itemDisabled,
|
|
1339
|
+
"aria-label": ariaLabel,
|
|
1340
|
+
...rest
|
|
1341
|
+
}) => {
|
|
1342
|
+
const context = (0, import_react22.useContext)(SegmentedControlContext);
|
|
1343
|
+
const buttonRef = (0, import_react22.useRef)(null);
|
|
1344
|
+
const lastInteractionWasMouse = (0, import_react22.useRef)(false);
|
|
1345
|
+
if (context === null) {
|
|
1346
|
+
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
1347
|
+
}
|
|
1348
|
+
const {
|
|
1349
|
+
value: selectedValue,
|
|
1350
|
+
onChange,
|
|
1351
|
+
size,
|
|
1352
|
+
isDisabled: isContextDisabled,
|
|
1353
|
+
focusedValue,
|
|
1354
|
+
onFocusChange,
|
|
1355
|
+
onBlur
|
|
1356
|
+
} = context;
|
|
1357
|
+
const isSelected = value === selectedValue;
|
|
1358
|
+
const isFocused = value === focusedValue;
|
|
1359
|
+
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
1360
|
+
(0, import_react22.useEffect)(() => {
|
|
1361
|
+
if (isFocused === true && buttonRef.current !== null) {
|
|
1362
|
+
buttonRef.current.focus();
|
|
1363
|
+
}
|
|
1364
|
+
}, [isFocused]);
|
|
1365
|
+
const handleClick = () => {
|
|
1366
|
+
if (!isOptionDisabled) {
|
|
1367
|
+
onChange?.(value);
|
|
1368
|
+
}
|
|
1369
|
+
};
|
|
1370
|
+
const handleFocus = () => {
|
|
1371
|
+
if (!lastInteractionWasMouse.current && !isOptionDisabled) {
|
|
1372
|
+
onFocusChange?.(value);
|
|
1373
|
+
}
|
|
1374
|
+
};
|
|
1375
|
+
const handleMouseDown = () => {
|
|
1376
|
+
lastInteractionWasMouse.current = true;
|
|
1377
|
+
};
|
|
1378
|
+
const handleBlur = () => {
|
|
1379
|
+
lastInteractionWasMouse.current = false;
|
|
1380
|
+
onBlur?.();
|
|
1381
|
+
};
|
|
1382
|
+
const buttonClasses = (0, import_clsx21.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme14.focusVisible.normal, {
|
|
1383
|
+
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
1384
|
+
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
1385
|
+
// States - Default with hover
|
|
1386
|
+
"bg-transparent text-text01 hover:bg-hover02": isSelected === false && isOptionDisabled === false,
|
|
1387
|
+
// States - Selected
|
|
1388
|
+
"bg-uiBackground01 text-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1389
|
+
// States - Disabled
|
|
1390
|
+
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
1391
|
+
});
|
|
1392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
1393
|
+
"button",
|
|
1394
|
+
{
|
|
1395
|
+
ref: buttonRef,
|
|
1396
|
+
type: "button",
|
|
1397
|
+
role: "tab",
|
|
1398
|
+
"aria-selected": isSelected,
|
|
1399
|
+
"aria-label": ariaLabel,
|
|
1400
|
+
disabled: isOptionDisabled,
|
|
1401
|
+
tabIndex: isFocused === true || isSelected === true && focusedValue === null ? 0 : -1,
|
|
1402
|
+
className: buttonClasses,
|
|
1403
|
+
onClick: handleClick,
|
|
1404
|
+
onFocus: handleFocus,
|
|
1405
|
+
onBlur: handleBlur,
|
|
1406
|
+
onMouseDown: handleMouseDown,
|
|
1407
|
+
...rest,
|
|
1408
|
+
children: [
|
|
1409
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
1410
|
+
"span",
|
|
1411
|
+
{
|
|
1412
|
+
className: (0, import_clsx21.clsx)("flex items-center", {
|
|
1413
|
+
"fill-disabled01": isOptionDisabled === true,
|
|
1414
|
+
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1415
|
+
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
1416
|
+
}),
|
|
1417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: icon, size: "small" })
|
|
1418
|
+
}
|
|
1419
|
+
),
|
|
1420
|
+
Boolean(label) === true && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
1421
|
+
]
|
|
1422
|
+
}
|
|
1423
|
+
);
|
|
1424
|
+
};
|
|
1425
|
+
|
|
1426
|
+
// src/segmented-control/segmented-control.tsx
|
|
1427
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1428
|
+
var SegmentedControl = ({
|
|
1429
|
+
children,
|
|
1430
|
+
value,
|
|
1431
|
+
onChange,
|
|
1432
|
+
size = "medium",
|
|
1433
|
+
isDisabled = false,
|
|
1434
|
+
"aria-label": ariaLabel,
|
|
1435
|
+
...rest
|
|
1436
|
+
}) => {
|
|
1437
|
+
const containerRef = (0, import_react23.useRef)(null);
|
|
1438
|
+
const itemIds = import_react23.Children.toArray(children).filter((child) => {
|
|
1439
|
+
if (!import_react23.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
1440
|
+
return false;
|
|
1441
|
+
}
|
|
1442
|
+
const props = child.props;
|
|
1443
|
+
return props.isDisabled !== true;
|
|
1444
|
+
}).map((child) => child.props.value);
|
|
1445
|
+
const childrenCount = import_react23.Children.count(children);
|
|
1446
|
+
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
1447
|
+
const {
|
|
1448
|
+
focusedValue,
|
|
1449
|
+
handleFocusChange,
|
|
1450
|
+
handleKeyDown,
|
|
1451
|
+
handleBlur: handleBlurRovingFocus
|
|
1452
|
+
} = useRovingFocus({
|
|
1453
|
+
values: itemIds,
|
|
1454
|
+
isDisabled
|
|
1455
|
+
});
|
|
1456
|
+
const handleFocusAndChange = (newValue) => {
|
|
1457
|
+
handleFocusChange(newValue);
|
|
1458
|
+
if (!isDisabled && typeof onChange === "function" && newValue !== value) {
|
|
1459
|
+
onChange(newValue);
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
const contextValue = {
|
|
1463
|
+
value,
|
|
1464
|
+
onChange,
|
|
1465
|
+
size,
|
|
1466
|
+
isDisabled,
|
|
1467
|
+
focusedValue,
|
|
1468
|
+
onFocusChange: handleFocusAndChange,
|
|
1469
|
+
onBlur: handleBlurRovingFocus,
|
|
1470
|
+
values: itemIds
|
|
1471
|
+
};
|
|
1472
|
+
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)(
|
|
1473
|
+
"div",
|
|
1474
|
+
{
|
|
1475
|
+
ref: containerRef,
|
|
1476
|
+
className: "grid gap-1 rounded-lg bg-uiBackground02 p-1",
|
|
1477
|
+
style: containerStyle,
|
|
1478
|
+
role: "tablist",
|
|
1479
|
+
"aria-label": ariaLabel,
|
|
1480
|
+
onKeyDown: handleKeyDown,
|
|
1481
|
+
...rest,
|
|
1482
|
+
children
|
|
1483
|
+
}
|
|
1484
|
+
) }) });
|
|
1485
|
+
};
|
|
1486
|
+
SegmentedControl.Item = SegmentedControlItem;
|
|
1487
|
+
|
|
1235
1488
|
// src/select-sort/select-sort.tsx
|
|
1489
|
+
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
1490
|
+
var import_clsx24 = __toESM(require("clsx"));
|
|
1491
|
+
var import_react24 = require("react");
|
|
1492
|
+
|
|
1493
|
+
// src/select-sort/select-list.tsx
|
|
1236
1494
|
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
1237
1495
|
var import_clsx23 = __toESM(require("clsx"));
|
|
1238
|
-
var import_react20 = require("react");
|
|
1239
1496
|
|
|
1240
|
-
// src/select-sort/select-
|
|
1497
|
+
// src/select-sort/select-item.tsx
|
|
1241
1498
|
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
1242
1499
|
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");
|
|
1500
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1248
1501
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
1249
|
-
const itemClasses = (0,
|
|
1502
|
+
const itemClasses = (0, import_clsx22.default)(
|
|
1250
1503
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1251
|
-
|
|
1504
|
+
import_component_theme15.focusVisible.inset,
|
|
1252
1505
|
{
|
|
1253
1506
|
"bg-selectedUi fill-interactive01 text-interactive01": isSortKey,
|
|
1254
1507
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
1255
1508
|
}
|
|
1256
1509
|
);
|
|
1257
|
-
return /* @__PURE__ */ (0,
|
|
1258
|
-
/* @__PURE__ */ (0,
|
|
1259
|
-
isSortKey && /* @__PURE__ */ (0,
|
|
1510
|
+
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: [
|
|
1511
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "ml-1 mr-6", children }),
|
|
1512
|
+
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
1513
|
] }) });
|
|
1261
1514
|
}
|
|
1262
1515
|
|
|
1263
1516
|
// src/select-sort/select-list.tsx
|
|
1264
|
-
var
|
|
1517
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1265
1518
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
1266
|
-
const listClasses = (0,
|
|
1519
|
+
const listClasses = (0, import_clsx23.default)(
|
|
1267
1520
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
1268
1521
|
{
|
|
1269
1522
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -1272,19 +1525,19 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
1272
1525
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1273
1526
|
}
|
|
1274
1527
|
);
|
|
1275
|
-
const deselectButtonClasses = (0,
|
|
1528
|
+
const deselectButtonClasses = (0, import_clsx23.default)(
|
|
1276
1529
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1277
|
-
|
|
1530
|
+
import_component_theme16.focusVisible.inset
|
|
1278
1531
|
);
|
|
1279
|
-
return /* @__PURE__ */ (0,
|
|
1280
|
-
/* @__PURE__ */ (0,
|
|
1281
|
-
/* @__PURE__ */ (0,
|
|
1282
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0,
|
|
1532
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("ul", { className: listClasses, children: [
|
|
1533
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1534
|
+
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
1535
|
+
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
1536
|
] });
|
|
1284
1537
|
}
|
|
1285
1538
|
|
|
1286
1539
|
// src/select-sort/select-sort.tsx
|
|
1287
|
-
var
|
|
1540
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1288
1541
|
function SelectSort({
|
|
1289
1542
|
size = "medium",
|
|
1290
1543
|
variant = "outline",
|
|
@@ -1296,54 +1549,54 @@ function SelectSort({
|
|
|
1296
1549
|
onChange,
|
|
1297
1550
|
onClickDeselect
|
|
1298
1551
|
}) {
|
|
1299
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
1300
|
-
const targetRef = (0,
|
|
1552
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react24.useState)(false);
|
|
1553
|
+
const targetRef = (0, import_react24.useRef)(null);
|
|
1301
1554
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1302
1555
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1303
|
-
const handleClickItem = (0,
|
|
1556
|
+
const handleClickItem = (0, import_react24.useCallback)(
|
|
1304
1557
|
(value) => {
|
|
1305
1558
|
onChange?.(value);
|
|
1306
1559
|
setIsOptionListOpen(false);
|
|
1307
1560
|
},
|
|
1308
1561
|
[onChange]
|
|
1309
1562
|
);
|
|
1310
|
-
const wrapperClasses = (0,
|
|
1563
|
+
const wrapperClasses = (0, import_clsx24.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1311
1564
|
"h-6": size === "x-small" || size === "small",
|
|
1312
1565
|
"h-8": size === "medium",
|
|
1313
1566
|
"h-10": size === "large",
|
|
1314
1567
|
"cursor-not-allowed": isDisabled
|
|
1315
1568
|
});
|
|
1316
|
-
const buttonClasses = (0,
|
|
1569
|
+
const buttonClasses = (0, import_clsx24.default)(
|
|
1317
1570
|
"flex size-full items-center rounded",
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1571
|
+
import_component_theme17.buttonColors[variant].hover,
|
|
1572
|
+
import_component_theme17.buttonColors[variant].active,
|
|
1573
|
+
import_component_theme17.buttonColors[variant].disabled,
|
|
1574
|
+
import_component_theme17.focusVisible.normal,
|
|
1322
1575
|
{
|
|
1323
|
-
[
|
|
1324
|
-
[
|
|
1576
|
+
[import_component_theme17.buttonColors[variant].selected]: isSortKey,
|
|
1577
|
+
[import_component_theme17.buttonColors[variant].base]: !isSortKey,
|
|
1325
1578
|
"px-2": size === "x-small" || size === "small",
|
|
1326
1579
|
"px-4": size === "medium" || size === "large",
|
|
1327
1580
|
"pointer-events-none": isDisabled
|
|
1328
1581
|
}
|
|
1329
1582
|
);
|
|
1330
|
-
const labelClasses = (0,
|
|
1583
|
+
const labelClasses = (0, import_clsx24.default)("truncate", {
|
|
1331
1584
|
"typography-label12regular": size === "x-small",
|
|
1332
1585
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1333
1586
|
"typography-label16regular": size === "large",
|
|
1334
1587
|
"mr-1": size === "x-small",
|
|
1335
1588
|
"mr-2": size !== "x-small"
|
|
1336
1589
|
});
|
|
1337
|
-
return /* @__PURE__ */ (0,
|
|
1338
|
-
/* @__PURE__ */ (0,
|
|
1339
|
-
/* @__PURE__ */ (0,
|
|
1340
|
-
/* @__PURE__ */ (0,
|
|
1590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
1591
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
1592
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: labelClasses, children: label }),
|
|
1593
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1341
1594
|
Icon,
|
|
1342
1595
|
{
|
|
1343
1596
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
1344
1597
|
size: size === "large" ? "medium" : "small"
|
|
1345
1598
|
}
|
|
1346
|
-
) : /* @__PURE__ */ (0,
|
|
1599
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1347
1600
|
Icon,
|
|
1348
1601
|
{
|
|
1349
1602
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1351,7 +1604,7 @@ function SelectSort({
|
|
|
1351
1604
|
}
|
|
1352
1605
|
) })
|
|
1353
1606
|
] }),
|
|
1354
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
1607
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
1355
1608
|
SelectList2,
|
|
1356
1609
|
{
|
|
1357
1610
|
size,
|
|
@@ -1364,12 +1617,87 @@ function SelectSort({
|
|
|
1364
1617
|
] });
|
|
1365
1618
|
}
|
|
1366
1619
|
|
|
1620
|
+
// src/sort-button/sort-button.tsx
|
|
1621
|
+
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
1622
|
+
var import_clsx25 = __toESM(require("clsx"));
|
|
1623
|
+
var import_react25 = require("react");
|
|
1624
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1625
|
+
function SortButton({
|
|
1626
|
+
size = "medium",
|
|
1627
|
+
width,
|
|
1628
|
+
label,
|
|
1629
|
+
sortOrder,
|
|
1630
|
+
isDisabled = false,
|
|
1631
|
+
onClick,
|
|
1632
|
+
"aria-label": ariaLabel,
|
|
1633
|
+
...rest
|
|
1634
|
+
}) {
|
|
1635
|
+
const handleClick = (0, import_react25.useCallback)(() => {
|
|
1636
|
+
if (isDisabled || !onClick) return;
|
|
1637
|
+
onClick();
|
|
1638
|
+
}, [isDisabled, onClick]);
|
|
1639
|
+
const getIconName = () => {
|
|
1640
|
+
if (sortOrder === "ascend") return "arrow-up";
|
|
1641
|
+
if (sortOrder === "descend") return "arrow-down";
|
|
1642
|
+
return "angle-small-down";
|
|
1643
|
+
};
|
|
1644
|
+
const wrapperClasses = (0, import_clsx25.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1645
|
+
"h-6": size === "x-small" || size === "small",
|
|
1646
|
+
"h-8": size === "medium",
|
|
1647
|
+
"h-10": size === "large",
|
|
1648
|
+
"cursor-not-allowed": isDisabled
|
|
1649
|
+
});
|
|
1650
|
+
const buttonClasses = (0, import_clsx25.default)(
|
|
1651
|
+
"flex size-full items-center rounded",
|
|
1652
|
+
import_component_theme18.buttonColors.text.hover,
|
|
1653
|
+
import_component_theme18.buttonColors.text.active,
|
|
1654
|
+
import_component_theme18.buttonColors.text.disabled,
|
|
1655
|
+
import_component_theme18.focusVisible.normal,
|
|
1656
|
+
{
|
|
1657
|
+
[import_component_theme18.buttonColors.text.selected]: !isDisabled && sortOrder !== null,
|
|
1658
|
+
// ソート状態時は選択状態のスタイル
|
|
1659
|
+
[import_component_theme18.buttonColors.text.base]: sortOrder === null,
|
|
1660
|
+
// ソートなし時は通常のスタイル
|
|
1661
|
+
"px-2": size === "x-small" || size === "small",
|
|
1662
|
+
"px-4": size === "medium" || size === "large",
|
|
1663
|
+
"pointer-events-none": isDisabled
|
|
1664
|
+
}
|
|
1665
|
+
);
|
|
1666
|
+
const labelClasses = (0, import_clsx25.default)("truncate", {
|
|
1667
|
+
"typography-label12regular": size === "x-small",
|
|
1668
|
+
"typography-label14regular": size === "small" || size === "medium",
|
|
1669
|
+
"typography-label16regular": size === "large",
|
|
1670
|
+
"mr-1": size === "x-small",
|
|
1671
|
+
"mr-2": size !== "x-small"
|
|
1672
|
+
});
|
|
1673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
1674
|
+
"button",
|
|
1675
|
+
{
|
|
1676
|
+
className: buttonClasses,
|
|
1677
|
+
...rest,
|
|
1678
|
+
type: "button",
|
|
1679
|
+
onClick: handleClick,
|
|
1680
|
+
disabled: isDisabled,
|
|
1681
|
+
"aria-label": ariaLabel,
|
|
1682
|
+
"aria-disabled": isDisabled,
|
|
1683
|
+
children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: labelClasses, children: label }),
|
|
1685
|
+
/* @__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" }) })
|
|
1686
|
+
]
|
|
1687
|
+
}
|
|
1688
|
+
) });
|
|
1689
|
+
}
|
|
1690
|
+
|
|
1691
|
+
// src/tab/tab.tsx
|
|
1692
|
+
var import_clsx27 = require("clsx");
|
|
1693
|
+
var import_react26 = require("react");
|
|
1694
|
+
|
|
1367
1695
|
// src/tab/tab-item.tsx
|
|
1368
|
-
var
|
|
1369
|
-
var
|
|
1696
|
+
var import_clsx26 = require("clsx");
|
|
1697
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1370
1698
|
var TabItem = ({ isSelected = false, ...props }) => {
|
|
1371
|
-
const classes = (0,
|
|
1372
|
-
"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",
|
|
1699
|
+
const classes = (0, import_clsx26.clsx)(
|
|
1700
|
+
"relative z-0 flex justify-center py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-px hover:text-text01 disabled:pointer-events-none disabled:text-disabled01",
|
|
1373
1701
|
{
|
|
1374
1702
|
"typography-label14regular": !isSelected,
|
|
1375
1703
|
"text-interactive02 hover:before:bg-uiBorder04": !isSelected,
|
|
@@ -1377,7 +1705,7 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1377
1705
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
1378
1706
|
}
|
|
1379
1707
|
);
|
|
1380
|
-
return /* @__PURE__ */ (0,
|
|
1708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1381
1709
|
"button",
|
|
1382
1710
|
{
|
|
1383
1711
|
type: "button",
|
|
@@ -1392,37 +1720,39 @@ var TabItem = ({ isSelected = false, ...props }) => {
|
|
|
1392
1720
|
};
|
|
1393
1721
|
|
|
1394
1722
|
// src/tab/tab.tsx
|
|
1395
|
-
var
|
|
1396
|
-
function Tab({ children }) {
|
|
1397
|
-
|
|
1398
|
-
|
|
1723
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1724
|
+
function Tab({ children, layout = "auto" }) {
|
|
1725
|
+
const childrenCount = import_react26.Children.count(children);
|
|
1726
|
+
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
1727
|
+
const containerClasses = (0, import_clsx27.clsx)(
|
|
1728
|
+
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
1399
1729
|
{
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
children
|
|
1730
|
+
flex: layout === "auto",
|
|
1731
|
+
grid: layout === "equal"
|
|
1403
1732
|
}
|
|
1404
1733
|
);
|
|
1734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
1405
1735
|
}
|
|
1406
1736
|
Tab.Item = TabItem;
|
|
1407
1737
|
|
|
1408
1738
|
// src/table/table-cell.tsx
|
|
1409
|
-
var
|
|
1410
|
-
var
|
|
1739
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
1740
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1411
1741
|
function TableCell({ children, className, isHeader = false }) {
|
|
1412
|
-
const classes = (0,
|
|
1413
|
-
return /* @__PURE__ */ (0,
|
|
1742
|
+
const classes = (0, import_clsx28.default)("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
1743
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: classes, children });
|
|
1414
1744
|
}
|
|
1415
1745
|
|
|
1416
1746
|
// src/table/table-row.tsx
|
|
1417
|
-
var
|
|
1418
|
-
var
|
|
1747
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
1748
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1419
1749
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
1420
|
-
const rowClasses = (0,
|
|
1421
|
-
return /* @__PURE__ */ (0,
|
|
1750
|
+
const rowClasses = (0, import_clsx29.default)("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
1751
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: rowClasses, children });
|
|
1422
1752
|
}
|
|
1423
1753
|
|
|
1424
1754
|
// src/table/table.tsx
|
|
1425
|
-
var
|
|
1755
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1426
1756
|
function Table({
|
|
1427
1757
|
width,
|
|
1428
1758
|
templateRows,
|
|
@@ -1431,7 +1761,7 @@ function Table({
|
|
|
1431
1761
|
autoRows,
|
|
1432
1762
|
children
|
|
1433
1763
|
}) {
|
|
1434
|
-
return /* @__PURE__ */ (0,
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1435
1765
|
"div",
|
|
1436
1766
|
{
|
|
1437
1767
|
className: "grid",
|
|
@@ -1450,23 +1780,23 @@ Table.Row = TableRow;
|
|
|
1450
1780
|
Table.Cell = TableCell;
|
|
1451
1781
|
|
|
1452
1782
|
// src/tag/tag.tsx
|
|
1453
|
-
var
|
|
1454
|
-
var
|
|
1783
|
+
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
1784
|
+
var import_clsx31 = __toESM(require("clsx"));
|
|
1455
1785
|
|
|
1456
1786
|
// src/tag/delete-icon.tsx
|
|
1457
|
-
var
|
|
1458
|
-
var
|
|
1459
|
-
var
|
|
1787
|
+
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
1788
|
+
var import_clsx30 = __toESM(require("clsx"));
|
|
1789
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1460
1790
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
1461
|
-
const deleteButtonClasses = (0,
|
|
1791
|
+
const deleteButtonClasses = (0, import_clsx30.default)(
|
|
1462
1792
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
1463
|
-
|
|
1793
|
+
import_component_theme19.focusVisible.normal
|
|
1464
1794
|
);
|
|
1465
|
-
const deletePathClasses = (0,
|
|
1795
|
+
const deletePathClasses = (0, import_clsx30.default)({
|
|
1466
1796
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
1467
1797
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
1468
1798
|
});
|
|
1469
|
-
return /* @__PURE__ */ (0,
|
|
1799
|
+
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
1800
|
"path",
|
|
1471
1801
|
{
|
|
1472
1802
|
fillRule: "evenodd",
|
|
@@ -1478,11 +1808,11 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
1478
1808
|
};
|
|
1479
1809
|
|
|
1480
1810
|
// src/tag/tag.tsx
|
|
1481
|
-
var
|
|
1811
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1482
1812
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
1483
|
-
const wrapperClasses = (0,
|
|
1484
|
-
[
|
|
1485
|
-
[
|
|
1813
|
+
const wrapperClasses = (0, import_clsx31.default)("flex", "items-center", "justify-center", {
|
|
1814
|
+
[import_component_theme20.tagColors[color]]: variant === "normal",
|
|
1815
|
+
[import_component_theme20.tagLightColors[color]]: variant === "light",
|
|
1486
1816
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
1487
1817
|
"h-4 typography-label12regular": !isEditable && size === "small",
|
|
1488
1818
|
"h-[18px] typography-label14regular": !isEditable && size === "medium",
|
|
@@ -1492,17 +1822,17 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
1492
1822
|
"py-0.5 px-1": !isEditable,
|
|
1493
1823
|
"py-1 px-2": isEditable
|
|
1494
1824
|
});
|
|
1495
|
-
return /* @__PURE__ */ (0,
|
|
1825
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: wrapperClasses, children: [
|
|
1496
1826
|
children,
|
|
1497
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
1827
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
1498
1828
|
] });
|
|
1499
1829
|
}
|
|
1500
1830
|
|
|
1501
1831
|
// src/text-area/text-area.tsx
|
|
1502
|
-
var
|
|
1503
|
-
var
|
|
1504
|
-
var
|
|
1505
|
-
var TextArea = (0,
|
|
1832
|
+
var import_clsx32 = require("clsx");
|
|
1833
|
+
var import_react27 = require("react");
|
|
1834
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1835
|
+
var TextArea = (0, import_react27.forwardRef)(
|
|
1506
1836
|
({
|
|
1507
1837
|
size = "medium",
|
|
1508
1838
|
isResizable = false,
|
|
@@ -1513,7 +1843,7 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1513
1843
|
height,
|
|
1514
1844
|
...props
|
|
1515
1845
|
}, ref) => {
|
|
1516
|
-
const classes = (0,
|
|
1846
|
+
const classes = (0, import_clsx32.clsx)(
|
|
1517
1847
|
"w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
1518
1848
|
{
|
|
1519
1849
|
"border-supportError": isError && !disabled,
|
|
@@ -1527,7 +1857,7 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1527
1857
|
"resize-none": !isResizable
|
|
1528
1858
|
}
|
|
1529
1859
|
);
|
|
1530
|
-
return /* @__PURE__ */ (0,
|
|
1860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
1531
1861
|
"textarea",
|
|
1532
1862
|
{
|
|
1533
1863
|
ref,
|
|
@@ -1548,13 +1878,13 @@ var TextArea = (0, import_react21.forwardRef)(
|
|
|
1548
1878
|
TextArea.displayName = "TextArea";
|
|
1549
1879
|
|
|
1550
1880
|
// src/text-input/text-input.tsx
|
|
1551
|
-
var
|
|
1552
|
-
var
|
|
1553
|
-
var
|
|
1554
|
-
var TextInput = (0,
|
|
1881
|
+
var import_clsx33 = require("clsx");
|
|
1882
|
+
var import_react28 = require("react");
|
|
1883
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1884
|
+
var TextInput = (0, import_react28.forwardRef)(
|
|
1555
1885
|
({ size = "medium", isError = false, disabled = false, onClickClearButton, ...props }, ref) => {
|
|
1556
1886
|
const isShowClearButton = !!onClickClearButton && props.value.length !== 0 && !disabled;
|
|
1557
|
-
const inputWrapClasses = (0,
|
|
1887
|
+
const inputWrapClasses = (0, import_clsx33.clsx)("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1558
1888
|
"border-uiBorder02": !isError && !disabled,
|
|
1559
1889
|
"border-supportError": isError && !disabled,
|
|
1560
1890
|
"hover:border-hoverInput": !disabled && !isError,
|
|
@@ -1564,25 +1894,25 @@ var TextInput = (0, import_react22.forwardRef)(
|
|
|
1564
1894
|
"pr-2": size === "medium" && isShowClearButton,
|
|
1565
1895
|
"pr-3": size === "large" && isShowClearButton
|
|
1566
1896
|
});
|
|
1567
|
-
const inputClasses = (0,
|
|
1897
|
+
const inputClasses = (0, import_clsx33.clsx)("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1568
1898
|
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1569
1899
|
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1570
1900
|
"text-text01": !isError,
|
|
1571
1901
|
"text-supportError": isError,
|
|
1572
1902
|
"pr-0": isShowClearButton
|
|
1573
1903
|
});
|
|
1574
|
-
return /* @__PURE__ */ (0,
|
|
1575
|
-
/* @__PURE__ */ (0,
|
|
1576
|
-
isShowClearButton && /* @__PURE__ */ (0,
|
|
1904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: inputWrapClasses, children: [
|
|
1905
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)("input", { ref, size: 1, className: inputClasses, disabled, onChange: props.onChange, ...props }),
|
|
1906
|
+
isShowClearButton && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1577
1907
|
] });
|
|
1578
1908
|
}
|
|
1579
1909
|
);
|
|
1580
1910
|
TextInput.displayName = "TextInput";
|
|
1581
1911
|
|
|
1582
1912
|
// src/toast/toast.tsx
|
|
1583
|
-
var
|
|
1584
|
-
var
|
|
1585
|
-
var
|
|
1913
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
1914
|
+
var import_react29 = require("react");
|
|
1915
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1586
1916
|
var CLOSE_TIME_MSEC = 5e3;
|
|
1587
1917
|
function Toast({
|
|
1588
1918
|
state = "information",
|
|
@@ -1592,8 +1922,8 @@ function Toast({
|
|
|
1592
1922
|
children,
|
|
1593
1923
|
onClickClose
|
|
1594
1924
|
}) {
|
|
1595
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
1596
|
-
const handleClose = (0,
|
|
1925
|
+
const [isRemoving, setIsRemoving] = (0, import_react29.useState)(false);
|
|
1926
|
+
const handleClose = (0, import_react29.useCallback)(() => {
|
|
1597
1927
|
if (isAnimation) {
|
|
1598
1928
|
setIsRemoving(true);
|
|
1599
1929
|
} else {
|
|
@@ -1601,17 +1931,17 @@ function Toast({
|
|
|
1601
1931
|
}
|
|
1602
1932
|
}, [isAnimation, onClickClose]);
|
|
1603
1933
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
1604
|
-
const wrapperClasses = (0,
|
|
1934
|
+
const wrapperClasses = (0, import_clsx34.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
1605
1935
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
1606
1936
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
1607
1937
|
});
|
|
1608
|
-
const iconClasses = (0,
|
|
1938
|
+
const iconClasses = (0, import_clsx34.default)("flex items-center", {
|
|
1609
1939
|
"fill-supportSuccess": state === "success",
|
|
1610
1940
|
"fill-supportError": state === "error",
|
|
1611
1941
|
"fill-supportWarning": state === "warning",
|
|
1612
1942
|
"fill-supportInfo": state === "information"
|
|
1613
1943
|
});
|
|
1614
|
-
const textClasses = (0,
|
|
1944
|
+
const textClasses = (0, import_clsx34.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
1615
1945
|
"text-supportError": state === "error",
|
|
1616
1946
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
1617
1947
|
});
|
|
@@ -1621,7 +1951,7 @@ function Toast({
|
|
|
1621
1951
|
warning: "warning",
|
|
1622
1952
|
information: "information-filled"
|
|
1623
1953
|
};
|
|
1624
|
-
(0,
|
|
1954
|
+
(0, import_react29.useEffect)(() => {
|
|
1625
1955
|
const timer = window.setTimeout(() => {
|
|
1626
1956
|
if (isAutoClose) {
|
|
1627
1957
|
setIsRemoving(true);
|
|
@@ -1629,45 +1959,45 @@ function Toast({
|
|
|
1629
1959
|
}, CLOSE_TIME_MSEC);
|
|
1630
1960
|
return () => window.clearTimeout(timer);
|
|
1631
1961
|
}, [isAutoClose]);
|
|
1632
|
-
return /* @__PURE__ */ (0,
|
|
1633
|
-
/* @__PURE__ */ (0,
|
|
1634
|
-
/* @__PURE__ */ (0,
|
|
1635
|
-
/* @__PURE__ */ (0,
|
|
1962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
1963
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Icon, { name: iconName[state] }) }),
|
|
1964
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("p", { className: textClasses, children }),
|
|
1965
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
1636
1966
|
] });
|
|
1637
1967
|
}
|
|
1638
1968
|
|
|
1639
1969
|
// src/toast/toast-provider.tsx
|
|
1640
|
-
var
|
|
1970
|
+
var import_react30 = require("react");
|
|
1641
1971
|
var import_react_dom3 = require("react-dom");
|
|
1642
|
-
var
|
|
1643
|
-
var ToastContext = (0,
|
|
1972
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1973
|
+
var ToastContext = (0, import_react30.createContext)({});
|
|
1644
1974
|
var ToastProvider = ({ children }) => {
|
|
1645
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
1646
|
-
const [toasts, setToasts] = (0,
|
|
1647
|
-
const addToast = (0,
|
|
1975
|
+
const [isClientRender, setIsClientRender] = (0, import_react30.useState)(false);
|
|
1976
|
+
const [toasts, setToasts] = (0, import_react30.useState)([]);
|
|
1977
|
+
const addToast = (0, import_react30.useCallback)(({ message, state }) => {
|
|
1648
1978
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
1649
1979
|
}, []);
|
|
1650
|
-
const removeToast = (0,
|
|
1980
|
+
const removeToast = (0, import_react30.useCallback)((id) => {
|
|
1651
1981
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
1652
1982
|
}, []);
|
|
1653
|
-
(0,
|
|
1983
|
+
(0, import_react30.useEffect)(() => {
|
|
1654
1984
|
setIsClientRender(true);
|
|
1655
1985
|
}, []);
|
|
1656
|
-
return /* @__PURE__ */ (0,
|
|
1986
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
1657
1987
|
children,
|
|
1658
1988
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
1659
|
-
/* @__PURE__ */ (0,
|
|
1989
|
+
/* @__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
1990
|
document.body
|
|
1661
1991
|
)
|
|
1662
1992
|
] });
|
|
1663
1993
|
};
|
|
1664
1994
|
var useToast = () => {
|
|
1665
|
-
return (0,
|
|
1995
|
+
return (0, import_react30.useContext)(ToastContext);
|
|
1666
1996
|
};
|
|
1667
1997
|
|
|
1668
1998
|
// src/toggle/toggle.tsx
|
|
1669
|
-
var
|
|
1670
|
-
var
|
|
1999
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
2000
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
1671
2001
|
function Toggle({
|
|
1672
2002
|
id,
|
|
1673
2003
|
size = "medium",
|
|
@@ -1677,7 +2007,7 @@ function Toggle({
|
|
|
1677
2007
|
labelPosition = "right",
|
|
1678
2008
|
isDisabled = false
|
|
1679
2009
|
}) {
|
|
1680
|
-
const baseClasses = (0,
|
|
2010
|
+
const baseClasses = (0, import_clsx35.default)("relative flex items-center rounded-full", {
|
|
1681
2011
|
"bg-disabledOn": isDisabled && isChecked,
|
|
1682
2012
|
"bg-disabled01": isDisabled && !isChecked,
|
|
1683
2013
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -1685,16 +2015,16 @@ function Toggle({
|
|
|
1685
2015
|
"w-8 h-4 px-[3px]": size === "small",
|
|
1686
2016
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
1687
2017
|
});
|
|
1688
|
-
const inputClasses = (0,
|
|
2018
|
+
const inputClasses = (0, import_clsx35.default)(
|
|
1689
2019
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
1690
2020
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
1691
2021
|
);
|
|
1692
|
-
const indicatorClasses = (0,
|
|
2022
|
+
const indicatorClasses = (0, import_clsx35.default)("rounded-full bg-iconOnColor", {
|
|
1693
2023
|
"w-2.5 h-2.5": size === "small",
|
|
1694
2024
|
"w-4 h-4": size === "medium" || size === "large",
|
|
1695
2025
|
"ml-auto": isChecked
|
|
1696
2026
|
});
|
|
1697
|
-
const labelClasses = (0,
|
|
2027
|
+
const labelClasses = (0, import_clsx35.default)("break-all", {
|
|
1698
2028
|
"mr-2": labelPosition === "left",
|
|
1699
2029
|
"ml-2": labelPosition === "right",
|
|
1700
2030
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -1702,9 +2032,9 @@ function Toggle({
|
|
|
1702
2032
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1703
2033
|
"cursor-pointer text-text01": !isDisabled
|
|
1704
2034
|
});
|
|
1705
|
-
return /* @__PURE__ */ (0,
|
|
1706
|
-
label != null && labelPosition === "left" && /* @__PURE__ */ (0,
|
|
1707
|
-
/* @__PURE__ */ (0,
|
|
2035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
2036
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
2037
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
|
|
1708
2038
|
"input",
|
|
1709
2039
|
{
|
|
1710
2040
|
className: inputClasses,
|
|
@@ -1716,77 +2046,23 @@ function Toggle({
|
|
|
1716
2046
|
disabled: isDisabled
|
|
1717
2047
|
}
|
|
1718
2048
|
),
|
|
1719
|
-
/* @__PURE__ */ (0,
|
|
1720
|
-
label != null && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2049
|
+
/* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: baseClasses, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: indicatorClasses }) }),
|
|
2050
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1721
2051
|
] });
|
|
1722
2052
|
}
|
|
1723
2053
|
|
|
1724
2054
|
// src/tooltip/tooltip.tsx
|
|
1725
|
-
var
|
|
2055
|
+
var import_react32 = require("react");
|
|
1726
2056
|
var import_react_dom4 = require("react-dom");
|
|
1727
2057
|
|
|
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
2058
|
// src/tooltip/tooltip-content.tsx
|
|
1783
|
-
var
|
|
2059
|
+
var import_clsx37 = __toESM(require("clsx"));
|
|
1784
2060
|
|
|
1785
2061
|
// src/tooltip/tail-icon.tsx
|
|
1786
|
-
var
|
|
1787
|
-
var
|
|
2062
|
+
var import_clsx36 = __toESM(require("clsx"));
|
|
2063
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
1788
2064
|
var TailIcon = (props) => {
|
|
1789
|
-
const tailClasses = (0,
|
|
2065
|
+
const tailClasses = (0, import_clsx36.default)("absolute fill-uiBackgroundTooltip", {
|
|
1790
2066
|
"rotate-180": props.verticalPosition === "bottom",
|
|
1791
2067
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
1792
2068
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -1801,9 +2077,9 @@ var TailIcon = (props) => {
|
|
|
1801
2077
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
1802
2078
|
});
|
|
1803
2079
|
if (props.size === "small") {
|
|
1804
|
-
return /* @__PURE__ */ (0,
|
|
2080
|
+
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
2081
|
} else {
|
|
1806
|
-
return /* @__PURE__ */ (0,
|
|
2082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
|
|
1807
2083
|
"svg",
|
|
1808
2084
|
{
|
|
1809
2085
|
className: tailClasses,
|
|
@@ -1812,14 +2088,14 @@ var TailIcon = (props) => {
|
|
|
1812
2088
|
viewBox: "0 0 14 8",
|
|
1813
2089
|
fill: "none",
|
|
1814
2090
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1815
|
-
children: /* @__PURE__ */ (0,
|
|
2091
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
1816
2092
|
}
|
|
1817
2093
|
);
|
|
1818
2094
|
}
|
|
1819
2095
|
};
|
|
1820
2096
|
|
|
1821
2097
|
// src/tooltip/tooltip-content.tsx
|
|
1822
|
-
var
|
|
2098
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1823
2099
|
var TooltipContent = ({
|
|
1824
2100
|
content,
|
|
1825
2101
|
horizontalAlign,
|
|
@@ -1829,7 +2105,7 @@ var TooltipContent = ({
|
|
|
1829
2105
|
maxWidth,
|
|
1830
2106
|
isPortal = false
|
|
1831
2107
|
}) => {
|
|
1832
|
-
const tooltipWrapperClasses = (0,
|
|
2108
|
+
const tooltipWrapperClasses = (0, import_clsx37.default)("absolute z-tooltip m-auto flex", {
|
|
1833
2109
|
"top-0": !isPortal && verticalPosition === "top",
|
|
1834
2110
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
1835
2111
|
"justify-start": horizontalAlign === "left",
|
|
@@ -1838,7 +2114,7 @@ var TooltipContent = ({
|
|
|
1838
2114
|
"w-[24px]": size === "small",
|
|
1839
2115
|
"w-[46px]": size !== "small"
|
|
1840
2116
|
});
|
|
1841
|
-
const tooltipBodyClasses = (0,
|
|
2117
|
+
const tooltipBodyClasses = (0, import_clsx37.default)(
|
|
1842
2118
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
1843
2119
|
{
|
|
1844
2120
|
"typography-body12regular": size === "small",
|
|
@@ -1855,7 +2131,7 @@ var TooltipContent = ({
|
|
|
1855
2131
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
1856
2132
|
...tooltipPosition
|
|
1857
2133
|
} : {};
|
|
1858
|
-
return /* @__PURE__ */ (0,
|
|
2134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
|
|
1859
2135
|
"div",
|
|
1860
2136
|
{
|
|
1861
2137
|
className: tooltipBodyClasses,
|
|
@@ -1864,14 +2140,68 @@ var TooltipContent = ({
|
|
|
1864
2140
|
},
|
|
1865
2141
|
children: [
|
|
1866
2142
|
content,
|
|
1867
|
-
/* @__PURE__ */ (0,
|
|
2143
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
1868
2144
|
]
|
|
1869
2145
|
}
|
|
1870
2146
|
) });
|
|
1871
2147
|
};
|
|
1872
2148
|
|
|
2149
|
+
// src/tooltip/tooltip-hook.ts
|
|
2150
|
+
var import_react31 = require("react");
|
|
2151
|
+
var useTooltip = () => {
|
|
2152
|
+
const calculatePosition = (0, import_react31.useCallback)(
|
|
2153
|
+
(args) => {
|
|
2154
|
+
const result = {
|
|
2155
|
+
maxWidth: "none",
|
|
2156
|
+
width: "auto",
|
|
2157
|
+
left: "0px",
|
|
2158
|
+
top: "0px",
|
|
2159
|
+
bottom: "0px",
|
|
2160
|
+
translateX: "0",
|
|
2161
|
+
translateY: "0"
|
|
2162
|
+
};
|
|
2163
|
+
result.maxWidth = args.maxWidth ?? "none";
|
|
2164
|
+
const offsetH = args.tooltipSize === "small" ? 11 : 22;
|
|
2165
|
+
const targetHorizontalCenter = args.dimensions.right - (args.dimensions.right - args.dimensions.left) / 2;
|
|
2166
|
+
const targetLeft = args.dimensions.left;
|
|
2167
|
+
const targetRight = args.dimensions.right;
|
|
2168
|
+
const targetWidth = args.dimensions.width;
|
|
2169
|
+
switch (args.horizontalAlign) {
|
|
2170
|
+
case "center":
|
|
2171
|
+
result.left = `${targetHorizontalCenter}px`;
|
|
2172
|
+
result.translateX = "-50%";
|
|
2173
|
+
break;
|
|
2174
|
+
case "left":
|
|
2175
|
+
result.left = `${targetLeft - offsetH}px`;
|
|
2176
|
+
result.translateX = `${targetWidth / 2}px`;
|
|
2177
|
+
break;
|
|
2178
|
+
case "right":
|
|
2179
|
+
result.left = `${targetRight + offsetH}px`;
|
|
2180
|
+
result.translateX = `-${targetWidth / 2}px`;
|
|
2181
|
+
break;
|
|
2182
|
+
}
|
|
2183
|
+
switch (args.verticalPosition) {
|
|
2184
|
+
case "bottom":
|
|
2185
|
+
result.top = `${args.dimensions.top + args.dimensions.height + window.scrollY}px`;
|
|
2186
|
+
result.bottom = "unset";
|
|
2187
|
+
break;
|
|
2188
|
+
case "top":
|
|
2189
|
+
result.top = `${args.dimensions.top + window.scrollY}px`;
|
|
2190
|
+
result.bottom = "unset";
|
|
2191
|
+
result.translateY = "-100%";
|
|
2192
|
+
break;
|
|
2193
|
+
}
|
|
2194
|
+
return result;
|
|
2195
|
+
},
|
|
2196
|
+
[]
|
|
2197
|
+
);
|
|
2198
|
+
return {
|
|
2199
|
+
calculatePosition
|
|
2200
|
+
};
|
|
2201
|
+
};
|
|
2202
|
+
|
|
1873
2203
|
// src/tooltip/tooltip.tsx
|
|
1874
|
-
var
|
|
2204
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1875
2205
|
function Tooltip({
|
|
1876
2206
|
children,
|
|
1877
2207
|
content,
|
|
@@ -1883,8 +2213,8 @@ function Tooltip({
|
|
|
1883
2213
|
portalTarget
|
|
1884
2214
|
}) {
|
|
1885
2215
|
const { calculatePosition } = useTooltip();
|
|
1886
|
-
const [isVisible, setIsVisible] = (0,
|
|
1887
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
2216
|
+
const [isVisible, setIsVisible] = (0, import_react32.useState)(false);
|
|
2217
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react32.useState)({
|
|
1888
2218
|
maxWidth: "none",
|
|
1889
2219
|
width: "auto",
|
|
1890
2220
|
left: "0px",
|
|
@@ -1893,23 +2223,23 @@ function Tooltip({
|
|
|
1893
2223
|
translateX: "0",
|
|
1894
2224
|
translateY: "0"
|
|
1895
2225
|
});
|
|
1896
|
-
const targetRef = (0,
|
|
1897
|
-
const handleMouseOverWrapper = (0,
|
|
2226
|
+
const targetRef = (0, import_react32.useRef)(null);
|
|
2227
|
+
const handleMouseOverWrapper = (0, import_react32.useCallback)(() => {
|
|
1898
2228
|
if (isDisabledHover) {
|
|
1899
2229
|
return;
|
|
1900
2230
|
}
|
|
1901
2231
|
setIsVisible(true);
|
|
1902
2232
|
}, [isDisabledHover]);
|
|
1903
|
-
const handleMouseOutWrapper = (0,
|
|
2233
|
+
const handleMouseOutWrapper = (0, import_react32.useCallback)(() => {
|
|
1904
2234
|
setIsVisible(false);
|
|
1905
2235
|
}, []);
|
|
1906
|
-
(0,
|
|
2236
|
+
(0, import_react32.useEffect)(() => {
|
|
1907
2237
|
if (targetRef.current === null) return;
|
|
1908
2238
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
1909
2239
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
1910
2240
|
setTooltipPosition(position);
|
|
1911
2241
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
2242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
|
|
1913
2243
|
"div",
|
|
1914
2244
|
{
|
|
1915
2245
|
ref: targetRef,
|
|
@@ -1918,7 +2248,7 @@ function Tooltip({
|
|
|
1918
2248
|
onMouseLeave: handleMouseOutWrapper,
|
|
1919
2249
|
children: [
|
|
1920
2250
|
children,
|
|
1921
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */ (0,
|
|
2251
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
1922
2252
|
TooltipContent,
|
|
1923
2253
|
{
|
|
1924
2254
|
content,
|
|
@@ -1929,7 +2259,7 @@ function Tooltip({
|
|
|
1929
2259
|
tooltipPosition
|
|
1930
2260
|
}
|
|
1931
2261
|
) : (0, import_react_dom4.createPortal)(
|
|
1932
|
-
/* @__PURE__ */ (0,
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
1933
2263
|
TooltipContent,
|
|
1934
2264
|
{
|
|
1935
2265
|
isPortal: true,
|
|
@@ -1965,8 +2295,10 @@ function Tooltip({
|
|
|
1965
2295
|
PaginationSelect,
|
|
1966
2296
|
Radio,
|
|
1967
2297
|
Search,
|
|
2298
|
+
SegmentedControl,
|
|
1968
2299
|
Select,
|
|
1969
2300
|
SelectSort,
|
|
2301
|
+
SortButton,
|
|
1970
2302
|
Tab,
|
|
1971
2303
|
TabItem,
|
|
1972
2304
|
Table,
|
|
@@ -1980,5 +2312,6 @@ function Tooltip({
|
|
|
1980
2312
|
Toggle,
|
|
1981
2313
|
Tooltip,
|
|
1982
2314
|
useOutsideClick,
|
|
2315
|
+
useRovingFocus,
|
|
1983
2316
|
useToast
|
|
1984
2317
|
});
|