panelui-native 0.9.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/lib/module/components/bottom-sheet/index.js +38 -2
- package/lib/module/components/bottom-sheet/index.js.map +1 -1
- package/lib/module/components/button/index.js +19 -1
- package/lib/module/components/button/index.js.map +1 -1
- package/lib/module/components/frame/index.js +128 -15
- package/lib/module/components/frame/index.js.map +1 -1
- package/lib/module/components/input/index.js +107 -15
- package/lib/module/components/input/index.js.map +1 -1
- package/lib/module/components/popover/index.js +22 -11
- package/lib/module/components/popover/index.js.map +1 -1
- package/lib/module/components/progress/index.js +52 -2
- package/lib/module/components/progress/index.js.map +1 -1
- package/lib/module/components/radio-group/index.js +34 -7
- package/lib/module/components/radio-group/index.js.map +1 -1
- package/lib/module/components/section-rail/index.js +355 -0
- package/lib/module/components/section-rail/index.js.map +1 -0
- package/lib/module/components/select/index.js +245 -56
- package/lib/module/components/select/index.js.map +1 -1
- package/lib/module/components/slider/index.js +355 -0
- package/lib/module/components/slider/index.js.map +1 -0
- package/lib/module/components/switch/index.js +10 -1
- package/lib/module/components/switch/index.js.map +1 -1
- package/lib/module/components/tabs/index.js +186 -16
- package/lib/module/components/tabs/index.js.map +1 -1
- package/lib/module/components/toggle-button/index.js +297 -0
- package/lib/module/components/toggle-button/index.js.map +1 -0
- 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 +57 -8
- package/lib/module/hooks/use-keyboard-avoidance.js.map +1 -1
- package/lib/module/hooks/use-scroll-sections.js +89 -0
- package/lib/module/hooks/use-scroll-sections.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/index.js.map +1 -1
- package/lib/module/primitives/keyboard-avoider.js +2 -0
- package/lib/module/primitives/keyboard-avoider.js.map +1 -1
- package/lib/module/utils/haptics.js +57 -0
- package/lib/module/utils/haptics.js.map +1 -0
- package/lib/typescript/src/components/bottom-sheet/index.d.ts.map +1 -1
- package/lib/typescript/src/components/button/index.d.ts +9 -4
- package/lib/typescript/src/components/button/index.d.ts.map +1 -1
- package/lib/typescript/src/components/frame/index.d.ts +47 -7
- package/lib/typescript/src/components/frame/index.d.ts.map +1 -1
- package/lib/typescript/src/components/input/index.d.ts +113 -2
- package/lib/typescript/src/components/input/index.d.ts.map +1 -1
- package/lib/typescript/src/components/popover/index.d.ts +7 -1
- package/lib/typescript/src/components/popover/index.d.ts.map +1 -1
- package/lib/typescript/src/components/progress/index.d.ts +33 -0
- package/lib/typescript/src/components/progress/index.d.ts.map +1 -1
- package/lib/typescript/src/components/radio-group/index.d.ts +7 -0
- package/lib/typescript/src/components/radio-group/index.d.ts.map +1 -1
- package/lib/typescript/src/components/section-rail/index.d.ts +115 -0
- package/lib/typescript/src/components/section-rail/index.d.ts.map +1 -0
- package/lib/typescript/src/components/select/index.d.ts +46 -7
- package/lib/typescript/src/components/select/index.d.ts.map +1 -1
- package/lib/typescript/src/components/slider/index.d.ts +203 -0
- package/lib/typescript/src/components/slider/index.d.ts.map +1 -0
- package/lib/typescript/src/components/switch/index.d.ts.map +1 -1
- package/lib/typescript/src/components/tabs/index.d.ts +46 -4
- package/lib/typescript/src/components/tabs/index.d.ts.map +1 -1
- package/lib/typescript/src/components/toggle-button/index.d.ts +244 -0
- package/lib/typescript/src/components/toggle-button/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +1 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts +10 -1
- package/lib/typescript/src/hooks/use-keyboard-avoidance.d.ts.map +1 -1
- package/lib/typescript/src/hooks/use-scroll-sections.d.ts +31 -0
- package/lib/typescript/src/hooks/use-scroll-sections.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +6 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/index.d.ts +16 -1
- package/lib/typescript/src/native/index.d.ts.map +1 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts +8 -1
- package/lib/typescript/src/primitives/keyboard-avoider.d.ts.map +1 -1
- package/lib/typescript/src/utils/haptics.d.ts +12 -0
- package/lib/typescript/src/utils/haptics.d.ts.map +1 -0
- package/package.json +5 -1
- package/src/components/bottom-sheet/index.tsx +38 -2
- package/src/components/button/index.tsx +26 -5
- package/src/components/chip/index.tsx +333 -0
- package/src/components/frame/index.tsx +175 -29
- package/src/components/input/index.tsx +122 -16
- package/src/components/popover/index.tsx +49 -24
- package/src/components/progress/index.tsx +81 -1
- package/src/components/radio-group/index.tsx +55 -8
- package/src/components/section-rail/index.tsx +459 -0
- package/src/components/select/index.tsx +265 -52
- package/src/components/slider/index.tsx +371 -0
- package/src/components/switch/index.tsx +8 -1
- package/src/components/tabs/index.tsx +208 -28
- package/src/components/toggle-button/index.tsx +396 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/use-keyboard-avoidance.ts +73 -7
- package/src/hooks/use-scroll-sections.ts +127 -0
- package/src/index.ts +45 -6
- package/src/native/index.ts +13 -1
- package/src/primitives/keyboard-avoider.tsx +9 -1
- package/src/utils/haptics.ts +63 -0
- package/theme.css +6 -2
- package/lib/module/components/inline-select/index.js +0 -284
- package/lib/module/components/inline-select/index.js.map +0 -1
- package/lib/typescript/src/components/inline-select/index.d.ts +0 -48
- package/lib/typescript/src/components/inline-select/index.d.ts.map +0 -1
- package/src/components/inline-select/index.tsx +0 -332
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToggleButton — a button that stays down.
|
|
3
|
+
*
|
|
4
|
+
* The difference from Button is the whole point: a button does something and
|
|
5
|
+
* springs back, a toggle button *is* something afterwards. So the selected
|
|
6
|
+
* state is the loud one — a filled accent surface — and the resting state is
|
|
7
|
+
* quiet, either a soft fill or nothing at all.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <ToggleButton defaultSelected>Like</ToggleButton>
|
|
11
|
+
*
|
|
12
|
+
* <ToggleButton iconOnly accessibilityLabel="Bold">
|
|
13
|
+
* <BoldIcon size={16} />
|
|
14
|
+
* </ToggleButton>
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* `ToggleButtonGroup` takes over the state for a set of them — a segmented
|
|
18
|
+
* toolbar in `multiple` mode, an either-or choice in `single`. Inside a group
|
|
19
|
+
* each button needs an `id`, which is the value the group reports.
|
|
20
|
+
*
|
|
21
|
+
* ```tsx
|
|
22
|
+
* <ToggleButtonGroup selectionMode="multiple" value={marks} onValueChange={setMarks}>
|
|
23
|
+
* <ToggleButton id="bold" iconOnly accessibilityLabel="Bold">…</ToggleButton>
|
|
24
|
+
* <ToggleButton id="italic" iconOnly accessibilityLabel="Italic">…</ToggleButton>
|
|
25
|
+
* </ToggleButtonGroup>
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
import { type ReactNode } from 'react';
|
|
29
|
+
import { View, type ViewProps } from 'react-native';
|
|
30
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
31
|
+
import { type AnimatedPressableProps } from '../../primitives/animated-pressable.js';
|
|
32
|
+
declare const toggleVariants: import("tailwind-variants").TVReturnType<{
|
|
33
|
+
variant: {
|
|
34
|
+
/** A soft fill at rest, so the control is visible before you touch it. */
|
|
35
|
+
default: {
|
|
36
|
+
root: string;
|
|
37
|
+
};
|
|
38
|
+
/** Nothing at rest — for a dense toolbar where six fills would be noise. */
|
|
39
|
+
ghost: {
|
|
40
|
+
root: string;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
size: {
|
|
44
|
+
sm: {
|
|
45
|
+
root: string;
|
|
46
|
+
label: string;
|
|
47
|
+
};
|
|
48
|
+
md: {
|
|
49
|
+
root: string;
|
|
50
|
+
label: string;
|
|
51
|
+
};
|
|
52
|
+
lg: {
|
|
53
|
+
root: string;
|
|
54
|
+
label: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
selected: {
|
|
58
|
+
true: {
|
|
59
|
+
root: string;
|
|
60
|
+
label: string;
|
|
61
|
+
};
|
|
62
|
+
false: {
|
|
63
|
+
label: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
iconOnly: {
|
|
67
|
+
true: {
|
|
68
|
+
root: string;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
disabled: {
|
|
72
|
+
true: {
|
|
73
|
+
root: string;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
}, {
|
|
77
|
+
root: string;
|
|
78
|
+
label: string;
|
|
79
|
+
}, undefined, {
|
|
80
|
+
variant: {
|
|
81
|
+
/** A soft fill at rest, so the control is visible before you touch it. */
|
|
82
|
+
default: {
|
|
83
|
+
root: string;
|
|
84
|
+
};
|
|
85
|
+
/** Nothing at rest — for a dense toolbar where six fills would be noise. */
|
|
86
|
+
ghost: {
|
|
87
|
+
root: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
size: {
|
|
91
|
+
sm: {
|
|
92
|
+
root: string;
|
|
93
|
+
label: string;
|
|
94
|
+
};
|
|
95
|
+
md: {
|
|
96
|
+
root: string;
|
|
97
|
+
label: string;
|
|
98
|
+
};
|
|
99
|
+
lg: {
|
|
100
|
+
root: string;
|
|
101
|
+
label: string;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
selected: {
|
|
105
|
+
true: {
|
|
106
|
+
root: string;
|
|
107
|
+
label: string;
|
|
108
|
+
};
|
|
109
|
+
false: {
|
|
110
|
+
label: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
iconOnly: {
|
|
114
|
+
true: {
|
|
115
|
+
root: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
disabled: {
|
|
119
|
+
true: {
|
|
120
|
+
root: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
}, {
|
|
124
|
+
root: string;
|
|
125
|
+
label: string;
|
|
126
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
127
|
+
variant: {
|
|
128
|
+
/** A soft fill at rest, so the control is visible before you touch it. */
|
|
129
|
+
default: {
|
|
130
|
+
root: string;
|
|
131
|
+
};
|
|
132
|
+
/** Nothing at rest — for a dense toolbar where six fills would be noise. */
|
|
133
|
+
ghost: {
|
|
134
|
+
root: string;
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
size: {
|
|
138
|
+
sm: {
|
|
139
|
+
root: string;
|
|
140
|
+
label: string;
|
|
141
|
+
};
|
|
142
|
+
md: {
|
|
143
|
+
root: string;
|
|
144
|
+
label: string;
|
|
145
|
+
};
|
|
146
|
+
lg: {
|
|
147
|
+
root: string;
|
|
148
|
+
label: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
151
|
+
selected: {
|
|
152
|
+
true: {
|
|
153
|
+
root: string;
|
|
154
|
+
label: string;
|
|
155
|
+
};
|
|
156
|
+
false: {
|
|
157
|
+
label: string;
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
iconOnly: {
|
|
161
|
+
true: {
|
|
162
|
+
root: string;
|
|
163
|
+
};
|
|
164
|
+
};
|
|
165
|
+
disabled: {
|
|
166
|
+
true: {
|
|
167
|
+
root: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
}, {
|
|
171
|
+
root: string;
|
|
172
|
+
label: string;
|
|
173
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
174
|
+
type ToggleVariantProps = VariantProps<typeof toggleVariants>;
|
|
175
|
+
export type ToggleButtonSize = NonNullable<ToggleVariantProps['size']>;
|
|
176
|
+
export type ToggleButtonVariant = NonNullable<ToggleVariantProps['variant']>;
|
|
177
|
+
export type ToggleSelectionMode = 'single' | 'multiple';
|
|
178
|
+
export interface ToggleButtonGroupProps extends ViewProps {
|
|
179
|
+
className?: string;
|
|
180
|
+
/**
|
|
181
|
+
* `multiple` is a set of independent marks — bold *and* italic. `single` is
|
|
182
|
+
* an either-or choice where picking one clears the last.
|
|
183
|
+
*/
|
|
184
|
+
selectionMode?: ToggleSelectionMode;
|
|
185
|
+
/** Selected ids. Controlled — pair with `onValueChange`. */
|
|
186
|
+
value?: string[];
|
|
187
|
+
/** Starting selection when uncontrolled. */
|
|
188
|
+
defaultValue?: string[];
|
|
189
|
+
onValueChange?: (value: string[]) => void;
|
|
190
|
+
/** Disables every button in the group. */
|
|
191
|
+
disabled?: boolean;
|
|
192
|
+
/** Applied to every button that does not set its own. */
|
|
193
|
+
variant?: ToggleButtonVariant;
|
|
194
|
+
size?: ToggleButtonSize;
|
|
195
|
+
children: ReactNode;
|
|
196
|
+
}
|
|
197
|
+
declare const ToggleButtonGroup: import("react").ForwardRefExoticComponent<ToggleButtonGroupProps & import("react").RefAttributes<View>>;
|
|
198
|
+
interface ToggleStateValue {
|
|
199
|
+
selected: boolean;
|
|
200
|
+
disabled: boolean;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The toggle's own state, for anything rendered inside it — an icon that
|
|
204
|
+
* changes shape when selected, a count that only shows when it is on.
|
|
205
|
+
*/
|
|
206
|
+
export declare function useToggleButton(): ToggleStateValue;
|
|
207
|
+
export interface ToggleButtonProps extends Omit<AnimatedPressableProps, 'children' | 'disabled'>, Omit<ToggleVariantProps, 'selected' | 'disabled' | 'iconOnly'> {
|
|
208
|
+
children?: ReactNode;
|
|
209
|
+
className?: string;
|
|
210
|
+
/** Extra classes for the label when children is a string. */
|
|
211
|
+
labelClassName?: string;
|
|
212
|
+
/** Identifies this button within a `ToggleButtonGroup`. Required there. */
|
|
213
|
+
id?: string;
|
|
214
|
+
/** Controlled selection. Ignored inside a group, which owns the state. */
|
|
215
|
+
selected?: boolean;
|
|
216
|
+
/** Starting state when uncontrolled and outside a group. */
|
|
217
|
+
defaultSelected?: boolean;
|
|
218
|
+
onSelectedChange?: (selected: boolean) => void;
|
|
219
|
+
disabled?: boolean;
|
|
220
|
+
/** Square, with no horizontal padding — for a single icon. */
|
|
221
|
+
iconOnly?: boolean;
|
|
222
|
+
/** Extra classes applied only while selected. */
|
|
223
|
+
selectedClassName?: string;
|
|
224
|
+
/** Extra classes applied only while unselected. */
|
|
225
|
+
unselectedClassName?: string;
|
|
226
|
+
}
|
|
227
|
+
export interface ToggleButtonLabelProps {
|
|
228
|
+
className?: string;
|
|
229
|
+
children: ReactNode;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* The label, when the button holds more than a string — an icon beside text.
|
|
233
|
+
* It reads the selected state itself, so composing the two does not mean
|
|
234
|
+
* threading the colour through by hand.
|
|
235
|
+
*/
|
|
236
|
+
declare function ToggleButtonLabel({ className, children }: ToggleButtonLabelProps): import("react").JSX.Element;
|
|
237
|
+
declare namespace ToggleButtonLabel {
|
|
238
|
+
var displayName: string;
|
|
239
|
+
}
|
|
240
|
+
export declare const ToggleButton: import("react").ForwardRefExoticComponent<ToggleButtonProps & import("react").RefAttributes<View>> & {
|
|
241
|
+
Label: typeof ToggleButtonLabel;
|
|
242
|
+
};
|
|
243
|
+
export { ToggleButtonGroup };
|
|
244
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/toggle-button/index.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAG1D,OAAO,EAEL,KAAK,sBAAsB,EAC5B,MAAM,wCAAqC,CAAC;AAI7C,QAAA,MAAM,cAAc;;QAOd,0EAA0E;;;;QAE1E,4EAA4E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAF5E,0EAA0E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IAAI,CAAC,kBAAkB,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,CAAC;IAChE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4DAA4D;IAC5D,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iDAAiD;IACjD,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mDAAmD;IACnD,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAsGD,MAAM,WAAW,sBAAsB;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,sBAAsB,+BAczE;kBAdQ,iBAAiB;;;AAiB1B,eAAO,MAAM,YAAY;;CAEvB,CAAC;AAEH,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -3,6 +3,7 @@ export { useDisclosure, type UseDisclosureOptions, type UseDisclosureResult, } f
|
|
|
3
3
|
export { useBreakpoint, BREAKPOINTS, type Breakpoint, type UseBreakpointResult, } from './use-breakpoint.js';
|
|
4
4
|
export { useKeyboard, type UseKeyboardResult } from './use-keyboard.js';
|
|
5
5
|
export { useKeyboardAvoidance, type UseKeyboardAvoidanceOptions, type UseKeyboardAvoidanceResult, } from './use-keyboard-avoidance.js';
|
|
6
|
+
export { useScrollSections, type UseScrollSectionsOptions, type UseScrollSectionsResult, } from './use-scroll-sections.js';
|
|
6
7
|
export { useDebouncedValue } from './use-debounced-value.js';
|
|
7
8
|
export { usePrevious } from './use-previous.js';
|
|
8
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,4BAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,6BAA0B,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,4BAAyB,CAAC;AACjC,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,KAAK,UAAU,EACf,KAAK,mBAAmB,GACzB,MAAM,qBAAkB,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAgB,CAAC;AACrE,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,6BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EACjB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,0BAAuB,CAAC;AAC/B,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC"}
|
|
@@ -3,6 +3,15 @@ import { useAnimatedStyle, type AnimatedRef } from 'react-native-reanimated';
|
|
|
3
3
|
export interface UseKeyboardAvoidanceOptions {
|
|
4
4
|
/** Set false to leave the element where it is. */
|
|
5
5
|
enabled?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Whether this element is the one that should get out of the keyboard's way.
|
|
8
|
+
*
|
|
9
|
+
* Defaults to true, which suits a composer or a toolbar: it rides the
|
|
10
|
+
* keyboard whatever is focused. A *field* wants the opposite — pass its own
|
|
11
|
+
* focus state, or every field on the screen lifts whenever any one of them
|
|
12
|
+
* is tapped, and they all arrive at the same place on top of each other.
|
|
13
|
+
*/
|
|
14
|
+
active?: boolean;
|
|
6
15
|
/** Gap to keep between the element's bottom edge and the keyboard. */
|
|
7
16
|
offset?: number;
|
|
8
17
|
}
|
|
@@ -16,5 +25,5 @@ export interface UseKeyboardAvoidanceResult {
|
|
|
16
25
|
}
|
|
17
26
|
/** True when the keyboard controller is driving this, rather than the fallback. */
|
|
18
27
|
export declare function hasKeyboardController(): boolean;
|
|
19
|
-
export declare function useKeyboardAvoidance({ enabled, offset, }?: UseKeyboardAvoidanceOptions): UseKeyboardAvoidanceResult;
|
|
28
|
+
export declare function useKeyboardAvoidance({ enabled, active, offset, }?: UseKeyboardAvoidanceOptions): UseKeyboardAvoidanceResult;
|
|
20
29
|
//# sourceMappingURL=use-keyboard-avoidance.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-keyboard-avoidance.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-keyboard-avoidance.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,
|
|
1
|
+
{"version":3,"file":"use-keyboard-avoidance.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-keyboard-avoidance.ts"],"names":[],"mappings":"AAkCA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,KAAK,IAAI,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAKL,gBAAgB,EAEhB,KAAK,WAAW,EAEjB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,2BAA2B;IAC1C,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,sDAAsD;IACtD,GAAG,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACvB,+EAA+E;IAC/E,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,iCAAiC;IACjC,aAAa,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CACpD;AA6BD,mFAAmF;AACnF,wBAAgB,qBAAqB,IAAI,OAAO,CAQ/C;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAc,EACd,MAAa,EACb,MAAW,GACZ,GAAE,2BAAgC,GAAG,0BAA0B,CA4F/D"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent, ScrollView } from 'react-native';
|
|
2
|
+
export interface UseScrollSectionsOptions {
|
|
3
|
+
/** Section ids, in the order they appear down the page. */
|
|
4
|
+
ids: string[];
|
|
5
|
+
/**
|
|
6
|
+
* How far down the viewport the reading line sits, in pixels. Larger values
|
|
7
|
+
* switch to the next section later.
|
|
8
|
+
*/
|
|
9
|
+
offset?: number;
|
|
10
|
+
/** How close to the bottom counts as "at the bottom", in pixels. */
|
|
11
|
+
endThreshold?: number;
|
|
12
|
+
/** Extra gap left above a section when scrolling to it. */
|
|
13
|
+
scrollPadding?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface UseScrollSectionsResult {
|
|
16
|
+
/** Attach to the ScrollView, so `scrollTo` has something to drive. */
|
|
17
|
+
ref: React.RefObject<ScrollView | null>;
|
|
18
|
+
/** The section being read. */
|
|
19
|
+
active: string | undefined;
|
|
20
|
+
/** Spread onto the ScrollView. */
|
|
21
|
+
scrollProps: {
|
|
22
|
+
onScroll: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
23
|
+
scrollEventThrottle: number;
|
|
24
|
+
};
|
|
25
|
+
/** `onLayout` for a section's wrapper: `onLayout={measure(id)}`. */
|
|
26
|
+
measure: (id: string) => (event: LayoutChangeEvent) => void;
|
|
27
|
+
/** Scroll a section to the top. Pass straight to a rail's `onValueChange`. */
|
|
28
|
+
scrollTo: (id: string) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare function useScrollSections({ ids, offset, endThreshold, scrollPadding, }: UseScrollSectionsOptions): UseScrollSectionsResult;
|
|
31
|
+
//# sourceMappingURL=use-scroll-sections.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-scroll-sections.d.ts","sourceRoot":"","sources":["../../../../src/hooks/use-scroll-sections.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,UAAU,EACX,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,wBAAwB;IACvC,2DAA2D;IAC3D,GAAG,EAAE,MAAM,EAAE,CAAC;IACd;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,GAAG,IAAI,CAAC,CAAC;IACxC,8BAA8B;IAC9B,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,kCAAkC;IAClC,WAAW,EAAE;QACX,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;QACnE,mBAAmB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF,oEAAoE;IACpE,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC5D,8EAA8E;IAC9E,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAChC;AAED,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,MAAY,EACZ,YAAiB,EACjB,aAAiB,GAClB,EAAE,wBAAwB,GAAG,uBAAuB,CAyDpD"}
|
|
@@ -5,6 +5,7 @@ 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
7
|
export { hasNativeUI } from './native/index.js';
|
|
8
|
+
export { hasHaptics, selectionTick } from './utils/haptics.js';
|
|
8
9
|
export { Accordion, type AccordionProps, type AccordionItemProps, type AccordionTriggerProps, type AccordionIndicatorProps, type AccordionContentProps, type AccordionVariant, type AccordionSelectionMode, } from './components/accordion/index.js';
|
|
9
10
|
export { Alert, type AlertProps, type AlertIndicatorProps, } from './components/alert/index.js';
|
|
10
11
|
export { Avatar, type AvatarProps, type AvatarBadgeProps, } from './components/avatar/index.js';
|
|
@@ -12,10 +13,11 @@ export { Attachment, type AttachmentProps, type AttachmentGroupProps, type Attac
|
|
|
12
13
|
export { Badge, type BadgeProps } from './components/badge/index.js';
|
|
13
14
|
export { BottomSheet, type BottomSheetProps, type BottomSheetContentProps, } from './components/bottom-sheet/index.js';
|
|
14
15
|
export { Button, type ButtonProps } from './components/button/index.js';
|
|
16
|
+
export { ToggleButton, ToggleButtonGroup, useToggleButton, type ToggleButtonProps, type ToggleButtonGroupProps, type ToggleButtonLabelProps, type ToggleButtonSize, type ToggleButtonVariant, type ToggleSelectionMode, } from './components/toggle-button/index.js';
|
|
15
17
|
export { Dialog, type DialogProps, type DialogContentProps, } from './components/dialog/index.js';
|
|
16
|
-
export { Frame, type FrameProps } from './components/frame/index.js';
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
18
|
+
export { Frame, type FrameProps, type FrameRootProps, type FramePanelProps, type FrameRowProps, type FrameSectionProps, type FrameVariant, } from './components/frame/index.js';
|
|
19
|
+
export { Select, type SelectProps, type SelectItemProps, type SelectPresentation, } from './components/select/index.js';
|
|
20
|
+
export { SectionRail, type SectionRailProps, type SectionRailTriggerProps, type SectionRailBarProps, type SectionRailContentProps, type SectionRailItemProps, type SectionRailPlacement, type SectionRailAlign, } from './components/section-rail/index.js';
|
|
19
21
|
export { Tabs, type TabsProps, type TabsListProps, type TabsTriggerProps, type TabsContentProps, } from './components/tabs/index.js';
|
|
20
22
|
export { Card, type CardProps } from './components/card/index.js';
|
|
21
23
|
export { Checkbox, type CheckboxProps } from './components/checkbox/index.js';
|
|
@@ -35,6 +37,7 @@ export { ScrollFade, type ScrollFadeProps, } from './components/scroll-fade/inde
|
|
|
35
37
|
export { Separator, type SeparatorProps } from './components/separator/index.js';
|
|
36
38
|
export { Shimmer, type ShimmerProps } from './components/shimmer/index.js';
|
|
37
39
|
export { Skeleton, type SkeletonProps } from './components/skeleton/index.js';
|
|
40
|
+
export { Slider, type SliderProps } from './components/slider/index.js';
|
|
38
41
|
export { Spinner, type SpinnerProps } from './components/spinner/index.js';
|
|
39
42
|
export { Steps, type StepsProps, type StepsItemProps, type StepsTriggerProps, type StepsIndicatorProps, type StepsSeparatorProps, type StepState, type StepsOrientation, } from './components/steps/index.js';
|
|
40
43
|
export { Surface, type SurfaceProps } from './components/surface/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;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAU,CAAC;
|
|
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,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,EACL,aAAa,EACb,KAAK,EACL,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,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"}
|
|
@@ -2,7 +2,21 @@ import type { ComponentType, ReactNode } from 'react';
|
|
|
2
2
|
interface NativeUIModule {
|
|
3
3
|
Host: ComponentType<{
|
|
4
4
|
children?: ReactNode;
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Whether the host resizes itself to the platform content.
|
|
7
|
+
*
|
|
8
|
+
* Every control here gives the host an explicit height instead, and takes
|
|
9
|
+
* its width from ordinary layout. The measurement arrives a frame late and
|
|
10
|
+
* again whenever the platform's content changes, so a host left to work
|
|
11
|
+
* its own size out renders at nothing and then jumps — on first paint, and
|
|
12
|
+
* again on first press. The per-axis form does not help; the answer is not
|
|
13
|
+
* to ask. Only the natively-presented sheet still uses it, where the host
|
|
14
|
+
* is a zero-size anchor rather than the control itself.
|
|
15
|
+
*/
|
|
16
|
+
matchContents?: boolean | {
|
|
17
|
+
vertical?: boolean;
|
|
18
|
+
horizontal?: boolean;
|
|
19
|
+
};
|
|
6
20
|
style?: unknown;
|
|
7
21
|
[key: string]: unknown;
|
|
8
22
|
}>;
|
|
@@ -18,6 +32,7 @@ interface NativeUIModule {
|
|
|
18
32
|
}>;
|
|
19
33
|
Button: ComponentType<Record<string, unknown>>;
|
|
20
34
|
Switch: ComponentType<Record<string, unknown>>;
|
|
35
|
+
Slider: ComponentType<Record<string, unknown>>;
|
|
21
36
|
Picker: ComponentType<Record<string, unknown>> & {
|
|
22
37
|
Item: ComponentType<Record<string, unknown>>;
|
|
23
38
|
};
|
|
@@ -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,aAAa,CAAC,EAAE,OAAO,CAAC;
|
|
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;;;;;;;;;;WAUG;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,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"}
|
|
@@ -11,11 +11,18 @@ export interface KeyboardAvoiderProps extends ViewProps {
|
|
|
11
11
|
className?: string;
|
|
12
12
|
/** Set false to leave the content where it is. */
|
|
13
13
|
enabled?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this is the element that should get out of the keyboard's way.
|
|
16
|
+
* Defaults to true, which is right for a composer or a toolbar. Pass a
|
|
17
|
+
* field's focus state when wrapping a single field, so the others on the
|
|
18
|
+
* screen stay put.
|
|
19
|
+
*/
|
|
20
|
+
active?: boolean;
|
|
14
21
|
/** Gap to keep between the content's bottom edge and the keyboard. */
|
|
15
22
|
offset?: number;
|
|
16
23
|
children?: ReactNode;
|
|
17
24
|
}
|
|
18
|
-
export declare function KeyboardAvoider({ className, enabled, offset, children, style, onLayout, ...props }: KeyboardAvoiderProps): import("react").JSX.Element;
|
|
25
|
+
export declare function KeyboardAvoider({ className, enabled, active, offset, children, style, onLayout, ...props }: KeyboardAvoiderProps): import("react").JSX.Element;
|
|
19
26
|
export declare namespace KeyboardAvoider {
|
|
20
27
|
var displayName: string;
|
|
21
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keyboard-avoider.d.ts","sourceRoot":"","sources":["../../../../src/primitives/keyboard-avoider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,MAAM,WAAW,oBAAqB,SAAQ,SAAS;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAc,EACd,MAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAiBtB;
|
|
1
|
+
{"version":3,"file":"keyboard-avoider.d.ts","sourceRoot":"","sources":["../../../../src/primitives/keyboard-avoider.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAI9C,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,sEAAsE;IACtE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAc,EACd,MAAa,EACb,MAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,+BAiBtB;yBA1Be,eAAe"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Whether a haptic will actually be felt. */
|
|
2
|
+
export declare function hasHaptics(): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* The light tick for moving between options — a segmented control, a picker,
|
|
5
|
+
* a section marker. Deliberately not an impact: selection is the lightest of
|
|
6
|
+
* the feedbacks, and anything heavier gets tiring when it fires on scroll.
|
|
7
|
+
*
|
|
8
|
+
* Fire-and-forget. A rejected haptic is not worth an unhandled rejection, and
|
|
9
|
+
* there is nothing useful to do about one.
|
|
10
|
+
*/
|
|
11
|
+
export declare function selectionTick(): void;
|
|
12
|
+
//# sourceMappingURL=haptics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"haptics.d.ts","sourceRoot":"","sources":["../../../../src/utils/haptics.ts"],"names":[],"mappings":"AA+CA,8CAA8C;AAC9C,wBAAgB,UAAU,IAAI,OAAO,CAEpC;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,IAAI,IAAI,CAEpC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "panelui-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.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",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@react-native-masked-view/masked-view": ">=0.3.0",
|
|
68
68
|
"expo-blur": ">=13.0.0",
|
|
69
69
|
"expo-clipboard": ">=7.0.0",
|
|
70
|
+
"expo-haptics": ">=13.0.0",
|
|
70
71
|
"expo-linear-gradient": ">=13.0.0",
|
|
71
72
|
"react": "*",
|
|
72
73
|
"react-native": "*",
|
|
@@ -109,6 +110,9 @@
|
|
|
109
110
|
"expo-clipboard": {
|
|
110
111
|
"optional": true
|
|
111
112
|
},
|
|
113
|
+
"expo-haptics": {
|
|
114
|
+
"optional": true
|
|
115
|
+
},
|
|
112
116
|
"react-native-keyboard-controller": {
|
|
113
117
|
"optional": true
|
|
114
118
|
}
|
|
@@ -71,6 +71,39 @@ export interface BottomSheetProps {
|
|
|
71
71
|
snapPoints?: ('half' | 'full' | { fraction: number } | { height: number })[];
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Roughly how tall the platform will make the sheet at a given detent, as a
|
|
76
|
+
* fraction of the screen. Approximate on purpose — it is used as a floor for
|
|
77
|
+
* the content, not as the sheet's real height, which the platform owns.
|
|
78
|
+
*/
|
|
79
|
+
const DETENT_FRACTION = { half: 0.5, full: 0.9 } as const;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The height the content should at least fill for a given set of detents.
|
|
83
|
+
*
|
|
84
|
+
* Without this the hosted content sizes to itself and the platform centres
|
|
85
|
+
* that smaller box inside the taller sheet, which is why a short sheet shows
|
|
86
|
+
* its content floating in the middle. Filling the detent leaves nothing to
|
|
87
|
+
* centre, so the content sits where it was written: at the top.
|
|
88
|
+
*/
|
|
89
|
+
function detentFloor(
|
|
90
|
+
snapPoints: BottomSheetProps['snapPoints'],
|
|
91
|
+
screenHeight: number
|
|
92
|
+
): number | undefined {
|
|
93
|
+
if (!snapPoints?.length) return undefined;
|
|
94
|
+
|
|
95
|
+
// The sheet opens at its first detent, so that is the one to fill.
|
|
96
|
+
const first = snapPoints[0];
|
|
97
|
+
if (first === 'half' || first === 'full') {
|
|
98
|
+
return screenHeight * DETENT_FRACTION[first];
|
|
99
|
+
}
|
|
100
|
+
if (typeof first === 'object' && 'fraction' in first) {
|
|
101
|
+
return screenHeight * first.fraction;
|
|
102
|
+
}
|
|
103
|
+
if (typeof first === 'object' && 'height' in first) return first.height;
|
|
104
|
+
return undefined;
|
|
105
|
+
}
|
|
106
|
+
|
|
74
107
|
/**
|
|
75
108
|
* Set by the root so Content knows the platform is drawing the sheet, and with
|
|
76
109
|
* which detents. Null means the styled sheet renders.
|
|
@@ -209,8 +242,10 @@ function BottomSheetContent({
|
|
|
209
242
|
{...props}
|
|
210
243
|
className={cn(
|
|
211
244
|
// The platform draws the container, but it hands us a bare
|
|
212
|
-
// box — padding and safe-area are still ours.
|
|
213
|
-
|
|
245
|
+
// box — padding and safe-area are still ours. The top
|
|
246
|
+
// padding has to clear the platform's grabber, which sits
|
|
247
|
+
// inside the sheet rather than above the content.
|
|
248
|
+
'justify-start gap-2 px-5 pb-2 pt-5',
|
|
214
249
|
className
|
|
215
250
|
)}
|
|
216
251
|
style={{
|
|
@@ -219,6 +254,7 @@ function BottomSheetContent({
|
|
|
219
254
|
// against, so `100%` measures against nothing and the
|
|
220
255
|
// content lays out wider than the sheet it sits in.
|
|
221
256
|
width: screenWidth,
|
|
257
|
+
minHeight: detentFloor(nativeSheet.snapPoints, screenHeight),
|
|
222
258
|
paddingBottom: Math.max(insets.bottom, 16),
|
|
223
259
|
}}
|
|
224
260
|
>
|
|
@@ -110,14 +110,35 @@ export interface ButtonProps
|
|
|
110
110
|
* optional `@expo/ui` package; without it this prop does nothing.
|
|
111
111
|
*
|
|
112
112
|
* **Theme tokens do not apply** — the platform draws the button, so
|
|
113
|
-
* `className`, `
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
113
|
+
* `className`, `fullWidth`, `startContent`, `endContent` and `loading` are
|
|
114
|
+
* all ignored. `variant` maps onto the nearest platform style:
|
|
115
|
+
* `primary`/`destructive` → filled, `outline` → outlined, everything else
|
|
116
|
+
* → text; `size` sets the height.
|
|
117
|
+
*
|
|
118
|
+
* A native button **fills the width it is given**, because the host is told
|
|
119
|
+
* its size rather than left to measure the platform's content — which is
|
|
120
|
+
* what made it collapse and then jump on first press. Put it in a row to
|
|
121
|
+
* share the width, or in a narrower parent to shrink it.
|
|
117
122
|
*/
|
|
118
123
|
native?: boolean;
|
|
119
124
|
}
|
|
120
125
|
|
|
126
|
+
/**
|
|
127
|
+
* Height given to the native host, matching the styled scale above.
|
|
128
|
+
*
|
|
129
|
+
* The host is told its size rather than asked to work it out. `matchContents`
|
|
130
|
+
* measures the platform's own content a frame late and again when that content
|
|
131
|
+
* changes — so the button renders at nothing, collapses against whatever sits
|
|
132
|
+
* above it, and jolts into place on the first press. Width comes from ordinary
|
|
133
|
+
* layout instead, which is why a native button fills its container.
|
|
134
|
+
*/
|
|
135
|
+
const NATIVE_HEIGHT: Record<NonNullable<ButtonVariantProps['size']>, number> = {
|
|
136
|
+
sm: 36,
|
|
137
|
+
md: 44,
|
|
138
|
+
lg: 48,
|
|
139
|
+
icon: 44,
|
|
140
|
+
};
|
|
141
|
+
|
|
121
142
|
/** PanelUI variants mapped onto the platform button styles. */
|
|
122
143
|
const NATIVE_VARIANT: Record<
|
|
123
144
|
NonNullable<ButtonVariantProps['variant']>,
|
|
@@ -178,7 +199,7 @@ export const Button = forwardRef<View, ButtonProps>(
|
|
|
178
199
|
const isStringLabel = typeof children === 'string';
|
|
179
200
|
|
|
180
201
|
return (
|
|
181
|
-
<Host
|
|
202
|
+
<Host style={{ height: NATIVE_HEIGHT[size ?? 'md'] }}>
|
|
182
203
|
<NativeButton
|
|
183
204
|
label={isStringLabel ? children : undefined}
|
|
184
205
|
variant={NATIVE_VARIANT[variant ?? 'primary']}
|