@norges-domstoler/dds-components 1.0.1 → 2.0.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.
Files changed (74) hide show
  1. package/dist/components/Button/Button.d.ts +2 -1
  2. package/dist/components/Button/Button.tokens.d.ts +2 -3
  3. package/dist/components/Button/Button.types.d.ts +2 -2
  4. package/dist/components/Card/Card.d.ts +17 -5
  5. package/dist/components/Card/CardAccordion/CardAccordionBody.d.ts +2 -2
  6. package/dist/components/Checkbox/Checkbox.d.ts +1 -0
  7. package/dist/components/Checkbox/Checkbox.styles.d.ts +1 -0
  8. package/dist/components/Checkbox/Checkbox.tokens.d.ts +2 -3
  9. package/dist/components/Checkbox/CheckboxGroup.tokens.d.ts +14 -0
  10. package/dist/components/Datepicker/Datepicker.d.ts +3 -1
  11. package/dist/components/DescriptionList/DescriptionListDesc.d.ts +2 -2
  12. package/dist/components/DescriptionList/DescriptionListGroup.d.ts +2 -2
  13. package/dist/components/Drawer/Drawer.d.ts +29 -0
  14. package/dist/components/Drawer/Drawer.tokens.d.ts +17 -0
  15. package/dist/components/Drawer/DrawerGroup.d.ts +9 -0
  16. package/dist/components/Drawer/index.d.ts +2 -0
  17. package/dist/components/GlobalMessage/GlobalMessage.tokens.d.ts +9 -3
  18. package/dist/components/InternalHeader/InternalHeader.d.ts +1 -0
  19. package/dist/components/InternalHeader/InternalHeader.styles.d.ts +11 -8
  20. package/dist/components/InternalHeader/InternalHeader.tokens.d.ts +0 -22
  21. package/dist/components/InternalHeader/InternalHeader.types.d.ts +2 -2
  22. package/dist/components/LocalMessage/LocalMessage.d.ts +2 -2
  23. package/dist/components/LocalMessage/LocalMessage.tokens.d.ts +20 -7
  24. package/dist/components/OverflowMenu/OverflowMenu.d.ts +18 -0
  25. package/dist/components/OverflowMenu/OverflowMenu.tokens.d.ts +22 -0
  26. package/dist/components/OverflowMenu/OverflowMenu.types.d.ts +26 -0
  27. package/dist/components/OverflowMenu/OverflowMenuGroup.d.ts +9 -0
  28. package/dist/components/{InternalHeader/ContextMenuItem.d.ts → OverflowMenu/OverflowMenuItem.d.ts} +6 -6
  29. package/dist/components/OverflowMenu/index.d.ts +3 -0
  30. package/dist/components/Pagination/Pagination.d.ts +8 -5
  31. package/dist/components/Popover/Popover.d.ts +10 -10
  32. package/dist/components/RadioButton/RadioButton.d.ts +1 -0
  33. package/dist/components/RadioButton/RadioButton.styles.d.ts +1 -0
  34. package/dist/components/RadioButton/RadioButton.tokens.d.ts +2 -3
  35. package/dist/components/RadioButton/RadioButtonGroup.d.ts +1 -1
  36. package/dist/components/RadioButton/RadioButtonGroup.tokens.d.ts +14 -0
  37. package/dist/components/Select/Select.d.ts +5 -10
  38. package/dist/components/Select/Select.styles.d.ts +2 -2
  39. package/dist/components/Select/Select.tokens.d.ts +3 -2
  40. package/dist/components/SkipToContent/SkipToContent.d.ts +2 -2
  41. package/dist/components/Spinner/Spinner.d.ts +1 -1
  42. package/dist/components/Table/Cell.tokens.d.ts +3 -0
  43. package/dist/components/Table/Row.tokens.d.ts +3 -0
  44. package/dist/components/TextInput/TextInput.d.ts +1 -1
  45. package/dist/components/TextInput/TextInput.styles.d.ts +1 -0
  46. package/dist/components/TextInput/TextInput.tokens.d.ts +2 -1
  47. package/dist/components/Tooltip/Tooltip.tokens.d.ts +0 -7
  48. package/dist/helpers/Chevron/AnimatedChevronUpDown.d.ts +3 -2
  49. package/dist/helpers/IconWrapper/IconWrapper.d.ts +3 -3
  50. package/dist/helpers/Input/Input.styles.d.ts +1 -0
  51. package/dist/helpers/Input/Input.types.d.ts +1 -1
  52. package/dist/helpers/InputMessage/InputMessage.d.ts +2 -1
  53. package/dist/helpers/InputMessage/InputMessage.tokens.d.ts +2 -1
  54. package/dist/helpers/Paper/Paper.d.ts +1 -0
  55. package/dist/helpers/Paper/Paper.tokens.d.ts +4 -0
  56. package/dist/helpers/Paper/index.d.ts +1 -0
  57. package/dist/helpers/RequiredMarker.d.ts +1 -0
  58. package/dist/helpers/styling/danger.d.ts +4 -0
  59. package/dist/helpers/styling/focus.d.ts +9 -0
  60. package/dist/helpers/styling/focusVisible.d.ts +35 -0
  61. package/dist/helpers/styling/hover.d.ts +14 -0
  62. package/dist/helpers/styling/index.d.ts +4 -0
  63. package/dist/hooks/index.d.ts +2 -1
  64. package/dist/hooks/useFloatPosition.d.ts +25 -0
  65. package/dist/hooks/useFocusTrap.d.ts +1 -0
  66. package/dist/hooks/useId.d.ts +1 -0
  67. package/dist/index.css +7 -0
  68. package/dist/index.d.ts +3 -0
  69. package/dist/index.es.css +7 -0
  70. package/dist/index.es.js +15142 -17868
  71. package/dist/index.js +15106 -17826
  72. package/dist/styles/selection.css +6 -0
  73. package/package.json +20 -17
  74. package/dist/hooks/useReactPopper.d.ts +0 -12
@@ -1,5 +1,19 @@
1
+ import { CSSObject } from 'styled-components';
1
2
  export declare const radioButtonGroupTokens: {
2
3
  label: {
3
4
  spaceLeft: string;
4
5
  };
6
+ container: {
7
+ base: CSSObject;
8
+ };
9
+ groupContainer: {
10
+ direction: {
11
+ row: {
12
+ base: CSSObject;
13
+ };
14
+ column: {
15
+ base: CSSObject;
16
+ };
17
+ };
18
+ };
5
19
  };
@@ -2,21 +2,16 @@ import * as CSS from 'csstype';
2
2
  import React from 'react';
3
3
  import { GroupBase, Props as ReactSelectProps, SelectInstance } from 'react-select';
4
4
  export declare function searchFilter(text: string, search: string): boolean;
5
- export declare type SelectOption = {
6
- label: string;
7
- value: string | number;
8
- data?: unknown;
9
- };
10
- export declare type SelectProps<IsMulti extends boolean> = {
5
+ export declare type SelectProps<TOption, IsMulti extends boolean> = {
11
6
  label?: string;
12
7
  required?: boolean;
13
8
  readOnly?: boolean;
14
9
  errorMessage?: string;
15
10
  tip?: string;
16
- width?: CSS.WidthProperty<string>;
11
+ width?: CSS.Property.Width<string>;
17
12
  className?: string;
18
13
  style?: React.CSSProperties;
19
- } & ReactSelectProps<SelectOption, IsMulti, GroupBase<SelectOption>>;
20
- declare type ForwardRefType<IsMulti extends boolean> = React.ForwardedRef<SelectInstance<SelectOption, IsMulti, GroupBase<SelectOption>>>;
21
- export declare const Select: <IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<IsMulti>, ref: ForwardRefType<IsMulti>) => JSX.Element;
14
+ } & ReactSelectProps<TOption, IsMulti, GroupBase<TOption>>;
15
+ declare type ForwardRefType<TOption, IsMulti extends boolean> = React.ForwardedRef<SelectInstance<TOption, IsMulti, GroupBase<TOption>>>;
16
+ export declare const Select: <TOption, IsMulti extends boolean = false>({ id, label, errorMessage, tip, required, readOnly, options, isMulti, value, defaultValue, width, closeMenuOnSelect, className, style, isDisabled, isClearable, placeholder, ...rest }: SelectProps<TOption, IsMulti>, ref: ForwardRefType<TOption, IsMulti>) => JSX.Element;
22
17
  export {};
@@ -1,6 +1,6 @@
1
+ /// <reference types="react" />
1
2
  import { GroupBase, StylesConfig } from 'react-select';
2
3
  import { IconWrapper } from '../../helpers/IconWrapper';
3
- import { SelectOption } from './Select';
4
4
  export declare const prefix = "dds-select";
5
5
  export declare const Label: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<import("../Typography").TypographyProps & import("react").RefAttributes<HTMLElement>>, any, {}, never>;
6
6
  declare type StyledContainerProps = {
@@ -15,5 +15,5 @@ export declare const Wrapper: import("styled-components").StyledComponent<"div",
15
15
  width?: string | number | undefined;
16
16
  }, never>;
17
17
  export declare const SelectedIconWrapper: import("styled-components").StyledComponent<typeof IconWrapper, any, {}, never>;
18
- export declare const CustomStyles: Partial<StylesConfig<SelectOption, boolean, GroupBase<SelectOption>>>;
18
+ export declare const getCustomStyles: <TOption>() => Partial<StylesConfig<TOption, boolean, GroupBase<TOption>>>;
19
19
  export {};
@@ -1,9 +1,10 @@
1
1
  import { CSSObject } from 'styled-components';
2
+ import * as CSS from 'csstype';
2
3
  export declare const multiValueContainerMinHeight: string;
3
4
  export declare const selectTokens: {
4
5
  container: {
5
6
  base: CSSObject;
6
- defaultWidth: string;
7
+ defaultWidth: CSS.Property.Width<string>;
7
8
  hover: {
8
9
  base: CSSObject;
9
10
  };
@@ -49,7 +50,7 @@ export declare const selectTokens: {
49
50
  placeholder: {
50
51
  base: CSSObject;
51
52
  };
52
- optionsList: {
53
+ menu: {
53
54
  base: CSSObject;
54
55
  spaceTop: number;
55
56
  };
@@ -3,10 +3,10 @@ import * as CSS from 'csstype';
3
3
  export declare type SkipToContentProps = {
4
4
  text?: string;
5
5
  href: string;
6
- top?: CSS.TopProperty<string | number>;
6
+ top?: CSS.Property.Top<string | number>;
7
7
  } & HTMLAttributes<HTMLAnchorElement>;
8
8
  export declare const SkipToContent: import("react").ForwardRefExoticComponent<{
9
9
  text?: string | undefined;
10
10
  href: string;
11
- top?: CSS.TopProperty<string | number> | undefined;
11
+ top?: CSS.Property.Top<string | number> | undefined;
12
12
  } & HTMLAttributes<HTMLAnchorElement> & import("react").RefAttributes<HTMLAnchorElement>>;
@@ -3,6 +3,6 @@ import * as CSS from 'csstype';
3
3
  import { TextColor } from '../Typography';
4
4
  export declare type SpinnerProps = {
5
5
  color?: TextColor | string;
6
- size?: CSS.WidthProperty<string>;
6
+ size?: CSS.Property.Width<string>;
7
7
  } & HTMLAttributes<SVGElement>;
8
8
  export declare function Spinner({ size, color, ...rest }: SpinnerProps): JSX.Element;
@@ -15,6 +15,9 @@ export declare const cellTokens: {
15
15
  icon: {
16
16
  base: CSSObject;
17
17
  };
18
+ focus: {
19
+ base: CSSObject;
20
+ };
18
21
  };
19
22
  };
20
23
  data: {
@@ -17,6 +17,9 @@ export declare const rowTokens: {
17
17
  hover: {
18
18
  base: CSSObject;
19
19
  };
20
+ focus: {
21
+ base: CSSObject;
22
+ };
20
23
  mode: {
21
24
  sum: {
22
25
  base: CSSObject;
@@ -5,7 +5,7 @@ export declare const TextInput: React.ForwardRefExoticComponent<{
5
5
  style?: React.CSSProperties | undefined;
6
6
  } & {
7
7
  label?: string | undefined;
8
- width?: string | undefined;
8
+ width?: import("csstype").Property.Width<string> | undefined;
9
9
  tip?: string | undefined;
10
10
  errorMessage?: string | undefined;
11
11
  } & React.InputHTMLAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLTextAreaElement> & React.RefAttributes<HTMLInputElement>>;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TextInputProps } from './TextInput.types';
2
3
  export declare const TextArea: import("styled-components").StyledComponent<"textarea", any, Pick<import("../../helpers/Input").InputProps, "label" | "readOnly" | "disabled"> & {
3
4
  hasErrorMessage: boolean;
@@ -1,4 +1,5 @@
1
1
  import { CSSObject } from 'styled-components';
2
+ import * as CSS from 'csstype';
2
3
  export declare const textInputTokens: {
3
4
  general: {
4
5
  input: {
@@ -49,7 +50,7 @@ export declare const textInputTokens: {
49
50
  };
50
51
  };
51
52
  wrapper: {
52
- defaultWidth: string;
53
+ defaultWidth: CSS.Property.Width<string>;
53
54
  };
54
55
  container: {
55
56
  multiline: {
@@ -11,11 +11,4 @@ export declare const tooltipTokens: {
11
11
  fill: string;
12
12
  };
13
13
  };
14
- arrowPlacementTemplate: {
15
- top: string;
16
- bottom: string;
17
- left: string;
18
- right: string;
19
- };
20
- offset: number;
21
14
  };
@@ -1,8 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import * as CSS from 'csstype';
2
3
  declare type SvgChevronProps = {
3
4
  isUp?: boolean;
4
- height?: CSS.HeightProperty<string>;
5
- width?: CSS.WidthProperty<string>;
5
+ height?: CSS.Property.Height<string>;
6
+ width?: CSS.Property.Width<string>;
6
7
  };
7
8
  export declare const AnimatedChevronUpDown: ({ isUp, height, width }: SvgChevronProps) => JSX.Element;
8
9
  export {};
@@ -1,11 +1,11 @@
1
- import { SvgIconTypeMap } from '@material-ui/core/SvgIcon';
2
- import { OverridableComponent } from '@material-ui/core/OverridableComponent';
1
+ import { SvgIconTypeMap } from '@mui/material/SvgIcon';
2
+ import { OverridableComponent } from '@mui/material/OverridableComponent';
3
3
  import { HTMLAttributes } from 'react';
4
4
  import * as CSS from 'csstype';
5
5
  export declare type IconSize = 'small' | 'medium' | 'large' | 'inline';
6
6
  export declare type IconWrapperProps = {
7
7
  Icon: OverridableComponent<SvgIconTypeMap<Record<string, unknown>, 'svg'>>;
8
8
  iconSize?: IconSize;
9
- color?: CSS.ColorProperty;
9
+ color?: CSS.Property.Color;
10
10
  } & HTMLAttributes<SVGElement>;
11
11
  export declare function IconWrapper({ Icon, iconSize, color, className, style, ...rest }: IconWrapperProps): JSX.Element;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { InputProps, StyledInputProps, StyledLabelProps } from './Input.types';
2
3
  export declare const inputStyling: ({ readOnly, label, disabled, hasErrorMessage }: StyledInputProps) => import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<any>>;
3
4
  export declare const Input: import("styled-components").StyledComponent<"input", any, Pick<InputProps, "readOnly" | "label" | "disabled"> & {
@@ -2,7 +2,7 @@ import { InputHTMLAttributes } from 'react';
2
2
  import * as CSS from 'csstype';
3
3
  export declare type InputProps = {
4
4
  label?: string;
5
- width?: CSS.WidthProperty<string>;
5
+ width?: CSS.Property.Width<string>;
6
6
  tip?: string;
7
7
  errorMessage?: string;
8
8
  } & InputHTMLAttributes<HTMLInputElement>;
@@ -1,9 +1,10 @@
1
+ import * as CSS from 'csstype';
1
2
  import { HTMLAttributes } from 'react';
2
3
  declare type MessageType = 'error' | 'tip';
3
4
  export declare const InputMessage: import("react").ForwardRefExoticComponent<{
4
5
  message: string;
5
6
  messageType: MessageType;
6
- maxWidth?: string | undefined;
7
+ maxWidth?: CSS.Property.MaxWidth<string> | undefined;
7
8
  messageId?: string | undefined;
8
9
  } & HTMLAttributes<HTMLDivElement> & import("react").RefAttributes<HTMLDivElement>>;
9
10
  export {};
@@ -1,8 +1,9 @@
1
1
  import { CSSObject } from 'styled-components';
2
+ import * as CSS from 'csstype';
2
3
  export declare const inputMessageTokens: {
3
4
  padding: string;
4
5
  base: CSSObject;
5
- defaultMaxWidth: string;
6
+ defaultMaxWidth: CSS.Property.MaxWidth<string>;
6
7
  tip: {
7
8
  base: CSSObject;
8
9
  };
@@ -0,0 +1 @@
1
+ export declare const Paper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,4 @@
1
+ import { CSSObject } from 'styled-components';
2
+ export declare const paperTokens: {
3
+ base: CSSObject;
4
+ };
@@ -0,0 +1 @@
1
+ export * from './Paper';
@@ -1,2 +1,3 @@
1
+ /// <reference types="react" />
1
2
  declare function RequiredMarker(): JSX.Element;
2
3
  export default RequiredMarker;
@@ -0,0 +1,4 @@
1
+ export declare const dangerInputfield: {
2
+ borderColor: string;
3
+ boxShadow: string;
4
+ };
@@ -0,0 +1,9 @@
1
+ export declare const focusInputfield: {
2
+ outline: string;
3
+ borderColor: string;
4
+ boxShadow: string;
5
+ };
6
+ export declare const focusDangerInputfield: {
7
+ borderColor: string;
8
+ boxShadow: string;
9
+ };
@@ -0,0 +1,35 @@
1
+ export declare const outlineOffset = "2px";
2
+ export declare const focusVisible: {
3
+ outline: string;
4
+ outlineOffset: string;
5
+ };
6
+ export declare const focusVisibleOnDark: {
7
+ outline: string;
8
+ outlineOffset: string;
9
+ };
10
+ export declare const focusVisibleLink: {
11
+ outline: string;
12
+ backgroundColor: string;
13
+ color: string;
14
+ textDecoration: string;
15
+ };
16
+ export declare const focusVisibleLinkOnDark: {
17
+ outline: string;
18
+ backgroundColor: string;
19
+ color: string;
20
+ textDecoration: string;
21
+ };
22
+ export declare const focusVisibleWithBorder: {
23
+ outline: string;
24
+ borderColor: string;
25
+ boxShadow: string;
26
+ };
27
+ export declare const focusVisibleThickWithBorderOnDark: {
28
+ outline: string;
29
+ borderColor: string;
30
+ boxShadow: string;
31
+ };
32
+ export declare const focusVisibleInset: {
33
+ outline: string;
34
+ boxShadow: string;
35
+ };
@@ -0,0 +1,14 @@
1
+ export declare const hoverWithBorder: {
2
+ borderColor: string;
3
+ boxShadow: string;
4
+ };
5
+ export declare const hoverInputfield: {
6
+ borderColor: string;
7
+ boxShadow: string;
8
+ backgroundColor: string;
9
+ };
10
+ export declare const hoverDangerInputfield: {
11
+ borderColor: string;
12
+ boxShadow: string;
13
+ backgroundColor: string;
14
+ };
@@ -1,2 +1,6 @@
1
1
  export * from './removeButtonStyling';
2
2
  export * from './visibilityTransition';
3
+ export * from './focusVisible';
4
+ export * from './hover';
5
+ export * from './focus';
6
+ export * from './danger';
@@ -1,7 +1,8 @@
1
1
  export * from './useCombinedRefs';
2
2
  export * from './useOnClickOutside';
3
3
  export * from './useOnKeyDown';
4
- export * from './useReactPopper';
4
+ export * from './useFloatPosition';
5
5
  export * from './useRoveFocus';
6
6
  export * from './useFocusTrap';
7
7
  export * from './useMountTransition';
8
+ export * from './useId';
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { Strategy } from '@floating-ui/react-dom';
3
+ export declare type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'right' | 'right-start' | 'right-end' | 'left' | 'left-start' | 'left-end';
4
+ export declare const useFloatPosition: (arrowRef: HTMLElement | null, placement?: Placement, offset?: number) => {
5
+ reference: (node: (Element | import("@floating-ui/core").VirtualElement) | null) => void;
6
+ floating: (node: HTMLElement | null) => void;
7
+ refs: {
8
+ reference: import("react").MutableRefObject<(Element | import("@floating-ui/core").VirtualElement) | null>;
9
+ floating: import("react").MutableRefObject<HTMLElement | null>;
10
+ };
11
+ styles: {
12
+ floating: {
13
+ position: Strategy;
14
+ top: string | number;
15
+ left: string | number;
16
+ };
17
+ arrow: {
18
+ [x: string]: string | number;
19
+ position: Strategy;
20
+ top: string | number;
21
+ left: string | number;
22
+ transform: string;
23
+ } | undefined;
24
+ };
25
+ };
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare function useFocusTrap<T extends HTMLElement>(active: boolean): import("react").RefObject<T>;
@@ -0,0 +1 @@
1
+ export declare function useId(prefix: string, suffix?: string): string;
package/dist/index.css CHANGED
@@ -58,3 +58,10 @@
58
58
  url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff2') format('woff2'),
59
59
  url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff') format('woff');
60
60
  }
61
+
62
+ @import '~@norges-domstoler/dds-design-tokens/dist/css/colors.css';
63
+
64
+ *::selection {
65
+ background-color: var(--dds-color-tertiary-lightest);
66
+ color: var(--dds-color-neutrals-gray-9);
67
+ }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import 'focus-visible';
2
2
  import './styles/fontStyles.css';
3
+ import './styles/selection.css';
3
4
  export * from './components/RadioButton';
4
5
  export * from './components/Checkbox';
5
6
  export * from './components/Button';
@@ -23,4 +24,6 @@ export * from './components/Datepicker';
23
24
  export * from './components/SkipToContent';
24
25
  export * from './components/Tooltip';
25
26
  export * from './components/Modal';
27
+ export * from './components/Drawer';
28
+ export * from './components/OverflowMenu';
26
29
  export * from './components/Popover';
package/dist/index.es.css CHANGED
@@ -58,3 +58,10 @@
58
58
  url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff2') format('woff2'),
59
59
  url('../assets/fonts/IBMPlexSans-SemiBoldItalic.woff') format('woff');
60
60
  }
61
+
62
+ @import '~@norges-domstoler/dds-design-tokens/dist/css/colors.css';
63
+
64
+ *::selection {
65
+ background-color: var(--dds-color-tertiary-lightest);
66
+ color: var(--dds-color-neutrals-gray-9);
67
+ }