@gitlab/ui 135.1.2 → 136.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 (32) hide show
  1. package/dist/components/base/form/form_password_input/form_password_input.js +12 -15
  2. package/dist/components/base/label/label.js +9 -1
  3. package/dist/components/base/toast/index.js +21 -13
  4. package/dist/components/index.js +1 -1
  5. package/dist/index.css +2 -2
  6. package/dist/index.css.map +1 -1
  7. package/dist/tailwind.css +1 -1
  8. package/dist/tailwind.css.map +1 -1
  9. package/dist/tokens/build/js/tokens.dark.js +2 -1
  10. package/dist/tokens/build/js/tokens.js +2 -1
  11. package/dist/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +3 -1
  12. package/package.json +6 -6
  13. package/src/components/base/form/form_password_input/form_password_input.scss +14 -32
  14. package/src/components/base/form/form_password_input/form_password_input.vue +25 -31
  15. package/src/components/base/label/label.vue +10 -1
  16. package/src/components/base/toast/index.js +23 -10
  17. package/src/components/base/tooltip/tooltip.scss +1 -0
  18. package/src/components/index.js +1 -1
  19. package/src/tokens/build/css/tokens.css +1 -0
  20. package/src/tokens/build/css/tokens.dark.css +1 -0
  21. package/src/tokens/build/figma/mode.dark.json +10 -0
  22. package/src/tokens/build/figma/mode.json +10 -0
  23. package/src/tokens/build/js/tokens.dark.js +1 -0
  24. package/src/tokens/build/js/tokens.js +1 -0
  25. package/src/tokens/build/json/tokens.dark.json +38 -0
  26. package/src/tokens/build/json/tokens.json +38 -0
  27. package/src/tokens/build/scss/_tokens.dark.scss +1 -0
  28. package/src/tokens/build/scss/_tokens.scss +1 -0
  29. package/src/tokens/build/scss/_tokens_custom_properties.scss +1 -0
  30. package/src/tokens/contextual/tooltip.tokens.json +18 -0
  31. package/src/vendor/bootstrap-vue/src/components/tooltip/helpers/bv-tooltip.js +3 -1
  32. package/translations.js +2 -0
@@ -1,42 +1,24 @@
1
1
  .gl-form-password-input {
2
+ position: relative;
3
+ @apply gl-w-full;
4
+
2
5
  // Hide Edge's native password-reveal control so only this component's toggle
3
6
  // button is shown; otherwise Edge renders a second reveal icon for typed
4
7
  // passwords, producing two overlapping controls.
5
8
  input[type="password"]::-ms-reveal {
6
9
  display: none;
7
10
  }
11
+ }
8
12
 
9
- // The reveal button (its own border removed via !gl-border-0 in the template)
10
- // draws its border the way the input does: an inset box-shadow in the control
11
- // color, so the two match exactly and animate together.
12
- .gl-form-password-input-toggle {
13
- box-shadow: inset 0 0 0 $gl-border-size-1 var(--gl-control-border-color-default);
14
- }
15
-
16
- // Animate the input's and the button's box-shadow borders with the same
17
- // timing so the whole outline darkens together on hover.
18
- .gl-form-input,
19
- .gl-form-password-input-toggle {
20
- transition: box-shadow $gl-transition-duration-medium $gl-easing-out-cubic;
21
- }
22
-
23
- // Darken the whole control's border on hover so the input and reveal button
24
- // react as one field, mirroring the input's own hover.
25
- &:hover {
26
- .gl-form-input {
27
- box-shadow: inset 0 0 0 $gl-border-size-1 var(--gl-control-border-color-hover);
28
- }
29
-
30
- .gl-form-password-input-toggle {
31
- box-shadow: inset 0 0 0 $gl-border-size-1 var(--gl-control-border-color-hover);
32
- }
33
- }
13
+ // Reserve room for the toggle button. Both classes are needed: the base padding
14
+ // lands at two-class specificity via `.gl-form-input.form-control`.
15
+ .gl-form-password-input-field.gl-form-input {
16
+ @apply gl-pe-7;
17
+ }
34
18
 
35
- // On focus, mirror the input's focus: a border in the focus color plus the
36
- // focus ring, combined in one box-shadow. The button's default focus is
37
- // ring-only and would otherwise drop the reveal side's border on focus,
38
- // leaving it inconsistent with the (still-bordered) input beside it.
39
- .gl-form-password-input-toggle:focus {
40
- @include gl-focus($color: var(--gl-control-border-color-focus), $important: true);
41
- }
19
+ .gl-form-password-input-toggle {
20
+ position: absolute;
21
+ top: 50%;
22
+ @apply gl-end-2;
23
+ transform: translateY(-50%);
42
24
  }
@@ -1,15 +1,14 @@
1
1
  <script>
2
2
  import GlButton from '../../button/button.vue';
3
3
  import { GlTooltipDirective } from '../../../../directives/tooltip/tooltip';
4
+ import { translate } from '../../../../utils/i18n';
4
5
  import GlFormInput from '../form_input/form_input.vue';
5
- import GlFormInputGroup from '../form_input_group/form_input_group.vue';
6
6
 
7
7
  export default {
8
8
  name: 'GlFormPasswordInput',
9
9
  components: {
10
10
  GlButton,
11
11
  GlFormInput,
12
- GlFormInputGroup,
13
12
  },
14
13
  directives: {
15
14
  GlTooltip: GlTooltipDirective,
@@ -35,28 +34,29 @@ export default {
35
34
  },
36
35
  /**
37
36
  * Accessible label and tooltip for the toggle button while the value is masked.
38
- * Pass a translated string.
39
37
  */
40
38
  revealLabel: {
41
39
  type: String,
42
40
  required: false,
43
- default: 'Reveal password',
41
+ default: () => translate('GlFormPasswordInput.revealLabel', 'Reveal password'),
44
42
  },
45
43
  /**
46
44
  * Accessible label and tooltip for the toggle button while the value is revealed.
47
- * Pass a translated string.
48
45
  */
49
46
  hideLabel: {
50
47
  type: String,
51
48
  required: false,
52
- default: 'Hide password',
49
+ default: () => translate('GlFormPasswordInput.hideLabel', 'Hide password'),
53
50
  },
54
51
  /**
55
- * Disables the field while keeping it in the focus order and announced by
56
- * assistive technology (via `aria-disabled`), rather than removing it from
57
- * the tab sequence.
52
+ * Disables the field and its toggle. Neither is in the tab order and the
53
+ * value is not submitted with the form.
54
+ *
55
+ * To prevent edits while keeping the value readable, copyable and
56
+ * submitted, pass `readonly` instead. It reaches the input untouched and
57
+ * leaves the toggle usable, since revealing a value is a read.
58
58
  */
59
- accessibleDisabled: {
59
+ disabled: {
60
60
  type: Boolean,
61
61
  required: false,
62
62
  default: false,
@@ -80,10 +80,6 @@ export default {
80
80
  },
81
81
  methods: {
82
82
  toggleVisibility() {
83
- if (this.accessibleDisabled) {
84
- return;
85
- }
86
-
87
83
  this.isMasked = !this.isMasked;
88
84
  /**
89
85
  * Emitted when the reveal/hide button is clicked.
@@ -98,26 +94,24 @@ export default {
98
94
  </script>
99
95
 
100
96
  <template>
101
- <gl-form-input-group class="gl-form-password-input">
97
+ <div class="gl-form-password-input">
102
98
  <gl-form-input
99
+ v-bind="$attrs"
100
+ class="gl-form-password-input-field"
103
101
  :value="value"
104
102
  :type="type"
105
- :readonly="accessibleDisabled"
106
- :aria-disabled="accessibleDisabled ? 'true' : null"
107
- v-bind="$attrs"
103
+ :disabled="disabled"
108
104
  v-on="$listeners"
109
105
  />
110
- <template #append>
111
- <gl-button
112
- v-gl-tooltip="toggleLabel"
113
- class="gl-form-password-input-toggle !gl-border-0"
114
- category="tertiary"
115
- accessible-disabled
116
- :aria-label="toggleLabel"
117
- :icon="toggleIcon"
118
- :disabled="accessibleDisabled"
119
- @click="toggleVisibility"
120
- />
121
- </template>
122
- </gl-form-input-group>
106
+ <gl-button
107
+ v-gl-tooltip="toggleLabel"
108
+ class="gl-form-password-input-toggle"
109
+ category="tertiary"
110
+ size="small"
111
+ :aria-label="toggleLabel"
112
+ :icon="toggleIcon"
113
+ :disabled="disabled"
114
+ @click="toggleVisibility"
115
+ />
116
+ </div>
123
117
  </template>
@@ -80,6 +80,14 @@ export default {
80
80
  required: false,
81
81
  default: false,
82
82
  },
83
+ /**
84
+ * Additional text shown in a muted footer line of the tooltip (e.g. "Archived")
85
+ */
86
+ footer: {
87
+ type: String,
88
+ required: false,
89
+ default: '',
90
+ },
83
91
  },
84
92
  computed: {
85
93
  removeButtonAriaLabel() {
@@ -166,13 +174,14 @@ export default {
166
174
  <gl-icon name="close-xs" :size="12" />
167
175
  </gl-button>
168
176
  <gl-tooltip
169
- v-if="description"
177
+ v-if="description || footer"
170
178
  :target="() => tooltipTarget"
171
179
  :placement="tooltipPlacement"
172
180
  boundary="viewport"
173
181
  >
174
182
  <span v-if="scoped" class="gl-label-tooltip-title">Scoped label</span>
175
183
  {{ description }}
184
+ <span v-if="footer" class="gl-block gl-text-subtle">{{ footer }}</span>
176
185
  </gl-tooltip>
177
186
  </span>
178
187
  </template>
@@ -46,21 +46,34 @@ function showToast(message, options = {}) {
46
46
  return toast;
47
47
  }
48
48
 
49
+ /**
50
+ * Adds a `$toast` property to the component it's applied to.
51
+ *
52
+ * Use this to opt individual components into toasts, instead of adding `$toast`
53
+ * to every component in the app with `GlToastPlugin`.
54
+ */
55
+ export const GlToastMixin = {
56
+ beforeCreate() {
57
+ if (this.$toast) {
58
+ return;
59
+ }
60
+ this.$toast = { show: showToast.bind(this) };
61
+ },
62
+ };
63
+
49
64
  /**
50
65
  * Note: This is not a typical Vue component and needs to be registered before instantiating a Vue app.
51
66
  * Once registered, the toast will be globally available throughout your app.
52
67
  *
53
- * See https://design.gitlab.com/storybook for detailed documentation.
68
+ * See https://design.gitlab.com/components/toast for detailed documentation.
54
69
  */
55
- export default {
70
+ export const GlToastPlugin = {
56
71
  install(V) {
57
- V.mixin({
58
- beforeCreate() {
59
- if (this.$toast) {
60
- return;
61
- }
62
- this.$toast = { show: showToast.bind(this) };
63
- },
64
- });
72
+ V.mixin(GlToastMixin);
65
73
  },
66
74
  };
75
+
76
+ /**
77
+ * @deprecated Use the named `GlToastPlugin` export instead.
78
+ */
79
+ export default GlToastPlugin;
@@ -11,6 +11,7 @@
11
11
  @apply gl-rounded-feedback;
12
12
  background: var(--gl-feedback-strong-background-color);
13
13
  color: var(--gl-feedback-strong-text-color);
14
+ --gl-text-color-subtle: var(--gl-tooltip-text-color-subtle);
14
15
  }
15
16
 
16
17
  .arrow {
@@ -33,7 +33,7 @@ export { default as GlBadge } from './base/badge/badge.vue';
33
33
  export { default as GlBanner } from './base/banner/banner.vue';
34
34
  export { default as GlButton } from './base/button/button.vue';
35
35
  export { default as GlTooltip } from './base/tooltip/tooltip.vue';
36
- export { default as GlToast } from './base/toast';
36
+ export { default as GlToast, GlToastMixin, GlToastPlugin } from './base/toast';
37
37
  export { default as GlDashboardSkeleton } from './regions/dashboard_skeleton/dashboard_skeleton.vue';
38
38
  export { default as GlEmptyState } from './regions/empty_state/empty_state.vue';
39
39
  export { default as GlForm } from './base/form/form.vue';
@@ -647,6 +647,7 @@
647
647
  --gl-toggle-switch-track-color-checked-active: var(--gl-color-neutral-1000); /** Used for the track color of a checked toggle switch in the active state. */
648
648
  --gl-token-selector-token-container-token-background-color-focus: var(--gl-color-neutral-300); /** Used for the background color of a token in a token-selector when it's token-container is in the focus state. */
649
649
  --gl-token-background-color: var(--gl-color-neutral-100); /** Used for the token background color. */
650
+ --gl-tooltip-text-color-subtle: var(--gl-color-neutral-200); /** Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode. */
650
651
  --black: var(--gl-color-neutral-1000);
651
652
  --white: var(--gl-color-neutral-0);
652
653
  --blue-50: var(--gl-color-blue-50);
@@ -665,6 +665,7 @@
665
665
  --gl-toggle-switch-track-color-checked-active: var(--gl-color-neutral-0); /** Used for the track color of a checked toggle switch in the active state. */
666
666
  --gl-token-selector-token-container-token-background-color-focus: var(--gl-color-neutral-600); /** Used for the background color of a token in a token-selector when it's token-container is in the focus state. */
667
667
  --gl-token-background-color: var(--gl-color-neutral-800); /** Used for the token background color. */
668
+ --gl-tooltip-text-color-subtle: var(--gl-color-neutral-200); /** Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode. */
668
669
  --black: var(--gl-color-neutral-0);
669
670
  --white: var(--gl-color-neutral-900);
670
671
  --blue-50: var(--gl-color-blue-900);
@@ -5429,6 +5429,16 @@
5429
5429
  ]
5430
5430
  }
5431
5431
  },
5432
+ "🔒/tooltip-text-color-subtle": {
5433
+ "$value": "{color-neutral-200}",
5434
+ "$type": "color",
5435
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
5436
+ "$extensions": {
5437
+ "com.figma.scopes": [
5438
+ "TEXT_FILL"
5439
+ ]
5440
+ }
5441
+ },
5432
5442
  "action-border-radius": {
5433
5443
  "$value": "{border-radius-lg}",
5434
5444
  "$type": "dimension",
@@ -5373,6 +5373,16 @@
5373
5373
  ]
5374
5374
  }
5375
5375
  },
5376
+ "🔒/tooltip-text-color-subtle": {
5377
+ "$value": "{color-neutral-200}",
5378
+ "$type": "color",
5379
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
5380
+ "$extensions": {
5381
+ "com.figma.scopes": [
5382
+ "TEXT_FILL"
5383
+ ]
5384
+ }
5385
+ },
5376
5386
  "action-border-radius": {
5377
5387
  "$value": "{border-radius-lg}",
5378
5388
  "$type": "dimension",
@@ -827,6 +827,7 @@ export const GL_TOKEN_SELECTOR_TOKEN_CONTAINER_TOKEN_BACKGROUND_COLOR_FOCUS = '#
827
827
  export const GL_TOKEN_BORDER_RADIUS = '0.25rem';
828
828
  export const GL_TOKEN_FOREGROUND_COLOR = '#ececef';
829
829
  export const GL_TOKEN_BACKGROUND_COLOR = '#3a383f';
830
+ export const GL_TOOLTIP_TEXT_COLOR_SUBTLE = '#bfbfc3';
830
831
  export const DATA_VIZ_GREEN_50 = '#133a03';
831
832
  export const DATA_VIZ_GREEN_100 = '#1a4500';
832
833
  export const DATA_VIZ_GREEN_200 = '#275600';
@@ -827,6 +827,7 @@ export const GL_TOKEN_SELECTOR_TOKEN_CONTAINER_TOKEN_BACKGROUND_COLOR_FOCUS = '#
827
827
  export const GL_TOKEN_BORDER_RADIUS = '0.25rem';
828
828
  export const GL_TOKEN_FOREGROUND_COLOR = '#3a383f';
829
829
  export const GL_TOKEN_BACKGROUND_COLOR = '#dcdcde';
830
+ export const GL_TOOLTIP_TEXT_COLOR_SUBTLE = '#bfbfc3';
830
831
  export const DATA_VIZ_GREEN_50 = '#ddfab7';
831
832
  export const DATA_VIZ_GREEN_100 = '#c6ed94';
832
833
  export const DATA_VIZ_GREEN_200 = '#b0d97b';
@@ -24901,6 +24901,44 @@
24901
24901
  }
24902
24902
  }
24903
24903
  },
24904
+ "tooltip": {
24905
+ "text": {
24906
+ "color": {
24907
+ "subtle": {
24908
+ "key": "{tooltip.text.color.subtle}",
24909
+ "$value": "#bfbfc3",
24910
+ "$type": "color",
24911
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
24912
+ "$extensions": {
24913
+ "com.figma.scopes": [
24914
+ "TEXT_FILL"
24915
+ ]
24916
+ },
24917
+ "filePath": "src/tokens/contextual/tooltip.tokens.json",
24918
+ "isSource": true,
24919
+ "original": {
24920
+ "$value": "{color.neutral.200}",
24921
+ "$type": "color",
24922
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
24923
+ "$extensions": {
24924
+ "com.figma.scopes": [
24925
+ "TEXT_FILL"
24926
+ ]
24927
+ },
24928
+ "key": "{tooltip.text.color.subtle}"
24929
+ },
24930
+ "name": "TOOLTIP_TEXT_COLOR_SUBTLE",
24931
+ "attributes": {},
24932
+ "path": [
24933
+ "tooltip",
24934
+ "text",
24935
+ "color",
24936
+ "subtle"
24937
+ ]
24938
+ }
24939
+ }
24940
+ }
24941
+ },
24904
24942
  "data-viz": {
24905
24943
  "green": {
24906
24944
  "50": {
@@ -24901,6 +24901,44 @@
24901
24901
  }
24902
24902
  }
24903
24903
  },
24904
+ "tooltip": {
24905
+ "text": {
24906
+ "color": {
24907
+ "subtle": {
24908
+ "key": "{tooltip.text.color.subtle}",
24909
+ "$value": "#bfbfc3",
24910
+ "$type": "color",
24911
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
24912
+ "$extensions": {
24913
+ "com.figma.scopes": [
24914
+ "TEXT_FILL"
24915
+ ]
24916
+ },
24917
+ "filePath": "src/tokens/contextual/tooltip.tokens.json",
24918
+ "isSource": true,
24919
+ "original": {
24920
+ "$value": "{color.neutral.200}",
24921
+ "$type": "color",
24922
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
24923
+ "$extensions": {
24924
+ "com.figma.scopes": [
24925
+ "TEXT_FILL"
24926
+ ]
24927
+ },
24928
+ "key": "{tooltip.text.color.subtle}"
24929
+ },
24930
+ "name": "TOOLTIP_TEXT_COLOR_SUBTLE",
24931
+ "attributes": {},
24932
+ "path": [
24933
+ "tooltip",
24934
+ "text",
24935
+ "color",
24936
+ "subtle"
24937
+ ]
24938
+ }
24939
+ }
24940
+ }
24941
+ },
24904
24942
  "data-viz": {
24905
24943
  "green": {
24906
24944
  "50": {
@@ -663,6 +663,7 @@ $gl-toggle-switch-track-color-checked-hover: $gl-color-neutral-10; // Used for t
663
663
  $gl-toggle-switch-track-color-checked-active: $gl-color-neutral-0; // Used for the track color of a checked toggle switch in the active state.
664
664
  $gl-token-selector-token-container-token-background-color-focus: $gl-color-neutral-600; // Used for the background color of a token in a token-selector when it's token-container is in the focus state.
665
665
  $gl-token-background-color: $gl-color-neutral-800; // Used for the token background color.
666
+ $gl-tooltip-text-color-subtle: $gl-color-neutral-200; // Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.
666
667
  $black: $gl-color-neutral-0 !default;
667
668
  $white: $gl-color-neutral-900 !default;
668
669
  $blue-50: $gl-color-blue-900 !default;
@@ -645,6 +645,7 @@ $gl-toggle-switch-track-color-checked-hover: $gl-color-neutral-950; // Used for
645
645
  $gl-toggle-switch-track-color-checked-active: $gl-color-neutral-1000; // Used for the track color of a checked toggle switch in the active state.
646
646
  $gl-token-selector-token-container-token-background-color-focus: $gl-color-neutral-300; // Used for the background color of a token in a token-selector when it's token-container is in the focus state.
647
647
  $gl-token-background-color: $gl-color-neutral-100; // Used for the token background color.
648
+ $gl-tooltip-text-color-subtle: $gl-color-neutral-200; // Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.
648
649
  $black: $gl-color-neutral-1000 !default;
649
650
  $white: $gl-color-neutral-0 !default;
650
651
  $blue-50: $gl-color-blue-50 !default;
@@ -736,6 +736,7 @@ $gl-token-selector-token-container-token-background-color-focus: var(--gl-token-
736
736
  $gl-token-border-radius: var(--gl-token-border-radius);
737
737
  $gl-token-foreground-color: var(--gl-token-foreground-color);
738
738
  $gl-token-background-color: var(--gl-token-background-color);
739
+ $gl-tooltip-text-color-subtle: var(--gl-tooltip-text-color-subtle);
739
740
  $data-viz-green-50: var(--data-viz-green-50);
740
741
  $data-viz-green-100: var(--data-viz-green-100);
741
742
  $data-viz-green-200: var(--data-viz-green-200);
@@ -0,0 +1,18 @@
1
+ {
2
+ "tooltip": {
3
+ "text": {
4
+ "color": {
5
+ "subtle": {
6
+ "$value": "{color.neutral.200}",
7
+ "$type": "color",
8
+ "$description": "Used for supplemental tooltip text that is less prominent than the default text and remains the same color regardless of mode.",
9
+ "$extensions": {
10
+ "com.figma.scopes": [
11
+ "TEXT_FILL"
12
+ ]
13
+ }
14
+ }
15
+ }
16
+ }
17
+ }
18
+ }
@@ -814,7 +814,9 @@ export const BVTooltip = /*#__PURE__*/ extend({
814
814
  } else if (type === 'focusin' && triggers.includes('focus')) {
815
815
  // `focusin` is a bubbling event
816
816
  // `event` includes `relatedTarget` (element losing focus)
817
- this.enter(event)
817
+ if (event.target.matches(':focus-visible')) {
818
+ this.enter(event)
819
+ }
818
820
  } else if (
819
821
  (type === 'focusout' && (triggers.includes('focus') || triggers.includes('blur'))) ||
820
822
  (type === 'mouseleave' && triggers.includes('hover'))
package/translations.js CHANGED
@@ -21,6 +21,8 @@ export default {
21
21
  'GlColorModeToggle.lightLabel': 'Light mode',
22
22
  'GlDatepicker.monthLabel': 'Month',
23
23
  'GlDatepicker.yearLabel': 'Year',
24
+ 'GlFormPasswordInput.hideLabel': 'Hide password',
25
+ 'GlFormPasswordInput.revealLabel': 'Reveal password',
24
26
  'GlKeysetPagination.navigationLabel': 'Pagination',
25
27
  'GlKeysetPagination.nextText': 'Next',
26
28
  'GlKeysetPagination.prevText': 'Previous',