@butternutbox/pawprint-native 0.25.0 → 1.0.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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +16 -0
- package/dist/index.cjs +26 -50
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -7
- package/dist/index.d.ts +2 -7
- package/dist/index.js +16 -37
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/components/atoms/Button/Button.stories.tsx +90 -16
- package/src/components/atoms/Button/Button.tsx +14 -3
- package/src/components/atoms/Input/InputField.tsx +1 -1
- package/src/components/atoms/TextArea/TextAreaField.tsx +1 -1
- package/src/components/atoms/Typography/Typography.tsx +1 -1
- package/src/components/molecules/NativeSelectPicker/NativeSelectPicker.styled.ts +1 -1
- package/src/components/molecules/NumberField/NumberFieldInput.tsx +1 -1
- package/src/index.ts +1 -1
- package/tsup.config.ts +1 -2
- package/dist/ibm-plex-sans-condensed-400-normal.ttf +0 -0
- package/dist/ibm-plex-sans-condensed-500-normal.ttf +0 -0
- package/dist/ibm-plex-sans-condensed-600-normal.ttf +0 -0
- package/dist/ibm-plex-sans-condensed-700-normal.ttf +0 -0
- package/dist/ida-narrow-500-normal.ttf +0 -0
- package/dist/ida-narrow-700-normal.ttf +0 -0
- package/src/fonts/ibm-plex-sans-condensed-400-normal.ttf +0 -0
- package/src/fonts/ibm-plex-sans-condensed-500-normal.ttf +0 -0
- package/src/fonts/ibm-plex-sans-condensed-600-normal.ttf +0 -0
- package/src/fonts/ibm-plex-sans-condensed-700-normal.ttf +0 -0
- package/src/fonts/ida-narrow-500-normal.ttf +0 -0
- package/src/fonts/ida-narrow-700-normal.ttf +0 -0
- package/src/fonts/index.ts +0 -48
- package/src/types/fonts.d.ts +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@butternutbox/pawprint-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "ButternutBox Pawprint Design System - React Native Components",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"test": "vitest run"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@butternutbox/pawprint-fonts": "^2.0.0",
|
|
25
26
|
"@butternutbox/pawprint-tokens": "^0.5.0",
|
|
26
27
|
"@emotion/native": "^11.11.0",
|
|
27
28
|
"@emotion/react": "^11.14.0",
|
|
@@ -5,20 +5,18 @@ import type { ButtonProps } from "./Button"
|
|
|
5
5
|
import { Typography } from "../Typography"
|
|
6
6
|
import { Icon } from "../Icon"
|
|
7
7
|
import {
|
|
8
|
-
|
|
8
|
+
Facebook,
|
|
9
9
|
IosShare,
|
|
10
10
|
Whatsapp,
|
|
11
|
-
|
|
11
|
+
Mail
|
|
12
12
|
} from "@butternutbox/pawprint-icons/core"
|
|
13
13
|
|
|
14
14
|
const iconElements: Record<string, React.ReactNode> = {
|
|
15
15
|
None: undefined,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Whatsapp: <Icon icon={Whatsapp} colour="primary" />,
|
|
21
|
-
Check: <Icon icon={Check} colour="primary" />
|
|
16
|
+
Facebook: <Icon icon={Facebook} size="sm" colour="action-default" />,
|
|
17
|
+
IosShare: <Icon icon={IosShare} size="sm" colour="action-default" />,
|
|
18
|
+
Whatsapp: <Icon icon={Whatsapp} size="sm" colour="action-default" />,
|
|
19
|
+
Mail: <Icon icon={Mail} size="sm" colour="action-default" />
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
const iconArgType = {
|
|
@@ -155,28 +153,104 @@ export const WithStartIcon = () => (
|
|
|
155
153
|
<View style={styles.row}>
|
|
156
154
|
<Button
|
|
157
155
|
size={size}
|
|
158
|
-
startIcon={
|
|
156
|
+
startIcon={
|
|
157
|
+
<Icon icon={Facebook} size="sm" colour="action-default" />
|
|
158
|
+
}
|
|
159
159
|
>
|
|
160
|
-
|
|
160
|
+
Share
|
|
161
161
|
</Button>
|
|
162
162
|
<Button
|
|
163
163
|
size={size}
|
|
164
|
-
startIcon={
|
|
164
|
+
startIcon={
|
|
165
|
+
<Icon icon={IosShare} size="sm" colour="action-default" />
|
|
166
|
+
}
|
|
165
167
|
>
|
|
166
|
-
|
|
168
|
+
Export
|
|
167
169
|
</Button>
|
|
168
170
|
<Button
|
|
169
171
|
size={size}
|
|
170
|
-
startIcon={
|
|
172
|
+
startIcon={
|
|
173
|
+
<Icon icon={Whatsapp} size="sm" colour="action-default" />
|
|
174
|
+
}
|
|
171
175
|
>
|
|
172
|
-
|
|
176
|
+
Message
|
|
173
177
|
</Button>
|
|
174
178
|
<Button
|
|
175
179
|
size={size}
|
|
176
|
-
startIcon={<Icon icon={
|
|
180
|
+
startIcon={<Icon icon={Mail} size="sm" colour="action-default" />}
|
|
177
181
|
colour="secondary"
|
|
178
182
|
>
|
|
179
|
-
|
|
183
|
+
Send
|
|
184
|
+
</Button>
|
|
185
|
+
</View>
|
|
186
|
+
</View>
|
|
187
|
+
))}
|
|
188
|
+
</View>
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
export const WithEndIcon = () => (
|
|
192
|
+
<View style={styles.column}>
|
|
193
|
+
{(["sm", "md", "lg"] as const).map((size) => (
|
|
194
|
+
<View key={size} style={styles.section}>
|
|
195
|
+
<Typography size="sm" weight="semiBold" color="tertiary">
|
|
196
|
+
{size}
|
|
197
|
+
</Typography>
|
|
198
|
+
<View style={styles.row}>
|
|
199
|
+
<Button
|
|
200
|
+
size={size}
|
|
201
|
+
endIcon={<Icon icon={Facebook} size="sm" colour="action-default" />}
|
|
202
|
+
>
|
|
203
|
+
Connect
|
|
204
|
+
</Button>
|
|
205
|
+
<Button
|
|
206
|
+
size={size}
|
|
207
|
+
endIcon={<Icon icon={IosShare} size="sm" colour="action-default" />}
|
|
208
|
+
>
|
|
209
|
+
Share
|
|
210
|
+
</Button>
|
|
211
|
+
<Button
|
|
212
|
+
size={size}
|
|
213
|
+
endIcon={<Icon icon={Whatsapp} size="sm" colour="action-default" />}
|
|
214
|
+
>
|
|
215
|
+
Chat
|
|
216
|
+
</Button>
|
|
217
|
+
<Button
|
|
218
|
+
size={size}
|
|
219
|
+
endIcon={<Icon icon={Mail} size="sm" colour="action-default" />}
|
|
220
|
+
colour="secondary"
|
|
221
|
+
>
|
|
222
|
+
Email
|
|
223
|
+
</Button>
|
|
224
|
+
</View>
|
|
225
|
+
</View>
|
|
226
|
+
))}
|
|
227
|
+
</View>
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
export const WithBothIcons = () => (
|
|
231
|
+
<View style={styles.column}>
|
|
232
|
+
{(["sm", "md", "lg"] as const).map((size) => (
|
|
233
|
+
<View key={size} style={styles.section}>
|
|
234
|
+
<Typography size="sm" weight="semiBold" color="tertiary">
|
|
235
|
+
{size}
|
|
236
|
+
</Typography>
|
|
237
|
+
<View style={styles.row}>
|
|
238
|
+
<Button
|
|
239
|
+
size={size}
|
|
240
|
+
startIcon={
|
|
241
|
+
<Icon icon={Facebook} size="sm" colour="action-default" />
|
|
242
|
+
}
|
|
243
|
+
endIcon={<Icon icon={IosShare} size="sm" colour="action-default" />}
|
|
244
|
+
>
|
|
245
|
+
Share
|
|
246
|
+
</Button>
|
|
247
|
+
<Button
|
|
248
|
+
size={size}
|
|
249
|
+
startIcon={<Icon icon={Mail} size="sm" colour="action-default" />}
|
|
250
|
+
endIcon={<Icon icon={Whatsapp} size="sm" colour="action-default" />}
|
|
251
|
+
variant="outlined"
|
|
252
|
+
>
|
|
253
|
+
Contact
|
|
180
254
|
</Button>
|
|
181
255
|
</View>
|
|
182
256
|
</View>
|
|
@@ -4,7 +4,7 @@ import styled from "@emotion/native"
|
|
|
4
4
|
import { useTheme } from "@emotion/react"
|
|
5
5
|
import { Typography } from "../Typography"
|
|
6
6
|
import { Spinner } from "../Spinner"
|
|
7
|
-
import { resolveFont } from "
|
|
7
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
8
8
|
|
|
9
9
|
type ButtonVariant = "filled" | "outlined" | "text"
|
|
10
10
|
type ButtonSize = "sm" | "md" | "lg"
|
|
@@ -193,6 +193,17 @@ const Button = React.forwardRef<View, ButtonProps>(
|
|
|
193
193
|
|
|
194
194
|
const variantStyles = getVariantStyles(pressed)
|
|
195
195
|
|
|
196
|
+
const renderIcon = (icon: React.ReactNode): React.ReactNode => {
|
|
197
|
+
if (!React.isValidElement(icon)) return icon
|
|
198
|
+
const iconElement = icon as React.ReactElement<any>
|
|
199
|
+
if (!pressed) {
|
|
200
|
+
return icon
|
|
201
|
+
}
|
|
202
|
+
return React.cloneElement(iconElement, {
|
|
203
|
+
customColour: variantStyles.textColor
|
|
204
|
+
})
|
|
205
|
+
}
|
|
206
|
+
|
|
196
207
|
return (
|
|
197
208
|
<StyledButton
|
|
198
209
|
ref={ref}
|
|
@@ -220,7 +231,7 @@ const Button = React.forwardRef<View, ButtonProps>(
|
|
|
220
231
|
buttonFullWidth={fullWidth}
|
|
221
232
|
{...rest}
|
|
222
233
|
>
|
|
223
|
-
{startIcon && <IconWrapper>{startIcon}</IconWrapper>}
|
|
234
|
+
{startIcon && <IconWrapper>{renderIcon(startIcon)}</IconWrapper>}
|
|
224
235
|
{/* `Typography` is a DIRECT child of the button row (no wrapping View)
|
|
225
236
|
so its `<Text>` participates in flex shrink and wraps long /
|
|
226
237
|
translated labels to multiple lines under the button's `minHeight`.
|
|
@@ -241,7 +252,7 @@ const Button = React.forwardRef<View, ButtonProps>(
|
|
|
241
252
|
>
|
|
242
253
|
{children}
|
|
243
254
|
</Typography>
|
|
244
|
-
{endIcon && <IconWrapper>{endIcon}</IconWrapper>}
|
|
255
|
+
{endIcon && <IconWrapper>{renderIcon(endIcon)}</IconWrapper>}
|
|
245
256
|
{loading && (
|
|
246
257
|
<StyledSpinnerWrapper>
|
|
247
258
|
<Spinner
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Error as ErrorIcon,
|
|
14
14
|
CheckCircle as SuccessIcon
|
|
15
15
|
} from "@butternutbox/pawprint-icons/core"
|
|
16
|
-
import { resolveFont } from "
|
|
16
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
17
17
|
import { Icon } from "../Icon"
|
|
18
18
|
|
|
19
19
|
export type InputState = "default" | "error" | "success"
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Error as ErrorIcon,
|
|
14
14
|
CheckCircle as SuccessIcon
|
|
15
15
|
} from "@butternutbox/pawprint-icons/core"
|
|
16
|
-
import { resolveFont } from "
|
|
16
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
17
17
|
import { Icon } from "../Icon"
|
|
18
18
|
import type { InputState } from "../Input/InputField"
|
|
19
19
|
|
|
@@ -3,7 +3,7 @@ import { Text, TextStyle, TextProps } from "react-native"
|
|
|
3
3
|
import { useTheme } from "@emotion/react"
|
|
4
4
|
import styled from "@emotion/native"
|
|
5
5
|
import { type BrandThemeSemanticsColourText } from "@butternutbox/pawprint-tokens"
|
|
6
|
-
import { resolveFont } from "
|
|
6
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
7
7
|
|
|
8
8
|
type BodySize = "xs" | "sm" | "md" | "lg"
|
|
9
9
|
type HeadingSize = "2xs" | "xs" | "sm" | "md" | "lg" | "xl"
|
|
@@ -3,7 +3,7 @@ import { View, Text } from "react-native"
|
|
|
3
3
|
import Animated from "react-native-reanimated"
|
|
4
4
|
import { DEFAULT_THEME_OPTIONS } from "@butternutbox/pawprint-tokens"
|
|
5
5
|
|
|
6
|
-
import { resolveFont } from "
|
|
6
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
7
7
|
|
|
8
8
|
type AndroidOptionTextProps = {
|
|
9
9
|
isSelected: boolean
|
|
@@ -4,7 +4,7 @@ import styled from "@emotion/native"
|
|
|
4
4
|
import { useTheme } from "@emotion/react"
|
|
5
5
|
import { IconButton } from "../../atoms/IconButton"
|
|
6
6
|
import { Add, Remove } from "@butternutbox/pawprint-icons/core"
|
|
7
|
-
import { resolveFont } from "
|
|
7
|
+
import { resolveFont } from "@butternutbox/pawprint-fonts"
|
|
8
8
|
import { Typography } from "../../atoms/Typography"
|
|
9
9
|
|
|
10
10
|
type NumberFieldSize = "sm" | "lg"
|
package/src/index.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { tokens } from "@butternutbox/pawprint-tokens"
|
|
|
4
4
|
|
|
5
5
|
export { default as styled } from "@emotion/native"
|
|
6
6
|
|
|
7
|
-
export * from "
|
|
7
|
+
export * from "@butternutbox/pawprint-fonts"
|
|
8
8
|
export * from "./theme"
|
|
9
9
|
export * from "./components"
|
|
10
10
|
export * from "./hooks"
|
package/tsup.config.ts
CHANGED
|
@@ -14,10 +14,9 @@ export default defineConfig({
|
|
|
14
14
|
"react-native-svg",
|
|
15
15
|
"react-native-worklets",
|
|
16
16
|
/^@rn-primitives\/.*/,
|
|
17
|
-
|
|
17
|
+
/^@butternutbox\/pawprint-fonts/
|
|
18
18
|
],
|
|
19
19
|
treeshake: true,
|
|
20
|
-
onSuccess: "cp src/fonts/*.ttf dist/",
|
|
21
20
|
esbuildOptions(options) {
|
|
22
21
|
options.conditions = ["react-native", "import", "module", "default"]
|
|
23
22
|
options.loader = {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src/fonts/index.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Brand, BrandName } from "@butternutbox/pawprint-tokens"
|
|
2
|
-
import type { FontSource } from "expo-font"
|
|
3
|
-
|
|
4
|
-
import idaNarrow500 from "./ida-narrow-500-normal.ttf"
|
|
5
|
-
import idaNarrow700 from "./ida-narrow-700-normal.ttf"
|
|
6
|
-
import ibmPlexSansCondensed400 from "./ibm-plex-sans-condensed-400-normal.ttf"
|
|
7
|
-
import ibmPlexSansCondensed500 from "./ibm-plex-sans-condensed-500-normal.ttf"
|
|
8
|
-
import ibmPlexSansCondensed600 from "./ibm-plex-sans-condensed-600-normal.ttf"
|
|
9
|
-
import ibmPlexSansCondensed700 from "./ibm-plex-sans-condensed-700-normal.ttf"
|
|
10
|
-
|
|
11
|
-
// Keys passed to useFonts — each key becomes the exact @font-face family name
|
|
12
|
-
// that expo-font registers on web, and the postscript font name on iOS/Android.
|
|
13
|
-
export const BRAND_FONTS: Partial<
|
|
14
|
-
Record<BrandName, Record<string, FontSource>>
|
|
15
|
-
> = {
|
|
16
|
-
[Brand.Butternutbox]: {
|
|
17
|
-
"IdaWebNarrow-Medium": idaNarrow500 as FontSource,
|
|
18
|
-
"IdaWebNarrow-Bold": idaNarrow700 as FontSource,
|
|
19
|
-
"IBMPlexSansCond-Regular": ibmPlexSansCondensed400 as FontSource,
|
|
20
|
-
"IBMPlexSansCond-Medium": ibmPlexSansCondensed500 as FontSource,
|
|
21
|
-
"IBMPlexSansCond-SemiBold": ibmPlexSansCondensed600 as FontSource,
|
|
22
|
-
"IBMPlexSansCond-Bold": ibmPlexSansCondensed700 as FontSource
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Maps token fontFamily + fontWeight → PostScript font name.
|
|
27
|
-
// Keys must match the PostScript name embedded in the font file — iOS registers
|
|
28
|
-
// fonts under their PostScript name regardless of the useFonts key.
|
|
29
|
-
const FONT_MAP: Record<string, Record<string, string>> = {
|
|
30
|
-
"IBM Plex Sans Condensed": {
|
|
31
|
-
"400": "IBMPlexSansCond-Regular",
|
|
32
|
-
"500": "IBMPlexSansCond-Medium",
|
|
33
|
-
"600": "IBMPlexSansCond-SemiBold",
|
|
34
|
-
"700": "IBMPlexSansCond-Bold"
|
|
35
|
-
},
|
|
36
|
-
"Ida Narrow": {
|
|
37
|
-
"500": "IdaWebNarrow-Medium",
|
|
38
|
-
"700": "IdaWebNarrow-Bold"
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const resolveFont = (
|
|
43
|
-
fontFamily: string,
|
|
44
|
-
fontWeight: string
|
|
45
|
-
): { fontFamily: string } => {
|
|
46
|
-
const resolved = FONT_MAP[fontFamily]?.[fontWeight]
|
|
47
|
-
return { fontFamily: resolved ?? fontFamily }
|
|
48
|
-
}
|
package/src/types/fonts.d.ts
DELETED