@pelatform/ui 1.5.9 → 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 -5559
  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 -1087
  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 +29 -109
  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 -5559
  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 -1176
  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,180 +0,0 @@
1
- import {
2
- META_THEME_COLORS,
3
- THEME_MODES
4
- } from "./chunk-HW52LCWN.js";
5
-
6
- // src/hooks/use-meta-color.ts
7
- import * as React from "react";
8
- import { useTheme } from "next-themes";
9
- function useMetaColor(defaultColors) {
10
- const { resolvedTheme } = useTheme();
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 === THEME_MODES.SYSTEM) {
18
- return isSystemDarkMode() ? THEME_MODES.DARK : THEME_MODES.LIGHT;
19
- }
20
- return theme;
21
- },
22
- [isSystemDarkMode]
23
- );
24
- const metaColor = React.useMemo(() => {
25
- const colorsToUse = defaultColors ?? META_THEME_COLORS;
26
- const effectiveTheme = getEffectiveTheme(resolvedTheme);
27
- if (effectiveTheme === THEME_MODES.DARK) {
28
- return colorsToUse[THEME_MODES.DARK];
29
- } else if (effectiveTheme === THEME_MODES.LIGHT) {
30
- return colorsToUse[THEME_MODES.LIGHT];
31
- }
32
- return colorsToUse[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
- import { useCallback as useCallback2, useEffect, useRef } from "react";
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 = useRef(null);
82
- const containerRef = useRef(null);
83
- const isRendered = useRef(false);
84
- const isInitializing = useRef(false);
85
- const initializeRecaptcha = useCallback2(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
- useEffect(() => {
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
- export {
178
- useMetaColor,
179
- useRecaptchaV2
180
- };
@@ -1,10 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/lib/utils.ts
2
- var _clsx = require('clsx');
3
- var _tailwindmerge = require('tailwind-merge');
4
- function cn(...inputs) {
5
- return _tailwindmerge.twMerge.call(void 0, _clsx.clsx.call(void 0, inputs));
6
- }
7
-
8
-
9
-
10
- exports.cn = cn;