@butternutbox/pawprint-native 0.4.1 → 0.5.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +18 -0
- package/dist/index.cjs +102 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -10
- package/dist/index.d.ts +34 -10
- package/dist/index.js +102 -46
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/Countdown/Countdown.stories.tsx +35 -0
- package/src/components/molecules/Countdown/Countdown.tsx +52 -10
- package/src/components/molecules/Countdown/index.ts +5 -1
- package/src/components/molecules/Drawer/DrawerBody.tsx +29 -7
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.stories.tsx +25 -11
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.test.tsx +1 -1
- package/src/components/molecules/ProductDisplayCard/ProductDisplayCard.tsx +53 -33
- package/src/components/molecules/ProductDisplayCard/index.ts +1 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -15,16 +15,16 @@
|
|
|
15
15
|
[32mESM[39m [1mdist/ibm-plex-sans-condensed-700-normal-4PFYFTSO.woff2 [22m[32m18.90 KB[39m
|
|
16
16
|
[32mESM[39m [1mdist/index.js [22m[32m1.70 MB[39m
|
|
17
17
|
[32mESM[39m [1mdist/index.js.map [22m[32m2.65 MB[39m
|
|
18
|
-
[32mESM[39m ⚡️ Build success in
|
|
18
|
+
[32mESM[39m ⚡️ Build success in 11961ms
|
|
19
19
|
[32mCJS[39m [1mdist/ida-narrow-500-normal-C6I2PK4T.woff2 [22m[32m47.41 KB[39m
|
|
20
20
|
[32mCJS[39m [1mdist/ida-narrow-700-normal-UPHPRIN6.woff2 [22m[32m49.90 KB[39m
|
|
21
21
|
[32mCJS[39m [1mdist/ibm-plex-sans-condensed-400-normal-I2XLJNNB.woff2 [22m[32m19.33 KB[39m
|
|
22
|
+
[32mCJS[39m [1mdist/ibm-plex-sans-condensed-500-normal-IEQBNVGX.woff2 [22m[32m19.48 KB[39m
|
|
22
23
|
[32mCJS[39m [1mdist/ibm-plex-sans-condensed-600-normal-UX5ZU5T6.woff2 [22m[32m19.35 KB[39m
|
|
23
24
|
[32mCJS[39m [1mdist/ibm-plex-sans-condensed-700-normal-4PFYFTSO.woff2 [22m[32m18.90 KB[39m
|
|
24
|
-
[32mCJS[39m [1mdist/ibm-plex-sans-condensed-500-normal-IEQBNVGX.woff2 [22m[32m19.48 KB[39m
|
|
25
25
|
[32mCJS[39m [1mdist/index.cjs [22m[32m1.77 MB[39m
|
|
26
26
|
[32mCJS[39m [1mdist/index.cjs.map [22m[32m2.65 MB[39m
|
|
27
|
-
[32mCJS[39m ⚡️ Build success in
|
|
28
|
-
[32mDTS[39m ⚡️ Build success in
|
|
29
|
-
[32mDTS[39m [1mdist/index.d.cts [22m[
|
|
30
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
27
|
+
[32mCJS[39m ⚡️ Build success in 11962ms
|
|
28
|
+
[32mDTS[39m ⚡️ Build success in 22770ms
|
|
29
|
+
[32mDTS[39m [1mdist/index.d.cts [22m[32m88.44 KB[39m
|
|
30
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m88.44 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @butternutbox/pawprint-native
|
|
2
2
|
|
|
3
|
+
## 0.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4e3a96a: fix drawer layour for mobile devices'
|
|
8
|
+
|
|
9
|
+
## 0.5.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 8d7fa63: Countdown unit labels are now configurable via a new `labels` prop, so consumers can pass translated strings. Each unit (`days`/`hours`/`minutes`/`seconds`) accepts either a plain string or a `{ singular, plural }` pair that resolves against the unit's value. Omitted units fall back to the English defaults.
|
|
14
|
+
|
|
15
|
+
Note: the default labels are now pluralised, so a unit value of exactly `1` renders the singular form (e.g. `hours={1}` shows "hr" instead of "hrs").
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- a48558b: Product Display card spacing changes
|
|
20
|
+
|
|
3
21
|
## 0.4.1
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -8789,6 +8789,7 @@ DrawerOverlay.displayName = "Drawer.Overlay";
|
|
|
8789
8789
|
var DrawerDragContext = React60__default.default.createContext(null);
|
|
8790
8790
|
var useDrawerDragContext = () => React60__default.default.useContext(DrawerDragContext);
|
|
8791
8791
|
var DrawerFooterContext = React60__default.default.createContext(false);
|
|
8792
|
+
var useDrawerFooterContext = () => React60__default.default.useContext(DrawerFooterContext);
|
|
8792
8793
|
var DrawerHeaderContext = React60__default.default.createContext(null);
|
|
8793
8794
|
var useDrawerHeaderContext = () => React60__default.default.useContext(DrawerHeaderContext);
|
|
8794
8795
|
var OPEN_DURATION = 320;
|
|
@@ -9315,12 +9316,22 @@ var DrawerDescription = React60__default.default.forwardRef(
|
|
|
9315
9316
|
);
|
|
9316
9317
|
DrawerDescription.displayName = "Drawer.Description";
|
|
9317
9318
|
var parseTokenValue26 = (value) => parseFloat(value);
|
|
9318
|
-
var StyledScrollView = styled60__default.default(reactNative.ScrollView)(
|
|
9319
|
-
|
|
9320
|
-
|
|
9321
|
-
|
|
9322
|
-
|
|
9323
|
-
|
|
9319
|
+
var StyledScrollView = styled60__default.default(reactNative.ScrollView)(
|
|
9320
|
+
({
|
|
9321
|
+
bodyPaddingHorizontal,
|
|
9322
|
+
bodyPaddingRight,
|
|
9323
|
+
bodyGap,
|
|
9324
|
+
bodyMaxHeight,
|
|
9325
|
+
bodyPaddingBottom
|
|
9326
|
+
}) => ({
|
|
9327
|
+
flex: 1,
|
|
9328
|
+
paddingLeft: bodyPaddingHorizontal,
|
|
9329
|
+
paddingRight: bodyPaddingRight,
|
|
9330
|
+
gap: bodyGap,
|
|
9331
|
+
maxHeight: bodyMaxHeight,
|
|
9332
|
+
paddingBottom: bodyPaddingBottom
|
|
9333
|
+
})
|
|
9334
|
+
);
|
|
9324
9335
|
var DrawerBody = React60__default.default.forwardRef(
|
|
9325
9336
|
(_a, ref) => {
|
|
9326
9337
|
var _b = _a, { children, contentContainerStyle } = _b, props = __objRest(_b, ["children", "contentContainerStyle"]);
|
|
@@ -9329,10 +9340,14 @@ var DrawerBody = React60__default.default.forwardRef(
|
|
|
9329
9340
|
const { buttons } = theme2.tokens.components;
|
|
9330
9341
|
const { content } = spacing;
|
|
9331
9342
|
const headerContext = useDrawerHeaderContext();
|
|
9343
|
+
const footerContext = useDrawerFooterContext();
|
|
9344
|
+
const { height: windowHeight } = reactNative.useWindowDimensions();
|
|
9332
9345
|
const gap = parseTokenValue26(content.slot.gap);
|
|
9333
9346
|
const horizontalPadding = parseTokenValue26(content.slot.horizontalPadding);
|
|
9334
9347
|
const topPadding = parseTokenValue26(content.slot.verticalPadding);
|
|
9348
|
+
const bodyMaxHeight = windowHeight - 300;
|
|
9335
9349
|
const paddingRight = headerContext === null ? parseTokenValue26(spacing.close.right.md) + parseTokenValue26(buttons.size.sm.height) : horizontalPadding;
|
|
9350
|
+
const bodyPaddingBottom = !footerContext ? parseTokenValue26(theme2.tokens.semantics.dimensions.spacing["2xl"]) : 0;
|
|
9336
9351
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9337
9352
|
StyledScrollView,
|
|
9338
9353
|
__spreadProps(__spreadValues({
|
|
@@ -9340,6 +9355,8 @@ var DrawerBody = React60__default.default.forwardRef(
|
|
|
9340
9355
|
bodyPaddingHorizontal: horizontalPadding,
|
|
9341
9356
|
bodyPaddingRight: paddingRight,
|
|
9342
9357
|
bodyGap: gap,
|
|
9358
|
+
bodyMaxHeight,
|
|
9359
|
+
bodyPaddingBottom,
|
|
9343
9360
|
contentContainerStyle: [
|
|
9344
9361
|
{
|
|
9345
9362
|
gap,
|
|
@@ -13683,12 +13700,13 @@ var PictureSelector = React60__default.default.forwardRef(
|
|
|
13683
13700
|
}
|
|
13684
13701
|
);
|
|
13685
13702
|
PictureSelector.displayName = "PictureSelector";
|
|
13686
|
-
var
|
|
13687
|
-
days: "days",
|
|
13688
|
-
hours: "hrs",
|
|
13689
|
-
minutes: "min",
|
|
13690
|
-
seconds: "secs"
|
|
13703
|
+
var DEFAULT_UNIT_LABELS = {
|
|
13704
|
+
days: { singular: "day", plural: "days" },
|
|
13705
|
+
hours: { singular: "hr", plural: "hrs" },
|
|
13706
|
+
minutes: { singular: "min", plural: "min" },
|
|
13707
|
+
seconds: { singular: "sec", plural: "secs" }
|
|
13691
13708
|
};
|
|
13709
|
+
var resolveLabel = (label, value) => typeof label === "string" ? label : value === 1 ? label.singular : label.plural;
|
|
13692
13710
|
var parseTokenValue54 = (value) => parseFloat(value);
|
|
13693
13711
|
var pad = (value) => String(Math.max(0, Math.floor(value))).padStart(2, "0");
|
|
13694
13712
|
var StackedRoot = styled60__default.default(reactNative.View)(({ rootGap }) => ({
|
|
@@ -13766,7 +13784,8 @@ var Countdown = React60__default.default.forwardRef(
|
|
|
13766
13784
|
seconds = 0,
|
|
13767
13785
|
showDays = true,
|
|
13768
13786
|
showSeconds = true,
|
|
13769
|
-
label
|
|
13787
|
+
label,
|
|
13788
|
+
labels
|
|
13770
13789
|
} = _b, rest = __objRest(_b, [
|
|
13771
13790
|
"layout",
|
|
13772
13791
|
"days",
|
|
@@ -13775,23 +13794,33 @@ var Countdown = React60__default.default.forwardRef(
|
|
|
13775
13794
|
"seconds",
|
|
13776
13795
|
"showDays",
|
|
13777
13796
|
"showSeconds",
|
|
13778
|
-
"label"
|
|
13797
|
+
"label",
|
|
13798
|
+
"labels"
|
|
13779
13799
|
]);
|
|
13780
13800
|
const theme2 = react.useTheme();
|
|
13781
13801
|
const { countdown } = theme2.tokens.components;
|
|
13782
13802
|
const { countdownItem } = countdown;
|
|
13803
|
+
const unitLabels = __spreadValues(__spreadValues({}, DEFAULT_UNIT_LABELS), labels);
|
|
13783
13804
|
const units = [
|
|
13784
13805
|
showDays && {
|
|
13785
13806
|
key: "days",
|
|
13786
13807
|
value: days,
|
|
13787
|
-
label:
|
|
13808
|
+
label: resolveLabel(unitLabels.days, days)
|
|
13809
|
+
},
|
|
13810
|
+
{
|
|
13811
|
+
key: "hours",
|
|
13812
|
+
value: hours,
|
|
13813
|
+
label: resolveLabel(unitLabels.hours, hours)
|
|
13814
|
+
},
|
|
13815
|
+
{
|
|
13816
|
+
key: "minutes",
|
|
13817
|
+
value: minutes,
|
|
13818
|
+
label: resolveLabel(unitLabels.minutes, minutes)
|
|
13788
13819
|
},
|
|
13789
|
-
{ key: "hours", value: hours, label: UNIT_LABELS.hours },
|
|
13790
|
-
{ key: "minutes", value: minutes, label: UNIT_LABELS.minutes },
|
|
13791
13820
|
showSeconds && {
|
|
13792
13821
|
key: "seconds",
|
|
13793
13822
|
value: seconds,
|
|
13794
|
-
label:
|
|
13823
|
+
label: resolveLabel(unitLabels.seconds, seconds)
|
|
13795
13824
|
}
|
|
13796
13825
|
].filter(Boolean);
|
|
13797
13826
|
const colon = (key) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -14165,36 +14194,47 @@ var ProductListingCardWithBadgeAndGrid = Object.assign(_ProductListingCard, {
|
|
|
14165
14194
|
Badge: Badge2,
|
|
14166
14195
|
Grid
|
|
14167
14196
|
});
|
|
14168
|
-
var StyledCardContainer = styled60__default.default(reactNative.View)(({
|
|
14197
|
+
var StyledCardContainer = styled60__default.default(reactNative.View)(({
|
|
14198
|
+
theme: theme2,
|
|
14199
|
+
borderless
|
|
14200
|
+
}) => {
|
|
14169
14201
|
const { spacing, borderRadius } = theme2.tokens.semantics.dimensions;
|
|
14170
14202
|
const { colour } = theme2.tokens.semantics;
|
|
14171
14203
|
const spacingMd = parseTokenValue8(spacing.md);
|
|
14172
14204
|
const spacingXl = parseTokenValue8(spacing.xl);
|
|
14173
|
-
return {
|
|
14205
|
+
return __spreadProps(__spreadValues({
|
|
14174
14206
|
flexDirection: "row",
|
|
14175
14207
|
width: "100%",
|
|
14176
|
-
height: "100%",
|
|
14208
|
+
height: borderless ? void 0 : "100%",
|
|
14177
14209
|
maxHeight: spacingXl * 6 + spacingMd,
|
|
14178
|
-
backgroundColor: colour.background.surface.default
|
|
14210
|
+
backgroundColor: colour.background.surface.default
|
|
14211
|
+
}, borderless ? {} : {
|
|
14179
14212
|
borderWidth: 1,
|
|
14180
14213
|
borderColor: colour.border.default,
|
|
14181
|
-
borderRadius: parseTokenValue8(borderRadius.md),
|
|
14182
|
-
overflow: "hidden",
|
|
14183
14214
|
shadowColor: "#522a10",
|
|
14184
14215
|
shadowOffset: { width: 0, height: spacingMd / 4 },
|
|
14185
14216
|
shadowOpacity: 0.05,
|
|
14186
14217
|
shadowRadius: spacingXl - 4,
|
|
14187
|
-
elevation: 5
|
|
14218
|
+
elevation: 5
|
|
14219
|
+
}), {
|
|
14220
|
+
borderRadius: parseTokenValue8(borderRadius.md),
|
|
14221
|
+
overflow: "hidden",
|
|
14188
14222
|
zIndex: 1
|
|
14189
|
-
};
|
|
14223
|
+
});
|
|
14190
14224
|
});
|
|
14191
14225
|
var StyledImage3 = styled60__default.default(reactNative.View)(
|
|
14192
|
-
({
|
|
14226
|
+
({
|
|
14227
|
+
theme: theme2,
|
|
14228
|
+
imageBackgroundColor,
|
|
14229
|
+
thumbnailWidth = 100,
|
|
14230
|
+
thumbnailBackgroundColor
|
|
14231
|
+
}) => ({
|
|
14193
14232
|
flexShrink: 0,
|
|
14194
|
-
backgroundColor: imageBackgroundColor || theme2.tokens.semantics.colour.background.container.secondary,
|
|
14233
|
+
backgroundColor: thumbnailBackgroundColor || imageBackgroundColor || theme2.tokens.semantics.colour.background.container.secondary,
|
|
14195
14234
|
overflow: "hidden",
|
|
14196
14235
|
aspectRatio: "1 / 1",
|
|
14197
|
-
|
|
14236
|
+
width: thumbnailWidth,
|
|
14237
|
+
height: thumbnailWidth,
|
|
14198
14238
|
position: "relative"
|
|
14199
14239
|
})
|
|
14200
14240
|
);
|
|
@@ -14216,12 +14256,16 @@ var StyledQuantityBadge = styled60__default.default(reactNative.View)(({ theme:
|
|
|
14216
14256
|
zIndex: 2
|
|
14217
14257
|
};
|
|
14218
14258
|
});
|
|
14219
|
-
var StyledContentArea = styled60__default.default(reactNative.View)(({
|
|
14259
|
+
var StyledContentArea = styled60__default.default(reactNative.View)(({
|
|
14260
|
+
theme: theme2,
|
|
14261
|
+
borderless
|
|
14262
|
+
}) => {
|
|
14220
14263
|
const { spacing } = theme2.tokens.semantics.dimensions;
|
|
14264
|
+
const paddingValue = parseTokenValue8(spacing.md);
|
|
14221
14265
|
return {
|
|
14222
14266
|
flex: 1,
|
|
14223
|
-
paddingHorizontal:
|
|
14224
|
-
paddingVertical:
|
|
14267
|
+
paddingHorizontal: paddingValue,
|
|
14268
|
+
paddingVertical: borderless ? 0 : paddingValue,
|
|
14225
14269
|
gap: parseTokenValue8(spacing.xs),
|
|
14226
14270
|
justifyContent: "space-between"
|
|
14227
14271
|
};
|
|
@@ -14253,7 +14297,6 @@ var StyledNotification = styled60__default.default(Notification)(({ theme: theme
|
|
|
14253
14297
|
var ProductDisplayCard = React60__default.default.forwardRef(
|
|
14254
14298
|
(_a, ref) => {
|
|
14255
14299
|
var _b = _a, {
|
|
14256
|
-
device = "mobile",
|
|
14257
14300
|
title,
|
|
14258
14301
|
subtext,
|
|
14259
14302
|
showSubtext = true,
|
|
@@ -14268,13 +14311,15 @@ var ProductDisplayCard = React60__default.default.forwardRef(
|
|
|
14268
14311
|
decrementDisabled = false,
|
|
14269
14312
|
image,
|
|
14270
14313
|
imageBackgroundColor,
|
|
14314
|
+
thumbnailWidth,
|
|
14315
|
+
thumbnailBackgroundColor,
|
|
14271
14316
|
showImageQuantityBadge = false,
|
|
14317
|
+
borderless = false,
|
|
14272
14318
|
banner,
|
|
14273
14319
|
showBanner = false,
|
|
14274
14320
|
bannerType = "info",
|
|
14275
14321
|
showBannerIcon = false
|
|
14276
14322
|
} = _b, rest = __objRest(_b, [
|
|
14277
|
-
"device",
|
|
14278
14323
|
"title",
|
|
14279
14324
|
"subtext",
|
|
14280
14325
|
"showSubtext",
|
|
@@ -14289,7 +14334,10 @@ var ProductDisplayCard = React60__default.default.forwardRef(
|
|
|
14289
14334
|
"decrementDisabled",
|
|
14290
14335
|
"image",
|
|
14291
14336
|
"imageBackgroundColor",
|
|
14337
|
+
"thumbnailWidth",
|
|
14338
|
+
"thumbnailBackgroundColor",
|
|
14292
14339
|
"showImageQuantityBadge",
|
|
14340
|
+
"borderless",
|
|
14293
14341
|
"banner",
|
|
14294
14342
|
"showBanner",
|
|
14295
14343
|
"bannerType",
|
|
@@ -14300,20 +14348,28 @@ var ProductDisplayCard = React60__default.default.forwardRef(
|
|
|
14300
14348
|
onQuantityChange == null ? void 0 : onQuantityChange(newQuantity);
|
|
14301
14349
|
}
|
|
14302
14350
|
};
|
|
14303
|
-
const cardContent = /* @__PURE__ */ jsxRuntime.jsxs(StyledCardContainer, __spreadProps(__spreadValues({ ref,
|
|
14304
|
-
image && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14305
|
-
|
|
14306
|
-
|
|
14307
|
-
|
|
14308
|
-
|
|
14309
|
-
|
|
14310
|
-
|
|
14311
|
-
|
|
14312
|
-
|
|
14313
|
-
|
|
14314
|
-
|
|
14351
|
+
const cardContent = /* @__PURE__ */ jsxRuntime.jsxs(StyledCardContainer, __spreadProps(__spreadValues({ ref, borderless }, rest), { children: [
|
|
14352
|
+
image && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14353
|
+
StyledImage3,
|
|
14354
|
+
{
|
|
14355
|
+
imageBackgroundColor,
|
|
14356
|
+
thumbnailWidth,
|
|
14357
|
+
thumbnailBackgroundColor,
|
|
14358
|
+
children: [
|
|
14359
|
+
typeof image === "string" ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
14360
|
+
reactNative.Image,
|
|
14361
|
+
{
|
|
14362
|
+
source: { uri: image },
|
|
14363
|
+
style: { width: "100%", height: "100%" }
|
|
14364
|
+
}
|
|
14365
|
+
) : image,
|
|
14366
|
+
showImageQuantityBadge && quantity && /* @__PURE__ */ jsxRuntime.jsx(StyledQuantityBadge, { children: /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", size: "sm", weight: "bold", children: quantity }) })
|
|
14367
|
+
]
|
|
14368
|
+
}
|
|
14369
|
+
),
|
|
14370
|
+
/* @__PURE__ */ jsxRuntime.jsxs(StyledContentArea, { borderless, children: [
|
|
14315
14371
|
/* @__PURE__ */ jsxRuntime.jsxs(StyledTextContainer, { children: [
|
|
14316
|
-
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "heading", size: "
|
|
14372
|
+
/* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "heading", size: "2xs", color: "primary", children: title }),
|
|
14317
14373
|
showSubtext && subtext && /* @__PURE__ */ jsxRuntime.jsx(Typography, { variant: "body", size: "sm", color: "secondary", children: subtext })
|
|
14318
14374
|
] }),
|
|
14319
14375
|
showQuantityPicker && /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsxRuntime.jsx(
|