@splunk/react-ui 4.21.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.
Files changed (83) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +7 -2
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/Image.js CHANGED
@@ -1,407 +1,451 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- "default": () => (/* reexport */ Image_Image)
55
- });
56
-
57
- ;// CONCATENATED MODULE: external "react"
58
- const external_react_namespaceObject = require("react");
59
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
60
- ;// CONCATENATED MODULE: external "prop-types"
61
- const external_prop_types_namespaceObject = require("prop-types");
62
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
63
- ;// CONCATENATED MODULE: external "lodash/endsWith"
64
- const endsWith_namespaceObject = require("lodash/endsWith");
65
- var endsWith_default = /*#__PURE__*/__webpack_require__.n(endsWith_namespaceObject);
66
- ;// CONCATENATED MODULE: external "lodash/omit"
67
- const omit_namespaceObject = require("lodash/omit");
68
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
69
- ;// CONCATENATED MODULE: external "lodash/toLower"
70
- const toLower_namespaceObject = require("lodash/toLower");
71
- var toLower_default = /*#__PURE__*/__webpack_require__.n(toLower_namespaceObject);
72
- ;// CONCATENATED MODULE: external "@splunk/react-ui/File"
73
- const File_namespaceObject = require("@splunk/react-ui/File");
74
- var File_default = /*#__PURE__*/__webpack_require__.n(File_namespaceObject);
75
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/format"
76
- const format_namespaceObject = require("@splunk/ui-utils/format");
77
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
78
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
79
- ;// CONCATENATED MODULE: external "@splunk/themes"
80
- const themes_namespaceObject = require("@splunk/themes");
81
- ;// CONCATENATED MODULE: external "@splunk/react-icons/Cross"
82
- const Cross_namespaceObject = require("@splunk/react-icons/Cross");
83
- var Cross_default = /*#__PURE__*/__webpack_require__.n(Cross_namespaceObject);
84
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Close"
85
- const Close_namespaceObject = require("@splunk/react-icons/enterprise/Close");
86
- var Close_default = /*#__PURE__*/__webpack_require__.n(Close_namespaceObject);
87
- ;// CONCATENATED MODULE: ./src/Image/icons/Cross.tsx
88
-
89
-
90
-
91
-
92
-
93
-
94
- var CrossIcon = function CrossIcon() {
95
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
96
- isEnterprise = _useSplunkTheme.isEnterprise,
97
- isCompact = _useSplunkTheme.isCompact;
98
-
99
- var prismaSize = isCompact ? '20px' : '24px';
100
-
101
- var removeScreenReaderText = (0,i18n_namespaceObject._)('Remove');
102
-
103
- var crossIconFamily = isEnterprise ? /*#__PURE__*/external_react_default().createElement((Close_default()), {
104
- hideDefaultTooltip: true,
105
- screenReaderText: removeScreenReaderText
106
- }) : /*#__PURE__*/external_react_default().createElement((Cross_default()), {
107
- "aria-label": removeScreenReaderText,
108
- height: prismaSize,
109
- width: prismaSize
110
- });
111
- return crossIconFamily;
112
- };
113
-
114
- /* harmony default export */ const Cross = (CrossIcon);
115
- ;// CONCATENATED MODULE: external "styled-components"
116
- const external_styled_components_namespaceObject = require("styled-components");
117
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
118
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
119
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
120
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
121
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Message"
122
- const Message_namespaceObject = require("@splunk/react-ui/Message");
123
- var Message_default = /*#__PURE__*/__webpack_require__.n(Message_namespaceObject);
124
- ;// CONCATENATED MODULE: ./src/Image/ImageStyles.ts
125
-
126
-
127
-
128
-
129
- var StyledImagePreview = external_styled_components_default().div.withConfig({
130
- displayName: "ImageStyles__StyledImagePreview",
131
- componentId: "sc-16ooypp-0"
132
- })(["position:relative;min-height:", ";", ""], (0,themes_namespaceObject.pick)({
133
- enterprise: '30px',
134
- prisma: themes_namespaceObject.variables.inputHeight
135
- }), (0,themes_namespaceObject.pick)({
136
- enterprise: (0,external_styled_components_namespaceObject.css)(["border:", ";"], themes_namespaceObject.variables.border),
137
- prisma: (0,external_styled_components_namespaceObject.css)(["border-radius:", ";overflow:hidden;margin-top:12px;background-color:", ";"], themes_namespaceObject.variables.borderRadius, themes_namespaceObject.variables.interactiveColorBackground)
138
- }));
139
- var StyledLabelContainer = external_styled_components_default().div.withConfig({
140
- displayName: "ImageStyles__StyledLabelContainer",
141
- componentId: "sc-16ooypp-1"
142
- })(["", ";flex-direction:row;justify-content:space-between;background-color:", ";color:", ";opacity:0.9;position:absolute;width:100%;"], themes_namespaceObject.mixins.reset('flex'), (0,themes_namespaceObject.pick)({
143
- enterprise: {
144
- light: themes_namespaceObject.variables.gray92,
145
- dark: themes_namespaceObject.variables.gray30
146
- },
147
- prisma: themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorBackground, themes_namespaceObject.variables.interactiveColorOverlaySelected)
148
- }), themes_namespaceObject.variables.contentColorMuted);
149
- var StyledRemoveClickable = external_styled_components_default()((Clickable_default())).withConfig({
150
- displayName: "ImageStyles__StyledRemoveClickable",
151
- componentId: "sc-16ooypp-2"
152
- })(["cursor:pointer;", " padding:", ";text-align:center;height:inherit;&:focus{", "}&:hover{background-color:", ";color:", ";}"], (0,themes_namespaceObject.pick)({
153
- enterprise: (0,external_styled_components_namespaceObject.css)(["flex:0 0 26px;"]),
154
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";border-radius:50%;"], themes_namespaceObject.variables.contentColorMuted)
155
- }), (0,themes_namespaceObject.pick)({
156
- enterprise: '3px 0',
157
- prisma: {
158
- comfortable: '0 8px',
159
- compact: '0 6px'
160
- }
161
- }), (0,themes_namespaceObject.pick)({
162
- enterprise: (0,external_styled_components_namespaceObject.css)(["box-shadow:", ";color:", ";"], themes_namespaceObject.variables.focusShadow, themes_namespaceObject.variables.linkColor),
163
- prisma: (0,external_styled_components_namespaceObject.css)(["color:", ";background-color:", ";box-shadow:0 0 0 3px ", ";"], themes_namespaceObject.variables.contentColorActive, themes_namespaceObject.variables.interactiveColorOverlayHover, themes_namespaceObject.variables.focusColor)
164
- }), (0,themes_namespaceObject.pick)({
165
- enterprise: {
166
- light: themes_namespaceObject.variables.gray96,
167
- dark: themes_namespaceObject.variables.gray30
168
- },
169
- prisma: themes_namespaceObject.variables.interactiveColorOverlayHover
170
- }), (0,themes_namespaceObject.pick)({
171
- enterprise: themes_namespaceObject.variables.linkColor,
172
- prisma: themes_namespaceObject.variables.contentColorActive
173
- }));
174
- var StyledLabel = external_styled_components_default().div.withConfig({
175
- displayName: "ImageStyles__StyledLabel",
176
- componentId: "sc-16ooypp-3"
177
- })(["color:", ";overflow:hidden;white-space:nowrap;text-overflow:ellipsis;flex:1 0 0px;padding:", ";", ""], themes_namespaceObject.variables.contentColorActive, (0,themes_namespaceObject.pick)({
178
- enterprise: '3px 0 3px 10px',
179
- prisma: {
180
- comfortable: '10px 10px',
181
- compact: '6px 10px'
182
- }
183
- }), function (_ref) {
184
- var $disabled = _ref.$disabled;
185
- return $disabled && (0,external_styled_components_namespaceObject.css)(["background-color:", ";color:", ";cursor:not-allowed;"], (0,themes_namespaceObject.pick)({
186
- enterprise: themes_namespaceObject.variables.gray96,
187
- prisma: themes_namespaceObject.variables.interactiveColorBackgroundDisabled
188
- }), themes_namespaceObject.variables.contentColorDisabled);
189
- });
190
- var StyledImageThumbnail = external_styled_components_default().img.withConfig({
191
- displayName: "ImageStyles__StyledImageThumbnail",
192
- componentId: "sc-16ooypp-4"
193
- })(["", ";margin:0 auto;max-height:", "px;max-width:100%;"], themes_namespaceObject.mixins.reset('block'), function (props) {
194
- return props.maxHeight;
195
- });
196
- var StyledErrorMessage = external_styled_components_default()((Message_default())).withConfig({
197
- displayName: "ImageStyles__StyledErrorMessage",
198
- componentId: "sc-16ooypp-5"
199
- })(["margin-top:", ";"], (0,themes_namespaceObject.pick)({
200
- enterprise: themes_namespaceObject.variables.spacingQuarter,
201
- prisma: '12px'
202
- }));
203
-
204
- ;// CONCATENATED MODULE: ./src/Image/Image.tsx
205
- 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); }
206
-
207
- 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); }
208
-
209
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
210
-
211
- 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); } }
212
-
213
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
214
-
215
- 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); }
216
-
217
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
218
-
219
- 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); }; }
220
-
221
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
222
-
223
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
224
-
225
- 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; } }
226
-
227
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
228
-
229
- 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; }
230
-
231
-
232
-
233
-
234
-
235
-
236
-
237
-
238
-
239
-
240
-
241
- var propTypes = {
242
- allowExtensions: external_prop_types_default().arrayOf((external_prop_types_default()).string),
243
- defaultFilename: (external_prop_types_default()).string,
244
- defaultImageDataURI: (external_prop_types_default()).string,
245
- disabled: (external_prop_types_default()).bool,
246
- dropAnywhere: (external_prop_types_default()).bool,
247
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
248
- error: (external_prop_types_default()).bool,
249
- maxHeight: (external_prop_types_default()).number,
250
- onImageChange: (external_prop_types_default()).func
251
- };
252
- var defaultProps = {
253
- allowExtensions: ['gif', 'jpeg', 'jpg', 'png'],
254
- disabled: false,
255
- dropAnywhere: false,
256
- error: false,
257
- maxHeight: 180
258
- };
259
-
260
- /**
261
- * Image provides the ability to accept image files and present a preview of the image.
262
- */
263
- var Image = /*#__PURE__*/function (_Component) {
264
- _inherits(Image, _Component);
265
-
266
- var _super = _createSuper(Image);
267
-
268
- _createClass(Image, null, [{
269
- key: "isAllowedFilename",
270
- // @docs-props-type ImagePropsBase
271
- value: function isAllowedFilename(filename, allowExtensions) {
272
- return !!filename && allowExtensions.some(function (extension) {
273
- return endsWith_default()(toLower_default()(filename), ".".concat(toLower_default()(extension)));
274
- });
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);
275
227
  }
276
- }]);
277
-
278
- function Image(props) {
279
- var _this;
280
-
281
- _classCallCheck(this, Image);
282
-
283
- _this = _super.call(this, props);
284
-
285
- _defineProperty(_assertThisInitialized(_this), "fileReader", void 0);
286
-
287
- _defineProperty(_assertThisInitialized(_this), "handleAddFiles", function (files) {
288
- if (files.length > 0) {
289
- var file = files[0];
290
-
291
- if (_this.fileReader.readyState === 1) {
292
- _this.fileReader.abort();
228
+ function H(e, r) {
229
+ if (!(e instanceof r)) {
230
+ throw new TypeError("Cannot call a class as a function");
293
231
  }
294
-
295
- _this.fileReader.onload = function () {
296
- var event = {
297
- filename: file.name,
298
- imageDataURI: _this.fileReader.result // TS: guaranteed by readAsDataURL call below (see spec)
299
-
300
- };
301
-
302
- _this.setState(event);
303
-
304
- if (Image.isAllowedFilename(file.name, _this.props.allowExtensions)) {
305
- var _this$props$onImageCh, _this$props;
306
-
307
- (_this$props$onImageCh = (_this$props = _this.props).onImageChange) === null || _this$props$onImageCh === void 0 ? void 0 : _this$props$onImageCh.call(_this$props, event);
308
- }
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;
309
264
  };
310
-
311
- _this.fileReader.readAsDataURL(file);
312
- }
313
- });
314
-
315
- _defineProperty(_assertThisInitialized(_this), "handleRemoveFile", function () {
316
- var _this$props$onImageCh2, _this$props2;
317
-
318
- if (_this.fileReader.readyState === 1) {
319
- _this.fileReader.abort();
320
- }
321
-
322
- var event = {
323
- filename: null,
324
- imageDataURI: null
325
- };
326
-
327
- _this.setState(event);
328
-
329
- (_this$props$onImageCh2 = (_this$props2 = _this.props).onImageChange) === null || _this$props$onImageCh2 === void 0 ? void 0 : _this$props$onImageCh2.call(_this$props2, event);
330
- });
331
-
332
- _this.state = {
333
- filename: props.defaultFilename,
334
- imageDataURI: props.defaultImageDataURI
335
- };
336
- _this.fileReader = new FileReader();
337
- return _this;
338
- }
339
-
340
- _createClass(Image, [{
341
- key: "componentDidUpdate",
342
- value: function componentDidUpdate(prevProps) {
343
- if (false) {}
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);
344
308
  }
345
- }, {
346
- key: "render",
347
- value: function render() {
348
- var _this$props3 = this.props,
349
- allowExtensions = _this$props3.allowExtensions,
350
- maxHeight = _this$props3.maxHeight,
351
- disabled = _this$props3.disabled,
352
- error = _this$props3.error;
353
- var _this$state = this.state,
354
- filename = _this$state.filename,
355
- imageDataURI = _this$state.imageDataURI;
356
- var accept = allowExtensions.map(function (extension) {
357
- return ".".concat(extension);
358
- }).join(', '); // TODO: Error text should be customizable, error should support a string prop for customization SUI-5414
359
-
360
- var hasError = filename && !Image.isAllowedFilename(filename, allowExtensions) || error;
361
-
362
- var errorText = (0,i18n_namespaceObject._)('This file extension is unsupported.');
363
-
364
- var removeLabel = (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Remove "%(filename)s"'), {
365
- filename: filename
366
- });
367
- return /*#__PURE__*/external_react_default().createElement("div", {
368
- "data-test": "image"
369
- }, /*#__PURE__*/external_react_default().createElement((File_default()), _extends({}, omit_default()(this.props, ['allowExtensions', 'defaultFilename', 'defaultImageDataURI', 'maxHeight', 'onImageChange']), {
370
- accept: accept,
371
- allowMultiple: false,
372
- error: hasError,
373
- onRequestAdd: this.handleAddFiles,
374
- "data-test": "file"
375
- }), filename && imageDataURI && !hasError && /*#__PURE__*/external_react_default().createElement(StyledImagePreview, null, /*#__PURE__*/external_react_default().createElement(StyledLabelContainer, null, /*#__PURE__*/external_react_default().createElement(StyledLabel, {
376
- "data-test": "label",
377
- $disabled: disabled
378
- }, filename), !disabled && /*#__PURE__*/external_react_default().createElement(StyledRemoveClickable, {
379
- onClick: this.handleRemoveFile,
380
- "data-test": "remove",
381
- "aria-label": removeLabel
382
- }, /*#__PURE__*/external_react_default().createElement(Cross, null))), /*#__PURE__*/external_react_default().createElement(StyledImageThumbnail, {
383
- alt: filename,
384
- "data-test": "preview",
385
- maxHeight: maxHeight,
386
- src: imageDataURI
387
- }))), hasError && /*#__PURE__*/external_react_default().createElement(StyledErrorMessage, {
388
- appearance: "fill",
389
- type: "error"
390
- }, 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;
391
321
  }
392
- }]);
393
-
394
- return Image;
395
- }(external_react_namespaceObject.Component);
396
-
397
- _defineProperty(Image, "propTypes", propTypes);
398
-
399
- _defineProperty(Image, "defaultProps", defaultProps);
400
-
401
- /* harmony default export */ const Image_Image = (Image);
402
- ;// CONCATENATED MODULE: ./src/Image/index.ts
403
-
404
-
405
- module.exports = __webpack_exports__;
406
- /******/ })()
407
- ;
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
+ /******/})();