@sikka/hawa 0.24.8-next → 0.24.11-next
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/{Radio-2ZwcMDWt.d.ts → Radio-K1WGpnGA.d.ts} +2 -1
- package/dist/{Radio-5ZANA8Vh.d.mts → Radio-hsrLKNxE.d.mts} +2 -1
- package/dist/blocks/auth/index.js +6 -6
- package/dist/blocks/auth/index.mjs +6 -6
- package/dist/blocks/feedback/index.js +20 -23
- package/dist/blocks/feedback/index.mjs +2 -2
- package/dist/blocks/index.d.mts +1 -1
- package/dist/blocks/index.d.ts +1 -1
- package/dist/blocks/index.js +30 -33
- package/dist/blocks/index.mjs +6 -6
- package/dist/blocks/pricing/index.js +23 -26
- package/dist/blocks/pricing/index.mjs +5 -5
- package/dist/checkbox/index.js +6 -6
- package/dist/checkbox/index.mjs +6 -6
- package/dist/{chunk-OT7WQYPD.mjs → chunk-N26RJDIG.mjs} +19 -22
- package/dist/{chunk-O4FANSN5.mjs → chunk-XOEHA3H6.mjs} +25 -28
- package/dist/elements/index.d.mts +2 -2
- package/dist/elements/index.d.ts +2 -2
- package/dist/elements/index.js +27 -30
- package/dist/elements/index.mjs +3 -3
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +32 -35
- package/dist/index.mjs +32 -35
- package/dist/interfaceSettings/index.js +21 -24
- package/dist/interfaceSettings/index.mjs +21 -24
- package/dist/radio/index.d.mts +2 -1
- package/dist/radio/index.d.ts +2 -1
- package/dist/radio/index.js +19 -22
- package/dist/radio/index.mjs +19 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -2955,8 +2955,10 @@ var Radio = ({
|
|
2955
2955
|
width = "default",
|
2956
2956
|
size = "default",
|
2957
2957
|
orientation = "horizontal",
|
2958
|
+
name,
|
2958
2959
|
labelProps,
|
2959
2960
|
tabsContainerClassName,
|
2961
|
+
onChange,
|
2960
2962
|
...props
|
2961
2963
|
}) => {
|
2962
2964
|
var _a, _b, _c;
|
@@ -2990,6 +2992,14 @@ var Radio = ({
|
|
2990
2992
|
setParentDirection(dir);
|
2991
2993
|
}
|
2992
2994
|
});
|
2995
|
+
const handleChange = (opt) => {
|
2996
|
+
setSelectedOption(opt.value);
|
2997
|
+
if (onChange) {
|
2998
|
+
onChange(opt.value);
|
2999
|
+
} else {
|
3000
|
+
console.log("onChange was not provided");
|
3001
|
+
}
|
3002
|
+
};
|
2993
3003
|
switch (design) {
|
2994
3004
|
case "tabs":
|
2995
3005
|
return /* @__PURE__ */ import_react11.default.createElement(
|
@@ -3008,14 +3018,7 @@ var Radio = ({
|
|
3008
3018
|
"li",
|
3009
3019
|
{
|
3010
3020
|
"aria-current": "page",
|
3011
|
-
onClick: () =>
|
3012
|
-
setSelectedOption(opt.value);
|
3013
|
-
if (props.onChangeTab) {
|
3014
|
-
props.onChangeTab(opt);
|
3015
|
-
} else {
|
3016
|
-
console.log("onChangeTab was not provided");
|
3017
|
-
}
|
3018
|
-
},
|
3021
|
+
onClick: () => handleChange(opt),
|
3019
3022
|
className: cn(
|
3020
3023
|
"hawa-w-full hawa-cursor-pointer ",
|
3021
3024
|
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
@@ -3036,7 +3039,7 @@ var Radio = ({
|
|
3036
3039
|
"div",
|
3037
3040
|
{
|
3038
3041
|
key: i,
|
3039
|
-
className: "hawa-rounded hawa-border hawa-border-gray-200
|
3042
|
+
className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
|
3040
3043
|
},
|
3041
3044
|
/* @__PURE__ */ import_react11.default.createElement(
|
3042
3045
|
"div",
|
@@ -3054,7 +3057,8 @@ var Radio = ({
|
|
3054
3057
|
id: opt.value.toString(),
|
3055
3058
|
type: "radio",
|
3056
3059
|
value: opt.value,
|
3057
|
-
name
|
3060
|
+
name,
|
3061
|
+
onChange: () => handleChange(opt)
|
3058
3062
|
}
|
3059
3063
|
),
|
3060
3064
|
/* @__PURE__ */ import_react11.default.createElement(
|
@@ -3062,7 +3066,7 @@ var Radio = ({
|
|
3062
3066
|
{
|
3063
3067
|
htmlFor: opt.value.toString(),
|
3064
3068
|
className: cn(
|
3065
|
-
"hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3
|
3069
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
3066
3070
|
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
3067
3071
|
)
|
3068
3072
|
},
|
@@ -3071,12 +3075,12 @@ var Radio = ({
|
|
3071
3075
|
)
|
3072
3076
|
)));
|
3073
3077
|
case "cards":
|
3074
|
-
return /* @__PURE__ */ import_react11.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react11.default.createElement("li", { key: o }, /* @__PURE__ */ import_react11.default.createElement(
|
3078
|
+
return /* @__PURE__ */ import_react11.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react11.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react11.default.createElement(
|
3075
3079
|
"input",
|
3076
3080
|
{
|
3077
3081
|
type: "radio",
|
3078
3082
|
id: opt.value.toString(),
|
3079
|
-
name
|
3083
|
+
name,
|
3080
3084
|
value: opt.value.toString(),
|
3081
3085
|
className: "hawa-peer hawa-hidden",
|
3082
3086
|
required: true,
|
@@ -3110,15 +3114,8 @@ var Radio = ({
|
|
3110
3114
|
id: opt.value.toString(),
|
3111
3115
|
type: "radio",
|
3112
3116
|
value: opt.value,
|
3113
|
-
name
|
3114
|
-
onChange: () =>
|
3115
|
-
setSelectedOption(opt.value);
|
3116
|
-
if (props.onChangeTab) {
|
3117
|
-
props.onChangeTab(opt);
|
3118
|
-
} else {
|
3119
|
-
console.log("onChangeTab was not provided");
|
3120
|
-
}
|
3121
|
-
}
|
3117
|
+
name,
|
3118
|
+
onChange: () => handleChange(opt)
|
3122
3119
|
}
|
3123
3120
|
),
|
3124
3121
|
/* @__PURE__ */ import_react11.default.createElement(
|
@@ -4084,7 +4081,7 @@ var Checkbox = ({
|
|
4084
4081
|
let labelLineHeightStyles = {
|
4085
4082
|
xs: sublabel || helperText ? 0.5 : 0.1,
|
4086
4083
|
sm: 0.6,
|
4087
|
-
default:
|
4084
|
+
default: 1,
|
4088
4085
|
md: 0.8,
|
4089
4086
|
lg: 0.9,
|
4090
4087
|
xl: 1
|
@@ -4094,8 +4091,7 @@ var Checkbox = ({
|
|
4094
4091
|
{
|
4095
4092
|
className: cn(
|
4096
4093
|
"hawa-flex hawa-gap-2",
|
4097
|
-
"hawa-items-top"
|
4098
|
-
sublabel || helperText ? "hawa-items-top" : "hawa-items-center"
|
4094
|
+
size === "default" ? "hawa-items-top" : "hawa-items-center"
|
4099
4095
|
)
|
4100
4096
|
},
|
4101
4097
|
/* @__PURE__ */ React34.createElement(
|
@@ -4108,16 +4104,17 @@ var Checkbox = ({
|
|
4108
4104
|
id
|
4109
4105
|
}
|
4110
4106
|
),
|
4111
|
-
(label || helperText) && /* @__PURE__ */ React34.createElement("div", { className: "hawa-grid hawa-gap-1.5
|
4107
|
+
(label || helperText) && /* @__PURE__ */ React34.createElement("div", { className: "hawa-grid hawa-gap-1.5" }, label && /* @__PURE__ */ React34.createElement(
|
4112
4108
|
"label",
|
4113
4109
|
{
|
4114
4110
|
htmlFor: id,
|
4115
4111
|
className: cn(
|
4116
|
-
"hawa-w-fit hawa-select-none hawa-pt-0.5 hawa-text-sm hawa-font-medium
|
4112
|
+
"hawa-w-fit hawa-select-none hawa-pt-0.5 hawa-text-sm hawa-font-medium",
|
4117
4113
|
disabled ? "hawa-cursor-not-allowed hawa-text-muted-foreground hawa-opacity-70 " : "hawa-cursor-pointer"
|
4118
4114
|
),
|
4119
4115
|
style: {
|
4120
|
-
lineHeight: labelLineHeightStyles[size]
|
4116
|
+
// lineHeight: labelLineHeightStyles[size]
|
4117
|
+
lineHeight: 1
|
4121
4118
|
}
|
4122
4119
|
},
|
4123
4120
|
label
|
@@ -7706,7 +7703,7 @@ var InterfaceSettings = ({
|
|
7706
7703
|
{
|
7707
7704
|
width,
|
7708
7705
|
defaultValue: language,
|
7709
|
-
|
7706
|
+
onChange: (e) => {
|
7710
7707
|
if (handleLanguage) {
|
7711
7708
|
handleLanguage(e.value);
|
7712
7709
|
}
|
@@ -7723,7 +7720,7 @@ var InterfaceSettings = ({
|
|
7723
7720
|
{
|
7724
7721
|
width,
|
7725
7722
|
defaultValue: color,
|
7726
|
-
|
7723
|
+
onChange: (e) => {
|
7727
7724
|
if (handleColorMode) {
|
7728
7725
|
handleColorMode(e.value);
|
7729
7726
|
}
|
@@ -10279,7 +10276,7 @@ var UserReferralSource = ({
|
|
10279
10276
|
orientation: "vertical",
|
10280
10277
|
options: optionsWithOther,
|
10281
10278
|
defaultValue: field.value,
|
10282
|
-
|
10279
|
+
onChange: (e) => field.onChange(e.value),
|
10283
10280
|
helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
10284
10281
|
}
|
10285
10282
|
);
|
@@ -11272,7 +11269,7 @@ var PricingPlans = ({
|
|
11272
11269
|
design: "tabs",
|
11273
11270
|
defaultValue: props.currentCycle.value,
|
11274
11271
|
options: props.billingCycles,
|
11275
|
-
|
11272
|
+
onChange: (e) => {
|
11276
11273
|
if (props.onCycleChange) {
|
11277
11274
|
props.onCycleChange(e);
|
11278
11275
|
}
|
@@ -11284,7 +11281,7 @@ var PricingPlans = ({
|
|
11284
11281
|
design: "tabs",
|
11285
11282
|
defaultValue: props.currentCurrency.value,
|
11286
11283
|
options: props.currencies,
|
11287
|
-
|
11284
|
+
onChange: (e) => {
|
11288
11285
|
if (props.onCurrencyChange) {
|
11289
11286
|
props.onCurrencyChange(e);
|
11290
11287
|
}
|
@@ -11345,7 +11342,7 @@ var ComparingPlans = (props) => {
|
|
11345
11342
|
design: "tabs",
|
11346
11343
|
defaultValue: props.currentCycle.value,
|
11347
11344
|
options: props.billingCycles,
|
11348
|
-
|
11345
|
+
onChange: (e) => {
|
11349
11346
|
if (props.onCycleChange) {
|
11350
11347
|
props.onCycleChange(e);
|
11351
11348
|
}
|
@@ -11359,7 +11356,7 @@ var ComparingPlans = (props) => {
|
|
11359
11356
|
design: "tabs",
|
11360
11357
|
defaultValue: props.currentCurrency.value,
|
11361
11358
|
options: props.currencies,
|
11362
|
-
|
11359
|
+
onChange: (e) => {
|
11363
11360
|
if (props.onCurrencyChange) {
|
11364
11361
|
props.onCurrencyChange(e);
|
11365
11362
|
}
|
package/dist/index.mjs
CHANGED
@@ -2722,8 +2722,10 @@ var Radio = ({
|
|
2722
2722
|
width = "default",
|
2723
2723
|
size = "default",
|
2724
2724
|
orientation = "horizontal",
|
2725
|
+
name,
|
2725
2726
|
labelProps,
|
2726
2727
|
tabsContainerClassName,
|
2728
|
+
onChange,
|
2727
2729
|
...props
|
2728
2730
|
}) => {
|
2729
2731
|
var _a, _b, _c;
|
@@ -2757,6 +2759,14 @@ var Radio = ({
|
|
2757
2759
|
setParentDirection(dir);
|
2758
2760
|
}
|
2759
2761
|
});
|
2762
|
+
const handleChange = (opt) => {
|
2763
|
+
setSelectedOption(opt.value);
|
2764
|
+
if (onChange) {
|
2765
|
+
onChange(opt.value);
|
2766
|
+
} else {
|
2767
|
+
console.log("onChange was not provided");
|
2768
|
+
}
|
2769
|
+
};
|
2760
2770
|
switch (design) {
|
2761
2771
|
case "tabs":
|
2762
2772
|
return /* @__PURE__ */ React24.createElement(
|
@@ -2775,14 +2785,7 @@ var Radio = ({
|
|
2775
2785
|
"li",
|
2776
2786
|
{
|
2777
2787
|
"aria-current": "page",
|
2778
|
-
onClick: () =>
|
2779
|
-
setSelectedOption(opt.value);
|
2780
|
-
if (props.onChangeTab) {
|
2781
|
-
props.onChangeTab(opt);
|
2782
|
-
} else {
|
2783
|
-
console.log("onChangeTab was not provided");
|
2784
|
-
}
|
2785
|
-
},
|
2788
|
+
onClick: () => handleChange(opt),
|
2786
2789
|
className: cn(
|
2787
2790
|
"hawa-w-full hawa-cursor-pointer ",
|
2788
2791
|
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
@@ -2803,7 +2806,7 @@ var Radio = ({
|
|
2803
2806
|
"div",
|
2804
2807
|
{
|
2805
2808
|
key: i,
|
2806
|
-
className: "hawa-rounded hawa-border hawa-border-gray-200
|
2809
|
+
className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
|
2807
2810
|
},
|
2808
2811
|
/* @__PURE__ */ React24.createElement(
|
2809
2812
|
"div",
|
@@ -2821,7 +2824,8 @@ var Radio = ({
|
|
2821
2824
|
id: opt.value.toString(),
|
2822
2825
|
type: "radio",
|
2823
2826
|
value: opt.value,
|
2824
|
-
name
|
2827
|
+
name,
|
2828
|
+
onChange: () => handleChange(opt)
|
2825
2829
|
}
|
2826
2830
|
),
|
2827
2831
|
/* @__PURE__ */ React24.createElement(
|
@@ -2829,7 +2833,7 @@ var Radio = ({
|
|
2829
2833
|
{
|
2830
2834
|
htmlFor: opt.value.toString(),
|
2831
2835
|
className: cn(
|
2832
|
-
"hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3
|
2836
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
2833
2837
|
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
2834
2838
|
)
|
2835
2839
|
},
|
@@ -2838,12 +2842,12 @@ var Radio = ({
|
|
2838
2842
|
)
|
2839
2843
|
)));
|
2840
2844
|
case "cards":
|
2841
|
-
return /* @__PURE__ */ React24.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React24.createElement("li", { key: o }, /* @__PURE__ */ React24.createElement(
|
2845
|
+
return /* @__PURE__ */ React24.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React24.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React24.createElement(
|
2842
2846
|
"input",
|
2843
2847
|
{
|
2844
2848
|
type: "radio",
|
2845
2849
|
id: opt.value.toString(),
|
2846
|
-
name
|
2850
|
+
name,
|
2847
2851
|
value: opt.value.toString(),
|
2848
2852
|
className: "hawa-peer hawa-hidden",
|
2849
2853
|
required: true,
|
@@ -2877,15 +2881,8 @@ var Radio = ({
|
|
2877
2881
|
id: opt.value.toString(),
|
2878
2882
|
type: "radio",
|
2879
2883
|
value: opt.value,
|
2880
|
-
name
|
2881
|
-
onChange: () =>
|
2882
|
-
setSelectedOption(opt.value);
|
2883
|
-
if (props.onChangeTab) {
|
2884
|
-
props.onChangeTab(opt);
|
2885
|
-
} else {
|
2886
|
-
console.log("onChangeTab was not provided");
|
2887
|
-
}
|
2888
|
-
}
|
2884
|
+
name,
|
2885
|
+
onChange: () => handleChange(opt)
|
2889
2886
|
}
|
2890
2887
|
),
|
2891
2888
|
/* @__PURE__ */ React24.createElement(
|
@@ -3851,7 +3848,7 @@ var Checkbox = ({
|
|
3851
3848
|
let labelLineHeightStyles = {
|
3852
3849
|
xs: sublabel || helperText ? 0.5 : 0.1,
|
3853
3850
|
sm: 0.6,
|
3854
|
-
default:
|
3851
|
+
default: 1,
|
3855
3852
|
md: 0.8,
|
3856
3853
|
lg: 0.9,
|
3857
3854
|
xl: 1
|
@@ -3861,8 +3858,7 @@ var Checkbox = ({
|
|
3861
3858
|
{
|
3862
3859
|
className: cn(
|
3863
3860
|
"hawa-flex hawa-gap-2",
|
3864
|
-
"hawa-items-top"
|
3865
|
-
sublabel || helperText ? "hawa-items-top" : "hawa-items-center"
|
3861
|
+
size === "default" ? "hawa-items-top" : "hawa-items-center"
|
3866
3862
|
)
|
3867
3863
|
},
|
3868
3864
|
/* @__PURE__ */ React34.createElement(
|
@@ -3875,16 +3871,17 @@ var Checkbox = ({
|
|
3875
3871
|
id
|
3876
3872
|
}
|
3877
3873
|
),
|
3878
|
-
(label || helperText) && /* @__PURE__ */ React34.createElement("div", { className: "hawa-grid hawa-gap-1.5
|
3874
|
+
(label || helperText) && /* @__PURE__ */ React34.createElement("div", { className: "hawa-grid hawa-gap-1.5" }, label && /* @__PURE__ */ React34.createElement(
|
3879
3875
|
"label",
|
3880
3876
|
{
|
3881
3877
|
htmlFor: id,
|
3882
3878
|
className: cn(
|
3883
|
-
"hawa-w-fit hawa-select-none hawa-pt-0.5 hawa-text-sm hawa-font-medium
|
3879
|
+
"hawa-w-fit hawa-select-none hawa-pt-0.5 hawa-text-sm hawa-font-medium",
|
3884
3880
|
disabled ? "hawa-cursor-not-allowed hawa-text-muted-foreground hawa-opacity-70 " : "hawa-cursor-pointer"
|
3885
3881
|
),
|
3886
3882
|
style: {
|
3887
|
-
lineHeight: labelLineHeightStyles[size]
|
3883
|
+
// lineHeight: labelLineHeightStyles[size]
|
3884
|
+
lineHeight: 1
|
3888
3885
|
}
|
3889
3886
|
},
|
3890
3887
|
label
|
@@ -7480,7 +7477,7 @@ var InterfaceSettings = ({
|
|
7480
7477
|
{
|
7481
7478
|
width,
|
7482
7479
|
defaultValue: language,
|
7483
|
-
|
7480
|
+
onChange: (e) => {
|
7484
7481
|
if (handleLanguage) {
|
7485
7482
|
handleLanguage(e.value);
|
7486
7483
|
}
|
@@ -7497,7 +7494,7 @@ var InterfaceSettings = ({
|
|
7497
7494
|
{
|
7498
7495
|
width,
|
7499
7496
|
defaultValue: color,
|
7500
|
-
|
7497
|
+
onChange: (e) => {
|
7501
7498
|
if (handleColorMode) {
|
7502
7499
|
handleColorMode(e.value);
|
7503
7500
|
}
|
@@ -10053,7 +10050,7 @@ var UserReferralSource = ({
|
|
10053
10050
|
orientation: "vertical",
|
10054
10051
|
options: optionsWithOther,
|
10055
10052
|
defaultValue: field.value,
|
10056
|
-
|
10053
|
+
onChange: (e) => field.onChange(e.value),
|
10057
10054
|
helperText: (_b2 = (_a2 = formState.errors.source) == null ? void 0 : _a2.message) == null ? void 0 : _b2.toString()
|
10058
10055
|
}
|
10059
10056
|
);
|
@@ -11046,7 +11043,7 @@ var PricingPlans = ({
|
|
11046
11043
|
design: "tabs",
|
11047
11044
|
defaultValue: props.currentCycle.value,
|
11048
11045
|
options: props.billingCycles,
|
11049
|
-
|
11046
|
+
onChange: (e) => {
|
11050
11047
|
if (props.onCycleChange) {
|
11051
11048
|
props.onCycleChange(e);
|
11052
11049
|
}
|
@@ -11058,7 +11055,7 @@ var PricingPlans = ({
|
|
11058
11055
|
design: "tabs",
|
11059
11056
|
defaultValue: props.currentCurrency.value,
|
11060
11057
|
options: props.currencies,
|
11061
|
-
|
11058
|
+
onChange: (e) => {
|
11062
11059
|
if (props.onCurrencyChange) {
|
11063
11060
|
props.onCurrencyChange(e);
|
11064
11061
|
}
|
@@ -11119,7 +11116,7 @@ var ComparingPlans = (props) => {
|
|
11119
11116
|
design: "tabs",
|
11120
11117
|
defaultValue: props.currentCycle.value,
|
11121
11118
|
options: props.billingCycles,
|
11122
|
-
|
11119
|
+
onChange: (e) => {
|
11123
11120
|
if (props.onCycleChange) {
|
11124
11121
|
props.onCycleChange(e);
|
11125
11122
|
}
|
@@ -11133,7 +11130,7 @@ var ComparingPlans = (props) => {
|
|
11133
11130
|
design: "tabs",
|
11134
11131
|
defaultValue: props.currentCurrency.value,
|
11135
11132
|
options: props.currencies,
|
11136
|
-
|
11133
|
+
onChange: (e) => {
|
11137
11134
|
if (props.onCurrencyChange) {
|
11138
11135
|
props.onCurrencyChange(e);
|
11139
11136
|
}
|
@@ -138,8 +138,10 @@ var Radio = ({
|
|
138
138
|
width = "default",
|
139
139
|
size = "default",
|
140
140
|
orientation = "horizontal",
|
141
|
+
name,
|
141
142
|
labelProps,
|
142
143
|
tabsContainerClassName,
|
144
|
+
onChange,
|
143
145
|
...props
|
144
146
|
}) => {
|
145
147
|
var _a, _b, _c;
|
@@ -173,6 +175,14 @@ var Radio = ({
|
|
173
175
|
setParentDirection(dir);
|
174
176
|
}
|
175
177
|
});
|
178
|
+
const handleChange = (opt) => {
|
179
|
+
setSelectedOption(opt.value);
|
180
|
+
if (onChange) {
|
181
|
+
onChange(opt.value);
|
182
|
+
} else {
|
183
|
+
console.log("onChange was not provided");
|
184
|
+
}
|
185
|
+
};
|
176
186
|
switch (design) {
|
177
187
|
case "tabs":
|
178
188
|
return /* @__PURE__ */ import_react2.default.createElement(
|
@@ -191,14 +201,7 @@ var Radio = ({
|
|
191
201
|
"li",
|
192
202
|
{
|
193
203
|
"aria-current": "page",
|
194
|
-
onClick: () =>
|
195
|
-
setSelectedOption(opt.value);
|
196
|
-
if (props.onChangeTab) {
|
197
|
-
props.onChangeTab(opt);
|
198
|
-
} else {
|
199
|
-
console.log("onChangeTab was not provided");
|
200
|
-
}
|
201
|
-
},
|
204
|
+
onClick: () => handleChange(opt),
|
202
205
|
className: cn(
|
203
206
|
"hawa-w-full hawa-cursor-pointer ",
|
204
207
|
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
@@ -219,7 +222,7 @@ var Radio = ({
|
|
219
222
|
"div",
|
220
223
|
{
|
221
224
|
key: i,
|
222
|
-
className: "hawa-rounded hawa-border hawa-border-gray-200
|
225
|
+
className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
|
223
226
|
},
|
224
227
|
/* @__PURE__ */ import_react2.default.createElement(
|
225
228
|
"div",
|
@@ -237,7 +240,8 @@ var Radio = ({
|
|
237
240
|
id: opt.value.toString(),
|
238
241
|
type: "radio",
|
239
242
|
value: opt.value,
|
240
|
-
name
|
243
|
+
name,
|
244
|
+
onChange: () => handleChange(opt)
|
241
245
|
}
|
242
246
|
),
|
243
247
|
/* @__PURE__ */ import_react2.default.createElement(
|
@@ -245,7 +249,7 @@ var Radio = ({
|
|
245
249
|
{
|
246
250
|
htmlFor: opt.value.toString(),
|
247
251
|
className: cn(
|
248
|
-
"hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3
|
252
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
249
253
|
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
250
254
|
)
|
251
255
|
},
|
@@ -254,12 +258,12 @@ var Radio = ({
|
|
254
258
|
)
|
255
259
|
)));
|
256
260
|
case "cards":
|
257
|
-
return /* @__PURE__ */ import_react2.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react2.default.createElement("li", { key: o }, /* @__PURE__ */ import_react2.default.createElement(
|
261
|
+
return /* @__PURE__ */ import_react2.default.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ import_react2.default.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ import_react2.default.createElement(
|
258
262
|
"input",
|
259
263
|
{
|
260
264
|
type: "radio",
|
261
265
|
id: opt.value.toString(),
|
262
|
-
name
|
266
|
+
name,
|
263
267
|
value: opt.value.toString(),
|
264
268
|
className: "hawa-peer hawa-hidden",
|
265
269
|
required: true,
|
@@ -293,15 +297,8 @@ var Radio = ({
|
|
293
297
|
id: opt.value.toString(),
|
294
298
|
type: "radio",
|
295
299
|
value: opt.value,
|
296
|
-
name
|
297
|
-
onChange: () =>
|
298
|
-
setSelectedOption(opt.value);
|
299
|
-
if (props.onChangeTab) {
|
300
|
-
props.onChangeTab(opt);
|
301
|
-
} else {
|
302
|
-
console.log("onChangeTab was not provided");
|
303
|
-
}
|
304
|
-
}
|
300
|
+
name,
|
301
|
+
onChange: () => handleChange(opt)
|
305
302
|
}
|
306
303
|
),
|
307
304
|
/* @__PURE__ */ import_react2.default.createElement(
|
@@ -347,7 +344,7 @@ var InterfaceSettings = ({
|
|
347
344
|
{
|
348
345
|
width,
|
349
346
|
defaultValue: language,
|
350
|
-
|
347
|
+
onChange: (e) => {
|
351
348
|
if (handleLanguage) {
|
352
349
|
handleLanguage(e.value);
|
353
350
|
}
|
@@ -364,7 +361,7 @@ var InterfaceSettings = ({
|
|
364
361
|
{
|
365
362
|
width,
|
366
363
|
defaultValue: color,
|
367
|
-
|
364
|
+
onChange: (e) => {
|
368
365
|
if (handleColorMode) {
|
369
366
|
handleColorMode(e.value);
|
370
367
|
}
|
@@ -13,8 +13,10 @@ var Radio = ({
|
|
13
13
|
width = "default",
|
14
14
|
size = "default",
|
15
15
|
orientation = "horizontal",
|
16
|
+
name,
|
16
17
|
labelProps,
|
17
18
|
tabsContainerClassName,
|
19
|
+
onChange,
|
18
20
|
...props
|
19
21
|
}) => {
|
20
22
|
var _a, _b, _c;
|
@@ -48,6 +50,14 @@ var Radio = ({
|
|
48
50
|
setParentDirection(dir);
|
49
51
|
}
|
50
52
|
});
|
53
|
+
const handleChange = (opt) => {
|
54
|
+
setSelectedOption(opt.value);
|
55
|
+
if (onChange) {
|
56
|
+
onChange(opt.value);
|
57
|
+
} else {
|
58
|
+
console.log("onChange was not provided");
|
59
|
+
}
|
60
|
+
};
|
51
61
|
switch (design) {
|
52
62
|
case "tabs":
|
53
63
|
return /* @__PURE__ */ React.createElement(
|
@@ -66,14 +76,7 @@ var Radio = ({
|
|
66
76
|
"li",
|
67
77
|
{
|
68
78
|
"aria-current": "page",
|
69
|
-
onClick: () =>
|
70
|
-
setSelectedOption(opt.value);
|
71
|
-
if (props.onChangeTab) {
|
72
|
-
props.onChangeTab(opt);
|
73
|
-
} else {
|
74
|
-
console.log("onChangeTab was not provided");
|
75
|
-
}
|
76
|
-
},
|
79
|
+
onClick: () => handleChange(opt),
|
77
80
|
className: cn(
|
78
81
|
"hawa-w-full hawa-cursor-pointer ",
|
79
82
|
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
@@ -94,7 +97,7 @@ var Radio = ({
|
|
94
97
|
"div",
|
95
98
|
{
|
96
99
|
key: i,
|
97
|
-
className: "hawa-rounded hawa-border hawa-border-gray-200
|
100
|
+
className: "hawa-w-full hawa-rounded hawa-border hawa-border-gray-200"
|
98
101
|
},
|
99
102
|
/* @__PURE__ */ React.createElement(
|
100
103
|
"div",
|
@@ -112,7 +115,8 @@ var Radio = ({
|
|
112
115
|
id: opt.value.toString(),
|
113
116
|
type: "radio",
|
114
117
|
value: opt.value,
|
115
|
-
name
|
118
|
+
name,
|
119
|
+
onChange: () => handleChange(opt)
|
116
120
|
}
|
117
121
|
),
|
118
122
|
/* @__PURE__ */ React.createElement(
|
@@ -120,7 +124,7 @@ var Radio = ({
|
|
120
124
|
{
|
121
125
|
htmlFor: opt.value.toString(),
|
122
126
|
className: cn(
|
123
|
-
"hawa-ml-2 hawa-w-full hawa-p-4 hawa-pl-3
|
127
|
+
"hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
124
128
|
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
125
129
|
)
|
126
130
|
},
|
@@ -129,12 +133,12 @@ var Radio = ({
|
|
129
133
|
)
|
130
134
|
)));
|
131
135
|
case "cards":
|
132
|
-
return /* @__PURE__ */ React.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React.createElement("li", { key: o }, /* @__PURE__ */ React.createElement(
|
136
|
+
return /* @__PURE__ */ React.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React.createElement(
|
133
137
|
"input",
|
134
138
|
{
|
135
139
|
type: "radio",
|
136
140
|
id: opt.value.toString(),
|
137
|
-
name
|
141
|
+
name,
|
138
142
|
value: opt.value.toString(),
|
139
143
|
className: "hawa-peer hawa-hidden",
|
140
144
|
required: true,
|
@@ -168,15 +172,8 @@ var Radio = ({
|
|
168
172
|
id: opt.value.toString(),
|
169
173
|
type: "radio",
|
170
174
|
value: opt.value,
|
171
|
-
name
|
172
|
-
onChange: () =>
|
173
|
-
setSelectedOption(opt.value);
|
174
|
-
if (props.onChangeTab) {
|
175
|
-
props.onChangeTab(opt);
|
176
|
-
} else {
|
177
|
-
console.log("onChangeTab was not provided");
|
178
|
-
}
|
179
|
-
}
|
175
|
+
name,
|
176
|
+
onChange: () => handleChange(opt)
|
180
177
|
}
|
181
178
|
),
|
182
179
|
/* @__PURE__ */ React.createElement(
|
@@ -222,7 +219,7 @@ var InterfaceSettings = ({
|
|
222
219
|
{
|
223
220
|
width,
|
224
221
|
defaultValue: language,
|
225
|
-
|
222
|
+
onChange: (e) => {
|
226
223
|
if (handleLanguage) {
|
227
224
|
handleLanguage(e.value);
|
228
225
|
}
|
@@ -239,7 +236,7 @@ var InterfaceSettings = ({
|
|
239
236
|
{
|
240
237
|
width,
|
241
238
|
defaultValue: color,
|
242
|
-
|
239
|
+
onChange: (e) => {
|
243
240
|
if (handleColorMode) {
|
244
241
|
handleColorMode(e.value);
|
245
242
|
}
|
package/dist/radio/index.d.mts
CHANGED
@@ -21,8 +21,9 @@ type RadioTypes = {
|
|
21
21
|
design?: "default" | "tabs" | "cards" | "bordered";
|
22
22
|
width?: "default" | "full" | "none";
|
23
23
|
size?: "default" | "lg" | "sm" | "xs";
|
24
|
+
name?: string;
|
24
25
|
options: RadioOptionsTypes[];
|
25
|
-
|
26
|
+
onChange?: any;
|
26
27
|
defaultValue?: any;
|
27
28
|
direction?: DirectionType;
|
28
29
|
helperText?: string;
|
package/dist/radio/index.d.ts
CHANGED
@@ -21,8 +21,9 @@ type RadioTypes = {
|
|
21
21
|
design?: "default" | "tabs" | "cards" | "bordered";
|
22
22
|
width?: "default" | "full" | "none";
|
23
23
|
size?: "default" | "lg" | "sm" | "xs";
|
24
|
+
name?: string;
|
24
25
|
options: RadioOptionsTypes[];
|
25
|
-
|
26
|
+
onChange?: any;
|
26
27
|
defaultValue?: any;
|
27
28
|
direction?: DirectionType;
|
28
29
|
helperText?: string;
|