@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/Spinner/Spinner.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Spinner
|
|
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 SpinnerBaseProps {
|
|
10
|
-
/**
|
|
11
|
-
* A theme-supplied component that performs the animation.
|
|
12
|
-
*
|
|
13
|
-
* Theme authors can use the `css.running` class to attach the animation CSS.
|
|
14
|
-
This element should accept a `children` prop which takes the form of an optional message
|
|
15
|
-
for the user.
|
|
16
|
-
*
|
|
17
|
-
* Unlike most other components, this does _not_ represent the root rendered element, and
|
|
18
|
-
instead refers to the "spinner" part of this component. The presence of `blockClickOn`
|
|
19
|
-
changes the rendering tree and where this is used.
|
|
20
|
-
*/
|
|
21
|
-
component: string | React.ComponentType;
|
|
22
|
-
/**
|
|
23
|
-
* Determines how far the click-blocking should extend.
|
|
24
|
-
* * `null` does not block clicking
|
|
25
|
-
* * 'screen' blocks entire screen
|
|
26
|
-
* * 'container' blocks up to the nearest ancestor with absolute or relative positioning
|
|
27
|
-
*
|
|
28
|
-
* When `blockClickOn` is either `'screen'` or `'container'` , a translucent scrim can be added
|
|
29
|
-
by setting [scrim] prop to `true` .
|
|
30
|
-
*/
|
|
31
|
-
blockClickOn?: string | any;
|
|
32
|
-
/**
|
|
33
|
-
* Centers the spinner horizontally and vertically relative to its containing component.
|
|
34
|
-
*/
|
|
35
|
-
centered?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Called with a reference to the root component.
|
|
38
|
-
*
|
|
39
|
-
* When using , the `ref` prop is forwarded to this component
|
|
40
|
-
as `componentRef` .
|
|
41
|
-
*/
|
|
42
|
-
componentRef?: object | Function;
|
|
43
|
-
/**
|
|
44
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
45
|
-
corresponding internal elements and states of this component.
|
|
46
|
-
*
|
|
47
|
-
* The following classes are supported:
|
|
48
|
-
* * `spinner` - The root `component` class
|
|
49
|
-
* * `spinnerContainer` - Added as a parent in the case of `blockOnClick="container"
|
|
50
|
-
* * `blockClickOn` - Applied if interaction should be blocked
|
|
51
|
-
* * `centered` - Applied if the `centered` prop is present
|
|
52
|
-
* * `running` - Always applied to `component` . Attach animation name property to this class.
|
|
53
|
-
* * `scrim` - The blocking layer behind the Spinner
|
|
54
|
-
*/
|
|
55
|
-
css?: object;
|
|
56
|
-
/**
|
|
57
|
-
* Halts the animation of the spinner
|
|
58
|
-
*/
|
|
59
|
-
paused?: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Sets a scrim behind the spinner with the `css.scrim` class applied.
|
|
62
|
-
*
|
|
63
|
-
* Only has an effect when `blockClickOn` is `'screen'` or `'container'` and has no effect
|
|
64
|
-
by default or when blockClickOn is `null` .
|
|
65
|
-
*/
|
|
66
|
-
scrim?: boolean;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* A minimally styled component that controls `Spinner` positioning and interaction states, without
|
|
70
|
-
applied.
|
|
71
|
-
*/
|
|
72
|
-
|
|
73
|
-
export class SpinnerBase extends React.Component<
|
|
74
|
-
Merge<React.HTMLProps<HTMLElement>, SpinnerBaseProps>
|
|
75
|
-
> {}
|
|
76
|
-
|
|
77
|
-
export interface SpinnerDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
|
|
78
|
-
export function SpinnerDecorator<P>(
|
|
79
|
-
Component: React.ComponentType<P> | string
|
|
80
|
-
): React.ComponentType<P & SpinnerDecoratorProps>;
|
|
81
|
-
|
|
82
|
-
export interface SpinnerProps
|
|
83
|
-
extends Omit<
|
|
84
|
-
Merge<SpinnerBaseProps, SpinnerDecoratorProps>,
|
|
85
|
-
"componentRef"
|
|
86
|
-
> {}
|
|
87
|
-
/**
|
|
88
|
-
* A minimally styled component that controls `Spinner` positioning and interaction states.
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
export class Spinner extends React.Component<
|
|
92
|
-
Merge<React.HTMLProps<HTMLElement>, SpinnerProps>
|
|
93
|
-
> {}
|
|
94
|
-
|
|
95
|
-
export default Spinner;
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/ToggleIcon
|
|
2
|
-
|
|
3
|
-
import * as React from "react";
|
|
4
|
-
import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
|
|
5
|
-
import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable";
|
|
6
|
-
import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
|
|
7
|
-
|
|
8
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
9
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
10
|
-
|
|
11
|
-
export interface ToggleIconBaseProps {
|
|
12
|
-
/**
|
|
13
|
-
* The icon to use for this component.
|
|
14
|
-
*/
|
|
15
|
-
children?: string | object;
|
|
16
|
-
/**
|
|
17
|
-
* Called with a reference to the root component.
|
|
18
|
-
*
|
|
19
|
-
* When using , the `ref` prop is forwarded to this component
|
|
20
|
-
as `componentRef` .
|
|
21
|
-
*/
|
|
22
|
-
componentRef?: object | Function;
|
|
23
|
-
/**
|
|
24
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
25
|
-
corresponding internal elements and states of this component.
|
|
26
|
-
*
|
|
27
|
-
* The following classes are supported:
|
|
28
|
-
* * `toggleIcon` - The root class name
|
|
29
|
-
* * `icon` - The background node of the button
|
|
30
|
-
* * `selected` - Applied to a `selected` button
|
|
31
|
-
*/
|
|
32
|
-
css?: object;
|
|
33
|
-
/**
|
|
34
|
-
* Disables `ToggleIcon` .
|
|
35
|
-
*/
|
|
36
|
-
disabled?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* CSS classes to be used on the Icon component
|
|
39
|
-
*/
|
|
40
|
-
iconClasses?: string;
|
|
41
|
-
/**
|
|
42
|
-
* The component used to render the icon.
|
|
43
|
-
*/
|
|
44
|
-
iconComponent?: string | React.ComponentType;
|
|
45
|
-
/**
|
|
46
|
-
* Sets whether this control is in the 'on' or 'off' state. `true` for 'on', `false` for 'off'.
|
|
47
|
-
*/
|
|
48
|
-
selected?: boolean;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Represents a Boolean state, and can accept any icon to toggle.
|
|
52
|
-
*/
|
|
53
|
-
|
|
54
|
-
export class ToggleIconBase extends React.Component<
|
|
55
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleIconBaseProps>
|
|
56
|
-
> {}
|
|
57
|
-
|
|
58
|
-
export interface ToggleIconDecoratorProps
|
|
59
|
-
extends Merge<
|
|
60
|
-
Merge<ui_ForwardRef_ForwardRefProps, ui_Toggleable_ToggleableProps>,
|
|
61
|
-
ui_Touchable_TouchableProps
|
|
62
|
-
> {}
|
|
63
|
-
/**
|
|
64
|
-
* Adds support for the `onToggle` prop callback to be fired when the `onTap` (touch-safe `onClick` )
|
|
65
|
-
event executes.
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
export class ToggleIconDecorator extends React.Component<
|
|
69
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleIconDecoratorProps>
|
|
70
|
-
> {}
|
|
71
|
-
|
|
72
|
-
export interface ToggleIconProps
|
|
73
|
-
extends Omit<
|
|
74
|
-
Merge<ToggleIconBaseProps, ToggleIconDecoratorProps>,
|
|
75
|
-
"componentRef"
|
|
76
|
-
> {
|
|
77
|
-
/**
|
|
78
|
-
* The handler to run when the component is toggled.
|
|
79
|
-
*/
|
|
80
|
-
onToggle?: Function;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Represents a Boolean state, and can accept any icon to toggle.
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
export class ToggleIcon extends React.Component<
|
|
87
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleIconProps>
|
|
88
|
-
> {}
|
|
89
|
-
|
|
90
|
-
export default ToggleIcon;
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/ToggleItem
|
|
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
|
-
import { ToggleableProps as ui_Toggleable_ToggleableProps } from "@enact/ui/Toggleable";
|
|
7
|
-
|
|
8
|
-
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
9
|
-
type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
|
|
10
|
-
|
|
11
|
-
export interface ToggleItemBaseProps {
|
|
12
|
-
/**
|
|
13
|
-
* The main content of the toggle item.
|
|
14
|
-
*/
|
|
15
|
-
children: React.ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* The type of component to use to render as root element.
|
|
18
|
-
*
|
|
19
|
-
* This receives the `css` prop for theme extension and therefore must be a custom
|
|
20
|
-
component and not a simple HTML DOM node. Recommended component or themed
|
|
21
|
-
derivative: [SlotItem]
|
|
22
|
-
*/
|
|
23
|
-
component: React.ComponentType;
|
|
24
|
-
/**
|
|
25
|
-
* The `Icon` to render in this item.
|
|
26
|
-
*
|
|
27
|
-
* This component receives the `selected` prop and value,
|
|
28
|
-
and must therefore respond to it in some way. It is recommended to use
|
|
29
|
-
[ToggleIcon] for this.
|
|
30
|
-
*/
|
|
31
|
-
iconComponent: React.ComponentType | JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
* Called with a reference to the root component.
|
|
34
|
-
*
|
|
35
|
-
* When using , the `ref` prop is forwarded to this
|
|
36
|
-
component as `componentRef` .
|
|
37
|
-
*/
|
|
38
|
-
componentRef?: object | Function;
|
|
39
|
-
/**
|
|
40
|
-
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
41
|
-
corresponding internal elements and states of this component.
|
|
42
|
-
*
|
|
43
|
-
* The following classes are supported:
|
|
44
|
-
* * `toggleItem` - The root class name
|
|
45
|
-
*/
|
|
46
|
-
css?: object;
|
|
47
|
-
/**
|
|
48
|
-
* Applies a disabled visual state to the toggle item.
|
|
49
|
-
*/
|
|
50
|
-
disabled?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* An optional prop that lets you override the icon of the `iconComponent` component.
|
|
53
|
-
*
|
|
54
|
-
* This accepts any string that the [Icon] component supports, provided
|
|
55
|
-
the recommendations of `iconComponent` are followed.
|
|
56
|
-
*/
|
|
57
|
-
icon?: string | object;
|
|
58
|
-
/**
|
|
59
|
-
* Specifies on which side ( `'before'` or `'after'` ) of `children` the icon appears.
|
|
60
|
-
*/
|
|
61
|
-
iconPosition?: "before" | "after";
|
|
62
|
-
/**
|
|
63
|
-
* An additional customizable icon component.
|
|
64
|
-
*
|
|
65
|
-
* Supports more granular positioning rules. This should only be used _after_ specifying the
|
|
66
|
-
`icon` property, as the positioning for this offers the ability to place this in front of
|
|
67
|
-
or behind the existing `icon` . See `itemIconPosition` for options.
|
|
68
|
-
*/
|
|
69
|
-
itemIcon?: React.ReactNode;
|
|
70
|
-
/**
|
|
71
|
-
* Specifies where `itemIcon` appears.
|
|
72
|
-
* * `'before'` - first element in the item
|
|
73
|
-
* * `'beforeChildren'` - before `children` . If `iconPosition` is `'before'` , `icon` will be
|
|
74
|
-
*
|
|
75
|
-
* before `itemIcon`
|
|
76
|
-
* * `'afterChildren'` - after `children` . If iconPosition `is` 'after' `, ` icon` will be
|
|
77
|
-
*
|
|
78
|
-
* after `itemIcon`
|
|
79
|
-
* * `'after'` - the last element in the item
|
|
80
|
-
*/
|
|
81
|
-
itemIconPosition?: "before" | "beforeChildren" | "afterChildren" | "after";
|
|
82
|
-
/**
|
|
83
|
-
* Called when the toggle item is toggled. Developers should generally use `onToggle` instead.
|
|
84
|
-
*/
|
|
85
|
-
onTap?: Function;
|
|
86
|
-
/**
|
|
87
|
-
* Called when the toggle item is toggled.
|
|
88
|
-
*/
|
|
89
|
-
onToggle?: Function;
|
|
90
|
-
/**
|
|
91
|
-
* Applies the provided `icon` .
|
|
92
|
-
*/
|
|
93
|
-
selected?: boolean;
|
|
94
|
-
/**
|
|
95
|
-
* The value that will be sent to the `onToggle` handler.
|
|
96
|
-
*/
|
|
97
|
-
value?: any;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* A minimally styled toggle item without any behavior, ripe for extension.
|
|
101
|
-
*/
|
|
102
|
-
|
|
103
|
-
export class ToggleItemBase extends React.Component<
|
|
104
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleItemBaseProps>
|
|
105
|
-
> {}
|
|
106
|
-
|
|
107
|
-
export interface ToggleItemDecoratorProps
|
|
108
|
-
extends Merge<
|
|
109
|
-
Merge<ui_ForwardRef_ForwardRefProps, ui_Touchable_TouchableProps>,
|
|
110
|
-
ui_Toggleable_ToggleableProps
|
|
111
|
-
> {}
|
|
112
|
-
export function ToggleItemDecorator<P>(
|
|
113
|
-
Component: React.ComponentType<P> | string
|
|
114
|
-
): React.ComponentType<P & ToggleItemDecoratorProps>;
|
|
115
|
-
|
|
116
|
-
export interface ToggleItemProps
|
|
117
|
-
extends Omit<
|
|
118
|
-
Merge<ToggleItemBaseProps, ToggleItemDecoratorProps>,
|
|
119
|
-
"componentRef"
|
|
120
|
-
> {}
|
|
121
|
-
/**
|
|
122
|
-
* An unstyled item with built-in support for toggling.
|
|
123
|
-
*
|
|
124
|
-
* Example:
|
|
125
|
-
* ```
|
|
126
|
-
<ToggleItem icon="lock" iconPosition="before">Toggle Me</ToggleItem>
|
|
127
|
-
```
|
|
128
|
-
*/
|
|
129
|
-
|
|
130
|
-
export class ToggleItem extends React.Component<
|
|
131
|
-
Merge<React.HTMLProps<HTMLElement>, ToggleItemProps>
|
|
132
|
-
> {}
|
|
133
|
-
|
|
134
|
-
export default ToggleItem;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Toggleable
|
|
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 ToggleableConfig extends Object {
|
|
7
|
-
/**
|
|
8
|
-
* Configures the event name that activates the component.
|
|
9
|
-
*
|
|
10
|
-
* Note : When using `activate` / `deactivate` , the event payload will only forward the original
|
|
11
|
-
event and not include toggled `prop` value. Use `toggle` to receive toggled value from the
|
|
12
|
-
event payload.
|
|
13
|
-
*
|
|
14
|
-
* Example:
|
|
15
|
-
* ```
|
|
16
|
-
const ToggleItem = Toggleable({activate: 'onFocus', deactivate: 'onBlur'}, Item);
|
|
17
|
-
|
|
18
|
-
handleEvent = (ev) => {
|
|
19
|
-
// do something with `ev.selected` here
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
<ToggleItem onToggle={handleEvent}>This is a toggle item</Item>
|
|
23
|
-
```
|
|
24
|
-
*/
|
|
25
|
-
activate?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Configures the event name that deactivates the component.
|
|
28
|
-
*
|
|
29
|
-
* Note : When using `activate` / `deactivate` , the event payload will only forward the original
|
|
30
|
-
event and not include toggled `prop` value. Use `toggle` to receive toggled value from the
|
|
31
|
-
event payload.
|
|
32
|
-
*
|
|
33
|
-
* Example:
|
|
34
|
-
* ```
|
|
35
|
-
const ToggleItem = Toggleable({activate: 'onFocus', deactivate: 'onBlur'}, Item);
|
|
36
|
-
|
|
37
|
-
handleEvent = (ev) => {
|
|
38
|
-
// do something with `ev.selected` here
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
<ToggleItem onToggle={handleEvent}>This is a toggle item</Item>
|
|
42
|
-
```
|
|
43
|
-
*/
|
|
44
|
-
deactivate?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Configures additional props to attach to the event that is sent when toggled.
|
|
47
|
-
*/
|
|
48
|
-
eventProps?: string[];
|
|
49
|
-
/**
|
|
50
|
-
* Configures the property that is passed to the wrapped component when toggled.
|
|
51
|
-
*/
|
|
52
|
-
prop?: string;
|
|
53
|
-
/**
|
|
54
|
-
* Configures the event name that toggles the component.
|
|
55
|
-
*
|
|
56
|
-
* The payload includes a toggled Boolean value of `prop` .
|
|
57
|
-
*
|
|
58
|
-
* Note : The payload will override the original event. If a native event is set, then the native
|
|
59
|
-
event payload will be lost.
|
|
60
|
-
*/
|
|
61
|
-
toggle?: string;
|
|
62
|
-
/**
|
|
63
|
-
* Allows you to remap the incoming `toggle` callback to an event name of your choosing.
|
|
64
|
-
*
|
|
65
|
-
* For example, run `onToggle` when the wrapped component has an `onClick` property and you've specified
|
|
66
|
-
`onClick` here.
|
|
67
|
-
*/
|
|
68
|
-
toggleProp?: string;
|
|
69
|
-
}
|
|
70
|
-
export interface ToggleableProps {
|
|
71
|
-
/**
|
|
72
|
-
* Default toggled state applied at construction when the toggled prop is `undefined` or
|
|
73
|
-
`null` .
|
|
74
|
-
*/
|
|
75
|
-
defaultSelected?: boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Whether or not the component is in a disabled state.
|
|
78
|
-
*/
|
|
79
|
-
disabled?: boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Current toggled state.
|
|
82
|
-
*
|
|
83
|
-
* When set at construction, the component is considered 'controlled' and will only
|
|
84
|
-
update its internal value when updated by new props. If undefined, the component
|
|
85
|
-
is 'uncontrolled' and `Toggleable` will manage the toggled state using callbacks
|
|
86
|
-
defined by its configuration.
|
|
87
|
-
*/
|
|
88
|
-
selected?: boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Event callback to notify that state should be toggled.
|
|
91
|
-
*/
|
|
92
|
-
onToggle?: Function;
|
|
93
|
-
}
|
|
94
|
-
export function Toggleable<P>(
|
|
95
|
-
config: ToggleableConfig,
|
|
96
|
-
Component: React.ComponentType<P> | string
|
|
97
|
-
): React.ComponentType<P & ToggleableProps>;
|
|
98
|
-
|
|
99
|
-
export function Toggleable<P>(
|
|
100
|
-
Component: React.ComponentType<P> | string
|
|
101
|
-
): React.ComponentType<P & ToggleableProps>;
|
|
102
|
-
|
|
103
|
-
export default Toggleable;
|
package/Touchable/Touchable.d.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
// Type definitions for ui/Touchable
|
|
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 TouchableConfig extends Object {
|
|
7
|
-
/**
|
|
8
|
-
* Configures the prop name to pass the active state to the wrapped component
|
|
9
|
-
*/
|
|
10
|
-
activeProp?: string;
|
|
11
|
-
}
|
|
12
|
-
export interface TouchableProps {
|
|
13
|
-
/**
|
|
14
|
-
* Disables the component.
|
|
15
|
-
*/
|
|
16
|
-
disabled?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Instance-specific overrides of the drag configuration.
|
|
19
|
-
*/
|
|
20
|
-
dragConfig?: object;
|
|
21
|
-
/**
|
|
22
|
-
* Instance-specific overrides of the flick configuration.
|
|
23
|
-
*/
|
|
24
|
-
flickConfig?: object;
|
|
25
|
-
/**
|
|
26
|
-
* Instance-specific overrides of the hold configuration.
|
|
27
|
-
*/
|
|
28
|
-
holdConfig?: object;
|
|
29
|
-
/**
|
|
30
|
-
* Prevents resuming the touch events and gestures when re-entering the component.
|
|
31
|
-
*/
|
|
32
|
-
noResume?: boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Event handler for 'down' pointer events.
|
|
35
|
-
*/
|
|
36
|
-
onDown?: Function;
|
|
37
|
-
/**
|
|
38
|
-
* Event handler for a drag gesture.
|
|
39
|
-
*
|
|
40
|
-
* Event payload includes:
|
|
41
|
-
* * `type` - Type of event, `'onDrag'`
|
|
42
|
-
* * `x` - Horizontal position of the drag, relative to the viewport
|
|
43
|
-
* * `y` - Vertical position of the drag, relative to the viewport
|
|
44
|
-
*/
|
|
45
|
-
onDrag?: Function;
|
|
46
|
-
/**
|
|
47
|
-
* Event handler for the end of a drag gesture.
|
|
48
|
-
*
|
|
49
|
-
* Event payload includes:
|
|
50
|
-
* * `type` - Type of event, `'onDragEnd'`
|
|
51
|
-
*/
|
|
52
|
-
onDragEnd?: Function;
|
|
53
|
-
/**
|
|
54
|
-
* Event handler for the start of a drag gesture.
|
|
55
|
-
*
|
|
56
|
-
* Event payload includes:
|
|
57
|
-
* * `type` - Type of event, `'onDragStart'`
|
|
58
|
-
* * `x` - Horizontal position of the drag, relative to the viewport
|
|
59
|
-
* * `y` - Vertical position of the drag, relative to the viewport
|
|
60
|
-
*/
|
|
61
|
-
onDragStart?: Function;
|
|
62
|
-
/**
|
|
63
|
-
* Event handler for a flick gesture.
|
|
64
|
-
*
|
|
65
|
-
* Event payload includes:
|
|
66
|
-
* * `type` - Type of event, `'onFlick'`
|
|
67
|
-
* * `direction` - Primary direction of the flick, either `'horizontal'` or `'vertical'`
|
|
68
|
-
* * `velocity` - Velocity of flick
|
|
69
|
-
* * `velocityX` - Velocity of flick along te horizontal axis
|
|
70
|
-
* * `velocityY` - Velocity of flick along te vertical axis
|
|
71
|
-
*/
|
|
72
|
-
onFlick?: Function;
|
|
73
|
-
/**
|
|
74
|
-
* Event handler for hold pulse events.
|
|
75
|
-
*
|
|
76
|
-
* Event payload includes:
|
|
77
|
-
* * `type` - Type of event, `'onHold'`
|
|
78
|
-
* * `time` - Time, in milliseconds, since the hold began
|
|
79
|
-
*/
|
|
80
|
-
onHold?: Function;
|
|
81
|
-
/**
|
|
82
|
-
* Event handler for the end of hold events.
|
|
83
|
-
*
|
|
84
|
-
* Event payload includes:
|
|
85
|
-
* * `type` - Type of event, `'onHoldEnd'`
|
|
86
|
-
* * `time` - Time, in milliseconds, since the hold began
|
|
87
|
-
*/
|
|
88
|
-
onHoldEnd?: Function;
|
|
89
|
-
/**
|
|
90
|
-
* Event handler for hold events.
|
|
91
|
-
*
|
|
92
|
-
* Event payload includes:
|
|
93
|
-
* * `type` - Type of event, `'onHoldStart'`
|
|
94
|
-
* * `name` - The name of the hold as configured in the events list
|
|
95
|
-
* * `time` - Time, in milliseconds, configured for this hold which may vary slightly
|
|
96
|
-
from time since the hold began
|
|
97
|
-
*/
|
|
98
|
-
onHoldStart?: Function;
|
|
99
|
-
/**
|
|
100
|
-
* Event handler for 'move' pointer events.
|
|
101
|
-
*/
|
|
102
|
-
onMove?: Function;
|
|
103
|
-
/**
|
|
104
|
-
* Event handler for 'tap' pointer events.
|
|
105
|
-
*/
|
|
106
|
-
onTap?: Function;
|
|
107
|
-
/**
|
|
108
|
-
* Event handler for 'up' pointer events.
|
|
109
|
-
*/
|
|
110
|
-
onUp?: Function;
|
|
111
|
-
}
|
|
112
|
-
export function Touchable<P>(
|
|
113
|
-
config: TouchableConfig,
|
|
114
|
-
Component: React.ComponentType<P> | string
|
|
115
|
-
): React.ComponentType<P & TouchableProps>;
|
|
116
|
-
|
|
117
|
-
export function Touchable<P>(
|
|
118
|
-
Component: React.ComponentType<P> | string
|
|
119
|
-
): React.ComponentType<P & TouchableProps>;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Configures the global gesture configuration for the application.
|
|
123
|
-
*
|
|
124
|
-
* Example:
|
|
125
|
-
* ```
|
|
126
|
-
// Updates the `maxMoves`, `moveTolerance`, and `frequency` configurations while retaining the
|
|
127
|
-
// current value of all other configurations
|
|
128
|
-
configure({
|
|
129
|
-
flick: {
|
|
130
|
-
maxMoves: 10
|
|
131
|
-
},
|
|
132
|
-
hold: {
|
|
133
|
-
moveTolerance: 32,
|
|
134
|
-
frequency: 400
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
* Each type of gesture has its own set of configuration properties grouped within a separate object
|
|
140
|
-
keyed by the name of the gesture. Partial configurations may be passed and will be merged with
|
|
141
|
-
the current configuration.
|
|
142
|
-
*
|
|
143
|
-
* `drag`
|
|
144
|
-
* * `boxSizing` - The part of the component's box model is used as the bounds of the constraint.
|
|
145
|
-
Only applies when `global` is `false` .
|
|
146
|
-
* * `'border-box'` - the default, includes the padding and border but excludes the margin.
|
|
147
|
-
* * `'content-box'` - excludes the padding, border, and margin.
|
|
148
|
-
* * `global` - When `true` , drag gestures will continue when leaving the bounds of the component
|
|
149
|
-
or blurring the component.
|
|
150
|
-
* * `moveTolerance` - The number of pixels from the start position of the drag that the pointer
|
|
151
|
-
may move before cancelling the drag. Defaults to `16` .
|
|
152
|
-
*
|
|
153
|
-
* `flick`
|
|
154
|
-
* * `maxDuration` - The amount of time, in milliseconds, to complete a flick gesture before it
|
|
155
|
-
is cancelled. Defaults to 250.
|
|
156
|
-
* * `maxMoves` - The number of moves tracked to determine if a flick occurred. Defaults to `5` .
|
|
157
|
-
* * `minVelocity` - The minimum threshold, measured as the change in pixels over the change in
|
|
158
|
-
time per move, that must be exceeded to generate a `onFlick` event.
|
|
159
|
-
*
|
|
160
|
-
* `hold`
|
|
161
|
-
* * `cancelOnMove` - When `true` , the hold is cancelled when moving beyond the `moveTolerance` .
|
|
162
|
-
Defaults to `false`
|
|
163
|
-
* * `global` - When `true` , hold gestures will continue when leaving the bounds of the component
|
|
164
|
-
or blurring the component.
|
|
165
|
-
* * `moveTolerance` - The number of pixels from the start position of the hold that the pointer
|
|
166
|
-
may move before cancelling the hold. Ignored when `cancelOnMove` is `false` . Defaults to
|
|
167
|
-
`16` .
|
|
168
|
-
* * `frequency` - The time, in milliseconds, to poll for hold events. Defaults to `200` .
|
|
169
|
-
* * `events` - An array of `onHoldStart` events which each contain a `name` and `time` . The `time`
|
|
170
|
-
controls the amount of time that must pass before this `onHoldStart` event is fired and should
|
|
171
|
-
be a multiple of `frequency` .
|
|
172
|
-
*/
|
|
173
|
-
export function configure(cfg: object): void;
|
|
174
|
-
|
|
175
|
-
export default Touchable;
|