panelui-native 0.13.0 → 0.14.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/README.md +39 -23
- package/lib/module/components/button/index.js +12 -9
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/chip/index.js +313 -0
- package/lib/module/components/chip/index.js.map +1 -0
- package/lib/module/components/frame/index.js +41 -39
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/heatmap-chart/index.js +772 -0
- package/lib/module/components/heatmap-chart/index.js.map +1 -0
- package/lib/module/components/input/index.js +4 -0
- package/lib/module/components/input/index.js.map +1 -1
- package/lib/module/components/scroll-canvas/index.js +175 -0
- package/lib/module/components/scroll-canvas/index.js.map +1 -0
- package/lib/module/components/scroll-text/index.js +213 -0
- package/lib/module/components/scroll-text/index.js.map +1 -0
- package/lib/module/components/select/index.js +20 -24
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/slider/index.js +2 -5
- package/lib/module/components/slider/index.js.map +1 -1
- package/lib/module/components/switch/index.js +15 -17
- package/lib/module/components/switch/index.js.map +1 -1
- package/lib/module/components/thinking-orb/index.js +741 -0
- package/lib/module/components/thinking-orb/index.js.map +1 -0
- package/lib/module/components/toggle-button/index.js +12 -3
- package/lib/module/components/toggle-button/index.js.map +1 -1
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/use-keyboard-avoidance.js +99 -59
- package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
- package/lib/module/hooks/use-reveal-progress.js +75 -0
- package/lib/module/hooks/use-reveal-progress.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/primitives/keyboard-avoider.js +21 -2
- package/lib/module/primitives/keyboard-avoider.js.map +1 -1
- package/lib/module/primitives/scroll-progress.js +114 -0
- package/lib/module/primitives/scroll-progress.js.map +1 -0
- package/lib/typescript/src/components/button/index.d.ts +3 -4
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/chip/index.d.ts +304 -0
- package/lib/typescript/src/components/chip/index.d.ts.map +1 -0
- package/lib/typescript/src/components/frame/index.d.ts +15 -13
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/heatmap-chart/index.d.ts +260 -0
- package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -0
- package/lib/typescript/src/components/input/index.d.ts +19 -4
- package/lib/typescript/src/components/input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/scroll-canvas/index.d.ts +66 -0
- package/lib/typescript/src/components/scroll-canvas/index.d.ts.map +1 -0
- package/lib/typescript/src/components/scroll-text/index.d.ts +46 -0
- package/lib/typescript/src/components/scroll-text/index.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -1
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/src/components/thinking-orb/index.d.ts +28 -0
- package/lib/typescript/src/components/thinking-orb/index.d.ts.map +1 -0
- package/lib/typescript/src/components/toggle-button/index.d.ts +12 -0
- package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/index.d.ts +2 -1
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts +16 -3
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts +56 -0
- package/lib/typescript/src/hooks/use-reveal-progress.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +15 -7
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts +30 -3
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
- package/lib/typescript/src/primitives/scroll-progress.d.ts +61 -0
- package/lib/typescript/src/primitives/scroll-progress.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/components/button/index.tsx +13 -11
- package/src/components/frame/index.tsx +39 -50
- package/src/components/heatmap-chart/index.tsx +1024 -0
- package/src/components/input/index.tsx +23 -4
- package/src/components/scroll-canvas/index.tsx +220 -0
- package/src/components/scroll-text/index.tsx +277 -0
- package/src/components/select/index.tsx +4 -9
- package/src/components/slider/index.tsx +4 -7
- package/src/components/switch/index.tsx +5 -8
- package/src/components/thinking-orb/index.tsx +792 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-keyboard-avoidance.ts +111 -65
- package/src/hooks/use-reveal-progress.ts +106 -0
- package/src/index.ts +38 -0
- package/src/native/index.ts +15 -7
- package/src/primitives/keyboard-avoider.tsx +41 -4
- package/src/primitives/scroll-progress.tsx +167 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useRevealProgress — how far an element has travelled through the viewport.
|
|
3
|
+
*
|
|
4
|
+
* The number every scroll-driven effect is really made of: `0` before the
|
|
5
|
+
* element has arrived, `1` once it has passed, and a smooth scrub between the
|
|
6
|
+
* two. What an effect *does* with it — recolour, fade, zoom, step through
|
|
7
|
+
* frames — is the only part that differs.
|
|
8
|
+
*
|
|
9
|
+
* The window is set the way a scroll-trigger's is: `start` and `end` are
|
|
10
|
+
* positions down the viewport, as fractions of its height. Progress is `0`
|
|
11
|
+
* while the element's **top** is still below `start`, and reaches `1` when its
|
|
12
|
+
* **bottom** passes `end` — so a tall block scrubs across its own height rather
|
|
13
|
+
* than snapping the moment its first line appears.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* const { ref, progress } = useRevealProgress({ start: 0.9, end: 0.5 });
|
|
17
|
+
*
|
|
18
|
+
* <Animated.View ref={ref} style={useAnimatedStyle(() => ({
|
|
19
|
+
* opacity: progress.value,
|
|
20
|
+
* }))} />
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* The element is measured on the UI thread whenever the scroll position
|
|
24
|
+
* changes — not every frame, and not once at layout. Once is wrong the moment
|
|
25
|
+
* anything above it resizes; every frame is a measurement pass for a value that
|
|
26
|
+
* only changes when the scroller moves.
|
|
27
|
+
*/
|
|
28
|
+
import { type View } from 'react-native';
|
|
29
|
+
import { type AnimatedRef, type SharedValue } from 'react-native-reanimated';
|
|
30
|
+
export interface UseRevealProgressOptions {
|
|
31
|
+
/**
|
|
32
|
+
* Where down the viewport the element's top sits when progress is `0`, as a
|
|
33
|
+
* fraction of the viewport height. `0.9` starts it just before it appears.
|
|
34
|
+
*/
|
|
35
|
+
start?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Where down the viewport the element's bottom sits when progress reaches
|
|
38
|
+
* `1`. Smaller values mean a longer scrub.
|
|
39
|
+
*/
|
|
40
|
+
end?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Drive the effect from a value of your own instead of from the scroll
|
|
43
|
+
* position. Anything passed here is used as-is and nothing is measured.
|
|
44
|
+
*/
|
|
45
|
+
progress?: SharedValue<number>;
|
|
46
|
+
/** Set false to hold progress at `1`, as though the element had passed. */
|
|
47
|
+
enabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface UseRevealProgressResult {
|
|
50
|
+
/** Attach to the element whose travel drives the effect. */
|
|
51
|
+
ref: AnimatedRef<View>;
|
|
52
|
+
/** `0` before, `1` after, scrubbed between. */
|
|
53
|
+
progress: SharedValue<number>;
|
|
54
|
+
}
|
|
55
|
+
export declare function useRevealProgress({ start, end, progress: external, enabled, }?: UseRevealProgressOptions): UseRevealProgressResult;
|
|
56
|
+
//# sourceMappingURL=use-reveal-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-reveal-progress.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-reveal-progress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAuB,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAIL,KAAK,WAAW,EAChB,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,QAAQ,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC/B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,4DAA4D;IAC5D,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,KAAW,EACX,GAAS,EACT,QAAQ,EAAE,QAAQ,EAClB,OAAc,GACf,GAAE,wBAA6B,GAAG,uBAAuB,CAoCzD"}
|
|
@@ -4,6 +4,7 @@ export { Portal, PortalHost, PortalProvider } from './primitives/portal.js';
|
|
|
4
4
|
export { Text, type TextProps } from './primitives/text.js';
|
|
5
5
|
export { KeyboardAvoider, type KeyboardAvoiderProps, } from './primitives/keyboard-avoider.js';
|
|
6
6
|
export { AnimatedPressable, type AnimatedPressableProps, } from './primitives/animated-pressable.js';
|
|
7
|
+
export { ScrollProgress, useScrollProgress, type ScrollProgressProps, type ScrollProgressValue, } from './primitives/scroll-progress.js';
|
|
7
8
|
export { hasNativeUI } from './native/index.js';
|
|
8
9
|
export { hasHaptics, selectionTick } from './utils/haptics.js';
|
|
9
10
|
export { Accordion, type AccordionProps, type AccordionItemProps, type AccordionTriggerProps, type AccordionIndicatorProps, type AccordionContentProps, type AccordionVariant, type AccordionSelectionMode, } from './components/accordion/index.js';
|
|
@@ -16,11 +17,13 @@ export { Button, type ButtonProps } from './components/button/index.js';
|
|
|
16
17
|
export { ToggleButton, ToggleButtonGroup, useToggleButton, type ToggleButtonProps, type ToggleButtonGroupProps, type ToggleButtonLabelProps, type ToggleButtonSize, type ToggleButtonVariant, type ToggleSelectionMode, } from './components/toggle-button/index.js';
|
|
17
18
|
export { Dialog, type DialogProps, type DialogContentProps, } from './components/dialog/index.js';
|
|
18
19
|
export { Frame, type FrameProps, type FrameRootProps, type FramePanelProps, type FrameRowProps, type FrameSectionProps, type FrameVariant, } from './components/frame/index.js';
|
|
20
|
+
export { HeatmapChart, useHeatmapChart, buildHeatmapCalendar, type HeatmapChartProps, type HeatmapCellsProps, type HeatmapSeparatorProps, type HeatmapXAxisProps, type HeatmapYAxisProps, type HeatmapTooltipProps, type HeatmapLegendProps, type HeatmapColumn, type HeatmapBin, type HeatmapCell, type HeatmapLayout, } from './components/heatmap-chart/index.js';
|
|
19
21
|
export { Select, type SelectProps, type SelectItemProps, type SelectPresentation, } from './components/select/index.js';
|
|
20
22
|
export { SectionRail, type SectionRailProps, type SectionRailTriggerProps, type SectionRailBarProps, type SectionRailContentProps, type SectionRailItemProps, type SectionRailPlacement, type SectionRailAlign, } from './components/section-rail/index.js';
|
|
21
23
|
export { Tabs, type TabsProps, type TabsListProps, type TabsTriggerProps, type TabsContentProps, } from './components/tabs/index.js';
|
|
22
24
|
export { Card, type CardProps } from './components/card/index.js';
|
|
23
25
|
export { Checkbox, type CheckboxProps } from './components/checkbox/index.js';
|
|
26
|
+
export { Chip, useChip, type ChipProps, type ChipLabelProps, type ChipVariant, type ChipSize, } from './components/chip/index.js';
|
|
24
27
|
export { EmptyState, type EmptyStateProps, type EmptyStateMediaProps, } from './components/empty-state/index.js';
|
|
25
28
|
export { Input, type InputProps } from './components/input/index.js';
|
|
26
29
|
export { InputGroup, type InputGroupProps, type InputGroupInputProps, type InputGroupDecoratorProps, } from './components/input-group/index.js';
|
|
@@ -36,6 +39,9 @@ export { RadioGroup, type RadioGroupProps, type RadioGroupItemProps, } from './c
|
|
|
36
39
|
export { ScrollFade, type ScrollFadeProps, } from './components/scroll-fade/index.js';
|
|
37
40
|
export { Separator, type SeparatorProps } from './components/separator/index.js';
|
|
38
41
|
export { Shimmer, type ShimmerProps } from './components/shimmer/index.js';
|
|
42
|
+
export { ScrollText, type ScrollTextProps, type ScrollTextEffect, type ScrollTextSplit, } from './components/scroll-text/index.js';
|
|
43
|
+
export { ScrollCanvas, type ScrollCanvasProps, type ScrollCanvasEffect, } from './components/scroll-canvas/index.js';
|
|
44
|
+
export { ThinkingOrb, type ThinkingOrbProps, type ThinkingOrbState, } from './components/thinking-orb/index.js';
|
|
39
45
|
export { Skeleton, type SkeletonProps } from './components/skeleton/index.js';
|
|
40
46
|
export { Slider, type SliderProps } from './components/slider/index.js';
|
|
41
47
|
export { Spinner, type SpinnerProps } from './components/spinner/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,kCAA+B,CAAC;AAG3F,OAAO,EACL,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,gBAAgB,GACtB,MAAM,sBAAmB,CAAC;AAG3B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,wBAAqB,CAAC;AACzE,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,sBAAmB,CAAC;AACzD,OAAO,EACL,eAAe,EACf,KAAK,oBAAoB,GAC1B,MAAM,kCAA+B,CAAC;AACvC,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,oCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"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,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,eAAe,GACrB,MAAM,6BAAoB,CAAC;AAC5B,OAAO,EACL,UAAU,EACV,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,mBAAmB,GACzB,MAAM,kCAAyB,CAAC;AAGjC,OAAO,EACL,iBAAiB,EACjB,SAAS,EACT,gBAAgB,EAChB,QAAQ,EACR,QAAQ,EACR,eAAe,EACf,SAAS,EACT,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,WAAW,EACX,aAAa,EACb,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,eAAe,EACf,OAAO,EACP,KAAK,EACL,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,kBAAS,CAAC;AAGjB,cAAc,kBAAS,CAAC;AAGxB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAY,CAAC"}
|
|
@@ -5,13 +5,15 @@ interface NativeUIModule {
|
|
|
5
5
|
/**
|
|
6
6
|
* Whether the host resizes itself to the platform content.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* is a
|
|
8
|
+
* This is on for every control here, and it is the whole answer to the
|
|
9
|
+
* jump. Sizing the *host* and leaving the control unsized inside it hands
|
|
10
|
+
* the platform a box it never agreed to: it lays out against its own
|
|
11
|
+
* intrinsic size, and settles into the box on the first thing that forces
|
|
12
|
+
* a second pass — which for a button is the first press.
|
|
13
|
+
*
|
|
14
|
+
* The per-axis form is for a control with no intrinsic width, like a
|
|
15
|
+
* slider or a picker: the width comes from ordinary layout and only the
|
|
16
|
+
* height is reported back.
|
|
15
17
|
*/
|
|
16
18
|
matchContents?: boolean | {
|
|
17
19
|
vertical?: boolean;
|
|
@@ -30,6 +32,12 @@ interface NativeUIModule {
|
|
|
30
32
|
matchContents?: boolean;
|
|
31
33
|
style?: unknown;
|
|
32
34
|
}>;
|
|
35
|
+
/**
|
|
36
|
+
* `style` here is not a React Native style — it is the small portable subset
|
|
37
|
+
* (`width`, `height`, padding, `backgroundColor`, `borderRadius`, `opacity`)
|
|
38
|
+
* that the toolkit compiles into real SwiftUI and Compose modifiers. It is
|
|
39
|
+
* how a control is given a definite size without the host having to guess.
|
|
40
|
+
*/
|
|
33
41
|
Button: ComponentType<Record<string, unknown>>;
|
|
34
42
|
Switch: ComponentType<Record<string, unknown>>;
|
|
35
43
|
Slider: ComponentType<Record<string, unknown>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/native/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,UAAU,cAAc;IACtB,IAAI,EAAE,aAAa,CAAC;QAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/native/index.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEtD,UAAU,cAAc;IACtB,IAAI,EAAE,aAAa,CAAC;QAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB;;;;;;;;;;;;WAYG;QACH,aAAa,CAAC,EAAE,OAAO,GAAG;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAC;QACvE,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC,CAAC;IACH;;;;OAIG;IACH,UAAU,EAAE,aAAa,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC;QACrB,aAAa,CAAC,EAAE,OAAO,CAAC;QACxB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC,CAAC;IACH;;;;;OAKG;IACH,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAC/C,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;QAC/C,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;KAC9C,CAAC;IACF,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACrD;AAKD;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,cAAc,GAAG,IAAI,CAgBnD;AAED,gEAAgE;AAChE,wBAAgB,WAAW,IAAI,OAAO,CAErC"}
|
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* KeyboardAvoider — a view that
|
|
2
|
+
* KeyboardAvoider — a view that keeps itself clear of the keyboard.
|
|
3
3
|
*
|
|
4
4
|
* A thin wrapper over `useKeyboardAvoidance` for the common case of "keep this
|
|
5
5
|
* box visible", so a form does not have to wire the ref, layout handler and
|
|
6
6
|
* animated style by hand.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // In the flow of a scrolling page: lifts by the overlap, follows the scroll.
|
|
10
|
+
* <KeyboardAvoider active={focused}>…</KeyboardAvoider>
|
|
11
|
+
*
|
|
12
|
+
* // Pinned to the bottom edge: rides the keyboard up and back down.
|
|
13
|
+
* <KeyboardAvoider
|
|
14
|
+
* mode="dock"
|
|
15
|
+
* bottomInset={insets.bottom}
|
|
16
|
+
* className="absolute left-0 right-0"
|
|
17
|
+
* style={{ bottom: insets.bottom + 16 }}
|
|
18
|
+
* >
|
|
19
|
+
* …
|
|
20
|
+
* </KeyboardAvoider>
|
|
21
|
+
* ```
|
|
7
22
|
*/
|
|
8
23
|
import type { ReactNode } from 'react';
|
|
9
24
|
import type { ViewProps } from 'react-native';
|
|
25
|
+
import { type KeyboardAvoidanceMode } from '../hooks/use-keyboard-avoidance.js';
|
|
10
26
|
export interface KeyboardAvoiderProps extends ViewProps {
|
|
11
27
|
className?: string;
|
|
12
28
|
/** Set false to leave the content where it is. */
|
|
@@ -18,11 +34,22 @@ export interface KeyboardAvoiderProps extends ViewProps {
|
|
|
18
34
|
* screen stay put.
|
|
19
35
|
*/
|
|
20
36
|
active?: boolean;
|
|
21
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* `lift` moves in-flow content up by its overlap with the keyboard and keeps
|
|
39
|
+
* tracking it as the page scrolls. `dock` travels with the keyboard, for a
|
|
40
|
+
* bar already pinned near the bottom edge.
|
|
41
|
+
*/
|
|
42
|
+
mode?: KeyboardAvoidanceMode;
|
|
43
|
+
/** Gap to keep between the content's bottom edge and the keyboard. `lift` only. */
|
|
22
44
|
offset?: number;
|
|
45
|
+
/**
|
|
46
|
+
* How far above the bottom edge the bar already sits — usually the safe area
|
|
47
|
+
* inset it is positioned by. `dock` only.
|
|
48
|
+
*/
|
|
49
|
+
bottomInset?: number;
|
|
23
50
|
children?: ReactNode;
|
|
24
51
|
}
|
|
25
|
-
export declare function KeyboardAvoider({ className, enabled, active, offset, children, style, onLayout, ...props }: KeyboardAvoiderProps): import("react").JSX.Element;
|
|
52
|
+
export declare function KeyboardAvoider({ className, enabled, active, mode, offset, bottomInset, children, style, onLayout, ...props }: KeyboardAvoiderProps): import("react").JSX.Element;
|
|
26
53
|
export declare namespace KeyboardAvoider {
|
|
27
54
|
var displayName: string;
|
|
28
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-avoider.d.ts","sourceRoot":"","sources":["../../../../src/primitives/keyboard-avoider.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"keyboard-avoider.d.ts","sourceRoot":"","sources":["../../../../src/primitives/keyboard-avoider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAEL,KAAK,qBAAqB,EAC3B,MAAM,oCAAiC,CAAC;AAEzC,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,qBAAqB,CAAC;IAC7B,mFAAmF;IACnF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAc,EACd,MAAa,EACb,IAAa,EACb,MAAW,EACX,WAAe,EACf,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAuBtB;yBAlCe,eAAe"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ScrollProgress — publishes a scroll container's position so children can
|
|
3
|
+
* animate against it.
|
|
4
|
+
*
|
|
5
|
+
* Scroll-driven effects all need the same two numbers: where the scroller is,
|
|
6
|
+
* and how tall its viewport is. Every component that wanted them measuring for
|
|
7
|
+
* itself would mean one scroll listener per effect and one measurement pass per
|
|
8
|
+
* effect per frame, for two values that are the same for all of them.
|
|
9
|
+
*
|
|
10
|
+
* It wraps the scroll view you already have rather than replacing it — the
|
|
11
|
+
* child is cloned with an animated scroll handler composed onto it, the same
|
|
12
|
+
* way `ScrollFade` does — so a `FlatList`, a `SectionList` or your own
|
|
13
|
+
* scrollable all work, and nothing has to be rewritten to adopt it.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <ScrollProgress>
|
|
17
|
+
* <ScrollView>
|
|
18
|
+
* <ScrollText>…</ScrollText>
|
|
19
|
+
* </ScrollView>
|
|
20
|
+
* </ScrollProgress>
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Both values are shared values, so the whole chain from scroll event to
|
|
24
|
+
* animated style stays on the UI thread and nothing re-renders as you scroll.
|
|
25
|
+
*/
|
|
26
|
+
import { type ReactNode } from 'react';
|
|
27
|
+
import { type ViewProps } from 'react-native';
|
|
28
|
+
import { type SharedValue } from 'react-native-reanimated';
|
|
29
|
+
export interface ScrollProgressValue {
|
|
30
|
+
/** Distance scrolled, in pixels. */
|
|
31
|
+
offset: SharedValue<number>;
|
|
32
|
+
/** Height of the visible area. */
|
|
33
|
+
viewport: SharedValue<number>;
|
|
34
|
+
/** Total height of the content. */
|
|
35
|
+
content: SharedValue<number>;
|
|
36
|
+
/**
|
|
37
|
+
* Window-space top edge of the scroller. What turns an element's measured
|
|
38
|
+
* `pageY` into a position inside *this* viewport rather than the screen's —
|
|
39
|
+
* they differ by whatever sits above the scroller, and assuming they do not
|
|
40
|
+
* is why scroll effects drift under a header.
|
|
41
|
+
*/
|
|
42
|
+
top: SharedValue<number>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The nearest enclosing scroll container's position, or `null` outside one.
|
|
46
|
+
*
|
|
47
|
+
* It returns null rather than throwing because every consumer of this also
|
|
48
|
+
* takes an explicit `progress` prop — a component that can be driven by hand
|
|
49
|
+
* should not insist on a provider it does not need.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useScrollProgress(): ScrollProgressValue | null;
|
|
52
|
+
export interface ScrollProgressProps extends ViewProps {
|
|
53
|
+
className?: string;
|
|
54
|
+
/** Exactly one scrollable — a ScrollView, FlatList, or anything like them. */
|
|
55
|
+
children?: ReactNode;
|
|
56
|
+
}
|
|
57
|
+
export declare function ScrollProgress({ className, children, ...props }: ScrollProgressProps): import("react").JSX.Element;
|
|
58
|
+
export declare namespace ScrollProgress {
|
|
59
|
+
var displayName: string;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=scroll-progress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-progress.d.ts","sourceRoot":"","sources":["../../../../src/primitives/scroll-progress.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC5E,OAAiB,EAKf,KAAK,WAAW,EACjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,mBAAmB;IAClC,oCAAoC;IACpC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5B,kCAAkC;IAClC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,mCAAmC;IACnC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B;;;;;OAKG;IACH,GAAG,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC1B;AAID;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,GAAG,IAAI,CAE9D;AASD,MAAM,WAAW,mBAAoB,SAAQ,SAAS;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,cAAc,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,mBAAmB,+BA6EpF;yBA7Ee,cAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.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",
|
|
@@ -115,22 +115,23 @@ export interface ButtonProps
|
|
|
115
115
|
* `primary`/`destructive` → filled, `outline` → outlined, everything else
|
|
116
116
|
* → text; `size` sets the height.
|
|
117
117
|
*
|
|
118
|
-
* A native button **
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
* share the width, or in a narrower parent to shrink it.
|
|
118
|
+
* A native button **sizes itself to its label**, the way a platform button
|
|
119
|
+
* is supposed to. It does not stretch to fill its container, and `fullWidth`
|
|
120
|
+
* has no effect on it.
|
|
122
121
|
*/
|
|
123
122
|
native?: boolean;
|
|
124
123
|
}
|
|
125
124
|
|
|
126
125
|
/**
|
|
127
|
-
* Height given to the
|
|
126
|
+
* Height given to the platform button, matching the styled scale above.
|
|
128
127
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
128
|
+
* It goes on the button rather than on the host, and that distinction is the
|
|
129
|
+
* whole fix for the jump. A host sized to a number with an unsized control
|
|
130
|
+
* inside it hands the platform a box the control never agreed to: SwiftUI and
|
|
131
|
+
* Compose both lay out against their own intrinsic size and only settle into
|
|
132
|
+
* the box when something forces a second pass — which for a button is the
|
|
133
|
+
* first press. Given a definite height of its own, the button has nothing left
|
|
134
|
+
* to recompute, and the host follows it with `matchContents`.
|
|
134
135
|
*/
|
|
135
136
|
const NATIVE_HEIGHT: Record<NonNullable<ButtonVariantProps['size']>, number> = {
|
|
136
137
|
sm: 36,
|
|
@@ -199,11 +200,12 @@ export const Button = forwardRef<View, ButtonProps>(
|
|
|
199
200
|
const isStringLabel = typeof children === 'string';
|
|
200
201
|
|
|
201
202
|
return (
|
|
202
|
-
<Host
|
|
203
|
+
<Host matchContents>
|
|
203
204
|
<NativeButton
|
|
204
205
|
label={isStringLabel ? children : undefined}
|
|
205
206
|
variant={NATIVE_VARIANT[variant ?? 'primary']}
|
|
206
207
|
disabled={isDisabled}
|
|
208
|
+
style={{ height: NATIVE_HEIGHT[size ?? 'md'] }}
|
|
207
209
|
onPress={props.onPress}
|
|
208
210
|
>
|
|
209
211
|
{/* Non-string children are React Native views, and the native
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Frame — a widget shell: a
|
|
3
|
-
*
|
|
2
|
+
* Frame — a widget shell: a card of rows sitting in a tray, with the tray's
|
|
3
|
+
* one exposed strip along the top carrying the title.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* The two surfaces are nested rather than stacked, and only one edge of the
|
|
6
|
+
* outer one is ever visible. The panel is flush to the shell's left, right and
|
|
7
|
+
* bottom, so the shell reads as something the card is *sitting in* rather than
|
|
8
|
+
* as a border around it — and the strip left at the top is the header, which
|
|
9
|
+
* is why the header needs no rule under it and no background of its own.
|
|
10
|
+
*
|
|
11
|
+
* The shell's radius is the larger of the two, and the panel's top corners are
|
|
12
|
+
* tighter. That is the reverse of the usual nested-radius rule, and it is
|
|
13
|
+
* deliberate: with only the top corners free, matching them would make the two
|
|
14
|
+
* surfaces read as one misdrawn shape. The panel's bottom corners are not set
|
|
15
|
+
* at all — the shell clips them, so they take its radius exactly.
|
|
9
16
|
*
|
|
10
17
|
* ```tsx
|
|
11
18
|
* <Frame>
|
|
12
19
|
* <Frame.Header>
|
|
13
|
-
* <Frame.Title>
|
|
14
|
-
* <Frame.Action>
|
|
20
|
+
* <Frame.Title>Agent monitor</Frame.Title>
|
|
21
|
+
* <Frame.Action>All agents under 25% token limit</Frame.Action>
|
|
15
22
|
* </Frame.Header>
|
|
16
23
|
* <Frame.Panel>
|
|
17
24
|
* <Frame.Row>…</Frame.Row>
|
|
18
25
|
* <Frame.Row>…</Frame.Row>
|
|
19
26
|
* </Frame.Panel>
|
|
20
|
-
* <Frame.Footer>Updated 2 minutes ago</Frame.Footer>
|
|
21
27
|
* </Frame>
|
|
22
28
|
* ```
|
|
23
29
|
*
|
|
@@ -41,15 +47,24 @@ import { cn } from '../../utils/cn';
|
|
|
41
47
|
const frameVariants = tv({
|
|
42
48
|
slots: {
|
|
43
49
|
root: '',
|
|
44
|
-
|
|
50
|
+
// Flush left, right and bottom: no side or bottom border, because the
|
|
51
|
+
// shell's own edge is already there, and no bottom radius, because the
|
|
52
|
+
// shell clips it. Only the top corners and the rule under the header are
|
|
53
|
+
// the panel's to draw.
|
|
54
|
+
panel: 'overflow-hidden rounded-t-2xl border-t border-border bg-card',
|
|
45
55
|
},
|
|
46
56
|
variants: {
|
|
47
57
|
variant: {
|
|
48
|
-
|
|
58
|
+
// `overflow-hidden` is load-bearing — it is what makes the panel's
|
|
59
|
+
// bottom corners take the shell's radius instead of squaring off
|
|
60
|
+
// against it.
|
|
61
|
+
default: {
|
|
62
|
+
root: 'overflow-hidden rounded-3xl border border-border bg-surface',
|
|
63
|
+
},
|
|
49
64
|
// No shell: the panel is the whole widget. For a Frame nested inside a
|
|
50
65
|
// card that already draws a border, where the shell's own edge sitting
|
|
51
66
|
// just inside it reads as a double line.
|
|
52
|
-
plain: { root: '', panel: 'rounded-
|
|
67
|
+
plain: { root: '', panel: 'rounded-3xl border border-border' },
|
|
53
68
|
},
|
|
54
69
|
},
|
|
55
70
|
defaultVariants: {
|
|
@@ -83,15 +98,16 @@ export interface FrameHeaderProps extends FrameProps {
|
|
|
83
98
|
}
|
|
84
99
|
|
|
85
100
|
/**
|
|
86
|
-
* The header row
|
|
87
|
-
* `className="flex-col items-start"`
|
|
101
|
+
* The header row — the strip of shell left exposed above the panel. Title on
|
|
102
|
+
* the left, `Frame.Action` on the right. Add `className="flex-col items-start"`
|
|
103
|
+
* when you want a description underneath.
|
|
88
104
|
*/
|
|
89
105
|
const FrameHeader = forwardRef<View, FrameHeaderProps>(
|
|
90
106
|
({ className, ...props }, ref) => (
|
|
91
107
|
<View
|
|
92
108
|
ref={ref}
|
|
93
109
|
className={cn(
|
|
94
|
-
'flex-row items-center justify-between gap-3 px-
|
|
110
|
+
'flex-row items-center justify-between gap-3 px-4 pb-3 pt-2.5',
|
|
95
111
|
className
|
|
96
112
|
)}
|
|
97
113
|
{...props}
|
|
@@ -100,14 +116,12 @@ const FrameHeader = forwardRef<View, FrameHeaderProps>(
|
|
|
100
116
|
);
|
|
101
117
|
FrameHeader.displayName = 'Frame.Header';
|
|
102
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Muted by default. The header is a caption on the tray the card sits in, not
|
|
121
|
+
* a heading over a section — the card's own rows carry the weight.
|
|
122
|
+
*/
|
|
103
123
|
const FrameTitle = forwardRef<RNText, TextProps>(({ className, ...props }, ref) => (
|
|
104
|
-
<Text
|
|
105
|
-
ref={ref}
|
|
106
|
-
size="base"
|
|
107
|
-
weight="medium"
|
|
108
|
-
className={cn('text-foreground', className)}
|
|
109
|
-
{...props}
|
|
110
|
-
/>
|
|
124
|
+
<Text ref={ref} size="sm" muted className={className} {...props} />
|
|
111
125
|
));
|
|
112
126
|
FrameTitle.displayName = 'Frame.Title';
|
|
113
127
|
|
|
@@ -123,7 +137,7 @@ const FrameAction = forwardRef<View, FrameActionProps>(
|
|
|
123
137
|
({ className, children, ...props }, ref) => (
|
|
124
138
|
<View ref={ref} className={cn('flex-row items-center gap-2', className)} {...props}>
|
|
125
139
|
{typeof children === 'string' ? (
|
|
126
|
-
<Text size="
|
|
140
|
+
<Text size="sm" muted>
|
|
127
141
|
{children}
|
|
128
142
|
</Text>
|
|
129
143
|
) : (
|
|
@@ -177,8 +191,8 @@ export interface FramePanelProps extends FrameProps {
|
|
|
177
191
|
}
|
|
178
192
|
|
|
179
193
|
/**
|
|
180
|
-
* The
|
|
181
|
-
*
|
|
194
|
+
* The card holding the frame's content — flush to the shell on three sides,
|
|
195
|
+
* with the header strip above it.
|
|
182
196
|
*/
|
|
183
197
|
const FramePanel = forwardRef<View, FramePanelProps>(
|
|
184
198
|
({ className, dividers = true, children, ...props }, ref) => (
|
|
@@ -284,30 +298,6 @@ FrameSection.displayName = 'Frame.Section';
|
|
|
284
298
|
/** Parts the panel divides. Declared after them, since it holds references. */
|
|
285
299
|
const DIVIDABLE = new Set<unknown>([FrameRow, FrameSection]);
|
|
286
300
|
|
|
287
|
-
export interface FrameFooterProps extends FrameProps {
|
|
288
|
-
children?: ReactNode;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
/** Muted caption under the panel. Strings are wrapped for you. */
|
|
292
|
-
const FrameFooter = forwardRef<View, FrameFooterProps>(
|
|
293
|
-
({ className, children, ...props }, ref) => (
|
|
294
|
-
<View
|
|
295
|
-
ref={ref}
|
|
296
|
-
className={cn('flex-row items-center gap-2 px-3 pb-1.5 pt-2.5', className)}
|
|
297
|
-
{...props}
|
|
298
|
-
>
|
|
299
|
-
{typeof children === 'string' ? (
|
|
300
|
-
<Text size="sm" muted>
|
|
301
|
-
{children}
|
|
302
|
-
</Text>
|
|
303
|
-
) : (
|
|
304
|
-
children
|
|
305
|
-
)}
|
|
306
|
-
</View>
|
|
307
|
-
)
|
|
308
|
-
);
|
|
309
|
-
FrameFooter.displayName = 'Frame.Footer';
|
|
310
|
-
|
|
311
301
|
export const Frame = Object.assign(FrameRoot, {
|
|
312
302
|
Header: FrameHeader,
|
|
313
303
|
Title: FrameTitle,
|
|
@@ -316,5 +306,4 @@ export const Frame = Object.assign(FrameRoot, {
|
|
|
316
306
|
Panel: FramePanel,
|
|
317
307
|
Section: FrameSection,
|
|
318
308
|
Row: FrameRow,
|
|
319
|
-
Footer: FrameFooter,
|
|
320
309
|
});
|