@arbeidstilsynet/design-react 0.6.0 → 0.7.1

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/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { useDropzone } from "react-dropzone";
5
5
  import { Spinner, Button, ValidationMessage, Table, Link, Dropdown, Divider } from "@digdir/designsystemet-react";
6
6
  import { Alert, Avatar, Badge, BadgePosition, Breadcrumbs, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsList, Button as Button2, Card, CardBlock, Checkbox, Chip, ChipButton, ChipCheckbox, ChipRadio, ChipRemovable, Combobox, ComboboxEmpty, ComboboxOption, Details, DetailsContent, DetailsSummary, Dialog, DialogBlock, DialogTrigger, DialogTriggerContext, Divider as Divider2, Dropdown as Dropdown2, DropdownButton, DropdownHeading, DropdownItem, DropdownList, DropdownTrigger, DropdownTriggerContext, EXPERIMENTAL_AvatarStack, EXPERIMENTAL_Suggestion, EXPERIMENTAL_SuggestionClear, EXPERIMENTAL_SuggestionEmpty, EXPERIMENTAL_SuggestionInput, EXPERIMENTAL_SuggestionList, EXPERIMENTAL_SuggestionOption, ErrorSummary, ErrorSummaryHeading, ErrorSummaryItem, ErrorSummaryLink, ErrorSummaryList, Field, FieldAffix, FieldAffixes, FieldCounter, FieldDescription, Fieldset, FieldsetDescription, FieldsetLegend, Heading, Input, Label, Link as Link2, List, ListItem, ListOrdered, ListUnordered, Pagination, PaginationButton, PaginationItem, PaginationList, Paragraph, Popover, PopoverTrigger, PopoverTriggerContext, Radio, RovingFocusItem, RovingFocusRoot, Search, SearchButton, SearchClear, SearchInput, Select, SelectOptgroup, SelectOption, Skeleton, SkipLink, Spinner as Spinner2, Switch, Table as Table2, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TabsList, TabsPanel, TabsTab, Tag, Textarea, Textfield, ToggleGroup, ToggleGroupItem, Tooltip, ValidationMessage as ValidationMessage2, omit, useCheckboxGroup, useDebounceCallback, useIsomorphicLayoutEffect, useMediaQuery, usePagination, useRadioGroup, useSynchronizedAnimation } from "@digdir/designsystemet-react";
7
7
  import { Slot } from "@radix-ui/react-slot";
8
+ import clsx$1 from "clsx";
8
9
  var jsxRuntime = { exports: {} };
9
10
  var reactJsxRuntime_production = {};
10
11
  var hasRequiredReactJsxRuntime_production;
@@ -1181,7 +1182,7 @@ function useMediaQuery2(query, t0) {
1181
1182
  return matches;
1182
1183
  }
1183
1184
  function HeaderMenu(t0) {
1184
- const $ = compilerRuntimeExports.c(52);
1185
+ const $ = compilerRuntimeExports.c(53);
1185
1186
  let children;
1186
1187
  let className;
1187
1188
  let rest;
@@ -1260,10 +1261,11 @@ function HeaderMenu(t0) {
1260
1261
  } else {
1261
1262
  t5 = $[12];
1262
1263
  }
1263
- const t6 = isMobile ? "primary" : "tertiary";
1264
- let t7;
1264
+ const t6 = isMobile ? "sm" : void 0;
1265
+ const t7 = isMobile ? "primary" : "tertiary";
1266
+ let t8;
1265
1267
  if ($[13] !== isMobile || $[14] !== mobileMenuText || $[15] !== open || $[16] !== triggerContent) {
1266
- t7 = isMobile ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1268
+ t8 = isMobile ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1267
1269
  open ? /* @__PURE__ */ jsxRuntimeExports.jsx(XMarkIcon, { "aria-hidden": true }) : /* @__PURE__ */ jsxRuntimeExports.jsx(MenuHamburgerIcon, { "aria-hidden": true }),
1268
1270
  mobileMenuText
1269
1271
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -1274,145 +1276,262 @@ function HeaderMenu(t0) {
1274
1276
  $[14] = mobileMenuText;
1275
1277
  $[15] = open;
1276
1278
  $[16] = triggerContent;
1277
- $[17] = t7;
1279
+ $[17] = t8;
1278
1280
  } else {
1279
- t7 = $[17];
1281
+ t8 = $[17];
1280
1282
  }
1281
- let t8;
1282
- if ($[18] !== t6 || $[19] !== t7) {
1283
- t8 = /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Trigger, { "data-size": "sm", variant: t6, children: t7 });
1283
+ let t9;
1284
+ if ($[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
1285
+ t9 = /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Trigger, { "data-size": t6, variant: t7, className: "at-header__dropdown-trigger", children: t8 });
1284
1286
  $[18] = t6;
1285
1287
  $[19] = t7;
1286
1288
  $[20] = t8;
1289
+ $[21] = t9;
1287
1290
  } else {
1288
- t8 = $[20];
1291
+ t9 = $[21];
1289
1292
  }
1290
1293
  let t10;
1291
- let t9;
1292
- if ($[21] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1293
- t9 = () => setOpen(true);
1294
- t10 = () => setOpen(false);
1295
- $[21] = t10;
1296
- $[22] = t9;
1297
- } else {
1298
- t10 = $[21];
1299
- t9 = $[22];
1300
- }
1301
1294
  let t11;
1302
- if ($[23] !== links) {
1303
- t11 = links?.map(_temp$1);
1304
- $[23] = links;
1305
- $[24] = t11;
1295
+ if ($[22] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1296
+ t10 = () => setOpen(true);
1297
+ t11 = () => setOpen(false);
1298
+ $[22] = t10;
1299
+ $[23] = t11;
1306
1300
  } else {
1307
- t11 = $[24];
1301
+ t10 = $[22];
1302
+ t11 = $[23];
1308
1303
  }
1309
1304
  let t12;
1310
- if ($[25] !== links) {
1311
- t12 = links && links.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("at-header__dropdown-item-mobile at-header__dropdown-controls"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}) }) });
1312
- $[25] = links;
1313
- $[26] = t12;
1305
+ if ($[24] !== links) {
1306
+ t12 = links?.map(_temp$1);
1307
+ $[24] = links;
1308
+ $[25] = t12;
1314
1309
  } else {
1315
- t12 = $[26];
1310
+ t12 = $[25];
1316
1311
  }
1317
1312
  let t13;
1318
- if ($[27] !== children) {
1319
- t13 = children && /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "at-header__dropdown-controls", children }) });
1320
- $[27] = children;
1321
- $[28] = t13;
1313
+ if ($[26] !== links) {
1314
+ t13 = links && links.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("at-header__dropdown-item-mobile at-header__dropdown-controls"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}) }) });
1315
+ $[26] = links;
1316
+ $[27] = t13;
1322
1317
  } else {
1323
- t13 = $[28];
1318
+ t13 = $[27];
1324
1319
  }
1325
1320
  let t14;
1326
- if ($[29] !== t11 || $[30] !== t12 || $[31] !== t13) {
1327
- t14 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown.List, { children: [
1328
- t11,
1329
- t12,
1330
- t13
1331
- ] });
1332
- $[29] = t11;
1333
- $[30] = t12;
1334
- $[31] = t13;
1335
- $[32] = t14;
1321
+ if ($[28] !== children) {
1322
+ t14 = children && /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "at-header__dropdown-controls", children }) });
1323
+ $[28] = children;
1324
+ $[29] = t14;
1336
1325
  } else {
1337
- t14 = $[32];
1326
+ t14 = $[29];
1338
1327
  }
1339
1328
  let t15;
1340
1329
  let t16;
1341
- if ($[33] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1330
+ if ($[30] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
1342
1331
  t15 = () => setOpen(false);
1343
1332
  t16 = /* @__PURE__ */ jsxRuntimeExports.jsx(XMarkIcon, { "aria-hidden": true });
1344
- $[33] = t15;
1345
- $[34] = t16;
1333
+ $[30] = t15;
1334
+ $[31] = t16;
1346
1335
  } else {
1347
- t15 = $[33];
1348
- t16 = $[34];
1336
+ t15 = $[30];
1337
+ t16 = $[31];
1349
1338
  }
1350
1339
  let t17;
1351
- if ($[35] !== closeButtonText) {
1340
+ if ($[32] !== closeButtonText) {
1352
1341
  t17 = /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "at-header__dropdown-close-mobile", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", variant: "secondary", onClick: t15, children: [
1353
1342
  t16,
1354
1343
  closeButtonText
1355
1344
  ] }) }) });
1356
- $[35] = closeButtonText;
1357
- $[36] = t17;
1345
+ $[32] = closeButtonText;
1346
+ $[33] = t17;
1358
1347
  } else {
1359
- t17 = $[36];
1348
+ t17 = $[33];
1360
1349
  }
1361
1350
  let t18;
1362
- if ($[37] !== open || $[38] !== t14 || $[39] !== t17) {
1363
- t18 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown, { open, onOpen: t9, onClose: t10, placement: "bottom", className: "at-header__dropdown-content", children: [
1351
+ if ($[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t17) {
1352
+ t18 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown.List, { children: [
1353
+ t12,
1354
+ t13,
1364
1355
  t14,
1365
1356
  t17
1366
1357
  ] });
1367
- $[37] = open;
1368
- $[38] = t14;
1369
- $[39] = t17;
1370
- $[40] = t18;
1358
+ $[34] = t12;
1359
+ $[35] = t13;
1360
+ $[36] = t14;
1361
+ $[37] = t17;
1362
+ $[38] = t18;
1371
1363
  } else {
1372
- t18 = $[40];
1364
+ t18 = $[38];
1373
1365
  }
1374
1366
  let t19;
1375
- if ($[41] !== t18 || $[42] !== t8) {
1376
- t19 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown.TriggerContext, { children: [
1377
- t8,
1378
- t18
1379
- ] });
1380
- $[41] = t18;
1381
- $[42] = t8;
1382
- $[43] = t19;
1367
+ if ($[39] !== open || $[40] !== t18) {
1368
+ t19 = /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown, { open, onOpen: t10, onClose: t11, placement: "bottom", className: "at-header__dropdown-content", children: t18 });
1369
+ $[39] = open;
1370
+ $[40] = t18;
1371
+ $[41] = t19;
1383
1372
  } else {
1384
- t19 = $[43];
1373
+ t19 = $[41];
1385
1374
  }
1386
1375
  let t20;
1387
- if ($[44] !== backdropTop || $[45] !== open) {
1388
- t20 = open ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "at-header__dropdown-backdrop", style: {
1376
+ if ($[42] !== t19 || $[43] !== t9) {
1377
+ t20 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Dropdown.TriggerContext, { children: [
1378
+ t9,
1379
+ t19
1380
+ ] });
1381
+ $[42] = t19;
1382
+ $[43] = t9;
1383
+ $[44] = t20;
1384
+ } else {
1385
+ t20 = $[44];
1386
+ }
1387
+ let t21;
1388
+ if ($[45] !== backdropTop || $[46] !== open) {
1389
+ t21 = open ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { "aria-hidden": true, className: "at-header__dropdown-backdrop", style: {
1389
1390
  top: backdropTop
1390
1391
  } }) : null;
1391
- $[44] = backdropTop;
1392
- $[45] = open;
1393
- $[46] = t20;
1392
+ $[45] = backdropTop;
1393
+ $[46] = open;
1394
+ $[47] = t21;
1394
1395
  } else {
1395
- t20 = $[46];
1396
+ t21 = $[47];
1396
1397
  }
1397
- let t21;
1398
- if ($[47] !== rest || $[48] !== t19 || $[49] !== t20 || $[50] !== t5) {
1399
- t21 = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: t5, ...rest, children: [
1400
- t19,
1401
- t20
1398
+ let t22;
1399
+ if ($[48] !== rest || $[49] !== t20 || $[50] !== t21 || $[51] !== t5) {
1400
+ t22 = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: t5, ...rest, children: [
1401
+ t20,
1402
+ t21
1402
1403
  ] });
1403
- $[47] = rest;
1404
- $[48] = t19;
1404
+ $[48] = rest;
1405
1405
  $[49] = t20;
1406
- $[50] = t5;
1407
- $[51] = t21;
1406
+ $[50] = t21;
1407
+ $[51] = t5;
1408
+ $[52] = t22;
1408
1409
  } else {
1409
- t21 = $[51];
1410
+ t22 = $[52];
1410
1411
  }
1411
- return t21;
1412
+ return t22;
1412
1413
  }
1413
1414
  function _temp$1(link, index) {
1414
1415
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Dropdown.Item, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: clsx("at-header__dropdown-controls", "at-header__dropdown-item-mobile"), children: isValidElement(link) ? /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { className: clsx("at-header__link", "ds-link"), children: link }) : link }) }, "nav-" + index);
1415
1416
  }
1417
+ function HeaderMenuRow(t0) {
1418
+ const $ = compilerRuntimeExports.c(10);
1419
+ let className;
1420
+ let padded;
1421
+ let rest;
1422
+ if ($[0] !== t0) {
1423
+ ({
1424
+ className,
1425
+ padded,
1426
+ ...rest
1427
+ } = t0);
1428
+ $[0] = t0;
1429
+ $[1] = className;
1430
+ $[2] = padded;
1431
+ $[3] = rest;
1432
+ } else {
1433
+ className = $[1];
1434
+ padded = $[2];
1435
+ rest = $[3];
1436
+ }
1437
+ const t1 = padded && "padded";
1438
+ let t2;
1439
+ if ($[4] !== className || $[5] !== t1) {
1440
+ t2 = clsx$1("at-header__menu-row", t1, className);
1441
+ $[4] = className;
1442
+ $[5] = t1;
1443
+ $[6] = t2;
1444
+ } else {
1445
+ t2 = $[6];
1446
+ }
1447
+ let t3;
1448
+ if ($[7] !== rest || $[8] !== t2) {
1449
+ t3 = /* @__PURE__ */ jsxRuntimeExports.jsx(Slot, { className: t2, ...rest });
1450
+ $[7] = rest;
1451
+ $[8] = t2;
1452
+ $[9] = t3;
1453
+ } else {
1454
+ t3 = $[9];
1455
+ }
1456
+ return t3;
1457
+ }
1458
+ function HeaderMenuIcon(t0) {
1459
+ const $ = compilerRuntimeExports.c(8);
1460
+ let className;
1461
+ let rest;
1462
+ if ($[0] !== t0) {
1463
+ ({
1464
+ className,
1465
+ ...rest
1466
+ } = t0);
1467
+ $[0] = t0;
1468
+ $[1] = className;
1469
+ $[2] = rest;
1470
+ } else {
1471
+ className = $[1];
1472
+ rest = $[2];
1473
+ }
1474
+ let t1;
1475
+ if ($[3] !== className) {
1476
+ t1 = clsx$1("at-header__menu-icon", className);
1477
+ $[3] = className;
1478
+ $[4] = t1;
1479
+ } else {
1480
+ t1 = $[4];
1481
+ }
1482
+ let t2;
1483
+ if ($[5] !== rest || $[6] !== t1) {
1484
+ t2 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: t1, ...rest });
1485
+ $[5] = rest;
1486
+ $[6] = t1;
1487
+ $[7] = t2;
1488
+ } else {
1489
+ t2 = $[7];
1490
+ }
1491
+ return t2;
1492
+ }
1493
+ function HeaderMenuBadge(t0) {
1494
+ const $ = compilerRuntimeExports.c(10);
1495
+ let className;
1496
+ let rest;
1497
+ let t1;
1498
+ if ($[0] !== t0) {
1499
+ ({
1500
+ className,
1501
+ color: t1,
1502
+ ...rest
1503
+ } = t0);
1504
+ $[0] = t0;
1505
+ $[1] = className;
1506
+ $[2] = rest;
1507
+ $[3] = t1;
1508
+ } else {
1509
+ className = $[1];
1510
+ rest = $[2];
1511
+ t1 = $[3];
1512
+ }
1513
+ const color = t1 === void 0 ? "info" : t1;
1514
+ const t2 = `at-header__menu-badge-${color}`;
1515
+ let t3;
1516
+ if ($[4] !== className || $[5] !== t2) {
1517
+ t3 = clsx$1(t2, className);
1518
+ $[4] = className;
1519
+ $[5] = t2;
1520
+ $[6] = t3;
1521
+ } else {
1522
+ t3 = $[6];
1523
+ }
1524
+ let t4;
1525
+ if ($[7] !== rest || $[8] !== t3) {
1526
+ t4 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: t3, ...rest });
1527
+ $[7] = rest;
1528
+ $[8] = t3;
1529
+ $[9] = t4;
1530
+ } else {
1531
+ t4 = $[9];
1532
+ }
1533
+ return t4;
1534
+ }
1416
1535
  function HeaderNavbar(t0) {
1417
1536
  const $ = compilerRuntimeExports.c(11);
1418
1537
  let className;
@@ -1511,7 +1630,10 @@ const Header = Object.assign(Header$1, {
1511
1630
  Illustration: HeaderIllustration,
1512
1631
  Logo: HeaderLogo,
1513
1632
  Navbar: HeaderNavbar,
1514
- Menu: HeaderMenu
1633
+ Menu: HeaderMenu,
1634
+ MenuRow: HeaderMenuRow,
1635
+ MenuIcon: HeaderMenuIcon,
1636
+ MenuBadge: HeaderMenuBadge
1515
1637
  });
1516
1638
  const LogoBlack = (t0) => {
1517
1639
  const $ = compilerRuntimeExports.c(20);
@@ -1963,6 +2085,9 @@ export {
1963
2085
  HeaderIllustration,
1964
2086
  HeaderLogo,
1965
2087
  HeaderMenu,
2088
+ HeaderMenuBadge,
2089
+ HeaderMenuIcon,
2090
+ HeaderMenuRow,
1966
2091
  HeaderNavbar,
1967
2092
  HeaderTitle,
1968
2093
  Heading,