@enact/ui 4.5.2 → 4.6.1
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 +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +45 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/package.json +3 -0
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +24 -57
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +29 -63
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +7 -29
- package/RadioDecorator/RadioDecorator.js +9 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +37 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +23 -45
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +16 -43
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +24 -57
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Pinch.js +185 -0
- package/Touchable/Touch.js +71 -76
- package/Touchable/Touchable.js +95 -75
- package/Touchable/config.js +27 -24
- package/Touchable/tests/Touchable-specs.js +360 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +57 -65
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +20 -84
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +265 -409
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +6 -20
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +9 -3
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
- package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
- package/BodyText/BodyText.d.ts +0 -66
- package/Button/Button.d.ts +0 -125
- package/Cancelable/Cancelable.d.ts +0 -64
- package/Changeable/Changeable.d.ts +0 -54
- package/ComponentOverride/ComponentOverride.d.ts +0 -52
- package/ForwardRef/ForwardRef.d.ts +0 -22
- package/GridListImageItem/GridListImageItem.d.ts +0 -85
- package/Group/Group.d.ts +0 -107
- package/Heading/Heading.d.ts +0 -90
- package/Icon/Icon.d.ts +0 -88
- package/IconButton/IconButton.d.ts +0 -115
- package/Image/Image.d.ts +0 -113
- package/ImageItem/ImageItem.d.ts +0 -83
- package/Item/Item.d.ts +0 -64
- package/LabeledIcon/LabeledIcon.d.ts +0 -130
- package/Layout/Layout.d.ts +0 -247
- package/Marquee/index.d.ts +0 -258
- package/Measurable/Measurable.d.ts +0 -26
- package/Media/Media.d.ts +0 -99
- package/Placeholder/index.d.ts +0 -53
- package/ProgressBar/ProgressBar.d.ts +0 -92
- package/RadioDecorator/RadioDecorator.d.ts +0 -35
- package/Repeater/Repeater.d.ts +0 -83
- package/Resizable/Resizable.d.ts +0 -31
- package/Routable/Routable.d.ts +0 -148
- package/Scrollable/Scrollable.d.ts +0 -0
- package/Scroller/Scroller.d.ts +0 -276
- package/Skinnable/Skinnable.d.ts +0 -94
- package/Slider/Slider.d.ts +0 -202
- package/SlotItem/SlotItem.d.ts +0 -118
- package/Slottable/Slottable.d.ts +0 -22
- package/Spinner/Spinner.d.ts +0 -95
- package/ToggleIcon/ToggleIcon.d.ts +0 -90
- package/ToggleItem/ToggleItem.d.ts +0 -134
- package/Toggleable/Toggleable.d.ts +0 -103
- package/Touchable/Touchable.d.ts +0 -175
- package/Transition/Transition.d.ts +0 -196
- package/ViewManager/ViewManager.d.ts +0 -191
- package/VirtualList/VirtualList.d.ts +0 -530
- package/index.d.ts +0 -0
- package/internal/IdProvider/IdProvider.d.ts +0 -0
- package/internal/Pure/Pure.d.ts +0 -0
- package/internal/localized-fonts/localized-fonts.d.ts +0 -53
- package/internal/selection/selection.d.ts +0 -0
- package/internal/validators/validators.d.ts +0 -0
- package/resolution/index.d.ts +0 -187
- package/useControlledState/useControlledState.d.ts +0 -0
- package/useScroll/useScroll.d.ts +0 -0
package/useScroll/utilDOM.js
CHANGED
|
@@ -4,14 +4,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.utilDOM = exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _warning = _interopRequireDefault(require("warning"));
|
|
9
|
-
|
|
10
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
-
|
|
12
9
|
// At the end, wes should not use DOM APIs as well as the APIs in the `utilDOM`. If we use them, we have to try to remove them first if possible.
|
|
10
|
+
|
|
13
11
|
var utilDOM = function () {
|
|
14
12
|
// Functions
|
|
13
|
+
|
|
15
14
|
function containsDangerously(ref, target) {
|
|
16
15
|
if (!target) {
|
|
17
16
|
return false;
|
|
@@ -22,9 +21,10 @@ var utilDOM = function () {
|
|
|
22
21
|
process.env.NODE_ENV !== "production" ? (0, _warning["default"])(ref.contains, 'The `contains` function of the Ref is not supported.') : void 0;
|
|
23
22
|
return ref.contains(target);
|
|
24
23
|
}
|
|
25
|
-
|
|
26
24
|
return false;
|
|
27
|
-
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// TBD
|
|
28
28
|
// Need to define functions for the following DOM APIs
|
|
29
29
|
// getBoundingClientRect
|
|
30
30
|
// dataset.spotlightId
|
|
@@ -33,20 +33,15 @@ var utilDOM = function () {
|
|
|
33
33
|
// removeAttribute
|
|
34
34
|
// scrollLeft
|
|
35
35
|
// scrollTop
|
|
36
|
-
|
|
37
|
-
|
|
38
36
|
function datasetDangerously() {}
|
|
39
|
-
|
|
40
37
|
function getBoundingClientRectDangerously() {}
|
|
41
|
-
|
|
42
38
|
function getRectDangerously() {}
|
|
43
|
-
|
|
44
39
|
function removeAttributeDangerously() {}
|
|
45
|
-
|
|
46
40
|
function setAttributeDangerously() {}
|
|
47
|
-
|
|
48
41
|
var scrollLeftDangerously = 0;
|
|
49
|
-
var scrollTopDangerously = 0;
|
|
42
|
+
var scrollTopDangerously = 0;
|
|
43
|
+
|
|
44
|
+
// Return
|
|
50
45
|
|
|
51
46
|
return {
|
|
52
47
|
containsDangerously: containsDangerously,
|
|
@@ -59,7 +54,6 @@ var utilDOM = function () {
|
|
|
59
54
|
setAttributeDangerously: setAttributeDangerously
|
|
60
55
|
};
|
|
61
56
|
}();
|
|
62
|
-
|
|
63
57
|
exports.utilDOM = utilDOM;
|
|
64
58
|
var _default = utilDOM;
|
|
65
59
|
exports["default"] = _default;
|
package/useScroll/utilEvent.js
CHANGED
|
@@ -4,14 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.utilEvent = exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
// A `React.useEvent` hooks is introduced in https://github.com/facebook/react/pull/17651
|
|
9
8
|
// The `useEvent` below will be replaced with the `React.useEvent` later.
|
|
10
9
|
var utilEvent = function utilEvent(eventName) {
|
|
11
10
|
return {
|
|
12
11
|
addEventListener: function addEventListener(ref, fn, param) {
|
|
13
12
|
if (!ref) return;
|
|
14
|
-
|
|
15
13
|
if (typeof window !== 'undefined' && (ref === window || ref === document)) {
|
|
16
14
|
ref.addEventListener(eventName, fn, param);
|
|
17
15
|
} else if (ref.current) {
|
|
@@ -22,7 +20,6 @@ var utilEvent = function utilEvent(eventName) {
|
|
|
22
20
|
},
|
|
23
21
|
removeEventListener: function removeEventListener(ref, fn, param) {
|
|
24
22
|
if (!ref) return;
|
|
25
|
-
|
|
26
23
|
if (typeof window !== 'undefined' && (ref === window || ref === document)) {
|
|
27
24
|
ref.removeEventListener(eventName, fn, param);
|
|
28
25
|
} else if (ref.current) {
|
|
@@ -33,7 +30,6 @@ var utilEvent = function utilEvent(eventName) {
|
|
|
33
30
|
}
|
|
34
31
|
};
|
|
35
32
|
};
|
|
36
|
-
|
|
37
33
|
exports.utilEvent = utilEvent;
|
|
38
34
|
var _default = utilEvent;
|
|
39
35
|
exports["default"] = _default;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/AnnounceDecorator
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
|
|
5
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
6
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
7
|
-
|
|
8
|
-
export interface AnnounceDecoratorProps {
|
|
9
|
-
/**
|
|
10
|
-
* The wrapped component's children.
|
|
11
|
-
*
|
|
12
|
-
* An instance of will be appended to `children` .
|
|
13
|
-
*/
|
|
14
|
-
children?: React.ReactNode;
|
|
15
|
-
}
|
|
16
|
-
export function AnnounceDecorator<P>(
|
|
17
|
-
Component: React.ComponentType<P> | string
|
|
18
|
-
): React.ComponentType<P & AnnounceDecoratorProps>;
|
|
19
|
-
|
|
20
|
-
export interface AnnounceProps {
|
|
21
|
-
/**
|
|
22
|
-
* Time, in milliseconds, to wait to remove the alert message.
|
|
23
|
-
*
|
|
24
|
-
* Subsequent updates to the
|
|
25
|
-
message before the timeout are ignored.
|
|
26
|
-
*/
|
|
27
|
-
timeout?: number;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* An unstyled component with an imperative API to alert the user.
|
|
31
|
-
*
|
|
32
|
-
* The `announce()` method should be used to alert the user of behavior for accessibility.
|
|
33
|
-
*
|
|
34
|
-
* Example:
|
|
35
|
-
* ```
|
|
36
|
-
import {Announce} from '@enact/ui/AnnounceDecorator';
|
|
37
|
-
import {Component} from 'react';
|
|
38
|
-
|
|
39
|
-
class Example extends Component {
|
|
40
|
-
notify = () => {
|
|
41
|
-
if (this.announce) {
|
|
42
|
-
this.announce.announce('this text will be alerted to user by TTS');
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setAnnounceRef = (announce) => {
|
|
47
|
-
this.announce = announce;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
render () {
|
|
51
|
-
<div>
|
|
52
|
-
<button onClick={this.notify}>Notify on Click</button>
|
|
53
|
-
<Announce ref={this.setAnnounceRef} />
|
|
54
|
-
</div>
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
*/
|
|
59
|
-
|
|
60
|
-
export class Announce extends React.Component<
|
|
61
|
-
Merge<React.HTMLProps<HTMLElement>, AnnounceProps>
|
|
62
|
-
> {}
|
|
63
|
-
|
|
64
|
-
export default AnnounceDecorator;
|
package/BodyText/BodyText.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/BodyText
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
-
|
|
6
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
7
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
8
|
-
|
|
9
|
-
export interface BodyTextBaseProps {
|
|
10
|
-
/**
|
|
11
|
-
* Centers the contents.
|
|
12
|
-
*
|
|
13
|
-
* Applies the `centered` CSS class which can be customized by
|
|
14
|
-
[theming] .
|
|
15
|
-
*/
|
|
16
|
-
centered?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* The type of component to use to render the item. May be a DOM node name (e.g 'div',
|
|
19
|
-
'p', etc.) or a custom component.
|
|
20
|
-
*/
|
|
21
|
-
component?: React.ComponentType;
|
|
22
|
-
/**
|
|
23
|
-
* Called with a reference to the root component.
|
|
24
|
-
*
|
|
25
|
-
* When using , the `ref` prop is forwarded to this component
|
|
26
|
-
as `componentRef` .
|
|
27
|
-
*/
|
|
28
|
-
componentRef?: object | Function;
|
|
29
|
-
/**
|
|
30
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
31
|
-
corresponding internal elements and states of this component.
|
|
32
|
-
*
|
|
33
|
-
* The following classes are supported:
|
|
34
|
-
* * `bodyText` - The root class name
|
|
35
|
-
* * `centered` - Applied when `centered` prop is `true`
|
|
36
|
-
*/
|
|
37
|
-
css?: object;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A simple, unstyled text block component, without
|
|
41
|
-
applied.
|
|
42
|
-
*/
|
|
43
|
-
|
|
44
|
-
export class BodyTextBase extends React.Component<
|
|
45
|
-
Merge<React.HTMLProps<HTMLElement>, BodyTextBaseProps>
|
|
46
|
-
> {}
|
|
47
|
-
|
|
48
|
-
export interface BodyTextDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
49
|
-
export function BodyTextDecorator<P>(
|
|
50
|
-
Component: React.ComponentType<P> | string
|
|
51
|
-
): React.ComponentType<P & BodyTextDecoratorProps>;
|
|
52
|
-
|
|
53
|
-
export interface BodyTextProps
|
|
54
|
-
extends Omit<
|
|
55
|
-
Merge<BodyTextBaseProps, BodyTextDecoratorProps>,
|
|
56
|
-
"componentRef"
|
|
57
|
-
> {}
|
|
58
|
-
/**
|
|
59
|
-
* A simple, unstyled text block component.
|
|
60
|
-
*/
|
|
61
|
-
|
|
62
|
-
export class BodyText extends React.Component<
|
|
63
|
-
Merge<React.HTMLProps<HTMLElement>, BodyTextProps>
|
|
64
|
-
> {}
|
|
65
|
-
|
|
66
|
-
export default BodyText;
|
package/Button/Button.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Button
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
|
|
5
|
-
|
|
6
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
7
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
8
|
-
|
|
9
|
-
export interface ButtonBaseProps {
|
|
10
|
-
/**
|
|
11
|
-
* Called with a reference to the root component.
|
|
12
|
-
*
|
|
13
|
-
* When using , the `ref` prop is forwarded to this component
|
|
14
|
-
as `componentRef` .
|
|
15
|
-
*/
|
|
16
|
-
componentRef?: object | Function;
|
|
17
|
-
/**
|
|
18
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
19
|
-
corresponding internal elements and states of this component.
|
|
20
|
-
*
|
|
21
|
-
* The following classes are supported:
|
|
22
|
-
* * `button` - The root component class
|
|
23
|
-
* * `bg` - The background node of the button
|
|
24
|
-
* * `client` - The content node of the button
|
|
25
|
-
* * `hasIcon` - Applied when there is an `icon` present
|
|
26
|
-
* * `icon` - The icon node, when `icon` is set
|
|
27
|
-
* * `large` - Applied when `size` prop is `'large'`
|
|
28
|
-
* * `minWidth` - Applied when `minWidth` prop is `true`
|
|
29
|
-
* * `pressed` - Applied when `pressed` prop is `true`
|
|
30
|
-
* * `selected` - Applied when `selected` prop is `true`
|
|
31
|
-
* * `small` - Applied when `size` prop is `'small'`
|
|
32
|
-
*/
|
|
33
|
-
css?: object;
|
|
34
|
-
/**
|
|
35
|
-
* Applies the `disabled` class.
|
|
36
|
-
*
|
|
37
|
-
* When `true` , the button is shown as disabled.
|
|
38
|
-
*/
|
|
39
|
-
disabled?: boolean;
|
|
40
|
-
/**
|
|
41
|
-
* The icon displayed within the Button.
|
|
42
|
-
*
|
|
43
|
-
* The icon will be displayed before the natural reading order of the text, regardless
|
|
44
|
-
of locale. Any string that is valid for its is
|
|
45
|
-
valid here. If `icon` is specified as a string and `iconButton` is undefined, the icon is
|
|
46
|
-
not rendered.
|
|
47
|
-
*
|
|
48
|
-
* This also supports a custom icon, in the form of a DOM node or a Component,
|
|
49
|
-
with the caveat that if you supply a custom icon, you are responsible for sizing and
|
|
50
|
-
locale positioning of the custom component.
|
|
51
|
-
*
|
|
52
|
-
* Setting this to `true` means the `iconComponent` will be rendered but with empty content.
|
|
53
|
-
This may be useful if you've customized the `iconComponent` to render the icon content
|
|
54
|
-
externally.
|
|
55
|
-
*/
|
|
56
|
-
icon?: React.ReactNode | boolean;
|
|
57
|
-
/**
|
|
58
|
-
* The component used to render the [icon] .
|
|
59
|
-
*
|
|
60
|
-
* This component will receive the `icon` class to customize its styling.
|
|
61
|
-
If [icon] is not assigned or is false, this component
|
|
62
|
-
will not be rendered.
|
|
63
|
-
*
|
|
64
|
-
* If this is a component rather than an HTML element string, this component will also
|
|
65
|
-
receive the `size` and `iconFlip` (as `flip` ) properties and should be configured to
|
|
66
|
-
handle it.
|
|
67
|
-
*/
|
|
68
|
-
iconComponent?: React.ComponentType | React.ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Flips the icon.
|
|
71
|
-
*/
|
|
72
|
-
iconFlip?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Enforces a minimum width for the component.
|
|
75
|
-
*
|
|
76
|
-
* Applies the `minWidth` CSS class which can be customized by
|
|
77
|
-
[theming] .
|
|
78
|
-
*/
|
|
79
|
-
minWidth?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Indicates the component is depressed.
|
|
82
|
-
*
|
|
83
|
-
* Applies the `pressed` CSS class which can be customized by
|
|
84
|
-
[theming] .
|
|
85
|
-
*/
|
|
86
|
-
pressed?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Indicates the component is selected.
|
|
89
|
-
*
|
|
90
|
-
* Applies the `selected` CSS class which can be customized by
|
|
91
|
-
[theming] .
|
|
92
|
-
*/
|
|
93
|
-
selected?: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* The size of the button.
|
|
96
|
-
*
|
|
97
|
-
* Applies the CSS class which can be customized by
|
|
98
|
-
[theming] .
|
|
99
|
-
*/
|
|
100
|
-
size?: string;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* A basic button component structure without any behaviors applied to it.
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
export class ButtonBase extends React.Component<
|
|
107
|
-
Merge<React.HTMLProps<HTMLElement>, ButtonBaseProps>
|
|
108
|
-
> {}
|
|
109
|
-
|
|
110
|
-
export interface ButtonDecoratorProps extends ui_Touchable_TouchableProps {}
|
|
111
|
-
export function ButtonDecorator<P>(
|
|
112
|
-
Component: React.ComponentType<P> | string
|
|
113
|
-
): React.ComponentType<P & ButtonDecoratorProps>;
|
|
114
|
-
|
|
115
|
-
export interface ButtonProps
|
|
116
|
-
extends Omit<Merge<ButtonBaseProps, ButtonDecoratorProps>, "componentRef"> {}
|
|
117
|
-
/**
|
|
118
|
-
* A minimally-styled button component with touch support.
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
export class Button extends React.Component<
|
|
122
|
-
Merge<React.HTMLProps<HTMLElement>, ButtonProps>
|
|
123
|
-
> {}
|
|
124
|
-
|
|
125
|
-
export default Button;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Cancelable
|
|
2
|
-
|
|
3
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
4
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
5
|
-
|
|
6
|
-
export interface CancelableConfig extends Object {
|
|
7
|
-
/**
|
|
8
|
-
* Called when a cancel action is invoked by the user.
|
|
9
|
-
*
|
|
10
|
-
* If it is a string, the cancel handler will attempt to invoke a function passed as a prop of
|
|
11
|
-
that name. If it is a function, that function will be called with the current props as the
|
|
12
|
-
only argument.
|
|
13
|
-
*
|
|
14
|
-
* If the function handles the cancel action, it should call `stopPropagation()` on the provided
|
|
15
|
-
event object prevent container or `modal` Cancelable instances from also handling the action.
|
|
16
|
-
*/
|
|
17
|
-
onCancel: string | Function;
|
|
18
|
-
/**
|
|
19
|
-
* Subscribes to cancel events globally for this instance.
|
|
20
|
-
*
|
|
21
|
-
* When `true` , the `Cancelable` instance will handle cancel events globally that successfully
|
|
22
|
-
bubble up to `window` regardless of which component is focused.
|
|
23
|
-
*
|
|
24
|
-
* `modal` cancel handlers are processed in reverse of the order they are created such that the
|
|
25
|
-
innermost instance (in terms of the component hierarchy) have the first opportunity to handle
|
|
26
|
-
the event before its container components.
|
|
27
|
-
*/
|
|
28
|
-
modal?: string;
|
|
29
|
-
/**
|
|
30
|
-
* The component that will contain the wrapped component.
|
|
31
|
-
*
|
|
32
|
-
* When set, the wrapped component will be contained within an instance of `component` . This may
|
|
33
|
-
be necessary if the props passed to the wrapped component are not placed on the root element.
|
|
34
|
-
*/
|
|
35
|
-
component?: React.ComponentType;
|
|
36
|
-
}
|
|
37
|
-
export interface CancelableProps {
|
|
38
|
-
/**
|
|
39
|
-
* Called when a cancel action is received.
|
|
40
|
-
*
|
|
41
|
-
* This callback is invoked for every cancel action before the config or prop handler is
|
|
42
|
-
invoked.
|
|
43
|
-
*/
|
|
44
|
-
onCancel?: Function;
|
|
45
|
-
}
|
|
46
|
-
export function Cancelable<P>(
|
|
47
|
-
config: CancelableConfig,
|
|
48
|
-
Component: React.ComponentType<P> | string
|
|
49
|
-
): React.ComponentType<P & CancelableProps>;
|
|
50
|
-
|
|
51
|
-
export function Cancelable<P>(
|
|
52
|
-
Component: React.ComponentType<P> | string
|
|
53
|
-
): React.ComponentType<P & CancelableProps>;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Adds an event handler to filter cancel events.
|
|
57
|
-
*/
|
|
58
|
-
export function addCancelHandler(handler: Function): void;
|
|
59
|
-
/**
|
|
60
|
-
* Removes an event handler to filter cancel events
|
|
61
|
-
*/
|
|
62
|
-
export function removeCancelHandler(handler: Function): void;
|
|
63
|
-
|
|
64
|
-
export default Cancelable;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Changeable
|
|
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 ChangeableConfig extends Object {
|
|
7
|
-
/**
|
|
8
|
-
* Configures the prop name to pass the callback to change the value
|
|
9
|
-
*/
|
|
10
|
-
change?: string;
|
|
11
|
-
/**
|
|
12
|
-
* Configures the prop name to pass the current value
|
|
13
|
-
*/
|
|
14
|
-
prop?: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ChangeableProps {
|
|
17
|
-
/**
|
|
18
|
-
* Called to notify `Changeable` that the value has changed.
|
|
19
|
-
*
|
|
20
|
-
* The event object must contain a property with the same name as the configured `prop` .
|
|
21
|
-
*/
|
|
22
|
-
onChange?: Function;
|
|
23
|
-
/**
|
|
24
|
-
* The value set at construction when the value prop is `undefined` or `null` .
|
|
25
|
-
*
|
|
26
|
-
* This prop is consumed by `Changeable` and not passed onto the wrapped component.
|
|
27
|
-
*/
|
|
28
|
-
defaultValue?: any;
|
|
29
|
-
/**
|
|
30
|
-
* The current value.
|
|
31
|
-
*
|
|
32
|
-
* When set at construction, the component is considered "controlled" and will only
|
|
33
|
-
update its internal value when updated by new props. If `undefined` , the component is
|
|
34
|
-
"uncontrolled" and `Changeable` will manage the value using callbacks defined by its
|
|
35
|
-
configuration.
|
|
36
|
-
*/
|
|
37
|
-
prop?: any;
|
|
38
|
-
/**
|
|
39
|
-
* Prevents updates to the internal state of `Changeable` .
|
|
40
|
-
*
|
|
41
|
-
* `disabled` is forwarded on to the wrapped component.
|
|
42
|
-
*/
|
|
43
|
-
disabled?: boolean;
|
|
44
|
-
}
|
|
45
|
-
export function Changeable<P>(
|
|
46
|
-
config: ChangeableConfig,
|
|
47
|
-
Component: React.ComponentType<P> | string
|
|
48
|
-
): React.ComponentType<P & ChangeableProps>;
|
|
49
|
-
|
|
50
|
-
export function Changeable<P>(
|
|
51
|
-
Component: React.ComponentType<P> | string
|
|
52
|
-
): React.ComponentType<P & ChangeableProps>;
|
|
53
|
-
|
|
54
|
-
export default Changeable;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/ComponentOverride
|
|
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 ComponentOverrideProps {}
|
|
9
|
-
/**
|
|
10
|
-
* Utility to either create or clone a component instance with the given set of props.
|
|
11
|
-
*
|
|
12
|
-
* `ComponentOverride` can be used to support props that either accept a type, (e.g. `Button` ) or an
|
|
13
|
-
element (e.g. `<Button customProp="value" />` ) and return a new element which includes the
|
|
14
|
-
remaining props specified.
|
|
15
|
-
*
|
|
16
|
-
* Example:
|
|
17
|
-
* ```
|
|
18
|
-
const LabeledIconButton = ({iconComponent, label, ...rest}) => {
|
|
19
|
-
return (
|
|
20
|
-
<div {...rest}>
|
|
21
|
-
<ComponentOverride
|
|
22
|
-
component={iconComponent}
|
|
23
|
-
icon="house"
|
|
24
|
-
/>
|
|
25
|
-
<span>{label}</span>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// Usage
|
|
31
|
-
|
|
32
|
-
// Only the props defined by LabeledIconButton will be passed to CustomIcon
|
|
33
|
-
<LabeledIconButton
|
|
34
|
-
label="Home"
|
|
35
|
-
iconComponent={CustomIcon}
|
|
36
|
-
/>
|
|
37
|
-
|
|
38
|
-
// The color prop along with props defined by LabeledIconButton will be passed to CustomIcon
|
|
39
|
-
<LabeledIconButton
|
|
40
|
-
label="Home"
|
|
41
|
-
iconComponent={
|
|
42
|
-
<CustomIcon color="green" />
|
|
43
|
-
}
|
|
44
|
-
/>
|
|
45
|
-
```
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
export class ComponentOverride extends React.Component<
|
|
49
|
-
Merge<React.HTMLProps<HTMLElement>, ComponentOverrideProps>
|
|
50
|
-
> {}
|
|
51
|
-
|
|
52
|
-
export default ComponentOverride;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,85 +0,0 @@
|
|
|
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 [source]
|
|
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;
|