@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
@@ -0,0 +1,38 @@
1
+ // components/elements/appStores/AppStores.tsx
2
+ import React from "react";
3
+ var AppStores = (props) => {
4
+ return /* @__PURE__ */ React.createElement("div", { className: "hawa-flex hawa-justify-center" }, /* @__PURE__ */ React.createElement("div", null, props.store === "apple" ? /* @__PURE__ */ React.createElement("div", { className: "hawa-mt-3 hawa-flex hawa-h-14 hawa-w-48 hawa-items-center hawa-justify-center hawa-rounded-lg hawa-bg-black hawa-text-white dark:hawa-bg-white dark:hawa-text-black" }, /* @__PURE__ */ React.createElement("div", { className: "hawa-mr-3" }, /* @__PURE__ */ React.createElement("svg", { viewBox: "0 0 384 512", width: "30" }, /* @__PURE__ */ React.createElement(
5
+ "path",
6
+ {
7
+ fill: "currentColor",
8
+ d: "M318.7 268.7c-.2-36.7 16.4-64.4 50-84.8-18.8-26.9-47.2-41.7-84.7-44.6-35.5-2.8-74.3 20.7-88.5 20.7-15 0-49.4-19.7-76.4-19.7C63.3 141.2 4 184.8 4 273.5q0 39.3 14.4 81.2c12.8 36.7 59 126.7 107.2 125.2 25.2-.6 43-17.9 75.8-17.9 31.8 0 48.3 17.9 76.4 17.9 48.6-.7 90.4-82.5 102.6-119.3-65.2-30.7-61.7-90-61.7-91.9zm-56.6-164.2c27.3-32.4 24.8-61.9 24-72.5-24.1 1.4-52 16.4-67.9 34.9-17.5 19.8-27.8 44.3-25.6 71.9 26.1 2 49.9-11.4 69.5-34.3z"
9
+ }
10
+ ))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "hawa-text-xs" }, "Download on the"), /* @__PURE__ */ React.createElement("div", { className: "hawa--mt-1 hawa-font-sans hawa-text-2xl hawa-font-semibold" }, "App Store"))) : /* @__PURE__ */ React.createElement("div", { className: "hawa-mt-3 hawa-flex hawa-h-14 hawa-w-48 hawa-items-center hawa-justify-center hawa-rounded-lg hawa-border hawa-border-black hawa-bg-black hawa-text-white dark:hawa-bg-white dark:hawa-text-black" }, /* @__PURE__ */ React.createElement("div", { className: "hawa-mr-3" }, /* @__PURE__ */ React.createElement("svg", { viewBox: "30 336.7 120.9 129.2", width: "30" }, /* @__PURE__ */ React.createElement(
11
+ "path",
12
+ {
13
+ fill: "#FFD400",
14
+ d: "M119.2,421.2c15.3-8.4,27-14.8,28-15.3c3.2-1.7,6.5-6.2,0-9.7 c-2.1-1.1-13.4-7.3-28-15.3l-20.1,20.2L119.2,421.2z"
15
+ }
16
+ ), /* @__PURE__ */ React.createElement(
17
+ "path",
18
+ {
19
+ fill: "#FF3333",
20
+ d: "M99.1,401.1l-64.2,64.7c1.5,0.2,3.2-0.2,5.2-1.3 c4.2-2.3,48.8-26.7,79.1-43.3L99.1,401.1L99.1,401.1z"
21
+ }
22
+ ), /* @__PURE__ */ React.createElement(
23
+ "path",
24
+ {
25
+ fill: "#48FF48",
26
+ d: "M99.1,401.1l20.1-20.2c0,0-74.6-40.7-79.1-43.1 c-1.7-1-3.6-1.3-5.3-1L99.1,401.1z"
27
+ }
28
+ ), /* @__PURE__ */ React.createElement(
29
+ "path",
30
+ {
31
+ fill: "#3BCCFF",
32
+ d: "M99.1,401.1l-64.3-64.3c-2.6,0.6-4.8,2.9-4.8,7.6 c0,7.5,0,107.5,0,113.8c0,4.3,1.7,7.4,4.9,7.7L99.1,401.1z"
33
+ }
34
+ ))), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement("div", { className: "hawa-text-xs" }, "GET IT ON"), /* @__PURE__ */ React.createElement("div", { className: "hawa--mt-1 hawa-font-sans hawa-text-xl hawa-font-semibold" }, "Google Play")))));
35
+ };
36
+ export {
37
+ AppStores
38
+ };
@@ -1,7 +1,122 @@
1
1
  import {
2
- Avatar
3
- } from "../chunk-POT2IP62.mjs";
4
- import "../chunk-TE3BKEXL.mjs";
2
+ cn
3
+ } from "../chunk-TE3BKEXL.mjs";
4
+
5
+ // components/elements/avatar/Avatar.tsx
6
+ import React2 from "react";
7
+
8
+ // components/elements/FileUploader.tsx
9
+ import React, { useRef } from "react";
10
+ var FileUploader = ({ handleFile, className }) => {
11
+ const hiddenFileInput = useRef(null);
12
+ const handleClick = () => {
13
+ var _a;
14
+ (_a = hiddenFileInput.current) == null ? void 0 : _a.click();
15
+ };
16
+ const handleChange = (event) => {
17
+ const fileUploaded = event.target.files[0];
18
+ handleFile(fileUploaded);
19
+ };
20
+ return /* @__PURE__ */ React.createElement("div", { className }, /* @__PURE__ */ React.createElement("div", { className: "hawa-h-full hawa-w-full", onClick: handleClick }), /* @__PURE__ */ React.createElement(
21
+ "input",
22
+ {
23
+ type: "file",
24
+ onChange: handleChange,
25
+ ref: hiddenFileInput,
26
+ style: { display: "none" }
27
+ }
28
+ ));
29
+ };
30
+
31
+ // components/elements/avatar/Avatar.tsx
32
+ var Avatar = ({
33
+ isUploadable,
34
+ src,
35
+ alt,
36
+ size = "default",
37
+ radius = "inherit",
38
+ icon,
39
+ className,
40
+ ...props
41
+ }) => {
42
+ let sizeStyles = {
43
+ "2xs": "hawa-h-4 hawa-w-4",
44
+ xs: "hawa-h-6 hawa-w-6",
45
+ sm: "hawa-h-8 hawa-w-8",
46
+ default: "hawa-h-10 hawa-w-10",
47
+ lg: "hawa-h-12 hawa-w-12",
48
+ xl: "hawa-h-14 hawa-w-14",
49
+ "2xl": "hawa-h-16 hawa-w-16",
50
+ "3xl": "hawa-h-[72px] hawa-w-[72px]",
51
+ "4xl": "hawa-h-20 hawa-w-20",
52
+ "5xl": "hawa-h-[88px] hawa-w-[88px]",
53
+ "6xl": "hawa-h-24 hawa-w-24"
54
+ };
55
+ let radiusStyles = {
56
+ full: "hawa-rounded-full",
57
+ inherit: "hawa-rounded",
58
+ none: "hawa-rounded-none"
59
+ };
60
+ return /* @__PURE__ */ React2.createElement(
61
+ "div",
62
+ {
63
+ className: cn(
64
+ "hawa-relative hawa-bg-card hawa-p-0",
65
+ sizeStyles[size],
66
+ radiusStyles[radius],
67
+ className
68
+ )
69
+ },
70
+ /* @__PURE__ */ React2.createElement(
71
+ FileUploader,
72
+ {
73
+ className: cn(
74
+ "hawa-absolute hawa-left-0 hawa-top-0 hawa-w-full hawa-cursor-pointer hawa-bg-red-400 hawa-opacity-0",
75
+ sizeStyles[size],
76
+ radiusStyles[radius],
77
+ (!isUploadable || !!src) && "hawa-hidden"
78
+ )
79
+ }
80
+ ),
81
+ /* @__PURE__ */ React2.createElement(
82
+ "img",
83
+ {
84
+ className: cn(
85
+ "hawa-blue-400 hawa-object-cover",
86
+ sizeStyles[size],
87
+ radiusStyles[radius],
88
+ !src && "hawa-hidden"
89
+ ),
90
+ src,
91
+ alt
92
+ }
93
+ ),
94
+ !src && !isUploadable && /* @__PURE__ */ React2.createElement(
95
+ "div",
96
+ {
97
+ className: cn(
98
+ sizeStyles[size],
99
+ "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center"
100
+ )
101
+ },
102
+ icon ? icon : /* @__PURE__ */ React2.createElement(
103
+ "svg",
104
+ {
105
+ xmlns: "http://www.w3.org/2000/svg",
106
+ style: { width: "50%", opacity: 0.35 },
107
+ viewBox: "0 0 24 24",
108
+ fill: "none",
109
+ stroke: "currentColor",
110
+ strokeWidth: "2",
111
+ strokeLinecap: "round",
112
+ strokeLinejoin: "round"
113
+ },
114
+ /* @__PURE__ */ React2.createElement("circle", { cx: "12", cy: "8", r: "5" }),
115
+ /* @__PURE__ */ React2.createElement("path", { d: "M20 21a8 8 0 1 0-16 0" })
116
+ )
117
+ )
118
+ );
119
+ };
5
120
  export {
6
121
  Avatar
7
122
  };
@@ -1,9 +1,107 @@
1
1
  import {
2
- BackToTop
3
- } from "../chunk-IQPGAHUR.mjs";
4
- import "../chunk-SYB66JGL.mjs";
2
+ Button
3
+ } from "../chunk-SYB66JGL.mjs";
5
4
  import "../chunk-PUQV6URH.mjs";
6
- import "../chunk-TE3BKEXL.mjs";
5
+ import {
6
+ cn
7
+ } from "../chunk-TE3BKEXL.mjs";
8
+
9
+ // components/elements/backToTop/BackToTop.tsx
10
+ import React, { useState, useEffect, useRef } from "react";
11
+ var BackToTop = ({ ...props }) => {
12
+ const [visible, setVisible] = useState(false);
13
+ const [rect, _setRect] = useState(null);
14
+ const self = useRef(null);
15
+ const _rect = useRef(rect);
16
+ const setRect = (data) => {
17
+ _rect.current = data;
18
+ _setRect(data);
19
+ };
20
+ const getCoords = () => {
21
+ let anchor = props.anchor.current;
22
+ if (anchor) {
23
+ return [anchor.scrollTop, anchor.scrollLeft];
24
+ }
25
+ return [0, 0];
26
+ };
27
+ const onScroll = () => {
28
+ var _a;
29
+ let [scrollTop, scrollLeft] = getCoords();
30
+ let rect2 = (_a = props.anchor.current) == null ? void 0 : _a.getBoundingClientRect();
31
+ if (rect2) {
32
+ setVisible(scrollTop >= rect2.height + (props.paddingThreshold || 100));
33
+ }
34
+ };
35
+ const backToTop = () => {
36
+ if (props.anchor.current) {
37
+ props.anchor.current.scrollTo({ top: 0, behavior: "smooth" });
38
+ }
39
+ };
40
+ useEffect(() => {
41
+ if (!props.anchor.current)
42
+ return;
43
+ props.anchor.current.addEventListener("scroll", onScroll);
44
+ let interval = setInterval(() => {
45
+ if (!props.anchor.current)
46
+ return;
47
+ let newRect = props.anchor.current.getBoundingClientRect();
48
+ if (_rect.current == null)
49
+ return setRect(newRect);
50
+ if (!(_rect.current.top == newRect.top && _rect.current.left == newRect.left && _rect.current.width == newRect.width && _rect.current.height == newRect.height)) {
51
+ setRect(newRect);
52
+ }
53
+ }, 1);
54
+ return () => {
55
+ var _a;
56
+ (_a = props.anchor.current) == null ? void 0 : _a.removeEventListener("scroll", onScroll);
57
+ clearInterval(interval);
58
+ };
59
+ }, [onScroll, props.anchor]);
60
+ const getStyles = () => {
61
+ var _a;
62
+ if (!props.anchor.current || !self.current)
63
+ return {};
64
+ let corner = props.corner || "bottom-right";
65
+ let [vertical, horizontal] = corner.split("-");
66
+ let anchorRect = props.anchor.current.getBoundingClientRect();
67
+ let selfRect = (_a = self.current) == null ? void 0 : _a.getBoundingClientRect();
68
+ let width = horizontal == "right" ? anchorRect.width - selfRect.width : 0;
69
+ let height = vertical == "bottom" ? anchorRect.height - selfRect.height : 0;
70
+ let style = {
71
+ top: anchorRect.y + height + (vertical == "bottom" ? -1 : 1) * (props.paddingX || 10),
72
+ left: anchorRect.x + width + (horizontal == "right" ? -1 : 1) * (props.paddingX || 25)
73
+ };
74
+ return style;
75
+ };
76
+ return /* @__PURE__ */ React.createElement(
77
+ Button,
78
+ {
79
+ className: cn(
80
+ "hawa-fixed hawa-cursor-pointer hawa-rounded hawa-transition-all",
81
+ visible ? "hawa-pointer-events-all hawa-opacity-100" : "hawa-pointer-events-none hawa-opacity-0"
82
+ ),
83
+ onClick: backToTop,
84
+ style: {
85
+ ...getStyles(),
86
+ transitionProperty: "opacity, background-color"
87
+ },
88
+ ref: self,
89
+ size: "icon"
90
+ },
91
+ /* @__PURE__ */ React.createElement(
92
+ "svg",
93
+ {
94
+ className: cn(
95
+ "hawa-h-6 hawa-w-6 hawa-shrink-0 hawa-rotate-180 hawa-transition-all disabled:hawa-bg-gray-200"
96
+ ),
97
+ "aria-label": "Arrow Icon",
98
+ viewBox: "0 0 20 20",
99
+ fill: "currentColor"
100
+ },
101
+ /* @__PURE__ */ React.createElement("path", { d: "M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" })
102
+ )
103
+ );
104
+ };
7
105
  export {
8
106
  BackToTop
9
107
  };
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // components/elements/badge/index.ts
31
+ var badge_exports = {};
32
+ __export(badge_exports, {
33
+ Badge: () => Badge,
34
+ BadgedComponent: () => BadgedComponent
35
+ });
36
+ module.exports = __toCommonJS(badge_exports);
37
+
38
+ // components/elements/badge/Badge.tsx
39
+ var import_react = __toESM(require("react"));
40
+
41
+ // components/util.ts
42
+ var import_clsx = require("clsx");
43
+ var import_tailwind_merge = require("tailwind-merge");
44
+ function cn(...inputs) {
45
+ return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
46
+ }
47
+
48
+ // components/elements/badge/Badge.tsx
49
+ var Badge = ({
50
+ anchor,
51
+ position = "right",
52
+ size = "default",
53
+ text,
54
+ className
55
+ }) => {
56
+ const [badgePosition, setBadgePosition] = (0, import_react.useState)(null);
57
+ const indicatorRef = (0, import_react.useRef)(null);
58
+ const sizeStyles = {
59
+ small: { top: 4, left: 6, right: 7, classes: "hawa-w-3 hawa-h-3" },
60
+ default: { top: 4, left: 7, right: 5, classes: "hawa-w-3 hawa-h-3" },
61
+ large: { top: 6, left: 12, right: 7, classes: "hawa-w-6 hawa-h-6" }
62
+ };
63
+ (0, import_react.useEffect)(() => {
64
+ const handlePositioning = () => {
65
+ var _a;
66
+ if (anchor.current && indicatorRef.current) {
67
+ const rect = anchor.current.getBoundingClientRect();
68
+ const parentRect = (_a = indicatorRef.current.parentElement) == null ? void 0 : _a.getBoundingClientRect();
69
+ const style = window.getComputedStyle(anchor.current);
70
+ const marginTop = parseFloat(style.marginTop.replace("px", ""));
71
+ const marginRight = parseFloat(style.marginRight.replace("px", ""));
72
+ if (parentRect) {
73
+ setBadgePosition({
74
+ top: rect.top - parentRect.top - marginTop - sizeStyles[size].top,
75
+ left: position === "right" ? parentRect.right - parentRect.left - sizeStyles[size].left : rect.right - parentRect.left - parentRect.width - marginRight - sizeStyles[size].right
76
+ });
77
+ }
78
+ }
79
+ };
80
+ handlePositioning();
81
+ window.addEventListener("resize", handlePositioning);
82
+ return () => {
83
+ window.removeEventListener("resize", handlePositioning);
84
+ };
85
+ }, [anchor]);
86
+ return /* @__PURE__ */ import_react.default.createElement("div", { ref: indicatorRef, className: cn("hawa-relative", className) }, badgePosition && /* @__PURE__ */ import_react.default.createElement(
87
+ "div",
88
+ {
89
+ style: {
90
+ position: "absolute",
91
+ top: badgePosition == null ? void 0 : badgePosition.top,
92
+ left: badgePosition == null ? void 0 : badgePosition.left
93
+ },
94
+ className: cn(
95
+ "hawa-origin-center hawa-rounded-full hawa-bg-red-500 ",
96
+ sizeStyles[size].classes,
97
+ "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-text-[9px] hawa-text-white"
98
+ )
99
+ },
100
+ size === "large" && text && text
101
+ ));
102
+ };
103
+ var BadgedComponent = ({
104
+ children,
105
+ className,
106
+ hideBadge,
107
+ position,
108
+ size,
109
+ text
110
+ }) => {
111
+ const ref = (0, import_react.useRef)(null);
112
+ return /* @__PURE__ */ import_react.default.createElement("div", { className: cn("hawa-relative hawa-w-fit", className), ref }, !hideBadge && /* @__PURE__ */ import_react.default.createElement(
113
+ Badge,
114
+ {
115
+ size,
116
+ text,
117
+ position,
118
+ anchor: ref,
119
+ className: "hawa-z-10"
120
+ }
121
+ ), children);
122
+ };
123
+ // Annotate the CommonJS export names for ESM import in node:
124
+ 0 && (module.exports = {
125
+ Badge,
126
+ BadgedComponent
127
+ });
@@ -0,0 +1,84 @@
1
+ import {
2
+ cn
3
+ } from "../chunk-TE3BKEXL.mjs";
4
+
5
+ // components/elements/badge/Badge.tsx
6
+ import React, { useEffect, useState, useRef } from "react";
7
+ var Badge = ({
8
+ anchor,
9
+ position = "right",
10
+ size = "default",
11
+ text,
12
+ className
13
+ }) => {
14
+ const [badgePosition, setBadgePosition] = useState(null);
15
+ const indicatorRef = useRef(null);
16
+ const sizeStyles = {
17
+ small: { top: 4, left: 6, right: 7, classes: "hawa-w-3 hawa-h-3" },
18
+ default: { top: 4, left: 7, right: 5, classes: "hawa-w-3 hawa-h-3" },
19
+ large: { top: 6, left: 12, right: 7, classes: "hawa-w-6 hawa-h-6" }
20
+ };
21
+ useEffect(() => {
22
+ const handlePositioning = () => {
23
+ var _a;
24
+ if (anchor.current && indicatorRef.current) {
25
+ const rect = anchor.current.getBoundingClientRect();
26
+ const parentRect = (_a = indicatorRef.current.parentElement) == null ? void 0 : _a.getBoundingClientRect();
27
+ const style = window.getComputedStyle(anchor.current);
28
+ const marginTop = parseFloat(style.marginTop.replace("px", ""));
29
+ const marginRight = parseFloat(style.marginRight.replace("px", ""));
30
+ if (parentRect) {
31
+ setBadgePosition({
32
+ top: rect.top - parentRect.top - marginTop - sizeStyles[size].top,
33
+ left: position === "right" ? parentRect.right - parentRect.left - sizeStyles[size].left : rect.right - parentRect.left - parentRect.width - marginRight - sizeStyles[size].right
34
+ });
35
+ }
36
+ }
37
+ };
38
+ handlePositioning();
39
+ window.addEventListener("resize", handlePositioning);
40
+ return () => {
41
+ window.removeEventListener("resize", handlePositioning);
42
+ };
43
+ }, [anchor]);
44
+ return /* @__PURE__ */ React.createElement("div", { ref: indicatorRef, className: cn("hawa-relative", className) }, badgePosition && /* @__PURE__ */ React.createElement(
45
+ "div",
46
+ {
47
+ style: {
48
+ position: "absolute",
49
+ top: badgePosition == null ? void 0 : badgePosition.top,
50
+ left: badgePosition == null ? void 0 : badgePosition.left
51
+ },
52
+ className: cn(
53
+ "hawa-origin-center hawa-rounded-full hawa-bg-red-500 ",
54
+ sizeStyles[size].classes,
55
+ "hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-text-[9px] hawa-text-white"
56
+ )
57
+ },
58
+ size === "large" && text && text
59
+ ));
60
+ };
61
+ var BadgedComponent = ({
62
+ children,
63
+ className,
64
+ hideBadge,
65
+ position,
66
+ size,
67
+ text
68
+ }) => {
69
+ const ref = useRef(null);
70
+ return /* @__PURE__ */ React.createElement("div", { className: cn("hawa-relative hawa-w-fit", className), ref }, !hideBadge && /* @__PURE__ */ React.createElement(
71
+ Badge,
72
+ {
73
+ size,
74
+ text,
75
+ position,
76
+ anchor: ref,
77
+ className: "hawa-z-10"
78
+ }
79
+ ), children);
80
+ };
81
+ export {
82
+ Badge,
83
+ BadgedComponent
84
+ };