panelui-native 0.75.0 → 0.76.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/lib/module/components/ai-input/ai-input-growth.js +62 -0
- package/lib/module/components/ai-input/ai-input-growth.js.map +1 -0
- package/lib/module/components/ai-input/index.js +1568 -0
- package/lib/module/components/ai-input/index.js.map +1 -0
- package/lib/module/components/alert/index.js +1 -1
- package/lib/module/components/alert/index.js.map +1 -1
- package/lib/module/components/avatar/avatar-source.js +15 -0
- package/lib/module/components/avatar/avatar-source.js.map +1 -0
- package/lib/module/components/avatar/index.js +32 -31
- package/lib/module/components/avatar/index.js.map +1 -1
- package/lib/module/components/bottom-sheet/index.js +3 -2
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/button-group/index.js +2 -3
- package/lib/module/components/button-group/index.js.map +1 -1
- package/lib/module/components/carousel/index.js +10 -7
- package/lib/module/components/carousel/index.js.map +1 -1
- package/lib/module/components/collapsible/index.js +1 -1
- package/lib/module/components/collapsible/index.js.map +1 -1
- package/lib/module/components/drawer/index.js +18 -14
- package/lib/module/components/drawer/index.js.map +1 -1
- package/lib/module/components/field/index.js +7 -8
- package/lib/module/components/field/index.js.map +1 -1
- package/lib/module/components/label/index.js +1 -1
- package/lib/module/components/label/index.js.map +1 -1
- package/lib/module/components/marquee/index.js +36 -11
- package/lib/module/components/marquee/index.js.map +1 -1
- package/lib/module/components/marquee/marquee-math.js +22 -6
- package/lib/module/components/marquee/marquee-math.js.map +1 -1
- package/lib/module/components/plan/index.js +2 -1
- package/lib/module/components/plan/index.js.map +1 -1
- package/lib/module/components/plot/index.js +27 -9
- package/lib/module/components/plot/index.js.map +1 -1
- package/lib/module/components/search-bar/index.js +11 -3
- package/lib/module/components/search-bar/index.js.map +1 -1
- package/lib/module/components/split-view/index.js +26 -27
- package/lib/module/components/split-view/index.js.map +1 -1
- package/lib/module/components/split-view/split-view-lifecycle.js +32 -0
- package/lib/module/components/split-view/split-view-lifecycle.js.map +1 -0
- package/lib/module/components/splitter/index.js +7 -13
- package/lib/module/components/splitter/index.js.map +1 -1
- package/lib/module/components/splitter/splitter-math.js +14 -0
- package/lib/module/components/splitter/splitter-math.js.map +1 -1
- package/lib/module/components/tabs/index.js +1 -1
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/timeline/index.js +156 -42
- package/lib/module/components/timeline/index.js.map +1 -1
- package/lib/module/components/timeline/timeline-geometry.js +11 -0
- package/lib/module/components/timeline/timeline-geometry.js.map +1 -1
- package/lib/module/components/toast/index.js +1 -1
- package/lib/module/components/toast/index.js.map +1 -1
- package/lib/module/components/tooltip/index.js +2 -2
- package/lib/module/components/tooltip/index.js.map +1 -1
- package/lib/module/components/tree/index.js +2 -2
- package/lib/module/components/tree/index.js.map +1 -1
- package/lib/module/components/typography/index.js +2 -1
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/components/waterfall-chart/index.js +22 -3
- package/lib/module/components/waterfall-chart/index.js.map +1 -1
- package/lib/module/hooks/use-disclosure.js +10 -8
- package/lib/module/hooks/use-disclosure.js.map +1 -1
- package/lib/module/icons/index.js +135 -0
- package/lib/module/icons/index.js.map +1 -1
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/primitives/controllable-state.js +61 -0
- package/lib/module/primitives/controllable-state.js.map +1 -0
- package/lib/module/primitives/finite-chart.js +15 -0
- package/lib/module/primitives/finite-chart.js.map +1 -0
- package/lib/module/primitives/glass.js +136 -0
- package/lib/module/primitives/glass.js.map +1 -0
- package/lib/module/primitives/scrim.js +8 -1
- package/lib/module/primitives/scrim.js.map +1 -1
- package/lib/typescript/src/components/ai-input/ai-input-growth.d.ts +59 -0
- package/lib/typescript/src/components/ai-input/ai-input-growth.d.ts.map +1 -0
- package/lib/typescript/src/components/ai-input/index.d.ts +423 -0
- package/lib/typescript/src/components/ai-input/index.d.ts.map +1 -0
- package/lib/typescript/src/components/avatar/avatar-source.d.ts +4 -0
- package/lib/typescript/src/components/avatar/avatar-source.d.ts.map +1 -0
- package/lib/typescript/src/components/avatar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts +10 -1
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/carousel/index.d.ts.map +1 -1
- package/lib/typescript/src/components/drawer/index.d.ts.map +1 -1
- package/lib/typescript/src/components/marquee/index.d.ts +15 -6
- package/lib/typescript/src/components/marquee/index.d.ts.map +1 -1
- package/lib/typescript/src/components/marquee/marquee-math.d.ts +6 -0
- package/lib/typescript/src/components/marquee/marquee-math.d.ts.map +1 -1
- package/lib/typescript/src/components/plan/index.d.ts.map +1 -1
- package/lib/typescript/src/components/plot/index.d.ts +2 -1
- package/lib/typescript/src/components/plot/index.d.ts.map +1 -1
- package/lib/typescript/src/components/search-bar/index.d.ts.map +1 -1
- package/lib/typescript/src/components/split-view/index.d.ts.map +1 -1
- package/lib/typescript/src/components/split-view/split-view-lifecycle.d.ts +14 -0
- package/lib/typescript/src/components/split-view/split-view-lifecycle.d.ts.map +1 -0
- package/lib/typescript/src/components/splitter/index.d.ts +2 -2
- package/lib/typescript/src/components/splitter/index.d.ts.map +1 -1
- package/lib/typescript/src/components/splitter/splitter-math.d.ts +2 -0
- package/lib/typescript/src/components/splitter/splitter-math.d.ts.map +1 -1
- package/lib/typescript/src/components/timeline/index.d.ts +24 -2
- package/lib/typescript/src/components/timeline/index.d.ts.map +1 -1
- package/lib/typescript/src/components/timeline/timeline-geometry.d.ts +2 -0
- package/lib/typescript/src/components/timeline/timeline-geometry.d.ts.map +1 -1
- package/lib/typescript/src/components/toast/index.d.ts.map +1 -1
- package/lib/typescript/src/components/waterfall-chart/index.d.ts +2 -1
- package/lib/typescript/src/components/waterfall-chart/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-disclosure.d.ts.map +1 -1
- package/lib/typescript/src/icons/index.d.ts +18 -0
- package/lib/typescript/src/icons/index.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/controllable-state.d.ts +33 -0
- package/lib/typescript/src/primitives/controllable-state.d.ts.map +1 -0
- package/lib/typescript/src/primitives/finite-chart.d.ts +5 -0
- package/lib/typescript/src/primitives/finite-chart.d.ts.map +1 -0
- package/lib/typescript/src/primitives/glass.d.ts +43 -0
- package/lib/typescript/src/primitives/glass.d.ts.map +1 -0
- package/lib/typescript/src/primitives/scrim.d.ts +7 -0
- package/lib/typescript/src/primitives/scrim.d.ts.map +1 -1
- package/package.json +7 -2
- package/src/components/ai-input/ai-input-growth.ts +65 -0
- package/src/components/ai-input/index.tsx +1937 -0
- package/src/components/alert/index.tsx +1 -1
- package/src/components/avatar/avatar-source.ts +18 -0
- package/src/components/avatar/index.tsx +35 -27
- package/src/components/bottom-sheet/index.tsx +15 -3
- package/src/components/button-group/index.tsx +1 -1
- package/src/components/carousel/index.tsx +10 -11
- package/src/components/collapsible/index.tsx +1 -1
- package/src/components/drawer/index.tsx +24 -20
- package/src/components/field/index.tsx +4 -4
- package/src/components/label/index.tsx +1 -1
- package/src/components/marquee/index.tsx +56 -12
- package/src/components/marquee/marquee-math.ts +26 -3
- package/src/components/plan/index.tsx +6 -2
- package/src/components/plot/index.tsx +37 -11
- package/src/components/search-bar/index.tsx +9 -3
- package/src/components/split-view/index.tsx +24 -33
- package/src/components/split-view/split-view-lifecycle.ts +43 -0
- package/src/components/splitter/index.tsx +7 -11
- package/src/components/splitter/splitter-math.ts +28 -0
- package/src/components/tabs/index.tsx +1 -1
- package/src/components/timeline/index.tsx +189 -34
- package/src/components/timeline/timeline-geometry.ts +11 -0
- package/src/components/toast/index.tsx +6 -1
- package/src/components/tooltip/index.tsx +1 -1
- package/src/components/tree/index.tsx +2 -2
- package/src/components/typography/index.tsx +2 -2
- package/src/components/waterfall-chart/index.tsx +37 -4
- package/src/hooks/use-disclosure.ts +7 -12
- package/src/icons/index.tsx +106 -0
- package/src/index.ts +27 -0
- package/src/primitives/controllable-state.ts +112 -0
- package/src/primitives/finite-chart.ts +14 -0
- package/src/primitives/glass.tsx +171 -0
- package/src/primitives/scrim.tsx +7 -1
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Glass — the material iOS draws its own floating controls in.
|
|
5
|
+
*
|
|
6
|
+
* A control that floats over content needs to read as *over* it, and a flat
|
|
7
|
+
* fill cannot say that: it either hides what is behind it or disappears into
|
|
8
|
+
* it. The system material does both jobs at once — it refracts what is behind,
|
|
9
|
+
* lifts its own edge, and stays legible over anything.
|
|
10
|
+
*
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Glass radius={28} className="px-4 py-3">
|
|
13
|
+
* <Text>Over whatever is behind it.</Text>
|
|
14
|
+
* </Glass>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* ## Where it is real, and where it is not
|
|
18
|
+
*
|
|
19
|
+
* The material exists on iOS 26 and above. Below that, on Android, on web, and
|
|
20
|
+
* for anyone who has switched Reduce Transparency on, this draws
|
|
21
|
+
* `fallbackClassName` instead — a solid token surface. That is deliberate
|
|
22
|
+
* rather than a gap: a hand-drawn approximation of a system material is a
|
|
23
|
+
* near-miss on the one platform that has the real thing, and on Android it is
|
|
24
|
+
* an iOS look pasted onto a platform that never asked for it.
|
|
25
|
+
*
|
|
26
|
+
* So `Glass` is not a promise that the screen will be glass. It is a promise
|
|
27
|
+
* that the container will be drawn correctly either way, and callers should
|
|
28
|
+
* pick a `fallbackClassName` that stands on its own.
|
|
29
|
+
*
|
|
30
|
+
* ## The material is a layer, not the box
|
|
31
|
+
*
|
|
32
|
+
* The native view is rendered as a non-interactive layer filling this
|
|
33
|
+
* container, with the content above it, for the same reason `Scrim` layers a
|
|
34
|
+
* blur: it keeps every layout class, every token and every touch target on an
|
|
35
|
+
* ordinary `View` that behaves the way the rest of the library does.
|
|
36
|
+
*
|
|
37
|
+
* `radius` is a number rather than a class because the material has to round
|
|
38
|
+
* its own corners — clipping a square one to a rounded parent throws away the
|
|
39
|
+
* lit edge that makes it read as glass.
|
|
40
|
+
*
|
|
41
|
+
* ## Do not fade it
|
|
42
|
+
*
|
|
43
|
+
* Setting `opacity` to `0` on the material or on anything above it stops it
|
|
44
|
+
* rendering at all, and it does not come back when the opacity does. Move it,
|
|
45
|
+
* or unmount it; never animate it out.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
import { Platform, StyleSheet, View } from 'react-native';
|
|
49
|
+
import { cn } from "../utils/cn.js";
|
|
50
|
+
import { useReduceTransparency } from "./scrim.js";
|
|
51
|
+
|
|
52
|
+
/** How the material treats what is behind it. */
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Corner radius in points — one number for all four, or a top and a bottom.
|
|
56
|
+
*
|
|
57
|
+
* The two-sided form is for a surface with an edge that is not a real edge: a
|
|
58
|
+
* sheet docked to the bottom of the screen rounds its top and leaves its
|
|
59
|
+
* bottom square, because the screen edge is where it ends.
|
|
60
|
+
*/
|
|
61
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
62
|
+
function shapeOf(radius) {
|
|
63
|
+
if (radius === undefined) return null;
|
|
64
|
+
if (typeof radius === 'number') return {
|
|
65
|
+
borderRadius: radius
|
|
66
|
+
};
|
|
67
|
+
return {
|
|
68
|
+
borderTopLeftRadius: radius.top ?? 0,
|
|
69
|
+
borderTopRightRadius: radius.top ?? 0,
|
|
70
|
+
borderBottomLeftRadius: radius.bottom ?? 0,
|
|
71
|
+
borderBottomRightRadius: radius.bottom ?? 0
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* `expo-glass-effect`'s GlassView, or null when the material cannot be drawn
|
|
76
|
+
* here.
|
|
77
|
+
*
|
|
78
|
+
* Resolved once at module load, behind three gates that all have to pass. The
|
|
79
|
+
* package is optional, so the require can fail; the API is missing from some
|
|
80
|
+
* iOS 26 builds, and reaching for it there crashes; and the design itself is
|
|
81
|
+
* only present when the app was compiled for it. Asking all three once is
|
|
82
|
+
* cheaper than a try/catch on every render, and there is no answer that can
|
|
83
|
+
* change while the process is alive.
|
|
84
|
+
*/
|
|
85
|
+
const GlassView = (() => {
|
|
86
|
+
if (Platform.OS !== 'ios') return null;
|
|
87
|
+
try {
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
89
|
+
const mod = require('expo-glass-effect');
|
|
90
|
+
if (typeof mod?.isGlassEffectAPIAvailable === 'function' && !mod.isGlassEffectAPIAvailable()) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
if (typeof mod?.isLiquidGlassAvailable === 'function' && !mod.isLiquidGlassAvailable()) {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
return mod?.GlassView ?? null;
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
})();
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* True when the real material can be drawn — for a caller that wants to know
|
|
104
|
+
* before it commits to a look. It says nothing about Reduce Transparency, which
|
|
105
|
+
* is a live preference and belongs to the hook.
|
|
106
|
+
*/
|
|
107
|
+
export const hasGlass = GlassView !== null;
|
|
108
|
+
export function Glass({
|
|
109
|
+
variant = 'regular',
|
|
110
|
+
tint,
|
|
111
|
+
radius,
|
|
112
|
+
fallbackClassName = 'bg-card',
|
|
113
|
+
className,
|
|
114
|
+
children,
|
|
115
|
+
style,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
const reduceTransparency = useReduceTransparency();
|
|
119
|
+
// Not knowing yet counts as "do not draw it": the material arriving a frame
|
|
120
|
+
// late is invisible, and one flashing at somebody who opted out is not.
|
|
121
|
+
const material = GlassView !== null && reduceTransparency === false;
|
|
122
|
+
const shape = shapeOf(radius);
|
|
123
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
124
|
+
className: cn('overflow-hidden', material ? null : fallbackClassName, className),
|
|
125
|
+
style: [shape, style],
|
|
126
|
+
...props,
|
|
127
|
+
children: [material && GlassView ? /*#__PURE__*/_jsx(GlassView, {
|
|
128
|
+
glassEffectStyle: variant,
|
|
129
|
+
tintColor: tint,
|
|
130
|
+
pointerEvents: "none",
|
|
131
|
+
style: [StyleSheet.absoluteFill, shape]
|
|
132
|
+
}) : null, children]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
Glass.displayName = 'Glass';
|
|
136
|
+
//# sourceMappingURL=glass.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","StyleSheet","View","cn","useReduceTransparency","jsx","_jsx","jsxs","_jsxs","shapeOf","radius","undefined","borderRadius","borderTopLeftRadius","top","borderTopRightRadius","borderBottomLeftRadius","bottom","borderBottomRightRadius","GlassView","OS","mod","require","isGlassEffectAPIAvailable","isLiquidGlassAvailable","hasGlass","Glass","variant","tint","fallbackClassName","className","children","style","props","reduceTransparency","material","shape","glassEffectStyle","tintColor","pointerEvents","absoluteFill","displayName"],"sourceRoot":"../../../src","sources":["primitives/glass.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAwD,cAAc;AACzG,SAASC,EAAE,QAAQ,gBAAa;AAChC,SAASC,qBAAqB,QAAQ,YAAS;;AAE/C;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AASA,SAASC,OAAOA,CAACC,MAA+B,EAAE;EAChD,IAAIA,MAAM,KAAKC,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AC,CAAC;EAClD;EACA;EACA,MAAM+B,QAAQ,GAAGhB,SAAS,KAAK,IAAI,IAAIe,kBAAkB,KAAK,KAAK;EACnE,MAAME,KAAK,GAAG3B,OAAO,CAACC,MAAM,CAAC;EAE7B,oBACEF,KAAA,CAACN,IAAI;IACH4B,SAAS,EAAE3B,EAAE,CAAC,iBAAiB,EAAEgC,QAAQ,GAAG,IAAI,GAAGN,iBAAiB,EAAEC,SAAS,CAAE;IACjFE,KAAK,EAAE,CAACI,KAAK,EAAEJ,KAAK,CAAE;IAAA,GAClBC,KAAK;IAAAF,QAAA,GAERI,QAAQ,IAAIhB,SAAS,gBACpBb,IAAA,CAACa,SAAS;MACRkB,gBAAgB,EAAEV,OAAQ;MAC1BW,SAAS,EAAEV,IAAK;MAChBW,aAAa,EAAC,MAAM;MACpBP,KAAK,EAAE,CAAC/B,UAAU,CAACuC,YAAY,EAAEJ,KAAK;IAAE,CACzC,CAAC,GACA,IAAI,EACPL,QAAQ;EAAA,CACL,CAAC;AAEX;AAEAL,KAAK,CAACe,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -89,7 +89,14 @@ function observeReduceTransparency(source, onChange) {
|
|
|
89
89
|
* launch can see it.
|
|
90
90
|
*/
|
|
91
91
|
let knownReduceTransparency = null;
|
|
92
|
-
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Whether the device asks for Reduce Transparency: `true`, `false`, or `null`
|
|
95
|
+
* while the platform has not answered yet. Exported because every material in
|
|
96
|
+
* the library has to respect the same preference, and two copies of this would
|
|
97
|
+
* be two answers.
|
|
98
|
+
*/
|
|
99
|
+
export function useReduceTransparency() {
|
|
93
100
|
// Not knowing is deliberately conservative: draw opaque until the platform
|
|
94
101
|
// says blur is allowed, rather than flashing blur at someone who opted out.
|
|
95
102
|
const [enabled, setEnabled] = useState(knownReduceTransparency);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useState","AccessibilityInfo","StyleSheet","View","Animated","FadeIn","FadeOut","jsx","_jsx","jsxs","_jsxs","BlurView","mod","require","hasBlur","observeReduceTransparency","source","onChange","active","changed","update","enabled","Boolean","fallback","queryable","subscription","addEventListener","isReduceTransparencyEnabled","then","remove","knownReduceTransparency","useReduceTransparency","setEnabled","next","scrimMode","blur","canBlur","reduceTransparency","opaqueClassName","tint","Scrim","intensity","dimClassName","style","props","mode","entering","duration","exiting","absoluteFill","children","className","pointerEvents","displayName"],"sourceRoot":"../../../src","sources":["primitives/scrim.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAA4B,OAAO;AAC/D,SAASC,iBAAiB,EAAEC,UAAU,EAAEC,IAAI,QAAwB,cAAc;AAClF,OAAOC,QAAQ,IAAIC,MAAM,EAAEC,OAAO,QAAQ,yBAAyB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAWpE;AACA;AACA;AACA;AACA;AACA,MAAMC,QAA6C,GAAG,CAAC,MAAM;EAC3D,IAAI;IACF;IACA,MAAMC,GAAG,GAAGC,OAAO,CAAC,WAAW,CAAC;IAChC,OAAQD,GAAG,EAAED,QAAQ,IAAqC,IAAI;EAChE,CAAC,CAAC,MAAM;IACN,OAAO,IAAI;EACb;AACF,CAAC,EAAE,CAAC;;AAEJ;AACA,OAAO,MAAMG,OAAO,GAAGH,QAAQ,KAAK,IAAI;AAUxC,SAASI,yBAAyBA,CAChCC,MAAgC,EAChCC,QAAoC,EACpC;EACA,IAAIC,MAAM,GAAG,IAAI;EACjB,IAAIC,OAAO,GAAG,KAAK;EACnB,MAAMC,MAAM,GAAIC,OAAgB,IAAK;IACnCF,OAAO,GAAG,IAAI;IACd,IAAID,MAAM,EAAED,QAAQ,CAACK,OAAO,CAACD,OAAO,CAAC,CAAC;EACxC,CAAC;EACD;AACF;AACA;AACA;AACA;EACE,MAAME,QAAQ,GAAIC,SAAkB,IAAK,MAAM;IAC7C,IAAIN,MAAM,IAAI,CAACC,OAAO,EAAEF,QAAQ,CAACO,SAAS,CAAC;EAC7C,CAAC;EAED,IAAIC,YAAiD;EACrD,IAAI;IACFA,YAAY,GAAGT,MAAM,CAACU,gBAAgB,GAAG,2BAA2B,EAAEN,MAAM,CAAC;EAC/E,CAAC,CAAC,MAAM;IACN;EAAA;EAGF,IAAI;IACF,IAAI,OAAOJ,MAAM,CAACW,2BAA2B,KAAK,UAAU,EAAEJ,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAC3E;MACH,KAAKP,MAAM,CAACW,2BAA2B,CAAC,CAAC,CAACC,IAAI,CAAEP,OAAO,IAAK;QAC1D;QACA,IAAIH,MAAM,IAAI,CAACC,OAAO,EAAEC,MAAM,CAACC,OAAO,CAAC;MACzC,CAAC,EAAEE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACpB;EACF,CAAC,CAAC,MAAM;IACNA,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;EAClB;EAEA,OAAO,MAAM;IACXL,MAAM,GAAG,KAAK;IACd,IAAI;MACFO,YAAY,EAAEI,MAAM,GAAG,CAAC;IAC1B,CAAC,CAAC,MAAM;MACN;IAAA;EAEJ,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAIC,uBAAuC,GAAG,IAAI;
|
|
1
|
+
{"version":3,"names":["useEffect","useState","AccessibilityInfo","StyleSheet","View","Animated","FadeIn","FadeOut","jsx","_jsx","jsxs","_jsxs","BlurView","mod","require","hasBlur","observeReduceTransparency","source","onChange","active","changed","update","enabled","Boolean","fallback","queryable","subscription","addEventListener","isReduceTransparencyEnabled","then","remove","knownReduceTransparency","useReduceTransparency","setEnabled","next","scrimMode","blur","canBlur","reduceTransparency","opaqueClassName","tint","Scrim","intensity","dimClassName","style","props","mode","entering","duration","exiting","absoluteFill","children","className","pointerEvents","displayName"],"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EN,KAAK,CAAE;MAAA,GACpCC,KAAK;MAAAM,QAAA,gBAET1C,IAAA,CAACL,IAAI;QACHiD,aAAa,EAAC,MAAM;QACpBT,KAAK,EAAEzC,UAAU,CAAC+C,YAAa;QAC/BE,SAAS,EAAEb,eAAe,CAACC,IAAI;MAAE,CAClC,CAAC,eACF/B,IAAA,CAACL,IAAI;QAACiD,aAAa,EAAC,MAAM;QAACT,KAAK,EAAEzC,UAAU,CAAC+C,YAAa;QAACE,SAAS,EAAET;MAAa,CAAE,CAAC;IAAA,CACzE,CAAC;EAEpB;EAEA,oBACElC,IAAA,CAACJ,QAAQ,CAACD,IAAI;IACZ2C,QAAQ,EAAEzC,MAAM,CAAC0C,QAAQ,CAAC,GAAG,CAAE;IAC/BC,OAAO,EAAE1C,OAAO,CAACyC,QAAQ,CAAC,GAAG,CAAE;IAC/BJ,KAAK,EAAE,CAACzC,UAAU,CAAC+C,YAAY,EAAEN,KAAK,CAAE;IACxCQ,SAAS,EAAET,YAAa;IAAA,GACpBE;EAAK,CACV,CAAC;AAEN;AAEAJ,KAAK,CAACa,WAAW,GAAG,OAAO","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How tall the composer's field is allowed to be.
|
|
3
|
+
*
|
|
4
|
+
* Separated from the component because it is the one piece of AI Input with a
|
|
5
|
+
* right answer that can be checked without a device: a composer that opens at
|
|
6
|
+
* the wrong height, or grows past where it was told to stop, is a bug nobody
|
|
7
|
+
* notices until the send button is off the bottom of the screen.
|
|
8
|
+
*
|
|
9
|
+
* ## Bounds, not a measured height
|
|
10
|
+
*
|
|
11
|
+
* The obvious way to grow a field is to measure its content and set a height
|
|
12
|
+
* from it. That is a loop with a different answer on each platform — the
|
|
13
|
+
* measurement reports the text's height on one and the clipped height of the
|
|
14
|
+
* box we just set on another, where the field can then never grow at all.
|
|
15
|
+
*
|
|
16
|
+
* So nothing is measured. The field is given a floor and a ceiling and left to
|
|
17
|
+
* size itself between them, which is the layout engine's job and which it does
|
|
18
|
+
* without telling anybody. Past the ceiling a multiline field scrolls its own
|
|
19
|
+
* content, and that is the whole mechanism.
|
|
20
|
+
*/
|
|
21
|
+
/** Type size and the leading it is given, per `size`. */
|
|
22
|
+
export declare const AI_INPUT_METRICS: {
|
|
23
|
+
readonly sm: {
|
|
24
|
+
readonly fontSize: 15;
|
|
25
|
+
readonly lineHeight: 20;
|
|
26
|
+
readonly padding: 10;
|
|
27
|
+
};
|
|
28
|
+
readonly md: {
|
|
29
|
+
readonly fontSize: 16;
|
|
30
|
+
readonly lineHeight: 22;
|
|
31
|
+
readonly padding: 12;
|
|
32
|
+
};
|
|
33
|
+
readonly lg: {
|
|
34
|
+
readonly fontSize: 17;
|
|
35
|
+
readonly lineHeight: 24;
|
|
36
|
+
readonly padding: 14;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export type AIInputSize = keyof typeof AI_INPUT_METRICS;
|
|
40
|
+
export interface GrowthMetrics {
|
|
41
|
+
lineHeight: number;
|
|
42
|
+
padding: number;
|
|
43
|
+
}
|
|
44
|
+
/** The box a whole number of lines asks for: the lines, plus both paddings. */
|
|
45
|
+
export declare function heightForLines(metrics: GrowthMetrics, lines: number): number;
|
|
46
|
+
export interface GrowthBounds {
|
|
47
|
+
minHeight: number;
|
|
48
|
+
maxHeight: number;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The floor and ceiling a field grows between.
|
|
52
|
+
*
|
|
53
|
+
* At least one line, so an empty composer is the size of an empty composer.
|
|
54
|
+
* Never below the floor, so a `maxRows` under `minRows` — a caller
|
|
55
|
+
* contradicting itself — resolves to the height that was asked for outright
|
|
56
|
+
* rather than to one shorter than the field was told to open at.
|
|
57
|
+
*/
|
|
58
|
+
export declare function growthBounds(metrics: GrowthMetrics, minRows: number, maxRows: number): GrowthBounds;
|
|
59
|
+
//# sourceMappingURL=ai-input-growth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-input-growth.d.ts","sourceRoot":"","sources":["../../../../../src/components/ai-input/ai-input-growth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,yDAAyD;AACzD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;CAInB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,gBAAgB,CAAC;AAExD,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,GACd,YAAY,CAOd"}
|
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AIInput — the composer a person types a prompt into.
|
|
3
|
+
*
|
|
4
|
+
* ```tsx
|
|
5
|
+
* <AIInput value={value} onValueChange={setValue} onSubmit={send}>
|
|
6
|
+
* <AIInput.Field placeholder="Chat with the model" />
|
|
7
|
+
* <AIInput.Toolbar>
|
|
8
|
+
* <AIInput.Action label="Add" icon={<PlusIcon />} onPress={openSheet} />
|
|
9
|
+
* <AIInput.Pill label="Sonnet 4.6" detail="High" onPress={openModels} />
|
|
10
|
+
* <AIInput.Action label="Dictate" icon={<MicIcon />} onPress={record} />
|
|
11
|
+
* <AIInput.Submit />
|
|
12
|
+
* </AIInput.Toolbar>
|
|
13
|
+
* </AIInput>
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* ## The field grows, and then it stops
|
|
17
|
+
*
|
|
18
|
+
* It opens one line tall and follows what is typed into it up to `maxRows`,
|
|
19
|
+
* after which it holds that height and scrolls its own content. Five rows is
|
|
20
|
+
* the default because a composer that keeps growing eventually pushes its own
|
|
21
|
+
* send button off the bottom of the screen, and the row that carries the
|
|
22
|
+
* actions stays pinned to the bottom of the box either way.
|
|
23
|
+
*
|
|
24
|
+
* ## It does not record anything
|
|
25
|
+
*
|
|
26
|
+
* There is a recording state, and it draws a live meter, but nothing here
|
|
27
|
+
* touches the microphone. The app owns the recorder — the permission prompt,
|
|
28
|
+
* the session, the platform quirks — and passes back a `level` between 0 and 1
|
|
29
|
+
* along with a `status`. Pass a Reanimated shared value and a recorder
|
|
30
|
+
* reporting every 30ms never re-renders anything above this component.
|
|
31
|
+
*
|
|
32
|
+
* That division is what keeps the composer free of an audio dependency.
|
|
33
|
+
*
|
|
34
|
+
* ## Glass is iOS 26 and above
|
|
35
|
+
*
|
|
36
|
+
* The surfaces ask for the system material and get it where it exists. Below
|
|
37
|
+
* iOS 26, on Android, and for anyone with Reduce Transparency switched on,
|
|
38
|
+
* they are drawn as solid token surfaces instead. Both are finished looks; see
|
|
39
|
+
* `Glass` for why nothing is faked on the platforms without it.
|
|
40
|
+
*
|
|
41
|
+
* ## Where the props come from
|
|
42
|
+
*
|
|
43
|
+
* The root takes `ViewProps`. `Field` takes `TextInputProps`, so
|
|
44
|
+
* `keyboardType`, `maxLength`, `autoFocus` and the rest work as they always
|
|
45
|
+
* do. Every part takes `className`.
|
|
46
|
+
*/
|
|
47
|
+
import { type ReactNode } from 'react';
|
|
48
|
+
import { type TextInputProps, type ViewProps } from 'react-native';
|
|
49
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
50
|
+
import { type AIInputSize } from './ai-input-growth.js';
|
|
51
|
+
/** What the app is doing, which is what the trailing button offers to do next. */
|
|
52
|
+
export type AIInputStatus = 'ready' | 'recording' | 'submitted' | 'streaming';
|
|
53
|
+
export interface AIInputProps extends Omit<ViewProps, 'children'> {
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
className?: string;
|
|
56
|
+
/** The prompt, when the app owns it. */
|
|
57
|
+
value?: string;
|
|
58
|
+
/** Called on every keystroke. */
|
|
59
|
+
onValueChange?: (value: string) => void;
|
|
60
|
+
/** The prompt to start with, when the composer owns it. */
|
|
61
|
+
defaultValue?: string;
|
|
62
|
+
/**
|
|
63
|
+
* What the app is doing. `ready` offers to send, `streaming` offers to stop,
|
|
64
|
+
* and `recording` swaps the toolbar for the meter and its two decisions.
|
|
65
|
+
*/
|
|
66
|
+
status?: AIInputStatus;
|
|
67
|
+
/** Called with the prompt when it is sent. The composer does not clear itself. */
|
|
68
|
+
onSubmit?: (value: string) => void;
|
|
69
|
+
/** Called when the trailing button is pressed while `streaming`. */
|
|
70
|
+
onStop?: () => void;
|
|
71
|
+
/** Called when the voice button is pressed on an empty composer. */
|
|
72
|
+
onVoice?: () => void;
|
|
73
|
+
/** Called when a recording is thrown away. */
|
|
74
|
+
onRecordCancel?: () => void;
|
|
75
|
+
/** Called when a recording is accepted. */
|
|
76
|
+
onRecordConfirm?: () => void;
|
|
77
|
+
/**
|
|
78
|
+
* Input level, 0–1, from the app's own recorder. Pass a shared value to keep
|
|
79
|
+
* metering off the JS thread entirely. Omitted, the meter animates plausible
|
|
80
|
+
* motion so a screen can be built before any audio exists.
|
|
81
|
+
*/
|
|
82
|
+
level?: number | SharedValue<number>;
|
|
83
|
+
/** Type scale and control size. */
|
|
84
|
+
size?: AIInputSize;
|
|
85
|
+
/** Nothing can be typed, pressed or sent. */
|
|
86
|
+
disabled?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Draw the toolbar's controls as the platform's own buttons, in the system
|
|
89
|
+
* material — Liquid Glass on iOS 26, the platform's ordinary button style
|
|
90
|
+
* below it and on Android.
|
|
91
|
+
*
|
|
92
|
+
* The platform owns their colour, metrics and shape when this is on, so
|
|
93
|
+
* `className` and the theme tokens no longer reach them. The card behind
|
|
94
|
+
* them is still ours, and still glass. Needs the optional `@expo/ui`;
|
|
95
|
+
* without it the drawn controls are used and nothing breaks.
|
|
96
|
+
*/
|
|
97
|
+
native?: boolean;
|
|
98
|
+
/** Rows the empty field is tall. */
|
|
99
|
+
minRows?: number;
|
|
100
|
+
/** Rows the field grows to before it holds that height and scrolls. */
|
|
101
|
+
maxRows?: number;
|
|
102
|
+
/** Lift the composer clear of the software keyboard. */
|
|
103
|
+
avoidKeyboard?: boolean;
|
|
104
|
+
/** How far above the bottom edge the composer already sits. */
|
|
105
|
+
keyboardBottomInset?: number;
|
|
106
|
+
/**
|
|
107
|
+
* Gap to leave between the composer and the top of the keyboard. A composer
|
|
108
|
+
* resting directly on the keys reads as part of them.
|
|
109
|
+
*/
|
|
110
|
+
keyboardGap?: number;
|
|
111
|
+
}
|
|
112
|
+
declare function AIInputRoot({ children, className, value: valueProp, onValueChange, defaultValue, status, onSubmit, onStop, onVoice, onRecordCancel, onRecordConfirm, level, size, disabled, native, minRows, maxRows, avoidKeyboard, keyboardBottomInset, keyboardGap, style, ...props }: AIInputProps): import("react").JSX.Element;
|
|
113
|
+
declare namespace AIInputRoot {
|
|
114
|
+
var displayName: string;
|
|
115
|
+
}
|
|
116
|
+
export interface AIInputFieldProps extends Omit<TextInputProps, 'value' | 'onChangeText' | 'multiline'> {
|
|
117
|
+
className?: string;
|
|
118
|
+
}
|
|
119
|
+
declare function AIInputField({ className, placeholder, onFocus, onBlur, style, ...props }: AIInputFieldProps): import("react").JSX.Element;
|
|
120
|
+
declare namespace AIInputField {
|
|
121
|
+
var displayName: string;
|
|
122
|
+
}
|
|
123
|
+
export interface AIInputRowProps extends ViewProps {
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The field and its controls on a single line.
|
|
128
|
+
*
|
|
129
|
+
* The composer at its smallest: one pill above the keyboard with the field
|
|
130
|
+
* between the controls rather than above them. It suits a bar that is always
|
|
131
|
+
* on screen, where the stacked composer suits one that is the focus of it.
|
|
132
|
+
*
|
|
133
|
+
* The field still grows — it just grows the row.
|
|
134
|
+
*
|
|
135
|
+
* ```tsx
|
|
136
|
+
* <AIInput>
|
|
137
|
+
* <AIInput.Row>
|
|
138
|
+
* <AIInput.Action label="Add" icon={<PlusIcon />} />
|
|
139
|
+
* <AIInput.Field placeholder="Ask anything" />
|
|
140
|
+
* <AIInput.Action label="Dictate" icon={<MicIcon />} />
|
|
141
|
+
* <AIInput.Submit />
|
|
142
|
+
* </AIInput.Row>
|
|
143
|
+
* </AIInput>
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
declare function AIInputRow({ className, children, ...props }: AIInputRowProps): import("react").JSX.Element;
|
|
147
|
+
declare namespace AIInputRow {
|
|
148
|
+
var displayName: string;
|
|
149
|
+
}
|
|
150
|
+
export interface AIInputToolbarProps extends ViewProps {
|
|
151
|
+
className?: string;
|
|
152
|
+
}
|
|
153
|
+
declare function AIInputToolbar({ className, children, style, ...props }: AIInputToolbarProps): import("react").JSX.Element;
|
|
154
|
+
declare namespace AIInputToolbar {
|
|
155
|
+
var displayName: string;
|
|
156
|
+
}
|
|
157
|
+
/** Pushes everything after it to the trailing end of the toolbar. */
|
|
158
|
+
declare function AIInputSpacer({ className, ...props }: ViewProps): import("react").JSX.Element;
|
|
159
|
+
declare namespace AIInputSpacer {
|
|
160
|
+
var displayName: string;
|
|
161
|
+
}
|
|
162
|
+
export interface AIInputActionProps extends Omit<ViewProps, 'children'>, Pick<ViewProps, 'accessibilityHint'> {
|
|
163
|
+
className?: string;
|
|
164
|
+
/** Names the control. It is a circle with a glyph in it; nothing else says what it does. */
|
|
165
|
+
label: string;
|
|
166
|
+
icon: ReactNode;
|
|
167
|
+
onPress?: () => void;
|
|
168
|
+
disabled?: boolean;
|
|
169
|
+
/** Control size. Inherited from the composer when it is inside one. */
|
|
170
|
+
size?: AIInputSize;
|
|
171
|
+
/**
|
|
172
|
+
* Draw it as the platform's own button, in the system material. Inherited
|
|
173
|
+
* from the composer when it is inside one. The platform owns its colour and
|
|
174
|
+
* shape, so `className` stops reaching it.
|
|
175
|
+
*/
|
|
176
|
+
native?: boolean;
|
|
177
|
+
}
|
|
178
|
+
declare function AIInputAction({ className, label, icon, onPress, disabled, size: sizeProp, native, ...props }: AIInputActionProps): import("react").JSX.Element;
|
|
179
|
+
declare namespace AIInputAction {
|
|
180
|
+
var displayName: string;
|
|
181
|
+
}
|
|
182
|
+
export interface AIInputPillProps extends Omit<ViewProps, 'children'> {
|
|
183
|
+
className?: string;
|
|
184
|
+
/** The current value — a model name, a mode, a project. */
|
|
185
|
+
label: ReactNode;
|
|
186
|
+
/** A second, quieter value beside it. */
|
|
187
|
+
detail?: ReactNode;
|
|
188
|
+
/** A glyph after the labels, for a pill that opens a list. */
|
|
189
|
+
indicator?: ReactNode;
|
|
190
|
+
onPress?: () => void;
|
|
191
|
+
disabled?: boolean;
|
|
192
|
+
/** Names the control when the label alone does not say what changing it does. */
|
|
193
|
+
accessibilityLabel?: string;
|
|
194
|
+
/** Control size. Inherited from the composer when it is inside one. */
|
|
195
|
+
size?: AIInputSize;
|
|
196
|
+
/**
|
|
197
|
+
* Draw it as the platform's own button, in the system material. Only a
|
|
198
|
+
* string `label` can be handed over — a hosted view inside a native button
|
|
199
|
+
* has no width anything can resolve — so a pill given elements is drawn
|
|
200
|
+
* here whatever this says.
|
|
201
|
+
*/
|
|
202
|
+
native?: boolean;
|
|
203
|
+
}
|
|
204
|
+
declare function AIInputPill({ className, label, detail, indicator, onPress, disabled, accessibilityLabel, size: sizeProp, native, ...props }: AIInputPillProps): import("react").JSX.Element;
|
|
205
|
+
declare namespace AIInputPill {
|
|
206
|
+
var displayName: string;
|
|
207
|
+
}
|
|
208
|
+
export interface AIInputSubmitProps extends Omit<ViewProps, 'children'> {
|
|
209
|
+
className?: string;
|
|
210
|
+
/** Names the button in its send state. */
|
|
211
|
+
sendLabel?: string;
|
|
212
|
+
/** Names it in its voice state, which is what an empty composer offers. */
|
|
213
|
+
voiceLabel?: string;
|
|
214
|
+
/** Names it while the model is answering. */
|
|
215
|
+
stopLabel?: string;
|
|
216
|
+
/** Draw it as the platform's own button, in the system material. */
|
|
217
|
+
native?: boolean;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* The trailing button, which is three buttons wearing one shape.
|
|
221
|
+
*
|
|
222
|
+
* Empty and ready, it opens voice mode; with something typed, it sends; while
|
|
223
|
+
* the model is answering, it stops. One control rather than three because only
|
|
224
|
+
* one of them is ever the thing to do, and a row of dimmed siblings is a row
|
|
225
|
+
* of things that look broken.
|
|
226
|
+
*/
|
|
227
|
+
declare function AIInputSubmit({ className, sendLabel, voiceLabel, stopLabel, native, ...props }: AIInputSubmitProps): import("react").JSX.Element;
|
|
228
|
+
declare namespace AIInputSubmit {
|
|
229
|
+
var displayName: string;
|
|
230
|
+
}
|
|
231
|
+
export interface AIInputRecordingProps extends Omit<ViewProps, 'children'> {
|
|
232
|
+
className?: string;
|
|
233
|
+
cancelLabel?: string;
|
|
234
|
+
confirmLabel?: string;
|
|
235
|
+
/** Draw the two decisions as the platform's own buttons. */
|
|
236
|
+
native?: boolean;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* What the toolbar becomes while a recording is running: throw it away, watch
|
|
240
|
+
* it, or keep it. Render it in place of `AIInput.Toolbar` when `status` is
|
|
241
|
+
* `recording`.
|
|
242
|
+
*/
|
|
243
|
+
declare function AIInputRecording({ className, cancelLabel, confirmLabel, native, ...props }: AIInputRecordingProps): import("react").JSX.Element;
|
|
244
|
+
declare namespace AIInputRecording {
|
|
245
|
+
var displayName: string;
|
|
246
|
+
}
|
|
247
|
+
export interface AIInputSheetScreenProps extends ViewProps {
|
|
248
|
+
className?: string;
|
|
249
|
+
/** Names this screen. `AIInput.Sheet.Row`'s `to` pushes the screen with this id. */
|
|
250
|
+
id: string;
|
|
251
|
+
/** Centred in the header, and the first thing a screen reader reaches. */
|
|
252
|
+
title?: ReactNode;
|
|
253
|
+
/**
|
|
254
|
+
* A control at the trailing end of the header — a second action the screen
|
|
255
|
+
* offers. The leading end is the sheet's, and is a close button on the root
|
|
256
|
+
* screen and a back button on every screen pushed onto it.
|
|
257
|
+
*/
|
|
258
|
+
trailing?: ReactNode;
|
|
259
|
+
}
|
|
260
|
+
declare function AIInputSheetScreen({ className, id, title, trailing, children, ...props }: AIInputSheetScreenProps): import("react").JSX.Element;
|
|
261
|
+
declare namespace AIInputSheetScreen {
|
|
262
|
+
var displayName: string;
|
|
263
|
+
}
|
|
264
|
+
export interface AIInputSheetProps {
|
|
265
|
+
children?: ReactNode;
|
|
266
|
+
className?: string;
|
|
267
|
+
open?: boolean;
|
|
268
|
+
onOpenChange?: (open: boolean) => void;
|
|
269
|
+
defaultOpen?: boolean;
|
|
270
|
+
/** Which screen opens first. Defaults to the first one given. */
|
|
271
|
+
initialScreen?: string;
|
|
272
|
+
/** Called whenever the screen on top changes, pushed or popped. */
|
|
273
|
+
onScreenChange?: (id: string) => void;
|
|
274
|
+
/** Frost the screen behind the sheet instead of dimming it. */
|
|
275
|
+
blur?: boolean;
|
|
276
|
+
/** How tall the sheet opens. `auto` sizes to the screen currently on top. */
|
|
277
|
+
size?: 'auto' | 'half' | 'full';
|
|
278
|
+
/**
|
|
279
|
+
* Float the sheet clear of the screen edges instead of docking it to the
|
|
280
|
+
* bottom. On by default: the surface is a material, and a material reads as
|
|
281
|
+
* laid over the app when there is app visible around all four of its edges.
|
|
282
|
+
* Docked, its bottom edge is the screen's, and there is nothing behind it
|
|
283
|
+
* there to refract.
|
|
284
|
+
*/
|
|
285
|
+
detached?: boolean;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The sheet the composer's controls open, and the screens it goes on to.
|
|
289
|
+
*
|
|
290
|
+
* A row that leads somewhere pushes a screen onto this sheet rather than
|
|
291
|
+
* opening a second one over it. The sheet stays where it is, the header's
|
|
292
|
+
* close button becomes a back button, and the body slides — which is what
|
|
293
|
+
* makes going one level deeper feel like the same surface rather than another
|
|
294
|
+
* one landing on top of it.
|
|
295
|
+
*
|
|
296
|
+
* ```tsx
|
|
297
|
+
* <AIInput.Sheet open={open} onOpenChange={setOpen}>
|
|
298
|
+
* <AIInput.Sheet.Screen id="root" title="Add to chat">
|
|
299
|
+
* <AIInput.Sheet.Group>
|
|
300
|
+
* <AIInput.Sheet.Row label="Add to project" value="None" to="project" />
|
|
301
|
+
* <AIInput.Sheet.Toggle label="Web search" value={web} onValueChange={setWeb} />
|
|
302
|
+
* </AIInput.Sheet.Group>
|
|
303
|
+
* </AIInput.Sheet.Screen>
|
|
304
|
+
* <AIInput.Sheet.Screen id="project" title="Add to project">…</AIInput.Sheet.Screen>
|
|
305
|
+
* </AIInput.Sheet>
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
declare function AIInputSheet({ children, className, open: openProp, onOpenChange, defaultOpen, initialScreen, onScreenChange, blur, size, detached, }: AIInputSheetProps): import("react").JSX.Element | null;
|
|
309
|
+
declare namespace AIInputSheet {
|
|
310
|
+
var displayName: string;
|
|
311
|
+
}
|
|
312
|
+
export interface AIInputSheetGroupProps extends ViewProps {
|
|
313
|
+
className?: string;
|
|
314
|
+
/** A line under the group, for what the rows in it mean. */
|
|
315
|
+
footnote?: ReactNode;
|
|
316
|
+
}
|
|
317
|
+
/** A card of related rows, with a hairline between each pair. */
|
|
318
|
+
declare function AIInputSheetGroup({ className, footnote, children, ...props }: AIInputSheetGroupProps): import("react").JSX.Element;
|
|
319
|
+
declare namespace AIInputSheetGroup {
|
|
320
|
+
var displayName: string;
|
|
321
|
+
}
|
|
322
|
+
export interface AIInputSheetRowProps extends Omit<ViewProps, 'children'> {
|
|
323
|
+
className?: string;
|
|
324
|
+
label: ReactNode;
|
|
325
|
+
/** A quieter line under the label. */
|
|
326
|
+
description?: ReactNode;
|
|
327
|
+
/** A glyph at the leading end. */
|
|
328
|
+
icon?: ReactNode;
|
|
329
|
+
/** The current setting, shown at the trailing end. */
|
|
330
|
+
value?: ReactNode;
|
|
331
|
+
/**
|
|
332
|
+
* Push the screen with this id when the row is pressed. A row with one shows
|
|
333
|
+
* a chevron, because a row that leads somewhere should say so before it is
|
|
334
|
+
* pressed.
|
|
335
|
+
*/
|
|
336
|
+
to?: string;
|
|
337
|
+
onPress?: () => void;
|
|
338
|
+
disabled?: boolean;
|
|
339
|
+
}
|
|
340
|
+
declare function AIInputSheetRow({ className, label, description, icon, value, to, onPress, disabled, ...props }: AIInputSheetRowProps): import("react").JSX.Element;
|
|
341
|
+
declare namespace AIInputSheetRow {
|
|
342
|
+
var displayName: string;
|
|
343
|
+
}
|
|
344
|
+
export interface AIInputSheetToggleProps extends Omit<ViewProps, 'children'> {
|
|
345
|
+
className?: string;
|
|
346
|
+
label: ReactNode;
|
|
347
|
+
description?: ReactNode;
|
|
348
|
+
icon?: ReactNode;
|
|
349
|
+
value: boolean;
|
|
350
|
+
onValueChange?: (value: boolean) => void;
|
|
351
|
+
disabled?: boolean;
|
|
352
|
+
}
|
|
353
|
+
declare function AIInputSheetToggle({ className, label, description, icon, value, onValueChange, disabled, ...props }: AIInputSheetToggleProps): import("react").JSX.Element;
|
|
354
|
+
declare namespace AIInputSheetToggle {
|
|
355
|
+
var displayName: string;
|
|
356
|
+
}
|
|
357
|
+
export interface AIInputSheetChoiceProps extends Omit<ViewProps, 'children'> {
|
|
358
|
+
className?: string;
|
|
359
|
+
label: ReactNode;
|
|
360
|
+
description?: ReactNode;
|
|
361
|
+
/** A pill beside the label — what the choice costs, or what it needs. */
|
|
362
|
+
badge?: ReactNode;
|
|
363
|
+
selected?: boolean;
|
|
364
|
+
onPress?: () => void;
|
|
365
|
+
disabled?: boolean;
|
|
366
|
+
}
|
|
367
|
+
/** One of a set, with a tick on the one in force. */
|
|
368
|
+
declare function AIInputSheetChoice({ className, label, description, badge, selected, onPress, disabled, ...props }: AIInputSheetChoiceProps): import("react").JSX.Element;
|
|
369
|
+
declare namespace AIInputSheetChoice {
|
|
370
|
+
var displayName: string;
|
|
371
|
+
}
|
|
372
|
+
export interface AIInputVoiceModeProps extends Omit<ViewProps, 'children'> {
|
|
373
|
+
className?: string;
|
|
374
|
+
/** The controls in the bottom row, before the close button. */
|
|
375
|
+
children?: ReactNode;
|
|
376
|
+
/** What the app is doing, which is what the wave behind everything shows. */
|
|
377
|
+
state?: 'idle' | 'listening' | 'thinking' | 'speaking';
|
|
378
|
+
/** Input level, 0–1. A shared value keeps metering off the JS thread. */
|
|
379
|
+
level?: number | SharedValue<number>;
|
|
380
|
+
/** A line above the microphone — a greeting, or what it is waiting for. */
|
|
381
|
+
title?: ReactNode;
|
|
382
|
+
onMicPress?: () => void;
|
|
383
|
+
micLabel?: string;
|
|
384
|
+
onClose?: () => void;
|
|
385
|
+
closeLabel?: string;
|
|
386
|
+
/** Type scale for the controls in the bottom row. */
|
|
387
|
+
size?: AIInputSize;
|
|
388
|
+
/** Draw the bottom row's controls as the platform's own, in its material. */
|
|
389
|
+
native?: boolean;
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* The screen a voice conversation happens on: no field, no keyboard, one
|
|
393
|
+
* microphone and a way out.
|
|
394
|
+
*
|
|
395
|
+
* It is a surface rather than an overlay — render it as its own route or
|
|
396
|
+
* inside a modal of your own. It provides the composer's context, so
|
|
397
|
+
* `AIInput.Action` and `AIInput.Pill` work in the bottom row without an
|
|
398
|
+
* `AIInput` around them.
|
|
399
|
+
*/
|
|
400
|
+
declare function AIInputVoiceMode({ className, children, state, level, title, onMicPress, micLabel, onClose, closeLabel, size, native, ...props }: AIInputVoiceModeProps): import("react").JSX.Element;
|
|
401
|
+
declare namespace AIInputVoiceMode {
|
|
402
|
+
var displayName: string;
|
|
403
|
+
}
|
|
404
|
+
export declare const AIInput: typeof AIInputRoot & {
|
|
405
|
+
Field: typeof AIInputField;
|
|
406
|
+
Row: typeof AIInputRow;
|
|
407
|
+
Toolbar: typeof AIInputToolbar;
|
|
408
|
+
Spacer: typeof AIInputSpacer;
|
|
409
|
+
Action: typeof AIInputAction;
|
|
410
|
+
Pill: typeof AIInputPill;
|
|
411
|
+
Submit: typeof AIInputSubmit;
|
|
412
|
+
Recording: typeof AIInputRecording;
|
|
413
|
+
Sheet: typeof AIInputSheet & {
|
|
414
|
+
Screen: typeof AIInputSheetScreen;
|
|
415
|
+
Group: typeof AIInputSheetGroup;
|
|
416
|
+
Row: typeof AIInputSheetRow;
|
|
417
|
+
Toggle: typeof AIInputSheetToggle;
|
|
418
|
+
Choice: typeof AIInputSheetChoice;
|
|
419
|
+
};
|
|
420
|
+
VoiceMode: typeof AIInputVoiceMode;
|
|
421
|
+
};
|
|
422
|
+
export {};
|
|
423
|
+
//# sourceMappingURL=index.d.ts.map
|