0.46.1 • Published 9 months ago

@clds/design-system-foundations v0.46.1

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

@clds/design-system-foundations


npm version

Design System Foundations establish two abstract concepts:

  • Size
  • Surface

Size

When some component can contain other inside, it usually creates a slot for it, sometimes called "area". For example, the button can contain the icon.

In order to make implementations of all components decoupled, we introduce a concept that describes how much space child component is expected to consume.

It is expressed in an abstract unit, which is equal to theme spacing units: xxs, sm, md, etc.

We create components that can automatically adjust it's size if the component hasn't specified size directly.

The communication between containers and children is done via special FoundationContext.

Once component puts the expected size into the context, then any component inside can read it and default it's size to make sure it consumes the space expected by the container.

Size mapping

Components size props are not standardized. For example sm button doesn't have spacing.sm height but greater. Also, button supports only sm and md sizes. We should map context props into components props individually.

Surface

Components can have different color versions. The thing, which is common for many components, is their tone and variant. Variant implies the main color for the component theme (primary, error, etc), and tone implies how colors are used (subtle - lightweight, non eye-disturbing, solid - intense colors, bring user attention). The surface is an abstract concept that combines both tone and variant.

Many components in design system accept properties which are superset of the surface concept. But when one component is used inside the other, it is expected that the child component will somehow adjust own surface to be clearly visible when inside the container.

This is why we share this information about container surface via SurfaceContext. It means that if the component doesn't have own surface-related props specified, they will default to ones mapped from the Surface context.

Surface mapping

Child surface-related default props are mapped from the surface context, which means that the child component has to decide how to create own default style to make it visible on the surface.

For example, if Banner component is used with success variant, it will put { tone: 'solid', variant: 'success' } into the context.

If you put a Chip inside a banner, it reads the context and defaults its own variant to success but the button tone, to be clearly visible, has to be the opposite - solid when subtle and subtle when solid.

API

This package contains API for two independent contexts.

  • foundation context - FoundationContextProvider and createUseFoundationHook
  • surface context - SurfaceContextProvider and createUseSurfaceHook

You can find more information about them in JSDocs.

Versioning

This library follows Semantic Versioning.

License

See LICENSE

0.46.0

9 months ago

0.46.1

9 months ago

0.44.4

10 months ago

0.44.2

10 months ago

0.44.3

10 months ago

0.44.0

10 months ago

0.44.1

10 months ago

0.45.3

9 months ago

0.45.1

9 months ago

0.45.2

9 months ago

0.45.0

9 months ago

0.43.0

10 months ago

0.40.0

1 year ago

0.41.1

1 year ago

0.41.0

1 year ago

0.42.4

11 months ago

0.42.2

12 months ago

0.42.3

11 months ago

0.42.0

12 months ago

0.42.1

12 months ago

0.39.0

1 year ago

0.39.2

1 year ago

0.43.1

10 months ago

0.38.0

1 year ago

0.37.0

2 years ago

0.36.3

2 years ago

0.36.2

2 years ago

0.36.1

2 years ago

0.36.0

2 years ago

0.32.4

2 years ago

0.34.0

2 years ago

0.33.10

2 years ago

0.33.7

2 years ago

0.33.6

2 years ago

0.35.3

2 years ago

0.33.5

2 years ago

0.35.2

2 years ago

0.35.1

2 years ago

0.33.3

2 years ago

0.35.0

2 years ago

0.33.2

2 years ago

0.33.1

2 years ago

0.33.0

2 years ago

0.33.9

2 years ago

0.33.8

2 years ago

0.32.3

2 years ago

0.32.2

2 years ago

0.32.1

2 years ago

0.32.0

2 years ago

0.30.1

2 years ago

0.30.0

2 years ago

0.29.0

2 years ago

0.27.0

2 years ago

0.23.4

2 years ago

0.23.3

2 years ago

0.25.0

2 years ago

0.23.2

2 years ago

0.23.1

2 years ago

0.23.0

2 years ago

0.21.0

2 years ago

0.31.1

2 years ago

0.31.0

2 years ago

0.28.1

2 years ago

0.28.0

2 years ago

0.26.1

2 years ago

0.26.0

2 years ago

0.24.1

2 years ago

0.24.0

2 years ago

0.20.3

2 years ago

0.22.0

2 years ago

0.20.1

2 years ago

0.20.0

2 years ago

0.19.0

2 years ago

0.19.1

2 years ago

0.17.0

2 years ago

0.18.0

2 years ago

0.20.2

2 years ago

0.16.0

2 years ago

0.15.0

2 years ago

0.14.5

2 years ago

0.14.6

2 years ago

0.13.0

2 years ago

0.12.1

2 years ago

0.14.0

2 years ago

0.13.1

2 years ago

0.12.2

2 years ago

0.14.1

2 years ago

0.12.3

2 years ago

0.14.2

2 years ago

0.14.3

2 years ago

0.14.4

2 years ago

0.8.8

3 years ago

0.8.5

3 years ago

0.7.6

3 years ago

0.8.4

3 years ago

0.7.5

3 years ago

0.8.7

3 years ago

0.11.0

3 years ago

0.10.0

3 years ago

0.9.0

3 years ago

0.8.1

3 years ago

0.8.0

3 years ago

0.8.3

3 years ago

0.8.2

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.4

3 years ago

0.7.3

3 years ago

0.7.0

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.0

3 years ago

0.4.0

3 years ago

0.3.0

3 years ago