@almadar/ui 5.16.4 → 5.17.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.
- package/dist/avl/index.cjs +191 -153
- package/dist/avl/index.js +191 -153
- package/dist/components/atoms/Avatar.d.ts +4 -2
- package/dist/components/atoms/ConditionalWrapper.d.ts +2 -2
- package/dist/components/atoms/Icon.d.ts +6 -2
- package/dist/components/atoms/Input.d.ts +3 -2
- package/dist/components/atoms/LawReferenceTooltip.d.ts +2 -2
- package/dist/components/atoms/game/MiniMap.d.ts +15 -17
- package/dist/components/atoms/index.d.ts +1 -0
- package/dist/components/atoms/types.d.ts +40 -0
- package/dist/components/index.cjs +191 -153
- package/dist/components/index.js +191 -153
- package/dist/components/molecules/CTABanner.d.ts +3 -8
- package/dist/components/molecules/CalendarGrid.d.ts +2 -2
- package/dist/components/molecules/CommunityLinks.d.ts +15 -12
- package/dist/components/molecules/DataGrid.d.ts +2 -1
- package/dist/components/molecules/DataList.d.ts +12 -11
- package/dist/components/molecules/GraphView.d.ts +2 -2
- package/dist/components/molecules/HeroSection.d.ts +4 -12
- package/dist/components/molecules/MapView.d.ts +2 -2
- package/dist/components/molecules/MarketingFooter.d.ts +6 -5
- package/dist/components/molecules/Meter.d.ts +2 -1
- package/dist/components/molecules/OptionConstraintGroup.d.ts +5 -3
- package/dist/components/molecules/PricingCard.d.ts +2 -4
- package/dist/components/molecules/QrScanner.d.ts +2 -2
- package/dist/components/molecules/RepeatableFormSection.d.ts +2 -2
- package/dist/components/molecules/ShowcaseCard.d.ts +2 -4
- package/dist/components/molecules/SplitSection.d.ts +2 -4
- package/dist/components/molecules/StatDisplay.d.ts +2 -1
- package/dist/components/molecules/StatsGrid.d.ts +5 -4
- package/dist/components/molecules/TableView.d.ts +2 -1
- package/dist/components/molecules/ViolationAlert.d.ts +2 -2
- package/dist/components/molecules/game/CraftingRecipe.d.ts +11 -7
- package/dist/components/molecules/game/DialogueBox.d.ts +2 -2
- package/dist/components/molecules/game/HealthPanel.d.ts +6 -5
- package/dist/components/molecules/game/IsometricCanvas.d.ts +9 -13
- package/dist/components/organisms/Chart.d.ts +2 -1
- package/dist/components/organisms/CodeViewer.d.ts +8 -6
- package/dist/components/organisms/ComponentPatterns.d.ts +2 -1
- package/dist/components/organisms/ConfirmDialog.d.ts +2 -1
- package/dist/components/organisms/CustomPattern.d.ts +2 -1
- package/dist/components/organisms/DataTable.d.ts +6 -5
- package/dist/components/organisms/DetailPanel.d.ts +5 -4
- package/dist/components/organisms/DocumentViewer.d.ts +9 -7
- package/dist/components/organisms/DrawerSlot.d.ts +2 -1
- package/dist/components/organisms/Form.d.ts +5 -4
- package/dist/components/organisms/GraphCanvas.d.ts +2 -1
- package/dist/components/organisms/Header.d.ts +17 -14
- package/dist/components/organisms/JazariStateMachine.d.ts +2 -1
- package/dist/components/organisms/LayoutPatterns.d.ts +4 -3
- package/dist/components/organisms/List.d.ts +2 -2
- package/dist/components/organisms/Meter.d.ts +2 -1
- package/dist/components/organisms/ModalSlot.d.ts +2 -1
- package/dist/components/organisms/Navigation.d.ts +2 -1
- package/dist/components/organisms/OrbitalVisualization.d.ts +2 -1
- package/dist/components/organisms/PageHeader.d.ts +7 -5
- package/dist/components/organisms/Section.d.ts +2 -1
- package/dist/components/organisms/Sidebar.d.ts +2 -1
- package/dist/components/organisms/SignaturePad.d.ts +2 -1
- package/dist/components/organisms/Split.d.ts +2 -1
- package/dist/components/organisms/StateMachineView.d.ts +8 -4
- package/dist/components/organisms/Timeline.d.ts +2 -1
- package/dist/components/organisms/ToastSlot.d.ts +2 -1
- package/dist/components/organisms/UISlotRenderer.d.ts +4 -3
- package/dist/components/organisms/WizardContainer.d.ts +2 -1
- package/dist/components/organisms/book/types.d.ts +2 -2
- package/dist/components/organisms/game/BattleBoard.d.ts +4 -4
- package/dist/components/organisms/game/CanvasEffect.d.ts +2 -1
- package/dist/components/organisms/game/CastleBoard.d.ts +6 -5
- package/dist/components/organisms/game/GameAudioProvider.d.ts +2 -1
- package/dist/components/organisms/game/GameAudioToggle.d.ts +2 -1
- package/dist/components/organisms/game/TraitSlot.d.ts +4 -3
- package/dist/components/organisms/game/TraitStateViewer.d.ts +6 -5
- package/dist/components/organisms/game/UncontrolledBattleBoard.d.ts +9 -4
- package/dist/components/organisms/game/WorldMapBoard.d.ts +11 -9
- package/dist/components/organisms/game/physics-sim/SimulationControls.d.ts +8 -7
- package/dist/components/organisms/game/puzzles/builder/BuilderBoard.d.ts +3 -3
- package/dist/components/organisms/game/puzzles/classifier/ClassifierBoard.d.ts +3 -3
- package/dist/components/organisms/game/puzzles/debugger/DebuggerBoard.d.ts +3 -3
- package/dist/components/organisms/game/puzzles/event-handler/EventHandlerBoard.d.ts +7 -4
- package/dist/components/organisms/game/puzzles/event-handler/ObjectRulePanel.d.ts +2 -2
- package/dist/components/organisms/game/puzzles/event-handler/RuleEditor.d.ts +7 -9
- package/dist/components/organisms/game/puzzles/negotiator/NegotiatorBoard.d.ts +3 -3
- package/dist/components/organisms/game/puzzles/sequencer/SequencerBoard.d.ts +5 -4
- package/dist/components/organisms/game/puzzles/simulator/SimulatorBoard.d.ts +3 -3
- package/dist/components/organisms/game/puzzles/state-architect/StateArchitectBoard.d.ts +5 -4
- package/dist/components/organisms/game/puzzles/state-architect/StateNode.d.ts +2 -4
- package/dist/components/organisms/game/puzzles/state-architect/TransitionArrow.d.ts +3 -8
- package/dist/components/organisms/game/types/isometric.d.ts +4 -4
- package/dist/components/organisms/index.d.ts +1 -1
- package/dist/components/organisms/types.d.ts +3 -1
- package/dist/components/templates/DashboardLayout.d.ts +6 -5
- package/dist/components/templates/GameTemplate.d.ts +7 -6
- package/dist/components/templates/GenericAppTemplate.d.ts +1 -7
- package/dist/components/templates/types.d.ts +14 -6
- package/dist/docs/index.cjs +60 -22
- package/dist/docs/index.d.cts +9 -4
- package/dist/docs/index.js +58 -20
- package/dist/marketing/index.cjs +61 -23
- package/dist/marketing/index.d.cts +54 -55
- package/dist/marketing/index.js +58 -20
- package/dist/providers/index.cjs +191 -153
- package/dist/providers/index.js +191 -153
- package/dist/runtime/index.cjs +191 -153
- package/dist/runtime/index.js +191 -153
- package/package.json +1 -1
|
@@ -11,6 +11,12 @@ interface GameEntity {
|
|
|
11
11
|
id: string;
|
|
12
12
|
title?: string;
|
|
13
13
|
}
|
|
14
|
+
export interface GameControls {
|
|
15
|
+
onPlay?: () => void;
|
|
16
|
+
onPause?: () => void;
|
|
17
|
+
onReset?: () => void;
|
|
18
|
+
isPlaying?: boolean;
|
|
19
|
+
}
|
|
14
20
|
export interface GameTemplateProps extends TemplateProps<GameEntity> {
|
|
15
21
|
/** Title of the game */
|
|
16
22
|
title?: string;
|
|
@@ -23,12 +29,7 @@ export interface GameTemplateProps extends TemplateProps<GameEntity> {
|
|
|
23
29
|
/** Whether the debug panel is visible */
|
|
24
30
|
showDebugPanel?: boolean;
|
|
25
31
|
/** Game controls */
|
|
26
|
-
controls?:
|
|
27
|
-
onPlay?: () => void;
|
|
28
|
-
onPause?: () => void;
|
|
29
|
-
onReset?: () => void;
|
|
30
|
-
isPlaying?: boolean;
|
|
31
|
-
};
|
|
32
|
+
controls?: GameControls;
|
|
32
33
|
/** Additional class name */
|
|
33
34
|
className?: string;
|
|
34
35
|
}
|
|
@@ -7,12 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import React from "react";
|
|
9
9
|
import type { TemplateProps } from "./types";
|
|
10
|
-
interface
|
|
11
|
-
id: string;
|
|
12
|
-
title?: string;
|
|
13
|
-
subtitle?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface GenericAppTemplateProps extends TemplateProps<GenericAppEntity> {
|
|
10
|
+
export interface GenericAppTemplateProps extends TemplateProps {
|
|
16
11
|
/** Page title */
|
|
17
12
|
title: string;
|
|
18
13
|
/** Subtitle or description */
|
|
@@ -27,4 +22,3 @@ export interface GenericAppTemplateProps extends TemplateProps<GenericAppEntity>
|
|
|
27
22
|
className?: string;
|
|
28
23
|
}
|
|
29
24
|
export declare const GenericAppTemplate: React.FC<GenericAppTemplateProps>;
|
|
30
|
-
export {};
|
|
@@ -9,19 +9,27 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @see docs/Almadar_Templates.md
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
import type { EntityRow } from "@almadar/core";
|
|
13
|
+
/** Base props for all templates — enforces entity-only data flow.
|
|
14
|
+
*
|
|
15
|
+
* The constraint is `{ id?: string }` (optional id) so the canonical
|
|
16
|
+
* `EntityRow` from `@almadar/core` — whose `id` is optional — satisfies it. */
|
|
13
17
|
export interface TemplateProps<E extends {
|
|
14
|
-
id
|
|
15
|
-
} = {
|
|
16
|
-
id: string;
|
|
17
|
-
}> {
|
|
18
|
+
id?: string;
|
|
19
|
+
} = EntityRow> {
|
|
18
20
|
/**
|
|
19
21
|
* Entity data — single object or array (pre-resolved by the compiler
|
|
20
22
|
* from `@payload.data` on the calling trait). The legacy `string`
|
|
21
23
|
* entity-name branch was removed in V2 Phase 6 along with the
|
|
22
24
|
* EntityStore resolver.
|
|
25
|
+
*
|
|
26
|
+
* The inlet always also accepts the canonical `EntityRow` (and arrays of
|
|
27
|
+
* it), because the compiler binds the generic data-store row regardless of
|
|
28
|
+
* a template's curated read-shape `E`. A template that reads specific
|
|
29
|
+
* fields narrows `entity` to `E` internally (a valid union-narrow) — no
|
|
30
|
+
* `as unknown` cast and no per-template inlet widening required.
|
|
23
31
|
*/
|
|
24
|
-
entity?: E | readonly E[];
|
|
32
|
+
entity?: E | EntityRow | readonly (E | EntityRow)[];
|
|
25
33
|
/** External styling override */
|
|
26
34
|
className?: string;
|
|
27
35
|
}
|
package/dist/docs/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React7 = require('react');
|
|
4
4
|
var logger = require('@almadar/logger');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var LucideIcons2 = require('lucide-react');
|
|
7
7
|
var PhosphorIcons = require('@phosphor-icons/react');
|
|
8
8
|
var TablerIcons = require('@tabler/icons-react');
|
|
9
9
|
var FaIcons = require('react-icons/fa');
|
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var React7__default = /*#__PURE__*/_interopDefault(React7);
|
|
32
|
-
var
|
|
32
|
+
var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
|
|
33
33
|
var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
|
|
34
34
|
var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
|
|
35
35
|
var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
|
|
@@ -3067,26 +3067,26 @@ function kebabToPascal(name) {
|
|
|
3067
3067
|
}).join("");
|
|
3068
3068
|
}
|
|
3069
3069
|
var lucideAliases = {
|
|
3070
|
-
close:
|
|
3071
|
-
trash:
|
|
3072
|
-
loader:
|
|
3073
|
-
stop:
|
|
3074
|
-
volume:
|
|
3075
|
-
"volume-off":
|
|
3076
|
-
refresh:
|
|
3077
|
-
share:
|
|
3078
|
-
"sort-asc":
|
|
3079
|
-
"sort-desc":
|
|
3070
|
+
close: LucideIcons2__namespace.X,
|
|
3071
|
+
trash: LucideIcons2__namespace.Trash2,
|
|
3072
|
+
loader: LucideIcons2__namespace.Loader2,
|
|
3073
|
+
stop: LucideIcons2__namespace.Square,
|
|
3074
|
+
volume: LucideIcons2__namespace.Volume2,
|
|
3075
|
+
"volume-off": LucideIcons2__namespace.VolumeX,
|
|
3076
|
+
refresh: LucideIcons2__namespace.RefreshCw,
|
|
3077
|
+
share: LucideIcons2__namespace.Share2,
|
|
3078
|
+
"sort-asc": LucideIcons2__namespace.ArrowUpNarrowWide,
|
|
3079
|
+
"sort-desc": LucideIcons2__namespace.ArrowDownNarrowWide
|
|
3080
3080
|
};
|
|
3081
3081
|
function resolveLucide(name) {
|
|
3082
3082
|
if (lucideAliases[name]) return lucideAliases[name];
|
|
3083
3083
|
const pascal = kebabToPascal(name);
|
|
3084
|
-
const lucideMap =
|
|
3084
|
+
const lucideMap = LucideIcons2__namespace;
|
|
3085
3085
|
const direct = lucideMap[pascal];
|
|
3086
3086
|
if (direct && typeof direct === "object") return direct;
|
|
3087
3087
|
const asIs = lucideMap[name];
|
|
3088
3088
|
if (asIs && typeof asIs === "object") return asIs;
|
|
3089
|
-
return
|
|
3089
|
+
return LucideIcons2__namespace.HelpCircle;
|
|
3090
3090
|
}
|
|
3091
3091
|
var phosphorAliases = {
|
|
3092
3092
|
// lucide name → phosphor PascalCase name
|
|
@@ -3679,6 +3679,41 @@ function resolveIconForFamily(name, family) {
|
|
|
3679
3679
|
}
|
|
3680
3680
|
}
|
|
3681
3681
|
}
|
|
3682
|
+
var iconAliases = {
|
|
3683
|
+
"close": LucideIcons2__namespace.X,
|
|
3684
|
+
"trash": LucideIcons2__namespace.Trash2,
|
|
3685
|
+
"loader": LucideIcons2__namespace.Loader2,
|
|
3686
|
+
"stop": LucideIcons2__namespace.Square,
|
|
3687
|
+
"volume": LucideIcons2__namespace.Volume2,
|
|
3688
|
+
"volume-off": LucideIcons2__namespace.VolumeX,
|
|
3689
|
+
"refresh": LucideIcons2__namespace.RefreshCw,
|
|
3690
|
+
"share": LucideIcons2__namespace.Share2,
|
|
3691
|
+
"sort-asc": LucideIcons2__namespace.ArrowUpNarrowWide,
|
|
3692
|
+
"sort-desc": LucideIcons2__namespace.ArrowDownNarrowWide
|
|
3693
|
+
};
|
|
3694
|
+
function kebabToPascal2(name) {
|
|
3695
|
+
return name.split("-").map((part) => {
|
|
3696
|
+
if (/^\d+$/.test(part)) return part;
|
|
3697
|
+
return part.charAt(0).toUpperCase() + part.slice(1);
|
|
3698
|
+
}).join("");
|
|
3699
|
+
}
|
|
3700
|
+
var resolvedCache = /* @__PURE__ */ new Map();
|
|
3701
|
+
function resolveIcon(name) {
|
|
3702
|
+
const cached = resolvedCache.get(name);
|
|
3703
|
+
if (cached) return cached;
|
|
3704
|
+
const resolved = doResolve(name);
|
|
3705
|
+
resolvedCache.set(name, resolved);
|
|
3706
|
+
return resolved;
|
|
3707
|
+
}
|
|
3708
|
+
function doResolve(name) {
|
|
3709
|
+
if (iconAliases[name]) return iconAliases[name];
|
|
3710
|
+
const pascalName = kebabToPascal2(name);
|
|
3711
|
+
const directLookup = LucideIcons2__namespace[pascalName];
|
|
3712
|
+
if (directLookup && typeof directLookup === "object") return directLookup;
|
|
3713
|
+
const asIs = LucideIcons2__namespace[name];
|
|
3714
|
+
if (asIs && typeof asIs === "object") return asIs;
|
|
3715
|
+
return LucideIcons2__namespace.HelpCircle;
|
|
3716
|
+
}
|
|
3682
3717
|
var sizeClasses = {
|
|
3683
3718
|
xs: "w-3 h-3",
|
|
3684
3719
|
sm: "w-4 h-4",
|
|
@@ -3701,11 +3736,13 @@ var Icon = ({
|
|
|
3701
3736
|
strokeWidth,
|
|
3702
3737
|
style
|
|
3703
3738
|
}) => {
|
|
3739
|
+
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
3740
|
+
const effectiveName = typeof icon === "string" ? icon : name;
|
|
3704
3741
|
const family = useIconFamily();
|
|
3705
3742
|
const RenderedComponent = React7__default.default.useMemo(() => {
|
|
3706
|
-
if (
|
|
3707
|
-
return
|
|
3708
|
-
}, [
|
|
3743
|
+
if (directIcon) return null;
|
|
3744
|
+
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
3745
|
+
}, [directIcon, effectiveName, family]);
|
|
3709
3746
|
const effectiveStrokeWidth = strokeWidth ?? void 0;
|
|
3710
3747
|
const inlineStyle = {
|
|
3711
3748
|
...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
|
|
@@ -3717,8 +3754,8 @@ var Icon = ({
|
|
|
3717
3754
|
color ? color : "text-current",
|
|
3718
3755
|
className
|
|
3719
3756
|
);
|
|
3720
|
-
if (
|
|
3721
|
-
const Direct =
|
|
3757
|
+
if (directIcon) {
|
|
3758
|
+
const Direct = directIcon;
|
|
3722
3759
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3723
3760
|
Direct,
|
|
3724
3761
|
{
|
|
@@ -3738,7 +3775,7 @@ var Icon = ({
|
|
|
3738
3775
|
}
|
|
3739
3776
|
);
|
|
3740
3777
|
}
|
|
3741
|
-
const Fallback =
|
|
3778
|
+
const Fallback = LucideIcons2__namespace.HelpCircle;
|
|
3742
3779
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3743
3780
|
Fallback,
|
|
3744
3781
|
{
|
|
@@ -3877,7 +3914,7 @@ var Button = React7__default.default.forwardRef(
|
|
|
3877
3914
|
...props,
|
|
3878
3915
|
"data-testid": props["data-testid"] ?? (action ? `action-${action}` : void 0),
|
|
3879
3916
|
children: [
|
|
3880
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LucideIcons2.Loader2, { className: "h-icon-default w-icon-default animate-spin" }) : resolvedLeftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: resolvedLeftIcon }),
|
|
3881
3918
|
children || label,
|
|
3882
3919
|
resolvedRightIcon && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: resolvedRightIcon })
|
|
3883
3920
|
]
|
|
@@ -4083,7 +4120,7 @@ var Input = React7__default.default.forwardRef(
|
|
|
4083
4120
|
error,
|
|
4084
4121
|
leftIcon,
|
|
4085
4122
|
rightIcon,
|
|
4086
|
-
icon:
|
|
4123
|
+
icon: iconProp,
|
|
4087
4124
|
clearable,
|
|
4088
4125
|
onClear,
|
|
4089
4126
|
value,
|
|
@@ -4093,6 +4130,7 @@ var Input = React7__default.default.forwardRef(
|
|
|
4093
4130
|
...props
|
|
4094
4131
|
}, ref) => {
|
|
4095
4132
|
const type = inputType || htmlType || "text";
|
|
4133
|
+
const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
|
|
4096
4134
|
const resolvedLeftIcon = leftIcon || IconComponent && /* @__PURE__ */ jsxRuntime.jsx(IconComponent, { className: "h-icon-default w-icon-default" });
|
|
4097
4135
|
const showClearButton = clearable && value && String(value).length > 0;
|
|
4098
4136
|
const isMultiline = type === "textarea";
|
package/dist/docs/index.d.cts
CHANGED
|
@@ -212,8 +212,12 @@ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAtt
|
|
|
212
212
|
type IconSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
213
213
|
type IconAnimation = 'spin' | 'pulse' | 'none';
|
|
214
214
|
interface IconProps {
|
|
215
|
-
/**
|
|
216
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Lucide icon component (preferred for type-safe usage), OR a canonical
|
|
217
|
+
* kebab-case icon name string — a string is treated exactly like `name` so
|
|
218
|
+
* trait/factory authors can pass an icon by name through the `icon` prop.
|
|
219
|
+
*/
|
|
220
|
+
icon?: LucideIcon | string;
|
|
217
221
|
/** Icon name as string (resolved from iconMap) */
|
|
218
222
|
name?: string;
|
|
219
223
|
/** Size of the icon */
|
|
@@ -305,8 +309,9 @@ interface InputProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
|
305
309
|
error?: string;
|
|
306
310
|
leftIcon?: React.ReactNode;
|
|
307
311
|
rightIcon?: React.ReactNode;
|
|
308
|
-
/** Lucide icon component for left side (convenience prop)
|
|
309
|
-
|
|
312
|
+
/** Lucide icon component for left side (convenience prop), or a canonical
|
|
313
|
+
* kebab-case icon name string (resolved via `resolveIcon`). */
|
|
314
|
+
icon?: LucideIcon | string;
|
|
310
315
|
/** Show clear button when input has value */
|
|
311
316
|
clearable?: boolean;
|
|
312
317
|
/** Callback when clear button is clicked */
|
package/dist/docs/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React7, { createContext, useCallback, useContext, useMemo, useSyncExternalStore, useState, useRef, useEffect } from 'react';
|
|
2
2
|
import { createLogger } from '@almadar/logger';
|
|
3
3
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
-
import * as
|
|
4
|
+
import * as LucideIcons2 from 'lucide-react';
|
|
5
5
|
import { Loader2 } from 'lucide-react';
|
|
6
6
|
import * as PhosphorIcons from '@phosphor-icons/react';
|
|
7
7
|
import * as TablerIcons from '@tabler/icons-react';
|
|
@@ -3040,26 +3040,26 @@ function kebabToPascal(name) {
|
|
|
3040
3040
|
}).join("");
|
|
3041
3041
|
}
|
|
3042
3042
|
var lucideAliases = {
|
|
3043
|
-
close:
|
|
3044
|
-
trash:
|
|
3045
|
-
loader:
|
|
3046
|
-
stop:
|
|
3047
|
-
volume:
|
|
3048
|
-
"volume-off":
|
|
3049
|
-
refresh:
|
|
3050
|
-
share:
|
|
3051
|
-
"sort-asc":
|
|
3052
|
-
"sort-desc":
|
|
3043
|
+
close: LucideIcons2.X,
|
|
3044
|
+
trash: LucideIcons2.Trash2,
|
|
3045
|
+
loader: LucideIcons2.Loader2,
|
|
3046
|
+
stop: LucideIcons2.Square,
|
|
3047
|
+
volume: LucideIcons2.Volume2,
|
|
3048
|
+
"volume-off": LucideIcons2.VolumeX,
|
|
3049
|
+
refresh: LucideIcons2.RefreshCw,
|
|
3050
|
+
share: LucideIcons2.Share2,
|
|
3051
|
+
"sort-asc": LucideIcons2.ArrowUpNarrowWide,
|
|
3052
|
+
"sort-desc": LucideIcons2.ArrowDownNarrowWide
|
|
3053
3053
|
};
|
|
3054
3054
|
function resolveLucide(name) {
|
|
3055
3055
|
if (lucideAliases[name]) return lucideAliases[name];
|
|
3056
3056
|
const pascal = kebabToPascal(name);
|
|
3057
|
-
const lucideMap =
|
|
3057
|
+
const lucideMap = LucideIcons2;
|
|
3058
3058
|
const direct = lucideMap[pascal];
|
|
3059
3059
|
if (direct && typeof direct === "object") return direct;
|
|
3060
3060
|
const asIs = lucideMap[name];
|
|
3061
3061
|
if (asIs && typeof asIs === "object") return asIs;
|
|
3062
|
-
return
|
|
3062
|
+
return LucideIcons2.HelpCircle;
|
|
3063
3063
|
}
|
|
3064
3064
|
var phosphorAliases = {
|
|
3065
3065
|
// lucide name → phosphor PascalCase name
|
|
@@ -3652,6 +3652,41 @@ function resolveIconForFamily(name, family) {
|
|
|
3652
3652
|
}
|
|
3653
3653
|
}
|
|
3654
3654
|
}
|
|
3655
|
+
var iconAliases = {
|
|
3656
|
+
"close": LucideIcons2.X,
|
|
3657
|
+
"trash": LucideIcons2.Trash2,
|
|
3658
|
+
"loader": LucideIcons2.Loader2,
|
|
3659
|
+
"stop": LucideIcons2.Square,
|
|
3660
|
+
"volume": LucideIcons2.Volume2,
|
|
3661
|
+
"volume-off": LucideIcons2.VolumeX,
|
|
3662
|
+
"refresh": LucideIcons2.RefreshCw,
|
|
3663
|
+
"share": LucideIcons2.Share2,
|
|
3664
|
+
"sort-asc": LucideIcons2.ArrowUpNarrowWide,
|
|
3665
|
+
"sort-desc": LucideIcons2.ArrowDownNarrowWide
|
|
3666
|
+
};
|
|
3667
|
+
function kebabToPascal2(name) {
|
|
3668
|
+
return name.split("-").map((part) => {
|
|
3669
|
+
if (/^\d+$/.test(part)) return part;
|
|
3670
|
+
return part.charAt(0).toUpperCase() + part.slice(1);
|
|
3671
|
+
}).join("");
|
|
3672
|
+
}
|
|
3673
|
+
var resolvedCache = /* @__PURE__ */ new Map();
|
|
3674
|
+
function resolveIcon(name) {
|
|
3675
|
+
const cached = resolvedCache.get(name);
|
|
3676
|
+
if (cached) return cached;
|
|
3677
|
+
const resolved = doResolve(name);
|
|
3678
|
+
resolvedCache.set(name, resolved);
|
|
3679
|
+
return resolved;
|
|
3680
|
+
}
|
|
3681
|
+
function doResolve(name) {
|
|
3682
|
+
if (iconAliases[name]) return iconAliases[name];
|
|
3683
|
+
const pascalName = kebabToPascal2(name);
|
|
3684
|
+
const directLookup = LucideIcons2[pascalName];
|
|
3685
|
+
if (directLookup && typeof directLookup === "object") return directLookup;
|
|
3686
|
+
const asIs = LucideIcons2[name];
|
|
3687
|
+
if (asIs && typeof asIs === "object") return asIs;
|
|
3688
|
+
return LucideIcons2.HelpCircle;
|
|
3689
|
+
}
|
|
3655
3690
|
var sizeClasses = {
|
|
3656
3691
|
xs: "w-3 h-3",
|
|
3657
3692
|
sm: "w-4 h-4",
|
|
@@ -3674,11 +3709,13 @@ var Icon = ({
|
|
|
3674
3709
|
strokeWidth,
|
|
3675
3710
|
style
|
|
3676
3711
|
}) => {
|
|
3712
|
+
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
3713
|
+
const effectiveName = typeof icon === "string" ? icon : name;
|
|
3677
3714
|
const family = useIconFamily();
|
|
3678
3715
|
const RenderedComponent = React7.useMemo(() => {
|
|
3679
|
-
if (
|
|
3680
|
-
return
|
|
3681
|
-
}, [
|
|
3716
|
+
if (directIcon) return null;
|
|
3717
|
+
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
3718
|
+
}, [directIcon, effectiveName, family]);
|
|
3682
3719
|
const effectiveStrokeWidth = strokeWidth ?? void 0;
|
|
3683
3720
|
const inlineStyle = {
|
|
3684
3721
|
...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
|
|
@@ -3690,8 +3727,8 @@ var Icon = ({
|
|
|
3690
3727
|
color ? color : "text-current",
|
|
3691
3728
|
className
|
|
3692
3729
|
);
|
|
3693
|
-
if (
|
|
3694
|
-
const Direct =
|
|
3730
|
+
if (directIcon) {
|
|
3731
|
+
const Direct = directIcon;
|
|
3695
3732
|
return /* @__PURE__ */ jsx(
|
|
3696
3733
|
Direct,
|
|
3697
3734
|
{
|
|
@@ -3711,7 +3748,7 @@ var Icon = ({
|
|
|
3711
3748
|
}
|
|
3712
3749
|
);
|
|
3713
3750
|
}
|
|
3714
|
-
const Fallback =
|
|
3751
|
+
const Fallback = LucideIcons2.HelpCircle;
|
|
3715
3752
|
return /* @__PURE__ */ jsx(
|
|
3716
3753
|
Fallback,
|
|
3717
3754
|
{
|
|
@@ -4056,7 +4093,7 @@ var Input = React7.forwardRef(
|
|
|
4056
4093
|
error,
|
|
4057
4094
|
leftIcon,
|
|
4058
4095
|
rightIcon,
|
|
4059
|
-
icon:
|
|
4096
|
+
icon: iconProp,
|
|
4060
4097
|
clearable,
|
|
4061
4098
|
onClear,
|
|
4062
4099
|
value,
|
|
@@ -4066,6 +4103,7 @@ var Input = React7.forwardRef(
|
|
|
4066
4103
|
...props
|
|
4067
4104
|
}, ref) => {
|
|
4068
4105
|
const type = inputType || htmlType || "text";
|
|
4106
|
+
const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
|
|
4069
4107
|
const resolvedLeftIcon = leftIcon || IconComponent && /* @__PURE__ */ jsx(IconComponent, { className: "h-icon-default w-icon-default" });
|
|
4070
4108
|
const showClearButton = clearable && value && String(value).length > 0;
|
|
4071
4109
|
const isMultiline = type === "textarea";
|
package/dist/marketing/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var React8 = require('react');
|
|
4
4
|
var logger = require('@almadar/logger');
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
-
var
|
|
6
|
+
var LucideIcons2 = require('lucide-react');
|
|
7
7
|
var PhosphorIcons = require('@phosphor-icons/react');
|
|
8
8
|
var TablerIcons = require('@tabler/icons-react');
|
|
9
9
|
var FaIcons = require('react-icons/fa');
|
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
var React8__default = /*#__PURE__*/_interopDefault(React8);
|
|
32
|
-
var
|
|
32
|
+
var LucideIcons2__namespace = /*#__PURE__*/_interopNamespace(LucideIcons2);
|
|
33
33
|
var PhosphorIcons__namespace = /*#__PURE__*/_interopNamespace(PhosphorIcons);
|
|
34
34
|
var TablerIcons__namespace = /*#__PURE__*/_interopNamespace(TablerIcons);
|
|
35
35
|
var FaIcons__namespace = /*#__PURE__*/_interopNamespace(FaIcons);
|
|
@@ -3067,26 +3067,26 @@ function kebabToPascal(name) {
|
|
|
3067
3067
|
}).join("");
|
|
3068
3068
|
}
|
|
3069
3069
|
var lucideAliases = {
|
|
3070
|
-
close:
|
|
3071
|
-
trash:
|
|
3072
|
-
loader:
|
|
3073
|
-
stop:
|
|
3074
|
-
volume:
|
|
3075
|
-
"volume-off":
|
|
3076
|
-
refresh:
|
|
3077
|
-
share:
|
|
3078
|
-
"sort-asc":
|
|
3079
|
-
"sort-desc":
|
|
3070
|
+
close: LucideIcons2__namespace.X,
|
|
3071
|
+
trash: LucideIcons2__namespace.Trash2,
|
|
3072
|
+
loader: LucideIcons2__namespace.Loader2,
|
|
3073
|
+
stop: LucideIcons2__namespace.Square,
|
|
3074
|
+
volume: LucideIcons2__namespace.Volume2,
|
|
3075
|
+
"volume-off": LucideIcons2__namespace.VolumeX,
|
|
3076
|
+
refresh: LucideIcons2__namespace.RefreshCw,
|
|
3077
|
+
share: LucideIcons2__namespace.Share2,
|
|
3078
|
+
"sort-asc": LucideIcons2__namespace.ArrowUpNarrowWide,
|
|
3079
|
+
"sort-desc": LucideIcons2__namespace.ArrowDownNarrowWide
|
|
3080
3080
|
};
|
|
3081
3081
|
function resolveLucide(name) {
|
|
3082
3082
|
if (lucideAliases[name]) return lucideAliases[name];
|
|
3083
3083
|
const pascal = kebabToPascal(name);
|
|
3084
|
-
const lucideMap =
|
|
3084
|
+
const lucideMap = LucideIcons2__namespace;
|
|
3085
3085
|
const direct = lucideMap[pascal];
|
|
3086
3086
|
if (direct && typeof direct === "object") return direct;
|
|
3087
3087
|
const asIs = lucideMap[name];
|
|
3088
3088
|
if (asIs && typeof asIs === "object") return asIs;
|
|
3089
|
-
return
|
|
3089
|
+
return LucideIcons2__namespace.HelpCircle;
|
|
3090
3090
|
}
|
|
3091
3091
|
var phosphorAliases = {
|
|
3092
3092
|
// lucide name → phosphor PascalCase name
|
|
@@ -3679,6 +3679,41 @@ function resolveIconForFamily(name, family) {
|
|
|
3679
3679
|
}
|
|
3680
3680
|
}
|
|
3681
3681
|
}
|
|
3682
|
+
var iconAliases = {
|
|
3683
|
+
"close": LucideIcons2__namespace.X,
|
|
3684
|
+
"trash": LucideIcons2__namespace.Trash2,
|
|
3685
|
+
"loader": LucideIcons2__namespace.Loader2,
|
|
3686
|
+
"stop": LucideIcons2__namespace.Square,
|
|
3687
|
+
"volume": LucideIcons2__namespace.Volume2,
|
|
3688
|
+
"volume-off": LucideIcons2__namespace.VolumeX,
|
|
3689
|
+
"refresh": LucideIcons2__namespace.RefreshCw,
|
|
3690
|
+
"share": LucideIcons2__namespace.Share2,
|
|
3691
|
+
"sort-asc": LucideIcons2__namespace.ArrowUpNarrowWide,
|
|
3692
|
+
"sort-desc": LucideIcons2__namespace.ArrowDownNarrowWide
|
|
3693
|
+
};
|
|
3694
|
+
function kebabToPascal2(name) {
|
|
3695
|
+
return name.split("-").map((part) => {
|
|
3696
|
+
if (/^\d+$/.test(part)) return part;
|
|
3697
|
+
return part.charAt(0).toUpperCase() + part.slice(1);
|
|
3698
|
+
}).join("");
|
|
3699
|
+
}
|
|
3700
|
+
var resolvedCache = /* @__PURE__ */ new Map();
|
|
3701
|
+
function resolveIcon(name) {
|
|
3702
|
+
const cached = resolvedCache.get(name);
|
|
3703
|
+
if (cached) return cached;
|
|
3704
|
+
const resolved = doResolve(name);
|
|
3705
|
+
resolvedCache.set(name, resolved);
|
|
3706
|
+
return resolved;
|
|
3707
|
+
}
|
|
3708
|
+
function doResolve(name) {
|
|
3709
|
+
if (iconAliases[name]) return iconAliases[name];
|
|
3710
|
+
const pascalName = kebabToPascal2(name);
|
|
3711
|
+
const directLookup = LucideIcons2__namespace[pascalName];
|
|
3712
|
+
if (directLookup && typeof directLookup === "object") return directLookup;
|
|
3713
|
+
const asIs = LucideIcons2__namespace[name];
|
|
3714
|
+
if (asIs && typeof asIs === "object") return asIs;
|
|
3715
|
+
return LucideIcons2__namespace.HelpCircle;
|
|
3716
|
+
}
|
|
3682
3717
|
var sizeClasses = {
|
|
3683
3718
|
xs: "w-3 h-3",
|
|
3684
3719
|
sm: "w-4 h-4",
|
|
@@ -3701,11 +3736,13 @@ var Icon = ({
|
|
|
3701
3736
|
strokeWidth,
|
|
3702
3737
|
style
|
|
3703
3738
|
}) => {
|
|
3739
|
+
const directIcon = typeof icon === "string" ? void 0 : icon;
|
|
3740
|
+
const effectiveName = typeof icon === "string" ? icon : name;
|
|
3704
3741
|
const family = useIconFamily();
|
|
3705
3742
|
const RenderedComponent = React8__default.default.useMemo(() => {
|
|
3706
|
-
if (
|
|
3707
|
-
return
|
|
3708
|
-
}, [
|
|
3743
|
+
if (directIcon) return null;
|
|
3744
|
+
return effectiveName ? resolveIconForFamily(effectiveName, family) : null;
|
|
3745
|
+
}, [directIcon, effectiveName, family]);
|
|
3709
3746
|
const effectiveStrokeWidth = strokeWidth ?? void 0;
|
|
3710
3747
|
const inlineStyle = {
|
|
3711
3748
|
...effectiveStrokeWidth === void 0 ? { strokeWidth: "var(--icon-stroke-width, 2)" } : {},
|
|
@@ -3717,8 +3754,8 @@ var Icon = ({
|
|
|
3717
3754
|
color ? color : "text-current",
|
|
3718
3755
|
className
|
|
3719
3756
|
);
|
|
3720
|
-
if (
|
|
3721
|
-
const Direct =
|
|
3757
|
+
if (directIcon) {
|
|
3758
|
+
const Direct = directIcon;
|
|
3722
3759
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3723
3760
|
Direct,
|
|
3724
3761
|
{
|
|
@@ -3738,7 +3775,7 @@ var Icon = ({
|
|
|
3738
3775
|
}
|
|
3739
3776
|
);
|
|
3740
3777
|
}
|
|
3741
|
-
const Fallback =
|
|
3778
|
+
const Fallback = LucideIcons2__namespace.HelpCircle;
|
|
3742
3779
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3743
3780
|
Fallback,
|
|
3744
3781
|
{
|
|
@@ -3877,7 +3914,7 @@ var Button = React8__default.default.forwardRef(
|
|
|
3877
3914
|
...props,
|
|
3878
3915
|
"data-testid": props["data-testid"] ?? (action ? `action-${action}` : void 0),
|
|
3879
3916
|
children: [
|
|
3880
|
-
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3917
|
+
isLoading ? /* @__PURE__ */ jsxRuntime.jsx(LucideIcons2.Loader2, { className: "h-icon-default w-icon-default animate-spin" }) : resolvedLeftIcon && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: resolvedLeftIcon }),
|
|
3881
3918
|
children || label,
|
|
3882
3919
|
resolvedRightIcon && !isLoading && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-shrink-0", children: resolvedRightIcon })
|
|
3883
3920
|
]
|
|
@@ -3961,7 +3998,7 @@ var Badge = React8__default.default.forwardRef(
|
|
|
3961
3998
|
"transition-colors",
|
|
3962
3999
|
size === "sm" ? "w-4 h-4 ml-0.5" : size === "md" ? "w-5 h-5 ml-1" : "w-6 h-6 ml-1"
|
|
3963
4000
|
),
|
|
3964
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4001
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(LucideIcons2.X, { className: iconSizes[size] })
|
|
3965
4002
|
}
|
|
3966
4003
|
) : null
|
|
3967
4004
|
]
|
|
@@ -5042,7 +5079,7 @@ var Avatar = ({
|
|
|
5042
5079
|
alt,
|
|
5043
5080
|
name,
|
|
5044
5081
|
initials: providedInitials,
|
|
5045
|
-
icon:
|
|
5082
|
+
icon: iconProp,
|
|
5046
5083
|
size = "md",
|
|
5047
5084
|
status,
|
|
5048
5085
|
badge,
|
|
@@ -5053,6 +5090,7 @@ var Avatar = ({
|
|
|
5053
5090
|
}) => {
|
|
5054
5091
|
const eventBus = useEventBus();
|
|
5055
5092
|
const initials = providedInitials ?? (name ? generateInitials(name) : void 0);
|
|
5093
|
+
const IconComponent = typeof iconProp === "string" ? resolveIcon(iconProp) : iconProp;
|
|
5056
5094
|
const hasImage = !!src;
|
|
5057
5095
|
const hasInitials = !!initials;
|
|
5058
5096
|
const hasIcon = !!IconComponent;
|