5.11.3 β€’ Published 10 months ago

@inubekit/foundations v5.11.3

Weekly downloads
-
License
-
Repository
github
Last release
10 months ago

Inubekit-foundations is a library that defines and exports structured tokens to be used across all components of the Inubekit project. This library ensures an organized structure in accordance with the design token model.

Table of contents

Documentation

The tokens are designed to follow a specific method for fulfilling the color requirements of a component, as outlined below: 1. ### Tokens Structure image

  • A. Business Unit: Defines which unit the token belongs to.
  • B. Component: Specifies the component to modify.
  • C. Appearance: Indicates the state the component should take.
  • D. Block: Defines the characteristic the token should receive.
  • E. Element: Specifies the design attribute.
  • F. Modifier: Defines how the component should look.
  1. Conditions

    • 1. Content: Applies to border, background, text, and icon components.
    • 2. Contrast: Applies to texts, icons, and spinners when the background is filled.
    • 3. Hover: When filled, texts and icons do not support hover effects.

  • Palette: Color palette that is used within the design system.

image image image image

Therefore, the tokens for the various components utilize the palette tokens, for example:

inube.button.primary.content.color.regular image

For more information about the tokens available for the components and how they are used, please follow this link: πŸ‘‰ Inubekit-tokens

For more information about what are design tokens and how to use them please follow this link: πŸ‘‰ What-are-design-tokens

Installation

To use inubekit tokens, all you need to do is run the following command:

# with npm
$ npm install @inubekit/foundations

Usage

To use an Inubekit tokens in your project, import it from the package and include it in your code. Here’s an example using the button component:

To start using the tokens, please follow these steps:

  1. Make sure that the component is listed in package.json with the latest available version.
  "dependencies": {
    "@inubekit/foundations": "^5.5.0"
    ...
    }
  1. Use it on your component:
import styled from "styled-components";
import { inube } from "@inubekit/foundations";

const StyledLabel = styled.label`
  font-family: ${({ theme }) =>
      theme?.typography?.label?.[$size]?.font || "Roboto"},
    sans-serif;
  font-size: ${({ $size }) => inube.typography.label[$size].size};
  font-weight: ${({ $size }) => inube.typography.label[$size].weight};
  letter-spacing: ${({ $size }) => inube.typography.label[$size].tracking};
  line-height: ${({ $size }) => inube.typography.label[$size].lineHeight};
  margin: ${({ $margin }) => $margin};
  padding: ${({ $padding }) => $padding};
  color: ${({ theme, $disabled, $focused, $invalid }) => {
    if ($disabled) {
      return (
        theme?.label?.content?.color?.disabled ||
        inube.label.content.color.disabled
      );
    }

    if ($invalid) {
      return (
        theme?.label?.content?.color?.invalid ||
        inube.label.content.color.invalid
      );
    }

    if ($focused) {
      return (
        theme?.label?.content?.color?.focus || inube.label.content.color.focus
      );
    }

    return (
      theme?.label?.content?.color?.regular || inube.label.content.color.regular
    );
  }};
`;

export { StyledLabel };
  1. Example image

At this point, you are probably wondering why we use the structure theme?.label?.content?.color?.regular || inube.label.content.color.regular. The reason is simple: by default, our components will use the Inube theme. However, since the components can be customized using the same token structure but with a different palette, you can achieve results like this:

We are going to use <Button/> in order to explain

image

image

There are also typography tokens, which are used in specific contexts where a particular type of text or alignment for inputs is required, such as in <Text/>, <TextField/>, and similar components.

5.11.3

10 months ago

5.11.2

11 months ago

5.11.1

11 months ago

5.11.0

11 months ago

5.10.0

12 months ago

5.9.0

12 months ago

5.5.1

1 year ago

5.5.0

1 year ago

5.3.1

1 year ago

5.3.0

1 year ago

5.1.0

1 year ago

5.2.18

1 year ago

5.2.17

1 year ago

5.2.16

1 year ago

5.2.15

1 year ago

5.2.14

1 year ago

5.2.13

1 year ago

5.2.12

1 year ago

5.2.11

1 year ago

5.2.10

1 year ago

3.2.0

1 year ago

3.0.0

1 year ago

2.15.0

1 year ago

4.0.0

1 year ago

5.2.9

1 year ago

5.2.8

1 year ago

5.8.1

12 months ago

5.2.7

1 year ago

5.8.0

12 months ago

5.2.6

1 year ago

5.6.1

1 year ago

5.2.5

1 year ago

5.6.0

1 year ago

5.2.4

1 year ago

5.2.3

1 year ago

5.4.0

1 year ago

5.2.2

1 year ago

5.2.1

1 year ago

5.2.0

1 year ago

5.0.0

1 year ago

3.1.0

1 year ago

5.7.0

12 months ago

2.14.1

1 year ago

2.14.2

1 year ago

2.14.0

1 year ago

2.13.0

1 year ago

2.12.1

1 year ago

2.12.0

1 year ago

2.11.0

1 year ago

2.10.0

1 year ago

2.9.0

1 year ago

2.7.0

1 year ago

2.8.0

1 year ago

2.6.1

1 year ago

2.6.0

1 year ago

2.5.0

1 year ago

2.4.0

1 year ago

2.3.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

2.1.1

1 year ago

2.1.0

1 year ago

1.2.0

1 year ago

1.1.1

2 years ago

1.1.2

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago