@arc-ui/components 9.2.0 → 10.0.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.
@@ -1,9 +1,39 @@
1
- import { FC, HTMLAttributes } from "react";
1
+ import { FC, HTMLAttributes, ReactNode } from "react";
2
2
  import { anchorPoints } from "../../helpers";
3
3
  /**
4
- * Use `Image` to render a single image, or set of images, with support for image fitting.
4
+ * Use `Image` to render a single image, or set of images, with support for
5
+ * image fitting and art direction.
5
6
  */
6
- declare const Image: FC<ImageProps>;
7
+ declare const Image: FC<ImageProps> & {
8
+ Source: typeof ImageSource;
9
+ };
10
+ export declare const ImageSource: FC<ImageSourceProps>;
11
+ export interface ImageSourceProps {
12
+ /**
13
+ * The intrinsic height of the ImageSource, in pixels
14
+ */
15
+ height?: number;
16
+ /**
17
+ * Media condition (similar to a media query) that the user agent will evaluate for each ImageSource element. Same format as [media](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-media), i.e. `(min-width: 600px)`
18
+ */
19
+ media?: string;
20
+ /**
21
+ * The HTML [sizes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-sizes) attribute. Only required if srcSet is switching widths.
22
+ */
23
+ sizes?: string;
24
+ /**
25
+ * A comma-separated list indicating a set of possible sources for the user agent to use for different screen sizes for the ImageSource element. Same format as [srcSet](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-srcset), i.e. `my-image-200.png 200w, my-image-200.png 200w`.
26
+ */
27
+ srcSet: string;
28
+ /**
29
+ * MIME type for the resource URL(s) in the ImageSource element's srcset attribute. If the user agent does not support the given type, the element is skipped. Same format as [type](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/source#attr-type), i.e. `image/jpeg`.
30
+ */
31
+ type?: string;
32
+ /**
33
+ * The intrinsic width of the ImageSource, in pixels
34
+ */
35
+ width?: number;
36
+ }
7
37
  export declare const fitOptions: readonly ["cover"];
8
38
  export declare const loadingOptions: readonly ["eager", "lazy"];
9
39
  export declare const overlayOptions: readonly ["scrimBottomDark"];
@@ -16,6 +46,11 @@ export interface ImageProps extends HTMLAttributes<HTMLElement> {
16
46
  * Anchor point for the Image if using fit="cover".
17
47
  */
18
48
  anchor?: typeof anchorPoints[number];
49
+ /**
50
+ * Optionally enable HTML <picture> functionality by passing `Image.Source`
51
+ * components as children.
52
+ */
53
+ children?: ReactNode;
19
54
  /**
20
55
  * Fallback hexadecimal fill color. The intent is to increase perceived loading speed. Do not use on images with transparency. Requires that an explicit width and height be set for the image.
21
56
  */
@@ -25,7 +60,8 @@ export interface ImageProps extends HTMLAttributes<HTMLElement> {
25
60
  */
26
61
  fit?: typeof fitOptions[number];
27
62
  /**
28
- * Height of the Image, in pixels
63
+ * Height dimension of the Image, in pixels. If fit="cover", the height in which
64
+ * to fit the Image. Otherwise, the intrinsic height of the Image element.
29
65
  */
30
66
  height?: number;
31
67
  /**
@@ -38,7 +74,7 @@ export interface ImageProps extends HTMLAttributes<HTMLElement> {
38
74
  */
39
75
  overlay?: typeof overlayOptions[number];
40
76
  /**
41
- * The HTML [sizes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_4_Using_the_srcset_and_sizes_attributes) attribute. Required if srcSet is defined.
77
+ * The HTML [sizes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_4_Using_the_srcset_and_sizes_attributes) attribute. Only required if srcSet is switching widths. Ignored if `children` (<source> elements) are present.
42
78
  */
43
79
  sizes?: string;
44
80
  /**
@@ -46,11 +82,12 @@ export interface ImageProps extends HTMLAttributes<HTMLElement> {
46
82
  */
47
83
  src: string;
48
84
  /**
49
- * A comma-separated list indicating a set of possible sources for the user agent to use for different screen sizes for the Image. Same format as [srcSet](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_4_Using_the_srcset_and_sizes_attributes), i.e. `my-image-200.png 200w, my-image-200.png 200w`.
85
+ * A comma-separated list indicating a set of possible sources for the user agent to use for different screen sizes for the Image. Same format as [srcSet](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#Example_4_Using_the_srcset_and_sizes_attributes), i.e. `my-image-200.png 200w, my-image-200.png 200w`. Ignored if `children` (<source> elements) are present.
50
86
  */
51
87
  srcSet?: string;
52
88
  /**
53
- * Width of the Image, in pixels
89
+ * Width dimension of the Image, in pixels. If fit="cover", the width in which
90
+ * to fit the Image. Otherwise, the intrinsic width of the Image element.
54
91
  */
55
92
  width?: number;
56
93
  }
@@ -38,7 +38,6 @@ import "./components/FormControl/FormControl.bt.css";
38
38
  import "./components/Group/Group.bt.css";
39
39
  import "./components/Heading/Heading.bt.css";
40
40
  import "./components/Icon/Icon.bt.css";
41
- import "./components/Image/Image.bt.css";
42
41
  import "./components/Markup/Markup.bt.css";
43
42
  import "./components/Poster/Poster.bt.css";
44
43
  import "./components/RadioGroup/RadioGroup.bt.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-ui/components",
3
- "version": "9.2.0",
3
+ "version": "10.0.0",
4
4
  "homepage": "https://ui.digital-ent-int.bt.com",
5
5
  "author": "BT Enterprise Digital UI Team <ui-digital-ent-int@bt.com>",
6
6
  "main": "dist/index.js",
@@ -25,8 +25,8 @@
25
25
  "react": "^17.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "@arc-ui/fonts": "^9.2.0",
29
- "@arc-ui/tokens": "^9.2.0",
28
+ "@arc-ui/fonts": "^10.0.0",
29
+ "@arc-ui/tokens": "^10.0.0",
30
30
  "@babel/core": "^7.14.3",
31
31
  "@babel/helper-define-map": "^7.14.3",
32
32
  "@storybook/addon-essentials": "^6.3.6",
@@ -44,9 +44,9 @@
44
44
  "classnames": "^2.2.6",
45
45
  "formik": "^2.2.9",
46
46
  "prop-types": "^15.7.2",
47
- "react": "^17.0.0",
48
- "react-dom": "^17.0.0",
49
- "react-is": "^17.0.0",
47
+ "react": "^18.0.0",
48
+ "react-dom": "^18.0.0",
49
+ "react-is": "^18.0.0",
50
50
  "tslib": "^2.0.1",
51
51
  "typescript": "^4.0.2",
52
52
  "yup": "^0.32.11"