@moser-inc/moser-labs-react 1.3.2 → 1.4.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.
@@ -17,6 +17,7 @@ export interface DirectoryMenuItem extends MenuItem {
17
17
  badgeValue?: string | number | boolean | null;
18
18
  badgeSeverity?: BadgeProps['severity'];
19
19
  badgeClassName?: string;
20
+ isMenuOpen?: boolean;
20
21
  }
21
22
  export declare const directoryMenuItem: (item: DirectoryValue, options?: DirectoryMenuItem) => MenuItem;
22
23
  export {};
@@ -1,4 +1,4 @@
1
- import { FieldContainerProps } from '../components/FieldContainer';
1
+ import { FieldContainerProps } from './FieldContainer';
2
2
  export interface FieldContainerInputProps extends FieldContainerProps {
3
3
  floatLabel?: boolean;
4
4
  prependIcon?: string;
@@ -1,14 +1,14 @@
1
1
  import { CheckboxProps } from 'primereact/checkbox';
2
2
  import { FieldValues, FieldPath } from 'react-hook-form';
3
- import { FieldContainerProps } from '../components/FieldContainer';
3
+ import { FieldContainerProps } from '../components/FieldContainer/FieldContainer';
4
4
  import { ControllerRenderParams } from '../types/ReactHookForm.type';
5
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;
6
+ export type LabsCheckboxProps = FieldProps;
7
+ export declare const LabsCheckbox: {
8
+ ({ id, labelId, messageId, containerId, label, message, animation, className, checked, ...rest }: LabsCheckboxProps): import("react/jsx-runtime").JSX.Element;
9
9
  displayName: string;
10
10
  };
11
- export declare const toFieldCheckboxProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { value, ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
11
+ export declare const toLabsCheckboxProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { value, ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
12
12
  inputRef: import("react-hook-form").RefCallBack;
13
13
  checked: import("react-hook-form").PathValue<TValues, TName>;
14
14
  onChange: (event: import("primereact/checkbox").CheckboxChangeEvent) => void;
@@ -1,11 +1,11 @@
1
1
  import { FieldValues, FieldPath } from 'react-hook-form';
2
- import { type FieldContainerInputProps } from '../components/FieldContainerInput';
2
+ import { type FieldContainerInputProps } from '../components/FieldContainer/FieldContainerInput';
3
3
  import { LabsCalendarProps } from '../components/LabsCalendar';
4
4
  import { ControllerRenderParams } from '../types/ReactHookForm.type';
5
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>) => {
6
+ export type LabsDateProps = FieldProps;
7
+ export declare const LabsDate: ({ id, labelId, messageId, containerId, label, message, animation, floatLabel, className, ...rest }: LabsDateProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const toLabsDateProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
9
9
  inputRef: import("react-hook-form").RefCallBack;
10
10
  onChange: (event: import("primereact/calendar").CalendarChangeEvent) => void;
11
11
  message: string | undefined;
@@ -1,5 +1,5 @@
1
1
  import { HTMLAttributes } from 'react';
2
- export declare const ICONS: {
2
+ export declare const LABS_ICONS: {
3
3
  readonly BARS: "pi-bars";
4
4
  readonly CLOSE: "mci-close-fill";
5
5
  readonly ICON_EATS: "mli-eats";
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export interface LabsLogoutTimerProps {
3
+ children: ReactNode;
4
+ options?: {
5
+ delay: number;
6
+ };
7
+ onLogout: () => void;
8
+ }
9
+ export declare const LabsLogoutTimer: ({ children, options, onLogout, }: LabsLogoutTimerProps) => ReactNode;
@@ -3,25 +3,25 @@ import { DropdownProps } from 'primereact/dropdown';
3
3
  import { FormEvent } from 'primereact/ts-helpers';
4
4
  import type { IconType } from 'primereact/utils';
5
5
  import { FieldValues, FieldPath } from 'react-hook-form';
6
- import { type FieldContainerInputProps } from '../components/FieldContainerInput';
6
+ import { type FieldContainerInputProps } from '../components/FieldContainer/FieldContainerInput';
7
7
  import { ControllerRenderParams } from '../types/ReactHookForm.type';
8
- export interface FieldSelectOption<T = unknown> {
8
+ export interface LabsSelectOption<T = unknown> {
9
9
  label?: string;
10
10
  value?: T;
11
11
  className?: string;
12
12
  icon?: IconType<unknown>;
13
13
  title?: string;
14
14
  disabled?: boolean;
15
- items?: FieldSelectOption<T>[];
15
+ items?: LabsSelectOption<T>[];
16
16
  }
17
17
  type FieldProps = Partial<DropdownProps> & FieldContainerInputProps;
18
- export interface FieldSelectProps<TValue extends string> extends FieldProps {
18
+ export interface LabsSelectProps<TValue extends string> extends FieldProps {
19
19
  value?: TValue;
20
- options?: FieldSelectOption<TValue>[];
20
+ options?: LabsSelectOption<TValue>[];
21
21
  onChange?: (event: FormEvent<TValue>) => void;
22
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>) => {
23
+ export declare const LabsSelect: <TValue extends string>({ id, labelId, messageId, containerId, label, message, animation, floatLabel, className, ...rest }: LabsSelectProps<TValue>) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const toLabsSelectProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field: { ref, ...field }, fieldState, }: ControllerRenderParams<TValues, TName>) => {
25
25
  inputRef: import("react-hook-form").RefCallBack;
26
26
  onChange: (event: FormEvent<TValues[TName], import("react").SyntheticEvent<Element, Event>>) => void;
27
27
  message: string | undefined;
@@ -1,13 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import { InputTextProps } from 'primereact/inputtext';
3
3
  import { FieldValues, FieldPath } from 'react-hook-form';
4
- import { type FieldContainerInputProps } from '../components/FieldContainerInput';
4
+ import { type FieldContainerInputProps } from '../components/FieldContainer/FieldContainerInput';
5
5
  import { ControllerRenderParams } from '../types/ReactHookForm.type';
6
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>) => {
7
+ export type LabsTextProps = FieldProps;
8
+ export type LabsTextElement = HTMLInputElement;
9
+ export declare const LabsText: import("react").ForwardRefExoticComponent<Partial<InputTextProps> & FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
10
+ export declare const toLabsTextProps: <TValues extends FieldValues = FieldValues, TName extends FieldPath<TValues> = FieldPath<TValues>>({ field, fieldState, }: ControllerRenderParams<TValues, TName>) => {
11
11
  value: string;
12
12
  message: string | undefined;
13
13
  onChange: (...event: any[]) => void;
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ import { LabsTextProps } from '../components/LabsText';
3
+ export type LabsTextCurrencyProps = LabsTextProps;
4
+ export declare const LabsTextCurrency: import("react").ForwardRefExoticComponent<Partial<import("primereact/inputtext").InputTextProps> & import("./FieldContainer/FieldContainerInput").FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
5
+ export declare const toLabsTextCurrencyProps: <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 { LabsTextProps } from '../components/LabsText';
3
+ export type LabsTextSearchProps = LabsTextProps;
4
+ export declare const LabsTextSearch: import("react").ForwardRefExoticComponent<Partial<import("primereact/inputtext").InputTextProps> & import("./FieldContainer/FieldContainerInput").FieldContainerInputProps & import("react").RefAttributes<HTMLInputElement>>;
5
+ export declare const toLabsTextSearchProps: <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
+ };
@@ -6,6 +6,10 @@ interface LayoutMainProps {
6
6
  actions?: (() => React.ReactNode) | React.ReactNode;
7
7
  appName: string;
8
8
  children: React.ReactNode;
9
+ favicons: {
10
+ dark: string;
11
+ light: string;
12
+ };
9
13
  navigation: DirectoryValue[];
10
14
  navigationMobile?: DirectoryValue[];
11
15
  name?: ((appName: string) => React.ReactNode) | React.ReactNode;
@@ -16,5 +20,5 @@ interface LayoutMainProps {
16
20
  light: string;
17
21
  };
18
22
  }
19
- export declare const LayoutMain: ({ actions, appName, children, navigation, navigationMobile, name, renderNavigation, renderNavigationMobile, themes, }: LayoutMainProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const LayoutMain: ({ actions, appName, children, favicons, navigation, navigationMobile, name, renderNavigation, renderNavigationMobile, themes, }: LayoutMainProps) => import("react/jsx-runtime").JSX.Element;
20
24
  export {};
@@ -1,11 +1,10 @@
1
1
  /// <reference types="react" />
2
- import { Role } from '../../constants/roles.constant';
3
2
  import { User, refreshToken } from '../../lib/auth';
3
+ export type Role = string;
4
4
  export type AuthContextValue = {
5
5
  user: User | null;
6
6
  hasAllRoles: (roles: Role | readonly Role[] | undefined) => boolean;
7
7
  hasRole: (roles: Role | readonly Role[] | undefined) => boolean;
8
- isAdmin: boolean;
9
8
  isAuthenticated: boolean;
10
9
  isLoading: boolean;
11
10
  logout: () => void;
package/dist/main.d.ts CHANGED
@@ -1,18 +1,19 @@
1
- export * from './components/FieldCheckbox';
2
- export * from './components/FieldDate';
3
- export * from './components/FieldSelect';
4
- export * from './components/FieldText';
5
- export * from './components/FieldTextCurrency';
6
- export * from './components/FieldTextSearch';
7
1
  export * from './components/LabsButton';
8
2
  export * from './components/LabsCalendar';
3
+ export * from './components/LabsCheckbox';
4
+ export * from './components/LabsDate';
9
5
  export * from './components/LabsIcon';
10
6
  export * from './components/LabsLoader';
7
+ export * from './components/LabsLogoutTimer';
11
8
  export * from './components/LabsMain';
12
9
  export * from './components/LabsMainDesktopNav';
13
10
  export * from './components/LabsMainMobileNav';
14
11
  export * from './components/LabsMenuNav';
12
+ export * from './components/LabsSelect';
15
13
  export * from './components/LabsSpeedDialNav';
14
+ export * from './components/LabsText';
15
+ export * from './components/LabsTextCurrency';
16
+ export * from './components/LabsTextSearch';
16
17
  export * from './components/LabsUser';
17
18
  export * from './hooks/useAuth';
18
19
  export * from './hooks/useBreakpoints';