-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upd(mox/input): update mox/input + mox/label comp. with light mode va…
…riants
- Loading branch information
Showing
13 changed files
with
583 additions
and
143 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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<div class="h-4 relative" ...attributes> | ||
{{#if @error}} | ||
<p class="text-red-500 text-xs absolute" data-test-mox-form-error>{{@error}}</p> | ||
<p | ||
class="text-red-600 dark:text-red-500 text-xs absolute" | ||
data-test-mox-form-error | ||
>{{@error}}</p> | ||
{{/if}} | ||
</div> | ||
</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
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<label class="mox-label text-xs text-gray-300 uppercase {{if @isRequired "required"}}" data-test-mox-label ...attributes> | ||
<label class="mox-label text-xs text-gray-700 dark:text-gray-300 uppercase {{if @isRequired "required"}}" data-test-mox-label ...attributes> | ||
{{yield}} | ||
</label> |
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
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,117 @@ | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
export default { | ||
title: 'Mox Light/Mox::Input', | ||
parameters: { | ||
backgrounds: { | ||
default: 'Mute', | ||
values: [ | ||
{ | ||
name: 'White', | ||
value: '#ffffff', | ||
}, | ||
{ | ||
name: 'Mute', | ||
value: '#FBFBFB', | ||
}, | ||
], | ||
}, | ||
}, | ||
inputAction: () => {}, | ||
}; | ||
|
||
const Template = (args) => ({ | ||
template: hbs` | ||
<Mox::Input | ||
@value={{this.value}} @onInput={{this.inputAction}} | ||
@placeholder={{this.placeholder}} @label={{this.label}} | ||
disabled={{this.isDisabled}} @isRequired={{this.isRequired}} | ||
readonly={{this.readOnly}} | ||
@isValid={{this.isValid}} @error={{this.error}} /> | ||
`, | ||
context: args, | ||
}); | ||
|
||
const TemplateStackedFormFields = (args) => ({ | ||
template: hbs` | ||
<div class="flex flex-col"> | ||
<Mox::Input | ||
@value={{this.value}} @onInput={{this.inputAction}} | ||
@placeholder={{this.placeholder}} @label={{this.label}} | ||
disabled={{this.isDisabled}} @isRequired={{this.isRequired}} | ||
@isValid={{this.isValid}} @error={{this.error}} /> | ||
<Mox::Input | ||
@value={{this.secondValue}} @onInput={{this.inputAction}} | ||
@placeholder={{this.placeholder}} @label={{this.secondLabel}} | ||
disabled={{this.isDisabled}} @isRequired={{this.isRequired}} | ||
@isValid={{this.isValid}} @error={{this.secondError}} /> | ||
</div>`, | ||
context: args, | ||
}); | ||
|
||
export const Default = Template.bind({}); | ||
Default.args = { | ||
value: 'Sun', | ||
placeholder: 'Name', | ||
label: 'Name', | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const Disabled = Template.bind({}); | ||
Disabled.args = { | ||
value: 'Rain', | ||
isDisabled: true, | ||
label: 'Name', | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const ReadOnly = Template.bind({}); | ||
ReadOnly.args = { | ||
value: 'my_source_collection', | ||
isDisabled: false, | ||
readOnly: true, | ||
label: 'Source', | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const Placeholder = Template.bind({}); | ||
Placeholder.args = { | ||
value: '', | ||
placeholder: 'Your Name', | ||
label: 'Name', | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const Required = Template.bind({}); | ||
Required.args = { | ||
value: 'Neptune', | ||
placeholder: 'Your Name', | ||
label: 'Name', | ||
isRequired: true, | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const Errors = Template.bind({}); | ||
Errors.args = { | ||
value: '', | ||
placeholder: 'Your Name', | ||
label: 'Name', | ||
isRequired: true, | ||
isValid: false, | ||
error: 'You forgot to specify a planet', | ||
inputAction: () => {}, | ||
}; | ||
|
||
export const Stacked = TemplateStackedFormFields.bind({}); | ||
Stacked.args = { | ||
value: 'Mercury', | ||
secondValue: 'Moon', | ||
placeholder: 'Your Name', | ||
label: 'Planet', | ||
secondLabel: 'Other', | ||
isRequired: true, | ||
isValid: false, | ||
error: 'You forgot to specify a planet', | ||
secondError: 'You forgot to specify a natural satellite', | ||
inputAction: () => {}, | ||
}; |
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
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,28 @@ | ||
import { hbs } from 'ember-cli-htmlbars'; | ||
|
||
export default { | ||
title: 'Mox Light/Mox::Label', | ||
parameters: { | ||
backgrounds: { | ||
default: 'Mute', | ||
values: [ | ||
{ | ||
name: 'White', | ||
value: '#ffffff', | ||
}, | ||
{ | ||
name: 'Mute', | ||
value: '#FBFBFB', | ||
}, | ||
], | ||
}, | ||
}, | ||
}; | ||
|
||
export const DefaultLabel = () => hbs` | ||
<Mox::Label>Label</Mox::Label> | ||
`; | ||
|
||
export const RequiredLabel = () => hbs` | ||
<Mox::Label @isRequired={{true}}>This is required</Mox::Label> | ||
`; |
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
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
Oops, something went wrong.