@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.
- package/CHANGELOG.md +84 -1
- package/accordion/AccordionItem.d.ts +2 -2
- package/combobox/ComboBox.d.ts +1 -1
- package/combobox/types.d.ts +4 -0
- package/combobox/utils.d.ts +2 -0
- package/file-upload/FileUpload.d.ts +1 -1
- package/index.cjs +28 -28
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +6771 -6292
- package/layout/Layout.d.ts +29 -26
- package/layout/components/Backdrop.d.ts +2 -0
- package/layout/components/Header.d.ts +5 -0
- package/layout/components/Sidebar.d.ts +2 -0
- package/layout/components/SidebarLink.d.ts +3 -0
- package/layout/components/SkipLink.d.ts +6 -0
- package/layout/context/LayoutContext.d.ts +21 -0
- package/layout/index.d.ts +3 -0
- package/package.json +5 -1
- package/skeleton/Skeleton.d.ts +9 -0
- package/skeleton/index.d.ts +1 -0
- package/table/Table.d.ts +3 -4
- package/textarea/TextArea.d.ts +2 -2
- package/textfield/TextField.d.ts +14 -5
- package/tooltip/Tooltip.d.ts +9 -0
- package/tooltip/index.d.ts +1 -0
package/layout/Layout.d.ts
CHANGED
|
@@ -1,51 +1,54 @@
|
|
|
1
1
|
import { LucideIcon } from 'lucide-react';
|
|
2
|
-
import {
|
|
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:
|
|
10
|
+
items: SidebarLinkProps[];
|
|
6
11
|
}
|
|
7
|
-
export interface
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
50
|
-
|
|
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,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
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": "
|
|
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 @@
|
|
|
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
|
|
2
|
+
export interface TableProps extends AriaTableProps {
|
|
3
3
|
narrow?: boolean;
|
|
4
4
|
striped?: boolean;
|
|
5
|
-
rows: T[];
|
|
6
5
|
}
|
|
7
|
-
export declare const Table:
|
|
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;
|
package/textarea/TextArea.d.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
package/textfield/TextField.d.ts
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
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';
|