victory-core
Advanced tools
Comparing version
@@ -244,2 +244,5 @@ import * as React from "react"; | ||
origin?: OriginType; | ||
ouiaId?: number | string; | ||
ouiaSafe?: boolean; | ||
ouiaType?: string; | ||
polar?: boolean; | ||
@@ -246,0 +249,0 @@ portalComponent?: React.ReactElement; |
@@ -7,2 +7,4 @@ import _isFunction from "lodash/isFunction"; | ||
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); } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
@@ -12,4 +14,2 @@ | ||
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); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -104,2 +104,18 @@ | ||
return props.children; | ||
} // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec | ||
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component | ||
}, { | ||
key: "getOUIAProps", | ||
value: function getOUIAProps(props) { | ||
var ouiaId = props.ouiaId, | ||
ouiaSafe = props.ouiaSafe, | ||
ouiaType = props.ouiaType; | ||
return _objectSpread({}, ouiaId && { | ||
"data-ouia-component-id": ouiaId | ||
}, ouiaType && { | ||
"data-ouia-component-type": ouiaType | ||
}, ouiaSafe !== undefined && { | ||
"data-ouia-safe": ouiaSafe | ||
}); | ||
} | ||
@@ -159,7 +175,7 @@ }, { | ||
} | ||
}, React.createElement("div", { | ||
}, React.createElement("div", _extends({ | ||
style: _defaults({}, style, divStyle), | ||
className: className, | ||
ref: this.saveContainerRef | ||
}, React.createElement("svg", _extends({}, svgProps, { | ||
}, this.getOUIAProps(props)), React.createElement("svg", _extends({}, svgProps, { | ||
style: svgStyle | ||
@@ -235,2 +251,5 @@ }), title ? React.createElement("title", { | ||
}), | ||
ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
ouiaSafe: PropTypes.boolean, | ||
ouiaType: PropTypes.string, | ||
polar: PropTypes.bool, | ||
@@ -237,0 +256,0 @@ portalComponent: PropTypes.element, |
@@ -244,2 +244,5 @@ import * as React from "react"; | ||
origin?: OriginType; | ||
ouiaId?: number | string; | ||
ouiaSafe?: boolean; | ||
ouiaType?: string; | ||
polar?: boolean; | ||
@@ -246,0 +249,0 @@ portalComponent?: React.ReactElement; |
@@ -34,2 +34,4 @@ "use strict"; | ||
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); } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; } | ||
@@ -39,4 +41,2 @@ | ||
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); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -123,2 +123,18 @@ | ||
return props.children; | ||
} // Get props defined by the Open UI Automation (OUIA) 1.0-RC spec | ||
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component | ||
}, { | ||
key: "getOUIAProps", | ||
value: function getOUIAProps(props) { | ||
var ouiaId = props.ouiaId, | ||
ouiaSafe = props.ouiaSafe, | ||
ouiaType = props.ouiaType; | ||
return _objectSpread({}, ouiaId && { | ||
"data-ouia-component-id": ouiaId | ||
}, ouiaType && { | ||
"data-ouia-component-type": ouiaType | ||
}, ouiaSafe !== undefined && { | ||
"data-ouia-safe": ouiaSafe | ||
}); | ||
} | ||
@@ -173,7 +189,7 @@ }, { | ||
} | ||
}, _react.default.createElement("div", { | ||
}, _react.default.createElement("div", _extends({ | ||
style: (0, _defaults2.default)({}, style, divStyle), | ||
className: className, | ||
ref: this.saveContainerRef | ||
}, _react.default.createElement("svg", _extends({}, svgProps, { | ||
}, this.getOUIAProps(props)), _react.default.createElement("svg", _extends({}, svgProps, { | ||
style: svgStyle | ||
@@ -248,2 +264,5 @@ }), title ? _react.default.createElement("title", { | ||
}), | ||
ouiaId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]), | ||
ouiaSafe: _propTypes.default.boolean, | ||
ouiaType: _propTypes.default.string, | ||
polar: _propTypes.default.bool, | ||
@@ -250,0 +269,0 @@ portalComponent: _propTypes.default.element, |
{ | ||
"name": "victory-core", | ||
"version": "35.0.5", | ||
"version": "35.0.7", | ||
"description": "Victory Core", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -244,2 +244,5 @@ import * as React from "react"; | ||
origin?: OriginType; | ||
ouiaId?: number | string; | ||
ouiaSafe?: boolean; | ||
ouiaType?: string; | ||
polar?: boolean; | ||
@@ -246,0 +249,0 @@ portalComponent?: React.ReactElement; |
@@ -23,2 +23,5 @@ import React from "react"; | ||
origin: PropTypes.shape({ x: CustomPropTypes.nonNegative, y: CustomPropTypes.nonNegative }), | ||
ouiaId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), | ||
ouiaSafe: PropTypes.boolean, | ||
ouiaType: PropTypes.string, | ||
polar: PropTypes.bool, | ||
@@ -93,2 +96,13 @@ portalComponent: PropTypes.element, | ||
// Get props defined by the Open UI Automation (OUIA) 1.0-RC spec | ||
// See https://ouia.readthedocs.io/en/latest/README.html#ouia-component | ||
getOUIAProps(props) { | ||
const { ouiaId, ouiaSafe, ouiaType } = props; | ||
return { | ||
...(ouiaId && { "data-ouia-component-id": ouiaId }), | ||
...(ouiaType && { "data-ouia-component-type": ouiaType }), | ||
...(ouiaSafe !== undefined && { "data-ouia-safe": ouiaSafe }) | ||
}; | ||
} | ||
renderContainer(props, svgProps, style) { | ||
@@ -135,2 +149,3 @@ const { | ||
ref={this.saveContainerRef} | ||
{...this.getOUIAProps(props)} | ||
> | ||
@@ -137,0 +152,0 @@ <svg {...svgProps} style={svgStyle}> |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
2232224
0.16%30358
0.21%