@olenbetong/appframe-ds 1.6.0 → 1.7.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 (154) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/package.json +3 -3
  3. package/scripts/copyAssets.mjs +27 -27
  4. package/src/autocomplete/Autocomplete.css +253 -253
  5. package/src/autocomplete/Autocomplete.tsx +320 -320
  6. package/src/autocomplete/AutocompleteFrame.tsx +168 -168
  7. package/src/autocomplete/Combobox.tsx +286 -286
  8. package/src/autocomplete/index.ts +4 -4
  9. package/src/autocomplete/types.ts +204 -204
  10. package/src/autocomplete/utils.ts +183 -183
  11. package/src/binding/BoundNumberInput.tsx +42 -42
  12. package/src/binding/BoundNumericTextField.tsx +102 -102
  13. package/src/binding/BoundTextField.tsx +49 -49
  14. package/src/binding/CancelButton.tsx +30 -30
  15. package/src/binding/CancelIconButton.tsx +30 -30
  16. package/src/binding/DataEditToolbar.css +23 -23
  17. package/src/binding/DataEditToolbar.tsx +84 -84
  18. package/src/binding/DeleteButton.tsx +35 -35
  19. package/src/binding/DeleteIconButton.tsx +35 -35
  20. package/src/binding/RefreshButton.tsx +31 -31
  21. package/src/binding/RefreshIconButton.tsx +33 -33
  22. package/src/binding/RefreshRowIconButton.tsx +33 -33
  23. package/src/binding/SaveButton.tsx +37 -37
  24. package/src/binding/SaveIconButton.tsx +38 -38
  25. package/src/binding/index.ts +20 -20
  26. package/src/container/Container.tsx +50 -50
  27. package/src/container/index.ts +1 -1
  28. package/src/cutoff/CutOffPicker.css +12 -12
  29. package/src/cutoff/CutOffPicker.tsx +165 -165
  30. package/src/cutoff/context.tsx +194 -194
  31. package/src/cutoff/dsCutOffDates.ts +21 -21
  32. package/src/cutoff/index.ts +4 -4
  33. package/src/cutoff/utils.test.ts +59 -59
  34. package/src/cutoff/utils.ts +276 -276
  35. package/src/filter/ChipListInput.tsx +79 -79
  36. package/src/filter/FieldFilterPanel.css +150 -150
  37. package/src/filter/FieldFilterPanel.tsx +309 -309
  38. package/src/filter/FilterBuilder.css +152 -152
  39. package/src/filter/FilterBuilder.test.tsx +153 -153
  40. package/src/filter/FilterBuilder.tsx +435 -435
  41. package/src/filter/FilterEditor.css +231 -231
  42. package/src/filter/FilterEditor.test.tsx +285 -285
  43. package/src/filter/FilterEditor.tsx +75 -75
  44. package/src/filter/FilterGroupEditor.tsx +160 -160
  45. package/src/filter/FilterNameDialog.css +22 -22
  46. package/src/filter/FilterNameDialog.tsx +81 -81
  47. package/src/filter/FilterRow.tsx +117 -117
  48. package/src/filter/FilterShareDialog.css +28 -28
  49. package/src/filter/FilterShareDialog.tsx +201 -201
  50. package/src/filter/FilterStringField.tsx +78 -78
  51. package/src/filter/FilterValueEditor.tsx +239 -239
  52. package/src/filter/SavedFilterTree.css +107 -107
  53. package/src/filter/SavedFilterTree.test.tsx +94 -94
  54. package/src/filter/SavedFilterTree.tsx +218 -218
  55. package/src/filter/fieldFilter.test.ts +158 -158
  56. package/src/filter/fieldFilter.ts +139 -139
  57. package/src/filter/index.ts +27 -27
  58. package/src/filter/types.ts +38 -38
  59. package/src/filter/useDistinctValues.test.ts +102 -102
  60. package/src/filter/useDistinctValues.ts +230 -230
  61. package/src/global.d.ts +11 -11
  62. package/src/grid/formatters.ts +23 -0
  63. package/src/grid/index.css +8 -2
  64. package/src/grid/index.tsx +73 -3
  65. package/src/grid/useAfColumns.tsx +28 -4
  66. package/src/grid/useAfGridApi.ts +3 -0
  67. package/src/grid/utcDate.test.ts +25 -0
  68. package/src/grid/utcDate.ts +28 -0
  69. package/src/grid/utcDateEditing.tsx +11 -0
  70. package/src/i18n.ts +13 -13
  71. package/src/index.ts +14 -14
  72. package/src/input/InputAdornments.css +80 -80
  73. package/src/input/InputAdornments.tsx +102 -102
  74. package/src/input/NumberInput.css +9 -9
  75. package/src/input/NumberInput.test.tsx +212 -212
  76. package/src/input/NumberInput.tsx +268 -268
  77. package/src/input/index.ts +3 -3
  78. package/src/input/numberFormat.test.ts +79 -79
  79. package/src/input/numberFormat.ts +94 -94
  80. package/src/layout/AppMenu.tsx +74 -74
  81. package/src/layout/AppMenuDrawer.css +71 -71
  82. package/src/layout/AppMenuDrawer.tsx +122 -122
  83. package/src/layout/AppMenuItem.css +6 -2
  84. package/src/layout/DialogMotion.css +79 -79
  85. package/src/layout/ErrorBoundary.tsx +162 -162
  86. package/src/layout/PageContainer.css +48 -48
  87. package/src/layout/PageContainer.tsx +41 -41
  88. package/src/layout/ResponsiveDialog.css +86 -86
  89. package/src/layout/ResponsiveDialog.tsx +55 -55
  90. package/src/layout/index.tsx +70 -70
  91. package/src/link/Link.tsx +23 -23
  92. package/src/link/index.ts +1 -1
  93. package/src/mdi/Mdi.css +8 -8
  94. package/src/mdi/Mdi.test.tsx +91 -91
  95. package/src/mdi/Mdi.tsx +141 -141
  96. package/src/mdi/MdiConfirmCloseDialog.tsx +47 -47
  97. package/src/mdi/MdiContext.tsx +59 -59
  98. package/src/mdi/MdiDocumentContext.tsx +60 -60
  99. package/src/mdi/MdiPanel.tsx +61 -61
  100. package/src/mdi/MdiRestore.test.tsx +86 -86
  101. package/src/mdi/MdiTab.tsx +30 -30
  102. package/src/mdi/controller.test.ts +382 -382
  103. package/src/mdi/controller.ts +656 -656
  104. package/src/mdi/dockviewHost.ts +132 -132
  105. package/src/mdi/fakeHost.ts +200 -200
  106. package/src/mdi/host.ts +44 -44
  107. package/src/mdi/ids.test.ts +20 -20
  108. package/src/mdi/ids.ts +18 -18
  109. package/src/mdi/index.ts +31 -31
  110. package/src/mdi/layoutRestore.test.ts +156 -156
  111. package/src/mdi/layoutRestore.ts +311 -311
  112. package/src/mdi/layoutSpec.test.ts +143 -143
  113. package/src/mdi/layoutSpec.ts +214 -214
  114. package/src/mdi/layoutStore.test.ts +93 -93
  115. package/src/mdi/layoutStore.ts +99 -99
  116. package/src/mdi/memorySettingsStore.ts +21 -21
  117. package/src/mdi/registry.ts +34 -34
  118. package/src/mdi/testTypes.ts +37 -37
  119. package/src/mdi/theme.ts +22 -22
  120. package/src/mdi/types.ts +214 -214
  121. package/src/page/Page.css +57 -57
  122. package/src/page/PageBlock.css +64 -64
  123. package/src/page/PageBlock.tsx +93 -93
  124. package/src/page/PageHeader.css +88 -88
  125. package/src/page/PageHeader.tsx +115 -115
  126. package/src/page/PageTitle.css +5 -5
  127. package/src/page/PageTitle.tsx +21 -21
  128. package/src/page/index.ts +4 -4
  129. package/src/paper/Paper.tsx +52 -52
  130. package/src/progress/LinearProgress.css +121 -121
  131. package/src/progress/LinearProgress.tsx +106 -106
  132. package/src/progress/index.ts +1 -1
  133. package/src/report-downloader/ReportDownloader.css +67 -67
  134. package/src/report-downloader/components/StatusItem.tsx +87 -87
  135. package/src/report-downloader/components/StatusList.tsx +28 -28
  136. package/src/report-downloader/index.ts +41 -41
  137. package/src/report-downloader/status.tsx +92 -92
  138. package/src/sortable/DropIndicator.css +51 -51
  139. package/src/sortable/DropIndicator.tsx +27 -27
  140. package/src/sortable/SortableItemList.css +21 -21
  141. package/src/sortable/SortableItemList.tsx +264 -264
  142. package/src/sortable/index.ts +8 -8
  143. package/src/sortable/reorderSortOrder.ts +126 -126
  144. package/src/sortable/sortOrder.ts +101 -101
  145. package/src/sortable/types.ts +9 -9
  146. package/src/sortable/useSortableContainer.ts +53 -53
  147. package/src/sortable/useSortableItem.ts +95 -95
  148. package/src/sortable/useSortableList.ts +117 -117
  149. package/src/test/happy-dom-document-class.ts +24 -24
  150. package/src/test/setup.ts +27 -27
  151. package/src/theme/useDsColorScheme.ts +53 -53
  152. package/tsconfig.build.json +9 -9
  153. package/tsconfig.json +8 -8
  154. package/vitest.config.ts +10 -10
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @olenbetong/appframe-ds
2
2
 
3
+ ## 1.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 0857c68: `AfGrid` takes `disableLoadingOverlay` to leave out MUI's loading overlay, for grids refreshed on a timer where the overlay keeps blocking text selection; the toolbar's refresh button still shows that it is loading.
8
+
9
+ ### Patch Changes
10
+
11
+ - d45d019: `AfGrid` row grouping: the grouping column gets AfGrid's own header filter (on the grouped field, when grouped by one field) instead of MUI's default; group rows are tinted and bold; and on group rows the grouping cell spans the empty cells after it, so the label stays readable in a column no wider than its expand toggle.
12
+
13
+ The active header filter funnel and the MDI's accents used `--ds-color-accent-*`, which the Synergi themes do not define; they use `--ds-color-brand-*` now.
14
+
15
+ - 3c9ba6c: Resetting an `AfGrid` layout also restores row grouping and aggregation to the grid's `initialState`. Before, a reset left a user's own grouping and aggregation in place and never brought back the grid's.
16
+ - c99ddd6: `AppMenuItem` hover and press tint with the neutral text colour instead of black, so the hover shows in dark mode too.
17
+
18
+ ## 1.6.1
19
+
20
+ ### Patch Changes
21
+
22
+ - bd4a806: AfGrid edits `date` and `dateTime` columns in UTC, matching how it displays wall-clock dates. MUI's own editors used local time, so a date entered in Norway was saved as 22:00 the day before (and then shown as the previous day). Columns holding real UTC instants, such as Created/Updated in newer tables, can set `storedAsUtc: true` to be shown and edited in local time instead. A column's own `renderEditCell` still takes precedence.
23
+
3
24
  ## 1.6.0
4
25
 
5
26
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olenbetong/appframe-ds",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Components that bind Designsystemet components to Appframe data objects",
5
5
  "type": "module",
6
6
  "types": "./es/index.d.ts",
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/pragmatic-drag-and-drop-hitbox": "3.0.0",
65
65
  "@base-ui/react": "1.9.0",
66
66
  "@olenbetong/appframe-core": "^2.15.2",
67
- "@olenbetong/appframe-data": "^1.8.3",
67
+ "@olenbetong/appframe-data": "^1.8.4",
68
68
  "@olenbetong/appframe-react": "^2.2.8",
69
69
  "clsx": "^2.1.1",
70
70
  "dockview-react": "8.6.1",
@@ -82,7 +82,7 @@
82
82
  "@mui/material": "9.5.0",
83
83
  "@mui/x-data-grid-premium": "8.29.5",
84
84
  "@mui/x-license": "8.29.3",
85
- "@navikt/aksel-icons": "8.19.2",
85
+ "@navikt/aksel-icons": "8.20.0",
86
86
  "@testing-library/dom": "^10.4.2",
87
87
  "@testing-library/jest-dom": "^7.0.1",
88
88
  "@testing-library/react": "16.3.3",
@@ -1,27 +1,27 @@
1
- /*
2
- * tsc emits the JavaScript into es/ but not the stylesheets the components import next to
3
- * themselves. Copy every .css under src/ to the same path under es/, so a new component's
4
- * stylesheet is published without anyone remembering a list.
5
- */
6
- import { cpSync, mkdirSync, readdirSync } from "node:fs";
7
- import { dirname, join, relative } from "node:path";
8
-
9
- function* cssFiles(dir) {
10
- for (let entry of readdirSync(dir, { withFileTypes: true })) {
11
- let path = join(dir, entry.name);
12
- if (entry.isDirectory()) {
13
- yield* cssFiles(path);
14
- } else if (entry.name.endsWith(".css")) {
15
- yield path;
16
- }
17
- }
18
- }
19
-
20
- let count = 0;
21
- for (let src of cssFiles("src")) {
22
- let dest = join("es", relative("src", src));
23
- mkdirSync(dirname(dest), { recursive: true });
24
- cpSync(src, dest);
25
- count++;
26
- }
27
- console.log(`Copied ${count} stylesheets from src/ to es/`);
1
+ /*
2
+ * tsc emits the JavaScript into es/ but not the stylesheets the components import next to
3
+ * themselves. Copy every .css under src/ to the same path under es/, so a new component's
4
+ * stylesheet is published without anyone remembering a list.
5
+ */
6
+ import { cpSync, mkdirSync, readdirSync } from "node:fs";
7
+ import { dirname, join, relative } from "node:path";
8
+
9
+ function* cssFiles(dir) {
10
+ for (let entry of readdirSync(dir, { withFileTypes: true })) {
11
+ let path = join(dir, entry.name);
12
+ if (entry.isDirectory()) {
13
+ yield* cssFiles(path);
14
+ } else if (entry.name.endsWith(".css")) {
15
+ yield path;
16
+ }
17
+ }
18
+ }
19
+
20
+ let count = 0;
21
+ for (let src of cssFiles("src")) {
22
+ let dest = join("es", relative("src", src));
23
+ mkdirSync(dirname(dest), { recursive: true });
24
+ cpSync(src, dest);
25
+ count++;
26
+ }
27
+ console.log(`Copied ${count} stylesheets from src/ to es/`);
@@ -1,253 +1,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
- 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
+ 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
+ }