From c03bca1a750f052ee1699a5e41cc371b92f42441 Mon Sep 17 00:00:00 2001 From: Sam Van Campenhout Date: Thu, 7 Mar 2024 18:13:34 +0100 Subject: [PATCH] Add Glint support to the `AuFieldset` component --- .../{au-fieldset.gjs => au-fieldset.gts} | 46 +++++++++++++++++-- addon/template-registry.ts | 2 + .../components/au-fieldset-test.gts | 23 ++++++++++ .../integration/components/loose-mode-test.ts | 6 +++ 4 files changed, 73 insertions(+), 4 deletions(-) rename addon/components/{au-fieldset.gjs => au-fieldset.gts} (71%) create mode 100644 tests/integration/components/au-fieldset-test.gts diff --git a/addon/components/au-fieldset.gjs b/addon/components/au-fieldset.gts similarity index 71% rename from addon/components/au-fieldset.gjs rename to addon/components/au-fieldset.gts index 005a10ed1..f76235afe 100644 --- a/addon/components/au-fieldset.gjs +++ b/addon/components/au-fieldset.gts @@ -1,8 +1,25 @@ -import { AuBadge, AuPill } from '@appuniversum/ember-appuniversum'; +import type { TOC } from '@ember/component/template-only'; import { hash } from '@ember/helper'; import Component from '@glimmer/component'; +import AuBadge from './au-badge'; +import AuPill from './au-pill'; -export default class AuFieldset extends Component { +export interface AuFieldsetSignature { + Args: { + alignment?: 'inline'; + }; + Blocks: { + default: [ + { + legend?: typeof Legend; + content?: typeof Content; + }, + ]; + }; + Element: HTMLFieldSetElement; +} + +export default class AuFieldset extends Component { get alignment() { if (this.args.alignment == 'inline') return 'au-c-fieldset--inline'; else return ''; @@ -16,7 +33,22 @@ export default class AuFieldset extends Component { } -class Legend extends Component { +interface LegendSignature { + Args: { + error?: boolean; + inline?: boolean; + required?: boolean; + requiredLabel?: string; + skin?: '1' | '2' | '3' | '4' | '5' | '6' | 'functional'; + warning?: boolean; + }; + Blocks: { + default: []; + }; + Element: HTMLDivElement; +} + +class Legend extends Component { get skin() { if (this.args.skin == '1') return 'au-u-h1'; if (this.args.skin == '2') return 'au-u-h2'; @@ -86,7 +118,13 @@ class Legend extends Component { } -const Content =