@react-aria/gridlist
Advanced tools
Comparing version 3.1.2-nightly.3599 to 3.1.2-nightly.3600
165
dist/main.js
@@ -15,12 +15,42 @@ var $dSFus$reactariautils = require("@react-aria/utils"); | ||
$parcel$export(module.exports, "useGridListSelectionCheckbox", () => $43131ea217bc2ad3$export$e29f2573fabbf7b9); | ||
const $7db02799adae605d$export$5b9bb410392e3991 = new WeakMap(); | ||
/* | ||
* Copyright 2022 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ /* | ||
* Copyright 2022 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
/* | ||
* Copyright 2020 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ const $7db02799adae605d$export$5b9bb410392e3991 = new WeakMap(); | ||
function $7db02799adae605d$export$f45c25170b9a99c2(state, key) { | ||
let { id: id } = $7db02799adae605d$export$5b9bb410392e3991.get(state); | ||
if (!id) throw new Error('Unknown list'); | ||
if (!id) throw new Error("Unknown list"); | ||
return `${id}-${$7db02799adae605d$export$e0c709538cb8ae18(key)}`; | ||
} | ||
function $7db02799adae605d$export$e0c709538cb8ae18(key) { | ||
if (typeof key === 'string') return key.replace(/\s*/g, ''); | ||
return '' + key; | ||
if (typeof key === "string") return key.replace(/\s*/g, ""); | ||
return "" + key; | ||
} | ||
@@ -33,4 +63,4 @@ | ||
let { isVirtualized: isVirtualized , keyboardDelegate: keyboardDelegate , onAction: onAction } = props; | ||
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.'); | ||
let { listProps: listProps } = $dSFus$reactariaselection.useSelectableList({ | ||
if (!props["aria-label"] && !props["aria-labelledby"]) console.warn("An aria-label or aria-labelledby prop is required for accessibility."); | ||
let { listProps: listProps } = (0, $dSFus$reactariaselection.useSelectableList)({ | ||
selectionManager: state.selectionManager, | ||
@@ -42,28 +72,26 @@ collection: state.collection, | ||
isVirtualized: isVirtualized, | ||
selectOnFocus: state.selectionManager.selectionBehavior === 'replace' | ||
selectOnFocus: state.selectionManager.selectionBehavior === "replace" | ||
}); | ||
let id = $dSFus$reactariautils.useId(); | ||
$7db02799adae605d$export$5b9bb410392e3991.set(state, { | ||
let id = (0, $dSFus$reactariautils.useId)(); | ||
(0, $7db02799adae605d$export$5b9bb410392e3991).set(state, { | ||
id: id, | ||
onAction: onAction | ||
}); | ||
let descriptionProps = $dSFus$reactariagrid.useHighlightSelectionDescription({ | ||
let descriptionProps = (0, $dSFus$reactariagrid.useHighlightSelectionDescription)({ | ||
selectionManager: state.selectionManager, | ||
hasItemActions: !!onAction | ||
}); | ||
let domProps = $dSFus$reactariautils.filterDOMProps(props, { | ||
let domProps = (0, $dSFus$reactariautils.filterDOMProps)(props, { | ||
labelable: true | ||
}); | ||
let gridProps = $dSFus$reactariautils.mergeProps(domProps, { | ||
role: 'grid', | ||
let gridProps = (0, $dSFus$reactariautils.mergeProps)(domProps, { | ||
role: "grid", | ||
id: id, | ||
'aria-multiselectable': state.selectionManager.selectionMode === 'multiple' ? 'true' : undefined | ||
}, state.collection.size === 0 ? { | ||
} : listProps, descriptionProps); | ||
"aria-multiselectable": state.selectionManager.selectionMode === "multiple" ? "true" : undefined | ||
}, state.collection.size === 0 ? {} : listProps, descriptionProps); | ||
if (isVirtualized) { | ||
gridProps['aria-rowcount'] = state.collection.size; | ||
gridProps['aria-colcount'] = 1; | ||
gridProps["aria-rowcount"] = state.collection.size; | ||
gridProps["aria-colcount"] = 1; | ||
} | ||
$dSFus$reactariagrid.useGridSelectionAnnouncement({ | ||
}, state); | ||
(0, $dSFus$reactariagrid.useGridSelectionAnnouncement)({}, state); | ||
return { | ||
@@ -75,2 +103,13 @@ gridProps: gridProps | ||
/* | ||
* Copyright 2022 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
@@ -81,15 +120,14 @@ | ||
function $f7116f5928c03f32$export$9610e69494fadfd2(props, state, ref) { | ||
// Copied from useGridCell + some modifications to make it not so grid specific | ||
let { node: node , isVirtualized: isVirtualized , shouldSelectOnPressUp: shouldSelectOnPressUp } = props; | ||
let { direction: direction } = $dSFus$reactariai18n.useLocale(); | ||
let { onAction: onAction } = $7db02799adae605d$export$5b9bb410392e3991.get(state); | ||
let descriptionId = $dSFus$reactariautils.useSlotId(); | ||
let { direction: direction } = (0, $dSFus$reactariai18n.useLocale)(); | ||
let { onAction: onAction } = (0, $7db02799adae605d$export$5b9bb410392e3991).get(state); | ||
let descriptionId = (0, $dSFus$reactariautils.useSlotId)(); | ||
let focus = ()=>{ | ||
// Don't shift focus to the row if the active element is a element within the row already | ||
// (e.g. clicking on a row button) | ||
if (!ref.current.contains(document.activeElement)) $dSFus$reactariafocus.focusSafely(ref.current); | ||
if (!ref.current.contains(document.activeElement)) (0, $dSFus$reactariafocus.focusSafely)(ref.current); | ||
}; | ||
let { itemProps: itemProps , ...itemStates } = $dSFus$reactariaselection.useSelectableItem({ | ||
let { itemProps: itemProps , ...itemStates } = (0, $dSFus$reactariaselection.useSelectableItem)({ | ||
selectionManager: state.selectionManager, | ||
@@ -100,4 +138,3 @@ key: node.key, | ||
shouldSelectOnPressUp: shouldSelectOnPressUp, | ||
onAction: onAction ? ()=>onAction(node.key) | ||
: undefined, | ||
onAction: onAction ? ()=>onAction(node.key) : undefined, | ||
focus: focus | ||
@@ -107,13 +144,13 @@ }); | ||
if (!e.currentTarget.contains(e.target)) return; | ||
let walker = $dSFus$reactariafocus.getFocusableTreeWalker(ref.current); | ||
let walker = (0, $dSFus$reactariafocus.getFocusableTreeWalker)(ref.current); | ||
walker.currentNode = document.activeElement; | ||
switch(e.key){ | ||
case 'ArrowLeft': | ||
case "ArrowLeft": | ||
{ | ||
// Find the next focusable element within the row. | ||
let focusable = direction === 'rtl' ? walker.nextNode() : walker.previousNode(); | ||
let focusable = direction === "rtl" ? walker.nextNode() : walker.previousNode(); | ||
if (focusable) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
$dSFus$reactariafocus.focusSafely(focusable); | ||
(0, $dSFus$reactariafocus.focusSafely)(focusable); | ||
} else { | ||
@@ -123,7 +160,7 @@ // If there is no next focusable child, then return focus back to the row | ||
e.stopPropagation(); | ||
if (direction === 'rtl') $dSFus$reactariafocus.focusSafely(ref.current); | ||
if (direction === "rtl") (0, $dSFus$reactariafocus.focusSafely)(ref.current); | ||
else { | ||
walker.currentNode = ref.current; | ||
let lastElement = $f7116f5928c03f32$var$last(walker); | ||
if (lastElement) $dSFus$reactariafocus.focusSafely(lastElement); | ||
if (lastElement) (0, $dSFus$reactariafocus.focusSafely)(lastElement); | ||
} | ||
@@ -133,17 +170,17 @@ } | ||
} | ||
case 'ArrowRight': | ||
case "ArrowRight": | ||
{ | ||
let focusable = direction === 'rtl' ? walker.previousNode() : walker.nextNode(); | ||
if (focusable) { | ||
let focusable1 = direction === "rtl" ? walker.previousNode() : walker.nextNode(); | ||
if (focusable1) { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
$dSFus$reactariafocus.focusSafely(focusable); | ||
(0, $dSFus$reactariafocus.focusSafely)(focusable1); | ||
} else { | ||
e.preventDefault(); | ||
e.stopPropagation(); | ||
if (direction === 'ltr') $dSFus$reactariafocus.focusSafely(ref.current); | ||
if (direction === "ltr") (0, $dSFus$reactariafocus.focusSafely)(ref.current); | ||
else { | ||
walker.currentNode = ref.current; | ||
let lastElement = $f7116f5928c03f32$var$last(walker); | ||
if (lastElement) $dSFus$reactariafocus.focusSafely(lastElement); | ||
let lastElement1 = $f7116f5928c03f32$var$last(walker); | ||
if (lastElement1) (0, $dSFus$reactariafocus.focusSafely)(lastElement1); | ||
} | ||
@@ -153,4 +190,4 @@ } | ||
} | ||
case 'ArrowUp': | ||
case 'ArrowDown': | ||
case "ArrowUp": | ||
case "ArrowDown": | ||
// Prevent this event from reaching row children, e.g. menu buttons. We want arrow keys to navigate | ||
@@ -175,20 +212,20 @@ // to the row above/below instead. We need to re-dispatch the event from a higher parent so it still | ||
// in that case since the list should act like a single tab stop. | ||
if (!$dSFus$reactariainteractions.isFocusVisible()) state.selectionManager.setFocusedKey(node.key); | ||
if (!(0, $dSFus$reactariainteractions.isFocusVisible)()) state.selectionManager.setFocusedKey(node.key); | ||
return; | ||
} | ||
}; | ||
let rowProps = $dSFus$reactariautils.mergeProps(itemProps, { | ||
role: 'row', | ||
let rowProps = (0, $dSFus$reactariautils.mergeProps)(itemProps, { | ||
role: "row", | ||
onKeyDownCapture: onKeyDown, | ||
onFocus: onFocus, | ||
'aria-label': node.textValue || undefined, | ||
'aria-selected': state.selectionManager.canSelectItem(node.key) ? state.selectionManager.isSelected(node.key) : undefined, | ||
'aria-disabled': state.selectionManager.isDisabled(node.key) || undefined, | ||
'aria-labelledby': descriptionId && node.textValue ? `${$7db02799adae605d$export$f45c25170b9a99c2(state, node.key)} ${descriptionId}` : undefined, | ||
id: $7db02799adae605d$export$f45c25170b9a99c2(state, node.key) | ||
"aria-label": node.textValue || undefined, | ||
"aria-selected": state.selectionManager.canSelectItem(node.key) ? state.selectionManager.isSelected(node.key) : undefined, | ||
"aria-disabled": state.selectionManager.isDisabled(node.key) || undefined, | ||
"aria-labelledby": descriptionId && node.textValue ? `${(0, $7db02799adae605d$export$f45c25170b9a99c2)(state, node.key)} ${descriptionId}` : undefined, | ||
id: (0, $7db02799adae605d$export$f45c25170b9a99c2)(state, node.key) | ||
}); | ||
if (isVirtualized) rowProps['aria-rowindex'] = node.index + 1; | ||
if (isVirtualized) rowProps["aria-rowindex"] = node.index + 1; | ||
let gridCellProps = { | ||
role: 'gridcell', | ||
'aria-colindex': 1 | ||
role: "gridcell", | ||
"aria-colindex": 1 | ||
}; | ||
@@ -210,3 +247,3 @@ return { | ||
if (last) next = last; | ||
}while (last) | ||
}while (last); | ||
return next; | ||
@@ -216,11 +253,21 @@ } | ||
/* | ||
* Copyright 2022 Adobe. All rights reserved. | ||
* This file is licensed to you under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. You may obtain a copy | ||
* of the License at http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under | ||
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* OF ANY KIND, either express or implied. See the License for the specific language | ||
* governing permissions and limitations under the License. | ||
*/ | ||
function $43131ea217bc2ad3$export$e29f2573fabbf7b9(props, state) { | ||
let { key: key } = props; | ||
const { checkboxProps: checkboxProps } = $dSFus$reactariagrid.useGridSelectionCheckbox(props, state); | ||
const { checkboxProps: checkboxProps } = (0, $dSFus$reactariagrid.useGridSelectionCheckbox)(props, state); | ||
return { | ||
checkboxProps: { | ||
...checkboxProps, | ||
'aria-labelledby': `${checkboxProps.id} ${$7db02799adae605d$export$f45c25170b9a99c2(state, key)}` | ||
"aria-labelledby": `${checkboxProps.id} ${(0, $7db02799adae605d$export$f45c25170b9a99c2)(state, key)}` | ||
} | ||
@@ -227,0 +274,0 @@ }; |
{ | ||
"name": "@react-aria/gridlist", | ||
"version": "3.1.2-nightly.3599+b35d5c02f", | ||
"version": "3.1.2-nightly.3600+bfce84fee", | ||
"description": "Spectrum UI components in React", | ||
@@ -25,12 +25,12 @@ "license": "Apache-2.0", | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/focus": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-aria/grid": "3.5.2-nightly.3599+b35d5c02f", | ||
"@react-aria/i18n": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-aria/interactions": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-aria/selection": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-aria/utils": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-stately/list": "3.6.1-nightly.3599+b35d5c02f", | ||
"@react-types/checkbox": "3.0.0-nightly.1899+b35d5c02f", | ||
"@react-types/shared": "3.0.0-nightly.1899+b35d5c02f" | ||
"@react-aria/focus": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-aria/grid": "3.5.2-nightly.3600+bfce84fee", | ||
"@react-aria/i18n": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-aria/interactions": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-aria/selection": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-aria/utils": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-stately/list": "3.6.1-nightly.3600+bfce84fee", | ||
"@react-types/checkbox": "3.0.0-nightly.1900+bfce84fee", | ||
"@react-types/shared": "3.0.0-nightly.1900+bfce84fee", | ||
"@swc/helpers": "^0.4.14" | ||
}, | ||
@@ -43,3 +43,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "b35d5c02fe900badccd0cf1a8f23bb593419f238" | ||
"gitHead": "bfce84fee12a027d9cbc38b43e1747e3e4b4b169" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
99376
925
+ Added@swc/helpers@^0.4.14
+ Added@swc/helpers@0.4.37(transitive)
+ Addedtslib@2.8.1(transitive)
- Removed@babel/runtime@^7.6.2
- Removed@babel/runtime@7.26.0(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
Updated@react-aria/interactions@3.0.0-nightly.1900+bfce84fee