Socket
Socket
Sign inDemoInstall

react-apiembed

Package Overview
Dependencies
71
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.1.5

LICENSE

58

dist/react-apiembed.js

@@ -1005,2 +1005,3 @@ (function (global, factory) {

client: PropTypes.string,
showClientInTab: PropTypes.boolean,
prismLanguage: PropTypes.string.isRequired

@@ -1018,2 +1019,3 @@ };

_this.clickHandler = _this.clickHandler.bind(_this);
_this.keypressHandler = _this.keypressHandler.bind(_this);
_this.state = {

@@ -1023,2 +1025,5 @@ activeTab: 0,

};
_this.tabRefs = Array.from({ length: _this.props.snippets.length }, function () {
return React.createRef();
});
return _this;

@@ -1029,6 +1034,10 @@ }

key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
value: function componentDidUpdate(prevProps, prevState) {
if (prevProps.har.url !== this.props.har.url) {
this.setState({ active: this.getHarKey(this.props.har) + this.state.activeTab });
}
if (prevState.activeTab !== this.state.activeTab) {
this.tabRefs[this.state.activeTab].current.focus();
}
}

@@ -1046,2 +1055,23 @@ }, {

}, {
key: "keypressHandler",
value: function keypressHandler(key, index) {
var targetIndex = index;
var lastIndex = this.props.snippets.length - 1;
if (key === "ArrowUp" || key === "ArrowLeft") {
if (index === 0) {
targetIndex = lastIndex;
} else {
targetIndex = index - 1;
}
} else if (key === "ArrowRight" || key === "ArrowDown") {
if (index === lastIndex) {
targetIndex = 0;
} else {
targetIndex = index + 1;
}
}
this.setState({ active: this.getHarKey(this.props.har) + targetIndex, activeTab: targetIndex });
}
}, {
key: "getHarKey",

@@ -1076,4 +1106,16 @@ value: function getHarKey(harObject) {

{
role: "presentation",
role: "tab",
className: "tabs-component-tab" + (harKey + index == _this2.state.active ? " is-active" : ""),
"aria-controls": "" + (snippetKey + harKey),
onKeyUp: function onKeyUp(e) {
return _this2.keypressHandler(e.nativeEvent.code, index);
},
onClick: function onClick() {
return _this2.clickHandler(index);
},
"aria-selected": harKey + index == _this2.state.active,
tabIndex: harKey + index == _this2.state.active ? 0 : -1,
ref: function ref(el) {
return _this2.tabRefs[index].current = el;
},
key: index

@@ -1084,12 +1126,8 @@ },

{
"aria-controls": "" + (snippetKey + harKey),
"aria-selected": "true",
role: "tab",
role: "presentation",
className: "tabs-component-tab-a",
id: harKey + index,
onClick: function onClick() {
return _this2.clickHandler(index);
}
id: harKey + index
},
snippet.target
snippet.target,
snippet.client && snippet.showClientInTab && " - " + snippet.client
)

@@ -1096,0 +1134,0 @@ );

2

package.json
{
"name": "react-apiembed",
"version": "0.1.4",
"version": "0.1.5",
"description": "React api embed component.",

@@ -5,0 +5,0 @@ "files": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc