@ai-matrx/design-system 0.15.2 → 0.17.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.
package/dist/index.js CHANGED
@@ -1396,55 +1396,29 @@ function ConfirmDialog({
1396
1396
  }
1397
1397
 
1398
1398
  // src/confirm-host.tsx
1399
- import {
1400
- _registerHost,
1401
- _unregisterHost
1402
- } from "@ai-matrx/kit/confirm-opener";
1399
+ import { confirmOpener } from "@ai-matrx/kit/confirm-opener";
1400
+ import { useOpenerHost } from "@ai-matrx/kit/opener-react";
1403
1401
  import * as React14 from "react";
1404
1402
  import { jsx as jsx17 } from "react/jsx-runtime";
1405
1403
  function ConfirmDialogHost() {
1406
- const [active, setActive] = React14.useState(null);
1407
- const [tick, setTick] = React14.useState(0);
1408
- const queueRef = React14.useRef([]);
1409
- React14.useEffect(() => {
1410
- const controller = {
1411
- show: (opts, resolve) => {
1412
- queueRef.current.push({ opts, resolve });
1413
- setTick((n) => n + 1);
1414
- }
1415
- };
1416
- _registerHost(controller);
1417
- return () => _unregisterHost(controller);
1418
- }, []);
1419
- React14.useEffect(() => {
1420
- if (active === null && queueRef.current.length > 0) {
1421
- setActive(queueRef.current.shift());
1422
- }
1423
- }, [active, tick]);
1424
- const handleConfirm = React14.useCallback(() => {
1425
- if (!active) return;
1426
- active.resolve(true);
1427
- setActive(null);
1428
- }, [active]);
1404
+ const { request, open, settle } = useOpenerHost(confirmOpener);
1405
+ const handleConfirm = React14.useCallback(() => settle(true), [settle]);
1429
1406
  const handleOpenChange = React14.useCallback(
1430
- (open) => {
1431
- if (!open && active) {
1432
- active.resolve(false);
1433
- setActive(null);
1434
- }
1407
+ (next) => {
1408
+ if (!next) settle(false);
1435
1409
  },
1436
- [active]
1410
+ [settle]
1437
1411
  );
1438
1412
  return /* @__PURE__ */ jsx17(
1439
1413
  ConfirmDialog,
1440
1414
  {
1441
- open: !!active,
1415
+ open,
1442
1416
  onOpenChange: handleOpenChange,
1443
- title: active?.opts.title ?? "",
1444
- description: active?.opts.description,
1445
- confirmLabel: active?.opts.confirmLabel,
1446
- cancelLabel: active?.opts.cancelLabel,
1447
- variant: active?.opts.variant,
1417
+ title: request?.title ?? "",
1418
+ description: request?.description,
1419
+ confirmLabel: request?.confirmLabel,
1420
+ cancelLabel: request?.cancelLabel,
1421
+ variant: request?.variant,
1448
1422
  onConfirm: handleConfirm
1449
1423
  }
1450
1424
  );
@@ -1586,8 +1560,8 @@ ContextMenuShortcut.displayName = "ContextMenuShortcut";
1586
1560
 
1587
1561
  // src/creatable-picker.tsx
1588
1562
  import {
1589
- useRef as useRef2,
1590
- useState as useState3
1563
+ useRef,
1564
+ useState as useState2
1591
1565
  } from "react";
1592
1566
 
1593
1567
  // src/popover.tsx
@@ -1659,11 +1633,11 @@ function CreatablePicker({
1659
1633
  renderSelected,
1660
1634
  size = "sm"
1661
1635
  }) {
1662
- const [open, setOpen] = useState3(false);
1663
- const [query, setQuery] = useState3("");
1664
- const [busy, setBusy] = useState3(false);
1665
- const inputRef = useRef2(null);
1666
- const [needsName, setNeedsName] = useState3(false);
1636
+ const [open, setOpen] = useState2(false);
1637
+ const [query, setQuery] = useState2("");
1638
+ const [busy, setBusy] = useState2(false);
1639
+ const inputRef = useRef(null);
1640
+ const [needsName, setNeedsName] = useState2(false);
1667
1641
  const selected = options.find((option) => option.value === value) ?? null;
1668
1642
  const groups = [];
1669
1643
  for (const option of options) {
@@ -2208,7 +2182,7 @@ var DropdownMenuShortcut = ({
2208
2182
  DropdownMenuShortcut.displayName = "DropdownMenuShortcut";
2209
2183
 
2210
2184
  // src/editable-label.tsx
2211
- import { useCallback as useCallback3, useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
2185
+ import { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef2, useState as useState4 } from "react";
2212
2186
  import { jsx as jsx23, jsxs as jsxs12 } from "react/jsx-runtime";
2213
2187
  function EditableLabel({
2214
2188
  value,
@@ -2229,16 +2203,16 @@ function EditableLabel({
2229
2203
  inputClassName
2230
2204
  }) {
2231
2205
  const controlled = activation === "controlled";
2232
- const [internalEditing, setInternalEditing] = useState5(false);
2206
+ const [internalEditing, setInternalEditing] = useState4(false);
2233
2207
  const editing = controlled ? !!editingProp : internalEditing;
2234
- const [draft, setDraft] = useState5(value);
2235
- const [error, setError] = useState5(null);
2236
- const [busy, setBusy] = useState5(false);
2237
- const inputRef = useRef3(null);
2238
- useEffect3(() => {
2208
+ const [draft, setDraft] = useState4(value);
2209
+ const [error, setError] = useState4(null);
2210
+ const [busy, setBusy] = useState4(false);
2211
+ const inputRef = useRef2(null);
2212
+ useEffect2(() => {
2239
2213
  if (!editing) setDraft(value);
2240
2214
  }, [value, editing]);
2241
- useEffect3(() => {
2215
+ useEffect2(() => {
2242
2216
  if (editing && inputRef.current) {
2243
2217
  inputRef.current.focus();
2244
2218
  if (selectOnEdit) inputRef.current.select();
@@ -2515,7 +2489,7 @@ var Label3 = React20.forwardRef(({ className, ...props }, ref) => /* @__PURE__ *
2515
2489
  Label3.displayName = LabelPrimitive.Root.displayName;
2516
2490
 
2517
2491
  // src/overflow-toolbar.tsx
2518
- import { useLayoutEffect, useMemo, useRef as useRef4, useState as useState6 } from "react";
2492
+ import { useLayoutEffect, useMemo, useRef as useRef3, useState as useState5 } from "react";
2519
2493
  import { Fragment, jsx as jsx26, jsxs as jsxs14 } from "react/jsx-runtime";
2520
2494
  var GAP_PX = 6;
2521
2495
  var TONE = {
@@ -2601,10 +2575,10 @@ function OverflowToolbar({
2601
2575
  () => actions.filter((a) => !a.hidden),
2602
2576
  [actions]
2603
2577
  );
2604
- const containerRef = useRef4(null);
2605
- const ghostRef = useRef4(null);
2606
- const leadingRef = useRef4(null);
2607
- const [visibleCount, setVisibleCount] = useState6(visibleActions.length);
2578
+ const containerRef = useRef3(null);
2579
+ const ghostRef = useRef3(null);
2580
+ const leadingRef = useRef3(null);
2581
+ const [visibleCount, setVisibleCount] = useState5(visibleActions.length);
2608
2582
  const signature = visibleActions.map(
2609
2583
  (a) => `${a.id}:${a.hideLabel ? 1 : 0}:${a.running ? 1 : 0}:${a.runningLabel ?? ""}:${a.label}`
2610
2584
  ).join("|");
@@ -3518,7 +3492,7 @@ function DefaultOrganizationSwitch({
3518
3492
  }
3519
3493
 
3520
3494
  // src/tabbed-bottom-sheet.tsx
3521
- import { useState as useState7 } from "react";
3495
+ import { useState as useState6 } from "react";
3522
3496
  import { jsx as jsx39, jsxs as jsxs22 } from "react/jsx-runtime";
3523
3497
  function TabbedBottomSheet({
3524
3498
  open,
@@ -3526,8 +3500,8 @@ function TabbedBottomSheet({
3526
3500
  title,
3527
3501
  tabs
3528
3502
  }) {
3529
- const [selectedTabId, setSelectedTabId] = useState7(null);
3530
- const [wasOpen, setWasOpen] = useState7(open);
3503
+ const [selectedTabId, setSelectedTabId] = useState6(null);
3504
+ const [wasOpen, setWasOpen] = useState6(open);
3531
3505
  if (open !== wasOpen) {
3532
3506
  setWasOpen(open);
3533
3507
  if (open) setSelectedTabId(null);
@@ -3897,15 +3871,15 @@ var TextareaWithPrefix = React31.forwardRef(
3897
3871
  TextareaWithPrefix.displayName = "TextareaWithPrefix";
3898
3872
 
3899
3873
  // src/use-scroll-fade.ts
3900
- import { useCallback as useCallback5, useEffect as useEffect5, useRef as useRef6, useState as useState8 } from "react";
3874
+ import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef5, useState as useState7 } from "react";
3901
3875
  var EPSILON = 2;
3902
3876
  function useScrollFade() {
3903
- const [state, setState] = useState8({
3877
+ const [state, setState] = useState7({
3904
3878
  top: false,
3905
3879
  bottom: false
3906
3880
  });
3907
- const nodeRef = useRef6(null);
3908
- const cleanupRef = useRef6(null);
3881
+ const nodeRef = useRef5(null);
3882
+ const cleanupRef = useRef5(null);
3909
3883
  const measure = useCallback5(() => {
3910
3884
  const el = nodeRef.current;
3911
3885
  if (!el) return;
@@ -3938,7 +3912,7 @@ function useScrollFade() {
3938
3912
  },
3939
3913
  [measure]
3940
3914
  );
3941
- useEffect5(() => () => cleanupRef.current?.(), []);
3915
+ useEffect4(() => () => cleanupRef.current?.(), []);
3942
3916
  return {
3943
3917
  ref,
3944
3918
  state,