@deviceinsight/ng-ui-basic-components 7.17.0 → 7.18.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,836 @@
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
+ return /* @__PURE__ */ jsxs("div", {
283
+ className: `di spinner-wrapper ${className ? className : ""}`,
284
+ children: [/* @__PURE__ */ jsx("div", {
285
+ className: `di spinner-container ${show ? "visible" : ""}`,
286
+ "data-testid": this.props["data-testid"],
287
+ children: /* @__PURE__ */ jsx(Spinner, {
288
+ size,
289
+ center: true
290
+ })
291
+ }), children]
292
+ });
293
+ }
294
+ };
295
+ //#endregion
296
+ //#region src/components/input/Checkbox.tsx
297
+ var getWrapperClassName = (type, small) => {
298
+ switch (type) {
299
+ case "checkbox":
300
+ case "radio": return "di checkbox";
301
+ case "toggle": return small ? "di toggle toggle-small" : "di toggle";
302
+ default: throw Error(`type not support: ${type}`);
303
+ }
304
+ };
305
+ var getCheckboxClassName = (type, small) => {
306
+ switch (type) {
307
+ case "checkbox": return "box";
308
+ case "radio": return "radio";
309
+ case "toggle": return small ? "switch switch-small" : "switch";
310
+ default: throw Error(`type not support: ${type}`);
311
+ }
312
+ };
313
+ /**
314
+ * Checkbox for enabling user interaction can have one of multiple types which are defined via the `type` prop.
315
+ */
316
+ var Checkbox = ({ type = "checkbox", value, onChange, title, label, disabled = false, toggleSmall = false, toggleColor = "#259b23", t, ...other }) => {
317
+ const style = type === "toggle" ? { backgroundColor: value ? toggleColor : "gray" } : {};
318
+ const tooltip = title ? t(title.id, { defaultValue: title.defaultValue }) : void 0;
319
+ const labelText = label ? t(label.id, { defaultValue: label.defaultValue }) : null;
320
+ return /* @__PURE__ */ jsxs("label", {
321
+ title: tooltip,
322
+ className: getWrapperClassName(type, toggleSmall),
323
+ "data-testid": other["wrapper-data-testid"],
324
+ children: [
325
+ /* @__PURE__ */ jsx("input", {
326
+ type: "checkbox",
327
+ checked: value,
328
+ disabled,
329
+ onChange: () => onChange(!value),
330
+ "data-testid": other["data-testid"]
331
+ }),
332
+ /* @__PURE__ */ jsx("div", {
333
+ className: getCheckboxClassName(type, toggleSmall),
334
+ style,
335
+ "data-testid": other["innerdiv-data-testid"]
336
+ }),
337
+ label && /* @__PURE__ */ jsx("span", {
338
+ className: "textlabel",
339
+ children: labelText
340
+ })
341
+ ]
342
+ });
343
+ };
344
+ var Checkbox_default = withTranslation()(Checkbox);
345
+ //#endregion
346
+ //#region src/components/confirm/utils.ts
365
347
  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;
348
+ const result = typeof arg === "object" && typeof arg.id === "string" && typeof arg.defaultValue === "string";
349
+ if (result) console.warn("Please use strings instead of TranslationDescriptors to initialize the Confirm modal, because TranslationDescriptors are deprecated");
350
+ return result;
373
351
  }
352
+ //#endregion
353
+ //#region src/components/confirm/Confirm.tsx
374
354
  function transformTextToElement(message) {
375
- if (isTranslationDescriptor(message)) {
376
- return /* @__PURE__ */ jsx(Trans, { i18nKey: message.id, children: message.defaultValue });
377
- }
378
- return message;
355
+ if (isTranslationDescriptor(message)) return /* @__PURE__ */ jsx(Trans, {
356
+ i18nKey: message.id,
357
+ children: message.defaultValue
358
+ });
359
+ return message;
379
360
  }
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
- );
361
+ /**
362
+ * Confirm enables the possibility to open up a dialog within a modal, requiring additional user actions.
363
+ * This component should not be used directly, instead use `@withConfirm` to inject a promise based confirm method
364
+ */
365
+ function Confirm({ title, message, onAccept, onDecline, acceptButtonLabel, declineButtonLabel, acceptButtonStyle = "primary" }) {
366
+ return /* @__PURE__ */ jsx(Modal, {
367
+ header: transformTextToElement(title),
368
+ content: transformTextToElement(message),
369
+ footer: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Button_default, {
370
+ primary: acceptButtonStyle === "primary",
371
+ danger: acceptButtonStyle === "danger",
372
+ onClick: onAccept,
373
+ children: acceptButtonLabel ? transformTextToElement(acceptButtonLabel) : /* @__PURE__ */ jsx(Trans, {
374
+ i18nKey: "form.accept",
375
+ children: "Accept"
376
+ })
377
+ }), /* @__PURE__ */ jsx(Button_default, {
378
+ onClick: onDecline,
379
+ children: declineButtonLabel ? transformTextToElement(declineButtonLabel) : /* @__PURE__ */ jsx(Trans, {
380
+ i18nKey: "form.decline",
381
+ children: "Decline"
382
+ })
383
+ })] }),
384
+ width: 500
385
+ });
409
386
  }
410
- const ConfirmContext = createContext({
411
- confirm: () => Promise.reject(new Error("ConfirmProvider is missing!"))
412
- });
387
+ //#endregion
388
+ //#region src/components/confirm/ConfirmProvider.tsx
389
+ var ConfirmContext = createContext({ confirm: () => Promise.reject(/* @__PURE__ */ new Error("ConfirmProvider is missing!")) });
413
390
  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
- ] });
391
+ const [visible, setVisible] = useState(false);
392
+ const [confirmProps, setConfirmProps] = useState({
393
+ title: "",
394
+ message: "",
395
+ onAccept: () => {},
396
+ onDecline: () => {}
397
+ });
398
+ async function confirm(options) {
399
+ return new Promise((resolve) => {
400
+ setVisible(true);
401
+ setConfirmProps({
402
+ ...options,
403
+ onAccept: () => {
404
+ setVisible(false);
405
+ resolve(true);
406
+ },
407
+ onDecline: () => {
408
+ setVisible(false);
409
+ resolve(false);
410
+ }
411
+ });
412
+ });
413
+ }
414
+ return /* @__PURE__ */ jsxs(ConfirmContext.Provider, {
415
+ value: { confirm },
416
+ children: [children, visible && /* @__PURE__ */ jsx(Confirm, { ...confirmProps })]
417
+ });
443
418
  }
419
+ //#endregion
420
+ //#region src/components/confirm/useConfirm.ts
444
421
  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;
422
+ const context = useContext(ConfirmContext);
423
+ if (!context) throw new Error("ConfirmProvider is missing");
424
+ const { confirm } = context;
425
+ return confirm;
451
426
  }
427
+ //#endregion
428
+ //#region src/components/confirm/withConfirm.tsx
452
429
  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
- };
430
+ function WithConfirm(props) {
431
+ const confirm = useConfirm();
432
+ const { t } = useTranslation();
433
+ function trans(arg) {
434
+ if (isTranslationDescriptor(arg)) return t(arg.id, { defaultValue: arg.defaultValue });
435
+ return arg;
436
+ }
437
+ async function deprecatedConfirm(title, message, acceptButtonLabel, declineButtonLabel, resolveWithConfirmation, acceptButtonStyle) {
438
+ const accepted = await confirm({
439
+ title: trans(title),
440
+ message: isTranslationDescriptor(message) ? trans(message) : message,
441
+ acceptButtonLabel: acceptButtonLabel ? trans(acceptButtonLabel) : void 0,
442
+ declineButtonLabel: declineButtonLabel ? trans(declineButtonLabel) : void 0,
443
+ acceptButtonStyle
444
+ });
445
+ if (resolveWithConfirmation) return accepted;
446
+ else if (!accepted) return new Promise(() => {});
447
+ }
448
+ return /* @__PURE__ */ jsx(WrappedComponent, {
449
+ ...props,
450
+ confirm: deprecatedConfirm
451
+ });
452
+ }
453
+ return function WithConfirmWrapper(props) {
454
+ return /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(WithConfirm, { ...props }) });
455
+ };
482
456
  }
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";
457
+ //#endregion
458
+ //#region src/assets/svg/icon_add.svg
459
+ 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";
460
+ //#endregion
461
+ //#region src/assets/svg/icon_cross.svg
462
+ 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";
463
+ //#endregion
464
+ //#region src/assets/svg/icon_edit.svg
465
+ 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";
466
+ //#endregion
467
+ //#region src/assets/svg/icon_gear.svg
468
+ 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";
469
+ //#endregion
470
+ //#region src/assets/svg/icon_duplicate.svg
471
+ 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";
472
+ //#endregion
473
+ //#region src/assets/svg/icon_download.svg
474
+ 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";
475
+ //#endregion
476
+ //#region src/assets/svg/icon_lupe.svg
477
+ 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";
478
+ //#endregion
479
+ //#region src/assets/svg/icon_key.svg
480
+ 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";
481
+ //#endregion
482
+ //#region src/assets/svg/icon_reload.svg
483
+ 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";
484
+ //#endregion
485
+ //#region src/assets/svg/icon_fullscreen.svg
486
+ 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";
487
+ //#endregion
488
+ //#region src/assets/svg/icon_help_light.svg
489
+ 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";
490
+ //#endregion
491
+ //#region src/assets/svg/icon_star.svg
492
+ 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";
493
+ //#endregion
494
+ //#region src/components/icon/Icon.tsx
495
495
  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
- }
496
+ const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
497
+ if (add) return icon_add_default;
498
+ else if (del) return icon_cross_default;
499
+ else if (edit) return icon_edit_default;
500
+ else if (config) return icon_gear_default;
501
+ else if (duplicate) return icon_duplicate_default;
502
+ else if (search) return icon_lupe_default;
503
+ else if (download) return icon_download_default;
504
+ else if (sync) return icon_reload_default;
505
+ else if (fullscreen) return icon_fullscreen_default;
506
+ else if (iconKey) return icon_key_default;
507
+ else if (documentation) return icon_help_light_default;
508
+ else if (star) return icon_star_default;
509
+ else throw Error("getSrc: no icon type specified");
524
510
  }
525
511
  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
- }
512
+ const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
513
+ if (add) return "icon add";
514
+ else if (del) return "icon delete";
515
+ else if (edit) return "icon edit";
516
+ else if (config) return "icon config";
517
+ else if (duplicate) return "icon duplicate";
518
+ else if (search) return "icon search";
519
+ else if (download) return "icon download";
520
+ else if (sync) return "icon sync";
521
+ else if (fullscreen) return "icon fullscreen";
522
+ else if (iconKey) return "icon iconKey";
523
+ else if (documentation) return "icon documentation";
524
+ else if (star) return "icon star";
525
+ else throw Error("getAlt: no icon type specified");
554
526
  }
555
527
  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 });
528
+ let style;
529
+ if (props.large) style = {
530
+ width: 24,
531
+ height: 24
532
+ };
533
+ else style = {
534
+ width: 16,
535
+ height: 16
536
+ };
537
+ if (props.inverted) style = {
538
+ ...style,
539
+ filter: "invert(1)"
540
+ };
541
+ return /* @__PURE__ */ jsx("img", {
542
+ src: getSrc(props),
543
+ className: `di icon ${props.className || ""}`,
544
+ alt: getAlt(props),
545
+ style
546
+ });
566
547
  }
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
- );
548
+ //#endregion
549
+ //#region src/components/label/Label.tsx
550
+ /**
551
+ * Label enables an easy way for marking or tagging elements.
552
+ */
553
+ function Label({ text, small = false, large = false, onDelete, className, onClick, children, ...dataTestIds }) {
554
+ function handleDelete(event) {
555
+ event.stopPropagation();
556
+ if (onDelete) onDelete();
557
+ }
558
+ return /* @__PURE__ */ jsxs("span", {
559
+ onClick,
560
+ className: cx("di label", className, {
561
+ large,
562
+ small,
563
+ removable: onDelete,
564
+ clickable: !!onClick
565
+ }),
566
+ "data-testid": dataTestIds["data-testid"],
567
+ children: [
568
+ typeof text === "string" ? text : text && /* @__PURE__ */ jsx(Trans, {
569
+ i18nKey: text.id,
570
+ children: text.defaultValue
571
+ }),
572
+ /* @__PURE__ */ jsx(Fragment, { children }),
573
+ onDelete && /* @__PURE__ */ jsx("span", {
574
+ "data-testid": dataTestIds["delete-button-data-testid"],
575
+ className: "remove",
576
+ onClick: handleDelete,
577
+ children: /* @__PURE__ */ jsx(Icon, {
578
+ del: true,
579
+ inverted: true
580
+ })
581
+ })
582
+ ]
583
+ });
596
584
  }
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
- ] });
585
+ //#endregion
586
+ //#region src/components/popup/Popup.tsx
587
+ var MARGIN = 16;
588
+ /**
589
+ * Popup displays content within a small modal.
590
+ * Its usage is highly flexible and used in several other components.
591
+ */
592
+ function Popup({ placement = "bottom", mode = ["click"], disabled, handler, handlerWrapperClassName, preventDestroyContentOnHide, open, onOpenChange, className, children }) {
593
+ const arrowRef = useRef(null);
594
+ const { elements, update, refs, floatingStyles, context, middlewareData, placement: computedPlacement } = useFloating({
595
+ placement,
596
+ open,
597
+ onOpenChange,
598
+ whileElementsMounted: !preventDestroyContentOnHide ? autoUpdate : void 0,
599
+ middleware: [
600
+ offset({ mainAxis: 12 }),
601
+ flip({
602
+ padding: MARGIN,
603
+ boundary: "clippingAncestors",
604
+ altBoundary: true
605
+ }),
606
+ shift({
607
+ padding: MARGIN,
608
+ boundary: "clippingAncestors",
609
+ altBoundary: true
610
+ }),
611
+ size({
612
+ padding: MARGIN,
613
+ boundary: "clippingAncestors",
614
+ altBoundary: true,
615
+ apply({ availableHeight, availableWidth, elements }) {
616
+ const width = `${Math.max(0, availableWidth - MARGIN)}px`;
617
+ const height = `${Math.max(0, availableHeight - MARGIN)}px`;
618
+ elements.floating.style.maxWidth = width;
619
+ elements.floating.style.maxHeight = height;
620
+ }
621
+ }),
622
+ arrow({ element: arrowRef })
623
+ ]
624
+ });
625
+ useEffect(() => {
626
+ if (preventDestroyContentOnHide && open && elements.reference && elements.floating) return autoUpdate(elements.reference, elements.floating, update);
627
+ }, [
628
+ elements.floating,
629
+ elements.reference,
630
+ open,
631
+ update,
632
+ preventDestroyContentOnHide
633
+ ]);
634
+ const { getReferenceProps, getFloatingProps } = useInteractions([
635
+ useClick(context, {
636
+ enabled: !disabled && mode.includes("click"),
637
+ keyboardHandlers: false
638
+ }),
639
+ useHover(context, {
640
+ enabled: !disabled && mode.includes("hover"),
641
+ handleClose: safePolygon()
642
+ }),
643
+ useFocus(context, { enabled: !disabled && mode.includes("focus") }),
644
+ useDismiss(context)
645
+ ]);
646
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
647
+ style: { display: "inline-block" },
648
+ className: cx("popup-handler-wrapper", handlerWrapperClassName),
649
+ ref: refs.setReference,
650
+ ...getReferenceProps(),
651
+ children: handler
652
+ }), (open || preventDestroyContentOnHide) && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx("div", {
653
+ className: cx("di popup-wrapper", { hidden: preventDestroyContentOnHide && !open }),
654
+ ref: refs.setFloating,
655
+ style: {
656
+ ...floatingStyles,
657
+ zIndex: 1e5
658
+ },
659
+ ...getFloatingProps(),
660
+ children: /* @__PURE__ */ jsxs("div", {
661
+ className: cx("di popup", computedPlacement, className),
662
+ children: [/* @__PURE__ */ jsx("div", {
663
+ className: cx("popup-arrow", computedPlacement),
664
+ ref: arrowRef,
665
+ style: {
666
+ left: middlewareData.arrow?.x,
667
+ top: middlewareData.arrow?.y
668
+ }
669
+ }), /* @__PURE__ */ jsx("div", {
670
+ className: "popup-content",
671
+ children
672
+ })]
673
+ })
674
+ }) })] });
704
675
  }
676
+ //#endregion
677
+ //#region src/components/bubble/Bubble.tsx
678
+ /**
679
+ * 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.
680
+ */
705
681
  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
- );
682
+ const [open, setOpen] = useState(false);
683
+ return /* @__PURE__ */ jsx(Popup, {
684
+ open,
685
+ onOpenChange: setOpen,
686
+ handler: children,
687
+ disabled,
688
+ mode: ["hover"],
689
+ placement: direction ? direction : "top",
690
+ className: `bubble ${inverted ? "inverted" : ""} ${className ? className : ""}`,
691
+ children: /* @__PURE__ */ jsx("span", {
692
+ className: `bubble-content`,
693
+ style,
694
+ children: content
695
+ })
696
+ });
720
697
  }
698
+ //#endregion
699
+ //#region src/components/tooltip/Tooltip.tsx
700
+ /**
701
+ * Tooltip is best used to display some short additional information or description
702
+ */
721
703
  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
- );
704
+ const [open, setOpen] = useState(false);
705
+ return /* @__PURE__ */ jsx(Popup, {
706
+ open,
707
+ disabled,
708
+ mode: ["hover"],
709
+ onOpenChange: setOpen,
710
+ handler: children,
711
+ placement: direction ? direction : "right",
712
+ className: `tooltip inverted ${className ? className : ""}`,
713
+ children: /* @__PURE__ */ jsx("span", {
714
+ className: "tooltip-content",
715
+ children: content
716
+ })
717
+ });
736
718
  }
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
719
+ //#endregion
720
+ //#region src/components/tabs/Tabs.tsx
721
+ /**
722
+ * Tabs add the possibility to unite several homogeneous pages into one.
723
+ * Unlike RouteTabs, Tabs cannot be accessed directly via the browser's history
724
+ */
725
+ var Tabs = class extends React$1.Component {
726
+ state = { currentTab: this.props.pages.length ? this.props.pages[0].name : null };
727
+ handleClick = (tab) => {
728
+ if (this.props.onChange) this.props.onChange(tab);
729
+ else if (typeof this.props.currentTab === "undefined") this.setState({ currentTab: tab });
730
+ };
731
+ currentTabPage = () => {
732
+ const currentTab = typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab;
733
+ return this.props.pages.find(({ name }) => currentTab === name);
734
+ };
735
+ isCurrentTab = (tab) => {
736
+ return (typeof this.props.currentTab === "string" ? this.props.currentTab : this.state.currentTab) === tab;
737
+ };
738
+ renderBody = () => {
739
+ const page = this.currentTabPage();
740
+ if (page && typeof page.renderBody === "function") return page.renderBody();
741
+ return null;
742
+ };
743
+ render() {
744
+ const { pages, disabled } = this.props;
745
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
746
+ className: "di tabs",
747
+ children: pages.map(({ name, renderHeading, tabDescription }) => tabDescription ? /* @__PURE__ */ jsx(Bubble, {
748
+ inverted: true,
749
+ content: tabDescription,
750
+ className: "bubble-tab-description",
751
+ children: /* @__PURE__ */ jsx("button", {
752
+ "data-testid": "tab-button",
753
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
754
+ onClick: () => !disabled && this.handleClick(name),
755
+ children: renderHeading()
756
+ })
757
+ }, name) : /* @__PURE__ */ jsx("button", {
758
+ "data-testid": "tab-button",
759
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
760
+ onClick: () => !disabled && this.handleClick(name),
761
+ children: renderHeading()
762
+ }, name))
763
+ }), this.renderBody()] });
764
+ }
765
+ };
766
+ //#endregion
767
+ //#region src/components/input/SearchBox.tsx
768
+ var ClearButton = ({ onChange, inputElement, style }) => /* @__PURE__ */ jsx(Button_default, {
769
+ naked: true,
770
+ onClick: () => {
771
+ onChange("");
772
+ if (inputElement) inputElement.focus();
773
+ },
774
+ style,
775
+ children: /* @__PURE__ */ jsx(Icon, { del: true })
776
+ });
777
+ /**
778
+ * SearchBox is used for searching content and provides a set of `props` for different user experiences
779
+ */
780
+ var SearchBox = class extends React$1.Component {
781
+ state = { query: this.props.initialValue || "" };
782
+ input;
783
+ printPlaceholder() {
784
+ const { t, placeholder } = this.props;
785
+ if (typeof placeholder === "object") return t(placeholder.id, { defaultValue: placeholder.defaultValue });
786
+ else return placeholder;
787
+ }
788
+ handleChange = (value) => {
789
+ const { onChange } = this.props;
790
+ this.setState({ query: value });
791
+ onChange(value);
792
+ };
793
+ handleKeyUp = ({ key }) => {
794
+ const { onSubmit } = this.props;
795
+ const { query } = this.state;
796
+ if (key === "Enter" && typeof onSubmit === "function") onSubmit(query);
797
+ };
798
+ render() {
799
+ const { onSubmit, style, clearable } = this.props;
800
+ const { query } = this.state;
801
+ return /* @__PURE__ */ jsxs("div", {
802
+ className: "search-box",
803
+ style,
804
+ children: [/* @__PURE__ */ jsx("input", {
805
+ ref: (input) => {
806
+ this.input = input;
807
+ },
808
+ type: "text",
809
+ value: query,
810
+ placeholder: this.printPlaceholder(),
811
+ onKeyUp: this.handleKeyUp,
812
+ onChange: ({ target: { value } }) => this.handleChange(value)
813
+ }), typeof onSubmit === "function" ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [query && clearable && /* @__PURE__ */ jsx(ClearButton, {
814
+ onChange: this.handleChange,
815
+ inputElement: this.input,
816
+ style: { right: 30 }
817
+ }), /* @__PURE__ */ jsx(Button_default, {
818
+ naked: true,
819
+ onClick: () => onSubmit(query),
820
+ children: /* @__PURE__ */ jsx(Icon, { search: true })
821
+ })] }) : query && clearable ? /* @__PURE__ */ jsx(ClearButton, {
822
+ onChange: this.handleChange,
823
+ inputElement: this.input
824
+ }) : /* @__PURE__ */ jsx(Button_default, {
825
+ naked: true,
826
+ disabled: true,
827
+ children: /* @__PURE__ */ jsx(Icon, { search: true })
828
+ })]
829
+ });
830
+ }
893
831
  };
894
- //# sourceMappingURL=index.js.map
832
+ var SearchBox_default = withTranslation()(SearchBox);
833
+ //#endregion
834
+ 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 };
835
+
836
+ //# sourceMappingURL=index.js.map