@norges-domstoler/dds-components 23.1.0 → 23.1.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.mjs CHANGED
@@ -4456,7 +4456,7 @@ var Button = ({
4456
4456
  as: propAs,
4457
4457
  children,
4458
4458
  purpose = "primary",
4459
- size: size2 = "medium",
4459
+ size: propSize = "medium",
4460
4460
  iconPosition = "left",
4461
4461
  loading,
4462
4462
  loadingTooltip,
@@ -4483,11 +4483,12 @@ var Button = ({
4483
4483
  const isIconButton = !hasLabel && hasIcon;
4484
4484
  const isTextButton = hasLabel && !hasIcon;
4485
4485
  const noContent = !hasLabel && !hasIcon;
4486
+ const size2 = groupSize != null ? groupSize : propSize;
4486
4487
  const buttonCn = cn(
4487
4488
  className,
4488
4489
  Button_default.button,
4489
4490
  Button_default[`button--${groupPurpose ? groupPurpose : purpose}`],
4490
- Button_default[`button--${groupSize ? groupSize : size2}`],
4491
+ Button_default[`button--${size2}`],
4491
4492
  isTextButton && Button_default["just-text"],
4492
4493
  ...hasLabelAndIcon ? [Button_default["with-text-and-icon"], Button_default[`with-icon-${iconPosition}`]] : [],
4493
4494
  isIconButton && Button_default["just-icon"],
@@ -6414,7 +6415,6 @@ var DateInput_default = {
6414
6415
  segment: "DateInput_segment",
6415
6416
  segment__placeholder: "DateInput_segment__placeholder",
6416
6417
  "segment__placeholder--invisible": "DateInput_segment__placeholder--invisible",
6417
- "clear-button--inactive": "DateInput_clear-button--inactive",
6418
6418
  "icon-wrapper--disabled": "DateInput_icon-wrapper--disabled",
6419
6419
  "popover-button": "DateInput_popover-button",
6420
6420
  "icon-wrapper--readonly": "DateInput_icon-wrapper--readonly",
@@ -6430,8 +6430,8 @@ var DateInput_default = {
6430
6430
  "calendar__cell-button": "DateInput_calendar__cell-button",
6431
6431
  "calendar__cell-button--today": "DateInput_calendar__cell-button--today",
6432
6432
  "calendar__cell-button--default": "DateInput_calendar__cell-button--default",
6433
- "calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
6434
6433
  "calendar__cell-button--unavailable": "DateInput_calendar__cell-button--unavailable",
6434
+ "calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
6435
6435
  "calendar__cell-button--unavailable--today": "DateInput_calendar__cell-button--unavailable--today"
6436
6436
  };
6437
6437
 
@@ -6458,28 +6458,31 @@ function CalendarCell({ date, state, onClose }) {
6458
6458
  isDisabled,
6459
6459
  isUnavailable
6460
6460
  } = useCalendarCell({ date }, state, ref);
6461
- if (isDisabled) {
6461
+ if (isOutsideVisibleRange) {
6462
6462
  return /* @__PURE__ */ jsx241("td", { ...cellProps });
6463
6463
  }
6464
- const variant = isSelected ? "selected" : isUnavailable || isDisabled ? "unavailable" : "default";
6465
6464
  const closeOnKeyboardBlurForward = (event) => {
6466
6465
  if (event.key === "Tab" && event.shiftKey === false) {
6467
6466
  onClose();
6468
6467
  }
6469
6468
  };
6469
+ const isEffectivelyUnavailable = isUnavailable || isDisabled;
6470
+ const isUnavailableToday = isEffectivelyUnavailable && isToday(date, timezone);
6470
6471
  return /* @__PURE__ */ jsx241("td", { ...cellProps, children: /* @__PURE__ */ jsx241(
6471
6472
  "button",
6472
6473
  {
6473
6474
  ...buttonProps,
6474
6475
  type: "button",
6475
6476
  ref,
6476
- hidden: isOutsideVisibleRange,
6477
6477
  onKeyDown: closeOnKeyboardBlurForward,
6478
6478
  className: cn(
6479
6479
  DateInput_default["calendar__grid-element"],
6480
6480
  DateInput_default["calendar__cell-button"],
6481
6481
  isToday(date, timezone) && DateInput_default["calendar__cell-button--today"],
6482
- DateInput_default[`calendar__cell-button--${variant}`],
6482
+ DateInput_default[`calendar__cell-button--default`],
6483
+ isSelected && DateInput_default[`calendar__cell-button--selected`],
6484
+ isEffectivelyUnavailable && DateInput_default[`calendar__cell-button--unavailable`],
6485
+ isUnavailableToday && DateInput_default["calendar__cell-button--unavailable--today"],
6483
6486
  typographyStyles_default["body-short-small"],
6484
6487
  focusable
6485
6488
  ),
@@ -6861,6 +6864,8 @@ function Calendar(props) {
6861
6864
  nextButtonProps: { onPress: onNext },
6862
6865
  title
6863
6866
  } = useCalendar(props, state);
6867
+ const isPrevDisabled = !!props.minValue && state.visibleRange.start.compare(props.minValue) <= 0;
6868
+ const isNextDisabled = !!props.maxValue && state.visibleRange.end.compare(props.maxValue) >= 0;
6864
6869
  const { onClose, closeButtonRef } = useContext12(CalendarPopoverContext);
6865
6870
  const closeOnKeyboardBlurBack = (event) => {
6866
6871
  var _a;
@@ -6875,6 +6880,7 @@ function Calendar(props) {
6875
6880
  /* @__PURE__ */ jsx244(
6876
6881
  Button,
6877
6882
  {
6883
+ "aria-hidden": optAttr(isPrevDisabled),
6878
6884
  type: "button",
6879
6885
  "aria-label": t(texts7.previousMonth),
6880
6886
  onClick: (e) => onPrev == null ? void 0 : onPrev(e),
@@ -6882,7 +6888,10 @@ function Calendar(props) {
6882
6888
  purpose: "tertiary",
6883
6889
  icon: ArrowLeftIcon,
6884
6890
  htmlProps: { onKeyDown: closeOnKeyboardBlurBack },
6885
- className: DateInput_default["calendar__month-button"]
6891
+ className: cn(
6892
+ DateInput_default["calendar__month-button"],
6893
+ isPrevDisabled && utilStyles_default.invisible
6894
+ )
6886
6895
  }
6887
6896
  ),
6888
6897
  /* @__PURE__ */ jsx244(
@@ -6898,12 +6907,16 @@ function Calendar(props) {
6898
6907
  Button,
6899
6908
  {
6900
6909
  type: "button",
6910
+ "aria-hidden": optAttr(isNextDisabled),
6901
6911
  "aria-label": t(texts7.nextMonth),
6902
6912
  onClick: (e) => onNext == null ? void 0 : onNext(e),
6903
6913
  size: "small",
6904
6914
  purpose: "tertiary",
6905
6915
  icon: ArrowRightIcon,
6906
- className: DateInput_default["calendar__month-button"]
6916
+ className: cn(
6917
+ DateInput_default["calendar__month-button"],
6918
+ isNextDisabled && utilStyles_default.invisible
6919
+ )
6907
6920
  }
6908
6921
  )
6909
6922
  ] }),
@@ -7119,9 +7132,13 @@ function DateSegment({
7119
7132
  const ref = useRef15(null);
7120
7133
  const { segmentProps } = useDateSegment(segment, state, ref);
7121
7134
  return /* @__PURE__ */ jsxs90(
7122
- "div",
7135
+ Box,
7123
7136
  {
7124
7137
  ...segmentProps,
7138
+ padding: "0 0.05rem",
7139
+ width: "max-content",
7140
+ height: "max-content",
7141
+ marginBlock: "auto",
7125
7142
  "aria-describedby": spaceSeparatedIdListGenerator([
7126
7143
  errorMessageId ? errorMessageId : void 0,
7127
7144
  tipId ? tipId : void 0
@@ -7398,7 +7415,7 @@ function DateField({
7398
7415
  absolute: true,
7399
7416
  "aria-label": t(texts9.clearDate),
7400
7417
  "aria-hidden": !hasValue,
7401
- className: cn(!hasValue && DateInput_default["clear-button--inactive"]),
7418
+ className: cn(!hasValue && utilStyles_default.invisible),
7402
7419
  size: componentSize,
7403
7420
  onClick: clearDate
7404
7421
  }
@@ -10147,6 +10164,7 @@ var inlineInputCns = (hasErrorState, showEditingIcon) => [
10147
10164
  var inlineTextareaCns = (hasErrorState, showEditingIcon) => [
10148
10165
  ...inlineInputCns(hasErrorState, showEditingIcon),
10149
10166
  typographyStyles_default["body-long-medium"],
10167
+ InlineEdit_default["inline-textarea"],
10150
10168
  utilStyles_default.scrollbar
10151
10169
  ];
10152
10170
  var inlineSelectCns = (hasErrorState, showEditingIcon, hasValue) => [
@@ -11073,7 +11091,6 @@ import { useState as useState23 } from "react";
11073
11091
  var Pagination_default = {
11074
11092
  list: "Pagination_list",
11075
11093
  list__item: "Pagination_list__item",
11076
- "list__item--hidden": "Pagination_list__item--hidden",
11077
11094
  indicators: "Pagination_indicators",
11078
11095
  "truncation-icon": "Pagination_truncation-icon"
11079
11096
  };
@@ -11275,12 +11292,16 @@ var getCustomStyles = (size2, hasError, isReadOnly) => ({
11275
11292
  textOverflow: "ellipsis",
11276
11293
  whiteSpace: "nowrap",
11277
11294
  boxSizing: "border-box",
11278
- paddingInline: "var(--dds-spacing-x0-25)",
11295
+ paddingInlineStart: "var(--dds-spacing-x0-25)",
11296
+ paddingBlock: "var(--dds-spacing-x0-125)",
11279
11297
  ...state.selectProps.isDisabled && {
11280
11298
  color: "var(--dds-color-text-subtle)"
11281
11299
  },
11282
11300
  ...isReadOnly && {
11283
11301
  color: "var(--dds-color-text-medium)"
11302
+ },
11303
+ ...(state.selectProps.isDisabled || isReadOnly) && {
11304
+ paddingInlineEnd: "var(--dds-spacing-x0-25)"
11284
11305
  }
11285
11306
  }),
11286
11307
  multiValueRemove: (provided, state) => state.selectProps.isDisabled || isReadOnly ? {
@@ -11968,7 +11989,7 @@ var Pagination = ({
11968
11989
  {
11969
11990
  className: cn(
11970
11991
  Pagination_default.list__item,
11971
- isOnFirstPage && Pagination_default["list__item--hidden"]
11992
+ isOnFirstPage && utilStyles_default.invisible
11972
11993
  ),
11973
11994
  "aria-hidden": isOnFirstPage,
11974
11995
  children: previousPageButton
@@ -11980,7 +12001,7 @@ var Pagination = ({
11980
12001
  {
11981
12002
  className: cn(
11982
12003
  Pagination_default.list__item,
11983
- isOnLastPage && Pagination_default["list__item--hidden"]
12004
+ isOnLastPage && utilStyles_default.invisible
11984
12005
  ),
11985
12006
  "aria-hidden": isOnLastPage,
11986
12007
  children: nextPageButton
@@ -12001,7 +12022,7 @@ var Pagination = ({
12001
12022
  {
12002
12023
  className: cn(
12003
12024
  Pagination_default.list__item,
12004
- isOnFirstPage && Pagination_default["list__item--hidden"]
12025
+ isOnFirstPage && utilStyles_default.invisible
12005
12026
  ),
12006
12027
  "aria-hidden": isOnFirstPage,
12007
12028
  children: /* @__PURE__ */ jsx309(
@@ -12023,7 +12044,7 @@ var Pagination = ({
12023
12044
  {
12024
12045
  className: cn(
12025
12046
  Pagination_default.list__item,
12026
- isOnFirstPage && Pagination_default["list__item--hidden"]
12047
+ isOnFirstPage && utilStyles_default.invisible
12027
12048
  ),
12028
12049
  "aria-hidden": isOnFirstPage,
12029
12050
  children: previousPageButton
@@ -12044,7 +12065,7 @@ var Pagination = ({
12044
12065
  {
12045
12066
  className: cn(
12046
12067
  Pagination_default.list__item,
12047
- isOnLastPage && Pagination_default["list__item--hidden"]
12068
+ isOnLastPage && utilStyles_default.invisible
12048
12069
  ),
12049
12070
  "aria-hidden": isOnLastPage,
12050
12071
  children: nextPageButton
@@ -12055,7 +12076,7 @@ var Pagination = ({
12055
12076
  {
12056
12077
  className: cn(
12057
12078
  Pagination_default.list__item,
12058
- isOnLastPage && Pagination_default["list__item--hidden"]
12079
+ isOnLastPage && utilStyles_default.invisible
12059
12080
  ),
12060
12081
  "aria-hidden": isOnLastPage,
12061
12082
  children: /* @__PURE__ */ jsx309(
@@ -12579,7 +12600,8 @@ var PhoneInput_default = {
12579
12600
  "inputs-container--small-screen-md": "PhoneInput_inputs-container--small-screen-md",
12580
12601
  "inputs-container--small-screen-lg": "PhoneInput_inputs-container--small-screen-lg",
12581
12602
  "inputs-container--small-screen-xl": "PhoneInput_inputs-container--small-screen-xl",
12582
- "calling-code": "PhoneInput_calling-code"
12603
+ "calling-code": "PhoneInput_calling-code",
12604
+ "calling-code--disabled": "PhoneInput_calling-code--disabled"
12583
12605
  };
12584
12606
 
12585
12607
  // src/components/PhoneInput/PhoneInput.tsx
@@ -12774,7 +12796,8 @@ var PhoneInput = ({
12774
12796
  className: cn(
12775
12797
  typographyStyles_default[`body-short-${componentSize}`],
12776
12798
  Input_default["input-group__absolute-el"],
12777
- PhoneInput_default["calling-code"]
12799
+ PhoneInput_default["calling-code"],
12800
+ (commonProps.disabled || commonProps.readOnly) && PhoneInput_default["calling-code--disabled"]
12778
12801
  ),
12779
12802
  ref: callingCodeRef,
12780
12803
  children: callingCode
@@ -15204,12 +15227,6 @@ ToggleBar.displayName = "ToggleBar";
15204
15227
  // src/components/ToggleBar/ToggleRadio.tsx
15205
15228
  import { useId as useId31 } from "react";
15206
15229
  import { jsx as jsx343, jsxs as jsxs133 } from "react/jsx-runtime";
15207
- var typographyTypes = {
15208
- large: "bodyShortLarge",
15209
- medium: "bodyShortMedium",
15210
- small: "bodyShortSmall",
15211
- xsmall: "bodyShortXsmall"
15212
- };
15213
15230
  var calculateChecked = (value, group, checked) => {
15214
15231
  if (typeof checked !== "undefined") return checked;
15215
15232
  if (typeof value !== "undefined" && value !== null && group) {
@@ -15272,11 +15289,13 @@ var ToggleRadio = ({
15272
15289
  }
15273
15290
  ),
15274
15291
  /* @__PURE__ */ jsxs133(
15275
- Typography,
15292
+ HStack,
15276
15293
  {
15277
15294
  as: "span",
15278
- typographyType: typographyTypes[group.size],
15295
+ justifyContent: "center",
15296
+ alignItems: "center",
15279
15297
  className: cn(
15298
+ typographyStyles_default[`body-short-${group.size}`],
15280
15299
  ToggleBar_default.content,
15281
15300
  Button_default[contentTypeCn],
15282
15301
  hasLabel && hasIcon && Button_default["with-icon-left"],
@@ -15300,10 +15319,7 @@ import { useId as useId32 } from "react";
15300
15319
 
15301
15320
  // src/components/ToggleButton/ToggleButton.module.css
15302
15321
  var ToggleButton_default = {
15303
- content: "ToggleButton_content",
15304
- small: "ToggleButton_small",
15305
- xsmall: "ToggleButton_xsmall",
15306
- "content--with-icon": "ToggleButton_content--with-icon"
15322
+ content: "ToggleButton_content"
15307
15323
  };
15308
15324
 
15309
15325
  // src/components/ToggleButton/ToggleButton.tsx
@@ -15336,19 +15352,29 @@ var ToggleButton = ({
15336
15352
  }
15337
15353
  ),
15338
15354
  /* @__PURE__ */ jsxs134(
15339
- "span",
15355
+ Paper,
15340
15356
  {
15357
+ as: "span",
15358
+ border: "border-default",
15359
+ background: "surface-default",
15360
+ borderRadius: "rounded",
15361
+ width: "fit-content",
15362
+ display: "inline-flex",
15363
+ alignItems: "center",
15341
15364
  className: cn(
15342
15365
  ToggleButton_default.content,
15343
- ToggleButton_default[size2],
15344
- hasIcon && ToggleButton_default["content--with-icon"],
15345
15366
  typographyStyles_default[`body-short-${size2}`],
15346
- focus_default["focus-styled-sibling"]
15367
+ focus_default["focus-styled-sibling"],
15368
+ Button_default[`button--${size2}`],
15369
+ Button_default["just-text"],
15370
+ ...hasIcon ? [
15371
+ Button_default["with-text-and-icon"],
15372
+ Button_default["with-icon-left"]
15373
+ ] : []
15347
15374
  ),
15348
15375
  children: [
15349
15376
  hasIcon && /* @__PURE__ */ jsx344(Icon, { icon, iconSize: "component" }),
15350
- " ",
15351
- label
15377
+ /* @__PURE__ */ jsx344("span", { children: label })
15352
15378
  ]
15353
15379
  }
15354
15380
  )
@@ -15763,7 +15789,6 @@ export {
15763
15789
  removeListStyling,
15764
15790
  renderInputMessage,
15765
15791
  scrollbarStyling,
15766
- typographyTypes,
15767
15792
  useAccordion,
15768
15793
  useAccordionContext,
15769
15794
  useCallbackRef,