@pingux/astro 2.96.0 → 2.97.0-alpha.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.
- package/lib/cjs/components/SelectField/SelectField.stories.d.ts +1 -0
- package/lib/cjs/components/SelectField/SelectField.stories.js +16 -2
- package/lib/cjs/components/SelectField/SelectField.test.js +10 -0
- package/lib/cjs/components/TooltipTrigger/Tooltip.styles.js +8 -1
- package/lib/cjs/components/TooltipTrigger/TooltipTrigger.stories.js +10 -1
- package/lib/cjs/types/selectField.d.ts +1 -0
- package/lib/cjs/utils/designUtils/figmaLinks.d.ts +3 -0
- package/lib/cjs/utils/designUtils/figmaLinks.js +3 -0
- package/lib/components/SelectField/SelectField.stories.js +13 -0
- package/lib/components/SelectField/SelectField.test.js +11 -1
- package/lib/components/TooltipTrigger/Tooltip.styles.js +6 -0
- package/lib/components/TooltipTrigger/TooltipTrigger.stories.js +10 -1
- package/lib/utils/designUtils/figmaLinks.js +3 -0
- package/package.json +1 -1
@@ -21,7 +21,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
21
21
|
_Object$defineProperty(exports, "__esModule", {
|
22
22
|
value: true
|
23
23
|
});
|
24
|
-
exports["default"] = exports.WithoutStatusIndicator = exports.WithSlots = exports.WithSections = exports.WithNoneOption = exports.WithCustomHeight = exports.NoOptionsAvailable = exports.HelperText = exports.FloatLabel = exports.DynamicItems = exports.DisabledOptions = exports.DisabledField = exports.Default = exports.Controlled = exports.AsyncLoading = void 0;
|
24
|
+
exports["default"] = exports.WithoutStatusIndicator = exports.WithSlots = exports.WithSections = exports.WithNoneOption = exports.WithHelpHint = exports.WithCustomHeight = exports.NoOptionsAvailable = exports.HelperText = exports.FloatLabel = exports.DynamicItems = exports.DisabledOptions = exports.DisabledField = exports.Default = exports.Controlled = exports.AsyncLoading = void 0;
|
25
25
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/asyncToGenerator"));
|
26
26
|
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/values"));
|
27
27
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
@@ -443,4 +443,18 @@ var WithoutStatusIndicator = function WithoutStatusIndicator() {
|
|
443
443
|
key: "yellow"
|
444
444
|
}, "Yellow"));
|
445
445
|
};
|
446
|
-
exports.WithoutStatusIndicator = WithoutStatusIndicator;
|
446
|
+
exports.WithoutStatusIndicator = WithoutStatusIndicator;
|
447
|
+
var WithHelpHint = function WithHelpHint() {
|
448
|
+
return (0, _react2.jsx)(_reactAria.OverlayProvider, null, (0, _react2.jsx)(_index.SelectField, {
|
449
|
+
width: "100%",
|
450
|
+
hintText: "Example Hint",
|
451
|
+
label: "What's your favorite color?"
|
452
|
+
}, (0, _react2.jsx)(_index.Item, {
|
453
|
+
key: "red"
|
454
|
+
}, "Red"), (0, _react2.jsx)(_index.Item, {
|
455
|
+
key: "blue"
|
456
|
+
}, "Blue"), (0, _react2.jsx)(_index.Item, {
|
457
|
+
key: "yellow"
|
458
|
+
}, "Yellow")));
|
459
|
+
};
|
460
|
+
exports.WithHelpHint = WithHelpHint;
|
@@ -171,4 +171,14 @@ test('renders default placeholder text', function () {
|
|
171
171
|
});
|
172
172
|
var placeholder = _testWrapper.screen.getByText(placeholderText);
|
173
173
|
expect(placeholder).toBeInTheDocument();
|
174
|
+
});
|
175
|
+
test('should show hintText text if prop is passed', function () {
|
176
|
+
var hintText = 'some hint text';
|
177
|
+
getComponent({
|
178
|
+
hintText: hintText
|
179
|
+
});
|
180
|
+
var helpHintButton = _testWrapper.screen.getByTestId('help-hint__button');
|
181
|
+
_testWrapper.fireEvent.mouseMove(helpHintButton);
|
182
|
+
_testWrapper.fireEvent.mouseEnter(helpHintButton);
|
183
|
+
expect(_testWrapper.screen.getByText(hintText)).toBeInTheDocument();
|
174
184
|
});
|
@@ -12,7 +12,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
12
12
|
_Object$defineProperty(exports, "__esModule", {
|
13
13
|
value: true
|
14
14
|
});
|
15
|
-
exports["default"] = exports.container = exports.button = void 0;
|
15
|
+
exports["default"] = exports.container = exports.button = exports.badgeTooltipContainer = void 0;
|
16
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
17
17
|
var _Badge = require("../Badge/Badge.styles");
|
18
18
|
var _Buttons = require("../Button/Buttons.styles");
|
@@ -30,6 +30,12 @@ var container = {
|
|
30
30
|
}
|
31
31
|
};
|
32
32
|
exports.container = container;
|
33
|
+
var badgeTooltipContainer = _objectSpread(_objectSpread({}, container), {}, {
|
34
|
+
fontSize: 'sm',
|
35
|
+
fontWeight: '1',
|
36
|
+
lineHeight: '15.87px'
|
37
|
+
});
|
38
|
+
exports.badgeTooltipContainer = badgeTooltipContainer;
|
33
39
|
var badge = _objectSpread(_objectSpread({}, _Badge.baseBadge), {}, {
|
34
40
|
cursor: 'default',
|
35
41
|
'&.is-hovered, &.is-pressed': {
|
@@ -59,6 +65,7 @@ var inline = _objectSpread(_objectSpread({}, _Buttons.text), {}, {
|
|
59
65
|
});
|
60
66
|
var _default = {
|
61
67
|
container: container,
|
68
|
+
badgeTooltipContainer: badgeTooltipContainer,
|
62
69
|
badge: badge,
|
63
70
|
button: button,
|
64
71
|
inline: inline
|
@@ -11,6 +11,7 @@ var _AccountIcon = _interopRequireDefault(require("@pingux/mdi-react/AccountIcon
|
|
11
11
|
var _EarthIcon = _interopRequireDefault(require("@pingux/mdi-react/EarthIcon"));
|
12
12
|
var _storybookDocsLayout = _interopRequireDefault(require("../../../.storybook/storybookDocsLayout"));
|
13
13
|
var _index = require("../../index");
|
14
|
+
var _figmaLinks = require("../../utils/designUtils/figmaLinks");
|
14
15
|
var _TooltipTrigger = _interopRequireDefault(require("./TooltipTrigger.mdx"));
|
15
16
|
var _react2 = require("@emotion/react");
|
16
17
|
var _default = {
|
@@ -112,9 +113,17 @@ var BadgeWithTooltip = function BadgeWithTooltip() {
|
|
112
113
|
textTransform: 'uppercase'
|
113
114
|
},
|
114
115
|
color: "white"
|
115
|
-
}, "Some text")), (0, _react2.jsx)(_index.Tooltip,
|
116
|
+
}, "Some text")), (0, _react2.jsx)(_index.Tooltip, {
|
117
|
+
variant: "variants.tooltip.badgeTooltipContainer"
|
118
|
+
}, "Useful tooltip")));
|
116
119
|
};
|
117
120
|
exports.BadgeWithTooltip = BadgeWithTooltip;
|
121
|
+
BadgeWithTooltip.parameters = {
|
122
|
+
design: {
|
123
|
+
type: 'figma',
|
124
|
+
url: _figmaLinks.FIGMA_LINKS.tooltipTrigger.badgeWithTooltip
|
125
|
+
}
|
126
|
+
};
|
118
127
|
var TextWithTooltip = function TextWithTooltip() {
|
119
128
|
return (0, _react2.jsx)(_index.Box, {
|
120
129
|
pl: 50
|
@@ -10,6 +10,7 @@ export interface SelectFieldProps<T> extends Omit<StyleProps, 'direction'>, UseS
|
|
10
10
|
inContainer?: React.ReactNode;
|
11
11
|
};
|
12
12
|
'data-testid'?: string;
|
13
|
+
hintText?: string;
|
13
14
|
}
|
14
15
|
export interface SelectFieldBaseProps extends UseSelectFieldReturnProps<object>, SharedFieldProps {
|
15
16
|
slots?: {
|
@@ -188,6 +188,9 @@ var FIGMA_LINKS = {
|
|
188
188
|
withoutButton: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16196&t=OK8Fy4P3se6BKy0F-4',
|
189
189
|
withoutLink: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16201&t=OK8Fy4P3se6BKy0F-4'
|
190
190
|
},
|
191
|
+
tooltipTrigger: {
|
192
|
+
badgeWithTooltip: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=59201-5404&t=wsQsGpX0SmOiAweL-4'
|
193
|
+
},
|
191
194
|
editButton: {
|
192
195
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6267&t=pXTSE3YlGbL0X49N-4'
|
193
196
|
}
|
@@ -417,4 +417,17 @@ export var WithoutStatusIndicator = function WithoutStatusIndicator() {
|
|
417
417
|
}, "Blue"), ___EmotionJSX(Item, {
|
418
418
|
key: "yellow"
|
419
419
|
}, "Yellow"));
|
420
|
+
};
|
421
|
+
export var WithHelpHint = function WithHelpHint() {
|
422
|
+
return ___EmotionJSX(OverlayProvider, null, ___EmotionJSX(SelectField, {
|
423
|
+
width: "100%",
|
424
|
+
hintText: "Example Hint",
|
425
|
+
label: "What's your favorite color?"
|
426
|
+
}, ___EmotionJSX(Item, {
|
427
|
+
key: "red"
|
428
|
+
}, "Red"), ___EmotionJSX(Item, {
|
429
|
+
key: "blue"
|
430
|
+
}, "Blue"), ___EmotionJSX(Item, {
|
431
|
+
key: "yellow"
|
432
|
+
}, "Yellow")));
|
420
433
|
};
|
@@ -4,7 +4,7 @@ import { OverlayProvider } from 'react-aria';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
5
5
|
import { Item, Section, SelectField } from '../../index';
|
6
6
|
import statuses from '../../utils/devUtils/constants/statuses';
|
7
|
-
import { render, screen } from '../../utils/testUtils/testWrapper';
|
7
|
+
import { fireEvent, render, screen } from '../../utils/testUtils/testWrapper';
|
8
8
|
import { universalComponentTests } from '../../utils/testUtils/universalComponentTest';
|
9
9
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
10
10
|
var items = [{
|
@@ -168,4 +168,14 @@ test('renders default placeholder text', function () {
|
|
168
168
|
});
|
169
169
|
var placeholder = screen.getByText(placeholderText);
|
170
170
|
expect(placeholder).toBeInTheDocument();
|
171
|
+
});
|
172
|
+
test('should show hintText text if prop is passed', function () {
|
173
|
+
var hintText = 'some hint text';
|
174
|
+
getComponent({
|
175
|
+
hintText: hintText
|
176
|
+
});
|
177
|
+
var helpHintButton = screen.getByTestId('help-hint__button');
|
178
|
+
fireEvent.mouseMove(helpHintButton);
|
179
|
+
fireEvent.mouseEnter(helpHintButton);
|
180
|
+
expect(screen.getByText(hintText)).toBeInTheDocument();
|
171
181
|
});
|
@@ -22,6 +22,11 @@ export var container = {
|
|
22
22
|
WebkitLineClamp: '4'
|
23
23
|
}
|
24
24
|
};
|
25
|
+
export var badgeTooltipContainer = _objectSpread(_objectSpread({}, container), {}, {
|
26
|
+
fontSize: 'sm',
|
27
|
+
fontWeight: '1',
|
28
|
+
lineHeight: '15.87px'
|
29
|
+
});
|
25
30
|
var badge = _objectSpread(_objectSpread({}, baseBadge), {}, {
|
26
31
|
cursor: 'default',
|
27
32
|
'&.is-hovered, &.is-pressed': {
|
@@ -50,6 +55,7 @@ var inline = _objectSpread(_objectSpread({}, text), {}, {
|
|
50
55
|
});
|
51
56
|
export default {
|
52
57
|
container: container,
|
58
|
+
badgeTooltipContainer: badgeTooltipContainer,
|
53
59
|
badge: badge,
|
54
60
|
button: button,
|
55
61
|
inline: inline
|
@@ -3,6 +3,7 @@ import AccountIcon from '@pingux/mdi-react/AccountIcon';
|
|
3
3
|
import Earth from '@pingux/mdi-react/EarthIcon';
|
4
4
|
import DocsLayout from '../../../.storybook/storybookDocsLayout';
|
5
5
|
import { Box, Button, Icon, IconButton, Text, Tooltip, TooltipTrigger } from '../../index';
|
6
|
+
import { FIGMA_LINKS } from '../../utils/designUtils/figmaLinks';
|
6
7
|
import TooltipTriggerReadme from './TooltipTrigger.mdx';
|
7
8
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
8
9
|
export default {
|
@@ -94,7 +95,15 @@ export var BadgeWithTooltip = function BadgeWithTooltip() {
|
|
94
95
|
textTransform: 'uppercase'
|
95
96
|
},
|
96
97
|
color: "white"
|
97
|
-
}, "Some text")), ___EmotionJSX(Tooltip,
|
98
|
+
}, "Some text")), ___EmotionJSX(Tooltip, {
|
99
|
+
variant: "variants.tooltip.badgeTooltipContainer"
|
100
|
+
}, "Useful tooltip")));
|
101
|
+
};
|
102
|
+
BadgeWithTooltip.parameters = {
|
103
|
+
design: {
|
104
|
+
type: 'figma',
|
105
|
+
url: FIGMA_LINKS.tooltipTrigger.badgeWithTooltip
|
106
|
+
}
|
98
107
|
};
|
99
108
|
export var TextWithTooltip = function TextWithTooltip() {
|
100
109
|
return ___EmotionJSX(Box, {
|
@@ -181,6 +181,9 @@ export var FIGMA_LINKS = {
|
|
181
181
|
withoutButton: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16196&t=OK8Fy4P3se6BKy0F-4',
|
182
182
|
withoutLink: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=52102-16201&t=OK8Fy4P3se6BKy0F-4'
|
183
183
|
},
|
184
|
+
tooltipTrigger: {
|
185
|
+
badgeWithTooltip: 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=59201-5404&t=wsQsGpX0SmOiAweL-4'
|
186
|
+
},
|
184
187
|
editButton: {
|
185
188
|
"default": 'https://www.figma.com/file/bpbEw54gTTcdIiZs4PKK1p/Astro-Specs?node-id=58623-6267&t=pXTSE3YlGbL0X49N-4'
|
186
189
|
}
|