@ox0/ui 3.8.2 → 3.10.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,3 +1,4 @@
1
+ import { type SearchHistory } from "@ox0/hooks";
1
2
  import { type ReactNode } from "react";
2
3
  import { type SearchSource } from "./search-runner";
3
4
  export { defineSearchSource, matchSearchItems } from "./search-runner";
@@ -38,8 +39,14 @@ export interface GlobalSearchProps {
38
39
  * announced politely when it changes. Keep it to a short line or two.
39
40
  */
40
41
  readonly status?: ReactNode;
42
+ /**
43
+ * Recent searches, from `useSearchHistory("<key>")` in `@ox0/hooks`. Listed when the box is
44
+ * empty; picking one searches for it again. A search is recorded when a result is opened from
45
+ * it. Without it, no history is kept.
46
+ */
47
+ readonly history?: SearchHistory;
41
48
  }
42
- declare function GlobalSearchRoot({ children, defaultOpen, emptyState, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, status, }: GlobalSearchProps): ReactNode;
49
+ declare function GlobalSearchRoot({ children, defaultOpen, emptyState, history, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, status, }: GlobalSearchProps): ReactNode;
43
50
  export interface GlobalSearchTriggerProps {
44
51
  /** Text in the box. Default "Search…". */
45
52
  readonly placeholder?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"global-search.d.ts","sourceRoot":"","sources":["../../src/components/global-search.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,SAAS,EAWf,MAAM,OAAO,CAAA;AAOd,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,iBAAiB,CAAA;AAKjE,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACtE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAelE,MAAM,WAAW,oBAAoB;IACnC,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,EAAE,M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C,EAAE,SAAS,CAAA;IACzB,gDAAgD;IAChD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,kDAAkD;IAClD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,CAAA;CAC1B;AAED,mFAAmF;AACnF,wBAAgB,YAAY,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,SAAS,CAqB7F;AAsCD,eAAO,MAAM,YAAY;;;CAGvB,CAAA"}
@@ -1,6 +1,14 @@
1
1
  import { type ReactNode } from "react";
2
+ export type KeyboardVariant = "default" | "flat";
2
3
  export interface KeyboardProps {
3
4
  readonly children?: ReactNode;
5
+ /**
6
+ * `"default"`: a raised key cap on its own surface, for prose and tables.
7
+ * `"flat"`: takes on the surrounding text color with a faint tint and no border — for keys
8
+ * inside a button, menu item, or other colored control.
9
+ * @default "default"
10
+ */
11
+ readonly variant?: KeyboardVariant;
4
12
  }
5
13
  export declare const Keyboard: import("react").ForwardRefExoticComponent<KeyboardProps & import("react").RefAttributes<HTMLElement>>;
6
14
  //# sourceMappingURL=keyboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/components/keyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAElD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAC9B;AAED,eAAO,MAAM,QAAQ,uGAyBnB,CAAA"}
1
+ {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/components/keyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtE,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,CAAA;AAEhD,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAA;CACnC;AA2BD,eAAO,MAAM,QAAQ,uGASnB,CAAA"}
@@ -7,7 +7,10 @@ export interface TagGroupProps extends LayoutItemProps {
7
7
  readonly description?: ReactNode;
8
8
  /** Marks the group invalid. Also implied by `errorMessage`. */
9
9
  readonly isInvalid?: boolean;
10
- /** Disables all tags in the group. */
10
+ /**
11
+ * Disables all tags in the group.
12
+ * @default false
13
+ */
11
14
  readonly isDisabled?: boolean;
12
15
  /** Error message shown below the group. Implies invalid state. */
13
16
  readonly errorMessage?: ReactNode;
@@ -16,6 +19,7 @@ export interface TagGroupProps extends LayoutItemProps {
16
19
  * - `"multiple"` (default) — toggle each tag independently; `aria-multiselectable="true"`
17
20
  * - `"single"` — only one tag selected at a time
18
21
  * - `"none"` — display only, no selection; navigation and removal still work
22
+ * @default "multiple"
19
23
  */
20
24
  readonly selectionMode?: "single" | "multiple" | "none";
21
25
  /** Controlled selected keys. */
@@ -1 +1 @@
1
- {"version":3,"file":"tag-group.d.ts","sourceRoot":"","sources":["../../src/components/tag-group.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,EAAE,KAAK,eAAe,EAAuC,MAAM,uBAAuB,CAAA;AA2BjG,MAAM,WAAW,aAAc,SAAQ,eAAe;IACpD,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAA;IAC1B,yCAAyC;IACzC,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAA;IAChC,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAA;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAA;IAC7B,kEAAkE;IAClE,QAA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AS,CAAA;CAC7B;AAED,wBAAgB,GAAG,CAAC,EAAE,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,QAAQ,GAAG,SAAS,CAoFrF"}
package/dist/index.js CHANGED
@@ -2621,7 +2621,8 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
2621
2621
  align-items: center;
2622
2622
  gap: var(--ox0-space-sm);
2623
2623
  height: var(--ox0-control-height-md);
2624
- min-inline-size: 14rem;
2624
+ min-inline-size: min(14rem, 100%);
2625
+ max-inline-size: 100%;
2625
2626
  padding-inline: var(--ox0-space-md) var(--ox0-space-sm);
2626
2627
  transition: border-color var(--ox0-duration-fast) var(--ox0-ease-crisp);
2627
2628
  display: inline-flex;
@@ -2784,6 +2785,45 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
2784
2785
  background: color-mix(in srgb, var(--ox0-color-foreground) 10%, transparent);
2785
2786
  }
2786
2787
 
2788
+ .recent-oZybBM {
2789
+ align-items: center;
2790
+ gap: var(--ox0-space-sm);
2791
+ display: flex;
2792
+ }
2793
+
2794
+ .recentIcon-MrJTxU {
2795
+ color: var(--ox0-color-muted);
2796
+ display: inline-flex;
2797
+ }
2798
+
2799
+ .recentText-CGQFAg {
2800
+ text-overflow: ellipsis;
2801
+ white-space: nowrap;
2802
+ flex: auto;
2803
+ min-width: 0;
2804
+ overflow: hidden;
2805
+ }
2806
+
2807
+ .removeRecent-yVJYOj {
2808
+ border-radius: var(--ox0-radius-xs);
2809
+ color: var(--ox0-color-muted);
2810
+ cursor: pointer;
2811
+ padding: var(--ox0-space-2xs);
2812
+ visibility: hidden;
2813
+ background: none;
2814
+ border: none;
2815
+ align-items: center;
2816
+ display: inline-flex;
2817
+ }
2818
+
2819
+ .option-qf4Q7q:hover .removeRecent-yVJYOj, .option-qf4Q7q[data-active] .removeRecent-yVJYOj {
2820
+ visibility: visible;
2821
+ }
2822
+
2823
+ .removeRecent-yVJYOj:hover {
2824
+ color: var(--ox0-color-foreground);
2825
+ }
2826
+
2787
2827
  .preview-s52x7t {
2788
2828
  border-inline-start: 1px solid var(--ox0-color-border-subtle);
2789
2829
  min-height: 0;
@@ -2960,6 +3000,10 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
2960
3000
  groupHeading: "groupHeading-wlm1Bd",
2961
3001
  groupStatus: "groupStatus-xQbH9H",
2962
3002
  option: "option-qf4Q7q",
3003
+ recent: "recent-oZybBM",
3004
+ recentIcon: "recentIcon-MrJTxU",
3005
+ recentText: "recentText-CGQFAg",
3006
+ removeRecent: "removeRecent-yVJYOj",
2963
3007
  preview: "preview-s52x7t",
2964
3008
  result: "result-HpbdT2",
2965
3009
  resultIcon: "resultIcon-qmtpm2",
@@ -7582,22 +7626,35 @@ const code_block_CodeBlock = /*#__PURE__*/ forwardRef(function({ children, langu
7582
7626
  })
7583
7627
  });
7584
7628
  });
7585
- const keyboard_Keyboard = /*#__PURE__*/ forwardRef(function({ children }, ref) {
7629
+ const keyboard_base = {
7630
+ display: "inline-block",
7631
+ fontFamily: "var(--ox0-font-mono)",
7632
+ fontSize: "var(--ox0-font-size-xs)",
7633
+ fontWeight: "var(--ox0-font-weight-medium)",
7634
+ lineHeight: 1,
7635
+ padding: "0.2em 0.45em",
7636
+ borderRadius: "var(--ox0-radius-xs)",
7637
+ whiteSpace: "nowrap"
7638
+ };
7639
+ const variants = {
7640
+ default: {
7641
+ background: "var(--ox0-color-surface)",
7642
+ border: "1px solid var(--ox0-color-border)",
7643
+ borderBottomWidth: "2px",
7644
+ color: "var(--ox0-color-foreground)"
7645
+ },
7646
+ flat: {
7647
+ background: "color-mix(in srgb, currentColor 18%, transparent)",
7648
+ border: "none",
7649
+ color: "inherit"
7650
+ }
7651
+ };
7652
+ const keyboard_Keyboard = /*#__PURE__*/ forwardRef(function({ children, variant = "default" }, ref) {
7586
7653
  return /*#__PURE__*/ jsx("kbd", {
7587
7654
  ref: ref,
7588
7655
  style: {
7589
- display: "inline-block",
7590
- fontFamily: "var(--ox0-font-mono)",
7591
- fontSize: "var(--ox0-font-size-xs)",
7592
- fontWeight: "var(--ox0-font-weight-medium)",
7593
- lineHeight: 1,
7594
- padding: "0.2em 0.45em",
7595
- background: "var(--ox0-color-surface)",
7596
- border: "1px solid var(--ox0-color-border)",
7597
- borderBottomWidth: "2px",
7598
- borderRadius: "var(--ox0-radius-xs)",
7599
- color: "var(--ox0-color-foreground)",
7600
- whiteSpace: "nowrap"
7656
+ ...keyboard_base,
7657
+ ...variants[variant]
7601
7658
  },
7602
7659
  children: children
7603
7660
  });
@@ -9272,7 +9329,7 @@ function useGlobalSearch() {
9272
9329
  if (!ctx) throw new Error("useGlobalSearch must be used inside <GlobalSearch>");
9273
9330
  return ctx;
9274
9331
  }
9275
- function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources, status }) {
9332
+ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, history, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources, status }) {
9276
9333
  const os = useOS();
9277
9334
  const [isOpen, setIsOpen] = useControllableState({
9278
9335
  defaultValue: defaultOpen,
@@ -9337,6 +9394,7 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
9337
9394
  }),
9338
9395
  isOpen && anchor ? /*#__PURE__*/ createPortal(/*#__PURE__*/ jsx(SearchPanel, {
9339
9396
  emptyState: emptyState,
9397
+ history: history,
9340
9398
  initialQuery: initialQuery,
9341
9399
  placeholder: placeholder,
9342
9400
  refreshRef: refreshRef,
@@ -9347,7 +9405,7 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
9347
9405
  ]
9348
9406
  });
9349
9407
  }
9350
- function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRef, sources, status }) {
9408
+ function SearchPanel({ emptyState, history, initialQuery, onClose, placeholder, refreshRef, sources, status }) {
9351
9409
  const baseId = useId();
9352
9410
  const listboxId = `${baseId}-listbox`;
9353
9411
  const router = useRouter();
@@ -9368,6 +9426,8 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9368
9426
  const navigateHint = useMessage("ox0.globalSearch.navigate", "Navigate");
9369
9427
  const openHint = useMessage("ox0.globalSearch.open", "Open");
9370
9428
  const closeHint = useMessage("ox0.globalSearch.close", "Close");
9429
+ const recentLabel = useMessage("ox0.globalSearch.recent", "Recent");
9430
+ const removeRecentLabel = useMessage("ox0.globalSearch.removeRecent", "Remove from recent searches");
9371
9431
  useEffect(()=>{
9372
9432
  runner.run(sources, query);
9373
9433
  }, [
@@ -9406,7 +9466,17 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9406
9466
  baseId,
9407
9467
  groups
9408
9468
  ]);
9409
- const active = options.find((option)=>option.id === activeId) ?? options[0];
9469
+ const recents = "" === query.trim() ? (history?.entries ?? []).map((text, index)=>({
9470
+ id: `${baseId}-recent-${index}`,
9471
+ text
9472
+ })) : [];
9473
+ const rowIds = [
9474
+ ...recents.map((recent)=>recent.id),
9475
+ ...options.map((option)=>option.id)
9476
+ ];
9477
+ const activeRowId = null !== activeId && rowIds.includes(activeId) ? activeId : rowIds[0];
9478
+ const activeRecent = recents.find((recent)=>recent.id === activeRowId);
9479
+ const active = options.find((option)=>option.id === activeRowId);
9410
9480
  const isLoading = groups.some((group)=>"loading" === group.status);
9411
9481
  const hasPreviewPane = sources.some((source)=>void 0 !== source.renderPreview);
9412
9482
  const terms = useMemo(()=>query.trim().split(/\s+/).filter(Boolean), [
@@ -9416,15 +9486,16 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9416
9486
  count: String(options.length)
9417
9487
  });
9418
9488
  useEffect(()=>{
9419
- if (!active) return;
9420
- document.getElementById(active.id)?.scrollIntoView?.({
9489
+ if (void 0 === activeRowId) return;
9490
+ document.getElementById(activeRowId)?.scrollIntoView?.({
9421
9491
  block: "nearest"
9422
9492
  });
9423
9493
  }, [
9424
- active
9494
+ activeRowId
9425
9495
  ]);
9426
9496
  function choose(option, inNewTab) {
9427
9497
  const href = option.source.getHref?.(option.item);
9498
+ history?.add(query);
9428
9499
  onClose();
9429
9500
  if (void 0 !== href && isSafeHref(href)) if (inNewTab) window.open(href, "_blank", "noopener,noreferrer");
9430
9501
  else if (router) router.navigate(href);
@@ -9432,10 +9503,21 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9432
9503
  option.source.onAction?.(option.item);
9433
9504
  }
9434
9505
  function move(offset) {
9435
- if (0 === options.length || !active) return;
9436
- const index = options.indexOf(active);
9437
- const next = options[(index + offset + options.length) % options.length];
9438
- if (next) setActiveId(next.id);
9506
+ if (0 === rowIds.length || void 0 === activeRowId) return;
9507
+ const index = rowIds.indexOf(activeRowId);
9508
+ const next = rowIds[(index + offset + rowIds.length) % rowIds.length];
9509
+ if (next) setActiveId(next);
9510
+ }
9511
+ function searchAgain(recent) {
9512
+ setQuery(recent.text);
9513
+ setActiveId(null);
9514
+ inputRef.current?.focus();
9515
+ }
9516
+ function removeRecent(recent) {
9517
+ const index = recents.indexOf(recent);
9518
+ history?.remove(recent.text);
9519
+ const kept = index < recents.length - 1 ? index : index - 1;
9520
+ setActiveId(kept >= 0 ? `${baseId}-recent-${kept}` : null);
9439
9521
  }
9440
9522
  function handleInputKeyDown(e) {
9441
9523
  if (e.nativeEvent.isComposing) return;
@@ -9449,10 +9531,20 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9449
9531
  move(-1);
9450
9532
  break;
9451
9533
  case "Enter":
9534
+ if (activeRecent) {
9535
+ e.preventDefault();
9536
+ searchAgain(activeRecent);
9537
+ return;
9538
+ }
9452
9539
  if (!active) return;
9453
9540
  e.preventDefault();
9454
9541
  choose(active, e.metaKey || e.ctrlKey);
9455
9542
  break;
9543
+ case "Delete":
9544
+ if (!activeRecent || !e.shiftKey) return;
9545
+ e.preventDefault();
9546
+ removeRecent(activeRecent);
9547
+ break;
9456
9548
  case "Escape":
9457
9549
  e.preventDefault();
9458
9550
  if (query) setQuery("");
@@ -9503,10 +9595,10 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9503
9595
  /*#__PURE__*/ jsx(SearchIcon, {}),
9504
9596
  /*#__PURE__*/ jsx("input", {
9505
9597
  ref: inputRef,
9506
- "aria-activedescendant": active?.id,
9598
+ "aria-activedescendant": activeRowId,
9507
9599
  "aria-autocomplete": "list",
9508
9600
  "aria-controls": listboxId,
9509
- "aria-expanded": options.length > 0,
9601
+ "aria-expanded": rowIds.length > 0,
9510
9602
  "aria-label": label,
9511
9603
  autoComplete: "off",
9512
9604
  className: global_search_module.input,
@@ -9532,47 +9624,75 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9532
9624
  children: /*#__PURE__*/ jsxs("div", {
9533
9625
  className: global_search_module.resultsPane,
9534
9626
  children: [
9535
- /*#__PURE__*/ jsx("div", {
9627
+ /*#__PURE__*/ jsxs("div", {
9536
9628
  "aria-label": label,
9537
9629
  className: global_search_module.results,
9538
9630
  id: listboxId,
9539
9631
  role: "listbox",
9540
- children: groups.map((group)=>{
9541
- const groupOptions = options.filter((option)=>option.source === group.source);
9542
- const groupStatus = "error" === group.status ? errorText : "loading" === group.status && 0 === groupOptions.length ? loadingText : null;
9543
- if (0 === groupOptions.length && null === groupStatus) return null;
9544
- const headingId = `${baseId}-${group.source.id}-heading`;
9545
- return /*#__PURE__*/ jsxs("div", {
9632
+ children: [
9633
+ recents.length > 0 ? /*#__PURE__*/ jsxs("div", {
9546
9634
  className: global_search_module.group,
9547
9635
  role: "presentation",
9548
9636
  children: [
9549
- /*#__PURE__*/ jsxs("div", {
9637
+ /*#__PURE__*/ jsx("div", {
9550
9638
  className: global_search_module.groupHeading,
9551
- id: headingId,
9639
+ id: `${baseId}-recent-heading`,
9552
9640
  role: "presentation",
9553
- children: [
9554
- /*#__PURE__*/ jsx("span", {
9555
- children: group.source.label
9556
- }),
9557
- groupStatus ? /*#__PURE__*/ jsx("span", {
9558
- className: global_search_module.groupStatus,
9559
- children: groupStatus
9560
- }) : null
9561
- ]
9641
+ children: /*#__PURE__*/ jsx("span", {
9642
+ children: recentLabel
9643
+ })
9562
9644
  }),
9563
9645
  /*#__PURE__*/ jsx("div", {
9564
- "aria-labelledby": headingId,
9646
+ "aria-labelledby": `${baseId}-recent-heading`,
9565
9647
  role: "group",
9566
- children: groupOptions.map((option)=>/*#__PURE__*/ jsx(ResultRow, {
9567
- isActive: option === active,
9568
- option: option,
9569
- onChoose: choose,
9570
- onHover: setActiveId
9571
- }, option.id))
9648
+ children: recents.map((recent)=>/*#__PURE__*/ jsx(RecentRow, {
9649
+ isActive: recent.id === activeRowId,
9650
+ recent: recent,
9651
+ removeLabel: removeRecentLabel,
9652
+ onChoose: searchAgain,
9653
+ onHover: setActiveId,
9654
+ onRemove: removeRecent
9655
+ }, recent.id))
9572
9656
  })
9573
9657
  ]
9574
- }, group.source.id);
9575
- })
9658
+ }) : null,
9659
+ groups.map((group)=>{
9660
+ const groupOptions = options.filter((option)=>option.source === group.source);
9661
+ const groupStatus = "error" === group.status ? errorText : "loading" === group.status && 0 === groupOptions.length ? loadingText : null;
9662
+ if (0 === groupOptions.length && null === groupStatus) return null;
9663
+ const headingId = `${baseId}-${group.source.id}-heading`;
9664
+ return /*#__PURE__*/ jsxs("div", {
9665
+ className: global_search_module.group,
9666
+ role: "presentation",
9667
+ children: [
9668
+ /*#__PURE__*/ jsxs("div", {
9669
+ className: global_search_module.groupHeading,
9670
+ id: headingId,
9671
+ role: "presentation",
9672
+ children: [
9673
+ /*#__PURE__*/ jsx("span", {
9674
+ children: group.source.label
9675
+ }),
9676
+ groupStatus ? /*#__PURE__*/ jsx("span", {
9677
+ className: global_search_module.groupStatus,
9678
+ children: groupStatus
9679
+ }) : null
9680
+ ]
9681
+ }),
9682
+ /*#__PURE__*/ jsx("div", {
9683
+ "aria-labelledby": headingId,
9684
+ role: "group",
9685
+ children: groupOptions.map((option)=>/*#__PURE__*/ jsx(ResultRow, {
9686
+ isActive: option.id === activeRowId,
9687
+ option: option,
9688
+ onChoose: choose,
9689
+ onHover: setActiveId
9690
+ }, option.id))
9691
+ })
9692
+ ]
9693
+ }, group.source.id);
9694
+ })
9695
+ ]
9576
9696
  }),
9577
9697
  showEmpty ? /*#__PURE__*/ jsx("div", {
9578
9698
  className: global_search_module.empty,
@@ -9639,6 +9759,59 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRe
9639
9759
  ]
9640
9760
  });
9641
9761
  }
9762
+ function RecentRow({ isActive, onChoose, onHover, onRemove, recent, removeLabel }) {
9763
+ const { pressProps } = usePress({
9764
+ onPress: ()=>onChoose(recent),
9765
+ preventFocusOnPress: true
9766
+ });
9767
+ const { pressProps: removePressProps } = usePress({
9768
+ onPress: ()=>onRemove(recent),
9769
+ preventFocusOnPress: true
9770
+ });
9771
+ return /*#__PURE__*/ jsx("div", {
9772
+ ...pressProps,
9773
+ "aria-selected": isActive,
9774
+ className: global_search_module.option,
9775
+ "data-active": isActive || void 0,
9776
+ id: recent.id,
9777
+ role: "option",
9778
+ tabIndex: -1,
9779
+ onPointerMove: ()=>{
9780
+ if (!isActive) onHover(recent.id);
9781
+ },
9782
+ children: /*#__PURE__*/ jsxs("span", {
9783
+ className: global_search_module.recent,
9784
+ children: [
9785
+ /*#__PURE__*/ jsx(HistoryIcon, {}),
9786
+ /*#__PURE__*/ jsx("span", {
9787
+ className: global_search_module.recentText,
9788
+ children: recent.text
9789
+ }),
9790
+ /*#__PURE__*/ jsx("button", {
9791
+ ...removePressProps,
9792
+ "aria-label": removeLabel,
9793
+ className: global_search_module.removeRecent,
9794
+ tabIndex: -1,
9795
+ title: removeLabel,
9796
+ type: "button",
9797
+ children: /*#__PURE__*/ jsx("svg", {
9798
+ "aria-hidden": "true",
9799
+ fill: "none",
9800
+ height: "10",
9801
+ viewBox: "0 0 12 12",
9802
+ width: "10",
9803
+ children: /*#__PURE__*/ jsx("path", {
9804
+ d: "M2 2L10 10M10 2L2 10",
9805
+ stroke: "currentColor",
9806
+ strokeLinecap: "round",
9807
+ strokeWidth: "1.5"
9808
+ })
9809
+ })
9810
+ })
9811
+ ]
9812
+ })
9813
+ });
9814
+ }
9642
9815
  function ResultRow({ isActive, onChoose, onHover, option }) {
9643
9816
  const { pressProps } = usePress({
9644
9817
  onPress: (e)=>onChoose(option, e.metaKey || e.ctrlKey),
@@ -9744,6 +9917,25 @@ function SearchIcon() {
9744
9917
  })
9745
9918
  });
9746
9919
  }
9920
+ function HistoryIcon() {
9921
+ return /*#__PURE__*/ jsx("span", {
9922
+ "aria-hidden": "true",
9923
+ className: global_search_module.recentIcon,
9924
+ children: /*#__PURE__*/ jsx("svg", {
9925
+ fill: "none",
9926
+ height: "14",
9927
+ viewBox: "0 0 14 14",
9928
+ width: "14",
9929
+ children: /*#__PURE__*/ jsx("path", {
9930
+ d: "M2.5 7a4.5 4.5 0 1 0 1.3-3.2M2.5 2v2.5H5M7 4.5V7l1.75 1.25",
9931
+ stroke: "currentColor",
9932
+ strokeLinecap: "round",
9933
+ strokeLinejoin: "round",
9934
+ strokeWidth: "1.3"
9935
+ })
9936
+ })
9937
+ });
9938
+ }
9747
9939
  const GlobalSearch = Object.assign(GlobalSearchRoot, {
9748
9940
  displayName: "GlobalSearch",
9749
9941
  Trigger: GlobalSearchTrigger
@@ -3,7 +3,10 @@ import { type CSSProperties } from "react";
3
3
  export type SpacingToken = "none" | "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "4xl";
4
4
  /** Shared spacing props. Accepted by Stack, Inline, Grid, and Split. */
5
5
  export type SpacingProps = {
6
- /** Gap between direct children. */
6
+ /**
7
+ * Gap between direct children.
8
+ * @default "md"
9
+ */
7
10
  readonly gap?: SpacingToken;
8
11
  /** Padding on all sides. */
9
12
  readonly padding?: SpacingToken;
@@ -1 +1 @@
1
- {"version":3,"file":"spacing.d.ts","sourceR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AAK,CAAA;AAEpG,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG;IACzB;;;OAGG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE,YAAY,CAAA;IAC3B,4BAA4B;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAA;IAC/B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;IAChC,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,CAAC,EAAE,YAAY,CAAA;IAChC,uDAAuD;IACvD,QAAQ,CAAC,UAAU,CAAC,EAAE,YAAY,CAAA;IAClC,yDAAyD;IACzD,QAAQ,CAAC,YAAY,CAAC,EAAE,YAAY,CAAA;IACpC,0DAA0D;IAC1D,QAAQ,CAAC,aAAa,CAAC,EAAE,YAAY,CAAA;IACrC,wDAAwD;IACxD,QAAQ,CAAC,WAAW,CAAC,EAAE,YAAY,CAAA;CACpC,CAAA;AAwBD,+DAA+D;AAC/D,eAAO,MAAM,UAAU,UAAW,YAAY,KAAG;IAAE,KAAK,EAAE,aAAa,CAAA;CA0BtE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ox0/ui",
3
- "version": "3.8.2",
3
+ "version": "3.10.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/esturcke/ox0-platform.git",
@@ -25,9 +25,9 @@
25
25
  "@internationalized/date": "^3.12.4",
26
26
  "react-aria": "^3.52.1",
27
27
  "react-stately": "^3.50.0",
28
- "@ox0/hooks": "0.2.2",
29
- "@ox0/tokens": "0.7.0",
30
- "@ox0/i18n": "0.4.0"
28
+ "@ox0/hooks": "0.3.0",
29
+ "@ox0/i18n": "0.4.0",
30
+ "@ox0/tokens": "0.7.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": "^19.0.0",
@@ -35,7 +35,7 @@
35
35
  "react-intl": "^7.0.0 || ^8.0.0"
36
36
  },
37
37
  "scripts": {
38
- "build": "rslib build -c ../../rslib.config.ts && tsc --build --force tsconfig.build.json",
38
+ "build": "rslib build -c ../../rslib.config.ts && rm -f tsconfig.build.tsbuildinfo && tsc -p tsconfig.build.json",
39
39
  "typecheck": "tsc -p tsconfig.json",
40
40
  "lint": "oxlint .",
41
41
  "test": "vitest run"