@react-spectrum/actionbar 3.4.6-nightly.4709 → 3.4.6-nightly.4723
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/ActionBar.main.js
CHANGED
|
@@ -65,7 +65,7 @@ function $7b5467653feb1153$var$ActionBar(props, ref) {
|
|
|
65
65
|
}
|
|
66
66
|
function $7b5467653feb1153$var$ActionBarInner(props, ref) {
|
|
67
67
|
props = (0, $643e7$reactspectrumprovider.useProviderProps)(props);
|
|
68
|
-
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, items: items } = props;
|
|
68
|
+
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, buttonLabelBehavior: buttonLabelBehavior = 'collapse', items: items } = props;
|
|
69
69
|
let { styleProps: styleProps } = (0, $643e7$reactspectrumutils.useStyleProps)(props);
|
|
70
70
|
let stringFormatter = (0, $643e7$reactariai18n.useLocalizedStringFormatter)((0, ($parcel$interopDefault($b1ba52ca91e22687$exports))), '@react-spectrum/actionbar');
|
|
71
71
|
// Store the last count greater than zero in a ref so that we can retain it while rendering the fade-out animation.
|
|
@@ -108,7 +108,7 @@ function $7b5467653feb1153$var$ActionBarInner(props, ref) {
|
|
|
108
108
|
isQuiet: true,
|
|
109
109
|
staticColor: isEmphasized ? 'white' : undefined,
|
|
110
110
|
overflowMode: "collapse",
|
|
111
|
-
buttonLabelBehavior:
|
|
111
|
+
buttonLabelBehavior: buttonLabelBehavior,
|
|
112
112
|
onAction: onAction,
|
|
113
113
|
UNSAFE_className: (0, $643e7$reactspectrumutils.classNames)((0, ($parcel$interopDefault($ff24c7bbe0c168db$exports))), 'react-spectrum-ActionBar-actionGroup')
|
|
114
114
|
}, children), /*#__PURE__*/ (0, ($parcel$interopDefault($643e7$react))).createElement((0, $643e7$reactspectrumbutton.ActionButton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AC;QACnC,SAAS,IAAM;QACf,SAAA;QACA,aAAa,eAAe,UAAU;qBACtC,0DAAC,CAAA,GAAA,0DAAS,yBAEZ,0DAAC,CAAA,GAAA,6BAAG;QAAE,kBAAkB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;OACxC,cAAc,QACX,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC,YAAY;QAAC,OAAO;IAAS;AAMpE;AAEA,MAAM,4DAAwB,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;AAE/C;;CAEC,GACD,MAAM,0DAAa,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/actionbar/src/ActionBar.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\nimport {ActionButton} from '@react-spectrum/button';\nimport {ActionGroup} from '@react-spectrum/actiongroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossLarge from '@spectrum-icons/ui/CrossLarge';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {OpenTransition} from '@react-spectrum/overlays';\nimport React, {ReactElement, Ref, useEffect, useRef, useState} from 'react';\nimport {SpectrumActionBarProps} from '@react-types/actionbar';\nimport styles from './actionbar.css';\nimport {Text} from '@react-spectrum/text';\nimport {useKeyboard} from '@react-aria/interactions';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ActionBar<T extends object>(props: SpectrumActionBarProps<T>, ref: DOMRef<HTMLDivElement>) {\n let isOpen = props.selectedItemCount !== 0;\n let domRef = useDOMRef(ref);\n\n return (\n <OpenTransition\n nodeRef={domRef}\n in={isOpen}\n mountOnEnter\n unmountOnExit>\n <ActionBarInnerWithRef {...props} ref={domRef} />\n </OpenTransition>\n );\n}\n\ninterface ActionBarInnerProps<T> extends SpectrumActionBarProps<T> {\n isOpen?: boolean\n}\n\nfunction ActionBarInner<T>(props: ActionBarInnerProps<T>, ref: Ref<HTMLDivElement>) {\n props = useProviderProps(props);\n\n let {\n children,\n isEmphasized,\n onAction,\n onClearSelection,\n selectedItemCount,\n isOpen,\n buttonLabelBehavior = 'collapse',\n items\n } = props;\n\n let {styleProps} = useStyleProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/actionbar');\n\n // Store the last count greater than zero in a ref so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current) {\n isInitial.current = false;\n announce(stringFormatter.format('actionsAvailable'));\n }\n }, [stringFormatter]);\n\n return (\n <FocusScope restoreFocus>\n <div\n {...filterDOMProps(props)}\n {...styleProps}\n {...keyboardProps}\n ref={ref}\n className={classNames(\n styles,\n 'react-spectrum-ActionBar', {\n 'react-spectrum-ActionBar--emphasized': isEmphasized,\n 'is-open': isOpen\n },\n styleProps.className\n )}>\n <div className={classNames(styles, 'react-spectrum-ActionBar-bar')}>\n <ActionGroup\n items={items}\n aria-label={stringFormatter.format('actions')}\n isQuiet\n staticColor={isEmphasized ? 'white' : undefined}\n overflowMode=\"collapse\"\n buttonLabelBehavior={buttonLabelBehavior}\n onAction={onAction}\n UNSAFE_className={classNames(styles, 'react-spectrum-ActionBar-actionGroup')}>\n {children}\n </ActionGroup>\n <ActionButton\n gridArea={styles.clear}\n aria-label={stringFormatter.format('clearSelection')}\n onPress={() => onClearSelection()}\n isQuiet\n staticColor={isEmphasized ? 'white' : undefined}>\n <CrossLarge />\n </ActionButton>\n <Text UNSAFE_className={classNames(styles, 'react-spectrum-ActionBar-selectedCount')}>\n {lastCount === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selected', {count: lastCount})}\n </Text>\n </div>\n </div>\n </FocusScope>\n );\n}\n\nconst ActionBarInnerWithRef = React.forwardRef(ActionBarInner) as <T>(props: ActionBarInnerProps<T> & {ref?: Ref<HTMLDivElement>}) => ReactElement;\n\n/**\n * Action bars are used for single and bulk selection patterns when a user needs to perform actions on one or more items at the same time.\n */\nconst _ActionBar = React.forwardRef(ActionBar) as <T>(props: SpectrumActionBarProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_ActionBar as ActionBar};\n"],"names":[],"version":3,"file":"ActionBar.main.js.map"}
|
package/dist/ActionBar.mjs
CHANGED
|
@@ -59,7 +59,7 @@ function $a4e665fbd087d71e$var$ActionBar(props, ref) {
|
|
|
59
59
|
}
|
|
60
60
|
function $a4e665fbd087d71e$var$ActionBarInner(props, ref) {
|
|
61
61
|
props = (0, $c4Nes$useProviderProps)(props);
|
|
62
|
-
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, items: items } = props;
|
|
62
|
+
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, buttonLabelBehavior: buttonLabelBehavior = 'collapse', items: items } = props;
|
|
63
63
|
let { styleProps: styleProps } = (0, $c4Nes$useStyleProps)(props);
|
|
64
64
|
let stringFormatter = (0, $c4Nes$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c4Nes$intlStringsmodulejs))), '@react-spectrum/actionbar');
|
|
65
65
|
// Store the last count greater than zero in a ref so that we can retain it while rendering the fade-out animation.
|
|
@@ -102,7 +102,7 @@ function $a4e665fbd087d71e$var$ActionBarInner(props, ref) {
|
|
|
102
102
|
isQuiet: true,
|
|
103
103
|
staticColor: isEmphasized ? 'white' : undefined,
|
|
104
104
|
overflowMode: "collapse",
|
|
105
|
-
buttonLabelBehavior:
|
|
105
|
+
buttonLabelBehavior: buttonLabelBehavior,
|
|
106
106
|
onAction: onAction,
|
|
107
107
|
UNSAFE_className: (0, $c4Nes$classNames)((0, ($parcel$interopDefault($c4Nes$actionbar_cssmodulejs))), 'react-spectrum-ActionBar-actionGroup')
|
|
108
108
|
}, children), /*#__PURE__*/ (0, $c4Nes$react).createElement((0, $c4Nes$ActionButton), {
|
package/dist/ActionBar.module.js
CHANGED
|
@@ -59,7 +59,7 @@ function $a4e665fbd087d71e$var$ActionBar(props, ref) {
|
|
|
59
59
|
}
|
|
60
60
|
function $a4e665fbd087d71e$var$ActionBarInner(props, ref) {
|
|
61
61
|
props = (0, $c4Nes$useProviderProps)(props);
|
|
62
|
-
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, items: items } = props;
|
|
62
|
+
let { children: children, isEmphasized: isEmphasized, onAction: onAction, onClearSelection: onClearSelection, selectedItemCount: selectedItemCount, isOpen: isOpen, buttonLabelBehavior: buttonLabelBehavior = 'collapse', items: items } = props;
|
|
63
63
|
let { styleProps: styleProps } = (0, $c4Nes$useStyleProps)(props);
|
|
64
64
|
let stringFormatter = (0, $c4Nes$useLocalizedStringFormatter)((0, ($parcel$interopDefault($c4Nes$intlStringsmodulejs))), '@react-spectrum/actionbar');
|
|
65
65
|
// Store the last count greater than zero in a ref so that we can retain it while rendering the fade-out animation.
|
|
@@ -102,7 +102,7 @@ function $a4e665fbd087d71e$var$ActionBarInner(props, ref) {
|
|
|
102
102
|
isQuiet: true,
|
|
103
103
|
staticColor: isEmphasized ? 'white' : undefined,
|
|
104
104
|
overflowMode: "collapse",
|
|
105
|
-
buttonLabelBehavior:
|
|
105
|
+
buttonLabelBehavior: buttonLabelBehavior,
|
|
106
106
|
onAction: onAction,
|
|
107
107
|
UNSAFE_className: (0, $c4Nes$classNames)((0, ($parcel$interopDefault($c4Nes$actionbar_cssmodulejs))), 'react-spectrum-ActionBar-actionGroup')
|
|
108
108
|
}, children), /*#__PURE__*/ (0, $c4Nes$react).createElement((0, $c4Nes$ActionButton), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAqBD,SAAS,gCAA4B,KAAgC,EAAE,GAA2B;IAChG,IAAI,SAAS,MAAM,iBAAiB,KAAK;IACzC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,qBAAa;QACZ,SAAS;QACT,IAAI;QACJ,cAAA;QACA,eAAA;qBACA,gCAAC;QAAuB,GAAG,KAAK;QAAE,KAAK;;AAG7C;AAMA,SAAS,qCAAkB,KAA6B,EAAE,GAAwB;IAChF,QAAQ,CAAA,GAAA,uBAAe,EAAE;IAEzB,IAAI,YACF,QAAQ,gBACR,YAAY,YACZ,QAAQ,oBACR,gBAAgB,qBAChB,iBAAiB,UACjB,MAAM,
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;;;;;;AAqBD,SAAS,gCAA4B,KAAgC,EAAE,GAA2B;IAChG,IAAI,SAAS,MAAM,iBAAiB,KAAK;IACzC,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gCAAC,CAAA,GAAA,qBAAa;QACZ,SAAS;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SAAS;qBAEtB,gCAAC;QAAI,WAAW,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;qBACjC,gCAAC,CAAA,GAAA,kBAAU;QACT,OAAO;QACP,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAA;QACA,aAAa,eAAe,UAAU;QACtC,cAAa;QACb,qBAAqB;QACrB,UAAU;QACV,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACpC,yBAEH,gCAAC,CAAA,GAAA,mBAAW;QACV,UAAU,CAAA,GAAA,sDAAK,EAAE,KAAK;QACtB,cAAY,gBAAgB,MAAM,CAAC;QACnC,SAAS,IAAM;QACf,SAAA;QACA,aAAa,eAAe,UAAU;qBACtC,gCAAC,CAAA,GAAA,gCAAS,yBAEZ,gCAAC,CAAA,GAAA,WAAG;QAAE,kBAAkB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,sDAAK,GAAG;OACxC,cAAc,QACX,gBAAgB,MAAM,CAAC,iBACvB,gBAAgB,MAAM,CAAC,YAAY;QAAC,OAAO;IAAS;AAMpE;AAEA,MAAM,4DAAwB,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;AAE/C;;CAEC,GACD,MAAM,0DAAa,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC","sources":["packages/@react-spectrum/actionbar/src/ActionBar.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\nimport {ActionButton} from '@react-spectrum/button';\nimport {ActionGroup} from '@react-spectrum/actiongroup';\nimport {announce} from '@react-aria/live-announcer';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport CrossLarge from '@spectrum-icons/ui/CrossLarge';\nimport {DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {FocusScope} from '@react-aria/focus';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {OpenTransition} from '@react-spectrum/overlays';\nimport React, {ReactElement, Ref, useEffect, useRef, useState} from 'react';\nimport {SpectrumActionBarProps} from '@react-types/actionbar';\nimport styles from './actionbar.css';\nimport {Text} from '@react-spectrum/text';\nimport {useKeyboard} from '@react-aria/interactions';\nimport {useLocalizedStringFormatter} from '@react-aria/i18n';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nfunction ActionBar<T extends object>(props: SpectrumActionBarProps<T>, ref: DOMRef<HTMLDivElement>) {\n let isOpen = props.selectedItemCount !== 0;\n let domRef = useDOMRef(ref);\n\n return (\n <OpenTransition\n nodeRef={domRef}\n in={isOpen}\n mountOnEnter\n unmountOnExit>\n <ActionBarInnerWithRef {...props} ref={domRef} />\n </OpenTransition>\n );\n}\n\ninterface ActionBarInnerProps<T> extends SpectrumActionBarProps<T> {\n isOpen?: boolean\n}\n\nfunction ActionBarInner<T>(props: ActionBarInnerProps<T>, ref: Ref<HTMLDivElement>) {\n props = useProviderProps(props);\n\n let {\n children,\n isEmphasized,\n onAction,\n onClearSelection,\n selectedItemCount,\n isOpen,\n buttonLabelBehavior = 'collapse',\n items\n } = props;\n\n let {styleProps} = useStyleProps(props);\n let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-spectrum/actionbar');\n\n // Store the last count greater than zero in a ref so that we can retain it while rendering the fade-out animation.\n let [lastCount, setLastCount] = useState(selectedItemCount);\n if ((selectedItemCount === 'all' || selectedItemCount > 0) && selectedItemCount !== lastCount) {\n setLastCount(selectedItemCount);\n }\n\n let {keyboardProps} = useKeyboard({\n onKeyDown(e) {\n if (e.key === 'Escape') {\n e.preventDefault();\n onClearSelection();\n }\n }\n });\n\n // Announce \"actions available\" on mount.\n let isInitial = useRef(true);\n useEffect(() => {\n if (isInitial.current) {\n isInitial.current = false;\n announce(stringFormatter.format('actionsAvailable'));\n }\n }, [stringFormatter]);\n\n return (\n <FocusScope restoreFocus>\n <div\n {...filterDOMProps(props)}\n {...styleProps}\n {...keyboardProps}\n ref={ref}\n className={classNames(\n styles,\n 'react-spectrum-ActionBar', {\n 'react-spectrum-ActionBar--emphasized': isEmphasized,\n 'is-open': isOpen\n },\n styleProps.className\n )}>\n <div className={classNames(styles, 'react-spectrum-ActionBar-bar')}>\n <ActionGroup\n items={items}\n aria-label={stringFormatter.format('actions')}\n isQuiet\n staticColor={isEmphasized ? 'white' : undefined}\n overflowMode=\"collapse\"\n buttonLabelBehavior={buttonLabelBehavior}\n onAction={onAction}\n UNSAFE_className={classNames(styles, 'react-spectrum-ActionBar-actionGroup')}>\n {children}\n </ActionGroup>\n <ActionButton\n gridArea={styles.clear}\n aria-label={stringFormatter.format('clearSelection')}\n onPress={() => onClearSelection()}\n isQuiet\n staticColor={isEmphasized ? 'white' : undefined}>\n <CrossLarge />\n </ActionButton>\n <Text UNSAFE_className={classNames(styles, 'react-spectrum-ActionBar-selectedCount')}>\n {lastCount === 'all'\n ? stringFormatter.format('selectedAll')\n : stringFormatter.format('selected', {count: lastCount})}\n </Text>\n </div>\n </div>\n </FocusScope>\n );\n}\n\nconst ActionBarInnerWithRef = React.forwardRef(ActionBarInner) as <T>(props: ActionBarInnerProps<T> & {ref?: Ref<HTMLDivElement>}) => ReactElement;\n\n/**\n * Action bars are used for single and bulk selection patterns when a user needs to perform actions on one or more items at the same time.\n */\nconst _ActionBar = React.forwardRef(ActionBar) as <T>(props: SpectrumActionBarProps<T> & {ref?: DOMRef<HTMLDivElement>}) => ReactElement;\nexport {_ActionBar as ActionBar};\n"],"names":[],"version":3,"file":"ActionBar.module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;
|
|
1
|
+
{"mappings":";;;AA2IA;;GAEG;AACH,OAAA,MAAM,WAA4C,CAAC,CAAC,EAAE,KAAK,EAAE,uBAAuB,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,OAAO,cAAc,CAAC,CAAA;CAAC,KAAK,YAAY,CAAC;ACvGzI;;;GAGG;AACH,OAAA,MAAM,uIAA0D,CAAC;AC7BjE,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAChD,YAAY,EAAC,+BAA+B,EAAC,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAC,sBAAsB,EAAC,MAAM,wBAAwB,CAAC","sources":["packages/@react-spectrum/actionbar/src/packages/@react-spectrum/actionbar/src/ActionBar.tsx","packages/@react-spectrum/actionbar/src/packages/@react-spectrum/actionbar/src/ActionBarContainer.tsx","packages/@react-spectrum/actionbar/src/packages/@react-spectrum/actionbar/src/index.ts","packages/@react-spectrum/actionbar/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/// <reference types=\"css-module-types\" />\nexport {ActionBar} from './ActionBar';\nexport {ActionBarContainer} from './ActionBarContainer';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumActionBarContainerProps} from '@react-types/actionbar';\nexport type {SpectrumActionBarProps} from '@react-types/actionbar';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/actionbar",
|
|
3
|
-
"version": "3.4.6-nightly.
|
|
3
|
+
"version": "3.4.6-nightly.4723+9b48ec5d5",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -36,24 +36,24 @@
|
|
|
36
36
|
"url": "https://github.com/adobe/react-spectrum"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@react-aria/focus": "3.0.0-nightly.
|
|
40
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
41
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
42
|
-
"@react-aria/live-announcer": "3.0.0-nightly.
|
|
43
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
44
|
-
"@react-spectrum/actiongroup": "3.10.6-nightly.
|
|
45
|
-
"@react-spectrum/button": "3.0.0-nightly.
|
|
46
|
-
"@react-spectrum/overlays": "3.0.0-nightly.
|
|
47
|
-
"@react-spectrum/text": "3.5.6-nightly.
|
|
48
|
-
"@react-spectrum/utils": "3.0.0-nightly.
|
|
49
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
50
|
-
"@react-types/actionbar": "3.1.8-nightly.
|
|
51
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
52
|
-
"@spectrum-icons/ui": "3.0.0-nightly.
|
|
39
|
+
"@react-aria/focus": "3.0.0-nightly.3011+9b48ec5d5",
|
|
40
|
+
"@react-aria/i18n": "3.0.0-nightly.3011+9b48ec5d5",
|
|
41
|
+
"@react-aria/interactions": "3.0.0-nightly.3011+9b48ec5d5",
|
|
42
|
+
"@react-aria/live-announcer": "3.0.0-nightly.3011+9b48ec5d5",
|
|
43
|
+
"@react-aria/utils": "3.0.0-nightly.3011+9b48ec5d5",
|
|
44
|
+
"@react-spectrum/actiongroup": "3.10.6-nightly.4723+9b48ec5d5",
|
|
45
|
+
"@react-spectrum/button": "3.0.0-nightly.3011+9b48ec5d5",
|
|
46
|
+
"@react-spectrum/overlays": "3.0.0-nightly.3011+9b48ec5d5",
|
|
47
|
+
"@react-spectrum/text": "3.5.6-nightly.4723+9b48ec5d5",
|
|
48
|
+
"@react-spectrum/utils": "3.0.0-nightly.3011+9b48ec5d5",
|
|
49
|
+
"@react-stately/collections": "3.0.0-nightly.3011+9b48ec5d5",
|
|
50
|
+
"@react-types/actionbar": "3.1.8-nightly.4723+9b48ec5d5",
|
|
51
|
+
"@react-types/shared": "3.0.0-nightly.3011+9b48ec5d5",
|
|
52
|
+
"@spectrum-icons/ui": "3.0.0-nightly.3011+9b48ec5d5",
|
|
53
53
|
"@swc/helpers": "^0.5.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@adobe/spectrum-css-temp": "3.0.0-nightly.
|
|
56
|
+
"@adobe/spectrum-css-temp": "3.0.0-nightly.3011+9b48ec5d5"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@react-spectrum/provider": "^3.0.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "9b48ec5d528adeba1a96592945459726def7ba56"
|
|
67
67
|
}
|
package/src/ActionBar.tsx
CHANGED
|
@@ -58,6 +58,7 @@ function ActionBarInner<T>(props: ActionBarInnerProps<T>, ref: Ref<HTMLDivElemen
|
|
|
58
58
|
onClearSelection,
|
|
59
59
|
selectedItemCount,
|
|
60
60
|
isOpen,
|
|
61
|
+
buttonLabelBehavior = 'collapse',
|
|
61
62
|
items
|
|
62
63
|
} = props;
|
|
63
64
|
|
|
@@ -110,7 +111,7 @@ function ActionBarInner<T>(props: ActionBarInnerProps<T>, ref: Ref<HTMLDivElemen
|
|
|
110
111
|
isQuiet
|
|
111
112
|
staticColor={isEmphasized ? 'white' : undefined}
|
|
112
113
|
overflowMode="collapse"
|
|
113
|
-
buttonLabelBehavior=
|
|
114
|
+
buttonLabelBehavior={buttonLabelBehavior}
|
|
114
115
|
onAction={onAction}
|
|
115
116
|
UNSAFE_className={classNames(styles, 'react-spectrum-ActionBar-actionGroup')}>
|
|
116
117
|
{children}
|