@midas-ds/components 1.2.3 → 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.
@@ -1,51 +1,54 @@
1
1
  import { LucideIcon } from 'lucide-react';
2
- import { default as React } from 'react';
2
+ import { Sidebar } from './components/Sidebar';
3
+ import { Header } from './components/Header';
4
+ import { SidebarLink } from './components/SidebarLink';
5
+ import { Href } from '@react-types/shared';
6
+ import { LayoutProvider } from './context/LayoutContext';
7
+ import * as React from 'react';
3
8
  export interface SidebarLinkGroup {
4
9
  title?: string;
5
- items: SidebarLink[];
10
+ items: SidebarLinkProps[];
6
11
  }
7
- export interface SidebarLink {
12
+ export interface SidebarLinkProps {
8
13
  title: string;
9
14
  href: string;
10
15
  icon: LucideIcon;
16
+ active?: boolean;
17
+ isCollapsed?: boolean;
18
+ setIsOpened?: React.Dispatch<React.SetStateAction<boolean>>;
11
19
  }
12
20
  export interface SidebarUser {
13
21
  name: string;
14
22
  title: string;
15
23
  }
16
24
  type HEX = `#${string}`;
17
- interface App {
25
+ export interface App {
18
26
  name: string;
19
- shortName: string;
20
27
  color?: HEX;
21
28
  }
22
29
  export interface MidasLayout {
30
+ /** The menu items/item groups */
23
31
  items: SidebarLinkGroup[];
32
+ /** Title displayed at the top of the application header */
24
33
  title: string;
25
34
  children: React.ReactNode;
26
- headerChildren: React.ReactNode;
27
- user: SidebarUser;
28
- app: App;
29
- clientSideRouter?: (path: string, routerOptions: undefined) => void;
30
- }
31
- export interface MidasHeader {
32
- title: string;
33
- headerChildren: React.ReactNode;
35
+ /** List of links in the top right of the application header */
36
+ headerChildren?: React.ReactNode;
37
+ /** Current user details */
34
38
  user: SidebarUser;
39
+ /** Name of the app */
35
40
  app: App;
36
- isOpened?: boolean;
37
- setIsOpened?: React.Dispatch<React.SetStateAction<boolean>>;
38
- setIsCollapsed?: React.Dispatch<React.SetStateAction<boolean>>;
39
- }
40
- export interface MidasSidebar {
41
- items: SidebarLinkGroup[];
42
- app: App;
43
- isOpened?: boolean;
44
- isCollapsed: boolean;
45
- setIsCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
41
+ /** Provide the layout with your router for client side navigation
42
+ *
43
+ * @see {@link https://designsystem.migrationsverket.se/dev/client-side-routing/}
44
+ */
46
45
  clientSideRouter?: (path: string, routerOptions: undefined) => void;
46
+ clientSideHref?: (href: Href) => string;
47
47
  }
48
- export declare const Layout: React.FC<MidasLayout>;
49
- export declare const Sidebar: React.FC<MidasSidebar>;
50
- export declare const Header: React.FC<MidasHeader>;
48
+ export declare const Layout: React.FC<MidasLayout> & {
49
+ Provider: typeof LayoutProvider;
50
+ Header: typeof Header;
51
+ Sidebar: typeof Sidebar;
52
+ SidebarLink: typeof SidebarLink;
53
+ };
51
54
  export {};
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const Backdrop: React.FC;
@@ -0,0 +1,5 @@
1
+ import * as React from 'react';
2
+ export interface MidasHeader {
3
+ headerChildren?: React.ReactNode;
4
+ }
5
+ export declare const Header: React.FC;
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const Sidebar: React.FC;
@@ -0,0 +1,3 @@
1
+ import { SidebarLinkProps } from '../Layout';
2
+ import * as React from 'react';
3
+ export declare const SidebarLink: React.FC<SidebarLinkProps>;
@@ -0,0 +1,6 @@
1
+ import * as React from 'react';
2
+ interface SkipLinkProps {
3
+ id?: string;
4
+ }
5
+ export declare const SkipLink: React.FC<SkipLinkProps>;
6
+ export {};
@@ -0,0 +1,21 @@
1
+ import { SidebarLinkGroup, SidebarUser, App } from '../Layout';
2
+ import { Href } from '@react-types/shared';
3
+ import * as React from 'react';
4
+ interface LayoutContextProps {
5
+ items: SidebarLinkGroup[];
6
+ title: string;
7
+ user: SidebarUser;
8
+ app: App;
9
+ headerChildren: React.ReactNode;
10
+ isCollapsed: boolean;
11
+ setIsCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
12
+ isOpened: boolean;
13
+ setIsOpened: React.Dispatch<React.SetStateAction<boolean>>;
14
+ clientSideRouter?: (path: string, routerOptions: undefined) => void;
15
+ clientSideHref?: (href: Href) => string;
16
+ }
17
+ export declare const LayoutProvider: React.FC<LayoutContextProps & {
18
+ children: React.ReactNode;
19
+ }>;
20
+ export declare const useLayoutContext: () => LayoutContextProps;
21
+ export {};
package/layout/index.d.ts CHANGED
@@ -1 +1,4 @@
1
1
  export * from './Layout';
2
+ export * from './components/Header';
3
+ export * from './components/Sidebar';
4
+ export * from './components/SidebarLink';
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "description": "Midas Components",
15
15
  "homepage": "https://designsystem.migrationsverket.se/",
16
16
  "license": "CC0-1.0",
17
- "version": "1.2.3",
17
+ "version": "2.0.0",
18
18
  "main": "./index.cjs",
19
19
  "module": "./index.js",
20
20
  "types": "./index.d.ts",
@@ -39,8 +39,12 @@
39
39
  "require": "./index.cjs"
40
40
  },
41
41
  "./theme": {
42
+ "types": "./theme/index.d.ts",
42
43
  "import": "./theme.js",
43
44
  "require": "./theme.cjs"
45
+ },
46
+ "./global.css": {
47
+ "import": "./global.css"
44
48
  }
45
49
  },
46
50
  "dependencies": {
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ type SkeletonProps = {
3
+ width?: string | number;
4
+ height?: string | number;
5
+ variant?: 'circle' | 'rectangular';
6
+ animation?: 'wave' | false;
7
+ };
8
+ export declare const Skeleton: React.FC<SkeletonProps>;
9
+ export {};
@@ -0,0 +1 @@
1
+ export { Skeleton } from './Skeleton';
package/table/Table.d.ts CHANGED
@@ -1,11 +1,10 @@
1
1
  import { RowProps, TableHeaderProps, ColumnProps, TableProps as AriaTableProps, CellProps, TableBody } from 'react-aria-components';
2
- export interface TableProps<T> extends AriaTableProps {
2
+ export interface TableProps extends AriaTableProps {
3
3
  narrow?: boolean;
4
4
  striped?: boolean;
5
- rows: T[];
6
5
  }
7
- export declare const Table: <T extends object>({ narrow, striped, ...rest }: TableProps<T>) => import("react/jsx-runtime").JSX.Element;
8
- export declare const TableHeader: <T extends object>({ columns, children }: TableHeaderProps<T>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const Table: ({ narrow, striped, className, ...rest }: TableProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const TableHeader: <T extends object>({ columns, children, }: TableHeaderProps<T>) => import("react/jsx-runtime").JSX.Element;
9
8
  export declare const Row: <T extends object>({ id, columns, children, ...rest }: RowProps<T>) => import("react/jsx-runtime").JSX.Element;
10
9
  export declare const Column: ({ children, ...rest }: ColumnProps) => import("react/jsx-runtime").JSX.Element;
11
10
  export declare const Cell: ({ ...rest }: CellProps) => import("react/jsx-runtime").JSX.Element;
@@ -7,8 +7,8 @@ export interface TextAreaProps extends AriaTextFieldProps {
7
7
  description?: string;
8
8
  /** Set number of rows for the TextArea */
9
9
  rows?: number;
10
- /** Set number of characters that are allowed before the TextArea is put in an invalid state */
11
- maxCharacters?: number;
10
+ /** Set minimum number of characters that are allowed before the TextArea is put in an invalid state */
11
+ minLength?: number;
12
12
  /**
13
13
  * Whether to show the character counter or not
14
14
  * @default
@@ -1,16 +1,25 @@
1
- import { default as React, ReactNode } from 'react';
2
1
  import { TextFieldProps as AriaTextFieldProps, ValidationResult } from 'react-aria-components';
2
+ import * as React from 'react';
3
3
  export interface TextFieldProps extends AriaTextFieldProps {
4
- children?: ReactNode;
4
+ children?: React.ReactNode;
5
+ /** Specify label displayed above the TextField*/
5
6
  label?: string;
7
+ /** Specify description displayed below the label */
6
8
  description?: string;
9
+ /** Custom error messages */
7
10
  errorMessage?: string | ((validation: ValidationResult) => string) | undefined;
8
- validationType?: 'ssn' | RegExp;
9
- maxCharacters?: number;
11
+ /** Enable validations or add your own regex */
12
+ validationType?: 'ssn' | 'dossnr' | RegExp;
13
+ /**
14
+ * Whether to show the character counter or not
15
+ * @default
16
+ * false
17
+ */
10
18
  showCounter?: boolean;
11
19
  }
12
20
  export declare const TextField: React.FC<TextFieldProps>;
13
21
  type InputWrapperProps = Pick<TextFieldProps, 'label' | 'description' | 'errorMessage' | 'children'>;
14
- export declare const InputWrapper: ({ label, description, errorMessage, children }: InputWrapperProps) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const InputWrapper: ({ label, description, errorMessage, children, }: InputWrapperProps) => import("react/jsx-runtime").JSX.Element;
15
23
  export declare const ssnRegEx: RegExp;
24
+ export declare const dossNrRegEx: RegExp;
16
25
  export {};
@@ -0,0 +1,9 @@
1
+ import { TooltipProps, TooltipTriggerComponentProps } from 'react-aria-components';
2
+ import * as React from 'react';
3
+ interface MidasTooltipProps extends Omit<TooltipProps, 'children'> {
4
+ children: React.ReactNode;
5
+ placement?: 'top' | 'right' | 'bottom' | 'left';
6
+ }
7
+ export declare function Tooltip({ children, placement, className, ...props }: MidasTooltipProps): import("react/jsx-runtime").JSX.Element;
8
+ export declare function TooltipTrigger({ children, delay, ...props }: TooltipTriggerComponentProps): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1 @@
1
+ export * from './Tooltip';