@db-ux/core-components 4.7.0-tabs-34782eb → 4.7.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.
@@ -1,140 +1,138 @@
1
1
  @use "@db-ux/core-foundations/build/styles/variables";
2
2
  @use "@db-ux/core-foundations/build/styles/colors";
3
- @use "@db-ux/core-foundations/build/styles/helpers";
4
3
  @use "@db-ux/core-foundations/build/styles/icons";
5
- @use "@db-ux/core-foundations/build/styles/fonts";
4
+ @use "@db-ux/core-foundations/build/styles/helpers";
5
+ @use "../../styles/internal/component";
6
6
  @use "../../styles/internal/db-puls";
7
+ @use "../../styles/internal/form-components";
7
8
 
8
- db-tab-item,
9
- dbtabitem {
10
- display: contents;
11
- vertical-align: top; // fallback if display: contents fails: prevents baseline gap
12
- }
9
+ $with-icon-padding-calc: calc(
10
+ #{variables.$db-spacing-fixed-xs} + #{variables.$db-spacing-fixed-sm} +
11
+ #{form-components.$font-size-height}
12
+ );
13
13
 
14
14
  .db-tab-item {
15
15
  position: relative;
16
- background-color: colors.$db-adaptive-bg-basic-transparent-full-default;
17
- padding: variables.$db-spacing-fixed-xs;
18
- overflow: visible;
19
- align-items: center;
20
- justify-content: center;
21
- white-space: nowrap;
22
- border: 0;
16
+
17
+ @include helpers.display(inline-flex);
18
+
19
+ list-style-type: "";
23
20
  border-radius: variables.$db-border-radius-sm;
24
- cursor: pointer;
25
- font: inherit;
26
- color: inherit;
27
- flex-shrink: 0;
28
- z-index: 2;
29
- max-inline-size: variables.$db-sizing-2xl;
30
-
31
- @media screen and (forced-colors: active) {
32
- // Windows High Contrast mode forces transparent borders to become visible,
33
- // creating boundaries for the button when backgrounds are stripped.
34
- border: variables.$db-border-width-xs solid transparent;
35
- }
36
21
 
37
- @media screen and (prefers-reduced-motion: no-preference) {
38
- transition: background-color variables.$db-transition-duration-fast;
22
+ &:has(input:disabled) {
23
+ opacity: variables.$db-opacity-md;
39
24
  }
40
25
 
41
- .db-tab-label {
42
- max-inline-size: 100%;
26
+ label {
27
+ background-color: colors.$db-adaptive-bg-basic-transparent-full-default;
28
+ padding: variables.$db-spacing-fixed-xs;
29
+ align-items: center;
43
30
 
44
- @include helpers.display(block);
31
+ @include helpers.display(inline-block);
45
32
 
46
- &:not([data-icon-trailing])::after {
47
- content: attr(data-label);
48
- font-weight: 700;
49
- display: block;
50
- block-size: 0;
51
- font-size: 0;
52
- line-height: 0;
53
- padding: 0;
54
- margin: 0;
55
- overflow: hidden;
56
- visibility: hidden;
57
- }
33
+ white-space: nowrap;
34
+ border: 0;
35
+ border-radius: variables.$db-border-radius-sm;
36
+ overflow: hidden;
37
+ text-overflow: ellipsis;
58
38
 
59
- &[data-icon]:not([data-show-icon="false"]) {
60
- &::before {
61
- @extend %icon;
39
+ @include helpers.hover {
40
+ &:has(:not(input:disabled)) {
41
+ background-color: colors.$db-adaptive-bg-basic-transparent-full-hovered;
42
+ }
62
43
 
63
- margin-inline-end: variables.$db-spacing-fixed-xs;
64
- vertical-align: middle;
44
+ &:has(input:disabled) {
45
+ cursor: initial;
65
46
  }
66
47
  }
67
- }
68
48
 
69
- &[data-no-text="true"] .db-tab-label {
70
- &[data-icon]::before {
71
- margin-inline-end: 0;
72
- }
49
+ @include helpers.hover {
50
+ &:has(:not(input:disabled)) {
51
+ background-color: colors.$db-adaptive-bg-basic-transparent-full-hovered;
52
+ }
73
53
 
74
- &::after {
75
- content: none;
54
+ &:has(input:disabled) {
55
+ cursor: initial;
56
+ }
76
57
  }
77
- }
78
-
79
- [data-orientation="vertical"] & .db-tab-label {
80
- overflow: hidden;
81
- text-overflow: ellipsis;
82
- white-space: nowrap;
83
- }
84
-
85
- @extend %db-puls;
86
- @include helpers.display(flex);
87
-
88
- [data-density="functional"] & {
89
- padding: variables.$db-spacing-fixed-2xs;
90
58
 
91
- @extend %db-overwrite-font-size-sm;
92
- }
59
+ &:has(input:checked) {
60
+ font-weight: 700;
61
+ }
93
62
 
94
- [data-density="expressive"] & {
95
- padding: variables.$db-spacing-fixed-sm;
63
+ &[data-icon] {
64
+ padding-inline-start: $with-icon-padding-calc;
96
65
 
97
- @extend %db-overwrite-font-size-lg;
98
- }
66
+ &::before {
67
+ position: absolute;
68
+ transform: translateY(-50%);
69
+ inset-block-start: 50%;
70
+ inset-inline-start: calc(
71
+ 0% + #{variables.$db-spacing-fixed-xs}
72
+ );
73
+ }
74
+ }
99
75
 
100
- &::after {
101
- inline-size: 0;
102
- block-size: variables.$db-border-width-xs;
76
+ &[data-icon-trailing] {
77
+ padding-inline-end: $with-icon-padding-calc;
103
78
 
104
- @media screen and (prefers-reduced-motion: no-preference) {
105
- transition:
106
- block-size variables.$db-transition-duration-fast
107
- variables.$db-transition-timing-emotional,
108
- inline-size variables.$db-transition-duration-fast
109
- variables.$db-transition-timing-emotional !important; // overrides physical `width`/`height` transition from %db-puls in _db-puls.scss
79
+ &::after {
80
+ position: absolute;
81
+ transform: translateY(-50%);
82
+ inset-block-start: 50%;
83
+ inset-inline-end: calc(0% + #{variables.$db-spacing-fixed-xs});
84
+ }
110
85
  }
111
86
 
112
- [data-orientation="vertical"] & {
113
- inline-size: variables.$db-border-width-xs;
114
- block-size: 0;
115
- }
116
- }
87
+ &:is([data-no-text], [data-no-text="true"]) {
88
+ @include icons.is-icon-text-replace;
117
89
 
118
- [data-orientation="vertical"] & {
119
- max-inline-size: 100%;
120
- flex-shrink: 1;
121
- }
90
+ padding: 0;
91
+ inline-size: calc(
92
+ #{$with-icon-padding-calc} - #{variables.$db-spacing-fixed-2xs}
93
+ );
94
+ block-size: calc(
95
+ #{form-components.$font-size-height} +
96
+ #{variables.$db-spacing-fixed-xs}
97
+ );
122
98
 
123
- &[aria-selected="true"],
124
- &[data-active="true"] {
125
- font-weight: 700;
99
+ &::before {
100
+ margin-inline-end: 0;
101
+ }
102
+ }
126
103
  }
127
104
 
128
- &:disabled {
129
- opacity: variables.$db-opacity-md;
130
- cursor: initial;
131
- }
105
+ input {
106
+ position: absolute;
107
+ appearance: none;
108
+ inline-size: 100%;
109
+ margin-inline-end: initial;
110
+ inset: 0;
111
+ background-color: colors.$db-adaptive-bg-basic-transparent-full-default;
112
+ border-radius: variables.$db-border-radius-sm;
113
+ z-index: -1;
114
+
115
+ /*
116
+ focus must be set on input:
117
+ - parent label tag may use before AND after for displaying icons
118
+ - placed on li.db-tab-item focus would get cut off partially by by overflow hidden (orientation vertical)
119
+ */
120
+ &:focus-visible {
121
+ &:is(input[type="radio"]) {
122
+ outline: none;
123
+ box-shadow: none;
124
+ }
132
125
 
133
- // TODO: Investigate why helpers.hover mixin doesn't work here
134
- // Other components use @include helpers.hover directly, but for tab-item
135
- // it doesn't apply the hover effect. Using native pseudo-classes as workaround.
136
- &:not(:disabled):hover,
137
- &:not(:disabled):focus-visible {
138
- background-color: colors.$db-adaptive-bg-basic-transparent-full-hovered;
126
+ &::before {
127
+ @extend %focus-placeholder;
128
+
129
+ content: "";
130
+ position: absolute;
131
+ inset: 0;
132
+ border-radius: variables.$db-border-radius-sm;
133
+ z-index: 10;
134
+ pointer-events: none;
135
+ }
136
+ }
139
137
  }
140
138
  }
@@ -1,3 +1,4 @@
1
+ /* Variants for adaptive components like input, select, notification, ... */
1
2
  .db-visually-hidden,
2
3
  [data-visually-hidden=true] {
3
4
  clip: rect(0, 0, 0, 0) !important;
@@ -17,15 +18,7 @@
17
18
  pointer-events: none !important;
18
19
  }
19
20
 
20
- /* Variants for adaptive components like input, select, notification, ... */
21
- .db-tab-list {
22
- font: var(--db-type-body-md);
23
- /* Those variables are only for components to calculate heights and change icons */
24
- --db-icon-font-weight: var(--db-base-body-icon-weight-md);
25
- --db-icon-font-size: var(--db-base-body-icon-font-size-md);
26
- }
27
-
28
- .db-tab-list::-webkit-scrollbar, .db-tab-list::-webkit-scrollbar-corner {
21
+ .db-tab-list > ul::-webkit-scrollbar, .db-tab-list > ul::-webkit-scrollbar-corner {
29
22
  transition: outline var(--db-transition-duration-extra-fast), border-color var(--db-transition-straight-emotional), background-color var(--db-transition-straight-emotional);
30
23
  }
31
24
 
@@ -46,79 +39,86 @@
46
39
  transform: rotate(1turn);
47
40
  }
48
41
  }
42
+ .db-tab-list {
43
+ font: var(--db-type-body-md);
44
+ /* Those variables are only for components to calculate heights and change icons */
45
+ --db-icon-font-weight: var(--db-base-body-icon-weight-md);
46
+ --db-icon-font-size: var(--db-base-body-icon-font-size-md);
47
+ }
48
+
49
49
  @supports (field-sizing: content) {
50
- [data-field-sizing=content].db-tab-list:is([data-hide-resizer=true], [data-resize=none]) {
50
+ .db-tab-list > ul[data-field-sizing=content]:is([data-hide-resizer=true], [data-resize=none]) {
51
51
  /* We don't show a scrollbar if we use field-sizing: content and no resizer is available */
52
52
  scrollbar-width: none;
53
53
  }
54
54
  }
55
- .db-tab-list::-webkit-scrollbar {
55
+ .db-tab-list > ul::-webkit-scrollbar {
56
56
  z-index: 3;
57
57
  inline-size: 0.5rem;
58
58
  block-size: 0.5rem;
59
59
  background-color: var(--db-adaptive-bg-basic-level-1-default);
60
60
  border-start-end-radius: var(--db-border-radius-xs);
61
61
  }
62
- .db-tab-list:is(:hover, :focus)::-webkit-scrollbar-track, .db-tab-list:is(:hover, :focus)::-webkit-scrollbar-button:single-button {
62
+ .db-tab-list > ul:is(:hover, :focus)::-webkit-scrollbar-track, .db-tab-list > ul:is(:hover, :focus)::-webkit-scrollbar-button:single-button {
63
63
  background-color: var(--db-adaptive-bg-basic-transparent-full-hovered);
64
64
  }
65
- .db-tab-list:read-only::-webkit-scrollbar-track, .db-tab-list:read-only::-webkit-scrollbar-button:single-button {
65
+ .db-tab-list > ul:read-only::-webkit-scrollbar-track, .db-tab-list > ul:read-only::-webkit-scrollbar-button:single-button {
66
66
  background-color: var(--db-adaptive-bg-basic-level-1-default);
67
67
  }
68
- .db-tab-list::-webkit-scrollbar-track {
68
+ .db-tab-list > ul::-webkit-scrollbar-track {
69
69
  background-color: var(--db-adaptive-bg-basic-transparent-semi-default);
70
70
  }
71
- .db-tab-list::-webkit-scrollbar-thumb {
71
+ .db-tab-list > ul::-webkit-scrollbar-thumb {
72
72
  background-color: var(--db-adaptive-bg-basic-transparent-full-pressed);
73
73
  }
74
- .db-tab-list {
74
+ .db-tab-list > ul {
75
75
  /* Buttons */
76
76
  }
77
- .db-tab-list::-webkit-scrollbar-button:single-button {
77
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button {
78
78
  background-color: var(--db-adaptive-bg-basic-transparent-semi-default);
79
79
  background-size: 0.5rem;
80
80
  background-repeat: no-repeat;
81
81
  background-position: center;
82
82
  block-size: calc(var(--db-spacing-fixed-3xs) + var(--db-spacing-fixed-2xs) + var(--db-base-body-icon-font-size-2xs));
83
83
  }
84
- .db-tab-list::-webkit-scrollbar-button:single-button:is(:hover, :focus) {
84
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:is(:hover, :focus) {
85
85
  background-color: var(--db-adaptive-bg-basic-transparent-full-hovered);
86
86
  }
87
- .db-tab-list::-webkit-scrollbar-button:single-button:active {
87
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:active {
88
88
  background-color: var(--db-adaptive-bg-basic-transparent-full-pressed);
89
89
  }
90
- .db-tab-list {
90
+ .db-tab-list > ul {
91
91
  /* Up */
92
92
  }
93
- .db-tab-list::-webkit-scrollbar-button:single-button:vertical:decrement {
93
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:vertical:decrement {
94
94
  border-start-end-radius: var(--db-border-radius-xs);
95
95
  background-image: var(--db-scrollbar-button-vertical-decrement);
96
96
  }
97
- .db-tab-list {
97
+ .db-tab-list > ul {
98
98
  /* Down */
99
99
  }
100
- .db-tab-list::-webkit-scrollbar-button:single-button:vertical:increment {
100
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:vertical:increment {
101
101
  background-image: var(--db-scrollbar-button-vertical-increment);
102
102
  }
103
- .db-tab-list {
103
+ .db-tab-list > ul {
104
104
  /* Left */
105
105
  }
106
- .db-tab-list::-webkit-scrollbar-button:single-button:horizontal:decrement {
106
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:horizontal:decrement {
107
107
  background-image: var(--db-scrollbar-button-horizontal-decrement);
108
108
  }
109
- .db-tab-list {
109
+ .db-tab-list > ul {
110
110
  /* Right */
111
111
  }
112
- .db-tab-list::-webkit-scrollbar-button:single-button:horizontal:increment {
112
+ .db-tab-list > ul::-webkit-scrollbar-button:single-button:horizontal:increment {
113
113
  background-image: var(--db-scrollbar-button-horizontal-increment);
114
114
  }
115
- [data-variant=floating].db-tab-list::-webkit-resizer {
115
+ .db-tab-list > ul[data-variant=floating]::-webkit-resizer {
116
116
  background-color: var(--db-adaptive-bg-basic-transparent-semi-default);
117
117
  }
118
- [data-variant=floating].db-tab-list::-webkit-scrollbar-corner {
118
+ .db-tab-list > ul[data-variant=floating]::-webkit-scrollbar-corner {
119
119
  background-color: var(--db-adaptive-bg-basic-level-1-default);
120
120
  }
121
- .db-tab-list::-webkit-resizer {
121
+ .db-tab-list > ul::-webkit-resizer {
122
122
  background-color: var(--db-adaptive-bg-basic-transparent-full-default);
123
123
  background-size: 0.5rem;
124
124
  background-repeat: no-repeat;
@@ -126,19 +126,17 @@
126
126
  background-image: var(--db-textarea-resizer-image);
127
127
  border-end-end-radius: var(--db-border-radius-xs);
128
128
  }
129
- .db-tab-list::-webkit-scrollbar-corner {
129
+ .db-tab-list > ul::-webkit-scrollbar-corner {
130
130
  border-end-end-radius: var(--db-border-radius-xs);
131
131
  }
132
132
 
133
133
  .db-tab-list {
134
134
  position: relative;
135
+ }
136
+ .db-tab-list > ul {
135
137
  display: flex;
136
- gap: var(--db-spacing-fixed-2xs);
138
+ gap: var(--db-spacing-fixed-sm);
137
139
  scroll-behavior: smooth;
138
140
  padding: 0;
139
141
  margin: 0;
140
142
  }
141
- [data-orientation=vertical] .db-tab-list {
142
- flex-direction: column;
143
- align-items: flex-start;
144
- }
@@ -1,20 +1,18 @@
1
1
  @use "@db-ux/core-foundations/build/styles/variables";
2
- @use "@db-ux/core-foundations/build/styles/fonts";
3
2
  @use "../../styles/internal/scrollbar";
4
3
 
5
4
  .db-tab-list {
5
+ @extend %db-overwrite-font-size-md;
6
+
6
7
  position: relative;
7
- display: flex;
8
- gap: variables.$db-spacing-fixed-2xs;
9
- scroll-behavior: smooth;
10
- padding: 0;
11
- margin: 0;
12
8
 
13
- @extend %db-overwrite-font-size-md;
14
- @extend %scrollbar;
9
+ > ul {
10
+ @extend %scrollbar;
15
11
 
16
- [data-orientation="vertical"] & {
17
- flex-direction: column;
18
- align-items: flex-start;
12
+ display: flex;
13
+ gap: variables.$db-spacing-fixed-sm;
14
+ scroll-behavior: smooth;
15
+ padding: 0;
16
+ margin: 0;
19
17
  }
20
18
  }
@@ -1,3 +1,4 @@
1
+ /* Variants for adaptive components like input, select, notification, ... */
1
2
  .db-tab-panel:not([hidden]) {
2
- display: block;
3
+ display: none;
3
4
  }
@@ -1,3 +1,6 @@
1
- .db-tab-panel:not([hidden]) {
2
- display: block;
1
+ @use "@db-ux/core-foundations/build/styles/variables";
2
+ @use "@db-ux/core-foundations/build/styles/helpers";
3
+
4
+ .db-tab-panel {
5
+ @include helpers.display(none);
3
6
  }