victory-core 36.9.2 → 37.0.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/CHANGELOG.md +6 -0
- package/dist/victory-core.js +4371 -5749
- package/dist/victory-core.min.js +1 -1
- package/es/victory-accessible-group/victory-accessible-group.js +9 -15
- package/es/victory-animation/util.js +28 -47
- package/es/victory-animation/victory-animation.js +51 -67
- package/es/victory-clip-container/victory-clip-container.js +153 -229
- package/es/victory-container/victory-container.js +157 -216
- package/es/victory-label/victory-label.js +246 -323
- package/es/victory-portal/portal-context.js +1 -2
- package/es/victory-portal/portal.js +30 -76
- package/es/victory-portal/victory-portal.js +47 -104
- package/es/victory-primitives/arc.js +44 -47
- package/es/victory-primitives/background.js +14 -17
- package/es/victory-primitives/border.js +20 -24
- package/es/victory-primitives/circle.js +13 -27
- package/es/victory-primitives/clip-path.js +3 -7
- package/es/victory-primitives/line-segment.js +20 -24
- package/es/victory-primitives/line.js +13 -27
- package/es/victory-primitives/path.js +13 -27
- package/es/victory-primitives/point.js +36 -40
- package/es/victory-primitives/rect.js +13 -27
- package/es/victory-primitives/text.js +15 -28
- package/es/victory-primitives/tspan.js +13 -26
- package/es/victory-primitives/whisker.js +43 -47
- package/es/victory-theme/grayscale.js +22 -22
- package/es/victory-theme/material.js +46 -46
- package/es/victory-theme/victory-theme.js +3 -3
- package/es/victory-transition/victory-transition.js +126 -206
- package/es/victory-util/add-events.js +263 -374
- package/es/victory-util/axis.js +126 -222
- package/es/victory-util/collection.js +13 -41
- package/es/victory-util/data.js +159 -214
- package/es/victory-util/default-transitions.js +33 -51
- package/es/victory-util/domain.js +122 -171
- package/es/victory-util/events.js +168 -258
- package/es/victory-util/helpers.js +153 -178
- package/es/victory-util/hooks/use-animation-state.js +61 -99
- package/es/victory-util/hooks/use-previous-props.js +2 -2
- package/es/victory-util/immutable.js +6 -8
- package/es/victory-util/label-helpers.js +128 -130
- package/es/victory-util/line-helpers.js +29 -41
- package/es/victory-util/log.js +1 -1
- package/es/victory-util/point-path-helpers.js +89 -49
- package/es/victory-util/scale.js +24 -42
- package/es/victory-util/selection.js +39 -40
- package/es/victory-util/style.js +8 -13
- package/es/victory-util/textsize.js +80 -154
- package/es/victory-util/timer-context.js +2 -2
- package/es/victory-util/timer.js +40 -76
- package/es/victory-util/transitions.js +110 -150
- package/es/victory-util/type-helpers.js +2 -3
- package/es/victory-util/user-props.js +24 -49
- package/es/victory-util/wrapper.js +184 -247
- package/lib/index.js +0 -30
- package/lib/victory-accessible-group/victory-accessible-group.js +9 -19
- package/lib/victory-animation/util.js +28 -63
- package/lib/victory-animation/victory-animation.js +54 -83
- package/lib/victory-clip-container/victory-clip-container.js +156 -243
- package/lib/victory-container/victory-container.js +160 -232
- package/lib/victory-label/victory-label.js +248 -344
- package/lib/victory-portal/portal-context.js +1 -6
- package/lib/victory-portal/portal.js +31 -81
- package/lib/victory-portal/victory-portal.js +50 -116
- package/lib/victory-primitives/arc.js +48 -57
- package/lib/victory-primitives/background.js +16 -28
- package/lib/victory-primitives/border.js +22 -34
- package/lib/victory-primitives/circle.js +16 -36
- package/lib/victory-primitives/clip-path.js +3 -11
- package/lib/victory-primitives/index.js +0 -28
- package/lib/victory-primitives/line-segment.js +22 -34
- package/lib/victory-primitives/line.js +16 -36
- package/lib/victory-primitives/path.js +16 -36
- package/lib/victory-primitives/point.js +38 -52
- package/lib/victory-primitives/rect.js +16 -36
- package/lib/victory-primitives/text.js +15 -33
- package/lib/victory-primitives/tspan.js +13 -31
- package/lib/victory-primitives/whisker.js +45 -57
- package/lib/victory-theme/grayscale.js +23 -24
- package/lib/victory-theme/material.js +47 -48
- package/lib/victory-theme/victory-theme.js +2 -7
- package/lib/victory-transition/victory-transition.js +129 -224
- package/lib/victory-util/add-events.js +263 -380
- package/lib/victory-util/axis.js +128 -241
- package/lib/victory-util/collection.js +13 -50
- package/lib/victory-util/data.js +160 -239
- package/lib/victory-util/default-transitions.js +33 -54
- package/lib/victory-util/domain.js +123 -193
- package/lib/victory-util/events.js +167 -274
- package/lib/victory-util/helpers.js +156 -207
- package/lib/victory-util/hooks/index.js +0 -2
- package/lib/victory-util/hooks/use-animation-state.js +63 -113
- package/lib/victory-util/hooks/use-previous-props.js +2 -7
- package/lib/victory-util/immutable.js +6 -18
- package/lib/victory-util/index.js +2 -51
- package/lib/victory-util/label-helpers.js +130 -141
- package/lib/victory-util/line-helpers.js +31 -49
- package/lib/victory-util/log.js +1 -2
- package/lib/victory-util/point-path-helpers.js +91 -63
- package/lib/victory-util/scale.js +26 -57
- package/lib/victory-util/selection.js +41 -49
- package/lib/victory-util/style.js +8 -16
- package/lib/victory-util/textsize.js +80 -157
- package/lib/victory-util/timer-context.js +2 -8
- package/lib/victory-util/timer.js +40 -76
- package/lib/victory-util/transitions.js +110 -152
- package/lib/victory-util/type-helpers.js +2 -9
- package/lib/victory-util/user-props.js +25 -59
- package/lib/victory-util/wrapper.js +186 -281
- package/package.json +2 -2
|
@@ -4,258 +4,186 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VictoryContainer = void 0;
|
|
7
|
-
|
|
8
7
|
var _isObject2 = _interopRequireDefault(require("lodash/isObject"));
|
|
9
|
-
|
|
10
8
|
var _uniqueId2 = _interopRequireDefault(require("lodash/uniqueId"));
|
|
11
|
-
|
|
12
9
|
var _defaults2 = _interopRequireDefault(require("lodash/defaults"));
|
|
13
|
-
|
|
14
10
|
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
11
|
var _portal = require("../victory-portal/portal");
|
|
17
|
-
|
|
18
12
|
var _portalContext = require("../victory-portal/portal-context");
|
|
19
|
-
|
|
20
13
|
var _timerContext = _interopRequireDefault(require("../victory-util/timer-context"));
|
|
21
|
-
|
|
22
14
|
var Helpers = _interopRequireWildcard(require("../victory-util/helpers"));
|
|
23
|
-
|
|
24
15
|
var UserProps = _interopRequireWildcard(require("../victory-util/user-props"));
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
29
|
-
|
|
16
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
17
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
30
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
31
|
-
|
|
32
19
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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); }
|
|
20
|
+
class VictoryContainer extends _react.default.Component {
|
|
21
|
+
static displayName = "VictoryContainer";
|
|
22
|
+
static role = "container";
|
|
23
|
+
static defaultProps = {
|
|
24
|
+
className: "VictoryContainer",
|
|
25
|
+
portalComponent: /*#__PURE__*/_react.default.createElement(_portal.Portal, null),
|
|
26
|
+
portalZIndex: 99,
|
|
27
|
+
responsive: true,
|
|
28
|
+
role: "img"
|
|
29
|
+
};
|
|
30
|
+
static contextType = _timerContext.default;
|
|
33
31
|
|
|
34
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
-
|
|
36
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
37
|
-
|
|
38
|
-
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; }
|
|
39
|
-
|
|
40
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
41
|
-
|
|
42
|
-
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); } }
|
|
43
|
-
|
|
44
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
45
|
-
|
|
46
|
-
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 } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
47
|
-
|
|
48
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
49
|
-
|
|
50
|
-
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); }; }
|
|
51
|
-
|
|
52
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
53
|
-
|
|
54
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
55
|
-
|
|
56
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
57
|
-
|
|
58
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
59
|
-
|
|
60
|
-
var VictoryContainer = /*#__PURE__*/function (_React$Component) {
|
|
61
|
-
_inherits(VictoryContainer, _React$Component);
|
|
62
|
-
|
|
63
|
-
var _super = _createSuper(VictoryContainer);
|
|
64
|
-
|
|
65
|
-
// @ts-expect-error Ref will be initialized on mount
|
|
66
32
|
// @ts-expect-error Ref will be initialized on mount
|
|
67
|
-
function VictoryContainer(props) {
|
|
68
|
-
var _this;
|
|
69
|
-
|
|
70
|
-
_classCallCheck(this, VictoryContainer);
|
|
71
|
-
|
|
72
|
-
_this = _super.call(this, props);
|
|
73
|
-
_this.containerId = void 0;
|
|
74
|
-
_this.portalRef = void 0;
|
|
75
|
-
_this.containerRef = void 0;
|
|
76
|
-
_this.shouldHandleWheel = void 0;
|
|
77
|
-
|
|
78
|
-
_this.savePortalRef = function (portal) {
|
|
79
|
-
_this.portalRef = portal;
|
|
80
|
-
return portal;
|
|
81
|
-
};
|
|
82
33
|
|
|
83
|
-
|
|
84
|
-
return _this.portalRef.portalUpdate(key, el);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
_this.portalRegister = function () {
|
|
88
|
-
return _this.portalRef.portalRegister();
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
_this.portalDeregister = function (key) {
|
|
92
|
-
return _this.portalRef.portalDeregister(key);
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
_this.saveContainerRef = function (container) {
|
|
96
|
-
if (Helpers.isFunction(_this.props.containerRef)) {
|
|
97
|
-
_this.props.containerRef(container);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
_this.containerRef = container;
|
|
101
|
-
return container;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
_this.handleWheel = function (e) {
|
|
105
|
-
return e.preventDefault();
|
|
106
|
-
};
|
|
34
|
+
// @ts-expect-error Ref will be initialized on mount
|
|
107
35
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
36
|
+
constructor(props) {
|
|
37
|
+
super(props);
|
|
38
|
+
this.containerId = !(0, _isObject2.default)(props) || props.containerId === undefined ? (0, _uniqueId2.default)("victory-container-") : props.containerId;
|
|
39
|
+
this.shouldHandleWheel = !!(props && props.events && props.events.onWheel);
|
|
111
40
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
41
|
+
savePortalRef = portal => {
|
|
42
|
+
this.portalRef = portal;
|
|
43
|
+
return portal;
|
|
44
|
+
};
|
|
45
|
+
portalUpdate = (key, el) => this.portalRef.portalUpdate(key, el);
|
|
46
|
+
portalRegister = () => this.portalRef.portalRegister();
|
|
47
|
+
portalDeregister = key => this.portalRef.portalDeregister(key);
|
|
48
|
+
saveContainerRef = container => {
|
|
49
|
+
if (Helpers.isFunction(this.props.containerRef)) {
|
|
50
|
+
this.props.containerRef(container);
|
|
119
51
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
52
|
+
this.containerRef = container;
|
|
53
|
+
return container;
|
|
54
|
+
};
|
|
55
|
+
handleWheel = e => e.preventDefault();
|
|
56
|
+
componentDidMount() {
|
|
57
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
58
|
+
this.containerRef.addEventListener("wheel", this.handleWheel);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
componentWillUnmount() {
|
|
62
|
+
if (this.shouldHandleWheel && this.containerRef) {
|
|
63
|
+
this.containerRef.removeEventListener("wheel", this.handleWheel);
|
|
126
64
|
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} // overridden in custom containers
|
|
65
|
+
}
|
|
66
|
+
getIdForElement(elementName) {
|
|
67
|
+
return `${this.containerId}-${elementName}`;
|
|
68
|
+
}
|
|
132
69
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
} // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
|
|
138
|
-
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
|
|
70
|
+
// overridden in custom containers
|
|
71
|
+
getChildren(props) {
|
|
72
|
+
return props.children;
|
|
73
|
+
}
|
|
139
74
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
75
|
+
// Get props defined by the Open UI Automation (OUIA) 1.0-RC spec
|
|
76
|
+
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component
|
|
77
|
+
getOUIAProps(props) {
|
|
78
|
+
const {
|
|
79
|
+
ouiaId,
|
|
80
|
+
ouiaSafe,
|
|
81
|
+
ouiaType
|
|
82
|
+
} = props;
|
|
83
|
+
return {
|
|
84
|
+
...(ouiaId && {
|
|
147
85
|
"data-ouia-component-id": ouiaId
|
|
148
|
-
}),
|
|
86
|
+
}),
|
|
87
|
+
...(ouiaType && {
|
|
149
88
|
"data-ouia-component-type": ouiaType
|
|
150
|
-
}),
|
|
89
|
+
}),
|
|
90
|
+
...(ouiaSafe !== undefined && {
|
|
151
91
|
"data-ouia-safe": ouiaSafe
|
|
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
|
-
|
|
181
|
-
|
|
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
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
exports.VictoryContainer = VictoryContainer;
|
|
252
|
-
VictoryContainer.displayName = "VictoryContainer";
|
|
253
|
-
VictoryContainer.role = "container";
|
|
254
|
-
VictoryContainer.defaultProps = {
|
|
255
|
-
className: "VictoryContainer",
|
|
256
|
-
portalComponent: /*#__PURE__*/_react.default.createElement(_portal.Portal, null),
|
|
257
|
-
portalZIndex: 99,
|
|
258
|
-
responsive: true,
|
|
259
|
-
role: "img"
|
|
260
|
-
};
|
|
261
|
-
VictoryContainer.contextType = _timerContext.default;
|
|
92
|
+
})
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
renderContainer(props, svgProps, style) {
|
|
96
|
+
const {
|
|
97
|
+
title,
|
|
98
|
+
desc,
|
|
99
|
+
portalComponent,
|
|
100
|
+
className,
|
|
101
|
+
width,
|
|
102
|
+
height,
|
|
103
|
+
portalZIndex,
|
|
104
|
+
responsive
|
|
105
|
+
} = props;
|
|
106
|
+
const children = this.getChildren(props);
|
|
107
|
+
const dimensions = responsive ? {
|
|
108
|
+
width: "100%",
|
|
109
|
+
height: "100%"
|
|
110
|
+
} : {
|
|
111
|
+
width,
|
|
112
|
+
height
|
|
113
|
+
};
|
|
114
|
+
const divStyle = Object.assign({
|
|
115
|
+
pointerEvents: "none",
|
|
116
|
+
touchAction: "none",
|
|
117
|
+
position: "relative"
|
|
118
|
+
}, dimensions);
|
|
119
|
+
const portalDivStyle = Object.assign({
|
|
120
|
+
zIndex: portalZIndex,
|
|
121
|
+
position: "absolute",
|
|
122
|
+
top: 0,
|
|
123
|
+
left: 0
|
|
124
|
+
}, dimensions);
|
|
125
|
+
const svgStyle = Object.assign({
|
|
126
|
+
pointerEvents: "all"
|
|
127
|
+
}, dimensions);
|
|
128
|
+
const portalSvgStyle = Object.assign({
|
|
129
|
+
overflow: "visible"
|
|
130
|
+
}, dimensions);
|
|
131
|
+
const portalProps = {
|
|
132
|
+
width,
|
|
133
|
+
height,
|
|
134
|
+
viewBox: svgProps.viewBox,
|
|
135
|
+
preserveAspectRatio: svgProps.preserveAspectRatio,
|
|
136
|
+
style: portalSvgStyle
|
|
137
|
+
};
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_portalContext.PortalContext.Provider, {
|
|
139
|
+
value: {
|
|
140
|
+
portalUpdate: this.portalUpdate,
|
|
141
|
+
portalRegister: this.portalRegister,
|
|
142
|
+
portalDeregister: this.portalDeregister
|
|
143
|
+
}
|
|
144
|
+
}, /*#__PURE__*/_react.default.createElement("div", _extends({
|
|
145
|
+
style: (0, _defaults2.default)({}, style, divStyle),
|
|
146
|
+
className: className,
|
|
147
|
+
ref: this.saveContainerRef
|
|
148
|
+
}, this.getOUIAProps(props)), /*#__PURE__*/_react.default.createElement("svg", _extends({}, svgProps, {
|
|
149
|
+
style: svgStyle
|
|
150
|
+
}), title ? /*#__PURE__*/_react.default.createElement("title", {
|
|
151
|
+
id: this.getIdForElement("title")
|
|
152
|
+
}, title) : null, desc ? /*#__PURE__*/_react.default.createElement("desc", {
|
|
153
|
+
id: this.getIdForElement("desc")
|
|
154
|
+
}, desc) : null, children), /*#__PURE__*/_react.default.createElement("div", {
|
|
155
|
+
style: portalDivStyle
|
|
156
|
+
}, /*#__PURE__*/_react.default.cloneElement(portalComponent, {
|
|
157
|
+
...portalProps,
|
|
158
|
+
ref: this.savePortalRef
|
|
159
|
+
}))));
|
|
160
|
+
}
|
|
161
|
+
render() {
|
|
162
|
+
const {
|
|
163
|
+
width,
|
|
164
|
+
height,
|
|
165
|
+
responsive,
|
|
166
|
+
events,
|
|
167
|
+
title,
|
|
168
|
+
desc,
|
|
169
|
+
tabIndex,
|
|
170
|
+
preserveAspectRatio,
|
|
171
|
+
role
|
|
172
|
+
} = this.props;
|
|
173
|
+
const style = responsive ? this.props.style : Helpers.omit(this.props.style, ["height", "width"]);
|
|
174
|
+
const userProps = UserProps.getSafeUserProps(this.props);
|
|
175
|
+
const svgProps = Object.assign({
|
|
176
|
+
width,
|
|
177
|
+
height,
|
|
178
|
+
tabIndex,
|
|
179
|
+
role,
|
|
180
|
+
"aria-labelledby": [title && this.getIdForElement("title"), this.props["aria-labelledby"]].filter(Boolean).join(" ") || undefined,
|
|
181
|
+
"aria-describedby": [desc && this.getIdForElement("desc"), this.props["aria-describedby"]].filter(Boolean).join(" ") || undefined,
|
|
182
|
+
viewBox: responsive ? `0 0 ${width} ${height}` : undefined,
|
|
183
|
+
preserveAspectRatio: responsive ? preserveAspectRatio : undefined,
|
|
184
|
+
...userProps
|
|
185
|
+
}, events);
|
|
186
|
+
return this.renderContainer(this.props, svgProps, style);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
exports.VictoryContainer = VictoryContainer;
|