@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
package/IconButton/IconButton.js
CHANGED
|
@@ -16,26 +16,41 @@ var _Touchable = _interopRequireDefault(require("../Touchable"));
|
|
|
16
16
|
var _IconButtonModule = _interopRequireDefault(require("./IconButton.module.css"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _excluded = ["buttonComponent", "children", "componentRef", "css", "flip", "icon", "iconComponent", "size"];
|
|
19
|
+
/**
|
|
20
|
+
* An {@link ui/Icon.Icon|Icon} that acts like a {@link ui/Button.Button|Button}.
|
|
21
|
+
*
|
|
22
|
+
* You may specify an image or a font-based icon by setting the `children` to either the path
|
|
23
|
+
* to the image or a string from an {@link ui/Icon.Icon.iconList|iconList}. This is unstyled,
|
|
24
|
+
* but can easily be extended and customized by a theme or application.
|
|
25
|
+
*
|
|
26
|
+
* @module ui/IconButton
|
|
27
|
+
* @exports IconButton
|
|
28
|
+
* @exports IconButtonBase
|
|
29
|
+
* @exports IconButtonDecorator
|
|
30
|
+
* @deprecated Will be removed in 5.0.0. Use {@link ui/Button} instead.
|
|
31
|
+
*/
|
|
32
|
+
/**
|
|
33
|
+
* A ui-styled button without any behavior.
|
|
34
|
+
*
|
|
35
|
+
* @class IconButtonBase
|
|
36
|
+
* @memberof ui/IconButton
|
|
37
|
+
* @ui
|
|
38
|
+
* @public
|
|
39
|
+
*/
|
|
19
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
41
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
42
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
22
43
|
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); }
|
|
23
44
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
24
45
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
25
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
46
|
+
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; }
|
|
26
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; }
|
|
27
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; }
|
|
28
|
-
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; }
|
|
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 _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
51
|
+
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); }
|
|
29
52
|
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; }
|
|
30
53
|
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; }
|
|
31
|
-
/**
|
|
32
|
-
* A ui-styled button without any behavior.
|
|
33
|
-
*
|
|
34
|
-
* @class IconButtonBase
|
|
35
|
-
* @memberof ui/IconButton
|
|
36
|
-
* @ui
|
|
37
|
-
* @public
|
|
38
|
-
*/
|
|
39
54
|
var IconButtonBase = (0, _kind["default"])({
|
|
40
55
|
name: 'ui:IconButton',
|
|
41
56
|
propTypes: /** @lends ui/IconButton.IconButtonBase.prototype */{
|
|
@@ -64,7 +79,7 @@ var IconButtonBase = (0, _kind["default"])({
|
|
|
64
79
|
*
|
|
65
80
|
* If `icon` isn't specified but `children` is, `children` is used as the icon's value.
|
|
66
81
|
*
|
|
67
|
-
* @see {@link ui/Icon.
|
|
82
|
+
* @see {@link ui/Icon.IconBase.children}
|
|
68
83
|
* @type {Node}
|
|
69
84
|
* @public
|
|
70
85
|
*/
|
package/Image/Image.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Type definitions for ui/Image
|
|
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 ImageBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* String value for the alt attribute of the image.
|
|
12
|
+
*/
|
|
13
|
+
alt?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Node for the children of an `Image` . Useful for overlays.
|
|
16
|
+
*/
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* Called with a reference to the root component.
|
|
20
|
+
*
|
|
21
|
+
* When using , the `ref` prop is forwarded to this component
|
|
22
|
+
as `componentRef` .
|
|
23
|
+
*/
|
|
24
|
+
componentRef?: object | Function;
|
|
25
|
+
/**
|
|
26
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
27
|
+
corresponding internal elements and states of this component.
|
|
28
|
+
*
|
|
29
|
+
* The following classes are supported:
|
|
30
|
+
* * `image` - The root component class
|
|
31
|
+
* * `fit` - Applied when `sizing` prop is `fit`
|
|
32
|
+
* * `fill` - Applied when `sizing` prop is `fill`
|
|
33
|
+
*/
|
|
34
|
+
css?: object;
|
|
35
|
+
/**
|
|
36
|
+
* Called if the image has an error.
|
|
37
|
+
*/
|
|
38
|
+
onError?: Function;
|
|
39
|
+
/**
|
|
40
|
+
* Called once the image is loaded.
|
|
41
|
+
*/
|
|
42
|
+
onLoad?: Function;
|
|
43
|
+
/**
|
|
44
|
+
* A placeholder image to be displayed before the image is loaded.
|
|
45
|
+
*
|
|
46
|
+
* For performance purposes, it should be pre-loaded or be a data url. If `src` is
|
|
47
|
+
unset, this value will be used as the `background-image` .
|
|
48
|
+
*/
|
|
49
|
+
placeholder?: string;
|
|
50
|
+
/**
|
|
51
|
+
* Used to set the `background-size` of an `Image` .
|
|
52
|
+
* * `'fill'` - sets `background-size: cover`
|
|
53
|
+
* * `'fit'` - sets `background-size: contain`
|
|
54
|
+
* * `'none'` - uses the image's natural size
|
|
55
|
+
*/
|
|
56
|
+
sizing?: string;
|
|
57
|
+
/**
|
|
58
|
+
* String value or Object of values used to determine which image will appear on
|
|
59
|
+
a specific screenSize.
|
|
60
|
+
*/
|
|
61
|
+
src?: string | object;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* A basic image component designed to display images conditionally based on screen size.
|
|
65
|
+
*
|
|
66
|
+
* This component does not have a default size, therefore the image will not show unless a size is
|
|
67
|
+
specified using a CSS `className` or inline `style` .
|
|
68
|
+
*
|
|
69
|
+
* Example:
|
|
70
|
+
* ```
|
|
71
|
+
const src = {
|
|
72
|
+
'hd': 'http://lorempixel.com/64/64/city/1/',
|
|
73
|
+
'fhd': 'http://lorempixel.com/128/128/city/1/',
|
|
74
|
+
'uhd': 'http://lorempixel.com/256/256/city/1/'
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
<Image className={css.myImage} src={src} sizing="fill" />
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
* `ui/Image` is based on the `div` element, but it uses `img` to provide `onError` and `onLoad`
|
|
81
|
+
events. The image that you see on screen is a `background-image` from the `div` element, not the
|
|
82
|
+
`img` element.
|
|
83
|
+
*
|
|
84
|
+
* If you need a naturally sized image, you can use the native `<img>` element instead.
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
export class ImageBase extends React.Component<
|
|
88
|
+
Merge<React.HTMLProps<HTMLElement>, ImageBaseProps>
|
|
89
|
+
> {}
|
|
90
|
+
|
|
91
|
+
export interface ImageProps
|
|
92
|
+
extends Omit<Merge<ImageBaseProps, ImageDecoratorProps>, "componentRef"> {
|
|
93
|
+
/**
|
|
94
|
+
* The aria-label for the image.
|
|
95
|
+
*
|
|
96
|
+
* If unset, it defaults to the value of `alt` .
|
|
97
|
+
*/
|
|
98
|
+
"aria-label"?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* A minimally styled Image ready for customization by a theme.
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
export class Image extends React.Component<
|
|
105
|
+
Merge<React.HTMLProps<HTMLElement>, ImageProps>
|
|
106
|
+
> {}
|
|
107
|
+
|
|
108
|
+
export interface ImageDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
109
|
+
export function ImageDecorator<P>(
|
|
110
|
+
Component: React.ComponentType<P> | string
|
|
111
|
+
): React.ComponentType<P & ImageDecoratorProps>;
|
|
112
|
+
|
|
113
|
+
export default Image;
|
package/Image/Image.js
CHANGED
|
@@ -14,12 +14,14 @@ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
|
14
14
|
var _ImageModule = _interopRequireDefault(require("./Image.module.css"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
16
|
var _excluded = ["alt", "aria-label", "bgImage", "children", "componentRef", "css", "imgSrc", "onError", "onLoad", "style"];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
/**
|
|
18
|
+
* An unstyled image component to be customized by a theme or application.
|
|
19
|
+
*
|
|
20
|
+
* @module ui/Image
|
|
21
|
+
* @exports Image
|
|
22
|
+
* @exports ImageBase
|
|
23
|
+
* @exports ImageDecorator
|
|
24
|
+
*/
|
|
23
25
|
/**
|
|
24
26
|
* A basic image component designed to display images conditionally based on screen size.
|
|
25
27
|
*
|
|
@@ -48,6 +50,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
48
50
|
* @ui
|
|
49
51
|
* @public
|
|
50
52
|
*/
|
|
53
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
54
|
+
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; }
|
|
55
|
+
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; }
|
|
56
|
+
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; }
|
|
57
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
58
|
+
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); }
|
|
59
|
+
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; }
|
|
60
|
+
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; }
|
|
51
61
|
var ImageBase = (0, _kind["default"])({
|
|
52
62
|
name: 'ui:Image',
|
|
53
63
|
propTypes: /** @lends ui/Image.ImageBase.prototype */{
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// Type definitions for ui/ImageItem
|
|
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 ImageItemBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* The caption displayed with the image.
|
|
12
|
+
*/
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Called with a reference to the root component.
|
|
16
|
+
*
|
|
17
|
+
* When using , the `ref` prop is forwarded to this component
|
|
18
|
+
as `componentRef` .
|
|
19
|
+
*/
|
|
20
|
+
componentRef?: object | Function;
|
|
21
|
+
/**
|
|
22
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
23
|
+
corresponding internal elements and states of this component.
|
|
24
|
+
*
|
|
25
|
+
* The following classes are supported:
|
|
26
|
+
* * `imageItem` - The root component class
|
|
27
|
+
* * `caption` - The caption component class
|
|
28
|
+
* * `horizontal` - Applied when `orientation="horizontal"
|
|
29
|
+
* * `image` - The image component class
|
|
30
|
+
* * `selected` - Applied when `selected` prop is `true`
|
|
31
|
+
* * `vertical` - Applied when `orientation="vertical"
|
|
32
|
+
*/
|
|
33
|
+
css?: object;
|
|
34
|
+
/**
|
|
35
|
+
* The component used to render the image component.
|
|
36
|
+
*/
|
|
37
|
+
imageComponent?: React.ComponentType | JSX.Element;
|
|
38
|
+
/**
|
|
39
|
+
* The layout orientation of the component.
|
|
40
|
+
*/
|
|
41
|
+
orientation?: "horizontal" | "vertical";
|
|
42
|
+
/**
|
|
43
|
+
* A placeholder image to be displayed before the image is loaded.
|
|
44
|
+
*/
|
|
45
|
+
placeholder?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Applies a selected visual effect to the image.
|
|
48
|
+
*/
|
|
49
|
+
selected?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* String value or Object of values used to determine which image will appear on a specific
|
|
52
|
+
screenSize.
|
|
53
|
+
*/
|
|
54
|
+
src?: string | object;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A basic image item without any behavior.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export class ImageItemBase extends React.Component<
|
|
61
|
+
Merge<React.HTMLProps<HTMLElement>, ImageItemBaseProps>
|
|
62
|
+
> {}
|
|
63
|
+
|
|
64
|
+
export interface ImageItemDecoratorProps
|
|
65
|
+
extends ui_ForwardRef_ForwardRefProps {}
|
|
66
|
+
export function ImageItemDecorator<P>(
|
|
67
|
+
Component: React.ComponentType<P> | string
|
|
68
|
+
): React.ComponentType<P & ImageItemDecoratorProps>;
|
|
69
|
+
|
|
70
|
+
export interface ImageItemProps
|
|
71
|
+
extends Omit<
|
|
72
|
+
Merge<ImageItemBaseProps, ImageItemDecoratorProps>,
|
|
73
|
+
"componentRef"
|
|
74
|
+
> {}
|
|
75
|
+
/**
|
|
76
|
+
* A minimally styled ImageItem ready for customization by a theme.
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export class ImageItem extends React.Component<
|
|
80
|
+
Merge<React.HTMLProps<HTMLElement>, ImageItemProps>
|
|
81
|
+
> {}
|
|
82
|
+
|
|
83
|
+
export default ImageItem;
|
package/ImageItem/ImageItem.js
CHANGED
|
@@ -16,13 +16,23 @@ var _ImageItemModule = _interopRequireDefault(require("./ImageItem.module.css"))
|
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
var _excluded = ["imageComponent"],
|
|
18
18
|
_excluded2 = ["children", "componentRef", "css", "imageComponent", "orientation", "placeholder", "src"];
|
|
19
|
+
/**
|
|
20
|
+
* Unstyled image item components and behaviors to be customized by a theme or application.
|
|
21
|
+
*
|
|
22
|
+
* @module ui/ImageItem
|
|
23
|
+
* @exports ImageItem
|
|
24
|
+
* @exports ImageItemBase
|
|
25
|
+
* @exports ImageItemDecorator
|
|
26
|
+
*/
|
|
27
|
+
// Adapts ComponentOverride to work within Cell since both use the component prop
|
|
19
28
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
20
29
|
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
30
|
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; }
|
|
31
|
+
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; }
|
|
32
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
33
|
+
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); }
|
|
23
34
|
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; }
|
|
24
35
|
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; }
|
|
25
|
-
// Adapts ComponentOverride to work within Cell since both use the component prop
|
|
26
36
|
function ImageOverride(_ref) {
|
|
27
37
|
var imageComponent = _ref.imageComponent,
|
|
28
38
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -8,7 +8,9 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
8
8
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
9
9
|
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; }
|
|
10
10
|
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; }
|
|
11
|
-
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; }
|
|
11
|
+
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; }
|
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
+
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); }
|
|
12
14
|
var src = {
|
|
13
15
|
'hd': 'http://lorempixel.com/64/64/city/1/',
|
|
14
16
|
'fhd': 'http://lorempixel.com/128/128/city/1/',
|
package/Item/Item.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Type definitions for ui/Item
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
+
import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
|
|
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 ItemBaseProps {
|
|
11
|
+
/**
|
|
12
|
+
* The node to be displayed as the main content of the item.
|
|
13
|
+
*/
|
|
14
|
+
children?: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The type of component to use to render the item. May be a DOM node name (e.g 'div',
|
|
17
|
+
'span', etc.) or a custom component.
|
|
18
|
+
*/
|
|
19
|
+
component?: string | React.ComponentType;
|
|
20
|
+
/**
|
|
21
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
22
|
+
corresponding internal elements and states of this component.
|
|
23
|
+
*
|
|
24
|
+
* The following classes are supported:
|
|
25
|
+
* * `item` - The root class name
|
|
26
|
+
* * `inline` - Applied when `inline` prop is true
|
|
27
|
+
*/
|
|
28
|
+
css?: object;
|
|
29
|
+
/**
|
|
30
|
+
* Applies a disabled state to the item.
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Applies inline styling to the item.
|
|
35
|
+
*/
|
|
36
|
+
inline?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A basic list item component structure without any behaviors applied to it.
|
|
40
|
+
*
|
|
41
|
+
* It also has support for overlay to place things before and after the main content.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
export class ItemBase extends React.Component<
|
|
45
|
+
Merge<React.HTMLProps<HTMLElement>, ItemBaseProps>
|
|
46
|
+
> {}
|
|
47
|
+
|
|
48
|
+
export interface ItemDecoratorProps
|
|
49
|
+
extends Merge<ui_ForwardRef_ForwardRefProps, ui_Touchable_TouchableProps> {}
|
|
50
|
+
export function ItemDecorator<P>(
|
|
51
|
+
Component: React.ComponentType<P> | string
|
|
52
|
+
): React.ComponentType<P & ItemDecoratorProps>;
|
|
53
|
+
|
|
54
|
+
export interface ItemProps
|
|
55
|
+
extends Omit<Merge<ItemBaseProps, ItemDecoratorProps>, "componentRef"> {}
|
|
56
|
+
/**
|
|
57
|
+
* A minimally-styled ready-to-use list item component with touch support.
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export class Item extends React.Component<
|
|
61
|
+
Merge<React.HTMLProps<HTMLElement>, ItemProps>
|
|
62
|
+
> {}
|
|
63
|
+
|
|
64
|
+
export default Item;
|
package/Item/Item.js
CHANGED
|
@@ -13,12 +13,14 @@ var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
|
13
13
|
var _ItemModule = _interopRequireDefault(require("./Item.module.css"));
|
|
14
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
15
|
var _excluded = ["component", "componentRef", "disabled", "children"];
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
/**
|
|
17
|
+
* An unstyled item component and behaviors to be customized by a theme or application.
|
|
18
|
+
*
|
|
19
|
+
* @module ui/Item
|
|
20
|
+
* @exports Item
|
|
21
|
+
* @exports ItemBase
|
|
22
|
+
* @exports ItemDecorator
|
|
23
|
+
*/
|
|
22
24
|
/**
|
|
23
25
|
* A basic list item component structure without any behaviors applied to it.
|
|
24
26
|
*
|
|
@@ -29,6 +31,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
29
31
|
* @ui
|
|
30
32
|
* @public
|
|
31
33
|
*/
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
35
|
+
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; }
|
|
36
|
+
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; }
|
|
37
|
+
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; }
|
|
38
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
39
|
+
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); }
|
|
40
|
+
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; }
|
|
41
|
+
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; }
|
|
32
42
|
var ItemBase = (0, _kind["default"])({
|
|
33
43
|
name: 'ui:Item',
|
|
34
44
|
propTypes: /** @lends ui/Item.ItemBase.prototype */{
|
|
@@ -49,7 +59,7 @@ var ItemBase = (0, _kind["default"])({
|
|
|
49
59
|
*/
|
|
50
60
|
component: _propTypes["default"].renderable,
|
|
51
61
|
/**
|
|
52
|
-
* Called with a reference to {@link ui/Item.ItemBase
|
|
62
|
+
* Called with a reference to {@link ui/Item.ItemBase.component|component}
|
|
53
63
|
*
|
|
54
64
|
* @type {Object|Function}
|
|
55
65
|
* @private
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
// Type definitions for ui/LabeledIcon
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { SlottableProps as ui_Slottable_SlottableProps } from "@enact/ui/Slottable";
|
|
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 LabeledIconBaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* The label.
|
|
12
|
+
*
|
|
13
|
+
* This accepts strings, DOM, and Components, if you need more elaborate features. It may be
|
|
14
|
+
positioned using `labelPosition` .
|
|
15
|
+
*/
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* Called with a reference to the root component.
|
|
19
|
+
*
|
|
20
|
+
* When using , the `ref` prop is forwarded to this
|
|
21
|
+
component as `componentRef` .
|
|
22
|
+
*/
|
|
23
|
+
componentRef?: object | Function;
|
|
24
|
+
/**
|
|
25
|
+
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
26
|
+
corresponding internal elements and states of this component.
|
|
27
|
+
*
|
|
28
|
+
* The following classes are supported:
|
|
29
|
+
* * `labeledIcon` - The root component class
|
|
30
|
+
* * `icon` - The icon component class
|
|
31
|
+
* * `iconCell` - Applied to the `iconComponent` directly, like `.icon` . If `icon` in a
|
|
32
|
+
React component, this class is applied to the container of the icon,
|
|
33
|
+
rather than the icon itself.
|
|
34
|
+
* * `label` - The label component class
|
|
35
|
+
* * `inline` - Applied when the inline prop is set
|
|
36
|
+
* * `above` - Applied when the labelPosition prop is set to above
|
|
37
|
+
* * `after` - Applied when the labelPosition prop is set to after
|
|
38
|
+
* * `before` - Applied when the labelPosition prop is set to before
|
|
39
|
+
* * `below` - Applied when the labelPosition prop is set to below
|
|
40
|
+
* * `left` - Applied when the labelPosition prop is set to left
|
|
41
|
+
* * `right` - Applied when the labelPosition prop is set to right
|
|
42
|
+
*/
|
|
43
|
+
css?: object;
|
|
44
|
+
/**
|
|
45
|
+
* Disables the component and becomes non-interactive.
|
|
46
|
+
*/
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Flip the icon horizontally, vertically or both.
|
|
50
|
+
*/
|
|
51
|
+
flip?: "both" | "horizontal" | "vertical";
|
|
52
|
+
/**
|
|
53
|
+
* The icon.
|
|
54
|
+
*
|
|
55
|
+
* This will be passed as `children` to the `iconComponent` , unless you supply a React
|
|
56
|
+
element (like JSX) to this prop, directly or via the `<icon>` slot.
|
|
57
|
+
*/
|
|
58
|
+
icon?: string | JSX.Element | React.ComponentType;
|
|
59
|
+
/**
|
|
60
|
+
* The component used to render the `icon` .
|
|
61
|
+
*
|
|
62
|
+
* This will receive the `icon` prop as `children` and should handle it appropriately. This
|
|
63
|
+
prop is ignored in the case of a component being passed into the `icon` prop. It will
|
|
64
|
+
also receive the `flip` and `size` props as set on the component.
|
|
65
|
+
*/
|
|
66
|
+
iconComponent?: React.ComponentType;
|
|
67
|
+
/**
|
|
68
|
+
* Enables this component to be used in an "inline" context.
|
|
69
|
+
*
|
|
70
|
+
* This is useful for when you have several of these components in a row and are not using a
|
|
71
|
+
or flex-box configuration.
|
|
72
|
+
*/
|
|
73
|
+
inline?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The position of the label in relation to the icon element.
|
|
76
|
+
*
|
|
77
|
+
* Allowed values include:
|
|
78
|
+
* * 'below' (default),
|
|
79
|
+
* * 'above',
|
|
80
|
+
* * 'left',
|
|
81
|
+
* * 'right',
|
|
82
|
+
* * 'before', and
|
|
83
|
+
* * 'after'.
|
|
84
|
+
*
|
|
85
|
+
* The 'before' and 'after' values automatically swap sides when in an RTL locale context.
|
|
86
|
+
*/
|
|
87
|
+
labelPosition?: "above" | "after" | "before" | "below" | "left" | "right";
|
|
88
|
+
/**
|
|
89
|
+
* The size of the icon.
|
|
90
|
+
*
|
|
91
|
+
* Applies the CSS class which can be customized by
|
|
92
|
+
.
|
|
93
|
+
*/
|
|
94
|
+
size?: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* An icon component with a label.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
export class LabeledIconBase extends React.Component<
|
|
101
|
+
Merge<React.HTMLProps<HTMLElement>, LabeledIconBaseProps>
|
|
102
|
+
> {}
|
|
103
|
+
|
|
104
|
+
export interface LabeledIconDecoratorProps
|
|
105
|
+
extends ui_Slottable_SlottableProps {}
|
|
106
|
+
export function LabeledIconDecorator<P>(
|
|
107
|
+
Component: React.ComponentType<P> | string
|
|
108
|
+
): React.ComponentType<P & LabeledIconDecoratorProps>;
|
|
109
|
+
|
|
110
|
+
export interface LabeledIconProps
|
|
111
|
+
extends Omit<
|
|
112
|
+
Merge<LabeledIconBaseProps, LabeledIconDecoratorProps>,
|
|
113
|
+
"componentRef"
|
|
114
|
+
> {}
|
|
115
|
+
/**
|
|
116
|
+
* An icon component with a label without any behaviors applied to it.
|
|
117
|
+
*
|
|
118
|
+
* Usage:
|
|
119
|
+
* ```
|
|
120
|
+
<LabeledIcon icon="star" labelPosition="after">
|
|
121
|
+
Favorite
|
|
122
|
+
</LabeledIcon>
|
|
123
|
+
```
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
export class LabeledIcon extends React.Component<
|
|
127
|
+
Merge<React.HTMLProps<HTMLElement>, LabeledIconProps>
|
|
128
|
+
> {}
|
|
129
|
+
|
|
130
|
+
export default LabeledIcon;
|
|
@@ -16,12 +16,14 @@ var _Slottable = _interopRequireDefault(require("../Slottable"));
|
|
|
16
16
|
var _LabeledIconModule = _interopRequireDefault(require("./LabeledIcon.module.css"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
var _excluded = ["css", "children", "componentRef", "disabled", "flip", "icon", "iconComponent", "orientation", "size"];
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Provides unstyled LabeledIcon components to be customized by a theme or application.
|
|
21
|
+
*
|
|
22
|
+
* @module ui/LabeledIcon
|
|
23
|
+
* @exports LabeledIcon
|
|
24
|
+
* @exports LabeledIconBase
|
|
25
|
+
* @exports LabeledIconDecorator
|
|
26
|
+
*/
|
|
25
27
|
/**
|
|
26
28
|
* An icon component with a label.
|
|
27
29
|
*
|
|
@@ -30,6 +32,14 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
30
32
|
* @ui
|
|
31
33
|
* @public
|
|
32
34
|
*/
|
|
35
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
36
|
+
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; }
|
|
37
|
+
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; }
|
|
38
|
+
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; }
|
|
39
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
40
|
+
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); }
|
|
41
|
+
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; }
|
|
42
|
+
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; }
|
|
33
43
|
var LabeledIconBase = (0, _kind["default"])({
|
|
34
44
|
name: 'ui:LabeledIcon',
|
|
35
45
|
propTypes: /** @lends ui/LabeledIcon.LabeledIconBase.prototype */{
|