@react-aria/actiongroup
Advanced tools
Comparing version 3.0.0-alpha.1 to 3.0.0-nightly-07431f4b1-241030
145
dist/main.js
@@ -1,31 +0,11 @@ | ||
var _babelRuntimeHelpersObjectSpread = $parcel$interopDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
var $ceb684449a137553$exports = require("./useActionGroup.main.js"); | ||
var $44b92e5de834b44e$exports = require("./useActionGroupItem.main.js"); | ||
var _babelRuntimeHelpersSlicedToArray = $parcel$interopDefault(require("@babel/runtime/helpers/slicedToArray")); | ||
var _babelRuntimeHelpersClassCallCheck = $parcel$interopDefault(require("@babel/runtime/helpers/classCallCheck")); | ||
var _babelRuntimeHelpersCreateClass = $parcel$interopDefault(require("@babel/runtime/helpers/createClass")); | ||
var _babelRuntimeHelpersDefineProperty = $parcel$interopDefault(require("@babel/runtime/helpers/defineProperty")); | ||
var _temp = require("react"); | ||
var useMemo = _temp.useMemo; | ||
var useState = _temp.useState; | ||
var _temp2 = require("@react-aria/utils"); | ||
var mergeProps = _temp2.mergeProps; | ||
var useId = _temp2.useId; | ||
var useFocusWithin = require("@react-aria/interactions").useFocusWithin; | ||
var useLocale = require("@react-aria/i18n").useLocale; | ||
var useSelectableCollection = require("@react-aria/selection").useSelectableCollection; | ||
function $parcel$interopDefault(a) { | ||
return a && a.__esModule ? a.default : a; | ||
function $parcel$export(e, n, v, s) { | ||
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true}); | ||
} | ||
$parcel$export(module.exports, "useActionGroup", () => $ceb684449a137553$exports.useActionGroup); | ||
$parcel$export(module.exports, "useActionGroupItem", () => $44b92e5de834b44e$exports.useActionGroupItem); | ||
/* | ||
@@ -36,3 +16,3 @@ * Copyright 2020 Adobe. All rights reserved. | ||
* 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 | ||
@@ -42,113 +22,6 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* governing permissions and limitations under the License. | ||
*/ | ||
var $cbc64ff508bd61c50a336d0b16617f2$export$ActionGroupKeyboardDelegate = /*#__PURE__*/function () { | ||
function ActionGroupKeyboardDelegate(collection, direction, orientation) { | ||
_babelRuntimeHelpersClassCallCheck(this, ActionGroupKeyboardDelegate); | ||
*/ | ||
_babelRuntimeHelpersDefineProperty(this, "collection", void 0); | ||
_babelRuntimeHelpersDefineProperty(this, "flipDirection", void 0); | ||
this.collection = collection; | ||
this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; | ||
} | ||
_babelRuntimeHelpersCreateClass(ActionGroupKeyboardDelegate, [{ | ||
key: "getKeyLeftOf", | ||
value: function getKeyLeftOf(key) { | ||
return this.flipDirection ? this.collection.getKeyAfter(key) || this.getFirstKey() : this.collection.getKeyBefore(key) || this.getLastKey(); | ||
} | ||
}, { | ||
key: "getKeyRightOf", | ||
value: function getKeyRightOf(key) { | ||
return this.flipDirection ? this.collection.getKeyBefore(key) || this.getLastKey() : this.collection.getKeyAfter(key) || this.getFirstKey(); | ||
} | ||
}, { | ||
key: "getKeyAbove", | ||
value: function getKeyAbove(key) { | ||
return this.collection.getKeyBefore(key) || this.getLastKey(); | ||
} | ||
}, { | ||
key: "getKeyBelow", | ||
value: function getKeyBelow(key) { | ||
return this.collection.getKeyAfter(key) || this.getFirstKey(); | ||
} | ||
}, { | ||
key: "getFirstKey", | ||
value: function getFirstKey() { | ||
return this.collection.getFirstKey(); | ||
} | ||
}, { | ||
key: "getLastKey", | ||
value: function getLastKey() { | ||
return this.collection.getLastKey(); | ||
} | ||
}]); | ||
return ActionGroupKeyboardDelegate; | ||
}(); | ||
var $cc717402b750716d2d7745c9c1$var$BUTTON_GROUP_ROLES = { | ||
'none': 'toolbar', | ||
'single': 'radiogroup', | ||
'multiple': 'toolbar' | ||
}; | ||
var $cc717402b750716d2d7745c9c1$var$BUTTON_ROLES = { | ||
'none': null, | ||
'single': 'radio', | ||
'multiple': 'checkbox' | ||
}; | ||
function useActionGroup(props, state) { | ||
var id = props.id, | ||
_props$selectionMode = props.selectionMode, | ||
selectionMode = _props$selectionMode === void 0 ? 'single' : _props$selectionMode, | ||
isDisabled = props.isDisabled, | ||
_props$orientation = props.orientation, | ||
orientation = _props$orientation === void 0 ? 'horizontal' : _props$orientation, | ||
_props$role = props.role, | ||
role = _props$role === void 0 ? $cc717402b750716d2d7745c9c1$var$BUTTON_GROUP_ROLES[selectionMode] : _props$role; | ||
var _useLocale = useLocale(), | ||
direction = _useLocale.direction; | ||
var keyboardDelegate = useMemo(function () { | ||
return new $cbc64ff508bd61c50a336d0b16617f2$export$ActionGroupKeyboardDelegate(state.collection, direction, orientation); | ||
}, [state.collection, direction, orientation]); | ||
var _useSelectableCollect = useSelectableCollection({ | ||
selectionManager: state.selectionManager, | ||
keyboardDelegate: keyboardDelegate, | ||
disallowSelectAll: true | ||
}), | ||
collectionProps = _useSelectableCollect.collectionProps; | ||
var _useState = useState(false), | ||
_useState2 = _babelRuntimeHelpersSlicedToArray(_useState, 2), | ||
isFocusWithin = _useState2[0], | ||
setFocusWithin = _useState2[1]; | ||
var _useFocusWithin = useFocusWithin({ | ||
onFocusWithinChange: setFocusWithin | ||
}), | ||
focusWithinProps = _useFocusWithin.focusWithinProps; | ||
var tabIndex = isFocusWithin ? -1 : 0; | ||
return { | ||
actionGroupProps: _babelRuntimeHelpersObjectSpread({ | ||
id: useId(id), | ||
role: role, | ||
tabIndex: isDisabled ? null : tabIndex, | ||
'aria-orientation': role === 'toolbar' ? orientation : null, | ||
'aria-disabled': isDisabled | ||
}, mergeProps(focusWithinProps, collectionProps)), | ||
buttonProps: { | ||
role: $cc717402b750716d2d7745c9c1$var$BUTTON_ROLES[selectionMode], | ||
onFocus: function onFocus(e) { | ||
e.continuePropagation(); | ||
} | ||
} | ||
}; | ||
} | ||
exports.useActionGroup = useActionGroup; | ||
//# sourceMappingURL=main.js.map |
@@ -1,8 +0,3 @@ | ||
import _babelRuntimeHelpersEsmObjectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import _babelRuntimeHelpersEsmDefineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { useMemo, useState } from "react"; | ||
import { mergeProps, useId } from "@react-aria/utils"; | ||
import { useFocusWithin } from "@react-aria/interactions"; | ||
import { useLocale } from "@react-aria/i18n"; | ||
import { useSelectableCollection } from "@react-aria/selection"; | ||
import {useActionGroup as $304ac34015d4535d$export$f4bf8d43c16de704} from "./useActionGroup.module.js"; | ||
import {useActionGroupItem as $f0ac0fb73c3ec062$export$9597202bd3099a29} from "./useActionGroupItem.module.js"; | ||
@@ -14,3 +9,3 @@ /* | ||
* 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 | ||
@@ -20,90 +15,7 @@ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS | ||
* governing permissions and limitations under the License. | ||
*/ | ||
class $eac4d794a2dbc4809f226ada934b8664$export$ActionGroupKeyboardDelegate { | ||
constructor(collection, direction, orientation) { | ||
_babelRuntimeHelpersEsmDefineProperty(this, "collection", void 0); | ||
*/ | ||
_babelRuntimeHelpersEsmDefineProperty(this, "flipDirection", void 0); | ||
this.collection = collection; | ||
this.flipDirection = direction === 'rtl' && orientation === 'horizontal'; | ||
} | ||
getKeyLeftOf(key) { | ||
return this.flipDirection ? this.collection.getKeyAfter(key) || this.getFirstKey() : this.collection.getKeyBefore(key) || this.getLastKey(); | ||
} | ||
getKeyRightOf(key) { | ||
return this.flipDirection ? this.collection.getKeyBefore(key) || this.getLastKey() : this.collection.getKeyAfter(key) || this.getFirstKey(); | ||
} | ||
getKeyAbove(key) { | ||
return this.collection.getKeyBefore(key) || this.getLastKey(); | ||
} | ||
getKeyBelow(key) { | ||
return this.collection.getKeyAfter(key) || this.getFirstKey(); | ||
} | ||
getFirstKey() { | ||
return this.collection.getFirstKey(); | ||
} | ||
getLastKey() { | ||
return this.collection.getLastKey(); | ||
} | ||
} | ||
const $f7fd47918e2c4b42be7ca913c8e338$var$BUTTON_GROUP_ROLES = { | ||
'none': 'toolbar', | ||
'single': 'radiogroup', | ||
'multiple': 'toolbar' | ||
}; | ||
const $f7fd47918e2c4b42be7ca913c8e338$var$BUTTON_ROLES = { | ||
'none': null, | ||
'single': 'radio', | ||
'multiple': 'checkbox' | ||
}; | ||
export function useActionGroup(props, state) { | ||
let { | ||
id, | ||
selectionMode = 'single', | ||
isDisabled, | ||
orientation = 'horizontal', | ||
role = $f7fd47918e2c4b42be7ca913c8e338$var$BUTTON_GROUP_ROLES[selectionMode] | ||
} = props; | ||
let { | ||
direction | ||
} = useLocale(); | ||
let keyboardDelegate = useMemo(() => new $eac4d794a2dbc4809f226ada934b8664$export$ActionGroupKeyboardDelegate(state.collection, direction, orientation), [state.collection, direction, orientation]); | ||
let { | ||
collectionProps | ||
} = useSelectableCollection({ | ||
selectionManager: state.selectionManager, | ||
keyboardDelegate, | ||
disallowSelectAll: true | ||
}); | ||
let [isFocusWithin, setFocusWithin] = useState(false); | ||
let { | ||
focusWithinProps | ||
} = useFocusWithin({ | ||
onFocusWithinChange: setFocusWithin | ||
}); | ||
let tabIndex = isFocusWithin ? -1 : 0; | ||
return { | ||
actionGroupProps: _babelRuntimeHelpersEsmObjectSpread({ | ||
id: useId(id), | ||
role, | ||
tabIndex: isDisabled ? null : tabIndex, | ||
'aria-orientation': role === 'toolbar' ? orientation : null, | ||
'aria-disabled': isDisabled | ||
}, mergeProps(focusWithinProps, collectionProps)), | ||
buttonProps: { | ||
role: $f7fd47918e2c4b42be7ca913c8e338$var$BUTTON_ROLES[selectionMode], | ||
onFocus: e => { | ||
e.continuePropagation(); | ||
} | ||
} | ||
}; | ||
} | ||
export {$304ac34015d4535d$export$f4bf8d43c16de704 as useActionGroup, $f0ac0fb73c3ec062$export$9597202bd3099a29 as useActionGroupItem}; | ||
//# sourceMappingURL=module.js.map |
@@ -1,10 +0,18 @@ | ||
import { ActionGroupProps } from "@react-types/actiongroup"; | ||
import { ActionGroupState } from "@react-stately/actiongroup"; | ||
import { HTMLAttributes } from "react"; | ||
import { AriaActionGroupProps } from "@react-types/actiongroup"; | ||
import { DOMAttributes, FocusableElement, RefObject, Key } from "@react-types/shared"; | ||
import { ListState } from "@react-stately/list"; | ||
import { PressProps } from "@react-aria/interactions"; | ||
export interface ActionGroupAria { | ||
actionGroupProps: HTMLAttributes<HTMLElement>; | ||
buttonProps: HTMLAttributes<HTMLElement>; | ||
actionGroupProps: DOMAttributes; | ||
} | ||
export function useActionGroup<T>(props: ActionGroupProps<T>, state: ActionGroupState<T>): ActionGroupAria; | ||
export function useActionGroup<T>(props: AriaActionGroupProps<T>, state: ListState<T>, ref: RefObject<FocusableElement | null>): ActionGroupAria; | ||
export interface AriaActionGroupItemProps { | ||
key: Key; | ||
} | ||
export interface ActionGroupItemAria { | ||
buttonProps: DOMAttributes & PressProps; | ||
} | ||
export function useActionGroupItem<T>(props: AriaActionGroupItemProps, state: ListState<T>, ref?: RefObject<FocusableElement | null>): ActionGroupItemAria; | ||
export type { AriaActionGroupProps } from '@react-types/actiongroup'; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@react-aria/actiongroup", | ||
"version": "3.0.0-alpha.1", | ||
"version": "3.0.0-nightly-07431f4b1-241030", | ||
"description": "Spectrum UI components in React", | ||
@@ -8,6 +8,12 @@ "license": "Apache-2.0", | ||
"module": "dist/module.js", | ||
"exports": { | ||
"types": "./dist/types.d.ts", | ||
"import": "./dist/import.mjs", | ||
"require": "./dist/main.js" | ||
}, | ||
"types": "dist/types.d.ts", | ||
"source": "src/index.ts", | ||
"files": [ | ||
"dist" | ||
"dist", | ||
"src" | ||
], | ||
@@ -17,16 +23,17 @@ "sideEffects": false, | ||
"type": "git", | ||
"url": "https://github.com/adobe-private/react-spectrum-v3" | ||
"url": "https://github.com/adobe/react-spectrum" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "^7.6.2", | ||
"@react-aria/i18n": "^3.0.0-rc.2", | ||
"@react-aria/interactions": "^3.0.0-rc.2", | ||
"@react-aria/selection": "^3.0.0-alpha.1", | ||
"@react-aria/utils": "^3.0.0-rc.2", | ||
"@react-stately/actiongroup": "^3.0.0-alpha.1", | ||
"@react-stately/collections": "^3.0.0-alpha.1", | ||
"@react-types/actiongroup": "^3.0.0-alpha.1" | ||
"@react-aria/focus": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/i18n": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/interactions": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-aria/utils": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-stately/list": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-types/actiongroup": "^3.0.0-nightly-07431f4b1-241030", | ||
"@react-types/shared": "^3.0.0-nightly-07431f4b1-241030", | ||
"@swc/helpers": "^0.5.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.8.0" | ||
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0", | ||
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -36,3 +43,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "207e6ee9076905c96638a7f81a367758872e1410" | ||
} | ||
"stableVersion": "3.7.10" | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 5 instances in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
49115
22
628
0
3
10
5
60
1
+ Added@swc/helpers@^0.5.0
+ Added@react-stately/list@3.11.2(transitive)
- Removed@babel/runtime@^7.6.2
- Removed@react-aria/selection@^3.0.0-alpha.1
- Removed@babel/runtime@7.26.0(transitive)
- Removed@react-aria/selection@3.22.0(transitive)
- Removed@react-stately/actiongroup@3.0.0-alpha.1(transitive)
- Removed@react-types/button@3.10.2(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedprop-types@15.8.1(transitive)
- Removedreact@16.14.0(transitive)
- Removedreact-is@16.13.1(transitive)
- Removedregenerator-runtime@0.14.1(transitive)
Updated@react-aria/interactions@^3.0.0-nightly-07431f4b1-241030
Updated@react-types/actiongroup@^3.0.0-nightly-07431f4b1-241030