@mittwald/flow-react-components 0.2.0-alpha.97 → 0.2.0-alpha.98

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,9 +7,21 @@ import clsx from 'clsx';
7
7
  import styles from './Image.module.scss.mjs';
8
8
 
9
9
  const Image = flowComponent("Image", (props) => {
10
- const { className, withBorder, ...rest } = props;
11
- const rootClassName = clsx(withBorder && styles.border, className);
12
- return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx("img", { className: rootClassName, ...rest }) });
10
+ const { className, withBorder, style, aspectRatio, width, height, ...rest } = props;
11
+ const rootClassName = clsx(
12
+ styles.image,
13
+ withBorder && styles.border,
14
+ aspectRatio && styles.aspectRatio,
15
+ className
16
+ );
17
+ return /* @__PURE__ */ jsx(ClearPropsContext, { children: /* @__PURE__ */ jsx(
18
+ "img",
19
+ {
20
+ className: rootClassName,
21
+ style: { ...style, aspectRatio, width, height },
22
+ ...rest
23
+ }
24
+ ) });
13
25
  });
14
26
 
15
27
  export { Image, Image as default };
@@ -1 +1 @@
1
- {"version":3,"file":"Image.mjs","sources":["../../../../src/components/Image/Image.tsx"],"sourcesContent":["import type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport clsx from \"clsx\";\nimport type { ComponentProps } from \"react\";\nimport styles from \"./Image.module.scss\";\n\nexport interface ImageProps extends ComponentProps<\"img\">, FlowComponentProps {\n /** Display the image with border and rounded edges */\n withBorder?: boolean;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Image = flowComponent(\"Image\", (props) => {\n const { className, withBorder, ...rest } = props;\n\n const rootClassName = clsx(withBorder && styles.border, className);\n\n return (\n <ClearPropsContext>\n <img className={rootClassName} {...rest} />\n </ClearPropsContext>\n );\n});\n\nexport default Image;\n"],"names":[],"mappings":";;;;;;AAgBO,MAAM,KAAQ,GAAA,aAAA,CAAc,OAAS,EAAA,CAAC,KAAU,KAAA;AACrD,EAAA,MAAM,EAAE,SAAA,EAAW,UAAY,EAAA,GAAG,MAAS,GAAA,KAAA;AAE3C,EAAA,MAAM,aAAgB,GAAA,IAAA,CAAK,UAAc,IAAA,MAAA,CAAO,QAAQ,SAAS,CAAA;AAEjE,EACE,uBAAA,GAAA,CAAC,qBACC,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAI,WAAW,aAAgB,EAAA,GAAG,MAAM,CAC3C,EAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"Image.mjs","sources":["../../../../src/components/Image/Image.tsx"],"sourcesContent":["import type { FlowComponentProps } from \"@/lib/componentFactory/flowComponent\";\nimport { flowComponent } from \"@/lib/componentFactory/flowComponent\";\nimport ClearPropsContext from \"@/components/ClearPropsContext/ClearPropsContext\";\nimport clsx from \"clsx\";\nimport type { ComponentProps } from \"react\";\nimport styles from \"./Image.module.scss\";\n\nexport interface ImageProps extends ComponentProps<\"img\">, FlowComponentProps {\n /** Display the image with border and rounded edges. */\n withBorder?: boolean;\n /**\n * The aspect ratio of the images container. Larger images will be centered\n * and their overflow will be hidden.\n */\n aspectRatio?: number;\n}\n\n/**\n * @flr-generate all\n * @flr-clear-props-context\n */\nexport const Image = flowComponent(\"Image\", (props) => {\n const { className, withBorder, style, aspectRatio, width, height, ...rest } =\n props;\n\n const rootClassName = clsx(\n styles.image,\n withBorder && styles.border,\n aspectRatio && styles.aspectRatio,\n className,\n );\n\n return (\n <ClearPropsContext>\n <img\n className={rootClassName}\n style={{ ...style, aspectRatio, width, height }}\n {...rest}\n />\n </ClearPropsContext>\n );\n});\n\nexport default Image;\n"],"names":[],"mappings":";;;;;;AAqBO,MAAM,KAAQ,GAAA,aAAA,CAAc,OAAS,EAAA,CAAC,KAAU,KAAA;AACrD,EAAM,MAAA,EAAE,WAAW,UAAY,EAAA,KAAA,EAAO,aAAa,KAAO,EAAA,MAAA,EAAQ,GAAG,IAAA,EACnE,GAAA,KAAA;AAEF,EAAA,MAAM,aAAgB,GAAA,IAAA;AAAA,IACpB,MAAO,CAAA,KAAA;AAAA,IACP,cAAc,MAAO,CAAA,MAAA;AAAA,IACrB,eAAe,MAAO,CAAA,WAAA;AAAA,IACtB;AAAA,GACF;AAEA,EAAA,2BACG,iBACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,aAAA;AAAA,MACX,OAAO,EAAE,GAAG,KAAO,EAAA,WAAA,EAAa,OAAO,MAAO,EAAA;AAAA,MAC7C,GAAG;AAAA;AAAA,GAER,EAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -1,9 +1,13 @@
1
1
  "use client"
2
2
  /* */
3
+ const image = "flow--image";
3
4
  const border = "flow--image--border";
5
+ const aspectRatio = "flow--image--aspect-ratio";
4
6
  const styles = {
5
- border: border
7
+ image: image,
8
+ border: border,
9
+ aspectRatio: aspectRatio
6
10
  };
7
11
 
8
- export { border, styles as default };
12
+ export { aspectRatio, border, styles as default, image };
9
13
  //# sourceMappingURL=Image.module.scss.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Image.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"Image.module.scss.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,8 +1,13 @@
1
1
  import { FlowComponentProps } from '../../lib/componentFactory/flowComponent';
2
2
  import { ComponentProps } from 'react';
3
3
  export interface ImageProps extends ComponentProps<"img">, FlowComponentProps {
4
- /** Display the image with border and rounded edges */
4
+ /** Display the image with border and rounded edges. */
5
5
  withBorder?: boolean;
6
+ /**
7
+ * The aspect ratio of the images container. Larger images will be centered
8
+ * and their overflow will be hidden.
9
+ */
10
+ aspectRatio?: number;
6
11
  }
7
12
  /**
8
13
  * @flr-generate all
@@ -1 +1 @@
1
- {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/components/Image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,KAAK,CAAC,EAAE,kBAAkB;IAC3E,sDAAsD;IACtD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,+FAUhB,CAAC;AAEH,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../../src/components/Image/Image.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAI/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,KAAK,CAAC,EAAE,kBAAkB;IAC3E,uDAAuD;IACvD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,+FAoBhB,CAAC;AAEH,eAAe,KAAK,CAAC"}
@@ -5,4 +5,5 @@ export default meta;
5
5
  type Story = StoryObj<typeof Image>;
6
6
  export declare const Default: Story;
7
7
  export declare const WithBorder: Story;
8
+ export declare const WithAspectRation: Story;
8
9
  //# sourceMappingURL=Default.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Image/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,MAAM,UAAU,CAAC;AAI7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAI5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,UAAU,EAAE,KAAsC,CAAC"}
1
+ {"version":3,"file":"Default.stories.d.ts","sourceRoot":"","sources":["../../../../../src/components/Image/stories/Default.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,MAAM,UAAU,CAAC;AAI7B,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAI5B,CAAC;AACF,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAEpC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC;AAEjC,eAAO,MAAM,UAAU,EAAE,KAAsC,CAAC;AAEhE,eAAO,MAAM,gBAAgB,EAAE,KAAyC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mittwald/flow-react-components",
3
- "version": "0.2.0-alpha.97",
3
+ "version": "0.2.0-alpha.98",
4
4
  "type": "module",
5
5
  "description": "A React implementation of Flow, mittwald’s design system",
6
6
  "homepage": "https://mittwald.github.io/flow",
@@ -53,7 +53,7 @@
53
53
  "dependencies": {
54
54
  "@chakra-ui/live-region": "^2.1.0",
55
55
  "@internationalized/string-compiler": "^3.2.6",
56
- "@mittwald/react-tunnel": "0.2.0-alpha.97",
56
+ "@mittwald/react-tunnel": "0.2.0-alpha.98",
57
57
  "@mittwald/react-use-promise": "^3.0.1",
58
58
  "@react-aria/form": "^3.0.14",
59
59
  "@react-aria/utils": "^3.28.1",
@@ -92,7 +92,7 @@
92
92
  "@faker-js/faker": "^9.6.0",
93
93
  "@internationalized/date": "^3.7.0",
94
94
  "@mfalkenberg/remote-dom-react": "1.2.3",
95
- "@mittwald/flow-design-tokens": "0.2.0-alpha.97",
95
+ "@mittwald/flow-design-tokens": "0.2.0-alpha.98",
96
96
  "@mittwald/react-use-promise": "^2.6.0",
97
97
  "@mittwald/typescript-config": "",
98
98
  "@nx/storybook": "^20.5.0",
@@ -172,5 +172,5 @@
172
172
  "optional": true
173
173
  }
174
174
  },
175
- "gitHead": "0a834ad080c238fa9561ddce3d0423c855c7d7df"
175
+ "gitHead": "7ec72e8eb33bb6030e81355089cfb2624e8818b4"
176
176
  }