Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
8675356
feat(gcds-select): Add HTML validation/validity
ethanWallace Nov 18, 2025
4894c9e
Add nitve HTML attributes
ethanWallace Nov 18, 2025
2820492
Prevent invalid value being assigned to select
ethanWallace Nov 18, 2025
4048c00
Add spec test + remove console logs
ethanWallace Nov 18, 2025
93748d4
Merge branch 'main' into feat/gcds-select-validity
ethanWallace Nov 18, 2025
6953985
New build files
ethanWallace Nov 18, 2025
d98b2b9
Add e2e test
ethanWallace Nov 19, 2025
b9bc1da
Remove formatHTMLErrorMessage
ethanWallace Nov 20, 2025
babc0e3
Cleanup updateValidity
ethanWallace Nov 20, 2025
3cb06cc
Fix logic error
ethanWallace Nov 20, 2025
79c8eac
Add new properties to storybook
ethanWallace Nov 20, 2025
28e19cc
Merge branch 'main' into feat/gcds-select-validity
ethanWallace Nov 21, 2025
2a368bf
Merge branch 'main' into feat/gcds-select-validity
ethanWallace Nov 24, 2025
03a68aa
Update packages/web/src/components/gcds-select/gcds-select.tsx
ethanWallace Nov 25, 2025
60e81b3
Update packages/web/src/components/gcds-select/gcds-select.tsx
ethanWallace Nov 25, 2025
0382500
Update packages/web/src/components/gcds-select/gcds-select.tsx
ethanWallace Nov 25, 2025
7304eff
Update logic for value + unit tests
ethanWallace Nov 25, 2025
30be9fa
PR feedback
ethanWallace Nov 26, 2025
015d7ba
Merge branch 'main' into feat/gcds-select-validity
ethanWallace Nov 26, 2025
e47e432
Remove ? from autofocus property
ethanWallace Nov 26, 2025
94ff003
Merge branch 'feat/gcds-select-validity' of https://github.com/cds-sn…
ethanWallace Nov 26, 2025
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
22 changes: 19 additions & 3 deletions packages/angular/src/lib/stencil-generated/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1920,16 +1920,16 @@ export declare interface GcdsSearch extends Components.GcdsSearch {


@ProxyCmp({
inputs: ['defaultValue', 'disabled', 'errorMessage', 'hint', 'label', 'name', 'required', 'selectId', 'validateOn', 'validator', 'value'],
methods: ['validate'],
inputs: ['autocomplete', 'autofocus', 'defaultValue', 'disabled', 'errorMessage', 'form', 'hint', 'label', 'name', 'required', 'selectId', 'validateOn', 'validator', 'validity', 'value'],
methods: ['validate', 'checkValidity', 'getValidationMessage'],
outputs: ['gcdsChange', 'gcdsInput', 'gcdsFocus', 'gcdsBlur', 'gcdsError', 'gcdsValid']
})
@Component({
selector: 'gcds-select',
changeDetection: ChangeDetectionStrategy.OnPush,
template: '<ng-content></ng-content>',
// eslint-disable-next-line @angular-eslint/no-inputs-metadata-property
inputs: ['defaultValue', 'disabled', 'errorMessage', 'hint', 'label', 'name', 'required', 'selectId', 'validateOn', 'validator', 'value'],
inputs: ['autocomplete', 'autofocus', 'defaultValue', 'disabled', 'errorMessage', 'form', 'hint', 'label', 'name', 'required', 'selectId', 'validateOn', 'validator', 'validity', 'value'],
outputs: ['gcdsChange', 'gcdsInput', 'gcdsFocus', 'gcdsBlur', 'gcdsError', 'gcdsValid'],
standalone: false,
})
Expand Down Expand Up @@ -1960,6 +1960,18 @@ export class GcdsSelect {
*/
set defaultValue(_: Components.GcdsSelect['defaultValue']) {};
/**
* If true, the select will be focused on component render
*/
set autofocus(_: Components.GcdsSelect['autofocus']) {};
/**
* The ID of the form that the select field belongs to.
*/
set form(_: Components.GcdsSelect['form']) {};
/**
* String to have autocomplete enabled.
*/
set autocomplete(_: Components.GcdsSelect['autocomplete']) {};
/**
* Value for a select element.
*/
set value(_: Components.GcdsSelect['value']) {};
Expand All @@ -1972,6 +1984,10 @@ export class GcdsSelect {
*/
set hint(_: Components.GcdsSelect['hint']) {};
/**
* Read-only property of the select, returns a ValidityState object that represents the validity states this element is in. @readonly
*/
set validity(_: Components.GcdsSelect['validity']) {};
/**
* Array of validators
*/
set validator(_: Components.GcdsSelect['validator']) {};
Expand Down
4 changes: 4 additions & 0 deletions packages/vue/lib/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,9 +547,13 @@ export const GcdsSelect: StencilVueComponent<JSX.GcdsSelect, JSX.GcdsSelect["val
'required',
'disabled',
'defaultValue',
'autofocus',
'form',
'autocomplete',
'value',
'errorMessage',
'hint',
'validity',
'validator',
'validateOn',
'gcdsChange',
Expand Down
146 changes: 146 additions & 0 deletions packages/web/specs/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -9434,6 +9434,52 @@
],
"usage": {},
"props": [
{
"name": "autocomplete",
"type": "string",
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"mutable": false,
"attr": "autocomplete",
"reflectToAttr": false,
"docs": "String to have autocomplete enabled.",
"docsTags": [],
"values": [
{
"type": "string"
}
],
"optional": true,
"required": false,
"getter": false,
"setter": false
},
{
"name": "autofocus",
"type": "boolean",
"complexType": {
"original": "boolean",
"resolved": "boolean",
"references": {}
},
"mutable": false,
"attr": "autofocus",
"reflectToAttr": true,
"docs": "If true, the select will be focused on component render",
"docsTags": [],
"values": [
{
"type": "boolean"
}
],
"optional": false,
"required": false,
"getter": false,
"setter": false
},
{
"name": "defaultValue",
"type": "string",
Expand Down Expand Up @@ -9509,6 +9555,29 @@
"getter": false,
"setter": false
},
{
"name": "form",
"type": "string",
"complexType": {
"original": "string",
"resolved": "string",
"references": {}
},
"mutable": false,
"attr": "form",
"reflectToAttr": true,
"docs": "The ID of the form that the select field belongs to.",
"docsTags": [],
"values": [
{
"type": "string"
}
],
"optional": true,
"required": false,
"getter": false,
"setter": false
},
{
"name": "hint",
"type": "string",
Expand Down Expand Up @@ -9712,6 +9781,39 @@
"getter": false,
"setter": false
},
{
"name": "validity",
"type": "ValidityState",
"complexType": {
"original": "ValidityState",
"resolved": "ValidityState",
"references": {
"ValidityState": {
"location": "global",
"id": "global::ValidityState"
}
}
},
"mutable": false,
"attr": "validity",
"reflectToAttr": false,
"docs": "Read-only property of the select, returns a ValidityState object that represents the validity states this element is in.",
"docsTags": [
{
"name": "readonly",
"text": ""
}
],
"values": [
{
"type": "ValidityState"
}
],
"optional": false,
"required": false,
"getter": true,
"setter": false
},
{
"name": "value",
"type": "string",
Expand All @@ -9737,6 +9839,50 @@
}
],
"methods": [
{
"name": "checkValidity",
"returns": {
"type": "Promise<boolean>",
"docs": ""
},
"complexType": {
"signature": "() => Promise<boolean>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<boolean>"
},
"signature": "checkValidity() => Promise<boolean>",
"parameters": [],
"docs": "Check the validity of gcds-select",
"docsTags": []
},
{
"name": "getValidationMessage",
"returns": {
"type": "Promise<string>",
"docs": ""
},
"complexType": {
"signature": "() => Promise<string>",
"parameters": [],
"references": {
"Promise": {
"location": "global",
"id": "global::Promise"
}
},
"return": "Promise<string>"
},
"signature": "getValidationMessage() => Promise<string>",
"parameters": [],
"docs": "Get validationMessage of gcds-select",
"docsTags": []
},
{
"name": "validate",
"returns": {
Expand Down
42 changes: 42 additions & 0 deletions packages/web/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,18 @@ export namespace Components {
* A select provides a large list of options for single selection.
*/
interface GcdsSelect {
/**
* String to have autocomplete enabled.
*/
"autocomplete"?: string;
/**
* If true, the select will be focused on component render
*/
"autofocus": boolean;
/**
* Check the validity of gcds-select
*/
"checkValidity": () => Promise<boolean>;
/**
* The default value is an optional value that gets displayed before the user selects an option.
*/
Expand All @@ -1115,6 +1127,14 @@ export namespace Components {
* Error message for an invalid select element.
*/
"errorMessage"?: string;
/**
* The ID of the form that the select field belongs to.
*/
"form"?: string;
/**
* Get validationMessage of gcds-select
*/
"getValidationMessage": () => Promise<string>;
/**
* Hint displayed below the label.
*/
Expand Down Expand Up @@ -1151,6 +1171,11 @@ export namespace Components {
"validator": Array<
string | ValidatorEntry | Validator<string>
>;
/**
* Read-only property of the select, returns a ValidityState object that represents the validity states this element is in.
* @readonly
*/
"validity": ValidityState;
/**
* Value for a select element.
*/
Expand Down Expand Up @@ -3556,6 +3581,14 @@ declare namespace LocalJSX {
* A select provides a large list of options for single selection.
*/
interface GcdsSelect {
/**
* String to have autocomplete enabled.
*/
"autocomplete"?: string;
/**
* If true, the select will be focused on component render
*/
"autofocus"?: boolean;
/**
* The default value is an optional value that gets displayed before the user selects an option.
*/
Expand All @@ -3569,6 +3602,10 @@ declare namespace LocalJSX {
* Error message for an invalid select element.
*/
"errorMessage"?: string;
/**
* The ID of the form that the select field belongs to.
*/
"form"?: string;
/**
* Hint displayed below the label.
*/
Expand Down Expand Up @@ -3625,6 +3662,11 @@ declare namespace LocalJSX {
"validator"?: Array<
string | ValidatorEntry | Validator<string>
>;
/**
* Read-only property of the select, returns a ValidityState object that represents the validity states this element is in.
* @readonly
*/
"validity"?: ValidityState;
/**
* Value for a select element.
*/
Expand Down
Loading