@chellaa/react 0.2.2 → 0.2.3
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/index.cjs +186 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +9 -0
- package/dist/index.css.map +1 -1
- package/dist/index.mjs +186 -71
- package/dist/index.mjs.map +1 -1
- package/dist/index.node.mjs +186 -71
- package/dist/styles.css +1 -1
- package/package.json +12 -12
package/dist/index.mjs
CHANGED
|
@@ -3621,7 +3621,44 @@ var Checkbox = React56.forwardRef(
|
|
|
3621
3621
|
formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
|
|
3622
3622
|
formField?.hasHelperText ? formField.helperTextId : null
|
|
3623
3623
|
].filter(Boolean).join(" ") || void 0;
|
|
3624
|
+
const nativeInputNode = /* @__PURE__ */ jsx(
|
|
3625
|
+
"input",
|
|
3626
|
+
{
|
|
3627
|
+
type: "checkbox",
|
|
3628
|
+
id,
|
|
3629
|
+
name,
|
|
3630
|
+
value: valueProp,
|
|
3631
|
+
disabled,
|
|
3632
|
+
readOnly,
|
|
3633
|
+
required,
|
|
3634
|
+
checked: isControlled ? effectiveChecked : void 0,
|
|
3635
|
+
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
3636
|
+
onChange: handleChange,
|
|
3637
|
+
ref: mergedInputRef,
|
|
3638
|
+
"aria-checked": indeterminate ? "mixed" : effectiveChecked,
|
|
3639
|
+
"aria-invalid": error ? true : void 0,
|
|
3640
|
+
"aria-describedby": ariaDescribedBy,
|
|
3641
|
+
className: "cl-checkbox__input",
|
|
3642
|
+
...inputProps
|
|
3643
|
+
}
|
|
3644
|
+
);
|
|
3624
3645
|
if (asChild) {
|
|
3646
|
+
const childElement = React56.isValidElement(children) ? children : null;
|
|
3647
|
+
if (!childElement) {
|
|
3648
|
+
return /* @__PURE__ */ jsx(
|
|
3649
|
+
StyledCheckboxRoot,
|
|
3650
|
+
{
|
|
3651
|
+
as: Slot,
|
|
3652
|
+
ref,
|
|
3653
|
+
className: checkboxClassName,
|
|
3654
|
+
style,
|
|
3655
|
+
sx,
|
|
3656
|
+
...rest,
|
|
3657
|
+
children
|
|
3658
|
+
}
|
|
3659
|
+
);
|
|
3660
|
+
}
|
|
3661
|
+
const childLabel = childElement.props.children;
|
|
3625
3662
|
return /* @__PURE__ */ jsx(
|
|
3626
3663
|
StyledCheckboxRoot,
|
|
3627
3664
|
{
|
|
@@ -3631,7 +3668,15 @@ var Checkbox = React56.forwardRef(
|
|
|
3631
3668
|
style,
|
|
3632
3669
|
sx,
|
|
3633
3670
|
...rest,
|
|
3634
|
-
children
|
|
3671
|
+
children: React56.cloneElement(
|
|
3672
|
+
childElement,
|
|
3673
|
+
void 0,
|
|
3674
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3675
|
+
nativeInputNode,
|
|
3676
|
+
controlBox,
|
|
3677
|
+
childLabel && /* @__PURE__ */ jsx("span", { className: "cl-checkbox__label ChellaaCheckbox-Label", children: childLabel })
|
|
3678
|
+
] })
|
|
3679
|
+
)
|
|
3635
3680
|
}
|
|
3636
3681
|
);
|
|
3637
3682
|
}
|
|
@@ -3645,27 +3690,7 @@ var Checkbox = React56.forwardRef(
|
|
|
3645
3690
|
sx,
|
|
3646
3691
|
...rest,
|
|
3647
3692
|
children: [
|
|
3648
|
-
|
|
3649
|
-
"input",
|
|
3650
|
-
{
|
|
3651
|
-
type: "checkbox",
|
|
3652
|
-
id,
|
|
3653
|
-
name,
|
|
3654
|
-
value: valueProp,
|
|
3655
|
-
disabled,
|
|
3656
|
-
readOnly,
|
|
3657
|
-
required,
|
|
3658
|
-
checked: isControlled ? effectiveChecked : void 0,
|
|
3659
|
-
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
3660
|
-
onChange: handleChange,
|
|
3661
|
-
ref: mergedInputRef,
|
|
3662
|
-
"aria-checked": indeterminate ? "mixed" : effectiveChecked,
|
|
3663
|
-
"aria-invalid": error ? true : void 0,
|
|
3664
|
-
"aria-describedby": ariaDescribedBy,
|
|
3665
|
-
className: "cl-checkbox__input",
|
|
3666
|
-
...inputProps
|
|
3667
|
-
}
|
|
3668
|
-
),
|
|
3693
|
+
nativeInputNode,
|
|
3669
3694
|
controlBox,
|
|
3670
3695
|
children && /* @__PURE__ */ jsx("span", { className: "cl-checkbox__label ChellaaCheckbox-Label", children })
|
|
3671
3696
|
]
|
|
@@ -3892,7 +3917,43 @@ var Radio = React56.forwardRef(
|
|
|
3892
3917
|
formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
|
|
3893
3918
|
formField?.hasHelperText ? formField.helperTextId : null
|
|
3894
3919
|
].filter(Boolean).join(" ") || void 0;
|
|
3920
|
+
const nativeInputNode = /* @__PURE__ */ jsx(
|
|
3921
|
+
"input",
|
|
3922
|
+
{
|
|
3923
|
+
type: "radio",
|
|
3924
|
+
id,
|
|
3925
|
+
name,
|
|
3926
|
+
value: valueProp,
|
|
3927
|
+
disabled,
|
|
3928
|
+
readOnly,
|
|
3929
|
+
required,
|
|
3930
|
+
checked: isControlled ? effectiveChecked : void 0,
|
|
3931
|
+
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
3932
|
+
onChange: handleChange,
|
|
3933
|
+
ref: mergedInputRef,
|
|
3934
|
+
"aria-invalid": error ? true : void 0,
|
|
3935
|
+
"aria-describedby": ariaDescribedBy,
|
|
3936
|
+
className: "cl-radio__input",
|
|
3937
|
+
...inputProps
|
|
3938
|
+
}
|
|
3939
|
+
);
|
|
3895
3940
|
if (asChild) {
|
|
3941
|
+
const childElement = React56.isValidElement(children) ? children : null;
|
|
3942
|
+
if (!childElement) {
|
|
3943
|
+
return /* @__PURE__ */ jsx(
|
|
3944
|
+
StyledRadioRoot,
|
|
3945
|
+
{
|
|
3946
|
+
as: Slot,
|
|
3947
|
+
ref,
|
|
3948
|
+
className: radioClassName,
|
|
3949
|
+
style,
|
|
3950
|
+
sx,
|
|
3951
|
+
...rest,
|
|
3952
|
+
children
|
|
3953
|
+
}
|
|
3954
|
+
);
|
|
3955
|
+
}
|
|
3956
|
+
const childLabel = childElement.props.children;
|
|
3896
3957
|
return /* @__PURE__ */ jsx(
|
|
3897
3958
|
StyledRadioRoot,
|
|
3898
3959
|
{
|
|
@@ -3902,7 +3963,15 @@ var Radio = React56.forwardRef(
|
|
|
3902
3963
|
style,
|
|
3903
3964
|
sx,
|
|
3904
3965
|
...rest,
|
|
3905
|
-
children
|
|
3966
|
+
children: React56.cloneElement(
|
|
3967
|
+
childElement,
|
|
3968
|
+
void 0,
|
|
3969
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3970
|
+
nativeInputNode,
|
|
3971
|
+
controlBox,
|
|
3972
|
+
childLabel && /* @__PURE__ */ jsx("span", { className: "cl-radio__label ChellaaRadio-Label", children: childLabel })
|
|
3973
|
+
] })
|
|
3974
|
+
)
|
|
3906
3975
|
}
|
|
3907
3976
|
);
|
|
3908
3977
|
}
|
|
@@ -3916,26 +3985,7 @@ var Radio = React56.forwardRef(
|
|
|
3916
3985
|
sx,
|
|
3917
3986
|
...rest,
|
|
3918
3987
|
children: [
|
|
3919
|
-
|
|
3920
|
-
"input",
|
|
3921
|
-
{
|
|
3922
|
-
type: "radio",
|
|
3923
|
-
id,
|
|
3924
|
-
name,
|
|
3925
|
-
value: valueProp,
|
|
3926
|
-
disabled,
|
|
3927
|
-
readOnly,
|
|
3928
|
-
required,
|
|
3929
|
-
checked: isControlled ? effectiveChecked : void 0,
|
|
3930
|
-
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
3931
|
-
onChange: handleChange,
|
|
3932
|
-
ref: mergedInputRef,
|
|
3933
|
-
"aria-invalid": error ? true : void 0,
|
|
3934
|
-
"aria-describedby": ariaDescribedBy,
|
|
3935
|
-
className: "cl-radio__input",
|
|
3936
|
-
...inputProps
|
|
3937
|
-
}
|
|
3938
|
-
),
|
|
3988
|
+
nativeInputNode,
|
|
3939
3989
|
controlBox,
|
|
3940
3990
|
children && /* @__PURE__ */ jsx("span", { className: "cl-radio__label ChellaaRadio-Label", children })
|
|
3941
3991
|
]
|
|
@@ -4156,7 +4206,46 @@ var Switch = React56.forwardRef(
|
|
|
4156
4206
|
formField?.error && formField?.hasErrorMessage ? formField.errorMessageId : null,
|
|
4157
4207
|
formField?.hasHelperText ? formField.helperTextId : null
|
|
4158
4208
|
].filter(Boolean).join(" ") || void 0;
|
|
4209
|
+
const nativeInputNode = /* @__PURE__ */ jsx(
|
|
4210
|
+
"input",
|
|
4211
|
+
{
|
|
4212
|
+
type: "checkbox",
|
|
4213
|
+
role: "switch",
|
|
4214
|
+
id,
|
|
4215
|
+
name,
|
|
4216
|
+
value,
|
|
4217
|
+
disabled,
|
|
4218
|
+
readOnly,
|
|
4219
|
+
required,
|
|
4220
|
+
checked: isControlled ? effectiveChecked : void 0,
|
|
4221
|
+
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
4222
|
+
onChange: handleChange,
|
|
4223
|
+
onKeyDown: handleKeyDown,
|
|
4224
|
+
ref: mergedInputRef,
|
|
4225
|
+
"aria-checked": effectiveChecked,
|
|
4226
|
+
"aria-invalid": error ? true : void 0,
|
|
4227
|
+
"aria-describedby": ariaDescribedBy,
|
|
4228
|
+
className: "cl-switch__input",
|
|
4229
|
+
...inputProps
|
|
4230
|
+
}
|
|
4231
|
+
);
|
|
4159
4232
|
if (asChild) {
|
|
4233
|
+
const childElement = React56.isValidElement(children) ? children : null;
|
|
4234
|
+
if (!childElement) {
|
|
4235
|
+
return /* @__PURE__ */ jsx(
|
|
4236
|
+
StyledSwitchRoot,
|
|
4237
|
+
{
|
|
4238
|
+
as: Slot,
|
|
4239
|
+
ref,
|
|
4240
|
+
className: switchClassName,
|
|
4241
|
+
style,
|
|
4242
|
+
sx,
|
|
4243
|
+
...rest,
|
|
4244
|
+
children
|
|
4245
|
+
}
|
|
4246
|
+
);
|
|
4247
|
+
}
|
|
4248
|
+
const childLabel = childElement.props.children;
|
|
4160
4249
|
return /* @__PURE__ */ jsx(
|
|
4161
4250
|
StyledSwitchRoot,
|
|
4162
4251
|
{
|
|
@@ -4166,7 +4255,15 @@ var Switch = React56.forwardRef(
|
|
|
4166
4255
|
style,
|
|
4167
4256
|
sx,
|
|
4168
4257
|
...rest,
|
|
4169
|
-
children
|
|
4258
|
+
children: React56.cloneElement(
|
|
4259
|
+
childElement,
|
|
4260
|
+
void 0,
|
|
4261
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4262
|
+
nativeInputNode,
|
|
4263
|
+
trackControl,
|
|
4264
|
+
childLabel && /* @__PURE__ */ jsx("span", { className: "cl-switch__label ChellaaSwitch-Label", children: childLabel })
|
|
4265
|
+
] })
|
|
4266
|
+
)
|
|
4170
4267
|
}
|
|
4171
4268
|
);
|
|
4172
4269
|
}
|
|
@@ -4180,29 +4277,7 @@ var Switch = React56.forwardRef(
|
|
|
4180
4277
|
sx,
|
|
4181
4278
|
...rest,
|
|
4182
4279
|
children: [
|
|
4183
|
-
|
|
4184
|
-
"input",
|
|
4185
|
-
{
|
|
4186
|
-
type: "checkbox",
|
|
4187
|
-
role: "switch",
|
|
4188
|
-
id,
|
|
4189
|
-
name,
|
|
4190
|
-
value,
|
|
4191
|
-
disabled,
|
|
4192
|
-
readOnly,
|
|
4193
|
-
required,
|
|
4194
|
-
checked: isControlled ? effectiveChecked : void 0,
|
|
4195
|
-
defaultChecked: !isControlled ? defaultChecked : void 0,
|
|
4196
|
-
onChange: handleChange,
|
|
4197
|
-
onKeyDown: handleKeyDown,
|
|
4198
|
-
ref: mergedInputRef,
|
|
4199
|
-
"aria-checked": effectiveChecked,
|
|
4200
|
-
"aria-invalid": error ? true : void 0,
|
|
4201
|
-
"aria-describedby": ariaDescribedBy,
|
|
4202
|
-
className: "cl-switch__input",
|
|
4203
|
-
...inputProps
|
|
4204
|
-
}
|
|
4205
|
-
),
|
|
4280
|
+
nativeInputNode,
|
|
4206
4281
|
trackControl,
|
|
4207
4282
|
children && /* @__PURE__ */ jsx("span", { className: "cl-switch__label ChellaaSwitch-Label", children })
|
|
4208
4283
|
]
|
|
@@ -7099,7 +7174,7 @@ var SelectRoot = React56.forwardRef(
|
|
|
7099
7174
|
if (children) {
|
|
7100
7175
|
return children;
|
|
7101
7176
|
}
|
|
7102
|
-
if (options
|
|
7177
|
+
if (options !== void 0) {
|
|
7103
7178
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
7104
7179
|
/* @__PURE__ */ jsxs(SelectTrigger, { children: [
|
|
7105
7180
|
/* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? void 0 }),
|
|
@@ -9037,6 +9112,13 @@ var ComboboxTag = React56.forwardRef(
|
|
|
9037
9112
|
} else {
|
|
9038
9113
|
ctx.removeItem(tagVal);
|
|
9039
9114
|
}
|
|
9115
|
+
ctx.inputRef.current?.focus();
|
|
9116
|
+
};
|
|
9117
|
+
const handleKeyDown = (e) => {
|
|
9118
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9119
|
+
e.preventDefault();
|
|
9120
|
+
handleRemove(e);
|
|
9121
|
+
}
|
|
9040
9122
|
};
|
|
9041
9123
|
return /* @__PURE__ */ jsxs(
|
|
9042
9124
|
"span",
|
|
@@ -9050,11 +9132,13 @@ var ComboboxTag = React56.forwardRef(
|
|
|
9050
9132
|
"button",
|
|
9051
9133
|
{
|
|
9052
9134
|
type: "button",
|
|
9053
|
-
tabIndex: -1,
|
|
9135
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
9054
9136
|
"aria-label": `Remove ${typeof children === "string" ? children : tagVal}`,
|
|
9055
9137
|
className: "cl-combobox__tag-remove",
|
|
9056
9138
|
disabled: isDisabled,
|
|
9057
9139
|
onClick: handleRemove,
|
|
9140
|
+
onKeyDown: handleKeyDown,
|
|
9141
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
9058
9142
|
children: "\xD7"
|
|
9059
9143
|
}
|
|
9060
9144
|
)
|
|
@@ -9066,7 +9150,15 @@ var ComboboxTag = React56.forwardRef(
|
|
|
9066
9150
|
var ComboboxClear = React56.forwardRef(
|
|
9067
9151
|
function ComboboxClear2(props, ref) {
|
|
9068
9152
|
const ctx = useComboboxContext();
|
|
9069
|
-
const {
|
|
9153
|
+
const {
|
|
9154
|
+
className,
|
|
9155
|
+
onClick,
|
|
9156
|
+
onKeyDown,
|
|
9157
|
+
children,
|
|
9158
|
+
disabled: disabledProp,
|
|
9159
|
+
tabIndex = 0,
|
|
9160
|
+
...rest
|
|
9161
|
+
} = props;
|
|
9070
9162
|
const isDisabled = disabledProp ?? ctx.isDisabled;
|
|
9071
9163
|
const hasValue = ctx.isMulti ? Array.isArray(ctx.value) && ctx.value.length > 0 : Boolean(ctx.value || ctx.searchValue);
|
|
9072
9164
|
if (!hasValue) {
|
|
@@ -9076,18 +9168,28 @@ var ComboboxClear = React56.forwardRef(
|
|
|
9076
9168
|
e.stopPropagation();
|
|
9077
9169
|
if (isDisabled) return;
|
|
9078
9170
|
ctx.clearSelection();
|
|
9171
|
+
ctx.inputRef.current?.focus();
|
|
9079
9172
|
onClick?.(e);
|
|
9080
9173
|
};
|
|
9174
|
+
const handleKeyDown = (e) => {
|
|
9175
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
9176
|
+
e.preventDefault();
|
|
9177
|
+
handleClick(e);
|
|
9178
|
+
}
|
|
9179
|
+
onKeyDown?.(e);
|
|
9180
|
+
};
|
|
9081
9181
|
return /* @__PURE__ */ jsx(
|
|
9082
9182
|
"button",
|
|
9083
9183
|
{
|
|
9084
9184
|
ref,
|
|
9085
9185
|
type: "button",
|
|
9086
|
-
tabIndex: -1,
|
|
9186
|
+
tabIndex: isDisabled ? -1 : tabIndex,
|
|
9087
9187
|
"aria-label": "Clear selection",
|
|
9088
9188
|
className: classNames("cl-combobox__clear", className),
|
|
9089
9189
|
disabled: isDisabled,
|
|
9090
9190
|
onClick: handleClick,
|
|
9191
|
+
onKeyDown: handleKeyDown,
|
|
9192
|
+
onMouseDown: (e) => e.preventDefault(),
|
|
9091
9193
|
...rest,
|
|
9092
9194
|
children: children ?? /* @__PURE__ */ jsxs(
|
|
9093
9195
|
"svg",
|
|
@@ -9689,6 +9791,9 @@ var TableTh = React56.forwardRef(
|
|
|
9689
9791
|
scope = "col",
|
|
9690
9792
|
className,
|
|
9691
9793
|
children,
|
|
9794
|
+
tabIndex,
|
|
9795
|
+
onClick,
|
|
9796
|
+
onKeyDown,
|
|
9692
9797
|
...props
|
|
9693
9798
|
}, ref) => {
|
|
9694
9799
|
const computedAriaSort = isSortable ? sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none" : props["aria-sort"];
|
|
@@ -9700,13 +9805,23 @@ var TableTh = React56.forwardRef(
|
|
|
9700
9805
|
sortDirection && sortDirection !== "none" && `cl-table__th--sorted-${sortDirection}`,
|
|
9701
9806
|
className
|
|
9702
9807
|
].filter(Boolean).join(" ");
|
|
9808
|
+
const handleKeyDown = (e) => {
|
|
9809
|
+
if (isSortable && (e.key === "Enter" || e.key === " ")) {
|
|
9810
|
+
e.preventDefault();
|
|
9811
|
+
onClick?.(e);
|
|
9812
|
+
}
|
|
9813
|
+
onKeyDown?.(e);
|
|
9814
|
+
};
|
|
9703
9815
|
return /* @__PURE__ */ jsx(
|
|
9704
9816
|
"th",
|
|
9705
9817
|
{
|
|
9706
9818
|
ref,
|
|
9707
9819
|
scope,
|
|
9820
|
+
tabIndex: tabIndex ?? (isSortable ? 0 : void 0),
|
|
9708
9821
|
"aria-sort": computedAriaSort,
|
|
9709
9822
|
className: classNames2,
|
|
9823
|
+
onClick,
|
|
9824
|
+
onKeyDown: handleKeyDown,
|
|
9710
9825
|
...props,
|
|
9711
9826
|
children
|
|
9712
9827
|
}
|