Skip to content
Draft
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
5 changes: 5 additions & 0 deletions .changeset/quick-shoes-burn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@patternfly/pfe-core": patch
---

`InternalsController`: expose `form`, `validationMessage`, and `willValidate` getters. Previously returned `undefined` despite TypeScript accepting the access. Form-associated elements can read the associated form reference and validation state from the controller.
29 changes: 29 additions & 0 deletions .changeset/warm-birds-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
"@patternfly/elements": major
---

`<pf-v6-text-input>`: replaces `<pf-v5-text-input>` with PatternFly v6 design specs.

```html
<label for="name">Name</label>
<pf-v6-text-input id="name" name="name"></pf-v6-text-input>
```

**Breaking Changes from v5**

- Renamed tag from `<pf-v5-text-input>` to `<pf-v6-text-input>`
- CSS custom properties renamed from `--pf-v5-c-form-control--*` to `--pf-v6-c-form-control--*`
- `left-truncated` attribute replaced by `truncated="start"` enum
- `icon` / `custom-icon-url` / `custom-icon-dimensions` attributes replaced by `icon` slot
- `validate-on` and `error-text` attributes removed

**New features**

- `referenceTarget` support for native cross-root label association
- `validated="error"` state with `aria-invalid` and `role="alert"` status message
- Constraint validation via `checkValidity()`, `reportValidity()`, `setCustomValidity()`
- `maxlength`, `minlength`, and `inputmode` attributes
- `select()` method
- `icon` slot for custom icon content
- Cancelable `change` event
- v6 design tokens and `light-dark()` support
15 changes: 12 additions & 3 deletions core/pfe-core/controllers/internals-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,10 @@ type InternalsHost = ReactiveControllerHost & HTMLElement;
export class InternalsController implements ReactiveController, ARIAMixin {
private static instances = new WeakMap<HTMLElement, InternalsController>();

declare readonly form: ElementInternals['form'];
declare readonly shadowRoot: ElementInternals['shadowRoot'];

// https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/states
declare readonly states: unknown;
declare readonly willValidate: ElementInternals['willValidate'];
declare readonly validationMessage: ElementInternals['validationMessage'];

public static getLabels(host: InternalsHost): Element[] {
return Array.from(this.instances.get(host)?.internals.labels ?? []) as Element[];
Expand Down Expand Up @@ -232,6 +229,18 @@ export class InternalsController implements ReactiveController, ARIAMixin {
return this.internals.validity;
}

get form(): HTMLFormElement | null {
return this.internals.form;
}

get validationMessage(): string {
return this.internals.validationMessage;
}

get willValidate(): boolean {
return this.internals.willValidate;
}

/** A best-attempt based on observed behaviour in FireFox 115 on fedora 38 */
get computedLabelText(): string {
return this.internals.ariaLabel
Expand Down
2 changes: 1 addition & 1 deletion docs/main.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import '@patternfly/elements/pf-v5-select/pf-v5-select.js';
import '@patternfly/elements/pf-v5-table/pf-v5-table.js';
import '@patternfly/elements/pf-v5-tabs/pf-v5-tabs.js';
import '@patternfly/elements/pf-v5-text-area/pf-v5-text-area.js';
import '@patternfly/elements/pf-v5-text-input/pf-v5-text-input.js';
import '@patternfly/elements/pf-v6-text-input/pf-v6-text-input.js';
import '@patternfly/elements/pf-v5-tile/pf-v5-tile.js';
import '@patternfly/elements/pf-v5-tooltip/pf-v5-tooltip.js';

Expand Down
9 changes: 0 additions & 9 deletions elements/pf-v5-text-input/README.md

This file was deleted.

24 changes: 0 additions & 24 deletions elements/pf-v5-text-input/demo/form-submission.html

This file was deleted.

23 changes: 0 additions & 23 deletions elements/pf-v5-text-input/demo/icon-variants.html

This file was deleted.

12 changes: 0 additions & 12 deletions elements/pf-v5-text-input/demo/index.html

This file was deleted.

14 changes: 0 additions & 14 deletions elements/pf-v5-text-input/demo/invalid.html

This file was deleted.

81 changes: 0 additions & 81 deletions elements/pf-v5-text-input/demo/kitchen-sink.html

This file was deleted.

11 changes: 0 additions & 11 deletions elements/pf-v5-text-input/demo/left-truncated.html

This file was deleted.

18 changes: 0 additions & 18 deletions elements/pf-v5-text-input/demo/read-only.html

This file was deleted.

38 changes: 0 additions & 38 deletions elements/pf-v5-text-input/demo/status-icon-sprite.svg

This file was deleted.

26 changes: 0 additions & 26 deletions elements/pf-v5-text-input/demo/validation.html

This file was deleted.

23 changes: 0 additions & 23 deletions elements/pf-v5-text-input/docs/pf-v5-text-input.md

This file was deleted.

Binary file removed elements/pf-v5-text-input/docs/screenshot.png
Binary file not shown.
Loading
Loading