@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.js CHANGED
@@ -406,7 +406,6 @@ __export(index_exports, {
406
406
  removeListStyling: () => removeListStyling,
407
407
  renderInputMessage: () => renderInputMessage,
408
408
  scrollbarStyling: () => scrollbarStyling,
409
- typographyTypes: () => typographyTypes,
410
409
  useAccordion: () => useAccordion,
411
410
  useAccordionContext: () => useAccordionContext,
412
411
  useCallbackRef: () => useCallbackRef,
@@ -4849,7 +4848,7 @@ var Button = ({
4849
4848
  as: propAs,
4850
4849
  children,
4851
4850
  purpose = "primary",
4852
- size: size2 = "medium",
4851
+ size: propSize = "medium",
4853
4852
  iconPosition = "left",
4854
4853
  loading,
4855
4854
  loadingTooltip,
@@ -4876,11 +4875,12 @@ var Button = ({
4876
4875
  const isIconButton = !hasLabel && hasIcon;
4877
4876
  const isTextButton = hasLabel && !hasIcon;
4878
4877
  const noContent = !hasLabel && !hasIcon;
4878
+ const size2 = groupSize != null ? groupSize : propSize;
4879
4879
  const buttonCn = cn(
4880
4880
  className,
4881
4881
  Button_default.button,
4882
4882
  Button_default[`button--${groupPurpose ? groupPurpose : purpose}`],
4883
- Button_default[`button--${groupSize ? groupSize : size2}`],
4883
+ Button_default[`button--${size2}`],
4884
4884
  isTextButton && Button_default["just-text"],
4885
4885
  ...hasLabelAndIcon ? [Button_default["with-text-and-icon"], Button_default[`with-icon-${iconPosition}`]] : [],
4886
4886
  isIconButton && Button_default["just-icon"],
@@ -6785,7 +6785,6 @@ var DateInput_default = {
6785
6785
  segment: "DateInput_segment",
6786
6786
  segment__placeholder: "DateInput_segment__placeholder",
6787
6787
  "segment__placeholder--invisible": "DateInput_segment__placeholder--invisible",
6788
- "clear-button--inactive": "DateInput_clear-button--inactive",
6789
6788
  "icon-wrapper--disabled": "DateInput_icon-wrapper--disabled",
6790
6789
  "popover-button": "DateInput_popover-button",
6791
6790
  "icon-wrapper--readonly": "DateInput_icon-wrapper--readonly",
@@ -6801,8 +6800,8 @@ var DateInput_default = {
6801
6800
  "calendar__cell-button": "DateInput_calendar__cell-button",
6802
6801
  "calendar__cell-button--today": "DateInput_calendar__cell-button--today",
6803
6802
  "calendar__cell-button--default": "DateInput_calendar__cell-button--default",
6804
- "calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
6805
6803
  "calendar__cell-button--unavailable": "DateInput_calendar__cell-button--unavailable",
6804
+ "calendar__cell-button--selected": "DateInput_calendar__cell-button--selected",
6806
6805
  "calendar__cell-button--unavailable--today": "DateInput_calendar__cell-button--unavailable--today"
6807
6806
  };
6808
6807
 
@@ -6829,28 +6828,31 @@ function CalendarCell({ date, state, onClose }) {
6829
6828
  isDisabled,
6830
6829
  isUnavailable
6831
6830
  } = (0, import_calendar.useCalendarCell)({ date }, state, ref);
6832
- if (isDisabled) {
6831
+ if (isOutsideVisibleRange) {
6833
6832
  return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)("td", { ...cellProps });
6834
6833
  }
6835
- const variant = isSelected ? "selected" : isUnavailable || isDisabled ? "unavailable" : "default";
6836
6834
  const closeOnKeyboardBlurForward = (event) => {
6837
6835
  if (event.key === "Tab" && event.shiftKey === false) {
6838
6836
  onClose();
6839
6837
  }
6840
6838
  };
6839
+ const isEffectivelyUnavailable = isUnavailable || isDisabled;
6840
+ const isUnavailableToday = isEffectivelyUnavailable && (0, import_date.isToday)(date, timezone);
6841
6841
  return /* @__PURE__ */ (0, import_jsx_runtime241.jsx)("td", { ...cellProps, children: /* @__PURE__ */ (0, import_jsx_runtime241.jsx)(
6842
6842
  "button",
6843
6843
  {
6844
6844
  ...buttonProps,
6845
6845
  type: "button",
6846
6846
  ref,
6847
- hidden: isOutsideVisibleRange,
6848
6847
  onKeyDown: closeOnKeyboardBlurForward,
6849
6848
  className: cn(
6850
6849
  DateInput_default["calendar__grid-element"],
6851
6850
  DateInput_default["calendar__cell-button"],
6852
6851
  (0, import_date.isToday)(date, timezone) && DateInput_default["calendar__cell-button--today"],
6853
- DateInput_default[`calendar__cell-button--${variant}`],
6852
+ DateInput_default[`calendar__cell-button--default`],
6853
+ isSelected && DateInput_default[`calendar__cell-button--selected`],
6854
+ isEffectivelyUnavailable && DateInput_default[`calendar__cell-button--unavailable`],
6855
+ isUnavailableToday && DateInput_default["calendar__cell-button--unavailable--today"],
6854
6856
  typographyStyles_default["body-short-small"],
6855
6857
  focusable
6856
6858
  ),
@@ -7223,6 +7225,8 @@ function Calendar(props) {
7223
7225
  nextButtonProps: { onPress: onNext },
7224
7226
  title
7225
7227
  } = (0, import_calendar3.useCalendar)(props, state);
7228
+ const isPrevDisabled = !!props.minValue && state.visibleRange.start.compare(props.minValue) <= 0;
7229
+ const isNextDisabled = !!props.maxValue && state.visibleRange.end.compare(props.maxValue) >= 0;
7226
7230
  const { onClose, closeButtonRef } = (0, import_react43.useContext)(CalendarPopoverContext);
7227
7231
  const closeOnKeyboardBlurBack = (event) => {
7228
7232
  var _a;
@@ -7237,6 +7241,7 @@ function Calendar(props) {
7237
7241
  /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
7238
7242
  Button,
7239
7243
  {
7244
+ "aria-hidden": optAttr(isPrevDisabled),
7240
7245
  type: "button",
7241
7246
  "aria-label": t(texts7.previousMonth),
7242
7247
  onClick: (e) => onPrev == null ? void 0 : onPrev(e),
@@ -7244,7 +7249,10 @@ function Calendar(props) {
7244
7249
  purpose: "tertiary",
7245
7250
  icon: ArrowLeftIcon,
7246
7251
  htmlProps: { onKeyDown: closeOnKeyboardBlurBack },
7247
- className: DateInput_default["calendar__month-button"]
7252
+ className: cn(
7253
+ DateInput_default["calendar__month-button"],
7254
+ isPrevDisabled && utilStyles_default.invisible
7255
+ )
7248
7256
  }
7249
7257
  ),
7250
7258
  /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(
@@ -7260,12 +7268,16 @@ function Calendar(props) {
7260
7268
  Button,
7261
7269
  {
7262
7270
  type: "button",
7271
+ "aria-hidden": optAttr(isNextDisabled),
7263
7272
  "aria-label": t(texts7.nextMonth),
7264
7273
  onClick: (e) => onNext == null ? void 0 : onNext(e),
7265
7274
  size: "small",
7266
7275
  purpose: "tertiary",
7267
7276
  icon: ArrowRightIcon,
7268
- className: DateInput_default["calendar__month-button"]
7277
+ className: cn(
7278
+ DateInput_default["calendar__month-button"],
7279
+ isNextDisabled && utilStyles_default.invisible
7280
+ )
7269
7281
  }
7270
7282
  )
7271
7283
  ] }),
@@ -7477,9 +7489,13 @@ function DateSegment({
7477
7489
  const ref = (0, import_react45.useRef)(null);
7478
7490
  const { segmentProps } = (0, import_datepicker.useDateSegment)(segment, state, ref);
7479
7491
  return /* @__PURE__ */ (0, import_jsx_runtime247.jsxs)(
7480
- "div",
7492
+ Box,
7481
7493
  {
7482
7494
  ...segmentProps,
7495
+ padding: "0 0.05rem",
7496
+ width: "max-content",
7497
+ height: "max-content",
7498
+ marginBlock: "auto",
7483
7499
  "aria-describedby": spaceSeparatedIdListGenerator([
7484
7500
  errorMessageId ? errorMessageId : void 0,
7485
7501
  tipId ? tipId : void 0
@@ -7756,7 +7772,7 @@ function DateField({
7756
7772
  absolute: true,
7757
7773
  "aria-label": t(texts9.clearDate),
7758
7774
  "aria-hidden": !hasValue,
7759
- className: cn(!hasValue && DateInput_default["clear-button--inactive"]),
7775
+ className: cn(!hasValue && utilStyles_default.invisible),
7760
7776
  size: componentSize,
7761
7777
  onClick: clearDate
7762
7778
  }
@@ -10472,6 +10488,7 @@ var inlineInputCns = (hasErrorState, showEditingIcon) => [
10472
10488
  var inlineTextareaCns = (hasErrorState, showEditingIcon) => [
10473
10489
  ...inlineInputCns(hasErrorState, showEditingIcon),
10474
10490
  typographyStyles_default["body-long-medium"],
10491
+ InlineEdit_default["inline-textarea"],
10475
10492
  utilStyles_default.scrollbar
10476
10493
  ];
10477
10494
  var inlineSelectCns = (hasErrorState, showEditingIcon, hasValue) => [
@@ -11393,7 +11410,6 @@ var import_react76 = require("react");
11393
11410
  var Pagination_default = {
11394
11411
  list: "Pagination_list",
11395
11412
  list__item: "Pagination_list__item",
11396
- "list__item--hidden": "Pagination_list__item--hidden",
11397
11413
  indicators: "Pagination_indicators",
11398
11414
  "truncation-icon": "Pagination_truncation-icon"
11399
11415
  };
@@ -11589,12 +11605,16 @@ var getCustomStyles = (size2, hasError, isReadOnly) => ({
11589
11605
  textOverflow: "ellipsis",
11590
11606
  whiteSpace: "nowrap",
11591
11607
  boxSizing: "border-box",
11592
- paddingInline: "var(--dds-spacing-x0-25)",
11608
+ paddingInlineStart: "var(--dds-spacing-x0-25)",
11609
+ paddingBlock: "var(--dds-spacing-x0-125)",
11593
11610
  ...state.selectProps.isDisabled && {
11594
11611
  color: "var(--dds-color-text-subtle)"
11595
11612
  },
11596
11613
  ...isReadOnly && {
11597
11614
  color: "var(--dds-color-text-medium)"
11615
+ },
11616
+ ...(state.selectProps.isDisabled || isReadOnly) && {
11617
+ paddingInlineEnd: "var(--dds-spacing-x0-25)"
11598
11618
  }
11599
11619
  }),
11600
11620
  multiValueRemove: (provided, state) => state.selectProps.isDisabled || isReadOnly ? {
@@ -12280,7 +12300,7 @@ var Pagination = ({
12280
12300
  {
12281
12301
  className: cn(
12282
12302
  Pagination_default.list__item,
12283
- isOnFirstPage && Pagination_default["list__item--hidden"]
12303
+ isOnFirstPage && utilStyles_default.invisible
12284
12304
  ),
12285
12305
  "aria-hidden": isOnFirstPage,
12286
12306
  children: previousPageButton
@@ -12292,7 +12312,7 @@ var Pagination = ({
12292
12312
  {
12293
12313
  className: cn(
12294
12314
  Pagination_default.list__item,
12295
- isOnLastPage && Pagination_default["list__item--hidden"]
12315
+ isOnLastPage && utilStyles_default.invisible
12296
12316
  ),
12297
12317
  "aria-hidden": isOnLastPage,
12298
12318
  children: nextPageButton
@@ -12313,7 +12333,7 @@ var Pagination = ({
12313
12333
  {
12314
12334
  className: cn(
12315
12335
  Pagination_default.list__item,
12316
- isOnFirstPage && Pagination_default["list__item--hidden"]
12336
+ isOnFirstPage && utilStyles_default.invisible
12317
12337
  ),
12318
12338
  "aria-hidden": isOnFirstPage,
12319
12339
  children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
@@ -12335,7 +12355,7 @@ var Pagination = ({
12335
12355
  {
12336
12356
  className: cn(
12337
12357
  Pagination_default.list__item,
12338
- isOnFirstPage && Pagination_default["list__item--hidden"]
12358
+ isOnFirstPage && utilStyles_default.invisible
12339
12359
  ),
12340
12360
  "aria-hidden": isOnFirstPage,
12341
12361
  children: previousPageButton
@@ -12356,7 +12376,7 @@ var Pagination = ({
12356
12376
  {
12357
12377
  className: cn(
12358
12378
  Pagination_default.list__item,
12359
- isOnLastPage && Pagination_default["list__item--hidden"]
12379
+ isOnLastPage && utilStyles_default.invisible
12360
12380
  ),
12361
12381
  "aria-hidden": isOnLastPage,
12362
12382
  children: nextPageButton
@@ -12367,7 +12387,7 @@ var Pagination = ({
12367
12387
  {
12368
12388
  className: cn(
12369
12389
  Pagination_default.list__item,
12370
- isOnLastPage && Pagination_default["list__item--hidden"]
12390
+ isOnLastPage && utilStyles_default.invisible
12371
12391
  ),
12372
12392
  "aria-hidden": isOnLastPage,
12373
12393
  children: /* @__PURE__ */ (0, import_jsx_runtime310.jsx)(
@@ -12885,7 +12905,8 @@ var PhoneInput_default = {
12885
12905
  "inputs-container--small-screen-md": "PhoneInput_inputs-container--small-screen-md",
12886
12906
  "inputs-container--small-screen-lg": "PhoneInput_inputs-container--small-screen-lg",
12887
12907
  "inputs-container--small-screen-xl": "PhoneInput_inputs-container--small-screen-xl",
12888
- "calling-code": "PhoneInput_calling-code"
12908
+ "calling-code": "PhoneInput_calling-code",
12909
+ "calling-code--disabled": "PhoneInput_calling-code--disabled"
12889
12910
  };
12890
12911
 
12891
12912
  // src/components/PhoneInput/PhoneInput.tsx
@@ -13080,7 +13101,8 @@ var PhoneInput = ({
13080
13101
  className: cn(
13081
13102
  typographyStyles_default[`body-short-${componentSize}`],
13082
13103
  Input_default["input-group__absolute-el"],
13083
- PhoneInput_default["calling-code"]
13104
+ PhoneInput_default["calling-code"],
13105
+ (commonProps.disabled || commonProps.readOnly) && PhoneInput_default["calling-code--disabled"]
13084
13106
  ),
13085
13107
  ref: callingCodeRef,
13086
13108
  children: callingCode
@@ -15450,12 +15472,6 @@ ToggleBar.displayName = "ToggleBar";
15450
15472
  // src/components/ToggleBar/ToggleRadio.tsx
15451
15473
  var import_react104 = require("react");
15452
15474
  var import_jsx_runtime344 = require("react/jsx-runtime");
15453
- var typographyTypes = {
15454
- large: "bodyShortLarge",
15455
- medium: "bodyShortMedium",
15456
- small: "bodyShortSmall",
15457
- xsmall: "bodyShortXsmall"
15458
- };
15459
15475
  var calculateChecked = (value, group, checked) => {
15460
15476
  if (typeof checked !== "undefined") return checked;
15461
15477
  if (typeof value !== "undefined" && value !== null && group) {
@@ -15518,11 +15534,13 @@ var ToggleRadio = ({
15518
15534
  }
15519
15535
  ),
15520
15536
  /* @__PURE__ */ (0, import_jsx_runtime344.jsxs)(
15521
- Typography,
15537
+ HStack,
15522
15538
  {
15523
15539
  as: "span",
15524
- typographyType: typographyTypes[group.size],
15540
+ justifyContent: "center",
15541
+ alignItems: "center",
15525
15542
  className: cn(
15543
+ typographyStyles_default[`body-short-${group.size}`],
15526
15544
  ToggleBar_default.content,
15527
15545
  Button_default[contentTypeCn],
15528
15546
  hasLabel && hasIcon && Button_default["with-icon-left"],
@@ -15546,10 +15564,7 @@ var import_react105 = require("react");
15546
15564
 
15547
15565
  // src/components/ToggleButton/ToggleButton.module.css
15548
15566
  var ToggleButton_default = {
15549
- content: "ToggleButton_content",
15550
- small: "ToggleButton_small",
15551
- xsmall: "ToggleButton_xsmall",
15552
- "content--with-icon": "ToggleButton_content--with-icon"
15567
+ content: "ToggleButton_content"
15553
15568
  };
15554
15569
 
15555
15570
  // src/components/ToggleButton/ToggleButton.tsx
@@ -15582,19 +15597,29 @@ var ToggleButton = ({
15582
15597
  }
15583
15598
  ),
15584
15599
  /* @__PURE__ */ (0, import_jsx_runtime345.jsxs)(
15585
- "span",
15600
+ Paper,
15586
15601
  {
15602
+ as: "span",
15603
+ border: "border-default",
15604
+ background: "surface-default",
15605
+ borderRadius: "rounded",
15606
+ width: "fit-content",
15607
+ display: "inline-flex",
15608
+ alignItems: "center",
15587
15609
  className: cn(
15588
15610
  ToggleButton_default.content,
15589
- ToggleButton_default[size2],
15590
- hasIcon && ToggleButton_default["content--with-icon"],
15591
15611
  typographyStyles_default[`body-short-${size2}`],
15592
- focus_default["focus-styled-sibling"]
15612
+ focus_default["focus-styled-sibling"],
15613
+ Button_default[`button--${size2}`],
15614
+ Button_default["just-text"],
15615
+ ...hasIcon ? [
15616
+ Button_default["with-text-and-icon"],
15617
+ Button_default["with-icon-left"]
15618
+ ] : []
15593
15619
  ),
15594
15620
  children: [
15595
15621
  hasIcon && /* @__PURE__ */ (0, import_jsx_runtime345.jsx)(Icon, { icon, iconSize: "component" }),
15596
- " ",
15597
- label
15622
+ /* @__PURE__ */ (0, import_jsx_runtime345.jsx)("span", { children: label })
15598
15623
  ]
15599
15624
  }
15600
15625
  )
@@ -16010,7 +16035,6 @@ ToggleButtonGroup.displayName = "ToggleButtonGroup";
16010
16035
  removeListStyling,
16011
16036
  renderInputMessage,
16012
16037
  scrollbarStyling,
16013
- typographyTypes,
16014
16038
  useAccordion,
16015
16039
  useAccordionContext,
16016
16040
  useCallbackRef,