@moser-inc/moser-labs-react 1.0.1 → 1.2.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.
- package/README.md +27 -0
- package/dist/_dev/App.d.ts +1 -0
- package/dist/_dev/components/DevLabsUser.d.ts +5 -0
- package/dist/_dev/lib/directory.d.ts +4 -0
- package/dist/_dev/lib/router.d.ts +1 -0
- package/dist/_dev/lib/routerContext.d.ts +1 -0
- package/dist/_dev/sandbox.d.ts +0 -0
- package/dist/_dev/views/Base.view.d.ts +5 -0
- package/dist/_dev/views/Inputs.view.d.ts +5 -0
- package/dist/components/DirectoryLink.d.ts +23 -0
- package/dist/components/FieldCheckbox.d.ts +19 -0
- package/dist/components/FieldContainer.d.ts +18 -0
- package/dist/components/FieldContainerInput.d.ts +8 -0
- package/dist/components/FieldContainerLabel.d.ts +8 -0
- package/dist/components/FieldContainerMessage.d.ts +8 -0
- package/dist/components/FieldDate.d.ts +16 -0
- package/dist/components/FieldSelect.d.ts +32 -0
- package/dist/components/FieldText.d.ts +18 -0
- package/dist/components/FieldTextCurrency.d.ts +12 -0
- package/dist/components/FieldTextSearch.d.ts +12 -0
- package/dist/components/LabsButton.d.ts +15 -3
- package/dist/components/LabsCalendar.d.ts +4 -0
- package/dist/components/LabsIcon.d.ts +36 -0
- package/dist/components/LabsLink.d.ts +4 -0
- package/dist/components/LabsLoader.d.ts +7 -0
- package/dist/components/LabsMain.d.ts +7 -0
- package/dist/components/LabsMainDesktopNav.d.ts +3 -0
- package/dist/components/LabsMainMobileNav.d.ts +3 -0
- package/dist/components/LabsMenuNav.d.ts +10 -0
- package/dist/components/LabsSpeedDialNav.d.ts +10 -0
- package/dist/components/LabsUser.d.ts +14 -0
- package/dist/constants/roles.constant.d.ts +5 -0
- package/dist/hooks/useAuth.d.ts +1 -0
- package/dist/hooks/useBreakpoints.d.ts +4 -0
- package/dist/keycloak.json +8 -0
- package/dist/layouts/Base.layout.d.ts +13 -0
- package/dist/layouts/Main.layout.d.ts +14 -0
- package/dist/lib/auth/authContext.d.ts +19 -0
- package/dist/lib/auth/authUtils.d.ts +107 -0
- package/dist/lib/auth/index.d.ts +4 -0
- package/dist/lib/dayjs.d.ts +2 -0
- package/dist/main.d.ts +26 -0
- package/dist/moser-labs-react.cjs +215 -26
- package/dist/moser-labs-react.js +23418 -2187
- package/dist/style.css +1 -0
- package/dist/types/DirectoryValue.type.d.ts +8 -0
- package/dist/types/ReactHookForm.type.d.ts +6 -0
- package/dist/utils/animations.d.ts +2 -0
- package/dist/utils/number.d.ts +2 -0
- package/package.json +29 -3
package/README.md
CHANGED
|
@@ -10,7 +10,34 @@ npm i primereact @moser-inc/moser-labs-react
|
|
|
10
10
|
|
|
11
11
|
## Usage
|
|
12
12
|
|
|
13
|
+
Either load all component styles in your entry point, which may include unused styles:
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
// main.tsx
|
|
17
|
+
import '@moser-inc/moser-labs-react/style.css';
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Or when using UnoCSS with a bundler like Vite, configure your content sources to include labs components to load only the styles that are used:
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
// uno.config.ts
|
|
24
|
+
import { defineConfig } from 'unocss';
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
content: {
|
|
28
|
+
pipeline: {
|
|
29
|
+
include: [
|
|
30
|
+
/(.*\/)primereact(.*)\.(c|m)?(js)(x?)$/, // primereact
|
|
31
|
+
/(.*\/)@moser-inc_moser-labs-react(.*)\.(c|m)?(js)(x?)$/, // @moser-inc/moser-labs-react
|
|
32
|
+
/\.(vue|svelte|[jt]sx|mdx?|astro|elm|php|phtml|html)($|\?)/, // default
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
13
39
|
```tsx
|
|
40
|
+
// App.tsx
|
|
14
41
|
import { LabsButton } from '@moser-inc/moser-labs-react';
|
|
15
42
|
|
|
16
43
|
const App = () => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const App: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const router: import("@remix-run/router").Router;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const RouterProvider: () => import("react/jsx-runtime").JSX.Element;
|
|
File without changes
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { BadgeProps } from 'primereact/badge';
|
|
3
|
+
import { MenuItem } from 'primereact/menuitem';
|
|
4
|
+
import { NavLinkProps } from 'react-router-dom';
|
|
5
|
+
import { DirectoryValue } from '../types/DirectoryValue.type';
|
|
6
|
+
type DirectoryLinkBaseProps = Omit<NavLinkProps, 'to'>;
|
|
7
|
+
export interface DirectoryLinkProps extends DirectoryLinkBaseProps {
|
|
8
|
+
item: DirectoryValue;
|
|
9
|
+
refreshOnSameUrl?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const DirectoryLink: import("react").ForwardRefExoticComponent<DirectoryLinkProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
12
|
+
export interface DirectoryMenuItem extends MenuItem {
|
|
13
|
+
isMenuOpen?: boolean;
|
|
14
|
+
linkClassName?: DirectoryLinkProps['className'];
|
|
15
|
+
iconClassName?: string;
|
|
16
|
+
labelClassName?: string;
|
|
17
|
+
iconOnly?: boolean;
|
|
18
|
+
badgeValue?: string | number | boolean | null;
|
|
19
|
+
badgeSeverity?: BadgeProps['severity'];
|
|
20
|
+
badgeClassName?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const directoryMenuItem: (item: DirectoryValue, options?: DirectoryMenuItem) => MenuItem;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CheckboxProps } from 'primereact/checkbox';
|
|
2
|
+
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
3
|
+
import { FieldContainerProps } from '../components/FieldContainer';
|
|
4
|
+
import { ControllerRenderParams } from '../types/ReactHookForm.type';
|
|
5
|
+
type FieldProps = Partial<CheckboxProps> & FieldContainerProps;
|
|
6
|
+
export type FieldCheckboxProps = FieldProps;
|
|
7
|
+
export declare const FieldCheckbox: {
|
|
8
|
+
({ id, labelId, messageId, containerId, label, message, animation, className, checked, ...rest }: FieldCheckboxProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
displayName: string;
|
|
10
|
+
};
|
|
11
|
+
export declare const toFieldCheckboxProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { value, ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
|
|
12
|
+
inputRef: import("react-hook-form").RefCallBack;
|
|
13
|
+
checked: import("react-hook-form").PathValue<TValues, TName>;
|
|
14
|
+
onChange: (event: import("primereact/checkbox").CheckboxChangeEvent) => void;
|
|
15
|
+
message: string | undefined;
|
|
16
|
+
onBlur: import("react-hook-form").Noop;
|
|
17
|
+
name: TName;
|
|
18
|
+
};
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type MotionProps } from 'framer-motion';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { ControllerFieldState } from 'react-hook-form';
|
|
4
|
+
export interface FieldContainerProps {
|
|
5
|
+
id: string;
|
|
6
|
+
labelId?: string;
|
|
7
|
+
messageId?: string;
|
|
8
|
+
containerId?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
message?: string;
|
|
11
|
+
animation?: MotionProps;
|
|
12
|
+
className?: string;
|
|
13
|
+
children?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const FieldContainer: ({ id, labelId, messageId, containerId, label, message, animation, children, ...rest }: FieldContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const toFieldContainerProps: (fieldState: ControllerFieldState) => {
|
|
17
|
+
message: string | undefined;
|
|
18
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FieldContainerProps } from '../components/FieldContainer';
|
|
2
|
+
import { Icon } from '../components/LabsIcon';
|
|
3
|
+
export interface FieldContainerInputProps extends FieldContainerProps {
|
|
4
|
+
floatLabel?: boolean;
|
|
5
|
+
prependIcon?: Icon | string;
|
|
6
|
+
appendIcon?: Icon | string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FieldContainerInput: ({ id, labelId, messageId, containerId, label, message, floatLabel, prependIcon, appendIcon, className, children, ...rest }: FieldContainerInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface FieldContainerLabelProps extends ComponentProps<typeof motion.label> {
|
|
4
|
+
id: string;
|
|
5
|
+
labelId?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FieldContainerLabel: ({ id, labelId, label, children, className, ...rest }: FieldContainerLabelProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { motion } from 'framer-motion';
|
|
2
|
+
import { ComponentProps } from 'react';
|
|
3
|
+
export interface FieldContainerMessageProps extends ComponentProps<typeof motion.span> {
|
|
4
|
+
id: string;
|
|
5
|
+
messageId?: string;
|
|
6
|
+
message?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const FieldContainerMessage: ({ id, messageId, message, children, className, ...rest }: FieldContainerMessageProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
2
|
+
import { type FieldContainerInputProps } from '../components/FieldContainerInput';
|
|
3
|
+
import { LabsCalendarProps } from '../components/LabsCalendar';
|
|
4
|
+
import { ControllerRenderParams } from '../types/ReactHookForm.type';
|
|
5
|
+
type FieldProps = LabsCalendarProps & FieldContainerInputProps;
|
|
6
|
+
export type FieldDateProps = FieldProps;
|
|
7
|
+
export declare const FieldDate: ({ id, labelId, messageId, containerId, label, message, animation, floatLabel, className, ...rest }: FieldDateProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const toFieldDateProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
|
|
9
|
+
inputRef: import("react-hook-form").RefCallBack;
|
|
10
|
+
onChange: (event: import("primereact/calendar").CalendarChangeEvent) => void;
|
|
11
|
+
message: string | undefined;
|
|
12
|
+
onBlur: import("react-hook-form").Noop;
|
|
13
|
+
value: import("react-hook-form").PathValue<TValues, TName>;
|
|
14
|
+
name: TName;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DropdownProps } from 'primereact/dropdown';
|
|
3
|
+
import { FormEvent } from 'primereact/ts-helpers';
|
|
4
|
+
import type { IconType } from 'primereact/utils';
|
|
5
|
+
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
6
|
+
import { type FieldContainerInputProps } from '../components/FieldContainerInput';
|
|
7
|
+
import { ControllerRenderParams } from '../types/ReactHookForm.type';
|
|
8
|
+
export interface FieldSelectOption<T = unknown> {
|
|
9
|
+
label?: string;
|
|
10
|
+
value?: T;
|
|
11
|
+
className?: string;
|
|
12
|
+
icon?: IconType<unknown>;
|
|
13
|
+
title?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
items?: FieldSelectOption<T>[];
|
|
16
|
+
}
|
|
17
|
+
type FieldProps = Partial<DropdownProps> & FieldContainerInputProps;
|
|
18
|
+
export interface FieldSelectProps<TValue extends string> extends FieldProps {
|
|
19
|
+
value?: TValue;
|
|
20
|
+
options?: FieldSelectOption<TValue>[];
|
|
21
|
+
onChange?: (event: FormEvent<TValue>) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const FieldSelect: <TValue extends string>({ id, labelId, messageId, containerId, label, message, animation, floatLabel, className, ...rest }: FieldSelectProps<TValue>) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export declare const toFieldSelectProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
|
|
25
|
+
inputRef: import("react-hook-form").RefCallBack;
|
|
26
|
+
onChange: (event: FormEvent<TValues[TName], import("react").SyntheticEvent<Element, Event>>) => void;
|
|
27
|
+
message: string | undefined;
|
|
28
|
+
onBlur: import("react-hook-form").Noop;
|
|
29
|
+
value: import("react-hook-form").PathValue<TValues, TName>;
|
|
30
|
+
name: TName;
|
|
31
|
+
};
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { InputTextProps } from 'primereact/inputtext';
|
|
3
|
+
import { FieldValues, FieldPath } from 'react-hook-form';
|
|
4
|
+
import { type FieldContainerInputProps } from '../components/FieldContainerInput';
|
|
5
|
+
import { ControllerRenderParams } from '../types/ReactHookForm.type';
|
|
6
|
+
type FieldProps = Partial<InputTextProps> & FieldContainerInputProps;
|
|
7
|
+
export type FieldTextProps = FieldProps;
|
|
8
|
+
export type FieldTextElement = HTMLInputElement;
|
|
9
|
+
export declare const FieldText: import("react").ForwardRefExoticComponent<Partial<InputTextProps> & FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
10
|
+
export declare const toFieldTextProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field, fieldState, }: ControllerRenderParams<TValues, TName>) => {
|
|
11
|
+
value: string;
|
|
12
|
+
message: string | undefined;
|
|
13
|
+
onChange: (...event: any[]) => void;
|
|
14
|
+
onBlur: import("react-hook-form").Noop;
|
|
15
|
+
name: TName;
|
|
16
|
+
ref: import("react-hook-form").RefCallBack;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldTextProps } from '../components/FieldText';
|
|
3
|
+
export type FieldTextCurrencyProps = FieldTextProps;
|
|
4
|
+
export declare const FieldTextCurrency: import("react").ForwardRefExoticComponent<Partial<import("primereact/inputtext").InputTextProps> & import("./FieldContainerInput").FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export declare const toFieldTextCurrencyProps: <TValues extends import("react-hook-form").FieldValues = import("react-hook-form").FieldValues, TName extends import("react-hook-form").FieldPath<TValues> = import("react-hook-form").FieldPath<TValues>>({ field, fieldState, }: import("../main").ControllerRenderParams<TValues, TName>) => {
|
|
6
|
+
value: string;
|
|
7
|
+
message: string | undefined;
|
|
8
|
+
onChange: (...event: any[]) => void;
|
|
9
|
+
onBlur: import("react-hook-form").Noop;
|
|
10
|
+
name: TName;
|
|
11
|
+
ref: import("react-hook-form").RefCallBack;
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FieldTextProps } from '../components/FieldText';
|
|
3
|
+
export type FieldTextSearchProps = FieldTextProps;
|
|
4
|
+
export declare const FieldTextSearch: import("react").ForwardRefExoticComponent<Partial<import("primereact/inputtext").InputTextProps> & import("./FieldContainerInput").FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
5
|
+
export declare const toFieldTextSearchProps: <TValues extends import("react-hook-form").FieldValues = import("react-hook-form").FieldValues, TName extends import("react-hook-form").FieldPath<TValues> = import("react-hook-form").FieldPath<TValues>>({ field, fieldState, }: import("../main").ControllerRenderParams<TValues, TName>) => {
|
|
6
|
+
value: string;
|
|
7
|
+
message: string | undefined;
|
|
8
|
+
onChange: (...event: any[]) => void;
|
|
9
|
+
onBlur: import("react-hook-form").Noop;
|
|
10
|
+
name: TName;
|
|
11
|
+
ref: import("react-hook-form").RefCallBack;
|
|
12
|
+
};
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { ButtonProps } from 'primereact/button';
|
|
2
|
+
import { IconValue } from '../components/LabsIcon';
|
|
3
|
+
import { LabsLinkProps } from '../components/LabsLink';
|
|
4
|
+
export interface LabsButtonBaseProps extends Omit<ButtonProps, 'severity'> {
|
|
5
|
+
icon?: IconValue;
|
|
6
|
+
text?: boolean;
|
|
7
|
+
outlined?: boolean;
|
|
8
|
+
rounded?: boolean;
|
|
9
|
+
iconOnly?: boolean;
|
|
10
|
+
size?: 'small' | 'large';
|
|
11
|
+
severity?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'help' | 'danger' | 'plain';
|
|
12
|
+
}
|
|
13
|
+
export type LabsButtonLinkProps = LabsButtonBaseProps & LabsLinkProps;
|
|
14
|
+
export type LabsButtonProps = LabsButtonBaseProps | LabsButtonLinkProps;
|
|
15
|
+
export declare const LabsButton: (props: LabsButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Calendar, CalendarProps } from 'primereact/calendar';
|
|
3
|
+
export type LabsCalendarProps = CalendarProps;
|
|
4
|
+
export declare const LabsCalendar: import("react").ForwardRefExoticComponent<CalendarProps & import("react").RefAttributes<Calendar>>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export declare const ICONS: {
|
|
3
|
+
readonly ADMIN: "pi-shield";
|
|
4
|
+
readonly BARS: "pi-bars";
|
|
5
|
+
readonly CLOSE: "mci-close-fill";
|
|
6
|
+
readonly HOME: "pi-home";
|
|
7
|
+
readonly ICON_EATS: "mli-eats";
|
|
8
|
+
readonly ICON_ENGAGEMENTS: "mli-engagements";
|
|
9
|
+
readonly ICON_IDEALAB: "mli-idealab";
|
|
10
|
+
readonly ICON_LABS: "mli-labs";
|
|
11
|
+
readonly ICON_ROOMGRABBER: "mli-roomgrabber";
|
|
12
|
+
readonly ICON_SPENIO: "mli-spenio";
|
|
13
|
+
readonly ICON_TICKETS: "mli-tickets";
|
|
14
|
+
readonly ICON_TIMETRACKING: "mli-timetracking";
|
|
15
|
+
readonly ICON_TRAINING: "mli-training";
|
|
16
|
+
readonly ICON_WELLNESS: "mli-wellness";
|
|
17
|
+
readonly INPUT: "slr-password-minimalistic-input-outline";
|
|
18
|
+
readonly LOGO_EATS: "mli-eats-badge-lg";
|
|
19
|
+
readonly LOGO_ENGAGEMENTS: "mli-engagements-badge-lg";
|
|
20
|
+
readonly LOGO_IDEALAB: "mli-idealab-badge-lg";
|
|
21
|
+
readonly LOGO_LABS: "mli-labs-badge-lg";
|
|
22
|
+
readonly LOGO_ROOMGRABBER: "mli-roomgrabber-badge-lg";
|
|
23
|
+
readonly LOGO_SPENIO: "mli-spenio-badge-lg";
|
|
24
|
+
readonly LOGO_TICKETS: "mli-tickets-badge-lg";
|
|
25
|
+
readonly LOGO_TIMETRACKING: "mli-timetracking-badge-lg";
|
|
26
|
+
readonly LOGO_TRAINING: "mli-training-badge-lg";
|
|
27
|
+
readonly LOGO_WELLNESS: "mli-wellness-badge-lg";
|
|
28
|
+
readonly LOGOUT: "mdi-logout";
|
|
29
|
+
readonly QUESTION_CIRCLE: "mci-question-line";
|
|
30
|
+
};
|
|
31
|
+
export type Icon = keyof typeof ICONS;
|
|
32
|
+
export type IconValue = (typeof ICONS)[Icon] | string;
|
|
33
|
+
export interface LabsIconProps extends HTMLAttributes<HTMLElement> {
|
|
34
|
+
icon: IconValue;
|
|
35
|
+
}
|
|
36
|
+
export declare const LabsIcon: import("react").ForwardRefExoticComponent<LabsIconProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { DirectoryValue } from '../types/DirectoryValue.type';
|
|
3
|
+
export interface LabsMainProps extends ComponentProps<'main'> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
item?: DirectoryValue;
|
|
6
|
+
}
|
|
7
|
+
export declare const LabsMain: ({ item, children, ...rest }: LabsMainProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MenuProps } from 'primereact/menu';
|
|
2
|
+
import { DirectoryMenuItem } from '../components/DirectoryLink';
|
|
3
|
+
import { DirectoryValue } from '../types/DirectoryValue.type';
|
|
4
|
+
type LabsMenuNavBaseProps = MenuProps;
|
|
5
|
+
export interface LabsMenuNavProps extends LabsMenuNavBaseProps {
|
|
6
|
+
items: readonly DirectoryValue[];
|
|
7
|
+
itemOptions?: DirectoryMenuItem | ((item: DirectoryValue) => DirectoryMenuItem);
|
|
8
|
+
}
|
|
9
|
+
export declare const LabsMenuNav: ({ model, items, itemOptions, role, ...rest }: LabsMenuNavProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SpeedDialProps } from 'primereact/speeddial';
|
|
2
|
+
import { DirectoryMenuItem } from '../components/DirectoryLink';
|
|
3
|
+
import { DirectoryValue } from '../types/DirectoryValue.type';
|
|
4
|
+
type LabsSpeedDialNavBaseProps = SpeedDialProps;
|
|
5
|
+
export interface LabsSpeedDialNavProps extends LabsSpeedDialNavBaseProps {
|
|
6
|
+
items: readonly DirectoryValue[];
|
|
7
|
+
itemOptions?: DirectoryMenuItem | ((item: DirectoryValue) => DirectoryMenuItem);
|
|
8
|
+
}
|
|
9
|
+
export declare const LabsSpeedDialNav: ({ model, items, itemOptions, role, ...rest }: LabsSpeedDialNavProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export type LabsUser = {
|
|
3
|
+
id: string;
|
|
4
|
+
fullName: string;
|
|
5
|
+
email: string;
|
|
6
|
+
jobTitle: string;
|
|
7
|
+
image: string;
|
|
8
|
+
nameInitials: string;
|
|
9
|
+
};
|
|
10
|
+
interface LabsUserProps {
|
|
11
|
+
user: LabsUser;
|
|
12
|
+
}
|
|
13
|
+
export declare const LabsUser: React.FC<LabsUserProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useAuth: () => import('../lib/auth').AuthContextValue;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export type LayoutBaseProps = ComponentPropsWithoutRef<'div'> & {
|
|
3
|
+
appName: string;
|
|
4
|
+
favicon?: {
|
|
5
|
+
dark: string;
|
|
6
|
+
light: string;
|
|
7
|
+
};
|
|
8
|
+
theme?: {
|
|
9
|
+
dark: string;
|
|
10
|
+
light: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const LayoutBase: ({ appName, favicon, theme, children, ...rest }: LayoutBaseProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { DirectoryValue } from '../types/DirectoryValue.type';
|
|
3
|
+
interface LayoutMainProps {
|
|
4
|
+
navigation: DirectoryValue[];
|
|
5
|
+
navigationMobile?: DirectoryValue[];
|
|
6
|
+
actions?: (() => React.ReactNode) | React.ReactNode;
|
|
7
|
+
name?: (() => React.ReactNode) | React.ReactNode;
|
|
8
|
+
themes: {
|
|
9
|
+
dark: string;
|
|
10
|
+
light: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare const LayoutMain: React.FC<LayoutMainProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Role } from '../../constants/roles.constant';
|
|
3
|
+
import { User, refreshToken } from '../../lib/auth';
|
|
4
|
+
export type AuthContextValue = {
|
|
5
|
+
user: User | null;
|
|
6
|
+
hasAllRoles: (roles: Role | readonly Role[] | undefined) => boolean;
|
|
7
|
+
hasRole: (roles: Role | readonly Role[] | undefined) => boolean;
|
|
8
|
+
isAdmin: boolean;
|
|
9
|
+
isAuthenticated: boolean;
|
|
10
|
+
isLoading: boolean;
|
|
11
|
+
logout: () => void;
|
|
12
|
+
refreshToken: typeof refreshToken;
|
|
13
|
+
};
|
|
14
|
+
export declare const AuthContext: import("react").Context<AuthContextValue | null>;
|
|
15
|
+
export interface AuthProviderProps {
|
|
16
|
+
appIdentifier: string;
|
|
17
|
+
children: React.ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export declare const AuthProvider: ({ appIdentifier, children, }: AuthProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
appIdentifier: string;
|
|
3
|
+
};
|
|
4
|
+
export interface User {
|
|
5
|
+
email: string;
|
|
6
|
+
firstName: string;
|
|
7
|
+
id: string;
|
|
8
|
+
lastName: string;
|
|
9
|
+
name: string;
|
|
10
|
+
roles: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const getParsedUserInfo: (options: Options) => User | null;
|
|
13
|
+
export declare const withAuthHeader: (headers?: HeadersInit) => [string, string][] | Record<string, string> | Headers | {
|
|
14
|
+
authorization: string;
|
|
15
|
+
length: number;
|
|
16
|
+
toString(): string;
|
|
17
|
+
toLocaleString(): string;
|
|
18
|
+
pop(): [string, string] | undefined;
|
|
19
|
+
push(...items: [string, string][]): number;
|
|
20
|
+
concat(...items: ConcatArray<[string, string]>[]): [string, string][];
|
|
21
|
+
concat(...items: ([string, string] | ConcatArray<[string, string]>)[]): [string, string][];
|
|
22
|
+
join(separator?: string | undefined): string;
|
|
23
|
+
reverse(): [string, string][];
|
|
24
|
+
shift(): [string, string] | undefined;
|
|
25
|
+
slice(start?: number | undefined, end?: number | undefined): [string, string][];
|
|
26
|
+
sort(compareFn?: ((a: [string, string], b: [string, string]) => number) | undefined): [string, string][];
|
|
27
|
+
splice(start: number, deleteCount?: number | undefined): [string, string][];
|
|
28
|
+
splice(start: number, deleteCount: number, ...items: [string, string][]): [string, string][];
|
|
29
|
+
unshift(...items: [string, string][]): number;
|
|
30
|
+
indexOf(searchElement: [string, string], fromIndex?: number | undefined): number;
|
|
31
|
+
lastIndexOf(searchElement: [string, string], fromIndex?: number | undefined): number;
|
|
32
|
+
every<S extends [string, string]>(predicate: (value: [string, string], index: number, array: [string, string][]) => value is S, thisArg?: any): this is S[];
|
|
33
|
+
every(predicate: (value: [string, string], index: number, array: [string, string][]) => unknown, thisArg?: any): boolean;
|
|
34
|
+
some(predicate: (value: [string, string], index: number, array: [string, string][]) => unknown, thisArg?: any): boolean;
|
|
35
|
+
forEach(callbackfn: (value: [string, string], index: number, array: [string, string][]) => void, thisArg?: any): void;
|
|
36
|
+
map<U>(callbackfn: (value: [string, string], index: number, array: [string, string][]) => U, thisArg?: any): U[];
|
|
37
|
+
filter<S_1 extends [string, string]>(predicate: (value: [string, string], index: number, array: [string, string][]) => value is S_1, thisArg?: any): S_1[];
|
|
38
|
+
filter(predicate: (value: [string, string], index: number, array: [string, string][]) => unknown, thisArg?: any): [string, string][];
|
|
39
|
+
reduce(callbackfn: (previousValue: [string, string], currentValue: [string, string], currentIndex: number, array: [string, string][]) => [string, string]): [string, string];
|
|
40
|
+
reduce(callbackfn: (previousValue: [string, string], currentValue: [string, string], currentIndex: number, array: [string, string][]) => [string, string], initialValue: [string, string]): [string, string];
|
|
41
|
+
reduce<U_1>(callbackfn: (previousValue: U_1, currentValue: [string, string], currentIndex: number, array: [string, string][]) => U_1, initialValue: U_1): U_1;
|
|
42
|
+
reduceRight(callbackfn: (previousValue: [string, string], currentValue: [string, string], currentIndex: number, array: [string, string][]) => [string, string]): [string, string];
|
|
43
|
+
reduceRight(callbackfn: (previousValue: [string, string], currentValue: [string, string], currentIndex: number, array: [string, string][]) => [string, string], initialValue: [string, string]): [string, string];
|
|
44
|
+
reduceRight<U_2>(callbackfn: (previousValue: U_2, currentValue: [string, string], currentIndex: number, array: [string, string][]) => U_2, initialValue: U_2): U_2;
|
|
45
|
+
find<S_2 extends [string, string]>(predicate: (value: [string, string], index: number, obj: [string, string][]) => value is S_2, thisArg?: any): S_2 | undefined;
|
|
46
|
+
find(predicate: (value: [string, string], index: number, obj: [string, string][]) => unknown, thisArg?: any): [string, string] | undefined;
|
|
47
|
+
findIndex(predicate: (value: [string, string], index: number, obj: [string, string][]) => unknown, thisArg?: any): number;
|
|
48
|
+
fill(value: [string, string], start?: number | undefined, end?: number | undefined): [string, string][];
|
|
49
|
+
copyWithin(target: number, start?: number | undefined, end?: number | undefined): [string, string][];
|
|
50
|
+
entries(): IterableIterator<[number, [string, string]]>;
|
|
51
|
+
keys(): IterableIterator<number>;
|
|
52
|
+
values(): IterableIterator<[string, string]>;
|
|
53
|
+
includes(searchElement: [string, string], fromIndex?: number | undefined): boolean;
|
|
54
|
+
flatMap<U_3, This = undefined>(callback: (this: This, value: [string, string], index: number, array: [string, string][]) => U_3 | readonly U_3[], thisArg?: This | undefined): U_3[];
|
|
55
|
+
flat<A, D extends number = 1>(this: A, depth?: D | undefined): FlatArray<A, D>[];
|
|
56
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
57
|
+
[Symbol.unscopables]: {
|
|
58
|
+
[x: number]: boolean | undefined;
|
|
59
|
+
length?: boolean | undefined;
|
|
60
|
+
toString?: boolean | undefined;
|
|
61
|
+
toLocaleString?: boolean | undefined;
|
|
62
|
+
pop?: boolean | undefined;
|
|
63
|
+
push?: boolean | undefined;
|
|
64
|
+
concat?: boolean | undefined;
|
|
65
|
+
join?: boolean | undefined;
|
|
66
|
+
reverse?: boolean | undefined;
|
|
67
|
+
shift?: boolean | undefined;
|
|
68
|
+
slice?: boolean | undefined;
|
|
69
|
+
sort?: boolean | undefined;
|
|
70
|
+
splice?: boolean | undefined;
|
|
71
|
+
unshift?: boolean | undefined;
|
|
72
|
+
indexOf?: boolean | undefined;
|
|
73
|
+
lastIndexOf?: boolean | undefined;
|
|
74
|
+
every?: boolean | undefined;
|
|
75
|
+
some?: boolean | undefined;
|
|
76
|
+
forEach?: boolean | undefined;
|
|
77
|
+
map?: boolean | undefined;
|
|
78
|
+
filter?: boolean | undefined;
|
|
79
|
+
reduce?: boolean | undefined;
|
|
80
|
+
reduceRight?: boolean | undefined;
|
|
81
|
+
find?: boolean | undefined;
|
|
82
|
+
findIndex?: boolean | undefined;
|
|
83
|
+
fill?: boolean | undefined;
|
|
84
|
+
copyWithin?: boolean | undefined;
|
|
85
|
+
entries?: boolean | undefined;
|
|
86
|
+
keys?: boolean | undefined;
|
|
87
|
+
values?: boolean | undefined;
|
|
88
|
+
includes?: boolean | undefined;
|
|
89
|
+
flatMap?: boolean | undefined;
|
|
90
|
+
flat?: boolean | undefined;
|
|
91
|
+
[Symbol.iterator]?: boolean | undefined;
|
|
92
|
+
readonly [Symbol.unscopables]?: boolean | undefined;
|
|
93
|
+
};
|
|
94
|
+
} | {
|
|
95
|
+
authorization: string;
|
|
96
|
+
append(name: string, value: string): void;
|
|
97
|
+
delete(name: string): void;
|
|
98
|
+
get(name: string): string | null;
|
|
99
|
+
has(name: string): boolean;
|
|
100
|
+
set(name: string, value: string): void;
|
|
101
|
+
forEach(callbackfn: (value: string, key: string, parent: Headers) => void, thisArg?: any): void;
|
|
102
|
+
entries(): IterableIterator<[string, string]>;
|
|
103
|
+
keys(): IterableIterator<string>;
|
|
104
|
+
values(): IterableIterator<string>;
|
|
105
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
106
|
+
} | undefined;
|
|
107
|
+
export declare const refreshToken: () => Promise<boolean>;
|
package/dist/main.d.ts
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
+
export * from './components/DirectoryLink';
|
|
2
|
+
export * from './components/FieldCheckbox';
|
|
3
|
+
export * from './components/FieldDate';
|
|
4
|
+
export * from './components/FieldSelect';
|
|
5
|
+
export * from './components/FieldText';
|
|
6
|
+
export * from './components/FieldTextCurrency';
|
|
7
|
+
export * from './components/FieldTextSearch';
|
|
1
8
|
export * from './components/LabsButton';
|
|
9
|
+
export * from './components/LabsCalendar';
|
|
10
|
+
export * from './components/LabsIcon';
|
|
11
|
+
export * from './components/LabsLink';
|
|
12
|
+
export * from './components/LabsLoader';
|
|
13
|
+
export * from './components/LabsMain';
|
|
14
|
+
export * from './components/LabsMainDesktopNav';
|
|
15
|
+
export * from './components/LabsMainMobileNav';
|
|
16
|
+
export * from './components/LabsMenuNav';
|
|
17
|
+
export * from './components/LabsSpeedDialNav';
|
|
18
|
+
export * from './components/LabsUser';
|
|
19
|
+
export * from './hooks/useAuth';
|
|
20
|
+
export * from './hooks/useBreakpoints';
|
|
21
|
+
export * from './layouts/Base.layout';
|
|
22
|
+
export * from './layouts/Main.layout';
|
|
23
|
+
export * from './lib/auth';
|
|
24
|
+
export * from './types/DirectoryValue.type';
|
|
25
|
+
export * from './types/ReactHookForm.type';
|
|
26
|
+
export * from './utils/animations';
|
|
27
|
+
export * from './utils/number';
|