@pingux/astro 1.39.0-alpha.1 → 1.39.0-alpha.3
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/IconButton/IconButton.js +3 -1
- package/lib/cjs/components/ListBox/ListBox.test.js +18 -0
- package/lib/cjs/components/ListBox/Option.js +11 -2
- package/lib/cjs/recipes/ListAndPanel.stories.js +1 -0
- package/lib/components/IconButton/IconButton.js +3 -1
- package/lib/components/ListBox/ListBox.test.js +11 -0
- package/lib/components/ListBox/Option.js +11 -2
- package/lib/recipes/ListAndPanel.stories.js +1 -0
- package/package.json +1 -1
@@ -127,7 +127,9 @@ var IconButton = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
127
127
|
fill: chipBg
|
128
128
|
}
|
129
129
|
}
|
130
|
-
}, (0, _utils.mergeProps)(buttonProps, others, hoverProps, focusProps)
|
130
|
+
}, (0, _utils.mergeProps)(buttonProps, others, hoverProps, focusProps), {
|
131
|
+
onPointerOver: hoverProps.onPointerEnter
|
132
|
+
}), children);
|
131
133
|
|
132
134
|
if (title) {
|
133
135
|
return (0, _react2.jsx)(_TooltipTrigger["default"], {
|
@@ -18,6 +18,8 @@ var _react2 = require("@testing-library/react");
|
|
18
18
|
|
19
19
|
var _collections = require("@react-stately/collections");
|
20
20
|
|
21
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
22
|
+
|
21
23
|
var _ = _interopRequireDefault(require("."));
|
22
24
|
|
23
25
|
var _index = require("../../index");
|
@@ -168,4 +170,20 @@ test('renders sections and items within section', function () {
|
|
168
170
|
var options = _react2.screen.getAllByRole('option');
|
169
171
|
|
170
172
|
expect(options.length).toBe(itemsWithSections[0].options.length);
|
173
|
+
});
|
174
|
+
test('should have is-focused class when hover', function () {
|
175
|
+
getSectionsComponent();
|
176
|
+
|
177
|
+
var options = _react2.screen.getAllByRole('option');
|
178
|
+
|
179
|
+
expect(options[0]).not.toHaveClass('is-focused');
|
180
|
+
|
181
|
+
_userEvent["default"].hover(options[0]);
|
182
|
+
|
183
|
+
expect(options[0]).toHaveClass('is-focused');
|
184
|
+
|
185
|
+
_userEvent["default"].hover(options[1]);
|
186
|
+
|
187
|
+
expect(options[0]).not.toHaveClass('is-focused');
|
188
|
+
expect(options[1]).toHaveClass('is-focused');
|
171
189
|
});
|
@@ -96,9 +96,17 @@ var Option = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
96
96
|
isSelected = _useOption.isSelected,
|
97
97
|
isFocused = _useOption.isFocused;
|
98
98
|
|
99
|
+
var focused = isFocused || (state === null || state === void 0 ? void 0 : (_state$selectionManag = state.selectionManager) === null || _state$selectionManag === void 0 ? void 0 : _state$selectionManag.focusedKey) === item.key;
|
100
|
+
|
101
|
+
var setFocusOnHover = function setFocusOnHover() {
|
102
|
+
if (!focused) {
|
103
|
+
state.selectionManager.setFocusedKey(item.key);
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
99
107
|
var _useStatusClasses = (0, _hooks.useStatusClasses)(null, {
|
100
108
|
isDisabled: isDisabled || isSeparator,
|
101
|
-
isFocused:
|
109
|
+
isFocused: focused,
|
102
110
|
isSelected: isSelected
|
103
111
|
}),
|
104
112
|
classNames = _useStatusClasses.classNames;
|
@@ -115,7 +123,8 @@ var Option = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
115
123
|
ref: optionRef,
|
116
124
|
variant: "listBox.option",
|
117
125
|
"data-id": dataId,
|
118
|
-
className: classNames
|
126
|
+
className: classNames,
|
127
|
+
onPointerOver: setFocusOnHover
|
119
128
|
}, optionProps, others), isSelected && (0, _react2.jsx)(_Icon["default"], {
|
120
129
|
icon: _CircleSmallIcon["default"]
|
121
130
|
}), rendered);
|
@@ -379,6 +379,7 @@ var Default = function Default() {
|
|
379
379
|
title: "Profile"
|
380
380
|
}, selectedItemId >= 0 && (0, _react2.jsx)(_react["default"].Fragment, null, (0, _react2.jsx)(_index.IconButton, {
|
381
381
|
variant: "inverted",
|
382
|
+
"aria-label": "pencil icon button",
|
382
383
|
sx: sx.iconButton
|
383
384
|
}, (0, _react2.jsx)(_PencilIcon["default"], {
|
384
385
|
size: 20
|
@@ -90,7 +90,9 @@ var IconButton = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
90
90
|
fill: chipBg
|
91
91
|
}
|
92
92
|
}
|
93
|
-
}, mergeProps(buttonProps, others, hoverProps, focusProps)
|
93
|
+
}, mergeProps(buttonProps, others, hoverProps, focusProps), {
|
94
|
+
onPointerOver: hoverProps.onPointerEnter
|
95
|
+
}), children);
|
94
96
|
|
95
97
|
if (title) {
|
96
98
|
return ___EmotionJSX(TooltipTrigger, {
|
@@ -6,6 +6,7 @@ import { axe } from 'jest-axe';
|
|
6
6
|
import { useListState } from '@react-stately/list';
|
7
7
|
import { render, screen } from '@testing-library/react';
|
8
8
|
import { Section } from '@react-stately/collections';
|
9
|
+
import userEvent from '@testing-library/user-event';
|
9
10
|
import ListBox from '.';
|
10
11
|
import { Item } from '../../index';
|
11
12
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
@@ -145,4 +146,14 @@ test('renders sections and items within section', function () {
|
|
145
146
|
expect(section).toBeInTheDocument();
|
146
147
|
var options = screen.getAllByRole('option');
|
147
148
|
expect(options.length).toBe(itemsWithSections[0].options.length);
|
149
|
+
});
|
150
|
+
test('should have is-focused class when hover', function () {
|
151
|
+
getSectionsComponent();
|
152
|
+
var options = screen.getAllByRole('option');
|
153
|
+
expect(options[0]).not.toHaveClass('is-focused');
|
154
|
+
userEvent.hover(options[0]);
|
155
|
+
expect(options[0]).toHaveClass('is-focused');
|
156
|
+
userEvent.hover(options[1]);
|
157
|
+
expect(options[0]).not.toHaveClass('is-focused');
|
158
|
+
expect(options[1]).toHaveClass('is-focused');
|
148
159
|
});
|
@@ -58,9 +58,17 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
58
58
|
isSelected = _useOption.isSelected,
|
59
59
|
isFocused = _useOption.isFocused;
|
60
60
|
|
61
|
+
var focused = isFocused || (state === null || state === void 0 ? void 0 : (_state$selectionManag = state.selectionManager) === null || _state$selectionManag === void 0 ? void 0 : _state$selectionManag.focusedKey) === item.key;
|
62
|
+
|
63
|
+
var setFocusOnHover = function setFocusOnHover() {
|
64
|
+
if (!focused) {
|
65
|
+
state.selectionManager.setFocusedKey(item.key);
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
61
69
|
var _useStatusClasses = useStatusClasses(null, {
|
62
70
|
isDisabled: isDisabled || isSeparator,
|
63
|
-
isFocused:
|
71
|
+
isFocused: focused,
|
64
72
|
isSelected: isSelected
|
65
73
|
}),
|
66
74
|
classNames = _useStatusClasses.classNames;
|
@@ -77,7 +85,8 @@ var Option = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
77
85
|
ref: optionRef,
|
78
86
|
variant: "listBox.option",
|
79
87
|
"data-id": dataId,
|
80
|
-
className: classNames
|
88
|
+
className: classNames,
|
89
|
+
onPointerOver: setFocusOnHover
|
81
90
|
}, optionProps, others), isSelected && ___EmotionJSX(Icon, {
|
82
91
|
icon: CircleSmallIcon
|
83
92
|
}), rendered);
|
@@ -342,6 +342,7 @@ export var Default = function Default() {
|
|
342
342
|
title: "Profile"
|
343
343
|
}, selectedItemId >= 0 && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(IconButton, {
|
344
344
|
variant: "inverted",
|
345
|
+
"aria-label": "pencil icon button",
|
345
346
|
sx: sx.iconButton
|
346
347
|
}, ___EmotionJSX(PencilIcon, {
|
347
348
|
size: 20
|