@norges-domstoler/dds-components 21.8.0 → 21.9.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.
package/dist/index.mjs CHANGED
@@ -1112,7 +1112,7 @@ function getResponsiveCSSProperties(property, prefix2, suffix) {
1112
1112
  }
1113
1113
  return properties;
1114
1114
  }
1115
- function applyResponsiveStyle(p, bp, largeScreenP) {
1115
+ function styleUpToBreakpoint(p, bp, largeScreenP) {
1116
1116
  if (!bp) return largeScreenP;
1117
1117
  const bpIndex = BREAKPOINTS.indexOf(bp);
1118
1118
  return BREAKPOINTS.reduce((acc, curr, index) => {
@@ -5511,7 +5511,7 @@ function CookieBanner({
5511
5511
  ),
5512
5512
  role: "region",
5513
5513
  "aria-label": tAriaLabel,
5514
- padding: applyResponsiveStyle("x1", "sm", "x1.5"),
5514
+ padding: styleUpToBreakpoint("x1", "sm", "x1.5"),
5515
5515
  width,
5516
5516
  maxHeight,
5517
5517
  border: "border-default",
@@ -5544,7 +5544,7 @@ function CookieBanner({
5544
5544
  buttons && /* @__PURE__ */ jsx222(
5545
5545
  HStack,
5546
5546
  {
5547
- gap: applyResponsiveStyle("x1", "sm", "x1.5"),
5547
+ gap: styleUpToBreakpoint("x1", "sm", "x1.5"),
5548
5548
  flexWrap: "wrap",
5549
5549
  paddingBlock: "x0.25 0",
5550
5550
  children: buttons.map((props) => /* @__PURE__ */ jsx222(Button, { ...props, size: "medium", purpose: "secondary" }))
@@ -6300,7 +6300,16 @@ function getDefaultText(value, defaultValue) {
6300
6300
  return "";
6301
6301
  }
6302
6302
  function getInputWidth(width, defaultW) {
6303
- return width ? width : defaultW ? defaultW : "var(--dds-input-default-width)";
6303
+ const fallback = defaultW ? defaultW : "var(--dds-input-default-width)";
6304
+ if (isBreakpointObject(width)) {
6305
+ return BREAKPOINTS.reduce((acc, bp) => {
6306
+ return {
6307
+ ...acc,
6308
+ [bp]: bp in width ? width[bp] : fallback
6309
+ };
6310
+ }, {});
6311
+ }
6312
+ return width != null ? width : fallback;
6304
6313
  }
6305
6314
 
6306
6315
  // src/components/date-inputs/common/DateInput.tsx
@@ -8987,8 +8996,8 @@ var InternalHeader = (props) => {
8987
8996
  {
8988
8997
  display: "flex",
8989
8998
  alignItems: "center",
8990
- gap: applyResponsiveStyle("x1.5", smallScreenBreakpoint, "x1"),
8991
- paddingInline: applyResponsiveStyle(
8999
+ gap: styleUpToBreakpoint("x1.5", smallScreenBreakpoint, "x1"),
9000
+ paddingInline: styleUpToBreakpoint(
8992
9001
  "x1.5",
8993
9002
  smallScreenBreakpoint,
8994
9003
  "x1 x0.5"
@@ -10343,8 +10352,8 @@ var Pagination = ({
10343
10352
  gap: "x0.75",
10344
10353
  justifyContent: "space-between",
10345
10354
  flexWrap: "wrap",
10346
- flexDirection: applyResponsiveStyle("column", smallScreenBreakpoint),
10347
- alignItems: applyResponsiveStyle("center", smallScreenBreakpoint),
10355
+ flexDirection: styleUpToBreakpoint("column", smallScreenBreakpoint),
10356
+ alignItems: styleUpToBreakpoint("center", smallScreenBreakpoint),
10348
10357
  ...getBaseHTMLProps(id, className, htmlProps, rest),
10349
10358
  children: [
10350
10359
  /* @__PURE__ */ jsxs69("div", { className: Pagination_default.indicators, children: [
@@ -10995,7 +11004,7 @@ var PhoneInput = ({
10995
11004
  Box,
10996
11005
  {
10997
11006
  display: "flex",
10998
- flexDirection: applyResponsiveStyle("column", bp, "row"),
11007
+ flexDirection: styleUpToBreakpoint("column", bp, "row"),
10999
11008
  className: cn(
11000
11009
  PhoneInput_default["inputs-container"],
11001
11010
  !!bp && PhoneInput_default[`inputs-container--small-screen-${bp}`]
@@ -11008,7 +11017,7 @@ var PhoneInput = ({
11008
11017
  /* @__PURE__ */ jsx287(
11009
11018
  NativeSelect,
11010
11019
  {
11011
- width: applyResponsiveStyle(
11020
+ width: styleUpToBreakpoint(
11012
11021
  "100%",
11013
11022
  bp,
11014
11023
  componentSize === "xsmall" ? "5rem" : "8rem"