@primer/primitives 11.7.1 → 11.8.0-rc.036a9e18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DESIGN_TOKENS_GUIDE.md +28 -20
- package/DESIGN_TOKENS_SPEC.md +99 -0
- package/README.md +5 -0
- package/dist/build/transformers/transitionToCss.js +5 -1
- package/dist/css/functional/motion/motion.css +15 -0
- package/dist/css/functional/spacing/space.css +8 -0
- package/dist/css/primitives.css +2 -0
- package/dist/docs/functional/motion/motion.json +427 -0
- package/dist/docs/functional/spacing/space.json +224 -0
- package/dist/fallbacks/functional/motion/motion.json +51 -0
- package/dist/fallbacks/functional/spacing/space.json +8 -0
- package/dist/figma/figma.json +6 -6
- package/dist/figma/scales/dark-dimmed.json +629 -629
- package/dist/figma/scales/dark-high-constrast.json +628 -628
- package/dist/figma/scales/light-high-constrast.json +626 -626
- package/dist/styleLint/functional/motion/motion.json +427 -0
- package/dist/styleLint/functional/spacing/space.json +224 -0
- package/package.json +5 -3
- package/src/tokens/functional/motion/motion.json5 +190 -0
- package/src/tokens/functional/spacing/space.json5 +94 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@primer/primitives",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.0-rc.036a9e18",
|
|
4
4
|
"description": "Typography, spacing, and color primitives for Primer design system",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"lint": "eslint '**/*.{js,ts,tsx,md,mdx}' --max-warnings=0 --config eslint.config.mjs && npm run lint:tokens",
|
|
40
40
|
"lint:fix": "eslint '**/*.{js,ts,tsx,md,mdx}' --fix --max-warnings=0 --config eslint.config.mjs",
|
|
41
41
|
"lint:tokens": "tsx scripts/validateTokenJson.ts",
|
|
42
|
+
"check:removed-tokens": "tsx scripts/checkRemovedTokens.ts",
|
|
42
43
|
"test": "npm run test:unit && npm run test:integration",
|
|
43
44
|
"test:unit": "vitest run --coverage",
|
|
44
45
|
"test:integration": "vitest run -r integration",
|
|
@@ -46,7 +47,8 @@
|
|
|
46
47
|
"prepack": "npm run build",
|
|
47
48
|
"release": "changeset publish",
|
|
48
49
|
"storybook": "npm run build:tokens && cd docs/storybook && npm run storybook",
|
|
49
|
-
"storybook:install": "cd docs/storybook && npm ci --
|
|
50
|
+
"storybook:install": "cd docs/storybook && npm ci --no-audit --no-fund",
|
|
51
|
+
"postinstall": "npm run storybook:install"
|
|
50
52
|
},
|
|
51
53
|
"prettier": "@github/prettier-config",
|
|
52
54
|
"devDependencies": {
|
|
@@ -82,4 +84,4 @@
|
|
|
82
84
|
"zod-validation-error": "^4.0.1",
|
|
83
85
|
"colorjs.io": "^0.6.1"
|
|
84
86
|
}
|
|
85
|
-
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
{
|
|
2
|
+
motion: {
|
|
3
|
+
duration: {
|
|
4
|
+
$description: 'Semantic duration tokens for UI motion. Maps interaction types to appropriate timing values.',
|
|
5
|
+
$extensions: {
|
|
6
|
+
'org.primer.llm': {
|
|
7
|
+
usage: ['transition-duration', 'animation-duration', 'motion-timing'],
|
|
8
|
+
rules:
|
|
9
|
+
'MUST keep UI interactions ≤300ms. Use micro for hover/focus, short for state changes, medium for enter/exit. NEVER exceed 500ms for UI interactions.',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
micro: {
|
|
13
|
+
$value: '{base.duration.100}',
|
|
14
|
+
$type: 'duration',
|
|
15
|
+
$description: 'Fast micro-interactions like hover, focus ring, and color shifts.',
|
|
16
|
+
$extensions: {
|
|
17
|
+
'org.primer.llm': {
|
|
18
|
+
usage: ['hover-transition', 'focus-ring', 'color-shift', 'opacity-change'],
|
|
19
|
+
rules: 'Use for instantaneous feedback on hover and focus states.',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
short: {
|
|
24
|
+
$value: '{base.duration.200}',
|
|
25
|
+
$type: 'duration',
|
|
26
|
+
$description: 'Quick transitions for state changes like expand/collapse, toggles, and visibility changes.',
|
|
27
|
+
$extensions: {
|
|
28
|
+
'org.primer.llm': {
|
|
29
|
+
usage: ['expand-collapse', 'toggle', 'visibility-change', 'state-transition'],
|
|
30
|
+
rules: 'Use for interactive state changes that need to feel responsive.',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
medium: {
|
|
35
|
+
$value: '{base.duration.300}',
|
|
36
|
+
$type: 'duration',
|
|
37
|
+
$description: 'Standard duration for elements entering or exiting the viewport, such as modals and dropdowns.',
|
|
38
|
+
$extensions: {
|
|
39
|
+
'org.primer.llm': {
|
|
40
|
+
usage: ['modal-open', 'dropdown-appear', 'tooltip-show', 'enter-exit-viewport'],
|
|
41
|
+
rules: 'Use for elements entering or leaving the viewport. Maximum recommended duration for UI interactions.',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
long: {
|
|
46
|
+
$value: '{base.duration.500}',
|
|
47
|
+
$type: 'duration',
|
|
48
|
+
$description: 'Longer duration for complex multi-step animations or large-scale layout shifts. Use sparingly.',
|
|
49
|
+
$extensions: {
|
|
50
|
+
'org.primer.llm': {
|
|
51
|
+
usage: ['complex-animation', 'multi-step', 'layout-shift', 'page-transition'],
|
|
52
|
+
rules: 'Use sparingly for complex animations. NEVER use for simple UI interactions.',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
easing: {
|
|
58
|
+
$description: 'Semantic easing tokens for UI motion. Maps interaction types to appropriate cubic-bezier curves.',
|
|
59
|
+
$extensions: {
|
|
60
|
+
'org.primer.llm': {
|
|
61
|
+
usage: ['transition-timing-function', 'animation-timing-function', 'easing-curve'],
|
|
62
|
+
rules:
|
|
63
|
+
'Follow the easing decision tree: entering/exiting → enter, moving/morphing → move, hover → hover, constant → linear.',
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
hover: {
|
|
67
|
+
$value: '{base.easing.ease}',
|
|
68
|
+
$type: 'cubicBezier',
|
|
69
|
+
$description: 'Easing for hover state changes and micro-interactions.',
|
|
70
|
+
$extensions: {
|
|
71
|
+
'org.primer.llm': {
|
|
72
|
+
usage: ['hover-state', 'micro-interaction', 'button-hover', 'link-hover'],
|
|
73
|
+
rules: 'Use for hover state changes.',
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
enter: {
|
|
78
|
+
$value: '{base.easing.easeOut}',
|
|
79
|
+
$type: 'cubicBezier',
|
|
80
|
+
$description: 'Decelerating easing for elements entering the viewport or appearing on screen.',
|
|
81
|
+
$extensions: {
|
|
82
|
+
'org.primer.llm': {
|
|
83
|
+
usage: ['enter-animation', 'element-appearing', 'modal-open', 'dropdown-open', 'tooltip-appear'],
|
|
84
|
+
rules: 'RECOMMENDED default for enter animations. Element decelerates into its final position.',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
exit: {
|
|
89
|
+
$value: '{base.easing.easeIn}',
|
|
90
|
+
$type: 'cubicBezier',
|
|
91
|
+
$description: 'Accelerating easing for elements exiting the viewport or leaving the screen.',
|
|
92
|
+
$extensions: {
|
|
93
|
+
'org.primer.llm': {
|
|
94
|
+
usage: ['exit-animation', 'element-leaving', 'modal-close', 'dismiss'],
|
|
95
|
+
rules: 'Use for elements leaving the viewport. Element accelerates away.',
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
move: {
|
|
100
|
+
$value: '{base.easing.easeInOut}',
|
|
101
|
+
$type: 'cubicBezier',
|
|
102
|
+
$description: 'Smooth easing for elements moving or morphing within the viewport.',
|
|
103
|
+
$extensions: {
|
|
104
|
+
'org.primer.llm': {
|
|
105
|
+
usage: ['position-change', 'size-change', 'morph-animation', 'expand-collapse', 'slide-transition'],
|
|
106
|
+
rules: 'Use for elements that move or change shape on screen.',
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
linear: {
|
|
111
|
+
$value: '{base.easing.linear}',
|
|
112
|
+
$type: 'cubicBezier',
|
|
113
|
+
$description: 'Constant motion with no acceleration. Use for continuous animations like progress bars or loaders.',
|
|
114
|
+
$extensions: {
|
|
115
|
+
'org.primer.llm': {
|
|
116
|
+
usage: ['progress-bar', 'loader', 'continuous-animation', 'scrolling'],
|
|
117
|
+
rules: 'Use only for constant, uninterrupted motion.',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
transition: {
|
|
123
|
+
$description:
|
|
124
|
+
'Composite transition tokens bundling duration and easing for common UI interaction patterns. Use these for the CSS transition property.',
|
|
125
|
+
$extensions: {
|
|
126
|
+
'org.primer.llm': {
|
|
127
|
+
usage: ['css-transition', 'transition-shorthand'],
|
|
128
|
+
rules:
|
|
129
|
+
'Use transition tokens instead of raw duration + easing values. Pair with CSS transition-property to specify which properties to animate. MUST respect prefers-reduced-motion.',
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
hover: {
|
|
133
|
+
$value: {
|
|
134
|
+
duration: '{motion.duration.micro}',
|
|
135
|
+
timingFunction: '{motion.easing.hover}',
|
|
136
|
+
},
|
|
137
|
+
$type: 'transition',
|
|
138
|
+
$description: 'Transition for hover state changes on interactive elements like buttons and links.',
|
|
139
|
+
$extensions: {
|
|
140
|
+
'org.primer.llm': {
|
|
141
|
+
usage: ['button-hover', 'link-hover', 'interactive-hover', 'color-transition'],
|
|
142
|
+
rules: 'Use for all hover state transitions. Keeps interactions feeling instantaneous.',
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
stateChange: {
|
|
147
|
+
$value: {
|
|
148
|
+
duration: '{motion.duration.short}',
|
|
149
|
+
timingFunction: '{motion.easing.move}',
|
|
150
|
+
},
|
|
151
|
+
$type: 'transition',
|
|
152
|
+
$description: 'Transition for state changes like toggles, expand/collapse, and visibility changes.',
|
|
153
|
+
$extensions: {
|
|
154
|
+
'org.primer.llm': {
|
|
155
|
+
usage: ['toggle', 'expand-collapse', 'accordion', 'tab-switch', 'visibility-change'],
|
|
156
|
+
rules: 'Use for interactive elements that change between states.',
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
enter: {
|
|
161
|
+
$value: {
|
|
162
|
+
duration: '{motion.duration.medium}',
|
|
163
|
+
timingFunction: '{motion.easing.enter}',
|
|
164
|
+
},
|
|
165
|
+
$type: 'transition',
|
|
166
|
+
$description: 'Transition for elements entering the viewport, such as modals, dropdowns, and tooltips.',
|
|
167
|
+
$extensions: {
|
|
168
|
+
'org.primer.llm': {
|
|
169
|
+
usage: ['modal-open', 'dropdown-appear', 'tooltip-show', 'popover-enter', 'overlay-appear'],
|
|
170
|
+
rules: 'Use for elements appearing on screen. Element decelerates into final position.',
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
exit: {
|
|
175
|
+
$value: {
|
|
176
|
+
duration: '{motion.duration.short}',
|
|
177
|
+
timingFunction: '{motion.easing.exit}',
|
|
178
|
+
},
|
|
179
|
+
$type: 'transition',
|
|
180
|
+
$description: 'Transition for elements exiting the viewport, such as closing modals and dismissing dropdowns.',
|
|
181
|
+
$extensions: {
|
|
182
|
+
'org.primer.llm': {
|
|
183
|
+
usage: ['modal-close', 'dropdown-dismiss', 'tooltip-hide', 'popover-exit', 'overlay-dismiss'],
|
|
184
|
+
rules: 'Use for elements leaving the screen. Shorter than enter to feel snappy.',
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
space: {
|
|
3
|
+
xxs: {
|
|
4
|
+
$value: '{base.size.2}',
|
|
5
|
+
$type: 'dimension',
|
|
6
|
+
$description: 'Ultra-compact spacing for form field separators and tight visual divisions.',
|
|
7
|
+
$extensions: {
|
|
8
|
+
'org.primer.llm': {
|
|
9
|
+
usage: ['gap', 'padding', 'margin', 'form-separators'],
|
|
10
|
+
rules: 'Ultra-compact (2px). Use for form field separators, tight dividers, and minimal breathing room between small elements.',
|
|
11
|
+
},
|
|
12
|
+
'org.primer.figma': {
|
|
13
|
+
collection: 'functional/size',
|
|
14
|
+
scopes: ['gap'],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
xs: {
|
|
19
|
+
$value: '{base.size.4}',
|
|
20
|
+
$type: 'dimension',
|
|
21
|
+
$description: 'Compact spacing for small badges, tight internal spacing, and minimal breathing room.',
|
|
22
|
+
$extensions: {
|
|
23
|
+
'org.primer.llm': {
|
|
24
|
+
usage: ['gap', 'padding', 'margin', 'badge-spacing', 'list-items'],
|
|
25
|
+
rules: 'Compact (4px). Use for small component spacing, tight list separations, badge padding, and minimal internal margins.',
|
|
26
|
+
},
|
|
27
|
+
'org.primer.figma': {
|
|
28
|
+
collection: 'functional/size',
|
|
29
|
+
scopes: ['gap'],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
sm: {
|
|
34
|
+
$value: '{base.size.8}',
|
|
35
|
+
$type: 'dimension',
|
|
36
|
+
$description: 'Default spacing for most UI elements. Comfortable visual density for standard component layouts.',
|
|
37
|
+
$extensions: {
|
|
38
|
+
'org.primer.llm': {
|
|
39
|
+
usage: ['gap', 'padding', 'margin', 'flex-gap', 'grid-gap', 'card-padding'],
|
|
40
|
+
rules: 'Default (8px). Use for standard component spacing, flex/grid item separation, container padding, and most element margins.',
|
|
41
|
+
},
|
|
42
|
+
'org.primer.figma': {
|
|
43
|
+
collection: 'functional/size',
|
|
44
|
+
scopes: ['gap'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
md: {
|
|
49
|
+
$value: '{base.size.12}',
|
|
50
|
+
$type: 'dimension',
|
|
51
|
+
$description: 'Relaxed spacing for breathing room and comfortable internal container space.',
|
|
52
|
+
$extensions: {
|
|
53
|
+
'org.primer.llm': {
|
|
54
|
+
usage: ['gap', 'padding', 'margin', 'panel-padding', 'section-separation'],
|
|
55
|
+
rules: 'Relaxed (12px). Use for comfortable container padding, relaxed layouts, section separators, and breathing room in dense layouts.',
|
|
56
|
+
},
|
|
57
|
+
'org.primer.figma': {
|
|
58
|
+
collection: 'functional/size',
|
|
59
|
+
scopes: ['gap'],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
lg: {
|
|
64
|
+
$value: '{base.size.16}',
|
|
65
|
+
$type: 'dimension',
|
|
66
|
+
$description: 'Spacious spacing for major layout divisions and visual separation between content blocks.',
|
|
67
|
+
$extensions: {
|
|
68
|
+
'org.primer.llm': {
|
|
69
|
+
usage: ['gap', 'padding', 'margin', 'section-gap', 'container-margin'],
|
|
70
|
+
rules: 'Spacious (16px). Use for major layout divisions, visual separation between content blocks, and primary container margins.',
|
|
71
|
+
},
|
|
72
|
+
'org.primer.figma': {
|
|
73
|
+
collection: 'functional/size',
|
|
74
|
+
scopes: ['gap'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
xl: {
|
|
79
|
+
$value: '{base.size.24}',
|
|
80
|
+
$type: 'dimension',
|
|
81
|
+
$description: 'Expansive spacing for large sections and top-level structure separation.',
|
|
82
|
+
$extensions: {
|
|
83
|
+
'org.primer.llm': {
|
|
84
|
+
usage: ['gap', 'padding', 'margin', 'page-sections', 'major-divisions'],
|
|
85
|
+
rules: 'Expansive (24px). Use for large section separation, top-level layout structure, major page divisions, and expansive breathing room.',
|
|
86
|
+
},
|
|
87
|
+
'org.primer.figma': {
|
|
88
|
+
collection: 'functional/size',
|
|
89
|
+
scopes: ['gap'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
}
|