@norges-domstoler/dds-components 12.1.3 → 13.0.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.
Files changed (35) hide show
  1. package/dist/cjs/components/Button/Button.d.ts +1 -0
  2. package/dist/cjs/components/Button/Button.stories.d.ts +1 -0
  3. package/dist/cjs/components/Button/Button.types.d.ts +2 -0
  4. package/dist/cjs/components/LocalMessage/LocalMessage.stories.d.ts +1 -0
  5. package/dist/cjs/components/LocalMessage/LocalMessage.tokens.d.ts +23 -20
  6. package/dist/cjs/components/ProgressTracker/ProgressTracker.d.ts +0 -2
  7. package/dist/cjs/components/ProgressTracker/ProgressTracker.stories.d.ts +1 -2
  8. package/dist/cjs/components/Search/Search.tokens.d.ts +6 -1
  9. package/dist/cjs/components/Search/Search.utils.d.ts +9 -0
  10. package/dist/cjs/components/Spinner/Spinner.d.ts +2 -0
  11. package/dist/cjs/components/Spinner/Spinner.stories.d.ts +7 -1
  12. package/dist/cjs/components/Stack/Stack.d.ts +3 -5
  13. package/dist/cjs/index.js +214 -186
  14. package/dist/components/Button/Button.d.ts +1 -0
  15. package/dist/components/Button/Button.js +5 -2
  16. package/dist/components/Button/Button.stories.d.ts +1 -0
  17. package/dist/components/Button/Button.types.d.ts +2 -0
  18. package/dist/components/LocalMessage/LocalMessage.js +64 -65
  19. package/dist/components/LocalMessage/LocalMessage.stories.d.ts +1 -0
  20. package/dist/components/LocalMessage/LocalMessage.tokens.d.ts +23 -20
  21. package/dist/components/LocalMessage/LocalMessage.tokens.js +4 -21
  22. package/dist/components/ProgressTracker/ProgressTracker.d.ts +0 -2
  23. package/dist/components/ProgressTracker/ProgressTracker.js +2 -4
  24. package/dist/components/ProgressTracker/ProgressTracker.stories.d.ts +1 -2
  25. package/dist/components/ProgressTracker/ProgressTrackerItem.js +5 -23
  26. package/dist/components/Search/Search.js +40 -16
  27. package/dist/components/Search/Search.tokens.d.ts +6 -1
  28. package/dist/components/Search/Search.tokens.js +9 -3
  29. package/dist/components/Search/Search.utils.d.ts +9 -0
  30. package/dist/components/Search/Search.utils.js +35 -0
  31. package/dist/components/Spinner/Spinner.d.ts +2 -0
  32. package/dist/components/Spinner/Spinner.js +5 -3
  33. package/dist/components/Spinner/Spinner.stories.d.ts +7 -1
  34. package/dist/components/Stack/Stack.d.ts +3 -5
  35. package/package.json +3 -3
package/dist/cjs/index.js CHANGED
@@ -903,12 +903,12 @@ var message = {
903
903
  gap: spacing$A.SizesDdsSpacingLocalX05
904
904
  }
905
905
  };
906
- var icon$b = {
906
+ var icon$a = {
907
907
  marginTop: spacing$A.SizesDdsSpacingLocalX0125
908
908
  };
909
909
  var inputMessageTokens = {
910
910
  message: message,
911
- icon: icon$b
911
+ icon: icon$a
912
912
  };
913
913
 
914
914
  var size = 24;
@@ -4016,10 +4016,12 @@ function Spinner(props) {
4016
4016
  size = _props$size === void 0 ? ddsDesignTokens.ddsBaseTokens.iconSizes.DdsIconsizeMedium : _props$size,
4017
4017
  _props$color = props.color,
4018
4018
  color = _props$color === void 0 ? 'interactive' : _props$color,
4019
+ _props$tooltip = props.tooltip,
4020
+ tooltip = _props$tooltip === void 0 ? 'Innlasting pågår' : _props$tooltip,
4019
4021
  id = props.id,
4020
4022
  className = props.className,
4021
4023
  htmlProps = props.htmlProps,
4022
- rest = tslib.__rest(props, ["size", "color", "id", "className", "htmlProps"]);
4024
+ rest = tslib.__rest(props, ["size", "color", "tooltip", "id", "className", "htmlProps"]);
4023
4025
  var mountTime = React__default.default.useRef(Date.now());
4024
4026
  var outerAnimationDelay = -(mountTime.current % 2000);
4025
4027
  var innerAnimationDelay = -(mountTime.current % 1500);
@@ -4038,10 +4040,10 @@ function Spinner(props) {
4038
4040
  role: "img",
4039
4041
  "aria-labelledby": uniqueId
4040
4042
  }, spinnerProps, {
4041
- children: [jsxRuntime.jsx("title", Object.assign({
4043
+ children: [tooltip && jsxRuntime.jsx("title", Object.assign({
4042
4044
  id: uniqueId
4043
4045
  }, {
4044
- children: "innlastning p\xE5g\xE5r"
4046
+ children: tooltip
4045
4047
  })), jsxRuntime.jsx(Circle, Object.assign({}, circleProps, {
4046
4048
  cx: "25",
4047
4049
  cy: "25",
@@ -4142,6 +4144,8 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
4142
4144
  target = props.target,
4143
4145
  _props$loading = props.loading,
4144
4146
  loading = _props$loading === void 0 ? false : _props$loading,
4147
+ _props$loadingTooltip = props.loadingTooltip,
4148
+ loadingTooltip = _props$loadingTooltip === void 0 ? 'Lagring pågår' : _props$loadingTooltip,
4145
4149
  _props$fullWidth = props.fullWidth,
4146
4150
  fullWidth = _props$fullWidth === void 0 ? false : _props$fullWidth,
4147
4151
  icon = props.icon,
@@ -4151,7 +4155,7 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
4151
4155
  id = props.id,
4152
4156
  className = props.className,
4153
4157
  htmlProps = props.htmlProps,
4154
- rest = tslib.__rest(props, ["label", "purpose", "size", "iconPosition", "appearance", "href", "target", "loading", "fullWidth", "icon", "onClick", "onFocus", "onBlur", "id", "className", "htmlProps"]);
4158
+ rest = tslib.__rest(props, ["label", "purpose", "size", "iconPosition", "appearance", "href", "target", "loading", "loadingTooltip", "fullWidth", "icon", "onClick", "onFocus", "onBlur", "id", "className", "htmlProps"]);
4155
4159
  var as = href ? 'a' : 'button';
4156
4160
  var hasLabel = !!label;
4157
4161
  var hasIcon = !!icon;
@@ -4205,7 +4209,8 @@ var Button$1 = /*#__PURE__*/React.forwardRef(function (props, ref) {
4205
4209
  }, {
4206
4210
  children: jsxRuntime.jsx(Spinner, {
4207
4211
  color: appearances[appearance].purpose[purpose].base.color,
4208
- size: sizes[size].justIcon.icon.fontSize
4212
+ size: sizes[size].justIcon.icon.fontSize,
4213
+ tooltip: loadingTooltip
4209
4214
  })
4210
4215
  }))]
4211
4216
  }));
@@ -4249,7 +4254,7 @@ var input$3 = {
4249
4254
  }
4250
4255
  }
4251
4256
  };
4252
- var icon$a = {
4257
+ var icon$9 = {
4253
4258
  color: colors$o.DdsColorNeutralsGray9,
4254
4259
  sizes: {
4255
4260
  medium: {
@@ -4268,23 +4273,23 @@ var icon$a = {
4268
4273
  };
4269
4274
  var textInputTokens = {
4270
4275
  input: input$3,
4271
- icon: icon$a
4276
+ icon: icon$9
4272
4277
  };
4273
4278
 
4274
4279
  var iconSizes$4 = ddsDesignTokens.ddsBaseTokens.iconSizes;
4275
4280
  var input$2 = textInputTokens.input,
4276
- icon$9 = textInputTokens.icon;
4281
+ icon$8 = textInputTokens.icon;
4277
4282
  var MessageContainer$1 = styled__default.default.div.withConfig({
4278
4283
  displayName: "TextInputstyles__MessageContainer",
4279
4284
  componentId: "sc-165zflr-0"
4280
4285
  })(["display:flex;justify-content:space-between;"]);
4281
- var StyledIcon$4 = styled__default.default(Icon).withConfig({
4286
+ var StyledIcon$3 = styled__default.default(Icon).withConfig({
4282
4287
  displayName: "TextInputstyles__StyledIcon",
4283
4288
  componentId: "sc-165zflr-1"
4284
- })(["position:absolute;color:", ";", " z-index:1;"], icon$9.color, function (_ref) {
4289
+ })(["position:absolute;color:", ";", " z-index:1;"], icon$8.color, function (_ref) {
4285
4290
  var size = _ref.size,
4286
4291
  iconSize = _ref.iconSize;
4287
- return styled.css(["left:", ";", ""], icon$9.sizes[size].left, iconSize === 'small' ? styled.css(["top:", ";"], "calc(50% - ".concat(iconSizes$4.DdsIconsizeSmallNumberPx / 2, "px)")) : styled.css(["top:", ";"], "calc(50% - ".concat(iconSizes$4.DdsIconsizeMediumNumberPx / 2, "px)")));
4292
+ return styled.css(["left:", ";", ""], icon$8.sizes[size].left, iconSize === 'small' ? styled.css(["top:", ";"], "calc(50% - ".concat(iconSizes$4.DdsIconsizeSmallNumberPx / 2, "px)")) : styled.css(["top:", ";"], "calc(50% - ".concat(iconSizes$4.DdsIconsizeMediumNumberPx / 2, "px)")));
4288
4293
  });
4289
4294
  var StyledInput$1 = styled__default.default(StatefulInput).withConfig({
4290
4295
  displayName: "TextInputstyles__StyledInput",
@@ -4377,7 +4382,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_a, ref) {
4377
4382
  }, {
4378
4383
  children: label
4379
4384
  })), hasIcon ? jsxRuntime.jsxs(InputContainer$1, {
4380
- children: [jsxRuntime.jsx(StyledIcon$4, {
4385
+ children: [jsxRuntime.jsx(StyledIcon$3, {
4381
4386
  icon: icon,
4382
4387
  iconSize: getFormInputIconSize(componentSize),
4383
4388
  size: componentSize
@@ -4809,7 +4814,7 @@ var inputContainer$1 = {
4809
4814
  minHeight: inputContainerMinHeightMulti
4810
4815
  }
4811
4816
  };
4812
- var icon$8 = {
4817
+ var icon$7 = {
4813
4818
  marginRight: spacing$v.SizesDdsSpacingLocalX05
4814
4819
  };
4815
4820
  var selectTokens = {
@@ -4827,7 +4832,7 @@ var selectTokens = {
4827
4832
  noOptionsMessage: noOptionsMessage,
4828
4833
  clearIndicator: clearIndicator,
4829
4834
  loadingIndicator: loadingIndicator,
4830
- icon: icon$8
4835
+ icon: icon$7
4831
4836
  };
4832
4837
 
4833
4838
  var _control = selectTokens.control,
@@ -4842,7 +4847,7 @@ var _control = selectTokens.control,
4842
4847
  _multiValueRemove = selectTokens.multiValueRemove,
4843
4848
  _noOptionsMessage = selectTokens.noOptionsMessage,
4844
4849
  _placeholder = selectTokens.placeholder,
4845
- icon$7 = selectTokens.icon,
4850
+ icon$6 = selectTokens.icon,
4846
4851
  _valueContainer = selectTokens.valueContainer,
4847
4852
  inputContainer = selectTokens.inputContainer;
4848
4853
  var prefix = 'dds-select';
@@ -4868,10 +4873,10 @@ var InnerSingleValue = styled__default.default.div.withConfig({
4868
4873
  displayName: "Selectstyles__InnerSingleValue",
4869
4874
  componentId: "sc-19jkd5s-1"
4870
4875
  })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;box-sizing:border-box;max-width:100%;"]);
4871
- var StyledIcon$3 = styled__default.default(Icon).withConfig({
4876
+ var StyledIcon$2 = styled__default.default(Icon).withConfig({
4872
4877
  displayName: "Selectstyles__StyledIcon",
4873
4878
  componentId: "sc-19jkd5s-2"
4874
- })(["margin-right:", ";"], icon$7.marginRight);
4879
+ })(["margin-right:", ";"], icon$6.marginRight);
4875
4880
  var getCustomStyles = function getCustomStyles() {
4876
4881
  return {
4877
4882
  control: function control() {
@@ -5127,7 +5132,7 @@ var DDSInput = function DDSInput(props, ariaInvalid, ariaDescribedby) {
5127
5132
  };
5128
5133
  var DDSControl = function DDSControl(props, componentSize, icon) {
5129
5134
  return jsxRuntime.jsxs(Control, Object.assign({}, props, {
5130
- children: [icon && jsxRuntime.jsx(StyledIcon$3, {
5135
+ children: [icon && jsxRuntime.jsx(StyledIcon$2, {
5131
5136
  icon: icon,
5132
5137
  iconSize: getFormInputIconSize(componentSize)
5133
5138
  }), props.children]
@@ -5260,7 +5265,7 @@ var container$c = {
5260
5265
  backgroundColor: colors$l.DdsColorWarningLightest
5261
5266
  }
5262
5267
  };
5263
- var contentContainer$7 = {
5268
+ var contentContainer$5 = {
5264
5269
  paddingRight: spacing$u.SizesDdsSpacingLocalX15,
5265
5270
  paddingTop: spacing$u.SizesDdsSpacingLocalX075,
5266
5271
  paddingBottom: spacing$u.SizesDdsSpacingLocalX075,
@@ -5269,7 +5274,7 @@ var contentContainer$7 = {
5269
5274
  paddingRight: spacing$u.SizesDdsSpacingLocalX075
5270
5275
  }
5271
5276
  };
5272
- var purposeVariants$1 = {
5277
+ var purposeVariants$2 = {
5273
5278
  info: {
5274
5279
  icon: InfoIcon,
5275
5280
  closeButtonPurpose: 'secondary'
@@ -5285,7 +5290,7 @@ var purposeVariants$1 = {
5285
5290
  };
5286
5291
  var globalMessageTokens = {
5287
5292
  container: container$c,
5288
- contentContainer: contentContainer$7,
5293
+ contentContainer: contentContainer$5,
5289
5294
  icon: {
5290
5295
  marginRight: "".concat(spacing$u.SizesDdsSpacingLocalX075),
5291
5296
  info: {
@@ -5301,8 +5306,8 @@ var globalMessageTokens = {
5301
5306
  };
5302
5307
 
5303
5308
  var container$b = globalMessageTokens.container,
5304
- contentContainer$6 = globalMessageTokens.contentContainer,
5305
- icon$6 = globalMessageTokens.icon;
5309
+ contentContainer$4 = globalMessageTokens.contentContainer,
5310
+ icon$5 = globalMessageTokens.icon;
5306
5311
  var Container$d = styled__default.default.div.withConfig({
5307
5312
  displayName: "GlobalMessage__Container",
5308
5313
  componentId: "sc-bf2l65-0"
@@ -5313,17 +5318,17 @@ var Container$d = styled__default.default.div.withConfig({
5313
5318
  var MessageIconWrapper$1 = styled__default.default(Icon).withConfig({
5314
5319
  displayName: "GlobalMessage__MessageIconWrapper",
5315
5320
  componentId: "sc-bf2l65-1"
5316
- })(["margin-right:", ";"], icon$6.marginRight);
5321
+ })(["margin-right:", ";"], icon$5.marginRight);
5317
5322
  var ControlsContainer = styled__default.default.div.withConfig({
5318
5323
  displayName: "GlobalMessage__ControlsContainer",
5319
5324
  componentId: "sc-bf2l65-2"
5320
5325
  })(["display:flex;align-items:center;"]);
5321
- var ContentContainer$4 = styled__default.default.div.withConfig({
5326
+ var ContentContainer$3 = styled__default.default.div.withConfig({
5322
5327
  displayName: "GlobalMessage__ContentContainer",
5323
5328
  componentId: "sc-bf2l65-3"
5324
- })(["display:flex;align-items:center;padding-top:", ";padding-bottom:", ";padding-right:", ";"], contentContainer$6.paddingTop, contentContainer$6.paddingBottom, function (_ref2) {
5329
+ })(["display:flex;align-items:center;padding-top:", ";padding-bottom:", ";padding-right:", ";"], contentContainer$4.paddingTop, contentContainer$4.paddingBottom, function (_ref2) {
5325
5330
  var closable = _ref2.closable;
5326
- return closable ? contentContainer$6.withClosable.paddingRight : contentContainer$6.paddingRight;
5331
+ return closable ? contentContainer$4.withClosable.paddingRight : contentContainer$4.paddingRight;
5327
5332
  });
5328
5333
  var GlobalMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
5329
5334
  var message = props.message,
@@ -5345,12 +5350,12 @@ var GlobalMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
5345
5350
  purpose: purpose
5346
5351
  });
5347
5352
  return !isClosed ? jsxRuntime.jsxs(Container$d, Object.assign({}, containerProps, {
5348
- children: [jsxRuntime.jsxs(ContentContainer$4, Object.assign({
5353
+ children: [jsxRuntime.jsxs(ContentContainer$3, Object.assign({
5349
5354
  closable: closable
5350
5355
  }, {
5351
5356
  children: [jsxRuntime.jsx(MessageIconWrapper$1, {
5352
- icon: purposeVariants$1[purpose].icon,
5353
- color: icon$6[purpose].color
5357
+ icon: purposeVariants$2[purpose].icon,
5358
+ color: icon$5[purpose].color
5354
5359
  }), children !== null && children !== void 0 ? children : jsxRuntime.jsx(Typography, Object.assign({
5355
5360
  as: "span"
5356
5361
  }, {
@@ -5359,7 +5364,7 @@ var GlobalMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
5359
5364
  })), jsxRuntime.jsx(ControlsContainer, {
5360
5365
  children: closable && jsxRuntime.jsx(Button$1, {
5361
5366
  icon: CloseIcon,
5362
- purpose: purposeVariants$1[purpose].closeButtonPurpose,
5367
+ purpose: purposeVariants$2[purpose].closeButtonPurpose,
5363
5368
  appearance: "borderless",
5364
5369
  onClick: function onClick() {
5365
5370
  setClosed(true);
@@ -5382,7 +5387,8 @@ var container$a = {
5382
5387
  boxShadow: outerShadow.DdsShadow1Onlight,
5383
5388
  borderRadius: borderRadius$5.RadiiDdsBorderRadius1Radius,
5384
5389
  border: "".concat(border$9.BordersDdsBorderStyleLightStrokeWeight, " solid"),
5385
- padding: "0 ".concat(spacing$t.SizesDdsSpacingLocalX1)
5390
+ padding: spacing$t.SizesDdsSpacingLocalX075,
5391
+ gap: spacing$t.SizesDdsSpacingLocalX05
5386
5392
  },
5387
5393
  purpose: {
5388
5394
  info: {
@@ -5411,7 +5417,7 @@ var container$a = {
5411
5417
  }
5412
5418
  }
5413
5419
  };
5414
- var purposeVariants = {
5420
+ var purposeVariants$1 = {
5415
5421
  info: {
5416
5422
  icon: InfoIcon,
5417
5423
  closeButtonPurpose: 'secondary'
@@ -5437,7 +5443,7 @@ var purposeVariants = {
5437
5443
  closeButtonPurpose: 'danger'
5438
5444
  }
5439
5445
  };
5440
- var icon$5 = {
5446
+ var icon$4 = {
5441
5447
  marginRight: "".concat(spacing$t.SizesDdsSpacingLocalX075),
5442
5448
  info: {
5443
5449
  color: colors$k.DdsColorInfoDarkest
@@ -5458,71 +5464,65 @@ var icon$5 = {
5458
5464
  color: colors$k.DdsColorDangerDarkest
5459
5465
  }
5460
5466
  };
5461
- var contentContainer$5 = {
5462
- paddingRight: spacing$t.SizesDdsSpacingLocalX15,
5463
- paddingTop: spacing$t.SizesDdsSpacingLocalX075,
5464
- paddingBottom: spacing$t.SizesDdsSpacingLocalX075,
5465
- withClosable: {
5466
- paddingRight: spacing$t.SizesDdsSpacingLocalX075
5467
- },
5468
- vertical: {
5469
- paddingBottom: spacing$t.SizesDdsSpacingLocalX15
5470
- }
5471
- };
5472
- var topContainer$1 = {
5473
- paddingTop: spacing$t.SizesDdsSpacingLocalX15,
5474
- withClosable: {
5475
- paddingTop: spacing$t.SizesDdsSpacingLocalX1
5476
- }
5477
- };
5478
5467
  var localMessageTokens = {
5479
5468
  container: container$a,
5480
- contentContainer: contentContainer$5,
5481
- topContainer: topContainer$1,
5482
- icon: icon$5
5469
+ purposeVariants: purposeVariants$1,
5470
+ icon: icon$4
5483
5471
  };
5484
5472
 
5485
5473
  var defaultWidth$3 = '400px';
5486
5474
  var container$9 = localMessageTokens.container,
5487
- contentContainer$4 = localMessageTokens.contentContainer,
5488
- topContainer = localMessageTokens.topContainer;
5475
+ icon$3 = localMessageTokens.icon,
5476
+ purposeVariants = localMessageTokens.purposeVariants;
5489
5477
  var Container$c = styled__default.default.div.withConfig({
5490
5478
  displayName: "LocalMessage__Container",
5491
5479
  componentId: "sc-kmfp8w-0"
5492
- })(["box-sizing:border-box;display:flex;flex-direction:", ";box-shadow:", ";border:", ";padding:", ";border-radius:", ";", " ", ";*::selection{", "}", " width:", ";"], function (_ref) {
5493
- var layout = _ref.layout;
5494
- return layout === 'vertical' ? 'column' : 'row';
5495
- }, container$9.base.boxShadow, container$9.base.border, container$9.base.padding, container$9.base.borderRadius, getFontStyling(defaultTypographyType, true), function (_ref2) {
5496
- var layout = _ref2.layout;
5497
- return layout === 'horisontal' && styled.css(["align-items:center;justify-content:space-between;"]);
5498
- }, selection, function (_ref3) {
5480
+ })(["box-sizing:border-box;display:grid;grid-template-areas:", ";grid-template-columns:", ";box-shadow:", ";border:", ";border-radius:", ";padding:", ";gap:", ";align-items:center;", " *::selection{", "}", " width:", ";"], function (_ref) {
5481
+ var layout = _ref.layout,
5482
+ closable = _ref.closable;
5483
+ return getGridTemplateAreas(layout, closable);
5484
+ }, function (_ref2) {
5485
+ var layout = _ref2.layout,
5486
+ closable = _ref2.closable;
5487
+ return getGridTemplateColumns(layout, closable);
5488
+ }, container$9.base.boxShadow, container$9.base.border, container$9.base.borderRadius, container$9.base.padding, container$9.base.gap, getFontStyling(defaultTypographyType, true), selection, function (_ref3) {
5499
5489
  var purpose = _ref3.purpose;
5500
5490
  return purpose && styled.css(["border-color:", ";background-color:", ";"], container$9.purpose[purpose].borderColor, container$9.purpose[purpose].backgroundColor);
5501
5491
  }, function (_ref4) {
5502
5492
  var width = _ref4.width;
5503
5493
  return width;
5504
5494
  });
5495
+ function getGridTemplateAreas(layout, closeable) {
5496
+ if (closeable) {
5497
+ if (layout === 'horisontal') {
5498
+ return '"icon text closeButton"';
5499
+ }
5500
+ return '"icon closeButton" "text text"';
5501
+ } else {
5502
+ if (layout === 'horisontal') {
5503
+ return '"icon text"';
5504
+ }
5505
+ return '"icon icon" "text text"';
5506
+ }
5507
+ }
5508
+ function getGridTemplateColumns(layout, closable) {
5509
+ if (closable) {
5510
+ return layout === 'horisontal' ? 'min-content 1fr min-content' : '1fr min-content';
5511
+ }
5512
+ return layout === 'horisontal' ? 'min-content 1fr' : '1fr';
5513
+ }
5505
5514
  var MessageIconWrapper = styled__default.default(Icon).withConfig({
5506
5515
  displayName: "LocalMessage__MessageIconWrapper",
5507
5516
  componentId: "sc-kmfp8w-1"
5508
- })(["margin-right:", ";"], localMessageTokens.icon.marginRight);
5509
- var ContentContainer$3 = styled__default.default.div.withConfig({
5510
- displayName: "LocalMessage__ContentContainer",
5517
+ })(["grid-area:icon;"]);
5518
+ var TextContainer = styled__default.default.div.withConfig({
5519
+ displayName: "LocalMessage__TextContainer",
5511
5520
  componentId: "sc-kmfp8w-2"
5512
- })(["padding-top:", ";padding-right:", ";", ";"], contentContainer$4.paddingTop, function (_ref5) {
5513
- var closable = _ref5.closable;
5514
- return closable ? contentContainer$4.withClosable.paddingRight : contentContainer$4.paddingRight;
5515
- }, function (_ref6) {
5516
- var layout = _ref6.layout;
5517
- return layout === 'vertical' ? styled.css(["padding-bottom:", ";"], contentContainer$4.vertical.paddingBottom) : styled.css(["display:flex;align-items:center;padding-bottom:", ";"], contentContainer$4.paddingBottom);
5518
- });
5519
- var TopContainer = styled__default.default.div.withConfig({
5520
- displayName: "LocalMessage__TopContainer",
5521
+ })(["grid-area:text;"]);
5522
+ var CloseButton = styled__default.default(Button$1).withConfig({
5523
+ displayName: "LocalMessage__CloseButton",
5521
5524
  componentId: "sc-kmfp8w-3"
5522
- })(["width:100%;display:flex;justify-content:space-between;align-items:center;padding-top:", ";"], function (_ref7) {
5523
- var closable = _ref7.closable;
5524
- return closable ? topContainer.withClosable.paddingTop : topContainer.paddingTop;
5525
- });
5525
+ })(["grid-area:closeButton;margin:-", " 0;"], container$9.base.padding);
5526
5526
  var LocalMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
5527
5527
  var message = props.message,
5528
5528
  _props$purpose = props.purpose,
@@ -5546,49 +5546,64 @@ var LocalMessage = /*#__PURE__*/React.forwardRef(function (props, ref) {
5546
5546
  purpose: purpose,
5547
5547
  width: width,
5548
5548
  layout: layout,
5549
+ closable: closable,
5549
5550
  ref: ref
5550
5551
  });
5551
- var contentContainerProps = {
5552
- layout: layout,
5553
- closable: closable
5554
- };
5555
- var messageIconWrapper = jsxRuntime.jsx(MessageIconWrapper, {
5556
- icon: purposeVariants[purpose].icon,
5557
- color: localMessageTokens.icon[purpose].color
5558
- });
5559
- var content = children !== null && children !== void 0 ? children : jsxRuntime.jsx(Typography, Object.assign({
5560
- as: "span"
5561
- }, {
5562
- children: message
5563
- }));
5564
- var closeButton = closable && jsxRuntime.jsx(Button$1, {
5565
- icon: CloseIcon,
5566
- purpose: purposeVariants[purpose].closeButtonPurpose,
5567
- appearance: "borderless",
5568
- onClick: function onClick() {
5569
- setClosed(true);
5570
- onClose && onClose();
5571
- },
5572
- size: "small",
5573
- "aria-label": "Lukk melding"
5574
- });
5575
- return !isClosed ? jsxRuntime.jsx(Container$c, Object.assign({}, containerProps, {
5576
- children: layout === 'horisontal' ? jsxRuntime.jsxs(jsxRuntime.Fragment, {
5577
- children: [jsxRuntime.jsxs(ContentContainer$3, Object.assign({}, contentContainerProps, {
5578
- children: [messageIconWrapper, " ", content]
5579
- })), closeButton]
5580
- }) : jsxRuntime.jsxs(jsxRuntime.Fragment, {
5581
- children: [jsxRuntime.jsxs(TopContainer, Object.assign({
5582
- closable: closable
5552
+ if (isClosed) {
5553
+ return jsxRuntime.jsx(jsxRuntime.Fragment, {});
5554
+ }
5555
+ return jsxRuntime.jsxs(Container$c, Object.assign({}, containerProps, {
5556
+ children: [jsxRuntime.jsx(MessageIconWrapper, {
5557
+ icon: purposeVariants[purpose].icon,
5558
+ color: icon$3[purpose].color
5559
+ }), jsxRuntime.jsx(TextContainer, {
5560
+ children: children !== null && children !== void 0 ? children : jsxRuntime.jsx(Typography, Object.assign({
5561
+ as: "span"
5583
5562
  }, {
5584
- children: [messageIconWrapper, " ", closeButton]
5585
- })), jsxRuntime.jsx(ContentContainer$3, Object.assign({}, contentContainerProps, {
5586
- children: content
5587
- }))]
5588
- })
5589
- })) : null;
5563
+ children: message
5564
+ }))
5565
+ }), closable && jsxRuntime.jsx(CloseButton, {
5566
+ icon: CloseIcon,
5567
+ purpose: purposeVariants[purpose].closeButtonPurpose,
5568
+ appearance: "borderless",
5569
+ onClick: function onClick() {
5570
+ setClosed(true);
5571
+ onClose && onClose();
5572
+ },
5573
+ size: "small",
5574
+ "aria-label": "Lukk melding"
5575
+ })]
5576
+ }));
5590
5577
  });
5591
5578
 
5579
+ var Wrapper$6 = styled__default.default.span.withConfig({
5580
+ displayName: "VisuallyHidden__Wrapper",
5581
+ componentId: "sc-ciubxt-0"
5582
+ })(["position:absolute;width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);border:0px;"]);
5583
+ var VisuallyHidden = function VisuallyHidden(props) {
5584
+ var children = props.children,
5585
+ id = props.id,
5586
+ className = props.className,
5587
+ htmlProps = props.htmlProps,
5588
+ as = props.as,
5589
+ rest = tslib.__rest(props, ["children", "id", "className", "htmlProps", "as"]);
5590
+ if (as === 'div') {
5591
+ return jsxRuntime.jsx(Wrapper$6, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
5592
+ as: as
5593
+ }, {
5594
+ children: children
5595
+ }));
5596
+ }
5597
+ return jsxRuntime.jsx(Wrapper$6, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
5598
+ children: children
5599
+ }));
5600
+ };
5601
+
5602
+ var AutocompleteSearchContext = /*#__PURE__*/React.createContext({});
5603
+ var useAutocompleteSearch = function useAutocompleteSearch() {
5604
+ return React.useContext(AutocompleteSearchContext);
5605
+ };
5606
+
5592
5607
  var spacing$s = ddsDesignTokens.ddsBaseTokens.spacing,
5593
5608
  iconSizes$3 = ddsDesignTokens.ddsBaseTokens.iconSizes,
5594
5609
  colors$j = ddsDesignTokens.ddsBaseTokens.colors;
@@ -5603,7 +5618,7 @@ var paddingLeftMedium = "".concat(spacing$s.SizesDdsSpacingLocalX075NumberPx + i
5603
5618
  var paddingLeftLarge = "".concat(spacing$s.SizesDdsSpacingLocalX075NumberPx + iconSizes$3.DdsIconsizeMediumNumberPx + spacing$s.SizesDdsSpacingLocalX05NumberPx, "px");
5604
5619
  var input$1 = {
5605
5620
  base: {
5606
- paddingRight: spacing$s.SizesDdsSpacingLocalX05,
5621
+ paddingRight: spacing$s.SizesDdsSpacingLocalX25,
5607
5622
  paddingLeft: spacing$s.SizesDdsSpacingLocalX3
5608
5623
  },
5609
5624
  sizes: {
@@ -5630,7 +5645,7 @@ var horisontalContainer$1 = {
5630
5645
  var outerContainer$6 = {
5631
5646
  gap: spacing$s.SizesDdsSpacingLocalX0125
5632
5647
  };
5633
- var icon$4 = {
5648
+ var searchIcon$1 = {
5634
5649
  base: {
5635
5650
  left: spacing$s.SizesDdsSpacingLocalX075,
5636
5651
  color: textDefault$2.textColor
@@ -5645,6 +5660,11 @@ var icon$4 = {
5645
5660
  top: "calc(50% - ".concat(iconSizes$3.DdsIconsizeMediumNumberPx / 2, "px)")
5646
5661
  }
5647
5662
  };
5663
+ var clearButton$1 = {
5664
+ right: spacing$s.SizesDdsSpacingLocalX075,
5665
+ top: "calc(50% - 14px)",
5666
+ color: textDefault$2.textColor
5667
+ };
5648
5668
  var suggestionsContainer$1 = {
5649
5669
  marginTop: spacing$s.SizesDdsSpacingLocalX025,
5650
5670
  border: "1px solid ".concat(colors$j.DdsColorInteractiveBase),
@@ -5655,7 +5675,8 @@ var suggestionsHeader$1 = {
5655
5675
  };
5656
5676
  var searchTokens = {
5657
5677
  input: input$1,
5658
- icon: icon$4,
5678
+ searchIcon: searchIcon$1,
5679
+ clearButton: clearButton$1,
5659
5680
  horisontalContainer: horisontalContainer$1,
5660
5681
  outerContainer: outerContainer$6,
5661
5682
  suggestionsContainer: suggestionsContainer$1,
@@ -5893,38 +5914,45 @@ var SearchSuggestions = /*#__PURE__*/React.forwardRef(function (props, ref) {
5893
5914
  }));
5894
5915
  });
5895
5916
 
5896
- var AutocompleteSearchContext = /*#__PURE__*/React.createContext({});
5897
- var useAutocompleteSearch = function useAutocompleteSearch() {
5898
- return React.useContext(AutocompleteSearchContext);
5899
- };
5900
-
5901
- var Wrapper$6 = styled__default.default.span.withConfig({
5902
- displayName: "VisuallyHidden__Wrapper",
5903
- componentId: "sc-ciubxt-0"
5904
- })(["position:absolute;width:1px;height:1px;margin:0px;padding:0px;top:0px;inset-inline-start:0px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);border:0px;"]);
5905
- var VisuallyHidden = function VisuallyHidden(props) {
5906
- var children = props.children,
5907
- id = props.id,
5908
- className = props.className,
5909
- htmlProps = props.htmlProps,
5910
- as = props.as,
5911
- rest = tslib.__rest(props, ["children", "id", "className", "htmlProps", "as"]);
5912
- if (as === 'div') {
5913
- return jsxRuntime.jsx(Wrapper$6, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
5914
- as: as
5915
- }, {
5916
- children: children
5917
- }));
5918
- }
5919
- return jsxRuntime.jsx(Wrapper$6, Object.assign({}, getBaseHTMLProps(id, className, htmlProps, rest), {
5920
- children: children
5921
- }));
5922
- };
5917
+ /**
5918
+ * Lager en change-event som kan resette verdien i et input-felt.
5919
+ * Dette vil resultere i en event som har: event.target.value = ''.
5920
+ *
5921
+ * @param inputElementId Id'en til et gitt input-felt
5922
+ * @returns En change-event som har en tom streng som target value
5923
+ */
5924
+ function createEmptyChangeEvent(inputElementId) {
5925
+ var inputElement = document.getElementById(inputElementId);
5926
+ inputElement.value = '';
5927
+ var emptyChangeEvent = {
5928
+ target: inputElement,
5929
+ currentTarget: inputElement,
5930
+ bubbles: true,
5931
+ cancelable: false,
5932
+ defaultPrevented: false,
5933
+ eventPhase: 0,
5934
+ isTrusted: false,
5935
+ preventDefault: function preventDefault() {},
5936
+ stopPropagation: function stopPropagation() {},
5937
+ nativeEvent: new Event('input'),
5938
+ persist: function persist() {},
5939
+ type: 'change',
5940
+ timeStamp: Date.now(),
5941
+ isDefaultPrevented: function isDefaultPrevented() {
5942
+ return false;
5943
+ },
5944
+ isPropagationStopped: function isPropagationStopped() {
5945
+ return false;
5946
+ }
5947
+ };
5948
+ return emptyChangeEvent;
5949
+ }
5923
5950
 
5924
5951
  var input = searchTokens.input,
5925
5952
  outerContainer$5 = searchTokens.outerContainer,
5926
5953
  horisontalContainer = searchTokens.horisontalContainer,
5927
- icon$3 = searchTokens.icon;
5954
+ searchIcon = searchTokens.searchIcon,
5955
+ clearButton = searchTokens.clearButton;
5928
5956
  var getIconSize = function getIconSize(size) {
5929
5957
  switch (size) {
5930
5958
  case 'large':
@@ -5942,27 +5970,31 @@ var Input = styled__default.default(Input$2).withConfig({
5942
5970
  var componentSize = _ref.componentSize;
5943
5971
  return styled.css(["padding-top:", ";padding-bottom:", ";padding-left:", ";", ""], input.sizes[componentSize].paddingTop, input.sizes[componentSize].paddingBottom, input.sizes[componentSize].paddingLeft, getFontStyling(typographyTypes$4[componentSize]));
5944
5972
  });
5945
- var StyledIcon$2 = styled__default.default(Icon).withConfig({
5946
- displayName: "Search__StyledIcon",
5973
+ var StyledSearchIcon = styled__default.default(Icon).withConfig({
5974
+ displayName: "Search__StyledSearchIcon",
5947
5975
  componentId: "sc-1ax3s9s-1"
5948
- })(["position:absolute;left:", ";color:", ";", " z-index:1;"], icon$3.base.left, icon$3.base.color, function (_ref2) {
5976
+ })(["position:absolute;left:", ";color:", ";", " z-index:1;"], searchIcon.base.left, searchIcon.base.color, function (_ref2) {
5949
5977
  var size = _ref2.size;
5950
- return styled.css(["top:", ";"], searchTokens.icon[size].top);
5978
+ return styled.css(["top:", ";"], searchTokens.searchIcon[size].top);
5951
5979
  });
5980
+ var StyledClearButton = styled__default.default(Button$1).withConfig({
5981
+ displayName: "Search__StyledClearButton",
5982
+ componentId: "sc-1ax3s9s-2"
5983
+ })(["position:absolute;right:", ";color:", ";top:", ";"], clearButton.right, clearButton.color, clearButton.top);
5952
5984
  var OuterContainer$3 = styled__default.default.div.withConfig({
5953
5985
  displayName: "Search__OuterContainer",
5954
- componentId: "sc-1ax3s9s-2"
5986
+ componentId: "sc-1ax3s9s-3"
5955
5987
  })(["display:flex;flex-direction:column;gap:", ";"], outerContainer$5.gap);
5956
5988
  var HorisontalContainer = styled__default.default.div.withConfig({
5957
5989
  displayName: "Search__HorisontalContainer",
5958
- componentId: "sc-1ax3s9s-3"
5990
+ componentId: "sc-1ax3s9s-4"
5959
5991
  })(["", ""], function (props) {
5960
5992
  return props.hasSearchButton && styled.css(["display:grid;grid-template-columns:1fr auto;gap:", ";"], horisontalContainer.gap);
5961
5993
  });
5962
5994
  var InputContainer = styled__default.default.div.withConfig({
5963
5995
  displayName: "Search__InputContainer",
5964
- componentId: "sc-1ax3s9s-4"
5965
- })(["position:relative;"]);
5996
+ componentId: "sc-1ax3s9s-5"
5997
+ })(["position:relative;display:flex;"]);
5966
5998
  var Search$1 = /*#__PURE__*/React.forwardRef(function (_a, ref) {
5967
5999
  var _a$componentSize = _a.componentSize,
5968
6000
  componentSize = _a$componentSize === void 0 ? 'medium' : _a$componentSize,
@@ -5983,12 +6015,21 @@ var Search$1 = /*#__PURE__*/React.forwardRef(function (_a, ref) {
5983
6015
  var tipId = derivativeIdGenerator(uniqueId, 'tip');
5984
6016
  var suggestionsId = derivativeIdGenerator(uniqueId, 'suggestions');
5985
6017
  var suggestionsDescriptionId = derivativeIdGenerator(uniqueId, 'suggestions-description');
6018
+ var _useState = React.useState(!!value),
6019
+ _useState2 = _slicedToArray(_useState, 2),
6020
+ hasValue = _useState2[0],
6021
+ setHasValue = _useState2[1];
5986
6022
  var context = useAutocompleteSearch();
5987
6023
  var combinedRef = context.inputRef ? useCombinedRef(context.inputRef, ref) : ref;
5988
6024
  var handleChange = function handleChange(e) {
6025
+ setHasValue(e.target.value !== '');
5989
6026
  context.onValueChange && context.onValueChange(e);
5990
6027
  onChange && onChange(e);
5991
6028
  };
6029
+ var clearInput = function clearInput() {
6030
+ var emptyChangeEvent = createEmptyChangeEvent(uniqueId);
6031
+ handleChange(emptyChangeEvent);
6032
+ };
5992
6033
  var containerProps = {
5993
6034
  className: className,
5994
6035
  style: style
@@ -6020,7 +6061,7 @@ var Search$1 = /*#__PURE__*/React.forwardRef(function (_a, ref) {
6020
6061
  hasSearchButton: showSearchButton
6021
6062
  }, containerProps, {
6022
6063
  children: [jsxRuntime.jsxs(InputContainer, {
6023
- children: [jsxRuntime.jsx(StyledIcon$2, {
6064
+ children: [jsxRuntime.jsx(StyledSearchIcon, {
6024
6065
  icon: SearchIcon,
6025
6066
  size: componentSize,
6026
6067
  iconSize: getIconSize(componentSize)
@@ -6044,6 +6085,13 @@ var Search$1 = /*#__PURE__*/React.forwardRef(function (_a, ref) {
6044
6085
  }, {
6045
6086
  children: "Bla i s\xF8keforslag med piltaster n\xE5r listen er utvidet."
6046
6087
  }))]
6088
+ }), hasValue && jsxRuntime.jsx(StyledClearButton, {
6089
+ icon: CloseSmallIcon,
6090
+ size: "tiny",
6091
+ purpose: "secondary",
6092
+ appearance: "borderless",
6093
+ "aria-label": "T\xF8m",
6094
+ onClick: clearInput
6047
6095
  })]
6048
6096
  }), showSearchButton && jsxRuntime.jsx(Button$1, Object.assign({
6049
6097
  size: componentSize,
@@ -10077,29 +10125,12 @@ var ItemText = styled__default.default.div.withConfig({
10077
10125
  return styled.css(["color:", ";text-decoration:", ";"], itemText.disabled.color, itemText.disabled.textDecoration);
10078
10126
  }
10079
10127
  });
10080
- var ItemContentWrapper = styled__default.default.div.withConfig({
10128
+ var ItemContentWrapper = styled__default.default.button.withConfig({
10081
10129
  displayName: "ProgressTrackerItem__ItemContentWrapper",
10082
10130
  componentId: "sc-1j9qaj9-3"
10083
- })(["background:none;border:none;margin:0;padding:0;display:grid;grid-template-columns:", " 1fr;justify-content:flex-start;align-items:center;font-family:inherit;gap:", ";transition:", ";:focus-visible{", "}", " ", ""], itemNumber.size, itemContentWrapper.gap, focusVisibleTransitionValue, focusVisible, function (_ref3) {
10084
- var clickable = _ref3.clickable,
10085
- state = _ref3.state;
10086
- if (clickable) {
10087
- return styled.css([":hover{", "{", "}", "{", "}}"], ItemNumber, function () {
10088
- if (state === 'inactiveCompleted') {
10089
- return styled.css(["border-color:", ";color:", ";background-color:", ";"], itemNumber.completed.hover.borderColor, itemNumber.completed.hover.color, itemNumber.completed.hover.backgroundColor);
10090
- } else if (state === 'inactiveIncomplete') {
10091
- return styled.css(["border-color:", ";color:", ";background-color:", ";"], itemNumber.inactive.hover.borderColor, itemNumber.inactive.hover.color, itemNumber.inactive.hover.backgroundColor);
10092
- }
10093
- }, ItemText, function () {
10094
- if (state !== 'disabled') {
10095
- return styled.css(["text-decoration-color:", ";"], itemText.inactive.hover.textDecorationColor);
10096
- }
10097
- });
10098
- }
10099
- }, function (_ref4) {
10100
- var clickable = _ref4.clickable,
10101
- state = _ref4.state;
10102
- return clickable && state !== 'disabled' && styled.css(["cursor:pointer;"]);
10131
+ })(["background:none;border:none;margin:0;padding:0;display:grid;grid-template-columns:", " 1fr;justify-content:flex-start;align-items:center;font-family:inherit;gap:", ";transition:", ";:focus-visible{", "}", ""], itemNumber.size, itemContentWrapper.gap, focusVisibleTransitionValue, focusVisible, function (_ref3) {
10132
+ var state = _ref3.state;
10133
+ return state !== 'disabled' && styled.css(["cursor:pointer;"]);
10103
10134
  });
10104
10135
  var getVisuallyHiddenText = function getVisuallyHiddenText(active, completed, index) {
10105
10136
  return "".concat(index + 1, ", ").concat(active ? '' : 'Trinn, ').concat(completed ? 'Ferdig, ' : 'Ikke ferdig, ');
@@ -10118,8 +10149,7 @@ var ProgressTrackerItem = function ProgressTrackerItem(props) {
10118
10149
  handleStepChange = _useProgressTrackerCo.handleStepChange;
10119
10150
  var active = activeStep === index;
10120
10151
  var styleProps = {
10121
- state: toItemState(active, completed, disabled),
10122
- clickable: handleStepChange !== undefined
10152
+ state: toItemState(active, completed, disabled)
10123
10153
  };
10124
10154
  var stepNumberContent = React.useMemo(function () {
10125
10155
  if (completed) {
@@ -10175,12 +10205,10 @@ var ProgressTracker = function () {
10175
10205
  _props$activeStep = props.activeStep,
10176
10206
  activeStep = _props$activeStep === void 0 ? 0 : _props$activeStep,
10177
10207
  onStepChange = props.onStepChange,
10178
- _props$clickable = props.clickable,
10179
- clickable = _props$clickable === void 0 ? false : _props$clickable,
10180
10208
  children = props.children,
10181
10209
  className = props.className,
10182
10210
  htmlProps = props.htmlProps,
10183
- rest = tslib.__rest(props, ["id", "activeStep", "onStepChange", "clickable", "children", "className", "htmlProps"]);
10211
+ rest = tslib.__rest(props, ["id", "activeStep", "onStepChange", "children", "className", "htmlProps"]);
10184
10212
  var _useState = React.useState(activeStep),
10185
10213
  _useState2 = _slicedToArray(_useState, 2),
10186
10214
  thisActiveStep = _useState2[0],
@@ -10206,7 +10234,7 @@ var ProgressTracker = function () {
10206
10234
  return jsxRuntime.jsx(ProgressTrackerContext.Provider, Object.assign({
10207
10235
  value: {
10208
10236
  activeStep: thisActiveStep,
10209
- handleStepChange: clickable ? handleChange : undefined
10237
+ handleStepChange: handleChange
10210
10238
  }
10211
10239
  }, {
10212
10240
  children: jsxRuntime.jsx("div", Object.assign({