panelui-native 0.75.1 → 0.77.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 +1584 -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 +4 -2
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/button/index.js +7 -1
- package/lib/module/components/button/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/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/select/index.js +1 -0
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/slider/index.js +1 -0
- package/lib/module/components/slider/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/switch/index.js +1 -0
- package/lib/module/components/switch/index.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/native/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 +442 -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/button/index.d.ts +15 -0
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/carousel/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/native/index.d.ts +17 -0
- package/lib/typescript/src/native/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 +1971 -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 +16 -4
- package/src/components/button/index.tsx +20 -1
- 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/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/select/index.tsx +1 -1
- package/src/components/slider/index.tsx +1 -1
- 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/switch/index.tsx +1 -1
- 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/native/index.ts +17 -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,33 @@
|
|
|
1
|
+
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
|
+
export interface ControllableStateOptions<T> {
|
|
3
|
+
/** Accepted owner state. `undefined` selects uncontrolled ownership. */
|
|
4
|
+
value: T | undefined;
|
|
5
|
+
/** Initial state used only while uncontrolled. */
|
|
6
|
+
defaultValue: T;
|
|
7
|
+
/** Reports a distinct requested value exactly once per setter invocation. */
|
|
8
|
+
onChange?: (value: T) => void;
|
|
9
|
+
/** Reports accepted state changes, whether requested or externally reset. */
|
|
10
|
+
onSettled?: (value: T) => void;
|
|
11
|
+
/** Normalize defaults, controlled values, and requests through one boundary. */
|
|
12
|
+
normalize?: (value: T) => T;
|
|
13
|
+
/** Equality used for no-op requests and accepted settlement. */
|
|
14
|
+
isEqual?: (left: T, right: T) => boolean;
|
|
15
|
+
/** Stable semantic identity for controlled objects recreated by their owner. */
|
|
16
|
+
getValueKey?: (value: T) => unknown;
|
|
17
|
+
}
|
|
18
|
+
export interface ControllableStateResult<T> {
|
|
19
|
+
/** State accepted by the current owner; controlled requests never render optimistically. */
|
|
20
|
+
value: T;
|
|
21
|
+
setValue: Dispatch<SetStateAction<T>>;
|
|
22
|
+
isControlled: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Owner-driven controlled/uncontrolled state with an explicit settlement edge.
|
|
26
|
+
*
|
|
27
|
+
* Switching from controlled to uncontrolled retains the last accepted owner
|
|
28
|
+
* value instead of resurrecting a stale default. Switching into controlled
|
|
29
|
+
* mode adopts the prop immediately. `undefined` is the ownership sentinel and
|
|
30
|
+
* therefore cannot itself be a controlled value; use `null` for empty state.
|
|
31
|
+
*/
|
|
32
|
+
export declare function useControllableState<T>({ value: valueProp, defaultValue, onChange, onSettled, normalize, isEqual, getValueKey, }: ControllableStateOptions<T>): ControllableStateResult<T>;
|
|
33
|
+
//# sourceMappingURL=controllable-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controllable-state.d.ts","sourceRoot":"","sources":["../../../../src/primitives/controllable-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,QAAQ,EACb,KAAK,cAAc,EACpB,MAAM,OAAO,CAAC;AAKf,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACzC,wEAAwE;IACxE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC;IACrB,kDAAkD;IAClD,YAAY,EAAE,CAAC,CAAC;IAChB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC9B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,IAAI,CAAC;IAC/B,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC;IAC5B,gEAAgE;IAChE,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;IACzC,gFAAgF;IAChF,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC;CACrC;AAED,MAAM,WAAW,uBAAuB,CAAC,CAAC;IACxC,4FAA4F;IAC5F,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,YAAY,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,EACtC,KAAK,EAAE,SAAS,EAChB,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAoB,EACpB,OAAkB,EAClB,WAAW,GACZ,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAAC,CAAC,CA0D1D"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Returns a number only when it is safe to use in chart arithmetic. */
|
|
2
|
+
export declare function finiteChartNumber(value: unknown): number | undefined;
|
|
3
|
+
/** Accepts an explicit domain only when both ends are finite. */
|
|
4
|
+
export declare function finiteChartDomain(domain: readonly [number, number] | undefined): [number, number] | undefined;
|
|
5
|
+
//# sourceMappingURL=finite-chart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"finite-chart.d.ts","sourceRoot":"","sources":["../../../../src/primitives/finite-chart.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,iEAAiE;AACjE,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAC5C,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAK9B"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ViewProps } from 'react-native';
|
|
2
|
+
/** How the material treats what is behind it. */
|
|
3
|
+
export type GlassVariant = 'regular' | 'clear';
|
|
4
|
+
/**
|
|
5
|
+
* Corner radius in points — one number for all four, or a top and a bottom.
|
|
6
|
+
*
|
|
7
|
+
* The two-sided form is for a surface with an edge that is not a real edge: a
|
|
8
|
+
* sheet docked to the bottom of the screen rounds its top and leaves its
|
|
9
|
+
* bottom square, because the screen edge is where it ends.
|
|
10
|
+
*/
|
|
11
|
+
export type GlassRadius = number | {
|
|
12
|
+
top?: number;
|
|
13
|
+
bottom?: number;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* True when the real material can be drawn — for a caller that wants to know
|
|
17
|
+
* before it commits to a look. It says nothing about Reduce Transparency, which
|
|
18
|
+
* is a live preference and belongs to the hook.
|
|
19
|
+
*/
|
|
20
|
+
export declare const hasGlass: boolean;
|
|
21
|
+
export interface GlassProps extends ViewProps {
|
|
22
|
+
/**
|
|
23
|
+
* How much of what is behind shows through. `regular` is the everyday
|
|
24
|
+
* material; `clear` is thinner, for something over its own artwork.
|
|
25
|
+
*/
|
|
26
|
+
variant?: GlassVariant;
|
|
27
|
+
/** Tints the material. Takes a colour, not a token name. */
|
|
28
|
+
tint?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Corner radius in points. The material rounds itself to this, so give it
|
|
31
|
+
* the same shape the container is drawn with — clipping a square material
|
|
32
|
+
* to a rounded parent throws away the lit edge that makes it read as glass.
|
|
33
|
+
*/
|
|
34
|
+
radius?: GlassRadius;
|
|
35
|
+
/** Applied only when the material cannot be drawn. Give it a real surface. */
|
|
36
|
+
fallbackClassName?: string;
|
|
37
|
+
className?: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function Glass({ variant, tint, radius, fallbackClassName, className, children, style, ...props }: GlassProps): import("react").JSX.Element;
|
|
40
|
+
export declare namespace Glass {
|
|
41
|
+
var displayName: string;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=glass.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"glass.d.ts","sourceRoot":"","sources":["../../../../src/primitives/glass.tsx"],"names":[],"mappings":"AA6CA,OAAO,EAA8C,KAAK,SAAS,EAAkB,MAAM,cAAc,CAAC;AAI1G,iDAAiD;AACjD,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,OAAO,CAAC;AAE/C;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAkDrE;;;;GAIG;AACH,eAAO,MAAM,QAAQ,SAAqB,CAAC;AAE3C,MAAM,WAAW,UAAW,SAAQ,SAAS;IAC3C;;;OAGG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,4DAA4D;IAC5D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,KAAK,CAAC,EACpB,OAAmB,EACnB,IAAI,EACJ,MAAM,EACN,iBAA6B,EAC7B,SAAS,EACT,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE,UAAU,+BAwBZ;yBAjCe,KAAK"}
|
|
@@ -2,6 +2,13 @@ import { type ViewProps } from 'react-native';
|
|
|
2
2
|
type BlurTint = 'light' | 'dark' | 'default' | 'systemMaterial';
|
|
3
3
|
/** True when a real blur can be drawn — for a caller that wants to know. */
|
|
4
4
|
export declare const hasBlur: boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Whether the device asks for Reduce Transparency: `true`, `false`, or `null`
|
|
7
|
+
* while the platform has not answered yet. Exported because every material in
|
|
8
|
+
* the library has to respect the same preference, and two copies of this would
|
|
9
|
+
* be two answers.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useReduceTransparency(): boolean | null;
|
|
5
12
|
export interface ScrimProps extends Omit<ViewProps, 'children'> {
|
|
6
13
|
/** Frost the backdrop instead of dimming it. Falls back to a dim if it can't. */
|
|
7
14
|
blur?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrim.d.ts","sourceRoot":"","sources":["../../../../src/primitives/scrim.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGnF,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAwBhE,4EAA4E;AAC5E,eAAO,MAAM,OAAO,SAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"scrim.d.ts","sourceRoot":"","sources":["../../../../src/primitives/scrim.tsx"],"names":[],"mappings":"AAkBA,OAAO,EAAuC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAGnF,KAAK,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,gBAAgB,CAAC;AAwBhE,4EAA4E;AAC5E,eAAO,MAAM,OAAO,SAAoB,CAAC;AAqEzC;;;;;GAKG;AACH,wBAAgB,qBAAqB,mBAapC;AAgBD,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC;IAC7D,iFAAiF;IACjF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gCAAgC;IAChC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,KAAK,CAAC,EACpB,IAAY,EACZ,SAAc,EACd,IAAgB,EAChB,YAA4B,EAC5B,KAAK,EACL,GAAG,KAAK,EACT,EAAE,UAAU,+BA+CZ;yBAtDe,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0",
|
|
4
4
|
"description": "High-performance React Native UI components for Expo. Semantic design tokens, powered by Uniwind (Tailwind v4) and Reanimated.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"module": "./lib/module/index.js",
|
|
@@ -90,7 +90,8 @@
|
|
|
90
90
|
"clean": "rm -rf lib",
|
|
91
91
|
"verify:package": "node scripts/verify-package.mjs",
|
|
92
92
|
"generate:subpaths": "node scripts/generate-subpath-exports.mjs --write",
|
|
93
|
-
"check:subpaths": "node scripts/generate-subpath-exports.mjs"
|
|
93
|
+
"check:subpaths": "node scripts/generate-subpath-exports.mjs",
|
|
94
|
+
"benchmark:components": "node --experimental-strip-types scripts/benchmark-component-scale.mjs"
|
|
94
95
|
},
|
|
95
96
|
"keywords": [
|
|
96
97
|
"react-native",
|
|
@@ -132,6 +133,7 @@
|
|
|
132
133
|
"expo-blur": ">=13.0.0",
|
|
133
134
|
"expo-clipboard": ">=7.0.0",
|
|
134
135
|
"expo-file-system": ">=17.0.0",
|
|
136
|
+
"expo-glass-effect": ">=57.0.0",
|
|
135
137
|
"expo-haptics": ">=13.0.0",
|
|
136
138
|
"expo-linear-gradient": ">=13.0.0",
|
|
137
139
|
"expo-location": ">=18.0.0",
|
|
@@ -186,6 +188,9 @@
|
|
|
186
188
|
"expo-file-system": {
|
|
187
189
|
"optional": true
|
|
188
190
|
},
|
|
191
|
+
"expo-glass-effect": {
|
|
192
|
+
"optional": true
|
|
193
|
+
},
|
|
189
194
|
"expo-haptics": {
|
|
190
195
|
"optional": true
|
|
191
196
|
},
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
22
|
+
/** Type size and the leading it is given, per `size`. */
|
|
23
|
+
export const AI_INPUT_METRICS = {
|
|
24
|
+
sm: { fontSize: 15, lineHeight: 20, padding: 10 },
|
|
25
|
+
md: { fontSize: 16, lineHeight: 22, padding: 12 },
|
|
26
|
+
lg: { fontSize: 17, lineHeight: 24, padding: 14 },
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
export type AIInputSize = keyof typeof AI_INPUT_METRICS;
|
|
30
|
+
|
|
31
|
+
export interface GrowthMetrics {
|
|
32
|
+
lineHeight: number;
|
|
33
|
+
padding: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** The box a whole number of lines asks for: the lines, plus both paddings. */
|
|
37
|
+
export function heightForLines(metrics: GrowthMetrics, lines: number): number {
|
|
38
|
+
return lines * metrics.lineHeight + metrics.padding * 2;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface GrowthBounds {
|
|
42
|
+
minHeight: number;
|
|
43
|
+
maxHeight: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The floor and ceiling a field grows between.
|
|
48
|
+
*
|
|
49
|
+
* At least one line, so an empty composer is the size of an empty composer.
|
|
50
|
+
* Never below the floor, so a `maxRows` under `minRows` — a caller
|
|
51
|
+
* contradicting itself — resolves to the height that was asked for outright
|
|
52
|
+
* rather than to one shorter than the field was told to open at.
|
|
53
|
+
*/
|
|
54
|
+
export function growthBounds(
|
|
55
|
+
metrics: GrowthMetrics,
|
|
56
|
+
minRows: number,
|
|
57
|
+
maxRows: number
|
|
58
|
+
): GrowthBounds {
|
|
59
|
+
const floor = Math.max(1, Math.floor(minRows) || 1);
|
|
60
|
+
const ceiling = Math.max(floor, Math.floor(maxRows) || floor);
|
|
61
|
+
return {
|
|
62
|
+
minHeight: heightForLines(metrics, floor),
|
|
63
|
+
maxHeight: heightForLines(metrics, ceiling),
|
|
64
|
+
};
|
|
65
|
+
}
|