@wavv/ui 1.0.3 → 1.1.0-beta.3

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 (30) hide show
  1. package/dist/cjs/index.js +1 -1
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/Table/Body.d.ts +7 -0
  4. package/dist/cjs/types/components/Table/Column.d.ts +21 -0
  5. package/dist/cjs/types/components/Table/Content.d.ts +9 -0
  6. package/dist/cjs/types/components/Table/Header.d.ts +4 -0
  7. package/dist/cjs/types/components/Table/HeaderCell.d.ts +16 -0
  8. package/dist/cjs/types/components/Table/Row.d.ts +4 -0
  9. package/dist/cjs/types/components/Table/Table.d.ts +23 -0
  10. package/dist/cjs/types/components/Table/context.d.ts +4 -0
  11. package/dist/cjs/types/components/Table/index.d.ts +2 -0
  12. package/dist/cjs/types/components/Table/types.d.ts +38 -0
  13. package/dist/cjs/types/components/Table/utils.d.ts +4 -0
  14. package/dist/esm/index.js +4 -4
  15. package/dist/esm/index.js.map +1 -1
  16. package/dist/esm/types/components/Table/Body.d.ts +7 -0
  17. package/dist/esm/types/components/Table/Column.d.ts +21 -0
  18. package/dist/esm/types/components/Table/Content.d.ts +9 -0
  19. package/dist/esm/types/components/Table/Header.d.ts +4 -0
  20. package/dist/esm/types/components/Table/HeaderCell.d.ts +16 -0
  21. package/dist/esm/types/components/Table/Row.d.ts +4 -0
  22. package/dist/esm/types/components/Table/Table.d.ts +23 -0
  23. package/dist/esm/types/components/Table/context.d.ts +4 -0
  24. package/dist/esm/types/components/Table/index.d.ts +2 -0
  25. package/dist/esm/types/components/Table/types.d.ts +38 -0
  26. package/dist/esm/types/components/Table/utils.d.ts +4 -0
  27. package/dist/index.d.ts +41 -48
  28. package/package.json +1 -1
  29. package/dist/cjs/types/components/Table.d.ts +0 -53
  30. package/dist/esm/types/components/Table.d.ts +0 -53
@@ -0,0 +1,7 @@
1
+ import { HTMLProps, ReactNode } from 'react';
2
+ import { Height } from '../types';
3
+ declare type BodyProps = {
4
+ children: ReactNode;
5
+ } & Height & HTMLProps<HTMLTableSectionElement>;
6
+ declare const Body: ({ children, height }: BodyProps) => JSX.Element;
7
+ export default Body;
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from 'react';
2
+ import { FlexPosition, ThemeProp } from '../types';
3
+ declare type TableColumn = {
4
+ children?: ReactNode;
5
+ /** The flex positioning of the Column contents */
6
+ contentPosition?: FlexPosition;
7
+ /** The string value to display if the child text is undefined (i.e. "N/A", "—") */
8
+ defaultValue?: string;
9
+ };
10
+ declare const Column: ({ children, contentPosition, defaultValue }: TableColumn) => JSX.Element;
11
+ declare const TableColumn: import("@emotion/styled").StyledComponent<{
12
+ theme?: import("@emotion/react").Theme | undefined;
13
+ as?: import("react").ElementType<any> | undefined;
14
+ } & {
15
+ contentPosition?: FlexPosition | undefined;
16
+ } & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
17
+ theme?: import("@emotion/react").Theme | undefined;
18
+ } & {
19
+ showDefault?: boolean | undefined;
20
+ } & ThemeProp, {}, {}>;
21
+ export default Column;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { FlexPosition } from '../types';
3
+ declare const Content: import("@emotion/styled").StyledComponent<{
4
+ theme?: import("@emotion/react").Theme | undefined;
5
+ as?: import("react").ElementType<any> | undefined;
6
+ } & {
7
+ contentPosition?: FlexPosition | undefined;
8
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export default Content;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TableHeaderRow } from './types';
3
+ declare const Header: ({ children, columns, ...rest }: TableHeaderRow) => JSX.Element;
4
+ export default Header;
@@ -0,0 +1,16 @@
1
+ import { MouseEvent, ReactNode } from 'react';
2
+ import { FlexPosition } from '../types';
3
+ declare type SortDir = 'asc' | 'desc' | 'inactive';
4
+ declare type HeaderCellProps = {
5
+ children?: ReactNode;
6
+ /** The flex positioning of the HeaderCell contents */
7
+ contentPosition?: FlexPosition;
8
+ /** The function to be called when the HeaderCell is clicked */
9
+ onClick?: (event: MouseEvent) => void;
10
+ /** Controls the direction of the sort icon indicating the direction of the data */
11
+ sorted?: SortDir;
12
+ /** The property of the data object to sort by */
13
+ sortKey?: string;
14
+ };
15
+ declare const HeaderCell: ({ children, onClick, contentPosition, sorted, sortKey }: HeaderCellProps) => JSX.Element;
16
+ export default HeaderCell;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { TableHeaderRow } from './types';
3
+ declare const Row: ({ children, columns, onClick, ...rest }: TableHeaderRow) => JSX.Element;
4
+ export default Row;
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { Data, TableProps } from './types';
3
+ declare const Table: {
4
+ <DataType extends Data>({ children, columns, data, ...rest }: TableProps<DataType>): JSX.Element;
5
+ Header: ({ children, columns, ...rest }: import("./types").TableHeaderRow) => JSX.Element;
6
+ HeaderCell: ({ children, onClick, contentPosition, sorted, sortKey }: {
7
+ children?: ReactNode;
8
+ contentPosition?: import("../types").FlexPosition | undefined;
9
+ onClick?: ((event: import("react").MouseEvent<Element, MouseEvent>) => void) | undefined;
10
+ sorted?: ("desc" | "inactive" | "asc") | undefined;
11
+ sortKey?: string | undefined;
12
+ }) => JSX.Element;
13
+ Body: ({ children, height }: {
14
+ children: ReactNode;
15
+ } & import("../types").Height & import("react").HTMLProps<HTMLTableSectionElement>) => JSX.Element;
16
+ Row: ({ children, columns, onClick, ...rest }: import("./types").TableHeaderRow) => JSX.Element;
17
+ Column: ({ children, contentPosition, defaultValue }: {
18
+ children?: ReactNode;
19
+ contentPosition?: import("../types").FlexPosition | undefined;
20
+ defaultValue?: string | undefined;
21
+ }) => JSX.Element;
22
+ };
23
+ export default Table;
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import { Context, Data } from './types';
3
+ declare const TableContext: import("react").Context<Context<Data>>;
4
+ export default TableContext;
@@ -0,0 +1,2 @@
1
+ import Table from './Table';
2
+ export default Table;
@@ -0,0 +1,38 @@
1
+ import React, { HTMLProps, ReactNode } from 'react';
2
+ import { As, MarginPadding, Width, ThemeProp, Padding } from '../types';
3
+ export declare type Data = {
4
+ [key: string]: unknown;
5
+ };
6
+ export declare type SetData<DataType> = React.Dispatch<React.SetStateAction<DataType[]>>;
7
+ export declare type SetColumn = React.Dispatch<React.SetStateAction<string>>;
8
+ export declare type Columns = number | string;
9
+ export declare type SortedChildFunc<DataType> = (data: DataType[]) => ReactNode;
10
+ declare type Default = {
11
+ data?: never;
12
+ children: ReactNode;
13
+ };
14
+ declare type Sorted<DataType> = {
15
+ /** The data the table should use to add column sort functionality */
16
+ data: DataType[];
17
+ children: SortedChildFunc<DataType>;
18
+ };
19
+ declare type TableTypes<DataType> = Default | Sorted<DataType>;
20
+ declare type DefaultTableProps = Omit<HTMLProps<HTMLTableElement>, 'as' | 'children' | 'data'> & As;
21
+ declare type TableBase = {
22
+ /** If a number, columns creates n number columns of an equal size. If a string, columns sets the gridTemplateColumns property */
23
+ columns?: Columns;
24
+ } & Width & MarginPadding;
25
+ export declare type TableProps<DataType> = TableBase & TableTypes<DataType> & DefaultTableProps;
26
+ export declare type TableHeaderRow = TableBase & HTMLProps<HTMLTableRowElement>;
27
+ export declare type TableElements = {
28
+ as?: string;
29
+ } & ThemeProp & Padding;
30
+ export declare type Context<DataType> = {
31
+ data?: DataType[];
32
+ originalData?: DataType[];
33
+ parentColumns?: Columns;
34
+ setData?: SetData<DataType>;
35
+ activeColumn?: string;
36
+ setActiveColumn?: SetColumn;
37
+ };
38
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ReactNode } from 'react';
2
+ import { Data } from './types';
3
+ export declare const wrappedChildren: (children: ReactNode, type: string) => (JSX.Element | null)[];
4
+ export declare const isEqualContents: (array1?: Data[], array2?: Data[]) => boolean;
package/dist/index.d.ts CHANGED
@@ -1229,7 +1229,7 @@ declare type IconType = IconNames | IconProps | ReactElement<IconProps> | ReactE
1229
1229
  declare type OnClear = () => void;
1230
1230
  declare type OnChangeDefault = (event: ChangeEvent<HTMLInputElement>) => void;
1231
1231
  declare type OnChangePhone = (event: ChangeEvent<HTMLInputElement>, formatted: string, raw: string) => void;
1232
- declare type Default = {
1232
+ declare type Default$1 = {
1233
1233
  /** Auto-formats the input to a US phone number */
1234
1234
  phone?: never;
1235
1235
  /** A callback function that is run upon changing the contents of the input */
@@ -1239,7 +1239,7 @@ declare type Phone = {
1239
1239
  phone: true;
1240
1240
  onChange?: OnChangePhone;
1241
1241
  };
1242
- declare type InputTypes = Default | Phone;
1242
+ declare type InputTypes = Default$1 | Phone;
1243
1243
  declare type DefaultInputProps = Omit<HTMLProps<HTMLInputElement>, 'onChange' | 'as'> & As;
1244
1244
  declare type InputProps = {
1245
1245
  /** The id of the input element */
@@ -1356,7 +1356,7 @@ declare const Input: react.ForwardRefExoticComponent<(Pick<{
1356
1356
  onClick?: ((event?: MouseEvent$1) => void) | undefined;
1357
1357
  /** A callback function that is run upon clicking the clear icon */
1358
1358
  onClear?: OnClear | undefined;
1359
- } & Omit<HTMLProps<HTMLInputElement>, "as" | "onChange"> & As & Default & Margin, "search" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "start" | "size" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "pointer" | "backgroundColor" | "fontSize" | "borderColor" | "borderRadius" | "borderless" | "textOnly" | "invalid" | keyof Margin | "placeholderColor" | "description" | "isLoading" | "iconLeft" | "iconRight" | "containerRef" | "preventFocus" | "onClear" | keyof Default> | Pick<{
1359
+ } & Omit<HTMLProps<HTMLInputElement>, "as" | "onChange"> & As & Default$1 & Margin, "search" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "start" | "size" | "accept" | "acceptCharset" | "action" | "allowFullScreen" | "allowTransparency" | "alt" | "as" | "async" | "autoComplete" | "autoFocus" | "autoPlay" | "capture" | "cellPadding" | "cellSpacing" | "charSet" | "challenge" | "checked" | "classID" | "cols" | "colSpan" | "content" | "controls" | "coords" | "crossOrigin" | "dateTime" | "default" | "defer" | "disabled" | "download" | "encType" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "frameBorder" | "headers" | "height" | "high" | "href" | "hrefLang" | "htmlFor" | "httpEquiv" | "integrity" | "keyParams" | "keyType" | "kind" | "list" | "loop" | "low" | "manifest" | "marginHeight" | "marginWidth" | "max" | "maxLength" | "media" | "mediaGroup" | "method" | "min" | "minLength" | "multiple" | "muted" | "name" | "nonce" | "noValidate" | "open" | "optimum" | "placeholder" | "playsInline" | "poster" | "preload" | "readOnly" | "rel" | "required" | "reversed" | "rows" | "rowSpan" | "sandbox" | "scope" | "scoped" | "scrolling" | "seamless" | "selected" | "shape" | "sizes" | "src" | "srcDoc" | "srcLang" | "srcSet" | "step" | "target" | "type" | "useMap" | "value" | "width" | "wmode" | "wrap" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "pointer" | "backgroundColor" | "fontSize" | "borderColor" | "borderRadius" | "borderless" | "textOnly" | "invalid" | keyof Margin | "placeholderColor" | "description" | "isLoading" | "iconLeft" | "iconRight" | "containerRef" | "preventFocus" | "onClear" | keyof Default$1> | Pick<{
1360
1360
  /** The id of the input element */
1361
1361
  id?: string | undefined;
1362
1362
  /** Places a label element above the input. The value will set the text of the label */
@@ -2542,56 +2542,49 @@ declare type TransferListProps = {
2542
2542
  } & Width & Margin;
2543
2543
  declare const TransferList: ({ items, onChange, beforeItemChange, listTitle, noItemsMessage, hideSelectAll, hideRemoveAll, readOnly, width, margin, marginTop, marginBottom, marginRight, marginLeft, }: TransferListProps) => JSX.Element;
2544
2544
 
2545
- /** Table component */
2545
+ declare type Data = {
2546
+ [key: string]: unknown;
2547
+ };
2548
+ declare type Columns = number | string;
2549
+ declare type SortedChildFunc<DataType> = (data: DataType[]) => ReactNode;
2550
+ declare type Default = {
2551
+ data?: never;
2552
+ children: ReactNode;
2553
+ };
2554
+ declare type Sorted<DataType> = {
2555
+ /** The data the table should use to add column sort functionality */
2556
+ data: DataType[];
2557
+ children: SortedChildFunc<DataType>;
2558
+ };
2559
+ declare type TableTypes<DataType> = Default | Sorted<DataType>;
2560
+ declare type DefaultTableProps = Omit<HTMLProps<HTMLTableElement>, 'as' | 'children' | 'data'> & As;
2546
2561
  declare type TableBase = {
2547
- children?: ReactNode;
2548
2562
  /** If a number, columns creates n number columns of an equal size. If a string, columns sets the gridTemplateColumns property */
2549
- columns?: number | string;
2563
+ columns?: Columns;
2550
2564
  } & Width & MarginPadding;
2551
- declare type DefaultTableProps = Omit<HTMLProps<HTMLTableElement>, 'as'> & As;
2565
+ declare type TableProps<DataType> = TableBase & TableTypes<DataType> & DefaultTableProps;
2566
+ declare type TableHeaderRow = TableBase & HTMLProps<HTMLTableRowElement>;
2567
+
2552
2568
  declare const Table: {
2553
- ({ children, columns, ...rest }: TableBase & DefaultTableProps): JSX.Element;
2554
- /** Table.Header component */
2555
- Header({ children, columns, parentColumns, ...rest }: TableHeaderRow): JSX.Element;
2556
- HeaderCell: ({ children, onClick, contentPosition, sorted }: HeaderCellProps) => JSX.Element;
2557
- Body({ children, parentColumns, height }: BodyProps): JSX.Element;
2558
- /** Table.Row component */
2559
- Row({ children, columns, parentColumns, onClick, ...rest }: TableHeaderRow): JSX.Element;
2560
- Column({ children, contentPosition, defaultValue }: TableColumn): JSX.Element;
2561
- };
2562
- declare type TableHeaderRow = {
2563
- parentColumns?: number | string;
2564
- } & TableBase & HTMLProps<HTMLTableRowElement>;
2565
- /** Table.HeaderCell component */
2566
- declare type HeaderCellProps = {
2567
- children?: ReactNode;
2568
- /** The flex positioning of the HeaderCell contents */
2569
- contentPosition?: FlexPosition;
2570
- /** The function to be called when the HeaderCell is clicked */
2571
- onClick?: (event: MouseEvent$1) => void;
2572
- /** Controls the direction of the sort icon indicating the direction of the data */
2573
- sorted?: 'asc' | 'desc' | 'inactive';
2574
- };
2575
- /** Table.Body component */
2576
- declare type BodyProps = Omit<TableHeaderRow, 'columns'> & Height & HTMLProps<HTMLTableSectionElement>;
2577
- /** Table.Column component */
2578
- declare type TableColumn = {
2579
- children?: ReactNode;
2580
- /** The flex positioning of the Column contents */
2581
- contentPosition?: FlexPosition;
2582
- /** The string value to display if the child text is undefined (i.e. "N/A", "—") */
2583
- defaultValue?: string;
2569
+ <DataType extends Data>({ children, columns, data, ...rest }: TableProps<DataType>): JSX.Element;
2570
+ Header: ({ children, columns, ...rest }: TableHeaderRow) => JSX.Element;
2571
+ HeaderCell: ({ children, onClick, contentPosition, sorted, sortKey }: {
2572
+ children?: ReactNode;
2573
+ contentPosition?: FlexPosition | undefined;
2574
+ onClick?: ((event: react.MouseEvent<Element, MouseEvent>) => void) | undefined;
2575
+ sorted?: ("desc" | "inactive" | "asc") | undefined;
2576
+ sortKey?: string | undefined;
2577
+ }) => JSX.Element;
2578
+ Body: ({ children, height }: {
2579
+ children: ReactNode;
2580
+ } & Height & react.HTMLProps<HTMLTableSectionElement>) => JSX.Element;
2581
+ Row: ({ children, columns, onClick, ...rest }: TableHeaderRow) => JSX.Element;
2582
+ Column: ({ children, contentPosition, defaultValue }: {
2583
+ children?: ReactNode;
2584
+ contentPosition?: FlexPosition | undefined;
2585
+ defaultValue?: string | undefined;
2586
+ }) => JSX.Element;
2584
2587
  };
2585
- declare const TableColumn: _emotion_styled.StyledComponent<{
2586
- theme?: _emotion_react.Theme | undefined;
2587
- as?: react.ElementType<any> | undefined;
2588
- } & {
2589
- contentPosition?: FlexPosition | undefined;
2590
- } & react.ClassAttributes<HTMLDivElement> & react.HTMLAttributes<HTMLDivElement> & {
2591
- theme?: _emotion_react.Theme | undefined;
2592
- } & {
2593
- showDefault?: boolean | undefined;
2594
- } & ThemeProp, {}, {}>;
2595
2588
 
2596
2589
  declare type ToggleProps = {
2597
2590
  /** Id of the input element */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "1.0.3",
3
+ "version": "1.1.0-beta.3",
4
4
  "files": [
5
5
  "dist/**/*"
6
6
  ],
@@ -1,53 +0,0 @@
1
- import { HTMLProps, MouseEvent, ReactNode } from 'react';
2
- import { ThemeProp, MarginPadding, Height, Width, FlexPosition, As } from './types';
3
- /** Table component */
4
- declare type TableBase = {
5
- children?: ReactNode;
6
- /** If a number, columns creates n number columns of an equal size. If a string, columns sets the gridTemplateColumns property */
7
- columns?: number | string;
8
- } & Width & MarginPadding;
9
- declare type DefaultTableProps = Omit<HTMLProps<HTMLTableElement>, 'as'> & As;
10
- declare const Table: {
11
- ({ children, columns, ...rest }: TableBase & DefaultTableProps): JSX.Element;
12
- /** Table.Header component */
13
- Header({ children, columns, parentColumns, ...rest }: TableHeaderRow): JSX.Element;
14
- HeaderCell: ({ children, onClick, contentPosition, sorted }: HeaderCellProps) => JSX.Element;
15
- Body({ children, parentColumns, height }: BodyProps): JSX.Element;
16
- /** Table.Row component */
17
- Row({ children, columns, parentColumns, onClick, ...rest }: TableHeaderRow): JSX.Element;
18
- Column({ children, contentPosition, defaultValue }: TableColumn): JSX.Element;
19
- };
20
- declare type TableHeaderRow = {
21
- parentColumns?: number | string;
22
- } & TableBase & HTMLProps<HTMLTableRowElement>;
23
- /** Table.HeaderCell component */
24
- declare type HeaderCellProps = {
25
- children?: ReactNode;
26
- /** The flex positioning of the HeaderCell contents */
27
- contentPosition?: FlexPosition;
28
- /** The function to be called when the HeaderCell is clicked */
29
- onClick?: (event: MouseEvent) => void;
30
- /** Controls the direction of the sort icon indicating the direction of the data */
31
- sorted?: 'asc' | 'desc' | 'inactive';
32
- };
33
- /** Table.Body component */
34
- declare type BodyProps = Omit<TableHeaderRow, 'columns'> & Height & HTMLProps<HTMLTableSectionElement>;
35
- /** Table.Column component */
36
- declare type TableColumn = {
37
- children?: ReactNode;
38
- /** The flex positioning of the Column contents */
39
- contentPosition?: FlexPosition;
40
- /** The string value to display if the child text is undefined (i.e. "N/A", "—") */
41
- defaultValue?: string;
42
- };
43
- declare const TableColumn: import("@emotion/styled").StyledComponent<{
44
- theme?: import("@emotion/react").Theme | undefined;
45
- as?: import("react").ElementType<any> | undefined;
46
- } & {
47
- contentPosition?: FlexPosition | undefined;
48
- } & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
49
- theme?: import("@emotion/react").Theme | undefined;
50
- } & {
51
- showDefault?: boolean | undefined;
52
- } & ThemeProp, {}, {}>;
53
- export default Table;
@@ -1,53 +0,0 @@
1
- import { HTMLProps, MouseEvent, ReactNode } from 'react';
2
- import { ThemeProp, MarginPadding, Height, Width, FlexPosition, As } from './types';
3
- /** Table component */
4
- declare type TableBase = {
5
- children?: ReactNode;
6
- /** If a number, columns creates n number columns of an equal size. If a string, columns sets the gridTemplateColumns property */
7
- columns?: number | string;
8
- } & Width & MarginPadding;
9
- declare type DefaultTableProps = Omit<HTMLProps<HTMLTableElement>, 'as'> & As;
10
- declare const Table: {
11
- ({ children, columns, ...rest }: TableBase & DefaultTableProps): JSX.Element;
12
- /** Table.Header component */
13
- Header({ children, columns, parentColumns, ...rest }: TableHeaderRow): JSX.Element;
14
- HeaderCell: ({ children, onClick, contentPosition, sorted }: HeaderCellProps) => JSX.Element;
15
- Body({ children, parentColumns, height }: BodyProps): JSX.Element;
16
- /** Table.Row component */
17
- Row({ children, columns, parentColumns, onClick, ...rest }: TableHeaderRow): JSX.Element;
18
- Column({ children, contentPosition, defaultValue }: TableColumn): JSX.Element;
19
- };
20
- declare type TableHeaderRow = {
21
- parentColumns?: number | string;
22
- } & TableBase & HTMLProps<HTMLTableRowElement>;
23
- /** Table.HeaderCell component */
24
- declare type HeaderCellProps = {
25
- children?: ReactNode;
26
- /** The flex positioning of the HeaderCell contents */
27
- contentPosition?: FlexPosition;
28
- /** The function to be called when the HeaderCell is clicked */
29
- onClick?: (event: MouseEvent) => void;
30
- /** Controls the direction of the sort icon indicating the direction of the data */
31
- sorted?: 'asc' | 'desc' | 'inactive';
32
- };
33
- /** Table.Body component */
34
- declare type BodyProps = Omit<TableHeaderRow, 'columns'> & Height & HTMLProps<HTMLTableSectionElement>;
35
- /** Table.Column component */
36
- declare type TableColumn = {
37
- children?: ReactNode;
38
- /** The flex positioning of the Column contents */
39
- contentPosition?: FlexPosition;
40
- /** The string value to display if the child text is undefined (i.e. "N/A", "—") */
41
- defaultValue?: string;
42
- };
43
- declare const TableColumn: import("@emotion/styled").StyledComponent<{
44
- theme?: import("@emotion/react").Theme | undefined;
45
- as?: import("react").ElementType<any> | undefined;
46
- } & {
47
- contentPosition?: FlexPosition | undefined;
48
- } & import("react").ClassAttributes<HTMLDivElement> & import("react").HTMLAttributes<HTMLDivElement> & {
49
- theme?: import("@emotion/react").Theme | undefined;
50
- } & {
51
- showDefault?: boolean | undefined;
52
- } & ThemeProp, {}, {}>;
53
- export default Table;