@butternutbox/pawprint-native 0.12.0 → 0.13.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/dist/index.d.cts CHANGED
@@ -1055,6 +1055,12 @@ type CheckboxOwnProps = {
1055
1055
  disabled?: boolean;
1056
1056
  name?: string;
1057
1057
  value?: string;
1058
+ /**
1059
+ * Tile only: hug the content width instead of filling the container, so tiles
1060
+ * can sit side by side and wrap. Set automatically by a horizontal
1061
+ * `CheckboxGroup`; rarely needs setting by hand.
1062
+ */
1063
+ fitContent?: boolean;
1058
1064
  };
1059
1065
  type CheckboxProps = CheckboxOwnProps & Omit<PressableProps, keyof CheckboxOwnProps | "children">;
1060
1066
  /**
@@ -1083,12 +1089,16 @@ type CheckboxGroupProps = CheckboxGroupOwnProps & Omit<ViewProps, keyof Checkbox
1083
1089
  /**
1084
1090
  * CheckboxGroup manages layout for a collection of Checkboxes.
1085
1091
  *
1092
+ * A `horizontal` group lays its tiles out in a wrapping row and makes them hug
1093
+ * their content (via each Checkbox's `fitContent`) so they sit side by side;
1094
+ * a `vertical` group stacks full-width tiles.
1095
+ *
1086
1096
  * @param {"horizontal" | "vertical"} [orientation="vertical"] - Layout direction.
1087
1097
  *
1088
1098
  * @example
1089
- * <CheckboxGroup>
1090
- * <Checkbox label="Chicken" />
1091
- * <Checkbox label="Beef" />
1099
+ * <CheckboxGroup orientation="horizontal">
1100
+ * <Checkbox variant="tile" label="Chicken" />
1101
+ * <Checkbox variant="tile" label="Beef" />
1092
1102
  * </CheckboxGroup>
1093
1103
  */
1094
1104
  declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupOwnProps & Omit<ViewProps, keyof CheckboxGroupOwnProps> & React.RefAttributes<View>>;
package/dist/index.d.ts CHANGED
@@ -1055,6 +1055,12 @@ type CheckboxOwnProps = {
1055
1055
  disabled?: boolean;
1056
1056
  name?: string;
1057
1057
  value?: string;
1058
+ /**
1059
+ * Tile only: hug the content width instead of filling the container, so tiles
1060
+ * can sit side by side and wrap. Set automatically by a horizontal
1061
+ * `CheckboxGroup`; rarely needs setting by hand.
1062
+ */
1063
+ fitContent?: boolean;
1058
1064
  };
1059
1065
  type CheckboxProps = CheckboxOwnProps & Omit<PressableProps, keyof CheckboxOwnProps | "children">;
1060
1066
  /**
@@ -1083,12 +1089,16 @@ type CheckboxGroupProps = CheckboxGroupOwnProps & Omit<ViewProps, keyof Checkbox
1083
1089
  /**
1084
1090
  * CheckboxGroup manages layout for a collection of Checkboxes.
1085
1091
  *
1092
+ * A `horizontal` group lays its tiles out in a wrapping row and makes them hug
1093
+ * their content (via each Checkbox's `fitContent`) so they sit side by side;
1094
+ * a `vertical` group stacks full-width tiles.
1095
+ *
1086
1096
  * @param {"horizontal" | "vertical"} [orientation="vertical"] - Layout direction.
1087
1097
  *
1088
1098
  * @example
1089
- * <CheckboxGroup>
1090
- * <Checkbox label="Chicken" />
1091
- * <Checkbox label="Beef" />
1099
+ * <CheckboxGroup orientation="horizontal">
1100
+ * <Checkbox variant="tile" label="Chicken" />
1101
+ * <Checkbox variant="tile" label="Beef" />
1092
1102
  * </CheckboxGroup>
1093
1103
  */
1094
1104
  declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupOwnProps & Omit<ViewProps, keyof CheckboxGroupOwnProps> & React.RefAttributes<View>>;
package/dist/index.js CHANGED
@@ -4690,13 +4690,24 @@ var StyledTextAreaWrapper = styled51(Animated.View)(({ theme: theme2, isDisabled
4690
4690
  };
4691
4691
  });
4692
4692
  var StyledTextArea = styled51(TextInput)(({ theme: theme2 }) => {
4693
- const { colour } = theme2.tokens.components.inputs;
4693
+ var _a, _b;
4694
+ const { colour, field } = theme2.tokens.components.inputs;
4695
+ const typography = field.placeholder.default;
4696
+ const { fontFamily } = resolveFont(
4697
+ typography.fontFamily,
4698
+ typography.fontWeight
4699
+ );
4700
+ const fontSize = parseTokenValue19(typography.fontSize);
4701
+ const letterSpacing = ((_a = typography.letterSpacing) == null ? void 0 : _a.endsWith("%")) ? parseFloat(typography.letterSpacing) / 100 * fontSize : parseFloat((_b = typography.letterSpacing) != null ? _b : "0");
4694
4702
  return __spreadValues({
4695
4703
  flex: 1,
4696
4704
  minWidth: 0,
4697
4705
  minHeight: 0,
4698
4706
  padding: 0,
4699
4707
  color: colour.field.text.default,
4708
+ fontFamily,
4709
+ fontSize,
4710
+ letterSpacing,
4700
4711
  textAlignVertical: "top"
4701
4712
  }, {
4702
4713
  outlineStyle: "none",
@@ -6329,6 +6340,7 @@ var StyledRootPressable = styled51(Pressable)(
6329
6340
  rootPaddingVertical,
6330
6341
  rootPaddingHorizontal,
6331
6342
  rootMaxWidth,
6343
+ rootFitContent,
6332
6344
  rootBgColor,
6333
6345
  rootBorderWidth,
6334
6346
  rootBorderColor,
@@ -6338,7 +6350,7 @@ var StyledRootPressable = styled51(Pressable)(
6338
6350
  alignItems: rootFlexAlign,
6339
6351
  gap: rootGap,
6340
6352
  opacity: rootOpacity
6341
- }, rootPaddingVertical !== void 0 ? { paddingVertical: rootPaddingVertical } : {}), rootPaddingHorizontal !== void 0 ? { paddingHorizontal: rootPaddingHorizontal } : {}), rootMaxWidth !== void 0 ? { maxWidth: rootMaxWidth, width: "100%" } : {}), rootBgColor ? { backgroundColor: rootBgColor } : {}), rootBorderWidth !== void 0 ? { borderWidth: rootBorderWidth, borderColor: rootBorderColor } : {}), rootBorderRadius !== void 0 ? { borderRadius: rootBorderRadius } : {})
6353
+ }, rootPaddingVertical !== void 0 ? { paddingVertical: rootPaddingVertical } : {}), rootPaddingHorizontal !== void 0 ? { paddingHorizontal: rootPaddingHorizontal } : {}), rootMaxWidth !== void 0 ? rootFitContent ? { maxWidth: rootMaxWidth, alignSelf: "flex-start" } : { maxWidth: rootMaxWidth, width: "100%" } : {}), rootBgColor ? { backgroundColor: rootBgColor } : {}), rootBorderWidth !== void 0 ? { borderWidth: rootBorderWidth, borderColor: rootBorderColor } : {}), rootBorderRadius !== void 0 ? { borderRadius: rootBorderRadius } : {})
6342
6354
  );
6343
6355
  var StyledControl = styled51(View)(
6344
6356
  ({
@@ -6359,10 +6371,10 @@ var StyledControl = styled51(View)(
6359
6371
  justifyContent: "center"
6360
6372
  })
6361
6373
  );
6362
- var StyledContent2 = styled51(View)(({ contentGap }) => ({
6374
+ var StyledContent2 = styled51(View)(({ contentGap, contentFlex }) => ({
6363
6375
  flexDirection: "column",
6364
6376
  gap: contentGap,
6365
- flex: 1,
6377
+ flex: contentFlex,
6366
6378
  minWidth: 0
6367
6379
  }));
6368
6380
  var StyledIllustration = styled51(View)(({ illustrationSize }) => ({
@@ -6382,6 +6394,7 @@ var Checkbox = React66.forwardRef(
6382
6394
  defaultChecked = false,
6383
6395
  onCheckedChange,
6384
6396
  disabled = false,
6397
+ fitContent = false,
6385
6398
  style
6386
6399
  } = _b, rest = __objRest(_b, [
6387
6400
  "variant",
@@ -6392,6 +6405,7 @@ var Checkbox = React66.forwardRef(
6392
6405
  "defaultChecked",
6393
6406
  "onCheckedChange",
6394
6407
  "disabled",
6408
+ "fitContent",
6395
6409
  "style"
6396
6410
  ]);
6397
6411
  const theme2 = useTheme();
@@ -6426,6 +6440,7 @@ var Checkbox = React66.forwardRef(
6426
6440
  rootPaddingVertical: isTile ? parseTokenValue31(checkbox.checkboxTile.spacing.verticalPadding) : void 0,
6427
6441
  rootPaddingHorizontal: isTile ? parseTokenValue31(checkbox.checkboxTile.spacing.horizontalPadding) : void 0,
6428
6442
  rootMaxWidth: isTile ? parseTokenValue31(checkbox.checkboxTile.size.maxWidth) : void 0,
6443
+ rootFitContent: isTile && fitContent,
6429
6444
  rootBgColor: isTile ? isChecked ? checkbox.checkboxTile.colour.background.selected : checkbox.checkboxTile.colour.background.default : void 0,
6430
6445
  rootBorderWidth: isTile ? parseTokenValue31(checkbox.checkboxTile.borderWidth.default) : void 0,
6431
6446
  rootBorderColor: isTile ? isChecked ? checkbox.checkboxTile.colour.border.selected : checkbox.checkboxTile.colour.border.default : void 0,
@@ -6448,6 +6463,7 @@ var Checkbox = React66.forwardRef(
6448
6463
  StyledContent2,
6449
6464
  {
6450
6465
  contentGap: parseTokenValue31(checkbox.spacing.content.gap),
6466
+ contentFlex: isTile && fitContent ? 0 : 1,
6451
6467
  children: [
6452
6468
  label && /* @__PURE__ */ jsx(
6453
6469
  Typography,
@@ -6484,23 +6500,35 @@ var Checkbox = React66.forwardRef(
6484
6500
  );
6485
6501
  Checkbox.displayName = "Checkbox";
6486
6502
  var parseTokenValue32 = (value) => parseFloat(value);
6487
- var StyledGroup = styled51(View)(({ groupDirection, groupGap }) => ({
6503
+ var StyledGroup = styled51(View)(({ groupDirection, groupGap, groupWrap }) => ({
6488
6504
  flexDirection: groupDirection,
6489
- gap: groupGap
6505
+ gap: groupGap,
6506
+ flexWrap: groupWrap ? "wrap" : "nowrap"
6490
6507
  }));
6491
6508
  var CheckboxGroup = React66.forwardRef(
6492
6509
  (_a, ref) => {
6493
6510
  var _b = _a, { orientation = "vertical", children } = _b, rest = __objRest(_b, ["orientation", "children"]);
6494
6511
  const theme2 = useTheme();
6495
6512
  const { checkbox } = theme2.tokens.components;
6513
+ const isHorizontal = orientation === "horizontal";
6514
+ const renderChildren = () => isHorizontal ? React66.Children.map(children, (child) => {
6515
+ var _a2;
6516
+ if (!React66.isValidElement(child)) return child;
6517
+ const childProps = child.props;
6518
+ return React66.cloneElement(
6519
+ child,
6520
+ { fitContent: (_a2 = childProps.fitContent) != null ? _a2 : true }
6521
+ );
6522
+ }) : children;
6496
6523
  return /* @__PURE__ */ jsx(
6497
6524
  StyledGroup,
6498
6525
  __spreadProps(__spreadValues({
6499
6526
  ref,
6500
- groupDirection: orientation === "horizontal" ? "row" : "column",
6501
- groupGap: parseTokenValue32(checkbox.spacing.gap)
6527
+ groupDirection: isHorizontal ? "row" : "column",
6528
+ groupGap: parseTokenValue32(checkbox.spacing.gap),
6529
+ groupWrap: isHorizontal
6502
6530
  }, rest), {
6503
- children
6531
+ children: renderChildren()
6504
6532
  })
6505
6533
  );
6506
6534
  }