@splunk/react-ui 4.20.0 → 4.21.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.
- package/Accordion.js +425 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Image.js
CHANGED
|
@@ -1,563 +1,451 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
/******/
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/
|
|
49
|
-
/******/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/******/
|
|
53
|
-
/******/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/******/
|
|
57
|
-
/******/
|
|
58
|
-
/******/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
var
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
var Message_ = __webpack_require__(140);
|
|
228
|
-
var Message_default = /*#__PURE__*/__webpack_require__.n(Message_);
|
|
229
|
-
|
|
230
|
-
// CONCATENATED MODULE: ./src/Image/ImageStyles.ts
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
var StyledImagePreview = external_styled_components_default.a.div.withConfig({
|
|
236
|
-
displayName: "ImageStyles__StyledImagePreview",
|
|
237
|
-
componentId: "sc-16ooypp-0"
|
|
238
|
-
})(["position:relative;min-height:", ";", ""], Object(themes_["pick"])({
|
|
239
|
-
enterprise: '30px',
|
|
240
|
-
prisma: themes_["variables"].inputHeight
|
|
241
|
-
}), Object(themes_["pick"])({
|
|
242
|
-
enterprise: Object(external_styled_components_["css"])(["border:", ";"], themes_["variables"].border),
|
|
243
|
-
prisma: Object(external_styled_components_["css"])(["border-radius:", ";overflow:hidden;margin-top:12px;background-color:", ";"], themes_["variables"].borderRadius, themes_["variables"].interactiveColorBackground)
|
|
244
|
-
}));
|
|
245
|
-
var StyledLabelContainer = external_styled_components_default.a.div.withConfig({
|
|
246
|
-
displayName: "ImageStyles__StyledLabelContainer",
|
|
247
|
-
componentId: "sc-16ooypp-1"
|
|
248
|
-
})(["", ";flex-direction:row;justify-content:space-between;background-color:", ";color:", ";opacity:0.9;position:absolute;width:100%;"], themes_["mixins"].reset('flex'), Object(themes_["pick"])({
|
|
249
|
-
enterprise: {
|
|
250
|
-
light: themes_["variables"].gray92,
|
|
251
|
-
dark: themes_["variables"].gray30
|
|
252
|
-
},
|
|
253
|
-
prisma: themes_["mixins"].overlayColors(themes_["variables"].interactiveColorBackground, themes_["variables"].interactiveColorOverlaySelected)
|
|
254
|
-
}), themes_["variables"].contentColorMuted);
|
|
255
|
-
var StyledRemoveClickable = external_styled_components_default()(Clickable_default.a).withConfig({
|
|
256
|
-
displayName: "ImageStyles__StyledRemoveClickable",
|
|
257
|
-
componentId: "sc-16ooypp-2"
|
|
258
|
-
})(["cursor:pointer;", " padding:", ";text-align:center;height:inherit;&:focus{", "}&:hover{background-color:", ";color:", ";}"], Object(themes_["pick"])({
|
|
259
|
-
enterprise: Object(external_styled_components_["css"])(["flex:0 0 26px;"]),
|
|
260
|
-
prisma: Object(external_styled_components_["css"])(["color:", ";border-radius:50%;"], themes_["variables"].contentColorMuted)
|
|
261
|
-
}), Object(themes_["pick"])({
|
|
262
|
-
enterprise: '3px 0',
|
|
263
|
-
prisma: {
|
|
264
|
-
comfortable: '0 8px',
|
|
265
|
-
compact: '0 6px'
|
|
266
|
-
}
|
|
267
|
-
}), Object(themes_["pick"])({
|
|
268
|
-
enterprise: Object(external_styled_components_["css"])(["box-shadow:", ";color:", ";"], themes_["variables"].focusShadow, themes_["variables"].linkColor),
|
|
269
|
-
prisma: Object(external_styled_components_["css"])(["color:", ";background-color:", ";box-shadow:0 0 0 3px ", ";"], themes_["variables"].contentColorActive, themes_["variables"].interactiveColorOverlayHover, themes_["variables"].focusColor)
|
|
270
|
-
}), Object(themes_["pick"])({
|
|
271
|
-
enterprise: {
|
|
272
|
-
light: themes_["variables"].gray96,
|
|
273
|
-
dark: themes_["variables"].gray30
|
|
274
|
-
},
|
|
275
|
-
prisma: themes_["variables"].interactiveColorOverlayHover
|
|
276
|
-
}), Object(themes_["pick"])({
|
|
277
|
-
enterprise: themes_["variables"].linkColor,
|
|
278
|
-
prisma: themes_["variables"].contentColorActive
|
|
279
|
-
}));
|
|
280
|
-
var StyledLabel = external_styled_components_default.a.div.withConfig({
|
|
281
|
-
displayName: "ImageStyles__StyledLabel",
|
|
282
|
-
componentId: "sc-16ooypp-3"
|
|
283
|
-
})(["color:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1 0 0px;padding:", ";", ""], themes_["variables"].contentColorActive, Object(themes_["pick"])({
|
|
284
|
-
enterprise: '3px 0 3px 10px',
|
|
285
|
-
prisma: {
|
|
286
|
-
comfortable: '10px 10px',
|
|
287
|
-
compact: '6px 10px'
|
|
288
|
-
}
|
|
289
|
-
}), function (_ref) {
|
|
290
|
-
var $disabled = _ref.$disabled;
|
|
291
|
-
return $disabled && Object(external_styled_components_["css"])(["background-color:", ";color:", ";cursor:not-allowed;"], Object(themes_["pick"])({
|
|
292
|
-
enterprise: themes_["variables"].gray96,
|
|
293
|
-
prisma: themes_["variables"].interactiveColorBackgroundDisabled
|
|
294
|
-
}), themes_["variables"].contentColorDisabled);
|
|
295
|
-
});
|
|
296
|
-
var StyledImageThumbnail = external_styled_components_default.a.img.withConfig({
|
|
297
|
-
displayName: "ImageStyles__StyledImageThumbnail",
|
|
298
|
-
componentId: "sc-16ooypp-4"
|
|
299
|
-
})(["", ";margin:0 auto;max-height:", "px;max-width:100%;"], themes_["mixins"].reset('block'), function (props) {
|
|
300
|
-
return props.maxHeight;
|
|
301
|
-
});
|
|
302
|
-
var StyledErrorMessage = external_styled_components_default()(Message_default.a).withConfig({
|
|
303
|
-
displayName: "ImageStyles__StyledErrorMessage",
|
|
304
|
-
componentId: "sc-16ooypp-5"
|
|
305
|
-
})(["margin-top:", ";"], Object(themes_["pick"])({
|
|
306
|
-
enterprise: themes_["variables"].spacingQuarter,
|
|
307
|
-
prisma: '12px'
|
|
308
|
-
}));
|
|
309
|
-
|
|
310
|
-
// CONCATENATED MODULE: ./src/Image/Image.tsx
|
|
311
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
312
|
-
|
|
313
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
314
|
-
|
|
315
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
316
|
-
|
|
317
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
318
|
-
|
|
319
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
320
|
-
|
|
321
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
322
|
-
|
|
323
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
324
|
-
|
|
325
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
326
|
-
|
|
327
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
328
|
-
|
|
329
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
330
|
-
|
|
331
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
332
|
-
|
|
333
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
334
|
-
|
|
335
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var propTypes = {
|
|
348
|
-
allowExtensions: external_prop_types_default.a.arrayOf(external_prop_types_default.a.string),
|
|
349
|
-
defaultFilename: external_prop_types_default.a.string,
|
|
350
|
-
defaultImageDataURI: external_prop_types_default.a.string,
|
|
351
|
-
disabled: external_prop_types_default.a.bool,
|
|
352
|
-
dropAnywhere: external_prop_types_default.a.bool,
|
|
353
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
354
|
-
error: external_prop_types_default.a.bool,
|
|
355
|
-
maxHeight: external_prop_types_default.a.number,
|
|
356
|
-
onImageChange: external_prop_types_default.a.func
|
|
357
|
-
};
|
|
358
|
-
var defaultProps = {
|
|
359
|
-
allowExtensions: ['gif', 'jpeg', 'jpg', 'png'],
|
|
360
|
-
disabled: false,
|
|
361
|
-
dropAnywhere: false,
|
|
362
|
-
error: false,
|
|
363
|
-
maxHeight: 180
|
|
364
|
-
};
|
|
365
|
-
|
|
366
|
-
/**
|
|
367
|
-
* Image provides the ability to accept image files and present a preview of the image.
|
|
368
|
-
*/
|
|
369
|
-
var Image_Image = /*#__PURE__*/function (_Component) {
|
|
370
|
-
_inherits(Image, _Component);
|
|
371
|
-
|
|
372
|
-
var _super = _createSuper(Image);
|
|
373
|
-
|
|
374
|
-
_createClass(Image, null, [{
|
|
375
|
-
key: "isAllowedFilename",
|
|
376
|
-
// @docs-props-type ImagePropsBase
|
|
377
|
-
value: function isAllowedFilename(filename, allowExtensions) {
|
|
378
|
-
return !!filename && allowExtensions.some(function (extension) {
|
|
379
|
-
return endsWith_default()(toLower_default()(filename), ".".concat(toLower_default()(extension)));
|
|
380
|
-
});
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = r => {
|
|
12
|
+
/******/ var t = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(t, {
|
|
17
|
+
a: t
|
|
18
|
+
});
|
|
19
|
+
/******/ return t;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (r, t) => {
|
|
27
|
+
/******/ for (var a in t) {
|
|
28
|
+
/******/ if (e.o(t, a) && !e.o(r, a)) {
|
|
29
|
+
/******/ Object.defineProperty(r, a, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: t[a]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var r = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(r);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(r, {
|
|
64
|
+
default: () => /* reexport */ X
|
|
65
|
+
});
|
|
66
|
+
// CONCATENATED MODULE: external "react"
|
|
67
|
+
const t = require("react");
|
|
68
|
+
var a = e.n(t);
|
|
69
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
70
|
+
const o = require("prop-types");
|
|
71
|
+
var n = e.n(o);
|
|
72
|
+
// CONCATENATED MODULE: external "lodash/endsWith"
|
|
73
|
+
const i = require("lodash/endsWith");
|
|
74
|
+
var l = e.n(i);
|
|
75
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
76
|
+
const s = require("lodash/omit");
|
|
77
|
+
var c = e.n(s);
|
|
78
|
+
// CONCATENATED MODULE: external "lodash/toLower"
|
|
79
|
+
const u = require("lodash/toLower");
|
|
80
|
+
var p = e.n(u);
|
|
81
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/File"
|
|
82
|
+
const f = require("@splunk/react-ui/File");
|
|
83
|
+
var d = e.n(f);
|
|
84
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/format"
|
|
85
|
+
const m = require("@splunk/ui-utils/format");
|
|
86
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
87
|
+
const v = require("@splunk/ui-utils/i18n");
|
|
88
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
89
|
+
const b = require("@splunk/themes");
|
|
90
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/Cross"
|
|
91
|
+
const y = require("@splunk/react-icons/Cross");
|
|
92
|
+
var g = e.n(y);
|
|
93
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Close"
|
|
94
|
+
const h = require("@splunk/react-icons/enterprise/Close");
|
|
95
|
+
var x = e.n(h);
|
|
96
|
+
// CONCATENATED MODULE: ./src/Image/icons/Cross.tsx
|
|
97
|
+
var w = function e() {
|
|
98
|
+
var r = (0, b.useSplunkTheme)(), t = r.isEnterprise, o = r.isCompact;
|
|
99
|
+
var n = o ? "20px" : "24px";
|
|
100
|
+
var i = (0, v._)("Remove");
|
|
101
|
+
var l = t ? a().createElement(x(), {
|
|
102
|
+
hideDefaultTooltip: true,
|
|
103
|
+
screenReaderText: i
|
|
104
|
+
}) : a().createElement(g(), {
|
|
105
|
+
"aria-label": i,
|
|
106
|
+
height: n,
|
|
107
|
+
width: n
|
|
108
|
+
});
|
|
109
|
+
return l;
|
|
110
|
+
};
|
|
111
|
+
/* harmony default export */ const k = w;
|
|
112
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
113
|
+
const C = require("styled-components");
|
|
114
|
+
var R = e.n(C);
|
|
115
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
116
|
+
const S = require("@splunk/react-ui/Clickable");
|
|
117
|
+
var I = e.n(S);
|
|
118
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Message"
|
|
119
|
+
const _ = require("@splunk/react-ui/Message");
|
|
120
|
+
var O = e.n(_);
|
|
121
|
+
// CONCATENATED MODULE: ./src/Image/ImageStyles.ts
|
|
122
|
+
var E = R().div.withConfig({
|
|
123
|
+
displayName: "ImageStyles__StyledImagePreview",
|
|
124
|
+
componentId: "sc-16ooypp-0"
|
|
125
|
+
})([ "position:relative;min-height:", ";", "" ], (0, b.pick)({
|
|
126
|
+
enterprise: "30px",
|
|
127
|
+
prisma: b.variables.inputHeight
|
|
128
|
+
}), (0, b.pick)({
|
|
129
|
+
enterprise: (0, C.css)([ "border:", ";" ], b.variables.border),
|
|
130
|
+
prisma: (0, C.css)([ "border-radius:", ";overflow:hidden;margin-top:12px;background-color:", ";" ], b.variables.borderRadius, b.variables.interactiveColorBackground)
|
|
131
|
+
}));
|
|
132
|
+
var j = R().div.withConfig({
|
|
133
|
+
displayName: "ImageStyles__StyledLabelContainer",
|
|
134
|
+
componentId: "sc-16ooypp-1"
|
|
135
|
+
})([ "", ";flex-direction:row;justify-content:space-between;background-color:", ";color:", ";opacity:0.9;position:absolute;width:100%;" ], b.mixins.reset("flex"), (0,
|
|
136
|
+
b.pick)({
|
|
137
|
+
enterprise: {
|
|
138
|
+
light: b.variables.gray92,
|
|
139
|
+
dark: b.variables.gray30
|
|
140
|
+
},
|
|
141
|
+
prisma: b.mixins.overlayColors(b.variables.interactiveColorBackground, b.variables.interactiveColorOverlaySelected)
|
|
142
|
+
}), b.variables.contentColorMuted);
|
|
143
|
+
var q = R()(I()).withConfig({
|
|
144
|
+
displayName: "ImageStyles__StyledRemoveClickable",
|
|
145
|
+
componentId: "sc-16ooypp-2"
|
|
146
|
+
})([ "cursor:pointer;", " padding:", ";text-align:center;height:inherit;&:focus{", "}&:hover{background-color:", ";color:", ";}" ], (0,
|
|
147
|
+
b.pick)({
|
|
148
|
+
enterprise: (0, C.css)([ "flex:0 0 26px;" ]),
|
|
149
|
+
prisma: (0, C.css)([ "color:", ";border-radius:50%;" ], b.variables.contentColorMuted)
|
|
150
|
+
}), (0, b.pick)({
|
|
151
|
+
enterprise: "3px 0",
|
|
152
|
+
prisma: {
|
|
153
|
+
comfortable: "0 8px",
|
|
154
|
+
compact: "0 6px"
|
|
155
|
+
}
|
|
156
|
+
}), (0, b.pick)({
|
|
157
|
+
enterprise: (0, C.css)([ "box-shadow:", ";color:", ";" ], b.variables.focusShadow, b.variables.linkColor),
|
|
158
|
+
prisma: (0, C.css)([ "color:", ";background-color:", ";box-shadow:0 0 0 3px ", ";" ], b.variables.contentColorActive, b.variables.interactiveColorOverlayHover, b.variables.focusColor)
|
|
159
|
+
}), (0, b.pick)({
|
|
160
|
+
enterprise: {
|
|
161
|
+
light: b.variables.gray96,
|
|
162
|
+
dark: b.variables.gray30
|
|
163
|
+
},
|
|
164
|
+
prisma: b.variables.interactiveColorOverlayHover
|
|
165
|
+
}), (0, b.pick)({
|
|
166
|
+
enterprise: b.variables.linkColor,
|
|
167
|
+
prisma: b.variables.contentColorActive
|
|
168
|
+
}));
|
|
169
|
+
var D = R().div.withConfig({
|
|
170
|
+
displayName: "ImageStyles__StyledLabel",
|
|
171
|
+
componentId: "sc-16ooypp-3"
|
|
172
|
+
})([ "color:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1 0 0px;padding:", ";", "" ], b.variables.contentColorActive, (0,
|
|
173
|
+
b.pick)({
|
|
174
|
+
enterprise: "3px 0 3px 10px",
|
|
175
|
+
prisma: {
|
|
176
|
+
comfortable: "10px 10px",
|
|
177
|
+
compact: "6px 10px"
|
|
178
|
+
}
|
|
179
|
+
}), (function(e) {
|
|
180
|
+
var r = e.$disabled;
|
|
181
|
+
return r && (0, C.css)([ "background-color:", ";color:", ";cursor:not-allowed;" ], (0,
|
|
182
|
+
b.pick)({
|
|
183
|
+
enterprise: b.variables.gray96,
|
|
184
|
+
prisma: b.variables.interactiveColorBackgroundDisabled
|
|
185
|
+
}), b.variables.contentColorDisabled);
|
|
186
|
+
}));
|
|
187
|
+
var P = R().img.withConfig({
|
|
188
|
+
displayName: "ImageStyles__StyledImageThumbnail",
|
|
189
|
+
componentId: "sc-16ooypp-4"
|
|
190
|
+
})([ "", ";margin:0 auto;max-height:", "px;max-width:100%;" ], b.mixins.reset("block"), (function(e) {
|
|
191
|
+
return e.maxHeight;
|
|
192
|
+
}));
|
|
193
|
+
var A = R()(O()).withConfig({
|
|
194
|
+
displayName: "ImageStyles__StyledErrorMessage",
|
|
195
|
+
componentId: "sc-16ooypp-5"
|
|
196
|
+
})([ "margin-top:", ";" ], (0, b.pick)({
|
|
197
|
+
enterprise: b.variables.spacingQuarter,
|
|
198
|
+
prisma: "12px"
|
|
199
|
+
}));
|
|
200
|
+
// CONCATENATED MODULE: ./src/Image/Image.tsx
|
|
201
|
+
function F(e) {
|
|
202
|
+
"@babel/helpers - typeof";
|
|
203
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
204
|
+
F = function e(r) {
|
|
205
|
+
return typeof r;
|
|
206
|
+
};
|
|
207
|
+
} else {
|
|
208
|
+
F = function e(r) {
|
|
209
|
+
return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
return F(e);
|
|
213
|
+
}
|
|
214
|
+
function T() {
|
|
215
|
+
T = Object.assign || function(e) {
|
|
216
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
217
|
+
var t = arguments[r];
|
|
218
|
+
for (var a in t) {
|
|
219
|
+
if (Object.prototype.hasOwnProperty.call(t, a)) {
|
|
220
|
+
e[a] = t[a];
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
return e;
|
|
225
|
+
};
|
|
226
|
+
return T.apply(this, arguments);
|
|
381
227
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
var _this;
|
|
386
|
-
|
|
387
|
-
_classCallCheck(this, Image);
|
|
388
|
-
|
|
389
|
-
_this = _super.call(this, props);
|
|
390
|
-
|
|
391
|
-
_defineProperty(_assertThisInitialized(_this), "fileReader", void 0);
|
|
392
|
-
|
|
393
|
-
_defineProperty(_assertThisInitialized(_this), "handleAddFiles", function (files) {
|
|
394
|
-
if (files.length > 0) {
|
|
395
|
-
var file = files[0];
|
|
396
|
-
|
|
397
|
-
if (_this.fileReader.readyState === 1) {
|
|
398
|
-
_this.fileReader.abort();
|
|
228
|
+
function H(e, r) {
|
|
229
|
+
if (!(e instanceof r)) {
|
|
230
|
+
throw new TypeError("Cannot call a class as a function");
|
|
399
231
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
232
|
+
}
|
|
233
|
+
function U(e, r) {
|
|
234
|
+
for (var t = 0; t < r.length; t++) {
|
|
235
|
+
var a = r[t];
|
|
236
|
+
a.enumerable = a.enumerable || false;
|
|
237
|
+
a.configurable = true;
|
|
238
|
+
if ("value" in a) a.writable = true;
|
|
239
|
+
Object.defineProperty(e, a.key, a);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
function M(e, r, t) {
|
|
243
|
+
if (r) U(e.prototype, r);
|
|
244
|
+
if (t) U(e, t);
|
|
245
|
+
return e;
|
|
246
|
+
}
|
|
247
|
+
function N(e, r) {
|
|
248
|
+
if (typeof r !== "function" && r !== null) {
|
|
249
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
250
|
+
}
|
|
251
|
+
e.prototype = Object.create(r && r.prototype, {
|
|
252
|
+
constructor: {
|
|
253
|
+
value: e,
|
|
254
|
+
writable: true,
|
|
255
|
+
configurable: true
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
if (r) L(e, r);
|
|
259
|
+
}
|
|
260
|
+
function L(e, r) {
|
|
261
|
+
L = Object.setPrototypeOf || function e(r, t) {
|
|
262
|
+
r.__proto__ = t;
|
|
263
|
+
return r;
|
|
415
264
|
};
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
265
|
+
return L(e, r);
|
|
266
|
+
}
|
|
267
|
+
function B(e) {
|
|
268
|
+
var r = W();
|
|
269
|
+
return function t() {
|
|
270
|
+
var a = z(e), o;
|
|
271
|
+
if (r) {
|
|
272
|
+
var n = z(this).constructor;
|
|
273
|
+
o = Reflect.construct(a, arguments, n);
|
|
274
|
+
} else {
|
|
275
|
+
o = a.apply(this, arguments);
|
|
276
|
+
}
|
|
277
|
+
return $(this, o);
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
function $(e, r) {
|
|
281
|
+
if (r && (F(r) === "object" || typeof r === "function")) {
|
|
282
|
+
return r;
|
|
283
|
+
}
|
|
284
|
+
return Q(e);
|
|
285
|
+
}
|
|
286
|
+
function Q(e) {
|
|
287
|
+
if (e === void 0) {
|
|
288
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
289
|
+
}
|
|
290
|
+
return e;
|
|
291
|
+
}
|
|
292
|
+
function W() {
|
|
293
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
294
|
+
if (Reflect.construct.sham) return false;
|
|
295
|
+
if (typeof Proxy === "function") return true;
|
|
296
|
+
try {
|
|
297
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
298
|
+
return true;
|
|
299
|
+
} catch (e) {
|
|
300
|
+
return false;
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
function z(e) {
|
|
304
|
+
z = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
|
|
305
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
306
|
+
};
|
|
307
|
+
return z(e);
|
|
450
308
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
return ".".concat(extension);
|
|
464
|
-
}).join(', '); // TODO: Error text should be customizable, error should support a string prop for customization SUI-5414
|
|
465
|
-
|
|
466
|
-
var hasError = filename && !Image.isAllowedFilename(filename, allowExtensions) || error;
|
|
467
|
-
|
|
468
|
-
var errorText = Object(i18n_["_"])('This file extension is unsupported.');
|
|
469
|
-
|
|
470
|
-
var removeLabel = Object(format_["sprintf"])(Object(i18n_["_"])('Remove "%(filename)s"'), {
|
|
471
|
-
filename: filename
|
|
472
|
-
});
|
|
473
|
-
return /*#__PURE__*/external_react_default.a.createElement("div", {
|
|
474
|
-
"data-test": "image"
|
|
475
|
-
}, /*#__PURE__*/external_react_default.a.createElement(File_default.a, _extends({}, omit_default()(this.props, ['allowExtensions', 'defaultFilename', 'defaultImageDataURI', 'maxHeight', 'onImageChange']), {
|
|
476
|
-
accept: accept,
|
|
477
|
-
allowMultiple: false,
|
|
478
|
-
error: hasError,
|
|
479
|
-
onRequestAdd: this.handleAddFiles,
|
|
480
|
-
"data-test": "file"
|
|
481
|
-
}), filename && imageDataURI && !hasError && /*#__PURE__*/external_react_default.a.createElement(StyledImagePreview, null, /*#__PURE__*/external_react_default.a.createElement(StyledLabelContainer, null, /*#__PURE__*/external_react_default.a.createElement(StyledLabel, {
|
|
482
|
-
"data-test": "label",
|
|
483
|
-
$disabled: disabled
|
|
484
|
-
}, filename), !disabled && /*#__PURE__*/external_react_default.a.createElement(StyledRemoveClickable, {
|
|
485
|
-
onClick: this.handleRemoveFile,
|
|
486
|
-
"data-test": "remove",
|
|
487
|
-
"aria-label": removeLabel
|
|
488
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Cross, null))), /*#__PURE__*/external_react_default.a.createElement(StyledImageThumbnail, {
|
|
489
|
-
alt: filename,
|
|
490
|
-
"data-test": "preview",
|
|
491
|
-
maxHeight: maxHeight,
|
|
492
|
-
src: imageDataURI
|
|
493
|
-
}))), hasError && /*#__PURE__*/external_react_default.a.createElement(StyledErrorMessage, {
|
|
494
|
-
appearance: "fill",
|
|
495
|
-
type: "error"
|
|
496
|
-
}, errorText));
|
|
309
|
+
function G(e, r, t) {
|
|
310
|
+
if (r in e) {
|
|
311
|
+
Object.defineProperty(e, r, {
|
|
312
|
+
value: t,
|
|
313
|
+
enumerable: true,
|
|
314
|
+
configurable: true,
|
|
315
|
+
writable: true
|
|
316
|
+
});
|
|
317
|
+
} else {
|
|
318
|
+
e[r] = t;
|
|
319
|
+
}
|
|
320
|
+
return e;
|
|
497
321
|
}
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
322
|
+
var J = {
|
|
323
|
+
allowExtensions: n().arrayOf(n().string),
|
|
324
|
+
defaultFilename: n().string,
|
|
325
|
+
defaultImageDataURI: n().string,
|
|
326
|
+
disabled: n().bool,
|
|
327
|
+
dropAnywhere: n().bool,
|
|
328
|
+
elementRef: n().oneOfType([ n().func, n().object ]),
|
|
329
|
+
error: n().bool,
|
|
330
|
+
maxHeight: n().number,
|
|
331
|
+
onImageChange: n().func
|
|
332
|
+
};
|
|
333
|
+
var K = {
|
|
334
|
+
allowExtensions: [ "gif", "jpeg", "jpg", "png" ],
|
|
335
|
+
disabled: false,
|
|
336
|
+
dropAnywhere: false,
|
|
337
|
+
error: false,
|
|
338
|
+
maxHeight: 180
|
|
339
|
+
};
|
|
340
|
+
/**
|
|
341
|
+
* Image provides the ability to accept image files and present a preview of the image.
|
|
342
|
+
*/ var V = function(e) {
|
|
343
|
+
N(t, e);
|
|
344
|
+
var r = B(t);
|
|
345
|
+
M(t, null, [ {
|
|
346
|
+
key: "isAllowedFilename",
|
|
347
|
+
// @docs-props-type ImagePropsBase
|
|
348
|
+
value: function e(r, t) {
|
|
349
|
+
return !!r && t.some((function(e) {
|
|
350
|
+
return l()(p()(r), ".".concat(p()(e)));
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
353
|
+
} ]);
|
|
354
|
+
function t(e) {
|
|
355
|
+
var a;
|
|
356
|
+
H(this, t);
|
|
357
|
+
a = r.call(this, e);
|
|
358
|
+
G(Q(a), "fileReader", void 0);
|
|
359
|
+
G(Q(a), "handleAddFiles", (function(e) {
|
|
360
|
+
if (e.length > 0) {
|
|
361
|
+
var r = e[0];
|
|
362
|
+
if (a.fileReader.readyState === 1) {
|
|
363
|
+
a.fileReader.abort();
|
|
364
|
+
}
|
|
365
|
+
a.fileReader.onload = function() {
|
|
366
|
+
var e = {
|
|
367
|
+
filename: r.name,
|
|
368
|
+
imageDataURI: a.fileReader.result
|
|
369
|
+
};
|
|
370
|
+
a.setState(e);
|
|
371
|
+
if (t.isAllowedFilename(r.name, a.props.allowExtensions)) {
|
|
372
|
+
var o, n;
|
|
373
|
+
(o = (n = a.props).onImageChange) === null || o === void 0 ? void 0 : o.call(n, e);
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
a.fileReader.readAsDataURL(r);
|
|
377
|
+
}
|
|
378
|
+
}));
|
|
379
|
+
G(Q(a), "handleRemoveFile", (function() {
|
|
380
|
+
var e, r;
|
|
381
|
+
if (a.fileReader.readyState === 1) {
|
|
382
|
+
a.fileReader.abort();
|
|
383
|
+
}
|
|
384
|
+
var t = {
|
|
385
|
+
filename: null,
|
|
386
|
+
imageDataURI: null
|
|
387
|
+
};
|
|
388
|
+
a.setState(t);
|
|
389
|
+
(e = (r = a.props).onImageChange) === null || e === void 0 ? void 0 : e.call(r, t);
|
|
390
|
+
}));
|
|
391
|
+
a.state = {
|
|
392
|
+
filename: e.defaultFilename,
|
|
393
|
+
imageDataURI: e.defaultImageDataURI
|
|
394
|
+
};
|
|
395
|
+
a.fileReader = new FileReader;
|
|
396
|
+
return a;
|
|
397
|
+
}
|
|
398
|
+
M(t, [ {
|
|
399
|
+
key: "componentDidUpdate",
|
|
400
|
+
value: function e(r) {
|
|
401
|
+
if (false) {}
|
|
402
|
+
}
|
|
403
|
+
}, {
|
|
404
|
+
key: "render",
|
|
405
|
+
value: function e() {
|
|
406
|
+
var r = this.props, o = r.allowExtensions, n = r.maxHeight, i = r.disabled, l = r.error;
|
|
407
|
+
var s = this.state, u = s.filename, p = s.imageDataURI;
|
|
408
|
+
var f = o.map((function(e) {
|
|
409
|
+
return ".".concat(e);
|
|
410
|
+
})).join(", ");
|
|
411
|
+
// TODO: Error text should be customizable, error should support a string prop for customization SUI-5414
|
|
412
|
+
var b = u && !t.isAllowedFilename(u, o) || l;
|
|
413
|
+
var y = (0, v._)("This file extension is unsupported.");
|
|
414
|
+
var g = (0, m.sprintf)((0, v._)('Remove "%(filename)s"'), {
|
|
415
|
+
filename: u
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
return a().createElement("div", {
|
|
419
|
+
"data-test": "image"
|
|
420
|
+
}, a().createElement(d(), T({}, c()(this.props, [ "allowExtensions", "defaultFilename", "defaultImageDataURI", "maxHeight", "onImageChange" ]), {
|
|
421
|
+
accept: f,
|
|
422
|
+
allowMultiple: false,
|
|
423
|
+
error: b,
|
|
424
|
+
onRequestAdd: this.handleAddFiles,
|
|
425
|
+
"data-test": "file"
|
|
426
|
+
}), u && p && !b && a().createElement(E, null, a().createElement(j, null, a().createElement(D, {
|
|
427
|
+
"data-test": "label",
|
|
428
|
+
$disabled: i
|
|
429
|
+
}, u), !i && a().createElement(q, {
|
|
430
|
+
onClick: this.handleRemoveFile,
|
|
431
|
+
"data-test": "remove",
|
|
432
|
+
"aria-label": g
|
|
433
|
+
}, a().createElement(k, null))), a().createElement(P, {
|
|
434
|
+
alt: u,
|
|
435
|
+
"data-test": "preview",
|
|
436
|
+
maxHeight: n,
|
|
437
|
+
src: p
|
|
438
|
+
}))), b && a().createElement(A, {
|
|
439
|
+
appearance: "fill",
|
|
440
|
+
type: "error"
|
|
441
|
+
}, y));
|
|
442
|
+
}
|
|
443
|
+
} ]);
|
|
444
|
+
return t;
|
|
445
|
+
}(t.Component);
|
|
446
|
+
G(V, "propTypes", J);
|
|
447
|
+
G(V, "defaultProps", K);
|
|
448
|
+
/* harmony default export */ const X = V;
|
|
449
|
+
// CONCATENATED MODULE: ./src/Image/index.ts
|
|
450
|
+
module.exports = r;
|
|
451
|
+
/******/})();
|