@gitlab/ui 107.1.1 → 107.2.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "107.1.1",
3
+ "version": "107.2.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -32,7 +32,6 @@
32
32
  "build": "NODE_ENV=production rollup -c",
33
33
  "prebuild": "run-s build-tokens build-migration-script",
34
34
  "prepare": "run-s build-tokens",
35
- "postinstall": "patch-package --error-on-fail --error-on-warn",
36
35
  "copy-fonts": "make copy-fonts",
37
36
  "build-tokens": "node ./bin/build_tokens.mjs",
38
37
  "build-migration-script": "esbuild --bundle --platform=node --target=esnext --outfile=bin/migrate_custom_utils_to_tw.bundled.mjs --format=esm --banner:js=\"import { createRequire as __gl__createRequire } from 'node:module'; const require = __gl__createRequire(import.meta.url);\" bin/migrate_custom_utils_to_tw.mjs",
@@ -43,7 +42,8 @@
43
42
  "start": "yarn storybook",
44
43
  "storybook": "yarn storybook:prepare && storybook dev --ci --host ${STORYBOOK_HOST:-localhost} --port 9001 -c .storybook",
45
44
  "storybook-vue3": "yarn storybook:prepare && VUE_VERSION=3 storybook dev --ci --host ${STORYBOOK_HOST:-localhost} --port 9001 -c .storybook",
46
- "storybook:prepare": "run-s copy-fonts build-tokens",
45
+ "storybook:patch": "patch-package --error-on-fail --error-on-warn",
46
+ "storybook:prepare": "run-s storybook:patch copy-fonts build-tokens",
47
47
  "storybook:build:prod": "yarn storybook:prepare && storybook build -c .storybook -o storybook",
48
48
  "storybook:build:test": "yarn storybook:prepare && IS_VISUAL_TEST=true NODE_ENV=test storybook build --test -c .storybook -o storybook",
49
49
  "storybook:run": "npx http-server -bgs -p 9001 ./storybook",
@@ -39,6 +39,12 @@
39
39
  @include gl-button-border($border-color);
40
40
  }
41
41
 
42
+ &::before {
43
+ background-color: $border-color;
44
+ transition: background-color $gl-transition-duration-medium $gl-easing-out-cubic,
45
+ border-color $gl-transition-duration-medium $gl-easing-out-cubic;
46
+ }
47
+
42
48
  &:hover {
43
49
  color: $hover-color;
44
50
  background-color: $hover-background-color;
@@ -223,6 +229,12 @@
223
229
  }
224
230
  }
225
231
 
232
+ &.btn-reset {
233
+ &::before {
234
+ background-color: var(--gl-button-default-primary-border-color-default);
235
+ }
236
+ }
237
+
226
238
  &.btn-default-tertiary,
227
239
  &.btn-dashed {
228
240
  @include gl-button-theme(
@@ -578,6 +590,11 @@
578
590
  color: var(--gl-button-disabled-foreground-color);
579
591
  opacity: 1;
580
592
  cursor: not-allowed !important;
593
+
594
+ &::before {
595
+ background-color: var(--gl-button-disabled-border-color);
596
+ }
597
+
581
598
  @if $feature-button-border {
582
599
  border-color: var(--gl-button-disabled-border-color);
583
600
  } @else {
@@ -0,0 +1,147 @@
1
+ $gl-button-group-focus-z-index: 3;
2
+ $gl-button-group-border-z-index: $gl-button-group-focus-z-index + 1;
3
+
4
+ .gl-button-group:not(.gl-keyset-pagination),
5
+ .btn-group:not(.gl-keyset-pagination),
6
+ .gl-dropdown.btn-group {
7
+ @apply gl-inline-flex gl-relative;
8
+
9
+ // Reset borders
10
+ > .gl-button:not(:first-child),
11
+ > .btn-group:not(:first-child) > .gl-button,
12
+ > .gl-new-dropdown:not(:first-child) .gl-button {
13
+ @apply gl-border-l-0 gl-rounded-l-none;
14
+ }
15
+
16
+ > .gl-button:not(:last-child):not(.dropdown-toggle),
17
+ > .btn-group:not(:last-child) > .gl-button,
18
+ > .gl-new-dropdown:not(:last-child) .gl-button {
19
+ @apply gl-border-r-0 gl-rounded-r-none;
20
+ }
21
+
22
+ // Pseudo element to mock border between buttons
23
+ > .gl-button:not(:first-child),
24
+ > .btn-group:not(:first-child) > .gl-button,
25
+ > .gl-new-dropdown:not(:first-child) .gl-button {
26
+ @apply gl-relative gl-ml-[1px];
27
+
28
+ &::before {
29
+ content: '';
30
+ @apply gl-absolute gl-block gl-top-[-1px] gl-bottom-[-1px] gl-left-[-1px] gl-w-[1px];
31
+ z-index: $gl-button-group-border-z-index;
32
+ }
33
+ }
34
+
35
+ // Bring focus to front
36
+ > .gl-button {
37
+ &:focus,
38
+ &:active,
39
+ &.active {
40
+ z-index: $gl-button-group-focus-z-index;
41
+ }
42
+ }
43
+
44
+ // Button separators
45
+ .btn-dashed {
46
+ &::before {
47
+ @apply gl-bg-transparent;
48
+ border-left: 1px dashed var(--gl-button-dashed-border-color-default);
49
+ }
50
+
51
+ &.disabled::before,
52
+ &[disabled]::before {
53
+ @apply gl-bg-transparent;
54
+ border-left: 1px dashed var(--gl-button-disabled-border-color);
55
+ }
56
+ }
57
+
58
+ // GlButton confirm and danger variants have transparent gap between items
59
+ .btn-confirm,
60
+ .btn-danger {
61
+ &:not(.disabled):not([disabled])::before {
62
+ @apply gl-bg-transparent;
63
+ }
64
+ }
65
+
66
+ // Move icon by 1px as we add a pseudo divider
67
+ .gl-button.btn-icon .gl-button-text .gl-button-icon {
68
+ @apply gl-mr-[-1px];
69
+ }
70
+
71
+ &.disabled,
72
+ &[disabled] {
73
+ &::before {
74
+ background-color: var(--gl-button-disabled-border-color);
75
+ }
76
+ }
77
+
78
+ .btn-confirm-secondary {
79
+ &:not(.disabled):not([disabled])::before {
80
+ background-color: var(--gl-button-confirm-secondary-border-color-default);
81
+ }
82
+ }
83
+
84
+ .btn-danger-secondary {
85
+ &:not(.disabled):not([disabled])::before {
86
+ background-color: var(--gl-button-danger-secondary-border-color-default);
87
+ }
88
+ }
89
+ }
90
+
91
+ .gl-button-group-vertical,
92
+ .btn-group-vertical {
93
+ @apply gl-flex-col gl-items-start gl-justify-center;
94
+
95
+ > .gl-button,
96
+ > .btn-group {
97
+ @apply gl-relative gl-w-full;
98
+ }
99
+
100
+ // Reset borders
101
+ > .gl-button:not(:first-child),
102
+ > .btn-group:not(:first-child) > .gl-button,
103
+ > .gl-new-dropdown:not(:first-child) .gl-button {
104
+ @apply gl-border-t-0 gl-rounded-t-none;
105
+ }
106
+
107
+ > .gl-button:not(:last-child):not(.dropdown-toggle),
108
+ > .btn-group:not(:last-child) > .gl-button,
109
+ > .gl-new-dropdown:not(:last-child) .gl-button {
110
+ @apply gl-border-b-0 gl-rounded-b-none;
111
+ }
112
+
113
+ // Pseudo element to mock border between buttons
114
+ > .gl-button:not(:first-child),
115
+ > .btn-group:not(:first-child) > .gl-button,
116
+ > .gl-new-dropdown:not(:first-child) .gl-button {
117
+ @apply gl-relative gl-mt-[1px];
118
+
119
+ &::before {
120
+ content: '';
121
+ @apply gl-absolute gl-block gl-left-[-1px] gl-right-[-1px] gl-top-[-1px] gl-h-[1px];
122
+ z-index: $gl-button-group-border-z-index;
123
+ }
124
+ }
125
+
126
+ // GlButton confirm and danger variants have transparent gap between items
127
+ .btn-confirm,
128
+ .btn-danger {
129
+ &:not(.disabled):not([disabled])::before {
130
+ @apply gl-bg-transparent;
131
+ }
132
+ }
133
+
134
+ // Dashed button
135
+ > .gl-button.btn-dashed:not(:first-child),
136
+ > .btn-group:not(:first-child) > .gl-button.btn-dashed,
137
+ > .gl-new-dropdown:not(:first-child) .gl-button.btn-dashed {
138
+ &::before {
139
+ border-top: 1px dashed var(--gl-button-dashed-border-color-default);
140
+ }
141
+
142
+ &.disabled::before,
143
+ &[disabled]::before {
144
+ border-top: 1px dashed var(--gl-button-disabled-border-color);
145
+ }
146
+ }
147
+ }
@@ -14,7 +14,11 @@ export default {
14
14
  };
15
15
  </script>
16
16
  <template>
17
- <div :class="!vertical ? 'btn-group' : 'btn-group-vertical'" role="group" v-on="$listeners">
17
+ <div
18
+ :class="!vertical ? 'gl-button-group btn-group' : 'gl-button-group-vertical btn-group-vertical'"
19
+ role="group"
20
+ v-on="$listeners"
21
+ >
18
22
  <!-- @slot The buttons to group. -->
19
23
  <slot></slot>
20
24
  </div>
@@ -96,17 +96,6 @@
96
96
  @include mask-chevron-down;
97
97
  }
98
98
 
99
- &.btn-confirm,
100
- &.btn-danger {
101
- margin-left: 1px;
102
- }
103
-
104
- &:disabled,
105
- &.disabled,
106
- &[class*='-secondary'] {
107
- margin-left: -1px;
108
- }
109
-
110
99
  @if $feature-button-border {
111
100
  &.gl-button {
112
101
  @apply gl-px-0;
@@ -205,26 +205,6 @@
205
205
  .gl-new-dropdown-toggle {
206
206
  @apply gl-rounded-tl-none;
207
207
  @apply gl-rounded-bl-none;
208
-
209
- // Prevent double borders when buttons are next to each other
210
- margin-left: -1px;
211
- }
212
- }
213
-
214
- // The dropdown toggle of a "split" is by design supposed to be the last
215
- // child of a button group, so only apply styles for that.
216
- .gl-new-dropdown:last-child {
217
- .gl-new-dropdown-caret-only {
218
- &.btn-confirm,
219
- &.btn-danger {
220
- margin-left: 1px;
221
- }
222
-
223
- &:disabled,
224
- &.disabled,
225
- &[class*='-secondary'] {
226
- margin-left: -1px;
227
- }
228
208
  }
229
209
  }
230
210
 
@@ -51,6 +51,7 @@
51
51
  @import '../components/base/modal/modal';
52
52
  @import '../components/base/nav/nav';
53
53
  @import '../components/base/button/button';
54
+ @import '../components/base/button_group/button_group';
54
55
  @import '../components/base/pagination/pagination';
55
56
  @import '../components/base/path/path';
56
57
  @import '../components/base/popover/popover';