@react-spectrum/tag 3.0.0-nightly.1847 → 3.0.0-nightly.1852
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +15 -24
- package/dist/main.js.map +1 -1
- package/dist/module.js +15 -24
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/Tag.tsx +5 -9
- package/src/TagGroup.tsx +5 -10
package/dist/main.js
CHANGED
|
@@ -92,11 +92,10 @@ $ed889f8f1f091fc8$export$e7dc768d35940237 = "is-focused_8407eb";
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
function $dd2c5d00108c1840$export$3288d34c523a1192(props) {
|
|
95
|
-
const { children: children ,
|
|
95
|
+
const { children: children , allowsRemoving: allowsRemoving , item: item , state: state , onRemove: onRemove , ...otherProps } = props;
|
|
96
96
|
// @ts-ignore
|
|
97
97
|
let { styleProps: styleProps } = $dTV3V$reactspectrumutils.useStyleProps(otherProps);
|
|
98
98
|
let { hoverProps: hoverProps , isHovered: isHovered } = $dTV3V$reactariainteractions.useHover({
|
|
99
|
-
isDisabled: isDisabled
|
|
100
99
|
});
|
|
101
100
|
let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = $dTV3V$reactariafocus.useFocusRing({
|
|
102
101
|
within: true
|
|
@@ -105,9 +104,8 @@ function $dd2c5d00108c1840$export$3288d34c523a1192(props) {
|
|
|
105
104
|
let tagRowRef = $dTV3V$react.useRef();
|
|
106
105
|
let { clearButtonProps: clearButtonProps , labelProps: labelProps , tagProps: tagProps , tagRowProps: tagRowProps } = $dTV3V$reactariatag.useTag({
|
|
107
106
|
...props,
|
|
108
|
-
isDisabled: isDisabled,
|
|
109
107
|
isFocused: isFocused,
|
|
110
|
-
|
|
108
|
+
allowsRemoving: allowsRemoving,
|
|
111
109
|
item: item,
|
|
112
110
|
onRemove: onRemove,
|
|
113
111
|
tagRef: tagRef,
|
|
@@ -119,10 +117,8 @@ function $dd2c5d00108c1840$export$3288d34c523a1192(props) {
|
|
|
119
117
|
}, /*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement("div", {
|
|
120
118
|
...$dTV3V$reactariautils.mergeProps(tagProps, hoverProps, focusProps),
|
|
121
119
|
className: $dTV3V$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ed889f8f1f091fc8$exports)), 'spectrum-Tags-item', {
|
|
122
|
-
'is-disabled': isDisabled,
|
|
123
120
|
'focus-ring': isFocusVisible,
|
|
124
121
|
'is-focused': isFocused,
|
|
125
|
-
'not-removable': !isRemovable,
|
|
126
122
|
'is-hovered': isHovered
|
|
127
123
|
}, styleProps.className),
|
|
128
124
|
ref: tagRef
|
|
@@ -134,12 +130,12 @@ function $dd2c5d00108c1840$export$3288d34c523a1192(props) {
|
|
|
134
130
|
},
|
|
135
131
|
text: {
|
|
136
132
|
UNSAFE_className: $dTV3V$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ed889f8f1f091fc8$exports)), 'spectrum-Tag-content', {
|
|
137
|
-
'tags-removable':
|
|
133
|
+
'tags-removable': allowsRemoving
|
|
138
134
|
}),
|
|
139
135
|
...labelProps
|
|
140
136
|
}
|
|
141
137
|
}
|
|
142
|
-
}, typeof children === 'string' ? /*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement($dTV3V$reactspectrumtext.Text, null, children) : children,
|
|
138
|
+
}, typeof children === 'string' ? /*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement($dTV3V$reactspectrumtext.Text, null, children) : children, allowsRemoving && /*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement($dd2c5d00108c1840$var$TagRemoveButton, {
|
|
143
139
|
item: item,
|
|
144
140
|
...clearButtonProps,
|
|
145
141
|
UNSAFE_className: $dTV3V$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ed889f8f1f091fc8$exports)), 'spectrum-Tag-action')
|
|
@@ -164,10 +160,10 @@ function $dd2c5d00108c1840$var$TagRemoveButton(props) {
|
|
|
164
160
|
|
|
165
161
|
|
|
166
162
|
|
|
167
|
-
function $e7b72d8874e98cd4$var$TagGroup(props,
|
|
163
|
+
function $e7b72d8874e98cd4$var$TagGroup(props, ref) {
|
|
168
164
|
props = $dTV3V$reactspectrumprovider.useProviderProps(props);
|
|
169
|
-
let {
|
|
170
|
-
let domRef = $dTV3V$reactspectrumutils.useDOMRef(
|
|
165
|
+
let { allowsRemoving: allowsRemoving , onRemove: onRemove , ...otherProps } = props;
|
|
166
|
+
let domRef = $dTV3V$reactspectrumutils.useDOMRef(ref);
|
|
171
167
|
let { styleProps: styleProps } = $dTV3V$reactspectrumutils.useStyleProps(otherProps);
|
|
172
168
|
let { direction: direction } = $dTV3V$reactariai18n.useLocale();
|
|
173
169
|
let listState = $dTV3V$reactstatelylist.useListState(props);
|
|
@@ -191,7 +187,7 @@ function $e7b72d8874e98cd4$var$TagGroup(props, ref1) {
|
|
|
191
187
|
})
|
|
192
188
|
, [
|
|
193
189
|
listState.collection,
|
|
194
|
-
|
|
190
|
+
allowsRemoving
|
|
195
191
|
]);
|
|
196
192
|
let state = $dTV3V$reactstatelygrid.useGridState({
|
|
197
193
|
...props,
|
|
@@ -200,7 +196,7 @@ function $e7b72d8874e98cd4$var$TagGroup(props, ref1) {
|
|
|
200
196
|
});
|
|
201
197
|
let keyboardDelegate = new $dTV3V$reactariatag.TagKeyboardDelegate({
|
|
202
198
|
collection: state.collection,
|
|
203
|
-
disabledKeys:
|
|
199
|
+
disabledKeys: new Set(),
|
|
204
200
|
ref: domRef,
|
|
205
201
|
direction: direction,
|
|
206
202
|
focusMode: 'cell'
|
|
@@ -209,31 +205,26 @@ function $e7b72d8874e98cd4$var$TagGroup(props, ref1) {
|
|
|
209
205
|
...props,
|
|
210
206
|
keyboardDelegate: keyboardDelegate
|
|
211
207
|
}, state, domRef);
|
|
212
|
-
const { tagGroupProps: tagGroupProps } = $dTV3V$reactariatag.useTagGroup(props
|
|
208
|
+
const { tagGroupProps: tagGroupProps } = $dTV3V$reactariatag.useTagGroup(props);
|
|
213
209
|
// Don't want the grid to be focusable or accessible via keyboard
|
|
214
210
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
215
211
|
let { tabIndex: tabIndex , role: role , ...otherGridProps } = gridProps;
|
|
216
212
|
return(/*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement("div", {
|
|
217
213
|
...$dTV3V$reactariautils.mergeProps(styleProps, tagGroupProps, otherGridProps),
|
|
218
|
-
className: $dTV3V$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ed889f8f1f091fc8$exports)), 'spectrum-Tags',
|
|
219
|
-
'is-disabled': isDisabled
|
|
220
|
-
}, styleProps.className),
|
|
214
|
+
className: $dTV3V$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($ed889f8f1f091fc8$exports)), 'spectrum-Tags', styleProps.className),
|
|
221
215
|
role: state.collection.size ? 'grid' : null,
|
|
222
216
|
ref: domRef
|
|
223
217
|
}, [
|
|
224
218
|
...gridCollection
|
|
225
|
-
].map((item)
|
|
226
|
-
var ref;
|
|
227
|
-
return(/*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement($dd2c5d00108c1840$export$3288d34c523a1192, {
|
|
219
|
+
].map((item)=>/*#__PURE__*/ ($parcel$interopDefault($dTV3V$react)).createElement($dd2c5d00108c1840$export$3288d34c523a1192, {
|
|
228
220
|
...item.childNodes[0].props,
|
|
229
221
|
key: item.key,
|
|
230
222
|
item: item,
|
|
231
223
|
state: state,
|
|
232
|
-
|
|
233
|
-
isRemovable: isRemovable,
|
|
224
|
+
allowsRemoving: allowsRemoving,
|
|
234
225
|
onRemove: onRemove
|
|
235
|
-
}, item.childNodes[0].rendered)
|
|
236
|
-
|
|
226
|
+
}, item.childNodes[0].rendered)
|
|
227
|
+
)));
|
|
237
228
|
}
|
|
238
229
|
const $e7b72d8874e98cd4$export$67ea30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AC,CAAC,GAAG,EAAC,IAAI;;kFAC1B,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,QAAC,IAAI,aAAJ,IAAI,KAAJ,IAAI,CAAJ,CAAgB,GAAhB,IAAI,CAAJ,CAAgB,GAAhB,IAAI,CAAE,UAAU,CAAC,CAAC,uBAAlB,IAAI,CAAJ,CAAwB,GAAxB,IAAI,CAAJ,CAAwB,OAAH,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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from '@react-types/tag';\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: 1, // unused, but required for grid collections\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n return {\n type: 'item',\n childNodes\n };\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\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, role, ...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 role={state.collection.size ? 'grid' : null}\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 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 ref={tagRowRef}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\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 ref={tagRef}>\n <SlotProvider\n slots={{\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': isRemovable}), ...labelProps}\n }}>\n\n {typeof children === 'string' ? <Text>{children}</Text> : 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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AI,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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from '@react-types/tag';\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 allowsRemoving,\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: 1, // unused, but required for grid collections\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n return {\n type: 'item',\n childNodes\n };\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [listState.collection, allowsRemoving]);\n let state = useGridState({\n ...props,\n collection: gridCollection,\n focusMode: 'cell'\n });\n let keyboardDelegate = new TagKeyboardDelegate({\n collection: state.collection,\n disabledKeys: new Set(),\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);\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, role, ...otherGridProps} = gridProps;\n return (\n <div\n {...mergeProps(styleProps, tagGroupProps, otherGridProps)}\n className={\n classNames(\n styles,\n 'spectrum-Tags',\n styleProps.className\n )\n }\n role={state.collection.size ? 'grid' : null}\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 allowsRemoving={allowsRemoving}\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 allowsRemoving,\n item,\n state,\n onRemove,\n ...otherProps\n } = props;\n\n // @ts-ignore\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});\n let tagRef = useRef();\n let tagRowRef = useRef();\n let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({\n ...props,\n isFocused,\n allowsRemoving,\n item,\n onRemove,\n tagRef,\n tagRowRef\n }, state);\n\n return (\n <div\n {...tagRowProps}\n ref={tagRowRef}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\n className={classNames(\n styles,\n 'spectrum-Tags-item',\n {\n 'focus-ring': isFocusVisible,\n 'is-focused': isFocused,\n 'is-hovered': isHovered\n },\n styleProps.className\n )}\n ref={tagRef}>\n <SlotProvider\n slots={{\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': allowsRemoving}), ...labelProps}\n }}>\n\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {allowsRemoving && <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
CHANGED
|
@@ -89,11 +89,10 @@ $c033a7c057e84ef1$export$e7dc768d35940237 = "is-focused_8407eb";
|
|
|
89
89
|
|
|
90
90
|
|
|
91
91
|
function $b5f5ee35d3b6b95c$export$3288d34c523a1192(props) {
|
|
92
|
-
const { children: children ,
|
|
92
|
+
const { children: children , allowsRemoving: allowsRemoving , item: item , state: state , onRemove: onRemove , ...otherProps } = props;
|
|
93
93
|
// @ts-ignore
|
|
94
94
|
let { styleProps: styleProps } = $fUaQ2$useStyleProps(otherProps);
|
|
95
95
|
let { hoverProps: hoverProps , isHovered: isHovered } = $fUaQ2$useHover({
|
|
96
|
-
isDisabled: isDisabled
|
|
97
96
|
});
|
|
98
97
|
let { isFocused: isFocused , isFocusVisible: isFocusVisible , focusProps: focusProps } = $fUaQ2$useFocusRing({
|
|
99
98
|
within: true
|
|
@@ -102,9 +101,8 @@ function $b5f5ee35d3b6b95c$export$3288d34c523a1192(props) {
|
|
|
102
101
|
let tagRowRef = $fUaQ2$useRef();
|
|
103
102
|
let { clearButtonProps: clearButtonProps , labelProps: labelProps , tagProps: tagProps , tagRowProps: tagRowProps } = $fUaQ2$useTag({
|
|
104
103
|
...props,
|
|
105
|
-
isDisabled: isDisabled,
|
|
106
104
|
isFocused: isFocused,
|
|
107
|
-
|
|
105
|
+
allowsRemoving: allowsRemoving,
|
|
108
106
|
item: item,
|
|
109
107
|
onRemove: onRemove,
|
|
110
108
|
tagRef: tagRef,
|
|
@@ -116,10 +114,8 @@ function $b5f5ee35d3b6b95c$export$3288d34c523a1192(props) {
|
|
|
116
114
|
}, /*#__PURE__*/ $fUaQ2$react.createElement("div", {
|
|
117
115
|
...$fUaQ2$mergeProps(tagProps, hoverProps, focusProps),
|
|
118
116
|
className: $fUaQ2$classNames((/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports)), 'spectrum-Tags-item', {
|
|
119
|
-
'is-disabled': isDisabled,
|
|
120
117
|
'focus-ring': isFocusVisible,
|
|
121
118
|
'is-focused': isFocused,
|
|
122
|
-
'not-removable': !isRemovable,
|
|
123
119
|
'is-hovered': isHovered
|
|
124
120
|
}, styleProps.className),
|
|
125
121
|
ref: tagRef
|
|
@@ -131,12 +127,12 @@ function $b5f5ee35d3b6b95c$export$3288d34c523a1192(props) {
|
|
|
131
127
|
},
|
|
132
128
|
text: {
|
|
133
129
|
UNSAFE_className: $fUaQ2$classNames((/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports)), 'spectrum-Tag-content', {
|
|
134
|
-
'tags-removable':
|
|
130
|
+
'tags-removable': allowsRemoving
|
|
135
131
|
}),
|
|
136
132
|
...labelProps
|
|
137
133
|
}
|
|
138
134
|
}
|
|
139
|
-
}, typeof children === 'string' ? /*#__PURE__*/ $fUaQ2$react.createElement($fUaQ2$Text, null, children) : children,
|
|
135
|
+
}, typeof children === 'string' ? /*#__PURE__*/ $fUaQ2$react.createElement($fUaQ2$Text, null, children) : children, allowsRemoving && /*#__PURE__*/ $fUaQ2$react.createElement($b5f5ee35d3b6b95c$var$TagRemoveButton, {
|
|
140
136
|
item: item,
|
|
141
137
|
...clearButtonProps,
|
|
142
138
|
UNSAFE_className: $fUaQ2$classNames((/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports)), 'spectrum-Tag-action')
|
|
@@ -161,10 +157,10 @@ function $b5f5ee35d3b6b95c$var$TagRemoveButton(props) {
|
|
|
161
157
|
|
|
162
158
|
|
|
163
159
|
|
|
164
|
-
function $880d112c7a588209$var$TagGroup(props,
|
|
160
|
+
function $880d112c7a588209$var$TagGroup(props, ref) {
|
|
165
161
|
props = $fUaQ2$useProviderProps(props);
|
|
166
|
-
let {
|
|
167
|
-
let domRef = $fUaQ2$useDOMRef(
|
|
162
|
+
let { allowsRemoving: allowsRemoving , onRemove: onRemove , ...otherProps } = props;
|
|
163
|
+
let domRef = $fUaQ2$useDOMRef(ref);
|
|
168
164
|
let { styleProps: styleProps } = $fUaQ2$useStyleProps(otherProps);
|
|
169
165
|
let { direction: direction } = $fUaQ2$useLocale();
|
|
170
166
|
let listState = $fUaQ2$useListState(props);
|
|
@@ -188,7 +184,7 @@ function $880d112c7a588209$var$TagGroup(props, ref1) {
|
|
|
188
184
|
})
|
|
189
185
|
, [
|
|
190
186
|
listState.collection,
|
|
191
|
-
|
|
187
|
+
allowsRemoving
|
|
192
188
|
]);
|
|
193
189
|
let state = $fUaQ2$useGridState({
|
|
194
190
|
...props,
|
|
@@ -197,7 +193,7 @@ function $880d112c7a588209$var$TagGroup(props, ref1) {
|
|
|
197
193
|
});
|
|
198
194
|
let keyboardDelegate = new $fUaQ2$TagKeyboardDelegate({
|
|
199
195
|
collection: state.collection,
|
|
200
|
-
disabledKeys:
|
|
196
|
+
disabledKeys: new Set(),
|
|
201
197
|
ref: domRef,
|
|
202
198
|
direction: direction,
|
|
203
199
|
focusMode: 'cell'
|
|
@@ -206,31 +202,26 @@ function $880d112c7a588209$var$TagGroup(props, ref1) {
|
|
|
206
202
|
...props,
|
|
207
203
|
keyboardDelegate: keyboardDelegate
|
|
208
204
|
}, state, domRef);
|
|
209
|
-
const { tagGroupProps: tagGroupProps } = $fUaQ2$useTagGroup(props
|
|
205
|
+
const { tagGroupProps: tagGroupProps } = $fUaQ2$useTagGroup(props);
|
|
210
206
|
// Don't want the grid to be focusable or accessible via keyboard
|
|
211
207
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
212
208
|
let { tabIndex: tabIndex , role: role , ...otherGridProps } = gridProps;
|
|
213
209
|
return(/*#__PURE__*/ $fUaQ2$react.createElement("div", {
|
|
214
210
|
...$fUaQ2$mergeProps(styleProps, tagGroupProps, otherGridProps),
|
|
215
|
-
className: $fUaQ2$classNames((/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports)), 'spectrum-Tags',
|
|
216
|
-
'is-disabled': isDisabled
|
|
217
|
-
}, styleProps.className),
|
|
211
|
+
className: $fUaQ2$classNames((/*@__PURE__*/$parcel$interopDefault($c033a7c057e84ef1$exports)), 'spectrum-Tags', styleProps.className),
|
|
218
212
|
role: state.collection.size ? 'grid' : null,
|
|
219
213
|
ref: domRef
|
|
220
214
|
}, [
|
|
221
215
|
...gridCollection
|
|
222
|
-
].map((item)
|
|
223
|
-
var ref;
|
|
224
|
-
return(/*#__PURE__*/ $fUaQ2$react.createElement($b5f5ee35d3b6b95c$export$3288d34c523a1192, {
|
|
216
|
+
].map((item)=>/*#__PURE__*/ $fUaQ2$react.createElement($b5f5ee35d3b6b95c$export$3288d34c523a1192, {
|
|
225
217
|
...item.childNodes[0].props,
|
|
226
218
|
key: item.key,
|
|
227
219
|
item: item,
|
|
228
220
|
state: state,
|
|
229
|
-
|
|
230
|
-
isRemovable: isRemovable,
|
|
221
|
+
allowsRemoving: allowsRemoving,
|
|
231
222
|
onRemove: onRemove
|
|
232
|
-
}, item.childNodes[0].rendered)
|
|
233
|
-
|
|
223
|
+
}, item.childNodes[0].rendered)
|
|
224
|
+
)));
|
|
234
225
|
}
|
|
235
226
|
const $880d112c7a588209$export$67ea30858aaf75e3 = /*#__PURE__*/ $fUaQ2$react.forwardRef($880d112c7a588209$var$TagGroup);
|
|
236
227
|
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA+B;AAC/B,GAAoC;AACpC,GAA6B;AAC7B,GAAqC;AACrC,GAAmC;AACnC,GAAsC;AACtC,GAAgC;AAChC,GAA4B;AAC5B,GAA4B;AAC5B,GAA6B;AAC7B,GAA4B;AAC5B,GAAwC;AACxC,GAAyC;AACzC,GAA+C;AAC/C,GAAiC;AACjC,GAA+C;AAC/C,GAA4B;AAhB5B,yCAA+B,GAAG,CAAsB;AACxD,yCAAoC,GAAG,CAA2B;AAClE,yCAA6B,GAAG,CAAoB;AACpD,yCAAqC,GAAG,CAA4B;AACpE,yCAAmC,GAAG,CAA0B;AAChE,yCAAsC,GAAG,CAA6B;AACtE,yCAAgC,GAAG,CAAuB;AAC1D,yCAA4B,GAAG,CAAmB;AAClD,yCAA4B,GAAG,CAAmB;AAClD,yCAA6B,GAAG,CAAoB;AACpD,yCAA4B,GAAG,CAAmB;AAClD,yCAAwC,GAAG,CAA+B;AAC1E,yCAAyC,GAAG,CAAgC;AAC5E,yCAA+C,GAAG,CAAsC;AACxF,yCAAiC,GAAG,CAAwB;AAC5D,yCAA+C,GAAG,CAAsC;AACxF,yCAA4B,GAAG,CAAmB;;;;;;;;;;;;SCOlC,yCAAG,CAAI,KAA0B,EAAE,CAAC;IAClD,KAAK,CAAC,CAAC,WACL,QAAQ,eACR,UAAU,gBACV,WAAW,SACX,IAAI,UACJ,KAAK,aACL,QAAQ,MACL,UAAU,CACf,CAAC,GAAG,KAAK;IAET,EAAa,AAAb,WAAa;IACb,GAAG,CAAC,CAAC,aAAA,UAA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AI;QAC3C,GAAG,EAAE,MAAM;OACV,CAAC;WAAG,cAAc;IAAA,CAAC,CAAC,GAAG,EAAC,IAAI;;wDAC1B,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,QAAC,IAAI,aAAJ,IAAI,KAAJ,IAAI,CAAJ,CAAgB,GAAhB,IAAI,CAAJ,CAAgB,GAAhB,IAAI,CAAE,UAAU,CAAC,CAAC,uBAAlB,IAAI,CAAJ,CAAwB,GAAxB,IAAI,CAAJ,CAAwB,OAAH,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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from '@react-types/tag';\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: 1, // unused, but required for grid collections\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n return {\n type: 'item',\n childNodes\n };\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\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, role, ...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 role={state.collection.size ? 'grid' : null}\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 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 ref={tagRowRef}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\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 ref={tagRef}>\n <SlotProvider\n slots={{\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': isRemovable}), ...labelProps}\n }}>\n\n {typeof children === 'string' ? <Text>{children}</Text> : 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"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEAA,GAA+B;AAC/B,GAAoC;AACpC,GAA6B;AAC7B,GAAqC;AACrC,GAAmC;AACnC,GAAsC;AACtC,GAAgC;AAChC,GAA4B;AAC5B,GAA4B;AAC5B,GAA6B;AAC7B,GAA4B;AAC5B,GAAwC;AACxC,GAAyC;AACzC,GAA+C;AAC/C,GAAiC;AACjC,GAA+C;AAC/C,GAA4B;AAhB5B,yCAA+B,GAAG,CAAsB;AACxD,yCAAoC,GAAG,CAA2B;AAClE,yCAA6B,GAAG,CAAoB;AACpD,yCAAqC,GAAG,CAA4B;AACpE,yCAAmC,GAAG,CAA0B;AAChE,yCAAsC,GAAG,CAA6B;AACtE,yCAAgC,GAAG,CAAuB;AAC1D,yCAA4B,GAAG,CAAmB;AAClD,yCAA4B,GAAG,CAAmB;AAClD,yCAA6B,GAAG,CAAoB;AACpD,yCAA4B,GAAG,CAAmB;AAClD,yCAAwC,GAAG,CAA+B;AAC1E,yCAAyC,GAAG,CAAgC;AAC5E,yCAA+C,GAAG,CAAsC;AACxF,yCAAiC,GAAG,CAAwB;AAC5D,yCAA+C,GAAG,CAAsC;AACxF,yCAA4B,GAAG,CAAmB;;;;;;;;;;;;SCOlC,yCAAG,CAAI,KAA0B,EAAE,CAAC;IAClD,KAAK,CAAC,CAAC,WACL,QAAQ,mBACR,cAAc,SACd,IAAI,UACJ,KAAK,aACL,QAAQ,MACL,UAAU,CACf,CAAC,GAAG,KAAK;IAET,EAAa,AAAb,WAAa;IACb,GAAG,CAAC,CAAC,aAAA,UAAU,EAAA,CAAC,GAAG,oBAAa,CAAC,UAAU;IAC3C,GAAG,CAAC,CAAC,aAAA,UAAU,cAAE,SAAS,EAAA,CAAC,GA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AE,cAAc;YAC9B,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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from '@react-types/tag';\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 allowsRemoving,\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: 1, // unused, but required for grid collections\n items: [...listState.collection].map(item => {\n let childNodes = [{\n ...item,\n index: 0,\n type: 'cell'\n }];\n\n return {\n type: 'item',\n childNodes\n };\n })\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }), [listState.collection, allowsRemoving]);\n let state = useGridState({\n ...props,\n collection: gridCollection,\n focusMode: 'cell'\n });\n let keyboardDelegate = new TagKeyboardDelegate({\n collection: state.collection,\n disabledKeys: new Set(),\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);\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, role, ...otherGridProps} = gridProps;\n return (\n <div\n {...mergeProps(styleProps, tagGroupProps, otherGridProps)}\n className={\n classNames(\n styles,\n 'spectrum-Tags',\n styleProps.className\n )\n }\n role={state.collection.size ? 'grid' : null}\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 allowsRemoving={allowsRemoving}\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 allowsRemoving,\n item,\n state,\n onRemove,\n ...otherProps\n } = props;\n\n // @ts-ignore\n let {styleProps} = useStyleProps(otherProps);\n let {hoverProps, isHovered} = useHover({});\n let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});\n let tagRef = useRef();\n let tagRowRef = useRef();\n let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({\n ...props,\n isFocused,\n allowsRemoving,\n item,\n onRemove,\n tagRef,\n tagRowRef\n }, state);\n\n return (\n <div\n {...tagRowProps}\n ref={tagRowRef}>\n <div\n {...mergeProps(tagProps, hoverProps, focusProps)}\n className={classNames(\n styles,\n 'spectrum-Tags-item',\n {\n 'focus-ring': isFocusVisible,\n 'is-focused': isFocused,\n 'is-hovered': isHovered\n },\n styleProps.className\n )}\n ref={tagRef}>\n <SlotProvider\n slots={{\n icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},\n text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': allowsRemoving}), ...labelProps}\n }}>\n\n {typeof children === 'string' ? <Text>{children}</Text> : children}\n {allowsRemoving && <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"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;
|
|
1
|
+
{"mappings":";;;ACsGA,OAAA,MAAM;UAAuF,OAAO,cAAc,CAAC;MAAM,YAAY,CAAC;ACzFtI,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAChD,YAAY,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,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\nexport {TagGroup} from './TagGroup';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumTagGroupProps} from '@react-types/tag';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/tag",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.1852+286dbcdab",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -32,24 +32,24 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/runtime": "^7.6.2",
|
|
35
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
36
|
-
"@react-aria/grid": "3.5.1-nightly.
|
|
37
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
38
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
39
|
-
"@react-aria/tag": "3.0.0-nightly.
|
|
40
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
41
|
-
"@react-spectrum/button": "3.0.0-nightly.
|
|
42
|
-
"@react-spectrum/text": "3.3.3-nightly.
|
|
43
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
44
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
45
|
-
"@react-stately/grid": "3.4.1-nightly.
|
|
46
|
-
"@react-stately/list": "3.5.5-nightly.
|
|
47
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
48
|
-
"@react-types/tag": "3.0.0-nightly.
|
|
49
|
-
"@spectrum-icons/workflow": "3.0.0-nightly.
|
|
35
|
+
"@react-aria/focus": "3.0.0-nightly.1852+286dbcdab",
|
|
36
|
+
"@react-aria/grid": "3.5.1-nightly.3552+286dbcdab",
|
|
37
|
+
"@react-aria/i18n": "3.0.0-nightly.1852+286dbcdab",
|
|
38
|
+
"@react-aria/interactions": "3.0.0-nightly.1852+286dbcdab",
|
|
39
|
+
"@react-aria/tag": "3.0.0-nightly.1852+286dbcdab",
|
|
40
|
+
"@react-aria/utils": "3.0.0-nightly.1852+286dbcdab",
|
|
41
|
+
"@react-spectrum/button": "3.0.0-nightly.1852+286dbcdab",
|
|
42
|
+
"@react-spectrum/text": "3.3.3-nightly.3552+286dbcdab",
|
|
43
|
+
"@react-spectrum/utils": "3.0.0-nightly.1852+286dbcdab",
|
|
44
|
+
"@react-stately/collections": "3.0.0-nightly.1852+286dbcdab",
|
|
45
|
+
"@react-stately/grid": "3.4.1-nightly.3552+286dbcdab",
|
|
46
|
+
"@react-stately/list": "3.5.5-nightly.3552+286dbcdab",
|
|
47
|
+
"@react-types/shared": "3.0.0-nightly.1852+286dbcdab",
|
|
48
|
+
"@react-types/tag": "3.0.0-nightly.1852+286dbcdab",
|
|
49
|
+
"@spectrum-icons/workflow": "3.0.0-nightly.1852+286dbcdab"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
52
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.1852+286dbcdab"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"publishConfig": {
|
|
59
59
|
"access": "public"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "286dbcdabf60102d05a95ef00bc3fed06af91d98"
|
|
62
62
|
}
|
package/src/Tag.tsx
CHANGED
|
@@ -24,8 +24,7 @@ import {useTag} from '@react-aria/tag';
|
|
|
24
24
|
export function Tag<T>(props: SpectrumTagProps<T>) {
|
|
25
25
|
const {
|
|
26
26
|
children,
|
|
27
|
-
|
|
28
|
-
isRemovable,
|
|
27
|
+
allowsRemoving,
|
|
29
28
|
item,
|
|
30
29
|
state,
|
|
31
30
|
onRemove,
|
|
@@ -34,15 +33,14 @@ export function Tag<T>(props: SpectrumTagProps<T>) {
|
|
|
34
33
|
|
|
35
34
|
// @ts-ignore
|
|
36
35
|
let {styleProps} = useStyleProps(otherProps);
|
|
37
|
-
let {hoverProps, isHovered} = useHover({
|
|
36
|
+
let {hoverProps, isHovered} = useHover({});
|
|
38
37
|
let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});
|
|
39
38
|
let tagRef = useRef();
|
|
40
39
|
let tagRowRef = useRef();
|
|
41
40
|
let {clearButtonProps, labelProps, tagProps, tagRowProps} = useTag({
|
|
42
41
|
...props,
|
|
43
|
-
isDisabled,
|
|
44
42
|
isFocused,
|
|
45
|
-
|
|
43
|
+
allowsRemoving,
|
|
46
44
|
item,
|
|
47
45
|
onRemove,
|
|
48
46
|
tagRef,
|
|
@@ -59,10 +57,8 @@ export function Tag<T>(props: SpectrumTagProps<T>) {
|
|
|
59
57
|
styles,
|
|
60
58
|
'spectrum-Tags-item',
|
|
61
59
|
{
|
|
62
|
-
'is-disabled': isDisabled,
|
|
63
60
|
'focus-ring': isFocusVisible,
|
|
64
61
|
'is-focused': isFocused,
|
|
65
|
-
'not-removable': !isRemovable,
|
|
66
62
|
'is-hovered': isHovered
|
|
67
63
|
},
|
|
68
64
|
styleProps.className
|
|
@@ -71,11 +67,11 @@ export function Tag<T>(props: SpectrumTagProps<T>) {
|
|
|
71
67
|
<SlotProvider
|
|
72
68
|
slots={{
|
|
73
69
|
icon: {UNSAFE_className: classNames(styles, 'spectrum-Tag-icon'), size: 'XS'},
|
|
74
|
-
text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable':
|
|
70
|
+
text: {UNSAFE_className: classNames(styles, 'spectrum-Tag-content', {'tags-removable': allowsRemoving}), ...labelProps}
|
|
75
71
|
}}>
|
|
76
72
|
|
|
77
73
|
{typeof children === 'string' ? <Text>{children}</Text> : children}
|
|
78
|
-
{
|
|
74
|
+
{allowsRemoving && <TagRemoveButton item={item} {...clearButtonProps} UNSAFE_className={classNames(styles, 'spectrum-Tag-action')} />}
|
|
79
75
|
</SlotProvider>
|
|
80
76
|
</div>
|
|
81
77
|
</div>
|
package/src/TagGroup.tsx
CHANGED
|
@@ -28,8 +28,7 @@ import {useProviderProps} from '@react-spectrum/provider';
|
|
|
28
28
|
function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef<HTMLDivElement>) {
|
|
29
29
|
props = useProviderProps(props);
|
|
30
30
|
let {
|
|
31
|
-
|
|
32
|
-
isRemovable,
|
|
31
|
+
allowsRemoving,
|
|
33
32
|
onRemove,
|
|
34
33
|
...otherProps
|
|
35
34
|
} = props;
|
|
@@ -52,7 +51,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
52
51
|
};
|
|
53
52
|
})
|
|
54
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
55
|
-
}), [listState.collection,
|
|
54
|
+
}), [listState.collection, allowsRemoving]);
|
|
56
55
|
let state = useGridState({
|
|
57
56
|
...props,
|
|
58
57
|
collection: gridCollection,
|
|
@@ -60,7 +59,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
60
59
|
});
|
|
61
60
|
let keyboardDelegate = new TagKeyboardDelegate({
|
|
62
61
|
collection: state.collection,
|
|
63
|
-
disabledKeys:
|
|
62
|
+
disabledKeys: new Set(),
|
|
64
63
|
ref: domRef,
|
|
65
64
|
direction,
|
|
66
65
|
focusMode: 'cell'
|
|
@@ -69,7 +68,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
69
68
|
...props,
|
|
70
69
|
keyboardDelegate
|
|
71
70
|
}, state, domRef);
|
|
72
|
-
const {tagGroupProps} = useTagGroup(props
|
|
71
|
+
const {tagGroupProps} = useTagGroup(props);
|
|
73
72
|
|
|
74
73
|
// Don't want the grid to be focusable or accessible via keyboard
|
|
75
74
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -81,9 +80,6 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
81
80
|
classNames(
|
|
82
81
|
styles,
|
|
83
82
|
'spectrum-Tags',
|
|
84
|
-
{
|
|
85
|
-
'is-disabled': isDisabled
|
|
86
|
-
},
|
|
87
83
|
styleProps.className
|
|
88
84
|
)
|
|
89
85
|
}
|
|
@@ -95,8 +91,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
95
91
|
key={item.key}
|
|
96
92
|
item={item}
|
|
97
93
|
state={state}
|
|
98
|
-
|
|
99
|
-
isRemovable={isRemovable}
|
|
94
|
+
allowsRemoving={allowsRemoving}
|
|
100
95
|
onRemove={onRemove}>
|
|
101
96
|
{item.childNodes[0].rendered}
|
|
102
97
|
</Tag>
|