@sikka/hawa 0.46.0-next → 0.46.3-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/blocks/auth/index.js +31 -13
- package/dist/blocks/auth/index.mjs +4 -4
- package/dist/blocks/feedback/index.js +6 -0
- package/dist/blocks/feedback/index.mjs +5 -5
- package/dist/blocks/index.js +31 -13
- package/dist/blocks/index.mjs +2 -2
- package/dist/blocks/misc/index.js +31 -13
- package/dist/blocks/misc/index.mjs +5 -5
- package/dist/blocks/pricing/index.js +6 -0
- package/dist/blocks/pricing/index.mjs +4 -4
- package/dist/{chunk-6LI35F6L.mjs → chunk-6UOJKVIA.mjs} +6 -0
- package/dist/{chunk-JKZQWCAQ.mjs → chunk-7L5VUKZ7.mjs} +27 -15
- package/dist/{chunk-D3B3MKLS.mjs → chunk-7O555VJR.mjs} +1 -1
- package/dist/{chunk-XC6FSDW7.mjs → chunk-CIMTNOLA.mjs} +1 -1
- package/dist/{chunk-FIUKVRL5.mjs → chunk-EHJXQQDP.mjs} +1 -1
- package/dist/{chunk-3B7UZCET.mjs → chunk-HJVL6X7I.mjs} +6 -0
- package/dist/{chunk-IEB2ANWU.mjs → chunk-QLUJEUIB.mjs} +33 -21
- package/dist/{chunk-YABFWOF3.mjs → chunk-R37QEYSB.mjs} +1 -1
- package/dist/{chunk-FUYMZP4J.mjs → chunk-U72MOMEK.mjs} +1 -1
- package/dist/{chunk-JDCQLGWW.mjs → chunk-YXUHXKKK.mjs} +1 -1
- package/dist/colorPicker/index.js +6 -0
- package/dist/colorPicker/index.js.map +1 -1
- package/dist/colorPicker/index.mjs +6 -0
- package/dist/colorPicker/index.mjs.map +1 -1
- package/dist/combobox/index.js +7 -0
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +7 -0
- package/dist/combobox/index.mjs.map +1 -1
- package/dist/command/index.js +1 -0
- package/dist/command/index.js.map +1 -1
- package/dist/command/index.mjs +1 -0
- package/dist/command/index.mjs.map +1 -1
- package/dist/dataTable/index.js +31 -13
- package/dist/dataTable/index.js.map +1 -1
- package/dist/dataTable/index.mjs +32 -14
- package/dist/dataTable/index.mjs.map +1 -1
- package/dist/elements/index.d.mts +4 -3
- package/dist/elements/index.d.ts +4 -3
- package/dist/elements/index.js +32 -13
- package/dist/elements/index.mjs +4 -3
- package/dist/index.css +1 -1
- package/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +32 -13
- package/dist/index.mjs +139 -120
- package/dist/input/index.d.mts +2 -2
- package/dist/input/index.d.ts +2 -2
- package/dist/input/index.js +31 -13
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +32 -14
- package/dist/input/index.mjs.map +1 -1
- package/dist/layout/index.js +6 -0
- package/dist/layout/index.mjs +2 -2
- package/dist/passwordInput/index.js +31 -13
- package/dist/passwordInput/index.js.map +1 -1
- package/dist/passwordInput/index.mjs +42 -24
- package/dist/passwordInput/index.mjs.map +1 -1
- package/dist/phoneInput/index.js +6 -0
- package/dist/phoneInput/index.js.map +1 -1
- package/dist/phoneInput/index.mjs +6 -0
- package/dist/phoneInput/index.mjs.map +1 -1
- package/dist/select/index.js +6 -0
- package/dist/select/index.js.map +1 -1
- package/dist/select/index.mjs +6 -0
- package/dist/select/index.mjs.map +1 -1
- package/dist/simpleTable/index.js +6 -0
- package/dist/simpleTable/index.js.map +1 -1
- package/dist/simpleTable/index.mjs +6 -0
- package/dist/simpleTable/index.mjs.map +1 -1
- package/dist/skeleton/index.d.mts +2 -1
- package/dist/skeleton/index.d.ts +2 -1
- package/dist/skeleton/index.js +6 -0
- package/dist/skeleton/index.js.map +1 -1
- package/dist/skeleton/index.mjs +6 -0
- package/dist/skeleton/index.mjs.map +1 -1
- package/dist/stats/index.js +6 -0
- package/dist/stats/index.js.map +1 -1
- package/dist/stats/index.mjs +6 -0
- package/dist/stats/index.mjs.map +1 -1
- package/dist/textarea/index.js +6 -0
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +6 -0
- package/dist/textarea/index.mjs.map +1 -1
- package/package.json +1 -1
@@ -1092,6 +1092,7 @@ function Skeleton({
|
|
1092
1092
|
content,
|
1093
1093
|
animation = "pulse",
|
1094
1094
|
fade,
|
1095
|
+
as = "div",
|
1095
1096
|
...props
|
1096
1097
|
}) {
|
1097
1098
|
const animationStyles = {
|
@@ -1105,6 +1106,10 @@ function Skeleton({
|
|
1105
1106
|
right: "hawa-mask-fade-right",
|
1106
1107
|
left: "hawa-mask-fade-left "
|
1107
1108
|
};
|
1109
|
+
const styledAs = {
|
1110
|
+
div: "",
|
1111
|
+
input: "!h-[38px] !w-full"
|
1112
|
+
};
|
1108
1113
|
return /* @__PURE__ */ React8.createElement(
|
1109
1114
|
"div",
|
1110
1115
|
{
|
@@ -1112,6 +1117,7 @@ function Skeleton({
|
|
1112
1117
|
animationStyles[animation],
|
1113
1118
|
content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
|
1114
1119
|
fade && fadeStyle[fade],
|
1120
|
+
styledAs[as],
|
1115
1121
|
className
|
1116
1122
|
),
|
1117
1123
|
...props
|
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
Label,
|
10
10
|
Skeleton,
|
11
11
|
cn
|
12
|
-
} from "./chunk-
|
12
|
+
} from "./chunk-HJVL6X7I.mjs";
|
13
13
|
|
14
14
|
// elements/alert/Alert.tsx
|
15
15
|
import React, { useRef, useState, useEffect } from "react";
|
@@ -171,7 +171,7 @@ var Alert = ({
|
|
171
171
|
};
|
172
172
|
|
173
173
|
// elements/input/Input.tsx
|
174
|
-
import React2, { forwardRef } from "react";
|
174
|
+
import React2, { forwardRef, useState as useState2 } from "react";
|
175
175
|
var Input = forwardRef(
|
176
176
|
({
|
177
177
|
margin = "none",
|
@@ -186,6 +186,7 @@ var Input = forwardRef(
|
|
186
186
|
...props
|
187
187
|
}, ref) => {
|
188
188
|
var _a;
|
189
|
+
const [value, setValue] = useState2(props.value || "");
|
189
190
|
let marginStyles = {
|
190
191
|
none: "hawa-mb-0",
|
191
192
|
normal: "hawa-mb-3",
|
@@ -201,6 +202,7 @@ var Input = forwardRef(
|
|
201
202
|
let defaultInputStyle = "hawa-block hawa-w-full hawa-rounded hawa-border hawa-transition-all hawa-bg-background hawa-p-3 hawa-text-sm placeholder:hawa-text-muted-foreground";
|
202
203
|
const handleChange = (e) => {
|
203
204
|
let newValue = e.target.value;
|
205
|
+
setValue(newValue);
|
204
206
|
if (props.prefixText) {
|
205
207
|
if (newValue.length < props.prefixText.length) {
|
206
208
|
newValue = props.prefixText;
|
@@ -212,10 +214,27 @@ var Input = forwardRef(
|
|
212
214
|
}
|
213
215
|
}
|
214
216
|
if (props.onChange) {
|
215
|
-
|
216
|
-
|
217
|
+
if (props.type === "number" && props.maxLength) {
|
218
|
+
console.log("type is ", props.type);
|
219
|
+
console.log("max length is ", props.maxLength);
|
220
|
+
let v = newValue.replace(/[^0-9]/g, "").slice(0, props.maxLength);
|
221
|
+
const newEvent = { ...e, target: { ...e.target, value: v } };
|
222
|
+
setValue(v);
|
223
|
+
props.onChange(newEvent);
|
224
|
+
} else {
|
225
|
+
console.log("NETIHERRRER");
|
226
|
+
const newEvent = { ...e, target: { ...e.target, value: newValue } };
|
227
|
+
setValue(newValue);
|
228
|
+
props.onChange(newEvent);
|
229
|
+
}
|
217
230
|
}
|
218
231
|
};
|
232
|
+
const handleKeyDown = (e) => {
|
233
|
+
if (props.type === "number" && ["e", "E", "+", "-", "."].includes(e.key)) {
|
234
|
+
e.preventDefault();
|
235
|
+
}
|
236
|
+
props.onKeyDown && props.onKeyDown(e);
|
237
|
+
};
|
219
238
|
return /* @__PURE__ */ React2.createElement(
|
220
239
|
"div",
|
221
240
|
{
|
@@ -228,16 +247,7 @@ var Input = forwardRef(
|
|
228
247
|
)
|
229
248
|
},
|
230
249
|
props.label && /* @__PURE__ */ React2.createElement(Label, { ...labelProps }, props.label),
|
231
|
-
/* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React2.createElement(
|
232
|
-
"span",
|
233
|
-
{
|
234
|
-
className: cn(
|
235
|
-
"hawa-me-2 hawa-opacity-90",
|
236
|
-
!forceHideHelperText && "hawa-mb-2"
|
237
|
-
)
|
238
|
-
},
|
239
|
-
props.outsidePrefix
|
240
|
-
), props.isLoading ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(
|
250
|
+
/* @__PURE__ */ React2.createElement("div", { className: "hawa-flex hawa-flex-row hawa-w-full hawa-items-center" }, props.outsidePrefix && /* @__PURE__ */ React2.createElement("span", { className: cn("hawa-me-2 hawa-opacity-90", !forceHideHelperText && "hawa-mb-2") }, props.outsidePrefix), props.isLoading ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(Skeleton, { className: "hawa-h-[40px] hawa-w-full" })) : props.isLoadingError ? /* @__PURE__ */ React2.createElement("div", { className: "hawa-pb-2 hawa-w-full" }, /* @__PURE__ */ React2.createElement(
|
241
251
|
Skeleton,
|
242
252
|
{
|
243
253
|
animation: "none",
|
@@ -284,13 +294,15 @@ var Input = forwardRef(
|
|
284
294
|
required: true,
|
285
295
|
dir: props.dir,
|
286
296
|
type: props.type,
|
287
|
-
value: props.value,
|
297
|
+
value: props.value || value,
|
288
298
|
onChange: handleChange,
|
299
|
+
onKeyDown: handleKeyDown,
|
289
300
|
autoComplete: props.autoComplete,
|
290
301
|
defaultValue: props.defaultValue,
|
291
302
|
placeholder,
|
292
303
|
disabled: props.disabled || preview,
|
293
304
|
style: { height: 40 },
|
305
|
+
maxLength: props.maxLength,
|
294
306
|
...inputProps,
|
295
307
|
className: cn(
|
296
308
|
defaultInputStyle,
|
@@ -517,7 +529,7 @@ var Select = ({
|
|
517
529
|
};
|
518
530
|
|
519
531
|
// elements/phoneInput/PhoneInput.tsx
|
520
|
-
import React4, { useState as
|
532
|
+
import React4, { useState as useState3, useRef as useRef2 } from "react";
|
521
533
|
|
522
534
|
// countries.ts
|
523
535
|
var countries = [
|
@@ -2219,8 +2231,8 @@ var PhoneInput = ({
|
|
2219
2231
|
countryCodes,
|
2220
2232
|
...props
|
2221
2233
|
}) => {
|
2222
|
-
const [phoneNumber, setPhoneNumber] =
|
2223
|
-
const [countryCode, setCountryCode] =
|
2234
|
+
const [phoneNumber, setPhoneNumber] = useState3("");
|
2235
|
+
const [countryCode, setCountryCode] = useState3(props.preferredCountry);
|
2224
2236
|
const inputRef = useRef2(null);
|
2225
2237
|
const handleInputChange = (e) => {
|
2226
2238
|
console.log("test e ", e.target.value);
|
@@ -2629,7 +2641,7 @@ var PopoverPortal = PopoverPrimitive.Portal;
|
|
2629
2641
|
var PopoverRoot = PopoverPrimitive.Root;
|
2630
2642
|
|
2631
2643
|
// elements/radio/Radio.tsx
|
2632
|
-
import React9, { useState as
|
2644
|
+
import React9, { useState as useState4, useRef as useRef3, useEffect as useEffect3, forwardRef as forwardRef7 } from "react";
|
2633
2645
|
import { TabsList, TabsTrigger, Tabs } from "@radix-ui/react-tabs";
|
2634
2646
|
var Radio = forwardRef7(
|
2635
2647
|
({
|
@@ -2667,10 +2679,10 @@ var Radio = forwardRef7(
|
|
2667
2679
|
const [parentDirection, setParentDirection] = React9.useState(
|
2668
2680
|
null
|
2669
2681
|
);
|
2670
|
-
const [selectedOption, setSelectedOption] =
|
2682
|
+
const [selectedOption, setSelectedOption] = useState4(
|
2671
2683
|
props.defaultValue || props.value
|
2672
2684
|
);
|
2673
|
-
const [openTooltip, setOpenTooltip] =
|
2685
|
+
const [openTooltip, setOpenTooltip] = useState4(null);
|
2674
2686
|
const parentRef = useRef3(null);
|
2675
2687
|
useEffect3(() => {
|
2676
2688
|
var _a2;
|
@@ -71,6 +71,7 @@ function Skeleton({
|
|
71
71
|
content,
|
72
72
|
animation = "pulse",
|
73
73
|
fade,
|
74
|
+
as = "div",
|
74
75
|
...props
|
75
76
|
}) {
|
76
77
|
const animationStyles = {
|
@@ -84,6 +85,10 @@ function Skeleton({
|
|
84
85
|
right: "hawa-mask-fade-right",
|
85
86
|
left: "hawa-mask-fade-left "
|
86
87
|
};
|
88
|
+
const styledAs = {
|
89
|
+
div: "",
|
90
|
+
input: "!h-[38px] !w-full"
|
91
|
+
};
|
87
92
|
return /* @__PURE__ */ import_react.default.createElement(
|
88
93
|
"div",
|
89
94
|
{
|
@@ -91,6 +96,7 @@ function Skeleton({
|
|
91
96
|
animationStyles[animation],
|
92
97
|
content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
|
93
98
|
fade && fadeStyle[fade],
|
99
|
+
styledAs[as],
|
94
100
|
className
|
95
101
|
),
|
96
102
|
...props
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/colorPicker/index.ts","../../elements/colorPicker/ColorPicker.tsx","../../util/index.ts","../../elements/skeleton/Skeleton.tsx","../../elements/helperText/HelperText.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["export * from \"./ColorPicker\";","import React, {\n useState,\n FC,\n ChangeEvent,\n InputHTMLAttributes,\n useEffect,\n FormEvent,\n} from \"react\";\n\nimport { calculateLuminance, cn, getTextColor } from \"@util/index\";\n\nimport { Skeleton } from \"@elements/skeleton\";\n\nimport { HelperText } from \"../helperText\";\nimport { Label, LabelProps } from \"../label\";\n\ntype ColorPickerTypes = {\n label?: string;\n id?: string;\n isLoading?: boolean;\n labelProps?: LabelProps;\n helperText?: any;\n forceHideHelperText?: boolean;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n /** The hex code for the color */\n color?: any;\n /** Fires everytime the color changes */\n handleChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n colorPickerClassNames?: string;\n colorTextClassNames?: string;\n colorPickerProps?: InputHTMLAttributes<HTMLInputElement>;\n textInputProps?: InputHTMLAttributes<HTMLInputElement>;\n containerProps?: InputHTMLAttributes<HTMLDivElement>;\n};\n\nexport const ColorPicker: FC<ColorPickerTypes> = ({\n containerProps,\n colorPickerProps,\n textInputProps,\n labelProps,\n forceHideHelperText,\n isLoading,\n preview = false,\n ...props\n}) => {\n const [selectedColor, setSelectedColor] = useState(props.color);\n\n useEffect(() => {\n if (selectedColor && selectedColor[0] !== \"#\") {\n setSelectedColor(`#${selectedColor}`);\n }\n }, [selectedColor]);\n\n const handleTextInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputElement = e.target as HTMLInputElement;\n let inputColor = inputElement.value;\n\n if (inputColor[0] !== \"#\") {\n // Prepend a hash (#) to the input value\n inputColor = `#${inputColor}`;\n // inputElement.value = inputColor;\n }\n // Remove any non-alphanumeric characters except the hash (#)\n const sanitizedInput = inputColor.replace(/[^a-fA-F0-9#]/g, \"\");\n\n setSelectedColor(sanitizedInput);\n\n if (props.handleChange) {\n props.handleChange(e); // Pass the original event\n }\n };\n\n return (\n <div className=\"hawa-flex hawa-w-fit hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {isLoading ? (\n <Skeleton style={{ height: 40, width: 148 }} />\n ) : (\n <div dir=\"ltr\" className=\"hawa-flex hawa-w-full hawa-flex-row\">\n <div\n style={{ height: 40, backgroundColor: selectedColor }}\n className=\"hawa-rounded-bl-lg hawa-rounded-tl-lg hawa-border\"\n >\n <input\n disabled={preview}\n type=\"color\"\n value={selectedColor}\n onChange={(e) => {\n setSelectedColor(e.target.value);\n if (props.handleChange) {\n props.handleChange(e); //TODO: perhaps change this to onChange\n }\n }}\n className={cn(\n \"hawa-mt-0 hawa-h-[38px] hawa-opacity-0\",\n props.colorPickerClassNames,\n )}\n {...colorPickerProps}\n />\n </div>\n <div className=\"hawa-relative hawa-flex hawa-max-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0\">\n <input\n disabled={preview}\n maxLength={7}\n type=\"text\"\n onInput={handleTextInputChange}\n value={selectedColor}\n className={cn(\n \"hawa-block hawa-h-[40px] hawa-w-24 hawa-rounded hawa-rounded-l-none hawa-bg-background hawa-p-2 hawa-text-sm hawa-transition-all\",\n \"hawa-border hawa-border-l-0 hawa-border-l-transparent placeholder:hawa-text-muted-foreground\",\n // \"hawa-border hawa-border-x-0 hawa-border-x-transparent hawa-border-b-0 hawa-rounded-tr-none\"\n )}\n style={{\n backgroundColor: preview\n ? selectedColor\n : \"hsl(var(--background))\",\n color: preview\n ? calculateLuminance(selectedColor) > 0.5\n ? \"black\"\n : \"white\"\n : \"\",\n }}\n // 0.179\n {...textInputProps}\n />\n </div>\n </div>\n )}\n\n {!forceHideHelperText && <HelperText helperText={props.helperText} />}\n </div>\n );\n};\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","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n fade?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n fade,\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\",\n };\n const fadeStyle = {\n bottom: \"hawa-mask-fade-bottom\",\n top: \"hawa-mask-fade-top\",\n right: \"hawa-mask-fade-right\",\n left: \"hawa-mask-fade-left \",\n };\n\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n fade && fadeStyle[fade],\n className,\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n}\n\nexport { Skeleton };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport const HelperText = ({\n helperText,\n}: {\n helperText?: string | React.ReactNode;\n}) => (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-helper-color hawa-transition-all hawa-text-xs\",\n helperText ? \"hawa-opacity-100 hawa-h-4\" : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {helperText}\n </p>\n);\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className,\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault(),\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-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\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\",\n },\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\",\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAOO;;;ACPP,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;AA6EA,IAAM,aAAa,CA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IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,MAAK;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA,MAEF;AAAA,MACA,OAAO;AAAA,QACL,iBAAiB,UACb,gBACA;AAAA,QACJ,OAAO,UACH,mBAAmB,aAAa,IAAI,MAClC,UACA,UACF;AAAA,MACN;AAAA,MAEC,GAAG;AAAA;AAAA,EACN,CACF,CACF,GAGD,CAAC,uBAAuB,8BAAAA,QAAA,cAAC,cAAW,YAAY,MAAM,YAAY,CACrE;AAEJ;","names":["import_react","React","import_react","React","React","import_react","React","React"]}
|
1
|
+
{"version":3,"sources":["../../elements/colorPicker/index.ts","../../elements/colorPicker/ColorPicker.tsx","../../util/index.ts","../../elements/skeleton/Skeleton.tsx","../../elements/helperText/HelperText.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["export * from \"./ColorPicker\";","import React, {\n useState,\n FC,\n ChangeEvent,\n InputHTMLAttributes,\n useEffect,\n FormEvent,\n} from \"react\";\n\nimport { calculateLuminance, cn, getTextColor } from \"@util/index\";\n\nimport { Skeleton } from \"@elements/skeleton\";\n\nimport { HelperText } from \"../helperText\";\nimport { Label, LabelProps } from \"../label\";\n\ntype ColorPickerTypes = {\n label?: string;\n id?: string;\n isLoading?: boolean;\n labelProps?: LabelProps;\n helperText?: any;\n forceHideHelperText?: boolean;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n /** The hex code for the color */\n color?: any;\n /** Fires everytime the color changes */\n handleChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n colorPickerClassNames?: string;\n colorTextClassNames?: string;\n colorPickerProps?: InputHTMLAttributes<HTMLInputElement>;\n textInputProps?: InputHTMLAttributes<HTMLInputElement>;\n containerProps?: InputHTMLAttributes<HTMLDivElement>;\n};\n\nexport const ColorPicker: FC<ColorPickerTypes> = ({\n containerProps,\n colorPickerProps,\n textInputProps,\n labelProps,\n forceHideHelperText,\n isLoading,\n preview = false,\n ...props\n}) => {\n const [selectedColor, setSelectedColor] = useState(props.color);\n\n useEffect(() => {\n if (selectedColor && selectedColor[0] !== \"#\") {\n setSelectedColor(`#${selectedColor}`);\n }\n }, [selectedColor]);\n\n const handleTextInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputElement = e.target as HTMLInputElement;\n let inputColor = inputElement.value;\n\n if (inputColor[0] !== \"#\") {\n // Prepend a hash (#) to the input value\n inputColor = `#${inputColor}`;\n // inputElement.value = inputColor;\n }\n // Remove any non-alphanumeric characters except the hash (#)\n const sanitizedInput = inputColor.replace(/[^a-fA-F0-9#]/g, \"\");\n\n setSelectedColor(sanitizedInput);\n\n if (props.handleChange) {\n props.handleChange(e); // Pass the original event\n }\n };\n\n return (\n <div className=\"hawa-flex hawa-w-fit hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {isLoading ? (\n <Skeleton style={{ height: 40, width: 148 }} />\n ) : (\n <div dir=\"ltr\" className=\"hawa-flex hawa-w-full hawa-flex-row\">\n <div\n style={{ height: 40, backgroundColor: selectedColor }}\n className=\"hawa-rounded-bl-lg hawa-rounded-tl-lg hawa-border\"\n >\n <input\n disabled={preview}\n type=\"color\"\n value={selectedColor}\n onChange={(e) => {\n setSelectedColor(e.target.value);\n if (props.handleChange) {\n props.handleChange(e); //TODO: perhaps change this to onChange\n }\n }}\n className={cn(\n \"hawa-mt-0 hawa-h-[38px] hawa-opacity-0\",\n props.colorPickerClassNames,\n )}\n {...colorPickerProps}\n />\n </div>\n <div className=\"hawa-relative hawa-flex hawa-max-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0\">\n <input\n disabled={preview}\n maxLength={7}\n type=\"text\"\n onInput={handleTextInputChange}\n value={selectedColor}\n className={cn(\n \"hawa-block hawa-h-[40px] hawa-w-24 hawa-rounded hawa-rounded-l-none hawa-bg-background hawa-p-2 hawa-text-sm hawa-transition-all\",\n \"hawa-border hawa-border-l-0 hawa-border-l-transparent placeholder:hawa-text-muted-foreground\",\n // \"hawa-border hawa-border-x-0 hawa-border-x-transparent hawa-border-b-0 hawa-rounded-tr-none\"\n )}\n style={{\n backgroundColor: preview\n ? selectedColor\n : \"hsl(var(--background))\",\n color: preview\n ? calculateLuminance(selectedColor) > 0.5\n ? \"black\"\n : \"white\"\n : \"\",\n }}\n // 0.179\n {...textInputProps}\n />\n </div>\n </div>\n )}\n\n {!forceHideHelperText && <HelperText helperText={props.helperText} />}\n </div>\n );\n};\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","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n fade?: \"top\" | \"bottom\" | \"left\" | \"right\";\n as?: \"div\" | \"input\";\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n fade,\n as = \"div\",\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\",\n };\n const fadeStyle = {\n bottom: \"hawa-mask-fade-bottom\",\n top: \"hawa-mask-fade-top\",\n right: \"hawa-mask-fade-right\",\n left: \"hawa-mask-fade-left \",\n };\n\n const styledAs = {\n div: \"\",\n input: \"!h-[38px] !w-full\",\n };\n\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n fade && fadeStyle[fade],\n styledAs[as],\n className,\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n}\n\nexport { Skeleton };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport const HelperText = ({\n helperText,\n}: {\n helperText?: string | React.ReactNode;\n}) => (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-helper-color hawa-transition-all hawa-text-xs\",\n helperText ? \"hawa-opacity-100 hawa-h-4\" : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {helperText}\n </p>\n);\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className,\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault(),\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-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\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\",\n },\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\",\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAOO;;;ACPP,kBAAsC;AACtC,4BAAwB;AAEjB,SAAS,MAAM,QAAsB;AAC1C,aAAO,mCAAQ,kBAAK,MAAM,CAAC;AAC7B;AA6EA,IAAM,aAAa,CAAC,UAAe;AACjC,MAAI,MAAM,WAAW,GAAG,GAAG;AAEzB,QAAI,IAAI,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EA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AAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,MAAK;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA,MAEF;AAAA,MACA,OAAO;AAAA,QACL,iBAAiB,UACb,gBACA;AAAA,QACJ,OAAO,UACH,mBAAmB,aAAa,IAAI,MAClC,UACA,UACF;AAAA,MACN;AAAA,MAEC,GAAG;AAAA;AAAA,EACN,CACF,CACF,GAGD,CAAC,uBAAuB,8BAAAA,QAAA,cAAC,cAAW,YAAY,MAAM,YAAY,CACrE;AAEJ;","names":["import_react","React","import_react","React","React","import_react","React","React"]}
|
@@ -39,6 +39,7 @@ function Skeleton({
|
|
39
39
|
content,
|
40
40
|
animation = "pulse",
|
41
41
|
fade,
|
42
|
+
as = "div",
|
42
43
|
...props
|
43
44
|
}) {
|
44
45
|
const animationStyles = {
|
@@ -52,6 +53,10 @@ function Skeleton({
|
|
52
53
|
right: "hawa-mask-fade-right",
|
53
54
|
left: "hawa-mask-fade-left "
|
54
55
|
};
|
56
|
+
const styledAs = {
|
57
|
+
div: "",
|
58
|
+
input: "!h-[38px] !w-full"
|
59
|
+
};
|
55
60
|
return /* @__PURE__ */ React.createElement(
|
56
61
|
"div",
|
57
62
|
{
|
@@ -59,6 +64,7 @@ function Skeleton({
|
|
59
64
|
animationStyles[animation],
|
60
65
|
content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
|
61
66
|
fade && fadeStyle[fade],
|
67
|
+
styledAs[as],
|
62
68
|
className
|
63
69
|
),
|
64
70
|
...props
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../../elements/colorPicker/ColorPicker.tsx","../../util/index.ts","../../elements/skeleton/Skeleton.tsx","../../elements/helperText/HelperText.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["import React, {\n useState,\n FC,\n ChangeEvent,\n InputHTMLAttributes,\n useEffect,\n FormEvent,\n} from \"react\";\n\nimport { calculateLuminance, cn, getTextColor } from \"@util/index\";\n\nimport { Skeleton } from \"@elements/skeleton\";\n\nimport { HelperText } from \"../helperText\";\nimport { Label, LabelProps } from \"../label\";\n\ntype ColorPickerTypes = {\n label?: string;\n id?: string;\n isLoading?: boolean;\n labelProps?: LabelProps;\n helperText?: any;\n forceHideHelperText?: boolean;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n /** The hex code for the color */\n color?: any;\n /** Fires everytime the color changes */\n handleChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n colorPickerClassNames?: string;\n colorTextClassNames?: string;\n colorPickerProps?: InputHTMLAttributes<HTMLInputElement>;\n textInputProps?: InputHTMLAttributes<HTMLInputElement>;\n containerProps?: InputHTMLAttributes<HTMLDivElement>;\n};\n\nexport const ColorPicker: FC<ColorPickerTypes> = ({\n containerProps,\n colorPickerProps,\n textInputProps,\n labelProps,\n forceHideHelperText,\n isLoading,\n preview = false,\n ...props\n}) => {\n const [selectedColor, setSelectedColor] = useState(props.color);\n\n useEffect(() => {\n if (selectedColor && selectedColor[0] !== \"#\") {\n setSelectedColor(`#${selectedColor}`);\n }\n }, [selectedColor]);\n\n const handleTextInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputElement = e.target as HTMLInputElement;\n let inputColor = inputElement.value;\n\n if (inputColor[0] !== \"#\") {\n // Prepend a hash (#) to the input value\n inputColor = `#${inputColor}`;\n // inputElement.value = inputColor;\n }\n // Remove any non-alphanumeric characters except the hash (#)\n const sanitizedInput = inputColor.replace(/[^a-fA-F0-9#]/g, \"\");\n\n setSelectedColor(sanitizedInput);\n\n if (props.handleChange) {\n props.handleChange(e); // Pass the original event\n }\n };\n\n return (\n <div className=\"hawa-flex hawa-w-fit hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {isLoading ? (\n <Skeleton style={{ height: 40, width: 148 }} />\n ) : (\n <div dir=\"ltr\" className=\"hawa-flex hawa-w-full hawa-flex-row\">\n <div\n style={{ height: 40, backgroundColor: selectedColor }}\n className=\"hawa-rounded-bl-lg hawa-rounded-tl-lg hawa-border\"\n >\n <input\n disabled={preview}\n type=\"color\"\n value={selectedColor}\n onChange={(e) => {\n setSelectedColor(e.target.value);\n if (props.handleChange) {\n props.handleChange(e); //TODO: perhaps change this to onChange\n }\n }}\n className={cn(\n \"hawa-mt-0 hawa-h-[38px] hawa-opacity-0\",\n props.colorPickerClassNames,\n )}\n {...colorPickerProps}\n />\n </div>\n <div className=\"hawa-relative hawa-flex hawa-max-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0\">\n <input\n disabled={preview}\n maxLength={7}\n type=\"text\"\n onInput={handleTextInputChange}\n value={selectedColor}\n className={cn(\n \"hawa-block hawa-h-[40px] hawa-w-24 hawa-rounded hawa-rounded-l-none hawa-bg-background hawa-p-2 hawa-text-sm hawa-transition-all\",\n \"hawa-border hawa-border-l-0 hawa-border-l-transparent placeholder:hawa-text-muted-foreground\",\n // \"hawa-border hawa-border-x-0 hawa-border-x-transparent hawa-border-b-0 hawa-rounded-tr-none\"\n )}\n style={{\n backgroundColor: preview\n ? selectedColor\n : \"hsl(var(--background))\",\n color: preview\n ? calculateLuminance(selectedColor) > 0.5\n ? \"black\"\n : \"white\"\n : \"\",\n }}\n // 0.179\n {...textInputProps}\n />\n </div>\n </div>\n )}\n\n {!forceHideHelperText && <HelperText helperText={props.helperText} />}\n </div>\n );\n};\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","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n fade?: \"top\" | \"bottom\" | \"left\" | \"right\";\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n fade,\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\",\n };\n const fadeStyle = {\n bottom: \"hawa-mask-fade-bottom\",\n top: \"hawa-mask-fade-top\",\n right: \"hawa-mask-fade-right\",\n left: \"hawa-mask-fade-left \",\n };\n\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n fade && fadeStyle[fade],\n className,\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n}\n\nexport { Skeleton };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport const HelperText = ({\n helperText,\n}: {\n helperText?: string | React.ReactNode;\n}) => (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-helper-color hawa-transition-all hawa-text-xs\",\n helperText ? \"hawa-opacity-100 hawa-h-4\" : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {helperText}\n </p>\n);\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className,\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault(),\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-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\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\",\n },\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\",\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;AAAA,OAAOA;AAAA,EACL;AAAA,EAIA;AAAA,OAEK;;;ACPP,SAAS,YAA6B;AACtC,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AA6EA,IAAM,aAAa,CAAC,UAAe;AACjC,MAAI,MAAM,WAAW,GAAG,GAAG;AAEzB,QAAI,IAAI,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AACtC,QAAI,IAAI,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AACtC,QAAI,IAAI,SAAS,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;AACtC,WAAO,CAAC,GAAG,GAAG,CAAC;AAAA,EACjB,WAAW,MAAM,WAAW,KAAK,GAAG;AAElC,WAAO,MAAM,MAAM,MAAM,EAAE,IAAI,MAAM;AAAA,EACvC;AAEA,SAAO,CAAC,KAAK,KAAK,GAAG;AACvB;AACO,IAAM,qBAAqB,CAAC,UAAe;AAhGlD;AAiGE,QAAM,CAAC,GAAG,GAAG,CAAC,KAAI,gBAAW,KAAK,MAAhB,mBAAmB,IAAI,CAAC,MAAW;AACnD,SAAK;AACL,WAAO,KAAK,UAAU,IAAI,UAAU,IAAI,SAAS,UAAU;AAAA,EAC7D;AACA,SAAO,SAAS,IAAI,SAAS,IAAI,SAAS;AAC5C;;;ACtGA,OAAO,WAAW;AAWlB,SAAS,SAAS;AAAA,EAChB;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GAAkB;AAChB,QAAM,kBAAkB;AAAA,IACtB,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SACE;AAAA,EACJ;AACA,QAAM,YAAY;AAAA,IAChB,QAAQ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OAAO;AAAA,QACP,UAAU,CAAC,MAAM;AACf,2BAAiB,EAAE,OAAO,KAAK;AAC/B,cAAI,MAAM,cAAc;AACtB,kBAAM,aAAa,CAAC;AAAA,UACtB;AAAA,QACF;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,MAAM;AAAA,QACR;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EACF,GACA,gBAAAA,OAAA,cAAC,SAAI,WAAU,qGACb,gBAAAA,OAAA;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,MAAK;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA,MAEF;AAAA,MACA,OAAO;AAAA,QACL,iBAAiB,UACb,gBACA;AAAA,QACJ,OAAO,UACH,mBAAmB,aAAa,IAAI,MAClC,UACA,UACF;AAAA,MACN;AAAA,MAEC,GAAG;AAAA;AAAA,EACN,CACF,CACF,GAGD,CAAC,uBAAuB,gBAAAA,OAAA,cAAC,cAAW,YAAY,MAAM,YAAY,CACrE;AAEJ;","names":["React","React","React","React","React","React","React"]}
|
1
|
+
{"version":3,"sources":["../../elements/colorPicker/ColorPicker.tsx","../../util/index.ts","../../elements/skeleton/Skeleton.tsx","../../elements/helperText/HelperText.tsx","../../elements/label/Label.tsx","../../elements/tooltip/Tooltip.tsx"],"sourcesContent":["import React, {\n useState,\n FC,\n ChangeEvent,\n InputHTMLAttributes,\n useEffect,\n FormEvent,\n} from \"react\";\n\nimport { calculateLuminance, cn, getTextColor } from \"@util/index\";\n\nimport { Skeleton } from \"@elements/skeleton\";\n\nimport { HelperText } from \"../helperText\";\nimport { Label, LabelProps } from \"../label\";\n\ntype ColorPickerTypes = {\n label?: string;\n id?: string;\n isLoading?: boolean;\n labelProps?: LabelProps;\n helperText?: any;\n forceHideHelperText?: boolean;\n /** Boolean to enable/disable editing the input field and using it as a text field */\n preview?: boolean;\n /** The hex code for the color */\n color?: any;\n /** Fires everytime the color changes */\n handleChange?: (e: ChangeEvent<HTMLInputElement>) => void;\n colorPickerClassNames?: string;\n colorTextClassNames?: string;\n colorPickerProps?: InputHTMLAttributes<HTMLInputElement>;\n textInputProps?: InputHTMLAttributes<HTMLInputElement>;\n containerProps?: InputHTMLAttributes<HTMLDivElement>;\n};\n\nexport const ColorPicker: FC<ColorPickerTypes> = ({\n containerProps,\n colorPickerProps,\n textInputProps,\n labelProps,\n forceHideHelperText,\n isLoading,\n preview = false,\n ...props\n}) => {\n const [selectedColor, setSelectedColor] = useState(props.color);\n\n useEffect(() => {\n if (selectedColor && selectedColor[0] !== \"#\") {\n setSelectedColor(`#${selectedColor}`);\n }\n }, [selectedColor]);\n\n const handleTextInputChange = (e: ChangeEvent<HTMLInputElement>) => {\n const inputElement = e.target as HTMLInputElement;\n let inputColor = inputElement.value;\n\n if (inputColor[0] !== \"#\") {\n // Prepend a hash (#) to the input value\n inputColor = `#${inputColor}`;\n // inputElement.value = inputColor;\n }\n // Remove any non-alphanumeric characters except the hash (#)\n const sanitizedInput = inputColor.replace(/[^a-fA-F0-9#]/g, \"\");\n\n setSelectedColor(sanitizedInput);\n\n if (props.handleChange) {\n props.handleChange(e); // Pass the original event\n }\n };\n\n return (\n <div className=\"hawa-flex hawa-w-fit hawa-flex-col hawa-gap-2\">\n {props.label && <Label {...labelProps}>{props.label}</Label>}\n {isLoading ? (\n <Skeleton style={{ height: 40, width: 148 }} />\n ) : (\n <div dir=\"ltr\" className=\"hawa-flex hawa-w-full hawa-flex-row\">\n <div\n style={{ height: 40, backgroundColor: selectedColor }}\n className=\"hawa-rounded-bl-lg hawa-rounded-tl-lg hawa-border\"\n >\n <input\n disabled={preview}\n type=\"color\"\n value={selectedColor}\n onChange={(e) => {\n setSelectedColor(e.target.value);\n if (props.handleChange) {\n props.handleChange(e); //TODO: perhaps change this to onChange\n }\n }}\n className={cn(\n \"hawa-mt-0 hawa-h-[38px] hawa-opacity-0\",\n props.colorPickerClassNames,\n )}\n {...colorPickerProps}\n />\n </div>\n <div className=\"hawa-relative hawa-flex hawa-max-h-fit hawa-w-full hawa-flex-col hawa-justify-center hawa-gap-0\">\n <input\n disabled={preview}\n maxLength={7}\n type=\"text\"\n onInput={handleTextInputChange}\n value={selectedColor}\n className={cn(\n \"hawa-block hawa-h-[40px] hawa-w-24 hawa-rounded hawa-rounded-l-none hawa-bg-background hawa-p-2 hawa-text-sm hawa-transition-all\",\n \"hawa-border hawa-border-l-0 hawa-border-l-transparent placeholder:hawa-text-muted-foreground\",\n // \"hawa-border hawa-border-x-0 hawa-border-x-transparent hawa-border-b-0 hawa-rounded-tr-none\"\n )}\n style={{\n backgroundColor: preview\n ? selectedColor\n : \"hsl(var(--background))\",\n color: preview\n ? calculateLuminance(selectedColor) > 0.5\n ? \"black\"\n : \"white\"\n : \"\",\n }}\n // 0.179\n {...textInputProps}\n />\n </div>\n </div>\n )}\n\n {!forceHideHelperText && <HelperText helperText={props.helperText} />}\n </div>\n );\n};\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","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\ninterface SkeletonProps extends React.HTMLAttributes<HTMLDivElement> {\n className?: string;\n animation?: \"none\" | \"pulse\" | \"shimmer\";\n content?: any;\n fade?: \"top\" | \"bottom\" | \"left\" | \"right\";\n as?: \"div\" | \"input\";\n}\n\nfunction Skeleton({\n className,\n content,\n animation = \"pulse\",\n fade,\n as = \"div\",\n ...props\n}: SkeletonProps) {\n const animationStyles = {\n none: \"hawa-rounded hawa-bg-muted\",\n pulse: \"hawa-animate-pulse hawa-rounded hawa-bg-muted\",\n shimmer:\n \"hawa-space-y-5 hawa-rounded hawa-bg-muted hawa-p-4 hawa-relative before:hawa-absolute before:hawa-inset-0 before:hawa--translate-x-full before:hawa-animate-[shimmer_2s_infinite] before:hawa-bg-gradient-to-r before:hawa-from-transparent before:hawa-via-gray-300/40 dark:before:hawa-via-white/10 before:hawa-to-transparent hawa-isolate hawa-overflow-hidden before:hawa-border-t before:hawa-border-rose-100/10\",\n };\n const fadeStyle = {\n bottom: \"hawa-mask-fade-bottom\",\n top: \"hawa-mask-fade-top\",\n right: \"hawa-mask-fade-right\",\n left: \"hawa-mask-fade-left \",\n };\n\n const styledAs = {\n div: \"\",\n input: \"!h-[38px] !w-full\",\n };\n\n return (\n <div\n className={cn(\n animationStyles[animation],\n content &&\n \"hawa-flex hawa-flex-col hawa-items-center hawa-justify-center\",\n fade && fadeStyle[fade],\n styledAs[as],\n className,\n )}\n {...props}\n >\n {content && content}\n </div>\n );\n}\n\nexport { Skeleton };\n","import React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nexport const HelperText = ({\n helperText,\n}: {\n helperText?: string | React.ReactNode;\n}) => (\n <p\n className={cn(\n \"hawa-my-0 hawa-text-start hawa-text-helper-color hawa-transition-all hawa-text-xs\",\n helperText ? \"hawa-opacity-100 hawa-h-4\" : \"hawa-h-0 hawa-opacity-0\",\n )}\n >\n {helperText}\n </p>\n);\n","import * as React from \"react\";\n\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nimport { Tooltip } from \"../tooltip\";\n\nexport type LabelProps = {\n hint?: React.ReactNode;\n hintSide?: PositionType;\n htmlFor?: string;\n required?: boolean;\n};\n\nconst Label = React.forwardRef<\n HTMLLabelElement,\n React.LabelHTMLAttributes<HTMLLabelElement> & LabelProps\n>(({ className, hint, hintSide, required, children, ...props }, ref) => (\n <div className=\"hawa-flex hawa-flex-row hawa-items-center hawa-gap-1 hawa-transition-all\">\n <label\n ref={ref}\n className={cn(\n \"hawa-text-sm hawa-font-medium hawa-leading-none peer-disabled:hawa-cursor-not-allowed peer-disabled:hawa-opacity-70\",\n className,\n )}\n {...props}\n >\n {children}\n {required && <span className=\"hawa-mx-0.5 hawa-text-red-500\">*</span>}\n </label>\n {hint && (\n <Tooltip\n content={hint}\n side={hintSide}\n triggerProps={{\n tabIndex: -1,\n onClick: (event) => event.preventDefault(),\n }}\n >\n <div>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"hawa-h-[14px] hawa-w-[14px] hawa-cursor-help\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <circle cx=\"12\" cy=\"12\" r=\"10\" />\n <path d=\"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3\" />\n <path d=\"M12 17h.01\" />\n </svg>\n </div>\n </Tooltip>\n )}\n </div>\n));\n\nLabel.displayName = \"Label\";\n\nexport { Label };\n","import React from \"react\";\n\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\nimport { cn } from \"@util/index\";\n\nimport { PositionType } from \"@_types/commonTypes\";\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content> & {\n size?: \"default\" | \"small\" | \"large\";\n }\n>(({ className, sideOffset = 4, size = \"default\", ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"hawa-z-50 hawa-overflow-hidden hawa-rounded-md hawa-border hawa-bg-popover hawa-px-3 hawa-py-1.5 hawa-text-sm hawa-text-popover-foreground hawa-shadow-md hawa-animate-in hawa-fade-in-0 hawa-zoom-in-95 data-[state=closed]:hawa-animate-out data-[state=closed]:hawa-fade-out-0 data-[state=closed]:hawa-zoom-out-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\",\n {\n \"hawa-text-xs\": size === \"small\",\n \"hawa-text-xl\": size === \"large\",\n },\n className,\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nconst TooltipArrow = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Arrow>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Arrow>\n>(({ className, ...props }, ref) => (\n <TooltipPrimitive.Arrow ref={ref} className={cn(className)} {...props} />\n));\nTooltipArrow.displayName = TooltipPrimitive.Arrow.displayName;\n\ntype TooltipTypes = {\n /** Controls the open state of the tooltip. */\n open?: any;\n /** Specifies the side where the tooltip will appear. */\n side?: PositionType;\n /** Content to be displayed within the tooltip. */\n content?: any;\n /** Elements to which the tooltip is anchored. */\n children?: any;\n /** Sets the default open state of the tooltip. */\n defaultOpen?: any;\n /** Event handler for open state changes. */\n onOpenChange?: any;\n /** Duration of the delay before the tooltip appears. */\n delayDuration?: any;\n /** Size of the tooltip. */\n size?: \"default\" | \"small\" | \"large\";\n /** Disables the tooltip. */\n disabled?: boolean;\n triggerProps?: TooltipPrimitive.TooltipTriggerProps;\n contentProps?: TooltipPrimitive.TooltipContentProps;\n providerProps?: TooltipPrimitive.TooltipProps;\n};\n\nconst Tooltip: React.FunctionComponent<TooltipTypes> = ({\n side,\n size,\n open,\n content,\n children,\n disabled,\n defaultOpen,\n onOpenChange,\n triggerProps,\n contentProps,\n providerProps,\n delayDuration = 300,\n ...props\n}) => {\n return (\n <TooltipPrimitive.TooltipProvider\n delayDuration={delayDuration}\n {...providerProps}\n >\n <TooltipPrimitive.Root\n open={!disabled && open}\n defaultOpen={defaultOpen}\n onOpenChange={onOpenChange}\n {...props}\n >\n <TooltipPrimitive.Trigger {...triggerProps}>\n {children}\n </TooltipPrimitive.Trigger>\n <TooltipContent\n size={size}\n side={side}\n align=\"center\"\n {...contentProps}\n style={{\n ...contentProps?.style,\n maxWidth: \"var(--radix-tooltip-content-available-width)\",\n maxHeight: \"var(--radix-tooltip-content-available-height)\",\n }}\n >\n {content}\n </TooltipContent>\n </TooltipPrimitive.Root>\n </TooltipPrimitive.TooltipProvider>\n );\n};\n\nexport { Tooltip };\n"],"mappings":";;;AAAA,OAAOA;AAAA,EACL;AAAA,EAIA;AAAA,OAEK;;;ACPP,SAAS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AAa,CAAC;AAAA,UACtB;AAAA,QACF;AAAA,QACA,WAAW;AAAA,UACT;AAAA,UACA,MAAM;AAAA,QACR;AAAA,QACC,GAAG;AAAA;AAAA,IACN;AAAA,EACF,GACA,gBAAAA,OAAA,cAAC,SAAI,WAAU,qGACb,gBAAAA,OAAA;AAAA,IAAC;AAAA;AAAA,MACC,UAAU;AAAA,MACV,WAAW;AAAA,MACX,MAAK;AAAA,MACL,SAAS;AAAA,MACT,OAAO;AAAA,MACP,WAAW;AAAA,QACT;AAAA,QACA;AAAA;AAAA,MAEF;AAAA,MACA,OAAO;AAAA,QACL,iBAAiB,UACb,gBACA;AAAA,QACJ,OAAO,UACH,mBAAmB,aAAa,IAAI,MAClC,UACA,UACF;AAAA,MACN;AAAA,MAEC,GAAG;AAAA;AAAA,EACN,CACF,CACF,GAGD,CAAC,uBAAuB,gBAAAA,OAAA,cAAC,cAAW,YAAY,MAAM,YAAY,CACrE;AAEJ;","names":["React","React","React","React","React","React","React"]}
|
package/dist/combobox/index.js
CHANGED
@@ -457,6 +457,7 @@ var CommandItem = React2.forwardRef(({ className, ...props }, ref) => /* @__PURE
|
|
457
457
|
{
|
458
458
|
ref,
|
459
459
|
className: cn(
|
460
|
+
!props.disabled && "hawa-cursor-pointer",
|
460
461
|
"hawa-relative hawa-flex hawa-cursor-default hawa-select-none hawa-items-center hawa-rounded-sm hawa-px-2 hawa-py-1.5 hawa-text-sm hawa-outline-none aria-selected:hawa-bg-accent aria-selected:hawa-text-accent-foreground data-[disabled='true']:hawa-pointer-events-none data-[disabled='true']:hawa-opacity-50",
|
461
462
|
className
|
462
463
|
),
|
@@ -646,6 +647,7 @@ function Skeleton({
|
|
646
647
|
content,
|
647
648
|
animation = "pulse",
|
648
649
|
fade,
|
650
|
+
as = "div",
|
649
651
|
...props
|
650
652
|
}) {
|
651
653
|
const animationStyles = {
|
@@ -659,6 +661,10 @@ function Skeleton({
|
|
659
661
|
right: "hawa-mask-fade-right",
|
660
662
|
left: "hawa-mask-fade-left "
|
661
663
|
};
|
664
|
+
const styledAs = {
|
665
|
+
div: "",
|
666
|
+
input: "!h-[38px] !w-full"
|
667
|
+
};
|
662
668
|
return /* @__PURE__ */ import_react3.default.createElement(
|
663
669
|
"div",
|
664
670
|
{
|
@@ -666,6 +672,7 @@ function Skeleton({
|
|
666
672
|
animationStyles[animation],
|
667
673
|
content && "hawa-flex hawa-flex-col hawa-items-center hawa-justify-center",
|
668
674
|
fade && fadeStyle[fade],
|
675
|
+
styledAs[as],
|
669
676
|
className
|
670
677
|
),
|
671
678
|
...props
|