@ox0/ui 3.7.0 → 3.8.1
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.
|
@@ -6,6 +6,12 @@ export interface GlobalSearchControls {
|
|
|
6
6
|
/** Opens the search, optionally starting with `query`. */
|
|
7
7
|
readonly open: (query?: string) => void;
|
|
8
8
|
readonly close: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Re-runs the current query in the background — results update in place, without a loading
|
|
11
|
+
* state. Call it when the data behind a source changes (e.g. on an interval while documents are
|
|
12
|
+
* still being indexed). Does nothing while the search is closed.
|
|
13
|
+
*/
|
|
14
|
+
readonly refresh: () => void;
|
|
9
15
|
readonly isOpen: boolean;
|
|
10
16
|
/** The shortcut as shown to this user: "⌘K" on macOS, "Ctrl K" elsewhere. */
|
|
11
17
|
readonly shortcutLabel: string;
|
|
@@ -26,8 +32,14 @@ export interface GlobalSearchProps {
|
|
|
26
32
|
readonly placeholder?: string;
|
|
27
33
|
/** Shown instead of the default message when a query has no results. */
|
|
28
34
|
readonly emptyState?: ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* Notices about the results as a whole — "3 documents still being read", "text search
|
|
37
|
+
* unavailable". Shown in a strip above the key hints whether or not anything matched, and
|
|
38
|
+
* announced politely when it changes. Keep it to a short line or two.
|
|
39
|
+
*/
|
|
40
|
+
readonly status?: ReactNode;
|
|
29
41
|
}
|
|
30
|
-
declare function GlobalSearchRoot({ children, defaultOpen, emptyState, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, }: GlobalSearchProps): ReactNode;
|
|
42
|
+
declare function GlobalSearchRoot({ children, defaultOpen, emptyState, isOpen: isOpenProp, isShortcutDisabled, onOpenChange, placeholder, sources, status, }: GlobalSearchProps): ReactNode;
|
|
31
43
|
export interface GlobalSearchTriggerProps {
|
|
32
44
|
/** Text in the box. Default "Search…". */
|
|
33
45
|
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,
|
|
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,MAAM,KAAK,IAAI,CAAA;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,IAAI,CAAA;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAA;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,6EAA6E;IAC7E,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAID,oEAAoE;AACpE,wBAAgB,eAAe,IAAI,oBAAoB,CAItD;AAID,MAAM,WAAW,iBAAiB;IAChC,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;IAC7B,yFAAyF;IACzF,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,CAAC,OAAO,CAAC,EAAE,CAAA;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAA;IACjD,0CAA0C;IAC1C,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IACrC,4CAA4C;IAC5C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAA;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAA;CAC5B;AAED,iBAAS,gBAAgB,CAAC,EACxB,QAAQ,EACR,WAAmB,EACnB,UAAU,EACV,MAAM,EAAE,UAAU,EAClB,kBAA0B,EAC1B,YAAY,EACZ,WAAW,EACX,OAAO,EACP,MAAM,GACP,EAAE,iBAAiB,GAAG,SAAS,CAmE/B;AAiUD,MAAM,WAAW,wBAAwB;IACvC,0CAA0C;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAC9B;AAED,+EAA+E;AAC/E,iBAAS,mBAAmB,CAAC,EAAE,WAAW,EAAE,EAAE,wBAAwB,GAAG,SAAS,CAmBjF;AAID,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,CAAC,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;AAsBD,eAAO,MAAM,YAAY;;;CAGvB,CAAA"}
|
|
@@ -57,11 +57,18 @@ export declare class SearchRunner {
|
|
|
57
57
|
private readonly listeners;
|
|
58
58
|
private controller;
|
|
59
59
|
private timers;
|
|
60
|
+
private last;
|
|
60
61
|
readonly subscribe: (listener: () => void) => (() => void);
|
|
61
62
|
readonly getSnapshot: () => readonly SearchGroup[];
|
|
62
63
|
run(sources: readonly SearchSource<unknown>[], query: string): void;
|
|
64
|
+
/**
|
|
65
|
+
* Re-runs the last query in the background: groups keep their items and status until the new
|
|
66
|
+
* results land, so a periodic refresh doesn't flash "Searching…" or a spinner. Debounce is skipped.
|
|
67
|
+
*/
|
|
68
|
+
refresh(): void;
|
|
69
|
+
private execute;
|
|
63
70
|
cancel(): void;
|
|
64
|
-
private
|
|
71
|
+
private startSource;
|
|
65
72
|
private update;
|
|
66
73
|
private emit;
|
|
67
74
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-runner.d.ts","sourceRoot":"","sources":["../../src/components/search-runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,qDAAqD;IACrD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,qDAAqD;IACrD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAA;IACvB,oFAAoF;IACpF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;IAChC,6FAA6F;IAC7F,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;IAC5B,iFAAiF;IACjF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAA;IACnF,gCAAgC;IAChC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,MAAM,CAAA;IACvB,mEAAmE;IACnE,YAAY,CAAC,IAAI,EAAE,CAAC,GAA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ACnC;AAID;;;;GAIG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAA6B;IAC3C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwB;IAClD,OAAO,CAAC,UAAU,CAA+B;IACjD,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,IAAI,CAA4E;IAExF,QAAQ,CAAC,SAAS,aAAc,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC,CAKxD;IAED,QAAQ,CAAC,WAAW,QAAO,SAAS,WAAW,EAAE,CAAe;IAEhE,GAAG,CAAC,OAAO,EAAE,SAAS,YAAY,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAElE;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,CAEd;IAED,OAAO,CAAC,OAAO;IA+Bf,MAAM,IAAI,IAAI,CAKb;IAED,OAAO,CAAC,WAAW;IAsBnB,OAAO,CAAC,MAAM;IAYd,OAAO,CAAC,IAAI;CAGb;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAChC,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC3B,CAAC,EAAE,CAmBL"}
|
package/dist/index.js
CHANGED
|
@@ -2672,7 +2672,7 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2672
2672
|
border-radius: var(--ox0-radius-lg);
|
|
2673
2673
|
box-shadow: var(--ox0-shadow-modal);
|
|
2674
2674
|
color: var(--ox0-color-foreground);
|
|
2675
|
-
grid-template-rows: auto minmax(0, 1fr) auto;
|
|
2675
|
+
grid-template-rows: auto minmax(0, 1fr) auto auto;
|
|
2676
2676
|
width: min(100%, 40rem);
|
|
2677
2677
|
max-height: min(76vh, 36rem);
|
|
2678
2678
|
margin: 0;
|
|
@@ -2851,6 +2851,18 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2851
2851
|
flex: none;
|
|
2852
2852
|
}
|
|
2853
2853
|
|
|
2854
|
+
.status-ZysnH5 {
|
|
2855
|
+
border-top: 1px solid var(--ox0-color-border-subtle);
|
|
2856
|
+
color: var(--ox0-color-muted);
|
|
2857
|
+
font-size: var(--ox0-font-size-xs);
|
|
2858
|
+
padding: var(--ox0-space-sm) var(--ox0-space-lg);
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
.status-ZysnH5:empty {
|
|
2862
|
+
border-top: none;
|
|
2863
|
+
padding: 0;
|
|
2864
|
+
}
|
|
2865
|
+
|
|
2854
2866
|
.footer-umLGpy {
|
|
2855
2867
|
border-top: 1px solid var(--ox0-color-border-subtle);
|
|
2856
2868
|
color: var(--ox0-color-muted);
|
|
@@ -2955,6 +2967,7 @@ label:hover > .control-TGnWDN[aria-invalid="true"]:not(:disabled) {
|
|
|
2955
2967
|
resultTitle: "resultTitle-hu7e5s",
|
|
2956
2968
|
resultDescription: "resultDescription-UcRTCD",
|
|
2957
2969
|
resultMeta: "resultMeta-wVHGW8",
|
|
2970
|
+
status: "status-ZysnH5",
|
|
2958
2971
|
footer: "footer-umLGpy",
|
|
2959
2972
|
hint: "hint-u3aolN",
|
|
2960
2973
|
visuallyHidden: "visuallyHidden-VtiEjb"
|
|
@@ -8687,6 +8700,7 @@ function ConfirmDialog({ cancelLabel, children, confirmLabel, isOpen, isPending
|
|
|
8687
8700
|
children: [
|
|
8688
8701
|
/*#__PURE__*/ jsx(button_Button, {
|
|
8689
8702
|
isDisabled: isPending,
|
|
8703
|
+
variant: "ghost",
|
|
8690
8704
|
onPress: onCancel,
|
|
8691
8705
|
children: cancelLabel ?? defaultCancel
|
|
8692
8706
|
}),
|
|
@@ -8764,6 +8778,7 @@ function ConfirmPopover({ anchor, cancelLabel, children, confirmLabel, isOpen, o
|
|
|
8764
8778
|
/*#__PURE__*/ jsx(button_Button, {
|
|
8765
8779
|
ref: cancelRef,
|
|
8766
8780
|
size: "sm",
|
|
8781
|
+
variant: "ghost",
|
|
8767
8782
|
onPress: onCancel,
|
|
8768
8783
|
children: cancelLabel ?? defaultCancel
|
|
8769
8784
|
}),
|
|
@@ -9126,6 +9141,7 @@ class SearchRunner {
|
|
|
9126
9141
|
listeners = new Set();
|
|
9127
9142
|
controller = null;
|
|
9128
9143
|
timers = [];
|
|
9144
|
+
last = null;
|
|
9129
9145
|
subscribe = (listener)=>{
|
|
9130
9146
|
this.listeners.add(listener);
|
|
9131
9147
|
return ()=>{
|
|
@@ -9134,7 +9150,17 @@ class SearchRunner {
|
|
|
9134
9150
|
};
|
|
9135
9151
|
getSnapshot = ()=>this.groups;
|
|
9136
9152
|
run(sources, query) {
|
|
9153
|
+
this.execute(sources, query, false);
|
|
9154
|
+
}
|
|
9155
|
+
refresh() {
|
|
9156
|
+
if (this.last) this.execute(this.last.sources, this.last.query, true);
|
|
9157
|
+
}
|
|
9158
|
+
execute(sources, query, isBackground) {
|
|
9137
9159
|
this.cancel();
|
|
9160
|
+
this.last = {
|
|
9161
|
+
sources,
|
|
9162
|
+
query
|
|
9163
|
+
};
|
|
9138
9164
|
const controller = new AbortController();
|
|
9139
9165
|
this.controller = controller;
|
|
9140
9166
|
const trimmed = query.trim();
|
|
@@ -9148,16 +9174,18 @@ class SearchRunner {
|
|
|
9148
9174
|
items: [],
|
|
9149
9175
|
status: "idle"
|
|
9150
9176
|
};
|
|
9177
|
+
const prior = previous.get(source.id);
|
|
9178
|
+
if (isBackground && prior && "idle" !== prior.status) return prior;
|
|
9151
9179
|
return {
|
|
9152
9180
|
source,
|
|
9153
|
-
items:
|
|
9181
|
+
items: prior?.items ?? [],
|
|
9154
9182
|
status: "loading"
|
|
9155
9183
|
};
|
|
9156
9184
|
});
|
|
9157
9185
|
sources.forEach((source, index)=>{
|
|
9158
9186
|
if (this.groups[index]?.status === "idle") return;
|
|
9159
|
-
const start = ()=>this.
|
|
9160
|
-
const delay = source.debounceMs ?? 0;
|
|
9187
|
+
const start = ()=>this.startSource(source, index, trimmed, controller);
|
|
9188
|
+
const delay = isBackground ? 0 : source.debounceMs ?? 0;
|
|
9161
9189
|
if (delay > 0) this.timers.push(setTimeout(start, delay));
|
|
9162
9190
|
else start();
|
|
9163
9191
|
});
|
|
@@ -9169,7 +9197,7 @@ class SearchRunner {
|
|
|
9169
9197
|
this.controller?.abort();
|
|
9170
9198
|
this.controller = null;
|
|
9171
9199
|
}
|
|
9172
|
-
|
|
9200
|
+
startSource(source, index, query, controller) {
|
|
9173
9201
|
let result;
|
|
9174
9202
|
try {
|
|
9175
9203
|
result = source.search(query, {
|
|
@@ -9250,7 +9278,7 @@ function useGlobalSearch() {
|
|
|
9250
9278
|
if (!ctx) throw new Error("useGlobalSearch must be used inside <GlobalSearch>");
|
|
9251
9279
|
return ctx;
|
|
9252
9280
|
}
|
|
9253
|
-
function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources }) {
|
|
9281
|
+
function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: isOpenProp, isShortcutDisabled = false, onOpenChange, placeholder, sources, status }) {
|
|
9254
9282
|
const os = useOS();
|
|
9255
9283
|
const [isOpen, setIsOpen] = useControllableState({
|
|
9256
9284
|
defaultValue: defaultOpen,
|
|
@@ -9270,6 +9298,8 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9270
9298
|
const close = useCallback(()=>setIsOpen(false), [
|
|
9271
9299
|
setIsOpen
|
|
9272
9300
|
]);
|
|
9301
|
+
const refreshRef = useRef(null);
|
|
9302
|
+
const refresh = useCallback(()=>refreshRef.current?.(), []);
|
|
9273
9303
|
useEffect(()=>{
|
|
9274
9304
|
if (isShortcutDisabled) return;
|
|
9275
9305
|
const handler = (e)=>{
|
|
@@ -9294,11 +9324,13 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9294
9324
|
close,
|
|
9295
9325
|
isOpen,
|
|
9296
9326
|
open,
|
|
9327
|
+
refresh,
|
|
9297
9328
|
shortcutLabel
|
|
9298
9329
|
}), [
|
|
9299
9330
|
close,
|
|
9300
9331
|
isOpen,
|
|
9301
9332
|
open,
|
|
9333
|
+
refresh,
|
|
9302
9334
|
shortcutLabel
|
|
9303
9335
|
]);
|
|
9304
9336
|
return /*#__PURE__*/ jsxs(GlobalSearchContext.Provider, {
|
|
@@ -9313,13 +9345,15 @@ function GlobalSearchRoot({ children, defaultOpen = false, emptyState, isOpen: i
|
|
|
9313
9345
|
emptyState: emptyState,
|
|
9314
9346
|
initialQuery: initialQuery,
|
|
9315
9347
|
placeholder: placeholder,
|
|
9348
|
+
refreshRef: refreshRef,
|
|
9316
9349
|
sources: sources,
|
|
9350
|
+
status: status,
|
|
9317
9351
|
onClose: close
|
|
9318
9352
|
}), themeRoot(anchor) ?? document.body) : null
|
|
9319
9353
|
]
|
|
9320
9354
|
});
|
|
9321
9355
|
}
|
|
9322
|
-
function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }) {
|
|
9356
|
+
function SearchPanel({ emptyState, initialQuery, onClose, placeholder, refreshRef, sources, status }) {
|
|
9323
9357
|
const baseId = useId();
|
|
9324
9358
|
const listboxId = `${baseId}-listbox`;
|
|
9325
9359
|
const router = useRouter();
|
|
@@ -9350,6 +9384,15 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9350
9384
|
useEffect(()=>()=>runner.cancel(), [
|
|
9351
9385
|
runner
|
|
9352
9386
|
]);
|
|
9387
|
+
useEffect(()=>{
|
|
9388
|
+
refreshRef.current = ()=>runner.refresh();
|
|
9389
|
+
return ()=>{
|
|
9390
|
+
refreshRef.current = null;
|
|
9391
|
+
};
|
|
9392
|
+
}, [
|
|
9393
|
+
refreshRef,
|
|
9394
|
+
runner
|
|
9395
|
+
]);
|
|
9353
9396
|
useEffect(()=>{
|
|
9354
9397
|
const previouslyFocused = document.activeElement;
|
|
9355
9398
|
inputRef.current?.focus();
|
|
@@ -9502,8 +9545,8 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9502
9545
|
role: "listbox",
|
|
9503
9546
|
children: groups.map((group)=>{
|
|
9504
9547
|
const groupOptions = options.filter((option)=>option.source === group.source);
|
|
9505
|
-
const
|
|
9506
|
-
if (0 === groupOptions.length && null ===
|
|
9548
|
+
const groupStatus = "error" === group.status ? errorText : "loading" === group.status && 0 === groupOptions.length ? loadingText : null;
|
|
9549
|
+
if (0 === groupOptions.length && null === groupStatus) return null;
|
|
9507
9550
|
const headingId = `${baseId}-${group.source.id}-heading`;
|
|
9508
9551
|
return /*#__PURE__*/ jsxs("div", {
|
|
9509
9552
|
className: global_search_module.group,
|
|
@@ -9517,9 +9560,9 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9517
9560
|
/*#__PURE__*/ jsx("span", {
|
|
9518
9561
|
children: group.source.label
|
|
9519
9562
|
}),
|
|
9520
|
-
|
|
9563
|
+
groupStatus ? /*#__PURE__*/ jsx("span", {
|
|
9521
9564
|
className: global_search_module.groupStatus,
|
|
9522
|
-
children:
|
|
9565
|
+
children: groupStatus
|
|
9523
9566
|
}) : null
|
|
9524
9567
|
]
|
|
9525
9568
|
}),
|
|
@@ -9551,6 +9594,11 @@ function SearchPanel({ emptyState, initialQuery, onClose, placeholder, sources }
|
|
|
9551
9594
|
}) : null
|
|
9552
9595
|
]
|
|
9553
9596
|
}),
|
|
9597
|
+
/*#__PURE__*/ jsx("div", {
|
|
9598
|
+
"aria-live": "polite",
|
|
9599
|
+
className: global_search_module.status,
|
|
9600
|
+
children: status
|
|
9601
|
+
}),
|
|
9554
9602
|
/*#__PURE__*/ jsxs("div", {
|
|
9555
9603
|
"aria-hidden": "true",
|
|
9556
9604
|
className: global_search_module.footer,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox0/ui",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.1",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/esturcke/ox0-platform.git",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"react-aria": "^3.52.1",
|
|
27
27
|
"react-stately": "^3.50.0",
|
|
28
28
|
"@ox0/hooks": "0.2.2",
|
|
29
|
-
"@ox0/
|
|
30
|
-
"@ox0/
|
|
29
|
+
"@ox0/i18n": "0.4.0",
|
|
30
|
+
"@ox0/tokens": "0.7.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": "^19.0.0",
|