reshaped 3.6.1 → 3.6.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.
@@ -2,6 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { classNames, responsiveVariables, responsivePropDependency } from "../../utilities/props.js";
3
3
  import getAlignStyles from "../../styles/align/index.js";
4
4
  import getJustifyStyles from "../../styles/justify/index.js";
5
+ import getMaxWidthStyles from "../../styles/maxWidth/index.js";
5
6
  import s from "./Grid.module.css";
6
7
  const GridItem = (props) => {
7
8
  const { area, colStart, colEnd, colSpan, rowStart, rowEnd, rowSpan, children, className,
@@ -25,19 +26,20 @@ const GridItem = (props) => {
25
26
  return (_jsx(TagName, { ...attributes, className: itemClassNames, style: rootVariables, children: children }));
26
27
  };
27
28
  const Grid = (props) => {
28
- const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className,
29
+ const { areas, columns, rows, gap, align, justify, autoColumns, autoRows, autoFlow, children, className, maxWidth,
29
30
  // Using any here to let TS save on type resolving, otherwise TS throws an error due to the type complexity
30
31
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
31
32
  as: TagName = "div", attributes, } = props;
32
33
  const alignStyles = getAlignStyles(align);
33
34
  const justifyStyles = getJustifyStyles(justify);
35
+ const maxWidthStyles = getMaxWidthStyles(maxWidth);
34
36
  const resolvedRows = responsivePropDependency(rows, (value) => typeof value === "number" ? `repeat(${value}, 1fr)` : value);
35
37
  const resolvedColumns = responsivePropDependency(columns, (value) => typeof value === "number" ? `repeat(${value}, 1fr)` : value);
36
38
  const resolvedAreas = responsivePropDependency(areas, (value) => value
37
39
  ? `"${value?.join('" "')}"
38
40
  `
39
41
  : undefined);
40
- const rootClassNames = classNames(s.root, className);
42
+ const rootClassNames = classNames(s.root, maxWidthStyles?.classNames, className);
41
43
  const rootVariables = {
42
44
  ...attributes?.style,
43
45
  ...responsiveVariables("--rs-grid-gap", gap),
@@ -49,6 +51,7 @@ const Grid = (props) => {
49
51
  ...responsiveVariables("--rs-grid-auto-rows", autoRows),
50
52
  ...alignStyles?.variables,
51
53
  ...justifyStyles?.variables,
54
+ ...maxWidthStyles?.variables,
52
55
  };
53
56
  return (_jsx(TagName, { ...attributes, className: rootClassNames, style: rootVariables, children: children }));
54
57
  };
@@ -12,6 +12,7 @@ export type Props<TagName extends keyof React.JSX.IntrinsicElements = "div"> = {
12
12
  autoFlow?: G.Responsive<Property.GridAutoFlow>;
13
13
  autoColumns?: G.Responsive<Property.GridAutoColumns>;
14
14
  autoRows?: G.Responsive<Property.GridAutoRows>;
15
+ maxWidth?: G.Responsive<string | number>;
15
16
  children?: React.ReactNode;
16
17
  as?: TagName;
17
18
  className?: G.ClassName;
@@ -11,7 +11,7 @@ export default {
11
11
  },
12
12
  };
13
13
  export const base = {
14
- name: "gap, align, justify",
14
+ name: "gap, align, justify, maxWidth",
15
15
  render: () => (<Example>
16
16
  <Example.Item title="gap: 2">
17
17
  <Grid gap={2} columns={2}>
@@ -40,6 +40,17 @@ export const base = {
40
40
  </View>
41
41
  </Grid>
42
42
  </Example.Item>
43
+
44
+ <Example.Item title="maxWidth: 400px">
45
+ <Grid gap={2} columns="200px 200px" maxWidth="400px">
46
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
47
+ 1
48
+ </View>
49
+ <View backgroundColor="neutral-faded" borderRadius="medium" padding={4}>
50
+ 2
51
+ </View>
52
+ </Grid>
53
+ </Example.Item>
43
54
  </Example>),
44
55
  };
45
56
  export const layout = {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import type { FlyoutProps, FlyoutTriggerProps } from "../Flyout";
3
- export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "contentGap" | "contentShift" | "originCoordinates"> & {
3
+ export type Props = Pick<FlyoutProps, "id" | "position" | "onOpen" | "onClose" | "active" | "disabled" | "disableContentHover" | "containerRef" | "contentGap" | "contentShift" | "originCoordinates" | "contentAttributes" | "contentClassName"> & {
4
4
  children: (attributes: Parameters<FlyoutTriggerProps["children"]>[0] | {}) => React.ReactNode;
5
5
  text?: React.ReactNode;
6
6
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reshaped",
3
3
  "description": "Professionally crafted design system in React & Figma for building products of any scale and complexity",
4
- "version": "3.6.1",
4
+ "version": "3.6.2",
5
5
  "license": "MIT",
6
6
  "email": "hello@reshaped.so",
7
7
  "homepage": "https://reshaped.so",