@gusnips/react 0.1.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/LICENSE +21 -0
- package/README.md +180 -0
- package/dist/api-client.d.ts +139 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +133 -0
- package/dist/api-client.js.map +1 -0
- package/dist/api-error.d.ts +45 -0
- package/dist/api-error.d.ts.map +1 -0
- package/dist/api-error.js +52 -0
- package/dist/api-error.js.map +1 -0
- package/dist/auth-store.d.ts +49 -0
- package/dist/auth-store.d.ts.map +1 -0
- package/dist/auth-store.js +27 -0
- package/dist/auth-store.js.map +1 -0
- package/dist/chunk-reload.d.ts +61 -0
- package/dist/chunk-reload.d.ts.map +1 -0
- package/dist/chunk-reload.js +92 -0
- package/dist/chunk-reload.js.map +1 -0
- package/dist/cn.d.ts +13 -0
- package/dist/cn.d.ts.map +1 -0
- package/dist/cn.js +16 -0
- package/dist/cn.js.map +1 -0
- package/dist/describe-error.d.ts +74 -0
- package/dist/describe-error.d.ts.map +1 -0
- package/dist/describe-error.js +70 -0
- package/dist/describe-error.js.map +1 -0
- package/dist/error-boundary.d.ts +61 -0
- package/dist/error-boundary.d.ts.map +1 -0
- package/dist/error-boundary.js +32 -0
- package/dist/error-boundary.js.map +1 -0
- package/dist/guards.d.ts +65 -0
- package/dist/guards.d.ts.map +1 -0
- package/dist/guards.js +52 -0
- package/dist/guards.js.map +1 -0
- package/dist/hydrate.d.ts +30 -0
- package/dist/hydrate.d.ts.map +1 -0
- package/dist/hydrate.js +25 -0
- package/dist/hydrate.js.map +1 -0
- package/dist/i18n.d.ts +70 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +66 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/index.js.map +1 -0
- package/dist/prerender-contract.d.ts +30 -0
- package/dist/prerender-contract.d.ts.map +1 -0
- package/dist/prerender-contract.js +30 -0
- package/dist/prerender-contract.js.map +1 -0
- package/dist/query.d.ts +28 -0
- package/dist/query.d.ts.map +1 -0
- package/dist/query.js +51 -0
- package/dist/query.js.map +1 -0
- package/dist/sse.d.ts +64 -0
- package/dist/sse.d.ts.map +1 -0
- package/dist/sse.js +105 -0
- package/dist/sse.js.map +1 -0
- package/dist/states.d.ts +69 -0
- package/dist/states.d.ts.map +1 -0
- package/dist/states.js +2 -0
- package/dist/states.js.map +1 -0
- package/dist/ui/class-name.d.ts +16 -0
- package/dist/ui/class-name.d.ts.map +1 -0
- package/dist/ui/class-name.js +13 -0
- package/dist/ui/class-name.js.map +1 -0
- package/dist/ui/combobox.d.ts +81 -0
- package/dist/ui/combobox.d.ts.map +1 -0
- package/dist/ui/combobox.js +70 -0
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/dialog.d.ts +39 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +32 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/drawer.d.ts +63 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/drawer.js +55 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/glyphs.d.ts +4 -0
- package/dist/ui/glyphs.d.ts.map +1 -0
- package/dist/ui/glyphs.js +20 -0
- package/dist/ui/glyphs.js.map +1 -0
- package/dist/ui/index.d.ts +9 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +48 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input.d.ts +45 -0
- package/dist/ui/input.d.ts.map +1 -0
- package/dist/ui/input.js +108 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/menu.d.ts +70 -0
- package/dist/ui/menu.d.ts.map +1 -0
- package/dist/ui/menu.js +85 -0
- package/dist/ui/menu.js.map +1 -0
- package/dist/ui/select.d.ts +69 -0
- package/dist/ui/select.d.ts.map +1 -0
- package/dist/ui/select.js +48 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/tabs.d.ts +52 -0
- package/dist/ui/tabs.d.ts.map +1 -0
- package/dist/ui/tabs.js +62 -0
- package/dist/ui/tabs.js.map +1 -0
- package/package.json +124 -0
- package/src/api-client.test.ts +256 -0
- package/src/api-client.ts +305 -0
- package/src/api-error.ts +60 -0
- package/src/auth-store.ts +59 -0
- package/src/chunk-reload.test.ts +46 -0
- package/src/chunk-reload.ts +94 -0
- package/src/cn.ts +16 -0
- package/src/describe-error.test.ts +102 -0
- package/src/describe-error.ts +140 -0
- package/src/error-boundary.tsx +88 -0
- package/src/guards.tsx +99 -0
- package/src/hydrate.ts +36 -0
- package/src/i18n.test.ts +68 -0
- package/src/i18n.ts +101 -0
- package/src/index.ts +63 -0
- package/src/prerender-contract.ts +31 -0
- package/src/query.test.ts +54 -0
- package/src/query.ts +79 -0
- package/src/sse.test.ts +50 -0
- package/src/sse.ts +117 -0
- package/src/states.ts +71 -0
- package/src/ui/class-name.ts +23 -0
- package/src/ui/combobox.test.ts +32 -0
- package/src/ui/combobox.tsx +242 -0
- package/src/ui/dialog.tsx +87 -0
- package/src/ui/drawer.tsx +161 -0
- package/src/ui/focus.test.ts +82 -0
- package/src/ui/glyphs.tsx +35 -0
- package/src/ui/index.ts +145 -0
- package/src/ui/input.test.ts +22 -0
- package/src/ui/input.tsx +181 -0
- package/src/ui/menu.test.ts +73 -0
- package/src/ui/menu.tsx +186 -0
- package/src/ui/select.tsx +191 -0
- package/src/ui/tabs.tsx +95 -0
package/dist/states.d.ts
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* The two contracts that make "never dead-end the user" a compile error instead of a rule
|
|
4
|
+
* somebody remembers.
|
|
5
|
+
*
|
|
6
|
+
* **No component ships here, on purpose.** Seven repos have an `EmptyState.tsx` and an
|
|
7
|
+
* `ErrorState.tsx`, and read side by side they overlap 9–37%: one draws a tinted icon badge,
|
|
8
|
+
* one a branded illustration set, one a mascot. What they genuinely share is the PROP SHAPE —
|
|
9
|
+
* which is the rule itself, and the only part a package can hold without deciding how eight
|
|
10
|
+
* brands look. Same reasoning as the styled Button: share behaviour, skin per product.
|
|
11
|
+
*
|
|
12
|
+
* Import the type, write your own component against it, and the compiler enforces the rest.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* A panel with nothing in it yet.
|
|
16
|
+
*
|
|
17
|
+
* The prop shape IS the rule: somebody who lands here must learn what this panel is FOR
|
|
18
|
+
* (`title`), what belongs IN it (`description`), and how to FILL it (`action`). The first two
|
|
19
|
+
* are required because two of the three are what make it an orientation rather than a shrug.
|
|
20
|
+
* `action` is optional only because some panels fill themselves once a job upstream finishes.
|
|
21
|
+
*/
|
|
22
|
+
export interface EmptyStateProps {
|
|
23
|
+
/** What this panel is for. "No lookups yet" — not "No results". */
|
|
24
|
+
title: string;
|
|
25
|
+
/** What belongs here, and what it will show once it does. */
|
|
26
|
+
description: ReactNode;
|
|
27
|
+
/** The way forward, as a control. Usually one button. */
|
|
28
|
+
action?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* `3` inside a panel that already sits under a page heading — the default and the common
|
|
31
|
+
* case. `1` when this composer IS the page (a 404, a suspended account), which otherwise
|
|
32
|
+
* ships a document with no `h1` in it at all.
|
|
33
|
+
*
|
|
34
|
+
* Only one donor had this, and it is the difference between a screen reader announcing a
|
|
35
|
+
* page and announcing nothing.
|
|
36
|
+
*/
|
|
37
|
+
headingLevel?: 1 | 2 | 3;
|
|
38
|
+
className?: string;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Something did not work.
|
|
42
|
+
*
|
|
43
|
+
* `problem` names what failed, `cause` says why it most likely happened, `fix` says what to do
|
|
44
|
+
* about it, and `action` is that fix as a control. **`fix` and `action` are both required** — a
|
|
45
|
+
* required prop is the only version of "never dead-end" that a caller in a hurry cannot skip,
|
|
46
|
+
* and the donor that made them required is the one whose error screens all have a way out.
|
|
47
|
+
*
|
|
48
|
+
* Not a place for a stack trace. `cause` is what a person can act on ("the site answered too
|
|
49
|
+
* slowly"), with the request id, if there is one, alongside it in `reference`.
|
|
50
|
+
*
|
|
51
|
+
* {@link DescribedError} from `describe-error.ts` produces `cause` and `fix` from a thrown
|
|
52
|
+
* `ApiError`, which is the seam these two were designed against.
|
|
53
|
+
*/
|
|
54
|
+
export interface ErrorStateProps {
|
|
55
|
+
/** What failed, in the reader's words. "Couldn't load your numbers". */
|
|
56
|
+
problem: string;
|
|
57
|
+
/** Why it most likely happened. */
|
|
58
|
+
cause?: ReactNode;
|
|
59
|
+
/** The way forward, in words. */
|
|
60
|
+
fix: ReactNode;
|
|
61
|
+
/** The way forward, as a control — usually a retry button. */
|
|
62
|
+
action: ReactNode;
|
|
63
|
+
/** A request id or code, for a support thread. Set in mono, never shouted. */
|
|
64
|
+
reference?: ReactNode;
|
|
65
|
+
/** See {@link EmptyStateProps.headingLevel}. */
|
|
66
|
+
headingLevel?: 1 | 2 | 3;
|
|
67
|
+
className?: string;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=states.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.d.ts","sourceRoot":"","sources":["../src/states.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,WAAW,EAAE,SAAS,CAAC;IACvB,yDAAyD;IACzD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,eAAe;IAC9B,wEAAwE;IACxE,OAAO,EAAE,MAAM,CAAC;IAChB,mCAAmC;IACnC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,iCAAiC;IACjC,GAAG,EAAE,SAAS,CAAC;IACf,8DAA8D;IAC9D,MAAM,EAAE,SAAS,CAAC;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,gDAAgD;IAChD,YAAY,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/states.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"states.js","sourceRoot":"","sources":["../src/states.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ClassValue } from "clsx";
|
|
2
|
+
/**
|
|
3
|
+
* A Base UI part's `className`: a plain string, or a function of that part's own state
|
|
4
|
+
* (`open`, `transitionStatus`, `highlighted`, …).
|
|
5
|
+
*/
|
|
6
|
+
export type StateClassName<State> = string | ((state: State) => string | undefined) | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Merge a wrapper's own classes with the caller's, keeping BOTH forms working.
|
|
9
|
+
*
|
|
10
|
+
* `cn()` on its own silently DROPS the function form — clsx walks strings, arrays and plain
|
|
11
|
+
* objects, and a function is none of the three — so a caller styling by `open` or
|
|
12
|
+
* `transitionStatus` would get an empty class and no warning. Always returning a function
|
|
13
|
+
* keeps one code path for both.
|
|
14
|
+
*/
|
|
15
|
+
export declare function mergeClassName<State>(base: ClassValue, extra: StateClassName<State>): (state: State) => string;
|
|
16
|
+
//# sourceMappingURL=class-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-name.d.ts","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGvC;;;GAGG;AACH,MAAM,MAAM,cAAc,CAAC,KAAK,IAAI,MAAM,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;AAEhG;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAClC,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,GAC3B,CAAC,KAAK,EAAE,KAAK,KAAK,MAAM,CAE1B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { cn } from "../cn.js";
|
|
2
|
+
/**
|
|
3
|
+
* Merge a wrapper's own classes with the caller's, keeping BOTH forms working.
|
|
4
|
+
*
|
|
5
|
+
* `cn()` on its own silently DROPS the function form — clsx walks strings, arrays and plain
|
|
6
|
+
* objects, and a function is none of the three — so a caller styling by `open` or
|
|
7
|
+
* `transitionStatus` would get an empty class and no warning. Always returning a function
|
|
8
|
+
* keeps one code path for both.
|
|
9
|
+
*/
|
|
10
|
+
export function mergeClassName(base, extra) {
|
|
11
|
+
return (state) => cn(base, typeof extra === "function" ? extra(state) : extra);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=class-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"class-name.js","sourceRoot":"","sources":["../../src/ui/class-name.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAQ9B;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAgB,EAChB,KAA4B;IAE5B,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AACjF,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Combobox as Primitive } from "@base-ui/react/combobox";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import { type StateClassName } from "./class-name.ts";
|
|
4
|
+
export declare const ComboboxRoot: typeof Primitive.Root;
|
|
5
|
+
export declare const ComboboxInput: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteInputProps, "ref"> & import("react").RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export declare const ComboboxInputGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxInputGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const ComboboxTrigger: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxTriggerProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export declare const ComboboxClear: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteClearProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
export declare const ComboboxPortal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const ComboboxPositioner: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePositionerProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const ComboboxPopup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompletePopupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
12
|
+
export declare const ComboboxList: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteListProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const ComboboxItem: import("react").NamedExoticComponent<Omit<import("@base-ui/react").ComboboxItemProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export declare const ComboboxEmpty: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteEmptyProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export declare const ComboboxGroup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export declare const ComboboxGroupLabel: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AutocompleteGroupLabelProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
/**
|
|
18
|
+
* What the input shows: the QUERY while the list is open, the selected item's LABEL while it
|
|
19
|
+
* is closed.
|
|
20
|
+
*
|
|
21
|
+
* The two are different strings and swapping them is the whole job. Show the label while
|
|
22
|
+
* typing and every keystroke is overwritten by the old selection; show the query while
|
|
23
|
+
* closed and the field goes blank the moment focus leaves, even though a value is set.
|
|
24
|
+
*/
|
|
25
|
+
export declare function comboboxInputValue<T>(open: boolean, query: string, value: T | null, getLabel: (item: T) => string): string;
|
|
26
|
+
/** A loading state needs the line that says so — there is no default, and no English. */
|
|
27
|
+
type ComboboxLoadingState = {
|
|
28
|
+
loading: boolean;
|
|
29
|
+
loadingHint: ReactNode;
|
|
30
|
+
} | {
|
|
31
|
+
loading?: undefined;
|
|
32
|
+
loadingHint?: undefined;
|
|
33
|
+
};
|
|
34
|
+
export type ComboboxProps<T> = Omit<Primitive.Root.Props<T, false, T>, "children" | "items" | "filteredItems" | "filter" | "value" | "defaultValue" | "multiple" | "open" | "defaultOpen" | "inputValue" | "defaultInputValue" | "onInputValueChange" | "itemToStringLabel" | "isItemEqualToValue"> & {
|
|
35
|
+
value: T | null;
|
|
36
|
+
/**
|
|
37
|
+
* Items for the current query. Filtering is yours: this passes `filter={null}` to Base UI,
|
|
38
|
+
* so the list shows exactly what you return — a server search, a fuzzy match, a bounded
|
|
39
|
+
* page. Bound it here if it needs bounding; there is no cap in the wrapper, because a cap
|
|
40
|
+
* would quietly truncate a list a caller meant to show whole.
|
|
41
|
+
*/
|
|
42
|
+
search: (query: string) => readonly T[];
|
|
43
|
+
/** Stable identity of an item: its React key, and how two items are compared. */
|
|
44
|
+
getKey: (item: T) => string;
|
|
45
|
+
/** The item's text — what the input shows once it is picked, and what typeahead matches. */
|
|
46
|
+
getLabel: (item: T) => string;
|
|
47
|
+
renderItem?: (item: T) => ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* Shown when the query matches nothing. Required: "no results" with no next step is a dead
|
|
50
|
+
* end, and this is the line that offers one.
|
|
51
|
+
*/
|
|
52
|
+
emptyHint: ReactNode;
|
|
53
|
+
/** Label for the clear button. Required — it is a button with an icon and no text. */
|
|
54
|
+
clearLabel: string;
|
|
55
|
+
/** Label for the button that opens the list. Required, same reason. */
|
|
56
|
+
openLabel: string;
|
|
57
|
+
/** Accessible name for the input, when no visible label points at it. */
|
|
58
|
+
label?: string;
|
|
59
|
+
leadingIcon?: ReactNode;
|
|
60
|
+
/** Classes for the input itself. */
|
|
61
|
+
className?: StateClassName<Primitive.Input.State>;
|
|
62
|
+
popupClassName?: StateClassName<Primitive.Popup.State>;
|
|
63
|
+
inputProps?: Primitive.Input.Props;
|
|
64
|
+
/**
|
|
65
|
+
* Positioner props — `align`, `side`, `sideOffset`, `collisionPadding`, and the stacking
|
|
66
|
+
* order. The default `z-[60]` puts the list above the overlay layer (z-50: dialog, drawer);
|
|
67
|
+
* raise it with `positionerProps={{ className: "z-[80]" }}` if the app stacks something
|
|
68
|
+
* higher than a dialog above it.
|
|
69
|
+
*/
|
|
70
|
+
positionerProps?: Primitive.Positioner.Props;
|
|
71
|
+
} & ComboboxLoadingState;
|
|
72
|
+
/**
|
|
73
|
+
* A text field that filters a list. `name`, `form`, `required`, `id` and `disabled` pass
|
|
74
|
+
* straight through to the root, so it submits inside a `<form>`.
|
|
75
|
+
*
|
|
76
|
+
* Controlled only: the wrapper owns `open` and the input value, because those two are what
|
|
77
|
+
* the label/query bridge is made of.
|
|
78
|
+
*/
|
|
79
|
+
export declare function Combobox<T>({ value, search, getKey, getLabel, renderItem, emptyHint, loading, loadingHint, clearLabel, openLabel, label, leadingIcon, className, popupClassName, inputProps, positionerProps, onOpenChange, ...rest }: ComboboxProps<T>): import("react").JSX.Element;
|
|
80
|
+
export {};
|
|
81
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAqB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAKtE,eAAO,MAAM,YAAY,uBAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,2JAAkB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,0JAAuB,CAAC;AACvD,eAAO,MAAM,eAAe,0JAAoB,CAAC;AACjD,eAAO,MAAM,aAAa,4JAAkB,CAAC;AAC7C,eAAO,MAAM,cAAc,0JAAmB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,8JAAuB,CAAC;AACvD,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,YAAY,wJAAiB,CAAC;AAC3C,eAAO,MAAM,YAAY,+IAAiB,CAAC;AAC3C,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,aAAa,yJAAkB,CAAC;AAC7C,eAAO,MAAM,kBAAkB,8JAAuB,CAAC;AAEvD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,IAAI,EAAE,OAAO,EACb,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,CAAC,GAAG,IAAI,EACf,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAC5B,MAAM,CAGR;AAED,yFAAyF;AACzF,KAAK,oBAAoB,GACvB;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,WAAW,EAAE,S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H,eAAe,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;CAC9C,GAAG,oBAAoB,CAAC;AAEzB;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,EAC1B,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EACR,UAAU,EACV,SAAS,EACT,OAAO,EACP,WAAW,EACX,UAAU,EACV,SAAS,EACT,KAAK,EACL,WAAW,EACX,SAAS,EACT,cAAc,EACd,UAAU,EACV,eAAe,EACf,YAAY,EACZ,GAAG,IAAI,EACR,EAAE,aAAa,CAAC,CAAC,CAAC,+BAqHlB"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Combobox as Primitive } from "@base-ui/react/combobox";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { mergeClassName } from "./class-name.js";
|
|
5
|
+
import { ChevronGlyph, CloseGlyph } from "./glyphs.js";
|
|
6
|
+
// The parts, for a combobox this wrapper's shape cannot express — multi-select with chips,
|
|
7
|
+
// groups, a virtualised list.
|
|
8
|
+
export const ComboboxRoot = Primitive.Root;
|
|
9
|
+
export const ComboboxInput = Primitive.Input;
|
|
10
|
+
export const ComboboxInputGroup = Primitive.InputGroup;
|
|
11
|
+
export const ComboboxTrigger = Primitive.Trigger;
|
|
12
|
+
export const ComboboxClear = Primitive.Clear;
|
|
13
|
+
export const ComboboxPortal = Primitive.Portal;
|
|
14
|
+
export const ComboboxPositioner = Primitive.Positioner;
|
|
15
|
+
export const ComboboxPopup = Primitive.Popup;
|
|
16
|
+
export const ComboboxList = Primitive.List;
|
|
17
|
+
export const ComboboxItem = Primitive.Item;
|
|
18
|
+
export const ComboboxEmpty = Primitive.Empty;
|
|
19
|
+
export const ComboboxGroup = Primitive.Group;
|
|
20
|
+
export const ComboboxGroupLabel = Primitive.GroupLabel;
|
|
21
|
+
/**
|
|
22
|
+
* What the input shows: the QUERY while the list is open, the selected item's LABEL while it
|
|
23
|
+
* is closed.
|
|
24
|
+
*
|
|
25
|
+
* The two are different strings and swapping them is the whole job. Show the label while
|
|
26
|
+
* typing and every keystroke is overwritten by the old selection; show the query while
|
|
27
|
+
* closed and the field goes blank the moment focus leaves, even though a value is set.
|
|
28
|
+
*/
|
|
29
|
+
export function comboboxInputValue(open, query, value, getLabel) {
|
|
30
|
+
if (open)
|
|
31
|
+
return query;
|
|
32
|
+
return value === null ? "" : getLabel(value);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A text field that filters a list. `name`, `form`, `required`, `id` and `disabled` pass
|
|
36
|
+
* straight through to the root, so it submits inside a `<form>`.
|
|
37
|
+
*
|
|
38
|
+
* Controlled only: the wrapper owns `open` and the input value, because those two are what
|
|
39
|
+
* the label/query bridge is made of.
|
|
40
|
+
*/
|
|
41
|
+
export function Combobox({ value, search, getKey, getLabel, renderItem, emptyHint, loading, loadingHint, clearLabel, openLabel, label, leadingIcon, className, popupClassName, inputProps, positionerProps, onOpenChange, ...rest }) {
|
|
42
|
+
const [open, setOpen] = useState(false);
|
|
43
|
+
const [query, setQuery] = useState("");
|
|
44
|
+
const items = useMemo(() => search(query), [query, search]);
|
|
45
|
+
return (_jsxs(Primitive.Root, { value: value, items: items, open: open, itemToStringLabel: getLabel, isItemEqualToValue: (left, right) => getKey(left) === getKey(right),
|
|
46
|
+
// `null` hands filtering to `search`. Base UI's own filter would run a SECOND pass over
|
|
47
|
+
// an already-filtered list, so a server that matched on something the label does not
|
|
48
|
+
// contain — an id, a phone number, an accent-stripped name — would return rows the
|
|
49
|
+
// client then threw away.
|
|
50
|
+
filter: null, inputValue: comboboxInputValue(open, query, value, getLabel), onInputValueChange: (next) => {
|
|
51
|
+
setQuery(next);
|
|
52
|
+
if (!open)
|
|
53
|
+
setOpen(true);
|
|
54
|
+
}, onOpenChange: (next, details) => {
|
|
55
|
+
setOpen(next);
|
|
56
|
+
// A fresh open starts from the whole list, not from whatever was typed last time.
|
|
57
|
+
if (next)
|
|
58
|
+
setQuery("");
|
|
59
|
+
onOpenChange?.(next, details);
|
|
60
|
+
}, ...rest, children: [_jsxs(Primitive.InputGroup, { className: "relative", children: [leadingIcon ? (_jsx("span", { className: "pointer-events-none absolute top-1/2 left-3 z-10 -translate-y-1/2 text-muted-foreground", children: leadingIcon })) : null, _jsx(Primitive.Input, { "aria-label": label, autoComplete: "off", ...inputProps, className: mergeClassName([
|
|
61
|
+
// No focus style: the field keeps the app's one `:focus-visible` outline. Swapping
|
|
62
|
+
// it for a `ring-*` loses forced-colors mode, where a box-shadow is forced to none.
|
|
63
|
+
"w-full min-w-0 rounded-md border border-input bg-background py-2 pr-16 pl-3 text-base text-foreground placeholder:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 md:text-sm",
|
|
64
|
+
leadingIcon && "pl-9",
|
|
65
|
+
],
|
|
66
|
+
// The caller's classes land BEFORE the space reserved for the buttons is
|
|
67
|
+
// re-applied below, so a `px-*` of their own cannot swallow it.
|
|
68
|
+
className) }), _jsxs("span", { className: "absolute top-1/2 right-1.5 z-10 flex -translate-y-1/2 items-center gap-0.5", children: [_jsx(Primitive.Clear, { "aria-label": clearLabel, className: "inline-flex rounded-full p-1.5 text-muted-foreground", children: _jsx(CloseGlyph, {}) }), _jsx(Primitive.Trigger, { "aria-label": openLabel, className: "inline-flex rounded-full p-1.5 text-muted-foreground", children: _jsx(ChevronGlyph, {}) })] })] }), _jsx(Primitive.Portal, { children: _jsx(Primitive.Positioner, { sideOffset: 4, ...positionerProps, className: mergeClassName("z-[60] max-w-[var(--available-width)] outline-none", positionerProps?.className), children: _jsxs(Primitive.Popup, { className: mergeClassName("w-[var(--anchor-width)] overflow-hidden border border-border bg-popover text-popover-foreground outline-none transition-[scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0", popupClassName), children: [_jsx(Primitive.Empty, { children: _jsx("div", { className: "px-3 py-2 text-muted-foreground", children: loading ? loadingHint : emptyHint }) }), _jsx(Primitive.List, { className: "max-h-[var(--available-height)] overflow-y-auto", children: (item) => (_jsx(Primitive.Item, { value: item, className: "cursor-default px-3 py-2 outline-none data-highlighted:bg-accent data-highlighted:text-accent-foreground", children: renderItem ? renderItem(item) : getLabel(item) }, getKey(item))) })] }) }) })] }));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","sourceRoot":"","sources":["../../src/ui/combobox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,aAAc,CAAC;AAExD,2FAA2F;AAC3F,8BAA8B;AAC9B,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC;AACvD,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,OAAO,CAAC;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,MAAM,CAAC;AAC/C,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC,UAAU,CAAC;AACvD,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC;AAC7C,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,IAAI,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,SAA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,KAAC,SAAS,CAAC,MAAM,cAIf,KAAC,SAAS,CAAC,UAAU,IACnB,UAAU,EAAE,CAAC,KACT,eAAe,EACnB,SAAS,EAAE,cAAc,CACvB,oDAAoD,EACpD,eAAe,EAAE,SAAS,CAC3B,YAED,MAAC,SAAS,CAAC,KAAK,IACd,SAAS,EAAE,cAAc,CACvB,2PAA2P,EAC3P,cAAc,CACf,aAOD,KAAC,SAAS,CAAC,KAAK,cACd,cAAK,SAAS,EAAC,iCAAiC,YAC7C,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,GAC9B,GACU,EAIlB,KAAC,SAAS,CAAC,IAAI,IAAC,SAAS,EAAC,iDAAiD,YACxE,CAAC,IAAO,EAAE,EAAE,CAAC,CACZ,KAAC,SAAS,CAAC,IAAI,IAEb,KAAK,EAAE,IAAI,EACX,SAAS,EAAC,0GAA0G,YAEnH,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAJ1C,MAAM,CAAC,IAAI,CAAC,CAKF,CAClB,GACc,IACD,GACG,GACN,IACJ,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Dialog as Primitive } from "@base-ui/react/dialog";
|
|
2
|
+
import { type StateClassName } from "./class-name.ts";
|
|
3
|
+
export declare const Dialog: <Payload>(props: Primitive.Root.Props<Payload>) => React.JSX.Element;
|
|
4
|
+
export declare const DialogTrigger: Primitive.Trigger;
|
|
5
|
+
export declare const DialogTitle: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogTitleProps, "ref"> & import("react").RefAttributes<HTMLHeadingElement>>;
|
|
6
|
+
export declare const DialogDescription: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogDescriptionProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
7
|
+
export declare const DialogClose: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogCloseProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
export declare const DialogPortal: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPortalProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const DialogBackdrop: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const DialogPopup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").AlertDialogPopupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export type DialogContentProps = Primitive.Popup.Props & {
|
|
12
|
+
/**
|
|
13
|
+
* Accessible name, for a dialog with no visible `DialogTitle`. With a title, leave this
|
|
14
|
+
* out: Base UI points the popup's `aria-labelledby` at it, and an `aria-label` here would
|
|
15
|
+
* override the words the user can actually see.
|
|
16
|
+
*/
|
|
17
|
+
label?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Label for the built-in close button — REQUIRED to get one, which is the whole point:
|
|
20
|
+
* passing the label is the only way to render the button, so an unlabelled close button
|
|
21
|
+
* cannot be written. There is no default string, because a default would be English.
|
|
22
|
+
*/
|
|
23
|
+
closeLabel?: string;
|
|
24
|
+
backdropClassName?: StateClassName<Primitive.Backdrop.State>;
|
|
25
|
+
/** Where the portal mounts. Defaults to `<body>`. */
|
|
26
|
+
container?: Primitive.Portal.Props["container"];
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Portal + backdrop + popup as one part, so a scrimless dialog is not a thing a caller can
|
|
30
|
+
* ship by forgetting a line. The popup owns the scroll (`overflow-y-auto` plus
|
|
31
|
+
* `overscroll-contain`, so reaching the end of a long dialog does not start scrolling the
|
|
32
|
+
* page behind it) and is capped to the viewport, so a tall dialog is never taller than the
|
|
33
|
+
* screen it opens on.
|
|
34
|
+
*
|
|
35
|
+
* Everything else — padding, radius, shadow, type — is the product's. What is here is what
|
|
36
|
+
* makes the primitive work.
|
|
37
|
+
*/
|
|
38
|
+
export declare function DialogContent({ className, backdropClassName, container, label, closeLabel, children, ...rest }: DialogContentProps): import("react").JSX.Element;
|
|
39
|
+
//# sourceMappingURL=dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAMtE,eAAO,MAAM,MAAM,sEAAiB,CAAC;AACrC,eAAO,MAAM,aAAa,mBAAoB,CAAC;AAC/C,eAAO,MAAM,WAAW,4JAAkB,CAAC;AAC3C,eAAO,MAAM,iBAAiB,oKAAwB,CAAC;AACvD,eAAO,MAAM,WAAW,2JAAkB,CAAC;AAC3C,eAAO,MAAM,YAAY,yJAAmB,CAAC;AAC7C,eAAO,MAAM,cAAc,2JAAqB,CAAC;AACjD,eAAO,MAAM,WAAW,wJAAkB,CAAC;AAE3C,MAAM,MAAM,kBAAkB,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,GAAG;IACvD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,qDAAqD;IACrD,SAAS,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAkCpB"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Dialog as Primitive } from "@base-ui/react/dialog";
|
|
3
|
+
import { mergeClassName } from "./class-name.js";
|
|
4
|
+
import { CloseGlyph } from "./glyphs.js";
|
|
5
|
+
// The parts, straight through. Base UI already does focus trap, escape, outside-dismiss,
|
|
6
|
+
// scroll lock, focus return and the aria wiring, and a wrapper around any of these would only
|
|
7
|
+
// add a class name — so they are re-exported, not re-implemented.
|
|
8
|
+
export const Dialog = Primitive.Root;
|
|
9
|
+
export const DialogTrigger = Primitive.Trigger;
|
|
10
|
+
export const DialogTitle = Primitive.Title;
|
|
11
|
+
export const DialogDescription = Primitive.Description;
|
|
12
|
+
export const DialogClose = Primitive.Close;
|
|
13
|
+
export const DialogPortal = Primitive.Portal;
|
|
14
|
+
export const DialogBackdrop = Primitive.Backdrop;
|
|
15
|
+
export const DialogPopup = Primitive.Popup;
|
|
16
|
+
/**
|
|
17
|
+
* Portal + backdrop + popup as one part, so a scrimless dialog is not a thing a caller can
|
|
18
|
+
* ship by forgetting a line. The popup owns the scroll (`overflow-y-auto` plus
|
|
19
|
+
* `overscroll-contain`, so reaching the end of a long dialog does not start scrolling the
|
|
20
|
+
* page behind it) and is capped to the viewport, so a tall dialog is never taller than the
|
|
21
|
+
* screen it opens on.
|
|
22
|
+
*
|
|
23
|
+
* Everything else — padding, radius, shadow, type — is the product's. What is here is what
|
|
24
|
+
* makes the primitive work.
|
|
25
|
+
*/
|
|
26
|
+
export function DialogContent({ className, backdropClassName, container, label, closeLabel, children, ...rest }) {
|
|
27
|
+
return (_jsxs(Primitive.Portal, { container: container, children: [_jsx(Primitive.Backdrop, { className: mergeClassName("fixed inset-0 z-50 bg-scrim transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0", backdropClassName) }), _jsxs(Primitive.Popup, { "aria-label": label, ...rest, className: mergeClassName("fixed top-1/2 left-1/2 z-50 max-h-[calc(100dvh-2rem)] w-[calc(100%-2rem)] max-w-md -translate-x-1/2 -translate-y-1/2 overflow-y-auto overscroll-contain bg-popover text-popover-foreground outline-none transition-[scale,opacity] data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0", className), children: [children, closeLabel === undefined ? null : (_jsx(Primitive.Close, { "aria-label": closeLabel,
|
|
28
|
+
// 44px square: the close button is often the only way out on a phone, and a
|
|
29
|
+
// smaller target is one a thumb misses.
|
|
30
|
+
className: "absolute top-0 right-0 inline-flex size-11 items-center justify-center text-muted-foreground", children: _jsx(CloseGlyph, {}) }))] })] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/ui/dialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAc,CAAC;AAE1C,yFAAyF;AACzF,8FAA8F;AAC9F,kEAAkE;AAClE,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC;AACrC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,iBAAiB,GAAG,SAAS,CAAC,WAAW,CAAC;AACvD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC;AAoB3C;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,SAAS,EACT,iBAAiB,EACjB,SAAS,EACT,KAAK,EACL,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACY;IACnB,OAAO,CACL,MAAC,SAAS,CAAC,MAAM,IAAC,SAAS,EAAE,SAAS,aACpC,KAAC,SAAS,CAAC,QAAQ,IACjB,SAAS,EAAE,cAAc,CACvB,0GAA0G,EAC1G,iBAAiB,CAClB,GACD,EAIF,MAAC,SAAS,CAAC,KAAK,kBACF,KAAK,KACb,IAAI,EACR,SAAS,EAAE,cAAc,CACvB,sVAAsV,EACtV,SAAS,CACV,aAEA,QAAQ,EACR,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACjC,KAAC,SAAS,CAAC,KAAK,kBACF,UAAU;wBACtB,4EAA4E;wBAC5E,wCAAwC;wBACxC,SAAS,EAAC,8FAA8F,YAExG,KAAC,UAAU,KAAG,GACE,CACnB,IACe,IACD,CACpB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Drawer as Primitive } from "@base-ui/react/drawer";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import { type StateClassName } from "./class-name.ts";
|
|
4
|
+
export declare const DrawerRoot: typeof Primitive.Root;
|
|
5
|
+
export declare const DrawerTrigger: Primitive.Trigger;
|
|
6
|
+
export declare const DrawerPortal: Primitive.Portal;
|
|
7
|
+
export declare const DrawerBackdrop: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerBackdropProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const DrawerViewport: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerViewportProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const DrawerPopup: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerPopupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const DrawerContent: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerContentProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const DrawerHandle: typeof Primitive.Handle;
|
|
12
|
+
export declare const DrawerSwipeArea: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").DrawerSwipeAreaProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
export declare const DrawerTitle: Primitive.Title;
|
|
14
|
+
export declare const DrawerDescription: Primitive.Description;
|
|
15
|
+
export declare const DrawerClose: Primitive.Close;
|
|
16
|
+
export type DrawerSide = "left" | "right" | "bottom";
|
|
17
|
+
/**
|
|
18
|
+
* Where the portal mounts, and whether the drawer covers the page or a box inside it.
|
|
19
|
+
*
|
|
20
|
+
* A scoped drawer positions itself `absolute` against a container instead of `fixed` against
|
|
21
|
+
* the viewport — so it MUST be given that container, or it lands in `<body>` and positions
|
|
22
|
+
* against a box that is not there. The two travel together in the type.
|
|
23
|
+
*
|
|
24
|
+
* The container also needs a positioning context of its own (`relative`): `absolute` walks up
|
|
25
|
+
* to the nearest positioned ancestor, so a static container hands the drawer the whole page
|
|
26
|
+
* and the "scoped" part quietly does not happen.
|
|
27
|
+
*/
|
|
28
|
+
type DrawerPortalTarget = {
|
|
29
|
+
scoped: true;
|
|
30
|
+
container: NonNullable<Primitive.Portal.Props["container"]>;
|
|
31
|
+
} | {
|
|
32
|
+
scoped?: false;
|
|
33
|
+
container?: Primitive.Portal.Props["container"];
|
|
34
|
+
};
|
|
35
|
+
export type DrawerProps<Payload = unknown> = Omit<Primitive.Root.Props<Payload>, "children" | "swipeDirection"> & DrawerPortalTarget & {
|
|
36
|
+
/**
|
|
37
|
+
* Which edge it comes from. This also sets `swipeDirection` on the root — the two must
|
|
38
|
+
* agree, and a mismatch is silent: the drawer looks right and dismisses on a swipe
|
|
39
|
+
* towards the screen it is attached to.
|
|
40
|
+
*/
|
|
41
|
+
side?: DrawerSide;
|
|
42
|
+
/** Accessible name, for a drawer with no visible `DrawerTitle`. */
|
|
43
|
+
label?: string;
|
|
44
|
+
children?: ReactNode;
|
|
45
|
+
/** Classes for the popup — the panel itself. */
|
|
46
|
+
className?: StateClassName<Primitive.Popup.State>;
|
|
47
|
+
backdropClassName?: StateClassName<Primitive.Backdrop.State>;
|
|
48
|
+
viewportClassName?: StateClassName<Primitive.Viewport.State>;
|
|
49
|
+
contentClassName?: StateClassName<Primitive.Content.State>;
|
|
50
|
+
/** Popup-level props the wrapper does not own — `initialFocus`, `finalFocus`, `data-*`. */
|
|
51
|
+
popupProps?: Primitive.Popup.Props;
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* A panel that slides in from an edge. Root → portal → backdrop → viewport → popup → content,
|
|
55
|
+
* composed once here because the parts have to be arranged in exactly this order to work at
|
|
56
|
+
* all, and because two of the four rules below cost someone a bug that no test would catch.
|
|
57
|
+
*
|
|
58
|
+
* Everything the root takes — `open`, `onOpenChange`, `modal`, `snapPoints`, `actionsRef`,
|
|
59
|
+
* `data-*` — passes straight through.
|
|
60
|
+
*/
|
|
61
|
+
export declare function Drawer<Payload = unknown>({ side, label, scoped, container, className, backdropClassName, viewportClassName, contentClassName, popupProps, children, ...rest }: DrawerProps<Payload>): import("react").JSX.Element;
|
|
62
|
+
export {};
|
|
63
|
+
//# sourceMappingURL=drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","sourceRoot":"","sources":["../../src/ui/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtE,eAAO,MAAM,U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AClD,iBAAiB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,iBAAiB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC7D,gBAAgB,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC3D,2FAA2F;IAC3F,UAAU,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC;CACpC,CAAC;AAEJ;;;;;;;GAOG;AACH,wBAAgB,MAAM,CAAC,OAAO,GAAG,OAAO,EAAE,EACxC,IAAc,EACd,KAAK,EACL,MAAc,EACd,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,WAAW,CAAC,OAAO,CAAC,+BAiEtB"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Drawer as Primitive } from "@base-ui/react/drawer";
|
|
3
|
+
import { mergeClassName } from "./class-name.js";
|
|
4
|
+
// The parts, for a drawer that needs a shape this wrapper does not give it.
|
|
5
|
+
export const DrawerRoot = Primitive.Root;
|
|
6
|
+
export const DrawerTrigger = Primitive.Trigger;
|
|
7
|
+
export const DrawerPortal = Primitive.Portal;
|
|
8
|
+
export const DrawerBackdrop = Primitive.Backdrop;
|
|
9
|
+
export const DrawerViewport = Primitive.Viewport;
|
|
10
|
+
export const DrawerPopup = Primitive.Popup;
|
|
11
|
+
export const DrawerContent = Primitive.Content;
|
|
12
|
+
export const DrawerHandle = Primitive.Handle;
|
|
13
|
+
export const DrawerSwipeArea = Primitive.SwipeArea;
|
|
14
|
+
export const DrawerTitle = Primitive.Title;
|
|
15
|
+
export const DrawerDescription = Primitive.Description;
|
|
16
|
+
export const DrawerClose = Primitive.Close;
|
|
17
|
+
const viewportSide = {
|
|
18
|
+
left: "items-stretch justify-start",
|
|
19
|
+
right: "items-stretch justify-end",
|
|
20
|
+
bottom: "items-end",
|
|
21
|
+
};
|
|
22
|
+
// The translate pair is what Base UI animates between: `data-starting-style` is the frame
|
|
23
|
+
// before it opens, `data-ending-style` the frame it leaves on. Same class both ways, so the
|
|
24
|
+
// drawer goes back out the side it came in.
|
|
25
|
+
const popupSide = {
|
|
26
|
+
left: "w-[min(24rem,calc(100vw-1rem))] data-ending-style:-translate-x-full data-starting-style:-translate-x-full",
|
|
27
|
+
right: "w-[min(24rem,calc(100vw-1rem))] data-ending-style:translate-x-full data-starting-style:translate-x-full",
|
|
28
|
+
bottom: "max-h-[90svh] w-full data-ending-style:translate-y-full data-starting-style:translate-y-full",
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A panel that slides in from an edge. Root → portal → backdrop → viewport → popup → content,
|
|
32
|
+
* composed once here because the parts have to be arranged in exactly this order to work at
|
|
33
|
+
* all, and because two of the four rules below cost someone a bug that no test would catch.
|
|
34
|
+
*
|
|
35
|
+
* Everything the root takes — `open`, `onOpenChange`, `modal`, `snapPoints`, `actionsRef`,
|
|
36
|
+
* `data-*` — passes straight through.
|
|
37
|
+
*/
|
|
38
|
+
export function Drawer({ side = "right", label, scoped = false, container, className, backdropClassName, viewportClassName, contentClassName, popupProps, children, ...rest }) {
|
|
39
|
+
return (_jsx(Primitive.Root, { swipeDirection: side === "bottom" ? "down" : side, ...rest, children: _jsxs(Primitive.Portal, { container: container, children: [_jsx(Primitive.Backdrop, { className: mergeClassName([
|
|
40
|
+
scoped ? "absolute" : "fixed",
|
|
41
|
+
"inset-0 z-40 bg-scrim transition-opacity data-ending-style:opacity-0 data-starting-style:opacity-0",
|
|
42
|
+
], backdropClassName) }), _jsx(Primitive.Viewport, { className: mergeClassName([scoped ? "absolute" : "fixed", "inset-0 z-50 flex", viewportSide[side]], viewportClassName), children: _jsx(Primitive.Popup, { "aria-label": label, ...popupProps, className: mergeClassName([
|
|
43
|
+
"pointer-events-auto flex flex-col overflow-y-auto overscroll-contain bg-background text-foreground outline-none transition-transform",
|
|
44
|
+
popupSide[side],
|
|
45
|
+
], className), children: _jsx(Primitive.Content, { className: mergeClassName([
|
|
46
|
+
"flex w-full flex-1 flex-col",
|
|
47
|
+
// A side drawer has a definite height (the viewport's), so cap the content
|
|
48
|
+
// to it. Without `min-h-0` a child with its own scroll region grows the
|
|
49
|
+
// popup instead of scrolling inside it, and the footer that was meant to
|
|
50
|
+
// stay pinned ends up at the bottom of one long page scroll. A bottom
|
|
51
|
+
// drawer sizes from its content, so it keeps the default `min-height: auto`.
|
|
52
|
+
side !== "bottom" && "min-h-0",
|
|
53
|
+
], contentClassName), children: children }) }) })] }) }));
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=drawer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../src/ui/drawer.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AAEtE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC;AACzC,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,CAAC;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,QAAQ,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC,OAAO,CAAC;AAC/C,MAAM,CAAC,MAAM,YAAY,GAAG,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AC,CAAC,CAAC,OAAO,EAAE,mBAAmB,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,EACxE,iBAAiB,CAClB,YAED,KAAC,SAAS,CAAC,KAAK,kBACF,KAAK,KACb,UAAU,EACd,SAAS,EAAE,cAAc,CACvB;4BACE,sIAAsI;4BACtI,SAAS,CAAC,IAAI,CAAC;yBAChB,EACD,SAAS,CACV,YAED,KAAC,SAAS,CAAC,OAAO,IAChB,SAAS,EAAE,cAAc,CACvB;gCACE,6BAA6B;gCAC7B,2EAA2E;gCAC3E,wEAAwE;gCACxE,yEAAyE;gCACzE,sEAAsE;gCACtE,6EAA6E;gCAC7E,IAAI,KAAK,QAAQ,IAAI,SAAS;6BAC/B,EACD,gBAAgB,CACjB,YAEA,QAAQ,GACS,GACJ,GACC,IACJ,GACJ,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyphs.d.ts","sourceRoot":"","sources":["../../src/ui/glyphs.tsx"],"names":[],"mappings":"AAwBA,wBAAgB,YAAY,gCAE3B;AAED,wBAAgB,UAAU,gCAEzB;AAED,wBAAgB,UAAU,gCAEzB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// The three affordance marks the wrappers draw by default: the chevron that says "this
|
|
3
|
+
// opens", the check that says "this one is picked", the cross that says "this closes".
|
|
4
|
+
//
|
|
5
|
+
// They are `currentColor` stroke on a 24-grid so a product's own icon set drops in without
|
|
6
|
+
// a size or colour change. Every component that draws one takes it as a prop — these are the
|
|
7
|
+
// zero-config default, never the only option.
|
|
8
|
+
function Glyph({ d }) {
|
|
9
|
+
return (_jsx("svg", { className: "size-4", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: d }) }));
|
|
10
|
+
}
|
|
11
|
+
export function ChevronGlyph() {
|
|
12
|
+
return _jsx(Glyph, { d: "m6 9 6 6 6-6" });
|
|
13
|
+
}
|
|
14
|
+
export function CheckGlyph() {
|
|
15
|
+
return _jsx(Glyph, { d: "m5 13 4 4 10-10" });
|
|
16
|
+
}
|
|
17
|
+
export function CloseGlyph() {
|
|
18
|
+
return _jsx(Glyph, { d: "M18 6 6 18M6 6l12 12" });
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=glyphs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glyphs.js","sourceRoot":"","sources":["../../src/ui/glyphs.tsx"],"names":[],"mappings":";AAAA,uFAAuF;AACvF,uFAAuF;AACvF,EAAE;AACF,2FAA2F;AAC3F,6FAA6F;AAC7F,8CAA8C;AAE9C,SAAS,KAAK,CAAC,EAAE,CAAC,EAAiB;IACjC,OAAO,CACL,cACE,SAAS,EAAC,QAAQ,EAClB,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAE,CAAC,EACd,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,YAElB,eAAM,CAAC,EAAE,CAAC,GAAI,GACV,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,KAAC,KAAK,IAAC,CAAC,EAAC,cAAc,GAAG,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,KAAC,KAAK,IAAC,CAAC,EAAC,iBAAiB,GAAG,CAAC;AACvC,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,KAAC,KAAK,IAAC,CAAC,EAAC,sBAAsB,GAAG,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { mergeClassName, type StateClassName } from "./class-name.ts";
|
|
2
|
+
export { Dialog, DialogBackdrop, DialogClose, DialogContent, DialogDescription, DialogPopup, DialogPortal, DialogTitle, DialogTrigger, type DialogContentProps, } from "./dialog.tsx";
|
|
3
|
+
export { Drawer, DrawerBackdrop, DrawerClose, DrawerContent, DrawerDescription, DrawerHandle, DrawerPopup, DrawerPortal, DrawerRoot, DrawerSwipeArea, DrawerTitle, DrawerTrigger, DrawerViewport, type DrawerProps, type DrawerSide, } from "./drawer.tsx";
|
|
4
|
+
export { Select, SelectGroup, SelectGroupLabel, SelectIcon, SelectItem, SelectItemIndicator, SelectItemText, SelectList, SelectPopup, SelectPortal, SelectPositioner, SelectRoot, SelectSeparator, SelectTrigger, SelectValue, type SelectOption, type SelectProps, } from "./select.tsx";
|
|
5
|
+
export { Combobox, comboboxInputValue, ComboboxClear, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxInputGroup, ComboboxItem, ComboboxList, ComboboxPopup, ComboboxPortal, ComboboxPositioner, ComboboxRoot, ComboboxTrigger, type ComboboxProps, } from "./combobox.tsx";
|
|
6
|
+
export { Input, textareaHeight, type FieldProps, type InputProps, type MultilineInputProps, } from "./input.tsx";
|
|
7
|
+
export { Menu, MenuArrow, MenuBackdrop, MenuCheckboxItem, MenuCheckboxItemIndicator, MenuContent, MenuGroup, MenuItem, MenuLinkItem, MenuPopup, MenuPortal, MenuPositioner, MenuRadioGroup, MenuRadioItem, MenuRadioItemIndicator, MenuSeparator, MenuSubmenuRoot, MenuSubmenuTrigger, MenuTrigger, type MenuContentProps, type MenuRadioItemProps, } from "./menu.tsx";
|
|
8
|
+
export { Tab, TabIndicator, TabList, TabPanel, Tabs, type TabListProps } from "./tabs.tsx";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AA4BA,OAAO,EAAE,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EACL,MAAM,EACN,cAAc,EACd,WAAW,EACX,aAAa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