@elliemae/ds-image 3.16.0-next.17
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/cjs/DSImage.js +53 -0
- package/dist/cjs/DSImage.js.map +7 -0
- package/dist/cjs/config/useImage.js +53 -0
- package/dist/cjs/config/useImage.js.map +7 -0
- package/dist/cjs/config/useValidateProps.js +40 -0
- package/dist/cjs/config/useValidateProps.js.map +7 -0
- package/dist/cjs/constants/index.js +44 -0
- package/dist/cjs/constants/index.js.map +7 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/package.json +7 -0
- package/dist/cjs/react-desc-prop-types.js +45 -0
- package/dist/cjs/react-desc-prop-types.js.map +7 -0
- package/dist/cjs/styled.js +151 -0
- package/dist/cjs/styled.js.map +7 -0
- package/dist/esm/DSImage.js +23 -0
- package/dist/esm/DSImage.js.map +7 -0
- package/dist/esm/config/useImage.js +23 -0
- package/dist/esm/config/useImage.js.map +7 -0
- package/dist/esm/config/useValidateProps.js +10 -0
- package/dist/esm/config/useValidateProps.js.map +7 -0
- package/dist/esm/constants/index.js +14 -0
- package/dist/esm/constants/index.js.map +7 -0
- package/dist/esm/index.js +10 -0
- package/dist/esm/index.js.map +7 -0
- package/dist/esm/package.json +7 -0
- package/dist/esm/react-desc-prop-types.js +15 -0
- package/dist/esm/react-desc-prop-types.js.map +7 -0
- package/dist/esm/styled.js +121 -0
- package/dist/esm/styled.js.map +7 -0
- package/dist/types/DSImage.d.ts +5 -0
- package/dist/types/config/useImage.d.ts +13 -0
- package/dist/types/config/useValidateProps.d.ts +3 -0
- package/dist/types/constants/index.d.ts +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/react-desc-prop-types.d.ts +19 -0
- package/dist/types/styled.d.ts +6 -0
- package/dist/types/tests/DSImage.test.d.ts +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var DSImage_exports = {};
|
|
30
|
+
__export(DSImage_exports, {
|
|
31
|
+
DSImage: () => DSImage,
|
|
32
|
+
DSImageWithSchema: () => DSImageWithSchema
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(DSImage_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
38
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
39
|
+
var import_useImage = require("./config/useImage.js");
|
|
40
|
+
var import_constants = require("./constants/index.js");
|
|
41
|
+
var import_styled = require("./styled.js");
|
|
42
|
+
const DSImage = (props) => {
|
|
43
|
+
const {
|
|
44
|
+
globalProps,
|
|
45
|
+
xstyledProps,
|
|
46
|
+
propsWithDefault: { size }
|
|
47
|
+
} = (0, import_useImage.useImage)(props);
|
|
48
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styled.StyledWrapper, { ...globalProps, ...xstyledProps, size });
|
|
49
|
+
};
|
|
50
|
+
DSImage.displayName = import_constants.DSImageName;
|
|
51
|
+
const DSImageWithSchema = (0, import_ds_props_helpers.describe)(DSImage);
|
|
52
|
+
DSImageWithSchema.propTypes = import_react_desc_prop_types.DSImagePropTypes;
|
|
53
|
+
//# sourceMappingURL=DSImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/DSImage.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSImageT, DSImagePropTypes } from './react-desc-prop-types.js';\nimport { useImage } from './config/useImage.js';\nimport { DSImageName } from './constants/index.js';\nimport { StyledWrapper } from './styled.js';\n\nconst DSImage: React.ComponentType<DSImageT.Props> = (props) => {\n const {\n globalProps,\n xstyledProps,\n propsWithDefault: { size },\n } = useImage(props);\n\n return <StyledWrapper {...globalProps} {...xstyledProps} size={size} />;\n};\n\nDSImage.displayName = DSImageName;\nconst DSImageWithSchema = describe(DSImage);\nDSImageWithSchema.propTypes = DSImagePropTypes as unknown as React.WeakValidationMap<DSImageT.Props>;\n\nexport { DSImage, DSImageWithSchema };\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADcd;AAbT,8BAAyB;AACzB,mCAAgD;AAChD,sBAAyB;AACzB,uBAA4B;AAC5B,oBAA8B;AAE9B,MAAM,UAA+C,CAAC,UAAU;AAC9D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,kBAAkB,EAAE,KAAK;AAAA,EAC3B,QAAI,0BAAS,KAAK;AAElB,SAAO,4CAAC,+BAAe,GAAG,aAAc,GAAG,cAAc,MAAY;AACvE;AAEA,QAAQ,cAAc;AACtB,MAAM,wBAAoB,kCAAS,OAAO;AAC1C,kBAAkB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useImage_exports = {};
|
|
30
|
+
__export(useImage_exports, {
|
|
31
|
+
useImage: () => useImage
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useImage_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
+
var import_react_desc_prop_types = require("../react-desc-prop-types.js");
|
|
38
|
+
var import_useValidateProps = require("./useValidateProps.js");
|
|
39
|
+
const useImage = (propsFromUser) => {
|
|
40
|
+
const propsWithDefault = (0, import_ds_props_helpers.useMemoMergePropsWithDefault)(propsFromUser, import_react_desc_prop_types.defaultProps);
|
|
41
|
+
(0, import_useValidateProps.useValidateProps)(propsWithDefault, import_react_desc_prop_types.DSImagePropTypes);
|
|
42
|
+
const globalProps = (0, import_ds_props_helpers.useGetGlobalAttributes)(propsWithDefault);
|
|
43
|
+
const xstyledProps = (0, import_ds_props_helpers.useGetXstyledProps)(propsWithDefault);
|
|
44
|
+
return import_react.default.useMemo(
|
|
45
|
+
() => ({
|
|
46
|
+
propsWithDefault,
|
|
47
|
+
globalProps,
|
|
48
|
+
xstyledProps
|
|
49
|
+
}),
|
|
50
|
+
[propsWithDefault, globalProps, xstyledProps]
|
|
51
|
+
);
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=useImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useImage.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSImageT, DSImagePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface ImageCTX {\n propsWithDefault: DSImageT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useImage = (propsFromUser: DSImageT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSImageT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSImagePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSImageT.InternalProps>(propsWithDefault);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n }),\n [propsWithDefault, globalProps, xstyledProps],\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,8BAAyF;AACzF,mCAA8D;AAC9D,8BAAiC;AAS1B,MAAM,WAAW,CAAC,kBAAkC;AAIzD,QAAM,uBAAmB,sDAAqD,eAAe,yCAAY;AACzG,gDAAiB,kBAAkB,6CAAgB;AAInD,QAAM,kBAAc,gDAA+C,gBAAgB;AACnF,QAAM,mBAAe,4CAAmB,gBAAgB;AAExD,SAAO,aAAAA,QAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,YAAY;AAAA,EAC9C;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var useValidateProps_exports = {};
|
|
30
|
+
__export(useValidateProps_exports, {
|
|
31
|
+
useValidateProps: () => useValidateProps
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(useValidateProps_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
36
|
+
var import_constants = require("../constants/index.js");
|
|
37
|
+
const useValidateProps = (props, propTypes) => {
|
|
38
|
+
(0, import_ds_props_helpers.useValidateTypescriptPropTypes)(props, propTypes, import_constants.DSImageName);
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/config/useValidateProps.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { type DSPropTypesSchema, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { type DSImageT } from '../react-desc-prop-types.js';\nimport { DSImageName } from '../constants/index.js';\n\nexport const useValidateProps = (props: DSImageT.InternalProps, propTypes: DSPropTypesSchema<DSImageT.Props>): void => {\n useValidateTypescriptPropTypes(props, propTypes, DSImageName);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,8BAAuE;AAEvE,uBAA4B;AAErB,MAAM,mBAAmB,CAAC,OAA+B,cAAuD;AACrH,8DAA+B,OAAO,WAAW,4BAAW;AAC9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var constants_exports = {};
|
|
30
|
+
__export(constants_exports, {
|
|
31
|
+
DSImageName: () => DSImageName,
|
|
32
|
+
IMAGE_DATA_TESTID: () => IMAGE_DATA_TESTID,
|
|
33
|
+
IMAGE_SLOTS: () => IMAGE_SLOTS
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(constants_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
const DSImageName = "DSImage";
|
|
38
|
+
const IMAGE_SLOTS = {
|
|
39
|
+
ROOT: "wrapper"
|
|
40
|
+
};
|
|
41
|
+
const IMAGE_DATA_TESTID = {
|
|
42
|
+
ROOT: `ds-image-${IMAGE_SLOTS.ROOT}`
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/constants/index.ts", "../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["export const DSImageName = 'DSImage';\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const IMAGE_SLOTS = {\n ROOT: 'wrapper',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const IMAGE_DATA_TESTID = {\n ROOT: `ds-image-${IMAGE_SLOTS.ROOT}`,\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAhB,MAAM,cAAc;AAGpB,MAAM,cAAc;AAAA,EACzB,MAAM;AACR;AAGO,MAAM,oBAAoB;AAAA,EAC/B,MAAM,YAAY,YAAY;AAChC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
DSImage: () => import_DSImage.DSImage,
|
|
32
|
+
DSImageWithSchema: () => import_DSImage.DSImageWithSchema,
|
|
33
|
+
IMAGE_DATA_TESTID: () => import_constants.IMAGE_DATA_TESTID
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var React = __toESM(require("react"));
|
|
37
|
+
var import_DSImage = require("./DSImage.js");
|
|
38
|
+
var import_react_desc_prop_types = require("./react-desc-prop-types.js");
|
|
39
|
+
var import_constants = require("./constants/index.js");
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { DSImage, DSImageWithSchema } from './DSImage.js';\nexport { type DSImageT } from './react-desc-prop-types.js';\nexport { IMAGE_DATA_TESTID } from './constants/index.js';\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGvB,qBAA2C;AAC3C,mCAA8B;AAC9B,uBAAkC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var react_desc_prop_types_exports = {};
|
|
30
|
+
__export(react_desc_prop_types_exports, {
|
|
31
|
+
DSImagePropTypes: () => DSImagePropTypes,
|
|
32
|
+
defaultProps: () => defaultProps
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(react_desc_prop_types_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_ds_props_helpers = require("@elliemae/ds-props-helpers");
|
|
37
|
+
const defaultProps = {};
|
|
38
|
+
const DSImagePropTypes = {
|
|
39
|
+
...import_ds_props_helpers.globalAttributesPropTypes,
|
|
40
|
+
...import_ds_props_helpers.xstyledPropTypes,
|
|
41
|
+
size: import_ds_props_helpers.PropTypes.oneOf(["xxs", "xs", "s", "m", "l", "xl", "xxl"]).description("size of the image"),
|
|
42
|
+
src: import_ds_props_helpers.PropTypes.string.isRequired.description("source of the image"),
|
|
43
|
+
alt: import_ds_props_helpers.PropTypes.string.isRequired.description("alt text of the image")
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/react-desc-prop-types.ts", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSImageT {\n export type SizeType = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export interface RequiredProps {\n src: string;\n alt: string;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n size?: SizeType;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLImageElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLImageElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSImageT.DefaultProps = {};\n\nexport const DSImagePropTypes: DSPropTypesSchema<DSImageT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n size: PropTypes.oneOf(['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl']).description('size of the image'),\n src: PropTypes.string.isRequired.description('source of the image'),\n alt: PropTypes.string.isRequired.description('alt text of the image'),\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADEvB,8BAAuE;AAqChE,MAAM,eAAsC,CAAC;AAE7C,MAAM,mBAAsD;AAAA,EACjE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,kCAAU,MAAM,CAAC,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,KAAK,CAAC,EAAE,YAAY,mBAAmB;AAAA,EAChG,KAAK,kCAAU,OAAO,WAAW,YAAY,qBAAqB;AAAA,EAClE,KAAK,kCAAU,OAAO,WAAW,YAAY,uBAAuB;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var styled_exports = {};
|
|
30
|
+
__export(styled_exports, {
|
|
31
|
+
StyledWrapper: () => StyledWrapper
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(styled_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_ds_system = require("@elliemae/ds-system");
|
|
36
|
+
var import_constants = require("./constants/index.js");
|
|
37
|
+
const xxlSizes = import_ds_system.css`
|
|
38
|
+
width: 4rem;
|
|
39
|
+
height: 4rem;
|
|
40
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
41
|
+
width: 4.923rem;
|
|
42
|
+
height: 4.923rem;
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
45
|
+
const xlSizes = import_ds_system.css`
|
|
46
|
+
width: 3rem;
|
|
47
|
+
height: 3rem;
|
|
48
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
49
|
+
width: 3.692rem;
|
|
50
|
+
height: 3.692rem;
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
const lSizes = import_ds_system.css`
|
|
54
|
+
width: 2rem;
|
|
55
|
+
height: 2rem;
|
|
56
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
57
|
+
width: 2.462rem;
|
|
58
|
+
height: 2.462rem;
|
|
59
|
+
}
|
|
60
|
+
`;
|
|
61
|
+
const mSizes = import_ds_system.css`
|
|
62
|
+
width: 1.5rem;
|
|
63
|
+
height: 1.5rem;
|
|
64
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
65
|
+
width: 1.846rem;
|
|
66
|
+
height: 1.846rem;
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
const sSizes = import_ds_system.css`
|
|
70
|
+
width: 1rem;
|
|
71
|
+
height: 1rem;
|
|
72
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
73
|
+
width: 1.231rem;
|
|
74
|
+
height: 1.231rem;
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
const xsSizes = import_ds_system.css`
|
|
78
|
+
width: 0.5rem;
|
|
79
|
+
height: 0.5rem;
|
|
80
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
81
|
+
width: 0.615rem;
|
|
82
|
+
height: 0.615rem;
|
|
83
|
+
}
|
|
84
|
+
`;
|
|
85
|
+
const xxsSizes = import_ds_system.css`
|
|
86
|
+
width: 0.25rem;
|
|
87
|
+
height: 0.25rem;
|
|
88
|
+
@media (min-width: ${import_ds_system.th.breakpoint("small")}) {
|
|
89
|
+
width: 0.308rem;
|
|
90
|
+
height: 0.308rem;
|
|
91
|
+
}
|
|
92
|
+
`;
|
|
93
|
+
const standarSizes = import_ds_system.css`
|
|
94
|
+
${sSizes}
|
|
95
|
+
`;
|
|
96
|
+
const getSize = (size) => {
|
|
97
|
+
if (size === "xxl")
|
|
98
|
+
return xxlSizes;
|
|
99
|
+
if (size === "xl")
|
|
100
|
+
return xlSizes;
|
|
101
|
+
if (size === "l")
|
|
102
|
+
return lSizes;
|
|
103
|
+
if (size === "m")
|
|
104
|
+
return mSizes;
|
|
105
|
+
if (size === "s")
|
|
106
|
+
return sSizes;
|
|
107
|
+
if (size === "xs")
|
|
108
|
+
return xsSizes;
|
|
109
|
+
if (size === "xxs")
|
|
110
|
+
return xxsSizes;
|
|
111
|
+
return standarSizes;
|
|
112
|
+
};
|
|
113
|
+
const StyledWrapper = (0, import_ds_system.styled)("img", { name: import_constants.DSImageName, slot: import_constants.IMAGE_SLOTS.ROOT })`
|
|
114
|
+
${import_ds_system.xStyledCommonProps}
|
|
115
|
+
|
|
116
|
+
${({ size }) => {
|
|
117
|
+
if (size)
|
|
118
|
+
return getSize(size);
|
|
119
|
+
}};
|
|
120
|
+
|
|
121
|
+
${({ width, theme }) => {
|
|
122
|
+
if (typeof width === "string") {
|
|
123
|
+
return `
|
|
124
|
+
width: ${width};
|
|
125
|
+
`;
|
|
126
|
+
} else if (typeof width === "number") {
|
|
127
|
+
return `
|
|
128
|
+
width: ${width / 16}rem;
|
|
129
|
+
@media (min-width: ${theme.breakpoints?.small}) {
|
|
130
|
+
width: ${width / 13}rem;
|
|
131
|
+
}
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
}}
|
|
135
|
+
|
|
136
|
+
${({ height, theme }) => {
|
|
137
|
+
if (typeof height === "string") {
|
|
138
|
+
return `
|
|
139
|
+
height: ${height};
|
|
140
|
+
`;
|
|
141
|
+
} else if (typeof height === "number") {
|
|
142
|
+
return `
|
|
143
|
+
height: ${height / 16}rem;
|
|
144
|
+
@media (min-width: ${theme.breakpoints?.small}) {
|
|
145
|
+
height: ${height / 13}rem;
|
|
146
|
+
}
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
}}
|
|
150
|
+
`;
|
|
151
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/styled.tsx", "../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { FlattenInterpolation, Theme } from '@elliemae/ds-system';\nimport { xStyledCommonProps, css, styled, th } from '@elliemae/ds-system';\nimport type { DSImageT } from './react-desc-prop-types.js';\nimport { DSImageName, IMAGE_SLOTS } from './constants/index.js';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\n\nconst xxlSizes = css`\n width: 4rem;\n height: 4rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 4.923rem;\n height: 4.923rem;\n }\n`;\n\nconst xlSizes = css`\n width: 3rem;\n height: 3rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 3.692rem;\n height: 3.692rem;\n }\n`;\n\nconst lSizes = css`\n width: 2rem;\n height: 2rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 2.462rem;\n height: 2.462rem;\n }\n`;\n\nconst mSizes = css`\n width: 1.5rem;\n height: 1.5rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 1.846rem;\n height: 1.846rem;\n }\n`;\n\nconst sSizes = css`\n width: 1rem;\n height: 1rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 1.231rem;\n height: 1.231rem;\n }\n`;\n\nconst xsSizes = css`\n width: 0.5rem;\n height: 0.5rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 0.615rem;\n height: 0.615rem;\n }\n`;\n\nconst xxsSizes = css`\n width: 0.25rem;\n height: 0.25rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 0.308rem;\n height: 0.308rem;\n }\n`;\n\nconst standarSizes = css`\n ${sSizes}\n`;\n\nconst getSize = (\n size: DSImageT.SizeType | undefined,\n): FlattenInterpolation<{\n theme: Theme;\n}> => {\n if (size === 'xxl') return xxlSizes;\n if (size === 'xl') return xlSizes;\n if (size === 'l') return lSizes;\n if (size === 'm') return mSizes;\n if (size === 's') return sSizes;\n if (size === 'xs') return xsSizes;\n if (size === 'xxs') return xxsSizes;\n return standarSizes;\n};\n\nexport const StyledWrapper = styled('img', { name: DSImageName, slot: IMAGE_SLOTS.ROOT })<\n { size?: DSImageT.SizeType } & XstyledProps\n>`\n ${xStyledCommonProps}\n\n ${({ size }) => {\n if (size) return getSize(size);\n }};\n\n ${({ width, theme }) => {\n if (typeof width === 'string') {\n return `\n width: ${width};\n `;\n } else if (typeof width === 'number') {\n return `\n width: ${width / 16}rem;\n @media (min-width: ${theme.breakpoints?.small}) {\n width: ${width / 13}rem;\n }\n `;\n }\n }}\n\n ${({ height, theme }) => {\n if (typeof height === 'string') {\n return `\n height: ${height};\n `;\n } else if (typeof height === 'number') {\n return `\n height: ${height / 16}rem;\n @media (min-width: ${theme.breakpoints?.small}) {\n height: ${height / 13}rem;\n }\n `;\n }\n }}\n`;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,uBAAoD;AAEpD,uBAAyC;AAGzC,MAAM,WAAW;AAAA;AAAA;AAAA,uBAGM,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,UAAU;AAAA;AAAA;AAAA,uBAGO,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,UAAU;AAAA;AAAA;AAAA,uBAGO,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,WAAW;AAAA;AAAA;AAAA,uBAGM,oBAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,eAAe;AAAA,IACjB;AAAA;AAGJ,MAAM,UAAU,CACd,SAGI;AACJ,MAAI,SAAS;AAAO,WAAO;AAC3B,MAAI,SAAS;AAAM,WAAO;AAC1B,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAM,WAAO;AAC1B,MAAI,SAAS;AAAO,WAAO;AAC3B,SAAO;AACT;AAEO,MAAM,oBAAgB,yBAAO,OAAO,EAAE,MAAM,8BAAa,MAAM,6BAAY,KAAK,CAAC;AAAA,IAGpF;AAAA;AAAA,IAEA,CAAC,EAAE,KAAK,MAAM;AACd,MAAI;AAAM,WAAO,QAAQ,IAAI;AAC/B;AAAA;AAAA,IAEE,CAAC,EAAE,OAAO,MAAM,MAAM;AACtB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,iBACI;AAAA;AAAA,EAEb,WAAW,OAAO,UAAU,UAAU;AACpC,WAAO;AAAA,iBACI,QAAQ;AAAA,6BACI,MAAM,aAAa;AAAA,mBAC7B,QAAQ;AAAA;AAAA;AAAA,EAGvB;AACF;AAAA;AAAA,IAEE,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,kBACK;AAAA;AAAA,EAEd,WAAW,OAAO,WAAW,UAAU;AACrC,WAAO;AAAA,kBACK,SAAS;AAAA,6BACE,MAAM,aAAa;AAAA,oBAC5B,SAAS;AAAA;AAAA;AAAA,EAGzB;AACF;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { describe } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { DSImagePropTypes } from "./react-desc-prop-types.js";
|
|
5
|
+
import { useImage } from "./config/useImage.js";
|
|
6
|
+
import { DSImageName } from "./constants/index.js";
|
|
7
|
+
import { StyledWrapper } from "./styled.js";
|
|
8
|
+
const DSImage = (props) => {
|
|
9
|
+
const {
|
|
10
|
+
globalProps,
|
|
11
|
+
xstyledProps,
|
|
12
|
+
propsWithDefault: { size }
|
|
13
|
+
} = useImage(props);
|
|
14
|
+
return /* @__PURE__ */ jsx(StyledWrapper, { ...globalProps, ...xstyledProps, size });
|
|
15
|
+
};
|
|
16
|
+
DSImage.displayName = DSImageName;
|
|
17
|
+
const DSImageWithSchema = describe(DSImage);
|
|
18
|
+
DSImageWithSchema.propTypes = DSImagePropTypes;
|
|
19
|
+
export {
|
|
20
|
+
DSImage,
|
|
21
|
+
DSImageWithSchema
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=DSImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSImage.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { describe } from '@elliemae/ds-props-helpers';\nimport { type DSImageT, DSImagePropTypes } from './react-desc-prop-types.js';\nimport { useImage } from './config/useImage.js';\nimport { DSImageName } from './constants/index.js';\nimport { StyledWrapper } from './styled.js';\n\nconst DSImage: React.ComponentType<DSImageT.Props> = (props) => {\n const {\n globalProps,\n xstyledProps,\n propsWithDefault: { size },\n } = useImage(props);\n\n return <StyledWrapper {...globalProps} {...xstyledProps} size={size} />;\n};\n\nDSImage.displayName = DSImageName;\nconst DSImageWithSchema = describe(DSImage);\nDSImageWithSchema.propTypes = DSImagePropTypes as unknown as React.WeakValidationMap<DSImageT.Props>;\n\nexport { DSImage, DSImageWithSchema };\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACcd;AAbT,SAAS,gBAAgB;AACzB,SAAwB,wBAAwB;AAChD,SAAS,gBAAgB;AACzB,SAAS,mBAAmB;AAC5B,SAAS,qBAAqB;AAE9B,MAAM,UAA+C,CAAC,UAAU;AAC9D,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,kBAAkB,EAAE,KAAK;AAAA,EAC3B,IAAI,SAAS,KAAK;AAElB,SAAO,oBAAC,iBAAe,GAAG,aAAc,GAAG,cAAc,MAAY;AACvE;AAEA,QAAQ,cAAc;AACtB,MAAM,oBAAoB,SAAS,OAAO;AAC1C,kBAAkB,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import React2 from "react";
|
|
3
|
+
import { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from "@elliemae/ds-props-helpers";
|
|
4
|
+
import { DSImagePropTypes, defaultProps } from "../react-desc-prop-types.js";
|
|
5
|
+
import { useValidateProps } from "./useValidateProps.js";
|
|
6
|
+
const useImage = (propsFromUser) => {
|
|
7
|
+
const propsWithDefault = useMemoMergePropsWithDefault(propsFromUser, defaultProps);
|
|
8
|
+
useValidateProps(propsWithDefault, DSImagePropTypes);
|
|
9
|
+
const globalProps = useGetGlobalAttributes(propsWithDefault);
|
|
10
|
+
const xstyledProps = useGetXstyledProps(propsWithDefault);
|
|
11
|
+
return React2.useMemo(
|
|
12
|
+
() => ({
|
|
13
|
+
propsWithDefault,
|
|
14
|
+
globalProps,
|
|
15
|
+
xstyledProps
|
|
16
|
+
}),
|
|
17
|
+
[propsWithDefault, globalProps, xstyledProps]
|
|
18
|
+
);
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
useImage
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=useImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useImage.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport { useGetGlobalAttributes, useGetXstyledProps, useMemoMergePropsWithDefault } from '@elliemae/ds-props-helpers';\nimport { type DSImageT, DSImagePropTypes, defaultProps } from '../react-desc-prop-types.js';\nimport { useValidateProps } from './useValidateProps.js';\n\nexport interface ImageCTX {\n propsWithDefault: DSImageT.InternalProps;\n globalProps: ReturnType<typeof useGetGlobalAttributes>;\n xstyledProps: ReturnType<typeof useGetXstyledProps>;\n instanceUid: string;\n}\n\nexport const useImage = (propsFromUser: DSImageT.Props) => {\n // =============================================================================\n // MERGE WITH DEFAULT AND VALIDATE PROPS\n // =============================================================================\n const propsWithDefault = useMemoMergePropsWithDefault<DSImageT.InternalProps>(propsFromUser, defaultProps);\n useValidateProps(propsWithDefault, DSImagePropTypes);\n // =============================================================================\n // GLOBAL ATTRIBUTES & XSTYLED PROPS\n // =============================================================================\n const globalProps = useGetGlobalAttributes<DSImageT.InternalProps>(propsWithDefault);\n const xstyledProps = useGetXstyledProps(propsWithDefault);\n\n return React.useMemo(\n () => ({\n propsWithDefault,\n globalProps,\n xstyledProps,\n }),\n [propsWithDefault, globalProps, xstyledProps],\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,OAAOA,YAAW;AAClB,SAAS,wBAAwB,oBAAoB,oCAAoC;AACzF,SAAwB,kBAAkB,oBAAoB;AAC9D,SAAS,wBAAwB;AAS1B,MAAM,WAAW,CAAC,kBAAkC;AAIzD,QAAM,mBAAmB,6BAAqD,eAAe,YAAY;AACzG,mBAAiB,kBAAkB,gBAAgB;AAInD,QAAM,cAAc,uBAA+C,gBAAgB;AACnF,QAAM,eAAe,mBAAmB,gBAAgB;AAExD,SAAOA,OAAM;AAAA,IACX,OAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,kBAAkB,aAAa,YAAY;AAAA,EAC9C;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useValidateTypescriptPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
import { DSImageName } from "../constants/index.js";
|
|
4
|
+
const useValidateProps = (props, propTypes) => {
|
|
5
|
+
useValidateTypescriptPropTypes(props, propTypes, DSImageName);
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
useValidateProps
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useValidateProps.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/config/useValidateProps.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import { type DSPropTypesSchema, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';\nimport { type DSImageT } from '../react-desc-prop-types.js';\nimport { DSImageName } from '../constants/index.js';\n\nexport const useValidateProps = (props: DSImageT.InternalProps, propTypes: DSPropTypesSchema<DSImageT.Props>): void => {\n useValidateTypescriptPropTypes(props, propTypes, DSImageName);\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAvB,SAAiC,sCAAsC;AAEvE,SAAS,mBAAmB;AAErB,MAAM,mBAAmB,CAAC,OAA+B,cAAuD;AACrH,iCAA+B,OAAO,WAAW,WAAW;AAC9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const DSImageName = "DSImage";
|
|
3
|
+
const IMAGE_SLOTS = {
|
|
4
|
+
ROOT: "wrapper"
|
|
5
|
+
};
|
|
6
|
+
const IMAGE_DATA_TESTID = {
|
|
7
|
+
ROOT: `ds-image-${IMAGE_SLOTS.ROOT}`
|
|
8
|
+
};
|
|
9
|
+
export {
|
|
10
|
+
DSImageName,
|
|
11
|
+
IMAGE_DATA_TESTID,
|
|
12
|
+
IMAGE_SLOTS
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../scripts/build/transpile/react-shim.js", "../../../src/constants/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "export const DSImageName = 'DSImage';\n\n// we are giving \"component_name_slots\" to avoid errors on duplicate exports variables in aggregators\nexport const IMAGE_SLOTS = {\n ROOT: 'wrapper',\n} as const;\n\n// we are giving \"component_name_data_testid\" to avoid errors on duplicate exports variables in aggregators\nexport const IMAGE_DATA_TESTID = {\n ROOT: `ds-image-${IMAGE_SLOTS.ROOT}`,\n} as const;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACAhB,MAAM,cAAc;AAGpB,MAAM,cAAc;AAAA,EACzB,MAAM;AACR;AAGO,MAAM,oBAAoB;AAAA,EAC/B,MAAM,YAAY,YAAY;AAChC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { DSImage, DSImageWithSchema } from "./DSImage.js";
|
|
3
|
+
import {} from "./react-desc-prop-types.js";
|
|
4
|
+
import { IMAGE_DATA_TESTID } from "./constants/index.js";
|
|
5
|
+
export {
|
|
6
|
+
DSImage,
|
|
7
|
+
DSImageWithSchema,
|
|
8
|
+
IMAGE_DATA_TESTID
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "// this is a workaround to typescript error TS2742\n// https://github.com/microsoft/TypeScript/issues/47663\nimport type {} from '@xstyled/system';\nexport { DSImage, DSImageWithSchema } from './DSImage.js';\nexport { type DSImageT } from './react-desc-prop-types.js';\nexport { IMAGE_DATA_TESTID } from './constants/index.js';\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACGvB,SAAS,SAAS,yBAAyB;AAC3C,eAA8B;AAC9B,SAAS,yBAAyB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from "@elliemae/ds-props-helpers";
|
|
3
|
+
const defaultProps = {};
|
|
4
|
+
const DSImagePropTypes = {
|
|
5
|
+
...globalAttributesPropTypes,
|
|
6
|
+
...xstyledPropTypes,
|
|
7
|
+
size: PropTypes.oneOf(["xxs", "xs", "s", "m", "l", "xl", "xxl"]).description("size of the image"),
|
|
8
|
+
src: PropTypes.string.isRequired.description("source of the image"),
|
|
9
|
+
alt: PropTypes.string.isRequired.description("alt text of the image")
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
DSImagePropTypes,
|
|
13
|
+
defaultProps
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=react-desc-prop-types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/react-desc-prop-types.ts"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable @typescript-eslint/no-empty-interface */\nimport type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';\nimport { PropTypes, globalAttributesPropTypes, xstyledPropTypes } from '@elliemae/ds-props-helpers';\n\nexport declare namespace DSImageT {\n export type SizeType = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n export interface RequiredProps {\n src: string;\n alt: string;\n }\n\n export interface DefaultProps {}\n\n export interface OptionalProps {\n size?: SizeType;\n }\n\n export interface Props\n extends Partial<DefaultProps>,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLImageElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n\n export interface InternalProps\n extends DefaultProps,\n OptionalProps,\n Omit<\n GlobalAttributesT<HTMLImageElement>,\n keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps\n >,\n XstyledProps,\n RequiredProps {}\n}\n\nexport const defaultProps: DSImageT.DefaultProps = {};\n\nexport const DSImagePropTypes: DSPropTypesSchema<DSImageT.Props> = {\n ...globalAttributesPropTypes,\n ...xstyledPropTypes,\n size: PropTypes.oneOf(['xxs', 'xs', 's', 'm', 'l', 'xl', 'xxl']).description('size of the image'),\n src: PropTypes.string.isRequired.description('source of the image'),\n alt: PropTypes.string.isRequired.description('alt text of the image'),\n};\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACEvB,SAAS,WAAW,2BAA2B,wBAAwB;AAqChE,MAAM,eAAsC,CAAC;AAE7C,MAAM,mBAAsD;AAAA,EACjE,GAAG;AAAA,EACH,GAAG;AAAA,EACH,MAAM,UAAU,MAAM,CAAC,OAAO,MAAM,KAAK,KAAK,KAAK,MAAM,KAAK,CAAC,EAAE,YAAY,mBAAmB;AAAA,EAChG,KAAK,UAAU,OAAO,WAAW,YAAY,qBAAqB;AAAA,EAClE,KAAK,UAAU,OAAO,WAAW,YAAY,uBAAuB;AACtE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { xStyledCommonProps, css, styled, th } from "@elliemae/ds-system";
|
|
3
|
+
import { DSImageName, IMAGE_SLOTS } from "./constants/index.js";
|
|
4
|
+
const xxlSizes = css`
|
|
5
|
+
width: 4rem;
|
|
6
|
+
height: 4rem;
|
|
7
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
8
|
+
width: 4.923rem;
|
|
9
|
+
height: 4.923rem;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
12
|
+
const xlSizes = css`
|
|
13
|
+
width: 3rem;
|
|
14
|
+
height: 3rem;
|
|
15
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
16
|
+
width: 3.692rem;
|
|
17
|
+
height: 3.692rem;
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
const lSizes = css`
|
|
21
|
+
width: 2rem;
|
|
22
|
+
height: 2rem;
|
|
23
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
24
|
+
width: 2.462rem;
|
|
25
|
+
height: 2.462rem;
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const mSizes = css`
|
|
29
|
+
width: 1.5rem;
|
|
30
|
+
height: 1.5rem;
|
|
31
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
32
|
+
width: 1.846rem;
|
|
33
|
+
height: 1.846rem;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
const sSizes = css`
|
|
37
|
+
width: 1rem;
|
|
38
|
+
height: 1rem;
|
|
39
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
40
|
+
width: 1.231rem;
|
|
41
|
+
height: 1.231rem;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const xsSizes = css`
|
|
45
|
+
width: 0.5rem;
|
|
46
|
+
height: 0.5rem;
|
|
47
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
48
|
+
width: 0.615rem;
|
|
49
|
+
height: 0.615rem;
|
|
50
|
+
}
|
|
51
|
+
`;
|
|
52
|
+
const xxsSizes = css`
|
|
53
|
+
width: 0.25rem;
|
|
54
|
+
height: 0.25rem;
|
|
55
|
+
@media (min-width: ${th.breakpoint("small")}) {
|
|
56
|
+
width: 0.308rem;
|
|
57
|
+
height: 0.308rem;
|
|
58
|
+
}
|
|
59
|
+
`;
|
|
60
|
+
const standarSizes = css`
|
|
61
|
+
${sSizes}
|
|
62
|
+
`;
|
|
63
|
+
const getSize = (size) => {
|
|
64
|
+
if (size === "xxl")
|
|
65
|
+
return xxlSizes;
|
|
66
|
+
if (size === "xl")
|
|
67
|
+
return xlSizes;
|
|
68
|
+
if (size === "l")
|
|
69
|
+
return lSizes;
|
|
70
|
+
if (size === "m")
|
|
71
|
+
return mSizes;
|
|
72
|
+
if (size === "s")
|
|
73
|
+
return sSizes;
|
|
74
|
+
if (size === "xs")
|
|
75
|
+
return xsSizes;
|
|
76
|
+
if (size === "xxs")
|
|
77
|
+
return xxsSizes;
|
|
78
|
+
return standarSizes;
|
|
79
|
+
};
|
|
80
|
+
const StyledWrapper = styled("img", { name: DSImageName, slot: IMAGE_SLOTS.ROOT })`
|
|
81
|
+
${xStyledCommonProps}
|
|
82
|
+
|
|
83
|
+
${({ size }) => {
|
|
84
|
+
if (size)
|
|
85
|
+
return getSize(size);
|
|
86
|
+
}};
|
|
87
|
+
|
|
88
|
+
${({ width, theme }) => {
|
|
89
|
+
if (typeof width === "string") {
|
|
90
|
+
return `
|
|
91
|
+
width: ${width};
|
|
92
|
+
`;
|
|
93
|
+
} else if (typeof width === "number") {
|
|
94
|
+
return `
|
|
95
|
+
width: ${width / 16}rem;
|
|
96
|
+
@media (min-width: ${theme.breakpoints?.small}) {
|
|
97
|
+
width: ${width / 13}rem;
|
|
98
|
+
}
|
|
99
|
+
`;
|
|
100
|
+
}
|
|
101
|
+
}}
|
|
102
|
+
|
|
103
|
+
${({ height, theme }) => {
|
|
104
|
+
if (typeof height === "string") {
|
|
105
|
+
return `
|
|
106
|
+
height: ${height};
|
|
107
|
+
`;
|
|
108
|
+
} else if (typeof height === "number") {
|
|
109
|
+
return `
|
|
110
|
+
height: ${height / 16}rem;
|
|
111
|
+
@media (min-width: ${theme.breakpoints?.small}) {
|
|
112
|
+
height: ${height / 13}rem;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
}}
|
|
117
|
+
`;
|
|
118
|
+
export {
|
|
119
|
+
StyledWrapper
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=styled.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/styled.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import type { FlattenInterpolation, Theme } from '@elliemae/ds-system';\nimport { xStyledCommonProps, css, styled, th } from '@elliemae/ds-system';\nimport type { DSImageT } from './react-desc-prop-types.js';\nimport { DSImageName, IMAGE_SLOTS } from './constants/index.js';\nimport type { XstyledProps } from '@elliemae/ds-props-helpers';\n\nconst xxlSizes = css`\n width: 4rem;\n height: 4rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 4.923rem;\n height: 4.923rem;\n }\n`;\n\nconst xlSizes = css`\n width: 3rem;\n height: 3rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 3.692rem;\n height: 3.692rem;\n }\n`;\n\nconst lSizes = css`\n width: 2rem;\n height: 2rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 2.462rem;\n height: 2.462rem;\n }\n`;\n\nconst mSizes = css`\n width: 1.5rem;\n height: 1.5rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 1.846rem;\n height: 1.846rem;\n }\n`;\n\nconst sSizes = css`\n width: 1rem;\n height: 1rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 1.231rem;\n height: 1.231rem;\n }\n`;\n\nconst xsSizes = css`\n width: 0.5rem;\n height: 0.5rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 0.615rem;\n height: 0.615rem;\n }\n`;\n\nconst xxsSizes = css`\n width: 0.25rem;\n height: 0.25rem;\n @media (min-width: ${th.breakpoint('small')}) {\n width: 0.308rem;\n height: 0.308rem;\n }\n`;\n\nconst standarSizes = css`\n ${sSizes}\n`;\n\nconst getSize = (\n size: DSImageT.SizeType | undefined,\n): FlattenInterpolation<{\n theme: Theme;\n}> => {\n if (size === 'xxl') return xxlSizes;\n if (size === 'xl') return xlSizes;\n if (size === 'l') return lSizes;\n if (size === 'm') return mSizes;\n if (size === 's') return sSizes;\n if (size === 'xs') return xsSizes;\n if (size === 'xxs') return xxsSizes;\n return standarSizes;\n};\n\nexport const StyledWrapper = styled('img', { name: DSImageName, slot: IMAGE_SLOTS.ROOT })<\n { size?: DSImageT.SizeType } & XstyledProps\n>`\n ${xStyledCommonProps}\n\n ${({ size }) => {\n if (size) return getSize(size);\n }};\n\n ${({ width, theme }) => {\n if (typeof width === 'string') {\n return `\n width: ${width};\n `;\n } else if (typeof width === 'number') {\n return `\n width: ${width / 16}rem;\n @media (min-width: ${theme.breakpoints?.small}) {\n width: ${width / 13}rem;\n }\n `;\n }\n }}\n\n ${({ height, theme }) => {\n if (typeof height === 'string') {\n return `\n height: ${height};\n `;\n } else if (typeof height === 'number') {\n return `\n height: ${height / 16}rem;\n @media (min-width: ${theme.breakpoints?.small}) {\n height: ${height / 13}rem;\n }\n `;\n }\n }}\n`;\n"],
|
|
5
|
+
"mappings": "AAAA,YAAY,WAAW;ACCvB,SAAS,oBAAoB,KAAK,QAAQ,UAAU;AAEpD,SAAS,aAAa,mBAAmB;AAGzC,MAAM,WAAW;AAAA;AAAA;AAAA,uBAGM,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,UAAU;AAAA;AAAA;AAAA,uBAGO,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,SAAS;AAAA;AAAA;AAAA,uBAGQ,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,UAAU;AAAA;AAAA;AAAA,uBAGO,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,WAAW;AAAA;AAAA;AAAA,uBAGM,GAAG,WAAW,OAAO;AAAA;AAAA;AAAA;AAAA;AAM5C,MAAM,eAAe;AAAA,IACjB;AAAA;AAGJ,MAAM,UAAU,CACd,SAGI;AACJ,MAAI,SAAS;AAAO,WAAO;AAC3B,MAAI,SAAS;AAAM,WAAO;AAC1B,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAK,WAAO;AACzB,MAAI,SAAS;AAAM,WAAO;AAC1B,MAAI,SAAS;AAAO,WAAO;AAC3B,SAAO;AACT;AAEO,MAAM,gBAAgB,OAAO,OAAO,EAAE,MAAM,aAAa,MAAM,YAAY,KAAK,CAAC;AAAA,IAGpF;AAAA;AAAA,IAEA,CAAC,EAAE,KAAK,MAAM;AACd,MAAI;AAAM,WAAO,QAAQ,IAAI;AAC/B;AAAA;AAAA,IAEE,CAAC,EAAE,OAAO,MAAM,MAAM;AACtB,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO;AAAA,iBACI;AAAA;AAAA,EAEb,WAAW,OAAO,UAAU,UAAU;AACpC,WAAO;AAAA,iBACI,QAAQ;AAAA,6BACI,MAAM,aAAa;AAAA,mBAC7B,QAAQ;AAAA;AAAA;AAAA,EAGvB;AACF;AAAA;AAAA,IAEE,CAAC,EAAE,QAAQ,MAAM,MAAM;AACvB,MAAI,OAAO,WAAW,UAAU;AAC9B,WAAO;AAAA,kBACK;AAAA;AAAA,EAEd,WAAW,OAAO,WAAW,UAAU;AACrC,WAAO;AAAA,kBACK,SAAS;AAAA,6BACE,MAAM,aAAa;AAAA,oBAC5B,SAAS;AAAA;AAAA;AAAA,EAGzB;AACF;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type DSImageT } from './react-desc-prop-types.js';
|
|
3
|
+
declare const DSImage: React.ComponentType<DSImageT.Props>;
|
|
4
|
+
declare const DSImageWithSchema: import("@elliemae/ds-props-helpers/dist/types/propTypes/types.js").DocumentedReactComponent<DSImageT.Props>;
|
|
5
|
+
export { DSImage, DSImageWithSchema };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';
|
|
2
|
+
import { type DSImageT } from '../react-desc-prop-types.js';
|
|
3
|
+
export interface ImageCTX {
|
|
4
|
+
propsWithDefault: DSImageT.InternalProps;
|
|
5
|
+
globalProps: ReturnType<typeof useGetGlobalAttributes>;
|
|
6
|
+
xstyledProps: ReturnType<typeof useGetXstyledProps>;
|
|
7
|
+
instanceUid: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const useImage: (propsFromUser: DSImageT.Props) => {
|
|
10
|
+
propsWithDefault: DSImageT.InternalProps;
|
|
11
|
+
globalProps: import("@elliemae/ds-props-helpers").GlobalAttributesT<Element>;
|
|
12
|
+
xstyledProps: import("@elliemae/ds-props-helpers").XstyledProps;
|
|
13
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { GlobalAttributesT, XstyledProps, DSPropTypesSchema } from '@elliemae/ds-props-helpers';
|
|
2
|
+
export declare namespace DSImageT {
|
|
3
|
+
type SizeType = 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl' | 'xxl';
|
|
4
|
+
interface RequiredProps {
|
|
5
|
+
src: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
}
|
|
8
|
+
interface DefaultProps {
|
|
9
|
+
}
|
|
10
|
+
interface OptionalProps {
|
|
11
|
+
size?: SizeType;
|
|
12
|
+
}
|
|
13
|
+
interface Props extends Partial<DefaultProps>, OptionalProps, Omit<GlobalAttributesT<HTMLImageElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
14
|
+
}
|
|
15
|
+
interface InternalProps extends DefaultProps, OptionalProps, Omit<GlobalAttributesT<HTMLImageElement>, keyof DefaultProps | keyof OptionalProps | keyof RequiredProps | keyof XstyledProps>, XstyledProps, RequiredProps {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export declare const defaultProps: DSImageT.DefaultProps;
|
|
19
|
+
export declare const DSImagePropTypes: DSPropTypesSchema<DSImageT.Props>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Theme } from '@elliemae/ds-system';
|
|
2
|
+
import type { DSImageT } from './react-desc-prop-types.js';
|
|
3
|
+
import type { XstyledProps } from '@elliemae/ds-props-helpers';
|
|
4
|
+
export declare const StyledWrapper: import("styled-components").StyledComponent<"img", Theme, {
|
|
5
|
+
size?: DSImageT.SizeType | undefined;
|
|
6
|
+
} & XstyledProps, never>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@elliemae/ds-image",
|
|
3
|
+
"version": "3.16.0-next.17",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "ICE MT - Dimsum - Image",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"module": "./dist/esm/index.js",
|
|
10
|
+
"main": "./dist/cjs/index.js",
|
|
11
|
+
"types": "./dist/types/index.d.ts",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/esm/index.js",
|
|
15
|
+
"require": "./dist/cjs/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": [
|
|
19
|
+
"*.css",
|
|
20
|
+
"*.scss"
|
|
21
|
+
],
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "https://git.elliemae.io/platform-ui/dimsum.git"
|
|
25
|
+
},
|
|
26
|
+
"engines": {
|
|
27
|
+
"pnpm": ">=6",
|
|
28
|
+
"node": ">=16"
|
|
29
|
+
},
|
|
30
|
+
"author": "ICE MT",
|
|
31
|
+
"jestSonar": {
|
|
32
|
+
"sonar56x": true,
|
|
33
|
+
"reportPath": "reports",
|
|
34
|
+
"reportFile": "tests.xml",
|
|
35
|
+
"indent": 4
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@elliemae/ds-props-helpers": "3.16.0-next.17",
|
|
39
|
+
"@elliemae/ds-system": "3.16.0-next.17",
|
|
40
|
+
"@xstyled/system": "~3.6.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@testing-library/jest-dom": "~5.16.5",
|
|
44
|
+
"@testing-library/react": "~12.1.3",
|
|
45
|
+
"jest-axe": "^7.0.1"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"react": "^17.0.2",
|
|
49
|
+
"react-dom": "^17.0.2",
|
|
50
|
+
"styled-components": "~5.3.6"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public",
|
|
54
|
+
"typeSafety": false
|
|
55
|
+
},
|
|
56
|
+
"scripts": {
|
|
57
|
+
"dev": "cross-env NODE_ENV=development node ../../scripts/build/build.mjs --watch",
|
|
58
|
+
"test": "node ../../scripts/testing/test.mjs",
|
|
59
|
+
"lint": "node ../../scripts/lint.mjs --fix",
|
|
60
|
+
"eslint:fix": "eslint --ext='.js,.jsx,.test.js,.ts,.tsx' --fix --config='../../.eslintrc.js' src/",
|
|
61
|
+
"dts": "node ../../scripts/dts.mjs",
|
|
62
|
+
"dts:withdeps": "pnpm --filter {.}... dts",
|
|
63
|
+
"build": "cross-env NODE_ENV=production node ../../scripts/build/build.mjs",
|
|
64
|
+
"dev:build": "pnpm --filter {.}... build",
|
|
65
|
+
"dev:install": "pnpm --filter {.}... i --no-lockfile && pnpm run dev:build",
|
|
66
|
+
"checkDeps": "npx -yes ../ds-codemods check-missing-packages --projectFolderPath=\"./\" --ignorePackagesGlobPattern=\"\" --ignoreFilesGlobPattern=\"**/test-ables/*,**/tests/*\""
|
|
67
|
+
}
|
|
68
|
+
}
|