@almadar/ui 5.36.0 → 5.38.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.
@@ -4,9 +4,6 @@ var React9 = require('react');
4
4
  var logger = require('@almadar/logger');
5
5
  var jsxRuntime = require('react/jsx-runtime');
6
6
  var LucideIcons2 = require('lucide-react');
7
- var PhosphorIcons = require('@phosphor-icons/react');
8
- var TablerIcons = require('@tabler/icons-react');
9
- var FaIcons = require('react-icons/fa');
10
7
 
11
8
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
12
9
 
@@ -30,9 +27,6 @@ function _interopNamespace(e) {
30
27
 
31
28
  var React9__default = /*#__PURE__*/_interopDefault(React9);
32
29
  var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
33
- var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
34
- var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
35
- var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
36
30
 
37
31
  // node_modules/clsx/dist/clsx.mjs
38
32
  function r(e) {
@@ -3066,6 +3060,42 @@ function kebabToPascal(name) {
3066
3060
  return part.charAt(0).toUpperCase() + part.slice(1);
3067
3061
  }).join("");
3068
3062
  }
3063
+ var libPromises = /* @__PURE__ */ new Map();
3064
+ function loadLib(key, importer) {
3065
+ let p = libPromises.get(key);
3066
+ if (!p) {
3067
+ p = importer().then((m) => m);
3068
+ libPromises.set(key, p);
3069
+ }
3070
+ return p;
3071
+ }
3072
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
3073
+ const Lazy = React9__default.default.lazy(async () => {
3074
+ const lib = await loadLib(libKey, importer);
3075
+ const Comp = pick(lib);
3076
+ if (!Comp) {
3077
+ warnFallback(fallbackName, family);
3078
+ return { default: makeLucideAdapter(fallbackName, true) };
3079
+ }
3080
+ return { default: Comp };
3081
+ });
3082
+ const Wrapped = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3083
+ React9__default.default.Suspense,
3084
+ {
3085
+ fallback: /* @__PURE__ */ jsxRuntime.jsx(
3086
+ "span",
3087
+ {
3088
+ "aria-hidden": true,
3089
+ className: props.className,
3090
+ style: { display: "inline-block", ...props.style }
3091
+ }
3092
+ ),
3093
+ children: /* @__PURE__ */ jsxRuntime.jsx(Lazy, { ...props })
3094
+ }
3095
+ );
3096
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
3097
+ return Wrapped;
3098
+ }
3069
3099
  var lucideAliases = {
3070
3100
  close: LucideIcons2__namespace.X,
3071
3101
  trash: LucideIcons2__namespace.Trash2,
@@ -3245,23 +3275,30 @@ var phosphorAliases = {
3245
3275
  tree: "Tree",
3246
3276
  network: "Network"
3247
3277
  };
3248
- function resolvePhosphor(name, weight) {
3278
+ function resolvePhosphor(name, weight, family) {
3249
3279
  const target = phosphorAliases[name] ?? kebabToPascal(name);
3250
- const map = PhosphorIcons__namespace;
3251
- const PhosphorComp = map[target];
3252
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
3253
- const Component = PhosphorComp;
3254
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3255
- Component,
3256
- {
3257
- weight,
3258
- className: props.className,
3259
- style: props.style,
3260
- size: props.size ?? "1em"
3261
- }
3280
+ return lazyFamilyIcon(
3281
+ "phosphor",
3282
+ () => import('@phosphor-icons/react'),
3283
+ (lib) => {
3284
+ const PhosphorComp = lib[target];
3285
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
3286
+ const Component = PhosphorComp;
3287
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3288
+ Component,
3289
+ {
3290
+ weight,
3291
+ className: props.className,
3292
+ style: props.style,
3293
+ size: props.size ?? "1em"
3294
+ }
3295
+ );
3296
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
3297
+ return Adapter;
3298
+ },
3299
+ name,
3300
+ family
3262
3301
  );
3263
- Adapter.displayName = `Phosphor.${target}.${weight}`;
3264
- return Adapter;
3265
3302
  }
3266
3303
  var tablerAliases = {
3267
3304
  // lucide name → tabler suffix (after the `Icon` prefix)
@@ -3418,24 +3455,31 @@ var tablerAliases = {
3418
3455
  tree: "Hierarchy",
3419
3456
  network: "Network"
3420
3457
  };
3421
- function resolveTabler(name) {
3458
+ function resolveTabler(name, family) {
3422
3459
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
3423
3460
  const target = `Icon${suffix}`;
3424
- const map = TablerIcons__namespace;
3425
- const TablerComp = map[target];
3426
- if (!TablerComp || typeof TablerComp !== "object") return null;
3427
- const Component = TablerComp;
3428
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3429
- Component,
3430
- {
3431
- stroke: props.strokeWidth ?? 1.5,
3432
- className: props.className,
3433
- style: props.style,
3434
- size: props.size ?? 24
3435
- }
3461
+ return lazyFamilyIcon(
3462
+ "tabler",
3463
+ () => import('@tabler/icons-react'),
3464
+ (lib) => {
3465
+ const TablerComp = lib[target];
3466
+ if (!TablerComp || typeof TablerComp !== "object") return null;
3467
+ const Component = TablerComp;
3468
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3469
+ Component,
3470
+ {
3471
+ stroke: props.strokeWidth ?? 1.5,
3472
+ className: props.className,
3473
+ style: props.style,
3474
+ size: props.size ?? 24
3475
+ }
3476
+ );
3477
+ Adapter.displayName = `Tabler.${target}`;
3478
+ return Adapter;
3479
+ },
3480
+ name,
3481
+ family
3436
3482
  );
3437
- Adapter.displayName = `Tabler.${target}`;
3438
- return Adapter;
3439
3483
  }
3440
3484
  var faAliases = {
3441
3485
  // lucide name → fa-solid suffix (after the `Fa` prefix).
@@ -3596,23 +3640,30 @@ var faAliases = {
3596
3640
  tree: "Sitemap",
3597
3641
  network: "NetworkWired"
3598
3642
  };
3599
- function resolveFa(name) {
3643
+ function resolveFa(name, family) {
3600
3644
  const suffix = faAliases[name] ?? kebabToPascal(name);
3601
3645
  const target = `Fa${suffix}`;
3602
- const map = FaIcons__namespace;
3603
- const FaComp = map[target];
3604
- if (!FaComp || typeof FaComp !== "function") return null;
3605
- const Component = FaComp;
3606
- const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3607
- Component,
3608
- {
3609
- className: props.className,
3610
- style: props.style,
3611
- size: props.size ?? "1em"
3612
- }
3646
+ return lazyFamilyIcon(
3647
+ "fa",
3648
+ () => import('react-icons/fa'),
3649
+ (lib) => {
3650
+ const FaComp = lib[target];
3651
+ if (!FaComp || typeof FaComp !== "function") return null;
3652
+ const Component = FaComp;
3653
+ const Adapter = (props) => /* @__PURE__ */ jsxRuntime.jsx(
3654
+ Component,
3655
+ {
3656
+ className: props.className,
3657
+ style: props.style,
3658
+ size: props.size ?? "1em"
3659
+ }
3660
+ );
3661
+ Adapter.displayName = `Fa.${target}`;
3662
+ return Adapter;
3663
+ },
3664
+ name,
3665
+ family
3613
3666
  );
3614
- Adapter.displayName = `Fa.${target}`;
3615
- return Adapter;
3616
3667
  }
3617
3668
  var warned = /* @__PURE__ */ new Set();
3618
3669
  function warnFallback(name, family) {
@@ -3647,36 +3698,19 @@ function resolveIconForFamily(name, family) {
3647
3698
  switch (family) {
3648
3699
  case "lucide":
3649
3700
  return makeLucideAdapter(name, false);
3650
- case "phosphor-outline": {
3651
- const p = resolvePhosphor(name, "regular");
3652
- if (p) return p;
3653
- warnFallback(name, family);
3654
- return makeLucideAdapter(name, true);
3655
- }
3656
- case "phosphor-fill": {
3657
- const p = resolvePhosphor(name, "fill");
3658
- if (p) return p;
3659
- warnFallback(name, family);
3660
- return makeLucideAdapter(name, true);
3661
- }
3662
- case "phosphor-duotone": {
3663
- const p = resolvePhosphor(name, "duotone");
3664
- if (p) return p;
3665
- warnFallback(name, family);
3666
- return makeLucideAdapter(name, true);
3667
- }
3668
- case "tabler": {
3669
- const t = resolveTabler(name);
3670
- if (t) return t;
3671
- warnFallback(name, family);
3672
- return makeLucideAdapter(name, true);
3673
- }
3674
- case "fa-solid": {
3675
- const f3 = resolveFa(name);
3676
- if (f3) return f3;
3677
- warnFallback(name, family);
3678
- return makeLucideAdapter(name, true);
3679
- }
3701
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
3702
+ // dynamic-imports the library on first render and falls back to lucide
3703
+ // internally when the family lacks the icon (see lazyFamilyIcon).
3704
+ case "phosphor-outline":
3705
+ return resolvePhosphor(name, "regular", family);
3706
+ case "phosphor-fill":
3707
+ return resolvePhosphor(name, "fill", family);
3708
+ case "phosphor-duotone":
3709
+ return resolvePhosphor(name, "duotone", family);
3710
+ case "tabler":
3711
+ return resolveTabler(name, family);
3712
+ case "fa-solid":
3713
+ return resolveFa(name, family);
3680
3714
  }
3681
3715
  }
3682
3716
  var colorTokenClasses = {
@@ -3,9 +3,6 @@ import { createLogger } from '@almadar/logger';
3
3
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
4
4
  import * as LucideIcons2 from 'lucide-react';
5
5
  import { Loader2, X } from 'lucide-react';
6
- import * as PhosphorIcons from '@phosphor-icons/react';
7
- import * as TablerIcons from '@tabler/icons-react';
8
- import * as FaIcons from 'react-icons/fa';
9
6
 
10
7
  // node_modules/clsx/dist/clsx.mjs
11
8
  function r(e) {
@@ -3039,6 +3036,42 @@ function kebabToPascal(name) {
3039
3036
  return part.charAt(0).toUpperCase() + part.slice(1);
3040
3037
  }).join("");
3041
3038
  }
3039
+ var libPromises = /* @__PURE__ */ new Map();
3040
+ function loadLib(key, importer) {
3041
+ let p = libPromises.get(key);
3042
+ if (!p) {
3043
+ p = importer().then((m) => m);
3044
+ libPromises.set(key, p);
3045
+ }
3046
+ return p;
3047
+ }
3048
+ function lazyFamilyIcon(libKey, importer, pick, fallbackName, family) {
3049
+ const Lazy = React9.lazy(async () => {
3050
+ const lib = await loadLib(libKey, importer);
3051
+ const Comp = pick(lib);
3052
+ if (!Comp) {
3053
+ warnFallback(fallbackName, family);
3054
+ return { default: makeLucideAdapter(fallbackName, true) };
3055
+ }
3056
+ return { default: Comp };
3057
+ });
3058
+ const Wrapped = (props) => /* @__PURE__ */ jsx(
3059
+ React9.Suspense,
3060
+ {
3061
+ fallback: /* @__PURE__ */ jsx(
3062
+ "span",
3063
+ {
3064
+ "aria-hidden": true,
3065
+ className: props.className,
3066
+ style: { display: "inline-block", ...props.style }
3067
+ }
3068
+ ),
3069
+ children: /* @__PURE__ */ jsx(Lazy, { ...props })
3070
+ }
3071
+ );
3072
+ Wrapped.displayName = `Lazy.${libKey}.${fallbackName}`;
3073
+ return Wrapped;
3074
+ }
3042
3075
  var lucideAliases = {
3043
3076
  close: LucideIcons2.X,
3044
3077
  trash: LucideIcons2.Trash2,
@@ -3218,23 +3251,30 @@ var phosphorAliases = {
3218
3251
  tree: "Tree",
3219
3252
  network: "Network"
3220
3253
  };
3221
- function resolvePhosphor(name, weight) {
3254
+ function resolvePhosphor(name, weight, family) {
3222
3255
  const target = phosphorAliases[name] ?? kebabToPascal(name);
3223
- const map = PhosphorIcons;
3224
- const PhosphorComp = map[target];
3225
- if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
3226
- const Component = PhosphorComp;
3227
- const Adapter = (props) => /* @__PURE__ */ jsx(
3228
- Component,
3229
- {
3230
- weight,
3231
- className: props.className,
3232
- style: props.style,
3233
- size: props.size ?? "1em"
3234
- }
3256
+ return lazyFamilyIcon(
3257
+ "phosphor",
3258
+ () => import('@phosphor-icons/react'),
3259
+ (lib) => {
3260
+ const PhosphorComp = lib[target];
3261
+ if (!PhosphorComp || typeof PhosphorComp !== "object") return null;
3262
+ const Component = PhosphorComp;
3263
+ const Adapter = (props) => /* @__PURE__ */ jsx(
3264
+ Component,
3265
+ {
3266
+ weight,
3267
+ className: props.className,
3268
+ style: props.style,
3269
+ size: props.size ?? "1em"
3270
+ }
3271
+ );
3272
+ Adapter.displayName = `Phosphor.${target}.${weight}`;
3273
+ return Adapter;
3274
+ },
3275
+ name,
3276
+ family
3235
3277
  );
3236
- Adapter.displayName = `Phosphor.${target}.${weight}`;
3237
- return Adapter;
3238
3278
  }
3239
3279
  var tablerAliases = {
3240
3280
  // lucide name → tabler suffix (after the `Icon` prefix)
@@ -3391,24 +3431,31 @@ var tablerAliases = {
3391
3431
  tree: "Hierarchy",
3392
3432
  network: "Network"
3393
3433
  };
3394
- function resolveTabler(name) {
3434
+ function resolveTabler(name, family) {
3395
3435
  const suffix = tablerAliases[name] ?? kebabToPascal(name);
3396
3436
  const target = `Icon${suffix}`;
3397
- const map = TablerIcons;
3398
- const TablerComp = map[target];
3399
- if (!TablerComp || typeof TablerComp !== "object") return null;
3400
- const Component = TablerComp;
3401
- const Adapter = (props) => /* @__PURE__ */ jsx(
3402
- Component,
3403
- {
3404
- stroke: props.strokeWidth ?? 1.5,
3405
- className: props.className,
3406
- style: props.style,
3407
- size: props.size ?? 24
3408
- }
3437
+ return lazyFamilyIcon(
3438
+ "tabler",
3439
+ () => import('@tabler/icons-react'),
3440
+ (lib) => {
3441
+ const TablerComp = lib[target];
3442
+ if (!TablerComp || typeof TablerComp !== "object") return null;
3443
+ const Component = TablerComp;
3444
+ const Adapter = (props) => /* @__PURE__ */ jsx(
3445
+ Component,
3446
+ {
3447
+ stroke: props.strokeWidth ?? 1.5,
3448
+ className: props.className,
3449
+ style: props.style,
3450
+ size: props.size ?? 24
3451
+ }
3452
+ );
3453
+ Adapter.displayName = `Tabler.${target}`;
3454
+ return Adapter;
3455
+ },
3456
+ name,
3457
+ family
3409
3458
  );
3410
- Adapter.displayName = `Tabler.${target}`;
3411
- return Adapter;
3412
3459
  }
3413
3460
  var faAliases = {
3414
3461
  // lucide name → fa-solid suffix (after the `Fa` prefix).
@@ -3569,23 +3616,30 @@ var faAliases = {
3569
3616
  tree: "Sitemap",
3570
3617
  network: "NetworkWired"
3571
3618
  };
3572
- function resolveFa(name) {
3619
+ function resolveFa(name, family) {
3573
3620
  const suffix = faAliases[name] ?? kebabToPascal(name);
3574
3621
  const target = `Fa${suffix}`;
3575
- const map = FaIcons;
3576
- const FaComp = map[target];
3577
- if (!FaComp || typeof FaComp !== "function") return null;
3578
- const Component = FaComp;
3579
- const Adapter = (props) => /* @__PURE__ */ jsx(
3580
- Component,
3581
- {
3582
- className: props.className,
3583
- style: props.style,
3584
- size: props.size ?? "1em"
3585
- }
3622
+ return lazyFamilyIcon(
3623
+ "fa",
3624
+ () => import('react-icons/fa'),
3625
+ (lib) => {
3626
+ const FaComp = lib[target];
3627
+ if (!FaComp || typeof FaComp !== "function") return null;
3628
+ const Component = FaComp;
3629
+ const Adapter = (props) => /* @__PURE__ */ jsx(
3630
+ Component,
3631
+ {
3632
+ className: props.className,
3633
+ style: props.style,
3634
+ size: props.size ?? "1em"
3635
+ }
3636
+ );
3637
+ Adapter.displayName = `Fa.${target}`;
3638
+ return Adapter;
3639
+ },
3640
+ name,
3641
+ family
3586
3642
  );
3587
- Adapter.displayName = `Fa.${target}`;
3588
- return Adapter;
3589
3643
  }
3590
3644
  var warned = /* @__PURE__ */ new Set();
3591
3645
  function warnFallback(name, family) {
@@ -3620,36 +3674,19 @@ function resolveIconForFamily(name, family) {
3620
3674
  switch (family) {
3621
3675
  case "lucide":
3622
3676
  return makeLucideAdapter(name, false);
3623
- case "phosphor-outline": {
3624
- const p = resolvePhosphor(name, "regular");
3625
- if (p) return p;
3626
- warnFallback(name, family);
3627
- return makeLucideAdapter(name, true);
3628
- }
3629
- case "phosphor-fill": {
3630
- const p = resolvePhosphor(name, "fill");
3631
- if (p) return p;
3632
- warnFallback(name, family);
3633
- return makeLucideAdapter(name, true);
3634
- }
3635
- case "phosphor-duotone": {
3636
- const p = resolvePhosphor(name, "duotone");
3637
- if (p) return p;
3638
- warnFallback(name, family);
3639
- return makeLucideAdapter(name, true);
3640
- }
3641
- case "tabler": {
3642
- const t = resolveTabler(name);
3643
- if (t) return t;
3644
- warnFallback(name, family);
3645
- return makeLucideAdapter(name, true);
3646
- }
3647
- case "fa-solid": {
3648
- const f3 = resolveFa(name);
3649
- if (f3) return f3;
3650
- warnFallback(name, family);
3651
- return makeLucideAdapter(name, true);
3652
- }
3677
+ // Non-lucide families resolve to a lazy, Suspense-wrapped component that
3678
+ // dynamic-imports the library on first render and falls back to lucide
3679
+ // internally when the family lacks the icon (see lazyFamilyIcon).
3680
+ case "phosphor-outline":
3681
+ return resolvePhosphor(name, "regular", family);
3682
+ case "phosphor-fill":
3683
+ return resolvePhosphor(name, "fill", family);
3684
+ case "phosphor-duotone":
3685
+ return resolvePhosphor(name, "duotone", family);
3686
+ case "tabler":
3687
+ return resolveTabler(name, family);
3688
+ case "fa-solid":
3689
+ return resolveFa(name, family);
3653
3690
  }
3654
3691
  }
3655
3692
  var colorTokenClasses = {