Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ELEMENTS-1272: add nuxeo-sort-select and nuxeo-user-suggestion to sto…
…rybook
- Loading branch information
Showing
4 changed files
with
152 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export const USER_SUGGESTION_ENTRIES = [ | ||
{ | ||
company: '', | ||
displayIcon: true, | ||
displayLabel: 'Administrator', | ||
email: 'devnull@nuxeo.com', | ||
'entity-type': 'user', | ||
firstName: '', | ||
groups: [], | ||
id: 'Administrator', | ||
lastName: '', | ||
prefixed_id: 'user:Administrator', | ||
tenantId: null, | ||
type: 'USER_TYPE', | ||
username: 'Administrator', | ||
}, | ||
{ | ||
company: '', | ||
displayIcon: true, | ||
displayLabel: 'jdoe', | ||
email: 'devnull@nuxeo.com', | ||
'entity-type': 'user', | ||
firstName: '', | ||
groups: [], | ||
id: 'jdoe', | ||
lastName: '', | ||
prefixed_id: 'user:Administrator', | ||
tenantId: null, | ||
type: 'USER_TYPE', | ||
username: 'jdoe', | ||
}, | ||
{ | ||
company: '', | ||
displayIcon: true, | ||
displayLabel: 'Bob Jones', | ||
email: 'bob@jones.com', | ||
'entity-type': 'user', | ||
firstName: 'Bob', | ||
groups: [], | ||
id: 'bobJones', | ||
lastName: 'Jones', | ||
prefixed_id: 'user:bjones', | ||
tenantId: null, | ||
type: 'USER_TYPE', | ||
username: 'bjones', | ||
}, | ||
]; |
41 changes: 41 additions & 0 deletions
41
storybook/src/elements/nuxeo-sort-select/nuxeo-sort-select.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { html } from 'lit-html'; | ||
import { storiesOf } from '@storybook/polymer'; | ||
import '@nuxeo/nuxeo-ui-elements/widgets/nuxeo-sort-select.js'; | ||
|
||
const options = [ | ||
{ | ||
field: 'dc:title', | ||
label: 'Title', | ||
order: 'asc', | ||
}, | ||
{ | ||
field: 'dc:created', | ||
label: 'Created', | ||
order: 'asc', | ||
}, | ||
{ | ||
field: 'dc:modified', | ||
label: 'Modified', | ||
order: 'desc', | ||
}, | ||
{ | ||
field: 'dc:lastContributor', | ||
label: 'Last contributor', | ||
order: 'asc', | ||
}, | ||
]; | ||
|
||
storiesOf('UI/nuxeo-sort-select', module).add( | ||
'Default', | ||
() => | ||
html` | ||
<style> | ||
.container { | ||
margin: 2rem; | ||
} | ||
</style> | ||
<div class="container"> | ||
<nuxeo-sort-select .options="${options}"></nuxeo-sort-select> | ||
</div> | ||
`, | ||
); |
45 changes: 45 additions & 0 deletions
45
storybook/src/elements/nuxeo-user-suggestion/nuxeo-user-suggestion.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { html } from 'lit-html'; | ||
import { storiesOf } from '@storybook/polymer'; | ||
import { boolean, number, select, text } from '@storybook/addon-knobs'; | ||
import '@nuxeo/nuxeo-ui-elements/widgets/nuxeo-user-suggestion.js'; | ||
import { USER_SUGGESTION_ENTRIES } from '../../data/user-suggestion.data'; | ||
|
||
const server = window.nuxeo.mock; | ||
server.respondWith('post', '/api/v1/automation/UserGroup.Suggestion', () => USER_SUGGESTION_ENTRIES); | ||
storiesOf('UI/nuxeo-user-suggestion', module).add('nuxeo-user-suggestion', () => { | ||
const label = text('Label', 'Label'); | ||
const searchType = select( | ||
'searchType', | ||
{ | ||
USER_TYPE: 'USER_TYPE', | ||
GROUP_TYPE: 'GROUP_TYPE', | ||
USER_GROUP_TYPE: 'USER_GROUP_TYPE', | ||
}, | ||
'USER_GROUP_TYPE', | ||
); | ||
const multiple = boolean('multiple', false); | ||
const stayOpenOnSelect = boolean('stayOpenOnSelect', false); | ||
const readonly = boolean('readonly', false); | ||
const minChars = number('minChars', 0); | ||
const placeholder = text('Placeholder', 'Placeholder'); | ||
return html` | ||
<style> | ||
.container { | ||
margin: 2rem; | ||
max-width: 300px; | ||
} | ||
</style> | ||
<div class="container"> | ||
<nuxeo-user-suggestion | ||
label="${label}" | ||
.search-type="${searchType}" | ||
?multiple="${multiple}" | ||
?stay-open-on-select="${stayOpenOnSelect}" | ||
?readonly="${readonly}" | ||
min-chars="${minChars}" | ||
placeholder="${placeholder}" | ||
> | ||
</nuxeo-user-suggestion> | ||
</div> | ||
`; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters