@ai-matrx/design-system 0.86.364 → 0.86.365

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/CHANGELOG.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.86.365
4
+
5
+ - `SwipeDeck` gains `titleSize` (`"fit"` default | `"page"`: the card text at a page-title size in a 760px reading column, top-aligned; the stage still scrolls when the card is taller) and `moreOnCard` (default `true`; `false` drops the deck's own row of off-edge answers so the host draws every answer through `context.answer` — their shortcuts still answer). No consumer action required.
6
+
3
7
  ## 0.86.364
4
8
 
5
- UNVERIFIED: this release has no Unreleased entry and the source comparison could not be made (the caller supplied no source comparison). Whether source changed is unknown; consumer action is unknown.
6
- Check the package's gitHead on npm against this version's gitHead: `git diff <previous gitHead> <this gitHead> -- apps/shared/design-system/src`.
9
+ SOURCE CHANGED WITH NO RELEASE NOTE. This release shipped source changes that nobody described in an Unreleased entry,
10
+ so they may include breaking API changes. Consumer action is UNKNOWN: read the diff before upgrading.
11
+ Diff: `git diff 46cf8944d0 54207e9f2d -- apps/shared/design-system/src`
12
+
13
+ Changed shipped source files (1):
14
+ - `apps/shared/design-system/src/tokens.css`
7
15
 
8
16
  ## 0.86.363
9
17
 
package/dist/index.cjs CHANGED
@@ -13314,6 +13314,20 @@ function RowLink({ href, children }) {
13314
13314
  }
13315
13315
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("a", { href, className, onClick: stop, children });
13316
13316
  }
13317
+ function RowAction({ onSelect, children }) {
13318
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
13319
+ "button",
13320
+ {
13321
+ type: "button",
13322
+ className: "max-w-full truncate text-left text-primary underline-offset-2 hover:underline",
13323
+ onClick: (event) => {
13324
+ event.stopPropagation();
13325
+ onSelect();
13326
+ },
13327
+ children
13328
+ }
13329
+ );
13330
+ }
13317
13331
  function PeekCardRows({ rows, numbered = false, limit }) {
13318
13332
  const shown = limit && rows.length > limit ? rows.slice(0, limit) : rows;
13319
13333
  const rest = rows.length - shown.length;
@@ -13327,7 +13341,7 @@ function PeekCardRows({ rows, numbered = false, limit }) {
13327
13341
  row.tone ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { "aria-hidden": true, className: cn("mt-[7px] size-1.5 shrink-0 rounded-full", TONE_FILL[row.tone]) }) : null,
13328
13342
  row.glyph ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(row.glyph, { className: cn("mt-0.5 size-3.5 shrink-0 text-muted-foreground", lead) }) : null,
13329
13343
  /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "flex min-w-0 flex-1 flex-col", children: [
13330
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "type-secondary min-w-0 truncate text-foreground", title: row.title, children: row.href ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RowLink, { href: row.href, children: row.text }) : row.text }),
13344
+ /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "type-secondary min-w-0 truncate text-foreground", title: row.title, children: row.onSelect ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RowAction, { onSelect: row.onSelect, children: row.text }) : row.href ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(RowLink, { href: row.href, children: row.text }) : row.text }),
13331
13345
  row.detail ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { className: "type-meta break-words text-muted-foreground", children: row.detail }) : null
13332
13346
  ] }),
13333
13347
  row.status ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
@@ -14059,6 +14073,7 @@ function Block({ block }) {
14059
14073
  glyph: row.glyph,
14060
14074
  tone: row.tone,
14061
14075
  href: row.entity ? void 0 : row.href,
14076
+ onSelect: row.entity ? void 0 : row.onSelect,
14062
14077
  status: row.status,
14063
14078
  doors: row.doors
14064
14079
  }))
@@ -14516,12 +14531,16 @@ function compactCount(n) {
14516
14531
  var import_jsx_runtime92 = require("react/jsx-runtime");
14517
14532
  var HostContext2 = React61.createContext({});
14518
14533
  function ContactValuesHostProvider({ children, ...host }) {
14519
- const value = React61.useMemo(() => host, [host.validateAddress]);
14534
+ const value = React61.useMemo(() => host, [host.validateAddress, host.searchWeb]);
14520
14535
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(HostContext2.Provider, { value, children });
14521
14536
  }
14522
14537
  function useContactValuesHost() {
14523
14538
  return React61.useContext(HostContext2);
14524
14539
  }
14540
+ function useSearchRow() {
14541
+ const { searchWeb } = useContactValuesHost();
14542
+ return (query) => searchWeb ? { text: "Search the web", glyph: SearchIcon, onSelect: () => searchWeb(query) } : { text: "Search the web", glyph: SearchIcon, href: webSearchHref(query) };
14543
+ }
14525
14544
  var markCache = /* @__PURE__ */ new Map();
14526
14545
  function markFor(platform) {
14527
14546
  let glyph = markCache.get(platform);
@@ -14589,9 +14608,23 @@ function usePinnedHover() {
14589
14608
  }, [pinned]);
14590
14609
  return { open: hovered || held || pinned, setHovered, setHeld, setPinned, trigger };
14591
14610
  }
14611
+ function closingOnSelect(record, close) {
14612
+ if (!record.body?.length) return record;
14613
+ const body = record.body.map(
14614
+ (block) => typeof block === "object" && block !== null && "rows" in block && Array.isArray(block.rows) ? { ...block, rows: block.rows.map((row) => row.onSelect ? { ...row, onSelect: () => {
14615
+ close();
14616
+ row.onSelect();
14617
+ } } : row) } : block
14618
+ );
14619
+ return { ...record, body };
14620
+ }
14592
14621
  function ValueShell({ kind, glyph: Glyph, text, copy, state, record: own, peek, wrap, about }) {
14593
- const record = withAbout(own, about);
14594
14622
  const { open, setHovered, setHeld, setPinned, trigger } = usePinnedHover();
14623
+ const record = closingOnSelect(withAbout(own, about), () => {
14624
+ setPinned(false);
14625
+ setHeld(false);
14626
+ setHovered(false);
14627
+ });
14595
14628
  const off = state !== "ok";
14596
14629
  const value = /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: cn("min-w-0", wrap ? "whitespace-pre-line break-words" : "truncate", off ? "text-muted-foreground line-through" : "text-foreground"), children: text });
14597
14630
  const status = off ? /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("span", { className: "shrink-0 text-muted-foreground no-underline", children: `\xB7 ${CONTACT_STATE_LABEL[state]}` }) : null;
@@ -14654,6 +14687,7 @@ var actions = (rows) => ({
14654
14687
  });
14655
14688
  function EmailValue({ email, owner, state = "ok", peek = true, about }) {
14656
14689
  const parsed = parseEmail(email);
14690
+ const searchRow = useSearchRow();
14657
14691
  const ok = state === "ok" && parsed.valid;
14658
14692
  const site = parsed.domain ? parseUrl(parsed.domain) : null;
14659
14693
  const record = {
@@ -14667,7 +14701,7 @@ function EmailValue({ email, owner, state = "ok", peek = true, about }) {
14667
14701
  ...!parsed.valid && state === "ok" ? [{ fact: "Not a complete email address", glyph: LinkOffGlyph, muted: true }] : [],
14668
14702
  ...parsed.domain ? [{ property: "Domain", value: parsed.domain, ...ok && site?.href ? { href: site.href } : {} }] : [],
14669
14703
  actions([
14670
- { text: "Search the web", glyph: SearchIcon, href: webSearchHref(`"${parsed.address}"`) }
14704
+ searchRow(`"${parsed.address}"`)
14671
14705
  ])
14672
14706
  ],
14673
14707
  ...ok ? { primary: { label: "Send email", onSelect: () => window.location.assign(mailtoHref(parsed.address)) } } : {},
@@ -14675,8 +14709,13 @@ function EmailValue({ email, owner, state = "ok", peek = true, about }) {
14675
14709
  };
14676
14710
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(ValueShell, { kind: "email", glyph: MailGlyph, text: parsed.address, copy: parsed.address, state, record, peek, ...about !== void 0 ? { about } : {} });
14677
14711
  }
14712
+ function phoneSearchText(parsed) {
14713
+ const na = parsed.e164?.match(/^\+1(\d{3})(\d{3})(\d{4})$/);
14714
+ return na ? `${na[1]}-${na[2]}-${na[3]}` : parsed.display;
14715
+ }
14678
14716
  function PhoneValue({ phone, owner, state = "ok", peek = true, defaultCallingCode = "1", about }) {
14679
14717
  const parsed = parsePhone(phone, defaultCallingCode);
14718
+ const searchRow = useSearchRow();
14680
14719
  const ok = state === "ok" && parsed.valid;
14681
14720
  const record = {
14682
14721
  kind: "Phone number",
@@ -14692,7 +14731,7 @@ function PhoneValue({ phone, owner, state = "ok", peek = true, defaultCallingCod
14692
14731
  ...parsed.extension ? [{ property: "Extension", value: parsed.extension }] : [],
14693
14732
  actions([
14694
14733
  ok && { text: "Send a text", glyph: MessageSquareGlyph, href: smsHref(parsed) },
14695
- { text: "Search the web", glyph: SearchIcon, href: webSearchHref(`"${parsed.display}"`) }
14734
+ searchRow(phoneSearchText(parsed))
14696
14735
  ])
14697
14736
  ],
14698
14737
  ...ok ? { primary: { label: "Call", onSelect: () => window.location.assign(telHref(parsed)) } } : {},
@@ -14706,6 +14745,7 @@ function AddressValue({ address, owner, state = "ok", peek = true, multiline = f
14706
14745
  const one = addressText(address);
14707
14746
  const lines = typeof address === "string" ? address.split(/\n+/).map((l) => l.trim()).filter(Boolean) : address.map((l) => (l ?? "").trim()).filter(Boolean);
14708
14747
  const { validateAddress } = useContactValuesHost();
14748
+ const searchRow = useSearchRow();
14709
14749
  const [validation, setValidation] = React61.useState({ phase: "idle" });
14710
14750
  React61.useEffect(() => setValidation({ phase: "idle" }), [one]);
14711
14751
  const ok = state === "ok" && one.length > 0;
@@ -14741,7 +14781,7 @@ function AddressValue({ address, owner, state = "ok", peek = true, multiline = f
14741
14781
  ...validationBlock ? [validationBlock] : [],
14742
14782
  actions([
14743
14783
  ok && validateAddress && validation.phase !== "done" && { text: "Open in maps", glyph: MapPinGlyph, href: mapsHref(one) },
14744
- { text: "Search the web", glyph: SearchIcon, href: webSearchHref(one) }
14784
+ searchRow(one)
14745
14785
  ])
14746
14786
  ],
14747
14787
  ...ok && validateAddress && validation.phase !== "done" ? { primary: { label: validation.phase === "checking" ? "Checking\u2026" : "Validate", onSelect: validate } } : ok ? { primary: { label: "Open in maps", onSelect: () => (0, import_outbound2.openOutbound)(mapsHref(validation.phase === "done" && validation.result.formatted ? validation.result.formatted : one)) } } : {},
@@ -14762,7 +14802,7 @@ function AddressValue({ address, owner, state = "ok", peek = true, multiline = f
14762
14802
  }
14763
14803
  );
14764
14804
  }
14765
- function socialRecord(parsed, props, glyph) {
14805
+ function socialRecord(parsed, props, glyph, searchRow) {
14766
14806
  const state = props.state ?? "ok";
14767
14807
  const ok = state === "ok" && Boolean(parsed.href);
14768
14808
  return {
@@ -14778,7 +14818,7 @@ function socialRecord(parsed, props, glyph) {
14778
14818
  ...props.followers != null ? [{ fact: `${compactCount(props.followers)} followers`, glyph: UsersIcon }] : [],
14779
14819
  ...props.owner ? [{ property: "For", value: props.owner }] : [],
14780
14820
  actions([
14781
- { text: "Search the web", glyph: SearchIcon, href: webSearchHref(`${parsed.display} ${parsed.platformName}`) }
14821
+ searchRow(`${parsed.display} ${parsed.platformName}`)
14782
14822
  ])
14783
14823
  ],
14784
14824
  ...ok ? { primary: { label: "Open profile", onSelect: () => (0, import_outbound2.openOutbound)(parsed.href) } } : {},
@@ -14788,6 +14828,7 @@ function socialRecord(parsed, props, glyph) {
14788
14828
  function SocialHandleValue(props) {
14789
14829
  const { value, platform, state = "ok", peek = true } = props;
14790
14830
  const parsed = parseSocial(value, platform);
14831
+ const searchRow = useSearchRow();
14791
14832
  const glyph = parsed.platform === "other" ? AtSignGlyph : markFor(parsed.platform);
14792
14833
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
14793
14834
  ValueShell,
@@ -14797,7 +14838,7 @@ function SocialHandleValue(props) {
14797
14838
  text: parsed.display,
14798
14839
  copy: parsed.handle ? parsed.display : parsed.href ?? parsed.display,
14799
14840
  state,
14800
- record: socialRecord(parsed, props, glyph),
14841
+ record: socialRecord(parsed, props, glyph, searchRow),
14801
14842
  peek,
14802
14843
  ...props.about !== void 0 ? { about: props.about } : {}
14803
14844
  }
@@ -14805,6 +14846,7 @@ function SocialHandleValue(props) {
14805
14846
  }
14806
14847
  function UrlValue({ url, title, owner, state = "ok", peek = true, icon = true, about }) {
14807
14848
  const parsed = parseUrl(url);
14849
+ const searchRow = useSearchRow();
14808
14850
  const ok = state === "ok" && Boolean(parsed.href);
14809
14851
  const record = {
14810
14852
  kind: "Web address",
@@ -14817,7 +14859,7 @@ function UrlValue({ url, title, owner, state = "ok", peek = true, icon = true, a
14817
14859
  { property: "Domain", value: parsed.domain },
14818
14860
  ...owner && title ? [{ property: "For", value: owner }] : [],
14819
14861
  actions([
14820
- { text: "Search the web", glyph: SearchIcon, href: webSearchHref(parsed.domain) }
14862
+ searchRow(parsed.domain)
14821
14863
  ])
14822
14864
  ],
14823
14865
  ...ok ? { primary: { label: "Open", onSelect: () => (0, import_outbound2.openOutbound)(parsed.href) } } : {},