@sikka/hawa 0.43.6-next → 0.45.0-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.
Files changed (51) hide show
  1. package/dist/blocks/auth/index.d.mts +3 -2
  2. package/dist/blocks/auth/index.d.ts +3 -2
  3. package/dist/blocks/auth/index.js +62 -34
  4. package/dist/blocks/auth/index.mjs +44 -23
  5. package/dist/blocks/feedback/index.js +35 -20
  6. package/dist/blocks/feedback/index.mjs +2 -2
  7. package/dist/blocks/index.d.mts +5 -2
  8. package/dist/blocks/index.d.ts +5 -2
  9. package/dist/blocks/index.js +164 -56
  10. package/dist/blocks/index.mjs +45 -15
  11. package/dist/blocks/misc/index.d.mts +2 -0
  12. package/dist/blocks/misc/index.d.ts +2 -0
  13. package/dist/blocks/misc/index.js +97 -18
  14. package/dist/blocks/misc/index.mjs +79 -7
  15. package/dist/blocks/pricing/index.js +16 -8
  16. package/dist/blocks/pricing/index.mjs +1 -1
  17. package/dist/{chunk-DYYINLRJ.mjs → chunk-LMYT23CT.mjs} +19 -12
  18. package/dist/{chunk-A6PONMZ6.mjs → chunk-OE6XZ6LW.mjs} +16 -8
  19. package/dist/{chunk-VVUNGE7V.mjs → chunk-QMNXTGM4.mjs} +66 -44
  20. package/dist/datePicker/index.js +10 -1
  21. package/dist/datePicker/index.js.map +1 -1
  22. package/dist/datePicker/index.mjs +10 -1
  23. package/dist/datePicker/index.mjs.map +1 -1
  24. package/dist/elements/index.js +66 -44
  25. package/dist/elements/index.mjs +1 -1
  26. package/dist/index.css +3 -0
  27. package/dist/index.d.mts +5 -2
  28. package/dist/index.d.ts +5 -2
  29. package/dist/index.js +109 -59
  30. package/dist/index.mjs +109 -59
  31. package/dist/interfaceSettings/index.js +16 -8
  32. package/dist/interfaceSettings/index.js.map +1 -1
  33. package/dist/interfaceSettings/index.mjs +16 -8
  34. package/dist/interfaceSettings/index.mjs.map +1 -1
  35. package/dist/phoneInput/index.js +19 -12
  36. package/dist/phoneInput/index.js.map +1 -1
  37. package/dist/phoneInput/index.mjs +19 -12
  38. package/dist/phoneInput/index.mjs.map +1 -1
  39. package/dist/pinInput/index.js +22 -15
  40. package/dist/pinInput/index.js.map +1 -1
  41. package/dist/pinInput/index.mjs +22 -15
  42. package/dist/pinInput/index.mjs.map +1 -1
  43. package/dist/radio/index.js +16 -8
  44. package/dist/radio/index.js.map +1 -1
  45. package/dist/radio/index.mjs +16 -8
  46. package/dist/radio/index.mjs.map +1 -1
  47. package/dist/select/index.js +19 -12
  48. package/dist/select/index.js.map +1 -1
  49. package/dist/select/index.mjs +19 -12
  50. package/dist/select/index.mjs.map +1 -1
  51. package/package.json +11 -11
@@ -232,6 +232,64 @@ var import_react16 = require("react");
232
232
 
233
233
  // hooks/useShortcuts.ts
234
234
  var import_react17 = require("react");
235
+ function parseHotkey(hotkey) {
236
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
237
+ const modifiers = {
238
+ alt: keys.includes("alt"),
239
+ ctrl: keys.includes("ctrl"),
240
+ meta: keys.includes("meta"),
241
+ mod: keys.includes("mod"),
242
+ shift: keys.includes("shift")
243
+ };
244
+ const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
245
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
246
+ return {
247
+ ...modifiers,
248
+ key: freeKey
249
+ };
250
+ }
251
+ function isExactHotkey(hotkey, event) {
252
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
253
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
254
+ if (alt !== altKey) {
255
+ return false;
256
+ }
257
+ if (mod) {
258
+ if (!ctrlKey && !metaKey) {
259
+ return false;
260
+ }
261
+ } else {
262
+ if (ctrl !== ctrlKey) {
263
+ return false;
264
+ }
265
+ if (meta !== metaKey) {
266
+ return false;
267
+ }
268
+ }
269
+ if (shift !== shiftKey) {
270
+ return false;
271
+ }
272
+ if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
273
+ return true;
274
+ }
275
+ return false;
276
+ }
277
+ function getHotkeyMatcher(hotkey) {
278
+ return (event) => isExactHotkey(parseHotkey(hotkey), event);
279
+ }
280
+ function getHotkeyHandler(hotkeys) {
281
+ return (event) => {
282
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
283
+ hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
284
+ if (getHotkeyMatcher(hotkey)(_event)) {
285
+ if (options.preventDefault) {
286
+ event.preventDefault();
287
+ }
288
+ handler(_event);
289
+ }
290
+ });
291
+ };
292
+ }
235
293
 
236
294
  // hooks/useWindowEvent.ts
237
295
  var import_react18 = require("react");
@@ -1445,13 +1503,21 @@ var Select = ({
1445
1503
  children
1446
1504
  );
1447
1505
  };
1448
- const Option = ({ children, innerProps, innerRef }) => {
1506
+ const Option = ({
1507
+ children,
1508
+ innerProps,
1509
+ innerRef,
1510
+ isFocused,
1511
+ isSelected
1512
+ }) => {
1449
1513
  return /* @__PURE__ */ import_react33.default.createElement(
1450
1514
  "div",
1451
1515
  {
1452
1516
  ref: innerRef,
1453
1517
  className: cn(
1454
- "hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all hover:hawa-bg-primary hover:hawa-text-primary-foreground"
1518
+ "hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all",
1519
+ isFocused ? "hawa-bg-accent hawa-text-bg-accent-foreground" : "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
1520
+ isSelected && "hawa-bg-primary hawa-text-primary-foreground"
1455
1521
  ),
1456
1522
  ...innerProps
1457
1523
  },
@@ -1508,15 +1574,20 @@ var Select = ({
1508
1574
  container: () => cn(
1509
1575
  selectContainerStyles,
1510
1576
  props.phoneCode && phoneCodeStyles,
1511
- props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
1512
1577
  props.isMulti && "hawa-ps-0 "
1513
1578
  ),
1514
- placeholder: () => selectPlaceholderStyles,
1579
+ placeholder: () => cn(
1580
+ selectPlaceholderStyles,
1581
+ props.disabled && "hawa-text-muted-foreground"
1582
+ ),
1515
1583
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
1516
- singleValue: () => "hawa-text-foreground",
1584
+ singleValue: () => cn(
1585
+ props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
1586
+ ),
1517
1587
  indicatorsContainer: () => cn(
1518
1588
  selectIndicatorContainerStyles,
1519
- props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
1589
+ props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
1590
+ props.disabled && "hawa-opacity-30"
1520
1591
  )
1521
1592
  },
1522
1593
  unstyled: true,
@@ -1524,12 +1595,6 @@ var Select = ({
1524
1595
  components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
1525
1596
  Option,
1526
1597
  Menu,
1527
- // Control: (e) => (
1528
- // <div
1529
- // className={cn(e.className, "hawa-flex hawa-flex-row")}
1530
- // {...e}
1531
- // />
1532
- // ),
1533
1598
  ValueContainer: (e) => /* @__PURE__ */ import_react33.default.createElement(
1534
1599
  "div",
1535
1600
  {
@@ -1652,6 +1717,7 @@ var ContactForm = ({
1652
1717
  onSubmit,
1653
1718
  customFields,
1654
1719
  classNames,
1720
+ clearOnSubmit = true,
1655
1721
  ...props
1656
1722
  }) => {
1657
1723
  var _a, _b, _c, _d, _e;
@@ -1695,8 +1761,11 @@ var ContactForm = ({
1695
1761
  control,
1696
1762
  handleSubmit,
1697
1763
  formState: { errors },
1698
- reset
1764
+ reset,
1765
+ getValues,
1766
+ trigger
1699
1767
  } = (0, import_react_hook_form2.useForm)({
1768
+ mode: "all",
1700
1769
  resolver: (0, import_zod.zodResolver)(MainSchema),
1701
1770
  defaultValues: {
1702
1771
  name: "",
@@ -1705,10 +1774,16 @@ var ContactForm = ({
1705
1774
  ...customFieldsDefaultValues
1706
1775
  }
1707
1776
  });
1708
- const handleFormSubmit = (data) => {
1777
+ const SubmitForm = async (data) => {
1778
+ const isValid = await trigger();
1779
+ if (!isValid) {
1780
+ return;
1781
+ }
1709
1782
  if (onSubmit) {
1710
1783
  onSubmit(data);
1711
- reset();
1784
+ if (clearOnSubmit) {
1785
+ reset();
1786
+ }
1712
1787
  } else {
1713
1788
  console.log("Form is submitted but onSubmit prop is missing");
1714
1789
  }
@@ -1718,7 +1793,8 @@ var ContactForm = ({
1718
1793
  {
1719
1794
  className: cn(
1720
1795
  "hawa-w-full",
1721
- cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
1796
+ cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
1797
+ classNames == null ? void 0 : classNames.container
1722
1798
  ),
1723
1799
  style: cardless ? { boxShadow: "none" } : void 0
1724
1800
  },
@@ -1726,7 +1802,7 @@ var ContactForm = ({
1726
1802
  "form",
1727
1803
  {
1728
1804
  noValidate: true,
1729
- onSubmit: handleSubmit(handleFormSubmit),
1805
+ onSubmit: handleSubmit(SubmitForm),
1730
1806
  className: "hawa-space-y-2",
1731
1807
  id: formId,
1732
1808
  autoComplete: formAutoComplete
@@ -1837,7 +1913,10 @@ var ContactForm = ({
1837
1913
  textareaProps: {
1838
1914
  placeholder: texts == null ? void 0 : texts.message.placeholder,
1839
1915
  className: "hawa-min-h-20",
1840
- ...field
1916
+ ...field,
1917
+ onKeyDown: getHotkeyHandler([
1918
+ ["mod+enter", () => SubmitForm(getValues())]
1919
+ ])
1841
1920
  },
1842
1921
  classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
1843
1922
  helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
@@ -11,7 +11,7 @@ import {
11
11
  } from "../../chunk-FIUKVRL5.mjs";
12
12
  import {
13
13
  Select
14
- } from "../../chunk-DYYINLRJ.mjs";
14
+ } from "../../chunk-LMYT23CT.mjs";
15
15
  import {
16
16
  Button,
17
17
  Card,
@@ -84,6 +84,64 @@ import { useEffect as useEffect14, useRef as useRef8 } from "react";
84
84
 
85
85
  // hooks/useShortcuts.ts
86
86
  import { useEffect as useEffect15 } from "react";
87
+ function parseHotkey(hotkey) {
88
+ const keys = hotkey.toLowerCase().split("+").map((part) => part.trim());
89
+ const modifiers = {
90
+ alt: keys.includes("alt"),
91
+ ctrl: keys.includes("ctrl"),
92
+ meta: keys.includes("meta"),
93
+ mod: keys.includes("mod"),
94
+ shift: keys.includes("shift")
95
+ };
96
+ const reservedKeys = ["alt", "ctrl", "meta", "shift", "mod"];
97
+ const freeKey = keys.find((key) => !reservedKeys.includes(key));
98
+ return {
99
+ ...modifiers,
100
+ key: freeKey
101
+ };
102
+ }
103
+ function isExactHotkey(hotkey, event) {
104
+ const { alt, ctrl, meta, mod, shift, key } = hotkey;
105
+ const { altKey, ctrlKey, metaKey, shiftKey, key: pressedKey } = event;
106
+ if (alt !== altKey) {
107
+ return false;
108
+ }
109
+ if (mod) {
110
+ if (!ctrlKey && !metaKey) {
111
+ return false;
112
+ }
113
+ } else {
114
+ if (ctrl !== ctrlKey) {
115
+ return false;
116
+ }
117
+ if (meta !== metaKey) {
118
+ return false;
119
+ }
120
+ }
121
+ if (shift !== shiftKey) {
122
+ return false;
123
+ }
124
+ if (key && (pressedKey.toLowerCase() === key.toLowerCase() || event.code.replace("Key", "").toLowerCase() === key.toLowerCase())) {
125
+ return true;
126
+ }
127
+ return false;
128
+ }
129
+ function getHotkeyMatcher(hotkey) {
130
+ return (event) => isExactHotkey(parseHotkey(hotkey), event);
131
+ }
132
+ function getHotkeyHandler(hotkeys) {
133
+ return (event) => {
134
+ const _event = "nativeEvent" in event ? event.nativeEvent : event;
135
+ hotkeys.forEach(([hotkey, handler, options = { preventDefault: true }]) => {
136
+ if (getHotkeyMatcher(hotkey)(_event)) {
137
+ if (options.preventDefault) {
138
+ event.preventDefault();
139
+ }
140
+ handler(_event);
141
+ }
142
+ });
143
+ };
144
+ }
87
145
 
88
146
  // hooks/useWindowEvent.ts
89
147
  import { useEffect as useEffect16 } from "react";
@@ -447,6 +505,7 @@ var ContactForm = ({
447
505
  onSubmit,
448
506
  customFields,
449
507
  classNames,
508
+ clearOnSubmit = true,
450
509
  ...props
451
510
  }) => {
452
511
  var _a, _b, _c, _d, _e;
@@ -490,8 +549,11 @@ var ContactForm = ({
490
549
  control,
491
550
  handleSubmit,
492
551
  formState: { errors },
493
- reset
552
+ reset,
553
+ getValues,
554
+ trigger
494
555
  } = useForm2({
556
+ mode: "all",
495
557
  resolver: zodResolver(MainSchema),
496
558
  defaultValues: {
497
559
  name: "",
@@ -500,10 +562,16 @@ var ContactForm = ({
500
562
  ...customFieldsDefaultValues
501
563
  }
502
564
  });
503
- const handleFormSubmit = (data) => {
565
+ const SubmitForm = async (data) => {
566
+ const isValid = await trigger();
567
+ if (!isValid) {
568
+ return;
569
+ }
504
570
  if (onSubmit) {
505
571
  onSubmit(data);
506
- reset();
572
+ if (clearOnSubmit) {
573
+ reset();
574
+ }
507
575
  } else {
508
576
  console.log("Form is submitted but onSubmit prop is missing");
509
577
  }
@@ -513,7 +581,8 @@ var ContactForm = ({
513
581
  {
514
582
  className: cn(
515
583
  "hawa-w-full",
516
- cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none"
584
+ cardless && "hawa-border-none hawa-bg-transparent hawa-shadow-none hawa-drop-shadow-none",
585
+ classNames == null ? void 0 : classNames.container
517
586
  ),
518
587
  style: cardless ? { boxShadow: "none" } : void 0
519
588
  },
@@ -521,7 +590,7 @@ var ContactForm = ({
521
590
  "form",
522
591
  {
523
592
  noValidate: true,
524
- onSubmit: handleSubmit(handleFormSubmit),
593
+ onSubmit: handleSubmit(SubmitForm),
525
594
  className: "hawa-space-y-2",
526
595
  id: formId,
527
596
  autoComplete: formAutoComplete
@@ -632,7 +701,10 @@ var ContactForm = ({
632
701
  textareaProps: {
633
702
  placeholder: texts == null ? void 0 : texts.message.placeholder,
634
703
  className: "hawa-min-h-20",
635
- ...field
704
+ ...field,
705
+ onKeyDown: getHotkeyHandler([
706
+ ["mod+enter", () => SubmitForm(getValues())]
707
+ ])
636
708
  },
637
709
  classNames: { textarea: "hawa-min-h-40 hawa-h-full" },
638
710
  helperText: (_a2 = errors.message) == null ? void 0 : _a2.message
@@ -1048,6 +1048,7 @@ var import_react12 = __toESM(require("react"));
1048
1048
 
1049
1049
  // elements/radio/Radio.tsx
1050
1050
  var import_react13 = __toESM(require("react"));
1051
+ var import_react_tabs = require("@radix-ui/react-tabs");
1051
1052
 
1052
1053
  // elements/popover/Popover.tsx
1053
1054
  var React17 = __toESM(require("react"));
@@ -1148,9 +1149,10 @@ var Radio = (0, import_react13.forwardRef)(
1148
1149
  )
1149
1150
  },
1150
1151
  props.label && /* @__PURE__ */ import_react13.default.createElement(Label, { ...labelProps }, props.label),
1151
- /* @__PURE__ */ import_react13.default.createElement(
1152
- "ul",
1152
+ /* @__PURE__ */ import_react13.default.createElement(import_react_tabs.Tabs, null, /* @__PURE__ */ import_react13.default.createElement(
1153
+ import_react_tabs.TabsList,
1153
1154
  {
1155
+ role: "tablist",
1154
1156
  ref: parentRef,
1155
1157
  className: cn(
1156
1158
  props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
@@ -1176,9 +1178,12 @@ var Radio = (0, import_react13.forwardRef)(
1176
1178
  asChild: true
1177
1179
  },
1178
1180
  /* @__PURE__ */ import_react13.default.createElement(
1179
- "li",
1181
+ import_react_tabs.TabsTrigger,
1180
1182
  {
1181
- "aria-current": "page",
1183
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
1184
+ value: opt.value,
1185
+ role: "tab",
1186
+ tabIndex: 0,
1182
1187
  onClick: () => {
1183
1188
  if (props.disabled || opt.disabled) return;
1184
1189
  handleChange(opt);
@@ -1194,10 +1199,12 @@ var Radio = (0, import_react13.forwardRef)(
1194
1199
  ),
1195
1200
  /* @__PURE__ */ import_react13.default.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
1196
1201
  ) : /* @__PURE__ */ import_react13.default.createElement(
1197
- "li",
1202
+ import_react_tabs.TabsTrigger,
1198
1203
  {
1199
1204
  key: o,
1200
- "aria-current": "page",
1205
+ role: "tab",
1206
+ tabIndex: 0,
1207
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
1201
1208
  onClick: () => {
1202
1209
  if (props.disabled || opt.disabled) return;
1203
1210
  handleChange(opt);
@@ -1205,13 +1212,14 @@ var Radio = (0, import_react13.forwardRef)(
1205
1212
  className: cn(
1206
1213
  ...radio_option_tabs_styling,
1207
1214
  selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
1208
- )
1215
+ ),
1216
+ value: opt.value
1209
1217
  },
1210
1218
  opt.icon && opt.icon,
1211
1219
  opt.label
1212
1220
  );
1213
1221
  })
1214
- ),
1222
+ )),
1215
1223
  !forceHideHelperText && /* @__PURE__ */ import_react13.default.createElement(HelperText, { helperText: props.helperText })
1216
1224
  );
1217
1225
  case "bordered":
@@ -6,7 +6,7 @@ import {
6
6
  import "../../chunk-47APBDKK.mjs";
7
7
  import {
8
8
  Radio
9
- } from "../../chunk-A6PONMZ6.mjs";
9
+ } from "../../chunk-OE6XZ6LW.mjs";
10
10
  import {
11
11
  CheckMark,
12
12
  UncheckMark
@@ -33,13 +33,21 @@ var Select = ({
33
33
  children
34
34
  );
35
35
  };
36
- const Option = ({ children, innerProps, innerRef }) => {
36
+ const Option = ({
37
+ children,
38
+ innerProps,
39
+ innerRef,
40
+ isFocused,
41
+ isSelected
42
+ }) => {
37
43
  return /* @__PURE__ */ React.createElement(
38
44
  "div",
39
45
  {
40
46
  ref: innerRef,
41
47
  className: cn(
42
- "hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all hover:hawa-bg-primary hover:hawa-text-primary-foreground"
48
+ "hawa-flex hawa-cursor-pointer hawa-select-none hawa-flex-row hawa-items-center hawa-justify-between hawa-rounded-inner hawa-p-1 hawa-px-2 hawa-transition-all",
49
+ isFocused ? "hawa-bg-accent hawa-text-bg-accent-foreground" : "hover:hawa-bg-accent hover:hawa-text-accent-foreground",
50
+ isSelected && "hawa-bg-primary hawa-text-primary-foreground"
43
51
  ),
44
52
  ...innerProps
45
53
  },
@@ -96,15 +104,20 @@ var Select = ({
96
104
  container: () => cn(
97
105
  selectContainerStyles,
98
106
  props.phoneCode && phoneCodeStyles,
99
- props.disabled ? "hawa-cursor-not-allowed" : "hawa-cursor-pointer",
100
107
  props.isMulti && "hawa-ps-0 "
101
108
  ),
102
- placeholder: () => selectPlaceholderStyles,
109
+ placeholder: () => cn(
110
+ selectPlaceholderStyles,
111
+ props.disabled && "hawa-text-muted-foreground"
112
+ ),
103
113
  valueContainer: () => "hawa-text-foreground hawa-px-1 ",
104
- singleValue: () => "hawa-text-foreground",
114
+ singleValue: () => cn(
115
+ props.disabled ? "hawa-text-muted-foreground hawa-opacity-30" : "hawa-text-foreground"
116
+ ),
105
117
  indicatorsContainer: () => cn(
106
118
  selectIndicatorContainerStyles,
107
- props.hideIndicator ? "hawa-invisible" : "hawa-px-1"
119
+ props.hideIndicator ? "hawa-invisible" : "hawa-px-1",
120
+ props.disabled && "hawa-opacity-30"
108
121
  )
109
122
  },
110
123
  unstyled: true,
@@ -112,12 +125,6 @@ var Select = ({
112
125
  components: props.hideIndicator ? { Option, Menu, IndicatorsContainer: () => null } : {
113
126
  Option,
114
127
  Menu,
115
- // Control: (e) => (
116
- // <div
117
- // className={cn(e.className, "hawa-flex hawa-flex-row")}
118
- // {...e}
119
- // />
120
- // ),
121
128
  ValueContainer: (e) => /* @__PURE__ */ React.createElement(
122
129
  "div",
123
130
  {
@@ -72,6 +72,7 @@ var PopoverRoot = PopoverPrimitive.Root;
72
72
 
73
73
  // elements/radio/Radio.tsx
74
74
  import React2, { useState, useRef, useEffect, forwardRef as forwardRef2 } from "react";
75
+ import { TabsList, TabsTrigger, Tabs } from "@radix-ui/react-tabs";
75
76
  var Radio = forwardRef2(
76
77
  ({
77
78
  design = "default",
@@ -148,9 +149,10 @@ var Radio = forwardRef2(
148
149
  )
149
150
  },
150
151
  props.label && /* @__PURE__ */ React2.createElement(Label, { ...labelProps }, props.label),
151
- /* @__PURE__ */ React2.createElement(
152
- "ul",
152
+ /* @__PURE__ */ React2.createElement(Tabs, null, /* @__PURE__ */ React2.createElement(
153
+ TabsList,
153
154
  {
155
+ role: "tablist",
154
156
  ref: parentRef,
155
157
  className: cn(
156
158
  props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
@@ -176,9 +178,12 @@ var Radio = forwardRef2(
176
178
  asChild: true
177
179
  },
178
180
  /* @__PURE__ */ React2.createElement(
179
- "li",
181
+ TabsTrigger,
180
182
  {
181
- "aria-current": "page",
183
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
184
+ value: opt.value,
185
+ role: "tab",
186
+ tabIndex: 0,
182
187
  onClick: () => {
183
188
  if (props.disabled || opt.disabled) return;
184
189
  handleChange(opt);
@@ -194,10 +199,12 @@ var Radio = forwardRef2(
194
199
  ),
195
200
  /* @__PURE__ */ React2.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
196
201
  ) : /* @__PURE__ */ React2.createElement(
197
- "li",
202
+ TabsTrigger,
198
203
  {
199
204
  key: o,
200
- "aria-current": "page",
205
+ role: "tab",
206
+ tabIndex: 0,
207
+ "aria-current": selectedOption === opt.value ? "page" : void 0,
201
208
  onClick: () => {
202
209
  if (props.disabled || opt.disabled) return;
203
210
  handleChange(opt);
@@ -205,13 +212,14 @@ var Radio = forwardRef2(
205
212
  className: cn(
206
213
  ...radio_option_tabs_styling,
207
214
  selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
208
- )
215
+ ),
216
+ value: opt.value
209
217
  },
210
218
  opt.icon && opt.icon,
211
219
  opt.label
212
220
  );
213
221
  })
214
- ),
222
+ )),
215
223
  !forceHideHelperText && /* @__PURE__ */ React2.createElement(HelperText, { helperText: props.helperText })
216
224
  );
217
225
  case "bordered":