-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update .gitignore * deprecate Mode in favor of Theme * creates Recursive Record type * Semantics of Color token segment types. Add TSDoc * changesets * Update pretty-paws-try.md
- Loading branch information
1 parent
02e1d77
commit 7bc4fcd
Showing
15 changed files
with
278 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@leafygreen-ui/lib': minor | ||
--- | ||
|
||
Adds `RecursiveRecord` type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
'@leafygreen-ui/tokens': minor | ||
--- | ||
|
||
- Improves semantics of color token segment type names (e.g. `Type` -> `Property`, `State` -> `InteractionState`). | ||
- Adds TSDoc to color types | ||
- Deprecates `Mode` enum in favor if `Theme` (exported from `lib`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* Create a recursive Record type of any number of key sets. | ||
* | ||
* The second parameter (`Strict`) determines whether each union of Keys | ||
* must be complete in each recursive `Record` | ||
* Passing `false` to this parameter will wrap each recursive `Record` in `Partial`, | ||
* resulting in a looser Record definition. | ||
* | ||
* E.g. | ||
* ```ts | ||
* ColorRecord = RecursiveRecord< | ||
* [Theme, Property, Variant, State, string], | ||
* false | ||
* > = | ||
* Partial<Record<Theme, | ||
* Partial<Record<Property, | ||
* Partial<Record<Variant, | ||
* Partial<Record<State, string>> | ||
* >> | ||
* >> | ||
* >> | ||
* ``` | ||
* */ | ||
export type RecursiveRecord< | ||
Keys extends Array<any>, | ||
Strict extends boolean = true, | ||
> = Keys extends [ | ||
infer Key, // the current union of keys | ||
...infer Rest, | ||
] | ||
? Strict extends true | ||
? Record<Key & string, RecursiveRecord<Rest, Strict>> | ||
: Partial<Record<Key & string, RecursiveRecord<Rest, Strict>>> | ||
: Keys; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export { type Mutable } from './Mutable'; | ||
export type { Mutable } from './Mutable'; | ||
export type { RecursiveRecord } from './RecursiveRecord'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import { Mode } from '../mode'; | ||
import { Theme } from '@leafygreen-ui/lib'; | ||
|
||
import { ModeColorRecord } from './color.types'; | ||
import { PropertyColorRecord } from './color.types'; | ||
import { darkModeColors } from './darkModeColors'; | ||
import { lightModeColors } from './lightModeColors'; | ||
|
||
export const color = { | ||
[Mode.Dark]: darkModeColors, | ||
[Mode.Light]: lightModeColors, | ||
} as const satisfies Record<Mode, ModeColorRecord>; | ||
[Theme.Dark]: darkModeColors, | ||
[Theme.Light]: lightModeColors, | ||
} as const satisfies Record<Theme, PropertyColorRecord>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.