@equinor/eds-core-react 2.4.0 → 2.4.1-beta.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 (48) hide show
  1. package/build/index.css +370 -29
  2. package/build/index.min.css +1 -1
  3. package/dist/eds-core-react.cjs +24 -4
  4. package/dist/esm/components/Autocomplete/MultipleInput.js +19 -5
  5. package/dist/esm/components/Autocomplete/useAutocomplete.js +6 -0
  6. package/dist/esm/components/InputWrapper/InputWrapper.js +1 -1
  7. package/dist/esm/components/Textarea/Textarea.js +1 -1
  8. package/dist/esm-next/components/next/Banner/Banner.js +88 -0
  9. package/dist/esm-next/components/next/Button/Button.js +1 -2
  10. package/dist/esm-next/components/next/Input/Input.js +1 -1
  11. package/dist/esm-next/components/next/Link/Link.js +36 -0
  12. package/dist/esm-next/components/next/Search/Search.js +118 -0
  13. package/dist/esm-next/components/next/Slot/Slot.js +47 -0
  14. package/dist/esm-next/components/next/TextArea/TextArea.js +131 -0
  15. package/dist/esm-next/components/next/TextField/TextField.js +0 -1
  16. package/dist/esm-next/components/next/Tooltip/Tooltip.js +84 -0
  17. package/dist/esm-next/index.next.js +6 -0
  18. package/dist/index.next.cjs +474 -8
  19. package/dist/types/components/Autocomplete/Autocomplete.d.ts +5 -0
  20. package/dist/types/components/Autocomplete/AutocompleteContext.d.ts +6 -2
  21. package/dist/types/components/Autocomplete/useAutocomplete.d.ts +4 -2
  22. package/dist/types/components/next/Banner/Banner.d.ts +23 -0
  23. package/dist/types/components/next/Banner/Banner.figma.d.ts +1 -0
  24. package/dist/types/components/next/Banner/Banner.types.d.ts +33 -0
  25. package/dist/types/components/next/Banner/index.d.ts +2 -0
  26. package/dist/types/components/next/Button/Button.types.d.ts +1 -2
  27. package/dist/types/components/next/Input/Input.types.d.ts +4 -1
  28. package/dist/types/components/next/Link/Link.d.ts +4 -0
  29. package/dist/types/components/next/Link/Link.figma.d.ts +1 -0
  30. package/dist/types/components/next/Link/Link.types.d.ts +13 -0
  31. package/dist/types/components/next/Link/index.d.ts +2 -0
  32. package/dist/types/components/next/Search/Search.d.ts +9 -0
  33. package/dist/types/components/next/Search/Search.figma.d.ts +1 -0
  34. package/dist/types/components/next/Search/Search.types.d.ts +16 -0
  35. package/dist/types/components/next/Search/index.d.ts +2 -0
  36. package/dist/types/components/next/Slot/Slot.d.ts +3 -0
  37. package/dist/types/components/next/Slot/Slot.types.d.ts +4 -0
  38. package/dist/types/components/next/Slot/index.d.ts +2 -0
  39. package/dist/types/components/next/TextArea/TextArea.d.ts +11 -0
  40. package/dist/types/components/next/TextArea/TextArea.figma.d.ts +1 -0
  41. package/dist/types/components/next/TextArea/TextArea.types.d.ts +21 -0
  42. package/dist/types/components/next/TextArea/index.d.ts +2 -0
  43. package/dist/types/components/next/Tooltip/Tooltip.d.ts +7 -0
  44. package/dist/types/components/next/Tooltip/Tooltip.figma.d.ts +1 -0
  45. package/dist/types/components/next/Tooltip/Tooltip.types.d.ts +17 -0
  46. package/dist/types/components/next/Tooltip/index.d.ts +2 -0
  47. package/dist/types/components/next/index.d.ts +12 -0
  48. package/package.json +39 -32
package/build/index.css CHANGED
@@ -203,16 +203,10 @@
203
203
  * Button height is controlled by min-height.
204
204
  * The span keeps its natural line-height and is centered by flexbox.
205
205
  *
206
- * Spacious (default): sm=24px, md=36px, lg=44px
207
- * Comfortable: sm=20px, md=24px, lg=36px
206
+ * Spacious (default): sm=24px, md=36px
207
+ * Comfortable: sm=20px, md=24px
208
208
  */
209
209
 
210
- .eds-button[data-selectable-space='lg'] {
211
- gap: var(--eds-typography-gap-horizontal);
212
- min-height: 2.75rem; /* 44px */
213
- padding-inline: var(--eds-selectable-space-horizontal);
214
- }
215
-
216
210
  .eds-button[data-selectable-space='md'] {
217
211
  gap: var(--eds-typography-gap-horizontal);
218
212
  min-height: 2.25rem; /* 36px */
@@ -227,10 +221,6 @@
227
221
 
228
222
  /* Comfortable density */
229
223
 
230
- [data-density='comfortable'] .eds-button[data-selectable-space='lg'] {
231
- min-height: 2.25rem; /* 36px */
232
- }
233
-
234
224
  [data-density='comfortable'] .eds-button[data-selectable-space='md'] {
235
225
  min-height: 1.5rem; /* 24px */
236
226
  }
@@ -936,37 +926,45 @@
936
926
  .eds-input-container {
937
927
  /* Temporary alias until proper input background token is available */
938
928
  --_bg-input: var(--eds-color-bg-canvas);
929
+
939
930
  /* Temporary alias until proper readonly text token is available */
940
931
  --_readonly-text-color: var(--eds-color-border-strong);
941
932
 
942
933
  isolation: isolate;
934
+
943
935
  display: flex;
944
936
  flex-direction: row;
945
- align-items: center;
946
937
  gap: var(--eds-typography-gap-horizontal);
938
+ align-items: center;
939
+
947
940
  box-sizing: border-box;
948
941
  inline-size: 100%;
942
+ padding-block: var(--eds-selectable-space-vertical);
943
+ padding-inline: var(--eds-selectable-space-horizontal);
944
+ border-radius: var(--eds-spacing-border-radius-rounded, 4px);
945
+
949
946
  background: var(--_bg-input);
947
+
950
948
  /* Outline instead of border to not affect height calculation */
951
949
  outline: var(--eds-sizing-stroke-thin) solid var(--eds-color-border-subtle);
952
950
  outline-offset: calc(-1 * var(--eds-sizing-stroke-thin));
953
- border-radius: var(--eds-spacing-border-radius-none);
954
- padding-inline: var(--eds-selectable-space-horizontal);
955
- padding-block: var(--eds-selectable-space-vertical);
951
+
956
952
  transition:
957
953
  background-color 150ms,
958
954
  outline-color 150ms;
959
955
 
960
- &:hover:not([data-disabled]):not([data-readonly]) {
956
+ &:hover:not([data-disabled], [data-readonly]) {
961
957
  outline-color: var(--eds-color-border-strong);
962
958
 
963
959
  & .eds-input {
964
960
  color: var(--eds-color-text-strong);
961
+
965
962
  /* Safari autofill override */
966
963
  -webkit-text-fill-color: var(--eds-color-text-strong);
967
964
 
968
965
  &::placeholder {
969
966
  color: var(--eds-color-text-strong);
967
+
970
968
  /* Safari autofill override */
971
969
  -webkit-text-fill-color: var(--eds-color-text-strong);
972
970
  }
@@ -999,14 +997,16 @@
999
997
  outline-color: transparent;
1000
998
 
1001
999
  & .eds-input {
1002
- color: var(--eds-color-text-disabled);
1003
1000
  cursor: not-allowed;
1001
+ color: var(--eds-color-text-disabled);
1004
1002
  opacity: 1;
1003
+
1005
1004
  /* Safari autofill override */
1006
1005
  -webkit-text-fill-color: var(--eds-color-text-disabled);
1007
1006
 
1008
1007
  &::placeholder {
1009
1008
  color: var(--eds-color-text-disabled);
1009
+
1010
1010
  /* Safari autofill override */
1011
1011
  -webkit-text-fill-color: var(--eds-color-text-disabled);
1012
1012
  }
@@ -1025,6 +1025,7 @@
1025
1025
 
1026
1026
  & .eds-input {
1027
1027
  color: var(--_readonly-text-color);
1028
+
1028
1029
  /* Safari autofill override */
1029
1030
  -webkit-text-fill-color: var(--_readonly-text-color);
1030
1031
  }
@@ -1043,23 +1044,27 @@
1043
1044
 
1044
1045
  /* Input/Textarea element */
1045
1046
  .eds-input {
1046
- /* Temporary alias until proper placeholder text token is available */
1047
- --_placeholder-text-color: var(--eds-color-border-strong);
1047
+ --_placeholder-text-color: var(--eds-color-text-subtle);
1048
1048
 
1049
+ resize: none;
1050
+
1051
+ overflow: hidden;
1049
1052
  flex: 1;
1053
+
1050
1054
  min-inline-size: 0;
1055
+ padding: 0;
1051
1056
  border: var(--eds-sizing-stroke-none);
1052
- background: transparent;
1053
- outline: none;
1057
+
1054
1058
  color: var(--eds-color-text-strong);
1055
- padding: 0;
1056
- overflow: hidden;
1057
- white-space: nowrap;
1058
1059
  text-overflow: ellipsis;
1059
- resize: none;
1060
+ white-space: nowrap;
1061
+
1062
+ background: transparent;
1063
+ outline: none;
1060
1064
 
1061
1065
  &::placeholder {
1062
1066
  color: var(--_placeholder-text-color);
1067
+
1063
1068
  /* Safari autofill override */
1064
1069
  -webkit-text-fill-color: var(--_placeholder-text-color);
1065
1070
  }
@@ -1067,16 +1072,17 @@
1067
1072
 
1068
1073
  /* Error icon */
1069
1074
  .eds-error-icon {
1070
- color: var(--eds-color-text-subtle);
1071
1075
  flex-shrink: 0;
1076
+ color: var(--eds-color-text-subtle);
1072
1077
  }
1073
1078
 
1074
1079
  /* Adornments container */
1075
1080
  .eds-adornment {
1076
1081
  display: flex;
1077
- align-items: center;
1078
- gap: var(--eds-typography-gap-horizontal);
1079
1082
  flex-shrink: 0;
1083
+ gap: var(--eds-typography-gap-horizontal);
1084
+ align-items: center;
1085
+
1080
1086
  color: var(--eds-color-text-subtle);
1081
1087
  }
1082
1088
 
@@ -1131,4 +1137,339 @@
1131
1137
  margin-block: calc(var(--eds-sizing-icon-xs) / -2);
1132
1138
  }
1133
1139
  }
1140
+ @layer eds-components {
1141
+ .eds-text-area {
1142
+ & .label-row {
1143
+ display: flex;
1144
+ align-items: center;
1145
+ justify-content: space-between;
1146
+ gap: var(--eds-typography-gap-horizontal);
1147
+ inline-size: 100%;
1148
+
1149
+ & > button {
1150
+ flex-shrink: 0;
1151
+ margin-block: calc(var(--eds-sizing-icon-xs) / -2);
1152
+ }
1153
+ }
1154
+
1155
+ & .eds-input-container {
1156
+ align-items: flex-start;
1157
+ padding-block: var(--eds-container-space-vertical);
1158
+ overflow: hidden;
1159
+
1160
+ & textarea.eds-input {
1161
+ box-sizing: border-box;
1162
+ overflow: auto;
1163
+ white-space: pre-wrap;
1164
+ text-overflow: clip;
1165
+ resize: vertical;
1166
+ padding-block-end: var(--eds-container-space-vertical);
1167
+ padding-inline-end: var(--eds-selectable-space-horizontal);
1168
+ }
1169
+
1170
+ &:has(+ .helper-row) {
1171
+ margin-block-end: calc(
1172
+ var(--eds-spacing-vertical-3xs) - var(--eds-generic-gap-vertical)
1173
+ );
1174
+ }
1175
+ }
1176
+
1177
+ & .helper-row {
1178
+ display: flex;
1179
+ align-items: baseline;
1180
+ gap: var(--eds-typography-gap-horizontal);
1181
+ inline-size: 100%;
1182
+ }
1183
+
1184
+ & .char-count {
1185
+ flex-shrink: 0;
1186
+ color: var(--eds-color-text-subtle);
1187
+ }
1188
+ }
1189
+ }
1190
+ /* Must be outside @layer: [data-font-family] { margin: 0 } in variables.css
1191
+ is unlayered and overrides any margin inside @layer eds-components. */
1192
+ .eds-text-area {
1193
+ & .eds-error-icon {
1194
+ margin-block-start: var(--eds-spacing-vertical-2xs);
1195
+ }
1196
+
1197
+ & .char-count {
1198
+ margin-inline-start: auto;
1199
+ }
1200
+
1201
+ /* Extend textarea to bottom-right corner so the resize handle sits flush. */
1202
+ & textarea.eds-input {
1203
+ margin-block-end: calc(-1 * var(--eds-container-space-vertical));
1204
+ margin-inline-end: calc(-1 * var(--eds-selectable-space-horizontal));
1205
+ }
1206
+ }
1207
+ @layer eds-components {
1208
+ .eds-search {
1209
+ /* Color changes based on state — accent by default, overridden when readonly/disabled */
1210
+ & .search-icon {
1211
+ color: var(--eds-color-text-subtle);
1212
+
1213
+ [data-readonly] & {
1214
+ color: var(--eds-color-border-strong);
1215
+ }
1216
+
1217
+ [data-disabled] & {
1218
+ color: var(--eds-color-text-disabled);
1219
+ }
1220
+ }
1221
+
1222
+ /* Hide native clear button — replaced by our custom one */
1223
+ & [type='search']::-webkit-search-cancel-button {
1224
+ appearance: none;
1225
+ }
1226
+ }
1227
+ }
1228
+ @layer eds-components {
1229
+ .eds-link {
1230
+ color: var(--eds-color-text-link);
1231
+ text-decoration: underline;
1232
+ text-decoration-thickness: var(--eds-sizing-stroke-thin);
1233
+ text-underline-offset: var(--eds-spacing-vertical-4xs);
1234
+
1235
+ transition: color 150ms ease-in-out;
1236
+ }
1237
+
1238
+ .eds-link:hover {
1239
+ color: var(--eds-color-text-strong);
1240
+ }
1241
+
1242
+ .eds-link:focus-visible {
1243
+ border-radius: var(--eds-spacing-border-radius-rounded);
1244
+ color: var(--eds-color-text-strong);
1245
+ outline: var(--eds-sizing-stroke-thin) solid var(--eds-color-border-focus);
1246
+ outline-offset: var(--eds-spacing-vertical-3xs);
1247
+ }
1248
+
1249
+ /* Standalone variant: flex layout for icon + text */
1250
+ .eds-link[data-variant='standalone'] {
1251
+ position: relative;
1252
+
1253
+ gap: var(--eds-typography-gap-horizontal);
1254
+ align-items: center;
1255
+
1256
+ border-bottom: var(--eds-sizing-stroke-thin) solid currentcolor;
1257
+
1258
+ text-decoration: none;
1259
+ }
1260
+
1261
+ /* Use pseudo-element for focus ring so it can have border-radius
1262
+ while border-bottom stays straight */
1263
+ .eds-link[data-variant='standalone']:focus-visible {
1264
+ border-radius: 0;
1265
+ outline: none;
1266
+ }
1267
+
1268
+ .eds-link[data-variant='standalone']:focus-visible::after {
1269
+ pointer-events: none;
1270
+ content: '';
1271
+
1272
+ position: absolute;
1273
+ inset: calc(var(--eds-spacing-vertical-3xs) * -1);
1274
+
1275
+ border: var(--eds-sizing-stroke-thin) solid var(--eds-color-border-focus);
1276
+ border-radius: var(--eds-spacing-border-radius-rounded);
1277
+ }
1278
+ }
1279
+ /* Outside @layer to override typography.css [data-font-family] { display: block } */
1280
+ .eds-link[data-variant='standalone'] {
1281
+ display: inline-flex;
1282
+ }
1283
+ @layer eds-components {
1284
+ .eds-tooltip {
1285
+ /* Gap between tooltip and anchor; also used for the arrow height */
1286
+ --_arrow: var(--eds-spacing-vertical-3xs);
1287
+ /* Width of the arrow tip (1px = visually sharp, matches Figma) */
1288
+ --_tip: 1px;
1289
+
1290
+ /* UA popover reset */
1291
+ position: fixed;
1292
+ margin: 0;
1293
+ inset: auto;
1294
+ border: none;
1295
+ overflow: visible;
1296
+
1297
+ position-anchor: var(--tooltip-anchor-name);
1298
+ width: max-content;
1299
+ background-color: var(--eds-color-text-strong);
1300
+ color: var(--eds-color-text-strong-on-emphasis);
1301
+ border-radius: var(--eds-spacing-border-radius-rounded);
1302
+ padding-block: var(--eds-container-space-vertical);
1303
+ padding-inline: var(--eds-container-space-horizontal);
1304
+
1305
+ /* Rectangle shadow — always downward regardless of arrow direction (no shadow tokens in EDS 2.0) */
1306
+ box-shadow:
1307
+ 0px 2px 4px rgba(0, 0, 0, 0.14),
1308
+ 0px 3px 4px rgba(0, 0, 0, 0.12),
1309
+ 0px 1px 5px rgba(0, 0, 0, 0.2);
1310
+
1311
+ /* Arrow: ::before is expanded by --_arrow on all sides via `inset: calc(-1 * var(--_arrow))`.
1312
+ A 16-point star clip-path pre-draws all 4 arrows. `margin: inherit` shifts the pseudo-element
1313
+ to match the tooltip's own margin, so 3 arrows hide behind the tooltip body (z-index:-1)
1314
+ and only the gap-side arrow remains visible. */
1315
+ &::before {
1316
+ content: '';
1317
+ position: absolute;
1318
+ z-index: -1;
1319
+ background: inherit;
1320
+ inset: calc(-1 * var(--_arrow));
1321
+ margin: inherit;
1322
+ clip-path: polygon(
1323
+ /* top */
1324
+ calc(50% - var(--_arrow)) var(--_arrow),
1325
+ calc(50% - var(--_tip)) 0,
1326
+ calc(50% + var(--_tip)) 0,
1327
+ calc(50% + var(--_arrow)) var(--_arrow),
1328
+ /* right */
1329
+ calc(100% - var(--_arrow)) calc(50% - var(--_arrow)),
1330
+ 100% calc(50% - var(--_tip)),
1331
+ 100% calc(50% + var(--_tip)),
1332
+ calc(100% - var(--_arrow)) calc(50% + var(--_arrow)),
1333
+ /* bottom */
1334
+ calc(50% + var(--_arrow)) calc(100% - var(--_arrow)),
1335
+ calc(50% + var(--_tip)) 100%,
1336
+ calc(50% - var(--_tip)) 100%,
1337
+ calc(50% - var(--_arrow)) calc(100% - var(--_arrow)),
1338
+ /* left */
1339
+ var(--_arrow) calc(50% + var(--_arrow)),
1340
+ 0 calc(50% + var(--_tip)),
1341
+ 0 calc(50% - var(--_tip)),
1342
+ var(--_arrow) calc(50% - var(--_arrow))
1343
+ );
1344
+ }
1345
+
1346
+ &[data-placement='top'] {
1347
+ position-area: top;
1348
+ bottom: var(--_arrow);
1349
+ margin: var(--_arrow) var(--_arrow) 0;
1350
+ position-try-fallbacks: flip-block, --eds-tooltip-bottom;
1351
+ }
1352
+
1353
+ &[data-placement='bottom'] {
1354
+ position-area: bottom;
1355
+ top: var(--_arrow);
1356
+ margin: 0 var(--_arrow) var(--_arrow);
1357
+ position-try-fallbacks: flip-block, --eds-tooltip-top;
1358
+ }
1359
+
1360
+ &[data-placement='right'] {
1361
+ position-area: right;
1362
+ left: var(--_arrow);
1363
+ margin: var(--_arrow) var(--_arrow) var(--_arrow) 0;
1364
+ position-try-fallbacks: flip-inline, --eds-tooltip-left;
1365
+ }
1366
+
1367
+ &[data-placement='left'] {
1368
+ position-area: left;
1369
+ right: var(--_arrow);
1370
+ margin: var(--_arrow) 0 var(--_arrow) var(--_arrow);
1371
+ position-try-fallbacks: flip-inline, --eds-tooltip-right;
1372
+ }
1373
+
1374
+ & .label {
1375
+ font-feature-settings: 'lnum', 'tnum';
1376
+ }
1377
+ }
1378
+
1379
+ .eds-tooltip-anchor {
1380
+ display: inline-block;
1381
+ anchor-name: var(--tooltip-anchor-name);
1382
+ }
1383
+ }
1384
+ /* @position-try must be outside @layer per spec. */
1385
+ @position-try --eds-tooltip-bottom {
1386
+ position-area: bottom;
1387
+ top: var(--_arrow);
1388
+ margin: 0 var(--_arrow) var(--_arrow);
1389
+ }
1390
+ @position-try --eds-tooltip-top {
1391
+ position-area: top;
1392
+ bottom: var(--_arrow);
1393
+ margin: var(--_arrow) var(--_arrow) 0;
1394
+ }
1395
+ @position-try --eds-tooltip-left {
1396
+ position-area: left;
1397
+ right: var(--_arrow);
1398
+ margin: var(--_arrow) 0 var(--_arrow) var(--_arrow);
1399
+ }
1400
+ @position-try --eds-tooltip-right {
1401
+ position-area: right;
1402
+ left: var(--_arrow);
1403
+ margin: var(--_arrow) var(--_arrow) var(--_arrow) 0;
1404
+ }
1405
+ @layer eds-components {
1406
+ .eds-banner {
1407
+ position: relative;
1408
+
1409
+ display: flex;
1410
+ flex-wrap: wrap;
1411
+ gap: var(--eds-container-space-horizontal);
1412
+ align-items: flex-start;
1413
+
1414
+ padding: var(--eds-container-space-vertical)
1415
+ var(--eds-container-space-horizontal);
1416
+ border-radius: var(--eds-spacing-border-radius-rounded, 4px);
1417
+
1418
+ background: var(--eds-color-bg-surface);
1419
+ outline: var(--eds-sizing-stroke-thin) solid var(--eds-color-border-medium);
1420
+ }
1421
+
1422
+ .eds-banner__icon {
1423
+ display: flex;
1424
+ flex-shrink: 0;
1425
+ align-items: center;
1426
+
1427
+ height: var(--eds-typography-line-height, 1.5rem);
1428
+
1429
+ /*
1430
+ * Negative margin compensates for Figma's icon container padding,
1431
+ * pulling the icon closer to the component edge.
1432
+ * Figma variable: selectable/icon-container-padding (↕︎ -6px, ↔︎ -4.8px)
1433
+ * See #4684 for exporting this as a CSS custom property.
1434
+ */
1435
+ margin-block: -6px;
1436
+ margin-inline-start: -4.8px;
1437
+
1438
+ color: var(--eds-color-text-subtle);
1439
+ }
1440
+
1441
+ .eds-banner__message {
1442
+ flex: 1;
1443
+ min-width: 0;
1444
+ margin: 0;
1445
+ color: var(--eds-color-text-strong);
1446
+ }
1447
+
1448
+ .eds-banner__actions {
1449
+ display: flex;
1450
+ gap: var(--eds-selectable-gap-horizontal, 8px);
1451
+ align-items: center;
1452
+ }
1453
+
1454
+ .eds-banner__actions[data-placement='bottom'] {
1455
+ flex-basis: 100%;
1456
+ }
1457
+
1458
+ .eds-banner:has(.eds-banner__dismiss) {
1459
+ padding-inline-end: calc(
1460
+ var(--eds-container-space-horizontal) + 24px +
1461
+ var(--eds-container-space-horizontal)
1462
+ );
1463
+ }
1464
+
1465
+ .eds-banner__dismiss {
1466
+ position: absolute;
1467
+ top: var(--eds-container-space-vertical);
1468
+ right: var(--eds-container-space-horizontal);
1469
+
1470
+ /* Same Figma icon container padding compensation as .eds-banner__icon */
1471
+ margin-block: -6px;
1472
+ margin-inline-end: -4.8px;
1473
+ }
1474
+ }
1134
1475