@splunk/react-ui 4.21.0 → 4.22.0
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 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +24 -3
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1807 -2084
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1068 -1068
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +903 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1104 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3564 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +634 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +479 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +756 -650
- package/Select.js +2446 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +680 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +741 -680
- package/TabLayout.js +406 -322
- package/Table.js +4974 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +7 -7
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/Resize.js
CHANGED
|
@@ -1,500 +1,541 @@
|
|
|
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
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
var
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
var
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
var
|
|
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
|
-
var
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
})(["display:block;
|
|
129
|
-
var
|
|
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
|
-
|
|
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 = t => {
|
|
12
|
+
/******/ var r = t && t.__esModule ?
|
|
13
|
+
/******/ () => t["default"]
|
|
14
|
+
/******/ : () => t
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(r, {
|
|
17
|
+
a: r
|
|
18
|
+
});
|
|
19
|
+
/******/ return r;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (t, r) => {
|
|
27
|
+
/******/ for (var n in r) {
|
|
28
|
+
/******/ if (e.o(r, n) && !e.o(t, n)) {
|
|
29
|
+
/******/ Object.defineProperty(t, n, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: r[n]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
|
|
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 t = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(t);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(t, {
|
|
64
|
+
default: () => /* reexport */ G
|
|
65
|
+
});
|
|
66
|
+
// CONCATENATED MODULE: external "react"
|
|
67
|
+
const r = require("react");
|
|
68
|
+
var n = e.n(r);
|
|
69
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
70
|
+
const o = require("prop-types");
|
|
71
|
+
var i = e.n(o);
|
|
72
|
+
// CONCATENATED MODULE: external "lodash/keys"
|
|
73
|
+
const a = require("lodash/keys");
|
|
74
|
+
var s = e.n(a);
|
|
75
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
76
|
+
const l = require("lodash/omit");
|
|
77
|
+
var c = e.n(l);
|
|
78
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
|
|
79
|
+
const u = require("@splunk/react-ui/EventListener");
|
|
80
|
+
var d = e.n(u);
|
|
81
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
82
|
+
const f = require("@splunk/react-ui/ScreenReaderContent");
|
|
83
|
+
var p = e.n(f);
|
|
84
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
85
|
+
const h = require("@splunk/ui-utils/i18n");
|
|
86
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
87
|
+
const v = require("@splunk/ui-utils/keyboard");
|
|
88
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
89
|
+
const y = require("styled-components");
|
|
90
|
+
var w = e.n(y);
|
|
91
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
92
|
+
const m = require("@splunk/themes");
|
|
93
|
+
// CONCATENATED MODULE: ./src/Resize/ResizeStyles.ts
|
|
94
|
+
var b = "9px";
|
|
95
|
+
var g = "14px";
|
|
96
|
+
var S = "3px";
|
|
97
|
+
var z = "11px";
|
|
98
|
+
var R = w().div.withConfig({
|
|
99
|
+
displayName: "ResizeStyles__Styled",
|
|
100
|
+
componentId: "sc-181mwes-0"
|
|
101
|
+
})([ "", ";position:relative;overflow-x:hidden;overflow-y:hidden;" ], m.mixins.reset("block"));
|
|
102
|
+
var _ = w().div.withConfig({
|
|
103
|
+
displayName: "ResizeStyles__StyledBorder",
|
|
104
|
+
componentId: "sc-181mwes-1"
|
|
105
|
+
})([ "", ";height:100%;width:100%;border:0 solid ", ";", " ", " ", " ", "" ], m.mixins.reset("block"), (0,
|
|
106
|
+
m.pick)({
|
|
107
|
+
prisma: m.variables.interactiveColorBackground,
|
|
108
|
+
enterprise: {
|
|
109
|
+
dark: m.variables.gray22,
|
|
110
|
+
light: m.variables.white
|
|
111
|
+
}
|
|
112
|
+
}), (function(e) {
|
|
113
|
+
var t = e.$borderSides;
|
|
114
|
+
return t.n && (0, y.css)([ "border-top-width:", ";" ], b);
|
|
115
|
+
}), (function(e) {
|
|
116
|
+
var t = e.$borderSides;
|
|
117
|
+
return t.e && (0, y.css)([ "border-right-width:", ";" ], b);
|
|
118
|
+
}), (function(e) {
|
|
119
|
+
var t = e.$borderSides;
|
|
120
|
+
return t.s && (0, y.css)([ "border-bottom-width:", ";" ], b);
|
|
121
|
+
}), (function(e) {
|
|
122
|
+
var t = e.$borderSides;
|
|
123
|
+
return t.w && (0, y.css)([ "border-left-width:", ";" ], b);
|
|
124
|
+
}));
|
|
125
|
+
var x = w().svg.withConfig({
|
|
126
|
+
displayName: "ResizeStyles__StyledCornerSvg",
|
|
127
|
+
componentId: "sc-181mwes-2"
|
|
128
|
+
})([ "display:block;stroke:currentColor;" ]);
|
|
129
|
+
var O = w().path.withConfig({
|
|
130
|
+
displayName: "ResizeStyles__StyledCornerPath",
|
|
131
|
+
componentId: "sc-181mwes-3"
|
|
132
|
+
})([ "stroke-width:1.1px;" ]);
|
|
133
|
+
var k = w().svg.withConfig({
|
|
134
|
+
displayName: "ResizeStyles__StyledSideSvg",
|
|
135
|
+
componentId: "sc-181mwes-4"
|
|
136
|
+
})([ "display:block;fill:currentColor;" ]);
|
|
137
|
+
var D = (0, y.css)([ "", ";color:", ";&:hover,&:focus{color:", ";}", "" ], m.mixins.reset("block"), (0,
|
|
138
|
+
m.pick)({
|
|
139
|
+
prisma: m.variables.contentColorDefault,
|
|
140
|
+
enterprise: {
|
|
141
|
+
dark: m.variables.gray92,
|
|
142
|
+
light: m.variables.borderColor
|
|
143
|
+
}
|
|
144
|
+
}), (0, m.pick)({
|
|
145
|
+
prisma: m.variables.interactiveColorPrimary,
|
|
146
|
+
enterprise: m.variables.linkColor
|
|
147
|
+
}), (function(e) {
|
|
148
|
+
var t = e.$showHandles;
|
|
149
|
+
return t === "on-hover" && (0, y.css)([ "opacity:0;transition:opacity 200ms;", ":hover > div > &,&:focus{opacity:1;}" ],
|
|
150
|
+
/* sc-sel */
|
|
151
|
+
R);
|
|
152
|
+
}));
|
|
153
|
+
var E = (0, y.css)([ "", ";width:", ";height:", ";position:absolute;background-clip:content-box;z-index:2;" ], D, z, z);
|
|
154
|
+
var C = (0, y.css)([ "", ";position:absolute;z-index:1;" ], D);
|
|
155
|
+
var j = w().button.withConfig({
|
|
156
|
+
displayName: "ResizeStyles__StyledResize",
|
|
157
|
+
componentId: "sc-181mwes-5"
|
|
158
|
+
})([ "", "" ], (0, m.pickVariant)("$cardinalDirection", {
|
|
159
|
+
nw: (0, y.css)([ "", ";top:0;left:0;cursor:nwse-resize;> ", "{transform:rotate(180deg);}" ], E,
|
|
160
|
+
/* sc-sel */
|
|
161
|
+
x),
|
|
162
|
+
n: (0, y.css)([ "", ";cursor:ns-resize;top:0;left:calc(50% - ", " / 2);padding:", " 0;" ], C, g, S),
|
|
163
|
+
ne: (0, y.css)([ "", ";right:0;top:0;cursor:nesw-resize;> ", "{transform:rotate(-90deg);}" ], E,
|
|
164
|
+
/* sc-sel */
|
|
165
|
+
x),
|
|
166
|
+
w: (0, y.css)([ "", ";cursor:ew-resize;padding:0 ", ";left:0;top:calc(50% - ", " / 2);" ], C, S, g),
|
|
167
|
+
e: (0, y.css)([ "", ";cursor:ew-resize;padding:0 ", ";right:0;top:calc(50% - ", " / 2);" ], C, S, g),
|
|
168
|
+
sw: (0, y.css)([ "", ";left:0;bottom:0;cursor:nesw-resize;> ", "{transform:rotate(90deg);}" ], E,
|
|
169
|
+
/* sc-sel */
|
|
170
|
+
x),
|
|
171
|
+
s: (0, y.css)([ "", ";cursor:ns-resize;padding:", " 0;bottom:0;left:calc(50% - ", " / 2);" ], C, S, g),
|
|
172
|
+
se: (0, y.css)([ "", ";right:0;bottom:0;cursor:nwse-resize;" ], E)
|
|
173
|
+
}));
|
|
174
|
+
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
175
|
+
/**
|
|
168
176
|
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
169
177
|
*
|
|
170
178
|
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
171
179
|
* @param current - The new value of the ref.
|
|
172
180
|
*/
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
+
function q(e, t) {
|
|
182
|
+
if (e) {
|
|
183
|
+
if (typeof e === "function") {
|
|
184
|
+
e(t);
|
|
185
|
+
} else {
|
|
186
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
187
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
188
|
+
e.current = t;
|
|
189
|
+
// eslint-disable-line no-param-reassign
|
|
190
|
+
}
|
|
191
|
+
}
|
|
181
192
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
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; } }
|
|
208
|
-
|
|
209
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
210
|
-
|
|
211
|
-
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; }
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
var propTypes = {
|
|
224
|
-
appearance: external_prop_types_default().oneOf(['border', 'overlay']),
|
|
225
|
-
children: (external_prop_types_default()).node,
|
|
226
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
227
|
-
keyIncrement: (external_prop_types_default()).number,
|
|
228
|
-
onRequestResize: (external_prop_types_default()).func.isRequired,
|
|
229
|
-
resizeHandles: external_prop_types_default().arrayOf(external_prop_types_default().oneOf(['nw', 'n', 'ne', 'w', 'e', 'sw', 's', 'se'])).isRequired,
|
|
230
|
-
showHandles: external_prop_types_default().oneOf(['always', 'on-hover'])
|
|
231
|
-
};
|
|
232
|
-
var defaultProps = {
|
|
233
|
-
appearance: 'overlay',
|
|
234
|
-
keyIncrement: 10,
|
|
235
|
-
showHandles: 'always'
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Resize is a utility container with drag handles for resizing.
|
|
240
|
-
*/
|
|
241
|
-
var Resize = /*#__PURE__*/function (_Component) {
|
|
242
|
-
_inherits(Resize, _Component);
|
|
243
|
-
|
|
244
|
-
var _super = _createSuper(Resize);
|
|
245
|
-
|
|
246
|
-
// @docs-props-type ResizePropsBase
|
|
247
|
-
function Resize(props) {
|
|
248
|
-
var _this;
|
|
249
|
-
|
|
250
|
-
_classCallCheck(this, Resize);
|
|
251
|
-
|
|
252
|
-
_this = _super.call(this, props);
|
|
253
|
-
|
|
254
|
-
_defineProperty(_assertThisInitialized(_this), "handleMount", function (el) {
|
|
255
|
-
_this.setState({
|
|
256
|
-
el: el
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
updateReactRef(_this.props.elementRef, el);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
_defineProperty(_assertThisInitialized(_this), "handleDragStart", function (e, dragDirection) {
|
|
263
|
-
if (e.button > 0) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
e.preventDefault();
|
|
268
|
-
e.persist();
|
|
269
|
-
|
|
270
|
-
_this.setState(function (state) {
|
|
271
|
-
var _state$el, _state$el2;
|
|
272
|
-
|
|
273
|
-
return {
|
|
274
|
-
dragDirection: dragDirection,
|
|
275
|
-
startWidth: (_state$el = state.el) === null || _state$el === void 0 ? void 0 : _state$el.offsetWidth,
|
|
276
|
-
startHeight: (_state$el2 = state.el) === null || _state$el2 === void 0 ? void 0 : _state$el2.offsetHeight,
|
|
277
|
-
startX: e.clientX,
|
|
278
|
-
startY: e.clientY
|
|
193
|
+
// CONCATENATED MODULE: ./src/Resize/Resize.tsx
|
|
194
|
+
function P(e) {
|
|
195
|
+
"@babel/helpers - typeof";
|
|
196
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
197
|
+
P = function e(t) {
|
|
198
|
+
return typeof t;
|
|
199
|
+
};
|
|
200
|
+
} else {
|
|
201
|
+
P = function e(t) {
|
|
202
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
return P(e);
|
|
206
|
+
}
|
|
207
|
+
function H() {
|
|
208
|
+
H = Object.assign || function(e) {
|
|
209
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
210
|
+
var r = arguments[t];
|
|
211
|
+
for (var n in r) {
|
|
212
|
+
if (Object.prototype.hasOwnProperty.call(r, n)) {
|
|
213
|
+
e[n] = r[n];
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return e;
|
|
279
218
|
};
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
dragDirection: undefined
|
|
286
|
-
});
|
|
287
|
-
});
|
|
288
|
-
|
|
289
|
-
_defineProperty(_assertThisInitialized(_this), "handleDrag", function (e) {
|
|
290
|
-
var _this$state = _this.state,
|
|
291
|
-
dragDirection = _this$state.dragDirection,
|
|
292
|
-
_this$state$startWidt = _this$state.startWidth,
|
|
293
|
-
startWidth = _this$state$startWidt === void 0 ? 0 : _this$state$startWidt,
|
|
294
|
-
_this$state$startHeig = _this$state.startHeight,
|
|
295
|
-
startHeight = _this$state$startHeig === void 0 ? 0 : _this$state$startHeig,
|
|
296
|
-
_this$state$startX = _this$state.startX,
|
|
297
|
-
startX = _this$state$startX === void 0 ? 0 : _this$state$startX,
|
|
298
|
-
_this$state$startY = _this$state.startY,
|
|
299
|
-
startY = _this$state$startY === void 0 ? 0 : _this$state$startY;
|
|
300
|
-
var changeX = (dragDirection === null || dragDirection === void 0 ? void 0 : dragDirection.match(/(w|e)$/)) ? e.clientX - startX : 0;
|
|
301
|
-
var changeY = (dragDirection === null || dragDirection === void 0 ? void 0 : dragDirection.match(/^(s|n)/)) ? e.clientY - startY : 0;
|
|
302
|
-
var data = {
|
|
303
|
-
width: (dragDirection === null || dragDirection === void 0 ? void 0 : dragDirection.match(/w$/)) ? startWidth - changeX : startWidth + changeX,
|
|
304
|
-
height: (dragDirection === null || dragDirection === void 0 ? void 0 : dragDirection.match(/^n/)) ? startHeight - changeY : startHeight + changeY
|
|
305
|
-
};
|
|
306
|
-
|
|
307
|
-
_this.props.onRequestResize(e, data);
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e, dir) {
|
|
311
|
-
var keyIncrement = _this.props.keyIncrement;
|
|
312
|
-
var key = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
|
|
313
|
-
var lastDir = dir.slice(-1);
|
|
314
|
-
var widthMap = {
|
|
315
|
-
e: {
|
|
316
|
-
right: 1,
|
|
317
|
-
left: -1
|
|
318
|
-
},
|
|
319
|
-
w: {
|
|
320
|
-
right: -1,
|
|
321
|
-
left: 1
|
|
219
|
+
return H.apply(this, arguments);
|
|
220
|
+
}
|
|
221
|
+
function $(e, t) {
|
|
222
|
+
if (!(e instanceof t)) {
|
|
223
|
+
throw new TypeError("Cannot call a class as a function");
|
|
322
224
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
s: {
|
|
332
|
-
down: 1,
|
|
333
|
-
up: -1
|
|
225
|
+
}
|
|
226
|
+
function I(e, t) {
|
|
227
|
+
for (var r = 0; r < t.length; r++) {
|
|
228
|
+
var n = t[r];
|
|
229
|
+
n.enumerable = n.enumerable || false;
|
|
230
|
+
n.configurable = true;
|
|
231
|
+
if ("value" in n) n.writable = true;
|
|
232
|
+
Object.defineProperty(e, n.key, n);
|
|
334
233
|
}
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
e
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
var isCorner = dir.length > 1;
|
|
352
|
-
var handle;
|
|
353
|
-
|
|
354
|
-
if (isCorner) {
|
|
355
|
-
handle = /*#__PURE__*/external_react_default().createElement(StyledCornerSvg, {
|
|
356
|
-
viewBox: "0 0 11 11",
|
|
357
|
-
width: "11px",
|
|
358
|
-
height: "11px"
|
|
359
|
-
}, /*#__PURE__*/external_react_default().createElement(StyledCornerPath, {
|
|
360
|
-
d: "M0 8 L 8 0 M4 8 L 8 4"
|
|
361
|
-
}));
|
|
362
|
-
} else if (dir === 'n' || dir === 's') {
|
|
363
|
-
handle = /*#__PURE__*/external_react_default().createElement(StyledSideSvg, {
|
|
364
|
-
viewBox: "0 0 14 3",
|
|
365
|
-
width: "14px",
|
|
366
|
-
height: "3px"
|
|
367
|
-
}, /*#__PURE__*/external_react_default().createElement("rect", {
|
|
368
|
-
width: "14",
|
|
369
|
-
height: "1",
|
|
370
|
-
x: "0",
|
|
371
|
-
y: "0"
|
|
372
|
-
}), /*#__PURE__*/external_react_default().createElement("rect", {
|
|
373
|
-
width: "14",
|
|
374
|
-
height: "1",
|
|
375
|
-
x: "0",
|
|
376
|
-
y: "2"
|
|
377
|
-
}));
|
|
378
|
-
} else if (dir === 'e' || dir === 'w') {
|
|
379
|
-
handle = /*#__PURE__*/external_react_default().createElement(StyledSideSvg, {
|
|
380
|
-
viewBox: "0 0 3 14",
|
|
381
|
-
width: "3px",
|
|
382
|
-
height: "14px"
|
|
383
|
-
}, /*#__PURE__*/external_react_default().createElement("rect", {
|
|
384
|
-
width: "1",
|
|
385
|
-
height: "14",
|
|
386
|
-
x: "0",
|
|
387
|
-
y: "0"
|
|
388
|
-
}), /*#__PURE__*/external_react_default().createElement("rect", {
|
|
389
|
-
width: "1",
|
|
390
|
-
height: "14",
|
|
391
|
-
x: "2",
|
|
392
|
-
y: "0"
|
|
393
|
-
}));
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
return /*#__PURE__*/external_react_default().createElement(StyledResize, {
|
|
397
|
-
key: dir,
|
|
398
|
-
"data-test": "resize-handle-".concat(dir) // @ts-expect-error - guaranteed by constructor
|
|
399
|
-
,
|
|
400
|
-
onMouseDown: _this["handleDragStart".concat(dir)] // @ts-expect-error - guaranteed by constructor
|
|
401
|
-
,
|
|
402
|
-
onKeyDown: _this["handleKeyDown".concat(dir)],
|
|
403
|
-
$showHandles: showHandles,
|
|
404
|
-
$cardinalDirection: dir
|
|
405
|
-
}, handle, /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, Resize.handleLabels[dir]));
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
_this.state = {
|
|
409
|
-
el: null
|
|
410
|
-
}; // Generate handlers for each direction.
|
|
411
|
-
|
|
412
|
-
Resize.handleOrder.forEach(function (dir) {
|
|
413
|
-
// @ts-expect-error - dynamic function creation
|
|
414
|
-
_this["handleDragStart".concat(dir)] = function (e) {
|
|
415
|
-
_this.handleDragStart(e, dir);
|
|
416
|
-
}; // @ts-expect-error - dynamic function creation
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
_this["handleKeyDown".concat(dir)] = function (e) {
|
|
420
|
-
_this.handleKeyDown(e, dir);
|
|
421
|
-
};
|
|
422
|
-
});
|
|
423
|
-
return _this;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
_createClass(Resize, [{
|
|
427
|
-
key: "render",
|
|
428
|
-
value: function render() {
|
|
429
|
-
var _this$props = this.props,
|
|
430
|
-
appearance = _this$props.appearance,
|
|
431
|
-
children = _this$props.children,
|
|
432
|
-
resizeHandles = _this$props.resizeHandles;
|
|
433
|
-
var _this$state2 = this.state,
|
|
434
|
-
dragDirection = _this$state2.dragDirection,
|
|
435
|
-
el = _this$state2.el; // Handles are inserted before and after children to optimize tab order
|
|
436
|
-
|
|
437
|
-
var beforeHandles = Resize.handleOrder.slice(0, 4).filter(function (dir) {
|
|
438
|
-
return resizeHandles.indexOf(dir) > -1;
|
|
439
|
-
}).map(this.renderHandle);
|
|
440
|
-
var afterHandles = Resize.handleOrder.slice(4).filter(function (dir) {
|
|
441
|
-
return resizeHandles.indexOf(dir) > -1;
|
|
442
|
-
}).map(this.renderHandle);
|
|
443
|
-
/* When appearance is border, determine which sides need margin.
|
|
444
|
-
* Converts ['se', 'n'] to { e: true, s: true, n: true}
|
|
445
|
-
*/
|
|
446
|
-
|
|
447
|
-
var borderSides = {};
|
|
448
|
-
|
|
449
|
-
if (appearance === 'border') {
|
|
450
|
-
resizeHandles.join('').split('').filter(function (val, index, array) {
|
|
451
|
-
return array.indexOf(val) === index;
|
|
452
|
-
}).forEach(function (dir) {
|
|
453
|
-
borderSides[dir] = true;
|
|
234
|
+
}
|
|
235
|
+
function T(e, t, r) {
|
|
236
|
+
if (t) I(e.prototype, t);
|
|
237
|
+
if (r) I(e, r);
|
|
238
|
+
return e;
|
|
239
|
+
}
|
|
240
|
+
function M(e, t) {
|
|
241
|
+
if (typeof t !== "function" && t !== null) {
|
|
242
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
243
|
+
}
|
|
244
|
+
e.prototype = Object.create(t && t.prototype, {
|
|
245
|
+
constructor: {
|
|
246
|
+
value: e,
|
|
247
|
+
writable: true,
|
|
248
|
+
configurable: true
|
|
249
|
+
}
|
|
454
250
|
});
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
251
|
+
if (t) N(e, t);
|
|
252
|
+
}
|
|
253
|
+
function N(e, t) {
|
|
254
|
+
N = Object.setPrototypeOf || function e(t, r) {
|
|
255
|
+
t.__proto__ = r;
|
|
256
|
+
return t;
|
|
257
|
+
};
|
|
258
|
+
return N(e, t);
|
|
259
|
+
}
|
|
260
|
+
function B(e) {
|
|
261
|
+
var t = W();
|
|
262
|
+
return function r() {
|
|
263
|
+
var n = X(e), o;
|
|
264
|
+
if (t) {
|
|
265
|
+
var i = X(this).constructor;
|
|
266
|
+
o = Reflect.construct(n, arguments, i);
|
|
267
|
+
} else {
|
|
268
|
+
o = n.apply(this, arguments);
|
|
269
|
+
}
|
|
270
|
+
return K(this, o);
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
function K(e, t) {
|
|
274
|
+
if (t && (P(t) === "object" || typeof t === "function")) {
|
|
275
|
+
return t;
|
|
276
|
+
}
|
|
277
|
+
return L(e);
|
|
278
|
+
}
|
|
279
|
+
function L(e) {
|
|
280
|
+
if (e === void 0) {
|
|
281
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
282
|
+
}
|
|
283
|
+
return e;
|
|
471
284
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
;
|
|
285
|
+
function W() {
|
|
286
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
287
|
+
if (Reflect.construct.sham) return false;
|
|
288
|
+
if (typeof Proxy === "function") return true;
|
|
289
|
+
try {
|
|
290
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
291
|
+
return true;
|
|
292
|
+
} catch (e) {
|
|
293
|
+
return false;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
function X(e) {
|
|
297
|
+
X = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
|
|
298
|
+
return t.__proto__ || Object.getPrototypeOf(t);
|
|
299
|
+
};
|
|
300
|
+
return X(e);
|
|
301
|
+
}
|
|
302
|
+
function Y(e, t, r) {
|
|
303
|
+
if (t in e) {
|
|
304
|
+
Object.defineProperty(e, t, {
|
|
305
|
+
value: r,
|
|
306
|
+
enumerable: true,
|
|
307
|
+
configurable: true,
|
|
308
|
+
writable: true
|
|
309
|
+
});
|
|
310
|
+
} else {
|
|
311
|
+
e[t] = r;
|
|
312
|
+
}
|
|
313
|
+
return e;
|
|
314
|
+
}
|
|
315
|
+
var A = {
|
|
316
|
+
appearance: i().oneOf([ "border", "overlay" ]),
|
|
317
|
+
children: i().node,
|
|
318
|
+
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
319
|
+
keyIncrement: i().number,
|
|
320
|
+
onRequestResize: i().func.isRequired,
|
|
321
|
+
resizeHandles: i().arrayOf(i().oneOf([ "nw", "n", "ne", "w", "e", "sw", "s", "se" ])).isRequired,
|
|
322
|
+
showHandles: i().oneOf([ "always", "on-hover" ])
|
|
323
|
+
};
|
|
324
|
+
var F = {
|
|
325
|
+
appearance: "overlay",
|
|
326
|
+
keyIncrement: 10,
|
|
327
|
+
showHandles: "always"
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Resize is a utility container with drag handles for resizing.
|
|
331
|
+
*/ var V = function(e) {
|
|
332
|
+
M(r, e);
|
|
333
|
+
var t = B(r);
|
|
334
|
+
// @docs-props-type ResizePropsBase
|
|
335
|
+
function r(e) {
|
|
336
|
+
var o;
|
|
337
|
+
$(this, r);
|
|
338
|
+
o = t.call(this, e);
|
|
339
|
+
Y(L(o), "handleMount", (function(e) {
|
|
340
|
+
o.setState({
|
|
341
|
+
el: e
|
|
342
|
+
});
|
|
343
|
+
q(o.props.elementRef, e);
|
|
344
|
+
}));
|
|
345
|
+
Y(L(o), "handleDragStart", (function(e, t) {
|
|
346
|
+
if (e.button > 0) {
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
e.preventDefault();
|
|
350
|
+
e.persist();
|
|
351
|
+
o.setState((function(r) {
|
|
352
|
+
var n, o;
|
|
353
|
+
return {
|
|
354
|
+
dragDirection: t,
|
|
355
|
+
startWidth: (n = r.el) === null || n === void 0 ? void 0 : n.offsetWidth,
|
|
356
|
+
startHeight: (o = r.el) === null || o === void 0 ? void 0 : o.offsetHeight,
|
|
357
|
+
startX: e.clientX,
|
|
358
|
+
startY: e.clientY
|
|
359
|
+
};
|
|
360
|
+
}));
|
|
361
|
+
}));
|
|
362
|
+
Y(L(o), "handleDragEnd", (function() {
|
|
363
|
+
o.setState({
|
|
364
|
+
dragDirection: undefined
|
|
365
|
+
});
|
|
366
|
+
}));
|
|
367
|
+
Y(L(o), "handleDrag", (function(e) {
|
|
368
|
+
var t = o.state, r = t.dragDirection, n = t.startWidth, i = n === void 0 ? 0 : n, a = t.startHeight, s = a === void 0 ? 0 : a, l = t.startX, c = l === void 0 ? 0 : l, u = t.startY, d = u === void 0 ? 0 : u;
|
|
369
|
+
var f = (r === null || r === void 0 ? void 0 : r.match(/(w|e)$/)) ? e.clientX - c : 0;
|
|
370
|
+
var p = (r === null || r === void 0 ? void 0 : r.match(/^(s|n)/)) ? e.clientY - d : 0;
|
|
371
|
+
var h = {
|
|
372
|
+
width: (r === null || r === void 0 ? void 0 : r.match(/w$/)) ? i - f : i + f,
|
|
373
|
+
height: (r === null || r === void 0 ? void 0 : r.match(/^n/)) ? s - p : s + p
|
|
374
|
+
};
|
|
375
|
+
o.props.onRequestResize(e, h);
|
|
376
|
+
}));
|
|
377
|
+
Y(L(o), "handleKeyDown", (function(e, t) {
|
|
378
|
+
var r = o.props.keyIncrement;
|
|
379
|
+
var n = (0, v.keycode)(e.nativeEvent);
|
|
380
|
+
var i = t.slice(-1);
|
|
381
|
+
var a = {
|
|
382
|
+
e: {
|
|
383
|
+
right: 1,
|
|
384
|
+
left: -1
|
|
385
|
+
},
|
|
386
|
+
w: {
|
|
387
|
+
right: -1,
|
|
388
|
+
left: 1
|
|
389
|
+
}
|
|
390
|
+
};
|
|
391
|
+
var s = (i === "e" || i === "w") && (n === "right" || n === "left") ? a[i][n] : 0;
|
|
392
|
+
var l = t.charAt(0);
|
|
393
|
+
var c = {
|
|
394
|
+
n: {
|
|
395
|
+
down: -1,
|
|
396
|
+
up: 1
|
|
397
|
+
},
|
|
398
|
+
s: {
|
|
399
|
+
down: 1,
|
|
400
|
+
up: -1
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
var u = (l === "n" || l === "s") && (n === "up" || n === "down") ? c[l][n] : 0;
|
|
404
|
+
if ((s || u) && o.state.el) {
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
var d = {
|
|
407
|
+
width: o.state.el.offsetWidth + s * r,
|
|
408
|
+
height: o.state.el.offsetHeight + u * r
|
|
409
|
+
};
|
|
410
|
+
o.props.onRequestResize(e, d);
|
|
411
|
+
}
|
|
412
|
+
}));
|
|
413
|
+
Y(L(o), "renderHandle", (function(e) {
|
|
414
|
+
var t = o.props.showHandles;
|
|
415
|
+
var i = e.length > 1;
|
|
416
|
+
var a;
|
|
417
|
+
if (i) {
|
|
418
|
+
a = n().createElement(x, {
|
|
419
|
+
viewBox: "0 0 11 11",
|
|
420
|
+
width: "11px",
|
|
421
|
+
height: "11px"
|
|
422
|
+
}, n().createElement(O, {
|
|
423
|
+
d: "M0 8 L 8 0 M4 8 L 8 4"
|
|
424
|
+
}));
|
|
425
|
+
} else if (e === "n" || e === "s") {
|
|
426
|
+
a = n().createElement(k, {
|
|
427
|
+
viewBox: "0 0 14 3",
|
|
428
|
+
width: "14px",
|
|
429
|
+
height: "3px"
|
|
430
|
+
}, n().createElement("rect", {
|
|
431
|
+
width: "14",
|
|
432
|
+
height: "1",
|
|
433
|
+
x: "0",
|
|
434
|
+
y: "0"
|
|
435
|
+
}), n().createElement("rect", {
|
|
436
|
+
width: "14",
|
|
437
|
+
height: "1",
|
|
438
|
+
x: "0",
|
|
439
|
+
y: "2"
|
|
440
|
+
}));
|
|
441
|
+
} else if (e === "e" || e === "w") {
|
|
442
|
+
a = n().createElement(k, {
|
|
443
|
+
viewBox: "0 0 3 14",
|
|
444
|
+
width: "3px",
|
|
445
|
+
height: "14px"
|
|
446
|
+
}, n().createElement("rect", {
|
|
447
|
+
width: "1",
|
|
448
|
+
height: "14",
|
|
449
|
+
x: "0",
|
|
450
|
+
y: "0"
|
|
451
|
+
}), n().createElement("rect", {
|
|
452
|
+
width: "1",
|
|
453
|
+
height: "14",
|
|
454
|
+
x: "2",
|
|
455
|
+
y: "0"
|
|
456
|
+
}));
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
return n().createElement(j, {
|
|
460
|
+
key: e,
|
|
461
|
+
"data-test": "resize-handle-".concat(e),
|
|
462
|
+
onMouseDown: o["handleDragStart".concat(e)],
|
|
463
|
+
onKeyDown: o["handleKeyDown".concat(e)],
|
|
464
|
+
$showHandles: t,
|
|
465
|
+
$cardinalDirection: e
|
|
466
|
+
}, a, n().createElement(p(), null, r.handleLabels[e]));
|
|
467
|
+
}));
|
|
468
|
+
o.state = {
|
|
469
|
+
el: null
|
|
470
|
+
};
|
|
471
|
+
// Generate handlers for each direction.
|
|
472
|
+
r.handleOrder.forEach((function(e) {
|
|
473
|
+
// @ts-expect-error - dynamic function creation
|
|
474
|
+
o["handleDragStart".concat(e)] = function(t) {
|
|
475
|
+
o.handleDragStart(t, e);
|
|
476
|
+
};
|
|
477
|
+
// @ts-expect-error - dynamic function creation
|
|
478
|
+
o["handleKeyDown".concat(e)] = function(t) {
|
|
479
|
+
o.handleKeyDown(t, e);
|
|
480
|
+
};
|
|
481
|
+
}));
|
|
482
|
+
return o;
|
|
483
|
+
}
|
|
484
|
+
T(r, [ {
|
|
485
|
+
key: "render",
|
|
486
|
+
value: function e() {
|
|
487
|
+
var t = this.props, o = t.appearance, i = t.children, a = t.resizeHandles;
|
|
488
|
+
var l = this.state, u = l.dragDirection, f = l.el;
|
|
489
|
+
// Handles are inserted before and after children to optimize tab order
|
|
490
|
+
var p = r.handleOrder.slice(0, 4).filter((function(e) {
|
|
491
|
+
return a.indexOf(e) > -1;
|
|
492
|
+
})).map(this.renderHandle);
|
|
493
|
+
var h = r.handleOrder.slice(4).filter((function(e) {
|
|
494
|
+
return a.indexOf(e) > -1;
|
|
495
|
+
})).map(this.renderHandle);
|
|
496
|
+
/* When appearance is border, determine which sides need margin.
|
|
497
|
+
* Converts ['se', 'n'] to { e: true, s: true, n: true}
|
|
498
|
+
*/ var v = {};
|
|
499
|
+
if (o === "border") {
|
|
500
|
+
a.join("").split("").filter((function(e, t, r) {
|
|
501
|
+
return r.indexOf(e) === t;
|
|
502
|
+
})).forEach((function(e) {
|
|
503
|
+
v[e] = true;
|
|
504
|
+
}));
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
return n().createElement(R, H({
|
|
508
|
+
"data-test": "resize",
|
|
509
|
+
ref: this.handleMount
|
|
510
|
+
}, c()(this.props, s()(r.propTypes))), n().createElement(_, {
|
|
511
|
+
$borderSides: v
|
|
512
|
+
}, f && p, i, f && h, u && n().createElement(n().Fragment, null, n().createElement(d(), {
|
|
513
|
+
target: window,
|
|
514
|
+
eventType: "mousemove",
|
|
515
|
+
listener: this.handleDrag
|
|
516
|
+
}), n().createElement(d(), {
|
|
517
|
+
target: window,
|
|
518
|
+
eventType: "mouseup",
|
|
519
|
+
listener: this.handleDragEnd
|
|
520
|
+
}))));
|
|
521
|
+
}
|
|
522
|
+
} ]);
|
|
523
|
+
return r;
|
|
524
|
+
}(r.Component);
|
|
525
|
+
Y(V, "propTypes", A);
|
|
526
|
+
Y(V, "defaultProps", F);
|
|
527
|
+
Y(V, "handleOrder", [ "nw", "n", "ne", "w", "e", "sw", "s", "se" ]);
|
|
528
|
+
Y(V, "handleLabels", {
|
|
529
|
+
nw: (0, h._)("Resize northwest"),
|
|
530
|
+
n: (0, h._)("Resize north"),
|
|
531
|
+
ne: (0, h._)("Resize northeast"),
|
|
532
|
+
w: (0, h._)("Resize west"),
|
|
533
|
+
e: (0, h._)("Resize east"),
|
|
534
|
+
sw: (0, h._)("Resize southwest"),
|
|
535
|
+
s: (0, h._)("Resize south"),
|
|
536
|
+
se: (0, h._)("Resize southeast")
|
|
537
|
+
});
|
|
538
|
+
/* harmony default export */ const G = V;
|
|
539
|
+
// CONCATENATED MODULE: ./src/Resize/index.ts
|
|
540
|
+
module.exports = t;
|
|
541
|
+
/******/})();
|