diff --git a/pages/theming/themed-stroke-width.page.tsx b/pages/theming/themed-stroke-width.page.tsx new file mode 100644 index 0000000000..8b67e88eb4 --- /dev/null +++ b/pages/theming/themed-stroke-width.page.tsx @@ -0,0 +1,335 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 +import React, { useLayoutEffect, useState } from 'react'; + +import { + Alert, + Box, + Button, + Flashbar, + FormField, + IconProvider, + Input, + KeyValuePairs, + Link, + Select, + SelectProps, + SpaceBetween, + StatusIndicator, +} from '~components'; +import Icon, { IconProps } from '~components/icon'; +import icons from '~components/icon/generated/icons'; +import { applyTheme, Theme } from '~components/theming'; + +import ScreenshotArea from '../utils/screenshot-area'; + +import styles from '../icon/icons-list.scss'; + +export default function () { + const [themed, setThemed] = useState(false); + const [strokeSmall, setStrokeSmall] = useState('2'); + const [strokeNormal, setStrokeNormal] = useState('2'); + const [strokeMedium, setStrokeMedium] = useState('2'); + const [strokeBig, setStrokeBig] = useState('3'); + const [strokeLarge, setStrokeLarge] = useState('4'); + const [selectedOption, setSelectedOption] = useState({ label: 'Option 1', value: '1' }); + + // Reload page once after initial load to fix theme application + useLayoutEffect(() => { + const hasReloaded = sessionStorage.getItem('themed-stroke-width-reloaded'); + if (!hasReloaded) { + sessionStorage.setItem('themed-stroke-width-reloaded', 'true'); + window.location.reload(); + } + }, []); + + useLayoutEffect(() => { + let reset: () => void = () => {}; + if (themed) { + const theme: Theme = { + tokens: { + borderWidthIconSmall: strokeSmall ? `${strokeSmall}px` : '1px', + borderWidthIconNormal: strokeNormal ? `${strokeNormal}px` : '1px', + borderWidthIconMedium: strokeMedium ? `${strokeMedium}px` : '1px', + borderWidthIconBig: strokeBig ? `${strokeBig}px` : '1.5px', + borderWidthIconLarge: strokeLarge ? `${strokeLarge}px` : '2px', + }, + }; + + const result = applyTheme({ + theme, + baseThemeId: 'visual-refresh', + }); + reset = result.reset; + } + return reset; + }, [themed, strokeSmall, strokeNormal, strokeMedium, strokeBig, strokeLarge]); + + return ( +
+

Themed icon stroke width

+ +
+ + { + const numValue = parseFloat(evt.detail.value); + if (!isNaN(numValue) && numValue >= 1 && numValue <= 10) { + setStrokeSmall(evt.detail.value); + } else if (evt.detail.value === '') { + setStrokeSmall(evt.detail.value); + } + }} + placeholder="1px" + step={0.5} + inputMode="decimal" + /> + + + + { + const numValue = parseFloat(evt.detail.value); + if (!isNaN(numValue) && numValue >= 1 && numValue <= 10) { + setStrokeNormal(evt.detail.value); + } else if (evt.detail.value === '') { + setStrokeNormal(evt.detail.value); + } + }} + placeholder="1px" + step={0.5} + inputMode="decimal" + /> + + + + { + const numValue = parseFloat(evt.detail.value); + if (!isNaN(numValue) && numValue >= 1 && numValue <= 10) { + setStrokeMedium(evt.detail.value); + } else if (evt.detail.value === '') { + setStrokeMedium(evt.detail.value); + } + }} + placeholder="1px" + step={0.5} + inputMode="decimal" + /> + + + + { + const numValue = parseFloat(evt.detail.value); + if (!isNaN(numValue) && numValue >= 1 && numValue <= 10) { + setStrokeBig(evt.detail.value); + } else if (evt.detail.value === '') { + setStrokeBig(evt.detail.value); + } + }} + placeholder="1.5px" + step={0.5} + inputMode="decimal" + /> + + + + { + const numValue = parseFloat(evt.detail.value); + if (!isNaN(numValue) && numValue >= 1 && numValue <= 10) { + setStrokeLarge(evt.detail.value); + } else if (evt.detail.value === '') { + setStrokeLarge(evt.detail.value); + } + }} + placeholder="2px" + step={0.5} + inputMode="decimal" + /> + +
+ + +
+ + + + + Icon sizes + + + + Small (16px with shorter wrapper size) +
+ {Object.keys(icons).map(icon => ( + + ))} +
+
+ + + Normal (16px) +
+ {Object.keys(icons).map(icon => ( + + ))} +
+
+ + + Medium (20px) +
+ {Object.keys(icons).map(icon => ( + + ))} +
+
+ + + Big (32px) +
+ {Object.keys(icons).map(icon => ( + + ))} +
+
+ + + Large (48px) +
+ {Object.keys(icons).map(icon => ( + + ))} +
+
+ + + Inline Context Examples + + + +
+ +
+ +
+ + Learn more + +
+ +
+ + +
+ + + Error + Success + Warning + Info + + + + + + ), + }} + > + + + Custom icon using icon-provider component + + Two-factor authentication enabled, + }, + { + label: 'Custom icon in an alert', + value: ( + + Two-factor authentication enabled successfully. + + ), + }, + { + label: 'Custom icon in a flashbar', + value: ( + + ), + }, + ]} + /> + + +

+ Lorem ipsum dolor sit amet,{' '} + + Learn more + {' '} + consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad + minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute + irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur + sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum +

+
+
+
+
+ ); +} diff --git a/src/__integ__/__snapshots__/themes.test.ts.snap b/src/__integ__/__snapshots__/themes.test.ts.snap index 0e993e261f..8f6262f9b7 100644 --- a/src/__integ__/__snapshots__/themes.test.ts.snap +++ b/src/__integ__/__snapshots__/themes.test.ts.snap @@ -45,6 +45,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "compact" 1`] = "border-width-button": "1px", "border-width-dropdown": "1px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "1px", "border-width-token": "1px", "color-background-avatar-default": "#545b64", @@ -727,6 +732,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "dark" 1`] = ` "border-width-button": "1px", "border-width-dropdown": "1px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "1px", "border-width-token": "1px", "color-background-avatar-default": "#545b64", @@ -1409,6 +1419,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "light" 1`] = ` "border-width-button": "1px", "border-width-dropdown": "1px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "1px", "border-width-token": "1px", "color-background-avatar-default": "#545b64", @@ -2091,6 +2106,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "reduced-motion" "border-width-button": "1px", "border-width-dropdown": "1px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "1px", "border-width-token": "1px", "color-background-avatar-default": "#545b64", @@ -2773,6 +2793,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "visual-refresh" "border-width-button": "2px", "border-width-dropdown": "2px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "2px", "border-width-token": "2px", "color-background-avatar-default": "#424650", @@ -3455,6 +3480,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "visual-refresh- "border-width-button": "2px", "border-width-dropdown": "2px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "2px", "border-width-token": "2px", "color-background-avatar-default": "#424650", @@ -4137,6 +4167,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "visual-refresh- "border-width-button": "2px", "border-width-dropdown": "2px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "2px", "border-width-token": "2px", "color-background-avatar-default": "#424650", @@ -4819,6 +4854,11 @@ exports[`CSS Custom Properties match previous snapshot for mode "visual-refresh- "border-width-button": "2px", "border-width-dropdown": "2px", "border-width-field": "1px", + "border-width-icon-big": "3px", + "border-width-icon-large": "4px", + "border-width-icon-medium": "2px", + "border-width-icon-normal": "2px", + "border-width-icon-small": "2px", "border-width-popover": "2px", "border-width-token": "2px", "color-background-avatar-default": "#424650", diff --git a/src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap b/src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap index fc7efac8a6..9acd5fbf8d 100644 --- a/src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap +++ b/src/__tests__/snapshot-tests/__snapshots__/design-tokens.test.ts.snap @@ -93,6 +93,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -2753,6 +2773,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -5413,6 +5453,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -8073,6 +8133,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -10733,6 +10813,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -13393,6 +13493,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -16053,6 +16173,26 @@ exports[`Design tokens artifacts Design tokens JSON for classic matches the snap "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "1px", @@ -18718,6 +18858,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -21378,6 +21538,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -24038,6 +24218,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -26698,6 +26898,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -29358,6 +29578,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -32018,6 +32258,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -34678,6 +34938,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -37338,6 +37618,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", @@ -39998,6 +40298,26 @@ exports[`Design tokens artifacts Design tokens JSON for visual-refresh matches t "$description": "The border width of form fields.", "$value": "1px", }, + "border-width-icon-big": { + "$description": "The visual stroke width of big icons.", + "$value": "3px", + }, + "border-width-icon-large": { + "$description": "The visual stroke width of large icons.", + "$value": "4px", + }, + "border-width-icon-medium": { + "$description": "The visual stroke width of medium icons.", + "$value": "2px", + }, + "border-width-icon-normal": { + "$description": "The visual stroke width of normal icons.", + "$value": "2px", + }, + "border-width-icon-small": { + "$description": "The visual stroke width of small icons.", + "$value": "2px", + }, "border-width-popover": { "$description": "The border width of popovers.", "$value": "2px", diff --git a/src/icon/icons/at-symbol.svg b/src/icon/icons/at-symbol.svg index da83645b74..6b5583f2ae 100644 --- a/src/icon/icons/at-symbol.svg +++ b/src/icon/icons/at-symbol.svg @@ -1,3 +1,4 @@ - - \ No newline at end of file + + + diff --git a/src/icon/icons/history.svg b/src/icon/icons/history.svg index eae36ceb50..efd8380dc2 100644 --- a/src/icon/icons/history.svg +++ b/src/icon/icons/history.svg @@ -1,4 +1,5 @@ - - - \ No newline at end of file + + + + diff --git a/src/icon/icons/slash.svg b/src/icon/icons/slash.svg index b938672f69..497b86bc8b 100644 --- a/src/icon/icons/slash.svg +++ b/src/icon/icons/slash.svg @@ -1,4 +1,4 @@ - - + + \ No newline at end of file diff --git a/src/icon/mixins.scss b/src/icon/mixins.scss index 1b71014c07..59b29343b0 100644 --- a/src/icon/mixins.scss +++ b/src/icon/mixins.scss @@ -23,31 +23,36 @@ $_icon-sizes: ( name: 'small', size: awsui.$size-icon-normal, supportedLineHeight: awsui.$line-height-body-s, - stroke: 2px, + stroke: awsui.$border-width-icon-small, + scaleFactor: 1, ), ( name: 'normal', size: awsui.$size-icon-normal, supportedLineHeight: awsui.$line-height-body-m, - stroke: 2px, + stroke: awsui.$border-width-icon-normal, + scaleFactor: 1, ), ( name: 'medium', size: awsui.$size-icon-medium, supportedLineHeight: awsui.$line-height-heading-l, - stroke: 1.6px, + stroke: awsui.$border-width-icon-medium, + scaleFactor: 1.25, ), ( name: 'big', size: awsui.$size-icon-big, supportedLineHeight: awsui.$line-height-heading-xl, - stroke: 1.5px, + stroke: awsui.$border-width-icon-big, + scaleFactor: 2, ), ( name: 'large', size: awsui.$size-icon-large, supportedLineHeight: awsui.$line-height-display-l, - stroke: 1.333px, + stroke: awsui.$border-width-icon-large, + scaleFactor: 3, ) ); @@ -57,6 +62,7 @@ $_icon-sizes: ( $size: map.get($type, 'size'); $supportedLineHeight: map.get($type, 'supportedLineHeight'); $stroke: map.get($type, 'stroke'); + $scaleFactor: map.get($type, 'scaleFactor'); $padding: calc((#{$supportedLineHeight} - #{$size}) / 2); &.size-#{$name} { @@ -78,7 +84,7 @@ $_icon-sizes: ( > svg { &, * { - stroke-width: $stroke; + stroke-width: calc(#{$stroke} / #{$scaleFactor}); } } } diff --git a/style-dictionary/utils/token-names.ts b/style-dictionary/utils/token-names.ts index 4a41c89eaa..eda079635e 100644 --- a/style-dictionary/utils/token-names.ts +++ b/style-dictionary/utils/token-names.ts @@ -859,7 +859,12 @@ export type BordersTokenName = | 'borderWidthDropdown' | 'borderWidthField' | 'borderWidthPopover' - | 'borderWidthToken'; + | 'borderWidthToken' + | 'borderWidthIconSmall' + | 'borderWidthIconNormal' + | 'borderWidthIconMedium' + | 'borderWidthIconBig' + | 'borderWidthIconLarge'; export type MotionTokenName = | 'motionDurationExtraFast' | 'motionDurationExtraSlow' diff --git a/style-dictionary/visual-refresh/borders.ts b/style-dictionary/visual-refresh/borders.ts index de12e168d6..ea3b3d3b89 100644 --- a/style-dictionary/visual-refresh/borders.ts +++ b/style-dictionary/visual-refresh/borders.ts @@ -47,4 +47,9 @@ export const tokens: StyleDictionary.BordersDictionary = { borderWidthField: '1px', borderWidthPopover: '2px', borderWidthToken: '2px', + borderWidthIconSmall: '2px', + borderWidthIconNormal: '2px', + borderWidthIconMedium: '2px', + borderWidthIconBig: '3px', + borderWidthIconLarge: '4px', }; diff --git a/style-dictionary/visual-refresh/metadata/borders.ts b/style-dictionary/visual-refresh/metadata/borders.ts index c971cad076..bfe420cac7 100644 --- a/style-dictionary/visual-refresh/metadata/borders.ts +++ b/style-dictionary/visual-refresh/metadata/borders.ts @@ -139,6 +139,31 @@ const metadata: StyleDictionary.MetadataIndex = { public: true, themeable: true, }, + borderWidthIconSmall: { + description: 'The visual stroke width of small icons.', + public: true, + themeable: true, + }, + borderWidthIconNormal: { + description: 'The visual stroke width of normal icons.', + public: true, + themeable: true, + }, + borderWidthIconMedium: { + description: 'The visual stroke width of medium icons.', + public: true, + themeable: true, + }, + borderWidthIconBig: { + description: 'The visual stroke width of big icons.', + public: true, + themeable: true, + }, + borderWidthIconLarge: { + description: 'The visual stroke width of large icons.', + public: true, + themeable: true, + }, }; export default metadata;