@wavv/ui 1.6.6 → 1.7.0-beta.1

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.
@@ -1,28 +1,21 @@
1
1
  import { ReactNode } from 'react';
2
- import { ThemeProp } from './types';
3
- type Position = 'top' | 'bottom' | 'right' | 'left' | 'top left' | 'bottom left' | 'top right' | 'bottom right';
2
+ import type { ThemeProp } from './types';
3
+ type Side = 'top' | 'bottom' | 'right' | 'left';
4
+ type Top = 'top center' | 'top left' | 'top right';
5
+ type Bottom = 'bottom center' | 'bottom left' | 'bottom right';
6
+ type Left = 'left center' | 'left top' | 'left bottom';
7
+ type Right = 'right center' | 'right top' | 'right bottom';
8
+ type Position = Side | Top | Bottom | Left | Right;
4
9
  export type TooltipProps = {
5
10
  children?: ReactNode;
6
11
  /** The element that will trigger the opening of the Tooltip */
7
12
  trigger: ReactNode;
8
- /** Sets the instigator of the Tooltip opening */
9
- on?: 'hover' | 'click';
10
13
  /** The text content of the Tooltip */
11
14
  content?: string;
12
- /** The style prop of the Tooltip container */
13
- style?: {
14
- [key: string]: string | number;
15
- };
16
15
  /** The position of the Tooltip body and arrow in relation to the trigger */
17
16
  position?: Position;
18
- /** Offsets the vertical position of the Tooltip */
19
- offsetY?: number;
20
- /** Offsets the horizontal position of the Tooltip arrow */
21
- offsetArrowX?: number;
22
- /** Offsets the horizontal position of the Tooltip */
23
- offsetX?: number;
24
- /** The width of the Tooltip container */
25
- containerWidth?: number | string;
17
+ /** Offset of the Tooltip from the trigger */
18
+ offset?: number;
26
19
  /** The width of the Tooltip element */
27
20
  width?: number | string;
28
21
  /** The maxWidth of the Tooltip element */
@@ -33,17 +26,19 @@ export type TooltipProps = {
33
26
  disabled?: boolean;
34
27
  /** The id of the Tooltip element */
35
28
  id?: string;
36
- /** The function called after the Tooltip opens */
37
- afterShow?: () => void;
38
- /** The function called after the Tooltip closes */
39
- afterHide?: () => void;
40
29
  /** The backgroundColor of the Tooltip element */
41
30
  bgColor?: string;
42
31
  /** The text color of the Tooltip element */
43
32
  color?: string;
33
+ /** Specify a container element to portal the content into */
34
+ container?: HTMLElement;
35
+ /** The function called after the Tooltip opens */
36
+ afterShow?: () => void;
37
+ /** The function called after the Tooltip closes */
38
+ afterHide?: () => void;
44
39
  };
45
40
  declare const Tooltip: {
46
- ({ trigger, on, children, content, style, position, offsetY, offsetArrowX, offsetX, containerWidth, width, maxWidth, textAlign, disabled, id, afterShow, afterHide, bgColor, color, }: TooltipProps): JSX.Element;
41
+ ({ trigger, children, content, position, offset, width, maxWidth, textAlign, disabled, id, bgColor, color, container, afterShow, afterHide, }: TooltipProps): JSX.Element;
47
42
  Header: import("@emotion/styled").StyledComponent<{
48
43
  theme?: import("@emotion/react").Theme | undefined;
49
44
  as?: import("react").ElementType<any> | undefined;
@@ -0,0 +1,56 @@
1
+ import { ReactNode } from 'react';
2
+ import { ThemeProp } from './types';
3
+ type Position = 'top' | 'bottom' | 'right' | 'left' | 'top left' | 'bottom left' | 'top right' | 'bottom right';
4
+ export type TooltipProps = {
5
+ children?: ReactNode;
6
+ /** The element that will trigger the opening of the Tooltip */
7
+ trigger: ReactNode;
8
+ /** Sets the instigator of the Tooltip opening */
9
+ on?: 'hover' | 'click';
10
+ /** The text content of the Tooltip */
11
+ content?: string;
12
+ /** The style prop of the Tooltip container */
13
+ style?: {
14
+ [key: string]: string | number;
15
+ };
16
+ /** The position of the Tooltip body and arrow in relation to the trigger */
17
+ position?: Position;
18
+ /** Offsets the vertical position of the Tooltip */
19
+ offsetY?: number;
20
+ /** Offsets the horizontal position of the Tooltip arrow */
21
+ offsetArrowX?: number;
22
+ /** Offsets the horizontal position of the Tooltip */
23
+ offsetX?: number;
24
+ /** The width of the Tooltip container */
25
+ containerWidth?: number | string;
26
+ /** The width of the Tooltip element */
27
+ width?: number | string;
28
+ /** The maxWidth of the Tooltip element */
29
+ maxWidth?: number | string;
30
+ /** The textAlignment of the Tooltip text */
31
+ textAlign?: 'left' | 'right' | 'center';
32
+ /** Prevents the Tooltip from opening */
33
+ disabled?: boolean;
34
+ /** The id of the Tooltip element */
35
+ id?: string;
36
+ /** The function called after the Tooltip opens */
37
+ afterShow?: () => void;
38
+ /** The function called after the Tooltip closes */
39
+ afterHide?: () => void;
40
+ /** The backgroundColor of the Tooltip element */
41
+ bgColor?: string;
42
+ /** The text color of the Tooltip element */
43
+ color?: string;
44
+ };
45
+ declare const Tooltip: {
46
+ ({ trigger, on, children, content, style, position, offsetY, offsetArrowX, offsetX, containerWidth, width, maxWidth, textAlign, disabled, id, afterShow, afterHide, bgColor, color, }: TooltipProps): JSX.Element;
47
+ Header: import("@emotion/styled").StyledComponent<{
48
+ theme?: import("@emotion/react").Theme | undefined;
49
+ as?: import("react").ElementType<any> | undefined;
50
+ } & ThemeProp, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
51
+ Body: import("@emotion/styled").StyledComponent<{
52
+ theme?: import("@emotion/react").Theme | undefined;
53
+ as?: import("react").ElementType<any> | undefined;
54
+ } & ThemeProp, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
55
+ };
56
+ export default Tooltip;
@@ -38,6 +38,7 @@ export { default as TransferList } from './components/TransferList';
38
38
  export { default as Table } from './components/Table';
39
39
  export { default as Toggle } from './components/Toggle';
40
40
  export { default as Tooltip } from './components/Tooltip';
41
+ export { default as TooltipLegacy } from './components/TooltipLegacy';
41
42
  export { default as theme } from './theme';
42
43
  export type { ITheme, ThemeProp } from './theme/ThemeTypes';
43
44
  export type { IconNames } from './components/Icon/icons';
package/build/index.d.ts CHANGED
@@ -522,7 +522,7 @@ type Padding = {
522
522
  paddingRight?: number | string;
523
523
  paddingLeft?: number | string;
524
524
  };
525
- type Position$1 = {
525
+ type Position$2 = {
526
526
  position?: 'static' | 'relative' | 'absolute' | 'sticky' | 'fixed';
527
527
  top?: number | string;
528
528
  bottom?: number | string;
@@ -1117,29 +1117,22 @@ type ButtonComponentProps = {
1117
1117
  joined?: never;
1118
1118
  } & BasicButtonProps & DropdownProps$2 & Margin;
1119
1119
 
1120
- type Position = 'top' | 'bottom' | 'right' | 'left' | 'top left' | 'bottom left' | 'top right' | 'bottom right';
1121
- type TooltipProps = {
1120
+ type Side = 'top' | 'bottom' | 'right' | 'left';
1121
+ type Top = 'top center' | 'top left' | 'top right';
1122
+ type Bottom = 'bottom center' | 'bottom left' | 'bottom right';
1123
+ type Left = 'left center' | 'left top' | 'left bottom';
1124
+ type Right = 'right center' | 'right top' | 'right bottom';
1125
+ type Position$1 = Side | Top | Bottom | Left | Right;
1126
+ type TooltipProps$1 = {
1122
1127
  children?: ReactNode;
1123
1128
  /** The element that will trigger the opening of the Tooltip */
1124
1129
  trigger: ReactNode;
1125
- /** Sets the instigator of the Tooltip opening */
1126
- on?: 'hover' | 'click';
1127
1130
  /** The text content of the Tooltip */
1128
1131
  content?: string;
1129
- /** The style prop of the Tooltip container */
1130
- style?: {
1131
- [key: string]: string | number;
1132
- };
1133
1132
  /** The position of the Tooltip body and arrow in relation to the trigger */
1134
- position?: Position;
1135
- /** Offsets the vertical position of the Tooltip */
1136
- offsetY?: number;
1137
- /** Offsets the horizontal position of the Tooltip arrow */
1138
- offsetArrowX?: number;
1139
- /** Offsets the horizontal position of the Tooltip */
1140
- offsetX?: number;
1141
- /** The width of the Tooltip container */
1142
- containerWidth?: number | string;
1133
+ position?: Position$1;
1134
+ /** Offset of the Tooltip from the trigger */
1135
+ offset?: number;
1143
1136
  /** The width of the Tooltip element */
1144
1137
  width?: number | string;
1145
1138
  /** The maxWidth of the Tooltip element */
@@ -1150,17 +1143,19 @@ type TooltipProps = {
1150
1143
  disabled?: boolean;
1151
1144
  /** The id of the Tooltip element */
1152
1145
  id?: string;
1153
- /** The function called after the Tooltip opens */
1154
- afterShow?: () => void;
1155
- /** The function called after the Tooltip closes */
1156
- afterHide?: () => void;
1157
1146
  /** The backgroundColor of the Tooltip element */
1158
1147
  bgColor?: string;
1159
1148
  /** The text color of the Tooltip element */
1160
1149
  color?: string;
1150
+ /** Specify a container element to portal the content into */
1151
+ container?: HTMLElement;
1152
+ /** The function called after the Tooltip opens */
1153
+ afterShow?: () => void;
1154
+ /** The function called after the Tooltip closes */
1155
+ afterHide?: () => void;
1161
1156
  };
1162
- declare const Tooltip: {
1163
- ({ trigger, on, children, content, style, position, offsetY, offsetArrowX, offsetX, containerWidth, width, maxWidth, textAlign, disabled, id, afterShow, afterHide, bgColor, color, }: TooltipProps): JSX.Element;
1157
+ declare const Tooltip$1: {
1158
+ ({ trigger, children, content, position, offset, width, maxWidth, textAlign, disabled, id, bgColor, color, container, afterShow, afterHide, }: TooltipProps$1): JSX.Element;
1164
1159
  Header: _emotion_styled.StyledComponent<{
1165
1160
  theme?: _emotion_react.Theme | undefined;
1166
1161
  as?: React.ElementType<any> | undefined;
@@ -1175,7 +1170,7 @@ declare const Tooltip: {
1175
1170
  declare const Button: {
1176
1171
  (props: ButtonComponentProps): JSX.Element;
1177
1172
  Group: ({ children, disabled, outline, size, small, large, secondary, negative, positive, caution, collapse, ...props }: {
1178
- children: (React.ReactElement<BasicButtonProps | ButtonComponentProps, string | React.JSXElementConstructor<any>> | React.ReactElement<TooltipProps, string | React.JSXElementConstructor<any>>) | (React.ReactElement<BasicButtonProps | ButtonComponentProps, string | React.JSXElementConstructor<any>> | React.ReactElement<TooltipProps, string | React.JSXElementConstructor<any>>)[];
1173
+ children: (React.ReactElement<BasicButtonProps | ButtonComponentProps, string | React.JSXElementConstructor<any>> | React.ReactElement<TooltipProps$1, string | React.JSXElementConstructor<any>>) | (React.ReactElement<BasicButtonProps | ButtonComponentProps, string | React.JSXElementConstructor<any>> | React.ReactElement<TooltipProps$1, string | React.JSXElementConstructor<any>>)[];
1179
1174
  disabled?: boolean | undefined;
1180
1175
  size?: "small" | "large" | "medium" | undefined;
1181
1176
  small?: boolean | undefined;
@@ -1330,7 +1325,7 @@ type IconProps = {
1330
1325
  } & ConditionalProps & MarginPadding & As & DivAttributes;
1331
1326
  declare const Icon: ({ name, svg, size, width, height, color, hoverColor, pointer, inheritColor, style, onClick, ...props }: IconProps) => JSX.Element | null;
1332
1327
 
1333
- type IconType = IconNames | IconProps | ReactElement<IconProps> | ReactElement<TooltipProps>;
1328
+ type IconType = IconNames | IconProps | ReactElement<IconProps> | ReactElement<TooltipProps$1>;
1334
1329
 
1335
1330
  type OnClear = () => void;
1336
1331
  type OnChangeDefault = (event: ChangeEvent<HTMLInputElement>) => void;
@@ -2095,7 +2090,7 @@ declare const Notification: _emotion_styled.StyledComponent<{
2095
2090
  size?: string | number | undefined;
2096
2091
  /** Styles the dot to accommodate containing a number */
2097
2092
  number?: boolean | undefined;
2098
- } & ThemeProp & Margin & Position$1, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2093
+ } & ThemeProp & Margin & Position$2, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2099
2094
 
2100
2095
  type OptionsProps = {
2101
2096
  children: ReactNode;
@@ -2246,7 +2241,7 @@ type SpinnerProps = {
2246
2241
  background?: string | boolean;
2247
2242
  /** If center positioned, specifies the zIndex of the spinner */
2248
2243
  zIndex?: number;
2249
- } & Margin & Position$1;
2244
+ } & Margin & Position$2;
2250
2245
  declare const Spinner: ({ size, color, center, background, zIndex, margin, marginTop, marginBottom, marginRight, marginLeft, position, top, bottom, right, left, ...props }: SpinnerProps) => JSX.Element;
2251
2246
 
2252
2247
  type Color = ColorNames | CSSProperties['color'];
@@ -2354,6 +2349,60 @@ type ToggleProps = {
2354
2349
  } & Margin & As & CheckboxAttributes;
2355
2350
  declare const Toggle: ({ id, label, labelPosition, checked, disabled, onChange, margin, marginTop, marginBottom, marginRight, marginLeft, ...props }: ToggleProps) => JSX.Element;
2356
2351
 
2352
+ type Position = 'top' | 'bottom' | 'right' | 'left' | 'top left' | 'bottom left' | 'top right' | 'bottom right';
2353
+ type TooltipProps = {
2354
+ children?: ReactNode;
2355
+ /** The element that will trigger the opening of the Tooltip */
2356
+ trigger: ReactNode;
2357
+ /** Sets the instigator of the Tooltip opening */
2358
+ on?: 'hover' | 'click';
2359
+ /** The text content of the Tooltip */
2360
+ content?: string;
2361
+ /** The style prop of the Tooltip container */
2362
+ style?: {
2363
+ [key: string]: string | number;
2364
+ };
2365
+ /** The position of the Tooltip body and arrow in relation to the trigger */
2366
+ position?: Position;
2367
+ /** Offsets the vertical position of the Tooltip */
2368
+ offsetY?: number;
2369
+ /** Offsets the horizontal position of the Tooltip arrow */
2370
+ offsetArrowX?: number;
2371
+ /** Offsets the horizontal position of the Tooltip */
2372
+ offsetX?: number;
2373
+ /** The width of the Tooltip container */
2374
+ containerWidth?: number | string;
2375
+ /** The width of the Tooltip element */
2376
+ width?: number | string;
2377
+ /** The maxWidth of the Tooltip element */
2378
+ maxWidth?: number | string;
2379
+ /** The textAlignment of the Tooltip text */
2380
+ textAlign?: 'left' | 'right' | 'center';
2381
+ /** Prevents the Tooltip from opening */
2382
+ disabled?: boolean;
2383
+ /** The id of the Tooltip element */
2384
+ id?: string;
2385
+ /** The function called after the Tooltip opens */
2386
+ afterShow?: () => void;
2387
+ /** The function called after the Tooltip closes */
2388
+ afterHide?: () => void;
2389
+ /** The backgroundColor of the Tooltip element */
2390
+ bgColor?: string;
2391
+ /** The text color of the Tooltip element */
2392
+ color?: string;
2393
+ };
2394
+ declare const Tooltip: {
2395
+ ({ trigger, on, children, content, style, position, offsetY, offsetArrowX, offsetX, containerWidth, width, maxWidth, textAlign, disabled, id, afterShow, afterHide, bgColor, color, }: TooltipProps): JSX.Element;
2396
+ Header: _emotion_styled.StyledComponent<{
2397
+ theme?: _emotion_react.Theme | undefined;
2398
+ as?: React.ElementType<any> | undefined;
2399
+ } & ThemeProp, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2400
+ Body: _emotion_styled.StyledComponent<{
2401
+ theme?: _emotion_react.Theme | undefined;
2402
+ as?: React.ElementType<any> | undefined;
2403
+ } & ThemeProp, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
2404
+ };
2405
+
2357
2406
  declare const useEventListener: <T extends Event>(element: MutableRefObject<HTMLElement> | HTMLElement | Document | Window, type: keyof WindowEventMap, listener: (event: T) => void, condition?: boolean, dependencies?: unknown[]) => void;
2358
2407
 
2359
2408
  declare const useOnClickOutside: <T extends HTMLElement>(onClickOutside: () => void, condition?: boolean, exclusions?: string[]) => MutableRefObject<T | null>;
@@ -2442,7 +2491,7 @@ declare const marginProps: ({ margin, marginTop, marginBottom, marginRight, marg
2442
2491
  marginRight: string | number | undefined;
2443
2492
  marginLeft: string | number | undefined;
2444
2493
  };
2445
- declare const positionProps: ({ position, top, bottom, right, left }: Position$1) => {
2494
+ declare const positionProps: ({ position, top, bottom, right, left }: Position$2) => {
2446
2495
  position: "static" | "relative" | "absolute" | "sticky" | "fixed" | undefined;
2447
2496
  top: string | number | undefined;
2448
2497
  bottom: string | number | undefined;
@@ -2450,4 +2499,4 @@ declare const positionProps: ({ position, top, bottom, right, left }: Position$1
2450
2499
  left: string | number | undefined;
2451
2500
  };
2452
2501
 
2453
- export { Accordion, As, Audio, AudioRef, BarChart, Button, Calendar, Checkbox, Code, Table$1 as DocTable, DraftEditor, DraftEditorRef, Dropdown, 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, Modal, MultiSelect, Notification, Options, Padding, Pagination, PieChart, Position$1 as 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 };
2502
+ export { Accordion, As, Audio, AudioRef, BarChart, Button, Calendar, Checkbox, Code, Table$1 as DocTable, DraftEditor, DraftEditorRef, Dropdown, 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, Modal, MultiSelect, Notification, Options, Padding, Pagination, PieChart, Position$2 as Position, Progress, Radio, ResetStyles, ScrollbarStyles, Slider, Spacer, Spinner, Table, ThemeProp, ToastStyles, Toggle, Tooltip$1 as Tooltip, Tooltip as TooltipLegacy, 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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavv/ui",
3
- "version": "1.6.6",
3
+ "version": "1.7.0-beta.1",
4
4
  "files": [
5
5
  "build/**/*"
6
6
  ],
@@ -21,6 +21,7 @@
21
21
  "dependencies": {
22
22
  "@emotion/styled": "^11.10.6",
23
23
  "@radix-ui/react-accordion": "^1.1.1",
24
+ "@radix-ui/react-tooltip": "^1.0.5",
24
25
  "@react-hook/resize-observer": "^1.2.6",
25
26
  "date-fns": "^2.29.3",
26
27
  "draft-js": "^0.11.7",