@bigbinary/neeto-molecules 3.10.4 → 3.10.5
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/dist/ButtonGroup.js +36 -0
- package/dist/ButtonGroup.js.map +1 -0
- package/dist/cjs/ButtonGroup.js +38 -0
- package/dist/cjs/ButtonGroup.js.map +1 -0
- package/package.json +2 -2
- package/types/ButtonGroup.d.ts +45 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
4
|
+
import { n } from './inject-css-DmrvuTKK.js';
|
|
5
|
+
import { createElement } from 'react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var css = ".neeto-molecules-button-group{border-radius:var(--neeto-ui-rounded-md);display:flex}.neeto-molecules-button-group .neeto-ui-btn{margin-left:-1px}.neeto-molecules-button-group .neeto-ui-btn.neeto-ui-btn--style-primary{z-index:1}.neeto-molecules-button-group .neeto-ui-btn:first-child{border-bottom-right-radius:0;border-left:0;border-top-right-radius:0;margin-left:0}.neeto-molecules-button-group .neeto-ui-btn:last-child{border-bottom-left-radius:0;border-top-left-radius:0}.neeto-molecules-button-group .neeto-ui-btn:not(:first-child):not(:last-child){border-radius:0}";
|
|
9
|
+
n(css,{});
|
|
10
|
+
|
|
11
|
+
var _excluded = ["key", "isActive"];
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
|
+
var ButtonGroup = function ButtonGroup(_ref) {
|
|
15
|
+
var buttons = _ref.buttons,
|
|
16
|
+
_ref$style = _ref.style,
|
|
17
|
+
style = _ref$style === void 0 ? "tertiary" : _ref$style,
|
|
18
|
+
_ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? "medium" : _ref$size;
|
|
20
|
+
return /*#__PURE__*/jsx("div", {
|
|
21
|
+
className: "neeto-molecules-button-group",
|
|
22
|
+
children: buttons.map(function (_ref2) {
|
|
23
|
+
var key = _ref2.key,
|
|
24
|
+
isActive = _ref2.isActive,
|
|
25
|
+
buttonProps = _objectWithoutProperties(_ref2, _excluded);
|
|
26
|
+
return /*#__PURE__*/createElement(Button, _objectSpread({
|
|
27
|
+
size: size,
|
|
28
|
+
key: key,
|
|
29
|
+
style: isActive ? "primary" : style
|
|
30
|
+
}, buttonProps));
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { ButtonGroup as default };
|
|
36
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonGroup.js","sources":["../src/components/ButtonGroup/index.jsx"],"sourcesContent":["import { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport \"./button-group.scss\";\n\nconst ButtonGroup = ({ buttons, style = \"tertiary\", size = \"medium\" }) => (\n <div className=\"neeto-molecules-button-group\">\n {buttons.map(({ key, isActive, ...buttonProps }) => (\n <Button\n {...{ size }}\n key={key}\n style={isActive ? \"primary\" : style}\n {...buttonProps}\n />\n ))}\n </div>\n);\n\nButtonGroup.propTypes = {\n /*\n * Array of buttons to be rendered in the group. Each button should have a key, icon, isActive and onClick function.\n */\n buttons: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n isActive: PropTypes.bool,\n onClick: PropTypes.func,\n })\n ),\n /*\n * Size of the buttons in the group.\n */\n size: PropTypes.oneOf([\"small\", \"medium\", \"large\"]),\n /*\n * Style of the buttons in the group.\n */\n style: PropTypes.oneOf([\"secondary\", \"tertiary\"]),\n};\n\nexport default ButtonGroup;\n"],"names":["ButtonGroup","_ref","buttons","_ref$style","style","_ref$size","size","_jsx","className","children","map","_ref2","key","isActive","buttonProps","_objectWithoutProperties","_excluded","_createElement","Button","_objectSpread"],"mappings":";;;;;;;;;;;;;AAKA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAAC,UAAA,GAAAF,IAAA,CAAEG,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;IAAAE,SAAA,GAAAJ,IAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA,CAAA;AAAA,EAAA,oBACjEE,GAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,8BAA8B;AAAAC,IAAAA,QAAA,EAC1CP,OAAO,CAACQ,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,MAAA,IAAGC,GAAG,GAAAD,KAAA,CAAHC,GAAG;QAAEC,QAAQ,GAAAF,KAAA,CAARE,QAAQ;AAAKC,QAAAA,WAAW,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA,CAAA,CAAA;AAAA,MAAA,oBAC3CC,aAAA,CAACC,MAAM,EAAAC,aAAA,CAAA;AACCb,QAAAA,IAAI,EAAJA,IAAI;AACVM,QAAAA,GAAG,EAAEA,GAAI;AACTR,QAAAA,KAAK,EAAES,QAAQ,GAAG,SAAS,GAAGT,KAAAA;OAC1BU,EAAAA,WAAW,CAChB,CAAC,CAAA;KACH,CAAA;AAAC,GACC,CAAC,CAAA;AAAA;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
|
+
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
6
|
+
var injectCss = require('./inject-css-vQvjPR2x.js');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
9
|
+
|
|
10
|
+
var css = ".neeto-molecules-button-group{border-radius:var(--neeto-ui-rounded-md);display:flex}.neeto-molecules-button-group .neeto-ui-btn{margin-left:-1px}.neeto-molecules-button-group .neeto-ui-btn.neeto-ui-btn--style-primary{z-index:1}.neeto-molecules-button-group .neeto-ui-btn:first-child{border-bottom-right-radius:0;border-left:0;border-top-right-radius:0;margin-left:0}.neeto-molecules-button-group .neeto-ui-btn:last-child{border-bottom-left-radius:0;border-top-left-radius:0}.neeto-molecules-button-group .neeto-ui-btn:not(:first-child):not(:last-child){border-radius:0}";
|
|
11
|
+
injectCss.n(css,{});
|
|
12
|
+
|
|
13
|
+
var _excluded = ["key", "isActive"];
|
|
14
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
16
|
+
var ButtonGroup = function ButtonGroup(_ref) {
|
|
17
|
+
var buttons = _ref.buttons,
|
|
18
|
+
_ref$style = _ref.style,
|
|
19
|
+
style = _ref$style === void 0 ? "tertiary" : _ref$style,
|
|
20
|
+
_ref$size = _ref.size,
|
|
21
|
+
size = _ref$size === void 0 ? "medium" : _ref$size;
|
|
22
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
23
|
+
className: "neeto-molecules-button-group",
|
|
24
|
+
children: buttons.map(function (_ref2) {
|
|
25
|
+
var key = _ref2.key,
|
|
26
|
+
isActive = _ref2.isActive,
|
|
27
|
+
buttonProps = _objectWithoutProperties(_ref2, _excluded);
|
|
28
|
+
return /*#__PURE__*/React.createElement(Button, _objectSpread({
|
|
29
|
+
size: size,
|
|
30
|
+
key: key,
|
|
31
|
+
style: isActive ? "primary" : style
|
|
32
|
+
}, buttonProps));
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
module.exports = ButtonGroup;
|
|
38
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonGroup.js","sources":["../../src/components/ButtonGroup/index.jsx"],"sourcesContent":["import { Button } from \"neetoui\";\nimport PropTypes from \"prop-types\";\n\nimport \"./button-group.scss\";\n\nconst ButtonGroup = ({ buttons, style = \"tertiary\", size = \"medium\" }) => (\n <div className=\"neeto-molecules-button-group\">\n {buttons.map(({ key, isActive, ...buttonProps }) => (\n <Button\n {...{ size }}\n key={key}\n style={isActive ? \"primary\" : style}\n {...buttonProps}\n />\n ))}\n </div>\n);\n\nButtonGroup.propTypes = {\n /*\n * Array of buttons to be rendered in the group. Each button should have a key, icon, isActive and onClick function.\n */\n buttons: PropTypes.arrayOf(\n PropTypes.shape({\n key: PropTypes.string,\n icon: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),\n isActive: PropTypes.bool,\n onClick: PropTypes.func,\n })\n ),\n /*\n * Size of the buttons in the group.\n */\n size: PropTypes.oneOf([\"small\", \"medium\", \"large\"]),\n /*\n * Style of the buttons in the group.\n */\n style: PropTypes.oneOf([\"secondary\", \"tertiary\"]),\n};\n\nexport default ButtonGroup;\n"],"names":["ButtonGroup","_ref","buttons","_ref$style","style","_ref$size","size","_jsx","className","children","map","_ref2","key","isActive","buttonProps","_objectWithoutProperties","_excluded","_createElement","Button","_objectSpread"],"mappings":";;;;;;;;;;;;;;;AAKA,IAAMA,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAAA;AAAA,EAAA,IAAMC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IAAAC,UAAA,GAAAF,IAAA,CAAEG,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAG,KAAA,CAAA,GAAA,UAAU,GAAAA,UAAA;IAAAE,SAAA,GAAAJ,IAAA,CAAEK,IAAI;AAAJA,IAAAA,IAAI,GAAAD,SAAA,KAAG,KAAA,CAAA,GAAA,QAAQ,GAAAA,SAAA,CAAA;AAAA,EAAA,oBACjEE,cAAA,CAAA,KAAA,EAAA;AAAKC,IAAAA,SAAS,EAAC,8BAA8B;AAAAC,IAAAA,QAAA,EAC1CP,OAAO,CAACQ,GAAG,CAAC,UAAAC,KAAA,EAAA;AAAA,MAAA,IAAGC,GAAG,GAAAD,KAAA,CAAHC,GAAG;QAAEC,QAAQ,GAAAF,KAAA,CAARE,QAAQ;AAAKC,QAAAA,WAAW,GAAAC,wBAAA,CAAAJ,KAAA,EAAAK,SAAA,CAAA,CAAA;AAAA,MAAA,oBAC3CC,mBAAA,CAACC,MAAM,EAAAC,aAAA,CAAA;AACCb,QAAAA,IAAI,EAAJA,IAAI;AACVM,QAAAA,GAAG,EAAEA,GAAI;AACTR,QAAAA,KAAK,EAAES,QAAQ,GAAG,SAAS,GAAGT,KAAAA;OAC1BU,EAAAA,WAAW,CAChB,CAAC,CAAA;KACH,CAAA;AAAC,GACC,CAAC,CAAA;AAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigbinary/neeto-molecules",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.5",
|
|
4
4
|
"description": "A package of reusable molecular components for neeto products.",
|
|
5
5
|
"repository": "git@github.com:bigbinary/neeto-molecules.git",
|
|
6
6
|
"author": "Amaljith K <amaljith.k@bigbinary.com>",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@babel/preset-typescript": "^7.18.6",
|
|
51
51
|
"@babel/runtime": "7.19.0",
|
|
52
52
|
"@bigbinary/babel-preset-neeto": "^1.0.3",
|
|
53
|
-
"@bigbinary/eslint-plugin-neeto": "1.5.
|
|
53
|
+
"@bigbinary/eslint-plugin-neeto": "1.5.6",
|
|
54
54
|
"@bigbinary/neeto-audit-frontend": "^2.0.18",
|
|
55
55
|
"@bigbinary/neeto-cist": "1.0.11",
|
|
56
56
|
"@bigbinary/neeto-commons-frontend": "4.4.6",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { ButtonProps } from '@bigbinary/neetoui';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
|
|
4
|
+
interface Button extends ButtonProps {
|
|
5
|
+
key: string;
|
|
6
|
+
isActive?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface ButtonGroupProps {
|
|
9
|
+
style?: "secondary" | "tertiary";
|
|
10
|
+
size?: "small" | "medium" | "large";
|
|
11
|
+
buttons: Button[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* ButtonGroup component is a wrapper component that groups icon only buttons and
|
|
16
|
+
*
|
|
17
|
+
* highlights the active button.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
*
|
|
21
|
+
* import ButtonGroup from "@bigbinary/neeto-molecules/ButtonGroup";
|
|
22
|
+
*
|
|
23
|
+
* const Component = () => (
|
|
24
|
+
* <ButtonGroup
|
|
25
|
+
* buttons={[
|
|
26
|
+
* {
|
|
27
|
+
* key: "calendar",
|
|
28
|
+
* icon: Calendar,
|
|
29
|
+
* onClick: () => handleSwitch(),
|
|
30
|
+
* },
|
|
31
|
+
* {
|
|
32
|
+
* key: "list",
|
|
33
|
+
* icon: List,
|
|
34
|
+
* onClick: () => handleSwitch(),
|
|
35
|
+
* },
|
|
36
|
+
* ]}
|
|
37
|
+
* style="tertiary"
|
|
38
|
+
* size="medium"
|
|
39
|
+
* />
|
|
40
|
+
* );
|
|
41
|
+
* @endexample
|
|
42
|
+
*/
|
|
43
|
+
declare const ButtonGroup: React.FC<ButtonGroupProps>;
|
|
44
|
+
|
|
45
|
+
export { type ButtonGroupProps, ButtonGroup as default };
|