Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update test-app components to gts #348

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions packages/overlays/src/components/drawer.gts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,11 @@ export interface DrawerSignature {
Blocks: {
default: [
{
CloseButton: WithBoundArgs<typeof CloseButton, 'onClick'> &
WithBoundArgs<typeof CloseButton, 'class'>;
Header: WithBoundArgs<typeof DrawerHeader, 'labelledById'> &
WithBoundArgs<typeof DrawerHeader, 'classFromParent'>;
CloseButton: WithBoundArgs<typeof CloseButton, 'onClick' | 'class'>;
Header: WithBoundArgs<
typeof DrawerHeader,
'labelledById' | 'classFromParent'
>;
Body: WithBoundArgs<typeof DrawerBody, 'classFromParent'>;
Footer: WithBoundArgs<typeof DrawerFooter, 'classFromParent'>;
headerId: string;
Expand Down
120 changes: 120 additions & 0 deletions test-app/app/components/changeset-form/demo.gts
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import Component from '@glimmer/component';
import validateFormat from 'ember-changeset-validations/validators/format';
import validatePresence from 'ember-changeset-validations/validators/presence';
import countries from './countries';
import ChangesetForm from '@frontile/changeset-form/components/changeset-form/index';
import { Button } from '@frontile/buttons';
// @ts-ignore

Check warning on line 7 in test-app/app/components/changeset-form/demo.gts

View workflow job for this annotation

GitHub Actions / Tests

Use "@ts-expect-error" instead of "@ts-ignore", as "@ts-ignore" will do nothing if the following line is error-free
import changeset from 'ember-changeset/helpers/changeset';

export const myValidations = {
firstName: validatePresence(true),
lastName: validatePresence(true),
email: validateFormat({ type: 'email' }),
countries: validatePresence(true)
};

interface ExampleArgs {}

export default class Example extends Component<ExampleArgs> {
validations = myValidations;
countries = countries.map((c) => c.name);

model = {
firstName: null,
lastName: null,
email: '[email protected]',
comments: 'Changeset forms are great! 🚀',
countries: [
'Brazil',
'India',
'Israel',
'Japan',
'United Kingdom',
'United States'
],

hungry: true,
humble: true,
curious: true,
favoriteMeal: 'lunch'
};

<template>
{{! @glint-nocheck }}
{{#let (changeset this.model this.validations) as |changeset|}}
<ChangesetForm @changeset={{changeset}} as |Form|>
<Form.Input
@label="First Name"
@fieldName="firstName"
placeholder="What is your first name?"
/>
<Form.Input
@label="Last Name"
@fieldName="lastName"
@containerClass="mt-4"
placeholder="What is your family name?"
/>
<Form.Input
@label="Email Address"
@fieldName="email"
type="email"
@containerClass="mt-4"
/>
<Form.Textarea
@label="Comments"
@fieldName="comments"
@containerClass="mt-4"
/>
<Form.Select
@label="Countries"
@fieldName="countries"
@isMultiple={{true}}
@options={{this.countries}}
@allowClear={{true}}
@containerClass="mt-4"
as |option|
>
{{option}}
</Form.Select>
<Form.CheckboxGroup
@label="Core Values"
@isInline={{true}}
@containerClass="mt-4"
as |Checkbox|
>
<Checkbox @label="Hungry" @fieldName="hungry" />
<Checkbox @label="Humble" @fieldName="humble" />
<Checkbox @label="Curious" @fieldName="curious" />
</Form.CheckboxGroup>
<Form.RadioGroup
@label="Favorite Meal"
@containerClass="mt-4"
@fieldName="favoriteMeal"
as |Radio|
>
<Radio @label="Breakfast" @value="breakfast" />
<Radio @label="Lunch" @value="lunch" />
<Radio @label="Dinner" @value="dinner" />
</Form.RadioGroup>
<Button @type="submit" @class="my-4" disabled={{changeset.isInvalid}}>
Submit
</Button>
<div class="mb-4">
<p>
isPristine:
{{changeset.isPristine}}
</p>
<p>
isValid:
{{changeset.isValid}}
</p>
<p>
isInvalid:
{{changeset.isInvalid}}
</p>
</div>
</ChangesetForm>
{{/let}}
</template>
}
78 changes: 0 additions & 78 deletions test-app/app/components/changeset-form/demo.hbs

This file was deleted.

38 changes: 0 additions & 38 deletions test-app/app/components/changeset-form/demo.ts

This file was deleted.

Loading
Loading