@react-spectrum/tag 3.0.0-alpha.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2019 Adobe
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # @react-spectrum/tag
2
+
3
+ This package is part of [react-spectrum](https://github.com/adobe/react-spectrum). See the repo for more details.
package/dist/main.css ADDED
@@ -0,0 +1 @@
1
+ .spectrum-Tags_8407eb{display:inherit;margin:0;padding:0;list-style:none}[dir=ltr] .spectrum-Tags-item_8407eb{padding-left:calc(var(--spectrum-tag-padding-x,var(--spectrum-global-dimension-size-125)) - var(--spectrum-tag-border-size,var(--spectrum-alias-border-size-thin)))}[dir=rtl] .spectrum-Tags-item_8407eb{padding-right:calc(var(--spectrum-tag-padding-x,var(--spectrum-global-dimension-size-125)) - var(--spectrum-tag-border-size,var(--spectrum-alias-border-size-thin)))}.spectrum-Tags-item_8407eb{display:-ms-grid;-ms-grid-columns:1fr auto;box-sizing:border-box;margin:calc(var(--spectrum-taggroup-tag-gap-y,var(--spectrum-global-dimension-size-100))/2)calc(var(--spectrum-taggroup-tag-gap-x,var(--spectrum-global-dimension-size-100))/2);height:var(--spectrum-tag-height,var(--spectrum-global-dimension-size-300));max-width:100%;border-width:var(--spectrum-tag-border-size,var(--spectrum-alias-border-size-thin));border-radius:var(--spectrum-global-dimension-size-50);-webkit-user-select:none;user-select:none;transition:border-color var(--spectrum-global-animation-duration-100,130ms)ease-in-out,color var(--spectrum-global-animation-duration-100,130ms)ease-in-out,box-shadow var(--spectrum-global-animation-duration-100,130ms)ease-in-out,background-color var(--spectrum-global-animation-duration-100,130ms)ease-in-out;border-style:solid;outline:0;grid-template-columns:1fr auto;grid-template-areas:"icon content action";align-items:center;display:grid}.spectrum-Tags-item_8407eb.is-disabled_8407eb{pointer-events:none}[dir=ltr] .spectrum-Tag-icon_8407eb{margin-right:var(--spectrum-global-dimension-size-100)}[dir=rtl] .spectrum-Tag-icon_8407eb{margin-left:var(--spectrum-global-dimension-size-100)}.spectrum-Tag-icon_8407eb{grid-area:icon}[dir=ltr] .spectrum-Tag-content_8407eb{margin-right:var(--spectrum-tag-padding-x,var(--spectrum-global-dimension-size-125))}[dir=rtl] .spectrum-Tag-content_8407eb{margin-left:var(--spectrum-tag-padding-x,var(--spectrum-global-dimension-size-125))}.spectrum-Tag-content_8407eb{height:100%;line-height:calc(var(--spectrum-tag-height,var(--spectrum-global-dimension-size-300)) - var(--spectrum-tag-border-size,var(--spectrum-alias-border-size-thin))*2);font-size:var(--spectrum-tag-text-size,var(--spectrum-global-dimension-font-size-75));cursor:default;white-space:nowrap;text-overflow:ellipsis;outline:0;flex:auto;grid-area:content;overflow:hidden}[dir=ltr] .tags-removable_8407eb{margin-right:0}[dir=rtl] .tags-removable_8407eb{margin-left:0}.spectrum-Tag-label_8407eb{grid-area:label}.spectrum-Tag-action_8407eb{height:calc(var(--spectrum-tag-height,var(--spectrum-global-dimension-size-300)) - 2*var(--spectrum-tag-border-size,var(--spectrum-alias-border-size-thin)));width:var(--spectrum-global-dimension-size-300);grid-area:action}.spectrum-Tags-item_8407eb{color:var(--spectrum-tag-text-color,var(--spectrum-global-color-gray-700));background-color:var(--spectrum-tag-background-color,var(--spectrum-global-color-gray-75));border-color:var(--spectrum-tag-border-color,var(--spectrum-global-color-gray-600))}.spectrum-Tags-item_8407eb.is-hovered_8407eb{background-color:var(--spectrum-tag-background-color-hover,var(--spectrum-global-color-gray-75));color:var(--spectrum-tag-text-color-hover,var(--spectrum-global-color-gray-900));border-color:var(--spectrum-tag-border-color-hover,var(--spectrum-global-color-gray-900))}.spectrum-Tags-item_8407eb.focus-ring_8407eb{background-color:var(--spectrum-tag-background-color-key-focus,var(--spectrum-global-color-gray-75));color:var(--spectrum-tag-text-color-key-focus,var(--spectrum-global-color-gray-900));border-color:var(--spectrum-tag-border-color-key-focus,var(--spectrum-alias-border-color-focus));box-shadow:0 0 0 1px var(--spectrum-tag-border-color-key-focus,var(--spectrum-alias-border-color-focus))}.spectrum-Tags-item_8407eb.is-selected_8407eb{background-color:var(--spectrum-tag-background-color-selected,var(--spectrum-global-color-gray-700));color:var(--spectrum-tag-text-color-selected,var(--spectrum-global-color-gray-50));border-color:var(--spectrum-tag-border-color-selected,var(--spectrum-alias-border-color-transparent))}.spectrum-Tags-item_8407eb.is-selected_8407eb.is-hovered_8407eb{background-color:var(--spectrum-tag-background-color-selected-hover,var(--spectrum-global-color-gray-800))}.spectrum-Tags-item_8407eb.is-selected_8407eb.focus-ring_8407eb{box-shadow:0 0 0 2px var(--spectrum-tag-border-color-selected-key-focus,var(--spectrum-alias-border-color-focus));border-color:var(--spectrum-tag-text-color-selected-key-focus,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb{border-color:var(--spectrum-tag-border-color-error-selected,var(--spectrum-alias-border-color-transparent))}.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb .spectrum-Tags-itemIcon_8407eb,.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb .spectrum-Tags-itemLabel_8407eb,.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb .spectrum-Tags-itemClearButton_8407eb{color:var(--spectrum-tag-text-color-error-selected,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb.focus-ring_8407eb{box-shadow:0 0 0 2px var(--spectrum-tag-border-color-key-focus,var(--spectrum-alias-border-color-focus));border-color:var(--spectrum-tag-border-color-error-selected,var(--spectrum-alias-border-color-transparent))}.spectrum-Tags-item_8407eb.is-selected_8407eb.is-invalid_8407eb.is-hovered_8407eb{border-color:var(--spectrum-tag-border-color-selected,var(--spectrum-alias-border-color-transparent))}.spectrum-Tags-item_8407eb.is-invalid_8407eb{color:var(--spectrum-tag-icon-color-error,var(--spectrum-global-color-red-500));border-color:var(--spectrum-tag-border-color-error,var(--spectrum-global-color-red-500))}.spectrum-Tags-item_8407eb.is-invalid_8407eb.is-hovered_8407eb{color:var(--spectrum-tag-icon-color-error-hover,var(--spectrum-global-color-red-600));border-color:var(--spectrum-tag-border-color-error-hover,var(--spectrum-global-color-red-600))}.spectrum-Tags-item_8407eb.is-invalid_8407eb.focus-ring_8407eb{color:var(--spectrum-tag-icon-color-error-hover,var(--spectrum-global-color-red-600));border-color:var(--spectrum-tag-border-color-key-focus,var(--spectrum-alias-border-color-focus));box-shadow:0 0 0 1px var(--spectrum-tag-border-color-key-focus,var(--spectrum-alias-border-color-focus))}.spectrum-Tags-item_8407eb.is-invalid_8407eb .spectrum-Tags-itemIcon_8407eb,.spectrum-Tags-item_8407eb.is-invalid_8407eb .spectrum-Tags-itemClearButton_8407eb{color:var(--spectrum-tag-border-color-error,var(--spectrum-global-color-red-500))}.spectrum-Tags-item_8407eb.is-disabled_8407eb{color:var(--spectrum-tag-text-color-disabled,var(--spectrum-global-color-gray-500));background-color:var(--spectrum-tag-background-color-disabled,var(--spectrum-global-color-gray-200));border-color:var(--spectrum-tag-border-color-disabled,var(--spectrum-global-color-gray-200))}.spectrum-Tags-item_8407eb.is-disabled_8407eb .spectrum-Avatar_8407eb{opacity:var(--spectrum-avatar-small-opacity-disabled,0.3)}.spectrum-Tags-item--removable_8407eb.is-hovered_8407eb{color:var(--spectrum-tag-removable-text-color-hover,var(--spectrum-global-color-gray-900))}.spectrum-Tags-item--removable_8407eb:active{color:var(--spectrum-tag-removable-text-color-down,var(--spectrum-global-color-gray-700))}.spectrum-Tags-item--removable_8407eb.is-invalid_8407eb.is-hovered_8407eb{border-color:var(--spectrum-tag-removable-border-color-error-hover,var(--spectrum-global-color-red-600))}.spectrum-Tags-item--removable_8407eb.is-invalid_8407eb.is-hovered_8407eb .spectrum-Tags-itemClearButton_8407eb{color:var(--spectrum-tag-removable-border-color-error-hover,var(--spectrum-global-color-red-600))}.spectrum-Tags-item--removable_8407eb.is-invalid_8407eb .spectrum-Tags-itemClearButton_8407eb.is-focused_8407eb{color:var(--spectrum-tag-icon-color-error-hover,var(--spectrum-global-color-red-600))}.spectrum-Tags-item--removable_8407eb.is-invalid_8407eb:active{border-color:var(--spectrum-tag-removable-border-color-error-down,var(--spectrum-global-color-red-700));color:var(--spectrum-tag-removable-text-color-error-down,var(--spectrum-global-color-gray-700))}.spectrum-Tags-item--removable_8407eb.is-focused_8407eb{color:var(--spectrum-tag-removable-text-color-key-focus,var(--spectrum-global-color-gray-700))}.spectrum-Tags-item--removable_8407eb.is-focused_8407eb.is-invalid_8407eb{color:var(--spectrum-tag-removable-text-color-error-key-focus,var(--spectrum-global-color-gray-700))}.spectrum-Tags-item--removable_8407eb.is-selected_8407eb{color:var(--spectrum-tag-removable-text-color-selected,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item--removable_8407eb.is-selected_8407eb.is-focused_8407eb{color:var(--spectrum-tag-removable-text-color-selected-key-focus,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item--removable_8407eb.is-selected_8407eb .spectrum-Tags-itemClearButton_8407eb{color:var(--spectrum-tag-removable-button-icon-color-selected,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item--removable_8407eb.is-selected_8407eb .spectrum-Tags-itemClearButton_8407eb.is-hovered_8407eb{background-color:var(--spectrum-tag-removable-button-background-color-selected-hover,var(--spectrum-global-color-gray-600));color:var(--spectrum-tag-removable-button-icon-color-selected-hover,var(--spectrum-global-color-gray-50))}.spectrum-Tags-item--removable_8407eb .spectrum-Tags-itemClearButton_8407eb.is-focused_8407eb{border:2px solid var(--spectrum-tag-removable-border-color-key-focus,var(--spectrum-alias-border-color-focus));border-radius:var(--spectrum-alias-border-radius-regular,var(--spectrum-global-dimension-size-50));background-color:var(--spectrum-tag-removable-button-background-color-key-focus,var(--spectrum-global-color-gray-600));color:var(--spectrum-tag-removable-button-icon-color-key-focus,var(--spectrum-global-color-gray-900))}.spectrum-Tags-item--removable_8407eb .spectrum-Tags-itemClearButton_8407eb.is-hovered_8407eb{background-color:var(--spectrum-tag-removable-button-background-color-hover,var(--spectrum-global-color-gray-300));color:var(--spectrum-tag-removable-button-icon-color-hover,var(--spectrum-global-color-gray-900))}@media (forced-colors:active){.spectrum-Tags-item_8407eb{forced-color-adjust:none;--spectrum-tag-background-color:ButtonFace;--spectrum-tag-background-color-disabled:ButtonFace;--spectrum-tag-background-color-hover:ButtonFace;--spectrum-tag-background-color-key-focus:ButtonFace;--spectrum-tag-background-color-selected:Highlight;--spectrum-tag-background-color-selected-hover:Highlight;--spectrum-tag-border-color:ButtonText;--spectrum-tag-border-color-disabled:GrayText;--spectrum-tag-border-color-error:ButtonText;--spectrum-tag-border-color-error-hover:ButtonText;--spectrum-tag-border-color-error-selected:HighlightText;--spectrum-tag-border-color-hover:Highlight;--spectrum-tag-border-color-key-focus:Highlight;--spectrum-tag-border-color-selected:HighlightText;--spectrum-tag-border-color-selected-key-focus:ButtonText;--spectrum-tag-icon-color-error:ButtonText;--spectrum-tag-icon-color-error-hover:ButtonText;--spectrum-tag-removable-border-color-error-down:Highlight;--spectrum-tag-removable-border-color-error-hover:Highlight;--spectrum-tag-removable-border-color-key-focus:Highlight;--spectrum-tag-removable-button-background-color-hover:ButtonFace;--spectrum-tag-removable-button-background-color-key-focus:ButtonFace;--spectrum-tag-removable-button-background-color-selected-hover:Highlight;--spectrum-tag-removable-button-icon-color-hover:Highlight;--spectrum-tag-removable-button-icon-color-key-focus:Highlight;--spectrum-tag-removable-button-icon-color-selected:HighlightText;--spectrum-tag-removable-button-icon-color-selected-hover:HighlightText;--spectrum-tag-removable-text-color-down:ButtonText;--spectrum-tag-removable-text-color-error-down:Highlight;--spectrum-tag-removable-text-color-error-key-focus:Highlight;--spectrum-tag-removable-text-color-hover:ButtonText;--spectrum-tag-removable-text-color-key-focus:ButtonText;--spectrum-tag-removable-text-color-selected:HighlightText;--spectrum-tag-removable-text-color-selected-key-focus:HighlightText;--spectrum-tag-text-color:ButtonText;--spectrum-tag-text-color-disabled:GrayText;--spectrum-tag-text-color-error-selected:HighlightText;--spectrum-tag-text-color-hover:ButtonText;--spectrum-tag-text-color-key-focus:ButtonText;--spectrum-tag-text-color-selected:HighlightText;--spectrum-tag-text-color-selected-key-focus:HighlightText}}
package/dist/main.js ADDED
@@ -0,0 +1,274 @@
1
+ require("./main.css");
2
+ var $68ZCu$reactspectrumutils = require("@react-spectrum/utils");
3
+ var $68ZCu$reactstatelygrid = require("@react-stately/grid");
4
+ var $68ZCu$reactariautils = require("@react-aria/utils");
5
+ var $68ZCu$react = require("react");
6
+ var $68ZCu$reactariatag = require("@react-aria/tag");
7
+ var $68ZCu$reactariagrid = require("@react-aria/grid");
8
+ var $68ZCu$reactstatelylist = require("@react-stately/list");
9
+ var $68ZCu$reactariai18n = require("@react-aria/i18n");
10
+ var $68ZCu$reactspectrumprovider = require("@react-spectrum/provider");
11
+ var $68ZCu$reactspectrumbutton = require("@react-spectrum/button");
12
+ var $68ZCu$reactspectrumtext = require("@react-spectrum/text");
13
+ var $68ZCu$reactariafocus = require("@react-aria/focus");
14
+ var $68ZCu$reactariainteractions = require("@react-aria/interactions");
15
+
16
+ function $parcel$exportWildcard(dest, source) {
17
+ Object.keys(source).forEach(function(key) {
18
+ if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
19
+ return;
20
+ }
21
+
22
+ Object.defineProperty(dest, key, {
23
+ enumerable: true,
24
+ get: function get() {
25
+ return source[key];
26
+ }
27
+ });
28
+ });
29
+
30
+ return dest;
31
+ }
32
+ function $parcel$interopDefault(a) {
33
+ return a && a.__esModule ? a.default : a;
34
+ }
35
+ function $parcel$export(e, n, v, s) {
36
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
37
+ }
38
+ var $6b983db856007a15$exports = {};
39
+
40
+ $parcel$export($6b983db856007a15$exports, "TagGroup", () => $6b983db856007a15$export$67ea30858aaf75e3);
41
+
42
+
43
+
44
+
45
+ var $728b12fe3f15274a$exports = {};
46
+
47
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags", () => $728b12fe3f15274a$export$eb7e80013a1212da, (v) => $728b12fe3f15274a$export$eb7e80013a1212da = v);
48
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags-item", () => $728b12fe3f15274a$export$950d8dc0a3751654, (v) => $728b12fe3f15274a$export$950d8dc0a3751654 = v);
49
+ $parcel$export($728b12fe3f15274a$exports, "is-disabled", () => $728b12fe3f15274a$export$d35bc1e505d1ebbf, (v) => $728b12fe3f15274a$export$d35bc1e505d1ebbf = v);
50
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tag-icon", () => $728b12fe3f15274a$export$21f5254139e14871, (v) => $728b12fe3f15274a$export$21f5254139e14871 = v);
51
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tag-content", () => $728b12fe3f15274a$export$d281c967f4ee071e, (v) => $728b12fe3f15274a$export$d281c967f4ee071e = v);
52
+ $parcel$export($728b12fe3f15274a$exports, "tags-removable", () => $728b12fe3f15274a$export$7427262f66a3b803, (v) => $728b12fe3f15274a$export$7427262f66a3b803 = v);
53
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tag-label", () => $728b12fe3f15274a$export$7ea9e20fd4ac0076, (v) => $728b12fe3f15274a$export$7ea9e20fd4ac0076 = v);
54
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tag-action", () => $728b12fe3f15274a$export$c5a1243e33faa2d4, (v) => $728b12fe3f15274a$export$c5a1243e33faa2d4 = v);
55
+ $parcel$export($728b12fe3f15274a$exports, "is-hovered", () => $728b12fe3f15274a$export$b8813cd5d7824ce7, (v) => $728b12fe3f15274a$export$b8813cd5d7824ce7 = v);
56
+ $parcel$export($728b12fe3f15274a$exports, "focus-ring", () => $728b12fe3f15274a$export$f39a09f249340e2a, (v) => $728b12fe3f15274a$export$f39a09f249340e2a = v);
57
+ $parcel$export($728b12fe3f15274a$exports, "is-selected", () => $728b12fe3f15274a$export$1e0fb04f31d3c22a, (v) => $728b12fe3f15274a$export$1e0fb04f31d3c22a = v);
58
+ $parcel$export($728b12fe3f15274a$exports, "is-invalid", () => $728b12fe3f15274a$export$14a30de2866685fa, (v) => $728b12fe3f15274a$export$14a30de2866685fa = v);
59
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags-itemIcon", () => $728b12fe3f15274a$export$8c615c557fdf3d9c, (v) => $728b12fe3f15274a$export$8c615c557fdf3d9c = v);
60
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags-itemLabel", () => $728b12fe3f15274a$export$23caf26adee41b84, (v) => $728b12fe3f15274a$export$23caf26adee41b84 = v);
61
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags-itemClearButton", () => $728b12fe3f15274a$export$90881dd581d6be55, (v) => $728b12fe3f15274a$export$90881dd581d6be55 = v);
62
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Avatar", () => $728b12fe3f15274a$export$2e049b8d031600fb, (v) => $728b12fe3f15274a$export$2e049b8d031600fb = v);
63
+ $parcel$export($728b12fe3f15274a$exports, "spectrum-Tags-item--removable", () => $728b12fe3f15274a$export$c1666977f4e14f87, (v) => $728b12fe3f15274a$export$c1666977f4e14f87 = v);
64
+ $parcel$export($728b12fe3f15274a$exports, "is-focused", () => $728b12fe3f15274a$export$e7dc768d35940237, (v) => $728b12fe3f15274a$export$e7dc768d35940237 = v);
65
+ var $728b12fe3f15274a$export$eb7e80013a1212da;
66
+ var $728b12fe3f15274a$export$950d8dc0a3751654;
67
+ var $728b12fe3f15274a$export$d35bc1e505d1ebbf;
68
+ var $728b12fe3f15274a$export$21f5254139e14871;
69
+ var $728b12fe3f15274a$export$d281c967f4ee071e;
70
+ var $728b12fe3f15274a$export$7427262f66a3b803;
71
+ var $728b12fe3f15274a$export$7ea9e20fd4ac0076;
72
+ var $728b12fe3f15274a$export$c5a1243e33faa2d4;
73
+ var $728b12fe3f15274a$export$b8813cd5d7824ce7;
74
+ var $728b12fe3f15274a$export$f39a09f249340e2a;
75
+ var $728b12fe3f15274a$export$1e0fb04f31d3c22a;
76
+ var $728b12fe3f15274a$export$14a30de2866685fa;
77
+ var $728b12fe3f15274a$export$8c615c557fdf3d9c;
78
+ var $728b12fe3f15274a$export$23caf26adee41b84;
79
+ var $728b12fe3f15274a$export$90881dd581d6be55;
80
+ var $728b12fe3f15274a$export$2e049b8d031600fb;
81
+ var $728b12fe3f15274a$export$c1666977f4e14f87;
82
+ var $728b12fe3f15274a$export$e7dc768d35940237;
83
+ $728b12fe3f15274a$export$eb7e80013a1212da = "spectrum-Tags_8407eb";
84
+ $728b12fe3f15274a$export$950d8dc0a3751654 = "spectrum-Tags-item_8407eb";
85
+ $728b12fe3f15274a$export$d35bc1e505d1ebbf = "is-disabled_8407eb";
86
+ $728b12fe3f15274a$export$21f5254139e14871 = "spectrum-Tag-icon_8407eb";
87
+ $728b12fe3f15274a$export$d281c967f4ee071e = "spectrum-Tag-content_8407eb";
88
+ $728b12fe3f15274a$export$7427262f66a3b803 = "tags-removable_8407eb";
89
+ $728b12fe3f15274a$export$7ea9e20fd4ac0076 = "spectrum-Tag-label_8407eb";
90
+ $728b12fe3f15274a$export$c5a1243e33faa2d4 = "spectrum-Tag-action_8407eb";
91
+ $728b12fe3f15274a$export$b8813cd5d7824ce7 = "is-hovered_8407eb";
92
+ $728b12fe3f15274a$export$f39a09f249340e2a = "focus-ring_8407eb";
93
+ $728b12fe3f15274a$export$1e0fb04f31d3c22a = "is-selected_8407eb";
94
+ $728b12fe3f15274a$export$14a30de2866685fa = "is-invalid_8407eb";
95
+ $728b12fe3f15274a$export$8c615c557fdf3d9c = "spectrum-Tags-itemIcon_8407eb";
96
+ $728b12fe3f15274a$export$23caf26adee41b84 = "spectrum-Tags-itemLabel_8407eb";
97
+ $728b12fe3f15274a$export$90881dd581d6be55 = "spectrum-Tags-itemClearButton_8407eb";
98
+ $728b12fe3f15274a$export$2e049b8d031600fb = "spectrum-Avatar_8407eb";
99
+ $728b12fe3f15274a$export$c1666977f4e14f87 = "spectrum-Tags-item--removable_8407eb";
100
+ $728b12fe3f15274a$export$e7dc768d35940237 = "is-focused_8407eb";
101
+
102
+
103
+
104
+
105
+
106
+
107
+
108
+
109
+
110
+
111
+
112
+ function $6a18f2ab7062d76e$export$3288d34c523a1192(props) {
113
+ const { children: children , isDisabled: isDisabled , isRemovable: isRemovable , item: item , state: state , onRemove: onRemove , ...otherProps } = props;
114
+ // @ts-ignore
115
+ let { styleProps: styleProps } = $68ZCu$reactspectrumutils.useStyleProps(otherProps);
116
+ let { hoverProps: hoverProps , isHovered: isHovered } = $68ZCu$reactariainteractions.useHover({
117
+ isDisabled: isDisabled
118
+ });
119
+ let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = $68ZCu$reactariafocus.useFocusRing({
120
+ within: true
121
+ });
122
+ let labelRef = $68ZCu$react.useRef();
123
+ let tagRef = $68ZCu$react.useRef();
124
+ let tagRowRef = $68ZCu$react.useRef();
125
+ let { clearButtonProps: clearButtonProps , labelProps: labelProps , tagProps: tagProps , tagRowProps: tagRowProps } = $68ZCu$reactariatag.useTag({
126
+ ...props,
127
+ isDisabled: isDisabled,
128
+ isFocused: isFocused,
129
+ isRemovable: isRemovable,
130
+ item: item,
131
+ onRemove: onRemove,
132
+ tagRef: tagRef,
133
+ tagRowRef: tagRowRef
134
+ }, state);
135
+ return(/*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement("div", tagRowProps, /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement("div", {
136
+ ...$68ZCu$reactariautils.mergeProps(tagProps, hoverProps, focusProps),
137
+ role: "gridcell",
138
+ className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tags-item', {
139
+ 'is-disabled': isDisabled,
140
+ 'focus-ring': isFocusVisible,
141
+ 'is-focused': isFocused,
142
+ 'not-removable': !isRemovable,
143
+ 'is-hovered': isHovered
144
+ }, styleProps.className)
145
+ }, /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement($68ZCu$reactspectrumutils.SlotProvider, {
146
+ slots: {
147
+ tagLabel: {
148
+ UNSAFE_className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tag-label')
149
+ },
150
+ icon: {
151
+ UNSAFE_className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tag-icon'),
152
+ size: 'XS'
153
+ },
154
+ text: {
155
+ UNSAFE_className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tag-content', {
156
+ 'tags-removable': isRemovable
157
+ })
158
+ }
159
+ }
160
+ }, typeof children === 'string' ? /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement("div", {
161
+ ref: labelRef,
162
+ ...labelProps
163
+ }, /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement($68ZCu$reactspectrumtext.Text, null, children)) : children, isRemovable && /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement($6a18f2ab7062d76e$var$TagRemoveButton, {
164
+ item: item,
165
+ ...clearButtonProps,
166
+ UNSAFE_className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tag-action')
167
+ })))));
168
+ }
169
+ function $6a18f2ab7062d76e$var$TagRemoveButton(props) {
170
+ props = $68ZCu$reactspectrumutils.useSlotProps(props, 'tagRemoveButton');
171
+ let { styleProps: styleProps } = $68ZCu$reactspectrumutils.useStyleProps(props);
172
+ let clearBtnRef = $68ZCu$react.useRef();
173
+ return(/*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement("span", {
174
+ ...styleProps,
175
+ ref: clearBtnRef
176
+ }, /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement($68ZCu$reactspectrumbutton.ClearButton, {
177
+ preventFocus: true,
178
+ ...props
179
+ })));
180
+ }
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+ function $6b983db856007a15$var$TagGroup(props, ref) {
189
+ props = $68ZCu$reactspectrumprovider.useProviderProps(props);
190
+ let { isDisabled: isDisabled , isRemovable: isRemovable , onRemove: onRemove , ...otherProps } = props;
191
+ let domRef = $68ZCu$reactspectrumutils.useDOMRef(ref);
192
+ let { styleProps: styleProps } = $68ZCu$reactspectrumutils.useStyleProps(otherProps);
193
+ let { direction: direction } = $68ZCu$reactariai18n.useLocale();
194
+ let listState = $68ZCu$reactstatelylist.useListState(props);
195
+ let gridCollection = $68ZCu$react.useMemo(()=>new $68ZCu$reactstatelygrid.GridCollection({
196
+ columnCount: isRemovable ? 2 : 1,
197
+ items: [
198
+ ...listState.collection
199
+ ].map((item)=>{
200
+ let childNodes = [
201
+ {
202
+ ...item,
203
+ index: 0,
204
+ type: 'cell'
205
+ }
206
+ ];
207
+ // add column of clear buttons if removable
208
+ if (isRemovable) childNodes.push({
209
+ key: `remove-${item.key}`,
210
+ type: 'cell',
211
+ index: 1,
212
+ value: null,
213
+ level: 0,
214
+ rendered: null,
215
+ textValue: item.textValue,
216
+ hasChildNodes: false,
217
+ childNodes: []
218
+ });
219
+ return {
220
+ type: 'item',
221
+ childNodes: childNodes
222
+ };
223
+ })
224
+ })
225
+ , [
226
+ listState.collection,
227
+ isRemovable
228
+ ]);
229
+ let state = $68ZCu$reactstatelygrid.useGridState({
230
+ ...props,
231
+ collection: gridCollection,
232
+ focusMode: 'cell'
233
+ });
234
+ let keyboardDelegate = new $68ZCu$reactariatag.TagKeyboardDelegate({
235
+ collection: state.collection,
236
+ disabledKeys: state.disabledKeys,
237
+ ref: domRef,
238
+ direction: direction,
239
+ focusMode: 'cell'
240
+ });
241
+ let { gridProps: gridProps } = $68ZCu$reactariagrid.useGrid({
242
+ ...props,
243
+ keyboardDelegate: keyboardDelegate
244
+ }, state, domRef);
245
+ const { tagGroupProps: tagGroupProps } = $68ZCu$reactariatag.useTagGroup(props, listState);
246
+ // Don't want the grid to be focusable or accessible via keyboard
247
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
248
+ let { tabIndex: tabIndex , ...otherGridProps } = gridProps;
249
+ return(/*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement("div", {
250
+ ...$68ZCu$reactariautils.mergeProps(styleProps, tagGroupProps, otherGridProps),
251
+ className: $68ZCu$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($728b12fe3f15274a$exports)), 'spectrum-Tags', {
252
+ 'is-disabled': isDisabled
253
+ }, styleProps.className),
254
+ ref: domRef
255
+ }, [
256
+ ...gridCollection
257
+ ].map((item)=>/*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).createElement($6a18f2ab7062d76e$export$3288d34c523a1192, {
258
+ ...item.childNodes[0].props,
259
+ key: item.key,
260
+ item: item,
261
+ state: state,
262
+ isDisabled: isDisabled || state.disabledKeys.has(item?.childNodes[0]?.key),
263
+ isRemovable: isRemovable,
264
+ onRemove: onRemove
265
+ }, item.childNodes[0].rendered)
266
+ )));
267
+ }
268
+ const $6b983db856007a15$export$67ea30858aaf75e3 = /*#__PURE__*/ ($parcel$interopDefault($68ZCu$react)).forwardRef($6b983db856007a15$var$TagGroup);
269
+
270
+
271
+ $parcel$exportWildcard(module.exports, $6b983db856007a15$exports);
272
+
273
+
274
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA+B;AAC/B,GAAoC;AACpC,GAA6B;AAC7B,GAAmC;AACnC,GAAsC;AACtC,GAAgC;AAChC,GAAoC;AACpC,GAAqC;AACrC,GAA4B;AAC5B,GAA4B;AAC5B,GAA6B;AAC7B,GAA4B;AAC5B,GAAwC;AACxC,GAAyC;AAC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,CAAC,EACD,UAAU,CAAC,SAAS;QAGxB,GAAG,EAAE,MAAM;OACV,CAAC;WAAG,cAAc;IAAA,CAAC,CAAC,GAAG,EAAC,IAAI,sEAC1B,yCAAG;eACE,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,KAAK;YAC5B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK;YACZ,UAAU,EAAE,UAAU,IAAI,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,GAAG;YACzE,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,QAAQ;WACjB,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ;;AAKtC,CAAC;AAED,KAAK,CAAC,yCAAS,iBAAG,sCAAK,CAAC,UAAU,CAAC,8BAAQ","sources":["packages/@react-spectrum/tag/src/index.ts","packages/@react-spectrum/tag/src/TagGroup.tsx","packages/@adobe/spectrum-css-temp/components/tags/vars.css","packages/@react-spectrum/tag/src/Tag.tsx"],"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/// <reference types=\"css-module-types\" />\n\nexport * from './TagGroup';\n","/*\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\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {GridCollection, useGridState} from '@react-stately/grid';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useMemo} from 'react';\nimport {SpectrumTagGroupProps} from '@react-types/tag';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {TagKeyboardDelegate, useTagGroup} from '@react-aria/tag';\nimport {useGrid} from '@react-aria/grid';\nimport {useListState} from '@react-stately/list';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n\nfunction TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let {\n isDisabled,\n isRemovable,\n onRemove,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n let {direction} = useLocale();\n let listState = useListState(props);\n let gridCollection = useMemo(() => new GridCollection({\n columnCount: isRemovable ? 2 : 1,\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n // add column of clear buttons if removable\n if (isRemovable) {\n childNodes.push({\n key: `remove-${item.key}`,\n type: 'cell',\n index: 1,\n value: null,\n level: 0,\n rendered: null,\n textValue: item.textValue, // TODO localize?\n hasChildNodes: false,\n childNodes: []\n });\n }\n\n return {\n type: 'item',\n childNodes\n };\n })\n }), [listState.collection, isRemovable]);\n let state = useGridState({\n ...props,\n collection: gridCollection,\n focusMode: 'cell'\n });\n let keyboardDelegate = new TagKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n ref: domRef,\n direction,\n focusMode: 'cell'\n });\n let {gridProps} = useGrid({\n ...props,\n keyboardDelegate\n }, state, domRef);\n const {tagGroupProps} = useTagGroup(props, listState);\n\n // Don't want the grid to be focusable or accessible via keyboard\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {tabIndex, ...otherGridProps} = gridProps;\n return (\n <div\n {...mergeProps(styleProps, tagGroupProps, otherGridProps)}\n className={\n classNames(\n styles,\n 'spectrum-Tags',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className\n )\n }\n ref={domRef}>\n {[...gridCollection].map(item => (\n <Tag\n {...item.childNodes[0].props}\n key={item.key}\n item={item}\n state={state}\n isDisabled={isDisabled || state.disabledKeys.has(item?.childNodes[0]?.key)}\n isRemovable={isRemovable}\n onRemove={onRemove}>\n {item.childNodes[0].rendered}\n </Tag>\n ))}\n </div>\n );\n}\n\nconst _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_TagGroup as TagGroup};\n","/*\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@import './skin.css';\n","/*\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\nimport {classNames, SlotProvider, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {ClearButton} from '@react-spectrum/button';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useRef} from 'react';\nimport {SpectrumTagProps} from '@react-types/tag';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\nimport {useTag} from '@react-aria/tag';\n\nexport function Tag<T>(props: SpectrumTagProps<T>) {\n const {\n children,\n isDisabled,\n isRemovable,\n item,\n state,\n onRemove,\n ...otherProps\n } = props;\n\n // @ts-ignore\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});\n let labelRef = useRef();\n let tagRef = useRef();\n let tagRowRef = useRef();\n let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({\n ...props,\n isDisabled,\n isFocused,\n isRemovable,\n item,\n onRemove,\n tagRef,\n tagRowRef\n }, state);\n\n return (\n <div\n {...tagRowProps}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\n role=\"gridcell\"\n className={classNames(\n styles,\n 'spectrum-Tags-item',\n {\n 'is-disabled': isDisabled,\n 'focus-ring': isFocusVisible,\n 'is-focused': isFocused,\n 'not-removable': !isRemovable,\n 'is-hovered': isHovered\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n tagLabel: {UNSAFE_className: classNames(styles, 'spectrum-Tag-label')},\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': isRemovable})}\n }}>\n {typeof children === 'string' ? <div ref={labelRef} {...labelProps}><Text>{children}</Text></div> : children}\n {isRemovable && <TagRemoveButton item={item} {...clearButtonProps} UNSAFE_className={classNames(styles, 'spectrum-Tag-action')} />}\n </SlotProvider>\n </div>\n </div>\n );\n}\n\nfunction TagRemoveButton(props) {\n props = useSlotProps(props, 'tagRemoveButton');\n let {styleProps} = useStyleProps(props);\n let clearBtnRef = useRef();\n\n return (\n <span\n {...styleProps}\n ref={clearBtnRef}>\n <ClearButton\n preventFocus\n {...props} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js ADDED
@@ -0,0 +1,258 @@
1
+ import "./main.css";
2
+ import {useDOMRef as $8BfSF$useDOMRef, useStyleProps as $8BfSF$useStyleProps, classNames as $8BfSF$classNames, SlotProvider as $8BfSF$SlotProvider, useSlotProps as $8BfSF$useSlotProps} from "@react-spectrum/utils";
3
+ import {GridCollection as $8BfSF$GridCollection, useGridState as $8BfSF$useGridState} from "@react-stately/grid";
4
+ import {mergeProps as $8BfSF$mergeProps} from "@react-aria/utils";
5
+ import $8BfSF$react, {useMemo as $8BfSF$useMemo, useRef as $8BfSF$useRef} from "react";
6
+ import {TagKeyboardDelegate as $8BfSF$TagKeyboardDelegate, useTagGroup as $8BfSF$useTagGroup, useTag as $8BfSF$useTag} from "@react-aria/tag";
7
+ import {useGrid as $8BfSF$useGrid} from "@react-aria/grid";
8
+ import {useListState as $8BfSF$useListState} from "@react-stately/list";
9
+ import {useLocale as $8BfSF$useLocale} from "@react-aria/i18n";
10
+ import {useProviderProps as $8BfSF$useProviderProps} from "@react-spectrum/provider";
11
+ import {ClearButton as $8BfSF$ClearButton} from "@react-spectrum/button";
12
+ import {Text as $8BfSF$Text} from "@react-spectrum/text";
13
+ import {useFocusRing as $8BfSF$useFocusRing} from "@react-aria/focus";
14
+ import {useHover as $8BfSF$useHover} from "@react-aria/interactions";
15
+
16
+ function $parcel$interopDefault(a) {
17
+ return a && a.__esModule ? a.default : a;
18
+ }
19
+ function $parcel$export(e, n, v, s) {
20
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
21
+ }
22
+ var $02877bb8b3187e23$exports = {};
23
+
24
+ $parcel$export($02877bb8b3187e23$exports, "TagGroup", () => $02877bb8b3187e23$export$67ea30858aaf75e3);
25
+
26
+
27
+
28
+
29
+ var $044f79fa9b1990c6$exports = {};
30
+
31
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags", () => $044f79fa9b1990c6$export$eb7e80013a1212da, (v) => $044f79fa9b1990c6$export$eb7e80013a1212da = v);
32
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags-item", () => $044f79fa9b1990c6$export$950d8dc0a3751654, (v) => $044f79fa9b1990c6$export$950d8dc0a3751654 = v);
33
+ $parcel$export($044f79fa9b1990c6$exports, "is-disabled", () => $044f79fa9b1990c6$export$d35bc1e505d1ebbf, (v) => $044f79fa9b1990c6$export$d35bc1e505d1ebbf = v);
34
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tag-icon", () => $044f79fa9b1990c6$export$21f5254139e14871, (v) => $044f79fa9b1990c6$export$21f5254139e14871 = v);
35
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tag-content", () => $044f79fa9b1990c6$export$d281c967f4ee071e, (v) => $044f79fa9b1990c6$export$d281c967f4ee071e = v);
36
+ $parcel$export($044f79fa9b1990c6$exports, "tags-removable", () => $044f79fa9b1990c6$export$7427262f66a3b803, (v) => $044f79fa9b1990c6$export$7427262f66a3b803 = v);
37
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tag-label", () => $044f79fa9b1990c6$export$7ea9e20fd4ac0076, (v) => $044f79fa9b1990c6$export$7ea9e20fd4ac0076 = v);
38
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tag-action", () => $044f79fa9b1990c6$export$c5a1243e33faa2d4, (v) => $044f79fa9b1990c6$export$c5a1243e33faa2d4 = v);
39
+ $parcel$export($044f79fa9b1990c6$exports, "is-hovered", () => $044f79fa9b1990c6$export$b8813cd5d7824ce7, (v) => $044f79fa9b1990c6$export$b8813cd5d7824ce7 = v);
40
+ $parcel$export($044f79fa9b1990c6$exports, "focus-ring", () => $044f79fa9b1990c6$export$f39a09f249340e2a, (v) => $044f79fa9b1990c6$export$f39a09f249340e2a = v);
41
+ $parcel$export($044f79fa9b1990c6$exports, "is-selected", () => $044f79fa9b1990c6$export$1e0fb04f31d3c22a, (v) => $044f79fa9b1990c6$export$1e0fb04f31d3c22a = v);
42
+ $parcel$export($044f79fa9b1990c6$exports, "is-invalid", () => $044f79fa9b1990c6$export$14a30de2866685fa, (v) => $044f79fa9b1990c6$export$14a30de2866685fa = v);
43
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags-itemIcon", () => $044f79fa9b1990c6$export$8c615c557fdf3d9c, (v) => $044f79fa9b1990c6$export$8c615c557fdf3d9c = v);
44
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags-itemLabel", () => $044f79fa9b1990c6$export$23caf26adee41b84, (v) => $044f79fa9b1990c6$export$23caf26adee41b84 = v);
45
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags-itemClearButton", () => $044f79fa9b1990c6$export$90881dd581d6be55, (v) => $044f79fa9b1990c6$export$90881dd581d6be55 = v);
46
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Avatar", () => $044f79fa9b1990c6$export$2e049b8d031600fb, (v) => $044f79fa9b1990c6$export$2e049b8d031600fb = v);
47
+ $parcel$export($044f79fa9b1990c6$exports, "spectrum-Tags-item--removable", () => $044f79fa9b1990c6$export$c1666977f4e14f87, (v) => $044f79fa9b1990c6$export$c1666977f4e14f87 = v);
48
+ $parcel$export($044f79fa9b1990c6$exports, "is-focused", () => $044f79fa9b1990c6$export$e7dc768d35940237, (v) => $044f79fa9b1990c6$export$e7dc768d35940237 = v);
49
+ var $044f79fa9b1990c6$export$eb7e80013a1212da;
50
+ var $044f79fa9b1990c6$export$950d8dc0a3751654;
51
+ var $044f79fa9b1990c6$export$d35bc1e505d1ebbf;
52
+ var $044f79fa9b1990c6$export$21f5254139e14871;
53
+ var $044f79fa9b1990c6$export$d281c967f4ee071e;
54
+ var $044f79fa9b1990c6$export$7427262f66a3b803;
55
+ var $044f79fa9b1990c6$export$7ea9e20fd4ac0076;
56
+ var $044f79fa9b1990c6$export$c5a1243e33faa2d4;
57
+ var $044f79fa9b1990c6$export$b8813cd5d7824ce7;
58
+ var $044f79fa9b1990c6$export$f39a09f249340e2a;
59
+ var $044f79fa9b1990c6$export$1e0fb04f31d3c22a;
60
+ var $044f79fa9b1990c6$export$14a30de2866685fa;
61
+ var $044f79fa9b1990c6$export$8c615c557fdf3d9c;
62
+ var $044f79fa9b1990c6$export$23caf26adee41b84;
63
+ var $044f79fa9b1990c6$export$90881dd581d6be55;
64
+ var $044f79fa9b1990c6$export$2e049b8d031600fb;
65
+ var $044f79fa9b1990c6$export$c1666977f4e14f87;
66
+ var $044f79fa9b1990c6$export$e7dc768d35940237;
67
+ $044f79fa9b1990c6$export$eb7e80013a1212da = "spectrum-Tags_8407eb";
68
+ $044f79fa9b1990c6$export$950d8dc0a3751654 = "spectrum-Tags-item_8407eb";
69
+ $044f79fa9b1990c6$export$d35bc1e505d1ebbf = "is-disabled_8407eb";
70
+ $044f79fa9b1990c6$export$21f5254139e14871 = "spectrum-Tag-icon_8407eb";
71
+ $044f79fa9b1990c6$export$d281c967f4ee071e = "spectrum-Tag-content_8407eb";
72
+ $044f79fa9b1990c6$export$7427262f66a3b803 = "tags-removable_8407eb";
73
+ $044f79fa9b1990c6$export$7ea9e20fd4ac0076 = "spectrum-Tag-label_8407eb";
74
+ $044f79fa9b1990c6$export$c5a1243e33faa2d4 = "spectrum-Tag-action_8407eb";
75
+ $044f79fa9b1990c6$export$b8813cd5d7824ce7 = "is-hovered_8407eb";
76
+ $044f79fa9b1990c6$export$f39a09f249340e2a = "focus-ring_8407eb";
77
+ $044f79fa9b1990c6$export$1e0fb04f31d3c22a = "is-selected_8407eb";
78
+ $044f79fa9b1990c6$export$14a30de2866685fa = "is-invalid_8407eb";
79
+ $044f79fa9b1990c6$export$8c615c557fdf3d9c = "spectrum-Tags-itemIcon_8407eb";
80
+ $044f79fa9b1990c6$export$23caf26adee41b84 = "spectrum-Tags-itemLabel_8407eb";
81
+ $044f79fa9b1990c6$export$90881dd581d6be55 = "spectrum-Tags-itemClearButton_8407eb";
82
+ $044f79fa9b1990c6$export$2e049b8d031600fb = "spectrum-Avatar_8407eb";
83
+ $044f79fa9b1990c6$export$c1666977f4e14f87 = "spectrum-Tags-item--removable_8407eb";
84
+ $044f79fa9b1990c6$export$e7dc768d35940237 = "is-focused_8407eb";
85
+
86
+
87
+
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+ function $269f970a87c4d3b3$export$3288d34c523a1192(props) {
97
+ const { children: children , isDisabled: isDisabled , isRemovable: isRemovable , item: item , state: state , onRemove: onRemove , ...otherProps } = props;
98
+ // @ts-ignore
99
+ let { styleProps: styleProps } = $8BfSF$useStyleProps(otherProps);
100
+ let { hoverProps: hoverProps , isHovered: isHovered } = $8BfSF$useHover({
101
+ isDisabled: isDisabled
102
+ });
103
+ let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = $8BfSF$useFocusRing({
104
+ within: true
105
+ });
106
+ let labelRef = $8BfSF$useRef();
107
+ let tagRef = $8BfSF$useRef();
108
+ let tagRowRef = $8BfSF$useRef();
109
+ let { clearButtonProps: clearButtonProps , labelProps: labelProps , tagProps: tagProps , tagRowProps: tagRowProps } = $8BfSF$useTag({
110
+ ...props,
111
+ isDisabled: isDisabled,
112
+ isFocused: isFocused,
113
+ isRemovable: isRemovable,
114
+ item: item,
115
+ onRemove: onRemove,
116
+ tagRef: tagRef,
117
+ tagRowRef: tagRowRef
118
+ }, state);
119
+ return(/*#__PURE__*/ $8BfSF$react.createElement("div", tagRowProps, /*#__PURE__*/ $8BfSF$react.createElement("div", {
120
+ ...$8BfSF$mergeProps(tagProps, hoverProps, focusProps),
121
+ role: "gridcell",
122
+ className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tags-item', {
123
+ 'is-disabled': isDisabled,
124
+ 'focus-ring': isFocusVisible,
125
+ 'is-focused': isFocused,
126
+ 'not-removable': !isRemovable,
127
+ 'is-hovered': isHovered
128
+ }, styleProps.className)
129
+ }, /*#__PURE__*/ $8BfSF$react.createElement($8BfSF$SlotProvider, {
130
+ slots: {
131
+ tagLabel: {
132
+ UNSAFE_className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tag-label')
133
+ },
134
+ icon: {
135
+ UNSAFE_className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tag-icon'),
136
+ size: 'XS'
137
+ },
138
+ text: {
139
+ UNSAFE_className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tag-content', {
140
+ 'tags-removable': isRemovable
141
+ })
142
+ }
143
+ }
144
+ }, typeof children === 'string' ? /*#__PURE__*/ $8BfSF$react.createElement("div", {
145
+ ref: labelRef,
146
+ ...labelProps
147
+ }, /*#__PURE__*/ $8BfSF$react.createElement($8BfSF$Text, null, children)) : children, isRemovable && /*#__PURE__*/ $8BfSF$react.createElement($269f970a87c4d3b3$var$TagRemoveButton, {
148
+ item: item,
149
+ ...clearButtonProps,
150
+ UNSAFE_className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tag-action')
151
+ })))));
152
+ }
153
+ function $269f970a87c4d3b3$var$TagRemoveButton(props) {
154
+ props = $8BfSF$useSlotProps(props, 'tagRemoveButton');
155
+ let { styleProps: styleProps } = $8BfSF$useStyleProps(props);
156
+ let clearBtnRef = $8BfSF$useRef();
157
+ return(/*#__PURE__*/ $8BfSF$react.createElement("span", {
158
+ ...styleProps,
159
+ ref: clearBtnRef
160
+ }, /*#__PURE__*/ $8BfSF$react.createElement($8BfSF$ClearButton, {
161
+ preventFocus: true,
162
+ ...props
163
+ })));
164
+ }
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+ function $02877bb8b3187e23$var$TagGroup(props, ref) {
173
+ props = $8BfSF$useProviderProps(props);
174
+ let { isDisabled: isDisabled , isRemovable: isRemovable , onRemove: onRemove , ...otherProps } = props;
175
+ let domRef = $8BfSF$useDOMRef(ref);
176
+ let { styleProps: styleProps } = $8BfSF$useStyleProps(otherProps);
177
+ let { direction: direction } = $8BfSF$useLocale();
178
+ let listState = $8BfSF$useListState(props);
179
+ let gridCollection = $8BfSF$useMemo(()=>new $8BfSF$GridCollection({
180
+ columnCount: isRemovable ? 2 : 1,
181
+ items: [
182
+ ...listState.collection
183
+ ].map((item)=>{
184
+ let childNodes = [
185
+ {
186
+ ...item,
187
+ index: 0,
188
+ type: 'cell'
189
+ }
190
+ ];
191
+ // add column of clear buttons if removable
192
+ if (isRemovable) childNodes.push({
193
+ key: `remove-${item.key}`,
194
+ type: 'cell',
195
+ index: 1,
196
+ value: null,
197
+ level: 0,
198
+ rendered: null,
199
+ textValue: item.textValue,
200
+ hasChildNodes: false,
201
+ childNodes: []
202
+ });
203
+ return {
204
+ type: 'item',
205
+ childNodes: childNodes
206
+ };
207
+ })
208
+ })
209
+ , [
210
+ listState.collection,
211
+ isRemovable
212
+ ]);
213
+ let state = $8BfSF$useGridState({
214
+ ...props,
215
+ collection: gridCollection,
216
+ focusMode: 'cell'
217
+ });
218
+ let keyboardDelegate = new $8BfSF$TagKeyboardDelegate({
219
+ collection: state.collection,
220
+ disabledKeys: state.disabledKeys,
221
+ ref: domRef,
222
+ direction: direction,
223
+ focusMode: 'cell'
224
+ });
225
+ let { gridProps: gridProps } = $8BfSF$useGrid({
226
+ ...props,
227
+ keyboardDelegate: keyboardDelegate
228
+ }, state, domRef);
229
+ const { tagGroupProps: tagGroupProps } = $8BfSF$useTagGroup(props, listState);
230
+ // Don't want the grid to be focusable or accessible via keyboard
231
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
232
+ let { tabIndex: tabIndex , ...otherGridProps } = gridProps;
233
+ return(/*#__PURE__*/ $8BfSF$react.createElement("div", {
234
+ ...$8BfSF$mergeProps(styleProps, tagGroupProps, otherGridProps),
235
+ className: $8BfSF$classNames((/*@__PURE__*/$parcel$interopDefault($044f79fa9b1990c6$exports)), 'spectrum-Tags', {
236
+ 'is-disabled': isDisabled
237
+ }, styleProps.className),
238
+ ref: domRef
239
+ }, [
240
+ ...gridCollection
241
+ ].map((item)=>/*#__PURE__*/ $8BfSF$react.createElement($269f970a87c4d3b3$export$3288d34c523a1192, {
242
+ ...item.childNodes[0].props,
243
+ key: item.key,
244
+ item: item,
245
+ state: state,
246
+ isDisabled: isDisabled || state.disabledKeys.has(item?.childNodes[0]?.key),
247
+ isRemovable: isRemovable,
248
+ onRemove: onRemove
249
+ }, item.childNodes[0].rendered)
250
+ )));
251
+ }
252
+ const $02877bb8b3187e23$export$67ea30858aaf75e3 = /*#__PURE__*/ $8BfSF$react.forwardRef($02877bb8b3187e23$var$TagGroup);
253
+
254
+
255
+
256
+
257
+ export {$02877bb8b3187e23$export$67ea30858aaf75e3 as TagGroup};
258
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA+B;AAC/B,GAAoC;AACpC,GAA6B;AAC7B,GAAmC;AACnC,GAAsC;AACtC,GAAgC;AAChC,GAAoC;AACpC,GAAqC;AACrC,GAA4B;AAC5B,GAA4B;AAC5B,GAA6B;AAC7B,GAA4B;AAC5B,GAAwC;AACxC,GAAyC;AACzC,GAA+C;AAC/C,GAAiC;AACjC,GAA+C;AAC/C,GAA4B;AAjB5B,yCAA+B,GAAG,CAAsB;AACxD,yCAAoC,GAAG,CAA2B;AAClE,yCAA6B,GAAG,CAAoB;AACpD,yCAAmC,GAAG,CAA0B;AAChE,yCAAsC,GAAG,CAA6B;AACtE,yCAAgC,GAAG,CAAuB;AAC1D,yCAAoC,GAAG,CAA2B;AAClE,yCAAqC,GAAG,CAA4B;AACpE,yCAA4B,GAAG,CAAmB;AAClD,yCAA4B,GAAG,CAAmB;AAClD,yCAA6B,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AG,GAAG;YACzE,WAAW,EAAE,WAAW;YACxB,QAAQ,EAAE,QAAQ;WACjB,IAAI,CAAC,UAAU,CAAC,CAAC,EAAE,QAAQ;;AAKtC,CAAC;AAED,KAAK,CAAC,yCAAS,iBAAG,YAAK,CAAC,UAAU,CAAC,8BAAQ","sources":["packages/@react-spectrum/tag/src/index.ts","packages/@react-spectrum/tag/src/TagGroup.tsx","packages/@adobe/spectrum-css-temp/components/tags/vars.css","packages/@react-spectrum/tag/src/Tag.tsx"],"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/// <reference types=\"css-module-types\" />\n\nexport * from './TagGroup';\n","/*\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\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef} from '@react-types/shared';\nimport {GridCollection, useGridState} from '@react-stately/grid';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {ReactElement, useMemo} from 'react';\nimport {SpectrumTagGroupProps} from '@react-types/tag';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Tag} from './Tag';\nimport {TagKeyboardDelegate, useTagGroup} from '@react-aria/tag';\nimport {useGrid} from '@react-aria/grid';\nimport {useListState} from '@react-stately/list';\nimport {useLocale} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\n\nfunction TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {\n props = useProviderProps(props);\n let {\n isDisabled,\n isRemovable,\n onRemove,\n ...otherProps\n } = props;\n let domRef = useDOMRef(ref);\n let {styleProps} = useStyleProps(otherProps);\n let {direction} = useLocale();\n let listState = useListState(props);\n let gridCollection = useMemo(() => new GridCollection({\n columnCount: isRemovable ? 2 : 1,\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n // add column of clear buttons if removable\n if (isRemovable) {\n childNodes.push({\n key: `remove-${item.key}`,\n type: 'cell',\n index: 1,\n value: null,\n level: 0,\n rendered: null,\n textValue: item.textValue, // TODO localize?\n hasChildNodes: false,\n childNodes: []\n });\n }\n\n return {\n type: 'item',\n childNodes\n };\n })\n }), [listState.collection, isRemovable]);\n let state = useGridState({\n ...props,\n collection: gridCollection,\n focusMode: 'cell'\n });\n let keyboardDelegate = new TagKeyboardDelegate({\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n ref: domRef,\n direction,\n focusMode: 'cell'\n });\n let {gridProps} = useGrid({\n ...props,\n keyboardDelegate\n }, state, domRef);\n const {tagGroupProps} = useTagGroup(props, listState);\n\n // Don't want the grid to be focusable or accessible via keyboard\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n let {tabIndex, ...otherGridProps} = gridProps;\n return (\n <div\n {...mergeProps(styleProps, tagGroupProps, otherGridProps)}\n className={\n classNames(\n styles,\n 'spectrum-Tags',\n {\n 'is-disabled': isDisabled\n },\n styleProps.className\n )\n }\n ref={domRef}>\n {[...gridCollection].map(item => (\n <Tag\n {...item.childNodes[0].props}\n key={item.key}\n item={item}\n state={state}\n isDisabled={isDisabled || state.disabledKeys.has(item?.childNodes[0]?.key)}\n isRemovable={isRemovable}\n onRemove={onRemove}>\n {item.childNodes[0].rendered}\n </Tag>\n ))}\n </div>\n );\n}\n\nconst _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_TagGroup as TagGroup};\n","/*\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@import './skin.css';\n","/*\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\nimport {classNames, SlotProvider, useSlotProps, useStyleProps} from '@react-spectrum/utils';\nimport {ClearButton} from '@react-spectrum/button';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {useRef} from 'react';\nimport {SpectrumTagProps} from '@react-types/tag';\nimport styles from '@adobe/spectrum-css-temp/components/tags/vars.css';\nimport {Text} from '@react-spectrum/text';\nimport {useFocusRing} from '@react-aria/focus';\nimport {useHover} from '@react-aria/interactions';\nimport {useTag} from '@react-aria/tag';\n\nexport function Tag<T>(props: SpectrumTagProps<T>) {\n const {\n children,\n isDisabled,\n isRemovable,\n item,\n state,\n onRemove,\n ...otherProps\n } = props;\n\n // @ts-ignore\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({isDisabled});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});\n let labelRef = useRef();\n let tagRef = useRef();\n let tagRowRef = useRef();\n let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({\n ...props,\n isDisabled,\n isFocused,\n isRemovable,\n item,\n onRemove,\n tagRef,\n tagRowRef\n }, state);\n\n return (\n <div\n {...tagRowProps}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\n role=\"gridcell\"\n className={classNames(\n styles,\n 'spectrum-Tags-item',\n {\n 'is-disabled': isDisabled,\n 'focus-ring': isFocusVisible,\n 'is-focused': isFocused,\n 'not-removable': !isRemovable,\n 'is-hovered': isHovered\n },\n styleProps.className\n )}>\n <SlotProvider\n slots={{\n tagLabel: {UNSAFE_className: classNames(styles, 'spectrum-Tag-label')},\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': isRemovable})}\n }}>\n {typeof children === 'string' ? <div ref={labelRef} {...labelProps}><Text>{children}</Text></div> : children}\n {isRemovable && <TagRemoveButton item={item} {...clearButtonProps} UNSAFE_className={classNames(styles, 'spectrum-Tag-action')} />}\n </SlotProvider>\n </div>\n </div>\n );\n}\n\nfunction TagRemoveButton(props) {\n props = useSlotProps(props, 'tagRemoveButton');\n let {styleProps} = useStyleProps(props);\n let clearBtnRef = useRef();\n\n return (\n <span\n {...styleProps}\n ref={clearBtnRef}>\n <ClearButton\n preventFocus\n {...props} />\n </span>\n );\n}\n"],"names":[],"version":3,"file":"module.js.map"}
@@ -0,0 +1,8 @@
1
+ import { DOMRef } from "@react-types/shared";
2
+ import { ReactElement } from "react";
3
+ import { SpectrumTagGroupProps } from "@react-types/tag";
4
+ export const TagGroup: <T>(props: SpectrumTagGroupProps<T> & {
5
+ ref?: DOMRef<HTMLDivElement>;
6
+ }) => ReactElement;
7
+
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;ACwHA,OAAA,MAAM;UAAuF,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC","sources":["packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/Tag.tsx","packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/TagGroup.tsx","packages/@react-spectrum/tag/src/packages/@react-spectrum/tag/src/index.ts","packages/@react-spectrum/tag/src/index.ts"],"sourcesContent":[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 * from './TagGroup';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@react-spectrum/tag",
3
+ "version": "3.0.0-alpha.0",
4
+ "description": "Spectrum UI components in React",
5
+ "license": "Apache-2.0",
6
+ "main": "dist/main.js",
7
+ "module": "dist/module.js",
8
+ "types": "dist/types.d.ts",
9
+ "source": "src/index.ts",
10
+ "files": [
11
+ "dist",
12
+ "src"
13
+ ],
14
+ "sideEffects": [
15
+ "*.css"
16
+ ],
17
+ "targets": {
18
+ "main": {
19
+ "includeNodeModules": [
20
+ "@adobe/spectrum-css-temp"
21
+ ]
22
+ },
23
+ "module": {
24
+ "includeNodeModules": [
25
+ "@adobe/spectrum-css-temp"
26
+ ]
27
+ }
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "https://github.com/adobe/react-spectrum"
32
+ },
33
+ "dependencies": {
34
+ "@babel/runtime": "^7.6.2",
35
+ "@react-aria/focus": "^3.1.0",
36
+ "@react-aria/grid": "^3.0.0",
37
+ "@react-aria/i18n": "^3.3.1",
38
+ "@react-aria/interactions": "^3.1.0",
39
+ "@react-aria/tag": "3.0.0-alpha.0",
40
+ "@react-aria/utils": "^3.1.0",
41
+ "@react-spectrum/button": "^3.1.0",
42
+ "@react-spectrum/text": "^3.1.2",
43
+ "@react-spectrum/utils": "^3.1.0",
44
+ "@react-stately/collections": "^3.3.2",
45
+ "@react-stately/grid": "^3.0.0",
46
+ "@react-stately/list": "^3.3.0",
47
+ "@react-types/shared": "^3.1.0",
48
+ "@react-types/tag": "3.0.0-alpha.0",
49
+ "@spectrum-icons/workflow": "^3.1.0"
50
+ },
51
+ "devDependencies": {
52
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
53
+ },
54
+ "peerDependencies": {
55
+ "@react-spectrum/provider": "^3.0.0",
56
+ "react": "^16.8.0 || ^17.0.0-rc.1"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "gitHead": "54c2366c4f31bd4bf619126131cd583c12972acc"
62
+ }
package/src/Tag.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 {classNames, SlotProvider, useSlotProps, useStyleProps} from '@react-spectrum/utils';
14
+ import {ClearButton} from '@react-spectrum/button';
15
+ import {mergeProps} from '@react-aria/utils';
16
+ import React, {useRef} from 'react';
17
+ import {SpectrumTagProps} from '@react-types/tag';
18
+ import styles from '@adobe/spectrum-css-temp/components/tags/vars.css';
19
+ import {Text} from '@react-spectrum/text';
20
+ import {useFocusRing} from '@react-aria/focus';
21
+ import {useHover} from '@react-aria/interactions';
22
+ import {useTag} from '@react-aria/tag';
23
+
24
+ export function Tag<T>(props: SpectrumTagProps<T>) {
25
+ const {
26
+ children,
27
+ isDisabled,
28
+ isRemovable,
29
+ item,
30
+ state,
31
+ onRemove,
32
+ ...otherProps
33
+ } = props;
34
+
35
+ // @ts-ignore
36
+ let {styleProps} = useStyleProps(otherProps);
37
+ let {hoverProps, isHovered} = useHover({isDisabled});
38
+ let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});
39
+ let labelRef = useRef();
40
+ let tagRef = useRef();
41
+ let tagRowRef = useRef();
42
+ let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({
43
+ ...props,
44
+ isDisabled,
45
+ isFocused,
46
+ isRemovable,
47
+ item,
48
+ onRemove,
49
+ tagRef,
50
+ tagRowRef
51
+ }, state);
52
+
53
+ return (
54
+ <div
55
+ {...tagRowProps}>
56
+ <div
57
+ {...mergeProps(tagProps, hoverProps, focusProps)}
58
+ role="gridcell"
59
+ className={classNames(
60
+ styles,
61
+ 'spectrum-Tags-item',
62
+ {
63
+ 'is-disabled': isDisabled,
64
+ 'focus-ring': isFocusVisible,
65
+ 'is-focused': isFocused,
66
+ 'not-removable': !isRemovable,
67
+ 'is-hovered': isHovered
68
+ },
69
+ styleProps.className
70
+ )}>
71
+ <SlotProvider
72
+ slots={{
73
+ tagLabel: {UNSAFE_className: classNames(styles, 'spectrum-Tag-label')},
74
+ icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},
75
+ text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': isRemovable})}
76
+ }}>
77
+ {typeof children === 'string' ? <div ref={labelRef} {...labelProps}><Text>{children}</Text></div> : children}
78
+ {isRemovable && <TagRemoveButton item={item} {...clearButtonProps} UNSAFE_className={classNames(styles, 'spectrum-Tag-action')} />}
79
+ </SlotProvider>
80
+ </div>
81
+ </div>
82
+ );
83
+ }
84
+
85
+ function TagRemoveButton(props) {
86
+ props = useSlotProps(props, 'tagRemoveButton');
87
+ let {styleProps} = useStyleProps(props);
88
+ let clearBtnRef = useRef();
89
+
90
+ return (
91
+ <span
92
+ {...styleProps}
93
+ ref={clearBtnRef}>
94
+ <ClearButton
95
+ preventFocus
96
+ {...props} />
97
+ </span>
98
+ );
99
+ }
@@ -0,0 +1,122 @@
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 {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';
14
+ import {DOMRef} from '@react-types/shared';
15
+ import {GridCollection, useGridState} from '@react-stately/grid';
16
+ import {mergeProps} from '@react-aria/utils';
17
+ import React, {ReactElement, useMemo} from 'react';
18
+ import {SpectrumTagGroupProps} from '@react-types/tag';
19
+ import styles from '@adobe/spectrum-css-temp/components/tags/vars.css';
20
+ import {Tag} from './Tag';
21
+ import {TagKeyboardDelegate, useTagGroup} from '@react-aria/tag';
22
+ import {useGrid} from '@react-aria/grid';
23
+ import {useListState} from '@react-stately/list';
24
+ import {useLocale} from '@react-aria/i18n';
25
+ import {useProviderProps} from '@react-spectrum/provider';
26
+
27
+
28
+ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {
29
+ props = useProviderProps(props);
30
+ let {
31
+ isDisabled,
32
+ isRemovable,
33
+ onRemove,
34
+ ...otherProps
35
+ } = props;
36
+ let domRef = useDOMRef(ref);
37
+ let {styleProps} = useStyleProps(otherProps);
38
+ let {direction} = useLocale();
39
+ let listState = useListState(props);
40
+ let gridCollection = useMemo(() => new GridCollection({
41
+ columnCount: isRemovable ? 2 : 1,
42
+ items: [...listState.collection].map(item => {
43
+ let childNodes = [{
44
+ ...item,
45
+ index: 0,
46
+ type: 'cell'
47
+ }];
48
+
49
+ // add column of clear buttons if removable
50
+ if (isRemovable) {
51
+ childNodes.push({
52
+ key: `remove-${item.key}`,
53
+ type: 'cell',
54
+ index: 1,
55
+ value: null,
56
+ level: 0,
57
+ rendered: null,
58
+ textValue: item.textValue, // TODO localize?
59
+ hasChildNodes: false,
60
+ childNodes: []
61
+ });
62
+ }
63
+
64
+ return {
65
+ type: 'item',
66
+ childNodes
67
+ };
68
+ })
69
+ }), [listState.collection, isRemovable]);
70
+ let state = useGridState({
71
+ ...props,
72
+ collection: gridCollection,
73
+ focusMode: 'cell'
74
+ });
75
+ let keyboardDelegate = new TagKeyboardDelegate({
76
+ collection: state.collection,
77
+ disabledKeys: state.disabledKeys,
78
+ ref: domRef,
79
+ direction,
80
+ focusMode: 'cell'
81
+ });
82
+ let {gridProps} = useGrid({
83
+ ...props,
84
+ keyboardDelegate
85
+ }, state, domRef);
86
+ const {tagGroupProps} = useTagGroup(props, listState);
87
+
88
+ // Don't want the grid to be focusable or accessible via keyboard
89
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
90
+ let {tabIndex, ...otherGridProps} = gridProps;
91
+ return (
92
+ <div
93
+ {...mergeProps(styleProps, tagGroupProps, otherGridProps)}
94
+ className={
95
+ classNames(
96
+ styles,
97
+ 'spectrum-Tags',
98
+ {
99
+ 'is-disabled': isDisabled
100
+ },
101
+ styleProps.className
102
+ )
103
+ }
104
+ ref={domRef}>
105
+ {[...gridCollection].map(item => (
106
+ <Tag
107
+ {...item.childNodes[0].props}
108
+ key={item.key}
109
+ item={item}
110
+ state={state}
111
+ isDisabled={isDisabled || state.disabledKeys.has(item?.childNodes[0]?.key)}
112
+ isRemovable={isRemovable}
113
+ onRemove={onRemove}>
114
+ {item.childNodes[0].rendered}
115
+ </Tag>
116
+ ))}
117
+ </div>
118
+ );
119
+ }
120
+
121
+ const _TagGroup = React.forwardRef(TagGroup) as <T>(props: SpectrumTagGroupProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;
122
+ export {_TagGroup as TagGroup};
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
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 * from './TagGroup';