@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.
Files changed (35) hide show
  1. package/dist/chart.cjs +21 -13
  2. package/dist/chart.js +4 -4
  3. package/dist/{chunk-RLTG3IK7.js → chunk-25BU7YTB.js} +21 -11
  4. package/dist/{chunk-EJDPRAU2.js → chunk-3VJ4CZDQ.js} +7 -0
  5. package/dist/{chunk-JJVD2ITI.js → chunk-ALWHRV4L.js} +7 -4
  6. package/dist/{chunk-MOOMDRAN.js → chunk-K3XRTEIO.js} +9 -7
  7. package/dist/{chunk-F3VH6LJH.js → chunk-MUTJVDM6.js} +3 -3
  8. package/dist/{chunk-Z3T6RDQP.js → chunk-OKP4DIQH.js} +2 -2
  9. package/dist/{chunk-5ZTWY3PG.js → chunk-QJ4OQNQ4.js} +3 -3
  10. package/dist/{chunk-BUMS62NO.js → chunk-R3TYVU53.js} +14 -8
  11. package/dist/{chunk-MBS2HXLZ.js → chunk-TZGUBGA4.js} +6 -1
  12. package/dist/{chunk-WHARTF2I.js → chunk-YT6E3X2K.js} +5 -2
  13. package/dist/{core-y0w5PBO2.d.cts → core-BK8AXc12.d.cts} +3 -2
  14. package/dist/{core-VmiEI1Jp.d.ts → core-CJK3_KTQ.d.ts} +3 -2
  15. package/dist/core.cjs +54 -40
  16. package/dist/core.css +328 -40
  17. package/dist/core.d.cts +1 -1
  18. package/dist/core.d.ts +1 -1
  19. package/dist/core.js +6 -6
  20. package/dist/index.cjs +221 -111
  21. package/dist/index.css +328 -40
  22. package/dist/index.d.cts +24 -14
  23. package/dist/index.d.ts +24 -14
  24. package/dist/index.js +164 -76
  25. package/dist/markdown-editor.cjs +3 -2
  26. package/dist/markdown-editor.js +2 -2
  27. package/dist/rich-text-editor.cjs +9 -2
  28. package/dist/rich-text-editor.js +4 -4
  29. package/dist/{select-date-range-D-JMfpwD.d.ts → select-date-range-Bdb-hi9c.d.ts} +3 -3
  30. package/dist/{select-date-range-l-xgB959.d.cts → select-date-range-shDQ5uJA.d.cts} +3 -3
  31. package/dist/select-date-range.cjs +35 -15
  32. package/dist/select-date-range.d.cts +1 -1
  33. package/dist/select-date-range.d.ts +1 -1
  34. package/dist/select-date-range.js +5 -5
  35. package/package.json +1 -1
package/dist/chart.cjs CHANGED
@@ -3952,12 +3952,25 @@ function layoutTreeNodes(root, options = {}) {
3952
3952
  // src/components/ChartDataEditor.tsx
3953
3953
  var import_react31 = require("react");
3954
3954
 
3955
- // src/components/Button.tsx
3955
+ // src/components/shared.ts
3956
3956
  var import_react28 = require("react");
3957
+ var ControlSizeContext = (0, import_react28.createContext)("medium");
3958
+ function useControlSize(size) {
3959
+ const inherited = (0, import_react28.useContext)(ControlSizeContext);
3960
+ return size ?? inherited;
3961
+ }
3962
+ var PlaceholderModeContext = (0, import_react28.createContext)("default");
3963
+ function usePlaceholderMode(mode) {
3964
+ const inherited = (0, import_react28.useContext)(PlaceholderModeContext);
3965
+ return mode ?? inherited;
3966
+ }
3967
+
3968
+ // src/components/Button.tsx
3969
+ var import_react29 = require("react");
3957
3970
  var import_jsx_runtime28 = require("react/jsx-runtime");
3958
- var Button = (0, import_react28.forwardRef)(function Button2({
3971
+ var Button = (0, import_react29.forwardRef)(function Button2({
3959
3972
  variant = "default",
3960
- size = "medium",
3973
+ size: sizeProp,
3961
3974
  loading = false,
3962
3975
  block = false,
3963
3976
  danger = false,
@@ -3970,7 +3983,8 @@ var Button = (0, import_react28.forwardRef)(function Button2({
3970
3983
  style,
3971
3984
  ...props
3972
3985
  }, forwardedRef) {
3973
- const localRef = (0, import_react28.useRef)(null);
3986
+ const size = useControlSize(sizeProp);
3987
+ const localRef = (0, import_react29.useRef)(null);
3974
3988
  function setRef(node) {
3975
3989
  localRef.current = node;
3976
3990
  if (typeof forwardedRef === "function") forwardedRef(node);
@@ -4008,14 +4022,6 @@ var Button = (0, import_react28.forwardRef)(function Button2({
4008
4022
  );
4009
4023
  });
4010
4024
 
4011
- // src/components/shared.ts
4012
- var import_react29 = require("react");
4013
- var PlaceholderModeContext = (0, import_react29.createContext)("default");
4014
- function usePlaceholderMode(mode) {
4015
- const inherited = (0, import_react29.useContext)(PlaceholderModeContext);
4016
- return mode ?? inherited;
4017
- }
4018
-
4019
4025
  // src/components/FloatingPlaceholder.tsx
4020
4026
  var import_jsx_runtime29 = require("react/jsx-runtime");
4021
4027
  function useFloatingPlaceholder({ mode, placeholder, filled, active = false }) {
@@ -4034,6 +4040,7 @@ var TextArea = (0, import_react30.forwardRef)(function TextArea2({
4034
4040
  label,
4035
4041
  hint,
4036
4042
  status = "default",
4043
+ size: sizeProp,
4037
4044
  showCount = false,
4038
4045
  placeholder,
4039
4046
  placeholderMode,
@@ -4046,6 +4053,7 @@ var TextArea = (0, import_react30.forwardRef)(function TextArea2({
4046
4053
  onChange,
4047
4054
  ...props
4048
4055
  }, ref) {
4056
+ const size = useControlSize(sizeProp);
4049
4057
  const fallbackId = (0, import_react30.useId)();
4050
4058
  const textAreaId = id ?? fallbackId;
4051
4059
  const [uncontrolledValue, setUncontrolledValue] = (0, import_react30.useState)(() => defaultValue === void 0 ? "" : String(defaultValue));
@@ -4057,7 +4065,7 @@ var TextArea = (0, import_react30.forwardRef)(function TextArea2({
4057
4065
  setUncontrolledValue(event.target.value);
4058
4066
  onChange?.(event);
4059
4067
  }
4060
- const control = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
4068
+ const control = /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
4061
4069
  /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4062
4070
  "textarea",
4063
4071
  {
package/dist/chart.js CHANGED
@@ -56,10 +56,10 @@ import {
56
56
  smoothSvgPath,
57
57
  svgArcPath,
58
58
  transferCompositeValue
59
- } from "./chunk-Z3T6RDQP.js";
60
- import "./chunk-WHARTF2I.js";
61
- import "./chunk-MBS2HXLZ.js";
62
- import "./chunk-EJDPRAU2.js";
59
+ } from "./chunk-OKP4DIQH.js";
60
+ import "./chunk-YT6E3X2K.js";
61
+ import "./chunk-TZGUBGA4.js";
62
+ import "./chunk-3VJ4CZDQ.js";
63
63
  export {
64
64
  BarChart,
65
65
  CHART_VIEWBOX_HEIGHT,
@@ -1,14 +1,15 @@
1
1
  import {
2
2
  Select
3
- } from "./chunk-BUMS62NO.js";
3
+ } from "./chunk-R3TYVU53.js";
4
4
  import {
5
5
  Icon,
6
6
  PopupPortal
7
- } from "./chunk-JJVD2ITI.js";
7
+ } from "./chunk-ALWHRV4L.js";
8
8
  import {
9
+ useControlSize,
9
10
  useControllableState,
10
11
  useFloatingPlaceholder
11
- } from "./chunk-EJDPRAU2.js";
12
+ } from "./chunk-3VJ4CZDQ.js";
12
13
 
13
14
  // src/components/DatePicker.tsx
14
15
  import { useEffect, useId, useMemo, useRef as useRef2, useState } from "react";
@@ -274,7 +275,7 @@ function DatePicker({
274
275
  value,
275
276
  defaultValue,
276
277
  picker = "date",
277
- size = "medium",
278
+ size: sizeProp,
278
279
  status = "default",
279
280
  allowClear = true,
280
281
  multiple = false,
@@ -298,6 +299,7 @@ function DatePicker({
298
299
  renderExtraFooter,
299
300
  ...props
300
301
  }) {
302
+ const size = useControlSize(sizeProp);
301
303
  const id = useId();
302
304
  const rootRef = useRef2(null);
303
305
  const popupRef = useRef2(null);
@@ -458,7 +460,7 @@ function DateRangePicker({
458
460
  maxRangeDays,
459
461
  allowEmpty = [false, false],
460
462
  endpointDisabled = [false, false],
461
- size = "medium",
463
+ size: sizeProp,
462
464
  status = "default",
463
465
  allowClear = true,
464
466
  needConfirm,
@@ -479,6 +481,7 @@ function DateRangePicker({
479
481
  renderExtraFooter,
480
482
  ...props
481
483
  }) {
484
+ const size = useControlSize(sizeProp);
482
485
  const id = useId();
483
486
  const rootRef = useRef2(null);
484
487
  const popupRef = useRef2(null);
@@ -719,8 +722,9 @@ function DateRangePicker({
719
722
  endpointLabel
720
723
  );
721
724
  }
722
- const floating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder.filter(Boolean).join(" / "), filled: currentValue.some(Boolean), active: visible });
723
- return /* @__PURE__ */ jsxs2("span", { ref: rootRef, className: `sia-picker${floating.className} sia-picker-range-control sia-picker--${size} sia-picker--${status}${visible ? " is-open" : ""}${disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
725
+ const startFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[0], filled: Boolean(currentValue[0]), active: visible });
726
+ const endFloating = useFloatingPlaceholder({ mode: placeholderMode, placeholder: placeholder[1], filled: Boolean(currentValue[1]), active: visible });
727
+ return /* @__PURE__ */ jsxs2("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: [
724
728
  /* @__PURE__ */ jsxs2(
725
729
  "button",
726
730
  {
@@ -737,14 +741,19 @@ function DateRangePicker({
737
741
  disabled,
738
742
  onClick: () => changeOpen(!visible),
739
743
  children: [
740
- /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] ? formatValue(currentValue[0]) : placeholder[0] }),
744
+ /* @__PURE__ */ jsxs2("span", { className: `sia-picker-range-control__field${startFloating.className}`, children: [
745
+ /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${currentValue[0] ? "" : " is-placeholder"}`, children: currentValue[0] ? formatValue(currentValue[0]) : placeholder[0] }),
746
+ startFloating.label
747
+ ] }),
741
748
  /* @__PURE__ */ jsx2("span", { className: "sia-picker-range-control__separator", children: separator }),
742
- /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] ? formatValue(currentValue[1]) : placeholder[1] }),
749
+ /* @__PURE__ */ jsxs2("span", { className: `sia-picker-range-control__field${endFloating.className}`, children: [
750
+ /* @__PURE__ */ jsx2("span", { className: `sia-picker-range-control__value${currentValue[1] ? "" : " is-placeholder"}`, children: currentValue[1] ? formatValue(currentValue[1]) : placeholder[1] }),
751
+ endFloating.label
752
+ ] }),
743
753
  /* @__PURE__ */ jsx2("span", { className: "sia-picker__icon", "aria-hidden": "true", children: suffixIcon ?? /* @__PURE__ */ jsx2(Icon, { name: "calendar", size: 16 }) })
744
754
  ]
745
755
  }
746
756
  ),
747
- floating.label,
748
757
  allowClear && (currentValue[0] || currentValue[1]) && !disabled ? /* @__PURE__ */ jsx2("button", { type: "button", className: "sia-picker__clear", "aria-label": "\u6E05\u9664\u65E5\u671F\u8303\u56F4", onClick: clearValue, children: /* @__PURE__ */ jsx2(Icon, { name: "circle-close", variant: "filled", size: 15 }) }) : null,
749
758
  /* @__PURE__ */ jsxs2(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: [
750
759
  /* @__PURE__ */ jsx2("div", { className: "sia-date-panel__body", children: showTime ? /* @__PURE__ */ jsx2("div", { className: "sia-date-panel__range-date-time", children: compactDateTime ? renderDateTimeGroup(activeIndex) : /* @__PURE__ */ jsxs2(Fragment, { children: [
@@ -820,7 +829,7 @@ function SelectDateRange({
820
829
  selectAriaLabel = "\u9009\u62E9\u7C7B\u578B",
821
830
  rangeAriaLabel = "\u65E5\u671F\u8303\u56F4",
822
831
  presets,
823
- size = "medium",
832
+ size: sizeProp,
824
833
  status = "default",
825
834
  disabled = false,
826
835
  onChange,
@@ -828,6 +837,7 @@ function SelectDateRange({
828
837
  style,
829
838
  ...props
830
839
  }) {
840
+ const size = useControlSize(sizeProp);
831
841
  const initialValue = defaultValue ?? { select: options[0]?.value ?? "", range: ["", ""] };
832
842
  const [currentValue, setCurrentValue] = useControllableState({ value: value === void 0 ? void 0 : value && typeof value === "object" ? value : { select: "", range: ["", ""] }, defaultValue: initialValue, onChange });
833
843
  return /* @__PURE__ */ jsxs3("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: [
@@ -1,5 +1,10 @@
1
1
  // src/components/shared.ts
2
2
  import { createContext, useCallback, useContext, useState } from "react";
3
+ var ControlSizeContext = createContext("medium");
4
+ function useControlSize(size) {
5
+ const inherited = useContext(ControlSizeContext);
6
+ return size ?? inherited;
7
+ }
3
8
  var PlaceholderModeContext = createContext("default");
4
9
  function usePlaceholderMode(mode) {
5
10
  const inherited = useContext(PlaceholderModeContext);
@@ -29,6 +34,8 @@ function useFloatingPlaceholder({ mode, placeholder, filled, active = false }) {
29
34
  }
30
35
 
31
36
  export {
37
+ ControlSizeContext,
38
+ useControlSize,
32
39
  PlaceholderModeContext,
33
40
  usePlaceholderMode,
34
41
  useControllableState,
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  Button
3
- } from "./chunk-MBS2HXLZ.js";
3
+ } from "./chunk-TZGUBGA4.js";
4
4
  import {
5
+ useControlSize,
5
6
  useControllableState,
6
7
  usePlaceholderMode
7
- } from "./chunk-EJDPRAU2.js";
8
+ } from "./chunk-3VJ4CZDQ.js";
8
9
 
9
10
  // src/components/Icon.tsx
10
11
  import { forwardRef } from "react";
@@ -1134,7 +1135,8 @@ function Steps({ items, current = 0, initial = 0, direction = "horizontal", type
1134
1135
  ] }, index);
1135
1136
  }) });
1136
1137
  }
1137
- function Segmented({ options, value, defaultValue, size = "medium", block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1138
+ function Segmented({ options, value, defaultValue, size: sizeProp, block = false, vertical = false, disabled = false, onChange, className = "", onKeyDown, ...props }) {
1139
+ const size = useControlSize(sizeProp);
1138
1140
  const normalized = useMemo(() => options.map((option) => typeof option === "object" ? option : { label: option, value: option }), [options]);
1139
1141
  const [current, setCurrent] = useControllableState({ value, defaultValue: defaultValue ?? normalized[0]?.value, onChange: (next) => next !== void 0 && onChange?.(next) });
1140
1142
  function keyboard(event) {
@@ -1412,7 +1414,7 @@ var Input = forwardRef3(function Input2({
1412
1414
  label,
1413
1415
  hint,
1414
1416
  status = "default",
1415
- size = "medium",
1417
+ size: sizeProp,
1416
1418
  prefix,
1417
1419
  suffix,
1418
1420
  allowClear = false,
@@ -1429,6 +1431,7 @@ var Input = forwardRef3(function Input2({
1429
1431
  onChange,
1430
1432
  ...props
1431
1433
  }, forwardedRef) {
1434
+ const size = useControlSize(sizeProp);
1432
1435
  const fallbackId = useId2();
1433
1436
  const inputId = id ?? fallbackId;
1434
1437
  const localRef = useRef4(null);
@@ -1,21 +1,22 @@
1
1
  import {
2
2
  TextArea
3
- } from "./chunk-WHARTF2I.js";
3
+ } from "./chunk-YT6E3X2K.js";
4
4
  import {
5
5
  Popover,
6
6
  Tooltip,
7
7
  useOverlayLifecycle
8
- } from "./chunk-BUMS62NO.js";
8
+ } from "./chunk-R3TYVU53.js";
9
9
  import {
10
10
  Dropdown,
11
11
  Icon
12
- } from "./chunk-JJVD2ITI.js";
12
+ } from "./chunk-ALWHRV4L.js";
13
13
  import {
14
14
  Button
15
- } from "./chunk-MBS2HXLZ.js";
15
+ } from "./chunk-TZGUBGA4.js";
16
16
  import {
17
+ useControlSize,
17
18
  useControllableState
18
- } from "./chunk-EJDPRAU2.js";
19
+ } from "./chunk-3VJ4CZDQ.js";
19
20
 
20
21
  // src/components/Card.tsx
21
22
  import { useState } from "react";
@@ -580,14 +581,15 @@ function Tour({ open = false, steps, current, defaultCurrent = 0, mask = true, c
580
581
  import { Children, useEffect as useEffect2, useMemo as useMemo3, useRef as useRef3, useState as useState4 } from "react";
581
582
  import { createPortal as createPortal2 } from "react-dom";
582
583
  import { Fragment as Fragment3, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
583
- function Rate({ value, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
584
+ function Rate({ value, size: sizeProp, defaultValue = 0, count = 5, allowHalf = false, allowClear = true, disabled = false, character, tooltips, onChange, onHoverChange, className = "", ...props }) {
585
+ const size = useControlSize(sizeProp);
584
586
  const [current, setCurrent] = useControllableState({ value, defaultValue, onChange });
585
587
  const [hover, setHover] = useState4(0);
586
588
  const shown = hover || current;
587
589
  function choose(next) {
588
590
  setCurrent(allowClear && next === current ? 0 : next);
589
591
  }
590
- return /* @__PURE__ */ jsx5("div", { className: `sia-rate${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", "aria-label": "\u8BC4\u5206", onMouseLeave: () => {
592
+ return /* @__PURE__ */ jsx5("div", { className: `sia-rate sia-rate--${size}${disabled ? " is-disabled" : ""} ${className}`.trim(), role: "radiogroup", "aria-label": "\u8BC4\u5206", onMouseLeave: () => {
591
593
  setHover(0);
592
594
  onHoverChange?.(0);
593
595
  }, ...props, children: Array.from({ length: count }, (_, index) => {
@@ -2,13 +2,13 @@ import {
2
2
  Dropdown,
3
3
  Icon,
4
4
  Input
5
- } from "./chunk-JJVD2ITI.js";
5
+ } from "./chunk-ALWHRV4L.js";
6
6
  import {
7
7
  Button
8
- } from "./chunk-MBS2HXLZ.js";
8
+ } from "./chunk-TZGUBGA4.js";
9
9
  import {
10
10
  useFloatingPlaceholder
11
- } from "./chunk-EJDPRAU2.js";
11
+ } from "./chunk-3VJ4CZDQ.js";
12
12
 
13
13
  // src/components/RichTextEditor.tsx
14
14
  import { useEffect, useMemo, useRef, useState } from "react";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  TextArea
3
- } from "./chunk-WHARTF2I.js";
3
+ } from "./chunk-YT6E3X2K.js";
4
4
  import {
5
5
  Button
6
- } from "./chunk-MBS2HXLZ.js";
6
+ } from "./chunk-TZGUBGA4.js";
7
7
 
8
8
  // src/components/ChartWhirlingLoading.tsx
9
9
  import { useEffect, useState } from "react";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFloatingPlaceholder
3
- } from "./chunk-EJDPRAU2.js";
3
+ } from "./chunk-3VJ4CZDQ.js";
4
4
 
5
5
  // src/components/MarkdownEditor.tsx
6
6
  import { useEffect, useRef, useState } from "react";
@@ -274,7 +274,7 @@ function MarkdownEditor({
274
274
  width: "100%",
275
275
  height: "100%",
276
276
  minHeight: typeof minHeight === "number" ? minHeight : void 0,
277
- placeholder,
277
+ placeholder: floating.enabled ? "" : placeholder,
278
278
  cdn: assetBaseUrl,
279
279
  cache: { enable: false },
280
280
  toolbar,
@@ -354,7 +354,7 @@ function MarkdownEditor({
354
354
  if (editorRef.current === createdEditor) editorRef.current = null;
355
355
  if (editorInitialized) createdEditor?.destroy();
356
356
  };
357
- }, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder]);
357
+ }, [ariaLabel, assetBaseUrl, hasImageUpload, minHeight, mode, placeholder, floating.enabled]);
358
358
  useEffect(() => {
359
359
  const editor = editorRef.current;
360
360
  if (!editor || value === void 0) return;
@@ -3,20 +3,23 @@ import {
3
3
  Icon,
4
4
  Input,
5
5
  PopupPortal
6
- } from "./chunk-JJVD2ITI.js";
6
+ } from "./chunk-ALWHRV4L.js";
7
7
  import {
8
8
  Button
9
- } from "./chunk-MBS2HXLZ.js";
9
+ } from "./chunk-TZGUBGA4.js";
10
10
  import {
11
+ ControlSizeContext,
12
+ useControlSize,
11
13
  useControllableState,
12
14
  useFloatingPlaceholder
13
- } from "./chunk-EJDPRAU2.js";
15
+ } from "./chunk-3VJ4CZDQ.js";
14
16
 
15
17
  // src/components/Checkbox.tsx
16
18
  import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
17
19
  import { jsx, jsxs } from "react/jsx-runtime";
18
20
  var CheckboxGroupContext = createContext(null);
19
- var CheckboxRoot = forwardRef(function Checkbox({ value, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
21
+ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
22
+ const size = useControlSize(sizeProp);
20
23
  const group = useContext(CheckboxGroupContext);
21
24
  const localRef = useRef(null);
22
25
  const fallbackId = useId();
@@ -30,7 +33,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, indeterminate = false,
30
33
  if (typeof forwardedRef === "function") forwardedRef(node);
31
34
  else if (forwardedRef) forwardedRef.current = node;
32
35
  }
33
- return /* @__PURE__ */ jsxs("label", { className: `sia-checkbox${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
36
+ return /* @__PURE__ */ jsxs("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
34
37
  /* @__PURE__ */ jsx(
35
38
  "input",
36
39
  {
@@ -55,6 +58,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, indeterminate = false,
55
58
  ] });
56
59
  });
57
60
  function CheckboxGroup({
61
+ size: sizeProp,
58
62
  value,
59
63
  defaultValue = [],
60
64
  options,
@@ -64,6 +68,7 @@ function CheckboxGroup({
64
68
  children,
65
69
  onChange
66
70
  }) {
71
+ const size = useControlSize(sizeProp);
67
72
  const [values, setValues] = useControllableState({ value, defaultValue, onChange });
68
73
  const context = useMemo(() => ({
69
74
  values,
@@ -74,13 +79,13 @@ function CheckboxGroup({
74
79
  setValues(next);
75
80
  }
76
81
  }), [disabled, name, setValues, values]);
77
- return /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsxs("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
82
+ return /* @__PURE__ */ jsx(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsxs("div", { className: `sia-checkbox-group ${className}`.trim(), role: "group", children: [
78
83
  options?.map((option) => {
79
84
  const normalized = typeof option === "object" ? option : { label: String(option), value: option };
80
85
  return /* @__PURE__ */ jsx(CheckboxRoot, { value: normalized.value, disabled: normalized.disabled, children: normalized.label }, normalized.value);
81
86
  }),
82
87
  children
83
- ] }) });
88
+ ] }) }) });
84
89
  }
85
90
  var Checkbox2 = Object.assign(CheckboxRoot, { Group: CheckboxGroup });
86
91
 
@@ -1072,7 +1077,7 @@ var Select = forwardRef3(function Select2({
1072
1077
  onChange,
1073
1078
  placeholder = "\u8BF7\u9009\u62E9",
1074
1079
  placeholderMode,
1075
- size = "medium",
1080
+ size: sizeProp,
1076
1081
  status = "default",
1077
1082
  allowClear = false,
1078
1083
  loading = false,
@@ -1098,6 +1103,7 @@ var Select = forwardRef3(function Select2({
1098
1103
  onKeyDown,
1099
1104
  ...props
1100
1105
  }, forwardedRef) {
1106
+ const size = useControlSize(sizeProp);
1101
1107
  const fallbackId = useId5();
1102
1108
  const selectId = id ?? fallbackId;
1103
1109
  const listboxId = `${selectId}-listbox`;
@@ -1,9 +1,13 @@
1
+ import {
2
+ useControlSize
3
+ } from "./chunk-3VJ4CZDQ.js";
4
+
1
5
  // src/components/Button.tsx
2
6
  import { forwardRef, useRef } from "react";
3
7
  import { jsx, jsxs } from "react/jsx-runtime";
4
8
  var Button = forwardRef(function Button2({
5
9
  variant = "default",
6
- size = "medium",
10
+ size: sizeProp,
7
11
  loading = false,
8
12
  block = false,
9
13
  danger = false,
@@ -16,6 +20,7 @@ var Button = forwardRef(function Button2({
16
20
  style,
17
21
  ...props
18
22
  }, forwardedRef) {
23
+ const size = useControlSize(sizeProp);
19
24
  const localRef = useRef(null);
20
25
  function setRef(node) {
21
26
  localRef.current = node;
@@ -1,6 +1,7 @@
1
1
  import {
2
+ useControlSize,
2
3
  useFloatingPlaceholder
3
- } from "./chunk-EJDPRAU2.js";
4
+ } from "./chunk-3VJ4CZDQ.js";
4
5
 
5
6
  // src/components/TextArea.tsx
6
7
  import { forwardRef, useId, useState } from "react";
@@ -9,6 +10,7 @@ var TextArea = forwardRef(function TextArea2({
9
10
  label,
10
11
  hint,
11
12
  status = "default",
13
+ size: sizeProp,
12
14
  showCount = false,
13
15
  placeholder,
14
16
  placeholderMode,
@@ -21,6 +23,7 @@ var TextArea = forwardRef(function TextArea2({
21
23
  onChange,
22
24
  ...props
23
25
  }, ref) {
26
+ const size = useControlSize(sizeProp);
24
27
  const fallbackId = useId();
25
28
  const textAreaId = id ?? fallbackId;
26
29
  const [uncontrolledValue, setUncontrolledValue] = useState(() => defaultValue === void 0 ? "" : String(defaultValue));
@@ -32,7 +35,7 @@ var TextArea = forwardRef(function TextArea2({
32
35
  setUncontrolledValue(event.target.value);
33
36
  onChange?.(event);
34
37
  }
35
- const control = /* @__PURE__ */ jsxs("span", { className: `sia-textarea-control sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
38
+ const control = /* @__PURE__ */ jsxs("span", { className: `sia-textarea-control sia-textarea-control--${size} sia-textarea-control--${status}${floating.className}${disabled ? " is-disabled" : ""}`, children: [
36
39
  /* @__PURE__ */ jsx(
37
40
  "textarea",
38
41
  {
@@ -391,7 +391,7 @@ interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultVa
391
391
  disabled?: boolean;
392
392
  onChange?: (value: SegmentedValue) => void;
393
393
  }
394
- declare function Segmented({ options, value, defaultValue, size, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
394
+ declare function Segmented({ options, value, defaultValue, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
395
395
 
396
396
  interface TabItem {
397
397
  key: string;
@@ -714,6 +714,7 @@ interface TourProps {
714
714
  declare function Tour({ open, steps, current, defaultCurrent, mask, closable, disabledInteraction, onChange, onClose, onFinish }: TourProps): react.ReactPortal | null;
715
715
 
716
716
  interface RateProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
717
+ size?: ControlSize;
717
718
  value?: number;
718
719
  defaultValue?: number;
719
720
  count?: number;
@@ -725,7 +726,7 @@ interface RateProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"
725
726
  onChange?: (value: number) => void;
726
727
  onHoverChange?: (value: number) => void;
727
728
  }
728
- declare function Rate({ value, defaultValue, count, allowHalf, allowClear, disabled, character, tooltips, onChange, onHoverChange, className, ...props }: RateProps): react.JSX.Element;
729
+ declare function Rate({ value, size: sizeProp, defaultValue, count, allowHalf, allowClear, disabled, character, tooltips, onChange, onHoverChange, className, ...props }: RateProps): react.JSX.Element;
729
730
  type BadgeStatus = "success" | "processing" | "default" | "error" | "warning";
730
731
  interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
731
732
  count?: ReactNode;
@@ -391,7 +391,7 @@ interface SegmentedProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultVa
391
391
  disabled?: boolean;
392
392
  onChange?: (value: SegmentedValue) => void;
393
393
  }
394
- declare function Segmented({ options, value, defaultValue, size, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
394
+ declare function Segmented({ options, value, defaultValue, size: sizeProp, block, vertical, disabled, onChange, className, onKeyDown, ...props }: SegmentedProps): react.JSX.Element;
395
395
 
396
396
  interface TabItem {
397
397
  key: string;
@@ -714,6 +714,7 @@ interface TourProps {
714
714
  declare function Tour({ open, steps, current, defaultCurrent, mask, closable, disabledInteraction, onChange, onClose, onFinish }: TourProps): react.ReactPortal | null;
715
715
 
716
716
  interface RateProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> {
717
+ size?: ControlSize;
717
718
  value?: number;
718
719
  defaultValue?: number;
719
720
  count?: number;
@@ -725,7 +726,7 @@ interface RateProps extends Omit<HTMLAttributes<HTMLDivElement>, "defaultValue"
725
726
  onChange?: (value: number) => void;
726
727
  onHoverChange?: (value: number) => void;
727
728
  }
728
- declare function Rate({ value, defaultValue, count, allowHalf, allowClear, disabled, character, tooltips, onChange, onHoverChange, className, ...props }: RateProps): react.JSX.Element;
729
+ declare function Rate({ value, size: sizeProp, defaultValue, count, allowHalf, allowClear, disabled, character, tooltips, onChange, onHoverChange, className, ...props }: RateProps): react.JSX.Element;
729
730
  type BadgeStatus = "success" | "processing" | "default" | "error" | "warning";
730
731
  interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
731
732
  count?: ReactNode;