@almadar/ui 5.12.1 → 5.13.3

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.
@@ -10,9 +10,9 @@ import { Loader2, X, List, Printer, ChevronRight, ChevronLeft, GitBranch, Pencil
10
10
  import * as PhosphorIcons from '@phosphor-icons/react';
11
11
  import * as TablerIcons from '@tabler/icons-react';
12
12
  import * as FaIcons from 'react-icons/fa';
13
+ import { createPortal } from 'react-dom';
13
14
  import { evaluate, createMinimalContext } from '@almadar/evaluator';
14
15
  import { useUISlots, UISlotProvider } from '@almadar/ui/context';
15
- import { createPortal } from 'react-dom';
16
16
  import { Link, Outlet, useLocation } from 'react-router-dom';
17
17
  import ELK from 'elkjs/lib/elk.bundled.js';
18
18
  import ReactMarkdown from 'react-markdown';
@@ -2227,7 +2227,7 @@ var init_Modal = __esm({
2227
2227
  document.body.style.overflow = "";
2228
2228
  };
2229
2229
  }, [isOpen]);
2230
- if (!isOpen) return null;
2230
+ if (!isOpen || typeof document === "undefined") return null;
2231
2231
  const handleClose = () => {
2232
2232
  if (closeEvent) eventBus.emit(`UI:${closeEvent}`, {});
2233
2233
  onClose();
@@ -2237,124 +2237,127 @@ var init_Modal = __esm({
2237
2237
  handleClose();
2238
2238
  }
2239
2239
  };
2240
- return /* @__PURE__ */ jsxs(Fragment, { children: [
2241
- /* @__PURE__ */ jsx(
2242
- Overlay,
2243
- {
2244
- isVisible: isOpen,
2245
- onClick: handleOverlayClick,
2246
- className: "z-40"
2247
- }
2248
- ),
2249
- /* @__PURE__ */ jsx(
2250
- Box,
2251
- {
2252
- className: cn(
2253
- "fixed inset-0 z-50 pointer-events-none",
2254
- "flex items-start justify-center px-4 pb-4 pt-[10vh]",
2255
- "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
2256
- ),
2257
- children: /* @__PURE__ */ jsxs(
2258
- Dialog,
2259
- {
2260
- ref: modalRef,
2261
- open: true,
2262
- className: cn(
2263
- // Reset browser-default dialog chrome — we own styling. `static`
2264
- // overrides the user-agent `position: absolute` so the parent
2265
- // flex container's `justify-center` actually centers the dialog
2266
- // (without this, the dialog drops out of flex flow and `m-0`
2267
- // kills the user-agent's `margin: auto` centering, pinning the
2268
- // dialog to top-left).
2269
- "static m-0 p-0 border-0 bg-transparent",
2270
- // Pre-existing dialog frame
2271
- "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
2272
- // Desktop sizing + viewport-aware floor.
2273
- sizeClasses2[size],
2274
- minWidthClasses[size],
2275
- "max-h-[80vh]",
2276
- // Mobile: take the entire screen. Override desktop max-w cap,
2277
- // full height, no rounded corners, no min-width.
2278
- "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
2279
- lookStyles[look],
2280
- className
2281
- ),
2282
- style: dragY > 0 ? {
2283
- transform: `translateY(${dragY}px)`,
2284
- transition: isDragging.current ? "none" : "transform 200ms ease-out"
2285
- } : void 0,
2286
- ...title && { "aria-labelledby": "modal-title" },
2287
- children: [
2288
- /* @__PURE__ */ jsx(
2289
- Box,
2290
- {
2291
- className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
2292
- onPointerDown: (e) => {
2293
- if (!swipeDownToClose) return;
2294
- dragStartY.current = e.clientY;
2295
- isDragging.current = true;
2296
- e.target.setPointerCapture(e.pointerId);
2297
- },
2298
- onPointerMove: (e) => {
2299
- if (!isDragging.current) return;
2300
- const dy = Math.max(0, e.clientY - dragStartY.current);
2301
- setDragY(dy);
2302
- },
2303
- onPointerUp: () => {
2304
- if (!isDragging.current) return;
2305
- isDragging.current = false;
2306
- if (dragY > 100) {
2307
- handleClose();
2308
- }
2309
- setDragY(0);
2310
- },
2311
- onPointerCancel: () => {
2312
- isDragging.current = false;
2313
- setDragY(0);
2314
- },
2315
- children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
2316
- }
2240
+ return createPortal(
2241
+ /* @__PURE__ */ jsxs(Fragment, { children: [
2242
+ /* @__PURE__ */ jsx(
2243
+ Overlay,
2244
+ {
2245
+ isVisible: isOpen,
2246
+ onClick: handleOverlayClick,
2247
+ className: "z-[1000]"
2248
+ }
2249
+ ),
2250
+ /* @__PURE__ */ jsx(
2251
+ Box,
2252
+ {
2253
+ className: cn(
2254
+ "fixed inset-0 z-[1001] pointer-events-none",
2255
+ "flex items-start justify-center px-4 pb-4 pt-[10vh]",
2256
+ "max-sm:items-stretch max-sm:p-0 max-sm:pt-0"
2257
+ ),
2258
+ children: /* @__PURE__ */ jsxs(
2259
+ Dialog,
2260
+ {
2261
+ ref: modalRef,
2262
+ open: true,
2263
+ className: cn(
2264
+ // Reset browser-default dialog chrome we own styling. `static`
2265
+ // overrides the user-agent `position: absolute` so the parent
2266
+ // flex container's `justify-center` actually centers the dialog
2267
+ // (without this, the dialog drops out of flex flow and `m-0`
2268
+ // kills the user-agent's `margin: auto` centering, pinning the
2269
+ // dialog to top-left).
2270
+ "static m-0 p-0 border-0 bg-transparent",
2271
+ // Pre-existing dialog frame
2272
+ "pointer-events-auto w-full flex flex-col bg-surface border shadow-elevation-dialog rounded-container",
2273
+ // Desktop sizing + viewport-aware floor.
2274
+ sizeClasses2[size],
2275
+ minWidthClasses[size],
2276
+ "max-h-[80vh]",
2277
+ // Mobile: take the entire screen. Override desktop max-w cap,
2278
+ // full height, no rounded corners, no min-width.
2279
+ "max-sm:max-w-none max-sm:max-h-none max-sm:w-full max-sm:h-full max-sm:rounded-none",
2280
+ lookStyles[look],
2281
+ className
2317
2282
  ),
2318
- (title || showCloseButton) && /* @__PURE__ */ jsxs(
2319
- Box,
2320
- {
2321
- className: cn(
2322
- "px-6 py-4 flex items-center justify-between",
2323
- "border-b-[length:var(--border-width)] border-border"
2324
- ),
2325
- children: [
2326
- title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
2327
- showCloseButton && /* @__PURE__ */ jsx(
2328
- Button,
2329
- {
2330
- variant: "ghost",
2331
- size: "sm",
2332
- icon: "x",
2333
- onClick: handleClose,
2334
- "data-event": "CLOSE",
2335
- "aria-label": "Close modal"
2283
+ style: dragY > 0 ? {
2284
+ transform: `translateY(${dragY}px)`,
2285
+ transition: isDragging.current ? "none" : "transform 200ms ease-out"
2286
+ } : void 0,
2287
+ ...title && { "aria-labelledby": "modal-title" },
2288
+ children: [
2289
+ /* @__PURE__ */ jsx(
2290
+ Box,
2291
+ {
2292
+ className: "hidden max-sm:flex justify-center py-2 cursor-grab active:cursor-grabbing touch-none",
2293
+ onPointerDown: (e) => {
2294
+ if (!swipeDownToClose) return;
2295
+ dragStartY.current = e.clientY;
2296
+ isDragging.current = true;
2297
+ e.target.setPointerCapture(e.pointerId);
2298
+ },
2299
+ onPointerMove: (e) => {
2300
+ if (!isDragging.current) return;
2301
+ const dy = Math.max(0, e.clientY - dragStartY.current);
2302
+ setDragY(dy);
2303
+ },
2304
+ onPointerUp: () => {
2305
+ if (!isDragging.current) return;
2306
+ isDragging.current = false;
2307
+ if (dragY > 100) {
2308
+ handleClose();
2336
2309
  }
2337
- )
2338
- ]
2339
- }
2340
- ),
2341
- /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
2342
- footer && /* @__PURE__ */ jsx(
2343
- Box,
2344
- {
2345
- className: cn(
2346
- "px-6 py-4 bg-muted",
2347
- "border-t-[length:var(--border-width)] border-border"
2348
- ),
2349
- children: footer
2350
- }
2351
- )
2352
- ]
2353
- }
2354
- )
2355
- }
2356
- )
2357
- ] });
2310
+ setDragY(0);
2311
+ },
2312
+ onPointerCancel: () => {
2313
+ isDragging.current = false;
2314
+ setDragY(0);
2315
+ },
2316
+ children: /* @__PURE__ */ jsx(Box, { className: "w-10 h-1 rounded-full bg-border" })
2317
+ }
2318
+ ),
2319
+ (title || showCloseButton) && /* @__PURE__ */ jsxs(
2320
+ Box,
2321
+ {
2322
+ className: cn(
2323
+ "px-6 py-4 flex items-center justify-between",
2324
+ "border-b-[length:var(--border-width)] border-border"
2325
+ ),
2326
+ children: [
2327
+ title && /* @__PURE__ */ jsx(Typography, { variant: "h4", as: "h2", id: "modal-title", children: title }),
2328
+ showCloseButton && /* @__PURE__ */ jsx(
2329
+ Button,
2330
+ {
2331
+ variant: "ghost",
2332
+ size: "sm",
2333
+ icon: "x",
2334
+ onClick: handleClose,
2335
+ "data-event": "CLOSE",
2336
+ "aria-label": "Close modal"
2337
+ }
2338
+ )
2339
+ ]
2340
+ }
2341
+ ),
2342
+ /* @__PURE__ */ jsx(Box, { className: "flex-1 overflow-y-auto p-6", children }),
2343
+ footer && /* @__PURE__ */ jsx(
2344
+ Box,
2345
+ {
2346
+ className: cn(
2347
+ "px-6 py-4 bg-muted",
2348
+ "border-t-[length:var(--border-width)] border-border"
2349
+ ),
2350
+ children: footer
2351
+ }
2352
+ )
2353
+ ]
2354
+ }
2355
+ )
2356
+ }
2357
+ )
2358
+ ] }),
2359
+ document.body
2360
+ );
2358
2361
  };
2359
2362
  Modal.displayName = "Modal";
2360
2363
  }
@@ -13815,7 +13818,7 @@ var init_CodeBlock = __esm({
13815
13818
  };
13816
13819
  };
13817
13820
  }, [errorLines]);
13818
- const isFoldable = foldableProp ?? (language === "orb" || language === "json");
13821
+ const isFoldable = foldableProp ?? true;
13819
13822
  const [collapsed, setCollapsed] = useState(() => /* @__PURE__ */ new Set());
13820
13823
  const foldRegions = useMemo(
13821
13824
  () => isFoldable ? computeFoldRegions(code) : [],
@@ -17637,6 +17640,7 @@ function CalendarGrid({
17637
17640
  swipeRightEvent,
17638
17641
  dayWindow = "auto"
17639
17642
  }) {
17643
+ const evs = Array.isArray(events2) ? events2 : events2 ? [events2] : [];
17640
17644
  const eventBus = useEventBus();
17641
17645
  const longPressTimer = useRef(null);
17642
17646
  const resolvedWeekStart = useMemo(
@@ -17685,7 +17689,7 @@ function CalendarGrid({
17685
17689
  [onEventClick]
17686
17690
  );
17687
17691
  const eventsForDayCount = useCallback(
17688
- (day) => events2.filter(
17692
+ (day) => evs.filter(
17689
17693
  (ev) => new Date(ev.startTime).toDateString() === day.toDateString()
17690
17694
  ).length,
17691
17695
  [events2]
@@ -17800,7 +17804,7 @@ function CalendarGrid({
17800
17804
  }
17801
17805
  ) }),
17802
17806
  visibleDays.map((day) => {
17803
- const slotEvents = events2.filter(
17807
+ const slotEvents = evs.filter(
17804
17808
  (ev) => eventInSlot(ev, day, time)
17805
17809
  );
17806
17810
  const isToday = day.toDateString() === (/* @__PURE__ */ new Date()).toDateString();
@@ -29874,7 +29878,7 @@ function useSafeEventBus10() {
29874
29878
  }
29875
29879
  }
29876
29880
  function SortableListInner({
29877
- items: initialItems = EMPTY_ITEMS,
29881
+ items: initialItemsProp = EMPTY_ITEMS,
29878
29882
  renderItem,
29879
29883
  reorderEvent,
29880
29884
  reorderPayload,
@@ -29882,6 +29886,7 @@ function SortableListInner({
29882
29886
  className
29883
29887
  }) {
29884
29888
  const eventBus = useSafeEventBus10();
29889
+ const initialItems = Array.isArray(initialItemsProp) ? initialItemsProp : initialItemsProp ? [initialItemsProp] : [];
29885
29890
  const handleReorder = useCallback(
29886
29891
  (fromIndex, toIndex, item) => {
29887
29892
  eventBus.emit(`UI:${reorderEvent}`, {
@@ -33313,9 +33318,10 @@ var init_ReplyTree = __esm({
33313
33318
  showActions = true,
33314
33319
  className
33315
33320
  }) => {
33321
+ const nodeList = Array.isArray(nodes) ? nodes : nodes ? [nodes] : [];
33316
33322
  const [collapsedSet, setCollapsedSet] = useState(() => {
33317
33323
  const acc = /* @__PURE__ */ new Set();
33318
- collectInitiallyCollapsed(nodes, acc);
33324
+ collectInitiallyCollapsed(nodeList, acc);
33319
33325
  return acc;
33320
33326
  });
33321
33327
  const toggleCollapse = useCallback((id) => {
@@ -33329,10 +33335,10 @@ var init_ReplyTree = __esm({
33329
33335
  return next;
33330
33336
  });
33331
33337
  }, []);
33332
- if (nodes.length === 0) {
33338
+ if (nodeList.length === 0) {
33333
33339
  return /* @__PURE__ */ jsx(Box, { className: cn("text-sm text-muted-foreground", className), children: "No replies yet." });
33334
33340
  }
33335
- return /* @__PURE__ */ jsx(Box, { className: cn("flex flex-col gap-2 min-w-0", className), children: nodes.map((node) => /* @__PURE__ */ jsx(
33341
+ return /* @__PURE__ */ jsx(Box, { className: cn("flex flex-col gap-2 min-w-0", className), children: nodeList.map((node) => /* @__PURE__ */ jsx(
33336
33342
  ReplyTreeNode,
33337
33343
  {
33338
33344
  node,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@almadar/ui",
3
- "version": "5.12.1",
3
+ "version": "5.13.3",
4
4
  "description": "React UI components, hooks, and providers for Almadar",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -129,10 +129,10 @@
129
129
  "typecheck": "tsc --noEmit"
130
130
  },
131
131
  "dependencies": {
132
- "@almadar/core": "^9.0.0",
132
+ "@almadar/core": ">=9.8.0",
133
133
  "@almadar/evaluator": ">=2.9.2",
134
134
  "@almadar/logger": "^1.3.0",
135
- "@almadar/patterns": "^2.26.0",
135
+ "@almadar/patterns": ">=2.35.0",
136
136
  "@almadar/runtime": "^6.7.0",
137
137
  "@almadar/std": ">=6.4.1",
138
138
  "@almadar/syntax": ">=1.3.1",
@@ -232,5 +232,8 @@
232
232
  "@types/react": "^19.0.0",
233
233
  "@types/react-dom": "^19.0.0"
234
234
  }
235
+ },
236
+ "overrides": {
237
+ "@almadar/core": "$@almadar/core"
235
238
  }
236
239
  }
@@ -242,6 +242,8 @@ module.exports = {
242
242
  'w-[480px]',
243
243
  'w-[640px]',
244
244
  'will-change-[opacity,transform]',
245
+ 'z-[1000]',
246
+ 'z-[1001]',
245
247
  'z-[60]',
246
248
  ],
247
249
  theme: {