@sia.soul/sia-react-ui 0.1.13 → 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 +328 -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 +221 -111
- package/dist/index.css +328 -40
- package/dist/index.d.cts +24 -14
- package/dist/index.d.ts +24 -14
- package/dist/index.js +164 -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/index.cjs
CHANGED
|
@@ -1039,11 +1039,35 @@ function Alert({
|
|
|
1039
1039
|
] });
|
|
1040
1040
|
}
|
|
1041
1041
|
|
|
1042
|
+
// src/components/shared.ts
|
|
1043
|
+
var import_react3 = require("react");
|
|
1044
|
+
var ControlSizeContext = (0, import_react3.createContext)("medium");
|
|
1045
|
+
function useControlSize(size) {
|
|
1046
|
+
const inherited = (0, import_react3.useContext)(ControlSizeContext);
|
|
1047
|
+
return size ?? inherited;
|
|
1048
|
+
}
|
|
1049
|
+
var PlaceholderModeContext = (0, import_react3.createContext)("default");
|
|
1050
|
+
function usePlaceholderMode(mode) {
|
|
1051
|
+
const inherited = (0, import_react3.useContext)(PlaceholderModeContext);
|
|
1052
|
+
return mode ?? inherited;
|
|
1053
|
+
}
|
|
1054
|
+
function useControllableState({ value, defaultValue, onChange }) {
|
|
1055
|
+
const [internalValue, setInternalValue] = (0, import_react3.useState)(defaultValue);
|
|
1056
|
+
const controlled = value !== void 0;
|
|
1057
|
+
const currentValue = controlled ? value : internalValue;
|
|
1058
|
+
const setValue2 = (0, import_react3.useCallback)((nextValue) => {
|
|
1059
|
+
if (Object.is(currentValue, nextValue)) return;
|
|
1060
|
+
if (!controlled) setInternalValue(nextValue);
|
|
1061
|
+
onChange?.(nextValue);
|
|
1062
|
+
}, [controlled, currentValue, onChange]);
|
|
1063
|
+
return [currentValue, setValue2];
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1042
1066
|
// src/components/Navigation.tsx
|
|
1043
1067
|
var import_react5 = require("react");
|
|
1044
1068
|
|
|
1045
1069
|
// src/components/PopupPortal.tsx
|
|
1046
|
-
var
|
|
1070
|
+
var import_react4 = require("react");
|
|
1047
1071
|
var import_react_dom = require("react-dom");
|
|
1048
1072
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1049
1073
|
function setForwardedRef(ref, value) {
|
|
@@ -1053,7 +1077,7 @@ function setForwardedRef(ref, value) {
|
|
|
1053
1077
|
function clamp(value, min, max) {
|
|
1054
1078
|
return Math.min(Math.max(value, min), Math.max(min, max));
|
|
1055
1079
|
}
|
|
1056
|
-
var PopupPortal = (0,
|
|
1080
|
+
var PopupPortal = (0, import_react4.forwardRef)(function PopupPortal2({
|
|
1057
1081
|
anchorRef,
|
|
1058
1082
|
open = true,
|
|
1059
1083
|
placement = "bottom-start",
|
|
@@ -1064,9 +1088,9 @@ var PopupPortal = (0, import_react3.forwardRef)(function PopupPortal2({
|
|
|
1064
1088
|
children,
|
|
1065
1089
|
...props
|
|
1066
1090
|
}, forwardedRef) {
|
|
1067
|
-
const popupRef = (0,
|
|
1068
|
-
const [position, setPosition] = (0,
|
|
1069
|
-
(0,
|
|
1091
|
+
const popupRef = (0, import_react4.useRef)(null);
|
|
1092
|
+
const [position, setPosition] = (0, import_react4.useState)();
|
|
1093
|
+
(0, import_react4.useLayoutEffect)(() => {
|
|
1070
1094
|
if (!open || typeof document === "undefined") {
|
|
1071
1095
|
setPosition(void 0);
|
|
1072
1096
|
return;
|
|
@@ -1157,25 +1181,6 @@ var PopupPortal = (0, import_react3.forwardRef)(function PopupPortal2({
|
|
|
1157
1181
|
);
|
|
1158
1182
|
});
|
|
1159
1183
|
|
|
1160
|
-
// src/components/shared.ts
|
|
1161
|
-
var import_react4 = require("react");
|
|
1162
|
-
var PlaceholderModeContext = (0, import_react4.createContext)("default");
|
|
1163
|
-
function usePlaceholderMode(mode) {
|
|
1164
|
-
const inherited = (0, import_react4.useContext)(PlaceholderModeContext);
|
|
1165
|
-
return mode ?? inherited;
|
|
1166
|
-
}
|
|
1167
|
-
function useControllableState({ value, defaultValue, onChange }) {
|
|
1168
|
-
const [internalValue, setInternalValue] = (0, import_react4.useState)(defaultValue);
|
|
1169
|
-
const controlled = value !== void 0;
|
|
1170
|
-
const currentValue = controlled ? value : internalValue;
|
|
1171
|
-
const setValue2 = (0, import_react4.useCallback)((nextValue) => {
|
|
1172
|
-
if (Object.is(currentValue, nextValue)) return;
|
|
1173
|
-
if (!controlled) setInternalValue(nextValue);
|
|
1174
|
-
onChange?.(nextValue);
|
|
1175
|
-
}, [controlled, currentValue, onChange]);
|
|
1176
|
-
return [currentValue, setValue2];
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
1184
|
// src/components/Navigation.tsx
|
|
1180
1185
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1181
1186
|
function MenuPopup({
|
|
@@ -1377,7 +1382,8 @@ function Steps({ items, current = 0, initial: initial3 = 0, direction = "horizon
|
|
|
1377
1382
|
] }, index);
|
|
1378
1383
|
}) });
|
|
1379
1384
|
}
|
|
1380
|
-
function Segmented({ options, value, defaultValue, size
|
|
1385
|
+
function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
|
|
1386
|
+
const size = useControlSize(sizeProp);
|
|
1381
1387
|
const normalized = (0, import_react5.useMemo)(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
|
|
1382
1388
|
const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
|
|
1383
1389
|
function keyboard(event) {
|
|
@@ -1403,7 +1409,7 @@ var import_react6 = require("react");
|
|
|
1403
1409
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
1404
1410
|
var Button = (0, import_react6.forwardRef)(function Button2({
|
|
1405
1411
|
variant = "default",
|
|
1406
|
-
size
|
|
1412
|
+
size: sizeProp,
|
|
1407
1413
|
loading = false,
|
|
1408
1414
|
block = false,
|
|
1409
1415
|
danger = false,
|
|
@@ -1416,6 +1422,7 @@ var Button = (0, import_react6.forwardRef)(function Button2({
|
|
|
1416
1422
|
style,
|
|
1417
1423
|
...props
|
|
1418
1424
|
}, forwardedRef) {
|
|
1425
|
+
const size = useControlSize(sizeProp);
|
|
1419
1426
|
const localRef = (0, import_react6.useRef)(null);
|
|
1420
1427
|
function setRef(node) {
|
|
1421
1428
|
localRef.current = node;
|
|
@@ -2027,7 +2034,7 @@ var Input = (0, import_react10.forwardRef)(function Input2({
|
|
|
2027
2034
|
label,
|
|
2028
2035
|
hint,
|
|
2029
2036
|
status = "default",
|
|
2030
|
-
size
|
|
2037
|
+
size: sizeProp,
|
|
2031
2038
|
prefix,
|
|
2032
2039
|
suffix,
|
|
2033
2040
|
allowClear = false,
|
|
@@ -2044,6 +2051,7 @@ var Input = (0, import_react10.forwardRef)(function Input2({
|
|
|
2044
2051
|
onChange,
|
|
2045
2052
|
...props
|
|
2046
2053
|
}, forwardedRef) {
|
|
2054
|
+
const size = useControlSize(sizeProp);
|
|
2047
2055
|
const fallbackId = (0, import_react10.useId)();
|
|
2048
2056
|
const inputId = id ?? fallbackId;
|
|
2049
2057
|
const localRef = (0, import_react10.useRef)(null);
|
|
@@ -2127,7 +2135,8 @@ var Input = (0, import_react10.forwardRef)(function Input2({
|
|
|
2127
2135
|
var import_react11 = require("react");
|
|
2128
2136
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2129
2137
|
var CheckboxGroupContext = (0, import_react11.createContext)(null);
|
|
2130
|
-
var CheckboxRoot = (0, import_react11.forwardRef)(function Checkbox({ value, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
2138
|
+
var CheckboxRoot = (0, import_react11.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
2139
|
+
const size = useControlSize(sizeProp);
|
|
2131
2140
|
const group = (0, import_react11.useContext)(CheckboxGroupContext);
|
|
2132
2141
|
const localRef = (0, import_react11.useRef)(null);
|
|
2133
2142
|
const fallbackId = (0, import_react11.useId)();
|
|
@@ -2141,7 +2150,7 @@ var CheckboxRoot = (0, import_react11.forwardRef)(function Checkbox({ value, ind
|
|
|
2141
2150
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
2142
2151
|
else if (forwardedRef) forwardedRef.current = node;
|
|
2143
2152
|
}
|
|
2144
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `sia-checkbox${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2153
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2145
2154
|
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
2146
2155
|
"input",
|
|
2147
2156
|
{
|
|
@@ -2166,6 +2175,7 @@ var CheckboxRoot = (0, import_react11.forwardRef)(function Checkbox({ value, ind
|
|
|
2166
2175
|
] });
|
|
2167
2176
|
});
|
|
2168
2177
|
function CheckboxGroup({
|
|
2178
|
+
size: sizeProp,
|
|
2169
2179
|
value,
|
|
2170
2180
|
defaultValue = [],
|
|
2171
2181
|
options,
|
|
@@ -2175,6 +2185,7 @@ function CheckboxGroup({
|
|
|
2175
2185
|
children,
|
|
2176
2186
|
onChange
|
|
2177
2187
|
}) {
|
|
2188
|
+
const size = useControlSize(sizeProp);
|
|
2178
2189
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
2179
2190
|
const context = (0, import_react11.useMemo)(() => ({
|
|
2180
2191
|
values,
|
|
@@ -2185,13 +2196,13 @@ function CheckboxGroup({
|
|
|
2185
2196
|
setValues(next);
|
|
2186
2197
|
}
|
|
2187
2198
|
}), [disabled, name, setValues, values]);
|
|
2188
|
-
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
|
|
2199
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
|
|
2189
2200
|
options?.map((option) => {
|
|
2190
2201
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
2191
2202
|
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(CheckboxRoot, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
2192
2203
|
}),
|
|
2193
2204
|
children
|
|
2194
|
-
] }) });
|
|
2205
|
+
] }) }) });
|
|
2195
2206
|
}
|
|
2196
2207
|
var Checkbox2 = Object.assign(CheckboxRoot, { Group: CheckboxGroup });
|
|
2197
2208
|
|
|
@@ -2885,7 +2896,7 @@ var Select = (0, import_react15.forwardRef)(function Select2({
|
|
|
2885
2896
|
onChange,
|
|
2886
2897
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
2887
2898
|
placeholderMode,
|
|
2888
|
-
size
|
|
2899
|
+
size: sizeProp,
|
|
2889
2900
|
status = "default",
|
|
2890
2901
|
allowClear = false,
|
|
2891
2902
|
loading = false,
|
|
@@ -2911,6 +2922,7 @@ var Select = (0, import_react15.forwardRef)(function Select2({
|
|
|
2911
2922
|
onKeyDown,
|
|
2912
2923
|
...props
|
|
2913
2924
|
}, forwardedRef) {
|
|
2925
|
+
const size = useControlSize(sizeProp);
|
|
2914
2926
|
const fallbackId = (0, import_react15.useId)();
|
|
2915
2927
|
const selectId = id ?? fallbackId;
|
|
2916
2928
|
const listboxId = `${selectId}-listbox`;
|
|
@@ -3297,6 +3309,7 @@ var Select = (0, import_react15.forwardRef)(function Select2({
|
|
|
3297
3309
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
3298
3310
|
var DEFAULT_PAGE_SIZE_OPTIONS = [10, 25, 50, 100, 200, 500, 1e3, 2e3, 5e3];
|
|
3299
3311
|
function Pagination({
|
|
3312
|
+
size: sizeProp,
|
|
3300
3313
|
total = 0,
|
|
3301
3314
|
current,
|
|
3302
3315
|
defaultCurrent = 1,
|
|
@@ -3314,6 +3327,7 @@ function Pagination({
|
|
|
3314
3327
|
className = "",
|
|
3315
3328
|
...props
|
|
3316
3329
|
}) {
|
|
3330
|
+
const controlSize = useControlSize(sizeProp);
|
|
3317
3331
|
const [size, setSize] = useControllableState({ value: pageSize, defaultValue: Math.max(1, defaultPageSize) });
|
|
3318
3332
|
const [page, setPage] = useControllableState({ value: current, defaultValue: Math.max(1, defaultCurrent) });
|
|
3319
3333
|
const [internalRefreshing, setInternalRefreshing] = (0, import_react16.useState)(false);
|
|
@@ -3345,14 +3359,14 @@ function Pagination({
|
|
|
3345
3359
|
if (refreshing === void 0) setInternalRefreshing(false);
|
|
3346
3360
|
}
|
|
3347
3361
|
}
|
|
3348
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("nav", { className: `sia-pagination ${className}`.trim(), "aria-label": "\u5206\u9875", ...props, children: [
|
|
3362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("nav", { className: `sia-pagination sia-pagination--${controlSize} ${className}`.trim(), "aria-label": "\u5206\u9875", ...props, children: [
|
|
3349
3363
|
showSizeChanger ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "sia-pagination__size", children: [
|
|
3350
3364
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: "\u6BCF\u9875\u663E\u793A" }),
|
|
3351
3365
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
3352
3366
|
Select,
|
|
3353
3367
|
{
|
|
3354
3368
|
className: "sia-pagination__size-select",
|
|
3355
|
-
size:
|
|
3369
|
+
size: controlSize,
|
|
3356
3370
|
"aria-label": "\u6BCF\u9875\u6761\u6570",
|
|
3357
3371
|
value: size,
|
|
3358
3372
|
options: sizes.map((value) => ({ label: `${value} \u6761`, value })),
|
|
@@ -3367,7 +3381,7 @@ function Pagination({
|
|
|
3367
3381
|
Button,
|
|
3368
3382
|
{
|
|
3369
3383
|
variant: "text",
|
|
3370
|
-
size:
|
|
3384
|
+
size: controlSize,
|
|
3371
3385
|
className: "sia-pagination__total",
|
|
3372
3386
|
disabled: disabled || !onRefreshTotal || loading,
|
|
3373
3387
|
title: onRefreshTotal ? "\u70B9\u51FB\u5237\u65B0\u603B\u8BB0\u5F55\u6570" : void 0,
|
|
@@ -3382,15 +3396,15 @@ function Pagination({
|
|
|
3382
3396
|
}
|
|
3383
3397
|
) : null,
|
|
3384
3398
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "sia-pagination__buttons", children: [
|
|
3385
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size:
|
|
3386
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size:
|
|
3399
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size: controlSize, variant: "text", "aria-label": "\u7B2C\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(1), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "double-left", size: 15 }) }),
|
|
3400
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0A\u4E00\u9875", disabled: disabled || safePage <= 1, onClick: () => change(safePage - 1), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron-left", size: 15 }) }),
|
|
3387
3401
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { "aria-live": "polite", children: [
|
|
3388
3402
|
safePage,
|
|
3389
3403
|
" / ",
|
|
3390
3404
|
totalPages
|
|
3391
3405
|
] }),
|
|
3392
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size:
|
|
3393
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size:
|
|
3406
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size: controlSize, variant: "text", "aria-label": "\u4E0B\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(safePage + 1), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "chevron-right", size: 15 }) }),
|
|
3407
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button, { size: controlSize, variant: "text", "aria-label": "\u6700\u540E\u4E00\u9875", disabled: disabled || safePage >= totalPages, onClick: () => change(totalPages), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Icon, { name: "double-right", size: 15 }) })
|
|
3394
3408
|
] })
|
|
3395
3409
|
] });
|
|
3396
3410
|
}
|
|
@@ -3435,6 +3449,7 @@ function Cascader({
|
|
|
3435
3449
|
options,
|
|
3436
3450
|
value,
|
|
3437
3451
|
defaultValue,
|
|
3452
|
+
size: sizeProp,
|
|
3438
3453
|
multiple = false,
|
|
3439
3454
|
showSearch = false,
|
|
3440
3455
|
allowClear = false,
|
|
@@ -3450,6 +3465,7 @@ function Cascader({
|
|
|
3450
3465
|
className = "",
|
|
3451
3466
|
...props
|
|
3452
3467
|
}) {
|
|
3468
|
+
const size = useControlSize(sizeProp);
|
|
3453
3469
|
const fields = (0, import_react17.useMemo)(() => ({ label: fieldNames?.label ?? "label", value: fieldNames?.value ?? "value", children: fieldNames?.children ?? "children" }), [fieldNames]);
|
|
3454
3470
|
const rootRef = (0, import_react17.useRef)(null);
|
|
3455
3471
|
const popupRef = (0, import_react17.useRef)(null);
|
|
@@ -3538,7 +3554,7 @@ function Cascader({
|
|
|
3538
3554
|
if (children?.length) columns.push(children);
|
|
3539
3555
|
});
|
|
3540
3556
|
const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder, filled: selectedPaths.length > 0, active: open });
|
|
3541
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: rootRef, className: `sia-cascader${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
3557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { ref: rootRef, className: `sia-cascader sia-cascader--${size}${open ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
3542
3558
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("button", { type: "button", className: `sia-cascader__trigger${floating.className}`, disabled, "aria-haspopup": "listbox", "aria-expanded": open, onClick: toggleOpen, children: [
|
|
3543
3559
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sia-cascader__value", children: display ? multiple && Array.isArray(display) ? display.map((label, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sia-cascader__tag", children: label }, pathKey(selectedPaths[index] ?? []))) : display : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sia-cascader__placeholder", children: placeholder }) }),
|
|
3544
3560
|
allowClear && selectedPaths.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "sia-cascader__clear", role: "button", "aria-label": "\u6E05\u9664\u9009\u62E9", onClick: (event) => {
|
|
@@ -3604,14 +3620,15 @@ function Cascader({
|
|
|
3604
3620
|
var import_react18 = require("react");
|
|
3605
3621
|
var import_react_dom4 = require("react-dom");
|
|
3606
3622
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3607
|
-
function Rate({ value, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
|
|
3623
|
+
function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
|
|
3624
|
+
const size = useControlSize(sizeProp);
|
|
3608
3625
|
const [current, setCurrent] = useControllableState({ value, defaultValue, onChange });
|
|
3609
3626
|
const [hover, setHover] = (0, import_react18.useState)(0);
|
|
3610
3627
|
const shown = hover || current;
|
|
3611
3628
|
function choose(next) {
|
|
3612
3629
|
setCurrent(allowClear && next === current ? 0 : next);
|
|
3613
3630
|
}
|
|
3614
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `sia-rate${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", "aria-label": "\u8BC4\u5206", onMouseLeave: () => {
|
|
3631
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: `sia-rate sia-rate--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", "aria-label": "\u8BC4\u5206", onMouseLeave: () => {
|
|
3615
3632
|
setHover(0);
|
|
3616
3633
|
onHoverChange?.(0);
|
|
3617
3634
|
}, ...props, children: Array.from({ length: count }, (_, index) => {
|
|
@@ -5069,6 +5086,7 @@ var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
|
5069
5086
|
var Switch = (0, import_react25.forwardRef)(function Switch2({
|
|
5070
5087
|
label,
|
|
5071
5088
|
variant = "standard",
|
|
5089
|
+
size: sizeProp,
|
|
5072
5090
|
checkedContent,
|
|
5073
5091
|
uncheckedContent,
|
|
5074
5092
|
onChange,
|
|
@@ -5076,6 +5094,7 @@ var Switch = (0, import_react25.forwardRef)(function Switch2({
|
|
|
5076
5094
|
className = "",
|
|
5077
5095
|
...props
|
|
5078
5096
|
}, ref) {
|
|
5097
|
+
const size = useControlSize(sizeProp);
|
|
5079
5098
|
const hasContent = checkedContent !== void 0 || uncheckedContent !== void 0;
|
|
5080
5099
|
const checkedVisual = checkedContent ?? (variant === "segmented" ? "\u5F00" : null);
|
|
5081
5100
|
const uncheckedVisual = uncheckedContent ?? (variant === "segmented" ? "\u5173" : null);
|
|
@@ -5083,7 +5102,7 @@ var Switch = (0, import_react25.forwardRef)(function Switch2({
|
|
|
5083
5102
|
onCheckedChange?.(event.currentTarget.checked);
|
|
5084
5103
|
onChange?.(event);
|
|
5085
5104
|
};
|
|
5086
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: `sia-switch-wrap ${className}`.trim(), children: [
|
|
5105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: `sia-switch-wrap sia-switch-wrap--${size} ${className}`.trim(), children: [
|
|
5087
5106
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("input", { ref, type: "checkbox", role: "switch", className: "sia-switch-input", onChange: handleChange, ...props }),
|
|
5088
5107
|
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
5089
5108
|
"span",
|
|
@@ -5292,6 +5311,7 @@ function FormRoot({
|
|
|
5292
5311
|
form,
|
|
5293
5312
|
initialValues,
|
|
5294
5313
|
layout = "horizontal",
|
|
5314
|
+
size: sizeProp,
|
|
5295
5315
|
placeholderMode,
|
|
5296
5316
|
disabled = false,
|
|
5297
5317
|
requiredMark = true,
|
|
@@ -5302,16 +5322,17 @@ function FormRoot({
|
|
|
5302
5322
|
children,
|
|
5303
5323
|
...props
|
|
5304
5324
|
}) {
|
|
5325
|
+
const size = useControlSize(sizeProp);
|
|
5305
5326
|
const resolvedPlaceholderMode = usePlaceholderMode(placeholderMode);
|
|
5306
5327
|
const [internalForm] = useForm(form);
|
|
5307
5328
|
const instance = internalForm;
|
|
5308
5329
|
instance.configure(initialValues, { onFinish, onFinishFailed, onValuesChange });
|
|
5309
5330
|
const context = (0, import_react25.useMemo)(() => instance, [instance]);
|
|
5310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5331
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FormContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PlaceholderModeContext.Provider, { value: resolvedPlaceholderMode, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5311
5332
|
"form",
|
|
5312
5333
|
{
|
|
5313
5334
|
...props,
|
|
5314
|
-
className: `sia-form sia-form--${layout}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
5335
|
+
className: `sia-form sia-form--${layout} sia-form--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(),
|
|
5315
5336
|
"data-required-mark": requiredMark,
|
|
5316
5337
|
onSubmit: (event) => {
|
|
5317
5338
|
event.preventDefault();
|
|
@@ -5319,7 +5340,7 @@ function FormRoot({
|
|
|
5319
5340
|
},
|
|
5320
5341
|
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("fieldset", { disabled, children })
|
|
5321
5342
|
}
|
|
5322
|
-
) }) });
|
|
5343
|
+
) }) }) });
|
|
5323
5344
|
}
|
|
5324
5345
|
function defaultEventValue(valuePropName, args) {
|
|
5325
5346
|
const first = args[0];
|
|
@@ -5467,12 +5488,13 @@ var Form = Object.assign(FormRoot, {
|
|
|
5467
5488
|
var import_react26 = require("react");
|
|
5468
5489
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5469
5490
|
var RadioContext = (0, import_react26.createContext)(null);
|
|
5470
|
-
var RadioRoot = (0, import_react26.forwardRef)(function Radio({ value, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
5491
|
+
var RadioRoot = (0, import_react26.forwardRef)(function Radio({ value, size: sizeProp, children, disabled, checked, defaultChecked, button = false, className = "", onChange, ...props }, ref) {
|
|
5492
|
+
const size = useControlSize(sizeProp);
|
|
5471
5493
|
const group = (0, import_react26.useContext)(RadioContext);
|
|
5472
5494
|
const fallbackId = (0, import_react26.useId)();
|
|
5473
5495
|
const grouped = group !== null;
|
|
5474
5496
|
const currentChecked = grouped ? group.value === value : checked;
|
|
5475
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: `sia-radio${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
5497
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("label", { className: `sia-radio sia-radio--${size}${button ? " sia-radio--button" : ""}${button && group?.buttonStyle === "solid" ? " sia-radio--solid" : ""}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
5476
5498
|
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5477
5499
|
"input",
|
|
5478
5500
|
{
|
|
@@ -5500,6 +5522,7 @@ function RadioButton(props) {
|
|
|
5500
5522
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadioRoot, { ...props, button: true });
|
|
5501
5523
|
}
|
|
5502
5524
|
function RadioGroup({
|
|
5525
|
+
size: sizeProp,
|
|
5503
5526
|
value,
|
|
5504
5527
|
defaultValue,
|
|
5505
5528
|
options,
|
|
@@ -5511,6 +5534,7 @@ function RadioGroup({
|
|
|
5511
5534
|
children,
|
|
5512
5535
|
onChange
|
|
5513
5536
|
}) {
|
|
5537
|
+
const size = useControlSize(sizeProp);
|
|
5514
5538
|
const fallbackName = (0, import_react26.useId)();
|
|
5515
5539
|
const [currentValue, setValue2] = useControllableState({
|
|
5516
5540
|
value,
|
|
@@ -5527,13 +5551,13 @@ function RadioGroup({
|
|
|
5527
5551
|
setValue: setValue2
|
|
5528
5552
|
}), [buttonStyle, currentValue, disabled, fallbackName, name, setValue2]);
|
|
5529
5553
|
const Component = optionType === "button" ? RadioButton : RadioRoot;
|
|
5530
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadioContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
5554
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(RadioContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `sia-radio-group${optionType === "button" ? " sia-radio-group--button" : ""} ${className}`.trim(), role: "radiogroup", children: [
|
|
5531
5555
|
options?.map((option) => {
|
|
5532
5556
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
|
5533
5557
|
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Component, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
|
|
5534
5558
|
}),
|
|
5535
5559
|
children
|
|
5536
|
-
] }) });
|
|
5560
|
+
] }) }) });
|
|
5537
5561
|
}
|
|
5538
5562
|
var Radio2 = Object.assign(RadioRoot, { Button: RadioButton, Group: RadioGroup });
|
|
5539
5563
|
|
|
@@ -5728,6 +5752,7 @@ function createDefaultStops(color) {
|
|
|
5728
5752
|
return [createStop(color, 0), createStop("#FFFFFF", 100)];
|
|
5729
5753
|
}
|
|
5730
5754
|
function ColorPicker({
|
|
5755
|
+
size: sizeProp,
|
|
5731
5756
|
value,
|
|
5732
5757
|
defaultValue = "#1677FF",
|
|
5733
5758
|
mode,
|
|
@@ -5745,6 +5770,7 @@ function ColorPicker({
|
|
|
5745
5770
|
onClear,
|
|
5746
5771
|
...props
|
|
5747
5772
|
}) {
|
|
5773
|
+
const size = useControlSize(sizeProp);
|
|
5748
5774
|
const rootRef = (0, import_react28.useRef)(null);
|
|
5749
5775
|
const popupRef = (0, import_react28.useRef)(null);
|
|
5750
5776
|
const lastEmittedValue = (0, import_react28.useRef)();
|
|
@@ -5845,7 +5871,7 @@ function ColorPicker({
|
|
|
5845
5871
|
const triggerBackground = color || "transparent";
|
|
5846
5872
|
const triggerText = color || "\u65E0\u8272";
|
|
5847
5873
|
const opaqueColor = rgbaToHex({ ...rgba, a: 100 }, false);
|
|
5848
|
-
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: rootRef, className: `sia-color-picker${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
5874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { ref: rootRef, className: `sia-color-picker sia-color-picker--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), ...props, children: [
|
|
5849
5875
|
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
5850
5876
|
"button",
|
|
5851
5877
|
{
|
|
@@ -6233,7 +6259,7 @@ function DatePicker({
|
|
|
6233
6259
|
value,
|
|
6234
6260
|
defaultValue,
|
|
6235
6261
|
picker = "date",
|
|
6236
|
-
size
|
|
6262
|
+
size: sizeProp,
|
|
6237
6263
|
status = "default",
|
|
6238
6264
|
allowClear = true,
|
|
6239
6265
|
multiple = false,
|
|
@@ -6257,6 +6283,7 @@ function DatePicker({
|
|
|
6257
6283
|
renderExtraFooter,
|
|
6258
6284
|
...props
|
|
6259
6285
|
}) {
|
|
6286
|
+
const size = useControlSize(sizeProp);
|
|
6260
6287
|
const id = (0, import_react30.useId)();
|
|
6261
6288
|
const rootRef = (0, import_react30.useRef)(null);
|
|
6262
6289
|
const popupRef = (0, import_react30.useRef)(null);
|
|
@@ -6417,7 +6444,7 @@ function DateRangePicker({
|
|
|
6417
6444
|
maxRangeDays,
|
|
6418
6445
|
allowEmpty = [false, false],
|
|
6419
6446
|
endpointDisabled = [false, false],
|
|
6420
|
-
size
|
|
6447
|
+
size: sizeProp,
|
|
6421
6448
|
status = "default",
|
|
6422
6449
|
allowClear = true,
|
|
6423
6450
|
needConfirm,
|
|
@@ -6438,6 +6465,7 @@ function DateRangePicker({
|
|
|
6438
6465
|
renderExtraFooter,
|
|
6439
6466
|
...props
|
|
6440
6467
|
}) {
|
|
6468
|
+
const size = useControlSize(sizeProp);
|
|
6441
6469
|
const id = (0, import_react30.useId)();
|
|
6442
6470
|
const rootRef = (0, import_react30.useRef)(null);
|
|
6443
6471
|
const popupRef = (0, import_react30.useRef)(null);
|
|
@@ -6678,8 +6706,9 @@ function DateRangePicker({
|
|
|
6678
6706
|
endpointLabel
|
|
6679
6707
|
);
|
|
6680
6708
|
}
|
|
6681
|
-
const
|
|
6682
|
-
|
|
6709
|
+
const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(currentValue[0]), active: visible });
|
|
6710
|
+
const endFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[1], filled: Boolean(currentValue[1]), active: visible });
|
|
6711
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { ref: rootRef, className: `sia-picker sia-picker-range-control sia-picker--${size} sia-picker--${status}${visible ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
6683
6712
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
6684
6713
|
"button",
|
|
6685
6714
|
{
|
|
@@ -6696,14 +6725,19 @@ function DateRangePicker({
|
|
|
6696
6725
|
disabled,
|
|
6697
6726
|
onClick: () => changeOpen(!visible),
|
|
6698
6727
|
children: [
|
|
6699
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.
|
|
6728
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: `sia-picker-range-control__field${startFloating.className}`, children: [
|
|
6729
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] ? formatValue2(currentValue[0]) : placeholder[0] }),
|
|
6730
|
+
startFloating.label
|
|
6731
|
+
] }),
|
|
6700
6732
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "sia-picker-range-control__separator", children: separator }),
|
|
6701
|
-
/* @__PURE__ */ (0, import_jsx_runtime31.
|
|
6733
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("span", { className: `sia-picker-range-control__field${endFloating.className}`, children: [
|
|
6734
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] ? formatValue2(currentValue[1]) : placeholder[1] }),
|
|
6735
|
+
endFloating.label
|
|
6736
|
+
] }),
|
|
6702
6737
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "calendar", size: 16 }) })
|
|
6703
6738
|
]
|
|
6704
6739
|
}
|
|
6705
6740
|
),
|
|
6706
|
-
floating.label,
|
|
6707
6741
|
allowClear && (currentValue[0] || currentValue[1]) && !disabled ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
|
|
6708
6742
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(PopupPortal, { ref: popupRef, anchorRef: rootRef, open: visible, className: `sia-date-panel sia-date-panel--range${showTime ? ` sia-date-panel--with-time sia-date-panel--range-time-${compactDateTime ? "compact" : "paired"}` : ""}${presets?.length ? " sia-date-panel--with-presets" : ""}`, role: "dialog", "aria-label": "\u65E5\u671F\u8303\u56F4\u9009\u62E9\u9762\u677F", children: [
|
|
6709
6743
|
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "sia-date-panel__body", children: showTime ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "sia-date-panel__range-date-time", children: compactDateTime ? renderDateTimeGroup(activeIndex) : /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [
|
|
@@ -6779,7 +6813,7 @@ function SelectDateRange({
|
|
|
6779
6813
|
selectAriaLabel = "\u9009\u62E9\u7C7B\u578B",
|
|
6780
6814
|
rangeAriaLabel = "\u65E5\u671F\u8303\u56F4",
|
|
6781
6815
|
presets,
|
|
6782
|
-
size
|
|
6816
|
+
size: sizeProp,
|
|
6783
6817
|
status = "default",
|
|
6784
6818
|
disabled = false,
|
|
6785
6819
|
onChange,
|
|
@@ -6787,6 +6821,7 @@ function SelectDateRange({
|
|
|
6787
6821
|
style,
|
|
6788
6822
|
...props
|
|
6789
6823
|
}) {
|
|
6824
|
+
const size = useControlSize(sizeProp);
|
|
6790
6825
|
const initialValue = defaultValue ?? { select: options[0]?.value ?? "", range: ["", ""] };
|
|
6791
6826
|
const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : value && typeof value === "object" ? value : { select: "", range: ["", ""] }, defaultValue: initialValue, onChange });
|
|
6792
6827
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: `sia-select-date-range sia-select-date-range--${size} ${className}`.trim(), role: "group", "aria-label": `${selectAriaLabel}\u4E0E${rangeAriaLabel}`, ...props, style: { ...style, "--sia-select-date-range-select-width": typeof selectWidth === "number" ? `${selectWidth}px` : selectWidth }, children: [
|
|
@@ -6836,7 +6871,7 @@ function seconds(value) {
|
|
|
6836
6871
|
function TimePicker({
|
|
6837
6872
|
value,
|
|
6838
6873
|
defaultValue = "",
|
|
6839
|
-
size
|
|
6874
|
+
size: sizeProp,
|
|
6840
6875
|
status = "default",
|
|
6841
6876
|
allowClear = true,
|
|
6842
6877
|
use12Hours = false,
|
|
@@ -6856,6 +6891,7 @@ function TimePicker({
|
|
|
6856
6891
|
step,
|
|
6857
6892
|
...props
|
|
6858
6893
|
}) {
|
|
6894
|
+
const size = useControlSize(sizeProp);
|
|
6859
6895
|
const id = (0, import_react31.useId)();
|
|
6860
6896
|
const rootRef = (0, import_react31.useRef)(null);
|
|
6861
6897
|
const inputRef = (0, import_react31.useRef)(null);
|
|
@@ -6982,13 +7018,14 @@ function TimePicker({
|
|
|
6982
7018
|
] });
|
|
6983
7019
|
}
|
|
6984
7020
|
function TimeRangePicker({ value, defaultValue = ["", ""], placeholder = ["\u5F00\u59CB\u65F6\u95F4", "\u7ED3\u675F\u65F6\u95F4"], separator = "\u2192", onChange, className = "", style, ...props }) {
|
|
7021
|
+
const size = useControlSize(props.size);
|
|
6985
7022
|
const [currentValue, setValue2] = useControllableState({ value: value === void 0 ? void 0 : Array.isArray(value) ? value : ["", ""], defaultValue, onChange });
|
|
6986
7023
|
function update(index, next) {
|
|
6987
7024
|
const pair = [currentValue[0], currentValue[1]];
|
|
6988
7025
|
pair[index] = next;
|
|
6989
7026
|
setValue2(pair);
|
|
6990
7027
|
}
|
|
6991
|
-
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { style, className: `sia-time-range sia-picker--${
|
|
7028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { style, className: `sia-time-range sia-picker--${size} sia-picker--${props.status ?? "default"}${props.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
6992
7029
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimePicker, { ...props, "aria-label": props["aria-label"] ? props["aria-label"] + "\u5F00\u59CB\u65F6\u95F4" : "\u5F00\u59CB\u65F6\u95F4", value: currentValue[0], placeholder: placeholder[0], max: currentValue[1] && (!props.max || seconds(currentValue[1]) < seconds(String(props.max))) ? currentValue[1] : props.max, onChange: (next) => update(0, next) }),
|
|
6993
7030
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "sia-time-range__separator", children: separator }),
|
|
6994
7031
|
/* @__PURE__ */ (0, import_jsx_runtime33.jsx)(TimePicker, { ...props, id: props.id ? props.id + "-end" : void 0, "aria-label": props["aria-label"] ? props["aria-label"] + "\u7ED3\u675F\u65F6\u95F4" : "\u7ED3\u675F\u65F6\u95F4", value: currentValue[1], placeholder: placeholder[1], min: currentValue[0] && (!props.min || seconds(currentValue[0]) > seconds(String(props.min))) ? currentValue[0] : props.min, onChange: (next) => update(1, next) })
|
|
@@ -7034,7 +7071,7 @@ function TreeSelect({
|
|
|
7034
7071
|
searchPlaceholder = "\u641C\u7D22\u8282\u70B9",
|
|
7035
7072
|
maxTagCount = 3,
|
|
7036
7073
|
disabled = false,
|
|
7037
|
-
size
|
|
7074
|
+
size: sizeProp,
|
|
7038
7075
|
status = "default",
|
|
7039
7076
|
className = "",
|
|
7040
7077
|
onChange,
|
|
@@ -7061,6 +7098,7 @@ function TreeSelect({
|
|
|
7061
7098
|
onDeselect,
|
|
7062
7099
|
...props
|
|
7063
7100
|
}) {
|
|
7101
|
+
const size = useControlSize(sizeProp);
|
|
7064
7102
|
const rootRef = (0, import_react32.useRef)(null);
|
|
7065
7103
|
const popupRef = (0, import_react32.useRef)(null);
|
|
7066
7104
|
const nodeIndex = (0, import_react32.useMemo)(() => {
|
|
@@ -7453,6 +7491,7 @@ var TextArea = (0, import_react34.forwardRef)(function TextArea2({
|
|
|
7453
7491
|
label,
|
|
7454
7492
|
hint,
|
|
7455
7493
|
status = "default",
|
|
7494
|
+
size: sizeProp,
|
|
7456
7495
|
showCount = false,
|
|
7457
7496
|
placeholder,
|
|
7458
7497
|
placeholderMode,
|
|
@@ -7465,6 +7504,7 @@ var TextArea = (0, import_react34.forwardRef)(function TextArea2({
|
|
|
7465
7504
|
onChange,
|
|
7466
7505
|
...props
|
|
7467
7506
|
}, ref) {
|
|
7507
|
+
const size = useControlSize(sizeProp);
|
|
7468
7508
|
const fallbackId = (0, import_react34.useId)();
|
|
7469
7509
|
const textAreaId = id ?? fallbackId;
|
|
7470
7510
|
const [uncontrolledValue, setUncontrolledValue] = (0, import_react34.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
|
|
@@ -7476,7 +7516,7 @@ var TextArea = (0, import_react34.forwardRef)(function TextArea2({
|
|
|
7476
7516
|
setUncontrolledValue(event.target.value);
|
|
7477
7517
|
onChange?.(event);
|
|
7478
7518
|
}
|
|
7479
|
-
const control = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
|
|
7519
|
+
const control = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
|
|
7480
7520
|
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
7481
7521
|
"textarea",
|
|
7482
7522
|
{
|
|
@@ -8067,7 +8107,7 @@ function MarkdownEditor({
|
|
|
8067
8107
|
width: "100%",
|
|
8068
8108
|
height: "100%",
|
|
8069
8109
|
minHeight: typeof minHeight === "number" ? minHeight : void 0,
|
|
8070
|
-
placeholder,
|
|
8110
|
+
placeholder: floating.enabled ? "" : placeholder,
|
|
8071
8111
|
cdn: assetBaseUrl,
|
|
8072
8112
|
cache: { enable: false },
|
|
8073
8113
|
toolbar,
|
|
@@ -8147,7 +8187,7 @@ function MarkdownEditor({
|
|
|
8147
8187
|
if (editorRef.current === createdEditor) editorRef.current = null;
|
|
8148
8188
|
if (editorInitialized) createdEditor?.destroy();
|
|
8149
8189
|
};
|
|
8150
|
-
}, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder]);
|
|
8190
|
+
}, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder, floating.enabled]);
|
|
8151
8191
|
(0, import_react36.useEffect)(() => {
|
|
8152
8192
|
const editor = editorRef.current;
|
|
8153
8193
|
if (!editor || value === void 0) return;
|
|
@@ -9328,7 +9368,7 @@ var InputNumber = (0, import_react39.forwardRef)(function InputNumber2({
|
|
|
9328
9368
|
max,
|
|
9329
9369
|
step = 1,
|
|
9330
9370
|
precision,
|
|
9331
|
-
size
|
|
9371
|
+
size: sizeProp,
|
|
9332
9372
|
status = "default",
|
|
9333
9373
|
prefix,
|
|
9334
9374
|
suffix,
|
|
@@ -9343,6 +9383,7 @@ var InputNumber = (0, import_react39.forwardRef)(function InputNumber2({
|
|
|
9343
9383
|
onKeyDown,
|
|
9344
9384
|
...props
|
|
9345
9385
|
}, forwardedRef) {
|
|
9386
|
+
const size = useControlSize(sizeProp);
|
|
9346
9387
|
const fallbackId = (0, import_react39.useId)();
|
|
9347
9388
|
const inputId = id ?? fallbackId;
|
|
9348
9389
|
const localRef = (0, import_react39.useRef)(null);
|
|
@@ -11549,13 +11590,14 @@ function orderColumnSettings(items) {
|
|
|
11549
11590
|
}
|
|
11550
11591
|
function ColumnSettingPanel({ open, items, columns, loading, loadError, onRetry, onClose, onApply }) {
|
|
11551
11592
|
const [draft, setDraft] = (0, import_react44.useState)(items);
|
|
11552
|
-
const
|
|
11553
|
-
const
|
|
11593
|
+
const listRef = (0, import_react44.useRef)(null);
|
|
11594
|
+
const cancelDrag = (0, import_react44.useRef)(null);
|
|
11595
|
+
const [preview, setPreview] = (0, import_react44.useState)(null);
|
|
11554
11596
|
(0, import_react44.useEffect)(() => {
|
|
11597
|
+
cancelDrag.current?.();
|
|
11555
11598
|
if (open) setDraft(orderColumnSettings(items));
|
|
11556
|
-
drag.current = null;
|
|
11557
|
-
setDraggingKey(null);
|
|
11558
11599
|
}, [items, open]);
|
|
11600
|
+
(0, import_react44.useEffect)(() => () => cancelDrag.current?.(), []);
|
|
11559
11601
|
const labels = new Map(flattenTableColumns(columns).map((column) => [column.key, getColumnLabel(column)]));
|
|
11560
11602
|
const visibleCount = draft.filter((item) => item.visible).length;
|
|
11561
11603
|
function setFixed(key, fixed) {
|
|
@@ -11569,20 +11611,107 @@ function ColumnSettingPanel({ open, items, columns, loading, loadError, onRetry,
|
|
|
11569
11611
|
return orderColumnSettings(next);
|
|
11570
11612
|
});
|
|
11571
11613
|
}
|
|
11572
|
-
function
|
|
11573
|
-
|
|
11574
|
-
|
|
11575
|
-
|
|
11576
|
-
|
|
11577
|
-
|
|
11578
|
-
|
|
11579
|
-
|
|
11580
|
-
|
|
11581
|
-
|
|
11582
|
-
|
|
11583
|
-
|
|
11584
|
-
|
|
11585
|
-
|
|
11614
|
+
function startSort(event, key) {
|
|
11615
|
+
if (loading || loadError || event.button !== 0 || event.target.closest("button, input, label")) return;
|
|
11616
|
+
const list = listRef.current;
|
|
11617
|
+
if (!list) return;
|
|
11618
|
+
cancelDrag.current?.();
|
|
11619
|
+
const original = [...draft];
|
|
11620
|
+
const from = original.findIndex((item) => item.key === key);
|
|
11621
|
+
const elements = Array.from(list.querySelectorAll(".sia-table-settings__item"));
|
|
11622
|
+
const rects = elements.map((element) => element.getBoundingClientRect());
|
|
11623
|
+
const gap = parseFloat(getComputedStyle(list).rowGap) || 0;
|
|
11624
|
+
const positions = original.map((_, index) => index);
|
|
11625
|
+
const startY = event.clientY;
|
|
11626
|
+
let lastY = startY;
|
|
11627
|
+
let moved = false;
|
|
11628
|
+
let next = original;
|
|
11629
|
+
let frame = 0;
|
|
11630
|
+
let scrollParent = list.parentElement;
|
|
11631
|
+
while (scrollParent && !(scrollParent.scrollHeight > scrollParent.clientHeight && /auto|scroll/.test(getComputedStyle(scrollParent).overflowY))) scrollParent = scrollParent.parentElement;
|
|
11632
|
+
const initialScroll = scrollParent?.scrollTop ?? 0;
|
|
11633
|
+
const target = event.currentTarget;
|
|
11634
|
+
target.setPointerCapture(event.pointerId);
|
|
11635
|
+
const previousUserSelect = document.body.style.userSelect;
|
|
11636
|
+
function update() {
|
|
11637
|
+
const dy = lastY - startY + (scrollParent?.scrollTop ?? 0) - initialScroll;
|
|
11638
|
+
if (!moved && Math.abs(dy) < 4) return;
|
|
11639
|
+
moved = true;
|
|
11640
|
+
document.body.style.userSelect = "none";
|
|
11641
|
+
const center = rects[from].top + rects[from].height / 2 + dy;
|
|
11642
|
+
let to = from;
|
|
11643
|
+
for (const index of positions) {
|
|
11644
|
+
if (index > from && center > rects[index].top + rects[index].height / 2) to = index;
|
|
11645
|
+
if (index < from && center < rects[index].top + rects[index].height / 2) {
|
|
11646
|
+
to = index;
|
|
11647
|
+
break;
|
|
11648
|
+
}
|
|
11649
|
+
}
|
|
11650
|
+
next = [...original];
|
|
11651
|
+
const [item] = next.splice(from, 1);
|
|
11652
|
+
next.splice(to, 0, { ...item, fixed: original[to].fixed });
|
|
11653
|
+
const offsets = {};
|
|
11654
|
+
let top = rects[0].top;
|
|
11655
|
+
for (const entry of next) {
|
|
11656
|
+
const index = original.findIndex((item2) => item2.key === entry.key);
|
|
11657
|
+
offsets[entry.key] = entry.key === key ? dy : top - rects[index].top;
|
|
11658
|
+
top += rects[index].height + gap;
|
|
11659
|
+
}
|
|
11660
|
+
setPreview({ key, fixed: original[to].fixed, offsets });
|
|
11661
|
+
}
|
|
11662
|
+
function tick() {
|
|
11663
|
+
if (moved && scrollParent) {
|
|
11664
|
+
const bounds = scrollParent.getBoundingClientRect();
|
|
11665
|
+
const delta = lastY < bounds.top + 40 ? -10 : lastY > bounds.bottom - 40 ? 10 : 0;
|
|
11666
|
+
if (delta) {
|
|
11667
|
+
scrollParent.scrollTop += delta;
|
|
11668
|
+
update();
|
|
11669
|
+
}
|
|
11670
|
+
}
|
|
11671
|
+
frame = requestAnimationFrame(tick);
|
|
11672
|
+
}
|
|
11673
|
+
function move(moveEvent) {
|
|
11674
|
+
if (moveEvent.pointerId !== event.pointerId) return;
|
|
11675
|
+
lastY = moveEvent.clientY;
|
|
11676
|
+
update();
|
|
11677
|
+
}
|
|
11678
|
+
function finish(commit) {
|
|
11679
|
+
document.removeEventListener("pointermove", move);
|
|
11680
|
+
document.removeEventListener("pointerup", up);
|
|
11681
|
+
document.removeEventListener("pointercancel", cancel);
|
|
11682
|
+
document.removeEventListener("keydown", escape, true);
|
|
11683
|
+
window.removeEventListener("blur", cancel);
|
|
11684
|
+
cancelAnimationFrame(frame);
|
|
11685
|
+
if (target.hasPointerCapture(event.pointerId)) target.releasePointerCapture(event.pointerId);
|
|
11686
|
+
document.body.style.userSelect = previousUserSelect;
|
|
11687
|
+
cancelDrag.current = null;
|
|
11688
|
+
setPreview(null);
|
|
11689
|
+
if (commit && moved) setDraft(orderColumnSettings(next));
|
|
11690
|
+
}
|
|
11691
|
+
function up(upEvent) {
|
|
11692
|
+
if (upEvent.pointerId === event.pointerId) {
|
|
11693
|
+
lastY = upEvent.clientY;
|
|
11694
|
+
update();
|
|
11695
|
+
finish(true);
|
|
11696
|
+
}
|
|
11697
|
+
}
|
|
11698
|
+
function cancel() {
|
|
11699
|
+
finish(false);
|
|
11700
|
+
}
|
|
11701
|
+
function escape(event2) {
|
|
11702
|
+
if (event2.key === "Escape") {
|
|
11703
|
+
event2.preventDefault();
|
|
11704
|
+
event2.stopPropagation();
|
|
11705
|
+
cancel();
|
|
11706
|
+
}
|
|
11707
|
+
}
|
|
11708
|
+
cancelDrag.current = cancel;
|
|
11709
|
+
document.addEventListener("pointermove", move);
|
|
11710
|
+
document.addEventListener("pointerup", up);
|
|
11711
|
+
document.addEventListener("pointercancel", cancel);
|
|
11712
|
+
document.addEventListener("keydown", escape, true);
|
|
11713
|
+
window.addEventListener("blur", cancel);
|
|
11714
|
+
frame = requestAnimationFrame(tick);
|
|
11586
11715
|
}
|
|
11587
11716
|
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(Drawer2, { open, title: "\u5217\u8BBE\u7F6E", size: 440, onOpenChange: (next) => {
|
|
11588
11717
|
if (!next) onClose();
|
|
@@ -11606,40 +11735,20 @@ function ColumnSettingPanel({ open, items, columns, loading, loadError, onRetry,
|
|
|
11606
11735
|
"\uFF09"
|
|
11607
11736
|
] })
|
|
11608
11737
|
] }),
|
|
11609
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className:
|
|
11610
|
-
if (drag.current) event.preventDefault();
|
|
11611
|
-
}, onDrop: (event) => {
|
|
11612
|
-
event.preventDefault();
|
|
11613
|
-
if (drag.current) drag.current.dropped = true;
|
|
11614
|
-
}, children: draft.map((item) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
11738
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { ref: listRef, className: `sia-table-settings__list${preview ? " is-sorting" : ""}`, children: draft.map((item) => /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
|
|
11615
11739
|
"div",
|
|
11616
11740
|
{
|
|
11617
11741
|
"data-column-key": item.key,
|
|
11618
|
-
className: `sia-table-settings__item${
|
|
11619
|
-
|
|
11620
|
-
|
|
11621
|
-
drag.current = { key: item.key, original: draft, dropped: false };
|
|
11622
|
-
event.dataTransfer.effectAllowed = "move";
|
|
11623
|
-
event.dataTransfer.setData("text/plain", item.key);
|
|
11624
|
-
setDraggingKey(item.key);
|
|
11625
|
-
},
|
|
11626
|
-
onDragOver: (event) => {
|
|
11627
|
-
event.preventDefault();
|
|
11628
|
-
event.dataTransfer.dropEffect = "move";
|
|
11629
|
-
previewMove(item.key, event.clientY, event.currentTarget);
|
|
11630
|
-
},
|
|
11631
|
-
onDragEnd: () => {
|
|
11632
|
-
if (drag.current && !drag.current.dropped) setDraft(drag.current.original);
|
|
11633
|
-
drag.current = null;
|
|
11634
|
-
setDraggingKey(null);
|
|
11635
|
-
},
|
|
11742
|
+
className: `sia-table-settings__item${preview?.key === item.key ? " is-dragging" : ""}`,
|
|
11743
|
+
style: preview ? { transform: `translateY(${preview.offsets[item.key] ?? 0}px)` } : void 0,
|
|
11744
|
+
onPointerDown: (event) => startSort(event, item.key),
|
|
11636
11745
|
children: [
|
|
11637
11746
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "menu", size: 15 }),
|
|
11638
11747
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(TableCheckbox, { label: `\u663E\u793A${labels.get(item.key) ?? item.key}\u5217`, checked: item.visible, onChange: (checked) => setDraft((previous) => previous.map((entry) => entry.key === item.key ? { ...entry, visible: checked } : entry)) }),
|
|
11639
11748
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)("span", { className: "sia-table-settings__name", title: labels.get(item.key) ?? item.key, children: labels.get(item.key) ?? item.key }),
|
|
11640
11749
|
/* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "sia-table-settings__actions", children: [
|
|
11641
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { size: "small", variant: item.fixed === "left" ? "primary" : "text", "aria-label": "\u5DE6\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "left" ? void 0 : "left"), children: "\u5DE6" }),
|
|
11642
|
-
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { size: "small", variant: item.fixed === "right" ? "primary" : "text", "aria-label": "\u53F3\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "right" ? void 0 : "right"), children: "\u53F3" })
|
|
11750
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { size: "small", variant: (preview?.key === item.key ? preview.fixed : item.fixed) === "left" ? "primary" : "text", "aria-label": "\u5DE6\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "left" ? void 0 : "left"), children: "\u5DE6" }),
|
|
11751
|
+
/* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Button, { size: "small", variant: (preview?.key === item.key ? preview.fixed : item.fixed) === "right" ? "primary" : "text", "aria-label": "\u53F3\u56FA\u5B9A", onClick: () => setFixed(item.key, item.fixed === "right" ? void 0 : "right"), children: "\u53F3" })
|
|
11643
11752
|
] })
|
|
11644
11753
|
]
|
|
11645
11754
|
},
|
|
@@ -20594,7 +20703,7 @@ var InputSelect = (0, import_react86.forwardRef)(function InputSelect2({
|
|
|
20594
20703
|
showValue = false,
|
|
20595
20704
|
placeholder = "\u8BF7\u9009\u62E9",
|
|
20596
20705
|
placeholderMode,
|
|
20597
|
-
size
|
|
20706
|
+
size: sizeProp,
|
|
20598
20707
|
status,
|
|
20599
20708
|
disabled = false,
|
|
20600
20709
|
loading = false,
|
|
@@ -20609,6 +20718,7 @@ var InputSelect = (0, import_react86.forwardRef)(function InputSelect2({
|
|
|
20609
20718
|
onOpenChange,
|
|
20610
20719
|
...inputProps
|
|
20611
20720
|
}, forwardedRef) {
|
|
20721
|
+
const size = useControlSize(sizeProp);
|
|
20612
20722
|
const [internal, setInternal] = (0, import_react86.useState)(defaultValue);
|
|
20613
20723
|
const current = value !== void 0 ? value : internal;
|
|
20614
20724
|
const values = current == null ? [] : Array.isArray(current) ? current : [current];
|