Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
823aac8
feat: poc of theme support in uikit
kark Jul 11, 2022
10c60b0
fix: all tokens story
kark Jul 13, 2022
861aa5c
fix: attempt to fix percy snapshots
kark Jul 13, 2022
f336d55
fix: attempt to fix percy snapshots #2
kark Jul 13, 2022
7555122
fix: attempt to fix percy snapshots #3
kark Jul 25, 2022
fae831a
[POC] Fix proposal for Percy related issues with CSS vars (#2243)
CarlosCortizasCT Jul 28, 2022
f21a2ca
test: revert jest-puppeteer setup changes
kark Jul 28, 2022
6ead57a
refactor: add css vars to root, warn when theme not valid
kark Jul 28, 2022
3888d6a
fix: warn when using useTheme outside a ThemeProvider
kark Jul 28, 2022
e4ca173
refactor: allow declaring the initial theme
kark Jul 28, 2022
81efabb
refactor: useRef for root element
kark Jul 29, 2022
366ff25
feat: allow using different themes in VRTs (#2256)
CarlosCortizasCT Aug 8, 2022
46b0e1c
test: rollback to previous version to showcase the problem with percy
kark Aug 10, 2022
43050fd
fix: percy
kark Aug 10, 2022
a106f9d
[PoC] Spec theme switcher (#2258)
CarlosCortizasCT Aug 11, 2022
a852027
refactor: remove @emotion/react theming from ui-kit components (#2257)
kark Aug 30, 2022
dd45713
chore: update versions after rebase
kark Aug 30, 2022
0dca49f
Simplify alternative themes configuration (#2268)
CarlosCortizasCT Aug 31, 2022
43488ed
Merge branch 'main' into poc-theme-support-in-uikit
CarlosCortizasCT Aug 31, 2022
40a99ca
Remove unnecessary helper from theming React hook (#2270)
CarlosCortizasCT Sep 1, 2022
a2ffc48
Support themed decision groups desing tokens (#2271)
CarlosCortizasCT Sep 2, 2022
066d822
fix: rename customProperties imports to use the new designSytem expor…
CarlosCortizasCT Sep 2, 2022
eda95a2
fix: update icons
CarlosCortizasCT Sep 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .changeset/few-maps-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
'@commercetools-uikit/design-system': minor
'@commercetools-uikit/calendar-utils': patch
'@commercetools-uikit/avatar': patch
'@commercetools-uikit/accessible-button': patch
'@commercetools-uikit/flat-button': patch
'@commercetools-uikit/icon-button': patch
'@commercetools-uikit/link-button': patch
'@commercetools-uikit/primary-button': patch
'@commercetools-uikit/secondary-button': patch
'@commercetools-uikit/secondary-icon-button': patch
'@commercetools-uikit/card': patch
'@commercetools-uikit/collapsible-panel': patch
'@commercetools-uikit/constraints': patch
'@commercetools-uikit/data-table': patch
'@commercetools-uikit/data-table-manager': patch
'@commercetools-uikit/field-label': patch
'@commercetools-uikit/icons': patch
'@commercetools-uikit/async-creatable-select-input': patch
'@commercetools-uikit/async-select-input': patch
'@commercetools-uikit/checkbox-input': patch
'@commercetools-uikit/creatable-select-input': patch
'@commercetools-uikit/date-time-input': patch
'@commercetools-uikit/input-utils': patch
'@commercetools-uikit/localized-multiline-text-input': patch
'@commercetools-uikit/localized-rich-text-input': patch
'@commercetools-uikit/localized-text-input': patch
'@commercetools-uikit/money-input': patch
'@commercetools-uikit/multiline-text-input': patch
'@commercetools-uikit/number-input': patch
'@commercetools-uikit/password-input': patch
'@commercetools-uikit/radio-input': patch
'@commercetools-uikit/rich-text-utils': patch
'@commercetools-uikit/search-select-input': patch
'@commercetools-uikit/select-input': patch
'@commercetools-uikit/select-utils': patch
'@commercetools-uikit/text-input': patch
'@commercetools-uikit/time-input': patch
'@commercetools-uikit/toggle-input': patch
'@commercetools-uikit/label': patch
'@commercetools-uikit/link': patch
'@commercetools-uikit/loading-spinner': patch
'@commercetools-uikit/notifications': patch
'@commercetools-uikit/primary-action-dropdown': patch
'@commercetools-uikit/spacings-inline': patch
'@commercetools-uikit/spacings-inset': patch
'@commercetools-uikit/spacings-inset-squish': patch
'@commercetools-uikit/spacings-stack': patch
'@commercetools-uikit/stamp': patch
'@commercetools-uikit/tag': patch
'@commercetools-uikit/text': patch
'@commercetools-uikit/tooltip': patch
'@commercetools-uikit/view-switcher': patch
'visual-testing-app': minor
---

Introduce theming support to ui-kit components based on the use of **CSS custom properties** (sometimes referred to as **CSS variables** or **cascading variables**).

The theming implementation consists of 2 key parts:

- `<ThemeProvider>` component from `@commercetools-uikit/design-system` added to the React component hierarchy will be responsible for declaring CSS custom properties and `data-theme` attribute (by default) in the `:root` element. For instance:
```html
<html data-theme="default" style="--color-primary:#00b39e”>
```

- `customProperties` as well as `designTokens` objects exporteded from the `@commercetools-uikit/design-system` package make the components in the ui-kit refer to CSS variables values rather than use fixed values, for instance:
```ts
const customProperties = {
colorPrimary: 'var(--color-primary, #00b39e)',
}
```

When accessing CSS variables using the `var()` function, [fallback values](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties#custom_property_fallback_values) are provided, therefore lack of `<ThemeProvider>` component in the React component tree does not introduce any visual changes.
1 change: 1 addition & 0 deletions .percy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ version: 2
snapshot:
widths:
- 1024
enable-javascript: true
2 changes: 1 addition & 1 deletion design-system/materials/custom-properties.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.

This file is created by the 'scripts/generate-custom-properties.js' script.
This file is created by the 'scripts/generate-design-tokens.js' script.
The variables should be updated in 'materials/internals/definition.yaml'.
*/

Expand Down
Loading