@sia.soul/sia-react-ui 0.1.13 → 0.1.15
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/chart.cjs +21 -13
- package/dist/chart.js +4 -4
- package/dist/{chunk-RLTG3IK7.js → chunk-25BU7YTB.js} +21 -11
- package/dist/{chunk-EJDPRAU2.js → chunk-3VJ4CZDQ.js} +7 -0
- package/dist/{chunk-JJVD2ITI.js → chunk-ALWHRV4L.js} +7 -4
- package/dist/{chunk-MOOMDRAN.js → chunk-E7F47Z2C.js} +11 -8
- package/dist/{chunk-F3VH6LJH.js → chunk-MUTJVDM6.js} +3 -3
- package/dist/{chunk-Z3T6RDQP.js → chunk-OKP4DIQH.js} +2 -2
- package/dist/{chunk-5ZTWY3PG.js → chunk-QJ4OQNQ4.js} +3 -3
- package/dist/{chunk-BUMS62NO.js → chunk-R3TYVU53.js} +14 -8
- package/dist/{chunk-MBS2HXLZ.js → chunk-TZGUBGA4.js} +6 -1
- package/dist/{chunk-WHARTF2I.js → chunk-YT6E3X2K.js} +5 -2
- package/dist/{core-y0w5PBO2.d.cts → core-AeKYVPDZ.d.cts} +7 -4
- package/dist/{core-VmiEI1Jp.d.ts → core-DcSXqSRs.d.ts} +7 -4
- package/dist/core.cjs +56 -41
- package/dist/core.css +467 -40
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +6 -6
- package/dist/index.cjs +512 -112
- package/dist/index.css +467 -40
- package/dist/index.d.cts +77 -15
- package/dist/index.d.ts +77 -15
- package/dist/index.js +452 -76
- package/dist/markdown-editor.cjs +3 -2
- package/dist/markdown-editor.js +2 -2
- package/dist/rich-text-editor.cjs +9 -2
- package/dist/rich-text-editor.js +4 -4
- package/dist/{select-date-range-D-JMfpwD.d.ts → select-date-range-Bdb-hi9c.d.ts} +3 -3
- package/dist/{select-date-range-l-xgB959.d.cts → select-date-range-shDQ5uJA.d.cts} +3 -3
- package/dist/select-date-range.cjs +35 -15
- package/dist/select-date-range.d.cts +1 -1
- package/dist/select-date-range.d.ts +1 -1
- package/dist/select-date-range.js +5 -5
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -39,12 +39,36 @@ __export(core_exports, {
|
|
|
39
39
|
});
|
|
40
40
|
module.exports = __toCommonJS(core_exports);
|
|
41
41
|
|
|
42
|
-
// src/components/
|
|
42
|
+
// src/components/shared.ts
|
|
43
43
|
var import_react = require("react");
|
|
44
|
+
var ControlSizeContext = (0, import_react.createContext)("medium");
|
|
45
|
+
function useControlSize(size) {
|
|
46
|
+
const inherited = (0, import_react.useContext)(ControlSizeContext);
|
|
47
|
+
return size ?? inherited;
|
|
48
|
+
}
|
|
49
|
+
var PlaceholderModeContext = (0, import_react.createContext)("default");
|
|
50
|
+
function usePlaceholderMode(mode) {
|
|
51
|
+
const inherited = (0, import_react.useContext)(PlaceholderModeContext);
|
|
52
|
+
return mode ?? inherited;
|
|
53
|
+
}
|
|
54
|
+
function useControllableState({ value, defaultValue, onChange }) {
|
|
55
|
+
const [internalValue, setInternalValue] = (0, import_react.useState)(defaultValue);
|
|
56
|
+
const controlled = value !== void 0;
|
|
57
|
+
const currentValue = controlled ? value : internalValue;
|
|
58
|
+
const setValue = (0, import_react.useCallback)((nextValue) => {
|
|
59
|
+
if (Object.is(currentValue, nextValue)) return;
|
|
60
|
+
if (!controlled) setInternalValue(nextValue);
|
|
61
|
+
onChange?.(nextValue);
|
|
62
|
+
}, [controlled, currentValue, onChange]);
|
|
63
|
+
return [currentValue, setValue];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// src/components/Button.tsx
|
|
67
|
+
var import_react2 = require("react");
|
|
44
68
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
45
|
-
var Button = (0,
|
|
69
|
+
var Button = (0, import_react2.forwardRef)(function Button2({
|
|
46
70
|
variant = "default",
|
|
47
|
-
size
|
|
71
|
+
size: sizeProp,
|
|
48
72
|
loading = false,
|
|
49
73
|
block = false,
|
|
50
74
|
danger = false,
|
|
@@ -57,7 +81,8 @@ var Button = (0, import_react.forwardRef)(function Button2({
|
|
|
57
81
|
style,
|
|
58
82
|
...props
|
|
59
83
|
}, forwardedRef) {
|
|
60
|
-
const
|
|
84
|
+
const size = useControlSize(sizeProp);
|
|
85
|
+
const localRef = (0, import_react2.useRef)(null);
|
|
61
86
|
function setRef(node) {
|
|
62
87
|
localRef.current = node;
|
|
63
88
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
@@ -96,10 +121,10 @@ var Button = (0, import_react.forwardRef)(function Button2({
|
|
|
96
121
|
});
|
|
97
122
|
|
|
98
123
|
// src/components/Card.tsx
|
|
99
|
-
var
|
|
124
|
+
var import_react4 = require("react");
|
|
100
125
|
|
|
101
126
|
// src/components/Icon.tsx
|
|
102
|
-
var
|
|
127
|
+
var import_react3 = require("react");
|
|
103
128
|
|
|
104
129
|
// src/components/IconCatalog.tsx
|
|
105
130
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
@@ -885,7 +910,7 @@ var filledIconPaths = {
|
|
|
885
910
|
] })
|
|
886
911
|
};
|
|
887
912
|
var FILLED_ICON_NAMES = Object.freeze(Object.keys(filledIconPaths));
|
|
888
|
-
var Icon = (0,
|
|
913
|
+
var Icon = (0, import_react3.forwardRef)(function Icon2({ name, size = "1em", strokeWidth = 1.8, rotate = 0, spin = false, pulse = false, label, variant = "outline", className = "", style, ...props }, ref) {
|
|
889
914
|
const resolvedSize = typeof size === "number" ? `${size}px` : size;
|
|
890
915
|
const mergedStyle = { "--sia-icon-size": resolvedSize, "--sia-icon-rotate": `${rotate}deg`, ...style };
|
|
891
916
|
const animationClass = spin ? " sia-icon--spin" : pulse ? " sia-icon--pulse" : "";
|
|
@@ -927,7 +952,7 @@ function Card({
|
|
|
927
952
|
children,
|
|
928
953
|
...props
|
|
929
954
|
}) {
|
|
930
|
-
const [internalCollapsed, setInternalCollapsed] = (0,
|
|
955
|
+
const [internalCollapsed, setInternalCollapsed] = (0, import_react4.useState)(defaultCollapsed);
|
|
931
956
|
const isCollapsed = collapsed ?? internalCollapsed;
|
|
932
957
|
const hasHeader = title || extra || collapsible;
|
|
933
958
|
const mergedStyle = accentColor ? { "--sia-card-accent": accentColor, ...style } : style;
|
|
@@ -964,6 +989,7 @@ function Tag({
|
|
|
964
989
|
variant = "soft",
|
|
965
990
|
icon,
|
|
966
991
|
closable = false,
|
|
992
|
+
closeOnHover = false,
|
|
967
993
|
disabled = false,
|
|
968
994
|
onClose,
|
|
969
995
|
className = "",
|
|
@@ -973,7 +999,7 @@ function Tag({
|
|
|
973
999
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
974
1000
|
"span",
|
|
975
1001
|
{
|
|
976
|
-
className: `sia-tag sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
|
|
1002
|
+
className: `sia-tag${closable && closeOnHover ? " sia-tag--close-on-hover" : ""} sia-tag--${status} sia-tag--${variant}${compact ? " sia-tag--compact" : ""}${disabled ? " sia-tag--disabled" : ""} ${className}`.trim(),
|
|
977
1003
|
"aria-disabled": disabled || void 0,
|
|
978
1004
|
...props,
|
|
979
1005
|
children: [
|
|
@@ -1008,7 +1034,7 @@ var import_react7 = require("react");
|
|
|
1008
1034
|
var import_react6 = require("react");
|
|
1009
1035
|
|
|
1010
1036
|
// src/components/PopupPortal.tsx
|
|
1011
|
-
var
|
|
1037
|
+
var import_react5 = require("react");
|
|
1012
1038
|
var import_react_dom = require("react-dom");
|
|
1013
1039
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1014
1040
|
function setForwardedRef(ref, value) {
|
|
@@ -1018,7 +1044,7 @@ function setForwardedRef(ref, value) {
|
|
|
1018
1044
|
function clamp(value, min, max) {
|
|
1019
1045
|
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
1020
1046
|
}
|
|
1021
|
-
var PopupPortal = (0,
|
|
1047
|
+
var PopupPortal = (0, import_react5.forwardRef)(function PopupPortal2({
|
|
1022
1048
|
anchorRef,
|
|
1023
1049
|
open = true,
|
|
1024
1050
|
placement = "bottom-start",
|
|
@@ -1029,9 +1055,9 @@ var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
|
1029
1055
|
children,
|
|
1030
1056
|
...props
|
|
1031
1057
|
}, forwardedRef) {
|
|
1032
|
-
const popupRef = (0,
|
|
1033
|
-
const [position, setPosition] = (0,
|
|
1034
|
-
(0,
|
|
1058
|
+
const popupRef = (0, import_react5.useRef)(null);
|
|
1059
|
+
const [position, setPosition] = (0, import_react5.useState)();
|
|
1060
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
1035
1061
|
if (!open || typeof document === "undefined") {
|
|
1036
1062
|
setPosition(void 0);
|
|
1037
1063
|
return;
|
|
@@ -1122,25 +1148,6 @@ var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
|
1122
1148
|
);
|
|
1123
1149
|
});
|
|
1124
1150
|
|
|
1125
|
-
// src/components/shared.ts
|
|
1126
|
-
var import_react5 = require("react");
|
|
1127
|
-
var PlaceholderModeContext = (0, import_react5.createContext)("default");
|
|
1128
|
-
function usePlaceholderMode(mode) {
|
|
1129
|
-
const inherited = (0, import_react5.useContext)(PlaceholderModeContext);
|
|
1130
|
-
return mode ?? inherited;
|
|
1131
|
-
}
|
|
1132
|
-
function useControllableState({ value, defaultValue, onChange }) {
|
|
1133
|
-
const [internalValue, setInternalValue] = (0, import_react5.useState)(defaultValue);
|
|
1134
|
-
const controlled = value !== void 0;
|
|
1135
|
-
const currentValue = controlled ? value : internalValue;
|
|
1136
|
-
const setValue = (0, import_react5.useCallback)((nextValue) => {
|
|
1137
|
-
if (Object.is(currentValue, nextValue)) return;
|
|
1138
|
-
if (!controlled) setInternalValue(nextValue);
|
|
1139
|
-
onChange?.(nextValue);
|
|
1140
|
-
}, [controlled, currentValue, onChange]);
|
|
1141
|
-
return [currentValue, setValue];
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
1151
|
// src/components/Navigation.tsx
|
|
1145
1152
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1146
1153
|
function MenuPopup({
|
|
@@ -1321,7 +1328,8 @@ function Menu({
|
|
|
1321
1328
|
}
|
|
1322
1329
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { ref: rootRef, className: `sia-menu sia-menu--${mode} sia-menu--${theme}${inlineCollapsed ? " sia-menu--collapsed" : ""} ${className}`.trim(), role: "menu", ...rest, "data-sia-menu-owner": menuId, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MenuLevel, { items, level: 0, parents: [], props: { menuId, mode, theme, multiple, selectable, inlineCollapsed, inlineIndent, triggerSubMenuAction, selected, open, select, toggle } }) });
|
|
1323
1330
|
}
|
|
1324
|
-
function Segmented({ options, value, defaultValue, size
|
|
1331
|
+
function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
|
|
1332
|
+
const size = useControlSize(sizeProp);
|
|
1325
1333
|
const normalized = (0, import_react6.useMemo)(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
|
|
1326
1334
|
const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
|
|
1327
1335
|
function keyboard(event) {
|
|
@@ -1813,7 +1821,8 @@ var import_react_dom2 = require("react-dom");
|
|
|
1813
1821
|
var import_react9 = require("react");
|
|
1814
1822
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1815
1823
|
var CheckboxGroupContext = (0, import_react9.createContext)(null);
|
|
1816
|
-
var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
1824
|
+
var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
1825
|
+
const size = useControlSize(sizeProp);
|
|
1817
1826
|
const group = (0, import_react9.useContext)(CheckboxGroupContext);
|
|
1818
1827
|
const localRef = (0, import_react9.useRef)(null);
|
|
1819
1828
|
const fallbackId = (0, import_react9.useId)();
|
|
@@ -1827,7 +1836,7 @@ var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, inde
|
|
|
1827
1836
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
1828
1837
|
else if (forwardedRef) forwardedRef.current = node;
|
|
1829
1838
|
}
|
|
1830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: `sia-checkbox${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1831
1840
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1832
1841
|
"input",
|
|
1833
1842
|
{
|
|
@@ -1852,6 +1861,7 @@ var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, inde
|
|
|
1852
1861
|
] });
|
|
1853
1862
|
});
|
|
1854
1863
|
function CheckboxGroup({
|
|
1864
|
+
size: sizeProp,
|
|
1855
1865
|
value,
|
|
1856
1866
|
defaultValue = [],
|
|
1857
1867
|
options,
|
|
@@ -1861,6 +1871,7 @@ function CheckboxGroup({
|
|
|
1861
1871
|
children,
|
|
1862
1872
|
onChange
|
|
1863
1873
|
}) {
|
|
1874
|
+
const size = useControlSize(sizeProp);
|
|
1864
1875
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
1865
1876
|
const context = (0, import_react9.useMemo)(() => ({
|
|
1866
1877
|
values,
|
|
@@ -1871,13 +1882,13 @@ function CheckboxGroup({
|
|
|
1871
1882
|
setValues(next);
|
|
1872
1883
|
}
|
|
1873
1884
|
}), [disabled, name, setValues, values]);
|
|
1874
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
|
|
1885
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
|
|
1875
1886
|
options?.map((option) => {
|
|
1876
1887
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
1877
1888
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckboxRoot, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
1878
1889
|
}),
|
|
1879
1890
|
children
|
|
1880
|
-
] }) });
|
|
1891
|
+
] }) }) });
|
|
1881
1892
|
}
|
|
1882
1893
|
var Checkbox2 = Object.assign(CheckboxRoot, { Group: CheckboxGroup });
|
|
1883
1894
|
|
|
@@ -2509,7 +2520,7 @@ var Input = (0, import_react15.forwardRef)(function Input2({
|
|
|
2509
2520
|
label,
|
|
2510
2521
|
hint,
|
|
2511
2522
|
status = "default",
|
|
2512
|
-
size
|
|
2523
|
+
size: sizeProp,
|
|
2513
2524
|
prefix,
|
|
2514
2525
|
suffix,
|
|
2515
2526
|
allowClear = false,
|
|
@@ -2526,6 +2537,7 @@ var Input = (0, import_react15.forwardRef)(function Input2({
|
|
|
2526
2537
|
onChange,
|
|
2527
2538
|
...props
|
|
2528
2539
|
}, forwardedRef) {
|
|
2540
|
+
const size = useControlSize(sizeProp);
|
|
2529
2541
|
const fallbackId = (0, import_react15.useId)();
|
|
2530
2542
|
const inputId = id ?? fallbackId;
|
|
2531
2543
|
const localRef = (0, import_react15.useRef)(null);
|
|
@@ -2844,7 +2856,7 @@ var Select = (0, import_react18.forwardRef)(function Select2({
|
|
|
2844
2856
|
onChange,
|
|
2845
2857
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
2846
2858
|
placeholderMode,
|
|
2847
|
-
size
|
|
2859
|
+
size: sizeProp,
|
|
2848
2860
|
status = "default",
|
|
2849
2861
|
allowClear = false,
|
|
2850
2862
|
loading = false,
|
|
@@ -2870,6 +2882,7 @@ var Select = (0, import_react18.forwardRef)(function Select2({
|
|
|
2870
2882
|
onKeyDown,
|
|
2871
2883
|
...props
|
|
2872
2884
|
}, forwardedRef) {
|
|
2885
|
+
const size = useControlSize(sizeProp);
|
|
2873
2886
|
const fallbackId = (0, import_react18.useId)();
|
|
2874
2887
|
const selectId = id ?? fallbackId;
|
|
2875
2888
|
const listboxId = `${selectId}-listbox`;
|
|
@@ -3510,6 +3523,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3510
3523
|
label,
|
|
3511
3524
|
hint,
|
|
3512
3525
|
status = "default",
|
|
3526
|
+
size: sizeProp,
|
|
3513
3527
|
showCount = false,
|
|
3514
3528
|
placeholder,
|
|
3515
3529
|
placeholderMode,
|
|
@@ -3522,6 +3536,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3522
3536
|
onChange,
|
|
3523
3537
|
...props
|
|
3524
3538
|
}, ref) {
|
|
3539
|
+
const size = useControlSize(sizeProp);
|
|
3525
3540
|
const fallbackId = (0, import_react20.useId)();
|
|
3526
3541
|
const textAreaId = id ?? fallbackId;
|
|
3527
3542
|
const [uncontrolledValue, setUncontrolledValue] = (0, import_react20.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
@@ -3533,7 +3548,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3533
3548
|
setUncontrolledValue(event.target.value);
|
|
3534
3549
|
onChange?.(event);
|
|
3535
3550
|
}
|
|
3536
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
|
|
3551
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
|
|
3537
3552
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3538
3553
|
"textarea",
|
|
3539
3554
|
{
|