@enact/ui 4.6.0 → 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.
Files changed (65) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/FloatingLayer/package.json +3 -0
  3. package/IconButton/IconButton.js +7 -2
  4. package/RadioDecorator/RadioControllerDecorator.js +6 -0
  5. package/RadioDecorator/RadioDecorator.js +5 -0
  6. package/Scroller/UiScrollerBase.js +6 -0
  7. package/SlotItem/SlotItem.js +6 -2
  8. package/ToggleItem/ToggleItem.js +6 -2
  9. package/Touchable/Pinch.js +185 -0
  10. package/Touchable/Touch.js +34 -11
  11. package/Touchable/Touchable.js +63 -4
  12. package/Touchable/config.js +19 -2
  13. package/Touchable/tests/Touchable-specs.js +96 -6
  14. package/Touchable/useTouch.js +41 -32
  15. package/VirtualList/UiVirtualListBase.js +6 -0
  16. package/package.json +2 -2
  17. package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
  18. package/BodyText/BodyText.d.ts +0 -66
  19. package/Button/Button.d.ts +0 -125
  20. package/Cancelable/Cancelable.d.ts +0 -64
  21. package/Changeable/Changeable.d.ts +0 -54
  22. package/ComponentOverride/ComponentOverride.d.ts +0 -52
  23. package/ForwardRef/ForwardRef.d.ts +0 -22
  24. package/GridListImageItem/GridListImageItem.d.ts +0 -85
  25. package/Group/Group.d.ts +0 -107
  26. package/Heading/Heading.d.ts +0 -90
  27. package/Icon/Icon.d.ts +0 -88
  28. package/IconButton/IconButton.d.ts +0 -115
  29. package/Image/Image.d.ts +0 -113
  30. package/ImageItem/ImageItem.d.ts +0 -83
  31. package/Item/Item.d.ts +0 -64
  32. package/LabeledIcon/LabeledIcon.d.ts +0 -130
  33. package/Layout/Layout.d.ts +0 -247
  34. package/Marquee/index.d.ts +0 -258
  35. package/Measurable/Measurable.d.ts +0 -26
  36. package/Media/Media.d.ts +0 -99
  37. package/Placeholder/index.d.ts +0 -53
  38. package/ProgressBar/ProgressBar.d.ts +0 -92
  39. package/RadioDecorator/RadioDecorator.d.ts +0 -35
  40. package/Repeater/Repeater.d.ts +0 -83
  41. package/Resizable/Resizable.d.ts +0 -31
  42. package/Routable/Routable.d.ts +0 -148
  43. package/Scrollable/Scrollable.d.ts +0 -0
  44. package/Scroller/Scroller.d.ts +0 -276
  45. package/Skinnable/Skinnable.d.ts +0 -94
  46. package/Slider/Slider.d.ts +0 -202
  47. package/SlotItem/SlotItem.d.ts +0 -118
  48. package/Slottable/Slottable.d.ts +0 -22
  49. package/Spinner/Spinner.d.ts +0 -95
  50. package/ToggleIcon/ToggleIcon.d.ts +0 -90
  51. package/ToggleItem/ToggleItem.d.ts +0 -134
  52. package/Toggleable/Toggleable.d.ts +0 -103
  53. package/Touchable/Touchable.d.ts +0 -175
  54. package/Transition/Transition.d.ts +0 -196
  55. package/ViewManager/ViewManager.d.ts +0 -191
  56. package/VirtualList/VirtualList.d.ts +0 -530
  57. package/index.d.ts +0 -0
  58. package/internal/IdProvider/IdProvider.d.ts +0 -0
  59. package/internal/Pure/Pure.d.ts +0 -0
  60. package/internal/localized-fonts/localized-fonts.d.ts +0 -53
  61. package/internal/selection/selection.d.ts +0 -0
  62. package/internal/validators/validators.d.ts +0 -0
  63. package/resolution/index.d.ts +0 -187
  64. package/useControlledState/useControlledState.d.ts +0 -0
  65. package/useScroll/useScroll.d.ts +0 -0
@@ -203,6 +203,96 @@ describe('Touchable', function () {
203
203
  expect(handler).toHaveBeenCalled();
204
204
  done();
205
205
  });
206
+ test('should update state configurations onPinchStart events', function (done) {
207
+ var pinchConfig = {
208
+ global: true,
209
+ moveTolerance: 0
210
+ };
211
+ var Component = (0, _Touchable["default"])(DivComponent);
212
+ var handler = jest.fn();
213
+ var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
214
+ pinchConfig: pinchConfig,
215
+ onPinch: function onPinch() {}
216
+ })),
217
+ rerender = _render6.rerender;
218
+ var component = _react.screen.getByTestId('component');
219
+ var touchEvent = {
220
+ timeStamp: 1,
221
+ type: 'touch',
222
+ clientX: 0,
223
+ clientY: 0,
224
+ changedTouches: [{
225
+ clientX: 0,
226
+ clientY: 0
227
+ }, {
228
+ clientX: 10,
229
+ clientY: 10
230
+ }],
231
+ targetTouches: [{
232
+ clientX: 0,
233
+ clientY: 0
234
+ }, {
235
+ clientX: 10,
236
+ clientY: 10
237
+ }]
238
+ };
239
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
240
+ pinchConfig: pinchConfig,
241
+ onPinch: function onPinch() {},
242
+ onPinchStart: handler
243
+ }));
244
+ _react.fireEvent.touchStart(component, touchEvent);
245
+ _react.fireEvent.mouseDown(component, touchEvent);
246
+ jest.runOnlyPendingTimers();
247
+ expect(handler).toHaveBeenCalled();
248
+ done();
249
+ });
250
+ test('should update state configurations onPinchEnd events', function (done) {
251
+ var pinchConfig = {
252
+ global: true,
253
+ moveTolerance: 0
254
+ };
255
+ var Component = (0, _Touchable["default"])(DivComponent);
256
+ var handler = jest.fn();
257
+ var _render7 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
258
+ pinchConfig: pinchConfig,
259
+ onPinch: function onPinch() {}
260
+ })),
261
+ rerender = _render7.rerender;
262
+ var component = _react.screen.getByTestId('component');
263
+ var touchEvent = {
264
+ timeStamp: 1,
265
+ type: 'touch',
266
+ clientX: 0,
267
+ clientY: 0,
268
+ changedTouches: [{
269
+ clientX: 0,
270
+ clientY: 0
271
+ }, {
272
+ clientX: 10,
273
+ clientY: 10
274
+ }],
275
+ targetTouches: [{
276
+ clientX: 0,
277
+ clientY: 0
278
+ }, {
279
+ clientX: 10,
280
+ clientY: 10
281
+ }]
282
+ };
283
+ _react.fireEvent.touchStart(component, touchEvent);
284
+ _react.fireEvent.mouseDown(component, touchEvent);
285
+ rerender( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
286
+ pinchConfig: pinchConfig,
287
+ onPinch: function onPinch() {},
288
+ onPinchEnd: handler
289
+ }));
290
+ jest.runOnlyPendingTimers();
291
+ _react.fireEvent.touchEnd(component, touchEvent);
292
+ _react.fireEvent.mouseUp(component, touchEvent);
293
+ expect(handler).toHaveBeenCalled();
294
+ done();
295
+ });
206
296
  test('should merge configurations', function () {
207
297
  (0, _config.configure)({
208
298
  flick: {
@@ -298,10 +388,10 @@ describe('Touchable', function () {
298
388
  test('should call onDragStart event', function (done) {
299
389
  var Component = (0, _Touchable["default"])(DivComponent);
300
390
  var handler = jest.fn();
301
- var _render6 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
391
+ var _render8 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
302
392
  onDrag: function onDrag() {}
303
393
  })),
304
- rerender = _render6.rerender;
394
+ rerender = _render8.rerender;
305
395
  var component = _react.screen.getByTestId('component');
306
396
  _react.fireEvent.mouseDown(component, {
307
397
  clientX: 10,
@@ -347,10 +437,10 @@ describe('Touchable', function () {
347
437
  test('should call onDragEnd event', function (done) {
348
438
  var Component = (0, _Touchable["default"])(DivComponent);
349
439
  var handler = jest.fn();
350
- var _render7 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
440
+ var _render9 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
351
441
  onDrag: function onDrag() {}
352
442
  })),
353
- rerender = _render7.rerender;
443
+ rerender = _render9.rerender;
354
444
  var component = _react.screen.getByTestId('component');
355
445
  _react.fireEvent.mouseDown(component, {
356
446
  clientX: 10,
@@ -392,10 +482,10 @@ describe('Touchable', function () {
392
482
  test('should not call onDragEnd on mouseLeave', function (done) {
393
483
  var Component = (0, _Touchable["default"])(DivComponent);
394
484
  var handler = jest.fn();
395
- var _render8 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
485
+ var _render10 = (0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, {
396
486
  onDrag: function onDrag() {}
397
487
  })),
398
- rerender = _render8.rerender;
488
+ rerender = _render10.rerender;
399
489
  var component = _react.screen.getByTestId('component');
400
490
  _react.fireEvent.mouseDown(component, {
401
491
  clientX: 10,
@@ -24,33 +24,37 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
24
  *
25
25
  * @typedef {Object} useTouchConfig
26
26
  * @memberof ui/Touchable
27
- * @property {Object} dragConfig Instance-specific overrides of the drag configuration
28
- * @property {Object} flickConfig Instance-specific overrides of the flick configuration
29
- * @property {Object} holdConfig Instance-specific overrides of the hold configuration
30
- * @property {Boolean} getActive Enables active state management
31
- * @property {Boolean} disabled Disables a hook
32
- * @property {Boolean} noResume Prevents resuming the touch events and gestures when re-entering the component
33
- * @property {Function} onBlur Event handler for a blur event
34
- * @property {Function} onClick Event handler for a click event
35
- * @property {Function} onMouseDown Event handler for a mousedown event
36
- * @property {Function} onMouseEnter Event handler for a mouseenter event
37
- * @property {Function} onMouseLeave Event handler for a mouseleave event
38
- * @property {Function} onMouseMove Event handler for a mousemove event
39
- * @property {Function} onMouseUp Event handler for a mouseup event
40
- * @property {Function} onTouchEnd Event handler for a touchend event
41
- * @property {Function} onTouchMove Event handler for a touchmove event
42
- * @property {Function} onTouchStart Event handler for a touchstart event
43
- * @property {Function} onDown Event handler for 'down' pointer events
44
- * @property {Function} onDrag Event handler for a drag gesture
45
- * @property {Function} onDragEnd Event handler for the end of a drag gesture
46
- * @property {Function} onDragStart Event handler for the start of a drag gesture
47
- * @property {Function} onFlick Event handler for a flick gesture
48
- * @property {Function} onHold Event handler for hold pulse events
49
- * @property {Function} onHoldEnd Event handler for the end of hold events
50
- * @property {Function} onHoldStart Event handler for hold events
51
- * @property {Function} onMove Event handler for a pointer moving
52
- * @property {Function} onTap Event handler for 'tap' pointer events
53
- * @property {Function} onUp Event handler for 'up' pointer events
27
+ * @property {Object} dragConfig Instance-specific overrides of the drag configuration
28
+ * @property {Object} flickConfig Instance-specific overrides of the flick configuration
29
+ * @property {Object} holdConfig Instance-specific overrides of the hold configuration
30
+ * @property {Object} pinchConfig Instance-specific overrides of the pinch configuration
31
+ * @property {Boolean} getActive Enables active state management
32
+ * @property {Boolean} disabled Disables a hook
33
+ * @property {Boolean} noResume Prevents resuming the touch events and gestures when re-entering the component
34
+ * @property {Function} onBlur Event handler for a blur event
35
+ * @property {Function} onClick Event handler for a click event
36
+ * @property {Function} onMouseDown Event handler for a mousedown event
37
+ * @property {Function} onMouseEnter Event handler for a mouseenter event
38
+ * @property {Function} onMouseLeave Event handler for a mouseleave event
39
+ * @property {Function} onMouseMove Event handler for a mousemove event
40
+ * @property {Function} onMouseUp Event handler for a mouseup event
41
+ * @property {Function} onTouchEnd Event handler for a touchend event
42
+ * @property {Function} onTouchMove Event handler for a touchmove event
43
+ * @property {Function} onTouchStart Event handler for a touchstart event
44
+ * @property {Function} onDown Event handler for 'down' pointer events
45
+ * @property {Function} onDrag Event handler for a drag gesture
46
+ * @property {Function} onDragEnd Event handler for the end of a drag gesture
47
+ * @property {Function} onDragStart Event handler for the start of a drag gesture
48
+ * @property {Function} onFlick Event handler for a flick gesture
49
+ * @property {Function} onHold Event handler for hold pulse events
50
+ * @property {Function} onHoldEnd Event handler for the end of hold events
51
+ * @property {Function} onHoldStart Event handler for hold events
52
+ * @property {Function} onPinch Event handler for pinch gesture
53
+ * @property {Function} onPinchEnd Event handler for the end of pinch gesture
54
+ * @property {Function} onPinchStart Event handler for pinch gesture
55
+ * @property {Function} onMove Event handler for a pointer moving
56
+ * @property {Function} onTap Event handler for 'tap' pointer events
57
+ * @property {Function} onUp Event handler for 'up' pointer events
54
58
  * @see {@link ui/Touchable.configure}
55
59
  * @private
56
60
  */
@@ -68,7 +72,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
68
72
  /**
69
73
  * Provides a consistent set of pointer events -- `onDown`, `onUp`, and `onTap` --
70
74
  * across mouse and touch interfaces along with support for common gestures including
71
- * `onFlick`, `onDrag`, `onHoldStart`, `onHold`, and `onHoldEnd`.
75
+ * `onFlick`, `onDragStart`, `onDrag`, `onDragEnd`, `onHoldStart`, `onHold`, `onHoldEnd`,
76
+ * `onPinchStart`, `onPinch`, and `onPinchEnd`.
72
77
  * @param {useTouchConfig} config Configuration options
73
78
  * @returns {useTouchInterface}
74
79
  * @private
@@ -81,13 +86,17 @@ function useTouch() {
81
86
  dragConfig = config.dragConfig,
82
87
  flickConfig = config.flickConfig,
83
88
  holdConfig = config.holdConfig,
89
+ pinchConfig = config.pinchConfig,
84
90
  onDrag = config.onDrag,
85
91
  onDragEnd = config.onDragEnd,
86
92
  onDragStart = config.onDragStart,
87
93
  onHold = config.onHold,
88
94
  onHoldEnd = config.onHoldEnd,
89
95
  onHoldStart = config.onHoldStart,
90
- onFlick = config.onFlick;
96
+ onFlick = config.onFlick,
97
+ onPinch = config.onPinch,
98
+ onPinchEnd = config.onPinchEnd,
99
+ onPinchStart = config.onPinchStart;
91
100
  var touch = (0, _useClass["default"])(_Touch["default"]);
92
101
  var _useState = (0, _react.useState)(_state.States.Inactive),
93
102
  _useState2 = _slicedToArray(_useState, 2),
@@ -107,12 +116,12 @@ function useTouch() {
107
116
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
108
117
 
109
118
  (0, _react.useEffect)(function () {
110
- touch.updateGestureConfig(dragConfig, flickConfig, holdConfig);
111
- }, [dragConfig, flickConfig, holdConfig]); // eslint-disable-line react-hooks/exhaustive-deps
119
+ touch.updateGestureConfig(dragConfig, flickConfig, holdConfig, pinchConfig);
120
+ }, [dragConfig, flickConfig, holdConfig, pinchConfig]); // eslint-disable-line react-hooks/exhaustive-deps
112
121
 
113
122
  (0, _react.useEffect)(function () {
114
123
  touch.updateProps(config);
115
- }, [onDrag, onDragEnd, onDragStart, onHold, onHoldEnd, onHoldStart, onFlick]); // eslint-disable-line react-hooks/exhaustive-deps
124
+ }, [onDrag, onDragEnd, onDragStart, onHold, onHoldEnd, onHoldStart, onFlick, onPinch, onPinchEnd, onPinchStart]); // eslint-disable-line react-hooks/exhaustive-deps
116
125
 
117
126
  (0, _react.useEffect)(function () {
118
127
  if (disabled) {
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports["default"] = exports.UiVirtualListBaseNative = exports.UiVirtualListBase = void 0;
7
7
  var _classnames = _interopRequireDefault(require("classnames"));
8
8
  var _handle = require("@enact/core/handle");
9
+ var _deprecate = _interopRequireDefault(require("@enact/core/internal/deprecate"));
9
10
  var _platform = require("@enact/core/platform");
10
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
12
  var _equals = _interopRequireDefault(require("ramda/src/equals"));
@@ -983,6 +984,10 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
983
984
  }, {
984
985
  key: "render",
985
986
  value: function render() {
987
+ (0, _deprecate["default"])({
988
+ name: 'ui/VirtualList.VirtualListBase',
989
+ until: '5.0.0'
990
+ });
986
991
  var _this$props7 = this.props,
987
992
  className = _this$props7.className,
988
993
  containerProps = _this$props7.containerProps,
@@ -1231,6 +1236,7 @@ var VirtualListBaseFactory = function VirtualListBaseFactory(type) {
1231
1236
  * @memberof ui/VirtualList
1232
1237
  * @ui
1233
1238
  * @public
1239
+ * @deprecated Will be removed in 5.0.0.
1234
1240
  */
1235
1241
  var VirtualListBase = VirtualListBaseFactory(JS);
1236
1242
  exports.UiVirtualListBase = VirtualListBase;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/ui",
3
- "version": "4.6.0",
3
+ "version": "4.6.1",
4
4
  "description": "A collection of simplified unstyled cross-platform UI components for Enact",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,7 +31,7 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "@enact/core": "^4.6.0",
34
+ "@enact/core": "^4.6.1",
35
35
  "classnames": "^2.3.2",
36
36
  "direction": "^1.0.4",
37
37
  "invariant": "^2.2.4",
@@ -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;
@@ -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
- .
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;
@@ -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 .
59
- *
60
- * This component will receive the `icon` class to customize its styling.
61
- If is not assigned or is false, this component
62
- will not be rendered.
63
- *
64
- * If this is a component rather than an HTML element string, this component will also
65
- receive the `size` and `iconFlip` (as `flip` ) properties and should be configured to
66
- handle it.
67
- */
68
- iconComponent?: React.ComponentType | React.ReactNode;
69
- /**
70
- * Flips the icon.
71
- */
72
- iconFlip?: string;
73
- /**
74
- * Enforces a minimum width for the component.
75
- *
76
- * Applies the `minWidth` CSS class which can be customized by
77
- .
78
- */
79
- minWidth?: boolean;
80
- /**
81
- * Indicates the component is depressed.
82
- *
83
- * Applies the `pressed` CSS class which can be customized by
84
- .
85
- */
86
- pressed?: boolean;
87
- /**
88
- * Indicates the component is selected.
89
- *
90
- * Applies the `selected` CSS class which can be customized by
91
- .
92
- */
93
- selected?: boolean;
94
- /**
95
- * The size of the button.
96
- *
97
- * Applies the CSS class which can be customized by
98
- .
99
- */
100
- size?: string;
101
- }
102
- /**
103
- * A basic button component structure without any behaviors applied to it.
104
- */
105
-
106
- export class ButtonBase extends React.Component<
107
- Merge<React.HTMLProps<HTMLElement>, ButtonBaseProps>
108
- > {}
109
-
110
- export interface ButtonDecoratorProps extends ui_Touchable_TouchableProps {}
111
- export function ButtonDecorator<P>(
112
- Component: React.ComponentType<P> | string
113
- ): React.ComponentType<P & ButtonDecoratorProps>;
114
-
115
- export interface ButtonProps
116
- extends Omit<Merge<ButtonBaseProps, ButtonDecoratorProps>, "componentRef"> {}
117
- /**
118
- * A minimally-styled button component with touch support.
119
- */
120
-
121
- export class Button extends React.Component<
122
- Merge<React.HTMLProps<HTMLElement>, ButtonProps>
123
- > {}
124
-
125
- export default Button;
@@ -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;