@pelatform/ui 1.5.3 → 1.5.5
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/dist/{chunk-WI36EFUS.cjs → chunk-7472NIIL.cjs} +1 -1
- package/dist/{chunk-UYMAUGVA.js → chunk-HR3R6KKM.js} +1 -1
- package/dist/components.cjs +100 -37
- package/dist/components.d.cts +4 -4
- package/dist/components.d.ts +4 -4
- package/dist/components.js +87 -24
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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/utils/assets-url.ts
|
|
2
2
|
function getAssetsUrl(path) {
|
|
3
|
-
const baseUrl = "https://assets.pelatform.com
|
|
3
|
+
const baseUrl = "https://assets.pelatform.com";
|
|
4
4
|
return `${baseUrl}/${path}`;
|
|
5
5
|
}
|
|
6
6
|
function getFlagUrl(flag) {
|
package/dist/components.cjs
CHANGED
|
@@ -58,7 +58,7 @@ var _chunkJ4JGE3U5cjs = require('./chunk-J4JGE3U5.cjs');
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var _chunk7472NIILcjs = require('./chunk-7472NIIL.cjs');
|
|
62
62
|
|
|
63
63
|
|
|
64
64
|
var _chunkCJXIPSTGcjs = require('./chunk-CJXIPSTG.cjs');
|
|
@@ -345,7 +345,7 @@ function ErrorComponents({
|
|
|
345
345
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
346
346
|
"img",
|
|
347
347
|
{
|
|
348
|
-
src:
|
|
348
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/19.svg"),
|
|
349
349
|
className: "max-h-40 dark:hidden",
|
|
350
350
|
alt: "illustrations"
|
|
351
351
|
}
|
|
@@ -353,7 +353,7 @@ function ErrorComponents({
|
|
|
353
353
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
354
354
|
"img",
|
|
355
355
|
{
|
|
356
|
-
src:
|
|
356
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/19-dark.svg"),
|
|
357
357
|
className: "hidden max-h-40 dark:block",
|
|
358
358
|
alt: "illustrations"
|
|
359
359
|
}
|
|
@@ -370,7 +370,7 @@ function ErrorComponents({
|
|
|
370
370
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
371
371
|
"img",
|
|
372
372
|
{
|
|
373
|
-
src:
|
|
373
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/20.svg"),
|
|
374
374
|
className: "max-h-40 dark:hidden",
|
|
375
375
|
alt: "illustrations"
|
|
376
376
|
}
|
|
@@ -378,7 +378,7 @@ function ErrorComponents({
|
|
|
378
378
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
379
379
|
"img",
|
|
380
380
|
{
|
|
381
|
-
src:
|
|
381
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/20-dark.svg"),
|
|
382
382
|
className: "hidden max-h-40 dark:block",
|
|
383
383
|
alt: "illustrations"
|
|
384
384
|
}
|
|
@@ -395,7 +395,7 @@ function ErrorComponents({
|
|
|
395
395
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
396
396
|
"img",
|
|
397
397
|
{
|
|
398
|
-
src:
|
|
398
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/29.svg"),
|
|
399
399
|
className: "max-h-40 dark:hidden",
|
|
400
400
|
alt: "illustrations"
|
|
401
401
|
}
|
|
@@ -403,7 +403,7 @@ function ErrorComponents({
|
|
|
403
403
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
404
404
|
"img",
|
|
405
405
|
{
|
|
406
|
-
src:
|
|
406
|
+
src: _chunk7472NIILcjs.getAssetsUrl.call(void 0, "media/illustrations/29-dark.svg"),
|
|
407
407
|
className: "hidden max-h-40 dark:block",
|
|
408
408
|
alt: "illustrations"
|
|
409
409
|
}
|
|
@@ -643,7 +643,7 @@ function CommandMenu({
|
|
|
643
643
|
setOpen((currentOpen) => {
|
|
644
644
|
const newState = !currentOpen;
|
|
645
645
|
if (newState) {
|
|
646
|
-
|
|
646
|
+
_chunk7472NIILcjs.googleTrackEvent.call(void 0, {
|
|
647
647
|
name: "site_header_search_trigger_shortcut",
|
|
648
648
|
properties: {
|
|
649
649
|
method: e.key === "/" ? "slash" : "cmd_k",
|
|
@@ -661,7 +661,7 @@ function CommandMenu({
|
|
|
661
661
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
662
662
|
}, []);
|
|
663
663
|
const handleButtonClick = React.useCallback(() => {
|
|
664
|
-
|
|
664
|
+
_chunk7472NIILcjs.googleTrackEvent.call(void 0, {
|
|
665
665
|
name: "site_header_search_trigger_click",
|
|
666
666
|
properties: {
|
|
667
667
|
method: "button_click",
|
|
@@ -836,7 +836,7 @@ function ChildNavItemRenderer({ Link = DefaultLink, item, pathname, level }) {
|
|
|
836
836
|
) });
|
|
837
837
|
}
|
|
838
838
|
function handleMenuClick(item) {
|
|
839
|
-
|
|
839
|
+
_chunk7472NIILcjs.googleTrackEvent.call(void 0, {
|
|
840
840
|
name: `site_header_menu_${item.title.toLowerCase().replace(/\s+/g, "_")}_link_click`,
|
|
841
841
|
properties: {
|
|
842
842
|
menu_item: item.title,
|
|
@@ -1906,7 +1906,7 @@ var ImageInput = ({
|
|
|
1906
1906
|
|
|
1907
1907
|
function LanguageSwitcher({
|
|
1908
1908
|
className,
|
|
1909
|
-
type = "
|
|
1909
|
+
type = "dropdown",
|
|
1910
1910
|
variant = "ghost",
|
|
1911
1911
|
size = "md",
|
|
1912
1912
|
showNames = true,
|
|
@@ -1932,7 +1932,7 @@ function LanguageSwitcher({
|
|
|
1932
1932
|
if (!i18nEnabled && (_nullishCoalesce(_optionalChain([languages, 'optionalAccess', _51 => _51.length]), () => ( 0))) <= 1) {
|
|
1933
1933
|
return null;
|
|
1934
1934
|
}
|
|
1935
|
-
if (type === "
|
|
1935
|
+
if (type === "dropdown") {
|
|
1936
1936
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkHILACSFAcjs.DropdownMenu, { children: [
|
|
1937
1937
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHILACSFAcjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1938
1938
|
_chunkBXUKTDPNcjs.Button,
|
|
@@ -1951,28 +1951,36 @@ function LanguageSwitcher({
|
|
|
1951
1951
|
]
|
|
1952
1952
|
}
|
|
1953
1953
|
) }),
|
|
1954
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1955
|
-
_chunkHILACSFAcjs.
|
|
1954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1955
|
+
_chunkHILACSFAcjs.DropdownMenuContent,
|
|
1956
1956
|
{
|
|
1957
|
-
|
|
1958
|
-
className:
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1957
|
+
align: "end",
|
|
1958
|
+
className: "min-w-[150px]",
|
|
1959
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1960
|
+
children: languages.map((lang) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1961
|
+
_chunkHILACSFAcjs.DropdownMenuItem,
|
|
1962
|
+
{
|
|
1963
|
+
onClick: () => handleLanguageChange(lang.code),
|
|
1964
|
+
className: _chunkCJXIPSTGcjs.cn.call(void 0, "gap-2", currentLocale === lang.code && "bg-accent"),
|
|
1965
|
+
children: [
|
|
1966
|
+
showFlags && lang.flag ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1967
|
+
Image2,
|
|
1968
|
+
{
|
|
1969
|
+
src: _chunk7472NIILcjs.getFlagUrl.call(void 0, lang.flag),
|
|
1970
|
+
alt: `${lang.name} flag`,
|
|
1971
|
+
className: "size-4 rounded-full object-cover",
|
|
1972
|
+
width: 24,
|
|
1973
|
+
height: 24
|
|
1974
|
+
}
|
|
1975
|
+
) : showFlags ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Globe, { className: "size-4" }) : null,
|
|
1976
|
+
showNames && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "text-sm", children: lang.name }),
|
|
1977
|
+
currentLocale === lang.code && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "ms-auto text-muted-foreground text-xs", children: "\u2713" })
|
|
1978
|
+
]
|
|
1979
|
+
},
|
|
1980
|
+
lang.code
|
|
1981
|
+
))
|
|
1982
|
+
}
|
|
1983
|
+
)
|
|
1976
1984
|
] });
|
|
1977
1985
|
}
|
|
1978
1986
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkHILACSFAcjs.DropdownMenuSub, { children: [
|
|
@@ -1992,7 +2000,7 @@ function LanguageSwitcher({
|
|
|
1992
2000
|
showFlags && currentLanguage.flag && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1993
2001
|
Image2,
|
|
1994
2002
|
{
|
|
1995
|
-
src:
|
|
2003
|
+
src: _chunk7472NIILcjs.getFlagUrl.call(void 0, currentLanguage.flag),
|
|
1996
2004
|
alt: currentLanguage.name,
|
|
1997
2005
|
className: "ms-1 size-3.5 rounded-full",
|
|
1998
2006
|
width: 24,
|
|
@@ -2018,7 +2026,7 @@ function LanguageSwitcher({
|
|
|
2018
2026
|
showFlags && item.flag ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2019
2027
|
Image2,
|
|
2020
2028
|
{
|
|
2021
|
-
src:
|
|
2029
|
+
src: _chunk7472NIILcjs.getFlagUrl.call(void 0, item.flag),
|
|
2022
2030
|
alt: `${item.name} flag`,
|
|
2023
2031
|
className: "size-4 rounded-full object-cover",
|
|
2024
2032
|
width: 24,
|
|
@@ -2100,6 +2108,7 @@ function ModeSwitcher({
|
|
|
2100
2108
|
_nullishCoalesce(withLabel, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: label.light })))
|
|
2101
2109
|
] });
|
|
2102
2110
|
};
|
|
2111
|
+
const isActive = (val) => theme === val;
|
|
2103
2112
|
if (type === "toogle") {
|
|
2104
2113
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2105
2114
|
_chunkBXUKTDPNcjs.Button,
|
|
@@ -2116,6 +2125,60 @@ function ModeSwitcher({
|
|
|
2116
2125
|
}
|
|
2117
2126
|
);
|
|
2118
2127
|
}
|
|
2128
|
+
if (type === "dropdown") {
|
|
2129
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkHILACSFAcjs.DropdownMenu, { children: [
|
|
2130
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkHILACSFAcjs.DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2131
|
+
_chunkBXUKTDPNcjs.Button,
|
|
2132
|
+
{
|
|
2133
|
+
variant,
|
|
2134
|
+
size,
|
|
2135
|
+
className: _chunkCJXIPSTGcjs.cn.call(void 0,
|
|
2136
|
+
"group/toggle size-8 px-0 text-foreground ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0! focus-visible:ring-offset-0!",
|
|
2137
|
+
className
|
|
2138
|
+
),
|
|
2139
|
+
children: [
|
|
2140
|
+
getCurrentIcon(),
|
|
2141
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { className: "sr-only", children: "Toggle theme" })
|
|
2142
|
+
]
|
|
2143
|
+
}
|
|
2144
|
+
) }),
|
|
2145
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkHILACSFAcjs.DropdownMenuContent, { align: "end", onCloseAutoFocus: (e) => e.preventDefault(), children: [
|
|
2146
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2147
|
+
_chunkHILACSFAcjs.DropdownMenuItem,
|
|
2148
|
+
{
|
|
2149
|
+
className: isActive("light") ? "bg-accent" : "",
|
|
2150
|
+
onClick: () => setTheme("light"),
|
|
2151
|
+
children: [
|
|
2152
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Sun, {}),
|
|
2153
|
+
label.light
|
|
2154
|
+
]
|
|
2155
|
+
}
|
|
2156
|
+
),
|
|
2157
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2158
|
+
_chunkHILACSFAcjs.DropdownMenuItem,
|
|
2159
|
+
{
|
|
2160
|
+
className: isActive("dark") ? "bg-accent" : "",
|
|
2161
|
+
onClick: () => setTheme("dark"),
|
|
2162
|
+
children: [
|
|
2163
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Moon, {}),
|
|
2164
|
+
label.dark
|
|
2165
|
+
]
|
|
2166
|
+
}
|
|
2167
|
+
),
|
|
2168
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2169
|
+
_chunkHILACSFAcjs.DropdownMenuItem,
|
|
2170
|
+
{
|
|
2171
|
+
className: isActive("system") ? "bg-accent" : "",
|
|
2172
|
+
onClick: () => setTheme("system"),
|
|
2173
|
+
children: [
|
|
2174
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.Monitor, {}),
|
|
2175
|
+
label.system
|
|
2176
|
+
]
|
|
2177
|
+
}
|
|
2178
|
+
)
|
|
2179
|
+
] })
|
|
2180
|
+
] });
|
|
2181
|
+
}
|
|
2119
2182
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2120
2183
|
_chunkHILACSFAcjs.DropdownMenuItem,
|
|
2121
2184
|
{
|
|
@@ -2373,7 +2436,7 @@ function Subscribe({
|
|
|
2373
2436
|
setLoading(true);
|
|
2374
2437
|
setShowRecaptcha(false);
|
|
2375
2438
|
try {
|
|
2376
|
-
|
|
2439
|
+
_chunk7472NIILcjs.googleTrackEvent.call(void 0, {
|
|
2377
2440
|
name: "site_newsletter_subscribe_submit",
|
|
2378
2441
|
properties: {
|
|
2379
2442
|
category: "conversion",
|
|
@@ -2400,7 +2463,7 @@ function Subscribe({
|
|
|
2400
2463
|
position: "top-center"
|
|
2401
2464
|
}
|
|
2402
2465
|
);
|
|
2403
|
-
|
|
2466
|
+
_chunk7472NIILcjs.googleTrackEvent.call(void 0, {
|
|
2404
2467
|
name: "site_newsletter_subscribe_success",
|
|
2405
2468
|
properties: {
|
|
2406
2469
|
category: "conversion",
|
package/dist/components.d.cts
CHANGED
|
@@ -2226,8 +2226,8 @@ interface LocaleOption {
|
|
|
2226
2226
|
interface LanguageSwitcherProps extends SharedImage {
|
|
2227
2227
|
/** Additional CSS classes */
|
|
2228
2228
|
className?: string;
|
|
2229
|
-
/** UI type: standalone
|
|
2230
|
-
type?: '
|
|
2229
|
+
/** UI type: standalone dropdown or submenu dropdown */
|
|
2230
|
+
type?: 'dropdown' | 'sub-dropdown';
|
|
2231
2231
|
/** Button variant style (for toggle type) */
|
|
2232
2232
|
variant?: 'ghost' | 'outline' | 'secondary';
|
|
2233
2233
|
/** Button size (for toggle type) */
|
|
@@ -2308,8 +2308,8 @@ interface ModeSwitcherProps {
|
|
|
2308
2308
|
size?: 'sm' | 'md' | 'lg';
|
|
2309
2309
|
/** Custom cycle order for themes (defaults to system -> light -> dark) */
|
|
2310
2310
|
cycleOrder?: ThemeMode[];
|
|
2311
|
-
/** Button type: 'toggle' for a single button or 'dropdown' for a menu with options */
|
|
2312
|
-
type?: 'toogle' | 'dropdown';
|
|
2311
|
+
/** Button type: 'toggle' for a single button or 'dropdown' and 'sub-dropdown' for a menu with options */
|
|
2312
|
+
type?: 'toogle' | 'dropdown' | 'sub-dropdown';
|
|
2313
2313
|
/** Labels for each theme mode (optional) */
|
|
2314
2314
|
label?: {
|
|
2315
2315
|
system?: string;
|
package/dist/components.d.ts
CHANGED
|
@@ -2226,8 +2226,8 @@ interface LocaleOption {
|
|
|
2226
2226
|
interface LanguageSwitcherProps extends SharedImage {
|
|
2227
2227
|
/** Additional CSS classes */
|
|
2228
2228
|
className?: string;
|
|
2229
|
-
/** UI type: standalone
|
|
2230
|
-
type?: '
|
|
2229
|
+
/** UI type: standalone dropdown or submenu dropdown */
|
|
2230
|
+
type?: 'dropdown' | 'sub-dropdown';
|
|
2231
2231
|
/** Button variant style (for toggle type) */
|
|
2232
2232
|
variant?: 'ghost' | 'outline' | 'secondary';
|
|
2233
2233
|
/** Button size (for toggle type) */
|
|
@@ -2308,8 +2308,8 @@ interface ModeSwitcherProps {
|
|
|
2308
2308
|
size?: 'sm' | 'md' | 'lg';
|
|
2309
2309
|
/** Custom cycle order for themes (defaults to system -> light -> dark) */
|
|
2310
2310
|
cycleOrder?: ThemeMode[];
|
|
2311
|
-
/** Button type: 'toggle' for a single button or 'dropdown' for a menu with options */
|
|
2312
|
-
type?: 'toogle' | 'dropdown';
|
|
2311
|
+
/** Button type: 'toggle' for a single button or 'dropdown' and 'sub-dropdown' for a menu with options */
|
|
2312
|
+
type?: 'toogle' | 'dropdown' | 'sub-dropdown';
|
|
2313
2313
|
/** Labels for each theme mode (optional) */
|
|
2314
2314
|
label?: {
|
|
2315
2315
|
system?: string;
|
package/dist/components.js
CHANGED
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
getAssetsUrl,
|
|
59
59
|
getFlagUrl,
|
|
60
60
|
googleTrackEvent
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-HR3R6KKM.js";
|
|
62
62
|
import {
|
|
63
63
|
cn
|
|
64
64
|
} from "./chunk-RQHJBTEU.js";
|
|
@@ -1906,7 +1906,7 @@ import { Globe, Languages } from "lucide-react";
|
|
|
1906
1906
|
import { jsx as jsx34, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
1907
1907
|
function LanguageSwitcher({
|
|
1908
1908
|
className,
|
|
1909
|
-
type = "
|
|
1909
|
+
type = "dropdown",
|
|
1910
1910
|
variant = "ghost",
|
|
1911
1911
|
size = "md",
|
|
1912
1912
|
showNames = true,
|
|
@@ -1932,7 +1932,7 @@ function LanguageSwitcher({
|
|
|
1932
1932
|
if (!i18nEnabled && (languages?.length ?? 0) <= 1) {
|
|
1933
1933
|
return null;
|
|
1934
1934
|
}
|
|
1935
|
-
if (type === "
|
|
1935
|
+
if (type === "dropdown") {
|
|
1936
1936
|
return /* @__PURE__ */ jsxs23(DropdownMenu, { children: [
|
|
1937
1937
|
/* @__PURE__ */ jsx34(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs23(
|
|
1938
1938
|
Button,
|
|
@@ -1951,28 +1951,36 @@ function LanguageSwitcher({
|
|
|
1951
1951
|
]
|
|
1952
1952
|
}
|
|
1953
1953
|
) }),
|
|
1954
|
-
/* @__PURE__ */ jsx34(
|
|
1955
|
-
|
|
1954
|
+
/* @__PURE__ */ jsx34(
|
|
1955
|
+
DropdownMenuContent,
|
|
1956
1956
|
{
|
|
1957
|
-
|
|
1958
|
-
className:
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1957
|
+
align: "end",
|
|
1958
|
+
className: "min-w-[150px]",
|
|
1959
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
|
1960
|
+
children: languages.map((lang) => /* @__PURE__ */ jsxs23(
|
|
1961
|
+
DropdownMenuItem,
|
|
1962
|
+
{
|
|
1963
|
+
onClick: () => handleLanguageChange(lang.code),
|
|
1964
|
+
className: cn("gap-2", currentLocale === lang.code && "bg-accent"),
|
|
1965
|
+
children: [
|
|
1966
|
+
showFlags && lang.flag ? /* @__PURE__ */ jsx34(
|
|
1967
|
+
Image2,
|
|
1968
|
+
{
|
|
1969
|
+
src: getFlagUrl(lang.flag),
|
|
1970
|
+
alt: `${lang.name} flag`,
|
|
1971
|
+
className: "size-4 rounded-full object-cover",
|
|
1972
|
+
width: 24,
|
|
1973
|
+
height: 24
|
|
1974
|
+
}
|
|
1975
|
+
) : showFlags ? /* @__PURE__ */ jsx34(Globe, { className: "size-4" }) : null,
|
|
1976
|
+
showNames && /* @__PURE__ */ jsx34("span", { className: "text-sm", children: lang.name }),
|
|
1977
|
+
currentLocale === lang.code && /* @__PURE__ */ jsx34("span", { className: "ms-auto text-muted-foreground text-xs", children: "\u2713" })
|
|
1978
|
+
]
|
|
1979
|
+
},
|
|
1980
|
+
lang.code
|
|
1981
|
+
))
|
|
1982
|
+
}
|
|
1983
|
+
)
|
|
1976
1984
|
] });
|
|
1977
1985
|
}
|
|
1978
1986
|
return /* @__PURE__ */ jsxs23(DropdownMenuSub, { children: [
|
|
@@ -2100,6 +2108,7 @@ function ModeSwitcher({
|
|
|
2100
2108
|
withLabel ?? /* @__PURE__ */ jsx36("span", { children: label.light })
|
|
2101
2109
|
] });
|
|
2102
2110
|
};
|
|
2111
|
+
const isActive = (val) => theme === val;
|
|
2103
2112
|
if (type === "toogle") {
|
|
2104
2113
|
return /* @__PURE__ */ jsxs24(
|
|
2105
2114
|
Button,
|
|
@@ -2116,6 +2125,60 @@ function ModeSwitcher({
|
|
|
2116
2125
|
}
|
|
2117
2126
|
);
|
|
2118
2127
|
}
|
|
2128
|
+
if (type === "dropdown") {
|
|
2129
|
+
return /* @__PURE__ */ jsxs24(DropdownMenu, { children: [
|
|
2130
|
+
/* @__PURE__ */ jsx36(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs24(
|
|
2131
|
+
Button,
|
|
2132
|
+
{
|
|
2133
|
+
variant,
|
|
2134
|
+
size,
|
|
2135
|
+
className: cn(
|
|
2136
|
+
"group/toggle size-8 px-0 text-foreground ring-0! focus:outline-none! focus:ring-0! focus-visible:outline-none! focus-visible:ring-0! focus-visible:ring-offset-0!",
|
|
2137
|
+
className
|
|
2138
|
+
),
|
|
2139
|
+
children: [
|
|
2140
|
+
getCurrentIcon(),
|
|
2141
|
+
/* @__PURE__ */ jsx36("span", { className: "sr-only", children: "Toggle theme" })
|
|
2142
|
+
]
|
|
2143
|
+
}
|
|
2144
|
+
) }),
|
|
2145
|
+
/* @__PURE__ */ jsxs24(DropdownMenuContent, { align: "end", onCloseAutoFocus: (e) => e.preventDefault(), children: [
|
|
2146
|
+
/* @__PURE__ */ jsxs24(
|
|
2147
|
+
DropdownMenuItem,
|
|
2148
|
+
{
|
|
2149
|
+
className: isActive("light") ? "bg-accent" : "",
|
|
2150
|
+
onClick: () => setTheme("light"),
|
|
2151
|
+
children: [
|
|
2152
|
+
/* @__PURE__ */ jsx36(Sun, {}),
|
|
2153
|
+
label.light
|
|
2154
|
+
]
|
|
2155
|
+
}
|
|
2156
|
+
),
|
|
2157
|
+
/* @__PURE__ */ jsxs24(
|
|
2158
|
+
DropdownMenuItem,
|
|
2159
|
+
{
|
|
2160
|
+
className: isActive("dark") ? "bg-accent" : "",
|
|
2161
|
+
onClick: () => setTheme("dark"),
|
|
2162
|
+
children: [
|
|
2163
|
+
/* @__PURE__ */ jsx36(Moon, {}),
|
|
2164
|
+
label.dark
|
|
2165
|
+
]
|
|
2166
|
+
}
|
|
2167
|
+
),
|
|
2168
|
+
/* @__PURE__ */ jsxs24(
|
|
2169
|
+
DropdownMenuItem,
|
|
2170
|
+
{
|
|
2171
|
+
className: isActive("system") ? "bg-accent" : "",
|
|
2172
|
+
onClick: () => setTheme("system"),
|
|
2173
|
+
children: [
|
|
2174
|
+
/* @__PURE__ */ jsx36(Monitor, {}),
|
|
2175
|
+
label.system
|
|
2176
|
+
]
|
|
2177
|
+
}
|
|
2178
|
+
)
|
|
2179
|
+
] })
|
|
2180
|
+
] });
|
|
2181
|
+
}
|
|
2119
2182
|
return /* @__PURE__ */ jsx36(
|
|
2120
2183
|
DropdownMenuItem,
|
|
2121
2184
|
{
|
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk7472NIILcjs = require('./chunk-7472NIIL.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkCJXIPSTGcjs = require('./chunk-CJXIPSTG.cjs');
|
|
@@ -227,4 +227,4 @@ var parse = (
|
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
|
|
230
|
-
exports.DEFAULT_THEME_MODE = _chunkI46SELBAcjs.DEFAULT_THEME_MODE; exports.META_THEME_COLORS = _chunkI46SELBAcjs.META_THEME_COLORS; exports.THEME_MODES = _chunkI46SELBAcjs.THEME_MODES; exports.calculateMaxWidth = calculateMaxWidth; exports.cn = _chunkCJXIPSTGcjs.cn; exports.cva = _chunkUP53DCYHcjs.cva; exports.getAssetsUrl =
|
|
230
|
+
exports.DEFAULT_THEME_MODE = _chunkI46SELBAcjs.DEFAULT_THEME_MODE; exports.META_THEME_COLORS = _chunkI46SELBAcjs.META_THEME_COLORS; exports.THEME_MODES = _chunkI46SELBAcjs.THEME_MODES; exports.calculateMaxWidth = calculateMaxWidth; exports.cn = _chunkCJXIPSTGcjs.cn; exports.cva = _chunkUP53DCYHcjs.cva; exports.getAssetsUrl = _chunk7472NIILcjs.getAssetsUrl; exports.getDotPattern = getDotPattern; exports.getFlagUrl = _chunk7472NIILcjs.getFlagUrl; exports.getGradientStyle = getGradientStyle; exports.getGridPattern = getGridPattern; exports.getIPAddress = getIPAddress; exports.getMask = getMask; exports.getPatternStyle = getPatternStyle; exports.getPositionClasses = getPositionClasses; exports.googleTrackEvent = _chunk7472NIILcjs.googleTrackEvent; exports.hexToRgba = hexToRgba; exports.isValidHex = isValidHex; exports.normalizePath = normalizePath; exports.parse = parse;
|