Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-tab-component-pure-js

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-tab-component-pure-js - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

dist/index.d.js

66

dist/index.js
"use strict";
var __assign = void 0 && (void 0).__assign || function () {
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
Object.defineProperty(exports, "__esModule", {

@@ -7,28 +17,34 @@ value: true

exports.Tab = void 0;
var _react = _interopRequireDefault(require("react"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
var Tab = exports.Tab = function Tab(_ref) {
var tabList = _ref.tabList,
currentTabIndex = _ref.currentTabIndex,
tabClickHandler = _ref.tabClickHandler,
selectTabClass = _ref.selectTabClass,
unselectedTabClass = _ref.unselectedTabClass,
tabContainerClass = _ref.tabContainerClass;
return /*#__PURE__*/_react["default"].createElement("div", {
var jsx_runtime_1 = require("react/jsx-runtime");
var Tab = function Tab(_a) {
var tabList = _a.tabList,
currentTabIndex = _a.currentTabIndex,
tabClickHandler = _a.tabClickHandler,
selectTabClass = _a.selectTabClass,
unselectedTabClass = _a.unselectedTabClass,
tabContainerClass = _a.tabContainerClass,
tabOptionsClass = _a.tabOptionsClass;
return (0, jsx_runtime_1.jsxs)("div", __assign({
className: tabContainerClass
}, tabList.map(function (_ref2, index) {
var name = _ref2.name;
return /*#__PURE__*/_react["default"].createElement("div", {
key: name,
className: currentTabIndex === index ? selectTabClass : unselectedTabClass,
onClick: function onClick() {
return tabClickHandler(index);
}
}, name);
}), tabList.map(function (_ref3, index) {
var Component = _ref3.Component;
return index === currentTabIndex ? /*#__PURE__*/_react["default"].createElement(Component, {
key: index
}) : null;
}, {
children: [(0, jsx_runtime_1.jsx)("div", __assign({
className: tabOptionsClass
}, {
children: tabList.map(function (_a, index) {
var name = _a.name;
return (0, jsx_runtime_1.jsx)("div", __assign({
className: currentTabIndex === index ? selectTabClass : unselectedTabClass,
onClick: function onClick() {
return tabClickHandler(index);
}
}, {
children: name
}), name);
})
})), tabList.map(function (_a, index) {
var Component = _a.Component;
return index === currentTabIndex ? (0, jsx_runtime_1.jsx)(Component, {}, index) : null;
})]
}));
};
};
exports.Tab = Tab;
{
"name": "react-tab-component-pure-js",
"version": "1.0.3",
"version": "1.0.4",
"repository": {

@@ -10,4 +10,5 @@ "type": "git",

"main": "dist/index.js",
"types": "dist/index.d.ts",
"scripts": {
"build": "babel src -d dist --extensions \".js,.jsx,.ts,.tsx\"",
"build": "tsc && babel dist -d dist --extensions \".js,.jsx,.ts,.tsx\"",
"prepublishOnly": "npm run build"

@@ -37,4 +38,4 @@ },

],
"author": "Your Name",
"author": "Anup Agarwal",
"license": "MIT"
}

@@ -23,3 +23,3 @@ # react-tab-component-pure-js

import React, { useState } from 'react';
import Tab from 'react-tab-component-pure-js';
import { Tab } from 'react-tab-component-pure-js';

@@ -49,2 +49,3 @@ const Tab1 = () => <div>Content for Tab 1</div>;

tabContainerClass="tab-container"
tabOptionsClass="tab-options"
/>

@@ -56,2 +57,3 @@ );

```

@@ -76,2 +78,7 @@

display: flex;
flex-direction: column;
}
.tab-options {
display: flex;
border-bottom: 1px solid #ccc;

@@ -92,2 +99,3 @@ }

}
```

@@ -94,0 +102,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc