Skip to content

Add button type to updatemenus #974

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 26, 2016
31 changes: 31 additions & 0 deletions src/components/updatemenus/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,30 @@ module.exports = {
].join(' ')
},

type: {
valType: 'enumerated',
values: ['dropdown', 'buttons'],
dflt: 'dropdown',
role: 'info',
description: [
'Determines whether the buttons are accessible via a dropdown menu',
'or whether the buttons are stacked horizontally or vertically'
].join(' ')
},

direction: {
valType: 'enumerated',
values: ['left', 'right', 'up', 'down'],
dflt: 'down',
role: 'info',
description: [
'Determines the direction in which the buttons are laid out, whether',
'in a dropdown menu or a row/column of buttons. For `left` and `up`,',
'the buttons will still appear in left-to-right or top-to-bottom order',
'respectively.'
].join(' ')
},

active: {
valType: 'integer',
role: 'info',
Expand All @@ -68,6 +92,13 @@ module.exports = {
].join(' ')
},

showactive: {
valType: 'boolean',
role: 'info',
dflt: true,
description: 'Highlights active dropdown item or active button if true.'
},

buttons: buttonsAttrs,

x: {
Expand Down
6 changes: 4 additions & 2 deletions src/components/updatemenus/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module.exports = {
headerGroupClassName: 'updatemenu-header-group',
headerClassName: 'updatemenu-header',
headerArrowClassName: 'updatemenu-header-arrow',
buttonGroupClassName: 'updatemenu-button-group',
dropdownButtonGroupClassName: 'updatemenu-dropdown-button-group',
dropdownButtonClassName: 'updatemenu-dropdown-button',
buttonClassName: 'updatemenu-button',
itemRectClassName: 'updatemenu-item-rect',
itemTextClassName: 'updatemenu-item-text',
Expand All @@ -41,7 +42,8 @@ module.exports = {
minHeight: 30,

// padding around item text
textPadX: 40,
textPadX: 24,
arrowPadX: 16,

// font size to height scale
fontSizeToHeight: 1.3,
Expand Down
3 changes: 3 additions & 0 deletions src/components/updatemenus/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ function menuDefaults(menuIn, menuOut, layoutOut) {
if(!visible) return;

coerce('active');
coerce('direction');
coerce('type');
coerce('showactive');

coerce('x');
coerce('y');
Expand Down
Loading