ids-foundation

2.1.3 • Public • Published

Overview

Contains base tokens, semantic tokens, font files and foundational assets for IDS.

Design Tokens

Design tokens are pieces of data that represent foundational styles in the design system. They simplify the way product teams interpret and apply the design language, resulting in more cohesive, scalable interfaces. Find more info in the design system. This guide just covers how to use them in the context of this repo and things like exporting / consuming.

Types

Tokens are categorized by the foundational style that’s applied.

Token Example Status
color Defines fills for backgrounds, text, icons, and borders color-background-default Included
radius Defines border radii for backgrounds, text, icons, and borders border-radius-xs Included
space Defines scalable padding and margin units for grids and layouts space-xl Included
font Defines typography attributes like font families, weights, sizes, and line height font-size-label Included
border Defines stroke widths, styles, and radiuses border-style-dashed Included
size Defines other reusable values for heights, widths, and breakpoints size-70 Future
shadow Defines box shadow properties like offsets, blur, and color shadow-error Future
motion Defines animations during certain interaction states motion-ease Future

Using the Tokens in Code

We provide the tokens in a few formats. They are: scss, css, and map.scss. We can add other formats as needed. There is also a description json file that contains all tokens with descriptions.

To use any of these install the npm package. Additionally note that the web component theme css files contain the tokens, so if you are using those you can just start using the token css variables directly without any additional setup.

Using Scss

Sass files for the tokens are provided as CSS variables.

To use the components:

  1. Take the core and semantic tokens from /ids-foundation.
  2. Use them similar to the component tokens in @infor-design/enterprise-wc.

Example light theme:

@import '../../../node_modules/ids-foundation/theme-soho/scss/core';
@import '../../../node_modules/ids-foundation/theme-soho/scss/theme-colors';
@import '../../../node_modules/ids-foundation/theme-soho/scss/semantic-light';

.light-theme .my-class {
 color: var(--ids-color-neutral-90);
}

Using css

  1. Import the files from the tokens/theme-<name>/css directory.
  2. Start using them in your styles.
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Design Tokens Example</title>
  <link rel="stylesheet" href="path/to/ids-foundation/theme-soho/css/ids-theme-tokens-default-light.css">
</head>
<body>
  <div class="my-class">
    This text uses the design token for color.
  </div>
</body>
</html>
.my-class {
 color: var(--ids-color-neutral-90);
}

Using .map.scss

To use the sass map files you should review the info about them the Sass Website. These can be useful for filtering specific tokens in or out.

We made a simple example to test it out. Which you can see here: https://stackblitz.com/edit/sass-map-tester?file=src%2Fapp%2Fapp.component.scss,src%2Fapp%2Fapp.component.html

Some additional example code:

@use 'ids-theme-tokens-default-light.map' as light;
@use 'ids-theme-tokens-default-dark.map' as dark;

.theme-new-light {
  @each $key, $value in light.$css-variables {
    // only add tokens that are not in the color palette
    @if str-index($key, '--ids-color') == null {
      #{$key}: #{$value};
    }
  }

 .blue {
  color: var(--ids-color-blue-100);
 }
}

.theme-new-dark {
  @each $key, $value in dark.$css-variables {
    // only add tokens that are in the color palette
    @if str-index($key, '--ids-color') {
      #{$key}: #{$value};
    }
  }

  background-color: var(--ids-color-background-default);

  .blue {
    color: var(--ids-color-accent-blue-strongest);
  }
  .red {
    color: var(--ids-color-accent-red-strongest);
  }
}

Design

Semantic tokens can be manually applied in Figma by adding the IDS Design Tokens library. Tokenized Figma components will available in the future.

Using the System Fonts

The system fonts are included in the fonts directory. They are used in the web components and can be used in your projects as well. See ./fonts for more information and readme. To get around GDPR issues we strongly recommend you serve this with your app.

Using the SVG Icons

All of the SVG icons are in the icons folder. We have standard icons and icons for empty states. For each one there is a folder with every SVG icon in it. The metadata file contains the sections and the icon names. The path-data.json file contains the path data for each icon and is how ids-enterprise-wc uses them.

Readme

Keywords

none

Package Sidebar

Install

npm i ids-foundation

Weekly Downloads

1,814

Version

2.1.3

License

Apache-2.0

Unpacked Size

8.92 MB

Total Files

1431

Last publish

Collaborators

  • tmcconechy