@enact/limestone 1.9.3 → 1.10.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/.github/workflows/ci-reusable.yml +2 -2
- package/Alert/Alert.d.ts +9 -0
- package/Alert/Alert.js +35 -4
- package/Alert/Alert.module.css +12 -1
- package/Alert/tests/Alert-specs.js +91 -0
- package/Button/tests/Button-specs.js +26 -0
- package/CHANGELOG.md +34 -0
- package/Card/Card.d.ts +4 -4
- package/Card/Card.js +7 -8
- package/Card/tests/Card-specs.js +39 -5
- package/CheckboxItem/CheckboxItem.js +6 -4
- package/Chips/Chip.js +12 -6
- package/Chips/Chips.js +12 -6
- package/Chips/tests/Chip-specs.js +25 -5
- package/Chips/tests/Chips-specs.js +12 -2
- package/ColorPicker/ColorPicker.js +27 -25
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +32 -22
- package/DayPicker/DaySelectorDecorator.js +12 -7
- package/Dropdown/Dropdown.module.css +4 -0
- package/Dropdown/DropdownList.js +74 -53
- package/FlexiblePopupPanels/useNavButtonFocus.js +7 -10
- package/Heading/Heading.d.ts +1 -1
- package/Heading/Heading.js +2 -2
- package/Icon/Icon.d.ts +1 -0
- package/Icon/Icon.js +1 -0
- package/Icon/IconList.js +2 -0
- package/IconItem/IconItem.module.css +3 -3
- package/IconItem/tests/IconItem-specs.js +30 -1
- package/Image/Image.js +6 -4
- package/Input/Input.js +12 -1
- package/Input/InputField.js +75 -24
- package/Input/InputField.module.css +262 -45
- package/Input/InputFieldDecoratorIcon.js +1 -0
- package/Input/InputFieldSpotlightDecorator.js +53 -8
- package/Input/index.d.ts +105 -93
- package/Input/tests/Input-specs.js +26 -0
- package/Input/tests/InputField-specs.js +149 -3
- package/Input/tests/InputPopup-specs.js +1 -1
- package/KeyGuide/KeyGuide.js +29 -27
- package/MediaOverlay/tests/MediaOverlay-specs.js +29 -0
- package/MediaPlayer/tests/util-specs.js +4 -1
- package/PageViews/PageViews.js +134 -69
- package/PageViews/PageViews.module.css +3 -0
- package/PageViews/PageViewsRouter.js +91 -42
- package/PageViews/tests/PageViews-specs.js +87 -0
- package/Panels/Header.js +6 -4
- package/Popup/Popup.js +5 -4
- package/PopupTabLayout/PopupTabLayout.js +11 -9
- package/RadioItem/RadioItem.js +7 -5
- package/Scroller/EditableWrapper.js +17 -14
- package/Scroller/Scroller.js +11 -10
- package/Scroller/useThemeScroller.js +3 -3
- package/Slider/Slider.d.ts +4 -0
- package/Slider/Slider.js +40 -16
- package/Slider/Slider.module.css +150 -0
- package/Slider/SliderBehaviorDecorator.js +16 -14
- package/Slider/tests/Slider-specs.js +51 -0
- package/Slider/utils.js +23 -7
- package/Spinner/Spinner.js +10 -8
- package/TabLayout/RefocusDecorator.js +14 -12
- package/TabLayout/tests/TabGroup-specs.js +1 -1
- package/ThemeDecorator/AccessibilityDecorator.js +12 -11
- package/ThemeDecorator/I18nFontDecorator.js +6 -4
- package/ThemeDecorator/ThemeDecorator.d.ts +7 -0
- package/ThemeDecorator/ThemeDecorator.js +24 -9
- package/TimePicker/TimePickerBase.js +5 -3
- package/TooltipDecorator/TooltipDecorator.js +12 -7
- package/TooltipDecorator/tests/useTooltip-specs.js +5 -2
- package/VideoPlayer/VideoPlayer.js +25 -24
- package/VirtualList/VirtualList.js +20 -18
- package/VirtualList/useSpotlight.js +1 -1
- package/fonts/Limestone_Icons.ttf +0 -0
- package/internal/AsyncRenderChildren/AsyncRenderChildren.js +9 -5
- package/internal/AsyncRenderChildren/tests/AsyncRenderChildren-specs.js +4 -1
- package/internal/DateTime/DateTimeDecorator.js +5 -4
- package/internal/Panels/PanelsRouter.js +35 -29
- package/internal/Panels/useAutoFocus.js +10 -6
- package/internal/Panels/useFocusOnTransition.js +4 -3
- package/internal/Picker/Picker.js +7 -5
- package/internal/Picker/SpottablePicker.js +15 -13
- package/internal/SharedStateDecorator/SharedStateDecorator.js +6 -4
- package/package.json +14 -11
- package/styles/colors.less +1 -0
- package/styles/variables.less +1 -1
- package/useScroll/HoverToScroll.js +15 -12
- package/useScroll/Scrollbar.js +14 -10
- package/useScroll/ScrollbarPlaceholder.js +3 -5
- package/useScroll/ScrollbarTrack.js +7 -5
- package/useScroll/useEvent.js +7 -2
- package/useScroll/useScroll.js +10 -2
|
@@ -9,7 +9,9 @@ describe('Chip', function () {
|
|
|
9
9
|
var icon = 'star';
|
|
10
10
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
11
11
|
"data-testid": "chip",
|
|
12
|
-
icon: icon
|
|
12
|
+
icon: icon,
|
|
13
|
+
id: "minimal-chip",
|
|
14
|
+
children: "Chip"
|
|
13
15
|
}));
|
|
14
16
|
var expected = 983080; // decimal converted charCode of Unicode 'star' character
|
|
15
17
|
var actual = _react.screen.getByTestId('chip').textContent.codePointAt();
|
|
@@ -19,8 +21,10 @@ describe('Chip', function () {
|
|
|
19
21
|
var svg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MDAiIGhlaWdodD0iNzAwIiB2aWV3Qm94PSIwIDAgNzAwIDcwMCI+PGRlZnM+PHN0eWxlPi5hLC5ie2ZpbGw6I2ZmZjt9LmJ7b3BhY2l0eTowLjg7fTwvc3R5bGU+PC9kZWZzPjxwb2x5Z29uIGNsYXNzPSJhIiBwb2ludHM9IjM0OS45IDUyNy44IDE5OS45IDQyOS44IDE5OS45IDM3NC40IDM1MC4xIDQ3Mi43IDM0OS45IDM0OC41IDE5OS45IDI2MS4xIDE5OS45IDIwOS4zIDM1MCAyOTMuNiAzNTAgMjkzLjYgMzUwLjIgMjkzLjcgMzQ5LjkgMTY5LjMgMTAyLjcgNDguNSAxMDIuNyA0NzIuNiAzNTAuMSA2NTEuNiAzNDkuOSA1MjcuOCIvPjxwb2x5Z29uIGNsYXNzPSJiIiBwb2ludHM9IjM1MC4xIDY1MS42IDU5Ny4zIDQ3Mi44IDU5Ny4zIDM2Ni4zIDM0OS45IDUyNy44IDM1MC4xIDY1MS42Ii8+PHBvbHlnb24gY2xhc3M9ImIiIHBvaW50cz0iMzUwLjEgNDcyLjcgNTIzLjUgMzU5LjMgNTIzLjUgMjQ3LjQgMzQ5LjkgMzQ4LjUgMzUwLjEgNDcyLjciLz48cG9seWdvbiBjbGFzcz0iYiIgcG9pbnRzPSIzNTAgMjkzLjYgMzUwIDI5My42IDM1MC4yIDI5My43IDU5Ny4zIDE1NC44IDU5Ny4zIDQ4LjQgMzQ5LjkgMTY5LjMgMzUwIDI5My42Ii8+PC9zdmc+';
|
|
20
22
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
21
23
|
"data-testid": "chip",
|
|
24
|
+
id: "chip",
|
|
22
25
|
icon: svg,
|
|
23
|
-
isImage: true
|
|
26
|
+
isImage: true,
|
|
27
|
+
children: "Chip"
|
|
24
28
|
}));
|
|
25
29
|
var actual = _react.screen.queryAllByRole('img')[0].firstChild;
|
|
26
30
|
expect(actual).toHaveAttribute('src', svg);
|
|
@@ -28,6 +32,7 @@ describe('Chip', function () {
|
|
|
28
32
|
test('should support `children` prop', function () {
|
|
29
33
|
var children = 'label';
|
|
30
34
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
35
|
+
id: "chip",
|
|
31
36
|
children: children
|
|
32
37
|
}));
|
|
33
38
|
var expected = children;
|
|
@@ -38,9 +43,11 @@ describe('Chip', function () {
|
|
|
38
43
|
var position = 'top';
|
|
39
44
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
40
45
|
"data-testid": "chip",
|
|
46
|
+
id: "chip",
|
|
41
47
|
deleteButton: {
|
|
42
48
|
position: position
|
|
43
|
-
}
|
|
49
|
+
},
|
|
50
|
+
children: "Chip"
|
|
44
51
|
}));
|
|
45
52
|
var chip = _react.screen.getByTestId('chip');
|
|
46
53
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -51,9 +58,11 @@ describe('Chip', function () {
|
|
|
51
58
|
var position = 'bottom';
|
|
52
59
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
53
60
|
"data-testid": "chip",
|
|
61
|
+
id: "chip",
|
|
54
62
|
deleteButton: {
|
|
55
63
|
position: position
|
|
56
|
-
}
|
|
64
|
+
},
|
|
65
|
+
children: "Chip"
|
|
57
66
|
}));
|
|
58
67
|
var chip = _react.screen.getByTestId('chip');
|
|
59
68
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -64,9 +73,11 @@ describe('Chip', function () {
|
|
|
64
73
|
var position = 'right';
|
|
65
74
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
66
75
|
"data-testid": "chip",
|
|
76
|
+
id: "chip",
|
|
67
77
|
deleteButton: {
|
|
68
78
|
position: position
|
|
69
|
-
}
|
|
79
|
+
},
|
|
80
|
+
children: "Chip"
|
|
70
81
|
}));
|
|
71
82
|
var chip = _react.screen.getByTestId('chip');
|
|
72
83
|
var deleteButton = chip.querySelector('.deleteButtonContainer');
|
|
@@ -76,6 +87,7 @@ describe('Chip', function () {
|
|
|
76
87
|
test('should render without delete button when deleteButton is false', function () {
|
|
77
88
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
78
89
|
"data-testid": "chip",
|
|
90
|
+
id: "chip",
|
|
79
91
|
deleteButton: false,
|
|
80
92
|
children: "Test Chip"
|
|
81
93
|
}));
|
|
@@ -86,6 +98,7 @@ describe('Chip', function () {
|
|
|
86
98
|
test('should render without delete button when deleteButton is undefined', function () {
|
|
87
99
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
88
100
|
"data-testid": "chip",
|
|
101
|
+
id: "chip",
|
|
89
102
|
children: "Test Chip"
|
|
90
103
|
}));
|
|
91
104
|
var chip = _react.screen.getByTestId('chip');
|
|
@@ -95,6 +108,7 @@ describe('Chip', function () {
|
|
|
95
108
|
test('should handle disabled state', function () {
|
|
96
109
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
97
110
|
"data-testid": "chip",
|
|
111
|
+
id: "chip",
|
|
98
112
|
disabled: true,
|
|
99
113
|
children: "Disabled Chip"
|
|
100
114
|
}));
|
|
@@ -104,6 +118,7 @@ describe('Chip', function () {
|
|
|
104
118
|
test('should handle disabled state with delete button', function () {
|
|
105
119
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
106
120
|
"data-testid": "chip",
|
|
121
|
+
id: "chip",
|
|
107
122
|
disabled: true,
|
|
108
123
|
deleteButton: {
|
|
109
124
|
position: 'right'
|
|
@@ -118,6 +133,7 @@ describe('Chip', function () {
|
|
|
118
133
|
test('should use default delete button icon when not specified', function () {
|
|
119
134
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
120
135
|
"data-testid": "chip",
|
|
136
|
+
id: "chip",
|
|
121
137
|
deleteButton: {
|
|
122
138
|
position: 'right'
|
|
123
139
|
},
|
|
@@ -130,6 +146,7 @@ describe('Chip', function () {
|
|
|
130
146
|
test('should use custom delete button icon when specified', function () {
|
|
131
147
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
132
148
|
"data-testid": "chip",
|
|
149
|
+
id: "chip",
|
|
133
150
|
deleteButton: {
|
|
134
151
|
position: 'right',
|
|
135
152
|
icon: 'trash'
|
|
@@ -152,6 +169,7 @@ describe('Chip', function () {
|
|
|
152
169
|
test('should handle onClick events', function () {
|
|
153
170
|
var mockOnClick = jest.fn();
|
|
154
171
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
172
|
+
id: "chip",
|
|
155
173
|
onClick: mockOnClick,
|
|
156
174
|
children: "Clickable Chip"
|
|
157
175
|
}));
|
|
@@ -164,6 +182,7 @@ describe('Chip', function () {
|
|
|
164
182
|
var children = 'Star Chip';
|
|
165
183
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
166
184
|
"data-testid": "chip",
|
|
185
|
+
id: "chip",
|
|
167
186
|
icon: icon,
|
|
168
187
|
children: children
|
|
169
188
|
}));
|
|
@@ -178,6 +197,7 @@ describe('Chip', function () {
|
|
|
178
197
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
179
198
|
className: customClass,
|
|
180
199
|
"data-testid": "chip",
|
|
200
|
+
id: "chip",
|
|
181
201
|
children: "Test Chip"
|
|
182
202
|
}));
|
|
183
203
|
var chipButton = _react.screen.getByRole('checkbox');
|
|
@@ -15,6 +15,7 @@ describe('Chips', function () {
|
|
|
15
15
|
var defaultProps = {
|
|
16
16
|
orientation: 'vertical',
|
|
17
17
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
18
|
+
id: "chip1",
|
|
18
19
|
deleteButton: {
|
|
19
20
|
icon: 'closex',
|
|
20
21
|
position: 'right',
|
|
@@ -22,6 +23,7 @@ describe('Chips', function () {
|
|
|
22
23
|
},
|
|
23
24
|
children: "Chip 1"
|
|
24
25
|
}, "chip1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
26
|
+
id: "chip2",
|
|
25
27
|
deleteButton: {
|
|
26
28
|
icon: 'closex',
|
|
27
29
|
position: 'right',
|
|
@@ -296,8 +298,16 @@ describe('Chips', function () {
|
|
|
296
298
|
position: 'right',
|
|
297
299
|
onDelete: mockDeleteWithParams
|
|
298
300
|
},
|
|
299
|
-
children: "
|
|
300
|
-
}, "chip1")
|
|
301
|
+
children: "Chip 1"
|
|
302
|
+
}, "chip1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
303
|
+
id: "chip2",
|
|
304
|
+
deleteButton: {
|
|
305
|
+
icon: 'closex',
|
|
306
|
+
position: 'right',
|
|
307
|
+
onDelete: mockDeleteWithParams
|
|
308
|
+
},
|
|
309
|
+
children: "Chip 2"
|
|
310
|
+
}, "chip2")]
|
|
301
311
|
};
|
|
302
312
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, propsWithParams)));
|
|
303
313
|
var deleteButtons = getAllDeleteButtons();
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ColorPickerDecorator = exports.ColorPickerBase = exports.ColorPicker = void 0;
|
|
7
7
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
8
|
+
var _util = require("@enact/core/util");
|
|
8
9
|
var _Spottable = _interopRequireDefault(require("@enact/spotlight/Spottable"));
|
|
9
10
|
var _Layout = require("@enact/ui/Layout");
|
|
10
11
|
var _Toggleable = _interopRequireDefault(require("@enact/ui/Toggleable"));
|
|
@@ -63,11 +64,12 @@ var SpottableButton = (0, _Spottable["default"])(_Button.ButtonBase);
|
|
|
63
64
|
* @ui
|
|
64
65
|
* @private
|
|
65
66
|
*/
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
var _PopupContent = function PopupContent(props) {
|
|
68
|
+
(0, _util.checkPropTypes)(_PopupContent, props);
|
|
69
|
+
var color = props.color,
|
|
70
|
+
colorHandler = props.colorHandler,
|
|
71
|
+
css = props.css,
|
|
72
|
+
presetColors = props.presetColors;
|
|
71
73
|
var _useState = (0, _react.useState)(0),
|
|
72
74
|
_useState2 = _slicedToArray(_useState, 2),
|
|
73
75
|
hue = _useState2[0],
|
|
@@ -173,7 +175,7 @@ var PopupContent = function PopupContent(_ref) {
|
|
|
173
175
|
})]
|
|
174
176
|
});
|
|
175
177
|
};
|
|
176
|
-
|
|
178
|
+
_PopupContent.propTypes = {
|
|
177
179
|
/**
|
|
178
180
|
* Indicates the color.
|
|
179
181
|
*
|
|
@@ -295,13 +297,13 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
295
297
|
text: _propTypes["default"].string
|
|
296
298
|
},
|
|
297
299
|
handlers: {
|
|
298
|
-
handleClosePopup: function handleClosePopup(ev,
|
|
299
|
-
var onTogglePopup =
|
|
300
|
+
handleClosePopup: function handleClosePopup(ev, _ref) {
|
|
301
|
+
var onTogglePopup = _ref.onTogglePopup;
|
|
300
302
|
onTogglePopup();
|
|
301
303
|
},
|
|
302
|
-
handleOpenPopup: function handleOpenPopup(ev,
|
|
303
|
-
var disabled =
|
|
304
|
-
onTogglePopup =
|
|
304
|
+
handleOpenPopup: function handleOpenPopup(ev, _ref2) {
|
|
305
|
+
var disabled = _ref2.disabled,
|
|
306
|
+
onTogglePopup = _ref2.onTogglePopup;
|
|
305
307
|
if (!disabled) {
|
|
306
308
|
onTogglePopup();
|
|
307
309
|
}
|
|
@@ -311,19 +313,19 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
311
313
|
css: _ColorPickerModule["default"],
|
|
312
314
|
publicClassNames: true
|
|
313
315
|
},
|
|
314
|
-
render: function render(
|
|
315
|
-
var color =
|
|
316
|
-
colorHandler =
|
|
317
|
-
css =
|
|
318
|
-
|
|
319
|
-
disabled =
|
|
320
|
-
handleClosePopup =
|
|
321
|
-
handleOpenPopup =
|
|
322
|
-
|
|
323
|
-
popupOpen =
|
|
324
|
-
presetColors =
|
|
325
|
-
text =
|
|
326
|
-
rest = _objectWithoutProperties(
|
|
316
|
+
render: function render(_ref3) {
|
|
317
|
+
var color = _ref3.color,
|
|
318
|
+
colorHandler = _ref3.colorHandler,
|
|
319
|
+
css = _ref3.css,
|
|
320
|
+
_ref3$disabled = _ref3.disabled,
|
|
321
|
+
disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
|
|
322
|
+
handleClosePopup = _ref3.handleClosePopup,
|
|
323
|
+
handleOpenPopup = _ref3.handleOpenPopup,
|
|
324
|
+
_ref3$popupOpen = _ref3.popupOpen,
|
|
325
|
+
popupOpen = _ref3$popupOpen === void 0 ? false : _ref3$popupOpen,
|
|
326
|
+
presetColors = _ref3.presetColors,
|
|
327
|
+
text = _ref3.text,
|
|
328
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
327
329
|
delete rest.onTogglePopup;
|
|
328
330
|
var CloseIcon = (0, _react.useCallback)(function (props) {
|
|
329
331
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon["default"], _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -377,7 +379,7 @@ var ColorPickerBase = exports.ColorPickerBase = (0, _kind["default"])({
|
|
|
377
379
|
size: "small"
|
|
378
380
|
})
|
|
379
381
|
})]
|
|
380
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
382
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PopupContent, {
|
|
381
383
|
color: color,
|
|
382
384
|
colorHandler: colorHandler,
|
|
383
385
|
css: css,
|
|
@@ -116,7 +116,8 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
116
116
|
var WrappedWithRef = (0, _WithRef.WithRef)(Wrapped);
|
|
117
117
|
|
|
118
118
|
// eslint-disable-next-line no-shadow
|
|
119
|
-
var
|
|
119
|
+
var _ContextualPopupDecorator = function ContextualPopupDecorator(props) {
|
|
120
|
+
(0, _util.checkPropTypes)(_ContextualPopupDecorator, props);
|
|
120
121
|
var componentProps = (0, _util.setDefaultProps)(props, contextualPopupDecoratorDefaultProps);
|
|
121
122
|
var _useState = (0, _react.useState)(null),
|
|
122
123
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -137,12 +138,15 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
137
138
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
138
139
|
containerPosition = _useState6[0],
|
|
139
140
|
setContainerPosition = _useState6[1];
|
|
140
|
-
var _useState7 = (0, _react.useState)(
|
|
141
|
+
var _useState7 = (0, _react.useState)(componentProps.direction),
|
|
141
142
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
142
143
|
direction = _useState8[0],
|
|
143
144
|
setDirection = _useState8[1];
|
|
145
|
+
var _useState9 = (0, _react.useState)(null),
|
|
146
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
147
|
+
holeBounds = _useState0[0],
|
|
148
|
+
setHoleBounds = _useState0[1];
|
|
144
149
|
var adjustedDirection = (0, _react.useRef)(componentProps.direction);
|
|
145
|
-
var containerId = (0, _react.useRef)(_spotlight["default"].add(componentProps.popupSpotlightId));
|
|
146
150
|
var containerNode = (0, _react.useRef)(null);
|
|
147
151
|
var clientSiblingRef = (0, _react.useRef)(null);
|
|
148
152
|
var overflow = (0, _react.useRef)({});
|
|
@@ -153,6 +157,9 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
153
157
|
var findClientSiblingRef = (0, _react.useRef)(null);
|
|
154
158
|
var keyDownRef = (0, _react.useRef)(null);
|
|
155
159
|
var keyUpRef = (0, _react.useRef)(null);
|
|
160
|
+
var containerId = (0, _react.useMemo)(function () {
|
|
161
|
+
return _spotlight["default"].add(componentProps.popupSpotlightId);
|
|
162
|
+
}, [componentProps.popupSpotlightId]);
|
|
156
163
|
if (componentProps.setApiProvider) {
|
|
157
164
|
componentProps.setApiProvider();
|
|
158
165
|
}
|
|
@@ -172,7 +179,9 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
172
179
|
var generateId = (0, _react.useCallback)(function () {
|
|
173
180
|
return Math.random().toString(36).substring(2, 10);
|
|
174
181
|
}, []);
|
|
175
|
-
var id = (0, _react.
|
|
182
|
+
var id = (0, _react.useMemo)(function () {
|
|
183
|
+
return generateId();
|
|
184
|
+
}, [generateId]);
|
|
176
185
|
var adjustRTL = (0, _react.useCallback)(function (position) {
|
|
177
186
|
var pos = position;
|
|
178
187
|
if (componentProps.rtl) {
|
|
@@ -253,7 +262,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
253
262
|
return containerNode.current && containerNode.current.getBoundingClientRect().width || 0;
|
|
254
263
|
}, []);
|
|
255
264
|
var updateLeaveFor = (0, _react.useCallback)(function (localActivator) {
|
|
256
|
-
_spotlight["default"].set(containerId
|
|
265
|
+
_spotlight["default"].set(containerId, {
|
|
257
266
|
leaveFor: {
|
|
258
267
|
up: localActivator,
|
|
259
268
|
down: localActivator,
|
|
@@ -261,7 +270,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
261
270
|
right: localActivator
|
|
262
271
|
}
|
|
263
272
|
});
|
|
264
|
-
}, []);
|
|
273
|
+
}, [containerId]);
|
|
265
274
|
var getContainerPosition = (0, _react.useCallback)(function (localContainerNode, clientNode) {
|
|
266
275
|
var _distances2 = distances(),
|
|
267
276
|
ARROW_OFFSET = _distances2.ARROW_OFFSET,
|
|
@@ -451,14 +460,14 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
451
460
|
}, []);
|
|
452
461
|
var spotPopupContent = (0, _react.useCallback)(function () {
|
|
453
462
|
var localSpotlightRestrict = componentProps.spotlightRestrict;
|
|
454
|
-
var spottableDescendants = _spotlight["default"].getSpottableDescendants(containerId
|
|
463
|
+
var spottableDescendants = _spotlight["default"].getSpottableDescendants(containerId);
|
|
455
464
|
if (localSpotlightRestrict === 'self-only' && spottableDescendants.length && _spotlight["default"].getCurrent()) {
|
|
456
465
|
_spotlight["default"].getCurrent().blur();
|
|
457
466
|
}
|
|
458
|
-
if (!_spotlight["default"].focus(containerId
|
|
459
|
-
_spotlight["default"].setActiveContainer(containerId
|
|
467
|
+
if (!_spotlight["default"].focus(containerId)) {
|
|
468
|
+
_spotlight["default"].setActiveContainer(containerId);
|
|
460
469
|
}
|
|
461
|
-
}, [componentProps]);
|
|
470
|
+
}, [componentProps, containerId]);
|
|
462
471
|
var handleKeyUp = (0, _react.useCallback)(function () {
|
|
463
472
|
return (0, _handle.handle)((0, _handle.forProp)('open', true), (0, _handle.forKey)('enter'), function () {
|
|
464
473
|
return _spotlight["default"].getCurrent() === activator;
|
|
@@ -495,7 +504,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
495
504
|
var current = _spotlight["default"].getCurrent();
|
|
496
505
|
var localDirection = (0, _spotlight.getDirection)(ev.keyCode);
|
|
497
506
|
if (!localDirection) return;
|
|
498
|
-
var hasSpottables = _spotlight["default"].getSpottableDescendants(containerId
|
|
507
|
+
var hasSpottables = _spotlight["default"].getSpottableDescendants(containerId).length > 0;
|
|
499
508
|
var spotlessSpotlightModal = componentProps.spotlightRestrict === 'self-only' && !hasSpottables;
|
|
500
509
|
var shouldSpotPopup = current === activator && localDirection === PositionToDirection[adjustedDirection.current.split(' ')[0]] && hasSpottables;
|
|
501
510
|
if (shouldSpotPopup || spotlessSpotlightModal) {
|
|
@@ -507,7 +516,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
507
516
|
spotPopupContent();
|
|
508
517
|
}
|
|
509
518
|
}
|
|
510
|
-
}, [activator, componentProps, handleDirectionalKey, spotPopupContent]);
|
|
519
|
+
}, [activator, componentProps, containerId, handleDirectionalKey, spotPopupContent]);
|
|
511
520
|
|
|
512
521
|
// handle key event from contextual popup and closes the popup
|
|
513
522
|
var handleContainerKeyDown = (0, _react.useCallback)(function (ev) {
|
|
@@ -562,7 +571,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
562
571
|
}
|
|
563
572
|
}, [componentProps, handleKeyDown, handleKeyUp]);
|
|
564
573
|
(0, _react.useEffect)(function () {
|
|
565
|
-
var localId = containerId
|
|
574
|
+
var localId = containerId;
|
|
566
575
|
if (componentProps.open) {
|
|
567
576
|
(0, _dispatcher.on)('keydown', keyDownRef.current);
|
|
568
577
|
(0, _dispatcher.on)('keyup', keyUpRef.current);
|
|
@@ -626,7 +635,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
626
635
|
skin = componentProps.skin,
|
|
627
636
|
spotlightRestrict = componentProps.spotlightRestrict,
|
|
628
637
|
rest = _objectWithoutProperties(componentProps, _excluded);
|
|
629
|
-
var idFloatLayer = "".concat(id
|
|
638
|
+
var idFloatLayer = "".concat(id, "_floatLayer");
|
|
630
639
|
var scrimType = rest.scrimType;
|
|
631
640
|
delete rest.scrimType;
|
|
632
641
|
|
|
@@ -641,10 +650,11 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
641
650
|
if (!noSkin) {
|
|
642
651
|
rest.skin = skin;
|
|
643
652
|
}
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
653
|
+
(0, _react.useEffect)(function () {
|
|
654
|
+
if (clientSiblingRef !== null && clientSiblingRef !== void 0 && clientSiblingRef.current && holepunchScrim) {
|
|
655
|
+
setHoleBounds(clientSiblingRef.current.getBoundingClientRect());
|
|
656
|
+
}
|
|
657
|
+
}, [holepunchScrim]);
|
|
648
658
|
delete rest.direction;
|
|
649
659
|
delete rest.onClose;
|
|
650
660
|
delete rest.onOpen;
|
|
@@ -677,7 +687,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
677
687
|
offset: noArrow ? offset : 'none',
|
|
678
688
|
showArrow: !noArrow,
|
|
679
689
|
skin: skin,
|
|
680
|
-
spotlightId: containerId
|
|
690
|
+
spotlightId: containerId,
|
|
681
691
|
spotlightRestrict: spotlightRestrict,
|
|
682
692
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(PopupComponent, _objectSpread({}, popupPropsRef))
|
|
683
693
|
}))]
|
|
@@ -689,8 +699,8 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
689
699
|
}))]
|
|
690
700
|
});
|
|
691
701
|
};
|
|
692
|
-
|
|
693
|
-
|
|
702
|
+
_ContextualPopupDecorator.displayName = 'ContextualPopupDecorator';
|
|
703
|
+
_ContextualPopupDecorator.propTypes = /** @lends limestone/ContextualPopupDecorator.ContextualPopupDecorator.prototype */{
|
|
694
704
|
/**
|
|
695
705
|
* The component rendered within the
|
|
696
706
|
* {@link limestone/ContextualPopupDecorator.ContextualPopup|ContextualPopup}.
|
|
@@ -840,7 +850,7 @@ var Decorator = (0, _hoc["default"])(defaultConfig, function (config, Wrapped) {
|
|
|
840
850
|
*/
|
|
841
851
|
spotlightRestrict: _propTypes2["default"].oneOf(['none', 'self-first', 'self-only'])
|
|
842
852
|
};
|
|
843
|
-
return
|
|
853
|
+
return _ContextualPopupDecorator;
|
|
844
854
|
});
|
|
845
855
|
|
|
846
856
|
/**
|
|
@@ -207,13 +207,18 @@ var daySelectorDecoratorDefaultProps = {
|
|
|
207
207
|
* @private
|
|
208
208
|
*/
|
|
209
209
|
var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
210
|
-
var
|
|
211
|
-
var daySelectorDecoratorProps = (0,
|
|
210
|
+
var _DaySelector = function DaySelector(props) {
|
|
211
|
+
var daySelectorDecoratorProps = (0, _react.useMemo)(function () {
|
|
212
|
+
return (0, _util.setDefaultProps)(props, daySelectorDecoratorDefaultProps);
|
|
213
|
+
}, [props]);
|
|
214
|
+
(0, _util.checkPropTypes)(_DaySelector, daySelectorDecoratorProps);
|
|
212
215
|
var dayNameLength = daySelectorDecoratorProps.dayNameLength,
|
|
213
216
|
locale = daySelectorDecoratorProps.locale,
|
|
214
217
|
selected = daySelectorDecoratorProps.selected,
|
|
215
218
|
rest = _objectWithoutProperties(daySelectorDecoratorProps, _excluded);
|
|
216
|
-
var state =
|
|
219
|
+
var state = (0, _react.useMemo)(function () {
|
|
220
|
+
return getLocaleState(dayNameLength, locale);
|
|
221
|
+
}, [dayNameLength, locale]);
|
|
217
222
|
var localSelected = localizeSelected(selected, state);
|
|
218
223
|
var abbreviatedDayNames = orderDays(state.abbreviatedDayNames, state);
|
|
219
224
|
var fullDayNames = orderDays(state.fullDayNames, state);
|
|
@@ -243,8 +248,8 @@ var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(f
|
|
|
243
248
|
})
|
|
244
249
|
}));
|
|
245
250
|
};
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
_DaySelector.displayName = 'DaySelectorDecorator';
|
|
252
|
+
_DaySelector.propTypes = /** @lends limestone/DayPicker.DaySelectorDecorator.prototype */{
|
|
248
253
|
/**
|
|
249
254
|
* The "aria-label" for the selector.
|
|
250
255
|
*
|
|
@@ -295,7 +300,7 @@ var DaySelectorDecorator = exports.DaySelectorDecorator = (0, _hoc["default"])(f
|
|
|
295
300
|
*/
|
|
296
301
|
selected: _propTypes["default"].oneOfType([_propTypes["default"].number, _propTypes["default"].arrayOf(_propTypes["default"].number)])
|
|
297
302
|
};
|
|
298
|
-
|
|
299
|
-
return
|
|
303
|
+
_DaySelector.defaultPropValues = daySelectorDecoratorDefaultProps;
|
|
304
|
+
return _DaySelector;
|
|
300
305
|
});
|
|
301
306
|
var _default = exports["default"] = DaySelectorDecorator;
|
|
@@ -50,6 +50,10 @@
|
|
|
50
50
|
padding: 0 var(--primitive-spacing-48);
|
|
51
51
|
margin: 0;
|
|
52
52
|
}
|
|
53
|
+
.dropdown .button.small {
|
|
54
|
+
min-width: unset;
|
|
55
|
+
max-width: unset;
|
|
56
|
+
}
|
|
53
57
|
:global(.spotlight-input-key) .dropdown .button:not([disabled]):global(.spottable):focus.pressed .bg,
|
|
54
58
|
:global(.spotlight-input-mouse) .dropdown .button:not([disabled]):global(.spottable):focus.pressed .bg,
|
|
55
59
|
:global(.spotlight-input-key) .dropdown .button:not([disabled]):global(.spottable):focus:active .bg,
|