@leapdevuk/component-toolbox 0.0.3

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.
Files changed (35) hide show
  1. package/README.md +81 -0
  2. package/dist/components/appbar/AppBar.d.ts +9 -0
  3. package/dist/components/appbar/index.d.ts +1 -0
  4. package/dist/components/button/Button.d.ts +11 -0
  5. package/dist/components/button/index.d.ts +1 -0
  6. package/dist/components/currencyinput/CurrencyInput.d.ts +16 -0
  7. package/dist/components/currencyinput/index.d.ts +1 -0
  8. package/dist/components/datepicker/DatePicker.d.ts +32 -0
  9. package/dist/components/datepicker/calendar-icon.d.ts +2 -0
  10. package/dist/components/datepicker/index.d.ts +6 -0
  11. package/dist/components/datepicker/utils.d.ts +18 -0
  12. package/dist/components/dialog/Dialog.d.ts +16 -0
  13. package/dist/components/dialog/images/info-icon.d.ts +2 -0
  14. package/dist/components/dialog/images/leap-icon.d.ts +2 -0
  15. package/dist/components/dialog/images/warning-icon.d.ts +2 -0
  16. package/dist/components/dialog/index.d.ts +1 -0
  17. package/dist/components/footer/Footer.d.ts +10 -0
  18. package/dist/components/footer/index.d.ts +1 -0
  19. package/dist/components/formdialog/FormDialog.d.ts +16 -0
  20. package/dist/components/formdialog/index.d.ts +1 -0
  21. package/dist/components/index.d.ts +11 -0
  22. package/dist/components/loader/Loader.d.ts +6 -0
  23. package/dist/components/loader/index.d.ts +1 -0
  24. package/dist/components/numberinput/NumberInput.d.ts +12 -0
  25. package/dist/components/numberinput/index.d.ts +1 -0
  26. package/dist/components/select/Select.d.ts +16 -0
  27. package/dist/components/select/index.d.ts +1 -0
  28. package/dist/components/typography/Typography.d.ts +4 -0
  29. package/dist/components/typography/index.d.ts +1 -0
  30. package/dist/index.cjs.js +109 -0
  31. package/dist/index.cjs.js.map +1 -0
  32. package/dist/index.d.ts +1 -0
  33. package/dist/index.es.js +8730 -0
  34. package/dist/index.es.js.map +1 -0
  35. package/package.json +62 -0
package/README.md ADDED
@@ -0,0 +1,81 @@
1
+ # LEAP Dev UK - Component Toolbox
2
+
3
+ ### The LEAP Dev UK Component Toolbox.
4
+
5
+ ## Node vesion
6
+
7
+ We are using Node version 20.10.0 (Latest LTS). See https://nodejs.org/en/about/previous-releases
8
+
9
+ node -v
10
+
11
+ ### To install, upgrade, build, format, lint and run the unit tests, you will need to execute the following within a terminal window.
12
+
13
+ ## Install packages
14
+
15
+ Install the dependencies/packages.
16
+
17
+ npm install
18
+
19
+ ## Upgrade packages
20
+
21
+ Upgrade the dependencies/packages.
22
+
23
+ npm upgrade
24
+
25
+ ## Formatting
26
+
27
+ To format the code and follow/enforce a consistent coding style.
28
+
29
+ npm run format
30
+
31
+ ## Linting
32
+
33
+ To lint the code and perform automated checking for programmatic and stylistic errors.
34
+
35
+ npm run lint
36
+
37
+ ## Unit Tests
38
+
39
+ To run the unit tests and check/validate the component is performing as expected.
40
+
41
+ npm run test
42
+
43
+ To run a single test, for example the DatePicker.
44
+
45
+ npm run test -- DatePicker
46
+
47
+ ## Build
48
+
49
+ To build the component toolbox as a package.
50
+
51
+ npm run build
52
+
53
+ ## Publish to NPM
54
+
55
+ To publish the component toolbox package to the NPM account (currently public).
56
+
57
+ npm publish --access public
58
+
59
+ ## Installing locally
60
+
61
+ To use / test locally in an application.
62
+
63
+ npm pack
64
+
65
+ This will create a 'leapdevuk-component-toolbox-{version}.tgz' file which can be added as a dependency in the applications _package.json_ file.
66
+
67
+ "dependencies": {
68
+ ...
69
+ "@leapdevuk/component-toolbox": "file:../../leap-component-toolbox/leapdevuk-component-toolbox-0.0.1.tgz",
70
+ ...
71
+ }
72
+
73
+ ## Installing into an application
74
+
75
+ To use in an application, add package to dependencies.
76
+
77
+ "dependencies": {
78
+ ...
79
+ "@leapdevuk/component-toolbox": "VERSION_NUMBER",
80
+ ...
81
+ }
@@ -0,0 +1,9 @@
1
+ import { FC, MouseEventHandler, ReactNode } from 'react';
2
+ interface IAppBarProps {
3
+ centerComponents?: ReactNode;
4
+ leftComponents?: ReactNode;
5
+ onClickHelp?: MouseEventHandler<HTMLButtonElement>;
6
+ rightComponents?: ReactNode;
7
+ }
8
+ declare const LCTAppBar: FC<IAppBarProps>;
9
+ export default LCTAppBar;
@@ -0,0 +1 @@
1
+ export { default as LCTAppBar } from './AppBar';
@@ -0,0 +1,11 @@
1
+ import { MouseEventHandler, ReactNode } from 'react';
2
+ interface IProps {
3
+ disabled?: boolean;
4
+ onClick?: MouseEventHandler<HTMLButtonElement>;
5
+ primary?: boolean;
6
+ size?: "small" | "medium" | "large";
7
+ children: string | ReactNode;
8
+ variant?: "contained" | "outlined" | "text";
9
+ }
10
+ declare const LCTButton: ({ disabled, onClick, primary, size, children, variant, ...props }: IProps) => import("react/jsx-runtime").JSX.Element;
11
+ export default LCTButton;
@@ -0,0 +1 @@
1
+ export { default as LCTButton } from './Button';
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ interface ICurrencyInputProps {
3
+ allowNull?: boolean;
4
+ autoFocus?: boolean;
5
+ decimalScale?: number;
6
+ disabled?: boolean;
7
+ id?: string;
8
+ onUpdate?: (value: any) => void;
9
+ placeholder?: string;
10
+ prefix?: string;
11
+ size?: "medium" | "small";
12
+ value?: number | null;
13
+ width?: number;
14
+ }
15
+ declare const LCTCurrencyInput: React.FC<ICurrencyInputProps>;
16
+ export default LCTCurrencyInput;
@@ -0,0 +1 @@
1
+ export { default as LCTCurrencyInput } from './CurrencyInput';
@@ -0,0 +1,32 @@
1
+ import { FC } from 'react';
2
+ import { Locale } from 'date-fns';
3
+ interface IValidationError {
4
+ keepButton: boolean;
5
+ message: string;
6
+ originalValue?: string | null;
7
+ }
8
+ interface ICustomActonProps {
9
+ label: string;
10
+ value: Date;
11
+ }
12
+ interface IAdditionalActionsProps {
13
+ showToday?: boolean;
14
+ showClear?: boolean;
15
+ customActions?: ICustomActonProps[];
16
+ }
17
+ interface IDatePickerProps {
18
+ disabled?: boolean;
19
+ fullWidth?: boolean;
20
+ isUTC?: boolean;
21
+ startOfDate?: boolean;
22
+ endOfDate?: boolean;
23
+ onUpdate: (value: string | null) => void;
24
+ additionalActions?: IAdditionalActionsProps;
25
+ size?: "small" | "medium";
26
+ validate30Days?: boolean;
27
+ validate?: (value?: any | null) => IValidationError | null;
28
+ value: string | null;
29
+ locale?: Locale;
30
+ }
31
+ declare const LCTDatePicker: FC<IDatePickerProps>;
32
+ export default LCTDatePicker;
@@ -0,0 +1,2 @@
1
+ declare function CalendarIcon(): import("react/jsx-runtime").JSX.Element;
2
+ export default CalendarIcon;
@@ -0,0 +1,6 @@
1
+ export { default as LCTDatePicker } from './DatePicker';
2
+ export { formatDate as lctFormatDate } from './utils';
3
+ export { getLocalDisplayFormattedDate as lctGetLocalDisplayFormattedDate } from './utils';
4
+ export { getLocalDisplayFormattedDateTime as lctGetLocalDisplayFormattedDateTime } from './utils';
5
+ export { getLocale as lctGetLocale } from './utils';
6
+ export { parseDate as lctParseDate } from './utils';
@@ -0,0 +1,18 @@
1
+ import { LeapContext } from '@leapdev/leap-host';
2
+ import { Locale } from 'date-fns';
3
+ export declare const defaultDateFormat = "dd/MM/yyyy";
4
+ export declare const defaultDateTimeFormat = "yyyy-MM-dd HH:mm:ss";
5
+ export declare const minDateAsObject: Date;
6
+ export declare const timezone: string;
7
+ export declare const utcFormat = "yyyy-MM-dd HH:mm:ss";
8
+ export declare const minDate: string;
9
+ export declare const oneWeek: string;
10
+ export declare const today: string;
11
+ export declare const tomorrow: string;
12
+ export declare const twoWeeks: string;
13
+ export declare const defaultDate: (formatString?: string) => string;
14
+ export declare const formatDate: (date?: Date | null, startOfDate?: boolean, endOfDate?: boolean, isUTC?: boolean) => string | null;
15
+ export declare const parseDate: (date: any, formatString?: string, parseKeyboardVal?: boolean) => string | null;
16
+ export declare const getLocale: (leapContext?: LeapContext) => Locale | undefined;
17
+ export declare const getLocalDisplayFormattedDate: (value?: string | Date, locale?: Locale) => string;
18
+ export declare const getLocalDisplayFormattedDateTime: (value?: string | Date) => string;
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ interface IDialogProps {
3
+ actions?: React.ReactNode;
4
+ children: React.ReactNode;
5
+ closeIcon?: boolean;
6
+ hideOverflow?: boolean;
7
+ isOpen: boolean;
8
+ key?: React.Key | null | undefined;
9
+ maxWidth?: "xs" | "sm" | "md" | "lg" | "xl";
10
+ minWidth?: number;
11
+ onClose?: () => void;
12
+ showWarningIcon?: boolean;
13
+ title: string;
14
+ }
15
+ declare const LCTDialog: FC<IDialogProps>;
16
+ export default LCTDialog;
@@ -0,0 +1,2 @@
1
+ declare function InfoIcon(): import("react/jsx-runtime").JSX.Element;
2
+ export default InfoIcon;
@@ -0,0 +1,2 @@
1
+ declare function LEAPIcon(): import("react/jsx-runtime").JSX.Element;
2
+ export default LEAPIcon;
@@ -0,0 +1,2 @@
1
+ declare function WarningIcon(): import("react/jsx-runtime").JSX.Element;
2
+ export default WarningIcon;
@@ -0,0 +1 @@
1
+ export { default as LCTDialog } from './Dialog';
@@ -0,0 +1,10 @@
1
+ import { FC, ReactNode } from 'react';
2
+ interface IFooterProps {
3
+ leftComponents?: ReactNode;
4
+ onCancel?: () => void;
5
+ onClose?: () => void;
6
+ onOK?: () => void;
7
+ onSaveDisable?: boolean;
8
+ }
9
+ declare const LCTFooter: FC<IFooterProps>;
10
+ export default LCTFooter;
@@ -0,0 +1 @@
1
+ export { default as LCTFooter } from './Footer';
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ interface IDialogProps {
3
+ children: React.ReactNode;
4
+ closeIcon?: boolean;
5
+ fullWidth?: boolean;
6
+ hideOverflow?: boolean;
7
+ isOpen: boolean;
8
+ maxWidth?: "xs" | "sm" | "md" | "lg" | "xl";
9
+ minWidth?: number;
10
+ onCancel?: () => void;
11
+ onClose?: () => void;
12
+ onSave?: () => void;
13
+ title: string;
14
+ }
15
+ declare const LCTFormDialog: FC<IDialogProps>;
16
+ export default LCTFormDialog;
@@ -0,0 +1 @@
1
+ export { default as LCTFormDialog } from './FormDialog';
@@ -0,0 +1,11 @@
1
+ export * from './appbar';
2
+ export * from './button';
3
+ export * from './currencyinput';
4
+ export * from './datepicker';
5
+ export * from './dialog';
6
+ export * from './formdialog';
7
+ export * from './footer';
8
+ export * from './loader';
9
+ export * from './numberinput';
10
+ export * from './select';
11
+ export * from './typography';
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ interface IProps {
3
+ overlay?: boolean;
4
+ }
5
+ declare const LCTLoader: React.FC<IProps>;
6
+ export default LCTLoader;
@@ -0,0 +1 @@
1
+ export { default as LCTLoader } from './Loader';
@@ -0,0 +1,12 @@
1
+ interface IProps {
2
+ autoFocus?: boolean;
3
+ decimalScale?: number;
4
+ disabled?: boolean;
5
+ placeholder?: string;
6
+ updater?: (event: any) => void;
7
+ size?: "medium" | "small";
8
+ value?: number;
9
+ width?: number;
10
+ }
11
+ declare const LCTNumberInput: ({ autoFocus, disabled, placeholder, size, updater, value, width, ...props }: IProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default LCTNumberInput;
@@ -0,0 +1 @@
1
+ export { default as LCTNumberInput } from './NumberInput';
@@ -0,0 +1,16 @@
1
+ export interface ISelectItem {
2
+ name: string;
3
+ value: string;
4
+ }
5
+ interface IProps {
6
+ autoComplete?: boolean;
7
+ disabled?: boolean;
8
+ fullWidth?: boolean;
9
+ id: string;
10
+ items: ISelectItem[];
11
+ onUpdate: (value: string | null) => void;
12
+ size?: "small" | "medium";
13
+ value: string | null;
14
+ }
15
+ declare const LCTSelect: ({ autoComplete, disabled, fullWidth, id, items, onUpdate, size, value, ...props }: IProps) => import("react/jsx-runtime").JSX.Element | undefined;
16
+ export default LCTSelect;
@@ -0,0 +1 @@
1
+ export { default as LCTSelect } from './Select';
@@ -0,0 +1,4 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { TypographyOwnProps } from '@mui/material/Typography';
3
+ declare const LCTTypography: ({ children, variant, }: PropsWithChildren<TypographyOwnProps>) => import("react/jsx-runtime").JSX.Element;
4
+ export default LCTTypography;
@@ -0,0 +1 @@
1
+ export { default as LCTTypography } from './Typography';