@butternutbox/pawprint-native 0.19.2 → 0.21.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 +14 -0
- package/dist/index.cjs +59 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -4
- package/dist/index.d.ts +29 -4
- package/dist/index.js +59 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Drawer/DrawerBody.tsx +17 -2
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.stories.tsx +31 -0
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.test.tsx +54 -0
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.tsx +34 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useDrawerKeyboardAvoidance.ts +29 -0
- package/src/index.ts +1 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
[34mCJS[39m Build start
|
|
8
8
|
[34mESM[39m Build start
|
|
9
9
|
[34mDTS[39m Build start
|
|
10
|
-
[
|
|
11
|
-
[32mESM[39m [1mdist/index.js.map [22m[32m1.06 MB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in 7309ms
|
|
13
|
-
[32mCJS[39m [1mdist/index.cjs [22m[32m546.81 KB[39m
|
|
10
|
+
[32mCJS[39m [1mdist/index.cjs [22m[32m548.39 KB[39m
|
|
14
11
|
[32mCJS[39m [1mdist/index.cjs.map [22m[32m1.06 MB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 8017ms
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m518.18 KB[39m
|
|
14
|
+
[32mESM[39m [1mdist/index.js.map [22m[32m1.06 MB[39m
|
|
15
|
+
[32mESM[39m ⚡️ Build success in 8017ms
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 22080ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m102.08 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m102.08 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 0.21.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d90784c: ensure drawers sit above keyboard
|
|
8
|
+
|
|
9
|
+
## 0.20.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 246e43e: `ProductDisplayCard`: add an optional `quantityBadge` prop.
|
|
14
|
+
|
|
15
|
+
When `quantityBadge` is `true`, a quantity badge (the pawprint `Badge`, `variant="primary" size="large"`) is overlaid on the top-right of the product image and renders the current `quantity`, matching Figma node `10864:736`. It defaults to `false`, so existing usages are unaffected. The badge and the quantity picker are mutually exclusive — when `quantityBadge` is set the picker is never rendered (only one is visible at a time). Intended for the OOB recipe and Extras cards.
|
|
16
|
+
|
|
3
17
|
## 0.19.2
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -6298,6 +6298,26 @@ var DrawerDescription = React66__default.default.forwardRef(
|
|
|
6298
6298
|
}
|
|
6299
6299
|
);
|
|
6300
6300
|
DrawerDescription.displayName = "Drawer.Description";
|
|
6301
|
+
var useDrawerKeyboardAvoidance = (minPadding = 16) => {
|
|
6302
|
+
const [keyboardHeight, setKeyboardHeight] = React66.useState(0);
|
|
6303
|
+
React66.useEffect(() => {
|
|
6304
|
+
const showListener = reactNative.Keyboard.addListener("keyboardDidShow", (e) => {
|
|
6305
|
+
setKeyboardHeight(e.endCoordinates.height);
|
|
6306
|
+
});
|
|
6307
|
+
const hideListener = reactNative.Keyboard.addListener("keyboardDidHide", () => {
|
|
6308
|
+
setKeyboardHeight(0);
|
|
6309
|
+
});
|
|
6310
|
+
return () => {
|
|
6311
|
+
showListener.remove();
|
|
6312
|
+
hideListener.remove();
|
|
6313
|
+
};
|
|
6314
|
+
}, []);
|
|
6315
|
+
return {
|
|
6316
|
+
contentContainerStyle: {
|
|
6317
|
+
paddingBottom: Math.max(minPadding, keyboardHeight)
|
|
6318
|
+
}
|
|
6319
|
+
};
|
|
6320
|
+
};
|
|
6301
6321
|
var parseTokenValue27 = (value) => parseFloat(value);
|
|
6302
6322
|
var StyledScrollView = styled51__default.default(reactNative.ScrollView)(
|
|
6303
6323
|
({
|
|
@@ -6319,7 +6339,15 @@ var StyledScrollView = styled51__default.default(reactNative.ScrollView)(
|
|
|
6319
6339
|
);
|
|
6320
6340
|
var DrawerBody = React66__default.default.forwardRef(
|
|
6321
6341
|
(_a, ref) => {
|
|
6322
|
-
var _b = _a, {
|
|
6342
|
+
var _b = _a, {
|
|
6343
|
+
children,
|
|
6344
|
+
contentContainerStyle,
|
|
6345
|
+
ignoreKeyboardAvoidance = false
|
|
6346
|
+
} = _b, props = __objRest(_b, [
|
|
6347
|
+
"children",
|
|
6348
|
+
"contentContainerStyle",
|
|
6349
|
+
"ignoreKeyboardAvoidance"
|
|
6350
|
+
]);
|
|
6323
6351
|
const theme2 = react.useTheme();
|
|
6324
6352
|
const { spacing } = theme2.tokens.components.drawer;
|
|
6325
6353
|
const { buttons } = theme2.tokens.components;
|
|
@@ -6329,6 +6357,8 @@ var DrawerBody = React66__default.default.forwardRef(
|
|
|
6329
6357
|
const providedMaxHeight = useDrawerBodyMax();
|
|
6330
6358
|
const { height: windowHeight } = reactNative.useWindowDimensions();
|
|
6331
6359
|
const insets = reactNativeSafeAreaContext.useSafeAreaInsets();
|
|
6360
|
+
const { contentContainerStyle: keyboardStyle } = useDrawerKeyboardAvoidance();
|
|
6361
|
+
const effectiveKeyboardStyle = ignoreKeyboardAvoidance ? {} : keyboardStyle;
|
|
6332
6362
|
const gap = parseTokenValue27(content.slot.gap);
|
|
6333
6363
|
const horizontalPadding = parseTokenValue27(content.slot.horizontalPadding);
|
|
6334
6364
|
const topPadding = parseTokenValue27(content.slot.verticalPadding);
|
|
@@ -6352,6 +6382,7 @@ var DrawerBody = React66__default.default.forwardRef(
|
|
|
6352
6382
|
paddingTop: topPadding,
|
|
6353
6383
|
paddingBottom: 0
|
|
6354
6384
|
},
|
|
6385
|
+
effectiveKeyboardStyle,
|
|
6355
6386
|
contentContainerStyle
|
|
6356
6387
|
]
|
|
6357
6388
|
}, props), {
|
|
@@ -12037,6 +12068,17 @@ var StyledImage3 = styled51__default.default(reactNative.View)(({ theme: theme2,
|
|
|
12037
12068
|
minHeight: thumbnailWidth,
|
|
12038
12069
|
position: "relative"
|
|
12039
12070
|
}));
|
|
12071
|
+
var StyledBadgeOverlay = styled51__default.default(reactNative.View)(({ theme: theme2 }) => {
|
|
12072
|
+
const offset = parseTokenValue9(
|
|
12073
|
+
theme2.tokens.semantics.dimensions.spacing["2xs"]
|
|
12074
|
+
);
|
|
12075
|
+
return {
|
|
12076
|
+
position: "absolute",
|
|
12077
|
+
top: offset,
|
|
12078
|
+
right: offset,
|
|
12079
|
+
zIndex: 2
|
|
12080
|
+
};
|
|
12081
|
+
});
|
|
12040
12082
|
var StyledContentArea = styled51__default.default(reactNative.View)(({ theme: theme2 }) => {
|
|
12041
12083
|
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
12042
12084
|
const paddingValue = parseTokenValue9(spacing.md);
|
|
@@ -12113,6 +12155,7 @@ var ProductDisplayCard = React66__default.default.forwardRef(
|
|
|
12113
12155
|
quantity = 1,
|
|
12114
12156
|
onQuantityChange,
|
|
12115
12157
|
showQuantityPicker = false,
|
|
12158
|
+
quantityBadge = false,
|
|
12116
12159
|
disableQuantityButtons = false,
|
|
12117
12160
|
hideQuantityButtons = false,
|
|
12118
12161
|
incrementDisabled = false,
|
|
@@ -12133,6 +12176,7 @@ var ProductDisplayCard = React66__default.default.forwardRef(
|
|
|
12133
12176
|
"quantity",
|
|
12134
12177
|
"onQuantityChange",
|
|
12135
12178
|
"showQuantityPicker",
|
|
12179
|
+
"quantityBadge",
|
|
12136
12180
|
"disableQuantityButtons",
|
|
12137
12181
|
"hideQuantityButtons",
|
|
12138
12182
|
"incrementDisabled",
|
|
@@ -12159,19 +12203,22 @@ var ProductDisplayCard = React66__default.default.forwardRef(
|
|
|
12159
12203
|
showBanner: showBanner && !!banner
|
|
12160
12204
|
}, rest), {
|
|
12161
12205
|
children: [
|
|
12162
|
-
image && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */ jsxRuntime.
|
|
12206
|
+
image && /* @__PURE__ */ jsxRuntime.jsx(reactNative.Pressable, { disabled: !onImagePress, onPress: onImagePress, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12163
12207
|
StyledImage3,
|
|
12164
12208
|
{
|
|
12165
12209
|
imageBackgroundColor,
|
|
12166
12210
|
thumbnailWidth,
|
|
12167
|
-
children:
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12211
|
+
children: [
|
|
12212
|
+
typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
12213
|
+
reactNative.Image,
|
|
12214
|
+
{
|
|
12215
|
+
source: { uri: image },
|
|
12216
|
+
resizeMode: "cover",
|
|
12217
|
+
style: { flex: 1, width: "100%" }
|
|
12218
|
+
}
|
|
12219
|
+
) : image,
|
|
12220
|
+
quantityBadge && /* @__PURE__ */ jsxRuntime.jsx(StyledBadgeOverlay, { pointerEvents: "none", children: /* @__PURE__ */ jsxRuntime.jsx(Badge, { variant: "primary", size: "large", children: String(quantity) }) })
|
|
12221
|
+
]
|
|
12175
12222
|
}
|
|
12176
12223
|
) }),
|
|
12177
12224
|
/* @__PURE__ */ jsxRuntime.jsxs(StyledContentArea, { children: [
|
|
@@ -12179,7 +12226,7 @@ var ProductDisplayCard = React66__default.default.forwardRef(
|
|
|
12179
12226
|
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "heading", size: "2xs", color: "primary", children: title }),
|
|
12180
12227
|
showSubtext && subtext && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", size: "sm", color: "secondary", children: subtext })
|
|
12181
12228
|
] }),
|
|
12182
|
-
showQuantityPicker && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12229
|
+
showQuantityPicker && !quantityBadge && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12183
12230
|
NumberField,
|
|
12184
12231
|
{
|
|
12185
12232
|
size: "sm",
|
|
@@ -12489,6 +12536,7 @@ exports.slideInAnimation = slideInAnimation;
|
|
|
12489
12536
|
exports.slideOutAnimation = slideOutAnimation;
|
|
12490
12537
|
exports.theme = theme;
|
|
12491
12538
|
exports.useCopyField = useCopyField;
|
|
12539
|
+
exports.useDrawerKeyboardAvoidance = useDrawerKeyboardAvoidance;
|
|
12492
12540
|
exports.usePasswordField = usePasswordField;
|
|
12493
12541
|
exports.usePawprint = usePawprint;
|
|
12494
12542
|
exports.useSearchField = useSearchField;
|