Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@restart/ui

Package Overview
Dependencies
Maintainers
3
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/ui - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

9

cjs/Nav.d.ts

@@ -6,4 +6,13 @@ import * as React from 'react';

export interface NavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
/**
* Key for the currently active NavItem.
*/
activeKey?: EventKey;
/**
* Element used to render the component.
*/
as?: React.ElementType;
/**
* A callback fired when a NavItem has been selected.
*/
onSelect?: SelectCallback;

@@ -10,0 +19,0 @@ }

14

cjs/Nav.js

@@ -8,4 +8,2 @@ "use strict";

var _propTypes = _interopRequireDefault(require("prop-types"));
var React = _interopRequireWildcard(require("react"));

@@ -40,13 +38,2 @@

const propTypes = {
onSelect: _propTypes.default.func,
as: _propTypes.default.elementType,
role: _propTypes.default.string,
/** @private */
onKeyDown: _propTypes.default.func,
/** @private */
activeKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
};
const EVENT_KEY_ATTR = (0, _DataKey.dataAttr)('event-key');

@@ -161,3 +148,2 @@ const Nav = /*#__PURE__*/React.forwardRef((_ref, ref) => {

Nav.displayName = 'Nav';
Nav.propTypes = propTypes;

@@ -164,0 +150,0 @@ var _default = Object.assign(Nav, {

21

cjs/NavItem.d.ts
import * as React from 'react';
import { EventKey, DynamicRefForwardingComponent, SelectCallback } from './types';
import { EventKey, DynamicRefForwardingComponent } from './types';
import Button from './Button';
export interface NavItemProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
export interface NavItemProps extends React.HTMLAttributes<HTMLElement> {
/**
* Highlight the NavItem as active.
*/
active?: boolean;
/**
* Element used to render the component.
*/
as?: React.ElementType;
/**
* Disable the NavItem, making it unselectable.
*/
disabled?: boolean;
/**
* Value passed to the `onSelect` handler, useful for identifying the selected NavItem.
*/
eventKey?: EventKey;
/**
* HTML `href` attribute corresponding to `a.href`.
*/
href?: string;
tabIndex?: number;
onSelect?: SelectCallback;
}

@@ -13,0 +26,0 @@ export interface UseNavItemOptions {

@@ -7,4 +7,2 @@ "use strict";

var _propTypes = _interopRequireDefault(require("prop-types"));
var React = _interopRequireWildcard(require("react"));

@@ -24,2 +22,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }

@@ -29,19 +29,4 @@

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
const propTypes = {
id: _propTypes.default.string,
active: _propTypes.default.bool,
role: _propTypes.default.string,
href: _propTypes.default.string,
tabIndex: _propTypes.default.number,
eventKey: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
as: _propTypes.default.any,
onClick: _propTypes.default.func,
onSelect: _propTypes.default.func,
'aria-controls': _propTypes.default.string
};
function useNavItem({

@@ -93,3 +78,3 @@ key,

if (parentOnSelect && !e.isPropagationStopped()) {
parentOnSelect == null ? void 0 : parentOnSelect(key, e);
parentOnSelect(key, e);
}

@@ -105,9 +90,8 @@ });

as: Component = _Button.default,
eventKey,
href
eventKey
} = _ref,
options = _objectWithoutPropertiesLoose(_ref, ["as", "eventKey", "href"]);
options = _objectWithoutPropertiesLoose(_ref, ["as", "eventKey"]);
const [props, meta] = useNavItem(Object.assign({
key: (0, _SelectableContext.makeEventKey)(eventKey, href)
key: (0, _SelectableContext.makeEventKey)(eventKey, options.href)
}, options)); // @ts-ignore

@@ -121,4 +105,3 @@

NavItem.displayName = 'NavItem';
NavItem.propTypes = propTypes;
var _default = NavItem;
exports.default = _default;

@@ -6,4 +6,13 @@ import * as React from 'react';

export interface NavProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
/**
* Key for the currently active NavItem.
*/
activeKey?: EventKey;
/**
* Element used to render the component.
*/
as?: React.ElementType;
/**
* A callback fired when a NavItem has been selected.
*/
onSelect?: SelectCallback;

@@ -10,0 +19,0 @@ }

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import qsa from 'dom-helpers/querySelectorAll';
import PropTypes from 'prop-types';
import * as React from 'react';

@@ -19,13 +18,2 @@ import { useContext, useEffect, useRef } from 'react';

const propTypes = {
onSelect: PropTypes.func,
as: PropTypes.elementType,
role: PropTypes.string,
/** @private */
onKeyDown: PropTypes.func,
/** @private */
activeKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
};
const EVENT_KEY_ATTR = dataAttr('event-key');

@@ -140,5 +128,4 @@ const Nav = /*#__PURE__*/React.forwardRef((_ref, ref) => {

Nav.displayName = 'Nav';
Nav.propTypes = propTypes;
export default Object.assign(Nav, {
Item: NavItem
});
import * as React from 'react';
import { EventKey, DynamicRefForwardingComponent, SelectCallback } from './types';
import { EventKey, DynamicRefForwardingComponent } from './types';
import Button from './Button';
export interface NavItemProps extends Omit<React.HTMLAttributes<HTMLElement>, 'onSelect'> {
export interface NavItemProps extends React.HTMLAttributes<HTMLElement> {
/**
* Highlight the NavItem as active.
*/
active?: boolean;
/**
* Element used to render the component.
*/
as?: React.ElementType;
/**
* Disable the NavItem, making it unselectable.
*/
disabled?: boolean;
/**
* Value passed to the `onSelect` handler, useful for identifying the selected NavItem.
*/
eventKey?: EventKey;
/**
* HTML `href` attribute corresponding to `a.href`.
*/
href?: string;
tabIndex?: number;
onSelect?: SelectCallback;
}

@@ -13,0 +26,0 @@ export interface UseNavItemOptions {

function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
import PropTypes from 'prop-types';
import * as React from 'react';

@@ -12,14 +11,2 @@ import { useContext } from 'react';

import { jsx as _jsx } from "react/jsx-runtime";
const propTypes = {
id: PropTypes.string,
active: PropTypes.bool,
role: PropTypes.string,
href: PropTypes.string,
tabIndex: PropTypes.number,
eventKey: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
as: PropTypes.any,
onClick: PropTypes.func,
onSelect: PropTypes.func,
'aria-controls': PropTypes.string
};
export function useNavItem({

@@ -71,3 +58,3 @@ key,

if (parentOnSelect && !e.isPropagationStopped()) {
parentOnSelect == null ? void 0 : parentOnSelect(key, e);
parentOnSelect(key, e);
}

@@ -82,9 +69,8 @@ });

as: Component = Button,
eventKey,
href
eventKey
} = _ref,
options = _objectWithoutPropertiesLoose(_ref, ["as", "eventKey", "href"]);
options = _objectWithoutPropertiesLoose(_ref, ["as", "eventKey"]);
const [props, meta] = useNavItem(Object.assign({
key: makeEventKey(eventKey, href)
key: makeEventKey(eventKey, options.href)
}, options)); // @ts-ignore

@@ -98,3 +84,2 @@

NavItem.displayName = 'NavItem';
NavItem.propTypes = propTypes;
export default NavItem;
{
"name": "@restart/ui",
"version": "0.1.0",
"version": "0.1.1",
"description": "Utilities for creating robust overlay components",

@@ -5,0 +5,0 @@ "author": {

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