-
Notifications
You must be signed in to change notification settings - Fork 195
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
fix(menu)!: reimplement text truncating #2299
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
64da469
fix(menu): truncating class
jenndiaz 08ea8a9
docs(menu): add truncating example
jenndiaz 3c8a6d8
docs(menu): improve docs
jenndiaz 0bd1d56
feat(menu): add truncate example to storybook
jenndiaz c616688
refactor(menu): remove flex from itemLabel
jenndiaz c2c4e75
feat(menu): wip adds truncating to all stories
jenndiaz 2bdbabe
refactor(menu): removes uneeded code
jenndiaz 60c5a55
refactor(menu): removes hard coded ellipsis
jenndiaz b5ffb7e
docs(menu): improve description
jenndiaz 2032a05
chore(menu): story indenting
jenndiaz 3ca9993
docs(menu): improve storybook max-width
jenndiaz 01783ff
refactor(menu): improves story
jenndiaz 0c78f45
docs(menu): adds to migration guide
jenndiaz 6fdaf71
fix(menu): post rebase issues
jenndiaz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ governing permissions and limitations under the License. | |
--spectrum-menu-item-icon-width: var(--spectrum-workflow-icon-size-100); | ||
--spectrum-menu-item-label-font-size: var(--spectrum-font-size-100); | ||
--spectrum-menu-item-label-text-to-visual: var(--spectrum-text-to-visual-100); | ||
|
||
--spectrum-menu-item-label-inline-edge-to-content: var(--spectrum-component-edge-to-text-100); | ||
--spectrum-menu-item-top-edge-to-text: var(--spectrum-component-top-to-text-100); | ||
--spectrum-menu-item-bottom-edge-to-text: var(--spectrum-component-bottom-to-text-100); | ||
|
@@ -71,7 +71,7 @@ governing permissions and limitations under the License. | |
--spectrum-menu-section-header-font-weight: var(--spectrum-bold-font-weight); | ||
--spectrum-menu-section-header-color: var(--spectrum-gray-900); | ||
--spectrum-menu-collapsible-icon-color: var(--spectrum-gray-900); | ||
|
||
--spectrum-menu-checkmark-icon-color-default: var(--spectrum-accent-color-900); | ||
--spectrum-menu-checkmark-icon-color-hover: var(--spectrum-accent-color-1000); | ||
--spectrum-menu-checkmark-icon-color-down: var(--spectrum-accent-color-1100); | ||
|
@@ -120,7 +120,7 @@ governing permissions and limitations under the License. | |
--spectrum-menu-item-icon-width: var(--spectrum-workflow-icon-size-75); | ||
--spectrum-menu-item-label-font-size: var(--spectrum-font-size-75); | ||
--spectrum-menu-item-label-text-to-visual: var(--spectrum-text-to-visual-75); | ||
|
||
--spectrum-menu-item-label-inline-edge-to-content: var(--spectrum-component-edge-to-text-75); | ||
--spectrum-menu-item-top-edge-to-text: var(--spectrum-component-top-to-text-75); | ||
--spectrum-menu-item-bottom-edge-to-text: var(--spectrum-component-bottom-to-text-75); | ||
|
@@ -147,7 +147,7 @@ governing permissions and limitations under the License. | |
--spectrum-menu-item-icon-width: var(--spectrum-workflow-icon-size-200); | ||
--spectrum-menu-item-label-font-size: var(--spectrum-font-size-200); | ||
--spectrum-menu-item-label-text-to-visual: var(--spectrum-text-to-visual-200); | ||
|
||
--spectrum-menu-item-label-inline-edge-to-content: var(--spectrum-component-edge-to-text-200); | ||
--spectrum-menu-item-top-edge-to-text: var(--spectrum-component-top-to-text-200); | ||
--spectrum-menu-item-bottom-edge-to-text: var(--spectrum-component-bottom-to-text-200); | ||
|
@@ -174,7 +174,7 @@ governing permissions and limitations under the License. | |
--spectrum-menu-item-icon-width: var(--spectrum-workflow-icon-size-300); | ||
--spectrum-menu-item-label-font-size: var(--spectrum-font-size-300); | ||
--spectrum-menu-item-label-text-to-visual: var(--spectrum-text-to-visual-300); | ||
|
||
--spectrum-menu-item-label-inline-edge-to-content: var(--spectrum-component-edge-to-text-300); | ||
--spectrum-menu-item-top-edge-to-text: var(--spectrum-component-top-to-text-300); | ||
--spectrum-menu-item-bottom-edge-to-text: var(--spectrum-component-bottom-to-text-300); | ||
|
@@ -227,7 +227,7 @@ governing permissions and limitations under the License. | |
--highcontrast-checkbox-highlight-color-hover: ButtonText; | ||
--highcontrast-checkbox-highlight-color-default: ButtonText; | ||
} | ||
|
||
.spectrum-Menu-itemSwitch { | ||
--highcontrast-switch-handle-border-color-hover: ButtonText; | ||
--highcontrast-switch-handle-border-color-selected-default: ButtonText; | ||
|
@@ -281,7 +281,7 @@ governing permissions and limitations under the License. | |
.spectrum-Menu-divider { | ||
--spectrum-menu-divider-thickness: var(--spectrum-divider-thickness-medium); | ||
&.spectrum-Divider--sizeS { | ||
--spectrum-menu-divider-thickness: var(--spectrum-divider-thickness-small); | ||
--spectrum-menu-divider-thickness: var(--spectrum-divider-thickness-small); | ||
} | ||
|
||
overflow: visible; | ||
|
@@ -339,14 +339,14 @@ governing permissions and limitations under the License. | |
box-sizing: border-box; | ||
|
||
background-color: var(--highcontrast-menu-item-background-color-default, var(--mod-menu-item-background-color-default, var(--spectrum-menu-item-background-color-default))); | ||
|
||
line-height: var(--mod-menu-item-label-line-height, var(--spectrum-menu-item-label-line-height)); | ||
|
||
min-block-size: var(--mod-menu-item-min-height, var(--spectrum-menu-item-min-height)); | ||
padding-block-start: var(--mod-menu-item-top-edge-to-text, var(--spectrum-menu-item-top-edge-to-text)); | ||
padding-block-end: var(--mod-menu-item-bottom-edge-to-text, var(--spectrum-menu-item-bottom-edge-to-text)); | ||
padding-inline: var(--mod-menu-item-label-inline-edge-to-content, var(--spectrum-menu-item-label-inline-edge-to-content)); | ||
|
||
margin: 0; | ||
text-decoration: none; | ||
|
||
|
@@ -365,7 +365,7 @@ governing permissions and limitations under the License. | |
|
||
.spectrum-Menu-itemSwitch { | ||
min-block-size: 0; | ||
|
||
.spectrum-Switch-switch { | ||
margin-block-start: var(--mod-menu-item-top-to-action, var(--spectrum-menu-item-top-to-action));; | ||
margin-block-end: 0; | ||
|
@@ -377,11 +377,11 @@ governing permissions and limitations under the License. | |
display: grid; | ||
/* stylelint-disable declaration-block-no-redundant-longhand-properties */ | ||
grid-template-areas: | ||
". chevronAreaCollapsible . iconArea sectionHeadingArea . . . " | ||
". chevronAreaCollapsible . headingIconArea sectionHeadingArea . . . " | ||
"selectedArea chevronAreaCollapsible checkmarkArea iconArea labelArea valueArea actionsArea chevronAreaDrillIn" | ||
". . . . descriptionArea . . . " | ||
". . . . submenuArea . . . "; | ||
|
||
grid-template-columns: auto auto auto auto 1fr auto auto auto; | ||
grid-template-rows: 1fr auto; | ||
} | ||
|
@@ -422,7 +422,7 @@ governing permissions and limitations under the License. | |
> .spectrum-Menu-itemValue { | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-value-color-focus, var(--spectrum-menu-item-value-color-focus))); | ||
} | ||
|
||
> .spectrum-Menu-itemIcon:not(.spectrum-Menu-chevron, .spectrum-Menu-checkmark) { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-focus, var(--spectrum-menu-item-label-icon-color-focus))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-focus, var(--spectrum-menu-item-label-icon-color-focus))); | ||
|
@@ -469,7 +469,7 @@ governing permissions and limitations under the License. | |
> .spectrum-Menu-itemValue { | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-value-color-hover, var(--spectrum-menu-item-value-color-hover))); | ||
} | ||
|
||
> .spectrum-Menu-itemIcon:not(.spectrum-Menu-chevron, .spectrum-Menu-checkmark) { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-hover, var(--spectrum-menu-item-label-icon-color-hover))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-hover, var(--spectrum-menu-item-label-icon-color-hover))); | ||
|
@@ -492,7 +492,7 @@ governing permissions and limitations under the License. | |
> .spectrum-Menu-itemLabel { | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-content-color-down, var(--spectrum-menu-item-label-content-color-down))); | ||
} | ||
|
||
> .spectrum-Menu-sectionHeading { | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-section-header-color, var(--spectrum-menu-section-header-color))); | ||
} | ||
|
@@ -504,7 +504,7 @@ governing permissions and limitations under the License. | |
> .spectrum-Menu-itemValue { | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-value-color-down, var(--spectrum-menu-item-value-color-down))); | ||
} | ||
|
||
> .spectrum-Menu-itemIcon:not(.spectrum-Menu-chevron, .spectrum-Menu-checkmark) { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-down, var(--spectrum-menu-item-label-icon-color-down))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-item-label-icon-color-down, var(--spectrum-menu-item-label-icon-color-down))); | ||
|
@@ -526,6 +526,17 @@ governing permissions and limitations under the License. | |
align-self: start; | ||
} | ||
|
||
.spectrum-Menu-item--collapsible .spectrum-Menu-itemIcon { | ||
grid-area: headingIconArea; | ||
} | ||
|
||
.is-selectableMultiple .spectrum-Menu-item { | ||
align-items: start; | ||
} | ||
.is-selectableMultiple .spectrum-Menu-itemCheckbox { | ||
grid-area: iconArea; | ||
} | ||
|
||
.spectrum-Menu-checkmark { | ||
grid-area: checkmarkArea; | ||
align-self: start; | ||
|
@@ -537,8 +548,6 @@ governing permissions and limitations under the License. | |
|
||
.spectrum-Menu-itemLabel { | ||
grid-area: labelArea; | ||
display: flex; | ||
align-items: flex-start; | ||
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. Flex was causing |
||
font-size: var(--mod-menu-item-label-font-size, var(--spectrum-menu-item-label-font-size)); | ||
color: var(--highcontrast-menu-item-color-default, var(--mod-menu-item-label-content-color-default, var(--spectrum-menu-item-label-content-color-default))); | ||
} | ||
|
@@ -640,7 +649,7 @@ governing permissions and limitations under the License. | |
margin-inline-start: var(--mod-menu-item-label-to-value-area-min-spacing, var(--spectrum-menu-item-label-to-value-area-min-spacing)); | ||
} | ||
|
||
.spectrum-Menu-itemLabel--wrapping { | ||
.spectrum-Menu-itemLabel--truncate { | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
|
@@ -694,11 +703,11 @@ governing permissions and limitations under the License. | |
} | ||
|
||
[dir="rtl"] .spectrum-Menu-chevron { | ||
transform: rotate(-180deg); | ||
transform: rotate(-180deg); | ||
} | ||
|
||
/* | ||
assume that if an item is collapsible, it will | ||
assume that if an item is collapsible, it will | ||
have a chevron and we need to adjust position of submenu items to account for that | ||
*/ | ||
.spectrum-Menu-item--collapsible .spectrum-Menu { | ||
|
@@ -745,22 +754,22 @@ governing permissions and limitations under the License. | |
.spectrum-Menu-chevron { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-hover, var(--spectrum-menu-drillin-icon-color-hover))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-hover, var(--spectrum-menu-drillin-icon-color-hover))); | ||
} | ||
} | ||
} | ||
|
||
&:focus, | ||
&.is-focused { | ||
.spectrum-Menu-chevron { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-focus, var(--spectrum-menu-drillin-icon-color-focus))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-focus, var(--spectrum-menu-drillin-icon-color-focus))); | ||
} | ||
} | ||
} | ||
|
||
&:active { | ||
.spectrum-Menu-chevron { | ||
fill: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-down, var(--spectrum-menu-drillin-icon-color-down))); | ||
color: var(--highcontrast-menu-item-color-focus, var(--mod-menu-drillin-icon-color-down, var(--spectrum-menu-drillin-icon-color-down))); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
@@ -773,11 +782,11 @@ governing permissions and limitations under the License. | |
.spectrum-Menu-sectionHeading { | ||
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-content-color-disabled, var(--spectrum-menu-item-label-content-color-disabled))); | ||
} | ||
|
||
.spectrum-Menu-itemDescription { | ||
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-description-color-disabled, var(--spectrum-menu-item-description-color-disabled))); | ||
} | ||
|
||
.spectrum-Menu-itemIcon { | ||
fill: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled))); | ||
color: var(--highcontrast-menu-item-color-disabled, var(--mod-menu-item-label-icon-color-disabled, var(--spectrum-menu-item-label-icon-color-disabled))); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this previously had two
iconAreas
which causes some issues with menu item icons and labels not being on the correct row with in the grid.