@dscout/particle 1.0.0-alpha.28 → 1.0.0-alpha.29
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/lib/cjs/components/button.d.ts +1 -1
- package/lib/cjs/components/button.js +1 -0
- package/lib/cjs/components/button.js.map +1 -1
- package/lib/cjs/components/button_icon.d.ts +3 -1
- package/lib/cjs/components/button_icon.js +2 -2
- package/lib/cjs/components/button_icon.js.map +1 -1
- package/lib/cjs/components/callout.js +3 -1
- package/lib/cjs/components/callout.js.map +1 -1
- package/lib/cjs/components/common_button.d.ts +7 -1
- package/lib/cjs/components/common_button.js +60 -2
- package/lib/cjs/components/common_button.js.map +1 -1
- package/lib/cjs/components/dropdown/dropdown_container.d.ts +23 -0
- package/lib/cjs/components/dropdown/dropdown_container.js +142 -0
- package/lib/cjs/components/dropdown/dropdown_container.js.map +1 -0
- package/lib/cjs/components/dropdown/dropdown_popover.d.ts +20 -0
- package/lib/cjs/components/dropdown/dropdown_popover.js +88 -0
- package/lib/cjs/components/dropdown/dropdown_popover.js.map +1 -0
- package/lib/cjs/components/dropdown/dropdown_portal_registration_context.d.ts +29 -0
- package/lib/cjs/components/dropdown/dropdown_portal_registration_context.js +97 -0
- package/lib/cjs/components/dropdown/dropdown_portal_registration_context.js.map +1 -0
- package/lib/cjs/components/dropdown/index.d.ts +3 -0
- package/lib/cjs/components/dropdown/index.js +35 -0
- package/lib/cjs/components/dropdown/index.js.map +1 -0
- package/lib/cjs/components/dropdown/types.d.ts +123 -0
- package/lib/cjs/components/dropdown/types.js +3 -0
- package/lib/cjs/components/dropdown/types.js.map +1 -0
- package/lib/cjs/components/dropdown/use_dropdown.d.ts +18 -0
- package/lib/cjs/components/dropdown/use_dropdown.js +319 -0
- package/lib/cjs/components/dropdown/use_dropdown.js.map +1 -0
- package/lib/cjs/components/{dropdown.d.ts → legacy_dropdown.d.ts} +7 -3
- package/lib/cjs/components/{dropdown.js → legacy_dropdown.js} +22 -18
- package/lib/cjs/components/legacy_dropdown.js.map +1 -0
- package/lib/cjs/components/tooltip/types.d.ts +5 -1
- package/lib/cjs/components/tooltip/use_tooltip.js +13 -23
- package/lib/cjs/components/tooltip/use_tooltip.js.map +1 -1
- package/lib/cjs/icons/express/bulb_stars.d.ts +3 -3
- package/lib/cjs/icons/express/bulb_stars.js +6 -5
- package/lib/cjs/icons/express/bulb_stars.js.map +1 -1
- package/lib/cjs/icons/express/core/icon_types.d.ts +1 -0
- package/lib/cjs/icons/express/core/index.d.ts +3 -2
- package/lib/cjs/icons/express/core/index.js +3 -1
- package/lib/cjs/icons/express/core/index.js.map +1 -1
- package/lib/cjs/icons/express/core/utils.d.ts +2 -0
- package/lib/cjs/icons/express/core/utils.js +15 -0
- package/lib/cjs/icons/express/core/utils.js.map +1 -0
- package/lib/cjs/icons/express/document_stars.d.ts +3 -3
- package/lib/cjs/icons/express/document_stars.js +6 -5
- package/lib/cjs/icons/express/document_stars.js.map +1 -1
- package/lib/cjs/icons/express/stack_stars.d.ts +3 -3
- package/lib/cjs/icons/express/stack_stars.js +6 -5
- package/lib/cjs/icons/express/stack_stars.js.map +1 -1
- package/lib/cjs/icons/express/stars.d.ts +3 -3
- package/lib/cjs/icons/express/stars.js +7 -10
- package/lib/cjs/icons/express/stars.js.map +1 -1
- package/lib/cjs/index.d.ts +3 -2
- package/lib/cjs/index.js +10 -7
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/utils/refs.d.ts +1 -2
- package/lib/esm/components/button.d.ts +1 -1
- package/lib/esm/components/button.js +1 -0
- package/lib/esm/components/button.js.map +1 -1
- package/lib/esm/components/button_icon.d.ts +3 -1
- package/lib/esm/components/button_icon.js +2 -2
- package/lib/esm/components/button_icon.js.map +1 -1
- package/lib/esm/components/callout.js +3 -1
- package/lib/esm/components/callout.js.map +1 -1
- package/lib/esm/components/common_button.d.ts +7 -1
- package/lib/esm/components/common_button.js +37 -2
- package/lib/esm/components/common_button.js.map +1 -1
- package/lib/esm/components/dropdown/dropdown_container.d.ts +23 -0
- package/lib/esm/components/dropdown/dropdown_container.js +113 -0
- package/lib/esm/components/dropdown/dropdown_container.js.map +1 -0
- package/lib/esm/components/dropdown/dropdown_popover.d.ts +20 -0
- package/lib/esm/components/dropdown/dropdown_popover.js +60 -0
- package/lib/esm/components/dropdown/dropdown_popover.js.map +1 -0
- package/lib/esm/components/dropdown/dropdown_portal_registration_context.d.ts +29 -0
- package/lib/esm/components/dropdown/dropdown_portal_registration_context.js +67 -0
- package/lib/esm/components/dropdown/dropdown_portal_registration_context.js.map +1 -0
- package/lib/esm/components/dropdown/index.d.ts +3 -0
- package/lib/esm/components/dropdown/index.js +4 -0
- package/lib/esm/components/dropdown/index.js.map +1 -0
- package/lib/esm/components/dropdown/types.d.ts +123 -0
- package/lib/esm/components/dropdown/types.js +2 -0
- package/lib/esm/components/dropdown/types.js.map +1 -0
- package/lib/esm/components/dropdown/use_dropdown.d.ts +18 -0
- package/lib/esm/components/dropdown/use_dropdown.js +289 -0
- package/lib/esm/components/dropdown/use_dropdown.js.map +1 -0
- package/lib/esm/components/{dropdown.d.ts → legacy_dropdown.d.ts} +7 -3
- package/lib/esm/components/{dropdown.js → legacy_dropdown.js} +21 -17
- package/lib/esm/components/legacy_dropdown.js.map +1 -0
- package/lib/esm/components/tooltip/types.d.ts +5 -1
- package/lib/esm/components/tooltip/use_tooltip.js +14 -24
- package/lib/esm/components/tooltip/use_tooltip.js.map +1 -1
- package/lib/esm/icons/express/bulb_stars.d.ts +3 -3
- package/lib/esm/icons/express/bulb_stars.js +7 -6
- package/lib/esm/icons/express/bulb_stars.js.map +1 -1
- package/lib/esm/icons/express/core/icon_types.d.ts +1 -0
- package/lib/esm/icons/express/core/index.d.ts +3 -2
- package/lib/esm/icons/express/core/index.js +2 -1
- package/lib/esm/icons/express/core/index.js.map +1 -1
- package/lib/esm/icons/express/core/utils.d.ts +2 -0
- package/lib/esm/icons/express/core/utils.js +11 -0
- package/lib/esm/icons/express/core/utils.js.map +1 -0
- package/lib/esm/icons/express/document_stars.d.ts +3 -3
- package/lib/esm/icons/express/document_stars.js +7 -6
- package/lib/esm/icons/express/document_stars.js.map +1 -1
- package/lib/esm/icons/express/stack_stars.d.ts +3 -3
- package/lib/esm/icons/express/stack_stars.js +7 -6
- package/lib/esm/icons/express/stack_stars.js.map +1 -1
- package/lib/esm/icons/express/stars.d.ts +3 -3
- package/lib/esm/icons/express/stars.js +8 -11
- package/lib/esm/icons/express/stars.js.map +1 -1
- package/lib/esm/index.d.ts +3 -2
- package/lib/esm/index.js +2 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/refs.d.ts +1 -2
- package/lib/stylesheets/particle.css +90 -9
- package/lib/stylesheets/particle.css.map +1 -1
- package/lib/stylesheets/particle.min.css +1 -1
- package/lib/stylesheets/particle.min.css.gz +0 -0
- package/package.json +4 -1
- package/styles/color_schemes/_color_scheme_builder.scss +2 -0
- package/styles/components/add_button/_base.scss +3 -1
- package/styles/components/buttons/_base.scss +87 -22
- package/styles/components/buttons/themes/_theme_builder.scss +2 -2
- package/styles/components/callout/_base.scss +4 -0
- package/styles/components/callout/themes/_theme_builder.scss +4 -0
- package/lib/cjs/components/dropdown.js.map +0 -1
- package/lib/esm/components/dropdown.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CommonComponentProps, MarginModifierProp, ModifierClassProp } from '../types';
|
|
3
3
|
import type { GetRef } from '../utils/refs';
|
|
4
|
-
declare const COLORS: readonly ["alert", "close", "coachmark", "dscout", "archive", "none", "success", "note", "screener", "live", "diary", "test", "invert", "black", "white"];
|
|
4
|
+
declare const COLORS: readonly ["ai", "alert", "close", "coachmark", "dscout", "archive", "none", "success", "note", "screener", "live", "diary", "test", "invert", "black", "white"];
|
|
5
5
|
declare const SIZES: readonly ["tiny", "small", "big"];
|
|
6
6
|
declare const WIDTHS: readonly ["fullwidth", "tight"];
|
|
7
7
|
declare const VARIANTS: readonly ["glass", "outline"];
|
|
@@ -32,6 +32,7 @@ var data_attributes_1 = __importDefault(require("../utils/data_attributes"));
|
|
|
32
32
|
var modifier_classes_1 = require("../utils/modifier_classes");
|
|
33
33
|
var common_button_1 = require("./common_button");
|
|
34
34
|
var COLORS = [
|
|
35
|
+
'ai',
|
|
35
36
|
'alert',
|
|
36
37
|
'close',
|
|
37
38
|
'coachmark',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAA0B;AAS1B,qEAA8C;AAC9C,6EAAyD;AACzD,8DAA2D;AAE3D,iDAA+C;AAE/C,IAAM,MAAM,GAAG;IACb,OAAO;IACP,OAAO;IACP,WAAW;IACX,QAAQ;IACR,SAAS;IACT,MAAM;IACN,SAAS;IACT,MAAM;IACN,UAAU;IACV,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,OAAO;IACP,OAAO;CACC,CAAC;AAEX,IAAM,KAAK,GAAG,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAU,CAAC;AAEhD,IAAM,MAAM,GAAG,CAAC,WAAW,EAAE,OAAO,CAAU,CAAC;AAE/C,IAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,SAAS,CAAU,CAAC;AAE/C,IAAM,KAAK,GAAG;IACZ,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,KAAK;IACX,KAAK,EAAE,MAAM;IACb,OAAO,EAAE,QAAQ;CAClB,CAAC;AAkCF,IAAM,SAAS,GAA2B;IACxC,IAAI,EAAE,OAAO;CACd,CAAC;AAEF,SAAS,iBAAiB,CAAC,IAAwB,EAAE,KAAa;IAChE,IAAM,WAAW,GAAG,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC;IAErE,IAAK,KAAK,CAAC,IAAI,CAA2B,CAAC,QAAQ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SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,KAET,QAAQ,CACI,CAChB,CAAC;AACJ,CAAC;AAlED,wBAkEC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { GetRef } from '../utils/refs';
|
|
3
3
|
import type { Colors, CommonComponentProps, MarginModifierProp, ModifierClassProp, Radii } from '../types';
|
|
4
|
+
import type { BuiltInTooltipConfig } from './tooltip/types';
|
|
4
5
|
interface ButtonIconProps extends CommonComponentProps, MarginModifierProp, ModifierClassProp {
|
|
5
6
|
'aria-controls'?: string;
|
|
6
7
|
'aria-expanded'?: React.AriaAttributes['aria-expanded'];
|
|
@@ -26,7 +27,8 @@ interface ButtonIconProps extends CommonComponentProps, MarginModifierProp, Modi
|
|
|
26
27
|
radius?: Radii;
|
|
27
28
|
refProp?: string;
|
|
28
29
|
title?: string;
|
|
30
|
+
tooltipConfig?: BuiltInTooltipConfig;
|
|
29
31
|
type?: 'button' | 'submit';
|
|
30
32
|
}
|
|
31
|
-
export declare function ButtonIcon({ _modifierClass, 'aria-controls': ariaControls, 'aria-expanded': ariaExpanded, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-pressed': ariaPressed, bgColor, bgSize, borderColor, children, color, disabled, getRef, hoverBgColor, hoverBorderColor, hoverColor, hoverBgSize, id, linkComponent, linkProps, margin, name, onClick, onMouseUp, radius, onMouseDown, refProp, title, type, ...rest }: ButtonIconProps): React.JSX.Element;
|
|
33
|
+
export declare function ButtonIcon({ _modifierClass, 'aria-controls': ariaControls, 'aria-expanded': ariaExpanded, 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledby, 'aria-describedby': ariaDescribedby, 'aria-pressed': ariaPressed, bgColor, bgSize, borderColor, children, color, disabled, getRef, hoverBgColor, hoverBorderColor, hoverColor, hoverBgSize, id, linkComponent, linkProps, margin, name, onClick, onMouseUp, radius, onMouseDown, refProp, title, tooltipConfig, type, ...rest }: ButtonIconProps): React.JSX.Element;
|
|
32
34
|
export {};
|
|
@@ -59,7 +59,7 @@ var DEFAULT_HOVER_COLOR = 'main';
|
|
|
59
59
|
var DEFAULT_DISABLED_COLOR = 'gray-3';
|
|
60
60
|
var DEFAULT_RADIUS = 'circle';
|
|
61
61
|
function ButtonIcon(_a) {
|
|
62
|
-
var _modifierClass = _a._modifierClass, ariaControls = _a["aria-controls"], ariaExpanded = _a["aria-expanded"], ariaLabel = _a["aria-label"], ariaLabelledby = _a["aria-labelledby"], ariaDescribedby = _a["aria-describedby"], ariaPressed = _a["aria-pressed"], bgColor = _a.bgColor, bgSize = _a.bgSize, borderColor = _a.borderColor, children = _a.children, color = _a.color, disabled = _a.disabled, getRef = _a.getRef, hoverBgColor = _a.hoverBgColor, hoverBorderColor = _a.hoverBorderColor, hoverColor = _a.hoverColor, hoverBgSize = _a.hoverBgSize, id = _a.id, linkComponent = _a.linkComponent, linkProps = _a.linkProps, margin = _a.margin, name = _a.name, onClick = _a.onClick, onMouseUp = _a.onMouseUp, radius = _a.radius, onMouseDown = _a.onMouseDown, refProp = _a.refProp, title = _a.title, type = _a.type, rest = __rest(_a, ["_modifierClass", 'aria-controls', 'aria-expanded', 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-pressed', "bgColor", "bgSize", "borderColor", "children", "color", "disabled", "getRef", "hoverBgColor", "hoverBorderColor", "hoverColor", "hoverBgSize", "id", "linkComponent", "linkProps", "margin", "name", "onClick", "onMouseUp", "radius", "onMouseDown", "refProp", "title", "type"]);
|
|
62
|
+
var _modifierClass = _a._modifierClass, ariaControls = _a["aria-controls"], ariaExpanded = _a["aria-expanded"], ariaLabel = _a["aria-label"], ariaLabelledby = _a["aria-labelledby"], ariaDescribedby = _a["aria-describedby"], ariaPressed = _a["aria-pressed"], bgColor = _a.bgColor, bgSize = _a.bgSize, borderColor = _a.borderColor, children = _a.children, color = _a.color, disabled = _a.disabled, getRef = _a.getRef, hoverBgColor = _a.hoverBgColor, hoverBorderColor = _a.hoverBorderColor, hoverColor = _a.hoverColor, hoverBgSize = _a.hoverBgSize, id = _a.id, linkComponent = _a.linkComponent, linkProps = _a.linkProps, margin = _a.margin, name = _a.name, onClick = _a.onClick, onMouseUp = _a.onMouseUp, radius = _a.radius, onMouseDown = _a.onMouseDown, refProp = _a.refProp, title = _a.title, tooltipConfig = _a.tooltipConfig, type = _a.type, rest = __rest(_a, ["_modifierClass", 'aria-controls', 'aria-expanded', 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-pressed', "bgColor", "bgSize", "borderColor", "children", "color", "disabled", "getRef", "hoverBgColor", "hoverBorderColor", "hoverColor", "hoverBgSize", "id", "linkComponent", "linkProps", "margin", "name", "onClick", "onMouseUp", "radius", "onMouseDown", "refProp", "title", "tooltipConfig", "type"]);
|
|
63
63
|
var _b = (0, react_1.useState)(false), hovered = _b[0], setHovered = _b[1];
|
|
64
64
|
function getBgColorClass() {
|
|
65
65
|
var colorEnum = bgColor;
|
|
@@ -111,7 +111,7 @@ function ButtonIcon(_a) {
|
|
|
111
111
|
setHovered(true);
|
|
112
112
|
}, onMouseLeave: function () {
|
|
113
113
|
setHovered(false);
|
|
114
|
-
}, onMouseUp: onMouseUp, refProp: refProp, style: style, title: title, type: type }),
|
|
114
|
+
}, onMouseUp: onMouseUp, refProp: refProp, style: style, title: title, tooltipConfig: tooltipConfig, type: type }),
|
|
115
115
|
react_1.default.createElement("span", { className: "display--b" }, children)));
|
|
116
116
|
}
|
|
117
117
|
exports.ButtonIcon = ButtonIcon;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button_icon.js","sourceRoot":"","sources":["../../../src/components/button_icon.tsx"],"names":[],"mappings":";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QAChD,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM;KAChD,CAAC;IAEF,OAAO,CACL,8BAAC,4BAAY,eACP,IAAA,yBAAiB,EAAC,IAAI,CAAC,qBACZ,YAAY,mBACZ,YAAY,gBACf,SAAS,qBACJ,cAAc,sBACb,eAAe,kBACnB,WAAW,EACzB,SAAS,EAAE,QAAQ,EACnB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,EAAE,EACN,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE;YACN,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,EACD,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE;YACP,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EACD,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE;YACZ,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EACD,YAAY,EAAE;YACZ,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,EACD,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,IAAI;QAEV,wCAAM,SAAS,EAAC,YAAY,IAAE,QAAQ,CAAQ,CACjC,CAChB,CAAC;AACJ,CAAC;AAxID,gCAwIC"}
|
|
@@ -86,7 +86,9 @@ function Callout(_a) {
|
|
|
86
86
|
return (react_1.default.createElement("div", __assign({ className: containerClassnames }, (0, data_attributes_1.default)(rest)),
|
|
87
87
|
react_1.default.createElement("div", { className: "Callout__Title-Container flex" },
|
|
88
88
|
react_1.default.createElement("div", { className: "Callout__Icon-Container rounded--small height--1.5 width--1.5 flex-shrink--0 flex-grow--0 margin-r--0.75 flex justify--center" }, icon),
|
|
89
|
-
react_1.default.createElement("div", { className:
|
|
89
|
+
react_1.default.createElement("div", { className: (0, class_names_1.default)('flex-grow--1', {
|
|
90
|
+
'padding-r--1': renderWithDetailsAccordion || renderWithActionButton
|
|
91
|
+
}) },
|
|
90
92
|
react_1.default.createElement("span", { className: "font-size--s" }, title)),
|
|
91
93
|
renderWithDetailsAccordion && (react_1.default.createElement(button_plain_1.ButtonPlain, { margin: {
|
|
92
94
|
left: 'auto'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callout.js","sourceRoot":"","sources":["../../../src/components/callout.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAwD;AAExD,qEAA8C;AAC9C,4CAAgD;AAEhD,+CAA6C;AAC7C,6DAA2D;AAC3D,mCAAkC;AAOlC,8DAA8E;AAC9E,6EAAyD;AAGvD,IAAA,eAAe,GAIb,sBAAY,gBAJC,EACf,yBAAyB,GAGvB,sBAAY,0BAHW,EACzB,aAAa,GAEX,sBAAY,cAFD,EACb,uBAAuB,GACrB,sBAAY,wBADS,CACR;AAejB,IAAM,cAAc,GAAG,UAAC,OAAsC;IAC5D,QAAQ,OAAO,EAAE;QACf,KAAK,OAAO;YACV,OAAO,8BAAC,uBAAuB,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,GAAG,CAAC;QAC7D,KAAK,MAAM;YACT,OAAO,8BAAC,yBAAyB,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,GAAG,CAAC;QAC/D,KAAK,SAAS;YACZ,OAAO,8BAAC,uBAAuB,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,GAAG,CAAC;QAC7D,KAAK,KAAK,CAAC;QACX;YACE,OAAO,8BAAC,aAAa,IAAC,IAAI,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO,GAAG,CAAC;KACpD;AACH,CAAC,CAAC;AAEF;;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0B,IAAI,CAC7B,8BAAC,wCAAkB,IAAC,SAAS,EAAE,WAAW;YACxC,uCAAK,SAAS,EAAC,qCAAqC;gBAClD,uCAAK,SAAS,EAAC,cAAc,IAAE,cAAc,CAAO,CAChD,CACa,CACtB,CACG,CACP,CAAC;AACJ,CAAC;AA/ED,0BA+EC;AAED,kBAAe,OAAO,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { CommonComponentProps } from '../types';
|
|
3
3
|
import type { GetRef } from '../utils/refs';
|
|
4
|
+
import type { BuiltInTooltipConfig } from './tooltip/types';
|
|
4
5
|
interface CommonButtonProps extends CommonComponentProps {
|
|
5
6
|
'aria-controls'?: string;
|
|
6
7
|
'aria-expanded'?: React.AriaAttributes['aria-expanded'];
|
|
@@ -23,8 +24,13 @@ interface CommonButtonProps extends CommonComponentProps {
|
|
|
23
24
|
refProp?: string;
|
|
24
25
|
style?: React.CSSProperties;
|
|
25
26
|
tabIndex?: number;
|
|
27
|
+
tooltipConfig?: BuiltInTooltipConfig;
|
|
26
28
|
title?: string;
|
|
27
29
|
type?: 'button' | 'submit';
|
|
28
30
|
}
|
|
29
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Wrapper for the `BaseCommonButton` component that enables optionally rendering the button
|
|
33
|
+
* within a TooltipContainer if `tooltipConfig` is provided in props
|
|
34
|
+
*/
|
|
35
|
+
export declare function CommonButton({ disabled, tooltipConfig, getRef, refProp, ...rest }: CommonButtonProps): React.JSX.Element;
|
|
30
36
|
export {};
|
|
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
+
if (mod && mod.__esModule) return mod;
|
|
31
|
+
var result = {};
|
|
32
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
33
|
+
__setModuleDefault(result, mod);
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
13
36
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
37
|
var t = {};
|
|
15
38
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -26,9 +49,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
49
|
};
|
|
27
50
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
51
|
exports.CommonButton = void 0;
|
|
29
|
-
var react_1 =
|
|
52
|
+
var react_1 = __importStar(require("react"));
|
|
30
53
|
var reject_1 = __importDefault(require("../utils/reject"));
|
|
31
54
|
var data_attributes_1 = __importDefault(require("../utils/data_attributes"));
|
|
55
|
+
var tooltip_container_1 = require("./tooltip/tooltip_container");
|
|
32
56
|
var DISALLOWED_LINK_PROPS = ['className'];
|
|
33
57
|
var HREF = 'href';
|
|
34
58
|
function sanitizeProps(props, disabled) {
|
|
@@ -39,7 +63,7 @@ function sanitizeProps(props, disabled) {
|
|
|
39
63
|
: DISALLOWED_LINK_PROPS;
|
|
40
64
|
return (0, reject_1.default)(props, propsToRemove);
|
|
41
65
|
}
|
|
42
|
-
function
|
|
66
|
+
function CommonButtonBase(_a) {
|
|
43
67
|
var _b;
|
|
44
68
|
var ariaControls = _a["aria-controls"], ariaExpanded = _a["aria-expanded"], ariaLabel = _a["aria-label"], ariaLabelledby = _a["aria-labelledby"], ariaDescribedby = _a["aria-describedby"], ariaPressed = _a["aria-pressed"], children = _a.children, className = _a.className, disabled = _a.disabled, getRef = _a.getRef, id = _a.id, linkComponent = _a.linkComponent, linkProps = _a.linkProps, name = _a.name, onBlur = _a.onBlur, onClick = _a.onClick, onFocus = _a.onFocus, onMouseDown = _a.onMouseDown, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onMouseUp = _a.onMouseUp, _c = _a.refProp, refProp = _c === void 0 ? 'ref' : _c, style = _a.style, tabIndex = _a.tabIndex, title = _a.title, _d = _a.type, type = _d === void 0 ? 'button' : _d, rest = __rest(_a, ['aria-controls', 'aria-expanded', 'aria-label', 'aria-labelledby', 'aria-describedby', 'aria-pressed', "children", "className", "disabled", "getRef", "id", "linkComponent", "linkProps", "name", "onBlur", "onClick", "onFocus", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseUp", "refProp", "style", "tabIndex", "title", "type"]);
|
|
45
69
|
var isLink = !!linkComponent;
|
|
@@ -47,5 +71,39 @@ function CommonButton(_a) {
|
|
|
47
71
|
var refProps = getRef ? (_b = {}, _b[refProp] = getRef, _b) : {};
|
|
48
72
|
return (react_1.default.createElement(Component, __assign({}, sanitizeProps(linkProps, disabled), refProps, (0, data_attributes_1.default)(rest), { "aria-controls": ariaControls, "aria-expanded": ariaExpanded, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby, "aria-pressed": ariaPressed, className: className, disabled: disabled, id: id, name: name, onBlur: onBlur, onClick: onClick, onFocus: onFocus, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onMouseUp: onMouseUp, onMouseDown: onMouseDown, style: style, tabIndex: isLink && disabled ? -1 : tabIndex, title: title, type: isLink ? undefined : type }), children));
|
|
49
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Wrapper for the `BaseCommonButton` component that enables optionally rendering the button
|
|
76
|
+
* within a TooltipContainer if `tooltipConfig` is provided in props
|
|
77
|
+
*/
|
|
78
|
+
function CommonButton(_a) {
|
|
79
|
+
var disabled = _a.disabled, tooltipConfig = _a.tooltipConfig, getRef = _a.getRef, _b = _a.refProp, refProp = _b === void 0 ? 'ref' : _b, rest = __rest(_a, ["disabled", "tooltipConfig", "getRef", "refProp"]);
|
|
80
|
+
var tooltipRefFunctionRef = (0, react_1.useRef)(function () { });
|
|
81
|
+
var setRef = (0, react_1.useCallback)(function (ref, value) {
|
|
82
|
+
if (typeof ref === 'function') {
|
|
83
|
+
ref(value);
|
|
84
|
+
}
|
|
85
|
+
else if (ref && 'current' in ref) {
|
|
86
|
+
ref.current = value;
|
|
87
|
+
}
|
|
88
|
+
}, []);
|
|
89
|
+
var assignRefs = (0, react_1.useCallback)(function (element) {
|
|
90
|
+
setRef(getRef, element);
|
|
91
|
+
setRef(tooltipRefFunctionRef.current, element);
|
|
92
|
+
}, [getRef, setRef]);
|
|
93
|
+
if (!tooltipConfig) {
|
|
94
|
+
return (react_1.default.createElement(CommonButtonBase, __assign({}, rest, { disabled: disabled, refProp: refProp, getRef: getRef })));
|
|
95
|
+
}
|
|
96
|
+
return (react_1.default.createElement(tooltip_container_1.TooltipContainer, __assign({}, tooltipConfig), function (_a) {
|
|
97
|
+
var ref = _a.ref;
|
|
98
|
+
// We assign the TooltipContainer ref to our own ref here to prevent passing it to `assignRefs` directly
|
|
99
|
+
// via an inline function below. That inline function would be recreated on every render and cause the
|
|
100
|
+
// ref to be re-assigned unnecessarily and potentially impact performance
|
|
101
|
+
tooltipRefFunctionRef.current = ref;
|
|
102
|
+
// Disabled buttons do not receive focus or hover events and require a wrapping `span` element
|
|
103
|
+
// to receive the tooltip ref
|
|
104
|
+
return disabled ? (react_1.default.createElement("span", { ref: ref },
|
|
105
|
+
react_1.default.createElement(CommonButtonBase, __assign({}, rest, { disabled: disabled, refProp: refProp, getRef: getRef })))) : (react_1.default.createElement(CommonButtonBase, __assign({}, rest, { disabled: disabled, refProp: refProp, getRef: assignRefs })));
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
50
108
|
exports.CommonButton = CommonButton;
|
|
51
109
|
//# sourceMappingURL=common_button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_button.js","sourceRoot":"","sources":["../../../src/components/common_button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common_button.js","sourceRoot":"","sources":["../../../src/components/common_button.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAmD;AAKnD,2DAAqC;AACrC,6EAAyD;AAEzD,iEAA+D;AA6B/D,IAAM,qBAAqB,GAAG,CAAC,WAAW,CAAC,CAAC;AAC5C,IAAM,IAAI,GAAG,MAAM,CAAC;AAEpB,SAAS,aAAa,CAAC,KAA8B,EAAE,QAAiB;IACtE,IAAI,CAAC,KAAK;QAAE,OAAO;IAEnB,IAAM,aAAa,GAAG,QAAQ;QAC5B,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC;QACpC,CAAC,CAAC,qBAAqB,CAAC;IAE1B,OAAO,IAAA,gBAAM,EAAC,KAAK,EAAE,aAAa,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,gBAAgB,CAAC,EA4BN;;IA3BlB,IAAiB,YAAY,sBAAA,EACZ,YAAY,sBAAA,EACf,SAAS,mBAAA,EACJ,cAAc,wBAAA,EACb,eAAe,yBAAA,EACnB,WAAW,qBAAA,EAC3B,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,QAAQ,cAAA,EACR,MAAM,YAAA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CAAM,GAAG,EAAE,GAAG;YACZ,8BAAC,gBAAgB,eACX,IAAI,IACR,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,IACd,CACG,CACR,CAAC,CAAC,CAAC,CACF,8BAAC,gBAAgB,eACX,IAAI,IACR,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,UAAU,IAClB,CACH,CAAC;IACJ,CAAC,CACgB,CACpB,CAAC;AACJ,CAAC;AAvED,oCAuEC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { ContentRenderProp, ToggleRenderProp, DropdownOptions, DropdownPopoverOptions } from './types';
|
|
3
|
+
interface ContainerProps {
|
|
4
|
+
children: ContentRenderProp | React.ReactNode;
|
|
5
|
+
closeOnOutsideClick?: boolean;
|
|
6
|
+
setLockOutsideClick?: (lock: boolean) => void;
|
|
7
|
+
onToggle?: (isToggled: boolean) => void;
|
|
8
|
+
toggle: ToggleRenderProp;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The preferred export for implementing boundary aware dropdowns, which can be externally controlled or internally
|
|
12
|
+
* controlled. This component is responsible for rendering the toggle element and the dropdown popover content, where the
|
|
13
|
+
* `children` of this component are placed within the popover.
|
|
14
|
+
*
|
|
15
|
+
* Make sure you utilize the render prop pattern to ensure proper ref forwarding, this prevents
|
|
16
|
+
* this component from needing to render its own `span` element and will ensure a consistent layout
|
|
17
|
+
*
|
|
18
|
+
* If you render a dropdown that interferes with clickoutside logic due to it being render via a portal
|
|
19
|
+
* (such as a click within a dropdown should not trigger clickoutside logic),
|
|
20
|
+
* check out the `DropdownPortalRegistrationContextProvider` and corresponding `useActiveDropdownsContext` hook.
|
|
21
|
+
*/
|
|
22
|
+
export default function DropdownContainer({ boundary, boundaryPadding, children, className, closeOnOutsideClick, contentWidth, disabled, dropdownId, eventListenerOptions, focusToggleOnClose, flip, externallyControlled, hide, initialFocusDisabled, isOpen: externallyIsOpen, maxHeight, offset, onToggle, placement, portalContainer, boundaryElementRef, setLockOutsideClick, shrinkToPreventOverflow, shift, toggle, zIndex }: ContainerProps & DropdownOptions & DropdownPopoverOptions): React.JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var react_1 = __importStar(require("react"));
|
|
30
|
+
var noop_1 = __importDefault(require("../../utils/noop"));
|
|
31
|
+
var use_dropdown_1 = __importDefault(require("./use_dropdown"));
|
|
32
|
+
/**
|
|
33
|
+
* The preferred export for implementing boundary aware dropdowns, which can be externally controlled or internally
|
|
34
|
+
* controlled. This component is responsible for rendering the toggle element and the dropdown popover content, where the
|
|
35
|
+
* `children` of this component are placed within the popover.
|
|
36
|
+
*
|
|
37
|
+
* Make sure you utilize the render prop pattern to ensure proper ref forwarding, this prevents
|
|
38
|
+
* this component from needing to render its own `span` element and will ensure a consistent layout
|
|
39
|
+
*
|
|
40
|
+
* If you render a dropdown that interferes with clickoutside logic due to it being render via a portal
|
|
41
|
+
* (such as a click within a dropdown should not trigger clickoutside logic),
|
|
42
|
+
* check out the `DropdownPortalRegistrationContextProvider` and corresponding `useActiveDropdownsContext` hook.
|
|
43
|
+
*/
|
|
44
|
+
function DropdownContainer(_a) {
|
|
45
|
+
var boundary = _a.boundary, boundaryPadding = _a.boundaryPadding, children = _a.children, className = _a.className, _b = _a.closeOnOutsideClick, closeOnOutsideClick = _b === void 0 ? true : _b, contentWidth = _a.contentWidth, disabled = _a.disabled, dropdownId = _a.dropdownId, eventListenerOptions = _a.eventListenerOptions, _c = _a.focusToggleOnClose, focusToggleOnClose = _c === void 0 ? true : _c, flip = _a.flip, _d = _a.externallyControlled, externallyControlled = _d === void 0 ? false : _d, hide = _a.hide, _e = _a.initialFocusDisabled, initialFocusDisabled = _e === void 0 ? false : _e, _f = _a.isOpen, externallyIsOpen = _f === void 0 ? false : _f, maxHeight = _a.maxHeight, offset = _a.offset, _g = _a.onToggle, onToggle = _g === void 0 ? noop_1.default : _g, placement = _a.placement, portalContainer = _a.portalContainer, boundaryElementRef = _a.boundaryElementRef, setLockOutsideClick = _a.setLockOutsideClick, _h = _a.shrinkToPreventOverflow, shrinkToPreventOverflow = _h === void 0 ? false : _h, shift = _a.shift, toggle = _a.toggle, zIndex = _a.zIndex;
|
|
46
|
+
var _j = (0, react_1.useState)(false), isOpen = _j[0], setIsOpen = _j[1];
|
|
47
|
+
var eventListenerOptionsRef = (0, react_1.useRef)(eventListenerOptions);
|
|
48
|
+
eventListenerOptionsRef.current = eventListenerOptions;
|
|
49
|
+
var toggleDropdown = (0, react_1.useCallback)(function (stateOverride) {
|
|
50
|
+
var newState = typeof stateOverride === 'boolean' ? stateOverride : !isOpen;
|
|
51
|
+
setIsOpen(newState);
|
|
52
|
+
onToggle(newState);
|
|
53
|
+
if (setLockOutsideClick)
|
|
54
|
+
setLockOutsideClick(false);
|
|
55
|
+
}, [isOpen, onToggle, setLockOutsideClick]);
|
|
56
|
+
(0, react_1.useEffect)(function () {
|
|
57
|
+
if (!externallyControlled)
|
|
58
|
+
return;
|
|
59
|
+
toggleDropdown(externallyIsOpen);
|
|
60
|
+
}, [externallyControlled, externallyIsOpen, toggleDropdown]);
|
|
61
|
+
var renderPopoverContent = (0, react_1.useMemo)(function () {
|
|
62
|
+
if (typeof children === 'function') {
|
|
63
|
+
return children({ toggleDropdown: toggleDropdown });
|
|
64
|
+
}
|
|
65
|
+
return children;
|
|
66
|
+
}, [children, toggleDropdown]);
|
|
67
|
+
var _k = (0, use_dropdown_1.default)(renderPopoverContent, isOpen, {
|
|
68
|
+
boundary: boundary,
|
|
69
|
+
boundaryPadding: boundaryPadding,
|
|
70
|
+
className: className,
|
|
71
|
+
disabled: disabled,
|
|
72
|
+
flip: flip,
|
|
73
|
+
focusToggleOnClose: focusToggleOnClose,
|
|
74
|
+
hide: hide,
|
|
75
|
+
offset: offset,
|
|
76
|
+
placement: placement,
|
|
77
|
+
portalContainer: portalContainer,
|
|
78
|
+
shift: shift,
|
|
79
|
+
zIndex: zIndex
|
|
80
|
+
}, {
|
|
81
|
+
contentWidth: contentWidth,
|
|
82
|
+
maxHeight: maxHeight,
|
|
83
|
+
shrinkToPreventOverflow: shrinkToPreventOverflow,
|
|
84
|
+
initialFocusDisabled: initialFocusDisabled,
|
|
85
|
+
dropdownId: dropdownId,
|
|
86
|
+
boundaryElementRef: boundaryElementRef
|
|
87
|
+
}), ref = _k.ref, dropdownPopover = _k.dropdownPopover, popoverElementRef = _k.popoverElementRef, toggleElementRef = _k.toggleElementRef;
|
|
88
|
+
(0, react_1.useEffect)(function () {
|
|
89
|
+
var handleClickOutside = function (event) {
|
|
90
|
+
var _a;
|
|
91
|
+
if (!closeOnOutsideClick || !popoverElementRef.current)
|
|
92
|
+
return;
|
|
93
|
+
var hasComposedPath = typeof event.composedPath === 'function';
|
|
94
|
+
// Prefer composed path check for detecting outside clicks to prevent issues with
|
|
95
|
+
// clicking dynamically rendered content (see PAR-155 for more info)
|
|
96
|
+
var isClickInside = hasComposedPath
|
|
97
|
+
? event.composedPath().includes(popoverElementRef.current)
|
|
98
|
+
: popoverElementRef.current.contains(event.target);
|
|
99
|
+
var isClickOnToggle = hasComposedPath && toggleElementRef.current
|
|
100
|
+
? event.composedPath().includes(toggleElementRef.current)
|
|
101
|
+
: (_a = toggleElementRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target);
|
|
102
|
+
if (!isClickInside && !isClickOnToggle) {
|
|
103
|
+
toggleDropdown();
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var handleKeydownClose = function (event) {
|
|
107
|
+
if (!closeOnOutsideClick)
|
|
108
|
+
return;
|
|
109
|
+
var key = event.key;
|
|
110
|
+
if (key === 'Escape') {
|
|
111
|
+
toggleDropdown();
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
if (isOpen && !externallyControlled) {
|
|
115
|
+
document.addEventListener('click', handleClickOutside, eventListenerOptionsRef.current);
|
|
116
|
+
document.addEventListener('keydown', handleKeydownClose, eventListenerOptionsRef.current);
|
|
117
|
+
}
|
|
118
|
+
return function () {
|
|
119
|
+
document.removeEventListener('click', handleClickOutside, eventListenerOptionsRef.current);
|
|
120
|
+
document.removeEventListener('keydown', handleKeydownClose, eventListenerOptionsRef.current);
|
|
121
|
+
};
|
|
122
|
+
}, [
|
|
123
|
+
closeOnOutsideClick,
|
|
124
|
+
externallyControlled,
|
|
125
|
+
isOpen,
|
|
126
|
+
popoverElementRef,
|
|
127
|
+
toggleDropdown,
|
|
128
|
+
toggleElementRef
|
|
129
|
+
]);
|
|
130
|
+
var renderToggleContent = (0, react_1.useCallback)(function () {
|
|
131
|
+
return toggle({
|
|
132
|
+
ref: ref,
|
|
133
|
+
toggleDropdown: toggleDropdown,
|
|
134
|
+
isToggled: isOpen
|
|
135
|
+
});
|
|
136
|
+
}, [isOpen, ref, toggle, toggleDropdown]);
|
|
137
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
138
|
+
renderToggleContent(),
|
|
139
|
+
dropdownPopover));
|
|
140
|
+
}
|
|
141
|
+
exports.default = DropdownContainer;
|
|
142
|
+
//# sourceMappingURL=dropdown_container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown_container.js","sourceRoot":"","sources":["../../../../src/components/dropdown/dropdown_container.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAMe;AAEf,0DAAoC;AAOpC,gEAAyC;AAUzC;;;;;;;;;;;GAWG;AACH,SAAwB,iBAAiB,CAAC,EA2BkB;QA1B1D,QAAQ,cAAA,EACR,eAAe,qBAAA,EACf,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,2BAA0B,EAA1B,mBAAmB,mBAAG,IAAI,KAAA,EAC1B,YAAY,kBAAA,EACZ,QAAQ,cAAA,EACR,UAAU,gBAAA,EACV,oBAAoB,0BAAA,EACpB,0BAAyB,EAAzB,kBAAkB,mBAAG,IAAI,KAAA,EACzB,IAAI,UAAA,EACJ,4BAA4B,EAA5B,oBAAoB,mBAAG,KAAK,KAAA,EAC5B,IAAI,UAAA,EACJ,4BAA4B,EAA5B,oBAAoB,mBAAG,KAAK,KAAA,EAC5B,cAAgC,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EAChC,SAAS,eAAA,EACT,MAAM,YAAA,EACN,gBAAe,EAAf,QAAQ,mBAAG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AC;aAClB;QACH,CAAC,CAAC;QAEF,IAAM,kBAAkB,GAAG,UAAC,KAAoB;YAC9C,IAAI,CAAC,mBAAmB;gBAAE,OAAO;YAEzB,IAAA,GAAG,GAAK,KAAK,IAAV,CAAW;YACtB,IAAI,GAAG,KAAK,QAAQ,EAAE;gBACpB,cAAc,EAAE,CAAC;aAClB;QACH,CAAC,CAAC;QAEF,IAAI,MAAM,IAAI,CAAC,oBAAoB,EAAE;YACnC,QAAQ,CAAC,gBAAgB,CACvB,OAAO,EACP,kBAAkB,EAClB,uBAAuB,CAAC,OAAO,CAChC,CAAC;YACF,QAAQ,CAAC,gBAAgB,CACvB,SAAS,EACT,kBAAkB,EAClB,uBAAuB,CAAC,OAAO,CAChC,CAAC;SACH;QAED,OAAO;YACL,QAAQ,CAAC,mBAAmB,CAC1B,OAAO,EACP,kBAAkB,EAClB,uBAAuB,CAAC,OAAO,CAChC,CAAC;YACF,QAAQ,CAAC,mBAAmB,CAC1B,SAAS,EACT,kBAAkB,EAClB,uBAAuB,CAAC,OAAO,CAChC,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,EAAE;QACD,mBAAmB;QACnB,oBAAoB;QACpB,MAAM;QACN,iBAAiB;QACjB,cAAc;QACd,gBAAgB;KACjB,CAAC,CAAC;IAEH,IAAM,mBAAmB,GAAG,IAAA,mBAAW,EACrC;QACE,OAAA,MAAM,CAAC;YACL,GAAG,KAAA;YACH,cAAc,gBAAA;YACd,SAAS,EAAE,MAAM;SAClB,CAAC;IAJF,CAIE,EACJ,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,cAAc,CAAC,CACtC,CAAC;IAEF,OAAO,CACL;QACG,mBAAmB,EAAE;QACrB,eAAe,CACf,CACJ,CAAC;AACJ,CAAC;AAtKD,oCAsKC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Strategy } from '@floating-ui/dom';
|
|
3
|
+
import type { DropdownPopoverOptions } from './types';
|
|
4
|
+
type Position = {
|
|
5
|
+
top?: number;
|
|
6
|
+
right?: number;
|
|
7
|
+
bottom?: number;
|
|
8
|
+
left?: number;
|
|
9
|
+
};
|
|
10
|
+
interface Props {
|
|
11
|
+
className?: string;
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
id?: string;
|
|
14
|
+
position?: Position;
|
|
15
|
+
show?: boolean;
|
|
16
|
+
strategy?: Strategy;
|
|
17
|
+
zIndex?: number;
|
|
18
|
+
}
|
|
19
|
+
declare const _default: React.ForwardRefExoticComponent<Props & DropdownPopoverOptions & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
var react_1 = __importStar(require("react"));
|
|
30
|
+
var focus_trap_1 = require("../focus_trap");
|
|
31
|
+
var theme_provider_1 = require("../theme_provider");
|
|
32
|
+
var class_names_1 = __importDefault(require("../../utils/class_names"));
|
|
33
|
+
var dropdown_portal_registration_context_1 = require("./dropdown_portal_registration_context");
|
|
34
|
+
function DropdownPopover(_a, ref) {
|
|
35
|
+
var children = _a.children, className = _a.className, contentWidth = _a.contentWidth, id = _a.id, maxHeight = _a.maxHeight, dropdownId = _a.dropdownId, _b = _a.position, position = _b === void 0 ? {} : _b, show = _a.show, strategy = _a.strategy, zIndex = _a.zIndex;
|
|
36
|
+
var contentRef = (0, react_1.useRef)(null);
|
|
37
|
+
var _c = (0, react_1.useContext)(dropdown_portal_registration_context_1.DropdownPortalRegistrationContext), registerPortal = _c.registerPortal, unregisterPortal = _c.unregisterPortal;
|
|
38
|
+
/**
|
|
39
|
+
* If a dropdown ID was provided to this dropdown instance, register it's content using that
|
|
40
|
+
* ID with the dropdown portal registration context. This enables implementing components
|
|
41
|
+
* that rely on DOM events to determine if a node is within the portal rendered dropdown content
|
|
42
|
+
* created by this component.
|
|
43
|
+
*/
|
|
44
|
+
(0, react_1.useEffect)(function () {
|
|
45
|
+
if (!dropdownId)
|
|
46
|
+
return;
|
|
47
|
+
var idToRegister = dropdownId;
|
|
48
|
+
if (contentRef.current) {
|
|
49
|
+
registerPortal(idToRegister, contentRef.current);
|
|
50
|
+
}
|
|
51
|
+
return function () {
|
|
52
|
+
if (dropdownId) {
|
|
53
|
+
unregisterPortal(idToRegister);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}, [id, dropdownId, registerPortal, unregisterPortal]);
|
|
57
|
+
var assignRef = (0, react_1.useCallback)(function (el) {
|
|
58
|
+
if (ref && 'current' in ref) {
|
|
59
|
+
ref.current = el;
|
|
60
|
+
}
|
|
61
|
+
else if (typeof ref === 'function') {
|
|
62
|
+
ref(el);
|
|
63
|
+
}
|
|
64
|
+
contentRef.current = el;
|
|
65
|
+
}, [ref]);
|
|
66
|
+
// Retrieve currently applied theme from context
|
|
67
|
+
var theme = (0, react_1.useContext)(theme_provider_1.ThemeContext).theme;
|
|
68
|
+
return (
|
|
69
|
+
// Render popover content wrapped in a `ThemeProvider` using the current theme's value
|
|
70
|
+
// this ensures this content, rendered with via portal at the document's body, is wrapped
|
|
71
|
+
// in the correct theme classes
|
|
72
|
+
react_1.default.createElement(theme_provider_1.ThemeProvider, { theme: theme, className: "height--none" },
|
|
73
|
+
react_1.default.createElement(focus_trap_1.FocusTrap, { active: true },
|
|
74
|
+
react_1.default.createElement("div", { "data-testid": "dropdown-popover", className: (0, class_names_1.default)('margin--none rounded--med bg-color--invert shadow--xl', className), id: id, style: {
|
|
75
|
+
bottom: position.bottom,
|
|
76
|
+
left: position.left,
|
|
77
|
+
maxHeight: maxHeight,
|
|
78
|
+
opacity: show ? 1 : 0,
|
|
79
|
+
position: strategy,
|
|
80
|
+
right: position.right,
|
|
81
|
+
top: position.top,
|
|
82
|
+
transition: 'opacity 0.3s',
|
|
83
|
+
width: contentWidth,
|
|
84
|
+
zIndex: zIndex
|
|
85
|
+
}, ref: assignRef }, children))));
|
|
86
|
+
}
|
|
87
|
+
exports.default = react_1.default.forwardRef(DropdownPopover);
|
|
88
|
+
//# sourceMappingURL=dropdown_popover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropdown_popover.js","sourceRoot":"","sources":["../../../../src/components/dropdown/dropdown_popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA0E;AAG1E,4CAA0C;AAC1C,oDAAgE;AAChE,wEAAiD;AAGjD,+FAA2F;AAmB3F,SAA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sFAAsF;IACtF,yFAAyF;IACzF,+BAA+B;IAC/B,8BAAC,8BAAa,IAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,cAAc;QACnD,8BAAC,sBAAS,IAAC,MAAM;YACf,sDACc,kBAAkB,EAC9B,SAAS,EAAE,IAAA,qBAAU,EACnB,uDAAuD,EACvD,SAAS,CACV,EACD,EAAE,EAAE,EAAE,EACN,KAAK,EAAE;oBACL,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,SAAS,WAAA;oBACT,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;oBACrB,QAAQ,EAAE,QAAQ;oBAClB,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,GAAG,EAAE,QAAQ,CAAC,GAAG;oBACjB,UAAU,EAAE,cAAc;oBAC1B,KAAK,EAAE,YAAY;oBACnB,MAAM,QAAA;iBACP,EACD,GAAG,EAAE,SAAS,IAEb,QAAQ,CACL,CACI,CACE,CACjB,CAAC;AACJ,CAAC;AAED,kBAAe,eAAK,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ContextValue = {
|
|
3
|
+
registerPortal: (id: string, element: HTMLElement) => void;
|
|
4
|
+
unregisterPortal: (id: string) => void;
|
|
5
|
+
getPortalElement: (id: string) => HTMLElement | undefined;
|
|
6
|
+
isNodeWithinPortalDropdown: (node: Node, id: string) => boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const DropdownPortalRegistrationContext: React.Context<ContextValue>;
|
|
9
|
+
/**
|
|
10
|
+
* For consuming components a slimmer version of the context is returned, omitting `registerPortal`
|
|
11
|
+
* and `unregisterPortal` as those functions are only utilized by the `dropdown_popover` itself.
|
|
12
|
+
* `isNodeWithinPortalDropdown` is the preferred export, but `getPortalElement` is also provided
|
|
13
|
+
* if more complex logic is needed involving portal rendered dropdown content
|
|
14
|
+
*/
|
|
15
|
+
export declare const useActiveDropdownsContext: () => Pick<ContextValue, 'getPortalElement' | 'isNodeWithinPortalDropdown'>;
|
|
16
|
+
/**
|
|
17
|
+
* This context allows `DropdownContainer` components to opt into registering a reference to their
|
|
18
|
+
* rendered DOM content when the dropdown opens. To enable a `DropdownContainer` to opt into this context behavior,
|
|
19
|
+
* a `dropdownId` must be passed to the `DropdownContainer`.
|
|
20
|
+
*
|
|
21
|
+
* This context is `ref` based to reduce re-renders of consuming components and because ref data is a good match for
|
|
22
|
+
* tracking DOM references. This does mean that accessing data in this context should be done only at the time it is needed,
|
|
23
|
+
* such as in a click outside event handler. `isNodeWithinPortalDropdown` is the preferred export from this context
|
|
24
|
+
* for usage within standard components.
|
|
25
|
+
*/
|
|
26
|
+
declare function DropdownPortalRegistrationContextProvider({ children }: {
|
|
27
|
+
children: React.ReactNode | React.ReactNode[];
|
|
28
|
+
}): React.JSX.Element;
|
|
29
|
+
export default DropdownPortalRegistrationContextProvider;
|