@sia.soul/sia-react-ui 0.1.22 → 0.1.24
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/Select-O_yY51vc.d.ts +307 -0
- package/dist/Select-W_xpkpOW.d.cts +307 -0
- package/dist/chart.cjs +1401 -1160
- package/dist/chart.css +21 -0
- package/dist/chart.js +4 -4
- package/dist/{chunk-3TRRBMXY.js → chunk-6R7JY7IY.js} +44 -21
- package/dist/{chunk-TZGUBGA4.js → chunk-6WBABNAX.js} +4 -3
- package/dist/{chunk-OKP4DIQH.js → chunk-GUXAWU63.js} +29 -26
- package/dist/{chunk-QJ4OQNQ4.js → chunk-LA7O3PN4.js} +4 -3
- package/dist/{chunk-7RNS52YG.js → chunk-LIYCU2GU.js} +349 -278
- package/dist/{chunk-KLI65JVD.js → chunk-LRPQ5FGE.js} +68 -186
- package/dist/chunk-NSSPGXNM.js +284 -0
- package/dist/{chunk-YT6E3X2K.js → chunk-OH6YILJW.js} +4 -3
- package/dist/{chunk-RWGSZW32.js → chunk-RGXVPS37.js} +7 -6
- package/dist/{chunk-VN6PIPP7.js → chunk-T2QIW4OO.js} +8 -7
- package/dist/{core-DeZknKwc.d.ts → core-BOzLwiXG.d.ts} +40 -158
- package/dist/{core-C5OnrCi4.d.cts → core-tbb9ZiBY.d.cts} +40 -158
- package/dist/core.cjs +1656 -1443
- package/dist/core.css +60 -0
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +8 -6
- package/dist/index.cjs +3801 -3580
- package/dist/index.css +60 -0
- package/dist/index.d.cts +33 -16
- package/dist/index.d.ts +33 -16
- package/dist/index.js +94 -85
- package/dist/markdown-editor.cjs +269 -28
- package/dist/markdown-editor.css +20 -0
- package/dist/markdown-editor.js +2 -2
- package/dist/rich-text-editor.cjs +1156 -1031
- package/dist/rich-text-editor.css +20 -0
- package/dist/rich-text-editor.js +4 -4
- package/dist/{select-date-range-CGRb3-W8.d.ts → select-date-range-BjqFUeU6.d.ts} +1 -1
- package/dist/{select-date-range-DDmYGDD4.d.cts → select-date-range-C9w8z3G8.d.cts} +1 -1
- package/dist/select-date-range.cjs +1209 -1061
- package/dist/select-date-range.css +20 -0
- package/dist/select-date-range.d.cts +2 -2
- package/dist/select-date-range.d.ts +2 -2
- package/dist/select-date-range.js +5 -5
- package/package.json +2 -2
- package/dist/Select-4hGJt3RJ.d.cts +0 -142
- package/dist/Select-BNSE67xn.d.ts +0 -142
- package/dist/chunk-3VJ4CZDQ.js +0 -43
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Button
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6WBABNAX.js";
|
|
4
4
|
import {
|
|
5
|
+
PopupPortal,
|
|
5
6
|
useControlSize,
|
|
6
7
|
useControllableState,
|
|
7
|
-
usePlaceholderMode
|
|
8
|
-
|
|
8
|
+
usePlaceholderMode,
|
|
9
|
+
withTitleTooltip
|
|
10
|
+
} from "./chunk-NSSPGXNM.js";
|
|
9
11
|
|
|
10
12
|
// src/components/Icon.tsx
|
|
11
13
|
import { forwardRef } from "react";
|
|
@@ -810,132 +812,16 @@ var Icon = forwardRef(function Icon2({ name, size = "1em", strokeWidth = 1.8, ro
|
|
|
810
812
|
"aria-label": label,
|
|
811
813
|
"aria-hidden": label ? void 0 : true,
|
|
812
814
|
style: mergedStyle,
|
|
813
|
-
...props,
|
|
815
|
+
...withTitleTooltip(props),
|
|
814
816
|
children: /* @__PURE__ */ jsx2("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", focusable: "false", children: resolvedVariant === "filled" ? filledPath : iconPaths[name] })
|
|
815
817
|
}
|
|
816
818
|
);
|
|
817
819
|
});
|
|
818
820
|
|
|
819
821
|
// src/components/Navigation.tsx
|
|
820
|
-
import { useEffect, useId, useMemo, useRef
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
import { forwardRef as forwardRef2, useLayoutEffect, useRef, useState } from "react";
|
|
824
|
-
import { createPortal } from "react-dom";
|
|
825
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
826
|
-
function setForwardedRef(ref, value) {
|
|
827
|
-
if (typeof ref === "function") ref(value);
|
|
828
|
-
else if (ref) ref.current = value;
|
|
829
|
-
}
|
|
830
|
-
function clamp(value, min, max) {
|
|
831
|
-
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
832
|
-
}
|
|
833
|
-
var PopupPortal = forwardRef2(function PopupPortal2({
|
|
834
|
-
anchorRef,
|
|
835
|
-
open = true,
|
|
836
|
-
placement = "bottom-start",
|
|
837
|
-
offset = 6,
|
|
838
|
-
viewportPadding = 8,
|
|
839
|
-
className = "",
|
|
840
|
-
style,
|
|
841
|
-
children,
|
|
842
|
-
...props
|
|
843
|
-
}, forwardedRef) {
|
|
844
|
-
const popupRef = useRef(null);
|
|
845
|
-
const [position, setPosition] = useState();
|
|
846
|
-
useLayoutEffect(() => {
|
|
847
|
-
if (!open || typeof document === "undefined") {
|
|
848
|
-
setPosition(void 0);
|
|
849
|
-
return;
|
|
850
|
-
}
|
|
851
|
-
const update = () => {
|
|
852
|
-
const anchor = anchorRef.current;
|
|
853
|
-
const popup = popupRef.current;
|
|
854
|
-
if (!anchor || !popup) return;
|
|
855
|
-
const anchorRect = anchor.getBoundingClientRect();
|
|
856
|
-
const popupRect = popup.getBoundingClientRect();
|
|
857
|
-
const viewportWidth = document.documentElement.clientWidth;
|
|
858
|
-
const viewportHeight = document.documentElement.clientHeight;
|
|
859
|
-
let resolvedPlacement = placement;
|
|
860
|
-
const availableBelow = Math.max(0, viewportHeight - viewportPadding - anchorRect.bottom - offset);
|
|
861
|
-
const availableAbove = Math.max(0, anchorRect.top - offset - viewportPadding);
|
|
862
|
-
const availableRight = Math.max(0, viewportWidth - viewportPadding - anchorRect.right - offset);
|
|
863
|
-
const availableLeft = Math.max(0, anchorRect.left - offset - viewportPadding);
|
|
864
|
-
const horizontalSide = placement.startsWith("right") || placement.startsWith("left");
|
|
865
|
-
if (horizontalSide) {
|
|
866
|
-
const prefersRight = placement.startsWith("right");
|
|
867
|
-
const fitsRight = popupRect.width <= availableRight;
|
|
868
|
-
const fitsLeft = popupRect.width <= availableLeft;
|
|
869
|
-
if (prefersRight && !fitsRight && (fitsLeft || availableLeft > availableRight)) {
|
|
870
|
-
resolvedPlacement = placement.replace("right", "left");
|
|
871
|
-
} else if (!prefersRight && !fitsLeft && (fitsRight || availableRight > availableLeft)) {
|
|
872
|
-
resolvedPlacement = placement.replace("left", "right");
|
|
873
|
-
}
|
|
874
|
-
} else {
|
|
875
|
-
const prefersBottom = placement.startsWith("bottom");
|
|
876
|
-
const fitsBelow = popupRect.height <= availableBelow;
|
|
877
|
-
const fitsAbove = popupRect.height <= availableAbove;
|
|
878
|
-
if (prefersBottom && !fitsBelow && (fitsAbove || availableAbove > availableBelow)) {
|
|
879
|
-
resolvedPlacement = placement.replace("bottom", "top");
|
|
880
|
-
} else if (!prefersBottom && !fitsAbove && (fitsBelow || availableBelow > availableAbove)) {
|
|
881
|
-
resolvedPlacement = placement.replace("top", "bottom");
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
const resolvedHorizontalSide = resolvedPlacement.startsWith("right") || resolvedPlacement.startsWith("left");
|
|
885
|
-
const top = resolvedHorizontalSide ? resolvedPlacement.endsWith("end") ? anchorRect.bottom - popupRect.height : anchorRect.top : resolvedPlacement.startsWith("bottom") ? anchorRect.bottom + offset : anchorRect.top - popupRect.height - offset;
|
|
886
|
-
const availableHeight = resolvedHorizontalSide ? Math.max(0, viewportHeight - viewportPadding * 2) : resolvedPlacement.startsWith("bottom") ? availableBelow : availableAbove;
|
|
887
|
-
const alignedLeft = resolvedHorizontalSide ? resolvedPlacement.startsWith("right") ? anchorRect.right + offset : anchorRect.left - popupRect.width - offset : resolvedPlacement.endsWith("end") ? anchorRect.right - popupRect.width : anchorRect.left;
|
|
888
|
-
const next = {
|
|
889
|
-
top: clamp(top, viewportPadding, viewportHeight - popupRect.height - viewportPadding),
|
|
890
|
-
left: clamp(alignedLeft, viewportPadding, viewportWidth - popupRect.width - viewportPadding),
|
|
891
|
-
anchorWidth: anchorRect.width,
|
|
892
|
-
availableHeight,
|
|
893
|
-
placement: resolvedPlacement
|
|
894
|
-
};
|
|
895
|
-
setPosition((current) => current && current.top === next.top && current.left === next.left && current.anchorWidth === next.anchorWidth && current.availableHeight === next.availableHeight && current.placement === next.placement ? current : next);
|
|
896
|
-
};
|
|
897
|
-
update();
|
|
898
|
-
window.addEventListener("resize", update);
|
|
899
|
-
window.addEventListener("scroll", update, true);
|
|
900
|
-
const observer = new ResizeObserver(update);
|
|
901
|
-
if (anchorRef.current) observer.observe(anchorRef.current);
|
|
902
|
-
if (popupRef.current) observer.observe(popupRef.current);
|
|
903
|
-
return () => {
|
|
904
|
-
window.removeEventListener("resize", update);
|
|
905
|
-
window.removeEventListener("scroll", update, true);
|
|
906
|
-
observer.disconnect();
|
|
907
|
-
};
|
|
908
|
-
}, [anchorRef, offset, open, placement, viewportPadding]);
|
|
909
|
-
if (!open || typeof document === "undefined") return null;
|
|
910
|
-
return createPortal(
|
|
911
|
-
/* @__PURE__ */ jsx3(
|
|
912
|
-
"div",
|
|
913
|
-
{
|
|
914
|
-
ref: (node) => {
|
|
915
|
-
popupRef.current = node;
|
|
916
|
-
setForwardedRef(forwardedRef, node);
|
|
917
|
-
},
|
|
918
|
-
className: `sia-popup-portal ${className}`.trim(),
|
|
919
|
-
"data-sia-popup-layer": "",
|
|
920
|
-
"data-placement": position?.placement ?? placement,
|
|
921
|
-
style: {
|
|
922
|
-
...style,
|
|
923
|
-
"--sia-popup-anchor-width": `${position?.anchorWidth ?? anchorRef.current?.getBoundingClientRect().width ?? 0}px`,
|
|
924
|
-
"--sia-popup-available-height": position ? `${position.availableHeight}px` : void 0,
|
|
925
|
-
top: position?.top ?? 0,
|
|
926
|
-
left: position?.left ?? 0,
|
|
927
|
-
visibility: position ? "visible" : "hidden"
|
|
928
|
-
},
|
|
929
|
-
...props,
|
|
930
|
-
children
|
|
931
|
-
}
|
|
932
|
-
),
|
|
933
|
-
document.body
|
|
934
|
-
);
|
|
935
|
-
});
|
|
936
|
-
|
|
937
|
-
// src/components/Navigation.tsx
|
|
938
|
-
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
822
|
+
import { useEffect, useId, useMemo, useRef, useState } from "react";
|
|
823
|
+
import { Fragment as Fragment3, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
824
|
+
import { createElement } from "react";
|
|
939
825
|
function MenuPopup({
|
|
940
826
|
anchorRef,
|
|
941
827
|
open,
|
|
@@ -946,7 +832,7 @@ function MenuPopup({
|
|
|
946
832
|
onMouseEnter,
|
|
947
833
|
onMouseLeave
|
|
948
834
|
}) {
|
|
949
|
-
const [mounted, setMounted] =
|
|
835
|
+
const [mounted, setMounted] = useState(open);
|
|
950
836
|
useEffect(() => {
|
|
951
837
|
if (open) {
|
|
952
838
|
setMounted(true);
|
|
@@ -955,7 +841,7 @@ function MenuPopup({
|
|
|
955
841
|
const timer = window.setTimeout(() => setMounted(false), 160);
|
|
956
842
|
return () => window.clearTimeout(timer);
|
|
957
843
|
}, [open]);
|
|
958
|
-
return /* @__PURE__ */
|
|
844
|
+
return /* @__PURE__ */ jsx3(
|
|
959
845
|
PopupPortal,
|
|
960
846
|
{
|
|
961
847
|
anchorRef,
|
|
@@ -966,7 +852,7 @@ function MenuPopup({
|
|
|
966
852
|
"data-sia-menu-owner": menuId,
|
|
967
853
|
onMouseEnter,
|
|
968
854
|
onMouseLeave,
|
|
969
|
-
children: /* @__PURE__ */
|
|
855
|
+
children: /* @__PURE__ */ jsx3("ul", { className: "sia-menu__popup-list", role: "menu", children })
|
|
970
856
|
}
|
|
971
857
|
);
|
|
972
858
|
}
|
|
@@ -977,8 +863,8 @@ function MenuEntry({
|
|
|
977
863
|
props,
|
|
978
864
|
reserveIcon
|
|
979
865
|
}) {
|
|
980
|
-
const anchorRef =
|
|
981
|
-
const closeTimerRef =
|
|
866
|
+
const anchorRef = useRef(null);
|
|
867
|
+
const closeTimerRef = useRef(void 0);
|
|
982
868
|
const hasChildren = Boolean(item.children?.length);
|
|
983
869
|
const isOpen = props.open.includes(item.key);
|
|
984
870
|
const isSelected = props.selected.includes(item.key);
|
|
@@ -999,7 +885,7 @@ function MenuEntry({
|
|
|
999
885
|
closeTimerRef.current = window.setTimeout(() => props.toggle(item.key, false), 100);
|
|
1000
886
|
}
|
|
1001
887
|
const hover = props.triggerSubMenuAction === "hover" && hasChildren && !inlineSubmenu;
|
|
1002
|
-
const submenu = hasChildren ? /* @__PURE__ */
|
|
888
|
+
const submenu = hasChildren ? /* @__PURE__ */ jsx3(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [item.key, ...parents], props }) : null;
|
|
1003
889
|
const popupPlacement = props.mode === "horizontal" && level === 0 ? "bottom-start" : "right-start";
|
|
1004
890
|
return /* @__PURE__ */ jsxs3(
|
|
1005
891
|
"li",
|
|
@@ -1018,20 +904,20 @@ function MenuEntry({
|
|
|
1018
904
|
type: "button",
|
|
1019
905
|
className: "sia-menu__item",
|
|
1020
906
|
style: { paddingInlineStart: props.mode === "inline" && !props.inlineCollapsed ? 12 + level * props.inlineIndent : void 0 },
|
|
1021
|
-
title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title,
|
|
907
|
+
...withTitleTooltip({ title: collapsed ? item.title ?? (typeof item.label === "string" ? item.label : void 0) : item.title }),
|
|
1022
908
|
disabled: item.disabled,
|
|
1023
909
|
"aria-current": isSelected ? "page" : void 0,
|
|
1024
910
|
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
1025
911
|
onClick: (event) => hasChildren ? props.toggle(item.key) : props.select(item, path, event),
|
|
1026
912
|
children: [
|
|
1027
|
-
reserveIcon ? /* @__PURE__ */
|
|
1028
|
-
!collapsed ? /* @__PURE__ */
|
|
1029
|
-
!collapsed && item.extra ? /* @__PURE__ */
|
|
1030
|
-
!collapsed && hasChildren ? /* @__PURE__ */
|
|
913
|
+
reserveIcon ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__icon", "aria-hidden": !item.icon || void 0, children: item.icon }) : null,
|
|
914
|
+
!collapsed ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__label", children: item.label }) : null,
|
|
915
|
+
!collapsed && item.extra ? /* @__PURE__ */ jsx3("span", { className: "sia-menu__extra", children: item.extra }) : null,
|
|
916
|
+
!collapsed && hasChildren ? /* @__PURE__ */ jsx3(Icon, { className: "sia-menu__expand-icon", name: "chevron-down", size: 13 }) : null
|
|
1031
917
|
]
|
|
1032
918
|
}
|
|
1033
919
|
),
|
|
1034
|
-
hasChildren ? inlineSubmenu ? /* @__PURE__ */
|
|
920
|
+
hasChildren ? inlineSubmenu ? /* @__PURE__ */ jsx3("ul", { className: "sia-menu__submenu", role: "menu", "aria-hidden": !isOpen, children: submenu }) : /* @__PURE__ */ jsx3(
|
|
1035
921
|
MenuPopup,
|
|
1036
922
|
{
|
|
1037
923
|
anchorRef,
|
|
@@ -1058,13 +944,13 @@ function MenuLevel({
|
|
|
1058
944
|
props,
|
|
1059
945
|
reserveIcon = hasMenuIcon(items)
|
|
1060
946
|
}) {
|
|
1061
|
-
return /* @__PURE__ */
|
|
1062
|
-
if (item.type === "divider") return /* @__PURE__ */
|
|
947
|
+
return /* @__PURE__ */ jsx3(Fragment3, { children: items.map((item, index) => {
|
|
948
|
+
if (item.type === "divider") return /* @__PURE__ */ jsx3("li", { className: "sia-menu__divider", role: "separator" }, item.key || `divider-${index}`);
|
|
1063
949
|
if (item.type === "group") return /* @__PURE__ */ jsxs3("li", { className: "sia-menu__group", children: [
|
|
1064
|
-
/* @__PURE__ */
|
|
1065
|
-
/* @__PURE__ */
|
|
950
|
+
/* @__PURE__ */ jsx3("div", { className: "sia-menu__group-title", children: item.label }),
|
|
951
|
+
/* @__PURE__ */ jsx3("ul", { role: "group", children: /* @__PURE__ */ jsx3(MenuLevel, { items: item.children ?? [], level: level + 1, parents: [...parents, item.key], props, reserveIcon }) })
|
|
1066
952
|
] }, item.key);
|
|
1067
|
-
return /* @__PURE__ */
|
|
953
|
+
return /* @__PURE__ */ jsx3(MenuEntry, { item, level, parents, props, reserveIcon }, item.key);
|
|
1068
954
|
}) });
|
|
1069
955
|
}
|
|
1070
956
|
function Menu({
|
|
@@ -1088,7 +974,7 @@ function Menu({
|
|
|
1088
974
|
...rest
|
|
1089
975
|
}) {
|
|
1090
976
|
const menuId = useId();
|
|
1091
|
-
const rootRef =
|
|
977
|
+
const rootRef = useRef(null);
|
|
1092
978
|
const [selected, setSelected] = useControllableState({ value: selectedKeys, defaultValue: defaultSelectedKeys });
|
|
1093
979
|
const [open, setOpen] = useControllableState({ value: openKeys, defaultValue: defaultOpenKeys, onChange: (next) => onOpenChange?.([...next]) });
|
|
1094
980
|
useEffect(() => {
|
|
@@ -1117,25 +1003,25 @@ function Menu({
|
|
|
1117
1003
|
else onSelect?.({ ...info, selectedKeys: [...next] });
|
|
1118
1004
|
if (mode !== "inline") setOpen([]);
|
|
1119
1005
|
}
|
|
1120
|
-
return /* @__PURE__ */
|
|
1006
|
+
return /* @__PURE__ */ jsx3("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...withTitleTooltip(rest), "data-sia-menu-owner": menuId, children: /* @__PURE__ */ jsx3(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
1121
1007
|
}
|
|
1122
1008
|
function Steps({ items, current = 0, initial = 0, direction = "horizontal", type = "default", size = "default", status = "process", progressDot = false, onChange, className = "", ...props }) {
|
|
1123
|
-
return /* @__PURE__ */
|
|
1009
|
+
return /* @__PURE__ */ jsx3("div", { className: `sia-steps sia-steps--${direction} sia-steps--${type} sia-steps--${size} ${className}`.trim(), ...withTitleTooltip(props), children: items.map((item, rawIndex) => {
|
|
1124
1010
|
const index = rawIndex + initial;
|
|
1125
1011
|
const itemStatus = item.status ?? (index < current ? "finish" : index === current ? status : "wait");
|
|
1126
|
-
const dot = /* @__PURE__ */
|
|
1127
|
-
const icon = progressDot ? typeof progressDot === "function" ? progressDot(dot, { index, status: itemStatus, title: item.title, description: item.description }) : dot : item.icon ?? (itemStatus === "finish" ? /* @__PURE__ */
|
|
1012
|
+
const dot = /* @__PURE__ */ jsx3("span", { className: "sia-steps__dot" });
|
|
1013
|
+
const icon = progressDot ? typeof progressDot === "function" ? progressDot(dot, { index, status: itemStatus, title: item.title, description: item.description }) : dot : item.icon ?? (itemStatus === "finish" ? /* @__PURE__ */ jsx3(Icon, { name: "check", size: 15 }) : itemStatus === "error" ? /* @__PURE__ */ jsx3(Icon, { name: "close", size: 14 }) : index + 1);
|
|
1128
1014
|
return /* @__PURE__ */ jsxs3("button", { type: "button", className: `sia-steps__item sia-steps__item--${itemStatus}`, disabled: item.disabled || !onChange, onClick: () => onChange?.(index), children: [
|
|
1129
1015
|
/* @__PURE__ */ jsxs3("span", { className: "sia-steps__head", children: [
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
/* @__PURE__ */
|
|
1016
|
+
/* @__PURE__ */ jsx3("span", { className: "sia-steps__icon", children: icon }),
|
|
1017
|
+
/* @__PURE__ */ jsx3("span", { className: "sia-steps__tail" })
|
|
1132
1018
|
] }),
|
|
1133
1019
|
/* @__PURE__ */ jsxs3("span", { className: "sia-steps__content", children: [
|
|
1134
1020
|
/* @__PURE__ */ jsxs3("span", { className: "sia-steps__title", children: [
|
|
1135
1021
|
item.title,
|
|
1136
|
-
item.subTitle ? /* @__PURE__ */
|
|
1022
|
+
item.subTitle ? /* @__PURE__ */ jsx3("small", { children: item.subTitle }) : null
|
|
1137
1023
|
] }),
|
|
1138
|
-
item.description ? /* @__PURE__ */
|
|
1024
|
+
item.description ? /* @__PURE__ */ jsx3("span", { className: "sia-steps__description", children: item.description }) : null
|
|
1139
1025
|
] })
|
|
1140
1026
|
] }, index);
|
|
1141
1027
|
}) });
|
|
@@ -1153,15 +1039,12 @@ function Segmented({ options, value, defaultValue, size: sizeProp, block = false
|
|
|
1153
1039
|
const next = event.key === "ArrowRight" || event.key === "ArrowDown" ? enabled[(index + 1) % enabled.length] : enabled[(index - 1 + enabled.length) % enabled.length];
|
|
1154
1040
|
if (next) setCurrent(next.value);
|
|
1155
1041
|
}
|
|
1156
|
-
return /* @__PURE__ */
|
|
1157
|
-
option.icon,
|
|
1158
|
-
/* @__PURE__ */ jsx4("span", { children: option.label ?? option.value })
|
|
1159
|
-
] }, option.value)) });
|
|
1042
|
+
return /* @__PURE__ */ jsx3("div", { className: `sia-segmented sia-segmented--${size}${block ? " sia-segmented--block" : ""}${vertical ? " sia-segmented--vertical" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", onKeyDown: keyboard, ...withTitleTooltip(props), children: normalized.map((option) => /* @__PURE__ */ createElement("button", { type: "button", role: "radio", "aria-checked": option.value === current, ...withTitleTooltip({ title: option.title }), className: option.value === current ? "is-selected" : "", disabled: disabled || option.disabled, key: option.value, onClick: () => setCurrent(option.value) }, option.icon, /* @__PURE__ */ jsx3("span", { children: option.label ?? option.value }))) });
|
|
1160
1043
|
}
|
|
1161
1044
|
|
|
1162
1045
|
// src/components/Dropdown.tsx
|
|
1163
|
-
import { cloneElement, isValidElement, useEffect as useEffect2, useRef as
|
|
1164
|
-
import { jsx as
|
|
1046
|
+
import { cloneElement, isValidElement, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
1047
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1165
1048
|
var placementMap = {
|
|
1166
1049
|
bottomLeft: "bottom-start",
|
|
1167
1050
|
bottomRight: "bottom-end",
|
|
@@ -1193,14 +1076,14 @@ function DropdownRoot({
|
|
|
1193
1076
|
onKeyDown,
|
|
1194
1077
|
...props
|
|
1195
1078
|
}) {
|
|
1196
|
-
const rootRef =
|
|
1197
|
-
const contextAnchorRef =
|
|
1198
|
-
const popupRef =
|
|
1199
|
-
const openTimerRef =
|
|
1200
|
-
const closeTimerRef =
|
|
1201
|
-
const [internalOpen, setInternalOpen] =
|
|
1202
|
-
const [mounted, setMounted] =
|
|
1203
|
-
const [contextPoint, setContextPoint] =
|
|
1079
|
+
const rootRef = useRef2(null);
|
|
1080
|
+
const contextAnchorRef = useRef2(null);
|
|
1081
|
+
const popupRef = useRef2(null);
|
|
1082
|
+
const openTimerRef = useRef2(void 0);
|
|
1083
|
+
const closeTimerRef = useRef2(void 0);
|
|
1084
|
+
const [internalOpen, setInternalOpen] = useState2(defaultOpen);
|
|
1085
|
+
const [mounted, setMounted] = useState2(open ?? defaultOpen);
|
|
1086
|
+
const [contextPoint, setContextPoint] = useState2();
|
|
1204
1087
|
const visible = open ?? internalOpen;
|
|
1205
1088
|
const triggerSet = new Set(trigger);
|
|
1206
1089
|
const pointAtCenter = typeof arrow === "object" && arrow.pointAtCenter;
|
|
@@ -1320,7 +1203,7 @@ function DropdownRoot({
|
|
|
1320
1203
|
updateOpen(true, "trigger");
|
|
1321
1204
|
}
|
|
1322
1205
|
}
|
|
1323
|
-
const menuNode = /* @__PURE__ */
|
|
1206
|
+
const menuNode = /* @__PURE__ */ jsx4(
|
|
1324
1207
|
Menu,
|
|
1325
1208
|
{
|
|
1326
1209
|
mode: "vertical",
|
|
@@ -1339,7 +1222,7 @@ function DropdownRoot({
|
|
|
1339
1222
|
);
|
|
1340
1223
|
const triggerNode = showTriggerIcon && isValidElement(children) && children.type === Button && children.props.children !== void 0 && children.props.children !== null ? cloneElement(children, {}, /* @__PURE__ */ jsxs4("span", { className: "sia-dropdown__trigger-content", children: [
|
|
1341
1224
|
children.props.children,
|
|
1342
|
-
/* @__PURE__ */
|
|
1225
|
+
/* @__PURE__ */ jsx4(Icon, { name: "chevron-down", size: 14, className: "sia-dropdown__trigger-icon" })
|
|
1343
1226
|
] })) : children;
|
|
1344
1227
|
return /* @__PURE__ */ jsxs4(
|
|
1345
1228
|
"span",
|
|
@@ -1354,10 +1237,10 @@ function DropdownRoot({
|
|
|
1354
1237
|
onMouseLeave: handleMouseLeave,
|
|
1355
1238
|
onContextMenu: handleContextMenu,
|
|
1356
1239
|
onKeyDown: handleKeyDown,
|
|
1357
|
-
...props,
|
|
1240
|
+
...withTitleTooltip(props),
|
|
1358
1241
|
children: [
|
|
1359
1242
|
triggerNode,
|
|
1360
|
-
/* @__PURE__ */
|
|
1243
|
+
/* @__PURE__ */ jsx4(
|
|
1361
1244
|
"span",
|
|
1362
1245
|
{
|
|
1363
1246
|
ref: contextAnchorRef,
|
|
@@ -1366,7 +1249,7 @@ function DropdownRoot({
|
|
|
1366
1249
|
"aria-hidden": "true"
|
|
1367
1250
|
}
|
|
1368
1251
|
),
|
|
1369
|
-
/* @__PURE__ */
|
|
1252
|
+
/* @__PURE__ */ jsx4(
|
|
1370
1253
|
PopupPortal,
|
|
1371
1254
|
{
|
|
1372
1255
|
ref: popupRef,
|
|
@@ -1402,14 +1285,14 @@ function DropdownButton({
|
|
|
1402
1285
|
...dropdownProps
|
|
1403
1286
|
}) {
|
|
1404
1287
|
return /* @__PURE__ */ jsxs4("span", { className: `sia-dropdown-button ${className}`.trim(), children: [
|
|
1405
|
-
/* @__PURE__ */
|
|
1406
|
-
/* @__PURE__ */
|
|
1288
|
+
/* @__PURE__ */ jsx4(Button, { ...buttonProps, disabled, onClick, children }),
|
|
1289
|
+
/* @__PURE__ */ jsx4(DropdownRoot, { ...dropdownProps, disabled, trigger, showTriggerIcon: false, children: /* @__PURE__ */ jsx4(
|
|
1407
1290
|
Button,
|
|
1408
1291
|
{
|
|
1409
1292
|
...buttonProps,
|
|
1410
1293
|
className: `sia-dropdown-button__arrow ${buttonProps?.className ?? ""}`.trim(),
|
|
1411
1294
|
disabled,
|
|
1412
|
-
icon: /* @__PURE__ */
|
|
1295
|
+
icon: /* @__PURE__ */ jsx4(Icon, { name: "chevron-down", size: 14 }),
|
|
1413
1296
|
"aria-label": "\u5C55\u5F00\u4E0B\u62C9\u83DC\u5355"
|
|
1414
1297
|
}
|
|
1415
1298
|
) })
|
|
@@ -1421,9 +1304,9 @@ var Dropdown = Object.assign(DropdownRoot, {
|
|
|
1421
1304
|
});
|
|
1422
1305
|
|
|
1423
1306
|
// src/components/Input.tsx
|
|
1424
|
-
import { forwardRef as
|
|
1425
|
-
import { jsx as
|
|
1426
|
-
var Input =
|
|
1307
|
+
import { forwardRef as forwardRef2, useId as useId2, useRef as useRef3, useState as useState3 } from "react";
|
|
1308
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1309
|
+
var Input = forwardRef2(function Input2({
|
|
1427
1310
|
label,
|
|
1428
1311
|
hint,
|
|
1429
1312
|
status = "default",
|
|
@@ -1447,8 +1330,8 @@ var Input = forwardRef3(function Input2({
|
|
|
1447
1330
|
const size = useControlSize(sizeProp);
|
|
1448
1331
|
const fallbackId = useId2();
|
|
1449
1332
|
const inputId = id ?? fallbackId;
|
|
1450
|
-
const localRef =
|
|
1451
|
-
const [uncontrolledValue, setUncontrolledValue] =
|
|
1333
|
+
const localRef = useRef3(null);
|
|
1334
|
+
const [uncontrolledValue, setUncontrolledValue] = useState3(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
1452
1335
|
const currentText = value !== void 0 ? String(value) : uncontrolledValue;
|
|
1453
1336
|
const hasValue = currentText.length > 0;
|
|
1454
1337
|
const floatingPlaceholder = usePlaceholderMode(placeholderMode) === "floating" && Boolean(placeholder);
|
|
@@ -1486,10 +1369,10 @@ var Input = forwardRef3(function Input2({
|
|
|
1486
1369
|
event.preventDefault();
|
|
1487
1370
|
localRef.current?.focus({ preventScroll: true });
|
|
1488
1371
|
}
|
|
1489
|
-
const input = /* @__PURE__ */
|
|
1372
|
+
const input = /* @__PURE__ */ jsx5(
|
|
1490
1373
|
"input",
|
|
1491
1374
|
{
|
|
1492
|
-
...props,
|
|
1375
|
+
...withTitleTooltip(props),
|
|
1493
1376
|
ref: setRef,
|
|
1494
1377
|
id: inputId,
|
|
1495
1378
|
className: "sia-input",
|
|
@@ -1504,23 +1387,23 @@ var Input = forwardRef3(function Input2({
|
|
|
1504
1387
|
}
|
|
1505
1388
|
);
|
|
1506
1389
|
const control = /* @__PURE__ */ jsxs5("span", { onMouseDown: handleControlMouseDown, className: `sia-input-control sia-input-control--${size} sia-input-control--${status}${floatingPlaceholder ? " sia-input-control--floating" : ""}${floatingPlaceholder && hasValue ? " is-filled" : ""}${disabled ? " is-disabled" : ""}`, children: [
|
|
1507
|
-
prefix ? /* @__PURE__ */
|
|
1390
|
+
prefix ? /* @__PURE__ */ jsx5("span", { className: "sia-input-control__affix", children: prefix }) : null,
|
|
1508
1391
|
floatingPlaceholder ? /* @__PURE__ */ jsxs5("span", { className: "sia-input-control__input-wrap", children: [
|
|
1509
1392
|
input,
|
|
1510
|
-
/* @__PURE__ */
|
|
1393
|
+
/* @__PURE__ */ jsx5("span", { className: "sia-input-control__floating-placeholder", "aria-hidden": "true", children: placeholder })
|
|
1511
1394
|
] }) : input,
|
|
1512
|
-
allowClear && hasValue && !disabled ? /* @__PURE__ */
|
|
1513
|
-
suffix ? /* @__PURE__ */
|
|
1395
|
+
allowClear && hasValue && !disabled ? /* @__PURE__ */ jsx5("button", { className: "sia-input-control__clear", type: "button", "aria-label": "\u6E05\u7A7A\u8F93\u5165", onClick: clearValue, children: /* @__PURE__ */ jsx5(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
1396
|
+
suffix ? /* @__PURE__ */ jsx5("span", { className: "sia-input-control__affix", children: suffix }) : null,
|
|
1514
1397
|
showCount ? /* @__PURE__ */ jsxs5("span", { className: `sia-input-control__count${maxLength !== void 0 && currentText.length >= maxLength ? " is-limit" : ""}`, "aria-live": "polite", children: [
|
|
1515
1398
|
currentText.length,
|
|
1516
1399
|
maxLength !== void 0 ? `/${maxLength}` : null
|
|
1517
1400
|
] }) : null
|
|
1518
1401
|
] });
|
|
1519
|
-
if (!label && !hint) return /* @__PURE__ */
|
|
1402
|
+
if (!label && !hint) return /* @__PURE__ */ jsx5("span", { className: `sia-field ${className}`.trim(), children: control });
|
|
1520
1403
|
return /* @__PURE__ */ jsxs5("span", { className: `sia-field ${className}`.trim(), children: [
|
|
1521
|
-
label ? /* @__PURE__ */
|
|
1404
|
+
label ? /* @__PURE__ */ jsx5("label", { className: "sia-field__label", htmlFor: inputId, children: label }) : null,
|
|
1522
1405
|
control,
|
|
1523
|
-
hint ? /* @__PURE__ */
|
|
1406
|
+
hint ? /* @__PURE__ */ jsx5("span", { id: hintId, className: `sia-field__hint sia-field__hint--${status}`, children: hint }) : null
|
|
1524
1407
|
] });
|
|
1525
1408
|
});
|
|
1526
1409
|
|
|
@@ -1528,7 +1411,6 @@ export {
|
|
|
1528
1411
|
ICON_NAMES,
|
|
1529
1412
|
FILLED_ICON_NAMES,
|
|
1530
1413
|
Icon,
|
|
1531
|
-
PopupPortal,
|
|
1532
1414
|
Menu,
|
|
1533
1415
|
Steps,
|
|
1534
1416
|
Segmented,
|