@wavv/ui 1.8.21 → 1.9.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.
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from 'react';
2
+ import { Margin } from './types';
3
+ type TabItem = {
4
+ id: string | number;
5
+ label: ReactNode;
6
+ };
7
+ type Props<ItemType> = {
8
+ /** The tab items to be rendered */
9
+ items: ItemType[];
10
+ /** The id of the active tab */
11
+ activeItem: string | number;
12
+ /** Controls whether the tabs fill the space of the container */
13
+ itemWidth?: 'auto' | 'fill';
14
+ /** The gap between each tab item */
15
+ itemGap?: string | number;
16
+ /** The function called with the tab item after the tab is changed */
17
+ onChange: (tab: ItemType) => void;
18
+ } & Margin;
19
+ declare const Tabs: <ItemType extends TabItem>({ items, activeItem, itemWidth, itemGap, onChange, ...props }: Props<ItemType>) => import("react/jsx-runtime").JSX.Element;
20
+ export default Tabs;
@@ -4,3 +4,4 @@ export { default as useSelectAll } from './useSelectAll';
4
4
  export { default as useEventListener } from './useEventListener';
5
5
  export { default as useSelect } from './useSelect';
6
6
  export { default as useElementObserver } from './useElementObserver';
7
+ export { default as usePrevious } from './usePrevious';
@@ -0,0 +1,2 @@
1
+ declare const usePrevious: <T>(value: T) => T;
2
+ export default usePrevious;
@@ -39,6 +39,7 @@ export { default as TransferList } from './components/TransferList';
39
39
  export { default as Table } from './components/Table';
40
40
  export { default as Toggle } from './components/Toggle';
41
41
  export { default as Tooltip } from './components/Tooltip';
42
+ export { default as Tabs } from './components/Tabs';
42
43
  export { default as theme } from './theme';
43
44
  export type { ITheme, ThemeProp } from './theme/ThemeTypes';
44
45
  export type { IconNames } from './components/Icon/icons';
@@ -52,6 +53,7 @@ export { default as useSelectAll } from './hooks/useSelectAll';
52
53
  export { default as useWindowSize } from './hooks/useWindowSize';
53
54
  export { default as useConfirm } from './hooks/useConfirm';
54
55
  export { default as useElementObserver } from './hooks/useElementObserver';
56
+ export { default as usePrevious } from './hooks/usePrevious';
55
57
  export { default as formatDate } from './utils/formatDate';
56
58
  export { default as copyToClipboard } from './utils/copyToClipboard';
57
59
  export { default as numberWithCommas } from './utils/numberWithCommas';
package/build/index.d.ts CHANGED
@@ -675,7 +675,7 @@ type ChartProps = {
675
675
  responsive?: boolean;
676
676
  } & Margin & WidthHeight & MaxWidthHeight;
677
677
 
678
- type Props$2 = {
678
+ type Props$3 = {
679
679
  /** Stacks multiple data points within a single bar */
680
680
  stacked?: boolean;
681
681
  /** Orients the bars outward from the Y axis */
@@ -697,7 +697,7 @@ type Props$2 = {
697
697
  /** The width of the Y axis */
698
698
  yAxisWidth?: number;
699
699
  } & ChartProps;
700
- declare const BarChart: ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize, maxBarSize, vertical, hideYLabels, hideXLabels, xAxisHeight, yAxisWidth, ...rest }: Props$2) => react_jsx_runtime.JSX.Element;
700
+ declare const BarChart: ({ data, legend, keys, stacked, barGap, barCategoryGap, barSize, maxBarSize, vertical, hideYLabels, hideXLabels, xAxisHeight, yAxisWidth, ...rest }: Props$3) => react_jsx_runtime.JSX.Element;
701
701
 
702
702
  type OptionItem = {
703
703
  id: number | string;
@@ -2313,7 +2313,7 @@ type ChartData = {
2313
2313
  value: number;
2314
2314
  color?: string;
2315
2315
  };
2316
- type Props$1 = {
2316
+ type Props$2 = {
2317
2317
  /** The chart data array */
2318
2318
  data: ChartData[];
2319
2319
  /** The width & height of the chart */
@@ -2323,7 +2323,7 @@ type Props$1 = {
2323
2323
  /** Displays a gray chart if no data is present */
2324
2324
  showWhenEmpty?: boolean;
2325
2325
  } & Margin;
2326
- declare const PieChart: ({ size, data, innerRadius, showWhenEmpty, ...rest }: Props$1) => react_jsx_runtime.JSX.Element;
2326
+ declare const PieChart: ({ size, data, innerRadius, showWhenEmpty, ...rest }: Props$2) => react_jsx_runtime.JSX.Element;
2327
2327
 
2328
2328
  type CircleProps = ({
2329
2329
  circle?: false;
@@ -2530,6 +2530,24 @@ type ToggleProps = {
2530
2530
  } & Margin & As & CheckboxAttributes;
2531
2531
  declare const Toggle: ({ id, label, labelPosition, checked, disabled, onChange, margin, marginTop, marginBottom, marginRight, marginLeft, ...props }: ToggleProps) => react_jsx_runtime.JSX.Element;
2532
2532
 
2533
+ type TabItem = {
2534
+ id: string | number;
2535
+ label: ReactNode;
2536
+ };
2537
+ type Props$1<ItemType> = {
2538
+ /** The tab items to be rendered */
2539
+ items: ItemType[];
2540
+ /** The id of the active tab */
2541
+ activeItem: string | number;
2542
+ /** Controls whether the tabs fill the space of the container */
2543
+ itemWidth?: 'auto' | 'fill';
2544
+ /** The gap between each tab item */
2545
+ itemGap?: string | number;
2546
+ /** The function called with the tab item after the tab is changed */
2547
+ onChange: (tab: ItemType) => void;
2548
+ } & Margin;
2549
+ declare const Tabs: <ItemType extends TabItem>({ items, activeItem, itemWidth, itemGap, onChange, ...props }: Props$1<ItemType>) => react_jsx_runtime.JSX.Element;
2550
+
2533
2551
  declare const useEventListener: <T extends Event>(element: MutableRefObject<HTMLElement> | HTMLElement | Document | Window, type: keyof WindowEventMap, listener: (event: T) => void, condition?: boolean, dependencies?: unknown[]) => void;
2534
2552
 
2535
2553
  declare const useOnClickOutside: <T extends HTMLElement>(onClickOutside: () => void, condition?: boolean, exclusions?: string[]) => MutableRefObject<T | null>;
@@ -2589,6 +2607,8 @@ declare const useConfirm: ({ header, text, cancelText, confirmText, negative, in
2589
2607
  */
2590
2608
  declare const useElementObserver: <T extends HTMLElement>(target: RefObject<T>, callback: (node: T) => void) => void;
2591
2609
 
2610
+ declare const usePrevious: <T>(value: T) => T;
2611
+
2592
2612
  type TimeSpec = 'onlyTime' | 'withTime' | 'relative';
2593
2613
  type TimeOptions = {
2594
2614
  time?: TimeSpec;
@@ -2626,4 +2646,4 @@ declare const positionProps: ({ position, top, bottom, right, left }: Position)
2626
2646
  left: string | number | undefined;
2627
2647
  };
2628
2648
 
2629
- export { Accordion, As, Audio, AudioRef, BarChart, Button, Calendar, Checkbox, Code, Table$1 as DocTable, DraftEditor, DraftEditorRef, Dropdown, DropdownMenu, OptionItem as DropdownOption, FlexPosition, Form, Grid, Height, ITheme, Icon, IconNames, ImageViewer, InlineCode, Input, InputRef, _default as InputUtils, Label, LineChart, Margin, MarginPadding, MaxHeight, MaxWidth, MaxWidthHeight, Menu, Message, MessageHr, MinHeight, MinWidth, MinWidthHeight, Modal, MultiSelect, MultiSelectRef, Notification, Options, Padding, Pagination, PieChart, Position, Progress, Radio, ResetStyles, ScrollbarStyles, Slider, Spacer, Spinner, Table, ThemeProp, ToastStyles, Toggle, Tooltip, Action as TransferAction, Item as TransferItem, TransferList, Next as TransferNext, Width, WidthHeight, copyToClipboard, formatDate, marginProps, numberWithCommas, paddingProps, positionProps, theme, useConfirm, useElementObserver, useEventListener, useOnClickOutside, useSelect, useSelectAll, useWindowSize, widthHeightProps };
2649
+ export { Accordion, As, Audio, AudioRef, BarChart, Button, Calendar, Checkbox, Code, Table$1 as DocTable, DraftEditor, DraftEditorRef, Dropdown, DropdownMenu, OptionItem as DropdownOption, FlexPosition, Form, Grid, Height, ITheme, Icon, IconNames, ImageViewer, InlineCode, Input, InputRef, _default as InputUtils, Label, LineChart, Margin, MarginPadding, MaxHeight, MaxWidth, MaxWidthHeight, Menu, Message, MessageHr, MinHeight, MinWidth, MinWidthHeight, Modal, MultiSelect, MultiSelectRef, Notification, Options, Padding, Pagination, PieChart, Position, Progress, Radio, ResetStyles, ScrollbarStyles, Slider, Spacer, Spinner, Table, Tabs, ThemeProp, ToastStyles, Toggle, Tooltip, Action as TransferAction, Item as TransferItem, TransferList, Next as TransferNext, Width, WidthHeight, copyToClipboard, formatDate, marginProps, numberWithCommas, paddingProps, positionProps, theme, useConfirm, useElementObserver, useEventListener, useOnClickOutside, usePrevious, useSelect, useSelectAll, useWindowSize, widthHeightProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "1.8.21",
3
+ "version": "1.9.0",
4
4
  "files": [
5
5
  "build/**/*"
6
6
  ],