@enact/ui 4.6.1 → 4.6.2
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 +4 -2
- package/AnnounceDecorator/AnnounceDecorator.d.ts +64 -0
- package/AnnounceDecorator/AnnounceDecorator.js +3 -1
- package/BodyText/BodyText.d.ts +66 -0
- package/BodyText/BodyText.js +3 -1
- package/Button/Button.d.ts +125 -0
- package/Button/Button.js +3 -1
- package/CHANGELOG.md +4 -0
- package/Cancelable/Cancelable.d.ts +64 -0
- package/Cancelable/Cancelable.js +4 -2
- package/Cancelable/tests/Cancelable-specs.js +3 -1
- package/Changeable/Changeable.d.ts +54 -0
- package/Changeable/Changeable.js +4 -2
- package/ComponentOverride/ComponentOverride.d.ts +52 -0
- package/ComponentOverride/ComponentOverride.js +3 -1
- package/FloatingLayer/FloatingLayer.js +4 -2
- package/FloatingLayer/FloatingLayerContainer.js +3 -1
- package/FloatingLayer/FloatingLayerDecorator.js +3 -1
- 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 +3 -1
- package/GridListImageItem/GridListImageItem.d.ts +85 -0
- package/GridListImageItem/GridListImageItem.js +3 -1
- package/Group/Group.d.ts +107 -0
- package/Group/Group.js +3 -1
- package/Group/GroupItem.js +3 -1
- package/Heading/Heading.d.ts +89 -0
- package/Heading/Heading.js +3 -1
- package/Icon/Icon.d.ts +88 -0
- package/Icon/Icon.js +3 -1
- package/IconButton/IconButton.d.ts +115 -0
- package/IconButton/IconButton.js +4 -2
- package/Image/Image.d.ts +113 -0
- package/Image/Image.js +3 -1
- package/ImageItem/ImageItem.d.ts +83 -0
- package/ImageItem/ImageItem.js +3 -1
- package/ImageItem/tests/ImageItem-specs.js +3 -1
- package/Item/Item.d.ts +64 -0
- package/Item/Item.js +3 -1
- package/LabeledIcon/LabeledIcon.d.ts +130 -0
- package/LabeledIcon/LabeledIcon.js +3 -1
- package/Layout/Cell.js +3 -1
- package/Layout/Layout.d.ts +267 -0
- package/Layout/Layout.js +28 -5
- package/Layout/tests/Layout-specs.js +5 -3
- package/Marquee/MarqueeBase.js +3 -1
- package/Marquee/MarqueeController.js +4 -2
- package/Marquee/MarqueeDecorator.js +4 -2
- 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 +5 -3
- package/Measurable/tests/Measurable-specs.js +8 -6
- package/Media/Media.d.ts +99 -0
- package/Media/Media.js +6 -4
- package/Placeholder/PlaceholderControllerDecorator.js +4 -2
- package/Placeholder/PlaceholderDecorator.js +4 -2
- package/Placeholder/index.d.ts +53 -0
- package/ProgressBar/ProgressBar.d.ts +92 -0
- package/ProgressBar/ProgressBar.js +3 -1
- package/README.md +1 -1
- package/RadioDecorator/RadioControllerDecorator.js +4 -2
- package/RadioDecorator/RadioDecorator.d.ts +35 -0
- package/RadioDecorator/RadioDecorator.js +4 -2
- package/Repeater/Repeater.d.ts +82 -0
- package/Repeater/Repeater.js +3 -1
- package/Repeater/tests/Repeater-specs.js +3 -1
- package/Resizable/Resizable.d.ts +31 -0
- package/Resizable/Resizable.js +4 -2
- package/Routable/Link.js +4 -2
- package/Routable/Routable.d.ts +148 -0
- package/Routable/Routable.js +3 -1
- package/Routable/Router.js +4 -2
- package/Routable/tests/Routable-specs.js +5 -3
- package/Scrollable/ScrollAnimator.js +3 -1
- package/Scrollable/ScrollThumb.js +3 -1
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scrollable/Scrollable.js +4 -2
- package/Scrollable/ScrollableNative.js +4 -2
- package/Scrollable/Scrollbar.js +4 -2
- package/Scroller/Scroller.d.ts +276 -0
- package/Scroller/Scroller.js +3 -1
- package/Scroller/ScrollerBasic.js +4 -2
- package/Scroller/UiScrollerBase.js +4 -2
- package/Skinnable/Skinnable.d.ts +94 -0
- package/Skinnable/Skinnable.js +3 -1
- package/Skinnable/tests/Skinnable-specs.js +3 -1
- package/Skinnable/tests/useSkins-specs.js +3 -1
- package/Slider/Knob.js +3 -1
- package/Slider/PositionDecorator.js +4 -2
- package/Slider/Slider.d.ts +202 -0
- package/Slider/Slider.js +3 -1
- package/SlotItem/SlotItem.d.ts +118 -0
- package/SlotItem/SlotItem.js +3 -1
- package/Slottable/Slottable.d.ts +22 -0
- package/Slottable/Slottable.js +3 -1
- package/Slottable/useSlots.js +3 -1
- package/Spinner/Spinner.d.ts +95 -0
- package/Spinner/Spinner.js +3 -1
- package/ToggleIcon/ToggleIcon.d.ts +90 -0
- package/ToggleIcon/ToggleIcon.js +3 -1
- package/ToggleItem/ToggleItem.d.ts +132 -0
- package/ToggleItem/ToggleItem.js +3 -1
- 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 +3 -1
- package/Toggleable/useToggle.js +1 -1
- package/Touchable/ClickAllow.js +3 -1
- package/Touchable/Drag.js +4 -2
- package/Touchable/Flick.js +4 -2
- package/Touchable/Hold.js +4 -2
- package/Touchable/Pinch.js +4 -2
- package/Touchable/Touch.js +3 -1
- package/Touchable/Touchable.d.ts +217 -0
- package/Touchable/Touchable.js +3 -1
- package/Touchable/config.js +3 -1
- package/Touchable/tests/useTouch-specs.js +3 -1
- package/Touchable/useTouch.js +5 -3
- package/Transition/Transition.d.ts +194 -0
- package/Transition/Transition.js +4 -2
- package/Transition/tests/Transition-specs.js +5 -3
- package/ViewManager/Arranger.js +3 -1
- package/ViewManager/TransitionGroup.js +3 -1
- package/ViewManager/View.js +4 -2
- package/ViewManager/ViewManager.d.ts +191 -0
- package/ViewManager/ViewManager.js +4 -2
- package/ViewManager/tests/ViewManager-specs.js +3 -1
- package/VirtualList/UiVirtualListBase.js +5 -3
- package/VirtualList/VirtualList.d.ts +528 -0
- package/VirtualList/VirtualList.js +3 -1
- package/VirtualList/VirtualListBasic.js +5 -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 +3 -1
- 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/Pure/Pure.d.ts +0 -0
- package/internal/Pure/Pure.js +4 -2
- 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 +4 -2
- package/resolution/index.d.ts +187 -0
- 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 +3 -1
- package/useScroll/useScroll.d.ts +0 -0
- package/useScroll/useScroll.js +64 -52
package/FloatingLayer/Scrim.js
CHANGED
|
@@ -12,12 +12,14 @@ var _excluded = ["type"];
|
|
|
12
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
13
|
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; }
|
|
14
14
|
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; }
|
|
15
|
-
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 _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; }
|
|
16
16
|
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; }
|
|
17
17
|
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; }
|
|
18
18
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
|
-
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); } }
|
|
19
|
+
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); } }
|
|
20
20
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
21
23
|
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); }
|
|
22
24
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
23
25
|
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); }; }
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
// Type definitions for ui/FloatingLayer
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CancelableProps as ui_Cancelable_CancelableProps } from "@enact/ui/Cancelable";
|
|
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 FloatingLayerDecoratorConfig extends Object {
|
|
10
|
+
/**
|
|
11
|
+
* Element Id of the floatLayer
|
|
12
|
+
*/
|
|
13
|
+
floatLayerId?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Class name to be applied to wrapped component.
|
|
16
|
+
*
|
|
17
|
+
* It can be used when you want to only apply
|
|
18
|
+
certain styles to the wrapped component and not to the float layer.
|
|
19
|
+
*/
|
|
20
|
+
wrappedClassName?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FloatingLayerDecoratorProps {}
|
|
23
|
+
export function FloatingLayerDecorator<P>(
|
|
24
|
+
config: FloatingLayerDecoratorConfig,
|
|
25
|
+
Component: React.ComponentType<P> | string
|
|
26
|
+
): React.ComponentType<P & FloatingLayerDecoratorProps>;
|
|
27
|
+
|
|
28
|
+
export function FloatingLayerDecorator<P>(
|
|
29
|
+
Component: React.ComponentType<P> | string
|
|
30
|
+
): React.ComponentType<P & FloatingLayerDecoratorProps>;
|
|
31
|
+
|
|
32
|
+
export interface FloatingLayerBaseProps {
|
|
33
|
+
/**
|
|
34
|
+
* CSS classes for FloatingLayer.
|
|
35
|
+
*/
|
|
36
|
+
floatLayerClassName?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Element id for floating layer.
|
|
39
|
+
*/
|
|
40
|
+
floatLayerId?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Prevents FloatingLayer from hiding when the user presses cancel/back (e.g. `ESC` ) key or
|
|
43
|
+
clicks outside the floating layer.
|
|
44
|
+
*/
|
|
45
|
+
noAutoDismiss?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Called when floating layer is closed.
|
|
48
|
+
*/
|
|
49
|
+
onClose?: Function;
|
|
50
|
+
/**
|
|
51
|
+
* Called when a closing action is invoked.
|
|
52
|
+
*
|
|
53
|
+
* These actions may include pressing cancel/back (e.g. `ESC` ) key or programmatically closing
|
|
54
|
+
by `FloatingLayerDecorator` . When cancel key is pressed, the function will only invoke if
|
|
55
|
+
`noAutoDismiss` is set to `false` .
|
|
56
|
+
*
|
|
57
|
+
* When pressing `ESC` key, event payload carries `detail` property containing `inputType`
|
|
58
|
+
value of `'key'` .
|
|
59
|
+
When clicking outside the boundary of the popup, event payload carries `detail` property
|
|
60
|
+
containing `inputType` value of `'click'` .
|
|
61
|
+
*/
|
|
62
|
+
onDismiss?: Function;
|
|
63
|
+
/**
|
|
64
|
+
* Called when floating layer is opened. It will only be invoked for the first render.
|
|
65
|
+
*/
|
|
66
|
+
onOpen?: Function;
|
|
67
|
+
/**
|
|
68
|
+
* Renders the floating layer and its components.
|
|
69
|
+
*/
|
|
70
|
+
open?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* The scrim type that overlays FloatingLayer.
|
|
73
|
+
*
|
|
74
|
+
* It can be either `'transparent'` , `'translucent'` , or `'none'` .
|
|
75
|
+
*/
|
|
76
|
+
scrimType?: string;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* A component that creates an entry point to the new render tree.
|
|
80
|
+
*
|
|
81
|
+
* This is used for modal components such as popups.
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
export class FloatingLayerBase extends React.Component<
|
|
85
|
+
Merge<React.HTMLProps<HTMLElement>, FloatingLayerBaseProps>
|
|
86
|
+
> {}
|
|
87
|
+
|
|
88
|
+
export interface FloatingLayerProps
|
|
89
|
+
extends Merge<FloatingLayerBaseProps, ui_Cancelable_CancelableProps> {}
|
|
90
|
+
/**
|
|
91
|
+
* FloatingLayer that mixes to handle FloatingLayer dismissal.
|
|
92
|
+
*
|
|
93
|
+
* This is used for modal components such as popups.
|
|
94
|
+
*/
|
|
95
|
+
|
|
96
|
+
export class FloatingLayer extends React.Component<
|
|
97
|
+
Merge<React.HTMLProps<HTMLElement>, FloatingLayerProps>
|
|
98
|
+
> {}
|
|
99
|
+
|
|
100
|
+
export default FloatingLayer;
|
|
@@ -7,7 +7,9 @@ var _FloatingLayerDecorator = require("../FloatingLayerDecorator");
|
|
|
7
7
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
-
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; }
|
|
10
|
+
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; }
|
|
11
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
+
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); }
|
|
11
13
|
describe('FloatingLayer Specs', function () {
|
|
12
14
|
function Root(props) {
|
|
13
15
|
var hook = (0, _FloatingLayerDecorator.useFloatingLayerDecorator)();
|
|
@@ -10,8 +10,8 @@ var _FloatingLayerDecorator = require("./FloatingLayerDecorator");
|
|
|
10
10
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
11
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { var _i =
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
14
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
15
15
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
16
16
|
function useFloatingLayer() {
|
|
17
17
|
var _useState = (0, _react.useState)(null),
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Type definitions for ui/ForwardRef
|
|
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 ForwardRefConfig extends Object {
|
|
7
|
+
/**
|
|
8
|
+
* The prop name to pass the ref callback
|
|
9
|
+
*/
|
|
10
|
+
prop?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface ForwardRefProps {}
|
|
13
|
+
export function ForwardRef<P>(
|
|
14
|
+
config: ForwardRefConfig,
|
|
15
|
+
Component: React.ComponentType<P> | string
|
|
16
|
+
): React.ComponentType<P & ForwardRefProps>;
|
|
17
|
+
|
|
18
|
+
export function ForwardRef<P>(
|
|
19
|
+
Component: React.ComponentType<P> | string
|
|
20
|
+
): React.ComponentType<P & ForwardRefProps>;
|
|
21
|
+
|
|
22
|
+
export default ForwardRef;
|
package/ForwardRef/ForwardRef.js
CHANGED
|
@@ -10,7 +10,9 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
10
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
11
|
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; }
|
|
12
12
|
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; }
|
|
13
|
-
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; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
14
16
|
/**
|
|
15
17
|
* Default config for {@link ui/ForwardRef.ForwardRef}.
|
|
16
18
|
*
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Type definitions for ui/GridListImageItem
|
|
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 GridListImageItemProps {
|
|
9
|
+
/**
|
|
10
|
+
* The primary caption to be displayed with the image.
|
|
11
|
+
*/
|
|
12
|
+
caption?: string;
|
|
13
|
+
/**
|
|
14
|
+
* The component used to render the captions
|
|
15
|
+
*/
|
|
16
|
+
captionComponent?: string | React.ComponentType;
|
|
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
|
+
* * `icon` - The icon component class for default selection overlay
|
|
23
|
+
* * `image` - The image component class
|
|
24
|
+
* * `selected` - Applied when `selected` prop is `true`
|
|
25
|
+
* * `caption` - The caption component class
|
|
26
|
+
* * `subCaption` - The subCaption component class
|
|
27
|
+
*/
|
|
28
|
+
css?: object;
|
|
29
|
+
/**
|
|
30
|
+
* The component used to render the default check icon when selected.
|
|
31
|
+
If there is custom selectionOverlay component, this icon will not be shown.
|
|
32
|
+
*/
|
|
33
|
+
iconComponent?: React.ComponentType;
|
|
34
|
+
/**
|
|
35
|
+
* The component used to render the image component
|
|
36
|
+
*/
|
|
37
|
+
imageComponent?: React.ComponentType;
|
|
38
|
+
/**
|
|
39
|
+
* Placeholder image used while
|
|
40
|
+
is loaded.
|
|
41
|
+
*/
|
|
42
|
+
placeholder?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Applies a selected visual effect to the image, but only if `selectionOverlayShowing`
|
|
45
|
+
is also `true` .
|
|
46
|
+
*/
|
|
47
|
+
selected?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* The custom selection overlay component to render.
|
|
50
|
+
*
|
|
51
|
+
* A component can be a stateless functional component, `kind()` or React component.
|
|
52
|
+
The following is an example with custom selection overlay kind.
|
|
53
|
+
*
|
|
54
|
+
* Example:
|
|
55
|
+
* ```
|
|
56
|
+
const SelectionOverlay = kind({
|
|
57
|
+
render: () => <div>custom overlay</div>
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
<GridListImageItem selectionOverlay={SelectionOverlay} />
|
|
61
|
+
```
|
|
62
|
+
*/
|
|
63
|
+
selectionOverlay?: Function;
|
|
64
|
+
/**
|
|
65
|
+
* Shows a selection overlay with a centered icon. When `selected` is true, a check mark is shown.
|
|
66
|
+
*/
|
|
67
|
+
selectionOverlayShowing?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* The absolute URL path to the image.
|
|
70
|
+
*/
|
|
71
|
+
source?: string;
|
|
72
|
+
/**
|
|
73
|
+
* The second caption line to be displayed with the image.
|
|
74
|
+
*/
|
|
75
|
+
subCaption?: string;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* A basic grid list image item without any behavior.
|
|
79
|
+
*/
|
|
80
|
+
|
|
81
|
+
export class GridListImageItem extends React.Component<
|
|
82
|
+
Merge<React.HTMLProps<HTMLElement>, GridListImageItemProps>
|
|
83
|
+
> {}
|
|
84
|
+
|
|
85
|
+
export default GridListImageItem;
|
|
@@ -18,7 +18,9 @@ var _excluded = ["css", "imageComponent", "placeholder", "source", "selectionOve
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
19
|
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; }
|
|
20
20
|
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; }
|
|
21
|
-
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; }
|
|
21
|
+
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; }
|
|
22
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
23
|
+
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); }
|
|
22
24
|
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; }
|
|
23
25
|
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; }
|
|
24
26
|
/**
|
package/Group/Group.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
// Type definitions for ui/Group
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
+
import { ChangeableProps as ui_Changeable_ChangeableProps } from "@enact/ui/Changeable";
|
|
6
|
+
|
|
7
|
+
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
8
|
+
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
9
|
+
|
|
10
|
+
export interface GroupBaseProps {}
|
|
11
|
+
/**
|
|
12
|
+
* A stateless component that supports selection of its child items via configurable
|
|
13
|
+
properties and events.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export class GroupBase extends React.Component<
|
|
17
|
+
Merge<React.HTMLProps<HTMLElement>, GroupBaseProps>
|
|
18
|
+
> {}
|
|
19
|
+
|
|
20
|
+
export interface GroupProps
|
|
21
|
+
extends Omit<Merge<GroupBaseProps, GroupDecoratorProps>, "componentRef"> {
|
|
22
|
+
/**
|
|
23
|
+
* Component type to repeat. This can be a React component or a string describing a DOM
|
|
24
|
+
node (e.g. `'div'` )
|
|
25
|
+
*/
|
|
26
|
+
childComponent: string | React.ComponentType;
|
|
27
|
+
/**
|
|
28
|
+
* An array of data to be mapped onto the `childComponent` .
|
|
29
|
+
*
|
|
30
|
+
* This supports two data types. If an array of strings is provided, the strings will be
|
|
31
|
+
used in the generated `childComponent` as the content (i.e. passed as `children` ). If
|
|
32
|
+
an array of objects is provided, each object will be spread onto the generated
|
|
33
|
+
`childComponent` with no interpretation. You'll be responsible for setting properties
|
|
34
|
+
like `disabled` , `className` , and setting the content using `children` .
|
|
35
|
+
*
|
|
36
|
+
* NOTE: When providing an array of objects be sure a unique `key` is assigned to each
|
|
37
|
+
item. for more
|
|
38
|
+
information.
|
|
39
|
+
*/
|
|
40
|
+
children: string[] | { key: number | string; [propName: string]: any }[];
|
|
41
|
+
/**
|
|
42
|
+
* The property on each `childComponent` that receives the data in `children`
|
|
43
|
+
*/
|
|
44
|
+
childProp?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The name of the event that triggers activation.
|
|
47
|
+
*/
|
|
48
|
+
childSelect?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Called with a reference to the root component.
|
|
51
|
+
*
|
|
52
|
+
* When using , the `ref` prop is forwarded to this component
|
|
53
|
+
as `componentRef` .
|
|
54
|
+
*/
|
|
55
|
+
componentRef?: object | Function;
|
|
56
|
+
/**
|
|
57
|
+
* The property on each `childComponent` that receives the index of the item
|
|
58
|
+
*/
|
|
59
|
+
indexProp?: string;
|
|
60
|
+
/**
|
|
61
|
+
* An object containing properties to be passed to each child.
|
|
62
|
+
*/
|
|
63
|
+
itemProps?: object;
|
|
64
|
+
/**
|
|
65
|
+
* Callback method to be invoked when an item is activated.
|
|
66
|
+
*/
|
|
67
|
+
onSelect?: Function;
|
|
68
|
+
/**
|
|
69
|
+
* Selection mode for the group
|
|
70
|
+
* * `single` - Allows for 0 or 1 item to be selected. The selected item may be deselected.
|
|
71
|
+
* * `radio` - Allows for 0 or 1 item to be selected. The selected item may only be
|
|
72
|
+
deselected by selecting another item.
|
|
73
|
+
* * `multiple` - Allows 0 to _n_ items to be selected. Each item may be selected or
|
|
74
|
+
deselected.
|
|
75
|
+
*/
|
|
76
|
+
select?: string;
|
|
77
|
+
/**
|
|
78
|
+
* The index(es) of the currently activated item.
|
|
79
|
+
*/
|
|
80
|
+
selected?: number | Array<any>;
|
|
81
|
+
/**
|
|
82
|
+
* The key that will hold the value in the event passed to `onSelect` .
|
|
83
|
+
*/
|
|
84
|
+
selectedEventProp?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The name of the DOM property that represents the selected state.
|
|
87
|
+
*/
|
|
88
|
+
selectedProp?: string;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A component that supports selection of its child items via configurable properties and
|
|
92
|
+
events.
|
|
93
|
+
*
|
|
94
|
+
* Selected item is managed by .
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
export class Group extends React.Component<
|
|
98
|
+
Merge<React.HTMLProps<HTMLElement>, GroupProps>
|
|
99
|
+
> {}
|
|
100
|
+
|
|
101
|
+
export interface GroupDecoratorProps
|
|
102
|
+
extends Merge<ui_ForwardRef_ForwardRefProps, ui_Changeable_ChangeableProps> {}
|
|
103
|
+
export function GroupDecorator<P>(
|
|
104
|
+
Component: React.ComponentType<P> | string
|
|
105
|
+
): React.ComponentType<P & GroupDecoratorProps>;
|
|
106
|
+
|
|
107
|
+
export default Group;
|
package/Group/Group.js
CHANGED
|
@@ -24,7 +24,9 @@ var _excluded = ["componentRef"];
|
|
|
24
24
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
25
|
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; }
|
|
26
26
|
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; }
|
|
27
|
-
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; }
|
|
27
|
+
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; }
|
|
28
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
29
|
+
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); }
|
|
28
30
|
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; }
|
|
29
31
|
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; }
|
|
30
32
|
/**
|
package/Group/GroupItem.js
CHANGED
|
@@ -13,7 +13,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
13
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
14
|
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; }
|
|
15
15
|
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; }
|
|
16
|
-
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; }
|
|
16
|
+
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; }
|
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
18
|
+
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); }
|
|
17
19
|
/**
|
|
18
20
|
* Pick the `GroupItem`-specific props into a {@link /developer-guide/glossary/#private|private} `itemProps` key to be extracted by
|
|
19
21
|
* `GroupItem` before passing the remaining on to the repeated `childComponent`
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// Type definitions for ui/Heading
|
|
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 HeadingBaseProps {}
|
|
10
|
+
/**
|
|
11
|
+
* A labeled Heading component.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
export class HeadingBase extends React.Component<
|
|
15
|
+
Merge<React.HTMLProps<HTMLElement>, HeadingBaseProps>
|
|
16
|
+
> {}
|
|
17
|
+
|
|
18
|
+
export interface HeadingProps
|
|
19
|
+
extends Omit<Merge<HeadingBaseProps, HeadingDecoratorProps>, "componentRef"> {
|
|
20
|
+
/**
|
|
21
|
+
* The text for the label of the Heading.
|
|
22
|
+
*/
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Called with a reference to the root component.
|
|
26
|
+
*
|
|
27
|
+
* When using , the `ref` prop is forwarded to this component
|
|
28
|
+
as `componentRef` .
|
|
29
|
+
*/
|
|
30
|
+
componentRef?: object | Function;
|
|
31
|
+
/**
|
|
32
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
33
|
+
corresponding internal elements and states of this component.
|
|
34
|
+
*
|
|
35
|
+
* The following classes are supported:
|
|
36
|
+
* * `heading` - The root component class
|
|
37
|
+
* * `title` - Applied when `size` is set to "title"
|
|
38
|
+
* * `subtitle` - Applied when `size` is set to "subtitle"
|
|
39
|
+
* * `large` - Applied when `size` is set to "large"
|
|
40
|
+
* * `medium` - Applied when `size` is set to "medium"
|
|
41
|
+
* * `small` - Applied when `size` is set to "small"
|
|
42
|
+
* * `tiny` - Applied when `size` is set to "tiny"
|
|
43
|
+
* * `largeSpacing` - Applied when `spacing` is set to "large"
|
|
44
|
+
* * `mediumSpacing` - Applied when `spacing` is set to "medium"
|
|
45
|
+
* * `smallSpacing` - Applied when `spacing` is set to "small"
|
|
46
|
+
* * `noneSpacing` - Applied when `spacing` is set to "none"
|
|
47
|
+
*/
|
|
48
|
+
css?: object;
|
|
49
|
+
/**
|
|
50
|
+
* Set the size of this component.
|
|
51
|
+
* * `'title'` and `'subtitle'` are generally considered to be used only once on a given screen.
|
|
52
|
+
* * `'large'` , `'medium'` , `'small'` , and `'tiny'` are typically used as section headings
|
|
53
|
+
for content on a screen, starting with `'large'` for the first tier of information
|
|
54
|
+
followed by `'medium'` for the next, and so fourth.
|
|
55
|
+
*
|
|
56
|
+
* If the `spacing` prop is not set (defaulting to "auto"), these values automatically set
|
|
57
|
+
the spacing to the correlated names.
|
|
58
|
+
*/
|
|
59
|
+
size?: "title" | "subtitle" | "large" | "medium" | "small" | "tiny";
|
|
60
|
+
/**
|
|
61
|
+
* The size of the spacing around the Heading.
|
|
62
|
+
*
|
|
63
|
+
* These have no built-in measurements, as they are intended to be defined by the theme
|
|
64
|
+
consuming this UI element. The values correlate with customizable classes made available
|
|
65
|
+
by this component's `css` prop.
|
|
66
|
+
*
|
|
67
|
+
* Allowed values include:
|
|
68
|
+
* * `'auto'` (default) - Lets this value be based on the `size` prop for automatic usage.
|
|
69
|
+
* * `'large'` - Specifically assign the `'large'` spacing.
|
|
70
|
+
* * `'medium'` - Specifically assign the `'medium'` spacing.
|
|
71
|
+
* * `'small'` - Specifically assign the `'small'` spacing.
|
|
72
|
+
* * `'none'` - No spacing at all. Neighboring elements will directly touch the Heading.
|
|
73
|
+
*/
|
|
74
|
+
spacing?: "auto" | "large" | "medium" | "small" | "none";
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* A labeled Heading component.
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
export class Heading extends React.Component<
|
|
81
|
+
Merge<React.HTMLProps<HTMLElement>, HeadingProps>
|
|
82
|
+
> {}
|
|
83
|
+
|
|
84
|
+
export interface HeadingDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
85
|
+
export function HeadingDecorator<P>(
|
|
86
|
+
Component: React.ComponentType<P> | string
|
|
87
|
+
): React.ComponentType<P & HeadingDecoratorProps>;
|
|
88
|
+
|
|
89
|
+
export default Heading;
|
package/Heading/Heading.js
CHANGED
|
@@ -17,7 +17,9 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
17
17
|
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; }
|
|
18
18
|
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; }
|
|
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
|
-
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
21
23
|
/**
|
|
22
24
|
* A labeled Heading component.
|
|
23
25
|
*
|
package/Icon/Icon.d.ts
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Type definitions for ui/Icon
|
|
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 IconBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* The icon content.
|
|
12
|
+
*
|
|
13
|
+
* May be specified as either:
|
|
14
|
+
* * A string that represents an icon from the ,
|
|
15
|
+
* * An HTML entity string, Unicode reference or hex value (in the form '0x...'),
|
|
16
|
+
* * A URL specifying path to an icon image, or
|
|
17
|
+
* * An object representing a resolution independent resource (See ).
|
|
18
|
+
*/
|
|
19
|
+
children?: string | object;
|
|
20
|
+
/**
|
|
21
|
+
* Called with a reference to the root component.
|
|
22
|
+
*
|
|
23
|
+
* When using , the `ref` prop is forwarded to this component
|
|
24
|
+
as `componentRef` .
|
|
25
|
+
*/
|
|
26
|
+
componentRef?: object | Function;
|
|
27
|
+
/**
|
|
28
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
29
|
+
corresponding internal elements and states of this component.
|
|
30
|
+
*
|
|
31
|
+
* The following classes are supported:
|
|
32
|
+
* * `icon` - The root component class
|
|
33
|
+
* * `dingbat` - Applied when the value of is not
|
|
34
|
+
found in
|
|
35
|
+
* * `large` - Applied when `size` prop is `'large'`
|
|
36
|
+
* * `pressed` - Applied when `pressed` prop is `true`
|
|
37
|
+
* * `small` - Applied when `size` prop is `'small'`
|
|
38
|
+
*/
|
|
39
|
+
css?: object;
|
|
40
|
+
/**
|
|
41
|
+
* Flip the icon horizontally, vertically or both.
|
|
42
|
+
*/
|
|
43
|
+
flip?: "both" | "horizontal" | "vertical";
|
|
44
|
+
/**
|
|
45
|
+
* The full list (hash) of supported icons.
|
|
46
|
+
*
|
|
47
|
+
* The keys of this hash are the unique names of each icon. The values are the unicode
|
|
48
|
+
characters to insert in the icon. These will typically map to glyphs in your icon-font.
|
|
49
|
+
The format of the keys can be character, glyph, or entity reference that correctly
|
|
50
|
+
renders in a React + JSX string.
|
|
51
|
+
*/
|
|
52
|
+
iconList?: object;
|
|
53
|
+
/**
|
|
54
|
+
* Applies the `pressed` CSS class.
|
|
55
|
+
*/
|
|
56
|
+
pressed?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The size of the button.
|
|
59
|
+
*
|
|
60
|
+
* Applies the CSS class which can be customized by
|
|
61
|
+
.
|
|
62
|
+
*/
|
|
63
|
+
size?: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A basic icon component structure without any behaviors applied to it.
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
export class IconBase extends React.Component<
|
|
70
|
+
Merge<React.HTMLProps<HTMLElement>, IconBaseProps>
|
|
71
|
+
> {}
|
|
72
|
+
|
|
73
|
+
export interface IconDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
74
|
+
export function IconDecorator<P>(
|
|
75
|
+
Component: React.ComponentType<P> | string
|
|
76
|
+
): React.ComponentType<P & IconDecoratorProps>;
|
|
77
|
+
|
|
78
|
+
export interface IconProps
|
|
79
|
+
extends Omit<Merge<IconBaseProps, IconDecoratorProps>, "componentRef"> {}
|
|
80
|
+
/**
|
|
81
|
+
* An Icon component.
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
export class Icon extends React.Component<
|
|
85
|
+
Merge<React.HTMLProps<HTMLElement>, IconProps>
|
|
86
|
+
> {}
|
|
87
|
+
|
|
88
|
+
export default Icon;
|
package/Icon/Icon.js
CHANGED
|
@@ -17,7 +17,9 @@ var _excluded = ["componentRef", "iconProps"];
|
|
|
17
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
18
|
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; }
|
|
19
19
|
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; }
|
|
20
|
-
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; }
|
|
20
|
+
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; }
|
|
21
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
22
|
+
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); }
|
|
21
23
|
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; }
|
|
22
24
|
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; }
|
|
23
25
|
/**
|