@sikka/hawa 0.34.8-next → 0.35.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 (129) hide show
  1. package/dist/{Radio-BpXOu4Hr.d.mts → Radio-BCD7k628.d.mts} +3 -0
  2. package/dist/{Radio-CREjhlGz.d.ts → Radio-y9uhxitu.d.ts} +3 -0
  3. package/dist/alert/index.js +28 -17
  4. package/dist/alert/index.js.map +1 -1
  5. package/dist/alert/index.mjs +61 -50
  6. package/dist/alert/index.mjs.map +1 -1
  7. package/dist/appLayout/index.js +81 -70
  8. package/dist/appLayout/index.js.map +1 -1
  9. package/dist/appLayout/index.mjs +138 -127
  10. package/dist/appLayout/index.mjs.map +1 -1
  11. package/dist/backToTop/index.js +28 -17
  12. package/dist/backToTop/index.js.map +1 -1
  13. package/dist/backToTop/index.mjs +55 -44
  14. package/dist/backToTop/index.mjs.map +1 -1
  15. package/dist/blocks/auth/index.js +50 -39
  16. package/dist/blocks/auth/index.mjs +5 -5
  17. package/dist/blocks/feedback/index.d.mts +3 -0
  18. package/dist/blocks/feedback/index.d.ts +3 -0
  19. package/dist/blocks/feedback/index.js +174 -120
  20. package/dist/blocks/feedback/index.mjs +29 -93
  21. package/dist/blocks/index.d.mts +2 -1
  22. package/dist/blocks/index.d.ts +2 -1
  23. package/dist/blocks/index.js +253 -201
  24. package/dist/blocks/index.mjs +3 -3
  25. package/dist/blocks/misc/index.js +71 -60
  26. package/dist/blocks/misc/index.mjs +5 -5
  27. package/dist/blocks/pricing/index.js +154 -80
  28. package/dist/blocks/pricing/index.mjs +4 -4
  29. package/dist/button/index.d.mts +13 -0
  30. package/dist/button/index.d.ts +13 -0
  31. package/dist/button/index.js +28 -17
  32. package/dist/button/index.js.map +1 -1
  33. package/dist/button/index.mjs +51 -40
  34. package/dist/button/index.mjs.map +1 -1
  35. package/dist/calendar/index.js +34 -23
  36. package/dist/calendar/index.js.map +1 -1
  37. package/dist/calendar/index.mjs +57 -46
  38. package/dist/calendar/index.mjs.map +1 -1
  39. package/dist/{chunk-GEB3LM5A.mjs → chunk-A376BKNX.mjs} +2 -2
  40. package/dist/{chunk-OS2UOK5C.mjs → chunk-DABX3SU6.mjs} +64 -51
  41. package/dist/{chunk-QPZ4ZR2B.mjs → chunk-DFWFQWWT.mjs} +155 -116
  42. package/dist/{chunk-UBNCETCU.mjs → chunk-GVZWOUGN.mjs} +1 -1
  43. package/dist/chunk-HHC34DXN.mjs +320 -0
  44. package/dist/{chunk-QVF3VLB7.mjs → chunk-IDKXEJET.mjs} +157 -144
  45. package/dist/{chunk-AW5FW5TY.mjs → chunk-L56XQRQI.mjs} +1 -1
  46. package/dist/{chunk-ORNLFAC6.mjs → chunk-XFRJ62W3.mjs} +1 -1
  47. package/dist/{chunk-RTGD7N7I.mjs → chunk-XJMDUR5A.mjs} +1 -1
  48. package/dist/{chunk-J7BT4XJR.mjs → chunk-YOT2GVXO.mjs} +1 -1
  49. package/dist/codeBlock/index.js +28 -17
  50. package/dist/codeBlock/index.js.map +1 -1
  51. package/dist/codeBlock/index.mjs +70 -59
  52. package/dist/codeBlock/index.mjs.map +1 -1
  53. package/dist/colorPicker/index.js.map +1 -1
  54. package/dist/colorPicker/index.mjs.map +1 -1
  55. package/dist/combobox/index.js.map +1 -1
  56. package/dist/combobox/index.mjs.map +1 -1
  57. package/dist/dataTable/index.d.mts +1 -2
  58. package/dist/dataTable/index.d.ts +1 -2
  59. package/dist/dataTable/index.js +144 -105
  60. package/dist/dataTable/index.js.map +1 -1
  61. package/dist/dataTable/index.mjs +178 -139
  62. package/dist/dataTable/index.mjs.map +1 -1
  63. package/dist/datePicker/index.d.mts +23 -5
  64. package/dist/datePicker/index.d.ts +23 -5
  65. package/dist/datePicker/index.js +46 -18
  66. package/dist/datePicker/index.js.map +1 -1
  67. package/dist/datePicker/index.mjs +46 -18
  68. package/dist/datePicker/index.mjs.map +1 -1
  69. package/dist/docsLayout/index.js +40 -29
  70. package/dist/docsLayout/index.js.map +1 -1
  71. package/dist/docsLayout/index.mjs +135 -124
  72. package/dist/docsLayout/index.mjs.map +1 -1
  73. package/dist/elements/index.d.mts +7 -3
  74. package/dist/elements/index.d.ts +7 -3
  75. package/dist/elements/index.js +475 -395
  76. package/dist/elements/index.mjs +32 -4
  77. package/dist/fileDropzone/index.js +28 -17
  78. package/dist/fileDropzone/index.js.map +1 -1
  79. package/dist/fileDropzone/index.mjs +89 -78
  80. package/dist/fileDropzone/index.mjs.map +1 -1
  81. package/dist/index.css +3 -0
  82. package/dist/index.d.mts +16 -9
  83. package/dist/index.d.ts +16 -9
  84. package/dist/index.js +515 -435
  85. package/dist/index.mjs +1204 -1124
  86. package/dist/input/index.js +1 -1
  87. package/dist/input/index.js.map +1 -1
  88. package/dist/input/index.mjs +1 -1
  89. package/dist/input/index.mjs.map +1 -1
  90. package/dist/interfaceSettings/index.js +85 -24
  91. package/dist/interfaceSettings/index.js.map +1 -1
  92. package/dist/interfaceSettings/index.mjs +107 -46
  93. package/dist/interfaceSettings/index.mjs.map +1 -1
  94. package/dist/layout/index.js +121 -110
  95. package/dist/layout/index.mjs +2 -2
  96. package/dist/passwordInput/index.js +1 -1
  97. package/dist/passwordInput/index.js.map +1 -1
  98. package/dist/passwordInput/index.mjs +1 -1
  99. package/dist/passwordInput/index.mjs.map +1 -1
  100. package/dist/phoneInput/index.js.map +1 -1
  101. package/dist/phoneInput/index.mjs.map +1 -1
  102. package/dist/radio/index.d.mts +3 -0
  103. package/dist/radio/index.d.ts +3 -0
  104. package/dist/radio/index.js +85 -24
  105. package/dist/radio/index.js.map +1 -1
  106. package/dist/radio/index.mjs +100 -39
  107. package/dist/radio/index.mjs.map +1 -1
  108. package/dist/select/index.js.map +1 -1
  109. package/dist/select/index.mjs.map +1 -1
  110. package/dist/simpleTable/index.js.map +1 -1
  111. package/dist/simpleTable/index.mjs.map +1 -1
  112. package/dist/skeleton/index.js.map +1 -1
  113. package/dist/skeleton/index.mjs.map +1 -1
  114. package/dist/sortButton/index.js +28 -17
  115. package/dist/sortButton/index.js.map +1 -1
  116. package/dist/sortButton/index.mjs +58 -47
  117. package/dist/sortButton/index.mjs.map +1 -1
  118. package/dist/splitButton/index.d.mts +12 -0
  119. package/dist/splitButton/index.d.ts +12 -0
  120. package/dist/splitButton/index.js +70 -59
  121. package/dist/splitButton/index.js.map +1 -1
  122. package/dist/splitButton/index.mjs +93 -82
  123. package/dist/splitButton/index.mjs.map +1 -1
  124. package/dist/stats/index.js.map +1 -1
  125. package/dist/stats/index.mjs.map +1 -1
  126. package/dist/textarea/index.js.map +1 -1
  127. package/dist/textarea/index.mjs.map +1 -1
  128. package/package.json +6 -6
  129. package/dist/chunk-IQEBXGLM.mjs +0 -215
@@ -0,0 +1,320 @@
1
+ "use client";
2
+ import {
3
+ Label,
4
+ cn
5
+ } from "./chunk-DABX3SU6.mjs";
6
+
7
+ // elements/popover/Popover.tsx
8
+ import * as React from "react";
9
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
10
+ var PopoverContent = React.forwardRef(
11
+ ({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React.createElement(
12
+ PopoverPrimitive.Content,
13
+ {
14
+ ref,
15
+ align,
16
+ sideOffset,
17
+ className: cn(
18
+ "dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-bg-popover hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[state=open]:hawa-animate-in data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=open]:hawa-fade-in-0 data-[state=closed]:hawa-zoom-out-95 data-[state=open]:hawa-zoom-in-95 data-[side=bottom]:hawa-slide-in-from-top-2 data-[side=left]:hawa-slide-in-from-right-2 data-[side=right]:hawa-slide-in-from-left-2 data-[side=top]:hawa-slide-in-from-bottom-2",
19
+ className
20
+ ),
21
+ ...props
22
+ }
23
+ ))
24
+ );
25
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
26
+ var Popover = ({
27
+ trigger,
28
+ children,
29
+ className,
30
+ align = "center",
31
+ side,
32
+ sideOffset = 4,
33
+ open,
34
+ width = "default",
35
+ disableTrigger,
36
+ contentProps,
37
+ triggerProps,
38
+ ...props
39
+ }) => {
40
+ let widthStyles = {
41
+ trigger: "var(--radix-popover-trigger-width)",
42
+ default: "auto"
43
+ };
44
+ return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { open, ...props }, /* @__PURE__ */ React.createElement(
45
+ PopoverPrimitive.Trigger,
46
+ {
47
+ className: "hawa-w-full",
48
+ disabled: disableTrigger,
49
+ ...triggerProps
50
+ },
51
+ trigger
52
+ ), /* @__PURE__ */ React.createElement(
53
+ PopoverContent,
54
+ {
55
+ side,
56
+ className,
57
+ align,
58
+ sideOffset,
59
+ style: {
60
+ width: widthStyles[width],
61
+ maxWidth: "var(--radix-popover-content-available-width)",
62
+ maxHeight: "var(--radix-popover-content-available-height)"
63
+ },
64
+ ...contentProps
65
+ },
66
+ children
67
+ ));
68
+ };
69
+ var PopoverTrigger = PopoverPrimitive.Trigger;
70
+ var PopoverRoot = PopoverPrimitive.Root;
71
+
72
+ // elements/radio/Radio.tsx
73
+ import React2, { useState, useRef, useEffect, forwardRef as forwardRef2 } from "react";
74
+ var Radio = forwardRef2(
75
+ ({
76
+ design = "default",
77
+ width = "default",
78
+ size = "default",
79
+ orientation = "horizontal",
80
+ name,
81
+ labelProps,
82
+ tabsContainerClassName,
83
+ forceHideHelperText = false,
84
+ onChange,
85
+ ...props
86
+ }, ref) => {
87
+ var _a, _b, _c;
88
+ let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
89
+ let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
90
+ ${props.disabled ? "" : "hover:hawa-bg-muted"}`;
91
+ let orientationStyle = {
92
+ horizontal: "hawa-flex hawa-flex-row",
93
+ vertical: "hawa-flex hawa-flex-col"
94
+ };
95
+ let tabSizeStyle = {
96
+ default: "hawa-py-2 hawa-px-4 hawa-text-sm",
97
+ lg: "hawa-py-2 hawa-px-4",
98
+ sm: "hawa-p-1.5 hawa-text-xs",
99
+ xs: "hawa-p-1 hawa-text-[10px]"
100
+ };
101
+ let widthStyle = {
102
+ none: "",
103
+ default: "hawa-max-w-fit",
104
+ full: "hawa-w-full"
105
+ };
106
+ const [parentDirection, setParentDirection] = React2.useState(
107
+ null
108
+ );
109
+ const [selectedOption, setSelectedOption] = useState(
110
+ props.defaultValue || props.value
111
+ );
112
+ const [openTooltip, setOpenTooltip] = useState(null);
113
+ const parentRef = useRef(null);
114
+ useEffect(() => {
115
+ var _a2;
116
+ const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
117
+ if (parentNode) {
118
+ const dir = window.getComputedStyle(parentNode).direction;
119
+ setParentDirection(dir);
120
+ }
121
+ });
122
+ const handleChange = (opt) => {
123
+ setSelectedOption(opt.value);
124
+ if (onChange) {
125
+ onChange(opt.value);
126
+ } else {
127
+ console.log("onChange was not provided");
128
+ }
129
+ };
130
+ const radio_option_tabs_styling = [
131
+ "hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
132
+ !props.disabled && "hawa-cursor-pointer",
133
+ orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
134
+ orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
135
+ orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
136
+ tabSizeStyle[size]
137
+ ];
138
+ switch (design) {
139
+ case "tabs":
140
+ return /* @__PURE__ */ React2.createElement("div", { className: "hawa-gap-2 hawa-flex hawa-flex-col" }, props.label && /* @__PURE__ */ React2.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React2.createElement(
141
+ "ul",
142
+ {
143
+ ref: parentRef,
144
+ className: cn(
145
+ props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
146
+ "hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
147
+ orientationStyle[orientation],
148
+ widthStyle[width],
149
+ tabsContainerClassName
150
+ )
151
+ },
152
+ (_b = props.options) == null ? void 0 : _b.map((opt, o) => {
153
+ return opt.tooltip ? /* @__PURE__ */ React2.createElement(
154
+ PopoverRoot,
155
+ {
156
+ key: o,
157
+ open: o === openTooltip,
158
+ onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
159
+ },
160
+ /* @__PURE__ */ React2.createElement(
161
+ PopoverTrigger,
162
+ {
163
+ onMouseEnter: () => setOpenTooltip(o),
164
+ onMouseLeave: () => setOpenTooltip(null),
165
+ asChild: true
166
+ },
167
+ /* @__PURE__ */ React2.createElement(
168
+ "li",
169
+ {
170
+ "aria-current": "page",
171
+ onClick: () => {
172
+ if (props.disabled || opt.disabled)
173
+ return;
174
+ handleChange(opt);
175
+ },
176
+ className: cn(
177
+ ...radio_option_tabs_styling,
178
+ selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
179
+ )
180
+ },
181
+ opt.icon && opt.icon,
182
+ opt.label
183
+ )
184
+ ),
185
+ /* @__PURE__ */ React2.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
186
+ ) : /* @__PURE__ */ React2.createElement(
187
+ "li",
188
+ {
189
+ key: o,
190
+ "aria-current": "page",
191
+ onClick: () => {
192
+ if (props.disabled || opt.disabled)
193
+ return;
194
+ handleChange(opt);
195
+ },
196
+ className: cn(
197
+ ...radio_option_tabs_styling,
198
+ selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
199
+ )
200
+ },
201
+ opt.icon && opt.icon,
202
+ opt.label
203
+ );
204
+ })
205
+ ), !forceHideHelperText && /* @__PURE__ */ React2.createElement(
206
+ "p",
207
+ {
208
+ className: cn(
209
+ "hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
210
+ props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
211
+ )
212
+ },
213
+ props.helperText
214
+ ));
215
+ case "bordered":
216
+ return /* @__PURE__ */ React2.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React2.createElement("div", { key: i, className: "hawa-w-full hawa-rounded hawa-border" }, /* @__PURE__ */ React2.createElement(
217
+ "div",
218
+ {
219
+ className: cn(
220
+ "radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
221
+ props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
222
+ ),
223
+ key: i + 1
224
+ },
225
+ /* @__PURE__ */ React2.createElement(
226
+ "input",
227
+ {
228
+ disabled: opt.disabled,
229
+ id: opt.value.toString(),
230
+ type: "radio",
231
+ value: opt.value,
232
+ name,
233
+ onChange: () => handleChange(opt)
234
+ }
235
+ ),
236
+ /* @__PURE__ */ React2.createElement(
237
+ "label",
238
+ {
239
+ htmlFor: opt.value.toString(),
240
+ className: cn(
241
+ "hawa-ml-2 hawa-w-full hawa-select-none hawa-p-4 hawa-pl-3 hawa-text-sm hawa-font-medium hawa-text-black dark:hawa-text-white",
242
+ opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
243
+ )
244
+ },
245
+ opt.label
246
+ )
247
+ ))));
248
+ case "cards":
249
+ return /* @__PURE__ */ React2.createElement("ul", { className: cn(orientationStyle[orientation], "hawa-gap-4") }, (_c = props.options) == null ? void 0 : _c.map((opt, o) => /* @__PURE__ */ React2.createElement("li", { key: o, onClick: () => handleChange(opt) }, /* @__PURE__ */ React2.createElement(
250
+ "input",
251
+ {
252
+ type: "radio",
253
+ id: opt.value.toString(),
254
+ name,
255
+ value: opt.value.toString(),
256
+ className: "hawa-peer hawa-hidden",
257
+ required: true,
258
+ disabled: opt.disabled
259
+ }
260
+ ), /* @__PURE__ */ React2.createElement(
261
+ "label",
262
+ {
263
+ htmlFor: opt.value.toString(),
264
+ className: cn(
265
+ "hawa-inline-flex hawa-h-full hawa-w-full hawa-transition-all hawa-items-center hawa-justify-between hawa-rounded-lg hawa-border hawa-border-foreground/10 hawa-bg-background hawa-p-5 hawa-text-gray-500 peer-checked:hawa-border-primary peer-checked:hawa-text-primary dark:hawa-border-foreground/10 dark:hawa-bg-foreground/5 dark:hawa-text-gray-400 dark:peer-checked:hawa-text-primary",
266
+ opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hover:hawa-bg-foreground/10 hover:hawa-text-gray-600 dark:hover:hawa-bg-foreground/20 dark:hover:hawa-text-gray-300"
267
+ )
268
+ },
269
+ /* @__PURE__ */ React2.createElement("div", { className: "hawa-block hawa-h-full hawa-w-full" }, /* @__PURE__ */ React2.createElement("div", { className: "hawa-w-full hawa-text-lg hawa-font-semibold" }, opt.label), /* @__PURE__ */ React2.createElement("div", { className: "hawa-w-full" }, opt.sublabel))
270
+ ))));
271
+ default:
272
+ return /* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-col hawa-gap-2" }, props.label && /* @__PURE__ */ React2.createElement(Label, { ...labelProps }, props.label), /* @__PURE__ */ React2.createElement("div", { className: cn(orientationStyle[orientation], "hawa-gap-2") }, props.options && props.options.map((opt, i) => /* @__PURE__ */ React2.createElement(
273
+ "div",
274
+ {
275
+ className: cn(
276
+ "radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
277
+ props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
278
+ ),
279
+ key: i + 1
280
+ },
281
+ /* @__PURE__ */ React2.createElement(
282
+ "input",
283
+ {
284
+ disabled: opt.disabled,
285
+ id: opt.value.toString(),
286
+ type: "radio",
287
+ value: opt.value,
288
+ name,
289
+ onChange: () => handleChange(opt)
290
+ }
291
+ ),
292
+ /* @__PURE__ */ React2.createElement(
293
+ "label",
294
+ {
295
+ htmlFor: opt.value.toString(),
296
+ className: cn(
297
+ "hawa-text-sm hawa-font-medium dark:hawa-text-white",
298
+ opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
299
+ )
300
+ },
301
+ opt.label
302
+ )
303
+ ))), /* @__PURE__ */ React2.createElement(
304
+ "p",
305
+ {
306
+ className: cn(
307
+ "hawa-my-0 hawa-text-start hawa-text-xs hawa-text-helper-color hawa-transition-all",
308
+ props.helperText ? "hawa-h-4 hawa-opacity-100" : "hawa-h-0 hawa-opacity-0"
309
+ )
310
+ },
311
+ props.helperText
312
+ ));
313
+ }
314
+ }
315
+ );
316
+
317
+ export {
318
+ Popover,
319
+ Radio
320
+ };