jpmorganchase / salt-ds

React UI components built with a focus on accessibility, customization and ease-of-use
https://www.saltdesignsystem.com
Apache License 2.0
121 stars 88 forks source link

Provide a mechanism to swap out built-in component icons to custom icons #3520

Open origami-z opened 3 months ago

origami-z commented 3 months ago

To support adoption, need to a way to swap out built-in icons, e.g. icons in status indicator, chevron in accordion

Example (not to be final API), from user point of view

import {CustomErrorIcon} from '@another-library/icon';

const customMapping = {
   error: CustomErrorIcon
  // expand, collapse, submenu, status (error/warning/success/info), overflow, user profile
};

<SemanticIconProvider value={customMapping}>

Icon provider should fill in fallback icon, i.e., all other icons will be default to Salt icons. All components using error icon (e.g. StatusIndicator) will be using CustomErrorIcon.

From Salt internal perspective, it will be something like

before:

// e.g. in dropdown
<ChevronUpIcon aria-hidden />

after:

// useSemanticIcon, the hook will get either a custom icon passed in or default Salt icon
const SemanticExpandIcon = useSemanticIcon("expand"); 

<SemanticExpandIcon aria-hidden />

Questions:

  1. Is it possible to make different component to pick different icons? e.g. Dropdown's expand/collapse icon v.s. Accordion expand/collapse icon, what if a user want to only swap out Accordion expand icon not Dropdown. Possibly related to #3939
    1. Audit differences between DS, same semantic icon used in different components? e.g. Accordion vs Dropdown case
  2. Is it possible to change icon color in a component via custom icons? e.g. Accordion chevron to use a different color than Salt ones.

Design in #3625

https://www.figma.com/design/xET9vAEtgJ7w29lGNGAcrF/Salt-(Next)-Iconography?node-id=41-2264&t=8DBsM4nqta9xP3Vb-1

pseys commented 1 month ago

FYI @bhoppers2008

mark-tate commented 1 month ago

Goal: by EOS have a plan for the approach

origami-z commented 1 month ago

Aug 12 - will start later in the week

joshwooding commented 1 month ago

Aug 14 - Working on the mappings.

joshwooding commented 3 weeks ago

Aug 20 - ready for review

origami-z commented 3 weeks ago

Aug 23 - Blocked by icon naming confirmation, which was thought to be done in #3625 (but was rescoped to Figma work)

bhoppers2008 commented 2 weeks ago

@bhoppers2008 to send Vineet semantic icon names for build. Can review once updated. @pseys

origami-z commented 2 weeks ago

Caught up with @Vineet119

origami-z commented 2 weeks ago

Salt / Pepper icon difference audit link - https://www.figma.com/design/6yIx5tpSk2y1b4alYaifi2/Pepper-workspace?node-id=395-6227&t=MXYz08aI3q0Cf7rs-1

origami-z commented 1 week ago

Meet with @pseys and @Vineet119

mark-tate commented 1 week ago

Espresso Goal: design to unblock themselves, feature released by 13th September

bhoppers2008 commented 2 days ago

@origami-z @Vineet119 the design guidance is linked to this issue here: https://github.com/jpmorganchase/salt-ds/issues/3625#issuecomment-2306764388

@pseys we need a plan for what we do with this information.