@zuzjs/ui 0.7.9 → 0.8.1

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 (40) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/comps/Alert/index.d.ts +2 -2
  3. package/dist/cjs/comps/Alert/index.js +1 -1
  4. package/dist/cjs/comps/Alert/types.d.ts +3 -2
  5. package/dist/cjs/comps/Cover/index.js +1 -1
  6. package/dist/cjs/comps/Sheet/index.d.ts +4 -0
  7. package/dist/cjs/comps/Sheet/index.js +3 -1
  8. package/dist/cjs/comps/VideoPlayer/index.js +1 -1
  9. package/dist/cjs/funs/index.d.ts +1 -1
  10. package/dist/cjs/funs/index.js +2 -2
  11. package/dist/cjs/funs/stylesheet.js +2 -0
  12. package/dist/cjs/hooks/index.d.ts +4 -0
  13. package/dist/cjs/hooks/index.js +4 -0
  14. package/dist/cjs/hooks/useFacebookPixel.d.ts +11 -0
  15. package/dist/cjs/hooks/useFacebookPixel.js +64 -0
  16. package/dist/cjs/hooks/useGoogleTagManager.d.ts +9 -0
  17. package/dist/cjs/hooks/useGoogleTagManager.js +53 -0
  18. package/dist/cjs/hooks/useWebSocket.d.ts +15 -0
  19. package/dist/cjs/hooks/useWebSocket.js +87 -0
  20. package/dist/esm/comps/Alert/index.d.ts +2 -2
  21. package/dist/esm/comps/Alert/index.js +1 -1
  22. package/dist/esm/comps/Alert/types.d.ts +3 -2
  23. package/dist/esm/comps/Cover/index.js +1 -1
  24. package/dist/esm/comps/Sheet/index.d.ts +4 -0
  25. package/dist/esm/comps/Sheet/index.js +3 -1
  26. package/dist/esm/comps/VideoPlayer/index.js +1 -1
  27. package/dist/esm/funs/index.d.ts +1 -1
  28. package/dist/esm/funs/index.js +2 -2
  29. package/dist/esm/funs/stylesheet.js +2 -0
  30. package/dist/esm/hooks/index.d.ts +4 -0
  31. package/dist/esm/hooks/index.js +4 -0
  32. package/dist/esm/hooks/useFacebookPixel.d.ts +11 -0
  33. package/dist/esm/hooks/useFacebookPixel.js +64 -0
  34. package/dist/esm/hooks/useGoogleTagManager.d.ts +9 -0
  35. package/dist/esm/hooks/useGoogleTagManager.js +53 -0
  36. package/dist/esm/hooks/useWebSocket.d.ts +15 -0
  37. package/dist/esm/hooks/useWebSocket.js +87 -0
  38. package/dist/tsconfig.esm.tsbuildinfo +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/package.json +1 -1
package/README.md CHANGED
@@ -41,4 +41,4 @@ Documention in progress.
41
41
 
42
42
  ## License
43
43
 
44
- This project is licensed under the MIT License.
44
+ This project is licensed under the MIT License.
@@ -5,7 +5,7 @@ declare const Alert: import("react").ForwardRefExoticComponent<BoxProps & {
5
5
  type?: ALERT;
6
6
  icon?: string;
7
7
  iconSize?: number;
8
- message?: string;
9
- title: string;
8
+ message?: string | import("react").ReactNode;
9
+ title: string | import("react").ReactNode;
10
10
  } & import("react").RefAttributes<AlertHandler>>;
11
11
  export default Alert;
@@ -8,7 +8,7 @@ import Text from "../Text";
8
8
  const Alert = forwardRef((props, ref) => {
9
9
  const { type, icon, title, message, iconSize, ...pops } = props;
10
10
  const { className, style, rest } = useBase(pops);
11
- return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
11
+ return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { fontSize: iconSize, width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
12
12
  });
13
13
  Alert.displayName = `Alert`;
14
14
  export default Alert;
@@ -1,11 +1,12 @@
1
+ import { ReactNode } from "react";
1
2
  import { ALERT } from "../../types/enums";
2
3
  import { BoxProps } from "../Box";
3
4
  export type AlertProps = BoxProps & {
4
5
  type?: ALERT;
5
6
  icon?: string;
6
7
  iconSize?: number;
7
- message?: string;
8
- title: string;
8
+ message?: string | ReactNode;
9
+ title: string | ReactNode;
9
10
  };
10
11
  export interface AlertHandler {
11
12
  open: () => void;
@@ -12,7 +12,7 @@ const Cover = forwardRef((props, ref) => {
12
12
  if (`when` in props && props.when == false) {
13
13
  return null;
14
14
  }
15
- return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous`, style: {
15
+ return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous ${className}`.trim(), style: {
16
16
  ...style,
17
17
  backgroundColor: `var(--cover-bg)`
18
18
  }, ...rest, children: [_jsx(Spinner, { type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
@@ -11,6 +11,8 @@ export type SheetProps = ZuzProps & {
11
11
  spinner?: SPINNER;
12
12
  loadingMessage?: string;
13
13
  actionPosition?: SHEET_ACTION_POSITION;
14
+ onShow?: () => void;
15
+ onHide?: () => void;
14
16
  };
15
17
  export interface SheetActionHandler {
16
18
  key?: string;
@@ -38,6 +40,8 @@ declare const Sheet: import("react").ForwardRefExoticComponent<ZuzProps & {
38
40
  spinner?: SPINNER;
39
41
  loadingMessage?: string;
40
42
  actionPosition?: SHEET_ACTION_POSITION;
43
+ onShow?: () => void;
44
+ onHide?: () => void;
41
45
  } & import("react").RefAttributes<SheetHandler>>;
42
46
  export declare const isSheetHandler: (src: unknown) => src is SheetHandler;
43
47
  export default Sheet;
@@ -12,7 +12,7 @@ import Overlay from "../Overlay";
12
12
  let _sheetTimeout = null;
13
13
  let _sheetWobbleTimeout = null;
14
14
  const Sheet = forwardRef((props, ref) => {
15
- const { title: _title, message, transition, curve, speed, type, actionPosition, spinner, loadingMessage, ...pops } = props;
15
+ const { title: _title, message, transition, curve, speed, type, actionPosition, spinner, loadingMessage, onShow, onHide, ...pops } = props;
16
16
  const { className, style, rest } = useBase(pops);
17
17
  const [title, setTitle] = useState(_title || ``);
18
18
  const [msg, setMsg] = useState(message || ``);
@@ -125,9 +125,11 @@ const Sheet = forwardRef((props, ref) => {
125
125
  setSheetType(type || SHEET.Default);
126
126
  setMsg(message);
127
127
  setVisible(true);
128
+ onShow?.();
128
129
  },
129
130
  hide() {
130
131
  setVisible(false);
132
+ onHide?.();
131
133
  }
132
134
  }));
133
135
  const buildAnimation = useMemo(() => {
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import Box from "../Box";
4
4
  const VideoPlayer = forwardRef((props, ref) => {
5
- return _jsx(Box, {});
5
+ return _jsx(Box, { children: _jsx("video", {}) });
6
6
  });
7
7
  export default VideoPlayer;
@@ -50,7 +50,7 @@ export declare const withZuz: (cx: string | string[]) => string;
50
50
  export declare const setDeep: (object: dynamicObject, path: string, value: any, seperator?: string) => dynamicObject;
51
51
  export declare const removeDuplicatesFromArray: <T>(array: T[]) => T[];
52
52
  export declare const withPost: <T>(uri: string, data: dynamicObject | FormData, timeout?: number, onProgress?: (ev: AxiosProgressEvent) => void) => Promise<T>;
53
- export declare const withGet: <T>(uri: string, timeout?: number) => Promise<T>;
53
+ export declare const withGet: <T>(uri: string, timeout?: number, ignoreKind?: boolean) => Promise<T>;
54
54
  export declare const withTime: (fun: (...args: any[]) => any) => {
55
55
  result: any;
56
56
  executionTime: number;
@@ -260,12 +260,12 @@ export const withPost = async (uri, data, timeout = 60, onProgress) => {
260
260
  });
261
261
  });
262
262
  };
263
- export const withGet = async (uri, timeout = 60) => {
263
+ export const withGet = async (uri, timeout = 60, ignoreKind = false) => {
264
264
  return new Promise((resolve, reject) => {
265
265
  axios
266
266
  .get(uri, { timeout: timeout * 1000 })
267
267
  .then((resp) => {
268
- if (resp.data && "kind" in resp.data) {
268
+ if (ignoreKind || (resp.data && "kind" in resp.data)) {
269
269
  resolve(resp.data);
270
270
  }
271
271
  else {
@@ -18,6 +18,7 @@ export const cssProps = {
18
18
  "backgroundColor": "background-color",
19
19
  "backgroundImage": "background-image",
20
20
  "bgi": "background-image",
21
+ "bgc": "background-color",
21
22
  "backgroundOrigin": "background-origin",
22
23
  "backgroundPosition": "background-position",
23
24
  "backgroundRepeat": "background-repeat",
@@ -230,6 +231,7 @@ export const cssProps = {
230
231
  "textOverflow": "text-overflow",
231
232
  "textShadow": "text-shadow",
232
233
  "textTransform": "text-transform",
234
+ "textStroke": "-webkit-text-stroke",
233
235
  "top": "top",
234
236
  "transform": "transform",
235
237
  "transform(2D)": "transform(2D)",
@@ -16,12 +16,16 @@ export { default as useMergedRefs } from './useMergedRefs';
16
16
  export { default as useMutationObserver, type MutationCallback } from './useMutationObserver';
17
17
  export { default as useDrag, type DragOptions } from './useDrag';
18
18
  export { default as useFileManager } from './useFileManager';
19
+ export { default as useFacebookPixel } from './useFacebookPixel';
20
+ export { default as useGoogleTagManager } from './useGoogleTagManager';
19
21
  export { default as useImage } from './useImage';
20
22
  export { default as useIntersectionObserver } from './useIntersectionObserver';
21
23
  export { default as useScrollbar } from './useScrollbar';
24
+ export { default as useSheet } from './useSheet';
22
25
  export { default as useShortcuts } from './useShortcuts';
23
26
  export { default as useNetworkStatus } from './useNetworkStatus';
24
27
  export { default as useResizeObserver } from './useResizeObserver';
25
28
  export { default as useSlider } from './useSlider';
26
29
  export { default as useTruncateText } from './useTruncateText';
27
30
  export { default as useViewTransition } from './useViewTransition';
31
+ export { default as useWebSocket, type WebSocketOptions } from './useWebSocket';
@@ -17,12 +17,16 @@ export { default as useMutationObserver } from './useMutationObserver';
17
17
  export { default as useDrag } from './useDrag';
18
18
  export { default as useFileManager } from './useFileManager';
19
19
  //useFilter
20
+ export { default as useFacebookPixel } from './useFacebookPixel';
21
+ export { default as useGoogleTagManager } from './useGoogleTagManager';
20
22
  export { default as useImage } from './useImage';
21
23
  export { default as useIntersectionObserver } from './useIntersectionObserver';
22
24
  export { default as useScrollbar } from './useScrollbar';
25
+ export { default as useSheet } from './useSheet';
23
26
  export { default as useShortcuts } from './useShortcuts';
24
27
  export { default as useNetworkStatus } from './useNetworkStatus';
25
28
  export { default as useResizeObserver } from './useResizeObserver';
26
29
  export { default as useSlider } from './useSlider';
27
30
  export { default as useTruncateText } from './useTruncateText';
28
31
  export { default as useViewTransition } from './useViewTransition';
32
+ export { default as useWebSocket } from './useWebSocket';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Custom hook for Facebook Pixel tracking
3
+ * @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
4
+ * @param debug - Optional debug mode (default: false)
5
+ */
6
+ declare const useFacebookPixel: (pixelId?: string, debug?: boolean) => {
7
+ trackPageView: () => void;
8
+ trackEvent: (eventName: string, params?: Record<string, any>) => void;
9
+ trackCustom: (eventName: string, params?: Record<string, any>) => void;
10
+ };
11
+ export default useFacebookPixel;
@@ -0,0 +1,64 @@
1
+ import { useEffect } from "react";
2
+ /**
3
+ * Custom hook for Facebook Pixel tracking
4
+ * @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
5
+ * @param debug - Optional debug mode (default: false)
6
+ */
7
+ const useFacebookPixel = (pixelId, debug = false) => {
8
+ // Initialize Facebook Pixel
9
+ useEffect(() => {
10
+ if (!pixelId)
11
+ return;
12
+ // Load Facebook Pixel script if not already loaded
13
+ if (!window.fbq) {
14
+ const script = document.createElement('script');
15
+ script.async = true;
16
+ script.src = `https://connect.facebook.net/en_US/fbevents.js`;
17
+ document.head.appendChild(script);
18
+ window._fbq = window._fbq || [];
19
+ window.fbq = function () {
20
+ window._fbq.push(arguments);
21
+ };
22
+ window.fbq('init', pixelId);
23
+ if (debug) {
24
+ window.fbq('set', 'debug', true);
25
+ }
26
+ }
27
+ // Track initial page view
28
+ window.fbq('track', 'PageView');
29
+ }, [pixelId, debug]);
30
+ /**
31
+ * Track a page view
32
+ */
33
+ const trackPageView = () => {
34
+ if (!pixelId)
35
+ return;
36
+ window.fbq('track', 'PageView');
37
+ };
38
+ /**
39
+ * Track a custom event
40
+ * @param eventName - Standard or custom event name
41
+ * @param params - Optional event parameters
42
+ */
43
+ const trackEvent = (eventName, params) => {
44
+ if (!pixelId)
45
+ return;
46
+ window.fbq('track', eventName, params);
47
+ };
48
+ /**
49
+ * Track a custom conversion
50
+ * @param eventName - Conversion event name
51
+ * @param params - Optional conversion parameters
52
+ */
53
+ const trackCustom = (eventName, params) => {
54
+ if (!pixelId)
55
+ return;
56
+ window.fbq('trackCustom', eventName, params);
57
+ };
58
+ return {
59
+ trackPageView,
60
+ trackEvent,
61
+ trackCustom,
62
+ };
63
+ };
64
+ export default useFacebookPixel;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Custom hook for Google gtag (Global Site Tag) tracking
3
+ * @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
4
+ */
5
+ declare const useGtag: (id?: string) => {
6
+ trackPageView: (path?: string) => void;
7
+ trackEvent: (eventName: string, params?: Record<string, any>) => void;
8
+ };
9
+ export default useGtag;
@@ -0,0 +1,53 @@
1
+ import { useEffect } from 'react';
2
+ /**
3
+ * Custom hook for Google gtag (Global Site Tag) tracking
4
+ * @param id - Google Analytics tracking ID (e.g., 'G-XXXXXXXXXX')
5
+ */
6
+ const useGtag = (id) => {
7
+ // Initialize gtag.js
8
+ useEffect(() => {
9
+ if (!id)
10
+ return;
11
+ // Load gtag.js script if not already loaded
12
+ if (!window.gtag) {
13
+ const script = document.createElement('script');
14
+ script.async = true;
15
+ script.src = `https://www.googletagmanager.com/gtag/js?id=${id}`;
16
+ document.head.appendChild(script);
17
+ window.dataLayer = window.dataLayer || [];
18
+ window.gtag = function () {
19
+ window.dataLayer.push(arguments);
20
+ };
21
+ // Set the current date/time
22
+ window.gtag('js', new Date());
23
+ }
24
+ // Configure the tracker
25
+ window.gtag('config', id);
26
+ }, [id]);
27
+ /**
28
+ * Track a page view
29
+ * @param path - URL path to track (defaults to current location)
30
+ */
31
+ const trackPageView = (path) => {
32
+ if (!id)
33
+ return;
34
+ window.gtag('config', id, {
35
+ page_path: path || window.location.pathname,
36
+ });
37
+ };
38
+ /**
39
+ * Track an event
40
+ * @param eventName - Event name (e.g., 'login', 'sign_up')
41
+ * @param params - Additional event parameters
42
+ */
43
+ const trackEvent = (eventName, params) => {
44
+ if (!id)
45
+ return;
46
+ window.gtag('event', eventName, params);
47
+ };
48
+ return {
49
+ trackPageView,
50
+ trackEvent,
51
+ };
52
+ };
53
+ export default useGtag;
@@ -0,0 +1,15 @@
1
+ import { dynamicObject } from "..";
2
+ export type WebSocketOptions = {
3
+ onOpen?: (event: Event) => void;
4
+ onClose?: (event: CloseEvent) => void;
5
+ onRawMessage?: (event: MessageEvent) => void;
6
+ onMessage?: (data: dynamicObject) => void;
7
+ onError?: (event: Event) => void;
8
+ reconnect?: boolean;
9
+ };
10
+ declare const useWebSocket: (url: string, options?: WebSocketOptions) => {
11
+ isConnected: boolean;
12
+ messages: any[];
13
+ sendMessage: (message: string | object) => void;
14
+ };
15
+ export default useWebSocket;
@@ -0,0 +1,87 @@
1
+ "use client";
2
+ import { useCallback, useEffect, useState } from "react";
3
+ const socketInstances = new Map();
4
+ const listenersMap = new Map();
5
+ const reconnectIntervals = new Map(); // Store dynamic reconnect intervals
6
+ const useWebSocket = (url, options) => {
7
+ const { onOpen, onClose, onRawMessage, onMessage, onError, reconnect = true } = options || {};
8
+ const [isConnected, setIsConnected] = useState(false);
9
+ const [messages, setMessages] = useState([]);
10
+ const getReconnectInterval = (url) => reconnectIntervals.get(url) ?? 2;
11
+ const increaseReconnectInterval = (url) => {
12
+ const current = getReconnectInterval(url);
13
+ const next = Math.min(current * 2, 60); // Double each time, max 60s
14
+ reconnectIntervals.set(url, next);
15
+ return next * 1000;
16
+ };
17
+ const resetReconnectInterval = (url) => {
18
+ reconnectIntervals.set(url, 2); // Reset to 1s on successful reconnect
19
+ };
20
+ const connect = useCallback(() => {
21
+ if (socketInstances.has(url))
22
+ return; // Prevent duplicate connection
23
+ const socket = new WebSocket(url);
24
+ socketInstances.set(url, socket);
25
+ listenersMap.set(url, []);
26
+ socket.onopen = (event) => {
27
+ setIsConnected(true);
28
+ resetReconnectInterval(url);
29
+ onOpen?.(event);
30
+ };
31
+ socket.onmessage = (event) => {
32
+ setMessages((prev) => [...prev, event.data]);
33
+ onRawMessage?.(event);
34
+ const raw = JSON.parse(Buffer.isBuffer(event) ? event.toString(`utf8`) : `string` == typeof event ? event : event.data);
35
+ onMessage?.(raw);
36
+ listenersMap.get(url)?.forEach((listener) => listener(event));
37
+ };
38
+ socket.onerror = (event) => {
39
+ onError?.(event);
40
+ };
41
+ socket.onclose = (event) => {
42
+ setIsConnected(false);
43
+ onClose?.(event);
44
+ socketInstances.delete(url);
45
+ listenersMap.delete(url);
46
+ if (reconnect && event.code !== 1000) { // 1000 = normal close
47
+ const delay = increaseReconnectInterval(url);
48
+ console.log(`Reconnecting in ${delay / 1000} seconds...`);
49
+ setTimeout(() => {
50
+ if (!socketInstances.has(url))
51
+ connect(); // Ensure only one instance reconnects
52
+ }, delay);
53
+ }
54
+ };
55
+ }, [url, onOpen, onClose, onMessage, onError, reconnect]);
56
+ useEffect(() => {
57
+ connect();
58
+ return () => {
59
+ if (listenersMap.get(url)?.length === 0) {
60
+ socketInstances.get(url)?.close();
61
+ socketInstances.delete(url);
62
+ listenersMap.delete(url);
63
+ reconnectIntervals.delete(url);
64
+ }
65
+ };
66
+ }, []);
67
+ useEffect(() => {
68
+ const messageListener = (event) => setMessages((prev) => [...prev, event.data]);
69
+ listenersMap.get(url)?.push(messageListener);
70
+ return () => {
71
+ const listeners = listenersMap.get(url) || [];
72
+ listenersMap.set(url, listeners.filter((listener) => listener !== messageListener));
73
+ };
74
+ }, [url]);
75
+ const sendMessage = useCallback((message) => {
76
+ const socket = socketInstances.get(url);
77
+ if (socket && socket.readyState === WebSocket.OPEN) {
78
+ const data = typeof message === "string" ? message : JSON.stringify(message);
79
+ socket.send(data);
80
+ }
81
+ else {
82
+ console.warn("WebSocket is not connected.");
83
+ }
84
+ }, [url]);
85
+ return { isConnected, messages, sendMessage };
86
+ };
87
+ export default useWebSocket;
@@ -5,7 +5,7 @@ declare const Alert: import("react").ForwardRefExoticComponent<BoxProps & {
5
5
  type?: ALERT;
6
6
  icon?: string;
7
7
  iconSize?: number;
8
- message?: string;
9
- title: string;
8
+ message?: string | import("react").ReactNode;
9
+ title: string | import("react").ReactNode;
10
10
  } & import("react").RefAttributes<AlertHandler>>;
11
11
  export default Alert;
@@ -8,7 +8,7 @@ import Text from "../Text";
8
8
  const Alert = forwardRef((props, ref) => {
9
9
  const { type, icon, title, message, iconSize, ...pops } = props;
10
10
  const { className, style, rest } = useBase(pops);
11
- return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
11
+ return _jsxs(Box, { className: `--alert --${(type || ALERT.Info)} flex aic ${className}`.trim(), style: style, ...rest, children: [_jsx(Box, { className: `--icon icon-${icon || `auto-matic`}`, style: iconSize ? { fontSize: iconSize, width: iconSize, height: iconSize } : {}, children: !icon && SVGIcons[type || ALERT.Info] }), _jsxs(Box, { className: `--meta flex cols`, children: [_jsx(Text, { className: `--title ${message ? `--tm` : ``}`, children: title || `Lorem ipsum dolor sit amet, consectetur adipiscing elit.` }), message && _jsx(Text, { className: `--message`, h: 2, children: message })] })] });
12
12
  });
13
13
  Alert.displayName = `Alert`;
14
14
  export default Alert;
@@ -1,11 +1,12 @@
1
+ import { ReactNode } from "react";
1
2
  import { ALERT } from "../../types/enums";
2
3
  import { BoxProps } from "../Box";
3
4
  export type AlertProps = BoxProps & {
4
5
  type?: ALERT;
5
6
  icon?: string;
6
7
  iconSize?: number;
7
- message?: string;
8
- title: string;
8
+ message?: string | ReactNode;
9
+ title: string | ReactNode;
9
10
  };
10
11
  export interface AlertHandler {
11
12
  open: () => void;
@@ -12,7 +12,7 @@ const Cover = forwardRef((props, ref) => {
12
12
  if (`when` in props && props.when == false) {
13
13
  return null;
14
14
  }
15
- return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous`, style: {
15
+ return _jsxs(Box, { className: `--cover flex aic jcc cols abs fillx nope nous ${className}`.trim(), style: {
16
16
  ...style,
17
17
  backgroundColor: `var(--cover-bg)`
18
18
  }, ...rest, children: [_jsx(Spinner, { type: spinner || SPINNER.Simple }), !hideMessage && _jsx(Text, { className: `--label`, style: { color: `var(--cover-label)` }, children: message || `loading` })] });
@@ -11,6 +11,8 @@ export type SheetProps = ZuzProps & {
11
11
  spinner?: SPINNER;
12
12
  loadingMessage?: string;
13
13
  actionPosition?: SHEET_ACTION_POSITION;
14
+ onShow?: () => void;
15
+ onHide?: () => void;
14
16
  };
15
17
  export interface SheetActionHandler {
16
18
  key?: string;
@@ -38,6 +40,8 @@ declare const Sheet: import("react").ForwardRefExoticComponent<ZuzProps & {
38
40
  spinner?: SPINNER;
39
41
  loadingMessage?: string;
40
42
  actionPosition?: SHEET_ACTION_POSITION;
43
+ onShow?: () => void;
44
+ onHide?: () => void;
41
45
  } & import("react").RefAttributes<SheetHandler>>;
42
46
  export declare const isSheetHandler: (src: unknown) => src is SheetHandler;
43
47
  export default Sheet;
@@ -12,7 +12,7 @@ import Overlay from "../Overlay";
12
12
  let _sheetTimeout = null;
13
13
  let _sheetWobbleTimeout = null;
14
14
  const Sheet = forwardRef((props, ref) => {
15
- const { title: _title, message, transition, curve, speed, type, actionPosition, spinner, loadingMessage, ...pops } = props;
15
+ const { title: _title, message, transition, curve, speed, type, actionPosition, spinner, loadingMessage, onShow, onHide, ...pops } = props;
16
16
  const { className, style, rest } = useBase(pops);
17
17
  const [title, setTitle] = useState(_title || ``);
18
18
  const [msg, setMsg] = useState(message || ``);
@@ -125,9 +125,11 @@ const Sheet = forwardRef((props, ref) => {
125
125
  setSheetType(type || SHEET.Default);
126
126
  setMsg(message);
127
127
  setVisible(true);
128
+ onShow?.();
128
129
  },
129
130
  hide() {
130
131
  setVisible(false);
132
+ onHide?.();
131
133
  }
132
134
  }));
133
135
  const buildAnimation = useMemo(() => {
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import Box from "../Box";
4
4
  const VideoPlayer = forwardRef((props, ref) => {
5
- return _jsx(Box, {});
5
+ return _jsx(Box, { children: _jsx("video", {}) });
6
6
  });
7
7
  export default VideoPlayer;
@@ -50,7 +50,7 @@ export declare const withZuz: (cx: string | string[]) => string;
50
50
  export declare const setDeep: (object: dynamicObject, path: string, value: any, seperator?: string) => dynamicObject;
51
51
  export declare const removeDuplicatesFromArray: <T>(array: T[]) => T[];
52
52
  export declare const withPost: <T>(uri: string, data: dynamicObject | FormData, timeout?: number, onProgress?: (ev: AxiosProgressEvent) => void) => Promise<T>;
53
- export declare const withGet: <T>(uri: string, timeout?: number) => Promise<T>;
53
+ export declare const withGet: <T>(uri: string, timeout?: number, ignoreKind?: boolean) => Promise<T>;
54
54
  export declare const withTime: (fun: (...args: any[]) => any) => {
55
55
  result: any;
56
56
  executionTime: number;
@@ -260,12 +260,12 @@ export const withPost = async (uri, data, timeout = 60, onProgress) => {
260
260
  });
261
261
  });
262
262
  };
263
- export const withGet = async (uri, timeout = 60) => {
263
+ export const withGet = async (uri, timeout = 60, ignoreKind = false) => {
264
264
  return new Promise((resolve, reject) => {
265
265
  axios
266
266
  .get(uri, { timeout: timeout * 1000 })
267
267
  .then((resp) => {
268
- if (resp.data && "kind" in resp.data) {
268
+ if (ignoreKind || (resp.data && "kind" in resp.data)) {
269
269
  resolve(resp.data);
270
270
  }
271
271
  else {
@@ -18,6 +18,7 @@ export const cssProps = {
18
18
  "backgroundColor": "background-color",
19
19
  "backgroundImage": "background-image",
20
20
  "bgi": "background-image",
21
+ "bgc": "background-color",
21
22
  "backgroundOrigin": "background-origin",
22
23
  "backgroundPosition": "background-position",
23
24
  "backgroundRepeat": "background-repeat",
@@ -230,6 +231,7 @@ export const cssProps = {
230
231
  "textOverflow": "text-overflow",
231
232
  "textShadow": "text-shadow",
232
233
  "textTransform": "text-transform",
234
+ "textStroke": "-webkit-text-stroke",
233
235
  "top": "top",
234
236
  "transform": "transform",
235
237
  "transform(2D)": "transform(2D)",
@@ -16,12 +16,16 @@ export { default as useMergedRefs } from './useMergedRefs';
16
16
  export { default as useMutationObserver, type MutationCallback } from './useMutationObserver';
17
17
  export { default as useDrag, type DragOptions } from './useDrag';
18
18
  export { default as useFileManager } from './useFileManager';
19
+ export { default as useFacebookPixel } from './useFacebookPixel';
20
+ export { default as useGoogleTagManager } from './useGoogleTagManager';
19
21
  export { default as useImage } from './useImage';
20
22
  export { default as useIntersectionObserver } from './useIntersectionObserver';
21
23
  export { default as useScrollbar } from './useScrollbar';
24
+ export { default as useSheet } from './useSheet';
22
25
  export { default as useShortcuts } from './useShortcuts';
23
26
  export { default as useNetworkStatus } from './useNetworkStatus';
24
27
  export { default as useResizeObserver } from './useResizeObserver';
25
28
  export { default as useSlider } from './useSlider';
26
29
  export { default as useTruncateText } from './useTruncateText';
27
30
  export { default as useViewTransition } from './useViewTransition';
31
+ export { default as useWebSocket, type WebSocketOptions } from './useWebSocket';
@@ -17,12 +17,16 @@ export { default as useMutationObserver } from './useMutationObserver';
17
17
  export { default as useDrag } from './useDrag';
18
18
  export { default as useFileManager } from './useFileManager';
19
19
  //useFilter
20
+ export { default as useFacebookPixel } from './useFacebookPixel';
21
+ export { default as useGoogleTagManager } from './useGoogleTagManager';
20
22
  export { default as useImage } from './useImage';
21
23
  export { default as useIntersectionObserver } from './useIntersectionObserver';
22
24
  export { default as useScrollbar } from './useScrollbar';
25
+ export { default as useSheet } from './useSheet';
23
26
  export { default as useShortcuts } from './useShortcuts';
24
27
  export { default as useNetworkStatus } from './useNetworkStatus';
25
28
  export { default as useResizeObserver } from './useResizeObserver';
26
29
  export { default as useSlider } from './useSlider';
27
30
  export { default as useTruncateText } from './useTruncateText';
28
31
  export { default as useViewTransition } from './useViewTransition';
32
+ export { default as useWebSocket } from './useWebSocket';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Custom hook for Facebook Pixel tracking
3
+ * @param pixelId - Facebook Pixel ID (e.g., '123456789012345')
4
+ * @param debug - Optional debug mode (default: false)
5
+ */
6
+ declare const useFacebookPixel: (pixelId?: string, debug?: boolean) => {
7
+ trackPageView: () => void;
8
+ trackEvent: (eventName: string, params?: Record<string, any>) => void;
9
+ trackCustom: (eventName: string, params?: Record<string, any>) => void;
10
+ };
11
+ export default useFacebookPixel;