genesys-react-components 0.3.2-devengage-1574-implementing-code-fences.223 → 0.3.3-devengage-1574-implementing-code-fences.226

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/build/index.js ADDED
@@ -0,0 +1,659 @@
1
+ import { GenesysDevIcon, GenesysDevIcons } from 'genesys-dev-icons';
2
+ import React, { useState, useEffect, useRef } from 'react';
3
+ import { v4 } from 'uuid';
4
+ import { PrismAsync } from 'react-syntax-highlighter';
5
+ import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm/styles/prism';
6
+
7
+ function styleInject(css, ref) {
8
+ if ( ref === void 0 ) ref = {};
9
+ var insertAt = ref.insertAt;
10
+
11
+ if (!css || typeof document === 'undefined') { return; }
12
+
13
+ var head = document.head || document.getElementsByTagName('head')[0];
14
+ var style = document.createElement('style');
15
+ style.type = 'text/css';
16
+
17
+ if (insertAt === 'top') {
18
+ if (head.firstChild) {
19
+ head.insertBefore(style, head.firstChild);
20
+ } else {
21
+ head.appendChild(style);
22
+ }
23
+ } else {
24
+ head.appendChild(style);
25
+ }
26
+
27
+ if (style.styleSheet) {
28
+ style.styleSheet.cssText = css;
29
+ } else {
30
+ style.appendChild(document.createTextNode(css));
31
+ }
32
+ }
33
+
34
+ var css_248z$h = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.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: var(--theme-core-layout-border-color);\n font-style: normal;\n font-weight: bold;\n font-size: 14px;\n line-height: 14px;\n color: var(--theme-core-text-color);\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 color: var(--theme-core-text-color);\n padding: 13px 20px 20px 20px;\n border-bottom: 1px solid var(--theme-core-layout-border-color);\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}";
35
+ styleInject(css_248z$h);
36
+
37
+ function DxAccordion(props) {
38
+ const [isOpen, setIsOpen] = useState(props.showOpen || false);
39
+ const [expandTrigger, setExpandTrigger] = useState(props.expandTrigger);
40
+ const [showOpenTrigger, setShowOpenTrigger] = useState(props.showOpenTrigger);
41
+ // This one forcibly opens the component
42
+ React.useEffect(() => {
43
+ if (props.expandTrigger !== expandTrigger) {
44
+ setIsOpen(true);
45
+ setExpandTrigger(props.expandTrigger);
46
+ }
47
+ }, [props.expandTrigger, expandTrigger]);
48
+ // This one forcibly recalculates the state based on the value for props.showOpen
49
+ React.useEffect(() => {
50
+ if (props.showOpenTrigger !== showOpenTrigger) {
51
+ setIsOpen(props.showOpen);
52
+ setShowOpenTrigger(props.showOpenTrigger);
53
+ }
54
+ }, [props.showOpenTrigger, showOpenTrigger, props.showOpen]);
55
+ React.useEffect(() => {
56
+ if (props.showOpen === true || props.showOpen === false)
57
+ setIsOpen(props.showOpen);
58
+ }, [props.showOpen]);
59
+ let style = {};
60
+ if (props.headingColor)
61
+ style.color = props.headingColor;
62
+ let icon;
63
+ if (props.headingIcon)
64
+ icon = React.createElement(GenesysDevIcon, { icon: props.headingIcon, className: "heading-icon" });
65
+ return (React.createElement("div", { id: props.containerId || undefined, className: `dx-accordion${props.className ? ' ' + props.className : ''}` },
66
+ React.createElement("div", { className: "accordion-heading", style: style, onClick: () => setIsOpen(!isOpen) },
67
+ React.createElement("span", { className: "accordion-heading__left" },
68
+ icon,
69
+ " ",
70
+ props.title),
71
+ ' ',
72
+ React.createElement(GenesysDevIcon, { icon: isOpen ? GenesysDevIcons.AppChevronUp : GenesysDevIcons.AppChevronDown })),
73
+ isOpen ? React.createElement("div", { className: "accordion-content" }, props.children) : undefined));
74
+ }
75
+
76
+ var css_248z$g = ".dx-accordion-group {\n margin: 40px 0;\n}";
77
+ styleInject(css_248z$g);
78
+
79
+ function DxAccordionGroup(props) {
80
+ return React.createElement("div", { className: `dx-accordion-group${props.className ? ' ' + props.className : ''}` }, props.children);
81
+ }
82
+
83
+ var css_248z$f = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.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: var(--theme-dxbutton-primary-text-color);\n border: 1px solid var(--theme-dxbutton-primary-background-color);\n background-color: var(--theme-dxbutton-primary-background-color);\n}\n.dx-button-primary:hover {\n background-color: var(--theme-dxbutton-primary-hover-background-color);\n border-color: var(--theme-dxbutton-primary-hover-background-color);\n transition: 0.1s;\n}\n.dx-button-primary:focus {\n background-color: var(--theme-dxbutton-primary-background-color);\n border-color: var(--theme-dxbutton-primary-background-color);\n box-shadow: 0 0 0 2px var(--theme-dxbutton-primary-shadow-color);\n transition: 0.1s;\n}\n.dx-button-primary:disabled {\n background-color: var(--theme-dxbutton-primary-disabled-background-color);\n border-color: var(--theme-dxbutton-primary-disabled-background-color);\n transition: 0.1s;\n cursor: not-allowed;\n}\n.dx-button-secondary {\n background-color: var(--theme-dxbutton-secondary-background-color);\n border: 1px solid var(--theme-dxbutton-secondary-border-color);\n color: var(--theme-dxbutton-secondary-border-color);\n}\n.dx-button-secondary:hover {\n color: var(--theme-dxbutton-secondary-hover-border-color);\n border-color: var(--theme-dxbutton-secondary-border-color);\n transition: 0.1s;\n}\n.dx-button-secondary:focus {\n color: var(--theme-dxbutton-secondary-border-color);\n border-color: var(--theme-dxbutton-secondary-border-color);\n box-shadow: 0 0 0 2px var(--theme-dxbutton-secondary-shadow-color);\n transition: 0.1s;\n}\n.dx-button-secondary:disabled {\n color: var(--theme-dxbutton-secondary-disabled-text-color);\n background-color: var(--theme-dxbutton-secondary-disabled-background-color);\n border-color: var(--theme-dxbutton-secondary-disabled-background-color);\n transition: 0.1s;\n cursor: not-allowed;\n}\n.dx-button-link {\n color: var(--theme-core-link-color);\n background: transparent;\n margin: 0;\n padding: 0 2px;\n border: 0;\n}\n.dx-button-link:hover {\n color: var(--theme-core-link-hover-color);\n border-color: var(--theme-dxbutton-secondary-border-color);\n}\n.dx-button-link:disabled {\n color: #8a9a9e;\n transition: 0.1s;\n cursor: not-allowed;\n text-decoration: line-through;\n}";
84
+ styleInject(css_248z$f);
85
+
86
+ function DxButton(props) {
87
+ let classNames = ['dx-button'];
88
+ classNames.push(`dx-button-${props.type || 'primary'}`);
89
+ if (props.className)
90
+ classNames.push(props.className);
91
+ const handleClick = (e) => {
92
+ if (!props.onClick)
93
+ return;
94
+ e.preventDefault();
95
+ e.stopPropagation();
96
+ props.onClick();
97
+ };
98
+ return (React.createElement("button", { className: classNames.join(' '), type: "button", onClick: handleClick, disabled: props.disabled === true }, props.children));
99
+ }
100
+
101
+ var css_248z$e = ".dx-item-group {\n display: block;\n border: 0;\n margin: 0;\n padding: 0;\n}";
102
+ styleInject(css_248z$e);
103
+
104
+ var css_248z$d = "";
105
+ styleInject(css_248z$d);
106
+
107
+ var css_248z$c = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.dx-select-group {\n appearance: none;\n position: relative;\n}\n.dx-select-group select {\n border: 1px solid var(--theme-core-control-border-color);\n border-radius: 2px;\n background-color: var(--theme-core-control-alt-background-color);\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: var(--theme-core-control-textbox-text-color);\n padding: 8px 32px 8px 12px;\n width: 100%;\n appearance: none;\n}\n.dx-select-group select:focus-visible {\n outline: 2px solid var(--theme-core-control-focus-color);\n}\n.dx-select-group::after {\n position: absolute;\n bottom: 12px;\n right: 12px;\n content: \"\\f105\";\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: var(--theme-core-control-disabled-text-color);\n}\n.dx-select-group.disabled select:disabled {\n background-color: var(--theme-core-control-disabled-background-color);\n border-color: var(--theme-core-control-disabled-border-color);\n color: var(--theme-core-control-disabled-text-color);\n cursor: not-allowed;\n}";
108
+ styleInject(css_248z$c);
109
+
110
+ var css_248z$b = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.dx-multiselect-group {\n appearance: none;\n position: relative;\n}\n.dx-multiselect-group select {\n border: 1px solid var(--theme-core-control-border-color);\n border-radius: 2px;\n background-color: var(--theme-core-control-alt-background-color);\n font-style: normal;\n font-weight: 300;\n font-size: 12px;\n line-height: 14px;\n color: var(--theme-core-control-textbox-text-color);\n width: 100%;\n appearance: none;\n scrollbar-color: #b0b2b5 transparent;\n}\n.dx-multiselect-group select:focus-visible {\n outline: 2px solid var(--theme-core-control-focus-color);\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: var(--theme-core-control-textbox-text-color);\n}\n.dx-multiselect-group select option:checked {\n color: var(--theme-core-tag-text-color);\n background-color: var(--theme-core-tag-background-color);\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: var(--theme-core-control-disabled-background-color);\n border-color: var(--theme-core-control-disabled-border-color);\n cursor: not-allowed;\n}\n.dx-multiselect-group.disabled select:disabled option {\n color: var(--theme-core-control-disabled-text-color);\n}";
111
+ styleInject(css_248z$b);
112
+
113
+ var css_248z$a = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.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: var(--theme-core-control-label-color);\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: var(--theme-alertblock-info-icon-color);\n line-height: 0;\n}";
114
+ styleInject(css_248z$a);
115
+
116
+ function DxLabel(props) {
117
+ const hasLabel = props.label && props.label !== '';
118
+ const description = props.description ? (React.createElement("div", { className: 'input-description' },
119
+ React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppInfoSolid }),
120
+ React.createElement("span", null, props.description))) : undefined;
121
+ const contents = (React.createElement(React.Fragment, null,
122
+ ' ',
123
+ hasLabel ? React.createElement("span", { className: 'label-text' }, props.label) : undefined,
124
+ props.children,
125
+ description));
126
+ const className = `dx-label${props.className ? ' ' + props.className : ''}`;
127
+ if (props.useFieldset) {
128
+ return React.createElement("fieldset", { className: className }, contents);
129
+ }
130
+ return React.createElement("label", { className: className }, contents);
131
+ }
132
+
133
+ var css_248z$9 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.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: var(--theme-core-text-color);\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 var(--theme-core-control-border-color);\n border-radius: 2px;\n background-color: var(--theme-core-control-background-color);\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: var(--theme-core-control-background-color);\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: var(--theme-core-control-punch-color);\n content: \"\\f104\";\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: var(--theme-core-control-punch-color);\n}\n.dx-checkbox input[type=checkbox]:not(:disabled):focus {\n outline: var(--theme-core-control-focus-color) 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 var(--theme-core-control-border-color);\n border-radius: 8px;\n background-color: var(--theme-core-control-background-color);\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: var(--theme-core-control-punch-color);\n}\n.dx-checkbox input[type=radio]:not(:disabled):hover {\n border-color: var(--theme-core-control-punch-color);\n}\n.dx-checkbox input[type=radio]:not(:disabled):focus {\n outline: var(--theme-core-control-focus-color) 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: var(--theme-core-control-disabled-border-color);\n cursor: not-allowed;\n}\n.dx-checkbox.disabled input:checked {\n background-color: var(--theme-core-control-disabled-background-color);\n cursor: not-allowed;\n}\n\n.dx-label .dx-checkbox .label-text {\n margin: 0;\n}";
134
+ styleInject(css_248z$9);
135
+
136
+ function DxCheckbox(props) {
137
+ let initialValue = props.checked !== undefined ? props.checked : props.initiallyChecked || false;
138
+ const [checked, setChecked] = useState(initialValue);
139
+ useEffect(() => {
140
+ if (props.checked === undefined || props.checked === checked)
141
+ return;
142
+ setChecked(props.checked);
143
+ }, [props.checked]);
144
+ useEffect(() => {
145
+ if (props.onCheckChanged)
146
+ props.onCheckChanged(checked);
147
+ }, [checked]);
148
+ return (React.createElement("label", { className: `dx-checkbox${props.className ? ' ' + props.className : ''}${props.disabled ? ' disabled' : ''}` },
149
+ 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 }),
150
+ React.createElement("span", { className: 'label-text' }, props.label)));
151
+ }
152
+
153
+ function DxItemGroup(props) {
154
+ var _a, _b;
155
+ const [data, setData] = useState(props.items.map((item) => {
156
+ return { item, isSelected: item.isSelected !== undefined ? item.isSelected : false };
157
+ }));
158
+ const [id] = useState(v4());
159
+ const [title, setTitle] = useState(props.title);
160
+ const [description, setDescription] = useState(props.description);
161
+ const [format, setFormat] = useState(props.format);
162
+ const [disabled, setDisabled] = useState(props.disabled);
163
+ const [className, setClassName] = useState(props.className);
164
+ // data changed
165
+ useEffect(() => {
166
+ if (props.onItemsChanged)
167
+ props.onItemsChanged(data);
168
+ // eslint-disable-next-line react-hooks/exhaustive-deps
169
+ }, [data]);
170
+ // Recalculate on props changed
171
+ useEffect(() => {
172
+ setTitle(props.title);
173
+ setDescription(props.description);
174
+ setFormat(props.format);
175
+ setDisabled(props.disabled);
176
+ setClassName(props.className);
177
+ }, [props.title, props.description, props.format, props.items, props.disabled, props.className]);
178
+ useEffect(() => {
179
+ setData(props.items.map((item) => {
180
+ return { item, isSelected: item.isSelected !== undefined ? item.isSelected : false };
181
+ }));
182
+ }, [props.items]);
183
+ // Handle individual item changed
184
+ const itemChanged = (idx, item, checked) => {
185
+ if (props.onItemChanged)
186
+ props.onItemChanged(item, checked);
187
+ let newData = [...data];
188
+ // Unselect everything if it's radio buttons
189
+ if (format === 'radio')
190
+ newData.forEach((value) => (value.isSelected = false));
191
+ // Set the selected state of the new item
192
+ newData[idx].isSelected = checked;
193
+ setData(newData);
194
+ };
195
+ const selectChanged = (e) => {
196
+ const options = e.target.options;
197
+ let newData = [...data];
198
+ // Assign selected value for each item in the list
199
+ for (let i = 0; i < options.length; i++) {
200
+ const thisItem = newData.find((value) => value.item.value === options[i].value);
201
+ thisItem.isSelected = options[i].selected;
202
+ }
203
+ // Update entire data list
204
+ setData(newData);
205
+ // Trigger individual update
206
+ const changedItemIdx = newData.findIndex((value) => value.item.value === e.target.value);
207
+ if (changedItemIdx >= 0)
208
+ itemChanged(changedItemIdx, newData[changedItemIdx].item, newData[changedItemIdx].isSelected);
209
+ };
210
+ switch (format) {
211
+ case 'multiselect':
212
+ case 'dropdown': {
213
+ const isMulti = format === 'multiselect';
214
+ return (React.createElement(DxLabel, { label: title, description: description, className: className },
215
+ React.createElement("div", { className: `dx-item-group${isMulti ? ' dx-multiselect-group' : ' dx-select-group'}${disabled ? ' disabled' : ''}` },
216
+ React.createElement("select", { multiple: isMulti, disabled: disabled === true, onChange: (e) => selectChanged(e), value: isMulti
217
+ ? (_a = data.filter((item) => item.isSelected)) === null || _a === void 0 ? void 0 : _a.map((item) => item.item.value)
218
+ : (_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)))))));
219
+ }
220
+ case 'checkbox':
221
+ case 'radio':
222
+ default: {
223
+ return (React.createElement(DxLabel, { label: title, description: description, className: `dx-item-group${disabled ? ' disabled' : ''}${className ? ' ' + className : ''}`, useFieldset: true },
224
+ React.createElement("div", { onChange: (e) => {
225
+ var _a;
226
+ const i = data.findIndex((d) => { var _a; return d.item.value === ((_a = e.target) === null || _a === void 0 ? void 0 : _a.value); });
227
+ if (i < 0)
228
+ return;
229
+ itemChanged(i, data[i].item, (_a = e.target) === null || _a === void 0 ? void 0 : _a.checked);
230
+ } }, 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 }))))));
231
+ }
232
+ }
233
+ }
234
+
235
+ var css_248z$8 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.dx-tabbed-content {\n margin: 40px 0;\n}\n.dx-tabbed-content .tab-titles {\n border-bottom: 1px solid var(--theme-core-layout-border-color);\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: var(--theme-core-control-punch-color);\n}\n.dx-tabbed-content .tab-titles .tab-title.active {\n border-bottom-color: var(--theme-core-control-punch-color);\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 var(--theme-core-layout-border-color);\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}";
236
+ styleInject(css_248z$8);
237
+
238
+ function DxTabbedContent(props) {
239
+ const [activeTab, setActiveTab] = useState(props.initialTabId || 0);
240
+ const [titles] = useState(
241
+ // Scrape titles from child elements
242
+ React.Children.toArray(props.children).map((child) => {
243
+ if (!child || !child.props || !child.props.title)
244
+ return 'Unknown title';
245
+ return child.props.title;
246
+ }));
247
+ return (React.createElement("div", { className: `dx-tabbed-content${props.className ? ' ' + props.className : ''}` },
248
+ 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)))),
249
+ React.createElement("div", { className: 'tab-content' }, React.Children.toArray(props.children)[activeTab])));
250
+ }
251
+
252
+ var css_248z$7 = "";
253
+ styleInject(css_248z$7);
254
+
255
+ function DxTabPanel(props) {
256
+ return React.createElement("div", { className: `dx-tab-panel${props.className ? ' ' + props.className : ''}` }, props.children);
257
+ }
258
+
259
+ var css_248z$6 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.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 var(--theme-core-control-border-color);\n border-radius: 2px;\n margin: 0;\n padding: 0 10px;\n height: 32px;\n background-color: var(--theme-core-control-alt-background-color);\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: var(--theme-core-control-textbox-text-color);\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: var(--theme-core-control-textbox-text-color);\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: var(--theme-core-control-textbox-placeholder-text-color);\n}\n.dx-textbox.disabled {\n background-color: var(--theme-dxbutton-secondary-disabled-background-color);\n cursor: not-allowed;\n}\n.dx-textbox.disabled input {\n cursor: not-allowed;\n color: var(--theme-dxbutton-secondary-disabled-text-color);\n}\n.dx-textbox.disabled .icon,\n.dx-textbox.disabled input::placeholder {\n color: var(--theme-dxbutton-secondary-disabled-text-color);\n}\n\n.dx-textarea {\n padding: 10px;\n border: 1px solid var(--theme-core-control-border-color);\n border-radius: 2px;\n width: 100%;\n font-family: \"Roboto\", sans-serif;\n box-sizing: border-box;\n background-color: var(--theme-core-control-alt-background-color);\n color: var(--theme-core-control-textbox-text-color);\n}\n.dx-textarea:focus-within {\n outline: var(--theme-core-control-focus-color) 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: var(--theme-core-control-textbox-placeholder-text-color);\n}";
260
+ styleInject(css_248z$6);
261
+
262
+ function DxTextbox(props) {
263
+ const [debounceMs, setDebounceMs] = useState(props.changeDebounceMs || 300);
264
+ const [value, setValue] = useState(props.initialValue || props.value || '');
265
+ const [isFocused, setIsFocused] = useState(false);
266
+ const [escapePressed, setEscapePressed] = useState(Date.now());
267
+ const [step, setStep] = useState(undefined);
268
+ let [timer, setTimer] = useState(undefined);
269
+ // Constructor
270
+ useEffect(() => {
271
+ // Register global key bindings
272
+ document.addEventListener('keydown', globalKeyBindings, false);
273
+ return () => {
274
+ document.removeEventListener('keydown', globalKeyBindings, false);
275
+ };
276
+ }, []);
277
+ // Value prop updated
278
+ useEffect(() => {
279
+ // Ignore value changed if initial value was set; they're mutually exclusive
280
+ if (!props.initialValue) {
281
+ setValue(props.value || '');
282
+ }
283
+ }, [props.value]);
284
+ // Escape pressed
285
+ useEffect(() => {
286
+ var _a;
287
+ if (!isFocused || props.clearOnEscape === false)
288
+ return;
289
+ setValue('');
290
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.blur();
291
+ // eslint-disable-next-line react-hooks/exhaustive-deps
292
+ }, [escapePressed]);
293
+ // Value changed
294
+ useEffect(() => {
295
+ if (props.inputType === 'decimal') {
296
+ // Normalize step setting
297
+ if (!isNaN(parseFloat(value))) {
298
+ const match = /\.(.+)/.exec(value);
299
+ console.log(match);
300
+ if (match) {
301
+ const s = `0.${Array.apply(null, Array(match[1].length - 1))
302
+ .map(() => '0')
303
+ .join('')}1`;
304
+ console.log(s);
305
+ setStep(s);
306
+ }
307
+ }
308
+ }
309
+ else if (props.inputType === 'integer') {
310
+ // Overwrite value as integer to forcibly truncate floating point numbers
311
+ setValue(parseInt(value).toString());
312
+ }
313
+ // Debounce onChange notification
314
+ if (!props.onChange)
315
+ return;
316
+ clearTimeout(timer);
317
+ setTimer(setTimeout(() => (props.onChange ? props.onChange(value) : undefined), debounceMs));
318
+ // eslint-disable-next-line react-hooks/exhaustive-deps
319
+ }, [value]);
320
+ // Update state from props
321
+ useEffect(() => {
322
+ setDebounceMs(props.changeDebounceMs || 300);
323
+ }, [props.changeDebounceMs]);
324
+ // Normalize inputRef
325
+ let inputRef; // = useRef<HTMLInputElement>(null);
326
+ if (props.inputRef)
327
+ inputRef = props.inputRef;
328
+ else if (props.inputType === 'textarea')
329
+ inputRef = useRef(null);
330
+ else
331
+ inputRef = useRef(null);
332
+ const hasLabel = props.label && props.label !== '';
333
+ // Global key bindings
334
+ function globalKeyBindings(event) {
335
+ // Escape - cancel search
336
+ if (event.key === 'Escape') {
337
+ event.stopPropagation();
338
+ event.preventDefault();
339
+ setEscapePressed(Date.now());
340
+ return;
341
+ }
342
+ }
343
+ // Normalize input type
344
+ let inputType = props.inputType;
345
+ if (inputType === 'integer' || inputType === 'decimal')
346
+ inputType = 'number';
347
+ let component;
348
+ switch (inputType) {
349
+ case 'textarea': {
350
+ component = (React.createElement("textarea", { className: "dx-textarea", placeholder: props.placeholder, ref: inputRef, value: value, onChange: (e) => setValue(e.target.value), onFocus: () => {
351
+ setIsFocused(true);
352
+ if (props.onFocus)
353
+ props.onFocus();
354
+ }, onBlur: () => {
355
+ setIsFocused(false);
356
+ if (props.onBlur)
357
+ props.onBlur();
358
+ }, disabled: props.disabled === true, autoFocus: props.autoFocus }));
359
+ break;
360
+ }
361
+ // TODO: special handling for other inputType values
362
+ default: {
363
+ component = (React.createElement("div", { className: `dx-textbox${hasLabel ? ' with-label' : ''}${props.disabled ? ' disabled' : ''}` },
364
+ props.icon ? React.createElement(GenesysDevIcon, { icon: props.icon, className: "input-icon" }) : undefined,
365
+ React.createElement("input", { className: "dx-input", type: inputType, step: step, value: value, placeholder: props.placeholder, onChange: (e) => setValue(e.target.value), ref: inputRef, onFocus: () => {
366
+ setIsFocused(true);
367
+ if (props.onFocus)
368
+ props.onFocus();
369
+ }, onBlur: () => {
370
+ setIsFocused(false);
371
+ if (props.onBlur)
372
+ props.onBlur();
373
+ }, disabled: props.disabled === true, autoFocus: props.autoFocus }),
374
+ props.clearButton && (value || isFocused) && !props.disabled ? (React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppTimes, className: "clear-icon", onClick: () => setValue('') })) : undefined));
375
+ }
376
+ }
377
+ // Render
378
+ return (React.createElement(DxLabel, { label: props.label, description: props.description, className: props.className }, component));
379
+ }
380
+
381
+ var css_248z$5 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.dx-toggle-container {\n display: inline-block;\n}\n.dx-toggle-container .dx-toggle {\n border: 1px solid var(--theme-core-control-border-color);\n background: var(--theme-core-control-background-color);\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: var(--theme-core-control-focus-color);\n}\n.dx-toggle-container .dx-toggle .icon {\n font-size: 10px;\n line-height: 0;\n margin: 0 5px;\n color: var(--theme-core-control-border-color);\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: var(--theme-core-control-punch-color);\n box-shadow: 0px 1px 2px var(--theme-core-box-shadow-color);\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: var(--theme-core-control-background-color);\n padding: 0;\n margin: 0;\n}\n.dx-toggle-container.disabled .dx-toggle {\n cursor: not-allowed;\n opacity: 0.7;\n border-color: var(--theme-core-control-border-color);\n color: var(--theme-core-control-background-color);\n}\n.dx-toggle-container.disabled .dx-toggle:hover .slider {\n border-color: transparent;\n}\n.dx-toggle-container.disabled .dx-toggle .slider {\n opacity: 0.7;\n color: var(--theme-core-control-background-color);\n background-color: var(--theme-core-control-punch-color);\n}";
382
+ styleInject(css_248z$5);
383
+
384
+ function DxToggle(props) {
385
+ let initialValue = props.value !== undefined ? props.value : props.initialValue;
386
+ if (!props.isTriState)
387
+ initialValue = initialValue || false;
388
+ const [value, setValue] = useState(initialValue);
389
+ const trueIcon = props.trueIcon || GenesysDevIcons.AppCheck;
390
+ const falseIcon = props.falseIcon || GenesysDevIcons.AppTimes;
391
+ useEffect(() => {
392
+ if (props.initialValue || props.value === value || (!props.isTriState && props.value === undefined))
393
+ return;
394
+ setValue(props.value);
395
+ }, [props.value]);
396
+ useEffect(() => {
397
+ if (props.onChange)
398
+ props.onChange(value);
399
+ // eslint-disable-next-line react-hooks/exhaustive-deps
400
+ }, [value]);
401
+ const toggleValue = () => {
402
+ if (props.disabled)
403
+ return;
404
+ if (props.isTriState) {
405
+ if (value === undefined)
406
+ setValue(true);
407
+ else if (value === true)
408
+ setValue(false);
409
+ else
410
+ setValue(undefined);
411
+ }
412
+ else {
413
+ setValue(!value);
414
+ }
415
+ };
416
+ return (React.createElement(DxLabel, { label: props.label, description: props.description, className: props.className },
417
+ React.createElement("div", { className: `dx-toggle-container${props.disabled ? ' disabled' : ''}` },
418
+ React.createElement("div", { className: 'dx-toggle', onClick: toggleValue },
419
+ value !== false ? React.createElement(GenesysDevIcon, { icon: falseIcon }) : undefined,
420
+ value === true && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
421
+ React.createElement("div", { className: 'slider' }, value !== undefined ? React.createElement(GenesysDevIcon, { icon: value ? trueIcon : falseIcon }) : undefined),
422
+ value === false && props.isTriState ? React.createElement("div", { className: 'clear-placeholder' }, "\u00A0") : undefined,
423
+ value !== true ? React.createElement(GenesysDevIcon, { icon: trueIcon }) : undefined))));
424
+ }
425
+
426
+ var css_248z$4 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\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}";
427
+ styleInject(css_248z$4);
428
+
429
+ function AlertBlock(props) {
430
+ const isCollapsible = props.collapsible === false ? false : props.collapsible || props.autoCollapse || false;
431
+ const [isCollapsed, setIsCollapsed] = useState(isCollapsible ? props.autoCollapse || false : false);
432
+ let title;
433
+ if (props.title) {
434
+ title = (React.createElement("div", { className: `alert-title${isCollapsible ? ' clickable' : ''}${isCollapsed ? ' collapsed' : ''}`, onClick: isCollapsible ? () => setIsCollapsed(!isCollapsed) : undefined }, props.title));
435
+ }
436
+ let icon;
437
+ switch (props.alertType) {
438
+ case 'info': {
439
+ icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppInfoSolid });
440
+ break;
441
+ }
442
+ case 'success': {
443
+ icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppSuccessSolid });
444
+ break;
445
+ }
446
+ case 'critical': {
447
+ icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppCriticalSolid });
448
+ break;
449
+ }
450
+ case 'warning': {
451
+ icon = React.createElement(GenesysDevIcon, { className: "info-icon", icon: GenesysDevIcons.AppWarnSolid });
452
+ break;
453
+ }
454
+ }
455
+ if (icon && isCollapsible) {
456
+ icon = (React.createElement("span", { className: "clickable", onClick: () => setIsCollapsed(!isCollapsed) }, icon));
457
+ }
458
+ //TODO: remove the card fence classes and build a proper collapser
459
+ return (React.createElement("div", { className: `alert-container${props.indentation && props.indentation > 0 ? ` indent-${props.indentation}` : ''} ${props.className || ''}` },
460
+ React.createElement("div", { className: `alert alert-${props.alertType}`, role: "alert" },
461
+ icon,
462
+ React.createElement("div", { className: "alert-content" },
463
+ title,
464
+ isCollapsed ? undefined : React.createElement("div", null, props.children)),
465
+ isCollapsible ? (React.createElement("span", { className: "clickable", onClick: () => setIsCollapsed(!isCollapsed) },
466
+ React.createElement(GenesysDevIcon, { icon: isCollapsed ? GenesysDevIcons.AppChevronDown : GenesysDevIcons.AppChevronUp }))) : undefined)));
467
+ }
468
+
469
+ var css_248z$3 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\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 text-align: 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}";
470
+ styleInject(css_248z$3);
471
+
472
+ // SimCity loading messages! https://gist.github.com/erikcox/7e96d031d00d7ecb1a2f
473
+ const MESSAGES = [
474
+ 'Adding Hidden Agendas',
475
+ 'Adjusting Bell Curves',
476
+ 'Aesthesizing Industrial Areas',
477
+ 'Aligning Covariance Matrices',
478
+ 'Applying Feng Shui Shaders',
479
+ 'Applying Theatre Soda Layer',
480
+ 'Asserting Packed Exemplars',
481
+ 'Attempting to Lock Back-Buffer',
482
+ 'Binding Sapling Root System',
483
+ 'Building Data Trees',
484
+ 'Bureacritizing Bureaucracies',
485
+ 'Calculating Inverse Probability Matrices',
486
+ 'Calculating Llama Expectoration Trajectory',
487
+ 'Calibrating Blue Skies',
488
+ 'Charging Ozone Layer',
489
+ 'Coalescing Cloud Formations',
490
+ 'Cohorting Exemplars',
491
+ 'Collecting Meteor Particles',
492
+ 'Compounding Inert Tessellations',
493
+ 'Compressing Fish Files',
494
+ 'Computing Optimal Bin Packing',
495
+ 'Concatenating Sub-Contractors',
496
+ 'Containing Existential Buffer',
497
+ 'Debunching Unionized Commercial Services',
498
+ 'Deciding What Message to Display Next',
499
+ 'Decomposing Singular Values',
500
+ 'Decrementing Tectonic Plates',
501
+ 'Deleting Ferry Routes',
502
+ 'Depixelating Inner Mountain Surface Back Faces',
503
+ 'Deunionizing Bulldozers',
504
+ 'Dicing Models',
505
+ 'Diluting Livestock Nutrition Variables',
506
+ 'Downloading Satellite Terrain Data',
507
+ 'Exposing Flash Variables to Streak System',
508
+ 'Extracting Resources',
509
+ 'Flushing Pipe Network',
510
+ 'Gathering Particle Sources',
511
+ 'Generating Jobs',
512
+ 'Gesticulating Mimes',
513
+ 'Graphing Whale Migration',
514
+ 'Hiding Willio Webnet Mask',
515
+ 'Increasing Accuracy of RCI Simulators',
516
+ 'Increasing Magmafacation',
517
+ 'Initializing My Sim Tracking Mechanism',
518
+ 'Initializing Robotic Click-Path AI',
519
+ 'Inserting Sublimated Messages',
520
+ 'Integrating Curves',
521
+ 'Integrating Illumination Form Factors',
522
+ 'Integrating Population Graphs',
523
+ 'Iterating Cellular Automata',
524
+ 'Lecturing Errant Subsystems',
525
+ 'Modeling Object Components',
526
+ 'Mopping Occupant Leaks',
527
+ 'Normalizing Power',
528
+ 'Obfuscating Quigley Matrix',
529
+ 'Partitioning Singularities',
530
+ 'Perturbing Matrices',
531
+ 'Polishing Water Highlights',
532
+ 'Populating Lot Templates',
533
+ 'Preparing Sprites for Random Walks',
534
+ 'Prioritizing Landmarks',
535
+ 'Projecting Law Enforcement Pastry Intake',
536
+ 'Realigning Alternate Time Frames',
537
+ 'Relaxing Splines',
538
+ 'Removing Road Network Speed Bumps',
539
+ 'Removing Texture Gradients',
540
+ 'Removing Vehicle Avoidance Behavior',
541
+ 'Reticulating Splines',
542
+ 'Retracting Phong Shader',
543
+ 'Retrieving from Back Store',
544
+ 'Reverse Engineering Image Consultant',
545
+ 'Routing Neural Network Infanstructure',
546
+ 'Scattering Rhino Food Sources',
547
+ 'Scrubbing Terrain',
548
+ 'Searching for Llamas',
549
+ 'Seeding Architecture Simulation Parameters',
550
+ 'Sequencing Particles',
551
+ 'Setting Advisor Moods',
552
+ 'Setting Inner Deity Indicators',
553
+ 'Setting Universal Physical Constants',
554
+ 'Sonically Enhancing Occupant-Free Timber',
555
+ 'Speculating Stock Market Indices',
556
+ 'Splatting Transforms',
557
+ 'Stratifying Ground Layers',
558
+ 'Sub-Sampling Water Data',
559
+ 'Synthesizing Gravity',
560
+ 'Synthesizing Wavelets',
561
+ 'Time-Compressing Simulator Clock',
562
+ 'Unable to Reveal Current Activity',
563
+ ];
564
+ function LoadingPlaceholder(props) {
565
+ return (React.createElement("div", { className: "loading-placeholder" },
566
+ React.createElement("span", { className: "text" }, props.text || MESSAGES[Math.floor(Math.random() * (MESSAGES.length - 1))]),
567
+ React.createElement("div", null),
568
+ React.createElement("div", null)));
569
+ }
570
+
571
+ var css_248z$2 = "/* 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}";
572
+ styleInject(css_248z$2);
573
+
574
+ // Inspired by https://paladini.dev/posts/how-to-make-an-extremely-reusable-tooltip-component-with-react--and-nothing-else/
575
+ function Tooltip(props) {
576
+ const [isShowing, setIsShowing] = useState(false);
577
+ const timeout = useRef();
578
+ useEffect(() => {
579
+ if (props.isShowing === undefined)
580
+ return;
581
+ setIsShowing(props.isShowing === true);
582
+ }, [props.isShowing]);
583
+ const showTip = (e) => {
584
+ // Ignore mouse events from the tooltip itself
585
+ if (e.target.className.includes('tooltip-tip'))
586
+ return;
587
+ // Ignore mouse events when manually controlled
588
+ if (props.isShowing !== undefined)
589
+ return;
590
+ timeout.current = setTimeout(() => {
591
+ setIsShowing(true);
592
+ }, 100);
593
+ };
594
+ const hideTip = () => {
595
+ if (props.isShowing !== undefined)
596
+ return;
597
+ if (timeout.current)
598
+ clearInterval(timeout.current);
599
+ setIsShowing(false);
600
+ };
601
+ return (React.createElement("div", { className: `tooltip-container ${props.className || ''}`, onMouseEnter: showTip, onMouseLeave: hideTip },
602
+ props.children,
603
+ React.createElement("div", { className: `tooltip-tip ${props.position || 'top'}${isShowing ? ' visible' : ''}` }, props.text)));
604
+ }
605
+
606
+ var css_248z$1 = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.copy-button {\n cursor: pointer;\n border: 0;\n background: transparent;\n color: var(--theme-core-text-color);\n}";
607
+ styleInject(css_248z$1);
608
+
609
+ function CopyButton(props) {
610
+ let [copyState, setCopyState] = useState(false);
611
+ // 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'
612
+ const copyCode = (e) => {
613
+ e.stopPropagation();
614
+ setCopyState(true);
615
+ navigator.clipboard.writeText(props.copyText);
616
+ return;
617
+ };
618
+ // 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 ''
619
+ const loseFocus = () => {
620
+ setCopyState(false);
621
+ return;
622
+ };
623
+ const buttonClasses = ['copy-button'];
624
+ if (props.className)
625
+ buttonClasses.push(props.className);
626
+ return (React.createElement(React.Fragment, null,
627
+ React.createElement(Tooltip, { isShowing: copyState, text: "Copied", position: props.tooltipPosition },
628
+ React.createElement("button", { type: "button", className: buttonClasses.join(' '), onClick: copyCode, onMouseOut: loseFocus },
629
+ React.createElement(GenesysDevIcon, { icon: GenesysDevIcons.AppCopy })))));
630
+ }
631
+
632
+ var css_248z = "/*** \n * Core colors\n ***/\n/*** \n\t* Component-specific properties \n\t***/\n/*** \n\t* Theme definitions\n\t***/\n.fence {\n border-radius: 0;\n margin: 40px 0;\n position: relative;\n}\n.fence.json-editor-fence {\n margin: 1rem 0 0 0;\n height: 80%;\n width: 100%;\n overflow: hidden;\n}\n.fence .fence-header {\n background-color: var(--theme-codefence-header-background-color);\n color: var(--theme-codefence-header-text-color);\n font-size: 14px;\n border-radius: 4px 4px 0px 0px;\n border-bottom: 1px solid var(--theme-codefence-border-color);\n margin: 0;\n padding: 5px 16px;\n min-height: 24px;\n display: flex;\n flex-direction: row-reverse;\n flex-wrap: nowrap;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n}\n.fence .fence-header.clickable {\n cursor: pointer;\n}\n.fence .fence-header > * {\n flex-grow: 0;\n flex-shrink: 0;\n}\n.fence .fence-header .copy-button {\n font-size: 14px;\n padding: 0;\n color: var(--theme-codefence-header-text-color);\n}\n.fence .fence-header .fence-title {\n flex-grow: 1;\n}\n.fence .fence-header .icon {\n line-height: 0;\n}\n.fence .fence-body {\n padding: 0;\n overflow: auto;\n border-radius: 0 0 4px 4px;\n}\n.fence .fence-body.json-editor-body {\n height: 100%;\n line-height: 21px;\n}\n.fence .fence-body.collapsed {\n max-height: 15px;\n}\n.fence .fence-body.collapsed pre {\n padding-top: 3px;\n}\n.fence .fence-body pre {\n display: block;\n margin: 0 !important;\n padding: 0 !important;\n border-radius: 0 0 4px 4px;\n background: var(--theme-codefence-background-color) !important;\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n}\n.fence .fence-body pre.json-editor-pre {\n height: 100%;\n width: 100%;\n box-sizing: border-box;\n}\n.fence .fence-body pre code {\n background-color: transparent;\n max-height: 600px;\n color: white;\n}\n.fence .fence-body pre code .linenumber {\n min-width: 26px !important;\n}";
633
+ styleInject(css_248z);
634
+
635
+ function CodeFence(props) {
636
+ const [collapsed, setCollapsed] = useState(props.noCollapse ? false : props.autoCollapse || false);
637
+ const bodyClassNames = ['fence-body'];
638
+ if (props.jsonEditor)
639
+ bodyClassNames.push('json-editor-body');
640
+ const classNames = ['fence'];
641
+ if (props.className)
642
+ classNames.push(props.className);
643
+ if (props.noCollapse)
644
+ classNames.push('nocollapse');
645
+ if (props.indentation)
646
+ classNames.push(`indent-${props.indentation}`);
647
+ if (props.jsonEditor)
648
+ classNames.push('json-editor-fence');
649
+ return (React.createElement("div", { className: classNames.join(' ') },
650
+ props.noHeader || typeof props.value !== 'string' ? ('') : (React.createElement("div", { className: `fence-header${props.noCollapse ? '' : ' clickable'}`, onClick: () => setCollapsed(props.noCollapse ? false : !collapsed) },
651
+ props.noCollapse ? undefined : (React.createElement(GenesysDevIcon, { icon: collapsed ? GenesysDevIcons.AppChevronDown : GenesysDevIcons.AppChevronUp })),
652
+ React.createElement(CopyButton, { copyText: props.value }),
653
+ React.createElement("span", { className: "fence-title" }, props.title))),
654
+ collapsed ? undefined : (React.createElement("div", { ref: props.innerRef || undefined, className: bodyClassNames.join(' ') },
655
+ React.createElement(PrismAsync, { language: props.language, style: vscDarkPlus, showLineNumbers: props.showLineNumbers }, props.value)))));
656
+ }
657
+
658
+ export { AlertBlock, CodeFence, CopyButton, DxAccordion, DxAccordionGroup, DxButton, DxCheckbox, DxItemGroup, DxLabel, DxTabPanel, DxTabbedContent, DxTextbox, DxToggle, LoadingPlaceholder, Tooltip };
659
+ //# sourceMappingURL=index.js.map