@szhsin/react-accordion
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -232,3 +232,3 @@ 'use strict'; | ||
var buttonId = _useId(); | ||
var panelId = _useId(); | ||
var panelId = buttonId && buttonId + '-'; | ||
var buttonProps = (_buttonProps = { | ||
@@ -382,3 +382,3 @@ id: buttonId | ||
var _excluded = ["forwardedRef", "itemRef", "state", "toggle", "className", "header", "headingProps", "buttonProps", "contentProps", "panelProps", "children"]; | ||
var _excluded = ["forwardedRef", "itemRef", "state", "toggle", "className", "header", "headingTag", "headingProps", "buttonProps", "contentProps", "panelProps", "children"]; | ||
@@ -396,2 +396,3 @@ var getRenderNode = function getRenderNode(nodeOrFunc, props) { | ||
header = _ref.header, | ||
headingTag = _ref.headingTag, | ||
headingProps = _ref.headingProps, | ||
@@ -428,13 +429,12 @@ buttonProps = _ref.buttonProps, | ||
className: bem(ACCORDION_BLOCK, 'item', modifiers, className, true), | ||
children: [/*#__PURE__*/jsxRuntime.jsx("h3", _extends({}, headingProps, { | ||
children: [/*#__PURE__*/react.createElement(headingTag || 'h3', _extends({}, headingProps, { | ||
style: _extends({ | ||
margin: 0 | ||
}, headingProps && headingProps.style), | ||
className: bem(ACCORDION_BLOCK, 'item-heading', modifiers, headingProps && headingProps.className), | ||
children: /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, mergeProps(_buttonProps, buttonProps), { | ||
type: "button", | ||
className: bem(ACCORDION_BLOCK, 'item-btn', modifiers, buttonProps && buttonProps.className), | ||
children: getRenderNode(header, itemState) | ||
})) | ||
})), isMounted && /*#__PURE__*/jsxRuntime.jsx("div", _extends({}, contentProps, { | ||
className: bem(ACCORDION_BLOCK, 'item-heading', modifiers, headingProps && headingProps.className) | ||
}), /*#__PURE__*/jsxRuntime.jsx("button", _extends({}, mergeProps(_buttonProps, buttonProps), { | ||
type: "button", | ||
className: bem(ACCORDION_BLOCK, 'item-btn', modifiers, buttonProps && buttonProps.className), | ||
children: getRenderNode(header, itemState) | ||
}))), isMounted && /*#__PURE__*/jsxRuntime.jsx("div", _extends({}, contentProps, { | ||
style: _extends({ | ||
@@ -441,0 +441,0 @@ display: status === 'exited' ? 'none' : undefined |
import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js'; | ||
import { memo } from 'react'; | ||
import { memo, createElement } from 'react'; | ||
import { ACCORDION_BLOCK } from '../utils/constants.js'; | ||
@@ -12,3 +12,3 @@ import { bem } from '../utils/bem.js'; | ||
var _excluded = ["forwardedRef", "itemRef", "state", "toggle", "className", "header", "headingProps", "buttonProps", "contentProps", "panelProps", "children"]; | ||
var _excluded = ["forwardedRef", "itemRef", "state", "toggle", "className", "header", "headingTag", "headingProps", "buttonProps", "contentProps", "panelProps", "children"]; | ||
@@ -26,2 +26,3 @@ var getRenderNode = function getRenderNode(nodeOrFunc, props) { | ||
header = _ref.header, | ||
headingTag = _ref.headingTag, | ||
headingProps = _ref.headingProps, | ||
@@ -58,13 +59,12 @@ buttonProps = _ref.buttonProps, | ||
className: bem(ACCORDION_BLOCK, 'item', modifiers, className, true), | ||
children: [/*#__PURE__*/jsx("h3", _extends({}, headingProps, { | ||
children: [/*#__PURE__*/createElement(headingTag || 'h3', _extends({}, headingProps, { | ||
style: _extends({ | ||
margin: 0 | ||
}, headingProps && headingProps.style), | ||
className: bem(ACCORDION_BLOCK, 'item-heading', modifiers, headingProps && headingProps.className), | ||
children: /*#__PURE__*/jsx("button", _extends({}, mergeProps(_buttonProps, buttonProps), { | ||
type: "button", | ||
className: bem(ACCORDION_BLOCK, 'item-btn', modifiers, buttonProps && buttonProps.className), | ||
children: getRenderNode(header, itemState) | ||
})) | ||
})), isMounted && /*#__PURE__*/jsx("div", _extends({}, contentProps, { | ||
className: bem(ACCORDION_BLOCK, 'item-heading', modifiers, headingProps && headingProps.className) | ||
}), /*#__PURE__*/jsx("button", _extends({}, mergeProps(_buttonProps, buttonProps), { | ||
type: "button", | ||
className: bem(ACCORDION_BLOCK, 'item-btn', modifiers, buttonProps && buttonProps.className), | ||
children: getRenderNode(header, itemState) | ||
}))), isMounted && /*#__PURE__*/jsx("div", _extends({}, contentProps, { | ||
style: _extends({ | ||
@@ -71,0 +71,0 @@ display: status === 'exited' ? 'none' : undefined |
@@ -10,3 +10,3 @@ import { ACCORDION_BTN_ATTR } from '../utils/constants.js'; | ||
var buttonId = _useId(); | ||
var panelId = _useId(); | ||
var panelId = buttonId && buttonId + '-'; | ||
var buttonProps = (_buttonProps = { | ||
@@ -13,0 +13,0 @@ id: buttonId |
{ | ||
"name": "@szhsin/react-accordion", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "An accessible React accordion library", | ||
@@ -5,0 +5,0 @@ "author": "Zheng Song", |
@@ -15,2 +15,3 @@ import { ReactNode, ForwardedRef } from 'react'; | ||
children?: NodeOrFunc; | ||
headingTag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'; | ||
headingProps?: ItemElementProps<HTMLHeadingElement>; | ||
@@ -17,0 +18,0 @@ buttonProps?: ItemElementProps<HTMLButtonElement>; |
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
45303
983
1