@fluentui/react-image 0.0.0-nightly-20220302-0405.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.
Files changed (57) hide show
  1. package/CHANGELOG.json +3258 -0
  2. package/CHANGELOG.md +1240 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +235 -0
  5. package/README.md +57 -0
  6. package/Spec.md +173 -0
  7. package/dist/react-image.d.ts +60 -0
  8. package/lib/Image.d.ts +1 -0
  9. package/lib/Image.js +2 -0
  10. package/lib/Image.js.map +1 -0
  11. package/lib/components/Image/Image.d.ts +6 -0
  12. package/lib/components/Image/Image.js +15 -0
  13. package/lib/components/Image/Image.js.map +1 -0
  14. package/lib/components/Image/Image.types.d.ts +30 -0
  15. package/lib/components/Image/Image.types.js +2 -0
  16. package/lib/components/Image/Image.types.js.map +1 -0
  17. package/lib/components/Image/index.d.ts +5 -0
  18. package/lib/components/Image/index.js +6 -0
  19. package/lib/components/Image/index.js.map +1 -0
  20. package/lib/components/Image/renderImage.d.ts +6 -0
  21. package/lib/components/Image/renderImage.js +16 -0
  22. package/lib/components/Image/renderImage.js.map +1 -0
  23. package/lib/components/Image/useImage.d.ts +6 -0
  24. package/lib/components/Image/useImage.js +30 -0
  25. package/lib/components/Image/useImage.js.map +1 -0
  26. package/lib/components/Image/useImageStyles.d.ts +3 -0
  27. package/lib/components/Image/useImageStyles.js +78 -0
  28. package/lib/components/Image/useImageStyles.js.map +1 -0
  29. package/lib/index.d.ts +1 -0
  30. package/lib/index.js +2 -0
  31. package/lib/index.js.map +1 -0
  32. package/lib/tsdoc-metadata.json +11 -0
  33. package/lib-commonjs/Image.d.ts +1 -0
  34. package/lib-commonjs/Image.js +10 -0
  35. package/lib-commonjs/Image.js.map +1 -0
  36. package/lib-commonjs/components/Image/Image.d.ts +6 -0
  37. package/lib-commonjs/components/Image/Image.js +26 -0
  38. package/lib-commonjs/components/Image/Image.js.map +1 -0
  39. package/lib-commonjs/components/Image/Image.types.d.ts +30 -0
  40. package/lib-commonjs/components/Image/Image.types.js +6 -0
  41. package/lib-commonjs/components/Image/Image.types.js.map +1 -0
  42. package/lib-commonjs/components/Image/index.d.ts +5 -0
  43. package/lib-commonjs/components/Image/index.js +18 -0
  44. package/lib-commonjs/components/Image/index.js.map +1 -0
  45. package/lib-commonjs/components/Image/renderImage.d.ts +6 -0
  46. package/lib-commonjs/components/Image/renderImage.js +27 -0
  47. package/lib-commonjs/components/Image/renderImage.js.map +1 -0
  48. package/lib-commonjs/components/Image/useImage.d.ts +6 -0
  49. package/lib-commonjs/components/Image/useImage.js +40 -0
  50. package/lib-commonjs/components/Image/useImage.js.map +1 -0
  51. package/lib-commonjs/components/Image/useImageStyles.d.ts +3 -0
  52. package/lib-commonjs/components/Image/useImageStyles.js +89 -0
  53. package/lib-commonjs/components/Image/useImageStyles.js.map +1 -0
  54. package/lib-commonjs/index.d.ts +1 -0
  55. package/lib-commonjs/index.js +10 -0
  56. package/lib-commonjs/index.js.map +1 -0
  57. package/package.json +64 -0
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { ImageProps, ImageState } from './Image.types';
3
+ /**
4
+ * Given user props, returns state and render function for an Image.
5
+ */
6
+ export declare const useImage_unstable: (props: ImageProps, ref: React.Ref<HTMLImageElement>) => ImageState;
@@ -0,0 +1,30 @@
1
+ import { getNativeElementProps } from '@fluentui/react-utilities';
2
+ /**
3
+ * Given user props, returns state and render function for an Image.
4
+ */
5
+
6
+ export const useImage_unstable = (props, ref) => {
7
+ const {
8
+ bordered,
9
+ fit,
10
+ block,
11
+ shape = 'square',
12
+ shadow
13
+ } = props;
14
+ const state = {
15
+ bordered,
16
+ fit,
17
+ block,
18
+ shape,
19
+ shadow,
20
+ components: {
21
+ root: 'img'
22
+ },
23
+ root: getNativeElementProps('img', {
24
+ ref,
25
+ ...props
26
+ })
27
+ };
28
+ return state;
29
+ };
30
+ //# sourceMappingURL=useImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/useImage.ts"],"names":[],"mappings":"AACA,SAAS,qBAAT,QAAsC,2BAAtC;AAGA;;AAEG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAAoE;AACnG,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,GAAZ;AAAiB,IAAA,KAAjB;AAAwB,IAAA,KAAK,GAAG,QAAhC;AAA0C,IAAA;AAA1C,MAAqD,KAA3D;AAEA,QAAM,KAAK,GAAe;AACxB,IAAA,QADwB;AAExB,IAAA,GAFwB;AAGxB,IAAA,KAHwB;AAIxB,IAAA,KAJwB;AAKxB,IAAA,MALwB;AAMxB,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KANY;AASxB,IAAA,IAAI,EAAE,qBAAqB,CAAC,KAAD,EAAQ;AACjC,MAAA,GADiC;AAEjC,SAAG;AAF8B,KAAR;AATH,GAA1B;AAeA,SAAO,KAAP;AACD,CAnBM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { ImageProps, ImageState } from './Image.types';\n\n/**\n * Given user props, returns state and render function for an Image.\n */\nexport const useImage_unstable = (props: ImageProps, ref: React.Ref<HTMLImageElement>): ImageState => {\n const { bordered, fit, block, shape = 'square', shadow } = props;\n\n const state: ImageState = {\n bordered,\n fit,\n block,\n shape,\n shadow,\n components: {\n root: 'img',\n },\n root: getNativeElementProps('img', {\n ref,\n ...props,\n }),\n };\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,3 @@
1
+ import type { ImageState } from './Image.types';
2
+ export declare const imageClassName = "fui-Image";
3
+ export declare const useImageStyles_unstable: (state: ImageState) => void;
@@ -0,0 +1,78 @@
1
+ import { shorthands, mergeClasses, __styles } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
3
+ export const imageClassName = 'fui-Image';
4
+
5
+ const useStyles = /*#__PURE__*/__styles({
6
+ "root": {
7
+ "g2u3we": "fj3muxo",
8
+ "h3c5rm": ["f1akhkt", "f1lxtadh"],
9
+ "B9xav0g": "f1aperda",
10
+ "zhjwy3": ["f1lxtadh", "f1akhkt"],
11
+ "Bbmb7ep": ["fzi6hpg", "fyowgf4"],
12
+ "Beyfa6y": ["fyowgf4", "fzi6hpg"],
13
+ "B7oj6ja": ["f3fg2lr", "f13av6d4"],
14
+ "Btl43ni": ["f13av6d4", "f3fg2lr"],
15
+ "B7ck84d": "f1ewtqcl",
16
+ "mc9l5x": "f14t3ns0"
17
+ },
18
+ "rootBordered": {
19
+ "icvyot": "fzkkow9",
20
+ "vrafjx": ["fcdblym", "fjik90z"],
21
+ "oivjwe": "fg706s2",
22
+ "wvpqe5": ["fjik90z", "fcdblym"],
23
+ "B4j52fo": "f192inf7",
24
+ "Bekrc4i": ["f5tn483", "f1ojsxk5"],
25
+ "Bn0qgzm": "f1vxd6vx",
26
+ "ibv6hh": ["f1ojsxk5", "f5tn483"]
27
+ },
28
+ "rootCircular": {
29
+ "Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
30
+ "Beyfa6y": ["f1nfllo7", "f8fbkgy"],
31
+ "B7oj6ja": ["f1djnp8u", "f1s8kh49"],
32
+ "Btl43ni": ["f1s8kh49", "f1djnp8u"]
33
+ },
34
+ "rootRounded": {
35
+ "Bbmb7ep": ["f1aa9q02", "f16jpd5f"],
36
+ "Beyfa6y": ["f16jpd5f", "f1aa9q02"],
37
+ "B7oj6ja": ["f1jar5jt", "fyu767a"],
38
+ "Btl43ni": ["fyu767a", "f1jar5jt"]
39
+ },
40
+ "rootShadow": {
41
+ "E5pizo": "f1whvlc6"
42
+ },
43
+ "rootFitNone": {
44
+ "st4lth": "f1plgu50",
45
+ "Ermj5k": ["f13uwng7", "fjmyj0p"],
46
+ "Bqenvij": "f1l02sjl",
47
+ "a9b677": "fly5x3f"
48
+ },
49
+ "rootFitCenter": {
50
+ "st4lth": "f1plgu50",
51
+ "Ermj5k": "f14xojzb",
52
+ "Bqenvij": "f1l02sjl",
53
+ "a9b677": "fly5x3f"
54
+ },
55
+ "rootFitCover": {
56
+ "st4lth": "f1ps3kmd",
57
+ "Ermj5k": "f14xojzb",
58
+ "Bqenvij": "f1l02sjl",
59
+ "a9b677": "fly5x3f"
60
+ },
61
+ "rootFitContain": {
62
+ "st4lth": "f1kle4es",
63
+ "Ermj5k": "f14xojzb",
64
+ "Bqenvij": "f1l02sjl",
65
+ "a9b677": "fly5x3f"
66
+ },
67
+ "rootBlock": {
68
+ "a9b677": "fly5x3f"
69
+ }
70
+ }, {
71
+ "d": [".fj3muxo{border-top-color:var(--colorNeutralStroke1);}", ".f1akhkt{border-right-color:var(--colorNeutralStroke1);}", ".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}", ".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}", ".fzi6hpg{border-bottom-right-radius:var(--borderRadiusNone);}", ".fyowgf4{border-bottom-left-radius:var(--borderRadiusNone);}", ".f3fg2lr{border-top-right-radius:var(--borderRadiusNone);}", ".f13av6d4{border-top-left-radius:var(--borderRadiusNone);}", ".f1ewtqcl{box-sizing:border-box;}", ".f14t3ns0{display:inline-block;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f1whvlc6{box-shadow:var(--shadow4);}", ".f1plgu50{object-fit:none;}", ".f13uwng7{object-position:left top;}", ".fjmyj0p{object-position:right top;}", ".f1l02sjl{height:100%;}", ".fly5x3f{width:100%;}", ".f14xojzb{object-position:center;}", ".f1ps3kmd{object-fit:cover;}", ".f1kle4es{object-fit:contain;}"]
72
+ });
73
+
74
+ export const useImageStyles_unstable = state => {
75
+ const styles = useStyles();
76
+ state.root.className = mergeClasses(imageClassName, styles.root, state.bordered && styles.rootBordered, state.shape === 'circular' && styles.rootCircular, state.shape === 'rounded' && styles.rootRounded, state.shadow && styles.rootShadow, state.fit === 'none' && styles.rootFitNone, state.fit === 'center' && styles.rootFitCenter, state.fit === 'cover' && styles.rootFitCover, state.fit === 'contain' && styles.rootFitContain, state.block && styles.rootBlock, state.root.className);
77
+ };
78
+ //# sourceMappingURL=useImageStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/useImageStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAGA,OAAO,MAAM,cAAc,GAAG,WAAvB;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;;AAkDA,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAsB;AAC3D,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CACjC,cADiC,EAEjC,MAAM,CAAC,IAF0B,EAGjC,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,YAHQ,EAIjC,KAAK,CAAC,KAAN,KAAgB,UAAhB,IAA8B,MAAM,CAAC,YAJJ,EAKjC,KAAK,CAAC,KAAN,KAAgB,SAAhB,IAA6B,MAAM,CAAC,WALH,EAMjC,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,UANU,EAOjC,KAAK,CAAC,GAAN,KAAc,MAAd,IAAwB,MAAM,CAAC,WAPE,EAQjC,KAAK,CAAC,GAAN,KAAc,QAAd,IAA0B,MAAM,CAAC,aARA,EASjC,KAAK,CAAC,GAAN,KAAc,OAAd,IAAyB,MAAM,CAAC,YATC,EAUjC,KAAK,CAAC,GAAN,KAAc,SAAd,IAA2B,MAAM,CAAC,cAVD,EAWjC,KAAK,CAAC,KAAN,IAAe,MAAM,CAAC,SAXW,EAYjC,KAAK,CAAC,IAAN,CAAW,SAZsB,CAAnC;AAcD,CAhBM","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ImageState } from './Image.types';\n\nexport const imageClassName = 'fui-Image';\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderRadius(tokens.borderRadiusNone),\n\n boxSizing: 'border-box',\n display: 'inline-block',\n },\n rootBordered: {\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n },\n rootCircular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n rootRounded: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n rootShadow: {\n boxShadow: tokens.shadow4,\n },\n rootFitNone: {\n objectFit: 'none',\n objectPosition: 'left top',\n height: '100%',\n width: '100%',\n },\n rootFitCenter: {\n objectFit: 'none',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootFitCover: {\n objectFit: 'cover',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootFitContain: {\n objectFit: 'contain',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootBlock: {\n width: '100%',\n },\n});\n\nexport const useImageStyles_unstable = (state: ImageState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n imageClassName,\n styles.root,\n state.bordered && styles.rootBordered,\n state.shape === 'circular' && styles.rootCircular,\n state.shape === 'rounded' && styles.rootRounded,\n state.shadow && styles.rootShadow,\n state.fit === 'none' && styles.rootFitNone,\n state.fit === 'center' && styles.rootFitCenter,\n state.fit === 'cover' && styles.rootFitCover,\n state.fit === 'contain' && styles.rootFitContain,\n state.block && styles.rootBlock,\n state.root.className,\n );\n};\n"],"sourceRoot":"../src/"}
package/lib/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './Image';
package/lib/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './Image';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC","sourcesContent":["export * from './Image';\n"]}
@@ -0,0 +1,11 @@
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.18.1"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1 @@
1
+ export * from './components/Image/index';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./components/Image/index"), exports);
10
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["Image.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,0BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Image/index';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import type { ImageProps } from './Image.types';
2
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
3
+ /**
4
+ * The Image component ensures the consistent styling of images.
5
+ */
6
+ export declare const Image: ForwardRefComponent<ImageProps>;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.Image = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const renderImage_1 = /*#__PURE__*/require("./renderImage");
11
+
12
+ const useImage_1 = /*#__PURE__*/require("./useImage");
13
+
14
+ const useImageStyles_1 = /*#__PURE__*/require("./useImageStyles");
15
+ /**
16
+ * The Image component ensures the consistent styling of images.
17
+ */
18
+
19
+
20
+ exports.Image = /*#__PURE__*/React.forwardRef((props, ref) => {
21
+ const state = useImage_1.useImage_unstable(props, ref);
22
+ useImageStyles_1.useImageStyles_unstable(state);
23
+ return renderImage_1.renderImage_unstable(state);
24
+ });
25
+ exports.Image.displayName = 'Image';
26
+ //# sourceMappingURL=Image.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/Image.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,eAAA,CAAA;;AACA,MAAA,UAAA,gBAAA,OAAA,CAAA,YAAA,CAAA;;AACA,MAAA,gBAAA,gBAAA,OAAA,CAAA,kBAAA,CAAA;AAIA;;AAEG;;;AACU,OAAA,CAAA,KAAA,gBAAyC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACpF,QAAM,KAAK,GAAG,UAAA,CAAA,iBAAA,CAAkB,KAAlB,EAAyB,GAAzB,CAAd;AACA,EAAA,gBAAA,CAAA,uBAAA,CAAwB,KAAxB;AAEA,SAAO,aAAA,CAAA,oBAAA,CAAqB,KAArB,CAAP;AACD,CALqD,CAAzC;AAOb,OAAA,CAAA,KAAA,CAAM,WAAN,GAAoB,OAApB","sourcesContent":["import * as React from 'react';\nimport { renderImage_unstable } from './renderImage';\nimport { useImage_unstable } from './useImage';\nimport { useImageStyles_unstable } from './useImageStyles';\nimport type { ImageProps } from './Image.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * The Image component ensures the consistent styling of images.\n */\nexport const Image: ForwardRefComponent<ImageProps> = React.forwardRef((props, ref) => {\n const state = useImage_unstable(props, ref);\n useImageStyles_unstable(state);\n\n return renderImage_unstable(state);\n});\n\nImage.displayName = 'Image';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,30 @@
1
+ import type { ComponentState, ComponentProps, Slot } from '@fluentui/react-utilities';
2
+ export declare type ImageSlots = {
3
+ root: Slot<'img'>;
4
+ };
5
+ declare type ImageCommons = {
6
+ /**
7
+ * An image can appear with rectangular border.
8
+ */
9
+ bordered?: boolean;
10
+ /**
11
+ * An image can set how it should be resized to fit its container.
12
+ */
13
+ fit?: 'none' | 'center' | 'contain' | 'cover';
14
+ /**
15
+ * An image can take up the width of its container.
16
+ */
17
+ block?: boolean;
18
+ /**
19
+ * An image can appear square, circular, or rounded.
20
+ * @defaultvalue square
21
+ */
22
+ shape?: 'square' | 'circular' | 'rounded';
23
+ /**
24
+ * An image can appear elevated with shadow.
25
+ */
26
+ shadow?: boolean;
27
+ };
28
+ export declare type ImageProps = ComponentProps<ImageSlots> & Partial<ImageCommons>;
29
+ export declare type ImageState = ComponentState<ImageSlots> & ImageCommons;
30
+ export {};
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=Image.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":"../src/"}
@@ -0,0 +1,5 @@
1
+ export * from './Image.types';
2
+ export * from './Image';
3
+ export * from './renderImage';
4
+ export * from './useImage';
5
+ export * from './useImageStyles';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./Image.types"), exports);
10
+
11
+ tslib_1.__exportStar(require("./Image"), exports);
12
+
13
+ tslib_1.__exportStar(require("./renderImage"), exports);
14
+
15
+ tslib_1.__exportStar(require("./useImage"), exports);
16
+
17
+ tslib_1.__exportStar(require("./useImageStyles"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,eAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,YAAA,CAAA,EAAA,OAAA;;AACA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Image.types';\nexport * from './Image';\nexport * from './renderImage';\nexport * from './useImage';\nexport * from './useImageStyles';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import { ImageState } from './Image.types';
2
+ /**
3
+ * Define the render function.
4
+ * Given the state of an image, renders it.
5
+ */
6
+ export declare const renderImage_unstable: (state: ImageState) => JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.renderImage_unstable = void 0;
7
+
8
+ const React = /*#__PURE__*/require("react");
9
+
10
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
11
+ /**
12
+ * Define the render function.
13
+ * Given the state of an image, renders it.
14
+ */
15
+
16
+
17
+ const renderImage_unstable = state => {
18
+ const {
19
+ slots,
20
+ slotProps
21
+ } = react_utilities_1.getSlots(state);
22
+ return React.createElement(slots.root, { ...slotProps.root
23
+ });
24
+ };
25
+
26
+ exports.renderImage_unstable = renderImage_unstable;
27
+ //# sourceMappingURL=renderImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/renderImage.tsx"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;;AAGG;;;AACI,MAAM,oBAAoB,GAAI,KAAD,IAAsB;AACxD,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,iBAAA,CAAA,QAAA,CAAqB,KAArB,CAA7B;AAEA,SAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAAP;AACD,CAJM;;AAAM,OAAA,CAAA,oBAAA,GAAoB,oBAApB","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { ImageSlots, ImageState } from './Image.types';\n\n/**\n * Define the render function.\n * Given the state of an image, renders it.\n */\nexport const renderImage_unstable = (state: ImageState) => {\n const { slots, slotProps } = getSlots<ImageSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ import type { ImageProps, ImageState } from './Image.types';
3
+ /**
4
+ * Given user props, returns state and render function for an Image.
5
+ */
6
+ export declare const useImage_unstable: (props: ImageProps, ref: React.Ref<HTMLImageElement>) => ImageState;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useImage_unstable = void 0;
7
+
8
+ const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
+ /**
10
+ * Given user props, returns state and render function for an Image.
11
+ */
12
+
13
+
14
+ const useImage_unstable = (props, ref) => {
15
+ const {
16
+ bordered,
17
+ fit,
18
+ block,
19
+ shape = 'square',
20
+ shadow
21
+ } = props;
22
+ const state = {
23
+ bordered,
24
+ fit,
25
+ block,
26
+ shape,
27
+ shadow,
28
+ components: {
29
+ root: 'img'
30
+ },
31
+ root: react_utilities_1.getNativeElementProps('img', {
32
+ ref,
33
+ ...props
34
+ })
35
+ };
36
+ return state;
37
+ };
38
+
39
+ exports.useImage_unstable = useImage_unstable;
40
+ //# sourceMappingURL=useImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/useImage.ts"],"names":[],"mappings":";;;;;;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;AAGA;;AAEG;;;AACI,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAAoB,GAApB,KAAoE;AACnG,QAAM;AAAE,IAAA,QAAF;AAAY,IAAA,GAAZ;AAAiB,IAAA,KAAjB;AAAwB,IAAA,KAAK,GAAG,QAAhC;AAA0C,IAAA;AAA1C,MAAqD,KAA3D;AAEA,QAAM,KAAK,GAAe;AACxB,IAAA,QADwB;AAExB,IAAA,GAFwB;AAGxB,IAAA,KAHwB;AAIxB,IAAA,KAJwB;AAKxB,IAAA,MALwB;AAMxB,IAAA,UAAU,EAAE;AACV,MAAA,IAAI,EAAE;AADI,KANY;AASxB,IAAA,IAAI,EAAE,iBAAA,CAAA,qBAAA,CAAsB,KAAtB,EAA6B;AACjC,MAAA,GADiC;AAEjC,SAAG;AAF8B,KAA7B;AATkB,GAA1B;AAeA,SAAO,KAAP;AACD,CAnBM;;AAAM,OAAA,CAAA,iBAAA,GAAiB,iBAAjB","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps } from '@fluentui/react-utilities';\nimport type { ImageProps, ImageState } from './Image.types';\n\n/**\n * Given user props, returns state and render function for an Image.\n */\nexport const useImage_unstable = (props: ImageProps, ref: React.Ref<HTMLImageElement>): ImageState => {\n const { bordered, fit, block, shape = 'square', shadow } = props;\n\n const state: ImageState = {\n bordered,\n fit,\n block,\n shape,\n shadow,\n components: {\n root: 'img',\n },\n root: getNativeElementProps('img', {\n ref,\n ...props,\n }),\n };\n\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,3 @@
1
+ import type { ImageState } from './Image.types';
2
+ export declare const imageClassName = "fui-Image";
3
+ export declare const useImageStyles_unstable: (state: ImageState) => void;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useImageStyles_unstable = exports.imageClassName = void 0;
7
+
8
+ const react_1 = /*#__PURE__*/require("@griffel/react");
9
+
10
+ const react_theme_1 = /*#__PURE__*/require("@fluentui/react-theme");
11
+
12
+ exports.imageClassName = 'fui-Image';
13
+
14
+ const useStyles = /*#__PURE__*/react_1.__styles({
15
+ "root": {
16
+ "g2u3we": "fj3muxo",
17
+ "h3c5rm": ["f1akhkt", "f1lxtadh"],
18
+ "B9xav0g": "f1aperda",
19
+ "zhjwy3": ["f1lxtadh", "f1akhkt"],
20
+ "Bbmb7ep": ["fzi6hpg", "fyowgf4"],
21
+ "Beyfa6y": ["fyowgf4", "fzi6hpg"],
22
+ "B7oj6ja": ["f3fg2lr", "f13av6d4"],
23
+ "Btl43ni": ["f13av6d4", "f3fg2lr"],
24
+ "B7ck84d": "f1ewtqcl",
25
+ "mc9l5x": "f14t3ns0"
26
+ },
27
+ "rootBordered": {
28
+ "icvyot": "fzkkow9",
29
+ "vrafjx": ["fcdblym", "fjik90z"],
30
+ "oivjwe": "fg706s2",
31
+ "wvpqe5": ["fjik90z", "fcdblym"],
32
+ "B4j52fo": "f192inf7",
33
+ "Bekrc4i": ["f5tn483", "f1ojsxk5"],
34
+ "Bn0qgzm": "f1vxd6vx",
35
+ "ibv6hh": ["f1ojsxk5", "f5tn483"]
36
+ },
37
+ "rootCircular": {
38
+ "Bbmb7ep": ["f8fbkgy", "f1nfllo7"],
39
+ "Beyfa6y": ["f1nfllo7", "f8fbkgy"],
40
+ "B7oj6ja": ["f1djnp8u", "f1s8kh49"],
41
+ "Btl43ni": ["f1s8kh49", "f1djnp8u"]
42
+ },
43
+ "rootRounded": {
44
+ "Bbmb7ep": ["f1aa9q02", "f16jpd5f"],
45
+ "Beyfa6y": ["f16jpd5f", "f1aa9q02"],
46
+ "B7oj6ja": ["f1jar5jt", "fyu767a"],
47
+ "Btl43ni": ["fyu767a", "f1jar5jt"]
48
+ },
49
+ "rootShadow": {
50
+ "E5pizo": "f1whvlc6"
51
+ },
52
+ "rootFitNone": {
53
+ "st4lth": "f1plgu50",
54
+ "Ermj5k": ["f13uwng7", "fjmyj0p"],
55
+ "Bqenvij": "f1l02sjl",
56
+ "a9b677": "fly5x3f"
57
+ },
58
+ "rootFitCenter": {
59
+ "st4lth": "f1plgu50",
60
+ "Ermj5k": "f14xojzb",
61
+ "Bqenvij": "f1l02sjl",
62
+ "a9b677": "fly5x3f"
63
+ },
64
+ "rootFitCover": {
65
+ "st4lth": "f1ps3kmd",
66
+ "Ermj5k": "f14xojzb",
67
+ "Bqenvij": "f1l02sjl",
68
+ "a9b677": "fly5x3f"
69
+ },
70
+ "rootFitContain": {
71
+ "st4lth": "f1kle4es",
72
+ "Ermj5k": "f14xojzb",
73
+ "Bqenvij": "f1l02sjl",
74
+ "a9b677": "fly5x3f"
75
+ },
76
+ "rootBlock": {
77
+ "a9b677": "fly5x3f"
78
+ }
79
+ }, {
80
+ "d": [".fj3muxo{border-top-color:var(--colorNeutralStroke1);}", ".f1akhkt{border-right-color:var(--colorNeutralStroke1);}", ".f1lxtadh{border-left-color:var(--colorNeutralStroke1);}", ".f1aperda{border-bottom-color:var(--colorNeutralStroke1);}", ".fzi6hpg{border-bottom-right-radius:var(--borderRadiusNone);}", ".fyowgf4{border-bottom-left-radius:var(--borderRadiusNone);}", ".f3fg2lr{border-top-right-radius:var(--borderRadiusNone);}", ".f13av6d4{border-top-left-radius:var(--borderRadiusNone);}", ".f1ewtqcl{box-sizing:border-box;}", ".f14t3ns0{display:inline-block;}", ".fzkkow9{border-top-style:solid;}", ".fcdblym{border-right-style:solid;}", ".fjik90z{border-left-style:solid;}", ".fg706s2{border-bottom-style:solid;}", ".f192inf7{border-top-width:var(--strokeWidthThin);}", ".f5tn483{border-right-width:var(--strokeWidthThin);}", ".f1ojsxk5{border-left-width:var(--strokeWidthThin);}", ".f1vxd6vx{border-bottom-width:var(--strokeWidthThin);}", ".f8fbkgy{border-bottom-right-radius:var(--borderRadiusCircular);}", ".f1nfllo7{border-bottom-left-radius:var(--borderRadiusCircular);}", ".f1djnp8u{border-top-right-radius:var(--borderRadiusCircular);}", ".f1s8kh49{border-top-left-radius:var(--borderRadiusCircular);}", ".f1aa9q02{border-bottom-right-radius:var(--borderRadiusMedium);}", ".f16jpd5f{border-bottom-left-radius:var(--borderRadiusMedium);}", ".f1jar5jt{border-top-right-radius:var(--borderRadiusMedium);}", ".fyu767a{border-top-left-radius:var(--borderRadiusMedium);}", ".f1whvlc6{box-shadow:var(--shadow4);}", ".f1plgu50{object-fit:none;}", ".f13uwng7{object-position:left top;}", ".fjmyj0p{object-position:right top;}", ".f1l02sjl{height:100%;}", ".fly5x3f{width:100%;}", ".f14xojzb{object-position:center;}", ".f1ps3kmd{object-fit:cover;}", ".f1kle4es{object-fit:contain;}"]
81
+ });
82
+
83
+ const useImageStyles_unstable = state => {
84
+ const styles = useStyles();
85
+ state.root.className = react_1.mergeClasses(exports.imageClassName, styles.root, state.bordered && styles.rootBordered, state.shape === 'circular' && styles.rootCircular, state.shape === 'rounded' && styles.rootRounded, state.shadow && styles.rootShadow, state.fit === 'none' && styles.rootFitNone, state.fit === 'center' && styles.rootFitCenter, state.fit === 'cover' && styles.rootFitCover, state.fit === 'contain' && styles.rootFitContain, state.block && styles.rootBlock, state.root.className);
86
+ };
87
+
88
+ exports.useImageStyles_unstable = useImageStyles_unstable;
89
+ //# sourceMappingURL=useImageStyles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Image/useImageStyles.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,OAAA,gBAAA,OAAA,CAAA,gBAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,uBAAA,CAAA;;AAGa,OAAA,CAAA,cAAA,GAAiB,WAAjB;;AAEb,MAAM,SAAS,gBAAG,OAAA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;;AAkDO,MAAM,uBAAuB,GAAI,KAAD,IAAsB;AAC3D,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,OAAA,CAAA,YAAA,CACrB,OAAA,CAAA,cADqB,EAErB,MAAM,CAAC,IAFc,EAGrB,KAAK,CAAC,QAAN,IAAkB,MAAM,CAAC,YAHJ,EAIrB,KAAK,CAAC,KAAN,KAAgB,UAAhB,IAA8B,MAAM,CAAC,YAJhB,EAKrB,KAAK,CAAC,KAAN,KAAgB,SAAhB,IAA6B,MAAM,CAAC,WALf,EAMrB,KAAK,CAAC,MAAN,IAAgB,MAAM,CAAC,UANF,EAOrB,KAAK,CAAC,GAAN,KAAc,MAAd,IAAwB,MAAM,CAAC,WAPV,EAQrB,KAAK,CAAC,GAAN,KAAc,QAAd,IAA0B,MAAM,CAAC,aARZ,EASrB,KAAK,CAAC,GAAN,KAAc,OAAd,IAAyB,MAAM,CAAC,YATX,EAUrB,KAAK,CAAC,GAAN,KAAc,SAAd,IAA2B,MAAM,CAAC,cAVb,EAWrB,KAAK,CAAC,KAAN,IAAe,MAAM,CAAC,SAXD,EAYrB,KAAK,CAAC,IAAN,CAAW,SAZU,CAAvB;AAcD,CAhBM;;AAAM,OAAA,CAAA,uBAAA,GAAuB,uBAAvB","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { ImageState } from './Image.types';\n\nexport const imageClassName = 'fui-Image';\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.borderColor(tokens.colorNeutralStroke1),\n ...shorthands.borderRadius(tokens.borderRadiusNone),\n\n boxSizing: 'border-box',\n display: 'inline-block',\n },\n rootBordered: {\n ...shorthands.borderStyle('solid'),\n ...shorthands.borderWidth(tokens.strokeWidthThin),\n },\n rootCircular: {\n ...shorthands.borderRadius(tokens.borderRadiusCircular),\n },\n rootRounded: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n },\n rootShadow: {\n boxShadow: tokens.shadow4,\n },\n rootFitNone: {\n objectFit: 'none',\n objectPosition: 'left top',\n height: '100%',\n width: '100%',\n },\n rootFitCenter: {\n objectFit: 'none',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootFitCover: {\n objectFit: 'cover',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootFitContain: {\n objectFit: 'contain',\n objectPosition: 'center',\n height: '100%',\n width: '100%',\n },\n rootBlock: {\n width: '100%',\n },\n});\n\nexport const useImageStyles_unstable = (state: ImageState) => {\n const styles = useStyles();\n state.root.className = mergeClasses(\n imageClassName,\n styles.root,\n state.bordered && styles.rootBordered,\n state.shape === 'circular' && styles.rootCircular,\n state.shape === 'rounded' && styles.rootRounded,\n state.shadow && styles.rootShadow,\n state.fit === 'none' && styles.rootFitNone,\n state.fit === 'center' && styles.rootFitCenter,\n state.fit === 'cover' && styles.rootFitCover,\n state.fit === 'contain' && styles.rootFitContain,\n state.block && styles.rootBlock,\n state.root.className,\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1 @@
1
+ export * from './Image';
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ const tslib_1 = /*#__PURE__*/require("tslib");
8
+
9
+ tslib_1.__exportStar(require("./Image"), exports);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,SAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './Image';\n"],"sourceRoot":"../src/"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@fluentui/react-image",
3
+ "version": "0.0.0-nightly-20220302-0405.1",
4
+ "description": "Fluent UI React Image component.",
5
+ "main": "lib-commonjs/index.js",
6
+ "module": "lib/index.js",
7
+ "typings": "lib/index.d.ts",
8
+ "sideEffects": false,
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/microsoft/fluentui"
12
+ },
13
+ "license": "MIT",
14
+ "scripts": {
15
+ "build": "just-scripts build",
16
+ "bundle-size": "bundle-size measure",
17
+ "clean": "just-scripts clean",
18
+ "code-style": "just-scripts code-style",
19
+ "just": "just-scripts",
20
+ "lint": "just-scripts lint",
21
+ "start": "yarn storybook",
22
+ "test": "jest --passWithNoTests",
23
+ "docs": "api-extractor run --config=config/api-extractor.local.json --local",
24
+ "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../scripts/typescript/normalize-import --output ./dist/packages/react-image/src && yarn docs",
25
+ "storybook": "node ../../scripts/storybook/runner",
26
+ "type-check": "tsc -b tsconfig.json"
27
+ },
28
+ "devDependencies": {
29
+ "@fluentui/eslint-plugin": "*",
30
+ "@fluentui/react-conformance": "*",
31
+ "@fluentui/react-conformance-griffel": "0.0.0-nightly-20220302-0405.1",
32
+ "@fluentui/scripts": "^1.0.0",
33
+ "@types/enzyme": "3.10.3",
34
+ "@types/enzyme-adapter-react-16": "1.0.3",
35
+ "@types/object-fit-images": "^3.2.0",
36
+ "@types/react": "16.9.42",
37
+ "@types/react-dom": "16.9.10",
38
+ "@types/react-test-renderer": "^16.0.0",
39
+ "enzyme": "~3.10.0",
40
+ "enzyme-adapter-react-16": "^1.15.0",
41
+ "react": "16.8.6",
42
+ "react-dom": "16.8.6",
43
+ "react-test-renderer": "^16.3.0"
44
+ },
45
+ "dependencies": {
46
+ "@griffel/react": "1.0.0",
47
+ "@fluentui/react-utilities": "0.0.0-nightly-20220302-0405.1",
48
+ "@fluentui/react-theme": "0.0.0-nightly-20220302-0405.1",
49
+ "tslib": "^2.1.0"
50
+ },
51
+ "peerDependencies": {
52
+ "@types/react": ">=16.8.0 <18.0.0",
53
+ "@types/react-dom": ">=16.8.0 <18.0.0",
54
+ "react": ">=16.8.0 <18.0.0",
55
+ "react-dom": ">=16.8.0 <18.0.0"
56
+ },
57
+ "beachball": {
58
+ "disallowedChangeTypes": [
59
+ "major",
60
+ "minor",
61
+ "patch"
62
+ ]
63
+ }
64
+ }