@photon-ai/pho-ui 4.12.0 → 4.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{basic-page-CJ11ekjH.js → basic-page-6dDfY33L.js} +717 -737
- package/dist/chunks/basic-page-6dDfY33L.js.map +1 -0
- package/dist/chunks/box-search-C9EVZgcb.js +56 -0
- package/dist/chunks/box-search-C9EVZgcb.js.map +1 -0
- package/dist/chunks/{chat-CU3XVm99.js → chat-Bu8UyIbT.js} +206 -204
- package/dist/chunks/chat-Bu8UyIbT.js.map +1 -0
- package/dist/chunks/chrome-Ds7WykBJ.js +14 -0
- package/dist/chunks/chrome-Ds7WykBJ.js.map +1 -0
- package/dist/chunks/{data-table-Ce_c6T73.js → data-table-hzZb7Otx.js} +56 -54
- package/dist/chunks/{data-table-Ce_c6T73.js.map → data-table-hzZb7Otx.js.map} +1 -1
- package/dist/chunks/{filter-bar-CMkvhvgL.js → filter-bar-C4sPEjw1.js} +62 -65
- package/dist/chunks/filter-bar-C4sPEjw1.js.map +1 -0
- package/dist/chunks/ghost-search-8PzP73zS.js +50 -0
- package/dist/chunks/ghost-search-8PzP73zS.js.map +1 -0
- package/dist/chunks/{trace-D1fOFzJt.js → trace-DyjsBY-S.js} +15 -13
- package/dist/chunks/{trace-D1fOFzJt.js.map → trace-DyjsBY-S.js.map} +1 -1
- package/dist/components/chat.js +1 -1
- package/dist/components/data-table.js +4 -3
- package/dist/components/filter-bar.js +1 -1
- package/dist/components/scope.js +418 -0
- package/dist/components/scope.js.map +1 -0
- package/dist/components/trace.js +1 -1
- package/dist/index.js +176 -175
- package/dist/motion.js +61 -36
- package/dist/motion.js.map +1 -1
- package/dist/sections/basic-page.js +2 -2
- package/dist/src/components/chat/chat.d.ts +7 -4
- package/dist/src/components/input-group/box-search.d.ts +29 -0
- package/dist/src/components/scope/index.d.ts +1 -0
- package/dist/src/components/scope/scope.d.ts +98 -0
- package/dist/src/motion/index.d.ts +52 -0
- package/dist/src/utils/ghost-search.d.ts +19 -3
- package/package.json +5 -1
- package/dist/chunks/basic-page-CJ11ekjH.js.map +0 -1
- package/dist/chunks/chat-CU3XVm99.js.map +0 -1
- package/dist/chunks/filter-bar-CMkvhvgL.js.map +0 -1
- package/dist/chunks/ghost-search-CNVs9k1o.js +0 -34
- package/dist/chunks/ghost-search-CNVs9k1o.js.map +0 -1
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { ComponentProps, Ref } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Scope — pick what something covers out of a catalog: the events a webhook
|
|
4
|
+
* destination receives, the permissions an app or key holds. A searchable,
|
|
5
|
+
* grouped checklist with a catch-all row; `collapsible` folds it to a
|
|
6
|
+
* two-line summary for a resource that already exists, opening on click.
|
|
7
|
+
*/
|
|
8
|
+
export interface ScopeItem {
|
|
9
|
+
/**
|
|
10
|
+
* What the selection holds — an event type, a permission id. It is also
|
|
11
|
+
* the row's name unless `label` says otherwise.
|
|
12
|
+
*/
|
|
13
|
+
value: string;
|
|
14
|
+
/** The row's name, when it shouldn't be the value itself. */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** One line on what it covers. Searched along with the name. */
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The group it files under — the resource, the namespace. Groups keep
|
|
20
|
+
* the order they first appear in; items without one come first.
|
|
21
|
+
*/
|
|
22
|
+
group?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface ScopeAll {
|
|
25
|
+
/** The row's name — `All events`. */
|
|
26
|
+
label: string;
|
|
27
|
+
/** What choosing it means — `Every current and future event.` */
|
|
28
|
+
description?: string;
|
|
29
|
+
/**
|
|
30
|
+
* A wildcard the selection holds in place of the items — `*`. With it,
|
|
31
|
+
* the row stands for every item, now and later: choosing it sets the
|
|
32
|
+
* selection to `[value]`, and leaving it spells every item out by name so
|
|
33
|
+
* the reader prunes from there, never from nothing. Without it, the row
|
|
34
|
+
* selects every item listed.
|
|
35
|
+
*/
|
|
36
|
+
value?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface ScopeProps extends Omit<ComponentProps<"div">, "defaultValue" | "onChange" | "children"> {
|
|
39
|
+
/** The catalog — everything that can be picked, in display order. */
|
|
40
|
+
items: readonly ScopeItem[];
|
|
41
|
+
/** The selected values, controlled. */
|
|
42
|
+
value?: readonly string[];
|
|
43
|
+
/** The selected values at first, uncontrolled. */
|
|
44
|
+
defaultValue?: readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* Called with the next selection, in catalog order (values no longer in
|
|
47
|
+
* the catalog follow in the order they were held).
|
|
48
|
+
*/
|
|
49
|
+
onValueChange?: (value: string[]) => void;
|
|
50
|
+
/** The catch-all row at the top. Leave it out for no such row. */
|
|
51
|
+
all?: ScopeAll;
|
|
52
|
+
/** The search field's placeholder, which also names it. @default "Search" */
|
|
53
|
+
placeholder?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Fold to a two-line summary of the selection, opening to the full list
|
|
56
|
+
* on click — for a resource that already exists, where the scope is read
|
|
57
|
+
* far more often than it changes. The page saves the change (its "Save
|
|
58
|
+
* changes" below the card) and folds the list through `open`; the ✕ in
|
|
59
|
+
* the search row, or `Escape` on an empty search, drops the edit: the
|
|
60
|
+
* selection goes back to what it was when the list opened, and folds.
|
|
61
|
+
*/
|
|
62
|
+
collapsible?: boolean;
|
|
63
|
+
/** Whether the collapsible list is open, controlled. */
|
|
64
|
+
open?: boolean;
|
|
65
|
+
/** Whether the collapsible list starts open. @default false */
|
|
66
|
+
defaultOpen?: boolean;
|
|
67
|
+
/** Called when the collapsible list opens or folds. */
|
|
68
|
+
onOpenChange?: (open: boolean) => void;
|
|
69
|
+
/** The catalog is on its way: bones in place of rows. */
|
|
70
|
+
loading?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Read-only: the list can be searched but not changed, and a folded one
|
|
73
|
+
* stays folded. Held open by `open` (a save in flight), nothing in it
|
|
74
|
+
* changes the selection, the ✕ and Escape included.
|
|
75
|
+
*/
|
|
76
|
+
disabled?: boolean;
|
|
77
|
+
ref?: Ref<HTMLDivElement>;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A searchable, grouped checklist for choosing what something covers.
|
|
81
|
+
*
|
|
82
|
+
* Every row is one line on a wide card — the name, then its description in
|
|
83
|
+
* a second column that opens whole on hover when it doesn't fit. Groups are
|
|
84
|
+
* thin tinted bands carrying a checkbox for the whole group (mixed when
|
|
85
|
+
* partly chosen). The search matches names, descriptions, and group names,
|
|
86
|
+
* word by word; while it holds a query the catch-all row steps aside and a
|
|
87
|
+
* group's checkbox covers the rows it shows.
|
|
88
|
+
*
|
|
89
|
+
* With `collapsible`, the card rests as a summary — whole groups by name,
|
|
90
|
+
* the rest by item, over a count — and opens in place, the search taking
|
|
91
|
+
* focus, when clicked; its ✕ drops the edit and folds it back, the page's
|
|
92
|
+
* own save below the card commits it. Values the catalog no longer offers keep a row
|
|
93
|
+
* under "No longer offered": they can be removed, never added in bulk.
|
|
94
|
+
*/
|
|
95
|
+
export declare function Scope({ items, value: valueProp, defaultValue, onValueChange, all, placeholder, collapsible, open: openProp, defaultOpen, onOpenChange, loading, disabled, className, ref, ...props }: ScopeProps): import("react").JSX.Element;
|
|
96
|
+
export declare namespace Scope {
|
|
97
|
+
var displayName: string;
|
|
98
|
+
}
|
|
@@ -128,6 +128,58 @@ export declare function fadeThroughBlur(reduceMotion?: boolean | null): {
|
|
|
128
128
|
readonly duration: 0;
|
|
129
129
|
};
|
|
130
130
|
};
|
|
131
|
+
/**
|
|
132
|
+
* The presence recipe — `BasicPage.Reveal`'s: a block opens from no height
|
|
133
|
+
* on `SPRING_ENTRANCE` while `FADE_ENTRANCE` brings the ink, and closes the
|
|
134
|
+
* same way. Spread onto a keyed motion element inside `AnimatePresence`,
|
|
135
|
+
* clipped while it moves so what hasn't opened stays out of sight:
|
|
136
|
+
*
|
|
137
|
+
* <motion.div {...revealIn(reduceMotion)} />
|
|
138
|
+
*
|
|
139
|
+
* `collapseGap` is a flex gap the block trades against its height (a
|
|
140
|
+
* negative margin as it closes), so neighbours glide to where they end up
|
|
141
|
+
* instead of snapping by the gap when it unmounts. Under reduced motion the
|
|
142
|
+
* block snaps.
|
|
143
|
+
*/
|
|
144
|
+
export declare function revealIn(reduceMotion?: boolean | null, collapseGap?: string): {
|
|
145
|
+
readonly initial: {
|
|
146
|
+
readonly height: 0;
|
|
147
|
+
readonly opacity: 0;
|
|
148
|
+
readonly marginTop: string;
|
|
149
|
+
};
|
|
150
|
+
readonly animate: {
|
|
151
|
+
readonly height: "auto";
|
|
152
|
+
readonly opacity: 1;
|
|
153
|
+
readonly marginTop: 0;
|
|
154
|
+
};
|
|
155
|
+
readonly exit: {
|
|
156
|
+
readonly height: 0;
|
|
157
|
+
readonly opacity: 0;
|
|
158
|
+
readonly marginTop: string;
|
|
159
|
+
};
|
|
160
|
+
readonly transition: {
|
|
161
|
+
readonly duration: 0;
|
|
162
|
+
readonly height?: undefined;
|
|
163
|
+
readonly marginTop?: undefined;
|
|
164
|
+
readonly opacity?: undefined;
|
|
165
|
+
} | {
|
|
166
|
+
readonly height: {
|
|
167
|
+
readonly type: "spring";
|
|
168
|
+
readonly stiffness: 400;
|
|
169
|
+
readonly damping: 40;
|
|
170
|
+
};
|
|
171
|
+
readonly marginTop: {
|
|
172
|
+
readonly type: "spring";
|
|
173
|
+
readonly stiffness: 400;
|
|
174
|
+
readonly damping: 40;
|
|
175
|
+
};
|
|
176
|
+
readonly opacity: {
|
|
177
|
+
readonly duration: 0.25;
|
|
178
|
+
readonly ease: "easeOut";
|
|
179
|
+
};
|
|
180
|
+
readonly duration?: undefined;
|
|
181
|
+
};
|
|
182
|
+
};
|
|
131
183
|
/**
|
|
132
184
|
* The entrance recipe — rise `RISE_PX` on `SPRING_ENTRANCE` while
|
|
133
185
|
* `FADE_ENTRANCE` brings the ink. What `Stack` and `Reveal` do; spread it
|
|
@@ -1,11 +1,27 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
export interface GhostSearchProps extends Omit<ComponentProps<"input">, "value" | "onChange" | "type" | "children"> {
|
|
3
3
|
value: string;
|
|
4
4
|
onChange: (value: string) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Empties the query from the field's own clear button, shown while it
|
|
7
|
+
* holds text; focus stays in the field. Without it, the browser's own
|
|
8
|
+
* clear glyph stays.
|
|
9
|
+
*/
|
|
10
|
+
onClear?: () => void;
|
|
11
|
+
/** Quiet words at the field's end, before the clear button — a count. */
|
|
12
|
+
trailing?: ReactNode;
|
|
5
13
|
}
|
|
6
14
|
/**
|
|
7
15
|
* A search box with no box: the glyph and the text on the surface's own
|
|
8
16
|
* line, the way a toolbar band inside a card carries it (a `DataTable`'s
|
|
9
|
-
* search, a `Trace.Waterfall`'s). Quiet ink, no
|
|
17
|
+
* search, a `Trace.Waterfall`'s, a `Scope`'s first row). Quiet ink, and no
|
|
18
|
+
* ring on focus either: a ring would draw the box the face exists not to
|
|
19
|
+
* have. Focus shows in the caret and in the magnifier, which takes the
|
|
20
|
+
* primary ink while the field holds focus.
|
|
21
|
+
*
|
|
22
|
+
* The query is the list's, not a form's: its change stops at the field, so
|
|
23
|
+
* an enclosing form that saves on change (BasicPage `Form autoSave`) or
|
|
24
|
+
* shows a save row once dirty never hears it. The type is an `sm` field's:
|
|
25
|
+
* 16px on small viewports, where iOS zooms into anything smaller.
|
|
10
26
|
*/
|
|
11
|
-
export declare function GhostSearch({ value, onChange, className, ...props }: GhostSearchProps): import("react").JSX.Element;
|
|
27
|
+
export declare function GhostSearch({ value, onChange, onClear, trailing, className, ref, ...props }: GhostSearchProps): import("react").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@photon-ai/pho-ui",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.13.0",
|
|
4
4
|
"description": "Pho Design System — Photon's React component library, built on Base UI",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
|
@@ -85,6 +85,10 @@
|
|
|
85
85
|
"types": "./dist/src/components/checkbox/index.d.ts",
|
|
86
86
|
"import": "./dist/components/checkbox.js"
|
|
87
87
|
},
|
|
88
|
+
"./components/scope": {
|
|
89
|
+
"types": "./dist/src/components/scope/index.d.ts",
|
|
90
|
+
"import": "./dist/components/scope.js"
|
|
91
|
+
},
|
|
88
92
|
"./components/radio-group": {
|
|
89
93
|
"types": "./dist/src/components/radio-group/index.d.ts",
|
|
90
94
|
"import": "./dist/components/radio-group.js"
|