@norges-domstoler/dds-components 24.0.0 → 24.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.d.mts CHANGED
@@ -202,6 +202,7 @@ type CommonComponentProps<THTMLProps extends object, TRef extends Ref<unknown>>
202
202
  /**Ref til komponenten. */
203
203
  ref?: TRef;
204
204
  };
205
+ type HTMLAttributesFor<T extends Element> = T extends HTMLButtonElement ? React.ButtonHTMLAttributes<T> : T extends HTMLAnchorElement ? React.AnchorHTMLAttributes<T> : React.HTMLAttributes<T>;
205
206
  /**
206
207
  * Basetype for props som eksponeres til konsumenter av designsystemet.
207
208
  * - Rot: `id`, `className`, `style`, `TOtherProps`
@@ -211,9 +212,11 @@ type CommonComponentProps<THTMLProps extends object, TRef extends Ref<unknown>>
211
212
  *
212
213
  * @template TElement Element-type som genereres av komponenten.
213
214
  * @template TOtherProps Andre props komponenten skal eksponere til konsumenter.
214
- * @template THTMLAttributesProps Standard `HTMLAttributes<T>` men kan overstyres for f.eks knapper hvis man trenger en annen basetype for `htmlProps`.
215
+ * @template THTMLAttributesProps Standard `HTMLAttributes<T>`;
216
+ * settes til `ButtonHTMLAttributes<T>` hvis TElement er `HTMLButtonElement` og til `AnchorHTMLAttributes<T>` hvis TElement er `HTMLAnchorElement`.
217
+ * Kan overstyres hvis man trenger en annen basetype for `htmlProps`.
215
218
  */
216
- type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributes<TElement> = HTMLAttributes<TElement>> = TOtherProps & CommonComponentProps<Omit<THTMLAttributesProps, keyof HTMLRootProps | keyof TOtherProps>, Ref<TElement>>;
219
+ type BaseComponentProps<TElement extends Element, TOtherProps extends object = object, THTMLAttributesProps extends HTMLAttributesFor<TElement> = HTMLAttributesFor<TElement>> = TOtherProps & CommonComponentProps<Omit<THTMLAttributesProps, keyof HTMLRootProps | keyof TOtherProps>, Ref<TElement>>;
217
220
  /**
218
221
  * Basetype for polymorfe props som eksponeres til konsumenter av designsystemet.
219
222
  * - Rot: `id`, `className`, `style`, `TOtherProps`
@@ -232,7 +235,7 @@ type PolymorphicBaseComponentProps<E extends ElementType, TOtherProps extends ob
232
235
  /**
233
236
  * Utvidelse av {@link BaseComponentProps} med prop for `children`.
234
237
  */
235
- type BaseComponentPropsWithChildren<T extends Element, TProps extends object = object, THTMLProps extends HTMLAttributes<T> = HTMLAttributes<T>> = BaseComponentProps<T, TProps & {
238
+ type BaseComponentPropsWithChildren<T extends Element, TProps extends object = object, THTMLProps extends HTMLAttributesFor<T> = HTMLAttributesFor<T>> = BaseComponentProps<T, TProps & {
236
239
  /**Barn. */
237
240
  children?: ReactNode;
238
241
  }, THTMLProps>;
@@ -331,7 +334,7 @@ declare const BUTTON_PURPOSES: ["primary", "secondary", "tertiary", "danger"];
331
334
  type ButtonSize = (typeof BUTTON_SIZES)[number];
332
335
  type ButtonPurpose = (typeof BUTTON_PURPOSES)[number];
333
336
  type IconPosition = 'left' | 'right';
334
- type PickedHTMLAttributes$4 = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onFocus' | 'onBlur' | 'type' | 'aria-label'>;
337
+ type PickedHTMLAttributes$3 = Pick<ButtonHTMLAttributes<HTMLButtonElement>, 'onClick' | 'onFocus' | 'onBlur' | 'type' | 'aria-label'>;
335
338
  type ButtonProps<I extends SvgIcon = SvgIcon, T extends ElementType = 'button'> = PolymorphicBaseComponentProps<T, {
336
339
  /** Størrelsen på knappen.
337
340
  * @default "medium"
@@ -361,7 +364,7 @@ type ButtonProps<I extends SvgIcon = SvgIcon, T extends ElementType = 'button'>
361
364
  iconState?: IconStatesOf<I>;
362
365
  /**Knapp med full bredde. */
363
366
  fullWidth?: boolean;
364
- } & PickedHTMLAttributes$4>;
367
+ } & PickedHTMLAttributes$3>;
365
368
  //#endregion
366
369
  //#region ../../node_modules/.pnpm/csstype@3.2.3/node_modules/csstype/index.d.ts
367
370
  interface StandardLonghandProperties<TLength = (string & {}) | 0, TTime = string & {}> {
@@ -14962,7 +14965,7 @@ type AnchorTypographyProps = BaseComponentPropsWithChildren<HTMLAnchorElement, {
14962
14965
  href?: string | undefined;
14963
14966
  /**nativ `target`-prop ved `typographyType='a'`. */
14964
14967
  target?: string;
14965
- }, AnchorHTMLAttributes<HTMLAnchorElement>>;
14968
+ }>;
14966
14969
  type LabelTypographyProps = BaseComponentPropsWithChildren<HTMLLabelElement, HTMLAttributes<HTMLLabelElement>>;
14967
14970
  type OtherTypographyProps = BaseComponentPropsWithChildren<HTMLElement, HTMLAttributes<HTMLElement>>;
14968
14971
  type TypographyProps = ({
@@ -15017,7 +15020,7 @@ declare const Heading: {
15017
15020
  };
15018
15021
  //#endregion
15019
15022
  //#region src/components/Typography/Label/Label.d.ts
15020
- type PickedHTMLAttributes$3 = Pick<LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'>;
15023
+ type PickedHTMLAttributes$2 = Pick<LabelHTMLAttributes<HTMLLabelElement>, 'htmlFor'>;
15021
15024
  interface BaseLabelProps {
15022
15025
  /** Om input knyttet til ledeteksten er påkrevd; påvirker styling. */
15023
15026
  showRequiredStyling?: boolean;
@@ -15026,7 +15029,7 @@ interface BaseLabelProps {
15026
15029
  /**Innhold som står etter ledeteksten (knapp med ekstra info e.l.). */
15027
15030
  afterLabelContent?: ReactNode;
15028
15031
  }
15029
- type LabelProps = BaseComponentPropsWithChildren<HTMLLabelElement, BaseLabelProps & CommonInlineTypographyProps & PickedHTMLAttributes$3>;
15032
+ type LabelProps = BaseComponentPropsWithChildren<HTMLLabelElement, BaseLabelProps & CommonInlineTypographyProps & PickedHTMLAttributes$2>;
15030
15033
  declare const Label: {
15031
15034
  ({ showRequiredStyling, readOnly, id, className, style, htmlProps, children, afterLabelContent, ...rest }: LabelProps): import("react").JSX.Element;
15032
15035
  displayName: string;
@@ -15045,7 +15048,7 @@ declare const Legend: {
15045
15048
  };
15046
15049
  //#endregion
15047
15050
  //#region src/components/Typography/Link/Link.d.ts
15048
- type PickedHTMLAttributes$2 = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick' | 'href' | 'target'>;
15051
+ type PickedHTMLAttributes$1 = Pick<AnchorHTMLAttributes<HTMLAnchorElement>, 'onClick' | 'href' | 'target'>;
15049
15052
  type LinkProps<T extends ElementType = 'a'> = PolymorphicBaseComponentProps<T, {
15050
15053
  /**Om lenken kan få `:visited`-styling. */
15051
15054
  withVisited?: boolean;
@@ -15060,7 +15063,7 @@ type LinkProps<T extends ElementType = 'a'> = PolymorphicBaseComponentProps<T, {
15060
15063
  * Ikon kan legges inn som barn ved siden av teksten med `<Icon>`-komponent.
15061
15064
  * */
15062
15065
  withIconStyling?: boolean;
15063
- } & CommonInlineTypographyProps & PickedHTMLAttributes$2>;
15066
+ } & CommonInlineTypographyProps & PickedHTMLAttributes$1>;
15064
15067
  declare const Link: {
15065
15068
  <T extends ElementType = "a">({ id, className, htmlProps, children, typographyType, withMargins, withVisited, style, color, as: propAs, isAnchor: propIsAnchor, withIconStyling, ...rest }: LinkProps<T>): import("react").JSX.Element;
15066
15069
  displayName: string;
@@ -15088,7 +15091,7 @@ type AccordionHeaderProps = Omit<BaseComponentPropsWithChildren<HTMLButtonElemen
15088
15091
  typographyType?: StaticTypographyType;
15089
15092
  /**Angir om teksten skal være i "bold"-format. */
15090
15093
  bold?: boolean;
15091
- }, ButtonHTMLAttributes<HTMLButtonElement>>, 'id'>;
15094
+ }>, 'id'>;
15092
15095
  declare const AccordionHeader: {
15093
15096
  ({ children, className, style, htmlProps, typographyType, bold, ...rest }: AccordionHeaderProps): import("react").JSX.Element;
15094
15097
  displayName: string;
@@ -15141,7 +15144,7 @@ declare const Breadcrumbs: {
15141
15144
  };
15142
15145
  //#endregion
15143
15146
  //#region src/components/ButtonGroup/ButtonGroup.d.ts
15144
- type PickedHTMLAttributes$1 = Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-label' | 'aria-labelledby'>;
15147
+ type PickedHTMLAttributes = Pick<HTMLAttributes<HTMLDivElement>, 'role' | 'aria-label' | 'aria-labelledby'>;
15145
15148
  type ButtonGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
15146
15149
  /**Retning for gruppen.
15147
15150
  * @default "row"
@@ -15159,7 +15162,7 @@ type ButtonGroupProps = BaseComponentPropsWithChildren<HTMLDivElement, {
15159
15162
  * @default "group"
15160
15163
  */
15161
15164
  role?: AriaRole;
15162
- } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedHTMLAttributes$1>>;
15165
+ } & Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedHTMLAttributes>>;
15163
15166
  declare const ButtonGroup: {
15164
15167
  ({ children, id, className, style, htmlProps, direction, buttonSize, role, ...rest }: ButtonGroupProps): import("react").JSX.Element;
15165
15168
  displayName: string;
@@ -15281,7 +15284,7 @@ type CardExpandableHeaderProps = Omit<BaseComponentPropsWithChildren<HTMLButtonE
15281
15284
  typographyType?: StaticTypographyType;
15282
15285
  /**Angir om teksten skal være i "bold"-format. */
15283
15286
  bold?: boolean;
15284
- }, ButtonHTMLAttributes<HTMLButtonElement>>, 'id'>;
15287
+ }>, 'id'>;
15285
15288
  declare const CardExpandableHeader: {
15286
15289
  ({ children, className, style, htmlProps, padding, typographyType, bold, ...rest }: CardExpandableHeaderProps): import("react").JSX.Element;
15287
15290
  displayName: string;
@@ -15319,7 +15322,7 @@ type CardSelectableGroupProps<T extends string | number> = BaseComponentPropsWit
15319
15322
  value?: T | undefined;
15320
15323
  /**Default verdi - en `<CardSelectable>` med denne verdien blir forhåndsvalgt med uncontrolled state. */
15321
15324
  defaultValue?: T | undefined;
15322
- }, Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>>;
15325
+ }>;
15323
15326
  declare const CardSelectableGroup: {
15324
15327
  <T extends string | number = string>({ name, cardType, errorMessage, disabled, readOnly, value, defaultValue, children, required, onChange, id, tipId, className, style, htmlProps, ...rest }: CardSelectableGroupProps<T>): import("react").JSX.Element;
15325
15328
  displayName: string;
@@ -15565,7 +15568,7 @@ type DividerProps = BaseComponentProps<HTMLHRElement, {
15565
15568
  * @default "default"
15566
15569
  */
15567
15570
  color?: DividerColor;
15568
- }, Omit<HTMLAttributes<HTMLHRElement>, 'color'>>;
15571
+ }>;
15569
15572
  declare const Divider: ({ color, id, className, style, htmlProps, ...rest }: DividerProps) => import("react").JSX.Element;
15570
15573
  //#endregion
15571
15574
  //#region src/components/Drawer/Drawer.d.ts
@@ -15681,7 +15684,7 @@ type FavStarProps = BaseComponentPropsWithChildren<HTMLElement, {
15681
15684
  * @default "medium"
15682
15685
  */
15683
15686
  size?: ComponentSize;
15684
- }, Omit<HTMLAttributes<HTMLElement>, 'onChange'>>;
15687
+ }>;
15685
15688
  declare const FavStar: {
15686
15689
  ({ id, className, style, onChange, checked: checkedProp, defaultChecked, size, htmlProps, ...rest }: FavStarProps): import("react").JSX.Element;
15687
15690
  displayName: string;
@@ -15845,7 +15848,7 @@ declare const FileUploader: {
15845
15848
  //#endregion
15846
15849
  //#region src/components/Footer/Footer.d.ts
15847
15850
  type FooterProps = ComponentPropsWithRef<'footer'>;
15848
- declare const Footer: ({ className, ...rest }: FooterProps) => import("react").JSX.Element;
15851
+ declare const Footer: (props: FooterProps) => import("react").JSX.Element;
15849
15852
  //#endregion
15850
15853
  //#region src/components/Footer/FooterListHeader.d.ts
15851
15854
  type FooterListHeaderProps = Omit<HeadingProps, 'level' | 'withMargins'>;
@@ -15853,31 +15856,38 @@ declare const FooterListHeader: (props: FooterListHeaderProps) => import("react"
15853
15856
  //#endregion
15854
15857
  //#region src/components/Footer/FooterLogo.d.ts
15855
15858
  type HideBreakpoint = 'xs' | 'sm' | 'md';
15856
- type FooterLogoProps = ComponentPropsWithRef<'img'> & {
15859
+ type ImgLogoProps = ComponentPropsWithRef<'img'> & {
15857
15860
  /**Brekkepunkt når logoen skal skjules på mindre skjerm. */
15858
15861
  hideBreakpoint?: HideBreakpoint;
15859
15862
  };
15860
- declare const FooterLogo: ({ hideBreakpoint, ...rest }: FooterLogoProps) => import("react").JSX.Element;
15863
+ interface ChildrenLogoProps {
15864
+ /**Brekkepunkt når logoen skal skjules på mindre skjerm. */
15865
+ hideBreakpoint?: HideBreakpoint;
15866
+ /**Custom logo som ikke er HTML `<img>`. Settes istedenfor `<img>` props. */
15867
+ children: ComponentPropsWithRef<'div'>['children'];
15868
+ }
15869
+ type FooterLogoProps = ImgLogoProps | ChildrenLogoProps;
15870
+ declare const FooterLogo: ({ children, hideBreakpoint, ...rest }: FooterLogoProps) => import("react").JSX.Element;
15861
15871
  //#endregion
15862
15872
  //#region src/components/Footer/FooterList.d.ts
15863
15873
  type FooterListProps = ComponentPropsWithRef<'ul'>;
15864
- declare const FooterList: ({ className, ...rest }: FooterListProps) => import("react").JSX.Element;
15874
+ declare const FooterList: (props: FooterListProps) => import("react").JSX.Element;
15865
15875
  //#endregion
15866
15876
  //#region src/components/Footer/FooterSocialsList.d.ts
15867
15877
  type FooterSocialsListProps = ComponentPropsWithRef<'ul'>;
15868
- declare const FooterSocialsList: ({ className, ...rest }: FooterSocialsListProps) => import("react").JSX.Element;
15878
+ declare const FooterSocialsList: (props: FooterSocialsListProps) => import("react").JSX.Element;
15869
15879
  //#endregion
15870
15880
  //#region src/components/Footer/FooterSocialsGroup.d.ts
15871
15881
  type FooterSocialsGroupProps = ComponentPropsWithRef<'div'>;
15872
- declare const FooterSocialsGroup: ({ className, ...rest }: FooterSocialsGroupProps) => import("react").JSX.Element;
15882
+ declare const FooterSocialsGroup: (props: FooterSocialsGroupProps) => import("react").JSX.Element;
15873
15883
  //#endregion
15874
15884
  //#region src/components/Footer/FooterListGroup.d.ts
15875
15885
  type FooterListGroupProps = ComponentPropsWithRef<'div'>;
15876
- declare const FooterListGroup: ({ className, ...rest }: FooterListGroupProps) => import("react").JSX.Element;
15886
+ declare const FooterListGroup: (props: FooterListGroupProps) => import("react").JSX.Element;
15877
15887
  //#endregion
15878
15888
  //#region src/components/Footer/FooterLeft.d.ts
15879
15889
  type FooterLeftProps = ComponentPropsWithRef<'div'>;
15880
- declare const FooterLeft: ({ className, ...rest }: FooterLeftProps) => import("react").JSX.Element;
15890
+ declare const FooterLeft: (props: FooterLeftProps) => import("react").JSX.Element;
15881
15891
  //#endregion
15882
15892
  //#region src/components/FormSummary/FormSummary.d.ts
15883
15893
  type FormSummaryProps = Pick<PaperProps, 'children' | 'htmlProps' | 'ref' | 'id' | 'style' | 'className' | 'padding' | 'paddingBlock' | 'paddingInline' | 'margin' | 'marginBlock' | 'marginInline' | 'width' | 'minWidth' | 'maxWidth'>;
@@ -16342,7 +16352,7 @@ type PaginationProps = BaseComponentProps<HTMLElement, {
16342
16352
  onSelectOptionChange?: (option: PaginationOption | null) => void;
16343
16353
  /**Brekkpunkt for små skjermer; den viser færre sideknapper og stacker delkomponentene. */
16344
16354
  smallScreenBreakpoint?: Breakpoint;
16345
- }, Omit<HTMLAttributes<HTMLElement>, 'onChange'>>;
16355
+ }>;
16346
16356
  declare const Pagination: {
16347
16357
  ({ itemsAmount, defaultItemsPerPage, defaultActivePage, activePage: activePageProp, withPagination, withCounter, withSelect, selectOptions, smallScreenBreakpoint, onChange, onSelectOptionChange, id, className, style, htmlProps, ref, ...rest }: PaginationProps): import("react").JSX.Element | null;
16348
16358
  displayName: string;
@@ -16545,14 +16555,14 @@ type SearchButtonProps = {
16545
16555
  } & Pick<ButtonProps, 'loading' | 'loadingTooltip'> & ComponentPropsWithRef<'button'>;
16546
16556
  //#endregion
16547
16557
  //#region src/components/Search/Search.d.ts
16548
- type SearchProps = Pick<InputProps, 'tip' | 'label'> & {
16558
+ type SearchProps = Pick<InputProps, 'tip' | 'label' | 'width'> & {
16549
16559
  /**Størrelsen på komponenten. */
16550
16560
  componentSize?: SearchSize;
16551
16561
  /**Props for søkeknappen. */
16552
16562
  buttonProps?: SearchButtonProps;
16553
16563
  /**Om søkeikonet skal vises. */
16554
16564
  showIcon?: boolean;
16555
- } & Pick<InputProps, 'width'> & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
16565
+ } & Omit<ComponentPropsWithRef<'input'>, 'width' | 'height'>;
16556
16566
  declare const Search$1: {
16557
16567
  ({ componentSize, buttonProps, showIcon, name, label, tip, id, value, width, onChange, className, style, "aria-describedby": ariaDescribedby, ref, ...rest }: SearchProps): import("react").JSX.Element;
16558
16568
  displayName: string;
@@ -16681,7 +16691,7 @@ type RadioButtonGroupProps<T extends string | number> = BaseComponentPropsWithCh
16681
16691
  value?: T | undefined;
16682
16692
  /**Default verdi - en `<RadioButton>` med denne verdien blir forhåndsvalgt med uncontrolled state. */
16683
16693
  defaultValue?: T | undefined;
16684
- }, Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>>;
16694
+ }>;
16685
16695
  declare const RadioButtonGroup: {
16686
16696
  <T extends string | number = string>({ name, label, groupId, errorMessage, tip, disabled, readOnly, direction, value, defaultValue, children, required, onChange, id, className, style, htmlProps, ...rest }: RadioButtonGroupProps<T>): import("react").JSX.Element;
16687
16697
  displayName: string;
@@ -16731,7 +16741,7 @@ type SpinnerProps = BaseComponentProps<SVGElement, {
16731
16741
  * @default "Innlasting pågår"
16732
16742
  */
16733
16743
  tooltip?: string;
16734
- }, Omit<HTMLAttributes<SVGSVGElement>, 'color'>>;
16744
+ }>;
16735
16745
  declare function Spinner(props: SpinnerProps): import("react").JSX.Element;
16736
16746
  declare namespace Spinner {
16737
16747
  var displayName: string;
@@ -16910,7 +16920,7 @@ type TabsProps = BaseComponentPropsWithChildren<HTMLDivElement, {
16910
16920
  tabContentDirection?: Direction;
16911
16921
  /** Props for "Legg til fane"-knapp. Støtter native HTML attributter og `width`. */
16912
16922
  addTabButtonProps?: Omit<AddTabButtonProps, 'index'>;
16913
- } & Pick<ResponsiveProps, 'width'>, Omit<HTMLAttributes<HTMLDivElement>, 'onChange'>>;
16923
+ } & Pick<ResponsiveProps, 'width'>>;
16914
16924
  declare const Tabs: {
16915
16925
  ({ id, activeTab, onChange, tabContentDirection, size, addTabButtonProps, width, children, className, style, htmlProps, ...rest }: TabsProps): import("react").JSX.Element;
16916
16926
  displayName: string;
@@ -16935,7 +16945,7 @@ type TabProps = BaseComponentPropsWithChildren<HTMLButtonElement, {
16935
16945
  * @default "1fr"
16936
16946
  */
16937
16947
  width?: Properties['width'];
16938
- } & PickedAttributes, Omit<ButtonHTMLAttributes<HTMLButtonElement>, keyof PickedAttributes>>;
16948
+ } & PickedAttributes>;
16939
16949
  declare const Tab: {
16940
16950
  ({ active, icon, children, focus, setFocus, index, onClick, onKeyDown, id, className, htmlProps, style, width, ref, ...rest }: TabProps): import("react").JSX.Element;
16941
16951
  displayName: string;
@@ -17120,7 +17130,6 @@ declare const ToggleButtonGroup: {
17120
17130
  type AnchorElement = ReactElement<HTMLAttributes<HTMLElement> & {
17121
17131
  ref: Ref<HTMLElement>;
17122
17132
  }>;
17123
- type PickedHTMLAttributes = Pick<HTMLAttributes<HTMLDivElement>, 'style' | 'onMouseLeave' | 'onMouseOver'>;
17124
17133
  type TooltipProps = BaseComponentProps<HTMLDivElement, {
17125
17134
  /**Innhold i tooltip. */
17126
17135
  text: string;
@@ -17138,7 +17147,7 @@ type TooltipProps = BaseComponentProps<HTMLDivElement, {
17138
17147
  tooltipId?: string;
17139
17148
  /**Om tooltip skal alltid være i DOM, eller bli rendret først når den skal vises. */
17140
17149
  keepMounted?: boolean;
17141
- } & PickedHTMLAttributes, Omit<HTMLAttributes<HTMLDivElement>, 'children' | keyof PickedHTMLAttributes>>;
17150
+ } & Pick<HTMLAttributes<HTMLDivElement>, 'onMouseLeave' | 'onMouseOver'>>;
17142
17151
  declare const Tooltip: {
17143
17152
  ({ text, placement, children, tooltipId, delay, style, onMouseLeave, onMouseOver, keepMounted, id, ref, className, htmlProps, ...rest }: TooltipProps): import("react").JSX.Element;
17144
17153
  displayName: string;