diff --git a/addon/components/au-accordion.gjs b/addon/components/au-accordion.gts similarity index 75% rename from addon/components/au-accordion.gjs rename to addon/components/au-accordion.gts index b740d03e9..1f32c4bb6 100644 --- a/addon/components/au-accordion.gjs +++ b/addon/components/au-accordion.gts @@ -1,22 +1,43 @@ -import { - AuButton, - AuContent, - AuIcon, - AuLoader, - AuToolbar, -} from '@appuniversum/ember-appuniversum'; import { on } from '@ember/modifier'; import { action } from '@ember/object'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; import { modifier } from 'ember-modifier'; +import AuButton from './au-button'; +import AuContent from './au-content'; +import AuIcon from './au-icon'; +import AuLoader from './au-loader'; +import AuToolbar from './au-toolbar'; -const autofocus = modifier(function autofocus(element) { +const autofocus = modifier(function autofocus(element: HTMLElement) { element.focus(); }); -export default class AuAccordion extends Component { - @tracked isOpen = false; +export interface AuAccordionSignature { + Args: { + buttonLabel?: string; + iconClosed?: string; + iconOpen?: string; + isOpenInitially?: boolean; + loading?: boolean; + reverse?: boolean; + skin?: 'border'; + subtitle?: string; + }; + Blocks: { + default: []; + }; + Element: HTMLDivElement; +} + +export default class AuAccordion extends Component { + @tracked isOpen; + + constructor(owner: unknown, args: AuAccordionSignature['Args']) { + super(owner, args); + + this.isOpen = Boolean(this.args.isOpenInitially); + } get loading() { if (this.args.loading) return 'is-loading'; diff --git a/addon/components/au-toolbar.gjs b/addon/components/au-toolbar.gts similarity index 67% rename from addon/components/au-toolbar.gjs rename to addon/components/au-toolbar.gts index cb6bd588e..5e4e2b976 100644 --- a/addon/components/au-toolbar.gjs +++ b/addon/components/au-toolbar.gts @@ -1,6 +1,21 @@ +import type { TOC } from '@ember/component/template-only'; import Component from '@glimmer/component'; -export default class AuToolbar extends Component { +export interface AuToolbarSignature { + Args: { + reverse?: boolean; + border?: 'top' | 'bottom'; + skin?: 'tint'; + size?: 'small' | 'medium' | 'large'; + nowrap?: boolean; + }; + Blocks: { + default: [typeof Group]; + }; + Element: HTMLDivElement; +} + +export default class AuToolbar extends Component { get reverse() { if (this.args.reverse) return 'au-c-toolbar--reverse'; else return ''; @@ -44,7 +59,14 @@ export default class AuToolbar extends Component { } -const Group =