@react-spectrum/icon 3.0.0-nightly-641446f65-240905

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.
@@ -0,0 +1,70 @@
1
+ import { AriaLabelingProps, DOMProps, IconColorValue, StyleProps } from "@react-types/shared";
2
+ import React, { ReactElement } from "react";
3
+ export interface IconProps extends DOMProps, AriaLabelingProps, StyleProps {
4
+ /**
5
+ * A screen reader only label for the Icon.
6
+ */
7
+ 'aria-label'?: string;
8
+ /**
9
+ * The content to display. Should be an SVG.
10
+ */
11
+ children: ReactElement<any>;
12
+ /**
13
+ * Size of Icon (changes based on scale).
14
+ */
15
+ size?: 'XXS' | 'XS' | 'S' | 'M' | 'L' | 'XL' | 'XXL';
16
+ /**
17
+ * A slot to place the icon in.
18
+ * @default 'icon'
19
+ */
20
+ slot?: string;
21
+ /**
22
+ * Indicates whether the element is exposed to an accessibility API.
23
+ */
24
+ 'aria-hidden'?: boolean | 'false' | 'true';
25
+ /**
26
+ * Color of the Icon.
27
+ */
28
+ color?: IconColorValue;
29
+ }
30
+ export type IconPropsWithoutChildren = Omit<IconProps, 'children'>;
31
+ /**
32
+ * Spectrum icons are clear, minimal, and consistent across platforms. They follow the focused and rational principles of the design system in both metaphor and style.
33
+ */
34
+ export function Icon(props: IconProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
35
+ export interface UIIconProps extends DOMProps, AriaLabelingProps, StyleProps {
36
+ children: ReactElement<any>;
37
+ slot?: string;
38
+ /**
39
+ * Indicates whether the element is exposed to an accessibility API.
40
+ */
41
+ 'aria-hidden'?: boolean | 'false' | 'true';
42
+ }
43
+ export type UIIconPropsWithoutChildren = Omit<UIIconProps, 'children'>;
44
+ export function UIIcon(props: UIIconProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
45
+ export interface IllustrationProps extends DOMProps, AriaLabelingProps, StyleProps {
46
+ /**
47
+ * A screen reader only label for the Illustration.
48
+ */
49
+ 'aria-label'?: string;
50
+ /**
51
+ * The content to display. Should be an SVG.
52
+ */
53
+ children: ReactElement<any>;
54
+ /**
55
+ * A slot to place the illustration in.
56
+ * @default 'illustration'
57
+ */
58
+ slot?: string;
59
+ /**
60
+ * Indicates whether the element is exposed to an accessibility API.
61
+ */
62
+ 'aria-hidden'?: boolean | 'false' | 'true';
63
+ }
64
+ export type IllustrationPropsWithoutChildren = Omit<IllustrationProps, 'children'>;
65
+ /**
66
+ * Wrapper component for illustrations. Use this to wrap your svg element for a custom illustration.
67
+ */
68
+ export function Illustration(props: IllustrationProps): React.ReactElement<any, string | React.JSXElementConstructor<any>>;
69
+
70
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;AAmBA,0BAA2B,SAAQ,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IACxE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,aAAa,GAAG,CAAC,CAAC;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAE,IAAI,GAAG,KAAK,CAAC;IACpD;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,KAAK,CAAC,EAAE,cAAc,CAAA;CACvB;AAED,uCAAuC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AAWnE;;GAEG;AACH,qBAAqB,KAAK,EAAE,SAAS,sEAqCpC;AC/ED,4BAA6B,SAAQ,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IAC1E,QAAQ,EAAE,aAAa,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;CAC3C;AAED,yCAAyC,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC;AAEvE,uBAAuB,KAAK,EAAE,WAAW,sEAqCxC;AClDD,kCAAmC,SAAQ,QAAQ,EAAE,iBAAiB,EAAE,UAAU;IAChF;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,aAAa,GAAG,CAAC,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,MAAM,CAAA;CAC3C;AAED,+CAA+C,IAAI,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;AAEnF;;GAEG;AACH,6BAA6B,KAAK,EAAE,iBAAiB,sEA0BpD","sources":["packages/@react-spectrum/icon/src/packages/@react-spectrum/icon/src/Icon.tsx","packages/@react-spectrum/icon/src/packages/@react-spectrum/icon/src/UIIcon.tsx","packages/@react-spectrum/icon/src/packages/@react-spectrum/icon/src/Illustration.tsx","packages/@react-spectrum/icon/src/packages/@react-spectrum/icon/src/index.ts","packages/@react-spectrum/icon/src/index.ts"],"sourcesContent":[null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {Icon} from './Icon';\nexport {UIIcon} from './UIIcon';\nexport {Illustration} from './Illustration';\n\nexport type {IconProps, IconPropsWithoutChildren} from './Icon';\nexport type {IllustrationProps, IllustrationPropsWithoutChildren} from './Illustration';\nexport type {UIIconProps, UIIconPropsWithoutChildren} from './UIIcon';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
@@ -0,0 +1,261 @@
1
+ .yxBNXG_spectrum-Icon, .yxBNXG_spectrum-UIIcon {
2
+ color: inherit;
3
+ fill: currentColor;
4
+ pointer-events: none;
5
+ display: inline-block;
6
+ }
7
+
8
+ :is(.yxBNXG_spectrum-Icon, .yxBNXG_spectrum-UIIcon):not(:root) {
9
+ overflow: hidden;
10
+ }
11
+
12
+ @media (forced-colors: active) {
13
+ .yxBNXG_spectrum-Icon, .yxBNXG_spectrum-UIIcon {
14
+ forced-color-adjust: auto;
15
+ }
16
+ }
17
+
18
+ .yxBNXG_spectrum-Icon--sizeXXS, .yxBNXG_spectrum-Icon--sizeXXS img, .yxBNXG_spectrum-Icon--sizeXXS svg {
19
+ block-size: calc(var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225)) / 2);
20
+ inline-size: calc(var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225)) / 2);
21
+ }
22
+
23
+ .yxBNXG_spectrum-Icon--sizeXS, .yxBNXG_spectrum-Icon--sizeXS img, .yxBNXG_spectrum-Icon--sizeXS svg {
24
+ block-size: calc(var(--spectrum-global-dimension-size-300) / 2);
25
+ inline-size: calc(var(--spectrum-global-dimension-size-300) / 2);
26
+ }
27
+
28
+ .yxBNXG_spectrum-Icon--sizeS, .yxBNXG_spectrum-Icon--sizeS img, .yxBNXG_spectrum-Icon--sizeS svg {
29
+ block-size: var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225));
30
+ inline-size: var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225));
31
+ }
32
+
33
+ .yxBNXG_spectrum-Icon--sizeM, .yxBNXG_spectrum-Icon--sizeM img, .yxBNXG_spectrum-Icon--sizeM svg {
34
+ block-size: var(--spectrum-global-dimension-size-300);
35
+ inline-size: var(--spectrum-global-dimension-size-300);
36
+ }
37
+
38
+ .yxBNXG_spectrum-Icon--sizeL, .yxBNXG_spectrum-Icon--sizeL img, .yxBNXG_spectrum-Icon--sizeL svg {
39
+ block-size: calc(var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225)) * 2);
40
+ inline-size: calc(var(--spectrum-alias-workflow-icon-size, var(--spectrum-global-dimension-size-225)) * 2);
41
+ }
42
+
43
+ .yxBNXG_spectrum-Icon--sizeXL, .yxBNXG_spectrum-Icon--sizeXL img, .yxBNXG_spectrum-Icon--sizeXL svg {
44
+ block-size: calc(var(--spectrum-global-dimension-size-300) * 2);
45
+ inline-size: calc(var(--spectrum-global-dimension-size-300) * 2);
46
+ }
47
+
48
+ .yxBNXG_spectrum-Icon--sizeXXL, .yxBNXG_spectrum-Icon--sizeXXL img, .yxBNXG_spectrum-Icon--sizeXXL svg {
49
+ block-size: calc(var(--spectrum-global-dimension-size-300) * 3);
50
+ inline-size: calc(var(--spectrum-global-dimension-size-300) * 3);
51
+ }
52
+
53
+ .yxBNXG_spectrum--medium .yxBNXG_spectrum-UIIcon--large {
54
+ display: none;
55
+ }
56
+
57
+ .yxBNXG_spectrum--medium .yxBNXG_spectrum-UIIcon--medium {
58
+ display: inline;
59
+ }
60
+
61
+ .yxBNXG_spectrum--large .yxBNXG_spectrum-UIIcon--medium {
62
+ display: none;
63
+ }
64
+
65
+ .yxBNXG_spectrum--large .yxBNXG_spectrum-UIIcon--large {
66
+ display: inline;
67
+ }
68
+
69
+ .yxBNXG_spectrum--large {
70
+ --ui-icon-large-display: block;
71
+ --ui-icon-medium-display: none;
72
+ }
73
+
74
+ .yxBNXG_spectrum--medium {
75
+ --ui-icon-medium-display: block;
76
+ --ui-icon-large-display: none;
77
+ }
78
+
79
+ .yxBNXG_spectrum-UIIcon--large {
80
+ display: var(--ui-icon-large-display);
81
+ }
82
+
83
+ .yxBNXG_spectrum-UIIcon--medium {
84
+ display: var(--ui-icon-medium-display);
85
+ }
86
+
87
+ .yxBNXG_spectrum-UIIcon-AlertMedium {
88
+ inline-size: var(--spectrum-icon-alert-medium-width, var(--spectrum-global-dimension-size-225));
89
+ block-size: var(--spectrum-icon-alert-medium-height, var(--spectrum-global-dimension-size-225));
90
+ }
91
+
92
+ .yxBNXG_spectrum-UIIcon-AlertSmall {
93
+ inline-size: var(--spectrum-icon-alert-small-width, var(--spectrum-global-dimension-size-175));
94
+ block-size: var(--spectrum-icon-alert-small-height, var(--spectrum-global-dimension-size-175));
95
+ }
96
+
97
+ .yxBNXG_spectrum-UIIcon-ArrowDownSmall {
98
+ inline-size: var(--spectrum-icon-arrow-down-small-width, var(--spectrum-global-dimension-size-100));
99
+ block-size: var(--spectrum-icon-arrow-down-small-height);
100
+ }
101
+
102
+ .yxBNXG_spectrum-UIIcon-ArrowLeftMedium {
103
+ inline-size: var(--spectrum-icon-arrow-left-medium-width, var(--spectrum-global-dimension-size-175));
104
+ block-size: var(--spectrum-icon-arrow-left-medium-height);
105
+ }
106
+
107
+ .yxBNXG_spectrum-UIIcon-Asterisk {
108
+ inline-size: var(--spectrum-fieldlabel-asterisk-size, var(--spectrum-global-dimension-size-100));
109
+ block-size: var(--spectrum-fieldlabel-asterisk-size, var(--spectrum-global-dimension-size-100));
110
+ }
111
+
112
+ .yxBNXG_spectrum-UIIcon-CheckmarkMedium {
113
+ inline-size: var(--spectrum-icon-checkmark-medium-width);
114
+ block-size: var(--spectrum-icon-checkmark-medium-height);
115
+ }
116
+
117
+ .yxBNXG_spectrum-UIIcon-CheckmarkSmall {
118
+ inline-size: var(--spectrum-icon-checkmark-small-width);
119
+ block-size: var(--spectrum-icon-checkmark-small-height);
120
+ }
121
+
122
+ .yxBNXG_spectrum-UIIcon-ChevronDownMedium {
123
+ inline-size: var(--spectrum-icon-chevron-down-medium-width);
124
+ block-size: var(--spectrum-icon-chevron-down-medium-height, var(--spectrum-global-dimension-size-75));
125
+ }
126
+
127
+ .yxBNXG_spectrum-UIIcon-ChevronDownSmall {
128
+ inline-size: var(--spectrum-icon-chevron-down-small-width, var(--spectrum-global-dimension-size-100));
129
+ block-size: var(--spectrum-icon-chevron-down-small-height, var(--spectrum-global-dimension-size-75));
130
+ }
131
+
132
+ .yxBNXG_spectrum-UIIcon-ChevronLeftLarge {
133
+ inline-size: var(--spectrum-icon-chevron-left-large-width);
134
+ block-size: var(--spectrum-icon-chevron-left-large-height, var(--spectrum-global-dimension-size-200));
135
+ }
136
+
137
+ .yxBNXG_spectrum-UIIcon-ChevronLeftMedium {
138
+ inline-size: var(--spectrum-icon-chevron-left-medium-width, var(--spectrum-global-dimension-size-75));
139
+ block-size: var(--spectrum-icon-chevron-left-medium-height);
140
+ }
141
+
142
+ .yxBNXG_spectrum-UIIcon-ChevronRightLarge {
143
+ inline-size: var(--spectrum-icon-chevron-right-large-width);
144
+ block-size: var(--spectrum-icon-chevron-right-large-height, var(--spectrum-global-dimension-size-200));
145
+ }
146
+
147
+ .yxBNXG_spectrum-UIIcon-ChevronRightMedium {
148
+ inline-size: var(--spectrum-icon-chevron-right-medium-width, var(--spectrum-global-dimension-size-75));
149
+ block-size: var(--spectrum-icon-chevron-right-medium-height);
150
+ }
151
+
152
+ .yxBNXG_spectrum-UIIcon-ChevronRightSmall {
153
+ inline-size: var(--spectrum-icon-chevron-right-small-width, var(--spectrum-global-dimension-size-75));
154
+ block-size: var(--spectrum-icon-chevron-right-small-height, var(--spectrum-global-dimension-size-100));
155
+ }
156
+
157
+ .yxBNXG_spectrum-UIIcon-ChevronUpSmall {
158
+ inline-size: var(--spectrum-icon-chevron-up-small-width, var(--spectrum-global-dimension-size-100));
159
+ block-size: var(--spectrum-icon-chevron-up-small-height, var(--spectrum-global-dimension-size-75));
160
+ }
161
+
162
+ .yxBNXG_spectrum-UIIcon-CornerTriangle {
163
+ inline-size: var(--spectrum-icon-cornertriangle-width, var(--spectrum-global-dimension-size-65));
164
+ block-size: var(--spectrum-icon-cornertriangle-height, var(--spectrum-global-dimension-size-65));
165
+ }
166
+
167
+ .yxBNXG_spectrum-UIIcon-CrossLarge {
168
+ inline-size: var(--spectrum-icon-cross-large-width);
169
+ block-size: var(--spectrum-icon-cross-large-height);
170
+ }
171
+
172
+ .yxBNXG_spectrum-UIIcon-CrossMedium {
173
+ inline-size: var(--spectrum-icon-cross-medium-width, var(--spectrum-global-dimension-size-100));
174
+ block-size: var(--spectrum-icon-cross-medium-height, var(--spectrum-global-dimension-size-100));
175
+ }
176
+
177
+ .yxBNXG_spectrum-UIIcon-CrossSmall {
178
+ inline-size: var(--spectrum-icon-cross-small-width, var(--spectrum-global-dimension-size-100));
179
+ block-size: var(--spectrum-icon-cross-small-height, var(--spectrum-global-dimension-size-100));
180
+ }
181
+
182
+ .yxBNXG_spectrum-UIIcon-DashSmall {
183
+ inline-size: var(--spectrum-icon-dash-small-width);
184
+ block-size: var(--spectrum-icon-dash-small-height);
185
+ }
186
+
187
+ .yxBNXG_spectrum-UIIcon-DoubleGripper {
188
+ inline-size: var(--spectrum-icon-doublegripper-width, var(--spectrum-global-dimension-size-200));
189
+ block-size: var(--spectrum-icon-doublegripper-height, var(--spectrum-global-dimension-size-50));
190
+ }
191
+
192
+ .yxBNXG_spectrum-UIIcon-FolderBreadcrumb {
193
+ inline-size: var(--spectrum-icon-folderbreadcrumb-width, var(--spectrum-global-dimension-size-225));
194
+ block-size: var(--spectrum-icon-folderbreadcrumb-height, var(--spectrum-global-dimension-size-225));
195
+ }
196
+
197
+ .yxBNXG_spectrum-UIIcon-HelpMedium {
198
+ inline-size: var(--spectrum-icon-info-medium-width, var(--spectrum-global-dimension-size-225));
199
+ block-size: var(--spectrum-icon-info-medium-height, var(--spectrum-global-dimension-size-225));
200
+ }
201
+
202
+ .yxBNXG_spectrum-UIIcon-HelpSmall {
203
+ inline-size: var(--spectrum-icon-info-small-width, var(--spectrum-global-dimension-size-175));
204
+ block-size: var(--spectrum-icon-info-small-height, var(--spectrum-global-dimension-size-175));
205
+ }
206
+
207
+ .yxBNXG_spectrum-UIIcon-InfoMedium {
208
+ inline-size: var(--spectrum-icon-info-medium-width, var(--spectrum-global-dimension-size-225));
209
+ block-size: var(--spectrum-icon-info-medium-height, var(--spectrum-global-dimension-size-225));
210
+ }
211
+
212
+ .yxBNXG_spectrum-UIIcon-InfoSmall {
213
+ inline-size: var(--spectrum-icon-info-small-width, var(--spectrum-global-dimension-size-175));
214
+ block-size: var(--spectrum-icon-info-small-height, var(--spectrum-global-dimension-size-175));
215
+ }
216
+
217
+ .yxBNXG_spectrum-UIIcon-ListGripper {
218
+ inline-size: var(--spectrum-global-dimension-size-65);
219
+ block-size: var(--spectrum-global-dimension-size-150);
220
+ }
221
+
222
+ .yxBNXG_spectrum-UIIcon-Magnifier {
223
+ inline-size: var(--spectrum-icon-magnifier-width, var(--spectrum-global-dimension-size-200));
224
+ block-size: var(--spectrum-icon-magnifier-height, var(--spectrum-global-dimension-size-200));
225
+ }
226
+
227
+ .yxBNXG_spectrum-UIIcon-SkipLeft {
228
+ inline-size: var(--spectrum-icon-skip-left-width);
229
+ block-size: var(--spectrum-icon-skip-left-height);
230
+ }
231
+
232
+ .yxBNXG_spectrum-UIIcon-SkipRight {
233
+ inline-size: var(--spectrum-icon-skip-right-width);
234
+ block-size: var(--spectrum-icon-skip-right-height);
235
+ }
236
+
237
+ .yxBNXG_spectrum-UIIcon-Star {
238
+ inline-size: var(--spectrum-icon-star-width, var(--spectrum-global-dimension-size-225));
239
+ block-size: var(--spectrum-icon-star-height, var(--spectrum-global-dimension-size-225));
240
+ }
241
+
242
+ .yxBNXG_spectrum-UIIcon-StarOutline {
243
+ inline-size: var(--spectrum-icon-star-outline-width, var(--spectrum-global-dimension-size-225));
244
+ block-size: var(--spectrum-icon-star-outline-height, var(--spectrum-global-dimension-size-225));
245
+ }
246
+
247
+ .yxBNXG_spectrum-UIIcon-SuccessMedium {
248
+ inline-size: var(--spectrum-icon-success-medium-width, var(--spectrum-global-dimension-size-225));
249
+ block-size: var(--spectrum-icon-success-medium-height, var(--spectrum-global-dimension-size-225));
250
+ }
251
+
252
+ .yxBNXG_spectrum-UIIcon-SuccessSmall {
253
+ inline-size: var(--spectrum-icon-success-small-width, var(--spectrum-global-dimension-size-175));
254
+ block-size: var(--spectrum-icon-success-small-height, var(--spectrum-global-dimension-size-175));
255
+ }
256
+
257
+ .yxBNXG_spectrum-UIIcon-TripleGripper {
258
+ inline-size: var(--spectrum-icon-triplegripper-width);
259
+ block-size: var(--spectrum-icon-triplegripper-height, var(--spectrum-global-dimension-size-85));
260
+ }
261
+ /*# sourceMappingURL=vars.4163ca54.css.map */
@@ -0,0 +1 @@
1
+ {"mappings":"AAoCA;;;;;;;AAWE;;;;AAQF;EACE;;;;;AAoBA;;;;;AASA;;;;;AASA;;;;;AASA;;;;;AASA;;;;;AASA;;;;;AASA;;;;;AAuBA;;;;AAGA;;;;AAMA;;;;AAGA;;;;AAOF;;;;;AAKA;;;;;AAKA;;;;AAIA;;;;AAMA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA;;;;;AAKA","sources":["packages/@adobe/spectrum-css-temp/components/icon/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n"],"names":[],"version":3,"file":"vars.4163ca54.css.map"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@react-spectrum/icon",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
13
+ "types": "dist/types.d.ts",
14
+ "source": "src/index.ts",
15
+ "files": [
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
21
+ ],
22
+ "targets": {
23
+ "main": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ },
28
+ "module": {
29
+ "includeNodeModules": [
30
+ "@adobe/spectrum-css-temp"
31
+ ]
32
+ }
33
+ },
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/adobe/react-spectrum"
37
+ },
38
+ "dependencies": {
39
+ "@react-aria/utils": "^3.0.0-nightly-641446f65-240905",
40
+ "@react-spectrum/utils": "^3.0.0-nightly-641446f65-240905",
41
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905",
42
+ "@swc/helpers": "^0.5.0"
43
+ },
44
+ "devDependencies": {
45
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@react-spectrum/provider": "^3.0.0-nightly-641446f65-240905",
49
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
50
+ },
51
+ "publishConfig": {
52
+ "access": "public"
53
+ },
54
+ "stableVersion": "3.7.15"
55
+ }
package/src/Icon.tsx ADDED
@@ -0,0 +1,99 @@
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, IconColorValue, StyleProps} from '@react-types/shared';
14
+ import {baseStyleProps, classNames, StyleHandlers, useSlotProps, useStyleProps} from '@react-spectrum/utils';
15
+ import {filterDOMProps} from '@react-aria/utils';
16
+ import React, {ReactElement} from 'react';
17
+ import styles from '@adobe/spectrum-css-temp/components/icon/vars.css';
18
+ import {useProvider} from '@react-spectrum/provider';
19
+
20
+ export interface IconProps extends DOMProps, AriaLabelingProps, StyleProps {
21
+ /**
22
+ * A screen reader only label for the Icon.
23
+ */
24
+ 'aria-label'?: string,
25
+ /**
26
+ * The content to display. Should be an SVG.
27
+ */
28
+ children: ReactElement<any>,
29
+ /**
30
+ * Size of Icon (changes based on scale).
31
+ */
32
+ size?: 'XXS' | 'XS' | 'S' | 'M' | 'L' |'XL' | 'XXL',
33
+ /**
34
+ * A slot to place the icon in.
35
+ * @default 'icon'
36
+ */
37
+ slot?: string,
38
+ /**
39
+ * Indicates whether the element is exposed to an accessibility API.
40
+ */
41
+ 'aria-hidden'?: boolean | 'false' | 'true',
42
+ /**
43
+ * Color of the Icon.
44
+ */
45
+ color?: IconColorValue
46
+ }
47
+
48
+ export type IconPropsWithoutChildren = Omit<IconProps, 'children'>;
49
+
50
+ function iconColorValue(value: IconColorValue) {
51
+ return `var(--spectrum-semantic-${value}-color-icon)`;
52
+ }
53
+
54
+ const iconStyleProps: StyleHandlers = {
55
+ ...baseStyleProps,
56
+ color: ['color', iconColorValue]
57
+ };
58
+
59
+ /**
60
+ * Spectrum icons are clear, minimal, and consistent across platforms. They follow the focused and rational principles of the design system in both metaphor and style.
61
+ */
62
+ export function Icon(props: IconProps) {
63
+ props = useSlotProps(props, 'icon');
64
+ let {
65
+ children,
66
+ size,
67
+ 'aria-label': ariaLabel,
68
+ 'aria-hidden': ariaHidden,
69
+ ...otherProps
70
+ } = props;
71
+ let {styleProps} = useStyleProps(otherProps, iconStyleProps);
72
+
73
+ let provider = useProvider();
74
+ let scale = 'M';
75
+ if (provider !== null) {
76
+ scale = provider.scale === 'large' ? 'L' : 'M';
77
+ }
78
+ if (!ariaHidden) {
79
+ ariaHidden = undefined;
80
+ }
81
+
82
+ // Use user specified size, falling back to provider scale if size is undef
83
+ let iconSize = size ? size : scale;
84
+
85
+ return React.cloneElement(children, {
86
+ ...filterDOMProps(otherProps),
87
+ ...styleProps,
88
+ focusable: 'false',
89
+ 'aria-label': ariaLabel,
90
+ 'aria-hidden': (ariaLabel ? (ariaHidden || undefined) : true),
91
+ role: 'img',
92
+ className: classNames(
93
+ styles,
94
+ children.props.className,
95
+ 'spectrum-Icon',
96
+ `spectrum-Icon--size${iconSize}`,
97
+ styleProps.className)
98
+ });
99
+ }
@@ -0,0 +1,69 @@
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 {filterDOMProps} from '@react-aria/utils';
15
+ import React, {ReactElement} from 'react';
16
+ import {useSlotProps, useStyleProps} from '@react-spectrum/utils';
17
+
18
+ export interface IllustrationProps extends DOMProps, AriaLabelingProps, StyleProps {
19
+ /**
20
+ * A screen reader only label for the Illustration.
21
+ */
22
+ 'aria-label'?: string,
23
+ /**
24
+ * The content to display. Should be an SVG.
25
+ */
26
+ children: ReactElement<any>,
27
+ /**
28
+ * A slot to place the illustration in.
29
+ * @default 'illustration'
30
+ */
31
+ slot?: string,
32
+ /**
33
+ * Indicates whether the element is exposed to an accessibility API.
34
+ */
35
+ 'aria-hidden'?: boolean | 'false' | 'true'
36
+ }
37
+
38
+ export type IllustrationPropsWithoutChildren = Omit<IllustrationProps, 'children'>;
39
+
40
+ /**
41
+ * Wrapper component for illustrations. Use this to wrap your svg element for a custom illustration.
42
+ */
43
+ export function Illustration(props: IllustrationProps) {
44
+ props = useSlotProps(props, 'illustration');
45
+ let {
46
+ children,
47
+ 'aria-label': ariaLabel,
48
+ 'aria-labelledby': ariaLabelledby,
49
+ 'aria-hidden': ariaHidden,
50
+ ...otherProps
51
+ } = props;
52
+ let {styleProps} = useStyleProps(otherProps);
53
+
54
+ let hasLabel = ariaLabel || ariaLabelledby;
55
+
56
+ if (!ariaHidden) {
57
+ ariaHidden = undefined;
58
+ }
59
+
60
+ return React.cloneElement(children, {
61
+ ...filterDOMProps(otherProps),
62
+ ...styleProps,
63
+ focusable: 'false',
64
+ 'aria-label': ariaLabel,
65
+ 'aria-labelledby': ariaLabelledby,
66
+ 'aria-hidden': ariaHidden,
67
+ role: hasLabel ? 'img' : undefined
68
+ });
69
+ }
package/src/UIIcon.tsx ADDED
@@ -0,0 +1,68 @@
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 React, {ReactElement} from 'react';
17
+ import styles from '@adobe/spectrum-css-temp/components/icon/vars.css';
18
+ import {useProvider} from '@react-spectrum/provider';
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) {
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 = useProvider();
42
+ let scale = 'M';
43
+ if (provider !== null) {
44
+ scale = provider.scale === 'large' ? 'L' : 'M';
45
+ }
46
+
47
+ if (!ariaHidden) {
48
+ ariaHidden = undefined;
49
+ }
50
+
51
+ return React.cloneElement(children, {
52
+ ...filterDOMProps(otherProps),
53
+ ...styleProps,
54
+ scale,
55
+ focusable: 'false',
56
+ 'aria-label': ariaLabel,
57
+ 'aria-hidden': (ariaLabel ? (ariaHidden || undefined) : true),
58
+ role: 'img',
59
+ className: classNames(
60
+ styles,
61
+ children.props.className,
62
+ 'spectrum-Icon',
63
+ {
64
+ [`spectrum-UIIcon-${children.type['displayName']}`]: children.type['displayName']
65
+ },
66
+ styleProps.className)
67
+ });
68
+ }
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
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
+ /// <reference types="css-module-types" />
14
+
15
+ export {Icon} from './Icon';
16
+ export {UIIcon} from './UIIcon';
17
+ export {Illustration} from './Illustration';
18
+
19
+ export type {IconProps, IconPropsWithoutChildren} from './Icon';
20
+ export type {IllustrationProps, IllustrationPropsWithoutChildren} from './Illustration';
21
+ export type {UIIconProps, UIIconPropsWithoutChildren} from './UIIcon';