@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.d.mts CHANGED
@@ -2311,7 +2311,7 @@ declare const Typography: {
2311
2311
  interface CommonInputProps {
2312
2312
  /**Ledetekst. */
2313
2313
  label?: string;
2314
- /**Bredde for inputfeltet. */
2314
+ /**Bredde for inputfeltet. Kan settes per brekkpunkt, manglende brekkpunter får da default bredde. */
2315
2315
  width?: ResponsiveProps['width'];
2316
2316
  /**Hjelpetekst. */
2317
2317
  tip?: string;
package/dist/index.d.ts CHANGED
@@ -2311,7 +2311,7 @@ declare const Typography: {
2311
2311
  interface CommonInputProps {
2312
2312
  /**Ledetekst. */
2313
2313
  label?: string;
2314
- /**Bredde for inputfeltet. */
2314
+ /**Bredde for inputfeltet. Kan settes per brekkpunkt, manglende brekkpunter får da default bredde. */
2315
2315
  width?: ResponsiveProps['width'];
2316
2316
  /**Hjelpetekst. */
2317
2317
  tip?: string;
package/dist/index.js CHANGED
@@ -1492,7 +1492,7 @@ function getResponsiveCSSProperties(property, prefix2, suffix) {
1492
1492
  }
1493
1493
  return properties;
1494
1494
  }
1495
- function applyResponsiveStyle(p, bp, largeScreenP) {
1495
+ function styleUpToBreakpoint(p, bp, largeScreenP) {
1496
1496
  if (!bp) return largeScreenP;
1497
1497
  const bpIndex = BREAKPOINTS.indexOf(bp);
1498
1498
  return BREAKPOINTS.reduce((acc, curr, index) => {
@@ -5863,7 +5863,7 @@ function CookieBanner({
5863
5863
  ),
5864
5864
  role: "region",
5865
5865
  "aria-label": tAriaLabel,
5866
- padding: applyResponsiveStyle("x1", "sm", "x1.5"),
5866
+ padding: styleUpToBreakpoint("x1", "sm", "x1.5"),
5867
5867
  width,
5868
5868
  maxHeight,
5869
5869
  border: "border-default",
@@ -5896,7 +5896,7 @@ function CookieBanner({
5896
5896
  buttons && /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
5897
5897
  HStack,
5898
5898
  {
5899
- gap: applyResponsiveStyle("x1", "sm", "x1.5"),
5899
+ gap: styleUpToBreakpoint("x1", "sm", "x1.5"),
5900
5900
  flexWrap: "wrap",
5901
5901
  paddingBlock: "x0.25 0",
5902
5902
  children: buttons.map((props) => /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(Button, { ...props, size: "medium", purpose: "secondary" }))
@@ -6631,7 +6631,16 @@ function getDefaultText(value, defaultValue) {
6631
6631
  return "";
6632
6632
  }
6633
6633
  function getInputWidth(width, defaultW) {
6634
- return width ? width : defaultW ? defaultW : "var(--dds-input-default-width)";
6634
+ const fallback = defaultW ? defaultW : "var(--dds-input-default-width)";
6635
+ if (isBreakpointObject(width)) {
6636
+ return BREAKPOINTS.reduce((acc, bp) => {
6637
+ return {
6638
+ ...acc,
6639
+ [bp]: bp in width ? width[bp] : fallback
6640
+ };
6641
+ }, {});
6642
+ }
6643
+ return width != null ? width : fallback;
6635
6644
  }
6636
6645
 
6637
6646
  // src/components/date-inputs/common/DateInput.tsx
@@ -9285,8 +9294,8 @@ var InternalHeader = (props) => {
9285
9294
  {
9286
9295
  display: "flex",
9287
9296
  alignItems: "center",
9288
- gap: applyResponsiveStyle("x1.5", smallScreenBreakpoint, "x1"),
9289
- paddingInline: applyResponsiveStyle(
9297
+ gap: styleUpToBreakpoint("x1.5", smallScreenBreakpoint, "x1"),
9298
+ paddingInline: styleUpToBreakpoint(
9290
9299
  "x1.5",
9291
9300
  smallScreenBreakpoint,
9292
9301
  "x1 x0.5"
@@ -10629,8 +10638,8 @@ var Pagination = ({
10629
10638
  gap: "x0.75",
10630
10639
  justifyContent: "space-between",
10631
10640
  flexWrap: "wrap",
10632
- flexDirection: applyResponsiveStyle("column", smallScreenBreakpoint),
10633
- alignItems: applyResponsiveStyle("center", smallScreenBreakpoint),
10641
+ flexDirection: styleUpToBreakpoint("column", smallScreenBreakpoint),
10642
+ alignItems: styleUpToBreakpoint("center", smallScreenBreakpoint),
10634
10643
  ...getBaseHTMLProps(id, className, htmlProps, rest),
10635
10644
  children: [
10636
10645
  /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: Pagination_default.indicators, children: [
@@ -11275,7 +11284,7 @@ var PhoneInput = ({
11275
11284
  Box,
11276
11285
  {
11277
11286
  display: "flex",
11278
- flexDirection: applyResponsiveStyle("column", bp, "row"),
11287
+ flexDirection: styleUpToBreakpoint("column", bp, "row"),
11279
11288
  className: cn(
11280
11289
  PhoneInput_default["inputs-container"],
11281
11290
  !!bp && PhoneInput_default[`inputs-container--small-screen-${bp}`]
@@ -11288,7 +11297,7 @@ var PhoneInput = ({
11288
11297
  /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
11289
11298
  NativeSelect,
11290
11299
  {
11291
- width: applyResponsiveStyle(
11300
+ width: styleUpToBreakpoint(
11292
11301
  "100%",
11293
11302
  bp,
11294
11303
  componentSize === "xsmall" ? "5rem" : "8rem"