Skip to content

Commit 7cc1e6b

Browse files
authored
Merge pull request #974 from plotly/updatemenus-type
Add button type to updatemenus
2 parents 68289e2 + 570a448 commit 7cc1e6b

File tree

8 files changed

+480
-58
lines changed

8 files changed

+480
-58
lines changed

src/components/updatemenus/attributes.js

+31
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,30 @@ module.exports = {
5757
].join(' ')
5858
},
5959

60+
type: {
61+
valType: 'enumerated',
62+
values: ['dropdown', 'buttons'],
63+
dflt: 'dropdown',
64+
role: 'info',
65+
description: [
66+
'Determines whether the buttons are accessible via a dropdown menu',
67+
'or whether the buttons are stacked horizontally or vertically'
68+
].join(' ')
69+
},
70+
71+
direction: {
72+
valType: 'enumerated',
73+
values: ['left', 'right', 'up', 'down'],
74+
dflt: 'down',
75+
role: 'info',
76+
description: [
77+
'Determines the direction in which the buttons are laid out, whether',
78+
'in a dropdown menu or a row/column of buttons. For `left` and `up`,',
79+
'the buttons will still appear in left-to-right or top-to-bottom order',
80+
'respectively.'
81+
].join(' ')
82+
},
83+
6084
active: {
6185
valType: 'integer',
6286
role: 'info',
@@ -68,6 +92,13 @@ module.exports = {
6892
].join(' ')
6993
},
7094

95+
showactive: {
96+
valType: 'boolean',
97+
role: 'info',
98+
dflt: true,
99+
description: 'Highlights active dropdown item or active button if true.'
100+
},
101+
71102
buttons: buttonsAttrs,
72103

73104
x: {

src/components/updatemenus/constants.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ module.exports = {
2121
headerGroupClassName: 'updatemenu-header-group',
2222
headerClassName: 'updatemenu-header',
2323
headerArrowClassName: 'updatemenu-header-arrow',
24-
buttonGroupClassName: 'updatemenu-button-group',
24+
dropdownButtonGroupClassName: 'updatemenu-dropdown-button-group',
25+
dropdownButtonClassName: 'updatemenu-dropdown-button',
2526
buttonClassName: 'updatemenu-button',
2627
itemRectClassName: 'updatemenu-item-rect',
2728
itemTextClassName: 'updatemenu-item-text',
@@ -41,7 +42,8 @@ module.exports = {
4142
minHeight: 30,
4243

4344
// padding around item text
44-
textPadX: 40,
45+
textPadX: 24,
46+
arrowPadX: 16,
4547

4648
// font size to height scale
4749
fontSizeToHeight: 1.3,

src/components/updatemenus/defaults.js

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ function menuDefaults(menuIn, menuOut, layoutOut) {
4949
if(!visible) return;
5050

5151
coerce('active');
52+
coerce('direction');
53+
coerce('type');
54+
coerce('showactive');
5255

5356
coerce('x');
5457
coerce('y');

0 commit comments

Comments
 (0)