@sikka/hawa 0.24.8-next → 0.24.10-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.
@@ -12,8 +12,8 @@ import * as SheetPrimitive from '@radix-ui/react-dialog';
12
12
  import { DialogProps } from '@radix-ui/react-dialog';
13
13
  import { VariantProps } from 'class-variance-authority';
14
14
  import { RowData, ColumnDef } from '@tanstack/react-table';
15
- import { L as LabelProps } from '../Radio-2ZwcMDWt.js';
16
- export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-2ZwcMDWt.js';
15
+ import { L as LabelProps } from '../Radio-K1WGpnGA.js';
16
+ export { b as Label, a as Radio, R as RadioOptionsTypes, c as Select, S as SelectOptionProps } from '../Radio-K1WGpnGA.js';
17
17
  import * as TabsPrimitive from '@radix-ui/react-tabs';
18
18
  import * as PopoverPrimitive from '@radix-ui/react-popover';
19
19
  import * as SwitchPrimitives from '@radix-ui/react-switch';
@@ -2889,8 +2889,10 @@ var Radio = ({
2889
2889
  width = "default",
2890
2890
  size = "default",
2891
2891
  orientation = "horizontal",
2892
+ name,
2892
2893
  labelProps,
2893
2894
  tabsContainerClassName,
2895
+ onChange,
2894
2896
  ...props
2895
2897
  }) => {
2896
2898
  var _a, _b, _c;
@@ -2924,6 +2926,14 @@ var Radio = ({
2924
2926
  setParentDirection(dir);
2925
2927
  }
2926
2928
  });
2929
+ const handleChange = (opt) => {
2930
+ setSelectedOption(opt.value);
2931
+ if (onChange) {
2932
+ onChange(opt.value);
2933
+ } else {
2934
+ console.log("onChange was not provided");
2935
+ }
2936
+ };
2927
2937
  switch (design) {
2928
2938
  case "tabs":
2929
2939
  return /* @__PURE__ */ import_react11.default.createElement(
@@ -2942,14 +2952,7 @@ var Radio = ({
2942
2952
  "li",
2943
2953
  {
2944
2954
  "aria-current": "page",
2945
- onClick: () => {
2946
- setSelectedOption(opt.value);
2947
- if (props.onChangeTab) {
2948
- props.onChangeTab(opt);
2949
- } else {
2950
- console.log("onChangeTab was not provided");
2951
- }
2952
- },
2955
+ onClick: () => handleChange(opt),
2953
2956
  className: cn(
2954
2957
  "hawa-w-full hawa-cursor-pointer ",
2955
2958
  orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
@@ -2988,7 +2991,8 @@ var Radio = ({
2988
2991
  id: opt.value.toString(),
2989
2992
  type: "radio",
2990
2993
  value: opt.value,
2991
- name: "bordered-radio"
2994
+ name,
2995
+ onChange: () => handleChange(opt)
2992
2996
  }
2993
2997
  ),
2994
2998
  /* @__PURE__ */ import_react11.default.createElement(
@@ -3005,12 +3009,12 @@ var Radio = ({
3005
3009
  )
3006
3010
  )));
3007
3011
  case "cards":
3008
- 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(
3012
+ 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(
3009
3013
  "input",
3010
3014
  {
3011
3015
  type: "radio",
3012
3016
  id: opt.value.toString(),
3013
- name: "cards-radio",
3017
+ name,
3014
3018
  value: opt.value.toString(),
3015
3019
  className: "hawa-peer hawa-hidden",
3016
3020
  required: true,
@@ -3044,15 +3048,8 @@ var Radio = ({
3044
3048
  id: opt.value.toString(),
3045
3049
  type: "radio",
3046
3050
  value: opt.value,
3047
- name: "default-radio",
3048
- onChange: () => {
3049
- setSelectedOption(opt.value);
3050
- if (props.onChangeTab) {
3051
- props.onChangeTab(opt);
3052
- } else {
3053
- console.log("onChangeTab was not provided");
3054
- }
3055
- }
3051
+ name,
3052
+ onChange: () => handleChange(opt)
3056
3053
  }
3057
3054
  ),
3058
3055
  /* @__PURE__ */ import_react11.default.createElement(
@@ -7550,7 +7547,7 @@ var InterfaceSettings = ({
7550
7547
  {
7551
7548
  width,
7552
7549
  defaultValue: language,
7553
- onChangeTab: (e) => {
7550
+ onChange: (e) => {
7554
7551
  if (handleLanguage) {
7555
7552
  handleLanguage(e.value);
7556
7553
  }
@@ -7567,7 +7564,7 @@ var InterfaceSettings = ({
7567
7564
  {
7568
7565
  width,
7569
7566
  defaultValue: color,
7570
- onChangeTab: (e) => {
7567
+ onChange: (e) => {
7571
7568
  if (handleColorMode) {
7572
7569
  handleColorMode(e.value);
7573
7570
  }
@@ -28,7 +28,7 @@ import {
28
28
  TabsTrigger,
29
29
  Textarea,
30
30
  UncheckMark
31
- } from "../chunk-O4FANSN5.mjs";
31
+ } from "../chunk-2VDIM3CP.mjs";
32
32
  import {
33
33
  Sheet,
34
34
  SheetClose,
@@ -3167,7 +3167,7 @@ var InterfaceSettings = ({
3167
3167
  {
3168
3168
  width,
3169
3169
  defaultValue: language,
3170
- onChangeTab: (e) => {
3170
+ onChange: (e) => {
3171
3171
  if (handleLanguage) {
3172
3172
  handleLanguage(e.value);
3173
3173
  }
@@ -3184,7 +3184,7 @@ var InterfaceSettings = ({
3184
3184
  {
3185
3185
  width,
3186
3186
  defaultValue: color,
3187
- onChangeTab: (e) => {
3187
+ onChange: (e) => {
3188
3188
  if (handleColorMode) {
3189
3189
  handleColorMode(e.value);
3190
3190
  }
package/dist/index.d.mts CHANGED
@@ -480,8 +480,9 @@ type RadioTypes = {
480
480
  design?: "default" | "tabs" | "cards" | "bordered";
481
481
  width?: "default" | "full" | "none";
482
482
  size?: "default" | "lg" | "sm" | "xs";
483
+ name?: string;
483
484
  options: RadioOptionsTypes[];
484
- onChangeTab?: any;
485
+ onChange?: any;
485
486
  defaultValue?: any;
486
487
  direction?: DirectionType;
487
488
  helperText?: string;
package/dist/index.d.ts CHANGED
@@ -480,8 +480,9 @@ type RadioTypes = {
480
480
  design?: "default" | "tabs" | "cards" | "bordered";
481
481
  width?: "default" | "full" | "none";
482
482
  size?: "default" | "lg" | "sm" | "xs";
483
+ name?: string;
483
484
  options: RadioOptionsTypes[];
484
- onChangeTab?: any;
485
+ onChange?: any;
485
486
  defaultValue?: any;
486
487
  direction?: DirectionType;
487
488
  helperText?: string;
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",
@@ -3054,7 +3057,8 @@ var Radio = ({
3054
3057
  id: opt.value.toString(),
3055
3058
  type: "radio",
3056
3059
  value: opt.value,
3057
- name: "bordered-radio"
3060
+ name,
3061
+ onChange: () => handleChange(opt)
3058
3062
  }
3059
3063
  ),
3060
3064
  /* @__PURE__ */ import_react11.default.createElement(
@@ -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: "cards-radio",
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: "default-radio",
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(
@@ -7706,7 +7703,7 @@ var InterfaceSettings = ({
7706
7703
  {
7707
7704
  width,
7708
7705
  defaultValue: language,
7709
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => field.onChange(e.value),
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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",
@@ -2821,7 +2824,8 @@ var Radio = ({
2821
2824
  id: opt.value.toString(),
2822
2825
  type: "radio",
2823
2826
  value: opt.value,
2824
- name: "bordered-radio"
2827
+ name,
2828
+ onChange: () => handleChange(opt)
2825
2829
  }
2826
2830
  ),
2827
2831
  /* @__PURE__ */ React24.createElement(
@@ -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: "cards-radio",
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: "default-radio",
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(
@@ -7480,7 +7477,7 @@ var InterfaceSettings = ({
7480
7477
  {
7481
7478
  width,
7482
7479
  defaultValue: language,
7483
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => field.onChange(e.value),
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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",
@@ -237,7 +240,8 @@ var Radio = ({
237
240
  id: opt.value.toString(),
238
241
  type: "radio",
239
242
  value: opt.value,
240
- name: "bordered-radio"
243
+ name,
244
+ onChange: () => handleChange(opt)
241
245
  }
242
246
  ),
243
247
  /* @__PURE__ */ import_react2.default.createElement(
@@ -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: "cards-radio",
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: "default-radio",
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
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",
@@ -112,7 +115,8 @@ var Radio = ({
112
115
  id: opt.value.toString(),
113
116
  type: "radio",
114
117
  value: opt.value,
115
- name: "bordered-radio"
118
+ name,
119
+ onChange: () => handleChange(opt)
116
120
  }
117
121
  ),
118
122
  /* @__PURE__ */ React.createElement(
@@ -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: "cards-radio",
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: "default-radio",
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
- onChangeTab: (e) => {
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
- onChangeTab: (e) => {
239
+ onChange: (e) => {
243
240
  if (handleColorMode) {
244
241
  handleColorMode(e.value);
245
242
  }
@@ -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
- onChangeTab?: any;
26
+ onChange?: any;
26
27
  defaultValue?: any;
27
28
  direction?: DirectionType;
28
29
  helperText?: string;
@@ -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
- onChangeTab?: any;
26
+ onChange?: any;
26
27
  defaultValue?: any;
27
28
  direction?: DirectionType;
28
29
  helperText?: string;