@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
@@ -1,202 +0,0 @@
1
- // Type definitions for ui/Slider
2
-
3
- import * as React from "react";
4
- import { ChangeableProps as ui_Changeable_ChangeableProps } from "@enact/ui/Changeable";
5
- import { TouchableProps as ui_Touchable_TouchableProps } from "@enact/ui/Touchable";
6
-
7
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
8
- type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
9
-
10
- export interface KnobProps {
11
- /**
12
- * The orientation of the slider, either `"horizontal"` or `"vertical"` .
13
- */
14
- orientation?: string;
15
- /**
16
- * A number between 0 and 1 representing the proportion of the `value` in terms of `min`
17
- and `max` props of the slider.
18
- */
19
- proportion?: boolean;
20
- /**
21
- * Adds a tooltip to the knob using the provided component.
22
- *
23
- * The following props are forwarded to the tooltip:
24
- * * `children` - The `value` prop from the slider
25
- * * `orientation` - The value of the `orientation` prop from the slider
26
- * * `proportion` - The value of the `proportion` prop from the knob
27
- *
28
- * This prop accepts either a Component (e.g. `MyTooltip` } which will be instantiated with
29
- the above props or a component instance (e.g. `<MyTooltip customProp="value" />` ) which
30
- will have its props merged with the above props.
31
- */
32
- tooltipComponent?: Function | JSX.Element;
33
- /**
34
- * The value of the slider.
35
- */
36
- value?: number;
37
- }
38
- /**
39
- * An unstyled, knob component to be used with a `Slider` .
40
- */
41
-
42
- export class Knob extends React.Component<
43
- Merge<React.HTMLProps<HTMLElement>, KnobProps>
44
- > {}
45
-
46
- export interface SliderBaseProps {
47
- /**
48
- * The component used to render the progress bar within the slider.
49
- *
50
- * The provided component will receive the following props from `Slider`
51
- * * backgroundProgress - The value of `backgroundProgress`
52
- * * orientation - The value of `orientation`
53
- * * progress - The `value` as a proportion between `min` and `max`
54
- * * progressAnchor - The value of `progressAnchor`
55
- *
56
- * This prop accepts either a Component (e.g. `MyProgress` } which will be instantiated with
57
- the above props or a component instance (e.g. `<MyProgress customProp="value" />` ) which
58
- will have its props merged with the above props.
59
- */
60
- progressBarComponent: React.ComponentType | JSX.Element;
61
- /**
62
- * Background progress, as a proportion between `0` and `1` .
63
- */
64
- backgroundProgress?: number;
65
- /**
66
- * Called with a reference to the root component.
67
- *
68
- * When using , the `ref` prop is forwarded to this component
69
- as `componentRef` .
70
- */
71
- componentRef?: object | Function;
72
- /**
73
- * Customizes the component by mapping the supplied collection of CSS class names to the
74
- corresponding internal elements and states of this component.
75
- *
76
- * The following classes are supported:
77
- * * `slider` - The root component class
78
- * * `knob` - The knob node
79
- * * `horizontal` - Applied when `orientation` prop is `"horizontal"``
80
- * * `pressed` - Applied when `pressed` prop is `true`
81
- * * `noFill` - Applied when `noFill` prop is `true`
82
- * * `vertical` - Applied when `orientation` prop is `"vertical"`
83
- */
84
- css?: object;
85
- /**
86
- * Disables component and does not generate events.
87
- */
88
- disabled?: boolean;
89
- /**
90
- * Defines a custom knob component for the slider.
91
- *
92
- * By default, Slider will use its own implementation, .
93
- *
94
- * The following props are forwarded to the knob:
95
- * * `className` - A `knob` class applied by the slider
96
- * * `disabled` - The value of `disabled`
97
- * * `orientation` - The value of `orientation`
98
- * * `proportion` - The `value` as a proportion between `min` and `max`
99
- * * `tooltipComponent` - The value of `tooltipComponent`
100
- * * `value` - The value of `value`
101
- *
102
- * This prop accepts either a Component (e.g. `MyKnob` } which will be instantiated with
103
- the above props or a component instance (e.g. `<MyKnob customProp="value" />` ) which
104
- will have its props merged with the above props.
105
- */
106
- knobComponent?: React.ComponentType | JSX.Element;
107
- /**
108
- * The maximum value of the slider.
109
- *
110
- * The range between `min` and `max` should be evenly divisible by
111
- .
112
- */
113
- max?: number;
114
- /**
115
- * The minimum value of the slider.
116
- *
117
- * The range between `min` and `max` should be evenly divisible by
118
- .
119
- */
120
- min?: number;
121
- /**
122
- * Applies the style where the slider bar does not display filled.
123
- */
124
- noFill?: boolean;
125
- /**
126
- * The orientation of the slider.
127
- *
128
- * Allowed values include:
129
- * * `'horizontal'` - A left and right orientation
130
- * * `'vertical'` - An up and down orientation
131
- */
132
- orientation?: string;
133
- /**
134
- * Applies a pressed visual effect.
135
- */
136
- pressed?: boolean;
137
- /**
138
- * Sets the point, as a proportion between 0 and 1, from which the slider is filled.
139
- *
140
- * Applies to both the slider's `value` and `backgroundProgress` . In both cases,
141
- setting the value of `progressAnchor` will cause the slider to fill from that point
142
- down, when `value` or `backgroundProgress` is proportionally less than the anchor, or up,
143
- when `value` or `backgroundProgress` is proportionally greater than the anchor, rather
144
- than always from the start of the slider.
145
- */
146
- progressAnchor?: number;
147
- /**
148
- * The amount to increment or decrement the value.
149
- *
150
- * It must evenly divide into the range designated by `min` and `max` .
151
- */
152
- step?: number;
153
- /**
154
- * Adds a tooltip to the slider using the provided component.
155
- *
156
- * The following props are forwarded to the tooltip:
157
- * * `children` - The `value` prop from the slider
158
- * * `orientation` - The value of the `orientation` prop from the slider
159
- * * `proportion` - The `value` as a proportion between `min` and `max`
160
- *
161
- * This prop accepts either a Component (e.g. `MyTooltip` } which will be instantiated with
162
- the above props or a component instance (e.g. `<MyTooltip customProp="value" />` ) which
163
- will have its props merged with the above props.
164
- */
165
- tooltipComponent?: React.ComponentType | JSX.Element;
166
- /**
167
- * The value of the slider.
168
- *
169
- * Defaults to the value of `min` .
170
- */
171
- value?: number;
172
- }
173
- /**
174
- * An unstyled, sliding range-selection component.
175
- */
176
-
177
- export class SliderBase extends React.Component<
178
- Merge<React.HTMLProps<HTMLElement>, SliderBaseProps>
179
- > {}
180
-
181
- export interface SliderDecoratorProps
182
- extends Merge<ui_Changeable_ChangeableProps, ui_Touchable_TouchableProps> {}
183
- export function SliderDecorator<P>(
184
- Component: React.ComponentType<P> | string
185
- ): React.ComponentType<P & SliderDecoratorProps>;
186
-
187
- export interface SliderProps
188
- extends Omit<Merge<SliderBaseProps, SliderDecoratorProps>, "componentRef"> {
189
- /**
190
- * Called when the value is changed.
191
- */
192
- onChange?: Function;
193
- }
194
- /**
195
- * A minimally-styled slider component with touch and drag support.
196
- */
197
-
198
- export class Slider extends React.Component<
199
- Merge<React.HTMLProps<HTMLElement>, SliderProps>
200
- > {}
201
-
202
- export default Slider;
@@ -1,118 +0,0 @@
1
- // Type definitions for ui/SlotItem
2
-
3
- import * as React from "react";
4
- import { SlottableProps as ui_Slottable_SlottableProps } from "@enact/ui/Slottable";
5
- import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
6
-
7
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
8
- type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
9
-
10
- export interface SlotItemBaseProps {
11
- /**
12
- * The type of component to use to render the item.
13
- *
14
- * This component will receive the `inline` prop and any additional unhandled props provided
15
- to `SlotItem` . A derivative of is recommended.
16
- */
17
- component: React.ComponentType;
18
- /**
19
- * Controls the visibility state of the slots.
20
- *
21
- * One, both, or neither slot can be shown. Choosing `'after'` will leave `slotBefore`
22
- visible at all times; only `slotAfter` will have its visibility toggled. Valid values
23
- are `'before'` , `'after'` and `'both'` . Omitting the property will result in
24
- no-auto-hiding for either slot so they will both be present.
25
- *
26
- * In order for `autoHide` to have a visual affect, the `hidden` class must be tied to
27
- another condition such as focus.
28
- * ```
29
- .slot.hidden:not(:focus) {
30
- display: none;
31
- }
32
- ```
33
- */
34
- autoHide?: boolean;
35
- /**
36
- * Called with a reference to the root component.
37
- *
38
- * When using , the `ref` prop is forwarded to this component
39
- as `componentRef` .
40
- */
41
- componentRef?: object | Function;
42
- /**
43
- * Customizes the component by mapping the supplied collection of CSS class names to the
44
- corresponding internal elements and states of this component.
45
- *
46
- * The following classes are supported:
47
- * * `slotItem` - The root class name
48
- * * `slot` - Applied to both slots
49
- * * `after` - Applied to the slot that falls after the content
50
- * * `before` - Applied to the slot that falls before the content
51
- * * `hidden` - Applied to a slot when that slot is supposed to be hidden, according to
52
- `autoHide` prop
53
- */
54
- css?: object;
55
- /**
56
- * Applies inline styling to the component.
57
- */
58
- inline?: boolean;
59
- /**
60
- * The layout technique for `SlotItem` .
61
- *
62
- * `"flex"` is applied as a default and gives basic flex support to the wrapping elements.
63
- This may be set to `null` to define your own layout method.
64
- */
65
- layout?: string;
66
- /**
67
- * Nodes to be inserted after `children` and hidden using `autoHide` .
68
- *
69
- * If nothing is specified, nothing, not even an empty container, is rendered in this place.
70
- */
71
- slotAfter?: React.ReactNode;
72
- /**
73
- * Nodes to be inserted before `children` and hidden using `autoHide` .
74
- *
75
- * If nothing is specified, nothing, not even an empty container, is rendered in this place.
76
- */
77
- slotBefore?: React.ReactNode;
78
- }
79
- /**
80
- * A ui-styled `SlotItem` without any behavior.
81
- */
82
-
83
- export class SlotItemBase extends React.Component<
84
- Merge<React.HTMLProps<HTMLElement>, SlotItemBaseProps>
85
- > {}
86
-
87
- export interface SlotItemDecoratorProps
88
- extends Merge<ui_Slottable_SlottableProps, ui_ForwardRef_ForwardRefProps> {}
89
- export function SlotItemDecorator<P>(
90
- Component: React.ComponentType<P> | string
91
- ): React.ComponentType<P & SlotItemDecoratorProps>;
92
-
93
- export interface SlotItemProps
94
- extends Omit<
95
- Merge<SlotItemBaseProps, SlotItemDecoratorProps>,
96
- "componentRef"
97
- > {}
98
- /**
99
- * A ui-styled item with built-in support for slots.
100
- *
101
- * Example:
102
- * ```
103
- <SlotItem component={Item} autoHide="both">
104
- <slotBefore>
105
- <Icon>flag</Icon>
106
- <Icon>star</Icon>
107
- </slotBefore>
108
- An Item that will show some icons slotBefore and slotAfter this text when spotted
109
- <Icon slot="slotAfter">trash</Icon>
110
- </SlotItem>
111
- ```
112
- */
113
-
114
- export class SlotItem extends React.Component<
115
- Merge<React.HTMLProps<HTMLElement>, SlotItemProps>
116
- > {}
117
-
118
- export default SlotItem;
@@ -1,22 +0,0 @@
1
- // Type definitions for ui/Slottable
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 SlottableConfig extends Object {
7
- /**
8
- * Array of slot names which will be extracted from `children` and distributed to props.
9
- */
10
- slots?: string[];
11
- }
12
- export interface SlottableProps {}
13
- export function Slottable<P>(
14
- config: SlottableConfig,
15
- Component: React.ComponentType<P> | string
16
- ): React.ComponentType<P & SlottableProps>;
17
-
18
- export function Slottable<P>(
19
- Component: React.ComponentType<P> | string
20
- ): React.ComponentType<P & SlottableProps>;
21
-
22
- export default Slottable;
@@ -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 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:
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
- 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 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;