@luscii-healthtech/web-ui 2.3.0 → 2.4.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/dist/components/Form/Form.d.ts +15 -5
- package/dist/components/Form/form.types.d.ts +6 -2
- package/dist/components/Icons/WarningIcon.d.ts +3 -0
- package/dist/components/Icons/types/IconProps.type.d.ts +1 -0
- package/dist/components/Toaster/Toaster.d.ts +17 -0
- package/dist/components/Toaster/toast-elements-getter.d.ts +22 -0
- package/dist/components/Toaster/toast-progress-animator.d.ts +12 -0
- package/dist/components/Toaster/toast.d.ts +12 -0
- package/dist/index.d.ts +7 -3
- package/dist/web-ui-tailwind.css +29 -0
- package/dist/web-ui.cjs.development.js +700 -482
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +694 -481
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +5 -8
- package/src/components/Form/Form.tsx +100 -68
- package/src/components/Form/form.types.ts +8 -1
- package/src/components/Icons/CheckIcon.tsx +1 -0
- package/src/components/Icons/CrossIcon.tsx +1 -0
- package/src/components/Icons/WarningIcon.tsx +24 -0
- package/src/components/Icons/types/IconProps.type.ts +1 -0
- package/src/components/Toaster/Toaster.scss +53 -0
- package/src/components/Toaster/Toaster.tsx +100 -0
- package/src/components/Toaster/toast-elements-getter.ts +72 -0
- package/src/components/Toaster/toast-progress-animator.ts +53 -0
- package/src/components/Toaster/toast.ts +112 -0
- package/src/index.tsx +14 -6
- package/dist/components/Acknowledgement/Acknowledgement.d.ts +0 -22
- package/src/components/Acknowledgement/Acknowledgement.js +0 -61
- package/src/components/Acknowledgement/Acknowledgement.scss +0 -49
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FormProps } from "./form.types";
|
|
2
|
+
import { FormProps, GenericFormProps } from "./form.types";
|
|
3
3
|
/**
|
|
4
|
-
* Create a straight forward Form.
|
|
4
|
+
* Create a straight forward Form, which takes away the 'overhead' of react-hook-form.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* You will probably don't want to use this component for now, given that the button is hardcoded.
|
|
7
|
+
* This is an example for the Form for now, though it could be improved to enforce further unification.
|
|
8
|
+
*
|
|
9
|
+
* TODO: make the buttons configurable.
|
|
10
|
+
*/
|
|
11
|
+
export declare function GenericForm<TFieldValues>({ fields, onValid, onError, defaultValues, }: GenericFormProps<TFieldValues>): JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Form based on the fields input.
|
|
14
|
+
*
|
|
15
|
+
* Expects the results of the useForm hook to be injected into the useFormReturn parameter.
|
|
16
|
+
*
|
|
17
|
+
* This allows you to use and modify the useFormReturn before injecting it here.
|
|
8
18
|
*/
|
|
9
|
-
export declare function Form<TFieldValues>({ fields,
|
|
19
|
+
export declare function Form<TFieldValues, TContext>({ fields, useFormReturn, }: FormProps<TFieldValues, TContext>): JSX.Element;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { Control, DeepPartial, FieldErrors, FieldPath, FieldValues, RegisterOptions, SubmitErrorHandler, SubmitHandler } from "react-hook-form";
|
|
1
|
+
import { Control, DeepPartial, FieldErrors, FieldPath, FieldValues, RegisterOptions, SubmitErrorHandler, SubmitHandler, UseFormReturn } from "react-hook-form";
|
|
2
2
|
import React, { HTMLInputTypeAttribute } from "react";
|
|
3
3
|
import { InputProps } from "../Input/Input";
|
|
4
4
|
import { RadioGroupProps } from "../RadioGroup/RadioGroupV2";
|
|
5
5
|
import { SelectProps } from "../Select/SelectV2";
|
|
6
6
|
export declare type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
7
|
-
export interface
|
|
7
|
+
export interface GenericFormProps<TFieldValues extends FieldValues> {
|
|
8
8
|
fields: (FormFieldProps<TFieldValues> | FormFieldRowProps<TFieldValues>)[];
|
|
9
9
|
onValid: SubmitHandler<TFieldValues>;
|
|
10
10
|
onError?: SubmitErrorHandler<TFieldValues>;
|
|
11
11
|
defaultValues?: DeepPartial<TFieldValues>;
|
|
12
12
|
}
|
|
13
|
+
export interface FormProps<TFieldValues extends FieldValues, TContext> {
|
|
14
|
+
fields: (FormFieldProps<TFieldValues> | FormFieldRowProps<TFieldValues>)[];
|
|
15
|
+
useFormReturn: UseFormReturn<TFieldValues, TContext>;
|
|
16
|
+
}
|
|
13
17
|
interface FormFieldGenericProps<TFieldType, TFieldValues> extends FormFieldDecoratorProps {
|
|
14
18
|
name: FieldPath<TFieldValues>;
|
|
15
19
|
options?: RegisterOptions;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./Toaster.scss";
|
|
3
|
+
export interface ToasterProps {
|
|
4
|
+
type: "success" | "failure";
|
|
5
|
+
message: string;
|
|
6
|
+
title: string;
|
|
7
|
+
isVisible?: boolean;
|
|
8
|
+
/** if you need to reposition the toaster for whatever reason you can use these props */
|
|
9
|
+
styleOverwrite?: Pick<React.CSSProperties, "top" | "bottom" | "left" | "right">;
|
|
10
|
+
}
|
|
11
|
+
export declare const TOASTER_TYPE_OPTIONS: {
|
|
12
|
+
readonly SUCCESS: "success";
|
|
13
|
+
readonly FAILURE: "failure";
|
|
14
|
+
};
|
|
15
|
+
export declare type ToasterType = typeof TOASTER_TYPE_OPTIONS[keyof typeof TOASTER_TYPE_OPTIONS];
|
|
16
|
+
declare const Toaster: React.VoidFunctionComponent<ToasterProps>;
|
|
17
|
+
export default Toaster;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
interface GetToasterElementsParams {
|
|
3
|
+
timeoutId: NodeJS.Timeout;
|
|
4
|
+
progressBarAnimationFrameHandler: number;
|
|
5
|
+
}
|
|
6
|
+
interface GetToasterElementsReturn {
|
|
7
|
+
toasterElementMessage: HTMLElement;
|
|
8
|
+
toasterProgressBar: HTMLElement;
|
|
9
|
+
toasterElementTitle: HTMLElement;
|
|
10
|
+
toasterElementSuccessIcon: HTMLElement;
|
|
11
|
+
toasterElementFailureIcon: HTMLElement;
|
|
12
|
+
toasterElementContainer: HTMLElement;
|
|
13
|
+
toasterCloseButton: HTMLElement;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param params.timeoutId - the timeoutId (that makes the toaster vanish), in case of a shortcut
|
|
18
|
+
* @param params.progressBarAnimationFrameHandler - animation frame id to be canceled in case of a shortcut
|
|
19
|
+
* @returns a collection of html elements to be manipulated by the animation
|
|
20
|
+
*/
|
|
21
|
+
export declare const getToasterElements: (params: GetToasterElementsParams) => GetToasterElementsReturn;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface AnimateProgressParams {
|
|
2
|
+
animationDuration: number;
|
|
3
|
+
progressBarElement: HTMLElement;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Reference: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
|
|
7
|
+
* @param params.animationDuration - the amount of seconds the duration will take
|
|
8
|
+
* @param params.progressBarElement - the html element for the progress bar
|
|
9
|
+
* @returns the animation frame id
|
|
10
|
+
*/
|
|
11
|
+
export declare const animateProgress: (params: AnimateProgressParams) => number;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare type ToastParams = {
|
|
2
|
+
message: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
showIcon?: boolean;
|
|
5
|
+
type: "success" | "failure";
|
|
6
|
+
} | string;
|
|
7
|
+
export declare const toast: {
|
|
8
|
+
(params: ToastParams): void;
|
|
9
|
+
error(message: string): void;
|
|
10
|
+
info(message: string): void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
1
|
+
export { default as Toaster, TOASTER_TYPE_OPTIONS, } from "./components/Toaster/Toaster";
|
|
2
|
+
export { toast } from "./components/Toaster/toast";
|
|
2
3
|
export { default as Avatar } from "./components/Avatar/Avatar";
|
|
3
4
|
export { default as Badge } from "./components/Badge/Badge";
|
|
4
5
|
export { BaseButtonProps as NonPrimaryButtonProps, ButtonWithPendingStateProps as PrimaryButtonProps, ButtonDefinition, } from "./components/ButtonV2/ButtonProps.type";
|
|
@@ -34,9 +35,12 @@ export { PageSize as PaginationMenuPageSize, OnPaginationChange as OnPaginationM
|
|
|
34
35
|
export { default as PreviewPhone } from "./components/PreviewPhone/PreviewPhone";
|
|
35
36
|
export { default as Radio } from "./components/Radio/Radio";
|
|
36
37
|
export { default as RadioGroup } from "./components/RadioGroup/RadioGroup";
|
|
38
|
+
export { RadioProps, RadioV2 } from "./components/Radio/RadioV2";
|
|
39
|
+
export { RadioGroupProps, RadioGroupV2, } from "./components/RadioGroup/RadioGroupV2";
|
|
37
40
|
export { default as Section } from "./components/Section/Section";
|
|
38
41
|
export { default as SectionItemWithContent } from "./components/Section/SectionItemWithContent";
|
|
39
42
|
export { default as SectionItem, SectionItemProps, } from "./components/Section/SectionItem";
|
|
43
|
+
export { SelectProps, Select } from "./components/Select/SelectV2";
|
|
40
44
|
export { SettingsMenuButton, SettingsMenuButtonProps, } from "./components/SettingsMenuButton/SettingsMenuButton";
|
|
41
45
|
export { Spinner } from "./components/Spinner/Spinner";
|
|
42
46
|
export { Steps } from "./components/Steps/Steps";
|
|
@@ -56,8 +60,8 @@ export { Timeline } from "./components/Timeline/Timeline";
|
|
|
56
60
|
export { ViewItem, ViewItemProps } from "./components/ViewItem/ViewItem";
|
|
57
61
|
export { default as Text } from "./components/Text/Text";
|
|
58
62
|
export { SearchInput, SearchInputProps } from "./components/Input/SearchInput";
|
|
59
|
-
export { Form } from "./components/Form/Form";
|
|
60
|
-
export { FormProps } from "./components/Form/form.types";
|
|
63
|
+
export { GenericForm, Form } from "./components/Form/Form";
|
|
64
|
+
export { GenericFormProps, FormProps } from "./components/Form/form.types";
|
|
61
65
|
export { IconProps } from "./components/Icons/types/IconProps.type";
|
|
62
66
|
export { AddIcon } from "./components/Icons/AddIcon";
|
|
63
67
|
export { AlertsIcon } from "./components/Icons/AlertsIcon";
|
package/dist/web-ui-tailwind.css
CHANGED
|
@@ -969,6 +969,10 @@ video {
|
|
|
969
969
|
border-radius: 0.25rem;
|
|
970
970
|
}
|
|
971
971
|
|
|
972
|
+
.rounded-md {
|
|
973
|
+
border-radius: 0.375rem;
|
|
974
|
+
}
|
|
975
|
+
|
|
972
976
|
.rounded-lg {
|
|
973
977
|
border-radius: 0.5rem;
|
|
974
978
|
}
|
|
@@ -1001,6 +1005,11 @@ video {
|
|
|
1001
1005
|
border-bottom-left-radius: 0.25rem;
|
|
1002
1006
|
}
|
|
1003
1007
|
|
|
1008
|
+
.rounded-b-md {
|
|
1009
|
+
border-bottom-right-radius: 0.375rem;
|
|
1010
|
+
border-bottom-left-radius: 0.375rem;
|
|
1011
|
+
}
|
|
1012
|
+
|
|
1004
1013
|
.rounded-b-lg {
|
|
1005
1014
|
border-bottom-right-radius: 0.5rem;
|
|
1006
1015
|
border-bottom-left-radius: 0.5rem;
|
|
@@ -1449,6 +1458,10 @@ video {
|
|
|
1449
1458
|
margin-right: 0;
|
|
1450
1459
|
}
|
|
1451
1460
|
|
|
1461
|
+
.max-h-19 {
|
|
1462
|
+
max-height: 4.75rem;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1452
1465
|
.max-h-78 {
|
|
1453
1466
|
max-height: 19.5rem;
|
|
1454
1467
|
}
|
|
@@ -1461,6 +1474,10 @@ video {
|
|
|
1461
1474
|
max-width: 48rem;
|
|
1462
1475
|
}
|
|
1463
1476
|
|
|
1477
|
+
.min-h-13 {
|
|
1478
|
+
min-height: 3.25rem;
|
|
1479
|
+
}
|
|
1480
|
+
|
|
1464
1481
|
.min-w-24 {
|
|
1465
1482
|
min-width: 1.5rem;
|
|
1466
1483
|
}
|
|
@@ -1693,6 +1710,10 @@ video {
|
|
|
1693
1710
|
right: 0;
|
|
1694
1711
|
}
|
|
1695
1712
|
|
|
1713
|
+
.bottom-0 {
|
|
1714
|
+
bottom: 0;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1696
1717
|
.left-0 {
|
|
1697
1718
|
left: 0;
|
|
1698
1719
|
}
|
|
@@ -2041,6 +2062,10 @@ video {
|
|
|
2041
2062
|
width: 20rem;
|
|
2042
2063
|
}
|
|
2043
2064
|
|
|
2065
|
+
.w-104 {
|
|
2066
|
+
width: 26rem;
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2044
2069
|
.w-200 {
|
|
2045
2070
|
width: 50rem;
|
|
2046
2071
|
}
|
|
@@ -2108,6 +2133,10 @@ video {
|
|
|
2108
2133
|
transition-property: opacity;
|
|
2109
2134
|
}
|
|
2110
2135
|
|
|
2136
|
+
.transition-transform {
|
|
2137
|
+
transition-property: transform;
|
|
2138
|
+
}
|
|
2139
|
+
|
|
2111
2140
|
.ease-in {
|
|
2112
2141
|
transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
|
|
2113
2142
|
}
|