@norges-domstoler/dds-components 21.8.0 → 21.9.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.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;
@@ -3769,7 +3769,7 @@ type SelectProps<Option = unknown, IsMulti extends boolean = false> = {
3769
3769
  ref?: SelectForwardRefType<Option, IsMulti>;
3770
3770
  } & Pick<HTMLAttributes<HTMLInputElement>, 'aria-required'> & Pick<ResponsiveProps, 'width'> & WrappedReactSelectProps<Option, IsMulti, GroupBase<Option>>;
3771
3771
  type SelectForwardRefType<Option, IsMulti extends boolean> = Ref<SelectInstance<Option, IsMulti, GroupBase<Option>>>;
3772
- declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, required, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
3772
+ declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, required, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
3773
3773
  declare namespace Select {
3774
3774
  var displayName: string;
3775
3775
  }
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;
@@ -3769,7 +3769,7 @@ type SelectProps<Option = unknown, IsMulti extends boolean = false> = {
3769
3769
  ref?: SelectForwardRefType<Option, IsMulti>;
3770
3770
  } & Pick<HTMLAttributes<HTMLInputElement>, 'aria-required'> & Pick<ResponsiveProps, 'width'> & WrappedReactSelectProps<Option, IsMulti, GroupBase<Option>>;
3771
3771
  type SelectForwardRefType<Option, IsMulti extends boolean> = Ref<SelectInstance<Option, IsMulti, GroupBase<Option>>>;
3772
- declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, required, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
3772
+ declare function Select<Option = unknown, IsMulti extends boolean = false>({ id, label, componentSize, errorMessage, tip, required, 'aria-required': ariaRequired, readOnly, options, isMulti, value, icon, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, menuPortalTarget, customOptionElement, customSingleValueElement, 'data-testid': dataTestId, onKeyDown, openMenuOnClick, ref, instanceId, ...rest }: SelectProps<Option, IsMulti>): react_jsx_runtime.JSX.Element;
3773
3773
  declare namespace Select {
3774
3774
  var displayName: string;
3775
3775
  }
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"
@@ -10132,6 +10141,7 @@ function Select({
10132
10141
  onKeyDown,
10133
10142
  openMenuOnClick,
10134
10143
  ref,
10144
+ instanceId,
10135
10145
  ...rest
10136
10146
  }) {
10137
10147
  const themeContext = (0, import_react70.useContext)(ThemeContext);
@@ -10161,6 +10171,7 @@ function Select({
10161
10171
  placeholder: placeholder ? placeholder : "",
10162
10172
  closeMenuOnSelect: closeMenuOnSelect ? closeMenuOnSelect : isMulti ? false : true,
10163
10173
  isMulti,
10174
+ instanceId: instanceId != null ? instanceId : (0, import_react70.useId)(),
10164
10175
  inputId: uniqueId,
10165
10176
  name: uniqueId,
10166
10177
  menuPortalTarget: portalTarget,
@@ -10182,7 +10193,8 @@ function Select({
10182
10193
  {
10183
10194
  ...props,
10184
10195
  readOnly,
10185
- "aria-required": ariaRequired
10196
+ "aria-required": ariaRequired,
10197
+ "aria-activedescendant": props["aria-activedescendant"] === "" ? void 0 : props["aria-activedescendant"]
10186
10198
  },
10187
10199
  hasErrorMessage,
10188
10200
  spaceSeparatedIdListGenerator([
@@ -10629,8 +10641,8 @@ var Pagination = ({
10629
10641
  gap: "x0.75",
10630
10642
  justifyContent: "space-between",
10631
10643
  flexWrap: "wrap",
10632
- flexDirection: applyResponsiveStyle("column", smallScreenBreakpoint),
10633
- alignItems: applyResponsiveStyle("center", smallScreenBreakpoint),
10644
+ flexDirection: styleUpToBreakpoint("column", smallScreenBreakpoint),
10645
+ alignItems: styleUpToBreakpoint("center", smallScreenBreakpoint),
10634
10646
  ...getBaseHTMLProps(id, className, htmlProps, rest),
10635
10647
  children: [
10636
10648
  /* @__PURE__ */ (0, import_jsx_runtime287.jsxs)("div", { className: Pagination_default.indicators, children: [
@@ -11275,7 +11287,7 @@ var PhoneInput = ({
11275
11287
  Box,
11276
11288
  {
11277
11289
  display: "flex",
11278
- flexDirection: applyResponsiveStyle("column", bp, "row"),
11290
+ flexDirection: styleUpToBreakpoint("column", bp, "row"),
11279
11291
  className: cn(
11280
11292
  PhoneInput_default["inputs-container"],
11281
11293
  !!bp && PhoneInput_default[`inputs-container--small-screen-${bp}`]
@@ -11288,7 +11300,7 @@ var PhoneInput = ({
11288
11300
  /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
11289
11301
  NativeSelect,
11290
11302
  {
11291
- width: applyResponsiveStyle(
11303
+ width: styleUpToBreakpoint(
11292
11304
  "100%",
11293
11305
  bp,
11294
11306
  componentSize === "xsmall" ? "5rem" : "8rem"