@beautinique/frontend-components 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/README.md +100 -2
  2. package/dist/index.cjs +4 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +2 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.ts +2 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +3 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/lib/button.d.cts +3 -0
  11. package/dist/lib/button.d.cts.map +1 -0
  12. package/dist/lib/button.d.ts +3 -0
  13. package/dist/lib/button.d.ts.map +1 -0
  14. package/dist/lib/constants.d.cts +5 -0
  15. package/dist/lib/constants.d.cts.map +1 -0
  16. package/dist/lib/constants.d.ts +5 -0
  17. package/dist/lib/constants.d.ts.map +1 -0
  18. package/dist/lib/tooltip.d.cts +6 -0
  19. package/dist/lib/tooltip.d.cts.map +1 -0
  20. package/dist/lib/tooltip.d.ts +6 -0
  21. package/dist/lib/tooltip.d.ts.map +1 -0
  22. package/dist/toast/ToastContainer.d.cts +6 -0
  23. package/dist/toast/ToastContainer.d.cts.map +1 -0
  24. package/dist/toast/ToastContainer.d.ts +6 -0
  25. package/dist/toast/ToastContainer.d.ts.map +1 -0
  26. package/dist/toast/index.cjs +618 -0
  27. package/dist/toast/index.cjs.map +1 -0
  28. package/dist/toast/index.d.cts +8 -0
  29. package/dist/toast/index.d.cts.map +1 -0
  30. package/dist/toast/index.d.ts +8 -0
  31. package/dist/toast/index.d.ts.map +1 -0
  32. package/dist/toast/index.js +603 -0
  33. package/dist/toast/index.js.map +1 -0
  34. package/dist/toast/toast-icons.d.cts +3 -0
  35. package/dist/toast/toast-icons.d.cts.map +1 -0
  36. package/dist/toast/toast-icons.d.ts +3 -0
  37. package/dist/toast/toast-icons.d.ts.map +1 -0
  38. package/dist/toast/toast.store.d.cts +4 -0
  39. package/dist/toast/toast.store.d.cts.map +1 -0
  40. package/dist/toast/toast.store.d.ts +4 -0
  41. package/dist/toast/toast.store.d.ts.map +1 -0
  42. package/dist/toast/toaster.d.cts +21 -0
  43. package/dist/toast/toaster.d.cts.map +1 -0
  44. package/dist/toast/toaster.d.ts +21 -0
  45. package/dist/toast/toaster.d.ts.map +1 -0
  46. package/dist/toast/types.d.cts +92 -0
  47. package/dist/toast/types.d.cts.map +1 -0
  48. package/dist/toast/types.d.ts +92 -0
  49. package/dist/toast/types.d.ts.map +1 -0
  50. package/dist/toast/uploads.d.cts +63 -0
  51. package/dist/toast/uploads.d.cts.map +1 -0
  52. package/dist/toast/uploads.d.ts +63 -0
  53. package/dist/toast/uploads.d.ts.map +1 -0
  54. package/dist/types/component.d.cts +27 -0
  55. package/dist/types/component.d.cts.map +1 -0
  56. package/dist/types/component.d.ts +27 -0
  57. package/dist/types/component.d.ts.map +1 -0
  58. package/dist/ui/Button.d.cts +3 -0
  59. package/dist/ui/Button.d.cts.map +1 -0
  60. package/dist/ui/Button.d.ts +3 -0
  61. package/dist/ui/Button.d.ts.map +1 -0
  62. package/dist/ui/Tooltip.d.cts +3 -0
  63. package/dist/ui/Tooltip.d.cts.map +1 -0
  64. package/dist/ui/Tooltip.d.ts +3 -0
  65. package/dist/ui/Tooltip.d.ts.map +1 -0
  66. package/dist/ui/index.cjs +205 -0
  67. package/dist/ui/index.cjs.map +1 -0
  68. package/dist/ui/index.d.cts +3 -0
  69. package/dist/ui/index.d.cts.map +1 -0
  70. package/dist/ui/index.d.ts +3 -0
  71. package/dist/ui/index.d.ts.map +1 -0
  72. package/dist/ui/index.js +202 -0
  73. package/dist/ui/index.js.map +1 -0
  74. package/package.json +100 -4
  75. package/source.css +11 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.cts","sourceRoot":"","sources":["../../src/ui/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,MAAM,GAAI,oEAOpB,OAAO,gCAsBT,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { IButton } from '../types/component.js';
2
+ export declare const Button: ({ pattern, content, className, leftIcon, rightIcon, buttonProps, }: IButton) => import("react").JSX.Element;
3
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/ui/Button.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAErD,eAAO,MAAM,MAAM,GAAI,oEAOpB,OAAO,gCAsBT,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ITooltip } from '../types/component.js';
2
+ export declare const Tooltip: ({ children, required, ...props }: ITooltip) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
3
+ //# sourceMappingURL=Tooltip.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.cts","sourceRoot":"","sources":["../../src/ui/Tooltip.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAqGtD,eAAO,MAAM,OAAO,GAAI,kCAAyC,QAAQ,gWAExE,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ITooltip } from '../types/component.js';
2
+ export declare const Tooltip: ({ children, required, ...props }: ITooltip) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react").JSX.Element | null | undefined;
3
+ //# sourceMappingURL=Tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../src/ui/Tooltip.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAqGtD,eAAO,MAAM,OAAO,GAAI,kCAAyC,QAAQ,gWAExE,CAAC"}
@@ -0,0 +1,205 @@
1
+ 'use strict';
2
+
3
+ var react = require('@iconify/react');
4
+ var react$1 = require('react');
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var reactDom = require('react-dom');
7
+
8
+ var __defProp = Object.defineProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+
11
+ // src/lib/button.ts
12
+ var getButtonCss = /* @__PURE__ */ __name((pattern) => {
13
+ switch (pattern) {
14
+ case "primary":
15
+ return "text-white bg-sky-blue-burst shadow-primary-btn hover:shadow-primary-btn-hover";
16
+ case "secondary":
17
+ return "text-secondary-invert bg-secondary shadow-secondary-btn hover:shadow-secondary-btn-hover";
18
+ case "tertiary":
19
+ return "text-tertiary-invert bg-tertiary shadow-tertiary-btn hover:shadow-tertiary-btn-hover";
20
+ case "outline":
21
+ return "text-primary border border-primary shadow-outline-btn hover:shadow-outline-btn-hover";
22
+ case "transparent":
23
+ default:
24
+ return "bg-transparent border border-primary/30 text-secondary";
25
+ }
26
+ }, "getButtonCss");
27
+ var Button = /* @__PURE__ */ __name(({
28
+ pattern,
29
+ content,
30
+ className = "",
31
+ leftIcon,
32
+ rightIcon,
33
+ buttonProps
34
+ }) => {
35
+ const btnCSS = getButtonCss(pattern);
36
+ const handleClick = /* @__PURE__ */ __name((e) => {
37
+ if (buttonProps?.disabled) return;
38
+ buttonProps?.onClick?.(e);
39
+ }, "handleClick");
40
+ return /* @__PURE__ */ jsxRuntime.jsxs(
41
+ "button",
42
+ {
43
+ ...buttonProps,
44
+ className: `group flex w-full cursor-pointer items-center justify-center gap-1 rounded-lg px-4 py-3 text-sm leading-4 transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-85 lg:px-5 lg:py-4 xl:text-base ${btnCSS} ${className} ${buttonProps?.className ?? ""}`,
45
+ type: buttonProps?.type ?? "button",
46
+ onClick: handleClick,
47
+ children: [
48
+ leftIcon && /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { ...leftIcon }),
49
+ typeof content === "object" ? /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { ...content }) : content,
50
+ rightIcon && /* @__PURE__ */ jsxRuntime.jsx(react.Icon, { ...rightIcon })
51
+ ]
52
+ }
53
+ );
54
+ }, "Button");
55
+
56
+ // src/lib/constants.ts
57
+ var TOOLTIP_GAP = 15;
58
+ var TOOLTIP_ANIMATION_DURATION = 400;
59
+ var TOAST_TYPES = [
60
+ "success",
61
+ "error",
62
+ "warning",
63
+ "progress",
64
+ "uploads",
65
+ "loading",
66
+ "default",
67
+ "custom"
68
+ ];
69
+ Object.fromEntries(TOAST_TYPES.map((type) => [type, type]));
70
+
71
+ // src/lib/tooltip.ts
72
+ var getTooltipPosition = /* @__PURE__ */ __name((rect, placement) => {
73
+ switch (placement) {
74
+ case "bottom":
75
+ return { top: rect.bottom, left: rect.left + rect.width / 2 };
76
+ case "right":
77
+ return { top: rect.top + rect.height / 2, left: rect.right };
78
+ case "left":
79
+ return { top: rect.top + rect.height / 2, left: rect.left };
80
+ case "top":
81
+ default:
82
+ return { top: rect.top, left: rect.left + rect.width / 2 };
83
+ }
84
+ }, "getTooltipPosition");
85
+ var getTooltipTransform = /* @__PURE__ */ __name((placement, isVisible) => {
86
+ const gap = String(isVisible ? TOOLTIP_GAP : 0);
87
+ switch (placement) {
88
+ case "bottom":
89
+ return `translate(-50%, ${gap}px)`;
90
+ case "right":
91
+ return `translate(${gap}px, -50%)`;
92
+ case "left":
93
+ return `translate(calc(-100% - ${gap}px), -50%)`;
94
+ case "top":
95
+ default:
96
+ return `translate(-50%, calc(-100% - ${gap}px))`;
97
+ }
98
+ }, "getTooltipTransform");
99
+ var getTooltipArrowCss = /* @__PURE__ */ __name((placement) => {
100
+ switch (placement) {
101
+ case "bottom":
102
+ return "after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-b-silver-jet-2";
103
+ case "right":
104
+ return "after:top-1/2 after:right-full after:-translate-y-1/2 after:border-r-silver-jet-2";
105
+ case "left":
106
+ return "after:top-1/2 after:left-full after:-translate-y-1/2 after:border-l-silver-jet-2";
107
+ case "top":
108
+ default:
109
+ return "after:top-full after:left-1/2 after:-translate-x-1/2 after:border-t-silver-jet-2";
110
+ }
111
+ }, "getTooltipArrowCss");
112
+ var OriginalTooltip = /* @__PURE__ */ __name(({
113
+ title,
114
+ description,
115
+ children,
116
+ className = "",
117
+ containerClassName = "",
118
+ placement = "top"
119
+ }) => {
120
+ const containerRef = react$1.useRef(null);
121
+ const [isOpen, setIsOpen] = react$1.useState(false);
122
+ const [isVisible, setIsVisible] = react$1.useState(false);
123
+ const [tooltipStyle, setTooltipStyle] = react$1.useState();
124
+ const closeTimerRef = react$1.useRef(void 0);
125
+ const animationFrameRef = react$1.useRef(void 0);
126
+ const updateTooltipPosition = react$1.useCallback(() => {
127
+ const container = containerRef.current;
128
+ if (!container) return;
129
+ setTooltipStyle(getTooltipPosition(container.getBoundingClientRect(), placement));
130
+ }, [placement]);
131
+ const showTooltip = /* @__PURE__ */ __name(() => {
132
+ animationFrameRef.current = window.requestAnimationFrame(() => {
133
+ animationFrameRef.current = window.requestAnimationFrame(() => {
134
+ setIsVisible(true);
135
+ });
136
+ });
137
+ }, "showTooltip");
138
+ const openTooltip = /* @__PURE__ */ __name(() => {
139
+ if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);
140
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
141
+ updateTooltipPosition();
142
+ setIsVisible(false);
143
+ setIsOpen(true);
144
+ showTooltip();
145
+ }, "openTooltip");
146
+ const closeTooltip = /* @__PURE__ */ __name(() => {
147
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
148
+ setIsVisible(false);
149
+ closeTimerRef.current = window.setTimeout(() => {
150
+ setIsOpen(false);
151
+ }, TOOLTIP_ANIMATION_DURATION);
152
+ }, "closeTooltip");
153
+ react$1.useEffect(() => {
154
+ return () => {
155
+ if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);
156
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
157
+ };
158
+ }, []);
159
+ react$1.useLayoutEffect(() => {
160
+ if (!isOpen) return;
161
+ updateTooltipPosition();
162
+ window.addEventListener("resize", updateTooltipPosition);
163
+ window.addEventListener("scroll", updateTooltipPosition, true);
164
+ return () => {
165
+ window.removeEventListener("resize", updateTooltipPosition);
166
+ window.removeEventListener("scroll", updateTooltipPosition, true);
167
+ };
168
+ }, [isOpen, updateTooltipPosition]);
169
+ return /* @__PURE__ */ jsxRuntime.jsxs(
170
+ "div",
171
+ {
172
+ ref: containerRef,
173
+ className: `relative inline-flex ${containerClassName}`,
174
+ onBlur: closeTooltip,
175
+ onFocus: openTooltip,
176
+ onMouseEnter: openTooltip,
177
+ onMouseLeave: closeTooltip,
178
+ children: [
179
+ children,
180
+ isOpen && tooltipStyle && reactDom.createPortal(
181
+ /* @__PURE__ */ jsxRuntime.jsxs(
182
+ "div",
183
+ {
184
+ className: `border-silver-jet-2 bg-platinum-jet fixed z-9999 flex flex-col items-center justify-center rounded-lg border px-3 py-2 text-center whitespace-nowrap backdrop-blur-md transition-all duration-400 ease-in-out after:absolute after:border-8 after:border-solid after:border-transparent after:content-[''] ${isVisible ? "visible opacity-100" : "invisible opacity-0"} ${getTooltipArrowCss(placement)} ${className} `,
185
+ style: { ...tooltipStyle, transform: getTooltipTransform(placement, isVisible) },
186
+ children: [
187
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-primary text-xs font-medium", children: title }),
188
+ description && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-tertiary text-[10px] font-light", children: description })
189
+ ]
190
+ }
191
+ ),
192
+ document.body
193
+ )
194
+ ]
195
+ }
196
+ );
197
+ }, "OriginalTooltip");
198
+ var Tooltip = /* @__PURE__ */ __name(({ children, required = true, ...props }) => {
199
+ return required ? /* @__PURE__ */ jsxRuntime.jsx(OriginalTooltip, { ...props, children }) : children;
200
+ }, "Tooltip");
201
+
202
+ exports.Button = Button;
203
+ exports.Tooltip = Tooltip;
204
+ //# sourceMappingURL=index.cjs.map
205
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/button.ts","../../src/ui/Button.tsx","../../src/lib/constants.ts","../../src/lib/tooltip.ts","../../src/ui/Tooltip.tsx"],"names":["jsxs","jsx","Icon","useRef","useState","useCallback","useEffect","useLayoutEffect","createPortal"],"mappings":";;;;;;;;;;;AAEO,IAAM,YAAA,2BAAgB,OAAA,KAAgC;AAC3D,EAAA,QAAQ,OAAA;AAAS,IACf,KAAK,SAAA;AACH,MAAA,OAAO,gFAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,0FAAA;AAAA,IACT,KAAK,UAAA;AACH,MAAA,OAAO,sFAAA;AAAA,IACT,KAAK,SAAA;AACH,MAAA,OAAO,sFAAA;AAAA,IACT,KAAK,aAAA;AAAA,IACL;AACE,MAAA,OAAO,wDAAA;AAAA;AAEb,CAAA,EAd4B,cAAA,CAAA;ACIrB,IAAM,yBAAS,MAAA,CAAA,CAAC;AAAA,EACrB,OAAA;AAAA,EACA,OAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA;AAAA,EACA,SAAA;AAAA,EACA;AACF,CAAA,KAAe;AACb,EAAA,MAAM,MAAA,GAAS,aAAa,OAAO,CAAA;AAEnC,EAAA,MAAM,WAAA,2BAAe,CAAA,KAAqC;AACxD,IAAA,IAAI,aAAa,QAAA,EAAU;AAC3B,IAAA,WAAA,EAAa,UAAU,CAAC,CAAA;AAAA,EAC1B,CAAA,EAHoB,aAAA,CAAA;AAKpB,EAAA,uBACEA,eAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,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AA,EAAQ,UAAS,CAAA,GAAqB,QAAA;AAC/E,CAAA,EAFuB,SAAA","file":"index.cjs","sourcesContent":["import type { IButton } from '../types/component.js';\n\nexport const getButtonCss = (pattern: IButton['pattern']) => {\n switch (pattern) {\n case 'primary':\n return 'text-white bg-sky-blue-burst shadow-primary-btn hover:shadow-primary-btn-hover';\n case 'secondary':\n return 'text-secondary-invert bg-secondary shadow-secondary-btn hover:shadow-secondary-btn-hover';\n case 'tertiary':\n return 'text-tertiary-invert bg-tertiary shadow-tertiary-btn hover:shadow-tertiary-btn-hover';\n case 'outline':\n return 'text-primary border border-primary shadow-outline-btn hover:shadow-outline-btn-hover';\n case 'transparent':\n default:\n return 'bg-transparent border border-primary/30 text-secondary';\n }\n};\n","import { Icon } from '@iconify/react';\nimport { type MouseEvent } from 'react';\n\nimport { getButtonCss } from '../lib/button.js';\nimport type { IButton } from '../types/component.js';\n\nexport const Button = ({\n pattern,\n content,\n className = '',\n leftIcon,\n rightIcon,\n buttonProps,\n}: IButton) => {\n const btnCSS = getButtonCss(pattern);\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n if (buttonProps?.disabled) return;\n buttonProps?.onClick?.(e);\n };\n\n return (\n <button\n {...buttonProps}\n className={`group flex w-full cursor-pointer items-center justify-center gap-1 rounded-lg px-4 py-3 text-sm leading-4 transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-85 lg:px-5 lg:py-4 xl:text-base ${btnCSS} ${className} ${\n buttonProps?.className ?? ''\n }`}\n type={buttonProps?.type ?? 'button'}\n onClick={handleClick}\n >\n {leftIcon && <Icon {...leftIcon} />}\n {typeof content === 'object' ? <Icon {...content} /> : content}\n {rightIcon && <Icon {...rightIcon} />}\n </button>\n );\n};\n","export const TOOLTIP_GAP = 15 as const;\nexport const TOOLTIP_ANIMATION_DURATION = 400 as const;\n\nexport const TOAST_TYPES = [\n 'success',\n 'error',\n 'warning',\n 'progress',\n 'uploads',\n 'loading',\n 'default',\n 'custom',\n] as const;\n\nexport const TOAST_TYPE = Object.fromEntries(TOAST_TYPES.map((type) => [type, type])) as {\n [K in (typeof TOAST_TYPES)[number]]: K;\n};\n","import type { CSSProperties } from 'react';\n\nimport type { ITooltip } from '../types/component.js';\nimport { TOOLTIP_GAP } from './constants.js';\n\nexport const getTooltipPosition = (\n rect: DOMRect,\n placement: NonNullable<ITooltip['placement']>,\n): CSSProperties => {\n switch (placement) {\n case 'bottom':\n return { top: rect.bottom, left: rect.left + rect.width / 2 };\n case 'right':\n return { top: rect.top + rect.height / 2, left: rect.right };\n case 'left':\n return { top: rect.top + rect.height / 2, left: rect.left };\n case 'top':\n default:\n return { top: rect.top, left: rect.left + rect.width / 2 };\n }\n};\n\nexport const getTooltipTransform = (\n placement: NonNullable<ITooltip['placement']>,\n isVisible: boolean,\n) => {\n const gap = String(isVisible ? TOOLTIP_GAP : 0);\n\n switch (placement) {\n case 'bottom':\n return `translate(-50%, ${gap}px)`;\n case 'right':\n return `translate(${gap}px, -50%)`;\n case 'left':\n return `translate(calc(-100% - ${gap}px), -50%)`;\n case 'top':\n default:\n return `translate(-50%, calc(-100% - ${gap}px))`;\n }\n};\n\nexport const getTooltipArrowCss = (placement: NonNullable<ITooltip['placement']>) => {\n switch (placement) {\n case 'bottom':\n return 'after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-b-silver-jet-2';\n case 'right':\n return 'after:top-1/2 after:right-full after:-translate-y-1/2 after:border-r-silver-jet-2';\n case 'left':\n return 'after:top-1/2 after:left-full after:-translate-y-1/2 after:border-l-silver-jet-2';\n case 'top':\n default:\n return 'after:top-full after:left-1/2 after:-translate-x-1/2 after:border-t-silver-jet-2';\n }\n};\n","import {\n type CSSProperties,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { TOOLTIP_ANIMATION_DURATION } from '../lib/constants.js';\nimport { getTooltipArrowCss, getTooltipPosition, getTooltipTransform } from '../lib/tooltip.js';\nimport type { ITooltip } from '../types/component.js';\n\nconst OriginalTooltip = ({\n title,\n description,\n children,\n className = '',\n containerClassName = '',\n placement = 'top',\n}: Omit<ITooltip, 'required'>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [isVisible, setIsVisible] = useState(false);\n const [tooltipStyle, setTooltipStyle] = useState<CSSProperties>();\n const closeTimerRef = useRef<number | undefined>(undefined);\n const animationFrameRef = useRef<number | undefined>(undefined);\n\n const updateTooltipPosition = useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setTooltipStyle(getTooltipPosition(container.getBoundingClientRect(), placement));\n }, [placement]);\n\n const showTooltip = () => {\n animationFrameRef.current = window.requestAnimationFrame(() => {\n animationFrameRef.current = window.requestAnimationFrame(() => {\n setIsVisible(true);\n });\n });\n };\n\n const openTooltip = () => {\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n\n updateTooltipPosition();\n setIsVisible(false);\n setIsOpen(true);\n showTooltip();\n };\n\n const closeTooltip = () => {\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n\n setIsVisible(false);\n closeTimerRef.current = window.setTimeout(() => {\n setIsOpen(false);\n }, TOOLTIP_ANIMATION_DURATION);\n };\n\n useEffect(() => {\n return () => {\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!isOpen) return;\n\n updateTooltipPosition();\n window.addEventListener('resize', updateTooltipPosition);\n window.addEventListener('scroll', updateTooltipPosition, true);\n\n return () => {\n window.removeEventListener('resize', updateTooltipPosition);\n window.removeEventListener('scroll', updateTooltipPosition, true);\n };\n }, [isOpen, updateTooltipPosition]);\n\n return (\n <div\n ref={containerRef}\n className={`relative inline-flex ${containerClassName}`}\n onBlur={closeTooltip}\n onFocus={openTooltip}\n onMouseEnter={openTooltip}\n onMouseLeave={closeTooltip}\n >\n {/* Main Content */}\n {children}\n {/* Tooltip */}\n {isOpen &&\n tooltipStyle &&\n createPortal(\n <div\n className={`border-silver-jet-2 bg-platinum-jet fixed z-9999 flex flex-col items-center justify-center rounded-lg border px-3 py-2 text-center whitespace-nowrap backdrop-blur-md transition-all duration-400 ease-in-out after:absolute after:border-8 after:border-solid after:border-transparent after:content-[''] ${isVisible ? 'visible opacity-100' : 'invisible opacity-0'} ${getTooltipArrowCss(placement)} ${className} `}\n style={{ ...tooltipStyle, transform: getTooltipTransform(placement, isVisible) }}\n >\n <div className=\"text-primary text-xs font-medium\">{title}</div>\n {description && (\n <div className=\"text-tertiary text-[10px] font-light\">{description}</div>\n )}\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nexport const Tooltip = ({ children, required = true, ...props }: ITooltip) => {\n return required ? <OriginalTooltip {...props}>{children}</OriginalTooltip> : children;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button.js';
2
+ export { Tooltip } from './Tooltip.js';
3
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Button } from './Button.js';
2
+ export { Tooltip } from './Tooltip.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,202 @@
1
+ import { Icon } from '@iconify/react';
2
+ import { useRef, useState, useCallback, useEffect, useLayoutEffect } from 'react';
3
+ import { jsxs, jsx } from 'react/jsx-runtime';
4
+ import { createPortal } from 'react-dom';
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+
9
+ // src/lib/button.ts
10
+ var getButtonCss = /* @__PURE__ */ __name((pattern) => {
11
+ switch (pattern) {
12
+ case "primary":
13
+ return "text-white bg-sky-blue-burst shadow-primary-btn hover:shadow-primary-btn-hover";
14
+ case "secondary":
15
+ return "text-secondary-invert bg-secondary shadow-secondary-btn hover:shadow-secondary-btn-hover";
16
+ case "tertiary":
17
+ return "text-tertiary-invert bg-tertiary shadow-tertiary-btn hover:shadow-tertiary-btn-hover";
18
+ case "outline":
19
+ return "text-primary border border-primary shadow-outline-btn hover:shadow-outline-btn-hover";
20
+ case "transparent":
21
+ default:
22
+ return "bg-transparent border border-primary/30 text-secondary";
23
+ }
24
+ }, "getButtonCss");
25
+ var Button = /* @__PURE__ */ __name(({
26
+ pattern,
27
+ content,
28
+ className = "",
29
+ leftIcon,
30
+ rightIcon,
31
+ buttonProps
32
+ }) => {
33
+ const btnCSS = getButtonCss(pattern);
34
+ const handleClick = /* @__PURE__ */ __name((e) => {
35
+ if (buttonProps?.disabled) return;
36
+ buttonProps?.onClick?.(e);
37
+ }, "handleClick");
38
+ return /* @__PURE__ */ jsxs(
39
+ "button",
40
+ {
41
+ ...buttonProps,
42
+ className: `group flex w-full cursor-pointer items-center justify-center gap-1 rounded-lg px-4 py-3 text-sm leading-4 transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-85 lg:px-5 lg:py-4 xl:text-base ${btnCSS} ${className} ${buttonProps?.className ?? ""}`,
43
+ type: buttonProps?.type ?? "button",
44
+ onClick: handleClick,
45
+ children: [
46
+ leftIcon && /* @__PURE__ */ jsx(Icon, { ...leftIcon }),
47
+ typeof content === "object" ? /* @__PURE__ */ jsx(Icon, { ...content }) : content,
48
+ rightIcon && /* @__PURE__ */ jsx(Icon, { ...rightIcon })
49
+ ]
50
+ }
51
+ );
52
+ }, "Button");
53
+
54
+ // src/lib/constants.ts
55
+ var TOOLTIP_GAP = 15;
56
+ var TOOLTIP_ANIMATION_DURATION = 400;
57
+ var TOAST_TYPES = [
58
+ "success",
59
+ "error",
60
+ "warning",
61
+ "progress",
62
+ "uploads",
63
+ "loading",
64
+ "default",
65
+ "custom"
66
+ ];
67
+ Object.fromEntries(TOAST_TYPES.map((type) => [type, type]));
68
+
69
+ // src/lib/tooltip.ts
70
+ var getTooltipPosition = /* @__PURE__ */ __name((rect, placement) => {
71
+ switch (placement) {
72
+ case "bottom":
73
+ return { top: rect.bottom, left: rect.left + rect.width / 2 };
74
+ case "right":
75
+ return { top: rect.top + rect.height / 2, left: rect.right };
76
+ case "left":
77
+ return { top: rect.top + rect.height / 2, left: rect.left };
78
+ case "top":
79
+ default:
80
+ return { top: rect.top, left: rect.left + rect.width / 2 };
81
+ }
82
+ }, "getTooltipPosition");
83
+ var getTooltipTransform = /* @__PURE__ */ __name((placement, isVisible) => {
84
+ const gap = String(isVisible ? TOOLTIP_GAP : 0);
85
+ switch (placement) {
86
+ case "bottom":
87
+ return `translate(-50%, ${gap}px)`;
88
+ case "right":
89
+ return `translate(${gap}px, -50%)`;
90
+ case "left":
91
+ return `translate(calc(-100% - ${gap}px), -50%)`;
92
+ case "top":
93
+ default:
94
+ return `translate(-50%, calc(-100% - ${gap}px))`;
95
+ }
96
+ }, "getTooltipTransform");
97
+ var getTooltipArrowCss = /* @__PURE__ */ __name((placement) => {
98
+ switch (placement) {
99
+ case "bottom":
100
+ return "after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-b-silver-jet-2";
101
+ case "right":
102
+ return "after:top-1/2 after:right-full after:-translate-y-1/2 after:border-r-silver-jet-2";
103
+ case "left":
104
+ return "after:top-1/2 after:left-full after:-translate-y-1/2 after:border-l-silver-jet-2";
105
+ case "top":
106
+ default:
107
+ return "after:top-full after:left-1/2 after:-translate-x-1/2 after:border-t-silver-jet-2";
108
+ }
109
+ }, "getTooltipArrowCss");
110
+ var OriginalTooltip = /* @__PURE__ */ __name(({
111
+ title,
112
+ description,
113
+ children,
114
+ className = "",
115
+ containerClassName = "",
116
+ placement = "top"
117
+ }) => {
118
+ const containerRef = useRef(null);
119
+ const [isOpen, setIsOpen] = useState(false);
120
+ const [isVisible, setIsVisible] = useState(false);
121
+ const [tooltipStyle, setTooltipStyle] = useState();
122
+ const closeTimerRef = useRef(void 0);
123
+ const animationFrameRef = useRef(void 0);
124
+ const updateTooltipPosition = useCallback(() => {
125
+ const container = containerRef.current;
126
+ if (!container) return;
127
+ setTooltipStyle(getTooltipPosition(container.getBoundingClientRect(), placement));
128
+ }, [placement]);
129
+ const showTooltip = /* @__PURE__ */ __name(() => {
130
+ animationFrameRef.current = window.requestAnimationFrame(() => {
131
+ animationFrameRef.current = window.requestAnimationFrame(() => {
132
+ setIsVisible(true);
133
+ });
134
+ });
135
+ }, "showTooltip");
136
+ const openTooltip = /* @__PURE__ */ __name(() => {
137
+ if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);
138
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
139
+ updateTooltipPosition();
140
+ setIsVisible(false);
141
+ setIsOpen(true);
142
+ showTooltip();
143
+ }, "openTooltip");
144
+ const closeTooltip = /* @__PURE__ */ __name(() => {
145
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
146
+ setIsVisible(false);
147
+ closeTimerRef.current = window.setTimeout(() => {
148
+ setIsOpen(false);
149
+ }, TOOLTIP_ANIMATION_DURATION);
150
+ }, "closeTooltip");
151
+ useEffect(() => {
152
+ return () => {
153
+ if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);
154
+ if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);
155
+ };
156
+ }, []);
157
+ useLayoutEffect(() => {
158
+ if (!isOpen) return;
159
+ updateTooltipPosition();
160
+ window.addEventListener("resize", updateTooltipPosition);
161
+ window.addEventListener("scroll", updateTooltipPosition, true);
162
+ return () => {
163
+ window.removeEventListener("resize", updateTooltipPosition);
164
+ window.removeEventListener("scroll", updateTooltipPosition, true);
165
+ };
166
+ }, [isOpen, updateTooltipPosition]);
167
+ return /* @__PURE__ */ jsxs(
168
+ "div",
169
+ {
170
+ ref: containerRef,
171
+ className: `relative inline-flex ${containerClassName}`,
172
+ onBlur: closeTooltip,
173
+ onFocus: openTooltip,
174
+ onMouseEnter: openTooltip,
175
+ onMouseLeave: closeTooltip,
176
+ children: [
177
+ children,
178
+ isOpen && tooltipStyle && createPortal(
179
+ /* @__PURE__ */ jsxs(
180
+ "div",
181
+ {
182
+ className: `border-silver-jet-2 bg-platinum-jet fixed z-9999 flex flex-col items-center justify-center rounded-lg border px-3 py-2 text-center whitespace-nowrap backdrop-blur-md transition-all duration-400 ease-in-out after:absolute after:border-8 after:border-solid after:border-transparent after:content-[''] ${isVisible ? "visible opacity-100" : "invisible opacity-0"} ${getTooltipArrowCss(placement)} ${className} `,
183
+ style: { ...tooltipStyle, transform: getTooltipTransform(placement, isVisible) },
184
+ children: [
185
+ /* @__PURE__ */ jsx("div", { className: "text-primary text-xs font-medium", children: title }),
186
+ description && /* @__PURE__ */ jsx("div", { className: "text-tertiary text-[10px] font-light", children: description })
187
+ ]
188
+ }
189
+ ),
190
+ document.body
191
+ )
192
+ ]
193
+ }
194
+ );
195
+ }, "OriginalTooltip");
196
+ var Tooltip = /* @__PURE__ */ __name(({ children, required = true, ...props }) => {
197
+ return required ? /* @__PURE__ */ jsx(OriginalTooltip, { ...props, children }) : children;
198
+ }, "Tooltip");
199
+
200
+ export { Button, Tooltip };
201
+ //# sourceMappingURL=index.js.map
202
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/lib/button.ts","../../src/ui/Button.tsx","../../src/lib/constants.ts","../../src/lib/tooltip.ts","../../src/ui/Tooltip.tsx"],"names":["jsxs","jsx"],"mappings":";;;;;;;;;AAEO,IAAM,YAA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AAAA,YAAC,KAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,CAAA,2SAAA,EAA8S,SAAA,GAAY,qBAAA,GAAwB,qBAAqB,IAAI,kBAAA,CAAmB,SAAS,CAAC,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,CAAA;AAAA,cACha,KAAA,EAAO,EAAE,GAAG,YAAA,EAAc,WAAW,mBAAA,CAAoB,SAAA,EAAW,SAAS,CAAA,EAAE;AAAA,cAE/E,QAAA,EAAA;AAAA,gCAAAC,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,kCAAA,EAAoC,QAAA,EAAA,KAAA,EAAM,CAAA;AAAA,gBACxD,+BACCA,GAAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,wCAAwC,QAAA,EAAA,WAAA,EAAY;AAAA;AAAA;AAAA,WAEvE;AAAA,UACA,QAAA,CAAS;AAAA;AACX;AAAA;AAAA,GACJ;AAEJ,CAAA,EAjGwB,iBAAA,CAAA;AAmGjB,IAAM,OAAA,2BAAW,EAAE,QAAA,EAAU,WAAW,IAAA,EAAM,GAAG,OAAM,KAAgB;AAC5E,EAAA,OAAO,2BAAWA,GAAAA,CAAC,mBAAiB,GAAG,KAAA,EAAQ,UAAS,CAAA,GAAqB,QAAA;AAC/E,CAAA,EAFuB,SAAA","file":"index.js","sourcesContent":["import type { IButton } from '../types/component.js';\n\nexport const getButtonCss = (pattern: IButton['pattern']) => {\n switch (pattern) {\n case 'primary':\n return 'text-white bg-sky-blue-burst shadow-primary-btn hover:shadow-primary-btn-hover';\n case 'secondary':\n return 'text-secondary-invert bg-secondary shadow-secondary-btn hover:shadow-secondary-btn-hover';\n case 'tertiary':\n return 'text-tertiary-invert bg-tertiary shadow-tertiary-btn hover:shadow-tertiary-btn-hover';\n case 'outline':\n return 'text-primary border border-primary shadow-outline-btn hover:shadow-outline-btn-hover';\n case 'transparent':\n default:\n return 'bg-transparent border border-primary/30 text-secondary';\n }\n};\n","import { Icon } from '@iconify/react';\nimport { type MouseEvent } from 'react';\n\nimport { getButtonCss } from '../lib/button.js';\nimport type { IButton } from '../types/component.js';\n\nexport const Button = ({\n pattern,\n content,\n className = '',\n leftIcon,\n rightIcon,\n buttonProps,\n}: IButton) => {\n const btnCSS = getButtonCss(pattern);\n\n const handleClick = (e: MouseEvent<HTMLButtonElement>) => {\n if (buttonProps?.disabled) return;\n buttonProps?.onClick?.(e);\n };\n\n return (\n <button\n {...buttonProps}\n className={`group flex w-full cursor-pointer items-center justify-center gap-1 rounded-lg px-4 py-3 text-sm leading-4 transition-all duration-300 disabled:cursor-not-allowed disabled:opacity-85 lg:px-5 lg:py-4 xl:text-base ${btnCSS} ${className} ${\n buttonProps?.className ?? ''\n }`}\n type={buttonProps?.type ?? 'button'}\n onClick={handleClick}\n >\n {leftIcon && <Icon {...leftIcon} />}\n {typeof content === 'object' ? <Icon {...content} /> : content}\n {rightIcon && <Icon {...rightIcon} />}\n </button>\n );\n};\n","export const TOOLTIP_GAP = 15 as const;\nexport const TOOLTIP_ANIMATION_DURATION = 400 as const;\n\nexport const TOAST_TYPES = [\n 'success',\n 'error',\n 'warning',\n 'progress',\n 'uploads',\n 'loading',\n 'default',\n 'custom',\n] as const;\n\nexport const TOAST_TYPE = Object.fromEntries(TOAST_TYPES.map((type) => [type, type])) as {\n [K in (typeof TOAST_TYPES)[number]]: K;\n};\n","import type { CSSProperties } from 'react';\n\nimport type { ITooltip } from '../types/component.js';\nimport { TOOLTIP_GAP } from './constants.js';\n\nexport const getTooltipPosition = (\n rect: DOMRect,\n placement: NonNullable<ITooltip['placement']>,\n): CSSProperties => {\n switch (placement) {\n case 'bottom':\n return { top: rect.bottom, left: rect.left + rect.width / 2 };\n case 'right':\n return { top: rect.top + rect.height / 2, left: rect.right };\n case 'left':\n return { top: rect.top + rect.height / 2, left: rect.left };\n case 'top':\n default:\n return { top: rect.top, left: rect.left + rect.width / 2 };\n }\n};\n\nexport const getTooltipTransform = (\n placement: NonNullable<ITooltip['placement']>,\n isVisible: boolean,\n) => {\n const gap = String(isVisible ? TOOLTIP_GAP : 0);\n\n switch (placement) {\n case 'bottom':\n return `translate(-50%, ${gap}px)`;\n case 'right':\n return `translate(${gap}px, -50%)`;\n case 'left':\n return `translate(calc(-100% - ${gap}px), -50%)`;\n case 'top':\n default:\n return `translate(-50%, calc(-100% - ${gap}px))`;\n }\n};\n\nexport const getTooltipArrowCss = (placement: NonNullable<ITooltip['placement']>) => {\n switch (placement) {\n case 'bottom':\n return 'after:bottom-full after:left-1/2 after:-translate-x-1/2 after:border-b-silver-jet-2';\n case 'right':\n return 'after:top-1/2 after:right-full after:-translate-y-1/2 after:border-r-silver-jet-2';\n case 'left':\n return 'after:top-1/2 after:left-full after:-translate-y-1/2 after:border-l-silver-jet-2';\n case 'top':\n default:\n return 'after:top-full after:left-1/2 after:-translate-x-1/2 after:border-t-silver-jet-2';\n }\n};\n","import {\n type CSSProperties,\n useCallback,\n useEffect,\n useLayoutEffect,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { TOOLTIP_ANIMATION_DURATION } from '../lib/constants.js';\nimport { getTooltipArrowCss, getTooltipPosition, getTooltipTransform } from '../lib/tooltip.js';\nimport type { ITooltip } from '../types/component.js';\n\nconst OriginalTooltip = ({\n title,\n description,\n children,\n className = '',\n containerClassName = '',\n placement = 'top',\n}: Omit<ITooltip, 'required'>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const [isOpen, setIsOpen] = useState(false);\n const [isVisible, setIsVisible] = useState(false);\n const [tooltipStyle, setTooltipStyle] = useState<CSSProperties>();\n const closeTimerRef = useRef<number | undefined>(undefined);\n const animationFrameRef = useRef<number | undefined>(undefined);\n\n const updateTooltipPosition = useCallback(() => {\n const container = containerRef.current;\n if (!container) return;\n\n setTooltipStyle(getTooltipPosition(container.getBoundingClientRect(), placement));\n }, [placement]);\n\n const showTooltip = () => {\n animationFrameRef.current = window.requestAnimationFrame(() => {\n animationFrameRef.current = window.requestAnimationFrame(() => {\n setIsVisible(true);\n });\n });\n };\n\n const openTooltip = () => {\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n\n updateTooltipPosition();\n setIsVisible(false);\n setIsOpen(true);\n showTooltip();\n };\n\n const closeTooltip = () => {\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n\n setIsVisible(false);\n closeTimerRef.current = window.setTimeout(() => {\n setIsOpen(false);\n }, TOOLTIP_ANIMATION_DURATION);\n };\n\n useEffect(() => {\n return () => {\n if (closeTimerRef.current) window.clearTimeout(closeTimerRef.current);\n if (animationFrameRef.current) window.cancelAnimationFrame(animationFrameRef.current);\n };\n }, []);\n\n useLayoutEffect(() => {\n if (!isOpen) return;\n\n updateTooltipPosition();\n window.addEventListener('resize', updateTooltipPosition);\n window.addEventListener('scroll', updateTooltipPosition, true);\n\n return () => {\n window.removeEventListener('resize', updateTooltipPosition);\n window.removeEventListener('scroll', updateTooltipPosition, true);\n };\n }, [isOpen, updateTooltipPosition]);\n\n return (\n <div\n ref={containerRef}\n className={`relative inline-flex ${containerClassName}`}\n onBlur={closeTooltip}\n onFocus={openTooltip}\n onMouseEnter={openTooltip}\n onMouseLeave={closeTooltip}\n >\n {/* Main Content */}\n {children}\n {/* Tooltip */}\n {isOpen &&\n tooltipStyle &&\n createPortal(\n <div\n className={`border-silver-jet-2 bg-platinum-jet fixed z-9999 flex flex-col items-center justify-center rounded-lg border px-3 py-2 text-center whitespace-nowrap backdrop-blur-md transition-all duration-400 ease-in-out after:absolute after:border-8 after:border-solid after:border-transparent after:content-[''] ${isVisible ? 'visible opacity-100' : 'invisible opacity-0'} ${getTooltipArrowCss(placement)} ${className} `}\n style={{ ...tooltipStyle, transform: getTooltipTransform(placement, isVisible) }}\n >\n <div className=\"text-primary text-xs font-medium\">{title}</div>\n {description && (\n <div className=\"text-tertiary text-[10px] font-light\">{description}</div>\n )}\n </div>,\n document.body,\n )}\n </div>\n );\n};\n\nexport const Tooltip = ({ children, required = true, ...props }: ITooltip) => {\n return required ? <OriginalTooltip {...props}>{children}</OriginalTooltip> : children;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,102 @@
1
1
  {
2
2
  "name": "@beautinique/frontend-components",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Shared React UI components for the Beautinique frontends.",
5
+ "keywords": [
6
+ "frontend",
7
+ "react",
8
+ "components",
9
+ "ui",
10
+ "tailwind",
11
+ "beautinique"
12
+ ],
13
+ "author": "Nageshwar Pawar",
14
+ "license": "MIT",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Nageshwar1997/BQ-Packages.git",
18
+ "directory": "packages/frontend/components"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/Nageshwar1997/BQ-Packages/issues"
22
+ },
23
+ "homepage": "https://github.com/Nageshwar1997/BQ-Packages/tree/main/packages/frontend/components#readme",
24
+ "type": "module",
25
+ "main": "./dist/index.cjs",
26
+ "module": "./dist/index.js",
27
+ "types": "./dist/index.d.ts",
28
+ "files": [
29
+ "dist",
30
+ "source.css"
31
+ ],
32
+ "sideEffects": [
33
+ "**/*.css",
34
+ "./dist/toast/*"
35
+ ],
36
+ "exports": {
37
+ ".": {
38
+ "types": "./dist/index.d.ts",
39
+ "import": "./dist/index.js",
40
+ "require": "./dist/index.cjs",
41
+ "default": "./dist/index.js"
42
+ },
43
+ "./ui": {
44
+ "types": "./dist/ui/index.d.ts",
45
+ "import": "./dist/ui/index.js",
46
+ "require": "./dist/ui/index.cjs",
47
+ "default": "./dist/ui/index.js"
48
+ },
49
+ "./toast": {
50
+ "types": "./dist/toast/index.d.ts",
51
+ "import": "./dist/toast/index.js",
52
+ "require": "./dist/toast/index.cjs",
53
+ "default": "./dist/toast/index.js"
54
+ },
55
+ "./source.css": "./source.css",
56
+ "./package.json": "./package.json"
57
+ },
58
+ "scripts": {
59
+ "build": "tsup",
60
+ "postbuild": "node ../../../scripts/build-types/index.mjs",
61
+ "dev": "tsup --watch",
62
+ "playground": "vite --config playground/vite.config.ts",
63
+ "lint": "eslint .",
64
+ "test": "vitest run --environment jsdom",
65
+ "test:watch": "vitest --environment jsdom",
66
+ "typecheck": "tsc --noEmit"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "engines": {
72
+ "node": ">=24"
73
+ },
74
+ "peerDependencies": {
75
+ "@beautinique/frontend-styles": "^1.1.0",
76
+ "@iconify/react": "^6.0.2",
77
+ "react": "^19.0.0",
78
+ "react-dom": "^19.0.0"
79
+ },
80
+ "dependencies": {
81
+ "nanoid": "^6.0.1",
82
+ "zustand": "^5.0.15"
83
+ },
84
+ "devDependencies": {
85
+ "@beautinique/frontend-styles": "^1.1.0",
86
+ "@iconify/react": "^6.0.2",
87
+ "@tailwindcss/typography": "^0.5.20",
88
+ "@tailwindcss/vite": "^4.3.3",
89
+ "@testing-library/dom": "^10.4.2",
90
+ "@testing-library/react": "^16.3.3",
91
+ "@types/react": "^19.3.0",
92
+ "@types/react-dom": "^19.3.0",
93
+ "@vitejs/plugin-react": "^6.1.2",
94
+ "eslint-plugin-react-hooks": "^7.1.1",
95
+ "jsdom": "^30.1.2",
96
+ "react": "^19.3.0",
97
+ "react-dom": "^19.3.0",
98
+ "tailwindcss": "^4.3.3",
99
+ "vite": "^8.3.2",
100
+ "vitest": "^5.0.3"
101
+ }
102
+ }
package/source.css ADDED
@@ -0,0 +1,11 @@
1
+ /* @beautinique/frontend-components - tells Tailwind where the components' class names are.
2
+ *
3
+ * Tailwind v4 does not look inside node_modules for class names, so without this the classes the
4
+ * components use (e.g. `rounded-lg`, `shadow-primary-btn`) would not be generated and the
5
+ * components would look unstyled. Import it in the app's own css, after the styles package:
6
+ *
7
+ * @import '@beautinique/frontend-styles';
8
+ * @import '@beautinique/frontend-components/source.css';
9
+ * @import './app.css';
10
+ */
11
+ @source './dist';