@react-spectrum/tag 3.1.4 → 3.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ar-AE.main.js +9 -0
- package/dist/ar-AE.main.js.map +1 -0
- package/dist/ar-AE.mjs +11 -0
- package/dist/ar-AE.module.js +11 -0
- package/dist/ar-AE.module.js.map +1 -0
- package/dist/bg-BG.main.js +9 -0
- package/dist/bg-BG.main.js.map +1 -0
- package/dist/bg-BG.mjs +11 -0
- package/dist/bg-BG.module.js +11 -0
- package/dist/bg-BG.module.js.map +1 -0
- package/dist/cs-CZ.main.js +9 -0
- package/dist/cs-CZ.main.js.map +1 -0
- package/dist/cs-CZ.mjs +11 -0
- package/dist/cs-CZ.module.js +11 -0
- package/dist/cs-CZ.module.js.map +1 -0
- package/dist/da-DK.main.js +9 -0
- package/dist/da-DK.main.js.map +1 -0
- package/dist/da-DK.mjs +11 -0
- package/dist/da-DK.module.js +11 -0
- package/dist/da-DK.module.js.map +1 -0
- package/dist/de-DE.main.js +9 -0
- package/dist/de-DE.main.js.map +1 -0
- package/dist/de-DE.mjs +11 -0
- package/dist/de-DE.module.js +11 -0
- package/dist/de-DE.module.js.map +1 -0
- package/dist/el-GR.main.js +9 -0
- package/dist/el-GR.main.js.map +1 -0
- package/dist/el-GR.mjs +11 -0
- package/dist/el-GR.module.js +11 -0
- package/dist/el-GR.module.js.map +1 -0
- package/dist/en-US.main.js +9 -0
- package/dist/en-US.main.js.map +1 -0
- package/dist/en-US.mjs +11 -0
- package/dist/en-US.module.js +11 -0
- package/dist/en-US.module.js.map +1 -0
- package/dist/es-ES.main.js +9 -0
- package/dist/es-ES.main.js.map +1 -0
- package/dist/es-ES.mjs +11 -0
- package/dist/es-ES.module.js +11 -0
- package/dist/es-ES.module.js.map +1 -0
- package/dist/et-EE.main.js +9 -0
- package/dist/et-EE.main.js.map +1 -0
- package/dist/et-EE.mjs +11 -0
- package/dist/et-EE.module.js +11 -0
- package/dist/et-EE.module.js.map +1 -0
- package/dist/fi-FI.main.js +9 -0
- package/dist/fi-FI.main.js.map +1 -0
- package/dist/fi-FI.mjs +11 -0
- package/dist/fi-FI.module.js +11 -0
- package/dist/fi-FI.module.js.map +1 -0
- package/dist/fr-FR.main.js +9 -0
- package/dist/fr-FR.main.js.map +1 -0
- package/dist/fr-FR.mjs +11 -0
- package/dist/fr-FR.module.js +11 -0
- package/dist/fr-FR.module.js.map +1 -0
- package/dist/he-IL.main.js +9 -0
- package/dist/he-IL.main.js.map +1 -0
- package/dist/he-IL.mjs +11 -0
- package/dist/he-IL.module.js +11 -0
- package/dist/he-IL.module.js.map +1 -0
- package/dist/hr-HR.main.js +9 -0
- package/dist/hr-HR.main.js.map +1 -0
- package/dist/hr-HR.mjs +11 -0
- package/dist/hr-HR.module.js +11 -0
- package/dist/hr-HR.module.js.map +1 -0
- package/dist/hu-HU.main.js +9 -0
- package/dist/hu-HU.main.js.map +1 -0
- package/dist/hu-HU.mjs +11 -0
- package/dist/hu-HU.module.js +11 -0
- package/dist/hu-HU.module.js.map +1 -0
- package/dist/import.mjs +44 -280
- package/dist/it-IT.main.js +9 -0
- package/dist/it-IT.main.js.map +1 -0
- package/dist/it-IT.mjs +11 -0
- package/dist/it-IT.module.js +11 -0
- package/dist/it-IT.module.js.map +1 -0
- package/dist/ja-JP.main.js +9 -0
- package/dist/ja-JP.main.js.map +1 -0
- package/dist/ja-JP.mjs +11 -0
- package/dist/ja-JP.module.js +11 -0
- package/dist/ja-JP.module.js.map +1 -0
- package/dist/ko-KR.main.js +9 -0
- package/dist/ko-KR.main.js.map +1 -0
- package/dist/ko-KR.mjs +11 -0
- package/dist/ko-KR.module.js +11 -0
- package/dist/ko-KR.module.js.map +1 -0
- package/dist/lt-LT.main.js +9 -0
- package/dist/lt-LT.main.js.map +1 -0
- package/dist/lt-LT.mjs +11 -0
- package/dist/lt-LT.module.js +11 -0
- package/dist/lt-LT.module.js.map +1 -0
- package/dist/lv-LV.main.js +9 -0
- package/dist/lv-LV.main.js.map +1 -0
- package/dist/lv-LV.mjs +11 -0
- package/dist/lv-LV.module.js +11 -0
- package/dist/lv-LV.module.js.map +1 -0
- package/dist/main.css +279 -1
- package/dist/main.css.map +1 -0
- package/dist/main.js +44 -280
- package/dist/main.js.map +1 -1
- package/dist/module.js +44 -280
- package/dist/module.js.map +1 -1
- package/dist/nb-NO.main.js +9 -0
- package/dist/nb-NO.main.js.map +1 -0
- package/dist/nb-NO.mjs +11 -0
- package/dist/nb-NO.module.js +11 -0
- package/dist/nb-NO.module.js.map +1 -0
- package/dist/nl-NL.main.js +9 -0
- package/dist/nl-NL.main.js.map +1 -0
- package/dist/nl-NL.mjs +11 -0
- package/dist/nl-NL.module.js +11 -0
- package/dist/nl-NL.module.js.map +1 -0
- package/dist/pl-PL.main.js +9 -0
- package/dist/pl-PL.main.js.map +1 -0
- package/dist/pl-PL.mjs +11 -0
- package/dist/pl-PL.module.js +11 -0
- package/dist/pl-PL.module.js.map +1 -0
- package/dist/pt-BR.main.js +9 -0
- package/dist/pt-BR.main.js.map +1 -0
- package/dist/pt-BR.mjs +11 -0
- package/dist/pt-BR.module.js +11 -0
- package/dist/pt-BR.module.js.map +1 -0
- package/dist/pt-PT.main.js +9 -0
- package/dist/pt-PT.main.js.map +1 -0
- package/dist/pt-PT.mjs +11 -0
- package/dist/pt-PT.module.js +11 -0
- package/dist/pt-PT.module.js.map +1 -0
- package/dist/ro-RO.main.js +9 -0
- package/dist/ro-RO.main.js.map +1 -0
- package/dist/ro-RO.mjs +11 -0
- package/dist/ro-RO.module.js +11 -0
- package/dist/ro-RO.module.js.map +1 -0
- package/dist/ru-RU.main.js +9 -0
- package/dist/ru-RU.main.js.map +1 -0
- package/dist/ru-RU.mjs +11 -0
- package/dist/ru-RU.module.js +11 -0
- package/dist/ru-RU.module.js.map +1 -0
- package/dist/sk-SK.main.js +9 -0
- package/dist/sk-SK.main.js.map +1 -0
- package/dist/sk-SK.mjs +11 -0
- package/dist/sk-SK.module.js +11 -0
- package/dist/sk-SK.module.js.map +1 -0
- package/dist/sl-SI.main.js +9 -0
- package/dist/sl-SI.main.js.map +1 -0
- package/dist/sl-SI.mjs +11 -0
- package/dist/sl-SI.module.js +11 -0
- package/dist/sl-SI.module.js.map +1 -0
- package/dist/sr-SP.main.js +9 -0
- package/dist/sr-SP.main.js.map +1 -0
- package/dist/sr-SP.mjs +11 -0
- package/dist/sr-SP.module.js +11 -0
- package/dist/sr-SP.module.js.map +1 -0
- package/dist/sv-SE.main.js +9 -0
- package/dist/sv-SE.main.js.map +1 -0
- package/dist/sv-SE.mjs +11 -0
- package/dist/sv-SE.module.js +11 -0
- package/dist/sv-SE.module.js.map +1 -0
- package/dist/tr-TR.main.js +9 -0
- package/dist/tr-TR.main.js.map +1 -0
- package/dist/tr-TR.mjs +11 -0
- package/dist/tr-TR.module.js +11 -0
- package/dist/tr-TR.module.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/uk-UA.main.js +9 -0
- package/dist/uk-UA.main.js.map +1 -0
- package/dist/uk-UA.mjs +11 -0
- package/dist/uk-UA.module.js +11 -0
- package/dist/uk-UA.module.js.map +1 -0
- package/dist/zh-CN.main.js +9 -0
- package/dist/zh-CN.main.js.map +1 -0
- package/dist/zh-CN.mjs +11 -0
- package/dist/zh-CN.module.js +11 -0
- package/dist/zh-CN.module.js.map +1 -0
- package/dist/zh-TW.main.js +9 -0
- package/dist/zh-TW.main.js.map +1 -0
- package/dist/zh-TW.mjs +11 -0
- package/dist/zh-TW.module.js +11 -0
- package/dist/zh-TW.module.js.map +1 -0
- package/package.json +16 -16
- package/src/Tag.tsx +1 -1
- package/src/TagGroup.tsx +10 -10
package/dist/zh-TW.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var $18b85da2aafaaf3e$exports = {};
|
|
2
|
+
$18b85da2aafaaf3e$exports = {
|
|
3
|
+
"actions": `\u{52D5}\u{4F5C}`,
|
|
4
|
+
"hideButtonLabel": `\u{986F}\u{793A}\u{8F03}\u{5C11}`,
|
|
5
|
+
"noTags": `\u{7121}`,
|
|
6
|
+
"showAllButtonLabel": (args, formatter)=>`\u{986F}\u{793A}\u{5168}\u{90E8} (${formatter.number(args.tagCount)})`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export {$18b85da2aafaaf3e$exports as default};
|
|
11
|
+
//# sourceMappingURL=zh-TW.module.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
var $18b85da2aafaaf3e$exports = {};
|
|
2
|
+
$18b85da2aafaaf3e$exports = {
|
|
3
|
+
"actions": `\u{52D5}\u{4F5C}`,
|
|
4
|
+
"hideButtonLabel": `\u{986F}\u{793A}\u{8F03}\u{5C11}`,
|
|
5
|
+
"noTags": `\u{7121}`,
|
|
6
|
+
"showAllButtonLabel": (args, formatter)=>`\u{986F}\u{793A}\u{5168}\u{90E8} (${formatter.number(args.tagCount)})`
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
export {$18b85da2aafaaf3e$exports as default};
|
|
11
|
+
//# sourceMappingURL=zh-TW.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";AAAA,4BAAiB;IAAG,WAAW,CAAC,gBAAE,CAAC;IACjC,mBAAmB,CAAC,gCAAI,CAAC;IACzB,UAAU,CAAC,QAAC,CAAC;IACb,sBAAsB,CAAC,MAAM,YAAc,CAAC,kCAAM,EAAE,UAAU,MAAM,CAAC,KAAK,QAAQ,EAAE,CAAC,CAAC;AACxF","sources":["packages/@react-spectrum/tag/intl/zh-TW.json"],"sourcesContent":["{\n \"actions\": \"動作\",\n \"hideButtonLabel\": \"顯示較少\",\n \"noTags\": \"無\",\n \"showAllButtonLabel\": \"顯示全部 ({tagCount, number})\"\n}\n"],"names":[],"version":3,"file":"zh-TW.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/tag",
|
|
3
|
-
"version": "3.1
|
|
3
|
+
"version": "3.2.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/focus": "^3.
|
|
40
|
-
"@react-aria/i18n": "^3.
|
|
41
|
-
"@react-aria/interactions": "^3.
|
|
42
|
-
"@react-aria/selection": "^3.17.
|
|
43
|
-
"@react-aria/tag": "^3.
|
|
44
|
-
"@react-aria/utils": "^3.
|
|
45
|
-
"@react-spectrum/button": "^3.
|
|
46
|
-
"@react-spectrum/form": "^3.
|
|
47
|
-
"@react-spectrum/label": "^3.
|
|
48
|
-
"@react-spectrum/text": "^3.
|
|
49
|
-
"@react-spectrum/utils": "^3.11.
|
|
50
|
-
"@react-stately/collections": "^3.10.
|
|
51
|
-
"@react-stately/list": "^3.10.
|
|
52
|
-
"@react-types/shared": "^3.
|
|
39
|
+
"@react-aria/focus": "^3.16.0",
|
|
40
|
+
"@react-aria/i18n": "^3.10.0",
|
|
41
|
+
"@react-aria/interactions": "^3.20.1",
|
|
42
|
+
"@react-aria/selection": "^3.17.3",
|
|
43
|
+
"@react-aria/tag": "^3.3.1",
|
|
44
|
+
"@react-aria/utils": "^3.23.0",
|
|
45
|
+
"@react-spectrum/button": "^3.16.0",
|
|
46
|
+
"@react-spectrum/form": "^3.7.1",
|
|
47
|
+
"@react-spectrum/label": "^3.16.1",
|
|
48
|
+
"@react-spectrum/text": "^3.5.1",
|
|
49
|
+
"@react-spectrum/utils": "^3.11.3",
|
|
50
|
+
"@react-stately/collections": "^3.10.4",
|
|
51
|
+
"@react-stately/list": "^3.10.2",
|
|
52
|
+
"@react-types/shared": "^3.22.0",
|
|
53
53
|
"@swc/helpers": "^0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "86b38c87868ce7f262e0df905e5ac4eb2653791d"
|
|
67
67
|
}
|
package/src/Tag.tsx
CHANGED
|
@@ -36,7 +36,7 @@ export function Tag<T>(props: SpectrumTagProps<T>) {
|
|
|
36
36
|
let {styleProps} = useStyleProps(otherProps);
|
|
37
37
|
let {hoverProps, isHovered} = useHover({});
|
|
38
38
|
let {isFocused, isFocusVisible, focusProps} = useFocusRing({within: true});
|
|
39
|
-
let ref = useRef();
|
|
39
|
+
let ref = useRef(null);
|
|
40
40
|
let {removeButtonProps, gridCellProps, rowProps, allowsRemoving} = useTag({
|
|
41
41
|
...props,
|
|
42
42
|
item
|
package/src/TagGroup.tsx
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import {ActionButton} from '@react-spectrum/button';
|
|
14
14
|
import {AriaTagGroupProps, useTagGroup} from '@react-aria/tag';
|
|
15
15
|
import {classNames, useDOMRef} from '@react-spectrum/utils';
|
|
16
|
-
import {DOMRef, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';
|
|
16
|
+
import {Collection, DOMRef, Node, SpectrumLabelableProps, StyleProps, Validation} from '@react-types/shared';
|
|
17
17
|
import {Field} from '@react-spectrum/label';
|
|
18
18
|
import {FocusRing, FocusScope} from '@react-aria/focus';
|
|
19
19
|
// @ts-ignore
|
|
@@ -21,7 +21,7 @@ import intlMessages from '../intl/*.json';
|
|
|
21
21
|
import {ListCollection, useListState} from '@react-stately/list';
|
|
22
22
|
import {ListKeyboardDelegate} from '@react-aria/selection';
|
|
23
23
|
import {Provider, useProvider, useProviderProps} from '@react-spectrum/provider';
|
|
24
|
-
import React, {ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
24
|
+
import React, {JSX, ReactElement, useCallback, useEffect, useMemo, useRef, useState} from 'react';
|
|
25
25
|
import styles from '@adobe/spectrum-css-temp/components/tags/vars.css';
|
|
26
26
|
import {Tag} from './Tag';
|
|
27
27
|
import {useFormProps} from '@react-spectrum/form';
|
|
@@ -39,7 +39,7 @@ const TAG_STYLES = {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
export interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>,
|
|
42
|
+
export interface SpectrumTagGroupProps<T> extends Omit<AriaTagGroupProps<T>, 'selectionMode' | 'disallowEmptySelection' | 'selectedKeys' | 'defaultSelectedKeys' | 'onSelectionChange' | 'selectionBehavior' | 'disabledKeys'>, StyleProps, Omit<SpectrumLabelableProps, 'isRequired' | 'necessityIndicator'>, Pick<Validation<any>, 'isInvalid' | 'validationState'> {
|
|
43
43
|
/** The label to display on the action button. */
|
|
44
44
|
actionLabel?: string,
|
|
45
45
|
/** Handler that is called when the action button is pressed. */
|
|
@@ -63,17 +63,17 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
63
63
|
} = props;
|
|
64
64
|
let domRef = useDOMRef(ref);
|
|
65
65
|
let containerRef = useRef(null);
|
|
66
|
-
let tagsRef = useRef(null);
|
|
66
|
+
let tagsRef = useRef<HTMLDivElement | null>(null);
|
|
67
67
|
let {direction} = useLocale();
|
|
68
68
|
let {scale} = useProvider();
|
|
69
|
-
let stringFormatter = useLocalizedStringFormatter(intlMessages);
|
|
69
|
+
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/tag');
|
|
70
70
|
let [isCollapsed, setIsCollapsed] = useState(maxRows != null);
|
|
71
71
|
let state = useListState(props);
|
|
72
72
|
let [tagState, setTagState] = useValueEffect({visibleTagCount: state.collection.size, showCollapseButton: false});
|
|
73
73
|
let keyboardDelegate = useMemo(() => {
|
|
74
|
-
let collection = isCollapsed
|
|
74
|
+
let collection = (isCollapsed
|
|
75
75
|
? new ListCollection([...state.collection].slice(0, tagState.visibleTagCount))
|
|
76
|
-
: new ListCollection([...state.collection])
|
|
76
|
+
: new ListCollection([...state.collection])) as Collection<Node<T>>;
|
|
77
77
|
return new ListKeyboardDelegate({
|
|
78
78
|
collection,
|
|
79
79
|
ref: domRef,
|
|
@@ -88,7 +88,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
88
88
|
let actionsRef = useRef(null);
|
|
89
89
|
|
|
90
90
|
let updateVisibleTagCount = useCallback(() => {
|
|
91
|
-
if (maxRows > 0) {
|
|
91
|
+
if (maxRows && maxRows > 0) {
|
|
92
92
|
let computeVisibleTagCount = () => {
|
|
93
93
|
// Refs can be null at runtime.
|
|
94
94
|
let currContainerRef: HTMLDivElement | null = containerRef.current;
|
|
@@ -115,7 +115,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
115
115
|
rowCount++;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
if (rowCount > maxRows) {
|
|
118
|
+
if (maxRows && rowCount > maxRows) {
|
|
119
119
|
break;
|
|
120
120
|
}
|
|
121
121
|
tagWidths.push(width);
|
|
@@ -124,7 +124,7 @@ function TagGroup<T extends object>(props: SpectrumTagGroupProps<T>, ref: DOMRef
|
|
|
124
124
|
|
|
125
125
|
// Remove tags until there is space for the collapse button and action button (if present) on the last row.
|
|
126
126
|
let buttons = [...currActionsRef.children];
|
|
127
|
-
if (buttons.length > 0 && rowCount >= maxRows) {
|
|
127
|
+
if (maxRows && buttons.length > 0 && rowCount >= maxRows) {
|
|
128
128
|
let buttonsWidth = buttons.reduce((acc, curr) => acc += curr.getBoundingClientRect().width, 0);
|
|
129
129
|
buttonsWidth += TAG_STYLES[scale].margin * 2 * buttons.length;
|
|
130
130
|
let end = direction === 'ltr' ? 'right' : 'left';
|