Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions src/__integ__/__snapshots__/themes.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ Object {
"color-text-dropdown-item-filter-match": "#0073bb",
"color-text-dropdown-item-highlighted": "#16191f",
"color-text-dropdown-item-secondary": "#687078",
"color-text-dropdown-item-secondary-hover": "#687078",
"color-text-empty": "#687078",
"color-text-expandable-section-default": "#545b64",
"color-text-expandable-section-hover": "#16191f",
Expand Down Expand Up @@ -922,6 +923,7 @@ Object {
"color-text-dropdown-item-filter-match": "#44b9d6",
"color-text-dropdown-item-highlighted": "#eaeded",
"color-text-dropdown-item-secondary": "#95a5a6",
"color-text-dropdown-item-secondary-hover": "colorGrey300",
"color-text-empty": "#d5dbdb",
"color-text-expandable-section-default": "#d5dbdb",
"color-text-expandable-section-hover": "#fafafa",
Expand Down Expand Up @@ -1503,6 +1505,7 @@ Object {
"color-text-dropdown-item-filter-match": "#0073bb",
"color-text-dropdown-item-highlighted": "#16191f",
"color-text-dropdown-item-secondary": "#687078",
"color-text-dropdown-item-secondary-hover": "#687078",
"color-text-empty": "#687078",
"color-text-expandable-section-default": "#545b64",
"color-text-expandable-section-hover": "#16191f",
Expand Down Expand Up @@ -2084,6 +2087,7 @@ Object {
"color-text-dropdown-item-filter-match": "#0073bb",
"color-text-dropdown-item-highlighted": "#16191f",
"color-text-dropdown-item-secondary": "#687078",
"color-text-dropdown-item-secondary-hover": "#687078",
"color-text-empty": "#687078",
"color-text-expandable-section-default": "#545b64",
"color-text-expandable-section-hover": "#16191f",
Expand Down Expand Up @@ -2665,6 +2669,7 @@ Object {
"color-text-dropdown-item-filter-match": "#0972d3",
"color-text-dropdown-item-highlighted": "#000716",
"color-text-dropdown-item-secondary": "#5f6b7a",
"color-text-dropdown-item-secondary-hover": "#5f6b7a",
"color-text-empty": "#5f6b7a",
"color-text-expandable-section-default": "#000716",
"color-text-expandable-section-hover": "#0972d3",
Expand Down Expand Up @@ -3246,6 +3251,7 @@ Object {
"color-text-dropdown-item-filter-match": "#89bdee",
"color-text-dropdown-item-highlighted": "#e9ebed",
"color-text-dropdown-item-secondary": "#8d99a8",
"color-text-dropdown-item-secondary-hover": "colorGrey300",
"color-text-empty": "#d1d5db",
"color-text-expandable-section-default": "#fbfbfb",
"color-text-expandable-section-hover": "#539fe5",
Expand Down Expand Up @@ -3827,6 +3833,7 @@ Object {
"color-text-dropdown-item-filter-match": "#89bdee",
"color-text-dropdown-item-highlighted": "#e9ebed",
"color-text-dropdown-item-secondary": "#8d99a8",
"color-text-dropdown-item-secondary-hover": "colorGrey300",
"color-text-empty": "#d1d5db",
"color-text-expandable-section-default": "#fbfbfb",
"color-text-expandable-section-hover": "#539fe5",
Expand Down
2 changes: 1 addition & 1 deletion src/autosuggest/autosuggest-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const AutosuggestOption = (

optionContent = (
<div {...a11yProperties}>
<OptionComponent option={option} highlightText={highlightText} />
<OptionComponent option={option} highlightedOption={highlighted} highlightText={highlightText} />
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/internal/components/option/constants.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
@use '../../styles/tokens' as awsui;

$tags-description-color: awsui.$color-text-dropdown-item-secondary;
$tags-description-color-hover: awsui.$color-text-dropdown-item-secondary-hover;
20 changes: 18 additions & 2 deletions src/internal/components/option/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ const Option = ({
highlightText,
triggerVariant = false,
isGroupOption = false,
highlightedOption = false,
selectedOption = false,
...restProps
}: OptionProps) => {
if (!option) {
Expand Down Expand Up @@ -76,10 +78,24 @@ const Option = ({
/>
<LabelTag labelTag={option.labelTag} highlightText={highlightText} triggerVariant={triggerVariant} />
</span>
<Description description={option.description} highlightText={highlightText} triggerVariant={triggerVariant} />
<Tags tags={option.tags} highlightText={highlightText} triggerVariant={triggerVariant} />
<Description
description={option.description}
highlightedOption={highlightedOption}
selectedOption={selectedOption}
highlightText={highlightText}
triggerVariant={triggerVariant}
/>
<Tags
tags={option.tags}
highlightedOption={highlightedOption}
selectedOption={selectedOption}
highlightText={highlightText}
triggerVariant={triggerVariant}
/>
<FilteringTags
filteringTags={option.filteringTags}
highlightedOption={highlightedOption}
selectedOption={selectedOption}
highlightText={highlightText}
triggerVariant={triggerVariant}
/>
Expand Down
2 changes: 2 additions & 0 deletions src/internal/components/option/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,7 @@ export interface OptionProps extends BaseComponentProps {
option?: InternalOptionDefinition;
triggerVariant?: boolean;
highlightText?: string;
highlightedOption?: boolean;
selectedOption?: boolean;
isGroupOption?: boolean;
}
54 changes: 41 additions & 13 deletions src/internal/components/option/option-parts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,30 +36,47 @@ export const LabelTag = ({ labelTag, highlightText, triggerVariant }: LabelTagPr

interface DescriptionProps {
description?: string;
highlightedOption: boolean;
highlightText?: string;
selectedOption: boolean;
triggerVariant: boolean;
}
export const Description = ({ description, highlightText, triggerVariant }: DescriptionProps) =>
export const Description = ({
description,
highlightedOption,
highlightText,
selectedOption,
triggerVariant,
}: DescriptionProps) =>
description ? (
// We do not reach AA compliance in Dark mode for highlighted state
// TODO: Remove aria-disabled={true} when we fix AWSUI-10333
<span className={clsx(styles.description, triggerVariant && styles['trigger-variant'])} aria-disabled={true}>
<span
className={clsx(styles.description, {
[styles['trigger-variant']]: triggerVariant,
[styles.highlighted]: highlightedOption,
[styles.selected]: selectedOption,
})}
>
<HighlightMatch str={description} highlightText={highlightText} />
</span>
) : null;

interface TagsProps {
tags?: ReadonlyArray<string>;
highlightedOption: boolean;
highlightText?: string;
selectedOption: boolean;
triggerVariant: boolean;
}
export const Tags = ({ tags, highlightText, triggerVariant }: TagsProps) =>
export const Tags = ({ tags, highlightedOption, highlightText, selectedOption, triggerVariant }: TagsProps) =>
tags ? (
<span className={clsx(styles.tags)}>
<span
className={clsx(styles.tags, {
[styles.highlighted]: highlightedOption,
[styles.selected]: selectedOption,
})}
>
{tags.map((tag, idx) => (
// We do not reach AA compliance in Dark mode for highlighted state
// TODO: Remove aria-disabled={true} when we fix AWSUI-10333
<span key={idx} className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])} aria-disabled={true}>
<span key={idx} className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}>
<HighlightMatch str={tag} highlightText={highlightText} />
</span>
))}
Expand All @@ -68,24 +85,35 @@ export const Tags = ({ tags, highlightText, triggerVariant }: TagsProps) =>

interface FilteringTagProps {
filteringTags?: ReadonlyArray<string>;
highlightedOption: boolean;
highlightText?: string;
selectedOption: boolean;
triggerVariant: boolean;
}
export const FilteringTags = ({ filteringTags, highlightText, triggerVariant }: FilteringTagProps) => {
export const FilteringTags = ({
filteringTags,
highlightedOption,
highlightText,
selectedOption,
triggerVariant,
}: FilteringTagProps) => {
if (!highlightText || !filteringTags) {
return null;
}

const searchElement = highlightText.toLowerCase();

return (
<span className={clsx(styles.tags)}>
<span
className={clsx(styles.tags, {
[styles.highlighted]: highlightedOption,
[styles.selected]: selectedOption,
})}
>
{filteringTags.map((filteringTag, key) => {
const match = filteringTag.toLowerCase().indexOf(searchElement) !== -1;
if (match) {
return (
// We do not reach AA compliance in Dark mode for highlighted state
// TODO: Remove aria-disabled={true} when we fix AWSUI-10333
<span
className={clsx(styles.tag, triggerVariant && styles['trigger-variant'])}
key={key}
Expand Down
8 changes: 8 additions & 0 deletions src/internal/components/option/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
@include styles.font-body-s;
color: constants.$tags-description-color;
flex-wrap: wrap;

&.highlighted {
color: constants.$tags-description-color-hover;
}

&.selected {
color: constants.$tags-description-color;
}
}

.tags {
Expand Down
7 changes: 6 additions & 1 deletion src/select/parts/item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,12 @@ const Item = (
{isParent ? (
wrappedOption.label || wrappedOption.value
) : (
<Option option={{ ...wrappedOption, disabled }} highlightText={filteringValue} />
<Option
option={{ ...wrappedOption, disabled }}
highlightedOption={highlighted}
selectedOption={selected}
highlightText={filteringValue}
/>
)}
{!hasCheckbox && !isParent && selected && (
<div className={styles['selected-icon']}>
Expand Down
8 changes: 7 additions & 1 deletion src/select/parts/multiselect-item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ const MultiSelectItem = (
<CheckboxIcon checked={selected} indeterminate={isParent && indeterminate} disabled={option.disabled} />
</div>
)}
<Option option={{ ...wrappedOption, disabled }} highlightText={filteringValue} isGroupOption={isParent} />
<Option
option={{ ...wrappedOption, disabled }}
highlightedOption={highlighted}
selectedOption={selected}
highlightText={filteringValue}
isGroupOption={isParent}
/>
</div>
</SelectableItem>
);
Expand Down
2 changes: 1 addition & 1 deletion style-dictionary/utils/token-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,7 @@ export type ColorsTokenName =
| 'colorTextDropdownItemFilterMatch'
| 'colorTextDropdownItemHighlighted'
| 'colorTextDropdownItemSecondary'
| 'colorTextDropdownItemSecondaryHover'
| 'colorTextEmpty'
| 'colorTextExpandableSectionDefault'
| 'colorTextExpandableSectionHover'
Expand Down Expand Up @@ -534,7 +535,6 @@ export type MotionTokenName =
| 'motionEasingTransitionQuick'
| 'motionEasingTransitionShowPaced'
| 'motionEasingTransitionShowQuick'
| 'motionKeyframesFadeIn'
| 'motionEasingResponsive'
| 'motionEasingSticky'
| 'motionEasingExpressive'
Expand Down
1 change: 1 addition & 0 deletions style-dictionary/visual-refresh/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ const tokens: StyleDictionary.ColorsDictionary = {
colorTextDropdownItemFilterMatch: { light: '{colorBlue600}', dark: '{colorBlue400}' },
colorTextDropdownItemHighlighted: { light: '{colorGrey900}', dark: '{colorGrey200}' },
colorTextDropdownItemSecondary: '{colorTextFormSecondary}',
colorTextDropdownItemSecondaryHover: { light: '{colorGrey550}', dark: 'colorGrey300' },
colorTextEmpty: { light: '{colorGrey550}', dark: '{colorGrey300}' },
colorTextExpandableSectionDefault: '{colorTextInteractiveActive}',
colorTextExpandableSectionHover: '{colorTextAccent}',
Expand Down