New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@elliemae/ds-shared

Package Overview
Dependencies
Maintainers
2
Versions
2503
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@elliemae/ds-shared - npm Package Compare versions

Comparing version 0.3.30 to 0.3.31

FocusGroup/utils/getNextCellPosition.js

77

FocusGroup/FocusGrid.js

@@ -15,3 +15,3 @@ "use strict";

var _getNextCell = _interopRequireDefault(require("./utils/getNextCell"));
var _getNextCellPosition = _interopRequireDefault(require("./utils/getNextCellPosition"));

@@ -75,5 +75,11 @@ var _jsxFileName = "/Users/marcarbones/PROJECTS/dimsum-releases/packages/ds-shared/src/FocusGroup/FocusGrid.js";

var child = _react.default.cloneElement(_react.default.Children.only(children), {
ref: containerRef
innerRef: containerRef
});
var getNode = function getNode(_ref3) {
var rowIndex = _ref3.rowIndex,
cellIndex = _ref3.cellIndex;
return (0, _utils.get)(grid.current, [rowIndex, cellIndex]);
};
var register = function register(node, rowIndex, columnIndex) {

@@ -84,5 +90,15 @@ if (!Array.isArray(grid.current[rowIndex])) {

node.setAttribute('tabindex', -1);
if (rowIndex === 0 && columnIndex === 0) {
node.setAttribute('tabindex', 0);
} else {
node.setAttribute('tabindex', -1);
}
node.onfocus = function () {
var prevNode = getNode({
rowIndex: focusedRow.current,
cellIndex: focusedCell.current
});
if (prevNode) prevNode.setAttribute('tabindex', -1);
node.setAttribute('tabindex', 0);
focusedRow.current = rowIndex;

@@ -104,4 +120,4 @@ focusedCell.current = columnIndex;

var focusNextCell = function focusNextCell(directionY, directionX) {
var nextCell = (0, _getNextCell.default)({
var focusNextCell = function focusNextCell(directionY, directionX, position) {
var _ref4 = position || (0, _getNextCellPosition.default)({
grid: grid.current,

@@ -114,8 +130,15 @@ currentCell: focusedCell.current,

shouldWrapRows: shouldWrapRows
});
}),
rowIndex = _ref4.rowIndex,
cellIndex = _ref4.cellIndex;
if (nextCell.node) {
nextCell.node.focus();
focusedRow.current = nextCell.rowIndex;
focusedCell.current = nextCell.cellIndex;
var node = getNode({
rowIndex: rowIndex,
cellIndex: cellIndex
}); // can focus
if (node) {
node.focus();
focusedRow.current = rowIndex;
focusedCell.current = cellIndex;
}

@@ -129,3 +152,3 @@ };

var nextKeyBindings = _objectSpread({
var defaultKeyBindings = _objectSpread({
ArrowUp: (0, _utils.runAll)(preventDefault, function () {

@@ -142,5 +165,35 @@ return focusNextCell(-1, 0);

return focusNextCell(0, -1);
}),
Home: (0, _utils.runAll)(preventDefault, function (e) {
var rowIndex = focusedRow.current;
if (e.ctrlKey) {
rowIndex = 0;
}
focusNextCell(0, 0, {
rowIndex: rowIndex,
cellIndex: 0
});
}),
End: (0, _utils.runAll)(preventDefault, function (e) {
var rowIndex = focusedRow.current;
if (e.ctrlKey) {
rowIndex = grid.current.length - 1;
}
focusNextCell(0, 0, {
rowIndex: rowIndex,
cellIndex: grid.current[0].length - 1
});
})
}, keyBindings);
var nextKeyBindings = (0, _utils.isFunction)(keyBindings) ? keyBindings({
defaultBindings: defaultKeyBindings,
rowIndex: focusedRow.current,
cellIndex: focusedCell.current
}) : _objectSpread({}, defaultKeyBindings, keyBindings);
var onKeyDown = function onKeyDown(e) {

@@ -175,5 +228,5 @@ if (e.target.tagName.toLowerCase() === 'input') return;

fileName: _jsxFileName,
lineNumber: 123
lineNumber: 174
}
}, child);
}

2

package.json
{
"name": "@elliemae/ds-shared",
"version": "0.3.30",
"version": "0.3.31",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Ellie Mae - Dim Sum - Shared components and utilities",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc