@deviceinsight/ng-ui-basic-components 7.17.0 → 7.19.0

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/dist/index.js CHANGED
@@ -1,894 +1,841 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import * as React from "react";
3
- import React__default, { useRef, useEffect, useState, createContext, useContext } from "react";
1
+ import * as React$1 from "react";
2
+ import React, { createContext, useContext, useEffect, useRef, useState } from "react";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import cx from "classnames";
5
- import { withTranslation, Trans, useTranslation } from "react-i18next";
5
+ import { Trans, useTranslation, withTranslation } from "react-i18next";
6
6
  import ReactDOM from "react-dom";
7
7
  import Draggable from "react-draggable";
8
- import { useFloating, autoUpdate, offset, flip, shift, size, arrow, useClick, useHover, safePolygon, useFocus, useDismiss, useInteractions, FloatingPortal } from "@floating-ui/react";
9
- class Accordion extends React.Component {
10
- state = {
11
- currentPageIndex: -1
12
- };
13
- componentDidMount() {
14
- const { defaultOpenPageIndex } = this.props;
15
- if (defaultOpenPageIndex !== null && defaultOpenPageIndex !== void 0) {
16
- this.handleAccordionToggle(defaultOpenPageIndex);
17
- }
18
- }
19
- handleAccordionToggle = (index) => {
20
- const { onPageChange } = this.props;
21
- const newPageIndex = this.state.currentPageIndex !== index ? index : -1;
22
- this.setState({
23
- currentPageIndex: newPageIndex
24
- });
25
- if (onPageChange) {
26
- onPageChange(newPageIndex);
27
- }
28
- };
29
- render() {
30
- const { children, accordionClass } = this.props;
31
- const { currentPageIndex } = this.state;
32
- return /* @__PURE__ */ jsx("div", { className: accordionClass ? `di accordion ${accordionClass}` : "di accordion", children: children && children.map(
33
- (child, index) => child ? /* @__PURE__ */ jsx(
34
- child.type,
35
- {
36
- index,
37
- isOpen: currentPageIndex === index,
38
- toggle: () => this.handleAccordionToggle(index),
39
- ...child.props
40
- },
41
- index
42
- ) : null
43
- ) });
44
- }
45
- }
46
- class AccordionItem extends React.PureComponent {
47
- render() {
48
- const { badge, children, isOpen, info1, itemClasses, title, titleTooltip, toggle, tools, ...rest } = this.props;
49
- const accordionItemClasses = ["item"];
50
- if (itemClasses) accordionItemClasses.push(itemClasses);
51
- if (isOpen) accordionItemClasses.push("open");
52
- return /* @__PURE__ */ jsxs("div", { className: accordionItemClasses.join(" "), children: [
53
- /* @__PURE__ */ jsxs("div", { className: "head", children: [
54
- /* @__PURE__ */ jsxs("span", { className: "title", onClick: toggle, "data-testid": rest["data-testid"], children: [
55
- /* @__PURE__ */ jsx("h1", { title: titleTooltip, children: title }),
56
- badge && /* @__PURE__ */ jsx(
57
- "span",
58
- {
59
- className: "di label",
60
- style: {
61
- margin: "0 0 0 10px",
62
- backgroundColor: "#ddd",
63
- borderColor: "transparent"
64
- },
65
- children: badge
66
- }
67
- ),
68
- info1 && /* @__PURE__ */ jsx("span", { style: info1.cssStyle, children: info1.text })
69
- ] }),
70
- /* @__PURE__ */ jsx("span", { className: "tools", children: tools && tools.map((toolComponent, index) => /* @__PURE__ */ jsx("span", { className: "tool", children: toolComponent }, index)) })
71
- ] }),
72
- /* @__PURE__ */ jsx("div", { className: "cont", children })
73
- ] });
74
- }
75
- }
76
- function Button({
77
- children,
78
- title,
79
- type,
80
- disabled,
81
- onClick,
82
- style,
83
- tabIndex,
84
- t,
85
- primary,
86
- danger,
87
- naked,
88
- className,
89
- small,
90
- ...rest
91
- }) {
92
- let btnTitle = title;
93
- if (title && typeof title !== "string") {
94
- btnTitle = t(title.id, {
95
- defaultValue: title.defaultValue
96
- });
97
- }
98
- return /* @__PURE__ */ jsx(
99
- "button",
100
- {
101
- "data-testid": rest["data-testid"],
102
- type: type || "button",
103
- className: cx("di button", className, { small, primary, danger, link: naked }),
104
- title: typeof btnTitle === "string" ? btnTitle : void 0,
105
- disabled,
106
- onClick,
107
- style,
108
- tabIndex,
109
- children
110
- }
111
- );
112
- }
113
- const Button$1 = withTranslation()(Button);
114
- const ButtonRow = ({ children, dividing, className, style }) => /* @__PURE__ */ jsx("div", { style, className: `di button-row ${dividing ? "dividing" : ""} ${className || ""}`, children });
115
- ButtonRow.defaultProps = {
116
- dividing: false
8
+ import { FloatingPortal, arrow, autoUpdate, flip, offset, safePolygon, shift, size, useClick, useDismiss, useFloating, useFocus, useHover, useInteractions } from "@floating-ui/react";
9
+ //#region src/components/accordion/Accordion.tsx
10
+ /**
11
+ * Accordions are best used to display homogenous information, e.g. multiple configurations which would take up a lot of space otherwise.
12
+ */
13
+ var Accordion = class extends React$1.Component {
14
+ state = { currentPageIndex: -1 };
15
+ componentDidMount() {
16
+ const { defaultOpenPageIndex } = this.props;
17
+ if (defaultOpenPageIndex !== null && defaultOpenPageIndex !== void 0) this.handleAccordionToggle(defaultOpenPageIndex);
18
+ }
19
+ handleAccordionToggle = (index) => {
20
+ const { onPageChange } = this.props;
21
+ const newPageIndex = this.state.currentPageIndex !== index ? index : -1;
22
+ this.setState({ currentPageIndex: newPageIndex });
23
+ if (onPageChange) onPageChange(newPageIndex);
24
+ };
25
+ render() {
26
+ const { children, accordionClass } = this.props;
27
+ const { currentPageIndex } = this.state;
28
+ return /* @__PURE__ */ jsx("div", {
29
+ className: accordionClass ? `di accordion ${accordionClass}` : "di accordion",
30
+ children: children && children.map((child, index) => child ? /* @__PURE__ */ jsx(child.type, {
31
+ index,
32
+ isOpen: currentPageIndex === index,
33
+ toggle: () => this.handleAccordionToggle(index),
34
+ ...child.props
35
+ }, index) : null)
36
+ });
37
+ }
117
38
  };
118
- const isTouchEvent = (event) => {
119
- return !!event.touches;
39
+ //#endregion
40
+ //#region src/components/accordionComponents/AccordionItem.tsx
41
+ var AccordionItem = class extends React$1.PureComponent {
42
+ render() {
43
+ const { badge, children, isOpen, info1, itemClasses, title, titleTooltip, toggle, tools, ...rest } = this.props;
44
+ const accordionItemClasses = ["item"];
45
+ if (itemClasses) accordionItemClasses.push(itemClasses);
46
+ if (isOpen) accordionItemClasses.push("open");
47
+ return /* @__PURE__ */ jsxs("div", {
48
+ className: accordionItemClasses.join(" "),
49
+ children: [/* @__PURE__ */ jsxs("div", {
50
+ className: "head",
51
+ children: [/* @__PURE__ */ jsxs("span", {
52
+ className: "title",
53
+ onClick: toggle,
54
+ "data-testid": rest["data-testid"],
55
+ children: [
56
+ /* @__PURE__ */ jsx("h1", {
57
+ title: titleTooltip,
58
+ children: title
59
+ }),
60
+ badge && /* @__PURE__ */ jsx("span", {
61
+ className: "di label",
62
+ style: {
63
+ margin: "0 0 0 10px",
64
+ backgroundColor: "#ddd",
65
+ borderColor: "transparent"
66
+ },
67
+ children: badge
68
+ }),
69
+ info1 && /* @__PURE__ */ jsx("span", {
70
+ style: info1.cssStyle,
71
+ children: info1.text
72
+ })
73
+ ]
74
+ }), /* @__PURE__ */ jsx("span", {
75
+ className: "tools",
76
+ children: tools && tools.map((toolComponent, index) => /* @__PURE__ */ jsx("span", {
77
+ className: "tool",
78
+ children: toolComponent
79
+ }, index))
80
+ })]
81
+ }), /* @__PURE__ */ jsx("div", {
82
+ className: "cont",
83
+ children
84
+ })]
85
+ });
86
+ }
87
+ };
88
+ //#endregion
89
+ //#region src/components/button/Button.tsx
90
+ /**
91
+ * Buttons are used to inform the user about a potential user interaction, which then on interaction causes an action.
92
+ * To create a standardized look and feel, different props can be passed to the Button.
93
+ */
94
+ function Button({ children, title, type, disabled, onClick, style, tabIndex, t, primary, danger, naked, className, small, ...rest }) {
95
+ let btnTitle = title;
96
+ if (title && typeof title !== "string") btnTitle = t(title.id, { defaultValue: title.defaultValue });
97
+ return /* @__PURE__ */ jsx("button", {
98
+ "data-testid": rest["data-testid"],
99
+ type: type || "button",
100
+ className: cx("di button", className, {
101
+ small,
102
+ primary,
103
+ danger,
104
+ link: naked
105
+ }),
106
+ title: typeof btnTitle === "string" ? btnTitle : void 0,
107
+ disabled,
108
+ onClick,
109
+ style,
110
+ tabIndex,
111
+ children
112
+ });
113
+ }
114
+ var Button_default = withTranslation()(Button);
115
+ //#endregion
116
+ //#region src/components/button/ButtonRow.tsx
117
+ /**
118
+ * ButtonRows align Buttons nicely for all relevant and/or related user actions such as saving or canceling changes.
119
+ * To separate the ButtonRow from the content, the extra property `dividing` can be used.
120
+ */
121
+ var ButtonRow = ({ children, dividing, className, style }) => /* @__PURE__ */ jsx("div", {
122
+ style,
123
+ className: `di button-row ${dividing ? "dividing" : ""} ${className || ""}`,
124
+ children
125
+ });
126
+ ButtonRow.defaultProps = { dividing: false };
127
+ //#endregion
128
+ //#region src/hooks/useOutsideClick.ts
129
+ var isTouchEvent = (event) => {
130
+ return !!event.touches;
120
131
  };
121
- const isInsideBoundingRect = (element, event) => {
122
- const rect = element.getBoundingClientRect();
123
- let x, y;
124
- if (isTouchEvent(event)) {
125
- x = event.touches[0].pageX;
126
- y = event.touches[0].pageY;
127
- } else {
128
- x = event.pageX;
129
- y = event.pageY;
130
- }
131
- return rect.left <= x && rect.right >= x && rect.top <= y && rect.bottom >= y;
132
+ var isInsideBoundingRect = (element, event) => {
133
+ const rect = element.getBoundingClientRect();
134
+ let x, y;
135
+ if (isTouchEvent(event)) {
136
+ x = event.touches[0].pageX;
137
+ y = event.touches[0].pageY;
138
+ } else {
139
+ x = event.pageX;
140
+ y = event.pageY;
141
+ }
142
+ return rect.left <= x && rect.right >= x && rect.top <= y && rect.bottom >= y;
132
143
  };
133
- const useOutsideClick = (elements, callback) => {
134
- const callbackRef = useRef(callback);
135
- useEffect(() => {
136
- callbackRef.current = callback;
137
- }, [callback]);
138
- useEffect(() => {
139
- const listener = (event) => {
140
- const elementsNonNull = elements.filter((element) => element != null);
141
- if (elementsNonNull.every(
142
- (element) => element !== event.target && !element.contains(event.target) && !isInsideBoundingRect(element, event)
143
- )) {
144
- callbackRef.current(event);
145
- }
146
- };
147
- document.addEventListener("mousedown", listener, true);
148
- document.addEventListener("touchstart", listener, true);
149
- return () => {
150
- document.removeEventListener("mousedown", listener, true);
151
- document.removeEventListener("touchstart", listener, true);
152
- };
153
- }, [elements]);
144
+ var useOutsideClick = (elements, callback) => {
145
+ const callbackRef = useRef(callback);
146
+ useEffect(() => {
147
+ callbackRef.current = callback;
148
+ }, [callback]);
149
+ useEffect(() => {
150
+ const listener = (event) => {
151
+ if (elements.filter((element) => element != null).every((element) => element !== event.target && !element.contains(event.target) && !isInsideBoundingRect(element, event))) callbackRef.current(event);
152
+ };
153
+ document.addEventListener("mousedown", listener, true);
154
+ document.addEventListener("touchstart", listener, true);
155
+ return () => {
156
+ document.removeEventListener("mousedown", listener, true);
157
+ document.removeEventListener("touchstart", listener, true);
158
+ };
159
+ }, [elements]);
154
160
  };
161
+ //#endregion
162
+ //#region src/components/modalComponents/ModalWindow.tsx
155
163
  function ModalWindow({ className, width, header, content, footer, onOutsideClick }) {
156
- const ref = useRef(null);
157
- const [rootElement, setRootElement] = useState(null);
158
- useEffect(() => {
159
- setRootElement(ref.current);
160
- }, []);
161
- useOutsideClick([rootElement], () => {
162
- if (onOutsideClick) onOutsideClick();
163
- });
164
- return /* @__PURE__ */ jsx(Draggable, { handle: ".modal-header", nodeRef: ref, children: /* @__PURE__ */ jsxs(
165
- "div",
166
- {
167
- ref,
168
- className: `modal-window ${className || ""}`,
169
- style: {
170
- maxWidth: width
171
- },
172
- children: [
173
- header && /* @__PURE__ */ jsx("div", { className: "modal-header", children: header }),
174
- content && /* @__PURE__ */ jsx("div", { className: "modal-content", children: content }),
175
- footer && /* @__PURE__ */ jsx("div", { className: "modal-footer", children: footer })
176
- ]
177
- }
178
- ) });
179
- }
180
- class Modal extends React__default.Component {
181
- static defaultProps = {
182
- width: "60%"
183
- };
184
- container;
185
- modalRoot;
186
- timeoutId;
187
- constructor(props) {
188
- super(props);
189
- this.state = {
190
- className: "di modal"
191
- };
192
- }
193
- componentDidMount() {
194
- this.container = document.createElement("div");
195
- this.modalRoot = document.getElementById("modal-root");
196
- if (this.modalRoot) {
197
- this.modalRoot.appendChild(this.container);
198
- } else if (document.body) {
199
- document.body.appendChild(this.container);
200
- }
201
- if (this.props.onOutsideClick) {
202
- window.addEventListener("keydown", this.keyEventHandler);
203
- }
204
- this.timeoutId = setTimeout(
205
- () => this.setState({
206
- className: `di modal show ${this.props.className || ""}`
207
- }),
208
- 10
209
- );
210
- }
211
- componentWillUnmount() {
212
- if (this.container) {
213
- if (this.modalRoot) {
214
- this.modalRoot.removeChild(this.container);
215
- } else if (document.body) {
216
- document.body.removeChild(this.container);
217
- }
218
- }
219
- if (this.props.onOutsideClick) {
220
- window.removeEventListener("keydown", this.keyEventHandler);
221
- }
222
- if (this.timeoutId) {
223
- clearTimeout(this.timeoutId);
224
- }
225
- }
226
- keyEventHandler = (event) => {
227
- if (event.key === "Escape" && this.props.onOutsideClick) {
228
- this.props.onOutsideClick(event);
229
- }
230
- };
231
- render() {
232
- if (!this.container) {
233
- return null;
234
- }
235
- return ReactDOM.createPortal(
236
- /* @__PURE__ */ jsx("div", { className: this.state.className, onMouseDown: this.props.onMouseDown, children: /* @__PURE__ */ jsx(ModalWindow, { ...this.props }) }),
237
- this.container
238
- );
239
- }
240
- }
241
- class ModalContainer extends React__default.PureComponent {
242
- render() {
243
- return /* @__PURE__ */ jsx("div", { id: "modal-root" });
244
- }
245
- }
246
- class Spinner extends React__default.Component {
247
- static defaultProps = {
248
- size: 56,
249
- center: false
250
- };
251
- render() {
252
- const { size: size2 = 56, center, ...dataAttrs } = this.props;
253
- let style = {
254
- width: size2,
255
- height: size2
256
- };
257
- if (center) {
258
- style = {
259
- ...style,
260
- position: "absolute",
261
- top: "50%",
262
- left: "50%",
263
- marginTop: -size2 / 2,
264
- marginLeft: -size2 / 2
265
- };
266
- }
267
- return /* @__PURE__ */ jsx("div", { className: "di spinner", style, ...dataAttrs });
268
- }
269
- }
270
- class SpinnerContainer extends React__default.Component {
271
- static defaultProps = {
272
- size: 56
273
- };
274
- render() {
275
- const { show, size: size2, children, className } = this.props;
276
- const classNames = `di spinner-wrapper ${className ? className : ""}`;
277
- return /* @__PURE__ */ jsxs("div", { className: classNames, children: [
278
- /* @__PURE__ */ jsx(
279
- "div",
280
- {
281
- className: `di spinner-container ${show ? "visible" : ""}`,
282
- "data-testid": this.props["data-testid"],
283
- children: /* @__PURE__ */ jsx(Spinner, { size: size2, center: true })
284
- }
285
- ),
286
- children
287
- ] });
288
- }
164
+ const ref = useRef(null);
165
+ const [rootElement, setRootElement] = useState(null);
166
+ useEffect(() => {
167
+ setRootElement(ref.current);
168
+ }, []);
169
+ useOutsideClick([rootElement], () => {
170
+ if (onOutsideClick) onOutsideClick();
171
+ });
172
+ return /* @__PURE__ */ jsx(Draggable, {
173
+ handle: ".modal-header",
174
+ nodeRef: ref,
175
+ children: /* @__PURE__ */ jsxs("div", {
176
+ ref,
177
+ className: `modal-window ${className || ""}`,
178
+ style: { maxWidth: width },
179
+ children: [
180
+ header && /* @__PURE__ */ jsx("div", {
181
+ className: "modal-header",
182
+ children: header
183
+ }),
184
+ content && /* @__PURE__ */ jsx("div", {
185
+ className: "modal-content",
186
+ children: content
187
+ }),
188
+ footer && /* @__PURE__ */ jsx("div", {
189
+ className: "modal-footer",
190
+ children: footer
191
+ })
192
+ ]
193
+ })
194
+ });
289
195
  }
290
- const getWrapperClassName = (type, small) => {
291
- switch (type) {
292
- case "checkbox":
293
- case "radio":
294
- return "di checkbox";
295
- case "toggle":
296
- return small ? "di toggle toggle-small" : "di toggle";
297
- default:
298
- throw Error(`type not support: ${type}`);
299
- }
196
+ //#endregion
197
+ //#region src/components/modal/Modal.tsx
198
+ var Modal = class extends React.Component {
199
+ static defaultProps = { width: "60%" };
200
+ container;
201
+ modalRoot;
202
+ timeoutId;
203
+ constructor(props) {
204
+ super(props);
205
+ this.state = { className: "di modal" };
206
+ }
207
+ componentDidMount() {
208
+ this.container = document.createElement("div");
209
+ this.modalRoot = document.getElementById("modal-root");
210
+ if (this.modalRoot) this.modalRoot.appendChild(this.container);
211
+ else if (document.body) document.body.appendChild(this.container);
212
+ if (this.props.onOutsideClick) window.addEventListener("keydown", this.keyEventHandler);
213
+ this.timeoutId = setTimeout(() => this.setState({ className: `di modal show ${this.props.className || ""}` }), 10);
214
+ }
215
+ componentWillUnmount() {
216
+ if (this.container) {
217
+ if (this.modalRoot) this.modalRoot.removeChild(this.container);
218
+ else if (document.body) document.body.removeChild(this.container);
219
+ }
220
+ if (this.props.onOutsideClick) window.removeEventListener("keydown", this.keyEventHandler);
221
+ if (this.timeoutId) clearTimeout(this.timeoutId);
222
+ }
223
+ keyEventHandler = (event) => {
224
+ if (event.key === "Escape" && this.props.onOutsideClick) this.props.onOutsideClick(event);
225
+ };
226
+ render() {
227
+ if (!this.container) return null;
228
+ return ReactDOM.createPortal(/* @__PURE__ */ jsx("div", {
229
+ className: this.state.className,
230
+ onMouseDown: this.props.onMouseDown,
231
+ children: /* @__PURE__ */ jsx(ModalWindow, { ...this.props })
232
+ }), this.container);
233
+ }
300
234
  };
301
- const getCheckboxClassName = (type, small) => {
302
- switch (type) {
303
- case "checkbox":
304
- return "box";
305
- case "radio":
306
- return "radio";
307
- case "toggle":
308
- return small ? "switch switch-small" : "switch";
309
- default:
310
- throw Error(`type not support: ${type}`);
311
- }
235
+ //#endregion
236
+ //#region src/components/modalComponents/ModalContainer.tsx
237
+ var ModalContainer = class extends React.PureComponent {
238
+ render() {
239
+ return /* @__PURE__ */ jsx("div", { id: "modal-root" });
240
+ }
312
241
  };
313
- const Checkbox = ({
314
- type = "checkbox",
315
- value,
316
- onChange,
317
- title,
318
- label,
319
- disabled = false,
320
- toggleSmall = false,
321
- toggleColor = "#259b23",
322
- t,
323
- ...other
324
- }) => {
325
- const style = type === "toggle" ? {
326
- backgroundColor: value ? toggleColor : "gray"
327
- } : {};
328
- const tooltip = title ? t(title.id, {
329
- defaultValue: title.defaultValue
330
- }) : void 0;
331
- const labelText = label ? t(label.id, {
332
- defaultValue: label.defaultValue
333
- }) : null;
334
- return /* @__PURE__ */ jsxs(
335
- "label",
336
- {
337
- title: tooltip,
338
- className: getWrapperClassName(type, toggleSmall),
339
- "data-testid": other["wrapper-data-testid"],
340
- children: [
341
- /* @__PURE__ */ jsx(
342
- "input",
343
- {
344
- type: "checkbox",
345
- checked: value,
346
- disabled,
347
- onChange: () => onChange(!value),
348
- "data-testid": other["data-testid"]
349
- }
350
- ),
351
- /* @__PURE__ */ jsx(
352
- "div",
353
- {
354
- className: getCheckboxClassName(type, toggleSmall),
355
- style,
356
- "data-testid": other["innerdiv-data-testid"]
357
- }
358
- ),
359
- label && /* @__PURE__ */ jsx("span", { className: "textlabel", children: labelText })
360
- ]
361
- }
362
- );
242
+ //#endregion
243
+ //#region src/components/spinner/Spinner.tsx
244
+ /**
245
+ * Spinners usually show a loading indication.
246
+ */
247
+ var Spinner = class extends React.Component {
248
+ static defaultProps = {
249
+ size: 56,
250
+ center: false
251
+ };
252
+ render() {
253
+ const { size = 56, center, ...dataAttrs } = this.props;
254
+ let style = {
255
+ width: size,
256
+ height: size
257
+ };
258
+ if (center) style = {
259
+ ...style,
260
+ position: "absolute",
261
+ top: "50%",
262
+ left: "50%",
263
+ marginTop: -size / 2,
264
+ marginLeft: -size / 2
265
+ };
266
+ return /* @__PURE__ */ jsx("div", {
267
+ className: "di spinner",
268
+ style,
269
+ ...dataAttrs
270
+ });
271
+ }
363
272
  };
364
- const Checkbox_default = withTranslation()(Checkbox);
273
+ //#endregion
274
+ //#region src/components/spinner/SpinnerContainer.tsx
275
+ /**
276
+ * SpinnerContainer wraps the entire content and displays a loading indicator until the loading is done.
277
+ */
278
+ var SpinnerContainer = class extends React.Component {
279
+ static defaultProps = { size: 56 };
280
+ render() {
281
+ const { show, size, children, className } = this.props;
282
+ const classNames = `di spinner-wrapper ${className ? className : ""}`;
283
+ return /* @__PURE__ */ jsxs("div", {
284
+ className: classNames,
285
+ children: [/* @__PURE__ */ jsx("div", {
286
+ className: `di spinner-container ${show ? "visible" : ""}`,
287
+ "data-testid": this.props["data-testid"],
288
+ children: /* @__PURE__ */ jsx(Spinner, {
289
+ size,
290
+ center: true
291
+ })
292
+ }), children]
293
+ });
294
+ }
295
+ };
296
+ //#endregion
297
+ //#region src/components/input/Checkbox.tsx
298
+ var getWrapperClassName = (type, small) => {
299
+ switch (type) {
300
+ case "checkbox":
301
+ case "radio": return "di checkbox";
302
+ case "toggle": return small ? "di toggle toggle-small" : "di toggle";
303
+ default: throw Error(`type not support: ${type}`);
304
+ }
305
+ };
306
+ var getCheckboxClassName = (type, small) => {
307
+ switch (type) {
308
+ case "checkbox": return "box";
309
+ case "radio": return "radio";
310
+ case "toggle": return small ? "switch switch-small" : "switch";
311
+ default: throw Error(`type not support: ${type}`);
312
+ }
313
+ };
314
+ /**
315
+ * Checkbox for enabling user interaction can have one of multiple types which are defined via the `type` prop.
316
+ */
317
+ var Checkbox = ({ type = "checkbox", value, onChange, title, label, disabled = false, toggleSmall = false, toggleColor = "#259b23", t, ...other }) => {
318
+ const style = type === "toggle" ? { backgroundColor: value ? toggleColor : "gray" } : {};
319
+ const tooltip = title ? t(title.id, { defaultValue: title.defaultValue }) : void 0;
320
+ const labelText = label ? t(label.id, { defaultValue: label.defaultValue }) : null;
321
+ return /* @__PURE__ */ jsxs("label", {
322
+ title: tooltip,
323
+ className: getWrapperClassName(type, toggleSmall),
324
+ "data-testid": other["wrapper-data-testid"],
325
+ children: [
326
+ /* @__PURE__ */ jsx("input", {
327
+ type: "checkbox",
328
+ checked: value,
329
+ disabled,
330
+ onChange: () => onChange(!value),
331
+ "data-testid": other["data-testid"]
332
+ }),
333
+ /* @__PURE__ */ jsx("div", {
334
+ className: getCheckboxClassName(type, toggleSmall),
335
+ style,
336
+ "data-testid": other["innerdiv-data-testid"]
337
+ }),
338
+ label && /* @__PURE__ */ jsx("span", {
339
+ className: "textlabel",
340
+ children: labelText
341
+ })
342
+ ]
343
+ });
344
+ };
345
+ var Checkbox_default = withTranslation()(Checkbox);
346
+ //#endregion
347
+ //#region src/components/confirm/utils.ts
365
348
  function isTranslationDescriptor(arg) {
366
- const result = typeof arg === "object" && typeof arg.id === "string" && typeof arg.defaultValue === "string";
367
- if (result) {
368
- console.warn(
369
- "Please use strings instead of TranslationDescriptors to initialize the Confirm modal, because TranslationDescriptors are deprecated"
370
- );
371
- }
372
- return result;
349
+ const result = typeof arg === "object" && typeof arg.id === "string" && typeof arg.defaultValue === "string";
350
+ if (result) console.warn("Please use strings instead of TranslationDescriptors to initialize the Confirm modal, because TranslationDescriptors are deprecated");
351
+ return result;
373
352
  }
353
+ //#endregion
354
+ //#region src/components/confirm/Confirm.tsx
374
355
  function transformTextToElement(message) {
375
- if (isTranslationDescriptor(message)) {
376
- return /* @__PURE__ */ jsx(Trans, { i18nKey: message.id, children: message.defaultValue });
377
- }
378
- return message;
356
+ if (isTranslationDescriptor(message)) return /* @__PURE__ */ jsx(Trans, {
357
+ i18nKey: message.id,
358
+ children: message.defaultValue
359
+ });
360
+ return message;
379
361
  }
380
- function Confirm({
381
- title,
382
- message,
383
- onAccept,
384
- onDecline,
385
- acceptButtonLabel,
386
- declineButtonLabel,
387
- acceptButtonStyle = "primary"
388
- }) {
389
- return /* @__PURE__ */ jsx(
390
- Modal,
391
- {
392
- header: transformTextToElement(title),
393
- content: transformTextToElement(message),
394
- footer: /* @__PURE__ */ jsxs("div", { children: [
395
- /* @__PURE__ */ jsx(
396
- Button$1,
397
- {
398
- primary: acceptButtonStyle === "primary",
399
- danger: acceptButtonStyle === "danger",
400
- onClick: onAccept,
401
- children: acceptButtonLabel ? transformTextToElement(acceptButtonLabel) : /* @__PURE__ */ jsx(Trans, { i18nKey: "form.accept", children: "Accept" })
402
- }
403
- ),
404
- /* @__PURE__ */ jsx(Button$1, { onClick: onDecline, children: declineButtonLabel ? transformTextToElement(declineButtonLabel) : /* @__PURE__ */ jsx(Trans, { i18nKey: "form.decline", children: "Decline" }) })
405
- ] }),
406
- width: 500
407
- }
408
- );
362
+ /**
363
+ * Confirm enables the possibility to open up a dialog within a modal, requiring additional user actions.
364
+ * This component should not be used directly, instead use `@withConfirm` to inject a promise based confirm method
365
+ */
366
+ function Confirm({ title, message, onAccept, onDecline, acceptButtonLabel, declineButtonLabel, acceptButtonStyle = "primary" }) {
367
+ return /* @__PURE__ */ jsx(Modal, {
368
+ header: transformTextToElement(title),
369
+ content: transformTextToElement(message),
370
+ footer: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Button_default, {
371
+ primary: acceptButtonStyle === "primary",
372
+ danger: acceptButtonStyle === "danger",
373
+ onClick: onAccept,
374
+ children: acceptButtonLabel ? transformTextToElement(acceptButtonLabel) : /* @__PURE__ */ jsx(Trans, {
375
+ i18nKey: "form.accept",
376
+ children: "Accept"
377
+ })
378
+ }), /* @__PURE__ */ jsx(Button_default, {
379
+ onClick: onDecline,
380
+ children: declineButtonLabel ? transformTextToElement(declineButtonLabel) : /* @__PURE__ */ jsx(Trans, {
381
+ i18nKey: "form.decline",
382
+ children: "Decline"
383
+ })
384
+ })] }),
385
+ width: 500
386
+ });
409
387
  }
410
- const ConfirmContext = createContext({
411
- confirm: () => Promise.reject(new Error("ConfirmProvider is missing!"))
412
- });
388
+ //#endregion
389
+ //#region src/components/confirm/ConfirmProvider.tsx
390
+ var ConfirmContext = createContext({ confirm: () => Promise.reject(/* @__PURE__ */ new Error("ConfirmProvider is missing!")) });
413
391
  function ConfirmProvider({ children }) {
414
- const [visible, setVisible] = useState(false);
415
- const [confirmProps, setConfirmProps] = useState({
416
- title: "",
417
- message: "",
418
- onAccept: () => {
419
- },
420
- onDecline: () => {
421
- }
422
- });
423
- async function confirm(options) {
424
- return new Promise((resolve) => {
425
- setVisible(true);
426
- setConfirmProps({
427
- ...options,
428
- onAccept: () => {
429
- setVisible(false);
430
- resolve(true);
431
- },
432
- onDecline: () => {
433
- setVisible(false);
434
- resolve(false);
435
- }
436
- });
437
- });
438
- }
439
- return /* @__PURE__ */ jsxs(ConfirmContext.Provider, { value: { confirm }, children: [
440
- children,
441
- visible && /* @__PURE__ */ jsx(Confirm, { ...confirmProps })
442
- ] });
392
+ const [visible, setVisible] = useState(false);
393
+ const [confirmProps, setConfirmProps] = useState({
394
+ title: "",
395
+ message: "",
396
+ onAccept: () => {},
397
+ onDecline: () => {}
398
+ });
399
+ async function confirm(options) {
400
+ return new Promise((resolve) => {
401
+ setVisible(true);
402
+ setConfirmProps({
403
+ ...options,
404
+ onAccept: () => {
405
+ setVisible(false);
406
+ resolve(true);
407
+ },
408
+ onDecline: () => {
409
+ setVisible(false);
410
+ resolve(false);
411
+ }
412
+ });
413
+ });
414
+ }
415
+ return /* @__PURE__ */ jsxs(ConfirmContext.Provider, {
416
+ value: { confirm },
417
+ children: [children, visible && /* @__PURE__ */ jsx(Confirm, { ...confirmProps })]
418
+ });
443
419
  }
420
+ //#endregion
421
+ //#region src/components/confirm/useConfirm.ts
444
422
  function useConfirm() {
445
- const context = useContext(ConfirmContext);
446
- if (!context) {
447
- throw new Error("ConfirmProvider is missing");
448
- }
449
- const { confirm } = context;
450
- return confirm;
423
+ const context = useContext(ConfirmContext);
424
+ if (!context) throw new Error("ConfirmProvider is missing");
425
+ const { confirm } = context;
426
+ return confirm;
451
427
  }
428
+ //#endregion
429
+ //#region src/components/confirm/withConfirm.tsx
452
430
  function withConfirm(WrappedComponent) {
453
- function WithConfirm(props) {
454
- const confirm = useConfirm();
455
- const { t } = useTranslation();
456
- function trans(arg) {
457
- if (isTranslationDescriptor(arg)) {
458
- return t(arg.id, { defaultValue: arg.defaultValue });
459
- }
460
- return arg;
461
- }
462
- async function deprecatedConfirm(title, message, acceptButtonLabel, declineButtonLabel, resolveWithConfirmation, acceptButtonStyle) {
463
- const accepted = await confirm({
464
- title: trans(title),
465
- message: isTranslationDescriptor(message) ? trans(message) : message,
466
- acceptButtonLabel: acceptButtonLabel ? trans(acceptButtonLabel) : void 0,
467
- declineButtonLabel: declineButtonLabel ? trans(declineButtonLabel) : void 0,
468
- acceptButtonStyle
469
- });
470
- if (resolveWithConfirmation) {
471
- return accepted;
472
- } else if (!accepted) {
473
- return new Promise(() => {
474
- });
475
- }
476
- }
477
- return /* @__PURE__ */ jsx(WrappedComponent, { ...props, confirm: deprecatedConfirm });
478
- }
479
- return function WithConfirmWrapper(props) {
480
- return /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(WithConfirm, { ...props }) });
481
- };
431
+ function WithConfirm(props) {
432
+ const confirm = useConfirm();
433
+ const { t } = useTranslation();
434
+ function trans(arg) {
435
+ if (isTranslationDescriptor(arg)) return t(arg.id, { defaultValue: arg.defaultValue });
436
+ return arg;
437
+ }
438
+ async function deprecatedConfirm(title, message, acceptButtonLabel, declineButtonLabel, resolveWithConfirmation, acceptButtonStyle) {
439
+ const accepted = await confirm({
440
+ title: trans(title),
441
+ message: isTranslationDescriptor(message) ? trans(message) : message,
442
+ acceptButtonLabel: acceptButtonLabel ? trans(acceptButtonLabel) : void 0,
443
+ declineButtonLabel: declineButtonLabel ? trans(declineButtonLabel) : void 0,
444
+ acceptButtonStyle
445
+ });
446
+ if (resolveWithConfirmation) return accepted;
447
+ else if (!accepted) return new Promise(() => {});
448
+ }
449
+ return /* @__PURE__ */ jsx(WrappedComponent, {
450
+ ...props,
451
+ confirm: deprecatedConfirm
452
+ });
453
+ }
454
+ return function WithConfirmWrapper(props) {
455
+ return /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(WithConfirm, { ...props }) });
456
+ };
482
457
  }
483
- const iconAdd = "data:image/svg+xml,%3csvg%20id='icon-add_24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpolygon%20id='plus'%20points='20%2010%2014%2010%2014%204%2010%204%2010%2010%204%2010%204%2014%2010%2014%2010%2020%2014%2020%2014%2014%2020%2014%2020%2010'/%3e%3c/svg%3e";
484
- const iconDel = "data:image/svg+xml,%3csvg%20id='icon-cross_24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpolygon%20id='icon-cross_24'%20points='20%206.28%2017.87%204%2012%209.78%206.13%204%204%206.28%209.78%2011.97%204%2017.66%206.13%2019.93%2012%2014.15%2017.87%2019.93%2020%2017.66%2014.22%2011.97%2020%206.28'/%3e%3c/svg%3e";
485
- const iconEdit = "data:image/svg+xml,%3csvg%20id='icon-edit-24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='stift'%3e%3cpath%20d='M7.35,12.65a.5.5,0,0,0,0,.7l3.3,3.3a.5.5,0,0,0,.7,0l8.3-8.3A1.4,1.4,0,0,0,20,7.5v-1a1.4,1.4,0,0,0-.35-.85l-1.3-1.3A1.4,1.4,0,0,0,17.5,4h-1a1.4,1.4,0,0,0-.85.35Z'/%3e%3c/g%3e%3cpath%20d='M5.9,14.49c.06-.27.26-.33.45-.14l3.3,3.3c.19.19.13.39-.14.45l-4,.8a.3.3,0,0,1-.39-.39Z'/%3e%3c/svg%3e";
486
- const iconConfig = "data:image/svg+xml,%3csvg%20id='icon-gear-24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='icon-gear-24_sga-2'%20data-name='icon-gear-24_sga'%3e%3cpath%20d='M22.82,14.06A1.25,1.25,0,0,0,24,13,7.66,7.66,0,0,0,24,12,7.66,7.66,0,0,0,24,11a1.25,1.25,0,0,0-1.13-1l-1.09,0A1.49,1.49,0,0,1,20.44,9c-.15-.47-.44-2-.07-2.37l.74-.81a1.16,1.16,0,0,0,0-1.5L19.7,2.87a1.16,1.16,0,0,0-1.5,0l-.81.74a1.5,1.5,0,0,1-1.54.27c-.44-.23-1.72-1.08-1.74-1.63l0-1.09A1.25,1.25,0,0,0,13,.05a7.66,7.66,0,0,0-1,0,7.66,7.66,0,0,0-1,.05,1.25,1.25,0,0,0-1,1.13l0,1.09A1.52,1.52,0,0,1,9,3.56c-.47.15-2,.44-2.37.07L5.8,2.89a1.16,1.16,0,0,0-1.5,0L2.86,4.3a1.18,1.18,0,0,0,0,1.5l.74.81A1.5,1.5,0,0,1,3.9,8.15c-.23.44-1.08,1.72-1.63,1.74l-1.09,0A1.25,1.25,0,0,0,.05,11a7.66,7.66,0,0,0,0,1,7.66,7.66,0,0,0,.05,1,1.25,1.25,0,0,0,1.13,1l1.09,0A1.47,1.47,0,0,1,3.55,15c.16.48.45,2,.08,2.37l-.74.81a1.16,1.16,0,0,0,0,1.5L4.3,21.13a1.16,1.16,0,0,0,1.5,0l.81-.74a1.5,1.5,0,0,1,1.54-.27c.44.23,1.72,1.08,1.75,1.63l0,1.09A1.25,1.25,0,0,0,11,24,7.66,7.66,0,0,0,12,24,7.66,7.66,0,0,0,13,24a1.25,1.25,0,0,0,1-1.13l0-1.09A1.49,1.49,0,0,1,15,20.44c.47-.15,2-.44,2.37-.07l.81.74a1.16,1.16,0,0,0,1.5,0l1.43-1.43a1.16,1.16,0,0,0,0-1.5l-.74-.81a1.5,1.5,0,0,1-.27-1.54c.23-.44,1.08-1.72,1.63-1.74ZM12,15.5A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z'/%3e%3c/g%3e%3c/svg%3e";
487
- const iconDuplicate = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%3e%3cpath%20d='M22.1,4.91a3,3,0,0,0-3-3H6.44a2.4,2.4,0,0,1,1.34-.4h12.6A2.12,2.12,0,0,1,22.5,3.62V17.26a1.42,1.42,0,0,1-.4,1Z'/%3e%3cpath%20d='M20.38,1H7.78A3,3,0,0,0,5.26,2.4H19.09A2.51,2.51,0,0,1,21.6,4.91V19.12A1.94,1.94,0,0,0,23,17.26V3.62A2.62,2.62,0,0,0,20.38,1Z'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M4,21.5A1.5,1.5,0,0,1,2.5,20V5.8A1.5,1.5,0,0,1,4,4.3H18.2a1.5,1.5,0,0,1,1.5,1.5V20a1.5,1.5,0,0,1-1.5,1.5ZM9.5,18a.5.5,0,0,0,.5.5h2a.5.5,0,0,0,.5-.5V14.5H16a.5.5,0,0,0,.5-.5V12a.5.5,0,0,0-.5-.5H12.5V8a.5.5,0,0,0-.5-.5H10a.5.5,0,0,0-.5.5v3.5H6a.5.5,0,0,0-.5.5v2a.5.5,0,0,0,.5.5H9.5Z'/%3e%3cpath%20d='M18.2,4.8a1,1,0,0,1,1,1V20a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V5.8a1,1,0,0,1,1-1H18.2M9,11H6a1,1,0,0,0-1,1v2a1,1,0,0,0,1,1H9v3a1,1,0,0,0,1,1h2a1,1,0,0,0,1-1V15h3a1,1,0,0,0,1-1V12a1,1,0,0,0-1-1H13V8a1,1,0,0,0-1-1H10A1,1,0,0,0,9,8v3m9.2-7.2H4a2,2,0,0,0-2,2V20a2,2,0,0,0,2,2H18.2a2,2,0,0,0,2-2V5.8a2,2,0,0,0-2-2ZM6,14V12h4V8h2v4h4v2H12v4H10V14Z'/%3e%3c/g%3e%3c/svg%3e";
488
- const iconDownload = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3e%3cpolygon%20points='7.92%2012%202.84%207%2013%207%207.92%2012'/%3e%3crect%20x='5'%20y='2'%20width='6'%20height='5'/%3e%3crect%20x='2'%20y='14'%20width='12'%20height='1'/%3e%3c/svg%3e";
489
- const iconSearch = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cstyle%3e%20.cls-1%20{%20fill:%20%23fff;%20}%20%3c/style%3e%3c/defs%3e%3cg%3e%3ccircle%20class='cls-1'%20cx='5.5'%20cy='5.5'%20r='4.5'/%3e%3cpath%20d='M5.5,2A3.5,3.5,0,1,1,2,5.5,3.5,3.5,0,0,1,5.5,2m0-1A4.5,4.5,0,1,0,10,5.5,4.49,4.49,0,0,0,5.5,1Z'/%3e%3c/g%3e%3crect%20x='6.79'%20y='10.04'%20width='7.74'%20height='2.16'%20transform='translate(10.98%20-4.28)%20rotate(45)'/%3e%3c/svg%3e";
490
- const iconIconKey = "data:image/svg+xml,%3csvg%20data-name='icon_key'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2027.02%2027'%3e%3cpath%20d='M35.07,16.5a8.52,8.52,0,0,0-7.69,12L17.2,38.8a2.46,2.46,0,0,0,0,3.46,2.41,2.41,0,0,0,3.42,0l1.69-1.7,2.91,2.94L31,37.63l-2.92-3,2.44-2.46a8.31,8.31,0,0,0,4.51,1.33,8.53,8.53,0,0,0,0-17Zm0,3.91A4.62,4.62,0,1,1,30.5,25,4.6,4.6,0,0,1,35.07,20.41Z'%20transform='translate(-16.49%20-16.5)'/%3e%3c/svg%3e";
491
- const iconSync = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='Pfeilende'%3e%3cpath%20d='M24,10H15l9-8.93Z'/%3e%3c/g%3e%3cpath%20d='M18.45,18.78A9.33,9.33,0,0,1,2.62,14.86,9.8,9.8,0,0,1,8.89,2.69,9.42,9.42,0,0,1,20.72,9.14H23A11.72,11.72,0,0,0,11.68,0,11.74,11.74,0,0,0,.34,9.14,12,12,0,0,0,8.89,23.65a11.43,11.43,0,0,0,11.16-3.31Z'/%3e%3c/svg%3e";
492
- const iconFullscreen = "data:image/svg+xml,%3csvg%20data-name='icon_fullscreen_sga'%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpolygon%20id='ecke'%20points='2%2014%202%2010%200%2010%200%2016%206%2016%206%2014%202%2014'/%3e%3cpolygon%20id='ecke-2'%20data-name='ecke'%20points='2%202%206%202%206%200%200%200%200%206%202%206%202%202'/%3e%3cpolygon%20id='ecke-3'%20data-name='ecke'%20points='14%2014%2010%2014%2010%2016%2016%2016%2016%2010%2014%2010%2014%2014'/%3e%3cpolygon%20id='ecke-4'%20data-name='ecke'%20points='10%200%2010%202%2014%202%2014%206%2016%206%2016%200%2010%200'/%3e%3c/svg%3e";
493
- const iconDocumentation = "data:image/svg+xml,%3csvg%20id='Icon_help'%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20id='icon_help-2'%20data-name='icon_help'%20d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm1,16H11V15h2Zm1.7-6.26a4.85,4.85,0,0,1-.49.81l-1,1.37a1.36,1.36,0,0,0-.18.34,1,1,0,0,0-.07.38L13,14H11l.1-.49a2,2,0,0,1,.13-.77,3.18,3.18,0,0,1,.4-.69l1-1.33a3.21,3.21,0,0,0,.29-.46,1.19,1.19,0,0,0,.11-.47,1.17,1.17,0,0,0-.3-.82,1.07,1.07,0,0,0-.83-.33A1,1,0,0,0,11.1,9a1.25,1.25,0,0,0-.28.83H9a2.94,2.94,0,0,1,.23-1.17,2.45,2.45,0,0,1,.63-.88,2.9,2.9,0,0,1,.93-.55A3.13,3.13,0,0,1,11.94,7a3.31,3.31,0,0,1,1.13.19,2.82,2.82,0,0,1,.94.54,2.62,2.62,0,0,1,.65.88A3,3,0,0,1,14.9,9.8,2.16,2.16,0,0,1,14.7,10.74Z'%20style='opacity:%200.2'/%3e%3c/svg%3e";
494
- const iconStar = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='icon_star_16'%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20id='star'%20d='M8,0l2.45,4.97,5.55,.76-4.04,3.83,.99,5.44-4.94-2.61-4.94,2.61,.99-5.44L0,5.73l5.55-.76L8,0Z'/%3e%3c/svg%3e";
458
+ //#endregion
459
+ //#region src/assets/svg/icon_add.svg
460
+ var icon_add_default = "data:image/svg+xml,%3csvg%20id='icon-add_24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpolygon%20id='plus'%20points='20%2010%2014%2010%2014%204%2010%204%2010%2010%204%2010%204%2014%2010%2014%2010%2020%2014%2020%2014%2014%2020%2014%2020%2010'/%3e%3c/svg%3e";
461
+ //#endregion
462
+ //#region src/assets/svg/icon_cross.svg
463
+ var icon_cross_default = "data:image/svg+xml,%3csvg%20id='icon-cross_24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cpolygon%20id='icon-cross_24'%20points='20%206.28%2017.87%204%2012%209.78%206.13%204%204%206.28%209.78%2011.97%204%2017.66%206.13%2019.93%2012%2014.15%2017.87%2019.93%2020%2017.66%2014.22%2011.97%2020%206.28'/%3e%3c/svg%3e";
464
+ //#endregion
465
+ //#region src/assets/svg/icon_edit.svg
466
+ var icon_edit_default = "data:image/svg+xml,%3csvg%20id='icon-edit-24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='stift'%3e%3cpath%20d='M7.35,12.65a.5.5,0,0,0,0,.7l3.3,3.3a.5.5,0,0,0,.7,0l8.3-8.3A1.4,1.4,0,0,0,20,7.5v-1a1.4,1.4,0,0,0-.35-.85l-1.3-1.3A1.4,1.4,0,0,0,17.5,4h-1a1.4,1.4,0,0,0-.85.35Z'/%3e%3c/g%3e%3cpath%20d='M5.9,14.49c.06-.27.26-.33.45-.14l3.3,3.3c.19.19.13.39-.14.45l-4,.8a.3.3,0,0,1-.39-.39Z'/%3e%3c/svg%3e";
467
+ //#endregion
468
+ //#region src/assets/svg/icon_gear.svg
469
+ var icon_gear_default = "data:image/svg+xml,%3csvg%20id='icon-gear-24_sga'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='icon-gear-24_sga-2'%20data-name='icon-gear-24_sga'%3e%3cpath%20d='M22.82,14.06A1.25,1.25,0,0,0,24,13,7.66,7.66,0,0,0,24,12,7.66,7.66,0,0,0,24,11a1.25,1.25,0,0,0-1.13-1l-1.09,0A1.49,1.49,0,0,1,20.44,9c-.15-.47-.44-2-.07-2.37l.74-.81a1.16,1.16,0,0,0,0-1.5L19.7,2.87a1.16,1.16,0,0,0-1.5,0l-.81.74a1.5,1.5,0,0,1-1.54.27c-.44-.23-1.72-1.08-1.74-1.63l0-1.09A1.25,1.25,0,0,0,13,.05a7.66,7.66,0,0,0-1,0,7.66,7.66,0,0,0-1,.05,1.25,1.25,0,0,0-1,1.13l0,1.09A1.52,1.52,0,0,1,9,3.56c-.47.15-2,.44-2.37.07L5.8,2.89a1.16,1.16,0,0,0-1.5,0L2.86,4.3a1.18,1.18,0,0,0,0,1.5l.74.81A1.5,1.5,0,0,1,3.9,8.15c-.23.44-1.08,1.72-1.63,1.74l-1.09,0A1.25,1.25,0,0,0,.05,11a7.66,7.66,0,0,0,0,1,7.66,7.66,0,0,0,.05,1,1.25,1.25,0,0,0,1.13,1l1.09,0A1.47,1.47,0,0,1,3.55,15c.16.48.45,2,.08,2.37l-.74.81a1.16,1.16,0,0,0,0,1.5L4.3,21.13a1.16,1.16,0,0,0,1.5,0l.81-.74a1.5,1.5,0,0,1,1.54-.27c.44.23,1.72,1.08,1.75,1.63l0,1.09A1.25,1.25,0,0,0,11,24,7.66,7.66,0,0,0,12,24,7.66,7.66,0,0,0,13,24a1.25,1.25,0,0,0,1-1.13l0-1.09A1.49,1.49,0,0,1,15,20.44c.47-.15,2-.44,2.37-.07l.81.74a1.16,1.16,0,0,0,1.5,0l1.43-1.43a1.16,1.16,0,0,0,0-1.5l-.74-.81a1.5,1.5,0,0,1-.27-1.54c.23-.44,1.08-1.72,1.63-1.74ZM12,15.5A3.5,3.5,0,1,1,15.5,12,3.5,3.5,0,0,1,12,15.5Z'/%3e%3c/g%3e%3c/svg%3e";
470
+ //#endregion
471
+ //#region src/assets/svg/icon_duplicate.svg
472
+ var icon_duplicate_default = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%3e%3cpath%20d='M22.1,4.91a3,3,0,0,0-3-3H6.44a2.4,2.4,0,0,1,1.34-.4h12.6A2.12,2.12,0,0,1,22.5,3.62V17.26a1.42,1.42,0,0,1-.4,1Z'/%3e%3cpath%20d='M20.38,1H7.78A3,3,0,0,0,5.26,2.4H19.09A2.51,2.51,0,0,1,21.6,4.91V19.12A1.94,1.94,0,0,0,23,17.26V3.62A2.62,2.62,0,0,0,20.38,1Z'/%3e%3c/g%3e%3cg%3e%3cpath%20d='M4,21.5A1.5,1.5,0,0,1,2.5,20V5.8A1.5,1.5,0,0,1,4,4.3H18.2a1.5,1.5,0,0,1,1.5,1.5V20a1.5,1.5,0,0,1-1.5,1.5ZM9.5,18a.5.5,0,0,0,.5.5h2a.5.5,0,0,0,.5-.5V14.5H16a.5.5,0,0,0,.5-.5V12a.5.5,0,0,0-.5-.5H12.5V8a.5.5,0,0,0-.5-.5H10a.5.5,0,0,0-.5.5v3.5H6a.5.5,0,0,0-.5.5v2a.5.5,0,0,0,.5.5H9.5Z'/%3e%3cpath%20d='M18.2,4.8a1,1,0,0,1,1,1V20a1,1,0,0,1-1,1H4a1,1,0,0,1-1-1V5.8a1,1,0,0,1,1-1H18.2M9,11H6a1,1,0,0,0-1,1v2a1,1,0,0,0,1,1H9v3a1,1,0,0,0,1,1h2a1,1,0,0,0,1-1V15h3a1,1,0,0,0,1-1V12a1,1,0,0,0-1-1H13V8a1,1,0,0,0-1-1H10A1,1,0,0,0,9,8v3m9.2-7.2H4a2,2,0,0,0-2,2V20a2,2,0,0,0,2,2H18.2a2,2,0,0,0,2-2V5.8a2,2,0,0,0-2-2ZM6,14V12h4V8h2v4h4v2H12v4H10V14Z'/%3e%3c/g%3e%3c/svg%3e";
473
+ //#endregion
474
+ //#region src/assets/svg/icon_download.svg
475
+ var icon_download_default = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3e%3cpolygon%20points='7.92%2012%202.84%207%2013%207%207.92%2012'/%3e%3crect%20x='5'%20y='2'%20width='6'%20height='5'/%3e%3crect%20x='2'%20y='14'%20width='12'%20height='1'/%3e%3c/svg%3e";
476
+ //#endregion
477
+ //#region src/assets/svg/icon_lupe.svg
478
+ var icon_lupe_default = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3e%3cdefs%3e%3cstyle%3e%20.cls-1%20{%20fill:%20%23fff;%20}%20%3c/style%3e%3c/defs%3e%3cg%3e%3ccircle%20class='cls-1'%20cx='5.5'%20cy='5.5'%20r='4.5'/%3e%3cpath%20d='M5.5,2A3.5,3.5,0,1,1,2,5.5,3.5,3.5,0,0,1,5.5,2m0-1A4.5,4.5,0,1,0,10,5.5,4.49,4.49,0,0,0,5.5,1Z'/%3e%3c/g%3e%3crect%20x='6.79'%20y='10.04'%20width='7.74'%20height='2.16'%20transform='translate(10.98%20-4.28)%20rotate(45)'/%3e%3c/svg%3e";
479
+ //#endregion
480
+ //#region src/assets/svg/icon_key.svg
481
+ var icon_key_default = "data:image/svg+xml,%3csvg%20data-name='icon_key'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2027.02%2027'%3e%3cpath%20d='M35.07,16.5a8.52,8.52,0,0,0-7.69,12L17.2,38.8a2.46,2.46,0,0,0,0,3.46,2.41,2.41,0,0,0,3.42,0l1.69-1.7,2.91,2.94L31,37.63l-2.92-3,2.44-2.46a8.31,8.31,0,0,0,4.51,1.33,8.53,8.53,0,0,0,0-17Zm0,3.91A4.62,4.62,0,1,1,30.5,25,4.6,4.6,0,0,1,35.07,20.41Z'%20transform='translate(-16.49%20-16.5)'/%3e%3c/svg%3e";
482
+ //#endregion
483
+ //#region src/assets/svg/icon_reload.svg
484
+ var icon_reload_default = "data:image/svg+xml,%3csvg%20id='Layer_1'%20data-name='Layer%201'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%3e%3cg%20id='Pfeilende'%3e%3cpath%20d='M24,10H15l9-8.93Z'/%3e%3c/g%3e%3cpath%20d='M18.45,18.78A9.33,9.33,0,0,1,2.62,14.86,9.8,9.8,0,0,1,8.89,2.69,9.42,9.42,0,0,1,20.72,9.14H23A11.72,11.72,0,0,0,11.68,0,11.74,11.74,0,0,0,.34,9.14,12,12,0,0,0,8.89,23.65a11.43,11.43,0,0,0,11.16-3.31Z'/%3e%3c/svg%3e";
485
+ //#endregion
486
+ //#region src/assets/svg/icon_fullscreen.svg
487
+ var icon_fullscreen_default = "data:image/svg+xml,%3csvg%20data-name='icon_fullscreen_sga'%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpolygon%20id='ecke'%20points='2%2014%202%2010%200%2010%200%2016%206%2016%206%2014%202%2014'/%3e%3cpolygon%20id='ecke-2'%20data-name='ecke'%20points='2%202%206%202%206%200%200%200%200%206%202%206%202%202'/%3e%3cpolygon%20id='ecke-3'%20data-name='ecke'%20points='14%2014%2010%2014%2010%2016%2016%2016%2016%2010%2014%2010%2014%2014'/%3e%3cpolygon%20id='ecke-4'%20data-name='ecke'%20points='10%200%2010%202%2014%202%2014%206%2016%206%2016%200%2010%200'/%3e%3c/svg%3e";
488
+ //#endregion
489
+ //#region src/assets/svg/icon_help_light.svg
490
+ var icon_help_light_default = "data:image/svg+xml,%3csvg%20id='Icon_help'%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%3e%3cpath%20id='icon_help-2'%20data-name='icon_help'%20d='M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm1,16H11V15h2Zm1.7-6.26a4.85,4.85,0,0,1-.49.81l-1,1.37a1.36,1.36,0,0,0-.18.34,1,1,0,0,0-.07.38L13,14H11l.1-.49a2,2,0,0,1,.13-.77,3.18,3.18,0,0,1,.4-.69l1-1.33a3.21,3.21,0,0,0,.29-.46,1.19,1.19,0,0,0,.11-.47,1.17,1.17,0,0,0-.3-.82,1.07,1.07,0,0,0-.83-.33A1,1,0,0,0,11.1,9a1.25,1.25,0,0,0-.28.83H9a2.94,2.94,0,0,1,.23-1.17,2.45,2.45,0,0,1,.63-.88,2.9,2.9,0,0,1,.93-.55A3.13,3.13,0,0,1,11.94,7a3.31,3.31,0,0,1,1.13.19,2.82,2.82,0,0,1,.94.54,2.62,2.62,0,0,1,.65.88A3,3,0,0,1,14.9,9.8,2.16,2.16,0,0,1,14.7,10.74Z'%20style='opacity:%200.2'/%3e%3c/svg%3e";
491
+ //#endregion
492
+ //#region src/assets/svg/icon_star.svg
493
+ var icon_star_default = "data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='icon_star_16'%20xmlns='http://www.w3.org/2000/svg'%20width='16'%20height='16'%20viewBox='0%200%2016%2016'%3e%3cpath%20id='star'%20d='M8,0l2.45,4.97,5.55,.76-4.04,3.83,.99,5.44-4.94-2.61-4.94,2.61,.99-5.44L0,5.73l5.55-.76L8,0Z'/%3e%3c/svg%3e";
494
+ //#endregion
495
+ //#region src/components/icon/Icon.tsx
495
496
  function getSrc(props) {
496
- const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
497
- if (add) {
498
- return iconAdd;
499
- } else if (del) {
500
- return iconDel;
501
- } else if (edit) {
502
- return iconEdit;
503
- } else if (config) {
504
- return iconConfig;
505
- } else if (duplicate) {
506
- return iconDuplicate;
507
- } else if (search) {
508
- return iconSearch;
509
- } else if (download) {
510
- return iconDownload;
511
- } else if (sync) {
512
- return iconSync;
513
- } else if (fullscreen) {
514
- return iconFullscreen;
515
- } else if (iconKey) {
516
- return iconIconKey;
517
- } else if (documentation) {
518
- return iconDocumentation;
519
- } else if (star) {
520
- return iconStar;
521
- } else {
522
- throw Error("getSrc: no icon type specified");
523
- }
497
+ const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
498
+ if (add) return icon_add_default;
499
+ else if (del) return icon_cross_default;
500
+ else if (edit) return icon_edit_default;
501
+ else if (config) return icon_gear_default;
502
+ else if (duplicate) return icon_duplicate_default;
503
+ else if (search) return icon_lupe_default;
504
+ else if (download) return icon_download_default;
505
+ else if (sync) return icon_reload_default;
506
+ else if (fullscreen) return icon_fullscreen_default;
507
+ else if (iconKey) return icon_key_default;
508
+ else if (documentation) return icon_help_light_default;
509
+ else if (star) return icon_star_default;
510
+ else throw Error("getSrc: no icon type specified");
524
511
  }
525
512
  function getAlt(props) {
526
- const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
527
- if (add) {
528
- return "icon add";
529
- } else if (del) {
530
- return "icon delete";
531
- } else if (edit) {
532
- return "icon edit";
533
- } else if (config) {
534
- return "icon config";
535
- } else if (duplicate) {
536
- return "icon duplicate";
537
- } else if (search) {
538
- return "icon search";
539
- } else if (download) {
540
- return "icon download";
541
- } else if (sync) {
542
- return "icon sync";
543
- } else if (fullscreen) {
544
- return "icon fullscreen";
545
- } else if (iconKey) {
546
- return "icon iconKey";
547
- } else if (documentation) {
548
- return "icon documentation";
549
- } else if (star) {
550
- return "icon star";
551
- } else {
552
- throw Error("getAlt: no icon type specified");
553
- }
513
+ const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
514
+ if (add) return "icon add";
515
+ else if (del) return "icon delete";
516
+ else if (edit) return "icon edit";
517
+ else if (config) return "icon config";
518
+ else if (duplicate) return "icon duplicate";
519
+ else if (search) return "icon search";
520
+ else if (download) return "icon download";
521
+ else if (sync) return "icon sync";
522
+ else if (fullscreen) return "icon fullscreen";
523
+ else if (iconKey) return "icon iconKey";
524
+ else if (documentation) return "icon documentation";
525
+ else if (star) return "icon star";
526
+ else throw Error("getAlt: no icon type specified");
554
527
  }
555
528
  function Icon(props) {
556
- let style;
557
- if (props.large) {
558
- style = { width: 24, height: 24 };
559
- } else {
560
- style = { width: 16, height: 16 };
561
- }
562
- if (props.inverted) {
563
- style = { ...style, filter: "invert(1)" };
564
- }
565
- return /* @__PURE__ */ jsx("img", { src: getSrc(props), className: `di icon ${props.className || ""}`, alt: getAlt(props), style });
529
+ let style;
530
+ if (props.large) style = {
531
+ width: 24,
532
+ height: 24
533
+ };
534
+ else style = {
535
+ width: 16,
536
+ height: 16
537
+ };
538
+ if (props.inverted) style = {
539
+ ...style,
540
+ filter: "invert(1)"
541
+ };
542
+ return /* @__PURE__ */ jsx("img", {
543
+ src: getSrc(props),
544
+ className: `di icon ${props.className || ""}`,
545
+ alt: getAlt(props),
546
+ style
547
+ });
566
548
  }
567
- function Label({
568
- text,
569
- small = false,
570
- large = false,
571
- onDelete,
572
- className,
573
- onClick,
574
- children,
575
- ...dataTestIds
576
- }) {
577
- function handleDelete(event) {
578
- event.stopPropagation();
579
- if (onDelete) {
580
- onDelete();
581
- }
582
- }
583
- return /* @__PURE__ */ jsxs(
584
- "span",
585
- {
586
- onClick,
587
- className: cx("di label", className, { large, small, removable: onDelete, clickable: !!onClick }),
588
- "data-testid": dataTestIds["data-testid"],
589
- children: [
590
- typeof text === "string" ? text : text && /* @__PURE__ */ jsx(Trans, { i18nKey: text.id, children: text.defaultValue }),
591
- /* @__PURE__ */ jsx(Fragment, { children }),
592
- onDelete && /* @__PURE__ */ jsx("span", { "data-testid": dataTestIds["delete-button-data-testid"], className: "remove", onClick: handleDelete, children: /* @__PURE__ */ jsx(Icon, { del: true, inverted: true }) })
593
- ]
594
- }
595
- );
549
+ //#endregion
550
+ //#region src/components/label/Label.tsx
551
+ /**
552
+ * Label enables an easy way for marking or tagging elements.
553
+ */
554
+ function Label({ text, small = false, large = false, onDelete, className, onClick, children, ...dataTestIds }) {
555
+ function handleDelete(event) {
556
+ event.stopPropagation();
557
+ if (onDelete) onDelete();
558
+ }
559
+ return /* @__PURE__ */ jsxs("span", {
560
+ onClick,
561
+ className: cx("di label", className, {
562
+ large,
563
+ small,
564
+ removable: onDelete,
565
+ clickable: !!onClick
566
+ }),
567
+ "data-testid": dataTestIds["data-testid"],
568
+ children: [
569
+ typeof text === "string" ? text : text && /* @__PURE__ */ jsx(Trans, {
570
+ i18nKey: text.id,
571
+ children: text.defaultValue
572
+ }),
573
+ /* @__PURE__ */ jsx(Fragment, { children }),
574
+ onDelete && /* @__PURE__ */ jsx("span", {
575
+ "data-testid": dataTestIds["delete-button-data-testid"],
576
+ className: "remove",
577
+ onClick: handleDelete,
578
+ children: /* @__PURE__ */ jsx(Icon, {
579
+ del: true,
580
+ inverted: true
581
+ })
582
+ })
583
+ ]
584
+ });
596
585
  }
597
- const MARGIN = 16;
598
- function Popup({
599
- placement = "bottom",
600
- mode = ["click"],
601
- disabled,
602
- handler,
603
- handlerWrapperClassName,
604
- preventDestroyContentOnHide,
605
- open,
606
- onOpenChange,
607
- className,
608
- children
609
- }) {
610
- const arrowRef = useRef(null);
611
- const {
612
- elements,
613
- update,
614
- refs,
615
- floatingStyles,
616
- context,
617
- middlewareData,
618
- placement: computedPlacement
619
- } = useFloating({
620
- placement,
621
- open,
622
- onOpenChange,
623
- whileElementsMounted: !preventDestroyContentOnHide ? autoUpdate : void 0,
624
- middleware: [
625
- offset({
626
- mainAxis: 12
627
- }),
628
- flip({
629
- padding: MARGIN,
630
- boundary: "clippingAncestors",
631
- altBoundary: true
632
- }),
633
- shift({
634
- padding: MARGIN,
635
- boundary: "clippingAncestors",
636
- altBoundary: true
637
- }),
638
- size({
639
- padding: MARGIN,
640
- boundary: "clippingAncestors",
641
- altBoundary: true,
642
- apply({ availableHeight, availableWidth, elements: elements2 }) {
643
- const width = `${Math.max(0, availableWidth - MARGIN)}px`;
644
- const height = `${Math.max(0, availableHeight - MARGIN)}px`;
645
- elements2.floating.style.maxWidth = width;
646
- elements2.floating.style.maxHeight = height;
647
- }
648
- }),
649
- arrow({
650
- element: arrowRef
651
- })
652
- ]
653
- });
654
- useEffect(() => {
655
- if (preventDestroyContentOnHide && open && elements.reference && elements.floating) {
656
- const cleanup = autoUpdate(elements.reference, elements.floating, update);
657
- return cleanup;
658
- }
659
- }, [elements.floating, elements.reference, open, update, preventDestroyContentOnHide]);
660
- const click = useClick(context, {
661
- enabled: !disabled && mode.includes("click"),
662
- keyboardHandlers: false
663
- // Prevent space key from being blocked in input fields (floating-ui issue #1812)
664
- });
665
- const hover = useHover(context, {
666
- enabled: !disabled && mode.includes("hover"),
667
- handleClose: safePolygon()
668
- });
669
- const focus = useFocus(context, { enabled: !disabled && mode.includes("focus") });
670
- const dismiss = useDismiss(context);
671
- const { getReferenceProps, getFloatingProps } = useInteractions([click, hover, focus, dismiss]);
672
- return /* @__PURE__ */ jsxs(Fragment, { children: [
673
- /* @__PURE__ */ jsx(
674
- "span",
675
- {
676
- style: { display: "inline-block" },
677
- className: cx("popup-handler-wrapper", handlerWrapperClassName),
678
- ref: refs.setReference,
679
- ...getReferenceProps(),
680
- children: handler
681
- }
682
- ),
683
- (open || preventDestroyContentOnHide) && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
684
- "div",
685
- {
686
- className: cx("di popup-wrapper", { hidden: preventDestroyContentOnHide && !open }),
687
- ref: refs.setFloating,
688
- style: { ...floatingStyles, zIndex: 1e5 },
689
- ...getFloatingProps(),
690
- children: /* @__PURE__ */ jsxs("div", { className: cx("di popup", computedPlacement, className), children: [
691
- /* @__PURE__ */ jsx(
692
- "div",
693
- {
694
- className: cx("popup-arrow", computedPlacement),
695
- ref: arrowRef,
696
- style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y }
697
- }
698
- ),
699
- /* @__PURE__ */ jsx("div", { className: "popup-content", children })
700
- ] })
701
- }
702
- ) })
703
- ] });
586
+ //#endregion
587
+ //#region src/components/popup/Popup.tsx
588
+ var MARGIN = 16;
589
+ /**
590
+ * Popup displays content within a small modal.
591
+ * Its usage is highly flexible and used in several other components.
592
+ */
593
+ function Popup({ placement = "bottom", mode = ["click"], disabled, handler, handlerWrapperClassName, preventDestroyContentOnHide, open, onOpenChange, className, children }) {
594
+ const arrowRef = useRef(null);
595
+ const { elements, update, refs, floatingStyles, context, middlewareData, placement: computedPlacement } = useFloating({
596
+ placement,
597
+ open,
598
+ onOpenChange,
599
+ whileElementsMounted: !preventDestroyContentOnHide ? autoUpdate : void 0,
600
+ middleware: [
601
+ offset({ mainAxis: 12 }),
602
+ flip({
603
+ padding: MARGIN,
604
+ boundary: "clippingAncestors",
605
+ altBoundary: true
606
+ }),
607
+ shift({
608
+ padding: MARGIN,
609
+ boundary: "clippingAncestors",
610
+ altBoundary: true
611
+ }),
612
+ size({
613
+ padding: MARGIN,
614
+ boundary: "clippingAncestors",
615
+ altBoundary: true,
616
+ apply({ availableHeight, availableWidth, elements }) {
617
+ const width = `${Math.max(0, availableWidth - MARGIN)}px`;
618
+ const height = `${Math.max(0, availableHeight - MARGIN)}px`;
619
+ elements.floating.style.maxWidth = width;
620
+ elements.floating.style.maxHeight = height;
621
+ }
622
+ }),
623
+ arrow({ element: arrowRef })
624
+ ]
625
+ });
626
+ useEffect(() => {
627
+ if (preventDestroyContentOnHide && open && elements.reference && elements.floating) return autoUpdate(elements.reference, elements.floating, update);
628
+ }, [
629
+ elements.floating,
630
+ elements.reference,
631
+ open,
632
+ update,
633
+ preventDestroyContentOnHide
634
+ ]);
635
+ const click = useClick(context, {
636
+ enabled: !disabled && mode.includes("click"),
637
+ keyboardHandlers: false
638
+ });
639
+ const hover = useHover(context, {
640
+ enabled: !disabled && mode.includes("hover"),
641
+ handleClose: safePolygon()
642
+ });
643
+ const focus = useFocus(context, { enabled: !disabled && mode.includes("focus") });
644
+ const dismiss = useDismiss(context);
645
+ const { getReferenceProps, getFloatingProps } = useInteractions([
646
+ click,
647
+ hover,
648
+ focus,
649
+ dismiss
650
+ ]);
651
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
652
+ style: { display: "inline-block" },
653
+ className: cx("popup-handler-wrapper", handlerWrapperClassName),
654
+ ref: refs.setReference,
655
+ ...getReferenceProps(),
656
+ children: handler
657
+ }), (open || preventDestroyContentOnHide) && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx("div", {
658
+ className: cx("di popup-wrapper", { hidden: preventDestroyContentOnHide && !open }),
659
+ ref: refs.setFloating,
660
+ style: {
661
+ ...floatingStyles,
662
+ zIndex: 1e5
663
+ },
664
+ ...getFloatingProps(),
665
+ children: /* @__PURE__ */ jsxs("div", {
666
+ className: cx("di popup", computedPlacement, className),
667
+ children: [/* @__PURE__ */ jsx("div", {
668
+ className: cx("popup-arrow", computedPlacement),
669
+ ref: arrowRef,
670
+ style: {
671
+ left: middlewareData.arrow?.x,
672
+ top: middlewareData.arrow?.y
673
+ }
674
+ }), /* @__PURE__ */ jsx("div", {
675
+ className: "popup-content",
676
+ children
677
+ })]
678
+ })
679
+ }) })] });
704
680
  }
681
+ //#endregion
682
+ //#region src/components/bubble/Bubble.tsx
683
+ /**
684
+ * Bubbles are best used to provide some additional information like short instructions or help texts, which are then going to be displayed on Mouse-Over.
685
+ */
705
686
  function Bubble({ content, inverted, children, disabled, style, direction, className }) {
706
- const [open, setOpen] = useState(false);
707
- return /* @__PURE__ */ jsx(
708
- Popup,
709
- {
710
- open,
711
- onOpenChange: setOpen,
712
- handler: children,
713
- disabled,
714
- mode: ["hover"],
715
- placement: direction ? direction : "top",
716
- className: `bubble ${inverted ? "inverted" : ""} ${className ? className : ""}`,
717
- children: /* @__PURE__ */ jsx("span", { className: `bubble-content`, style, children: content })
718
- }
719
- );
687
+ const [open, setOpen] = useState(false);
688
+ return /* @__PURE__ */ jsx(Popup, {
689
+ open,
690
+ onOpenChange: setOpen,
691
+ handler: children,
692
+ disabled,
693
+ mode: ["hover"],
694
+ placement: direction ? direction : "top",
695
+ className: `bubble ${inverted ? "inverted" : ""} ${className ? className : ""}`,
696
+ children: /* @__PURE__ */ jsx("span", {
697
+ className: `bubble-content`,
698
+ style,
699
+ children: content
700
+ })
701
+ });
720
702
  }
703
+ //#endregion
704
+ //#region src/components/tooltip/Tooltip.tsx
705
+ /**
706
+ * Tooltip is best used to display some short additional information or description
707
+ */
721
708
  function Tooltip({ content, children, className, direction, disabled }) {
722
- const [open, setOpen] = useState(false);
723
- return /* @__PURE__ */ jsx(
724
- Popup,
725
- {
726
- open,
727
- disabled,
728
- mode: ["hover"],
729
- onOpenChange: setOpen,
730
- handler: children,
731
- placement: direction ? direction : "right",
732
- className: `tooltip inverted ${className ? className : ""}`,
733
- children: /* @__PURE__ */ jsx("span", { className: "tooltip-content", children: content })
734
- }
735
- );
709
+ const [open, setOpen] = useState(false);
710
+ return /* @__PURE__ */ jsx(Popup, {
711
+ open,
712
+ disabled,
713
+ mode: ["hover"],
714
+ onOpenChange: setOpen,
715
+ handler: children,
716
+ placement: direction ? direction : "right",
717
+ className: `tooltip inverted ${className ? className : ""}`,
718
+ children: /* @__PURE__ */ jsx("span", {
719
+ className: "tooltip-content",
720
+ children: content
721
+ })
722
+ });
736
723
  }
737
- class Tabs extends React.Component {
738
- state = {
739
- currentTab: this.props.pages.length ? this.props.pages[0].name : null
740
- };
741
- handleClick = (tab) => {
742
- if (this.props.onChange) {
743
- this.props.onChange(tab);
744
- } else if (typeof this.props.currentTab === "undefined") {
745
- this.setState({
746
- currentTab: tab
747
- });
748
- }
749
- };
750
- currentTabPage = () => {
751
- const currentTab = typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab;
752
- return this.props.pages.find(({ name }) => currentTab === name);
753
- };
754
- isCurrentTab = (tab) => {
755
- const currentTab = typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab;
756
- return currentTab === tab;
757
- };
758
- renderBody = () => {
759
- const page = this.currentTabPage();
760
- if (page && typeof page.renderBody === "function") {
761
- return page.renderBody();
762
- }
763
- return null;
764
- };
765
- render() {
766
- const { pages, disabled } = this.props;
767
- return /* @__PURE__ */ jsxs("div", { children: [
768
- /* @__PURE__ */ jsx("div", { className: "di tabs", children: pages.map(
769
- ({ name, renderHeading, tabDescription }) => tabDescription ? /* @__PURE__ */ jsx(Bubble, { inverted: true, content: tabDescription, className: "bubble-tab-description", children: /* @__PURE__ */ jsx(
770
- "button",
771
- {
772
- "data-testid": "tab-button",
773
- className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
774
- onClick: () => !disabled && this.handleClick(name),
775
- children: renderHeading()
776
- }
777
- ) }, name) : /* @__PURE__ */ jsx(
778
- "button",
779
- {
780
- "data-testid": "tab-button",
781
- className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
782
- onClick: () => !disabled && this.handleClick(name),
783
- children: renderHeading()
784
- },
785
- name
786
- )
787
- ) }),
788
- this.renderBody()
789
- ] });
790
- }
791
- }
792
- const ClearButton = ({
793
- onChange,
794
- inputElement,
795
- style
796
- }) => /* @__PURE__ */ jsx(
797
- Button$1,
798
- {
799
- naked: true,
800
- onClick: () => {
801
- onChange("");
802
- if (inputElement) {
803
- inputElement.focus();
804
- }
805
- },
806
- style,
807
- children: /* @__PURE__ */ jsx(Icon, { del: true })
808
- }
809
- );
810
- class SearchBox extends React.Component {
811
- state = {
812
- query: this.props.initialValue || ""
813
- };
814
- input;
815
- printPlaceholder() {
816
- const { t, placeholder } = this.props;
817
- if (typeof placeholder === "object") {
818
- return t(placeholder.id, {
819
- defaultValue: placeholder.defaultValue
820
- });
821
- } else {
822
- return placeholder;
823
- }
824
- }
825
- handleChange = (value) => {
826
- const { onChange } = this.props;
827
- this.setState({
828
- query: value
829
- });
830
- onChange(value);
831
- };
832
- handleKeyUp = ({ key }) => {
833
- const { onSubmit } = this.props;
834
- const { query } = this.state;
835
- if (key === "Enter" && typeof onSubmit === "function") {
836
- onSubmit(query);
837
- }
838
- };
839
- render() {
840
- const { onSubmit, style, clearable } = this.props;
841
- const { query } = this.state;
842
- return /* @__PURE__ */ jsxs("div", { className: "search-box", style, children: [
843
- /* @__PURE__ */ jsx(
844
- "input",
845
- {
846
- ref: (input) => {
847
- this.input = input;
848
- },
849
- type: "text",
850
- value: query,
851
- placeholder: this.printPlaceholder(),
852
- onKeyUp: this.handleKeyUp,
853
- onChange: ({ target: { value } }) => this.handleChange(value)
854
- }
855
- ),
856
- typeof onSubmit === "function" ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
857
- query && clearable && /* @__PURE__ */ jsx(
858
- ClearButton,
859
- {
860
- onChange: this.handleChange,
861
- inputElement: this.input,
862
- style: {
863
- right: 30
864
- }
865
- }
866
- ),
867
- /* @__PURE__ */ jsx(Button$1, { naked: true, onClick: () => onSubmit(query), children: /* @__PURE__ */ jsx(Icon, { search: true }) })
868
- ] }) : query && clearable ? /* @__PURE__ */ jsx(ClearButton, { onChange: this.handleChange, inputElement: this.input }) : /* @__PURE__ */ jsx(Button$1, { naked: true, disabled: true, children: /* @__PURE__ */ jsx(Icon, { search: true }) })
869
- ] });
870
- }
871
- }
872
- const SearchBox_default = withTranslation()(SearchBox);
873
- export {
874
- Accordion,
875
- AccordionItem,
876
- Bubble,
877
- Button$1 as Button,
878
- ButtonRow,
879
- Checkbox_default as Checkbox,
880
- ConfirmProvider,
881
- Icon,
882
- Label,
883
- Modal,
884
- ModalContainer,
885
- Popup,
886
- SearchBox_default as SearchBox,
887
- Spinner,
888
- SpinnerContainer,
889
- Tabs,
890
- Tooltip,
891
- useConfirm,
892
- withConfirm
724
+ //#endregion
725
+ //#region src/components/tabs/Tabs.tsx
726
+ /**
727
+ * Tabs add the possibility to unite several homogeneous pages into one.
728
+ * Unlike RouteTabs, Tabs cannot be accessed directly via the browser's history
729
+ */
730
+ var Tabs = class extends React$1.Component {
731
+ state = { currentTab: this.props.pages.length ? this.props.pages[0].name : null };
732
+ handleClick = (tab) => {
733
+ if (this.props.onChange) this.props.onChange(tab);
734
+ else if (typeof this.props.currentTab === "undefined") this.setState({ currentTab: tab });
735
+ };
736
+ currentTabPage = () => {
737
+ const currentTab = typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab;
738
+ return this.props.pages.find(({ name }) => currentTab === name);
739
+ };
740
+ isCurrentTab = (tab) => {
741
+ return (typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab) === tab;
742
+ };
743
+ renderBody = () => {
744
+ const page = this.currentTabPage();
745
+ if (page && typeof page.renderBody === "function") return page.renderBody();
746
+ return null;
747
+ };
748
+ render() {
749
+ const { pages, disabled } = this.props;
750
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
751
+ className: "di tabs",
752
+ children: pages.map(({ name, renderHeading, tabDescription }) => tabDescription ? /* @__PURE__ */ jsx(Bubble, {
753
+ inverted: true,
754
+ content: tabDescription,
755
+ className: "bubble-tab-description",
756
+ children: /* @__PURE__ */ jsx("button", {
757
+ "data-testid": "tab-button",
758
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
759
+ onClick: () => !disabled && this.handleClick(name),
760
+ children: renderHeading()
761
+ })
762
+ }, name) : /* @__PURE__ */ jsx("button", {
763
+ "data-testid": "tab-button",
764
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
765
+ onClick: () => !disabled && this.handleClick(name),
766
+ children: renderHeading()
767
+ }, name))
768
+ }), this.renderBody()] });
769
+ }
770
+ };
771
+ //#endregion
772
+ //#region src/components/input/SearchBox.tsx
773
+ var ClearButton = ({ onChange, inputElement, style }) => /* @__PURE__ */ jsx(Button_default, {
774
+ naked: true,
775
+ onClick: () => {
776
+ onChange("");
777
+ if (inputElement) inputElement.focus();
778
+ },
779
+ style,
780
+ children: /* @__PURE__ */ jsx(Icon, { del: true })
781
+ });
782
+ /**
783
+ * SearchBox is used for searching content and provides a set of `props` for different user experiences
784
+ */
785
+ var SearchBox = class extends React$1.Component {
786
+ state = { query: this.props.initialValue || "" };
787
+ input;
788
+ printPlaceholder() {
789
+ const { t, placeholder } = this.props;
790
+ if (typeof placeholder === "object") return t(placeholder.id, { defaultValue: placeholder.defaultValue });
791
+ else return placeholder;
792
+ }
793
+ handleChange = (value) => {
794
+ const { onChange } = this.props;
795
+ this.setState({ query: value });
796
+ onChange(value);
797
+ };
798
+ handleKeyUp = ({ key }) => {
799
+ const { onSubmit } = this.props;
800
+ const { query } = this.state;
801
+ if (key === "Enter" && typeof onSubmit === "function") onSubmit(query);
802
+ };
803
+ render() {
804
+ const { onSubmit, style, clearable } = this.props;
805
+ const { query } = this.state;
806
+ return /* @__PURE__ */ jsxs("div", {
807
+ className: "search-box",
808
+ style,
809
+ children: [/* @__PURE__ */ jsx("input", {
810
+ ref: (input) => {
811
+ this.input = input;
812
+ },
813
+ type: "text",
814
+ value: query,
815
+ placeholder: this.printPlaceholder(),
816
+ onKeyUp: this.handleKeyUp,
817
+ onChange: ({ target: { value } }) => this.handleChange(value)
818
+ }), typeof onSubmit === "function" ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [query && clearable && /* @__PURE__ */ jsx(ClearButton, {
819
+ onChange: this.handleChange,
820
+ inputElement: this.input,
821
+ style: { right: 30 }
822
+ }), /* @__PURE__ */ jsx(Button_default, {
823
+ naked: true,
824
+ onClick: () => onSubmit(query),
825
+ children: /* @__PURE__ */ jsx(Icon, { search: true })
826
+ })] }) : query && clearable ? /* @__PURE__ */ jsx(ClearButton, {
827
+ onChange: this.handleChange,
828
+ inputElement: this.input
829
+ }) : /* @__PURE__ */ jsx(Button_default, {
830
+ naked: true,
831
+ disabled: true,
832
+ children: /* @__PURE__ */ jsx(Icon, { search: true })
833
+ })]
834
+ });
835
+ }
893
836
  };
894
- //# sourceMappingURL=index.js.map
837
+ var SearchBox_default = withTranslation()(SearchBox);
838
+ //#endregion
839
+ export { Accordion, AccordionItem, Bubble, Button_default as Button, ButtonRow, Checkbox_default as Checkbox, ConfirmProvider, Icon, Label, Modal, ModalContainer, Popup, SearchBox_default as SearchBox, Spinner, SpinnerContainer, Tabs, Tooltip, useConfirm, withConfirm };
840
+
841
+ //# sourceMappingURL=index.js.map