@butternutbox/pawprint-native 0.12.0 → 0.13.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/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
@@ -6329,6 +6329,7 @@ var StyledRootPressable = styled51(Pressable)(
6329
6329
  rootPaddingVertical,
6330
6330
  rootPaddingHorizontal,
6331
6331
  rootMaxWidth,
6332
+ rootFitContent,
6332
6333
  rootBgColor,
6333
6334
  rootBorderWidth,
6334
6335
  rootBorderColor,
@@ -6338,7 +6339,7 @@ var StyledRootPressable = styled51(Pressable)(
6338
6339
  alignItems: rootFlexAlign,
6339
6340
  gap: rootGap,
6340
6341
  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 } : {})
6342
+ }, 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
6343
  );
6343
6344
  var StyledControl = styled51(View)(
6344
6345
  ({
@@ -6359,10 +6360,10 @@ var StyledControl = styled51(View)(
6359
6360
  justifyContent: "center"
6360
6361
  })
6361
6362
  );
6362
- var StyledContent2 = styled51(View)(({ contentGap }) => ({
6363
+ var StyledContent2 = styled51(View)(({ contentGap, contentFlex }) => ({
6363
6364
  flexDirection: "column",
6364
6365
  gap: contentGap,
6365
- flex: 1,
6366
+ flex: contentFlex,
6366
6367
  minWidth: 0
6367
6368
  }));
6368
6369
  var StyledIllustration = styled51(View)(({ illustrationSize }) => ({
@@ -6382,6 +6383,7 @@ var Checkbox = React66.forwardRef(
6382
6383
  defaultChecked = false,
6383
6384
  onCheckedChange,
6384
6385
  disabled = false,
6386
+ fitContent = false,
6385
6387
  style
6386
6388
  } = _b, rest = __objRest(_b, [
6387
6389
  "variant",
@@ -6392,6 +6394,7 @@ var Checkbox = React66.forwardRef(
6392
6394
  "defaultChecked",
6393
6395
  "onCheckedChange",
6394
6396
  "disabled",
6397
+ "fitContent",
6395
6398
  "style"
6396
6399
  ]);
6397
6400
  const theme2 = useTheme();
@@ -6426,6 +6429,7 @@ var Checkbox = React66.forwardRef(
6426
6429
  rootPaddingVertical: isTile ? parseTokenValue31(checkbox.checkboxTile.spacing.verticalPadding) : void 0,
6427
6430
  rootPaddingHorizontal: isTile ? parseTokenValue31(checkbox.checkboxTile.spacing.horizontalPadding) : void 0,
6428
6431
  rootMaxWidth: isTile ? parseTokenValue31(checkbox.checkboxTile.size.maxWidth) : void 0,
6432
+ rootFitContent: isTile && fitContent,
6429
6433
  rootBgColor: isTile ? isChecked ? checkbox.checkboxTile.colour.background.selected : checkbox.checkboxTile.colour.background.default : void 0,
6430
6434
  rootBorderWidth: isTile ? parseTokenValue31(checkbox.checkboxTile.borderWidth.default) : void 0,
6431
6435
  rootBorderColor: isTile ? isChecked ? checkbox.checkboxTile.colour.border.selected : checkbox.checkboxTile.colour.border.default : void 0,
@@ -6448,6 +6452,7 @@ var Checkbox = React66.forwardRef(
6448
6452
  StyledContent2,
6449
6453
  {
6450
6454
  contentGap: parseTokenValue31(checkbox.spacing.content.gap),
6455
+ contentFlex: isTile && fitContent ? 0 : 1,
6451
6456
  children: [
6452
6457
  label && /* @__PURE__ */ jsx(
6453
6458
  Typography,
@@ -6484,23 +6489,35 @@ var Checkbox = React66.forwardRef(
6484
6489
  );
6485
6490
  Checkbox.displayName = "Checkbox";
6486
6491
  var parseTokenValue32 = (value) => parseFloat(value);
6487
- var StyledGroup = styled51(View)(({ groupDirection, groupGap }) => ({
6492
+ var StyledGroup = styled51(View)(({ groupDirection, groupGap, groupWrap }) => ({
6488
6493
  flexDirection: groupDirection,
6489
- gap: groupGap
6494
+ gap: groupGap,
6495
+ flexWrap: groupWrap ? "wrap" : "nowrap"
6490
6496
  }));
6491
6497
  var CheckboxGroup = React66.forwardRef(
6492
6498
  (_a, ref) => {
6493
6499
  var _b = _a, { orientation = "vertical", children } = _b, rest = __objRest(_b, ["orientation", "children"]);
6494
6500
  const theme2 = useTheme();
6495
6501
  const { checkbox } = theme2.tokens.components;
6502
+ const isHorizontal = orientation === "horizontal";
6503
+ const renderChildren = () => isHorizontal ? React66.Children.map(children, (child) => {
6504
+ var _a2;
6505
+ if (!React66.isValidElement(child)) return child;
6506
+ const childProps = child.props;
6507
+ return React66.cloneElement(
6508
+ child,
6509
+ { fitContent: (_a2 = childProps.fitContent) != null ? _a2 : true }
6510
+ );
6511
+ }) : children;
6496
6512
  return /* @__PURE__ */ jsx(
6497
6513
  StyledGroup,
6498
6514
  __spreadProps(__spreadValues({
6499
6515
  ref,
6500
- groupDirection: orientation === "horizontal" ? "row" : "column",
6501
- groupGap: parseTokenValue32(checkbox.spacing.gap)
6516
+ groupDirection: isHorizontal ? "row" : "column",
6517
+ groupGap: parseTokenValue32(checkbox.spacing.gap),
6518
+ groupWrap: isHorizontal
6502
6519
  }, rest), {
6503
- children
6520
+ children: renderChildren()
6504
6521
  })
6505
6522
  );
6506
6523
  }