@zenkigen-inc/component-ui 1.17.0 → 1.18.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/README.md +9 -0
- package/dist/index.d.mts +237 -76
- package/dist/index.d.ts +237 -76
- package/dist/index.js +1307 -462
- package/dist/index.mjs +1282 -442
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -36,6 +36,7 @@ __export(index_exports, {
|
|
|
36
36
|
Checkbox: () => Checkbox,
|
|
37
37
|
Dropdown: () => Dropdown,
|
|
38
38
|
EvaluationStar: () => EvaluationStar,
|
|
39
|
+
FileInput: () => FileInput,
|
|
39
40
|
Heading: () => Heading,
|
|
40
41
|
Icon: () => Icon,
|
|
41
42
|
IconButton: () => IconButton,
|
|
@@ -44,7 +45,11 @@ __export(index_exports, {
|
|
|
44
45
|
NotificationInline: () => NotificationInline,
|
|
45
46
|
Pagination: () => Pagination,
|
|
46
47
|
PaginationSelect: () => PaginationSelect,
|
|
47
|
-
PasswordInput: () =>
|
|
48
|
+
PasswordInput: () => PasswordInput2,
|
|
49
|
+
Popover: () => Popover,
|
|
50
|
+
PopoverContent: () => PopoverContent,
|
|
51
|
+
PopoverTrigger: () => PopoverTrigger,
|
|
52
|
+
Popup: () => Popup,
|
|
48
53
|
Radio: () => Radio,
|
|
49
54
|
Search: () => Search,
|
|
50
55
|
SegmentedControl: () => SegmentedControl,
|
|
@@ -154,20 +159,21 @@ Breadcrumb.Item = BreadcrumbItem;
|
|
|
154
159
|
var import_component_theme3 = require("@zenkigen-inc/component-theme");
|
|
155
160
|
var import_clsx3 = require("clsx");
|
|
156
161
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
162
|
+
var createButton = (props) => {
|
|
163
|
+
const {
|
|
164
|
+
size = "medium",
|
|
165
|
+
variant = "fill",
|
|
166
|
+
isDisabled,
|
|
167
|
+
isSelected = false,
|
|
168
|
+
width,
|
|
169
|
+
borderRadius,
|
|
170
|
+
justifyContent = "center",
|
|
171
|
+
before,
|
|
172
|
+
after,
|
|
173
|
+
elementAs,
|
|
174
|
+
children,
|
|
175
|
+
...restProps
|
|
176
|
+
} = props;
|
|
171
177
|
const baseClasses = (0, import_clsx3.clsx)(
|
|
172
178
|
"flex shrink-0 items-center gap-1",
|
|
173
179
|
import_component_theme3.buttonColors[variant].hover,
|
|
@@ -175,13 +181,13 @@ var Button = ({
|
|
|
175
181
|
import_component_theme3.buttonColors[variant].disabled,
|
|
176
182
|
import_component_theme3.focusVisible.normal,
|
|
177
183
|
{
|
|
178
|
-
"h-6 px-2
|
|
184
|
+
"h-6 px-2": size === "small",
|
|
179
185
|
"h-8 px-3": size === "medium",
|
|
180
186
|
"h-10 px-4 leading-[24px]": size === "large",
|
|
181
187
|
"inline-flex": elementAs === "a",
|
|
182
188
|
[import_component_theme3.buttonColors[variant].selected]: isSelected,
|
|
183
189
|
[import_component_theme3.buttonColors[variant].base]: !isSelected,
|
|
184
|
-
"hover:text-textOnColor active:text-textOnColor [&:hover>*]:fill-iconOnColor [&:active>*]:fill-iconOnColor": isSelected && variant !== "outline" && variant !== "text",
|
|
190
|
+
"hover:text-textOnColor active:text-textOnColor [&:hover>*]:fill-iconOnColor [&:active>*]:fill-iconOnColor": isSelected && variant !== "outline" && variant !== "text" && variant !== "outlineDanger",
|
|
185
191
|
"pointer-events-none": isDisabled,
|
|
186
192
|
"rounded-button": borderRadius == null,
|
|
187
193
|
"justify-start": justifyContent === "start",
|
|
@@ -191,12 +197,18 @@ var Button = ({
|
|
|
191
197
|
}
|
|
192
198
|
);
|
|
193
199
|
const Component = elementAs ?? "button";
|
|
194
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Component, { className: baseClasses, style: { width, borderRadius }, disabled: isDisabled, ...
|
|
200
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Component, { className: baseClasses, style: { width, borderRadius }, disabled: isDisabled, ...restProps, children: [
|
|
195
201
|
before,
|
|
196
202
|
children,
|
|
197
203
|
after
|
|
198
204
|
] });
|
|
199
205
|
};
|
|
206
|
+
var Button = (props) => {
|
|
207
|
+
return createButton(props);
|
|
208
|
+
};
|
|
209
|
+
var InternalButton = (props) => {
|
|
210
|
+
return createButton(props);
|
|
211
|
+
};
|
|
200
212
|
|
|
201
213
|
// src/checkbox/checkbox.tsx
|
|
202
214
|
var import_component_theme4 = require("@zenkigen-inc/component-theme");
|
|
@@ -565,17 +577,352 @@ function EvaluationStar({ value, isEditable = false, onChangeRating, size = "med
|
|
|
565
577
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "flex flex-row", children: ratingStars });
|
|
566
578
|
}
|
|
567
579
|
|
|
568
|
-
// src/
|
|
580
|
+
// src/file-input/file-input.tsx
|
|
581
|
+
var import_clsx10 = require("clsx");
|
|
582
|
+
var import_react8 = require("react");
|
|
583
|
+
|
|
584
|
+
// src/icon-button/icon-button.tsx
|
|
569
585
|
var import_component_theme8 = require("@zenkigen-inc/component-theme");
|
|
570
586
|
var import_clsx9 = require("clsx");
|
|
571
587
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
588
|
+
function IconButton({
|
|
589
|
+
icon,
|
|
590
|
+
size = "medium",
|
|
591
|
+
variant = "outline",
|
|
592
|
+
isNoPadding = false,
|
|
593
|
+
isDisabled = false,
|
|
594
|
+
isSelected = false,
|
|
595
|
+
...props
|
|
596
|
+
}) {
|
|
597
|
+
const baseClasses = (0, import_clsx9.clsx)(
|
|
598
|
+
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
599
|
+
import_component_theme8.buttonColors[variant].hover,
|
|
600
|
+
import_component_theme8.buttonColors[variant].active,
|
|
601
|
+
import_component_theme8.buttonColors[variant].disabled,
|
|
602
|
+
import_component_theme8.focusVisible.normal,
|
|
603
|
+
{
|
|
604
|
+
"h-4 w-4": size === "small" && isNoPadding,
|
|
605
|
+
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
606
|
+
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
607
|
+
"h-10 w-10": size === "large" && !isNoPadding,
|
|
608
|
+
"inline-flex": props.isAnchor,
|
|
609
|
+
"pointer-events-none": isDisabled,
|
|
610
|
+
[import_component_theme8.buttonColors[variant].selected]: isSelected,
|
|
611
|
+
[import_component_theme8.buttonColors[variant].base]: !isSelected
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
const iconSize = size === "small" ? "small" : "medium";
|
|
615
|
+
if (props.isAnchor === true) {
|
|
616
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: icon, size: iconSize }) });
|
|
618
|
+
} else {
|
|
619
|
+
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", className: baseClasses, disabled: isDisabled, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Icon, { name: icon, size: iconSize }) });
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
// src/file-input/file-input.tsx
|
|
625
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
626
|
+
var ERROR_TYPES = {
|
|
627
|
+
SIZE_TOO_LARGE: "SIZE_TOO_LARGE",
|
|
628
|
+
UNSUPPORTED_FORMAT: "UNSUPPORTED_FORMAT"
|
|
629
|
+
};
|
|
630
|
+
var ERROR_MESSAGES = {
|
|
631
|
+
SIZE_TOO_LARGE: "\u30D5\u30A1\u30A4\u30EB\u30B5\u30A4\u30BA\u304C\u5927\u304D\u904E\u304E\u307E\u3059\u3002",
|
|
632
|
+
UNSUPPORTED_FORMAT: "\u30D5\u30A1\u30A4\u30EB\u5F62\u5F0F\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002"
|
|
633
|
+
};
|
|
634
|
+
var FileInput = (0, import_react8.forwardRef)(
|
|
635
|
+
({ id, variant, accept, maxSize, isDisabled = false, isError = false, onSelect, onError, errorMessages, ...rest }, ref) => {
|
|
636
|
+
const size = variant === "button" ? rest.size ?? "medium" : "medium";
|
|
637
|
+
const [selectedFile, setSelectedFile] = (0, import_react8.useState)(null);
|
|
638
|
+
const [isDragOver, setIsDragOver] = (0, import_react8.useState)(false);
|
|
639
|
+
const fileInputRef = (0, import_react8.useRef)(null);
|
|
640
|
+
const errorId = (0, import_react8.useId)();
|
|
641
|
+
const fallbackId = (0, import_react8.useId)();
|
|
642
|
+
const inputId = id ?? fallbackId;
|
|
643
|
+
const validateFile = (0, import_react8.useCallback)(
|
|
644
|
+
(file) => {
|
|
645
|
+
const errors = [];
|
|
646
|
+
if (maxSize != null && maxSize > 0 && file.size > maxSize) {
|
|
647
|
+
errors.push({
|
|
648
|
+
type: ERROR_TYPES.SIZE_TOO_LARGE,
|
|
649
|
+
message: ERROR_MESSAGES.SIZE_TOO_LARGE
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
if (accept != null && accept.length > 0) {
|
|
653
|
+
const acceptTypes = accept.split(",").map((t) => t.trim());
|
|
654
|
+
const fileName = file.name.toLowerCase();
|
|
655
|
+
const fileExtension = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
|
|
656
|
+
const fileMimeType = file.type;
|
|
657
|
+
const isAccepted = acceptTypes.some((acceptType) => {
|
|
658
|
+
if (acceptType.startsWith(".")) {
|
|
659
|
+
return fileExtension === acceptType.toLowerCase();
|
|
660
|
+
}
|
|
661
|
+
if (acceptType.includes("/")) {
|
|
662
|
+
if (acceptType.endsWith("/*")) {
|
|
663
|
+
const mainType = acceptType.split("/")[0];
|
|
664
|
+
return fileMimeType.startsWith(`${mainType}/`);
|
|
665
|
+
}
|
|
666
|
+
return fileMimeType === acceptType;
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
});
|
|
670
|
+
if (!isAccepted) {
|
|
671
|
+
errors.push({ type: ERROR_TYPES.UNSUPPORTED_FORMAT, message: ERROR_MESSAGES.UNSUPPORTED_FORMAT });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (errors.length > 0) {
|
|
675
|
+
onError?.(errors);
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
return true;
|
|
679
|
+
},
|
|
680
|
+
[accept, maxSize, onError]
|
|
681
|
+
);
|
|
682
|
+
const handleFileSelect = (0, import_react8.useCallback)(
|
|
683
|
+
(file) => {
|
|
684
|
+
if (file && !validateFile(file)) {
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
setSelectedFile(file);
|
|
688
|
+
onSelect?.(file);
|
|
689
|
+
},
|
|
690
|
+
[validateFile, onSelect]
|
|
691
|
+
);
|
|
692
|
+
const handleFileInputChange = (0, import_react8.useCallback)(
|
|
693
|
+
(event) => {
|
|
694
|
+
if (isDisabled) {
|
|
695
|
+
return;
|
|
696
|
+
}
|
|
697
|
+
const files = event.target.files;
|
|
698
|
+
if (files == null || files.length === 0) {
|
|
699
|
+
return;
|
|
700
|
+
}
|
|
701
|
+
const file = files[0];
|
|
702
|
+
if (file != null) {
|
|
703
|
+
handleFileSelect(file);
|
|
704
|
+
}
|
|
705
|
+
},
|
|
706
|
+
[isDisabled, handleFileSelect]
|
|
707
|
+
);
|
|
708
|
+
const handleDragOver = (0, import_react8.useCallback)(
|
|
709
|
+
(event) => {
|
|
710
|
+
event.preventDefault();
|
|
711
|
+
if (!isDisabled) {
|
|
712
|
+
setIsDragOver(true);
|
|
713
|
+
}
|
|
714
|
+
},
|
|
715
|
+
[isDisabled]
|
|
716
|
+
);
|
|
717
|
+
const handleDragLeave = (0, import_react8.useCallback)((event) => {
|
|
718
|
+
event.preventDefault();
|
|
719
|
+
setIsDragOver(false);
|
|
720
|
+
}, []);
|
|
721
|
+
const handleDrop = (0, import_react8.useCallback)(
|
|
722
|
+
(event) => {
|
|
723
|
+
event.preventDefault();
|
|
724
|
+
setIsDragOver(false);
|
|
725
|
+
if (isDisabled) return;
|
|
726
|
+
const file = event.dataTransfer.files[0];
|
|
727
|
+
if (file != null) {
|
|
728
|
+
handleFileSelect(file);
|
|
729
|
+
}
|
|
730
|
+
},
|
|
731
|
+
[isDisabled, handleFileSelect]
|
|
732
|
+
);
|
|
733
|
+
const handleButtonClick = (0, import_react8.useCallback)(() => {
|
|
734
|
+
if (!isDisabled) {
|
|
735
|
+
fileInputRef.current?.click();
|
|
736
|
+
}
|
|
737
|
+
}, [isDisabled]);
|
|
738
|
+
const handleClear = (0, import_react8.useCallback)(() => {
|
|
739
|
+
setSelectedFile(null);
|
|
740
|
+
if (fileInputRef.current) {
|
|
741
|
+
fileInputRef.current.value = "";
|
|
742
|
+
}
|
|
743
|
+
onSelect?.(null);
|
|
744
|
+
}, [onSelect]);
|
|
745
|
+
(0, import_react8.useImperativeHandle)(
|
|
746
|
+
ref,
|
|
747
|
+
() => ({
|
|
748
|
+
reset: handleClear
|
|
749
|
+
}),
|
|
750
|
+
[handleClear]
|
|
751
|
+
);
|
|
752
|
+
const hasErrorMessages = !isDisabled && errorMessages != null && errorMessages.length > 0;
|
|
753
|
+
const hasErrors = !isDisabled && isError === true;
|
|
754
|
+
const dropzoneClasses = (0, import_clsx10.clsx)(
|
|
755
|
+
"flex flex-1 flex-col items-center justify-center gap-4 rounded border border-dashed px-6 text-center",
|
|
756
|
+
selectedFile ? "py-[52px]" : "py-4",
|
|
757
|
+
{
|
|
758
|
+
"border-uiBorder03 bg-white text-text01": !isDisabled && !isDragOver && !hasErrors,
|
|
759
|
+
"border-activeInput bg-activeInput/5": !isDisabled && isDragOver && !hasErrors,
|
|
760
|
+
"border-supportDanger bg-white": hasErrors && !isDisabled,
|
|
761
|
+
"cursor-pointer hover:bg-hover02 active:bg-active02": !isDisabled,
|
|
762
|
+
"hover:bg-uiBackgroundError active:bg-red-red20": !isDisabled && hasErrors,
|
|
763
|
+
"border-disabled01 bg-disabled02 text-textPlaceholder cursor-not-allowed": isDisabled
|
|
764
|
+
}
|
|
765
|
+
);
|
|
766
|
+
const maxSizeLabel = (() => {
|
|
767
|
+
if (maxSize != null && maxSize > 0) {
|
|
768
|
+
const KB = 1024;
|
|
769
|
+
const MB = KB * 1024;
|
|
770
|
+
const GB = MB * 1024;
|
|
771
|
+
if (maxSize < MB) {
|
|
772
|
+
return `${Math.round(maxSize / KB)}KB\u4EE5\u4E0B`;
|
|
773
|
+
}
|
|
774
|
+
if (maxSize < GB) {
|
|
775
|
+
return `${Math.round(maxSize / MB)}MB\u4EE5\u4E0B`;
|
|
776
|
+
}
|
|
777
|
+
return `${Math.round(maxSize / GB)}GB\u4EE5\u4E0B`;
|
|
778
|
+
}
|
|
779
|
+
return "\u5236\u9650\u306A\u3057";
|
|
780
|
+
})();
|
|
781
|
+
const acceptLabel = (() => {
|
|
782
|
+
if (accept == null || accept.trim().length === 0) {
|
|
783
|
+
return "\u5236\u9650\u306A\u3057";
|
|
784
|
+
}
|
|
785
|
+
const tokens = accept.split(",").map((t) => t.trim()).filter((t) => t.length > 0);
|
|
786
|
+
const normalized = tokens.map((token) => {
|
|
787
|
+
if (token.startsWith(".")) {
|
|
788
|
+
return token.slice(1);
|
|
789
|
+
}
|
|
790
|
+
const slashIndex = token.indexOf("/");
|
|
791
|
+
if (slashIndex !== -1) {
|
|
792
|
+
const type = token.slice(0, slashIndex);
|
|
793
|
+
const subtype = token.slice(slashIndex + 1);
|
|
794
|
+
return subtype === "*" ? `${type}/*` : subtype;
|
|
795
|
+
}
|
|
796
|
+
return token;
|
|
797
|
+
});
|
|
798
|
+
return normalized.join(", ");
|
|
799
|
+
})();
|
|
800
|
+
if (variant === "button") {
|
|
801
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: hasErrors ? "flex-1" : "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
803
|
+
InternalButton,
|
|
804
|
+
{
|
|
805
|
+
size,
|
|
806
|
+
variant: hasErrors ? "outlineDanger" : "outline",
|
|
807
|
+
isDisabled,
|
|
808
|
+
width: "100%",
|
|
809
|
+
onClick: handleButtonClick,
|
|
810
|
+
before: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "upload", size: "small" }),
|
|
811
|
+
after: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_jsx_runtime14.Fragment, { children: selectedFile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: (0, import_clsx10.clsx)("typography-label12regular truncate", !isDisabled && "text-text01"), children: selectedFile.name }) : "" }),
|
|
812
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "truncate", children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" })
|
|
813
|
+
}
|
|
814
|
+
) }),
|
|
815
|
+
selectedFile && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(IconButton, { variant: "text", icon: "close", size: "small", onClick: handleClear }) }),
|
|
816
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { id: errorId, "data-testid": "error-messages", className: "typography-label12regular text-supportError", children: errorMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "break-all", children: message }, index)) }),
|
|
817
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
818
|
+
"input",
|
|
819
|
+
{
|
|
820
|
+
id: inputId,
|
|
821
|
+
ref: fileInputRef,
|
|
822
|
+
type: "file",
|
|
823
|
+
accept,
|
|
824
|
+
onChange: handleFileInputChange,
|
|
825
|
+
className: "hidden",
|
|
826
|
+
"aria-invalid": hasErrors,
|
|
827
|
+
...hasErrors && hasErrorMessages && { "aria-describedby": errorId }
|
|
828
|
+
}
|
|
829
|
+
)
|
|
830
|
+
] });
|
|
831
|
+
}
|
|
832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex min-w-[320px] flex-col gap-2", children: [
|
|
833
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
834
|
+
"div",
|
|
835
|
+
{
|
|
836
|
+
className: dropzoneClasses,
|
|
837
|
+
role: "button",
|
|
838
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
839
|
+
onDragOver: handleDragOver,
|
|
840
|
+
onDragLeave: handleDragLeave,
|
|
841
|
+
onDrop: handleDrop,
|
|
842
|
+
onClick: handleButtonClick,
|
|
843
|
+
onKeyDown: (e) => {
|
|
844
|
+
if ((e.key === "Enter" || e.key === " ") && !isDisabled) {
|
|
845
|
+
e.preventDefault();
|
|
846
|
+
handleButtonClick();
|
|
847
|
+
}
|
|
848
|
+
},
|
|
849
|
+
"aria-label": "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E",
|
|
850
|
+
"aria-disabled": isDisabled,
|
|
851
|
+
...hasErrors && hasErrorMessages && { "aria-describedby": errorId },
|
|
852
|
+
children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: "upload-document", size: "large", color: isDisabled ? "icon03" : "icon01" }),
|
|
854
|
+
!selectedFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex flex-col gap-1", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "typography-body13regular select-none", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
|
|
855
|
+
"\u3053\u3053\u306B\u30D5\u30A1\u30A4\u30EB\u3092\u30C9\u30ED\u30C3\u30D7\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
856
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("br", {}),
|
|
857
|
+
"\u307E\u305F\u306F\u3001",
|
|
858
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: (0, import_clsx10.clsx)(!isDisabled ? "text-link01" : ""), children: "\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E" }),
|
|
859
|
+
"\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
|
|
860
|
+
] }) }) }),
|
|
861
|
+
!selectedFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex flex-col gap-1", children: [
|
|
862
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_clsx10.clsx)("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u5BFE\u5FDC\u5F62\u5F0F" }),
|
|
863
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_clsx10.clsx)("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: acceptLabel }),
|
|
864
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_clsx10.clsx)("typography-label11regular", isDisabled ? "text-textPlaceholder" : "text-text02"), children: "\u30B5\u30A4\u30BA" }),
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: (0, import_clsx10.clsx)("typography-body12regular", isDisabled ? "text-textPlaceholder" : "text-text01"), children: maxSizeLabel })
|
|
866
|
+
] }),
|
|
867
|
+
selectedFile && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mt-2 flex flex-col items-center gap-1", children: [
|
|
868
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "typography-label11regular text-text02", children: "\u30D5\u30A1\u30A4\u30EB\u540D" }),
|
|
869
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
870
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "typography-label14regular", children: selectedFile.name }),
|
|
871
|
+
!isDisabled && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
872
|
+
IconButton,
|
|
873
|
+
{
|
|
874
|
+
variant: "text",
|
|
875
|
+
icon: "close",
|
|
876
|
+
size: "small",
|
|
877
|
+
onClick: (event) => {
|
|
878
|
+
event.stopPropagation();
|
|
879
|
+
handleClear();
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
)
|
|
883
|
+
] })
|
|
884
|
+
] }),
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
886
|
+
"input",
|
|
887
|
+
{
|
|
888
|
+
id: inputId,
|
|
889
|
+
ref: fileInputRef,
|
|
890
|
+
type: "file",
|
|
891
|
+
accept,
|
|
892
|
+
onChange: handleFileInputChange,
|
|
893
|
+
className: "hidden",
|
|
894
|
+
"aria-invalid": hasErrors,
|
|
895
|
+
...hasErrors && hasErrorMessages && { "aria-describedby": errorId }
|
|
896
|
+
}
|
|
897
|
+
)
|
|
898
|
+
]
|
|
899
|
+
}
|
|
900
|
+
),
|
|
901
|
+
hasErrors && hasErrorMessages && /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
902
|
+
"div",
|
|
903
|
+
{
|
|
904
|
+
id: errorId,
|
|
905
|
+
"data-testid": "error-messages",
|
|
906
|
+
className: "typography-body13regular flex flex-col text-supportDanger",
|
|
907
|
+
children: errorMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { children: message }, index))
|
|
908
|
+
}
|
|
909
|
+
)
|
|
910
|
+
] });
|
|
911
|
+
}
|
|
912
|
+
);
|
|
913
|
+
FileInput.displayName = "FileInput";
|
|
914
|
+
|
|
915
|
+
// src/heading/heading.tsx
|
|
916
|
+
var import_component_theme9 = require("@zenkigen-inc/component-theme");
|
|
917
|
+
var import_clsx11 = require("clsx");
|
|
918
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
572
919
|
function Heading(props) {
|
|
573
920
|
const TagName = `h${props.level}`;
|
|
574
|
-
const classes = (0,
|
|
921
|
+
const classes = (0, import_clsx11.clsx)(`flex items-center text-text01`, import_component_theme9.typography.heading[TagName], {
|
|
575
922
|
"gap-2": props.level === 1,
|
|
576
923
|
"gap-1": props.level > 1
|
|
577
924
|
});
|
|
578
|
-
return /* @__PURE__ */ (0,
|
|
925
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(TagName, { className: classes, children: [
|
|
579
926
|
props.before,
|
|
580
927
|
props.children,
|
|
581
928
|
props.after
|
|
@@ -583,22 +930,22 @@ function Heading(props) {
|
|
|
583
930
|
}
|
|
584
931
|
|
|
585
932
|
// src/hooks/use-roving-focus.ts
|
|
586
|
-
var
|
|
933
|
+
var import_react9 = require("react");
|
|
587
934
|
var useRovingFocus = ({
|
|
588
935
|
values,
|
|
589
936
|
defaultFocusedValue,
|
|
590
937
|
isDisabled = false
|
|
591
938
|
}) => {
|
|
592
|
-
const [focusedValue, setFocusedValue] = (0,
|
|
939
|
+
const [focusedValue, setFocusedValue] = (0, import_react9.useState)(
|
|
593
940
|
typeof defaultFocusedValue === "undefined" ? null : defaultFocusedValue
|
|
594
941
|
);
|
|
595
|
-
const handleFocusChange = (0,
|
|
942
|
+
const handleFocusChange = (0, import_react9.useCallback)((newValue) => {
|
|
596
943
|
setFocusedValue(newValue);
|
|
597
944
|
}, []);
|
|
598
|
-
const handleBlur = (0,
|
|
945
|
+
const handleBlur = (0, import_react9.useCallback)(() => {
|
|
599
946
|
setFocusedValue(null);
|
|
600
947
|
}, []);
|
|
601
|
-
const handleKeyDown = (0,
|
|
948
|
+
const handleKeyDown = (0, import_react9.useCallback)(
|
|
602
949
|
(event) => {
|
|
603
950
|
if (isDisabled === true || values.length === 0) return;
|
|
604
951
|
const currentIndex = focusedValue !== null && focusedValue !== "" ? values.indexOf(focusedValue) : -1;
|
|
@@ -652,60 +999,18 @@ var useRovingFocus = ({
|
|
|
652
999
|
};
|
|
653
1000
|
};
|
|
654
1001
|
|
|
655
|
-
// src/icon-button/icon-button.tsx
|
|
656
|
-
var import_component_theme9 = require("@zenkigen-inc/component-theme");
|
|
657
|
-
var import_clsx10 = require("clsx");
|
|
658
|
-
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
659
|
-
function IconButton({
|
|
660
|
-
icon,
|
|
661
|
-
size = "medium",
|
|
662
|
-
variant = "outline",
|
|
663
|
-
isNoPadding = false,
|
|
664
|
-
isDisabled = false,
|
|
665
|
-
isSelected = false,
|
|
666
|
-
...props
|
|
667
|
-
}) {
|
|
668
|
-
const baseClasses = (0, import_clsx10.clsx)(
|
|
669
|
-
"typography-label16regular flex items-center justify-center gap-1 rounded",
|
|
670
|
-
import_component_theme9.buttonColors[variant].hover,
|
|
671
|
-
import_component_theme9.buttonColors[variant].active,
|
|
672
|
-
import_component_theme9.buttonColors[variant].disabled,
|
|
673
|
-
import_component_theme9.focusVisible.normal,
|
|
674
|
-
{
|
|
675
|
-
"h-4 w-4": size === "small" && isNoPadding,
|
|
676
|
-
"h-6 w-6": size === "small" && !isNoPadding || (size === "medium" || size === "large") && isNoPadding,
|
|
677
|
-
"h-8 w-8": size === "medium" && !isNoPadding,
|
|
678
|
-
"h-10 w-10": size === "large" && !isNoPadding,
|
|
679
|
-
"inline-flex": props.isAnchor,
|
|
680
|
-
"pointer-events-none": isDisabled,
|
|
681
|
-
[import_component_theme9.buttonColors[variant].selected]: isSelected,
|
|
682
|
-
[import_component_theme9.buttonColors[variant].base]: !isSelected
|
|
683
|
-
}
|
|
684
|
-
);
|
|
685
|
-
const iconSize = size === "small" ? "small" : "medium";
|
|
686
|
-
if (props.isAnchor === true) {
|
|
687
|
-
const buttonProps = Object.fromEntries(Object.entries(props).filter(([key]) => key !== "isAnchor"));
|
|
688
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { className: baseClasses, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(Icon, { name: icon, size: iconSize }) });
|
|
689
|
-
} else {
|
|
690
|
-
const buttonProps = Object.fromEntries(
|
|
691
|
-
Object.entries(props).filter(([key]) => key !== "isAnchor" && key !== "onClick")
|
|
692
|
-
);
|
|
693
|
-
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 }) });
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
|
|
697
1002
|
// src/loading/loading.tsx
|
|
698
|
-
var
|
|
699
|
-
var
|
|
1003
|
+
var import_clsx12 = __toESM(require("clsx"));
|
|
1004
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
700
1005
|
function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
701
|
-
const wrapperClasses = (0,
|
|
702
|
-
const svgClasses = (0,
|
|
1006
|
+
const wrapperClasses = (0, import_clsx12.default)(position, "left-0 top-0 z-20 flex w-full items-center justify-center");
|
|
1007
|
+
const svgClasses = (0, import_clsx12.default)({
|
|
703
1008
|
"h-4 w-4": size === "small",
|
|
704
1009
|
"h-8 w-8": size === "medium",
|
|
705
1010
|
"h-16 w-16": size === "large"
|
|
706
1011
|
});
|
|
707
|
-
return /* @__PURE__ */ (0,
|
|
708
|
-
size === "small" && /* @__PURE__ */ (0,
|
|
1012
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: wrapperClasses, style: { height }, children: [
|
|
1013
|
+
size === "small" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { className: svgClasses, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
709
1014
|
"circle",
|
|
710
1015
|
{
|
|
711
1016
|
className: "origin-center animate-circular-small-move stroke-interactive01",
|
|
@@ -717,7 +1022,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
717
1022
|
fill: "none"
|
|
718
1023
|
}
|
|
719
1024
|
) }),
|
|
720
|
-
size === "medium" && /* @__PURE__ */ (0,
|
|
1025
|
+
size === "medium" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { className: svgClasses, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
721
1026
|
"circle",
|
|
722
1027
|
{
|
|
723
1028
|
className: "origin-center animate-circular-medium-move stroke-interactive01",
|
|
@@ -729,7 +1034,7 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
729
1034
|
fill: "none"
|
|
730
1035
|
}
|
|
731
1036
|
) }),
|
|
732
|
-
size === "large" && /* @__PURE__ */ (0,
|
|
1037
|
+
size === "large" && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { className: svgClasses, viewBox: "0 0 64 64", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
733
1038
|
"circle",
|
|
734
1039
|
{
|
|
735
1040
|
className: "origin-center animate-circular-large-move stroke-interactive01",
|
|
@@ -745,13 +1050,13 @@ function Loading({ size = "medium", position = "fixed", height = "100%" }) {
|
|
|
745
1050
|
}
|
|
746
1051
|
|
|
747
1052
|
// src/modal/modal.tsx
|
|
748
|
-
var
|
|
1053
|
+
var import_react13 = require("react");
|
|
749
1054
|
var import_react_dom2 = require("react-dom");
|
|
750
1055
|
|
|
751
1056
|
// src/modal/body-scroll-lock.tsx
|
|
752
|
-
var
|
|
1057
|
+
var import_react10 = require("react");
|
|
753
1058
|
var BodyScrollLock = () => {
|
|
754
|
-
(0,
|
|
1059
|
+
(0, import_react10.useLayoutEffect)(() => {
|
|
755
1060
|
const { scrollX, scrollY } = window;
|
|
756
1061
|
const { body } = document;
|
|
757
1062
|
const hasVerticalScrollbar = document.documentElement.scrollHeight > document.documentElement.clientHeight;
|
|
@@ -796,34 +1101,34 @@ function restoreProperty(element, property, value) {
|
|
|
796
1101
|
}
|
|
797
1102
|
|
|
798
1103
|
// src/modal/modal-body.tsx
|
|
799
|
-
var
|
|
1104
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
800
1105
|
function ModalBody({ children }) {
|
|
801
|
-
return /* @__PURE__ */ (0,
|
|
1106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "overflow-y-auto", children });
|
|
802
1107
|
}
|
|
803
1108
|
|
|
804
1109
|
// src/modal/modal-context.ts
|
|
805
|
-
var
|
|
806
|
-
var ModalContext = (0,
|
|
1110
|
+
var import_react11 = require("react");
|
|
1111
|
+
var ModalContext = (0, import_react11.createContext)({
|
|
807
1112
|
onClose: () => null
|
|
808
1113
|
});
|
|
809
1114
|
|
|
810
1115
|
// src/modal/modal-footer.tsx
|
|
811
|
-
var
|
|
812
|
-
var
|
|
1116
|
+
var import_clsx13 = __toESM(require("clsx"));
|
|
1117
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
813
1118
|
function ModalFooter({ children, isNoBorder = false }) {
|
|
814
|
-
const wrapperClasses = (0,
|
|
1119
|
+
const wrapperClasses = (0, import_clsx13.default)("flex w-full shrink-0 items-center rounded-b-lg px-6 py-4", {
|
|
815
1120
|
"border-t-[1px] border-uiBorder01": !isNoBorder
|
|
816
1121
|
});
|
|
817
|
-
return /* @__PURE__ */ (0,
|
|
1122
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: wrapperClasses, children });
|
|
818
1123
|
}
|
|
819
1124
|
|
|
820
1125
|
// src/modal/modal-header.tsx
|
|
821
|
-
var
|
|
822
|
-
var
|
|
823
|
-
var
|
|
1126
|
+
var import_clsx14 = __toESM(require("clsx"));
|
|
1127
|
+
var import_react12 = require("react");
|
|
1128
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
824
1129
|
function ModalHeader({ children, isNoBorder = false }) {
|
|
825
|
-
const { onClose } = (0,
|
|
826
|
-
const headerClasses = (0,
|
|
1130
|
+
const { onClose } = (0, import_react12.useContext)(ModalContext);
|
|
1131
|
+
const headerClasses = (0, import_clsx14.default)(
|
|
827
1132
|
"typography-h5 flex w-full shrink-0 items-center justify-between rounded-t-lg px-6 text-text01",
|
|
828
1133
|
{
|
|
829
1134
|
"border-b border-uiBorder01": !isNoBorder,
|
|
@@ -831,14 +1136,14 @@ function ModalHeader({ children, isNoBorder = false }) {
|
|
|
831
1136
|
"h-12": onClose
|
|
832
1137
|
}
|
|
833
1138
|
);
|
|
834
|
-
return /* @__PURE__ */ (0,
|
|
835
|
-
/* @__PURE__ */ (0,
|
|
836
|
-
onClose && /* @__PURE__ */ (0,
|
|
1139
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: headerClasses, children: [
|
|
1140
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children }),
|
|
1141
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
837
1142
|
] });
|
|
838
1143
|
}
|
|
839
1144
|
|
|
840
1145
|
// src/modal/modal.tsx
|
|
841
|
-
var
|
|
1146
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
842
1147
|
var LIMIT_WIDTH = 320;
|
|
843
1148
|
var LIMIT_HEIGHT = 184;
|
|
844
1149
|
function Modal({
|
|
@@ -850,16 +1155,16 @@ function Modal({
|
|
|
850
1155
|
onClose,
|
|
851
1156
|
portalTargetRef
|
|
852
1157
|
}) {
|
|
853
|
-
const [isMounted, setIsMounted] = (0,
|
|
1158
|
+
const [isMounted, setIsMounted] = (0, import_react13.useState)(false);
|
|
854
1159
|
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH) : width;
|
|
855
1160
|
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT) : height;
|
|
856
|
-
(0,
|
|
1161
|
+
(0, import_react13.useEffect)(() => {
|
|
857
1162
|
setIsMounted(true);
|
|
858
1163
|
}, []);
|
|
859
|
-
return isMounted && isOpen ? /* @__PURE__ */ (0,
|
|
860
|
-
/* @__PURE__ */ (0,
|
|
1164
|
+
return isMounted && isOpen ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
1165
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BodyScrollLock, {}),
|
|
861
1166
|
(0, import_react_dom2.createPortal)(
|
|
862
|
-
/* @__PURE__ */ (0,
|
|
1167
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ModalContext.Provider, { value: { onClose }, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "fixed left-0 top-0 z-overlay flex size-full items-center justify-center bg-backgroundOverlayBlack py-4", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
863
1168
|
"div",
|
|
864
1169
|
{
|
|
865
1170
|
className: "grid max-h-full min-h-[120px] grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-modalShadow",
|
|
@@ -876,10 +1181,10 @@ Modal.Header = ModalHeader;
|
|
|
876
1181
|
Modal.Footer = ModalFooter;
|
|
877
1182
|
|
|
878
1183
|
// src/notification-inline/notification-inline.tsx
|
|
879
|
-
var
|
|
880
|
-
var
|
|
1184
|
+
var import_clsx15 = require("clsx");
|
|
1185
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
881
1186
|
function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
882
|
-
const wrapperClasses = (0,
|
|
1187
|
+
const wrapperClasses = (0, import_clsx15.clsx)("typography-body13regular flex items-center gap-1 rounded text-text01", {
|
|
883
1188
|
"bg-uiBackgroundError": state === "attention",
|
|
884
1189
|
"bg-uiBackgroundWarning": state === "warning",
|
|
885
1190
|
"bg-uiBackgroundBlue": state === "information",
|
|
@@ -888,7 +1193,7 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
888
1193
|
"p-2": size === "small",
|
|
889
1194
|
"p-3": size === "medium"
|
|
890
1195
|
});
|
|
891
|
-
const iconClasses = (0,
|
|
1196
|
+
const iconClasses = (0, import_clsx15.clsx)("flex items-center", {
|
|
892
1197
|
"fill-supportError": state === "attention",
|
|
893
1198
|
"fill-supportWarning": state === "warning",
|
|
894
1199
|
"fill-blue-blue50": state === "information",
|
|
@@ -904,28 +1209,28 @@ function NotificationInline({ state = "default", size = "medium", ...props }) {
|
|
|
904
1209
|
small: "small",
|
|
905
1210
|
medium: "medium"
|
|
906
1211
|
};
|
|
907
|
-
return /* @__PURE__ */ (0,
|
|
908
|
-
state !== "default" && /* @__PURE__ */ (0,
|
|
909
|
-
/* @__PURE__ */ (0,
|
|
910
|
-
props.showClose === true && /* @__PURE__ */ (0,
|
|
1212
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: wrapperClasses, children: [
|
|
1213
|
+
state !== "default" && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { name: iconName[state], size: iconSize[size] }) }),
|
|
1214
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: "flex-1", children: props.children }),
|
|
1215
|
+
props.showClose === true && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(IconButton, { icon: "close", size: "small", variant: "text" }) })
|
|
911
1216
|
] });
|
|
912
1217
|
}
|
|
913
1218
|
|
|
914
1219
|
// src/pagination/pagination-button.tsx
|
|
915
|
-
var
|
|
916
|
-
var
|
|
1220
|
+
var import_clsx16 = require("clsx");
|
|
1221
|
+
var import_react15 = require("react");
|
|
917
1222
|
|
|
918
1223
|
// src/pagination/pagination-context.ts
|
|
919
|
-
var
|
|
920
|
-
var PaginationContext = (0,
|
|
1224
|
+
var import_react14 = require("react");
|
|
1225
|
+
var PaginationContext = (0, import_react14.createContext)({
|
|
921
1226
|
currentPage: 0
|
|
922
1227
|
});
|
|
923
1228
|
|
|
924
1229
|
// src/pagination/pagination-button.tsx
|
|
925
|
-
var
|
|
1230
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
926
1231
|
function PaginationButton({ page, onClick }) {
|
|
927
|
-
const { currentPage } = (0,
|
|
928
|
-
const buttonClasses = (0,
|
|
1232
|
+
const { currentPage } = (0, import_react15.useContext)(PaginationContext);
|
|
1233
|
+
const buttonClasses = (0, import_clsx16.clsx)(
|
|
929
1234
|
"flex h-8 min-w-8 items-center justify-center rounded fill-icon01 px-1",
|
|
930
1235
|
"typography-label14regular",
|
|
931
1236
|
"text-interactive02",
|
|
@@ -933,54 +1238,76 @@ function PaginationButton({ page, onClick }) {
|
|
|
933
1238
|
{ "border border-uiBorder02": page === currentPage },
|
|
934
1239
|
{ "border-transparent": page !== currentPage }
|
|
935
1240
|
);
|
|
936
|
-
return /* @__PURE__ */ (0,
|
|
1241
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("button", { type: "button", className: buttonClasses, onClick: () => onClick(page), children: page });
|
|
937
1242
|
}
|
|
938
1243
|
|
|
939
1244
|
// src/pagination/pagination.tsx
|
|
940
|
-
var
|
|
1245
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
941
1246
|
var START_PAGE = 1;
|
|
942
1247
|
function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick }) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
const
|
|
947
|
-
const
|
|
948
|
-
const
|
|
1248
|
+
if (totalPage < START_PAGE) {
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
1252
|
+
const clampedCurrentPage = clamp(currentPage, START_PAGE, totalPage);
|
|
1253
|
+
const maxSideNumPagesToShow = Math.max(0, totalPage - 2);
|
|
1254
|
+
const side = clamp(sideNumPagesToShow, 0, maxSideNumPagesToShow);
|
|
1255
|
+
const minPage = START_PAGE + 1;
|
|
1256
|
+
const maxPage = totalPage - 1;
|
|
1257
|
+
const availablePagesCount = Math.max(0, maxPage - minPage + 1);
|
|
1258
|
+
const hasBothSides = clampedCurrentPage > START_PAGE && clampedCurrentPage < totalPage;
|
|
1259
|
+
const windowSize = Math.min(availablePagesCount, hasBothSides ? side * 2 + 1 : side * 2);
|
|
1260
|
+
let start = minPage;
|
|
1261
|
+
if (windowSize > 0) {
|
|
1262
|
+
if (hasBothSides) {
|
|
1263
|
+
start = Math.max(minPage, Math.min(clampedCurrentPage - side, maxPage - windowSize + 1));
|
|
1264
|
+
} else if (clampedCurrentPage === totalPage) {
|
|
1265
|
+
start = Math.max(minPage, maxPage - windowSize + 1);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
const end = windowSize === 0 ? minPage - 1 : Math.min(maxPage, start + windowSize - 1);
|
|
949
1269
|
const pageList = [];
|
|
950
|
-
for (let i = start
|
|
1270
|
+
for (let i = start; i <= end; i++) {
|
|
951
1271
|
pageList.push(i);
|
|
952
1272
|
}
|
|
953
1273
|
const threeDotIconClasses = "flex h-8 w-8 items-center justify-center gap-1 fill-icon01";
|
|
954
|
-
|
|
1274
|
+
const isFirstPage = clampedCurrentPage === START_PAGE;
|
|
1275
|
+
const isLastPage = clampedCurrentPage === totalPage;
|
|
1276
|
+
const firstPageInList = pageList.at(0) ?? null;
|
|
1277
|
+
const lastPageInList = pageList.at(-1) ?? null;
|
|
1278
|
+
const hasHeadEllipsis = firstPageInList !== null && firstPageInList > START_PAGE + 1;
|
|
1279
|
+
const hasTailEllipsis = lastPageInList !== null && lastPageInList < totalPage - 1;
|
|
1280
|
+
const hasLastPageButton = totalPage > START_PAGE;
|
|
1281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
955
1282
|
PaginationContext.Provider,
|
|
956
1283
|
{
|
|
957
1284
|
value: {
|
|
958
|
-
currentPage
|
|
1285
|
+
currentPage: clampedCurrentPage
|
|
959
1286
|
},
|
|
960
|
-
children: /* @__PURE__ */ (0,
|
|
961
|
-
/* @__PURE__ */ (0,
|
|
1287
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("ul", { className: "flex gap-1", children: [
|
|
1288
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
962
1289
|
IconButton,
|
|
963
1290
|
{
|
|
964
|
-
isDisabled:
|
|
1291
|
+
isDisabled: isFirstPage,
|
|
965
1292
|
variant: "text",
|
|
966
1293
|
icon: "angle-left",
|
|
967
1294
|
size: "small",
|
|
968
|
-
onClick: () => onClick(
|
|
1295
|
+
onClick: () => onClick(Math.max(START_PAGE, clampedCurrentPage - 1))
|
|
969
1296
|
}
|
|
970
1297
|
) }),
|
|
971
|
-
/* @__PURE__ */ (0,
|
|
972
|
-
|
|
973
|
-
pageList.map((page, index) => /* @__PURE__ */ (0,
|
|
974
|
-
|
|
975
|
-
/* @__PURE__ */ (0,
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
1298
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaginationButton, { onClick: () => onClick(START_PAGE), page: START_PAGE }) }),
|
|
1299
|
+
hasHeadEllipsis && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: threeDotIconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "more", size: "small" }) }),
|
|
1300
|
+
pageList.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaginationButton, { onClick: () => onClick(page), page }) }, index)),
|
|
1301
|
+
hasTailEllipsis && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: threeDotIconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Icon, { name: "more", size: "small" }) }),
|
|
1302
|
+
hasLastPageButton && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(PaginationButton, { onClick: () => onClick(totalPage), page: totalPage }) }),
|
|
1303
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("li", { className: "flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
977
1304
|
IconButton,
|
|
978
1305
|
{
|
|
979
|
-
isDisabled:
|
|
1306
|
+
isDisabled: isLastPage,
|
|
980
1307
|
variant: "text",
|
|
981
1308
|
icon: "angle-right",
|
|
982
1309
|
size: "small",
|
|
983
|
-
onClick: () => onClick(
|
|
1310
|
+
onClick: () => onClick(Math.min(totalPage, clampedCurrentPage + 1))
|
|
984
1311
|
}
|
|
985
1312
|
) })
|
|
986
1313
|
] })
|
|
@@ -989,14 +1316,14 @@ function Pagination({ currentPage, totalPage, sideNumPagesToShow = 3, onClick })
|
|
|
989
1316
|
}
|
|
990
1317
|
|
|
991
1318
|
// src/select/select.tsx
|
|
992
|
-
var
|
|
1319
|
+
var import_react19 = require("@floating-ui/react");
|
|
993
1320
|
var import_component_theme12 = require("@zenkigen-inc/component-theme");
|
|
994
|
-
var
|
|
995
|
-
var
|
|
1321
|
+
var import_clsx19 = __toESM(require("clsx"));
|
|
1322
|
+
var import_react20 = require("react");
|
|
996
1323
|
|
|
997
1324
|
// src/select/select-context.ts
|
|
998
|
-
var
|
|
999
|
-
var SelectContext = (0,
|
|
1325
|
+
var import_react16 = require("react");
|
|
1326
|
+
var SelectContext = (0, import_react16.createContext)({
|
|
1000
1327
|
size: "medium",
|
|
1001
1328
|
setIsOptionListOpen: () => false,
|
|
1002
1329
|
variant: "outline",
|
|
@@ -1005,16 +1332,16 @@ var SelectContext = (0, import_react15.createContext)({
|
|
|
1005
1332
|
|
|
1006
1333
|
// src/select/select-item.tsx
|
|
1007
1334
|
var import_component_theme10 = require("@zenkigen-inc/component-theme");
|
|
1008
|
-
var
|
|
1009
|
-
var
|
|
1010
|
-
var
|
|
1335
|
+
var import_clsx17 = __toESM(require("clsx"));
|
|
1336
|
+
var import_react17 = require("react");
|
|
1337
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1011
1338
|
function SelectItem({ option }) {
|
|
1012
|
-
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0,
|
|
1339
|
+
const { setIsOptionListOpen, selectedOption, onChange, isError } = (0, import_react17.useContext)(SelectContext);
|
|
1013
1340
|
const handleClickItem = (option2) => {
|
|
1014
1341
|
onChange?.(option2);
|
|
1015
1342
|
setIsOptionListOpen(false);
|
|
1016
1343
|
};
|
|
1017
|
-
const itemClasses = (0,
|
|
1344
|
+
const itemClasses = (0, import_clsx17.default)(
|
|
1018
1345
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1019
1346
|
import_component_theme10.focusVisible.inset,
|
|
1020
1347
|
{
|
|
@@ -1024,25 +1351,25 @@ function SelectItem({ option }) {
|
|
|
1024
1351
|
"pr-10": option.id !== selectedOption?.id
|
|
1025
1352
|
}
|
|
1026
1353
|
);
|
|
1027
|
-
return /* @__PURE__ */ (0,
|
|
1028
|
-
option.icon && /* @__PURE__ */ (0,
|
|
1029
|
-
/* @__PURE__ */ (0,
|
|
1030
|
-
option.id === selectedOption?.id && /* @__PURE__ */ (0,
|
|
1354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("li", { className: "flex w-full items-center", "data-id": option.id, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("button", { className: itemClasses, type: "button", onClick: () => handleClickItem(option), children: [
|
|
1355
|
+
option.icon && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: option.icon, size: "small" }),
|
|
1356
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "ml-1 flex-1 truncate text-left", children: option.label }),
|
|
1357
|
+
option.id === selectedOption?.id && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "ml-2 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Icon, { name: "check", size: "small" }) })
|
|
1031
1358
|
] }) }, option.id);
|
|
1032
1359
|
}
|
|
1033
1360
|
|
|
1034
1361
|
// src/select/select-list.tsx
|
|
1035
1362
|
var import_component_theme11 = require("@zenkigen-inc/component-theme");
|
|
1036
|
-
var
|
|
1037
|
-
var
|
|
1038
|
-
var
|
|
1039
|
-
var SelectList = (0,
|
|
1040
|
-
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } = (0,
|
|
1363
|
+
var import_clsx18 = __toESM(require("clsx"));
|
|
1364
|
+
var import_react18 = require("react");
|
|
1365
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1366
|
+
var SelectList = (0, import_react18.forwardRef)(({ children, maxHeight }, ref) => {
|
|
1367
|
+
const { selectedOption, setIsOptionListOpen, variant, placeholder, onChange, floatingStyles, floatingRef } = (0, import_react18.useContext)(SelectContext);
|
|
1041
1368
|
const handleClickDeselect = () => {
|
|
1042
1369
|
onChange?.(null);
|
|
1043
1370
|
setIsOptionListOpen(false);
|
|
1044
1371
|
};
|
|
1045
|
-
(0,
|
|
1372
|
+
(0, import_react18.useLayoutEffect)(() => {
|
|
1046
1373
|
if (maxHeight != null && selectedOption != null) {
|
|
1047
1374
|
const container = floatingRef?.current;
|
|
1048
1375
|
if (container != null) {
|
|
@@ -1060,22 +1387,22 @@ var SelectList = (0, import_react17.forwardRef)(({ children, maxHeight }, ref) =
|
|
|
1060
1387
|
}
|
|
1061
1388
|
}
|
|
1062
1389
|
}, [selectedOption, maxHeight, floatingRef]);
|
|
1063
|
-
const listClasses = (0,
|
|
1390
|
+
const listClasses = (0, import_clsx18.default)("z-dropdown overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow", {
|
|
1064
1391
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1065
1392
|
});
|
|
1066
|
-
const deselectButtonClasses = (0,
|
|
1393
|
+
const deselectButtonClasses = (0, import_clsx18.default)(
|
|
1067
1394
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1068
1395
|
import_component_theme11.focusVisible.inset
|
|
1069
1396
|
);
|
|
1070
|
-
return /* @__PURE__ */ (0,
|
|
1397
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("ul", { className: listClasses, style: { maxHeight, ...floatingStyles }, ref, children: [
|
|
1071
1398
|
children,
|
|
1072
|
-
placeholder != null && selectedOption !== null && /* @__PURE__ */ (0,
|
|
1399
|
+
placeholder != null && selectedOption !== null && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: handleClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1073
1400
|
] });
|
|
1074
1401
|
});
|
|
1075
1402
|
SelectList.displayName = "SelectList";
|
|
1076
1403
|
|
|
1077
1404
|
// src/select/select.tsx
|
|
1078
|
-
var
|
|
1405
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1079
1406
|
var FLOATING_OFFSET = 4;
|
|
1080
1407
|
function Select({
|
|
1081
1408
|
children,
|
|
@@ -1092,16 +1419,16 @@ function Select({
|
|
|
1092
1419
|
onChange,
|
|
1093
1420
|
optionListMaxHeight
|
|
1094
1421
|
}) {
|
|
1095
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
1096
|
-
const targetRef = (0,
|
|
1422
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react20.useState)(false);
|
|
1423
|
+
const targetRef = (0, import_react20.useRef)(null);
|
|
1097
1424
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1098
|
-
const { refs, floatingStyles } = (0,
|
|
1425
|
+
const { refs, floatingStyles } = (0, import_react19.useFloating)({
|
|
1099
1426
|
open: isOptionListOpen,
|
|
1100
1427
|
onOpenChange: setIsOptionListOpen,
|
|
1101
1428
|
placement: "bottom-start",
|
|
1102
1429
|
middleware: [
|
|
1103
|
-
(0,
|
|
1104
|
-
(0,
|
|
1430
|
+
(0, import_react19.offset)(FLOATING_OFFSET),
|
|
1431
|
+
(0, import_react19.size)({
|
|
1105
1432
|
apply({ availableWidth, elements, rects }) {
|
|
1106
1433
|
const referenceWidth = rects.reference.width;
|
|
1107
1434
|
elements.floating.style.minWidth = `${referenceWidth}px`;
|
|
@@ -1109,18 +1436,18 @@ function Select({
|
|
|
1109
1436
|
}
|
|
1110
1437
|
})
|
|
1111
1438
|
],
|
|
1112
|
-
whileElementsMounted:
|
|
1439
|
+
whileElementsMounted: import_react19.autoUpdate
|
|
1113
1440
|
});
|
|
1114
1441
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1115
1442
|
const buttonVariant = isError && !isDisabled ? `${variant}Error` : variant;
|
|
1116
1443
|
const isSelected = isOptionSelected && !isDisabled && selectedOption !== null && !isError;
|
|
1117
|
-
const wrapperClasses = (0,
|
|
1444
|
+
const wrapperClasses = (0, import_clsx19.default)("relative flex shrink-0 items-center gap-1 rounded bg-uiBackground01", {
|
|
1118
1445
|
"h-6": size === "x-small" || size === "small",
|
|
1119
1446
|
"h-8": size === "medium",
|
|
1120
1447
|
"h-10": size === "large",
|
|
1121
1448
|
"cursor-not-allowed": isDisabled
|
|
1122
1449
|
});
|
|
1123
|
-
const buttonClasses = (0,
|
|
1450
|
+
const buttonClasses = (0, import_clsx19.default)(
|
|
1124
1451
|
"flex size-full items-center rounded",
|
|
1125
1452
|
import_component_theme12.selectColors[buttonVariant].hover,
|
|
1126
1453
|
import_component_theme12.selectColors[buttonVariant].active,
|
|
@@ -1135,14 +1462,14 @@ function Select({
|
|
|
1135
1462
|
"border-supportError": !isSelected && !isDisabled && isError
|
|
1136
1463
|
}
|
|
1137
1464
|
);
|
|
1138
|
-
const labelClasses = (0,
|
|
1465
|
+
const labelClasses = (0, import_clsx19.default)("overflow-hidden", {
|
|
1139
1466
|
"mr-1": size === "x-small",
|
|
1140
1467
|
"mr-2": size !== "x-small",
|
|
1141
1468
|
"typography-label12regular": size === "x-small",
|
|
1142
1469
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1143
1470
|
"typography-label16regular": size === "large"
|
|
1144
1471
|
});
|
|
1145
|
-
return /* @__PURE__ */ (0,
|
|
1472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1146
1473
|
SelectContext.Provider,
|
|
1147
1474
|
{
|
|
1148
1475
|
value: {
|
|
@@ -1156,8 +1483,8 @@ function Select({
|
|
|
1156
1483
|
floatingStyles,
|
|
1157
1484
|
floatingRef: refs.floating
|
|
1158
1485
|
},
|
|
1159
|
-
children: /* @__PURE__ */ (0,
|
|
1160
|
-
/* @__PURE__ */ (0,
|
|
1486
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: wrapperClasses, style: { width, maxWidth }, ref: targetRef, children: [
|
|
1487
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
1161
1488
|
"button",
|
|
1162
1489
|
{
|
|
1163
1490
|
ref: refs.setReference,
|
|
@@ -1166,9 +1493,9 @@ function Select({
|
|
|
1166
1493
|
onClick: handleClickToggle,
|
|
1167
1494
|
disabled: isDisabled,
|
|
1168
1495
|
children: [
|
|
1169
|
-
selectedOption?.icon ? /* @__PURE__ */ (0,
|
|
1170
|
-
/* @__PURE__ */ (0,
|
|
1171
|
-
/* @__PURE__ */ (0,
|
|
1496
|
+
selectedOption?.icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mr-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon, { name: selectedOption.icon, size: size === "large" ? "medium" : "small" }) }) : placeholder != null && placeholderIcon && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mr-1 flex", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Icon, { name: placeholderIcon, size: size === "large" ? "medium" : "small" }) }),
|
|
1497
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: labelClasses, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "truncate", children: selectedOption ? selectedOption.label : placeholder != null && placeholder }) }),
|
|
1498
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
1172
1499
|
Icon,
|
|
1173
1500
|
{
|
|
1174
1501
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1178,7 +1505,7 @@ function Select({
|
|
|
1178
1505
|
]
|
|
1179
1506
|
}
|
|
1180
1507
|
),
|
|
1181
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
1508
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_react19.FloatingPortal, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "relative z-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SelectList, { ref: refs.setFloating, maxHeight: optionListMaxHeight, children }) }) })
|
|
1182
1509
|
] })
|
|
1183
1510
|
}
|
|
1184
1511
|
);
|
|
@@ -1186,7 +1513,7 @@ function Select({
|
|
|
1186
1513
|
Select.Option = SelectItem;
|
|
1187
1514
|
|
|
1188
1515
|
// src/pagination-select/pagination-select.tsx
|
|
1189
|
-
var
|
|
1516
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1190
1517
|
function PaginationSelect({
|
|
1191
1518
|
totalSize,
|
|
1192
1519
|
currentPage,
|
|
@@ -1209,14 +1536,14 @@ function PaginationSelect({
|
|
|
1209
1536
|
});
|
|
1210
1537
|
const minCount = totalSize ? (currentPage - 1) * sizePerPage + 1 : 0;
|
|
1211
1538
|
const maxCount = currentPage * sizePerPage > totalSize ? totalSize : currentPage * sizePerPage;
|
|
1212
|
-
return /* @__PURE__ */ (0,
|
|
1213
|
-
/* @__PURE__ */ (0,
|
|
1214
|
-
/* @__PURE__ */ (0,
|
|
1539
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("nav", { "aria-label": "pagination", className: "flex items-center gap-x-1", children: [
|
|
1540
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-x-2", children: [
|
|
1541
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "typography-label14regular text-text01", children: [
|
|
1215
1542
|
minCount > 0 && `${minCount} - `,
|
|
1216
1543
|
maxCount,
|
|
1217
1544
|
countLabel
|
|
1218
1545
|
] }),
|
|
1219
|
-
/* @__PURE__ */ (0,
|
|
1546
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1220
1547
|
Select,
|
|
1221
1548
|
{
|
|
1222
1549
|
size: "medium",
|
|
@@ -1225,17 +1552,17 @@ function PaginationSelect({
|
|
|
1225
1552
|
optionListMaxHeight,
|
|
1226
1553
|
onChange: (option) => option && onChange(Number(option.value)),
|
|
1227
1554
|
isDisabled: pageMax === 0,
|
|
1228
|
-
children: optionsList.map((option) => /* @__PURE__ */ (0,
|
|
1555
|
+
children: optionsList.map((option) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Select.Option, { option }, option.id))
|
|
1229
1556
|
}
|
|
1230
1557
|
),
|
|
1231
|
-
/* @__PURE__ */ (0,
|
|
1558
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "typography-label14regular text-text02", children: [
|
|
1232
1559
|
"/ ",
|
|
1233
1560
|
pageMax,
|
|
1234
1561
|
pageLabel
|
|
1235
1562
|
] })
|
|
1236
1563
|
] }),
|
|
1237
|
-
/* @__PURE__ */ (0,
|
|
1238
|
-
/* @__PURE__ */ (0,
|
|
1564
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center", children: [
|
|
1565
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1239
1566
|
IconButton,
|
|
1240
1567
|
{
|
|
1241
1568
|
variant: "text",
|
|
@@ -1245,7 +1572,7 @@ function PaginationSelect({
|
|
|
1245
1572
|
onClick: onClickPrevButton
|
|
1246
1573
|
}
|
|
1247
1574
|
),
|
|
1248
|
-
/* @__PURE__ */ (0,
|
|
1575
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
1249
1576
|
IconButton,
|
|
1250
1577
|
{
|
|
1251
1578
|
variant: "text",
|
|
@@ -1260,50 +1587,182 @@ function PaginationSelect({
|
|
|
1260
1587
|
}
|
|
1261
1588
|
|
|
1262
1589
|
// src/password-input/password-input.tsx
|
|
1590
|
+
var import_react25 = require("react");
|
|
1591
|
+
|
|
1592
|
+
// src/text-input/text-input.tsx
|
|
1593
|
+
var import_clsx22 = require("clsx");
|
|
1594
|
+
var import_react24 = require("react");
|
|
1595
|
+
|
|
1596
|
+
// src/text-input/text-input-context.tsx
|
|
1263
1597
|
var import_react21 = require("react");
|
|
1598
|
+
var TextInputCompoundContext = (0, import_react21.createContext)(null);
|
|
1599
|
+
var useTextInputCompoundContext = (componentName) => {
|
|
1600
|
+
const context = (0, import_react21.useContext)(TextInputCompoundContext);
|
|
1601
|
+
if (context == null) {
|
|
1602
|
+
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextInput \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
1603
|
+
}
|
|
1604
|
+
return context;
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
// src/text-input/text-input-error-message.tsx
|
|
1608
|
+
var import_clsx20 = require("clsx");
|
|
1609
|
+
var import_react22 = require("react");
|
|
1610
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1611
|
+
var TextInputErrorMessage = (0, import_react22.forwardRef)(
|
|
1612
|
+
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
1613
|
+
const { inputProps } = useTextInputCompoundContext("TextInput.ErrorMessage");
|
|
1614
|
+
const typographyClass = inputProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
1615
|
+
const shouldRender = inputProps.isError === true;
|
|
1616
|
+
if (!shouldRender) {
|
|
1617
|
+
return null;
|
|
1618
|
+
}
|
|
1619
|
+
const errorMessageClassName = (0, import_clsx20.clsx)(typographyClass, "text-supportError");
|
|
1620
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
1621
|
+
}
|
|
1622
|
+
);
|
|
1623
|
+
TextInputErrorMessage.displayName = "TextInput.ErrorMessage";
|
|
1624
|
+
|
|
1625
|
+
// src/text-input/text-input-helper-message.tsx
|
|
1626
|
+
var import_clsx21 = require("clsx");
|
|
1627
|
+
var import_react23 = require("react");
|
|
1628
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1629
|
+
var TextInputHelperMessage = (0, import_react23.forwardRef)((props, ref) => {
|
|
1630
|
+
const { inputProps } = useTextInputCompoundContext("TextInput.HelperMessage");
|
|
1631
|
+
const typographyClass = inputProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
1632
|
+
const helperMessageClassName = (0, import_clsx21.clsx)(typographyClass, "text-text02");
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { ref, className: helperMessageClassName, ...props });
|
|
1634
|
+
});
|
|
1635
|
+
TextInputHelperMessage.displayName = "TextInput.HelperMessage";
|
|
1264
1636
|
|
|
1265
1637
|
// src/text-input/text-input.tsx
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
]
|
|
1638
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1639
|
+
function TextInputInner({
|
|
1640
|
+
size = "medium",
|
|
1641
|
+
isError = false,
|
|
1642
|
+
disabled = false,
|
|
1643
|
+
onClickClearButton,
|
|
1644
|
+
after,
|
|
1645
|
+
children,
|
|
1646
|
+
...props
|
|
1647
|
+
}, ref) {
|
|
1648
|
+
const autoGeneratedId = (0, import_react24.useId)();
|
|
1649
|
+
const { className: _className, ...restInputProps } = props;
|
|
1650
|
+
const inputPropsForContext = (0, import_react24.useMemo)(
|
|
1651
|
+
() => ({
|
|
1652
|
+
...restInputProps,
|
|
1653
|
+
size,
|
|
1654
|
+
isError,
|
|
1655
|
+
disabled,
|
|
1656
|
+
onClickClearButton,
|
|
1657
|
+
after
|
|
1658
|
+
}),
|
|
1659
|
+
[restInputProps, size, isError, disabled, onClickClearButton, after]
|
|
1660
|
+
);
|
|
1661
|
+
const contextValue = (0, import_react24.useMemo)(
|
|
1662
|
+
() => ({
|
|
1663
|
+
inputProps: inputPropsForContext,
|
|
1664
|
+
forwardedRef: ref
|
|
1665
|
+
}),
|
|
1666
|
+
[inputPropsForContext, ref]
|
|
1667
|
+
);
|
|
1668
|
+
const helperMessageIds = [];
|
|
1669
|
+
const errorIds = [];
|
|
1670
|
+
const describedByBaseId = restInputProps.id ?? autoGeneratedId;
|
|
1671
|
+
const enhancedChildren = import_react24.Children.map(children, (child) => {
|
|
1672
|
+
if (!(0, import_react24.isValidElement)(child)) {
|
|
1673
|
+
return child;
|
|
1674
|
+
}
|
|
1675
|
+
if (child.type === TextInputHelperMessage) {
|
|
1676
|
+
const helperChild = child;
|
|
1677
|
+
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
1678
|
+
helperMessageIds.push(assignedId);
|
|
1679
|
+
return (0, import_react24.cloneElement)(helperChild, { id: assignedId });
|
|
1680
|
+
}
|
|
1681
|
+
if (child.type === TextInputErrorMessage && isError) {
|
|
1682
|
+
const errorChild = child;
|
|
1683
|
+
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
1684
|
+
errorIds.push(assignedId);
|
|
1685
|
+
return (0, import_react24.cloneElement)(errorChild, { id: assignedId });
|
|
1686
|
+
}
|
|
1687
|
+
return child;
|
|
1688
|
+
});
|
|
1689
|
+
const describedByFromProps = typeof restInputProps["aria-describedby"] === "string" ? restInputProps["aria-describedby"] : null;
|
|
1690
|
+
const describedByList = [describedByFromProps, ...helperMessageIds, ...errorIds].filter(
|
|
1691
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
1692
|
+
);
|
|
1693
|
+
const describedByProps = describedByList.length > 0 ? {
|
|
1694
|
+
"aria-describedby": describedByList.join(" ")
|
|
1695
|
+
} : {};
|
|
1696
|
+
const shouldMarkInvalid = isError === true || errorIds.length > 0;
|
|
1697
|
+
const ariaInvalidFromProps = restInputProps["aria-invalid"];
|
|
1698
|
+
const ariaInvalidValue = ariaInvalidFromProps != null ? ariaInvalidFromProps : shouldMarkInvalid ? true : null;
|
|
1699
|
+
const ariaInvalidProps = ariaInvalidValue == null ? {} : { "aria-invalid": ariaInvalidValue };
|
|
1700
|
+
const mergedInputProps = {
|
|
1701
|
+
...restInputProps,
|
|
1702
|
+
...describedByProps,
|
|
1703
|
+
...ariaInvalidProps,
|
|
1704
|
+
disabled
|
|
1705
|
+
};
|
|
1706
|
+
const isShowClearButton = !!onClickClearButton && restInputProps.value.length !== 0 && !disabled;
|
|
1707
|
+
const hasTrailingElement = isShowClearButton || after != null;
|
|
1708
|
+
const inputWrapClasses = (0, import_clsx22.clsx)("relative flex items-center gap-2 overflow-hidden rounded border", {
|
|
1709
|
+
"border-uiBorder02": !isError && !disabled,
|
|
1710
|
+
"border-supportError": isError && !disabled,
|
|
1711
|
+
"hover:border-hoverInput": !disabled && !isError,
|
|
1712
|
+
"hover:focus-within:border-activeInput": !isError,
|
|
1713
|
+
"focus-within:border-activeInput": !isError,
|
|
1714
|
+
"bg-disabled02 border-disabled01": disabled,
|
|
1715
|
+
"pr-2": size === "medium" && hasTrailingElement,
|
|
1716
|
+
"pr-3": size === "large" && hasTrailingElement
|
|
1717
|
+
});
|
|
1718
|
+
const inputClasses = (0, import_clsx22.clsx)("flex-1 outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder", {
|
|
1719
|
+
["typography-label14regular min-h-8 px-2"]: size === "medium",
|
|
1720
|
+
["typography-label16regular min-h-10 px-3"]: size === "large",
|
|
1721
|
+
"text-text01": !isError,
|
|
1722
|
+
"text-supportError": isError,
|
|
1723
|
+
"pr-0": hasTrailingElement
|
|
1724
|
+
});
|
|
1725
|
+
const inputElement = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: inputWrapClasses, children: [
|
|
1726
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)("input", { ref, size: 1, className: inputClasses, ...mergedInputProps }),
|
|
1727
|
+
after,
|
|
1728
|
+
isShowClearButton && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(IconButton, { variant: "text", icon: "close", size: "small", onClick: onClickClearButton })
|
|
1729
|
+
] });
|
|
1730
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react24.Children.toArray(enhancedChildren);
|
|
1731
|
+
const hasMessageChildren = stackedChildren.length > 0;
|
|
1732
|
+
if (!hasMessageChildren) {
|
|
1733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TextInputCompoundContext.Provider, { value: contextValue, children: inputElement });
|
|
1734
|
+
}
|
|
1735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(TextInputCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
1736
|
+
inputElement,
|
|
1737
|
+
stackedChildren
|
|
1738
|
+
] }) });
|
|
1739
|
+
}
|
|
1740
|
+
var attachStatics = (component) => {
|
|
1741
|
+
component.HelperMessage = TextInputHelperMessage;
|
|
1742
|
+
component.ErrorMessage = TextInputErrorMessage;
|
|
1743
|
+
component.displayName = "TextInput";
|
|
1744
|
+
return component;
|
|
1745
|
+
};
|
|
1746
|
+
var TextInputPublic = (0, import_react24.forwardRef)(function TextInputPublic2(props, ref) {
|
|
1747
|
+
return TextInputInner(props, ref);
|
|
1748
|
+
});
|
|
1749
|
+
var InternalTextInputBase = (0, import_react24.forwardRef)(
|
|
1750
|
+
function InternalTextInputBase2(props, ref) {
|
|
1751
|
+
return TextInputInner(props, ref);
|
|
1295
1752
|
}
|
|
1296
1753
|
);
|
|
1297
|
-
TextInput
|
|
1754
|
+
var TextInput = attachStatics(TextInputPublic);
|
|
1755
|
+
var InternalTextInput = attachStatics(InternalTextInputBase);
|
|
1298
1756
|
|
|
1299
1757
|
// src/password-input/password-input.tsx
|
|
1300
|
-
var
|
|
1301
|
-
var
|
|
1302
|
-
const [isPasswordVisible, setIsPasswordVisible] = (0,
|
|
1758
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1759
|
+
var PasswordInputBase = (0, import_react25.forwardRef)(function PasswordInput({ disabled = false, children, ...props }, ref) {
|
|
1760
|
+
const [isPasswordVisible, setIsPasswordVisible] = (0, import_react25.useState)(false);
|
|
1761
|
+
const { className: _className, ...textInputProps } = props;
|
|
1303
1762
|
const handlePasswordVisibilityToggle = () => {
|
|
1304
|
-
setIsPasswordVisible(!
|
|
1763
|
+
setIsPasswordVisible((prev) => !prev);
|
|
1305
1764
|
};
|
|
1306
|
-
const passwordToggleButton = /* @__PURE__ */ (0,
|
|
1765
|
+
const passwordToggleButton = /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1307
1766
|
IconButton,
|
|
1308
1767
|
{
|
|
1309
1768
|
variant: "text",
|
|
@@ -1314,41 +1773,303 @@ var PasswordInput = (0, import_react21.forwardRef)(({ disabled = false, ...props
|
|
|
1314
1773
|
"aria-label": isPasswordVisible === true ? "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u975E\u8868\u793A\u306B\u3059\u308B" : "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u8868\u793A\u3059\u308B"
|
|
1315
1774
|
}
|
|
1316
1775
|
);
|
|
1317
|
-
return /* @__PURE__ */ (0,
|
|
1318
|
-
|
|
1776
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1777
|
+
InternalTextInput,
|
|
1319
1778
|
{
|
|
1320
1779
|
ref,
|
|
1321
1780
|
type: isPasswordVisible === true ? "text" : "password",
|
|
1322
1781
|
disabled,
|
|
1323
|
-
|
|
1324
|
-
...
|
|
1782
|
+
after: passwordToggleButton,
|
|
1783
|
+
...textInputProps,
|
|
1784
|
+
children
|
|
1785
|
+
}
|
|
1786
|
+
);
|
|
1787
|
+
});
|
|
1788
|
+
var PasswordInput2 = Object.assign(PasswordInputBase, {
|
|
1789
|
+
HelperMessage: TextInputHelperMessage,
|
|
1790
|
+
ErrorMessage: TextInputErrorMessage,
|
|
1791
|
+
displayName: "PasswordInput"
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
// src/popover/popover.tsx
|
|
1795
|
+
var import_react30 = require("@floating-ui/react");
|
|
1796
|
+
var import_react31 = require("react");
|
|
1797
|
+
|
|
1798
|
+
// src/popover/popover-content.tsx
|
|
1799
|
+
var import_react27 = require("@floating-ui/react");
|
|
1800
|
+
var React = __toESM(require("react"));
|
|
1801
|
+
var import_react28 = require("react");
|
|
1802
|
+
|
|
1803
|
+
// src/utils/react-utils.ts
|
|
1804
|
+
function composeRefs(...refs) {
|
|
1805
|
+
return (node) => {
|
|
1806
|
+
for (const ref of refs) {
|
|
1807
|
+
if (ref == null) {
|
|
1808
|
+
continue;
|
|
1809
|
+
}
|
|
1810
|
+
if (typeof ref === "function") {
|
|
1811
|
+
ref(node);
|
|
1812
|
+
} else {
|
|
1813
|
+
ref.current = node;
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
}
|
|
1818
|
+
function isElement(node) {
|
|
1819
|
+
return node != null && typeof node === "object" && "type" in node;
|
|
1820
|
+
}
|
|
1821
|
+
|
|
1822
|
+
// src/popover/popover-context.ts
|
|
1823
|
+
var import_react26 = require("react");
|
|
1824
|
+
var PopoverContext = (0, import_react26.createContext)(null);
|
|
1825
|
+
var usePopoverContext = () => {
|
|
1826
|
+
const context = (0, import_react26.useContext)(PopoverContext);
|
|
1827
|
+
if (context == null) {
|
|
1828
|
+
throw new Error("Popover components must be used inside <Popover.Root>");
|
|
1829
|
+
}
|
|
1830
|
+
return context;
|
|
1831
|
+
};
|
|
1832
|
+
|
|
1833
|
+
// src/popover/popover-content.tsx
|
|
1834
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1835
|
+
var PopoverContent = (0, import_react28.forwardRef)(function PopoverContent2({ children }, ref) {
|
|
1836
|
+
const { isOpen, triggerRef, floating, panelId, onClose } = usePopoverContext();
|
|
1837
|
+
const shouldCloseOnOutsidePress = (0, import_react28.useCallback)(
|
|
1838
|
+
(event) => {
|
|
1839
|
+
const target = event.target;
|
|
1840
|
+
if (!(target instanceof Element)) {
|
|
1841
|
+
return true;
|
|
1842
|
+
}
|
|
1843
|
+
const floatingElement = floating.refs.floating.current;
|
|
1844
|
+
const closestOverlay = target.closest(".z-overlay, .z-dropdown");
|
|
1845
|
+
if (closestOverlay !== null && floatingElement instanceof Element) {
|
|
1846
|
+
const isInsideOwnFloating = floatingElement.contains(closestOverlay);
|
|
1847
|
+
return isInsideOwnFloating;
|
|
1848
|
+
}
|
|
1849
|
+
return true;
|
|
1850
|
+
},
|
|
1851
|
+
[floating.refs.floating]
|
|
1852
|
+
);
|
|
1853
|
+
const dismiss = (0, import_react27.useDismiss)(floating.context, {
|
|
1854
|
+
outsidePressEvent: "pointerdown",
|
|
1855
|
+
outsidePress: shouldCloseOnOutsidePress,
|
|
1856
|
+
escapeKey: false
|
|
1857
|
+
});
|
|
1858
|
+
const interactions = (0, import_react27.useInteractions)([dismiss, (0, import_react27.useRole)(floating.context, { role: "dialog" })]);
|
|
1859
|
+
(0, import_react28.useEffect)(() => {
|
|
1860
|
+
if (isOpen) {
|
|
1861
|
+
const element = floating.refs.floating.current;
|
|
1862
|
+
element?.focus?.({ preventScroll: true });
|
|
1863
|
+
}
|
|
1864
|
+
}, [isOpen, floating.refs.floating]);
|
|
1865
|
+
(0, import_react28.useEffect)(() => {
|
|
1866
|
+
if (!isOpen) {
|
|
1867
|
+
triggerRef.current?.focus({ preventScroll: true });
|
|
1868
|
+
}
|
|
1869
|
+
}, [isOpen, triggerRef]);
|
|
1870
|
+
const handleKeyDown = (0, import_react28.useCallback)(
|
|
1871
|
+
(event) => {
|
|
1872
|
+
if (event.key === "Escape") {
|
|
1873
|
+
event.stopPropagation();
|
|
1874
|
+
if (onClose != null) {
|
|
1875
|
+
onClose({ reason: "escape-key-down" });
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
},
|
|
1879
|
+
[onClose]
|
|
1880
|
+
);
|
|
1881
|
+
let wrappedChildren = children;
|
|
1882
|
+
if (isElement(children)) {
|
|
1883
|
+
const childProps = children.props;
|
|
1884
|
+
wrappedChildren = React.cloneElement(children, {
|
|
1885
|
+
...childProps,
|
|
1886
|
+
...childProps.id == null && { id: panelId },
|
|
1887
|
+
...childProps.role == null && { role: "dialog" }
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_react27.FloatingPortal, { children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1891
|
+
"div",
|
|
1892
|
+
{
|
|
1893
|
+
...interactions.getFloatingProps({
|
|
1894
|
+
ref: composeRefs(floating.refs.setFloating, ref),
|
|
1895
|
+
tabIndex: -1,
|
|
1896
|
+
onKeyDown: handleKeyDown,
|
|
1897
|
+
style: {
|
|
1898
|
+
position: floating.strategy,
|
|
1899
|
+
top: floating.y ?? 0,
|
|
1900
|
+
left: floating.x ?? 0,
|
|
1901
|
+
outline: "0"
|
|
1902
|
+
}
|
|
1903
|
+
}),
|
|
1904
|
+
children: wrappedChildren
|
|
1325
1905
|
}
|
|
1906
|
+
) : null });
|
|
1907
|
+
});
|
|
1908
|
+
|
|
1909
|
+
// src/popover/popover-trigger.tsx
|
|
1910
|
+
var React2 = __toESM(require("react"));
|
|
1911
|
+
var import_react29 = require("react");
|
|
1912
|
+
var PopoverTrigger = (0, import_react29.forwardRef)(function PopoverTrigger2({ children }, ref) {
|
|
1913
|
+
const { isOpen, floating, triggerRef, anchorRef, panelId } = usePopoverContext();
|
|
1914
|
+
if (!isElement(children)) {
|
|
1915
|
+
return null;
|
|
1916
|
+
}
|
|
1917
|
+
const handleTriggerRef = (node) => {
|
|
1918
|
+
triggerRef.current = node;
|
|
1919
|
+
if (anchorRef == null) {
|
|
1920
|
+
floating.refs.setReference(node);
|
|
1921
|
+
}
|
|
1922
|
+
if (typeof ref === "function") {
|
|
1923
|
+
ref(node);
|
|
1924
|
+
} else if (ref != null) {
|
|
1925
|
+
ref.current = node;
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
const childProps = children.props;
|
|
1929
|
+
const childRef = childProps.ref;
|
|
1930
|
+
return React2.cloneElement(children, {
|
|
1931
|
+
...childProps,
|
|
1932
|
+
ref: composeRefs(childRef, handleTriggerRef),
|
|
1933
|
+
"aria-haspopup": "dialog",
|
|
1934
|
+
"aria-expanded": isOpen,
|
|
1935
|
+
"aria-controls": panelId
|
|
1936
|
+
});
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
// src/popover/popover.tsx
|
|
1940
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1941
|
+
function Popover({
|
|
1942
|
+
isOpen,
|
|
1943
|
+
children,
|
|
1944
|
+
placement = "top",
|
|
1945
|
+
offset: offsetValue = 8,
|
|
1946
|
+
onClose,
|
|
1947
|
+
anchorRef
|
|
1948
|
+
}) {
|
|
1949
|
+
const triggerRef = (0, import_react31.useRef)(null);
|
|
1950
|
+
const floating = (0, import_react30.useFloating)({
|
|
1951
|
+
open: isOpen,
|
|
1952
|
+
onOpenChange: (open) => {
|
|
1953
|
+
if (!open && onClose != null) {
|
|
1954
|
+
onClose({ reason: "outside-click" });
|
|
1955
|
+
}
|
|
1956
|
+
},
|
|
1957
|
+
placement,
|
|
1958
|
+
middleware: [(0, import_react30.offset)(offsetValue)],
|
|
1959
|
+
whileElementsMounted: import_react30.autoUpdate,
|
|
1960
|
+
strategy: "fixed"
|
|
1961
|
+
});
|
|
1962
|
+
(0, import_react31.useEffect)(() => {
|
|
1963
|
+
if (anchorRef?.current) {
|
|
1964
|
+
floating.refs.setReference(anchorRef.current);
|
|
1965
|
+
}
|
|
1966
|
+
}, [anchorRef, floating.refs]);
|
|
1967
|
+
const contentId = (0, import_react30.useId)() ?? "";
|
|
1968
|
+
const panelId = `${contentId}-panel`;
|
|
1969
|
+
const contextValue = (0, import_react31.useMemo)(
|
|
1970
|
+
() => ({
|
|
1971
|
+
isOpen,
|
|
1972
|
+
triggerRef,
|
|
1973
|
+
anchorRef,
|
|
1974
|
+
floating,
|
|
1975
|
+
contentId,
|
|
1976
|
+
panelId,
|
|
1977
|
+
onClose
|
|
1978
|
+
}),
|
|
1979
|
+
[isOpen, triggerRef, anchorRef, floating, contentId, panelId, onClose]
|
|
1326
1980
|
);
|
|
1981
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(PopoverContext.Provider, { value: contextValue, children });
|
|
1982
|
+
}
|
|
1983
|
+
Popover.Trigger = PopoverTrigger;
|
|
1984
|
+
Popover.Content = PopoverContent;
|
|
1985
|
+
|
|
1986
|
+
// src/popup/popup.tsx
|
|
1987
|
+
var import_react34 = require("react");
|
|
1988
|
+
|
|
1989
|
+
// src/popup/popup-body.tsx
|
|
1990
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1991
|
+
function PopupBody({ children }) {
|
|
1992
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "overflow-y-auto", children });
|
|
1993
|
+
}
|
|
1994
|
+
|
|
1995
|
+
// src/popup/popup-context.ts
|
|
1996
|
+
var import_react32 = require("react");
|
|
1997
|
+
var PopupContext = (0, import_react32.createContext)({
|
|
1998
|
+
isOpen: false,
|
|
1999
|
+
onClose: () => null
|
|
1327
2000
|
});
|
|
1328
|
-
|
|
2001
|
+
|
|
2002
|
+
// src/popup/popup-footer.tsx
|
|
2003
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
2004
|
+
function PopupFooter({ children }) {
|
|
2005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "flex w-full shrink-0 items-center rounded-b-lg px-6 py-3", children });
|
|
2006
|
+
}
|
|
2007
|
+
|
|
2008
|
+
// src/popup/popup-header.tsx
|
|
2009
|
+
var import_react33 = require("react");
|
|
2010
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
2011
|
+
function PopupHeader({ children, before }) {
|
|
2012
|
+
const { onClose } = (0, import_react33.useContext)(PopupContext);
|
|
2013
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "typography-h5 flex h-12 w-full shrink-0 items-start justify-between rounded-t-lg px-6 pt-3 text-text01", children: [
|
|
2014
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2015
|
+
before,
|
|
2016
|
+
children
|
|
2017
|
+
] }),
|
|
2018
|
+
onClose && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(IconButton, { icon: "close", size: "small", variant: "text", onClick: onClose })
|
|
2019
|
+
] });
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
// src/popup/popup.tsx
|
|
2023
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
2024
|
+
var LIMIT_WIDTH2 = 320;
|
|
2025
|
+
var LIMIT_HEIGHT2 = 184;
|
|
2026
|
+
function useOptionalPopoverContext() {
|
|
2027
|
+
return (0, import_react34.useContext)(PopoverContext);
|
|
2028
|
+
}
|
|
2029
|
+
function Popup({ children, isOpen: controlledIsOpen, width = 480, height, onClose }) {
|
|
2030
|
+
const renderWidth = typeof width === "number" ? Math.max(width, LIMIT_WIDTH2) : width;
|
|
2031
|
+
const renderHeight = typeof height === "number" ? Math.max(height, LIMIT_HEIGHT2) : height;
|
|
2032
|
+
const popoverContext = useOptionalPopoverContext();
|
|
2033
|
+
const isInPopover = popoverContext != null;
|
|
2034
|
+
const isOpen = isInPopover ? popoverContext.isOpen : controlledIsOpen ?? false;
|
|
2035
|
+
if (!isOpen) {
|
|
2036
|
+
return null;
|
|
2037
|
+
}
|
|
2038
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PopupContext.Provider, { value: { isOpen, onClose }, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
2039
|
+
"div",
|
|
2040
|
+
{
|
|
2041
|
+
className: "grid max-h-full grid-rows-[max-content_1fr_max-content] flex-col rounded-lg bg-uiBackground01 shadow-floatingShadow",
|
|
2042
|
+
style: { width: renderWidth, height: renderHeight },
|
|
2043
|
+
children
|
|
2044
|
+
}
|
|
2045
|
+
) });
|
|
2046
|
+
}
|
|
2047
|
+
Popup.Body = PopupBody;
|
|
2048
|
+
Popup.Header = PopupHeader;
|
|
2049
|
+
Popup.Footer = PopupFooter;
|
|
1329
2050
|
|
|
1330
2051
|
// src/radio/radio.tsx
|
|
1331
2052
|
var import_component_theme13 = require("@zenkigen-inc/component-theme");
|
|
1332
|
-
var
|
|
1333
|
-
var
|
|
1334
|
-
var
|
|
2053
|
+
var import_clsx23 = __toESM(require("clsx"));
|
|
2054
|
+
var import_react35 = require("react");
|
|
2055
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1335
2056
|
function Radio({ name, value, id, label, isChecked = false, isDisabled = false, onChange }) {
|
|
1336
|
-
const [isMouseOver, setIsMouseOver] = (0,
|
|
1337
|
-
const handleMouseOverInput = (0,
|
|
2057
|
+
const [isMouseOver, setIsMouseOver] = (0, import_react35.useState)(false);
|
|
2058
|
+
const handleMouseOverInput = (0, import_react35.useCallback)(() => {
|
|
1338
2059
|
setIsMouseOver(true);
|
|
1339
2060
|
}, []);
|
|
1340
|
-
const handleMouseOutInput = (0,
|
|
2061
|
+
const handleMouseOutInput = (0, import_react35.useCallback)(() => {
|
|
1341
2062
|
setIsMouseOver(false);
|
|
1342
2063
|
}, []);
|
|
1343
|
-
const handleChange = (0,
|
|
2064
|
+
const handleChange = (0, import_react35.useCallback)(
|
|
1344
2065
|
(e) => !isDisabled && onChange?.(e),
|
|
1345
2066
|
[isDisabled, onChange]
|
|
1346
2067
|
);
|
|
1347
|
-
const inputClasses = (0,
|
|
2068
|
+
const inputClasses = (0, import_clsx23.default)("peer absolute z-[1] size-6 opacity-0", {
|
|
1348
2069
|
"cursor-not-allowed": isDisabled,
|
|
1349
2070
|
"cursor-pointer": !isDisabled
|
|
1350
2071
|
});
|
|
1351
|
-
const boxClasses = (0,
|
|
2072
|
+
const boxClasses = (0, import_clsx23.default)(
|
|
1352
2073
|
"inline-flex size-5 items-center justify-center rounded-full border border-solid bg-white",
|
|
1353
2074
|
import_component_theme13.focusVisible.normalPeer,
|
|
1354
2075
|
{
|
|
@@ -1359,22 +2080,22 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
1359
2080
|
"cursor-pointer": !isDisabled
|
|
1360
2081
|
}
|
|
1361
2082
|
);
|
|
1362
|
-
const afterClasses = (0,
|
|
2083
|
+
const afterClasses = (0, import_clsx23.default)("absolute inset-0 m-auto block size-3 rounded-full", {
|
|
1363
2084
|
"bg-disabled01": isDisabled && isChecked,
|
|
1364
2085
|
"bg-activeSelectedUi": !isDisabled && isChecked,
|
|
1365
2086
|
"scale-0": !isChecked,
|
|
1366
2087
|
"scale-100": isChecked
|
|
1367
2088
|
});
|
|
1368
|
-
const hoverIndicatorClasses = (0,
|
|
2089
|
+
const hoverIndicatorClasses = (0, import_clsx23.default)("inline-block size-3 rounded-full", {
|
|
1369
2090
|
"bg-hoverUi": !isDisabled && !isChecked && isMouseOver
|
|
1370
2091
|
});
|
|
1371
|
-
const labelClasses = (0,
|
|
2092
|
+
const labelClasses = (0, import_clsx23.default)("typography-label14regular ml-2 flex-[1_0_0] select-none break-all", {
|
|
1372
2093
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
1373
2094
|
"cursor-pointer text-text01": !isDisabled
|
|
1374
2095
|
});
|
|
1375
|
-
return /* @__PURE__ */ (0,
|
|
1376
|
-
/* @__PURE__ */ (0,
|
|
1377
|
-
/* @__PURE__ */ (0,
|
|
2096
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex items-center", children: [
|
|
2097
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex size-6 items-center justify-center", children: [
|
|
2098
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1378
2099
|
"input",
|
|
1379
2100
|
{
|
|
1380
2101
|
type: "checkbox",
|
|
@@ -1389,32 +2110,32 @@ function Radio({ name, value, id, label, isChecked = false, isDisabled = false,
|
|
|
1389
2110
|
className: inputClasses
|
|
1390
2111
|
}
|
|
1391
2112
|
),
|
|
1392
|
-
/* @__PURE__ */ (0,
|
|
1393
|
-
/* @__PURE__ */ (0,
|
|
1394
|
-
/* @__PURE__ */ (0,
|
|
2113
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: boxClasses, children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "relative flex size-5 flex-[0_0_auto] items-center justify-center", children: [
|
|
2114
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: afterClasses }),
|
|
2115
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("span", { className: hoverIndicatorClasses })
|
|
1395
2116
|
] }) })
|
|
1396
2117
|
] }),
|
|
1397
|
-
/* @__PURE__ */ (0,
|
|
2118
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
1398
2119
|
] });
|
|
1399
2120
|
}
|
|
1400
2121
|
|
|
1401
2122
|
// src/search/search.tsx
|
|
1402
|
-
var
|
|
1403
|
-
var
|
|
1404
|
-
var
|
|
1405
|
-
var Search = (0,
|
|
1406
|
-
const classes = (0,
|
|
2123
|
+
var import_clsx24 = require("clsx");
|
|
2124
|
+
var import_react36 = require("react");
|
|
2125
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
2126
|
+
var Search = (0, import_react36.forwardRef)(({ width = "100%", size = "medium", ...props }, ref) => {
|
|
2127
|
+
const classes = (0, import_clsx24.clsx)(
|
|
1407
2128
|
"flex items-center rounded-full border border-uiBorder02 bg-uiBackground01 focus-within:border-activeInput",
|
|
1408
2129
|
{ "h-8 px-3": size === "medium" },
|
|
1409
2130
|
{ "h-10 px-4": size === "large" }
|
|
1410
2131
|
);
|
|
1411
|
-
const inputClasses = (0,
|
|
2132
|
+
const inputClasses = (0, import_clsx24.clsx)("mx-2 h-full flex-1 text-text01 outline-0 placeholder:text-textPlaceholder", {
|
|
1412
2133
|
["typography-label14regular"]: size === "medium",
|
|
1413
2134
|
["typography-label16regular"]: size === "large"
|
|
1414
2135
|
});
|
|
1415
|
-
return /* @__PURE__ */ (0,
|
|
1416
|
-
/* @__PURE__ */ (0,
|
|
1417
|
-
/* @__PURE__ */ (0,
|
|
2136
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "relative", ref, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("form", { onSubmit: props.onSubmit, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: classes, style: { width }, children: [
|
|
2137
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(Icon, { name: "search", color: "icon01", size: "medium" }),
|
|
2138
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1418
2139
|
"input",
|
|
1419
2140
|
{
|
|
1420
2141
|
type: "text",
|
|
@@ -1425,7 +2146,7 @@ var Search = (0, import_react23.forwardRef)(({ width = "100%", size = "medium",
|
|
|
1425
2146
|
onChange: props.onChange
|
|
1426
2147
|
}
|
|
1427
2148
|
),
|
|
1428
|
-
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ (0,
|
|
2149
|
+
props.onClickClearButton && props.value && props.value.length !== 0 && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1429
2150
|
IconButton,
|
|
1430
2151
|
{
|
|
1431
2152
|
variant: "text",
|
|
@@ -1440,17 +2161,17 @@ var Search = (0, import_react23.forwardRef)(({ width = "100%", size = "medium",
|
|
|
1440
2161
|
Search.displayName = "Search";
|
|
1441
2162
|
|
|
1442
2163
|
// src/segmented-control/segmented-control.tsx
|
|
1443
|
-
var
|
|
2164
|
+
var import_react39 = __toESM(require("react"));
|
|
1444
2165
|
|
|
1445
2166
|
// src/segmented-control/segmented-control-context.ts
|
|
1446
|
-
var
|
|
1447
|
-
var SegmentedControlContext = (0,
|
|
2167
|
+
var import_react37 = require("react");
|
|
2168
|
+
var SegmentedControlContext = (0, import_react37.createContext)(null);
|
|
1448
2169
|
|
|
1449
2170
|
// src/segmented-control/segmented-control-item.tsx
|
|
1450
2171
|
var import_component_theme14 = require("@zenkigen-inc/component-theme");
|
|
1451
|
-
var
|
|
1452
|
-
var
|
|
1453
|
-
var
|
|
2172
|
+
var import_clsx25 = require("clsx");
|
|
2173
|
+
var import_react38 = require("react");
|
|
2174
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1454
2175
|
var SegmentedControlItem = ({
|
|
1455
2176
|
label,
|
|
1456
2177
|
value,
|
|
@@ -1459,9 +2180,9 @@ var SegmentedControlItem = ({
|
|
|
1459
2180
|
"aria-label": ariaLabel,
|
|
1460
2181
|
...rest
|
|
1461
2182
|
}) => {
|
|
1462
|
-
const context = (0,
|
|
1463
|
-
const buttonRef = (0,
|
|
1464
|
-
const lastInteractionWasMouse = (0,
|
|
2183
|
+
const context = (0, import_react38.useContext)(SegmentedControlContext);
|
|
2184
|
+
const buttonRef = (0, import_react38.useRef)(null);
|
|
2185
|
+
const lastInteractionWasMouse = (0, import_react38.useRef)(false);
|
|
1465
2186
|
if (context === null) {
|
|
1466
2187
|
throw new Error("SegmentedControl.Item must be used within SegmentedControl");
|
|
1467
2188
|
}
|
|
@@ -1477,7 +2198,7 @@ var SegmentedControlItem = ({
|
|
|
1477
2198
|
const isSelected = value === selectedValue;
|
|
1478
2199
|
const isFocused = value === focusedValue;
|
|
1479
2200
|
const isOptionDisabled = isContextDisabled || itemDisabled === true;
|
|
1480
|
-
(0,
|
|
2201
|
+
(0, import_react38.useEffect)(() => {
|
|
1481
2202
|
if (isFocused === true && buttonRef.current !== null) {
|
|
1482
2203
|
buttonRef.current.focus();
|
|
1483
2204
|
}
|
|
@@ -1499,7 +2220,7 @@ var SegmentedControlItem = ({
|
|
|
1499
2220
|
lastInteractionWasMouse.current = false;
|
|
1500
2221
|
onBlur?.();
|
|
1501
2222
|
};
|
|
1502
|
-
const buttonClasses = (0,
|
|
2223
|
+
const buttonClasses = (0, import_clsx25.clsx)("relative flex items-center justify-center gap-1 rounded", import_component_theme14.focusVisible.normal, {
|
|
1503
2224
|
"px-2 min-h-[24px] typography-label12regular": size === "small",
|
|
1504
2225
|
"px-4 min-h-[32px] typography-label14regular": size === "medium",
|
|
1505
2226
|
// States - Default with hover
|
|
@@ -1509,7 +2230,7 @@ var SegmentedControlItem = ({
|
|
|
1509
2230
|
// States - Disabled
|
|
1510
2231
|
"text-disabled01 bg-transparent": isOptionDisabled === true
|
|
1511
2232
|
});
|
|
1512
|
-
return /* @__PURE__ */ (0,
|
|
2233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
1513
2234
|
"button",
|
|
1514
2235
|
{
|
|
1515
2236
|
ref: buttonRef,
|
|
@@ -1526,25 +2247,25 @@ var SegmentedControlItem = ({
|
|
|
1526
2247
|
onMouseDown: handleMouseDown,
|
|
1527
2248
|
...rest,
|
|
1528
2249
|
children: [
|
|
1529
|
-
Boolean(icon) === true && icon && /* @__PURE__ */ (0,
|
|
2250
|
+
Boolean(icon) === true && icon && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
1530
2251
|
"span",
|
|
1531
2252
|
{
|
|
1532
|
-
className: (0,
|
|
2253
|
+
className: (0, import_clsx25.clsx)("flex items-center", {
|
|
1533
2254
|
"fill-disabled01": isOptionDisabled === true,
|
|
1534
2255
|
"fill-interactive01": isSelected === true && isOptionDisabled === false,
|
|
1535
2256
|
"fill-icon01": isSelected === false && isOptionDisabled === false
|
|
1536
2257
|
}),
|
|
1537
|
-
children: /* @__PURE__ */ (0,
|
|
2258
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Icon, { name: icon, size: "small" })
|
|
1538
2259
|
}
|
|
1539
2260
|
),
|
|
1540
|
-
Boolean(label) === true && /* @__PURE__ */ (0,
|
|
2261
|
+
Boolean(label) === true && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("span", { className: "whitespace-nowrap", children: label })
|
|
1541
2262
|
]
|
|
1542
2263
|
}
|
|
1543
2264
|
);
|
|
1544
2265
|
};
|
|
1545
2266
|
|
|
1546
2267
|
// src/segmented-control/segmented-control.tsx
|
|
1547
|
-
var
|
|
2268
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1548
2269
|
var SegmentedControl = ({
|
|
1549
2270
|
children,
|
|
1550
2271
|
value,
|
|
@@ -1554,15 +2275,15 @@ var SegmentedControl = ({
|
|
|
1554
2275
|
"aria-label": ariaLabel,
|
|
1555
2276
|
...rest
|
|
1556
2277
|
}) => {
|
|
1557
|
-
const containerRef = (0,
|
|
1558
|
-
const itemIds =
|
|
1559
|
-
if (!
|
|
2278
|
+
const containerRef = (0, import_react39.useRef)(null);
|
|
2279
|
+
const itemIds = import_react39.Children.toArray(children).filter((child) => {
|
|
2280
|
+
if (!import_react39.default.isValidElement(child) || typeof child.props !== "object" || child.props === null || !("value" in child.props)) {
|
|
1560
2281
|
return false;
|
|
1561
2282
|
}
|
|
1562
2283
|
const props = child.props;
|
|
1563
2284
|
return props.isDisabled !== true;
|
|
1564
2285
|
}).map((child) => child.props.value);
|
|
1565
|
-
const childrenCount =
|
|
2286
|
+
const childrenCount = import_react39.Children.count(children);
|
|
1566
2287
|
const containerStyle = { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` };
|
|
1567
2288
|
const {
|
|
1568
2289
|
focusedValue,
|
|
@@ -1589,7 +2310,7 @@ var SegmentedControl = ({
|
|
|
1589
2310
|
onBlur: handleBlurRovingFocus,
|
|
1590
2311
|
values: itemIds
|
|
1591
2312
|
};
|
|
1592
|
-
return /* @__PURE__ */ (0,
|
|
2313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_jsx_runtime41.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(SegmentedControlContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
1593
2314
|
"div",
|
|
1594
2315
|
{
|
|
1595
2316
|
ref: containerRef,
|
|
@@ -1607,19 +2328,19 @@ SegmentedControl.Item = SegmentedControlItem;
|
|
|
1607
2328
|
|
|
1608
2329
|
// src/select-sort/select-sort.tsx
|
|
1609
2330
|
var import_component_theme17 = require("@zenkigen-inc/component-theme");
|
|
1610
|
-
var
|
|
1611
|
-
var
|
|
2331
|
+
var import_clsx28 = __toESM(require("clsx"));
|
|
2332
|
+
var import_react40 = require("react");
|
|
1612
2333
|
|
|
1613
2334
|
// src/select-sort/select-list.tsx
|
|
1614
2335
|
var import_component_theme16 = require("@zenkigen-inc/component-theme");
|
|
1615
|
-
var
|
|
2336
|
+
var import_clsx27 = __toESM(require("clsx"));
|
|
1616
2337
|
|
|
1617
2338
|
// src/select-sort/select-item.tsx
|
|
1618
2339
|
var import_component_theme15 = require("@zenkigen-inc/component-theme");
|
|
1619
|
-
var
|
|
1620
|
-
var
|
|
2340
|
+
var import_clsx26 = __toESM(require("clsx"));
|
|
2341
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
1621
2342
|
function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
1622
|
-
const itemClasses = (0,
|
|
2343
|
+
const itemClasses = (0, import_clsx26.default)(
|
|
1623
2344
|
"typography-label14regular flex h-8 w-full items-center px-3 hover:bg-hover02 active:bg-active02",
|
|
1624
2345
|
import_component_theme15.focusVisible.inset,
|
|
1625
2346
|
{
|
|
@@ -1627,16 +2348,16 @@ function SelectItem2({ children, isSortKey, onClickItem }) {
|
|
|
1627
2348
|
"bg-uiBackground01 fill-icon01 text-interactive02": !isSortKey
|
|
1628
2349
|
}
|
|
1629
2350
|
);
|
|
1630
|
-
return /* @__PURE__ */ (0,
|
|
1631
|
-
/* @__PURE__ */ (0,
|
|
1632
|
-
isSortKey && /* @__PURE__ */ (0,
|
|
2351
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("li", { className: "flex w-full items-center", onClick: onClickItem, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("button", { className: itemClasses, type: "button", children: [
|
|
2352
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("span", { className: "ml-1 mr-6", children }),
|
|
2353
|
+
isSortKey && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Icon, { name: "check", size: "small" }) })
|
|
1633
2354
|
] }) });
|
|
1634
2355
|
}
|
|
1635
2356
|
|
|
1636
2357
|
// src/select-sort/select-list.tsx
|
|
1637
|
-
var
|
|
2358
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
1638
2359
|
function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect }) {
|
|
1639
|
-
const listClasses = (0,
|
|
2360
|
+
const listClasses = (0, import_clsx27.default)(
|
|
1640
2361
|
"absolute z-dropdown w-max overflow-y-auto rounded bg-uiBackground01 py-2 shadow-floatingShadow",
|
|
1641
2362
|
{
|
|
1642
2363
|
"top-7": size === "x-small" || size === "small",
|
|
@@ -1645,19 +2366,19 @@ function SelectList2({ size, variant, sortOrder, onClickItem, onClickDeselect })
|
|
|
1645
2366
|
"border-solid border border-uiBorder01": variant === "outline"
|
|
1646
2367
|
}
|
|
1647
2368
|
);
|
|
1648
|
-
const deselectButtonClasses = (0,
|
|
2369
|
+
const deselectButtonClasses = (0, import_clsx27.default)(
|
|
1649
2370
|
"typography-label14regular flex h-8 w-full items-center px-3 text-interactive02 hover:bg-hover02 active:bg-active02",
|
|
1650
2371
|
import_component_theme16.focusVisible.inset
|
|
1651
2372
|
);
|
|
1652
|
-
return /* @__PURE__ */ (0,
|
|
1653
|
-
/* @__PURE__ */ (0,
|
|
1654
|
-
/* @__PURE__ */ (0,
|
|
1655
|
-
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0,
|
|
2373
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("ul", { className: listClasses, children: [
|
|
2374
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SelectItem2, { isSortKey: sortOrder === "ascend", onClickItem: () => onClickItem("ascend"), children: "\u6607\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
2375
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(SelectItem2, { isSortKey: sortOrder === "descend", onClickItem: () => onClickItem("descend"), children: "\u964D\u9806\u3067\u4E26\u3073\u66FF\u3048" }),
|
|
2376
|
+
sortOrder !== null && onClickDeselect && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("button", { className: deselectButtonClasses, type: "button", onClick: onClickDeselect, children: "\u9078\u629E\u89E3\u9664" }) })
|
|
1656
2377
|
] });
|
|
1657
2378
|
}
|
|
1658
2379
|
|
|
1659
2380
|
// src/select-sort/select-sort.tsx
|
|
1660
|
-
var
|
|
2381
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
1661
2382
|
function SelectSort({
|
|
1662
2383
|
size = "medium",
|
|
1663
2384
|
variant = "outline",
|
|
@@ -1669,24 +2390,24 @@ function SelectSort({
|
|
|
1669
2390
|
onChange,
|
|
1670
2391
|
onClickDeselect
|
|
1671
2392
|
}) {
|
|
1672
|
-
const [isOptionListOpen, setIsOptionListOpen] = (0,
|
|
1673
|
-
const targetRef = (0,
|
|
2393
|
+
const [isOptionListOpen, setIsOptionListOpen] = (0, import_react40.useState)(false);
|
|
2394
|
+
const targetRef = (0, import_react40.useRef)(null);
|
|
1674
2395
|
useOutsideClick(targetRef, () => setIsOptionListOpen(false));
|
|
1675
2396
|
const handleClickToggle = () => setIsOptionListOpen((prev) => !prev);
|
|
1676
|
-
const handleClickItem = (0,
|
|
2397
|
+
const handleClickItem = (0, import_react40.useCallback)(
|
|
1677
2398
|
(value) => {
|
|
1678
2399
|
onChange?.(value);
|
|
1679
2400
|
setIsOptionListOpen(false);
|
|
1680
2401
|
},
|
|
1681
2402
|
[onChange]
|
|
1682
2403
|
);
|
|
1683
|
-
const wrapperClasses = (0,
|
|
2404
|
+
const wrapperClasses = (0, import_clsx28.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1684
2405
|
"h-6": size === "x-small" || size === "small",
|
|
1685
2406
|
"h-8": size === "medium",
|
|
1686
2407
|
"h-10": size === "large",
|
|
1687
2408
|
"cursor-not-allowed": isDisabled
|
|
1688
2409
|
});
|
|
1689
|
-
const buttonClasses = (0,
|
|
2410
|
+
const buttonClasses = (0, import_clsx28.default)(
|
|
1690
2411
|
"flex size-full items-center rounded",
|
|
1691
2412
|
import_component_theme17.buttonColors[variant].hover,
|
|
1692
2413
|
import_component_theme17.buttonColors[variant].active,
|
|
@@ -1700,23 +2421,23 @@ function SelectSort({
|
|
|
1700
2421
|
"pointer-events-none": isDisabled
|
|
1701
2422
|
}
|
|
1702
2423
|
);
|
|
1703
|
-
const labelClasses = (0,
|
|
2424
|
+
const labelClasses = (0, import_clsx28.default)("truncate", {
|
|
1704
2425
|
"typography-label12regular": size === "x-small",
|
|
1705
2426
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1706
2427
|
"typography-label16regular": size === "large",
|
|
1707
2428
|
"mr-1": size === "x-small",
|
|
1708
2429
|
"mr-2": size !== "x-small"
|
|
1709
2430
|
});
|
|
1710
|
-
return /* @__PURE__ */ (0,
|
|
1711
|
-
/* @__PURE__ */ (0,
|
|
1712
|
-
/* @__PURE__ */ (0,
|
|
1713
|
-
/* @__PURE__ */ (0,
|
|
2431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: wrapperClasses, style: { width }, ref: targetRef, children: [
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("button", { className: buttonClasses, type: "button", onClick: handleClickToggle, disabled: isDisabled, children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: labelClasses, children: label }),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "ml-auto flex items-center", children: isSortKey ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1714
2435
|
Icon,
|
|
1715
2436
|
{
|
|
1716
2437
|
name: sortOrder === "ascend" ? "arrow-up" : "arrow-down",
|
|
1717
2438
|
size: size === "large" ? "medium" : "small"
|
|
1718
2439
|
}
|
|
1719
|
-
) : /* @__PURE__ */ (0,
|
|
2440
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1720
2441
|
Icon,
|
|
1721
2442
|
{
|
|
1722
2443
|
name: isOptionListOpen ? "angle-small-up" : "angle-small-down",
|
|
@@ -1724,7 +2445,7 @@ function SelectSort({
|
|
|
1724
2445
|
}
|
|
1725
2446
|
) })
|
|
1726
2447
|
] }),
|
|
1727
|
-
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0,
|
|
2448
|
+
isOptionListOpen && !isDisabled && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1728
2449
|
SelectList2,
|
|
1729
2450
|
{
|
|
1730
2451
|
size,
|
|
@@ -1739,9 +2460,9 @@ function SelectSort({
|
|
|
1739
2460
|
|
|
1740
2461
|
// src/sort-button/sort-button.tsx
|
|
1741
2462
|
var import_component_theme18 = require("@zenkigen-inc/component-theme");
|
|
1742
|
-
var
|
|
1743
|
-
var
|
|
1744
|
-
var
|
|
2463
|
+
var import_clsx29 = __toESM(require("clsx"));
|
|
2464
|
+
var import_react41 = require("react");
|
|
2465
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
1745
2466
|
function SortButton({
|
|
1746
2467
|
size = "medium",
|
|
1747
2468
|
width,
|
|
@@ -1752,7 +2473,7 @@ function SortButton({
|
|
|
1752
2473
|
"aria-label": ariaLabel,
|
|
1753
2474
|
...rest
|
|
1754
2475
|
}) {
|
|
1755
|
-
const handleClick = (0,
|
|
2476
|
+
const handleClick = (0, import_react41.useCallback)(() => {
|
|
1756
2477
|
if (isDisabled || !onClick) return;
|
|
1757
2478
|
onClick();
|
|
1758
2479
|
}, [isDisabled, onClick]);
|
|
@@ -1761,13 +2482,13 @@ function SortButton({
|
|
|
1761
2482
|
if (sortOrder === "descend") return "arrow-down";
|
|
1762
2483
|
return "angle-small-down";
|
|
1763
2484
|
};
|
|
1764
|
-
const wrapperClasses = (0,
|
|
2485
|
+
const wrapperClasses = (0, import_clsx29.default)("relative flex shrink-0 items-center gap-1 rounded", {
|
|
1765
2486
|
"h-6": size === "x-small" || size === "small",
|
|
1766
2487
|
"h-8": size === "medium",
|
|
1767
2488
|
"h-10": size === "large",
|
|
1768
2489
|
"cursor-not-allowed": isDisabled
|
|
1769
2490
|
});
|
|
1770
|
-
const buttonClasses = (0,
|
|
2491
|
+
const buttonClasses = (0, import_clsx29.default)(
|
|
1771
2492
|
"flex size-full items-center rounded",
|
|
1772
2493
|
import_component_theme18.buttonColors.text.hover,
|
|
1773
2494
|
import_component_theme18.buttonColors.text.active,
|
|
@@ -1783,14 +2504,14 @@ function SortButton({
|
|
|
1783
2504
|
"pointer-events-none": isDisabled
|
|
1784
2505
|
}
|
|
1785
2506
|
);
|
|
1786
|
-
const labelClasses = (0,
|
|
2507
|
+
const labelClasses = (0, import_clsx29.default)("truncate", {
|
|
1787
2508
|
"typography-label12regular": size === "x-small",
|
|
1788
2509
|
"typography-label14regular": size === "small" || size === "medium",
|
|
1789
2510
|
"typography-label16regular": size === "large",
|
|
1790
2511
|
"mr-1": size === "x-small",
|
|
1791
2512
|
"mr-2": size !== "x-small"
|
|
1792
2513
|
});
|
|
1793
|
-
return /* @__PURE__ */ (0,
|
|
2514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: wrapperClasses, style: { width }, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
|
|
1794
2515
|
"button",
|
|
1795
2516
|
{
|
|
1796
2517
|
className: buttonClasses,
|
|
@@ -1801,78 +2522,85 @@ function SortButton({
|
|
|
1801
2522
|
"aria-label": ariaLabel,
|
|
1802
2523
|
"aria-disabled": isDisabled,
|
|
1803
2524
|
children: [
|
|
1804
|
-
/* @__PURE__ */ (0,
|
|
1805
|
-
/* @__PURE__ */ (0,
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: labelClasses, children: label }),
|
|
2526
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ml-auto flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Icon, { name: getIconName(), size: size === "large" ? "medium" : "small" }) })
|
|
1806
2527
|
]
|
|
1807
2528
|
}
|
|
1808
2529
|
) });
|
|
1809
2530
|
}
|
|
1810
2531
|
|
|
1811
2532
|
// src/tab/tab.tsx
|
|
1812
|
-
var
|
|
1813
|
-
var
|
|
2533
|
+
var import_clsx31 = require("clsx");
|
|
2534
|
+
var import_react42 = require("react");
|
|
1814
2535
|
|
|
1815
2536
|
// src/tab/tab-item.tsx
|
|
1816
|
-
var
|
|
1817
|
-
var
|
|
1818
|
-
var TabItem = ({ isSelected = false, ...props }) => {
|
|
1819
|
-
const classes = (0,
|
|
1820
|
-
"relative z-0 flex justify-center py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-
|
|
2537
|
+
var import_clsx30 = require("clsx");
|
|
2538
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2539
|
+
var TabItem = ({ isSelected = false, isDisabled = false, icon, ...props }) => {
|
|
2540
|
+
const classes = (0, import_clsx30.clsx)(
|
|
2541
|
+
"group relative z-0 flex items-center justify-center gap-1 py-2 leading-[24px] before:absolute before:inset-x-0 before:bottom-0 before:h-[2px] hover:text-interactive01 disabled:pointer-events-none disabled:text-disabled01",
|
|
1821
2542
|
{
|
|
1822
|
-
"typography-label14regular": !isSelected,
|
|
1823
|
-
"
|
|
1824
|
-
"typography-label14bold": isSelected,
|
|
2543
|
+
"typography-label14regular text-interactive02": !isSelected,
|
|
2544
|
+
"typography-label14bold text-interactive01": isSelected,
|
|
1825
2545
|
"before:bg-interactive01 hover:before:bg-interactive01 pointer-events-none": isSelected
|
|
1826
2546
|
}
|
|
1827
2547
|
);
|
|
1828
|
-
|
|
2548
|
+
const iconWrapperClasses = (0, import_clsx30.clsx)("flex shrink-0 items-center", {
|
|
2549
|
+
"fill-disabled01": isDisabled,
|
|
2550
|
+
"fill-interactive01": !isDisabled && isSelected,
|
|
2551
|
+
"fill-icon01 group-hover:fill-interactive01": !isDisabled && !isSelected
|
|
2552
|
+
});
|
|
2553
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
|
|
1829
2554
|
"button",
|
|
1830
2555
|
{
|
|
1831
2556
|
type: "button",
|
|
1832
2557
|
role: "tab",
|
|
1833
2558
|
"aria-selected": isSelected,
|
|
1834
2559
|
className: classes,
|
|
1835
|
-
disabled:
|
|
2560
|
+
disabled: isDisabled,
|
|
1836
2561
|
onClick: () => props.onClick(props.id),
|
|
1837
|
-
children:
|
|
2562
|
+
children: [
|
|
2563
|
+
icon != null && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("span", { className: iconWrapperClasses, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: icon, size: "small" }) }),
|
|
2564
|
+
props.children
|
|
2565
|
+
]
|
|
1838
2566
|
}
|
|
1839
2567
|
);
|
|
1840
2568
|
};
|
|
1841
2569
|
|
|
1842
2570
|
// src/tab/tab.tsx
|
|
1843
|
-
var
|
|
2571
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
1844
2572
|
function Tab({ children, layout = "auto" }) {
|
|
1845
|
-
const childrenCount =
|
|
2573
|
+
const childrenCount = import_react42.Children.count(children);
|
|
1846
2574
|
const containerStyle = layout === "equal" ? { gridTemplateColumns: `repeat(${childrenCount}, minmax(0,1fr))` } : {};
|
|
1847
|
-
const containerClasses = (0,
|
|
2575
|
+
const containerClasses = (0, import_clsx31.clsx)(
|
|
1848
2576
|
"relative gap-4 px-6 before:absolute before:inset-x-0 before:bottom-0 before:h-px before:bg-uiBorder01",
|
|
1849
2577
|
{
|
|
1850
2578
|
flex: layout === "auto",
|
|
1851
2579
|
grid: layout === "equal"
|
|
1852
2580
|
}
|
|
1853
2581
|
);
|
|
1854
|
-
return /* @__PURE__ */ (0,
|
|
2582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { role: "tablist", className: containerClasses, style: containerStyle, children });
|
|
1855
2583
|
}
|
|
1856
2584
|
Tab.Item = TabItem;
|
|
1857
2585
|
|
|
1858
2586
|
// src/table/table-cell.tsx
|
|
1859
|
-
var
|
|
1860
|
-
var
|
|
2587
|
+
var import_clsx32 = __toESM(require("clsx"));
|
|
2588
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
1861
2589
|
function TableCell({ children, className, isHeader = false }) {
|
|
1862
|
-
const classes = (0,
|
|
1863
|
-
return /* @__PURE__ */ (0,
|
|
2590
|
+
const classes = (0, import_clsx32.default)("border-b border-uiBorder01", { "sticky top-0 z-10 bg-white": isHeader }, className);
|
|
2591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { className: classes, children });
|
|
1864
2592
|
}
|
|
1865
2593
|
|
|
1866
2594
|
// src/table/table-row.tsx
|
|
1867
|
-
var
|
|
1868
|
-
var
|
|
2595
|
+
var import_clsx33 = __toESM(require("clsx"));
|
|
2596
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
1869
2597
|
function TableRow({ children, isHoverBackgroundVisible = false }) {
|
|
1870
|
-
const rowClasses = (0,
|
|
1871
|
-
return /* @__PURE__ */ (0,
|
|
2598
|
+
const rowClasses = (0, import_clsx33.default)("contents", isHoverBackgroundVisible && "[&:hover>div]:bg-hoverUi02");
|
|
2599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: rowClasses, children });
|
|
1872
2600
|
}
|
|
1873
2601
|
|
|
1874
2602
|
// src/table/table.tsx
|
|
1875
|
-
var
|
|
2603
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
1876
2604
|
function Table({
|
|
1877
2605
|
width,
|
|
1878
2606
|
templateRows,
|
|
@@ -1881,7 +2609,7 @@ function Table({
|
|
|
1881
2609
|
autoRows,
|
|
1882
2610
|
children
|
|
1883
2611
|
}) {
|
|
1884
|
-
return /* @__PURE__ */ (0,
|
|
2612
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
1885
2613
|
"div",
|
|
1886
2614
|
{
|
|
1887
2615
|
className: "grid",
|
|
@@ -1901,22 +2629,22 @@ Table.Cell = TableCell;
|
|
|
1901
2629
|
|
|
1902
2630
|
// src/tag/tag.tsx
|
|
1903
2631
|
var import_component_theme20 = require("@zenkigen-inc/component-theme");
|
|
1904
|
-
var
|
|
2632
|
+
var import_clsx35 = __toESM(require("clsx"));
|
|
1905
2633
|
|
|
1906
2634
|
// src/tag/delete-icon.tsx
|
|
1907
2635
|
var import_component_theme19 = require("@zenkigen-inc/component-theme");
|
|
1908
|
-
var
|
|
1909
|
-
var
|
|
2636
|
+
var import_clsx34 = __toESM(require("clsx"));
|
|
2637
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
1910
2638
|
var DeleteIcon = ({ color, variant, onClick }) => {
|
|
1911
|
-
const deleteButtonClasses = (0,
|
|
2639
|
+
const deleteButtonClasses = (0, import_clsx34.default)(
|
|
1912
2640
|
"group ml-2 size-[14px] rounded-full p-0.5 hover:cursor-pointer hover:bg-iconOnColor focus-visible:bg-iconOnColor",
|
|
1913
2641
|
import_component_theme19.focusVisible.normal
|
|
1914
2642
|
);
|
|
1915
|
-
const deletePathClasses = (0,
|
|
2643
|
+
const deletePathClasses = (0, import_clsx34.default)({
|
|
1916
2644
|
"fill-interactive02": color === "gray" || variant === "light",
|
|
1917
2645
|
"group-hover:fill-interactive02 group-focus-visible:fill-interactive02 fill-iconOnColor": color !== "gray"
|
|
1918
2646
|
});
|
|
1919
|
-
return /* @__PURE__ */ (0,
|
|
2647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("button", { type: "button", className: deleteButtonClasses, onClick, children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("svg", { viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
1920
2648
|
"path",
|
|
1921
2649
|
{
|
|
1922
2650
|
fillRule: "evenodd",
|
|
@@ -1928,9 +2656,9 @@ var DeleteIcon = ({ color, variant, onClick }) => {
|
|
|
1928
2656
|
};
|
|
1929
2657
|
|
|
1930
2658
|
// src/tag/tag.tsx
|
|
1931
|
-
var
|
|
2659
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
1932
2660
|
function Tag({ id, children, color, variant = "normal", size = "medium", isEditable, onDelete }) {
|
|
1933
|
-
const wrapperClasses = (0,
|
|
2661
|
+
const wrapperClasses = (0, import_clsx35.default)("flex", "items-center", "justify-center", {
|
|
1934
2662
|
[import_component_theme20.tagColors[color]]: variant === "normal",
|
|
1935
2663
|
[import_component_theme20.tagLightColors[color]]: variant === "light",
|
|
1936
2664
|
"h-[14px] typography-label11regular": !isEditable && size === "x-small",
|
|
@@ -1942,65 +2670,177 @@ function Tag({ id, children, color, variant = "normal", size = "medium", isEdita
|
|
|
1942
2670
|
"py-0.5 px-1": !isEditable,
|
|
1943
2671
|
"py-1 px-2": isEditable
|
|
1944
2672
|
});
|
|
1945
|
-
return /* @__PURE__ */ (0,
|
|
2673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: wrapperClasses, children: [
|
|
1946
2674
|
children,
|
|
1947
|
-
isEditable ? /* @__PURE__ */ (0,
|
|
2675
|
+
isEditable ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(DeleteIcon, { onClick: () => onDelete(id), color, variant }) : null
|
|
1948
2676
|
] });
|
|
1949
2677
|
}
|
|
1950
2678
|
|
|
1951
2679
|
// src/text-area/text-area.tsx
|
|
1952
|
-
var
|
|
1953
|
-
var
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
);
|
|
1980
|
-
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
1981
|
-
"textarea",
|
|
1982
|
-
{
|
|
1983
|
-
ref,
|
|
1984
|
-
className: classes,
|
|
1985
|
-
disabled,
|
|
1986
|
-
...props,
|
|
1987
|
-
style: {
|
|
1988
|
-
...{ maxHeight },
|
|
1989
|
-
// 自動高さではない場合で、height 指定がある場合は設定する
|
|
1990
|
-
...!autoHeight && height !== null ? { height } : {},
|
|
1991
|
-
// 自動高さの場合で、height が指定されている場合は、height を minHeight に設定する
|
|
1992
|
-
...autoHeight && height !== null ? { minHeight: height } : {}
|
|
1993
|
-
}
|
|
1994
|
-
}
|
|
1995
|
-
) });
|
|
2680
|
+
var import_clsx38 = require("clsx");
|
|
2681
|
+
var import_react46 = require("react");
|
|
2682
|
+
|
|
2683
|
+
// src/text-area/text-area-context.tsx
|
|
2684
|
+
var import_react43 = require("react");
|
|
2685
|
+
var TextAreaCompoundContext = (0, import_react43.createContext)(null);
|
|
2686
|
+
var useTextAreaCompoundContext = (componentName) => {
|
|
2687
|
+
const context = (0, import_react43.useContext)(TextAreaCompoundContext);
|
|
2688
|
+
if (context == null) {
|
|
2689
|
+
throw new Error(`${componentName} \u3092\u4F7F\u7528\u3059\u308B\u306B\u306F TextArea \u306E\u5B50\u8981\u7D20\u3068\u3057\u3066\u914D\u7F6E\u3059\u308B\u5FC5\u8981\u304C\u3042\u308B\u3002`);
|
|
2690
|
+
}
|
|
2691
|
+
return context;
|
|
2692
|
+
};
|
|
2693
|
+
|
|
2694
|
+
// src/text-area/text-area-error-message.tsx
|
|
2695
|
+
var import_clsx36 = require("clsx");
|
|
2696
|
+
var import_react44 = require("react");
|
|
2697
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2698
|
+
var TextAreaErrorMessage = (0, import_react44.forwardRef)(
|
|
2699
|
+
({ "aria-live": ariaLive = "assertive", ...props }, ref) => {
|
|
2700
|
+
const { textAreaProps } = useTextAreaCompoundContext("TextArea.ErrorMessage");
|
|
2701
|
+
const typographyClass = textAreaProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
2702
|
+
const shouldRender = textAreaProps.isError === true;
|
|
2703
|
+
if (!shouldRender) {
|
|
2704
|
+
return null;
|
|
2705
|
+
}
|
|
2706
|
+
const errorMessageClassName = (0, import_clsx36.clsx)(typographyClass, "text-supportError");
|
|
2707
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { ref, className: errorMessageClassName, "aria-live": ariaLive, ...props });
|
|
1996
2708
|
}
|
|
1997
2709
|
);
|
|
1998
|
-
|
|
2710
|
+
TextAreaErrorMessage.displayName = "TextArea.ErrorMessage";
|
|
2711
|
+
|
|
2712
|
+
// src/text-area/text-area-helper-message.tsx
|
|
2713
|
+
var import_clsx37 = require("clsx");
|
|
2714
|
+
var import_react45 = require("react");
|
|
2715
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2716
|
+
var TextAreaHelperMessage = (0, import_react45.forwardRef)((props, ref) => {
|
|
2717
|
+
const { textAreaProps } = useTextAreaCompoundContext("TextArea.HelperMessage");
|
|
2718
|
+
const typographyClass = textAreaProps.size === "large" ? "typography-label12regular" : "typography-label11regular";
|
|
2719
|
+
const helperMessageClassName = (0, import_clsx37.clsx)(typographyClass, "text-text02");
|
|
2720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { ref, className: helperMessageClassName, ...props });
|
|
2721
|
+
});
|
|
2722
|
+
TextAreaHelperMessage.displayName = "TextArea.HelperMessage";
|
|
2723
|
+
|
|
2724
|
+
// src/text-area/text-area.tsx
|
|
2725
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2726
|
+
function TextAreaInner({
|
|
2727
|
+
size = "medium",
|
|
2728
|
+
isResizable = false,
|
|
2729
|
+
autoHeight = false,
|
|
2730
|
+
maxHeight,
|
|
2731
|
+
isError = false,
|
|
2732
|
+
disabled = false,
|
|
2733
|
+
height,
|
|
2734
|
+
children,
|
|
2735
|
+
...props
|
|
2736
|
+
}, ref) {
|
|
2737
|
+
const autoGeneratedId = (0, import_react46.useId)();
|
|
2738
|
+
const textAreaPropsForContext = (0, import_react46.useMemo)(
|
|
2739
|
+
() => ({
|
|
2740
|
+
size,
|
|
2741
|
+
isError
|
|
2742
|
+
}),
|
|
2743
|
+
[size, isError]
|
|
2744
|
+
);
|
|
2745
|
+
const contextValue = (0, import_react46.useMemo)(
|
|
2746
|
+
() => ({
|
|
2747
|
+
textAreaProps: textAreaPropsForContext,
|
|
2748
|
+
forwardedRef: ref
|
|
2749
|
+
}),
|
|
2750
|
+
[textAreaPropsForContext, ref]
|
|
2751
|
+
);
|
|
2752
|
+
const helperMessageIds = [];
|
|
2753
|
+
const errorIds = [];
|
|
2754
|
+
const describedByBaseId = props.id ?? autoGeneratedId;
|
|
2755
|
+
const enhancedChildren = import_react46.Children.map(children, (child) => {
|
|
2756
|
+
if (!(0, import_react46.isValidElement)(child)) {
|
|
2757
|
+
return child;
|
|
2758
|
+
}
|
|
2759
|
+
if (child.type === TextAreaHelperMessage) {
|
|
2760
|
+
const helperChild = child;
|
|
2761
|
+
const assignedId = helperChild.props.id ?? `${describedByBaseId}-helper-${helperMessageIds.length + 1}`;
|
|
2762
|
+
helperMessageIds.push(assignedId);
|
|
2763
|
+
return (0, import_react46.cloneElement)(helperChild, { id: assignedId });
|
|
2764
|
+
}
|
|
2765
|
+
if (child.type === TextAreaErrorMessage && isError) {
|
|
2766
|
+
const errorChild = child;
|
|
2767
|
+
const assignedId = errorChild.props.id ?? `${describedByBaseId}-error-${errorIds.length + 1}`;
|
|
2768
|
+
errorIds.push(assignedId);
|
|
2769
|
+
return (0, import_react46.cloneElement)(errorChild, { id: assignedId });
|
|
2770
|
+
}
|
|
2771
|
+
return child;
|
|
2772
|
+
});
|
|
2773
|
+
const describedByFromProps = typeof props["aria-describedby"] === "string" ? props["aria-describedby"] : null;
|
|
2774
|
+
const describedByList = [describedByFromProps, ...helperMessageIds, ...errorIds].filter(
|
|
2775
|
+
(id) => typeof id === "string" && id.trim().length > 0
|
|
2776
|
+
);
|
|
2777
|
+
const describedByProps = describedByList.length > 0 ? {
|
|
2778
|
+
"aria-describedby": describedByList.join(" ")
|
|
2779
|
+
} : {};
|
|
2780
|
+
const shouldMarkInvalid = isError === true || errorIds.length > 0;
|
|
2781
|
+
const ariaInvalidFromProps = props["aria-invalid"];
|
|
2782
|
+
const ariaInvalidValue = ariaInvalidFromProps != null ? ariaInvalidFromProps : shouldMarkInvalid ? true : null;
|
|
2783
|
+
const ariaInvalidProps = ariaInvalidValue == null ? {} : { "aria-invalid": ariaInvalidValue };
|
|
2784
|
+
const mergedTextAreaProps = {
|
|
2785
|
+
...props,
|
|
2786
|
+
...describedByProps,
|
|
2787
|
+
...ariaInvalidProps
|
|
2788
|
+
};
|
|
2789
|
+
const classes = (0, import_clsx38.clsx)(
|
|
2790
|
+
"w-full rounded border outline-0 placeholder:text-textPlaceholder disabled:text-textPlaceholder",
|
|
2791
|
+
{
|
|
2792
|
+
"border-supportError": isError && !disabled,
|
|
2793
|
+
"hover:border-hoverInput": !disabled && !isError,
|
|
2794
|
+
"border-uiBorder02 hover:focus-within:border-activeInput focus-within:border-activeInput text-text01": !isError,
|
|
2795
|
+
"bg-disabled02 border-disabled01": disabled,
|
|
2796
|
+
"typography-body14regular px-2 pt-2 pb-2": size === "medium",
|
|
2797
|
+
"text-4 leading-normal px-3.5 py-2.5": size === "large",
|
|
2798
|
+
"field-sizing-content": autoHeight,
|
|
2799
|
+
"text-supportError": isError,
|
|
2800
|
+
"resize-none": !isResizable
|
|
2801
|
+
}
|
|
2802
|
+
);
|
|
2803
|
+
const textAreaElement = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "flex", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2804
|
+
"textarea",
|
|
2805
|
+
{
|
|
2806
|
+
ref,
|
|
2807
|
+
className: classes,
|
|
2808
|
+
...mergedTextAreaProps,
|
|
2809
|
+
disabled,
|
|
2810
|
+
style: {
|
|
2811
|
+
...{ maxHeight },
|
|
2812
|
+
// 自動高さではない場合で、height 指定がある場合は設定する
|
|
2813
|
+
...!autoHeight && height !== null ? { height } : {},
|
|
2814
|
+
// 自動高さの場合で、height が指定されている場合は、height を minHeight に設定する
|
|
2815
|
+
...autoHeight && height !== null ? { minHeight: height } : {}
|
|
2816
|
+
}
|
|
2817
|
+
}
|
|
2818
|
+
) });
|
|
2819
|
+
const stackedChildren = enhancedChildren == null ? [] : import_react46.Children.toArray(enhancedChildren);
|
|
2820
|
+
const hasMessageChildren = stackedChildren.length > 0;
|
|
2821
|
+
if (!hasMessageChildren) {
|
|
2822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TextAreaCompoundContext.Provider, { value: contextValue, children: textAreaElement });
|
|
2823
|
+
}
|
|
2824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(TextAreaCompoundContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
2825
|
+
textAreaElement,
|
|
2826
|
+
stackedChildren
|
|
2827
|
+
] }) });
|
|
2828
|
+
}
|
|
2829
|
+
var attachStatics2 = (component) => {
|
|
2830
|
+
component.HelperMessage = TextAreaHelperMessage;
|
|
2831
|
+
component.ErrorMessage = TextAreaErrorMessage;
|
|
2832
|
+
component.displayName = "TextArea";
|
|
2833
|
+
return component;
|
|
2834
|
+
};
|
|
2835
|
+
var TextAreaBase = (0, import_react46.forwardRef)(function TextAreaBase2(props, ref) {
|
|
2836
|
+
return TextAreaInner(props, ref);
|
|
2837
|
+
});
|
|
2838
|
+
var TextArea = attachStatics2(TextAreaBase);
|
|
1999
2839
|
|
|
2000
2840
|
// src/toast/toast.tsx
|
|
2001
|
-
var
|
|
2002
|
-
var
|
|
2003
|
-
var
|
|
2841
|
+
var import_clsx39 = __toESM(require("clsx"));
|
|
2842
|
+
var import_react47 = require("react");
|
|
2843
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2004
2844
|
var CLOSE_TIME_MSEC = 5e3;
|
|
2005
2845
|
function Toast({
|
|
2006
2846
|
state = "information",
|
|
@@ -2010,8 +2850,8 @@ function Toast({
|
|
|
2010
2850
|
children,
|
|
2011
2851
|
onClickClose
|
|
2012
2852
|
}) {
|
|
2013
|
-
const [isRemoving, setIsRemoving] = (0,
|
|
2014
|
-
const handleClose = (0,
|
|
2853
|
+
const [isRemoving, setIsRemoving] = (0, import_react47.useState)(false);
|
|
2854
|
+
const handleClose = (0, import_react47.useCallback)(() => {
|
|
2015
2855
|
if (isAnimation) {
|
|
2016
2856
|
setIsRemoving(true);
|
|
2017
2857
|
} else {
|
|
@@ -2019,17 +2859,17 @@ function Toast({
|
|
|
2019
2859
|
}
|
|
2020
2860
|
}, [isAnimation, onClickClose]);
|
|
2021
2861
|
const handleAnimationEnd = (e) => window.getComputedStyle(e.currentTarget).opacity === "0" && onClickClose();
|
|
2022
|
-
const wrapperClasses = (0,
|
|
2862
|
+
const wrapperClasses = (0, import_clsx39.default)("pointer-events-auto flex items-start gap-1 bg-white p-4 shadow-floatingShadow", {
|
|
2023
2863
|
["animate-toast-in"]: isAnimation && !isRemoving,
|
|
2024
2864
|
["animate-toast-out opacity-0"]: isAnimation && isRemoving
|
|
2025
2865
|
});
|
|
2026
|
-
const iconClasses = (0,
|
|
2866
|
+
const iconClasses = (0, import_clsx39.default)("flex items-center", {
|
|
2027
2867
|
"fill-supportSuccess": state === "success",
|
|
2028
2868
|
"fill-supportError": state === "error",
|
|
2029
2869
|
"fill-supportWarning": state === "warning",
|
|
2030
2870
|
"fill-supportInfo": state === "information"
|
|
2031
2871
|
});
|
|
2032
|
-
const textClasses = (0,
|
|
2872
|
+
const textClasses = (0, import_clsx39.default)("typography-body13regular flex-1 pt-[3px]", {
|
|
2033
2873
|
"text-supportError": state === "error",
|
|
2034
2874
|
"text-text01": state === "success" || state === "warning" || state === "information"
|
|
2035
2875
|
});
|
|
@@ -2039,7 +2879,7 @@ function Toast({
|
|
|
2039
2879
|
warning: "warning",
|
|
2040
2880
|
information: "information-filled"
|
|
2041
2881
|
};
|
|
2042
|
-
(0,
|
|
2882
|
+
(0, import_react47.useEffect)(() => {
|
|
2043
2883
|
const timer = window.setTimeout(() => {
|
|
2044
2884
|
if (isAutoClose) {
|
|
2045
2885
|
setIsRemoving(true);
|
|
@@ -2047,45 +2887,45 @@ function Toast({
|
|
|
2047
2887
|
}, CLOSE_TIME_MSEC);
|
|
2048
2888
|
return () => window.clearTimeout(timer);
|
|
2049
2889
|
}, [isAutoClose]);
|
|
2050
|
-
return /* @__PURE__ */ (0,
|
|
2051
|
-
/* @__PURE__ */ (0,
|
|
2052
|
-
/* @__PURE__ */ (0,
|
|
2053
|
-
/* @__PURE__ */ (0,
|
|
2890
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: wrapperClasses, style: { width }, onAnimationEnd: handleAnimationEnd, children: [
|
|
2891
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: iconClasses, children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Icon, { name: iconName[state] }) }),
|
|
2892
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: textClasses, children }),
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(IconButton, { icon: "close", size: "medium", variant: "text", onClick: handleClose, isNoPadding: true })
|
|
2054
2894
|
] });
|
|
2055
2895
|
}
|
|
2056
2896
|
|
|
2057
2897
|
// src/toast/toast-provider.tsx
|
|
2058
|
-
var
|
|
2898
|
+
var import_react48 = require("react");
|
|
2059
2899
|
var import_react_dom3 = require("react-dom");
|
|
2060
|
-
var
|
|
2061
|
-
var ToastContext = (0,
|
|
2900
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2901
|
+
var ToastContext = (0, import_react48.createContext)({});
|
|
2062
2902
|
var ToastProvider = ({ children }) => {
|
|
2063
|
-
const [isClientRender, setIsClientRender] = (0,
|
|
2064
|
-
const [toasts, setToasts] = (0,
|
|
2065
|
-
const addToast = (0,
|
|
2903
|
+
const [isClientRender, setIsClientRender] = (0, import_react48.useState)(false);
|
|
2904
|
+
const [toasts, setToasts] = (0, import_react48.useState)([]);
|
|
2905
|
+
const addToast = (0, import_react48.useCallback)(({ message, state }) => {
|
|
2066
2906
|
setToasts((prev) => [...prev, { id: Math.trunc(Math.random() * 1e5), message, state }]);
|
|
2067
2907
|
}, []);
|
|
2068
|
-
const removeToast = (0,
|
|
2908
|
+
const removeToast = (0, import_react48.useCallback)((id) => {
|
|
2069
2909
|
setToasts((prev) => prev.filter((snackbar) => snackbar.id !== id));
|
|
2070
2910
|
}, []);
|
|
2071
|
-
(0,
|
|
2911
|
+
(0, import_react48.useEffect)(() => {
|
|
2072
2912
|
setIsClientRender(true);
|
|
2073
2913
|
}, []);
|
|
2074
|
-
return /* @__PURE__ */ (0,
|
|
2914
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(ToastContext.Provider, { value: { addToast, removeToast }, children: [
|
|
2075
2915
|
children,
|
|
2076
2916
|
isClientRender && (0, import_react_dom3.createPortal)(
|
|
2077
|
-
/* @__PURE__ */ (0,
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.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_runtime57.jsx)(Toast, { state, isAutoClose: true, isAnimation: true, onClickClose: () => removeToast(id), width: 475, children: message }, id)) }),
|
|
2078
2918
|
document.body
|
|
2079
2919
|
)
|
|
2080
2920
|
] });
|
|
2081
2921
|
};
|
|
2082
2922
|
var useToast = () => {
|
|
2083
|
-
return (0,
|
|
2923
|
+
return (0, import_react48.useContext)(ToastContext);
|
|
2084
2924
|
};
|
|
2085
2925
|
|
|
2086
2926
|
// src/toggle/toggle.tsx
|
|
2087
|
-
var
|
|
2088
|
-
var
|
|
2927
|
+
var import_clsx40 = __toESM(require("clsx"));
|
|
2928
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
2089
2929
|
function Toggle({
|
|
2090
2930
|
id,
|
|
2091
2931
|
size = "medium",
|
|
@@ -2095,7 +2935,7 @@ function Toggle({
|
|
|
2095
2935
|
labelPosition = "right",
|
|
2096
2936
|
isDisabled = false
|
|
2097
2937
|
}) {
|
|
2098
|
-
const baseClasses = (0,
|
|
2938
|
+
const baseClasses = (0, import_clsx40.default)("relative flex items-center rounded-full", {
|
|
2099
2939
|
"bg-disabledOn": isDisabled && isChecked,
|
|
2100
2940
|
"bg-disabled01": isDisabled && !isChecked,
|
|
2101
2941
|
"bg-interactive01 peer-hover:bg-hover01": !isDisabled && isChecked,
|
|
@@ -2103,16 +2943,16 @@ function Toggle({
|
|
|
2103
2943
|
"w-8 h-4 px-[3px]": size === "small",
|
|
2104
2944
|
"w-12 h-6 px-1": size === "medium" || size === "large"
|
|
2105
2945
|
});
|
|
2106
|
-
const inputClasses = (0,
|
|
2946
|
+
const inputClasses = (0, import_clsx40.default)(
|
|
2107
2947
|
"peer absolute inset-0 z-[1] opacity-0",
|
|
2108
2948
|
isDisabled ? "cursor-not-allowed" : "cursor-pointer"
|
|
2109
2949
|
);
|
|
2110
|
-
const indicatorClasses = (0,
|
|
2950
|
+
const indicatorClasses = (0, import_clsx40.default)("rounded-full bg-iconOnColor", {
|
|
2111
2951
|
"w-2.5 h-2.5": size === "small",
|
|
2112
2952
|
"w-4 h-4": size === "medium" || size === "large",
|
|
2113
2953
|
"ml-auto": isChecked
|
|
2114
2954
|
});
|
|
2115
|
-
const labelClasses = (0,
|
|
2955
|
+
const labelClasses = (0, import_clsx40.default)("break-all", {
|
|
2116
2956
|
"mr-2": labelPosition === "left",
|
|
2117
2957
|
"ml-2": labelPosition === "right",
|
|
2118
2958
|
"typography-label14regular": size === "small" || size === "medium",
|
|
@@ -2120,9 +2960,9 @@ function Toggle({
|
|
|
2120
2960
|
"pointer-events-none cursor-not-allowed text-disabled01": isDisabled,
|
|
2121
2961
|
"cursor-pointer text-text01": !isDisabled
|
|
2122
2962
|
});
|
|
2123
|
-
return /* @__PURE__ */ (0,
|
|
2124
|
-
label != null && labelPosition === "left" && /* @__PURE__ */ (0,
|
|
2125
|
-
/* @__PURE__ */ (0,
|
|
2963
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "relative flex flex-[0_0_auto] items-center", children: [
|
|
2964
|
+
label != null && labelPosition === "left" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("label", { htmlFor: id, className: labelClasses, children: label }),
|
|
2965
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2126
2966
|
"input",
|
|
2127
2967
|
{
|
|
2128
2968
|
className: inputClasses,
|
|
@@ -2134,23 +2974,23 @@ function Toggle({
|
|
|
2134
2974
|
disabled: isDisabled
|
|
2135
2975
|
}
|
|
2136
2976
|
),
|
|
2137
|
-
/* @__PURE__ */ (0,
|
|
2138
|
-
label != null && labelPosition === "right" && /* @__PURE__ */ (0,
|
|
2977
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: baseClasses, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: indicatorClasses }) }),
|
|
2978
|
+
label != null && labelPosition === "right" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("label", { htmlFor: id, className: labelClasses, children: label })
|
|
2139
2979
|
] });
|
|
2140
2980
|
}
|
|
2141
2981
|
|
|
2142
2982
|
// src/tooltip/tooltip.tsx
|
|
2143
|
-
var
|
|
2983
|
+
var import_react50 = require("react");
|
|
2144
2984
|
var import_react_dom4 = require("react-dom");
|
|
2145
2985
|
|
|
2146
2986
|
// src/tooltip/tooltip-content.tsx
|
|
2147
|
-
var
|
|
2987
|
+
var import_clsx42 = __toESM(require("clsx"));
|
|
2148
2988
|
|
|
2149
2989
|
// src/tooltip/tail-icon.tsx
|
|
2150
|
-
var
|
|
2151
|
-
var
|
|
2990
|
+
var import_clsx41 = __toESM(require("clsx"));
|
|
2991
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
2152
2992
|
var TailIcon = (props) => {
|
|
2153
|
-
const tailClasses = (0,
|
|
2993
|
+
const tailClasses = (0, import_clsx41.default)("absolute fill-uiBackgroundTooltip", {
|
|
2154
2994
|
"rotate-180": props.verticalPosition === "bottom",
|
|
2155
2995
|
"rotate-0": props.verticalPosition !== "bottom",
|
|
2156
2996
|
"-top-1": props.verticalPosition === "bottom" && props.size === "small",
|
|
@@ -2165,9 +3005,9 @@ var TailIcon = (props) => {
|
|
|
2165
3005
|
"left-1/2 -translate-x-2": props.horizontalAlign === "center" && props.size !== "small"
|
|
2166
3006
|
});
|
|
2167
3007
|
if (props.size === "small") {
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
3008
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.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_runtime59.jsx)("path", { d: "M4 4L0 0H8L4 4Z" }) });
|
|
2169
3009
|
} else {
|
|
2170
|
-
return /* @__PURE__ */ (0,
|
|
3010
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
2171
3011
|
"svg",
|
|
2172
3012
|
{
|
|
2173
3013
|
className: tailClasses,
|
|
@@ -2176,14 +3016,14 @@ var TailIcon = (props) => {
|
|
|
2176
3016
|
viewBox: "0 0 14 8",
|
|
2177
3017
|
fill: "none",
|
|
2178
3018
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2179
|
-
children: /* @__PURE__ */ (0,
|
|
3019
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("path", { d: "M7 8L0 0H14L7 8Z" })
|
|
2180
3020
|
}
|
|
2181
3021
|
);
|
|
2182
3022
|
}
|
|
2183
3023
|
};
|
|
2184
3024
|
|
|
2185
3025
|
// src/tooltip/tooltip-content.tsx
|
|
2186
|
-
var
|
|
3026
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
2187
3027
|
var TooltipContent = ({
|
|
2188
3028
|
content,
|
|
2189
3029
|
horizontalAlign,
|
|
@@ -2193,7 +3033,7 @@ var TooltipContent = ({
|
|
|
2193
3033
|
maxWidth,
|
|
2194
3034
|
isPortal = false
|
|
2195
3035
|
}) => {
|
|
2196
|
-
const tooltipWrapperClasses = (0,
|
|
3036
|
+
const tooltipWrapperClasses = (0, import_clsx42.default)("absolute z-tooltip m-auto flex", {
|
|
2197
3037
|
"top-0": !isPortal && verticalPosition === "top",
|
|
2198
3038
|
"bottom-0": !isPortal && verticalPosition === "bottom",
|
|
2199
3039
|
"justify-start": horizontalAlign === "left",
|
|
@@ -2202,7 +3042,7 @@ var TooltipContent = ({
|
|
|
2202
3042
|
"w-[24px]": size === "small",
|
|
2203
3043
|
"w-[46px]": size !== "small"
|
|
2204
3044
|
});
|
|
2205
|
-
const tooltipBodyClasses = (0,
|
|
3045
|
+
const tooltipBodyClasses = (0, import_clsx42.default)(
|
|
2206
3046
|
"absolute z-tooltip inline-block w-max rounded bg-uiBackgroundTooltip text-textOnColor",
|
|
2207
3047
|
{
|
|
2208
3048
|
"typography-body12regular": size === "small",
|
|
@@ -2219,7 +3059,7 @@ var TooltipContent = ({
|
|
|
2219
3059
|
transform: `translate(${tooltipPosition.translateX}, ${tooltipPosition.translateY})`,
|
|
2220
3060
|
...tooltipPosition
|
|
2221
3061
|
} : {};
|
|
2222
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: tooltipWrapperClasses, style: tooltipWrapperStyle, children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(
|
|
2223
3063
|
"div",
|
|
2224
3064
|
{
|
|
2225
3065
|
className: tooltipBodyClasses,
|
|
@@ -2228,16 +3068,16 @@ var TooltipContent = ({
|
|
|
2228
3068
|
},
|
|
2229
3069
|
children: [
|
|
2230
3070
|
content,
|
|
2231
|
-
/* @__PURE__ */ (0,
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(TailIcon, { size, verticalPosition, horizontalAlign })
|
|
2232
3072
|
]
|
|
2233
3073
|
}
|
|
2234
3074
|
) });
|
|
2235
3075
|
};
|
|
2236
3076
|
|
|
2237
3077
|
// src/tooltip/tooltip-hook.ts
|
|
2238
|
-
var
|
|
3078
|
+
var import_react49 = require("react");
|
|
2239
3079
|
var useTooltip = () => {
|
|
2240
|
-
const calculatePosition = (0,
|
|
3080
|
+
const calculatePosition = (0, import_react49.useCallback)(
|
|
2241
3081
|
(args) => {
|
|
2242
3082
|
const result = {
|
|
2243
3083
|
maxWidth: "none",
|
|
@@ -2289,7 +3129,7 @@ var useTooltip = () => {
|
|
|
2289
3129
|
};
|
|
2290
3130
|
|
|
2291
3131
|
// src/tooltip/tooltip.tsx
|
|
2292
|
-
var
|
|
3132
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
2293
3133
|
function Tooltip({
|
|
2294
3134
|
children,
|
|
2295
3135
|
content,
|
|
@@ -2301,8 +3141,8 @@ function Tooltip({
|
|
|
2301
3141
|
portalTarget
|
|
2302
3142
|
}) {
|
|
2303
3143
|
const { calculatePosition } = useTooltip();
|
|
2304
|
-
const [isVisible, setIsVisible] = (0,
|
|
2305
|
-
const [tooltipPosition, setTooltipPosition] = (0,
|
|
3144
|
+
const [isVisible, setIsVisible] = (0, import_react50.useState)(false);
|
|
3145
|
+
const [tooltipPosition, setTooltipPosition] = (0, import_react50.useState)({
|
|
2306
3146
|
maxWidth: "none",
|
|
2307
3147
|
width: "auto",
|
|
2308
3148
|
left: "0px",
|
|
@@ -2311,23 +3151,23 @@ function Tooltip({
|
|
|
2311
3151
|
translateX: "0",
|
|
2312
3152
|
translateY: "0"
|
|
2313
3153
|
});
|
|
2314
|
-
const targetRef = (0,
|
|
2315
|
-
const handleMouseOverWrapper = (0,
|
|
3154
|
+
const targetRef = (0, import_react50.useRef)(null);
|
|
3155
|
+
const handleMouseOverWrapper = (0, import_react50.useCallback)(() => {
|
|
2316
3156
|
if (isDisabledHover) {
|
|
2317
3157
|
return;
|
|
2318
3158
|
}
|
|
2319
3159
|
setIsVisible(true);
|
|
2320
3160
|
}, [isDisabledHover]);
|
|
2321
|
-
const handleMouseOutWrapper = (0,
|
|
3161
|
+
const handleMouseOutWrapper = (0, import_react50.useCallback)(() => {
|
|
2322
3162
|
setIsVisible(false);
|
|
2323
3163
|
}, []);
|
|
2324
|
-
(0,
|
|
3164
|
+
(0, import_react50.useEffect)(() => {
|
|
2325
3165
|
if (targetRef.current === null) return;
|
|
2326
3166
|
const dimensions = targetRef.current?.getBoundingClientRect();
|
|
2327
3167
|
const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
|
|
2328
3168
|
setTooltipPosition(position);
|
|
2329
3169
|
}, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
|
|
2330
|
-
return /* @__PURE__ */ (0,
|
|
3170
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
2331
3171
|
"div",
|
|
2332
3172
|
{
|
|
2333
3173
|
ref: targetRef,
|
|
@@ -2336,7 +3176,7 @@ function Tooltip({
|
|
|
2336
3176
|
onMouseLeave: handleMouseOutWrapper,
|
|
2337
3177
|
children: [
|
|
2338
3178
|
children,
|
|
2339
|
-
isVisible && (portalTarget == null ? /* @__PURE__ */ (0,
|
|
3179
|
+
isVisible && (portalTarget == null ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2340
3180
|
TooltipContent,
|
|
2341
3181
|
{
|
|
2342
3182
|
content,
|
|
@@ -2347,7 +3187,7 @@ function Tooltip({
|
|
|
2347
3187
|
tooltipPosition
|
|
2348
3188
|
}
|
|
2349
3189
|
) : (0, import_react_dom4.createPortal)(
|
|
2350
|
-
/* @__PURE__ */ (0,
|
|
3190
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
2351
3191
|
TooltipContent,
|
|
2352
3192
|
{
|
|
2353
3193
|
isPortal: true,
|
|
@@ -2373,6 +3213,7 @@ function Tooltip({
|
|
|
2373
3213
|
Checkbox,
|
|
2374
3214
|
Dropdown,
|
|
2375
3215
|
EvaluationStar,
|
|
3216
|
+
FileInput,
|
|
2376
3217
|
Heading,
|
|
2377
3218
|
Icon,
|
|
2378
3219
|
IconButton,
|
|
@@ -2382,6 +3223,10 @@ function Tooltip({
|
|
|
2382
3223
|
Pagination,
|
|
2383
3224
|
PaginationSelect,
|
|
2384
3225
|
PasswordInput,
|
|
3226
|
+
Popover,
|
|
3227
|
+
PopoverContent,
|
|
3228
|
+
PopoverTrigger,
|
|
3229
|
+
Popup,
|
|
2385
3230
|
Radio,
|
|
2386
3231
|
Search,
|
|
2387
3232
|
SegmentedControl,
|