@enact/limestone 1.3.0 → 1.9.4
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-branch.yml +21 -0
- package/.github/workflows/ci-pull-request.yml +16 -0
- package/.github/workflows/ci-reusable.yml +73 -0
- package/ActionGuide/ActionGuide.d.ts +5 -4
- package/ActionGuide/ActionGuide.module.css +1 -1
- package/Alert/Alert.d.ts +4 -2
- package/Alert/Alert.js +4 -1
- package/Alert/Alert.module.css +36 -0
- package/BodyText/BodyText.d.ts +5 -4
- package/BodyText/BodyText.module.css +7 -7
- package/Button/Button.d.ts +17 -12
- package/Button/Button.js +1 -1
- package/Button/Button.module.css +195 -268
- package/CHANGELOG.md +226 -0
- package/Card/Card.d.ts +36 -8
- package/Card/Card.js +157 -20
- package/Card/Card.module.css +277 -58
- package/Card/tests/Card-specs.js +30 -0
- package/Checkbox/Checkbox.d.ts +8 -7
- package/Checkbox/Checkbox.js +3 -1
- package/Checkbox/Checkbox.module.css +213 -120
- package/Checkbox/tests/Checkbox-specs.js +1 -1
- package/CheckboxItem/CheckboxItem.d.ts +22 -7
- package/CheckboxItem/CheckboxItem.js +69 -4
- package/Chips/Chip.js +60 -7
- package/Chips/Chip.module.css +3 -3
- package/Chips/Chips.js +26 -12
- package/Chips/Chips.module.css +1 -1
- package/Chips/tests/Chip-specs.js +19 -9
- package/Chips/tests/Chips-specs.js +19 -19
- package/ContextualMenuDecorator/ContextualMenuDecorator.d.ts +4 -5
- package/ContextualPopupDecorator/ContextualPopup.module.css +34 -34
- package/ContextualPopupDecorator/ContextualPopupDecorator.js +557 -549
- package/DatePicker/DatePicker.d.ts +4 -5
- package/DayPicker/DayPicker.d.ts +8 -7
- package/Dropdown/Dropdown.d.ts +11 -13
- package/Dropdown/Dropdown.module.css +9 -9
- package/Dropdown/DropdownList.js +16 -11
- package/FixedPopupPanels/FixedPopupPanels.d.ts +4 -2
- package/FixedPopupPanels/FixedPopupPanels.module.css +18 -18
- package/FlexiblePopupPanels/FlexiblePopupPanels.module.css +23 -23
- package/FormCheckboxItem/FormCheckboxItem.d.ts +5 -4
- package/Heading/Heading.d.ts +8 -7
- package/Heading/Heading.module.css +5 -5
- package/Icon/Icon.d.ts +14 -4
- package/Icon/Icon.js +48 -2
- package/Icon/Icon.module.css +1 -1
- package/Icon/IconList.js +25 -1
- package/IconItem/IconItem.d.ts +13 -12
- package/IconItem/IconItem.js +15 -0
- package/IconItem/IconItem.module.css +107 -1
- package/Image/Image.d.ts +5 -4
- package/ImageItem/ImageItem.d.ts +11 -10
- package/ImageItem/ImageItem.js +37 -31
- package/ImageItem/ImageItem.module.css +30 -30
- package/ImageItem/tests/ImageItem-specs.js +3 -10
- package/Input/Input.js +9 -2
- package/Input/Input.module.css +37 -8
- package/Input/InputField.js +5 -1
- package/Input/InputField.module.css +17 -2
- package/Input/InputFieldSpotlightDecorator.js +213 -229
- package/Input/index.d.ts +15 -18
- package/Input/tests/InputField-specs.js +21 -0
- package/Item/Item.d.ts +16 -9
- package/Item/Item.js +20 -2
- package/Item/Item.module.css +1 -1
- package/KeyGuide/KeyGuide.d.ts +8 -7
- package/KeyGuide/KeyGuide.module.css +25 -1
- package/Marquee/Marquee.d.ts +2 -4
- package/MediaOverlay/MediaOverlay.d.ts +12 -11
- package/MediaOverlay/MediaOverlay.js +43 -21
- package/MediaOverlay/MediaOverlay.module.css +114 -15
- package/MediaPlayer/MediaControls.js +195 -13
- package/MediaPlayer/MediaControls.module.css +3 -2
- package/MediaPlayer/MediaSlider.module.css +7 -20
- package/MediaPlayer/index.d.ts +59 -7
- package/PageViews/PageViews.js +165 -80
- package/PageViews/PageViewsRouter.js +9 -0
- package/PageViews/tests/PageViews-specs.js +84 -0
- package/Panels/Header.js +48 -30
- package/Panels/Header.module.css +83 -31
- package/Panels/Panel.module.css +1 -1
- package/Panels/index.d.ts +7 -8
- package/Picker/Picker.d.ts +4 -5
- package/Picker/Picker.module.css +2 -2
- package/Popup/Popup.js +242 -240
- package/Popup/Popup.module.css +24 -24
- package/PopupTabLayout/PopupTabLayout.d.ts +5 -7
- package/PopupTabLayout/PopupTabLayout.js +15 -9
- package/PopupTabLayout/PopupTabLayout.module.css +53 -16
- package/PopupTabLayout/PopupTabLayoutStateContext.js +8 -0
- package/ProgressBar/ProgressBar.d.ts +5 -4
- package/ProgressBar/ProgressBarTooltip.module.css +12 -12
- package/ProgressButton/ProgressButton.d.ts +4 -5
- package/QuickGuidePanels/QuickGuidePanels.module.css +2 -2
- package/RadioItem/RadioItem.d.ts +18 -5
- package/RadioItem/RadioItem.js +67 -2
- package/RadioItem/RadioItem.module.css +36 -36
- package/RangePicker/RangePicker.module.css +2 -2
- package/Scroller/EditableWrapper.js +11 -4
- package/Scroller/Scroller.d.ts +20 -16
- package/Scroller/Scroller.js +9 -3
- package/Scroller/Scroller.module.css +4 -4
- package/Slider/Slider.d.ts +16 -14
- package/Slider/Slider.js +37 -4
- package/Slider/Slider.module.css +314 -91
- package/Slider/tests/Slider-specs.js +2 -1
- package/Spinner/Spinner.d.ts +5 -4
- package/Spinner/Spinner.module.css +9 -9
- package/Steps/Steps.d.ts +5 -4
- package/Steps/Steps.js +9 -5
- package/Switch/Switch.d.ts +8 -7
- package/Switch/Switch.module.css +100 -13
- package/SwitchItem/SwitchItem.d.ts +9 -6
- package/TabLayout/RefocusDecorator.js +15 -9
- package/TabLayout/TabGroup.js +3 -2
- package/TabLayout/TabGroup.module.css +2 -2
- package/TabLayout/TabLayout.d.ts +6 -0
- package/TabLayout/TabLayout.js +11 -1
- package/TabLayout/TabLayout.module.css +18 -0
- package/TabLayout/tests/TabLayout-specs.js +52 -0
- package/ThemeDecorator/ThemeDecorator.d.ts +9 -10
- package/ThemeDecorator/fontGenerator.js +1 -1
- package/ThemeDecorator/screenTypes.json +1 -0
- package/TimePicker/TimePicker.module.css +1 -1
- package/TooltipDecorator/Tooltip.module.css +1 -2
- package/TooltipDecorator/tests/util-specs.js +12 -0
- package/TooltipDecorator/useTooltip.js +1 -1
- package/TooltipDecorator/util.js +18 -11
- package/VideoPlayer/Feedback.js +3 -0
- package/VideoPlayer/Feedback.module.css +5 -9
- package/VideoPlayer/FeedbackIcons.js +1 -1
- package/VideoPlayer/FeedbackTooltip.module.css +55 -11
- package/VideoPlayer/VideoPlayer.d.ts +44 -18
- package/VideoPlayer/VideoPlayer.js +128 -23
- package/VideoPlayer/VideoPlayer.module.css +28 -11
- package/VirtualList/VirtualList.d.ts +9 -2
- package/VirtualList/VirtualList.js +31 -6
- package/VirtualList/tests/VirtualGridList-translate-specs.js +3 -0
- package/VirtualList/tests/VirtualList-specs.js +28 -1
- package/VirtualList/tests/VirtualList-translate-specs.js +4 -1
- package/VirtualList/tests/useEvent-specs.js +39 -0
- package/VirtualList/useEvent.js +45 -10
- package/VirtualList/useThemeVirtualList.js +3 -0
- package/WizardPanels/WizardPanels.module.css +2 -2
- package/WizardPanels/index.d.ts +4 -2
- package/fonts/Limestone_Icons.ttf +0 -0
- package/internal/$L/$L.js +3 -3
- package/internal/DateComponentPicker/DateComponentPicker.module.css +2 -2
- package/internal/DateTime/DateTime.module.css +1 -0
- package/internal/Panels/PanelsRouter.js +16 -5
- package/internal/Picker/Picker.module.css +2 -2
- package/internal/SharedStateDecorator/SharedStateDecorator.js +76 -99
- package/internal/validators/validators.js +21 -2
- package/package.json +14 -14
- package/styles/colors-highcontrast.less +9 -1
- package/styles/colors.less +11 -7
- package/styles/motion-mixins.less +66 -0
- package/styles/motions.less +78 -0
- package/styles/variables.less +176 -150
- package/useScroll/HoverToScroll.js +8 -5
- package/useScroll/ScrollbarTrack.module.css +8 -8
- package/useScroll/useEvent.js +7 -1
- package/useScroll/useScroll.js +2 -0
- package/useScroll/useScroll.module.css +6 -6
- package/.travis.yml +0 -40
|
@@ -9,7 +9,7 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
9
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
10
10
|
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
11
11
|
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
12
|
-
describe('
|
|
12
|
+
describe('Checkbox Specs', function () {
|
|
13
13
|
test('should not include the selected class when not selected', function () {
|
|
14
14
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Checkbox.CheckboxBase, {}));
|
|
15
15
|
var checkboxElement = _react.screen.getByRole('checkbox');
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
// Type definitions for limestone/CheckboxItem
|
|
2
2
|
|
|
3
3
|
import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable";
|
|
4
|
-
import { ItemProps as limestone_Item_ItemProps } from "limestone/Item";
|
|
5
4
|
import * as React from "react";
|
|
5
|
+
import { ItemProps as limestone_Item_ItemProps } from "limestone/Item";
|
|
6
6
|
|
|
7
7
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
8
8
|
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
9
9
|
|
|
10
|
-
export interface CheckboxItemBaseProps
|
|
11
|
-
|
|
10
|
+
export interface CheckboxItemBaseProps extends Omit<
|
|
11
|
+
limestone_Item_ItemProps,
|
|
12
|
+
"iconComponent"
|
|
13
|
+
> {
|
|
12
14
|
/**
|
|
13
15
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
14
16
|
corresponding internal elements and states of this component.
|
|
@@ -77,14 +79,15 @@ export class CheckboxItemBase extends React.Component<
|
|
|
77
79
|
Merge<React.HTMLProps<HTMLElement>, CheckboxItemBaseProps>
|
|
78
80
|
> {}
|
|
79
81
|
|
|
80
|
-
export interface CheckboxItemDecoratorProps
|
|
81
|
-
extends ui_Toggleable_ToggleableProps {}
|
|
82
|
+
export interface CheckboxItemDecoratorProps extends ui_Toggleable_ToggleableProps {}
|
|
82
83
|
export function CheckboxItemDecorator<P>(
|
|
83
84
|
Component: React.ComponentType<P> | string,
|
|
84
85
|
): React.ComponentType<P & CheckboxItemDecoratorProps>;
|
|
85
86
|
|
|
86
|
-
export interface CheckboxItemProps
|
|
87
|
-
|
|
87
|
+
export interface CheckboxItemProps extends Merge<
|
|
88
|
+
CheckboxItemBaseProps,
|
|
89
|
+
CheckboxItemDecoratorProps
|
|
90
|
+
> {}
|
|
88
91
|
/**
|
|
89
92
|
* A Limestone-styled item with a checkbox component.
|
|
90
93
|
*
|
|
@@ -96,4 +99,16 @@ export class CheckboxItem extends React.Component<
|
|
|
96
99
|
Merge<React.HTMLProps<HTMLElement>, CheckboxItemProps>
|
|
97
100
|
> {}
|
|
98
101
|
|
|
102
|
+
export interface CheckboxItemGroupProps {}
|
|
103
|
+
/**
|
|
104
|
+
* A container that surrounds multiple CheckboxItems.
|
|
105
|
+
*
|
|
106
|
+
* A list of multiple CheckboxItems wrapped with a CheckboxItemGroup component gets
|
|
107
|
+
required audio guidance.
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
export class CheckboxItemGroup extends React.Component<
|
|
111
|
+
Merge<React.HTMLProps<HTMLElement>, CheckboxItemGroupProps>
|
|
112
|
+
> {}
|
|
113
|
+
|
|
99
114
|
export default CheckboxItem;
|
|
@@ -3,19 +3,24 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.CheckboxItemDecorator = exports.CheckboxItemBase = exports.CheckboxItem = void 0;
|
|
6
|
+
exports["default"] = exports.CheckboxItemGroup = exports.CheckboxItemDecorator = exports.CheckboxItemBase = exports.CheckboxItem = void 0;
|
|
7
7
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
8
|
-
var
|
|
9
|
-
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
8
|
+
var _Group = _interopRequireDefault(require("@enact/ui/Group"));
|
|
10
9
|
var _Pure = _interopRequireDefault(require("@enact/ui/internal/Pure"));
|
|
11
10
|
var _Slottable = _interopRequireDefault(require("@enact/ui/Slottable"));
|
|
12
11
|
var _Toggleable = _interopRequireDefault(require("@enact/ui/Toggleable"));
|
|
12
|
+
var _IString = _interopRequireDefault(require("ilib/lib/IString"));
|
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
15
|
+
var _$L = _interopRequireDefault(require("../internal/$L"));
|
|
13
16
|
var _Checkbox = require("../Checkbox");
|
|
14
17
|
var _Item = require("../Item");
|
|
15
18
|
var _Skinnable = _interopRequireDefault(require("../Skinnable"));
|
|
16
19
|
var _CheckboxItemModule = _interopRequireDefault(require("./CheckboxItem.module.css"));
|
|
17
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
var _excluded = ["children", "css", "icon", "indeterminate", "indeterminateIcon", "selected", "slotBefore"]
|
|
21
|
+
var _excluded = ["children", "css", "icon", "indeterminate", "indeterminateIcon", "selected", "slotBefore"],
|
|
22
|
+
_excluded2 = ["children", "groupId", "itemProps"],
|
|
23
|
+
_excluded3 = ["children"];
|
|
19
24
|
/**
|
|
20
25
|
* Limestone styled item components with a toggleable checkbox.
|
|
21
26
|
*
|
|
@@ -207,4 +212,64 @@ var CheckboxItemDecorator = exports.CheckboxItemDecorator = (0, _compose["defaul
|
|
|
207
212
|
* @public
|
|
208
213
|
*/
|
|
209
214
|
var CheckboxItem = exports.CheckboxItem = (0, _Pure["default"])(CheckboxItemDecorator(CheckboxItemBase));
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* A container that surrounds multiple CheckboxItems.
|
|
218
|
+
*
|
|
219
|
+
* A list of multiple CheckboxItems wrapped with a CheckboxItemGroup component gets
|
|
220
|
+
* required audio guidance.
|
|
221
|
+
*
|
|
222
|
+
* @class CheckboxItemGroup
|
|
223
|
+
* @memberof limestone/CheckboxItem
|
|
224
|
+
* @ui
|
|
225
|
+
* @public
|
|
226
|
+
*/
|
|
227
|
+
var _CheckboxItemGroup = exports.CheckboxItemGroup = function CheckboxItemGroup(props) {
|
|
228
|
+
var children = props.children,
|
|
229
|
+
groupId = props.groupId,
|
|
230
|
+
itemProps = props.itemProps,
|
|
231
|
+
rest = _objectWithoutProperties(props, _excluded2);
|
|
232
|
+
_CheckboxItemGroup.propTypes = {
|
|
233
|
+
groupId: _propTypes["default"].string,
|
|
234
|
+
itemProps: _propTypes["default"].object
|
|
235
|
+
};
|
|
236
|
+
if (typeof children[0] === 'string') {
|
|
237
|
+
// The case of multiple checkbox items are represented by string array instead of `CheckboxItem` components using `ui/Group`
|
|
238
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
239
|
+
role: "region",
|
|
240
|
+
"aria-labelledby": groupId || "checkboxItemGroup",
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Group["default"], _objectSpread(_objectSpread({}, rest), {}, {
|
|
242
|
+
id: groupId || "checkboxItemGroup",
|
|
243
|
+
"aria-label": new _IString["default"]((0, _$L["default"])('{total} items in total')).format({
|
|
244
|
+
'total': children.length
|
|
245
|
+
}),
|
|
246
|
+
childComponent: CheckboxItem,
|
|
247
|
+
childSelect: "onToggle",
|
|
248
|
+
itemProps: _objectSpread({}, itemProps),
|
|
249
|
+
children: children
|
|
250
|
+
}))
|
|
251
|
+
});
|
|
252
|
+
} else {
|
|
253
|
+
// The case of multiple checkbox items are represented by `CheckboxItem` components
|
|
254
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
255
|
+
role: "region",
|
|
256
|
+
"aria-labelledby": groupId || "checkboxItemGroup",
|
|
257
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
258
|
+
role: "group",
|
|
259
|
+
id: groupId || "checkboxItemGroup",
|
|
260
|
+
"aria-label": new _IString["default"]((0, _$L["default"])('{total} items in total')).format({
|
|
261
|
+
'total': children.length
|
|
262
|
+
}),
|
|
263
|
+
children: children.map(function (child, index) {
|
|
264
|
+
var _child$props = child.props,
|
|
265
|
+
itemValue = _child$props.children,
|
|
266
|
+
childRest = _objectWithoutProperties(_child$props, _excluded3);
|
|
267
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckboxItem, _objectSpread(_objectSpread(_objectSpread({}, childRest), itemProps), {}, {
|
|
268
|
+
children: itemValue
|
|
269
|
+
}), index);
|
|
270
|
+
})
|
|
271
|
+
}))
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
};
|
|
210
275
|
var _default = exports["default"] = CheckboxItem;
|
package/Chips/Chip.js
CHANGED
|
@@ -12,11 +12,15 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
13
13
|
var _react = require("react");
|
|
14
14
|
var _Button = _interopRequireDefault(require("../Button"));
|
|
15
|
+
var _Icon = _interopRequireDefault(require("../Icon"));
|
|
16
|
+
var _Image = _interopRequireDefault(require("../Image"));
|
|
17
|
+
var _$L = _interopRequireDefault(require("../internal/$L"));
|
|
15
18
|
var _Skinnable = _interopRequireDefault(require("../Skinnable"));
|
|
16
19
|
var _Chips = require("./Chips");
|
|
17
20
|
var _ChipModule = _interopRequireDefault(require("./Chip.module.css"));
|
|
18
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
var _excluded = ["children", "className", "deleteButton", "disabled", "icon", "id", "onClick", "ref"]
|
|
22
|
+
var _excluded = ["checked", "children", "className", "deleteButton", "disabled", "icon", "id", "imageSize", "isImage", "onClick", "ref"],
|
|
23
|
+
_excluded2 = ["children"];
|
|
20
24
|
/**
|
|
21
25
|
* The shape of the chip delete button for {@link limestone/Chips.Chip|Chip}.
|
|
22
26
|
*
|
|
@@ -42,7 +46,8 @@ var chipDeleteButtonShape = exports.chipDeleteButtonShape = _propTypes["default"
|
|
|
42
46
|
position: _propTypes["default"].oneOf(['top', 'bottom', 'right'])
|
|
43
47
|
});
|
|
44
48
|
var ChipDefaultProps = {
|
|
45
|
-
disabled: false
|
|
49
|
+
disabled: false,
|
|
50
|
+
imageSize: 24
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
/**
|
|
@@ -72,17 +77,21 @@ var ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
|
72
77
|
getNextTargetFromDeleteButton = _use.getNextTargetFromDeleteButton,
|
|
73
78
|
registerChild = _use.registerChild;
|
|
74
79
|
var chipProps = (0, _util.setDefaultProps)(props, ChipDefaultProps);
|
|
75
|
-
var
|
|
80
|
+
var checked = chipProps.checked,
|
|
81
|
+
children = chipProps.children,
|
|
76
82
|
className = chipProps.className,
|
|
77
83
|
deleteButton = chipProps.deleteButton,
|
|
78
84
|
disabled = chipProps.disabled,
|
|
79
85
|
icon = chipProps.icon,
|
|
80
86
|
id = chipProps.id,
|
|
87
|
+
imageSize = chipProps.imageSize,
|
|
88
|
+
isImage = chipProps.isImage,
|
|
81
89
|
onClick = chipProps.onClick,
|
|
82
90
|
ref = chipProps.ref,
|
|
83
91
|
rest = _objectWithoutProperties(chipProps, _excluded);
|
|
84
|
-
var
|
|
92
|
+
var ariaLabel = children + ' ' + (0, _$L["default"])('Chip') + ' ' + (0, _$L["default"])('button');
|
|
85
93
|
var buttonClassName = (0, _classnames["default"])(_ChipModule["default"].deleteButtonContainer, _ChipModule["default"][(deleteButton === null || deleteButton === void 0 ? void 0 : deleteButton.position) || 'right']);
|
|
94
|
+
var chipClassName = (0, _classnames["default"])(className, deleteButton === null || deleteButton === void 0 ? void 0 : deleteButton.position);
|
|
86
95
|
var containerRef = (0, _react.useRef)(null);
|
|
87
96
|
var clientRef = (0, _react.useRef)(null);
|
|
88
97
|
var deleteButtonRef = (0, _react.useRef)(null);
|
|
@@ -160,6 +169,24 @@ var ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
|
160
169
|
deleteButton.onDelete(ev);
|
|
161
170
|
}
|
|
162
171
|
}, [deleteButton, handleChipDelete, id]);
|
|
172
|
+
var iconComponent = (0, _react.useCallback)(function (_ref) {
|
|
173
|
+
var childComponent = _ref.children,
|
|
174
|
+
iconProps = _objectWithoutProperties(_ref, _excluded2);
|
|
175
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
176
|
+
children: [checked && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon["default"], _objectSpread(_objectSpread({}, iconProps), {}, {
|
|
177
|
+
children: "checkmark"
|
|
178
|
+
})), isImage && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image["default"], _objectSpread(_objectSpread({}, iconProps), {}, {
|
|
179
|
+
src: childComponent,
|
|
180
|
+
style: {
|
|
181
|
+
borderRadius: '999px',
|
|
182
|
+
width: "".concat(imageSize, "px"),
|
|
183
|
+
height: "".concat(imageSize, "px")
|
|
184
|
+
}
|
|
185
|
+
})), !isImage && childComponent && childComponent !== 'check' && childComponent !== 'checkmark' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Icon["default"], _objectSpread(_objectSpread({}, iconProps), {}, {
|
|
186
|
+
children: childComponent
|
|
187
|
+
}))]
|
|
188
|
+
});
|
|
189
|
+
}, [checked, imageSize, isImage]);
|
|
163
190
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
164
191
|
className: _ChipModule["default"].chip,
|
|
165
192
|
onMouseLeave: handleMouseLeave,
|
|
@@ -169,28 +196,33 @@ var ChipBase = exports.ChipBase = function ChipBase(props) {
|
|
|
169
196
|
onKeyDown: handleKeyDown,
|
|
170
197
|
ref: containerRef,
|
|
171
198
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
|
199
|
+
"aria-label": ariaLabel,
|
|
200
|
+
"aria-checked": checked,
|
|
172
201
|
css: _ChipModule["default"],
|
|
173
202
|
className: chipClassName,
|
|
174
203
|
"data-chip-index": id,
|
|
175
204
|
disabled: disabled,
|
|
176
|
-
|
|
177
|
-
|
|
205
|
+
icon: icon ? icon : '',
|
|
206
|
+
iconComponent: iconComponent,
|
|
178
207
|
size: "small",
|
|
179
208
|
onFocus: handleFocus,
|
|
180
209
|
onClick: onClick,
|
|
181
210
|
ref: chipRef,
|
|
211
|
+
role: "checkbox",
|
|
182
212
|
roundBorder: true,
|
|
183
213
|
children: children
|
|
184
214
|
}), deleteButton && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
185
215
|
className: buttonClassName,
|
|
186
216
|
ref: deleteButtonRef,
|
|
187
217
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button["default"], {
|
|
218
|
+
"aria-label": children + ' ' + (0, _$L["default"])("Delete"),
|
|
188
219
|
css: _ChipModule["default"],
|
|
189
220
|
backgroundOpacity: "transparent",
|
|
190
221
|
disabled: disabled,
|
|
191
222
|
icon: (deleteButton === null || deleteButton === void 0 ? void 0 : deleteButton.icon) || 'closex',
|
|
192
223
|
size: "small",
|
|
193
224
|
onClick: handleDelete,
|
|
225
|
+
role: "button",
|
|
194
226
|
roundBorder: true
|
|
195
227
|
})
|
|
196
228
|
})]
|
|
@@ -214,6 +246,13 @@ ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
|
214
246
|
* @public
|
|
215
247
|
*/
|
|
216
248
|
id: _propTypes["default"].string.isRequired,
|
|
249
|
+
/**
|
|
250
|
+
* Sets the chip as `checked` if `true`
|
|
251
|
+
*
|
|
252
|
+
* @type {Boolean}
|
|
253
|
+
* @public
|
|
254
|
+
*/
|
|
255
|
+
checked: _propTypes["default"].bool,
|
|
217
256
|
/**
|
|
218
257
|
* Define the icon, delete handler, and position for the delete button.
|
|
219
258
|
*
|
|
@@ -236,7 +275,21 @@ ChipBase.propTypes = /** @lends limestone/Chips.Chip.prototype */{
|
|
|
236
275
|
* @type {String|Object}
|
|
237
276
|
* @public
|
|
238
277
|
*/
|
|
239
|
-
icon: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object])
|
|
278
|
+
icon: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].object]),
|
|
279
|
+
/**
|
|
280
|
+
* Sets the size of the image passed to the component.
|
|
281
|
+
*
|
|
282
|
+
* @type {Number}
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
imageSize: _propTypes["default"].number,
|
|
286
|
+
/**
|
|
287
|
+
* If `true` tells the component to use `Image` instead of `Icon` element inside `Chip`.
|
|
288
|
+
*
|
|
289
|
+
* @type {Boolean}
|
|
290
|
+
* @public
|
|
291
|
+
*/
|
|
292
|
+
isImage: _propTypes["default"].bool
|
|
240
293
|
};
|
|
241
294
|
|
|
242
295
|
/**
|
package/Chips/Chip.module.css
CHANGED
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
.chip .deleteButtonContainer.right {
|
|
14
14
|
top: 50%;
|
|
15
15
|
right: 0;
|
|
16
|
-
transform: translateY(-50%) translateX(calc(100% +
|
|
16
|
+
transform: translateY(-50%) translateX(calc(100% + var(--primitive-spacing-12) ));
|
|
17
17
|
}
|
|
18
18
|
.chip .deleteButtonContainer.bottom {
|
|
19
|
-
bottom: -
|
|
19
|
+
bottom: calc( var(--primitive-spacing-12) * -1);
|
|
20
20
|
left: 50%;
|
|
21
21
|
transform: translate(-50%, 100%);
|
|
22
22
|
}
|
|
23
23
|
.chip .deleteButtonContainer.top {
|
|
24
|
-
top: calc(-100% -
|
|
24
|
+
top: calc(-100% - var(--primitive-spacing-12) );
|
|
25
25
|
left: 50%;
|
|
26
26
|
transform: translateX(-50%);
|
|
27
27
|
}
|
package/Chips/Chips.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.ChipsDecorator = exports.ChipsContext = exports.ChipsBase = exports.Chips = void 0;
|
|
7
7
|
var _util = require("@enact/core/util");
|
|
8
|
+
var _IString = _interopRequireDefault(require("ilib/lib/IString"));
|
|
8
9
|
var _spotlight = _interopRequireDefault(require("@enact/spotlight"));
|
|
9
10
|
var _SpotlightContainerDecorator = require("@enact/spotlight/SpotlightContainerDecorator");
|
|
10
11
|
var _container = require("@enact/spotlight/src/container");
|
|
@@ -13,6 +14,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
15
|
var _compose = _interopRequireDefault(require("ramda/src/compose"));
|
|
15
16
|
var _react = require("react");
|
|
17
|
+
var _$L = _interopRequireDefault(require("../internal/$L"));
|
|
16
18
|
var _ChipsModule = _interopRequireDefault(require("./Chips.module.css"));
|
|
17
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
20
|
var _excluded = ["children", "className", "orientation"];
|
|
@@ -62,6 +64,10 @@ var ChipsBase = exports.ChipsBase = function ChipsBase(props) {
|
|
|
62
64
|
var chipsClassName = (0, _classnames["default"])(_ChipsModule["default"].chips, _ChipsModule["default"][orientation], className);
|
|
63
65
|
var childRefs = (0, _react.useRef)([]);
|
|
64
66
|
var containerRef = (0, _react.useRef)(null);
|
|
67
|
+
var ariaLabel = new _IString["default"]((0, _$L["default"])('{total} items in total')).format({
|
|
68
|
+
total: children === null || children === void 0 ? void 0 : children.length
|
|
69
|
+
});
|
|
70
|
+
var ariaId = Math.random().toString(36).substring(2, 10);
|
|
65
71
|
var getPreviousChip = (0, _react.useCallback)(function (id) {
|
|
66
72
|
var currentIndex = childRefs.current.findIndex(function (child) {
|
|
67
73
|
return child.id === id;
|
|
@@ -149,18 +155,26 @@ var ChipsBase = exports.ChipsBase = function ChipsBase(props) {
|
|
|
149
155
|
});
|
|
150
156
|
}
|
|
151
157
|
}, [children]);
|
|
152
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div",
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
158
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
159
|
+
role: "region",
|
|
160
|
+
"aria-labelledby": "".concat(ariaId, "_chips"),
|
|
161
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", _objectSpread(_objectSpread({
|
|
162
|
+
"aria-label": ariaLabel,
|
|
163
|
+
className: chipsClassName,
|
|
164
|
+
id: "".concat(ariaId, "_chips"),
|
|
165
|
+
ref: containerRef,
|
|
166
|
+
role: "group"
|
|
167
|
+
}, rest), {}, {
|
|
168
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ChipsContext, {
|
|
169
|
+
value: {
|
|
170
|
+
getNextTargetFromDeleteButton: getNextTargetFromDeleteButton,
|
|
171
|
+
handleChipDelete: handleChipDelete,
|
|
172
|
+
registerChild: registerChild
|
|
173
|
+
},
|
|
174
|
+
children: children
|
|
175
|
+
})
|
|
176
|
+
}))
|
|
177
|
+
});
|
|
164
178
|
};
|
|
165
179
|
ChipsBase.displayName = 'Chips';
|
|
166
180
|
ChipsBase.propTypes = /** @lends limestone/Chips.Chips.prototype */{
|
package/Chips/Chips.module.css
CHANGED
|
@@ -15,6 +15,16 @@ describe('Chip', function () {
|
|
|
15
15
|
var actual = _react.screen.getByTestId('chip').textContent.codePointAt();
|
|
16
16
|
expect(actual).toBe(expected);
|
|
17
17
|
});
|
|
18
|
+
test('should support image if prop `isImage` is `true', function () {
|
|
19
|
+
var svg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MDAiIGhlaWdodD0iNzAwIiB2aWV3Qm94PSIwIDAgNzAwIDcwMCI+PGRlZnM+PHN0eWxlPi5hLC5ie2ZpbGw6I2ZmZjt9LmJ7b3BhY2l0eTowLjg7fTwvc3R5bGU+PC9kZWZzPjxwb2x5Z29uIGNsYXNzPSJhIiBwb2ludHM9IjM0OS45IDUyNy44IDE5OS45IDQyOS44IDE5OS45IDM3NC40IDM1MC4xIDQ3Mi43IDM0OS45IDM0OC41IDE5OS45IDI2MS4xIDE5OS45IDIwOS4zIDM1MCAyOTMuNiAzNTAgMjkzLjYgMzUwLjIgMjkzLjcgMzQ5LjkgMTY5LjMgMTAyLjcgNDguNSAxMDIuNyA0NzIuNiAzNTAuMSA2NTEuNiAzNDkuOSA1MjcuOCIvPjxwb2x5Z29uIGNsYXNzPSJiIiBwb2ludHM9IjM1MC4xIDY1MS42IDU5Ny4zIDQ3Mi44IDU5Ny4zIDM2Ni4zIDM0OS45IDUyNy44IDM1MC4xIDY1MS42Ii8+PHBvbHlnb24gY2xhc3M9ImIiIHBvaW50cz0iMzUwLjEgNDcyLjcgNTIzLjUgMzU5LjMgNTIzLjUgMjQ3LjQgMzQ5LjkgMzQ4LjUgMzUwLjEgNDcyLjciLz48cG9seWdvbiBjbGFzcz0iYiIgcG9pbnRzPSIzNTAgMjkzLjYgMzUwIDI5My42IDM1MC4yIDI5My43IDU5Ny4zIDE1NC44IDU5Ny4zIDQ4LjQgMzQ5LjkgMTY5LjMgMzUwIDI5My42Ii8+PC9zdmc+';
|
|
20
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
21
|
+
"data-testid": "chip",
|
|
22
|
+
icon: svg,
|
|
23
|
+
isImage: true
|
|
24
|
+
}));
|
|
25
|
+
var actual = _react.screen.queryAllByRole('img')[0].firstChild;
|
|
26
|
+
expect(actual).toHaveAttribute('src', svg);
|
|
27
|
+
});
|
|
18
28
|
test('should support `children` prop', function () {
|
|
19
29
|
var children = 'label';
|
|
20
30
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
@@ -88,7 +98,7 @@ describe('Chip', function () {
|
|
|
88
98
|
disabled: true,
|
|
89
99
|
children: "Disabled Chip"
|
|
90
100
|
}));
|
|
91
|
-
var chipButton = _react.screen.getByRole('
|
|
101
|
+
var chipButton = _react.screen.getByRole('checkbox');
|
|
92
102
|
expect(chipButton).toHaveAttribute('aria-disabled', 'true');
|
|
93
103
|
});
|
|
94
104
|
test('should handle disabled state with delete button', function () {
|
|
@@ -100,10 +110,10 @@ describe('Chip', function () {
|
|
|
100
110
|
},
|
|
101
111
|
children: "Disabled Chip"
|
|
102
112
|
}));
|
|
103
|
-
var
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
113
|
+
var chip = _react.screen.getByRole('checkbox');
|
|
114
|
+
var deleteButton = _react.screen.getByRole('button');
|
|
115
|
+
expect(chip).toHaveAttribute('aria-disabled', 'true');
|
|
116
|
+
expect(deleteButton).toHaveAttribute('aria-disabled', 'true');
|
|
107
117
|
});
|
|
108
118
|
test('should use default delete button icon when not specified', function () {
|
|
109
119
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.ChipBase, {
|
|
@@ -136,7 +146,7 @@ describe('Chip', function () {
|
|
|
136
146
|
id: chipId,
|
|
137
147
|
children: "Test Chip"
|
|
138
148
|
}));
|
|
139
|
-
var chipButton = _react.screen.getByRole('
|
|
149
|
+
var chipButton = _react.screen.getByRole('checkbox');
|
|
140
150
|
expect(chipButton).toHaveAttribute('data-chip-index', chipId);
|
|
141
151
|
});
|
|
142
152
|
test('should handle onClick events', function () {
|
|
@@ -145,7 +155,7 @@ describe('Chip', function () {
|
|
|
145
155
|
onClick: mockOnClick,
|
|
146
156
|
children: "Clickable Chip"
|
|
147
157
|
}));
|
|
148
|
-
var chipButton = _react.screen.getByRole('
|
|
158
|
+
var chipButton = _react.screen.getByRole('checkbox');
|
|
149
159
|
_react.fireEvent.click(chipButton);
|
|
150
160
|
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
151
161
|
});
|
|
@@ -170,7 +180,7 @@ describe('Chip', function () {
|
|
|
170
180
|
"data-testid": "chip",
|
|
171
181
|
children: "Test Chip"
|
|
172
182
|
}));
|
|
173
|
-
var chipButton = _react.screen.getByRole('
|
|
183
|
+
var chipButton = _react.screen.getByRole('checkbox');
|
|
174
184
|
expect(chipButton).toHaveClass(customClass);
|
|
175
185
|
});
|
|
176
186
|
test('should render chip with required props only', function () {
|
|
@@ -180,7 +190,7 @@ describe('Chip', function () {
|
|
|
180
190
|
}));
|
|
181
191
|
var chipText = _react.screen.getByText('Minimal Chip');
|
|
182
192
|
expect(chipText).toBeInTheDocument();
|
|
183
|
-
var chipButton = _react.screen.getByRole('
|
|
193
|
+
var chipButton = _react.screen.getByRole('checkbox');
|
|
184
194
|
expect(chipButton).toHaveAttribute('data-chip-index', 'minimal-chip');
|
|
185
195
|
});
|
|
186
196
|
});
|
|
@@ -46,13 +46,13 @@ describe('Chips', function () {
|
|
|
46
46
|
it('should render correctly with default props', function () {
|
|
47
47
|
var _render = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, defaultProps))),
|
|
48
48
|
container = _render.container;
|
|
49
|
-
expect(container.firstChild).toHaveClass('chips');
|
|
50
|
-
expect(container.firstChild).toHaveClass('vertical');
|
|
49
|
+
expect(container.firstChild.firstChild).toHaveClass('chips');
|
|
50
|
+
expect(container.firstChild.firstChild).toHaveClass('vertical');
|
|
51
51
|
});
|
|
52
52
|
it('should focus the correct chip on navigation', function () {
|
|
53
53
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, defaultProps)));
|
|
54
|
-
var chip1 = _react.screen.getByText('Chip 1').closest('[role="
|
|
55
|
-
var chip2 = _react.screen.getByText('Chip 2').closest('[role="
|
|
54
|
+
var chip1 = _react.screen.getByText('Chip 1').closest('[role="checkbox"]');
|
|
55
|
+
var chip2 = _react.screen.getByText('Chip 2').closest('[role="checkbox"]');
|
|
56
56
|
chip1.setAttribute('tabIndex', '0');
|
|
57
57
|
chip2.setAttribute('tabIndex', '0');
|
|
58
58
|
chip1.focus();
|
|
@@ -72,7 +72,7 @@ describe('Chips', function () {
|
|
|
72
72
|
});
|
|
73
73
|
it('should call handleDelete when delete button is clicked', function () {
|
|
74
74
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, defaultProps)));
|
|
75
|
-
var chipButtons = _react.screen.getAllByRole('
|
|
75
|
+
var chipButtons = _react.screen.getAllByRole('checkbox', {
|
|
76
76
|
name: /Chip [12]/i
|
|
77
77
|
});
|
|
78
78
|
_react.fireEvent.focus(chipButtons[0]);
|
|
@@ -87,16 +87,16 @@ describe('Chips', function () {
|
|
|
87
87
|
});
|
|
88
88
|
var _render2 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, horizontalProps))),
|
|
89
89
|
container = _render2.container;
|
|
90
|
-
expect(container.firstChild).toHaveClass('chips');
|
|
91
|
-
expect(container.firstChild).toHaveClass('horizontal');
|
|
90
|
+
expect(container.firstChild.firstChild).toHaveClass('chips');
|
|
91
|
+
expect(container.firstChild.firstChild).toHaveClass('horizontal');
|
|
92
92
|
});
|
|
93
93
|
it('should handle navigation in horizontal orientation', function () {
|
|
94
94
|
var horizontalProps = _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
95
95
|
orientation: 'horizontal'
|
|
96
96
|
});
|
|
97
97
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, horizontalProps)));
|
|
98
|
-
var chip1 = _react.screen.getByText('Chip 1').closest('[role="
|
|
99
|
-
var chip2 = _react.screen.getByText('Chip 2').closest('[role="
|
|
98
|
+
var chip1 = _react.screen.getByText('Chip 1').closest('[role="checkbox"]');
|
|
99
|
+
var chip2 = _react.screen.getByText('Chip 2').closest('[role="checkbox"]');
|
|
100
100
|
chip1.setAttribute('tabIndex', '0');
|
|
101
101
|
chip2.setAttribute('tabIndex', '0');
|
|
102
102
|
chip1.focus();
|
|
@@ -173,7 +173,7 @@ describe('Chips', function () {
|
|
|
173
173
|
}, "chip1")]
|
|
174
174
|
};
|
|
175
175
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, clickableProps)));
|
|
176
|
-
var chipButton = _react.screen.getByText('Chip 1').closest('[role="
|
|
176
|
+
var chipButton = _react.screen.getByText('Chip 1').closest('[role="checkbox"]');
|
|
177
177
|
_react.fireEvent.click(chipButton);
|
|
178
178
|
expect(mockOnClick).toHaveBeenCalledTimes(1);
|
|
179
179
|
});
|
|
@@ -213,7 +213,7 @@ describe('Chips', function () {
|
|
|
213
213
|
}, "chip2")]
|
|
214
214
|
};
|
|
215
215
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, disabledProps)));
|
|
216
|
-
var disabledChips = _react.screen.getAllByRole('
|
|
216
|
+
var disabledChips = _react.screen.getAllByRole('checkbox');
|
|
217
217
|
disabledChips.forEach(function (chip) {
|
|
218
218
|
expect(chip).toHaveAttribute('aria-disabled', 'true');
|
|
219
219
|
});
|
|
@@ -243,9 +243,9 @@ describe('Chips', function () {
|
|
|
243
243
|
};
|
|
244
244
|
var _render3 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, emptyProps))),
|
|
245
245
|
container = _render3.container;
|
|
246
|
-
expect(container.firstChild).toHaveClass('chips');
|
|
247
|
-
expect(container.firstChild).toHaveClass('vertical');
|
|
248
|
-
var buttons = _react.screen.queryAllByRole('
|
|
246
|
+
expect(container.firstChild.firstChild).toHaveClass('chips');
|
|
247
|
+
expect(container.firstChild.firstChild).toHaveClass('vertical');
|
|
248
|
+
var buttons = _react.screen.queryAllByRole('checkbox');
|
|
249
249
|
expect(buttons).toHaveLength(0);
|
|
250
250
|
});
|
|
251
251
|
it('should handle custom className', function () {
|
|
@@ -254,17 +254,17 @@ describe('Chips', function () {
|
|
|
254
254
|
});
|
|
255
255
|
var _render4 = (0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, customProps))),
|
|
256
256
|
container = _render4.container;
|
|
257
|
-
expect(container.firstChild).toHaveClass('chips');
|
|
258
|
-
expect(container.firstChild).toHaveClass('vertical');
|
|
259
|
-
expect(container.firstChild).toHaveClass('custom-chips-class');
|
|
257
|
+
expect(container.firstChild.firstChild).toHaveClass('chips');
|
|
258
|
+
expect(container.firstChild.firstChild).toHaveClass('vertical');
|
|
259
|
+
expect(container.firstChild.firstChild).toHaveClass('custom-chips-class');
|
|
260
260
|
});
|
|
261
261
|
it('should handle keyboard navigation with mixed orientations', function () {
|
|
262
262
|
var verticalProps = _objectSpread(_objectSpread({}, defaultProps), {}, {
|
|
263
263
|
orientation: 'vertical'
|
|
264
264
|
});
|
|
265
265
|
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_Chips.ChipsBase, _objectSpread({}, verticalProps)));
|
|
266
|
-
var chip1 = _react.screen.getByText('Chip 1').closest('[role="
|
|
267
|
-
var chip2 = _react.screen.getByText('Chip 2').closest('[role="
|
|
266
|
+
var chip1 = _react.screen.getByText('Chip 1').closest('[role="checkbox"]');
|
|
267
|
+
var chip2 = _react.screen.getByText('Chip 2').closest('[role="checkbox"]');
|
|
268
268
|
chip1.setAttribute('tabIndex', '0');
|
|
269
269
|
chip2.setAttribute('tabIndex', '0');
|
|
270
270
|
|
|
@@ -18,11 +18,10 @@ wrapped component.
|
|
|
18
18
|
*/
|
|
19
19
|
openProp?: string;
|
|
20
20
|
}
|
|
21
|
-
export interface ContextualMenuDecoratorProps
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
> {
|
|
21
|
+
export interface ContextualMenuDecoratorProps extends Merge<
|
|
22
|
+
Merge<ui_Toggleable_ToggleableProps, limestone_Skinnable_SkinnableProps>,
|
|
23
|
+
limestone_ContextualPopupDecorator_ContextualPopupDecoratorProps
|
|
24
|
+
> {
|
|
26
25
|
/**
|
|
27
26
|
* Direction of popup with respect to the wrapped component.
|
|
28
27
|
*/
|