@elliemae/ds-imagelibrarymodal 2.3.1-rc.2 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,122 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
9
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __spreadValues = (a, b) => {
11
+ for (var prop in b || (b = {}))
12
+ if (__hasOwnProp.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ if (__getOwnPropSymbols)
15
+ for (var prop of __getOwnPropSymbols(b)) {
16
+ if (__propIsEnum.call(b, prop))
17
+ __defNormalProp(a, prop, b[prop]);
18
+ }
19
+ return a;
20
+ };
21
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
22
+ var __objRest = (source, exclude) => {
23
+ var target = {};
24
+ for (var prop in source)
25
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
26
+ target[prop] = source[prop];
27
+ if (source != null && __getOwnPropSymbols)
28
+ for (var prop of __getOwnPropSymbols(source)) {
29
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
30
+ target[prop] = source[prop];
31
+ }
32
+ return target;
33
+ };
34
+ var __export = (target, all) => {
35
+ for (var name in all)
36
+ __defProp(target, name, { get: all[name], enumerable: true });
37
+ };
38
+ var __reExport = (target, module2, copyDefault, desc) => {
39
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
40
+ for (let key of __getOwnPropNames(module2))
41
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
42
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
43
+ }
44
+ return target;
45
+ };
46
+ var __toESM = (module2, isNodeMode) => {
47
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
48
+ };
49
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
50
+ return (module2, temp) => {
51
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
52
+ };
53
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
54
+ var DSImageLibraryModal_exports = {};
55
+ __export(DSImageLibraryModal_exports, {
56
+ default: () => DSImageLibraryModal_default
57
+ });
58
+ var React = __toESM(require("react"));
59
+ var import_react = __toESM(require("react"));
60
+ var import_prop_types = __toESM(require("prop-types"));
61
+ var import_ds_modal = require("@elliemae/ds-modal");
62
+ var import_constants = require("@elliemae/ds-shared/constants");
63
+ var import_ImageLibraryModalImpl = __toESM(require("./components/ImageLibraryModalImpl"));
64
+ const modalTypes = Object.values(import_ds_modal.MODAL_TYPE);
65
+ const DSImageLibraryModal = (_a) => {
66
+ var _b = _a, {
67
+ containerProps = {},
68
+ confirmLabel = "Add",
69
+ disableDoubleClick = false,
70
+ isOpen = true,
71
+ modalTitle = "Add Image",
72
+ modalType = modalTypes[2],
73
+ rejectLabel = "Cancel",
74
+ shouldCloseOnOverlayClick = true,
75
+ size = import_constants.sizeOptions[3],
76
+ imagesData = [
77
+ {
78
+ url: "https://www.freeiconspng.com/minicovers/no-image-icon-6.png",
79
+ name: "no image",
80
+ createdBy: "user:John Doe",
81
+ createdDate: "0000-01-01 00:00 AM UTC"
82
+ }
83
+ ],
84
+ onSelect = () => null
85
+ } = _b, rest = __objRest(_b, [
86
+ "containerProps",
87
+ "confirmLabel",
88
+ "disableDoubleClick",
89
+ "isOpen",
90
+ "modalTitle",
91
+ "modalType",
92
+ "rejectLabel",
93
+ "shouldCloseOnOverlayClick",
94
+ "size",
95
+ "imagesData",
96
+ "onSelect"
97
+ ]);
98
+ return /* @__PURE__ */ import_react.default.createElement(import_ImageLibraryModalImpl.default, __spreadValues({
99
+ confirmLabel,
100
+ containerProps,
101
+ disableDoubleClick,
102
+ imagesData,
103
+ isOpen,
104
+ modalTitle,
105
+ modalType,
106
+ onSelect,
107
+ rejectLabel,
108
+ shouldCloseOnOverlayClick,
109
+ size
110
+ }, rest));
111
+ };
112
+ DSImageLibraryModal.propTypes = {
113
+ containerProps: import_prop_types.default.shape({}),
114
+ imagesData: import_prop_types.default.arrayOf(import_prop_types.default.shape({
115
+ url: import_prop_types.default.string,
116
+ name: import_prop_types.default.string
117
+ })),
118
+ onSelect: import_prop_types.default.func
119
+ };
120
+ var DSImageLibraryModal_default = DSImageLibraryModal;
121
+ module.exports = __toCommonJS(DSImageLibraryModal_exports);
122
+ //# sourceMappingURL=DSImageLibraryModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/DSImageLibraryModal.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared/constants';\nimport ImageLibraryModalImpl from './components/ImageLibraryModalImpl';\n\nconst modalTypes = Object.values(MODAL_TYPE);\n\nconst DSImageLibraryModal = ({\n containerProps = {},\n confirmLabel = 'Add',\n disableDoubleClick = false,\n isOpen = true,\n modalTitle = 'Add Image',\n modalType = modalTypes[2],\n rejectLabel = 'Cancel',\n shouldCloseOnOverlayClick = true,\n size = sizeOptions[3],\n imagesData = [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n onSelect = () => null,\n ...rest\n}) => (\n <ImageLibraryModalImpl\n confirmLabel={confirmLabel}\n containerProps={containerProps}\n disableDoubleClick={disableDoubleClick}\n imagesData={imagesData}\n isOpen={isOpen}\n modalTitle={modalTitle}\n modalType={modalType}\n onSelect={onSelect}\n rejectLabel={rejectLabel}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n size={size}\n {...rest}\n />\n);\n\n/** Inherits DSModal props */\nDSImageLibraryModal.propTypes = {\n containerProps: PropTypes.shape({}),\n /** List of images src */\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n url: PropTypes.string,\n name: PropTypes.string,\n }),\n ),\n /** Handler when user selects an image */\n onSelect: PropTypes.func,\n};\n\nexport default DSImageLibraryModal;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAClB,wBAAsB;AACtB,sBAA2B;AAC3B,uBAA4B;AAC5B,mCAAkC;AAElC,MAAM,aAAa,OAAO,OAAO;AAEjC,MAAM,sBAAsB,CAAC,OAoB1B;AApB0B,eAC3B;AAAA,qBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,YAAY,WAAW;AAAA,IACvB,cAAc;AAAA,IACd,4BAA4B;AAAA,IAC5B,OAAO,6BAAY;AAAA,IACnB,aAAa;AAAA,MACX;AAAA,QACE,KAAK;AAAA,QACL,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA;AAAA;AAAA,IAGjB,WAAW,MAAM;AAAA,MAlBU,IAmBxB,iBAnBwB,IAmBxB;AAAA,IAlBH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAQA;AAAA;AAGA,4DAAC,sCAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KACI;AAAA;AAKR,oBAAoB,YAAY;AAAA,EAC9B,gBAAgB,0BAAU,MAAM;AAAA,EAEhC,YAAY,0BAAU,QACpB,0BAAU,MAAM;AAAA,IACd,KAAK,0BAAU;AAAA,IACf,MAAM,0BAAU;AAAA;AAAA,EAIpB,UAAU,0BAAU;AAAA;AAGtB,IAAO,8BAAQ;",
6
+ "names": []
7
+ }
@@ -0,0 +1,216 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
25
+ var __objRest = (source, exclude) => {
26
+ var target = {};
27
+ for (var prop in source)
28
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
29
+ target[prop] = source[prop];
30
+ if (source != null && __getOwnPropSymbols)
31
+ for (var prop of __getOwnPropSymbols(source)) {
32
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
33
+ target[prop] = source[prop];
34
+ }
35
+ return target;
36
+ };
37
+ var __export = (target, all) => {
38
+ for (var name in all)
39
+ __defProp(target, name, { get: all[name], enumerable: true });
40
+ };
41
+ var __reExport = (target, module2, copyDefault, desc) => {
42
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
43
+ for (let key of __getOwnPropNames(module2))
44
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
45
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
46
+ }
47
+ return target;
48
+ };
49
+ var __toESM = (module2, isNodeMode) => {
50
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
51
+ };
52
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
53
+ return (module2, temp) => {
54
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
55
+ };
56
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
57
+ var ImageLibraryModalImpl_exports = {};
58
+ __export(ImageLibraryModalImpl_exports, {
59
+ default: () => ImageLibraryModalImpl
60
+ });
61
+ var React = __toESM(require("react"));
62
+ var import_react = __toESM(require("react"));
63
+ var import_ds_modal = __toESM(require("@elliemae/ds-modal"));
64
+ var import_ds_spinner = __toESM(require("@elliemae/ds-spinner"));
65
+ var import_ds_icon = require("@elliemae/ds-icon");
66
+ var import_lodash = require("lodash");
67
+ var import_react_loading_image = __toESM(require("react-loading-image"));
68
+ var import_ds_icons = require("@elliemae/ds-icons");
69
+ const elementClassName = "imglibmodal-element";
70
+ class ImageLibraryModalImpl extends import_react.default.PureComponent {
71
+ constructor(props) {
72
+ super(props);
73
+ this.onReject = () => {
74
+ const { onReject, onClose } = this.props;
75
+ if (onReject) {
76
+ onReject();
77
+ } else {
78
+ onClose();
79
+ }
80
+ };
81
+ this.handleElementClick = (e, image) => {
82
+ if (e.key && e.key !== " ") {
83
+ return;
84
+ }
85
+ const { selected } = this.state;
86
+ const { disableDoubleClick, onConfirm, onSelect } = this.props;
87
+ if (image === selected && onConfirm && !disableDoubleClick) {
88
+ onConfirm();
89
+ return;
90
+ }
91
+ this.setState({
92
+ selected: image,
93
+ user: this.getUser(image)
94
+ });
95
+ if (onSelect) {
96
+ onSelect(image);
97
+ }
98
+ };
99
+ this.renderElements = () => {
100
+ const { imagesData } = this.props;
101
+ if (!imagesData) {
102
+ return "Empty";
103
+ }
104
+ const { selected } = this.state;
105
+ return imagesData.map((image, idx) => {
106
+ const extras = {};
107
+ const { name, id } = image;
108
+ if (this.focusFirst && idx === 0) {
109
+ extras.ref = (element) => element && element.focus();
110
+ this.focusFirst = void 0;
111
+ } else if (selected && name === selected.name) {
112
+ extras.ref = (element) => element && element.focus();
113
+ }
114
+ return /* @__PURE__ */ import_react.default.createElement("div", __spreadValues({
115
+ key: id || `${name}_${idx}`,
116
+ className: elementClassName,
117
+ onClick: (e) => this.handleElementClick(e, image),
118
+ onKeyUp: (e) => this.handleElementClick(e, image),
119
+ role: "button",
120
+ tabIndex: 0
121
+ }, extras), /* @__PURE__ */ import_react.default.createElement("div", {
122
+ className: "content"
123
+ }, name));
124
+ });
125
+ };
126
+ this.renderSpinner = () => /* @__PURE__ */ import_react.default.createElement(import_ds_spinner.default, {
127
+ message: "Loading...",
128
+ size: "m"
129
+ });
130
+ this.renderError = () => /* @__PURE__ */ import_react.default.createElement(import_ds_icons.ImageMissing, {
131
+ color: import_ds_icon.DSIconColors.NEUTRAL,
132
+ size: import_ds_icon.DSIconSizes.M
133
+ });
134
+ this.state = {
135
+ selected: void 0,
136
+ user: void 0
137
+ };
138
+ this.preventSpacebarScroll();
139
+ }
140
+ componentDidMount() {
141
+ const { imagesData } = this.props;
142
+ if (imagesData) {
143
+ this.handleElementClick({}, imagesData[0]);
144
+ this.focusFirst = true;
145
+ }
146
+ }
147
+ getDerivedStateFromProps(nextProps) {
148
+ const { imagesData } = this.props;
149
+ if (!imagesData && nextProps.imagesData) {
150
+ this.setState({ selected: imagesData[0] });
151
+ }
152
+ }
153
+ getUser(selected) {
154
+ if (!selected) {
155
+ return "";
156
+ }
157
+ const index = selected.createdBy.lastIndexOf("user:");
158
+ if (index === -1) {
159
+ return selected.createdBy;
160
+ }
161
+ return selected.createdBy.substring(index + 5);
162
+ }
163
+ preventSpacebarScroll() {
164
+ document.onkeypress = function(e) {
165
+ if (!(0, import_lodash.includes)(e.target.className, elementClassName)) {
166
+ return true;
167
+ }
168
+ e = e || window.event;
169
+ const charCode = e.keyCode || e.which;
170
+ if (charCode === 32) {
171
+ e.preventDefault();
172
+ return false;
173
+ }
174
+ return true;
175
+ };
176
+ }
177
+ drawDiv(className, content) {
178
+ return /* @__PURE__ */ import_react.default.createElement("div", {
179
+ className
180
+ }, content);
181
+ }
182
+ drawLabel(className, label, value) {
183
+ return /* @__PURE__ */ import_react.default.createElement("div", {
184
+ className
185
+ }, /* @__PURE__ */ import_react.default.createElement("span", {
186
+ className: "label"
187
+ }, label), /* @__PURE__ */ import_react.default.createElement("span", {
188
+ className: "value"
189
+ }, value));
190
+ }
191
+ render() {
192
+ const { selected, user } = this.state;
193
+ const _a = this.props, { containerProps, imagesData, onSelect, disableDoubleClick } = _a, modalProps = __objRest(_a, ["containerProps", "imagesData", "onSelect", "disableDoubleClick"]);
194
+ return /* @__PURE__ */ import_react.default.createElement(import_ds_modal.default, __spreadProps(__spreadValues({
195
+ containerProps
196
+ }, modalProps), {
197
+ className: "em-ds-modal-image-library",
198
+ onReject: this.onReject
199
+ }), /* @__PURE__ */ import_react.default.createElement("div", {
200
+ className: "wrapper"
201
+ }, /* @__PURE__ */ import_react.default.createElement("div", {
202
+ className: "col-1"
203
+ }, this.drawDiv("title", "Company Images"), this.renderElements()), /* @__PURE__ */ import_react.default.createElement("div", {
204
+ className: "col-2"
205
+ }, this.drawDiv("title", selected ? selected.name : ""), /* @__PURE__ */ import_react.default.createElement(import_react_loading_image.default, {
206
+ className: "image-loader",
207
+ error: this.renderError,
208
+ loading: this.renderSpinner,
209
+ src: selected ? selected.url : ""
210
+ }), selected && /* @__PURE__ */ import_react.default.createElement("div", {
211
+ className: "info"
212
+ }, this.drawLabel("info-element", "Created Date:", selected.createdDate), this.drawLabel("info-element", "Created By:", user)))));
213
+ }
214
+ }
215
+ module.exports = __toCommonJS(ImageLibraryModalImpl_exports);
216
+ //# sourceMappingURL=ImageLibraryModalImpl.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ImageLibraryModalImpl.tsx", "../../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["/* eslint-disable max-lines */\nimport React from 'react';\nimport DSModal from '@elliemae/ds-modal';\nimport DSSpinner from '@elliemae/ds-spinner';\nimport { DSIconSizes as ICONS_SIZES, DSIconColors as ICONS_COLORS } from '@elliemae/ds-icon';\nimport { includes } from 'lodash';\nimport ImageLoader from 'react-loading-image';\nimport { ImageMissing } from '@elliemae/ds-icons';\n\nconst elementClassName = 'imglibmodal-element';\n\nexport default class ImageLibraryModalImpl extends React.PureComponent {\n constructor(props) {\n super(props);\n this.state = {\n selected: undefined,\n user: undefined,\n };\n this.preventSpacebarScroll();\n }\n\n componentDidMount() {\n const { imagesData } = this.props;\n if (imagesData) {\n this.handleElementClick({}, imagesData[0]);\n this.focusFirst = true;\n }\n }\n\n getDerivedStateFromProps(nextProps) {\n const { imagesData } = this.props;\n if (!imagesData && nextProps.imagesData) {\n this.setState({ selected: imagesData[0] });\n }\n }\n\n onReject = () => {\n const { onReject, onClose } = this.props;\n if (onReject) {\n onReject();\n } else {\n onClose();\n }\n };\n\n getUser(selected) {\n if (!selected) {\n return '';\n }\n const index = selected.createdBy.lastIndexOf('user:');\n if (index === -1) {\n return selected.createdBy;\n }\n return selected.createdBy.substring(index + 5);\n }\n\n handleElementClick = (e, image) => {\n if (e.key && e.key !== ' ') {\n return;\n }\n const { selected } = this.state;\n const { disableDoubleClick, onConfirm, onSelect } = this.props;\n if (image === selected && onConfirm && !disableDoubleClick) {\n onConfirm();\n return;\n }\n this.setState({\n selected: image,\n user: this.getUser(image),\n });\n if (onSelect) {\n onSelect(image);\n }\n };\n\n preventSpacebarScroll() {\n document.onkeypress = function (e) {\n if (!includes(e.target.className, elementClassName)) {\n return true;\n }\n e = e || window.event;\n const charCode = e.keyCode || e.which;\n if (charCode === 32) {\n e.preventDefault();\n return false;\n }\n return true;\n };\n }\n\n drawDiv(className, content) {\n return <div className={className}>{content}</div>;\n }\n\n drawLabel(className, label, value) {\n return (\n <div className={className}>\n <span className=\"label\">{label}</span>\n <span className=\"value\">{value}</span>\n </div>\n );\n }\n\n renderElements = () => {\n const { imagesData } = this.props;\n if (!imagesData) {\n return 'Empty';\n }\n const { selected } = this.state;\n return imagesData.map((image, idx) => {\n const extras = {};\n const { name, id } = image;\n if (this.focusFirst && idx === 0) {\n extras.ref = (element) => element && element.focus();\n this.focusFirst = undefined;\n } else if (selected && name === selected.name) {\n extras.ref = (element) => element && element.focus();\n }\n return (\n <div\n key={id || `${name}_${idx}`}\n className={elementClassName}\n onClick={(e) => this.handleElementClick(e, image)}\n onKeyUp={(e) => this.handleElementClick(e, image)}\n role=\"button\"\n tabIndex={0}\n {...extras}\n >\n <div className=\"content\">{name}</div>\n </div>\n );\n });\n };\n\n renderSpinner = () => <DSSpinner message=\"Loading...\" size=\"m\" />;\n\n renderError = () => <ImageMissing color={ICONS_COLORS.NEUTRAL} size={ICONS_SIZES.M} />;\n\n render() {\n const { selected, user } = this.state;\n const { containerProps, imagesData, onSelect, disableDoubleClick, ...modalProps } = this.props;\n return (\n <DSModal\n containerProps={containerProps}\n {...modalProps}\n className=\"em-ds-modal-image-library\"\n onReject={this.onReject}\n >\n <div className=\"wrapper\">\n <div className=\"col-1\">\n {this.drawDiv('title', 'Company Images')}\n {this.renderElements()}\n </div>\n <div className=\"col-2\">\n {this.drawDiv('title', selected ? selected.name : '')}\n <ImageLoader\n className=\"image-loader\"\n error={this.renderError}\n loading={this.renderSpinner}\n src={selected ? selected.url : ''}\n />\n {selected && (\n <div className=\"info\">\n {this.drawLabel('info-element', 'Created Date:', selected.createdDate)}\n {this.drawLabel('info-element', 'Created By:', user)}\n </div>\n )}\n </div>\n </div>\n </DSModal>\n );\n }\n}\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAAkB;AAClB,sBAAoB;AACpB,wBAAsB;AACtB,qBAAyE;AACzE,oBAAyB;AACzB,iCAAwB;AACxB,sBAA6B;AAE7B,MAAM,mBAAmB;AAEzB,oCAAmD,qBAAM,cAAc;AAAA,EACrE,YAAY,OAAO;AACjB,UAAM;AAuBR,oBAAW,MAAM;AACf,YAAM,EAAE,UAAU,YAAY,KAAK;AACnC,UAAI,UAAU;AACZ;AAAA,aACK;AACL;AAAA;AAAA;AAeJ,8BAAqB,CAAC,GAAG,UAAU;AACjC,UAAI,EAAE,OAAO,EAAE,QAAQ,KAAK;AAC1B;AAAA;AAEF,YAAM,EAAE,aAAa,KAAK;AAC1B,YAAM,EAAE,oBAAoB,WAAW,aAAa,KAAK;AACzD,UAAI,UAAU,YAAY,aAAa,CAAC,oBAAoB;AAC1D;AACA;AAAA;AAEF,WAAK,SAAS;AAAA,QACZ,UAAU;AAAA,QACV,MAAM,KAAK,QAAQ;AAAA;AAErB,UAAI,UAAU;AACZ,iBAAS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,MACV,OAAO,KAAK;AAAA,MACZ,SAAS,KAAK;AAAA,MACd,KAAK,WAAW,SAAS,MAAM;AAAA,QAEhC,YACC,mDAAC,OAAD;AAAA,MAAK,WAAU;AAAA,OACZ,KAAK,UAAU,gBAAgB,iBAAiB,SAAS,cACzD,KAAK,UAAU,gBAAgB,eAAe;AAAA;AAAA;",
6
+ "names": []
7
+ }
@@ -0,0 +1,35 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __reExport = (target, module2, copyDefault, desc) => {
13
+ if (module2 && typeof module2 === "object" || typeof module2 === "function") {
14
+ for (let key of __getOwnPropNames(module2))
15
+ if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
16
+ __defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
17
+ }
18
+ return target;
19
+ };
20
+ var __toESM = (module2, isNodeMode) => {
21
+ return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", !isNodeMode && module2 && module2.__esModule ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
22
+ };
23
+ var __toCommonJS = /* @__PURE__ */ ((cache) => {
24
+ return (module2, temp) => {
25
+ return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
26
+ };
27
+ })(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
28
+ var src_exports = {};
29
+ __export(src_exports, {
30
+ default: () => import_DSImageLibraryModal.default
31
+ });
32
+ var React = __toESM(require("react"));
33
+ var import_DSImageLibraryModal = __toESM(require("./DSImageLibraryModal"));
34
+ module.exports = __toCommonJS(src_exports);
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/index.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
+ "sourcesContent": ["export { default } from './DSImageLibraryModal';\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAAwB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,95 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
3
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
4
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
5
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
+ var __spreadValues = (a, b) => {
7
+ for (var prop in b || (b = {}))
8
+ if (__hasOwnProp.call(b, prop))
9
+ __defNormalProp(a, prop, b[prop]);
10
+ if (__getOwnPropSymbols)
11
+ for (var prop of __getOwnPropSymbols(b)) {
12
+ if (__propIsEnum.call(b, prop))
13
+ __defNormalProp(a, prop, b[prop]);
14
+ }
15
+ return a;
16
+ };
17
+ var __objRest = (source, exclude) => {
18
+ var target = {};
19
+ for (var prop in source)
20
+ if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
21
+ target[prop] = source[prop];
22
+ if (source != null && __getOwnPropSymbols)
23
+ for (var prop of __getOwnPropSymbols(source)) {
24
+ if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
25
+ target[prop] = source[prop];
26
+ }
27
+ return target;
28
+ };
29
+ import * as React from "react";
30
+ import React2 from "react";
31
+ import PropTypes from "prop-types";
32
+ import { MODAL_TYPE } from "@elliemae/ds-modal";
33
+ import { sizeOptions } from "@elliemae/ds-shared/constants";
34
+ import ImageLibraryModalImpl from "./components/ImageLibraryModalImpl";
35
+ const modalTypes = Object.values(MODAL_TYPE);
36
+ const DSImageLibraryModal = (_a) => {
37
+ var _b = _a, {
38
+ containerProps = {},
39
+ confirmLabel = "Add",
40
+ disableDoubleClick = false,
41
+ isOpen = true,
42
+ modalTitle = "Add Image",
43
+ modalType = modalTypes[2],
44
+ rejectLabel = "Cancel",
45
+ shouldCloseOnOverlayClick = true,
46
+ size = sizeOptions[3],
47
+ imagesData = [
48
+ {
49
+ url: "https://www.freeiconspng.com/minicovers/no-image-icon-6.png",
50
+ name: "no image",
51
+ createdBy: "user:John Doe",
52
+ createdDate: "0000-01-01 00:00 AM UTC"
53
+ }
54
+ ],
55
+ onSelect = () => null
56
+ } = _b, rest = __objRest(_b, [
57
+ "containerProps",
58
+ "confirmLabel",
59
+ "disableDoubleClick",
60
+ "isOpen",
61
+ "modalTitle",
62
+ "modalType",
63
+ "rejectLabel",
64
+ "shouldCloseOnOverlayClick",
65
+ "size",
66
+ "imagesData",
67
+ "onSelect"
68
+ ]);
69
+ return /* @__PURE__ */ React2.createElement(ImageLibraryModalImpl, __spreadValues({
70
+ confirmLabel,
71
+ containerProps,
72
+ disableDoubleClick,
73
+ imagesData,
74
+ isOpen,
75
+ modalTitle,
76
+ modalType,
77
+ onSelect,
78
+ rejectLabel,
79
+ shouldCloseOnOverlayClick,
80
+ size
81
+ }, rest));
82
+ };
83
+ DSImageLibraryModal.propTypes = {
84
+ containerProps: PropTypes.shape({}),
85
+ imagesData: PropTypes.arrayOf(PropTypes.shape({
86
+ url: PropTypes.string,
87
+ name: PropTypes.string
88
+ })),
89
+ onSelect: PropTypes.func
90
+ };
91
+ var DSImageLibraryModal_default = DSImageLibraryModal;
92
+ export {
93
+ DSImageLibraryModal_default as default
94
+ };
95
+ //# sourceMappingURL=DSImageLibraryModal.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DSImageLibraryModal.tsx"],
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React from 'react';\nimport PropTypes from 'prop-types';\nimport { MODAL_TYPE } from '@elliemae/ds-modal';\nimport { sizeOptions } from '@elliemae/ds-shared/constants';\nimport ImageLibraryModalImpl from './components/ImageLibraryModalImpl';\n\nconst modalTypes = Object.values(MODAL_TYPE);\n\nconst DSImageLibraryModal = ({\n containerProps = {},\n confirmLabel = 'Add',\n disableDoubleClick = false,\n isOpen = true,\n modalTitle = 'Add Image',\n modalType = modalTypes[2],\n rejectLabel = 'Cancel',\n shouldCloseOnOverlayClick = true,\n size = sizeOptions[3],\n imagesData = [\n {\n url: 'https://www.freeiconspng.com/minicovers/no-image-icon-6.png',\n name: 'no image',\n createdBy: 'user:John Doe',\n createdDate: '0000-01-01 00:00 AM UTC',\n },\n ],\n onSelect = () => null,\n ...rest\n}) => (\n <ImageLibraryModalImpl\n confirmLabel={confirmLabel}\n containerProps={containerProps}\n disableDoubleClick={disableDoubleClick}\n imagesData={imagesData}\n isOpen={isOpen}\n modalTitle={modalTitle}\n modalType={modalType}\n onSelect={onSelect}\n rejectLabel={rejectLabel}\n shouldCloseOnOverlayClick={shouldCloseOnOverlayClick}\n size={size}\n {...rest}\n />\n);\n\n/** Inherits DSModal props */\nDSImageLibraryModal.propTypes = {\n containerProps: PropTypes.shape({}),\n /** List of images src */\n imagesData: PropTypes.arrayOf(\n PropTypes.shape({\n url: PropTypes.string,\n name: PropTypes.string,\n }),\n ),\n /** Handler when user selects an image */\n onSelect: PropTypes.func,\n};\n\nexport default DSImageLibraryModal;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AAEA,MAAM,aAAa,OAAO,OAAO;AAEjC,MAAM,sBAAsB,CAAC,OAoB1B;AApB0B,eAC3B;AAAA,qBAAiB;AAAA,IACjB,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,SAAS;AAAA,IACT,aAAa;AAAA,IACb,YAAY,WAAW;AAAA,IACvB,cAAc;AAAA,IACd,4BAA4B;AAAA,IAC5B,OAAO,YAAY;AAAA,IACnB,aAAa;AAAA,MACX;AAAA,QACE,KAAK;AAAA,QACL,MAAM;AAAA,QACN,WAAW;AAAA,QACX,aAAa;AAAA;AAAA;AAAA,IAGjB,WAAW,MAAM;AAAA,MAlBU,IAmBxB,iBAnBwB,IAmBxB;AAAA,IAlBH;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IAQA;AAAA;AAGA,8CAAC,uBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,KACI;AAAA;AAKR,oBAAoB,YAAY;AAAA,EAC9B,gBAAgB,UAAU,MAAM;AAAA,EAEhC,YAAY,UAAU,QACpB,UAAU,MAAM;AAAA,IACd,KAAK,UAAU;AAAA,IACf,MAAM,UAAU;AAAA;AAAA,EAIpB,UAAU,UAAU;AAAA;AAGtB,IAAO,8BAAQ;",
6
+ "names": []
7
+ }