@situaction/traq-ui-ste 1.1.39 → 1.1.40
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/components/editable-field/EditableField.d.ts +3 -1
- package/dist/components/editable-field/EditableField.js +42 -25
- package/dist/components/modal/Modal.d.ts +2 -0
- package/dist/components/modal/Modal.js +36 -34
- package/dist/styles/EditableField.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/package.json +1 -1
|
@@ -15,10 +15,12 @@ interface EditableFieldProps extends Partial<LabelInputProps> {
|
|
|
15
15
|
edit: boolean;
|
|
16
16
|
/** Callback when value is changed (only in edit mode) */
|
|
17
17
|
onChange?: (val: string) => void;
|
|
18
|
+
/** If true, value is displayed as a clickable link */
|
|
19
|
+
isLink?: boolean;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* EditableField displays either a read-only value or an editable input.
|
|
21
23
|
* It supports all props from InputLabel.
|
|
22
24
|
*/
|
|
23
|
-
export declare const EditableField: ({ label, value, placeholder, edit, onChange, ...inputLabelProps }: EditableFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
export declare const EditableField: ({ label, value, placeholder, edit, onChange, isLink, ...inputLabelProps }: EditableFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
24
26
|
export {};
|
|
@@ -1,30 +1,47 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { InputLabel as
|
|
3
|
-
import '../../styles/EditableField.css';const
|
|
4
|
-
editableField:
|
|
5
|
-
statiqueField:
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
|
+
import { InputLabel as p } from "../input-label/InputLabel.js";
|
|
3
|
+
import '../../styles/EditableField.css';const F = "_editableField_1gd32_30", _ = "_statiqueField_1gd32_40", b = "_link_1gd32_48", i = {
|
|
4
|
+
editableField: F,
|
|
5
|
+
statiqueField: _,
|
|
6
|
+
link: b
|
|
7
|
+
}, k = ({
|
|
8
|
+
label: l,
|
|
8
9
|
value: e,
|
|
9
10
|
placeholder: d,
|
|
10
|
-
edit:
|
|
11
|
-
onChange:
|
|
12
|
-
|
|
11
|
+
edit: a,
|
|
12
|
+
onChange: n,
|
|
13
|
+
isLink: r = !1,
|
|
14
|
+
...o
|
|
13
15
|
// Spread to pass all remaining props to InputLabel
|
|
14
|
-
}) =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
}) => {
|
|
17
|
+
if (a)
|
|
18
|
+
return /* @__PURE__ */ t(
|
|
19
|
+
p,
|
|
20
|
+
{
|
|
21
|
+
label: l,
|
|
22
|
+
defaultValue: e || "",
|
|
23
|
+
placeholder: d || "",
|
|
24
|
+
onSubmit: n || (() => {
|
|
25
|
+
}),
|
|
26
|
+
...o
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
const s = (e == null ? void 0 : e.trim()) || " ";
|
|
30
|
+
return /* @__PURE__ */ m("div", { className: i.editableField, children: [
|
|
31
|
+
/* @__PURE__ */ t("span", { className: "textSmall", children: l }),
|
|
32
|
+
r && e ? /* @__PURE__ */ t(
|
|
33
|
+
"a",
|
|
34
|
+
{
|
|
35
|
+
href: e,
|
|
36
|
+
target: "_blank",
|
|
37
|
+
rel: "noopener noreferrer",
|
|
38
|
+
className: `${i.statiqueField} ${i.link} textSmall`,
|
|
39
|
+
onClick: (c) => c.stopPropagation(),
|
|
40
|
+
children: s
|
|
41
|
+
}
|
|
42
|
+
) : /* @__PURE__ */ t("div", { className: `${i.statiqueField} textSmall`, children: s })
|
|
43
|
+
] });
|
|
44
|
+
};
|
|
28
45
|
export {
|
|
29
|
-
|
|
46
|
+
k as EditableField
|
|
30
47
|
};
|
|
@@ -25,5 +25,7 @@ export interface ModalProps {
|
|
|
25
25
|
autoCloseCondition?: boolean;
|
|
26
26
|
/** Optional anchor reference for positioning */
|
|
27
27
|
anchorRef?: RefObject<HTMLElement>;
|
|
28
|
+
/** If true, show a background overlay behind the panel */
|
|
29
|
+
overlayBackground?: boolean;
|
|
28
30
|
}
|
|
29
31
|
export declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,47 +1,49 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import '../../styles/Modal.css';const F = "
|
|
1
|
+
import { jsxs as x, Fragment as B, jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as h, useRef as j, useState as C, useEffect as E, useLayoutEffect as N } from "react";
|
|
3
|
+
import '../../styles/Modal.css';const F = "_overlay_1hu8i_1", L = "_overlayBackground_1hu8i_11", M = "_modalContent_1hu8i_15", S = "_centered_1hu8i_22", c = {
|
|
4
4
|
overlay: F,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
overlayBackground: L,
|
|
6
|
+
modalContent: M,
|
|
7
|
+
centered: S
|
|
8
|
+
}, q = h(
|
|
8
9
|
({
|
|
9
|
-
open:
|
|
10
|
-
onClose:
|
|
11
|
-
children:
|
|
10
|
+
open: t,
|
|
11
|
+
onClose: d,
|
|
12
|
+
children: v,
|
|
12
13
|
position: l,
|
|
13
14
|
centered: r = !1,
|
|
14
|
-
className:
|
|
15
|
-
disableOverlay:
|
|
16
|
-
autoCloseCondition:
|
|
17
|
-
anchorRef: f
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
15
|
+
className: _,
|
|
16
|
+
disableOverlay: g = !1,
|
|
17
|
+
autoCloseCondition: u,
|
|
18
|
+
anchorRef: f,
|
|
19
|
+
overlayBackground: y = !1
|
|
20
|
+
}, w) => {
|
|
21
|
+
const $ = j(null), k = w || $, [e, b] = C();
|
|
22
|
+
return E(() => {
|
|
23
|
+
!u && u !== void 0 && t && d();
|
|
24
|
+
}, [u, t, d]), N(() => {
|
|
25
|
+
if (f != null && f.current && t && !l && !r) {
|
|
26
|
+
const a = f.current.getBoundingClientRect();
|
|
27
|
+
b({
|
|
28
|
+
top: `${a.bottom + window.scrollY}px`,
|
|
29
|
+
left: `${a.left + window.scrollX}px`
|
|
28
30
|
});
|
|
29
31
|
}
|
|
30
|
-
}, [f,
|
|
31
|
-
!
|
|
32
|
+
}, [f, t, l, r]), t ? /* @__PURE__ */ x(B, { children: [
|
|
33
|
+
!g && /* @__PURE__ */ m(
|
|
32
34
|
"div",
|
|
33
35
|
{
|
|
34
|
-
className:
|
|
35
|
-
onClick: (
|
|
36
|
-
|
|
36
|
+
className: `${c.overlay} ${y ? c.overlayBackground : ""}`,
|
|
37
|
+
onClick: (a) => {
|
|
38
|
+
a.stopPropagation(), d();
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
),
|
|
40
|
-
/* @__PURE__ */
|
|
42
|
+
/* @__PURE__ */ m(
|
|
41
43
|
"div",
|
|
42
44
|
{
|
|
43
|
-
ref:
|
|
44
|
-
className: `${
|
|
45
|
+
ref: k,
|
|
46
|
+
className: `${c.modalContent} ${_ || ""} ${r ? c.centered : ""}`,
|
|
45
47
|
style: {
|
|
46
48
|
position: "absolute",
|
|
47
49
|
top: r ? "50%" : (l == null ? void 0 : l.top) ?? (e == null ? void 0 : e.top),
|
|
@@ -51,13 +53,13 @@ import '../../styles/Modal.css';const F = "_overlay_b1r7c_1", L = "_modalContent
|
|
|
51
53
|
width: l == null ? void 0 : l.width,
|
|
52
54
|
transform: r || !(l != null && l.top) && !(l != null && l.left) && !e ? "translate(-50%, -50%)" : void 0
|
|
53
55
|
},
|
|
54
|
-
onClick: (
|
|
55
|
-
children:
|
|
56
|
+
onClick: (a) => a.stopPropagation(),
|
|
57
|
+
children: v
|
|
56
58
|
}
|
|
57
59
|
)
|
|
58
60
|
] }) : null;
|
|
59
61
|
}
|
|
60
62
|
);
|
|
61
63
|
export {
|
|
62
|
-
|
|
64
|
+
q as Modal
|
|
63
65
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._editableField_1gd32_30{width:100%;display:flex;justify-content:flex-start;align-items:start;flex-direction:column;gap:.25rem;cursor:default}._statiqueField_1gd32_40{width:100%;border-radius:4px;border:1px solid var(--input-primary-default-border);padding:.5rem;box-sizing:border-box}._link_1gd32_48{color:var(--primary-color);text-decoration:underline;cursor:pointer}._link_1gd32_48:hover{text-decoration:none}
|
package/dist/styles/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._overlay_1hu8i_1{position:fixed;top:0;left:0;right:0;bottom:0;z-index:11;pointer-events:auto}._overlayBackground_1hu8i_11{background-color:#0000004d}._modalContent_1hu8i_15{position:absolute;z-index:12;border:1px solid var(--general-border-window);background-color:var(--background-primary)}._centered_1hu8i_22{max-width:90%;max-height:90%}
|