@targetprocess/menu 12.27.4 → 12.29.0-alpha.0
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/Menu.jsx +12 -10
- package/dist/menu.es.js +18 -6
- package/dist/menu.js +18 -6
- package/package.json +4 -4
package/Menu.jsx
CHANGED
|
@@ -231,7 +231,7 @@ export class Menu extends React.Component {
|
|
|
231
231
|
onOuterAction = () => this.props.closeOnOuterAction && this.setOpened(false)
|
|
232
232
|
|
|
233
233
|
prepareTrigger = menuChildren => {
|
|
234
|
-
const {isLeftOpen, navigationState} = this.props
|
|
234
|
+
const {isLeftOpen, isAnchoredBottom, navigationState} = this.props
|
|
235
235
|
const isOpen = this.isControlledMode() ? this.props.open : this.state.open
|
|
236
236
|
const menuTrigger = menuChildren.find(element => element.type === MenuTrigger)
|
|
237
237
|
if (!menuTrigger) {
|
|
@@ -251,12 +251,15 @@ export class Menu extends React.Component {
|
|
|
251
251
|
|
|
252
252
|
const trigger = typeof children === 'function' ? children(renderCallbackArgs) : children
|
|
253
253
|
|
|
254
|
-
const getPopoverPosition =
|
|
255
|
-
typeof this.props.getPopoverPosition
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
254
|
+
const getPopoverPosition = hostRect => {
|
|
255
|
+
if (typeof this.props.getPopoverPosition !== 'undefined') {
|
|
256
|
+
return this.props.getPopoverPosition
|
|
257
|
+
}
|
|
258
|
+
if (isAnchoredBottom) {
|
|
259
|
+
return isLeftOpen ? {right: 0, top: hostRect.height} : {left: 0, top: hostRect.height}
|
|
260
|
+
}
|
|
261
|
+
return isLeftOpen ? {right: hostRect.width, top: 0} : {left: hostRect.width, top: 0}
|
|
262
|
+
}
|
|
260
263
|
return {trigger, getPopoverPosition}
|
|
261
264
|
}
|
|
262
265
|
|
|
@@ -277,7 +280,6 @@ export class Menu extends React.Component {
|
|
|
277
280
|
inline={this.props.appendInline}
|
|
278
281
|
relativeToParent={this.props.relativeToParent}
|
|
279
282
|
getPopoverPosition={getPopoverPosition}
|
|
280
|
-
getContainerElement={this.props.getContainerElement}
|
|
281
283
|
>
|
|
282
284
|
{trigger}
|
|
283
285
|
</Popover>
|
|
@@ -303,6 +305,7 @@ Menu.propTypes = {
|
|
|
303
305
|
* (This option may override `Trigger` offset option)
|
|
304
306
|
*/
|
|
305
307
|
isLeftOpen: PropTypes.bool,
|
|
308
|
+
isAnchoredBottom: PropTypes.bool,
|
|
306
309
|
closeOnOuterAction: PropTypes.bool,
|
|
307
310
|
/**
|
|
308
311
|
* Naviagtion` state represent set of characterisics
|
|
@@ -321,8 +324,7 @@ Menu.propTypes = {
|
|
|
321
324
|
isOpenMenu: PropTypes.bool,
|
|
322
325
|
currentEvent: PropTypes.string,
|
|
323
326
|
onChangeMenuState: PropTypes.func
|
|
324
|
-
})
|
|
325
|
-
getContainerElement: Popover.propTypes && Popover.propTypes.getContainerElement
|
|
327
|
+
})
|
|
326
328
|
}
|
|
327
329
|
|
|
328
330
|
Menu.defaultProps = {
|
package/dist/menu.es.js
CHANGED
|
@@ -166,8 +166,8 @@ function styleInject(css, ref) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.menu__menu__12-
|
|
170
|
-
var styles = {"menu":"menu__menu__12-
|
|
169
|
+
var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.menu__menu__12-29-0-alpha-0 {\n -webkit-transition-property: opacity !important;\n transition-property: opacity !important;\n -webkit-transform: none !important;\n transform: none !important;\n padding: 0;\n}\n.menu__item__menu__12-29-0-alpha-0 {\n font-size: var(--FontSizeDefault, 13px);\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n.menu__item__content__menu__12-29-0-alpha-0 {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n }\n.menu__item__content--left__menu__12-29-0-alpha-0 {\n padding-left: var(--IconsSizeDefault, 16px);\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon__menu__12-29-0-alpha-0 {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon--left__menu__12-29-0-alpha-0 {\n margin-right: var(--SpaceS, 8px);\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon--right__menu__12-29-0-alpha-0 {\n margin-left: var(--SpaceS, 8px);\n }\n.menu__item__menu__12-29-0-alpha-0:not(.menu__item--disabled__menu__12-29-0-alpha-0):hover {\n cursor: pointer;\n }\n.menu__item--disabled__menu__12-29-0-alpha-0 {\n opacity: var(--ControlDisabledOpacity, 0.5);\n cursor: not-allowed;\n }\n.menu__item--danger__menu__12-29-0-alpha-0 {\n color: var(--ActionColorDelete, #AE304A);\n }\n.menu__item--danger__menu__12-29-0-alpha-0:not(.menu__item--disabled__menu__12-29-0-alpha-0):hover {\n background-color: var(--ActionBackgroundDelete, #F3E0E4);\n }\n.menu__item--current__menu__12-29-0-alpha-0 {\n background-color: var(--HighlightBlockBackground, #F5F6F6); /* keyboard current background */\n }\n.menu__item--selected__menu__12-29-0-alpha-0:not(.menu__item--danger__menu__12-29-0-alpha-0) {\n background-color: var(--ActionBackgroundSelected, #F1CE4A);\n }\n.menu__item__menu__12-29-0-alpha-0:not(.menu__item--danger__menu__12-29-0-alpha-0):not(.menu__item--disabled__menu__12-29-0-alpha-0):not(.menu__item--selected__menu__12-29-0-alpha-0):hover {\n background-color: var(--ActionBackgroundHover, #F9E9AE);\n }\n.menu__item__menu__12-29-0-alpha-0:last-child {\n border-radius: 0 0 var(--BorderRadiusDefault, 3px) var(--BorderRadiusDefault, 3px);\n }\n.menu__separator__menu__12-29-0-alpha-0 {\n margin: var(--SpaceXS, 4px) 0;\n border-top: solid 1px var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n }\n.menu__separator__title__menu__12-29-0-alpha-0 {\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px) var(--SpaceXS, 4px) var(--SpaceSM, 12px);\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: var(--FontSizeLabel, 11px);\n line-height: 1.3;\n font-weight: var(--FontWeightSemibold, 600);\n text-transform: uppercase;\n color: var(--FontColorGray, rgba(0, 0, 0, 0.7));\n letter-spacing: 0.4px;\n }\n";
|
|
170
|
+
var styles = {"menu":"menu__menu__12-29-0-alpha-0","menu__item":"menu__item__menu__12-29-0-alpha-0","menu__item__content":"menu__item__content__menu__12-29-0-alpha-0","menu__item__content--left":"menu__item__content--left__menu__12-29-0-alpha-0","submenu-icon":"submenu-icon__menu__12-29-0-alpha-0","submenu-icon--left":"submenu-icon--left__menu__12-29-0-alpha-0","submenu-icon--right":"submenu-icon--right__menu__12-29-0-alpha-0","menu__item--disabled":"menu__item--disabled__menu__12-29-0-alpha-0","menu__item--danger":"menu__item--danger__menu__12-29-0-alpha-0","menu__item--current":"menu__item--current__menu__12-29-0-alpha-0","menu__item--selected":"menu__item--selected__menu__12-29-0-alpha-0","menu__separator":"menu__separator__menu__12-29-0-alpha-0","menu__separator__title":"menu__separator__title__menu__12-29-0-alpha-0"};
|
|
171
171
|
styleInject(css);
|
|
172
172
|
|
|
173
173
|
/**
|
|
@@ -389,6 +389,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
389
389
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "prepareTrigger", function (menuChildren) {
|
|
390
390
|
var _this$props2 = _this.props,
|
|
391
391
|
isLeftOpen = _this$props2.isLeftOpen,
|
|
392
|
+
isAnchoredBottom = _this$props2.isAnchoredBottom,
|
|
392
393
|
navigationState = _this$props2.navigationState;
|
|
393
394
|
var isOpen = _this.isControlledMode() ? _this.props.open : _this.state.open;
|
|
394
395
|
var menuTrigger = menuChildren.find(function (element) {
|
|
@@ -406,7 +407,19 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
406
407
|
setOpened: _this.setOpened
|
|
407
408
|
};
|
|
408
409
|
var trigger = typeof children === 'function' ? children(renderCallbackArgs) : children;
|
|
409
|
-
var getPopoverPosition =
|
|
410
|
+
var getPopoverPosition = function getPopoverPosition(hostRect) {
|
|
411
|
+
if (typeof _this.props.getPopoverPosition !== 'undefined') {
|
|
412
|
+
return _this.props.getPopoverPosition;
|
|
413
|
+
}
|
|
414
|
+
if (isAnchoredBottom) {
|
|
415
|
+
return isLeftOpen ? {
|
|
416
|
+
right: 0,
|
|
417
|
+
top: hostRect.height
|
|
418
|
+
} : {
|
|
419
|
+
left: 0,
|
|
420
|
+
top: hostRect.height
|
|
421
|
+
};
|
|
422
|
+
}
|
|
410
423
|
return isLeftOpen ? {
|
|
411
424
|
right: hostRect.width,
|
|
412
425
|
top: 0
|
|
@@ -414,7 +427,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
414
427
|
left: hostRect.width,
|
|
415
428
|
top: 0
|
|
416
429
|
};
|
|
417
|
-
}
|
|
430
|
+
};
|
|
418
431
|
return {
|
|
419
432
|
trigger: trigger,
|
|
420
433
|
getPopoverPosition: getPopoverPosition
|
|
@@ -567,8 +580,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
567
580
|
body: renderBody(menuItems),
|
|
568
581
|
inline: this.props.appendInline,
|
|
569
582
|
relativeToParent: this.props.relativeToParent,
|
|
570
|
-
getPopoverPosition: getPopoverPosition
|
|
571
|
-
getContainerElement: this.props.getContainerElement
|
|
583
|
+
getPopoverPosition: getPopoverPosition
|
|
572
584
|
}, trigger);
|
|
573
585
|
}
|
|
574
586
|
}]);
|
package/dist/menu.js
CHANGED
|
@@ -172,8 +172,8 @@ function styleInject(css, ref) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
|
|
175
|
-
var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.menu__menu__12-
|
|
176
|
-
var styles = {"menu":"menu__menu__12-
|
|
175
|
+
var css = "/*********************************************************************\n* © Copyright IBM Corp. 2024\n*********************************************************************/\n.menu__menu__12-29-0-alpha-0 {\n -webkit-transition-property: opacity !important;\n transition-property: opacity !important;\n -webkit-transform: none !important;\n transform: none !important;\n padding: 0;\n}\n.menu__item__menu__12-29-0-alpha-0 {\n font-size: var(--FontSizeDefault, 13px);\n position: relative;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px);\n -webkit-box-sizing: border-box;\n box-sizing: border-box;\n }\n.menu__item__content__menu__12-29-0-alpha-0 {\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n -webkit-box-flex: 1;\n -ms-flex: 1 1 auto;\n flex: 1 1 auto;\n }\n.menu__item__content--left__menu__12-29-0-alpha-0 {\n padding-left: var(--IconsSizeDefault, 16px);\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon__menu__12-29-0-alpha-0 {\n -webkit-box-flex: 0;\n -ms-flex: 0 0 auto;\n flex: 0 0 auto;\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon--left__menu__12-29-0-alpha-0 {\n margin-right: var(--SpaceS, 8px);\n }\n.menu__item__menu__12-29-0-alpha-0 .submenu-icon--right__menu__12-29-0-alpha-0 {\n margin-left: var(--SpaceS, 8px);\n }\n.menu__item__menu__12-29-0-alpha-0:not(.menu__item--disabled__menu__12-29-0-alpha-0):hover {\n cursor: pointer;\n }\n.menu__item--disabled__menu__12-29-0-alpha-0 {\n opacity: var(--ControlDisabledOpacity, 0.5);\n cursor: not-allowed;\n }\n.menu__item--danger__menu__12-29-0-alpha-0 {\n color: var(--ActionColorDelete, #AE304A);\n }\n.menu__item--danger__menu__12-29-0-alpha-0:not(.menu__item--disabled__menu__12-29-0-alpha-0):hover {\n background-color: var(--ActionBackgroundDelete, #F3E0E4);\n }\n.menu__item--current__menu__12-29-0-alpha-0 {\n background-color: var(--HighlightBlockBackground, #F5F6F6); /* keyboard current background */\n }\n.menu__item--selected__menu__12-29-0-alpha-0:not(.menu__item--danger__menu__12-29-0-alpha-0) {\n background-color: var(--ActionBackgroundSelected, #F1CE4A);\n }\n.menu__item__menu__12-29-0-alpha-0:not(.menu__item--danger__menu__12-29-0-alpha-0):not(.menu__item--disabled__menu__12-29-0-alpha-0):not(.menu__item--selected__menu__12-29-0-alpha-0):hover {\n background-color: var(--ActionBackgroundHover, #F9E9AE);\n }\n.menu__item__menu__12-29-0-alpha-0:last-child {\n border-radius: 0 0 var(--BorderRadiusDefault, 3px) var(--BorderRadiusDefault, 3px);\n }\n.menu__separator__menu__12-29-0-alpha-0 {\n margin: var(--SpaceXS, 4px) 0;\n border-top: solid 1px var(--HighlightBlockBorderColor, rgba(64, 66, 73, 0.1));\n }\n.menu__separator__title__menu__12-29-0-alpha-0 {\n padding: var(--SpaceS, 8px) var(--SpaceSM, 12px) var(--SpaceXS, 4px) var(--SpaceSM, 12px);\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n font-size: var(--FontSizeLabel, 11px);\n line-height: 1.3;\n font-weight: var(--FontWeightSemibold, 600);\n text-transform: uppercase;\n color: var(--FontColorGray, rgba(0, 0, 0, 0.7));\n letter-spacing: 0.4px;\n }\n";
|
|
176
|
+
var styles = {"menu":"menu__menu__12-29-0-alpha-0","menu__item":"menu__item__menu__12-29-0-alpha-0","menu__item__content":"menu__item__content__menu__12-29-0-alpha-0","menu__item__content--left":"menu__item__content--left__menu__12-29-0-alpha-0","submenu-icon":"submenu-icon__menu__12-29-0-alpha-0","submenu-icon--left":"submenu-icon--left__menu__12-29-0-alpha-0","submenu-icon--right":"submenu-icon--right__menu__12-29-0-alpha-0","menu__item--disabled":"menu__item--disabled__menu__12-29-0-alpha-0","menu__item--danger":"menu__item--danger__menu__12-29-0-alpha-0","menu__item--current":"menu__item--current__menu__12-29-0-alpha-0","menu__item--selected":"menu__item--selected__menu__12-29-0-alpha-0","menu__separator":"menu__separator__menu__12-29-0-alpha-0","menu__separator__title":"menu__separator__title__menu__12-29-0-alpha-0"};
|
|
177
177
|
styleInject(css);
|
|
178
178
|
|
|
179
179
|
/**
|
|
@@ -395,6 +395,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
395
395
|
_defineProperty(_assertThisInitialized(_assertThisInitialized(_this)), "prepareTrigger", function (menuChildren) {
|
|
396
396
|
var _this$props2 = _this.props,
|
|
397
397
|
isLeftOpen = _this$props2.isLeftOpen,
|
|
398
|
+
isAnchoredBottom = _this$props2.isAnchoredBottom,
|
|
398
399
|
navigationState = _this$props2.navigationState;
|
|
399
400
|
var isOpen = _this.isControlledMode() ? _this.props.open : _this.state.open;
|
|
400
401
|
var menuTrigger = menuChildren.find(function (element) {
|
|
@@ -412,7 +413,19 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
412
413
|
setOpened: _this.setOpened
|
|
413
414
|
};
|
|
414
415
|
var trigger = typeof children === 'function' ? children(renderCallbackArgs) : children;
|
|
415
|
-
var getPopoverPosition =
|
|
416
|
+
var getPopoverPosition = function getPopoverPosition(hostRect) {
|
|
417
|
+
if (typeof _this.props.getPopoverPosition !== 'undefined') {
|
|
418
|
+
return _this.props.getPopoverPosition;
|
|
419
|
+
}
|
|
420
|
+
if (isAnchoredBottom) {
|
|
421
|
+
return isLeftOpen ? {
|
|
422
|
+
right: 0,
|
|
423
|
+
top: hostRect.height
|
|
424
|
+
} : {
|
|
425
|
+
left: 0,
|
|
426
|
+
top: hostRect.height
|
|
427
|
+
};
|
|
428
|
+
}
|
|
416
429
|
return isLeftOpen ? {
|
|
417
430
|
right: hostRect.width,
|
|
418
431
|
top: 0
|
|
@@ -420,7 +433,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
420
433
|
left: hostRect.width,
|
|
421
434
|
top: 0
|
|
422
435
|
};
|
|
423
|
-
}
|
|
436
|
+
};
|
|
424
437
|
return {
|
|
425
438
|
trigger: trigger,
|
|
426
439
|
getPopoverPosition: getPopoverPosition
|
|
@@ -573,8 +586,7 @@ var Menu = /*#__PURE__*/function (_React$Component) {
|
|
|
573
586
|
body: renderBody(menuItems),
|
|
574
587
|
inline: this.props.appendInline,
|
|
575
588
|
relativeToParent: this.props.relativeToParent,
|
|
576
|
-
getPopoverPosition: getPopoverPosition
|
|
577
|
-
getContainerElement: this.props.getContainerElement
|
|
589
|
+
getPopoverPosition: getPopoverPosition
|
|
578
590
|
}, trigger);
|
|
579
591
|
}
|
|
580
592
|
}]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@targetprocess/menu",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.29.0-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/menu.js",
|
|
6
6
|
"module": "dist/menu.es.js",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"prepack": "node -r ../../.ts-node.js ../../config/rollup.config.js ."
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@targetprocess/icons": "^12.
|
|
14
|
-
"@targetprocess/popover": "^12.
|
|
13
|
+
"@targetprocess/icons": "^12.29.0-alpha.0",
|
|
14
|
+
"@targetprocess/popover": "^12.29.0-alpha.0",
|
|
15
15
|
"classnames": "^2.2.5",
|
|
16
16
|
"prop-types": "^15.6.0",
|
|
17
17
|
"react": "^16.7.0",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
"access": "public"
|
|
22
22
|
},
|
|
23
23
|
"sideEffects": false,
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "2f3e7403b38c771e31c7dce19adb66c93a268f2b"
|
|
25
25
|
}
|