@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,52 +0,0 @@
1
- // Type definitions for ui/ComponentOverride
2
-
3
- import * as React from "react";
4
-
5
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
6
- type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
7
-
8
- export interface ComponentOverrideProps {}
9
- /**
10
- * Utility to either create or clone a component instance with the given set of props.
11
- *
12
- * `ComponentOverride` can be used to support props that either accept a type, (e.g. `Button` ) or an
13
- element (e.g. `<Button customProp="value" />` ) and return a new element which includes the
14
- remaining props specified.
15
- *
16
- * Example:
17
- * ```
18
- const LabeledIconButton = ({iconComponent, label, ...rest}) => {
19
- return (
20
- <div {...rest}>
21
- <ComponentOverride
22
- component={iconComponent}
23
- icon="house"
24
- />
25
- <span>{label}</span>
26
- </div>
27
- );
28
- };
29
-
30
- // Usage
31
-
32
- // Only the props defined by LabeledIconButton will be passed to CustomIcon
33
- <LabeledIconButton
34
- label="Home"
35
- iconComponent={CustomIcon}
36
- />
37
-
38
- // The color prop along with props defined by LabeledIconButton will be passed to CustomIcon
39
- <LabeledIconButton
40
- label="Home"
41
- iconComponent={
42
- <CustomIcon color="green" />
43
- }
44
- />
45
- ```
46
- */
47
-
48
- export class ComponentOverride extends React.Component<
49
- Merge<React.HTMLProps<HTMLElement>, ComponentOverrideProps>
50
- > {}
51
-
52
- export default ComponentOverride;
@@ -1,22 +0,0 @@
1
- // Type definitions for ui/ForwardRef
2
-
3
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
4
- type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
5
-
6
- export interface ForwardRefConfig extends Object {
7
- /**
8
- * The prop name to pass the ref callback
9
- */
10
- prop?: string;
11
- }
12
- export interface ForwardRefProps {}
13
- export function ForwardRef<P>(
14
- config: ForwardRefConfig,
15
- Component: React.ComponentType<P> | string
16
- ): React.ComponentType<P & ForwardRefProps>;
17
-
18
- export function ForwardRef<P>(
19
- Component: React.ComponentType<P> | string
20
- ): React.ComponentType<P & ForwardRefProps>;
21
-
22
- export default ForwardRef;
@@ -1,85 +0,0 @@
1
- // Type definitions for ui/GridListImageItem
2
-
3
- import * as React from "react";
4
-
5
- type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
6
- type Merge<M, N> = Omit<M, Extract<keyof M, keyof N>> & N;
7
-
8
- export interface GridListImageItemProps {
9
- /**
10
- * The primary caption to be displayed with the image.
11
- */
12
- caption?: string;
13
- /**
14
- * The component used to render the captions
15
- */
16
- captionComponent?: string | React.ComponentType;
17
- /**
18
- * Customizes the component by mapping the supplied collection of CSS class names to the
19
- corresponding internal elements and states of this component.
20
- *
21
- * The following classes are supported:
22
- * * `icon` - The icon component class for default selection overlay
23
- * * `image` - The image component class
24
- * * `selected` - Applied when `selected` prop is `true`
25
- * * `caption` - The caption component class
26
- * * `subCaption` - The subCaption component class
27
- */
28
- css?: object;
29
- /**
30
- * The component used to render the default check icon when selected.
31
- If there is custom selectionOverlay component, this icon will not be shown.
32
- */
33
- iconComponent?: React.ComponentType;
34
- /**
35
- * The component used to render the image component
36
- */
37
- imageComponent?: React.ComponentType;
38
- /**
39
- * Placeholder image used while
40
- is loaded.
41
- */
42
- placeholder?: string;
43
- /**
44
- * Applies a selected visual effect to the image, but only if `selectionOverlayShowing`
45
- is also `true` .
46
- */
47
- selected?: boolean;
48
- /**
49
- * The custom selection overlay component to render.
50
- *
51
- * A component can be a stateless functional component, `kind()` or React component.
52
- The following is an example with custom selection overlay kind.
53
- *
54
- * Example:
55
- * ```
56
- const SelectionOverlay = kind({
57
- render: () => <div>custom overlay</div>
58
- });
59
-
60
- <GridListImageItem selectionOverlay={SelectionOverlay} />
61
- ```
62
- */
63
- selectionOverlay?: Function;
64
- /**
65
- * Shows a selection overlay with a centered icon. When `selected` is true, a check mark is shown.
66
- */
67
- selectionOverlayShowing?: boolean;
68
- /**
69
- * The absolute URL path to the image.
70
- */
71
- source?: string;
72
- /**
73
- * The second caption line to be displayed with the image.
74
- */
75
- subCaption?: string;
76
- }
77
- /**
78
- * A basic grid list image item without any behavior.
79
- */
80
-
81
- export class GridListImageItem extends React.Component<
82
- Merge<React.HTMLProps<HTMLElement>, GridListImageItemProps>
83
- > {}
84
-
85
- export default GridListImageItem;
package/Group/Group.d.ts DELETED
@@ -1,107 +0,0 @@
1
- // Type definitions for ui/Group
2
-
3
- import * as React from "react";
4
- import { ForwardRefProps as ui_ForwardRef_ForwardRefProps } from "@enact/ui/ForwardRef";
5
- import { ChangeableProps as ui_Changeable_ChangeableProps } from "@enact/ui/Changeable";
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 GroupBaseProps {}
11
- /**
12
- * A stateless component that supports selection of its child items via configurable
13
- properties and events.
14
- */
15
-
16
- export class GroupBase extends React.Component<
17
- Merge<React.HTMLProps<HTMLElement>, GroupBaseProps>
18
- > {}
19
-
20
- export interface GroupProps
21
- extends Omit<Merge<GroupBaseProps, GroupDecoratorProps>, "componentRef"> {
22
- /**
23
- * Component type to repeat. This can be a React component or a string describing a DOM
24
- node (e.g. `'div'` )
25
- */
26
- childComponent: string | React.ComponentType;
27
- /**
28
- * An array of data to be mapped onto the `childComponent` .
29
- *
30
- * This supports two data types. If an array of strings is provided, the strings will be
31
- used in the generated `childComponent` as the content (i.e. passed as `children` ). If
32
- an array of objects is provided, each object will be spread onto the generated
33
- `childComponent` with no interpretation. You'll be responsible for setting properties
34
- like `disabled` , `className` , and setting the content using `children` .
35
- *
36
- * NOTE: When providing an array of objects be sure a unique `key` is assigned to each
37
- item. for more
38
- information.
39
- */
40
- children: string[] | { key: number | string; [propName: string]: any }[];
41
- /**
42
- * The property on each `childComponent` that receives the data in `children`
43
- */
44
- childProp?: string;
45
- /**
46
- * The name of the event that triggers activation.
47
- */
48
- childSelect?: string;
49
- /**
50
- * Called with a reference to the root component.
51
- *
52
- * When using , the `ref` prop is forwarded to this component
53
- as `componentRef` .
54
- */
55
- componentRef?: object | Function;
56
- /**
57
- * The property on each `childComponent` that receives the index of the item
58
- */
59
- indexProp?: string;
60
- /**
61
- * An object containing properties to be passed to each child.
62
- */
63
- itemProps?: object;
64
- /**
65
- * Callback method to be invoked when an item is activated.
66
- */
67
- onSelect?: Function;
68
- /**
69
- * Selection mode for the group
70
- * * `single` - Allows for 0 or 1 item to be selected. The selected item may be deselected.
71
- * * `radio` - Allows for 0 or 1 item to be selected. The selected item may only be
72
- deselected by selecting another item.
73
- * * `multiple` - Allows 0 to _n_ items to be selected. Each item may be selected or
74
- deselected.
75
- */
76
- select?: string;
77
- /**
78
- * The index(es) of the currently activated item.
79
- */
80
- selected?: number | Array<any>;
81
- /**
82
- * The key that will hold the value in the event passed to `onSelect` .
83
- */
84
- selectedEventProp?: string;
85
- /**
86
- * The name of the DOM property that represents the selected state.
87
- */
88
- selectedProp?: string;
89
- }
90
- /**
91
- * A component that supports selection of its child items via configurable properties and
92
- events.
93
- *
94
- * Selected item is managed by .
95
- */
96
-
97
- export class Group extends React.Component<
98
- Merge<React.HTMLProps<HTMLElement>, GroupProps>
99
- > {}
100
-
101
- export interface GroupDecoratorProps
102
- extends Merge<ui_ForwardRef_ForwardRefProps, ui_Changeable_ChangeableProps> {}
103
- export function GroupDecorator<P>(
104
- Component: React.ComponentType<P> | string
105
- ): React.ComponentType<P & GroupDecoratorProps>;
106
-
107
- export default Group;
@@ -1,90 +0,0 @@
1
- // Type definitions for ui/Heading
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 HeadingBaseProps {}
10
- /**
11
- * A labeled Heading component.
12
- */
13
-
14
- export class HeadingBase extends React.Component<
15
- Merge<React.HTMLProps<HTMLElement>, HeadingBaseProps>
16
- > {}
17
-
18
- export interface HeadingProps
19
- extends Omit<Merge<HeadingBaseProps, HeadingDecoratorProps>, "componentRef"> {
20
- /**
21
- * The text for the label of the Heading.
22
- */
23
- children?: React.ReactNode;
24
- /**
25
- * Called with a reference to the root component.
26
- *
27
- * When using , the `ref` prop is forwarded to this component
28
- as `componentRef` .
29
- */
30
- componentRef?: object | Function;
31
- /**
32
- * Customizes the component by mapping the supplied collection of CSS class names to the
33
- corresponding internal elements and states of this component.
34
- *
35
- * The following classes are supported:
36
- * * `heading` - The root component class
37
- * * `title` - Applied when `size` is set to "title"
38
- * * `subtitle` - Applied when `size` is set to "subtitle"
39
- * * `large` - Applied when `size` is set to "large"
40
- * * `medium` - Applied when `size` is set to "medium"
41
- * * `small` - Applied when `size` is set to "small"
42
- * * `tiny` - Applied when `size` is set to "tiny"
43
- * * `largeSpacing` - Applied when `spacing` is set to "large"
44
- * * `mediumSpacing` - Applied when `spacing` is set to "medium"
45
- * * `smallSpacing` - Applied when `spacing` is set to "small"
46
- * * `noneSpacing` - Applied when `spacing` is set to "none"
47
- */
48
- css?: object;
49
- /**
50
- * Set the size of this component.
51
- * * `'title'` and `'subtitle'` are generally considered to be used only once on a given screen.
52
- * * `'large'` , `'medium'` , `'small'` , and `'tiny'` are typically used as section headings
53
- *
54
- * for content on a screen, starting with `'large'` for the first tier of information
55
- followed by `'medium'` for the next, and so fourth.
56
- *
57
- * If the `spacing` prop is not set (defaulting to "auto"), these values automatically set
58
- the spacing to the correlated names.
59
- */
60
- size?: "title" | "subtitle" | "large" | "medium" | "small" | "tiny";
61
- /**
62
- * The size of the spacing around the Heading.
63
- *
64
- * These have no built-in measurements, as they are intended to be defined by the theme
65
- consuming this UI element. The values correlate with customizable classes made available
66
- by this component's `css` prop.
67
- *
68
- * Allowed values include:
69
- * * `'auto'` (default) - Lets this value be based on the `size` prop for automatic usage.
70
- * * `'large'` - Specifically assign the `'large'` spacing.
71
- * * `'medium'` - Specifically assign the `'medium'` spacing.
72
- * * `'small'` - Specifically assign the `'small'` spacing.
73
- * * `'none'` - No spacing at all. Neighboring elements will directly touch the Heading.
74
- */
75
- spacing?: "auto" | "large" | "medium" | "small" | "none";
76
- }
77
- /**
78
- * A labeled Heading component.
79
- */
80
-
81
- export class Heading extends React.Component<
82
- Merge<React.HTMLProps<HTMLElement>, HeadingProps>
83
- > {}
84
-
85
- export interface HeadingDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
86
- export function HeadingDecorator<P>(
87
- Component: React.ComponentType<P> | string
88
- ): React.ComponentType<P & HeadingDecoratorProps>;
89
-
90
- export default Heading;
package/Icon/Icon.d.ts DELETED
@@ -1,88 +0,0 @@
1
- // Type definitions for ui/Icon
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 IconBaseProps {
10
- /**
11
- * The icon content.
12
- *
13
- * May be specified as either:
14
- * * A string that represents an icon from the ,
15
- * * An HTML entity string, Unicode reference or hex value (in the form '0x...'),
16
- * * A URL specifying path to an icon image, or
17
- * * An object representing a resolution independent resource (See ).
18
- */
19
- children?: string | object;
20
- /**
21
- * Called with a reference to the root component.
22
- *
23
- * When using , the `ref` prop is forwarded to this component
24
- as `componentRef` .
25
- */
26
- componentRef?: object | Function;
27
- /**
28
- * Customizes the component by mapping the supplied collection of CSS class names to the
29
- corresponding internal elements and states of this component.
30
- *
31
- * The following classes are supported:
32
- * * `icon` - The root component class
33
- * * `dingbat` - Applied when the value of is not
34
- found in
35
- * * `large` - Applied when `size` prop is `'large'`
36
- * * `pressed` - Applied when `pressed` prop is `true`
37
- * * `small` - Applied when `size` prop is `'small'`
38
- */
39
- css?: object;
40
- /**
41
- * Flip the icon horizontally, vertically or both.
42
- */
43
- flip?: "both" | "horizontal" | "vertical";
44
- /**
45
- * The full list (hash) of supported icons.
46
- *
47
- * The keys of this hash are the unique names of each icon. The values are the unicode
48
- characters to insert in the icon. These will typically map to glyphs in your icon-font.
49
- The format of the keys can be character, glyph, or entity reference that correctly
50
- renders in a React + JSX string.
51
- */
52
- iconList?: object;
53
- /**
54
- * Applies the `pressed` CSS class.
55
- */
56
- pressed?: boolean;
57
- /**
58
- * The size of the button.
59
- *
60
- * Applies the CSS class which can be customized by
61
- .
62
- */
63
- size?: string;
64
- }
65
- /**
66
- * A basic icon component structure without any behaviors applied to it.
67
- */
68
-
69
- export class IconBase extends React.Component<
70
- Merge<React.HTMLProps<HTMLElement>, IconBaseProps>
71
- > {}
72
-
73
- export interface IconDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
74
- export function IconDecorator<P>(
75
- Component: React.ComponentType<P> | string
76
- ): React.ComponentType<P & IconDecoratorProps>;
77
-
78
- export interface IconProps
79
- extends Omit<Merge<IconBaseProps, IconDecoratorProps>, "componentRef"> {}
80
- /**
81
- * An Icon component.
82
- */
83
-
84
- export class Icon extends React.Component<
85
- Merge<React.HTMLProps<HTMLElement>, IconProps>
86
- > {}
87
-
88
- export default Icon;
@@ -1,115 +0,0 @@
1
- // Type definitions for ui/IconButton
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
-
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 IconButtonBaseProps {
11
- /**
12
- * This is the root component used to render the button and will receive all props except
13
- `icon` .
14
- */
15
- buttonComponent: React.ComponentType | JSX.Element;
16
- /**
17
- * The component used to render the .
18
- *
19
- * This component will receive the `flip` and `size` property set on the `IconButton` as well as the
20
- `icon` class to customize its styling.
21
- */
22
- iconComponent: React.ComponentType;
23
- /**
24
- * Additional children that follow the icon.
25
- *
26
- * If `icon` isn't specified but `children` is, `children` is used as the icon's value.
27
- */
28
- children?: React.ReactNode;
29
- /**
30
- * Called with a reference to the root component.
31
- *
32
- * When using , the `ref` prop is forwarded to this
33
- component as `componentRef` .
34
- */
35
- componentRef?: object | Function;
36
- /**
37
- * Customizes the component by mapping the supplied collection of CSS class names to the
38
- corresponding internal elements and states of this component.
39
- *
40
- * The following classes are supported:
41
- * * `iconButton` - The root component class
42
- * * `icon` - The class
43
- * * `large` - Applied when `size` prop is `'large'`
44
- * * `small` - Applied when `size` prop is `'small'`
45
- * * `pressed` - Applied when `pressed` prop is `true`
46
- */
47
- css?: object;
48
- /**
49
- * Disables IconButton.
50
- *
51
- * When `true` , the button is shown as disabled and does not generate
52
- `onClick` .
53
- */
54
- disabled?: boolean;
55
- /**
56
- * Flip the icon horizontally, vertically or both.
57
- */
58
- flip?: "both" | "horizontal" | "vertical";
59
- /**
60
- * The icon displayed within the IconButton.
61
- *
62
- * If not specified, `children` is used as the icon value instead.
63
- */
64
- icon?: string;
65
- /**
66
- * Applies the `pressed` CSS class.
67
- */
68
- pressed?: boolean;
69
- /**
70
- * Applies the `selected` CSS class.
71
- */
72
- selected?: boolean;
73
- /**
74
- * The size of the button.
75
- *
76
- * Applies the CSS class which can be customized by
77
- .
78
- */
79
- size?: string;
80
- }
81
- /**
82
- * A ui-styled button without any behavior.
83
- */
84
-
85
- export class IconButtonBase extends React.Component<
86
- Merge<React.HTMLProps<HTMLElement>, IconButtonBaseProps>
87
- > {}
88
-
89
- export interface IconButtonDecoratorProps
90
- extends Merge<ui_ForwardRef_ForwardRefProps, ui_Touchable_TouchableProps> {}
91
- export function IconButtonDecorator<P>(
92
- Component: React.ComponentType<P> | string
93
- ): React.ComponentType<P & IconButtonDecoratorProps>;
94
-
95
- export interface IconButtonProps
96
- extends Omit<
97
- Merge<IconButtonBaseProps, IconButtonDecoratorProps>,
98
- "componentRef"
99
- > {}
100
- /**
101
- * A minimally styled, but interactive, Button ready for customization by a theme.
102
- *
103
- * Example:
104
- * ```
105
- <IconButton size="small">
106
- plus
107
- </IconButton>
108
- ```
109
- */
110
-
111
- export class IconButton extends React.Component<
112
- Merge<React.HTMLProps<HTMLElement>, IconButtonProps>
113
- > {}
114
-
115
- export default IconButton;
package/Image/Image.d.ts DELETED
@@ -1,113 +0,0 @@
1
- // Type definitions for ui/Image
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 ImageBaseProps {
10
- /**
11
- * String value for the alt attribute of the image.
12
- */
13
- alt?: string;
14
- /**
15
- * Node for the children of an `Image` . Useful for overlays.
16
- */
17
- children?: React.ReactNode;
18
- /**
19
- * Called with a reference to the root component.
20
- *
21
- * When using , the `ref` prop is forwarded to this component
22
- as `componentRef` .
23
- */
24
- componentRef?: object | Function;
25
- /**
26
- * Customizes the component by mapping the supplied collection of CSS class names to the
27
- corresponding internal elements and states of this component.
28
- *
29
- * The following classes are supported:
30
- * * `image` - The root component class
31
- * * `fit` - Applied when `sizing` prop is `fit`
32
- * * `fill` - Applied when `sizing` prop is `fill`
33
- */
34
- css?: object;
35
- /**
36
- * Called if the image has an error.
37
- */
38
- onError?: Function;
39
- /**
40
- * Called once the image is loaded.
41
- */
42
- onLoad?: Function;
43
- /**
44
- * A placeholder image to be displayed before the image is loaded.
45
- *
46
- * For performance purposes, it should be pre-loaded or be a data url. If `src` is
47
- unset, this value will be used as the `background-image` .
48
- */
49
- placeholder?: string;
50
- /**
51
- * Used to set the `background-size` of an `Image` .
52
- * * `'fill'` - sets `background-size: cover`
53
- * * `'fit'` - sets `background-size: contain`
54
- * * `'none'` - uses the image's natural size
55
- */
56
- sizing?: string;
57
- /**
58
- * String value or Object of values used to determine which image will appear on
59
- a specific screenSize.
60
- */
61
- src?: string | object;
62
- }
63
- /**
64
- * A basic image component designed to display images conditionally based on screen size.
65
- *
66
- * This component does not have a default size, therefore the image will not show unless a size is
67
- specified using a CSS `className` or inline `style` .
68
- *
69
- * Example:
70
- * ```
71
- const src = {
72
- 'hd': 'http://lorempixel.com/64/64/city/1/',
73
- 'fhd': 'http://lorempixel.com/128/128/city/1/',
74
- 'uhd': 'http://lorempixel.com/256/256/city/1/'
75
- };
76
-
77
- <Image className={css.myImage} src={src} sizing="fill" />
78
- ```
79
-
80
- * `ui/Image` is based on the `div` element, but it uses `img` to provide `onError` and `onLoad`
81
- events. The image that you see on screen is a `background-image` from the `div` element, not the
82
- `img` element.
83
- *
84
- * If you need a naturally sized image, you can use the native `<img>` element instead.
85
- */
86
-
87
- export class ImageBase extends React.Component<
88
- Merge<React.HTMLProps<HTMLElement>, ImageBaseProps>
89
- > {}
90
-
91
- export interface ImageProps
92
- extends Omit<Merge<ImageBaseProps, ImageDecoratorProps>, "componentRef"> {
93
- /**
94
- * The aria-label for the image.
95
- *
96
- * If unset, it defaults to the value of `alt` .
97
- */
98
- "aria-label"?: string;
99
- }
100
- /**
101
- * A minimally styled Image ready for customization by a theme.
102
- */
103
-
104
- export class Image extends React.Component<
105
- Merge<React.HTMLProps<HTMLElement>, ImageProps>
106
- > {}
107
-
108
- export interface ImageDecoratorProps extends ui_ForwardRef_ForwardRefProps {}
109
- export function ImageDecorator<P>(
110
- Component: React.ComponentType<P> | string
111
- ): React.ComponentType<P & ImageDecoratorProps>;
112
-
113
- export default Image;