@papillonbits/components 0.7.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 (24) hide show
  1. package/build/index.scss +1 -1
  2. package/build/primer/BranchName/branch-name.scss +1 -0
  3. package/build/primer/Button/Button.scss +54 -27
  4. package/build/primer/Dropdown/Dropdown.scss +0 -2
  5. package/build/primer/Form/form-control.scss +24 -5
  6. package/build/primer/Form/form-group.scss +13 -2
  7. package/build/primer/Form/form-validation.scss +8 -3
  8. package/build/primer/Form/input-group.scss +18 -0
  9. package/build/primer/Navigation/Menu/Menu.scss +0 -6
  10. package/build/primer/Navigation/TabNav/TabNav.scss +7 -2
  11. package/build/primer/Navigation/UnderlineNav/UnderlineNav.scss +72 -23
  12. package/build/primer/Pagination/PreviousNext/PreviousNext.scss +0 -1
  13. package/build/primer/Popover/Popover.scss +1 -2
  14. package/build/primer/Toast/Toast.scss +1 -2
  15. package/package.json +4 -4
  16. package/build/primer/Form/Checkbox/__tests__/__snapshots__/Checkbox.int.test.js.snap +0 -75
  17. package/build/primer/Form/Input/__tests__/__snapshots__/Input.int.test.js.snap +0 -25
  18. package/build/primer/Form/Radio/__tests__/__snapshots__/Radio.int.test.js.snap +0 -65
  19. package/build/primer/Grid/DisplayTable/__tests__/__snapshots__/DisplayTable.int.test.js.snap +0 -326
  20. package/build/primer/Grid/FlexGrid/__tests__/__snapshots__/FlexGrid.int.test.js.snap +0 -6247
  21. package/build/primer/Navigation/Menu/__tests__/__snapshots__/Menu.int.test.js.snap +0 -114
  22. package/build/primer/Navigation/TabNav/__tests__/__snapshots__/TabNav.int.test.js.snap +0 -218
  23. package/build/primer/Navigation/UnderlineNav/__tests__/__snapshots__/UnderlineNav.int.test.js.snap +0 -259
  24. package/build/primer/Pagination/PreviousNext/__tests__/__snapshots__/PreviousNext.int.test.js.snap +0 -63
package/build/index.scss CHANGED
@@ -1 +1 @@
1
- @import '~@papillonbits/css/build/primer/index.scss';
1
+ @import '../../css/src/primer/index.scss';
@@ -10,6 +10,7 @@
10
10
  padding: 2px 6px;
11
11
  font: 12px $mono-font;
12
12
  color: var(--color-fg-muted);
13
+ word-break: break-all;
13
14
  background-color: var(--color-accent-subtle);
14
15
  border-radius: $border-radius;
15
16
 
@@ -69,8 +69,8 @@
69
69
  background-color: var(--color-btn-bg);
70
70
  border-color: var(--color-btn-border);
71
71
  box-shadow: var(--color-btn-shadow), var(--color-btn-inset-shadow);
72
- transition: 0.2s cubic-bezier(0.3, 0, 0.5, 1);
73
- transition-property: color, background-color, border-color;
72
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
73
+ transition-property: color, background-color, box-shadow, border-color;
74
74
 
75
75
  &:hover,
76
76
  &.hover,
@@ -103,14 +103,6 @@
103
103
  color: var(--color-primer-fg-disabled);
104
104
  }
105
105
  }
106
-
107
- // Keep :focus after :disabled. Allows to see the focus ring even on disabled buttons
108
- &:focus,
109
- &.focus {
110
- border-color: var(--color-btn-focus-border);
111
- outline: none;
112
- box-shadow: var(--color-btn-focus-shadow);
113
- }
114
106
  }
115
107
 
116
108
  // Primary button
@@ -128,6 +120,22 @@
128
120
  border-color: var(--color-btn-primary-hover-border);
129
121
  }
130
122
 
123
+ // fallback :focus state
124
+ &:focus {
125
+ @include focusOutlineOnEmphasis;
126
+
127
+ // remove fallback :focus if :focus-visible is supported
128
+ &:not(:focus-visible) {
129
+ outline: solid 1px transparent;
130
+ box-shadow: none;
131
+ }
132
+ }
133
+
134
+ // default focus state
135
+ &:focus-visible {
136
+ @include focusOutlineOnEmphasis;
137
+ }
138
+
131
139
  &:active,
132
140
  &.selected,
133
141
  &[aria-selected='true'] {
@@ -147,13 +155,6 @@
147
155
  }
148
156
  }
149
157
 
150
- &:focus,
151
- &.focus {
152
- background-color: var(--color-btn-primary-focus-bg);
153
- border-color: var(--color-btn-primary-focus-border);
154
- box-shadow: var(--color-btn-primary-focus-shadow);
155
- }
156
-
157
158
  .Counter {
158
159
  color: inherit;
159
160
  background-color: var(--color-btn-primary-counter-bg);
@@ -164,6 +165,26 @@
164
165
  }
165
166
  }
166
167
 
168
+ // ensure links styled as button primary gets proper focus style
169
+ // stylelint-disable-next-line selector-no-qualifying-type
170
+ a.btn-primary {
171
+ // fallback :focus state
172
+ &:focus {
173
+ @include focusOutlineOnEmphasis;
174
+
175
+ // remove fallback :focus if :focus-visible is supported
176
+ &:not(:focus-visible) {
177
+ outline: solid 1px transparent;
178
+ box-shadow: none;
179
+ }
180
+ }
181
+
182
+ // default focus state
183
+ &:focus-visible {
184
+ @include focusOutlineOnEmphasis;
185
+ }
186
+ }
187
+
167
188
  // Outline button
168
189
 
169
190
  .btn-outline {
@@ -192,6 +213,22 @@
192
213
  background-color: var(--color-btn-outline-selected-bg);
193
214
  border-color: var(--color-btn-outline-selected-border);
194
215
  box-shadow: var(--color-btn-outline-selected-shadow);
216
+
217
+ // fallback :focus state
218
+ &:focus {
219
+ @include focusOutlineOnEmphasis;
220
+
221
+ // remove fallback :focus if :focus-visible is supported
222
+ &:not(:focus-visible) {
223
+ outline: solid 1px transparent;
224
+ box-shadow: none;
225
+ }
226
+ }
227
+
228
+ // default focus state
229
+ &:focus-visible {
230
+ @include focusOutlineOnEmphasis;
231
+ }
195
232
  }
196
233
 
197
234
  &:disabled,
@@ -207,11 +244,6 @@
207
244
  }
208
245
  }
209
246
 
210
- &:focus {
211
- border-color: var(--color-btn-outline-focus-border);
212
- box-shadow: var(--color-btn-outline-focus-shadow);
213
- }
214
-
215
247
  .Counter {
216
248
  color: inherit;
217
249
  background-color: var(--color-btn-outline-counter-bg);
@@ -269,11 +301,6 @@
269
301
  }
270
302
  }
271
303
 
272
- &:focus {
273
- border-color: var(--color-btn-danger-focus-border);
274
- box-shadow: var(--color-btn-danger-focus-shadow);
275
- }
276
-
277
304
  .Counter {
278
305
  color: inherit;
279
306
  background-color: var(--color-btn-danger-counter-bg);
@@ -86,12 +86,10 @@
86
86
  text-overflow: ellipsis;
87
87
  white-space: nowrap;
88
88
 
89
- &:focus,
90
89
  &:hover {
91
90
  color: var(--color-fg-on-emphasis);
92
91
  text-decoration: none;
93
92
  background-color: var(--color-accent-emphasis);
94
- outline: none;
95
93
 
96
94
  > .octicon {
97
95
  color: inherit;
@@ -1,4 +1,5 @@
1
1
  // Needs refactoring
2
+ // stylelint-disable no-descending-specificity
2
3
  // stylelint-disable selector-no-qualifying-type, selector-max-compound-selectors
3
4
  // stylelint-disable selector-max-type
4
5
  // Base form controls
@@ -29,14 +30,32 @@ label {
29
30
  background-position: right 8px center; // For form validation. This keeps images 8px from right and centered vertically.
30
31
  border: $border-width $border-style var(--color-border-default);
31
32
  border-radius: $border-radius;
32
- outline: none;
33
33
  box-shadow: var(--color-primer-shadow-inset);
34
+ transition: 80ms cubic-bezier(0.33, 1, 0.68, 1);
35
+ transition-property: color, background-color, box-shadow, border-color;
34
36
 
35
- &.focus,
36
37
  &:focus {
37
- border-color: var(--color-accent-emphasis);
38
- outline: none;
39
- box-shadow: var(--color-primer-shadow-focus);
38
+ @include focusBoxShadowInset;
39
+
40
+ // remove fallback :focus if :focus-visible is supported
41
+ &:not(:focus-visible) {
42
+ border-color: transparent;
43
+
44
+ @include focusBoxShadowInset(1px, transparent);
45
+ }
46
+ }
47
+
48
+ // default focus state
49
+ &:focus-visible {
50
+ @include focusBoxShadowInset;
51
+ }
52
+
53
+ // override form controls with no border in focused state
54
+ &.border-0 {
55
+ &:focus,
56
+ &:focus-visible {
57
+ border: $border-width $border-style var(--color-accent-fg) !important;
58
+ }
40
59
  }
41
60
 
42
61
  &[disabled] {
@@ -15,8 +15,16 @@
15
15
  // stylelint-disable-next-line primer/spacing
16
16
  margin: 15px 0;
17
17
 
18
+ // Autocomplete with embedded icon
19
+ .form-control.autocomplete-embedded-icon-wrap {
20
+ &:focus-within {
21
+ background-color: var(--color-canvas-default);
22
+ }
23
+ }
24
+
18
25
  // Text fields
19
26
  .form-control {
27
+ // stylelint-disable-next-line primer/responsive-widths
20
28
  width: 440px;
21
29
  max-width: 100%;
22
30
  // stylelint-disable-next-line primer/spacing
@@ -210,6 +218,7 @@
210
218
  &::after {
211
219
  border-bottom-color: var(--color-success-subtle);
212
220
  }
221
+
213
222
  &::before {
214
223
  border-bottom-color: var(--color-success-muted);
215
224
  }
@@ -217,7 +226,7 @@
217
226
  }
218
227
 
219
228
  &.warn {
220
- .form-control {
229
+ .form-control:not(:focus, :focus-visible) {
221
230
  border-color: var(--color-attention-emphasis);
222
231
  }
223
232
 
@@ -230,6 +239,7 @@
230
239
  &::after {
231
240
  border-bottom-color: var(--color-attention-subtle);
232
241
  }
242
+
233
243
  &::before {
234
244
  border-bottom-color: var(--color-attention-muted);
235
245
  }
@@ -237,7 +247,7 @@
237
247
  }
238
248
 
239
249
  &.errored {
240
- .form-control {
250
+ .form-control:not(:focus, :focus-visible) {
241
251
  border-color: var(--color-danger-emphasis);
242
252
  }
243
253
 
@@ -254,6 +264,7 @@
254
264
  &::after {
255
265
  border-bottom-color: var(--color-danger-subtle);
256
266
  }
267
+
257
268
  &::before {
258
269
  border-bottom-color: var(--color-danger-muted);
259
270
  }
@@ -236,15 +236,20 @@ dl.form-group > dd, // TODO: Deprecate
236
236
  }
237
237
 
238
238
  &.focused {
239
+ border-color: var(--color-accent-fg);
239
240
  border-radius: $border-radius;
240
- box-shadow: var(--color-primer-shadow-inset), var(--color-primer-shadow-focus);
241
+ outline: none;
242
+ // stylelint-disable-next-line primer/box-shadow
243
+ box-shadow: 0 0 0 2px var(--color-accent-fg);
241
244
 
242
245
  .form-control {
246
+ border-color: transparent;
247
+ border-bottom-color: var(--color-accent-fg);
243
248
  box-shadow: none;
244
249
  }
245
250
 
246
251
  .drag-and-drop {
247
- border-color: var(--color-accent-emphasis);
252
+ border-color: transparent;
248
253
  }
249
254
  }
250
255
  }
@@ -320,8 +325,8 @@ div.composer {
320
325
  min-height: 200px;
321
326
  }
322
327
 
323
- // stylelint-disable-next-line primer/spacing
324
328
  .composer .tabnav {
329
+ // stylelint-disable-next-line primer/spacing
325
330
  margin: 0 0 10px;
326
331
  }
327
332
 
@@ -20,6 +20,20 @@
20
20
  &.inline {
21
21
  display: inline-table;
22
22
  }
23
+
24
+ // within input group, if button exists change focus styles to match input (no offset)
25
+ &:focus-within {
26
+ // stylelint-disable-next-line selector-max-type
27
+ button {
28
+ outline-offset: 0;
29
+ }
30
+ }
31
+
32
+ // Autocomplete with embedded icon
33
+ .form-control.autocomplete-embedded-icon-wrap {
34
+ display: inline-flex;
35
+ padding: $spacer-1 * 1.25 $spacer-2;
36
+ }
23
37
  }
24
38
 
25
39
  .input-group .form-control,
@@ -32,6 +46,10 @@
32
46
  vertical-align: middle; // Match the inputs
33
47
  }
34
48
 
49
+ .input-group-button--autocomplete-embedded-icon {
50
+ vertical-align: bottom;
51
+ }
52
+
35
53
  .input-group .form-control:first-child,
36
54
  .input-group-button:first-child .btn {
37
55
  border-top-right-radius: 0;
@@ -40,12 +40,6 @@
40
40
  }
41
41
  }
42
42
 
43
- &:focus {
44
- z-index: 1;
45
- outline: none;
46
- box-shadow: var(--color-primer-shadow-focus);
47
- }
48
-
49
43
  &:hover {
50
44
  text-decoration: none;
51
45
  background-color: var(--color-neutral-subtle);
@@ -44,13 +44,18 @@
44
44
  }
45
45
  }
46
46
 
47
- &:hover,
48
- &:focus {
47
+ &:hover {
49
48
  color: var(--color-fg-default);
50
49
  text-decoration: none;
51
50
  transition-duration: 0.1s;
52
51
  }
53
52
 
53
+ &:focus,
54
+ &:focus-visible {
55
+ border-radius: $border-radius $border-radius 0 0 !important;
56
+ outline-offset: -6px;
57
+ }
58
+
54
59
  &:active {
55
60
  color: var(--color-fg-muted);
56
61
  }
@@ -2,54 +2,107 @@
2
2
  @import '../../../index.scss';
3
3
 
4
4
  // stylelint-disable no-descending-specificity
5
+ $nav-height: $spacer-3 * 3 !default; // 48px
5
6
 
6
7
  .UnderlineNav {
7
8
  display: flex;
9
+ min-height: $nav-height;
8
10
  overflow-x: auto;
9
11
  overflow-y: hidden;
10
12
  // stylelint-disable-next-line primer/box-shadow
11
13
  box-shadow: inset 0 -1px 0 var(--color-border-muted);
14
+ -webkit-overflow-scrolling: auto;
12
15
  justify-content: space-between;
16
+
17
+ .Counter {
18
+ margin-left: $spacer-2;
19
+ color: var(--color-fg-default);
20
+ background-color: var(--color-neutral-muted);
21
+
22
+ &--primary {
23
+ color: var(--color-fg-on-emphasis);
24
+ background-color: var(--color-neutral-emphasis);
25
+ }
26
+ }
13
27
  }
14
28
 
15
29
  .UnderlineNav-body {
16
30
  display: flex;
31
+ align-items: center;
32
+ gap: $spacer-2;
33
+ list-style: none;
17
34
  }
18
35
 
19
36
  .UnderlineNav-item {
20
- padding: $spacer-2 $spacer-3;
37
+ position: relative;
38
+ display: flex;
39
+ padding: 0 $spacer-2;
21
40
  font-size: $body-font-size;
22
41
  // stylelint-disable-next-line primer/typography
23
42
  line-height: 30px;
24
43
  color: var(--color-fg-default);
25
44
  text-align: center;
26
45
  white-space: nowrap;
46
+ cursor: pointer;
27
47
  background-color: transparent;
28
48
  border: 0;
29
- // stylelint-disable-next-line primer/borders
30
- border-bottom: 2px $border-style transparent;
49
+ border-radius: $border-radius;
50
+ align-items: center;
31
51
 
32
52
  &:hover,
33
- &:focus {
53
+ &:focus,
54
+ &:focus-visible {
34
55
  color: var(--color-fg-default);
35
56
  text-decoration: none;
36
57
  border-bottom-color: var(--color-neutral-muted);
37
- outline: 1px dotted transparent; // Support Firefox custom colors
38
- outline-offset: -1px;
58
+ outline-offset: -2px;
39
59
  transition: border-bottom-color 0.12s ease-out;
40
60
  }
41
61
 
62
+ // renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected
63
+ [data-content]::before {
64
+ display: block;
65
+ height: 0;
66
+ font-weight: $font-weight-bold;
67
+ visibility: hidden;
68
+ content: attr(data-content);
69
+ }
70
+
71
+ // increase touch target area
72
+ &::before {
73
+ @include minTouchTarget($min-height: $nav-height);
74
+ }
75
+
76
+ // hover state was "sticking" on mobile after click
77
+ @media (pointer: fine) {
78
+ &:hover {
79
+ color: var(--color-fg-default);
80
+ text-decoration: none;
81
+ background: var(--color-action-list-item-default-hover-bg);
82
+ transition: background 0.12s ease-out;
83
+ }
84
+ }
85
+
42
86
  &.selected,
43
87
  &[role='tab'][aria-selected='true'],
44
88
  &[aria-current]:not([aria-current='false']) {
45
89
  font-weight: $font-weight-bold;
46
90
  color: var(--color-fg-default);
47
91
  border-bottom-color: var(--color-primer-border-active);
48
- outline: 1px dotted transparent; // Support Firefox custom colors
49
- outline-offset: -1px;
92
+ outline-offset: -8px;
50
93
 
51
- .UnderlineNav-octicon {
52
- color: var(--color-fg-muted);
94
+ // current/selected underline
95
+ &::after {
96
+ position: absolute;
97
+ right: 50%;
98
+ // 48px total height / 2 (24px) + 1px
99
+ bottom: calc(50% - 25px);
100
+ width: 100%;
101
+ height: 2px;
102
+ content: '';
103
+ background: var(--color-primer-border-active);
104
+ border-radius: $border-radius;
105
+ transform: translate(50%, -50%);
53
106
  }
54
107
  }
55
108
  }
@@ -68,22 +121,18 @@
68
121
 
69
122
  .UnderlineNav--full {
70
123
  display: block;
71
- }
72
124
 
73
- .UnderlineNav-octicon {
74
- margin-right: $spacer-1;
75
- color: var(--color-fg-subtle);
125
+ // required for underline to align with additional wrapper element
126
+ .UnderlineNav-body {
127
+ min-height: $nav-height;
128
+ }
76
129
  }
77
130
 
78
- .UnderlineNav .Counter {
79
- margin-left: $spacer-1;
80
- color: var(--color-fg-default);
81
- background-color: var(--color-neutral-muted);
82
-
83
- &--primary {
84
- color: var(--color-fg-on-emphasis);
85
- background-color: var(--color-neutral-emphasis);
86
- }
131
+ .UnderlineNav-octicon {
132
+ display: inline !important;
133
+ margin-right: $spacer-2;
134
+ color: var(--color-fg-muted);
135
+ fill: var(--color-fg-muted);
87
136
  }
88
137
 
89
138
  .UnderlineNav-container {
@@ -26,7 +26,6 @@
26
26
  &:focus {
27
27
  text-decoration: none;
28
28
  border-color: var(--color-border-default);
29
- outline: 0;
30
29
  transition-duration: 0.1s;
31
30
  }
32
31
 
@@ -1,7 +1,5 @@
1
1
  @import '../../index.scss';
2
2
 
3
- // stylelint-disable function-no-unknown
4
-
5
3
  .Popover {
6
4
  position: absolute;
7
5
  z-index: 100;
@@ -126,6 +124,7 @@
126
124
  }
127
125
 
128
126
  &::before {
127
+ // stylelint-disable-next-line function-no-unknown
129
128
  margin-top: -($spacer-2 + 1);
130
129
  }
131
130
 
@@ -42,9 +42,7 @@
42
42
  background-color: transparent;
43
43
  border: 0;
44
44
 
45
- &:focus,
46
45
  &:hover {
47
- outline: none;
48
46
  opacity: 0.7;
49
47
  }
50
48
 
@@ -124,6 +122,7 @@
124
122
  from {
125
123
  transform: rotate(0deg);
126
124
  }
125
+
127
126
  to {
128
127
  transform: rotate(360deg);
129
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@papillonbits/components",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Papillon Bits Components",
5
5
  "homepage": "https://github.com/papillonbits/papillonbits/tree/master/packages/components",
6
6
  "repository": {
@@ -29,8 +29,8 @@
29
29
  "build-release": "npm run build"
30
30
  },
31
31
  "dependencies": {
32
- "@papillonbits/css": "^0.7.0",
33
- "@papillonbits/library": "^0.7.0"
32
+ "@papillonbits/css": "^0.8.0",
33
+ "@papillonbits/library": "^0.8.0"
34
34
  },
35
- "gitHead": "df7997ecded1ad74bb4f697d79b1d5d2e316526d"
35
+ "gitHead": "a1b80ef4af73c00ad9edddcaefbe25f3b8e1a9d8"
36
36
  }
@@ -1,75 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Checkbox /> Render must match isChecked() 1`] = `
4
- <div>
5
- <div
6
- class="m-0 form-checkbox"
7
- >
8
- <label
9
- for="checkbox"
10
- >
11
- <input
12
- aria-describedby="help-text-for-checkbox"
13
- checked=""
14
- type="checkbox"
15
- />
16
- is checked
17
- </label>
18
- </div>
19
- </div>
20
- `;
21
-
22
- exports[`<Checkbox /> Render must match isCheckedInactive() 1`] = `
23
- <div>
24
- <div
25
- class="m-0 form-checkbox checkbox-inactive"
26
- >
27
- <label
28
- for="checkbox"
29
- >
30
- <input
31
- aria-describedby="help-text-for-checkbox"
32
- checked=""
33
- type="checkbox"
34
- />
35
- is checked
36
- </label>
37
- </div>
38
- </div>
39
- `;
40
-
41
- exports[`<Checkbox /> Render must match isNotChecked() 1`] = `
42
- <div>
43
- <div
44
- class="m-0 form-checkbox"
45
- >
46
- <label
47
- for="checkbox"
48
- >
49
- <input
50
- aria-describedby="help-text-for-checkbox"
51
- type="checkbox"
52
- />
53
- is not checked
54
- </label>
55
- </div>
56
- </div>
57
- `;
58
-
59
- exports[`<Checkbox /> Render must match isNotCheckedInactive() 1`] = `
60
- <div>
61
- <div
62
- class="m-0 form-checkbox checkbox-inactive"
63
- >
64
- <label
65
- for="checkbox"
66
- >
67
- <input
68
- aria-describedby="help-text-for-checkbox"
69
- type="checkbox"
70
- />
71
- is not checked
72
- </label>
73
- </div>
74
- </div>
75
- `;
@@ -1,25 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<Input /> Render must match inactive() 1`] = `
4
- <div>
5
- <input
6
- aria-label="Repository description"
7
- class="form-control input-inactive"
8
- placeholder="Fantastic placeholder"
9
- type="text"
10
- value=""
11
- />
12
- </div>
13
- `;
14
-
15
- exports[`<Input /> Render must match regular() 1`] = `
16
- <div>
17
- <input
18
- aria-label="Repository description"
19
- class="form-control"
20
- placeholder="Fantastic placeholder"
21
- type="text"
22
- value=""
23
- />
24
- </div>
25
- `;