@tcn/ui 0.12.3 → 0.12.5
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/actions/index.d.ts +0 -2
- package/dist/actions/index.d.ts.map +1 -1
- package/dist/actions/index.js +6 -10
- package/dist/actions/index.js.map +1 -1
- package/dist/group.css +1 -0
- package/dist/inputs/color_input/color_input.js +2 -4
- package/dist/inputs/color_input/color_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_header.js +20 -22
- package/dist/inputs/date_picker/date_picker_header.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +2 -4
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_time_selector.js +9 -11
- package/dist/inputs/date_picker/date_picker_time_selector.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_input.js +5 -7
- package/dist/inputs/date_picker/date_picker_year_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +2 -4
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/index.d.ts +2 -0
- package/dist/inputs/index.d.ts.map +1 -1
- package/dist/inputs/index.js +24 -20
- package/dist/inputs/index.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_inline_values.js +7 -9
- package/dist/inputs/multiselect/multiselect_inline_values.js.map +1 -1
- package/dist/inputs/multiselect/multiselect_values.js +2 -4
- package/dist/inputs/multiselect/multiselect_values.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js +2 -4
- package/dist/inputs/phone_number_input/phone_number_input_adapter.js.map +1 -1
- package/dist/inputs/phone_number_input/sip_input.js +13 -15
- package/dist/inputs/phone_number_input/sip_input.js.map +1 -1
- package/dist/inputs/select/select.js +2 -4
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/{actions/button → inputs}/select_group/select_group.d.ts +1 -1
- package/dist/inputs/select_group/select_group.d.ts.map +1 -0
- package/dist/{actions/button → inputs}/select_group/select_group.js +3 -3
- package/dist/inputs/select_group/select_group.js.map +1 -0
- package/dist/inputs/select_group/single_select_group.d.ts.map +1 -0
- package/dist/inputs/select_group/single_select_group.js.map +1 -0
- package/dist/inputs/suggestions/suggestion_list.js +2 -4
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/layouts/group/group.d.ts +5 -0
- package/dist/layouts/group/group.d.ts.map +1 -0
- package/dist/layouts/group/group.js +26 -0
- package/dist/layouts/group/group.js.map +1 -0
- package/dist/layouts/index.d.ts +2 -0
- package/dist/layouts/index.d.ts.map +1 -1
- package/dist/layouts/index.js +36 -32
- package/dist/layouts/index.js.map +1 -1
- package/dist/overlay/frame/frame.d.ts.map +1 -1
- package/dist/overlay/frame/frame.js +57 -63
- package/dist/overlay/frame/frame.js.map +1 -1
- package/dist/select_group.css +1 -1
- package/dist/stacks/box/box.d.ts +5 -4
- package/dist/stacks/box/box.d.ts.map +1 -1
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/box/detect_resize_bounds.d.ts +15 -0
- package/dist/stacks/box/detect_resize_bounds.d.ts.map +1 -0
- package/dist/stacks/box/detect_resize_bounds.js +49 -0
- package/dist/stacks/box/detect_resize_bounds.js.map +1 -0
- package/dist/stacks/box/resize_handlers.d.ts.map +1 -1
- package/dist/stacks/box/resize_handlers.js +51 -44
- package/dist/stacks/box/resize_handlers.js.map +1 -1
- package/dist/stacks/box/start_resize_handle.d.ts.map +1 -1
- package/dist/stacks/box/start_resize_handle.js +2 -1
- package/dist/stacks/box/start_resize_handle.js.map +1 -1
- package/dist/stacks/box/types.d.ts +17 -4
- package/dist/stacks/box/types.d.ts.map +1 -1
- package/dist/surfaces/alert/alert.d.ts +0 -2
- package/dist/surfaces/alert/alert.d.ts.map +1 -1
- package/dist/surfaces/alert/alert.js +5 -7
- package/dist/surfaces/alert/alert.js.map +1 -1
- package/dist/surfaces/confirm/confirm.d.ts +3 -3
- package/dist/surfaces/confirm/confirm.d.ts.map +1 -1
- package/dist/surfaces/confirm/confirm.js +46 -45
- package/dist/surfaces/confirm/confirm.js.map +1 -1
- package/dist/surfaces/modal/modal.d.ts.map +1 -1
- package/dist/surfaces/modal/modal.js +22 -13
- package/dist/surfaces/modal/modal.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.js +4 -2
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/window/window.d.ts.map +1 -1
- package/dist/surfaces/window/window.js +21 -24
- package/dist/surfaces/window/window.js.map +1 -1
- package/dist/themes/stories/button_showcase.d.ts.map +1 -1
- package/dist/themes/stylesheets/reset.css +1 -1
- package/dist/themes/stylesheets/reset.js +3 -3
- package/dist/themes/stylesheets/reset.js.map +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +30 -4
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/package.json +3 -2
- package/src/actions/index.ts +0 -8
- package/src/inputs/index.ts +9 -0
- package/src/{actions/button/__stories__ → inputs/select_group}/select_group.stories.tsx +5 -26
- package/src/{actions/button → inputs}/select_group/select_group.tsx +3 -3
- package/src/layouts/bar/bar.stories.tsx +61 -0
- package/src/layouts/group/group.module.css +8 -0
- package/src/layouts/group/group.tsx +23 -0
- package/src/layouts/index.ts +2 -0
- package/src/overlay/frame/frame.tsx +34 -51
- package/src/overlay/popper/__stories__/element_popper.stories.tsx +1 -1
- package/src/stacks/box/box.tsx +10 -16
- package/src/stacks/box/detect_resize_bounds.ts +84 -0
- package/src/stacks/box/resize_handlers.ts +27 -15
- package/src/stacks/box/start_resize_handle.tsx +6 -3
- package/src/stacks/box/types.ts +23 -25
- package/src/surfaces/alert/alert.tsx +0 -2
- package/src/surfaces/confirm/confirm.tsx +24 -9
- package/src/surfaces/modal/__stories__/modal.stories.tsx +70 -3
- package/src/surfaces/modal/modal.tsx +11 -2
- package/src/surfaces/window/window.stories.tsx +64 -8
- package/src/surfaces/window/window.tsx +6 -9
- package/src/themes/stories/button_showcase.tsx +19 -51
- package/src/themes/stylesheets/reset.css +3 -3
- package/src/themes/themes/ergo/ergo_theme.css +30 -4
- package/dist/actions/button/select_group/select_group.d.ts.map +0 -1
- package/dist/actions/button/select_group/select_group.js.map +0 -1
- package/dist/actions/button/select_group/single_select_group.d.ts.map +0 -1
- package/dist/actions/button/select_group/single_select_group.js.map +0 -1
- /package/dist/{actions/button → inputs}/select_group/single_select_group.d.ts +0 -0
- /package/dist/{actions/button → inputs}/select_group/single_select_group.js +0 -0
- /package/src/{actions/button → inputs}/select_group/select_group.module.css +0 -0
- /package/src/{actions/button → inputs}/select_group/single_select_group.tsx +0 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const u = {
|
|
2
|
+
width: {
|
|
3
|
+
size: "width",
|
|
4
|
+
min: "minWidth",
|
|
5
|
+
max: "maxWidth"
|
|
6
|
+
},
|
|
7
|
+
height: {
|
|
8
|
+
size: "height",
|
|
9
|
+
min: "minHeight",
|
|
10
|
+
max: "maxHeight"
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
function l(e) {
|
|
14
|
+
const n = /^(-?\d+(?:\.\d+)?)px$/.exec(e.trim());
|
|
15
|
+
return n ? Number(n[1]) : null;
|
|
16
|
+
}
|
|
17
|
+
function x(e, n, i) {
|
|
18
|
+
const c = l(n), t = l(i), s = c !== null && e < c, o = t !== null && e > t;
|
|
19
|
+
return {
|
|
20
|
+
hitMin: s,
|
|
21
|
+
hitMax: o,
|
|
22
|
+
clamped: s || o
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function z({
|
|
26
|
+
element: e,
|
|
27
|
+
axis: n,
|
|
28
|
+
nextSize: i,
|
|
29
|
+
epsilon: c = 0.5
|
|
30
|
+
}) {
|
|
31
|
+
const t = u[n], s = getComputedStyle(e), o = x(i, s[t.min], s[t.max]);
|
|
32
|
+
if (o.clamped) return o;
|
|
33
|
+
const d = e.style, h = d[t.size];
|
|
34
|
+
try {
|
|
35
|
+
d[t.size] = `${i}px`;
|
|
36
|
+
const r = e.getBoundingClientRect()[t.size] - i, a = r > c, m = r < -c;
|
|
37
|
+
return {
|
|
38
|
+
hitMin: a,
|
|
39
|
+
hitMax: m,
|
|
40
|
+
clamped: a || m
|
|
41
|
+
};
|
|
42
|
+
} finally {
|
|
43
|
+
d[t.size] = h;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export {
|
|
47
|
+
z as detectResizeBounds
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=detect_resize_bounds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect_resize_bounds.js","sources":["../../../src/stacks/box/detect_resize_bounds.ts"],"sourcesContent":["type ConstraintAxis = 'width' | 'height';\n\nexport type DetectResizeBoundsParams = {\n element: HTMLElement;\n axis: ConstraintAxis;\n nextSize: number;\n epsilon?: number; // Tolerance for the constraint hit detection.\n};\n\nexport type DetectResizeBoundsResult = {\n hitMin: boolean;\n hitMax: boolean;\n clamped: boolean;\n};\n\nconst styleKeys = {\n width: {\n size: 'width',\n min: 'minWidth',\n max: 'maxWidth',\n },\n height: {\n size: 'height',\n min: 'minHeight',\n max: 'maxHeight',\n },\n} as const;\n\nfunction parsePx(value: string): number | null {\n const match = /^(-?\\d+(?:\\.\\d+)?)px$/.exec(value.trim());\n return match ? Number(match[1]) : null;\n}\n\nfunction detectByPixelValue(nextSize: number, min: string, max: string) {\n const minPx = parsePx(min);\n const maxPx = parsePx(max);\n const hitMin = minPx !== null && nextSize < minPx;\n const hitMax = maxPx !== null && nextSize > maxPx;\n return {\n hitMin,\n hitMax,\n clamped: hitMin || hitMax,\n };\n}\n\nexport function detectResizeBounds({\n element,\n axis,\n nextSize,\n epsilon = 0.5,\n}: DetectResizeBoundsParams): DetectResizeBoundsResult {\n const keys = styleKeys[axis];\n\n const computed = getComputedStyle(element);\n const fastPath = detectByPixelValue(nextSize, computed[keys.min], computed[keys.max]);\n if (fastPath.clamped) return fastPath;\n\n const style = element.style;\n const prevInlineSize = style[keys.size]; // Save the previous size to revert later.\n\n try {\n // Temporarily apply the new size to the element to offload bound test to browser.\n style[keys.size] = `${nextSize}px`;\n\n // Force layout so browser resolves min/max/intrinsic constraints.\n const rect = element.getBoundingClientRect();\n const renderedSize = rect[keys.size];\n\n const delta = renderedSize - nextSize;\n\n const hitMin = delta > epsilon;\n const hitMax = delta < -epsilon;\n const clamped = hitMin || hitMax;\n\n return {\n hitMin,\n hitMax,\n clamped,\n };\n } finally {\n // revert the style change\n style[keys.size] = prevInlineSize;\n }\n}\n"],"names":["styleKeys","parsePx","value","match","detectByPixelValue","nextSize","min","max","minPx","maxPx","hitMin","hitMax","detectResizeBounds","element","axis","epsilon","keys","computed","fastPath","style","prevInlineSize","delta"],"mappings":"AAeA,MAAMA,IAAY;AAAA,EAChB,OAAO;AAAA,IACL,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,EAAA;AAAA,EAEP,QAAQ;AAAA,IACN,MAAM;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AAAA,EAAA;AAET;AAEA,SAASC,EAAQC,GAA8B;AAC7C,QAAMC,IAAQ,wBAAwB,KAAKD,EAAM,MAAM;AACvD,SAAOC,IAAQ,OAAOA,EAAM,CAAC,CAAC,IAAI;AACpC;AAEA,SAASC,EAAmBC,GAAkBC,GAAaC,GAAa;AACtE,QAAMC,IAAQP,EAAQK,CAAG,GACnBG,IAAQR,EAAQM,CAAG,GACnBG,IAASF,MAAU,QAAQH,IAAWG,GACtCG,IAASF,MAAU,QAAQJ,IAAWI;AAC5C,SAAO;AAAA,IACL,QAAAC;AAAA,IACA,QAAAC;AAAA,IACA,SAASD,KAAUC;AAAA,EAAA;AAEvB;AAEO,SAASC,EAAmB;AAAA,EACjC,SAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAT;AAAA,EACA,SAAAU,IAAU;AACZ,GAAuD;AACrD,QAAMC,IAAOhB,EAAUc,CAAI,GAErBG,IAAW,iBAAiBJ,CAAO,GACnCK,IAAWd,EAAmBC,GAAUY,EAASD,EAAK,GAAG,GAAGC,EAASD,EAAK,GAAG,CAAC;AACpF,MAAIE,EAAS,QAAS,QAAOA;AAE7B,QAAMC,IAAQN,EAAQ,OAChBO,IAAiBD,EAAMH,EAAK,IAAI;AAEtC,MAAI;AAEF,IAAAG,EAAMH,EAAK,IAAI,IAAI,GAAGX,CAAQ;AAM9B,UAAMgB,IAHOR,EAAQ,sBAAA,EACKG,EAAK,IAAI,IAENX,GAEvBK,IAASW,IAAQN,GACjBJ,IAASU,IAAQ,CAACN;AAGxB,WAAO;AAAA,MACL,QAAAL;AAAA,MACA,QAAAC;AAAA,MACA,SALcD,KAAUC;AAAA,IAKxB;AAAA,EAEJ,UAAA;AAEE,IAAAQ,EAAMH,EAAK,IAAI,IAAII;AAAA,EACrB;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize_handlers.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/resize_handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"resize_handlers.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/resize_handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,SAAS,CAAC;AAYjB,wBAAgB,6BAA6B,CAC3C,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,EACrD,aAAa,CAAC,EAAE,aAAa,EAC7B,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,KAAK,IAAI,EACrE,MAAM,GAAE,iBAA2B,EACnC,MAAM,UAAQ,EACd,gBAAgB,UAAQ,IAEc,OAAO,KAAK,CAAC,UAAU,UAgE9D;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,EACrD,cAAc,CAAC,EAAE,cAAc,EAC/B,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,EACxE,MAAM,UAAQ,EACd,MAAM,GAAE,kBAA6B,IAGD,OAAO,KAAK,CAAC,UAAU,UA2D5D"}
|
|
@@ -1,54 +1,61 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { detectResizeBounds as D } from "./detect_resize_bounds.js";
|
|
2
|
+
function w() {
|
|
3
|
+
const n = window.document.createElement("div");
|
|
4
|
+
return n.style.position = "absolute", n.style.inset = "-500px", n.style.backgroundColor = "transparent", n.style.pointerEvents = "auto", n;
|
|
4
5
|
}
|
|
5
|
-
function
|
|
6
|
-
return function(
|
|
7
|
-
const
|
|
8
|
-
if (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
t.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
6
|
+
function C(n, v, f, p = "right", c = !1, b = !1) {
|
|
7
|
+
return function(t) {
|
|
8
|
+
const e = n.current;
|
|
9
|
+
if (e == null) return;
|
|
10
|
+
const a = w();
|
|
11
|
+
e.appendChild(a);
|
|
12
|
+
const d = (window.getComputedStyle(e).direction === "rtl" && !b ? !c : c) ? -1 : 1, g = t.clientX, u = e.getBoundingClientRect();
|
|
13
|
+
let s = u.width;
|
|
14
|
+
const r = (i) => {
|
|
15
|
+
const h = d * (i.clientX - g), m = u.width + h;
|
|
16
|
+
if (D({
|
|
17
|
+
element: e,
|
|
18
|
+
axis: "width",
|
|
19
|
+
nextSize: m
|
|
20
|
+
}).clamped) return;
|
|
21
|
+
const x = m - s;
|
|
22
|
+
s = m, e.style.width = `${m}px`, v?.({ width: m, origin: p, totalDelta: h, currentDelta: x }), i.stopPropagation(), i.preventDefault();
|
|
23
|
+
}, l = (i) => {
|
|
24
|
+
i.buttons === 0 && o();
|
|
25
|
+
}, o = () => {
|
|
26
|
+
e.removeChild(a), document.body.removeEventListener("mousemove", r), document.body.removeEventListener("mouseup", o), document.body.removeEventListener("mouseenter", l), t.stopPropagation(), t.preventDefault(), f?.(s, p);
|
|
23
27
|
};
|
|
24
|
-
document.body.addEventListener("mousemove",
|
|
28
|
+
document.body.addEventListener("mousemove", r), document.body.addEventListener("mouseup", o), document.body.addEventListener("mouseenter", l), t.stopPropagation(), t.preventDefault();
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
|
-
function
|
|
28
|
-
const
|
|
29
|
-
return function(
|
|
30
|
-
const
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
t.
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
31
|
+
function P(n, v, f, p = !1, c = "bottom") {
|
|
32
|
+
const b = p ? -1 : 1;
|
|
33
|
+
return function(t) {
|
|
34
|
+
const e = n.current;
|
|
35
|
+
if (e == null) return;
|
|
36
|
+
const a = w();
|
|
37
|
+
e.appendChild(a);
|
|
38
|
+
const E = t.clientY, y = e.getBoundingClientRect();
|
|
39
|
+
let d = y.height;
|
|
40
|
+
const g = (r) => {
|
|
41
|
+
const l = b * (r.clientY - E), o = y.height + l;
|
|
42
|
+
if (D({
|
|
43
|
+
element: e,
|
|
44
|
+
axis: "height",
|
|
45
|
+
nextSize: o
|
|
46
|
+
}).clamped) return;
|
|
47
|
+
const h = o - d;
|
|
48
|
+
d = o, e.style.height = `${o}px`, v?.({ height: o, origin: c, totalDelta: l, currentDelta: h }), r.stopPropagation(), r.preventDefault();
|
|
49
|
+
}, u = (r) => {
|
|
50
|
+
r.buttons === 0 && s();
|
|
51
|
+
}, s = () => {
|
|
52
|
+
e.removeChild(a), document.body.removeEventListener("mousemove", g), document.body.removeEventListener("mouseup", s), document.body.removeEventListener("mouseenter", u), t.stopPropagation(), t.preventDefault(), f?.(d, c);
|
|
46
53
|
};
|
|
47
|
-
document.body.addEventListener("mousemove", g), document.body.addEventListener("mouseup",
|
|
54
|
+
document.body.addEventListener("mousemove", g), document.body.addEventListener("mouseup", s), document.body.addEventListener("mouseenter", u), t.stopPropagation(), t.preventDefault();
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
export {
|
|
51
|
-
|
|
52
|
-
|
|
58
|
+
C as createHorizontalResizeHandler,
|
|
59
|
+
P as createVerticalResizeHandler
|
|
53
60
|
};
|
|
54
61
|
//# sourceMappingURL=resize_handlers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resize_handlers.js","sources":["../../../src/stacks/box/resize_handlers.ts"],"sourcesContent":["import {\n OnWidthResize,\n type HeightResizeOrigin,\n type OnHeightResize,\n type WidthResizeOrigin,\n} from './types';\n\nfunction createVeil() {\n const veil = window.document.createElement('div');\n veil.style.position = 'absolute';\n veil.style.inset = '-500px';\n veil.style.backgroundColor = 'transparent';\n veil.style.pointerEvents = 'auto';\n return veil;\n}\n\nexport function createHorizontalResizeHandler(\n targetRef: React.MutableRefObject<HTMLElement | null>,\n onWidthResize?: OnWidthResize,\n onWidthResizeEnd?: (width: number, origin: WidthResizeOrigin) => void,\n origin: WidthResizeOrigin = 'right',\n invert = false,\n disableDirection = false\n) {\n return function startHorizontalResize(event: React.MouseEvent) {\n const box = targetRef.current;\n\n if (box == null)
|
|
1
|
+
{"version":3,"file":"resize_handlers.js","sources":["../../../src/stacks/box/resize_handlers.ts"],"sourcesContent":["import {\n OnWidthResize,\n type HeightResizeOrigin,\n type OnHeightResize,\n type WidthResizeOrigin,\n} from './types';\nimport { detectResizeBounds } from './detect_resize_bounds.js';\n\nfunction createVeil() {\n const veil = window.document.createElement('div');\n veil.style.position = 'absolute';\n veil.style.inset = '-500px';\n veil.style.backgroundColor = 'transparent';\n veil.style.pointerEvents = 'auto';\n return veil;\n}\n\nexport function createHorizontalResizeHandler(\n targetRef: React.MutableRefObject<HTMLElement | null>,\n onWidthResize?: OnWidthResize,\n onWidthResizeEnd?: (width: number, origin: WidthResizeOrigin) => void,\n origin: WidthResizeOrigin = 'right',\n invert = false,\n disableDirection = false\n) {\n return function startHorizontalResize(event: React.MouseEvent) {\n const box = targetRef.current;\n\n if (box == null) return;\n\n const veil = createVeil();\n box.appendChild(veil);\n\n const languageDirection = window.getComputedStyle(box).direction;\n const finalInvert =\n languageDirection === 'rtl' && !disableDirection ? !invert : invert;\n const direction = finalInvert ? -1 : 1;\n\n const startX = event.clientX;\n const startRect = box.getBoundingClientRect();\n let width = startRect.width;\n\n const drag = (event: MouseEvent) => {\n const totalDelta = direction * (event.clientX - startX);\n const newWidth = startRect.width + totalDelta;\n\n const result = detectResizeBounds({\n element: box,\n axis: 'width',\n nextSize: newWidth,\n });\n\n if (result.clamped) return;\n\n const currentDelta = newWidth - width;\n\n // apply the new width\n width = newWidth;\n box.style.width = `${newWidth}px`;\n\n onWidthResize?.({ width: newWidth, origin, totalDelta, currentDelta });\n event.stopPropagation();\n event.preventDefault();\n };\n\n const mouseEnter = (event: MouseEvent) => {\n if (event.buttons === 0) {\n endDrag();\n }\n };\n\n const endDrag = () => {\n box.removeChild(veil);\n\n document.body.removeEventListener('mousemove', drag);\n document.body.removeEventListener('mouseup', endDrag);\n document.body.removeEventListener('mouseenter', mouseEnter);\n event.stopPropagation();\n event.preventDefault();\n\n onWidthResizeEnd?.(width, origin);\n };\n\n document.body.addEventListener('mousemove', drag);\n document.body.addEventListener('mouseup', endDrag);\n document.body.addEventListener('mouseenter', mouseEnter);\n event.stopPropagation();\n event.preventDefault();\n };\n}\n\nexport function createVerticalResizeHandler(\n targetRef: React.MutableRefObject<HTMLElement | null>,\n onHeightResize?: OnHeightResize,\n onHeightResizeEnd?: (height: number, origin: HeightResizeOrigin) => void,\n invert = false,\n origin: HeightResizeOrigin = 'bottom'\n) {\n const direction = invert ? -1 : 1;\n return function startVerticalResize(event: React.MouseEvent) {\n const box = targetRef.current;\n\n if (box == null) return;\n\n const veil = createVeil();\n box.appendChild(veil);\n\n const startY = event.clientY;\n const startRect = box.getBoundingClientRect();\n let height = startRect.height;\n\n const drag = (event: MouseEvent) => {\n const totalDelta = direction * (event.clientY - startY);\n const newHeight = startRect.height + totalDelta;\n\n const result = detectResizeBounds({\n element: box,\n axis: 'height',\n nextSize: newHeight,\n });\n\n if (result.clamped) return;\n\n const currentDelta = newHeight - height;\n\n // apply the new height\n height = newHeight;\n box.style.height = `${newHeight}px`;\n\n onHeightResize?.({ height: newHeight, origin, totalDelta, currentDelta });\n event.stopPropagation();\n event.preventDefault();\n };\n\n const mouseEnter = (event: MouseEvent) => {\n if (event.buttons === 0) {\n endDrag();\n }\n };\n\n const endDrag = () => {\n box.removeChild(veil);\n\n document.body.removeEventListener('mousemove', drag);\n document.body.removeEventListener('mouseup', endDrag);\n document.body.removeEventListener('mouseenter', mouseEnter);\n event.stopPropagation();\n event.preventDefault();\n\n onHeightResizeEnd?.(height, origin);\n };\n\n document.body.addEventListener('mousemove', drag);\n document.body.addEventListener('mouseup', endDrag);\n document.body.addEventListener('mouseenter', mouseEnter);\n event.stopPropagation();\n event.preventDefault();\n };\n}\n"],"names":["createVeil","veil","createHorizontalResizeHandler","targetRef","onWidthResize","onWidthResizeEnd","origin","invert","disableDirection","event","box","direction","startX","startRect","width","drag","totalDelta","newWidth","detectResizeBounds","currentDelta","mouseEnter","endDrag","createVerticalResizeHandler","onHeightResize","onHeightResizeEnd","startY","height","newHeight"],"mappings":";AAQA,SAASA,IAAa;AACpB,QAAMC,IAAO,OAAO,SAAS,cAAc,KAAK;AAChD,SA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GAENe,IAAoBE,GAAQpB,CAAM;AAAA,IACpC;AAEA,aAAS,KAAK,iBAAiB,aAAaS,CAAI,GAChD,SAAS,KAAK,iBAAiB,WAAWM,CAAO,GACjD,SAAS,KAAK,iBAAiB,cAAcD,CAAU,GACvDX,EAAM,gBAAA,GACNA,EAAM,eAAA;AAAA,EACR;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_resize_handle.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/start_resize_handle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"start_resize_handle.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/start_resize_handle.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAG9D,MAAM,MAAM,sBAAsB,GAAG,2BAA2B,CAAC;AAEjE,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,WAAW,EACX,aAAa,EACb,gBAAgB,GACjB,EAAE,sBAAsB,2CA0BxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_resize_handle.js","sources":["../../../src/stacks/box/start_resize_handle.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createHorizontalResizeHandler } from './resize_handlers.js';\nimport styles from './start_resize_handle.module.css';\nimport type { HorizontalResizeHandleProps } from './types.js';\n\nexport type StartResizeHandleProps = HorizontalResizeHandleProps;\n\nexport function StartResizeHandle({\n targetRef,\n handleProps,\n onWidthResize,\n onWidthResizeEnd,\n}: StartResizeHandleProps) {\n const resizeHandler = createHorizontalResizeHandler(\n targetRef,\n onWidthResize,\n onWidthResizeEnd,\n 'left'\n );\n const offset = handleProps?.offset ? handleProps.offset : -8;\n\n const startResizeHandleStyle
|
|
1
|
+
{"version":3,"file":"start_resize_handle.js","sources":["../../../src/stacks/box/start_resize_handle.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { createHorizontalResizeHandler } from './resize_handlers.js';\nimport styles from './start_resize_handle.module.css';\nimport type { HorizontalResizeHandleProps } from './types.js';\nimport { CSSProperties } from 'react';\n\nexport type StartResizeHandleProps = HorizontalResizeHandleProps;\n\nexport function StartResizeHandle({\n targetRef,\n handleProps,\n onWidthResize,\n onWidthResizeEnd,\n}: StartResizeHandleProps) {\n const resizeHandler = createHorizontalResizeHandler(\n targetRef,\n onWidthResize,\n onWidthResizeEnd,\n 'left',\n true\n );\n\n const offset = handleProps?.offset ? handleProps.offset : -8;\n\n const startResizeHandleStyle = {\n ...handleProps?.style,\n '--resize-offset': `${offset}px`,\n width: handleProps?.size || '16px',\n } as CSSProperties;\n\n return (\n <div\n className={clsx(styles['start-resize-handle'], 'tcn-start-resize-handle')}\n onMouseDown={resizeHandler}\n style={startResizeHandleStyle}\n >\n {handleProps?.children}\n </div>\n );\n}\n"],"names":["StartResizeHandle","targetRef","handleProps","onWidthResize","onWidthResizeEnd","resizeHandler","createHorizontalResizeHandler","offset","startResizeHandleStyle","jsx","clsx","styles"],"mappings":";;;;AAQO,SAASA,EAAkB;AAAA,EAChC,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,eAAAC;AAAA,EACA,kBAAAC;AACF,GAA2B;AACzB,QAAMC,IAAgBC;AAAA,IACpBL;AAAA,IACAE;AAAA,IACAC;AAAA,IACA;AAAA,IACA;AAAA,EAAA,GAGIG,IAASL,GAAa,SAASA,EAAY,SAAS,IAEpDM,IAAyB;AAAA,IAC7B,GAAGN,GAAa;AAAA,IAChB,mBAAmB,GAAGK,CAAM;AAAA,IAC5B,OAAOL,GAAa,QAAQ;AAAA,EAAA;AAG9B,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,EAAKC,EAAO,qBAAqB,GAAG,yBAAyB;AAAA,MACxE,aAAaN;AAAA,MACb,OAAOG;AAAA,MAEN,UAAAN,GAAa;AAAA,IAAA;AAAA,EAAA;AAGpB;"}
|
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
import { HandleProps } from './handle_props.js';
|
|
2
2
|
export type WidthResizeOrigin = 'left' | 'right';
|
|
3
3
|
export type HeightResizeOrigin = 'top' | 'bottom';
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export interface BaseOnResizePayload<Origin extends WidthResizeOrigin | HeightResizeOrigin> {
|
|
5
|
+
origin: Origin;
|
|
6
|
+
totalDelta: number;
|
|
7
|
+
currentDelta: number;
|
|
8
|
+
}
|
|
9
|
+
export interface OnWidthResizePayload extends BaseOnResizePayload<WidthResizeOrigin> {
|
|
10
|
+
width: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OnHeightResizePayload extends BaseOnResizePayload<HeightResizeOrigin> {
|
|
13
|
+
height: number;
|
|
14
|
+
}
|
|
15
|
+
export type OnWidthResizeEnd = (width: number, origin: WidthResizeOrigin) => void;
|
|
16
|
+
export type OnHeightResizeEnd = (height: number, origin: HeightResizeOrigin) => void;
|
|
17
|
+
export type OnWidthResize = (payload: OnWidthResizePayload) => void;
|
|
18
|
+
export type OnHeightResize = (payload: OnHeightResizePayload) => void;
|
|
6
19
|
export interface HorizontalResizeHandleProps {
|
|
7
20
|
targetRef: React.MutableRefObject<HTMLElement | null>;
|
|
8
21
|
handleProps?: HandleProps;
|
|
9
22
|
onWidthResize?: OnWidthResize;
|
|
10
|
-
onWidthResizeEnd?:
|
|
23
|
+
onWidthResizeEnd?: OnWidthResizeEnd;
|
|
11
24
|
}
|
|
12
25
|
export interface VerticalResizeHandleProps {
|
|
13
26
|
targetRef: React.MutableRefObject<HTMLElement | null>;
|
|
14
27
|
handleProps?: HandleProps;
|
|
15
28
|
onHeightResize?: OnHeightResize;
|
|
16
|
-
onHeightResizeEnd?:
|
|
29
|
+
onHeightResizeEnd?: OnHeightResizeEnd;
|
|
17
30
|
}
|
|
18
31
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAC;AACjD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAElD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/stacks/box/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,OAAO,CAAC;AACjD,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,mBAAmB,CAClC,MAAM,SAAS,iBAAiB,GAAG,kBAAkB;IAErD,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB,CAAC,iBAAiB,CAAC;IAClF,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB,CAAC,kBAAkB,CAAC;IACpF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,iBAAiB,KAAK,IAAI,CAAC;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAC;AAErF,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;AACpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAEtE,MAAM,WAAW,2BAA2B;IAC1C,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,EAAE,KAAK,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACtD,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC"}
|
|
@@ -3,8 +3,6 @@ import { ConfirmProps } from '../confirm/confirm.js';
|
|
|
3
3
|
export interface AlertProps extends Omit<ConfirmProps, 'actions'> {
|
|
4
4
|
open?: boolean;
|
|
5
5
|
graphic?: React.ReactNode;
|
|
6
|
-
title?: string;
|
|
7
|
-
description?: string;
|
|
8
6
|
onAccept?: () => void;
|
|
9
7
|
}
|
|
10
8
|
export declare const Alert: React.ForwardRefExoticComponent<AlertProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/surfaces/alert/alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAW,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/surfaces/alert/alert.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAW,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,YAAY,EAAE,SAAS,CAAC;IAC/D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,eAAO,MAAM,KAAK,mFAgBhB,CAAC"}
|
|
@@ -1,26 +1,24 @@
|
|
|
1
1
|
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { clsx as
|
|
3
|
-
import
|
|
2
|
+
import { clsx as e } from "clsx";
|
|
3
|
+
import p from "react";
|
|
4
4
|
import "../../actions/button/base_button/base_button.js";
|
|
5
5
|
import "../../actions/button/button_group/button_group.js";
|
|
6
6
|
import "../../actions/button/slim_button/slim_button.js";
|
|
7
7
|
import { Button as c } from "../../actions/button/button/button.js";
|
|
8
|
-
import "../../actions/button/select_group/select_group.js";
|
|
9
|
-
import "../../actions/button/select_group/single_select_group.js";
|
|
10
8
|
import "../../actions/toggle/toggle.js";
|
|
11
9
|
import { Confirm as f } from "../confirm/confirm.js";
|
|
12
|
-
const
|
|
10
|
+
const A = p.forwardRef(function({ className: t, onAccept: o, ...i }, m) {
|
|
13
11
|
return /* @__PURE__ */ r(
|
|
14
12
|
f,
|
|
15
13
|
{
|
|
16
14
|
ref: m,
|
|
17
|
-
className:
|
|
15
|
+
className: e(t, "tcn-alert"),
|
|
18
16
|
...i,
|
|
19
17
|
actions: /* @__PURE__ */ r(c, { onClick: o, hierarchy: "primary", width: "100%", children: "OK" })
|
|
20
18
|
}
|
|
21
19
|
);
|
|
22
20
|
});
|
|
23
21
|
export {
|
|
24
|
-
|
|
22
|
+
A as Alert
|
|
25
23
|
};
|
|
26
24
|
//# sourceMappingURL=alert.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.js","sources":["../../../src/surfaces/alert/alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React from 'react';\nimport { Button } from '../../actions/index.js';\nimport { Confirm, ConfirmProps } from '../confirm/confirm.js';\n\nexport interface AlertProps extends Omit<ConfirmProps, 'actions'> {\n open?: boolean;\n graphic?: React.ReactNode;\n
|
|
1
|
+
{"version":3,"file":"alert.js","sources":["../../../src/surfaces/alert/alert.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React from 'react';\nimport { Button } from '../../actions/index.js';\nimport { Confirm, ConfirmProps } from '../confirm/confirm.js';\n\nexport interface AlertProps extends Omit<ConfirmProps, 'actions'> {\n open?: boolean;\n graphic?: React.ReactNode;\n onAccept?: () => void;\n}\n\nexport const Alert = React.forwardRef(function Alert(\n { className, onAccept, ...props }: AlertProps,\n ref: React.Ref<HTMLDivElement>\n) {\n return (\n <Confirm\n ref={ref}\n className={clsx(className, 'tcn-alert')}\n {...props}\n actions={\n <Button onClick={onAccept} hierarchy=\"primary\" width=\"100%\">\n OK\n </Button>\n }\n />\n );\n});\n"],"names":["Alert","React","className","onAccept","props","ref","jsx","Confirm","clsx","Button"],"mappings":";;;;;;;;;AAWO,MAAMA,IAAQC,EAAM,WAAW,SACpC,EAAE,WAAAC,GAAW,UAAAC,GAAU,GAAGC,EAAA,GAC1BC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,WAAWG,EAAKN,GAAW,WAAW;AAAA,MACrC,GAAGE;AAAA,MACJ,2BACGK,GAAA,EAAO,SAASN,GAAU,WAAU,WAAU,OAAM,QAAO,UAAA,KAAA,CAE5D;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { BoxProps } from '../../stacks/box/box.js';
|
|
3
|
-
export interface ConfirmProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
export interface ConfirmProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {
|
|
4
4
|
open?: boolean;
|
|
5
5
|
graphic?: React.ReactNode;
|
|
6
|
-
title?:
|
|
7
|
-
description?:
|
|
6
|
+
title?: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
8
|
actions?: React.ReactNode;
|
|
9
9
|
veilProps?: BoxProps;
|
|
10
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/surfaces/confirm/confirm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAQjE,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/surfaces/confirm/confirm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAQjE,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,WAAW,YACf,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAC3D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB;AAED,eAAO,MAAM,OAAO,qFAqFlB,CAAC"}
|
|
@@ -1,62 +1,63 @@
|
|
|
1
|
-
import { jsx as t, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { clsx as
|
|
4
|
-
import { Spacer as
|
|
5
|
-
import { VStack as
|
|
6
|
-
import { ZStack as
|
|
7
|
-
import { Portal as
|
|
8
|
-
import { BodyText as
|
|
1
|
+
import { jsx as t, Fragment as S, jsxs as c } from "react/jsx-runtime";
|
|
2
|
+
import C, { useRef as N, useState as T, useLayoutEffect as s } from "react";
|
|
3
|
+
import { clsx as m } from "clsx";
|
|
4
|
+
import { Spacer as E } from "../../stacks/spacer.js";
|
|
5
|
+
import { VStack as R } from "../../stacks/v_stack.js";
|
|
6
|
+
import { ZStack as j } from "../../stacks/z_stack.js";
|
|
7
|
+
import { Portal as B } from "../../overlay/portal/portal.js";
|
|
8
|
+
import { BodyText as b } from "../../typography/body_text/body_text.js";
|
|
9
9
|
import "../../typography/callout/callout.js";
|
|
10
10
|
import "../../typography/caption/caption.js";
|
|
11
11
|
import "../../typography/footnote/footnote.js";
|
|
12
12
|
import "../../typography/headline/headline.js";
|
|
13
13
|
import "../../typography/subheadline/subheadline.js";
|
|
14
|
-
import { Title as
|
|
15
|
-
import { Box as
|
|
16
|
-
import '../../confirm.css';const
|
|
17
|
-
open:
|
|
18
|
-
graphic:
|
|
19
|
-
title:
|
|
20
|
-
description:
|
|
21
|
-
actions:
|
|
22
|
-
veilProps:
|
|
14
|
+
import { Title as v } from "../../typography/title/title.js";
|
|
15
|
+
import { Box as a } from "../../stacks/box/box.js";
|
|
16
|
+
import '../../confirm.css';const z = "_confirm_e53f865", A = "_shake_d5d9154", F = "_actions_b7ffee5", f = { confirm: z, shake: A, actions: F }, X = C.forwardRef(function({
|
|
17
|
+
open: l,
|
|
18
|
+
graphic: h,
|
|
19
|
+
title: e,
|
|
20
|
+
description: r,
|
|
21
|
+
actions: p,
|
|
22
|
+
veilProps: d,
|
|
23
23
|
className: u,
|
|
24
|
-
...
|
|
25
|
-
},
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}), []),
|
|
30
|
-
if (
|
|
31
|
-
const
|
|
32
|
-
|
|
24
|
+
...g
|
|
25
|
+
}, k) {
|
|
26
|
+
const o = N(!1), [i, n] = T(!1);
|
|
27
|
+
s(() => (o.current = !0, () => {
|
|
28
|
+
o.current = !1;
|
|
29
|
+
}), []), s(() => {
|
|
30
|
+
if (i && o.current) {
|
|
31
|
+
const w = window.setTimeout(() => {
|
|
32
|
+
n(!1);
|
|
33
33
|
}, 600);
|
|
34
|
-
return () => window.clearTimeout(
|
|
34
|
+
return () => window.clearTimeout(w);
|
|
35
35
|
}
|
|
36
|
-
}, [
|
|
37
|
-
function
|
|
38
|
-
|
|
36
|
+
}, [i]);
|
|
37
|
+
function x() {
|
|
38
|
+
n(!0);
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const y = typeof r == "string" ? /* @__PURE__ */ t(b, { className: "tcn-confirm-description", hierarchy: "tertiary", children: r }) : r, _ = typeof e == "string" ? /* @__PURE__ */ t(v, { className: "tcn-confirm-title", emphasis: "strong", size: "sm", children: e }) : e;
|
|
41
|
+
return /* @__PURE__ */ t(S, { children: l && /* @__PURE__ */ t(B, { children: /* @__PURE__ */ c(j, { height: "100%", style: { position: "fixed" }, children: [
|
|
42
|
+
/* @__PURE__ */ t(a, { onClick: x, ...d, height: "100%" }),
|
|
42
43
|
/* @__PURE__ */ t(
|
|
43
44
|
"div",
|
|
44
45
|
{
|
|
45
|
-
ref:
|
|
46
|
-
className:
|
|
47
|
-
"data-shake":
|
|
48
|
-
...
|
|
49
|
-
children: /* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
/* @__PURE__ */ t(
|
|
46
|
+
ref: k,
|
|
47
|
+
className: m(f.confirm, u, "tcn-confirm"),
|
|
48
|
+
"data-shake": i,
|
|
49
|
+
...g,
|
|
50
|
+
children: /* @__PURE__ */ c(R, { hAlign: "center", children: [
|
|
51
|
+
h,
|
|
52
|
+
_,
|
|
53
|
+
y,
|
|
54
|
+
/* @__PURE__ */ t(E, { height: "16px" }),
|
|
54
55
|
/* @__PURE__ */ t(
|
|
55
|
-
|
|
56
|
+
a,
|
|
56
57
|
{
|
|
57
|
-
className:
|
|
58
|
+
className: m(f.actions, "tcn-confirm-actions"),
|
|
58
59
|
height: "auto",
|
|
59
|
-
children:
|
|
60
|
+
children: p
|
|
60
61
|
}
|
|
61
62
|
)
|
|
62
63
|
] })
|
|
@@ -65,6 +66,6 @@ import '../../confirm.css';const v = "_confirm_e53f865", z = "_shake_d5d9154", A
|
|
|
65
66
|
] }) }) });
|
|
66
67
|
});
|
|
67
68
|
export {
|
|
68
|
-
|
|
69
|
+
X as Confirm
|
|
69
70
|
};
|
|
70
71
|
//# sourceMappingURL=confirm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.js","sources":["../../../src/surfaces/confirm/confirm.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\nimport { Spacer } from '../../stacks/spacer.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { Portal } from '../../overlay/portal/portal.js';\nimport { BodyText, Title } from '../../typography/index.js';\nimport styles from './confirm.module.css';\nimport { Box, type BoxProps } from '../../stacks/box/box.js';\n\nexport interface ConfirmProps
|
|
1
|
+
{"version":3,"file":"confirm.js","sources":["../../../src/surfaces/confirm/confirm.tsx"],"sourcesContent":["import React, { useLayoutEffect, useRef, useState } from 'react';\nimport { clsx } from 'clsx';\nimport { Spacer } from '../../stacks/spacer.js';\nimport { VStack } from '../../stacks/v_stack.js';\nimport { ZStack } from '../../stacks/z_stack.js';\nimport { Portal } from '../../overlay/portal/portal.js';\nimport { BodyText, Title } from '../../typography/index.js';\nimport styles from './confirm.module.css';\nimport { Box, type BoxProps } from '../../stacks/box/box.js';\n\nexport interface ConfirmProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, 'title'> {\n open?: boolean;\n graphic?: React.ReactNode;\n title?: React.ReactNode;\n description?: React.ReactNode;\n actions?: React.ReactNode;\n veilProps?: BoxProps;\n}\n\nexport const Confirm = React.forwardRef(function Confirm(\n {\n open,\n graphic,\n title,\n description,\n actions,\n veilProps,\n className,\n ...props\n }: ConfirmProps,\n ref: React.Ref<HTMLDivElement>\n) {\n const isMounted = useRef(false);\n const [shake, setShake] = useState(false);\n\n useLayoutEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n useLayoutEffect(() => {\n if (shake && isMounted.current) {\n const id = window.setTimeout(() => {\n setShake(false);\n }, 600);\n\n return () => window.clearTimeout(id);\n }\n }, [shake]);\n\n function shakeConfirm() {\n setShake(true);\n }\n\n const descriptionElement =\n typeof description === 'string' ? (\n <BodyText className=\"tcn-confirm-description\" hierarchy=\"tertiary\">\n {description}\n </BodyText>\n ) : (\n description\n );\n\n const titleElement =\n typeof title === 'string' ? (\n <Title className=\"tcn-confirm-title\" emphasis=\"strong\" size=\"sm\">\n {title}\n </Title>\n ) : (\n title\n );\n\n return (\n <>\n {open && (\n <Portal>\n <ZStack height=\"100%\" style={{ position: 'fixed' }}>\n <Box onClick={shakeConfirm} {...veilProps} height=\"100%\"></Box>\n <div\n ref={ref}\n className={clsx(styles.confirm, className, 'tcn-confirm')}\n data-shake={shake}\n {...props}\n >\n <VStack hAlign=\"center\">\n {graphic}\n {titleElement}\n {descriptionElement}\n <Spacer height=\"16px\" />\n <Box\n className={clsx(styles.actions, 'tcn-confirm-actions')}\n height=\"auto\"\n >\n {actions}\n </Box>\n </VStack>\n </div>\n </ZStack>\n </Portal>\n )}\n </>\n );\n});\n"],"names":["Confirm","React","open","graphic","title","description","actions","veilProps","className","props","ref","isMounted","useRef","shake","setShake","useState","useLayoutEffect","id","shakeConfirm","descriptionElement","jsx","BodyText","titleElement","Title","Fragment","Portal","jsxs","ZStack","Box","clsx","styles","VStack","Spacer"],"mappings":";;;;;;;;;;;;;;;sHAoBaA,IAAUC,EAAM,WAAW,SACtC;AAAA,EACE,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,SAAAC;AAAA,EACA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,UACAH;AAAA,UACD,gBAAAC,EAACY,GAAA,EAAO,QAAO,OAAA,CAAO;AAAA,UACtB,gBAAAZ;AAAA,YAACQ;AAAA,YAAA;AAAA,cACC,WAAWC,EAAKC,EAAO,SAAS,qBAAqB;AAAA,cACrD,QAAO;AAAA,cAEN,UAAAxB;AAAA,YAAA;AAAA,UAAA;AAAA,QACH,EAAA,CACF;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,EAAA,CACF,GACF,GAEJ;AAEJ,CAAC;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/surfaces/modal/modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMtE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,eAAO,MAAM,KAAK,+
|
|
1
|
+
{"version":3,"file":"modal.d.ts","sourceRoot":"","sources":["../../../src/surfaces/modal/modal.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAS,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAMtE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC;AAEpC,eAAO,MAAM,KAAK,+QA2BhB,CAAC"}
|
|
@@ -1,23 +1,32 @@
|
|
|
1
1
|
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
-
import { clsx as
|
|
3
|
-
import
|
|
4
|
-
import { Frame as
|
|
5
|
-
import { Scaffold as
|
|
6
|
-
import '../../modal.css';const
|
|
2
|
+
import { clsx as s } from "clsx";
|
|
3
|
+
import d from "react";
|
|
4
|
+
import { Frame as n } from "../../overlay/frame/frame.js";
|
|
5
|
+
import { Scaffold as i } from "../../layouts/scaffold/scaffold.js";
|
|
6
|
+
import '../../modal.css';const p = "_modal_473c6ef", u = { modal: p }, R = d.forwardRef(function({
|
|
7
|
+
children: a,
|
|
8
|
+
className: t,
|
|
9
|
+
isOpen: r,
|
|
10
|
+
veil: m = !0,
|
|
11
|
+
resizable: f = !1,
|
|
12
|
+
draggable: l = !1,
|
|
13
|
+
...c
|
|
14
|
+
}, e) {
|
|
7
15
|
return /* @__PURE__ */ o(
|
|
8
|
-
|
|
16
|
+
n,
|
|
9
17
|
{
|
|
10
|
-
ref:
|
|
18
|
+
ref: e,
|
|
11
19
|
isOpen: r,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
20
|
+
veil: m,
|
|
21
|
+
draggable: l,
|
|
22
|
+
resizable: f,
|
|
23
|
+
className: s(u.modal, "tcn-surface", "tcn-modal", t),
|
|
24
|
+
...c,
|
|
25
|
+
children: /* @__PURE__ */ o(i, { className: "tcn-modal-scaffold", width: "100%", height: "100%", children: a })
|
|
17
26
|
}
|
|
18
27
|
);
|
|
19
28
|
});
|
|
20
29
|
export {
|
|
21
|
-
|
|
30
|
+
R as Modal
|
|
22
31
|
};
|
|
23
32
|
//# sourceMappingURL=modal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modal.js","sources":["../../../src/surfaces/modal/modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React from 'react';\nimport { Frame, type FrameProps } from '../../overlay/frame/frame.js';\nimport { Scaffold } from '../../layouts/scaffold/scaffold.js';\n\n// Styles\nimport styles from './modal.module.css';\n\nexport type ModalProps = FrameProps;\n\nexport const Modal = React.forwardRef<HTMLElement, ModalProps>(function Modal(\n {
|
|
1
|
+
{"version":3,"file":"modal.js","sources":["../../../src/surfaces/modal/modal.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport React from 'react';\nimport { Frame, type FrameProps } from '../../overlay/frame/frame.js';\nimport { Scaffold } from '../../layouts/scaffold/scaffold.js';\n\n// Styles\nimport styles from './modal.module.css';\n\nexport type ModalProps = FrameProps;\n\nexport const Modal = React.forwardRef<HTMLElement, ModalProps>(function Modal(\n {\n children,\n className,\n isOpen,\n veil = true,\n resizable = false,\n draggable = false,\n ...props\n }: ModalProps,\n ref\n) {\n return (\n <Frame\n ref={ref}\n isOpen={isOpen}\n veil={veil}\n draggable={draggable}\n resizable={resizable}\n className={clsx(styles['modal'], 'tcn-surface', 'tcn-modal', className)}\n {...props}\n >\n <Scaffold className={'tcn-modal-scaffold'} width=\"100%\" height=\"100%\">\n {children}\n </Scaffold>\n </Frame>\n );\n});\n"],"names":["Modal","React","children","className","isOpen","veil","resizable","draggable","props","ref","jsx","Frame","clsx","styles","Scaffold"],"mappings":";;;;;8CAUaA,IAAQC,EAAM,WAAoC,SAC7D;AAAA,EACE,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC,IAAY;AAAA,EACZ,WAAAC,IAAY;AAAA,EACZ,GAAGC;AACL,GACAC,GACA;AACA,SACE,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,KAAAF;AAAA,MACA,QAAAL;AAAA,MACA,MAAAC;AAAA,MACA,WAAAE;AAAA,MACA,WAAAD;AAAA,MACA,WAAWM,EAAKC,EAAO,OAAU,eAAe,aAAaV,CAAS;AAAA,MACrE,GAAGK;AAAA,MAEJ,UAAA,gBAAAE,EAACI,KAAS,WAAW,sBAAsB,OAAM,QAAO,QAAO,QAC5D,UAAAZ,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN,CAAC;"}
|