@pelatform/ui 1.6.0 → 2.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 (104) hide show
  1. package/css/source.css +20 -0
  2. package/css/theme.css +1 -2
  3. package/dist/animation.d.ts +4 -379
  4. package/dist/animation.js +2 -1752
  5. package/dist/aria.d.ts +1 -31
  6. package/dist/aria.js +2 -139
  7. package/dist/base.d.ts +1 -651
  8. package/dist/base.js +2 -5556
  9. package/dist/chunk-UEVIEY7W.js +51 -0
  10. package/dist/{components.cjs → chunk-VZEE3GOC.js} +81 -2344
  11. package/dist/components.d.ts +224 -181
  12. package/dist/components.js +364 -765
  13. package/dist/default.d.ts +1 -1322
  14. package/dist/default.js +2 -8931
  15. package/dist/hooks.d.ts +4 -1083
  16. package/dist/hooks.js +5 -662
  17. package/dist/index.d.ts +58 -308
  18. package/dist/index.js +5 -226
  19. package/package.json +25 -105
  20. package/dist/animation.cjs +0 -1752
  21. package/dist/animation.d.cts +0 -379
  22. package/dist/aria.cjs +0 -139
  23. package/dist/aria.d.cts +0 -31
  24. package/dist/badge-BtI4BMea.d.cts +0 -33
  25. package/dist/badge-BtI4BMea.d.ts +0 -33
  26. package/dist/base.cjs +0 -5556
  27. package/dist/base.d.cts +0 -651
  28. package/dist/chunk-3N75YA6Q.cjs +0 -60
  29. package/dist/chunk-7472NIIL.cjs +0 -40
  30. package/dist/chunk-BXUKTDPN.cjs +0 -576
  31. package/dist/chunk-CD2BCCQU.js +0 -180
  32. package/dist/chunk-CJXIPSTG.cjs +0 -10
  33. package/dist/chunk-CTHRAJQZ.js +0 -1522
  34. package/dist/chunk-D373YKDA.js +0 -196
  35. package/dist/chunk-EZW5GNS4.js +0 -6
  36. package/dist/chunk-HILACSFA.cjs +0 -1522
  37. package/dist/chunk-HR3R6KKM.js +0 -40
  38. package/dist/chunk-HW52LCWN.js +0 -22
  39. package/dist/chunk-I46SELBA.cjs +0 -22
  40. package/dist/chunk-J4JGE3U5.cjs +0 -180
  41. package/dist/chunk-RQHJBTEU.js +0 -10
  42. package/dist/chunk-SK6SSJHC.js +0 -9
  43. package/dist/chunk-T74DBLYY.js +0 -60
  44. package/dist/chunk-TB6DU23O.js +0 -576
  45. package/dist/chunk-UP53DCYH.cjs +0 -6
  46. package/dist/chunk-ZBO5IAMA.cjs +0 -196
  47. package/dist/chunk-ZDR3OZ7Z.cjs +0 -9
  48. package/dist/colors-CUDWvz1g.d.cts +0 -42
  49. package/dist/colors-CUDWvz1g.d.ts +0 -42
  50. package/dist/components-CidsRcc3.d.cts +0 -46
  51. package/dist/components-CidsRcc3.d.ts +0 -46
  52. package/dist/components.d.cts +0 -2944
  53. package/dist/default.cjs +0 -8931
  54. package/dist/default.d.cts +0 -1322
  55. package/dist/hooks.cjs +0 -666
  56. package/dist/hooks.d.cts +0 -1172
  57. package/dist/index.cjs +0 -230
  58. package/dist/index.d.cts +0 -318
  59. package/dist/input-AwYIskrX.d.cts +0 -22
  60. package/dist/input-AwYIskrX.d.ts +0 -22
  61. package/dist/menu-GmSRfRGB.d.cts +0 -43
  62. package/dist/menu-GmSRfRGB.d.ts +0 -43
  63. package/dist/metafile-cjs.json +0 -1
  64. package/dist/metafile-esm.json +0 -1
  65. package/dist/re-export/cva.cjs +0 -6
  66. package/dist/re-export/cva.d.cts +0 -10
  67. package/dist/re-export/cva.d.ts +0 -10
  68. package/dist/re-export/cva.js +0 -6
  69. package/dist/re-export/motion.cjs +0 -2
  70. package/dist/re-export/motion.d.cts +0 -1
  71. package/dist/re-export/motion.d.ts +0 -1
  72. package/dist/re-export/motion.js +0 -2
  73. package/dist/re-export/next-themes.cjs +0 -2
  74. package/dist/re-export/next-themes.d.cts +0 -1
  75. package/dist/re-export/next-themes.d.ts +0 -1
  76. package/dist/re-export/next-themes.js +0 -2
  77. package/dist/re-export/react-day-picker.cjs +0 -2
  78. package/dist/re-export/react-day-picker.d.cts +0 -1
  79. package/dist/re-export/react-day-picker.d.ts +0 -1
  80. package/dist/re-export/react-day-picker.js +0 -2
  81. package/dist/re-export/react-hook-form.cjs +0 -2
  82. package/dist/re-export/react-hook-form.d.cts +0 -1
  83. package/dist/re-export/react-hook-form.d.ts +0 -1
  84. package/dist/re-export/react-hook-form.js +0 -2
  85. package/dist/re-export/resolver.cjs +0 -2
  86. package/dist/re-export/resolver.d.cts +0 -1
  87. package/dist/re-export/resolver.d.ts +0 -1
  88. package/dist/re-export/resolver.js +0 -2
  89. package/dist/re-export/sonner.cjs +0 -2
  90. package/dist/re-export/sonner.d.cts +0 -1
  91. package/dist/re-export/sonner.d.ts +0 -1
  92. package/dist/re-export/sonner.js +0 -2
  93. package/dist/re-export/tanstack-query.cjs +0 -2
  94. package/dist/re-export/tanstack-query.d.cts +0 -1
  95. package/dist/re-export/tanstack-query.d.ts +0 -1
  96. package/dist/re-export/tanstack-query.js +0 -2
  97. package/dist/re-export/tanstack-table.cjs +0 -2
  98. package/dist/re-export/tanstack-table.d.cts +0 -1
  99. package/dist/re-export/tanstack-table.d.ts +0 -1
  100. package/dist/re-export/tanstack-table.js +0 -2
  101. package/dist/re-export/zod.cjs +0 -2
  102. package/dist/re-export/zod.d.cts +0 -1
  103. package/dist/re-export/zod.d.ts +0 -1
  104. package/dist/re-export/zod.js +0 -2
@@ -1,40 +0,0 @@
1
- // src/utils/assets-url.ts
2
- function getAssetsUrl(path) {
3
- const baseUrl = "https://assets.pelatform.com";
4
- return `${baseUrl}/${path}`;
5
- }
6
- function getFlagUrl(flag) {
7
- const flagCode = flag.toLowerCase();
8
- return `${getAssetsUrl("media/flags")}/${flagCode}.svg`;
9
- }
10
-
11
- // src/lib/analytics.ts
12
- var googleTrackEvent = ({ name, properties }) => {
13
- if (!name || typeof name !== "string" || name.trim().length === 0) {
14
- console.warn("Analytics: Event name is required and must be a non-empty string");
15
- return;
16
- }
17
- if (properties && typeof properties !== "object") {
18
- console.warn("Analytics: Properties must be an object");
19
- return;
20
- }
21
- try {
22
- if (typeof window !== "undefined" && window.gtag) {
23
- window.gtag("event", name.trim(), {
24
- ...properties,
25
- // GA4 recommended parameters
26
- event_category: properties?.category || "engagement",
27
- event_label: properties?.label,
28
- value: properties?.value
29
- });
30
- }
31
- } catch (error) {
32
- console.error("Analytics: Failed to track event", { name, error });
33
- }
34
- };
35
-
36
- export {
37
- getAssetsUrl,
38
- getFlagUrl,
39
- googleTrackEvent
40
- };
@@ -1,22 +0,0 @@
1
- // src/lib/colors.ts
2
- var THEME_MODES = {
3
- LIGHT: "light",
4
- DARK: "dark",
5
- SYSTEM: "system"
6
- };
7
- var META_THEME_COLORS = {
8
- /** Light theme color - Pure white for clean, bright appearance */
9
- [THEME_MODES.LIGHT]: "#ffffff",
10
- /** Dark theme color - Near black with slight warmth to reduce eye strain */
11
- [THEME_MODES.DARK]: "#09090b",
12
- /** System theme - Will be determined by user's OS preference */
13
- [THEME_MODES.SYSTEM]: "auto"
14
- // Special value indicating system preference
15
- };
16
- var DEFAULT_THEME_MODE = THEME_MODES.SYSTEM;
17
-
18
- export {
19
- THEME_MODES,
20
- META_THEME_COLORS,
21
- DEFAULT_THEME_MODE
22
- };
@@ -1,22 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/lib/colors.ts
2
- var THEME_MODES = {
3
- LIGHT: "light",
4
- DARK: "dark",
5
- SYSTEM: "system"
6
- };
7
- var META_THEME_COLORS = {
8
- /** Light theme color - Pure white for clean, bright appearance */
9
- [THEME_MODES.LIGHT]: "#ffffff",
10
- /** Dark theme color - Near black with slight warmth to reduce eye strain */
11
- [THEME_MODES.DARK]: "#09090b",
12
- /** System theme - Will be determined by user's OS preference */
13
- [THEME_MODES.SYSTEM]: "auto"
14
- // Special value indicating system preference
15
- };
16
- var DEFAULT_THEME_MODE = THEME_MODES.SYSTEM;
17
-
18
-
19
-
20
-
21
-
22
- exports.THEME_MODES = THEME_MODES; exports.META_THEME_COLORS = META_THEME_COLORS; exports.DEFAULT_THEME_MODE = DEFAULT_THEME_MODE;
@@ -1,180 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
-
4
- var _chunkI46SELBAcjs = require('./chunk-I46SELBA.cjs');
5
-
6
- // src/hooks/use-meta-color.ts
7
- var _react = require('react'); var React = _interopRequireWildcard(_react);
8
- var _nextthemes = require('next-themes');
9
- function useMetaColor(defaultColors) {
10
- const { resolvedTheme } = _nextthemes.useTheme.call(void 0, );
11
- const isSystemDarkMode = React.useCallback(() => {
12
- if (typeof window === "undefined") return false;
13
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
14
- }, []);
15
- const getEffectiveTheme = React.useCallback(
16
- (theme) => {
17
- if (theme === _chunkI46SELBAcjs.THEME_MODES.SYSTEM) {
18
- return isSystemDarkMode() ? _chunkI46SELBAcjs.THEME_MODES.DARK : _chunkI46SELBAcjs.THEME_MODES.LIGHT;
19
- }
20
- return theme;
21
- },
22
- [isSystemDarkMode]
23
- );
24
- const metaColor = React.useMemo(() => {
25
- const colorsToUse = _nullishCoalesce(defaultColors, () => ( _chunkI46SELBAcjs.META_THEME_COLORS));
26
- const effectiveTheme = getEffectiveTheme(resolvedTheme);
27
- if (effectiveTheme === _chunkI46SELBAcjs.THEME_MODES.DARK) {
28
- return colorsToUse[_chunkI46SELBAcjs.THEME_MODES.DARK];
29
- } else if (effectiveTheme === _chunkI46SELBAcjs.THEME_MODES.LIGHT) {
30
- return colorsToUse[_chunkI46SELBAcjs.THEME_MODES.LIGHT];
31
- }
32
- return colorsToUse[_chunkI46SELBAcjs.THEME_MODES.LIGHT];
33
- }, [resolvedTheme, defaultColors, getEffectiveTheme]);
34
- const setMetaColor = React.useCallback((color) => {
35
- const metaTag = document.querySelector('meta[name="theme-color"]');
36
- if (metaTag) {
37
- metaTag.setAttribute("content", color);
38
- } else {
39
- const newMetaTag = document.createElement("meta");
40
- newMetaTag.name = "theme-color";
41
- newMetaTag.content = color;
42
- document.head.appendChild(newMetaTag);
43
- }
44
- }, []);
45
- return {
46
- /** Current meta theme color based on resolved theme */
47
- metaColor,
48
- /** Function to manually set meta theme color */
49
- setMetaColor
50
- };
51
- }
52
-
53
- // src/hooks/use-recaptcha-v2.ts
54
-
55
- var RECAPTCHA_SCRIPT_ID = "recaptcha-v2-script";
56
- var scriptLoadPromise = null;
57
- function loadRecaptchaScript() {
58
- if (scriptLoadPromise) return scriptLoadPromise;
59
- scriptLoadPromise = new Promise((resolve) => {
60
- if (document.getElementById(RECAPTCHA_SCRIPT_ID) && window.grecaptcha) {
61
- resolve();
62
- return;
63
- }
64
- window.onRecaptchaLoaded = () => {
65
- resolve();
66
- };
67
- const script = document.createElement("script");
68
- script.id = RECAPTCHA_SCRIPT_ID;
69
- script.src = `https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoaded&render=explicit`;
70
- script.async = true;
71
- script.defer = true;
72
- script.onerror = () => {
73
- console.error("Failed to load reCAPTCHA script");
74
- scriptLoadPromise = null;
75
- };
76
- document.head.appendChild(script);
77
- });
78
- return scriptLoadPromise;
79
- }
80
- function useRecaptchaV2(siteKey) {
81
- const widgetId = _react.useRef.call(void 0, null);
82
- const containerRef = _react.useRef.call(void 0, null);
83
- const isRendered = _react.useRef.call(void 0, false);
84
- const isInitializing = _react.useRef.call(void 0, false);
85
- const initializeRecaptcha = _react.useCallback.call(void 0, async () => {
86
- if (isInitializing.current) return;
87
- if (!containerRef.current || !siteKey) return;
88
- isInitializing.current = true;
89
- try {
90
- if (widgetId.current !== null) {
91
- const grecaptcha2 = window.grecaptcha;
92
- if (grecaptcha2) {
93
- try {
94
- grecaptcha2.reset(widgetId.current);
95
- } catch (error) {
96
- console.error("Error resetting reCAPTCHA:", error);
97
- }
98
- }
99
- widgetId.current = null;
100
- isRendered.current = false;
101
- }
102
- await loadRecaptchaScript();
103
- const grecaptcha = window.grecaptcha;
104
- if (!grecaptcha) {
105
- throw new Error("reCAPTCHA failed to load");
106
- }
107
- await new Promise((resolve) => {
108
- grecaptcha.ready(() => resolve());
109
- });
110
- if (containerRef.current && !isRendered.current) {
111
- widgetId.current = grecaptcha.render(containerRef.current, {
112
- sitekey: siteKey,
113
- size: "normal",
114
- // Can be 'normal', 'compact', or 'invisible'
115
- theme: "light"
116
- // Can be 'light' or 'dark'
117
- });
118
- isRendered.current = true;
119
- }
120
- } catch (error) {
121
- console.error("Error initializing reCAPTCHA:", error);
122
- } finally {
123
- isInitializing.current = false;
124
- }
125
- }, [siteKey]);
126
- _react.useEffect.call(void 0, () => {
127
- if (containerRef.current) {
128
- initializeRecaptcha();
129
- }
130
- return () => {
131
- if (widgetId.current !== null) {
132
- const grecaptcha = window.grecaptcha;
133
- if (grecaptcha) {
134
- try {
135
- grecaptcha.reset(widgetId.current);
136
- } catch (error) {
137
- console.error("Error resetting reCAPTCHA on cleanup:", error);
138
- }
139
- }
140
- widgetId.current = null;
141
- isRendered.current = false;
142
- }
143
- };
144
- }, [initializeRecaptcha]);
145
- const getToken = () => {
146
- const grecaptcha = window.grecaptcha;
147
- if (!grecaptcha || widgetId.current === null) {
148
- throw new Error("reCAPTCHA not initialized");
149
- }
150
- const token = grecaptcha.getResponse(widgetId.current);
151
- if (!token) {
152
- throw new Error("reCAPTCHA not completed");
153
- }
154
- return token;
155
- };
156
- const resetCaptcha = () => {
157
- const grecaptcha = window.grecaptcha;
158
- if (!grecaptcha || widgetId.current === null) return;
159
- try {
160
- grecaptcha.reset(widgetId.current);
161
- } catch (error) {
162
- console.error("Error resetting reCAPTCHA:", error);
163
- }
164
- };
165
- return {
166
- /** Ref to attach to the container div where reCAPTCHA will be rendered */
167
- containerRef,
168
- /** Function to get the reCAPTCHA response token */
169
- getToken,
170
- /** Function to reset the reCAPTCHA widget */
171
- resetCaptcha,
172
- /** Function to manually initialize reCAPTCHA (usually not needed) */
173
- initializeRecaptcha
174
- };
175
- }
176
-
177
-
178
-
179
-
180
- exports.useMetaColor = useMetaColor; exports.useRecaptchaV2 = useRecaptchaV2;
@@ -1,10 +0,0 @@
1
- // src/lib/utils.ts
2
- import { clsx } from "clsx";
3
- import { twMerge } from "tailwind-merge";
4
- function cn(...inputs) {
5
- return twMerge(clsx(inputs));
6
- }
7
-
8
- export {
9
- cn
10
- };
@@ -1,9 +0,0 @@
1
- // src/hooks/use-toast.ts
2
- import { Toast } from "@base-ui-components/react/toast";
3
- var toastManager = Toast.createToastManager();
4
- var useToast = Toast.useToastManager;
5
-
6
- export {
7
- toastManager,
8
- useToast
9
- };
@@ -1,60 +0,0 @@
1
- // src/hooks/use-copy-to-clipboard.ts
2
- import * as React from "react";
3
- function useCopyToClipboard({ timeout = 2e3, onCopy } = {}) {
4
- const [copied, setCopied] = React.useState(false);
5
- const copy = React.useCallback(
6
- (value) => {
7
- if (typeof window === "undefined" || !navigator.clipboard?.writeText) {
8
- console.warn("Clipboard API not supported in this environment");
9
- return;
10
- }
11
- if (!value) {
12
- console.warn("Cannot copy empty value to clipboard");
13
- return;
14
- }
15
- navigator.clipboard.writeText(value).then(
16
- () => {
17
- setCopied(true);
18
- if (onCopy) {
19
- onCopy();
20
- }
21
- setTimeout(() => {
22
- setCopied(false);
23
- }, timeout);
24
- },
25
- (error) => {
26
- console.error("Failed to copy text to clipboard:", error);
27
- }
28
- );
29
- },
30
- [timeout, onCopy]
31
- );
32
- return {
33
- /** Whether text was recently copied (true for timeout duration) */
34
- copied,
35
- /** Function to copy text to clipboard */
36
- copy
37
- };
38
- }
39
-
40
- // src/hooks/use-mobile.ts
41
- import * as React2 from "react";
42
- var DEFAULT_MOBILE_BREAKPOINT = 1024;
43
- function useIsMobile(breakpoint = DEFAULT_MOBILE_BREAKPOINT) {
44
- const [isMobile, setIsMobile] = React2.useState(void 0);
45
- React2.useEffect(() => {
46
- const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
47
- const onChange = () => {
48
- setIsMobile(window.innerWidth < breakpoint);
49
- };
50
- mql.addEventListener("change", onChange);
51
- setIsMobile(window.innerWidth < breakpoint);
52
- return () => mql.removeEventListener("change", onChange);
53
- }, [breakpoint]);
54
- return !!isMobile;
55
- }
56
-
57
- export {
58
- useCopyToClipboard,
59
- useIsMobile
60
- };