@sia.soul/sia-react-ui 0.1.141 → 0.1.142
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/{chunk-DIRPOUVX.js → chunk-3KYG7IU7.js} +1 -1
- package/dist/{chunk-436QH6XH.js → chunk-PGP4TEPP.js} +6 -3
- package/dist/{chunk-L2S7IPSM.js → chunk-TUGCP3GB.js} +1 -1
- package/dist/core.cjs +6 -3
- package/dist/core.css +3 -0
- package/dist/core.js +2 -2
- package/dist/index.cjs +6 -3
- package/dist/index.css +3 -0
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +3 -3
- package/dist/select-date-range.cjs +6 -3
- package/dist/select-date-range.js +2 -2
- package/package.json +1 -1
|
@@ -28,9 +28,10 @@ import {
|
|
|
28
28
|
import { createContext, forwardRef, useContext, useEffect, useId, useMemo, useRef } from "react";
|
|
29
29
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
30
|
var CheckboxGroupContext = createContext(null);
|
|
31
|
-
var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
31
|
+
var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
32
32
|
const size = useControlSize(sizeProp);
|
|
33
33
|
const group = useContext(CheckboxGroupContext);
|
|
34
|
+
const shape = shapeProp ?? group?.shape ?? "square";
|
|
34
35
|
const localRef = useRef(null);
|
|
35
36
|
const fallbackId = useId();
|
|
36
37
|
const grouped = group !== null && value !== void 0;
|
|
@@ -43,7 +44,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, indeter
|
|
|
43
44
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
44
45
|
else if (forwardedRef) forwardedRef.current = node;
|
|
45
46
|
}
|
|
46
|
-
return /* @__PURE__ */ jsxs("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
47
|
+
return /* @__PURE__ */ jsxs("label", { className: `sia-checkbox sia-checkbox--${size} sia-checkbox--${shape}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
47
48
|
/* @__PURE__ */ jsx(
|
|
48
49
|
"input",
|
|
49
50
|
{
|
|
@@ -69,6 +70,7 @@ var CheckboxRoot = forwardRef(function Checkbox({ value, size: sizeProp, indeter
|
|
|
69
70
|
});
|
|
70
71
|
function CheckboxGroup({
|
|
71
72
|
size: sizeProp,
|
|
73
|
+
shape = "square",
|
|
72
74
|
columns,
|
|
73
75
|
direction = "horizontal",
|
|
74
76
|
gap,
|
|
@@ -89,6 +91,7 @@ function CheckboxGroup({
|
|
|
89
91
|
};
|
|
90
92
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
91
93
|
const context = useMemo(() => ({
|
|
94
|
+
shape,
|
|
92
95
|
values,
|
|
93
96
|
disabled,
|
|
94
97
|
name,
|
|
@@ -96,7 +99,7 @@ function CheckboxGroup({
|
|
|
96
99
|
const next = checked ? values.includes(optionValue) ? values : [...values, optionValue] : values.filter((item) => item !== optionValue);
|
|
97
100
|
setValues(next);
|
|
98
101
|
}
|
|
99
|
-
}), [disabled, name, setValues, values]);
|
|
102
|
+
}), [disabled, name, setValues, values, shape]);
|
|
100
103
|
return /* @__PURE__ */ jsx(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ jsx(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ jsxs("div", { className: `sia-checkbox-group${gridColumns ? " sia-checkbox-group--grid" : direction === "vertical" ? " sia-checkbox-group--vertical" : ""} ${className}`.trim(), style: layoutStyle, role: "group", children: [
|
|
101
104
|
options?.map((option) => {
|
|
102
105
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
package/dist/core.cjs
CHANGED
|
@@ -2700,9 +2700,10 @@ var import_react_dom3 = require("react-dom");
|
|
|
2700
2700
|
var import_react13 = require("react");
|
|
2701
2701
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2702
2702
|
var CheckboxGroupContext = (0, import_react13.createContext)(null);
|
|
2703
|
-
var CheckboxRoot = (0, import_react13.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
2703
|
+
var CheckboxRoot = (0, import_react13.forwardRef)(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
2704
2704
|
const size = useControlSize(sizeProp);
|
|
2705
2705
|
const group = (0, import_react13.useContext)(CheckboxGroupContext);
|
|
2706
|
+
const shape = shapeProp ?? group?.shape ?? "square";
|
|
2706
2707
|
const localRef = (0, import_react13.useRef)(null);
|
|
2707
2708
|
const fallbackId = (0, import_react13.useId)();
|
|
2708
2709
|
const grouped = group !== null && value !== void 0;
|
|
@@ -2715,7 +2716,7 @@ var CheckboxRoot = (0, import_react13.forwardRef)(function Checkbox({ value, siz
|
|
|
2715
2716
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
2716
2717
|
else if (forwardedRef) forwardedRef.current = node;
|
|
2717
2718
|
}
|
|
2718
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2719
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size} sia-checkbox--${shape}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
2719
2720
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
2720
2721
|
"input",
|
|
2721
2722
|
{
|
|
@@ -2741,6 +2742,7 @@ var CheckboxRoot = (0, import_react13.forwardRef)(function Checkbox({ value, siz
|
|
|
2741
2742
|
});
|
|
2742
2743
|
function CheckboxGroup({
|
|
2743
2744
|
size: sizeProp,
|
|
2745
|
+
shape = "square",
|
|
2744
2746
|
columns,
|
|
2745
2747
|
direction = "horizontal",
|
|
2746
2748
|
gap,
|
|
@@ -2761,6 +2763,7 @@ function CheckboxGroup({
|
|
|
2761
2763
|
};
|
|
2762
2764
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
2763
2765
|
const context = (0, import_react13.useMemo)(() => ({
|
|
2766
|
+
shape,
|
|
2764
2767
|
values,
|
|
2765
2768
|
disabled,
|
|
2766
2769
|
name,
|
|
@@ -2768,7 +2771,7 @@ function CheckboxGroup({
|
|
|
2768
2771
|
const next = checked ? values.includes(optionValue) ? values : [...values, optionValue] : values.filter((item) => item !== optionValue);
|
|
2769
2772
|
setValues(next);
|
|
2770
2773
|
}
|
|
2771
|
-
}), [disabled, name, setValues, values]);
|
|
2774
|
+
}), [disabled, name, setValues, values, shape]);
|
|
2772
2775
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `sia-checkbox-group${gridColumns ? " sia-checkbox-group--grid" : direction === "vertical" ? " sia-checkbox-group--vertical" : ""} ${className}`.trim(), style: layoutStyle, role: "group", children: [
|
|
2773
2776
|
options?.map((option) => {
|
|
2774
2777
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
package/dist/core.css
CHANGED
|
@@ -6228,6 +6228,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
6228
6228
|
border-color 140ms ease,
|
|
6229
6229
|
box-shadow 140ms ease;
|
|
6230
6230
|
}
|
|
6231
|
+
.sia-checkbox.sia-checkbox--circle > .sia-checkbox__control {
|
|
6232
|
+
border-radius: 50%;
|
|
6233
|
+
}
|
|
6231
6234
|
.sia-checkbox__control span {
|
|
6232
6235
|
width: 8px;
|
|
6233
6236
|
height: 5px;
|
package/dist/core.js
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
Typography,
|
|
12
12
|
Upload,
|
|
13
13
|
message
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3KYG7IU7.js";
|
|
15
15
|
import "./chunk-RX242MUO.js";
|
|
16
16
|
import {
|
|
17
17
|
Select
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-PGP4TEPP.js";
|
|
19
19
|
import {
|
|
20
20
|
Input,
|
|
21
21
|
Segmented
|
package/dist/index.cjs
CHANGED
|
@@ -3698,9 +3698,10 @@ var Input = (0, import_react17.forwardRef)(function Input2({
|
|
|
3698
3698
|
var import_react18 = require("react");
|
|
3699
3699
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
3700
3700
|
var CheckboxGroupContext = (0, import_react18.createContext)(null);
|
|
3701
|
-
var CheckboxRoot = (0, import_react18.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
3701
|
+
var CheckboxRoot = (0, import_react18.forwardRef)(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
3702
3702
|
const size = useControlSize(sizeProp);
|
|
3703
3703
|
const group = (0, import_react18.useContext)(CheckboxGroupContext);
|
|
3704
|
+
const shape = shapeProp ?? group?.shape ?? "square";
|
|
3704
3705
|
const localRef = (0, import_react18.useRef)(null);
|
|
3705
3706
|
const fallbackId = (0, import_react18.useId)();
|
|
3706
3707
|
const grouped = group !== null && value !== void 0;
|
|
@@ -3713,7 +3714,7 @@ var CheckboxRoot = (0, import_react18.forwardRef)(function Checkbox({ value, siz
|
|
|
3713
3714
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
3714
3715
|
else if (forwardedRef) forwardedRef.current = node;
|
|
3715
3716
|
}
|
|
3716
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size} sia-checkbox--${shape}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3717
3718
|
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
3718
3719
|
"input",
|
|
3719
3720
|
{
|
|
@@ -3739,6 +3740,7 @@ var CheckboxRoot = (0, import_react18.forwardRef)(function Checkbox({ value, siz
|
|
|
3739
3740
|
});
|
|
3740
3741
|
function CheckboxGroup({
|
|
3741
3742
|
size: sizeProp,
|
|
3743
|
+
shape = "square",
|
|
3742
3744
|
columns,
|
|
3743
3745
|
direction = "horizontal",
|
|
3744
3746
|
gap,
|
|
@@ -3759,6 +3761,7 @@ function CheckboxGroup({
|
|
|
3759
3761
|
};
|
|
3760
3762
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
3761
3763
|
const context = (0, import_react18.useMemo)(() => ({
|
|
3764
|
+
shape,
|
|
3762
3765
|
values,
|
|
3763
3766
|
disabled,
|
|
3764
3767
|
name,
|
|
@@ -3766,7 +3769,7 @@ function CheckboxGroup({
|
|
|
3766
3769
|
const next = checked ? values.includes(optionValue2) ? values : [...values, optionValue2] : values.filter((item) => item !== optionValue2);
|
|
3767
3770
|
setValues(next);
|
|
3768
3771
|
}
|
|
3769
|
-
}), [disabled, name, setValues, values]);
|
|
3772
|
+
}), [disabled, name, setValues, values, shape]);
|
|
3770
3773
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: `sia-checkbox-group${gridColumns ? " sia-checkbox-group--grid" : direction === "vertical" ? " sia-checkbox-group--vertical" : ""} ${className}`.trim(), style: layoutStyle, role: "group", children: [
|
|
3771
3774
|
options?.map((option) => {
|
|
3772
3775
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|
package/dist/index.css
CHANGED
|
@@ -6228,6 +6228,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
|
|
|
6228
6228
|
border-color 140ms ease,
|
|
6229
6229
|
box-shadow 140ms ease;
|
|
6230
6230
|
}
|
|
6231
|
+
.sia-checkbox.sia-checkbox--circle > .sia-checkbox__control {
|
|
6232
|
+
border-radius: 50%;
|
|
6233
|
+
}
|
|
6231
6234
|
.sia-checkbox__control span {
|
|
6232
6235
|
width: 8px;
|
|
6233
6236
|
height: 5px;
|
package/dist/index.d.cts
CHANGED
|
@@ -972,6 +972,8 @@ type CheckboxValue = string | number;
|
|
|
972
972
|
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
|
|
973
973
|
/** small / medium / large 文字字号为 12 / 13 / 16 像素,同时调整图形和间距;默认继承所在组或 Form,无上下文时为 medium(13px),组件显式 size 优先。 */
|
|
974
974
|
size?: ControlSize;
|
|
975
|
+
/** 外框形状:square 为圆角方框,circle 为圆形;仅改变外观,仍支持多选和半选。未指定时继承 Checkbox.Group.shape,无分组时默认 square;单项显式设置优先。 */
|
|
976
|
+
shape?: "square" | "circle";
|
|
975
977
|
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
976
978
|
value?: CheckboxValue;
|
|
977
979
|
/**
|
|
@@ -995,6 +997,10 @@ interface CheckboxOption {
|
|
|
995
997
|
}
|
|
996
998
|
/** CheckboxGroup的属性配置。 */
|
|
997
999
|
interface CheckboxGroupProps {
|
|
1000
|
+
/** 组内复选框的默认形状:square 为圆角方框,circle 为圆形;适用于 options 和 Checkbox 子项,子项显式 shape 优先,不改变多选行为。
|
|
1001
|
+
* @defaultValue "square"
|
|
1002
|
+
*/
|
|
1003
|
+
shape?: CheckboxProps["shape"];
|
|
998
1004
|
/** 等宽网格的列数,按选项顺序从左到右逐行排列并占满容器宽度;仅正整数生效,未设置或无效时使用 direction 排列。设置有效列数后优先于 direction;同样适用于直接传入的 Checkbox 子项。 */
|
|
999
1005
|
columns?: number;
|
|
1000
1006
|
/** 非网格模式的排列方向:horizontal 横向排列并自动换行,vertical 纵向单列排列;有效 columns 优先。默认 horizontal。 */
|
|
@@ -1026,7 +1032,7 @@ interface CheckboxGroupProps {
|
|
|
1026
1032
|
/** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
|
|
1027
1033
|
onChange?: (values: readonly CheckboxValue[]) => void;
|
|
1028
1034
|
}
|
|
1029
|
-
declare function CheckboxGroup({ size: sizeProp, columns, direction, gap, value, defaultValue, options, disabled, name, className, children, onChange, }: CheckboxGroupProps): react.JSX.Element;
|
|
1035
|
+
declare function CheckboxGroup({ size: sizeProp, shape, columns, direction, gap, value, defaultValue, options, disabled, name, className, children, onChange, }: CheckboxGroupProps): react.JSX.Element;
|
|
1030
1036
|
/** 复选框组件。 */
|
|
1031
1037
|
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>> & {
|
|
1032
1038
|
/** 组合多个子项并统一管理布局或选择状态。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -972,6 +972,8 @@ type CheckboxValue = string | number;
|
|
|
972
972
|
interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "size" | "value" | "onChange"> {
|
|
973
973
|
/** small / medium / large 文字字号为 12 / 13 / 16 像素,同时调整图形和间距;默认继承所在组或 Form,无上下文时为 medium(13px),组件显式 size 优先。 */
|
|
974
974
|
size?: ControlSize;
|
|
975
|
+
/** 外框形状:square 为圆角方框,circle 为圆形;仅改变外观,仍支持多选和半选。未指定时继承 Checkbox.Group.shape,无分组时默认 square;单项显式设置优先。 */
|
|
976
|
+
shape?: "square" | "circle";
|
|
975
977
|
/** 当前值;作为受控属性时,需要在变更回调中同步更新。 */
|
|
976
978
|
value?: CheckboxValue;
|
|
977
979
|
/**
|
|
@@ -995,6 +997,10 @@ interface CheckboxOption {
|
|
|
995
997
|
}
|
|
996
998
|
/** CheckboxGroup的属性配置。 */
|
|
997
999
|
interface CheckboxGroupProps {
|
|
1000
|
+
/** 组内复选框的默认形状:square 为圆角方框,circle 为圆形;适用于 options 和 Checkbox 子项,子项显式 shape 优先,不改变多选行为。
|
|
1001
|
+
* @defaultValue "square"
|
|
1002
|
+
*/
|
|
1003
|
+
shape?: CheckboxProps["shape"];
|
|
998
1004
|
/** 等宽网格的列数,按选项顺序从左到右逐行排列并占满容器宽度;仅正整数生效,未设置或无效时使用 direction 排列。设置有效列数后优先于 direction;同样适用于直接传入的 Checkbox 子项。 */
|
|
999
1005
|
columns?: number;
|
|
1000
1006
|
/** 非网格模式的排列方向:horizontal 横向排列并自动换行,vertical 纵向单列排列;有效 columns 优先。默认 horizontal。 */
|
|
@@ -1026,7 +1032,7 @@ interface CheckboxGroupProps {
|
|
|
1026
1032
|
/** 值发生变化时调用;参数为新值及类型声明中列出的关联信息。 */
|
|
1027
1033
|
onChange?: (values: readonly CheckboxValue[]) => void;
|
|
1028
1034
|
}
|
|
1029
|
-
declare function CheckboxGroup({ size: sizeProp, columns, direction, gap, value, defaultValue, options, disabled, name, className, children, onChange, }: CheckboxGroupProps): react.JSX.Element;
|
|
1035
|
+
declare function CheckboxGroup({ size: sizeProp, shape, columns, direction, gap, value, defaultValue, options, disabled, name, className, children, onChange, }: CheckboxGroupProps): react.JSX.Element;
|
|
1030
1036
|
/** 复选框组件。 */
|
|
1031
1037
|
declare const Checkbox: react.ForwardRefExoticComponent<CheckboxProps & react.RefAttributes<HTMLInputElement>> & {
|
|
1032
1038
|
/** 组合多个子项并统一管理布局或选择状态。 */
|
package/dist/index.js
CHANGED
|
@@ -82,7 +82,7 @@ import {
|
|
|
82
82
|
Watermark,
|
|
83
83
|
message,
|
|
84
84
|
notification
|
|
85
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-3KYG7IU7.js";
|
|
86
86
|
import "./chunk-RX242MUO.js";
|
|
87
87
|
import {
|
|
88
88
|
MarkdownEditor
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
DatePicker,
|
|
96
96
|
SelectDateRange,
|
|
97
97
|
TimePanel
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-TUGCP3GB.js";
|
|
99
99
|
import {
|
|
100
100
|
Checkbox,
|
|
101
101
|
FloatingScrollbarProvider,
|
|
@@ -107,7 +107,7 @@ import {
|
|
|
107
107
|
Tooltip,
|
|
108
108
|
Tree,
|
|
109
109
|
useScrollbarProximity
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-PGP4TEPP.js";
|
|
111
111
|
import {
|
|
112
112
|
Dropdown,
|
|
113
113
|
Input,
|
|
@@ -3425,9 +3425,10 @@ var Input = (0, import_react13.forwardRef)(function Input2({
|
|
|
3425
3425
|
var import_react14 = require("react");
|
|
3426
3426
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
3427
3427
|
var CheckboxGroupContext = (0, import_react14.createContext)(null);
|
|
3428
|
-
var CheckboxRoot = (0, import_react14.forwardRef)(function Checkbox({ value, size: sizeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
3428
|
+
var CheckboxRoot = (0, import_react14.forwardRef)(function Checkbox({ value, size: sizeProp, shape: shapeProp, indeterminate = false, children, disabled, checked, defaultChecked, className = "", onChange, ...props }, forwardedRef) {
|
|
3429
3429
|
const size = useControlSize(sizeProp);
|
|
3430
3430
|
const group = (0, import_react14.useContext)(CheckboxGroupContext);
|
|
3431
|
+
const shape = shapeProp ?? group?.shape ?? "square";
|
|
3431
3432
|
const localRef = (0, import_react14.useRef)(null);
|
|
3432
3433
|
const fallbackId = (0, import_react14.useId)();
|
|
3433
3434
|
const grouped = group !== null && value !== void 0;
|
|
@@ -3440,7 +3441,7 @@ var CheckboxRoot = (0, import_react14.forwardRef)(function Checkbox({ value, siz
|
|
|
3440
3441
|
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
3441
3442
|
else if (forwardedRef) forwardedRef.current = node;
|
|
3442
3443
|
}
|
|
3443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("label", { className: `sia-checkbox sia-checkbox--${size} sia-checkbox--${shape}${disabled || group?.disabled ? " is-disabled" : ""} ${className}`.trim(), children: [
|
|
3444
3445
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
3445
3446
|
"input",
|
|
3446
3447
|
{
|
|
@@ -3466,6 +3467,7 @@ var CheckboxRoot = (0, import_react14.forwardRef)(function Checkbox({ value, siz
|
|
|
3466
3467
|
});
|
|
3467
3468
|
function CheckboxGroup({
|
|
3468
3469
|
size: sizeProp,
|
|
3470
|
+
shape = "square",
|
|
3469
3471
|
columns,
|
|
3470
3472
|
direction = "horizontal",
|
|
3471
3473
|
gap,
|
|
@@ -3486,6 +3488,7 @@ function CheckboxGroup({
|
|
|
3486
3488
|
};
|
|
3487
3489
|
const [values, setValues] = useControllableState({ value, defaultValue, onChange });
|
|
3488
3490
|
const context = (0, import_react14.useMemo)(() => ({
|
|
3491
|
+
shape,
|
|
3489
3492
|
values,
|
|
3490
3493
|
disabled,
|
|
3491
3494
|
name,
|
|
@@ -3493,7 +3496,7 @@ function CheckboxGroup({
|
|
|
3493
3496
|
const next = checked ? values.includes(optionValue) ? values : [...values, optionValue] : values.filter((item) => item !== optionValue);
|
|
3494
3497
|
setValues(next);
|
|
3495
3498
|
}
|
|
3496
|
-
}), [disabled, name, setValues, values]);
|
|
3499
|
+
}), [disabled, name, setValues, values, shape]);
|
|
3497
3500
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ControlSizeContext.Provider, { value: size, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CheckboxGroupContext.Provider, { value: context, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: `sia-checkbox-group${gridColumns ? " sia-checkbox-group--grid" : direction === "vertical" ? " sia-checkbox-group--vertical" : ""} ${className}`.trim(), style: layoutStyle, role: "group", children: [
|
|
3498
3501
|
options?.map((option) => {
|
|
3499
3502
|
const normalized = typeof option === "object" ? option : { label: String(option), value: option };
|