genesys-react-components 0.2.4-no-jira-peer-deps.194 → 0.3.1-devengage-1574-implementing-code-fences-devengage-1574-implementing-code-fences.219
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 +24 -1
- package/build/codefence/CodeFence.d.ts +22 -0
- package/build/index.d.ts +2 -1
- package/build/index.js/index-a1accecb.js +29479 -0
- package/build/index.js/index-a1accecb.js.map +1 -0
- package/build/index.js/index.js +2232 -0
- package/build/index.js/index.js.map +1 -0
- package/package.json +6 -3
- package/src/alertblock/AlertBlock.scss +1 -1
- package/src/codefence/CodeFence.scss +103 -0
- package/src/codefence/CodeFence.tsx +68 -0
- package/src/copybutton/CopyButton.scss +1 -1
- package/src/dxaccordion/DxAccordion.scss +6 -3
- package/src/dxbutton/DxButton.scss +26 -23
- package/src/dxitemgroup/DxCheckbox.scss +22 -17
- package/src/dxitemgroup/dropdown.scss +11 -9
- package/src/dxitemgroup/multiselect.scss +12 -9
- package/src/dxlabel/DxLabel.scss +5 -3
- package/src/dxtabbedcontent/DxTabbedContent.scss +6 -4
- package/src/dxtextbox/DxTextbox.scss +15 -12
- package/src/dxtoggle/DxToggle.scss +15 -11
- package/src/index.ts +2 -0
- package/src/loadingplaceholder/LoadingPlaceholder.scss +3 -2
- package/src/loadingplaceholder/LoadingPlaceholder.tsx +94 -1
- package/src/theme/fonts/roboto-v29-latin-300.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-300.woff2 +0 -0
- package/src/theme/fonts/roboto-v29-latin-300italic.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-300italic.woff2 +0 -0
- package/src/theme/fonts/roboto-v29-latin-700.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-700.woff2 +0 -0
- package/src/theme/fonts/roboto-v29-latin-700italic.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-700italic.woff2 +0 -0
- package/src/theme/fonts/roboto-v29-latin-italic.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-italic.woff2 +0 -0
- package/src/theme/fonts/roboto-v29-latin-regular.woff +0 -0
- package/src/theme/fonts/roboto-v29-latin-regular.woff2 +0 -0
- package/src/theme/roboto.scss +65 -0
- package/src/theme/scrollbars.scss +49 -0
- package/src/theme/typography.scss +184 -0
- package/src/theme/variables.scss +413 -0
- package/build/index.js +0 -539
- package/build/index.js.map +0 -1
package/build/index.js
DELETED
|
@@ -1,539 +0,0 @@
|
|
|
1
|
-
import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
|
|
2
|
-
import React, { useState, useEffect, useRef } from 'react';
|
|
3
|
-
import { v4 } from 'uuid';
|
|
4
|
-
|
|
5
|
-
function styleInject(css, ref) {
|
|
6
|
-
if ( ref === void 0 ) ref = {};
|
|
7
|
-
var insertAt = ref.insertAt;
|
|
8
|
-
|
|
9
|
-
if (!css || typeof document === 'undefined') { return; }
|
|
10
|
-
|
|
11
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
12
|
-
var style = document.createElement('style');
|
|
13
|
-
style.type = 'text/css';
|
|
14
|
-
|
|
15
|
-
if (insertAt === 'top') {
|
|
16
|
-
if (head.firstChild) {
|
|
17
|
-
head.insertBefore(style, head.firstChild);
|
|
18
|
-
} else {
|
|
19
|
-
head.appendChild(style);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
head.appendChild(style);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
if (style.styleSheet) {
|
|
26
|
-
style.styleSheet.cssText = css;
|
|
27
|
-
} else {
|
|
28
|
-
style.appendChild(document.createTextNode(css));
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var css_248z$g = ".dx-accordion {\n margin: 0;\n}\n.dx-accordion .accordion-heading {\n border-width: 0 0 1px 0;\n border-style: solid;\n border-color: #bfd4e4;\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n line-height: 14px;\n color: #54565a;\n padding: 13px 20px;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n cursor: pointer;\n}\n.dx-accordion .accordion-heading .icon {\n line-height: 0;\n}\n.dx-accordion .accordion-heading__left {\n align-self: left;\n}\n.dx-accordion .accordion-content {\n padding: 13px 20px 20px 20px;\n border-bottom: 1px solid #bfd4e4;\n}\n.dx-accordion .accordion-content > *:first-child {\n margin-top: 0;\n}\n.dx-accordion .accordion-content > *:last-child {\n margin-bottom: 0;\n}";
|
|
33
|
-
styleInject(css_248z$g);
|
|
34
|
-
|
|
35
|
-
function DxAccordion(props) {
|
|
36
|
-
const [isOpen, setIsOpen] = useState(props.showOpen || false);
|
|
37
|
-
const [expandTrigger, setExpandTrigger] = useState(props.expandTrigger);
|
|
38
|
-
const [showOpenTrigger, setShowOpenTrigger] = useState(props.showOpenTrigger);
|
|
39
|
-
// This one forcibly opens the component
|
|
40
|
-
React.useEffect(() => {
|
|
41
|
-
if (props.expandTrigger !== expandTrigger) {
|
|
42
|
-
setIsOpen(true);
|
|
43
|
-
setExpandTrigger(props.expandTrigger);
|
|
44
|
-
}
|
|
45
|
-
}, [props.expandTrigger, expandTrigger]);
|
|
46
|
-
// This one forcibly recalculates the state based on the value for props.showOpen
|
|
47
|
-
React.useEffect(() => {
|
|
48
|
-
if (props.showOpenTrigger !== showOpenTrigger) {
|
|
49
|
-
setIsOpen(props.showOpen);
|
|
50
|
-
setShowOpenTrigger(props.showOpenTrigger);
|
|
51
|
-
}
|
|
52
|
-
}, [props.showOpenTrigger, showOpenTrigger, props.showOpen]);
|
|
53
|
-
React.useEffect(() => {
|
|
54
|
-
if (props.showOpen === true || props.showOpen === false)
|
|
55
|
-
setIsOpen(props.showOpen);
|
|
56
|
-
}, [props.showOpen]);
|
|
57
|
-
let style = {};
|
|
58
|
-
if (props.headingColor)
|
|
59
|
-
style.color = props.headingColor;
|
|
60
|
-
let icon;
|
|
61
|
-
if (props.headingIcon)
|
|
62
|
-
icon = React.createElement(GenesysDevIcon, { icon: props.headingIcon, className: "heading-icon" });
|
|
63
|
-
return (React.createElement("div", { id: props.containerId || undefined, className: `dx-accordion${props.className ? ' ' + props.className : ''}` },
|
|
64
|
-
React.createElement("div", { className: "accordion-heading", style: style, onClick: () => setIsOpen(!isOpen) },
|
|
65
|
-
React.createElement("span", { className: "accordion-heading__left" },
|
|
66
|
-
icon,
|
|
67
|
-
" ",
|
|
68
|
-
props.title),
|
|
69
|
-
' ',
|
|
70
|
-
React.createElement(GenesysDevIcon, { icon: isOpen ? GenesysDevIcons.AppChevronUp : GenesysDevIcons.AppChevronDown })),
|
|
71
|
-
isOpen ? React.createElement("div", { className: "accordion-content" }, props.children) : undefined));
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var css_248z$f = ".dx-accordion-group {\n margin: 40px 0;\n}";
|
|
75
|
-
styleInject(css_248z$f);
|
|
76
|
-
|
|
77
|
-
function DxAccordionGroup(props) {
|
|
78
|
-
return React.createElement("div", { className: `dx-accordion-group${props.className ? ' ' + props.className : ''}` }, props.children);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
var css_248z$e = ".dx-button {\n margin: 15px 10px;\n border-radius: 2px;\n padding: 8px 15px;\n cursor: pointer;\n font-weight: 500;\n}\n.dx-button-primary {\n color: #ffffff;\n border: 1px solid #419bb2;\n background-color: #419bb2;\n}\n.dx-button-primary:hover {\n background-color: #317b8d;\n border-color: #317b8d;\n transition: 0.1s;\n}\n.dx-button-primary:focus {\n background-color: #419bb2;\n border-color: #419bb2;\n box-shadow: 0 0 0 2px #aac9ff;\n transition: 0.1s;\n}\n.dx-button-primary:disabled {\n background-color: #9aafb540;\n border-color: #9aafb540;\n transition: 0.1s;\n cursor: not-allowed;\n}\n.dx-button-secondary {\n color: #419bb2;\n border: 1px solid #419bb2;\n background-color: #ffffff;\n}\n.dx-button-secondary:hover {\n color: #317b8d;\n border-color: #317b8d;\n transition: 0.1s;\n}\n.dx-button-secondary:focus {\n color: #419bb2;\n border-color: #419bb2;\n box-shadow: 0 0 0 2px #aac9ff;\n transition: 0.1s;\n}\n.dx-button-secondary:disabled {\n color: #8a9a9e;\n background-color: #e0e6e8;\n border-color: #e0e6e8;\n transition: 0.1s;\n cursor: not-allowed;\n}\n.dx-button-link {\n color: #2f7bb1;\n background: transparent;\n margin: 0;\n padding: 0 2px;\n border: 0;\n}\n.dx-button-link:hover {\n color: #1c5176;\n}\n.dx-button-link:disabled {\n color: #8a9a9e;\n transition: 0.1s;\n cursor: not-allowed;\n text-decoration: line-through;\n}";
|
|
82
|
-
styleInject(css_248z$e);
|
|
83
|
-
|
|
84
|
-
function DxButton(props) {
|
|
85
|
-
let classNames = ['dx-button'];
|
|
86
|
-
classNames.push(`dx-button-${props.type || 'primary'}`);
|
|
87
|
-
if (props.className)
|
|
88
|
-
classNames.push(props.className);
|
|
89
|
-
const handleClick = (e) => {
|
|
90
|
-
if (!props.onClick)
|
|
91
|
-
return;
|
|
92
|
-
e.preventDefault();
|
|
93
|
-
e.stopPropagation();
|
|
94
|
-
props.onClick();
|
|
95
|
-
};
|
|
96
|
-
return (React.createElement("button", { className: classNames.join(' '), type: "button", onClick: handleClick, disabled: props.disabled === true }, props.children));
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
var css_248z$d = ".dx-item-group {\n display: block;\n border: 0;\n margin: 0;\n padding: 0;\n}";
|
|
100
|
-
styleInject(css_248z$d);
|
|
101
|
-
|
|
102
|
-
var css_248z$c = "";
|
|
103
|
-
styleInject(css_248z$c);
|
|
104
|
-
|
|
105
|
-
var css_248z$b = ".dx-select-group {\n appearance: none;\n position: relative;\n}\n.dx-select-group select {\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n padding: 8px 32px 8px 12px;\n width: 100%;\n appearance: none;\n}\n.dx-select-group select:focus-visible {\n outline: 2px solid #aac9ff;\n}\n.dx-select-group::after {\n position: absolute;\n bottom: 12px;\n right: 12px;\n content: \"\\f104\";\n font-size: 8px;\n font-family: genesys-dev-icons !important;\n font-style: normal;\n font-weight: normal !important;\n font-feature-settings: normal;\n font-variant: normal;\n text-transform: none;\n line-height: 1;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n pointer-events: none;\n}\n.dx-select-group.disabled::after {\n color: #8a9a9e;\n}\n.dx-select-group.disabled select:disabled {\n background-color: #e6ebec;\n border-color: #e8eaed;\n color: #8a9a9e;\n cursor: not-allowed;\n}";
|
|
106
|
-
styleInject(css_248z$b);
|
|
107
|
-
|
|
108
|
-
var css_248z$a = ".dx-multiselect-group {\n appearance: none;\n position: relative;\n}\n.dx-multiselect-group select {\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n width: 100%;\n appearance: none;\n scrollbar-color: #b0b2b5 transparent;\n}\n.dx-multiselect-group select:focus-visible {\n outline: 2px solid #aac9ff;\n}\n.dx-multiselect-group select option {\n overflow: hidden;\n white-space: pre;\n text-overflow: ellipsis;\n -webkit-appearance: none;\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 31px;\n padding: 8px 12px;\n color: #75757a;\n}\n.dx-multiselect-group select option:checked {\n background: #aac9ff -webkit-linear-gradient(bottom, #aac9ff 0%, #aac9ff 100%);\n}\n.dx-multiselect-group select option:disabled {\n color: #8a9a9e;\n cursor: not-allowed;\n}\n.dx-multiselect-group select::-webkit-scrollbar {\n -webkit-appearance: none;\n width: 7px;\n height: 7px;\n}\n.dx-multiselect-group select::-webkit-scrollbar-thumb {\n border-radius: 4px;\n background-color: #b0b2b5;\n}\n.dx-multiselect-group select::-webkit-scrollbar-corner {\n background: transparent;\n}\n.dx-multiselect-group.disabled select:disabled {\n background-color: #e6ebec;\n border-color: #e8eaed;\n cursor: not-allowed;\n}\n.dx-multiselect-group.disabled select:disabled option {\n color: #8a9a9e;\n}";
|
|
109
|
-
styleInject(css_248z$a);
|
|
110
|
-
|
|
111
|
-
var css_248z$9 = ".dx-label {\n margin: 20px 0;\n display: block;\n}\n.dx-label .label-text,\n.dx-label .input-description {\n display: block;\n font-family: Roboto;\n font-style: normal;\n font-weight: 400;\n font-size: 12px;\n line-height: 14px;\n color: #75757a;\n}\n.dx-label .label-text {\n margin: 0 0 4px 0;\n}\n.dx-label .input-description {\n padding: 6px 20px;\n display: flex;\n flex-flow: row nowrap;\n gap: 8px;\n}\n.dx-label .input-description .icon {\n color: #597393;\n line-height: 0;\n}";
|
|
112
|
-
styleInject(css_248z$9);
|
|
113
|
-
|
|
114
|
-
function DxLabel(props) {
|
|
115
|
-
const hasLabel = props.label && props.label !== '';
|
|
116
|
-
const description = props.description ? (React.createElement("div", { className: 'input-description' },
|
|
117
|
-
React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppInfoSolid }),
|
|
118
|
-
React.createElement("span", null, props.description))) : undefined;
|
|
119
|
-
const contents = (React.createElement(React.Fragment, null,
|
|
120
|
-
' ',
|
|
121
|
-
hasLabel ? React.createElement("span", { className: 'label-text' }, props.label) : undefined,
|
|
122
|
-
props.children,
|
|
123
|
-
description));
|
|
124
|
-
const className = `dx-label${props.className ? ' ' + props.className : ''}`;
|
|
125
|
-
if (props.useFieldset) {
|
|
126
|
-
return React.createElement("fieldset", { className: className }, contents);
|
|
127
|
-
}
|
|
128
|
-
return React.createElement("label", { className: className }, contents);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
var css_248z$8 = ".dx-checkbox {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n margin: 15px 0;\n}\n.dx-checkbox:first-of-type {\n margin-top: 0;\n}\n.dx-checkbox .label-text {\n font-family: Roboto;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 18px;\n color: #75757a;\n}\n.dx-checkbox input[type=checkbox] {\n -webkit-appearance: none;\n appearance: none;\n margin: 0 8px 0 0;\n width: 16px;\n height: 16px;\n border: 1px solid #8a96a3;\n border-radius: 2px;\n background-color: #ffffff;\n flex-shrink: 0;\n}\n.dx-checkbox input[type=checkbox]::before {\n display: none;\n}\n.dx-checkbox input[type=checkbox]:checked {\n background-color: #8a96a3;\n}\n.dx-checkbox input[type=checkbox]:checked::before {\n display: block;\n position: relative;\n top: 7px;\n left: 3px;\n font-size: 9px;\n line-height: 0;\n color: #ffffff;\n content: \"\\f103\";\n font-family: genesys-dev-icons !important;\n font-style: normal;\n font-weight: normal !important;\n font-feature-settings: normal;\n font-variant: normal;\n text-transform: none;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n.dx-checkbox input[type=checkbox]:not(:disabled):hover {\n border-color: #4d5061;\n}\n.dx-checkbox input[type=checkbox]:not(:disabled):focus {\n outline: #aac9ff solid 2px;\n}\n.dx-checkbox input[type=checkbox]:not(:disabled):focus-visible {\n outline: 0;\n}\n.dx-checkbox input[type=radio] {\n -webkit-appearance: none;\n appearance: none;\n margin: 0 8px 0 0;\n width: 16px;\n height: 16px;\n border: 1px solid #8a96a3;\n border-radius: 8px;\n background-color: #ffffff;\n flex-shrink: 0;\n}\n.dx-checkbox input[type=radio]::before {\n display: none;\n}\n.dx-checkbox input[type=radio]:checked::before {\n content: \"\";\n display: block;\n width: 10px;\n height: 10px;\n border-radius: 8px;\n position: relative;\n top: 2px;\n left: 2px;\n background-color: #8a96a3;\n}\n.dx-checkbox input[type=radio]:not(:disabled):hover {\n border-color: #4d5061;\n}\n.dx-checkbox input[type=radio]:not(:disabled):focus {\n outline: #aac9ff solid 2px;\n}\n.dx-checkbox input[type=radio]:not(:disabled):focus-visible {\n outline: 0;\n}\n.dx-checkbox.disabled {\n cursor: not-allowed;\n}\n.dx-checkbox.disabled input {\n border-color: #e8eaed;\n cursor: not-allowed;\n}\n.dx-checkbox.disabled input:checked {\n background-color: #e8eaed;\n cursor: not-allowed;\n}\n\n.dx-label .dx-checkbox .label-text {\n margin: 0;\n}";
|
|
132
|
-
styleInject(css_248z$8);
|
|
133
|
-
|
|
134
|
-
function DxCheckbox(props) {
|
|
135
|
-
let initialValue = props.checked !== undefined ? props.checked : props.initiallyChecked || false;
|
|
136
|
-
const [checked, setChecked] = useState(initialValue);
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
if (props.checked === undefined || props.checked === checked)
|
|
139
|
-
return;
|
|
140
|
-
setChecked(props.checked);
|
|
141
|
-
}, [props.checked]);
|
|
142
|
-
useEffect(() => {
|
|
143
|
-
if (props.onCheckChanged)
|
|
144
|
-
props.onCheckChanged(checked);
|
|
145
|
-
}, [checked]);
|
|
146
|
-
return (React.createElement("label", { className: `dx-checkbox${props.className ? ' ' + props.className : ''}${props.disabled ? ' disabled' : ''}` },
|
|
147
|
-
React.createElement("input", { type: props.useRadioType ? 'radio' : 'checkbox', name: props.name, value: props.itemValue, checked: checked, onChange: (e) => setChecked(e.target.checked), disabled: props.disabled === true }),
|
|
148
|
-
React.createElement("span", { className: 'label-text' }, props.label)));
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function DxItemGroup(props) {
|
|
152
|
-
var _a, _b;
|
|
153
|
-
const [data, setData] = useState(props.items.map((item) => {
|
|
154
|
-
return { item, isSelected: item.isSelected !== undefined ? item.isSelected : false };
|
|
155
|
-
}));
|
|
156
|
-
const [id] = useState(v4());
|
|
157
|
-
const [title, setTitle] = useState(props.title);
|
|
158
|
-
const [description, setDescription] = useState(props.description);
|
|
159
|
-
const [format, setFormat] = useState(props.format);
|
|
160
|
-
const [disabled, setDisabled] = useState(props.disabled);
|
|
161
|
-
const [className, setClassName] = useState(props.className);
|
|
162
|
-
// data changed
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
if (props.onItemsChanged)
|
|
165
|
-
props.onItemsChanged(data);
|
|
166
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
167
|
-
}, [data]);
|
|
168
|
-
// Recalculate on props changed
|
|
169
|
-
useEffect(() => {
|
|
170
|
-
setTitle(props.title);
|
|
171
|
-
setDescription(props.description);
|
|
172
|
-
setFormat(props.format);
|
|
173
|
-
setDisabled(props.disabled);
|
|
174
|
-
setClassName(props.className);
|
|
175
|
-
}, [props.title, props.description, props.format, props.items, props.disabled, props.className]);
|
|
176
|
-
useEffect(() => {
|
|
177
|
-
setData(props.items.map((item) => {
|
|
178
|
-
return { item, isSelected: item.isSelected !== undefined ? item.isSelected : false };
|
|
179
|
-
}));
|
|
180
|
-
}, [props.items]);
|
|
181
|
-
// Handle individual item changed
|
|
182
|
-
const itemChanged = (idx, item, checked) => {
|
|
183
|
-
if (props.onItemChanged)
|
|
184
|
-
props.onItemChanged(item, checked);
|
|
185
|
-
let newData = [...data];
|
|
186
|
-
// Unselect everything if it's radio buttons
|
|
187
|
-
if (format === 'radio')
|
|
188
|
-
newData.forEach((value) => (value.isSelected = false));
|
|
189
|
-
// Set the selected state of the new item
|
|
190
|
-
newData[idx].isSelected = checked;
|
|
191
|
-
setData(newData);
|
|
192
|
-
};
|
|
193
|
-
const selectChanged = (e) => {
|
|
194
|
-
const options = e.target.options;
|
|
195
|
-
let newData = [...data];
|
|
196
|
-
// Assign selected value for each item in the list
|
|
197
|
-
for (let i = 0; i < options.length; i++) {
|
|
198
|
-
const thisItem = newData.find((value) => value.item.value === options[i].value);
|
|
199
|
-
thisItem.isSelected = options[i].selected;
|
|
200
|
-
}
|
|
201
|
-
// Update entire data list
|
|
202
|
-
setData(newData);
|
|
203
|
-
// Trigger individual update
|
|
204
|
-
const changedItemIdx = newData.findIndex((value) => value.item.value === e.target.value);
|
|
205
|
-
if (changedItemIdx >= 0)
|
|
206
|
-
itemChanged(changedItemIdx, newData[changedItemIdx].item, newData[changedItemIdx].isSelected);
|
|
207
|
-
};
|
|
208
|
-
switch (format) {
|
|
209
|
-
case 'multiselect':
|
|
210
|
-
case 'dropdown': {
|
|
211
|
-
const isMulti = format === 'multiselect';
|
|
212
|
-
return (React.createElement(DxLabel, { label: title, description: description, className: className },
|
|
213
|
-
React.createElement("div", { className: `dx-item-group${isMulti ? ' dx-multiselect-group' : ' dx-select-group'}${disabled ? ' disabled' : ''}` },
|
|
214
|
-
React.createElement("select", { multiple: isMulti, disabled: disabled === true, onChange: (e) => selectChanged(e), value: isMulti
|
|
215
|
-
? (_a = data.filter((item) => item.isSelected)) === null || _a === void 0 ? void 0 : _a.map((item) => item.item.value)
|
|
216
|
-
: (_b = data.find((item) => item.isSelected)) === null || _b === void 0 ? void 0 : _b.item.value }, data.map((d, i) => (React.createElement("option", { key: i, value: d.item.value, disabled: d.item.disabled }, d.item.label)))))));
|
|
217
|
-
}
|
|
218
|
-
case 'checkbox':
|
|
219
|
-
case 'radio':
|
|
220
|
-
default: {
|
|
221
|
-
return (React.createElement(DxLabel, { label: title, description: description, className: `dx-item-group${disabled ? ' disabled' : ''}${className ? ' ' + className : ''}`, useFieldset: true },
|
|
222
|
-
React.createElement("div", { onChange: (e) => {
|
|
223
|
-
var _a;
|
|
224
|
-
const i = data.findIndex((d) => { var _a; return d.item.value === ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value); });
|
|
225
|
-
if (i < 0)
|
|
226
|
-
return;
|
|
227
|
-
itemChanged(i, data[i].item, (_a = e.target) === null || _a === void 0 ? void 0 : _a.checked);
|
|
228
|
-
} }, data.map((d, i) => (React.createElement(DxCheckbox, { key: d.item.value, name: format === 'checkbox' ? `${id}-${d.item.value}` : id, label: d.item.label, itemValue: d.item.value, checked: d.isSelected, useRadioType: format === 'radio', disabled: disabled || d.item.disabled }))))));
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
var css_248z$7 = ".dx-tabbed-content {\n margin: 40px 0;\n}\n.dx-tabbed-content .tab-titles {\n border-bottom: 1px solid #bfd4e4;\n font-weight: normal;\n font-size: 14px;\n line-height: 20px;\n}\n.dx-tabbed-content .tab-titles .tab-title {\n display: inline-block;\n padding: 5px 20px;\n border-bottom: 1px solid transparent;\n cursor: pointer;\n}\n.dx-tabbed-content .tab-titles .tab-title:hover {\n border-color: #bfd4e4;\n}\n.dx-tabbed-content .tab-titles .tab-title.active {\n border-bottom-color: #597393;\n font-weight: bold;\n}\n.dx-tabbed-content .tab-titles .tab-title p {\n margin: 0;\n display: inline;\n}\n.dx-tabbed-content .tab-content {\n padding: 13px 20px 20px 20px;\n border-bottom: 1px solid #bfd4e4;\n}\n.dx-tabbed-content .tab-content > *:first-child {\n margin-top: 0;\n}\n.dx-tabbed-content .tab-content > *:last-child {\n margin-bottom: 0;\n}";
|
|
234
|
-
styleInject(css_248z$7);
|
|
235
|
-
|
|
236
|
-
function DxTabbedContent(props) {
|
|
237
|
-
const [activeTab, setActiveTab] = useState(props.initialTabId || 0);
|
|
238
|
-
const [titles] = useState(
|
|
239
|
-
// Scrape titles from child elements
|
|
240
|
-
React.Children.toArray(props.children).map((child) => {
|
|
241
|
-
if (!child || !child.props || !child.props.title)
|
|
242
|
-
return 'Unknown title';
|
|
243
|
-
return child.props.title;
|
|
244
|
-
}));
|
|
245
|
-
return (React.createElement("div", { className: `dx-tabbed-content${props.className ? ' ' + props.className : ''}` },
|
|
246
|
-
React.createElement("div", { className: 'tab-titles' }, titles.map((title, i) => (React.createElement("span", { key: i, className: `tab-title${i === activeTab ? ' active' : ''}`, onClick: () => setActiveTab(i) }, title)))),
|
|
247
|
-
React.createElement("div", { className: 'tab-content' }, React.Children.toArray(props.children)[activeTab])));
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
var css_248z$6 = "";
|
|
251
|
-
styleInject(css_248z$6);
|
|
252
|
-
|
|
253
|
-
function DxTabPanel(props) {
|
|
254
|
-
return React.createElement("div", { className: `dx-tab-panel${props.className ? ' ' + props.className : ''}` }, props.children);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
var css_248z$5 = ".dx-textbox {\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n gap: 10px;\n border: 1px solid #c6cbd1;\n border-radius: 2px;\n margin: 0;\n padding: 0 10px;\n height: 32px;\n background-color: #ffffff;\n}\n.dx-textbox.with-label {\n margin-top: 0;\n}\n.dx-textbox:focus-within {\n outline: #aac9ff solid 2px;\n}\n.dx-textbox .icon {\n display: block;\n flex: none;\n color: #75757a;\n}\n.dx-textbox .icon.input-icon {\n font-size: 14px;\n line-height: 0;\n}\n.dx-textbox .icon.clear-icon {\n font-size: 11px;\n line-height: 0;\n cursor: pointer;\n padding: 4px;\n margin-right: -4px;\n}\n.dx-textbox .dx-input {\n flex-grow: 1;\n border: 0;\n background: transparent;\n box-sizing: border-box;\n height: 32px;\n width: 100%;\n padding: 0;\n margin: 0;\n font-family: Roboto;\n font-style: normal;\n font-weight: normal;\n font-size: 14px;\n line-height: 16px;\n color: #272d2d;\n}\n.dx-textbox .dx-input:focus-visible {\n outline: 0;\n}\n.dx-textbox .dx-input::placeholder {\n font-style: normal;\n font-weight: 300;\n font-size: 14px;\n line-height: 16px;\n color: #757576;\n}\n.dx-textbox.disabled {\n background-color: #e6ebec;\n border-color: #e8eaed;\n cursor: not-allowed;\n}\n.dx-textbox.disabled input {\n cursor: not-allowed;\n color: #75757a;\n}\n.dx-textbox.disabled .icon,\n.dx-textbox.disabled input::placeholder {\n color: #ffffff;\n}\n\n.dx-textarea {\n padding: 10px;\n border: 1px solid #c6cbd1;\n border-radius: 2px;\n width: 100%;\n font-family: \"Roboto\", sans-serif;\n box-sizing: border-box;\n}\n.dx-textarea:focus-within {\n outline: #aac9ff solid 2px;\n}\n.dx-textarea::placeholder {\n font-family: \"Roboto\", sans-serif;\n font-style: normal;\n font-weight: 300;\n font-size: 14px;\n line-height: 16px;\n color: #757576;\n}";
|
|
258
|
-
styleInject(css_248z$5);
|
|
259
|
-
|
|
260
|
-
function DxTextbox(props) {
|
|
261
|
-
const [debounceMs, setDebounceMs] = useState(props.changeDebounceMs || 300);
|
|
262
|
-
const [value, setValue] = useState(props.initialValue || props.value || '');
|
|
263
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
264
|
-
const [escapePressed, setEscapePressed] = useState(Date.now());
|
|
265
|
-
const [step, setStep] = useState(undefined);
|
|
266
|
-
let [timer, setTimer] = useState(undefined);
|
|
267
|
-
// Constructor
|
|
268
|
-
useEffect(() => {
|
|
269
|
-
// Register global key bindings
|
|
270
|
-
document.addEventListener('keydown', globalKeyBindings, false);
|
|
271
|
-
return () => {
|
|
272
|
-
document.removeEventListener('keydown', globalKeyBindings, false);
|
|
273
|
-
};
|
|
274
|
-
}, []);
|
|
275
|
-
// Value prop updated
|
|
276
|
-
useEffect(() => {
|
|
277
|
-
// Ignore value changed if initial value was set; they're mutually exclusive
|
|
278
|
-
if (!props.initialValue) {
|
|
279
|
-
setValue(props.value || '');
|
|
280
|
-
}
|
|
281
|
-
}, [props.value]);
|
|
282
|
-
// Escape pressed
|
|
283
|
-
useEffect(() => {
|
|
284
|
-
var _a;
|
|
285
|
-
if (!isFocused || props.clearOnEscape === false)
|
|
286
|
-
return;
|
|
287
|
-
setValue('');
|
|
288
|
-
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
|
|
289
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
290
|
-
}, [escapePressed]);
|
|
291
|
-
// Value changed
|
|
292
|
-
useEffect(() => {
|
|
293
|
-
if (props.inputType === 'decimal') {
|
|
294
|
-
// Normalize step setting
|
|
295
|
-
if (!isNaN(parseFloat(value))) {
|
|
296
|
-
const match = /\.(.+)/.exec(value);
|
|
297
|
-
console.log(match);
|
|
298
|
-
if (match) {
|
|
299
|
-
const s = `0.${Array.apply(null, Array(match[1].length - 1))
|
|
300
|
-
.map(() => '0')
|
|
301
|
-
.join('')}1`;
|
|
302
|
-
console.log(s);
|
|
303
|
-
setStep(s);
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
else if (props.inputType === 'integer') {
|
|
308
|
-
// Overwrite value as integer to forcibly truncate floating point numbers
|
|
309
|
-
setValue(parseInt(value).toString());
|
|
310
|
-
}
|
|
311
|
-
// Debounce onChange notification
|
|
312
|
-
if (!props.onChange)
|
|
313
|
-
return;
|
|
314
|
-
clearTimeout(timer);
|
|
315
|
-
setTimer(setTimeout(() => (props.onChange ? props.onChange(value) : undefined), debounceMs));
|
|
316
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
317
|
-
}, [value]);
|
|
318
|
-
// Update state from props
|
|
319
|
-
useEffect(() => {
|
|
320
|
-
setDebounceMs(props.changeDebounceMs || 300);
|
|
321
|
-
}, [props.changeDebounceMs]);
|
|
322
|
-
// Normalize inputRef
|
|
323
|
-
let inputRef; // = useRef<HTMLInputElement>(null);
|
|
324
|
-
if (props.inputRef)
|
|
325
|
-
inputRef = props.inputRef;
|
|
326
|
-
else if (props.inputType === 'textarea')
|
|
327
|
-
inputRef = useRef(null);
|
|
328
|
-
else
|
|
329
|
-
inputRef = useRef(null);
|
|
330
|
-
const hasLabel = props.label && props.label !== '';
|
|
331
|
-
// Global key bindings
|
|
332
|
-
function globalKeyBindings(event) {
|
|
333
|
-
// Escape - cancel search
|
|
334
|
-
if (event.key === 'Escape') {
|
|
335
|
-
event.stopPropagation();
|
|
336
|
-
event.preventDefault();
|
|
337
|
-
setEscapePressed(Date.now());
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
// Normalize input type
|
|
342
|
-
let inputType = props.inputType;
|
|
343
|
-
if (inputType === 'integer' || inputType === 'decimal')
|
|
344
|
-
inputType = 'number';
|
|
345
|
-
let component;
|
|
346
|
-
switch (inputType) {
|
|
347
|
-
case 'textarea': {
|
|
348
|
-
component = (React.createElement("textarea", { className: "dx-textarea", placeholder: props.placeholder, ref: inputRef, value: value, onChange: (e) => setValue(e.target.value), onFocus: () => {
|
|
349
|
-
setIsFocused(true);
|
|
350
|
-
if (props.onFocus)
|
|
351
|
-
props.onFocus();
|
|
352
|
-
}, onBlur: () => {
|
|
353
|
-
setIsFocused(false);
|
|
354
|
-
if (props.onBlur)
|
|
355
|
-
props.onBlur();
|
|
356
|
-
}, disabled: props.disabled === true, autoFocus: props.autoFocus }));
|
|
357
|
-
break;
|
|
358
|
-
}
|
|
359
|
-
// TODO: special handling for other inputType values
|
|
360
|
-
default: {
|
|
361
|
-
component = (React.createElement("div", { className: `dx-textbox${hasLabel ? ' with-label' : ''}${props.disabled ? ' disabled' : ''}` },
|
|
362
|
-
props.icon ? React.createElement(GenesysDevIcon, { icon: props.icon, className: "input-icon" }) : undefined,
|
|
363
|
-
React.createElement("input", { className: "dx-input", type: inputType, step: step, value: value, placeholder: props.placeholder, onChange: (e) => setValue(e.target.value), ref: inputRef, onFocus: () => {
|
|
364
|
-
setIsFocused(true);
|
|
365
|
-
if (props.onFocus)
|
|
366
|
-
props.onFocus();
|
|
367
|
-
}, onBlur: () => {
|
|
368
|
-
setIsFocused(false);
|
|
369
|
-
if (props.onBlur)
|
|
370
|
-
props.onBlur();
|
|
371
|
-
}, disabled: props.disabled === true, autoFocus: props.autoFocus }),
|
|
372
|
-
props.clearButton && (value || isFocused) && !props.disabled ? (React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppTimes, className: "clear-icon", onClick: () => setValue('') })) : undefined));
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
// Render
|
|
376
|
-
return (React.createElement(DxLabel, { label: props.label, description: props.description, className: props.className }, component));
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
var css_248z$4 = ".dx-toggle-container {\n display: inline-block;\n}\n.dx-toggle-container .dx-toggle {\n background: #f5f8fb;\n border: 1px solid #c6cbd1;\n border-radius: 6px;\n height: 26px;\n padding: 0px 4px;\n display: flex;\n flex-flow: row nowrap;\n justify-content: space-between;\n align-items: center;\n gap: 2px;\n cursor: pointer;\n}\n.dx-toggle-container .dx-toggle:hover .slider {\n border-color: #aac9ff;\n}\n.dx-toggle-container .dx-toggle .icon {\n font-size: 10px;\n line-height: 0;\n margin: 0 5px;\n color: #c4c4c4;\n}\n.dx-toggle-container .dx-toggle .clear-placeholder {\n width: 19px;\n padding: 0 1px 0 0;\n margin: 0;\n display: block;\n}\n.dx-toggle-container .dx-toggle .slider {\n height: 22px;\n width: 22px;\n border-radius: 22px;\n background-color: #419bb2;\n box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.25);\n display: flex;\n align-items: center;\n justify-content: center;\n border: 1px solid transparent;\n}\n.dx-toggle-container .dx-toggle .slider .icon {\n font-size: 10px;\n line-height: 0;\n color: #ffffff;\n padding: 0;\n margin: 0;\n}\n.dx-toggle-container.disabled .dx-toggle {\n border-color: #e8eaed;\n color: #ffffff;\n cursor: not-allowed;\n}\n.dx-toggle-container.disabled .dx-toggle:hover .slider {\n border-color: transparent;\n}\n.dx-toggle-container.disabled .dx-toggle .slider {\n color: #8a9a9e;\n background-color: #e0e6e8;\n}";
|
|
380
|
-
styleInject(css_248z$4);
|
|
381
|
-
|
|
382
|
-
function DxToggle(props) {
|
|
383
|
-
let initialValue = props.value !== undefined ? props.value : props.initialValue;
|
|
384
|
-
if (!props.isTriState)
|
|
385
|
-
initialValue = initialValue || false;
|
|
386
|
-
const [value, setValue] = useState(initialValue);
|
|
387
|
-
const trueIcon = props.trueIcon || GenesysDevIcons.AppCheck;
|
|
388
|
-
const falseIcon = props.falseIcon || GenesysDevIcons.AppTimes;
|
|
389
|
-
useEffect(() => {
|
|
390
|
-
if (props.initialValue || props.value === value || (!props.isTriState && props.value === undefined))
|
|
391
|
-
return;
|
|
392
|
-
setValue(props.value);
|
|
393
|
-
}, [props.value]);
|
|
394
|
-
useEffect(() => {
|
|
395
|
-
if (props.onChange)
|
|
396
|
-
props.onChange(value);
|
|
397
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
398
|
-
}, [value]);
|
|
399
|
-
const toggleValue = () => {
|
|
400
|
-
if (props.disabled)
|
|
401
|
-
return;
|
|
402
|
-
if (props.isTriState) {
|
|
403
|
-
if (value === undefined)
|
|
404
|
-
setValue(true);
|
|
405
|
-
else if (value === true)
|
|
406
|
-
setValue(false);
|
|
407
|
-
else
|
|
408
|
-
setValue(undefined);
|
|
409
|
-
}
|
|
410
|
-
else {
|
|
411
|
-
setValue(!value);
|
|
412
|
-
}
|
|
413
|
-
};
|
|
414
|
-
return (React.createElement(DxLabel, { label: props.label, description: props.description, className: props.className },
|
|
415
|
-
React.createElement("div", { className: `dx-toggle-container${props.disabled ? ' disabled' : ''}` },
|
|
416
|
-
React.createElement("div", { className: 'dx-toggle', onClick: toggleValue },
|
|
417
|
-
value !== false ? React.createElement(GenesysDevIcon, { icon: falseIcon }) : undefined,
|
|
418
|
-
value === true && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
|
|
419
|
-
React.createElement("div", { className: 'slider' }, value !== undefined ? React.createElement(GenesysDevIcon, { icon: value ? trueIcon : falseIcon }) : undefined),
|
|
420
|
-
value === false && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
|
|
421
|
-
value !== true ? React.createElement(GenesysDevIcon, { icon: trueIcon }) : undefined))));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
var css_248z$3 = "/*** \n * Core colors\n ***/\n/*** \n* Component-specific properties \n***/\n/*** \n* Theme definitions\n***/\n.alert-container {\n margin: 40px 0;\n padding: 0;\n}\n.toc-link + .alert-container {\n margin-top: 0;\n}\n.alert-container .alert {\n display: flex;\n flex-flow: row nowrap;\n gap: 20px;\n background-color: var(--theme-alertblock-default-background-color);\n border: 1px solid var(--theme-alertblock-default-border-color);\n color: var(--theme-alertblock-default-text-color);\n border-radius: 4px;\n padding: 15px 20px;\n font-size: 14px;\n line-height: 14px;\n}\n.alert-container .alert .clickable {\n cursor: pointer;\n}\n.alert-container .alert .info-icon {\n display: inline-block;\n font-size: 16px;\n line-height: 0;\n margin-top: 2px;\n color: var(--theme-alertblock-default-icon-color);\n}\n.alert-container .alert .alert-content {\n flex-grow: 1;\n font-size: 14px;\n line-height: 20px;\n margin: 0;\n}\n.alert-container .alert .alert-content .alert-title {\n font-size: 14px;\n line-height: 20px;\n font-weight: bold;\n margin-bottom: 6px;\n}\n.alert-container .alert .alert-content .alert-title.collapsed {\n margin-bottom: 0;\n}\n.alert-container .alert p:last-of-type {\n margin-bottom: 0;\n}\n.alert-container .alert.alert-info {\n color: var(--theme-alertblock-info-text-color);\n background-color: var(--theme-alertblock-info-background-color);\n border-color: var(--theme-alertblock-info-border-color);\n}\n.alert-container .alert.alert-info .icon {\n color: var(--theme-alertblock-info-icon-color);\n}\n.alert-container .alert.alert-warning {\n color: var(--theme-alertblock-warning-text-color);\n background-color: var(--theme-alertblock-warning-background-color);\n border-color: var(--theme-alertblock-warning-border-color);\n}\n.alert-container .alert.alert-warning .icon {\n color: var(--theme-alertblock-warning-icon-color);\n}\n.alert-container .alert.alert-critical {\n color: var(--theme-alertblock-critical-text-color);\n background-color: var(--theme-alertblock-critical-background-color);\n border-color: var(--theme-alertblock-critical-border-color);\n}\n.alert-container .alert.alert-critical .icon {\n color: var(--theme-alertblock-critical-icon-color);\n}\n.alert-container .alert.alert-success {\n color: var(--theme-alertblock-success-text-color);\n background-color: var(--theme-alertblock-success-background-color);\n border-color: var(--theme-alertblock-success-border-color);\n}\n.alert-container .alert.alert-success .icon {\n color: var(--theme-alertblock-success-icon-color);\n}\n.alert-container .alert.alert-toast {\n color: var(--theme-alertblock-toast-text-color);\n background-color: var(--theme-alertblock-toast-background-color);\n border-color: var(--theme-alertblock-toast-border-color);\n}\n.alert-container .alert.alert-toast .icon {\n color: var(--theme-alertblock-toast-icon-color);\n}";
|
|
425
|
-
styleInject(css_248z$3);
|
|
426
|
-
|
|
427
|
-
function AlertBlock(props) {
|
|
428
|
-
const isCollapsible = props.collapsible === false ? false : props.collapsible || props.autoCollapse || false;
|
|
429
|
-
const [isCollapsed, setIsCollapsed] = useState(isCollapsible ? props.autoCollapse || false : false);
|
|
430
|
-
let title;
|
|
431
|
-
if (props.title) {
|
|
432
|
-
title = (React.createElement("div", { className: `alert-title${isCollapsible ? ' clickable' : ''}${isCollapsed ? ' collapsed' : ''}`, onClick: isCollapsible ? () => setIsCollapsed(!isCollapsed) : undefined }, props.title));
|
|
433
|
-
}
|
|
434
|
-
let icon;
|
|
435
|
-
switch (props.alertType) {
|
|
436
|
-
case 'info': {
|
|
437
|
-
icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppInfoSolid });
|
|
438
|
-
break;
|
|
439
|
-
}
|
|
440
|
-
case 'success': {
|
|
441
|
-
icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppSuccessSolid });
|
|
442
|
-
break;
|
|
443
|
-
}
|
|
444
|
-
case 'critical': {
|
|
445
|
-
icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppCriticalSolid });
|
|
446
|
-
break;
|
|
447
|
-
}
|
|
448
|
-
case 'warning': {
|
|
449
|
-
icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppWarnSolid });
|
|
450
|
-
break;
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
if (icon && isCollapsible) {
|
|
454
|
-
icon = (React.createElement("span", { className: "clickable", onClick: () => setIsCollapsed(!isCollapsed) }, icon));
|
|
455
|
-
}
|
|
456
|
-
//TODO: remove the card fence classes and build a proper collapser
|
|
457
|
-
return (React.createElement("div", { className: `alert-container${props.indentation && props.indentation > 0 ? ` indent-${props.indentation}` : ''} ${props.className || ''}` },
|
|
458
|
-
React.createElement("div", { className: `alert alert-${props.alertType}`, role: "alert" },
|
|
459
|
-
icon,
|
|
460
|
-
React.createElement("div", { className: "alert-content" },
|
|
461
|
-
title,
|
|
462
|
-
isCollapsed ? undefined : React.createElement("div", null, props.children)),
|
|
463
|
-
isCollapsible ? (React.createElement("span", { className: "clickable", onClick: () => setIsCollapsed(!isCollapsed) },
|
|
464
|
-
React.createElement(GenesysDevIcon, { icon: isCollapsed ? GenesysDevIcons.AppChevronDown : GenesysDevIcons.AppChevronUp }))) : undefined)));
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
var css_248z$2 = "/*** \n * Core colors\n ***/\n/*** \n* Component-specific properties \n***/\n/*** \n* Theme definitions\n***/\n.loading-placeholder {\n position: relative;\n width: 160px;\n height: 160px;\n margin: 60px auto;\n}\n.loading-placeholder .text {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n font-style: normal;\n font-weight: 300;\n font-size: 16px;\n line-height: 20px;\n color: var(--theme-loadingplaceholder-text-color);\n position: relative;\n top: 5px;\n left: 5px;\n opacity: 0.5;\n}\n.loading-placeholder div {\n position: absolute;\n border: 4px solid var(--theme-loadingplaceholder-wave-color);\n opacity: 1;\n border-radius: 50%;\n animation: loading-placeholder 1s cubic-bezier(0, 0.2, 0.8, 1) infinite;\n}\n.loading-placeholder div:nth-child(2) {\n animation-delay: -0.5s;\n}\n@keyframes loading-placeholder {\n 0% {\n top: 80px;\n left: 80px;\n width: 0;\n height: 0;\n opacity: 1;\n }\n 100% {\n top: 0px;\n left: 0px;\n width: 160px;\n height: 160px;\n opacity: 0;\n }\n}";
|
|
468
|
-
styleInject(css_248z$2);
|
|
469
|
-
|
|
470
|
-
function LoadingPlaceholder(props) {
|
|
471
|
-
return (React.createElement("div", { className: "loading-placeholder" },
|
|
472
|
-
React.createElement("span", { className: "text" }, props.text || 'Loading'),
|
|
473
|
-
React.createElement("div", null),
|
|
474
|
-
React.createElement("div", null)));
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
var css_248z$1 = "/* Custom properties */\n:root {\n --tooltip-text-color: white;\n --tooltip-background-color: black;\n --tooltip-margin: 10px;\n --tooltip-arrow-size: 6px;\n}\n\n/* Wrapping */\n.tooltip-container {\n display: inline-block;\n position: relative;\n line-height: 0;\n /* Absolute positioning */\n}\n.tooltip-container .tooltip-tip {\n position: absolute;\n border-radius: 4px;\n left: 50%;\n transform: translateX(-50%);\n padding: 6px;\n color: var(--tooltip-text-color);\n background: var(--tooltip-background-color);\n font-size: 14px;\n line-height: 1;\n z-index: 10000;\n max-width: 300px;\n width: max-content;\n opacity: 0;\n visibility: hidden;\n transition: visibility 1.1s ease-out, opacity 1s ease-out;\n /* CSS border triangles */\n /* Absolute positioning */\n /* Absolute positioning */\n /* Absolute positioning */\n /* Absolute positioning */\n}\n.tooltip-container .tooltip-tip.visible {\n opacity: 1;\n visibility: visible;\n transition: visibility 0s, opacity 0.1s ease-in;\n}\n.tooltip-container .tooltip-tip::before {\n content: \" \";\n left: 50%;\n border: solid transparent;\n height: 0;\n width: 0;\n position: absolute;\n pointer-events: none;\n border-width: var(--tooltip-arrow-size);\n margin-left: calc(var(--tooltip-arrow-size) * -1);\n}\n.tooltip-container .tooltip-tip.top {\n bottom: 130%;\n /* CSS border triangles */\n}\n.tooltip-container .tooltip-tip.top::before {\n top: 100%;\n border-top-color: var(--tooltip-background-color);\n}\n.tooltip-container .tooltip-tip.right {\n left: calc(100% + var(--tooltip-margin));\n top: 50%;\n transform: translateX(0) translateY(-50%);\n /* CSS border triangles */\n}\n.tooltip-container .tooltip-tip.right::before {\n left: calc(var(--tooltip-arrow-size) * -1);\n top: 50%;\n transform: translateX(0) translateY(-50%);\n border-right-color: var(--tooltip-background-color);\n}\n.tooltip-container .tooltip-tip.bottom {\n top: 110%;\n /* CSS border triangles */\n}\n.tooltip-container .tooltip-tip.bottom::before {\n bottom: 100%;\n border-bottom-color: var(--tooltip-background-color);\n}\n.tooltip-container .tooltip-tip.left {\n left: auto;\n right: calc(100% + var(--tooltip-margin));\n top: 50%;\n transform: translateX(0) translateY(-50%);\n /* CSS border triangles */\n}\n.tooltip-container .tooltip-tip.left::before {\n left: auto;\n right: calc(var(--tooltip-arrow-size) * -2);\n top: 50%;\n transform: translateX(0) translateY(-50%);\n border-left-color: var(--tooltip-background-color);\n}";
|
|
478
|
-
styleInject(css_248z$1);
|
|
479
|
-
|
|
480
|
-
// Inspired by https://paladini.dev/posts/how-to-make-an-extremely-reusable-tooltip-component-with-react--and-nothing-else/
|
|
481
|
-
function Tooltip(props) {
|
|
482
|
-
const [isShowing, setIsShowing] = useState(false);
|
|
483
|
-
const timeout = useRef();
|
|
484
|
-
useEffect(() => {
|
|
485
|
-
if (props.isShowing === undefined)
|
|
486
|
-
return;
|
|
487
|
-
setIsShowing(props.isShowing === true);
|
|
488
|
-
}, [props.isShowing]);
|
|
489
|
-
const showTip = (e) => {
|
|
490
|
-
// Ignore mouse events from the tooltip itself
|
|
491
|
-
if (e.target.className.includes('tooltip-tip'))
|
|
492
|
-
return;
|
|
493
|
-
// Ignore mouse events when manually controlled
|
|
494
|
-
if (props.isShowing !== undefined)
|
|
495
|
-
return;
|
|
496
|
-
timeout.current = setTimeout(() => {
|
|
497
|
-
setIsShowing(true);
|
|
498
|
-
}, 100);
|
|
499
|
-
};
|
|
500
|
-
const hideTip = () => {
|
|
501
|
-
if (props.isShowing !== undefined)
|
|
502
|
-
return;
|
|
503
|
-
if (timeout.current)
|
|
504
|
-
clearInterval(timeout.current);
|
|
505
|
-
setIsShowing(false);
|
|
506
|
-
};
|
|
507
|
-
return (React.createElement("div", { className: `tooltip-container ${props.className || ''}`, onMouseEnter: showTip, onMouseLeave: hideTip },
|
|
508
|
-
props.children,
|
|
509
|
-
React.createElement("div", { className: `tooltip-tip ${props.position || 'top'}${isShowing ? ' visible' : ''}` }, props.text)));
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
var css_248z = "/*** \n * Core colors\n ***/\n/*** \n* Component-specific properties \n***/\n/*** \n* Theme definitions\n***/\n.copy-button {\n cursor: pointer;\n border: 0;\n background: transparent;\n color: var(--theme-core-text-color);\n}";
|
|
513
|
-
styleInject(css_248z);
|
|
514
|
-
|
|
515
|
-
function CopyButton(props) {
|
|
516
|
-
let [copyState, setCopyState] = useState(false);
|
|
517
|
-
// Copy function will set the component state to indicate we have copied the record and then show the tool tip. With the copyState set to true we will see 'Copied'
|
|
518
|
-
const copyCode = (e) => {
|
|
519
|
-
e.stopPropagation();
|
|
520
|
-
setCopyState(true);
|
|
521
|
-
navigator.clipboard.writeText(props.copyText);
|
|
522
|
-
return;
|
|
523
|
-
};
|
|
524
|
-
// Once we lose focus on the copy button, we want to set the copyState to false so that we can hide the tool tip and set the default tool tip to ''
|
|
525
|
-
const loseFocus = () => {
|
|
526
|
-
setCopyState(false);
|
|
527
|
-
return;
|
|
528
|
-
};
|
|
529
|
-
const buttonClasses = ['copy-button'];
|
|
530
|
-
if (props.className)
|
|
531
|
-
buttonClasses.push(props.className);
|
|
532
|
-
return (React.createElement(React.Fragment, null,
|
|
533
|
-
React.createElement(Tooltip, { isShowing: copyState, text: "Copied", position: props.tooltipPosition },
|
|
534
|
-
React.createElement("button", { type: "button", className: buttonClasses.join(' '), onClick: copyCode, onMouseOut: loseFocus },
|
|
535
|
-
React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppCopy })))));
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
export { AlertBlock, CopyButton, DxAccordion, DxAccordionGroup, DxButton, DxCheckbox, DxItemGroup, DxLabel, DxTabPanel, DxTabbedContent, DxTextbox, DxToggle, LoadingPlaceholder, Tooltip };
|
|
539
|
-
//# sourceMappingURL=index.js.map
|