@danske/sapphire-css 38.1.1 → 39.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.
@@ -19,6 +19,7 @@
19
19
  */
20
20
  -webkit-font-smoothing: antialiased;
21
21
  -moz-osx-font-smoothing: grayscale;
22
+ list-style: none;
22
23
  }
23
24
 
24
25
  .sapphire-list__item {
@@ -31,9 +32,29 @@
31
32
  --sapphire-semantic-color-background-action-tertiary-ghost-default
32
33
  );
33
34
  outline: none;
35
+ font-family: var(--sapphire-semantic-font-name-default);
34
36
  }
35
37
 
36
- .sapphire-list__item:has(.sapphire-list__item-content-wrapper) {
38
+ /**
39
+ * .sapphire-list__item--interactive is used either for a list item or list item content wrapper.
40
+ * Created to reuse the same styles for angular and react.
41
+ */
42
+ .sapphire-list__item--interactive {
43
+ /* When list item is a button or anchor, we need to remove the default styles */
44
+ border: none;
45
+ outline: none;
46
+ text-decoration: none;
47
+ box-sizing: border-box;
48
+ width: 100%;
49
+
50
+ transition-property: opacity, background-color, color;
51
+ transition-duration: var(--sapphire-semantic-time-fade-quick);
52
+ transition-timing-function: ease-in-out;
53
+
54
+ cursor: pointer;
55
+ }
56
+
57
+ .sapphire-list__item:has(.sapphire-list__item--interactive) {
37
58
  padding: 0;
38
59
  }
39
60
 
@@ -41,7 +62,11 @@
41
62
  z-index: 1;
42
63
  }
43
64
 
44
- .sapphire-list__item-content-wrapper {
65
+ /* the flex style needed in the scenario where the
66
+ --interactive element is rendered as a wrapper of the content inside the list item,
67
+ instead of being applied on the list item itself */
68
+
69
+ .sapphire-list__item > .sapphire-list__item--interactive {
45
70
  display: flex;
46
71
  justify-content: space-between;
47
72
  width: 100%;
@@ -78,10 +103,8 @@
78
103
  );
79
104
  }
80
105
 
81
- .sapphire-list__item:disabled .sapphire-list__item-content-wrapper,
82
- .sapphire-list__item[aria-disabled='true'] .sapphire-list__item-content-wrapper,
83
- .sapphire-list__item-content-wrapper:disabled,
84
- .sapphire-list__item-content-wrapper[aria-disabled='true'] {
106
+ .sapphire-list__item--interactive:disabled,
107
+ .sapphire-list__item--interactive[aria-disabled='true'] {
85
108
  cursor: not-allowed;
86
109
  opacity: var(--sapphire-semantic-opacity-disabled);
87
110
  }
@@ -90,70 +113,78 @@
90
113
  Only render a divider if
91
114
  - item isn't last child of without-last-divider list
92
115
  - next item is focused (as next item's top box-shadow will act as divider) either by
93
- - parent item of item-content-wrapper not having a sibling with a focused child item-content-wrapper
94
- - sibling of a list item without a child item-content-wrapper not having a focused child item-content-wrapper
95
- - item-content-wrapper is not focused itself
116
+ - parent item of item--interactive not having a sibling with a focused child item--interactive
117
+ - sibling of a list item without a child item--interactive not having a focused child item--interactive
118
+ - item--interactive is not focused itself
96
119
 
97
120
  Note that using box-shadow both for divider and focus styling complicates the selectors
98
121
  as we for instance have to exclude the focus states when adding the divider.
99
122
  */
100
- .sapphire-list__item-content-wrapper:not(.is-focus, :not(.js-focus):focus),
101
- .sapphire-list__item:not(:has(.sapphire-list__item-content-wrapper)) {
123
+ .sapphire-list__item--interactive:not(.is-focus, :not(.js-focus):focus),
124
+ .sapphire-list__item:not(:has(.sapphire-list__item--interactive)) {
102
125
  box-shadow: inset 0px -1px 0px 0px var(--sapphire-semantic-color-border-separator-default);
103
126
  }
104
127
  /* For not virtualized list */
105
128
  .sapphire-list--without-last-divider:not(:has([role="presentation"] > [role="presentation"]))
106
129
  .sapphire-list__item:last-child
107
- .sapphire-list__item-content-wrapper:not(.is-focus):not(:focus),
130
+ .sapphire-list__item--interactive:not(.is-focus):not(:focus),
108
131
  .sapphire-list--without-last-divider:not(:has([role="presentation"] > [role="presentation"]))
109
- .sapphire-list__item:last-child,
132
+ .sapphire-list__item:not(.sapphire-list__item--interactive):last-child,
110
133
  /* For virtualized lists.
111
134
  * This is admittedly a bad-looking selector. To keep in
112
135
  * mind that a virtualized list adds one or more extra nesting with role
113
136
  * presentation. */
114
137
  .sapphire-list--without-last-divider
115
138
  [role="presentation"]:last-child > .sapphire-list__item
116
- .sapphire-list__item-content-wrapper:not(.is-focus):not(:focus),
139
+ .sapphire-list__item--interactive:not(.is-focus):not(:focus),
117
140
  .sapphire-list--without-last-divider
118
141
  [role="presentation"]:last-child > .sapphire-list__item,
119
142
  /* other */
120
143
  .sapphire-list__item:has(+ .sapphire-list__item
121
- > .sapphire-list__item-content-wrapper.is-focus)
122
- > .sapphire-list__item-content-wrapper:not(.is-focus, :not(.js-focus):focus),
144
+ > .sapphire-list__item--interactive.is-focus)
145
+ > .sapphire-list__item--interactive:not(.is-focus, :not(.js-focus):focus),
123
146
  .sapphire-list__item:has(+ .sapphire-list__item
124
- > .sapphire-list__item-content-wrapper:not(.js-focus):focus)
125
- > .sapphire-list__item-content-wrapper:not(.is-focus, :not(.js-focus):focus),
147
+ > .sapphire-list__item--interactive:not(.js-focus):focus)
148
+ > .sapphire-list__item-ineractive:not(.is-focus, :not(.js-focus):focus),
126
149
  .sapphire-list__item:has(+ .sapphire-list__item
127
- > .sapphire-list__item-content-wrapper.is-focus),
150
+ > .sapphire-list__item--interactive.is-focus),
128
151
  .sapphire-list__item:has(+ .sapphire-list__item
129
- > .sapphire-list__item-content-wrapper:not(.js-focus):focus) {
152
+ > .sapphire-list__item--interactive:not(.js-focus):focus) {
153
+ box-shadow: none;
154
+ }
155
+
156
+ /*
157
+ * This is used in the list item in Anular to remove the last divider
158
+ */
159
+ .sapphire-list__item.sapphire-list__item--interactive:not(
160
+ .is-focus,
161
+ :not(.js-focus):focus
162
+ ).sapphire-list__item--without-divider {
130
163
  box-shadow: none;
131
164
  }
132
165
 
133
166
  /*
134
167
  * Hover
135
168
  */
136
- .sapphire-list .sapphire-list__item-content-wrapper.is-hover,
137
- .sapphire-list
138
- .sapphire-list__item-content-wrapper:not(.js-hover):not(
169
+ .sapphire-list__item--interactive.is-hover:not(.is-active),
170
+ .sapphire-list__item--interactive:not(.js-hover):not(
139
171
  [aria-disabled='true']
140
- ):not(:disabled):hover {
172
+ ):not(:disabled):not(:active):hover {
141
173
  background-color: var(
142
174
  --sapphire-semantic-color-background-action-secondary-default
143
175
  );
144
- cursor: pointer;
145
176
  }
146
177
 
147
178
  /*
148
179
  * Focus
149
180
  */
150
- .sapphire-list__item-content-wrapper:focus,
151
- .sapphire-list__item-content-wrapper:focus-visible {
181
+ .sapphire-list__item-content-interactive:focus,
182
+ .sapphire-list__item-content-interactive:focus-visible {
152
183
  outline: none;
153
184
  }
154
185
 
155
- .sapphire-list__item-content-wrapper.is-focus,
156
- .sapphire-list__item-content-wrapper:not(.js-focus):focus {
186
+ .sapphire-list__item--interactive.is-focus,
187
+ .sapphire-list__item--interactive:not(.js-focus):focus {
157
188
  outline: none;
158
189
  box-shadow: inset 0px 0px 0px var(--sapphire-semantic-size-focus-ring)
159
190
  var(--sapphire-semantic-color-focus-ring);
@@ -161,12 +192,27 @@
161
192
  border-radius: var(--sapphire-semantic-size-radius-sm);
162
193
  }
163
194
 
195
+ /* Active */
196
+
197
+ .sapphire-list__item--interactive:not(.is-disabled).is-active,
198
+ .sapphire-list__item--interactive:not([aria-disabled='true']):not(
199
+ :disabled
200
+ ):active,
201
+ .sapphire-list__item--interactive:not([aria-disabled='true']):not(
202
+ :disabled
203
+ ):focus-visible:active {
204
+ background-color: var(
205
+ --sapphire-semantic-color-background-action-secondary-hover
206
+ );
207
+ }
208
+
164
209
  .sapphire-list__item-content-left {
165
210
  display: flex;
166
211
  align-items: center;
167
212
  margin-right: var(--sapphire-semantic-size-spacing-30);
168
213
  /* This was added to accommodate nowrap + hidden text overflow situations */
169
214
  min-width: 0;
215
+ gap: var(--sapphire-semantic-size-spacing-30);
170
216
  }
171
217
 
172
218
  .sapphire-list__item-content-right {
@@ -175,6 +221,7 @@
175
221
  text-align: right;
176
222
  margin-left: var(--sapphire-semantic-size-spacing-30);
177
223
  color: var(--sapphire-semantic-color-content-default-primary);
224
+ gap: var(--sapphire-semantic-size-spacing-30);
178
225
  }
179
226
 
180
227
  .sapphire-list__item-text {
@@ -190,16 +237,6 @@
190
237
  flex-direction: column-reverse;
191
238
  }
192
239
 
193
- /* If sibling is present before the text, we apply margin to the left on the text */
194
- * + .sapphire-list__item-text {
195
- margin-left: var(--sapphire-semantic-size-spacing-30);
196
- }
197
-
198
- /* If sibling is present after the text, we apply margin to the left on that sibling */
199
- .sapphire-list__item-text + * {
200
- margin-left: var(--sapphire-semantic-size-spacing-30);
201
- }
202
-
203
240
  .sapphire-list__item-text-primary {
204
241
  color: var(--sapphire-semantic-color-content-default-primary);
205
242
  line-height: var(--sapphire-semantic-size-line-height-md);
@@ -1,13 +1,18 @@
1
1
  declare const styles: {
2
2
  readonly "sapphire-list": string;
3
3
  readonly "sapphire-list__item": string;
4
- readonly "sapphire-list__item-content-wrapper": string;
4
+ readonly "sapphire-list__item--interactive": string;
5
5
  readonly "sapphire-list--negative-margin-self": string;
6
6
  readonly "is-focus": string;
7
7
  readonly "js-focus": string;
8
8
  readonly "sapphire-list--without-last-divider": string;
9
+ readonly "sapphire-list__item-ineractive": string;
10
+ readonly "sapphire-list__item--without-divider": string;
9
11
  readonly "is-hover": string;
12
+ readonly "is-active": string;
10
13
  readonly "js-hover": string;
14
+ readonly "sapphire-list__item-content-interactive": string;
15
+ readonly "is-disabled": string;
11
16
  readonly "sapphire-list__item-content-left": string;
12
17
  readonly "sapphire-list__item-content-right": string;
13
18
  readonly "sapphire-list__item-text": string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danske/sapphire-css",
3
- "version": "38.1.1",
3
+ "version": "39.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,
@@ -45,7 +45,7 @@
45
45
  "@babel/preset-env": "^7.20.2",
46
46
  "@babel/preset-react": "^7.18.6",
47
47
  "@babel/preset-typescript": "^7.18.6",
48
- "@danske/sapphire-icons": "^2.2.0",
48
+ "@danske/sapphire-icons": "^2.3.0",
49
49
  "@danske/sapphire-react": "^4.3.0",
50
50
  "@mdx-js/react": "^1.6.22",
51
51
  "@storybook/addon-essentials": "^6.5.13",
@@ -69,5 +69,5 @@
69
69
  "dependencies": {
70
70
  "@danske/sapphire-design-tokens": "^41.5.0"
71
71
  },
72
- "gitHead": "6bd3c484a3b470e3efbb4b9bc14f8132ad50071f"
72
+ "gitHead": "f2079a7e0cd3e3c50c5b75c0aa545f8beee78d3c"
73
73
  }