@sia.soul/sia-react-ui 0.1.12 → 0.1.14
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-K3XRTEIO.js} +9 -7
- 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-BK8AXc12.d.cts} +3 -2
- package/dist/{core-VmiEI1Jp.d.ts → core-CJK3_KTQ.d.ts} +3 -2
- package/dist/core.cjs +54 -40
- package/dist/core.css +344 -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 +312 -123
- package/dist/index.css +344 -40
- package/dist/index.d.cts +27 -14
- package/dist/index.d.ts +27 -14
- package/dist/index.js +255 -88
- 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;
|
|
@@ -1008,7 +1033,7 @@ var import_react7 = require("react");
|
|
|
1008
1033
|
var import_react6 = require("react");
|
|
1009
1034
|
|
|
1010
1035
|
// src/components/PopupPortal.tsx
|
|
1011
|
-
var
|
|
1036
|
+
var import_react5 = require("react");
|
|
1012
1037
|
var import_react_dom = require("react-dom");
|
|
1013
1038
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1014
1039
|
function setForwardedRef(ref, value) {
|
|
@@ -1018,7 +1043,7 @@ function setForwardedRef(ref, value) {
|
|
|
1018
1043
|
function clamp(value, min, max) {
|
|
1019
1044
|
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
1020
1045
|
}
|
|
1021
|
-
var PopupPortal = (0,
|
|
1046
|
+
var PopupPortal = (0, import_react5.forwardRef)(function PopupPortal2({
|
|
1022
1047
|
anchorRef,
|
|
1023
1048
|
open = true,
|
|
1024
1049
|
placement = "bottom-start",
|
|
@@ -1029,9 +1054,9 @@ var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
|
1029
1054
|
children,
|
|
1030
1055
|
...props
|
|
1031
1056
|
}, forwardedRef) {
|
|
1032
|
-
const popupRef = (0,
|
|
1033
|
-
const [position, setPosition] = (0,
|
|
1034
|
-
(0,
|
|
1057
|
+
const popupRef = (0, import_react5.useRef)(null);
|
|
1058
|
+
const [position, setPosition] = (0, import_react5.useState)();
|
|
1059
|
+
(0, import_react5.useLayoutEffect)(() => {
|
|
1035
1060
|
if (!open || typeof document === "undefined") {
|
|
1036
1061
|
setPosition(void 0);
|
|
1037
1062
|
return;
|
|
@@ -1122,25 +1147,6 @@ var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
|
1122
1147
|
);
|
|
1123
1148
|
});
|
|
1124
1149
|
|
|
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
1150
|
// src/components/Navigation.tsx
|
|
1145
1151
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
1146
1152
|
function MenuPopup({
|
|
@@ -1321,7 +1327,8 @@ function Menu({
|
|
|
1321
1327
|
}
|
|
1322
1328
|
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
1329
|
}
|
|
1324
|
-
function Segmented({ options, value, defaultValue, size
|
|
1330
|
+
function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
|
|
1331
|
+
const size = useControlSize(sizeProp);
|
|
1325
1332
|
const normalized = (0, import_react6.useMemo)(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
|
|
1326
1333
|
const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
|
|
1327
1334
|
function keyboard(event) {
|
|
@@ -1813,7 +1820,8 @@ var import_react_dom2 = require("react-dom");
|
|
|
1813
1820
|
var import_react9 = require("react");
|
|
1814
1821
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1815
1822
|
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) {
|
|
1823
|
+
var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
1824
|
+
const size = useControlSize(sizeProp);
|
|
1817
1825
|
const group = (0, import_react9.useContext)(CheckboxGroupContext);
|
|
1818
1826
|
const localRef = (0, import_react9.useRef)(null);
|
|
1819
1827
|
const fallbackId = (0, import_react9.useId)();
|
|
@@ -1827,7 +1835,7 @@ var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, inde
|
|
|
1827
1835
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
1828
1836
|
else if (forwardedRef) forwardedRef.current = node;
|
|
1829
1837
|
}
|
|
1830
|
-
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: `sia-checkbox${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1838
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
1831
1839
|
/* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1832
1840
|
"input",
|
|
1833
1841
|
{
|
|
@@ -1852,6 +1860,7 @@ var CheckboxRoot = (0, import_react9.forwardRef)(function Checkbox({ value, inde
|
|
|
1852
1860
|
] });
|
|
1853
1861
|
});
|
|
1854
1862
|
function CheckboxGroup({
|
|
1863
|
+
size: sizeProp,
|
|
1855
1864
|
value,
|
|
1856
1865
|
defaultValue = [],
|
|
1857
1866
|
options,
|
|
@@ -1861,6 +1870,7 @@ function CheckboxGroup({
|
|
|
1861
1870
|
children,
|
|
1862
1871
|
onChange
|
|
1863
1872
|
}) {
|
|
1873
|
+
const size = useControlSize(sizeProp);
|
|
1864
1874
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
1865
1875
|
const context = (0, import_react9.useMemo)(() => ({
|
|
1866
1876
|
values,
|
|
@@ -1871,13 +1881,13 @@ function CheckboxGroup({
|
|
|
1871
1881
|
setValues(next);
|
|
1872
1882
|
}
|
|
1873
1883
|
}), [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: [
|
|
1884
|
+
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
1885
|
options?.map((option) => {
|
|
1876
1886
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
1877
1887
|
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckboxRoot, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
1878
1888
|
}),
|
|
1879
1889
|
children
|
|
1880
|
-
] }) });
|
|
1890
|
+
] }) }) });
|
|
1881
1891
|
}
|
|
1882
1892
|
var Checkbox2 = Object.assign(CheckboxRoot, { Group: CheckboxGroup });
|
|
1883
1893
|
|
|
@@ -2509,7 +2519,7 @@ var Input = (0, import_react15.forwardRef)(function Input2({
|
|
|
2509
2519
|
label,
|
|
2510
2520
|
hint,
|
|
2511
2521
|
status = "default",
|
|
2512
|
-
size
|
|
2522
|
+
size: sizeProp,
|
|
2513
2523
|
prefix,
|
|
2514
2524
|
suffix,
|
|
2515
2525
|
allowClear = false,
|
|
@@ -2526,6 +2536,7 @@ var Input = (0, import_react15.forwardRef)(function Input2({
|
|
|
2526
2536
|
onChange,
|
|
2527
2537
|
...props
|
|
2528
2538
|
}, forwardedRef) {
|
|
2539
|
+
const size = useControlSize(sizeProp);
|
|
2529
2540
|
const fallbackId = (0, import_react15.useId)();
|
|
2530
2541
|
const inputId = id ?? fallbackId;
|
|
2531
2542
|
const localRef = (0, import_react15.useRef)(null);
|
|
@@ -2844,7 +2855,7 @@ var Select = (0, import_react18.forwardRef)(function Select2({
|
|
|
2844
2855
|
onChange,
|
|
2845
2856
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
2846
2857
|
placeholderMode,
|
|
2847
|
-
size
|
|
2858
|
+
size: sizeProp,
|
|
2848
2859
|
status = "default",
|
|
2849
2860
|
allowClear = false,
|
|
2850
2861
|
loading = false,
|
|
@@ -2870,6 +2881,7 @@ var Select = (0, import_react18.forwardRef)(function Select2({
|
|
|
2870
2881
|
onKeyDown,
|
|
2871
2882
|
...props
|
|
2872
2883
|
}, forwardedRef) {
|
|
2884
|
+
const size = useControlSize(sizeProp);
|
|
2873
2885
|
const fallbackId = (0, import_react18.useId)();
|
|
2874
2886
|
const selectId = id ?? fallbackId;
|
|
2875
2887
|
const listboxId = `${selectId}-listbox`;
|
|
@@ -3510,6 +3522,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3510
3522
|
label,
|
|
3511
3523
|
hint,
|
|
3512
3524
|
status = "default",
|
|
3525
|
+
size: sizeProp,
|
|
3513
3526
|
showCount = false,
|
|
3514
3527
|
placeholder,
|
|
3515
3528
|
placeholderMode,
|
|
@@ -3522,6 +3535,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3522
3535
|
onChange,
|
|
3523
3536
|
...props
|
|
3524
3537
|
}, ref) {
|
|
3538
|
+
const size = useControlSize(sizeProp);
|
|
3525
3539
|
const fallbackId = (0, import_react20.useId)();
|
|
3526
3540
|
const textAreaId = id ?? fallbackId;
|
|
3527
3541
|
const [uncontrolledValue, setUncontrolledValue] = (0, import_react20.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
@@ -3533,7 +3547,7 @@ var TextArea = (0, import_react20.forwardRef)(function TextArea2({
|
|
|
3533
3547
|
setUncontrolledValue(event.target.value);
|
|
3534
3548
|
onChange?.(event);
|
|
3535
3549
|
}
|
|
3536
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
|
|
3550
|
+
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
3551
|
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3538
3552
|
"textarea",
|
|
3539
3553
|
{
|