Skip to content

Commit

Permalink
working on motion
Browse files Browse the repository at this point in the history
  • Loading branch information
lukasoppermann committed Nov 20, 2024
1 parent fab6044 commit c3a1f0f
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-birds-hang.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/primitives': minor
---

Adding motion tokens
10 changes: 7 additions & 3 deletions scripts/buildTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ const getStyleDictionaryConfig: StyleDictionaryConfigGenerator = (
source, // build the special formats
include,
log: {
warnings: 'warn', // 'warn' | 'error' | 'disabled'
verbosity: 'verbose', // 'default' | 'silent' | 'verbose'
warnings: 'disabled', // 'warn' | 'error' | 'disabled'
verbosity: 'silent', // 'default' | 'silent' | 'verbose'
errors: {
brokenReferences: 'throw', // 'throw' | 'console'
},
Expand Down Expand Up @@ -157,7 +157,11 @@ export const buildDesignTokens = async (buildOptions: ConfigGeneratorOptions): P
const extendedSD = await PrimerStyleDictionary.extend(
getStyleDictionaryConfig(
`functional/motion/motion`,
[`src/tokens/functional/motion/*.json5`],
[
`src/tokens/functional/motion/*.json5`,
`src/tokens/base/motion/timing.json5`,
`src/tokens/base/motion/easing.json5`,
],
[`src/tokens/base/motion/*.json5`],
buildOptions,
{
Expand Down
26 changes: 26 additions & 0 deletions src/tokens/base/motion/easing.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
base: {
easing: {
linear: {
$value: [0, 0, 1, 1],
$type: 'cubicBezier',
$description: 'Ideal for non-movement properties, like opacity or background color.',
},
easeIn: {
$value: [0.7, 0.1, 0.75, 0.9],
$type: 'cubicBezier',
$description: 'Ideal for movement that starts on the page and ends off the page.',
},
easeOut: {
$value: [0.16, 1, 0.3, 1],
$type: 'cubicBezier',
$description: 'Ideal for movement that starts off the page and ends on the page.',
},
easeInOut: {
$value: [0.6, 0, 0.2, 1],
$type: 'cubicBezier',
$description: 'Ideal for movement that starts and ends on the page.',
},
},
},
}
50 changes: 50 additions & 0 deletions src/tokens/base/motion/timing.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
base: {
duration: {
'0': {
$value: '0ms',
$type: 'duration',
},
'75': {
$value: '75ms',
$type: 'duration',
},
'200': {
$value: '200ms',
$type: 'duration',
},
'300': {
$value: '300ms',
$type: 'duration',
},
'400': {
$value: '400ms',
$type: 'duration',
},
'500': {
$value: '500ms',
$type: 'duration',
},
'600': {
$value: '600ms',
$type: 'duration',
},
'700': {
$value: '700ms',
$type: 'duration',
},
'800': {
$value: '800ms',
$type: 'duration',
},
'900': {
$value: '900ms',
$type: 'duration',
},
'1000': {
$value: '1000ms',
$type: 'duration',
},
},
},
}
2 changes: 1 addition & 1 deletion src/tokens/functional/motion/loading.json5
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
loading: {
delay: {
default: {
$value: '1000ms',
$value: '{base.duration.1000}',
$type: 'duration',
$description: 'The amount of time to wait before showing a loading indicator or announcing a loading state to assistive technologies.',
},
Expand Down

0 comments on commit c3a1f0f

Please sign in to comment.