wix-style-react
Version:
wix-style-react
114 lines (87 loc) • 3.84 kB
JavaScript
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _CodeExample = require('wix-storybook-utils/CodeExample');
var _CodeExample2 = _interopRequireDefault(_CodeExample);
var _ExampleStandard = require('./ExampleStandard');
var _ExampleStandard2 = _interopRequireDefault(_ExampleStandard);
var _ExampleStandard3 = require('!raw-loader!./ExampleStandard');
var _ExampleStandard4 = _interopRequireDefault(_ExampleStandard3);
var _ExampleControlled = require('./ExampleControlled');
var _ExampleControlled2 = _interopRequireDefault(_ExampleControlled);
var _ExampleControlled3 = require('!raw-loader!./ExampleControlled');
var _ExampleControlled4 = _interopRequireDefault(_ExampleControlled3);
var _ExampleWithCustomValue = require('./ExampleWithCustomValue');
var _ExampleWithCustomValue2 = _interopRequireDefault(_ExampleWithCustomValue);
var _ExampleWithCustomValue3 = require('!raw-loader!./ExampleWithCustomValue');
var _ExampleWithCustomValue4 = _interopRequireDefault(_ExampleWithCustomValue3);
var _Dropdown = require('wix-style-react/Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
var _storySettings = require('./storySettings');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* eslint-disable no-console */
var options = [{ id: 0, value: 'Option 1' }, { id: 1, value: 'Option 2' }, { id: 2, value: 'Option 3' }, { id: 3, value: 'Option 4' }];
var optionsWithDivider = [{ id: 0, value: 'Option 1' }, { id: 1, value: 'Option 2' }, { id: -99, value: '-' }, { id: 2, value: 'Option 3' }, { id: 3, value: 'Option 4' }];
var optionsWithFooter = [{ id: 0, value: 'Option 1' }, { id: 1, value: 'Option 2' }, { id: 2, value: 'Option 3' }, { id: 3, value: 'Option 4' }, {
id: 'footer',
overrideStyle: true,
value: _react2.default.createElement(
'div',
{
style: { height: '240px', padding: '20px', backgroundColor: '#F0F' }
},
'This is a footer with a ',
_react2.default.createElement(
'a',
{ href: 'http://www.wix.com' },
'link'
),
'.'
)
}];
exports.default = {
category: _storySettings.storySettings.kind,
storyName: _storySettings.storySettings.storyName,
component: _Dropdown2.default,
componentPath: '../../../src/Dropdown',
componentProps: {
dataHook: _storySettings.storySettings.dataHook,
placeholder: 'This is a placeholder',
options: options,
onSelect: function onSelect(option) {
return console.log('option selected. ' + JSON.stringify(option) + '.');
},
upgrade: true
},
exampleProps: {
// FIXME: The following onSelect callback prop is commented out since it exposes a
// bug in Dropdown, that the selectedId is not updated. Needs investigation.
// onSelect: option => console.log(`${option.value} selected`),
options: [{ label: 'normal', value: options }, { label: 'with divider', value: optionsWithDivider }, { label: 'with footer', value: optionsWithFooter }]
},
examples: _react2.default.createElement(
'div',
null,
_react2.default.createElement(
_CodeExample2.default,
{ title: 'Standard', code: _ExampleStandard4.default },
_react2.default.createElement(_ExampleStandard2.default, null)
),
_react2.default.createElement(
_CodeExample2.default,
{ title: 'Controlled Dropdown', code: _ExampleControlled4.default },
_react2.default.createElement(_ExampleControlled2.default, null)
),
_react2.default.createElement(
_CodeExample2.default,
{
title: 'Custom Values in Dropdown',
code: _ExampleWithCustomValue4.default
},
_react2.default.createElement(_ExampleWithCustomValue2.default, null)
)
)
};