@almadar/ui 2.16.1 → 2.18.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.
@@ -1,4 +1,4 @@
1
- import React3, { createContext, useCallback, useState, useEffect, useMemo, useContext, useRef, useSyncExternalStore } from 'react';
1
+ import React2, { createContext, useCallback, useState, useEffect, useMemo, useContext, useRef, useSyncExternalStore } from 'react';
2
2
  import 'react/jsx-runtime';
3
3
  import { useQueryClient, useMutation, useQuery } from '@tanstack/react-query';
4
4
 
@@ -1233,7 +1233,7 @@ function EntityDataProvider({
1233
1233
  adapter,
1234
1234
  children
1235
1235
  }) {
1236
- return React3.createElement(
1236
+ return React2.createElement(
1237
1237
  EntityDataContext.Provider,
1238
1238
  { value: adapter },
1239
1239
  children
@@ -0,0 +1,15 @@
1
+ import type { EventBusContextType } from '../hooks/event-bus-types';
2
+ /**
3
+ * Extended context type for backward compatibility.
4
+ */
5
+ export interface EventBusContextTypeExtended extends EventBusContextType {
6
+ /** @deprecated Use useSelection from SelectionProvider instead. */
7
+ getSelectedEntity: () => unknown | null;
8
+ /** @deprecated Use useSelection from SelectionProvider instead. */
9
+ clearSelectedEntity: () => void;
10
+ }
11
+ /**
12
+ * The one and only EventBusContext.
13
+ * Imported by EventBusProvider (to provide) and useEventBus (to consume).
14
+ */
15
+ export declare const EventBusContext: import("react").Context<EventBusContextTypeExtended | null>;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var React5 = require('react');
3
+ var React4 = require('react');
4
4
  var jsxRuntime = require('react/jsx-runtime');
5
5
  var LucideIcons = require('lucide-react');
6
6
 
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
24
24
  return Object.freeze(n);
25
25
  }
26
26
 
27
- var React5__default = /*#__PURE__*/_interopDefault(React5);
27
+ var React4__default = /*#__PURE__*/_interopDefault(React4);
28
28
  var LucideIcons__namespace = /*#__PURE__*/_interopNamespace(LucideIcons);
29
29
 
30
30
  // node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
@@ -2506,7 +2506,7 @@ var twMerge = /* @__PURE__ */ createTailwindMerge(getDefaultConfig);
2506
2506
  function cn(...inputs) {
2507
2507
  return twMerge(clsx(inputs));
2508
2508
  }
2509
- var EventBusContext = React5.createContext(null);
2509
+ var EventBusContext = React4.createContext(null);
2510
2510
 
2511
2511
  // hooks/useEventBus.ts
2512
2512
  function getGlobalEventBus() {
@@ -2576,7 +2576,7 @@ var fallbackEventBus = {
2576
2576
  }
2577
2577
  };
2578
2578
  function useEventBus() {
2579
- const context = React5.useContext(EventBusContext);
2579
+ const context = React4.useContext(EventBusContext);
2580
2580
  return context ?? getGlobalEventBus() ?? fallbackEventBus;
2581
2581
  }
2582
2582
  var paddingStyles = {
@@ -2681,7 +2681,7 @@ var positionStyles = {
2681
2681
  fixed: "fixed",
2682
2682
  sticky: "sticky"
2683
2683
  };
2684
- var Box = React5__default.default.forwardRef(
2684
+ var Box = React4__default.default.forwardRef(
2685
2685
  ({
2686
2686
  padding,
2687
2687
  paddingX,
@@ -2710,20 +2710,20 @@ var Box = React5__default.default.forwardRef(
2710
2710
  ...rest
2711
2711
  }, ref) => {
2712
2712
  const eventBus = useEventBus();
2713
- const handleClick = React5.useCallback((e) => {
2713
+ const handleClick = React4.useCallback((e) => {
2714
2714
  if (action) {
2715
2715
  e.stopPropagation();
2716
2716
  eventBus.emit(`UI:${action}`, actionPayload ?? {});
2717
2717
  }
2718
2718
  onClick?.(e);
2719
2719
  }, [action, actionPayload, eventBus, onClick]);
2720
- const handleMouseEnter = React5.useCallback((e) => {
2720
+ const handleMouseEnter = React4.useCallback((e) => {
2721
2721
  if (hoverEvent) {
2722
2722
  eventBus.emit(`UI:${hoverEvent}`, { hovered: true });
2723
2723
  }
2724
2724
  onMouseEnter?.(e);
2725
2725
  }, [hoverEvent, eventBus, onMouseEnter]);
2726
- const handleMouseLeave = React5.useCallback((e) => {
2726
+ const handleMouseLeave = React4.useCallback((e) => {
2727
2727
  if (hoverEvent) {
2728
2728
  eventBus.emit(`UI:${hoverEvent}`, { hovered: false });
2729
2729
  }
@@ -3107,7 +3107,7 @@ function resolveIconProp(value, sizeClass) {
3107
3107
  const IconComp = value;
3108
3108
  return /* @__PURE__ */ jsxRuntime.jsx(IconComp, { className: sizeClass });
3109
3109
  }
3110
- if (React5__default.default.isValidElement(value)) {
3110
+ if (React4__default.default.isValidElement(value)) {
3111
3111
  return value;
3112
3112
  }
3113
3113
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -3116,7 +3116,7 @@ function resolveIconProp(value, sizeClass) {
3116
3116
  }
3117
3117
  return value;
3118
3118
  }
3119
- var Button = React5__default.default.forwardRef(
3119
+ var Button = React4__default.default.forwardRef(
3120
3120
  ({
3121
3121
  className,
3122
3122
  variant = "primary",
@@ -3211,7 +3211,7 @@ var sizeStyles3 = {
3211
3211
  md: "px-2.5 py-1 text-sm",
3212
3212
  lg: "px-3 py-1.5 text-base"
3213
3213
  };
3214
- var Badge = React5__default.default.forwardRef(
3214
+ var Badge = React4__default.default.forwardRef(
3215
3215
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
3216
3216
  const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
3217
3217
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -3280,7 +3280,7 @@ var shadowStyles2 = {
3280
3280
  md: "shadow-[var(--shadow-main)]",
3281
3281
  lg: "shadow-[var(--shadow-lg)]"
3282
3282
  };
3283
- var Card = React5__default.default.forwardRef(
3283
+ var Card = React4__default.default.forwardRef(
3284
3284
  ({
3285
3285
  className,
3286
3286
  variant = "bordered",
@@ -3316,9 +3316,9 @@ var Card = React5__default.default.forwardRef(
3316
3316
  }
3317
3317
  );
3318
3318
  Card.displayName = "Card";
3319
- var CardHeader = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
3319
+ var CardHeader = React4__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("mb-4", className), ...props }));
3320
3320
  CardHeader.displayName = "CardHeader";
3321
- var CardTitle = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3321
+ var CardTitle = React4__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3322
3322
  "h3",
3323
3323
  {
3324
3324
  ref,
@@ -3331,11 +3331,11 @@ var CardTitle = React5__default.default.forwardRef(({ className, ...props }, ref
3331
3331
  }
3332
3332
  ));
3333
3333
  CardTitle.displayName = "CardTitle";
3334
- var CardContent = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
3334
+ var CardContent = React4__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("", className), ...props }));
3335
3335
  CardContent.displayName = "CardContent";
3336
3336
  var CardBody = CardContent;
3337
3337
  CardBody.displayName = "CardBody";
3338
- var CardFooter = React5__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3338
+ var CardFooter = React4__default.default.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx(
3339
3339
  "div",
3340
3340
  {
3341
3341
  ref,
@@ -3492,7 +3492,7 @@ var paddingClasses = {
3492
3492
  md: "py-16",
3493
3493
  lg: "py-24"
3494
3494
  };
3495
- var ContentSection = React5__default.default.forwardRef(
3495
+ var ContentSection = React4__default.default.forwardRef(
3496
3496
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
3497
3497
  return /* @__PURE__ */ jsxRuntime.jsx(
3498
3498
  Box,
@@ -3516,8 +3516,8 @@ var InstallBox = ({
3516
3516
  label,
3517
3517
  className
3518
3518
  }) => {
3519
- const [copied, setCopied] = React5.useState(false);
3520
- const handleCopy = React5.useCallback(() => {
3519
+ const [copied, setCopied] = React4.useState(false);
3520
+ const handleCopy = React4.useCallback(() => {
3521
3521
  void navigator.clipboard.writeText(command);
3522
3522
  setCopied(true);
3523
3523
  const timer = setTimeout(() => setCopied(false), 2e3);
@@ -4063,7 +4063,7 @@ var StepFlow = ({
4063
4063
  className
4064
4064
  }) => {
4065
4065
  if (orientation === "vertical") {
4066
- return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(React5__default.default.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
4066
+ return /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsx(React4__default.default.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
4067
4067
  /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "none", align: "center", children: [
4068
4068
  /* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
4069
4069
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "w-px h-8 bg-[var(--color-border)]" })
@@ -4074,7 +4074,7 @@ var StepFlow = ({
4074
4074
  ] })
4075
4075
  ] }) }, index)) });
4076
4076
  }
4077
- return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(React5__default.default.Fragment, { children: [
4077
+ return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxRuntime.jsxs(React4__default.default.Fragment, { children: [
4078
4078
  /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
4079
4079
  /* @__PURE__ */ jsxRuntime.jsx(StepCircle, { step, index }),
4080
4080
  /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -4589,10 +4589,10 @@ var AnimatedCounter = ({
4589
4589
  duration = 1500,
4590
4590
  className
4591
4591
  }) => {
4592
- const ref = React5.useRef(null);
4593
- const [displayValue, setDisplayValue] = React5.useState("0");
4594
- const [hasAnimated, setHasAnimated] = React5.useState(false);
4595
- const animate = React5.useCallback(() => {
4592
+ const ref = React4.useRef(null);
4593
+ const [displayValue, setDisplayValue] = React4.useState("0");
4594
+ const [hasAnimated, setHasAnimated] = React4.useState(false);
4595
+ const animate = React4.useCallback(() => {
4596
4596
  const { num, prefix, suffix, decimals } = parseValue(value);
4597
4597
  if (num === 0) {
4598
4598
  setDisplayValue(value);
@@ -4613,7 +4613,7 @@ var AnimatedCounter = ({
4613
4613
  };
4614
4614
  requestAnimationFrame(tick);
4615
4615
  }, [value, duration]);
4616
- React5.useEffect(() => {
4616
+ React4.useEffect(() => {
4617
4617
  if (hasAnimated) return;
4618
4618
  const el = ref.current;
4619
4619
  if (!el) return;
@@ -1,4 +1,4 @@
1
- import React5, { createContext, useCallback, useContext, useState, useRef, useEffect } from 'react';
1
+ import React4, { createContext, useCallback, useContext, useState, useRef, useEffect } from 'react';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import * as LucideIcons from 'lucide-react';
4
4
  import { Loader2, Check, User } from 'lucide-react';
@@ -2657,7 +2657,7 @@ var positionStyles = {
2657
2657
  fixed: "fixed",
2658
2658
  sticky: "sticky"
2659
2659
  };
2660
- var Box = React5.forwardRef(
2660
+ var Box = React4.forwardRef(
2661
2661
  ({
2662
2662
  padding,
2663
2663
  paddingX,
@@ -3083,7 +3083,7 @@ function resolveIconProp(value, sizeClass) {
3083
3083
  const IconComp = value;
3084
3084
  return /* @__PURE__ */ jsx(IconComp, { className: sizeClass });
3085
3085
  }
3086
- if (React5.isValidElement(value)) {
3086
+ if (React4.isValidElement(value)) {
3087
3087
  return value;
3088
3088
  }
3089
3089
  if (typeof value === "object" && value !== null && "render" in value) {
@@ -3092,7 +3092,7 @@ function resolveIconProp(value, sizeClass) {
3092
3092
  }
3093
3093
  return value;
3094
3094
  }
3095
- var Button = React5.forwardRef(
3095
+ var Button = React4.forwardRef(
3096
3096
  ({
3097
3097
  className,
3098
3098
  variant = "primary",
@@ -3187,7 +3187,7 @@ var sizeStyles3 = {
3187
3187
  md: "px-2.5 py-1 text-sm",
3188
3188
  lg: "px-3 py-1.5 text-base"
3189
3189
  };
3190
- var Badge = React5.forwardRef(
3190
+ var Badge = React4.forwardRef(
3191
3191
  ({ className, variant = "default", size = "sm", amount, label, icon, children, ...props }, ref) => {
3192
3192
  const iconSizes = { sm: "w-3 h-3", md: "w-3.5 h-3.5", lg: "w-4 h-4" };
3193
3193
  const resolvedIcon = typeof icon === "string" ? (() => {
@@ -3256,7 +3256,7 @@ var shadowStyles2 = {
3256
3256
  md: "shadow-[var(--shadow-main)]",
3257
3257
  lg: "shadow-[var(--shadow-lg)]"
3258
3258
  };
3259
- var Card = React5.forwardRef(
3259
+ var Card = React4.forwardRef(
3260
3260
  ({
3261
3261
  className,
3262
3262
  variant = "bordered",
@@ -3292,9 +3292,9 @@ var Card = React5.forwardRef(
3292
3292
  }
3293
3293
  );
3294
3294
  Card.displayName = "Card";
3295
- var CardHeader = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3295
+ var CardHeader = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("mb-4", className), ...props }));
3296
3296
  CardHeader.displayName = "CardHeader";
3297
- var CardTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3297
+ var CardTitle = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3298
3298
  "h3",
3299
3299
  {
3300
3300
  ref,
@@ -3307,11 +3307,11 @@ var CardTitle = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__
3307
3307
  }
3308
3308
  ));
3309
3309
  CardTitle.displayName = "CardTitle";
3310
- var CardContent = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3310
+ var CardContent = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("", className), ...props }));
3311
3311
  CardContent.displayName = "CardContent";
3312
3312
  var CardBody = CardContent;
3313
3313
  CardBody.displayName = "CardBody";
3314
- var CardFooter = React5.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3314
+ var CardFooter = React4.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
3315
3315
  "div",
3316
3316
  {
3317
3317
  ref,
@@ -3468,7 +3468,7 @@ var paddingClasses = {
3468
3468
  md: "py-16",
3469
3469
  lg: "py-24"
3470
3470
  };
3471
- var ContentSection = React5.forwardRef(
3471
+ var ContentSection = React4.forwardRef(
3472
3472
  ({ children, background = "default", padding = "lg", id, className }, ref) => {
3473
3473
  return /* @__PURE__ */ jsx(
3474
3474
  Box,
@@ -4039,7 +4039,7 @@ var StepFlow = ({
4039
4039
  className
4040
4040
  }) => {
4041
4041
  if (orientation === "vertical") {
4042
- return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React5.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
4042
+ return /* @__PURE__ */ jsx(VStack, { gap: "none", className: cn("w-full", className), children: steps.map((step, index) => /* @__PURE__ */ jsx(React4.Fragment, { children: /* @__PURE__ */ jsxs(HStack, { gap: "md", align: "start", className: "w-full", children: [
4043
4043
  /* @__PURE__ */ jsxs(VStack, { gap: "none", align: "center", children: [
4044
4044
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
4045
4045
  showConnectors && index < steps.length - 1 && /* @__PURE__ */ jsx(Box, { className: "w-px h-8 bg-[var(--color-border)]" })
@@ -4050,7 +4050,7 @@ var StepFlow = ({
4050
4050
  ] })
4051
4051
  ] }) }, index)) });
4052
4052
  }
4053
- return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React5.Fragment, { children: [
4053
+ return /* @__PURE__ */ jsx(Box, { className: cn("w-full flex flex-col md:flex-row items-start gap-0", className), children: steps.map((step, index) => /* @__PURE__ */ jsxs(React4.Fragment, { children: [
4054
4054
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "center", className: "flex-1 w-full md:w-auto", children: [
4055
4055
  /* @__PURE__ */ jsx(StepCircle, { step, index }),
4056
4056
  /* @__PURE__ */ jsx(Typography, { variant: "h4", className: "text-center", children: step.title }),
@@ -9,27 +9,11 @@
9
9
  *
10
10
  * @packageDocumentation
11
11
  */
12
- import React, { type ReactNode } from 'react';
12
+ import { type ReactNode } from 'react';
13
13
  import type { EventBusContextType } from '../hooks/event-bus-types';
14
- /**
15
- * Extended context type for backward compatibility.
16
- *
17
- * @deprecated getSelectedEntity and clearSelectedEntity are deprecated.
18
- * Use SelectionProvider and useSelection hook instead.
19
- */
20
- export interface EventBusContextTypeExtended extends EventBusContextType {
21
- /**
22
- * @deprecated Use useSelection from SelectionProvider instead.
23
- * This method now returns null - selection state moved to SelectionProvider.
24
- */
25
- getSelectedEntity: () => unknown | null;
26
- /**
27
- * @deprecated Use useSelection from SelectionProvider instead.
28
- * This method is now a no-op - selection state moved to SelectionProvider.
29
- */
30
- clearSelectedEntity: () => void;
31
- }
32
- export declare const EventBusContext: React.Context<EventBusContextTypeExtended | null>;
14
+ import { EventBusContext } from '../internals/event-bus-context';
15
+ import type { EventBusContextTypeExtended } from '../internals/event-bus-context';
16
+ export { EventBusContext, type EventBusContextTypeExtended };
33
17
  interface EventBusProviderProps {
34
18
  children: ReactNode;
35
19
  /** Enable debug logging in development */
@@ -283,6 +283,9 @@ var ThemeProvider = ({
283
283
  );
284
284
  return /* @__PURE__ */ jsxRuntime.jsx(ThemeContext.Provider, { value: contextValue, children });
285
285
  };
286
+ var EventBusContext = React110.createContext(null);
287
+
288
+ // hooks/useEventBus.ts
286
289
  function setGlobalEventBus(bus) {
287
290
  if (typeof window !== "undefined") {
288
291
  window.__kflowEventBus = bus;
@@ -358,7 +361,6 @@ function useEventBus() {
358
361
  const context = React110.useContext(EventBusContext);
359
362
  return context ?? getGlobalEventBus() ?? fallbackEventBus;
360
363
  }
361
- var EventBusContext = React110.createContext(null);
362
364
  function EventBusProvider({ children, debug: debug2 = false }) {
363
365
  const listenersRef = React110.useRef(/* @__PURE__ */ new Map());
364
366
  const anyListenersRef = React110.useRef(/* @__PURE__ */ new Set());
@@ -253,6 +253,9 @@ var ThemeProvider = ({
253
253
  );
254
254
  return /* @__PURE__ */ jsx(ThemeContext.Provider, { value: contextValue, children });
255
255
  };
256
+ var EventBusContext = createContext(null);
257
+
258
+ // hooks/useEventBus.ts
256
259
  function setGlobalEventBus(bus) {
257
260
  if (typeof window !== "undefined") {
258
261
  window.__kflowEventBus = bus;
@@ -328,7 +331,6 @@ function useEventBus() {
328
331
  const context = useContext(EventBusContext);
329
332
  return context ?? getGlobalEventBus() ?? fallbackEventBus;
330
333
  }
331
- var EventBusContext = createContext(null);
332
334
  function EventBusProvider({ children, debug: debug2 = false }) {
333
335
  const listenersRef = useRef(/* @__PURE__ */ new Map());
334
336
  const anyListenersRef = useRef(/* @__PURE__ */ new Set());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "2.16.1",
3
+ "version": "2.18.0",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "main": "./dist/components/index.js",