carbon-react 104.7.2 → 104.7.3

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.
@@ -17,6 +17,8 @@ var _ether = require("../../__internal__/utils/ether");
17
17
 
18
18
  var _appWrapper = _interopRequireDefault(require("./app-wrapper.style"));
19
19
 
20
+ var _logger = _interopRequireDefault(require("../../__internal__/utils/logger"));
21
+
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
23
 
22
24
  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); }
@@ -41,9 +43,11 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
41
43
 
42
44
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
45
 
46
+ let deprecatedWarnTriggered = false;
44
47
  /**
45
48
  * Manages the width and containment of your application.
46
49
  */
50
+
47
51
  let AppWrapper = /*#__PURE__*/function (_React$Component) {
48
52
  _inherits(AppWrapper, _React$Component);
49
53
 
@@ -56,6 +60,13 @@ let AppWrapper = /*#__PURE__*/function (_React$Component) {
56
60
 
57
61
  _this = _super.call(this, ...args);
58
62
  _this.classes = _this.classes.bind(_assertThisInitialized(_this));
63
+
64
+ if (!deprecatedWarnTriggered) {
65
+ deprecatedWarnTriggered = true; // eslint-disable-next-line max-len
66
+
67
+ _logger.default.deprecate("`AppWrapper` component is now deprecated and will soon be removed. Please use the `Box` component instead.");
68
+ }
69
+
59
70
  return _this;
60
71
  }
61
72
  /**
@@ -44,11 +44,15 @@ const StyledSubmenuWrapper = _styledComponents.default.div`
44
44
  menuType,
45
45
  asPassiveItem,
46
46
  theme
47
- }) => inFullscreenView && asPassiveItem && (0, _styledComponents.css)`
48
- ${_menuItem.default} {
49
- outline: none;
50
- color: ${theme.menu[menuType].title};
51
- }
47
+ }) => inFullscreenView && (0, _styledComponents.css)`
48
+ width: 100%;
49
+
50
+ ${asPassiveItem && (0, _styledComponents.css)`
51
+ ${_menuItem.default} {
52
+ outline: none;
53
+ color: ${theme.menu[menuType].title};
54
+ }
55
+ `}
52
56
  `}
53
57
  `;
54
58
  exports.StyledSubmenuWrapper = StyledSubmenuWrapper;
@@ -75,7 +79,7 @@ const StyledSubmenu = _styledComponents.default.ul`
75
79
 
76
80
  ${inFullscreenView && (0, _styledComponents.css)`
77
81
  ${_menu.StyledMenuItem} {
78
- width: 100vw;
82
+ width: 100%;
79
83
  }
80
84
  `}
81
85
 
@@ -126,7 +130,7 @@ const StyledSubmenu = _styledComponents.default.ul`
126
130
  margin-right: 5px;
127
131
  }
128
132
 
129
- ${_search.default} [data-component="icon"] {
133
+ ${_search.default} span > [data-component="icon"] {
130
134
  color: ${theme.menu[menuType].searchIcon};
131
135
 
132
136
  &:hover {
@@ -106,10 +106,10 @@ const MenuFullscreen = ({
106
106
  type: "close",
107
107
  color: iconColors[menuType]
108
108
  }))), /*#__PURE__*/_react.default.createElement(_box.default, {
109
- overflow: "auto",
109
+ overflowY: "auto",
110
110
  scrollVariant: scrollVariants[menuType],
111
- width: "100vw",
112
- height: "100vh"
111
+ width: "100%",
112
+ height: "calc(100% - 40px)"
113
113
  }, /*#__PURE__*/_react.default.createElement(_menu.StyledMenuWrapper, {
114
114
  "data-component": "menu",
115
115
  menuType: menuType,
@@ -13,6 +13,12 @@ var _iconButton = _interopRequireDefault(require("../../icon-button/icon-button.
13
13
 
14
14
  var _box = _interopRequireDefault(require("../../box"));
15
15
 
16
+ var _search = _interopRequireDefault(require("../../search/search.style"));
17
+
18
+ var _icon = _interopRequireDefault(require("../../icon/icon.style"));
19
+
20
+ var _button = _interopRequireDefault(require("../../button/button.style"));
21
+
16
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
23
 
18
24
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
@@ -23,6 +29,8 @@ const StyledMenuFullscreen = _styledComponents.default.div`
23
29
  position: fixed;
24
30
  top: 0;
25
31
  bottom: 0;
32
+ height: 100vh;
33
+ width: 100%;
26
34
 
27
35
  a,
28
36
  button,
@@ -39,6 +47,45 @@ const StyledMenuFullscreen = _styledComponents.default.div`
39
47
  background-color: ${theme.menu[menuType].background};
40
48
  z-index: ${theme.zIndex.fullScreenModal};
41
49
 
50
+ ${menuType === "dark" && (0, _styledComponents.css)`
51
+ ${_search.default} span > [data-component="icon"] {
52
+ color: ${theme.menu.dark.searchIcon};
53
+
54
+ &:hover {
55
+ color: ${theme.menu.dark.searchIconHover};
56
+ }
57
+ }
58
+ `}
59
+
60
+ ${menuType === "light" && (0, _styledComponents.css)`
61
+ ${_search.default} span > [data-component="icon"] {
62
+ color: ${theme.search.icon};
63
+
64
+ &:hover {
65
+ color: ${theme.search.iconHover};
66
+ }
67
+ }
68
+ `}
69
+
70
+ ${_search.default} {
71
+ ${_icon.default} {
72
+ display: inline-flex;
73
+ margin-right: 0;
74
+ bottom: auto;
75
+ }
76
+
77
+ ${_button.default} {
78
+ display: flex;
79
+ line-height: normal;
80
+ padding-bottom: 0;
81
+
82
+ &:focus {
83
+ outline: solid 3px var(--colorsSemanticFocus500);
84
+ box-shadow: none;
85
+ }
86
+ }
87
+ }
88
+
42
89
  ${isOpen && (0, _styledComponents.css)`
43
90
  visibility: visible;
44
91
  ${startPosition}: 0;
@@ -47,7 +94,7 @@ const StyledMenuFullscreen = _styledComponents.default.div`
47
94
 
48
95
  ${!isOpen && (0, _styledComponents.css)`
49
96
  visibility: hidden;
50
- ${startPosition}: -100vw;
97
+ ${startPosition}: -100%;
51
98
  transition: all 0.3s ease;
52
99
  `}
53
100
  `}
@@ -218,7 +218,6 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
218
218
 
219
219
  ${inFullscreenView && (0, _styledComponents.css)`
220
220
  ${as === "div" && (0, _styledComponents.css)`
221
- width: 100vw;
222
221
  cursor: default;
223
222
  padding: 0 16px;
224
223
 
@@ -226,14 +225,6 @@ const StyledMenuItemWrapper = _styledComponents.default.a`
226
225
  background: transparent;
227
226
  }
228
227
  `}
229
-
230
- a,
231
- ${_link.StyledLink} a,
232
- button,
233
- ${_link.StyledLink} button {
234
- width: 100vw;
235
- box-sizing: border-box;
236
- }
237
228
  `}
238
229
  `}
239
230
  `;
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.MenuFullScreenStory = exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _addonActions = require("@storybook/addon-actions");
11
+
12
+ var _ = require(".");
13
+
14
+ var _menuItem = _interopRequireDefault(require("./menu-item"));
15
+
16
+ var _menuFullScreen = _interopRequireDefault(require("./menu-full-screen"));
17
+
18
+ var _search = _interopRequireDefault(require("../search"));
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
23
+
24
+ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
25
+
26
+ /* eslint-disable react/prop-types */
27
+ var _default = {
28
+ title: "Menu/Test",
29
+ parameters: {
30
+ info: {
31
+ disable: true
32
+ },
33
+ chromatic: {
34
+ disable: false
35
+ }
36
+ },
37
+ argTypes: {
38
+ menuType: {
39
+ options: ["light", "dark"],
40
+ control: {
41
+ type: "select"
42
+ }
43
+ },
44
+ startPosition: {
45
+ options: ["left", "right"],
46
+ control: {
47
+ type: "select"
48
+ }
49
+ },
50
+ searchVariant: {
51
+ options: ["default", "dark"],
52
+ control: {
53
+ type: "select"
54
+ }
55
+ },
56
+ searchButton: {
57
+ options: [true, false],
58
+ control: {
59
+ type: "boolean"
60
+ }
61
+ }
62
+ }
63
+ };
64
+ exports.default = _default;
65
+
66
+ const MenuFullScreenStory = ({
67
+ menuType,
68
+ startPosition,
69
+ searchVariant,
70
+ searchButton
71
+ }) => {
72
+ const [isOpen, setIsOpen] = (0, _react.useState)(true);
73
+
74
+ const onClose = evt => {
75
+ setIsOpen(false);
76
+ (0, _addonActions.action)("close icon clicked")(evt);
77
+ };
78
+
79
+ const handleOpen = () => {
80
+ setIsOpen(true);
81
+ (0, _addonActions.action)("open")();
82
+ };
83
+
84
+ return /*#__PURE__*/_react.default.createElement(_.Menu, {
85
+ menuType: menuType
86
+ }, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
87
+ onClick: handleOpen
88
+ }, "Menu"), /*#__PURE__*/_react.default.createElement(_menuFullScreen.default, {
89
+ startPosition: startPosition,
90
+ isOpen: isOpen,
91
+ onClose: onClose
92
+ }, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
93
+ href: "#"
94
+ }, "Menu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
95
+ onClick: evt => (0, _addonActions.action)("submenu item clicked")(evt),
96
+ submenu: "Menu Item Two"
97
+ }, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
98
+ href: "#"
99
+ }, "Submenu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
100
+ href: "#"
101
+ }, "Submenu Item Two")), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
102
+ variant: "alternate"
103
+ }, /*#__PURE__*/_react.default.createElement(_search.default, {
104
+ placeholder: "Search...",
105
+ variant: searchVariant,
106
+ defaultValue: "",
107
+ searchButton: searchButton
108
+ })), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
109
+ href: "#"
110
+ }, "Menu Item Three"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
111
+ href: "#"
112
+ }, "Menu Item Four"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
113
+ submenu: "Menu Item Five"
114
+ }, /*#__PURE__*/_react.default.createElement(_menuItem.default, {
115
+ href: "#"
116
+ }, "Submenu Item One"), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
117
+ href: "#"
118
+ }, "Submenu Item Two")), /*#__PURE__*/_react.default.createElement(_menuItem.default, {
119
+ href: "#"
120
+ }, "Menu Item Six")));
121
+ };
122
+
123
+ exports.MenuFullScreenStory = MenuFullScreenStory;
124
+ MenuFullScreenStory.story = {
125
+ name: "fullscreen menu",
126
+ args: {
127
+ menuType: "light",
128
+ startPosition: "left",
129
+ searchVariant: "default",
130
+ searchButton: true
131
+ }
132
+ };
@@ -13,6 +13,8 @@ var _verticalDivider = require("../vertical-divider/vertical-divider.style");
13
13
 
14
14
  var _themes = require("../../style/themes");
15
15
 
16
+ var _link = require("../link/link.style");
17
+
16
18
  function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
17
19
 
18
20
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
@@ -46,12 +48,6 @@ const StyledMenuWrapper = _styledComponents.default.ul`
46
48
  top: -1px;
47
49
  }
48
50
  }
49
-
50
- ${({
51
- inFullscreenView
52
- }) => inFullscreenView && (0, _styledComponents.css)`
53
- padding-bottom: 24px;
54
- `}
55
51
  `;
56
52
  exports.StyledMenuWrapper = StyledMenuWrapper;
57
53
  const StyledMenuItem = _styledComponents.default.li`
@@ -71,6 +67,17 @@ const StyledMenuItem = _styledComponents.default.li`
71
67
  }) => inFullscreenView && (0, _styledComponents.css)`
72
68
  padding-top: 16px;
73
69
  padding-bottom: 16px;
70
+
71
+ a,
72
+ ${_link.StyledLink} a,
73
+ button,
74
+ ${_link.StyledLink} button,
75
+ > span,
76
+ > div,
77
+ [data-component="submenu-wrapper"] > ${_link.StyledLink} {
78
+ width: 100%;
79
+ box-sizing: border-box;
80
+ }
74
81
  `}
75
82
  `;
76
83
  exports.StyledMenuItem = StyledMenuItem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "carbon-react",
3
- "version": "104.7.2",
3
+ "version": "104.7.3",
4
4
  "description": "A library of reusable React components for easily building user interfaces.",
5
5
  "engineStrict": true,
6
6
  "engines": {