@deque/cauldron-react 6.6.1-canary.db04cb91 → 6.7.0-canary.0fa62fa5
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/cauldron.css +6 -0
- package/lib/components/ClickOutsideListener/index.d.ts +3 -19
- package/lib/components/Icon/types.d.ts +1 -1
- package/lib/images.js +37 -0
- package/lib/index.js +52 -69
- package/package.json +1 -1
package/lib/cauldron.css
CHANGED
|
@@ -4,23 +4,7 @@ export interface ClickOutsideListenerProps<T extends HTMLElement = HTMLElement>
|
|
|
4
4
|
onClickOutside: (e: MouseEvent | TouchEvent) => void;
|
|
5
5
|
mouseEvent?: 'mousedown' | 'click' | 'mouseup' | false;
|
|
6
6
|
touchEvent?: 'touchstart' | 'touchend' | false;
|
|
7
|
-
target?: T
|
|
8
|
-
}
|
|
9
|
-
export default class ClickOutsideListener extends React.Component<ClickOutsideListenerProps> {
|
|
10
|
-
static displayName: string;
|
|
11
|
-
static defaultProps: {
|
|
12
|
-
mouseEvent: string;
|
|
13
|
-
touchEvent: string;
|
|
14
|
-
};
|
|
15
|
-
private nodeRef;
|
|
16
|
-
handleEvent: (event: MouseEvent | TouchEvent) => void;
|
|
17
|
-
componentDidMount(): void;
|
|
18
|
-
componentDidUpdate(prevProps: ClickOutsideListenerProps): void;
|
|
19
|
-
componentWillUnmount(): void;
|
|
20
|
-
private attachEventListeners;
|
|
21
|
-
private removeEventListeners;
|
|
22
|
-
resolveRef: (node: HTMLElement) => void;
|
|
23
|
-
render(): React.FunctionComponentElement<{
|
|
24
|
-
ref: (node: HTMLElement) => void;
|
|
25
|
-
}> | null;
|
|
7
|
+
target?: T | React.RefObject<T> | React.MutableRefObject<T>;
|
|
26
8
|
}
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<ClickOutsideListenerProps<HTMLElement> & React.RefAttributes<HTMLElement>>;
|
|
10
|
+
export default _default;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* GENERATED CODE. DO NOT EDIT DIRECTLY!
|
|
3
3
|
*/
|
|
4
4
|
/** IconType represents each valid icon type. */
|
|
5
|
-
export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'step-back' | 'step-forward' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload';
|
|
5
|
+
export type IconType = 'add-user' | 'arrow-circle-up' | 'arrow-circle-down' | 'arrow-circle-left' | 'arrow-circle-right' | 'arrow-up' | 'arrow-down' | 'arrow-left' | 'arrow-right' | 'arrows-alt' | 'bolt' | 'caution' | 'check-circle' | 'check-shield' | 'check-solid' | 'check' | 'checkbox-checked' | 'checkbox-unchecked' | 'chevron-double-up' | 'chevron-double-down' | 'chevron-double-left' | 'chevron-double-right' | 'chevron-up' | 'chevron-down' | 'chevron-left' | 'chevron-right' | 'clipboard' | 'clock' | 'close' | 'code' | 'copy' | 'download' | 'dropper' | 'exchange' | 'export-solid' | 'external-link' | 'eye' | 'filter-solid' | 'filter' | 'flag' | 'gears' | 'github' | 'grid' | 'hamburger-menu' | 'hashtag' | 'highlight' | 'images' | 'info-circle-alt' | 'info-circle' | 'info-square' | 'kabob' | 'link' | 'linkedin' | 'list' | 'lock' | 'magnifying-glass' | 'menu' | 'minus' | 'new-releases' | 'new' | 'no' | 'pencil' | 'person-running' | 'play' | 'plus' | 'question-circle-alt' | 'question-circle' | 'radio-checked' | 'radio-unchecked' | 'recycle-square' | 'recycle' | 'resend' | 'robot' | 'run-again' | 'save' | 'share-nodes' | 'share' | 'sort-triangle' | 'sort' | 'star' | 'step-back' | 'step-forward' | 'sun' | 'table-sort-ascending' | 'table-sort-descending' | 'tag' | 'target' | 'trash' | 'triangle-up' | 'triangle-down' | 'triangle-left' | 'triangle-right' | 'twitter' | 'upload';
|
|
6
6
|
/** iconTypes holds each valid icon type. */
|
|
7
7
|
export declare const iconTypes: string[];
|
package/lib/images.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopNamespace(e) {
|
|
6
|
+
if (e && e.__esModule) return e;
|
|
7
|
+
var n = Object.create(null);
|
|
8
|
+
if (e) {
|
|
9
|
+
Object.keys(e).forEach(function (k) {
|
|
10
|
+
if (k !== 'default') {
|
|
11
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
12
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () { return e[k]; }
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
n["default"] = e;
|
|
20
|
+
return Object.freeze(n);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
24
|
+
|
|
25
|
+
var _path;
|
|
26
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
27
|
+
const SvgImages = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
viewBox: "0 0 576 512",
|
|
30
|
+
height: 24,
|
|
31
|
+
width: 24
|
|
32
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
33
|
+
d: "M160 32c-35.3 0-64 28.7-64 64v224c0 35.3 28.7 64 64 64h352c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H160zm236 106.7 96 144c4.9 7.4 5.4 16.8 1.2 24.6S480.9 320 472 320H200c-9.2 0-17.6-5.3-21.6-13.6s-2.9-18.2 2.9-25.4l64-80c4.6-5.7 11.4-9 18.7-9s14.2 3.3 18.7 9l17.3 21.6 56-84c4.5-6.6 12-10.6 20-10.6s15.5 4 20 10.7zM192 128a32 32 0 1 1 64 0 32 32 0 1 1-64 0zm-144-8c0-13.3-10.7-24-24-24S0 106.7 0 120v224c0 75.1 60.9 136 136 136h320c13.3 0 24-10.7 24-24s-10.7-24-24-24H136c-48.6 0-88-39.4-88-88V120z",
|
|
34
|
+
fill: "currentColor"
|
|
35
|
+
})));
|
|
36
|
+
|
|
37
|
+
exports["default"] = SvgImages;
|
package/lib/index.js
CHANGED
|
@@ -149,6 +149,7 @@ var iconTypes = [
|
|
|
149
149
|
'hamburger-menu',
|
|
150
150
|
'hashtag',
|
|
151
151
|
'highlight',
|
|
152
|
+
'images',
|
|
152
153
|
'info-circle-alt',
|
|
153
154
|
'info-circle',
|
|
154
155
|
'info-square',
|
|
@@ -234,6 +235,7 @@ function __variableDynamicImportRuntime0__(path) {
|
|
|
234
235
|
case './icons/hamburger-menu.svg': return Promise.resolve().then(function () { return require('./hamburger-menu.js'); });
|
|
235
236
|
case './icons/hashtag.svg': return Promise.resolve().then(function () { return require('./hashtag.js'); });
|
|
236
237
|
case './icons/highlight.svg': return Promise.resolve().then(function () { return require('./highlight.js'); });
|
|
238
|
+
case './icons/images.svg': return Promise.resolve().then(function () { return require('./images.js'); });
|
|
237
239
|
case './icons/info-circle-alt.svg': return Promise.resolve().then(function () { return require('./info-circle-alt.js'); });
|
|
238
240
|
case './icons/info-circle.svg': return Promise.resolve().then(function () { return require('./info-circle.js'); });
|
|
239
241
|
case './icons/info-square.svg': return Promise.resolve().then(function () { return require('./info-square.js'); });
|
|
@@ -789,74 +791,55 @@ var OptionsMenuWrapper = function (_a) {
|
|
|
789
791
|
return (React__default["default"].createElement("div", tslib.__assign({ className: classNames__default["default"]('OptionsMenu', menuAlignment(align), className) }, other)));
|
|
790
792
|
};
|
|
791
793
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
if ((target && !target.contains(eventTarget)) ||
|
|
804
|
-
(nodeRef && !nodeRef.contains(eventTarget))) {
|
|
794
|
+
function ClickOutsideListener(_a, ref) {
|
|
795
|
+
var children = _a.children, _b = _a.mouseEvent, mouseEvent = _b === void 0 ? 'click' : _b, _c = _a.touchEvent, touchEvent = _c === void 0 ? 'touchend' : _c, target = _a.target, _d = _a.onClickOutside, onClickOutside = _d === void 0 ? function () { return null; } : _d;
|
|
796
|
+
var childElementRef = React.useRef();
|
|
797
|
+
var handleEvent = function (event) {
|
|
798
|
+
if (event.defaultPrevented) {
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
801
|
+
var eventTarget = event.target;
|
|
802
|
+
if (target && (target instanceof HTMLElement || 'current' in target)) {
|
|
803
|
+
var elementTarget = target instanceof HTMLElement ? target : target.current;
|
|
804
|
+
if (!(elementTarget === null || elementTarget === void 0 ? void 0 : elementTarget.contains(eventTarget))) {
|
|
805
805
|
onClickOutside(event);
|
|
806
806
|
}
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
};
|
|
815
|
-
_this.removeEventListeners = function (mouseEvent, touchEvent) {
|
|
816
|
-
typeof mouseEvent === 'string' &&
|
|
817
|
-
document.removeEventListener(mouseEvent, _this.handleEvent);
|
|
818
|
-
typeof touchEvent === 'string' &&
|
|
819
|
-
document.removeEventListener(touchEvent, _this.handleEvent);
|
|
820
|
-
};
|
|
821
|
-
_this.resolveRef = function (node) {
|
|
822
|
-
_this.nodeRef = node;
|
|
823
|
-
// If child has its own ref, we want to update
|
|
824
|
-
// its ref with the newly cloned node
|
|
825
|
-
var ref = _this.props.children.ref;
|
|
826
|
-
setRef(ref, node);
|
|
827
|
-
};
|
|
828
|
-
return _this;
|
|
829
|
-
}
|
|
830
|
-
ClickOutsideListener.prototype.componentDidMount = function () {
|
|
831
|
-
this.attachEventListeners();
|
|
832
|
-
};
|
|
833
|
-
ClickOutsideListener.prototype.componentDidUpdate = function (prevProps) {
|
|
834
|
-
var _a = this.props, mouseEvent = _a.mouseEvent, touchEvent = _a.touchEvent;
|
|
835
|
-
if (prevProps.mouseEvent !== mouseEvent ||
|
|
836
|
-
prevProps.touchEvent !== touchEvent) {
|
|
837
|
-
this.removeEventListeners(prevProps.mouseEvent, prevProps.touchEvent);
|
|
838
|
-
this.attachEventListeners();
|
|
807
|
+
// If a target is passed in via a prop, we defer to utilizing that
|
|
808
|
+
// target instead of a child element target
|
|
809
|
+
return;
|
|
810
|
+
}
|
|
811
|
+
if (childElementRef.current &&
|
|
812
|
+
!childElementRef.current.contains(eventTarget)) {
|
|
813
|
+
onClickOutside(event);
|
|
839
814
|
}
|
|
840
815
|
};
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
this
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
: React__default["default"].cloneElement(props.children, {
|
|
850
|
-
ref: resolveRef
|
|
851
|
-
});
|
|
852
|
-
};
|
|
853
|
-
ClickOutsideListener.displayName = 'ClickOutsideListener';
|
|
854
|
-
ClickOutsideListener.defaultProps = {
|
|
855
|
-
mouseEvent: 'click',
|
|
856
|
-
touchEvent: 'touchend'
|
|
816
|
+
var resolveRef = function (node) {
|
|
817
|
+
childElementRef.current = node;
|
|
818
|
+
// Ref for this component should pass-through to the child node
|
|
819
|
+
setRef(ref, node);
|
|
820
|
+
// If child has its own ref, we want to update
|
|
821
|
+
// its ref with the newly cloned node
|
|
822
|
+
var childRef = children.ref;
|
|
823
|
+
setRef(childRef, node);
|
|
857
824
|
};
|
|
858
|
-
|
|
859
|
-
|
|
825
|
+
React.useEffect(function () {
|
|
826
|
+
typeof mouseEvent === 'string' &&
|
|
827
|
+
document.addEventListener(mouseEvent, handleEvent);
|
|
828
|
+
typeof touchEvent === 'string' &&
|
|
829
|
+
document.addEventListener(touchEvent, handleEvent);
|
|
830
|
+
return function () {
|
|
831
|
+
typeof mouseEvent === 'string' &&
|
|
832
|
+
document.removeEventListener(mouseEvent, handleEvent);
|
|
833
|
+
typeof touchEvent === 'string' &&
|
|
834
|
+
document.removeEventListener(touchEvent, handleEvent);
|
|
835
|
+
};
|
|
836
|
+
}, [mouseEvent, touchEvent]);
|
|
837
|
+
return !children
|
|
838
|
+
? null
|
|
839
|
+
: React__default["default"].cloneElement(children, { ref: resolveRef });
|
|
840
|
+
}
|
|
841
|
+
ClickOutsideListener.displayName = 'ClickOutsideListener';
|
|
842
|
+
var ClickOutsideListener$1 = React__default["default"].forwardRef(ClickOutsideListener);
|
|
860
843
|
|
|
861
844
|
var _a$2 = tslib.__read([38, 40, 9, 13, 32, 27], 6), up = _a$2[0], down$1 = _a$2[1], tab = _a$2[2], enter = _a$2[3], space = _a$2[4], esc = _a$2[5];
|
|
862
845
|
var OptionsMenuList = /** @class */ (function (_super) {
|
|
@@ -962,7 +945,7 @@ var OptionsMenuList = /** @class */ (function (_super) {
|
|
|
962
945
|
// Key event is being handled in componentDidMount
|
|
963
946
|
/* eslint-disable jsx-a11y/click-events-have-key-events */
|
|
964
947
|
/* eslint-disable jsx-a11y/role-supports-aria-props */
|
|
965
|
-
return (React__default["default"].createElement(ClickOutsideListener, { onClickOutside: this.handleClickOutside, mouseEvent: clickOutsideEventActive, touchEvent: clickOutsideEventActive },
|
|
948
|
+
return (React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: this.handleClickOutside, mouseEvent: clickOutsideEventActive, touchEvent: clickOutsideEventActive },
|
|
966
949
|
React__default["default"].createElement("ul", tslib.__assign({}, other, { className: classNames__default["default"]('OptionsMenu__list', className), "aria-expanded": show, role: "menu", onClick: handleClick, ref: function (el) {
|
|
967
950
|
_this.menuRef = el;
|
|
968
951
|
if (menuRef) {
|
|
@@ -1310,7 +1293,7 @@ var SideBar = /** @class */ (function (_super) {
|
|
|
1310
1293
|
var _b = this.props, children = _b.children, className = _b.className, show = _b.show; _b.onDismiss; var navProps = _b.navProps, other = tslib.__rest(_b, ["children", "className", "show", "onDismiss", "navProps"]);
|
|
1311
1294
|
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
|
|
1312
1295
|
return (React__default["default"].createElement(React.Fragment, null,
|
|
1313
|
-
React__default["default"].createElement(ClickOutsideListener, { onClickOutside: this.handleClickOutside },
|
|
1296
|
+
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: this.handleClickOutside },
|
|
1314
1297
|
React__default["default"].createElement("nav", tslib.__assign({}, navProps),
|
|
1315
1298
|
React__default["default"].createElement("ul", tslib.__assign({ className: classNames__default["default"]('SideBar', className, animateClass) }, other, { ref: this.navList, onKeyDown: this.onKeyDown }), children))),
|
|
1316
1299
|
React__default["default"].createElement(Scrim, { show: !wide && show })));
|
|
@@ -1449,7 +1432,7 @@ var Dialog = /** @class */ (function (_super) {
|
|
|
1449
1432
|
escapeDeactivates: false,
|
|
1450
1433
|
fallbackFocus: '.Dialog__heading'
|
|
1451
1434
|
} },
|
|
1452
|
-
React__default["default"].createElement(ClickOutsideListener, { onClickOutside: this.handleClickOutside },
|
|
1435
|
+
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: this.handleClickOutside },
|
|
1453
1436
|
React__default["default"].createElement("div", tslib.__assign({ role: "dialog", className: classNames__default["default"]('Dialog', className, {
|
|
1454
1437
|
'Dialog--show': show
|
|
1455
1438
|
}), ref: function (el) {
|
|
@@ -3326,7 +3309,7 @@ var TwoColumnPanel = React.forwardRef(function (_a, ref) {
|
|
|
3326
3309
|
allowOutsideClick: true,
|
|
3327
3310
|
fallbackFocus: columnLeftRef.current
|
|
3328
3311
|
}, containerElements: [columnLeftRef.current] }),
|
|
3329
|
-
React__default["default"].createElement(ClickOutsideListener, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
|
|
3312
|
+
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside, target: columnLeftRef.current }),
|
|
3330
3313
|
isCollapsed ? null : skipLink,
|
|
3331
3314
|
showPanel ? ColumnLeftComponent : null,
|
|
3332
3315
|
ColumnRightComponent)));
|
|
@@ -4143,7 +4126,7 @@ var Popover = React.forwardRef(function (_a, ref) {
|
|
|
4143
4126
|
allowOutsideClick: true,
|
|
4144
4127
|
fallbackFocus: '.Popover__borderLeft'
|
|
4145
4128
|
} },
|
|
4146
|
-
React__default["default"].createElement(ClickOutsideListener, { onClickOutside: handleClickOutside },
|
|
4129
|
+
React__default["default"].createElement(ClickOutsideListener$1, { onClickOutside: handleClickOutside },
|
|
4147
4130
|
React__default["default"].createElement("div", tslib.__assign({ id: id, className: classNames__default["default"]('Popover', "Popover--".concat(placement), className, {
|
|
4148
4131
|
'Popover--hidden': !show,
|
|
4149
4132
|
'Popover--prompt': variant === 'prompt'
|
|
@@ -4298,7 +4281,7 @@ exports.BreadcrumbItem = BreadcrumbItem;
|
|
|
4298
4281
|
exports.BreadcrumbLink = BreadcrumbLink;
|
|
4299
4282
|
exports.Button = Button;
|
|
4300
4283
|
exports.Checkbox = Checkbox;
|
|
4301
|
-
exports.ClickOutsideListener = ClickOutsideListener;
|
|
4284
|
+
exports.ClickOutsideListener = ClickOutsideListener$1;
|
|
4302
4285
|
exports.Code = Code;
|
|
4303
4286
|
exports.ColumnGroupHeader = ColumnGroupHeader;
|
|
4304
4287
|
exports.ColumnHeader = ColumnHeader;
|
package/package.json
CHANGED