@primer/primitives 0.0.0-20260220144751 → 0.0.0-20260220163920
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 +0 -24
- package/DESIGN_TOKENS_SPEC.md +0 -42
- package/dist/css/base/size/size.css +35 -0
- package/dist/css/functional/size/border.css +11 -0
- package/dist/css/functional/size/breakpoints.css +8 -0
- package/dist/css/functional/size/radius.css +7 -0
- package/dist/css/functional/size/size-coarse.css +8 -0
- package/dist/css/functional/size/size-fine.css +8 -0
- package/dist/css/functional/size/size.css +73 -0
- package/dist/css/functional/size/viewport.css +6 -0
- package/dist/css/primitives.css +7 -0
- package/dist/docs/base/size/size.json +824 -0
- package/dist/docs/functional/size/border.json +258 -0
- package/dist/docs/functional/size/breakpoints.json +182 -0
- package/dist/docs/functional/size/radius.json +221 -0
- package/dist/docs/functional/size/size-coarse.json +142 -0
- package/dist/docs/functional/size/size-fine.json +142 -0
- package/dist/docs/functional/size/size.json +2000 -0
- package/dist/docs/functional/size/viewport.json +92 -0
- package/dist/fallbacks/base/size/size.json +35 -0
- package/dist/fallbacks/functional/size/border.json +11 -0
- package/dist/fallbacks/functional/size/breakpoints.json +8 -0
- package/dist/fallbacks/functional/size/radius.json +7 -0
- package/dist/fallbacks/functional/size/size-coarse.json +6 -0
- package/dist/fallbacks/functional/size/size-fine.json +6 -0
- package/dist/fallbacks/functional/size/size.json +73 -0
- package/dist/fallbacks/functional/size/viewport.json +8 -0
- package/dist/styleLint/base/size/size.json +824 -0
- package/dist/styleLint/functional/size/border.json +258 -0
- package/dist/styleLint/functional/size/breakpoints.json +182 -0
- package/dist/styleLint/functional/size/radius.json +221 -0
- package/dist/styleLint/functional/size/size-coarse.json +142 -0
- package/dist/styleLint/functional/size/size-fine.json +142 -0
- package/dist/styleLint/functional/size/size.json +2000 -0
- package/dist/styleLint/functional/size/viewport.json +92 -0
- package/package.json +1 -1
- package/src/tokens/base/size/size.json5 +56 -0
- package/src/tokens/base/size/z-index.json5 +0 -38
- package/src/tokens/functional/size/z-index.json5 +0 -100
package/DESIGN_TOKENS_GUIDE.md
CHANGED
|
@@ -98,30 +98,6 @@
|
|
|
98
98
|
| MUST | Match padding density to control's purpose |
|
|
99
99
|
| SHOULD | Use `medium` size as default |
|
|
100
100
|
|
|
101
|
-
### Z-Index
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
--zIndex-[layer]
|
|
105
|
-
└── layer: behind | default | sticky | dropdown | overlay | modal | popover | skipLink
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
| Keyword | Rule |
|
|
109
|
-
| ------- | ------------------------------------------------------------------------------------------------------------ |
|
|
110
|
-
| MUST | Use z-index tokens instead of raw numeric values |
|
|
111
|
-
| MUST | Use `skipLink` only for accessibility skip-navigation links |
|
|
112
|
-
| MUST | Pair z-index with appropriate shadow level (see table below) |
|
|
113
|
-
| SHOULD | Prefer creating a new stacking context (`isolation: isolate`) over escalating z-index |
|
|
114
|
-
| NEVER | Use `behind` (-1) without verifying no ancestor creates a stacking context (transform, opacity, filter, etc) |
|
|
115
|
-
| NEVER | Use arbitrary z-index values outside the token scale |
|
|
116
|
-
|
|
117
|
-
**Shadow ↔ Z-Index Alignment:**
|
|
118
|
-
|
|
119
|
-
| Shadow Level | Z-Index Token | Example |
|
|
120
|
-
| ------------------------------ | ------------------------------------ | --------------------- |
|
|
121
|
-
| `shadow.resting.*` | `zIndex.default` / `zIndex.sticky` | Cards, sticky headers |
|
|
122
|
-
| `shadow.floating.small/medium` | `zIndex.dropdown` / `zIndex.overlay` | Menus, drawers |
|
|
123
|
-
| `shadow.floating.large/xlarge` | `zIndex.modal` / `zIndex.popover` | Dialogs, tooltips |
|
|
124
|
-
|
|
125
101
|
---
|
|
126
102
|
|
|
127
103
|
## Decision Tree: Easing Selection
|
package/DESIGN_TOKENS_SPEC.md
CHANGED
|
@@ -568,48 +568,6 @@ Monospace text styles for code blocks and inline code.
|
|
|
568
568
|
| **text-codeBlock-shorthand** | Default style for rendering code blocks. | code-block, pre-element, code-snippet | MUST use for multi-line code. Use monospace font stack. |
|
|
569
569
|
| **text-codeInline-shorthand** | Inline code blocks using em units to inherit size from its parent. | inline-code, code-element, variable-name | Use for inline code within text. Size inherits from parent using em units. |
|
|
570
570
|
|
|
571
|
-
## ZIndex
|
|
572
|
-
|
|
573
|
-
### zIndex-behind
|
|
574
|
-
Place element behind base content. Use for decorative backgrounds or canvas elements.
|
|
575
|
-
**U:** background-pattern, canvas-element, decorative-background
|
|
576
|
-
**R:** Use to push an element behind its siblings. WARNING: Negative z-index can behave unpredictably if any ancestor creates a new stacking context (via transform, opacity < 1, filter, will-change, etc.). Only use when you control the full stacking context chain. Do NOT use as a general "hide" mechanism.
|
|
577
|
-
|
|
578
|
-
### zIndex-default
|
|
579
|
-
Default stacking order. No elevation above surrounding content.
|
|
580
|
-
**U:** default-content, in-flow-element, reset
|
|
581
|
-
**R:** Use to explicitly reset z-index to the default layer. Suitable for elements that should participate in normal document flow stacking. Do NOT use for any element that needs to appear above other content.
|
|
582
|
-
|
|
583
|
-
### zIndex-dropdown
|
|
584
|
-
Dropdown menus and select panels that appear above page content.
|
|
585
|
-
**U:** autocomplete-list, dropdown-menu, select-panel
|
|
586
|
-
**R:** Use for menus, select panels, and autocomplete lists that overlay page content. These should appear above sticky elements but below overlays and modals. Pair -> `shadow.floating.small` or `shadow.floating.medium` for visual elevation.
|
|
587
|
-
|
|
588
|
-
### zIndex-modal
|
|
589
|
-
Modal dialogs and full-screen overlays.
|
|
590
|
-
**U:** dialog, full-screen-overlay, modal-dialog
|
|
591
|
-
**R:** Use for modal dialogs that require user interaction before returning to the page. MUST trap focus within the modal. MUST appear above all other page content except popovers and skip links. Pair -> `shadow.floating.large` or `shadow.floating.xlarge` for visual elevation.
|
|
592
|
-
|
|
593
|
-
### zIndex-overlay
|
|
594
|
-
Overlay backdrops, side panels, and drawers.
|
|
595
|
-
**U:** drawer, overlay-backdrop, side-panel
|
|
596
|
-
**R:** Use for overlay surfaces that partially cover the page — drawers, side panels, and backdrop layers. These appear above dropdowns but below modal dialogs. SHOULD be paired with a backdrop/scrim element to indicate the overlay is blocking interaction with content beneath.
|
|
597
|
-
|
|
598
|
-
### zIndex-popover
|
|
599
|
-
Tooltips and popovers that appear above all normal UI.
|
|
600
|
-
**U:** hover-card, popover, tooltip
|
|
601
|
-
**R:** Use for tooltips, popovers, and hover cards that must appear above all other UI elements including modals. These are the highest layer in normal UI. Do NOT use for persistent navigation — use `sticky` instead.
|
|
602
|
-
|
|
603
|
-
### zIndex-skipLink
|
|
604
|
-
Accessibility skip links. Must always be the topmost layer.
|
|
605
|
-
**U:** skip-link, skip-navigation, skip-to-content
|
|
606
|
-
**R:** MUST use for accessibility skip links that allow keyboard users to bypass navigation. This is the highest z-index level and MUST always appear above everything else including modals and tooltips. NEVER use for non-accessibility purposes.
|
|
607
|
-
|
|
608
|
-
### zIndex-sticky
|
|
609
|
-
Sticky elements that remain visible while scrolling.
|
|
610
|
-
**U:** sticky-header, sticky-sidebar, sticky-table-header
|
|
611
|
-
**R:** MUST use with `position: sticky` or `position: fixed` for headers, sidebars, and navigation bars that persist during scroll. Do NOT use for floating overlays or dropdowns — use higher z-index levels instead.
|
|
612
|
-
|
|
613
571
|
---
|
|
614
572
|
|
|
615
573
|
**Final Directive for AI**:
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--base-size-112: 7rem;
|
|
3
|
+
--base-size-12: 0.75rem;
|
|
4
|
+
--base-size-128: 8rem;
|
|
5
|
+
--base-size-16: 1rem;
|
|
6
|
+
--base-size-2: 0.125rem;
|
|
7
|
+
--base-size-20: 1.25rem;
|
|
8
|
+
--base-size-24: 1.5rem;
|
|
9
|
+
--base-size-28: 1.75rem;
|
|
10
|
+
--base-size-32: 2rem;
|
|
11
|
+
--base-size-36: 2.25rem;
|
|
12
|
+
--base-size-4: 0.25rem;
|
|
13
|
+
--base-size-40: 2.5rem;
|
|
14
|
+
--base-size-44: 2.75rem;
|
|
15
|
+
--base-size-48: 3rem;
|
|
16
|
+
--base-size-6: 0.375rem;
|
|
17
|
+
--base-size-64: 4rem;
|
|
18
|
+
--base-size-8: 0.5rem;
|
|
19
|
+
--base-size-80: 5rem;
|
|
20
|
+
--base-size-96: 6rem;
|
|
21
|
+
--base-size-negative-12: -0.75rem;
|
|
22
|
+
--base-size-negative-16: -1rem;
|
|
23
|
+
--base-size-negative-2: -0.125rem;
|
|
24
|
+
--base-size-negative-20: -1.25rem;
|
|
25
|
+
--base-size-negative-24: -1.5rem;
|
|
26
|
+
--base-size-negative-28: -1.75rem;
|
|
27
|
+
--base-size-negative-32: -2rem;
|
|
28
|
+
--base-size-negative-36: -2.25rem;
|
|
29
|
+
--base-size-negative-4: -0.25rem;
|
|
30
|
+
--base-size-negative-40: -2.5rem;
|
|
31
|
+
--base-size-negative-44: -2.75rem;
|
|
32
|
+
--base-size-negative-48: -3rem;
|
|
33
|
+
--base-size-negative-6: -0.375rem;
|
|
34
|
+
--base-size-negative-8: -0.5rem;
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--borderWidth-thick: 0.125rem; /** Thick 2px border for emphasis. Use for focus indicators, selected states, or to emphasize important boundaries */
|
|
3
|
+
--borderWidth-thicker: 0.25rem; /** Extra thick 4px border for maximum emphasis. Use sparingly for high-contrast focus indicators or critical visual separators */
|
|
4
|
+
--borderWidth-thin: 0.0625rem; /** Standard 1px border width. Use for most borders, dividers, and outlines throughout the interface */
|
|
5
|
+
--outline-focus-offset: -0.125rem; /** Focus outline offset (-2px). Negative value creates an inset outline for keyboard focus indicators, ensuring the focus ring stays within the element bounds */
|
|
6
|
+
--outline-focus-width: 0.125rem; /** Focus outline width (2px). Standard width for keyboard focus indicators to meet WCAG 2.4.7 accessibility requirements */
|
|
7
|
+
--borderWidth-default: var(--borderWidth-thin); /** Default border width for most UI elements. Alias of borderWidth.thin (1px) */
|
|
8
|
+
--boxShadow-thick: inset 0 0 0 var(--borderWidth-thick); /** Thick shadow (2px) used instead of a border for emphasis without layout shift */
|
|
9
|
+
--boxShadow-thicker: inset 0 0 0 var(--borderWidth-thicker); /** Thickest shadow (4px) used for high emphasis borders without layout shift. Use sparingly for maximum visual impact */
|
|
10
|
+
--boxShadow-thin: inset 0 0 0 var(--borderWidth-thin); /** Thin shadow used instead of a border to prevent layout shift */
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--borderRadius-full: 624.9375rem; /** Use this border radius for pill shaped elements */
|
|
3
|
+
--borderRadius-large: 0.75rem; /** Large border radius (12px). Use for larger containers, dialogs, or when more visual softness is desired. */
|
|
4
|
+
--borderRadius-medium: 0.375rem; /** Medium border radius (6px). The default choice for most buttons, cards, and containers */
|
|
5
|
+
--borderRadius-small: 0.1875rem; /** Small border radius (3px). Use for small variants of components or small UI elements like badges, tags, or anything below 16px in height */
|
|
6
|
+
--borderRadius-default: var(--borderRadius-medium); /** Default border radius for most UI elements. Alias of borderRadius.medium (6px). Use when in doubt */
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
@media (pointer: coarse) {
|
|
2
|
+
:root {
|
|
3
|
+
--control-minTarget-auto: 2.75rem; /** Minimum touch target size for coarse pointer devices (touch screens) */
|
|
4
|
+
--controlStack-large-gap-auto: 0.75rem; /** Gap between stacked controls in large density layouts for touch devices */
|
|
5
|
+
--controlStack-medium-gap-auto: 0.75rem; /** Gap between stacked controls in medium density layouts for touch devices */
|
|
6
|
+
--controlStack-small-gap-auto: 1rem; /** Gap between stacked controls in small density layouts for touch devices */
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
@media (pointer: fine) {
|
|
2
|
+
:root {
|
|
3
|
+
--control-minTarget-auto: 1rem; /** Minimum target size for fine pointer devices (mouse) */
|
|
4
|
+
--controlStack-large-gap-auto: 0.5rem; /** Gap between stacked controls in large density layouts for mouse interfaces */
|
|
5
|
+
--controlStack-medium-gap-auto: 0.5rem; /** Gap between stacked controls in medium density layouts for mouse interfaces */
|
|
6
|
+
--controlStack-small-gap-auto: 0.5rem; /** Gap between stacked controls in small density layouts for mouse interfaces */
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--control-large-paddingBlock: 0.625rem;
|
|
3
|
+
--control-medium-paddingBlock: 0.375rem;
|
|
4
|
+
--control-xlarge-paddingBlock: 0.875rem;
|
|
5
|
+
--control-xsmall-paddingBlock: 0.125rem;
|
|
6
|
+
--overlay-height-large: 27rem;
|
|
7
|
+
--overlay-height-medium: 20rem;
|
|
8
|
+
--overlay-height-small: 16rem;
|
|
9
|
+
--overlay-height-xlarge: 37.5rem;
|
|
10
|
+
--overlay-offset: 0.25rem;
|
|
11
|
+
--overlay-width-large: 40rem;
|
|
12
|
+
--overlay-width-medium: 30rem;
|
|
13
|
+
--overlay-width-small: 20rem;
|
|
14
|
+
--overlay-width-xlarge: 60rem;
|
|
15
|
+
--overlay-width-xsmall: 12rem;
|
|
16
|
+
--spinner-strokeWidth-default: 0.125rem;
|
|
17
|
+
--control-large-gap: 0.5rem;
|
|
18
|
+
--control-large-lineBoxHeight: 1.25rem;
|
|
19
|
+
--control-large-paddingInline-condensed: 0.5rem;
|
|
20
|
+
--control-large-paddingInline-normal: 0.75rem;
|
|
21
|
+
--control-large-paddingInline-spacious: 1rem;
|
|
22
|
+
--control-large-size: 2.5rem;
|
|
23
|
+
--control-medium-gap: 0.5rem;
|
|
24
|
+
--control-medium-lineBoxHeight: 1.25rem;
|
|
25
|
+
--control-medium-paddingInline-condensed: 0.5rem;
|
|
26
|
+
--control-medium-paddingInline-normal: 0.75rem;
|
|
27
|
+
--control-medium-paddingInline-spacious: 1rem;
|
|
28
|
+
--control-medium-size: 2rem;
|
|
29
|
+
--control-minTarget-coarse: 2.75rem;
|
|
30
|
+
--control-minTarget-fine: 1rem;
|
|
31
|
+
--control-small-gap: 0.25rem;
|
|
32
|
+
--control-small-lineBoxHeight: 1.25rem;
|
|
33
|
+
--control-small-paddingBlock: 0.25rem;
|
|
34
|
+
--control-small-paddingInline-condensed: 0.5rem;
|
|
35
|
+
--control-small-paddingInline-normal: 0.75rem;
|
|
36
|
+
--control-small-paddingInline-spacious: 1rem;
|
|
37
|
+
--control-small-size: 1.75rem;
|
|
38
|
+
--control-xlarge-gap: 0.5rem;
|
|
39
|
+
--control-xlarge-lineBoxHeight: 1.25rem;
|
|
40
|
+
--control-xlarge-paddingInline-condensed: 0.5rem;
|
|
41
|
+
--control-xlarge-paddingInline-normal: 0.75rem;
|
|
42
|
+
--control-xlarge-paddingInline-spacious: 1rem;
|
|
43
|
+
--control-xlarge-size: 3rem;
|
|
44
|
+
--control-xsmall-gap: 0.25rem;
|
|
45
|
+
--control-xsmall-lineBoxHeight: 1.25rem;
|
|
46
|
+
--control-xsmall-paddingInline-condensed: 0.25rem;
|
|
47
|
+
--control-xsmall-paddingInline-normal: 0.5rem;
|
|
48
|
+
--control-xsmall-paddingInline-spacious: 0.75rem;
|
|
49
|
+
--control-xsmall-size: 1.5rem;
|
|
50
|
+
--controlStack-large-gap-auto: 0.5rem;
|
|
51
|
+
--controlStack-large-gap-condensed: 0.5rem;
|
|
52
|
+
--controlStack-large-gap-spacious: 0.75rem;
|
|
53
|
+
--controlStack-medium-gap-auto: 0.5rem;
|
|
54
|
+
--controlStack-medium-gap-condensed: 0.5rem;
|
|
55
|
+
--controlStack-medium-gap-spacious: 0.75rem;
|
|
56
|
+
--controlStack-small-gap-auto: 0.5rem;
|
|
57
|
+
--controlStack-small-gap-condensed: 0.5rem;
|
|
58
|
+
--controlStack-small-gap-spacious: 1rem;
|
|
59
|
+
--overlay-borderRadius: 0.375rem;
|
|
60
|
+
--overlay-padding-condensed: 0.5rem;
|
|
61
|
+
--overlay-padding-normal: 1rem;
|
|
62
|
+
--overlay-paddingBlock-condensed: 0.25rem;
|
|
63
|
+
--overlay-paddingBlock-normal: 0.75rem;
|
|
64
|
+
--spinner-size-large: 4rem;
|
|
65
|
+
--spinner-size-medium: 2rem;
|
|
66
|
+
--spinner-size-small: 1rem;
|
|
67
|
+
--stack-gap-condensed: 0.5rem;
|
|
68
|
+
--stack-gap-normal: 1rem;
|
|
69
|
+
--stack-gap-spacious: 1.5rem;
|
|
70
|
+
--stack-padding-condensed: 0.5rem;
|
|
71
|
+
--stack-padding-normal: 1rem;
|
|
72
|
+
--stack-padding-spacious: 1.5rem;
|
|
73
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
@custom-media --viewportRange-landscape (orientation: landscape);
|
|
2
|
+
@custom-media --viewportRange-narrow (max-width: calc(48rem - 0.02px));
|
|
3
|
+
@custom-media --viewportRange-narrowLandscape ((max-width: calc(63.25rem - 0.02px)) and (max-height: calc(34rem - 0.02px)) and (orientation: landscape));
|
|
4
|
+
@custom-media --viewportRange-portrait (orientation: portrait);
|
|
5
|
+
@custom-media --viewportRange-regular (min-width: 48rem);
|
|
6
|
+
@custom-media --viewportRange-wide (min-width: 87.5rem);
|
package/dist/css/primitives.css
CHANGED
|
@@ -3,5 +3,12 @@
|
|
|
3
3
|
* @rule Never use raw values (hex/px). Use semantic tokens ONLY.
|
|
4
4
|
*/
|
|
5
5
|
@import './base/motion/motion.css';
|
|
6
|
+
@import './base/size/size.css';
|
|
6
7
|
@import './base/typography/typography.css';
|
|
8
|
+
@import './functional/size/border.css';
|
|
9
|
+
@import './functional/size/breakpoints.css';
|
|
10
|
+
@import './functional/size/radius.css';
|
|
11
|
+
@import './functional/size/size-coarse.css';
|
|
12
|
+
@import './functional/size/size-fine.css';
|
|
13
|
+
@import './functional/size/size.css';
|
|
7
14
|
@import './functional/typography/typography.css';
|