Skip to content

Commit

Permalink
fix(calendar,dial,pickerbutton,progressbar,radio,stepper): unused cus…
Browse files Browse the repository at this point in the history
…tom properties (#3487)

* fix(pickerbutton): add missing custom properties
* fix(radio): add missing custom props
* fix(calendar): add missing custom properties
* fix(stepper): define unused custom props
* fix(progressbar): remove unused custom properties; change background-color to background see #2929; fix static color
* fix(dial): remove unused custom properties; add undefined custom properties
  • Loading branch information
rise-erpelding authored and castastrophe committed Jan 17, 2025
1 parent 885119f commit 46ae687
Show file tree
Hide file tree
Showing 12 changed files with 151 additions and 70 deletions.
17 changes: 17 additions & 0 deletions .changeset/wicked-dragons-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"@spectrum-css/pickerbutton": patch
"@spectrum-css/progressbar": patch
"@spectrum-css/calendar": patch
"@spectrum-css/stepper": patch
"@spectrum-css/radio": patch
"@spectrum-css/dial": patch
---

Fixes to align `spectrum-two` with `s2-foundations-redux`/`main`, mostly defining unused custom properties, but addresses any other lint warnings or inconsistencies noted in the following components:

**Calendar**: Defines 1 previously undefined custom property to align with `main` and `s2-foundations-redux`
**Dial**: Defines 6 previously undefined custom properties, removes 3 unused custom properties
**Pickerbutton**: Defines 9 previously undefined custom properties to align with `main` and `s2-foundations-redux`
**Progressbar**: Removes 3 unused custom properties, reverts background-color to background to accommodate gradients
**Radio**: Defines 4 previously undefined custom properties to align with `main` and `s2-foundations-redux`
**Stepper**: moves high contrast block further down to align with other components' CSS structure, defines multiple undefined custom properties, adds disable-next-line comment to suppress no-unused-custom-properties warning
1 change: 1 addition & 0 deletions components/calendar/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
"--spectrum-font-size-100",
"--spectrum-font-size-300",
"--spectrum-font-size-50",
"--spectrum-gray-100-rgb",
"--spectrum-gray-800",
"--spectrum-logical-rotation",
"--spectrum-neutral-content-color-default",
Expand Down
1 change: 1 addition & 0 deletions components/calendar/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
--spectrum-calendar-day-background: var(--mod-calendar-day-background-color, transparent);
--spectrum-calendar-day-background-selected: var(--highcontrast-calendar-day-background-selected, var(--mod-calendar-day-background-color-selected, var(--spectrum-calendar-day-background-color-selected)));
--spectrum-calendar-day-background-selected-hover: var(--highcontrast-calendar-day-background-selected-hover, var(--mod-calendar-day-background-color-selected-hover, var(--spectrum-calendar-day-background-color-selected-hover)));
--spectrum-calendar-day-background-color-selected-disabled: rgba(var(--spectrum-gray-100-rgb), 0.4);
--spectrum-calendar-day-background-cap-selected: var(--highcontrast-calendar-day-background-cap-selected, var(--mod-calendar-day-background-color-cap-selected, var(--spectrum-calendar-day-background-color-cap-selected)));
--spectrum-calendar-day-background-hover: var(--highcontrast-calendar-day-background-hover, var(--mod-calendar-day-background-color-hover, var(--spectrum-calendar-day-background-color-hover)));
--spectrum-calendar-day-background-focus: var(--highcontrast-calendar-day-background-focus, var(--mod-calendar-day-background-color-key-focus, var(--spectrum-calendar-day-background-color-key-focus)));
Expand Down
6 changes: 2 additions & 4 deletions components/dial/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@
"component": [
"--spectrum-dial-background-color-default",
"--spectrum-dial-border-color",
"--spectrum-dial-border-color-disabled",
"--spectrum-dial-border-color-hover",
"--spectrum-dial-border-color-key-focus",
"--spectrum-dial-border-radius",
"--spectrum-dial-container-width",
"--spectrum-dial-controls-margin",
Expand All @@ -88,7 +86,6 @@
"--spectrum-dial-handle-inline-margin",
"--spectrum-dial-handle-marker-border-radius",
"--spectrum-dial-handle-marker-color",
"--spectrum-dial-handle-marker-color-disabled",
"--spectrum-dial-handle-marker-color-hover",
"--spectrum-dial-handle-marker-color-key-focus",
"--spectrum-dial-handle-marker-color-mouse-focus",
Expand All @@ -111,11 +108,12 @@
"global": [
"--spectrum-border-width-200",
"--spectrum-font-size-75",
"--spectrum-gray-200",
"--spectrum-gray-25",
"--spectrum-gray-400",
"--spectrum-gray-600",
"--spectrum-gray-700",
"--spectrum-gray-75",
"--spectrum-gray-800",
"--spectrum-line-height-200"
],
"passthroughs": [],
Expand Down
13 changes: 9 additions & 4 deletions components/dial/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,21 @@
.spectrum-Dial {
--spectrum-dial-background-color-default: var(--spectrum-gray-75);

--spectrum-dial-handle-marker-color-disabled: var(--spectrum-gray-200);
--spectrum-dial-border-color-disabled: var(--spectrum-gray-200);

--spectrum-dial-handle-marker-color: var(--spectrum-gray-700);
--spectrum-dial-border-color: var(--spectrum-gray-700);

--spectrum-dial-handle-marker-color-hover: var(--spectrum-gray-800);
--spectrum-dial-border-color-hover: var(--spectrum-gray-800);

--spectrum-dial-handle-marker-color-mouse-focus: var(--spectrum-gray-700);

--spectrum-dial-min-max-tick-color: var(--spectrum-gray-600);

--spectrum-dial-handle-marker-color-key-focus: var(--spectrum-gray-25);
--spectrum-dial-border-color-key-focus: var(--spectrum-gray-25);

--spectrum-dial-label-text-color: var(--spectrum-gray-700);
--spectrum-dial-label-text-color-disabled: var(--spectrum-gray-700);
--spectrum-dial-handle-border-color-disabled: var(--spectrum-gray-400);

--spectrum-dial-container-width: 48px;

Expand Down
5 changes: 5 additions & 0 deletions components/pickerbutton/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,12 @@
"global": [
"--spectrum-animation-duration-100",
"--spectrum-body-sans-serif-font-weight",
"--spectrum-border-width-100",
"--spectrum-component-height-100",
"--spectrum-component-height-200",
"--spectrum-component-height-300",
"--spectrum-component-height-75",
"--spectrum-corner-radius-100",
"--spectrum-corner-radius-200",
"--spectrum-default-font-style",
"--spectrum-disabled-background-color",
Expand All @@ -123,6 +125,9 @@
"--spectrum-font-size-200",
"--spectrum-font-size-300",
"--spectrum-font-size-75",
"--spectrum-gray-100",
"--spectrum-gray-200",
"--spectrum-gray-50",
"--spectrum-in-field-button-edge-to-fill",
"--spectrum-neutral-content-color-default",
"--spectrum-neutral-content-color-down",
Expand Down
9 changes: 9 additions & 0 deletions components/pickerbutton/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,17 @@
--spectrum-picker-button-font-weight: var(--spectrum-body-sans-serif-font-weight);
--spectrum-picker-button-font-size: var(--spectrum-font-size-100);

--spectrum-picker-button-border-color: inherit;
--spectrum-picker-button-border-radius: var(--spectrum-corner-radius-100);
--spectrum-picker-button-border-radius-rounded-sided: 0;
--spectrum-picker-button-border-radius-sided: 0;
--spectrum-picker-button-border-width: var(--spectrum-border-width-100);
--spectrum-picker-button-border-radius-rounded: var(--spectrum-corner-radius-200);

--spectrum-picker-button-background-color: var(--spectrum-gray-50);
--spectrum-picker-button-background-color-hover: var(--spectrum-gray-100);
--spectrum-picker-button-background-color-down: var(--spectrum-gray-200);
--spectrum-picker-button-background-color-key-focus: var(--spectrum-gray-100);
--spectrum-picker-button-background-animation-duration: var(--spectrum-animation-duration-100);

&:hover {
Expand Down
8 changes: 4 additions & 4 deletions components/progressbar/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,14 @@
block-size: var(--mod-progressbar-thickness, var(--spectrum-progressbar-thickness));
border-radius: var(--spectrum-progressbar-corner-radius);

background-color: var(--highcontrast-progressbar-track-color, var(--mod-progressbar-track-color, var(--spectrum-progressbar-track-color)));
background: var(--highcontrast-progressbar-track-color, var(--mod-progressbar-track-color, var(--spectrum-progressbar-track-color)));
}

.spectrum-ProgressBar-fill {
border: none;
block-size: var(--mod-progressbar-thickness, var(--spectrum-progressbar-thickness));
transition: width 1s;
background-color: var(--highcontrast-progressbar-fill-color, var(--mod-progressbar-fill-color, var(--spectrum-progressbar-fill-color)));
background: var(--highcontrast-progressbar-fill-color, var(--mod-progressbar-fill-color, var(--spectrum-progressbar-fill-color)));
}
}

Expand Down Expand Up @@ -183,7 +183,7 @@
.spectrum-ProgressBar--staticWhite {
.spectrum-ProgressBar-fill {
color: var(--mod-progressbar-label-and-value-white, var(--spectrum-progressbar-label-and-value-white));
background-color: var(--highcontrast-progressbar-fill-color-white, var(--mod-progressbar-fill-color-white, var(--spectrum-progressbar-fill-color-white)));
background: var(--highcontrast-progressbar-fill-color-white, var(--mod-progressbar-fill-color-white, var(--spectrum-progressbar-fill-color-white)));
}

.spectrum-ProgressBar-label,
Expand All @@ -192,7 +192,7 @@
}

.spectrum-ProgressBar-track {
background-color: var(--spectrum-progressbar-track-color-white);
background: var(--spectrum-progressbar-track-color-white);
}
}

Expand Down
3 changes: 3 additions & 0 deletions components/radio/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@
"--spectrum-font-size-300",
"--spectrum-font-size-75",
"--spectrum-gray-50",
"--spectrum-gray-600",
"--spectrum-gray-700",
"--spectrum-gray-800",
"--spectrum-line-height-100",
"--spectrum-neutral-background-color-selected-default",
"--spectrum-neutral-background-color-selected-down",
Expand Down
6 changes: 6 additions & 0 deletions components/radio/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
--spectrum-radio-emphasized-accent-color-down: var(--spectrum-accent-color-1100);
--spectrum-radio-emphasized-accent-color-focus: var(--spectrum-accent-color-1000);

/* unchecked selection indicator */
--spectrum-radio-button-border-color-default: var(--spectrum-gray-600);
--spectrum-radio-button-border-color-hover: var(--spectrum-gray-700);
--spectrum-radio-button-border-color-down: var(--spectrum-gray-800);
--spectrum-radio-button-border-color-focus: var(--spectrum-gray-700);

/* checked selection indicator */
--spectrum-radio-button-checked-border-color-default: var(--spectrum-neutral-background-color-selected-default);
--spectrum-radio-button-checked-border-color-hover: var(--spectrum-neutral-background-color-selected-hover);
Expand Down
7 changes: 7 additions & 0 deletions components/stepper/dist/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
],
"global": [
"--spectrum-animation-duration-100",
"--spectrum-border-width-100",
"--spectrum-component-height-100",
"--spectrum-component-height-200",
"--spectrum-component-height-300",
Expand All @@ -120,6 +121,12 @@
"--spectrum-focus-indicator-color",
"--spectrum-focus-indicator-gap",
"--spectrum-focus-indicator-thickness",
"--spectrum-gray-25",
"--spectrum-gray-50",
"--spectrum-gray-500",
"--spectrum-gray-600",
"--spectrum-gray-800",
"--spectrum-gray-900",
"--spectrum-in-field-button-width-stacked-extra-large",
"--spectrum-in-field-button-width-stacked-large",
"--spectrum-in-field-button-width-stacked-medium",
Expand Down
145 changes: 87 additions & 58 deletions components/stepper/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,14 @@
* governing permissions and limitations under the License.
*/

/* --- High contrast settings --- */
@media (forced-colors: active) {
.spectrum-Stepper {
--highcontrast-stepper-border-color: CanvasText;
--highcontrast-stepper-border-color-hover: Highlight;
--highcontrast-stepper-border-color-focus: Highlight;
--highcontrast-stepper-border-color-focus-hover: Highlight;
--highcontrast-stepper-border-color-keyboard-focus: CanvasText;
--highcontrast-stepper-focus-indicator-color: Highlight;

&.is-invalid {
--highcontrast-stepper-border-color: Highlight;
--highcontrast-stepper-border-color-hover: Highlight;
--highcontrast-stepper-border-color-focus: Highlight;
--highcontrast-stepper-border-color-focus-hover: Highlight;
--highcontrast-stepper-border-color-keyboard-focus: Highlight;
}

&.is-disabled {
--highcontrast-stepper-border-color: GrayText;
--highcontrast-stepper-buttons-border-width: var(--mod-stepper-border-width, var(--spectrum-stepper-border-width));
}

&:not(.is-disabled) {
&:hover {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-hover);
}

&.is-focused,
&:focus {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-focus);

&:hover {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-focus-hover);
}
}

&.is-keyboardFocused,
&:focus-visible {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-keyboard-focus);
}
}
}

/* @passthrough start */
.spectrum-Stepper-input {
--highcontrast-textfield-border-color: var(--highcontrast-stepper-border-color);
}
/* @passthrough end */

/* @passthrough start */
.spectrum-Stepper-button {
--highcontrast-infield-button-border-color: var(--highcontrast-stepper-border-color);
--highcontrast-infield-button-border-color-active: var(--highcontrast-stepper-border-color);
}
/* @passthrough end */
}

/* --- Component-level definitions --- */
.spectrum-Stepper {
--spectrum-stepper-border-width: var(--spectrum-border-width-100);
--spectrum-stepper-border-color-default: var(--spectrum-gray-500);
--spectrum-stepper-border-color-hover: var(--spectrum-gray-600);
--spectrum-stepper-border-color-focus: var(--spectrum-gray-800);
--spectrum-stepper-border-color-focus-hover: var(--spectrum-gray-800);
--spectrum-stepper-border-color-keyboard-focus: var(--spectrum-gray-900);
--spectrum-stepper-border-color: var(--highcontrast-stepper-border-color, var(--mod-stepper-border-color, var(--spectrum-stepper-border-color-default)));
--spectrum-stepper-border-radius: var(--mod-stepper-border-radius, var(--spectrum-corner-radius-100));

Expand All @@ -83,6 +31,26 @@
--spectrum-stepper-button-width: var(--mod-stepper-button-width, var(--spectrum-in-field-button-width-stacked-medium));
--spectrum-stepper-height: var(--mod-stepper-height, var(--spectrum-component-height-100));

--spectrum-stepper-buttons-border-style: none;
--spectrum-stepper-buttons-border-width: 0;
--spectrum-stepper-buttons-border-color: var(--spectrum-gray-500);
--spectrum-stepper-buttons-background-color: var(--spectrum-gray-25);
--spectrum-stepper-buttons-border-color-hover: var(--spectrum-gray-600);
--spectrum-stepper-buttons-border-color-focus: var(--spectrum-gray-800);
--spectrum-stepper-buttons-border-color-keyboard-focus: var(--spectrum-gray-900);

--spectrum-stepper-button-border-width: var(--spectrum-border-width-100);

/** Invalid **/
--spectrum-stepper-border-color-invalid: var(--spectrum-negative-border-color-default);
--spectrum-stepper-border-color-focus-invalid: var(--spectrum-negative-border-color-focus);
--spectrum-stepper-border-color-focus-hover-invalid: var(--spectrum-negative-border-color-focus-hover);
--spectrum-stepper-border-color-keyboard-focus-invalid: var(--spectrum-negative-border-color-key-focus);

/** Disabled **/
--spectrum-stepper-button-border-width-disabled: var(--spectrum-border-width-100);
--spectrum-stepper-buttons-background-color-disabled: var(--spectrum-gray-50);

&.spectrum-Stepper--sizeS {
--spectrum-stepper-button-width: var(--mod-stepper-button-width, var(--spectrum-in-field-button-width-stacked-small));
--spectrum-stepper-height: var(--mod-stepper-height, var(--spectrum-component-height-75));
Expand Down Expand Up @@ -131,6 +99,9 @@
}

&.spectrum-Stepper--quiet {
/* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used by --mod-infield-button-inner-edge-to-fill and --mod-infield-button-edge-to-fill */
--spectrum-stepper-button-edge-to-fill: 0;

--mod-stepper-buttons-background-color: transparent;

/* quiet hover */
Expand All @@ -151,6 +122,64 @@
}
}

/* --- High contrast settings --- */
@media (forced-colors: active) {
.spectrum-Stepper {
--highcontrast-stepper-border-color: CanvasText;
--highcontrast-stepper-border-color-hover: Highlight;
--highcontrast-stepper-border-color-focus: Highlight;
--highcontrast-stepper-border-color-focus-hover: Highlight;
--highcontrast-stepper-border-color-keyboard-focus: CanvasText;
--highcontrast-stepper-focus-indicator-color: Highlight;

&.is-invalid {
--highcontrast-stepper-border-color: Highlight;
--highcontrast-stepper-border-color-hover: Highlight;
--highcontrast-stepper-border-color-focus: Highlight;
--highcontrast-stepper-border-color-focus-hover: Highlight;
--highcontrast-stepper-border-color-keyboard-focus: Highlight;
}

&.is-disabled {
--highcontrast-stepper-border-color: GrayText;
--highcontrast-stepper-buttons-border-width: var(--mod-stepper-border-width, var(--spectrum-stepper-border-width));
}

&:not(.is-disabled) {
&:hover {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-hover);
}

&.is-focused,
&:focus {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-focus);

&:hover {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-focus-hover);
}
}

&.is-keyboardFocused,
&:focus-visible {
--highcontrast-stepper-border-color: var(--highcontrast-stepper-border-color-keyboard-focus);
}
}
}

/* @passthrough start */
.spectrum-Stepper-input {
--highcontrast-textfield-border-color: var(--highcontrast-stepper-border-color);
}
/* @passthrough end */

/* @passthrough start */
.spectrum-Stepper-button {
--highcontrast-infield-button-border-color: var(--highcontrast-stepper-border-color);
--highcontrast-infield-button-border-color-active: var(--highcontrast-stepper-border-color);
}
/* @passthrough end */
}

/* --- Component-level passthroughs for nested components --- */
/* @passthrough start -- MODS for sub components */
.spectrum-Stepper {
Expand Down

0 comments on commit 46ae687

Please sign in to comment.