Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
* development:
  add the option to configure the initalFocus of the focus-trap in aumodal
  add wrap property to a button
  • Loading branch information
Dietr committed Sep 30, 2022
2 parents bf8c660 + 2fc6e2f commit 747e3c6
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/components/au-button.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<button
class="au-c-button {{this.width}} {{this.size}} {{this.skin}} {{this.alert}} {{this.loading}} {{this.disabled}} {{if (and @icon @hideText) 'au-c-button--icon-only'}}" disabled={{@disabled}}
class="au-c-button {{this.width}} {{this.size}} {{this.skin}} {{this.alert}} {{this.loading}} {{this.disabled}} {{if (and @icon @hideText) 'au-c-button--icon-only'}} {{if @wrap 'au-c-button--wrap'}}" disabled={{@disabled}}
type="button"
...attributes
>
Expand Down
4 changes: 2 additions & 2 deletions addon/components/au-modal.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
isActive=@modalOpen
focusTrapOptions=
(hash
initialFocus=".au-c-modal__title"
initialFocus=this.initialFocus
allowOutsideClick=true
escapeDeactivates=this.handleEscapePress
)
Expand Down Expand Up @@ -65,4 +65,4 @@
{{/if}}
</div>
{{/in-element}}
{{/if}}
{{/if}}
4 changes: 4 additions & 0 deletions addon/components/au-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default class AuModal extends Component {
else return '';
}

get initialFocus() {
return this.args.initialFocus ?? '.au-c-modal__title';
}

@action
handleEscapePress() {
this.closeModal();
Expand Down
7 changes: 7 additions & 0 deletions app/styles/ember-appuniversum/_c-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,13 @@ $au-button-icon-only-width-large : $au-button-height-large !defa
}
}

// Wrap text inside a button
.au-c-button--wrap {
height: auto;
white-space: initial;
text-align: left;
}

// Block button
.au-c-button--block {
display: flex;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -155,5 +155,8 @@
"release": true,
"tokenRef": "GITHUB_AUTH"
}
},
"volta": {
"node": "14.20.1"
}
}
9 changes: 9 additions & 0 deletions stories/5-components/Buttons/AuButton.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export default {
options: ['', 'block'],
description: 'Defines the width of a button',
},
wrap: {
control: 'boolean',
description: 'Wrap the text inside a button',
},
alert: {
control: 'boolean',
description: 'Adds an alert state to the button',
Expand Down Expand Up @@ -62,6 +66,7 @@ const Template = (args) => ({
@iconAlignment={{this.iconAlignment}}
@hideText={{this.hideText}}
@width={{this.width}}
@wrap={{this.wrap}}
@alert={{this.alert}}
@disabled={{this.disabled}}
@loading={{this.loading}}
Expand All @@ -81,6 +86,7 @@ Primary.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -95,6 +101,7 @@ Secondary.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -109,6 +116,7 @@ PrimaryLink.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand All @@ -123,6 +131,7 @@ SecondaryLink.args = {
iconAlignment: 'left',
hideText: false,
width: '',
wrap: '',
alert: false,
disabled: false,
loading: false,
Expand Down
7 changes: 7 additions & 0 deletions stories/5-components/Content/AuModal.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ export default {
description:
'If set to true the modal container and content will be have visible overflow. Useful when using a powerselect component inside a modal.',
},
initialFocus: {
control: 'text',
description: 'Element which should be focused when opening the modal',
},
},
parameters: {
layout: 'fullscreen',
Expand Down Expand Up @@ -75,11 +79,13 @@ const OverflowTemplate = (args) => ({
@size={{this.size}}
@padding={{this.padding}}
@overflow={{this.overflow}}
@initialFocus='.power-select'
>
<:title>{{this.title}}</:title>
<:body>
<AuLabel>Power select (rendered in place)</AuLabel>
<PowerSelect
class='power-select'
@allowClear={{true}}
@searchEnabled={{true}}
@loadingMessage='Aan het laden...'
Expand Down Expand Up @@ -119,4 +125,5 @@ Overflow.args = {
padding: 'default',
overflow: true,
powerselectoptions: singleselects,
initialFocus: '.power-select',
};

0 comments on commit 747e3c6

Please sign in to comment.