@coreui/react-pro 5.0.0-alpha.2 → 5.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
|
|
43
43
|
Several quick start options are available:
|
|
44
44
|
|
|
45
|
-
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v5.0.0-alpha.
|
|
45
|
+
- [Download the latest release](https://github.com/coreui/coreui-react-pro/archive/v5.0.0-alpha.3.zip)
|
|
46
46
|
- Clone the repo: `git clone https://github.com/coreui/coreui-react.git`
|
|
47
47
|
- Install with [npm](https://www.npmjs.com/): `npm install @coreui/react`
|
|
48
48
|
- Install with [yarn](https://yarnpkg.com/): `yarn add @coreui/react`
|
|
@@ -10,6 +10,12 @@ export interface CDropdownToggleProps extends Omit<CButtonProps, 'type'> {
|
|
|
10
10
|
* Create a custom toggler which accepts any content.
|
|
11
11
|
*/
|
|
12
12
|
custom?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* If a dropdown `variant` is set to `nav-item` then render the toggler as a link instead of a button.
|
|
15
|
+
*
|
|
16
|
+
* @since v5.0.0-alpha.3
|
|
17
|
+
*/
|
|
18
|
+
navLink?: boolean;
|
|
13
19
|
/**
|
|
14
20
|
* Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of `.dropdown-toggle-split` className for proper spacing around the dropdown caret.
|
|
15
21
|
*/
|
package/dist/index.es.js
CHANGED
|
@@ -10122,8 +10122,8 @@ CDropdownMenu.propTypes = {
|
|
|
10122
10122
|
CDropdownMenu.displayName = 'CDropdownMenu';
|
|
10123
10123
|
|
|
10124
10124
|
var CDropdownToggle = function (_a) {
|
|
10125
|
-
var children = _a.children, _b = _a.caret, caret = _b === void 0 ? true : _b, custom = _a.custom, className = _a.className, split = _a.split,
|
|
10126
|
-
var
|
|
10125
|
+
var children = _a.children, _b = _a.caret, caret = _b === void 0 ? true : _b, custom = _a.custom, className = _a.className, _c = _a.navLink, navLink = _c === void 0 ? true : _c, split = _a.split, _d = _a.trigger, trigger = _d === void 0 ? 'click' : _d, rest = __rest$1(_a, ["children", "caret", "custom", "className", "navLink", "split", "trigger"]);
|
|
10126
|
+
var _e = useContext(CDropdownContext), dropdownToggleRef = _e.dropdownToggleRef, variant = _e.variant, visible = _e.visible, setVisible = _e.setVisible;
|
|
10127
10127
|
var triggers = __assign$1(__assign$1({}, ((trigger === 'click' || trigger.includes('click')) && {
|
|
10128
10128
|
onClick: function (event) {
|
|
10129
10129
|
event.preventDefault();
|
|
@@ -10134,6 +10134,7 @@ var CDropdownToggle = function (_a) {
|
|
|
10134
10134
|
onBlur: function () { return setVisible(false); },
|
|
10135
10135
|
}));
|
|
10136
10136
|
var togglerProps = __assign$1({ className: classNames$1({
|
|
10137
|
+
'nav-link': variant === 'nav-item' && navLink,
|
|
10137
10138
|
'dropdown-toggle': caret,
|
|
10138
10139
|
'dropdown-toggle-split': split,
|
|
10139
10140
|
show: visible,
|
|
@@ -10142,6 +10143,9 @@ var CDropdownToggle = function (_a) {
|
|
|
10142
10143
|
if (custom && React$1.isValidElement(children)) {
|
|
10143
10144
|
return (React$1.createElement(React$1.Fragment, null, React$1.cloneElement(children, __assign$1(__assign$1({ 'aria-expanded': visible }, (!rest.disabled && __assign$1({}, triggers))), { ref: dropdownToggleRef }))));
|
|
10144
10145
|
}
|
|
10146
|
+
if (variant === 'nav-item' && navLink) {
|
|
10147
|
+
return (React$1.createElement("a", __assign$1({ href: "#" }, togglerProps, { role: "button", ref: dropdownToggleRef }), children));
|
|
10148
|
+
}
|
|
10145
10149
|
return (React$1.createElement(CButton, __assign$1({}, togglerProps, { tabIndex: 0 }, rest, { ref: dropdownToggleRef }),
|
|
10146
10150
|
children,
|
|
10147
10151
|
split && React$1.createElement("span", { className: "visually-hidden" }, "Toggle Dropdown")));
|