@deviceinsight/ng-ui-basic-components 7.1.0 → 7.4.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,49 +1,59 @@
1
- import { jsx as a, jsxs as m, Fragment as R } from "react/jsx-runtime";
2
- import * as w from "react";
3
- import T, { useRef as V, useEffect as N, useState as y, createContext as q, useContext as X } from "react";
4
- import g from "classnames";
5
- import { withTranslation as M, Trans as k, useTranslation as Y } from "react-i18next";
6
- import G from "react-dom";
7
- import J from "react-draggable";
8
- import { useFloating as Q, offset as ee, flip as te, shift as ne, size as ie, arrow as se, autoUpdate as L, useClick as ae, useHover as oe, safePolygon as re, useFocus as ce, useDismiss as le, useInteractions as de, FloatingPortal as ue } from "@floating-ui/react";
9
- class Xe extends w.Component {
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";
4
+ import cx from "classnames";
5
+ import { withTranslation, Trans, useTranslation } from "react-i18next";
6
+ import ReactDOM from "react-dom";
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
10
  state = {
11
11
  currentPageIndex: -1
12
12
  };
13
13
  componentDidMount() {
14
- const { defaultOpenPageIndex: e } = this.props;
15
- e != null && this.handleAccordionToggle(e);
14
+ const { defaultOpenPageIndex } = this.props;
15
+ if (defaultOpenPageIndex !== null && defaultOpenPageIndex !== void 0) {
16
+ this.handleAccordionToggle(defaultOpenPageIndex);
17
+ }
16
18
  }
17
- handleAccordionToggle = (e) => {
18
- const { onPageChange: n } = this.props, i = this.state.currentPageIndex !== e ? e : -1;
19
+ handleAccordionToggle = (index) => {
20
+ const { onPageChange } = this.props;
21
+ const newPageIndex = this.state.currentPageIndex !== index ? index : -1;
19
22
  this.setState({
20
- currentPageIndex: i
21
- }), n && n(i);
23
+ currentPageIndex: newPageIndex
24
+ });
25
+ if (onPageChange) {
26
+ onPageChange(newPageIndex);
27
+ }
22
28
  };
23
29
  render() {
24
- const { children: e, accordionClass: n } = this.props, { currentPageIndex: i } = this.state;
25
- return /* @__PURE__ */ a("div", { className: n ? `di accordion ${n}` : "di accordion", children: e && e.map(
26
- (s, o) => s ? /* @__PURE__ */ a(
27
- s.type,
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,
28
35
  {
29
- index: o,
30
- isOpen: i === o,
31
- toggle: () => this.handleAccordionToggle(o),
32
- ...s.props
36
+ index,
37
+ isOpen: currentPageIndex === index,
38
+ toggle: () => this.handleAccordionToggle(index),
39
+ ...child.props
33
40
  },
34
- o
41
+ index
35
42
  ) : null
36
43
  ) });
37
44
  }
38
45
  }
39
- class Ye extends w.PureComponent {
46
+ class AccordionItem extends React.PureComponent {
40
47
  render() {
41
- const { badge: e, children: n, isOpen: i, info1: s, itemClasses: o, title: r, titleTooltip: c, toggle: l, tools: u, ...h } = this.props, d = ["item"];
42
- return o && d.push(o), i && d.push("open"), /* @__PURE__ */ m("div", { className: d.join(" "), children: [
43
- /* @__PURE__ */ m("div", { className: "head", children: [
44
- /* @__PURE__ */ m("span", { className: "title", onClick: l, "data-testid": h["data-testid"], children: [
45
- /* @__PURE__ */ a("h1", { title: c, children: r }),
46
- e && /* @__PURE__ */ a(
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(
47
57
  "span",
48
58
  {
49
59
  className: "di label",
@@ -52,110 +62,146 @@ class Ye extends w.PureComponent {
52
62
  backgroundColor: "#ddd",
53
63
  borderColor: "transparent"
54
64
  },
55
- children: e
65
+ children: badge
56
66
  }
57
67
  ),
58
- s && /* @__PURE__ */ a("span", { style: s.cssStyle, children: s.text })
68
+ info1 && /* @__PURE__ */ jsx("span", { style: info1.cssStyle, children: info1.text })
59
69
  ] }),
60
- /* @__PURE__ */ a("span", { className: "tools", children: u && u.map((p, f) => /* @__PURE__ */ a("span", { className: "tool", children: p }, f)) })
70
+ /* @__PURE__ */ jsx("span", { className: "tools", children: tools && tools.map((toolComponent, index) => /* @__PURE__ */ jsx("span", { className: "tool", children: toolComponent }, index)) })
61
71
  ] }),
62
- /* @__PURE__ */ a("div", { className: "cont", children: n })
72
+ /* @__PURE__ */ jsx("div", { className: "cont", children })
63
73
  ] });
64
74
  }
65
75
  }
66
- function he({
67
- children: t,
68
- title: e,
69
- type: n,
70
- disabled: i,
71
- onClick: s,
72
- style: o,
73
- tabIndex: r,
74
- t: c,
75
- primary: l,
76
- danger: u,
77
- naked: h,
78
- className: d,
79
- small: p,
80
- ...f
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
81
91
  }) {
82
- let v = e;
83
- return e && typeof e != "string" && (v = c(e.id, {
84
- defaultValue: e.defaultValue
85
- })), /* @__PURE__ */ a(
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(
86
99
  "button",
87
100
  {
88
- "data-testid": f["data-testid"],
89
- type: n || "button",
90
- className: g("di button", d, { small: p, primary: l, danger: u, link: h }),
91
- title: typeof v == "string" ? v : void 0,
92
- disabled: i,
93
- onClick: s,
94
- style: o,
95
- tabIndex: r,
96
- children: t
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
97
110
  }
98
111
  );
99
112
  }
100
- const x = M()(he), pe = ({ children: t, dividing: e, className: n, style: i }) => /* @__PURE__ */ a("div", { style: i, className: `di button-row ${e ? "dividing" : ""} ${n || ""}`, children: t });
101
- pe.defaultProps = {
102
- dividing: !1
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
117
+ };
118
+ const isTouchEvent = (event) => {
119
+ return !!event.touches;
103
120
  };
104
- const me = (t) => !!t.touches, fe = (t, e) => {
105
- const n = t.getBoundingClientRect();
106
- let i, s;
107
- return me(e) ? (i = e.touches[0].pageX, s = e.touches[0].pageY) : (i = e.pageX, s = e.pageY), n.left <= i && n.right >= i && n.top <= s && n.bottom >= s;
108
- }, ge = (t, e) => {
109
- const n = V(e);
110
- N(() => {
111
- n.current = e;
112
- }, [e]), N(() => {
113
- const i = (s) => {
114
- t.filter((r) => r != null).every(
115
- (r) => r !== s.target && !r.contains(s.target) && !fe(r, s)
116
- ) && n.current(s);
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
+ };
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
+ }
117
146
  };
118
- return document.addEventListener("mousedown", i, !0), document.addEventListener("touchstart", i, !0), () => {
119
- document.removeEventListener("mousedown", i, !0), document.removeEventListener("touchstart", i, !0);
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);
120
152
  };
121
- }, [t]);
153
+ }, [elements]);
122
154
  };
123
- function ve({ className: t, width: e, header: n, content: i, footer: s, onOutsideClick: o }) {
124
- const r = V(null), [c, l] = y(null);
125
- return N(() => {
126
- l(r.current);
127
- }, []), ge([c], () => {
128
- o && o();
129
- }), /* @__PURE__ */ a(J, { handle: ".modal-header", nodeRef: r, children: /* @__PURE__ */ m(
155
+ 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(
130
165
  "div",
131
166
  {
132
- ref: r,
133
- className: `modal-window ${t || ""}`,
167
+ ref,
168
+ className: `modal-window ${className || ""}`,
134
169
  style: {
135
- maxWidth: e
170
+ maxWidth: width
136
171
  },
137
172
  children: [
138
- n && /* @__PURE__ */ a("div", { className: "modal-header", children: n }),
139
- i && /* @__PURE__ */ a("div", { className: "modal-content", children: i }),
140
- s && /* @__PURE__ */ a("div", { className: "modal-footer", children: s })
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 })
141
176
  ]
142
177
  }
143
178
  ) });
144
179
  }
145
- class we extends T.Component {
180
+ class Modal extends React__default.Component {
146
181
  static defaultProps = {
147
182
  width: "60%"
148
183
  };
149
184
  container;
150
185
  modalRoot;
151
186
  timeoutId;
152
- constructor(e) {
153
- super(e), this.state = {
187
+ constructor(props) {
188
+ super(props);
189
+ this.state = {
154
190
  className: "di modal"
155
191
  };
156
192
  }
157
193
  componentDidMount() {
158
- this.container = document.createElement("div"), this.modalRoot = document.getElementById("modal-root"), this.modalRoot ? this.modalRoot.appendChild(this.container) : document.body && document.body.appendChild(this.container), this.props.onOutsideClick && window.addEventListener("keydown", this.keyEventHandler), this.timeoutId = setTimeout(
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(
159
205
  () => this.setState({
160
206
  className: `di modal show ${this.props.className || ""}`
161
207
  }),
@@ -163,177 +209,210 @@ class we extends T.Component {
163
209
  );
164
210
  }
165
211
  componentWillUnmount() {
166
- this.container && (this.modalRoot ? this.modalRoot.removeChild(this.container) : document.body && document.body.removeChild(this.container)), this.props.onOutsideClick && window.removeEventListener("keydown", this.keyEventHandler), this.timeoutId && clearTimeout(this.timeoutId);
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
+ }
167
225
  }
168
- keyEventHandler = (e) => {
169
- e.key === "Escape" && this.props.onOutsideClick && this.props.onOutsideClick(e);
226
+ keyEventHandler = (event) => {
227
+ if (event.key === "Escape" && this.props.onOutsideClick) {
228
+ this.props.onOutsideClick(event);
229
+ }
170
230
  };
171
231
  render() {
172
- return this.container ? G.createPortal(
173
- /* @__PURE__ */ a("div", { className: this.state.className, onMouseDown: this.props.onMouseDown, children: /* @__PURE__ */ a(ve, { ...this.props }) }),
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 }) }),
174
237
  this.container
175
- ) : null;
238
+ );
176
239
  }
177
240
  }
178
- class Ge extends T.PureComponent {
241
+ class ModalContainer extends React__default.PureComponent {
179
242
  render() {
180
- return /* @__PURE__ */ a("div", { id: "modal-root" });
243
+ return /* @__PURE__ */ jsx("div", { id: "modal-root" });
181
244
  }
182
245
  }
183
- class ye extends T.Component {
246
+ class Spinner extends React__default.Component {
184
247
  static defaultProps = {
185
248
  size: 56,
186
- center: !1
249
+ center: false
187
250
  };
188
251
  render() {
189
- const { size: e = 56, center: n, ...i } = this.props;
190
- let s = {
191
- width: e,
192
- height: e
252
+ const { size: size2 = 56, center, ...dataAttrs } = this.props;
253
+ let style = {
254
+ width: size2,
255
+ height: size2
193
256
  };
194
- return n && (s = {
195
- ...s,
196
- position: "absolute",
197
- top: "50%",
198
- left: "50%",
199
- marginTop: -e / 2,
200
- marginLeft: -e / 2
201
- }), /* @__PURE__ */ a("div", { className: "di spinner", style: s, ...i });
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 });
202
268
  }
203
269
  }
204
- class Je extends T.Component {
270
+ class SpinnerContainer extends React__default.Component {
205
271
  static defaultProps = {
206
272
  size: 56
207
273
  };
208
274
  render() {
209
- const { show: e, size: n, children: i, className: s } = this.props, o = `di spinner-wrapper ${s || ""}`;
210
- return /* @__PURE__ */ m("div", { className: o, children: [
211
- /* @__PURE__ */ a(
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(
212
279
  "div",
213
280
  {
214
- className: `di spinner-container ${e ? "visible" : ""}`,
281
+ className: `di spinner-container ${show ? "visible" : ""}`,
215
282
  "data-testid": this.props["data-testid"],
216
- children: /* @__PURE__ */ a(ye, { size: n, center: !0 })
283
+ children: /* @__PURE__ */ jsx(Spinner, { size: size2, center: true })
217
284
  }
218
285
  ),
219
- i
286
+ children
220
287
  ] });
221
288
  }
222
289
  }
223
- const xe = (t, e) => {
224
- switch (t) {
290
+ const getWrapperClassName = (type, small) => {
291
+ switch (type) {
225
292
  case "checkbox":
226
293
  case "radio":
227
294
  return "di checkbox";
228
295
  case "toggle":
229
- return e ? "di toggle toggle-small" : "di toggle";
296
+ return small ? "di toggle toggle-small" : "di toggle";
230
297
  default:
231
- throw Error(`type not support: ${t}`);
298
+ throw Error(`type not support: ${type}`);
232
299
  }
233
- }, be = (t, e) => {
234
- switch (t) {
300
+ };
301
+ const getCheckboxClassName = (type, small) => {
302
+ switch (type) {
235
303
  case "checkbox":
236
304
  return "box";
237
305
  case "radio":
238
306
  return "radio";
239
307
  case "toggle":
240
- return e ? "switch switch-small" : "switch";
308
+ return small ? "switch switch-small" : "switch";
241
309
  default:
242
- throw Error(`type not support: ${t}`);
310
+ throw Error(`type not support: ${type}`);
243
311
  }
244
- }, Ce = ({
245
- type: t = "checkbox",
246
- value: e,
247
- onChange: n,
248
- title: i,
249
- label: s,
250
- disabled: o = !1,
251
- toggleSmall: r = !1,
252
- toggleColor: c = "#259b23",
253
- t: l,
254
- ...u
312
+ };
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
255
324
  }) => {
256
- const h = t === "toggle" ? {
257
- backgroundColor: e ? c : "gray"
258
- } : {}, d = i ? l(i.id, {
259
- defaultValue: i.defaultValue
260
- }) : void 0, p = s ? l(s.id, {
261
- defaultValue: s.defaultValue
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
262
333
  }) : null;
263
- return /* @__PURE__ */ m(
334
+ return /* @__PURE__ */ jsxs(
264
335
  "label",
265
336
  {
266
- title: d,
267
- className: xe(t, r),
268
- "data-testid": u["wrapper-data-testid"],
337
+ title: tooltip,
338
+ className: getWrapperClassName(type, toggleSmall),
339
+ "data-testid": other["wrapper-data-testid"],
269
340
  children: [
270
- /* @__PURE__ */ a(
341
+ /* @__PURE__ */ jsx(
271
342
  "input",
272
343
  {
273
344
  type: "checkbox",
274
- checked: e,
275
- disabled: o,
276
- onChange: () => n(!e),
277
- "data-testid": u["data-testid"]
345
+ checked: value,
346
+ disabled,
347
+ onChange: () => onChange(!value),
348
+ "data-testid": other["data-testid"]
278
349
  }
279
350
  ),
280
- /* @__PURE__ */ a(
351
+ /* @__PURE__ */ jsx(
281
352
  "div",
282
353
  {
283
- className: be(t, r),
284
- style: h,
285
- "data-testid": u["innerdiv-data-testid"]
354
+ className: getCheckboxClassName(type, toggleSmall),
355
+ style,
356
+ "data-testid": other["innerdiv-data-testid"]
286
357
  }
287
358
  ),
288
- s && /* @__PURE__ */ a("span", { className: "textlabel", children: p })
359
+ label && /* @__PURE__ */ jsx("span", { className: "textlabel", children: labelText })
289
360
  ]
290
361
  }
291
362
  );
292
- }, Qe = M()(Ce);
293
- function P(t) {
294
- const e = typeof t == "object" && typeof t.id == "string" && typeof t.defaultValue == "string";
295
- return e && console.warn(
296
- "Please use strings instead of TranslationDescriptors to initialize the Confirm modal, because TranslationDescriptors are deprecated"
297
- ), e;
363
+ };
364
+ const Checkbox_default = withTranslation()(Checkbox);
365
+ 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;
298
373
  }
299
- function C(t) {
300
- return P(t) ? /* @__PURE__ */ a(k, { i18nKey: t.id, children: t.defaultValue }) : t;
374
+ function transformTextToElement(message) {
375
+ if (isTranslationDescriptor(message)) {
376
+ return /* @__PURE__ */ jsx(Trans, { i18nKey: message.id, children: message.defaultValue });
377
+ }
378
+ return message;
301
379
  }
302
- function Ne({
303
- title: t,
304
- message: e,
305
- onAccept: n,
306
- onDecline: i,
307
- acceptButtonLabel: s,
308
- declineButtonLabel: o,
309
- acceptButtonStyle: r = "primary"
380
+ function Confirm({
381
+ title,
382
+ message,
383
+ onAccept,
384
+ onDecline,
385
+ acceptButtonLabel,
386
+ declineButtonLabel,
387
+ acceptButtonStyle = "primary"
310
388
  }) {
311
- return /* @__PURE__ */ a(
312
- we,
389
+ return /* @__PURE__ */ jsx(
390
+ Modal,
313
391
  {
314
- header: C(t),
315
- content: C(e),
316
- footer: /* @__PURE__ */ m("div", { children: [
317
- /* @__PURE__ */ a(
318
- x,
392
+ header: transformTextToElement(title),
393
+ content: transformTextToElement(message),
394
+ footer: /* @__PURE__ */ jsxs("div", { children: [
395
+ /* @__PURE__ */ jsx(
396
+ Button$1,
319
397
  {
320
- primary: r === "primary",
321
- danger: r === "danger",
322
- onClick: n,
323
- children: s ? C(s) : /* @__PURE__ */ a(k, { i18nKey: "form.accept", children: "Accept" })
398
+ primary: acceptButtonStyle === "primary",
399
+ danger: acceptButtonStyle === "danger",
400
+ onClick: onAccept,
401
+ children: acceptButtonLabel ? transformTextToElement(acceptButtonLabel) : /* @__PURE__ */ jsx(Trans, { i18nKey: "form.accept", children: "Accept" })
324
402
  }
325
403
  ),
326
- /* @__PURE__ */ a(x, { onClick: i, children: o ? C(o) : /* @__PURE__ */ a(k, { i18nKey: "form.decline", children: "Decline" }) })
404
+ /* @__PURE__ */ jsx(Button$1, { onClick: onDecline, children: declineButtonLabel ? transformTextToElement(declineButtonLabel) : /* @__PURE__ */ jsx(Trans, { i18nKey: "form.decline", children: "Decline" }) })
327
405
  ] }),
328
406
  width: 500
329
407
  }
330
408
  );
331
409
  }
332
- const Z = q({
410
+ const ConfirmContext = createContext({
333
411
  confirm: () => Promise.reject(new Error("ConfirmProvider is missing!"))
334
412
  });
335
- function ke({ children: t }) {
336
- const [e, n] = y(!1), [i, s] = y({
413
+ function ConfirmProvider({ children }) {
414
+ const [visible, setVisible] = useState(false);
415
+ const [confirmProps, setConfirmProps] = useState({
337
416
  title: "",
338
417
  message: "",
339
418
  onAccept: () => {
@@ -341,353 +420,442 @@ function ke({ children: t }) {
341
420
  onDecline: () => {
342
421
  }
343
422
  });
344
- async function o(r) {
345
- return new Promise((c) => {
346
- n(!0), s({
347
- ...r,
423
+ async function confirm(options) {
424
+ return new Promise((resolve) => {
425
+ setVisible(true);
426
+ setConfirmProps({
427
+ ...options,
348
428
  onAccept: () => {
349
- n(!1), c(!0);
429
+ setVisible(false);
430
+ resolve(true);
350
431
  },
351
432
  onDecline: () => {
352
- n(!1), c(!1);
433
+ setVisible(false);
434
+ resolve(false);
353
435
  }
354
436
  });
355
437
  });
356
438
  }
357
- return /* @__PURE__ */ m(Z.Provider, { value: { confirm: o }, children: [
358
- t,
359
- e && /* @__PURE__ */ a(Ne, { ...i })
439
+ return /* @__PURE__ */ jsxs(ConfirmContext.Provider, { value: { confirm }, children: [
440
+ children,
441
+ visible && /* @__PURE__ */ jsx(Confirm, { ...confirmProps })
360
442
  ] });
361
443
  }
362
- function Ae() {
363
- const t = X(Z);
364
- if (!t)
444
+ function useConfirm() {
445
+ const context = useContext(ConfirmContext);
446
+ if (!context) {
365
447
  throw new Error("ConfirmProvider is missing");
366
- const { confirm: e } = t;
367
- return e;
448
+ }
449
+ const { confirm } = context;
450
+ return confirm;
368
451
  }
369
- function et(t) {
370
- function e(n) {
371
- const i = Ae(), { t: s } = Y();
372
- function o(c) {
373
- return P(c) ? s(c.id, { defaultValue: c.defaultValue }) : c;
452
+ 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;
374
461
  }
375
- async function r(c, l, u, h, d, p) {
376
- const f = await i({
377
- title: o(c),
378
- message: P(l) ? o(l) : l,
379
- acceptButtonLabel: u ? o(u) : void 0,
380
- declineButtonLabel: h ? o(h) : void 0,
381
- acceptButtonStyle: p
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
382
469
  });
383
- if (d)
384
- return f;
385
- if (!f)
470
+ if (resolveWithConfirmation) {
471
+ return accepted;
472
+ } else if (!accepted) {
386
473
  return new Promise(() => {
387
474
  });
475
+ }
388
476
  }
389
- return /* @__PURE__ */ a(t, { ...n, confirm: r });
477
+ return /* @__PURE__ */ jsx(WrappedComponent, { ...props, confirm: deprecatedConfirm });
390
478
  }
391
- return function(i) {
392
- return /* @__PURE__ */ a(ke, { children: /* @__PURE__ */ a(e, { ...i }) });
479
+ return function WithConfirmWrapper(props) {
480
+ return /* @__PURE__ */ jsx(ConfirmProvider, { children: /* @__PURE__ */ jsx(WithConfirm, { ...props }) });
393
481
  };
394
482
  }
395
- const Te = "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", Pe = "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", Ve = "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", Me = "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", Ee = "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", Be = "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", He = "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", Le = "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", _e = "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", $e = "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", Re = "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", Ze = "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";
396
- function Ie(t) {
397
- const { add: e, del: n, edit: i, config: s, duplicate: o, search: r, download: c, sync: l, fullscreen: u, iconKey: h, documentation: d, star: p } = t;
398
- if (e)
399
- return Te;
400
- if (n)
401
- return Pe;
402
- if (i)
403
- return Ve;
404
- if (s)
405
- return Me;
406
- if (o)
407
- return Ee;
408
- if (r)
409
- return He;
410
- if (c)
411
- return Be;
412
- if (l)
413
- return _e;
414
- if (u)
415
- return $e;
416
- if (h)
417
- return Le;
418
- if (d)
419
- return Re;
420
- if (p)
421
- return Ze;
422
- throw Error("getSrc: no icon type specified");
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";
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
+ }
423
524
  }
424
- function Se(t) {
425
- const { add: e, del: n, edit: i, config: s, duplicate: o, search: r, download: c, sync: l, fullscreen: u, iconKey: h, documentation: d, star: p } = t;
426
- if (e)
525
+ function getAlt(props) {
526
+ const { add, del, edit, config, duplicate, search, download, sync, fullscreen, iconKey, documentation, star } = props;
527
+ if (add) {
427
528
  return "icon add";
428
- if (n)
529
+ } else if (del) {
429
530
  return "icon delete";
430
- if (i)
531
+ } else if (edit) {
431
532
  return "icon edit";
432
- if (s)
533
+ } else if (config) {
433
534
  return "icon config";
434
- if (o)
535
+ } else if (duplicate) {
435
536
  return "icon duplicate";
436
- if (r)
537
+ } else if (search) {
437
538
  return "icon search";
438
- if (c)
539
+ } else if (download) {
439
540
  return "icon download";
440
- if (l)
541
+ } else if (sync) {
441
542
  return "icon sync";
442
- if (u)
543
+ } else if (fullscreen) {
443
544
  return "icon fullscreen";
444
- if (h)
545
+ } else if (iconKey) {
445
546
  return "icon iconKey";
446
- if (d)
547
+ } else if (documentation) {
447
548
  return "icon documentation";
448
- if (p)
549
+ } else if (star) {
449
550
  return "icon star";
450
- throw Error("getAlt: no icon type specified");
551
+ } else {
552
+ throw Error("getAlt: no icon type specified");
553
+ }
451
554
  }
452
- function A(t) {
453
- let e;
454
- return t.large ? e = { width: 24, height: 24 } : e = { width: 16, height: 16 }, t.inverted && (e = { ...e, filter: "invert(1)" }), /* @__PURE__ */ a("img", { src: Ie(t), className: `di icon ${t.className || ""}`, alt: Se(t), style: e });
555
+ 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 });
455
566
  }
456
- function tt({
457
- text: t,
458
- small: e = !1,
459
- large: n = !1,
460
- onDelete: i,
461
- className: s,
462
- onClick: o,
463
- children: r,
464
- ...c
567
+ function Label({
568
+ text,
569
+ small = false,
570
+ large = false,
571
+ onDelete,
572
+ className,
573
+ onClick,
574
+ children,
575
+ ...dataTestIds
465
576
  }) {
466
- function l(u) {
467
- u.stopPropagation(), i && i();
577
+ function handleDelete(event) {
578
+ event.stopPropagation();
579
+ if (onDelete) {
580
+ onDelete();
581
+ }
468
582
  }
469
- return /* @__PURE__ */ m(
583
+ return /* @__PURE__ */ jsxs(
470
584
  "span",
471
585
  {
472
- onClick: o,
473
- className: g("di label", s, { large: n, small: e, removable: i, clickable: !!o }),
474
- "data-testid": c["data-testid"],
586
+ onClick,
587
+ className: cx("di label", className, { large, small, removable: onDelete, clickable: !!onClick }),
588
+ "data-testid": dataTestIds["data-testid"],
475
589
  children: [
476
- typeof t == "string" ? t : t && /* @__PURE__ */ a(k, { i18nKey: t.id, children: t.defaultValue }),
477
- /* @__PURE__ */ a(R, { children: r }),
478
- i && /* @__PURE__ */ a("span", { "data-testid": c["delete-button-data-testid"], className: "remove", onClick: l, children: /* @__PURE__ */ a(A, { del: !0, inverted: !0 }) })
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 }) })
479
593
  ]
480
594
  }
481
595
  );
482
596
  }
483
- const _ = 16;
484
- function I({
485
- placement: t = "bottom",
486
- mode: e = ["click"],
487
- disabled: n,
488
- handler: i,
489
- handlerWrapperClassName: s,
490
- preventDestroyContentOnHide: o,
491
- open: r,
492
- onOpenChange: c,
493
- className: l,
494
- children: u
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
495
609
  }) {
496
- const h = V(null), { elements: d, update: p, refs: f, floatingStyles: v, context: b, middlewareData: E } = Q({
497
- placement: t,
498
- open: r,
499
- onOpenChange: c,
500
- whileElementsMounted: o ? void 0 : L,
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,
501
624
  middleware: [
502
- ee({
625
+ offset({
503
626
  mainAxis: 12
504
627
  }),
505
- te(),
506
- ne(),
507
- ie({
508
- apply({ availableHeight: B, availableWidth: j, elements: H }) {
509
- const z = `${Math.max(0, j - _)}px`, U = `${Math.max(0, B - _)}px`;
510
- H.floating.style.maxWidth = z, H.floating.style.maxHeight = U;
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;
511
647
  }
512
648
  }),
513
- se({
514
- element: h
649
+ arrow({
650
+ element: arrowRef
515
651
  })
516
652
  ]
517
653
  });
518
- N(() => {
519
- if (o && r && d.reference && d.floating)
520
- return L(d.reference, d.floating, p);
521
- }, [d.floating, d.reference, r, p, o]);
522
- const S = ae(b, { enabled: !n && e.includes("click") }), D = oe(b, {
523
- enabled: !n && e.includes("hover"),
524
- handleClose: re()
525
- }), K = ce(b, { enabled: !n && e.includes("focus") }), F = le(b), { getReferenceProps: O, getFloatingProps: W } = de([S, D, K, F]);
526
- return /* @__PURE__ */ m(R, { children: [
527
- /* @__PURE__ */ a(
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(
528
674
  "span",
529
675
  {
530
676
  style: { display: "inline-block" },
531
- className: g("popup-handler-wrapper", s),
532
- ref: f.setReference,
533
- ...O(),
534
- children: i
677
+ className: cx("popup-handler-wrapper", handlerWrapperClassName),
678
+ ref: refs.setReference,
679
+ ...getReferenceProps(),
680
+ children: handler
535
681
  }
536
682
  ),
537
- (r || o) && /* @__PURE__ */ a(ue, { children: /* @__PURE__ */ a(
683
+ (open || preventDestroyContentOnHide) && /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
538
684
  "div",
539
685
  {
540
- className: g("di popup-wrapper", { hidden: o && !r }),
541
- ref: f.setFloating,
542
- style: v,
543
- ...W(),
544
- children: /* @__PURE__ */ m("div", { className: g("di popup", t, l), children: [
545
- /* @__PURE__ */ a(
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(
546
692
  "div",
547
693
  {
548
- className: g("popup-arrow", t),
549
- ref: h,
550
- style: { left: E.arrow?.x, top: E.arrow?.y }
694
+ className: cx("popup-arrow", computedPlacement),
695
+ ref: arrowRef,
696
+ style: { left: middlewareData.arrow?.x, top: middlewareData.arrow?.y }
551
697
  }
552
698
  ),
553
- /* @__PURE__ */ a("div", { className: "popup-content", children: u })
699
+ /* @__PURE__ */ jsx("div", { className: "popup-content", children })
554
700
  ] })
555
701
  }
556
702
  ) })
557
703
  ] });
558
704
  }
559
- function De({ content: t, inverted: e, children: n, disabled: i, style: s, direction: o, className: r }) {
560
- const [c, l] = y(!1);
561
- return /* @__PURE__ */ a(
562
- I,
705
+ function Bubble({ content, inverted, children, disabled, style, direction, className }) {
706
+ const [open, setOpen] = useState(false);
707
+ return /* @__PURE__ */ jsx(
708
+ Popup,
563
709
  {
564
- open: c,
565
- onOpenChange: l,
566
- handler: n,
567
- disabled: i,
710
+ open,
711
+ onOpenChange: setOpen,
712
+ handler: children,
713
+ disabled,
568
714
  mode: ["hover"],
569
- placement: o || "top",
570
- className: `bubble ${e ? "inverted" : ""} ${r || ""}`,
571
- children: /* @__PURE__ */ a("span", { className: "bubble-content", style: s, children: t })
715
+ placement: direction ? direction : "top",
716
+ className: `bubble ${inverted ? "inverted" : ""} ${className ? className : ""}`,
717
+ children: /* @__PURE__ */ jsx("span", { className: `bubble-content`, style, children: content })
572
718
  }
573
719
  );
574
720
  }
575
- function nt({ content: t, children: e, className: n, direction: i, disabled: s }) {
576
- const [o, r] = y(!1);
577
- return /* @__PURE__ */ a(
578
- I,
721
+ function Tooltip({ content, children, className, direction, disabled }) {
722
+ const [open, setOpen] = useState(false);
723
+ return /* @__PURE__ */ jsx(
724
+ Popup,
579
725
  {
580
- open: o,
581
- disabled: s,
726
+ open,
727
+ disabled,
582
728
  mode: ["hover"],
583
- onOpenChange: r,
584
- handler: e,
585
- placement: i || "right",
586
- className: `tooltip inverted ${n || ""}`,
587
- children: /* @__PURE__ */ a("span", { className: "tooltip-content", children: t })
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 })
588
734
  }
589
735
  );
590
736
  }
591
- class it extends w.Component {
737
+ class Tabs extends React.Component {
592
738
  state = {
593
739
  currentTab: this.props.pages.length ? this.props.pages[0].name : null
594
740
  };
595
- handleClick = (e) => {
596
- this.props.onChange ? this.props.onChange(e) : typeof this.props.currentTab > "u" && this.setState({
597
- currentTab: e
598
- });
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
+ }
599
749
  };
600
750
  currentTabPage = () => {
601
- const e = typeof this.props.currentTab == "string" ? this.props.currentTab : this.state.currentTab;
602
- return this.props.pages.find(({ name: n }) => e === n);
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;
603
757
  };
604
- isCurrentTab = (e) => (typeof this.props.currentTab == "string" ? this.props.currentTab : this.state.currentTab) === e;
605
758
  renderBody = () => {
606
- const e = this.currentTabPage();
607
- return e && typeof e.renderBody == "function" ? e.renderBody() : null;
759
+ const page = this.currentTabPage();
760
+ if (page && typeof page.renderBody === "function") {
761
+ return page.renderBody();
762
+ }
763
+ return null;
608
764
  };
609
765
  render() {
610
- const { pages: e, disabled: n } = this.props;
611
- return /* @__PURE__ */ m("div", { children: [
612
- /* @__PURE__ */ a("div", { className: "di tabs", children: e.map(
613
- ({ name: i, renderHeading: s, tabDescription: o }) => o ? /* @__PURE__ */ a(De, { inverted: !0, content: o, className: "bubble-tab-description", children: /* @__PURE__ */ a(
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(
614
770
  "button",
615
771
  {
616
772
  "data-testid": "tab-button",
617
- className: `item ${n ? "disabled" : ""} ${this.isCurrentTab(i) ? "active" : ""}`,
618
- onClick: () => !n && this.handleClick(i),
619
- children: s()
773
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
774
+ onClick: () => !disabled && this.handleClick(name),
775
+ children: renderHeading()
620
776
  }
621
- ) }, i) : /* @__PURE__ */ a(
777
+ ) }, name) : /* @__PURE__ */ jsx(
622
778
  "button",
623
779
  {
624
780
  "data-testid": "tab-button",
625
- className: `item ${n ? "disabled" : ""} ${this.isCurrentTab(i) ? "active" : ""}`,
626
- onClick: () => !n && this.handleClick(i),
627
- children: s()
781
+ className: `item ${disabled ? "disabled" : ""} ${this.isCurrentTab(name) ? "active" : ""}`,
782
+ onClick: () => !disabled && this.handleClick(name),
783
+ children: renderHeading()
628
784
  },
629
- i
785
+ name
630
786
  )
631
787
  ) }),
632
788
  this.renderBody()
633
789
  ] });
634
790
  }
635
791
  }
636
- const $ = ({
637
- onChange: t,
638
- inputElement: e,
639
- style: n
640
- }) => /* @__PURE__ */ a(
641
- x,
792
+ const ClearButton = ({
793
+ onChange,
794
+ inputElement,
795
+ style
796
+ }) => /* @__PURE__ */ jsx(
797
+ Button$1,
642
798
  {
643
- naked: !0,
799
+ naked: true,
644
800
  onClick: () => {
645
- t(""), e && e.focus();
801
+ onChange("");
802
+ if (inputElement) {
803
+ inputElement.focus();
804
+ }
646
805
  },
647
- style: n,
648
- children: /* @__PURE__ */ a(A, { del: !0 })
806
+ style,
807
+ children: /* @__PURE__ */ jsx(Icon, { del: true })
649
808
  }
650
809
  );
651
- class Ke extends w.Component {
810
+ class SearchBox extends React.Component {
652
811
  state = {
653
812
  query: this.props.initialValue || ""
654
813
  };
655
814
  input;
656
815
  printPlaceholder() {
657
- const { t: e, placeholder: n } = this.props;
658
- return typeof n == "object" ? e(n.id, {
659
- defaultValue: n.defaultValue
660
- }) : n;
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
+ }
661
824
  }
662
- handleChange = (e) => {
663
- const { onChange: n } = this.props;
825
+ handleChange = (value) => {
826
+ const { onChange } = this.props;
664
827
  this.setState({
665
- query: e
666
- }), n(e);
828
+ query: value
829
+ });
830
+ onChange(value);
667
831
  };
668
- handleKeyUp = ({ key: e }) => {
669
- const { onSubmit: n } = this.props, { query: i } = this.state;
670
- e === "Enter" && typeof n == "function" && n(i);
832
+ handleKeyUp = ({ key }) => {
833
+ const { onSubmit } = this.props;
834
+ const { query } = this.state;
835
+ if (key === "Enter" && typeof onSubmit === "function") {
836
+ onSubmit(query);
837
+ }
671
838
  };
672
839
  render() {
673
- const { onSubmit: e, style: n, clearable: i } = this.props, { query: s } = this.state;
674
- return /* @__PURE__ */ m("div", { className: "search-box", style: n, children: [
675
- /* @__PURE__ */ a(
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(
676
844
  "input",
677
845
  {
678
- ref: (o) => {
679
- this.input = o;
846
+ ref: (input) => {
847
+ this.input = input;
680
848
  },
681
849
  type: "text",
682
- value: s,
850
+ value: query,
683
851
  placeholder: this.printPlaceholder(),
684
852
  onKeyUp: this.handleKeyUp,
685
- onChange: ({ target: { value: o } }) => this.handleChange(o)
853
+ onChange: ({ target: { value } }) => this.handleChange(value)
686
854
  }
687
855
  ),
688
- typeof e == "function" ? /* @__PURE__ */ m(w.Fragment, { children: [
689
- s && i && /* @__PURE__ */ a(
690
- $,
856
+ typeof onSubmit === "function" ? /* @__PURE__ */ jsxs(React.Fragment, { children: [
857
+ query && clearable && /* @__PURE__ */ jsx(
858
+ ClearButton,
691
859
  {
692
860
  onChange: this.handleChange,
693
861
  inputElement: this.input,
@@ -696,31 +864,31 @@ class Ke extends w.Component {
696
864
  }
697
865
  }
698
866
  ),
699
- /* @__PURE__ */ a(x, { naked: !0, onClick: () => e(s), children: /* @__PURE__ */ a(A, { search: !0 }) })
700
- ] }) : s && i ? /* @__PURE__ */ a($, { onChange: this.handleChange, inputElement: this.input }) : /* @__PURE__ */ a(x, { naked: !0, disabled: !0, children: /* @__PURE__ */ a(A, { search: !0 }) })
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 }) })
701
869
  ] });
702
870
  }
703
871
  }
704
- const st = M()(Ke);
872
+ const SearchBox_default = withTranslation()(SearchBox);
705
873
  export {
706
- Xe as Accordion,
707
- Ye as AccordionItem,
708
- De as Bubble,
709
- x as Button,
710
- pe as ButtonRow,
711
- Qe as Checkbox,
712
- ke as ConfirmProvider,
713
- A as Icon,
714
- tt as Label,
715
- we as Modal,
716
- Ge as ModalContainer,
717
- I as Popup,
718
- st as SearchBox,
719
- ye as Spinner,
720
- Je as SpinnerContainer,
721
- it as Tabs,
722
- nt as Tooltip,
723
- Ae as useConfirm,
724
- et as withConfirm
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
725
893
  };
726
894
  //# sourceMappingURL=index.js.map