-
Notifications
You must be signed in to change notification settings - Fork 210
feat(search): s2 migration #2673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@spectrum-css/tokens": patch | ||
| --- | ||
|
|
||
| Adds `--spectrum-corner-radius-1000: 9999px;` to global-vars.css to override value of 0.5. This should ensure our components that use this custom property are properly rounded (i.e. the fully rounded swatch or search field) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| --- | ||
| "@spectrum-css/search": major | ||
| --- | ||
|
|
||
| #### Search S2 migration | ||
|
|
||
| Search now uses Spectrum 2 tokens and specifications. The following items have been adjusted: | ||
|
|
||
| - Quiet variant has been deprecated and code removed (including removal of the custom property `--mod-search-quiet-button-offset`). | ||
| - Updates to colors, corner rounding, and spacing. | ||
| - Custom property mod adjustments: | ||
| - Added `--mod-search-top-to-icon`. | ||
| - Removed `--mod-workflow-icon-size-100`. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| /*! | ||
| * Copyright 2024 Adobe. All rights reserved. | ||
| * Copyright 2025 Adobe. All rights reserved. | ||
| * | ||
| * This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. You may obtain a copy | ||
|
|
@@ -12,7 +12,17 @@ | |
| */ | ||
|
|
||
| .spectrum-Search { | ||
| /* Background / Border */ | ||
| /* stylelint-disable spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-background-color: var(--spectrum-gray-25); | ||
| --spectrum-search-border-color-default: var(--spectrum-gray-300); | ||
| --spectrum-search-border-color-hover: var(--spectrum-gray-400); | ||
| --spectrum-search-border-color-focus: var(--spectrum-gray-800); | ||
| --spectrum-search-border-color-focus-hover: var(--spectrum-gray-900); | ||
| --spectrum-search-border-color-key-focus: var(--spectrum-gray-800); | ||
| --spectrum-search-border-width: var(--spectrum-border-width-200); | ||
| --spectrum-search-border-radius: var(--spectrum-corner-radius-full); | ||
| /* stylelint-enable spectrum-tools/no-unused-custom-properties */ | ||
|
|
||
| /* Size / Spacing */ | ||
| --spectrum-search-inline-size: var(--spectrum-field-width); | ||
|
|
@@ -25,41 +35,47 @@ | |
| --spectrum-search-to-help-text: var(--spectrum-help-text-to-component); | ||
| --spectrum-search-top-to-text: var(--spectrum-component-top-to-text-100); | ||
| --spectrum-search-bottom-to-text: var(--spectrum-component-bottom-to-text-100); | ||
| --spectrum-search-border-radius: var(--spectrum-corner-radius-100); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-edge-to-visual-100); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-pill-edge-to-visual-100); | ||
| --spectrum-search-top-to-icon: var(--spectrum-component-top-to-workflow-icon-100); | ||
|
|
||
| /* Focus Indicator */ | ||
| /* stylelint-disable spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-focus-indicator-thickness: var(--spectrum-focus-indicator-thickness); | ||
| --spectrum-search-focus-indicator-gap: var(--spectrum-focus-indicator-gap); | ||
| --spectrum-search-focus-indicator-color: var(--spectrum-focus-indicator-color); | ||
| /* stylelint-enable spectrum-tools/no-unused-custom-properties */ | ||
|
|
||
| /* Font / Color */ | ||
| /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-font-family: var(--spectrum-sans-font-family-stack); | ||
| /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-font-weight: var(--spectrum-regular-font-weight); | ||
| --spectrum-search-font-style: var(--spectrum-default-font-style); | ||
| --spectrum-search-line-height: var(--spectrum-line-height-100); | ||
|
|
||
| --spectrum-search-color-default: var(--spectrum-neutral-content-color-default); | ||
| --spectrum-search-color-hover: var(--spectrum-neutral-content-color-hover); | ||
| --spectrum-search-color-focus: var(--spectrum-neutral-content-color-focus); | ||
| --spectrum-search-color-focus-hover: var(--spectrum-neutral-content-color-focus-hover); | ||
| --spectrum-search-color-key-focus: var(--spectrum-neutral-content-color-key-focus); | ||
|
|
||
| --spectrum-search-border-color-default: var(--spectrum-gray-500); | ||
| --spectrum-search-border-color-hover: var(--spectrum-gray-600); | ||
| --spectrum-search-border-color-focus: var(--spectrum-gray-800); | ||
| --spectrum-search-border-color-focus-hover: var(--spectrum-gray-900); | ||
| --spectrum-search-border-color-key-focus: var(--spectrum-gray-900); | ||
|
|
||
| /* Background and Border */ | ||
| --spectrum-search-border-width: var(--spectrum-border-width-100); | ||
|
|
||
| /* Disabled */ | ||
| --spectrum-search-color-disabled: var(--spectrum-disabled-content-color); | ||
|
|
||
| /* @passthrough start -- settings for nested Textfield component */ | ||
| /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-background-color-disabled: var(--spectrum-gray-25); | ||
| /* stylelint-disable-next-line spectrum-tools/no-unused-custom-properties -- used to assign Textfield mods */ | ||
| --spectrum-search-border-color-disabled: var(--spectrum-disabled-border-color); | ||
|
|
||
| &:lang(ja), | ||
| &:lang(zh), | ||
| &:lang(ko) { | ||
| --spectrum-search-line-height: var(--spectrum-cjk-line-height-100); | ||
|
rise-erpelding marked this conversation as resolved.
|
||
| } | ||
|
|
||
| /* /* @passthrough start: nested Textfield component. */ | ||
| --mod-textfield-font-family: var(--mod-search-font-family, var(--spectrum-search-font-family)); | ||
| --mod-textfield-font-weight: var(--mod-search-font-weight, var(--spectrum-search-font-weight)); | ||
| --mod-textfield-placeholder-font-size: var(--spectrum-font-size-100); | ||
|
|
||
| --mod-textfield-corner-radius: var(--mod-search-border-radius, var(--spectrum-search-border-radius)); | ||
| --mod-textfield-border-width: var(--mod-search-border-width, var(--spectrum-search-border-width)); | ||
|
|
@@ -85,53 +101,53 @@ | |
| --mod-textfield-background-color: var(--mod-search-background-color, var(--spectrum-search-background-color)); | ||
| --mod-textfield-background-color-disabled: var(--mod-search-background-color-disabled, var(--spectrum-search-background-color-disabled)); | ||
| /* @passthrough end */ | ||
|
|
||
| display: inline-block; | ||
| position: relative; | ||
| inline-size: var(--mod-search-inline-size, var(--spectrum-search-inline-size)); | ||
| min-inline-size: var(--mod-search-min-inline-size, var(--spectrum-search-min-inline-size)); | ||
|
|
||
| .spectrum-HelpText { | ||
| margin-block-start: var(--mod-search-to-help-text, var(--spectrum-search-to-help-text)); | ||
| } | ||
| } | ||
|
|
||
| .spectrum-Search--sizeS { | ||
| --spectrum-search-block-size: var(--spectrum-component-height-75); | ||
| --spectrum-search-icon-size: var(--spectrum-workflow-icon-size-75); | ||
| --spectrum-search-text-to-icon: var(--spectrum-text-to-visual-75); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-edge-to-visual-75); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-pill-edge-to-visual-75); | ||
| --spectrum-search-top-to-icon: var(--spectrum-component-top-to-workflow-icon-75); | ||
| --spectrum-search-top-to-text: var(--spectrum-component-top-to-text-75); | ||
| --spectrum-search-bottom-to-text: var(--spectrum-component-bottom-to-text-75); | ||
|
|
||
| --mod-textfield-placeholder-font-size: var(--spectrum-font-size-75); | ||
| } | ||
|
|
||
| .spectrum-Search--sizeL { | ||
| --spectrum-search-block-size: var(--spectrum-component-height-200); | ||
| --spectrum-search-icon-size: var(--spectrum-workflow-icon-size-200); | ||
| --spectrum-search-text-to-icon: var(--spectrum-text-to-visual-200); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-edge-to-visual-200); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-pill-edge-to-visual-200); | ||
| --spectrum-search-top-to-icon: var(--spectrum-component-top-to-workflow-icon-200); | ||
| --spectrum-search-top-to-text: var(--spectrum-component-top-to-text-200); | ||
| --spectrum-search-bottom-to-text: var(--spectrum-component-bottom-to-text-200); | ||
|
|
||
| --mod-textfield-placeholder-font-size: var(--spectrum-font-size-200); | ||
| } | ||
|
|
||
| .spectrum-Search--sizeXL { | ||
| --spectrum-search-block-size: var(--spectrum-component-height-300); | ||
| --spectrum-search-icon-size: var(--spectrum-workflow-icon-size-300); | ||
| --spectrum-search-text-to-icon: var(--spectrum-text-to-visual-300); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-edge-to-visual-300); | ||
| --spectrum-search-edge-to-visual: var(--spectrum-component-pill-edge-to-visual-300); | ||
| --spectrum-search-top-to-icon: var(--spectrum-component-top-to-workflow-icon-300); | ||
| --spectrum-search-top-to-text: var(--spectrum-component-top-to-text-300); | ||
| --spectrum-search-bottom-to-text: var(--spectrum-component-bottom-to-text-300); | ||
|
|
||
| --mod-textfield-placeholder-font-size: var(--spectrum-font-size-300); | ||
| } | ||
|
|
||
| @media (forced-colors: active) { | ||
| .spectrum-Search .spectrum-Search-textfield, | ||
| .spectrum-Search .spectrum-Search-textfield .spectrum-Search-input { | ||
| --highcontrast-search-color-default: CanvasText; | ||
| --highcontrast-search-color-hover: CanvasText; | ||
| --highcontrast-search-color-focus: CanvasText; | ||
| --highcontrast-search-color-disabled: GrayText; | ||
| } | ||
| /* Standard / Default */ | ||
| .spectrum-Search { | ||
| display: inline-block; | ||
| position: relative; | ||
| inline-size: var(--mod-search-inline-size, var(--spectrum-search-inline-size)); | ||
| min-inline-size: var(--mod-search-min-inline-size, var(--spectrum-search-min-inline-size)); | ||
|
rise-erpelding marked this conversation as resolved.
|
||
|
|
||
| .spectrum-Search .spectrum-Search-clearButton { | ||
| .spectrum-ClearButton-fill { | ||
| /* Avoid button background color overlapping on border. */ | ||
| forced-color-adjust: none; | ||
| background-color: transparent; | ||
| } | ||
| .spectrum-HelpText { | ||
| margin-block-start: var(--mod-search-to-help-text, var(--spectrum-search-to-help-text)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -160,7 +176,8 @@ | |
| display: block; | ||
| position: absolute; | ||
| inset-block: 0; | ||
| margin-block: auto; | ||
| inset-inline-start: var(--mod-search-edge-to-visual, var(--spectrum-search-edge-to-visual)); | ||
| margin-block-start: var(--mod-search-top-to-icon, var(--spectrum-search-top-to-icon)); | ||
| color: var(--spectrum-search-color); | ||
|
|
||
| .spectrum-Search-textfield:hover & { | ||
|
|
@@ -193,6 +210,8 @@ | |
| block-size: var(--mod-search-block-size, var(--spectrum-search-block-size)); | ||
| padding-block-start: calc(var(--mod-search-top-to-text, var(--spectrum-search-top-to-text)) - var(--mod-search-border-width, var(--spectrum-search-border-width))); | ||
| padding-block-end: calc(var(--mod-search-bottom-to-text, var(--spectrum-search-bottom-to-text)) - var(--mod-search-border-width, var(--spectrum-search-border-width))); | ||
| padding-inline-start: calc(var(--mod-search-edge-to-visual, var(--spectrum-search-edge-to-visual)) - var(--mod-search-border-width, var(--spectrum-search-border-width)) + var(--mod-search-icon-size, var(--spectrum-search-icon-size)) + var(--mod-search-text-to-icon, var(--spectrum-search-text-to-icon))); | ||
| padding-inline-end: calc(var(--mod-search-button-inline-size, var(--spectrum-search-button-inline-size)) - var(--mod-search-border-width, var(--spectrum-search-border-width))); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this the piece of padding between the text input and the edge? I noticed we're not using But also the clear button isn't really spec'd inside of search at all, which feels odd to me, is there a reason for that, that you know of?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes- the The I don't know why the clear button isn't spec'd, but I can certainly reach out to design and ask. All I can infer from the designs is that the clear button is all the way at the end of the search container. That's how the component seems to be styled currently as well. |
||
|
|
||
| font-style: var(--mod-search-font-style, var(--spectrum-search-font-style)); | ||
| line-height: var(--mod-search-line-height, var(--spectrum-search-line-height)); | ||
|
|
@@ -204,32 +223,20 @@ | |
| } | ||
| } | ||
|
|
||
| /* Standard / Default Only */ | ||
| .spectrum-Search:not(.spectrum-Search--quiet) { | ||
| .spectrum-Search-icon { | ||
| inset-inline-start: var(--mod-search-edge-to-visual, var(--spectrum-search-edge-to-visual)); | ||
| } | ||
|
|
||
| .spectrum-Search-input { | ||
| padding-inline-start: calc(var(--mod-search-edge-to-visual, var(--spectrum-search-edge-to-visual)) - var(--mod-search-border-width, var(--spectrum-search-border-width)) + var(--mod-search-icon-size, var(--spectrum-search-icon-size)) + var(--mod-search-text-to-icon, var(--spectrum-search-text-to-icon))); | ||
| padding-inline-end: var(--mod-search-button-inline-size, var(--spectrum-search-button-inline-size)); | ||
| @media (forced-colors: active) { | ||
| .spectrum-Search .spectrum-Search-textfield, | ||
| .spectrum-Search .spectrum-Search-textfield .spectrum-Search-input { | ||
| --highcontrast-search-color-default: CanvasText; | ||
| --highcontrast-search-color-hover: CanvasText; | ||
| --highcontrast-search-color-focus: CanvasText; | ||
| --highcontrast-search-color-disabled: GrayText; | ||
|
Comment on lines
+227
to
+232
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what I'm seeing for the forced-colors emulator in Chrome, which might not be as accurate as the WHCM emulator: Looks like we probably want the text color to be white and not green looking at the guidelines. But we might get this for free because textfield has the same colors and this PR needs a rebase to include those migration changes! I'll take a closer look and open up AssistivLabs on the next review!
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rise-erpelding I've updated this, but didn't see the same colors as your screenshot (neither in the Chrome forced-colors emulator, or in AssistivLabs).
I did notice that the focus+hover was black? I'd like your advice on how to approach that border color change, since the "simplest" fix was just to add the
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } | ||
| } | ||
|
|
||
| /* Quiet Variant */ | ||
| .spectrum-Search--quiet { | ||
| --spectrum-search-background-color: transparent; | ||
| --spectrum-search-background-color-disabled: transparent; | ||
| --spectrum-search-border-color-disabled: var(--spectrum-disabled-border-color); | ||
|
|
||
| /* Added specificity, otherwise they are overridden by system specific themes. */ | ||
| --mod-search-border-radius: 0; | ||
| --mod-search-edge-to-visual: var(--spectrum-field-edge-to-visual-quiet); | ||
|
|
||
| .spectrum-Search-input { | ||
| border-radius: var(--mod-search-border-radius, var(--spectrum-search-border-radius)); | ||
| padding-inline-start: calc(var(--mod-search-edge-to-visual, var(--spectrum-search-edge-to-visual)) + var(--mod-search-icon-size, var(--spectrum-search-icon-size)) + var(--mod-search-text-to-icon, var(--spectrum-search-text-to-icon))); | ||
| padding-inline-end: var(--mod-search-button-inline-size, var(--spectrum-search-button-inline-size)); | ||
| padding-block-start: var(--mod-search-top-to-text, var(--spectrum-search-top-to-text)); | ||
| .spectrum-Search .spectrum-Search-clearButton { | ||
| .spectrum-ClearButton-fill { | ||
| /* Avoid button background color overlapping on border. */ | ||
| forced-color-adjust: none; | ||
| background-color: transparent; | ||
| } | ||
| } | ||
| } | ||




Uh oh!
There was an error while loading. Please reload this page.