@butternutbox/pawprint-native 0.23.3 → 0.24.2

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
- CJS dist/index.cjs 552.50 KB
11
- CJS dist/index.cjs.map 1.07 MB
12
- CJS ⚡️ Build success in 8360ms
13
- ESM dist/index.js 522.10 KB
14
- ESM dist/index.js.map 1.07 MB
15
- ESM ⚡️ Build success in 8360ms
16
- DTS ⚡️ Build success in 23889ms
17
- DTS dist/index.d.cts 102.54 KB
18
- DTS dist/index.d.ts 102.54 KB
10
+ CJS dist/index.cjs 554.62 KB
11
+ CJS dist/index.cjs.map 1.08 MB
12
+ CJS ⚡️ Build success in 7560ms
13
+ ESM dist/index.js 523.98 KB
14
+ ESM dist/index.js.map 1.08 MB
15
+ ESM ⚡️ Build success in 7564ms
16
+ DTS ⚡️ Build success in 22152ms
17
+ DTS dist/index.d.cts 103.19 KB
18
+ DTS dist/index.d.ts 103.19 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @butternutbox/pawprint-native
2
2
 
3
+ ## 0.24.2
4
+
5
+ ### Patch Changes
6
+
7
+ - f0bb467: add step count to product card quantity changer
8
+
9
+ ## 0.24.1
10
+
11
+ ### Patch Changes
12
+
13
+ - d75e132: Fix two `StackedNotifications` animation glitches: dismissing from a deep queue would briefly show only one peek before the next popped in, and a brand-new notification would jump into place instead of sliding and fading in smoothly.
14
+
15
+ ## 0.24.0
16
+
17
+ ### Minor Changes
18
+
19
+ - 85a6f8e: `Progress` now eases its indicator to the new width instead of snapping to it. Add `animate={false}` to opt out; the animation is also skipped when the OS has reduced motion enabled. The timing is exported as `PROGRESS_ANIMATION` so anything overlaid on the track can stay pinned to the leading edge of the fill.
20
+
3
21
  ## 0.23.3
4
22
 
5
23
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -7901,6 +7901,10 @@ function usePasswordField({
7901
7901
  showRequirements
7902
7902
  });
7903
7903
  }
7904
+ var PROGRESS_ANIMATION = {
7905
+ duration: 450,
7906
+ easing: Animated10.Easing.inOut(Animated10.Easing.cubic)
7907
+ };
7904
7908
  var parseTokenValue40 = (value) => parseFloat(value);
7905
7909
  var StyledRoot12 = styled51__default.default(reactNative.View)(({ rootGap }) => ({
7906
7910
  flexDirection: "column",
@@ -7923,7 +7927,7 @@ var StyledTrack = styled51__default.default(reactNative.View)(({ trackHeight, tr
7923
7927
  backgroundColor: trackBgColor,
7924
7928
  overflow: "hidden"
7925
7929
  }));
7926
- var StyledIndicator = styled51__default.default(reactNative.View)(({ indicatorBorderRadius, indicatorBgColor }) => ({
7930
+ var StyledIndicator = styled51__default.default(Animated10__default.default.View)(({ indicatorBorderRadius, indicatorBgColor }) => ({
7927
7931
  height: "100%",
7928
7932
  borderRadius: indicatorBorderRadius,
7929
7933
  backgroundColor: indicatorBgColor
@@ -7938,7 +7942,8 @@ var Progress = React66__default.default.forwardRef(
7938
7942
  colour = "primary",
7939
7943
  label,
7940
7944
  description,
7941
- getValueLabel
7945
+ getValueLabel,
7946
+ animate = true
7942
7947
  } = _b, rest = __objRest(_b, [
7943
7948
  "value",
7944
7949
  "max",
@@ -7946,7 +7951,8 @@ var Progress = React66__default.default.forwardRef(
7946
7951
  "colour",
7947
7952
  "label",
7948
7953
  "description",
7949
- "getValueLabel"
7954
+ "getValueLabel",
7955
+ "animate"
7950
7956
  ]);
7951
7957
  const theme2 = react.useTheme();
7952
7958
  const {
@@ -7962,6 +7968,15 @@ var Progress = React66__default.default.forwardRef(
7962
7968
  const percent = clampedValue / safeMax * 100;
7963
7969
  const showHeader = Boolean(label) || Boolean(description);
7964
7970
  const typographyForSize = size === "lg" ? typography.large : typography.small;
7971
+ const reducedMotion = Animated10.useReducedMotion();
7972
+ const shouldAnimate = animate && !reducedMotion;
7973
+ const fill = Animated10.useSharedValue(percent);
7974
+ React66__default.default.useEffect(() => {
7975
+ fill.value = shouldAnimate ? Animated10.withTiming(percent, PROGRESS_ANIMATION) : percent;
7976
+ }, [fill, percent, shouldAnimate]);
7977
+ const indicatorStyle = Animated10.useAnimatedStyle(() => ({
7978
+ width: `${fill.value}%`
7979
+ }));
7965
7980
  const trackSize = { lg: track.size.large, sm: track.size.small }[size];
7966
7981
  const trackHeight = parseTokenValue40(trackSize.height);
7967
7982
  const trackMinWidth = parseTokenValue40(trackSize.mindWidth);
@@ -8008,7 +8023,7 @@ var Progress = React66__default.default.forwardRef(
8008
8023
  {
8009
8024
  indicatorBorderRadius,
8010
8025
  indicatorBgColor,
8011
- style: { width: `${percent}%` }
8026
+ style: indicatorStyle
8012
8027
  }
8013
8028
  ) })
8014
8029
  }
@@ -10271,8 +10286,11 @@ var CARD_BASE_STYLE = {
10271
10286
  position: "absolute",
10272
10287
  bottom: 0,
10273
10288
  left: 0,
10274
- right: 0,
10275
- transformOrigin: "50% 100%"
10289
+ right: 0
10290
+ };
10291
+ var DEPTH_LAYER_STYLE = {
10292
+ transformOrigin: "50% 100%",
10293
+ width: "100%"
10276
10294
  };
10277
10295
  var StyledRoot15 = styled51__default.default(reactNative.View)(({ rootBottom, rootPaddingH }) => ({
10278
10296
  position: "absolute",
@@ -10286,17 +10304,34 @@ var StyledStack = styled51__default.default(reactNative.View)({
10286
10304
  position: "relative",
10287
10305
  width: "100%"
10288
10306
  });
10307
+ var computeBackfillIds = (layers, prevActiveIds, prevLayerIds) => {
10308
+ const ids = /* @__PURE__ */ new Set();
10309
+ layers.forEach((item) => {
10310
+ if (prevActiveIds.has(item.id) && !prevLayerIds.has(item.id)) {
10311
+ ids.add(item.id);
10312
+ }
10313
+ });
10314
+ return ids;
10315
+ };
10289
10316
  var StackedCard = ({
10290
10317
  item,
10291
10318
  depth,
10292
10319
  revealStep,
10293
- onDismiss
10320
+ onDismiss,
10321
+ isBackfill
10294
10322
  }) => {
10295
- const depthSV = Animated10.useSharedValue(depth);
10323
+ const isBackfillRef = React66__default.default.useRef(isBackfill);
10324
+ const wasBackfill = isBackfillRef.current;
10325
+ const depthSV = Animated10.useSharedValue(wasBackfill ? depth + 1 : depth);
10326
+ const opacitySV = Animated10.useSharedValue(wasBackfill ? 0 : 1);
10296
10327
  React66__default.default.useEffect(() => {
10297
10328
  depthSV.value = Animated10.withSpring(depth, SPRING_CONFIG);
10298
10329
  }, [depth, depthSV]);
10299
- const animatedStyle = Animated10.useAnimatedStyle(() => ({
10330
+ React66__default.default.useEffect(() => {
10331
+ if (wasBackfill) opacitySV.value = Animated10.withSpring(1, SPRING_CONFIG);
10332
+ }, []);
10333
+ const depthStyle = Animated10.useAnimatedStyle(() => ({
10334
+ opacity: opacitySV.value,
10300
10335
  transform: [
10301
10336
  { translateY: depthSV.value * revealStep },
10302
10337
  { scale: 1 - depthSV.value * SCALE_STEP }
@@ -10306,13 +10341,13 @@ var StackedCard = ({
10306
10341
  return /* @__PURE__ */ jsxRuntime.jsx(
10307
10342
  Animated10__default.default.View,
10308
10343
  {
10309
- entering: CARD_ENTERING,
10344
+ entering: wasBackfill ? void 0 : CARD_ENTERING,
10310
10345
  exiting: CARD_EXITING,
10311
10346
  pointerEvents: isFront ? "auto" : "none",
10312
10347
  accessibilityElementsHidden: !isFront,
10313
10348
  importantForAccessibility: isFront ? "auto" : "no-hide-descendants",
10314
- style: [CARD_BASE_STYLE, { zIndex: -depth }, animatedStyle],
10315
- children: /* @__PURE__ */ jsxRuntime.jsx(
10349
+ style: [CARD_BASE_STYLE, { zIndex: -depth }],
10350
+ children: /* @__PURE__ */ jsxRuntime.jsx(Animated10__default.default.View, { style: [DEPTH_LAYER_STYLE, depthStyle], children: /* @__PURE__ */ jsxRuntime.jsx(
10316
10351
  Notification,
10317
10352
  {
10318
10353
  variant: "toast",
@@ -10320,7 +10355,7 @@ var StackedCard = ({
10320
10355
  onClose: isFront ? () => onDismiss == null ? void 0 : onDismiss(item.id) : void 0,
10321
10356
  children: item.message
10322
10357
  }
10323
- )
10358
+ ) })
10324
10359
  }
10325
10360
  );
10326
10361
  };
@@ -10351,6 +10386,20 @@ var StackedNotifications = React66__default.default.forwardRef((_a, ref) => {
10351
10386
  () => activeItems.slice(-3).reverse(),
10352
10387
  [activeItems]
10353
10388
  );
10389
+ const prevActiveIdsRef = React66__default.default.useRef(/* @__PURE__ */ new Set());
10390
+ const prevLayerIdsRef = React66__default.default.useRef(/* @__PURE__ */ new Set());
10391
+ const backfillIds = React66__default.default.useMemo(
10392
+ () => computeBackfillIds(
10393
+ layers,
10394
+ prevActiveIdsRef.current,
10395
+ prevLayerIdsRef.current
10396
+ ),
10397
+ [layers]
10398
+ );
10399
+ React66__default.default.useEffect(() => {
10400
+ prevActiveIdsRef.current = new Set(activeItems.map((item) => item.id));
10401
+ prevLayerIdsRef.current = new Set(layers.map((item) => item.id));
10402
+ }, [activeItems, layers]);
10354
10403
  const handleDismiss = (id) => {
10355
10404
  setDismissed((prev) => {
10356
10405
  const next = new Set(prev);
@@ -10375,7 +10424,8 @@ var StackedNotifications = React66__default.default.forwardRef((_a, ref) => {
10375
10424
  item,
10376
10425
  depth,
10377
10426
  revealStep: peekStep,
10378
- onDismiss: handleDismiss
10427
+ onDismiss: handleDismiss,
10428
+ isBackfill: backfillIds.has(item.id)
10379
10429
  },
10380
10430
  item.id
10381
10431
  )) })
@@ -12236,6 +12286,7 @@ var ProductDisplayCard = React66__default.default.forwardRef(
12236
12286
  incrementDisabled = false,
12237
12287
  decrementDisabled = false,
12238
12288
  minQuantity = 1,
12289
+ quantityStep = 1,
12239
12290
  image,
12240
12291
  imageBackgroundColor,
12241
12292
  thumbnailWidth,
@@ -12257,6 +12308,7 @@ var ProductDisplayCard = React66__default.default.forwardRef(
12257
12308
  "incrementDisabled",
12258
12309
  "decrementDisabled",
12259
12310
  "minQuantity",
12311
+ "quantityStep",
12260
12312
  "image",
12261
12313
  "imageBackgroundColor",
12262
12314
  "thumbnailWidth",
@@ -12312,8 +12364,8 @@ var ProductDisplayCard = React66__default.default.forwardRef(
12312
12364
  handleQuantityChange(value);
12313
12365
  }
12314
12366
  },
12315
- onIncrement: () => handleQuantityChange(quantity + 1),
12316
- onDecrement: () => handleQuantityChange(quantity - 1),
12367
+ onIncrement: () => handleQuantityChange(quantity + quantityStep),
12368
+ onDecrement: () => handleQuantityChange(quantity - quantityStep),
12317
12369
  min: minQuantity,
12318
12370
  accessible: true,
12319
12371
  accessibilityLabel: `Quantity: ${quantity}`,
@@ -12572,6 +12624,7 @@ exports.Notification = Notification;
12572
12624
  exports.NumberField = NumberField;
12573
12625
  exports.NumberInput = NumberInput;
12574
12626
  exports.NumberInputField = NumberInputField;
12627
+ exports.PROGRESS_ANIMATION = PROGRESS_ANIMATION;
12575
12628
  exports.PasswordField = PasswordField;
12576
12629
  exports.PasswordFieldInput = PasswordFieldInput;
12577
12630
  exports.PasswordFieldRequirements = PasswordFieldRequirements;