@pelatform/ui 1.5.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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -0
  3. package/css/components/apexcharts.css +101 -0
  4. package/css/components/book.css +19 -0
  5. package/css/components/extra.css +12 -0
  6. package/css/components/image-input.css +51 -0
  7. package/css/components/leaflet.css +25 -0
  8. package/css/components/patterns.css +34 -0
  9. package/css/components/rating.css +89 -0
  10. package/css/components/scrollable.css +118 -0
  11. package/css/components/theme-transition.css +51 -0
  12. package/css/theme.css +237 -0
  13. package/dist/animation.cjs +1936 -0
  14. package/dist/animation.d.cts +379 -0
  15. package/dist/animation.d.ts +379 -0
  16. package/dist/animation.js +1936 -0
  17. package/dist/aria.cjs +139 -0
  18. package/dist/aria.d.cts +31 -0
  19. package/dist/aria.d.ts +31 -0
  20. package/dist/aria.js +139 -0
  21. package/dist/badge-BtI4BMea.d.cts +33 -0
  22. package/dist/badge-BtI4BMea.d.ts +33 -0
  23. package/dist/base.cjs +5559 -0
  24. package/dist/base.d.cts +651 -0
  25. package/dist/base.d.ts +651 -0
  26. package/dist/base.js +5559 -0
  27. package/dist/chunk-3N75YA6Q.cjs +60 -0
  28. package/dist/chunk-CD2BCCQU.js +180 -0
  29. package/dist/chunk-CJXIPSTG.cjs +10 -0
  30. package/dist/chunk-CYFW37N5.js +1355 -0
  31. package/dist/chunk-EZW5GNS4.js +6 -0
  32. package/dist/chunk-HW52LCWN.js +22 -0
  33. package/dist/chunk-I46SELBA.cjs +22 -0
  34. package/dist/chunk-J4JGE3U5.cjs +180 -0
  35. package/dist/chunk-KNS6QRVB.cjs +28 -0
  36. package/dist/chunk-OMPNDLGS.js +576 -0
  37. package/dist/chunk-RQHJBTEU.js +10 -0
  38. package/dist/chunk-S3QFGYE6.js +28 -0
  39. package/dist/chunk-SK6SSJHC.js +9 -0
  40. package/dist/chunk-T74DBLYY.js +60 -0
  41. package/dist/chunk-UP53DCYH.cjs +6 -0
  42. package/dist/chunk-VECBSKBC.cjs +576 -0
  43. package/dist/chunk-VSLPH2IR.cjs +1355 -0
  44. package/dist/chunk-ZDR3OZ7Z.cjs +9 -0
  45. package/dist/colors-CUDWvz1g.d.cts +42 -0
  46. package/dist/colors-CUDWvz1g.d.ts +42 -0
  47. package/dist/components-BgbIL9EW.d.cts +42 -0
  48. package/dist/components-BgbIL9EW.d.ts +42 -0
  49. package/dist/components.cjs +2276 -0
  50. package/dist/components.d.cts +2762 -0
  51. package/dist/components.d.ts +2762 -0
  52. package/dist/components.js +2276 -0
  53. package/dist/default.cjs +9081 -0
  54. package/dist/default.d.cts +1322 -0
  55. package/dist/default.d.ts +1322 -0
  56. package/dist/default.js +9081 -0
  57. package/dist/hooks.cjs +666 -0
  58. package/dist/hooks.d.cts +1176 -0
  59. package/dist/hooks.d.ts +1176 -0
  60. package/dist/hooks.js +666 -0
  61. package/dist/index.cjs +234 -0
  62. package/dist/index.d.cts +298 -0
  63. package/dist/index.d.ts +298 -0
  64. package/dist/index.js +234 -0
  65. package/dist/input-AwYIskrX.d.cts +22 -0
  66. package/dist/input-AwYIskrX.d.ts +22 -0
  67. package/dist/menu-GmSRfRGB.d.cts +43 -0
  68. package/dist/menu-GmSRfRGB.d.ts +43 -0
  69. package/dist/metafile-cjs.json +1 -0
  70. package/dist/metafile-esm.json +1 -0
  71. package/dist/re-export/cva.cjs +6 -0
  72. package/dist/re-export/cva.d.cts +9 -0
  73. package/dist/re-export/cva.d.ts +9 -0
  74. package/dist/re-export/cva.js +6 -0
  75. package/dist/re-export/motion.cjs +2 -0
  76. package/dist/re-export/motion.d.cts +1 -0
  77. package/dist/re-export/motion.d.ts +1 -0
  78. package/dist/re-export/motion.js +2 -0
  79. package/dist/re-export/next-themes.cjs +2 -0
  80. package/dist/re-export/next-themes.d.cts +1 -0
  81. package/dist/re-export/next-themes.d.ts +1 -0
  82. package/dist/re-export/next-themes.js +2 -0
  83. package/dist/re-export/react-day-picker.cjs +2 -0
  84. package/dist/re-export/react-day-picker.d.cts +1 -0
  85. package/dist/re-export/react-day-picker.d.ts +1 -0
  86. package/dist/re-export/react-day-picker.js +2 -0
  87. package/dist/re-export/react-hook-form.cjs +2 -0
  88. package/dist/re-export/react-hook-form.d.cts +1 -0
  89. package/dist/re-export/react-hook-form.d.ts +1 -0
  90. package/dist/re-export/react-hook-form.js +2 -0
  91. package/dist/re-export/sonner.cjs +2 -0
  92. package/dist/re-export/sonner.d.cts +1 -0
  93. package/dist/re-export/sonner.d.ts +1 -0
  94. package/dist/re-export/sonner.js +2 -0
  95. package/dist/re-export/tanstack-query.cjs +2 -0
  96. package/dist/re-export/tanstack-query.d.cts +1 -0
  97. package/dist/re-export/tanstack-query.d.ts +1 -0
  98. package/dist/re-export/tanstack-query.js +2 -0
  99. package/dist/re-export/tanstack-table.cjs +2 -0
  100. package/dist/re-export/tanstack-table.d.cts +1 -0
  101. package/dist/re-export/tanstack-table.d.ts +1 -0
  102. package/dist/re-export/tanstack-table.js +2 -0
  103. package/dist/re-export/zod.cjs +2 -0
  104. package/dist/re-export/zod.d.cts +1 -0
  105. package/dist/re-export/zod.d.ts +1 -0
  106. package/dist/re-export/zod.js +2 -0
  107. package/package.json +171 -0
@@ -0,0 +1,60 @@
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 _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/hooks/use-copy-to-clipboard.ts
2
+ var _react = require('react'); var React = _interopRequireWildcard(_react); var React2 = _interopRequireWildcard(_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" || !_optionalChain([navigator, 'access', _ => _.clipboard, 'optionalAccess', _2 => _2.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
+
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
+
58
+
59
+
60
+ exports.useCopyToClipboard = useCopyToClipboard; exports.useIsMobile = useIsMobile;
@@ -0,0 +1,180 @@
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
+ };
@@ -0,0 +1,10 @@
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;