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

rc-collapse

Package Overview
Dependencies
Maintainers
5
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-collapse - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

6

es/interface.d.ts

@@ -1,3 +0,3 @@

import * as React from 'react';
import { CSSMotionProps } from 'rc-motion';
import type * as React from 'react';
import type { CSSMotionProps } from 'rc-motion';
export declare type CollapsibleType = 'header' | 'disabled';

@@ -16,2 +16,3 @@ export interface CollapseProps {

collapsible?: CollapsibleType;
children?: React.ReactNode;
}

@@ -37,2 +38,3 @@ export interface CollapsePanelProps {

collapsible?: CollapsibleType;
children?: React.ReactNode;
}

@@ -80,3 +80,4 @@ import _extends from "@babel/runtime/helpers/esm/extends";

var disabled = collapsible === 'disabled';
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames = {}, _defineProperty(_classNames, headerClass, headerClass), _defineProperty(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsible === 'header'), _classNames));
var collapsibleHeader = collapsible === 'header';
var headerCls = classNames("".concat(prefixCls, "-header"), (_classNames = {}, _defineProperty(_classNames, headerClass, headerClass), _defineProperty(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames));
var itemCls = classNames((_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefixCls, "-item"), true), _defineProperty(_classNames2, "".concat(prefixCls, "-item-active"), isActive), _defineProperty(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled), _classNames2), className);

@@ -86,3 +87,10 @@ var icon = /*#__PURE__*/React.createElement("i", {

});
/** header 节点属性 */
var headerProps = {
className: headerCls,
'aria-expanded': isActive,
onKeyPress: this.handleKeyPress
};
if (showArrow && typeof expandIcon === 'function') {

@@ -92,2 +100,17 @@ icon = expandIcon(this.props);

if (collapsibleHeader) {
icon = /*#__PURE__*/React.createElement("span", {
style: {
cursor: 'pointer'
},
onClick: function onClick() {
return _this2.handleItemClick();
}
}, icon);
} else {
headerProps.onClick = this.handleItemClick;
headerProps.role = accordion ? 'tab' : 'button';
headerProps.tabIndex = disabled ? -1 : 0;
}
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean';

@@ -98,12 +121,3 @@ return /*#__PURE__*/React.createElement("div", {

id: id
}, /*#__PURE__*/React.createElement("div", {
className: headerCls,
onClick: function onClick() {
return collapsible !== 'header' && _this2.handleItemClick();
},
role: accordion ? 'tab' : 'button',
tabIndex: disabled ? -1 : 0,
"aria-expanded": isActive,
onKeyPress: this.handleKeyPress
}, showArrow && icon, collapsible === 'header' ? /*#__PURE__*/React.createElement("span", {
}, /*#__PURE__*/React.createElement("div", headerProps, showArrow && icon, collapsibleHeader ? /*#__PURE__*/React.createElement("span", {
onClick: this.handleItemClick,

@@ -110,0 +124,0 @@ className: "".concat(prefixCls, "-header-text")

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

});
exports.Panel = exports.default = void 0;
exports.default = exports.Panel = void 0;

@@ -11,0 +11,0 @@ var _Collapse = _interopRequireDefault(require("./Collapse"));

@@ -1,3 +0,3 @@

import * as React from 'react';
import { CSSMotionProps } from 'rc-motion';
import type * as React from 'react';
import type { CSSMotionProps } from 'rc-motion';
export declare type CollapsibleType = 'header' | 'disabled';

@@ -16,2 +16,3 @@ export interface CollapseProps {

collapsible?: CollapsibleType;
children?: React.ReactNode;
}

@@ -37,2 +38,3 @@ export interface CollapsePanelProps {

collapsible?: CollapsibleType;
children?: React.ReactNode;
}

@@ -100,3 +100,4 @@ "use strict";

var disabled = collapsible === 'disabled';
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, headerClass, headerClass), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsible === 'header'), _classNames));
var collapsibleHeader = collapsible === 'header';
var headerCls = (0, _classnames.default)("".concat(prefixCls, "-header"), (_classNames = {}, (0, _defineProperty2.default)(_classNames, headerClass, headerClass), (0, _defineProperty2.default)(_classNames, "".concat(prefixCls, "-header-collapsible-only"), collapsibleHeader), _classNames));
var itemCls = (0, _classnames.default)((_classNames2 = {}, (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item"), true), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-active"), isActive), (0, _defineProperty2.default)(_classNames2, "".concat(prefixCls, "-item-disabled"), disabled), _classNames2), className);

@@ -106,3 +107,10 @@ var icon = /*#__PURE__*/React.createElement("i", {

});
/** header 节点属性 */
var headerProps = {
className: headerCls,
'aria-expanded': isActive,
onKeyPress: this.handleKeyPress
};
if (showArrow && typeof expandIcon === 'function') {

@@ -112,2 +120,17 @@ icon = expandIcon(this.props);

if (collapsibleHeader) {
icon = /*#__PURE__*/React.createElement("span", {
style: {
cursor: 'pointer'
},
onClick: function onClick() {
return _this2.handleItemClick();
}
}, icon);
} else {
headerProps.onClick = this.handleItemClick;
headerProps.role = accordion ? 'tab' : 'button';
headerProps.tabIndex = disabled ? -1 : 0;
}
var ifExtraExist = extra !== null && extra !== undefined && typeof extra !== 'boolean';

@@ -118,12 +141,3 @@ return /*#__PURE__*/React.createElement("div", {

id: id
}, /*#__PURE__*/React.createElement("div", {
className: headerCls,
onClick: function onClick() {
return collapsible !== 'header' && _this2.handleItemClick();
},
role: accordion ? 'tab' : 'button',
tabIndex: disabled ? -1 : 0,
"aria-expanded": isActive,
onKeyPress: this.handleKeyPress
}, showArrow && icon, collapsible === 'header' ? /*#__PURE__*/React.createElement("span", {
}, /*#__PURE__*/React.createElement("div", headerProps, showArrow && icon, collapsibleHeader ? /*#__PURE__*/React.createElement("span", {
onClick: this.handleItemClick,

@@ -130,0 +144,0 @@ className: "".concat(prefixCls, "-header-text")

{
"name": "rc-collapse",
"version": "3.1.2",
"version": "3.1.3",
"description": "rc-collapse ui component for react",

@@ -45,4 +45,4 @@ "keywords": [

"@types/jest": "^26.0.0",
"@types/react": "^16.9.2",
"@types/react-dom": "^16.9.0",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/shallowequal": "^1.1.1",

@@ -49,0 +49,0 @@ "@umijs/fabric": "^2.0.0",

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