@trackunit/react-components 1.10.55 → 1.10.56

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 (46) hide show
  1. package/index.cjs.js +4334 -3923
  2. package/index.esm.js +4329 -3925
  3. package/package.json +8 -7
  4. package/src/components/Breadcrumb/utils/types.d.ts +1 -1
  5. package/src/components/Card/CardBody.d.ts +2 -1
  6. package/src/components/Card/CardFooter.d.ts +2 -1
  7. package/src/components/Card/CardHeader.d.ts +2 -1
  8. package/src/components/CopyableText/CopyableText.d.ts +1 -1
  9. package/src/components/EmptyState/EmptyState.d.ts +1 -1
  10. package/src/components/ExternalLink/ExternalLink.d.ts +1 -1
  11. package/src/components/Highlight/Highlight.d.ts +2 -1
  12. package/src/components/Icon/Icon.d.ts +2 -1
  13. package/src/components/KPI/KPI.d.ts +2 -1
  14. package/src/components/List/useList.d.ts +1 -1
  15. package/src/components/Menu/MenuItem/MenuItem.d.ts +1 -1
  16. package/src/components/Menu/MenuList/MenuList.d.ts +1 -1
  17. package/src/components/Page/Page.d.ts +1 -1
  18. package/src/components/Page/PageContent.d.ts +1 -1
  19. package/src/components/PageHeader/components/PageHeaderTitle.d.ts +1 -1
  20. package/src/components/PageHeader/types.d.ts +1 -1
  21. package/src/components/Popover/PopoverContent.d.ts +1 -1
  22. package/src/components/Popover/PopoverTypes.d.ts +1 -1
  23. package/src/components/Spacer/Spacer.d.ts +2 -1
  24. package/src/components/Tag/Tag.d.ts +2 -1
  25. package/src/components/Text/Text.d.ts +2 -1
  26. package/src/components/Tooltip/Tooltip.d.ts +2 -1
  27. package/src/components/ValueBar/ValueBar.d.ts +2 -1
  28. package/src/components/buttons/Button/Button.d.ts +1 -1
  29. package/src/components/buttons/IconButton/IconButton.d.ts +1 -1
  30. package/src/components/buttons/shared/ButtonProps.d.ts +2 -1
  31. package/src/hooks/encoding/useCustomEncoding.d.ts +14 -0
  32. package/src/hooks/localStorage/initLocalStorageState.d.ts +9 -0
  33. package/src/hooks/localStorage/setLocalStorage.d.ts +11 -0
  34. package/src/hooks/localStorage/types.d.ts +27 -0
  35. package/src/hooks/localStorage/useLocalStorage.d.ts +10 -0
  36. package/src/hooks/localStorage/useLocalStorageEffect.d.ts +12 -0
  37. package/src/hooks/localStorage/useLocalStorageReducer.d.ts +13 -0
  38. package/src/hooks/localStorage/validateState.d.ts +13 -0
  39. package/src/hooks/useCopyToClipboard.d.ts +6 -0
  40. package/src/hooks/usePrevious.d.ts +8 -0
  41. package/src/hooks/useTextSearch.d.ts +13 -0
  42. package/src/hooks/useWatch.d.ts +20 -0
  43. package/src/index.d.ts +91 -3
  44. package/src/common/index.d.ts +0 -7
  45. package/src/components/index.d.ts +0 -53
  46. package/src/hooks/index.d.ts +0 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.10.55",
3
+ "version": "1.10.56",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -10,18 +10,19 @@
10
10
  "@radix-ui/react-slot": "^1.2.3",
11
11
  "@radix-ui/react-tabs": "^1.1.13",
12
12
  "react": "19.0.0",
13
- "usehooks-ts": "^3.1.0",
14
13
  "react-helmet-async": "^1.3.0",
15
14
  "@floating-ui/react": "^0.26.25",
16
15
  "string-ts": "^2.0.0",
17
16
  "tailwind-merge": "^2.0.0",
18
- "@trackunit/ui-design-tokens": "1.7.80",
19
- "@trackunit/css-class-variance-utilities": "1.7.80",
20
- "@trackunit/shared-utils": "1.9.80",
21
- "@trackunit/ui-icons": "1.7.81",
17
+ "@trackunit/ui-design-tokens": "1.7.81",
18
+ "@trackunit/css-class-variance-utilities": "1.7.81",
19
+ "@trackunit/shared-utils": "1.9.81",
20
+ "@trackunit/ui-icons": "1.7.82",
22
21
  "@tanstack/react-router": "1.114.29",
23
22
  "es-toolkit": "^1.39.10",
24
- "@tanstack/react-virtual": "3.13.12"
23
+ "@tanstack/react-virtual": "3.13.12",
24
+ "fflate": "^0.8.2",
25
+ "zod": "^3.23.8"
25
26
  },
26
27
  "module": "./index.esm.js",
27
28
  "main": "./index.cjs.js",
@@ -1,4 +1,4 @@
1
- import { CommonProps } from "../../../common";
1
+ import { CommonProps } from "../../../common/CommonProps";
2
2
  export interface BreadcrumbItemProps {
3
3
  label: string;
4
4
  to: string;
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
- import { CommonProps, Density } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Density } from "../../common/Density";
3
4
  export interface CardBodyProps extends CommonProps {
4
5
  /**
5
6
  * Sets gap, padding and margin.
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
- import { CommonProps, Density } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Density } from "../../common/Density";
3
4
  export interface CardFooterProps extends CommonProps {
4
5
  /**
5
6
  * Sets gap, padding and margin.
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
- import { CommonProps, Density } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Density } from "../../common/Density";
3
4
  import { HeadingVariant } from "../Heading/Heading";
4
5
  export interface CardHeaderProps extends CommonProps {
5
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
3
  export interface CopyableTextProps extends CommonProps {
4
4
  /**
5
5
  * The text shown in the ui.
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
3
  type EmptyStateImage = "WORKER_WITH_SIGN" | "ROAD_BLOCK" | "BUILDING_ERROR" | "WALL_CONSTRUCTION" | "PHONE_LOCK_SECURITY" | "SEARCH_DOCUMENT";
4
4
  type EmptyStateButtonAction = {
5
5
  disabled?: boolean;
@@ -1,5 +1,5 @@
1
1
  import { MouseEvent, ReactElement, ReactNode } from "react";
2
- import { CommonProps } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
3
  export interface ExternalLinkProps extends CommonProps {
4
4
  /**
5
5
  * The URL to which users are redirected
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode, Ref } from "react";
2
- import { CommonProps, Size } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Size } from "../../common/Size";
3
4
  export type HighlightSize = Extract<Size, "small" | "medium">;
4
5
  export interface HighlightProps extends CommonProps {
5
6
  /**
@@ -1,8 +1,9 @@
1
1
  import { ActivityColors, CriticalityColors, GeneralColors, IntentColors, RentalStatusColors, SitesColors, UtilizationColors } from "@trackunit/ui-design-tokens";
2
2
  import { IconName } from "@trackunit/ui-icons";
3
3
  import { CSSProperties, ReactElement } from "react";
4
- import { CommonProps, Size } from "../../common";
5
4
  import { AriaProps } from "../../common/AriaProps";
5
+ import { CommonProps } from "../../common/CommonProps";
6
+ import { Size } from "../../common/Size";
6
7
  export type IconColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors | UtilizationColors | SitesColors | RentalStatusColors;
7
8
  export declare const iconPalette: {
8
9
  ON_RENT: {
@@ -1,5 +1,6 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps, Styleable } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Styleable } from "../../common/Styleable";
3
4
  export interface KPIProps extends CommonProps, Styleable {
4
5
  /**
5
6
  * The title of the KPI
@@ -1,6 +1,6 @@
1
1
  import type { VirtualItem, Virtualizer } from "@tanstack/react-virtual";
2
2
  import { ReactElement, RefObject } from "react";
3
- import { RelayPagination } from "../../hooks";
3
+ import { RelayPagination } from "../../hooks/useRelayPagination";
4
4
  import { ListLoadingIndicatorProps } from "./ListLoadingIndicator";
5
5
  declare const DEFAULT_LOADING_INDICATOR_CONFIG: Extract<ListLoadingIndicatorProps, {
6
6
  type: "skeleton";
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from "@trackunit/css-class-variance-utilities";
2
2
  import { MouseEventHandler, ReactElement, ReactNode } from "react";
3
- import { CommonProps } from "../../../common";
3
+ import { CommonProps } from "../../../common/CommonProps";
4
4
  import { cvaMenuItemStyle } from "./MenuItem.variants";
5
5
  export type MenuItemVariant = "primary" | "danger";
6
6
  export interface MenuItemProps extends CommonProps {
@@ -1,5 +1,5 @@
1
1
  import { ReactElement, ReactNode } from "react";
2
- import { CommonProps } from "../../../common";
2
+ import { CommonProps } from "../../../common/CommonProps";
3
3
  export interface MenuListProps extends CommonProps {
4
4
  /**
5
5
  * List of menu items to be rendered.
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from "@trackunit/css-class-variance-utilities";
2
2
  import { ReactElement, ReactNode } from "react";
3
- import { CommonProps } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
4
  import { cvaPage } from "./Page.variants";
5
5
  /**
6
6
  * The layout of the page.
@@ -1,6 +1,6 @@
1
1
  import { VariantProps } from "@trackunit/css-class-variance-utilities";
2
2
  import { ReactElement, ReactNode } from "react";
3
- import { CommonProps } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
4
  import { cvaPageContent } from "./Page.variants";
5
5
  /**
6
6
  * The layout of the page.
@@ -1,5 +1,5 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps } from "../../../common";
2
+ import { CommonProps } from "../../../common/CommonProps";
3
3
  interface PageHeaderTitleProps extends CommonProps {
4
4
  /**
5
5
  * The title of the page header
@@ -1,6 +1,6 @@
1
1
  import { IconName } from "@trackunit/ui-icons";
2
2
  import { ReactElement, ReactNode } from "react";
3
- import { CommonProps } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
4
  import { ButtonVariant } from "../buttons";
5
5
  import { TabListProps } from "../Tabs/TabList";
6
6
  import { TagColors } from "../Tag";
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps, ReactElement, ReactNode, Ref } from "react";
2
- import { CommonProps } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
3
  export type PopoverContentChildren = ((close: () => void) => ReactNode) | ReactNode;
4
4
  export interface PopoverContentProps extends Omit<HTMLProps<HTMLDivElement>, "children">, CommonProps {
5
5
  /**
@@ -1,6 +1,6 @@
1
1
  import { ExtendedRefs, ReferenceType, UseDismissProps, UseFloatingReturn } from "@floating-ui/react";
2
2
  import { Dispatch, HTMLProps, SetStateAction } from "react";
3
- import { CommonProps } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
4
  export type PopoverActivation = {
5
5
  click?: boolean;
6
6
  hover?: boolean;
@@ -1,5 +1,6 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps, Size } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Size } from "../../common/Size";
3
4
  export interface SpacerProps extends CommonProps {
4
5
  /**
5
6
  * The minimum height of the spacer. Defaults to 1px.
@@ -1,6 +1,7 @@
1
1
  import { ActivityColors, CriticalityColors, GeneralColors, IntentColors } from "@trackunit/ui-design-tokens";
2
2
  import { MouseEventHandler, ReactElement, ReactNode, Ref } from "react";
3
- import { CommonProps, Size } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
+ import { Size } from "../../common/Size";
4
5
  export type TagSize = Extract<Size, "small" | "medium">;
5
6
  export type TagColors = IntentColors | GeneralColors | CriticalityColors | ActivityColors;
6
7
  export interface TagProps extends CommonProps {
@@ -1,5 +1,6 @@
1
1
  import { ReactElement, ReactNode, Ref } from "react";
2
- import { CommonProps, Size } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Size } from "../../common/Size";
3
4
  export type TextType = "p" | "span" | "div";
4
5
  export type TextAlign = "left" | "center" | "right";
5
6
  export type TextWeight = "normal" | "thick" | "bold";
@@ -1,6 +1,7 @@
1
1
  import { Placement } from "@floating-ui/react";
2
2
  import { ReactElement, ReactNode } from "react";
3
- import { CommonProps, Styleable } from "../../common";
3
+ import { CommonProps } from "../../common/CommonProps";
4
+ import { Styleable } from "../../common/Styleable";
4
5
  import { IconProps } from "../Icon/Icon";
5
6
  export type TooltipPlacement = Placement | "auto";
6
7
  export interface TooltipProps extends CommonProps, Styleable {
@@ -1,5 +1,6 @@
1
1
  import { ReactElement } from "react";
2
- import { CommonProps, Size } from "../../common";
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ import { Size } from "../../common/Size";
3
4
  import { LevelColors } from "./ValueBarTypes";
4
5
  type ValueBarSize = Extract<Size, "small" | "large"> | "extraSmall";
5
6
  export interface ValueBarProps extends CommonProps {
@@ -1,5 +1,5 @@
1
1
  import { MouseEvent, ReactElement, ReactNode, Ref } from "react";
2
- import { Size } from "../../../common";
2
+ import { Size } from "../../../common/Size";
3
3
  import { ButtonCommonProps, ButtonType } from "../shared/ButtonProps";
4
4
  export interface ButtonProps extends Omit<ButtonCommonProps, "size"> {
5
5
  onClick?: (event: MouseEvent<HTMLElement>) => void;
@@ -1,6 +1,6 @@
1
1
  import { MappedOmit } from "@trackunit/shared-utils";
2
2
  import { ComponentType, JSX, ReactElement, ReactNode, Ref } from "react";
3
- import { Size } from "../../../common";
3
+ import { Size } from "../../../common/Size";
4
4
  import { ButtonCommonProps } from "../shared/ButtonProps";
5
5
  export interface IconButtonProps extends MappedOmit<ButtonCommonProps, "size"> {
6
6
  /**
@@ -1,4 +1,5 @@
1
- import { CommonProps, Size } from "../../../common";
1
+ import { CommonProps } from "../../../common/CommonProps";
2
+ import { Size } from "../../../common/Size";
2
3
  export type ButtonVariant = "primary" | "secondary" | "primary-danger" | "secondary-danger" | "ghost" | "ghost-neutral" | "filled";
3
4
  export type ButtonType = "button" | "submit";
4
5
  export interface ButtonCommonProps extends CommonProps {
@@ -0,0 +1,14 @@
1
+ export interface UseCustomEncodingReturn {
2
+ encode: (input: string | object | Array<object>) => string;
3
+ decode: (str: string) => object | Array<object> | string;
4
+ }
5
+ /**
6
+ * React hook for safe base64 encoding/decoding with UTF-8 support and compression
7
+ *
8
+ * This hook provides callbacks for safely encoding and decoding objects/strings to/from base64
9
+ * with proper Unicode character support (including Japanese, Chinese, etc.) and automatic
10
+ * compression for better performance with large objects.
11
+ *
12
+ * @returns { { encode: (input: unknown) => string, decode: (str: string) => JSON | string } } Object containing encode and decode callback functions
13
+ */
14
+ export declare const useCustomEncoding: () => UseCustomEncodingReturn;
@@ -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 TState - The type of the state stored in local storage.
6
+ * @param {Omit<LocalStorageParams<TState>, "state">} params - The parameters for initializing the local storage state.
7
+ * @returns {TState} - The initialized state.
8
+ */
9
+ export declare const initLocalStorageState: <TState>({ key, defaultState, schema, }: Omit<LocalStorageParams<TState>, "state">) => TState;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Sets a value in the local storage with the specified key.
3
+ * Thin wrapper around localStorage.setItem() that is slightly more type safe
4
+ * Stringifies value automatically.
5
+ * Useful if you for some reason can't use the useLocalStorage hook for React lifecycle reasons
6
+ *
7
+ * @template TValue - The type of value to be stored.
8
+ * @param {string} key - The key under which to store the value.
9
+ * @param {TValue} value - The value to store in the local storage.
10
+ */
11
+ export declare const setLocalStorage: <TValue>(key: string, value: TValue) => void;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ export interface LocalStorageParams<TState> {
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: TState;
11
+ /**
12
+ * Optional schema for validating the state.
13
+ */
14
+ schema?: z.Schema<TState>;
15
+ }
16
+ export interface LocalStorageCallbacks<TState> {
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?: (data: TState) => 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 TState - The type of the value stored in local storage.
7
+ * @param {Omit<LocalStorageParams<TState>, "state"> & LocalStorageCallbacks} options - The options for useLocalStorage.
8
+ * @returns {[TState, Dispatch<SetStateAction<TState>>, () => 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: <TState>({ key, defaultState, schema, onValidationFailed, onValidationSuccessful, }: LocalStorageParams<TState> & LocalStorageCallbacks<TState>) => [TState, Dispatch<SetStateAction<TState>>, () => void];
@@ -0,0 +1,12 @@
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 TState - The type of the state variable.
7
+ * @param {LocalStorageParams<TState> & LocalStorageCallbacks & { state: TState }} params - The parameters for the useLocalStorageEffect hook.
8
+ * @returns {void}
9
+ */
10
+ export declare const useLocalStorageEffect: <TState>({ key, state, defaultState, schema, onValidationFailed, onValidationSuccessful, }: LocalStorageParams<TState> & LocalStorageCallbacks<TState> & {
11
+ state: TState;
12
+ }) => 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 TState - The type of the state.
7
+ * @template TAction - The type of the action.
8
+ * @param {LocalStorageParams<TState> & LocalStorageCallbacks} params - The parameters for the useLocalStorageReducer function.
9
+ * @returns {[TState, Dispatch<TAction>]} - A tuple containing the state and the dispatch function.
10
+ */
11
+ export declare const useLocalStorageReducer: <TState, TAction>({ key, defaultState, reducer, schema, onValidationFailed, onValidationSuccessful, }: {
12
+ reducer: (state: TState, action: TAction) => TState;
13
+ } & LocalStorageParams<TState> & LocalStorageCallbacks<TState>) => [TState, Dispatch<TAction>];
@@ -0,0 +1,13 @@
1
+ import { LocalStorageCallbacks, LocalStorageParams } from "./types";
2
+ type ValidateStateOptions<TState> = Required<Pick<LocalStorageParams<TState>, "schema">> & {
3
+ state: TState;
4
+ defaultState: TState;
5
+ } & LocalStorageCallbacks<TState>;
6
+ /**
7
+ * Validates the state object using a Zod schema.
8
+ *
9
+ * @template TState - The type of the state.
10
+ * @param {ValidateStateOptions<TState>} params - The parameters for the validateState function.
11
+ */
12
+ export declare const validateState: <TState>(params: ValidateStateOptions<TState>) => TState;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ export type CopyToClipboardResult = [boolean, (text: string) => Promise<void>];
2
+ /**
3
+ * Custom hook for copying text to clipboard with Chrome compatibility
4
+ * Uses modern Clipboard API with fallback to execCommand for older browsers
5
+ */
6
+ export declare const useCopyToClipboard: () => CopyToClipboardResult;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * The usePrevious hook is a useful tool for tracking the previous value of a variable in a functional component. This can be particularly handy in scenarios where it is necessary to compare the current value with the previous one, such as triggering actions or rendering based on changes.
3
+ *
4
+ * @example
5
+ * const [color, setColor] = React.useState(getRandomColor());
6
+ const previousColor = usePrevious(color);
7
+ */
8
+ export declare const usePrevious: <TValue>(value: TValue) => TValue | undefined;
@@ -0,0 +1,13 @@
1
+ import { Maybe } from "@trackunit/shared-utils";
2
+ import { Dispatch } from "react";
3
+ /**
4
+ * Hook for filtering a list of items by text search, client side search in a list.
5
+ *
6
+ * @template TSearchableItem
7
+ * @param items The list of items to filter.
8
+ * @param props The properties to search in each item.
9
+ * @returns {[TSearchableItem[], string, Dispatch<string>]} A tuple with the filtered items, the search text and a setter for the search text.
10
+ * @example
11
+ * const [result, searchText, setSearchText] = useTextSearch(items, item => [item.name, item.description]);
12
+ */
13
+ export declare function useTextSearch<TSearchableItem>(items: Array<TSearchableItem>, props: (item: TSearchableItem) => Array<Maybe<string> | undefined>): [Array<TSearchableItem>, string, Dispatch<string>];
@@ -0,0 +1,20 @@
1
+ interface UseWatchOptions {
2
+ immediate?: boolean;
3
+ skip?: boolean;
4
+ }
5
+ interface UseWatchProps<TValue> extends UseWatchOptions {
6
+ value: TValue;
7
+ onChange: (value: TValue, prevValue: TValue | null) => void;
8
+ }
9
+ /**
10
+ * Hook to watch for changes in a value and react to them.
11
+ * Uses deep equality comparison via es-toolkit's isEqual.
12
+ *
13
+ * @param props - The hook properties
14
+ * @param props.value - The value to watch for changes
15
+ * @param props.onChange - Function to call when the value changes
16
+ * @param props.immediate - Whether to run the callback immediately on mount (default: false)
17
+ * @param props.skip - Whether to skip watching for changes (default: false)
18
+ */
19
+ export declare const useWatch: <TValue>({ value, onChange, immediate, skip }: UseWatchProps<TValue>) => void;
20
+ export {};
package/src/index.d.ts CHANGED
@@ -1,10 +1,98 @@
1
- export * from "./common";
1
+ export * from "./common/AllOrNone";
2
+ export * from "./common/AriaProps";
3
+ export * from "./common/CommonProps";
4
+ export * from "./common/Density";
2
5
  export * from "./common/PackageNameStoryComponent";
3
- export * from "./components";
6
+ export * from "./common/Size";
7
+ export * from "./common/StorybookProps";
8
+ export * from "./common/Styleable";
9
+ export * from "./components/Alert";
10
+ export * from "./components/Badge";
11
+ export * from "./components/Breadcrumb/Breadcrumb";
12
+ export * from "./components/buttons";
4
13
  export * from "./components/buttons/shared/Button.variants";
14
+ export * from "./components/Card";
5
15
  export * from "./components/Clickable/Clickable.variants";
16
+ export * from "./components/Collapse";
17
+ export * from "./components/CompletionStatusIndicator/CompletionStatusIndicator";
18
+ export * from "./components/CopyableText";
19
+ export * from "./components/DetailsList/DetailsList";
20
+ export * from "./components/EmptyState/EmptyState";
21
+ export * from "./components/EmptyState/EmptyState.variants";
22
+ export * from "./components/EmptyValue/EmptyValue";
23
+ export * from "./components/ExternalLink/ExternalLink";
24
+ export * from "./components/Heading";
25
+ export * from "./components/Highlight/Highlight";
26
+ export * from "./components/HorizontalOverflowScroller/HorizontalOverflowScroller";
27
+ export * from "./components/Icon/Icon";
28
+ export * from "./components/Indicator";
6
29
  export * from "./components/Indicator/Indicator.variants";
7
30
  export * from "./components/InteractableItem/InteractableItem.variants";
31
+ export * from "./components/KPI/KPI";
32
+ export * from "./components/KPICard/KPICard";
33
+ export * from "./components/List/List";
34
+ export * from "./components/List/List.variants";
35
+ export * from "./components/List/useList";
36
+ export * from "./components/ListItem/ListItem";
37
+ export * from "./components/ListItem/useListItemHeight";
38
+ export * from "./components/Menu";
8
39
  export * from "./components/Menu/MenuItem/MenuItem.variants";
9
40
  export * from "./components/Menu/MenuList/MenuList.variants";
10
- export * from "./hooks";
41
+ export * from "./components/Notice";
42
+ export * from "./components/Page";
43
+ export * from "./components/PageHeader";
44
+ export * from "./components/Pagination/Pagination";
45
+ export * from "./components/Polygon/Polygon";
46
+ export * from "./components/Popover";
47
+ export * from "./components/Popover/Popover";
48
+ export * from "./components/Portal/Portal";
49
+ export * from "./components/Prompt";
50
+ export * from "./components/SectionHeader";
51
+ export * from "./components/Sidebar/Sidebar";
52
+ export * from "./components/Sidebar/useOverflowItems";
53
+ export * from "./components/SkeletonLines";
54
+ export * from "./components/Spacer";
55
+ export * from "./components/Spinner";
56
+ export * from "./components/Tabs/Tab";
57
+ export * from "./components/Tabs/TabContent";
58
+ export * from "./components/Tabs/TabList";
59
+ export * from "./components/Tabs/Tabs";
60
+ export * from "./components/Tag";
61
+ export * from "./components/Text";
62
+ export * from "./components/ToggleGroup/ToggleGroup";
63
+ export * from "./components/ToggleGroup/ToggleGroup.variants";
64
+ export * from "./components/Tooltip";
65
+ export * from "./components/ValueBar";
66
+ export * from "./components/ZStack/ZStack";
67
+ export * from "./components/ZStack/ZStack.variants";
68
+ export * from "./hooks/encoding/useCustomEncoding";
69
+ export * from "./hooks/localStorage/useLocalStorage";
70
+ export * from "./hooks/localStorage/useLocalStorageReducer";
71
+ export * from "./hooks/noPagination";
72
+ export * from "./hooks/useClickOutside";
73
+ export * from "./hooks/useContainerBreakpoints";
74
+ export * from "./hooks/useContinuousTimeout";
75
+ export * from "./hooks/useCopyToClipboard";
76
+ export * from "./hooks/useDebounce";
77
+ export * from "./hooks/useDevicePixelRatio";
78
+ export * from "./hooks/useElevatedReducer";
79
+ export * from "./hooks/useElevatedState";
80
+ export * from "./hooks/useHover";
81
+ export * from "./hooks/useInfiniteScroll";
82
+ export * from "./hooks/useIsFirstRender";
83
+ export * from "./hooks/useIsFullScreen";
84
+ export * from "./hooks/useIsTextTruncated";
85
+ export * from "./hooks/useMeasure";
86
+ export * from "./hooks/useMergeRefs";
87
+ export * from "./hooks/useModifierKey";
88
+ export * from "./hooks/usePrevious";
89
+ export * from "./hooks/useRelayPagination";
90
+ export * from "./hooks/useResize";
91
+ export * from "./hooks/useScrollBlock";
92
+ export * from "./hooks/useScrollDetection";
93
+ export * from "./hooks/useSelfUpdatingRef";
94
+ export * from "./hooks/useTextSearch";
95
+ export * from "./hooks/useTimeout";
96
+ export * from "./hooks/useViewportBreakpoints";
97
+ export * from "./hooks/useWatch";
98
+ export * from "./hooks/useWindowActivity";
@@ -1,7 +0,0 @@
1
- export * from "./AllOrNone";
2
- export * from "./AriaProps";
3
- export * from "./CommonProps";
4
- export * from "./Density";
5
- export * from "./Size";
6
- export * from "./StorybookProps";
7
- export * from "./Styleable";
@@ -1,53 +0,0 @@
1
- export * from "./Alert";
2
- export * from "./Badge";
3
- export * from "./Breadcrumb/Breadcrumb";
4
- export * from "./buttons";
5
- export * from "./Card";
6
- export * from "./Collapse";
7
- export * from "./CompletionStatusIndicator/CompletionStatusIndicator";
8
- export * from "./CopyableText";
9
- export * from "./DetailsList/DetailsList";
10
- export * from "./EmptyState/EmptyState";
11
- export * from "./EmptyState/EmptyState.variants";
12
- export * from "./EmptyValue/EmptyValue";
13
- export * from "./ExternalLink/ExternalLink";
14
- export * from "./Heading";
15
- export * from "./Highlight/Highlight";
16
- export * from "./HorizontalOverflowScroller/HorizontalOverflowScroller";
17
- export * from "./Icon/Icon";
18
- export * from "./Indicator";
19
- export * from "./KPI/KPI";
20
- export * from "./KPICard/KPICard";
21
- export * from "./List/List";
22
- export * from "./List/List.variants";
23
- export * from "./List/useList";
24
- export * from "./ListItem/useListItemHeight";
25
- export * from "./ListItem/ListItem";
26
- export * from "./Menu";
27
- export * from "./Notice";
28
- export * from "./Page";
29
- export * from "./PageHeader";
30
- export * from "./Pagination/Pagination";
31
- export * from "./Polygon/Polygon";
32
- export * from "./Popover";
33
- export * from "./Popover/Popover";
34
- export * from "./Portal/Portal";
35
- export * from "./Prompt";
36
- export * from "./SectionHeader";
37
- export * from "./Sidebar/Sidebar";
38
- export * from "./Sidebar/useOverflowItems";
39
- export * from "./SkeletonLines";
40
- export * from "./Spacer";
41
- export * from "./Spinner";
42
- export * from "./Tabs/Tab";
43
- export * from "./Tabs/TabContent";
44
- export * from "./Tabs/TabList";
45
- export * from "./Tabs/Tabs";
46
- export * from "./Tag";
47
- export * from "./Text";
48
- export * from "./ToggleGroup/ToggleGroup";
49
- export * from "./ToggleGroup/ToggleGroup.variants";
50
- export * from "./Tooltip";
51
- export * from "./ValueBar";
52
- export * from "./ZStack/ZStack";
53
- export * from "./ZStack/ZStack.variants";