@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.
Files changed (222) hide show
  1. package/AnnounceDecorator/Announce.js +1 -40
  2. package/AnnounceDecorator/AnnounceDecorator.js +3 -21
  3. package/AnnounceDecorator/tests/Announce-specs.js +2 -7
  4. package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
  5. package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
  6. package/AnnounceDecorator/useAnnounce.js +0 -6
  7. package/BodyText/BodyText.js +8 -28
  8. package/BodyText/tests/BodyText-specs.js +0 -19
  9. package/Button/Button.js +33 -63
  10. package/Button/tests/Button-specs.js +0 -26
  11. package/CHANGELOG.md +45 -0
  12. package/Cancelable/Cancelable.js +8 -47
  13. package/Cancelable/cancelHandler.js +5 -12
  14. package/Cancelable/modalHandler.js +3 -11
  15. package/Cancelable/tests/Cancelable-specs.js +3 -57
  16. package/Changeable/Changeable.js +2 -34
  17. package/Changeable/tests/Changeable-specs.js +20 -66
  18. package/ComponentOverride/ComponentOverride.js +1 -13
  19. package/FloatingLayer/FloatingLayer.js +17 -73
  20. package/FloatingLayer/FloatingLayerContainer.js +0 -15
  21. package/FloatingLayer/FloatingLayerDecorator.js +4 -17
  22. package/FloatingLayer/Scrim.js +9 -53
  23. package/FloatingLayer/index.js +0 -4
  24. package/FloatingLayer/package.json +3 -0
  25. package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
  26. package/FloatingLayer/tests/Scrim-specs.js +0 -9
  27. package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
  28. package/FloatingLayer/useFloatingLayer.js +3 -14
  29. package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
  30. package/ForwardRef/ForwardRef.js +1 -10
  31. package/GridListImageItem/GridListImageItem.js +18 -51
  32. package/Group/Group.js +5 -36
  33. package/Group/GroupItem.js +16 -33
  34. package/Group/tests/Group-specs.js +0 -32
  35. package/Heading/Heading.js +8 -36
  36. package/Heading/tests/Heading-specs.js +81 -14
  37. package/Icon/Icon.js +19 -53
  38. package/Icon/tests/Icon-specs.js +0 -22
  39. package/IconButton/IconButton.js +24 -57
  40. package/IconButton/tests/IconButton-specs.js +0 -7
  41. package/Image/Image.js +17 -46
  42. package/Image/tests/Image-specs.js +0 -14
  43. package/ImageItem/ImageItem.js +18 -47
  44. package/ImageItem/tests/ImageItem-specs.js +0 -25
  45. package/Item/Item.js +9 -33
  46. package/Item/tests/Item-specs.js +0 -24
  47. package/LabeledIcon/LabeledIcon.js +22 -53
  48. package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
  49. package/Layout/Cell.js +18 -44
  50. package/Layout/Layout.js +23 -46
  51. package/Layout/tests/Layout-specs.js +10 -39
  52. package/Marquee/MarqueeBase.js +29 -63
  53. package/Marquee/MarqueeController.js +11 -72
  54. package/Marquee/MarqueeDecorator.js +70 -196
  55. package/Marquee/index.js +1 -5
  56. package/Marquee/tests/Marquee-specs.js +295 -87
  57. package/Measurable/Measurable.js +12 -34
  58. package/Measurable/tests/Measurable-specs.js +115 -0
  59. package/Media/Media.js +15 -65
  60. package/Media/tests/Media-specs.js +168 -0
  61. package/Placeholder/PlaceholderControllerDecorator.js +7 -43
  62. package/Placeholder/PlaceholderDecorator.js +7 -38
  63. package/Placeholder/index.js +1 -5
  64. package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
  65. package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
  66. package/ProgressBar/ProgressBar.js +14 -45
  67. package/ProgressBar/tests/ProgressBar-specs.js +0 -17
  68. package/RadioDecorator/RadioControllerDecorator.js +7 -29
  69. package/RadioDecorator/RadioDecorator.js +9 -42
  70. package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
  71. package/Repeater/Repeater.js +9 -33
  72. package/Repeater/tests/Repeater-specs.js +0 -38
  73. package/Resizable/Resizable.js +9 -37
  74. package/Resizable/tests/Resizable-specs.js +34 -0
  75. package/Routable/Link.js +11 -47
  76. package/Routable/Routable.js +12 -35
  77. package/Routable/Route.js +0 -6
  78. package/Routable/Router.js +15 -58
  79. package/Routable/tests/Routable-specs.js +7 -33
  80. package/Routable/tests/Router-specs.js +18 -44
  81. package/Routable/useLink.js +4 -8
  82. package/Routable/util.js +18 -24
  83. package/Scrollable/ScrollAnimator.js +49 -65
  84. package/Scrollable/ScrollThumb.js +2 -13
  85. package/Scrollable/Scrollable.js +180 -387
  86. package/Scrollable/ScrollableNative.js +189 -392
  87. package/Scrollable/Scrollbar.js +30 -102
  88. package/Scroller/Scroller.js +15 -39
  89. package/Scroller/ScrollerBasic.js +34 -89
  90. package/Scroller/UiScrollerBase.js +37 -84
  91. package/Scroller/tests/Scroller-specs.js +56 -0
  92. package/Skinnable/Skinnable.js +11 -38
  93. package/Skinnable/tests/Skinnable-specs.js +3 -74
  94. package/Skinnable/tests/useSkins-specs.js +1 -13
  95. package/Skinnable/tests/util-specs.js +0 -14
  96. package/Skinnable/useSkins.js +8 -15
  97. package/Skinnable/util.js +9 -20
  98. package/Slider/Knob.js +5 -24
  99. package/Slider/PositionDecorator.js +16 -54
  100. package/Slider/Slider.js +29 -67
  101. package/Slider/tests/Slider-specs.js +94 -7
  102. package/Slider/utils.js +0 -2
  103. package/SlotItem/SlotItem.js +23 -45
  104. package/SlotItem/tests/SlotItem-specs.js +0 -5
  105. package/Slottable/Slottable.js +4 -12
  106. package/Slottable/tests/Slottable-specs.js +19 -46
  107. package/Slottable/tests/useSlots-specs.js +27 -65
  108. package/Slottable/useSlots.js +8 -33
  109. package/Spinner/Spinner.js +16 -43
  110. package/Spinner/tests/Spinner-specs.js +0 -15
  111. package/ToggleIcon/ToggleIcon.js +10 -36
  112. package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
  113. package/ToggleItem/ToggleItem.js +24 -57
  114. package/ToggleItem/tests/ToggleItem-specs.js +0 -30
  115. package/Toggleable/Toggle.js +1 -15
  116. package/Toggleable/Toggleable.js +12 -45
  117. package/Toggleable/tests/Toggleable-specs.js +28 -96
  118. package/Toggleable/useToggle.js +3 -19
  119. package/Touchable/ClickAllow.js +5 -14
  120. package/Touchable/Drag.js +16 -54
  121. package/Touchable/Flick.js +11 -42
  122. package/Touchable/Hold.js +21 -68
  123. package/Touchable/Pinch.js +185 -0
  124. package/Touchable/Touch.js +71 -76
  125. package/Touchable/Touchable.js +95 -75
  126. package/Touchable/config.js +27 -24
  127. package/Touchable/tests/Touchable-specs.js +360 -119
  128. package/Touchable/tests/useTouch-specs.js +6 -80
  129. package/Touchable/useTouch.js +57 -65
  130. package/Transition/Transition.js +37 -118
  131. package/Transition/tests/Transition-specs.js +20 -60
  132. package/ViewManager/Arranger.js +10 -22
  133. package/ViewManager/TransitionGroup.js +32 -107
  134. package/ViewManager/View.js +35 -91
  135. package/ViewManager/ViewManager.js +20 -84
  136. package/ViewManager/tests/View-specs.js +0 -17
  137. package/ViewManager/tests/ViewManager-specs.js +236 -305
  138. package/ViewManager/tests/test-utils.js +0 -8
  139. package/VirtualList/UiVirtualListBase.js +265 -409
  140. package/VirtualList/VirtualList.js +29 -69
  141. package/VirtualList/VirtualListBase.js +0 -3
  142. package/VirtualList/VirtualListBasic.js +273 -431
  143. package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
  144. package/VirtualList/tests/VirtualGridList-specs.js +614 -0
  145. package/VirtualList/tests/VirtualList-native-specs.js +152 -0
  146. package/VirtualList/tests/VirtualList-specs.js +423 -95
  147. package/internal/IdProvider/IdProvider.js +7 -21
  148. package/internal/IdProvider/Provider.js +4 -17
  149. package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
  150. package/internal/IdProvider/tests/useId-specs.js +6 -20
  151. package/internal/IdProvider/useId.js +0 -6
  152. package/internal/Pure/Pure.js +3 -30
  153. package/internal/Pure/tests/Pure-specs.js +88 -0
  154. package/internal/localized-fonts/localized-fonts.js +33 -62
  155. package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
  156. package/internal/selection/selection.js +1 -6
  157. package/internal/selection/tests/selection-specs.js +6 -4
  158. package/internal/validators/tests/validators-specs.js +80 -0
  159. package/internal/validators/validators.js +14 -34
  160. package/package.json +9 -3
  161. package/resolution/ResolutionDecorator.js +4 -40
  162. package/resolution/index.js +0 -7
  163. package/resolution/resolution.js +42 -80
  164. package/resolution/tests/ResolutionDecorator-specs.js +4 -11
  165. package/resolution/tests/resolution-specs.js +2 -2
  166. package/useControlledState/tests/useControlledState-specs.js +15 -46
  167. package/useControlledState/useControlledState.js +11 -22
  168. package/useScroll/ScrollAnimator.js +49 -65
  169. package/useScroll/Scrollbar.js +22 -58
  170. package/useScroll/ScrollbarTrack.js +3 -19
  171. package/useScroll/useScroll.js +267 -454
  172. package/useScroll/utilDOM.js +8 -14
  173. package/useScroll/utilEvent.js +0 -4
  174. package/AnnounceDecorator/AnnounceDecorator.d.ts +0 -64
  175. package/BodyText/BodyText.d.ts +0 -66
  176. package/Button/Button.d.ts +0 -125
  177. package/Cancelable/Cancelable.d.ts +0 -64
  178. package/Changeable/Changeable.d.ts +0 -54
  179. package/ComponentOverride/ComponentOverride.d.ts +0 -52
  180. package/ForwardRef/ForwardRef.d.ts +0 -22
  181. package/GridListImageItem/GridListImageItem.d.ts +0 -85
  182. package/Group/Group.d.ts +0 -107
  183. package/Heading/Heading.d.ts +0 -90
  184. package/Icon/Icon.d.ts +0 -88
  185. package/IconButton/IconButton.d.ts +0 -115
  186. package/Image/Image.d.ts +0 -113
  187. package/ImageItem/ImageItem.d.ts +0 -83
  188. package/Item/Item.d.ts +0 -64
  189. package/LabeledIcon/LabeledIcon.d.ts +0 -130
  190. package/Layout/Layout.d.ts +0 -247
  191. package/Marquee/index.d.ts +0 -258
  192. package/Measurable/Measurable.d.ts +0 -26
  193. package/Media/Media.d.ts +0 -99
  194. package/Placeholder/index.d.ts +0 -53
  195. package/ProgressBar/ProgressBar.d.ts +0 -92
  196. package/RadioDecorator/RadioDecorator.d.ts +0 -35
  197. package/Repeater/Repeater.d.ts +0 -83
  198. package/Resizable/Resizable.d.ts +0 -31
  199. package/Routable/Routable.d.ts +0 -148
  200. package/Scrollable/Scrollable.d.ts +0 -0
  201. package/Scroller/Scroller.d.ts +0 -276
  202. package/Skinnable/Skinnable.d.ts +0 -94
  203. package/Slider/Slider.d.ts +0 -202
  204. package/SlotItem/SlotItem.d.ts +0 -118
  205. package/Slottable/Slottable.d.ts +0 -22
  206. package/Spinner/Spinner.d.ts +0 -95
  207. package/ToggleIcon/ToggleIcon.d.ts +0 -90
  208. package/ToggleItem/ToggleItem.d.ts +0 -134
  209. package/Toggleable/Toggleable.d.ts +0 -103
  210. package/Touchable/Touchable.d.ts +0 -175
  211. package/Transition/Transition.d.ts +0 -196
  212. package/ViewManager/ViewManager.d.ts +0 -191
  213. package/VirtualList/VirtualList.d.ts +0 -530
  214. package/index.d.ts +0 -0
  215. package/internal/IdProvider/IdProvider.d.ts +0 -0
  216. package/internal/Pure/Pure.d.ts +0 -0
  217. package/internal/localized-fonts/localized-fonts.d.ts +0 -53
  218. package/internal/selection/selection.d.ts +0 -0
  219. package/internal/validators/validators.d.ts +0 -0
  220. package/resolution/index.d.ts +0 -187
  221. package/useControlledState/useControlledState.d.ts +0 -0
  222. package/useScroll/useScroll.d.ts +0 -0
package/Media/Media.d.ts DELETED
@@ -1,99 +0,0 @@
1
- // Type definitions for ui/Media
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
- /**
9
- * Generates a key representing the source node or nodes provided
10
- *
11
- * Example:
12
- * ```
13
- getKeyFromSource('path/file.mp4'); // 'path/file.mp4'
14
- getKeyFromSource(
15
- <source src="path/file.mp4" type="video/mp4" />
16
- ); // 'path/file.mp4'
17
- getKeyFromSource([
18
- <source src="path/file.mp4" type="video/mp4" />,
19
- <source src="path/file.ogg" type="video/ogg" />,
20
- ]); // 'path/file.mp4+path/file.ogg'
21
- ```
22
- */
23
- export function getKeyFromSource(
24
- source: string | JSX.Element | JSX.Element[]
25
- ): string;
26
- /**
27
- * Maps standard media event `type` values to React-style callback prop names
28
- *
29
- * See
30
- * ```
31
- {
32
- abort : 'onAbort',
33
- canplay : 'onCanPlay',
34
- canplaythrough : 'onCanPlayThrough',
35
- durationchange : 'onDurationChange',
36
- emptied : 'onEmptied',
37
- encrypted : 'onEncrypted',
38
- ended : 'onEnded',
39
- error : 'onError',
40
- loadeddata : 'onLoadedData',
41
- loadedmetadata : 'onLoadedMetadata',
42
- loadstart : 'onLoadStart',
43
- pause : 'onPause',
44
- play : 'onPlay',
45
- playing : 'onPlaying',
46
- progress : 'onProgress',
47
- ratechange : 'onRateChange',
48
- seeked : 'onSeeked',
49
- seeking : 'onSeeking',
50
- stalled : 'onStalled',
51
- suspend : 'onSuspend',
52
- timeupdate : 'onTimeUpdate',
53
- volumechange : 'onVolumeChange',
54
- waiting : 'onWaiting'
55
- }
56
- ```
57
- */
58
- export interface handledMediaEventsMap {}
59
- export interface MediaProps {
60
- /**
61
- * A type of media component.
62
- */
63
- mediaComponent: string | React.ComponentType;
64
- /**
65
- * An event map object for custom media events.
66
- *
67
- * List custom events that aren't standard to React. These will be directly added to the media
68
- element and props matching their name will be executed as callback functions when the event fires.
69
- *
70
- * Example:
71
- * ```
72
- {'umsmediainfo': 'onUMSMediaInfo'} // `onUMSMediaInfo` prop function will execute when the `umsmediainfo` event happens
73
- ```
74
- */
75
- customMediaEventsMap?: object;
76
- /**
77
- * A event map object for media events.
78
- */
79
- mediaEventsMap?: object;
80
- /**
81
- * A function to be run when media updates.
82
- */
83
- onUpdate?: Function;
84
- /**
85
- * Media sources passed as children to `mediaComponent`
86
- *
87
- * See:
88
- */
89
- source?: any;
90
- }
91
- /**
92
- * A component representation of HTMLMediaElement.
93
- */
94
-
95
- export class Media extends React.Component<
96
- Merge<React.HTMLProps<HTMLElement>, MediaProps>
97
- > {}
98
-
99
- export default Media;
@@ -1,53 +0,0 @@
1
- // Type definitions for ui/Placeholder
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 PlaceholderDecoratorConfig extends Object {
7
- /**
8
- * Configures the style of the placeholder element
9
- */
10
- style?: object;
11
- /**
12
- * The component to use as a placeholder.
13
- */
14
- placeholderComponent?: string;
15
- }
16
- export interface PlaceholderDecoratorProps {}
17
- export function PlaceholderDecorator<P>(
18
- config: PlaceholderDecoratorConfig,
19
- Component: React.ComponentType<P> | string
20
- ): React.ComponentType<P & PlaceholderDecoratorProps>;
21
-
22
- export function PlaceholderDecorator<P>(
23
- Component: React.ComponentType<P> | string
24
- ): React.ComponentType<P & PlaceholderDecoratorProps>;
25
-
26
- export interface PlaceholderControllerDecoratorConfig extends Object {
27
- /**
28
- * The bounds of the container represented by an object with `height` and `width` members.
29
- *
30
- * If the container is a static size, this can be specified at design-time to avoid calculating
31
- the bounds at run-time (the default behavior).
32
- */
33
- bounds?: object;
34
- /**
35
- * Event callback which indicates that the viewport has scrolled and placeholders should be
36
- notified.
37
- */
38
- notify?: string;
39
- /**
40
- * Multiplier used with the wrapped component's height and width to determine the threshold for
41
- replacing the placeholder component with the true component.
42
- */
43
- thresholdFactor?: number;
44
- }
45
- export interface PlaceholderControllerDecoratorProps {}
46
- export function PlaceholderControllerDecorator<P>(
47
- config: PlaceholderControllerDecoratorConfig,
48
- Component: React.ComponentType<P> | string
49
- ): React.ComponentType<P & PlaceholderControllerDecoratorProps>;
50
-
51
- export function PlaceholderControllerDecorator<P>(
52
- Component: React.ComponentType<P> | string
53
- ): React.ComponentType<P & PlaceholderControllerDecoratorProps>;
@@ -1,92 +0,0 @@
1
- // Type definitions for ui/ProgressBar
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 ProgressBarBaseProps {
10
- /**
11
- * The proportion of the loaded portion of the progress bar.
12
- * * Valid values are between `0` and `1` .
13
- */
14
- backgroundProgress?: number;
15
- /**
16
- * The contents to be displayed with progress bar.
17
- */
18
- children?: React.ReactNode;
19
- /**
20
- * Called with a reference to the root component.
21
- *
22
- * When using , the `ref` prop is forwarded to this
23
- component as `componentRef` .
24
- */
25
- componentRef?: object | Function;
26
- /**
27
- * Customizes the component by mapping the supplied collection of CSS class names to the
28
- corresponding internal elements and states of this component.
29
- *
30
- * The following classes are supported:
31
- * * `progressBar` - The root component class
32
- * * `bar` - The background node (the empty part of the progressBar)
33
- * * `fill` - The foreground of the progress bar ( `progress` )
34
- * * `load` - The `backgroundProgress` node
35
- * * `horizontal` - Applied when `orientation` is `'horizontal'`
36
- * * `vertical` - Applied when `orientation` is `'vertical'`
37
- * * `radial` - Applied when `orientation` is `'radial'`
38
- */
39
- css?: object;
40
- /**
41
- * Sets the orientation of the slider.
42
- *
43
- * Allowed values include:
44
- * * `'horizontal'` - A left and right orientation
45
- * * `'vertical'` - An up and down orientation
46
- * * `'radial'` - A circular orientation
47
- */
48
- orientation?: string;
49
- /**
50
- * The proportion of the filled portion of the progress bar.
51
- * * Valid values are between `0` and `1` .
52
- */
53
- progress?: number;
54
- /**
55
- * Sets the point, as a proportion between 0 and 1, from which the progress bar is filled.
56
- *
57
- * Applies to both the progress bar's `value` and `backgroundProgress` . In both cases,
58
- setting the value of `progressAnchor` will cause the progress bar to fill from that point
59
- down, when `value` or `backgroundProgress` is proportionally less than the anchor, or up,
60
- when `value` or `backgroundProgress` is proportionally greater than the anchor, rather
61
- than always from the start of the progress bar.
62
- */
63
- progressAnchor?: number;
64
- }
65
- /**
66
- * An unstyled progress bar component that can be customized by a theme or application.
67
- */
68
-
69
- export class ProgressBarBase extends React.Component<
70
- Merge<React.HTMLProps<HTMLElement>, ProgressBarBaseProps>
71
- > {}
72
-
73
- export interface ProgressBarDecoratorProps
74
- extends ui_ForwardRef_ForwardRefProps {}
75
- export function ProgressBarDecorator<P>(
76
- Component: React.ComponentType<P> | string
77
- ): React.ComponentType<P & ProgressBarDecoratorProps>;
78
-
79
- export interface ProgressBarProps
80
- extends Omit<
81
- Merge<ProgressBarBaseProps, ProgressBarDecoratorProps>,
82
- "componentRef"
83
- > {}
84
- /**
85
- * An unstyled progress bar component that can be customized by a theme or application.
86
- */
87
-
88
- export class ProgressBar extends React.Component<
89
- Merge<React.HTMLProps<HTMLElement>, ProgressBarProps>
90
- > {}
91
-
92
- export default ProgressBar;
@@ -1,35 +0,0 @@
1
- // Type definitions for ui/RadioDecorator
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 RadioControllerDecoratorProps {}
7
- export function RadioControllerDecorator<P>(
8
- Component: React.ComponentType<P> | string
9
- ): React.ComponentType<P & RadioControllerDecoratorProps>;
10
-
11
- export interface RadioDecoratorConfig extends Object {
12
- /**
13
- * The event indicating the wrapped component is activated
14
- */
15
- activate?: string;
16
- /**
17
- * The event indicating the wrapped component is deactivated
18
- */
19
- deactivate?: string;
20
- /**
21
- * The name of a boolean prop that activates the wrapped component when it is true.
22
- */
23
- prop?: string;
24
- }
25
- export interface RadioDecoratorProps {}
26
- export function RadioDecorator<P>(
27
- config: RadioDecoratorConfig,
28
- Component: React.ComponentType<P> | string
29
- ): React.ComponentType<P & RadioDecoratorProps>;
30
-
31
- export function RadioDecorator<P>(
32
- Component: React.ComponentType<P> | string
33
- ): React.ComponentType<P & RadioDecoratorProps>;
34
-
35
- export default RadioDecorator;
@@ -1,83 +0,0 @@
1
- // Type definitions for ui/Repeater
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 RepeaterBaseProps {
10
- /**
11
- * Component type to repeat.
12
- *
13
- * This can be a React component or a string describing a DOM node (e.g. `'div'` ).
14
- */
15
- childComponent: string | React.ComponentType;
16
- /**
17
- * An array of data to be mapped onto the `childComponent` .
18
- *
19
- * This supports two data types. If an array of strings is provided, the strings will be used
20
- in the generated `childComponent` as the readable text. If an array of objects is provided,
21
- each object will be spread onto the generated `childComponent` with no interpretation.
22
- You'll be responsible for setting properties like `disabled` , `className` , and setting the
23
- text content using the `children` key.
24
- *
25
- * NOTE : When an array of objects is provided, make sure a unique `key` is assigned to each
26
- *
27
- * data. See for more information.
28
- */
29
- children: string[] | { key: number | string; [propName: string]: any }[];
30
- /**
31
- * The property on each `childComponent` that receives the data in `children` .
32
- */
33
- childProp?: string;
34
- /**
35
- * Component type to wrap around all of the repeated elements.
36
- *
37
- * This can be a string describing a DOM node or React component (e.g. `'div'` or `Layout` ).
38
- */
39
- component?: string | React.ComponentType;
40
- /**
41
- * Called with a reference to the root component.
42
- *
43
- * When using , the `ref` prop is forwarded to this component
44
- as `componentRef` .
45
- */
46
- componentRef?: object | Function;
47
- /**
48
- * The property on each `childComponent` that receives the index of the item in the `Repeater` .
49
- */
50
- indexProp?: string;
51
- /**
52
- * An object containing properties to be passed to each child.
53
- */
54
- itemProps?: object;
55
- }
56
- /**
57
- * A stateless component that stamps out copies of `childComponent` , without
58
- applied.
59
- */
60
-
61
- export class RepeaterBase extends React.Component<
62
- Merge<React.HTMLProps<HTMLElement>, RepeaterBaseProps>
63
- > {}
64
-
65
- export interface RepeaterDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
66
- export function RepeaterDecorator<P>(
67
- Component: React.ComponentType<P> | string
68
- ): React.ComponentType<P & RepeaterDecoratorProps>;
69
-
70
- export interface RepeaterProps
71
- extends Omit<
72
- Merge<RepeaterBaseProps, RepeaterDecoratorProps>,
73
- "componentRef"
74
- > {}
75
- /**
76
- * A stateless component that stamps out copies of `childComponent` .
77
- */
78
-
79
- export class Repeater extends React.Component<
80
- Merge<React.HTMLProps<HTMLElement>, RepeaterProps>
81
- > {}
82
-
83
- export default Repeater;
@@ -1,31 +0,0 @@
1
- // Type definitions for ui/Resizable
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 ResizableConfig extends Object {
7
- /**
8
- * A handler to process the `resize` event.
9
- *
10
- * It should return a truthy value if the event should trigger a resize.
11
- */
12
- filter?: Function;
13
- /**
14
- * The name of the event on the wrapped component to listen to for size changes.
15
- *
16
- * This event name will be passed to the wrapped component and will also be forwarded (if
17
- needed) to the parent component.
18
- */
19
- resize: string;
20
- }
21
- export interface ResizableProps {}
22
- export function Resizable<P>(
23
- config: ResizableConfig,
24
- Component: React.ComponentType<P> | string
25
- ): React.ComponentType<P & ResizableProps>;
26
-
27
- export function Resizable<P>(
28
- Component: React.ComponentType<P> | string
29
- ): React.ComponentType<P & ResizableProps>;
30
-
31
- export default Resizable;
@@ -1,148 +0,0 @@
1
- // Type definitions for ui/Routable
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 LinkBaseProps {}
9
- /**
10
- * A base component that is used to make a link.
11
- */
12
-
13
- export class LinkBase extends React.Component<
14
- Merge<React.HTMLProps<HTMLElement>, LinkBaseProps>
15
- > {}
16
-
17
- export interface RoutableConfig extends Object {
18
- /**
19
- * The event to listen to for path changes.
20
- *
21
- * This defines the actual name of the [navigate]
22
- property.
23
- */
24
- navigate: string;
25
- }
26
- export interface RoutableProps {
27
- /**
28
- * Path to the active panel.
29
- *
30
- * May either be a URI-style path ( `'/app/home/settings'` ) or an array
31
- of strings ( `['app', 'home', 'settings']` ).
32
- */
33
- path: string | string[];
34
- /**
35
- * Called when navigating.
36
- *
37
- * The event object is decorated to add `path` .
38
- *
39
- * _NOTE_ : The actual name of this property is configured in the HOC config.
40
- */
41
- navigate?: Function;
42
- }
43
- export function Routable<P>(
44
- config: RoutableConfig,
45
- Component: React.ComponentType<P> | string
46
- ): React.ComponentType<P & RoutableProps>;
47
-
48
- export function Routable<P>(
49
- Component: React.ComponentType<P> | string
50
- ): React.ComponentType<P & RoutableProps>;
51
-
52
- export interface LinkProps extends Merge<LinkBaseProps, LinkableProps> {
53
- /**
54
- * The `path` to navigate that matches the path of the container.
55
- */
56
- path: string;
57
- /**
58
- * Applies a disabled style and the control becomes non-interactive.
59
- */
60
- disabled?: boolean;
61
- }
62
- /**
63
- * A component that is used to make a link to navigate among [ `Route` ] components.
64
- *
65
- * In the following example, `Sample` would render `Main` with two Links for `About` and `FAQ` .
66
- If `About` is clicked, the content of `About` would be displayed under `Main` .
67
- *
68
- * Example:
69
- * ```
70
- const Views = Routable({navigate: 'onNavigate'}, ({children}) => <div>{children}</div>);
71
-
72
- const Main = () => (
73
- <div>
74
- <Link path="./about">About</Link>
75
- <Link path="./faq">FAQ</Link>
76
- </div>
77
- );
78
-
79
- const About = () => (<div>Greetings! We are Enact team.</div>);
80
-
81
- const Faq = () => (<div>List of FAQ</div>);
82
-
83
- const Sample = (props) => {
84
- // use 'main' for the default path
85
- const [path, nav] = useState('main');
86
- // if onNavigate is called with a new path, update the state
87
- const handleNavigate = useCallback((ev) => nav(ev.path), [nav]);
88
-
89
- return (
90
- <Views {...props} path={path} onNavigate={handleNavigate}>
91
- <Route path="main" component={Main}>
92
- <Route path="about" component={About} />
93
- <Route path="faq" component={Faq} />
94
- </Route>
95
- </Views>
96
- );
97
- };
98
- ```
99
- */
100
-
101
- export class Link extends React.Component<
102
- Merge<React.HTMLProps<HTMLElement>, LinkProps>
103
- > {}
104
-
105
- export interface RouteProps {
106
- /**
107
- * The component to render when the `path` for this Route matches the path of the
108
- container.
109
- */
110
- component: string | React.ComponentType;
111
- /**
112
- * The name of the path segment.
113
- */
114
- path: string;
115
- }
116
- /**
117
- * Used with to define the `path` segment and the
118
- `component` to render.
119
- *
120
- * `Route` elements can be nested to build multiple level paths.
121
- *
122
- * In the below example, `Panels` would render `SettingsPanel` with breadcrumbs to
123
- navigate `AppPanel` and `HomePanel` .
124
- *
125
- * Example:
126
- * ```
127
- <Panels path="/app/home/settings" onSelectBreadcrumb={this.handleNavigate}>
128
- <Route path="app" component={AppPanel}>
129
- <Route path="home" component={HomePanel}>
130
- <Route path="settings" component={SettingsPanel} />
131
- </Route>
132
- </Route>
133
- <Route path="admin" component={AdminPanel} />
134
- <Route path="help" component={HelpPanel} />
135
- </Panels>
136
- ```
137
- */
138
-
139
- export class Route extends React.Component<
140
- Merge<React.HTMLProps<HTMLElement>, RouteProps>
141
- > {}
142
-
143
- export interface LinkableProps {}
144
- export function Linkable<P>(
145
- Component: React.ComponentType<P> | string
146
- ): React.ComponentType<P & LinkableProps>;
147
-
148
- export default Routable;
File without changes