diff --git a/docs-app/app/assets/app.css b/docs-app/app/assets/app.css index 264908e0..439c8230 100644 --- a/docs-app/app/assets/app.css +++ b/docs-app/app/assets/app.css @@ -92,6 +92,12 @@ ul { list-style-type: none; } +:global(.input-disabled) { + background-color: #9ea4b0 !important; + color: #546e7a !important; + cursor: not-allowed !important; +} + :global(#ember-testing-container) { background-color: #020e1c !important; border: 0.0625rem solid rgb(211 211 211 / 15%) !important; diff --git a/docs-app/app/components/navigation-menu.gts b/docs-app/app/components/navigation-menu.gts index 6e140b01..40d52a14 100644 --- a/docs-app/app/components/navigation-menu.gts +++ b/docs-app/app/components/navigation-menu.gts @@ -1,5 +1,6 @@ import type { TOC } from '@ember/component/template-only'; import { LinkTo } from '@ember/routing'; +import { local } from 'embroider-css-modules'; import styles from './navigation-menu.css'; @@ -23,7 +24,7 @@ const NavigationMenuComponent: TOC =
  • {{menuItem.label}} diff --git a/docs-app/app/components/products/product/card.gts b/docs-app/app/components/products/product/card.gts index 960744d9..57d760b5 100644 --- a/docs-app/app/components/products/product/card.gts +++ b/docs-app/app/components/products/product/card.gts @@ -3,7 +3,7 @@ import { hash } from '@ember/helper'; import { LinkTo } from '@ember/routing'; import { ContainerQuery, width } from 'ember-container-query'; -import type { Product } from '../../../data/products'; +import type { Product } from '../../../data'; import styles from './card.css'; import ProductsProductImage from './image'; diff --git a/docs-app/app/components/tracks.gts b/docs-app/app/components/tracks.gts new file mode 100644 index 00000000..372fa8dd --- /dev/null +++ b/docs-app/app/components/tracks.gts @@ -0,0 +1,50 @@ +import type { TOC } from '@ember/component/template-only'; +import { hash } from '@ember/helper'; +import { ContainerQuery, height, width } from 'ember-container-query'; +import { and } from 'ember-truth-helpers'; + +import type { Track } from '../data'; +import TracksList from './tracks/list'; +import TracksTable from './tracks/table'; + +interface TracksSignature { + Args: { + tracks?: Track[]; + }; +} + +const TracksComponent: TOC = + + +export default TracksComponent; + +declare module '@glint/environment-ember-loose/registry' { + export default interface Registry { + Tracks: typeof TracksComponent; + } +} diff --git a/docs-app/app/components/tracks.hbs b/docs-app/app/components/tracks.hbs deleted file mode 100644 index 8292c474..00000000 --- a/docs-app/app/components/tracks.hbs +++ /dev/null @@ -1,24 +0,0 @@ - - {{#if (strict-and CQ.features.large CQ.features.tall)}} - - - {{else}} - - - {{/if}} - \ No newline at end of file diff --git a/docs-app/app/components/tracks.ts b/docs-app/app/components/tracks.ts deleted file mode 100644 index ae08031c..00000000 --- a/docs-app/app/components/tracks.ts +++ /dev/null @@ -1,19 +0,0 @@ -import templateOnlyComponent from '@ember/component/template-only'; - -import type { Track } from '../data/album'; - -interface TracksSignature { - Args: { - tracks?: Track[]; - }; -} - -const TracksComponent = templateOnlyComponent(); - -export default TracksComponent; - -declare module '@glint/environment-ember-loose/registry' { - export default interface Registry { - Tracks: typeof TracksComponent; - } -} diff --git a/docs-app/app/components/tracks/list.ts b/docs-app/app/components/tracks/list.ts index 365402a8..758d0032 100644 --- a/docs-app/app/components/tracks/list.ts +++ b/docs-app/app/components/tracks/list.ts @@ -1,6 +1,6 @@ import Component from '@glimmer/component'; -import type { Track } from '../../data/album'; +import type { Track } from '../../data'; import styles from './list.css'; interface TracksListSignature { diff --git a/docs-app/app/components/tracks/table.gts b/docs-app/app/components/tracks/table.gts index 33c621f4..08ddf695 100644 --- a/docs-app/app/components/tracks/table.gts +++ b/docs-app/app/components/tracks/table.gts @@ -1,6 +1,6 @@ import type { TOC } from '@ember/component/template-only'; -import type { Track } from '../../data/album'; +import type { Track } from '../../data'; import add from '../../helpers/add'; import styles from './table.css'; diff --git a/docs-app/app/components/ui/form.hbs b/docs-app/app/components/ui/form.hbs index 7ebdfd60..91907340 100644 --- a/docs-app/app/components/ui/form.hbs +++ b/docs-app/app/components/ui/form.hbs @@ -33,6 +33,12 @@ isWide=CQ.features.wide onUpdate=this.updateChangeset ) + Number=(component + "ui/form/number" + changeset=this.changeset + isWide=CQ.features.wide + onUpdate=this.updateChangeset + ) Textarea=(component "ui/form/textarea" changeset=this.changeset diff --git a/docs-app/app/components/ui/form.ts b/docs-app/app/components/ui/form.ts index 0b8d9587..7159d9cd 100644 --- a/docs-app/app/components/ui/form.ts +++ b/docs-app/app/components/ui/form.ts @@ -2,17 +2,19 @@ import { action } from '@ember/object'; import { guidFor } from '@ember/object/internals'; import Component from '@glimmer/component'; import { tracked } from '@glimmer/tracking'; -import { WithBoundArgs } from '@glint/template'; +import type { WithBoundArgs } from '@glint/template'; import styles from './form.css'; import type UiFormCheckboxComponent from './form/checkbox'; import type UiFormInputComponent from './form/input'; +import type UiFormNumberComponent from './form/number'; import type UiFormTextareaComponent from './form/textarea'; interface UiFormSignature { Args: { data?: Record; instructions?: string; + onSubmit: (data: Record) => Promise; title?: string; }; Blocks: { @@ -26,6 +28,10 @@ interface UiFormSignature { typeof UiFormInputComponent, 'changeset' | 'isWide' | 'onUpdate' >; + Number: WithBoundArgs< + typeof UiFormNumberComponent, + 'changeset' | 'isWide' | 'onUpdate' + >; Textarea: WithBoundArgs< typeof UiFormTextareaComponent, 'changeset' | 'isWide' | 'onUpdate' @@ -41,10 +47,10 @@ export default class UiFormComponent extends Component { @tracked changeset = this.args.data ?? ({} as Record); - @action submitForm(event: SubmitEvent): void { + @action async submitForm(event: SubmitEvent): Promise { event.preventDefault(); - console.table(this.changeset); + await this.args.onSubmit(this.changeset); } @action updateChangeset({ key, value }: { key: string; value: any }): void { diff --git a/docs-app/app/components/ui/form/checkbox.css b/docs-app/app/components/ui/form/checkbox.css index bc12045f..af645357 100644 --- a/docs-app/app/components/ui/form/checkbox.css +++ b/docs-app/app/components/ui/form/checkbox.css @@ -19,19 +19,18 @@ border-color: transparent; } -.checkbox.is-checked { - background-color: #1976d2; +.checkmark-icon { + color: white; } -.checkbox.is-disabled { - background-color: #b2c9d4; - cursor: not-allowed; +.checkbox.is-checked { + background-color: #1976d2; } -.checkmark-icon { - color: white; +.is-disabled { + composes: input-disabled from global; } -.checkbox.is-disabled .checkmark-icon { +.is-disabled .checkmark-icon { color: #546e7a; } diff --git a/docs-app/app/components/ui/form/checkbox.hbs b/docs-app/app/components/ui/form/checkbox.hbs index b1d7ab6e..eec3c914 100644 --- a/docs-app/app/components/ui/form/checkbox.hbs +++ b/docs-app/app/components/ui/form/checkbox.hbs @@ -22,11 +22,11 @@ aria-labelledby={{concat f.inputId "-label"}} aria-readonly={{if @isReadOnly "true" "false"}} aria-required={{if @isRequired "true" "false"}} - class={{local-class + class={{local this.styles "checkbox" (if this.isChecked "is-checked") - (if (strict-or @isDisabled @isReadOnly) "is-disabled") + (if (or @isDisabled @isReadOnly) "is-disabled") }} data-test-field={{@label}} role="checkbox" diff --git a/docs-app/app/components/ui/form/checkbox.ts b/docs-app/app/components/ui/form/checkbox.ts index 24fbf9fe..5518216a 100644 --- a/docs-app/app/components/ui/form/checkbox.ts +++ b/docs-app/app/components/ui/form/checkbox.ts @@ -1,6 +1,7 @@ import { action, get } from '@ember/object'; import Component from '@glimmer/component'; +import { generateErrorMessage } from '../../../utils/components/ui/form'; import styles from './checkbox.css'; interface UiFormCheckboxSignature { @@ -23,15 +24,11 @@ export default class UiFormCheckboxComponent extends Component
    {{svgJar "alert" diff --git a/docs-app/app/components/ui/form/information.gts b/docs-app/app/components/ui/form/information.gts index 0c78cd8c..9e330e30 100644 --- a/docs-app/app/components/ui/form/information.gts +++ b/docs-app/app/components/ui/form/information.gts @@ -1,7 +1,7 @@ import type { TOC } from '@ember/component/template-only'; import { concat } from '@ember/helper'; +import { or } from 'ember-truth-helpers'; -import strictOr from '../../../helpers/strict-or'; import styles from './information.css'; interface UiFormInformationSignature { @@ -14,7 +14,7 @@ interface UiFormInformationSignature { const UiFormInformationComponent: TOC =