@react-spectrum/icon 3.8.12 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +4 -4
- package/dist/main.js +6 -6
- package/dist/main.js.map +1 -1
- package/dist/module.js +4 -4
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +7 -0
- package/package.json +12 -27
- package/src/index.ts +7 -6
- package/dist/Icon.main.js +0 -71
- package/dist/Icon.main.js.map +0 -1
- package/dist/Icon.mjs +0 -66
- package/dist/Icon.module.js +0 -66
- package/dist/Icon.module.js.map +0 -1
- package/dist/Illustration.main.js +0 -46
- package/dist/Illustration.main.js.map +0 -1
- package/dist/Illustration.mjs +0 -37
- package/dist/Illustration.module.js +0 -37
- package/dist/Illustration.module.js.map +0 -1
- package/dist/UIIcon.main.js +0 -62
- package/dist/UIIcon.main.js.map +0 -1
- package/dist/UIIcon.mjs +0 -57
- package/dist/UIIcon.module.js +0 -57
- package/dist/UIIcon.module.js.map +0 -1
- package/dist/icon.248b9ee8.css +0 -264
- package/dist/icon.248b9ee8.css.map +0 -1
- package/dist/icon_vars_css.main.js +0 -152
- package/dist/icon_vars_css.main.js.map +0 -1
- package/dist/icon_vars_css.mjs +0 -154
- package/dist/icon_vars_css.module.js +0 -154
- package/dist/icon_vars_css.module.js.map +0 -1
- package/dist/types.d.ts +0 -70
- package/dist/types.d.ts.map +0 -1
- package/src/Icon.tsx +0 -105
- package/src/Illustration.tsx +0 -69
- package/src/UIIcon.tsx +0 -74
package/src/UIIcon.tsx
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
3
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*
|
|
7
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
-
* governing permissions and limitations under the License.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import {AriaLabelingProps, DOMProps, StyleProps} from '@react-types/shared';
|
|
14
|
-
import {classNames, useSlotProps, useStyleProps} from '@react-spectrum/utils';
|
|
15
|
-
import {filterDOMProps} from '@react-aria/utils';
|
|
16
|
-
import {ProviderContext, useProvider} from '@react-spectrum/provider';
|
|
17
|
-
import React, {JSX, ReactElement} from 'react';
|
|
18
|
-
import styles from '@adobe/spectrum-css-temp/components/icon/vars.css';
|
|
19
|
-
|
|
20
|
-
export interface UIIconProps extends DOMProps, AriaLabelingProps, StyleProps {
|
|
21
|
-
children: ReactElement<any>,
|
|
22
|
-
slot?: string,
|
|
23
|
-
/**
|
|
24
|
-
* Indicates whether the element is exposed to an accessibility API.
|
|
25
|
-
*/
|
|
26
|
-
'aria-hidden'?: boolean | 'false' | 'true'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type UIIconPropsWithoutChildren = Omit<UIIconProps, 'children'>;
|
|
30
|
-
|
|
31
|
-
export function UIIcon(props: UIIconProps): JSX.Element {
|
|
32
|
-
props = useSlotProps(props, 'icon');
|
|
33
|
-
let {
|
|
34
|
-
children,
|
|
35
|
-
'aria-label': ariaLabel,
|
|
36
|
-
'aria-hidden': ariaHidden,
|
|
37
|
-
...otherProps
|
|
38
|
-
} = props;
|
|
39
|
-
|
|
40
|
-
let {styleProps} = useStyleProps(otherProps);
|
|
41
|
-
let provider: undefined | ProviderContext;
|
|
42
|
-
try {
|
|
43
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
|
-
provider = useProvider();
|
|
45
|
-
} catch {
|
|
46
|
-
// ignore
|
|
47
|
-
}
|
|
48
|
-
let scale = 'M';
|
|
49
|
-
if (provider != null) {
|
|
50
|
-
scale = provider.scale === 'large' ? 'L' : 'M';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if (!ariaHidden) {
|
|
54
|
-
ariaHidden = undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return React.cloneElement(children, {
|
|
58
|
-
...filterDOMProps(otherProps),
|
|
59
|
-
...styleProps,
|
|
60
|
-
scale,
|
|
61
|
-
focusable: 'false',
|
|
62
|
-
'aria-label': ariaLabel,
|
|
63
|
-
'aria-hidden': (ariaLabel ? (ariaHidden || undefined) : true),
|
|
64
|
-
role: 'img',
|
|
65
|
-
className: classNames(
|
|
66
|
-
styles,
|
|
67
|
-
children.props.className,
|
|
68
|
-
'spectrum-Icon',
|
|
69
|
-
{
|
|
70
|
-
[`spectrum-UIIcon-${children.type['displayName']}`]: children.type['displayName']
|
|
71
|
-
},
|
|
72
|
-
styleProps.className)
|
|
73
|
-
});
|
|
74
|
-
}
|