@hyphen/hyphen-components 4.6.0 → 4.7.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.
package/dist/index.d.ts CHANGED
@@ -49,4 +49,5 @@ export * from './components/TimePicker/TimePicker';
49
49
  export * from './components/TimePickerNative/TimePickerNative';
50
50
  export * from './components/Toast';
51
51
  export * from './components/Toggle/Toggle';
52
+ export * from './components/Tooltip/Tooltip';
52
53
  export * from './hooks';
@@ -6,8 +6,8 @@ export declare const BREAKPOINT_OPTIONS: BreakpointSizeWithBase[];
6
6
  export declare const BREAKPOINTS: Breakpoint[];
7
7
  export declare const BASE_COLOR_OPTIONS: ("black" | "white" | "magenta" | "primary-50" | "primary-100" | "primary-200" | "primary-300" | "primary-400" | "primary-500" | "primary-600" | "primary-700" | "primary-800" | "primary-900" | "green-50" | "green-100" | "green-200" | "green-300" | "green-400" | "green-500" | "green-600" | "green-700" | "green-800" | "green-900" | "blue-50" | "blue-100" | "blue-200" | "blue-300" | "blue-400" | "blue-500" | "blue-600" | "blue-700" | "blue-800" | "blue-900" | "purple-50" | "purple-100" | "purple-200" | "purple-300" | "purple-400" | "purple-500" | "purple-600" | "purple-700" | "purple-800" | "purple-900" | "yellow-50" | "yellow-100" | "yellow-200" | "yellow-300" | "yellow-400" | "yellow-500" | "yellow-600" | "yellow-700" | "yellow-800" | "yellow-900" | "red-50" | "red-100" | "red-200" | "red-300" | "red-400" | "red-500" | "red-600" | "red-700" | "red-800" | "red-900" | "grey-50" | "grey-100" | "grey-200" | "grey-300" | "grey-400" | "grey-500" | "grey-600" | "grey-700" | "grey-800" | "grey-900")[];
8
8
  export declare const BASE_COLOR_NAMES: ("black" | "white" | "magenta" | "primary" | "green" | "blue" | "purple" | "yellow" | "red" | "grey")[];
9
- export declare const FONT_COLOR_OPTIONS: ("info" | "base" | "black" | "white" | "grey" | "secondary" | "tertiary" | "inverse" | "disabled" | "success" | "success-disabled" | "warn" | "warn-disabled" | "danger" | "danger-input" | "danger-disabled" | "button-primary" | "button-primary-hover" | "button-primary-active" | "button-secondary" | "button-secondary-hover" | "button-secondary-active" | "button-tertiary" | "button-tertiary-hover" | "button-tertiary-active" | "button-danger" | "button-danger-hover" | "button-danger-active" | "toast" | "toast-error" | "placeholder" | "brand-yellow" | "brand-orange" | "brand-magenta" | "brand-dark-grey" | "brand-cyan" | "brand-pink" | "brand-light-purple" | "brand-medium-purple" | "brand-dark-purple")[];
10
- export declare const BACKGROUND_COLOR_OPTIONS: ("info" | "black" | "white" | "primary" | "secondary" | "tertiary" | "inverse" | "disabled" | "success" | "danger" | "button-primary" | "button-primary-hover" | "button-primary-active" | "button-secondary" | "button-secondary-hover" | "button-secondary-active" | "button-tertiary" | "button-tertiary-hover" | "button-tertiary-active" | "button-danger" | "button-danger-hover" | "button-danger-active" | "toast" | "toast-error" | "brand-yellow" | "brand-orange" | "brand-magenta" | "brand-dark-grey" | "brand-cyan" | "brand-pink" | "brand-light-purple" | "brand-medium-purple" | "brand-dark-purple" | "error" | "warning" | "transparent" | "modal" | "brand-gradient" | "brand-gradient-reverse" | "brand-gradient-purple" | "brand-gradient-purple-reverse" | "brand-gradient-cyan" | "brand-gradient-cyan-reverse" | "chart-1" | "chart-2" | "chart-3")[];
9
+ export declare const FONT_COLOR_OPTIONS: ("info" | "base" | "black" | "white" | "grey" | "secondary" | "tertiary" | "inverse" | "disabled" | "success" | "success-disabled" | "warn" | "warn-disabled" | "danger" | "danger-input" | "danger-disabled" | "button-primary" | "button-primary-hover" | "button-primary-active" | "button-secondary" | "button-secondary-hover" | "button-secondary-active" | "button-tertiary" | "button-tertiary-hover" | "button-tertiary-active" | "button-danger" | "button-danger-hover" | "button-danger-active" | "toast" | "toast-error" | "tooltip" | "placeholder" | "brand-yellow" | "brand-orange" | "brand-magenta" | "brand-dark-grey" | "brand-cyan" | "brand-pink" | "brand-light-purple" | "brand-medium-purple" | "brand-dark-purple")[];
10
+ export declare const BACKGROUND_COLOR_OPTIONS: ("info" | "black" | "white" | "primary" | "secondary" | "tertiary" | "inverse" | "disabled" | "success" | "danger" | "button-primary" | "button-primary-hover" | "button-primary-active" | "button-secondary" | "button-secondary-hover" | "button-secondary-active" | "button-tertiary" | "button-tertiary-hover" | "button-tertiary-active" | "button-danger" | "button-danger-hover" | "button-danger-active" | "toast" | "toast-error" | "tooltip" | "brand-yellow" | "brand-orange" | "brand-magenta" | "brand-dark-grey" | "brand-cyan" | "brand-pink" | "brand-light-purple" | "brand-medium-purple" | "brand-dark-purple" | "error" | "warning" | "transparent" | "modal" | "brand-gradient" | "brand-gradient-reverse" | "brand-gradient-purple" | "brand-gradient-purple-reverse" | "brand-gradient-cyan" | "brand-gradient-cyan-reverse" | "chart-1" | "chart-2" | "chart-3")[];
11
11
  export declare const BORDER_COLOR_OPTIONS: ("info" | "inverse" | "danger" | "button-primary" | "button-primary-hover" | "button-primary-active" | "button-secondary" | "button-secondary-hover" | "button-secondary-active" | "button-tertiary" | "button-tertiary-hover" | "button-tertiary-active" | "toast" | "toast-error" | "brand-yellow" | "brand-orange" | "brand-magenta" | "brand-dark-grey" | "brand-cyan" | "brand-pink" | "brand-light-purple" | "brand-medium-purple" | "brand-dark-purple" | "warning" | "default" | "subtle" | "hover" | "active")[];
12
12
  export declare const FONT_SIZE_OPTIONS: ("xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "3xl" | "base" | "2xs" | "4xl" | "5xl" | "6xl" | "7xl")[];
13
13
  export declare const FONT_FAMILY_OPTIONS: ("monospace" | "body" | "brand")[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyphen/hyphen-components",
3
- "version": "4.6.0",
3
+ "version": "4.7.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "@hyphen"
@@ -61,11 +61,13 @@
61
61
  }
62
62
  ],
63
63
  "dependencies": {
64
- "@hyphen/hyphen-design-tokens": "^4.21.0",
64
+ "@emotion/react": "^11.14.0",
65
+ "@hyphen/hyphen-design-tokens": "^4.22.0",
65
66
  "@popperjs/core": "^2.11.8",
66
67
  "@radix-ui/react-collapsible": "^1.1.2",
67
68
  "@radix-ui/react-dropdown-menu": "^2.1.4",
68
69
  "@radix-ui/react-slot": "^1.1.1",
70
+ "@radix-ui/react-tooltip": "^1.1.7",
69
71
  "@types/react-modal": "^3.16.3",
70
72
  "classnames": "^2.5.1",
71
73
  "date-fns": "^2.16.1",
@@ -78,8 +80,7 @@
78
80
  "react-remove-scroll": "^2.5.10",
79
81
  "react-router-dom": "^6.26.1",
80
82
  "react-select": "^5.9.0",
81
- "react-select-event": "^5.5.1",
82
- "@emotion/react": "^11.14.0"
83
+ "react-select-event": "^5.5.1"
83
84
  },
84
85
  "devDependencies": {
85
86
  "@babel/core": "^7.23.7",
@@ -0,0 +1,23 @@
1
+
2
+ import { Canvas, Meta, ArgTypes } from '@storybook/blocks';
3
+ import { Tooltip } from './Tooltip';
4
+ import * as Stories from './Tooltip.stories';
5
+
6
+ <Meta of={Stories} />
7
+
8
+ # Tooltip
9
+
10
+ A popup that displays information related to an element when the element receives keyboard focus or the mouse hovers over it.
11
+
12
+ This component is extended from [Radix](https://www.radix-ui.com/primitives/docs/components/tooltip).
13
+
14
+ [API Reference](https://www.radix-ui.com/primitives/docs/components/tooltip#api-reference)
15
+
16
+
17
+ ## Basic Usage
18
+
19
+ <Canvas of={Stories.BasicUsage} />
20
+
21
+ ## With Portal
22
+
23
+ <Canvas of={Stories.WithPortal} />
@@ -0,0 +1,41 @@
1
+ import React from 'react';
2
+ import {
3
+ Tooltip,
4
+ TooltipTrigger,
5
+ TooltipContent,
6
+ TooltipProvider,
7
+ TooltipPortal,
8
+ } from './Tooltip';
9
+ import type { Meta } from '@storybook/react';
10
+ import { Button } from '../Button/Button';
11
+
12
+ const meta: Meta<typeof Tooltip> = {
13
+ title: 'Components/Tooltip',
14
+ component: Tooltip,
15
+ };
16
+
17
+ export default meta;
18
+
19
+ export const BasicUsage = () => (
20
+ <TooltipProvider delayDuration={100}>
21
+ <Tooltip>
22
+ <TooltipTrigger asChild>
23
+ <Button>Hover</Button>
24
+ </TooltipTrigger>
25
+ <TooltipContent>This is the tooltip content</TooltipContent>
26
+ </Tooltip>
27
+ </TooltipProvider>
28
+ );
29
+
30
+ export const WithPortal = () => (
31
+ <TooltipProvider delayDuration={100}>
32
+ <Tooltip>
33
+ <TooltipTrigger asChild>
34
+ <Button>Tooltip in Portal</Button>
35
+ </TooltipTrigger>
36
+ <TooltipPortal>
37
+ <TooltipContent>This is the tooltip content</TooltipContent>
38
+ </TooltipPortal>
39
+ </Tooltip>
40
+ </TooltipProvider>
41
+ );
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
3
+
4
+ import classNames from 'classnames';
5
+
6
+ const TooltipProvider = TooltipPrimitive.Provider;
7
+
8
+ const Tooltip = TooltipPrimitive.Root;
9
+
10
+ const TooltipTrigger = TooltipPrimitive.Trigger;
11
+
12
+ const TooltipPortal = TooltipPrimitive.Portal;
13
+
14
+ const TooltipContent = React.forwardRef<
15
+ React.ElementRef<typeof TooltipPrimitive.Content>,
16
+ React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>
17
+ >(({ className, sideOffset = 4, ...props }, ref) => (
18
+ <TooltipPrimitive.Content
19
+ ref={ref}
20
+ sideOffset={sideOffset}
21
+ className={classNames(
22
+ 'background-color-tooltip font-color-tooltip font-size-xs overflow-hidden br-sm p-h-sm p-v-xs shadow-sm ',
23
+ className
24
+ )}
25
+ {...props}
26
+ />
27
+ ));
28
+ TooltipContent.displayName = TooltipPrimitive.Content.displayName;
29
+
30
+ export {
31
+ Tooltip,
32
+ TooltipTrigger,
33
+ TooltipContent,
34
+ TooltipProvider,
35
+ TooltipPortal,
36
+ };
package/src/index.ts CHANGED
@@ -49,4 +49,5 @@ export * from './components/TimePicker/TimePicker';
49
49
  export * from './components/TimePickerNative/TimePickerNative';
50
50
  export * from './components/Toast';
51
51
  export * from './components/Toggle/Toggle';
52
+ export * from './components/Tooltip/Tooltip';
52
53
  export * from './hooks';