@perawallet/react-ui-toolkit 2.0.0-beta.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.
- package/LICENSE +21 -0
- package/README.md +128 -0
- package/dist/Button.js +1 -0
- package/dist/Checkbox.js +1 -0
- package/dist/DateTimer-DIYsxSVY.js +1 -0
- package/dist/DateTimer.js +1 -0
- package/dist/FileInput.js +1 -0
- package/dist/FileUploadButton.js +1 -0
- package/dist/FormField.js +1 -0
- package/dist/Input.js +1 -0
- package/dist/List.js +1 -0
- package/dist/ListItem.js +1 -0
- package/dist/NumberInput.js +1 -0
- package/dist/PasswordInput.js +1 -0
- package/dist/ProgressBar.js +1 -0
- package/dist/Radio.js +1 -0
- package/dist/RadioGroup.js +1 -0
- package/dist/Select-CMiQfdu3.js +1 -0
- package/dist/Select.js +1 -0
- package/dist/Spinner.js +1 -0
- package/dist/Switch.js +1 -0
- package/dist/Textarea.js +1 -0
- package/dist/TimeInput.js +1 -0
- package/dist/Toast-9FKOjJle.js +1 -0
- package/dist/Toast.js +1 -0
- package/dist/Toggle.js +1 -0
- package/dist/TypeaheadInput.js +1 -0
- package/dist/TypeaheadSelect.js +1 -0
- package/dist/arrayUtils-BZ-V_2c9.js +1 -0
- package/dist/button/Button.d.ts +25 -0
- package/dist/button/file-upload/FileUploadButton.d.ts +9 -0
- package/dist/check-BSS-LBT3.js +1 -0
- package/dist/core/utils/array/arrayUtils.d.ts +13 -0
- package/dist/core/utils/device/deviceUtils.d.ts +2 -0
- package/dist/core/utils/dom/domUtils.d.ts +2 -0
- package/dist/core/utils/function/functionUtils.d.ts +7 -0
- package/dist/core/utils/hooks/useDateTimer.d.ts +17 -0
- package/dist/core/utils/hooks/useDebounce.d.ts +2 -0
- package/dist/core/utils/hooks/useOnClickOutside.d.ts +2 -0
- package/dist/core/utils/keyboard/keyboardEventConstants.d.ts +16 -0
- package/dist/core/utils/number/numberConstants.d.ts +5 -0
- package/dist/core/utils/number/numberTypes.d.ts +7 -0
- package/dist/core/utils/number/numberUtils.d.ts +44 -0
- package/dist/core/utils/string/stringConstants.d.ts +2 -0
- package/dist/core/utils/string/stringUtils.d.ts +5 -0
- package/dist/core/utils/test/testUtils.d.ts +19 -0
- package/dist/core/utils/time/timeConstants.d.ts +13 -0
- package/dist/core/utils/time/timeTypes.d.ts +13 -0
- package/dist/core/utils/time/timeUtils.d.ts +42 -0
- package/dist/date-timer/DateTimer.d.ts +4 -0
- package/dist/date-timer/util/dateTimerTypes.d.ts +18 -0
- package/dist/date-timer/util/dateTimerUtils.d.ts +7 -0
- package/dist/form/field/FormField.d.ts +14 -0
- package/dist/form/field/message/FormFieldMessage.d.ts +9 -0
- package/dist/form/input/Input.d.ts +14 -0
- package/dist/form/input/checkbox/CheckboxInput.d.ts +14 -0
- package/dist/form/input/file/FileInput.d.ts +19 -0
- package/dist/form/input/number/NumberInput.d.ts +6 -0
- package/dist/form/input/number/util/numberInputTypes.d.ts +14 -0
- package/dist/form/input/number/util/numberInputUtils.d.ts +42 -0
- package/dist/form/input/radio/RadioInput.d.ts +24 -0
- package/dist/form/input/radio/group/RadioGroup.d.ts +12 -0
- package/dist/form/input/typeahead/TypeaheadInput.d.ts +27 -0
- package/dist/form/input/util/inputTypes.d.ts +12 -0
- package/dist/form/password-input/PasswordInput.d.ts +9 -0
- package/dist/form/textarea/Textarea.d.ts +22 -0
- package/dist/form/time-input/TimeInput.d.ts +10 -0
- package/dist/index.d.ts +93 -0
- package/dist/index.js +1 -0
- package/dist/keyboardEventConstants-BL5de2V9.js +1 -0
- package/dist/list/List.d.ts +26 -0
- package/dist/list/description-term/DescriptionTerm.d.ts +16 -0
- package/dist/list/item/ListItem.d.ts +17 -0
- package/dist/list/util/listUtils.d.ts +7 -0
- package/dist/main.css +703 -0
- package/dist/numberUtils-CMCFc8Kh.js +1 -0
- package/dist/progress-bar/ProgressBar.d.ts +20 -0
- package/dist/select/Select.d.ts +19 -0
- package/dist/select/content/SelectContent.d.ts +9 -0
- package/dist/select/group/SelectGroup.d.ts +8 -0
- package/dist/select/item/SelectItem.d.ts +17 -0
- package/dist/select/item-list/SelectItemList.d.ts +13 -0
- package/dist/select/trigger/SelectTrigger.d.ts +6 -0
- package/dist/select/typeahead/TypeaheadSelect.d.ts +26 -0
- package/dist/select/typeahead/trigger/TypeheadSelectTrigger.d.ts +20 -0
- package/dist/select/typeahead/util/typeaheadSelectUtils.d.ts +3 -0
- package/dist/select/util/context/SelectContext.d.ts +7 -0
- package/dist/select/util/context/SelectContext.reducer.d.ts +3 -0
- package/dist/select/util/hook/useMultiSelect.d.ts +14 -0
- package/dist/select/util/hook/useSelectClassName.d.ts +12 -0
- package/dist/select/util/hook/useSelectKeyDown.d.ts +18 -0
- package/dist/select/util/hook/useSingleSelect.d.ts +13 -0
- package/dist/select/util/selectTypes.d.ts +40 -0
- package/dist/select/util/selectUtils.d.ts +9 -0
- package/dist/spinner/Spinner.d.ts +7 -0
- package/dist/switch/Switch.d.ts +10 -0
- package/dist/tab/Tab.d.ts +27 -0
- package/dist/tab/header/item/TabHeaderItem.d.ts +11 -0
- package/dist/tag/Tag.d.ts +15 -0
- package/dist/tag/util/tagUtils.d.ts +4 -0
- package/dist/timeUtils-BvuzU1KM.js +1 -0
- package/dist/toast/Toast.d.ts +11 -0
- package/dist/toast/ToastItemContext.d.ts +5 -0
- package/dist/toast/ToastProvider.d.ts +17 -0
- package/dist/toast/close-button/ToastCloseButton.d.ts +8 -0
- package/dist/toast/stack/ToastStack.d.ts +6 -0
- package/dist/toast/util/toastConstants.d.ts +4 -0
- package/dist/toast/util/toastHooks.d.ts +28 -0
- package/dist/toast/util/toastReducer.d.ts +5 -0
- package/dist/toast/util/toastTypes.d.ts +39 -0
- package/dist/toast/util/toastUtils.d.ts +3 -0
- package/dist/toggle/Toggle.d.ts +18 -0
- package/dist/toggle/item/ToggleItem.d.ts +11 -0
- package/dist/toggle/util/ToggleContext.d.ts +8 -0
- package/dist/useDebounce-CP74COv3.js +1 -0
- package/package.json +110 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RemainingTimeBreakdown } from "../../core/utils/time/timeTypes";
|
|
2
|
+
export type TimerType = "down" | "up";
|
|
3
|
+
export type DateTimerItemID = keyof Omit<RemainingTimeBreakdown, "delta">;
|
|
4
|
+
export interface DateTimerProps {
|
|
5
|
+
range: [Date, Date?];
|
|
6
|
+
testid?: string;
|
|
7
|
+
titleMap?: Record<DateTimerItemID, undefined | string>;
|
|
8
|
+
timerInterval?: number;
|
|
9
|
+
timerType?: TimerType;
|
|
10
|
+
alwaysShowSeconds?: boolean;
|
|
11
|
+
onEnd?: () => void;
|
|
12
|
+
customClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DateTimerItem {
|
|
15
|
+
id: DateTimerItemID;
|
|
16
|
+
title: string;
|
|
17
|
+
count: string | number;
|
|
18
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RemainingTimeBreakdown } from "../../core/utils/time/timeTypes";
|
|
2
|
+
import type { DateTimerItem, DateTimerProps } from "./dateTimerTypes";
|
|
3
|
+
declare function generateDateTimerItems({ titleMap, alwaysShowSeconds }: {
|
|
4
|
+
titleMap: DateTimerProps["titleMap"];
|
|
5
|
+
alwaysShowSeconds: boolean;
|
|
6
|
+
}, dateTimerData: RemainingTimeBreakdown): DateTimerItem[];
|
|
7
|
+
export { generateDateTimerItems };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./_form-field.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export interface FormFieldProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
label?: string;
|
|
6
|
+
labelledBy?: string;
|
|
7
|
+
labelFor?: string;
|
|
8
|
+
customClassName?: string;
|
|
9
|
+
helperMessages?: string[];
|
|
10
|
+
errorMessages?: string[];
|
|
11
|
+
testid?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function FormField(props: FormFieldProps): React.JSX.Element;
|
|
14
|
+
export default FormField;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./_form-field-message.scss";
|
|
2
|
+
export interface FormFieldMessageProps {
|
|
3
|
+
type: "error" | "warning" | "helper";
|
|
4
|
+
customClassName?: string;
|
|
5
|
+
message?: string;
|
|
6
|
+
testid?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function FormFieldMessage({ customClassName, type, message, testid }: FormFieldMessageProps): import("react").JSX.Element;
|
|
9
|
+
export default FormFieldMessage;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./_input.scss";
|
|
2
|
+
import React from "react";
|
|
3
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled" | "name" | "className"> & {
|
|
4
|
+
name: string;
|
|
5
|
+
onChange: React.ReactEventHandler<HTMLInputElement>;
|
|
6
|
+
type?: import("./util/inputTypes").InputTypes;
|
|
7
|
+
testid?: string;
|
|
8
|
+
leftIcon?: React.ReactNode;
|
|
9
|
+
rightIcon?: React.ReactNode;
|
|
10
|
+
isDisabled?: boolean;
|
|
11
|
+
hasError?: boolean;
|
|
12
|
+
customClassName?: string;
|
|
13
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
14
|
+
export default Input;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "./_checkbox-input.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { RadioInputItem } from "../../..";
|
|
4
|
+
export interface CheckboxInputProps {
|
|
5
|
+
item: RadioInputItem;
|
|
6
|
+
onSelect: (item: RadioInputItem, event?: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
customIcon?: React.ReactNode;
|
|
10
|
+
customClassName?: string;
|
|
11
|
+
testid?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function CheckboxInput({ item, onSelect, customClassName, isSelected, isDisabled, customIcon, testid }: CheckboxInputProps): React.JSX.Element;
|
|
14
|
+
export default CheckboxInput;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "./_file-input.scss";
|
|
3
|
+
export interface FileInputProps {
|
|
4
|
+
htmlFor: string;
|
|
5
|
+
name: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
onChange: React.ReactEventHandler<HTMLInputElement>;
|
|
8
|
+
testid?: string;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
isPending?: boolean;
|
|
11
|
+
customSpinner?: React.ReactNode;
|
|
12
|
+
customClassName?: string;
|
|
13
|
+
customLabelClassName?: string;
|
|
14
|
+
acceptedFileTypes?: string;
|
|
15
|
+
ref?: React.RefObject<HTMLLabelElement>;
|
|
16
|
+
isMultiple?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const FileInput: React.ForwardRefExoticComponent<Omit<FileInputProps, "ref"> & React.RefAttributes<HTMLLabelElement>>;
|
|
19
|
+
export default FileInput;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare const NumberInput: React.ForwardRefExoticComponent<Omit<import("../util/inputTypes").InputProps, "type"> & {
|
|
3
|
+
formatProps?: import("./util/numberInputTypes").NumberInputFormatProps;
|
|
4
|
+
maximumFractionDigits?: number;
|
|
5
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
6
|
+
export default NumberInput;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InputProps } from "../../util/inputTypes";
|
|
2
|
+
export type NumberInputFormatProps = {
|
|
3
|
+
locale?: string;
|
|
4
|
+
shouldFormatToLocaleString?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export type NumberInputLocaleProps = {
|
|
7
|
+
decimalSeparatorForLocale?: string;
|
|
8
|
+
minusSignForLocale?: string;
|
|
9
|
+
negativeZeroForLocale?: string;
|
|
10
|
+
};
|
|
11
|
+
export type NumberInputProps = Omit<InputProps, "type"> & {
|
|
12
|
+
formatProps?: NumberInputFormatProps;
|
|
13
|
+
maximumFractionDigits?: number;
|
|
14
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { ParseNumberOptions } from "../../../../core/utils/number/numberTypes";
|
|
3
|
+
import type { NumberInputFormatProps, NumberInputLocaleProps } from "./numberInputTypes";
|
|
4
|
+
declare function getNumberInputFormatProps(formatProps: NumberInputFormatProps): {
|
|
5
|
+
LOCALE_NEGATIVE_ZERO: string;
|
|
6
|
+
LOCALE_NEGATIVE_DOUBLE_ZERO: string;
|
|
7
|
+
DEFAULT_NEGATIVE_ZERO: string;
|
|
8
|
+
DEFAULT_NEGATIVE_DOUBLE_ZERO: string;
|
|
9
|
+
THOUSANDTHS_SEPARATOR: string;
|
|
10
|
+
DECIMAL_NUMBER_SEPARATOR: string;
|
|
11
|
+
MINUS_SIGN: string;
|
|
12
|
+
locale?: string;
|
|
13
|
+
shouldFormatToLocaleString?: boolean;
|
|
14
|
+
} | {
|
|
15
|
+
locale: undefined;
|
|
16
|
+
shouldFormatToLocaleString: boolean;
|
|
17
|
+
DECIMAL_NUMBER_SEPARATOR: undefined;
|
|
18
|
+
MINUS_SIGN: undefined;
|
|
19
|
+
LOCALE_NEGATIVE_ZERO: undefined;
|
|
20
|
+
};
|
|
21
|
+
declare function getNumberInputParseNumberOptions(options: ParseNumberOptions): ParseNumberOptions;
|
|
22
|
+
declare function isNumberInputValueNotAValidNumber({ eventValue, formattedValue }: {
|
|
23
|
+
eventValue: string;
|
|
24
|
+
formattedValue: string;
|
|
25
|
+
}): boolean;
|
|
26
|
+
declare function getIsValidNumberInputMaxFractionDigits({ maximumFractionDigits }: {
|
|
27
|
+
maximumFractionDigits: number;
|
|
28
|
+
}): boolean;
|
|
29
|
+
declare function localizeNumberInputValue({ value, formatProps, signProps, maximumFractionDigits }: {
|
|
30
|
+
value: React.InputHTMLAttributes<HTMLInputElement>["value"];
|
|
31
|
+
formatProps: NumberInputFormatProps;
|
|
32
|
+
signProps: NumberInputLocaleProps;
|
|
33
|
+
maximumFractionDigits: number;
|
|
34
|
+
}): string | number | readonly string[] | undefined;
|
|
35
|
+
declare function delocalizeNumberInputValue({ value, event, formatProps, parseNumberOptions, maximumFractionDigits }: {
|
|
36
|
+
value: React.InputHTMLAttributes<HTMLInputElement>["value"];
|
|
37
|
+
event: React.SyntheticEvent<HTMLInputElement>;
|
|
38
|
+
formatProps: NumberInputFormatProps;
|
|
39
|
+
parseNumberOptions: ParseNumberOptions;
|
|
40
|
+
maximumFractionDigits: number;
|
|
41
|
+
}): string;
|
|
42
|
+
export { delocalizeNumberInputValue, getIsValidNumberInputMaxFractionDigits, getNumberInputFormatProps, getNumberInputParseNumberOptions, isNumberInputValueNotAValidNumber, localizeNumberInputValue };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import "./_radio-input.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export interface RadioInputItem<Id = string, Context = any> {
|
|
4
|
+
id: Id;
|
|
5
|
+
content: React.ReactNode;
|
|
6
|
+
inputProps: {
|
|
7
|
+
htmlFor: string;
|
|
8
|
+
value: string;
|
|
9
|
+
name: string;
|
|
10
|
+
};
|
|
11
|
+
isDisabled?: boolean;
|
|
12
|
+
context?: Context;
|
|
13
|
+
customClassName?: string;
|
|
14
|
+
}
|
|
15
|
+
export type RadioInputSelectHandler<Id = string, Context = any> = (item: RadioInputItem<Id, Context>, event?: React.SyntheticEvent<HTMLInputElement>) => void;
|
|
16
|
+
export interface RadioInputProps<Id, Context> {
|
|
17
|
+
item: RadioInputItem<Id, Context>;
|
|
18
|
+
onSelect: RadioInputSelectHandler<Id, Context>;
|
|
19
|
+
isSelected: boolean;
|
|
20
|
+
testid?: string;
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
}
|
|
23
|
+
declare function RadioInput<Id = string, Context = any>({ testid, item, onSelect, isSelected, isDisabled }: RadioInputProps<Id, Context>): React.JSX.Element;
|
|
24
|
+
export default RadioInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import "./_radio-group.scss";
|
|
2
|
+
import type { RadioInputItem, RadioInputSelectHandler } from "../RadioInput";
|
|
3
|
+
export interface RadioGroupProps<Id = string, Context = any> {
|
|
4
|
+
items: RadioInputItem<Id, Context>[];
|
|
5
|
+
selectedItem: null | RadioInputItem<Id, Context>;
|
|
6
|
+
onSelect: RadioInputSelectHandler<Id, Context>;
|
|
7
|
+
customClassName?: string;
|
|
8
|
+
isDisabled?: boolean;
|
|
9
|
+
testid?: string;
|
|
10
|
+
}
|
|
11
|
+
declare function RadioGroup<Id = string, Context = any>({ items, testid, onSelect, selectedItem, customClassName, isDisabled }: RadioGroupProps<Id, Context>): import("react").JSX.Element;
|
|
12
|
+
export default RadioGroup;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { InputProps, InputTypes } from "../util/inputTypes";
|
|
3
|
+
export type TypeaheadInputProps = Omit<InputProps, "onChange" | "type"> & {
|
|
4
|
+
onQueryChange: (value: string) => void;
|
|
5
|
+
type?: Extract<InputTypes, "text" | "number">;
|
|
6
|
+
initialValue?: string;
|
|
7
|
+
queryChangeDebounceTimeout?: number;
|
|
8
|
+
onFocus?: React.ReactEventHandler<HTMLInputElement>;
|
|
9
|
+
onBlur?: React.ReactEventHandler<HTMLInputElement>;
|
|
10
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
11
|
+
leftIcon?: React.ReactNode;
|
|
12
|
+
rightIcon?: React.ReactNode;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
declare const TypeaheadInput: React.ForwardRefExoticComponent<Omit<InputProps, "type" | "onChange"> & {
|
|
16
|
+
onQueryChange: (value: string) => void;
|
|
17
|
+
type?: Extract<InputTypes, "text" | "number">;
|
|
18
|
+
initialValue?: string;
|
|
19
|
+
queryChangeDebounceTimeout?: number;
|
|
20
|
+
onFocus?: React.ReactEventHandler<HTMLInputElement>;
|
|
21
|
+
onBlur?: React.ReactEventHandler<HTMLInputElement>;
|
|
22
|
+
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>;
|
|
23
|
+
leftIcon?: React.ReactNode;
|
|
24
|
+
rightIcon?: React.ReactNode;
|
|
25
|
+
children?: React.ReactNode;
|
|
26
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export default TypeaheadInput;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type InputTypes = "checkbox" | "button" | "color" | "date" | "datetime-local" | "email" | "file" | "hidden" | "image" | "month" | "number" | "password" | "radio" | "range" | "reset" | "search" | "submit" | "tel" | "text" | "time" | "url" | "week";
|
|
2
|
+
export type InputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, "disabled" | "name" | "className"> & {
|
|
3
|
+
name: string;
|
|
4
|
+
onChange: React.ReactEventHandler<HTMLInputElement>;
|
|
5
|
+
type?: InputTypes;
|
|
6
|
+
testid?: string;
|
|
7
|
+
leftIcon?: React.ReactNode;
|
|
8
|
+
rightIcon?: React.ReactNode;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
hasError?: boolean;
|
|
11
|
+
customClassName?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./_password-input.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { InputProps } from "../input/util/inputTypes";
|
|
4
|
+
export interface PasswordInputProps extends Omit<InputProps, "leftIcon" | "rightIcon"> {
|
|
5
|
+
hideIcon?: React.ReactNode;
|
|
6
|
+
revealIcon?: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function PasswordInput({ testid, name, value, onChange, hasError, placeholder, customClassName, hideIcon, revealIcon }: PasswordInputProps): React.JSX.Element;
|
|
9
|
+
export default PasswordInput;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import "./_textarea.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type { TextareaAutosizeProps } from "react-textarea-autosize";
|
|
4
|
+
export type TextareaProps = Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "name" | "onChange" | "className"> & {
|
|
5
|
+
name: string;
|
|
6
|
+
onChange: React.ReactEventHandler<HTMLTextAreaElement>;
|
|
7
|
+
value?: string;
|
|
8
|
+
testid?: string;
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
customClassNames?: {
|
|
11
|
+
container?: string;
|
|
12
|
+
textarea?: string;
|
|
13
|
+
};
|
|
14
|
+
style?: React.CSSProperties;
|
|
15
|
+
autoSizeProps?: TextareaAutosizeProps;
|
|
16
|
+
onJustEnterPressed?: () => void;
|
|
17
|
+
onShiftEnter?: () => void;
|
|
18
|
+
isRequired?: boolean;
|
|
19
|
+
hasError?: boolean;
|
|
20
|
+
};
|
|
21
|
+
declare function Textarea(props: TextareaProps): React.JSX.Element;
|
|
22
|
+
export default Textarea;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type { InputProps } from "../input/util/inputTypes";
|
|
3
|
+
export type TimeInputProps = Omit<InputProps, "localizationOptions" | "onChange" | "value" | "type" | "name"> & {
|
|
4
|
+
onChange: (timeString: string) => void;
|
|
5
|
+
value: string;
|
|
6
|
+
initialDateTime?: Date | null;
|
|
7
|
+
name?: string;
|
|
8
|
+
};
|
|
9
|
+
declare function TimeInput({ testid, initialDateTime, value, onChange, placeholder, name, customClassName, ...rest }: TimeInputProps): React.JSX.Element;
|
|
10
|
+
export default TimeInput;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import "./ui/reference/_colors.scss";
|
|
2
|
+
import "./ui/reference/_measurement.scss";
|
|
3
|
+
import type { ButtonProps as ButtonComponentProps } from "./button/Button";
|
|
4
|
+
import Button from "./button/Button";
|
|
5
|
+
import type { FileUploadButtonProps as FileUploadButtonComponentProps } from "./button/file-upload/FileUploadButton";
|
|
6
|
+
import FileUploadButton from "./button/file-upload/FileUploadButton";
|
|
7
|
+
import useDateTimer from "./core/utils/hooks/useDateTimer";
|
|
8
|
+
import DateTimer from "./date-timer/DateTimer";
|
|
9
|
+
import type { DateTimerProps as DateTimerComponentProps } from "./date-timer/util/dateTimerTypes";
|
|
10
|
+
import type { FormFieldProps as FormFieldComponentProps } from "./form/field/FormField";
|
|
11
|
+
import FormField from "./form/field/FormField";
|
|
12
|
+
import type { CheckboxInputProps as CheckboxInputComponentProps } from "./form/input/checkbox/CheckboxInput";
|
|
13
|
+
import CheckboxInput from "./form/input/checkbox/CheckboxInput";
|
|
14
|
+
import type { FileInputProps as FileInputComponentProps } from "./form/input/file/FileInput";
|
|
15
|
+
import FileInput from "./form/input/file/FileInput";
|
|
16
|
+
import Input from "./form/input/Input";
|
|
17
|
+
import NumberInput from "./form/input/number/NumberInput";
|
|
18
|
+
import type { NumberInputProps as NumberInputComponentProps } from "./form/input/number/util/numberInputTypes";
|
|
19
|
+
import type { RadioGroupProps as RadioGroupComponentProps } from "./form/input/radio/group/RadioGroup";
|
|
20
|
+
import RadioGroup from "./form/input/radio/group/RadioGroup";
|
|
21
|
+
import type { RadioInputItem as RadioInputComponentItem, RadioInputProps as RadioInputComponentProps } from "./form/input/radio/RadioInput";
|
|
22
|
+
import RadioInput from "./form/input/radio/RadioInput";
|
|
23
|
+
import type { TypeaheadInputProps as TypeaheadInputComponentProps } from "./form/input/typeahead/TypeaheadInput";
|
|
24
|
+
import TypeaheadInput from "./form/input/typeahead/TypeaheadInput";
|
|
25
|
+
import type { InputProps as InputComponentProps } from "./form/input/util/inputTypes";
|
|
26
|
+
import type { PasswordInputProps as PasswordInputComponentProps } from "./form/password-input/PasswordInput";
|
|
27
|
+
import PasswordInput from "./form/password-input/PasswordInput";
|
|
28
|
+
import type { TextareaProps as TextareaComponentProps } from "./form/textarea/Textarea";
|
|
29
|
+
import Textarea from "./form/textarea/Textarea";
|
|
30
|
+
import type { TimeInputProps as TimeInputComponentProps } from "./form/time-input/TimeInput";
|
|
31
|
+
import TimeInput from "./form/time-input/TimeInput";
|
|
32
|
+
import type { DescriptionTermProps as DescriptionTermComponentProps } from "./list/description-term/DescriptionTerm";
|
|
33
|
+
import DescriptionTerm from "./list/description-term/DescriptionTerm";
|
|
34
|
+
import type { ListItemProps as ListItemComponentProps } from "./list/item/ListItem";
|
|
35
|
+
import ListItem from "./list/item/ListItem";
|
|
36
|
+
import type { ListProps as ListComponentProps } from "./list/List";
|
|
37
|
+
import List from "./list/List";
|
|
38
|
+
import type { ProgressBarProps as ProgressBarComponentProps } from "./progress-bar/ProgressBar";
|
|
39
|
+
import ProgressBar from "./progress-bar/ProgressBar";
|
|
40
|
+
import type { SelectContentProps as SelectContentComponentProps } from "./select/content/SelectContent";
|
|
41
|
+
import type { SelectGroupProps as SelectGroupComponentProps } from "./select/group/SelectGroup";
|
|
42
|
+
import type { SelectItemProps as SelectItemComponentProps } from "./select/item/SelectItem";
|
|
43
|
+
import Select from "./select/Select";
|
|
44
|
+
import type { SelectTriggerProps as SelectTriggerComponentProps } from "./select/trigger/SelectTrigger";
|
|
45
|
+
import type { TypeaheadSelectProps as TypeaheadSelectComponentProps } from "./select/typeahead/TypeaheadSelect";
|
|
46
|
+
import TypeaheadSelect from "./select/typeahead/TypeaheadSelect";
|
|
47
|
+
import useMultiSelect from "./select/util/hook/useMultiSelect";
|
|
48
|
+
import useSingleSelect from "./select/util/hook/useSingleSelect";
|
|
49
|
+
import type { SelectProps as SelectComponentProps } from "./select/util/selectTypes";
|
|
50
|
+
import type { SpinnerProps as SpinnerComponentProps } from "./spinner/Spinner";
|
|
51
|
+
import Spinner from "./spinner/Spinner";
|
|
52
|
+
import type { SwitchProps as SwitchComponentProps } from "./switch/Switch";
|
|
53
|
+
import Switch from "./switch/Switch";
|
|
54
|
+
import type { TabItem as TabComponentItem, TabProps as TabComponentProps } from "./tab/Tab";
|
|
55
|
+
import Tab from "./tab/Tab";
|
|
56
|
+
import type { ToastProps as ToastComponentProps } from "./toast/Toast";
|
|
57
|
+
import Toast from "./toast/Toast";
|
|
58
|
+
import { ToastContextProvider, ToastDispatchContext, ToastStateContext } from "./toast/ToastProvider";
|
|
59
|
+
import { useToastContextState, useToaster } from "./toast/util/toastHooks";
|
|
60
|
+
import type { ToggleProps as ToggleComponentProps } from "./toggle/Toggle";
|
|
61
|
+
import { Toggle } from "./toggle/Toggle";
|
|
62
|
+
export { Button, CheckboxInput, DateTimer, DescriptionTerm, FileInput, FileUploadButton, FormField, Input, List, ListItem, NumberInput, PasswordInput, ProgressBar, RadioGroup, RadioInput, Select, Spinner, Switch, Tab, Textarea, TimeInput, Toast, ToastContextProvider, ToastDispatchContext, ToastStateContext, Toggle, TypeaheadInput, TypeaheadSelect, useDateTimer, useMultiSelect, useSingleSelect, useToastContextState, useToaster };
|
|
63
|
+
export type FormFieldProps = FormFieldComponentProps;
|
|
64
|
+
export type InputProps = InputComponentProps;
|
|
65
|
+
export type NumberInputProps = NumberInputComponentProps;
|
|
66
|
+
export type FileInputProps = FileInputComponentProps;
|
|
67
|
+
export type PasswordInputProps = PasswordInputComponentProps;
|
|
68
|
+
export type CheckboxInputProps = CheckboxInputComponentProps;
|
|
69
|
+
export type RadioInputProps<Id = string, Context = any> = RadioInputComponentProps<Id, Context>;
|
|
70
|
+
export type RadioInputItem<Id = string, Context = any> = RadioInputComponentItem<Id, Context>;
|
|
71
|
+
export type RadioGroupProps<Id = string, Context = any> = RadioGroupComponentProps<Id, Context>;
|
|
72
|
+
export type TypeaheadInputProps = TypeaheadInputComponentProps;
|
|
73
|
+
export type TypeaheadSelectProps = TypeaheadSelectComponentProps;
|
|
74
|
+
export type ListProps<Item = any> = ListComponentProps<Item>;
|
|
75
|
+
export type ButtonProps = ButtonComponentProps;
|
|
76
|
+
export type DescriptionTermProps = DescriptionTermComponentProps;
|
|
77
|
+
export type FileUploadButtonProps = FileUploadButtonComponentProps;
|
|
78
|
+
export type SpinnerProps = SpinnerComponentProps;
|
|
79
|
+
export type TabItem = TabComponentItem;
|
|
80
|
+
export type TabProps = TabComponentProps;
|
|
81
|
+
export type ProgressBarProps = ProgressBarComponentProps;
|
|
82
|
+
export type TextareaProps = TextareaComponentProps;
|
|
83
|
+
export type ToggleProps = ToggleComponentProps;
|
|
84
|
+
export type SwitchProps = SwitchComponentProps;
|
|
85
|
+
export type TimeInputProps = TimeInputComponentProps;
|
|
86
|
+
export type DateTimerProps = DateTimerComponentProps;
|
|
87
|
+
export type ListItemProps = ListItemComponentProps;
|
|
88
|
+
export type ToastProps = ToastComponentProps;
|
|
89
|
+
export type SelectProps = SelectComponentProps;
|
|
90
|
+
export type SelectGroupProps = SelectGroupComponentProps;
|
|
91
|
+
export type SelectTriggerProps = SelectTriggerComponentProps;
|
|
92
|
+
export type SelectContentProps = SelectContentComponentProps;
|
|
93
|
+
export type SelectItemProps = SelectItemComponentProps;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("./Button.js"),t=require("./FileUploadButton.js"),r=require("./DateTimer-DIYsxSVY.js"),s=require("./FormField.js"),i=require("./Checkbox.js"),a=require("./FileInput.js"),o=require("./Input.js"),u=require("./NumberInput.js"),n=require("./RadioGroup.js"),d=require("./Radio.js"),c=require("./TypeaheadInput.js"),l=require("./PasswordInput.js"),p=require("./Textarea.js"),x=require("./TimeInput.js"),m=require("react/jsx-runtime"),j=require("classnames"),q=require("react"),T=require("./ListItem.js"),h=require("./List.js"),b=require("./ProgressBar.js"),C=require("./Select-CMiQfdu3.js"),S=require("./TypeaheadSelect.js"),I=require("./Spinner.js"),v=require("./Switch.js"),f=require("./Toast-9FKOjJle.js"),N=require("./Toggle.js");require("./timeUtils-BvuzU1KM.js"),require("date-fns/fp"),require("date-fns/locale"),require("date-fns-tz"),require("./check-BSS-LBT3.js"),require("./numberUtils-CMCFc8Kh.js"),require("./useDebounce-CP74COv3.js"),require("react-textarea-autosize"),require("./keyboardEventConstants-BL5de2V9.js"),require("uuid"),require("./arrayUtils-BZ-V_2c9.js"),require("react-dom");const D=q.forwardRef(({id:e,title:t,description:r,customClassNames:s,testid:i,role:a},o)=>{const{container:u,title:n,description:d}=s||{};return m.jsxs("div",{ref:o,className:u,"data-testid":i,id:e,role:a,children:[m.jsx("dt",{className:j("description-term__title",n),children:t}),m.jsx("dd",{className:j("description-term__description",d),children:r})]})});function g({testid:e,tab:t,onClick:r,index:s,isActive:i}){return m.jsxs(T,{customClassName:j("tab-header-item",{"tab-header-item--is-active":i,"tab-header-item--is-disabled":t.isDisabled}),clickableListItemProps:{onClick:function(){if(t.isDisabled)return;r(s)}},testid:e,children:[t.icon&&m.jsx("span",{className:"tab-header-item__icon",children:t.icon}),t.content]})}exports.Button=e,exports.FileUploadButton=t,exports.DateTimer=r.DateTimer,exports.useDateTimer=r.useDateTimer,exports.FormField=s,exports.CheckboxInput=i,exports.FileInput=a,exports.Input=o,exports.NumberInput=u,exports.RadioGroup=n,exports.RadioInput=d,exports.TypeaheadInput=c,exports.PasswordInput=l,exports.Textarea=p,exports.TimeInput=x,exports.ListItem=T,exports.List=h,exports.ProgressBar=b,exports.Select=C.Select,exports.TypeaheadSelect=S,exports.Spinner=I,exports.Switch=v,exports.Toast=f.Toast,exports.ToastContextProvider=f.ToastContextProvider,exports.ToastDispatchContext=f.ToastDispatchContext,exports.ToastStateContext=f.ToastStateContext,exports.useToastContextState=f.useToastContextState,exports.useToaster=f.useToaster,exports.Toggle=N.Toggle,exports.DescriptionTerm=D,exports.Tab=function({testid:e,items:t,initialActiveTabIndex:r=0,activeTabIndex:s,children:i,customClassName:a,onTabChange:o,wrapperId:u}){const[n,d]=q.useState(r),c=j("tab",a);return m.jsxs("div",{id:u,className:c,children:[m.jsx(h,{testid:`${e}.header`,customClassName:"tab__header",items:t,children:(e,t,r)=>m.jsx(g,{testid:t,onClick:l,tab:e,isActive:void 0===s?n===r:s===r,index:r})}),m.jsx("div",{className:"tab__body","data-testid":`${e}.body`,children:i[void 0===s?n:s]})]});function l(e){o&&e!==s&&o(e),void 0===s&&d(e)}},exports.useMultiSelect=function(e){const[t,r]=q.useState(e||[]),s=q.useCallback(e=>{let s;s=t.includes(e)?t.filter(t=>t.id!==e.id):[...t,e],r(s)},[t]);return{value:t,handleSelect:s}},exports.useSingleSelect=function(e){const[t,r]=q.useState(e||null);return{value:t,handleSelect:q.useCallback(e=>{r(e)},[])}};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";exports.KEYBOARD_EVENT_KEY={ENTER:"Enter",SPACE:" ",ESCAPE:"Escape",TAB:"Tab",BACKSPACE:"Backspace",ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SHIFT:"Shift",HOME:"Home",END:"End"};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import "./_list.scss";
|
|
3
|
+
import type { Ref } from "react";
|
|
4
|
+
import React from "react";
|
|
5
|
+
export interface ListProps<Item = any> {
|
|
6
|
+
items: Item[];
|
|
7
|
+
children: (item: Item, testid: string, index?: number) => JSX.Element;
|
|
8
|
+
listItemKeyGenerator?: (item: Item, testid: string) => string;
|
|
9
|
+
testid?: string;
|
|
10
|
+
role?: string;
|
|
11
|
+
customClassName?: string;
|
|
12
|
+
placeholderProps?: {
|
|
13
|
+
shouldDisplayPlaceholder: boolean;
|
|
14
|
+
placeholder: React.ReactNode;
|
|
15
|
+
};
|
|
16
|
+
emptyStateProps?: {
|
|
17
|
+
shouldDisplayEmptyState: boolean;
|
|
18
|
+
emptyState: React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
type?: "unordered" | "ordered" | "description";
|
|
21
|
+
}
|
|
22
|
+
export type ListElementType = Extract<keyof JSX.IntrinsicElements, "ul" | "ol" | "dl">;
|
|
23
|
+
declare const _default: <Item = any>(props: ListProps<Item> & {
|
|
24
|
+
ref?: Ref<ListElementType>;
|
|
25
|
+
}) => JSX.Element;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./_description-term.scss";
|
|
2
|
+
import React from "react";
|
|
3
|
+
export interface DescriptionTermProps {
|
|
4
|
+
title: string;
|
|
5
|
+
description: React.ReactNode;
|
|
6
|
+
id?: string;
|
|
7
|
+
customClassNames?: {
|
|
8
|
+
container?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
role?: string;
|
|
13
|
+
testid?: string;
|
|
14
|
+
}
|
|
15
|
+
declare const DescriptionTerm: React.ForwardRefExoticComponent<DescriptionTermProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default DescriptionTerm;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "./_list-item.scss";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
export interface ListItemProps {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
testid?: string;
|
|
6
|
+
customClassName?: string;
|
|
7
|
+
clickableListItemProps?: {
|
|
8
|
+
onClick: React.ReactEventHandler;
|
|
9
|
+
tabIndex?: number;
|
|
10
|
+
};
|
|
11
|
+
id?: string;
|
|
12
|
+
role?: string;
|
|
13
|
+
ariaSelected?: boolean;
|
|
14
|
+
listItemRef?: React.RefObject<HTMLLIElement>;
|
|
15
|
+
}
|
|
16
|
+
declare function ListItem({ id, testid, children, customClassName, clickableListItemProps, role, ariaSelected, listItemRef }: ListItemProps): React.JSX.Element;
|
|
17
|
+
export default ListItem;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ListProps } from "../List";
|
|
2
|
+
declare function generateListItemKey<Item = any>({ listItemKeyGenerator, listItemTestId, item }: {
|
|
3
|
+
listItemKeyGenerator: ListProps["listItemKeyGenerator"];
|
|
4
|
+
listItemTestId: string;
|
|
5
|
+
item: Item;
|
|
6
|
+
}): any;
|
|
7
|
+
export { generateListItemKey };
|