paris 0.14.0 → 0.14.2
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/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/src/stories/informationaltooltip/InformationalTooltip.module.scss +1 -2
- package/src/stories/informationaltooltip/InformationalTooltip.stories.tsx +0 -25
- package/src/stories/informationaltooltip/InformationalTooltip.tsx +33 -10
- package/src/stories/menu/Menu.module.scss +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# paris
|
|
2
2
|
|
|
3
|
+
## 0.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8252518: InformationalTooltip: Added overrides, and increased padding
|
|
8
|
+
- 8252518: Menu: Item side padding from 16px to 14px
|
|
9
|
+
|
|
10
|
+
## 0.14.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- ffa4d0c: InformationalTooltip: Removed `headingIcon` prop
|
|
15
|
+
- ffa4d0c: InformationalTooltip: Opens onClick for mobile support, new `disableClick` prop to disable that behavior
|
|
16
|
+
|
|
3
17
|
## 0.14.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "paris",
|
|
3
3
|
"author": "Sanil Chawla <sanil@slingshot.fm> (https://sanil.co)",
|
|
4
4
|
"description": "Paris is Slingshot's React design system. It's a collection of reusable components, design tokens, and guidelines that help us build consistent, accessible, and performant user interfaces.",
|
|
5
|
-
"version": "0.14.
|
|
5
|
+
"version": "0.14.2",
|
|
6
6
|
"homepage": "https://paris.slingshot.fm",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
justify-content: center;
|
|
8
8
|
gap: 6px;
|
|
9
9
|
width: 280px;
|
|
10
|
-
padding: 12px;
|
|
10
|
+
padding: 12px 14px;
|
|
11
11
|
color: var(--pte-new-colors-contentTertiary);
|
|
12
12
|
|
|
13
13
|
&.medium {
|
|
@@ -20,5 +20,4 @@
|
|
|
20
20
|
display: flex;
|
|
21
21
|
align-items: center;
|
|
22
22
|
gap: 8px;
|
|
23
|
-
padding-left: 1px;
|
|
24
23
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
2
|
import { createElement } from 'react';
|
|
3
|
-
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
|
4
|
-
import { faPlus } from '@fortawesome/free-solid-svg-icons';
|
|
5
3
|
import { InformationalTooltip } from './InformationalTooltip';
|
|
6
4
|
|
|
7
5
|
const meta: Meta<typeof InformationalTooltip> = {
|
|
@@ -63,26 +61,3 @@ export const CustomAlign: Story = {
|
|
|
63
61
|
},
|
|
64
62
|
render,
|
|
65
63
|
};
|
|
66
|
-
|
|
67
|
-
export const HeadingIcon: Story = {
|
|
68
|
-
args: {
|
|
69
|
-
children: 'This is a medium tooltip with a heading',
|
|
70
|
-
size: 'medium',
|
|
71
|
-
headingIcon: (createElement(FontAwesomeIcon, {
|
|
72
|
-
icon: faPlus,
|
|
73
|
-
width: '14px',
|
|
74
|
-
})),
|
|
75
|
-
heading: 'Custom icon',
|
|
76
|
-
},
|
|
77
|
-
render,
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const NullIcon: Story = {
|
|
81
|
-
args: {
|
|
82
|
-
children: 'But the headingIcon is null',
|
|
83
|
-
size: 'medium',
|
|
84
|
-
headingIcon: null,
|
|
85
|
-
heading: 'This has a heading',
|
|
86
|
-
},
|
|
87
|
-
render,
|
|
88
|
-
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { FC, ReactNode } from 'react';
|
|
1
|
+
import type { ComponentPropsWithoutRef, FC, ReactNode } from 'react';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import * as RadixTooltip from '@radix-ui/react-tooltip';
|
|
5
|
+
import type { HTMLMotionProps } from 'framer-motion';
|
|
5
6
|
import { motion, AnimatePresence } from 'framer-motion';
|
|
6
7
|
import styles from './InformationalTooltip.module.scss';
|
|
7
8
|
import { TextWhenString } from '../utility';
|
|
@@ -19,8 +20,6 @@ export type InformationalTooltipProps = {
|
|
|
19
20
|
trigger?: ReactNode;
|
|
20
21
|
/** The heading text in the tooltip. If null, the heading will be hidden. */
|
|
21
22
|
heading?: string | null;
|
|
22
|
-
/** The heading icon in the tooltip. If undefined, will show info icon. If pass in an element, it will display in the heading. If set to null, will hide icon. */
|
|
23
|
-
headingIcon?: ReactNode | null | undefined;
|
|
24
23
|
/** The contents of the tooltip. */
|
|
25
24
|
children?: ReactNode;
|
|
26
25
|
/**
|
|
@@ -46,6 +45,22 @@ export type InformationalTooltipProps = {
|
|
|
46
45
|
* @default false
|
|
47
46
|
*/
|
|
48
47
|
defaultOpen?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* By default, tooltip opens on hover and on click (for mobile support). If you want to disable the click event, set this to true.
|
|
50
|
+
* @default false
|
|
51
|
+
*/
|
|
52
|
+
disableClick?: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Optional overrides for props of each tooltip element.
|
|
55
|
+
*
|
|
56
|
+
* Valid keys are: `tooltip`, `heading`.
|
|
57
|
+
*/
|
|
58
|
+
overrides?: {
|
|
59
|
+
/** The main tooltip element */
|
|
60
|
+
tooltip?: HTMLMotionProps<'div'>,
|
|
61
|
+
/** The heading element */
|
|
62
|
+
heading?: ComponentPropsWithoutRef<'div'>,
|
|
63
|
+
}
|
|
49
64
|
};
|
|
50
65
|
|
|
51
66
|
/**
|
|
@@ -64,12 +79,13 @@ export const InformationalTooltip: FC<InformationalTooltipProps> = ({
|
|
|
64
79
|
size = 'large',
|
|
65
80
|
trigger,
|
|
66
81
|
heading,
|
|
67
|
-
headingIcon,
|
|
68
82
|
children,
|
|
69
83
|
side = 'bottom',
|
|
70
84
|
sideOffset = 6,
|
|
71
85
|
align = 'start',
|
|
72
86
|
defaultOpen = false,
|
|
87
|
+
disableClick = false,
|
|
88
|
+
overrides,
|
|
73
89
|
}) => {
|
|
74
90
|
const [isOpen, setOpen] = useState(defaultOpen);
|
|
75
91
|
|
|
@@ -103,7 +119,13 @@ export const InformationalTooltip: FC<InformationalTooltipProps> = ({
|
|
|
103
119
|
open={isOpen}
|
|
104
120
|
onOpenChange={setOpen}
|
|
105
121
|
>
|
|
106
|
-
<RadixTooltip.Trigger
|
|
122
|
+
<RadixTooltip.Trigger
|
|
123
|
+
onClick={() => {
|
|
124
|
+
if (!disableClick) {
|
|
125
|
+
setOpen(!isOpen);
|
|
126
|
+
}
|
|
127
|
+
}}
|
|
128
|
+
>
|
|
107
129
|
{!trigger ? (
|
|
108
130
|
<Icon icon={Info} size={14} className={styles.icon} style={{ color: pvar('new.colors.contentSecondary') }} />
|
|
109
131
|
) : (
|
|
@@ -126,13 +148,14 @@ export const InformationalTooltip: FC<InformationalTooltipProps> = ({
|
|
|
126
148
|
animate={{ opacity: 1, y: 0 }}
|
|
127
149
|
exit={{ opacity: 0, y: 3 }}
|
|
128
150
|
transition={{ duration: parseCSSTime(pget('new.animations.duration.normal')) / 1000 }}
|
|
129
|
-
|
|
151
|
+
{...overrides?.tooltip}
|
|
152
|
+
className={clsx(styles.tooltip, styles[size], overrides?.tooltip?.className)}
|
|
130
153
|
>
|
|
131
154
|
{heading && (
|
|
132
|
-
<div
|
|
133
|
-
{
|
|
134
|
-
|
|
135
|
-
|
|
155
|
+
<div
|
|
156
|
+
{...overrides?.heading}
|
|
157
|
+
className={clsx(styles.heading, overrides?.heading?.className)}
|
|
158
|
+
>
|
|
136
159
|
<TextWhenString as="p" kind="paragraphXSmall" weight="medium">
|
|
137
160
|
{heading}
|
|
138
161
|
</TextWhenString>
|