Skip to content

Commit

Permalink
feat(pix-ui): define size params instead of labelSize
Browse files Browse the repository at this point in the history
  • Loading branch information
xav-car committed Mar 20, 2024
1 parent e4a4745 commit 9681905
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 56 deletions.
2 changes: 1 addition & 1 deletion addon/components/pix-checkbox.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PixLabel
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@inlineLabel={{true}}
@screenReaderOnly={{@screenReaderOnly}}
@isDisabled={{@isDisabled}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-filterable-and-searchable-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PixLabel
@for={{this.pixSelectId}}
@requiredLabel={{@requiredLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@subLabel={{@subLabel}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-input-password.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PixLabel
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@subLabel={{@subLabel}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
>
Expand Down
6 changes: 2 additions & 4 deletions addon/components/pix-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ export default class PixLabel extends Component {
if (this.args.inlineLabel) classes.push('pix-label--inline-label');
if (this.args.isDisabled) classes.push('pix-label--disabled');

const labelSize = ['small', 'large'].includes(this.args.labelSize)
? this.args.labelSize
: 'default';
const size = ['small', 'large'].includes(this.args.size) ? this.args.size : 'default';

classes.push(`pix-label--${labelSize}`);
classes.push(`pix-label--${size}`);

return classes.join(' ');
}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/pix-multi-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@for={{this.multiSelectId}}
@requiredLabel={{@requiredLabel}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
>
Expand Down Expand Up @@ -72,7 +72,7 @@
<PixCheckbox
@id={{concat this.multiSelectId "-" option.value}}
@checked={{option.checked}}
@labelSize="small"
@size="small"
@class="pix-multi-select-list__item-label"
value={{option.value}}
{{on "change" this.onSelect}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-radio-button.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PixLabel
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@isDisabled={{@isDisabled}}
@inlineLabel={{true}}
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-search-input.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-select.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@for={{this.selectId}}
@requiredLabel={{@requiredLabel}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-textarea.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@for={{this.id}}
@requiredLabel={{@requiredLabel}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@screenReaderOnly={{@screenReaderOnly}}
@inlineLabel={{@inlineLabel}}
>
Expand Down
2 changes: 1 addition & 1 deletion addon/components/pix-toggle.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@for={{this.id}}
@screenReaderOnly={{@screenReaderOnly}}
@subLabel={{@subLabel}}
@labelSize={{@labelSize}}
@size={{@size}}
@inlineLabel={{@inlineLabel}}
>{{yield to="label"}}</PixLabel>
<button
Expand Down
1 change: 1 addition & 0 deletions addon/styles/_pix-search-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
gap: var(--pix-spacing-6x);
align-items:flex-start;
}

&__input-container {
position: relative;

Expand Down
2 changes: 1 addition & 1 deletion app/stories/form.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const form = (args) => {
<br />
<PixCheckbox @id='spam-pub' @labelSize='small'>
<PixCheckbox @id='spam-pub' @size='small'>
<:label>Acceptez-vous de vous faire spammer de PUB ?</:label>
</PixCheckbox>
Expand Down
2 changes: 1 addition & 1 deletion app/stories/pix-checkbox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ En ce sens, nous avons déjà prévu un espace vertical pour séparer 2 composan
<PixCheckbox
@screenReaderOnly="{{false}}"
@isIndeterminate="{{false}}"
@labelSize="small"
@'size'="small"
disabled
>
<:label>Recevoir la newsletter</:label>
Expand Down
14 changes: 7 additions & 7 deletions app/stories/pix-checkbox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand All @@ -96,7 +96,7 @@ export const Template = (args) => {
@checked={{this.checked}}
@isDisabled={{this.isDisabled}}
disabled={{this.isDisabled}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@inlineLabel={{this.inlineLabel}}
@screenReaderOnly={{this.screenReaderOnly}}
>
Expand Down Expand Up @@ -124,14 +124,14 @@ export const checkboxWithSmallLabel = Template.bind({});
checkboxWithSmallLabel.args = {
id: 'accept-newsletter-2',
label: 'Recevoir la newsletter',
labelSize: 'small',
size: 'small',
};

export const checkboxWithLargeLabel = Template.bind({});
checkboxWithLargeLabel.args = {
id: 'accept-newsletter-2',
label: 'Recevoir la newsletter',
labelSize: 'large',
size: 'large',
};

export const checkboxDisabled = Template.bind({});
Expand Down Expand Up @@ -165,7 +165,7 @@ export const MultipleTemplate = (args) => {
@class={{this.class}}
@screenReaderOnly={{this.screenReaderOnly}}
@isIndeterminate={{this.isIndeterminate}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@checked={{this.checked}}
disabled={{this.isDisabled}}
@isDisabled={{this.isDisabled}}
Expand All @@ -177,7 +177,7 @@ export const MultipleTemplate = (args) => {
@class={{this.class}}
@screenReaderOnly={{this.screenReaderOnly}}
@isIndeterminate={{this.isIndeterminate}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@checked={{this.checked}}
disabled={{this.isDisabled}}
@isDisabled={{this.isDisabled}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-filterable-and-searchable-select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default {
type: { summary: 'string' },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -158,7 +158,7 @@ const Template = (args) => {
@isSearchable={{this.isSearchable}}
@value={{this.value}}
@errorMessage={{this.errorMessage}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@requiredLabel={{this.requiredLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-input-password.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -90,7 +90,7 @@ const Template = (args) => {
@errorMessage={{this.errorMessage}}
@prefix={{this.prefix}}
@validationStatus={{this.validationStatus}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@requiredLabel={{this.requiredLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -88,7 +88,7 @@ const Template = (args) => {
@errorMessage={{this.errorMessage}}
placeholder='Jeanne, Pierre ...'
@validationStatus={{this.validationStatus}}
@labelSize={{this.labelSize}}
@size={{this.size}}
disabled={{this.disabled}}
readonly={{this.readonly}}
@subLabel={{this.subLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-label.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand All @@ -64,7 +64,7 @@ const Template = (args) => {
template: hbs`<PixLabel
@id={{this.id}}
@subLabel={{this.subLabel}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@requiredLabel={{this.requiredLabel}}
@screenReaderOnly={{this.screenReaderOnly}}
@inlineLabel={{this.inlineLabel}}
Expand Down
10 changes: 5 additions & 5 deletions app/stories/pix-multi-select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default {
@id={{this.id}}
@placeholder={{this.placeholder}}
@screenReaderOnly={{this.screenReaderOnly}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@onChange={{this.onChange}}
@emptyMessage={{this.emptyMessage}}
@className={{this.className}}
Expand Down Expand Up @@ -131,8 +131,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -187,7 +187,7 @@ export const multiSelectWithChildComponent = (args) => {
@emptyMessage={{this.emptyMessage}}
@className={{this.className}}
@options={{this.options}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@screenReaderOnly={{this.screenReaderOnly}}
Expand Down Expand Up @@ -253,7 +253,7 @@ const TemplateWithYield = (args) => ({
@strictSearch={{this.strictSearch}}
@values={{this.values}}
@options={{this.options}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@requiredLabel={{this.requiredLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-radio-button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand All @@ -81,7 +81,7 @@ const Template = (args) => {
@class={{this.class}}
disabled={{this.isDisabled}}
@isDisabled={{this.isDisabled}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@screenReaderOnly={{this.screenReaderOnly}}
@requiredLabel={{this.requiredLabel}}
>
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-search-input.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -97,7 +97,7 @@ export const Template = (args) => {
@placeholder={{this.placeholder}}
@debounceTimeInMs={{this.debounceTimeInMs}}
@triggerFiltering={{this.triggerFiltering}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@requiredLabel={{this.requiredLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-select.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -218,7 +218,7 @@ export const Template = (args) => {
@isDisabled={{this.isDisabled}}
@placement={{this.placement}}
@icon={{this.icon}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@inlineLabel={{this.inlineLabel}}
@requiredLabel={{this.requiredLabel}}
Expand Down
6 changes: 3 additions & 3 deletions app/stories/pix-textarea.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export default {
defaultValue: { summary: false },
},
},
labelSize: {
name: 'labelSize',
size: {
name: 'size',
description: 'Correspond à la taille de la police du label.',
type: { name: 'string', required: false },
table: {
Expand Down Expand Up @@ -81,7 +81,7 @@ const Template = (args) => {
@value={{this.value}}
@maxlength={{this.maxlength}}
@errorMessage={{this.errorMessage}}
@labelSize={{this.labelSize}}
@size={{this.size}}
@subLabel={{this.subLabel}}
@requiredLabel={{this.requiredLabel}}
@inlineLabel={{this.inlineLabel}}
Expand Down
Loading

0 comments on commit 9681905

Please sign in to comment.