@automattic/vip-design-system 0.18.3-0 → 0.18.4-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/build/system/Dropdown/Dropdown.stories.js +1 -5
- package/build/system/NewConfirmationDialog/NewConfirmationDialog.js +9 -11
- package/build/system/Tooltip/Tooltip.js +15 -4
- package/build/system/Tooltip/Tooltip.stories.js +2 -1
- package/package.json +1 -1
- package/src/system/Dropdown/Dropdown.stories.jsx +1 -5
- package/src/system/NewConfirmationDialog/NewConfirmationDialog.js +2 -0
- package/src/system/Tooltip/Tooltip.js +5 -4
- package/src/system/Tooltip/Tooltip.stories.jsx +1 -1
|
@@ -159,11 +159,6 @@ var WithDialog = function WithDialog() {
|
|
|
159
159
|
var onConfirm = _ref.onConfirm,
|
|
160
160
|
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
|
|
161
161
|
return (0, _jsxRuntime.jsx)(NewDialog.Root, (0, _extends2["default"])({}, props, {
|
|
162
|
-
contentProps: {
|
|
163
|
-
onCloseAutoFocus: function onCloseAutoFocus() {
|
|
164
|
-
onConfirm();
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
162
|
content: (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
168
163
|
children: [(0, _jsxRuntime.jsx)(_Button.Button, {
|
|
169
164
|
variant: "secondary",
|
|
@@ -182,6 +177,7 @@ var WithDialog = function WithDialog() {
|
|
|
182
177
|
children: [(0, _jsxRuntime.jsx)("p", {
|
|
183
178
|
children: "This is an important example when combining the Dropdown component with the NewDialog component. In order to have the correct accessibility, there are some events you need to use. Use this example if you want to copy and paste the code."
|
|
184
179
|
}), (0, _jsxRuntime.jsxs)(Dropdown.Root, {
|
|
180
|
+
modal: !alertOpen,
|
|
185
181
|
open: menuOpen,
|
|
186
182
|
onOpenChange: setMenuOpen,
|
|
187
183
|
contentProps: {
|
|
@@ -5,6 +5,10 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.NewConfirmationDialog = void 0;
|
|
7
7
|
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
|
|
8
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
13
|
|
|
10
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -15,15 +19,8 @@ var _ = require("..");
|
|
|
15
19
|
|
|
16
20
|
var _jsxRuntime = require("theme-ui/jsx-runtime");
|
|
17
21
|
|
|
18
|
-
|
|
22
|
+
var _excluded = ["trigger", "onConfirm", "needsConfirm", "label", "buttonVariant", "title", "body"];
|
|
19
23
|
|
|
20
|
-
/**
|
|
21
|
-
* External dependencies
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Internal dependencies
|
|
26
|
-
*/
|
|
27
24
|
var NewConfirmationDialogContent = function NewConfirmationDialogContent(_ref) {
|
|
28
25
|
var _ref$label = _ref.label,
|
|
29
26
|
label = _ref$label === void 0 ? 'Confirm' : _ref$label,
|
|
@@ -79,7 +76,8 @@ var NewConfirmationDialog = function NewConfirmationDialog(_ref2) {
|
|
|
79
76
|
buttonVariant = _ref2.buttonVariant,
|
|
80
77
|
title = _ref2.title,
|
|
81
78
|
_ref2$body = _ref2.body,
|
|
82
|
-
body = _ref2$body === void 0 ? '' : _ref2$body
|
|
79
|
+
body = _ref2$body === void 0 ? '' : _ref2$body,
|
|
80
|
+
props = (0, _objectWithoutPropertiesLoose2["default"])(_ref2, _excluded);
|
|
83
81
|
|
|
84
82
|
var _React$useState = _react["default"].useState(false),
|
|
85
83
|
open = _React$useState[0],
|
|
@@ -93,7 +91,7 @@ var NewConfirmationDialog = function NewConfirmationDialog(_ref2) {
|
|
|
93
91
|
return directTrigger;
|
|
94
92
|
}
|
|
95
93
|
|
|
96
|
-
return (0, _jsxRuntime.jsx)(_.NewDialog.Root, {
|
|
94
|
+
return (0, _jsxRuntime.jsx)(_.NewDialog.Root, (0, _extends2["default"])({
|
|
97
95
|
open: open,
|
|
98
96
|
onOpenChange: setOpen,
|
|
99
97
|
sx: {
|
|
@@ -111,7 +109,7 @@ var NewConfirmationDialog = function NewConfirmationDialog(_ref2) {
|
|
|
111
109
|
buttonVariant: buttonVariant
|
|
112
110
|
}),
|
|
113
111
|
trigger: trigger
|
|
114
|
-
});
|
|
112
|
+
}, props));
|
|
115
113
|
};
|
|
116
114
|
|
|
117
115
|
exports.NewConfirmationDialog = NewConfirmationDialog;
|
|
@@ -35,7 +35,11 @@ var StyledArrow = function StyledArrow(props) {
|
|
|
35
35
|
|
|
36
36
|
var Tooltip = function Tooltip(_ref) {
|
|
37
37
|
var _ref$trigger = _ref.trigger,
|
|
38
|
-
trigger = _ref$trigger === void 0 ? (0, _jsxRuntime.jsx)(_md.MdHelp, {
|
|
38
|
+
trigger = _ref$trigger === void 0 ? (0, _jsxRuntime.jsx)(_md.MdHelp, {
|
|
39
|
+
sx: {
|
|
40
|
+
fill: 'text'
|
|
41
|
+
}
|
|
42
|
+
}) : _ref$trigger,
|
|
39
43
|
_ref$text = _ref.text,
|
|
40
44
|
text = _ref$text === void 0 ? '' : _ref$text,
|
|
41
45
|
_ref$width = _ref.width,
|
|
@@ -67,7 +71,12 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
67
71
|
background: 'transparent',
|
|
68
72
|
border: 'none',
|
|
69
73
|
display: 'inline-flex',
|
|
70
|
-
|
|
74
|
+
'&:focus': function focus(theme) {
|
|
75
|
+
return theme.outline;
|
|
76
|
+
},
|
|
77
|
+
'&:focus-visible': function focusVisible(theme) {
|
|
78
|
+
return theme.outline;
|
|
79
|
+
},
|
|
71
80
|
p: 0,
|
|
72
81
|
m: 0
|
|
73
82
|
},
|
|
@@ -75,12 +84,14 @@ var Tooltip = function Tooltip(_ref) {
|
|
|
75
84
|
children: [(0, _jsxRuntime.jsx)(_.Card, (0, _extends2["default"])({
|
|
76
85
|
className: "tooltip-content",
|
|
77
86
|
sx: {
|
|
78
|
-
width: width
|
|
87
|
+
width: width,
|
|
88
|
+
background: 'dialog'
|
|
79
89
|
}
|
|
80
90
|
}, props, {
|
|
81
91
|
children: children ? children : (0, _jsxRuntime.jsx)(_.Text, {
|
|
82
92
|
sx: {
|
|
83
|
-
fontSize:
|
|
93
|
+
fontSize: 2,
|
|
94
|
+
color: 'text'
|
|
84
95
|
},
|
|
85
96
|
children: text
|
|
86
97
|
})
|
|
@@ -30,7 +30,8 @@ var Default = function Default() {
|
|
|
30
30
|
}), (0, _jsxRuntime.jsx)(_.Tooltip, {
|
|
31
31
|
children: (0, _jsxRuntime.jsxs)(_.Text, {
|
|
32
32
|
sx: {
|
|
33
|
-
fontSize: 1
|
|
33
|
+
fontSize: 1,
|
|
34
|
+
color: 'text'
|
|
34
35
|
},
|
|
35
36
|
children: ["This is a tooltip that can be used to describe various pieces of functionality.", (0, _jsxRuntime.jsx)("br", {}), (0, _jsxRuntime.jsx)(_.Link, {
|
|
36
37
|
children: "Find out more \u2192"
|
package/package.json
CHANGED
|
@@ -120,11 +120,6 @@ export const WithDialog = () => {
|
|
|
120
120
|
const AreYouSureDialog = ( { onConfirm, ...props } ) => (
|
|
121
121
|
<NewDialog.Root
|
|
122
122
|
{ ...props }
|
|
123
|
-
contentProps={ {
|
|
124
|
-
onCloseAutoFocus: () => {
|
|
125
|
-
onConfirm();
|
|
126
|
-
},
|
|
127
|
-
} }
|
|
128
123
|
content={
|
|
129
124
|
<>
|
|
130
125
|
<Button variant="secondary" onClick={ () => onConfirm() }>
|
|
@@ -146,6 +141,7 @@ export const WithDialog = () => {
|
|
|
146
141
|
</p>
|
|
147
142
|
|
|
148
143
|
<Dropdown.Root
|
|
144
|
+
modal={ ! alertOpen }
|
|
149
145
|
open={ menuOpen }
|
|
150
146
|
onOpenChange={ setMenuOpen }
|
|
151
147
|
contentProps={ { sideOffset: 5 } }
|
|
@@ -56,6 +56,7 @@ const NewConfirmationDialog = ( {
|
|
|
56
56
|
buttonVariant,
|
|
57
57
|
title,
|
|
58
58
|
body = '',
|
|
59
|
+
...props
|
|
59
60
|
} ) => {
|
|
60
61
|
const [ open, setOpen ] = React.useState( false );
|
|
61
62
|
const directTrigger = React.cloneElement( trigger, { onClick: onConfirm } );
|
|
@@ -81,6 +82,7 @@ const NewConfirmationDialog = ( {
|
|
|
81
82
|
/>
|
|
82
83
|
}
|
|
83
84
|
trigger={ trigger }
|
|
85
|
+
{ ...props }
|
|
84
86
|
/>
|
|
85
87
|
);
|
|
86
88
|
};
|
|
@@ -15,7 +15,7 @@ import { Card, Text } from '..';
|
|
|
15
15
|
const StyledArrow = props => <TooltipPrimitive.Arrow sx={ { fill: 'white' } } { ...props } />;
|
|
16
16
|
|
|
17
17
|
const Tooltip = ( {
|
|
18
|
-
trigger = <MdHelp />,
|
|
18
|
+
trigger = <MdHelp sx={ { fill: 'text' } } />,
|
|
19
19
|
text = '',
|
|
20
20
|
width = 200,
|
|
21
21
|
children,
|
|
@@ -48,7 +48,8 @@ const Tooltip = ( {
|
|
|
48
48
|
background: 'transparent',
|
|
49
49
|
border: 'none',
|
|
50
50
|
display: 'inline-flex',
|
|
51
|
-
|
|
51
|
+
'&:focus': theme => theme.outline,
|
|
52
|
+
'&:focus-visible': theme => theme.outline,
|
|
52
53
|
p: 0,
|
|
53
54
|
m: 0,
|
|
54
55
|
} }
|
|
@@ -56,8 +57,8 @@ const Tooltip = ( {
|
|
|
56
57
|
{ trigger }
|
|
57
58
|
|
|
58
59
|
<TooltipPrimitive.Content>
|
|
59
|
-
<Card className="tooltip-content" sx={ { width:
|
|
60
|
-
{ children ? children : <Text sx={ { fontSize:
|
|
60
|
+
<Card className="tooltip-content" sx={ { width, background: 'dialog' } } { ...props }>
|
|
61
|
+
{ children ? children : <Text sx={ { fontSize: 2, color: 'text' } }>{ text }</Text> }
|
|
61
62
|
</Card>
|
|
62
63
|
<StyledArrow />
|
|
63
64
|
</TooltipPrimitive.Content>
|
|
@@ -12,7 +12,7 @@ export const Default = () => (
|
|
|
12
12
|
<Flex sx={ { alignItems: 'center' } }>
|
|
13
13
|
<Heading sx={ { mb: 0, mr: 2 } }>My Section Heading</Heading>
|
|
14
14
|
<Tooltip>
|
|
15
|
-
<Text sx={ { fontSize: 1 } }>
|
|
15
|
+
<Text sx={ { fontSize: 1, color: 'text' } }>
|
|
16
16
|
This is a tooltip that can be used to describe various pieces of functionality.
|
|
17
17
|
<br />
|
|
18
18
|
<Link>Find out more →</Link>
|