@sikka/hawa 0.39.0-next → 0.40.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.
- package/dist/{DropdownMenu-B3cTLPDi.d.mts → DropdownMenu-FVVDS2rX.d.mts} +6 -1
- package/dist/{DropdownMenu-BO1TNMm5.d.ts → DropdownMenu-SFJtRGAw.d.ts} +6 -1
- package/dist/{Radio-lgoClQrv.d.ts → Radio-DlPwVCG4.d.ts} +6 -0
- package/dist/{Radio-uQ7DtzcI.d.mts → Radio-Dyvlywnk.d.mts} +6 -0
- package/dist/alert/index.js +2 -2
- package/dist/alert/index.js.map +1 -1
- package/dist/alert/index.mjs +2 -2
- package/dist/alert/index.mjs.map +1 -1
- package/dist/appLayout/index.d.mts +2 -0
- package/dist/appLayout/index.d.ts +2 -0
- package/dist/appLayout/index.js +14 -3
- package/dist/appLayout/index.js.map +1 -1
- package/dist/appLayout/index.mjs +14 -3
- package/dist/appLayout/index.mjs.map +1 -1
- package/dist/appTopbar/index.js.map +1 -1
- package/dist/appTopbar/index.mjs.map +1 -1
- package/dist/backToTop/index.js +2 -2
- package/dist/backToTop/index.js.map +1 -1
- package/dist/backToTop/index.mjs +2 -2
- package/dist/backToTop/index.mjs.map +1 -1
- package/dist/blocks/auth/index.js +2 -2
- package/dist/blocks/auth/index.mjs +4 -4
- package/dist/blocks/feedback/index.js +162 -119
- package/dist/blocks/feedback/index.mjs +5 -5
- package/dist/blocks/index.d.mts +2 -2
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +442 -450
- package/dist/blocks/index.mjs +3 -3
- package/dist/blocks/misc/index.js +238 -289
- package/dist/blocks/misc/index.mjs +147 -200
- package/dist/blocks/pricing/index.js +162 -119
- package/dist/blocks/pricing/index.mjs +4 -4
- package/dist/button/index.d.mts +1 -1
- package/dist/button/index.d.ts +1 -1
- package/dist/button/index.js +2 -2
- package/dist/button/index.js.map +1 -1
- package/dist/button/index.mjs +2 -2
- package/dist/button/index.mjs.map +1 -1
- package/dist/calendar/index.js +2 -2
- package/dist/calendar/index.js.map +1 -1
- package/dist/calendar/index.mjs +2 -2
- package/dist/calendar/index.mjs.map +1 -1
- package/dist/{chunk-C2IX3SUD.mjs → chunk-27G5FKOP.mjs} +1 -1
- package/dist/{chunk-IC5WYNKN.mjs → chunk-AJTYKC5R.mjs} +1 -1
- package/dist/{chunk-UMOBOCED.mjs → chunk-CTNKKP2O.mjs} +2 -2
- package/dist/chunk-CTZRVSTI.mjs +346 -0
- package/dist/{chunk-XFSBC5VI.mjs → chunk-DYPGZ2IP.mjs} +1 -1
- package/dist/{chunk-UJ5SXC3M.mjs → chunk-GN7EIDTE.mjs} +1 -1
- package/dist/{chunk-VMVZM3QQ.mjs → chunk-GU2DOJ7Q.mjs} +31 -8
- package/dist/{chunk-RTK6REIK.mjs → chunk-QZIENYTE.mjs} +1 -1
- package/dist/{chunk-EZBHA2IL.mjs → chunk-RT2Q3SH7.mjs} +1 -1
- package/dist/{chunk-W3CF7BSC.mjs → chunk-UBUVHGW4.mjs} +238 -248
- package/dist/{chunk-ZBUBNKF6.mjs → chunk-XCW5YNMS.mjs} +34 -1
- package/dist/codeBlock/index.js +2 -2
- package/dist/codeBlock/index.js.map +1 -1
- package/dist/codeBlock/index.mjs +2 -2
- package/dist/codeBlock/index.mjs.map +1 -1
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +1 -1
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/command/index.js +1 -1
- package/dist/command/index.js.map +1 -1
- package/dist/command/index.mjs +1 -1
- package/dist/command/index.mjs.map +1 -1
- package/dist/commonTypes-189mW5eB.d.mts +8 -0
- package/dist/commonTypes-189mW5eB.d.ts +8 -0
- package/dist/commonTypes-DUY2LJm1.d.mts +3 -0
- package/dist/commonTypes-DUY2LJm1.d.ts +3 -0
- package/dist/commonTypes-D_7LV7Ri.d.mts +5 -0
- package/dist/commonTypes-D_7LV7Ri.d.ts +5 -0
- package/dist/dataTable/index.js +2 -2
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs +2 -2
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/datePicker/index.d.mts +1 -1
- package/dist/datePicker/index.d.ts +1 -1
- package/dist/datePicker/index.js +3 -3
- package/dist/datePicker/index.js.map +1 -1
- package/dist/datePicker/index.mjs +3 -3
- package/dist/datePicker/index.mjs.map +1 -1
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docsLayout/index.js +2 -2
- package/dist/docsLayout/index.js.map +1 -1
- package/dist/docsLayout/index.mjs +2 -2
- package/dist/docsLayout/index.mjs.map +1 -1
- package/dist/dropdownMenu/index.d.mts +6 -1
- package/dist/dropdownMenu/index.d.ts +6 -1
- package/dist/dropdownMenu/index.js +29 -6
- package/dist/dropdownMenu/index.js.map +1 -1
- package/dist/dropdownMenu/index.mjs +29 -6
- package/dist/dropdownMenu/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +7 -5
- package/dist/elements/index.d.ts +7 -5
- package/dist/elements/index.js +546 -531
- package/dist/elements/index.mjs +5 -5
- package/dist/fileDropzone/index.d.mts +2 -2
- package/dist/fileDropzone/index.d.ts +2 -2
- package/dist/fileDropzone/index.js +2 -2
- package/dist/fileDropzone/index.js.map +1 -1
- package/dist/fileDropzone/index.mjs +2 -2
- package/dist/fileDropzone/index.mjs.map +1 -1
- package/dist/fileUploader/index.d.mts +2 -2
- package/dist/fileUploader/index.d.ts +2 -2
- package/dist/glow/index.d.mts +3 -3
- package/dist/glow/index.d.ts +3 -3
- package/dist/hooks/index.d.mts +8 -1
- package/dist/hooks/index.d.ts +8 -1
- package/dist/hooks/index.js +35 -0
- package/dist/hooks/index.mjs +5 -1
- package/dist/index.css +0 -91
- package/dist/index.d.mts +26 -4
- package/dist/index.d.ts +26 -4
- package/dist/index.js +1020 -959
- package/dist/index.mjs +971 -912
- package/dist/input/index.d.mts +2 -9
- package/dist/input/index.d.ts +2 -9
- package/dist/interfaceSettings/index.js +160 -117
- package/dist/interfaceSettings/index.js.map +1 -1
- package/dist/interfaceSettings/index.mjs +160 -117
- package/dist/interfaceSettings/index.mjs.map +1 -1
- package/dist/label/index.d.mts +1 -2
- package/dist/label/index.d.ts +1 -2
- package/dist/layout/index.d.mts +3 -1
- package/dist/layout/index.d.ts +3 -1
- package/dist/layout/index.js +14 -3
- package/dist/layout/index.mjs +14 -3
- package/dist/navigationMenu/index.d.mts +2 -1
- package/dist/navigationMenu/index.d.ts +2 -1
- package/dist/pagination/index.d.mts +1 -1
- package/dist/pagination/index.d.ts +1 -1
- package/dist/phoneInput/index.d.mts +1 -1
- package/dist/phoneInput/index.d.ts +1 -1
- package/dist/progress/index.d.mts +8 -1
- package/dist/progress/index.d.ts +8 -1
- package/dist/radio/index.d.mts +15 -1
- package/dist/radio/index.d.ts +15 -1
- package/dist/radio/index.js +160 -117
- package/dist/radio/index.js.map +1 -1
- package/dist/radio/index.mjs +160 -117
- package/dist/radio/index.mjs.map +1 -1
- package/dist/scrollArea/index.d.mts +1 -1
- package/dist/scrollArea/index.d.ts +1 -1
- package/dist/separator/index.d.mts +1 -1
- package/dist/separator/index.d.ts +1 -1
- package/dist/signature/index.d.mts +1 -2
- package/dist/signature/index.d.ts +1 -2
- package/dist/simpleTable/index.d.mts +1 -1
- package/dist/simpleTable/index.d.ts +1 -1
- package/dist/sonner/index.d.mts +1 -1
- package/dist/sonner/index.d.ts +1 -1
- package/dist/sortButton/index.js +2 -2
- package/dist/sortButton/index.js.map +1 -1
- package/dist/sortButton/index.mjs +2 -2
- package/dist/sortButton/index.mjs.map +1 -1
- package/dist/splitButton/index.d.mts +3 -9
- package/dist/splitButton/index.d.ts +3 -9
- package/dist/splitButton/index.js +2 -2
- package/dist/splitButton/index.js.map +1 -1
- package/dist/splitButton/index.mjs +2 -2
- package/dist/splitButton/index.mjs.map +1 -1
- package/dist/switch/index.d.mts +1 -1
- package/dist/switch/index.d.ts +1 -1
- package/dist/tabs/index.d.mts +4 -2
- package/dist/tabs/index.d.ts +4 -2
- package/dist/tabs/index.js +123 -174
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +118 -169
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/textarea/index.d.mts +1 -1
- package/dist/textarea/index.d.ts +1 -1
- package/dist/toast/index.d.mts +1 -1
- package/dist/toast/index.d.ts +1 -1
- package/dist/toaster/index.d.mts +4 -22
- package/dist/toaster/index.d.ts +4 -22
- package/dist/tooltip/index.d.mts +4 -3
- package/dist/tooltip/index.d.ts +4 -3
- package/package.json +1 -1
- package/dist/Label-UbMDLtJF.d.mts +0 -14
- package/dist/Label-UbMDLtJF.d.ts +0 -14
- package/dist/chunk-WDCKXU54.mjs +0 -303
- package/dist/commonTypes-CgDwjGvU.d.mts +0 -5
- package/dist/commonTypes-CgDwjGvU.d.ts +0 -5
- package/dist/commonTypes-DZdITB5m.d.mts +0 -4
- package/dist/commonTypes-DZdITB5m.d.ts +0 -4
- package/dist/floatBox/index.d.mts +0 -15
- package/dist/floatBox/index.d.ts +0 -15
- package/dist/floatBox/index.js +0 -105
- package/dist/floatBox/index.js.map +0 -1
- package/dist/floatBox/index.mjs +0 -69
- package/dist/floatBox/index.mjs.map +0 -1
package/dist/chunk-WDCKXU54.mjs
DELETED
@@ -1,303 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
import {
|
3
|
-
HelperText,
|
4
|
-
Label,
|
5
|
-
cn
|
6
|
-
} from "./chunk-UMOBOCED.mjs";
|
7
|
-
|
8
|
-
// elements/popover/Popover.tsx
|
9
|
-
import * as React from "react";
|
10
|
-
import * as PopoverPrimitive from "@radix-ui/react-popover";
|
11
|
-
var PopoverContent = React.forwardRef(
|
12
|
-
({ className, align = "center", sideOffset = 4, container, ...props }, ref) => /* @__PURE__ */ React.createElement(PopoverPrimitive.Portal, { container }, /* @__PURE__ */ React.createElement(
|
13
|
-
PopoverPrimitive.Content,
|
14
|
-
{
|
15
|
-
ref,
|
16
|
-
align,
|
17
|
-
sideOffset,
|
18
|
-
className: cn(
|
19
|
-
"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",
|
20
|
-
className
|
21
|
-
),
|
22
|
-
...props
|
23
|
-
}
|
24
|
-
))
|
25
|
-
);
|
26
|
-
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
|
27
|
-
var Popover = ({
|
28
|
-
trigger,
|
29
|
-
children,
|
30
|
-
className,
|
31
|
-
align = "center",
|
32
|
-
side,
|
33
|
-
sideOffset = 4,
|
34
|
-
open,
|
35
|
-
width = "default",
|
36
|
-
disableTrigger,
|
37
|
-
contentProps,
|
38
|
-
triggerProps,
|
39
|
-
...props
|
40
|
-
}) => {
|
41
|
-
let widthStyles = {
|
42
|
-
trigger: "var(--radix-popover-trigger-width)",
|
43
|
-
default: "auto"
|
44
|
-
};
|
45
|
-
return /* @__PURE__ */ React.createElement(PopoverPrimitive.Root, { open, ...props }, /* @__PURE__ */ React.createElement(
|
46
|
-
PopoverPrimitive.Trigger,
|
47
|
-
{
|
48
|
-
className: "hawa-w-full",
|
49
|
-
disabled: disableTrigger,
|
50
|
-
...triggerProps
|
51
|
-
},
|
52
|
-
trigger
|
53
|
-
), /* @__PURE__ */ React.createElement(
|
54
|
-
PopoverContent,
|
55
|
-
{
|
56
|
-
side,
|
57
|
-
className,
|
58
|
-
align,
|
59
|
-
sideOffset,
|
60
|
-
style: {
|
61
|
-
width: widthStyles[width],
|
62
|
-
maxWidth: "var(--radix-popover-content-available-width)",
|
63
|
-
maxHeight: "var(--radix-popover-content-available-height)"
|
64
|
-
},
|
65
|
-
...contentProps
|
66
|
-
},
|
67
|
-
children
|
68
|
-
));
|
69
|
-
};
|
70
|
-
var PopoverTrigger = PopoverPrimitive.Trigger;
|
71
|
-
var PopoverRoot = PopoverPrimitive.Root;
|
72
|
-
|
73
|
-
// elements/radio/Radio.tsx
|
74
|
-
import React2, { useState, useRef, useEffect, forwardRef as forwardRef2 } from "react";
|
75
|
-
var Radio = forwardRef2(
|
76
|
-
({
|
77
|
-
design = "default",
|
78
|
-
width = "default",
|
79
|
-
size = "default",
|
80
|
-
orientation = "horizontal",
|
81
|
-
name,
|
82
|
-
labelProps,
|
83
|
-
tabsContainerClassName,
|
84
|
-
forceHideHelperText = false,
|
85
|
-
onChange,
|
86
|
-
...props
|
87
|
-
}, ref) => {
|
88
|
-
var _a, _b, _c;
|
89
|
-
let activeTabStyle = "hawa-inline-block hawa-w-full hawa-text-primary-foreground hawa-bg-primary hawa-active dark:hawa-bg-primary";
|
90
|
-
let inactiveTabStyle = `hawa-inline-block hawa-w-full hawa-transition-all hawa-bg-primary-foreground dark:hover:hawa-text-white
|
91
|
-
${props.disabled ? "" : "hover:hawa-bg-muted"}`;
|
92
|
-
let orientationStyle = {
|
93
|
-
horizontal: "hawa-flex hawa-flex-row",
|
94
|
-
vertical: "hawa-flex hawa-flex-col"
|
95
|
-
};
|
96
|
-
let tabSizeStyle = {
|
97
|
-
default: "hawa-py-2 hawa-px-4 hawa-text-sm",
|
98
|
-
lg: "hawa-py-2 hawa-px-4",
|
99
|
-
sm: "hawa-p-1.5 hawa-text-xs",
|
100
|
-
xs: "hawa-p-1 hawa-text-[10px]"
|
101
|
-
};
|
102
|
-
let widthStyle = {
|
103
|
-
none: "",
|
104
|
-
default: "hawa-max-w-fit",
|
105
|
-
full: "hawa-w-full"
|
106
|
-
};
|
107
|
-
const [parentDirection, setParentDirection] = React2.useState(
|
108
|
-
null
|
109
|
-
);
|
110
|
-
const [selectedOption, setSelectedOption] = useState(
|
111
|
-
props.defaultValue || props.value
|
112
|
-
);
|
113
|
-
const [openTooltip, setOpenTooltip] = useState(null);
|
114
|
-
const parentRef = useRef(null);
|
115
|
-
useEffect(() => {
|
116
|
-
var _a2;
|
117
|
-
const parentNode = (_a2 = parentRef.current) == null ? void 0 : _a2.parentNode;
|
118
|
-
if (parentNode) {
|
119
|
-
const dir = window.getComputedStyle(parentNode).direction;
|
120
|
-
setParentDirection(dir);
|
121
|
-
}
|
122
|
-
});
|
123
|
-
const handleChange = (opt) => {
|
124
|
-
setSelectedOption(opt.value);
|
125
|
-
if (onChange) {
|
126
|
-
onChange(opt.value);
|
127
|
-
} else {
|
128
|
-
console.log("onChange was not provided");
|
129
|
-
}
|
130
|
-
};
|
131
|
-
const radio_option_tabs_styling = [
|
132
|
-
"hawa-w-full hawa-last hawa-flex hawa-flex-row hawa-items-center hawa-justify-center hawa-gap-2 ",
|
133
|
-
!props.disabled && "hawa-cursor-pointer",
|
134
|
-
orientation === "horizontal" && parentDirection === "ltr" && "hawa-rounded-none first:hawa-rounded-l last:hawa-rounded-r",
|
135
|
-
orientation === "horizontal" && parentDirection === "rtl" && "hawa-rounded-none first:hawa-rounded-r last:hawa-rounded-l",
|
136
|
-
orientation === "vertical" && "hawa-rounded-none first:hawa-rounded-t last:hawa-rounded-b",
|
137
|
-
tabSizeStyle[size]
|
138
|
-
];
|
139
|
-
switch (design) {
|
140
|
-
case "tabs":
|
141
|
-
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(
|
142
|
-
"ul",
|
143
|
-
{
|
144
|
-
ref: parentRef,
|
145
|
-
className: cn(
|
146
|
-
props.options && ((_a = props.options) == null ? void 0 : _a.length) > 2 ? "hawa-flex-wrap xs:hawa-max-w-full xs:hawa-flex-nowrap" : "",
|
147
|
-
"hawa-select-none hawa-whitespace-nowrap hawa-rounded hawa-border hawa-text-center hawa-font-medium hawa-h-[40px]",
|
148
|
-
orientationStyle[orientation],
|
149
|
-
widthStyle[width],
|
150
|
-
tabsContainerClassName
|
151
|
-
)
|
152
|
-
},
|
153
|
-
(_b = props.options) == null ? void 0 : _b.map((opt, o) => {
|
154
|
-
return opt.tooltip ? /* @__PURE__ */ React2.createElement(
|
155
|
-
PopoverRoot,
|
156
|
-
{
|
157
|
-
key: o,
|
158
|
-
open: o === openTooltip,
|
159
|
-
onOpenChange: (bool) => setOpenTooltip(bool ? o : null)
|
160
|
-
},
|
161
|
-
/* @__PURE__ */ React2.createElement(
|
162
|
-
PopoverTrigger,
|
163
|
-
{
|
164
|
-
onMouseEnter: () => setOpenTooltip(o),
|
165
|
-
onMouseLeave: () => setOpenTooltip(null),
|
166
|
-
asChild: true
|
167
|
-
},
|
168
|
-
/* @__PURE__ */ React2.createElement(
|
169
|
-
"li",
|
170
|
-
{
|
171
|
-
"aria-current": "page",
|
172
|
-
onClick: () => {
|
173
|
-
if (props.disabled || opt.disabled)
|
174
|
-
return;
|
175
|
-
handleChange(opt);
|
176
|
-
},
|
177
|
-
className: cn(
|
178
|
-
...radio_option_tabs_styling,
|
179
|
-
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
180
|
-
)
|
181
|
-
},
|
182
|
-
opt.icon && opt.icon,
|
183
|
-
opt.label
|
184
|
-
)
|
185
|
-
),
|
186
|
-
/* @__PURE__ */ React2.createElement(PopoverContent, { ...opt.tooltipContentProps }, opt.tooltip)
|
187
|
-
) : /* @__PURE__ */ React2.createElement(
|
188
|
-
"li",
|
189
|
-
{
|
190
|
-
key: o,
|
191
|
-
"aria-current": "page",
|
192
|
-
onClick: () => {
|
193
|
-
if (props.disabled || opt.disabled)
|
194
|
-
return;
|
195
|
-
handleChange(opt);
|
196
|
-
},
|
197
|
-
className: cn(
|
198
|
-
...radio_option_tabs_styling,
|
199
|
-
selectedOption === opt.value ? activeTabStyle : inactiveTabStyle
|
200
|
-
)
|
201
|
-
},
|
202
|
-
opt.icon && opt.icon,
|
203
|
-
opt.label
|
204
|
-
);
|
205
|
-
})
|
206
|
-
), !forceHideHelperText && /* @__PURE__ */ React2.createElement(HelperText, { helperText: props.helperText }));
|
207
|
-
case "bordered":
|
208
|
-
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(
|
209
|
-
"div",
|
210
|
-
{
|
211
|
-
className: cn(
|
212
|
-
"radio-item radio-item-bordered hawa-flex hawa-items-center hawa-transition-all",
|
213
|
-
props.direction === "rtl" ? "margin-left right-19px" : "margin-right left-23px"
|
214
|
-
),
|
215
|
-
key: i + 1
|
216
|
-
},
|
217
|
-
/* @__PURE__ */ React2.createElement(
|
218
|
-
"input",
|
219
|
-
{
|
220
|
-
disabled: opt.disabled,
|
221
|
-
id: opt.value.toString(),
|
222
|
-
type: "radio",
|
223
|
-
value: opt.value,
|
224
|
-
name,
|
225
|
-
onChange: () => handleChange(opt)
|
226
|
-
}
|
227
|
-
),
|
228
|
-
/* @__PURE__ */ React2.createElement(
|
229
|
-
"label",
|
230
|
-
{
|
231
|
-
htmlFor: opt.value.toString(),
|
232
|
-
className: cn(
|
233
|
-
"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",
|
234
|
-
opt.disabled ? "hawa-opacity-50" : "hawa-cursor-pointer hawa-text-gray-900"
|
235
|
-
)
|
236
|
-
},
|
237
|
-
opt.label
|
238
|
-
)
|
239
|
-
))));
|
240
|
-
case "cards":
|
241
|
-
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(
|
242
|
-
"input",
|
243
|
-
{
|
244
|
-
type: "radio",
|
245
|
-
id: opt.value.toString(),
|
246
|
-
name,
|
247
|
-
value: opt.value.toString(),
|
248
|
-
className: "hawa-peer hawa-hidden",
|
249
|
-
required: true,
|
250
|
-
disabled: opt.disabled
|
251
|
-
}
|
252
|
-
), /* @__PURE__ */ React2.createElement(
|
253
|
-
"label",
|
254
|
-
{
|
255
|
-
htmlFor: opt.value.toString(),
|
256
|
-
className: cn(
|
257
|
-
"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",
|
258
|
-
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"
|
259
|
-
)
|
260
|
-
},
|
261
|
-
/* @__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))
|
262
|
-
))));
|
263
|
-
default:
|
264
|
-
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(
|
265
|
-
"div",
|
266
|
-
{
|
267
|
-
className: cn(
|
268
|
-
"radio-item radio-item-default hawa-flex hawa-items-center hawa-transition-all",
|
269
|
-
props.direction === "rtl" ? "margin-left right-3px" : "margin-right left-3px"
|
270
|
-
),
|
271
|
-
key: i + 1
|
272
|
-
},
|
273
|
-
/* @__PURE__ */ React2.createElement(
|
274
|
-
"input",
|
275
|
-
{
|
276
|
-
disabled: opt.disabled,
|
277
|
-
id: opt.value.toString(),
|
278
|
-
type: "radio",
|
279
|
-
value: opt.value,
|
280
|
-
name,
|
281
|
-
onChange: () => handleChange(opt)
|
282
|
-
}
|
283
|
-
),
|
284
|
-
/* @__PURE__ */ React2.createElement(
|
285
|
-
"label",
|
286
|
-
{
|
287
|
-
htmlFor: opt.value.toString(),
|
288
|
-
className: cn(
|
289
|
-
"hawa-text-sm hawa-font-medium dark:hawa-text-white",
|
290
|
-
opt.disabled ? "hawa-text-gray-400" : "hawa-cursor-pointer hawa-text-gray-900"
|
291
|
-
)
|
292
|
-
},
|
293
|
-
opt.label
|
294
|
-
)
|
295
|
-
))), /* @__PURE__ */ React2.createElement(HelperText, { helperText: props.helperText }));
|
296
|
-
}
|
297
|
-
}
|
298
|
-
);
|
299
|
-
|
300
|
-
export {
|
301
|
-
Popover,
|
302
|
-
Radio
|
303
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
|
3
|
-
type FloatBoxProps = {
|
4
|
-
className?: string;
|
5
|
-
open?: boolean;
|
6
|
-
children?: React.ReactNode;
|
7
|
-
side?: "bottom" | "left" | "right" | "top";
|
8
|
-
sideOffset?: number;
|
9
|
-
align?: "start" | "center" | "end";
|
10
|
-
alignOffset?: number;
|
11
|
-
withArrow?: boolean;
|
12
|
-
};
|
13
|
-
declare const FloatBox: React.FC<FloatBoxProps>;
|
14
|
-
|
15
|
-
export { FloatBox, type FloatBoxProps };
|
package/dist/floatBox/index.d.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as React from 'react';
|
2
|
-
|
3
|
-
type FloatBoxProps = {
|
4
|
-
className?: string;
|
5
|
-
open?: boolean;
|
6
|
-
children?: React.ReactNode;
|
7
|
-
side?: "bottom" | "left" | "right" | "top";
|
8
|
-
sideOffset?: number;
|
9
|
-
align?: "start" | "center" | "end";
|
10
|
-
alignOffset?: number;
|
11
|
-
withArrow?: boolean;
|
12
|
-
};
|
13
|
-
declare const FloatBox: React.FC<FloatBoxProps>;
|
14
|
-
|
15
|
-
export { FloatBox, type FloatBoxProps };
|
package/dist/floatBox/index.js
DELETED
@@ -1,105 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
"use strict";
|
3
|
-
var __create = Object.create;
|
4
|
-
var __defProp = Object.defineProperty;
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
9
|
-
var __export = (target, all) => {
|
10
|
-
for (var name in all)
|
11
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
12
|
-
};
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
15
|
-
for (let key of __getOwnPropNames(from))
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
18
|
-
}
|
19
|
-
return to;
|
20
|
-
};
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
27
|
-
mod
|
28
|
-
));
|
29
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
30
|
-
|
31
|
-
// elements/floatBox/index.ts
|
32
|
-
var floatBox_exports = {};
|
33
|
-
__export(floatBox_exports, {
|
34
|
-
FloatBox: () => FloatBox
|
35
|
-
});
|
36
|
-
module.exports = __toCommonJS(floatBox_exports);
|
37
|
-
|
38
|
-
// elements/floatBox/FloatBox.tsx
|
39
|
-
var React = __toESM(require("react"));
|
40
|
-
|
41
|
-
// util/index.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
|
-
// elements/floatBox/FloatBox.tsx
|
49
|
-
var FloatBox = ({
|
50
|
-
className,
|
51
|
-
open,
|
52
|
-
side = "bottom",
|
53
|
-
sideOffset = 40,
|
54
|
-
align = "center",
|
55
|
-
withArrow = false,
|
56
|
-
...props
|
57
|
-
}) => {
|
58
|
-
let stylesMap = {
|
59
|
-
bottom: {
|
60
|
-
start: { top: sideOffset, insetInlineStart: 0 },
|
61
|
-
center: { top: sideOffset },
|
62
|
-
end: { top: sideOffset, insetInlineEnd: 0 }
|
63
|
-
},
|
64
|
-
top: {
|
65
|
-
start: { bottom: sideOffset, insetInlineStart: 0 },
|
66
|
-
center: { bottom: sideOffset },
|
67
|
-
end: { bottom: sideOffset, insetInlineEnd: 0 }
|
68
|
-
},
|
69
|
-
right: {
|
70
|
-
start: { left: sideOffset, top: -5 },
|
71
|
-
center: { left: sideOffset },
|
72
|
-
end: { left: sideOffset, bottom: 0 }
|
73
|
-
},
|
74
|
-
left: {
|
75
|
-
start: { right: sideOffset, top: 0 },
|
76
|
-
center: { right: sideOffset },
|
77
|
-
end: { right: sideOffset, bottom: 0 }
|
78
|
-
}
|
79
|
-
};
|
80
|
-
const arrowDirection = {
|
81
|
-
top: "hawa-arrow-default-bottom",
|
82
|
-
bottom: "hawa-arrow-default-top",
|
83
|
-
right: "hawa-arrow-default-left",
|
84
|
-
left: "hawa-arrow-default-right"
|
85
|
-
};
|
86
|
-
return /* @__PURE__ */ React.createElement(
|
87
|
-
"div",
|
88
|
-
{
|
89
|
-
className: cn(
|
90
|
-
"data-[floatbox-state=closed]:hawa-invisible data-[floatbox-state=open]:hawa-visible hawa-absolute dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[floatbox-state=open]:hawa-animate-in data-[floatbox-state=closed]:hawa-animate-out data-[floatbox-state=closed]:hawa-fade-out-0 data-[floatbox-state=open]:hawa-fade-in-0 data-[floatbox-state=closed]:hawa-zoom-out-95 data-[floatbox-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 hawa-bg-popover",
|
91
|
-
className
|
92
|
-
),
|
93
|
-
style: { ...stylesMap[side][align] },
|
94
|
-
"data-side": side,
|
95
|
-
"data-floatbox-state": open ? "open" : "closed"
|
96
|
-
},
|
97
|
-
withArrow && /* @__PURE__ */ React.createElement("div", { className: cn(arrowDirection[side]) }),
|
98
|
-
/* @__PURE__ */ React.createElement("span", null, props.children)
|
99
|
-
);
|
100
|
-
};
|
101
|
-
// Annotate the CommonJS export names for ESM import in node:
|
102
|
-
0 && (module.exports = {
|
103
|
-
FloatBox
|
104
|
-
});
|
105
|
-
//# sourceMappingURL=index.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/floatBox/index.ts","../../elements/floatBox/FloatBox.tsx","../../util/index.ts"],"sourcesContent":["export * from \"./FloatBox\";\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport type FloatBoxProps = {\n className?: string;\n open?: boolean;\n children?: React.ReactNode;\n side?: \"bottom\" | \"left\" | \"right\" | \"top\";\n sideOffset?: number;\n align?: \"start\" | \"center\" | \"end\";\n alignOffset?: number;\n withArrow?: boolean;\n};\n\nconst FloatBox: React.FC<FloatBoxProps> = ({\n className,\n open,\n side = \"bottom\",\n sideOffset = 40,\n align = \"center\",\n withArrow = false,\n ...props\n}) => {\n let stylesMap = {\n bottom: {\n start: { top: sideOffset, insetInlineStart: 0 },\n center: { top: sideOffset },\n end: { top: sideOffset, insetInlineEnd: 0 },\n },\n top: {\n start: { bottom: sideOffset, insetInlineStart: 0 },\n center: { bottom: sideOffset },\n end: { bottom: sideOffset, insetInlineEnd: 0 },\n },\n right: {\n start: { left: sideOffset, top: -5 },\n center: { left: sideOffset },\n end: { left: sideOffset, bottom: 0 },\n },\n left: {\n start: { right: sideOffset, top: 0 },\n center: { right: sideOffset },\n end: { right: sideOffset, bottom: 0 },\n },\n };\n const arrowDirection = {\n top: \"hawa-arrow-default-bottom\",\n bottom: \"hawa-arrow-default-top\",\n right: \"hawa-arrow-default-left\",\n left: \"hawa-arrow-default-right\",\n };\n\n return (\n <div\n className={cn(\n \"data-[floatbox-state=closed]:hawa-invisible data-[floatbox-state=open]:hawa-visible hawa-absolute dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[floatbox-state=open]:hawa-animate-in data-[floatbox-state=closed]:hawa-animate-out data-[floatbox-state=closed]:hawa-fade-out-0 data-[floatbox-state=open]:hawa-fade-in-0 data-[floatbox-state=closed]:hawa-zoom-out-95 data-[floatbox-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 hawa-bg-popover\",\n className,\n )}\n style={{ ...stylesMap[side][align] }}\n data-side={side}\n data-floatbox-state={open ? \"open\" : \"closed\"}\n >\n {withArrow && <div className={cn(arrowDirection[side])} />}\n <span>{props.children}</span>\n </div>\n );\n};\n\nexport { FloatBox };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;;;ADUA,IAAM,WAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,MAAI,YAAY;AAAA,IACd,QAAQ;AAAA,MACN,OAAO,EAAE,KAAK,YAAY,kBAAkB,EAAE;AAAA,MAC9C,QAAQ,EAAE,KAAK,WAAW;AAAA,MAC1B,KAAK,EAAE,KAAK,YAAY,gBAAgB,EAAE;AAAA,IAC5C;AAAA,IACA,KAAK;AAAA,MACH,OAAO,EAAE,QAAQ,YAAY,kBAAkB,EAAE;AAAA,MACjD,QAAQ,EAAE,QAAQ,WAAW;AAAA,MAC7B,KAAK,EAAE,QAAQ,YAAY,gBAAgB,EAAE;AAAA,IAC/C;AAAA,IACA,OAAO;AAAA,MACL,OAAO,EAAE,MAAM,YAAY,KAAK,GAAG;AAAA,MACnC,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,KAAK,EAAE,MAAM,YAAY,QAAQ,EAAE;AAAA,IACrC;AAAA,IACA,MAAM;AAAA,MACJ,OAAO,EAAE,OAAO,YAAY,KAAK,EAAE;AAAA,MACnC,QAAQ,EAAE,OAAO,WAAW;AAAA,MAC5B,KAAK,EAAE,OAAO,YAAY,QAAQ,EAAE;AAAA,IACtC;AAAA,EACF;AACA,QAAM,iBAAiB;AAAA,IACrB,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,KAAK,EAAE;AAAA,MACnC,aAAW;AAAA,MACX,uBAAqB,OAAO,SAAS;AAAA;AAAA,IAEpC,aAAa,oCAAC,SAAI,WAAW,GAAG,eAAe,IAAI,CAAC,GAAG;AAAA,IACxD,oCAAC,cAAM,MAAM,QAAS;AAAA,EACxB;AAEJ;","names":[]}
|
package/dist/floatBox/index.mjs
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
"use client";
|
2
|
-
|
3
|
-
// elements/floatBox/FloatBox.tsx
|
4
|
-
import * as React from "react";
|
5
|
-
|
6
|
-
// util/index.ts
|
7
|
-
import { clsx } from "clsx";
|
8
|
-
import { twMerge } from "tailwind-merge";
|
9
|
-
function cn(...inputs) {
|
10
|
-
return twMerge(clsx(inputs));
|
11
|
-
}
|
12
|
-
|
13
|
-
// elements/floatBox/FloatBox.tsx
|
14
|
-
var FloatBox = ({
|
15
|
-
className,
|
16
|
-
open,
|
17
|
-
side = "bottom",
|
18
|
-
sideOffset = 40,
|
19
|
-
align = "center",
|
20
|
-
withArrow = false,
|
21
|
-
...props
|
22
|
-
}) => {
|
23
|
-
let stylesMap = {
|
24
|
-
bottom: {
|
25
|
-
start: { top: sideOffset, insetInlineStart: 0 },
|
26
|
-
center: { top: sideOffset },
|
27
|
-
end: { top: sideOffset, insetInlineEnd: 0 }
|
28
|
-
},
|
29
|
-
top: {
|
30
|
-
start: { bottom: sideOffset, insetInlineStart: 0 },
|
31
|
-
center: { bottom: sideOffset },
|
32
|
-
end: { bottom: sideOffset, insetInlineEnd: 0 }
|
33
|
-
},
|
34
|
-
right: {
|
35
|
-
start: { left: sideOffset, top: -5 },
|
36
|
-
center: { left: sideOffset },
|
37
|
-
end: { left: sideOffset, bottom: 0 }
|
38
|
-
},
|
39
|
-
left: {
|
40
|
-
start: { right: sideOffset, top: 0 },
|
41
|
-
center: { right: sideOffset },
|
42
|
-
end: { right: sideOffset, bottom: 0 }
|
43
|
-
}
|
44
|
-
};
|
45
|
-
const arrowDirection = {
|
46
|
-
top: "hawa-arrow-default-bottom",
|
47
|
-
bottom: "hawa-arrow-default-top",
|
48
|
-
right: "hawa-arrow-default-left",
|
49
|
-
left: "hawa-arrow-default-right"
|
50
|
-
};
|
51
|
-
return /* @__PURE__ */ React.createElement(
|
52
|
-
"div",
|
53
|
-
{
|
54
|
-
className: cn(
|
55
|
-
"data-[floatbox-state=closed]:hawa-invisible data-[floatbox-state=open]:hawa-visible hawa-absolute dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[floatbox-state=open]:hawa-animate-in data-[floatbox-state=closed]:hawa-animate-out data-[floatbox-state=closed]:hawa-fade-out-0 data-[floatbox-state=open]:hawa-fade-in-0 data-[floatbox-state=closed]:hawa-zoom-out-95 data-[floatbox-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 hawa-bg-popover",
|
56
|
-
className
|
57
|
-
),
|
58
|
-
style: { ...stylesMap[side][align] },
|
59
|
-
"data-side": side,
|
60
|
-
"data-floatbox-state": open ? "open" : "closed"
|
61
|
-
},
|
62
|
-
withArrow && /* @__PURE__ */ React.createElement("div", { className: cn(arrowDirection[side]) }),
|
63
|
-
/* @__PURE__ */ React.createElement("span", null, props.children)
|
64
|
-
);
|
65
|
-
};
|
66
|
-
export {
|
67
|
-
FloatBox
|
68
|
-
};
|
69
|
-
//# sourceMappingURL=index.mjs.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/floatBox/FloatBox.tsx","../../util/index.ts"],"sourcesContent":["import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport type FloatBoxProps = {\n className?: string;\n open?: boolean;\n children?: React.ReactNode;\n side?: \"bottom\" | \"left\" | \"right\" | \"top\";\n sideOffset?: number;\n align?: \"start\" | \"center\" | \"end\";\n alignOffset?: number;\n withArrow?: boolean;\n};\n\nconst FloatBox: React.FC<FloatBoxProps> = ({\n className,\n open,\n side = \"bottom\",\n sideOffset = 40,\n align = \"center\",\n withArrow = false,\n ...props\n}) => {\n let stylesMap = {\n bottom: {\n start: { top: sideOffset, insetInlineStart: 0 },\n center: { top: sideOffset },\n end: { top: sideOffset, insetInlineEnd: 0 },\n },\n top: {\n start: { bottom: sideOffset, insetInlineStart: 0 },\n center: { bottom: sideOffset },\n end: { bottom: sideOffset, insetInlineEnd: 0 },\n },\n right: {\n start: { left: sideOffset, top: -5 },\n center: { left: sideOffset },\n end: { left: sideOffset, bottom: 0 },\n },\n left: {\n start: { right: sideOffset, top: 0 },\n center: { right: sideOffset },\n end: { right: sideOffset, bottom: 0 },\n },\n };\n const arrowDirection = {\n top: \"hawa-arrow-default-bottom\",\n bottom: \"hawa-arrow-default-top\",\n right: \"hawa-arrow-default-left\",\n left: \"hawa-arrow-default-right\",\n };\n\n return (\n <div\n className={cn(\n \"data-[floatbox-state=closed]:hawa-invisible data-[floatbox-state=open]:hawa-visible hawa-absolute dark:dark-shadow hawa-z-50 hawa-rounded hawa-border hawa-text-popover-foreground hawa-shadow-md hawa-outline-none data-[floatbox-state=open]:hawa-animate-in data-[floatbox-state=closed]:hawa-animate-out data-[floatbox-state=closed]:hawa-fade-out-0 data-[floatbox-state=open]:hawa-fade-in-0 data-[floatbox-state=closed]:hawa-zoom-out-95 data-[floatbox-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 hawa-bg-popover\",\n className,\n )}\n style={{ ...stylesMap[side][align] }}\n data-side={side}\n data-floatbox-state={open ? \"open\" : \"closed\"}\n >\n {withArrow && <div className={cn(arrowDirection[side])} />}\n <span>{props.children}</span>\n </div>\n );\n};\n\nexport { FloatBox };\n","import { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\ntype Palette = {\n name: string;\n colors: {\n [key: number]: string;\n };\n};\ntype Rgb = {\n r: number;\n g: number;\n b: number;\n};\nfunction hexToRgb(hex: string): Rgb | null {\n const sanitizedHex = hex.replaceAll(\"##\", \"#\");\n const colorParts = /^#?([a-f\\d]{2})([a-f\\d]{2})([a-f\\d]{2})$/i.exec(\n sanitizedHex\n );\n\n if (!colorParts) {\n return null;\n }\n\n const [, r, g, b] = colorParts;\n\n return {\n r: parseInt(r, 16),\n g: parseInt(g, 16),\n b: parseInt(b, 16)\n } as Rgb;\n}\n\nfunction rgbToHex(r: number, g: number, b: number): string {\n const toHex = (c: number) => `0${c.toString(16)}`.slice(-2);\n return `#${toHex(r)}${toHex(g)}${toHex(b)}`;\n}\n\nexport function getTextColor(color: string): \"#FFF\" | \"#333\" {\n const rgbColor = hexToRgb(color);\n\n if (!rgbColor) {\n return \"#333\";\n }\n\n const { r, g, b } = rgbColor;\n const luma = 0.2126 * r + 0.7152 * g + 0.0722 * b;\n\n return luma < 120 ? \"#FFF\" : \"#333\";\n}\n\nfunction lighten(hex: string, intensity: number): string {\n const color = hexToRgb(`#${hex}`);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r + (255 - color.r) * intensity);\n const g = Math.round(color.g + (255 - color.g) * intensity);\n const b = Math.round(color.b + (255 - color.b) * intensity);\n\n return rgbToHex(r, g, b);\n}\n\nfunction darken(hex: string, intensity: number): string {\n const color = hexToRgb(hex);\n\n if (!color) {\n return \"\";\n }\n\n const r = Math.round(color.r * intensity);\n const g = Math.round(color.g * intensity);\n const b = Math.round(color.b * intensity);\n\n return rgbToHex(r, g, b);\n}\nconst parseColor = (color: any) => {\n if (color.startsWith(\"#\")) {\n // Convert hex to RGB\n let r = parseInt(color.slice(1, 3), 16);\n let g = parseInt(color.slice(3, 5), 16);\n let b = parseInt(color.slice(5, 7), 16);\n return [r, g, b];\n } else if (color.startsWith(\"rgb\")) {\n // Extract RGB values from rgb() format\n return color.match(/\\d+/g).map(Number);\n }\n // Default to white if format is unrecognized\n return [255, 255, 255];\n};\nexport const calculateLuminance = (color: any) => {\n const [r, g, b] = parseColor(color)?.map((c: any) => {\n c /= 255;\n return c <= 0.03928 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;\n });\n return 0.2126 * r + 0.7152 * g + 0.0722 * b;\n};\n\nfunction getPallette(baseColor: string): Palette {\n const name = baseColor;\n\n const response: Palette = {\n name,\n colors: {\n 500: `#${baseColor}`.replace(\"##\", \"#\")\n }\n };\n\n const intensityMap: {\n [key: number]: number;\n } = {\n 50: 0.95,\n 100: 0.9,\n 200: 0.75,\n 300: 0.6,\n 400: 0.3,\n 600: 0.9,\n 700: 0.75,\n 800: 0.6,\n 900: 0.49\n };\n\n [50, 100, 200, 300, 400].forEach((level) => {\n response.colors[level] = lighten(baseColor, intensityMap[level]);\n });\n [600, 700, 800, 900].forEach((level) => {\n response.colors[level] = darken(baseColor, intensityMap[level]);\n });\n\n return response as Palette;\n}\n\nexport { getPallette };\n\n// const hexToRgb = (hex) => {\n// let d = hex?.split(\"#\")[1];\n// var aRgbHex = d?.match(/.{1,2}/g);\n// var aRgb = [\n// parseInt(aRgbHex[0], 16),\n// parseInt(aRgbHex[1], 16),\n// parseInt(aRgbHex[2], 16)\n// ];\n// return aRgb;\n// };\n// const getTextColor = (backColor) => {\n// let rgbArray = hexToRgb(backColor);\n// if (rgbArray[0] * 0.299 + rgbArray[1] * 0.587 + rgbArray[2] * 0.114 > 186) {\n// return \"#000000\";\n// } else {\n// return \"#ffffff\";\n// }\n// };\n// const replaceAt = function (string, index, replacement) {\n// // if (replacement == \"\" || replacement == \" \") {\n// // return (\n// // string.substring(0, index) +\n// // string.substring(index + replacement.length )\n// // );\n// // }\n// const replaced = string.substring(0, index) + replacement + string.substring(index + 1)\n// return replaced\n// };\n\n// export { hexToRgb, getTextColor, replaceAt };\n"],"mappings":";;;AAAA,YAAY,WAAW;;;ACAvB,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;;;ADUA,IAAM,WAAoC,CAAC;AAAA,EACzC;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,YAAY;AAAA,EACZ,GAAG;AACL,MAAM;AACJ,MAAI,YAAY;AAAA,IACd,QAAQ;AAAA,MACN,OAAO,EAAE,KAAK,YAAY,kBAAkB,EAAE;AAAA,MAC9C,QAAQ,EAAE,KAAK,WAAW;AAAA,MAC1B,KAAK,EAAE,KAAK,YAAY,gBAAgB,EAAE;AAAA,IAC5C;AAAA,IACA,KAAK;AAAA,MACH,OAAO,EAAE,QAAQ,YAAY,kBAAkB,EAAE;AAAA,MACjD,QAAQ,EAAE,QAAQ,WAAW;AAAA,MAC7B,KAAK,EAAE,QAAQ,YAAY,gBAAgB,EAAE;AAAA,IAC/C;AAAA,IACA,OAAO;AAAA,MACL,OAAO,EAAE,MAAM,YAAY,KAAK,GAAG;AAAA,MACnC,QAAQ,EAAE,MAAM,WAAW;AAAA,MAC3B,KAAK,EAAE,MAAM,YAAY,QAAQ,EAAE;AAAA,IACrC;AAAA,IACA,MAAM;AAAA,MACJ,OAAO,EAAE,OAAO,YAAY,KAAK,EAAE;AAAA,MACnC,QAAQ,EAAE,OAAO,WAAW;AAAA,MAC5B,KAAK,EAAE,OAAO,YAAY,QAAQ,EAAE;AAAA,IACtC;AAAA,EACF;AACA,QAAM,iBAAiB;AAAA,IACrB,KAAK;AAAA,IACL,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACA,OAAO,EAAE,GAAG,UAAU,IAAI,EAAE,KAAK,EAAE;AAAA,MACnC,aAAW;AAAA,MACX,uBAAqB,OAAO,SAAS;AAAA;AAAA,IAEpC,aAAa,oCAAC,SAAI,WAAW,GAAG,eAAe,IAAI,CAAC,GAAG;AAAA,IACxD,oCAAC,cAAM,MAAM,QAAS;AAAA,EACxB;AAEJ;","names":[]}
|