@situaction/traq-ui-ste 1.1.35 → 1.1.37
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-select/EditableSelect.d.ts +1 -3
- package/dist/components/editable-select/EditableSelect.js +20 -21
- package/dist/components/modal/Modal.d.ts +10 -16
- package/dist/components/modal/Modal.js +47 -40
- package/dist/components/select/Select.js +31 -31
- package/dist/styles/EditableSelect.css +1 -1
- package/dist/styles/Modal.css +1 -1
- package/package.json +1 -1
|
@@ -15,8 +15,6 @@ interface EditableSelectProps {
|
|
|
15
15
|
onSelect?: (selected: SelectItem) => void;
|
|
16
16
|
/** The currently selected item */
|
|
17
17
|
selected?: SelectItem;
|
|
18
|
-
/** Condition that automatically closes the dropdown */
|
|
19
|
-
autoCloseCondition?: boolean;
|
|
20
18
|
/** If true, the select takes full width */
|
|
21
19
|
fullWidth?: boolean;
|
|
22
20
|
}
|
|
@@ -25,5 +23,5 @@ interface EditableSelectProps {
|
|
|
25
23
|
* and a Select dropdown based on the `edit` prop. It is commonly used
|
|
26
24
|
* in forms or data views where inline editing is required.
|
|
27
25
|
*/
|
|
28
|
-
export declare const EditableSelect: ({ label, listItems, value, placeholder, edit, onSelect, selected,
|
|
26
|
+
export declare const EditableSelect: ({ label, listItems, value, placeholder, edit, onSelect, selected, fullWidth }: EditableSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
27
|
export {};
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Select as
|
|
3
|
-
import '../../styles/EditableSelect.css';const
|
|
4
|
-
editableSelect:
|
|
5
|
-
statiqueField:
|
|
6
|
-
},
|
|
7
|
-
label:
|
|
1
|
+
import { jsxs as i, Fragment as m, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Select as S } from "../select/Select.js";
|
|
3
|
+
import '../../styles/EditableSelect.css';const x = "_editableSelect_j0aoc_30", f = "_statiqueField_j0aoc_40", s = {
|
|
4
|
+
editableSelect: x,
|
|
5
|
+
statiqueField: f
|
|
6
|
+
}, _ = ({
|
|
7
|
+
label: l,
|
|
8
8
|
listItems: a,
|
|
9
9
|
value: t,
|
|
10
10
|
placeholder: c,
|
|
11
11
|
edit: d,
|
|
12
|
-
onSelect:
|
|
13
|
-
selected:
|
|
14
|
-
autoCloseCondition: n = !1,
|
|
12
|
+
onSelect: r,
|
|
13
|
+
selected: n,
|
|
15
14
|
fullWidth: o = !1
|
|
16
|
-
}) => d ? /* @__PURE__ */
|
|
17
|
-
/* @__PURE__ */ e("span", { className: "textSmall", children:
|
|
15
|
+
}) => d ? /* @__PURE__ */ i(m, { children: [
|
|
16
|
+
/* @__PURE__ */ e("span", { className: "textSmall", children: l }),
|
|
18
17
|
/* @__PURE__ */ e(
|
|
19
|
-
|
|
18
|
+
S,
|
|
20
19
|
{
|
|
21
20
|
size: "s",
|
|
22
21
|
listItem: a,
|
|
23
22
|
placeholder: c,
|
|
24
23
|
modeDisplay: "text",
|
|
25
|
-
onSelect:
|
|
26
|
-
selected:
|
|
27
|
-
autoCloseCondition:
|
|
28
|
-
fullWidth: o
|
|
24
|
+
onSelect: r,
|
|
25
|
+
selected: n,
|
|
26
|
+
autoCloseCondition: !0,
|
|
27
|
+
fullWidth: o ?? !1
|
|
29
28
|
}
|
|
30
29
|
)
|
|
31
|
-
] }) : /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */ e("span", { className: "textSmall", children:
|
|
33
|
-
/* @__PURE__ */ e("div", { className: `${
|
|
30
|
+
] }) : /* @__PURE__ */ i("div", { className: s.editableSelect, children: [
|
|
31
|
+
/* @__PURE__ */ e("span", { className: "textSmall", children: l }),
|
|
32
|
+
/* @__PURE__ */ e("div", { className: `${s.statiqueField} textSmall`, children: (t == null ? void 0 : t.trim()) || "-" })
|
|
34
33
|
] });
|
|
35
34
|
export {
|
|
36
|
-
|
|
35
|
+
_ as EditableSelect
|
|
37
36
|
};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { ReactNode, RefObject } from 'react';
|
|
2
2
|
|
|
3
3
|
export interface ModalProps {
|
|
4
|
-
/** Determines whether the modal is open or closed
|
|
5
|
-
* If true, the modal is displayed; if false, it is hidden. */
|
|
4
|
+
/** Determines whether the modal is open or closed */
|
|
6
5
|
open: boolean;
|
|
7
|
-
/** Callback function to handle closing the modal
|
|
8
|
-
* Triggered when clicking outside the modal content. */
|
|
6
|
+
/** Callback function to handle closing the modal */
|
|
9
7
|
onClose: () => void;
|
|
10
|
-
/** Content to be displayed inside the modal
|
|
11
|
-
* Typically includes child components or HTML elements. */
|
|
8
|
+
/** Content to be displayed inside the modal */
|
|
12
9
|
children: ReactNode;
|
|
13
|
-
/** Optional
|
|
14
|
-
* Supports CSS properties such as top, left, right, bottom, and width. */
|
|
10
|
+
/** Optional custom position for the modal */
|
|
15
11
|
position?: {
|
|
16
12
|
top?: string;
|
|
17
13
|
left?: string;
|
|
@@ -19,17 +15,15 @@ export interface ModalProps {
|
|
|
19
15
|
bottom?: string;
|
|
20
16
|
width?: string;
|
|
21
17
|
};
|
|
22
|
-
/**
|
|
18
|
+
/** Centers the modal automatically in the middle of the screen */
|
|
19
|
+
centered?: boolean;
|
|
20
|
+
/** Optional additional CSS classes */
|
|
23
21
|
className?: string;
|
|
24
|
-
/**
|
|
22
|
+
/** Disable overlay and event blocking */
|
|
25
23
|
disableOverlay?: boolean;
|
|
26
|
-
/**
|
|
24
|
+
/** Auto-close condition */
|
|
27
25
|
autoCloseCondition?: boolean;
|
|
26
|
+
/** Optional anchor reference for positioning */
|
|
28
27
|
anchorRef?: RefObject<HTMLElement>;
|
|
29
28
|
}
|
|
30
|
-
/**
|
|
31
|
-
* Modal component that renders content in a floating layer above the main UI.
|
|
32
|
-
* It supports custom positioning and closes when clicking outside of its content area.
|
|
33
|
-
* The component uses a ref to detect clicks outside the modal.
|
|
34
|
-
*/
|
|
35
29
|
export declare const Modal: import('react').ForwardRefExoticComponent<ModalProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,54 +1,61 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import '../../styles/Modal.css';const
|
|
4
|
-
overlay:
|
|
5
|
-
modalContent:
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
import { jsxs as $, Fragment as j, jsx as u } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as k, useRef as C, useState as E, useEffect as N, useLayoutEffect as B } from "react";
|
|
3
|
+
import '../../styles/Modal.css';const F = "_overlay_b1r7c_1", L = "_modalContent_b1r7c_12", M = "_centered_b1r7c_19", d = {
|
|
4
|
+
overlay: F,
|
|
5
|
+
modalContent: L,
|
|
6
|
+
centered: M
|
|
7
|
+
}, Y = k(
|
|
8
|
+
({
|
|
9
|
+
open: t,
|
|
10
|
+
onClose: c,
|
|
11
|
+
children: _,
|
|
12
|
+
position: l,
|
|
13
|
+
centered: r = !1,
|
|
14
|
+
className: b,
|
|
15
|
+
disableOverlay: v = !1,
|
|
16
|
+
autoCloseCondition: m,
|
|
17
|
+
anchorRef: a
|
|
18
|
+
}, w) => {
|
|
19
|
+
const y = C(null), g = w || y, [e, x] = E();
|
|
20
|
+
return N(() => {
|
|
21
|
+
!m && m !== void 0 && t && c();
|
|
22
|
+
}, [m, t, c]), B(() => {
|
|
23
|
+
if (a != null && a.current && t && !l && !r) {
|
|
24
|
+
const f = a.current.getBoundingClientRect();
|
|
25
|
+
x({
|
|
26
|
+
top: `${f.bottom + window.scrollY}px`,
|
|
27
|
+
left: `${f.left + window.scrollX}px`
|
|
17
28
|
});
|
|
18
29
|
}
|
|
19
|
-
}, [a, t,
|
|
20
|
-
|
|
21
|
-
const f = c.current;
|
|
22
|
-
f && !f.contains(u.target) && t && ![...document.querySelectorAll(".dialog")].some(
|
|
23
|
-
(L) => L.contains(u.target)
|
|
24
|
-
) && d();
|
|
25
|
-
};
|
|
26
|
-
return document.addEventListener("mousedown", r), () => {
|
|
27
|
-
document.removeEventListener("mousedown", r);
|
|
28
|
-
};
|
|
29
|
-
}, [d, t, c]), t ? /* @__PURE__ */ j(M, { children: [
|
|
30
|
-
!b && /* @__PURE__ */ v("div", { className: g.overlay }),
|
|
31
|
-
/* @__PURE__ */ v(
|
|
30
|
+
}, [a, t, l, r]), t ? /* @__PURE__ */ $(j, { children: [
|
|
31
|
+
!v && /* @__PURE__ */ u(
|
|
32
32
|
"div",
|
|
33
33
|
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
className: d.overlay,
|
|
35
|
+
onClick: c
|
|
36
|
+
}
|
|
37
|
+
),
|
|
38
|
+
/* @__PURE__ */ u(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
ref: g,
|
|
42
|
+
className: `${d.modalContent} ${b || ""} ${r ? d.centered : ""}`,
|
|
37
43
|
style: {
|
|
38
44
|
position: "absolute",
|
|
39
|
-
top: (
|
|
40
|
-
left: (
|
|
41
|
-
right:
|
|
42
|
-
bottom:
|
|
43
|
-
width:
|
|
44
|
-
transform: !(
|
|
45
|
+
top: r ? "50%" : (l == null ? void 0 : l.top) ?? (e == null ? void 0 : e.top),
|
|
46
|
+
left: r ? "50%" : (l == null ? void 0 : l.left) ?? (e == null ? void 0 : e.left),
|
|
47
|
+
right: l == null ? void 0 : l.right,
|
|
48
|
+
bottom: l == null ? void 0 : l.bottom,
|
|
49
|
+
width: l == null ? void 0 : l.width,
|
|
50
|
+
transform: r || !(l != null && l.top) && !(l != null && l.left) && !e ? "translate(-50%, -50%)" : void 0
|
|
45
51
|
},
|
|
46
|
-
|
|
52
|
+
onClick: (f) => f.stopPropagation(),
|
|
53
|
+
children: _
|
|
47
54
|
}
|
|
48
55
|
)
|
|
49
56
|
] }) : null;
|
|
50
57
|
}
|
|
51
58
|
);
|
|
52
59
|
export {
|
|
53
|
-
|
|
60
|
+
Y as Modal
|
|
54
61
|
};
|
|
@@ -18,7 +18,7 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
18
18
|
}, ce = ({
|
|
19
19
|
selected: _,
|
|
20
20
|
size: b = "m",
|
|
21
|
-
listItem:
|
|
21
|
+
listItem: s,
|
|
22
22
|
modeDisplay: g = "all",
|
|
23
23
|
onSelect: B,
|
|
24
24
|
positionOverride: R,
|
|
@@ -29,17 +29,17 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
29
29
|
const [n, u] = x(!1), U = h(null), [V, F] = x({
|
|
30
30
|
top: "calc(100% + 6px)",
|
|
31
31
|
left: "0px"
|
|
32
|
-
}), [
|
|
32
|
+
}), [c, L] = x(_ ?? null);
|
|
33
33
|
w(() => {
|
|
34
|
-
_ ? L(_) :
|
|
35
|
-
}, [_,
|
|
34
|
+
_ ? L(_) : s.length > 0 ? L(s[0]) : L(null);
|
|
35
|
+
}, [_, s]), w(() => {
|
|
36
36
|
R && F(R);
|
|
37
37
|
}, [R]);
|
|
38
38
|
const M = (e) => {
|
|
39
39
|
L(e), u(!1), B && B(e);
|
|
40
40
|
}, O = () => {
|
|
41
|
-
const e =
|
|
42
|
-
return g === "icon" && e ? /* @__PURE__ */ r(W, { ref: d, mode: "tertiary", size: b, onClick: () => u(!n), children: /* @__PURE__ */ r(p, { icon:
|
|
41
|
+
const e = c == null ? void 0 : c.icon, o = (c == null ? void 0 : c.label) || P || "Sélectionner";
|
|
42
|
+
return g === "icon" && e ? /* @__PURE__ */ r(W, { ref: d, mode: "tertiary", size: b, onClick: () => u(!n), children: /* @__PURE__ */ r(p, { icon: c.icon }) }) : g === "text" ? /* @__PURE__ */ r(
|
|
43
43
|
N,
|
|
44
44
|
{
|
|
45
45
|
ref: d,
|
|
@@ -58,7 +58,7 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
58
58
|
label: o,
|
|
59
59
|
size: b,
|
|
60
60
|
fullWidth: T,
|
|
61
|
-
childrenLeft: e && /* @__PURE__ */ r(p, { icon:
|
|
61
|
+
childrenLeft: e && /* @__PURE__ */ r(p, { icon: c.icon }),
|
|
62
62
|
childrenRight: /* @__PURE__ */ r(p, { icon: n ? "CaretUp" : "CaretDown", size: 14, weight: "bold" }),
|
|
63
63
|
onClick: () => u(!n)
|
|
64
64
|
}
|
|
@@ -77,11 +77,11 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
77
77
|
if (!n) return;
|
|
78
78
|
const o = e.key.length === 1 ? e.key.toLowerCase() : "";
|
|
79
79
|
if (!o) return;
|
|
80
|
-
const
|
|
81
|
-
v(
|
|
82
|
-
const a =
|
|
83
|
-
var
|
|
84
|
-
return (
|
|
80
|
+
const l = k + o;
|
|
81
|
+
v(l);
|
|
82
|
+
const a = s.find((t) => {
|
|
83
|
+
var i;
|
|
84
|
+
return (i = t.label) == null ? void 0 : i.toLowerCase().startsWith(l);
|
|
85
85
|
});
|
|
86
86
|
if (a) {
|
|
87
87
|
const t = C.current[a.value];
|
|
@@ -93,23 +93,23 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
93
93
|
};
|
|
94
94
|
w(() => (n ? window.addEventListener("keydown", S) : (window.removeEventListener("keydown", S), v("")), () => {
|
|
95
95
|
window.removeEventListener("keydown", S);
|
|
96
|
-
}), [n, k,
|
|
96
|
+
}), [n, k, s]), w(() => {
|
|
97
97
|
const e = (o) => {
|
|
98
98
|
if (!n) return;
|
|
99
|
-
const
|
|
100
|
-
if (!
|
|
101
|
-
const a = k +
|
|
99
|
+
const l = o.key.length === 1 ? o.key.toLowerCase() : "";
|
|
100
|
+
if (!l) return;
|
|
101
|
+
const a = k + l;
|
|
102
102
|
v(a);
|
|
103
|
-
const t =
|
|
104
|
-
(
|
|
103
|
+
const t = s.find(
|
|
104
|
+
(i) => {
|
|
105
105
|
var y;
|
|
106
|
-
return (y =
|
|
106
|
+
return (y = i.label) == null ? void 0 : y.toLowerCase().startsWith(a);
|
|
107
107
|
}
|
|
108
108
|
);
|
|
109
109
|
if (t && E.current && t.value in C.current && C.current[t.value]) {
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
top: y.offsetTop -
|
|
110
|
+
const i = E.current, y = C.current[t.value];
|
|
111
|
+
i.scrollTo({
|
|
112
|
+
top: y.offsetTop - i.offsetTop,
|
|
113
113
|
behavior: "smooth"
|
|
114
114
|
});
|
|
115
115
|
}
|
|
@@ -118,15 +118,15 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
118
118
|
}, 700);
|
|
119
119
|
};
|
|
120
120
|
return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
|
|
121
|
-
}, [n,
|
|
121
|
+
}, [n, s, k]), w(() => {
|
|
122
122
|
if (!n) return;
|
|
123
123
|
const e = (o) => {
|
|
124
|
-
const
|
|
125
|
-
if (
|
|
126
|
-
const a =
|
|
124
|
+
const l = o.key.toLowerCase();
|
|
125
|
+
if (l.length === 1) {
|
|
126
|
+
const a = s.find(
|
|
127
127
|
(t) => {
|
|
128
|
-
var
|
|
129
|
-
return (
|
|
128
|
+
var i;
|
|
129
|
+
return (i = t.label) == null ? void 0 : i.toLowerCase().startsWith(l);
|
|
130
130
|
}
|
|
131
131
|
);
|
|
132
132
|
if (a) {
|
|
@@ -136,7 +136,7 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
|
|
139
|
-
}, [n,
|
|
139
|
+
}, [n, s]);
|
|
140
140
|
const d = h(null);
|
|
141
141
|
return w(() => {
|
|
142
142
|
if (n && d.current) {
|
|
@@ -159,11 +159,11 @@ const z = "_selectContainer_1o5wx_54", A = "_selected_1o5wx_57", D = "_children_
|
|
|
159
159
|
disableOverlay: !0,
|
|
160
160
|
className: m.modal,
|
|
161
161
|
autoCloseCondition: j,
|
|
162
|
-
children: /* @__PURE__ */ r("div", { className: m.selectList, ref: E, children:
|
|
162
|
+
children: /* @__PURE__ */ r("div", { className: m.selectList, ref: E, children: s.map((e) => /* @__PURE__ */ $(
|
|
163
163
|
"div",
|
|
164
164
|
{
|
|
165
165
|
ref: (o) => K.current[e.value] = o,
|
|
166
|
-
className: `${m.children} ${(
|
|
166
|
+
className: `${m.children} ${(c == null ? void 0 : c.value) === e.value ? m.active : ""}`,
|
|
167
167
|
onClick: () => M(e),
|
|
168
168
|
children: [
|
|
169
169
|
e.icon && /* @__PURE__ */ r(p, { icon: e.icon, size: 16 }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._editableSelect_j0aoc_30{width:100%;gap:.25rem;display:flex;justify-content:flex-start;align-items:start;flex-direction:column;cursor:default}._statiqueField_j0aoc_40{width:100%;border-radius:4px;border:1px solid var(--input-primary-default-border);padding:.5rem;box-sizing:border-box}
|
package/dist/styles/Modal.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
._overlay_b1r7c_1{position:fixed;top:0;left:0;right:0;bottom:0;background-color:#0000004d;z-index:11;pointer-events:auto}._modalContent_b1r7c_12{position:absolute;z-index:12;border:1px solid var(--general-border-window);background-color:var(--background-primary)}._centered_b1r7c_19{max-width:90%;max-height:90%}
|