react-accessible-accordion
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -1,3 +0,29 @@ | ||
import { createElement, PureComponent, createContext, useState, Fragment } from 'react'; | ||
import { createElement, PureComponent, createContext, useId, useState, Fragment } from 'react'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -22,2 +48,5 @@ if (!(instance instanceof Constructor)) { | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, "prototype", { | ||
writable: false | ||
}); | ||
return Constructor; | ||
@@ -59,36 +88,2 @@ } | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _inherits(subClass, superClass) { | ||
@@ -106,2 +101,5 @@ if (typeof superClass !== "function" && superClass !== null) { | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
@@ -132,3 +130,3 @@ } | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); | ||
return true; | ||
@@ -187,2 +185,4 @@ } catch (e) { | ||
return call; | ||
} else if (call !== void 0) { | ||
throw new TypeError("Derived constructors may only return object or undefined"); | ||
} | ||
@@ -229,14 +229,17 @@ | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
var _s, _e; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
@@ -285,3 +288,3 @@ | ||
var AccordionStore = function AccordionStore(_ref) { | ||
var AccordionStore = /*#__PURE__*/_createClass(function AccordionStore(_ref) { | ||
var _this = this; | ||
@@ -367,8 +370,8 @@ | ||
_defineProperty(this, "getPanelId", function (uuid) { | ||
return "accordion__panel-".concat(uuid); | ||
_defineProperty(this, "getPanelId", function (id) { | ||
return "accordion__panel-".concat(id); | ||
}); | ||
_defineProperty(this, "getButtonId", function (uuid) { | ||
return "accordion__heading-".concat(uuid); | ||
_defineProperty(this, "getButtonId", function (id) { | ||
return "accordion__heading-".concat(id); | ||
}); | ||
@@ -387,3 +390,3 @@ | ||
this.allowZeroExpanded = allowZeroExpanded; | ||
}; | ||
}); | ||
@@ -486,4 +489,4 @@ var Context = /*#__PURE__*/createContext(null); | ||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
@@ -510,2 +513,4 @@ | ||
var _excluded = ["className", "allowMultipleExpanded", "allowZeroExpanded", "onChange", "preExpanded"]; | ||
var Accordion = function Accordion(_ref) { | ||
@@ -518,3 +523,3 @@ var _ref$className = _ref.className, | ||
preExpanded = _ref.preExpanded, | ||
rest = _objectWithoutProperties(_ref, ["className", "allowMultipleExpanded", "allowZeroExpanded", "onChange", "preExpanded"]); | ||
rest = _objectWithoutProperties(_ref, _excluded); | ||
@@ -544,5 +549,6 @@ return /*#__PURE__*/createElement(Provider, { | ||
// @ts-ignore | ||
var DEFAULT = 0; | ||
var counter = DEFAULT; | ||
function nextUuid() { | ||
var counter = 0; | ||
function useGlobalCounterId() { | ||
var current = counter; | ||
@@ -552,5 +558,6 @@ counter = counter + 1; | ||
} | ||
function resetNextUuid() { | ||
function resetGlobalCounterId() { | ||
counter = DEFAULT; | ||
} // HTML5 ids allow all unicode characters, except for ASCII whitespaces | ||
} | ||
var useNextId = useId || useGlobalCounterId; // HTML5 ids allow all unicode characters, except for ASCII whitespaces | ||
// https://infra.spec.whatwg.org/#ascii-whitespace | ||
@@ -620,2 +627,4 @@ // eslint-disable-next-line no-control-regex | ||
var _excluded$1 = ["uuid", "dangerouslySetExpanded", "className", "activeClassName"]; | ||
var AccordionItem = function AccordionItem(_ref) { | ||
@@ -627,5 +636,5 @@ var customUuid = _ref.uuid, | ||
activeClassName = _ref.activeClassName, | ||
rest = _objectWithoutProperties(_ref, ["uuid", "dangerouslySetExpanded", "className", "activeClassName"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$1); | ||
var _useState = useState(nextUuid()), | ||
var _useState = useState(useNextId()), | ||
_useState2 = _slicedToArray(_useState, 1), | ||
@@ -719,2 +728,4 @@ instanceUuid = _useState2[0]; | ||
var _excluded$2 = ["toggleExpanded", "className"]; | ||
var AccordionItemButton = function AccordionItemButton(_ref) { | ||
@@ -724,3 +735,3 @@ var toggleExpanded = _ref.toggleExpanded, | ||
className = _ref$className === void 0 ? 'accordion__button' : _ref$className, | ||
rest = _objectWithoutProperties(_ref, ["toggleExpanded", "className"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$2); | ||
@@ -882,2 +893,4 @@ var handleKeyPress = function handleKeyPress(evt) { | ||
var _excluded$3 = ["className", "region", "id"]; | ||
var AccordionItemPanel = function AccordionItemPanel(_ref) { | ||
@@ -888,3 +901,3 @@ var _ref$className = _ref.className, | ||
id = _ref.id, | ||
rest = _objectWithoutProperties(_ref, ["className", "region", "id"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$3); | ||
@@ -928,2 +941,2 @@ var renderChildren = function renderChildren(_ref2) { | ||
export { Accordion, AccordionItem, AccordionItemButtonWrapper as AccordionItemButton, AccordionItemHeadingWrapper as AccordionItemHeading, AccordionItemPanel, AccordionItemState, resetNextUuid }; | ||
export { Accordion, AccordionItem, AccordionItemButtonWrapper as AccordionItemButton, AccordionItemHeadingWrapper as AccordionItemHeading, AccordionItemPanel, AccordionItemState, resetGlobalCounterId as resetNextUuid }; |
/// <reference types="react" /> | ||
import { DivAttributes } from '../helpers/types'; | ||
import { UUID } from './ItemContext'; | ||
import { ID } from './ItemContext'; | ||
declare type AccordionProps = Pick<DivAttributes, Exclude<keyof DivAttributes, 'onChange'>> & { | ||
className?: string; | ||
preExpanded?: UUID[]; | ||
preExpanded?: ID[]; | ||
allowMultipleExpanded?: boolean; | ||
allowZeroExpanded?: boolean; | ||
onChange?(args: UUID[]): void; | ||
onChange?(args: ID[]): void; | ||
}; | ||
declare const Accordion: ({ className, allowMultipleExpanded, allowZeroExpanded, onChange, preExpanded, ...rest }: AccordionProps) => JSX.Element; | ||
export default Accordion; |
import * as React from 'react'; | ||
import AccordionStore, { InjectedButtonAttributes, InjectedHeadingAttributes, InjectedPanelAttributes } from '../helpers/AccordionStore'; | ||
import { UUID } from './ItemContext'; | ||
import { ID } from './ItemContext'; | ||
export interface ProviderProps { | ||
preExpanded?: UUID[]; | ||
preExpanded?: ID[]; | ||
allowMultipleExpanded?: boolean; | ||
allowZeroExpanded?: boolean; | ||
children?: React.ReactNode; | ||
onChange?(args: UUID[]): void; | ||
onChange?(args: ID[]): void; | ||
} | ||
@@ -15,8 +15,8 @@ declare type ProviderState = AccordionStore; | ||
allowZeroExpanded: boolean; | ||
toggleExpanded(uuid: UUID): void; | ||
isItemDisabled(uuid: UUID): boolean; | ||
isItemExpanded(uuid: UUID): boolean; | ||
getPanelAttributes(uuid: UUID, dangerouslySetExpanded?: boolean): InjectedPanelAttributes; | ||
getHeadingAttributes(uuid: UUID): InjectedHeadingAttributes; | ||
getButtonAttributes(uuid: UUID, dangerouslySetExpanded?: boolean): InjectedButtonAttributes; | ||
toggleExpanded(uuid: ID): void; | ||
isItemDisabled(uuid: ID): boolean; | ||
isItemExpanded(uuid: ID): boolean; | ||
getPanelAttributes(uuid: ID, dangerouslySetExpanded?: boolean): InjectedPanelAttributes; | ||
getHeadingAttributes(uuid: ID): InjectedHeadingAttributes; | ||
getButtonAttributes(uuid: ID, dangerouslySetExpanded?: boolean): InjectedButtonAttributes; | ||
} | ||
@@ -26,8 +26,8 @@ export declare class Provider extends React.PureComponent<ProviderProps, ProviderState> { | ||
state: ProviderState; | ||
toggleExpanded: (key: UUID) => void; | ||
isItemDisabled: (key: UUID) => boolean; | ||
isItemExpanded: (key: UUID) => boolean; | ||
getPanelAttributes: (key: UUID, dangerouslySetExpanded?: boolean | undefined) => InjectedPanelAttributes; | ||
toggleExpanded: (key: ID) => void; | ||
isItemDisabled: (key: ID) => boolean; | ||
isItemExpanded: (key: ID) => boolean; | ||
getPanelAttributes: (key: ID, dangerouslySetExpanded?: boolean | undefined) => InjectedPanelAttributes; | ||
getHeadingAttributes: () => InjectedHeadingAttributes; | ||
getButtonAttributes: (key: UUID, dangerouslySetExpanded?: boolean | undefined) => InjectedButtonAttributes; | ||
getButtonAttributes: (key: ID, dangerouslySetExpanded?: boolean | undefined) => InjectedButtonAttributes; | ||
render(): JSX.Element; | ||
@@ -34,0 +34,0 @@ } |
/// <reference types="react" /> | ||
import DisplayName from '../helpers/DisplayName'; | ||
import { DivAttributes } from '../helpers/types'; | ||
import { UUID } from './ItemContext'; | ||
import { ID } from './ItemContext'; | ||
declare type Props = DivAttributes & { | ||
uuid?: UUID; | ||
uuid?: ID; | ||
activeClassName?: string; | ||
@@ -8,0 +8,0 @@ dangerouslySetExpanded?: boolean; |
@@ -5,3 +5,3 @@ import * as React from 'react'; | ||
declare type WrapperProps = Pick<DivAttributes, Exclude<keyof DivAttributes, keyof InjectedButtonAttributes>>; | ||
declare const AccordionItemButtonWrapper: React.SFC<WrapperProps>; | ||
declare const AccordionItemButtonWrapper: React.FC<WrapperProps>; | ||
export default AccordionItemButtonWrapper; |
@@ -18,3 +18,3 @@ import * as React from 'react'; | ||
} | ||
declare const AccordionItemHeadingWrapper: React.SFC<DivAttributes>; | ||
declare const AccordionItemHeadingWrapper: React.FC<DivAttributes>; | ||
export default AccordionItemHeadingWrapper; |
import * as React from 'react'; | ||
import { InjectedButtonAttributes, InjectedHeadingAttributes, InjectedPanelAttributes } from '../helpers/AccordionStore'; | ||
import { AccordionContext } from './AccordionContext'; | ||
export declare type UUID = string | number; | ||
export declare type ID = string | number; | ||
declare type ProviderProps = { | ||
children?: React.ReactNode; | ||
uuid: UUID; | ||
uuid: ID; | ||
accordionContext: AccordionContext; | ||
@@ -13,3 +13,3 @@ dangerouslySetExpanded?: boolean; | ||
export declare type ItemContext = { | ||
uuid: UUID; | ||
uuid: ID; | ||
expanded: boolean; | ||
@@ -22,3 +22,3 @@ disabled: boolean; | ||
}; | ||
declare const ProviderWrapper: React.SFC<ProviderWrapperProps>; | ||
declare const ProviderWrapper: React.FunctionComponent<ProviderWrapperProps>; | ||
export { ProviderWrapper as Provider }; | ||
@@ -25,0 +25,0 @@ declare type ConsumerProps = { |
@@ -1,2 +0,2 @@ | ||
import { UUID } from '../components/ItemContext'; | ||
import { ID } from '../components/ItemContext'; | ||
export interface InjectedPanelAttributes { | ||
@@ -21,16 +21,16 @@ role: string | undefined; | ||
export default class AccordionStore { | ||
readonly expanded: UUID[]; | ||
readonly expanded: ID[]; | ||
readonly allowMultipleExpanded: boolean; | ||
readonly allowZeroExpanded: boolean; | ||
constructor({ expanded, allowMultipleExpanded, allowZeroExpanded, }: { | ||
expanded?: UUID[]; | ||
expanded?: ID[]; | ||
allowMultipleExpanded?: boolean; | ||
allowZeroExpanded?: boolean; | ||
}); | ||
readonly toggleExpanded: (uuid: UUID) => AccordionStore; | ||
readonly isItemDisabled: (uuid: UUID) => boolean; | ||
readonly isItemExpanded: (uuid: UUID) => boolean; | ||
readonly getPanelAttributes: (uuid: UUID, dangerouslySetExpanded?: boolean | undefined) => InjectedPanelAttributes; | ||
readonly toggleExpanded: (uuid: ID) => AccordionStore; | ||
readonly isItemDisabled: (uuid: ID) => boolean; | ||
readonly isItemExpanded: (uuid: ID) => boolean; | ||
readonly getPanelAttributes: (uuid: ID, dangerouslySetExpanded?: boolean | undefined) => InjectedPanelAttributes; | ||
readonly getHeadingAttributes: () => InjectedHeadingAttributes; | ||
readonly getButtonAttributes: (uuid: UUID, dangerouslySetExpanded?: boolean | undefined) => InjectedButtonAttributes; | ||
readonly getButtonAttributes: (uuid: ID, dangerouslySetExpanded?: boolean | undefined) => InjectedButtonAttributes; | ||
private readonly getPanelId; | ||
@@ -37,0 +37,0 @@ private readonly getButtonId; |
@@ -7,3 +7,3 @@ import Accordion from './components/Accordion'; | ||
import AccordionItemState from './components/AccordionItemState'; | ||
import { resetNextUuid } from './helpers/uuid'; | ||
export { Accordion, AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel, AccordionItemState, resetNextUuid, }; | ||
import { resetGlobalCounterId } from './helpers/id'; | ||
export { Accordion, AccordionItem, AccordionItemButton, AccordionItemHeading, AccordionItemPanel, AccordionItemState, resetGlobalCounterId as resetNextUuid, }; |
@@ -7,2 +7,28 @@ (function (global, factory) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
return target; | ||
} | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -27,2 +53,5 @@ if (!(instance instanceof Constructor)) { | ||
if (staticProps) _defineProperties(Constructor, staticProps); | ||
Object.defineProperty(Constructor, "prototype", { | ||
writable: false | ||
}); | ||
return Constructor; | ||
@@ -64,36 +93,2 @@ } | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
} | ||
return target; | ||
} | ||
function _inherits(subClass, superClass) { | ||
@@ -111,2 +106,5 @@ if (typeof superClass !== "function" && superClass !== null) { | ||
}); | ||
Object.defineProperty(subClass, "prototype", { | ||
writable: false | ||
}); | ||
if (superClass) _setPrototypeOf(subClass, superClass); | ||
@@ -137,3 +135,3 @@ } | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); | ||
return true; | ||
@@ -192,2 +190,4 @@ } catch (e) { | ||
return call; | ||
} else if (call !== void 0) { | ||
throw new TypeError("Derived constructors may only return object or undefined"); | ||
} | ||
@@ -234,14 +234,17 @@ | ||
function _iterableToArray(iter) { | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; | ||
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (_i == null) return; | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
var _s, _e; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
@@ -290,3 +293,3 @@ | ||
var AccordionStore = function AccordionStore(_ref) { | ||
var AccordionStore = /*#__PURE__*/_createClass(function AccordionStore(_ref) { | ||
var _this = this; | ||
@@ -372,8 +375,8 @@ | ||
_defineProperty(this, "getPanelId", function (uuid) { | ||
return "accordion__panel-".concat(uuid); | ||
_defineProperty(this, "getPanelId", function (id) { | ||
return "accordion__panel-".concat(id); | ||
}); | ||
_defineProperty(this, "getButtonId", function (uuid) { | ||
return "accordion__heading-".concat(uuid); | ||
_defineProperty(this, "getButtonId", function (id) { | ||
return "accordion__heading-".concat(id); | ||
}); | ||
@@ -392,3 +395,3 @@ | ||
this.allowZeroExpanded = allowZeroExpanded; | ||
}; | ||
}); | ||
@@ -491,4 +494,4 @@ var Context = /*#__PURE__*/React.createContext(null); | ||
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { | ||
args[_key3] = arguments[_key3]; | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
} | ||
@@ -515,2 +518,4 @@ | ||
var _excluded = ["className", "allowMultipleExpanded", "allowZeroExpanded", "onChange", "preExpanded"]; | ||
var Accordion = function Accordion(_ref) { | ||
@@ -523,3 +528,3 @@ var _ref$className = _ref.className, | ||
preExpanded = _ref.preExpanded, | ||
rest = _objectWithoutProperties(_ref, ["className", "allowMultipleExpanded", "allowZeroExpanded", "onChange", "preExpanded"]); | ||
rest = _objectWithoutProperties(_ref, _excluded); | ||
@@ -549,5 +554,6 @@ return /*#__PURE__*/React.createElement(Provider, { | ||
// @ts-ignore | ||
var DEFAULT = 0; | ||
var counter = DEFAULT; | ||
function nextUuid() { | ||
var counter = 0; | ||
function useGlobalCounterId() { | ||
var current = counter; | ||
@@ -557,5 +563,6 @@ counter = counter + 1; | ||
} | ||
function resetNextUuid() { | ||
function resetGlobalCounterId() { | ||
counter = DEFAULT; | ||
} // HTML5 ids allow all unicode characters, except for ASCII whitespaces | ||
} | ||
var useNextId = React.useId || useGlobalCounterId; // HTML5 ids allow all unicode characters, except for ASCII whitespaces | ||
// https://infra.spec.whatwg.org/#ascii-whitespace | ||
@@ -625,2 +632,4 @@ // eslint-disable-next-line no-control-regex | ||
var _excluded$1 = ["uuid", "dangerouslySetExpanded", "className", "activeClassName"]; | ||
var AccordionItem = function AccordionItem(_ref) { | ||
@@ -632,5 +641,5 @@ var customUuid = _ref.uuid, | ||
activeClassName = _ref.activeClassName, | ||
rest = _objectWithoutProperties(_ref, ["uuid", "dangerouslySetExpanded", "className", "activeClassName"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$1); | ||
var _useState = React.useState(nextUuid()), | ||
var _useState = React.useState(useNextId()), | ||
_useState2 = _slicedToArray(_useState, 1), | ||
@@ -724,2 +733,4 @@ instanceUuid = _useState2[0]; | ||
var _excluded$2 = ["toggleExpanded", "className"]; | ||
var AccordionItemButton = function AccordionItemButton(_ref) { | ||
@@ -729,3 +740,3 @@ var toggleExpanded = _ref.toggleExpanded, | ||
className = _ref$className === void 0 ? 'accordion__button' : _ref$className, | ||
rest = _objectWithoutProperties(_ref, ["toggleExpanded", "className"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$2); | ||
@@ -887,2 +898,4 @@ var handleKeyPress = function handleKeyPress(evt) { | ||
var _excluded$3 = ["className", "region", "id"]; | ||
var AccordionItemPanel = function AccordionItemPanel(_ref) { | ||
@@ -893,3 +906,3 @@ var _ref$className = _ref.className, | ||
id = _ref.id, | ||
rest = _objectWithoutProperties(_ref, ["className", "region", "id"]); | ||
rest = _objectWithoutProperties(_ref, _excluded$3); | ||
@@ -939,3 +952,3 @@ var renderChildren = function renderChildren(_ref2) { | ||
exports.AccordionItemState = AccordionItemState; | ||
exports.resetNextUuid = resetNextUuid; | ||
exports.resetNextUuid = resetGlobalCounterId; | ||
@@ -942,0 +955,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
{ | ||
"name": "react-accessible-accordion", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "Accessible Accordion component for React", | ||
@@ -28,3 +28,3 @@ "main": "dist/umd/index.js", | ||
"format": "prettier \"**/*\" --write", | ||
"prepublishOnly": "yarn typecheck && yarn lint && yarn test && yarn build" | ||
"prepublishOnly": "yarn lint && yarn test && yarn build" | ||
}, | ||
@@ -93,8 +93,8 @@ "repository": { | ||
"@babel/preset-typescript": "^7.1.0", | ||
"@testing-library/react": "^8.0.4", | ||
"@testing-library/react": "12", | ||
"@types/jest": "^24.0.15", | ||
"@types/react": "^16.8.22", | ||
"@types/react-dom": "^16.8.4", | ||
"@types/react": "^18.0.5", | ||
"@types/react-dom": "^18.0.1", | ||
"@types/react-syntax-highlighter": "^11.0.4", | ||
"@types/react-test-renderer": "^16.8.2", | ||
"@types/react-test-renderer": "^18.0.0", | ||
"@types/uuid": "^3.4.4", | ||
@@ -120,4 +120,4 @@ "@typescript-eslint/eslint-plugin": "^3.6.0", | ||
"puppeteer": "2.0.0", | ||
"react": "16.8.0", | ||
"react-dom": "16.8.0", | ||
"react": "17", | ||
"react-dom": "17", | ||
"react-syntax-highlighter": "^12.2.1", | ||
@@ -139,4 +139,4 @@ "react-test-renderer": "^16.8.6", | ||
"peerDependencies": { | ||
"react": "^16.3.2 || ^17.0.0", | ||
"react-dom": "^16.3.3 || ^17.0.0" | ||
"react": "^16.3.2 || ^17.0.0 || ^18.0.0", | ||
"react-dom": "^16.3.3 || ^17.0.0 || ^18.0.0" | ||
}, | ||
@@ -143,0 +143,0 @@ "husky": { |
@@ -210,2 +210,7 @@ [react-accessible-accordion](https://springload.github.io/react-accessible-accordion/) | ||
### React 18? | ||
RAA supports React 18, and the new out-of-order streaming feature. See the | ||
CHANGELOG for details. | ||
### Which design patterns does this component aim to solve? | ||
@@ -229,4 +234,4 @@ | ||
multi-step forms, like those seen in many cart/checkout flows, which we believe | ||
require (other) complex markup in order to be considered 'accessible'. | ||
This also includes disclosure widgets. | ||
require (other) complex markup in order to be considered 'accessible'. This also | ||
includes disclosure widgets. | ||
@@ -233,0 +238,0 @@ ### How do I disable an item? |
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
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
101625
22
1772
253