@butternutbox/pawprint-native 0.10.5 → 0.10.6
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/.turbo/turbo-build.log +7 -7
- package/CHANGELOG.md +7 -0
- package/dist/index.cjs +6 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Drawer/Drawer.stories.tsx +58 -0
- package/src/components/molecules/Drawer/Drawer.tsx +10 -3
- package/src/components/molecules/Drawer/index.ts +5 -1
- package/src/components/molecules/NumberField/NumberFieldInput.tsx +1 -2
package/package.json
CHANGED
|
@@ -273,6 +273,54 @@ Playground.args = {
|
|
|
273
273
|
defaultOpen: false
|
|
274
274
|
}
|
|
275
275
|
|
|
276
|
+
export const WithTopContent = () => {
|
|
277
|
+
const [showToast, setShowToast] = useState(false)
|
|
278
|
+
|
|
279
|
+
return (
|
|
280
|
+
<View style={styles.container}>
|
|
281
|
+
<Drawer.Root>
|
|
282
|
+
<Drawer.Trigger>
|
|
283
|
+
<Button variant="filled" colour="primary">
|
|
284
|
+
Open drawer with overlay
|
|
285
|
+
</Button>
|
|
286
|
+
</Drawer.Trigger>
|
|
287
|
+
<Drawer.Portal
|
|
288
|
+
topContent={
|
|
289
|
+
showToast ? (
|
|
290
|
+
<View style={styles.toast}>
|
|
291
|
+
<Typography>Action saved!</Typography>
|
|
292
|
+
</View>
|
|
293
|
+
) : null
|
|
294
|
+
}
|
|
295
|
+
>
|
|
296
|
+
<Drawer.Overlay />
|
|
297
|
+
<Drawer.Content>
|
|
298
|
+
<Drawer.Header variant="titleAndText">
|
|
299
|
+
<Drawer.Title>Floating content demo</Drawer.Title>
|
|
300
|
+
<Drawer.Close />
|
|
301
|
+
</Drawer.Header>
|
|
302
|
+
<Drawer.Body>
|
|
303
|
+
<Typography>{bodyText}</Typography>
|
|
304
|
+
</Drawer.Body>
|
|
305
|
+
<Drawer.Footer>
|
|
306
|
+
<Button
|
|
307
|
+
variant="filled"
|
|
308
|
+
colour="primary"
|
|
309
|
+
onPress={() => {
|
|
310
|
+
setShowToast(true)
|
|
311
|
+
setTimeout(() => setShowToast(false), 2000)
|
|
312
|
+
}}
|
|
313
|
+
>
|
|
314
|
+
Show overlay
|
|
315
|
+
</Button>
|
|
316
|
+
</Drawer.Footer>
|
|
317
|
+
</Drawer.Content>
|
|
318
|
+
</Drawer.Portal>
|
|
319
|
+
</Drawer.Root>
|
|
320
|
+
</View>
|
|
321
|
+
)
|
|
322
|
+
}
|
|
323
|
+
|
|
276
324
|
const styles = StyleSheet.create({
|
|
277
325
|
container: {
|
|
278
326
|
padding: 16
|
|
@@ -281,5 +329,15 @@ const styles = StyleSheet.create({
|
|
|
281
329
|
flexDirection: "row",
|
|
282
330
|
gap: 12,
|
|
283
331
|
marginBottom: 16
|
|
332
|
+
},
|
|
333
|
+
toast: {
|
|
334
|
+
position: "absolute",
|
|
335
|
+
top: 60,
|
|
336
|
+
left: 16,
|
|
337
|
+
right: 16,
|
|
338
|
+
backgroundColor: "#000",
|
|
339
|
+
padding: 16,
|
|
340
|
+
borderRadius: 8,
|
|
341
|
+
zIndex: 100
|
|
284
342
|
}
|
|
285
343
|
})
|
|
@@ -135,15 +135,19 @@ DrawerTrigger.displayName = "Drawer.Trigger"
|
|
|
135
135
|
|
|
136
136
|
// ─── Portal ───────────────────────────────────────────────────────────────────
|
|
137
137
|
|
|
138
|
-
type DrawerPortalProps = {
|
|
138
|
+
export type DrawerPortalProps = {
|
|
139
139
|
children: React.ReactNode
|
|
140
|
+
topContent?: React.ReactNode
|
|
140
141
|
}
|
|
141
142
|
|
|
142
143
|
/**
|
|
143
144
|
* Renders its children above the rest of the app using React Native `Modal`.
|
|
144
145
|
* The modal stays mounted during exit animations and unmounts once complete.
|
|
146
|
+
*
|
|
147
|
+
* @param children - Drawer content (Overlay, Content, etc.)
|
|
148
|
+
* @param topContent - *(optional)* Additional content rendered on top of the drawer
|
|
145
149
|
*/
|
|
146
|
-
const DrawerPortal = ({ children }: DrawerPortalProps) => {
|
|
150
|
+
const DrawerPortal = ({ children, topContent }: DrawerPortalProps) => {
|
|
147
151
|
const { modalVisible, closeDrawer } = React.useContext(DrawerContext)
|
|
148
152
|
|
|
149
153
|
if (!modalVisible) return null
|
|
@@ -156,7 +160,10 @@ const DrawerPortal = ({ children }: DrawerPortalProps) => {
|
|
|
156
160
|
statusBarTranslucent
|
|
157
161
|
onRequestClose={closeDrawer}
|
|
158
162
|
>
|
|
159
|
-
<View style={styles.modalContainer}>
|
|
163
|
+
<View style={styles.modalContainer}>
|
|
164
|
+
{children}
|
|
165
|
+
{topContent}
|
|
166
|
+
</View>
|
|
160
167
|
</Modal>
|
|
161
168
|
)
|
|
162
169
|
}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
export { Drawer } from "./Drawer"
|
|
2
|
-
export type {
|
|
2
|
+
export type {
|
|
3
|
+
DrawerProps,
|
|
4
|
+
DrawerTriggerProps,
|
|
5
|
+
DrawerPortalProps
|
|
6
|
+
} from "./Drawer"
|
|
3
7
|
export type { DrawerContentProps } from "./DrawerContent"
|
|
4
8
|
export type { DrawerOverlayProps } from "./DrawerOverlay"
|
|
5
9
|
export type { DrawerGrabberProps } from "./DrawerGrabber"
|
|
@@ -90,8 +90,7 @@ const StyledTextInput = styled(TextInput)<{
|
|
|
90
90
|
color: inputColor,
|
|
91
91
|
fontFamily: inputFontFamily,
|
|
92
92
|
...(inputFontWeight ? { fontWeight: inputFontWeight } : {}),
|
|
93
|
-
fontSize: inputFontSize
|
|
94
|
-
lineHeight: 0
|
|
93
|
+
fontSize: inputFontSize
|
|
95
94
|
}))
|
|
96
95
|
|
|
97
96
|
const StyledRow = styled(View)<{
|