@enact/ui 4.6.1 → 4.7.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/AnnounceDecorator/Announce.js +27 -15
- package/AnnounceDecorator/AnnounceDecorator.d.ts +64 -0
- package/AnnounceDecorator/AnnounceDecorator.js +15 -6
- package/AnnounceDecorator/useAnnounce.js +1 -2
- package/BodyText/BodyText.d.ts +66 -0
- package/BodyText/BodyText.js +14 -6
- package/Button/Button.d.ts +125 -0
- package/Button/Button.js +18 -10
- package/CHANGELOG.md +14 -0
- package/Cancelable/Cancelable.d.ts +64 -0
- package/Cancelable/Cancelable.js +17 -9
- package/Cancelable/tests/Cancelable-specs.js +3 -1
- package/Changeable/Changeable.d.ts +54 -0
- package/Changeable/Changeable.js +15 -9
- package/ComponentOverride/ComponentOverride.d.ts +52 -0
- package/ComponentOverride/ComponentOverride.js +18 -5
- package/FloatingLayer/FloatingLayer.js +14 -13
- package/FloatingLayer/FloatingLayerContainer.js +3 -1
- package/FloatingLayer/FloatingLayerDecorator.js +11 -6
- package/FloatingLayer/Scrim.js +4 -2
- package/FloatingLayer/index.d.ts +100 -0
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +3 -1
- package/FloatingLayer/useFloatingLayer.js +2 -2
- package/ForwardRef/ForwardRef.d.ts +22 -0
- package/ForwardRef/ForwardRef.js +13 -7
- package/GridListImageItem/GridListImageItem.d.ts +85 -0
- package/GridListImageItem/GridListImageItem.js +16 -7
- package/Group/Group.d.ts +107 -0
- package/Group/Group.js +17 -6
- package/Group/GroupItem.js +16 -10
- package/Heading/Heading.d.ts +89 -0
- package/Heading/Heading.js +22 -9
- package/Icon/Icon.d.ts +88 -0
- package/Icon/Icon.js +15 -6
- package/IconButton/IconButton.d.ts +115 -0
- package/IconButton/IconButton.js +26 -11
- package/Image/Image.d.ts +113 -0
- package/Image/Image.js +16 -6
- package/ImageItem/ImageItem.d.ts +83 -0
- package/ImageItem/ImageItem.js +12 -2
- package/ImageItem/tests/ImageItem-specs.js +3 -1
- package/Item/Item.d.ts +64 -0
- package/Item/Item.js +17 -7
- package/LabeledIcon/LabeledIcon.d.ts +130 -0
- package/LabeledIcon/LabeledIcon.js +16 -6
- package/Layout/Cell.js +30 -5
- package/Layout/Layout.d.ts +284 -0
- package/Layout/Layout.js +181 -36
- package/Layout/Layout.module.css +8 -0
- package/Layout/tests/Layout-specs.js +44 -3
- package/Marquee/MarqueeBase.js +3 -1
- package/Marquee/MarqueeController.js +54 -2
- package/Marquee/MarqueeDecorator.js +44 -4
- package/Marquee/index.d.ts +258 -0
- package/Marquee/tests/Marquee-specs.js +3 -1
- package/Measurable/Measurable.d.ts +26 -0
- package/Measurable/Measurable.js +16 -10
- package/Measurable/tests/Measurable-specs.js +8 -6
- package/Media/Media.d.ts +99 -0
- package/Media/Media.js +36 -27
- package/Placeholder/PlaceholderControllerDecorator.js +13 -10
- package/Placeholder/PlaceholderDecorator.js +11 -10
- package/Placeholder/index.d.ts +53 -0
- package/ProgressBar/ProgressBar.d.ts +92 -0
- package/ProgressBar/ProgressBar.js +14 -1
- package/README.md +1 -1
- package/RadioDecorator/RadioControllerDecorator.js +4 -2
- package/RadioDecorator/RadioDecorator.d.ts +35 -0
- package/RadioDecorator/RadioDecorator.js +17 -9
- package/Repeater/Repeater.d.ts +82 -0
- package/Repeater/Repeater.js +16 -10
- package/Repeater/tests/Repeater-specs.js +3 -1
- package/Resizable/Resizable.d.ts +31 -0
- package/Resizable/Resizable.js +16 -10
- package/Routable/Link.js +12 -10
- package/Routable/Routable.d.ts +148 -0
- package/Routable/Routable.js +17 -8
- package/Routable/Router.js +14 -12
- package/Routable/tests/Routable-specs.js +5 -3
- package/Scrollable/ScrollAnimator.js +3 -1
- package/Scrollable/ScrollThumb.js +10 -9
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scrollable/Scrollable.js +27 -3
- package/Scrollable/ScrollableNative.js +16 -2
- package/Scrollable/Scrollbar.js +4 -2
- package/Scroller/Scroller.d.ts +276 -0
- package/Scroller/Scroller.js +10 -1
- package/Scroller/ScrollerBasic.js +12 -11
- package/Scroller/UiScrollerBase.js +15 -14
- package/Skinnable/Skinnable.d.ts +94 -0
- package/Skinnable/Skinnable.js +20 -6
- package/Skinnable/tests/Skinnable-specs.js +3 -1
- package/Skinnable/tests/useSkins-specs.js +3 -1
- package/Skinnable/useSkins.js +1 -2
- package/Slider/Knob.js +8 -6
- package/Slider/PositionDecorator.js +4 -2
- package/Slider/Slider.d.ts +202 -0
- package/Slider/Slider.js +18 -9
- package/SlotItem/SlotItem.d.ts +118 -0
- package/SlotItem/SlotItem.js +20 -6
- package/Slottable/Slottable.d.ts +22 -0
- package/Slottable/Slottable.js +16 -8
- package/Slottable/useSlots.js +3 -1
- package/Spinner/Spinner.d.ts +95 -0
- package/Spinner/Spinner.js +24 -7
- package/ToggleIcon/ToggleIcon.d.ts +90 -0
- package/ToggleIcon/ToggleIcon.js +21 -7
- package/ToggleItem/ToggleItem.d.ts +132 -0
- package/ToggleItem/ToggleItem.js +17 -2
- package/ToggleItem/tests/ToggleItem-specs.js +3 -1
- package/Toggleable/Toggle.js +4 -2
- package/Toggleable/Toggleable.d.ts +103 -0
- package/Toggleable/Toggleable.js +13 -7
- package/Toggleable/useToggle.js +1 -2
- package/Touchable/ClickAllow.js +3 -1
- package/Touchable/Drag.js +6 -3
- package/Touchable/Flick.js +6 -2
- package/Touchable/Hold.js +6 -2
- package/Touchable/Pinch.js +6 -3
- package/Touchable/Touch.js +6 -4
- package/Touchable/Touchable.d.ts +217 -0
- package/Touchable/Touchable.js +10 -1
- package/Touchable/config.js +3 -1
- package/Touchable/tests/useTouch-specs.js +3 -1
- package/Touchable/useTouch.js +5 -4
- package/Transition/Transition.d.ts +194 -0
- package/Transition/Transition.js +22 -4
- package/Transition/tests/Transition-specs.js +5 -3
- package/ViewManager/Arranger.js +6 -1
- package/ViewManager/TransitionGroup.js +8 -5
- package/ViewManager/View.js +7 -4
- package/ViewManager/ViewManager.d.ts +191 -0
- package/ViewManager/ViewManager.js +29 -11
- package/ViewManager/tests/ViewManager-specs.js +47 -1
- package/VirtualList/UiVirtualListBase.js +9 -3
- package/VirtualList/VirtualList.d.ts +528 -0
- package/VirtualList/VirtualList.js +13 -1
- package/VirtualList/VirtualListBasic.js +9 -3
- package/VirtualList/tests/VirtualGridList-native-specs.js +3 -1
- package/VirtualList/tests/VirtualGridList-specs.js +3 -1
- package/VirtualList/tests/VirtualList-native-specs.js +3 -1
- package/VirtualList/tests/VirtualList-specs.js +3 -1
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/IdProvider/IdProvider.js +8 -7
- package/internal/IdProvider/Provider.js +3 -1
- package/internal/IdProvider/tests/IdProvider-specs.js +3 -1
- package/internal/IdProvider/tests/useId-specs.js +4 -3
- package/internal/IdProvider/useId.js +0 -1
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/Pure/Pure.js +15 -9
- package/internal/Pure/tests/Pure-specs.js +4 -2
- package/internal/localized-fonts/localized-fonts.d.ts +53 -0
- package/internal/localized-fonts/localized-fonts.js +2 -2
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/package.json +2 -2
- package/resolution/ResolutionDecorator.js +40 -9
- package/resolution/index.d.ts +187 -0
- package/resolution/resolution.js +23 -7
- package/useControlledState/tests/useControlledState-specs.js +2 -2
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useControlledState/useControlledState.js +2 -2
- package/useScroll/ScrollAnimator.js +3 -1
- package/useScroll/Scrollbar.js +6 -4
- package/useScroll/ScrollbarTrack.js +8 -6
- package/useScroll/useScroll.d.ts +0 -0
- package/useScroll/useScroll.js +80 -52
|
@@ -8,20 +8,6 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
10
|
var _class;
|
|
11
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
13
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
14
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
19
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
20
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
21
|
-
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
22
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
23
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
24
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
11
|
/**
|
|
26
12
|
* An unstyled component with an imperative API to alert the user.
|
|
27
13
|
*
|
|
@@ -57,6 +43,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
57
43
|
* @memberof ui/AnnounceDecorator
|
|
58
44
|
* @public
|
|
59
45
|
*/
|
|
46
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
47
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
48
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
49
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
50
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
51
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
52
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
53
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
54
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
55
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
56
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
58
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
59
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
60
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
61
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
60
62
|
var Announce = (_class = /*#__PURE__*/function (_Component) {
|
|
61
63
|
_inherits(Announce, _Component);
|
|
62
64
|
var _super = _createSuper(Announce);
|
|
@@ -106,7 +108,17 @@ var Announce = (_class = /*#__PURE__*/function (_Component) {
|
|
|
106
108
|
if (this.alertTimeout) {
|
|
107
109
|
clearTimeout(this.alertTimeout);
|
|
108
110
|
}
|
|
109
|
-
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Call to update the message for the alert.
|
|
115
|
+
*
|
|
116
|
+
* @method
|
|
117
|
+
* @param {String} message Message to notify the user
|
|
118
|
+
* @param {Boolean} clear Clears a previous message before setting the new message
|
|
119
|
+
* @returns {undefined}
|
|
120
|
+
* @public
|
|
121
|
+
*/)
|
|
110
122
|
}, {
|
|
111
123
|
key: "render",
|
|
112
124
|
value: function render() {
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Type definitions for ui/AnnounceDecorator
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
6
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
7
|
+
|
|
8
|
+
export interface AnnounceDecoratorProps {
|
|
9
|
+
/**
|
|
10
|
+
* The wrapped component's children.
|
|
11
|
+
*
|
|
12
|
+
* An instance of will be appended to `children` .
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export function AnnounceDecorator<P>(
|
|
17
|
+
Component: React.ComponentType<P> | string
|
|
18
|
+
): React.ComponentType<P & AnnounceDecoratorProps>;
|
|
19
|
+
|
|
20
|
+
export interface AnnounceProps {
|
|
21
|
+
/**
|
|
22
|
+
* Time, in milliseconds, to wait to remove the alert message.
|
|
23
|
+
*
|
|
24
|
+
* Subsequent updates to the
|
|
25
|
+
message before the timeout are ignored.
|
|
26
|
+
*/
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* An unstyled component with an imperative API to alert the user.
|
|
31
|
+
*
|
|
32
|
+
* The `announce()` method should be used to alert the user of behavior for accessibility.
|
|
33
|
+
*
|
|
34
|
+
* Example:
|
|
35
|
+
* ```
|
|
36
|
+
import {Announce} from '@enact/ui/AnnounceDecorator';
|
|
37
|
+
import {Component} from 'react';
|
|
38
|
+
|
|
39
|
+
class Example extends Component {
|
|
40
|
+
notify = () => {
|
|
41
|
+
if (this.announce) {
|
|
42
|
+
this.announce.announce('this text will be alerted to user by TTS');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
setAnnounceRef = (announce) => {
|
|
47
|
+
this.announce = announce;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render () {
|
|
51
|
+
<div>
|
|
52
|
+
<button onClick={this.notify}>Notify on Click</button>
|
|
53
|
+
<Announce ref={this.setAnnounceRef} />
|
|
54
|
+
</div>
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export class Announce extends React.Component<
|
|
61
|
+
Merge<React.HTMLProps<HTMLElement>, AnnounceProps>
|
|
62
|
+
> {}
|
|
63
|
+
|
|
64
|
+
export default AnnounceDecorator;
|
|
@@ -22,12 +22,13 @@ var _Announce = _interopRequireDefault(require("./Announce"));
|
|
|
22
22
|
var _useAnnounce = _interopRequireDefault(require("./useAnnounce"));
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
var _excluded = ["children"];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Provides components to assist in notifying the user through ARIA alerts.
|
|
27
|
+
*
|
|
28
|
+
* @module ui/AnnounceDecorator
|
|
29
|
+
* @exports Announce
|
|
30
|
+
* @exports AnnounceDecorator
|
|
31
|
+
*/
|
|
31
32
|
/**
|
|
32
33
|
* Default config for {@link ui/AnnounceDecorator.AnnounceDecorator}.
|
|
33
34
|
*
|
|
@@ -35,6 +36,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
35
36
|
* @hocconfig
|
|
36
37
|
* @private
|
|
37
38
|
*/
|
|
39
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
42
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
43
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
44
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
45
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
46
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
38
47
|
var defaultConfig = {
|
|
39
48
|
/**
|
|
40
49
|
* Configures the prop name to pass the announce function.
|
|
@@ -36,8 +36,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "d
|
|
|
36
36
|
*
|
|
37
37
|
* @returns {useAnnounceInterface}
|
|
38
38
|
* @private
|
|
39
|
-
*/
|
|
40
|
-
function useAnnounce() {
|
|
39
|
+
*/function useAnnounce() {
|
|
41
40
|
var ref = (0, _react.useRef)(null);
|
|
42
41
|
var announce = (0, _react.useCallback)(function (message) {
|
|
43
42
|
if (ref.current) {
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Type definitions for ui/BodyText
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
+
|
|
6
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
7
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
8
|
+
|
|
9
|
+
export interface BodyTextBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Centers the contents.
|
|
12
|
+
*
|
|
13
|
+
* Applies the `centered` CSS class which can be customized by
|
|
14
|
+
.
|
|
15
|
+
*/
|
|
16
|
+
centered?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* The type of component to use to render the item. May be a DOM node name (e.g 'div',
|
|
19
|
+
'p', etc.) or a custom component.
|
|
20
|
+
*/
|
|
21
|
+
component?: React.ComponentType;
|
|
22
|
+
/**
|
|
23
|
+
* Called with a reference to the root component.
|
|
24
|
+
*
|
|
25
|
+
* When using , the `ref` prop is forwarded to this component
|
|
26
|
+
as `componentRef` .
|
|
27
|
+
*/
|
|
28
|
+
componentRef?: object | Function;
|
|
29
|
+
/**
|
|
30
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
31
|
+
corresponding internal elements and states of this component.
|
|
32
|
+
*
|
|
33
|
+
* The following classes are supported:
|
|
34
|
+
* * `bodyText` - The root class name
|
|
35
|
+
* * `centered` - Applied when `centered` prop is `true`
|
|
36
|
+
*/
|
|
37
|
+
css?: object;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A simple, unstyled text block component, without
|
|
41
|
+
applied.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export class BodyTextBase extends React.Component<
|
|
45
|
+
Merge<React.HTMLProps<HTMLElement>, BodyTextBaseProps>
|
|
46
|
+
> {}
|
|
47
|
+
|
|
48
|
+
export interface BodyTextDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
49
|
+
export function BodyTextDecorator<P>(
|
|
50
|
+
Component: React.ComponentType<P> | string
|
|
51
|
+
): React.ComponentType<P & BodyTextDecoratorProps>;
|
|
52
|
+
|
|
53
|
+
export interface BodyTextProps
|
|
54
|
+
extends Omit<
|
|
55
|
+
Merge<BodyTextBaseProps, BodyTextDecoratorProps>,
|
|
56
|
+
"componentRef"
|
|
57
|
+
> {}
|
|
58
|
+
/**
|
|
59
|
+
* A simple, unstyled text block component.
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
export class BodyText extends React.Component<
|
|
63
|
+
Merge<React.HTMLProps<HTMLElement>, BodyTextProps>
|
|
64
|
+
> {}
|
|
65
|
+
|
|
66
|
+
export default BodyText;
|
package/BodyText/BodyText.js
CHANGED
|
@@ -11,12 +11,12 @@ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
|
11
11
|
var _BodyTextModule = _interopRequireDefault(require("./BodyText.module.css"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
13
|
var _excluded = ["component", "componentRef"];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
/**
|
|
15
|
+
* Text block component to be customized by a theme or application.
|
|
16
|
+
*
|
|
17
|
+
* @module ui/BodyText
|
|
18
|
+
* @exports BodyText
|
|
19
|
+
*/
|
|
20
20
|
/**
|
|
21
21
|
* A simple, unstyled text block component, without
|
|
22
22
|
* {@link ui/BodyText.BodyTextDecorator|BodyTextDecorator} applied.
|
|
@@ -26,6 +26,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
26
26
|
* @ui
|
|
27
27
|
* @public
|
|
28
28
|
*/
|
|
29
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
34
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
35
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
36
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
29
37
|
var BodyTextBase = (0, _kind["default"])({
|
|
30
38
|
name: 'ui:BodyText',
|
|
31
39
|
propTypes: /** @lends ui/BodyText.BodyTextBase.prototype */{
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Type definitions for ui/Button
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
|
|
5
|
+
|
|
6
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
7
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
8
|
+
|
|
9
|
+
export interface ButtonBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Called with a reference to the root component.
|
|
12
|
+
*
|
|
13
|
+
* When using , the `ref` prop is forwarded to this component
|
|
14
|
+
as `componentRef` .
|
|
15
|
+
*/
|
|
16
|
+
componentRef?: object | Function;
|
|
17
|
+
/**
|
|
18
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
19
|
+
corresponding internal elements and states of this component.
|
|
20
|
+
*
|
|
21
|
+
* The following classes are supported:
|
|
22
|
+
* * `button` - The root component class
|
|
23
|
+
* * `bg` - The background node of the button
|
|
24
|
+
* * `client` - The content node of the button
|
|
25
|
+
* * `hasIcon` - Applied when there is an `icon` present
|
|
26
|
+
* * `icon` - The icon node, when `icon` is set
|
|
27
|
+
* * `large` - Applied when `size` prop is `'large'`
|
|
28
|
+
* * `minWidth` - Applied when `minWidth` prop is `true`
|
|
29
|
+
* * `pressed` - Applied when `pressed` prop is `true`
|
|
30
|
+
* * `selected` - Applied when `selected` prop is `true`
|
|
31
|
+
* * `small` - Applied when `size` prop is `'small'`
|
|
32
|
+
*/
|
|
33
|
+
css?: object;
|
|
34
|
+
/**
|
|
35
|
+
* Applies the `disabled` class.
|
|
36
|
+
*
|
|
37
|
+
* When `true` , the button is shown as disabled.
|
|
38
|
+
*/
|
|
39
|
+
disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The icon displayed within the Button.
|
|
42
|
+
*
|
|
43
|
+
* The icon will be displayed before the natural reading order of the text, regardless
|
|
44
|
+
of locale. Any string that is valid for its is
|
|
45
|
+
valid here. If `icon` is specified as a string and `iconButton` is undefined, the icon is
|
|
46
|
+
not rendered.
|
|
47
|
+
*
|
|
48
|
+
* This also supports a custom icon, in the form of a DOM node or a Component,
|
|
49
|
+
with the caveat that if you supply a custom icon, you are responsible for sizing and
|
|
50
|
+
locale positioning of the custom component.
|
|
51
|
+
*
|
|
52
|
+
* Setting this to `true` means the `iconComponent` will be rendered but with empty content.
|
|
53
|
+
This may be useful if you've customized the `iconComponent` to render the icon content
|
|
54
|
+
externally.
|
|
55
|
+
*/
|
|
56
|
+
icon?: React.ReactNode | boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The component used to render the .
|
|
59
|
+
*
|
|
60
|
+
* This component will receive the `icon` class to customize its styling.
|
|
61
|
+
If is not assigned or is false, this component
|
|
62
|
+
will not be rendered.
|
|
63
|
+
*
|
|
64
|
+
* If this is a component rather than an HTML element string, this component will also
|
|
65
|
+
receive the `size` and `iconFlip` (as `flip` ) properties and should be configured to
|
|
66
|
+
handle it.
|
|
67
|
+
*/
|
|
68
|
+
iconComponent?: React.ComponentType | React.ReactNode;
|
|
69
|
+
/**
|
|
70
|
+
* Flips the icon.
|
|
71
|
+
*/
|
|
72
|
+
iconFlip?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Enforces a minimum width for the component.
|
|
75
|
+
*
|
|
76
|
+
* Applies the `minWidth` CSS class which can be customized by
|
|
77
|
+
.
|
|
78
|
+
*/
|
|
79
|
+
minWidth?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Indicates the component is depressed.
|
|
82
|
+
*
|
|
83
|
+
* Applies the `pressed` CSS class which can be customized by
|
|
84
|
+
.
|
|
85
|
+
*/
|
|
86
|
+
pressed?: boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Indicates the component is selected.
|
|
89
|
+
*
|
|
90
|
+
* Applies the `selected` CSS class which can be customized by
|
|
91
|
+
.
|
|
92
|
+
*/
|
|
93
|
+
selected?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* The size of the button.
|
|
96
|
+
*
|
|
97
|
+
* Applies the CSS class which can be customized by
|
|
98
|
+
.
|
|
99
|
+
*/
|
|
100
|
+
size?: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* A basic button component structure without any behaviors applied to it.
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
export class ButtonBase extends React.Component<
|
|
107
|
+
Merge<React.HTMLProps<HTMLElement>, ButtonBaseProps>
|
|
108
|
+
> {}
|
|
109
|
+
|
|
110
|
+
export interface ButtonDecoratorProps extends ui_Touchable_TouchableProps {}
|
|
111
|
+
export function ButtonDecorator<P>(
|
|
112
|
+
Component: React.ComponentType<P> | string
|
|
113
|
+
): React.ComponentType<P & ButtonDecoratorProps>;
|
|
114
|
+
|
|
115
|
+
export interface ButtonProps
|
|
116
|
+
extends Omit<Merge<ButtonBaseProps, ButtonDecoratorProps>, "componentRef"> {}
|
|
117
|
+
/**
|
|
118
|
+
* A minimally-styled button component with touch support.
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
export class Button extends React.Component<
|
|
122
|
+
Merge<React.HTMLProps<HTMLElement>, ButtonProps>
|
|
123
|
+
> {}
|
|
124
|
+
|
|
125
|
+
export default Button;
|
package/Button/Button.js
CHANGED
|
@@ -19,15 +19,23 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
19
19
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
20
20
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
21
21
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
24
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
|
|
25
|
+
* Unstyled button components and behaviors to be customized by a theme or application.
|
|
26
|
+
*
|
|
27
|
+
* @module ui/Button
|
|
28
|
+
* @exports Button
|
|
29
|
+
* @exports ButtonBase
|
|
30
|
+
* @exports ButtonDecorator
|
|
31
|
+
*/ /**
|
|
32
|
+
* A basic button component structure without any behaviors applied to it.
|
|
33
|
+
*
|
|
34
|
+
* @class ButtonBase
|
|
35
|
+
* @memberof ui/Button
|
|
36
|
+
* @ui
|
|
37
|
+
* @public
|
|
38
|
+
*/
|
|
31
39
|
var ButtonBase = (0, _kind["default"])({
|
|
32
40
|
name: 'ui:Button',
|
|
33
41
|
propTypes: /** @lends ui/Button.ButtonBase.prototype */{
|
|
@@ -117,7 +125,7 @@ var ButtonBase = (0, _kind["default"])({
|
|
|
117
125
|
/**
|
|
118
126
|
* Flips the icon.
|
|
119
127
|
*
|
|
120
|
-
* @see {@link ui/Icon.
|
|
128
|
+
* @see {@link ui/Icon.IconBase.flip}
|
|
121
129
|
* @type {String}
|
|
122
130
|
* @public
|
|
123
131
|
*/
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact ui module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.7.0] - 2023-04-25
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `ui/Layout.Cell` prop `grow` to expand its size to the container
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `ui/ViewManager` to set index prop properly when reverseTransition prop is given
|
|
14
|
+
|
|
15
|
+
## [4.6.2] - 2023-03-09
|
|
16
|
+
|
|
17
|
+
No significant changes.
|
|
18
|
+
|
|
5
19
|
## [4.6.1] - 2023-02-03
|
|
6
20
|
|
|
7
21
|
### Added
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Type definitions for ui/Cancelable
|
|
2
|
+
|
|
3
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
4
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
5
|
+
|
|
6
|
+
export interface CancelableConfig extends Object {
|
|
7
|
+
/**
|
|
8
|
+
* Called when a cancel action is invoked by the user.
|
|
9
|
+
*
|
|
10
|
+
* If it is a string, the cancel handler will attempt to invoke a function passed as a prop of
|
|
11
|
+
that name. If it is a function, that function will be called with the current props as the
|
|
12
|
+
only argument.
|
|
13
|
+
*
|
|
14
|
+
* If the function handles the cancel action, it should call `stopPropagation()` on the provided
|
|
15
|
+
event object prevent container or `modal` Cancelable instances from also handling the action.
|
|
16
|
+
*/
|
|
17
|
+
onCancel: string | Function;
|
|
18
|
+
/**
|
|
19
|
+
* Subscribes to cancel events globally for this instance.
|
|
20
|
+
*
|
|
21
|
+
* When `true` , the `Cancelable` instance will handle cancel events globally that successfully
|
|
22
|
+
bubble up to `window` regardless of which component is focused.
|
|
23
|
+
*
|
|
24
|
+
* `modal` cancel handlers are processed in reverse of the order they are created such that the
|
|
25
|
+
innermost instance (in terms of the component hierarchy) have the first opportunity to handle
|
|
26
|
+
the event before its container components.
|
|
27
|
+
*/
|
|
28
|
+
modal?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The component that will contain the wrapped component.
|
|
31
|
+
*
|
|
32
|
+
* When set, the wrapped component will be contained within an instance of `component` . This may
|
|
33
|
+
be necessary if the props passed to the wrapped component are not placed on the root element.
|
|
34
|
+
*/
|
|
35
|
+
component?: React.ComponentType;
|
|
36
|
+
}
|
|
37
|
+
export interface CancelableProps {
|
|
38
|
+
/**
|
|
39
|
+
* Called when a cancel action is received.
|
|
40
|
+
*
|
|
41
|
+
* This callback is invoked for every cancel action before the config or prop handler is
|
|
42
|
+
invoked.
|
|
43
|
+
*/
|
|
44
|
+
onCancel?: Function;
|
|
45
|
+
}
|
|
46
|
+
export function Cancelable<P>(
|
|
47
|
+
config: CancelableConfig,
|
|
48
|
+
Component: React.ComponentType<P> | string
|
|
49
|
+
): React.ComponentType<P & CancelableProps>;
|
|
50
|
+
|
|
51
|
+
export function Cancelable<P>(
|
|
52
|
+
Component: React.ComponentType<P> | string
|
|
53
|
+
): React.ComponentType<P & CancelableProps>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Adds an event handler to filter cancel events.
|
|
57
|
+
*/
|
|
58
|
+
export function addCancelHandler(handler: Function): void;
|
|
59
|
+
/**
|
|
60
|
+
* Removes an event handler to filter cancel events
|
|
61
|
+
*/
|
|
62
|
+
export function removeCancelHandler(handler: Function): void;
|
|
63
|
+
|
|
64
|
+
export default Cancelable;
|
package/Cancelable/Cancelable.js
CHANGED
|
@@ -29,23 +29,31 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
29
29
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
30
30
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
31
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
32
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
32
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
33
33
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
34
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
34
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
35
35
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
36
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
37
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
36
38
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
37
39
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
38
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
39
41
|
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
40
42
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
41
43
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
42
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**
|
|
45
|
+
* Provides components and methods to add support for handling cancel actions.
|
|
46
|
+
*
|
|
47
|
+
* @module ui/Cancelable
|
|
48
|
+
* @exports addCancelHandler
|
|
49
|
+
* @exports Cancelable
|
|
50
|
+
* @exports removeCancelHandle
|
|
51
|
+
*/ /**
|
|
52
|
+
* Default config for {@link ui/Cancelable.Cancelable}
|
|
53
|
+
*
|
|
54
|
+
* @memberof ui/Cancelable.Cancelable
|
|
55
|
+
* @hocconfig
|
|
56
|
+
*/
|
|
49
57
|
var defaultConfig = {
|
|
50
58
|
/**
|
|
51
59
|
* Called when a cancel action is invoked by the user.
|
|
@@ -6,7 +6,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
6
6
|
var _excluded = ["children", "className", "onKeyUp"];
|
|
7
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
12
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
11
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
12
14
|
describe('Cancelable', function () {
|