@laerdal/life-react-components 1.5.1-dev.2.full → 1.5.1-dev.21.full

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.
Files changed (106) hide show
  1. package/dist/Card/Card.cjs +101 -0
  2. package/dist/Card/Card.cjs.map +1 -0
  3. package/dist/Card/Card.d.ts +23 -0
  4. package/dist/Card/Card.js +74 -0
  5. package/dist/Card/Card.js.map +1 -0
  6. package/dist/Card/CardBottomSection.cjs +139 -0
  7. package/dist/Card/CardBottomSection.cjs.map +1 -0
  8. package/dist/Card/CardBottomSection.d.ts +22 -0
  9. package/dist/Card/CardBottomSection.js +109 -0
  10. package/dist/Card/CardBottomSection.js.map +1 -0
  11. package/dist/Card/CardMiddleSection.cjs +104 -0
  12. package/dist/Card/CardMiddleSection.cjs.map +1 -0
  13. package/dist/Card/CardMiddleSection.d.ts +14 -0
  14. package/dist/Card/CardMiddleSection.js +80 -0
  15. package/dist/Card/CardMiddleSection.js.map +1 -0
  16. package/dist/Card/CardTopSection.cjs +106 -0
  17. package/dist/Card/CardTopSection.cjs.map +1 -0
  18. package/dist/Card/CardTopSection.d.ts +17 -0
  19. package/dist/Card/CardTopSection.js +80 -0
  20. package/dist/Card/CardTopSection.js.map +1 -0
  21. package/dist/Card/index.cjs +52 -0
  22. package/dist/Card/index.cjs.map +1 -0
  23. package/dist/Card/index.d.ts +5 -0
  24. package/dist/Card/index.js +6 -0
  25. package/dist/Card/index.js.map +1 -0
  26. package/dist/Dropdown/BasicDropdown.cjs +7 -2
  27. package/dist/Dropdown/BasicDropdown.cjs.map +1 -1
  28. package/dist/Dropdown/BasicDropdown.js +7 -2
  29. package/dist/Dropdown/BasicDropdown.js.map +1 -1
  30. package/dist/Dropdown/CommonStyling.cjs +9 -17
  31. package/dist/Dropdown/CommonStyling.cjs.map +1 -1
  32. package/dist/Dropdown/CommonStyling.d.ts +0 -3
  33. package/dist/Dropdown/CommonStyling.js +8 -12
  34. package/dist/Dropdown/CommonStyling.js.map +1 -1
  35. package/dist/Dropdown/DropdownContent.cjs +15 -3
  36. package/dist/Dropdown/DropdownContent.cjs.map +1 -1
  37. package/dist/Dropdown/DropdownContent.d.ts +1 -0
  38. package/dist/Dropdown/DropdownContent.js +15 -3
  39. package/dist/Dropdown/DropdownContent.js.map +1 -1
  40. package/dist/Dropdown/DropdownFilter.cjs +1 -0
  41. package/dist/Dropdown/DropdownFilter.cjs.map +1 -1
  42. package/dist/Dropdown/DropdownFilter.js +1 -0
  43. package/dist/Dropdown/DropdownFilter.js.map +1 -1
  44. package/dist/Dropdown/index.cjs +8 -0
  45. package/dist/Dropdown/index.cjs.map +1 -1
  46. package/dist/Dropdown/index.d.ts +2 -1
  47. package/dist/Dropdown/index.js +2 -1
  48. package/dist/Dropdown/index.js.map +1 -1
  49. package/dist/LinearProgression/LinearProgression.cjs +132 -0
  50. package/dist/LinearProgression/LinearProgression.cjs.map +1 -0
  51. package/dist/LinearProgression/LinearProgression.d.ts +24 -0
  52. package/dist/LinearProgression/LinearProgression.js +102 -0
  53. package/dist/LinearProgression/LinearProgression.js.map +1 -0
  54. package/dist/LinearProgression/index.cjs +32 -0
  55. package/dist/LinearProgression/index.cjs.map +1 -0
  56. package/dist/LinearProgression/index.d.ts +3 -0
  57. package/dist/LinearProgression/index.js +4 -0
  58. package/dist/LinearProgression/index.js.map +1 -0
  59. package/dist/MenuItem/MenuItem.cjs +28 -13
  60. package/dist/MenuItem/MenuItem.cjs.map +1 -1
  61. package/dist/MenuItem/MenuItem.d.ts +2 -1
  62. package/dist/MenuItem/MenuItem.js +25 -11
  63. package/dist/MenuItem/MenuItem.js.map +1 -1
  64. package/dist/MenuItem/index.cjs +16 -0
  65. package/dist/MenuItem/index.cjs.map +1 -0
  66. package/dist/MenuItem/index.d.ts +1 -0
  67. package/dist/MenuItem/index.js +2 -0
  68. package/dist/MenuItem/index.js.map +1 -0
  69. package/dist/SegmentControl/SegmentControl.cjs +99 -0
  70. package/dist/SegmentControl/SegmentControl.cjs.map +1 -0
  71. package/dist/SegmentControl/SegmentControl.d.ts +19 -0
  72. package/dist/SegmentControl/SegmentControl.js +71 -0
  73. package/dist/SegmentControl/SegmentControl.js.map +1 -0
  74. package/dist/SegmentControl/index.cjs +16 -0
  75. package/dist/SegmentControl/index.cjs.map +1 -0
  76. package/dist/SegmentControl/index.d.ts +3 -0
  77. package/dist/SegmentControl/index.js +3 -0
  78. package/dist/SegmentControl/index.js.map +1 -0
  79. package/dist/Table/TableFooter.cjs +1 -1
  80. package/dist/Table/TableFooter.cjs.map +1 -1
  81. package/dist/Table/TableFooter.js +1 -1
  82. package/dist/Table/TableFooter.js.map +1 -1
  83. package/dist/Table/TableStyles.cjs +1 -1
  84. package/dist/Table/TableStyles.cjs.map +1 -1
  85. package/dist/Table/TableStyles.js +1 -1
  86. package/dist/Table/TableStyles.js.map +1 -1
  87. package/dist/Tag/Tag.cjs +92 -0
  88. package/dist/Tag/Tag.cjs.map +1 -0
  89. package/dist/Tag/Tag.d.ts +9 -0
  90. package/dist/Tag/Tag.js +70 -0
  91. package/dist/Tag/Tag.js.map +1 -0
  92. package/dist/Tag/index.cjs +16 -0
  93. package/dist/Tag/index.cjs.map +1 -0
  94. package/dist/Tag/index.d.ts +1 -0
  95. package/dist/Tag/index.js +2 -0
  96. package/dist/Tag/index.js.map +1 -0
  97. package/dist/common/InputStyling.cjs +1 -1
  98. package/dist/common/InputStyling.cjs.map +1 -1
  99. package/dist/common/InputStyling.js +1 -1
  100. package/dist/common/InputStyling.js.map +1 -1
  101. package/dist/index.cjs +52 -0
  102. package/dist/index.cjs.map +1 -1
  103. package/dist/index.d.ts +4 -0
  104. package/dist/index.js +4 -0
  105. package/dist/index.js.map +1 -1
  106. package/package.json +1 -1
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _typeof = require("@babel/runtime/helpers/typeof");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "LinearProgression", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _LinearProgression.default;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "LinearProgressionType", {
15
+ enumerable: true,
16
+ get: function get() {
17
+ return _LinearProgression.LinearProgressionType;
18
+ }
19
+ });
20
+ Object.defineProperty(exports, "LinearProgressionVariant", {
21
+ enumerable: true,
22
+ get: function get() {
23
+ return _LinearProgression.LinearProgressionVariant;
24
+ }
25
+ });
26
+
27
+ var _LinearProgression = _interopRequireWildcard(require("./LinearProgression"));
28
+
29
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
30
+
31
+ 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; }
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/LinearProgression/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA","sourcesContent":["import LinearProgression, {LinearProgressionType, LinearProgressionVariant} from './LinearProgression';\n\nexport {LinearProgressionType, LinearProgressionVariant};\nexport {LinearProgression}\n"],"file":"index.cjs"}
@@ -0,0 +1,3 @@
1
+ import LinearProgression, { LinearProgressionType, LinearProgressionVariant } from './LinearProgression';
2
+ export { LinearProgressionType, LinearProgressionVariant };
3
+ export { LinearProgression };
@@ -0,0 +1,4 @@
1
+ import LinearProgression, { LinearProgressionType, LinearProgressionVariant } from './LinearProgression';
2
+ export { LinearProgressionType, LinearProgressionVariant };
3
+ export { LinearProgression };
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/LinearProgression/index.ts"],"names":["LinearProgression","LinearProgressionType","LinearProgressionVariant"],"mappings":"AAAA,OAAOA,iBAAP,IAA2BC,qBAA3B,EAAkDC,wBAAlD,QAAiF,qBAAjF;AAEA,SAAQD,qBAAR,EAA+BC,wBAA/B;AACA,SAAQF,iBAAR","sourcesContent":["import LinearProgression, {LinearProgressionType, LinearProgressionVariant} from './LinearProgression';\n\nexport {LinearProgressionType, LinearProgressionVariant};\nexport {LinearProgression}\n"],"file":"index.js"}
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
7
7
  Object.defineProperty(exports, "__esModule", {
8
8
  value: true
9
9
  });
10
- exports.default = exports.ItemLabel = exports.ItemIconOld = exports.ItemIcon = exports.ItemContent = exports.DropdownButtonCSS = exports.DropdownButton = void 0;
10
+ exports.default = exports.LockedIconContainer = exports.ItemLabel = exports.ItemIcon = exports.ItemContent = exports.DropdownButtonCSS = exports.DropdownButton = void 0;
11
11
 
12
12
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
13
13
 
@@ -19,6 +19,8 @@ var _styledComponents = _interopRequireWildcard(require("styled-components"));
19
19
 
20
20
  var _styles = require("../styles");
21
21
 
22
+ var _SystemIcons = require("../icons/systemicons/SystemIcons");
23
+
22
24
  var _types = require("../types");
23
25
 
24
26
  var _typography = require("../styles/typography");
@@ -47,16 +49,16 @@ var ItemIcon = _styledComponents.default.div(_templateObject3 || (_templateObjec
47
49
 
48
50
  exports.ItemIcon = ItemIcon;
49
51
 
50
- var ItemIconOld = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)([""])));
52
+ var LockedIconContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n"])));
51
53
 
52
- exports.ItemIconOld = ItemIconOld;
54
+ exports.LockedIconContainer = LockedIconContainer;
53
55
 
54
- var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ", " {\n flex: 1 0 calc(100% - 40px); \n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ", " {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n"])), ItemLabel, ItemIcon, ItemIconOld);
56
+ var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
55
57
 
56
58
  exports.ItemContent = ItemContent;
57
59
 
58
60
  var DropdownButtonCSS = function DropdownButtonCSS(size) {
59
- return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ", ";\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == _types.Size.Small && (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Medium && (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large && (0, _typography.ComponentLStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large ? '64px' : size == _types.Size.Medium ? '56px' : '48px', _styles.COLORS.white, _common.CommonInteractionStyling, _styles.COLORS.neutral_20, _styles.COLORS.primary_500, _styles.COLORS.neutral_200, _styles.COLORS.primary_20, _styles.COLORS.primary_600, _styles.COLORS.primary_500, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.primary_500);
61
+ return (0, _styledComponents.css)(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == _types.Size.Small && (0, _typography.ComponentSStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Medium && (0, _typography.ComponentMStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large && (0, _typography.ComponentLStyling)(_styles.ComponentTextStyle.Regular, _styles.COLORS.neutral_600), size == _types.Size.Large ? '64px' : size == _types.Size.Medium ? '56px' : '48px', _styles.COLORS.white, _common.CommonInteractionStyling, _styles.COLORS.neutral_20, _styles.COLORS.primary_500, _styles.COLORS.neutral_200, _styles.COLORS.neutral_500, _styles.COLORS.primary_20, _styles.COLORS.primary_600, _styles.COLORS.primary_500, _styles.COLORS.primary_100, _styles.COLORS.primary_800, _styles.COLORS.primary_500);
60
62
  };
61
63
 
62
64
  exports.DropdownButtonCSS = DropdownButtonCSS;
@@ -68,14 +70,15 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
68
70
  onClickHandler = _ref.onClickHandler,
69
71
  key = _ref.key,
70
72
  size = _ref.size,
73
+ className = _ref.className,
71
74
  id = _ref.id;
72
75
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownButton, {
73
76
  type: "button",
74
77
  size: size,
75
- disabled: item.disabled,
78
+ disabled: item.disabled || item.locked,
76
79
  ref: ref,
77
80
  onClick: onClickHandler,
78
- className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
81
+ className: className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
79
82
  id: id,
80
83
  children: [item.showDividerAbove && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
81
84
  className: "divider"
@@ -83,11 +86,22 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
83
86
  children: [item.icon && /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemIcon, {
84
87
  children: item.icon
85
88
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(ItemLabel, {
86
- children: [(_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value, item.noteLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
87
- style: {
88
- fontSize: '12px'
89
- },
90
- children: item.noteLabel
89
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
90
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
91
+ children: (_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value
92
+ }), item.noteLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
93
+ style: {
94
+ fontSize: '12px',
95
+ lineHeight: '16px'
96
+ },
97
+ children: item.noteLabel
98
+ })]
99
+ }), item.locked && /*#__PURE__*/(0, _jsxRuntime.jsx)(LockedIconContainer, {
100
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.LockedOn, {
101
+ color: _styles.COLORS.neutral_400,
102
+ className: "extraMargin",
103
+ size: "24px"
104
+ })
91
105
  })]
92
106
  })]
93
107
  })]
@@ -97,7 +111,8 @@ MenuItem.propTypes = {
97
111
  onClickHandler: _propTypes.default.func.isRequired,
98
112
  active: _propTypes.default.bool.isRequired,
99
113
  id: _propTypes.default.string.isRequired,
100
- key: _propTypes.default.string.isRequired
114
+ key: _propTypes.default.string.isRequired,
115
+ className: _propTypes.default.string
101
116
  };
102
117
  var _default = MenuItem;
103
118
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","ItemIconOld","ItemContent","css","Size","Small","ComponentTextStyle","Regular","COLORS","neutral_600","Medium","Large","white","CommonInteractionStyling","neutral_20","primary_500","neutral_200","primary_20","primary_600","primary_100","primary_800","MenuItem","React","forwardRef","ref","active","item","onClickHandler","key","id","disabled","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAEA;;AACA;;AAEA;;;;;;;;;;AAWO,IAAMA,cAAc,GAAGC,0BAAOC,MAAV,8FACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;;;;AAIA,IAAMC,SAAS,GAAGL,0BAAOM,GAAV,qFAAf;;;;AACA,IAAMC,QAAQ,GAAGP,0BAAOM,GAAV,qFAAd;;;;AACA,IAAME,WAAW,GAAGR,0BAAOM,GAAV,qFAAjB;;;;AAEA,IAAMG,WAAW,GAAGT,0BAAOM,GAAV,ybAKlBD,SALkB,EASlBE,QATkB,EAgBlBC,WAhBkB,CAAjB;;;;AAuBA,IAAML,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiB;AAChD,aAAOM,qBAAP,gtCACIN,IAAI,IAAIO,YAAKC,KAAb,IAAsB,mCAAkBC,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAD1B,EAEIZ,IAAI,IAAIO,YAAKM,MAAb,IAAuB,mCAAkBJ,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAF3B,EAGIZ,IAAI,IAAIO,YAAKO,KAAb,IAAsB,mCAAkBL,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAH1B,EAUgBZ,IAAI,IAAIO,YAAKO,KAAb,GAAqB,MAArB,GAA8Bd,IAAI,IAAIO,YAAKM,MAAb,GAAsB,MAAtB,GAA+B,MAV7E,EAWsBF,eAAOI,KAX7B,EAuBIC,gCAvBJ,EA0BkB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EAAE;AAAEC,YAAAA,QAAQ,EAAE;AAAZ,WAAZ;AAAA,oBAAmCV,IAAI,CAACS;AAAxC,UAFvB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSP,GAPT,CADF;AAoBD,CA3BgB,CAAjB;;AAhHGD,EAAAA,c;AACAF,EAAAA,M;AACAI,EAAAA,E;AACAD,EAAAA,G;;eA0IYP,Q","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\nexport const ItemIconOld = styled.div``;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px); \n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ${ItemIconOld} {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n`;\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled}\n ref={ref}\n onClick={onClickHandler}\n className={ (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n {item.displayLabel ?? item.value}\n {item.noteLabel && <div style={{ fontSize: '12px' }}>{item.noteLabel}</div>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.cjs"}
1
+ {"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","css","Size","Small","ComponentTextStyle","Regular","COLORS","neutral_600","Medium","Large","white","CommonInteractionStyling","neutral_20","primary_500","neutral_200","neutral_500","primary_20","primary_600","primary_100","primary_800","MenuItem","React","forwardRef","ref","active","item","onClickHandler","key","className","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAYO,IAAMA,cAAc,GAAGC,0BAAOC,MAAV,8FACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;;;;AAIA,IAAMC,SAAS,GAAGL,0BAAOM,GAAV,qFAAf;;;;AACA,IAAMC,QAAQ,GAAGP,0BAAOM,GAAV,qFAAd;;;;AAEA,IAAME,mBAAmB,GAAGR,0BAAOM,GAAV,yFAAzB;;;;AAIA,IAAMG,WAAW,GAAGT,0BAAOM,GAAV,wiBAMlBD,SANkB,EAalBE,QAbkB,EAqBlBC,mBArBkB,CAAjB;;;;AA+BA,IAAML,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiB;AAChD,aAAOM,qBAAP,k4CACIN,IAAI,IAAIO,YAAKC,KAAb,IAAsB,mCAAkBC,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAD1B,EAEIZ,IAAI,IAAIO,YAAKM,MAAb,IAAuB,mCAAkBJ,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAF3B,EAGIZ,IAAI,IAAIO,YAAKO,KAAb,IAAsB,mCAAkBL,2BAAmBC,OAArC,EAA8CC,eAAOC,WAArD,CAH1B,EAUgBZ,IAAI,IAAIO,YAAKO,KAAb,GAAqB,MAArB,GAA8Bd,IAAI,IAAIO,YAAKM,MAAb,GAAsB,MAAtB,GAA+B,MAV7E,EAWsBF,eAAOI,KAX7B,EAuBIC,gCAvBJ,EA0BkBL,eAAOM,UA1BzB,EAmC0BN,eAAOO,W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AAAhB,QADhB,eAEE,sBAAC,SAAD;AAAA,gCACI;AAAA,kCACE;AAAA,4CAAMR,IAAI,CAACS,YAAX,mEAA2BT,IAAI,CAACU;AAAhC,YADF,EAEGV,IAAI,CAACW,SAAL,iBAAkB;AAAK,YAAA,KAAK,EAAE;AAAEC,cAAAA,QAAQ,EAAE,MAAZ;AAAoBC,cAAAA,UAAU,EAAE;AAAhC,aAAZ;AAAA,sBAAuDb,IAAI,CAACW;AAA5D,YAFrB;AAAA,UADJ,EAKKX,IAAI,CAACM,MAAL,iBAAe,qBAAC,mBAAD;AAAA,iCACd,qBAAC,qBAAD;AAAU,YAAA,KAAK,EAAEzB,eAAOiC,WAAxB;AAAqC,YAAA,SAAS,EAAC,aAA/C;AAA6D,YAAA,IAAI,EAAC;AAAlE;AADc,UALpB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSZ,GAPT,CADF;AAyBD,CAjCgB,CAAjB;;AAlIGD,EAAAA,c;AACAF,EAAAA,M;AACAK,EAAAA,E;AACAF,EAAAA,G;AAEAC,EAAAA,S;;eAgKYR,Q","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight, LockedOn} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n className?: string;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n`;\n\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n className,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.cjs"}
@@ -8,13 +8,14 @@ export interface MenuItemProps {
8
8
  id: string;
9
9
  key: string;
10
10
  size?: Size;
11
+ className?: string;
11
12
  }
12
13
  export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {
13
14
  size?: Size | undefined;
14
15
  }, never>;
15
16
  export declare const ItemLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
16
17
  export declare const ItemIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
17
- export declare const ItemIconOld: import("styled-components").StyledComponent<"div", any, {}, never>;
18
+ export declare const LockedIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
18
19
  export declare const ItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
19
20
  export declare const DropdownButtonCSS: (size?: Size | undefined) => import("styled-components").FlattenSimpleInterpolation;
20
21
  declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
@@ -6,6 +6,7 @@ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _temp
6
6
  import * as React from 'react';
7
7
  import styled, { css } from 'styled-components';
8
8
  import { COLORS, ComponentTextStyle } from '../styles';
9
+ import { LockedOn } from '../icons/systemicons/SystemIcons';
9
10
  import { Size } from '../types';
10
11
  import { ComponentLStyling, ComponentMStyling, ComponentSStyling } from '../styles/typography';
11
12
  import { CommonInteractionStyling } from '../common';
@@ -16,10 +17,10 @@ export var DropdownButton = styled.button(_templateObject || (_templateObject =
16
17
  });
17
18
  export var ItemLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral([""])));
18
19
  export var ItemIcon = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral([""])));
19
- export var ItemIconOld = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral([""])));
20
- export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ", " {\n flex: 1 0 calc(100% - 40px); \n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ", " {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n"])), ItemLabel, ItemIcon, ItemIconOld);
20
+ export var LockedIconContainer = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n\n"])));
21
+ export var ItemContent = styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
21
22
  export var DropdownButtonCSS = function DropdownButtonCSS(size) {
22
- return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ", ";\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px', COLORS.white, CommonInteractionStyling, COLORS.neutral_20, COLORS.primary_500, COLORS.neutral_200, COLORS.primary_20, COLORS.primary_600, COLORS.primary_500, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500);
23
+ return css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n ", "\n ", "\n ", "\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ", ";\n background-color: ", ";\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ", ";\n\n &.active {\n background: ", ";\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ", ";\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ", ";\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ", ";\n\n svg {\n color: ", ";\n }\n\n &::after {\n background-color: ", ";\n }\n }\n "])), size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600), size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px', COLORS.white, CommonInteractionStyling, COLORS.neutral_20, COLORS.primary_500, COLORS.neutral_200, COLORS.neutral_500, COLORS.primary_20, COLORS.primary_600, COLORS.primary_500, COLORS.primary_100, COLORS.primary_800, COLORS.primary_500);
23
24
  };
24
25
  var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
25
26
  var _item$displayLabel;
@@ -29,14 +30,15 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
29
30
  onClickHandler = _ref.onClickHandler,
30
31
  key = _ref.key,
31
32
  size = _ref.size,
33
+ className = _ref.className,
32
34
  id = _ref.id;
33
35
  return /*#__PURE__*/_jsxs(DropdownButton, {
34
36
  type: "button",
35
37
  size: size,
36
- disabled: item.disabled,
38
+ disabled: item.disabled || item.locked,
37
39
  ref: ref,
38
40
  onClick: onClickHandler,
39
- className: (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
41
+ className: className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : ''),
40
42
  id: id,
41
43
  children: [item.showDividerAbove && /*#__PURE__*/_jsx("div", {
42
44
  className: "divider"
@@ -44,11 +46,22 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
44
46
  children: [item.icon && /*#__PURE__*/_jsx(ItemIcon, {
45
47
  children: item.icon
46
48
  }), /*#__PURE__*/_jsxs(ItemLabel, {
47
- children: [(_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value, item.noteLabel && /*#__PURE__*/_jsx("div", {
48
- style: {
49
- fontSize: '12px'
50
- },
51
- children: item.noteLabel
49
+ children: [/*#__PURE__*/_jsxs("div", {
50
+ children: [/*#__PURE__*/_jsx("div", {
51
+ children: (_item$displayLabel = item.displayLabel) !== null && _item$displayLabel !== void 0 ? _item$displayLabel : item.value
52
+ }), item.noteLabel && /*#__PURE__*/_jsx("div", {
53
+ style: {
54
+ fontSize: '12px',
55
+ lineHeight: '16px'
56
+ },
57
+ children: item.noteLabel
58
+ })]
59
+ }), item.locked && /*#__PURE__*/_jsx(LockedIconContainer, {
60
+ children: /*#__PURE__*/_jsx(LockedOn, {
61
+ color: COLORS.neutral_400,
62
+ className: "extraMargin",
63
+ size: "24px"
64
+ })
52
65
  })]
53
66
  })]
54
67
  })]
@@ -58,7 +71,8 @@ MenuItem.propTypes = {
58
71
  onClickHandler: _pt.func.isRequired,
59
72
  active: _pt.bool.isRequired,
60
73
  id: _pt.string.isRequired,
61
- key: _pt.string.isRequired
74
+ key: _pt.string.isRequired,
75
+ className: _pt.string
62
76
  };
63
77
  export default MenuItem;
64
78
  //# sourceMappingURL=MenuItem.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","ItemIconOld","ItemContent","Small","Regular","neutral_600","Medium","Large","white","neutral_20","primary_500","neutral_200","primary_20","primary_600","primary_100","primary_800","MenuItem","forwardRef","ref","active","item","onClickHandler","key","id","disabled","showD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BACGL,IAAI,CAACM,IAAL,iBAAa,KAAC,QAAD;AAAA,kBAAWN,IAAI,CAACM;AAAhB,QADhB,eAEE,MAAC,SAAD;AAAA,yCACKN,IAAI,CAACO,YADV,mEAC0BP,IAAI,CAACQ,KAD/B,EAEKR,IAAI,CAACS,SAAL,iBAAkB;AAAK,UAAA,KAAK,EAAE;AAAEC,YAAAA,QAAQ,EAAE;AAAZ,WAAZ;AAAA,oBAAmCV,IAAI,CAACS;AAAxC,UAFvB;AAAA,QAFF;AAAA,MAVJ;AAAA,KAOSP,GAPT,CADF;AAoBD,CA3BgB,CAAjB;;AAhHGD,EAAAA,c;AACAF,EAAAA,M;AACAI,EAAAA,E;AACAD,EAAAA,G;;AA0IH,eAAeN,QAAf","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\nexport const ItemIconOld = styled.div``;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px); \n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n ${ItemIconOld} {\n flex: 1 0 40px;\n display: flex;\n justify-content: flex-end;\n }\n`;\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 0;\n bottom: 0;\n left: 2px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 2px;\n }\n }\n\n &:disabled {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.active:hover {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled}\n ref={ref}\n onClick={onClickHandler}\n className={ (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n {item.displayLabel ?? item.value}\n {item.noteLabel && <div style={{ fontSize: '12px' }}>{item.noteLabel}</div>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
1
+ {"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["React","styled","css","COLORS","ComponentTextStyle","LockedOn","Size","ComponentLStyling","ComponentMStyling","ComponentSStyling","CommonInteractionStyling","DropdownButton","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","Small","Regular","neutral_600","Medium","Large","white","neutral_20","primary_500","neutral_200","neutral_500","primary_20","primary_600","primary_100","primary_800","MenuItem","forwardRef","ref","active","item","onClickHandler","key","className","id","disabled","locked","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,MAAP,IAAiBC,GAAjB,QAA4B,mBAA5B;AACA,SAAqBC,MAArB,EAA6BC,kBAA7B,QAAsD,WAAtD;AACA,SAAsBC,QAAtB,QAAqC,kCAArC;AACA,SAAiBC,IAAjB,QAA4B,UAA5B;AACA,SAAQC,iBAAR,EAA2BC,iBAA3B,EAA8CC,iBAA9C,QAAsE,sBAAtE;AAEA,SAASC,wBAAT,QAAyC,WAAzC;;;AAYA,OAAO,IAAMC,cAAc,GAAGV,MAAM,CAACW,MAAV,gFACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;AAIP,OAAO,IAAMC,SAAS,GAAGf,MAAM,CAACgB,GAAV,uEAAf;AACP,OAAO,IAAMC,QAAQ,GAAGjB,MAAM,CAACgB,GAAV,uEAAd;AAEP,OAAO,IAAME,mBAAmB,GAAGlB,MAAM,CAACgB,GAAV,2EAAzB;AAIP,OAAO,IAAMG,WAAW,GAAGnB,MAAM,CAACgB,GAAV,0hBAMlBD,SANkB,EAalBE,QAbkB,EAqBlBC,mBArBkB,CAAjB;AA+BP,OAAO,IAAML,iBAAi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AAA,MAVJ;AAAA,KAOSZ,GAPT,CADF;AAyBD,CAjCgB,CAAjB;;AAlIGD,EAAAA,c;AACAF,EAAAA,M;AACAK,EAAAA,E;AACAF,EAAAA,G;AAEAC,EAAAA,S;;AAgKH,eAAeP,QAAf","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight, LockedOn} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport { CommonInteractionStyling } from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n className?: string;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n`;\n\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_200};\n }\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n className,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.js"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ Object.defineProperty(exports, "MenuItem", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _MenuItem.default;
12
+ }
13
+ });
14
+
15
+ var _MenuItem = _interopRequireDefault(require("./MenuItem"));
16
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/MenuItem/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA","sourcesContent":["export {default as MenuItem} from './MenuItem';"],"file":"index.cjs"}
@@ -0,0 +1 @@
1
+ export { default as MenuItem } from './MenuItem';
@@ -0,0 +1,2 @@
1
+ export { default as MenuItem } from './MenuItem';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/MenuItem/index.tsx"],"names":["default","MenuItem"],"mappings":"AAAA,SAAQA,OAAO,IAAIC,QAAnB,QAAkC,YAAlC","sourcesContent":["export {default as MenuItem} from './MenuItem';"],"file":"index.js"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = exports.SegmentControlWrapper = exports.SegmentControlItemWrapper = exports.SegmentControlItemContent = exports.SegmentControlItemBackground = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
11
+
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+
14
+ var _react = _interopRequireDefault(require("react"));
15
+
16
+ var _types = require("../types");
17
+
18
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
19
+
20
+ var _styles = require("../styles");
21
+
22
+ var _common = require("../common");
23
+
24
+ var _jsxRuntime = require("react/jsx-runtime");
25
+
26
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
27
+
28
+ var SegmentControlItemContent = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n border-radius: 8px;\n padding: 0 16px;\n\n background-color: transparent;\n color: ", ";\n"])), _styles.COLORS.neutral_600);
29
+
30
+ exports.SegmentControlItemContent = SegmentControlItemContent;
31
+
32
+ var SegmentControlItemBackground = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1;\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding: 4px 0px;\n"])), _styles.COLORS.neutral_20);
33
+
34
+ exports.SegmentControlItemBackground = SegmentControlItemBackground;
35
+
36
+ var SegmentControlItemWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n flex: 1;\n cursor: pointer;\n min-height: 48px;\n\n &:focus {\n z-index: ", ";\n outline: none;\n\n ", " {\n background-color: ", ";\n color: ", ";\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n }\n }\n\n &:hover {\n z-index: ", ";\n\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n\n &:active {\n z-index: ", ";\n\n ", " {\n background-color: ", ";\n color: ", ";\n box-shadow: none;\n }\n }\n\n &.disabled {\n pointer-events: none;\n cursor: not-allowed;\n\n ", " {\n background-color: transparent;\n color: ", ";\n }\n }\n\n &.selected {\n cursor: default;\n pointer-events: none;\n\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n\n &.selected.disabled {\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), _styles.Z_INDEXES.focus, SegmentControlItemContent, _styles.COLORS.primary_100, _styles.COLORS.primary_700, _styles.Z_INDEXES.hover, SegmentControlItemContent, _styles.COLORS.primary_100, _styles.COLORS.primary_700, _styles.Z_INDEXES.active, SegmentControlItemContent, _styles.COLORS.primary_200, _styles.COLORS.primary_800, SegmentControlItemContent, _styles.COLORS.neutral_300, SegmentControlItemContent, _styles.COLORS.primary_500, _styles.COLORS.white, SegmentControlItemContent, _styles.COLORS.neutral_100, _styles.COLORS.neutral_300);
37
+
38
+ exports.SegmentControlItemWrapper = SegmentControlItemWrapper;
39
+
40
+ var SegmentControlWrapper = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n ", ":first-of-type {\n ", " {\n border-bottom-left-radius: 12px;\n border-top-left-radius: 12px;\n padding-left: 4px;\n }\n }\n\n ", ":last-of-type {\n ", " {\n border-bottom-right-radius: 12px;\n border-top-right-radius: 12px;\n padding-right: 4px;\n }\n }\n\n\n &.small {\n ", " {\n ", "\n min-height: 32px;\n }\n }\n\n &.medium {\n ", " {\n ", "\n min-height: 40px;\n }\n }\n"])), SegmentControlItemWrapper, SegmentControlItemBackground, SegmentControlItemWrapper, SegmentControlItemBackground, SegmentControlItemContent, (0, _styles.ComponentSStyling)(_styles.ComponentTextStyle.Bold, null), SegmentControlItemContent, (0, _styles.ComponentMStyling)(_styles.ComponentTextStyle.Bold, null));
41
+
42
+ exports.SegmentControlWrapper = SegmentControlWrapper;
43
+
44
+ var SegmentControl = function SegmentControl(_ref) {
45
+ var items = _ref.items,
46
+ _ref$size = _ref.size,
47
+ size = _ref$size === void 0 ? _types.Size.Medium : _ref$size,
48
+ onChange = _ref.onChange,
49
+ selected = _ref.selected;
50
+
51
+ var onKeyPress = function onKeyPress(e, item) {
52
+ if (e.key === 'Enter' || e.key === ' ') {
53
+ var _document, _document$activeEleme;
54
+
55
+ //@ts-ignore
56
+ (_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.blur();
57
+ !item.disabled && onChange(item.key);
58
+ }
59
+ };
60
+
61
+ var onClick = function onClick(e, item) {
62
+ !item.disabled && onChange(item.key);
63
+ };
64
+
65
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SegmentControlWrapper, {
66
+ className: size,
67
+ children: items.map(function (a, i) {
68
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(SegmentControlItemWrapper, {
69
+ className: (a.disabled ? 'disabled' : '') + (a.key === selected ? ' selected' : ''),
70
+ tabIndex: a.disabled || a.key === selected ? -1 : 0,
71
+ onClick: a.disabled ? undefined : function (e) {
72
+ return onClick(e, a);
73
+ },
74
+ onMouseDown: _common.defaultOnMouseDownHandler,
75
+ onKeyPress: a.disabled ? undefined : function (e) {
76
+ return onKeyPress(e, a);
77
+ },
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SegmentControlItemBackground, {
79
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(SegmentControlItemContent, {
80
+ children: a.content
81
+ })
82
+ })
83
+ }, a.key || i);
84
+ })
85
+ });
86
+ };
87
+
88
+ SegmentControl.propTypes = {
89
+ items: _propTypes.default.arrayOf(_propTypes.default.shape({
90
+ key: _propTypes.default.string.isRequired,
91
+ disabled: _propTypes.default.bool,
92
+ content: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.string]).isRequired
93
+ })).isRequired,
94
+ selected: _propTypes.default.string.isRequired,
95
+ onChange: _propTypes.default.func.isRequired
96
+ };
97
+ var _default = SegmentControl;
98
+ exports.default = _default;
99
+ //# sourceMappingURL=SegmentControl.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/SegmentControl/SegmentControl.tsx"],"names":["SegmentControlItemContent","styled","div","COLORS","neutral_600","SegmentControlItemBackground","neutral_20","SegmentControlItemWrapper","Z_INDEXES","focus","primary_100","primary_700","hover","active","primary_200","primary_800","neutral_300","primary_500","white","neutral_100","SegmentControlWrapper","ComponentTextStyle","Bold","SegmentControl","items","size","Size","Medium","onChange","selected","onKeyPress","e","item","key","document","activeElement","blur","disabled","onClick","map","a","i","undefined","defaultOnMouseDownHandler","content"],"mappings":";;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAGO,IAAMA,yBAAyB,GAAGC,0BAAOC,GAAV,2QAS3BC,eAAOC,WAToB,CAA/B;;;;AAYA,IAAMC,4BAA4B,GAAGJ,0BAAOC,GAAV,sNAKnBC,eAAOG,UALY,CAAlC;;;;AASA,IAAMC,yBAAyB,GAAGN,0BAAOC,GAAV,ykCAUvBM,kBAAUC,KAVa,EAahCT,yBAbgC,EAcZG,eAAOO,WAdK,EAevBP,eAAOQ,WAfgB,EAqBvBH,kBAAUI,KArBa,EAuBhCZ,yBAvBgC,EAwBZG,eAAOO,WAxBK,EAyBvBP,eAAOQ,WAzBgB,EA8BvBH,kBAAUK,MA9Ba,EAgChCb,yBAhCgC,EAiCZG,eAAOW,WAjCK,EAkCvBX,eAAOY,WAlCgB,EA2ChCf,yBA3CgC,EA6CvBG,eAAOa,WA7CgB,EAqDhChB,yBArDgC,EAsDZG,eAAOc,WAtDK,EAuDvBd,eAAOe,KAvDgB,EA4DhClB,yBA5DgC,EA6DZG,eAAOgB,WA7DK,EA8DvBhB,eAAOa,WA9DgB,CAA/B;;;;AAmEA,IAAMI,qBAAqB,GAAGnB,0BAAOC,GAAV,ynBAM9BK,yBAN8B,EAO5BF,4BAP4B,EAc9BE,yBAd8B,EAe5BF,4BAf4B,EAwB5BL,yBAxB4B,EAyB1B,+BAAkBqB,2BAAmBC,IAArC,EAA2C,IAA3C,CAzB0B,EA+B5BtB,yBA/B4B,EAgC1B,+BAAkBqB,2BAAmBC,IAArC,EAA2C,IAA3C,CAhC0B,CAA3B;;;;AAoDP,IAAMC,cAA4D,GAAG,SAA/D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WAAW,EAAEG,iCAJxC;AAK2B,QAAA,UAAU,EAAEH,CAAC,CAACH,QAAF,GAAaK,SAAb,GAAyB,UAACX,CAAD;AAAA,iBAAOD,UAAU,CAACC,CAAD,EAAIS,CAAJ,CAAjB;AAAA,SALhE;AAAA,+BAME,qBAAC,4BAAD;AAAA,iCACE,qBAAC,yBAAD;AAAA,sBACGA,CAAC,CAACI;AADL;AADF;AANF,SAAgCJ,CAAC,CAACP,GAAF,IAASQ,CAAzC,CADS;AAAA,KAAV;AADH,IADF;AAkBD,CApCD;;;AANEjB,EAAAA,K;AANAS,IAAAA,G;AACAI,IAAAA,Q;AACAO,IAAAA,O;;AAKAf,EAAAA,Q;AACAD,EAAAA,Q;;eA0CaL,c","sourcesContent":["import React from 'react';\nimport {Size} from '../types';\nimport styled from 'styled-components';\nimport {COLORS, ComponentMStyling, ComponentSStyling, ComponentTextStyle, Z_INDEXES} from '../styles';\nimport {defaultOnMouseDownHandler} from '../common';\n\n\nexport const SegmentControlItemContent = styled.div`\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n border-radius: 8px;\n padding: 0 16px;\n\n background-color: transparent;\n color: ${COLORS.neutral_600};\n`\n\nexport const SegmentControlItemBackground = styled.div`\n flex: 1;\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: ${COLORS.neutral_20};\n padding: 4px 0px;\n`;\n\nexport const SegmentControlItemWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n flex: 1;\n cursor: pointer;\n min-height: 48px;\n\n &:focus {\n z-index: ${Z_INDEXES.focus};\n outline: none;\n\n ${SegmentControlItemContent} {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_700};\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n }\n }\n\n &:hover {\n z-index: ${Z_INDEXES.hover};\n\n ${SegmentControlItemContent} {\n background-color: ${COLORS.primary_100};\n color: ${COLORS.primary_700};\n }\n }\n\n &:active {\n z-index: ${Z_INDEXES.active};\n\n ${SegmentControlItemContent} {\n background-color: ${COLORS.primary_200};\n color: ${COLORS.primary_800};\n box-shadow: none;\n }\n }\n\n &.disabled {\n pointer-events: none;\n cursor: not-allowed;\n\n ${SegmentControlItemContent} {\n background-color: transparent;\n color: ${COLORS.neutral_300};\n }\n }\n\n &.selected {\n cursor: default;\n pointer-events: none;\n\n ${SegmentControlItemContent} {\n background-color: ${COLORS.primary_500};\n color: ${COLORS.white};\n }\n }\n\n &.selected.disabled {\n ${SegmentControlItemContent} {\n background-color: ${COLORS.neutral_100};\n color: ${COLORS.neutral_300};\n }\n }\n`;\n\nexport const SegmentControlWrapper = styled.div`\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n ${SegmentControlItemWrapper}:first-of-type {\n ${SegmentControlItemBackground} {\n border-bottom-left-radius: 12px;\n border-top-left-radius: 12px;\n padding-left: 4px;\n }\n }\n\n ${SegmentControlItemWrapper}:last-of-type {\n ${SegmentControlItemBackground} {\n border-bottom-right-radius: 12px;\n border-top-right-radius: 12px;\n padding-right: 4px;\n }\n }\n\n\n &.small {\n ${SegmentControlItemContent} {\n ${ComponentSStyling(ComponentTextStyle.Bold, null)}\n min-height: 32px;\n }\n }\n\n &.medium {\n ${SegmentControlItemContent} {\n ${ComponentMStyling(ComponentTextStyle.Bold, null)}\n min-height: 40px;\n }\n }\n`;\n\n\nexport interface SegmentControlItem {\n key: string\n disabled?: boolean;\n content: React.ReactNode | string;\n}\n\ninterface SegmentControlProps {\n items: SegmentControlItem[];\n selected: string;\n onChange: (value: string) => void;\n size?: Size.Small | Size.Medium;\n}\n\nconst SegmentControl: React.FunctionComponent<SegmentControlProps> = ({\n items,\n size = Size.Medium,\n onChange,\n selected\n }) => {\n const onKeyPress = (e: React.KeyboardEvent<HTMLDivElement>, item: SegmentControlItem) => {\n if (e.key === 'Enter' || e.key === ' ') {\n //@ts-ignore\n document?.activeElement?.blur();\n !item.disabled && onChange(item.key);\n }\n };\n\n const onClick = (e: React.MouseEvent, item: SegmentControlItem) => {\n !item.disabled && onChange(item.key);\n }\n\n return (\n <SegmentControlWrapper className={size}>\n {items.map((a, i) =>\n <SegmentControlItemWrapper key={a.key || i}\n className={(a.disabled ? 'disabled' : '') + (a.key === selected ? ' selected' : '')}\n tabIndex={a.disabled || a.key === selected ? -1 : 0}\n onClick={a.disabled ? undefined : (e) => onClick(e, a)}\n onMouseDown={defaultOnMouseDownHandler}\n onKeyPress={a.disabled ? undefined : (e) => onKeyPress(e, a)}>\n <SegmentControlItemBackground>\n <SegmentControlItemContent>\n {a.content}\n </SegmentControlItemContent>\n </SegmentControlItemBackground>\n </SegmentControlItemWrapper>)\n }\n </SegmentControlWrapper>\n );\n};\n\nexport default SegmentControl;\n"],"file":"SegmentControl.cjs"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { Size } from '../types';
3
+ export declare const SegmentControlItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const SegmentControlItemBackground: import("styled-components").StyledComponent<"div", any, {}, never>;
5
+ export declare const SegmentControlItemWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
6
+ export declare const SegmentControlWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
7
+ export interface SegmentControlItem {
8
+ key: string;
9
+ disabled?: boolean;
10
+ content: React.ReactNode | string;
11
+ }
12
+ interface SegmentControlProps {
13
+ items: SegmentControlItem[];
14
+ selected: string;
15
+ onChange: (value: string) => void;
16
+ size?: Size.Small | Size.Medium;
17
+ }
18
+ declare const SegmentControl: React.FunctionComponent<SegmentControlProps>;
19
+ export default SegmentControl;
@@ -0,0 +1,71 @@
1
+ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
+ import _pt from "prop-types";
3
+
4
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4;
5
+
6
+ import React from 'react';
7
+ import { Size } from '../types';
8
+ import styled from 'styled-components';
9
+ import { COLORS, ComponentMStyling, ComponentSStyling, ComponentTextStyle, Z_INDEXES } from '../styles';
10
+ import { defaultOnMouseDownHandler } from '../common';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ export var SegmentControlItemContent = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n border-radius: 8px;\n padding: 0 16px;\n\n background-color: transparent;\n color: ", ";\n"])), COLORS.neutral_600);
13
+ export var SegmentControlItemBackground = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n flex: 1;\n display: flex;\n flex-direction: row;\n align-items: center;\n background-color: ", ";\n padding: 4px 0px;\n"])), COLORS.neutral_20);
14
+ export var SegmentControlItemWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: center;\n flex: 1;\n cursor: pointer;\n min-height: 48px;\n\n &:focus {\n z-index: ", ";\n outline: none;\n\n ", " {\n background-color: ", ";\n color: ", ";\n box-shadow: 0px 4px 12px rgba(46, 127, 161, 0.25), 0px 0px 8px #2E7FA1;\n }\n }\n\n &:hover {\n z-index: ", ";\n\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n\n &:active {\n z-index: ", ";\n\n ", " {\n background-color: ", ";\n color: ", ";\n box-shadow: none;\n }\n }\n\n &.disabled {\n pointer-events: none;\n cursor: not-allowed;\n\n ", " {\n background-color: transparent;\n color: ", ";\n }\n }\n\n &.selected {\n cursor: default;\n pointer-events: none;\n\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n\n &.selected.disabled {\n ", " {\n background-color: ", ";\n color: ", ";\n }\n }\n"])), Z_INDEXES.focus, SegmentControlItemContent, COLORS.primary_100, COLORS.primary_700, Z_INDEXES.hover, SegmentControlItemContent, COLORS.primary_100, COLORS.primary_700, Z_INDEXES.active, SegmentControlItemContent, COLORS.primary_200, COLORS.primary_800, SegmentControlItemContent, COLORS.neutral_300, SegmentControlItemContent, COLORS.primary_500, COLORS.white, SegmentControlItemContent, COLORS.neutral_100, COLORS.neutral_300);
15
+ export var SegmentControlWrapper = styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n width: 100%;\n display: flex;\n flex-direction: row;\n align-items: center;\n\n ", ":first-of-type {\n ", " {\n border-bottom-left-radius: 12px;\n border-top-left-radius: 12px;\n padding-left: 4px;\n }\n }\n\n ", ":last-of-type {\n ", " {\n border-bottom-right-radius: 12px;\n border-top-right-radius: 12px;\n padding-right: 4px;\n }\n }\n\n\n &.small {\n ", " {\n ", "\n min-height: 32px;\n }\n }\n\n &.medium {\n ", " {\n ", "\n min-height: 40px;\n }\n }\n"])), SegmentControlItemWrapper, SegmentControlItemBackground, SegmentControlItemWrapper, SegmentControlItemBackground, SegmentControlItemContent, ComponentSStyling(ComponentTextStyle.Bold, null), SegmentControlItemContent, ComponentMStyling(ComponentTextStyle.Bold, null));
16
+
17
+ var SegmentControl = function SegmentControl(_ref) {
18
+ var items = _ref.items,
19
+ _ref$size = _ref.size,
20
+ size = _ref$size === void 0 ? Size.Medium : _ref$size,
21
+ onChange = _ref.onChange,
22
+ selected = _ref.selected;
23
+
24
+ var onKeyPress = function onKeyPress(e, item) {
25
+ if (e.key === 'Enter' || e.key === ' ') {
26
+ var _document, _document$activeEleme;
27
+
28
+ //@ts-ignore
29
+ (_document = document) === null || _document === void 0 ? void 0 : (_document$activeEleme = _document.activeElement) === null || _document$activeEleme === void 0 ? void 0 : _document$activeEleme.blur();
30
+ !item.disabled && onChange(item.key);
31
+ }
32
+ };
33
+
34
+ var onClick = function onClick(e, item) {
35
+ !item.disabled && onChange(item.key);
36
+ };
37
+
38
+ return /*#__PURE__*/_jsx(SegmentControlWrapper, {
39
+ className: size,
40
+ children: items.map(function (a, i) {
41
+ return /*#__PURE__*/_jsx(SegmentControlItemWrapper, {
42
+ className: (a.disabled ? 'disabled' : '') + (a.key === selected ? ' selected' : ''),
43
+ tabIndex: a.disabled || a.key === selected ? -1 : 0,
44
+ onClick: a.disabled ? undefined : function (e) {
45
+ return onClick(e, a);
46
+ },
47
+ onMouseDown: defaultOnMouseDownHandler,
48
+ onKeyPress: a.disabled ? undefined : function (e) {
49
+ return onKeyPress(e, a);
50
+ },
51
+ children: /*#__PURE__*/_jsx(SegmentControlItemBackground, {
52
+ children: /*#__PURE__*/_jsx(SegmentControlItemContent, {
53
+ children: a.content
54
+ })
55
+ })
56
+ }, a.key || i);
57
+ })
58
+ });
59
+ };
60
+
61
+ SegmentControl.propTypes = {
62
+ items: _pt.arrayOf(_pt.shape({
63
+ key: _pt.string.isRequired,
64
+ disabled: _pt.bool,
65
+ content: _pt.oneOfType([_pt.node, _pt.string]).isRequired
66
+ })).isRequired,
67
+ selected: _pt.string.isRequired,
68
+ onChange: _pt.func.isRequired
69
+ };
70
+ export default SegmentControl;
71
+ //# sourceMappingURL=SegmentControl.js.map