@duskmoon-dev/components 0.3.3 → 0.4.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/README.md +61 -2
- package/dist/classes/chat.d.ts +9 -1
- package/dist/classes/console-page.d.ts +16 -0
- package/dist/classes/dropdown.d.ts +5 -5
- package/dist/classes/fab.d.ts +11 -0
- package/dist/classes/index.d.ts +5 -0
- package/dist/classes/index.js +180 -34
- package/dist/classes/megamenu.d.ts +10 -0
- package/dist/classes/otp-input.d.ts +12 -0
- package/dist/classes/popover.d.ts +1 -3
- package/dist/classes/swap.d.ts +12 -0
- package/dist/classes/tree-select.d.ts +6 -6
- package/dist/components/app/index.js +128 -68
- package/dist/components/avatar/Avatar.types.d.ts +1 -1
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/Button.d.ts +1 -1
- package/dist/components/button/Button.types.d.ts +8 -0
- package/dist/components/button/index.js +253 -24
- package/dist/components/calendar/index.js +44 -19
- package/dist/components/chat/Chat.d.ts +9 -1
- package/dist/components/chat/Chat.types.d.ts +26 -0
- package/dist/components/chat/index.js +92 -3
- package/dist/components/color-picker/ColorPicker.types.d.ts +2 -1
- package/dist/components/color-picker/index.js +206 -9
- package/dist/components/console-page/ConsolePage.d.ts +2 -0
- package/dist/components/console-page/ConsolePage.types.d.ts +29 -0
- package/dist/components/console-page/index.d.ts +2 -0
- package/dist/components/console-page/index.js +205 -0
- package/dist/components/date-picker/DatePicker.types.d.ts +1 -0
- package/dist/components/date-picker/index.js +537 -35
- package/dist/components/date-picker/usePickerDropdown.d.ts +17 -0
- package/dist/components/dm-date-picker/index.js +545 -43
- package/dist/components/dm-drawer/index.js +253 -24
- package/dist/components/dm-layout/index.js +391 -24
- package/dist/components/dm-menu/index.js +380 -13
- package/dist/components/dm-page-header/index.js +404 -114
- package/dist/components/dm-pro-table/index.js +1183 -368
- package/dist/components/dm-query/DmQuery.types.d.ts +1 -1
- package/dist/components/dm-query/index.js +931 -188
- package/dist/components/dm-search/DmSearch.types.d.ts +4 -0
- package/dist/components/dm-search/index.js +917 -163
- package/dist/components/dm-table/index.js +1001 -247
- package/dist/components/dm-toolbar/index.js +400 -110
- package/dist/components/dm-truncate/index.js +115 -35
- package/dist/components/dropdown/Dropdown.types.d.ts +1 -1
- package/dist/components/dropdown/index.js +400 -110
- package/dist/components/fab/Fab.d.ts +4 -0
- package/dist/components/fab/Fab.types.d.ts +25 -0
- package/dist/components/fab/index.d.ts +2 -0
- package/dist/components/fab/index.js +480 -0
- package/dist/components/form/Form.types.d.ts +1 -0
- package/dist/components/form/index.js +14 -3
- package/dist/components/megamenu/Megamenu.d.ts +2 -0
- package/dist/components/megamenu/Megamenu.types.d.ts +32 -0
- package/dist/components/megamenu/index.d.ts +2 -0
- package/dist/components/megamenu/index.js +214 -0
- package/dist/components/modal/index.js +128 -68
- package/dist/components/otp-input/OtpInput.d.ts +2 -0
- package/dist/components/otp-input/OtpInput.types.d.ts +16 -0
- package/dist/components/otp-input/index.d.ts +2 -0
- package/dist/components/otp-input/index.js +112 -0
- package/dist/components/popconfirm/index.js +255 -26
- package/dist/components/popover/index.js +24 -4
- package/dist/components/swap/Swap.d.ts +3 -0
- package/dist/components/swap/Swap.types.d.ts +22 -0
- package/dist/components/swap/index.d.ts +2 -0
- package/dist/components/swap/index.js +109 -0
- package/dist/components/time-picker/TimePicker.types.d.ts +1 -0
- package/dist/components/time-picker/index.js +167 -29
- package/dist/components/tooltip/Tooltip.types.d.ts +4 -0
- package/dist/components/tooltip/index.js +107 -27
- package/dist/components/tour/index.js +253 -24
- package/dist/components/tree-select/index.js +8 -8
- package/dist/components/upload/Upload.types.d.ts +1 -0
- package/dist/components/upload/index.js +2 -0
- package/dist/generated/version.d.ts +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +3330 -1632
- package/dist/infrastructure.js +1 -1
- package/dist/styles.css +1190 -906
- package/package.json +23 -3
|
@@ -890,15 +890,342 @@ MenuRoot.Item = MenuItem;
|
|
|
890
890
|
MenuRoot.Divider = MenuDivider;
|
|
891
891
|
MenuRoot.ItemGroup = MenuItemGroup;
|
|
892
892
|
var Menu = MenuRoot;
|
|
893
|
+
// src/components/button/Button.tsx
|
|
894
|
+
import React5 from "react";
|
|
895
|
+
import { createPortal } from "react-dom";
|
|
896
|
+
|
|
897
|
+
// src/classes/button.ts
|
|
898
|
+
var buttonBaseClass = "btn";
|
|
899
|
+
var buttonColorClasses = {
|
|
900
|
+
primary: "btn-primary",
|
|
901
|
+
secondary: "btn-secondary",
|
|
902
|
+
tertiary: "btn-tertiary",
|
|
903
|
+
accent: "btn-accent",
|
|
904
|
+
neutral: "btn-neutral",
|
|
905
|
+
base: "btn-base",
|
|
906
|
+
info: "btn-info",
|
|
907
|
+
success: "btn-success",
|
|
908
|
+
warning: "btn-warning",
|
|
909
|
+
error: "btn-error"
|
|
910
|
+
};
|
|
911
|
+
var buttonAppearanceClasses = {
|
|
912
|
+
filled: "",
|
|
913
|
+
outline: "btn-outline",
|
|
914
|
+
tonal: "btn-tonal",
|
|
915
|
+
ghost: "btn-ghost",
|
|
916
|
+
text: "btn-text"
|
|
917
|
+
};
|
|
918
|
+
var buttonShapeClasses = {
|
|
919
|
+
rect: "",
|
|
920
|
+
circle: "btn-circle btn-icon",
|
|
921
|
+
square: "btn-square"
|
|
922
|
+
};
|
|
923
|
+
var buttonSizeClasses = {
|
|
924
|
+
xs: "btn-xs",
|
|
925
|
+
sm: "btn-sm",
|
|
926
|
+
md: "btn-md",
|
|
927
|
+
lg: "btn-lg"
|
|
928
|
+
};
|
|
929
|
+
var buttonBlockClass = "btn-block";
|
|
930
|
+
var buttonIsLoadingClass = "btn-loading";
|
|
931
|
+
function getButtonClasses({
|
|
932
|
+
color = "primary",
|
|
933
|
+
appearance = "filled",
|
|
934
|
+
shape = "rect",
|
|
935
|
+
size = "md",
|
|
936
|
+
block,
|
|
937
|
+
isLoading,
|
|
938
|
+
className
|
|
939
|
+
}) {
|
|
940
|
+
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], shape === "circle" && size === "xs" && "btn-icon-sm", shape === "circle" && size === "sm" && "btn-icon-sm", shape === "circle" && size === "lg" && "btn-icon-lg", block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/components/button/Button.tsx
|
|
944
|
+
import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
945
|
+
function isPromiseLike(value) {
|
|
946
|
+
return value !== null && (typeof value === "object" || typeof value === "function") && typeof value.then === "function";
|
|
947
|
+
}
|
|
948
|
+
function Button({
|
|
949
|
+
color = "primary",
|
|
950
|
+
appearance = "filled",
|
|
951
|
+
shape = "rect",
|
|
952
|
+
size = "md",
|
|
953
|
+
block,
|
|
954
|
+
isLoading,
|
|
955
|
+
leftIcon,
|
|
956
|
+
rightIcon,
|
|
957
|
+
className,
|
|
958
|
+
children,
|
|
959
|
+
disabled,
|
|
960
|
+
ref,
|
|
961
|
+
confirm,
|
|
962
|
+
onClick,
|
|
963
|
+
...props
|
|
964
|
+
}) {
|
|
965
|
+
const buttonRef = React5.useRef(null);
|
|
966
|
+
const popoverRef = React5.useRef(null);
|
|
967
|
+
const cancelRef = React5.useRef(null);
|
|
968
|
+
const approvalRef = React5.useRef("idle");
|
|
969
|
+
const pendingRef = React5.useRef(false);
|
|
970
|
+
const actionRef = React5.useRef(0);
|
|
971
|
+
const operationRef = React5.useRef(0);
|
|
972
|
+
const mountedRef = React5.useRef(false);
|
|
973
|
+
const [portalTarget, setPortalTarget] = React5.useState(null);
|
|
974
|
+
const [confirmLoading, setConfirmLoading] = React5.useState(false);
|
|
975
|
+
const [confirmError, setConfirmError] = React5.useState(false);
|
|
976
|
+
const generatedId = React5.useId().replace(/:/g, "");
|
|
977
|
+
const popoverId = `button-confirm-${generatedId}`;
|
|
978
|
+
const titleId = `${popoverId}-title`;
|
|
979
|
+
const descriptionId = `${popoverId}-description`;
|
|
980
|
+
const anchor = `--${popoverId}-anchor`;
|
|
981
|
+
const hasConfirm = Boolean(confirm);
|
|
982
|
+
const confirmation = confirm && typeof confirm === "object" ? confirm : undefined;
|
|
983
|
+
const title = confirmation ? confirmation.title : "Confirm action";
|
|
984
|
+
const hasTitle = title !== undefined && title !== null && title !== false && title !== "";
|
|
985
|
+
const content = confirmation?.component ?? confirmation?.message ?? confirmation?.description;
|
|
986
|
+
const hasContent = content !== undefined && content !== null && content !== false && content !== "";
|
|
987
|
+
const mergedRef = React5.useCallback((node) => {
|
|
988
|
+
buttonRef.current = node;
|
|
989
|
+
if (!node) {
|
|
990
|
+
if (typeof ref === "function")
|
|
991
|
+
ref(null);
|
|
992
|
+
else if (ref)
|
|
993
|
+
ref.current = null;
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const cleanup = typeof ref === "function" ? ref(node) : undefined;
|
|
997
|
+
if (ref && typeof ref !== "function")
|
|
998
|
+
ref.current = node;
|
|
999
|
+
return () => {
|
|
1000
|
+
buttonRef.current = null;
|
|
1001
|
+
if (typeof cleanup === "function")
|
|
1002
|
+
cleanup();
|
|
1003
|
+
else if (typeof ref === "function")
|
|
1004
|
+
ref(null);
|
|
1005
|
+
else if (ref)
|
|
1006
|
+
ref.current = null;
|
|
1007
|
+
};
|
|
1008
|
+
}, [ref]);
|
|
1009
|
+
React5.useEffect(() => {
|
|
1010
|
+
mountedRef.current = true;
|
|
1011
|
+
return () => {
|
|
1012
|
+
mountedRef.current = false;
|
|
1013
|
+
operationRef.current += 1;
|
|
1014
|
+
};
|
|
1015
|
+
}, []);
|
|
1016
|
+
React5.useEffect(() => {
|
|
1017
|
+
operationRef.current += 1;
|
|
1018
|
+
approvalRef.current = "idle";
|
|
1019
|
+
setConfirmError(false);
|
|
1020
|
+
setPortalTarget(hasConfirm ? document.body : null);
|
|
1021
|
+
}, [hasConfirm]);
|
|
1022
|
+
function closePopover() {
|
|
1023
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
1024
|
+
popoverRef.current.hidePopover();
|
|
1025
|
+
}
|
|
1026
|
+
buttonRef.current?.focus();
|
|
1027
|
+
}
|
|
1028
|
+
function handleClick(event) {
|
|
1029
|
+
if (!confirm) {
|
|
1030
|
+
onClick?.(event);
|
|
1031
|
+
return;
|
|
1032
|
+
}
|
|
1033
|
+
if (approvalRef.current === "native") {
|
|
1034
|
+
approvalRef.current = "idle";
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
1037
|
+
if (approvalRef.current === "action") {
|
|
1038
|
+
approvalRef.current = "idle";
|
|
1039
|
+
let result;
|
|
1040
|
+
try {
|
|
1041
|
+
result = onClick?.(event);
|
|
1042
|
+
} catch {
|
|
1043
|
+
event.preventDefault();
|
|
1044
|
+
pendingRef.current = false;
|
|
1045
|
+
setConfirmError(true);
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
if (!isPromiseLike(result)) {
|
|
1049
|
+
pendingRef.current = false;
|
|
1050
|
+
closePopover();
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
const userPreventedDefault = event.defaultPrevented;
|
|
1054
|
+
event.preventDefault();
|
|
1055
|
+
setConfirmLoading(true);
|
|
1056
|
+
const action = actionRef.current;
|
|
1057
|
+
const operation = operationRef.current;
|
|
1058
|
+
Promise.resolve(result).then(() => {
|
|
1059
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
1060
|
+
return;
|
|
1061
|
+
pendingRef.current = false;
|
|
1062
|
+
setConfirmLoading(false);
|
|
1063
|
+
if (operation !== operationRef.current)
|
|
1064
|
+
return;
|
|
1065
|
+
closePopover();
|
|
1066
|
+
if (!userPreventedDefault && !buttonRef.current?.disabled) {
|
|
1067
|
+
approvalRef.current = "native";
|
|
1068
|
+
buttonRef.current?.click();
|
|
1069
|
+
approvalRef.current = "idle";
|
|
1070
|
+
}
|
|
1071
|
+
}, () => {
|
|
1072
|
+
if (!mountedRef.current || action !== actionRef.current)
|
|
1073
|
+
return;
|
|
1074
|
+
pendingRef.current = false;
|
|
1075
|
+
setConfirmLoading(false);
|
|
1076
|
+
if (operation !== operationRef.current)
|
|
1077
|
+
return;
|
|
1078
|
+
setConfirmError(true);
|
|
1079
|
+
cancelRef.current?.focus();
|
|
1080
|
+
});
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
event.preventDefault();
|
|
1084
|
+
if (disabled || isLoading || pendingRef.current)
|
|
1085
|
+
return;
|
|
1086
|
+
if (popoverRef.current?.matches(":popover-open")) {
|
|
1087
|
+
closePopover();
|
|
1088
|
+
return;
|
|
1089
|
+
}
|
|
1090
|
+
setConfirmError(false);
|
|
1091
|
+
popoverRef.current?.showPopover();
|
|
1092
|
+
cancelRef.current?.focus();
|
|
1093
|
+
}
|
|
1094
|
+
function handleConfirm(event) {
|
|
1095
|
+
event.preventDefault();
|
|
1096
|
+
event.stopPropagation();
|
|
1097
|
+
const trigger = buttonRef.current;
|
|
1098
|
+
if (disabled || isLoading || pendingRef.current || !trigger || trigger.disabled || !event.currentTarget.matches(":popover-open"))
|
|
1099
|
+
return;
|
|
1100
|
+
setConfirmError(false);
|
|
1101
|
+
pendingRef.current = true;
|
|
1102
|
+
actionRef.current += 1;
|
|
1103
|
+
approvalRef.current = "action";
|
|
1104
|
+
trigger.click();
|
|
1105
|
+
if (approvalRef.current === "action") {
|
|
1106
|
+
approvalRef.current = "idle";
|
|
1107
|
+
pendingRef.current = false;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
const classes = getButtonClasses({
|
|
1111
|
+
color,
|
|
1112
|
+
appearance,
|
|
1113
|
+
shape,
|
|
1114
|
+
size,
|
|
1115
|
+
block,
|
|
1116
|
+
isLoading,
|
|
1117
|
+
className
|
|
1118
|
+
});
|
|
1119
|
+
const confirmClasses = getButtonClasses({
|
|
1120
|
+
color,
|
|
1121
|
+
size: "sm",
|
|
1122
|
+
isLoading: confirmLoading
|
|
1123
|
+
});
|
|
1124
|
+
return /* @__PURE__ */ jsxs5(Fragment2, {
|
|
1125
|
+
children: [
|
|
1126
|
+
/* @__PURE__ */ jsxs5("button", {
|
|
1127
|
+
ref: confirm ? mergedRef : ref,
|
|
1128
|
+
className: classes,
|
|
1129
|
+
disabled: disabled || isLoading,
|
|
1130
|
+
"aria-busy": isLoading,
|
|
1131
|
+
"aria-disabled": disabled || isLoading,
|
|
1132
|
+
...props,
|
|
1133
|
+
style: confirm ? { ...props.style, anchorName: anchor } : props.style,
|
|
1134
|
+
"aria-haspopup": confirm ? "dialog" : props["aria-haspopup"],
|
|
1135
|
+
"aria-controls": confirm ? popoverId : props["aria-controls"],
|
|
1136
|
+
onClick: confirm ? handleClick : onClick,
|
|
1137
|
+
children: [
|
|
1138
|
+
isLoading && /* @__PURE__ */ jsx5("span", {
|
|
1139
|
+
className: "btn-spinner"
|
|
1140
|
+
}),
|
|
1141
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsx5("span", {
|
|
1142
|
+
className: "btn-icon-left",
|
|
1143
|
+
children: leftIcon
|
|
1144
|
+
}),
|
|
1145
|
+
/* @__PURE__ */ jsx5("span", {
|
|
1146
|
+
className: "btn-content",
|
|
1147
|
+
children
|
|
1148
|
+
}),
|
|
1149
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsx5("span", {
|
|
1150
|
+
className: "btn-icon-right",
|
|
1151
|
+
children: rightIcon
|
|
1152
|
+
})
|
|
1153
|
+
]
|
|
1154
|
+
}),
|
|
1155
|
+
confirm && portalTarget && createPortal(/* @__PURE__ */ jsxs5("form", {
|
|
1156
|
+
id: popoverId,
|
|
1157
|
+
ref: popoverRef,
|
|
1158
|
+
popover: "auto",
|
|
1159
|
+
role: "dialog",
|
|
1160
|
+
"aria-labelledby": hasTitle ? titleId : undefined,
|
|
1161
|
+
"aria-label": hasTitle ? undefined : "Confirm action",
|
|
1162
|
+
"aria-describedby": hasContent ? descriptionId : undefined,
|
|
1163
|
+
className: "popover popover-confirm popover-bottom",
|
|
1164
|
+
style: { positionAnchor: anchor },
|
|
1165
|
+
onSubmit: handleConfirm,
|
|
1166
|
+
onClick: (event) => event.stopPropagation(),
|
|
1167
|
+
onToggle: (event) => {
|
|
1168
|
+
if (!event.currentTarget.matches(":popover-open")) {
|
|
1169
|
+
operationRef.current += 1;
|
|
1170
|
+
if (event.currentTarget.contains(document.activeElement) || document.activeElement === document.body) {
|
|
1171
|
+
buttonRef.current?.focus();
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
},
|
|
1175
|
+
children: [
|
|
1176
|
+
hasTitle && /* @__PURE__ */ jsx5("div", {
|
|
1177
|
+
className: "popover-header",
|
|
1178
|
+
children: /* @__PURE__ */ jsx5("h3", {
|
|
1179
|
+
id: titleId,
|
|
1180
|
+
className: "popover-title",
|
|
1181
|
+
children: title
|
|
1182
|
+
})
|
|
1183
|
+
}),
|
|
1184
|
+
hasContent && /* @__PURE__ */ jsx5("div", {
|
|
1185
|
+
id: descriptionId,
|
|
1186
|
+
className: "popover-body",
|
|
1187
|
+
children: content
|
|
1188
|
+
}),
|
|
1189
|
+
confirmError && /* @__PURE__ */ jsx5("div", {
|
|
1190
|
+
role: "alert",
|
|
1191
|
+
className: "popover-body",
|
|
1192
|
+
children: "The action failed. Please try again."
|
|
1193
|
+
}),
|
|
1194
|
+
/* @__PURE__ */ jsxs5("div", {
|
|
1195
|
+
className: "popover-footer",
|
|
1196
|
+
children: [
|
|
1197
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1198
|
+
ref: cancelRef,
|
|
1199
|
+
type: "button",
|
|
1200
|
+
className: "btn btn-text btn-sm",
|
|
1201
|
+
popoverTarget: popoverId,
|
|
1202
|
+
popoverTargetAction: "hide",
|
|
1203
|
+
disabled: confirmLoading,
|
|
1204
|
+
children: confirmation?.cancelText ?? "Cancel"
|
|
1205
|
+
}),
|
|
1206
|
+
/* @__PURE__ */ jsx5("button", {
|
|
1207
|
+
type: "submit",
|
|
1208
|
+
className: confirmClasses,
|
|
1209
|
+
disabled: disabled || isLoading || confirmLoading,
|
|
1210
|
+
"aria-busy": confirmLoading,
|
|
1211
|
+
children: confirmation?.confirmText ?? "Confirm"
|
|
1212
|
+
})
|
|
1213
|
+
]
|
|
1214
|
+
})
|
|
1215
|
+
]
|
|
1216
|
+
}), portalTarget)
|
|
1217
|
+
]
|
|
1218
|
+
});
|
|
1219
|
+
}
|
|
893
1220
|
// src/components/dm-menu/DmMenu.tsx
|
|
894
|
-
import { jsx as
|
|
1221
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
895
1222
|
function getMenuLabel(menu, locale) {
|
|
896
1223
|
return locale === "en-US" && menu.menuNameEn ? menu.menuNameEn : menu.menuName;
|
|
897
1224
|
}
|
|
898
1225
|
function renderIcon(icon) {
|
|
899
1226
|
if (!icon)
|
|
900
1227
|
return;
|
|
901
|
-
return typeof icon === "string" ? /* @__PURE__ */
|
|
1228
|
+
return typeof icon === "string" ? /* @__PURE__ */ jsx6("span", {
|
|
902
1229
|
className: dmMenuProductIconClass,
|
|
903
1230
|
"aria-hidden": "true",
|
|
904
1231
|
children: icon
|
|
@@ -923,6 +1250,28 @@ function toMenuItems(menus, locale, byKey) {
|
|
|
923
1250
|
function createDmMenuItems(menus, locale) {
|
|
924
1251
|
return toMenuItems(menus, locale);
|
|
925
1252
|
}
|
|
1253
|
+
function presentMenuItem(item, collapsed) {
|
|
1254
|
+
if (item.type === "divider")
|
|
1255
|
+
return item;
|
|
1256
|
+
const label = item.label ?? item.title;
|
|
1257
|
+
const initial = typeof label === "string" ? label.trim().slice(0, 1) : "";
|
|
1258
|
+
return {
|
|
1259
|
+
...item,
|
|
1260
|
+
label: /* @__PURE__ */ jsx6("span", {
|
|
1261
|
+
className: "dm-menu-item-label",
|
|
1262
|
+
children: label
|
|
1263
|
+
}),
|
|
1264
|
+
icon: item.icon || collapsed ? /* @__PURE__ */ jsx6("span", {
|
|
1265
|
+
"aria-hidden": "true",
|
|
1266
|
+
className: "dm-menu-item-symbol",
|
|
1267
|
+
children: item.icon || /* @__PURE__ */ jsx6("span", {
|
|
1268
|
+
className: "dm-menu-item-initial",
|
|
1269
|
+
children: initial || "•"
|
|
1270
|
+
})
|
|
1271
|
+
}) : undefined,
|
|
1272
|
+
children: item.children?.map((child) => presentMenuItem(child, collapsed))
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
926
1275
|
var DmMenu = forwardRef5(({
|
|
927
1276
|
menus = [],
|
|
928
1277
|
items,
|
|
@@ -941,14 +1290,14 @@ var DmMenu = forwardRef5(({
|
|
|
941
1290
|
menuByKey.clear();
|
|
942
1291
|
return toMenuItems(menus, locale, menuByKey);
|
|
943
1292
|
}, [locale, menuByKey, menus]);
|
|
944
|
-
const contentItems = items ?? schemaItems;
|
|
1293
|
+
const contentItems = (items ?? schemaItems).map((item) => presentMenuItem(item, inlineCollapsed));
|
|
945
1294
|
function handleClick(info) {
|
|
946
1295
|
onClick?.({
|
|
947
1296
|
...info,
|
|
948
1297
|
menu: menuByKey.get(info.key)
|
|
949
1298
|
});
|
|
950
1299
|
}
|
|
951
|
-
return /* @__PURE__ */
|
|
1300
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
952
1301
|
ref,
|
|
953
1302
|
className: getDmMenuClasses({
|
|
954
1303
|
hideProductHeader,
|
|
@@ -956,25 +1305,25 @@ var DmMenu = forwardRef5(({
|
|
|
956
1305
|
className
|
|
957
1306
|
}),
|
|
958
1307
|
children: [
|
|
959
|
-
hideProductHeader ? null : /* @__PURE__ */
|
|
1308
|
+
hideProductHeader ? null : /* @__PURE__ */ jsx6("div", {
|
|
960
1309
|
className: dmMenuHeaderClass,
|
|
961
|
-
children: /* @__PURE__ */
|
|
1310
|
+
children: /* @__PURE__ */ jsx6(Menu, {
|
|
962
1311
|
mode: "inline",
|
|
963
1312
|
inlineCollapsed,
|
|
964
1313
|
selectable: false,
|
|
965
1314
|
items: [
|
|
966
|
-
{
|
|
1315
|
+
presentMenuItem({
|
|
967
1316
|
key: "__product",
|
|
968
1317
|
label: productTitle,
|
|
969
1318
|
title: productTitle,
|
|
970
1319
|
icon: renderIcon(productIcon)
|
|
971
|
-
}
|
|
1320
|
+
}, inlineCollapsed)
|
|
972
1321
|
]
|
|
973
1322
|
})
|
|
974
1323
|
}),
|
|
975
|
-
/* @__PURE__ */
|
|
1324
|
+
/* @__PURE__ */ jsx6("div", {
|
|
976
1325
|
className: dmMenuContentClass,
|
|
977
|
-
children: /* @__PURE__ */
|
|
1326
|
+
children: /* @__PURE__ */ jsx6(Menu, {
|
|
978
1327
|
...props,
|
|
979
1328
|
mode: props.mode ?? "inline",
|
|
980
1329
|
items: contentItems,
|
|
@@ -982,14 +1331,32 @@ var DmMenu = forwardRef5(({
|
|
|
982
1331
|
onClick: handleClick
|
|
983
1332
|
})
|
|
984
1333
|
}),
|
|
985
|
-
onCollapsed ? /* @__PURE__ */
|
|
1334
|
+
onCollapsed ? /* @__PURE__ */ jsx6("div", {
|
|
986
1335
|
className: dmMenuFooterClass,
|
|
987
|
-
children: /* @__PURE__ */
|
|
1336
|
+
children: /* @__PURE__ */ jsx6(Button, {
|
|
988
1337
|
type: "button",
|
|
1338
|
+
color: "base",
|
|
1339
|
+
appearance: "ghost",
|
|
1340
|
+
shape: "square",
|
|
1341
|
+
size: "sm",
|
|
989
1342
|
className: dmMenuCollapseButtonClass,
|
|
990
1343
|
"aria-label": inlineCollapsed ? "Expand menu" : "Collapse menu",
|
|
991
1344
|
onClick: onCollapsed,
|
|
992
|
-
children:
|
|
1345
|
+
children: /* @__PURE__ */ jsx6("svg", {
|
|
1346
|
+
"aria-hidden": "true",
|
|
1347
|
+
focusable: "false",
|
|
1348
|
+
width: "18",
|
|
1349
|
+
height: "18",
|
|
1350
|
+
viewBox: "0 0 24 24",
|
|
1351
|
+
fill: "none",
|
|
1352
|
+
stroke: "currentColor",
|
|
1353
|
+
strokeWidth: "2",
|
|
1354
|
+
strokeLinecap: "round",
|
|
1355
|
+
strokeLinejoin: "round",
|
|
1356
|
+
children: /* @__PURE__ */ jsx6("path", {
|
|
1357
|
+
d: inlineCollapsed ? "m9 18 6-6-6-6" : "m15 18-6-6 6-6"
|
|
1358
|
+
})
|
|
1359
|
+
})
|
|
993
1360
|
})
|
|
994
1361
|
}) : null
|
|
995
1362
|
]
|
|
@@ -997,7 +1364,7 @@ var DmMenu = forwardRef5(({
|
|
|
997
1364
|
});
|
|
998
1365
|
DmMenu.displayName = "DmMenu";
|
|
999
1366
|
// src/components/dm-layout/DmLayout.tsx
|
|
1000
|
-
import { jsx as
|
|
1367
|
+
import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1001
1368
|
function getLabel(menu, locale) {
|
|
1002
1369
|
return locale === "en-US" && menu.menuNameEn ? menu.menuNameEn : menu.menuName;
|
|
1003
1370
|
}
|
|
@@ -1120,23 +1487,23 @@ var DmLayout = forwardRef6(({
|
|
|
1120
1487
|
}
|
|
1121
1488
|
onCollapse?.(nextCollapsed);
|
|
1122
1489
|
}
|
|
1123
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsx7(Layout, {
|
|
1124
1491
|
...props,
|
|
1125
1492
|
ref,
|
|
1126
1493
|
hasSider: true,
|
|
1127
1494
|
className: getDmLayoutClasses({ className }),
|
|
1128
|
-
children: /* @__PURE__ */
|
|
1495
|
+
children: /* @__PURE__ */ jsxs7(Layout, {
|
|
1129
1496
|
className: dmLayoutShellClass,
|
|
1130
1497
|
hasSider: true,
|
|
1131
1498
|
children: [
|
|
1132
|
-
/* @__PURE__ */
|
|
1499
|
+
/* @__PURE__ */ jsx7(Layout.Sider, {
|
|
1133
1500
|
className: dmLayoutSiderClass,
|
|
1134
1501
|
collapsible: true,
|
|
1135
1502
|
collapsed: mergedCollapsed,
|
|
1136
1503
|
collapsedWidth: 60,
|
|
1137
1504
|
width: 230,
|
|
1138
1505
|
trigger: null,
|
|
1139
|
-
children: /* @__PURE__ */
|
|
1506
|
+
children: /* @__PURE__ */ jsx7(DmMenu, {
|
|
1140
1507
|
...menuProps,
|
|
1141
1508
|
hideProductHeader,
|
|
1142
1509
|
productTitle,
|
|
@@ -1151,23 +1518,23 @@ var DmLayout = forwardRef6(({
|
|
|
1151
1518
|
onClick: (info) => onMenuClick?.(info.key, info.menu)
|
|
1152
1519
|
})
|
|
1153
1520
|
}),
|
|
1154
|
-
/* @__PURE__ */
|
|
1521
|
+
/* @__PURE__ */ jsxs7(Layout, {
|
|
1155
1522
|
className: dmLayoutMainClass,
|
|
1156
1523
|
children: [
|
|
1157
|
-
mergedBreadcrumbItems.length ? /* @__PURE__ */
|
|
1524
|
+
mergedBreadcrumbItems.length ? /* @__PURE__ */ jsx7("div", {
|
|
1158
1525
|
className: dmLayoutBreadcrumbClass,
|
|
1159
|
-
children: /* @__PURE__ */
|
|
1526
|
+
children: /* @__PURE__ */ jsx7(DmBreadcrumb, {
|
|
1160
1527
|
items: mergedBreadcrumbItems
|
|
1161
1528
|
})
|
|
1162
1529
|
}) : null,
|
|
1163
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsxs7(Layout.Content, {
|
|
1164
1531
|
className: dmLayoutBodyClass,
|
|
1165
1532
|
children: [
|
|
1166
|
-
mergedTips ? /* @__PURE__ */
|
|
1533
|
+
mergedTips ? /* @__PURE__ */ jsx7("div", {
|
|
1167
1534
|
className: dmLayoutAuxiliaryClass,
|
|
1168
1535
|
children: mergedTips
|
|
1169
1536
|
}) : null,
|
|
1170
|
-
/* @__PURE__ */
|
|
1537
|
+
/* @__PURE__ */ jsx7("div", {
|
|
1171
1538
|
className: dmLayoutContentClass,
|
|
1172
1539
|
children
|
|
1173
1540
|
})
|