@trackunit/react-components 0.1.117 → 0.1.124
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/index.cjs +39061 -2457
- package/index.js +39057 -2457
- package/package.json +9 -8
- package/src/common/CommonProps.d.ts +12 -12
- package/src/common/StorybookProps.d.ts +6 -6
- package/src/common/index.d.ts +3 -3
- package/src/common/useContainerProps.d.ts +16 -16
- package/src/components/Alert/Alert.d.ts +53 -53
- package/src/components/Alert/Alert.variants.d.ts +18 -18
- package/src/components/Alert/index.d.ts +1 -1
- package/src/components/Badge/Badge.d.ts +38 -38
- package/src/components/Badge/Badge.variants.d.ts +3 -3
- package/src/components/Badge/index.d.ts +1 -1
- package/src/components/Card/Card.d.ts +39 -39
- package/src/components/Card/Card.variants.d.ts +13 -13
- package/src/components/Card/CardBody.d.ts +25 -25
- package/src/components/Card/CardFooter.d.ts +25 -25
- package/src/components/Card/CardHeader.d.ts +47 -47
- package/src/components/Card/DensityContainer.d.ts +30 -30
- package/src/components/Card/index.d.ts +5 -5
- package/src/components/Clickable/Clickable.variants.d.ts +3 -3
- package/src/components/Collapse/Collapse.d.ts +28 -28
- package/src/components/Collapse/Collapse.variants.d.ts +8 -8
- package/src/components/Collapse/index.d.ts +1 -1
- package/src/components/CopyableText/CopyableText.d.ts +21 -21
- package/src/components/CopyableText/CopyableText.variants.d.ts +3 -3
- package/src/components/CopyableText/index.d.ts +1 -1
- package/src/components/DayPicker/DayPicker.d.ts +32 -32
- package/src/components/DayPicker/DayPickerPopover.d.ts +22 -22
- package/src/components/DayPicker/DayRangePicker.d.ts +33 -33
- package/src/components/DayPicker/index.d.ts +21 -21
- package/src/components/DayPicker/useLocale.d.ts +8 -8
- package/src/components/Drawer/Drawer.d.ts +32 -32
- package/src/components/Drawer/Drawer.variants.d.ts +4 -4
- package/src/components/ExternalLink/ExternalLink.d.ts +31 -31
- package/src/components/Heading/Heading.d.ts +28 -28
- package/src/components/Heading/Heading.variants.d.ts +5 -5
- package/src/components/Heading/index.d.ts +1 -1
- package/src/components/Icon/Icon.d.ts +52 -52
- package/src/components/Icon/Icon.variants.d.ts +8 -8
- package/src/components/Indicator/Indicator.d.ts +42 -42
- package/src/components/Indicator/Indicator.variants.d.ts +10 -10
- package/src/components/Indicator/index.d.ts +1 -1
- package/src/components/Menu/MenuItem/MenuItem.d.ts +57 -65
- package/src/components/Menu/MenuItem/MenuItem.variants.d.ts +12 -0
- package/src/components/Menu/MenuList/MenuList.d.ts +29 -36
- package/src/components/Menu/MenuList/MenuList.variants.d.ts +4 -0
- package/src/components/Menu/MoreMenu/MoreMenu.d.ts +24 -24
- package/src/components/Menu/MoreMenu/MoreMenu.variants.d.ts +1 -0
- package/src/components/Menu/index.d.ts +3 -3
- package/src/components/Modal/Modal.d.ts +30 -30
- package/src/components/Modal/Modal.variants.d.ts +5 -0
- package/src/components/Modal/ModalBackdrop.d.ts +13 -13
- package/src/components/Modal/index.d.ts +3 -3
- package/src/components/Modal/useModal.d.ts +21 -21
- package/src/components/PageHeader/PageHeader.d.ts +47 -47
- package/src/components/PageHeader/PageHeader.variants.d.ts +5 -5
- package/src/components/PageHeader/index.d.ts +1 -1
- package/src/components/Pagination/Pagination.d.ts +62 -62
- package/src/components/Pagination/Pagination.variants.d.ts +2 -2
- package/src/components/Popover/Popover.d.ts +72 -72
- package/src/components/Popover/Popover.variants.d.ts +5 -5
- package/src/components/Popover/PopoverContent.d.ts +7 -7
- package/src/components/Popover/PopoverTitle.d.ts +20 -20
- package/src/components/Popover/PopoverTrigger.d.ts +12 -12
- package/src/components/Popover/PopoverTypes.d.ts +33 -33
- package/src/components/Popover/index.d.ts +5 -5
- package/src/components/Popover/usePopover.d.ts +56 -56
- package/src/components/Prompt/Prompt.d.ts +20 -20
- package/src/components/Prompt/index.d.ts +1 -1
- package/src/components/SectionHeader/SectionHeader.d.ts +23 -23
- package/src/components/SectionHeader/index.d.ts +1 -1
- package/src/components/Sidebar/Sidebar.d.ts +57 -57
- package/src/components/Sidebar/Sidebar.variants.d.ts +4 -4
- package/src/components/Sidebar/useOverflowItems.d.ts +39 -39
- package/src/components/SkeletonLines/SkeletonLines.d.ts +25 -25
- package/src/components/SkeletonLines/SkeletonLines.variants.d.ts +1 -1
- package/src/components/SkeletonLines/index.d.ts +1 -1
- package/src/components/Spacer/Spacer.d.ts +20 -20
- package/src/components/Spacer/Spacer.variants.d.ts +4 -4
- package/src/components/Spacer/index.d.ts +1 -1
- package/src/components/Spinner/Spinner.d.ts +39 -39
- package/src/components/Spinner/Spinner.variants.d.ts +7 -7
- package/src/components/Spinner/index.d.ts +1 -1
- package/src/components/Tag/Tag.d.ts +40 -40
- package/src/components/Tag/Tag.variants.d.ts +7 -7
- package/src/components/Tag/index.d.ts +1 -1
- package/src/components/Text/Text.d.ts +58 -58
- package/src/components/Text/Text.variants.d.ts +9 -0
- package/src/components/Text/index.d.ts +1 -1
- package/src/components/Timeline/Timeline.d.ts +33 -33
- package/src/components/Timeline/Timeline.variants.d.ts +3 -3
- package/src/components/Tip/Tip.d.ts +26 -26
- package/src/components/Tip/Tip.variants.d.ts +4 -4
- package/src/components/Tip/index.d.ts +1 -1
- package/src/components/Tooltip/Tooltip.d.ts +37 -37
- package/src/components/Tooltip/Tooltip.variants.d.ts +6 -6
- package/src/components/Tooltip/index.d.ts +1 -1
- package/src/components/ValueBar/ValueBar.d.ts +44 -44
- package/src/components/ValueBar/ValueBar.variants.d.ts +9 -9
- package/src/components/ValueBar/ValueBarHelper.d.ts +35 -35
- package/src/components/ValueBar/ValueBarTypes.d.ts +9 -9
- package/src/components/ValueBar/index.d.ts +3 -3
- package/src/components/buttons/BackToTopButton/BackToTopButton.d.ts +14 -14
- package/src/components/buttons/BackToTopButton/BackToTopButton.variants.d.ts +3 -3
- package/src/components/buttons/Button/Button.d.ts +44 -44
- package/src/components/buttons/IconButton/IconButton.d.ts +20 -20
- package/src/components/buttons/StarButton/StarButton.d.ts +13 -13
- package/src/components/buttons/index.d.ts +4 -4
- package/src/components/buttons/shared/Button.variants.d.ts +13 -13
- package/src/components/buttons/shared/ButtonProps.d.ts +48 -48
- package/src/components/index.d.ts +30 -30
- package/src/hooks/index.d.ts +9 -9
- package/src/hooks/localStorage/initLocalStorageState.d.ts +9 -0
- package/src/hooks/localStorage/types.d.ts +27 -0
- package/src/hooks/localStorage/useLocalStorage.d.ts +10 -0
- package/src/hooks/localStorage/useLocalStorageEffect.d.ts +11 -0
- package/src/hooks/localStorage/useLocalStorageReducer.d.ts +13 -0
- package/src/hooks/localStorage/validateState.d.ts +13 -0
- package/src/hooks/useClickOutside.d.ts +12 -12
- package/src/hooks/useDebounce.d.ts +13 -13
- package/src/hooks/useDevicePixelRatio.d.ts +37 -37
- package/src/hooks/useHover.d.ts +24 -24
- package/src/hooks/useIsFirstRender.d.ts +6 -6
- package/src/hooks/useResize.d.ts +10 -10
- package/src/hooks/useTimeout.d.ts +11 -11
- package/src/index.d.ts +8 -7
- package/src/layout/helper/MinTopFullContentLayout.d.ts +18 -18
- package/src/layout/index.d.ts +6 -6
- package/src/layout/responsive/FilterListMapLayout.d.ts +15 -22
- package/src/layout/responsive/FullWidthRepeatingLayout.d.ts +19 -19
- package/src/layout/responsive/GridArea.d.ts +13 -13
- package/src/layout/responsive/IntrinsicallyResponsiveGrid.d.ts +32 -32
- package/src/layout/responsive/TitleNavContentLayout.d.ts +28 -28
- package/src/test-utils/hooks.d.ts +4 -4
- package/src/test-utils/test-utils.d.ts +5 -5
- package/src/hooks/useLocalStorage.d.ts +0 -9
- package/src/hooks/useLocalStorageReducer.d.ts +0 -7
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
export * from "./Alert";
|
|
2
|
-
export * from "./Badge";
|
|
3
|
-
export * from "./buttons";
|
|
4
|
-
export * from "./Card";
|
|
5
|
-
export * from "./Collapse";
|
|
6
|
-
export * from "./CopyableText";
|
|
7
|
-
export * from "./DayPicker";
|
|
8
|
-
export * from "./Drawer/Drawer";
|
|
9
|
-
export * from "./ExternalLink/ExternalLink";
|
|
10
|
-
export * from "./Heading";
|
|
11
|
-
export * from "./Icon/Icon";
|
|
12
|
-
export * from "./Indicator";
|
|
13
|
-
export * from "./Menu";
|
|
14
|
-
export * from "./Modal";
|
|
15
|
-
export * from "./PageHeader";
|
|
16
|
-
export * from "./Pagination/Pagination";
|
|
17
|
-
export * from "./Popover";
|
|
18
|
-
export * from "./Popover/Popover";
|
|
19
|
-
export * from "./Prompt";
|
|
20
|
-
export * from "./SectionHeader";
|
|
21
|
-
export * from "./Sidebar/Sidebar";
|
|
22
|
-
export * from "./SkeletonLines";
|
|
23
|
-
export * from "./Spacer";
|
|
24
|
-
export * from "./Spinner";
|
|
25
|
-
export * from "./Tag";
|
|
26
|
-
export * from "./Text";
|
|
27
|
-
export * from "./Timeline/Timeline";
|
|
28
|
-
export * from "./Tip";
|
|
29
|
-
export * from "./Tooltip";
|
|
30
|
-
export * from "./ValueBar";
|
|
1
|
+
export * from "./Alert";
|
|
2
|
+
export * from "./Badge";
|
|
3
|
+
export * from "./buttons";
|
|
4
|
+
export * from "./Card";
|
|
5
|
+
export * from "./Collapse";
|
|
6
|
+
export * from "./CopyableText";
|
|
7
|
+
export * from "./DayPicker";
|
|
8
|
+
export * from "./Drawer/Drawer";
|
|
9
|
+
export * from "./ExternalLink/ExternalLink";
|
|
10
|
+
export * from "./Heading";
|
|
11
|
+
export * from "./Icon/Icon";
|
|
12
|
+
export * from "./Indicator";
|
|
13
|
+
export * from "./Menu";
|
|
14
|
+
export * from "./Modal";
|
|
15
|
+
export * from "./PageHeader";
|
|
16
|
+
export * from "./Pagination/Pagination";
|
|
17
|
+
export * from "./Popover";
|
|
18
|
+
export * from "./Popover/Popover";
|
|
19
|
+
export * from "./Prompt";
|
|
20
|
+
export * from "./SectionHeader";
|
|
21
|
+
export * from "./Sidebar/Sidebar";
|
|
22
|
+
export * from "./SkeletonLines";
|
|
23
|
+
export * from "./Spacer";
|
|
24
|
+
export * from "./Spinner";
|
|
25
|
+
export * from "./Tag";
|
|
26
|
+
export * from "./Text";
|
|
27
|
+
export * from "./Timeline/Timeline";
|
|
28
|
+
export * from "./Tip";
|
|
29
|
+
export * from "./Tooltip";
|
|
30
|
+
export * from "./ValueBar";
|
package/src/hooks/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export * from "./
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./
|
|
5
|
-
export * from "./
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
8
|
-
export * from "./useResize";
|
|
9
|
-
export * from "./useTimeout";
|
|
1
|
+
export * from "./localStorage/useLocalStorage";
|
|
2
|
+
export * from "./localStorage/useLocalStorageReducer";
|
|
3
|
+
export * from "./useClickOutside";
|
|
4
|
+
export * from "./useDebounce";
|
|
5
|
+
export * from "./useDevicePixelRatio";
|
|
6
|
+
export * from "./useHover";
|
|
7
|
+
export * from "./useIsFirstRender";
|
|
8
|
+
export * from "./useResize";
|
|
9
|
+
export * from "./useTimeout";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LocalStorageParams } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Initializes the state from local storage, parsing and validating it if a Zod schema is provided.
|
|
4
|
+
*
|
|
5
|
+
* @template State - The type of the state stored in local storage.
|
|
6
|
+
* @param {Omit<LocalStorageParams<State>, "state">} params - The parameters for initializing the local storage state.
|
|
7
|
+
* @returns {State} - The initialized state.
|
|
8
|
+
*/
|
|
9
|
+
export declare const initLocalStorageState: <State>({ key, defaultState, schema, }: Omit<LocalStorageParams<State>, "state">) => State;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ZodType } from "zod";
|
|
2
|
+
export interface LocalStorageParams<State> {
|
|
3
|
+
/**
|
|
4
|
+
* The key used to store the value in local storage.
|
|
5
|
+
*/
|
|
6
|
+
key: string;
|
|
7
|
+
/**
|
|
8
|
+
* The default state value.
|
|
9
|
+
*/
|
|
10
|
+
defaultState: State;
|
|
11
|
+
/**
|
|
12
|
+
* Optional schema for validating the state.
|
|
13
|
+
*/
|
|
14
|
+
schema?: ZodType<State>;
|
|
15
|
+
}
|
|
16
|
+
export interface LocalStorageCallbacks {
|
|
17
|
+
/**
|
|
18
|
+
* Optional callback function called when validation fails.
|
|
19
|
+
*
|
|
20
|
+
* @param error - The validation error object.
|
|
21
|
+
*/
|
|
22
|
+
onValidationFailed?: (error: unknown) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Optional callback function called when validation succeeds.
|
|
25
|
+
*/
|
|
26
|
+
onValidationSuccessful?: () => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from "react";
|
|
2
|
+
import { LocalStorageCallbacks, LocalStorageParams } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Works like a normal useState, but saves to local storage and has optional schema validation.
|
|
5
|
+
*
|
|
6
|
+
* @template State - The type of the value stored in local storage.
|
|
7
|
+
* @param {Omit<LocalStorageParams<State>, "state"> & LocalStorageCallbacks} options - The options for useLocalStorage.
|
|
8
|
+
* @returns {[State, Dispatch<SetStateAction<State>>, () => void]} - A tuple containing the current value, a function to update the value, and a function to remove the value from local storage.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useLocalStorage: <State>({ key, defaultState, schema, onValidationFailed, onValidationSuccessful, }: Omit<LocalStorageParams<State>, "state"> & LocalStorageCallbacks) => [State, Dispatch<SetStateAction<State>>, () => void];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LocalStorageCallbacks, LocalStorageParams } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook for synchronizing a state variable with local storage,
|
|
4
|
+
* with optional schema validation and callbacks.
|
|
5
|
+
*
|
|
6
|
+
* @template State - The type of the state variable.
|
|
7
|
+
* @param {LocalStorageParams<State> & LocalStorageCallbacks & { state: State }} params - The parameters for the useLocalStorageEffect hook.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useLocalStorageEffect: <State>({ key, state, defaultState, schema, onValidationFailed, onValidationSuccessful, }: LocalStorageParams<State> & LocalStorageCallbacks & {
|
|
10
|
+
state: State;
|
|
11
|
+
}) => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Dispatch } from "react";
|
|
2
|
+
import { LocalStorageCallbacks, LocalStorageParams } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Works like a normal useReducer, but saves to local storage and has optional schema validation.
|
|
5
|
+
*
|
|
6
|
+
* @template State - The type of the state.
|
|
7
|
+
* @template Action - The type of the action.
|
|
8
|
+
* @param {LocalStorageParams<State> & LocalStorageCallbacks} params - The parameters for the useLocalStorageReducer function.
|
|
9
|
+
* @returns {[State, Dispatch<Action>]} - A tuple containing the state and the dispatch function.
|
|
10
|
+
*/
|
|
11
|
+
export declare const useLocalStorageReducer: <State, Action>({ key, defaultState, reducer, schema, onValidationFailed, onValidationSuccessful, }: {
|
|
12
|
+
reducer: (state: State, action: Action) => State;
|
|
13
|
+
} & LocalStorageParams<State> & LocalStorageCallbacks) => [State, Dispatch<Action>];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LocalStorageCallbacks, LocalStorageParams } from "./types";
|
|
2
|
+
type ValidateStateOptions<State> = Required<Pick<LocalStorageParams<State>, "schema">> & {
|
|
3
|
+
state: State;
|
|
4
|
+
} & LocalStorageCallbacks;
|
|
5
|
+
/**
|
|
6
|
+
* Validates the state object using a Zod schema.
|
|
7
|
+
*
|
|
8
|
+
* @template State - The type of the state.
|
|
9
|
+
* @param {ValidateStateOptions<State>} params - The parameters for the validateState function.
|
|
10
|
+
* @returns {boolean} - `true` if the state is valid according to the schema, `false` otherwise.
|
|
11
|
+
*/
|
|
12
|
+
export declare const validateState: <State>({ state, schema, onValidationFailed, onValidationSuccessful, }: ValidateStateOptions<State>) => boolean;
|
|
13
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { RefObject } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Custom hook to handle click outside events.
|
|
4
|
-
*
|
|
5
|
-
* @param {RefObject<HTMLElement> | Array<RefObject<HTMLElement>>} el - The reference(s) to the element(s) to watch for click outside events.
|
|
6
|
-
* @param {Object | Function} [options={}] - Configuration options or the click event handler if options are not provided.
|
|
7
|
-
* @param {boolean} [options.active=true] - Whether the click outside event listener should be active.
|
|
8
|
-
* @param {Function} [onClick] - The event handler for the click outside event.
|
|
9
|
-
*/
|
|
10
|
-
export declare const useClickOutside: (el: RefObject<HTMLElement> | RefObject<HTMLElement>[], options?: {
|
|
11
|
-
active?: boolean | undefined;
|
|
12
|
-
} | ((ev: MouseEvent) => void), onClick?: ((ev: MouseEvent) => void) | undefined) => void;
|
|
1
|
+
import { RefObject } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Custom hook to handle click outside events.
|
|
4
|
+
*
|
|
5
|
+
* @param {RefObject<HTMLElement> | Array<RefObject<HTMLElement>>} el - The reference(s) to the element(s) to watch for click outside events.
|
|
6
|
+
* @param {Object | Function} [options={}] - Configuration options or the click event handler if options are not provided.
|
|
7
|
+
* @param {boolean} [options.active=true] - Whether the click outside event listener should be active.
|
|
8
|
+
* @param {Function} [onClick] - The event handler for the click outside event.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useClickOutside: (el: RefObject<HTMLElement> | RefObject<HTMLElement>[], options?: {
|
|
11
|
+
active?: boolean | undefined;
|
|
12
|
+
} | ((ev: MouseEvent) => void), onClick?: ((ev: MouseEvent) => void) | undefined) => void;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type DebounceDirection = "in" | "out" | "both";
|
|
2
|
-
/**
|
|
3
|
-
* The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
|
|
4
|
-
*
|
|
5
|
-
* @param {any} value The value to set
|
|
6
|
-
* @param {number} delay The debounce time
|
|
7
|
-
* @param {"in" | "out" | "both"} direction Considers truthiness of value. If set to "in", the value will only be debounced if it is truthy. If set to "out", the value will only be debounced if it is falsy. If set to "both" or if not defined, the value will be debounced regardless of truthiness.
|
|
8
|
-
* @returns {any} The latest value received
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
*/
|
|
13
|
-
export declare const useDebounce: <T>(value: T, delay?: number, direction?: DebounceDirection) => T;
|
|
1
|
+
export type DebounceDirection = "in" | "out" | "both";
|
|
2
|
+
/**
|
|
3
|
+
* The useDebounce hook works like useState, but adds a delay where previous values will be ignored.
|
|
4
|
+
*
|
|
5
|
+
* @param {any} value The value to set
|
|
6
|
+
* @param {number} delay The debounce time
|
|
7
|
+
* @param {"in" | "out" | "both"} direction Considers truthiness of value. If set to "in", the value will only be debounced if it is truthy. If set to "out", the value will only be debounced if it is falsy. If set to "both" or if not defined, the value will be debounced regardless of truthiness.
|
|
8
|
+
* @returns {any} The latest value received
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const useDebounce: <T>(value: T, delay?: number, direction?: DebounceDirection) => T;
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export interface DevicePixelRatioOptions {
|
|
2
|
-
/**
|
|
3
|
-
* Default DPR to use if browser does not support the `devicePixelRatio`
|
|
4
|
-
* property, or when rendering on server
|
|
5
|
-
*
|
|
6
|
-
* @default `1`
|
|
7
|
-
* @returns DPR
|
|
8
|
-
*/
|
|
9
|
-
defaultDpr?: number;
|
|
10
|
-
/**
|
|
11
|
-
* Whether or not to round the number down to the closest integer
|
|
12
|
-
*
|
|
13
|
-
* @default `true`
|
|
14
|
-
*/
|
|
15
|
-
round?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* Maximum DPR to return (set to `2` to only generate 1 and 2)
|
|
18
|
-
*
|
|
19
|
-
* @default `3`
|
|
20
|
-
*/
|
|
21
|
-
maxDpr?: number;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Get the device pixel ratio, potentially rounded and capped.
|
|
25
|
-
* Will emit new values if it changes.
|
|
26
|
-
*
|
|
27
|
-
* @param {DevicePixelRatioOptions} options the options object
|
|
28
|
-
* @returns { number } The current device pixel ratio, or the default if none can be resolved
|
|
29
|
-
*/
|
|
30
|
-
export declare function useDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
31
|
-
/**
|
|
32
|
-
* Returns the current device pixel ratio (DPR) given the passed options
|
|
33
|
-
*
|
|
34
|
-
* @param { DevicePixelRatioOptions } options the options object
|
|
35
|
-
* @returns { number } current device pixel ratio
|
|
36
|
-
*/
|
|
37
|
-
export declare function getDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
1
|
+
export interface DevicePixelRatioOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Default DPR to use if browser does not support the `devicePixelRatio`
|
|
4
|
+
* property, or when rendering on server
|
|
5
|
+
*
|
|
6
|
+
* @default `1`
|
|
7
|
+
* @returns DPR
|
|
8
|
+
*/
|
|
9
|
+
defaultDpr?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Whether or not to round the number down to the closest integer
|
|
12
|
+
*
|
|
13
|
+
* @default `true`
|
|
14
|
+
*/
|
|
15
|
+
round?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Maximum DPR to return (set to `2` to only generate 1 and 2)
|
|
18
|
+
*
|
|
19
|
+
* @default `3`
|
|
20
|
+
*/
|
|
21
|
+
maxDpr?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the device pixel ratio, potentially rounded and capped.
|
|
25
|
+
* Will emit new values if it changes.
|
|
26
|
+
*
|
|
27
|
+
* @param {DevicePixelRatioOptions} options the options object
|
|
28
|
+
* @returns { number } The current device pixel ratio, or the default if none can be resolved
|
|
29
|
+
*/
|
|
30
|
+
export declare function useDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the current device pixel ratio (DPR) given the passed options
|
|
33
|
+
*
|
|
34
|
+
* @param { DevicePixelRatioOptions } options the options object
|
|
35
|
+
* @returns { number } current device pixel ratio
|
|
36
|
+
*/
|
|
37
|
+
export declare function getDevicePixelRatio(options?: DevicePixelRatioOptions): number;
|
package/src/hooks/useHover.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { DebounceDirection } from "./useDebounce";
|
|
2
|
-
type ConditionalUseHoverProps = {
|
|
3
|
-
debounced: true;
|
|
4
|
-
delay?: number;
|
|
5
|
-
direction?: DebounceDirection;
|
|
6
|
-
} | {
|
|
7
|
-
debounced: false;
|
|
8
|
-
delay?: never;
|
|
9
|
-
direction?: never;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* The useHover hook returns a onMouseEnter, onMouseLeave and a boolean indicating whether the element is being hovered.
|
|
13
|
-
* The boolean will be true if the element is being hovered, and false if it is not.
|
|
14
|
-
* Can be directionally debounced.
|
|
15
|
-
*
|
|
16
|
-
* @param {ConditionalUseHoverProps} param0 The options
|
|
17
|
-
* @returns {Object} The object containing the onMouseEnter, onMouseLeave and hovering props
|
|
18
|
-
*/
|
|
19
|
-
export declare const useHover: ({ debounced, delay, direction }?: ConditionalUseHoverProps) => {
|
|
20
|
-
onMouseEnter: () => void;
|
|
21
|
-
onMouseLeave: () => void;
|
|
22
|
-
hovering: boolean;
|
|
23
|
-
};
|
|
24
|
-
export {};
|
|
1
|
+
import { DebounceDirection } from "./useDebounce";
|
|
2
|
+
type ConditionalUseHoverProps = {
|
|
3
|
+
debounced: true;
|
|
4
|
+
delay?: number;
|
|
5
|
+
direction?: DebounceDirection;
|
|
6
|
+
} | {
|
|
7
|
+
debounced: false;
|
|
8
|
+
delay?: never;
|
|
9
|
+
direction?: never;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* The useHover hook returns a onMouseEnter, onMouseLeave and a boolean indicating whether the element is being hovered.
|
|
13
|
+
* The boolean will be true if the element is being hovered, and false if it is not.
|
|
14
|
+
* Can be directionally debounced.
|
|
15
|
+
*
|
|
16
|
+
* @param {ConditionalUseHoverProps} param0 The options
|
|
17
|
+
* @returns {Object} The object containing the onMouseEnter, onMouseLeave and hovering props
|
|
18
|
+
*/
|
|
19
|
+
export declare const useHover: ({ debounced, delay, direction }?: ConditionalUseHoverProps) => {
|
|
20
|
+
onMouseEnter: () => void;
|
|
21
|
+
onMouseLeave: () => void;
|
|
22
|
+
hovering: boolean;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Differentiate between the first and subsequent renders.
|
|
3
|
-
*
|
|
4
|
-
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
5
|
-
*/
|
|
6
|
-
export declare const useIsFirstRender: () => boolean;
|
|
1
|
+
/**
|
|
2
|
+
* Differentiate between the first and subsequent renders.
|
|
3
|
+
*
|
|
4
|
+
* @returns {boolean} Returns true if it is the first render, false otherwise.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useIsFirstRender: () => boolean;
|
package/src/hooks/useResize.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export interface WindowSize {
|
|
2
|
-
height: number;
|
|
3
|
-
width: number;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook to handle window resize events and provide the current window size.
|
|
7
|
-
*
|
|
8
|
-
* @returns {WindowSize} An object containing the current window height and width.
|
|
9
|
-
*/
|
|
10
|
-
export declare const useResize: () => WindowSize;
|
|
1
|
+
export interface WindowSize {
|
|
2
|
+
height: number;
|
|
3
|
+
width: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Custom hook to handle window resize events and provide the current window size.
|
|
7
|
+
*
|
|
8
|
+
* @returns {WindowSize} An object containing the current window height and width.
|
|
9
|
+
*/
|
|
10
|
+
export declare const useResize: () => WindowSize;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export type UseTimeoutReturn = [() => boolean | null, () => void, () => void];
|
|
2
|
-
interface UseTimeoutProps {
|
|
3
|
-
onTimeout: () => void;
|
|
4
|
-
duration: number;
|
|
5
|
-
}
|
|
6
|
-
/**
|
|
7
|
-
* @param {UseTimeoutProps} props The props
|
|
8
|
-
* @returns {{ startTimeout: () => void; stopTimeout: () => void; isReady: boolean | null}} return
|
|
9
|
-
*/
|
|
10
|
-
export declare const useTimeout: ({ onTimeout, duration }: UseTimeoutProps) => UseTimeoutReturn;
|
|
11
|
-
export {};
|
|
1
|
+
export type UseTimeoutReturn = [() => boolean | null, () => void, () => void];
|
|
2
|
+
interface UseTimeoutProps {
|
|
3
|
+
onTimeout: () => void;
|
|
4
|
+
duration: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* @param {UseTimeoutProps} props The props
|
|
8
|
+
* @returns {{ startTimeout: () => void; stopTimeout: () => void; isReady: boolean | null}} return
|
|
9
|
+
*/
|
|
10
|
+
export declare const useTimeout: ({ onTimeout, duration }: UseTimeoutProps) => UseTimeoutReturn;
|
|
11
|
+
export {};
|
package/src/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
export * from "./common";
|
|
2
|
-
export * from "./components";
|
|
3
|
-
export * from "./components/buttons/shared/Button.variants";
|
|
4
|
-
export * from "./components/Clickable/Clickable.variants";
|
|
5
|
-
export * from "./components/Indicator/Indicator.variants";
|
|
6
|
-
export * from "./
|
|
7
|
-
export * from "./
|
|
1
|
+
export * from "./common";
|
|
2
|
+
export * from "./components";
|
|
3
|
+
export * from "./components/buttons/shared/Button.variants";
|
|
4
|
+
export * from "./components/Clickable/Clickable.variants";
|
|
5
|
+
export * from "./components/Indicator/Indicator.variants";
|
|
6
|
+
export * from "./components/Menu/MenuItem/MenuItem.variants";
|
|
7
|
+
export * from "./hooks";
|
|
8
|
+
export * from "./layout";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
/**
|
|
4
|
-
* Pass two children. The first will be min-content and the second full height
|
|
5
|
-
* Useful when toy want the second child to have 100% height and be scrollable
|
|
6
|
-
* Example: FilterBar + Fleet List
|
|
7
|
-
*/
|
|
8
|
-
interface MinTopFullContentLayoutProps extends CommonProps {
|
|
9
|
-
children: ReactNode;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* The MinTopFullContentLayout component.
|
|
13
|
-
*
|
|
14
|
-
* @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
|
|
15
|
-
* @returns {JSX.Element} MinTopFullContentLayout component
|
|
16
|
-
*/
|
|
17
|
-
export declare const MinTopFullContentLayout: ({ children, className, dataTestId }: MinTopFullContentLayoutProps) => JSX.Element;
|
|
18
|
-
export {};
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
/**
|
|
4
|
+
* Pass two children. The first will be min-content and the second full height
|
|
5
|
+
* Useful when toy want the second child to have 100% height and be scrollable
|
|
6
|
+
* Example: FilterBar + Fleet List
|
|
7
|
+
*/
|
|
8
|
+
interface MinTopFullContentLayoutProps extends CommonProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The MinTopFullContentLayout component.
|
|
13
|
+
*
|
|
14
|
+
* @param {MinTopFullContentLayoutProps} props - The props for the MinTopFullContentLayout component
|
|
15
|
+
* @returns {JSX.Element} MinTopFullContentLayout component
|
|
16
|
+
*/
|
|
17
|
+
export declare const MinTopFullContentLayout: ({ children, className, dataTestId }: MinTopFullContentLayoutProps) => JSX.Element;
|
|
18
|
+
export {};
|
package/src/layout/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from "./helper/MinTopFullContentLayout";
|
|
2
|
-
export * from "./responsive/FilterListMapLayout";
|
|
3
|
-
export * from "./responsive/FullWidthRepeatingLayout";
|
|
4
|
-
export * from "./responsive/GridArea";
|
|
5
|
-
export * from "./responsive/IntrinsicallyResponsiveGrid";
|
|
6
|
-
export * from "./responsive/TitleNavContentLayout";
|
|
1
|
+
export * from "./helper/MinTopFullContentLayout";
|
|
2
|
+
export * from "./responsive/FilterListMapLayout";
|
|
3
|
+
export * from "./responsive/FullWidthRepeatingLayout";
|
|
4
|
+
export * from "./responsive/GridArea";
|
|
5
|
+
export * from "./responsive/IntrinsicallyResponsiveGrid";
|
|
6
|
+
export * from "./responsive/TitleNavContentLayout";
|
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
interface FilterListMapLayoutProps {
|
|
3
|
-
children: React.ReactNode;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Responsive layout component setting up three grid areas
|
|
7
|
-
* one for filtering, (result-)list and (result-map)
|
|
8
|
-
*
|
|
9
|
-
* List needs to handle its own min size - and map takes up the rest.
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
|
|
19
|
-
* @returns {JSX.Element} FilterListMapLayout component
|
|
20
|
-
*/
|
|
21
|
-
export declare const FilterListMapLayout: ({ children }: FilterListMapLayoutProps) => JSX.Element;
|
|
22
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface FilterListMapLayoutProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Responsive layout component setting up three grid areas
|
|
7
|
+
* one for filtering, (result-)list and (result-map)
|
|
8
|
+
*
|
|
9
|
+
* List needs to handle its own min size - and map takes up the rest.
|
|
10
|
+
*
|
|
11
|
+
* @param {FilterListMapLayoutProps} props - The props for the FilterListMapLayout component
|
|
12
|
+
* @returns {JSX.Element} FilterListMapLayout component
|
|
13
|
+
*/
|
|
14
|
+
export declare const FilterListMapLayout: ({ children }: FilterListMapLayoutProps) => JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
type RowSizing = "Equal" | "MinContent" | "Unmanaged";
|
|
3
|
-
interface FullWidthRepeatingLayoutProps {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
rowSizing?: RowSizing;
|
|
6
|
-
rowMinHeight?: number;
|
|
7
|
-
dataTestId?: string;
|
|
8
|
-
className?: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Layout component with repeating full width areas, default one height fraction each but option to use content height instead
|
|
12
|
-
* Row min height can optionally be set here or managed by children
|
|
13
|
-
* Scrolling happens if/when children's a min-height is reached
|
|
14
|
-
*
|
|
15
|
-
* @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
|
|
16
|
-
* @returns {JSX.Element} FullWidthRepeatingLayout component
|
|
17
|
-
*/
|
|
18
|
-
export declare const FullWidthRepeatingLayout: ({ children, rowSizing, rowMinHeight, dataTestId, className, }: FullWidthRepeatingLayoutProps) => JSX.Element;
|
|
19
|
-
export {};
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type RowSizing = "Equal" | "MinContent" | "Unmanaged";
|
|
3
|
+
interface FullWidthRepeatingLayoutProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
rowSizing?: RowSizing;
|
|
6
|
+
rowMinHeight?: number;
|
|
7
|
+
dataTestId?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Layout component with repeating full width areas, default one height fraction each but option to use content height instead
|
|
12
|
+
* Row min height can optionally be set here or managed by children
|
|
13
|
+
* Scrolling happens if/when children's a min-height is reached
|
|
14
|
+
*
|
|
15
|
+
* @param {FullWidthRepeatingLayoutProps} props - The props for the FullWidthRepeatingLayout component
|
|
16
|
+
* @returns {JSX.Element} FullWidthRepeatingLayout component
|
|
17
|
+
*/
|
|
18
|
+
export declare const FullWidthRepeatingLayout: ({ children, rowSizing, rowMinHeight, dataTestId, className, }: FullWidthRepeatingLayoutProps) => JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
-
export interface GridAreaProps extends CommonProps {
|
|
4
|
-
area: string;
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Simply applies a Grid Area to the element
|
|
9
|
-
*
|
|
10
|
-
* @param {GridAreaProps} props - The props for the GridArea component
|
|
11
|
-
* @returns {JSX.Element} GridArea component
|
|
12
|
-
*/
|
|
13
|
-
export declare const GridArea: ({ area, dataTestId, className, children }: GridAreaProps) => JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CommonProps } from "../../common/CommonProps";
|
|
3
|
+
export interface GridAreaProps extends CommonProps {
|
|
4
|
+
area: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Simply applies a Grid Area to the element
|
|
9
|
+
*
|
|
10
|
+
* @param {GridAreaProps} props - The props for the GridArea component
|
|
11
|
+
* @returns {JSX.Element} GridArea component
|
|
12
|
+
*/
|
|
13
|
+
export declare const GridArea: ({ area, dataTestId, className, children }: GridAreaProps) => JSX.Element;
|