Skip to content

Commit 54c8e34

Browse files
author
Luke Bowerman
authored
Dynamic theme generation (#1012)
- ComponentsProvider now accepts coreColors for dynamic theme specification - NOTE: If explicit key color is not specified we'll simply pass through the fallback values. This means that existing users of @looker/components will see no effective changes when this feature is added unless they use the coreColors prop on ComponentsProvider
1 parent f67943b commit 54c8e34

File tree

30 files changed

+681
-88
lines changed

30 files changed

+681
-88
lines changed

.vscode/settings.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
"xxxxlarge"
4242
],
4343
"prettier.arrowParens": "always",
44-
"extensions.ignoreRecommendations": true,
4544
"files.autoSave": "off",
4645
"debug.allowBreakpointsEverywhere": true
4746
}

CHANGELOG.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,45 +5,48 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [UNRELEASED]
8+
## [0.8.0]
9+
10+
### NOTABLE
11+
12+
- `ComponentsProvider` now supports `coreColors` attribute for dynamic theme generation
13+
- `theme.colors.palette` no longer used internally except in very limited (and soon-to-be-deprecated) cases.
14+
- `theme.colors` shape has been significantly refactored (documentation updates to follow)
15+
- `Tooltip` now uses `keyAccent` for link color
916

1017
### Added
1118

12-
- update InputColor to have an empty `Swatch`
13-
- `Status` component
14-
- `Tree`, `TreeItem` components
15-
- Includes docs and test suite
1619
- `ActionListItem` accepts `actionsButtonLabel` prop to help with testing
1720
- `ComboboxList` and `ComboboxOption` now both support a custom `indicator`
1821
- `Select` and `SelectMulti` also support `indicator` at both the component and option level
22+
- `InputColor` now supports a "null" state
23+
- `Status` component
24+
- `Tree`, `TreeItem` components
25+
- Includes docs and test suite
1926
- Test helper functions for `Combobox` component using react-testing-library
2027

2128
### Changed
2229

23-
- `theme.colors.palette` no longer used internally except in very limited (and soon-to-be-deprecated) cases.
24-
- `Button*` font sizes updated to match design specifications
25-
- `theme.colors` shape has been significantly refactored (documentation updates to follow)
30+
- `Badge` - `default` intent is now `key`
2631
- `Banner` is now `MessageBar`
2732
- Major style changes to be more Material-esque
2833
- `warning` is now `warn`
2934
- `error` is now `critical`
3035
- `info` is now `inform`
3136
- `confirmation` is now `positive`
32-
- ``
33-
- `Badge` - `default` intent is now `key`
37+
- `Button*` font sizes updated to match design specifications
3438
- `CheckboxGroup` and `RadioGroup` `name` is now optional
35-
- Updated `LookerLogo` and `LogoRings` to match new branding
36-
- `Tooltip` now uses `keyAccent` for link color
39+
- `TextArea` now supports min-height
40+
- Icons: `LookerLogo` and `LogoRings` updated to match new branding
3741

3842
### Fixed
3943

40-
- update `TextArea` to have min-height as `defaultProps`
44+
- `CheckboxGroup` and `RadioGroup` now reflect changes to `value` prop
45+
- `InlineInputText` no longer adds a special character to prevent vertical-collapse when empty
46+
- `InlineInputText` `simple` option _actually_ removes border-bottom
4147
- `InlineInputText` & `InlineInputTextArea` inherit color and text-alignment from parent
42-
- `InlineInputText` prop simple removes border-bottom
4348
- `Popover` positioning when placement is "top" and the height changes
4449
- `usePopper` reinstate the `adaptive` option of `computeStyles`
45-
- `CheckboxGroup` and `RadioGroup` now reflect changes to `value` prop
46-
- `InlineInputText` no longer adds a special character to prevent vertical-collapse when empty
4750

4851
### Removed
4952

packages/components/src/Text/text_variant.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export const textVariant = variant({
4949
color: 'text1',
5050
},
5151
inverted: {
52-
color: 'onInverse',
52+
color: 'inverseOn',
5353
},
5454
positive: {
5555
color: 'positive',

packages/components/src/Tooltip/Tooltip.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export function useTooltip({
217217
backgroundColor="inverse"
218218
borderRadius="medium"
219219
boxShadow={3}
220-
color="onInverse"
220+
color="inverseOn"
221221
{...surfaceStyles}
222222
>
223223
<TooltipContent

packages/design-tokens/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export * from './GlobalStyle'
3333
export { palette }
3434
export { prismTheme } from './prismTheme'
3535

36-
// Useful external helpers
36+
// Useful external utilities
3737
export * from './customizeable_attributes'
38-
export * from './helpers/animations'
38+
export * from './utils/animations'
39+
export { generateThemeFromCoreColors } from './utils/theme'

packages/design-tokens/src/system/color/index.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@
2525
*/
2626

2727
import { BlendColors } from './blends'
28-
import { IntentColors, SurfaceColors } from './specifiable'
2928
import { StatefulColors } from './stateful'
30-
31-
export type { ColorProps } from 'styled-system'
29+
import { IntentColors, SurfaceColors } from './specifiable'
3230

3331
export interface CoreColors {
3432
/**
@@ -61,4 +59,10 @@ export interface Colors
6159
BlendColors,
6260
StatefulColors {}
6361

64-
export { StatefulColor } from './stateful'
62+
export type { BlendColors } from './blends'
63+
export type {
64+
StatefulColor,
65+
StatefulColors,
66+
StatefulColorChoices,
67+
} from './stateful'
68+
export type { ColorProps } from 'styled-system'

packages/design-tokens/src/system/color/specifiable.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface SurfaceColors {
4242
* Used for: Icons in main nav, Text on primary buttons
4343
* @default white
4444
*/
45-
onInverse: string
45+
inverseOn: string
4646
}
4747

4848
export interface IntentColors {

packages/design-tokens/src/system/color/stateful.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export type StatefulColor = 'key' | 'critical' | 'neutral'
2929
export interface StatefulColorChoices {
3030
subtle: string
3131
accent: string
32-
main: string
32+
focus: string
3333
interactive: string
3434
pressed: string
3535
text: string
@@ -44,6 +44,7 @@ export interface StatefulColors
4444
interface CriticalStatefulColors {
4545
criticalSubtle: string
4646
criticalAccent: string
47+
criticalFocus: string
4748
criticalInteractive: string
4849
criticalPressed: string
4950
criticalText: string
@@ -53,6 +54,7 @@ interface CriticalStatefulColors {
5354
interface NeutralStatefulColors {
5455
neutralSubtle: string
5556
neutralAccent: string
57+
neutralFocus: string
5658
neutralInteractive: string
5759
neutralPressed: string
5860
neutralText: string

packages/design-tokens/src/theme.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
} from './tokens'
5959
import * as palette from './tokens/color/palette'
6060

61-
interface ThemeColors extends Colors {
61+
export interface ThemeColors extends Colors {
6262
palette: Palette
6363
}
6464

packages/design-tokens/src/tokens/color/fallbacks.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import {
4545
purple600,
4646
red000,
4747
red100,
48+
red300,
4849
red400,
4950
red700,
5051
red600,
@@ -79,13 +80,15 @@ export const fallbackStateful: StatefulColors = {
7980

8081
criticalSubtle: red000,
8182
criticalAccent: red100,
83+
criticalFocus: red300,
8284
criticalInteractive: red600,
8385
criticalPressed: red700,
8486
criticalText: white,
8587
criticalBorder: red400,
8688

8789
neutralSubtle: charcoal000,
8890
neutralAccent: charcoal100,
91+
neutralFocus: charcoal300,
8992
neutralInteractive: charcoal500,
9093
neutralPressed: charcoal600,
9194
neutralText: white,

0 commit comments

Comments
 (0)