@butternutbox/pawprint-native 0.18.0 → 0.19.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@butternutbox/pawprint-native",
3
- "version": "0.18.0",
3
+ "version": "0.19.1",
4
4
  "type": "module",
5
5
  "description": "ButternutBox Pawprint Design System - React Native Components",
6
6
  "main": "./dist/index.cjs",
@@ -4,10 +4,12 @@ import { Button } from "./Button"
4
4
  import type { ButtonProps } from "./Button"
5
5
  import { Typography } from "../Typography"
6
6
  import { Icon } from "../Icon"
7
- import { Check } from "@butternutbox/pawprint-icons/core"
8
- import { IosShare, Whatsapp } from "@butternutbox/pawprint-icons/marketing"
9
-
10
- import { KeyboardDoubleArrowDown } from "@butternutbox/pawprint-icons/core"
7
+ import {
8
+ Check,
9
+ IosShare,
10
+ Whatsapp,
11
+ KeyboardDoubleArrowDown
12
+ } from "@butternutbox/pawprint-icons/core"
11
13
 
12
14
  export default {
13
15
  title: "Atoms/Button",
@@ -151,16 +151,22 @@ export const Switch = React.forwardRef<View, SwitchProps>(
151
151
 
152
152
  return (
153
153
  <StyledContainer
154
- ref={ref}
155
154
  switchGap={parseTokenValue(spacing.gap)}
156
155
  switchOpacity={disabled ? parseFloat(opacity.disabled) : 1}
157
156
  {...rest}
157
+ pointerEvents={disabled ? "none" : "auto"}
158
158
  >
159
159
  <SwitchPrimitive.Root
160
+ ref={ref as any}
160
161
  checked={isChecked}
161
162
  onCheckedChange={handleCheckedChange}
162
163
  disabled={disabled}
163
- asChild
164
+ style={
165
+ {
166
+ width: controlWidth,
167
+ height: controlHeight
168
+ } as any
169
+ }
164
170
  >
165
171
  <StyledControlTrack
166
172
  switchChecked={isChecked}
@@ -170,17 +176,19 @@ export const Switch = React.forwardRef<View, SwitchProps>(
170
176
  controlBorderColor={colour.control.border.default}
171
177
  controlBgChecked={colour.control.background.selected}
172
178
  controlBgDefault={colour.control.background.default}
173
- pointerEvents={disabled ? "none" : "auto"}
179
+ pointerEvents="none"
174
180
  >
175
- <StyledThumb
176
- thumbSize={thumbSize}
177
- thumbBgColor={
178
- isChecked
179
- ? colour.thumb.background.selected
180
- : colour.thumb.background.default
181
- }
182
- style={{ transform: [{ translateX: thumbTranslateX }] }}
183
- />
181
+ <SwitchPrimitive.Thumb asChild>
182
+ <StyledThumb
183
+ thumbSize={thumbSize}
184
+ thumbBgColor={
185
+ isChecked
186
+ ? colour.thumb.background.selected
187
+ : colour.thumb.background.default
188
+ }
189
+ style={{ transform: [{ translateX: thumbTranslateX }] }}
190
+ />
191
+ </SwitchPrimitive.Thumb>
184
192
  </StyledControlTrack>
185
193
  </SwitchPrimitive.Root>
186
194
 
@@ -2,6 +2,7 @@ import React from "react"
2
2
  import { ScrollView, ScrollViewProps, useWindowDimensions } from "react-native"
3
3
  import styled from "@emotion/native"
4
4
  import { useTheme } from "@emotion/react"
5
+ import { useSafeAreaInsets } from "react-native-safe-area-context"
5
6
  import { useDrawerHeaderContext } from "./DrawerHeaderContext"
6
7
  import { useDrawerFooterContext } from "./DrawerFooterContext"
7
8
  import { useDrawerBodyMax } from "./DrawerBodyMaxContext"
@@ -48,6 +49,7 @@ export const DrawerBody = React.forwardRef<ScrollView, DrawerBodyProps>(
48
49
  const footerContext = useDrawerFooterContext()
49
50
  const providedMaxHeight = useDrawerBodyMax()
50
51
  const { height: windowHeight } = useWindowDimensions()
52
+ const insets = useSafeAreaInsets()
51
53
 
52
54
  const gap = parseTokenValue(content.slot.gap)
53
55
  const horizontalPadding = parseTokenValue(content.slot.horizontalPadding)
@@ -66,8 +68,16 @@ export const DrawerBody = React.forwardRef<ScrollView, DrawerBodyProps>(
66
68
  parseTokenValue(buttons.size.sm.height)
67
69
  : horizontalPadding
68
70
 
71
+ // With no footer, the body is the last element in the panel, so it must
72
+ // clear the bottom safe area (home indicator / Android nav bar) itself —
73
+ // DrawerFooter does this when present. Use the larger of the standard 2xl
74
+ // content pad and the safe-area inset so short insets (iOS) keep the usual
75
+ // spacing while a taller inset (Android nav bar) isn't clipped.
69
76
  const bodyPaddingBottom = !footerContext
70
- ? parseTokenValue(theme.tokens.semantics.dimensions.spacing["2xl"])
77
+ ? Math.max(
78
+ parseTokenValue(theme.tokens.semantics.dimensions.spacing["2xl"]),
79
+ insets.bottom
80
+ )
71
81
  : 0
72
82
 
73
83
  return (