Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Commit

Permalink
updated lit-any/forms
Browse files Browse the repository at this point in the history
  • Loading branch information
tpluscode committed Aug 13, 2019
1 parent edd1797 commit 9b69538
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 5 deletions.
26 changes: 23 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"dependencies": {
"@lit-any/components-paper-elements": "^0.9.0",
"@lit-any/components-vaadin": "^0.9.0",
"@lit-any/forms": "^0.9.4",
"@lit-any/forms": "^0.10",
"@lit-any/views": "^0.9.1",
"@polymer/paper-card": "^3.0.1",
"@polymer/paper-input": "^3.0.1",
Expand Down
4 changes: 4 additions & 0 deletions storybook/knobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ export const noSubmitButton = (boolean, v) => boolean('No submit button', typeof

export const noResetButton = (boolean, v) => boolean('No reset button', typeof v === 'boolean' ? v : false)

export const noClearButton = (boolean, v) => boolean('No clear button', typeof v === 'boolean' ? v : false)

export const defaultValue = (object, v) => object('Value', v)

export const submitButton = (text, v) => text('Submit button label', v)

export const resetButton = (text, v) => text('Reset button label', v)

export const clearButton = (text, v) => text('Clear button label', v)

export const contract = (object, c) => object('Contract', c)
18 changes: 17 additions & 1 deletion storybook/lit-form.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@ import {
import '@lit-any/forms/lit-form'
import { FieldTemplates } from '@lit-any/forms'
import {
defaultValue, submitButton, resetButton, contract, noSubmitButton, noResetButton, showLabels,
defaultValue,
submitButton,
resetButton,
contract,
noSubmitButton,
noResetButton,
showLabels,
noClearButton,
clearButton,
} from './knobs'
import onSubmit from './helpers/submit-handler'
import buttonsNotes from './notes/lit-form/buttons'
Expand Down Expand Up @@ -76,8 +84,13 @@ storiesOf('lit-form', module)
form = part.element
}

const value = {
age: 18,
}

button('Submit programmatically', () => form.submit())
button('Reset programmatically', () => form.reset())
button('Clear programmatically', () => form.clear())

return buttonsNotes(html`
<lit-form .ref="${directive(getForm)}"
Expand All @@ -86,6 +99,9 @@ storiesOf('lit-form', module)
.submitButtonLabel=${submitButton(text, 'Submit')}
.noResetButton="${noResetButton(boolean)}"
.resetButtonLabel=${resetButton(text, 'Reset')}
.noClarButton="${noClearButton(boolean)}"
.clearButtonLabel=${clearButton(text, 'Clear')}
.value="${value}"
@submit="${onSubmit}"></lit-form>`)
})

Expand Down

0 comments on commit 9b69538

Please sign in to comment.