@deskpro/deskpro-ui 0.1.15 → 0.1.16
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 +11 -8
- package/dist/cjs/components/AttachmentTag/AttachmentTag.d.ts.map +1 -1
- package/dist/cjs/components/AttachmentTag/AttachmentTag.js +1 -3
- package/dist/cjs/components/Avatar/Avatar.d.ts.map +1 -1
- package/dist/cjs/components/Avatar/Avatar.js +5 -11
- package/dist/cjs/components/Avatar/AvatarGroup.d.ts +1 -1
- package/dist/cjs/components/Avatar/AvatarGroup.d.ts.map +1 -1
- package/dist/cjs/components/Button/Button.d.ts +17 -9
- package/dist/cjs/components/Button/Button.d.ts.map +1 -1
- package/dist/cjs/components/Button/Button.js +93 -27
- package/dist/cjs/components/Button/styles.d.ts +6 -5
- package/dist/cjs/components/Button/styles.d.ts.map +1 -1
- package/dist/cjs/components/Button/styles.js +57 -37
- package/dist/cjs/components/Button/types.d.ts +19 -9
- package/dist/cjs/components/Button/types.d.ts.map +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/cjs/components/Checkbox/Checkbox.js +1 -3
- package/dist/cjs/components/ColorInput/ColorInput.d.ts.map +1 -1
- package/dist/cjs/components/ColorInput/ColorInput.js +4 -8
- package/dist/cjs/components/DatePicker/index.d.ts +1 -1
- package/dist/cjs/components/DatePicker/index.d.ts.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.d.ts +1 -1
- package/dist/cjs/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/cjs/components/Dialog/Dialog.js +1 -0
- package/dist/cjs/components/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/cjs/components/Dropdown/Dropdown.js +5 -11
- package/dist/cjs/components/Dropdown/types.d.ts.map +1 -1
- package/dist/cjs/components/Icon/DeskproCustomIcon.d.ts +5 -4
- package/dist/cjs/components/Icon/DeskproCustomIcon.d.ts.map +1 -1
- package/dist/cjs/components/Icon/DeskproCustomIcon.js +2 -2
- package/dist/cjs/components/Icon/HeroIcon.d.ts +2 -2
- package/dist/cjs/components/Icon/HeroIcon.d.ts.map +1 -1
- package/dist/cjs/components/Icon/Icon.d.ts.map +1 -1
- package/dist/cjs/components/Icon/Icon.js +8 -16
- package/dist/cjs/components/Infinite/Infinite.d.ts.map +1 -1
- package/dist/cjs/components/Infinite/Infinite.js +5 -10
- package/dist/cjs/components/Infinite/InfiniteTopBottom.d.ts.map +1 -1
- package/dist/cjs/components/Infinite/InfiniteTopBottom.js +4 -8
- package/dist/cjs/components/IntlPhoneInput/IntlPhoneInput.d.ts +1 -1
- package/dist/cjs/components/IntlPhoneInput/IntlPhoneInput.d.ts.map +1 -1
- package/dist/cjs/components/IntlPhoneInput/IntlPhoneInput.js +2 -6
- package/dist/cjs/components/LabelTag/Tag.d.ts +1 -1
- package/dist/cjs/components/LabelTag/Tag.d.ts.map +1 -1
- package/dist/cjs/components/LabelTag/Tag.js +7 -6
- package/dist/cjs/components/Menu/Menu.d.ts +8 -16
- package/dist/cjs/components/Menu/Menu.d.ts.map +1 -1
- package/dist/cjs/components/Menu/Menu.js +2 -2
- package/dist/cjs/components/Modal/Modal.d.ts +1 -1
- package/dist/cjs/components/Modal/Modal.d.ts.map +1 -1
- package/dist/cjs/components/Modal/Modal.js +3 -9
- package/dist/cjs/components/OptionTag/OptionTag.d.ts.map +1 -1
- package/dist/cjs/components/OptionTag/OptionTag.js +1 -1
- package/dist/cjs/components/Pagination/Pagination.d.ts.map +1 -1
- package/dist/cjs/components/Pagination/Pagination.js +3 -4
- package/dist/cjs/components/Select/Select.d.ts.map +1 -1
- package/dist/cjs/components/Select/Select.js +5 -11
- package/dist/cjs/components/TabbedSection/Tabs.d.ts.map +1 -1
- package/dist/cjs/components/TabbedSection/Tabs.js +2 -2
- package/dist/cjs/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/cjs/components/Toggle/Toggle.d.ts.map +1 -1
- package/dist/cjs/components/Toggle/Toggle.js +4 -16
- package/dist/cjs/components/Tooltip/Tooltip.d.ts +3 -1
- package/dist/cjs/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/cjs/components/Tooltip/Tooltip.js +21 -2
- package/dist/cjs/nav/NavSidebar/NavSidebar.d.ts +1 -1
- package/dist/cjs/nav/NavSidebar/NavSidebar.d.ts.map +1 -1
- package/dist/cjs/nav/NavSidebar/NavSidebar.js +2 -6
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/components/AttachmentTag/AttachmentTag.js +1 -3
- package/dist/esm/components/Avatar/Avatar.js +5 -11
- package/dist/esm/components/Button/Button.js +92 -27
- package/dist/esm/components/Button/styles.js +56 -36
- package/dist/esm/components/Checkbox/Checkbox.js +1 -3
- package/dist/esm/components/ColorInput/ColorInput.js +4 -8
- package/dist/esm/components/DatePicker/index.js +1 -1
- package/dist/esm/components/Dialog/Dialog.js +1 -0
- package/dist/esm/components/Dropdown/Dropdown.js +6 -12
- package/dist/esm/components/Icon/DeskproCustomIcon.js +3 -3
- package/dist/esm/components/Icon/Icon.js +8 -16
- package/dist/esm/components/Infinite/Infinite.js +6 -11
- package/dist/esm/components/Infinite/InfiniteTopBottom.js +5 -9
- package/dist/esm/components/IntlPhoneInput/IntlPhoneInput.js +3 -7
- package/dist/esm/components/LabelTag/Tag.js +7 -6
- package/dist/esm/components/Menu/Menu.js +3 -3
- package/dist/esm/components/Modal/Modal.js +3 -9
- package/dist/esm/components/OptionTag/OptionTag.js +1 -1
- package/dist/esm/components/Pagination/Pagination.js +4 -5
- package/dist/esm/components/Select/Select.js +5 -11
- package/dist/esm/components/TabbedSection/Tabs.js +2 -2
- package/dist/esm/components/Toggle/Toggle.js +4 -16
- package/dist/esm/components/Tooltip/Tooltip.js +23 -4
- package/dist/esm/nav/NavSidebar/NavSidebar.js +2 -6
- package/package.json +19 -11
- package/.idea/.gitignore +0 -8
- package/.idea/deskpro-ui.iml +0 -8
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
|
@@ -2,7 +2,7 @@ import { __assign, __makeTemplateObject, __read, __spreadArray } from "tslib";
|
|
|
2
2
|
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
3
3
|
import { usePopper } from "react-popper";
|
|
4
4
|
import * as S from "./styles";
|
|
5
|
-
import { faCaretRight, faSearch, faTimes
|
|
5
|
+
import { faCaretRight, faSearch, faTimes } from "@fortawesome/free-solid-svg-icons";
|
|
6
6
|
import { mergeRefs } from "./utility";
|
|
7
7
|
import { Infinite } from "../Infinite";
|
|
8
8
|
import { Input } from "../Input";
|
|
@@ -20,7 +20,7 @@ export function dropdownRenderOptions(handleSelectOption, activeItem, activeSubI
|
|
|
20
20
|
case "value":
|
|
21
21
|
return (React.createElement(DropdownItem, { active: (activeItem === null || activeItem === void 0 ? void 0 : activeItem.key) === opt.key, onSelect: handleSelectOption, onSelectIcon: opt.onClickIcon, onClickSubItem: opt.onClickSubItem, key: opt.key, value: opt, meta: { active: false, input: "" }, activeSubItem: activeSubItem, setActiveSubItem: setActiveSubItem, hideIcons: hideIcons, iconColumnWidth: iconColumnWidth, fetchMoreText: fetchMoreText, autoscrollText: autoscrollText, selectedIcon: selectedIcon, externalLinkIcon: externalLinkIcon }));
|
|
22
22
|
case "header":
|
|
23
|
-
return
|
|
23
|
+
return React.createElement(S.DropdownHeaderItem, { key: "header".concat(index) }, opt.label);
|
|
24
24
|
case "divider":
|
|
25
25
|
return React.createElement(S.DropdownDividerItem, { key: "divider".concat(index) });
|
|
26
26
|
default:
|
|
@@ -85,7 +85,6 @@ var minimumDropdownWidth = 236;
|
|
|
85
85
|
* }
|
|
86
86
|
* </Dropdown>
|
|
87
87
|
*/
|
|
88
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
89
88
|
export function Dropdown(_a) {
|
|
90
89
|
var children = _a.children, options = _a.options, stickyHeaderOptions = _a.stickyHeaderOptions, stickyFooterOptions = _a.stickyFooterOptions, inputValue = _a.inputValue, searchPlaceholder = _a.searchPlaceholder, _b = _a.placement, placement = _b === void 0 ? "bottom-start" : _b, _c = _a.showInternalSearch, showInternalSearch = _c === void 0 ? false : _c, _d = _a.isLoading, isLoading = _d === void 0 ? false : _d, _e = _a.usePortal, usePortal = _e === void 0 ? true : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? true : _f, isOpenProp = _a.isOpen, renderCreateNewOption = _a.renderCreateNewOption, hideIcons = _a.hideIcons, iconColumnWidth = _a.iconColumnWidth, containerWidth = _a.containerWidth, onSelectOption = _a.onSelectOption, onInputChange = _a.onInputChange, onFetchMore = _a.onFetchMore, onClear = _a.onClear, onClose = _a.onClose, onOpen = _a.onOpen, optionsRenderer = _a.optionsRenderer, tabProps = _a.tabProps, disabled = _a.disabled, fetchMoreText = _a.fetchMoreText, autoscrollText = _a.autoscrollText, externalLinkIcon = _a.externalLinkIcon, selectedIcon = _a.selectedIcon;
|
|
91
90
|
var _g = __read(useState(false), 2), isOpenState = _g[0], setIsOpenState = _g[1];
|
|
@@ -114,7 +113,7 @@ export function Dropdown(_a) {
|
|
|
114
113
|
close();
|
|
115
114
|
};
|
|
116
115
|
function isHtmlNode(node) {
|
|
117
|
-
return
|
|
116
|
+
return typeof node === "object" && notEmpty(node) && node instanceof HTMLElement;
|
|
118
117
|
}
|
|
119
118
|
// Have to pass a fn to useCallback due to eslint bug in eslint-plugin-react-hooks
|
|
120
119
|
// which is fixed in 4.1.1 but we are tied to 1.6.1 in react-scripts
|
|
@@ -126,8 +125,7 @@ export function Dropdown(_a) {
|
|
|
126
125
|
function handler(event) {
|
|
127
126
|
var _a, _b, _c;
|
|
128
127
|
if (!(((_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) ||
|
|
129
|
-
(isHtmlNode(targetRef.current) &&
|
|
130
|
-
targetRef.current.contains(event.target)) ||
|
|
128
|
+
(isHtmlNode(targetRef.current) && targetRef.current.contains(event.target)) ||
|
|
131
129
|
(isHtmlNode(inputSearchRef.current) &&
|
|
132
130
|
((_b = inputSearchRef.current.parentElement) === null || _b === void 0 ? void 0 : _b.contains(event.target))) ||
|
|
133
131
|
((_c = inputSearchRef.current) === null || _c === void 0 ? void 0 : _c.contains(event.target)))) {
|
|
@@ -223,14 +221,10 @@ export function Dropdown(_a) {
|
|
|
223
221
|
};
|
|
224
222
|
// Have to pass a fn to useCallback due to eslint bug in eslint-plugin-react-hooks
|
|
225
223
|
// which is fixed in 4.1.1 but we are tied to 1.6.1 in react-scripts
|
|
226
|
-
var handleSelectOption = useCallback(handleSelectOptionCb, [
|
|
227
|
-
handleClose,
|
|
228
|
-
onSelectOption,
|
|
229
|
-
]);
|
|
224
|
+
var handleSelectOption = useCallback(handleSelectOptionCb, [handleClose, onSelectOption]);
|
|
230
225
|
// width of input or set minimum width - 236px
|
|
231
226
|
var refWidth = useMemo(function () {
|
|
232
|
-
if ((referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.scrollWidth) &&
|
|
233
|
-
referenceElement.scrollWidth > minimumDropdownWidth) {
|
|
227
|
+
if ((referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.scrollWidth) && referenceElement.scrollWidth > minimumDropdownWidth) {
|
|
234
228
|
return referenceElement.scrollWidth;
|
|
235
229
|
}
|
|
236
230
|
else
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { __assign } from "tslib";
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import classNames from "classnames";
|
|
4
4
|
import { DP_CUSTOM_ICONS_CODEPOINTS } from "./customIconsCodegen";
|
|
5
5
|
import { dpNameProp } from "../../utils";
|
|
6
6
|
export var DeskproCustomIcon = function (_a) {
|
|
7
|
-
var icon = _a.icon, className = _a.className;
|
|
8
|
-
return (React.createElement("i", __assign({}, dpNameProp("DeskproCustomIcon"), { className: classNames("dp-custom-icon-".concat(icon), className), style: { lineHeight: 1, height: "auto" } })));
|
|
7
|
+
var icon = _a.icon, className = _a.className, rest = __rest(_a, ["icon", "className"]);
|
|
8
|
+
return (React.createElement("i", __assign({}, rest, dpNameProp("DeskproCustomIcon"), { className: classNames("dp-custom-icon-".concat(icon), className), style: { lineHeight: 1, height: "auto" } })));
|
|
9
9
|
};
|
|
10
10
|
export var isDpCustomIconId = function (icon) {
|
|
11
11
|
return typeof icon === "string" && Object.keys(DP_CUSTOM_ICONS_CODEPOINTS).includes(icon);
|
|
@@ -7,16 +7,10 @@ import { dpNameProp, notEmpty } from "../../utils";
|
|
|
7
7
|
import { DeskproCustomIcon, isDpCustomIconId } from "./DeskproCustomIcon";
|
|
8
8
|
import HeroIcon, { isHeroIcon } from "./HeroIcon";
|
|
9
9
|
export function isFaIcon(icon) {
|
|
10
|
-
return
|
|
11
|
-
notEmpty(icon) &&
|
|
12
|
-
"prefix" in icon &&
|
|
13
|
-
"iconName" in icon);
|
|
10
|
+
return typeof icon === "object" && notEmpty(icon) && "prefix" in icon && "iconName" in icon;
|
|
14
11
|
}
|
|
15
12
|
export function isAnyIcon(icon) {
|
|
16
|
-
return
|
|
17
|
-
isDpCustomIconId(icon) ||
|
|
18
|
-
isFaIcon(icon) ||
|
|
19
|
-
isHeroIcon(icon));
|
|
13
|
+
return isISO3166(icon) || isDpCustomIconId(icon) || isFaIcon(icon) || isHeroIcon(icon);
|
|
20
14
|
}
|
|
21
15
|
export function isIconProps(props) {
|
|
22
16
|
return (typeof props === "object" &&
|
|
@@ -37,23 +31,21 @@ export function isIconProps(props) {
|
|
|
37
31
|
export var Icon = styled(function Icon(_a) {
|
|
38
32
|
var icon = _a.icon, themeColor = _a.themeColor, size = _a.size, rest = __rest(_a, ["icon", "themeColor", "size"]);
|
|
39
33
|
if (isFaIcon(icon)) {
|
|
40
|
-
return React.createElement(FontAwesomeIcon, __assign({}, dpNameProp("FAIcon"), { icon: icon }, rest));
|
|
34
|
+
return (React.createElement(FontAwesomeIcon, __assign({ "data-testid": "fa-icon" }, dpNameProp("FAIcon"), { icon: icon }, rest)));
|
|
41
35
|
}
|
|
42
36
|
if (isISO3166(icon)) {
|
|
43
|
-
return React.createElement(FlagImg, __assign({ isoCode: icon }, rest));
|
|
37
|
+
return React.createElement(FlagImg, __assign({ "data-testid": "flag-icon", isoCode: icon }, rest));
|
|
44
38
|
}
|
|
45
39
|
if (isDpCustomIconId(icon)) {
|
|
46
|
-
return React.createElement(DeskproCustomIcon, __assign({ icon: icon }, rest));
|
|
40
|
+
return React.createElement(DeskproCustomIcon, __assign({ "data-testid": "custom-icon", icon: icon }, rest));
|
|
47
41
|
}
|
|
48
42
|
if (isHeroIcon(icon)) {
|
|
49
|
-
return React.createElement(HeroIcon, __assign({ icon: icon }, rest, { width: size }));
|
|
43
|
+
return React.createElement(HeroIcon, __assign({ "data-testid": "hero-icon", icon: icon }, rest, { width: size }));
|
|
50
44
|
}
|
|
51
|
-
return React.createElement(DeskproCustomIcon, __assign({ icon: "dot" }, rest));
|
|
45
|
+
return React.createElement(DeskproCustomIcon, __assign({ "data-testid": "custom-icon", icon: "dot" }, rest));
|
|
52
46
|
})(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n height: 1em;\n color: ", ";\n font-size: ", ";\n user-select: none;\n"], ["\n height: 1em;\n color: ", ";\n font-size: ", ";\n user-select: none;\n"])), function (props) {
|
|
53
47
|
var _a;
|
|
54
48
|
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
55
49
|
return (_a = props.theme.colors[props.themeColor]) !== null && _a !== void 0 ? _a : "inherit";
|
|
56
|
-
}, function (props) {
|
|
57
|
-
return typeof props.size === "number" ? "".concat(props.size, "px") : "inherit";
|
|
58
|
-
});
|
|
50
|
+
}, function (props) { return (typeof props.size === "number" ? "".concat(props.size, "px") : "inherit"); });
|
|
59
51
|
var templateObject_1;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __read } from "tslib";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { useDebouncedCallback } from "use-debounce";
|
|
5
5
|
import { Stack } from "../../layout";
|
|
6
6
|
import { ObservedDiv } from "./ObservedDiv";
|
|
@@ -48,15 +48,13 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
48
48
|
}
|
|
49
49
|
else if (typeof lastKnownScrollOffset.current === "number" && reverse) {
|
|
50
50
|
ref.current.scrollTo({
|
|
51
|
-
top: Math.abs(lastKnownScrollOffset.current -
|
|
52
|
-
(ref.current.scrollHeight - ref.current.clientHeight)),
|
|
51
|
+
top: Math.abs(lastKnownScrollOffset.current - (ref.current.scrollHeight - ref.current.clientHeight)),
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
var debouncedSetIsAttached = useDebouncedCallback(function () {
|
|
57
56
|
if (typeof lastKnownScrollOffset.current === "number" && ref.current) {
|
|
58
|
-
if (shouldAttachScroll.current !== isAttached &&
|
|
59
|
-
lastKnownScrollOffset.current > 300) {
|
|
57
|
+
if (shouldAttachScroll.current !== isAttached && lastKnownScrollOffset.current > 300) {
|
|
60
58
|
setIsAttached(shouldAttachScroll.current);
|
|
61
59
|
}
|
|
62
60
|
else if (shouldAttachScroll.current !== isAttached &&
|
|
@@ -69,15 +67,13 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
69
67
|
var handleScroll = useCallback(function () {
|
|
70
68
|
if (ref.current &&
|
|
71
69
|
!isAttached &&
|
|
72
|
-
ref.current.scrollTop + ref.current.offsetHeight >
|
|
73
|
-
ref.current.scrollHeight - 2) {
|
|
70
|
+
ref.current.scrollTop + ref.current.offsetHeight > ref.current.scrollHeight - 2) {
|
|
74
71
|
setIsAttached(true);
|
|
75
72
|
}
|
|
76
73
|
if (!ref.current)
|
|
77
74
|
return;
|
|
78
75
|
if (reverse) {
|
|
79
|
-
if (ref.current.scrollTop <
|
|
80
|
-
ref.current.scrollHeight - ref.current.clientHeight) {
|
|
76
|
+
if (ref.current.scrollTop < ref.current.scrollHeight - ref.current.clientHeight) {
|
|
81
77
|
shouldAttachScroll.current = false;
|
|
82
78
|
}
|
|
83
79
|
else {
|
|
@@ -93,8 +89,7 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
93
89
|
}
|
|
94
90
|
}
|
|
95
91
|
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect();
|
|
96
|
-
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop -
|
|
97
|
-
(ref.current.scrollHeight - ref.current.clientHeight));
|
|
92
|
+
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop - (ref.current.scrollHeight - ref.current.clientHeight));
|
|
98
93
|
debouncedSetIsAttached();
|
|
99
94
|
}, [debouncedSetIsAttached, reverse, scrollSideEffect, isAttached]);
|
|
100
95
|
var reAttach = useCallback(function () {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __assign, __read } from "tslib";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { useCallback, useEffect, useLayoutEffect, useRef, useState
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
4
4
|
import { useDebouncedCallback } from "use-debounce";
|
|
5
5
|
import { Stack } from "../../layout";
|
|
6
6
|
import { ObservedDiv } from "./ObservedDiv";
|
|
@@ -48,15 +48,13 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
48
48
|
}
|
|
49
49
|
else if (typeof lastKnownScrollOffset.current === "number" && reverse) {
|
|
50
50
|
ref.current.scrollTo({
|
|
51
|
-
top: Math.abs(lastKnownScrollOffset.current -
|
|
52
|
-
(ref.current.scrollHeight - ref.current.clientHeight)),
|
|
51
|
+
top: Math.abs(lastKnownScrollOffset.current - (ref.current.scrollHeight - ref.current.clientHeight)),
|
|
53
52
|
});
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
var debouncedSetIsAttached = useDebouncedCallback(function () {
|
|
57
56
|
if (typeof lastKnownScrollOffset.current === "number" && ref.current) {
|
|
58
|
-
if (shouldAttachScroll.current !== isAttached &&
|
|
59
|
-
lastKnownScrollOffset.current > 300) {
|
|
57
|
+
if (shouldAttachScroll.current !== isAttached && lastKnownScrollOffset.current > 300) {
|
|
60
58
|
setIsAttached(shouldAttachScroll.current);
|
|
61
59
|
}
|
|
62
60
|
}
|
|
@@ -66,8 +64,7 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
66
64
|
if (!ref.current)
|
|
67
65
|
return;
|
|
68
66
|
if (reverse) {
|
|
69
|
-
if (ref.current.scrollTop <
|
|
70
|
-
ref.current.scrollHeight - ref.current.clientHeight) {
|
|
67
|
+
if (ref.current.scrollTop < ref.current.scrollHeight - ref.current.clientHeight) {
|
|
71
68
|
shouldAttachScroll.current = false;
|
|
72
69
|
}
|
|
73
70
|
else {
|
|
@@ -83,8 +80,7 @@ function useScrollControl(children, reverse, anchor, scrollSideEffect) {
|
|
|
83
80
|
}
|
|
84
81
|
}
|
|
85
82
|
scrollSideEffect === null || scrollSideEffect === void 0 ? void 0 : scrollSideEffect();
|
|
86
|
-
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop -
|
|
87
|
-
(ref.current.scrollHeight - ref.current.clientHeight));
|
|
83
|
+
lastKnownScrollOffset.current = Math.abs(ref.current.scrollTop - (ref.current.scrollHeight - ref.current.clientHeight));
|
|
88
84
|
debouncedSetIsAttached();
|
|
89
85
|
}, [debouncedSetIsAttached, reverse, scrollSideEffect]);
|
|
90
86
|
var reAttach = useCallback(function () {
|
|
@@ -12,7 +12,7 @@ import { Icon } from "../Icon";
|
|
|
12
12
|
import { isISO3166 } from "../FlagImg";
|
|
13
13
|
import { Stack } from "../../layout";
|
|
14
14
|
import styled from "styled-components";
|
|
15
|
-
export { isValidPhoneNumber, getCountryCallingCode, parsePhoneNumber, formatPhoneNumberIntl
|
|
15
|
+
export { isValidPhoneNumber, getCountryCallingCode, parsePhoneNumber, formatPhoneNumberIntl };
|
|
16
16
|
var allOptions = __spreadArray([
|
|
17
17
|
{
|
|
18
18
|
type: "value",
|
|
@@ -45,9 +45,7 @@ var SelectComponent = function (_a) {
|
|
|
45
45
|
var onChange = _a.onChange, value = _a.value, fetchMoreText = _a.fetchMoreText, autoscrollText = _a.autoscrollText, externalLinkIcon = _a.externalLinkIcon, selectedIcon = _a.selectedIcon;
|
|
46
46
|
var _b = __read(useState(""), 2), searchString = _b[0], setSearchString = _b[1];
|
|
47
47
|
var options = useMemo(function () {
|
|
48
|
-
return searchString
|
|
49
|
-
? optionsFuse.search(searchString).map(function (options) { return options.item; })
|
|
50
|
-
: allOptions;
|
|
48
|
+
return searchString ? optionsFuse.search(searchString).map(function (options) { return options.item; }) : allOptions;
|
|
51
49
|
}, [searchString]);
|
|
52
50
|
var handleClose = useCallback(function () { return setSearchString(""); }, []);
|
|
53
51
|
return (React.createElement(Dropdown, { onClose: handleClose, inputValue: searchString, showInternalSearch: true, onInputChange: setSearchString, onSelectOption: function (_a) {
|
|
@@ -72,9 +70,7 @@ var container = function (_a) {
|
|
|
72
70
|
export function IntlPhoneInput(_a) {
|
|
73
71
|
var rightIcon = _a.rightIcon, variant = _a.variant, inputsize = _a.inputsize, error = _a.error, hasLabel = _a.hasLabel, defaultCountryCode = _a.defaultCountryCode, fetchMoreText = _a.fetchMoreText, autoscrollText = _a.autoscrollText, selectedIcon = _a.selectedIcon, externalLinkIcon = _a.externalLinkIcon, rest = __rest(_a, ["rightIcon", "variant", "inputsize", "error", "hasLabel", "defaultCountryCode", "fetchMoreText", "autoscrollText", "selectedIcon", "externalLinkIcon"]);
|
|
74
72
|
var SelectComponentWithText = useCallback(function (props) { return (React.createElement(SelectComponent, __assign({}, props, { fetchMoreText: fetchMoreText, autoscrollText: autoscrollText, selectedIcon: selectedIcon, externalLinkIcon: externalLinkIcon }))); }, [fetchMoreText, autoscrollText, selectedIcon, externalLinkIcon]);
|
|
75
|
-
return (React.createElement(ReactPhoneInput, __assign({ placeholder: rest.placeholder, containerComponent: container, inputComponent: Input, defaultCountry: defaultCountryCode && isISO3166(defaultCountryCode)
|
|
76
|
-
? defaultCountryCode
|
|
77
|
-
: "GB", countrySelectComponent: SelectComponentWithText, international: false, numberInputProps: {
|
|
73
|
+
return (React.createElement(ReactPhoneInput, __assign({ placeholder: rest.placeholder, containerComponent: container, inputComponent: Input, defaultCountry: defaultCountryCode && isISO3166(defaultCountryCode) ? defaultCountryCode : "GB", countrySelectComponent: SelectComponentWithText, international: false, numberInputProps: {
|
|
78
74
|
variant: variant,
|
|
79
75
|
rightIcon: rightIcon,
|
|
80
76
|
inputsize: inputsize,
|
|
@@ -13,7 +13,7 @@ var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplat
|
|
|
13
13
|
return (addMargin ? "2px 4px 2px 0" : "0");
|
|
14
14
|
}, function (props) { return props.backgroundColor; }, function (props) { return props.borderColor; }, function (_a) {
|
|
15
15
|
var theme = _a.theme, textColor = _a.textColor;
|
|
16
|
-
return textColor ? textColor : theme.colors.grey40;
|
|
16
|
+
return (textColor ? textColor : theme.colors.grey40);
|
|
17
17
|
}, function (_a) {
|
|
18
18
|
var maxWidth = _a.maxWidth;
|
|
19
19
|
return maxWidth;
|
|
@@ -23,10 +23,10 @@ var RoundedContainer = styled.div(templateObject_2 || (templateObject_2 = __make
|
|
|
23
23
|
return (addMargin ? "2px 4px 2px 0" : "0");
|
|
24
24
|
}, function (_a) {
|
|
25
25
|
var theme = _a.theme, textColor = _a.textColor;
|
|
26
|
-
return textColor ? textColor : theme.colors.grey40;
|
|
26
|
+
return (textColor ? textColor : theme.colors.grey40);
|
|
27
27
|
}, function (props) { return (props.size === "large" ? "28px" : "16px"); }, function (_a) {
|
|
28
28
|
var backgroundColor = _a.backgroundColor, borderColor = _a.borderColor;
|
|
29
|
-
return borderColor ? borderColor : backgroundColor;
|
|
29
|
+
return (borderColor ? borderColor : backgroundColor);
|
|
30
30
|
}, function (_a) {
|
|
31
31
|
var backgroundColor = _a.backgroundColor;
|
|
32
32
|
return backgroundColor;
|
|
@@ -54,7 +54,7 @@ var Text = styled(TSpan).attrs({ type: "p8" })(templateObject_5 || (templateObje
|
|
|
54
54
|
return (color ? color : theme.colors.grey100);
|
|
55
55
|
}, function (_a) {
|
|
56
56
|
var capitalize = _a.capitalize;
|
|
57
|
-
return capitalize ? "capitalize" : "initial";
|
|
57
|
+
return (capitalize ? "capitalize" : "initial");
|
|
58
58
|
}, function (_a) {
|
|
59
59
|
var size = _a.size;
|
|
60
60
|
return size === "large" && "12px";
|
|
@@ -80,7 +80,7 @@ export var Tag = function (_a) {
|
|
|
80
80
|
icon && (React.createElement(IconWrapper, null,
|
|
81
81
|
React.createElement(Icon, { icon: icon, size: size === "large" ? 12 : undefined }))),
|
|
82
82
|
React.createElement(Text, { size: size, capitalize: capitalize, color: color.textColor, ref: ref }, label),
|
|
83
|
-
withClose &&
|
|
83
|
+
withClose && React.createElement(CloseButton, { minimal: true, icon: closeIcon, onClick: onCloseClick }))); }, [
|
|
84
84
|
addMargin,
|
|
85
85
|
capitalize,
|
|
86
86
|
className,
|
|
@@ -93,8 +93,9 @@ export var Tag = function (_a) {
|
|
|
93
93
|
onCloseClick,
|
|
94
94
|
size,
|
|
95
95
|
withClose,
|
|
96
|
+
closeIcon,
|
|
96
97
|
]);
|
|
97
|
-
return isOverflowActive ?
|
|
98
|
+
return isOverflowActive ? React.createElement(Tooltip, { content: label }, TagComponent) : TagComponent;
|
|
98
99
|
};
|
|
99
100
|
export var RoundedLabelTag = function (_a) {
|
|
100
101
|
var label = _a.label, withClose = _a.withClose, onCloseClick = _a.onCloseClick, closeIcon = _a.closeIcon, capitalize = _a.capitalize, className = _a.className, addMargin = _a.addMargin, icon = _a.icon, size = _a.size, backgroundColor = _a.backgroundColor, borderColor = _a.borderColor, textColor = _a.textColor;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
|
-
import { Icon, isAnyIcon } from "../Icon";
|
|
4
|
+
import { Icon, isAnyIcon, isIconProps } from "../Icon";
|
|
5
5
|
import { TSpan } from "../Typography";
|
|
6
6
|
import { Popover } from "../Popover";
|
|
7
7
|
import { faCaretRight } from "@fortawesome/free-solid-svg-icons";
|
|
@@ -20,9 +20,9 @@ export var MenuItem = forwardRef(function MenuItem(_a, ref) {
|
|
|
20
20
|
var active = _a.active, children = _a.children, disabled = _a.disabled, icon = _a.icon, rightIcon = _a.rightIcon, label = _a.label, htmlTitle = _a.htmlTitle, iconColor = _a.iconColor, anchorProps = __rest(_a, ["active", "children", "disabled", "icon", "rightIcon", "label", "htmlTitle", "iconColor"]);
|
|
21
21
|
var colors = useTheme().colors;
|
|
22
22
|
var target = (React.createElement(S.MenuItem, __assign({}, dpNameProp("MenuItem"), { ref: ref, disabled: disabled }, anchorProps, { title: htmlTitle, role: "menuitem" }),
|
|
23
|
-
icon && (React.createElement(TSpan, { type: "p5", style: { color: iconColor || colors.grey20 } }, isAnyIcon(icon) ? React.createElement(Icon, { icon: icon }) : icon)),
|
|
23
|
+
icon && (React.createElement(TSpan, { type: "p5", style: { color: iconColor || colors.grey20 } }, isAnyIcon(icon) ? React.createElement(Icon, { icon: icon }) : isIconProps(icon) ? React.createElement(Icon, __assign({}, icon)) : icon)),
|
|
24
24
|
React.createElement(TSpan, { "$fill": true, overflow: "ellipsis", type: "p5" }, label),
|
|
25
|
-
rightIcon && (React.createElement(TSpan, { type: "p5" }, isAnyIcon(rightIcon) ? React.createElement(Icon, { icon: rightIcon }) : rightIcon)),
|
|
25
|
+
rightIcon && (React.createElement(TSpan, { type: "p5" }, isAnyIcon(rightIcon) ? (React.createElement(Icon, { icon: rightIcon })) : isIconProps(rightIcon) ? (React.createElement(Icon, __assign({}, rightIcon))) : (rightIcon))),
|
|
26
26
|
children && React.createElement(Icon, { icon: faCaretRight })));
|
|
27
27
|
if (!children) {
|
|
28
28
|
return React.createElement("li", { role: "none" }, target);
|
|
@@ -22,9 +22,7 @@ var ModalPositonContainer = styled.div(templateObject_1 || (templateObject_1 = _
|
|
|
22
22
|
});
|
|
23
23
|
var ModalOverlayContainer = styled(motion.div)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n"], ["\n display: flex;\n justify-content: center;\n align-items: center;\n min-height: 100%;\n width: 100%;\n pointer-events: none;\n position: relative;\n"])));
|
|
24
24
|
var ModalContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 8px;\n display: flex;\n flex-direction: column;\n padding-bottom: 10px;\n pointer-events: all;\n width: ", "; // Space for the close btn\n height: ", ";\n overflow: hidden;\n box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.15);\n z-index: 20;\n"], ["\n background-color: ", ";\n border-radius: 8px;\n display: flex;\n flex-direction: column;\n padding-bottom: 10px;\n pointer-events: all;\n width: ", "; // Space for the close btn\n height: ", ";\n overflow: hidden;\n box-shadow: 0px 8px 20px rgba(0, 0, 0, 0.15);\n z-index: 20;\n"])), function (props) { return props.theme.colors.white; }, function (props) {
|
|
25
|
-
return props.width
|
|
26
|
-
? props.width
|
|
27
|
-
: "calc(100vw - 80px)";
|
|
25
|
+
return props.width ? props.width : "calc(100vw - 80px)";
|
|
28
26
|
}, function (props) { return (props.height ? props.height : "90vh"); });
|
|
29
27
|
var ModalCloseContainer = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 0 38px;\n position: relative;\n"], ["\n padding: 0 38px;\n position: relative;\n"])));
|
|
30
28
|
export var ModalClose = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: absolute;\n right: 0;\n background-color: ", ";\n box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.05);\n padding: 10px;\n border-radius: 100%;\n width: 28px;\n height: 28px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 99999;\n\n button {\n color: ", ";\n }\n"], ["\n position: absolute;\n right: 0;\n background-color: ", ";\n box-shadow: 0px 5px 8px rgba(0, 0, 0, 0.05);\n padding: 10px;\n border-radius: 100%;\n width: 28px;\n height: 28px;\n box-sizing: border-box;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n z-index: 99999;\n\n button {\n color: ", ";\n }\n"])), function (_a) {
|
|
@@ -35,12 +33,8 @@ export var ModalClose = styled.div(templateObject_5 || (templateObject_5 = __mak
|
|
|
35
33
|
return theme.colors.brandShade100;
|
|
36
34
|
});
|
|
37
35
|
var ModalHeaderContainer = styled(Stack)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n height: 32px;\n padding: 0 12px;\n flex-shrink: 0;\n"], ["\n background-color: ", ";\n color: ", ";\n height: 32px;\n padding: 0 12px;\n flex-shrink: 0;\n"])), function (props) {
|
|
38
|
-
return props.backgroundColor
|
|
39
|
-
|
|
40
|
-
: props.theme.colors.grey5;
|
|
41
|
-
}, function (props) {
|
|
42
|
-
return props.color ? props.theme.colors[props.color] : props.theme.colors.grey100;
|
|
43
|
-
});
|
|
36
|
+
return props.backgroundColor ? props.theme.colors[props.backgroundColor] : props.theme.colors.grey5;
|
|
37
|
+
}, function (props) { return (props.color ? props.theme.colors[props.color] : props.theme.colors.grey100); });
|
|
44
38
|
export function Modal(_a) {
|
|
45
39
|
var isOpen = _a.isOpen, canClickOutsideClose = _a.canClickOutsideClose, canEscClose = _a.canEscClose, children = _a.children, hasBackdrop = _a.hasBackdrop, onRequestClose = _a.onRequestClose, closeIcon = _a.closeIcon, autofocus = _a.autofocus, height = _a.height, width = _a.width, hideClose = _a.hideClose, top = _a.top, bottom = _a.bottom, left = _a.left, right = _a.right;
|
|
46
40
|
return (React.createElement(Overlay, __assign({}, dpNameProp("Modal"), { hasBackdrop: hasBackdrop, isOpen: isOpen, onRequestClose: onRequestClose, canEscClose: canEscClose, canClickOutsideClose: canClickOutsideClose, autofocus: autofocus }),
|
|
@@ -18,6 +18,6 @@ export var OptionTag = function (_a) {
|
|
|
18
18
|
return (React.createElement(OptionTagContainer, __assign({}, dpNameProp("OptionTag"), rest),
|
|
19
19
|
icon && React.createElement(Icon, { icon: icon }),
|
|
20
20
|
React.createElement(P6, null, displayName),
|
|
21
|
-
withClose &&
|
|
21
|
+
withClose && React.createElement(IconButton, { minimal: true, icon: faTimes, onClick: onClose })));
|
|
22
22
|
};
|
|
23
23
|
var templateObject_1;
|
|
@@ -3,7 +3,7 @@ import * as React from "react";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import styled from "styled-components";
|
|
5
5
|
import { times } from "lodash";
|
|
6
|
-
import { faChevronLeft, faChevronRight
|
|
6
|
+
import { faChevronLeft, faChevronRight } from "@fortawesome/free-solid-svg-icons";
|
|
7
7
|
import { Stack, StackItem } from "../../layout/Stack";
|
|
8
8
|
import { Select } from "../Select";
|
|
9
9
|
import { IconButton } from "../Button";
|
|
@@ -48,17 +48,16 @@ export var Pagination = function (_a) {
|
|
|
48
48
|
var ofTotalString = ofTotalText.replace("{total}", displayTotal);
|
|
49
49
|
var uniqueItemsString = uniqueItemsText.replace("{unique}", String(uniqueItems));
|
|
50
50
|
return (React.createElement(Stack, __assign({}, dpNameProp("Pagination"), { align: "center" }),
|
|
51
|
-
displayItems.includes("perPageText") &&
|
|
51
|
+
displayItems.includes("perPageText") && React.createElement(P1Items, null, itemsPerPageText),
|
|
52
52
|
displayItems.includes("perPageSelect") && (React.createElement(PerPageItem, null,
|
|
53
53
|
React.createElement(Select, { options: perPageOptions, value: currentPerPageOption === null || currentPerPageOption === void 0 ? void 0 : currentPerPageOption.value, onChange: function (event) {
|
|
54
|
-
onPerPageChange &&
|
|
55
|
-
onPerPageChange(Number(event.target.value));
|
|
54
|
+
onPerPageChange && onPerPageChange(Number(event.target.value));
|
|
56
55
|
onPageChange(1);
|
|
57
56
|
} }))),
|
|
58
57
|
displayItems.includes("pageSelect") && (React.createElement(PageItem, null,
|
|
59
58
|
React.createElement(Select, { options: pageOptions, value: currentPageOption === null || currentPageOption === void 0 ? void 0 : currentPageOption.value, onChange: function (event) { return onPageChange(Number(event.target.value)); } }))),
|
|
60
59
|
displayItems.includes("total") && React.createElement(P1Total, null, ofTotalString),
|
|
61
|
-
displayItems.includes("uniqueItems") &&
|
|
60
|
+
displayItems.includes("uniqueItems") && React.createElement(P1Items, null, uniqueItemsString),
|
|
62
61
|
displayItems.includes("navArrows") && (React.createElement(React.Fragment, null,
|
|
63
62
|
React.createElement(ButtonLeftItem, null,
|
|
64
63
|
React.createElement(IconButton, { minimal: true, icon: faChevronLeft, onClick: function () { return onPageChange(currentPage - 1); }, disabled: currentPage === 1 })),
|
|
@@ -9,7 +9,7 @@ var StyledIcon = styled(Icon)(templateObject_1 || (templateObject_1 = __makeTemp
|
|
|
9
9
|
var theme = _a.theme;
|
|
10
10
|
return theme.colors.grey40;
|
|
11
11
|
});
|
|
12
|
-
var StyledSelect = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n display: ", ";\n position: relative;\n\n select {\n border-radius: 4px;\n border: 1px solid
|
|
12
|
+
var StyledSelect = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: ", ";\n display: ", ";\n position: relative;\n\n select {\n border-radius: 4px;\n border: 1px solid ", ";\n color: ", ";\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n cursor: pointer;\n font-size: 12px;\n justify-content: center;\n text-align: left;\n vertical-align: middle;\n -moz-appearance: none;\n -webkit-appearance: none;\n height: 30px;\n line-height: 25px;\n padding: 0 25px 0 10px;\n width: ", ";\n\n > * {\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n option {\n color: ", ";\n }\n\n &:hover {\n border-color: ", ";\n color: ", ";\n }\n\n &:focus {\n border-color: ", ";\n color: ", ";\n background-color: ", ";\n outline: none;\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n\n ", ";\n }\n\n // Control the dropdown icon color\n :hover {\n ", " {\n visibility: visible;\n color: ", ";\n }\n }\n &:focus-within {\n ", " {\n color: ", ";\n }\n }\n"], ["\n width: ", ";\n display: ", ";\n position: relative;\n\n select {\n border-radius: 4px;\n border: 1px solid ", ";\n color: ", ";\n display: inline-flex;\n flex-direction: row;\n align-items: center;\n cursor: pointer;\n font-size: 12px;\n justify-content: center;\n text-align: left;\n vertical-align: middle;\n -moz-appearance: none;\n -webkit-appearance: none;\n height: 30px;\n line-height: 25px;\n padding: 0 25px 0 10px;\n width: ", ";\n\n > * {\n flex-grow: 0;\n flex-shrink: 0;\n }\n\n option {\n color: ", ";\n }\n\n &:hover {\n border-color: ", ";\n color: ", ";\n }\n\n &:focus {\n border-color: ", ";\n color: ", ";\n background-color: ", ";\n outline: none;\n }\n\n &:disabled {\n border-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n\n ", ";\n }\n\n // Control the dropdown icon color\n :hover {\n ", " {\n visibility: visible;\n color: ", ";\n }\n }\n &:focus-within {\n ", " {\n color: ", ";\n }\n }\n"])), function (_a) {
|
|
13
13
|
var fillWidth = _a.fillWidth;
|
|
14
14
|
return (fillWidth ? "100%" : "fit-content");
|
|
15
15
|
}, function (_a) {
|
|
@@ -17,12 +17,10 @@ var StyledSelect = styled.div(templateObject_3 || (templateObject_3 = __makeTemp
|
|
|
17
17
|
return (fillWidth ? "block" : "inline-block");
|
|
18
18
|
}, function (_a) {
|
|
19
19
|
var theme = _a.theme, error = _a.error;
|
|
20
|
-
return error ? theme.colors.red100 : theme.colors.grey20;
|
|
20
|
+
return (error ? theme.colors.red100 : theme.colors.grey20);
|
|
21
21
|
}, function (_a) {
|
|
22
22
|
var theme = _a.theme, hasSelectedValue = _a.hasSelectedValue, hasPlaceholder = _a.hasPlaceholder;
|
|
23
|
-
return !hasPlaceholder || hasSelectedValue
|
|
24
|
-
? theme.colors.grey100
|
|
25
|
-
: theme.colors.grey80;
|
|
23
|
+
return !hasPlaceholder || hasSelectedValue ? theme.colors.grey100 : theme.colors.grey80;
|
|
26
24
|
}, function (_a) {
|
|
27
25
|
var fillWidth = _a.fillWidth;
|
|
28
26
|
return (fillWidth ? "100%" : "auto");
|
|
@@ -31,7 +29,7 @@ var StyledSelect = styled.div(templateObject_3 || (templateObject_3 = __makeTemp
|
|
|
31
29
|
return theme.colors.grey100;
|
|
32
30
|
}, function (_a) {
|
|
33
31
|
var theme = _a.theme, error = _a.error;
|
|
34
|
-
return error ? theme.colors.red100 : theme.colors.grey40;
|
|
32
|
+
return (error ? theme.colors.red100 : theme.colors.grey40);
|
|
35
33
|
}, function (_a) {
|
|
36
34
|
var theme = _a.theme;
|
|
37
35
|
return theme.colors.grey100;
|
|
@@ -55,11 +53,7 @@ var StyledSelect = styled.div(templateObject_3 || (templateObject_3 = __makeTemp
|
|
|
55
53
|
return theme.colors.grey5;
|
|
56
54
|
}, function (_a) {
|
|
57
55
|
var theme = _a.theme, inline = _a.inline, required = _a.required, error = _a.error;
|
|
58
|
-
return inline && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: none;\n border-radius: 0;\n border-bottom: 1px solid\n ", ";\n\n &:hover {\n border-bottom-color: ", ";\n }\n\n &:focus {\n border-bottom-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n }\n "], ["\n border: none;\n border-radius: 0;\n border-bottom: 1px solid\n ", ";\n\n &:hover {\n border-bottom-color: ", ";\n }\n\n &:focus {\n border-bottom-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n }\n "])), error
|
|
59
|
-
? theme.colors.red100
|
|
60
|
-
: required
|
|
61
|
-
? theme.colors.red20
|
|
62
|
-
: "transparent", required
|
|
56
|
+
return inline && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border: none;\n border-radius: 0;\n border-bottom: 1px solid\n ", ";\n\n &:hover {\n border-bottom-color: ", ";\n }\n\n &:focus {\n border-bottom-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n }\n "], ["\n border: none;\n border-radius: 0;\n border-bottom: 1px solid\n ", ";\n\n &:hover {\n border-bottom-color: ", ";\n }\n\n &:focus {\n border-bottom-color: ", ";\n color: ", ";\n background-color: ", ";\n }\n &:disabled {\n background-color: ", ";\n }\n "])), error ? theme.colors.red100 : required ? theme.colors.red20 : "transparent", required
|
|
63
57
|
? theme.colors.red20
|
|
64
58
|
: error
|
|
65
59
|
? theme.colors.red100
|
|
@@ -6,7 +6,7 @@ import { headingStyles } from "../Typography";
|
|
|
6
6
|
import { dpNameProp } from "../../utils";
|
|
7
7
|
export var TabWrapperCSS = css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), function (_a) {
|
|
8
8
|
var active = _a.active, isTicketHistory = _a.isTicketHistory;
|
|
9
|
-
return
|
|
9
|
+
return active && isTicketHistory ? headingStyles.h1 : headingStyles.h2;
|
|
10
10
|
});
|
|
11
11
|
var TabWrapper = styled(Stack)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n font-family: ", ";\n font-style: normal;\n font-weight: ", ";\n font-size: 11px;\n line-height: 110%;\n cursor: default;\n align-items: center;\n justify-content: center;\n pointer-events: ", ";\n color: ", ";\n border-bottom: ", ";\n padding: 0 3px 6px 3px;\n\n :hover {\n color: ", ";\n cursor: pointer;\n }\n\n ", ";\n\n ", ";\n"], ["\n font-family: ", ";\n font-style: normal;\n font-weight: ", ";\n font-size: 11px;\n line-height: 110%;\n cursor: default;\n align-items: center;\n justify-content: center;\n pointer-events: ", ";\n color: ", ";\n border-bottom: ", ";\n padding: 0 3px 6px 3px;\n\n :hover {\n color: ", ";\n cursor: pointer;\n }\n\n ", ";\n\n ", ";\n"])), function (_a) {
|
|
12
12
|
var theme = _a.theme;
|
|
@@ -27,7 +27,7 @@ var TabWrapper = styled(Stack)(templateObject_4 || (templateObject_4 = __makeTem
|
|
|
27
27
|
return props.active ? "solid 2px ".concat(props.theme.colors.brandPrimary) : "none";
|
|
28
28
|
}, function (props) { return props.theme.colors.grey100; }, function (_a) {
|
|
29
29
|
var active = _a.active, tabStyle = _a.tabStyle, theme = _a.theme;
|
|
30
|
-
return tabStyle === "button" && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-grow: 1;\n border: 1px solid ", ";\n border-bottom: solid 1px
|
|
30
|
+
return tabStyle === "button" && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n flex-grow: 1;\n border: 1px solid ", ";\n border-bottom: solid 1px ", ";\n border-right-width: 0;\n\n :first-of-type {\n border-left-width: 0;\n }\n\n padding: 7px;\n\n ", ";\n "], ["\n flex-grow: 1;\n border: 1px solid ", ";\n border-bottom: solid 1px ", ";\n border-right-width: 0;\n\n :first-of-type {\n border-left-width: 0;\n }\n\n padding: 7px;\n\n ", ";\n "])), theme.colors.grey20, active ? theme.colors.brandPrimary : theme.colors.grey20, active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n "], ["\n background-color: ", ";\n "])), theme.colors.brandShade20));
|
|
31
31
|
}, TabWrapperCSS);
|
|
32
32
|
var StyledTabBar = styled(Stack)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-bottom: ", ";\n width: 100%;\n padding: ", ";\n"], ["\n border-bottom: ", ";\n width: 100%;\n padding: ", ";\n"])), function (_a) {
|
|
33
33
|
var tabStyle = _a.tabStyle, theme = _a.theme;
|
|
@@ -7,9 +7,7 @@ import { P5, TSpan } from "../Typography";
|
|
|
7
7
|
import { getSVGURI } from "../../utils/getSVGURI";
|
|
8
8
|
import { dpNameProp } from "../../utils";
|
|
9
9
|
var SliderStyled = styled.span(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: absolute;\n cursor: ", ";\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: ", ";\n\n transition: 0.4s;\n border-radius: 34px;\n &::before {\n position: absolute;\n content: \"\";\n background-image: ", ";\n background-size: ", "px;\n height: ", "px;\n background-repeat: no-repeat;\n background-position: center;\n stroke: ", ";\n height: ", "px;\n width: ", "px;\n left: ", "px;\n bottom: ", "px;\n background-color: white;\n transition: 0.2s;\n border-radius: 50%;\n }\n"], ["\n position: absolute;\n cursor: ", ";\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background-color: ", ";\n\n transition: 0.4s;\n border-radius: 34px;\n &::before {\n position: absolute;\n content: \"\";\n background-image: ", ";\n background-size: ", "px;\n height: ", "px;\n background-repeat: no-repeat;\n background-position: center;\n stroke: ", ";\n height: ", "px;\n width: ", "px;\n left: ", "px;\n bottom: ", "px;\n background-color: white;\n transition: 0.2s;\n border-radius: 50%;\n }\n"])), function (props) { return (props.isLocked ? "not-allowed" : "pointer"); }, function (props) {
|
|
10
|
-
return props.indeterminate
|
|
11
|
-
? props.theme.colors.yellow80
|
|
12
|
-
: props.theme.colors.grey20;
|
|
10
|
+
return props.indeterminate ? props.theme.colors.yellow80 : props.theme.colors.grey20;
|
|
13
11
|
}, function (props) {
|
|
14
12
|
return typeof props.isLocked === "boolean"
|
|
15
13
|
? props.isLocked
|
|
@@ -18,20 +16,10 @@ var SliderStyled = styled.span(templateObject_1 || (templateObject_1 = __makeTem
|
|
|
18
16
|
: "none";
|
|
19
17
|
}, function (props) { return (props.size === "small" ? 5 : 6); }, function (props) { return (props.size === "small" ? 6 : 8); }, function (props) { return props.theme.colors.white; }, function (props) { return (props.size === "small" ? 8 : 12); }, function (props) { return (props.size === "small" ? 8 : 12); }, function (props) { return (props.size === "small" ? 2 : 3); }, function (props) { return (props.size === "small" ? 2 : 3); });
|
|
20
18
|
var InputStyled = styled.input.attrs({ type: "checkbox" })(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n opacity: 0;\n width: 0;\n height: 0;\n display: block;\n"], ["\n opacity: 0;\n width: 0;\n height: 0;\n display: block;\n"])));
|
|
21
|
-
var ToggleContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n display: inline-block;\n width: ", "px;\n height: ", "px;\n\n input:checked + span {\n background-color: ", ";\n }\n input:focus + span {\n box-shadow: 0 0 1px
|
|
22
|
-
return props.indeterminate ? "" : props.
|
|
23
|
-
}, function (props) { return (props.indeterminate ? "" : props.theme.colors.turquoise100); }, function (props) {
|
|
24
|
-
return props.indeterminate
|
|
25
|
-
? ""
|
|
26
|
-
: props.size === "small"
|
|
27
|
-
? "translateX(6px)"
|
|
28
|
-
: "translateX(9px)";
|
|
19
|
+
var ToggleContainer = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n position: relative;\n display: inline-block;\n width: ", "px;\n height: ", "px;\n\n input:checked + span {\n background-color: ", ";\n }\n input:focus + span {\n box-shadow: 0 0 1px ", ";\n }\n input:checked + span:before {\n transform: ", ";\n }\n input + span:before {\n transform: ", ";\n }\n span:hover {\n ", "\n ", "\n }\n"], ["\n position: relative;\n display: inline-block;\n width: ", "px;\n height: ", "px;\n\n input:checked + span {\n background-color: ", ";\n }\n input:focus + span {\n box-shadow: 0 0 1px ", ";\n }\n input:checked + span:before {\n transform: ", ";\n }\n input + span:before {\n transform: ", ";\n }\n span:hover {\n ", "\n ", "\n }\n"])), function (props) { return (props.size === "small" ? 18 : 27); }, function (props) { return (props.size === "small" ? 12 : 18); }, function (props) { return (props.indeterminate ? "" : props.theme.colors.turquoise100); }, function (props) { return (props.indeterminate ? "" : props.theme.colors.turquoise100); }, function (props) {
|
|
20
|
+
return props.indeterminate ? "" : props.size === "small" ? "translateX(6px)" : "translateX(9px)";
|
|
29
21
|
}, function (props) {
|
|
30
|
-
return props.indeterminate
|
|
31
|
-
? props.size === "small"
|
|
32
|
-
? "translateX(3px)"
|
|
33
|
-
: "translateX(4px)"
|
|
34
|
-
: "";
|
|
22
|
+
return props.indeterminate ? (props.size === "small" ? "translateX(3px)" : "translateX(4px)") : "";
|
|
35
23
|
}, function (_a) {
|
|
36
24
|
var disabled = _a.disabled;
|
|
37
25
|
return disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: not-allowed;\n "], ["\n cursor: not-allowed;\n "])));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { __assign, __makeTemplateObject, __rest } from "tslib";
|
|
1
|
+
import { __assign, __makeTemplateObject, __read, __rest, __spreadArray } from "tslib";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import styled, { css
|
|
3
|
+
import styled, { css } from "styled-components";
|
|
4
4
|
import Tippy from "@tippyjs/react";
|
|
5
5
|
import { Stack } from "../../layout";
|
|
6
6
|
import { faQuestionCircle } from "@fortawesome/free-solid-svg-icons";
|
|
@@ -44,8 +44,27 @@ var getStyle = function (styleType, theme) {
|
|
|
44
44
|
return styles[styleType] || styles.dark;
|
|
45
45
|
};
|
|
46
46
|
export var Tooltip = styled(function (_a) {
|
|
47
|
-
var suppressClassNameWarning = _a.suppressClassNameWarning, styleType = _a.styleType, _b = _a.arrow, arrow = _b === void 0 ? false : _b, width = _a.width, offsetTop = _a.offsetTop, styledCss = _a.styledCss, customComponent = _a.customComponent, arrowColor = _a.arrowColor, offsetLeft = _a.offsetLeft, borderRadius = _a.borderRadius, props = __rest(_a, ["suppressClassNameWarning", "styleType", "arrow", "width", "offsetTop", "styledCss", "customComponent", "arrowColor", "offsetLeft", "borderRadius"]);
|
|
48
|
-
|
|
47
|
+
var suppressClassNameWarning = _a.suppressClassNameWarning, styleType = _a.styleType, _b = _a.arrow, arrow = _b === void 0 ? false : _b, width = _a.width, offsetTop = _a.offsetTop, styledCss = _a.styledCss, customComponent = _a.customComponent, arrowColor = _a.arrowColor, offsetLeft = _a.offsetLeft, borderRadius = _a.borderRadius, onPresEsc = _a.onPresEsc, props = __rest(_a, ["suppressClassNameWarning", "styleType", "arrow", "width", "offsetTop", "styledCss", "customComponent", "arrowColor", "offsetLeft", "borderRadius", "onPresEsc"]);
|
|
48
|
+
var escPlugIn = {
|
|
49
|
+
name: "hideOnEsc",
|
|
50
|
+
defaultValue: true,
|
|
51
|
+
fn: function () {
|
|
52
|
+
function onKeyDown(event) {
|
|
53
|
+
if (event.keyCode === 27 && onPresEsc) {
|
|
54
|
+
onPresEsc();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
onShow: function () {
|
|
59
|
+
document.addEventListener("keydown", onKeyDown);
|
|
60
|
+
},
|
|
61
|
+
onHide: function () {
|
|
62
|
+
document.removeEventListener("keydown", onKeyDown);
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
return React.createElement(Tippy, __assign({ arrow: arrow }, props, { plugins: __spreadArray([], __read((onPresEsc ? [escPlugIn] : [])), false) }));
|
|
49
68
|
}).attrs({
|
|
50
69
|
suppressClassNameWarning: true,
|
|
51
70
|
})(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n &.tippy-box {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n border: ", ";\n border-radius: ", "px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 11px;\n line-height: 150%;\n max-width: ", " !important;\n word-break: break-word;\n width: ", ";\n ", ";\n ", ";\n }\n ", "\n ", "\n ", "\n"], ["\n &.tippy-box {\n background-color: ", ";\n color: ", ";\n box-shadow: ", ";\n border: ", ";\n border-radius: ", "px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 11px;\n line-height: 150%;\n max-width: ", " !important;\n word-break: break-word;\n width: ", ";\n ", ";\n ", ";\n }\n ", "\n ", "\n ", "\n"])), function (_a) {
|
|
@@ -12,12 +12,8 @@ var Title = function (props) { return (React.createElement(TitleWrap, { hasIcon:
|
|
|
12
12
|
React.createElement(IconWrap, null, props.icon),
|
|
13
13
|
React.createElement("h1", null, props.label)))); };
|
|
14
14
|
var ItemWrap = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n a,\n span {\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: ", ";\n font-size: 12px;\n line-height: 150%;\n cursor: pointer;\n padding: 3px 0;\n padding-left: 36px;\n cursor: pointer;\n color: ", ";\n text-decoration: none;\n font-weight: ", ";\n background-color: ", ";\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n > svg {\n font-size: 14px;\n margin-right: 4px;\n color: ", ";\n }\n }\n"], ["\n a,\n span {\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: ", ";\n font-size: 12px;\n line-height: 150%;\n cursor: pointer;\n padding: 3px 0;\n padding-left: 36px;\n cursor: pointer;\n color: ", ";\n text-decoration: none;\n font-weight: ", ";\n background-color: ", ";\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n > svg {\n font-size: 14px;\n margin-right: 4px;\n color: ", ";\n }\n }\n"])), function (props) { return (props.hasIcon ? "center" : "start"); }, function (props) {
|
|
15
|
-
return props.isSelected
|
|
16
|
-
|
|
17
|
-
: props.theme.colors.grey100;
|
|
18
|
-
}, function (props) { return (props.isSelected ? 500 : 400); }, function (props) {
|
|
19
|
-
return props.isSelected ? props.theme.colors.brandShade20 : "";
|
|
20
|
-
}, function (props) { return props.theme.colors.brandShade100; }, function (props) { return props.theme.colors.brandShade20; }, function (props) { return (props.iconColor ? props.iconColor : "inherit"); });
|
|
15
|
+
return props.isSelected ? props.theme.colors.brandShade100 : props.theme.colors.grey100;
|
|
16
|
+
}, function (props) { return (props.isSelected ? 500 : 400); }, function (props) { return (props.isSelected ? props.theme.colors.brandShade20 : ""); }, function (props) { return props.theme.colors.brandShade100; }, function (props) { return props.theme.colors.brandShade20; }, function (props) { return (props.iconColor ? props.iconColor : "inherit"); });
|
|
21
17
|
var Item = function (props) { return (React.createElement(ItemWrap, { hasIcon: props.icon ? true : false, iconColor: props.iconColor, isSelected: props.isSelected }, props.href ? (React.createElement("a", { href: props.href, onClick: props.onClick },
|
|
22
18
|
props.icon,
|
|
23
19
|
" ",
|