@x-plat/design-system 0.8.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/AutoResizeTextArea/index.cjs +140 -4
- package/dist/components/AutoResizeTextArea/index.css +38 -0
- package/dist/components/AutoResizeTextArea/index.d.cts +4 -0
- package/dist/components/AutoResizeTextArea/index.d.ts +4 -0
- package/dist/components/AutoResizeTextArea/index.js +140 -4
- package/dist/components/Badge/index.cjs +5 -1
- package/dist/components/Badge/index.css +1 -0
- package/dist/components/Badge/index.d.cts +1 -0
- package/dist/components/Badge/index.d.ts +1 -0
- package/dist/components/Badge/index.js +5 -1
- package/dist/components/Box/index.d.cts +3 -0
- package/dist/components/Box/index.d.ts +3 -0
- package/dist/components/Chart/index.cjs +7 -6
- package/dist/components/Chart/index.d.cts +12 -1
- package/dist/components/Chart/index.d.ts +12 -1
- package/dist/components/Chart/index.js +7 -6
- package/dist/components/ChatInput/index.cjs +150 -9
- package/dist/components/ChatInput/index.css +38 -0
- package/dist/components/ChatInput/index.d.cts +9 -0
- package/dist/components/ChatInput/index.d.ts +9 -0
- package/dist/components/ChatInput/index.js +151 -10
- package/dist/components/CheckBox/index.cjs +137 -6
- package/dist/components/CheckBox/index.css +40 -0
- package/dist/components/CheckBox/index.d.cts +13 -2
- package/dist/components/CheckBox/index.d.ts +13 -2
- package/dist/components/CheckBox/index.js +137 -6
- package/dist/components/Chip/index.d.cts +2 -0
- package/dist/components/Chip/index.d.ts +2 -0
- package/dist/components/DatePicker/index.cjs +76 -62
- package/dist/components/DatePicker/index.css +38 -31
- package/dist/components/DatePicker/index.js +42 -28
- package/dist/components/Drawer/index.d.cts +1 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/FieldMessage/index.cjs +183 -0
- package/dist/components/FieldMessage/index.css +37 -0
- package/dist/components/FieldMessage/index.d.cts +37 -0
- package/dist/components/FieldMessage/index.d.ts +37 -0
- package/dist/components/FieldMessage/index.js +154 -0
- package/dist/components/FileUpload/index.cjs +135 -8
- package/dist/components/FileUpload/index.css +38 -0
- package/dist/components/FileUpload/index.d.cts +9 -0
- package/dist/components/FileUpload/index.d.ts +9 -0
- package/dist/components/FileUpload/index.js +135 -8
- package/dist/components/ImageSelector/index.cjs +153 -11
- package/dist/components/ImageSelector/index.css +38 -0
- package/dist/components/ImageSelector/index.d.cts +6 -0
- package/dist/components/ImageSelector/index.d.ts +6 -0
- package/dist/components/ImageSelector/index.js +153 -11
- package/dist/components/Input/index.cjs +38 -25
- package/dist/components/Input/index.css +38 -31
- package/dist/components/Input/index.d.cts +7 -8
- package/dist/components/Input/index.d.ts +7 -8
- package/dist/components/Input/index.js +36 -23
- package/dist/components/NotificationBadge/index.cjs +5 -1
- package/dist/components/NotificationBadge/index.css +1 -0
- package/dist/components/NotificationBadge/index.d.cts +6 -2
- package/dist/components/NotificationBadge/index.d.ts +6 -2
- package/dist/components/NotificationBadge/index.js +5 -1
- package/dist/components/Pagination/index.cjs +6 -2
- package/dist/components/Pagination/index.css +1 -0
- package/dist/components/Pagination/index.d.cts +13 -2
- package/dist/components/Pagination/index.d.ts +13 -2
- package/dist/components/Pagination/index.js +6 -2
- package/dist/components/Progress/index.cjs +6 -2
- package/dist/components/Progress/index.css +1 -0
- package/dist/components/Progress/index.d.cts +11 -2
- package/dist/components/Progress/index.d.ts +11 -2
- package/dist/components/Progress/index.js +6 -2
- package/dist/components/Radio/index.cjs +158 -10
- package/dist/components/Radio/index.css +40 -0
- package/dist/components/Radio/index.d.cts +14 -2
- package/dist/components/Radio/index.d.ts +14 -2
- package/dist/components/Radio/index.js +158 -10
- package/dist/components/Select/index.cjs +139 -13
- package/dist/components/Select/index.css +38 -0
- package/dist/components/Select/index.d.cts +8 -1
- package/dist/components/Select/index.d.ts +8 -1
- package/dist/components/Select/index.js +139 -13
- package/dist/components/Skeleton/index.d.cts +3 -0
- package/dist/components/Skeleton/index.d.ts +3 -0
- package/dist/components/Spinner/index.cjs +6 -2
- package/dist/components/Spinner/index.css +1 -0
- package/dist/components/Spinner/index.d.cts +8 -2
- package/dist/components/Spinner/index.d.ts +8 -2
- package/dist/components/Spinner/index.js +6 -2
- package/dist/components/Steps/index.cjs +6 -2
- package/dist/components/Steps/index.css +11 -0
- package/dist/components/Steps/index.d.cts +9 -2
- package/dist/components/Steps/index.d.ts +9 -2
- package/dist/components/Steps/index.js +6 -2
- package/dist/components/Switch/index.cjs +146 -6
- package/dist/components/Switch/index.css +40 -0
- package/dist/components/Switch/index.d.cts +13 -2
- package/dist/components/Switch/index.d.ts +13 -2
- package/dist/components/Switch/index.js +146 -6
- package/dist/components/Tab/index.cjs +4 -3
- package/dist/components/Tab/index.d.cts +12 -1
- package/dist/components/Tab/index.d.ts +12 -1
- package/dist/components/Tab/index.js +4 -3
- package/dist/components/Tag/index.cjs +5 -3
- package/dist/components/Tag/index.d.cts +12 -2
- package/dist/components/Tag/index.d.ts +12 -2
- package/dist/components/Tag/index.js +5 -3
- package/dist/components/TextArea/index.cjs +138 -2
- package/dist/components/TextArea/index.css +38 -0
- package/dist/components/TextArea/index.d.cts +6 -0
- package/dist/components/TextArea/index.d.ts +6 -0
- package/dist/components/TextArea/index.js +138 -2
- package/dist/components/Tooltip/index.cjs +4 -2
- package/dist/components/Tooltip/index.d.cts +11 -1
- package/dist/components/Tooltip/index.d.ts +11 -1
- package/dist/components/Tooltip/index.js +4 -2
- package/dist/components/index.cjs +479 -408
- package/dist/components/index.css +59 -31
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +262 -194
- package/dist/index.cjs +484 -413
- package/dist/index.css +59 -31
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +264 -196
- package/dist/status-g_KP3qT6.d.cts +8 -0
- package/dist/status-g_KP3qT6.d.ts +8 -0
- package/dist/validation-Dqo1zqhT.d.cts +13 -0
- package/dist/validation-Dqo1zqhT.d.ts +13 -0
- package/guidelines/AGENT_PROMPT.md +15 -0
- package/guidelines/components/card.md +3 -3
- package/guidelines/components/feedback.md +1 -1
- package/guidelines/components/form.md +26 -0
- package/guidelines/components/navigation.md +16 -15
- package/guidelines/components/overlay.md +43 -4
- package/package.json +1 -1
|
@@ -856,12 +856,83 @@ import { jsx as jsx253 } from "react/jsx-runtime";
|
|
|
856
856
|
|
|
857
857
|
// src/tokens/svg/status/ErrorIcon.tsx
|
|
858
858
|
import { jsx as jsx254, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
859
|
+
var ErrorIcon = () => /* @__PURE__ */ jsxs160(
|
|
860
|
+
"svg",
|
|
861
|
+
{
|
|
862
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
863
|
+
width: "1em",
|
|
864
|
+
height: "1em",
|
|
865
|
+
viewBox: "0 0 16 16",
|
|
866
|
+
fill: "none",
|
|
867
|
+
children: [
|
|
868
|
+
/* @__PURE__ */ jsxs160("g", { clipPath: "url(#clip0_1196_9603)", children: [
|
|
869
|
+
/* @__PURE__ */ jsx254(
|
|
870
|
+
"path",
|
|
871
|
+
{
|
|
872
|
+
d: "M9.57588 5.57559C9.81019 5.34127 10.19 5.34127 10.4243 5.57559C10.6586 5.8099 10.6586 6.18971 10.4243 6.42402L8.84854 7.9998L10.4243 9.57559C10.6586 9.8099 10.6586 10.1897 10.4243 10.424C10.19 10.6583 9.81019 10.6583 9.57588 10.424L8.0001 8.84824L6.42432 10.424C6.19 10.6583 5.81019 10.6583 5.57588 10.424C5.34156 10.1897 5.34156 9.8099 5.57588 9.57559L7.15166 7.9998L5.57588 6.42402C5.34156 6.18971 5.34156 5.8099 5.57588 5.57559C5.81019 5.34127 6.19 5.34127 6.42432 5.57559L8.0001 7.15137L9.57588 5.57559Z",
|
|
873
|
+
fill: "currentColor"
|
|
874
|
+
}
|
|
875
|
+
),
|
|
876
|
+
/* @__PURE__ */ jsx254(
|
|
877
|
+
"path",
|
|
878
|
+
{
|
|
879
|
+
fillRule: "evenodd",
|
|
880
|
+
clipRule: "evenodd",
|
|
881
|
+
d: "M8.0001 0.733398C12.0131 0.73361 15.2671 3.98679 15.2673 7.9998C15.2672 12.0129 12.0131 15.2668 8.0001 15.267C3.98701 15.2669 0.733016 12.0129 0.73291 7.9998C0.733051 3.98674 3.98704 0.733539 8.0001 0.733398ZM8.0001 1.9334C4.64978 1.93354 1.93383 4.64948 1.93369 7.9998C1.9338 11.3502 4.64975 14.0669 8.0001 14.067C11.3504 14.0668 14.0672 11.3501 14.0673 7.9998C14.0671 4.64953 11.3504 1.93361 8.0001 1.9334Z",
|
|
882
|
+
fill: "currentColor"
|
|
883
|
+
}
|
|
884
|
+
)
|
|
885
|
+
] }),
|
|
886
|
+
/* @__PURE__ */ jsx254("defs", { children: /* @__PURE__ */ jsx254("clipPath", { id: "clip0_1196_9603", children: /* @__PURE__ */ jsx254("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
887
|
+
]
|
|
888
|
+
}
|
|
889
|
+
);
|
|
890
|
+
var ErrorIcon_default = ErrorIcon;
|
|
859
891
|
|
|
860
892
|
// src/tokens/svg/status/HelpCircleIcon.tsx
|
|
861
893
|
import { jsx as jsx255, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
862
894
|
|
|
863
895
|
// src/tokens/svg/status/InfoIcon.tsx
|
|
864
896
|
import { jsx as jsx256, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
897
|
+
var InfoIcon = () => /* @__PURE__ */ jsxs162(
|
|
898
|
+
"svg",
|
|
899
|
+
{
|
|
900
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
901
|
+
width: "1em",
|
|
902
|
+
height: "1em",
|
|
903
|
+
viewBox: "0 0 16 16",
|
|
904
|
+
fill: "none",
|
|
905
|
+
children: [
|
|
906
|
+
/* @__PURE__ */ jsxs162("g", { clipPath: "url(#clip0_1188_11261)", children: [
|
|
907
|
+
/* @__PURE__ */ jsx256(
|
|
908
|
+
"path",
|
|
909
|
+
{
|
|
910
|
+
d: "M8.00156 7.39999C8.33293 7.39999 8.60156 7.66862 8.60156 7.99999V10.6664C8.60156 10.9978 8.33293 11.2664 8.00156 11.2664C7.67019 11.2664 7.40156 10.9978 7.40156 10.6664V7.99999C7.40156 7.66862 7.67019 7.39999 8.00156 7.39999Z",
|
|
911
|
+
fill: "currentColor"
|
|
912
|
+
}
|
|
913
|
+
),
|
|
914
|
+
/* @__PURE__ */ jsx256(
|
|
915
|
+
"path",
|
|
916
|
+
{
|
|
917
|
+
d: "M8.00859 4.73358C8.3398 4.73378 8.60859 5.00233 8.60859 5.33358C8.60849 5.66474 8.33973 5.93338 8.00859 5.93358H8.00156C7.67026 5.93358 7.40167 5.66486 7.40156 5.33358C7.40156 5.00221 7.67019 4.73358 8.00156 4.73358H8.00859Z",
|
|
918
|
+
fill: "currentColor"
|
|
919
|
+
}
|
|
920
|
+
),
|
|
921
|
+
/* @__PURE__ */ jsx256(
|
|
922
|
+
"path",
|
|
923
|
+
{
|
|
924
|
+
fillRule: "evenodd",
|
|
925
|
+
clipRule: "evenodd",
|
|
926
|
+
d: "M8.00156 0.733582C12.0146 0.733793 15.2686 3.98697 15.2688 7.99999C15.2686 12.013 12.0146 15.267 8.00156 15.2672C3.98848 15.267 0.734481 12.0131 0.734375 7.99999C0.734516 3.98693 3.9885 0.733722 8.00156 0.733582ZM8.00156 1.93358C4.65124 1.93372 1.9353 4.64967 1.93516 7.99999C1.93526 11.3503 4.65122 14.067 8.00156 14.0672C11.3518 14.067 14.0686 11.3503 14.0688 7.99999C14.0686 4.64971 11.3518 1.93379 8.00156 1.93358Z",
|
|
927
|
+
fill: "currentColor"
|
|
928
|
+
}
|
|
929
|
+
)
|
|
930
|
+
] }),
|
|
931
|
+
/* @__PURE__ */ jsx256("defs", { children: /* @__PURE__ */ jsx256("clipPath", { id: "clip0_1188_11261", children: /* @__PURE__ */ jsx256("rect", { width: "16", height: "16", fill: "white" }) }) })
|
|
932
|
+
]
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
var InfoIcon_default = InfoIcon;
|
|
865
936
|
|
|
866
937
|
// src/tokens/svg/status/LoaderIcon.tsx
|
|
867
938
|
import { jsx as jsx257, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
@@ -886,6 +957,24 @@ import { jsx as jsx263, jsxs as jsxs167 } from "react/jsx-runtime";
|
|
|
886
957
|
|
|
887
958
|
// src/tokens/svg/status/SuccessIcon.tsx
|
|
888
959
|
import { jsx as jsx264 } from "react/jsx-runtime";
|
|
960
|
+
var SuccessIcon = () => /* @__PURE__ */ jsx264(
|
|
961
|
+
"svg",
|
|
962
|
+
{
|
|
963
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
964
|
+
width: "1em",
|
|
965
|
+
height: "1em",
|
|
966
|
+
viewBox: "0 0 16 16",
|
|
967
|
+
fill: "none",
|
|
968
|
+
children: /* @__PURE__ */ jsx264(
|
|
969
|
+
"path",
|
|
970
|
+
{
|
|
971
|
+
d: "M12.9084 3.57597C13.1426 3.34172 13.5225 3.34185 13.7568 3.57597C13.9911 3.81028 13.9911 4.19009 13.7568 4.4244L6.424 11.758C6.31157 11.8703 6.15869 11.9337 5.99978 11.9338C5.8409 11.9337 5.68798 11.8703 5.57556 11.758L2.24197 8.4244C2.00782 8.19018 2.00795 7.81028 2.24197 7.57597C2.47626 7.34167 2.85609 7.34172 3.09041 7.57597L5.999 10.4846L12.9084 3.57597Z",
|
|
972
|
+
fill: "currentColor"
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
}
|
|
976
|
+
);
|
|
977
|
+
var SuccessIcon_default = SuccessIcon;
|
|
889
978
|
|
|
890
979
|
// src/tokens/svg/status/XCircleIcon.tsx
|
|
891
980
|
import { jsx as jsx265, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
@@ -977,10 +1066,61 @@ import { jsx as jsx293, jsxs as jsxs187 } from "react/jsx-runtime";
|
|
|
977
1066
|
// src/tokens/svg/weather/WindIcon.tsx
|
|
978
1067
|
import { jsx as jsx294, jsxs as jsxs188 } from "react/jsx-runtime";
|
|
979
1068
|
|
|
1069
|
+
// ../../node_modules/clsx/dist/clsx.mjs
|
|
1070
|
+
function r(e) {
|
|
1071
|
+
var t, f, n = "";
|
|
1072
|
+
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
1073
|
+
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
1074
|
+
var o = e.length;
|
|
1075
|
+
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
1076
|
+
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
1077
|
+
return n;
|
|
1078
|
+
}
|
|
1079
|
+
function clsx() {
|
|
1080
|
+
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
1081
|
+
return n;
|
|
1082
|
+
}
|
|
1083
|
+
var clsx_default = clsx;
|
|
1084
|
+
|
|
1085
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
1086
|
+
import { Fragment, jsx as jsx295, jsxs as jsxs189 } from "react/jsx-runtime";
|
|
1087
|
+
var ICON = {
|
|
1088
|
+
default: /* @__PURE__ */ jsx295(InfoIcon_default, {}),
|
|
1089
|
+
success: /* @__PURE__ */ jsx295(SuccessIcon_default, {}),
|
|
1090
|
+
warning: /* @__PURE__ */ jsx295(InfoIcon_default, {}),
|
|
1091
|
+
error: /* @__PURE__ */ jsx295(ErrorIcon_default, {})
|
|
1092
|
+
};
|
|
1093
|
+
var FieldMessage = (props) => {
|
|
1094
|
+
const { validations } = props;
|
|
1095
|
+
if (!validations || validations.length === 0) return null;
|
|
1096
|
+
return /* @__PURE__ */ jsx295("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs189(
|
|
1097
|
+
"div",
|
|
1098
|
+
{
|
|
1099
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
1100
|
+
children: [
|
|
1101
|
+
/* @__PURE__ */ jsx295("div", { className: "icon", children: ICON[v.status] }),
|
|
1102
|
+
/* @__PURE__ */ jsx295("span", { children: v.message })
|
|
1103
|
+
]
|
|
1104
|
+
},
|
|
1105
|
+
`${v.message}_${idx}`
|
|
1106
|
+
)) });
|
|
1107
|
+
};
|
|
1108
|
+
FieldMessage.displayName = "FieldMessage";
|
|
1109
|
+
var Field = (props) => {
|
|
1110
|
+
const { validations, children } = props;
|
|
1111
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ jsx295(Fragment, { children });
|
|
1112
|
+
return /* @__PURE__ */ jsxs189("div", { className: "lib-xplat-field", children: [
|
|
1113
|
+
children,
|
|
1114
|
+
/* @__PURE__ */ jsx295(FieldMessage, { validations })
|
|
1115
|
+
] });
|
|
1116
|
+
};
|
|
1117
|
+
Field.displayName = "Field";
|
|
1118
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
1119
|
+
|
|
980
1120
|
// src/components/ImageSelector/ImageSelector.tsx
|
|
981
|
-
import { jsx as
|
|
1121
|
+
import { jsx as jsx296, jsxs as jsxs190 } from "react/jsx-runtime";
|
|
982
1122
|
var ImageSelector = (props) => {
|
|
983
|
-
const { value, label, onChange } = props;
|
|
1123
|
+
const { value, label, onChange, validations } = props;
|
|
984
1124
|
const [previewUrl, setPreviewUrl] = React.useState();
|
|
985
1125
|
React.useEffect(() => {
|
|
986
1126
|
if (!value) {
|
|
@@ -1004,26 +1144,28 @@ var ImageSelector = (props) => {
|
|
|
1004
1144
|
const handleOpenFileDialog = () => {
|
|
1005
1145
|
inputRef.current?.click();
|
|
1006
1146
|
};
|
|
1007
|
-
|
|
1008
|
-
/* @__PURE__ */
|
|
1147
|
+
const control = /* @__PURE__ */ jsxs190("div", { className: `lib-xplat-imageselector${value ? "" : " none-value"}`, children: [
|
|
1148
|
+
/* @__PURE__ */ jsx296(
|
|
1009
1149
|
"input",
|
|
1010
1150
|
{
|
|
1011
1151
|
type: "file",
|
|
1012
1152
|
accept: "image/*",
|
|
1013
1153
|
id: "image-input",
|
|
1014
1154
|
onChange: handleFileChange,
|
|
1015
|
-
ref: inputRef
|
|
1155
|
+
ref: inputRef,
|
|
1156
|
+
"aria-invalid": hasError(validations) || void 0
|
|
1016
1157
|
}
|
|
1017
1158
|
),
|
|
1018
|
-
value && /* @__PURE__ */
|
|
1019
|
-
/* @__PURE__ */
|
|
1020
|
-
/* @__PURE__ */
|
|
1159
|
+
value && /* @__PURE__ */ jsxs190("div", { className: "action-bar", children: [
|
|
1160
|
+
/* @__PURE__ */ jsx296("div", { className: "icon-wrapper", onClick: handleOpenFileDialog, children: /* @__PURE__ */ jsx296(UploadIcon_default, {}) }),
|
|
1161
|
+
/* @__PURE__ */ jsx296("div", { className: "icon-wrapper", onClick: handleDeleteFile, children: /* @__PURE__ */ jsx296(DeleteIcon_default, {}) })
|
|
1021
1162
|
] }),
|
|
1022
|
-
/* @__PURE__ */
|
|
1023
|
-
/* @__PURE__ */
|
|
1024
|
-
/* @__PURE__ */
|
|
1163
|
+
/* @__PURE__ */ jsx296("div", { className: "content", children: previewUrl ? /* @__PURE__ */ jsx296("img", { src: previewUrl, alt: "preview" }) : /* @__PURE__ */ jsxs190("div", { className: "skeleton", onClick: handleOpenFileDialog, children: [
|
|
1164
|
+
/* @__PURE__ */ jsx296("div", { className: "icon-wrapper", children: /* @__PURE__ */ jsx296(ImageIcon_default, {}) }),
|
|
1165
|
+
/* @__PURE__ */ jsx296("div", { className: "label", children: label || "\uC774\uBBF8\uC9C0 \uCD94\uAC00\uD558\uAE30" })
|
|
1025
1166
|
] }) })
|
|
1026
1167
|
] });
|
|
1168
|
+
return /* @__PURE__ */ jsx296(Field, { validations, children: control });
|
|
1027
1169
|
};
|
|
1028
1170
|
ImageSelector.displayName = "ImageSelector";
|
|
1029
1171
|
var ImageSelector_default = ImageSelector;
|
|
@@ -152,22 +152,41 @@ var SuccessIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
|
152
152
|
);
|
|
153
153
|
var SuccessIcon_default = SuccessIcon;
|
|
154
154
|
|
|
155
|
-
// src/components/
|
|
155
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
156
156
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
157
|
-
var
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
157
|
+
var ICON = {
|
|
158
|
+
default: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
159
|
+
success: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(SuccessIcon_default, {}),
|
|
160
|
+
warning: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(InfoIcon_default, {}),
|
|
161
|
+
error: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ErrorIcon_default, {})
|
|
162
|
+
};
|
|
163
|
+
var FieldMessage = (props) => {
|
|
164
|
+
const { validations } = props;
|
|
165
|
+
if (!validations || validations.length === 0) return null;
|
|
166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
167
|
+
"div",
|
|
168
|
+
{
|
|
169
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
170
|
+
children: [
|
|
171
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "icon", children: ICON[v.status] }),
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: v.message })
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
`${v.message}_${idx}`
|
|
176
|
+
)) });
|
|
177
|
+
};
|
|
178
|
+
FieldMessage.displayName = "FieldMessage";
|
|
179
|
+
var FieldMessage_default = FieldMessage;
|
|
180
|
+
var Field = (props) => {
|
|
181
|
+
const { validations, children } = props;
|
|
182
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children });
|
|
183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "lib-xplat-field", children: [
|
|
184
|
+
children,
|
|
185
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FieldMessage, { validations })
|
|
167
186
|
] });
|
|
168
187
|
};
|
|
169
|
-
|
|
170
|
-
var
|
|
188
|
+
Field.displayName = "Field";
|
|
189
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
171
190
|
|
|
172
191
|
// src/components/Input/reg.ts
|
|
173
192
|
var numberAndCommaReg = /^[0-9,]+$/;
|
|
@@ -205,7 +224,6 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
205
224
|
|
|
206
225
|
// src/components/Input/Input.tsx
|
|
207
226
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
208
|
-
var import_react2 = require("react");
|
|
209
227
|
var formatValue = (type, value) => {
|
|
210
228
|
if (value === null || value === void 0) return "";
|
|
211
229
|
const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
|
|
@@ -294,27 +312,22 @@ var Input = import_react.default.forwardRef((props, ref) => {
|
|
|
294
312
|
disabled,
|
|
295
313
|
type: type === "number" ? "text" : type,
|
|
296
314
|
value: localValue,
|
|
297
|
-
onChange: handleChange
|
|
315
|
+
onChange: handleChange,
|
|
316
|
+
"aria-invalid": hasError(validations) || void 0
|
|
298
317
|
}
|
|
299
318
|
),
|
|
300
319
|
suffix && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "suffix", children: suffix })
|
|
301
320
|
]
|
|
302
321
|
}
|
|
303
322
|
),
|
|
304
|
-
|
|
305
|
-
InputValidations_default,
|
|
306
|
-
{
|
|
307
|
-
...validation,
|
|
308
|
-
key: `${validation.message}_${idx}`
|
|
309
|
-
}
|
|
310
|
-
)) })
|
|
323
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldMessage_default, { validations })
|
|
311
324
|
] });
|
|
312
325
|
});
|
|
313
326
|
Input.displayName = "Input";
|
|
314
327
|
var Input_default = Input;
|
|
315
328
|
|
|
316
329
|
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
317
|
-
var
|
|
330
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
318
331
|
|
|
319
332
|
// src/tokens/svg/form/CloseEyeIcon.tsx
|
|
320
333
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -384,10 +397,10 @@ var OpenEyeIcon_default = OpenEyeIcon;
|
|
|
384
397
|
|
|
385
398
|
// src/components/Input/PasswordInput/PasswordInput.tsx
|
|
386
399
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
387
|
-
var PasswordInput =
|
|
400
|
+
var PasswordInput = import_react2.default.forwardRef(
|
|
388
401
|
(props, ref) => {
|
|
389
402
|
const { reg: _reg, ...inputProps } = props;
|
|
390
|
-
const [isView, setIsView] =
|
|
403
|
+
const [isView, setIsView] = import_react2.default.useState(false);
|
|
391
404
|
const handleChangeView = () => {
|
|
392
405
|
setIsView((prev) => !prev);
|
|
393
406
|
};
|
|
@@ -1,3 +1,41 @@
|
|
|
1
|
+
/* src/components/FieldMessage/fieldMessage.scss */
|
|
2
|
+
.lib-xplat-field {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: var(--spacing-space-2);
|
|
6
|
+
}
|
|
7
|
+
.lib-xplat-field-message-wrap {
|
|
8
|
+
display: flex;
|
|
9
|
+
gap: var(--spacing-space-2);
|
|
10
|
+
margin-left: var(--spacing-space-1);
|
|
11
|
+
}
|
|
12
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message {
|
|
13
|
+
display: flex;
|
|
14
|
+
gap: var(--spacing-space-1);
|
|
15
|
+
font-family: var(--semantic-typo-caption-2-r-font);
|
|
16
|
+
font-size: var(--semantic-typo-caption-2-r-size);
|
|
17
|
+
line-height: var(--semantic-typo-caption-2-r-lh);
|
|
18
|
+
font-weight: var(--semantic-typo-caption-2-r-weight);
|
|
19
|
+
letter-spacing: var(--semantic-typo-caption-2-r-ls);
|
|
20
|
+
align-items: center;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.default {
|
|
24
|
+
color: var(--semantic-icon-secondary);
|
|
25
|
+
}
|
|
26
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.success {
|
|
27
|
+
color: var(--semantic-text-success);
|
|
28
|
+
}
|
|
29
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.warning {
|
|
30
|
+
color: var(--semantic-text-warning);
|
|
31
|
+
}
|
|
32
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message.error {
|
|
33
|
+
color: var(--semantic-text-error);
|
|
34
|
+
}
|
|
35
|
+
.lib-xplat-field-message-wrap > .lib-xplat-field-message > .icon {
|
|
36
|
+
font-size: var(--semantic-typo-label-2-m-size);
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
/* src/components/Input/input.scss */
|
|
2
40
|
.lib-xplat-input-wrap {
|
|
3
41
|
display: flex;
|
|
@@ -80,34 +118,3 @@
|
|
|
80
118
|
.lib-xplat-input-wrap .lib-xplat-input > .suffix > .wrapper.pointer {
|
|
81
119
|
cursor: pointer;
|
|
82
120
|
}
|
|
83
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap {
|
|
84
|
-
display: flex;
|
|
85
|
-
gap: var(--spacing-space-2);
|
|
86
|
-
margin-left: var(--spacing-space-1);
|
|
87
|
-
}
|
|
88
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation {
|
|
89
|
-
display: flex;
|
|
90
|
-
gap: var(--spacing-space-1);
|
|
91
|
-
font-family: var(--semantic-typo-caption-2-r-font);
|
|
92
|
-
font-size: var(--semantic-typo-caption-2-r-size);
|
|
93
|
-
line-height: var(--semantic-typo-caption-2-r-lh);
|
|
94
|
-
font-weight: var(--semantic-typo-caption-2-r-weight);
|
|
95
|
-
letter-spacing: var(--semantic-typo-caption-2-r-ls);
|
|
96
|
-
align-items: center;
|
|
97
|
-
user-select: none;
|
|
98
|
-
}
|
|
99
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.default {
|
|
100
|
-
color: var(--semantic-icon-secondary);
|
|
101
|
-
}
|
|
102
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.success {
|
|
103
|
-
color: var(--semantic-text-success);
|
|
104
|
-
}
|
|
105
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.warning {
|
|
106
|
-
color: var(--semantic-text-warning);
|
|
107
|
-
}
|
|
108
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation.error {
|
|
109
|
-
color: var(--semantic-text-error);
|
|
110
|
-
}
|
|
111
|
-
.lib-xplat-input-wrap .lib-xplat-input-validation-wrap > .lib-xplat-input-validation > .icon {
|
|
112
|
-
font-size: var(--semantic-typo-label-2-m-size);
|
|
113
|
-
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.cjs';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.cjs';
|
|
3
4
|
|
|
4
5
|
type InputSize$1 = "sm" | "md" | "lg";
|
|
5
6
|
interface InputProps extends Omit<InputAttributes, "size"> {
|
|
7
|
+
/** 입력 종류. number 는 천 단위 구분, tel 은 하이픈을 자동으로 넣는다 */
|
|
6
8
|
type?: "text" | "number" | "email" | "password" | "tel";
|
|
9
|
+
/** 높이와 글자 크기 */
|
|
7
10
|
size?: InputSize$1;
|
|
8
|
-
validations?:
|
|
9
|
-
|
|
10
|
-
message: string;
|
|
11
|
-
}[];
|
|
11
|
+
validations?: Validation[];
|
|
12
|
+
/** 입력칸 오른쪽에 붙일 요소 (단위·아이콘 등) */
|
|
12
13
|
suffix?: React.ReactNode;
|
|
13
14
|
}
|
|
14
15
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
15
16
|
|
|
16
17
|
type InputSize = "sm" | "md" | "lg";
|
|
17
18
|
interface PasswordInputProps extends Omit<InputAttributes, "size"> {
|
|
18
|
-
validations?:
|
|
19
|
-
|
|
20
|
-
message: string;
|
|
21
|
-
}[];
|
|
19
|
+
validations?: Validation[];
|
|
20
|
+
/** 높이와 글자 크기 */
|
|
22
21
|
size?: InputSize;
|
|
23
22
|
reg?: RegExp;
|
|
24
23
|
}
|
|
@@ -1,24 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { I as InputAttributes } from '../../attributes-DJIWir_0.js';
|
|
3
|
+
import { V as Validation } from '../../validation-Dqo1zqhT.js';
|
|
3
4
|
|
|
4
5
|
type InputSize$1 = "sm" | "md" | "lg";
|
|
5
6
|
interface InputProps extends Omit<InputAttributes, "size"> {
|
|
7
|
+
/** 입력 종류. number 는 천 단위 구분, tel 은 하이픈을 자동으로 넣는다 */
|
|
6
8
|
type?: "text" | "number" | "email" | "password" | "tel";
|
|
9
|
+
/** 높이와 글자 크기 */
|
|
7
10
|
size?: InputSize$1;
|
|
8
|
-
validations?:
|
|
9
|
-
|
|
10
|
-
message: string;
|
|
11
|
-
}[];
|
|
11
|
+
validations?: Validation[];
|
|
12
|
+
/** 입력칸 오른쪽에 붙일 요소 (단위·아이콘 등) */
|
|
12
13
|
suffix?: React.ReactNode;
|
|
13
14
|
}
|
|
14
15
|
declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
15
16
|
|
|
16
17
|
type InputSize = "sm" | "md" | "lg";
|
|
17
18
|
interface PasswordInputProps extends Omit<InputAttributes, "size"> {
|
|
18
|
-
validations?:
|
|
19
|
-
|
|
20
|
-
message: string;
|
|
21
|
-
}[];
|
|
19
|
+
validations?: Validation[];
|
|
20
|
+
/** 높이와 글자 크기 */
|
|
22
21
|
size?: InputSize;
|
|
23
22
|
reg?: RegExp;
|
|
24
23
|
}
|
|
@@ -115,22 +115,41 @@ var SuccessIcon = () => /* @__PURE__ */ jsx3(
|
|
|
115
115
|
);
|
|
116
116
|
var SuccessIcon_default = SuccessIcon;
|
|
117
117
|
|
|
118
|
-
// src/components/
|
|
119
|
-
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
120
|
-
var
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
118
|
+
// src/components/FieldMessage/FieldMessage.tsx
|
|
119
|
+
import { Fragment, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
120
|
+
var ICON = {
|
|
121
|
+
default: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
122
|
+
success: /* @__PURE__ */ jsx4(SuccessIcon_default, {}),
|
|
123
|
+
warning: /* @__PURE__ */ jsx4(InfoIcon_default, {}),
|
|
124
|
+
error: /* @__PURE__ */ jsx4(ErrorIcon_default, {})
|
|
125
|
+
};
|
|
126
|
+
var FieldMessage = (props) => {
|
|
127
|
+
const { validations } = props;
|
|
128
|
+
if (!validations || validations.length === 0) return null;
|
|
129
|
+
return /* @__PURE__ */ jsx4("div", { className: "lib-xplat-field-message-wrap", children: validations.map((v, idx) => /* @__PURE__ */ jsxs3(
|
|
130
|
+
"div",
|
|
131
|
+
{
|
|
132
|
+
className: clsx_default("lib-xplat-field-message", v.status),
|
|
133
|
+
children: [
|
|
134
|
+
/* @__PURE__ */ jsx4("div", { className: "icon", children: ICON[v.status] }),
|
|
135
|
+
/* @__PURE__ */ jsx4("span", { children: v.message })
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
`${v.message}_${idx}`
|
|
139
|
+
)) });
|
|
140
|
+
};
|
|
141
|
+
FieldMessage.displayName = "FieldMessage";
|
|
142
|
+
var FieldMessage_default = FieldMessage;
|
|
143
|
+
var Field = (props) => {
|
|
144
|
+
const { validations, children } = props;
|
|
145
|
+
if (!validations || validations.length === 0) return /* @__PURE__ */ jsx4(Fragment, { children });
|
|
146
|
+
return /* @__PURE__ */ jsxs3("div", { className: "lib-xplat-field", children: [
|
|
147
|
+
children,
|
|
148
|
+
/* @__PURE__ */ jsx4(FieldMessage, { validations })
|
|
130
149
|
] });
|
|
131
150
|
};
|
|
132
|
-
|
|
133
|
-
var
|
|
151
|
+
Field.displayName = "Field";
|
|
152
|
+
var hasError = (validations) => !!validations?.some((v) => v.status === "error");
|
|
134
153
|
|
|
135
154
|
// src/components/Input/reg.ts
|
|
136
155
|
var numberAndCommaReg = /^[0-9,]+$/;
|
|
@@ -168,7 +187,6 @@ var handleTelBackspace = (prevValue, currValue) => {
|
|
|
168
187
|
|
|
169
188
|
// src/components/Input/Input.tsx
|
|
170
189
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
171
|
-
import { createElement } from "react";
|
|
172
190
|
var formatValue = (type, value) => {
|
|
173
191
|
if (value === null || value === void 0) return "";
|
|
174
192
|
const strValue = Array.isArray(value) ? String(value[0] ?? "") : String(value);
|
|
@@ -257,20 +275,15 @@ var Input = React.forwardRef((props, ref) => {
|
|
|
257
275
|
disabled,
|
|
258
276
|
type: type === "number" ? "text" : type,
|
|
259
277
|
value: localValue,
|
|
260
|
-
onChange: handleChange
|
|
278
|
+
onChange: handleChange,
|
|
279
|
+
"aria-invalid": hasError(validations) || void 0
|
|
261
280
|
}
|
|
262
281
|
),
|
|
263
282
|
suffix && /* @__PURE__ */ jsx5("div", { className: "suffix", children: suffix })
|
|
264
283
|
]
|
|
265
284
|
}
|
|
266
285
|
),
|
|
267
|
-
|
|
268
|
-
InputValidations_default,
|
|
269
|
-
{
|
|
270
|
-
...validation,
|
|
271
|
-
key: `${validation.message}_${idx}`
|
|
272
|
-
}
|
|
273
|
-
)) })
|
|
286
|
+
/* @__PURE__ */ jsx5(FieldMessage_default, { validations })
|
|
274
287
|
] });
|
|
275
288
|
});
|
|
276
289
|
Input.displayName = "Input";
|
|
@@ -25,6 +25,9 @@ __export(NotificationBadge_exports, {
|
|
|
25
25
|
});
|
|
26
26
|
module.exports = __toCommonJS(NotificationBadge_exports);
|
|
27
27
|
|
|
28
|
+
// src/tokens/interface/status.ts
|
|
29
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
30
|
+
|
|
28
31
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
29
32
|
function r(e) {
|
|
30
33
|
var t, f, n = "";
|
|
@@ -52,11 +55,12 @@ var NotificationBadge = (props) => {
|
|
|
52
55
|
dot = false,
|
|
53
56
|
size = "md"
|
|
54
57
|
} = props;
|
|
58
|
+
const statusType = normalizeStatus(type);
|
|
55
59
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
56
60
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
57
61
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("lib-xplat-notification-badge", size), children: [
|
|
58
62
|
children,
|
|
59
|
-
showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: clsx_default("badge-indicator",
|
|
63
|
+
showBadge && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: clsx_default("badge-indicator", statusType, { dot }), children: !dot && displayCount })
|
|
60
64
|
] });
|
|
61
65
|
};
|
|
62
66
|
NotificationBadge.displayName = "NotificationBadge";
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
.lib-xplat-notification-badge .badge-indicator.info {
|
|
71
71
|
background-color: var(--semantic-surface-info-default);
|
|
72
72
|
}
|
|
73
|
+
.lib-xplat-notification-badge .badge-indicator.primary,
|
|
73
74
|
.lib-xplat-notification-badge .badge-indicator.brand {
|
|
74
75
|
background-color: var(--semantic-surface-brand-default);
|
|
75
76
|
}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-g_KP3qT6.cjs';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
/** NotificationBadge 의 상태 색 */
|
|
6
|
+
type NotificationBadgeType = "primary" | "success" | "error" | "warning" | "info";
|
|
7
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
8
|
+
type NotificationBadgeTypeInput = NotificationBadgeType | LegacyStatusType;
|
|
5
9
|
type NotificationBadgeSize = "sm" | "md" | "lg";
|
|
6
10
|
/**
|
|
7
11
|
* 알림 뱃지 — 다른 요소의 **우상단 모서리에 얹히는** 작은 원.
|
|
@@ -33,7 +37,7 @@ interface NotificationBadgeProps {
|
|
|
33
37
|
/** 개수 대신 점만 표시한다. `count` 없이 "새 항목 있음" 만 알릴 때 쓴다 */
|
|
34
38
|
dot?: boolean;
|
|
35
39
|
/** 뱃지 색. 뱃지가 렌더될 때만 의미가 있다 */
|
|
36
|
-
type?:
|
|
40
|
+
type?: NotificationBadgeTypeInput;
|
|
37
41
|
/** `count` 가 이 값을 넘으면 `99+` 처럼 표시한다 */
|
|
38
42
|
maxCount?: number;
|
|
39
43
|
/** 뱃지 크기. 대상의 크기가 아니다 */
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { L as LegacyStatusType } from '../../status-g_KP3qT6.js';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
+
/** NotificationBadge 의 상태 색 */
|
|
6
|
+
type NotificationBadgeType = "primary" | "success" | "error" | "warning" | "info";
|
|
7
|
+
/** 입력으로는 예전 이름 `brand` 도 받는다 (= `primary`) */
|
|
8
|
+
type NotificationBadgeTypeInput = NotificationBadgeType | LegacyStatusType;
|
|
5
9
|
type NotificationBadgeSize = "sm" | "md" | "lg";
|
|
6
10
|
/**
|
|
7
11
|
* 알림 뱃지 — 다른 요소의 **우상단 모서리에 얹히는** 작은 원.
|
|
@@ -33,7 +37,7 @@ interface NotificationBadgeProps {
|
|
|
33
37
|
/** 개수 대신 점만 표시한다. `count` 없이 "새 항목 있음" 만 알릴 때 쓴다 */
|
|
34
38
|
dot?: boolean;
|
|
35
39
|
/** 뱃지 색. 뱃지가 렌더될 때만 의미가 있다 */
|
|
36
|
-
type?:
|
|
40
|
+
type?: NotificationBadgeTypeInput;
|
|
37
41
|
/** `count` 가 이 값을 넘으면 `99+` 처럼 표시한다 */
|
|
38
42
|
maxCount?: number;
|
|
39
43
|
/** 뱃지 크기. 대상의 크기가 아니다 */
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// src/tokens/interface/status.ts
|
|
2
|
+
var normalizeStatus = (value) => value === "brand" ? "primary" : value;
|
|
3
|
+
|
|
1
4
|
// ../../node_modules/clsx/dist/clsx.mjs
|
|
2
5
|
function r(e) {
|
|
3
6
|
var t, f, n = "";
|
|
@@ -25,11 +28,12 @@ var NotificationBadge = (props) => {
|
|
|
25
28
|
dot = false,
|
|
26
29
|
size = "md"
|
|
27
30
|
} = props;
|
|
31
|
+
const statusType = normalizeStatus(type);
|
|
28
32
|
const showBadge = dot || count !== void 0 && count > 0;
|
|
29
33
|
const displayCount = count !== void 0 && count > maxCount ? `${maxCount}+` : count;
|
|
30
34
|
return /* @__PURE__ */ jsxs("div", { className: clsx_default("lib-xplat-notification-badge", size), children: [
|
|
31
35
|
children,
|
|
32
|
-
showBadge && /* @__PURE__ */ jsx("span", { className: clsx_default("badge-indicator",
|
|
36
|
+
showBadge && /* @__PURE__ */ jsx("span", { className: clsx_default("badge-indicator", statusType, { dot }), children: !dot && displayCount })
|
|
33
37
|
] });
|
|
34
38
|
};
|
|
35
39
|
NotificationBadge.displayName = "NotificationBadge";
|