@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.
@@ -7,12 +7,12 @@
7
7
  CJS Build start
8
8
  ESM Build start
9
9
  DTS Build start
10
- ESM dist/index.js 516.72 KB
11
- ESM dist/index.js.map 1.06 MB
12
- ESM ⚡️ Build success in 7309ms
13
- CJS dist/index.cjs 546.81 KB
10
+ CJS dist/index.cjs 548.39 KB
14
11
  CJS dist/index.cjs.map 1.06 MB
15
- CJS ⚡️ Build success in 7309ms
16
- DTS ⚡️ Build success in 21698ms
17
- DTS dist/index.d.cts 100.86 KB
18
- DTS dist/index.d.ts 100.86 KB
12
+ CJS ⚡️ Build success in 8017ms
13
+ ESM dist/index.js 518.18 KB
14
+ ESM dist/index.js.map 1.06 MB
15
+ ESM ⚡️ Build success in 8017ms
16
+ DTS ⚡️ Build success in 22080ms
17
+ DTS dist/index.d.cts 102.08 KB
18
+ DTS dist/index.d.ts 102.08 KB
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, { children, contentContainerStyle } = _b, props = __objRest(_b, ["children", "contentContainerStyle"]);
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.jsx(
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: typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
12168
- reactNative.Image,
12169
- {
12170
- source: { uri: image },
12171
- resizeMode: "cover",
12172
- style: { flex: 1, width: "100%" }
12173
- }
12174
- ) : image
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;