Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
12f2fc9
feat(label): init field label mixin
nikkimk Sep 24, 2025
b6ea53b
feat(textfield): updated textfiled docs to use label mixin
nikkimk Sep 24, 2025
6117e6b
feat(field-label): added mixin to package exports
nikkimk Sep 25, 2025
d5448f1
feat(field-label): added optional slot name for rendering label slot
nikkimk Sep 25, 2025
cf1c9d7
docs(textfield): implemented label mixin in stories
nikkimk Sep 25, 2025
743d553
test(textfield): added test for slotted label
nikkimk Sep 25, 2025
c386f09
feat(textfield): added default slot observer for label changes
nikkimk Sep 29, 2025
e812721
test(textfield): added tests for slotted label
nikkimk Sep 29, 2025
5be1715
docs(number-field): updated number field docs based on text field lab…
nikkimk Sep 29, 2025
56954ed
docs(number-field): updated stories with slotted label
nikkimk Sep 29, 2025
b5bdd62
docs(color-field): updated docs with slotted label
nikkimk Sep 29, 2025
d6dde5b
feat(field-label): updated interface to include optional slot name fo…
nikkimk Sep 29, 2025
e0e85c5
feat(combobox): added label slot to combobox
nikkimk Sep 29, 2025
3c226f8
docs(combobox): added slotted label to docs
nikkimk Sep 29, 2025
183218c
test(combobox): updates tests with slotted label
nikkimk Sep 29, 2025
c408b4e
fix(combobox): fixed combobox field id for label
nikkimk Sep 29, 2025
84c67c3
feat(field-label): added label slot change handler to mixin
nikkimk Oct 7, 2025
8822ec1
feat(combobox): added slot change handlers
nikkimk Oct 7, 2025
4868c82
feat(field-label): hide field label if not used
nikkimk Oct 7, 2025
9cdc838
feat(textfield): use field label mixin to observe slot
nikkimk Oct 7, 2025
d36080d
feat(combobox): use field label mixin to observe slot
nikkimk Oct 7, 2025
c304d57
feat(combobox): added placeholder
nikkimk Oct 9, 2025
da60cf4
fix(textfield): fixed issue with detecting slot content
nikkimk Oct 9, 2025
c40127f
fix(field-label): fixed issue with slot content detection in text field
nikkimk Oct 9, 2025
9717285
test(textfield): removed unneccessary id attribute
nikkimk Oct 9, 2025
0ffa462
fix(fieldl-label): fixed mixin to allow slot naming
nikkimk Oct 10, 2025
4ac3c92
feat(combobox): updated combobox, stories and tests for field label m…
nikkimk Oct 10, 2025
dd22117
fix(field-label): corrected linting issues
nikkimk Oct 10, 2025
4263db4
fix(menu): MenuItem focus stealing from input elements on mouseover (…
Rajdeepc Oct 10, 2025
58fab11
fix(field-label): made field id optional for picker
nikkimk Oct 10, 2025
6a22c11
fix(field-label): made field id optional for picker
nikkimk Oct 10, 2025
93289a4
feat(picker): added field label mixin to pciker and picker stories
nikkimk Oct 10, 2025
f0b3a39
fix(textfiled): fixed element name in warning
nikkimk Oct 15, 2025
462f5bb
fix(combobox): fixed element name in warning
nikkimk Oct 15, 2025
8d7b1ad
docs(picker): updated stories
nikkimk Oct 16, 2025
3934124
feat(picker): added field label mizin to picker without affecting pic…
nikkimk Oct 16, 2025
56e2e38
docs(textfield): documented default label slot
nikkimk Oct 16, 2025
b776c24
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
87cd4fb
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
c874038
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
6037e88
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
2ce98c9
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
d1996b0
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
8a917a4
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
fbf91db
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
2a11769
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
f573755
feat(picker): reverting changes until picker is refactored
nikkimk Oct 21, 2025
28b0054
docs(textfield): updated docs with label examples
nikkimk Oct 21, 2025
c376488
docs(textfield): fixed issue with tabs
nikkimk Oct 21, 2025
4cc0120
Merge branch 'main' into nikkimk/1042-form-mixins
nikkimk Oct 21, 2025
f0b2a3c
test(textfield): updated test warning text to match revised warning text
nikkimk Oct 21, 2025
29947da
docs(combobox): added label and placeholder sections to docs
nikkimk Oct 21, 2025
13e854a
docs(textfield): changed tabs label
nikkimk Oct 21, 2025
4d45feb
docs(number-field): updated docs with a label section
nikkimk Oct 21, 2025
78fc419
chore(changeset): added changsets
nikkimk Oct 21, 2025
41f08c9
docs(field-label): added field-label-mixin docs
nikkimk Oct 21, 2025
9ed1dd5
Apply suggestion from @nikkimk
nikkimk Oct 21, 2025
2eabaed
feat(picker): revert changes
nikkimk Oct 21, 2025
feb1241
feat(picker): revert changes
nikkimk Oct 21, 2025
dc4e856
chore: updated changesets
nikkimk Oct 22, 2025
ccafa69
docs(color-field): added label docs
nikkimk Oct 22, 2025
73b9dc5
chore: updated changesets
nikkimk Oct 22, 2025
9ceeade
docs(combobox): fixed typo
nikkimk Oct 22, 2025
9b04178
docs(field-label): added JS Docs to mixin
nikkimk Oct 22, 2025
59abba0
chore: linting fixes
nikkimk Oct 22, 2025
fd99e5d
docs(combobox): fixed typo
nikkimk Oct 22, 2025
a3c011f
chore: dropped changeset
nikkimk Oct 24, 2025
e4bf6ce
docs(color-field): fixed typo
nikkimk Oct 24, 2025
0b553fe
chore(combobox): fixed typo
nikkimk Oct 24, 2025
bbd4cdb
docs(combobox): added side-aligned to story
nikkimk Oct 24, 2025
7f5f325
docs(combobox): fixed typo
nikkimk Oct 24, 2025
d3ae4ed
docs(combobox): fixed typo
nikkimk Oct 24, 2025
65d97ac
docs(field-label): added links to mixin docs
nikkimk Oct 24, 2025
cf8345c
docs(field-label): added code type in mixin docs
nikkimk Oct 24, 2025
e7c1e63
docs(field-label): added code type in mixin docs
nikkimk Oct 24, 2025
25bf661
fix(textfield): simiplified styles getter
nikkimk Oct 24, 2025
798b1be
fix(textfield): simplified attribute
nikkimk Oct 24, 2025
8222010
fix(textfield): simplified attribute
nikkimk Oct 24, 2025
d189d44
docs(field-label): added more detail to mixin docs
nikkimk Oct 24, 2025
8eaa3bd
docs(field-label): added more detail to field label mixin docs
nikkimk Oct 24, 2025
dd27c32
fix(field-label): fixed inherited styles in mixin
nikkimk Oct 24, 2025
2d2c653
fix(field-label): set side-aligned property to optional
nikkimk Oct 24, 2025
55f0104
fix(field-label): added override to styles getter
nikkimk Oct 24, 2025
e6cd27d
fix(field-label): field id should be required
nikkimk Oct 24, 2025
ed3418c
fix(field-label): reverted styles changes to mixin
nikkimk Oct 24, 2025
cb4d007
fix(textfield): fixed styles array
nikkimk Oct 24, 2025
f24e789
fix(textfield): ensure super styles are CSSResultArray
nikkimk Oct 24, 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
5 changes: 5 additions & 0 deletions .changeset/four-suits-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/number-field': minor
---

**Added**: slotted visible label to resolve cross-root ARIA issues (Before: `<sp-field-label for="number">Label</sp-field-label><sp-number-field id="number"></sp-number-field>` / After: `<sp-number-field>Label</sp-number-field>`)
5 changes: 5 additions & 0 deletions .changeset/funny-dingos-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/field-label': minor
---

**Added**: field label mixin to insert a label in a component's shadow DOM to resolve cross-root ARIA issues (`export class FormField extends FieldLabelMixin(SpectrumElement, 'label')` to apply mixin with a `label` slot to a class and `this.renderFieldLabel('field_id')` to render a field label for an element with `id="field_id"`)
5 changes: 5 additions & 0 deletions .changeset/six-dragons-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/combobox': minor
---

**Added**: slotted visible label to resolve cross-root ARIA issues (Before: `<sp-field-label for="combo">Label</sp-field-label><sp-combobox id="combo"></sp-combobox>` / After: `<sp-combobox><span slot="field-label">Label</span></sp-combobox>`)
5 changes: 5 additions & 0 deletions .changeset/solid-streets-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/textfield': minor
---

**Added**: slotted visible label to resolve cross-root ARIA issues (Before: `<sp-field-label for="text">Label</sp-field-label><sp-textfield id="text"></sp-textfield>` / After: `<sp-textfield>Label</sp-textfield>`)
5 changes: 5 additions & 0 deletions .changeset/thick-towns-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@spectrum-web-components/color-field': minor
---

**Added**: slotted visible label to resolve cross-root ARIA issues (Before: `<sp-field-label for="color">Label</sp-field-label><sp-color-field id="color"></sp-color-field>` / After: `<sp-color-field>Label</sp-color-field>`)
127 changes: 111 additions & 16 deletions packages/color-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,78 @@ import { ColorField } from '@spectrum-web-components/color-field';

The color field consists of several key parts:

- **Label**: Visual or visually hidden text that describes the color field to the user
- **Input field**: The main text input area where users can type color values
- **Color handle**: An optional visual indicator showing the current color (when `view-color` attribute is enabled)
- **Validation feedback**: Visual indicators for valid and invalid color inputs
- **Size variations**: Different size options to match your design requirements

```html
<sp-color-field value="#ffff00"></sp-color-field>
<sp-color-field value="#ffff00">Background color</sp-color-field>
```

#### Label

A color field must have a label in order to be accessible. A label can be provided either via the default slot, or via the `label` attribute, for a hidden label that can be read by assistive technology. If no label is provided, the component will have a visually hidden label with the text `color`.

<sp-tabs selected="slotted" auto label="Labels">
<sp-tab value="slotted">Visible slotted label</sp-tab>
<sp-tab-panel value="slotted">

```html
<sp-color-field value="#000000">Text color</sp-color-field>
```

</sp-tab-panel>
<sp-tab value="attribute">Visually hidden label attribute</sp-tab>
<sp-tab-panel value="attribute">

```html
<sp-color-field value="#000000" label="Text color"></sp-color-field>
```

</sp-tab-panel>
</sp-tabs>

### Options

#### Sizes

<sp-tabs selected="m" auto label="Size Attribute Options">
<sp-tab value="s">Small</sp-tab>
<sp-tab-panel value="s">

```html
<sp-color-field label="Size" value="1024" size="s"></sp-color-field>
```

</sp-tab-panel>
<sp-tab value="m">Medium</sp-tab>
<sp-tab-panel value="m">

```html
<sp-number-field label="Size" value="1024" size="m"></sp-number-field>
```

</sp-tab-panel>
<sp-tab value="l">Large</sp-tab>
<sp-tab-panel value="l">

```html
<sp-number-field label="Size" value="1024" size="l"></sp-number-field>
```

</sp-tab-panel>
<sp-tab value="xl">Extra Large</sp-tab>
<sp-tab-panel value="xl">

```html
<sp-number-field label="Size" value="1024" size="xl"></sp-number-field>
```

</sp-tab-panel>
</sp-tabs>

### Options

#### Sizes
Expand All @@ -45,15 +108,23 @@ The color field consists of several key parts:
<sp-tab-panel value="s">

```html
<sp-color-field size="s" value="#ffff00"></sp-color-field>
<sp-color-field
size="s"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
<sp-tab value="m">Medium</sp-tab>
<sp-tab-panel value="m">

```html
<sp-color-field size="m" value="#ffff00"></sp-color-field>
<sp-color-field
size="m"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -62,7 +133,11 @@ The color field consists of several key parts:
<sp-tab-panel value="l">

```html
<sp-color-field size="l" value="#ffff00"></sp-color-field>
<sp-color-field
size="l"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -71,7 +146,11 @@ The color field consists of several key parts:
<sp-tab-panel value="xl">

```html
<sp-color-field size="xl" value="#ffff00"></sp-color-field>
<sp-color-field
size="xl"
value="#ffff00"
label="Background color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -82,15 +161,15 @@ The color field consists of several key parts:
When `view-color` is true, the color handle will be rendered. This is useful for development and debugging purposes.

```html
<sp-color-field view-color value="#f00"></sp-color-field>
<sp-color-field view-color value="#f00">Icon color</sp-color-field>
```

#### Quiet

A quiet color field provides a more subtle appearance:

```html
<sp-color-field quiet value="#e6e600"></sp-color-field>
<sp-color-field quiet value="#e6e600">Icon color</sp-color-field>
```

### States
Expand All @@ -100,23 +179,23 @@ A quiet color field provides a more subtle appearance:
The default state of the color field, ready for user input:

```html
<sp-color-field value="#ffff00"></sp-color-field>
<sp-color-field value="#ffff00">Icon color</sp-color-field>
```

#### Read Only

A readonly color field that displays the color value but prevents user modification:

```html
<sp-color-field readonly value="#ffff00"></sp-color-field>
<sp-color-field readonly value="#ffff00">Icon color</sp-color-field>
```

#### Invalid Input

If the input value is not a valid color, `<sp-color-field>` will not accept it and may show validation feedback:

```html
<sp-color-field value="not a color"></sp-color-field>
<sp-color-field value="not a color">Icon color</sp-color-field>
```

### Behaviors
Expand All @@ -134,7 +213,7 @@ For a complete list of supported color formats, see the [ColorController documen
A hexadecimal color is specified with: `#RRGGBB`. `RR` (red), `GG` (green) and `BB` (blue) are hexadecimal integers between `00` and `FF` specifying the intensity of the color.

```html
<sp-color-field view-color value="#ff0000"></sp-color-field>
<sp-color-field view-color value="#ff0000" label="Text color"></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -144,7 +223,7 @@ A hexadecimal color is specified with: `#RRGGBB`. `RR` (red), `GG` (green) and `
Shorthand hexadecimal color values are also supported. `#RGB` is a shorthand for `#RRGGBB`. In the shorthand form, `R` (red), `G` (green), and `B` (blue) are hexadecimal characters between `0` and `F`. Each character is repeated to create the full 6-digit color code. For example, `#123` would expand to `#112233`.

```html
<sp-color-field view-color value="#f00"></sp-color-field>
<sp-color-field view-color value="#f00" label="Text color"></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -154,7 +233,11 @@ Shorthand hexadecimal color values are also supported. `#RGB` is a shorthand for
An RGB color value is specified with: rgb(red, green, blue). Each parameter defines the intensity of the color with a value between 0 and 255.

```html
<sp-color-field view-color value="rgb(255,0,0)"></sp-color-field>
<sp-color-field
view-color
value="rgb(255,0,0)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -164,7 +247,11 @@ An RGB color value is specified with: rgb(red, green, blue). Each parameter defi
An RGBA color value is specified with: `rgba(red, green, blue, alpha)`. The `alpha` parameter is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

```html
<sp-color-field view-color value="rgba(0,255,0,0.3)"></sp-color-field>
<sp-color-field
view-color
value="rgba(0,255,0,0.3)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -174,7 +261,11 @@ An RGBA color value is specified with: `rgba(red, green, blue, alpha)`. The `alp
An HSL color value is specified with: hsl(hue, saturation, lightness). Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue. Saturation and lightness are percentages.

```html
<sp-color-field view-color value="hsl(234, 70%, 50%)"></sp-color-field>
<sp-color-field
view-color
value="hsl(234, 70%, 50%)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand All @@ -184,7 +275,11 @@ An HSL color value is specified with: hsl(hue, saturation, lightness). Hue is a
An HSV color value is specified with: hsv(hue, saturation, value). Hue is a degree on the color wheel from 0 to 360. 0 is red, 120 is green, and 240 is blue. Saturation and value are percentages.

```html
<sp-color-field view-color value="hsv(0, 70%, 50%)"></sp-color-field>
<sp-color-field
view-color
value="hsv(0, 70%, 50%)"
label="Text color"
></sp-color-field>
```

</sp-tab-panel>
Expand Down
2 changes: 0 additions & 2 deletions packages/color-field/stories/color-field-sizes.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
* governing permissions and limitations under the License.
*/
import { TemplateResult } from '@spectrum-web-components/base';

import '@spectrum-web-components/field-label/sp-field-label.js';
import '@spectrum-web-components/help-text/sp-help-text.js';
import { ColorFieldMarkup } from './template.js';

Expand Down
Loading
Loading