@norges-domstoler/dds-components 0.0.23 → 0.0.24

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.
@@ -0,0 +1,33 @@
1
+ import { HTMLAttributes, ReactNode, RefObject } from 'react';
2
+ import { Placement } from '../../hooks';
3
+ import * as CSS from 'csstype';
4
+ export declare type PopoverSizeProps = {
5
+ width?: CSS.WidthProperty<string>;
6
+ height?: CSS.HeightProperty<string>;
7
+ minWidth?: CSS.MinWidthProperty<string>;
8
+ minHeight?: CSS.MinHeightProperty<string>;
9
+ maxWidth?: CSS.MaxWidthProperty<string>;
10
+ maxHeight?: CSS.MaxHeightProperty<string>;
11
+ };
12
+ export declare type PopoverProps = {
13
+ title?: string | ReactNode;
14
+ onCloseButtonClick?: () => void;
15
+ onCloseButtonBlur?: () => void;
16
+ isOpen?: boolean;
17
+ withCloseButton?: boolean;
18
+ anchorElement?: RefObject<HTMLElement>;
19
+ placement?: Placement;
20
+ offset?: number;
21
+ sizeProps?: PopoverSizeProps;
22
+ } & HTMLAttributes<HTMLDivElement>;
23
+ export declare const Popover: import("react").ForwardRefExoticComponent<{
24
+ title?: string | ReactNode;
25
+ onCloseButtonClick?: (() => void) | undefined;
26
+ onCloseButtonBlur?: (() => void) | undefined;
27
+ isOpen?: boolean | undefined;
28
+ withCloseButton?: boolean | undefined;
29
+ anchorElement?: RefObject<HTMLElement> | undefined;
30
+ placement?: Placement | undefined;
31
+ offset?: number | undefined;
32
+ sizeProps?: PopoverSizeProps | undefined;
33
+ } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,15 @@
1
+ import { CSSObject } from 'styled-components';
2
+ export declare const popoverTokens: {
3
+ wrapper: {
4
+ base: CSSObject;
5
+ };
6
+ button: {
7
+ base: CSSObject;
8
+ };
9
+ title: {
10
+ base: CSSObject;
11
+ };
12
+ content: {
13
+ spaceTopNoTitle: string;
14
+ };
15
+ };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export declare type PopoverGroupProps = {
3
+ onCloseButtonClick?: () => void;
4
+ onTriggerClick?: () => void;
5
+ isOpen?: boolean;
6
+ popoverId?: string;
7
+ children: ReactNode;
8
+ };
9
+ export declare const PopoverGroup: ({ isOpen, onCloseButtonClick, onTriggerClick, children, popoverId }: PopoverGroupProps) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './Popover';
2
+ export * from './PopoverGroup';
@@ -0,0 +1,4 @@
1
+ export * from './useCombinedRefs';
2
+ export * from './useOnClickOutside';
3
+ export * from './useOnKeyDown';
4
+ export * from './useReactPopper';
@@ -0,0 +1,2 @@
1
+ import type { RefCallback } from 'react';
2
+ export declare function useCombinedRef<T>(...refs: React.Ref<T>[]): RefCallback<T>;
@@ -0,0 +1 @@
1
+ export declare function useOnClickOutside(element: HTMLElement | null | (HTMLElement | null)[], handler: (event: MouseEvent | TouchEvent) => void): void;
@@ -0,0 +1 @@
1
+ export declare const useOnKeyDown: (key: string | string[], handler: (event: KeyboardEvent) => void) => void;
@@ -0,0 +1,12 @@
1
+ import { CSSProperties } from 'react';
2
+ export declare type Placement = 'auto' | 'auto-start' | 'auto-end' | 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
3
+ export declare const useReactPopper: (referenceElement: HTMLElement, popperElement: HTMLElement, arrowRef?: string | HTMLElement | undefined, placement?: Placement, offset?: number) => {
4
+ styles: {
5
+ [key: string]: CSSProperties;
6
+ };
7
+ attributes: {
8
+ [key: string]: {
9
+ [key: string]: string;
10
+ } | undefined;
11
+ };
12
+ };
package/dist/index.d.ts CHANGED
@@ -21,3 +21,4 @@ export * from './components/Card';
21
21
  export * from './components/InternalHeader';
22
22
  export * from './components/Datepicker';
23
23
  export * from './components/SkipToContent';
24
+ export * from './components/Popover';