@pelatform/ui 1.6.0 → 2.1.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.
- package/README.md +360 -5
- package/dist/animation.d.ts +6 -379
- package/dist/animation.js +2 -1750
- package/dist/base.d.ts +1 -651
- package/dist/base.js +2 -5554
- package/dist/components.d.ts +1 -2944
- package/dist/components.js +2 -2719
- package/dist/css/color/gray.css +105 -0
- package/dist/css/color/neutral.css +105 -0
- package/dist/css/color/slate.css +105 -0
- package/dist/css/color/stone.css +105 -0
- package/dist/css/color/zinc.css +105 -0
- package/dist/css/styles/style-lyra.css +1335 -0
- package/dist/css/styles/style-maia.css +1360 -0
- package/dist/css/styles/style-mira.css +1362 -0
- package/dist/css/styles/style-nova.css +1360 -0
- package/dist/css/styles/style-vega.css +1356 -0
- package/dist/hooks.d.ts +1 -1172
- package/dist/hooks.js +2 -664
- package/dist/index.d.ts +1 -318
- package/dist/index.js +3 -229
- package/dist/radix.d.ts +1 -0
- package/dist/radix.js +4 -0
- package/dist/style.css +2 -0
- package/package.json +82 -136
- package/LICENSE +0 -21
- package/css/components/apexcharts.css +0 -101
- package/css/components/book.css +0 -19
- package/css/components/extra.css +0 -12
- package/css/components/image-input.css +0 -51
- package/css/components/leaflet.css +0 -25
- package/css/components/patterns.css +0 -34
- package/css/components/rating.css +0 -89
- package/css/components/scrollable.css +0 -118
- package/css/components/theme-transition.css +0 -51
- package/css/theme.css +0 -238
- package/dist/animation.cjs +0 -1752
- package/dist/animation.d.cts +0 -379
- package/dist/aria.cjs +0 -139
- package/dist/aria.d.cts +0 -31
- package/dist/aria.d.ts +0 -31
- package/dist/aria.js +0 -139
- package/dist/badge-BtI4BMea.d.cts +0 -33
- package/dist/badge-BtI4BMea.d.ts +0 -33
- package/dist/base.cjs +0 -5556
- package/dist/base.d.cts +0 -651
- package/dist/chunk-3N75YA6Q.cjs +0 -60
- package/dist/chunk-7472NIIL.cjs +0 -40
- package/dist/chunk-BXUKTDPN.cjs +0 -576
- package/dist/chunk-CD2BCCQU.js +0 -180
- package/dist/chunk-CJXIPSTG.cjs +0 -10
- package/dist/chunk-CTHRAJQZ.js +0 -1522
- package/dist/chunk-D373YKDA.js +0 -196
- package/dist/chunk-EZW5GNS4.js +0 -6
- package/dist/chunk-HILACSFA.cjs +0 -1522
- package/dist/chunk-HR3R6KKM.js +0 -40
- package/dist/chunk-HW52LCWN.js +0 -22
- package/dist/chunk-I46SELBA.cjs +0 -22
- package/dist/chunk-J4JGE3U5.cjs +0 -180
- package/dist/chunk-RQHJBTEU.js +0 -10
- package/dist/chunk-SK6SSJHC.js +0 -9
- package/dist/chunk-T74DBLYY.js +0 -60
- package/dist/chunk-TB6DU23O.js +0 -576
- package/dist/chunk-UP53DCYH.cjs +0 -6
- package/dist/chunk-ZBO5IAMA.cjs +0 -196
- package/dist/chunk-ZDR3OZ7Z.cjs +0 -9
- package/dist/colors-CUDWvz1g.d.cts +0 -42
- package/dist/colors-CUDWvz1g.d.ts +0 -42
- package/dist/components-CidsRcc3.d.cts +0 -46
- package/dist/components-CidsRcc3.d.ts +0 -46
- package/dist/components.cjs +0 -2721
- package/dist/components.d.cts +0 -2944
- package/dist/default.cjs +0 -8931
- package/dist/default.d.cts +0 -1322
- package/dist/default.d.ts +0 -1322
- package/dist/default.js +0 -8931
- package/dist/hooks.cjs +0 -666
- package/dist/hooks.d.cts +0 -1172
- package/dist/index.cjs +0 -230
- package/dist/index.d.cts +0 -318
- package/dist/input-AwYIskrX.d.cts +0 -22
- package/dist/input-AwYIskrX.d.ts +0 -22
- package/dist/menu-GmSRfRGB.d.cts +0 -43
- package/dist/menu-GmSRfRGB.d.ts +0 -43
- package/dist/metafile-cjs.json +0 -1
- package/dist/metafile-esm.json +0 -1
- package/dist/re-export/cva.cjs +0 -6
- package/dist/re-export/cva.d.cts +0 -10
- package/dist/re-export/cva.d.ts +0 -10
- package/dist/re-export/cva.js +0 -6
- package/dist/re-export/motion.cjs +0 -2
- package/dist/re-export/motion.d.cts +0 -1
- package/dist/re-export/motion.d.ts +0 -1
- package/dist/re-export/motion.js +0 -2
- package/dist/re-export/next-themes.cjs +0 -2
- package/dist/re-export/next-themes.d.cts +0 -1
- package/dist/re-export/next-themes.d.ts +0 -1
- package/dist/re-export/next-themes.js +0 -2
- package/dist/re-export/react-day-picker.cjs +0 -2
- package/dist/re-export/react-day-picker.d.cts +0 -1
- package/dist/re-export/react-day-picker.d.ts +0 -1
- package/dist/re-export/react-day-picker.js +0 -2
- package/dist/re-export/react-hook-form.cjs +0 -2
- package/dist/re-export/react-hook-form.d.cts +0 -1
- package/dist/re-export/react-hook-form.d.ts +0 -1
- package/dist/re-export/react-hook-form.js +0 -2
- package/dist/re-export/resolver.cjs +0 -2
- package/dist/re-export/resolver.d.cts +0 -1
- package/dist/re-export/resolver.d.ts +0 -1
- package/dist/re-export/resolver.js +0 -2
- package/dist/re-export/sonner.cjs +0 -2
- package/dist/re-export/sonner.d.cts +0 -1
- package/dist/re-export/sonner.d.ts +0 -1
- package/dist/re-export/sonner.js +0 -2
- package/dist/re-export/tanstack-query.cjs +0 -2
- package/dist/re-export/tanstack-query.d.cts +0 -1
- package/dist/re-export/tanstack-query.d.ts +0 -1
- package/dist/re-export/tanstack-query.js +0 -2
- package/dist/re-export/tanstack-table.cjs +0 -2
- package/dist/re-export/tanstack-table.d.cts +0 -1
- package/dist/re-export/tanstack-table.d.ts +0 -1
- package/dist/re-export/tanstack-table.js +0 -2
- package/dist/re-export/zod.cjs +0 -2
- package/dist/re-export/zod.d.cts +0 -1
- package/dist/re-export/zod.d.ts +0 -1
- package/dist/re-export/zod.js +0 -2
package/dist/chunk-HR3R6KKM.js
DELETED
|
@@ -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
|
-
};
|
package/dist/chunk-HW52LCWN.js
DELETED
|
@@ -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
|
-
};
|
package/dist/chunk-I46SELBA.cjs
DELETED
|
@@ -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;
|
package/dist/chunk-J4JGE3U5.cjs
DELETED
|
@@ -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;
|
package/dist/chunk-RQHJBTEU.js
DELETED
package/dist/chunk-SK6SSJHC.js
DELETED
package/dist/chunk-T74DBLYY.js
DELETED
|
@@ -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
|
-
};
|