Skip to content

Commit

Permalink
New CycleSelectControl added
Browse files Browse the repository at this point in the history
  • Loading branch information
cameronvoell committed Jan 15, 2020
1 parent 82ab9d3 commit 31caac7
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 4 deletions.
6 changes: 6 additions & 0 deletions docs/manifest-devhub.json
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,12 @@
"markdown_source": "../packages/components/src/menu-items-choice/README.md",
"parent": "components"
},
{
"title": "CycleSelectControl",
"slug": "cycle-select-control",
"markdown_source": "../packages/components/src/mobile/cycle-select-control/README.md",
"parent": "components"
},
{
"title": "StepperControl",
"slug": "stepper-control",
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/image/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ import { isEmpty, map, get } from 'lodash';
* WordPress dependencies
*/
import {
CycleSelectControl,
Icon,
PanelBody,
PanelActions,
SelectControl,
TextControl,
ToggleControl,
ToolbarButton,
Expand Down Expand Up @@ -334,7 +334,7 @@ export class ImageEdit extends React.Component {
/>
{ // eslint-disable-next-line no-undef
image && __DEV__ &&
<SelectControl
<CycleSelectControl
icon={ 'editor-expand' }
label={ __( 'Size' ) }
value={ sizeSlug || DEFAULT_SIZE_SLUG }
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ export { default as KeyboardAwareFlatList } from './mobile/keyboard-aware-flat-l
export { default as Picker } from './mobile/picker';
export { default as ReadableContentView } from './mobile/readable-content-view';
export { default as StepperControl } from './mobile/stepper-control';
export { default as CycleSelectControl } from './mobile/cycle-select-control';
2 changes: 2 additions & 0 deletions packages/components/src/mobile/bottom-sheet/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import styles from './styles.scss';
import Button from './button';
import Cell from './cell';
import CyclePickerCell from './cycle-picker-cell';
import PickerCell from './picker-cell';
import SwitchCell from './switch-cell';
import RangeCell from './range-cell';
import KeyboardAvoidingView from './keyboard-avoiding-view';
Expand Down Expand Up @@ -148,6 +149,7 @@ ThemedBottomSheet.getWidth = getWidth;
ThemedBottomSheet.Button = Button;
ThemedBottomSheet.Cell = Cell;
ThemedBottomSheet.CyclePickerCell = CyclePickerCell;
ThemedBottomSheet.PickerCell = PickerCell;
ThemedBottomSheet.SwitchCell = SwitchCell;
ThemedBottomSheet.RangeCell = RangeCell;

Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/mobile/cycle-select-control/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CycleSelectControl
===================

`CycleSelectControl` is an experimental alternative to SelectControl for mobile.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Internal dependencies
*/
import CyclePickerCell from '../bottom-sheet/cycle-picker-cell';

function CycleSelectControl( {
help,
instanceId,
label,
multiple = false,
onChange,
options = [],
className,
hideLabelFromVision,
...props
} ) {
const id = `inspector-select-control-${ instanceId }`;

return (
<CyclePickerCell
label={ label }
hideLabelFromVision={ hideLabelFromVision }
id={ id }
help={ help }
className={ className }
onChangeValue={ onChange }
aria-describedby={ !! help ? `${ id }__help` : undefined }
multiple={ multiple }
options={ options }
{ ...props }
/>
);
}

export default CycleSelectControl;
4 changes: 2 additions & 2 deletions packages/components/src/select-control/index.native.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Internal dependencies
*/
import CyclePickerCell from '../mobile/bottom-sheet/cycle-picker-cell';
import PickerCell from '../mobile/bottom-sheet/picker-cell';

function SelectControl( {
help,
Expand All @@ -17,7 +17,7 @@ function SelectControl( {
const id = `inspector-select-control-${ instanceId }`;

return (
<CyclePickerCell
<PickerCell
label={ label }
hideLabelFromVision={ hideLabelFromVision }
id={ id }
Expand Down

0 comments on commit 31caac7

Please sign in to comment.