@papillonarts/css 0.6.0 → 0.8.0

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.
Files changed (133) hide show
  1. package/LICENSE +1 -1
  2. package/build/primer/autocomplete/README.md +20 -0
  3. package/build/primer/autocomplete/index.scss +3 -0
  4. package/build/primer/autocomplete/suggester.scss +101 -0
  5. package/build/primer/avatars/README.md +20 -0
  6. package/build/primer/avatars/avatar-parent-child.scss +17 -0
  7. package/build/primer/avatars/circle-badge.scss +55 -0
  8. package/build/primer/avatars/index.scss +5 -0
  9. package/build/primer/base/README.md +20 -0
  10. package/build/primer/base/base.scss +9 -17
  11. package/build/primer/base/index.scss +1 -0
  12. package/build/primer/base/kbd.scss +8 -10
  13. package/build/primer/{color-modes/native.scss → base/native-colors.scss} +4 -2
  14. package/build/primer/base/normalize.scss +4 -3
  15. package/build/primer/base/typography-base.scss +4 -3
  16. package/build/primer/box/README.md +20 -0
  17. package/build/primer/box/box-overlay.scss +45 -0
  18. package/build/primer/box/index.scss +2 -0
  19. package/build/primer/branch-name/README.md +20 -0
  20. package/build/primer/branch-name/branch-name.scss +33 -0
  21. package/build/primer/branch-name/index.scss +3 -0
  22. package/build/primer/buttons/README.md +20 -0
  23. package/build/primer/buttons/button-group.scss +104 -0
  24. package/build/primer/buttons/button.scss +347 -0
  25. package/build/primer/buttons/index.scss +4 -0
  26. package/build/primer/buttons/misc.scss +244 -0
  27. package/build/primer/color-modes/index.scss +0 -1
  28. package/build/primer/color-modes/themes/dark.scss +1 -6
  29. package/build/primer/color-modes/themes/dark_colorblind.scss +1 -6
  30. package/build/primer/color-modes/themes/dark_dimmed.scss +1 -6
  31. package/build/primer/color-modes/themes/dark_high_contrast.scss +1 -6
  32. package/build/primer/color-modes/themes/dark_tritanopia.scss +1 -6
  33. package/build/primer/color-modes/themes/light.scss +1 -6
  34. package/build/primer/color-modes/themes/light_colorblind.scss +1 -6
  35. package/build/primer/color-modes/themes/light_high_contrast.scss +1 -6
  36. package/build/primer/color-modes/themes/light_tritanopia.scss +1 -6
  37. package/build/primer/core/README.md +20 -0
  38. package/build/primer/core/index.scss +18 -0
  39. package/build/primer/docs.scss +7 -0
  40. package/build/primer/forms/README.md +20 -0
  41. package/build/primer/forms/form-control.scss +286 -0
  42. package/build/primer/forms/form-group.scss +297 -0
  43. package/build/primer/forms/form-select.scss +47 -0
  44. package/build/primer/forms/index.scss +6 -0
  45. package/build/primer/forms/input-group.scss +81 -0
  46. package/build/primer/forms/radio-group.scss +68 -0
  47. package/build/primer/header/README.md +20 -0
  48. package/build/primer/header/header.scss +51 -0
  49. package/build/primer/header/index.scss +2 -0
  50. package/build/primer/index.scss +8 -3
  51. package/build/primer/labels/README.md +20 -0
  52. package/build/primer/labels/index.scss +3 -0
  53. package/build/primer/labels/issue-labels.scss +26 -0
  54. package/build/primer/labels/mixins.scss +44 -0
  55. package/build/primer/layout/README.md +20 -0
  56. package/build/primer/layout/app-frame.scss +156 -0
  57. package/build/primer/layout/container.scss +30 -0
  58. package/build/primer/layout/grid-offset.scss +19 -0
  59. package/build/primer/layout/grid.scss +77 -0
  60. package/build/primer/layout/index.scss +7 -0
  61. package/build/primer/layout/page-layout.scss +417 -0
  62. package/build/primer/layout/stack.scss +220 -0
  63. package/build/primer/loaders/README.md +20 -0
  64. package/build/primer/loaders/index.scss +2 -0
  65. package/build/primer/loaders/loaders.scss +19 -0
  66. package/build/primer/markdown/README.md +20 -0
  67. package/build/primer/markdown/blob-csv.scss +32 -0
  68. package/build/primer/markdown/code.scss +79 -0
  69. package/build/primer/markdown/footnotes.scss +59 -0
  70. package/build/primer/markdown/headings.scss +101 -0
  71. package/build/primer/markdown/images.scss +130 -0
  72. package/build/primer/markdown/index.scss +9 -0
  73. package/build/primer/markdown/lists.scss +101 -0
  74. package/build/primer/markdown/markdown-body.scss +101 -0
  75. package/build/primer/markdown/tables.scss +46 -0
  76. package/build/primer/marketing/README.md +20 -0
  77. package/build/primer/marketing/buttons/button.scss +171 -0
  78. package/build/primer/marketing/buttons/index.scss +3 -0
  79. package/build/primer/marketing/index.scss +8 -0
  80. package/build/primer/marketing/links/index.scss +3 -0
  81. package/build/primer/marketing/links/link.scss +51 -0
  82. package/build/primer/marketing/support/index.scss +2 -0
  83. package/build/primer/marketing/support/variables.scss +140 -0
  84. package/build/primer/marketing/type/index.scss +3 -0
  85. package/build/primer/marketing/type/typography.scss +140 -0
  86. package/build/primer/marketing/utilities/animations.scss +52 -0
  87. package/build/primer/marketing/utilities/borders.scss +4 -0
  88. package/build/primer/marketing/utilities/filters.scss +3 -0
  89. package/build/primer/marketing/utilities/index.scss +6 -0
  90. package/build/primer/marketing/utilities/layout.scss +58 -0
  91. package/build/primer/navigation/README.md +20 -0
  92. package/build/primer/navigation/filter-list.scss +86 -0
  93. package/build/primer/navigation/index.scss +5 -0
  94. package/build/primer/navigation/sidenav.scss +102 -0
  95. package/build/primer/navigation/subnav.scss +154 -0
  96. package/build/primer/pagination/README.md +20 -0
  97. package/build/primer/pagination/index.scss +3 -0
  98. package/build/primer/pagination/pagination.scss +157 -0
  99. package/build/primer/primitives/index.scss +10 -0
  100. package/build/primer/primitives/temp-typography-tokens.scss +22 -0
  101. package/build/primer/product/README.md +20 -0
  102. package/build/primer/product/index.scss +13 -0
  103. package/build/primer/select-menu/README.md +20 -0
  104. package/build/primer/select-menu/index.scss +3 -0
  105. package/build/primer/select-menu/select-menu.scss +486 -0
  106. package/build/primer/support/README.md +20 -0
  107. package/build/primer/support/mixins/color-modes.scss +89 -3
  108. package/build/primer/support/mixins/layout.scss +1 -2
  109. package/build/primer/support/mixins/misc.scss +15 -9
  110. package/build/primer/support/mixins/typography.scss +21 -2
  111. package/build/primer/support/variables/misc.scss +2 -2
  112. package/build/primer/support/variables/typography.scss +2 -2
  113. package/build/primer/table-object/index.scss +1 -0
  114. package/build/primer/table-object/table-object.scss +23 -0
  115. package/build/primer/toasts/README.md +20 -0
  116. package/build/primer/toasts/index.scss +2 -0
  117. package/build/primer/toasts/toasts.scss +129 -0
  118. package/build/primer/tooltips/README.md +20 -0
  119. package/build/primer/tooltips/index.scss +2 -0
  120. package/build/primer/tooltips/tooltips.scss +228 -0
  121. package/build/primer/truncate/truncate.scss +2 -66
  122. package/build/primer/utilities/README.md +20 -0
  123. package/build/primer/utilities/borders.scss +30 -21
  124. package/build/primer/utilities/box-shadow.scss +8 -6
  125. package/build/primer/utilities/colors.scss +59 -60
  126. package/build/primer/utilities/details.scss +2 -2
  127. package/build/primer/utilities/flexbox.scss +2 -2
  128. package/build/primer/utilities/layout.scss +8 -6
  129. package/build/primer/utilities/margin.scss +2 -5
  130. package/build/primer/utilities/padding.scss +8 -10
  131. package/build/primer/utilities/typography.scss +12 -11
  132. package/build/primer/utilities/visibility-display.scss +14 -12
  133. package/package.json +2 -2
@@ -1,11 +1,12 @@
1
1
  // Generate a two-color caret for any element.
2
- @mixin double-caret($background: var(--color-canvas-default), $border: var(--color-border-default)) {
2
+ @mixin double-caret($background: var(--bgColor-default, var(--color-canvas-default)), $border: var(--borderColor-default, var(--color-border-default))) {
3
3
  &::after,
4
4
  &::before {
5
5
  position: absolute;
6
+ // stylelint-disable-next-line primer/spacing
6
7
  top: 11px;
7
8
  right: 100%;
8
- left: -8px;
9
+ left: calc(var(--base-size-8) * -1);
9
10
  display: block;
10
11
  width: 8px;
11
12
  height: 16px;
@@ -17,11 +18,12 @@
17
18
  &::after {
18
19
  // stylelint-disable-next-line primer/spacing
19
20
  margin-left: 2px;
20
- background-color: var(--color-canvas-default);
21
+ background-color: var(--bgColor-default, var(--color-canvas-default));
21
22
  background-image: linear-gradient($background, $background);
22
23
  }
23
24
 
24
25
  &::before {
26
+ // stylelint-disable-next-line primer/colors
25
27
  background-color: $border;
26
28
  }
27
29
  }
@@ -29,31 +31,35 @@
29
31
  // global focus styles
30
32
 
31
33
  // inset box-shadow for form controls
32
- @mixin focusBoxShadowInset($outlineWidth: 1px, $outlineColor: var(--color-accent-fg)) {
33
- border-color: var(--color-accent-fg);
34
+ @mixin focusBoxShadowInset($outlineWidth: 1px, $outlineColor: var(--focus-outlineColor, var(--color-accent-fg))) {
35
+ // stylelint-disable-next-line primer/colors
36
+ border-color: var(--focus-outlineColor, var(--color-accent-fg));
34
37
  outline: none;
38
+ // stylelint-disable-next-line primer/box-shadow
35
39
  box-shadow: inset 0 0 0 $outlineWidth $outlineColor;
36
40
  }
37
41
 
38
42
  // box-shadow for :target styles (no inset)
39
43
  // !important to override PCSS utilities
40
- @mixin targetBoxShadow($outlineWidth: 2px, $outlineColor: var(--color-accent-fg)) {
44
+ @mixin targetBoxShadow($outlineWidth: 2px, $outlineColor: var(--focus-outlineColor, var(--color-accent-fg))) {
41
45
  outline: none !important;
46
+ // stylelint-disable-next-line primer/box-shadow
42
47
  box-shadow: 0 0 0 $outlineWidth $outlineColor !important;
43
48
  }
44
49
 
45
50
  // outline
46
- @mixin focusOutline($outlineOffset: -2px, $outlineColor: var(--color-accent-fg)) {
51
+ @mixin focusOutline($outlineOffset: -2px, $outlineColor: var(--focus-outlineColor, var(--color-accent-fg))) {
47
52
  outline: 2px solid $outlineColor;
48
53
  outline-offset: $outlineOffset;
49
54
  box-shadow: none;
50
55
  }
51
56
 
52
57
  // outline with fg box-shadow for buttons
53
- @mixin focusOutlineOnEmphasis($outlineOffset: -2px, $outlineColor: var(--color-accent-fg)) {
58
+ @mixin focusOutlineOnEmphasis($outlineOffset: -2px, $outlineColor: var(--focus-outlineColor, var(--color-accent-fg))) {
54
59
  outline: 2px solid $outlineColor;
55
60
  outline-offset: $outlineOffset;
56
- box-shadow: inset 0 0 0 3px var(--color-fg-on-emphasis);
61
+ // stylelint-disable-next-line primer/box-shadow
62
+ box-shadow: inset 0 0 0 3px var(--fgColor-onEmphasis, var(--color-fg-on-emphasis));
57
63
  }
58
64
 
59
65
  // if min-width is undefined, return only min-height
@@ -1,5 +1,3 @@
1
- @import "../variables/typography.scss";
2
-
3
1
  // Text hiding for image based text replacement.
4
2
  // Higher performance than -9999px because it only renders
5
3
  // the size of the actual text, not a full 9999px box.
@@ -12,32 +10,44 @@
12
10
  // Heading mixins for use within components
13
11
  // These match heading utilities in utilities/typography
14
12
  @mixin h1 {
13
+ // stylelint-disable-next-line primer/typography
15
14
  font-size: var(--h1-size, $h1-size);
15
+ // stylelint-disable-next-line primer/typography
16
16
  font-weight: $font-weight-bold;
17
17
  }
18
18
 
19
19
  @mixin h2 {
20
+ // stylelint-disable-next-line primer/typography
20
21
  font-size: var(--h2-size, $h2-size);
22
+ // stylelint-disable-next-line primer/typography
21
23
  font-weight: $font-weight-bold;
22
24
  }
23
25
 
24
26
  @mixin h3 {
27
+ // stylelint-disable-next-line primer/typography
25
28
  font-size: var(--h3-size, $h3-size);
29
+ // stylelint-disable-next-line primer/typography
26
30
  font-weight: $font-weight-bold;
27
31
  }
28
32
 
29
33
  @mixin h4 {
34
+ // stylelint-disable-next-line primer/typography
30
35
  font-size: var(--h4-size, $h4-size);
36
+ // stylelint-disable-next-line primer/typography
31
37
  font-weight: $font-weight-bold;
32
38
  }
33
39
 
34
40
  @mixin h5 {
41
+ // stylelint-disable-next-line primer/typography
35
42
  font-size: var(--h5-size, $h5-size);
43
+ // stylelint-disable-next-line primer/typography
36
44
  font-weight: $font-weight-bold;
37
45
  }
38
46
 
39
47
  @mixin h6 {
48
+ // stylelint-disable-next-line primer/typography
40
49
  font-size: var(--h6-size, $h6-size);
50
+ // stylelint-disable-next-line primer/typography
41
51
  font-weight: $font-weight-bold;
42
52
  }
43
53
 
@@ -45,28 +55,34 @@
45
55
  // There are no responsive mixins for h4-h6 because they are small
46
56
  // and don't need to be smaller on mobile.
47
57
  @mixin f1-responsive {
58
+ // stylelint-disable-next-line primer/typography
48
59
  font-size: var(--h1-size-mobile, $h1-size-mobile);
49
60
 
50
61
  // 32px on desktop
51
62
  @include breakpoint(md) {
63
+ // stylelint-disable-next-line primer/typography
52
64
  font-size: var(--h1-size, $h1-size);
53
65
  }
54
66
  }
55
67
 
56
68
  @mixin f2-responsive {
69
+ // stylelint-disable-next-line primer/typography
57
70
  font-size: var(--h2-size-mobile, $h2-size-mobile);
58
71
 
59
72
  // 24px on desktop
60
73
  @include breakpoint(md) {
74
+ // stylelint-disable-next-line primer/typography
61
75
  font-size: var(--h2-size, $h2-size);
62
76
  }
63
77
  }
64
78
 
65
79
  @mixin f3-responsive {
80
+ // stylelint-disable-next-line primer/typography
66
81
  font-size: var(--h3-size-mobile, $h3-size-mobile);
67
82
 
68
83
  // 20px on desktop
69
84
  @include breakpoint(md) {
85
+ // stylelint-disable-next-line primer/typography
70
86
  font-size: var(--h3-size, $h3-size);
71
87
  }
72
88
  }
@@ -77,17 +93,20 @@
77
93
  @mixin h1-responsive {
78
94
  @include f1-responsive;
79
95
 
96
+ // stylelint-disable-next-line primer/typography
80
97
  font-weight: $font-weight-bold;
81
98
  }
82
99
 
83
100
  @mixin h2-responsive {
84
101
  @include f2-responsive;
85
102
 
103
+ // stylelint-disable-next-line primer/typography
86
104
  font-weight: $font-weight-bold;
87
105
  }
88
106
 
89
107
  @mixin h3-responsive {
90
108
  @include f3-responsive;
91
109
 
110
+ // stylelint-disable-next-line primer/typography
92
111
  font-weight: $font-weight-bold;
93
112
  }
@@ -3,8 +3,8 @@
3
3
  // Border
4
4
  $border-width: 1px !default;
5
5
  $border-style: solid !default;
6
- $border: $border-width $border-style var(--color-border-default) !default;
7
- $border-rem: var(--primer-borderWidth-thin, 1px) solid var(--color-border-default) !default;
6
+ $border: $border-width $border-style var(--borderColor-default, var(--color-border-default)) !default;
7
+ $border-rem: var(--borderWidth-thin, 1px) solid var(--borderColor-default, var(--color-border-default)) !default;
8
8
 
9
9
  // Border Radius
10
10
  $border-radius-1: 4px !default;
@@ -32,11 +32,11 @@ $lh-condensed: 1.25 !default;
32
32
  $lh-default: 1.5 !default;
33
33
 
34
34
  // Font stacks
35
- $body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji' !default;
35
+ $body-font: var(--fontStack-sansSerif, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji') !default;
36
36
 
37
37
  // Monospace font stack
38
38
  // Note: SFMono-Regular needs to come before SF Mono to fix an older version of the font in Chrome
39
- $mono-font: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace !default;
39
+ $mono-font: var(--fontStack-monospace, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace) !default;
40
40
 
41
41
  // The base body size
42
42
  $body-font-size: 14px !default;
@@ -0,0 +1 @@
1
+ @import './table-object.scss';
@@ -0,0 +1,23 @@
1
+ // Deprecated
2
+ // TODO: Replace TableObject with flexbox or a new Table component
3
+
4
+ // TableObject is a module for creating dynamically resizable elements that
5
+ // always sit on the same horizontal line (e.g., they never wrap). Using
6
+ // tables means it's cross browser friendly.
7
+
8
+ .TableObject {
9
+ display: table;
10
+ }
11
+
12
+ // Place this on every "cell"
13
+ .TableObject-item {
14
+ display: table-cell;
15
+ width: 1%;
16
+ white-space: nowrap;
17
+ vertical-align: middle;
18
+ }
19
+
20
+ // Place this on the largest or most important "cell"
21
+ .TableObject-item--primary {
22
+ width: 99%;
23
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ bundle: "toasts"
3
+ generated: true
4
+ ---
5
+
6
+ # Primer CSS: `toasts` bundle
7
+
8
+ ## Usage
9
+
10
+ Primer CSS source files are written in [SCSS]. To include this Primer CSS module in your own build, ensure that your `node_modules` directory is listed in your Sass include paths, then import it with:
11
+
12
+ ```scss
13
+ @import "@primer/css/toasts/index.scss";
14
+ ```
15
+
16
+ ## Build
17
+
18
+ The `@primer/css` npm package includes a standalone CSS build of this module in `dist/toasts.css`.
19
+
20
+ [scss]: https://sass-lang.com/documentation/syntax#scss
@@ -0,0 +1,2 @@
1
+ @import '../support/index.scss';
2
+ @import './toasts.scss';
@@ -0,0 +1,129 @@
1
+ // Toast
2
+
3
+ .Toast {
4
+ display: flex;
5
+ margin: var(--base-size-8);
6
+ color: var(--fgColor-default, var(--color-fg-default));
7
+ background-color: var(--bgColor-default, var(--color-canvas-default));
8
+ // stylelint-disable-next-line primer/borders
9
+ border-radius: $border-radius;
10
+ box-shadow: inset 0 0 0 1px var(--borderColor-default, var(--color-border-default)), var(--shadow-floating-legacy, var(--color-overlay-shadow));
11
+
12
+ @include breakpoint(sm) {
13
+ width: max-content;
14
+ max-width: 450px;
15
+ margin: var(--base-size-16);
16
+ }
17
+ }
18
+
19
+ .Toast-icon {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ width: calc(var(--base-size-16) * 3);
24
+ flex-shrink: 0;
25
+ color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis));
26
+ background-color: var(--bgColor-accent-emphasis, var(--color-accent-emphasis));
27
+ // stylelint-disable-next-line primer/borders, primer/colors
28
+ border: $border-width $border-style transparent;
29
+ border-right: 0;
30
+ border-top-left-radius: inherit;
31
+ border-bottom-left-radius: inherit;
32
+ }
33
+
34
+ .Toast-content {
35
+ padding: var(--base-size-16);
36
+ }
37
+
38
+ .Toast-dismissButton {
39
+ max-height: 54px; // keeps button aligned to the top
40
+ padding: var(--base-size-16);
41
+ color: inherit;
42
+ background-color: transparent;
43
+ border: 0;
44
+
45
+ &:hover {
46
+ opacity: 0.7;
47
+ }
48
+
49
+ &:active {
50
+ opacity: 0.5;
51
+ }
52
+ }
53
+
54
+ // Modifier
55
+
56
+ .Toast--loading {
57
+ color: var(--fgColor-default, var(--color-fg-default));
58
+ box-shadow: inset 0 0 0 1px var(--borderColor-default, var(--color-border-default)), var(--shadow-floating-legacy, var(--color-overlay-shadow));
59
+
60
+ .Toast-icon {
61
+ background-color: var(--bgColor-neutral-emphasis, var(--color-neutral-emphasis));
62
+ }
63
+ }
64
+
65
+ .Toast--error {
66
+ color: var(--fgColor-default, var(--color-fg-default));
67
+ box-shadow: inset 0 0 0 1px var(--borderColor-default, var(--color-border-default)), var(--shadow-floating-legacy, var(--color-overlay-shadow));
68
+
69
+ .Toast-icon {
70
+ background-color: var(--bgColor-danger-emphasis, var(--color-danger-emphasis));
71
+ }
72
+ }
73
+
74
+ .Toast--warning {
75
+ color: var(--fgColor-default, var(--color-fg-default));
76
+ box-shadow: inset 0 0 0 1px var(--borderColor-default, var(--color-border-default)), var(--shadow-floating-legacy, var(--color-overlay-shadow));
77
+
78
+ .Toast-icon {
79
+ background-color: var(--bgColor-attention-emphasis, var(--color-attention-emphasis));
80
+ }
81
+ }
82
+
83
+ .Toast--success {
84
+ color: var(--fgColor-default, var(--color-fg-default));
85
+ box-shadow: inset 0 0 0 1px var(--borderColor-default, var(--color-border-default)), var(--shadow-floating-legacy, var(--color-overlay-shadow));
86
+
87
+ .Toast-icon {
88
+ background-color: var(--bgColor-success-emphasis, var(--color-success-emphasis));
89
+ }
90
+ }
91
+
92
+ // Animations
93
+
94
+ .Toast--animateIn {
95
+ animation: Toast--animateIn 0.18s cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
96
+ }
97
+
98
+ @keyframes Toast--animateIn {
99
+ 0% {
100
+ opacity: 0;
101
+ transform: translateY(100%);
102
+ }
103
+ }
104
+
105
+ .Toast--animateOut {
106
+ animation: Toast--animateOut 0.18s cubic-bezier(0.55, 0.06, 0.68, 0.19) forwards;
107
+ }
108
+
109
+ @keyframes Toast--animateOut {
110
+ 100% {
111
+ pointer-events: none;
112
+ opacity: 0;
113
+ transform: translateY(100%);
114
+ }
115
+ }
116
+
117
+ .Toast--spinner {
118
+ animation: Toast--spinner 1000ms linear infinite;
119
+ }
120
+
121
+ @keyframes Toast--spinner {
122
+ from {
123
+ transform: rotate(0deg);
124
+ }
125
+
126
+ to {
127
+ transform: rotate(360deg);
128
+ }
129
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ bundle: "tooltips"
3
+ generated: true
4
+ ---
5
+
6
+ # Primer CSS: `tooltips` bundle
7
+
8
+ ## Usage
9
+
10
+ Primer CSS source files are written in [SCSS]. To include this Primer CSS module in your own build, ensure that your `node_modules` directory is listed in your Sass include paths, then import it with:
11
+
12
+ ```scss
13
+ @import "@primer/css/tooltips/index.scss";
14
+ ```
15
+
16
+ ## Build
17
+
18
+ The `@primer/css` npm package includes a standalone CSS build of this module in `dist/tooltips.css`.
19
+
20
+ [scss]: https://sass-lang.com/documentation/syntax#scss
@@ -0,0 +1,2 @@
1
+ @import '../support/index.scss';
2
+ @import './tooltips.scss';
@@ -0,0 +1,228 @@
1
+ /* stylelint-disable primer/spacing */
2
+
3
+ .tooltipped {
4
+ position: relative;
5
+ }
6
+
7
+ // This is the tooltip bubble
8
+ .tooltipped::after {
9
+ position: absolute;
10
+ z-index: 1000000;
11
+ display: none;
12
+ padding: var(--overlay-paddingBlock-condensed, 0.25rem) var(--overlay-padding-condensed, 0.5rem);
13
+ font: var(--text-body-shorthand-small, normal normal 11px/1.5 $body-font);
14
+ -webkit-font-smoothing: subpixel-antialiased;
15
+ color: var(--fgColor-onEmphasis, var(--color-fg-on-emphasis));
16
+ text-align: center;
17
+ text-decoration: none;
18
+ text-shadow: none;
19
+ text-transform: none;
20
+ letter-spacing: normal;
21
+ word-wrap: break-word;
22
+ white-space: pre;
23
+ pointer-events: none;
24
+ content: attr(aria-label);
25
+ background: var(--bgColor-emphasis, var(--color-neutral-emphasis-plus));
26
+ border-radius: var(--borderRadius-medium);
27
+ opacity: 0;
28
+ }
29
+
30
+ // delay animation for tooltip
31
+ @keyframes tooltip-appear {
32
+ from {
33
+ opacity: 0;
34
+ }
35
+
36
+ to {
37
+ opacity: 1;
38
+ }
39
+ }
40
+
41
+ // This will indicate when we'll activate the tooltip
42
+ .tooltipped:hover,
43
+ .tooltipped:active,
44
+ .tooltipped:focus {
45
+ &::before,
46
+ &::after {
47
+ display: inline-block;
48
+ text-decoration: none;
49
+ animation-name: tooltip-appear;
50
+ animation-duration: $tooltip-duration;
51
+ animation-fill-mode: forwards;
52
+ animation-timing-function: ease-in;
53
+ }
54
+ }
55
+
56
+ .tooltipped-no-delay:hover,
57
+ .tooltipped-no-delay:active,
58
+ .tooltipped-no-delay:focus {
59
+ &::before,
60
+ &::after {
61
+ animation-delay: 0s;
62
+ }
63
+ }
64
+
65
+ .tooltipped-multiline:hover,
66
+ .tooltipped-multiline:active,
67
+ .tooltipped-multiline:focus {
68
+ &::after {
69
+ display: table-cell;
70
+ }
71
+ }
72
+
73
+ // Tooltipped south
74
+ .tooltipped-s,
75
+ .tooltipped-se,
76
+ .tooltipped-sw {
77
+ &::after {
78
+ top: 100%;
79
+ right: 50%;
80
+ margin-top: 6px;
81
+ }
82
+ }
83
+
84
+ .tooltipped-se {
85
+ &::after {
86
+ right: auto;
87
+ left: 50%;
88
+ margin-left: calc(var(--base-size-16) * -1);
89
+ }
90
+ }
91
+
92
+ .tooltipped-sw::after {
93
+ margin-right: calc(var(--base-size-16) * -1);
94
+ }
95
+
96
+ // Tooltips above the object
97
+ .tooltipped-n,
98
+ .tooltipped-ne,
99
+ .tooltipped-nw {
100
+ &::after {
101
+ right: 50%;
102
+ bottom: 100%;
103
+ margin-bottom: 6px;
104
+ }
105
+ }
106
+
107
+ .tooltipped-ne {
108
+ &::after {
109
+ right: auto;
110
+ left: 50%;
111
+ margin-left: calc(var(--base-size-16) * -1);
112
+ }
113
+ }
114
+
115
+ .tooltipped-nw::after {
116
+ margin-right: calc(var(--base-size-16) * -1);
117
+ }
118
+
119
+ // Move the tooltip body to the center of the object.
120
+ .tooltipped-s::after,
121
+ .tooltipped-n::after {
122
+ transform: translateX(50%);
123
+ }
124
+
125
+ // Tooltipped to the left
126
+ .tooltipped-w {
127
+ &::after {
128
+ right: 100%;
129
+ bottom: 50%;
130
+ margin-right: 6px;
131
+ transform: translateY(50%);
132
+ }
133
+ }
134
+
135
+ // tooltipped to the right
136
+ .tooltipped-e {
137
+ &::after {
138
+ bottom: 50%;
139
+ left: 100%;
140
+ margin-left: 6px;
141
+ transform: translateY(50%);
142
+ }
143
+ }
144
+
145
+ // Tooltip align right and left
146
+ .tooltipped-align-right-1,
147
+ .tooltipped-align-right-2 {
148
+ &::after {
149
+ right: 0;
150
+ margin-right: 0;
151
+ }
152
+ }
153
+
154
+ .tooltipped-align-right-1 {
155
+ &::before {
156
+ right: 10px;
157
+ }
158
+ }
159
+
160
+ .tooltipped-align-right-2 {
161
+ &::before {
162
+ right: 15px;
163
+ }
164
+ }
165
+
166
+ .tooltipped-align-left-1,
167
+ .tooltipped-align-left-2 {
168
+ &::after {
169
+ left: 0;
170
+ margin-left: 0;
171
+ }
172
+ }
173
+
174
+ .tooltipped-align-left-1 {
175
+ &::before {
176
+ left: 5px;
177
+ }
178
+ }
179
+
180
+ .tooltipped-align-left-2 {
181
+ &::before {
182
+ left: 10px;
183
+ }
184
+ }
185
+
186
+ // Multiline tooltips
187
+ //
188
+ // `.tooltipped-multiline` Add this class when you have long content.
189
+ // The downside is you cannot preformat the text with newlines and `[w,e]`
190
+ // are always `$tooltip-max-width` wide.
191
+ .tooltipped-multiline {
192
+ &::after {
193
+ width: max-content;
194
+ max-width: var(--overlay-width-small, 20rem);
195
+ word-wrap: break-word;
196
+ white-space: pre-line;
197
+ // stylelint-disable-next-line primer/borders
198
+ border-collapse: separate;
199
+ }
200
+
201
+ &.tooltipped-s::after,
202
+ &.tooltipped-n::after {
203
+ right: auto;
204
+ left: 50%;
205
+ transform: translateX(-50%);
206
+ }
207
+
208
+ &.tooltipped-w::after,
209
+ &.tooltipped-e::after {
210
+ right: 100%;
211
+ }
212
+ }
213
+
214
+ // Sticky tooltips
215
+ //
216
+ // Always show the tooltip.
217
+ .tooltipped-sticky {
218
+ &::before,
219
+ &::after {
220
+ display: inline-block;
221
+ }
222
+
223
+ &.tooltipped-multiline {
224
+ &::after {
225
+ display: table-cell;
226
+ }
227
+ }
228
+ }