@danske/sapphire-css 46.0.0 → 47.0.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.
@@ -84,23 +84,17 @@
84
84
  /* Content inside the item */
85
85
 
86
86
  .sapphire-listbox__content {
87
+ --sapphire-listbox-content-gap: var(--sapphire-semantic-size-spacing-xs);
88
+ --sapphire-listbox-icon-size: var(--sapphire-semantic-size-icon-sm);
87
89
  width: 100%;
88
90
  /**
89
91
  * max-width set to mitigate the issue of not being able to set a max-width on the popover the
90
92
  * listbox is rendered in, in use cases like Select.
91
93
  */
92
- max-width: calc(100vw - 2 * var(--sapphire-semantic-size-icon-sm));
93
- display: grid;
94
- grid-auto-flow: column;
94
+ max-width: calc(100vw - 2 * var(--sapphire-listbox-icon-size));
95
+ display: flex;
95
96
  align-items: center;
96
- gap: var(--sapphire-semantic-size-spacing-xs);
97
- /*
98
- * We want the left-side icon column to not take space if it's empty in the default case.
99
- * The right-side "checkmark" icon column should always take space even if
100
- * the checkmark isn't there. This is to make sure the listbox doesn't jump
101
- * when selecting items that add the checkmark in the last column
102
- */
103
- grid-template-columns: [left-icon] auto [text-content] 1fr [right-icon] auto;
97
+ gap: var(--sapphire-listbox-content-gap);
104
98
  padding: calc(
105
99
  var(--sapphire-semantic-size-spacing-sm) -
106
100
  var(--sapphire-semantic-size-spacing-4xs)
@@ -112,62 +106,57 @@
112
106
  transition-timing-function: var(--sapphire-semantic-transitions-fade);
113
107
  }
114
108
 
115
- .sapphire-listbox--selection
116
- .sapphire-listbox__content:not(.sapphire-listbox__content--empty) {
117
- /*
118
- * In this case, the right-side "checkmark" icon column should always take
119
- * space even if the checkmark isn't there. This is to make sure the listbox
120
- * doesn't jump when selecting items that add the checkmark in the last
121
- * column
109
+ /**
110
+ * A modifier that can be applied on listbox or listbox sections, and makes
111
+ * items reserve the space for selection checkmark on the left side,
112
+ * regardless of whether they have selection checkmark or not.
113
+ * This has two purposes:
114
+ * - keeps the content of selected and unselected items align
115
+ * - prevent the content jump when selection changes,
116
+ * by reserving the space for checkmark even when no item is selected.
122
117
  */
123
- grid-template-columns: [left-icon] var(--sapphire-semantic-size-icon-sm) [text-content] 1fr [right-icon] auto;
118
+ .sapphire-listbox--selection
119
+ .sapphire-listbox__item:not(.sapphire-listbox__item--empty)
120
+ .sapphire-listbox__content
121
+ > :first-child:not(.sapphire-listbox__checkmark) {
122
+ padding-left: calc(
123
+ var(--sapphire-listbox-icon-size) + var(--sapphire-listbox-content-gap)
124
+ );
124
125
  }
125
126
 
126
- .sapphire-listbox__content--empty {
127
- grid-template-columns: 1fr;
128
- justify-items: center;
127
+ .sapphire-listbox__item--empty {
129
128
  cursor: default;
129
+ /* instead of manually excluding empty state modifier from hover/active styles */
130
+ pointer-events: none;
130
131
  }
131
- .sapphire-listbox__item:has(.sapphire-listbox__content--empty) {
132
- cursor: default;
132
+ .sapphire-listbox__item--empty .sapphire-listbox__content,
133
+ .sapphire-listbox__item--empty .sapphire-listbox__text-container {
134
+ justify-content: center;
133
135
  }
134
136
 
135
137
  /* Icon content */
136
- .sapphire-listbox__icon {
138
+ .sapphire-listbox__icon,
139
+ /* NOTE: based on the designs, unlike checkmark icons,
140
+ the other icons should not change the alignment.
141
+ Hence a separate class for checkmark icon to be used in the alignment styles */
142
+ .sapphire-listbox__checkmark {
137
143
  line-height: 0;
138
144
  align-self: start;
145
+ flex-shrink: 0;
139
146
  /* to align with the centered text even when the item has a description */
140
147
  padding-top: calc(
141
148
  (
142
149
  (
143
150
  var(--sapphire-semantic-size-font-body-sm) *
144
151
  var(--sapphire-semantic-size-line-height-md)
145
- ) - var(--sapphire-semantic-size-icon-sm)
152
+ ) - var(--sapphire-listbox-icon-size)
146
153
  ) / 2
147
154
  );
148
155
  }
149
156
 
150
- .sapphire-listbox__icon:last-child {
151
- grid-column: right-icon / span 1;
152
- }
153
-
154
- .sapphire-listbox__icon:first-child {
155
- grid-column: left-icon / span 1;
156
- }
157
-
158
- /* Text content */
159
157
  .sapphire-listbox__text-container {
160
- grid-column: text-content / span 1;
161
158
  line-height: var(--sapphire-semantic-size-line-height-md);
162
- }
163
-
164
- /*
165
- * When there is no icon before the content we want the content
166
- * to stretch 2 columns out of the 3.
167
- */
168
- .sapphire-listbox:not(.sapphire-listbox--selection)
169
- .sapphire-listbox__text-container:first-child {
170
- grid-column: span 2;
159
+ flex: 1;
171
160
  }
172
161
 
173
162
  .sapphire-listbox__primary-text {
@@ -5,9 +5,10 @@ declare const styles: {
5
5
  readonly "sapphire-listbox__secondary-text": string;
6
6
  readonly "sapphire-listbox__content": string;
7
7
  readonly "sapphire-listbox--selection": string;
8
- readonly "sapphire-listbox__content--empty": string;
9
- readonly "sapphire-listbox__icon": string;
8
+ readonly "sapphire-listbox__item--empty": string;
9
+ readonly "sapphire-listbox__checkmark": string;
10
10
  readonly "sapphire-listbox__text-container": string;
11
+ readonly "sapphire-listbox__icon": string;
11
12
  readonly "sapphire-listbox__primary-text": string;
12
13
  readonly "is-disabled": string;
13
14
  readonly "sapphire-listbox__section": string;
@@ -3,11 +3,6 @@
3
3
  height: var(--sapphire-semantic-size-height-control-md);
4
4
  }
5
5
 
6
- .sapphire-segmented-control--stretch
7
- .sapphire-segmented-control__button-container {
8
- width: 100%;
9
- }
10
-
11
6
  .sapphire-segmented-control--align-center {
12
7
  justify-content: center;
13
8
  }
@@ -66,7 +61,6 @@
66
61
  */
67
62
  -webkit-font-smoothing: antialiased;
68
63
  -moz-osx-font-smoothing: grayscale;
69
- flex: 1 1 auto;
70
64
  box-sizing: content-box;
71
65
  margin: 0;
72
66
  border: 0;
@@ -84,6 +78,7 @@
84
78
  position: relative;
85
79
  transition: color var(--sapphire-semantic-time-motion-quick)
86
80
  var(--sapphire-semantic-transitions-dynamic);
81
+ white-space: nowrap;
87
82
  }
88
83
 
89
84
  .sapphire-segmented-control__button--active {
@@ -95,6 +90,12 @@
95
90
  cursor: not-allowed;
96
91
  }
97
92
 
93
+ .sapphire-segmented-control--stretch
94
+ .sapphire-segmented-control__button-container,
95
+ .sapphire-segmented-control--stretch .sapphire-segmented-control__button {
96
+ width: 100%;
97
+ }
98
+
98
99
  .sapphire-segmented-control.focus-visible:focus-within
99
100
  .sapphire-segmented-control__glider {
100
101
  outline: var(--sapphire-semantic-size-focus-ring) solid
@@ -1,15 +1,15 @@
1
1
  declare const styles: {
2
2
  readonly "sapphire-segmented-control": string;
3
- readonly "sapphire-segmented-control--stretch": string;
4
- readonly "sapphire-segmented-control__button-container": string;
5
3
  readonly "sapphire-segmented-control--align-center": string;
6
4
  readonly "sapphire-segmented-control--align-right": string;
7
5
  readonly "sapphire-segmented-control--align-left": string;
6
+ readonly "sapphire-segmented-control__button-container": string;
8
7
  readonly "sapphire-segmented-control__glider": string;
9
8
  readonly "sapphire-segmented-control__glider--with-transition": string;
10
9
  readonly "sapphire-segmented-control__button": string;
11
10
  readonly "sapphire-segmented-control__button--active": string;
12
11
  readonly "sapphire-segmented-control__button--disabled": string;
12
+ readonly "sapphire-segmented-control--stretch": string;
13
13
  readonly "focus-visible": string;
14
14
  readonly "sapphire-segmented-control--manual-keyboard-activation": string;
15
15
  readonly "sapphire-segmented-control--lg": string;
@@ -40,8 +40,8 @@
40
40
  padding-right: var(--sapphire-semantic-size-spacing-3xl);
41
41
  background: linear-gradient(
42
42
  90deg,
43
- var(--sapphire-global-color-white) 0%,
44
- var(--sapphire-global-color-white) 40%,
43
+ var(--sapphire-semantic-color-background-surface) 0%,
44
+ var(--sapphire-semantic-color-background-surface) 40%,
45
45
  var(--sapphire-global-color-transparent) 100%
46
46
  );
47
47
  }
@@ -52,8 +52,8 @@
52
52
  background: linear-gradient(
53
53
  90deg,
54
54
  var(--sapphire-global-color-transparent) 0%,
55
- var(--sapphire-global-color-white) 60%,
56
- var(--sapphire-global-color-white) 100%
55
+ var(--sapphire-semantic-color-background-surface) 60%,
56
+ var(--sapphire-semantic-color-background-surface) 100%
57
57
  );
58
58
  }
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danske/sapphire-css",
3
- "version": "46.0.0",
3
+ "version": "47.0.0",
4
4
  "description": "CSS implementation of the Sapphire Design System from Danske Bank A/S",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "sideEffects": false,
@@ -69,5 +69,5 @@
69
69
  "dependencies": {
70
70
  "@danske/sapphire-design-tokens": "^42.2.1"
71
71
  },
72
- "gitHead": "b745d009a1799e0912fcaeb52973104d566326c0"
72
+ "gitHead": "2c917bb01b95074630d7d28a6745f5b37f5c5963"
73
73
  }