@midas-ds/components 1.3.0 → 2.0.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.
@@ -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.3.0",
17
+ "version": "2.0.1",
18
18
  "main": "./index.cjs",
19
19
  "module": "./index.js",
20
20
  "types": "./index.d.ts",
@@ -42,6 +42,9 @@
42
42
  "types": "./theme/index.d.ts",
43
43
  "import": "./theme.js",
44
44
  "require": "./theme.cjs"
45
+ },
46
+ "./global.css": {
47
+ "import": "./global.css"
45
48
  }
46
49
  },
47
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';
@@ -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
@@ -10,8 +10,6 @@ export interface TextFieldProps extends AriaTextFieldProps {
10
10
  errorMessage?: string | ((validation: ValidationResult) => string) | undefined;
11
11
  /** Enable validations or add your own regex */
12
12
  validationType?: 'ssn' | 'dossnr' | RegExp;
13
- /** Set number of characters that are allowed before the TextField is put in an invalid state */
14
- maxCharacters?: number;
15
13
  /**
16
14
  * Whether to show the character counter or not
17
15
  * @default
@@ -23,5 +21,4 @@ export declare const TextField: React.FC<TextFieldProps>;
23
21
  type InputWrapperProps = Pick<TextFieldProps, 'label' | 'description' | 'errorMessage' | 'children'>;
24
22
  export declare const InputWrapper: ({ label, description, errorMessage, children, }: InputWrapperProps) => import("react/jsx-runtime").JSX.Element;
25
23
  export declare const ssnRegEx: RegExp;
26
- export declare const dossNrRegEx: RegExp;
27
24
  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';