@olenbetong/appframe-ds 1.7.1 → 1.7.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @olenbetong/appframe-ds
2
2
 
3
+ ## 1.7.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c3e56aa: `InputAdornments` is as tall as a `Textfield` or `Combobox` beside it: the input and any Designsystemet button inside it now fit within the control's height instead of a full-size button making it taller. Both `InputAdornments` and `Combobox`/`Autocomplete` now start their text where a `Textfield` does, and `InputAdornments` uses a `Textfield`'s font size and the `Combobox` its placeholder colour, so the three line up side by side.
8
+
3
9
  ## 1.7.1
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-ds",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Components that bind Designsystemet components to Appframe data objects",
5
5
  "type": "module",
6
6
  "types": "./es/index.d.ts",
@@ -1,253 +1,260 @@
1
- .ObAutocomplete-root {
2
- --obAutocomplete-padding: 0.25rem;
3
- --obAutocomplete-gap: 0.25rem;
4
-
5
- display: inline-grid;
6
- }
7
-
8
- /*
9
- * The root is not a `.ds-field`, so it has to space its label, description,
10
- * control and validation message itself. Mirrors `.ds-field > * + *`, including
11
- * the description sitting tight under the label.
12
- */
13
- .ObAutocomplete-root > * + * {
14
- margin-block-start: var(--ds-size-2);
15
- }
16
-
17
- .ObAutocomplete-root > [data-field="description"] {
18
- margin-block-start: 0;
19
- }
20
-
21
- .ObAutocomplete-root[data-full-width="true"] {
22
- display: grid;
23
- inline-size: 100%;
24
- }
25
-
26
- /*
27
- * Font size is deliberately never set: `ds-input` inherits its font size when a
28
- * `data-size` attribute is present, so referencing `--ds-font-size-*` here — which
29
- * `data-size` rescales — would render the text smaller than a `Textfield` or
30
- * `Select` of the same size. Only the padding varies per size, and only for the
31
- * sizes Designsystemet components come in (sm, md, lg; xs and xl are typography-only).
32
- */
33
- .ObAutocomplete-root[data-size="sm"] {
34
- --obAutocomplete-padding: 0.25rem;
35
- }
36
-
37
- .ObAutocomplete-root[data-size="md"] {
38
- --obAutocomplete-padding: 0.25rem;
39
- }
40
-
41
- .ObAutocomplete-root[data-size="lg"] {
42
- --obAutocomplete-padding: 0.375rem;
43
- }
44
-
45
- /*
46
- * The control is the visual input: it owns the border, background, hover and
47
- * focus styling, so the chips, the bare input and the buttons read as a single
48
- * control. Mirrors how Designsystemet's Suggestion renders selected chips
49
- * above the input.
50
- */
51
- .ObAutocomplete-control {
52
- display: flex;
53
- flex-direction: column;
54
- justify-content: center;
55
- box-sizing: border-box;
56
- gap: var(--obAutocomplete-gap);
57
- padding: var(--obAutocomplete-padding);
58
- inline-size: 100%;
59
- /* Matches `--dsc-input-size`, so the control lines up with a Textfield. */
60
- min-block-size: var(--ds-size-12);
61
- color: var(--ds-color-neutral-text-default);
62
- background-color: var(--ds-color-neutral-surface-default);
63
- border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-default);
64
- border-radius: var(--ds-border-radius-md);
65
- }
66
-
67
- .ObAutocomplete-control:hover:not(:focus-within) {
68
- border-color: var(--ds-color-neutral-border-strong);
69
- }
70
-
71
- .ObAutocomplete-control:has(.ObAutocomplete-input:focus-visible) {
72
- box-shadow: var(--dsc-focus-boxShadow);
73
- outline: var(--dsc-focus-outline);
74
- outline-offset: var(--ds-border-width-focus);
75
- }
76
-
77
- .ObAutocomplete-control[data-invalid="true"] {
78
- border-color: var(--ds-color-danger-border-default);
79
- }
80
-
81
- .ObAutocomplete-control[data-disabled="true"] {
82
- cursor: not-allowed;
83
- opacity: var(--ds-opacity-disabled);
84
- }
85
-
86
- .ObAutocomplete-chips {
87
- display: flex;
88
- flex-wrap: wrap;
89
- gap: var(--obAutocomplete-gap);
90
- padding: var(--obAutocomplete-padding);
91
- padding-block-end: 0;
92
- }
93
-
94
- .ObAutocomplete-inputGroup {
95
- display: flex;
96
- align-items: center;
97
- gap: var(--obAutocomplete-gap);
98
- min-inline-size: 0;
99
- }
100
-
101
- .ObAutocomplete-input {
102
- flex: 1;
103
- min-inline-size: 0;
104
- padding: var(--ds-size-1);
105
- font: inherit;
106
- color: inherit;
107
- background: transparent;
108
- border: none;
109
- outline: none;
110
- }
111
-
112
- .ObAutocomplete-input:disabled {
113
- cursor: not-allowed;
114
- }
115
-
116
- .ObAutocomplete-button {
117
- display: inline-flex;
118
- align-items: center;
119
- justify-content: center;
120
- flex: none;
121
- padding: var(--ds-size-1);
122
- color: inherit;
123
- background: transparent;
124
- border: none;
125
- border-radius: var(--ds-border-radius-sm);
126
- cursor: pointer;
127
- }
128
-
129
- .ObAutocomplete-button:hover:not(:disabled) {
130
- background-color: var(--ds-color-neutral-surface-hover);
131
- }
132
-
133
- .ObAutocomplete-button:disabled {
134
- cursor: not-allowed;
135
- }
136
-
137
- .ObAutocomplete-button[data-visible="false"] {
138
- display: none;
139
- }
140
-
141
- .ObAutocomplete-trigger[data-popup-open] svg {
142
- rotate: 180deg;
143
- }
144
-
145
- .ObAutocomplete-spinner {
146
- flex: none;
147
- display: inline-flex;
148
- align-items: center;
149
- padding-inline: var(--ds-size-1);
150
- }
151
-
152
- .ObAutocomplete-positioner {
153
- z-index: 1500;
154
- /* Base UI renders the positioner even while closed */
155
- outline: none;
156
- }
157
-
158
- .ObAutocomplete-popup {
159
- box-sizing: border-box;
160
- inline-size: var(--anchor-width);
161
- max-block-size: min(24rem, var(--available-height));
162
- overflow-y: auto;
163
- overscroll-behavior: contain;
164
- padding: var(--ds-size-1);
165
- color: var(--ds-color-neutral-text-default);
166
- background-color: var(--ds-color-neutral-surface-default);
167
- border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-subtle);
168
- border-radius: var(--ds-border-radius-md);
169
- box-shadow: var(--ds-shadow-md);
170
- transform-origin: var(--transform-origin);
171
- transition:
172
- opacity 0.12s ease-out,
173
- scale 0.12s ease-out;
174
- }
175
-
176
- .ObAutocomplete-popup[data-starting-style],
177
- .ObAutocomplete-popup[data-ending-style] {
178
- opacity: 0;
179
- scale: 0.98;
180
- }
181
-
182
- .ObAutocomplete-list {
183
- display: flex;
184
- flex-direction: column;
185
- }
186
-
187
- .ObAutocomplete-item {
188
- display: flex;
189
- align-items: center;
190
- gap: var(--ds-size-2);
191
- padding: var(--ds-size-2);
192
- border-radius: var(--ds-border-radius-sm);
193
- cursor: default;
194
- user-select: none;
195
- scroll-margin-block: var(--ds-size-1);
196
- }
197
-
198
- /*
199
- * The `accent` colour set does not exist in every Designsystemet theme, and the
200
- * contextual `--ds-color-*` aliases of the 1.13 token build are gone since 1.21,
201
- * so the option states use the neutral set explicitly.
202
- */
203
- .ObAutocomplete-item[data-highlighted] {
204
- color: var(--ds-color-neutral-text-default);
205
- background-color: var(--ds-color-neutral-surface-hover);
206
- }
207
-
208
- .ObAutocomplete-item[data-selected] {
209
- font-weight: var(--ds-font-weight-medium);
210
- color: var(--ds-color-neutral-text-default);
211
- background-color: var(--ds-color-neutral-surface-tinted);
212
- }
213
-
214
- .ObAutocomplete-item[data-selected][data-highlighted] {
215
- background-color: var(--ds-color-neutral-surface-active);
216
- }
217
-
218
- .ObAutocomplete-item[data-disabled] {
219
- cursor: not-allowed;
220
- opacity: var(--ds-opacity-disabled);
221
- }
222
-
223
- /*
224
- * The option's content. It is a flex row rather than the inline box it looks like, because
225
- * `renderOption` is normally an icon or an avatar beside a block of text — and a block child in an
226
- * inline parent drops onto its own line, stacking the two instead of setting them side by side.
227
- */
228
- .ObAutocomplete-itemContent {
229
- display: flex;
230
- align-items: center;
231
- gap: var(--ds-size-2);
232
- flex: 1;
233
- min-inline-size: 0;
234
- }
235
-
236
- .ObAutocomplete-itemIndicator {
237
- display: inline-flex;
238
- flex: none;
239
- inline-size: 1em;
240
- }
241
-
242
- .ObAutocomplete-groupLabel {
243
- padding: var(--ds-size-2);
244
- font-size: var(--ds-font-size-1);
245
- font-weight: var(--ds-font-weight-semibold);
246
- color: var(--ds-color-neutral-text-subtle);
247
- text-transform: uppercase;
248
- }
249
-
250
- .ObAutocomplete-empty:not(:empty) {
251
- padding: var(--ds-size-2);
252
- color: var(--ds-color-neutral-text-subtle);
253
- }
1
+ .ObAutocomplete-root {
2
+ --obAutocomplete-padding: 0.25rem;
3
+ --obAutocomplete-gap: 0.25rem;
4
+
5
+ display: inline-grid;
6
+ }
7
+
8
+ /*
9
+ * The root is not a `.ds-field`, so it has to space its label, description,
10
+ * control and validation message itself. Mirrors `.ds-field > * + *`, including
11
+ * the description sitting tight under the label.
12
+ */
13
+ .ObAutocomplete-root > * + * {
14
+ margin-block-start: var(--ds-size-2);
15
+ }
16
+
17
+ .ObAutocomplete-root > [data-field="description"] {
18
+ margin-block-start: 0;
19
+ }
20
+
21
+ .ObAutocomplete-root[data-full-width="true"] {
22
+ display: grid;
23
+ inline-size: 100%;
24
+ }
25
+
26
+ /*
27
+ * Font size is deliberately never set: `ds-input` inherits its font size when a
28
+ * `data-size` attribute is present, so referencing `--ds-font-size-*` here — which
29
+ * `data-size` rescales — would render the text smaller than a `Textfield` or
30
+ * `Select` of the same size. Only the padding varies per size, and only for the
31
+ * sizes Designsystemet components come in (sm, md, lg; xs and xl are typography-only).
32
+ */
33
+ .ObAutocomplete-root[data-size="sm"] {
34
+ --obAutocomplete-padding: 0.25rem;
35
+ }
36
+
37
+ .ObAutocomplete-root[data-size="md"] {
38
+ --obAutocomplete-padding: 0.25rem;
39
+ }
40
+
41
+ .ObAutocomplete-root[data-size="lg"] {
42
+ --obAutocomplete-padding: 0.375rem;
43
+ }
44
+
45
+ /*
46
+ * The control is the visual input: it owns the border, background, hover and
47
+ * focus styling, so the chips, the bare input and the buttons read as a single
48
+ * control. Mirrors how Designsystemet's Suggestion renders selected chips
49
+ * above the input.
50
+ */
51
+ .ObAutocomplete-control {
52
+ display: flex;
53
+ flex-direction: column;
54
+ justify-content: center;
55
+ box-sizing: border-box;
56
+ gap: var(--obAutocomplete-gap);
57
+ padding: var(--obAutocomplete-padding);
58
+ inline-size: 100%;
59
+ /* Matches `--dsc-input-size`, so the control lines up with a Textfield. */
60
+ min-block-size: var(--ds-size-12);
61
+ color: var(--ds-color-neutral-text-default);
62
+ background-color: var(--ds-color-neutral-surface-default);
63
+ border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-default);
64
+ border-radius: var(--ds-border-radius-md);
65
+ }
66
+
67
+ .ObAutocomplete-control:hover:not(:focus-within) {
68
+ border-color: var(--ds-color-neutral-border-strong);
69
+ }
70
+
71
+ .ObAutocomplete-control:has(.ObAutocomplete-input:focus-visible) {
72
+ box-shadow: var(--dsc-focus-boxShadow);
73
+ outline: var(--dsc-focus-outline);
74
+ outline-offset: var(--ds-border-width-focus);
75
+ }
76
+
77
+ .ObAutocomplete-control[data-invalid="true"] {
78
+ border-color: var(--ds-color-danger-border-default);
79
+ }
80
+
81
+ .ObAutocomplete-control[data-disabled="true"] {
82
+ cursor: not-allowed;
83
+ opacity: var(--ds-opacity-disabled);
84
+ }
85
+
86
+ .ObAutocomplete-chips {
87
+ display: flex;
88
+ flex-wrap: wrap;
89
+ gap: var(--obAutocomplete-gap);
90
+ padding: var(--obAutocomplete-padding);
91
+ padding-block-end: 0;
92
+ }
93
+
94
+ .ObAutocomplete-inputGroup {
95
+ display: flex;
96
+ align-items: center;
97
+ gap: var(--obAutocomplete-gap);
98
+ min-inline-size: 0;
99
+ }
100
+
101
+ .ObAutocomplete-input {
102
+ flex: 1;
103
+ min-inline-size: 0;
104
+ padding: var(--ds-size-1);
105
+ /* The text starts where a Textfield's does (its inline padding, inside the control's own). */
106
+ padding-inline-start: calc(var(--ds-size-3) - var(--obAutocomplete-padding));
107
+ font: inherit;
108
+ color: inherit;
109
+ background: transparent;
110
+ border: none;
111
+ outline: none;
112
+ }
113
+
114
+ /* Designsystemet's input placeholder colour, rather than the browser default grey. */
115
+ .ObAutocomplete-input::placeholder {
116
+ color: color-mix(in srgb, var(--ds-color-neutral-text-default), transparent 30%);
117
+ }
118
+
119
+ .ObAutocomplete-input:disabled {
120
+ cursor: not-allowed;
121
+ }
122
+
123
+ .ObAutocomplete-button {
124
+ display: inline-flex;
125
+ align-items: center;
126
+ justify-content: center;
127
+ flex: none;
128
+ padding: var(--ds-size-1);
129
+ color: inherit;
130
+ background: transparent;
131
+ border: none;
132
+ border-radius: var(--ds-border-radius-sm);
133
+ cursor: pointer;
134
+ }
135
+
136
+ .ObAutocomplete-button:hover:not(:disabled) {
137
+ background-color: var(--ds-color-neutral-surface-hover);
138
+ }
139
+
140
+ .ObAutocomplete-button:disabled {
141
+ cursor: not-allowed;
142
+ }
143
+
144
+ .ObAutocomplete-button[data-visible="false"] {
145
+ display: none;
146
+ }
147
+
148
+ .ObAutocomplete-trigger[data-popup-open] svg {
149
+ rotate: 180deg;
150
+ }
151
+
152
+ .ObAutocomplete-spinner {
153
+ flex: none;
154
+ display: inline-flex;
155
+ align-items: center;
156
+ padding-inline: var(--ds-size-1);
157
+ }
158
+
159
+ .ObAutocomplete-positioner {
160
+ z-index: 1500;
161
+ /* Base UI renders the positioner even while closed */
162
+ outline: none;
163
+ }
164
+
165
+ .ObAutocomplete-popup {
166
+ box-sizing: border-box;
167
+ inline-size: var(--anchor-width);
168
+ max-block-size: min(24rem, var(--available-height));
169
+ overflow-y: auto;
170
+ overscroll-behavior: contain;
171
+ padding: var(--ds-size-1);
172
+ color: var(--ds-color-neutral-text-default);
173
+ background-color: var(--ds-color-neutral-surface-default);
174
+ border: var(--ds-border-width-default) solid var(--ds-color-neutral-border-subtle);
175
+ border-radius: var(--ds-border-radius-md);
176
+ box-shadow: var(--ds-shadow-md);
177
+ transform-origin: var(--transform-origin);
178
+ transition:
179
+ opacity 0.12s ease-out,
180
+ scale 0.12s ease-out;
181
+ }
182
+
183
+ .ObAutocomplete-popup[data-starting-style],
184
+ .ObAutocomplete-popup[data-ending-style] {
185
+ opacity: 0;
186
+ scale: 0.98;
187
+ }
188
+
189
+ .ObAutocomplete-list {
190
+ display: flex;
191
+ flex-direction: column;
192
+ }
193
+
194
+ .ObAutocomplete-item {
195
+ display: flex;
196
+ align-items: center;
197
+ gap: var(--ds-size-2);
198
+ padding: var(--ds-size-2);
199
+ border-radius: var(--ds-border-radius-sm);
200
+ cursor: default;
201
+ user-select: none;
202
+ scroll-margin-block: var(--ds-size-1);
203
+ }
204
+
205
+ /*
206
+ * The `accent` colour set does not exist in every Designsystemet theme, and the
207
+ * contextual `--ds-color-*` aliases of the 1.13 token build are gone since 1.21,
208
+ * so the option states use the neutral set explicitly.
209
+ */
210
+ .ObAutocomplete-item[data-highlighted] {
211
+ color: var(--ds-color-neutral-text-default);
212
+ background-color: var(--ds-color-neutral-surface-hover);
213
+ }
214
+
215
+ .ObAutocomplete-item[data-selected] {
216
+ font-weight: var(--ds-font-weight-medium);
217
+ color: var(--ds-color-neutral-text-default);
218
+ background-color: var(--ds-color-neutral-surface-tinted);
219
+ }
220
+
221
+ .ObAutocomplete-item[data-selected][data-highlighted] {
222
+ background-color: var(--ds-color-neutral-surface-active);
223
+ }
224
+
225
+ .ObAutocomplete-item[data-disabled] {
226
+ cursor: not-allowed;
227
+ opacity: var(--ds-opacity-disabled);
228
+ }
229
+
230
+ /*
231
+ * The option's content. It is a flex row rather than the inline box it looks like, because
232
+ * `renderOption` is normally an icon or an avatar beside a block of text — and a block child in an
233
+ * inline parent drops onto its own line, stacking the two instead of setting them side by side.
234
+ */
235
+ .ObAutocomplete-itemContent {
236
+ display: flex;
237
+ align-items: center;
238
+ gap: var(--ds-size-2);
239
+ flex: 1;
240
+ min-inline-size: 0;
241
+ }
242
+
243
+ .ObAutocomplete-itemIndicator {
244
+ display: inline-flex;
245
+ flex: none;
246
+ inline-size: 1em;
247
+ }
248
+
249
+ .ObAutocomplete-groupLabel {
250
+ padding: var(--ds-size-2);
251
+ font-size: var(--ds-font-size-1);
252
+ font-weight: var(--ds-font-weight-semibold);
253
+ color: var(--ds-color-neutral-text-subtle);
254
+ text-transform: uppercase;
255
+ }
256
+
257
+ .ObAutocomplete-empty:not(:empty) {
258
+ padding: var(--ds-size-2);
259
+ color: var(--ds-color-neutral-text-subtle);
260
+ }