@papillonbits/css 0.1.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 (33) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/build/index.scss +1 -0
  4. package/build/primer/base/base.scss +89 -0
  5. package/build/primer/base/index.scss +6 -0
  6. package/build/primer/base/kbd.scss +23 -0
  7. package/build/primer/base/normalize.scss +421 -0
  8. package/build/primer/base/octicons.scss +6 -0
  9. package/build/primer/base/typography-base.scss +92 -0
  10. package/build/primer/index.scss +6 -0
  11. package/build/primer/support/index.scss +10 -0
  12. package/build/primer/support/mixins/color-modes.scss +109 -0
  13. package/build/primer/support/mixins/layout.scss +60 -0
  14. package/build/primer/support/mixins/misc.scss +27 -0
  15. package/build/primer/support/mixins/typography.scss +87 -0
  16. package/build/primer/support/variables/layout.scss +201 -0
  17. package/build/primer/support/variables/misc.scss +17 -0
  18. package/build/primer/support/variables/typography.scss +43 -0
  19. package/build/primer/truncate/index.scss +2 -0
  20. package/build/primer/truncate/truncate.scss +61 -0
  21. package/build/primer/utilities/animations.scss +196 -0
  22. package/build/primer/utilities/borders.scss +79 -0
  23. package/build/primer/utilities/box-shadow.scss +27 -0
  24. package/build/primer/utilities/colors.scss +95 -0
  25. package/build/primer/utilities/details.scss +28 -0
  26. package/build/primer/utilities/flexbox.scss +54 -0
  27. package/build/primer/utilities/index.scss +14 -0
  28. package/build/primer/utilities/layout.scss +98 -0
  29. package/build/primer/utilities/margin.scss +74 -0
  30. package/build/primer/utilities/padding.scss +59 -0
  31. package/build/primer/utilities/typography.scss +248 -0
  32. package/build/primer/utilities/visibility-display.scss +125 -0
  33. package/package.json +27 -0
@@ -0,0 +1,109 @@
1
+ @mixin color-mode-theme($theme-name, $include-root: false) {
2
+ @if $include-root {
3
+ :root,
4
+ [data-color-mode="light"][data-light-theme="#{$theme-name}"],
5
+ [data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
6
+ @content;
7
+
8
+ /*! */ // This is a fix for a cssstats bug see https://github.com/cssstats/cssstats/issues/331
9
+ }
10
+ }
11
+
12
+ @else {
13
+ [data-color-mode="light"][data-light-theme="#{$theme-name}"],
14
+ [data-color-mode="dark"][data-dark-theme="#{$theme-name}"] {
15
+ @content;
16
+ }
17
+ }
18
+
19
+ @media (prefers-color-scheme: light) {
20
+ [data-color-mode="auto"][data-light-theme="#{$theme-name}"] {
21
+ @content;
22
+ }
23
+ }
24
+
25
+ @media (prefers-color-scheme: dark) {
26
+ [data-color-mode="auto"][data-dark-theme="#{$theme-name}"] {
27
+ @content;
28
+ }
29
+ }
30
+ }
31
+
32
+ @mixin color-mode($mode) {
33
+ @if $mode == light {
34
+ :root,
35
+ [data-color-mode="light"][data-light-theme*="#{$mode}"],
36
+ [data-color-mode="dark"][data-dark-theme*="#{$mode}"] {
37
+ @content;
38
+ }
39
+ }
40
+
41
+ @else {
42
+ [data-color-mode="light"][data-light-theme*="#{$mode}"],
43
+ [data-color-mode="dark"][data-dark-theme*="#{$mode}"] {
44
+ @content;
45
+ }
46
+ }
47
+
48
+ @media (prefers-color-scheme: light) {
49
+ [data-color-mode="auto"][data-light-theme*="#{$mode}"] {
50
+ @content;
51
+ }
52
+ }
53
+
54
+ @media (prefers-color-scheme: dark) {
55
+ [data-color-mode="auto"][data-dark-theme*="#{$mode}"] {
56
+ @content;
57
+ }
58
+ }
59
+ }
60
+
61
+ // This mixin takes a map of color mode vars and splits them into dark and light mode
62
+ // The goal is to reduce the amount of dark/light mode selectors compiled.
63
+ //
64
+ // Example input for $color-map
65
+ //
66
+ // @include color-variables(("custom-css-variable-1": (
67
+ // light: var(--color-scale-gray-3),
68
+ // dark: var(--color-scale-gray-5)
69
+ // ),
70
+ // "custom-css-variable-2": (
71
+ // light: var(--color-scale-gray-2),
72
+ // dark: var(--color-scale-gray-6)
73
+ // ),
74
+ // "custom-css-variable-3": (
75
+ // light: var(--color-scale-gray-2),
76
+ // dark: var(--color-scale-gray-6)
77
+ // )
78
+ // ));
79
+ @mixin color-variables($color-map) {
80
+ // Create map to store incoming variables
81
+ $dark-colors: ();
82
+ $light-colors: ();
83
+
84
+ @each $name, $value in $color-map {
85
+ @each $type, $color in $value {
86
+ @if $type == dark {
87
+ $dark-colors: append($dark-colors, (--color-#{$name}, #{$color}));
88
+ }
89
+
90
+ @else {
91
+ $light-colors: append($light-colors, (--color-#{$name}, #{$color}));
92
+ }
93
+ }
94
+ }
95
+
96
+ $mode-colors: (
97
+ dark: $dark-colors,
98
+ light: $light-colors
99
+ );
100
+
101
+ // Loop through sorted list
102
+ @each $mode, $variables in $mode-colors {
103
+ @include color-mode($mode) {
104
+ @each $prop, $val in $variables {
105
+ #{$prop}: $val;
106
+ }
107
+ }
108
+ }
109
+ }
@@ -0,0 +1,60 @@
1
+ @import "../variables/layout.scss";
2
+
3
+ // Responsive media queries
4
+
5
+ @mixin breakpoint($breakpoint) {
6
+ @if $breakpoint == '' {
7
+ @content;
8
+ }
9
+
10
+ @else {
11
+ // Retrieves the value from the key
12
+ $value: map-get($breakpoints, $breakpoint);
13
+
14
+ // If the key exists in the map
15
+ @if $value != null {
16
+ // Prints a media query based on the value
17
+ @media (min-width: $value) {
18
+ @content;
19
+ }
20
+ }
21
+
22
+ // If the key doesn't exist in the map
23
+ @else {
24
+ @warn 'Unfortunately, no value could be retrieved from `#{$breakpoint}`. '
25
+ + 'Please make sure it is defined in `$breakpoints` map.';
26
+ }
27
+ }
28
+ }
29
+
30
+ // Retina media query
31
+
32
+ @mixin retina-media-query {
33
+ @media
34
+ only screen and (-webkit-min-device-pixel-ratio: 2),
35
+ only screen and (min--moz-device-pixel-ratio: 2),
36
+ only screen and (-moz-min-device-pixel-ratio: 2),
37
+ only screen and (-o-min-device-pixel-ratio: 2/1),
38
+ only screen and (min-device-pixel-ratio: 2),
39
+ only screen and (min-resolution: 192dpi),
40
+ only screen and (min-resolution: 2dppx) {
41
+ @content;
42
+ }
43
+ }
44
+
45
+ // Clearfix
46
+ //
47
+ // Clears floats via mixin.
48
+
49
+ @mixin clearfix {
50
+ &::before {
51
+ display: table;
52
+ content: '';
53
+ }
54
+
55
+ &::after {
56
+ display: table;
57
+ clear: both;
58
+ content: '';
59
+ }
60
+ }
@@ -0,0 +1,27 @@
1
+ // Generate a two-color caret for any element.
2
+ @mixin double-caret($background: var(--color-canvas-default), $border: var(--color-border-default)) {
3
+ &::after,
4
+ &::before {
5
+ position: absolute;
6
+ top: 11px;
7
+ right: 100%;
8
+ left: -8px;
9
+ display: block;
10
+ width: 8px;
11
+ height: 16px;
12
+ pointer-events: none;
13
+ content: ' ';
14
+ clip-path: polygon(0 50%, 100% 0, 100% 100%);
15
+ }
16
+
17
+ &::after {
18
+ // stylelint-disable-next-line primer/spacing
19
+ margin-left: 1px;
20
+ background-color: var(--color-canvas-default);
21
+ background-image: linear-gradient($background, $background);
22
+ }
23
+
24
+ &::before {
25
+ background-color: $border;
26
+ }
27
+ }
@@ -0,0 +1,87 @@
1
+ @import "../variables/typography.scss";
2
+
3
+ // Text hiding for image based text replacement.
4
+ // Higher performance than -9999px because it only renders
5
+ // the size of the actual text, not a full 9999px box.
6
+ @mixin hide-text() {
7
+ overflow: hidden;
8
+ text-indent: 100%;
9
+ white-space: nowrap;
10
+ }
11
+
12
+ // Heading mixins for use within components
13
+ // These match heading utilities in utilities/typography
14
+ @mixin h1 {
15
+ font-size: $h1-size;
16
+ font-weight: $font-weight-bold;
17
+ }
18
+
19
+ @mixin h2 {
20
+ font-size: $h2-size;
21
+ font-weight: $font-weight-bold;
22
+ }
23
+
24
+ @mixin h3 {
25
+ font-size: $h3-size;
26
+ font-weight: $font-weight-bold;
27
+ }
28
+
29
+ @mixin h4 {
30
+ font-size: $h4-size;
31
+ font-weight: $font-weight-bold;
32
+ }
33
+
34
+ @mixin h5 {
35
+ font-size: $h5-size;
36
+ font-weight: $font-weight-bold;
37
+ }
38
+
39
+ @mixin h6 {
40
+ font-size: $h6-size;
41
+ font-weight: $font-weight-bold;
42
+ }
43
+
44
+ // Responsive heading mixins
45
+ // There are no responsive mixins for h4-h6 because they are small
46
+ // and don't need to be smaller on mobile.
47
+ @mixin f1-responsive {
48
+ font-size: $h1-size-mobile;
49
+
50
+ // 32px on desktop
51
+ @include breakpoint(md) { font-size: $h1-size; }
52
+ }
53
+
54
+ @mixin f2-responsive {
55
+ font-size: $h2-size-mobile;
56
+
57
+ // 24px on desktop
58
+ @include breakpoint(md) { font-size: $h2-size; }
59
+ }
60
+
61
+ @mixin f3-responsive {
62
+ font-size: $h3-size-mobile;
63
+
64
+ // 20px on desktop
65
+ @include breakpoint(md) { font-size: $h3-size; }
66
+ }
67
+
68
+ // These use the mixins from above for responsive heading sizes.
69
+ // The following mixins can be used where it's convenient or necessary to
70
+ // couple the responsive font-size with the font-weight.
71
+ @mixin h1-responsive {
72
+ @include f1-responsive;
73
+
74
+ font-weight: $font-weight-bold;
75
+ }
76
+
77
+ @mixin h2-responsive {
78
+ @include f2-responsive;
79
+
80
+ font-weight: $font-weight-bold;
81
+ }
82
+
83
+ @mixin h3-responsive {
84
+ @include f3-responsive;
85
+
86
+ font-weight: $font-weight-bold;
87
+ }
@@ -0,0 +1,201 @@
1
+ // Layout variables
2
+
3
+ // these are values for the display CSS property
4
+ $display-values: (
5
+ block,
6
+ flex,
7
+ inline,
8
+ inline-block,
9
+ inline-flex,
10
+ none,
11
+ table,
12
+ table-cell
13
+ ) !default;
14
+
15
+ // maps edges to respective corners for border-radius
16
+ $edges: (
17
+ top: (top-left, top-right),
18
+ right: (top-right, bottom-right),
19
+ bottom: (bottom-right, bottom-left),
20
+ left: (bottom-left, top-left)
21
+ ) !default;
22
+
23
+ // These are our margin and padding utility spacers. The default step size we
24
+ // use is 8px. This gives us a key of:
25
+ // 0 => 0px
26
+ // 1 => 4px
27
+ // 2 => 8px
28
+ // 3 => 16px
29
+ // 4 => 24px
30
+ // 5 => 32px
31
+ // 6 => 40px
32
+ $spacer: 8px !default;
33
+
34
+ // Our spacing scale
35
+ $spacer-0: 0 !default; // 0
36
+ $spacer-1: $spacer * 0.5 !default; // 4px
37
+ $spacer-2: $spacer !default; // 8px
38
+ $spacer-3: $spacer * 2 !default; // 16px
39
+ $spacer-4: $spacer * 3 !default; // 24px
40
+ $spacer-5: $spacer * 4 !default; // 32px
41
+ $spacer-6: $spacer * 5 !default; // 40px
42
+
43
+ // The list of spacer values
44
+ $spacers: (
45
+ $spacer-0,
46
+ $spacer-1,
47
+ $spacer-2,
48
+ $spacer-3,
49
+ $spacer-4,
50
+ $spacer-5,
51
+ $spacer-6,
52
+ ) !default;
53
+
54
+ // And the map of spacers, for easier looping:
55
+ // @each $scale, $length in $spacer-map { ... }
56
+ $spacer-map: (
57
+ 0: $spacer-0,
58
+ 1: $spacer-1,
59
+ 2: $spacer-2,
60
+ 3: $spacer-3,
61
+ 4: $spacer-4,
62
+ 5: $spacer-5,
63
+ 6: $spacer-6,
64
+ ) !default;
65
+
66
+ // Increases the core spacing scale first by 8px for $spacer-7, then by 16px
67
+ // increments from $spacer-8 to $spacer-12, i.e. after 40px, we have 48, 64,
68
+ // 80, 96, etc.
69
+ $spacer-7: $spacer * 6 !default; // 48px
70
+ $spacer-8: $spacer * 8 !default; // 64px
71
+ $spacer-9: $spacer * 10 !default; // 80px
72
+ $spacer-10: $spacer * 12 !default; // 96px
73
+ $spacer-11: $spacer * 14 !default; // 112px
74
+ $spacer-12: $spacer * 16 !default; // 128px
75
+
76
+ $spacers-large: (
77
+ 7: $spacer-7,
78
+ 8: $spacer-8,
79
+ 9: $spacer-9,
80
+ 10: $spacer-10,
81
+ 11: $spacer-11,
82
+ 12: $spacer-12,
83
+ ) !default;
84
+
85
+ $spacer-map-extended: map-merge(
86
+ (
87
+ 0: 0,
88
+ 1: $spacer-1,
89
+ 2: $spacer-2,
90
+ 3: $spacer-3,
91
+ 4: $spacer-4,
92
+ 5: $spacer-5,
93
+ 6: $spacer-6,
94
+ ),
95
+ $spacers-large,
96
+ ) !default;
97
+
98
+ // Em spacer variables
99
+ $em-spacer-1: 0.0625em !default; // 1/16
100
+ $em-spacer-2: 0.125em !default; // 1/8
101
+ $em-spacer-3: 0.25em !default; // 1/4
102
+ $em-spacer-4: 0.375em !default; // 3/8
103
+ $em-spacer-5: 0.5em !default; // 1/2
104
+ $em-spacer-6: 0.75em !default; // 3/4
105
+
106
+ // Size scale
107
+ // Used for buttons, inputs, labels, avatars etc.
108
+ $size: 16px !default;
109
+
110
+ $size-0: 0 !default;
111
+ $size-1: $size !default; // 16px
112
+ $size-2: $size-1 + 4px !default; // 20px
113
+ $size-3: $size-2 + 4px !default; // 24px
114
+ $size-4: $size-3 + 4px !default; // 28px
115
+ $size-5: $size-4 + 4px !default; // 32px
116
+ $size-6: $size-5 + 8px !default; // 40px
117
+ $size-7: $size-6 + 8px !default; // 48px
118
+ $size-8: $size-7 + 16px !default; // 64px
119
+
120
+ // Fixed-width container variables
121
+ $container-width: 980px !default;
122
+ $grid-gutter: 10px !default;
123
+
124
+ // Breakpoint widths
125
+ $width-xs: 0 !default;
126
+ // Small screen / phone
127
+ $width-sm: 544px !default;
128
+ // Medium screen / tablet
129
+ $width-md: 768px !default;
130
+ // Large screen / desktop (980 + (16 * 2)) <= container + gutters
131
+ $width-lg: 1012px !default;
132
+ // Extra large screen / wide desktop
133
+ $width-xl: 1280px !default;
134
+
135
+ // Responsive container widths
136
+ $container-sm: $width-sm !default;
137
+ $container-md: $width-md !default;
138
+ $container-lg: $width-lg !default;
139
+ $container-xl: $width-xl !default;
140
+
141
+ // Breakpoints in the form (name: length)
142
+ $breakpoints: (
143
+ sm: $width-sm,
144
+ md: $width-md,
145
+ lg: $width-lg,
146
+ xl: $width-xl
147
+ ) !default;
148
+
149
+ // This map in the form (breakpoint: variant) is used to iterate over
150
+ // breakpoints and create both responsive and non-responsive classes in one
151
+ // loop:
152
+ $responsive-variants: (
153
+ '': '',
154
+ sm: '-sm',
155
+ md: '-md',
156
+ lg: '-lg',
157
+ xl: '-xl',
158
+ ) !default;
159
+
160
+ // responsive utility position values
161
+ $responsive-positions: (
162
+ static,
163
+ relative,
164
+ absolute,
165
+ fixed,
166
+ sticky
167
+ ) !default;
168
+
169
+ $sidebar-width: (
170
+ sm: 220px,
171
+ md: 256px,
172
+ lg: 296px
173
+ ) !default;
174
+
175
+ $sidebar-narrow-width: (
176
+ md: 240px,
177
+ lg: 256px
178
+ ) !default;
179
+
180
+ $sidebar-wide-width: (
181
+ lg: 320px,
182
+ xl: 336px
183
+ ) !default;
184
+
185
+ $gutter: (
186
+ md: $spacer-3,
187
+ lg: $spacer-4,
188
+ xl: $spacer-5
189
+ ) !default;
190
+
191
+ $gutter-condensed: (
192
+ md: $spacer-3,
193
+ lg: $spacer-3,
194
+ xl: $spacer-4
195
+ ) !default;
196
+
197
+ $gutter-spacious: (
198
+ md: $spacer-4,
199
+ lg: $spacer-5,
200
+ xl: $spacer-6
201
+ ) !default;
@@ -0,0 +1,17 @@
1
+ // Miscellaneous variables
2
+
3
+ // Border
4
+ $border-width: 1px !default;
5
+ $border-style: solid !default;
6
+ $border: $border-width $border-style var(--color-border-default) !default;
7
+
8
+ // Border Radius
9
+ $border-radius-1: 4px !default;
10
+ $border-radius-2: 6px !default;
11
+ $border-radius-3: 8px !default;
12
+ $border-radius: $border-radius-2 !default;
13
+
14
+ // Tooltips
15
+ $tooltip-max-width: 250px !default;
16
+ $tooltip-delay: 0.4s !default;
17
+ $tooltip-duration: 0.1s !default;
@@ -0,0 +1,43 @@
1
+ // Typography variables
2
+
3
+ // Heading sizes - mobile
4
+ // h4-h6 remain the same size on both mobile & desktop
5
+ $h00-size-mobile: 40px !default;
6
+ $h0-size-mobile: 32px !default;
7
+ $h1-size-mobile: 26px !default;
8
+ $h2-size-mobile: 22px !default;
9
+ $h3-size-mobile: 18px !default;
10
+
11
+ // Heading sizes - desktop
12
+ $h00-size: 48px !default;
13
+ $h0-size: 40px !default;
14
+ $h1-size: 32px !default;
15
+ $h2-size: 24px !default;
16
+ $h3-size: 20px !default;
17
+ $h4-size: 16px !default;
18
+ $h5-size: 14px !default;
19
+ $h6-size: 12px !default;
20
+
21
+ $font-size-small: 12px !default;
22
+
23
+ // Font weights
24
+ $font-weight-bold: 600 !default;
25
+ $font-weight-semibold: 500 !default;
26
+ $font-weight-normal: 400 !default;
27
+ $font-weight-light: 300 !default;
28
+
29
+ // Line heights
30
+ $lh-condensed-ultra: 1 !default;
31
+ $lh-condensed: 1.25 !default;
32
+ $lh-default: 1.5 !default;
33
+
34
+ // Font stacks
35
+ $body-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji' !default;
36
+
37
+ // Monospace font stack
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;
40
+
41
+ // The base body size
42
+ $body-font-size: 14px !default;
43
+ $body-line-height: $lh-default !default;
@@ -0,0 +1,2 @@
1
+ @import '../support/index.scss';
2
+ @import './truncate.scss';
@@ -0,0 +1,61 @@
1
+ // Truncate
2
+ //
3
+ // css-truncate will shorten text with an ellipsis.
4
+
5
+ .css-truncate {
6
+
7
+ // css-truncate-auto will shorten text with an ellipsis when overflowing
8
+ &.css-truncate-overflow,
9
+ .css-truncate-overflow,
10
+ &.css-truncate-target,
11
+ .css-truncate-target {
12
+ overflow: hidden;
13
+ text-overflow: ellipsis;
14
+ white-space: nowrap;
15
+ }
16
+
17
+ // css-truncate-target will shorten text with an ellipsis and a max width
18
+ &.css-truncate-target,
19
+ .css-truncate-target {
20
+ display: inline-block;
21
+ max-width: 125px;
22
+ vertical-align: top;
23
+ }
24
+
25
+ &.expandable.zeroclipboard-is-hover .css-truncate-target,
26
+ &.expandable.zeroclipboard-is-hover.css-truncate-target,
27
+ &.expandable:hover .css-truncate-target,
28
+ &.expandable:hover.css-truncate-target {
29
+ max-width: 10000px !important;
30
+ }
31
+ }
32
+
33
+ .Truncate {
34
+ display: inline-flex;
35
+ min-width: 0;
36
+ max-width: 100%;
37
+
38
+ > .Truncate-text {
39
+ min-width: 1ch;
40
+ max-width: fit-content;
41
+ overflow: hidden;
42
+ text-overflow: ellipsis;
43
+ white-space: nowrap;
44
+
45
+ + .Truncate-text {
46
+ margin-left: $spacer-1;
47
+ }
48
+
49
+ &.Truncate-text--primary {
50
+ flex-basis: 200%;
51
+ }
52
+
53
+ &.Truncate-text--expandable:hover,
54
+ &.Truncate-text--expandable:focus,
55
+ &.Truncate-text--expandable:active {
56
+ max-width: 100% !important;
57
+ flex-shrink: 0;
58
+ cursor: pointer;
59
+ }
60
+ }
61
+ }