@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
package/dist/index.d.ts CHANGED
@@ -1,318 +1,68 @@
1
- export { D as DEFAULT_THEME_MODE, M as META_THEME_COLORS, T as THEME_MODES, a as ThemeMode } from './colors-CUDWvz1g.js';
2
- import { ClassValue } from 'clsx';
3
- export { cva } from 'class-variance-authority';
4
- export { B as BaseProps, I as Image, L as Link } from './components-CidsRcc3.js';
5
- export { a as MenuConfig, M as MenuItem } from './menu-GmSRfRGB.js';
6
- import 'react';
1
+ export * from '@pelatform/ui.core';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import React__default from 'react';
7
4
 
8
5
  /**
9
- * Interface for event tracking parameters
10
- * Defines the structure for tracking events in Google Analytics
6
+ * Props interface for icon components
7
+ * Extends standard HTML SVG element attributes for full customization
11
8
  */
12
- interface EventProps {
13
- /** Event name to be tracked (required, non-empty string) */
14
- name: string;
15
- /** Optional properties/attributes for the event */
16
- properties?: Record<string, string | number | boolean>;
17
- }
9
+ type IconProps = React__default.HTMLAttributes<SVGElement>;
18
10
  /**
19
- * Global declaration for Google Analytics gtag function
20
- * This extends the Window interface to include the gtag function
21
- * that's injected by the Google Analytics script
22
- */
23
- declare global {
24
- interface Window {
25
- gtag?: (command: 'event' | 'config' | 'set', targetId: string, config?: Record<string, string | number | boolean | object | null | undefined>) => void;
26
- }
27
- }
28
- /**
29
- * Tracks an event in Google Analytics with proper error handling and validation.
30
- *
31
- * @param params - Event parameters
32
- * @param params.name - Event name (required, non-empty string)
33
- * @param params.properties - Optional event properties
34
- */
35
- declare const googleTrackEvent: ({ name, properties }: EventProps) => void;
36
-
37
- type PatternType = 'none' | 'grid' | 'dots';
38
- type GradientDirection = 'none' | 'to right' | 'to left' | 'to bottom' | 'to top' | 'to bottom right' | 'to bottom left' | 'to top right' | 'to top left';
39
- type MaskDirection = 'none' | 'circle at center' | 'circle at center top' | 'circle at top right' | 'circle at center right' | 'circle at bottom right' | 'circle at center bottom' | 'circle at bottom left' | 'circle at center left' | 'circle at top left';
40
- type PositionOption = 'start' | 'center' | 'end';
41
- type AlignmentOption = 'left' | 'center' | 'right';
42
- interface BackgroundImageLayer {
43
- imageSrc?: string;
44
- }
45
- interface MaskLayer {
46
- enabled?: boolean;
47
- direction?: MaskDirection;
48
- visibleRadius?: number;
49
- fadeWidth?: number;
50
- }
51
- interface PatternLayer {
52
- type?: PatternType;
53
- color?: string;
54
- opacity?: number;
55
- size?: number;
56
- backgroundSize?: number;
57
- lineThickness?: number;
58
- mask?: MaskLayer;
59
- }
60
- interface GradientLayer {
61
- startColor?: string;
62
- endColor?: string;
63
- opacity?: number;
64
- direction?: GradientDirection;
65
- mask?: MaskLayer;
66
- }
67
- interface PositionedElement {
68
- customClasses?: string;
69
- textColor?: string;
70
- bgColor?: string;
71
- fontSize?: string;
72
- fontWeight?: string;
73
- width?: string;
74
- height?: string;
75
- hPosition?: PositionOption;
76
- vPosition?: PositionOption;
77
- alignment?: AlignmentOption;
78
- autoMargin?: boolean;
79
- }
80
- interface ContentLayout {
81
- layoutContainer?: string;
82
- logoContainer?: string;
83
- logo?: string;
84
- tagContainer?: string;
85
- contentContainer?: string;
86
- tag?: string;
87
- title?: string;
88
- description?: string;
89
- website?: string;
90
- }
91
- interface OhImgBaseTemplateProps {
92
- content: {
93
- title: string;
94
- description?: string;
95
- tags?: string[];
96
- website?: string;
97
- logoSrc?: string;
98
- };
99
- background?: BackgroundImageLayer;
100
- pattern?: PatternLayer;
101
- gradient?: GradientLayer;
102
- layout?: ContentLayout;
103
- }
104
-
105
- /**
106
- * Converts hex color to rgba format with specified opacity
107
- */
108
- declare const isValidHex: (color: string) => boolean;
109
- declare const hexToRgba: (color: string, opacity: number) => string;
110
- declare const getMask: ({ direction, visibleRadius, fadeWidth }: {
111
- direction?: string | undefined;
112
- visibleRadius?: number | undefined;
113
- fadeWidth?: number | undefined;
114
- }) => {
115
- maskImage: string;
116
- WebkitMaskImage: string;
117
- };
118
- declare const getDotPattern: ({ color, opacity, size, backgroundSize, }: {
119
- color?: string | undefined;
120
- opacity?: number | undefined;
121
- size?: number | undefined;
122
- backgroundSize?: number | undefined;
123
- }) => {
124
- backgroundImage: string;
125
- backgroundSize: string;
126
- backgroundPosition: string;
127
- };
128
- declare const getGridPattern: ({ color, opacity, size, lineThickness, }: {
129
- color?: string;
130
- opacity?: number;
131
- size?: number;
132
- lineThickness?: number;
133
- }) => {
134
- backgroundImage: string;
135
- backgroundSize: string;
136
- };
137
- declare const getPatternStyle: (props: PatternLayer) => {};
138
- declare const getGradientStyle: (props: GradientLayer) => {};
139
- declare function calculateMaxWidth(paddingX: string | undefined): number;
140
- declare function getPositionClasses(element: PositionedElement, maxWidth: number): string;
141
-
142
- /**
143
- * Utility functions for CSS class name management
144
- * Provides optimized class name merging with Tailwind CSS conflict resolution
145
- * Essential for component styling and conditional class application
146
- */
147
-
148
- /**
149
- * Merges Tailwind class names, resolving any conflicts.
150
- * This utility combines clsx for conditional classes with tailwind-merge
151
- * to properly handle Tailwind CSS class conflicts.
152
- *
153
- * @param inputs - An array of class names, objects, or arrays to merge
154
- * @returns A string of merged and optimized class names
155
- */
156
- declare function cn(...inputs: ClassValue[]): string;
157
-
158
- /**
159
- * Assets URL Utility
160
- * Builds a fully-qualified CDN URL for a given assets path.
161
- * Useful for referencing illustrations and media from the Pelatform assets CDN.
162
- */
163
- /**
164
- * Build a full CDN URL for a given assets path.
165
- *
166
- * @param path - Relative path to the asset (e.g., "media/illustrations/29.svg")
167
- * @returns A fully-qualified CDN URL string
168
- *
169
- * @example
170
- * ```ts
171
- * import { getAssetsUrl } from "@pelatform/ui/utils/assets-url";
172
- *
173
- * const url = getAssetsUrl("media/illustrations/29.svg");
174
- * // "https://assets.pelatform.com/media/illustrations/29.svg"
175
- * ```
176
- */
177
- declare function getAssetsUrl(path: string): string;
178
- /**
179
- * Build a CDN URL for a country flag SVG.
180
- *
181
- * The function lowercases the given ISO country code and returns a
182
- * fully-qualified URL pointing to the SVG flag hosted on the Pelatform
183
- * assets CDN.
11
+ * Collection of brand and service icons
184
12
  *
185
- * @param flag - ISO 3166-1 alpha-2 country code (e.g., "US", "ID", "GB")
186
- * @returns A URL string to the SVG flag on the CDN
13
+ * This object contains SVG icons for popular brands, services, and technologies.
14
+ * All icons are designed to be scalable and themeable using CSS currentColor.
187
15
  *
188
16
  * @example
189
- * ```ts
190
- * import { getFlagUrl } from "@pelatform/ui/utils/flag-url";
191
- *
192
- * const urlUs = getFlagUrl("US");
193
- * // "https://assets.pelatform.com/media/flags/us.svg"
194
- *
195
- * const urlId = getFlagUrl("id");
196
- * // "https://assets.pelatform.com/media/flags/id.svg"
197
- *
198
- * // Can be used directly in an <img /> or <Image /> component
199
- * // <img src={getFlagUrl("GB")} alt="United Kingdom flag" />
17
+ * ```tsx
18
+ * // Basic usage
19
+ * <Icons.google className="w-6 h-6" />
20
+ *
21
+ * // With custom styling
22
+ * <Icons.github
23
+ * className="w-8 h-8 text-gray-600 hover:text-gray-900"
24
+ * onClick={handleGitHubClick}
25
+ * />
26
+ *
27
+ * // Colorful variants
28
+ * <Icons.googleColorful className="w-10 h-10" />
29
+ * <Icons.facebookColorful className="w-10 h-10" />
200
30
  * ```
201
31
  */
202
- declare function getFlagUrl(flag: string): string;
203
-
204
- /**
205
- * Get the client's public IP address using external services.
206
- *
207
- * This utility is intended for client-side usage only (it checks for `window`).
208
- * It attempts multiple providers for resiliency and normalizes the response
209
- * to a simple string. If all providers fail or the environment is not a
210
- * browser, it resolves to `'unknown'`.
211
- *
212
- * Providers queried (in order):
213
- * - `https://api.ipify.org?format=json`
214
- * - `https://ipapi.co/json/`
215
- * - `https://api.ip.sb/jsonip`
216
- *
217
- * @returns Promise that resolves to an IP address string or `'unknown'` if not available
218
- *
219
- * @example
220
- * ```ts
221
- * import { getIPAddress } from "@pelatform/ui/utils/ip";
222
- *
223
- * const ip = await getIPAddress();
224
- * // e.g., "203.0.113.42" or "unknown"
225
- *
226
- * // Example in a React component
227
- * // useEffect(() => {
228
- * // getIPAddress().then(setIp);
229
- * // }, []);
230
- * ```
231
- */
232
- declare function getIPAddress(): Promise<string>;
233
-
234
- /**
235
- * Normalize a pathname string.
236
- *
237
- * - Ensures it always starts with '/'
238
- * - Collapses multiple slashes (e.g., `'//a///b'` becomes `'/a/b'`)
239
- * - Removes trailing slash except for root path (e.g., `'/login/'` becomes `'/login'`)
240
- *
241
- * @param input - Any path-like string
242
- * @returns A normalized path beginning with '/'
243
- *
244
- * @example
245
- * ```ts
246
- * import { normalizePath } from "@pelatform/ui/utils/parse";
247
- *
248
- * normalizePath("dashboard"); // "/dashboard"
249
- * normalizePath("//a///b"); // "/a/b"
250
- * normalizePath("/login/"); // "/login"
251
- * normalizePath(""); // "/"
252
- * ```
253
- */
254
- declare function normalizePath(input: string): string;
255
- /**
256
- * Interface for parsed request data
257
- */
258
- interface ParsedRequest {
259
- /** Normalized domain name (lowercase, without www) */
260
- domain: string;
261
- /** URL pathname (e.g., '/dashboard/users') */
262
- path: string;
263
- /** Full path including query parameters (e.g., '/dashboard/users?page=1') */
264
- fullPath: string;
265
- /** First path segment (e.g., 'dashboard' from '/dashboard/users') */
266
- key: string;
267
- /** Full path without leading slash (e.g., 'dashboard/users') */
268
- fullKey: string;
269
- /** Query parameters as object */
270
- searchParamsObj: Record<string, string>;
271
- /** Query parameters as string (e.g., '?page=1&limit=10') */
272
- searchParamsString: string;
273
- }
274
- /**
275
- * Parse and normalize a Next.js `NextRequest`.
276
- *
277
- * Extracts domain, normalized path, first segment key, full path, and
278
- * query parameters (both as object and as string). Handles international
279
- * characters via `decodeURIComponent` and normalizes the host by removing
280
- * a leading `www.`.
281
- *
282
- * @param req - The incoming Next.js `NextRequest`
283
- * @returns Parsed request data with normalized components
284
- *
285
- * @example
286
- * ```ts
287
- * import type { NextRequest } from "next/server";
288
- * import { parse } from "@pelatform/ui/utils/parse";
289
- *
290
- * export function middleware(req: NextRequest) {
291
- * const { domain, path, fullPath, key } = parse(req);
292
- *
293
- * console.log(domain); // e.g., "api.pelatform.com"
294
- * console.log(path); // e.g., "/v1/users"
295
- * console.log(fullPath); // e.g., "/v1/users?page=1"
296
- * console.log(key); // e.g., "v1"
297
- * }
298
- * ```
299
- *
300
- * @example
301
- * ```ts
302
- * // Handling international URLs
303
- * const { key, fullKey } = parse(req);
304
- * console.log(key); // Decoded first path segment
305
- * console.log(fullKey); // Decoded full path
306
- * ```
307
- *
308
- * @example
309
- * ```ts
310
- * // Working with query parameters
311
- * const { searchParamsObj, searchParamsString } = parse(req);
312
- * // searchParamsObj -> { page: "1", limit: "10" }
313
- * // searchParamsString -> "?page=1&limit=10"
314
- * ```
315
- */
316
- declare const parse: (req: any) => ParsedRequest;
32
+ declare const Icons: {
33
+ anthropic: (props: IconProps) => react_jsx_runtime.JSX.Element;
34
+ apple: (props: IconProps) => react_jsx_runtime.JSX.Element;
35
+ aria: (props: IconProps) => react_jsx_runtime.JSX.Element;
36
+ facebook: (props: IconProps) => react_jsx_runtime.JSX.Element;
37
+ facebookColorful: (props: IconProps) => react_jsx_runtime.JSX.Element;
38
+ github: (props: IconProps) => react_jsx_runtime.JSX.Element;
39
+ google: (props: IconProps) => react_jsx_runtime.JSX.Element;
40
+ googleColorful: (props: IconProps) => react_jsx_runtime.JSX.Element;
41
+ instagram: (props: IconProps) => react_jsx_runtime.JSX.Element;
42
+ linkedin: (props: IconProps) => react_jsx_runtime.JSX.Element;
43
+ linkedinColorful: (props: IconProps) => react_jsx_runtime.JSX.Element;
44
+ microsoft: (props: IconProps) => react_jsx_runtime.JSX.Element;
45
+ nextjs: (props: IconProps) => react_jsx_runtime.JSX.Element;
46
+ npm: (props: IconProps) => react_jsx_runtime.JSX.Element;
47
+ openai: (props: IconProps) => react_jsx_runtime.JSX.Element;
48
+ paypal: (props: IconProps) => react_jsx_runtime.JSX.Element;
49
+ pelatform: (props: IconProps) => react_jsx_runtime.JSX.Element;
50
+ pnpm: (props: IconProps) => react_jsx_runtime.JSX.Element;
51
+ postgresql: (props: IconProps) => react_jsx_runtime.JSX.Element;
52
+ prisma: (props: IconProps) => react_jsx_runtime.JSX.Element;
53
+ radix: (props: IconProps) => react_jsx_runtime.JSX.Element;
54
+ radixui: (props: IconProps) => react_jsx_runtime.JSX.Element;
55
+ react: (props: IconProps) => react_jsx_runtime.JSX.Element;
56
+ scira: (props: IconProps) => react_jsx_runtime.JSX.Element;
57
+ scribble: (props: IconProps) => react_jsx_runtime.JSX.Element;
58
+ supabaseColorful: (props: IconProps) => react_jsx_runtime.JSX.Element;
59
+ tailwind: (props: IconProps) => react_jsx_runtime.JSX.Element;
60
+ telegram: (props: IconProps) => react_jsx_runtime.JSX.Element;
61
+ twitter: (props: IconProps) => react_jsx_runtime.JSX.Element;
62
+ whatsApp: (props: IconProps) => react_jsx_runtime.JSX.Element;
63
+ x: (props: IconProps) => react_jsx_runtime.JSX.Element;
64
+ yarn: (props: IconProps) => react_jsx_runtime.JSX.Element;
65
+ youtube: (props: IconProps) => react_jsx_runtime.JSX.Element;
66
+ };
317
67
 
318
- export { type AlignmentOption, type BackgroundImageLayer, type ContentLayout, type GradientDirection, type GradientLayer, type MaskDirection, type MaskLayer, type OhImgBaseTemplateProps, type ParsedRequest, type PatternLayer, type PatternType, type PositionOption, type PositionedElement, calculateMaxWidth, cn, getAssetsUrl, getDotPattern, getFlagUrl, getGradientStyle, getGridPattern, getIPAddress, getMask, getPatternStyle, getPositionClasses, googleTrackEvent, hexToRgba, isValidHex, normalizePath, parse };
68
+ export { Icons };
package/dist/index.js CHANGED
@@ -1,230 +1,9 @@
1
1
  import {
2
- getAssetsUrl,
3
- getFlagUrl,
4
- googleTrackEvent
5
- } from "./chunk-HR3R6KKM.js";
6
- import {
7
- cn
8
- } from "./chunk-RQHJBTEU.js";
9
- import {
10
- DEFAULT_THEME_MODE,
11
- META_THEME_COLORS,
12
- THEME_MODES
13
- } from "./chunk-HW52LCWN.js";
14
- import {
15
- cva
16
- } from "./chunk-EZW5GNS4.js";
17
-
18
- // src/lib/ohimg.ts
19
- var isValidHex = (color) => {
20
- const hexPattern = /^#[0-9A-Fa-f]{6}$/;
21
- return hexPattern.test(color);
22
- };
23
- var hexToRgba = (color, opacity) => {
24
- const defaultColor = "#000000";
25
- let normalizedColor = color?.startsWith("#") ? color : `#${color}`;
26
- if (!isValidHex(normalizedColor)) {
27
- console.warn(`Invalid hex color: ${color}, using default black`);
28
- normalizedColor = defaultColor;
29
- }
30
- const r = parseInt(normalizedColor.slice(1, 3), 16);
31
- const g = parseInt(normalizedColor.slice(3, 5), 16);
32
- const b = parseInt(normalizedColor.slice(5, 7), 16);
33
- const safeOpacity = Math.max(0, Math.min(1, opacity ?? 1));
34
- return `rgba(${r}, ${g}, ${b}, ${safeOpacity})`;
35
- };
36
- var getMask = ({ direction = "circle at center", visibleRadius = 30, fadeWidth = 20 }) => {
37
- const outerRadius = visibleRadius + fadeWidth;
38
- return {
39
- maskImage: `radial-gradient(${direction}, black ${visibleRadius}%, transparent ${outerRadius}%)`,
40
- WebkitMaskImage: `radial-gradient(${direction}, black ${visibleRadius}%, transparent ${outerRadius}%)`
41
- };
42
- };
43
- var getDotPattern = ({
44
- color = "#000000",
45
- opacity = 0.5,
46
- size = 25,
47
- backgroundSize = 20
48
- }) => {
49
- const dotColor = hexToRgba(color, opacity);
50
- return {
51
- backgroundImage: `radial-gradient(${dotColor} ${size}%, transparent ${size + 1}%), radial-gradient(${dotColor} ${size - 0.5}%, transparent ${size + 0.5}%)`,
52
- backgroundSize: `${backgroundSize}px ${backgroundSize}px, ${backgroundSize}px ${backgroundSize}px`,
53
- backgroundPosition: `0 0, ${backgroundSize / 2}px ${backgroundSize / 2}px`
54
- };
55
- };
56
- var getGridPattern = ({
57
- color = "#000000",
58
- opacity = 0.5,
59
- size = 20,
60
- lineThickness = 1
61
- }) => {
62
- const colorWithOpacity = hexToRgba(color, opacity);
63
- return {
64
- backgroundImage: `
65
- linear-gradient(to right, ${colorWithOpacity} ${lineThickness}px, transparent ${lineThickness}px),
66
- linear-gradient(to bottom, ${colorWithOpacity} ${lineThickness}px, transparent ${lineThickness}px)
67
- `,
68
- backgroundSize: `${size}px ${size}px`
69
- };
70
- };
71
- var getPatternStyle = (props) => {
72
- switch (props.type) {
73
- case "dots":
74
- return {
75
- ...getDotPattern({
76
- color: props.color,
77
- opacity: props.opacity,
78
- size: props.size,
79
- backgroundSize: props.backgroundSize
80
- }),
81
- ...props.mask && props.mask.enabled === true && getMask({
82
- direction: props.mask.direction,
83
- visibleRadius: props.mask.visibleRadius,
84
- fadeWidth: props.mask.fadeWidth
85
- })
86
- };
87
- case "grid":
88
- return {
89
- ...getGridPattern({
90
- color: props.color,
91
- opacity: props.opacity,
92
- size: props.size,
93
- lineThickness: props.lineThickness
94
- }),
95
- ...props.mask && props.mask.enabled === true && getMask({
96
- direction: props.mask.direction,
97
- visibleRadius: props.mask.visibleRadius,
98
- fadeWidth: props.mask.fadeWidth
99
- })
100
- };
101
- default:
102
- return {};
103
- }
104
- };
105
- var getGradientStyle = (props) => {
106
- if (!props.direction || props.direction === "none") {
107
- return {};
108
- }
109
- const baseGradient = {
110
- background: `linear-gradient(${props.direction || "to bottom"}, ${props.startColor || "#000000"}, ${props.endColor || "#000000"})`,
111
- opacity: props.opacity ?? 0.7
112
- };
113
- return {
114
- ...baseGradient,
115
- ...props.mask && props.mask.enabled === true && getMask({
116
- direction: props.mask.direction,
117
- visibleRadius: props.mask.visibleRadius,
118
- fadeWidth: props.mask.fadeWidth
119
- })
120
- };
121
- };
122
- function calculateMaxWidth(paddingX) {
123
- const baseWidth = 1200;
124
- if (!paddingX) {
125
- return baseWidth;
126
- }
127
- const paddingValue = parseInt(paddingX.replace("px", ""), 10);
128
- if (Number.isNaN(paddingValue)) {
129
- return baseWidth;
130
- }
131
- const adjustedWidth = baseWidth - 2 * paddingValue;
132
- const finalWidth = Math.min(adjustedWidth, baseWidth);
133
- return finalWidth;
134
- }
135
- function getPositionClasses(element, maxWidth) {
136
- return cn(element.customClasses && element.customClasses, `max-w-[${maxWidth}px]`);
137
- }
138
-
139
- // src/utils/ip.ts
140
- async function getIPAddress() {
141
- if (typeof window === "undefined") {
142
- return "unknown";
143
- }
144
- try {
145
- const services = [
146
- "https://api.ipify.org?format=json",
147
- "https://ipapi.co/json/",
148
- "https://api.ip.sb/jsonip"
149
- ];
150
- for (const service of services) {
151
- try {
152
- const response = await fetch(service, {
153
- method: "GET",
154
- headers: {
155
- Accept: "application/json"
156
- }
157
- });
158
- if (response.ok) {
159
- const data = await response.json();
160
- const ip = data.ip || data.query || data.ipAddress;
161
- if (ip && typeof ip === "string") {
162
- return ip;
163
- }
164
- }
165
- } catch (serviceError) {
166
- console.warn(`IP service ${service} failed:`, serviceError);
167
- }
168
- }
169
- return "unknown";
170
- } catch (error) {
171
- console.error("Failed to get client IP:", error);
172
- return "unknown";
173
- }
174
- }
2
+ Icons
3
+ } from "./chunk-VZEE3GOC.js";
175
4
 
176
- // src/utils/parse.ts
177
- function normalizePath(input) {
178
- if (!input) return "/";
179
- let p = input.trim();
180
- if (!p.startsWith("/")) p = `/${p}`;
181
- p = p.replace(/\/{2,}/g, "/");
182
- if (p.length > 1 && p.endsWith("/")) p = p.slice(0, -1);
183
- return p;
184
- }
185
- var parse = (
186
- // biome-ignore lint/suspicious/noExplicitAny: disable
187
- (req) => {
188
- let domain = req.headers.get("host");
189
- domain = domain.replace(/^www\./, "").toLowerCase();
190
- const path = req.nextUrl.pathname;
191
- const searchParams = req.nextUrl.searchParams.toString();
192
- const searchParamsObj = Object.fromEntries(req.nextUrl.searchParams);
193
- const searchParamsString = searchParams.length > 0 ? `?${searchParams}` : "";
194
- const fullPath = `${path}${searchParamsString}`;
195
- const pathSegments = path.split("/").filter(Boolean);
196
- const key = pathSegments.length > 0 ? decodeURIComponent(pathSegments[0]) : "";
197
- const fullKey = path.length > 1 ? decodeURIComponent(path.slice(1)) : "";
198
- return {
199
- domain,
200
- path,
201
- fullPath,
202
- key,
203
- fullKey,
204
- searchParamsObj,
205
- searchParamsString
206
- };
207
- }
208
- );
5
+ // src/index.ts
6
+ export * from "@pelatform/ui.core";
209
7
  export {
210
- DEFAULT_THEME_MODE,
211
- META_THEME_COLORS,
212
- THEME_MODES,
213
- calculateMaxWidth,
214
- cn,
215
- cva,
216
- getAssetsUrl,
217
- getDotPattern,
218
- getFlagUrl,
219
- getGradientStyle,
220
- getGridPattern,
221
- getIPAddress,
222
- getMask,
223
- getPatternStyle,
224
- getPositionClasses,
225
- googleTrackEvent,
226
- hexToRgba,
227
- isValidHex,
228
- normalizePath,
229
- parse
8
+ Icons
230
9
  };