@coreui/react 5.8.0 → 5.9.0
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 +1 -1
- package/dist/cjs/components/dropdown/CDropdown.d.ts +21 -1
- package/dist/cjs/components/dropdown/CDropdown.js +67 -33
- package/dist/cjs/components/dropdown/CDropdown.js.map +1 -1
- package/dist/cjs/components/dropdown/CDropdownHeader.js.map +1 -1
- package/dist/cjs/components/dropdown/CDropdownItemPlain.js.map +1 -1
- package/dist/cjs/components/dropdown/CDropdownMenu.js.map +1 -1
- package/dist/cjs/components/dropdown/CDropdownToggle.d.ts +7 -0
- package/dist/cjs/components/dropdown/CDropdownToggle.js +3 -2
- package/dist/cjs/components/dropdown/CDropdownToggle.js.map +1 -1
- package/dist/cjs/components/dropdown/utils.d.ts +2 -0
- package/dist/cjs/components/dropdown/utils.js +13 -0
- package/dist/cjs/components/dropdown/utils.js.map +1 -1
- package/dist/cjs/components/focus-trap/utils.js +0 -5
- package/dist/cjs/components/focus-trap/utils.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdown.d.ts +21 -1
- package/dist/esm/components/dropdown/CDropdown.js +68 -34
- package/dist/esm/components/dropdown/CDropdown.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdownHeader.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdownItemPlain.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdownMenu.js.map +1 -1
- package/dist/esm/components/dropdown/CDropdownToggle.d.ts +7 -0
- package/dist/esm/components/dropdown/CDropdownToggle.js +3 -2
- package/dist/esm/components/dropdown/CDropdownToggle.js.map +1 -1
- package/dist/esm/components/dropdown/utils.d.ts +2 -0
- package/dist/esm/components/dropdown/utils.js +13 -1
- package/dist/esm/components/dropdown/utils.js.map +1 -1
- package/dist/esm/components/focus-trap/utils.js +0 -5
- package/dist/esm/components/focus-trap/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/components/dropdown/CDropdown.tsx +126 -60
- package/src/components/dropdown/CDropdownHeader.tsx +1 -0
- package/src/components/dropdown/CDropdownItemPlain.tsx +1 -0
- package/src/components/dropdown/CDropdownMenu.tsx +1 -0
- package/src/components/dropdown/CDropdownToggle.tsx +15 -1
- package/src/components/dropdown/utils.ts +21 -0
- package/src/components/focus-trap/utils.ts +0 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CDropdown.js","sources":["../../../../src/components/dropdown/CDropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CDropdown.js","sources":["../../../../src/components/dropdown/CDropdown.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AA8MO,MAAM,SAAS,GAA6D,UAAU,CAI3F,CACE,EAoBC,EACD,GAAG,KACD;AAtBF,IAAA,IAAA,EACE,QAAQ,EACR,SAAS,EACT,EAAE,GAAG,KAAK,EACV,SAAS,GAAG,IAAI,EAChB,SAAS,EACT,SAAS,EACT,IAAI,EACJ,SAAS,EACT,MAAM,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACf,MAAM,EACN,MAAM,EACN,SAAS,GAAG,cAAc,EAC1B,MAAM,GAAG,IAAI,EACb,YAAY,EACZ,MAAM,GAAG,KAAK,EACd,SAAS,GAAG,QAAQ,EACpB,OAAO,GAAG,WAAW,EACrB,OAAO,GAAG,KAAK,EAAA,GAAA,EAEhB,EADI,IAAI,GAAA,MAAA,CAAA,EAAA,EAnBT,6MAoBC,CADQ;AAIT,IAAA,MAAM,WAAW,GAAG,MAAM,CAAiB,IAAI,CAAC;AAChD,IAAA,MAAM,eAAe,GAAG,MAAM,CAAoC,IAAI,CAAC;IACvE,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,WAAW,CAAC;IAChD,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC,GAAG,QAAQ,CAAqB,IAAI,CAAC;IAC5F,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAA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I;QACd,SAAS,CAAC,KAAK,CAAuB,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;KAC7D,CAAC;IACF,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,IAAI,EAAE,SAAS,CAAC,IAAI;AACpB,IAAA,SAAS,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;AACzF,IAAA,MAAM,EAAE,SAAS,CAAC,GAAG;IACrB,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,MAAM,EAAE,SAAS,CAAC,IAAI;AACtB,IAAA,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,SAAS,CAAC,IAAI;AACtB,IAAA,YAAY,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACrE,MAAM,EAAE,SAAS,CAAC,IAAI;AACtB,IAAA,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,CAAC,CAAC;IAC9E,OAAO,EAAE,SAAS,CAAC,IAAI;CACxB;AAED,SAAS,CAAC,WAAW,GAAG,WAAW;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CDropdownHeader.js","sources":["../../../../src/components/dropdown/CDropdownHeader.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CDropdownHeader.js","sources":["../../../../src/components/dropdown/CDropdownHeader.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAkBO,MAAM,eAAe,GAC1B,UAAU,CACR,CAAC,EAAsD,EAAE,GAAG,KAAI;AAA/D,IAAA,IAAA,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,SAAS,EAAA,GAAA,EAAW,EAAN,IAAI,GAAA,MAAA,CAAA,EAAA,EAApD,+BAAsD,CAAF;IACnD,QACE,oBAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAC,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAA,EAAM,IAAI,IAAE,GAAG,EAAE,GAAG,EAAA,CAAA,EAC/E,QAAQ,CACC;AAEhB,CAAC;AAGL,eAAe,CAAC,SAAS,GAAG;IAC1B,EAAE,EAAE,SAAS,CAAC,WAAW;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CDropdownItemPlain.js","sources":["../../../../src/components/dropdown/CDropdownItemPlain.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CDropdownItemPlain.js","sources":["../../../../src/components/dropdown/CDropdownItemPlain.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAkBO,MAAM,kBAAkB,GAG3B,UAAU,CACZ,CAAC,EAAwD,EAAE,GAAG,KAAI;AAAjE,IAAA,IAAA,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,SAAS,EAAA,GAAA,EAAW,EAAN,IAAI,GAAA,MAAA,CAAA,EAAA,EAAtD,+BAAwD,CAAF;IACrD,QACE,oBAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EAAC,SAAS,EAAE,UAAU,CAAC,oBAAoB,EAAE,SAAS,CAAC,EAAA,EAAM,IAAI,IAAE,GAAG,EAAE,GAAG,EAAA,CAAA,EAClF,QAAQ,CACC;AAEhB,CAAC;AAGH,kBAAkB,CAAC,SAAS,GAAG;IAC7B,EAAE,EAAE,SAAS,CAAC,WAAW;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B;AAED,kBAAkB,CAAC,WAAW,GAAG,oBAAoB;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CDropdownMenu.js","sources":["../../../../src/components/dropdown/CDropdownMenu.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CDropdownMenu.js","sources":["../../../../src/components/dropdown/CDropdownMenu.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,aAAa,GACxB,UAAU,CACR,CAAC,EAAsD,EAAE,GAAG,KAAI;AAA/D,IAAA,IAAA,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,GAAG,IAAI,EAAE,SAAS,EAAA,GAAA,EAAW,EAAN,IAAI,GAAA,MAAA,CAAA,EAAA,EAApD,+BAAsD,CAAF;IACnD,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAC5E,UAAU,CAAC,gBAAgB,CAAC;IAE9B,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,eAAe,CAAC;AAEpD,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,kBAAkB,EAAA,EAAC,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAA,IAAA,IAAN,MAAM,KAAA,MAAA,GAAN,MAAM,GAAI,KAAK,EAAA;AAC/D,QAAA,KAAA,CAAA,aAAA,CAAC,SAAS,EAAA,MAAA,CAAA,MAAA,CAAA,EACR,SAAS,EAAE,UAAU,CACnB,eAAe,EACf;AACE,gBAAA,IAAI,EAAE,OAAO;AACd,aAAA,EACD,SAAS,IAAI,sBAAsB,CAAC,SAAS,CAAC,EAC9C,SAAS,CACV,EACD,GAAG,EAAE,SAAS,EACd,IAAI,EAAC,MAAM,EAAA,GACN,CAAC,MAAM,IAAI,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAC7C,IAAI,IAAI,EAAE,mBAAmB,EAAE,MAAM,EAAE,GACxC,IAAI,CAAA,EAEP,SAAS,KAAK;AACb,cAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAI;AAC5C,gBAAA,IAAI,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE;AAC/B,oBAAA,OAAO,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAI,GAAG,EAAE,KAAK,EAAA,EAAG,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,CAAM;gBACzD;gBACA;AACF,YAAA,CAAC;AACH,cAAE,QAAQ,CACF,CACO;AAEzB,CAAC;AAGL,aAAa,CAAC,SAAS,GAAG;IACxB,EAAE,EAAE,SAAS,CAAC,WAAW;IACzB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,MAAM;CAC5B;AAED,aAAa,CAAC,WAAW,GAAG,eAAe;;;;"}
|
|
@@ -23,6 +23,13 @@ export interface CDropdownToggleProps extends Omit<CButtonProps, 'type'> {
|
|
|
23
23
|
* className for proper spacing around the dropdown caret.
|
|
24
24
|
*/
|
|
25
25
|
split?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Screen reader label for split button dropdown toggle.
|
|
28
|
+
*
|
|
29
|
+
* @default 'Toggle Dropdown'
|
|
30
|
+
* @since 5.9.0
|
|
31
|
+
*/
|
|
32
|
+
splitLabel?: string;
|
|
26
33
|
/**
|
|
27
34
|
* Sets which event handlers you'd like provided to your toggle prop. You can
|
|
28
35
|
* specify one trigger or an array of them.
|
|
@@ -7,7 +7,7 @@ import { CDropdownContext } from './CDropdownContext.js';
|
|
|
7
7
|
import { triggerPropType } from '../../props.js';
|
|
8
8
|
|
|
9
9
|
const CDropdownToggle = (_a) => {
|
|
10
|
-
var { children, caret = true, custom, className, navLink = true, split, trigger = 'click' } = _a, rest = __rest(_a, ["children", "caret", "custom", "className", "navLink", "split", "trigger"]);
|
|
10
|
+
var { children, caret = true, custom, className, navLink = true, split, splitLabel = 'Toggle Dropdown', trigger = 'click' } = _a, rest = __rest(_a, ["children", "caret", "custom", "className", "navLink", "split", "splitLabel", "trigger"]);
|
|
11
11
|
const { dropdownToggleRef, handleHide, handleShow, variant, visible } = useContext(CDropdownContext);
|
|
12
12
|
const triggers = Object.assign(Object.assign(Object.assign({}, ((trigger === 'click' || trigger.includes('click')) && {
|
|
13
13
|
onClick: (event) => {
|
|
@@ -42,7 +42,7 @@ const CDropdownToggle = (_a) => {
|
|
|
42
42
|
}
|
|
43
43
|
return (React.createElement(CButton, Object.assign({}, togglerProps, { tabIndex: 0 }, rest, { ref: dropdownToggleRef }),
|
|
44
44
|
children,
|
|
45
|
-
split && React.createElement("span", { className: "visually-hidden" },
|
|
45
|
+
split && React.createElement("span", { className: "visually-hidden" }, splitLabel)));
|
|
46
46
|
};
|
|
47
47
|
CDropdownToggle.propTypes = {
|
|
48
48
|
caret: PropTypes.bool,
|
|
@@ -50,6 +50,7 @@ CDropdownToggle.propTypes = {
|
|
|
50
50
|
className: PropTypes.string,
|
|
51
51
|
custom: PropTypes.bool,
|
|
52
52
|
split: PropTypes.bool,
|
|
53
|
+
splitLabel: PropTypes.string,
|
|
53
54
|
trigger: triggerPropType,
|
|
54
55
|
};
|
|
55
56
|
CDropdownToggle.displayName = 'CDropdownToggle';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CDropdownToggle.js","sources":["../../../../src/components/dropdown/CDropdownToggle.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"CDropdownToggle.js","sources":["../../../../src/components/dropdown/CDropdownToggle.tsx"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,eAAe,GAA6B,CAAC,EAUzD,KAAI;AAVqD,IAAA,IAAA,EACxD,QAAQ,EACR,KAAK,GAAG,IAA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QAAQ,CACP;IAER;AAEA,IAAA,QACE,KAAA,CAAA,aAAA,CAAC,OAAO,EAAA,MAAA,CAAA,MAAA,CAAA,EAAA,EAAK,YAAY,EAAA,EAAE,QAAQ,EAAE,CAAC,EAAA,EAAM,IAAI,EAAA,EAAE,GAAG,EAAE,iBAAiB,EAAA,CAAA;QACrE,QAAQ;QACR,KAAK,IAAI,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAM,SAAS,EAAC,iBAAiB,IAAE,UAAU,CAAQ,CACvD;AAEd;AAEA,eAAe,CAAC,SAAS,GAAG;IAC1B,KAAK,EAAE,SAAS,CAAC,IAAI;IACrB,QAAQ,EAAE,SAAS,CAAC,IAAI;IACxB,SAAS,EAAE,SAAS,CAAC,MAAM;IAC3B,MAAM,EAAE,SAAS,CAAC,IAAI;IACtB,KAAK,EAAE,SAAS,CAAC,IAAI;IACrB,UAAU,EAAE,SAAS,CAAC,MAAM;AAC5B,IAAA,OAAO,EAAE,eAAe;CACzB;AAED,eAAe,CAAC,WAAW,GAAG,iBAAiB;;;;"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { Placement } from '@popperjs/core';
|
|
2
3
|
import type { Placements } from '../../types';
|
|
3
4
|
import type { Alignments } from './types';
|
|
4
5
|
export declare const getAlignmentClassNames: (alignment: Alignments) => string[];
|
|
5
6
|
export declare const getPlacement: (placement: Placement, direction: string | undefined, alignment: Alignments | string | undefined, isRTL: boolean) => Placements;
|
|
7
|
+
export declare const getReferenceElement: (reference: "parent" | "toggle" | React.RefObject<HTMLElement | null> | HTMLElement, dropdownToggleElement: HTMLElement | null, dropdownRef: React.RefObject<HTMLElement | null>) => HTMLElement | null;
|
|
@@ -29,6 +29,18 @@ const getPlacement = (placement, direction, alignment, isRTL) => {
|
|
|
29
29
|
}
|
|
30
30
|
return _placement;
|
|
31
31
|
};
|
|
32
|
+
const getReferenceElement = (reference, dropdownToggleElement, dropdownRef) => {
|
|
33
|
+
if (reference === 'parent') {
|
|
34
|
+
return dropdownRef.current;
|
|
35
|
+
}
|
|
36
|
+
if (reference instanceof HTMLElement) {
|
|
37
|
+
return reference;
|
|
38
|
+
}
|
|
39
|
+
if (reference instanceof Object && 'current' in reference) {
|
|
40
|
+
return reference.current;
|
|
41
|
+
}
|
|
42
|
+
return dropdownToggleElement;
|
|
43
|
+
};
|
|
32
44
|
|
|
33
|
-
export { getAlignmentClassNames, getPlacement };
|
|
45
|
+
export { getAlignmentClassNames, getPlacement, getReferenceElement };
|
|
34
46
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/dropdown/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/dropdown/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAKO,MAAM,sBAAsB,GAAG,CAAC,SAAqB,KAAI;IAC9D,MAAM,UAAU,GAAa,EAAE;AAC/B,IAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AACjC,QAAA,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;YAC3B,UAAU,CAAC,IAAI,CACb,CAAA,aAAA,EAAgB,GAAG,KAAK,IAAI,GAAG,EAAE,GAAG,CAAA,CAAA,EAAI,GAAG,CAAA,CAAE,CAAA,CAAA,EAAI,SAAS,CAAC,GAAwB,CAAC,CAAA,CAAE,CACvF;QACH;IACF;AAEA,IAAA,IAAI,OAAO,SAAS,KAAK,QAAQ,EAAE;AACjC,QAAA,UAAU,CAAC,IAAI,CAAC,iBAAiB,SAAS,CAAA,CAAE,CAAC;IAC/C;AAEA,IAAA,OAAO,UAAU;AACnB;AAEO,MAAM,YAAY,GAAG,CAC1B,SAAoB,EACpB,SAA6B,EAC7B,SAA0C,EAC1C,KAAc,KACA;IACd,IAAI,UAAU,GAAG,SAAS;AAE1B,IAAA,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC1B,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,WAAW;IAC9C;AAEA,IAAA,IAAI,SAAS,KAAK,eAAe,EAAE;QACjC,UAAU,GAAG,KAAK;IACpB;AAEA,IAAA,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,UAAU,GAAG,KAAK,GAAG,YAAY,GAAG,aAAa;IACnD;AAEA,IAAA,IAAI,SAAS,KAAK,WAAW,EAAE;QAC7B,UAAU,GAAG,KAAK,GAAG,aAAa,GAAG,YAAY;IACnD;AAEA,IAAA,IAAI,SAAS,KAAK,KAAK,EAAE;QACvB,UAAU,GAAG,KAAK,GAAG,cAAc,GAAG,YAAY;IACpD;AAEA,IAAA,OAAO,UAAU;AACnB;AAEO,MAAM,mBAAmB,GAAG,CACjC,SAAkF,EAClF,qBAAyC,EACzC,WAAgD,KAC1B;AACtB,IAAA,IAAI,SAAS,KAAK,QAAQ,EAAE;QAC1B,OAAO,WAAW,CAAC,OAAO;IAC5B;AAEA,IAAA,IAAI,SAAS,YAAY,WAAW,EAAE;AACpC,QAAA,OAAO,SAAS;IAClB;IAEA,IAAI,SAAS,YAAY,MAAM,IAAI,SAAS,IAAI,SAAS,EAAE;QACzD,OAAO,SAAS,CAAC,OAAO;IAC1B;AAEA,IAAA,OAAO,qBAAqB;AAC9B;;;;"}
|
|
@@ -46,11 +46,6 @@ const isElement = (object) => {
|
|
|
46
46
|
if (!object || typeof object !== 'object') {
|
|
47
47
|
return false;
|
|
48
48
|
}
|
|
49
|
-
// Handle jQuery objects
|
|
50
|
-
if ('jquery' in object && object.jquery !== undefined) {
|
|
51
|
-
const jQueryObject = object;
|
|
52
|
-
return isElement(jQueryObject[0]);
|
|
53
|
-
}
|
|
54
49
|
return 'nodeType' in object && typeof object.nodeType === 'number';
|
|
55
50
|
};
|
|
56
51
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../src/components/focus-trap/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AACI,MAAM,iBAAiB,GAAG,CAAC,OAAoB,KAAmB;AACvE,IAAA,MAAM,kBAAkB,GAAG;QACzB,SAAS;QACT,wBAAwB;QACxB,uBAAuB;QACvB,0BAA0B;QAC1B,wBAAwB;QACxB,SAAS;QACT,iCAAiC;QACjC,0BAA0B;AAC3B,KAAA,CAAC,IAAI,CAAC,GAAG,CAAC;IAEX,MAAM,QAAQ,GAAG,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAc,kBAAkB,CAAC,CAAkB;IAEhG,OAAO,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC,CAAC;AAClE;AAEA;;;;;AAKG;AACI,MAAM,UAAU,GAAG,CAAC,OAAoB,KAAa;IAC1D,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI,CAAC,YAAY,EAAE;AACtD,QAAA,OAAO,IAAI;IACb;IAEA,IAAI,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;AAC1C,QAAA,OAAO,IAAI;IACb;IAEA,IAAI,UAAU,IAAI,OAAO,IAAI,OAAO,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE;QAClE,OAAO,OAAO,CAAC,QAAQ;IACzB;AAEA,IAAA,OAAO,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,KAAK,OAAO;AACzF;AAEA;;;;;AAKG;AACI,MAAM,SAAS,GAAG,CAAC,MAAe,KAAuB;IAC9D,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;AACzC,QAAA,OAAO,KAAK;IACd
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../src/components/focus-trap/utils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAEA;;;;;AAKG;AACI,M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IAAA,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE;AAChE,QAAA,OAAO,KAAK;IACd;AAEA,IAAA,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,KAAK,SAAS;;IAG/F,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC;IAE5D,IAAI,CAAC,aAAa,EAAE;AAClB,QAAA,OAAO,gBAAgB;IACzB;AAEA,IAAA,IAAI,aAAa,KAAK,OAAO,EAAE;QAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;;QAG1C,IAAI,CAAA,OAAO,KAAA,IAAA,IAAP,OAAO,KAAA,MAAA,GAAA,MAAA,GAAP,OAAO,CAAE,UAAU,MAAK,aAAa,EAAE;AACzC,YAAA,OAAO,KAAK;QACd;IACF;AAEA,IAAA,OAAO,gBAAgB;AACzB;AAEA;;;;;AAKG;AACI,MAAM,SAAS,GACpB,CAAI,GAAG,IAAkC,KACzC,CAAC,IAAO,KAAI;AACV,IAAA,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,KAAI;AACnB,QAAA,IAAI,CAAC,GAAG;YAAE;AACV,QAAA,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE;YAC7B,GAAG,CAAC,IAAI,CAAC;QACX;aAAO;AACL,YAAA,IAAI;gBACF;AAAE,gBAAA,GAA0B,CAAC,OAAO,GAAG,IAAI;YAC7C;AAAE,YAAA,OAAA,EAAA,EAAM;;YAER;QACF;AACF,IAAA,CAAC,CAAC;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coreui/react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.9.0",
|
|
4
4
|
"description": "UI Components Library for React.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
"@testing-library/jest-dom": "^6.8.0",
|
|
54
54
|
"@testing-library/react": "^16.3.0",
|
|
55
55
|
"@types/jest": "^29.5.14",
|
|
56
|
-
"@types/prop-types": "15.
|
|
57
|
-
"@types/react": "^19.1.
|
|
56
|
+
"@types/prop-types": "15.7.15",
|
|
57
|
+
"@types/react": "^19.1.13",
|
|
58
58
|
"@types/react-dom": "^19.1.9",
|
|
59
59
|
"@types/react-transition-group": "^4.4.12",
|
|
60
60
|
"classnames": "^2.5.1",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"react": "^18.3.1",
|
|
65
65
|
"react-dom": "^18.3.1",
|
|
66
66
|
"react-transition-group": "^4.4.5",
|
|
67
|
-
"rollup": "^4.50.
|
|
68
|
-
"ts-jest": "^29.4.
|
|
67
|
+
"rollup": "^4.50.2",
|
|
68
|
+
"ts-jest": "^29.4.2",
|
|
69
69
|
"tslib": "^2.8.1",
|
|
70
70
|
"typescript": "^5.9.2"
|
|
71
71
|
},
|
|
@@ -21,7 +21,8 @@ import type { Placements } from '../../types'
|
|
|
21
21
|
import { getNextActiveElement, isRTL } from '../../utils'
|
|
22
22
|
|
|
23
23
|
import type { Alignments, Directions } from './types'
|
|
24
|
-
import { getPlacement } from './utils'
|
|
24
|
+
import { getPlacement, getReferenceElement } from './utils'
|
|
25
|
+
import { CFocusTrap } from '../focus-trap'
|
|
25
26
|
|
|
26
27
|
export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIElement> {
|
|
27
28
|
/**
|
|
@@ -160,6 +161,27 @@ export interface CDropdownProps extends HTMLAttributes<HTMLDivElement | HTMLLIEl
|
|
|
160
161
|
*/
|
|
161
162
|
portal?: boolean
|
|
162
163
|
|
|
164
|
+
/**
|
|
165
|
+
* Sets the reference element for positioning the React Dropdown Menu.
|
|
166
|
+
* - `toggle` - The React Dropdown Toggle button (default).
|
|
167
|
+
* - `parent` - The React Dropdown wrapper element.
|
|
168
|
+
* - `HTMLElement` - A custom HTML element.
|
|
169
|
+
* - `React.RefObject` - A custom reference element.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* // Use the parent element as reference for positioning
|
|
173
|
+
* <CDropdown reference="parent">
|
|
174
|
+
* <CDropdownToggle>Toggle dropdown</CDropdownToggle>
|
|
175
|
+
* <CDropdownMenu>
|
|
176
|
+
* <CDropdownItem>Action</CDropdownItem>
|
|
177
|
+
* <CDropdownItem>Another Action</CDropdownItem>
|
|
178
|
+
* </CDropdownMenu>
|
|
179
|
+
* </CDropdown>
|
|
180
|
+
*
|
|
181
|
+
* @since 5.9.0
|
|
182
|
+
*/
|
|
183
|
+
reference?: 'parent' | 'toggle' | HTMLElement | React.RefObject<HTMLElement | null>
|
|
184
|
+
|
|
163
185
|
/**
|
|
164
186
|
* Defines the visual variant of the React Dropdown
|
|
165
187
|
*/
|
|
@@ -203,6 +225,7 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
203
225
|
popper = true,
|
|
204
226
|
popperConfig,
|
|
205
227
|
portal = false,
|
|
228
|
+
reference = 'toggle',
|
|
206
229
|
variant = 'btn-group',
|
|
207
230
|
visible = false,
|
|
208
231
|
...rest
|
|
@@ -254,12 +277,20 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
254
277
|
}, [visible])
|
|
255
278
|
|
|
256
279
|
useEffect(() => {
|
|
257
|
-
|
|
280
|
+
return () => {
|
|
281
|
+
if (_visible) {
|
|
282
|
+
handleHide()
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}, [])
|
|
286
|
+
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
const referenceElement = getReferenceElement(reference, dropdownToggleElement, dropdownRef)
|
|
258
289
|
const menuElement = dropdownMenuRef.current
|
|
259
|
-
if (allowPopperUse && menuElement &&
|
|
260
|
-
initPopper(
|
|
290
|
+
if (allowPopperUse && menuElement && referenceElement && _visible) {
|
|
291
|
+
initPopper(referenceElement, menuElement, computedPopperConfig)
|
|
261
292
|
}
|
|
262
|
-
}, [dropdownToggleElement])
|
|
293
|
+
}, [dropdownToggleElement, reference])
|
|
263
294
|
|
|
264
295
|
useEffect(() => {
|
|
265
296
|
if (pendingKeyDownEvent !== null) {
|
|
@@ -271,24 +302,28 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
271
302
|
const handleHide = useCallback(() => {
|
|
272
303
|
setVisible(false)
|
|
273
304
|
|
|
274
|
-
const toggleElement = dropdownToggleElement
|
|
275
305
|
const menuElement = dropdownMenuRef.current
|
|
306
|
+
const toggleElement = dropdownToggleElement
|
|
276
307
|
|
|
277
308
|
if (allowPopperUse) {
|
|
278
309
|
destroyPopper()
|
|
279
310
|
}
|
|
280
311
|
|
|
281
|
-
toggleElement?.removeEventListener('keydown', handleKeydown)
|
|
282
312
|
menuElement?.removeEventListener('keydown', handleKeydown)
|
|
313
|
+
toggleElement?.removeEventListener('keydown', handleKeydown)
|
|
283
314
|
|
|
284
|
-
window.removeEventListener('
|
|
315
|
+
window.removeEventListener('click', handleClick)
|
|
285
316
|
window.removeEventListener('keyup', handleKeyup)
|
|
286
317
|
|
|
287
318
|
onHide?.()
|
|
288
|
-
}, [
|
|
319
|
+
}, [allowPopperUse, dropdownToggleElement, destroyPopper, onHide])
|
|
289
320
|
|
|
290
321
|
const handleKeydown = useCallback((event: KeyboardEvent) => {
|
|
291
|
-
if (dropdownMenuRef.current
|
|
322
|
+
if (!dropdownMenuRef.current) {
|
|
323
|
+
return
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
292
327
|
event.preventDefault()
|
|
293
328
|
const target = event.target as HTMLElement
|
|
294
329
|
const items = [
|
|
@@ -311,28 +346,40 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
311
346
|
dropdownToggleElement?.focus()
|
|
312
347
|
}
|
|
313
348
|
},
|
|
314
|
-
[autoClose, handleHide]
|
|
349
|
+
[autoClose, dropdownToggleElement, handleHide]
|
|
315
350
|
)
|
|
316
351
|
|
|
317
|
-
const
|
|
318
|
-
(event:
|
|
352
|
+
const handleClick = useCallback(
|
|
353
|
+
(event: MouseEvent) => {
|
|
319
354
|
if (!dropdownToggleElement || !dropdownMenuRef.current) {
|
|
320
355
|
return
|
|
321
356
|
}
|
|
322
357
|
|
|
323
|
-
if (
|
|
358
|
+
if ((event as MouseEvent).button === 2) {
|
|
359
|
+
return
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const composedPath = event.composedPath()
|
|
363
|
+
const isOnToggle = composedPath.includes(dropdownToggleElement)
|
|
364
|
+
const isOnMenu = composedPath.includes(dropdownMenuRef.current)
|
|
365
|
+
|
|
366
|
+
if (isOnToggle) {
|
|
367
|
+
return
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
const target = event.target as HTMLElement | null
|
|
371
|
+
const FORM_TAG_RE = /^(input|select|option|textarea|form|button|label)$/i
|
|
372
|
+
|
|
373
|
+
if (isOnMenu && target && FORM_TAG_RE.test(target.tagName)) {
|
|
324
374
|
return
|
|
325
375
|
}
|
|
326
376
|
|
|
327
377
|
if (
|
|
328
378
|
autoClose === true ||
|
|
329
|
-
(autoClose === 'inside' &&
|
|
330
|
-
|
|
331
|
-
(autoClose === 'outside' &&
|
|
332
|
-
!dropdownMenuRef.current.contains(event.target as HTMLElement))
|
|
379
|
+
(autoClose === 'inside' && isOnMenu) ||
|
|
380
|
+
(autoClose === 'outside' && !isOnMenu)
|
|
333
381
|
) {
|
|
334
|
-
|
|
335
|
-
return
|
|
382
|
+
handleHide()
|
|
336
383
|
}
|
|
337
384
|
},
|
|
338
385
|
[autoClose, dropdownToggleElement, handleHide]
|
|
@@ -340,21 +387,22 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
340
387
|
|
|
341
388
|
const handleShow = useCallback(
|
|
342
389
|
(event?: KeyboardEvent) => {
|
|
343
|
-
const toggleElement = dropdownToggleElement
|
|
344
390
|
const menuElement = dropdownMenuRef.current
|
|
391
|
+
const referenceElement = getReferenceElement(reference, dropdownToggleElement, dropdownRef)
|
|
392
|
+
const toggleElement = dropdownToggleElement
|
|
345
393
|
|
|
346
|
-
if (
|
|
394
|
+
if (menuElement && referenceElement && toggleElement) {
|
|
347
395
|
setVisible(true)
|
|
348
396
|
|
|
349
397
|
if (allowPopperUse) {
|
|
350
|
-
initPopper(
|
|
398
|
+
initPopper(referenceElement, menuElement, computedPopperConfig)
|
|
351
399
|
}
|
|
352
400
|
|
|
353
401
|
toggleElement.focus()
|
|
354
402
|
toggleElement.addEventListener('keydown', handleKeydown)
|
|
355
403
|
menuElement.addEventListener('keydown', handleKeydown)
|
|
356
404
|
|
|
357
|
-
window.addEventListener('
|
|
405
|
+
window.addEventListener('click', handleClick)
|
|
358
406
|
window.addEventListener('keyup', handleKeyup)
|
|
359
407
|
|
|
360
408
|
if (event && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
|
|
@@ -365,53 +413,71 @@ export const CDropdown: PolymorphicRefForwardingComponent<'div', CDropdownProps>
|
|
|
365
413
|
}
|
|
366
414
|
},
|
|
367
415
|
[
|
|
368
|
-
dropdownToggleElement,
|
|
369
416
|
allowPopperUse,
|
|
370
|
-
initPopper,
|
|
371
417
|
computedPopperConfig,
|
|
418
|
+
dropdownToggleElement,
|
|
419
|
+
reference,
|
|
420
|
+
handleClick,
|
|
372
421
|
handleKeydown,
|
|
373
|
-
handleMouseUp,
|
|
374
422
|
handleKeyup,
|
|
423
|
+
initPopper,
|
|
375
424
|
onShow,
|
|
376
425
|
]
|
|
377
426
|
)
|
|
378
427
|
|
|
379
|
-
const contextValues =
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
428
|
+
const contextValues = useMemo(
|
|
429
|
+
() => ({
|
|
430
|
+
alignment,
|
|
431
|
+
container,
|
|
432
|
+
dark,
|
|
433
|
+
dropdownMenuRef,
|
|
434
|
+
dropdownToggleRef,
|
|
435
|
+
handleHide,
|
|
436
|
+
handleShow,
|
|
437
|
+
popper: allowPopperUse,
|
|
438
|
+
portal,
|
|
439
|
+
variant,
|
|
440
|
+
visible: _visible,
|
|
441
|
+
}),
|
|
442
|
+
[
|
|
443
|
+
alignment,
|
|
444
|
+
container,
|
|
445
|
+
dark,
|
|
446
|
+
dropdownMenuRef,
|
|
447
|
+
dropdownToggleRef,
|
|
448
|
+
handleHide,
|
|
449
|
+
handleShow,
|
|
450
|
+
allowPopperUse,
|
|
451
|
+
portal,
|
|
452
|
+
variant,
|
|
453
|
+
_visible,
|
|
454
|
+
]
|
|
455
|
+
)
|
|
392
456
|
|
|
393
457
|
return (
|
|
394
458
|
<CDropdownContext.Provider value={contextValues}>
|
|
395
|
-
{
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
direction
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
459
|
+
<CFocusTrap active={portal && _visible} additionalContainer={dropdownMenuRef} restoreFocus>
|
|
460
|
+
{variant === 'input-group' ? (
|
|
461
|
+
<>{children}</>
|
|
462
|
+
) : (
|
|
463
|
+
<Component
|
|
464
|
+
className={classNames(
|
|
465
|
+
variant === 'nav-item' ? 'nav-item dropdown' : variant,
|
|
466
|
+
{
|
|
467
|
+
'dropdown-center': direction === 'center',
|
|
468
|
+
'dropup dropup-center': direction === 'dropup-center',
|
|
469
|
+
[`${direction}`]:
|
|
470
|
+
direction && direction !== 'center' && direction !== 'dropup-center',
|
|
471
|
+
},
|
|
472
|
+
className
|
|
473
|
+
)}
|
|
474
|
+
{...rest}
|
|
475
|
+
ref={forkedRef}
|
|
476
|
+
>
|
|
477
|
+
{children}
|
|
478
|
+
</Component>
|
|
479
|
+
)}
|
|
480
|
+
</CFocusTrap>
|
|
415
481
|
</CDropdownContext.Provider>
|
|
416
482
|
)
|
|
417
483
|
}
|
|
@@ -9,6 +9,7 @@ export interface CDropdownHeaderProps extends HTMLAttributes<HTMLHeadingElement>
|
|
|
9
9
|
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
10
10
|
*/
|
|
11
11
|
as?: ElementType
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* A string of all className you want applied to the component.
|
|
14
15
|
*/
|
|
@@ -9,6 +9,7 @@ export interface CDropdownItemPlainProps extends HTMLAttributes<HTMLSpanElement>
|
|
|
9
9
|
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
10
10
|
*/
|
|
11
11
|
as?: ElementType
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* A string of all className you want applied to the component.
|
|
14
15
|
*/
|
|
@@ -15,6 +15,7 @@ export interface CDropdownMenuProps extends HTMLAttributes<HTMLDivElement | HTML
|
|
|
15
15
|
* Component used for the root node. Either a string to use a HTML element or a component.
|
|
16
16
|
*/
|
|
17
17
|
as?: ElementType
|
|
18
|
+
|
|
18
19
|
/**
|
|
19
20
|
* A string of all className you want applied to the base component.
|
|
20
21
|
*/
|
|
@@ -13,10 +13,12 @@ export interface CDropdownToggleProps extends Omit<CButtonProps, 'type'> {
|
|
|
13
13
|
* Enables pseudo element caret on toggler.
|
|
14
14
|
*/
|
|
15
15
|
caret?: boolean
|
|
16
|
+
|
|
16
17
|
/**
|
|
17
18
|
* Create a custom toggler which accepts any content.
|
|
18
19
|
*/
|
|
19
20
|
custom?: boolean
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* If a dropdown `variant` is set to `nav-item` then render the toggler as a
|
|
22
24
|
* link instead of a button.
|
|
@@ -24,12 +26,22 @@ export interface CDropdownToggleProps extends Omit<CButtonProps, 'type'> {
|
|
|
24
26
|
* @since 5.0.0
|
|
25
27
|
*/
|
|
26
28
|
navLink?: boolean
|
|
29
|
+
|
|
27
30
|
/**
|
|
28
31
|
* Similarly, create split button dropdowns with virtually the same markup as
|
|
29
32
|
* single button dropdowns, but with the addition of `.dropdown-toggle-split`
|
|
30
33
|
* className for proper spacing around the dropdown caret.
|
|
31
34
|
*/
|
|
32
35
|
split?: boolean
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Screen reader label for split button dropdown toggle.
|
|
39
|
+
*
|
|
40
|
+
* @default 'Toggle Dropdown'
|
|
41
|
+
* @since 5.9.0
|
|
42
|
+
*/
|
|
43
|
+
splitLabel?: string
|
|
44
|
+
|
|
33
45
|
/**
|
|
34
46
|
* Sets which event handlers you'd like provided to your toggle prop. You can
|
|
35
47
|
* specify one trigger or an array of them.
|
|
@@ -46,6 +58,7 @@ export const CDropdownToggle: FC<CDropdownToggleProps> = ({
|
|
|
46
58
|
className,
|
|
47
59
|
navLink = true,
|
|
48
60
|
split,
|
|
61
|
+
splitLabel = 'Toggle Dropdown',
|
|
49
62
|
trigger = 'click',
|
|
50
63
|
...rest
|
|
51
64
|
}) => {
|
|
@@ -113,7 +126,7 @@ export const CDropdownToggle: FC<CDropdownToggleProps> = ({
|
|
|
113
126
|
return (
|
|
114
127
|
<CButton {...togglerProps} tabIndex={0} {...rest} ref={dropdownToggleRef}>
|
|
115
128
|
{children}
|
|
116
|
-
{split && <span className="visually-hidden">
|
|
129
|
+
{split && <span className="visually-hidden">{splitLabel}</span>}
|
|
117
130
|
</CButton>
|
|
118
131
|
)
|
|
119
132
|
}
|
|
@@ -124,6 +137,7 @@ CDropdownToggle.propTypes = {
|
|
|
124
137
|
className: PropTypes.string,
|
|
125
138
|
custom: PropTypes.bool,
|
|
126
139
|
split: PropTypes.bool,
|
|
140
|
+
splitLabel: PropTypes.string,
|
|
127
141
|
trigger: triggerPropType,
|
|
128
142
|
}
|
|
129
143
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react'
|
|
1
2
|
import type { Placement } from '@popperjs/core'
|
|
2
3
|
import type { Placements } from '../../types'
|
|
3
4
|
import type { Alignments, Breakpoints } from './types'
|
|
@@ -49,3 +50,23 @@ export const getPlacement = (
|
|
|
49
50
|
|
|
50
51
|
return _placement
|
|
51
52
|
}
|
|
53
|
+
|
|
54
|
+
export const getReferenceElement = (
|
|
55
|
+
reference: 'parent' | 'toggle' | React.RefObject<HTMLElement | null> | HTMLElement,
|
|
56
|
+
dropdownToggleElement: HTMLElement | null,
|
|
57
|
+
dropdownRef: React.RefObject<HTMLElement | null>
|
|
58
|
+
): HTMLElement | null => {
|
|
59
|
+
if (reference === 'parent') {
|
|
60
|
+
return dropdownRef.current
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (reference instanceof HTMLElement) {
|
|
64
|
+
return reference
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (reference instanceof Object && 'current' in reference) {
|
|
68
|
+
return reference.current
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return dropdownToggleElement
|
|
72
|
+
}
|
|
@@ -56,12 +56,6 @@ export const isElement = (object: unknown): object is Element => {
|
|
|
56
56
|
return false
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// Handle jQuery objects
|
|
60
|
-
if ('jquery' in object && object.jquery !== undefined) {
|
|
61
|
-
const jQueryObject = object as { [key: number]: Element }
|
|
62
|
-
return isElement(jQueryObject[0])
|
|
63
|
-
}
|
|
64
|
-
|
|
65
59
|
return 'nodeType' in object && typeof object.nodeType === 'number'
|
|
66
60
|
}
|
|
67
61
|
|