@sikka/hawa 0.23.2-next → 0.23.7-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 (145) hide show
  1. package/dist/accordion/index.js +30 -2399
  2. package/dist/accordion/index.mjs +19 -461
  3. package/dist/alert/index.mjs +0 -1
  4. package/dist/appStores/index.js +75 -0
  5. package/dist/appStores/index.mjs +38 -0
  6. package/dist/avatar/index.mjs +118 -3
  7. package/dist/backToTop/index.mjs +102 -4
  8. package/dist/badge/index.js +127 -0
  9. package/dist/badge/index.mjs +84 -0
  10. package/dist/blocks/auth/index.js +1173 -3092
  11. package/dist/blocks/auth/index.mjs +16 -10
  12. package/dist/blocks/feedback/index.js +864 -2913
  13. package/dist/blocks/feedback/index.mjs +14 -8
  14. package/dist/blocks/index.js +5714 -5316
  15. package/dist/blocks/index.mjs +390 -45
  16. package/dist/blocks/misc/index.js +634 -2409
  17. package/dist/blocks/misc/index.mjs +14 -8
  18. package/dist/blocks/pricing/index.js +522 -524
  19. package/dist/blocks/pricing/index.mjs +1861 -45
  20. package/dist/breadcrumb/index.js +63 -0
  21. package/dist/breadcrumb/index.mjs +26 -0
  22. package/dist/card/index.mjs +83 -8
  23. package/dist/checkbox/index.mjs +138 -3
  24. package/dist/chip/index.js +129 -0
  25. package/dist/chip/index.mjs +8 -0
  26. package/dist/{chunk-X6PCWJYD.mjs → chunk-2R2QPJT7.mjs} +761 -1104
  27. package/dist/chunk-677VOLD4.mjs +464 -0
  28. package/dist/chunk-72HYR6WB.mjs +88 -0
  29. package/dist/chunk-A25EXELT.mjs +131 -0
  30. package/dist/{chunk-OE27DSIY.mjs → chunk-F6TKEDDP.mjs} +2 -4
  31. package/dist/{chunk-YFC2GSJ6.mjs → chunk-P2O6R3S6.mjs} +66 -5
  32. package/dist/{chunk-GXXX5UB4.mjs → chunk-QGKW5R5F.mjs} +59 -20
  33. package/dist/chunk-TR56G3NM.mjs +2350 -0
  34. package/dist/chunk-UAVBFK53.mjs +346 -0
  35. package/dist/combobox/index.mjs +153 -7
  36. package/dist/dataTable/index.mjs +355 -8
  37. package/dist/elements/index.js +800 -1148
  38. package/dist/elements/index.mjs +1 -11
  39. package/dist/fileDropzone/index.mjs +226 -4
  40. package/dist/index.js +1721 -1721
  41. package/dist/index.mjs +1663 -1663
  42. package/dist/layout/index.js +493 -510
  43. package/dist/layout/index.mjs +1 -1
  44. package/dist/loading/index.mjs +0 -1
  45. package/dist/logos/index.mjs +204 -3
  46. package/dist/navigationMenu/index.mjs +155 -13
  47. package/dist/phoneInput/index.js +2074 -0
  48. package/dist/phoneInput/index.mjs +1776 -0
  49. package/dist/pinInput/index.js +130 -0
  50. package/dist/pinInput/index.mjs +88 -0
  51. package/dist/progress/index.js +71 -0
  52. package/dist/progress/index.mjs +29 -0
  53. package/dist/radio/index.mjs +202 -4
  54. package/dist/scrollArea/index.js +90 -0
  55. package/dist/scrollArea/index.mjs +47 -0
  56. package/dist/select/index.mjs +1 -1
  57. package/dist/sheet/index.mjs +137 -12
  58. package/dist/sortButton/index.mjs +40 -4
  59. package/dist/stopPropagationWrapper/index.js +48 -0
  60. package/dist/stopPropagationWrapper/index.mjs +11 -0
  61. package/dist/switch/index.mjs +79 -3
  62. package/dist/tabs/index.js +1 -1
  63. package/dist/tabs/index.mjs +68 -6
  64. package/dist/textarea/index.mjs +54 -4
  65. package/package.json +2 -2
  66. package/dist/Chip-DJ6ThZc_.d.ts +0 -21
  67. package/dist/Chip-eal8vwDz.d.mts +0 -21
  68. package/dist/accordion/index.d.mts +0 -42
  69. package/dist/accordion/index.d.ts +0 -42
  70. package/dist/alert/index.d.mts +0 -28
  71. package/dist/alert/index.d.ts +0 -28
  72. package/dist/avatar/index.d.mts +0 -15
  73. package/dist/avatar/index.d.ts +0 -15
  74. package/dist/backToTop/index.d.mts +0 -15
  75. package/dist/backToTop/index.d.ts +0 -15
  76. package/dist/button/index.d.mts +0 -16
  77. package/dist/button/index.d.ts +0 -16
  78. package/dist/card/index.d.mts +0 -17
  79. package/dist/card/index.d.ts +0 -17
  80. package/dist/checkbox/index.d.mts +0 -20
  81. package/dist/checkbox/index.d.ts +0 -20
  82. package/dist/chunk-BK5WF7UO.mjs +0 -231
  83. package/dist/chunk-CXWYC6FS.mjs +0 -360
  84. package/dist/chunk-D2USGMDT.mjs +0 -208
  85. package/dist/chunk-DX4SLF2L.mjs +0 -45
  86. package/dist/chunk-ENNSA4VR.mjs +0 -5566
  87. package/dist/chunk-GXSYCLZZ.mjs +0 -158
  88. package/dist/chunk-IQPGAHUR.mjs +0 -107
  89. package/dist/chunk-POT2IP62.mjs +0 -123
  90. package/dist/chunk-TWDZB2VH.mjs +0 -151
  91. package/dist/chunk-VBTYVVA7.mjs +0 -93
  92. package/dist/chunk-VCGW5DIP.mjs +0 -170
  93. package/dist/chunk-X3SMPIA3.mjs +0 -0
  94. package/dist/chunk-XA646BZ2.mjs +0 -143
  95. package/dist/chunk-ZCUUQ5VV.mjs +0 -84
  96. package/dist/combobox/index.d.mts +0 -32
  97. package/dist/combobox/index.d.ts +0 -32
  98. package/dist/command/index.d.mts +0 -48
  99. package/dist/command/index.d.ts +0 -48
  100. package/dist/commonTypes-gbO4hPli.d.mts +0 -7
  101. package/dist/commonTypes-gbO4hPli.d.ts +0 -7
  102. package/dist/dataTable/index.d.mts +0 -39
  103. package/dist/dataTable/index.d.ts +0 -39
  104. package/dist/dialog/index.d.mts +0 -57
  105. package/dist/dialog/index.d.ts +0 -57
  106. package/dist/dropdownMenu/index.d.mts +0 -95
  107. package/dist/dropdownMenu/index.d.ts +0 -95
  108. package/dist/fileDropzone/index.d.mts +0 -37
  109. package/dist/fileDropzone/index.d.ts +0 -37
  110. package/dist/input/index.d.mts +0 -36
  111. package/dist/input/index.d.ts +0 -36
  112. package/dist/label/index.d.mts +0 -12
  113. package/dist/label/index.d.ts +0 -12
  114. package/dist/loading/index.d.mts +0 -15
  115. package/dist/loading/index.d.ts +0 -15
  116. package/dist/logos/index.d.mts +0 -27
  117. package/dist/logos/index.d.ts +0 -27
  118. package/dist/navigationMenu/index.d.mts +0 -39
  119. package/dist/navigationMenu/index.d.ts +0 -39
  120. package/dist/popover/index.d.mts +0 -23
  121. package/dist/popover/index.d.ts +0 -23
  122. package/dist/radio/index.d.mts +0 -28
  123. package/dist/radio/index.d.ts +0 -28
  124. package/dist/select/index.d.mts +0 -43
  125. package/dist/select/index.d.ts +0 -43
  126. package/dist/sheet/index.d.mts +0 -30
  127. package/dist/sheet/index.d.ts +0 -30
  128. package/dist/skeleton/index.d.mts +0 -10
  129. package/dist/skeleton/index.d.ts +0 -10
  130. package/dist/sortButton/index.d.mts +0 -10
  131. package/dist/sortButton/index.d.ts +0 -10
  132. package/dist/splitButton/index.d.mts +0 -15
  133. package/dist/splitButton/index.d.ts +0 -15
  134. package/dist/switch/index.d.mts +0 -12
  135. package/dist/switch/index.d.ts +0 -12
  136. package/dist/table/index.d.mts +0 -21
  137. package/dist/table/index.d.ts +0 -21
  138. package/dist/tabs/index.d.mts +0 -16
  139. package/dist/tabs/index.d.ts +0 -16
  140. package/dist/textarea/index.d.mts +0 -17
  141. package/dist/textarea/index.d.ts +0 -17
  142. package/dist/tooltip/index.d.mts +0 -26
  143. package/dist/tooltip/index.d.ts +0 -26
  144. /package/dist/{chunk-A7OPD7H7.mjs → chunk-B6UCD4GP.mjs} +0 -0
  145. /package/dist/{chunk-O2ALK7UE.mjs → chunk-Z4M72OD3.mjs} +0 -0
@@ -4,8 +4,6 @@ import {
4
4
  AccordionItem,
5
5
  AccordionRoot,
6
6
  AccordionTrigger,
7
- ActionCard,
8
- AdCard,
9
7
  Alert,
10
8
  AppStores,
11
9
  Avatar,
@@ -72,9 +70,7 @@ import {
72
70
  FileUploader,
73
71
  Input,
74
72
  InterfaceSettings,
75
- ItemCard,
76
73
  Label,
77
- LandingCard,
78
74
  Loading,
79
75
  Logos,
80
76
  NavigationMenu,
@@ -94,7 +90,6 @@ import {
94
90
  Popover,
95
91
  PopoverContent,
96
92
  PopoverTrigger,
97
- PricingCard,
98
93
  Progress,
99
94
  ProgressCircle,
100
95
  Radio,
@@ -144,7 +139,7 @@ import {
144
139
  Tooltip,
145
140
  buttonVariants,
146
141
  navigationMenuTriggerStyle
147
- } from "../chunk-X6PCWJYD.mjs";
142
+ } from "../chunk-2R2QPJT7.mjs";
148
143
  import "../chunk-343SRWR4.mjs";
149
144
  export {
150
145
  Accordion,
@@ -152,8 +147,6 @@ export {
152
147
  AccordionItem,
153
148
  AccordionRoot,
154
149
  AccordionTrigger,
155
- ActionCard,
156
- AdCard,
157
150
  Alert,
158
151
  AppStores,
159
152
  Avatar,
@@ -220,9 +213,7 @@ export {
220
213
  FileUploader,
221
214
  Input,
222
215
  InterfaceSettings,
223
- ItemCard,
224
216
  Label,
225
- LandingCard,
226
217
  Loading,
227
218
  Logos,
228
219
  NavigationMenu,
@@ -242,7 +233,6 @@ export {
242
233
  Popover,
243
234
  PopoverContent,
244
235
  PopoverTrigger,
245
- PricingCard,
246
236
  Progress,
247
237
  ProgressCircle,
248
238
  Radio,
@@ -1,10 +1,232 @@
1
1
  import {
2
- FileDropzone
3
- } from "../chunk-BK5WF7UO.mjs";
4
- import "../chunk-FRDYTR55.mjs";
5
- import "../chunk-SYB66JGL.mjs";
2
+ Alert
3
+ } from "../chunk-FRDYTR55.mjs";
4
+ import {
5
+ Button
6
+ } from "../chunk-SYB66JGL.mjs";
6
7
  import "../chunk-PUQV6URH.mjs";
7
8
  import "../chunk-TE3BKEXL.mjs";
9
+
10
+ // components/elements/fileDropzone/FileDropzone.tsx
11
+ import React, { useEffect, useState } from "react";
12
+ import { useDropzone } from "react-dropzone";
13
+ import clsx from "clsx";
14
+ var FileDropzone = ({
15
+ texts,
16
+ files,
17
+ setFiles,
18
+ setDeletedFiles,
19
+ onAcceptedFiles,
20
+ errorMessages,
21
+ maxFiles,
22
+ accept,
23
+ showPreview,
24
+ onDeleteFile,
25
+ onClearFiles,
26
+ disclaimer,
27
+ maxSize,
28
+ label,
29
+ termsLink,
30
+ privacyLink
31
+ }) => {
32
+ var _a, _b, _c, _d, _e, _f;
33
+ const [cmp, setCmp] = useState(0);
34
+ const [max, setMax] = useState(0);
35
+ const {
36
+ getRootProps,
37
+ getInputProps,
38
+ fileRejections,
39
+ acceptedFiles,
40
+ isDragActive
41
+ } = useDropzone({
42
+ multiple: true,
43
+ accept,
44
+ maxSize,
45
+ maxFiles,
46
+ onDrop: (acceptedFiles2) => {
47
+ setFiles(
48
+ acceptedFiles2.map(
49
+ (file, index) => Object.assign(file, {
50
+ preview: URL.createObjectURL(file)
51
+ })
52
+ )
53
+ );
54
+ }
55
+ });
56
+ useEffect(
57
+ () => () => {
58
+ files == null ? void 0 : files.forEach((file) => {
59
+ URL.revokeObjectURL(file.preview);
60
+ });
61
+ },
62
+ [files]
63
+ );
64
+ useEffect(() => {
65
+ setFiles(acceptedFiles);
66
+ }, [acceptedFiles, cmp, setFiles]);
67
+ onClearFiles = () => {
68
+ acceptedFiles.length = 0;
69
+ acceptedFiles.splice(0, acceptedFiles.length);
70
+ setFiles([]);
71
+ };
72
+ const clearAllFiles = () => {
73
+ acceptedFiles.length = 0;
74
+ setFiles([]);
75
+ };
76
+ useEffect(() => {
77
+ if (maxSize > 0) {
78
+ const k = 1024;
79
+ const sizes = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
80
+ const i = Math.floor(Math.log(maxSize) / Math.log(1024));
81
+ setMax(
82
+ parseFloat((maxSize / Math.pow(1024, i)).toFixed(2)) + " " + sizes[i]
83
+ );
84
+ }
85
+ }, [maxSize]);
86
+ const errs = fileRejections.map((rej, i) => {
87
+ switch (rej.errors[0].code) {
88
+ case "file-too-large":
89
+ return /* @__PURE__ */ React.createElement(
90
+ Alert,
91
+ {
92
+ key: i,
93
+ text: rej.file.name,
94
+ title: texts.fileTooLarge,
95
+ severity: "error"
96
+ }
97
+ );
98
+ case "too-many-files":
99
+ return /* @__PURE__ */ React.createElement(
100
+ Alert,
101
+ {
102
+ key: i,
103
+ text: rej.file.name,
104
+ title: texts.tooManyFiles,
105
+ severity: "error"
106
+ }
107
+ );
108
+ case "file-invalid-type":
109
+ return /* @__PURE__ */ React.createElement(
110
+ Alert,
111
+ {
112
+ key: i,
113
+ text: rej.file.name,
114
+ title: texts.invalidFileType,
115
+ severity: "error"
116
+ }
117
+ );
118
+ default:
119
+ return /* @__PURE__ */ React.createElement(
120
+ Alert,
121
+ {
122
+ key: i,
123
+ text: rej.file.name,
124
+ title: rej.errors[0].code,
125
+ severity: "error"
126
+ }
127
+ );
128
+ }
129
+ });
130
+ const thumbs = files == null ? void 0 : files.map((file, index) => /* @__PURE__ */ React.createElement("div", { className: "hawa-relative hawa-rounded", key: index }, /* @__PURE__ */ React.createElement(
131
+ "button",
132
+ {
133
+ onClick: (e) => {
134
+ e.stopPropagation();
135
+ acceptedFiles.splice(acceptedFiles.indexOf(file), 1);
136
+ setCmp(Math.random);
137
+ onDeleteFile(file);
138
+ },
139
+ type: "button",
140
+ className: "hawa-absolute hawa-left-0 hawa-ml-auto hawa-inline-flex hawa-items-center hawa-rounded-inner hawa-rounded-bl-none hawa-rounded-tr-none hawa-bg-gray-900 hawa-p-1.5 hawa-text-sm hawa-text-gray-400 hawa-transition-all hover:hawa-bg-gray-200 hover:hawa-text-gray-900 dark:hover:hawa-bg-gray-600 dark:hover:hawa-text-white",
141
+ "data-modal-toggle": "defaultModal"
142
+ },
143
+ /* @__PURE__ */ React.createElement(
144
+ "svg",
145
+ {
146
+ "aria-hidden": "true",
147
+ className: "hawa-h-5 hawa-w-5",
148
+ fill: "currentColor",
149
+ viewBox: "0 0 20 20"
150
+ },
151
+ /* @__PURE__ */ React.createElement(
152
+ "path",
153
+ {
154
+ fillRule: "evenodd",
155
+ d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",
156
+ clipRule: "evenodd"
157
+ }
158
+ )
159
+ ),
160
+ /* @__PURE__ */ React.createElement("span", { className: "hawa-sr-only" }, "Close modal")
161
+ ), /* @__PURE__ */ React.createElement(
162
+ "div",
163
+ {
164
+ style: {
165
+ display: "flex",
166
+ justifyContent: "center",
167
+ alignItems: "center",
168
+ overflow: "hidden",
169
+ height: 100,
170
+ width: 100,
171
+ backgroundImage: `url(${file.preview})`,
172
+ backgroundSize: "cover",
173
+ backgroundPosition: "center",
174
+ border: "1px solid black"
175
+ },
176
+ className: "hawa-rounded",
177
+ key: file.name
178
+ }
179
+ )));
180
+ return /* @__PURE__ */ React.createElement("div", null, label && /* @__PURE__ */ React.createElement("div", { className: "hawa-mb-2 hawa-block hawa-text-sm hawa-font-medium hawa-text-gray-900 dark:hawa-text-gray-300" }, label), /* @__PURE__ */ React.createElement(
181
+ "div",
182
+ {
183
+ className: clsx(
184
+ "hawa-flex hawa-flex-col hawa-justify-center hawa-rounded hawa-border hawa-border-dashed hawa-p-6 hawa-transition-all ",
185
+ isDragActive ? "hawa-bg-muted" : "hawa-bg-muted/20 hover:hawa-bg-muted/50 "
186
+ )
187
+ },
188
+ /* @__PURE__ */ React.createElement("div", { ...getRootProps({}) }, /* @__PURE__ */ React.createElement("p", { ...getInputProps() }), /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center hawa-gap-2 hawa-pt-4 hawa-text-center" }, /* @__PURE__ */ React.createElement(
189
+ "svg",
190
+ {
191
+ stroke: "currentColor",
192
+ fill: "none",
193
+ strokeWidth: "2",
194
+ viewBox: "0 0 24 24",
195
+ strokeLinecap: "round",
196
+ strokeLinejoin: "round",
197
+ height: "1.5em",
198
+ width: "1.5em"
199
+ },
200
+ /* @__PURE__ */ React.createElement("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
201
+ /* @__PURE__ */ React.createElement("path", { d: "M19 11v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2" }),
202
+ /* @__PURE__ */ React.createElement("path", { d: "M13 13l9 3l-4 2l-2 4l-3 -9" }),
203
+ /* @__PURE__ */ React.createElement("path", { d: "M3 3l0 .01" }),
204
+ /* @__PURE__ */ React.createElement("path", { d: "M7 3l0 .01" }),
205
+ /* @__PURE__ */ React.createElement("path", { d: "M11 3l0 .01" }),
206
+ /* @__PURE__ */ React.createElement("path", { d: "M15 3l0 .01" }),
207
+ /* @__PURE__ */ React.createElement("path", { d: "M3 7l0 .01" }),
208
+ /* @__PURE__ */ React.createElement("path", { d: "M3 11l0 .01" }),
209
+ /* @__PURE__ */ React.createElement("path", { d: "M3 15l0 .01" })
210
+ ), typeof texts.clickHereToUpload === "function" ? texts.clickHereToUpload() : texts.clickHereToUpload), /* @__PURE__ */ React.createElement("div", { className: "hawa-select-none hawa-pt-2 hawa-text-center hawa-text-xs" }, texts.acceptedFileTypes, " ", accept.split(",")), /* @__PURE__ */ React.createElement("div", { className: "hawa-select-none hawa-pb-2 hawa-pt-1 hawa-text-center hawa-text-xs" }, texts.maxFileSize, " ", max)),
211
+ acceptedFiles.length > 0 && /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-justify-center hawa-rounded-lg hawa-p-2 " }, /* @__PURE__ */ React.createElement(Button, { onClick: clearAllFiles }, "Clear All")),
212
+ acceptedFiles.length > 0 && thumbs && showPreview ? /* @__PURE__ */ React.createElement("aside", { className: "hawa-flex hawa-flex-row hawa-flex-wrap hawa-justify-center hawa-gap-2 hawa-rounded-lg hawa-p-2" }, thumbs) : null,
213
+ /* @__PURE__ */ React.createElement("div", { className: "px-4" }, ((_b = (_a = fileRejections[0]) == null ? void 0 : _a.errors[0]) == null ? void 0 : _b.code) && errs)
214
+ ), disclaimer && /* @__PURE__ */ React.createElement("div", { className: "hawa-mt-2 hawa-text-sm hawa-text-muted-foreground/50" }, (_c = texts.disclaimer) != null ? _c : "By uploading a file you agree to our", " ", /* @__PURE__ */ React.createElement(
215
+ "a",
216
+ {
217
+ href: termsLink,
218
+ className: "clickable-link hawa-text-muted-foreground/50"
219
+ },
220
+ (_d = texts.terms) != null ? _d : "Terms"
221
+ ), " ", (_e = texts.and) != null ? _e : "and", " ", /* @__PURE__ */ React.createElement(
222
+ "a",
223
+ {
224
+ href: privacyLink,
225
+ className: "clickable-link hawa-text-muted-foreground/50"
226
+ },
227
+ (_f = texts.privacyPolicy) != null ? _f : "Privacy Policy"
228
+ )));
229
+ };
8
230
  export {
9
231
  FileDropzone
10
232
  };