diff --git a/components/fieldlabel/index.css b/components/fieldlabel/index.css index fd4b63b2f4..e092a33502 100644 --- a/components/fieldlabel/index.css +++ b/components/fieldlabel/index.css @@ -11,82 +11,72 @@ governing permissions and limitations under the License. */ .spectrum-FieldLabel { - --spectrum-fieldlabel-min-height: var(--spectrum-component-height-75); - --spectrum-fieldlabel-color: var(--spectrum-neutral-subdued-content-color-default); - + --spectrum-fieldlabel-min-height: var(--spectrum-component-height-100); + --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-100); + --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-100); --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-medium); + --spectrum-fieldlabel-font-size: var(--spectrum-font-size-100); --spectrum-fieldlabel-font-weight: var(--spectrum-regular-font-weight); --spectrum-fieldlabel-line-height: var(--spectrum-line-height-100); --spectrum-fieldlabel-line-height-cjk: var(--spectrum-cjk-line-height-100); + + --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-medium); + --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-200); + + --spectrum-fieldlabel-color: var(--spectrum-neutral-subdued-content-color-default); } .spectrum-FieldLabel--sizeS { --spectrum-fieldlabel-min-height: var(--spectrum-component-height-75); --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-75); --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-75); - --spectrum-fieldlabel-font-size: var(--spectrum-font-size-75); - - --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-small); - --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-100); - --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-small); -} -.spectrum-FieldLabel--sizeM { - --spectrum-fieldlabel-min-height: var(--spectrum-component-height-75); - --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-75); - --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-75); --spectrum-fieldlabel-font-size: var(--spectrum-font-size-75); - --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-medium); - --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-200); - - --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-medium); + --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-small); + --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-100); } .spectrum-FieldLabel--sizeL { - --spectrum-fieldlabel-min-height: var(--spectrum-component-height-100); - --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-100); - --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-100); - --spectrum-fieldlabel-font-size: var(--spectrum-font-size-100); - - --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-large); - --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-200); - - --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-large); -} - -.spectrum-FieldLabel--sizeXL { --spectrum-fieldlabel-min-height: var(--spectrum-component-height-200); --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-200); --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-200); + --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-large); + --spectrum-fieldlabel-font-size: var(--spectrum-font-size-200); - --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-extra-large); - --spectrum-fieldlabel-side-padding-right: var(--spectrum-spacing-200); + --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-large); +} +.spectrum-FieldLabel--sizeXL { + --spectrum-fieldlabel-min-height: var(--spectrum-component-height-300); + --spectrum-fieldlabel-top-to-text: var(--spectrum-component-top-to-text-300); + --spectrum-fieldlabel-bottom-to-text: var(--spectrum-component-bottom-to-text-300); --spectrum-field-label-text-to-asterisk: var(--spectrum-field-label-text-to-asterisk-extra-large); + + --spectrum-fieldlabel-font-size: var(--spectrum-font-size-300); + + --spectrum-fieldlabel-side-margin-block-start: var(--spectrum-field-label-top-margin-extra-large); } .spectrum-FieldLabel { display: block; + box-sizing: border-box; min-block-size: var(--mod-fieldlabel-min-height, var(--spectrum-fieldlabel-min-height)); - padding-block: var(--mod-field-label-top-to-text, var(--spectrum-fieldlabel-top-to-text)) var(--mod-field-label-bottom-to-text, var(--spectrum-fieldlabel-bottom-to-text)); padding-inline: 0; font-size: var(--mod-fieldlabel-font-size, var(--spectrum-fieldlabel-font-size)); font-weight: var(--mod-fieldlabel-font-weight, var(--spectrum-fieldlabel-font-weight)); - line-height: var(--mod-fieldlabel-line-height, var(--spectrum-fieldlabel-line-height)); + color: var(--spectrum-fieldlabel-color); -webkit-font-smoothing: subpixel-antialiased; -moz-osx-font-smoothing: auto; - color: var(--spectrum-fieldlabel-color); - /* CJK (Chinese, Japanese, and Korean) language support */ &:lang(ja), &:lang(zh), @@ -116,19 +106,25 @@ governing permissions and limitations under the License. text-align: end; } +.spectrum-FieldLabel--staticBlack { + color: var(--spectrum-black); +} + +.spectrum-FieldLabel--staticWhite { + color: var(--spectrum-white); +} + /********* Form *********/ .spectrum-Form { --spectrum-tableform-item-block-spacing: var(--spectrum-spacing-300); - margin: 0; display: grid; grid-template-columns: var(--mod-form-grid-template-columns, auto auto); - inline-size: var(--mod-form-inline-size, fit-content); + row-gap: var(--mod-form-item-block-spacing, var(--spectrum-tableform-item-block-spacing)); justify-content: start; - /* @deprecation --mod-tableform-item-block-spacing has been renamed to - --mod-form-item-block-spacing. The fallback will be removed in a future version. */ - row-gap: var(--mod-form-item-block-spacing, var(--mod-tableform-item-block-spacing, var(--spectrum-tableform-item-block-spacing))); + inline-size: var(--mod-form-inline-size, fit-content); + margin: 0; } /* Row */ @@ -156,9 +152,7 @@ governing permissions and limitations under the License. /* Rows with stacked alignment */ .spectrum-Form--labelsAbove { - /* @deprecation --mod-tableform-item-block-spacing-labels-above has been renamed to - --mod-form-item-block-spacing-labels-above. The fallback will be removed in a future version. */ - --mod-form-item-block-spacing: var(--mod-form-item-block-spacing-labels-above, var(--mod-tableform-item-block-spacing-labels-above, var(--spectrum-spacing-200))); + --mod-form-item-block-spacing: var(--mod-form-item-block-spacing-labels-above, var(--spectrum-spacing-200)); --mod-form-grid-template-columns: var(--mod-form-grid-template-columns-labels-above, auto); .spectrum-Form-item { @@ -170,10 +164,10 @@ governing permissions and limitations under the License. .spectrum-FieldLabel, .spectrum-Form-itemLabel { &.is-disabled { - color: var(--highcontrast-disabled-content-color, var(--mod-disabled-content-color, var(--spectrum-disabled-content-color))); + color: var(--highcontrast-field-label-disabled-content-color, var(--mod-field-label-disabled-content-color, var(--spectrum-disabled-content-color))); .spectrum-FieldLabel-requiredIcon { - color: var(--highcontrast-disabled-content-color, var(--mod-disabled-content-color, var(--spectrum-disabled-content-color))); + color: var(--highcontrast-field-label-disabled-content-color, var(--mod-field-label-disabled-content-color, var(--spectrum-disabled-content-color))); } } } @@ -181,6 +175,6 @@ governing permissions and limitations under the License. /********* WHCM *********/ @media (forced-colors: active) { .spectrum-FieldLabel { - --highcontrast-disabled-content-color: GrayText; + --highcontrast-field-label-disabled-content-color: GrayText; } } diff --git a/components/fieldlabel/metadata/fieldlabel.yml b/components/fieldlabel/metadata/fieldlabel.yml index 4a1a2c3ab6..6840249ab1 100644 --- a/components/fieldlabel/metadata/fieldlabel.yml +++ b/components/fieldlabel/metadata/fieldlabel.yml @@ -6,7 +6,15 @@ sections: This component can be modified via its `--mod-*` prefixed custom properties. A list of those prefixed custom properties can be found here. - name: Migration Guide description: | - ### T-shirt sizing + ### x/x/2024 - Version 8.0.0 + #### Spectrum 2 release + Field label now uses Spectrum 2 tokens and specifications. A few notable changes and additions: + - The medium size styles are used by default, so the `spectrum-FieldLabel--sizeM` class is no longer necessary and has been removed. + - Two variant classes have been added for black and white static colors. + - The mod custom property `--mod-disabled-content-color` has been renamed to `--mod-field-label-disabled-content-color`. + + ### 11/13/2020 - Version 3.0.0 + #### T-shirt sizing Field label now supports t-shirt sizing and requires that you specify the size by adding a `.spectrum-FieldLabel--size*` class. examples: - id: fieldlabel-sizing @@ -14,75 +22,82 @@ examples: markup: |
-

S

+

Small

- +
- +
-

M (default)

+

Medium (default)

- +
- +
-

L

+

Large

- +
- +
-

XL

+

Extra large

- +
- +
- id: fieldlabel-standard name: Standard markup: | - +
- +
- id: fieldlabel-side-left - name: Left - description: A left aligned Field label. + name: Side label with left aligned text + description: Labels with either the `spectrum-FieldLabel--left` or `spectrum-FieldLabel--right` class are for positioning the label to the side (inline start) of the form field. The left class sets the text alignment to left. markup: | - +
- id: fieldlabel-side-right - name: Right - description: A right aligned Field label. + name: Side label with right aligned text + description: With `spectrum-FieldLabel--right`, the side label is still positioned similarly to the left class, but with the text alignment set to right. markup: | - +
- id: fieldlabel-required name: Required - description: A Field label for a required field can display either the text "(required)", or an asterisk. If using the asterisk icon, do not leave any space between the label text and the start of the `` element in the markup, so extra space is not added in addition to the inline margin. + description: | + A Field label for a required field can display either the text "(required)", or an asterisk. + + If using the asterisk icon, do not leave any space between the label text and the start of the `` element in the markup, so extra space is not added in addition to the inline margin. The following UI icon sizes are used for the asterisk: + - Asterisk100: Small and medium + - Asterisk200: Large + - Asterisk300: Extra large + markup: | -
@@ -100,7 +115,7 @@ examples:

-