Skip to content
Open
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
59 changes: 49 additions & 10 deletions apps/prs/angular/src/routes/docs/checkbox/checkbox.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,48 @@ <h3>With description</h3>
<goab-checkbox
name="newsletter"
text="Subscribe to newsletter"
description="Receive weekly updates about new features">
description="Receive weekly updates about new features"
>
</goab-checkbox>

<h3>Indeterminate</h3>
<goab-checkbox name="selectAll" text="Select all items" [indeterminate]="true"></goab-checkbox>
<goab-checkbox
name="selectAll"
text="Select all items"
[indeterminate]="true"
></goab-checkbox>

<h3>Sizes</h3>
<goab-checkbox name="default" text="Default size checkbox" mb="m"></goab-checkbox>
<goab-checkbox name="compact" text="Compact size checkbox" size="compact"></goab-checkbox>

<h3>States</h3>
<goab-checkbox name="disabled" text="Cannot be changed" [disabled]="true" mb="m"></goab-checkbox>
<goab-checkbox name="disabledChecked" text="Checked and disabled" [checked]="true" [disabled]="true" mb="m"></goab-checkbox>
<goab-checkbox name="terms" text="Accept terms and conditions" [error]="true"></goab-checkbox>
<goab-checkbox
name="disabled"
text="Cannot be changed"
[disabled]="true"
mb="m"
></goab-checkbox>
<goab-checkbox
name="disabledChecked"
text="Checked and disabled"
[checked]="true"
[disabled]="true"
mb="m"
></goab-checkbox>
<goab-checkbox
name="disabledCheckedError"
text="Checked, disabled and error"
[checked]="true"
[disabled]="true"
[error]="true"
mb="m"
></goab-checkbox>
<goab-checkbox
name="terms"
text="Accept terms and conditions"
[error]="true"
></goab-checkbox>

<h2>Examples</h2>

Expand All @@ -52,7 +80,8 @@ <h3>Include a link in the helper text of an option</h3>
name="email"
text="Email"
value="email"
[description]="descriptionTemplate">
[description]="descriptionTemplate"
>
<ng-template #descriptionTemplate>
<span>Help text with a <a href="#">link</a>.</span>
</ng-template>
Expand All @@ -64,7 +93,10 @@ <h3>Include a link in the helper text of an option</h3>

<h3>Reveal input based on a selection</h3>
<form [formGroup]="revealForm">
<goab-form-item label="How would you like to be contacted?" helpText="Select one option">
<goab-form-item
label="How would you like to be contacted?"
helpText="Select one option"
>
<goab-radio-group name="contactMethod" formControlName="contactMethod">
<goab-radio-item label="Email" value="email" [reveal]="emailReveal">
<ng-template #emailReveal>
Expand Down Expand Up @@ -106,7 +138,12 @@ <h3>Reveal input based on a selection</h3>
</goab-form-item>
</ng-template>
</goab-checkbox>
<goab-checkbox name="text" text="Text message" value="text" [reveal]="checkTextReveal">
<goab-checkbox
name="text"
text="Text message"
value="text"
[reveal]="checkTextReveal"
>
<ng-template #checkTextReveal>
<goab-form-item label="Mobile phone number">
<goab-input name="mobile" formControlName="phoneNumber"></goab-input>
Expand All @@ -120,11 +157,13 @@ <h3>Reveal input based on a selection</h3>
<h3>Select one or more from a list of options</h3>
<goab-form-item
label="How would you like to be contacted?"
helpText="Choose all that apply">
helpText="Choose all that apply"
>
<goab-checkbox-list
name="contactPreferences"
[value]="selectedOptions"
(onChange)="onSelectionChange($event)">
(onChange)="onSelectionChange($event)"
>
<goab-checkbox name="email" text="Email" value="email"></goab-checkbox>
<goab-checkbox name="phone" text="Phone" value="phone"></goab-checkbox>
<goab-checkbox name="text" text="Text message" value="text"></goab-checkbox>
Expand Down
64 changes: 57 additions & 7 deletions apps/prs/react/src/routes/docs/checkbox/checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,21 @@ export function DocsCheckboxRoute() {

<h3>States</h3>
<GoabCheckbox name="disabled" text="Cannot be changed" disabled mb="m" />
<GoabCheckbox name="disabledChecked" text="Checked and disabled" checked disabled mb="m" />
<GoabCheckbox
name="disabledChecked"
text="Checked and disabled"
checked
disabled
mb="m"
/>
<GoabCheckbox
name="disabledCheckedError"
text="Checked, disabled and error"
checked
disabled
error
mb="m"
/>
<GoabCheckbox name="terms" text="Accept terms and conditions" error />

<h2>Examples</h2>
Expand Down Expand Up @@ -74,7 +88,13 @@ export function DocsCheckboxRoute() {
label="Email"
reveal={
<GoabFormItem label="Email address">
<GoabInput name="email" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="email"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand All @@ -83,7 +103,13 @@ export function DocsCheckboxRoute() {
label="Phone"
reveal={
<GoabFormItem label="Phone number">
<GoabInput name="phoneNumber" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="phoneNumber"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand All @@ -92,7 +118,13 @@ export function DocsCheckboxRoute() {
label="Text message"
reveal={
<GoabFormItem label="Mobile phone number">
<GoabInput name="mobilePhoneNumber" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="mobilePhoneNumber"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand All @@ -111,7 +143,13 @@ export function DocsCheckboxRoute() {
value="email"
reveal={
<GoabFormItem label="Email address">
<GoabInput name="email" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="email"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand All @@ -121,7 +159,13 @@ export function DocsCheckboxRoute() {
value="phone"
reveal={
<GoabFormItem label="Phone number">
<GoabInput name="phoneNumber" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="phoneNumber"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand All @@ -131,7 +175,13 @@ export function DocsCheckboxRoute() {
value="text"
reveal={
<GoabFormItem label="Mobile phone number">
<GoabInput name="mobilePhoneNumber" onChange={() => { /* no-op */ }} value="" />
<GoabInput
name="mobilePhoneNumber"
onChange={() => {
/* no-op */
}}
value=""
/>
</GoabFormItem>
}
/>
Expand Down
21 changes: 21 additions & 0 deletions docs/src/data/configurations/checkbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ export const checkboxConfigurations: ComponentConfigurations = {
code: {
react: `<GoabCheckbox name="disabled" text="Cannot be changed" disabled mb="m" />
<GoabCheckbox name="disabledChecked" text="Checked and disabled" checked disabled mb="m" />
<GoabCheckbox name="disabledCheckedError" text="Checked, disabled and error" checked disabled error mb="m" />
<GoabCheckbox name="terms" text="Accept terms and conditions" error />`,
angular: [
{
Expand All @@ -269,6 +270,7 @@ export const checkboxConfigurations: ComponentConfigurations = {
this.form = this.fb.group({
disabled: [{ value: false, disabled: true }],
disabledChecked: [{ value: true, disabled: true }],
disabledCheckedError: [{ value: true, disabled: true }],
terms: [false],
});
}
Expand All @@ -288,6 +290,14 @@ export const checkboxConfigurations: ComponentConfigurations = {
mb="m"
>
</goab-checkbox>
<goab-checkbox
name="disabledCheckedError"
text="Checked, disabled and error"
formControlName="disabledCheckedError"
[error]="true"
mb="m"
>
</goab-checkbox>
<goab-checkbox
name="terms"
text="Accept terms and conditions"
Expand All @@ -302,6 +312,7 @@ export const checkboxConfigurations: ComponentConfigurations = {
ts: `export class SomeOtherComponent {
disabledItem = false;
disabledCheckedItem = true;
disabledCheckedErrorItem = true;
terms = false;

checkboxOnChange(event: GoabCheckboxOnChangeDetail) {
Expand All @@ -325,6 +336,15 @@ export const checkboxConfigurations: ComponentConfigurations = {
mb="m"
>
</goab-checkbox>
<goab-checkbox
name="disabledCheckedError"
text="Checked, disabled and error"
[disabled]="true"
[error]="true"
[(ngModel)]="disabledCheckedErrorItem"
mb="m"
>
</goab-checkbox>
<goab-checkbox
name="terms"
text="Accept terms and conditions"
Expand All @@ -338,6 +358,7 @@ export const checkboxConfigurations: ComponentConfigurations = {
],
webComponents: `<goa-checkbox version="2" name="disabled" text="Cannot be changed" disabled mb="m"></goa-checkbox>
<goa-checkbox version="2" name="disabledChecked" text="Checked and disabled" checked disabled mb="m"></goa-checkbox>
<goa-checkbox version="2" name="disabledCheckedError" text="Checked, disabled and error" checked disabled error mb="m"></goa-checkbox>
<goa-checkbox version="2" name="terms" text="Accept terms and conditions" error></goa-checkbox>`,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ max-width: ${maxwidth};
border: var(--goa-checkbox-border-disabled-error);
}
.disabled.error .container svg {
fill: #f58185;
fill: var(--goa-checkbox-color-bg-checked-error-disabled);
}

/* Version 2 */
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
},
"devDependencies": {
"@abgov/design-tokens": "1.10.0",
"@abgov/design-tokens-v2": "npm:@abgov/design-tokens@2.12.6",
"@abgov/design-tokens-v2": "npm:@abgov/design-tokens@2.12.7",
"@abgov/nx-release": "12.0.0",
"@angular-devkit/build-angular": "21.2.16",
"@angular-devkit/core": "21.2.6",
Expand Down
Loading