@tcn/ui 0.5.0 → 0.7.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/confirm.css +1 -1
- package/dist/draggable.module-BgelQsuJ.js +5 -0
- package/dist/draggable.module-BgelQsuJ.js.map +1 -0
- package/dist/form/field/field.js +13 -10
- package/dist/form/field/field.js.map +1 -1
- package/dist/inputs/color_input/color_picker.js +5 -3
- package/dist/inputs/color_input/color_picker.js.map +1 -1
- package/dist/inputs/combo_box/combo_box.js +4 -2
- package/dist/inputs/combo_box/combo_box.js.map +1 -1
- package/dist/inputs/date_picker/date_picker.js +16 -14
- package/dist/inputs/date_picker/date_picker.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_input.js +10 -8
- package/dist/inputs/date_picker/date_picker_input.js.map +1 -1
- package/dist/inputs/date_picker/date_picker_year_selector.js +4 -2
- package/dist/inputs/date_picker/date_picker_year_selector.js.map +1 -1
- package/dist/inputs/mask_input/key_capture_input.js +15 -12
- package/dist/inputs/mask_input/key_capture_input.js.map +1 -1
- package/dist/inputs/mask_input/mask_input.js +13 -10
- package/dist/inputs/mask_input/mask_input.js.map +1 -1
- package/dist/inputs/multiselect/multiselect.js +9 -7
- package/dist/inputs/multiselect/multiselect.js.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.d.ts +1 -0
- package/dist/inputs/phone_number_input/phone_number_input.d.ts.map +1 -1
- package/dist/inputs/phone_number_input/phone_number_input.js +136 -133
- package/dist/inputs/phone_number_input/phone_number_input.js.map +1 -1
- package/dist/inputs/select/select.js +4 -2
- package/dist/inputs/select/select.js.map +1 -1
- package/dist/inputs/slider/slider.js +7 -5
- package/dist/inputs/slider/slider.js.map +1 -1
- package/dist/inputs/suggestions/suggestion_list.js +4 -2
- package/dist/inputs/suggestions/suggestion_list.js.map +1 -1
- package/dist/inputs/switch/switch.js +16 -14
- package/dist/inputs/switch/switch.js.map +1 -1
- package/dist/inputs/unit_input/unit_input.js +16 -14
- package/dist/inputs/unit_input/unit_input.js.map +1 -1
- package/dist/navigation/tabs/state/link/tab_link.js +9 -6
- package/dist/navigation/tabs/state/link/tab_link.js.map +1 -1
- package/dist/navigation/tabs/state/link/use_tab_link.js +8 -8
- package/dist/navigation/tabs/state/link/use_tab_link.js.map +1 -1
- package/dist/overlay/caret/caret.d.ts +8 -0
- package/dist/overlay/caret/caret.d.ts.map +1 -0
- package/dist/overlay/caret/caret.js +20 -0
- package/dist/overlay/caret/caret.js.map +1 -0
- package/dist/overlay/menu/menu.js +34 -32
- package/dist/overlay/menu/menu.js.map +1 -1
- package/dist/overlay/popper/legacy/popper.js +22 -20
- package/dist/overlay/popper/legacy/popper.js.map +1 -1
- package/dist/overlay/popper/preview_popper.js +12 -9
- package/dist/overlay/popper/preview_popper.js.map +1 -1
- package/dist/overlay/tethered/hooks/calculate_origin.d.ts +23 -0
- package/dist/overlay/tethered/hooks/calculate_origin.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/calculate_origin.js +41 -0
- package/dist/overlay/tethered/hooks/calculate_origin.js.map +1 -0
- package/dist/overlay/tethered/hooks/useCaretRefDimensions.d.ts +9 -0
- package/dist/overlay/tethered/hooks/useCaretRefDimensions.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/useCaretRefDimensions.js +14 -0
- package/dist/overlay/tethered/hooks/useCaretRefDimensions.js.map +1 -0
- package/dist/overlay/tethered/hooks/useTether.d.ts +1 -1
- package/dist/overlay/tethered/hooks/useTether.d.ts.map +1 -1
- package/dist/overlay/tethered/hooks/useTether.js +22 -21
- package/dist/overlay/tethered/hooks/useTether.js.map +1 -1
- package/dist/overlay/tethered/hooks/useTetherContentRect.d.ts +3 -0
- package/dist/overlay/tethered/hooks/useTetherContentRect.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/useTetherContentRect.js +36 -0
- package/dist/overlay/tethered/hooks/useTetherContentRect.js.map +1 -0
- package/dist/overlay/tethered/hooks/useTetherOrigin.d.ts +14 -0
- package/dist/overlay/tethered/hooks/useTetherOrigin.d.ts.map +1 -0
- package/dist/overlay/tethered/hooks/useTetherOrigin.js +24 -0
- package/dist/overlay/tethered/hooks/useTetherOrigin.js.map +1 -0
- package/dist/overlay/tethered/tethered.d.ts +2 -1
- package/dist/overlay/tethered/tethered.d.ts.map +1 -1
- package/dist/overlay/tethered/tethered.js +71 -38
- package/dist/overlay/tethered/tethered.js.map +1 -1
- package/dist/stacks/box/box.js +29 -27
- package/dist/stacks/box/box.js.map +1 -1
- package/dist/stacks/h_collapsible_box.js +14 -12
- package/dist/stacks/h_collapsible_box.js.map +1 -1
- package/dist/stacks/v_collapsible_box.js +8 -6
- package/dist/stacks/v_collapsible_box.js.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.d.ts.map +1 -1
- package/dist/surfaces/pop_confirm/pop_confirm.js +14 -13
- package/dist/surfaces/pop_confirm/pop_confirm.js.map +1 -1
- package/dist/surfaces/tooltip/tooltip.d.ts.map +1 -1
- package/dist/surfaces/tooltip/tooltip.js +12 -11
- package/dist/surfaces/tooltip/tooltip.js.map +1 -1
- package/dist/tethered.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.css +1 -1
- package/dist/themes/themes/ergo/ergo_theme.js +86 -56
- package/dist/themes/themes/ergo/ergo_theme.js.map +1 -1
- package/dist/themes/themes/windows_98/windows_98.css +1 -1
- package/dist/themes/themes/windows_98/windows_98_theme.js +18 -18
- package/dist/themes/themes/windows_98/windows_98_theme.js.map +1 -1
- package/dist/utils/dnd/draggable/draggable.js +13 -12
- package/dist/utils/dnd/draggable/draggable.js.map +1 -1
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +23 -19
- package/dist/utils/index.js.map +1 -1
- package/package.json +9 -9
- package/src/inputs/phone_number_input/phone_number_input.stories.tsx +24 -0
- package/src/inputs/phone_number_input/phone_number_input.tsx +8 -6
- package/src/navigation/tabs/state/link/use_tab_link.ts +4 -4
- package/src/overlay/{carrot/carrot.stories.tsx → caret/caret.stories.tsx} +14 -14
- package/src/overlay/caret/caret.tsx +24 -0
- package/src/overlay/tethered/__stories__/shared/base_story_config.ts +8 -0
- package/src/overlay/tethered/hooks/calculate_origin.ts +74 -0
- package/src/overlay/tethered/hooks/useCaretRefDimensions.ts +22 -0
- package/src/overlay/tethered/hooks/useTether.ts +4 -3
- package/src/overlay/tethered/hooks/useTetherContentRect.ts +49 -0
- package/src/overlay/tethered/hooks/useTetherOrigin.ts +49 -0
- package/src/overlay/tethered/tethered.module.css +55 -0
- package/src/overlay/tethered/tethered.tsx +44 -6
- package/src/surfaces/confirm/confirm.module.css +0 -1
- package/src/surfaces/panel/__stories__/panel.stories.tsx +62 -27
- package/src/surfaces/panel/__stories__/panel_stories.module.css +14 -1
- package/src/surfaces/pop_confirm/pop_confirm.tsx +4 -3
- package/src/surfaces/tooltip/tooltip.tsx +1 -0
- package/src/themes/themes/ergo/ergo_theme.css +86 -56
- package/src/themes/themes/windows_98/windows_98.css +18 -18
- package/src/utils/index.ts +3 -0
- package/dist/overlay/carrot/base_carrot.d.ts +0 -8
- package/dist/overlay/carrot/base_carrot.d.ts.map +0 -1
- package/dist/overlay/carrot/base_carrot.js +0 -21
- package/dist/overlay/carrot/base_carrot.js.map +0 -1
- package/src/overlay/carrot/base_carrot.tsx +0 -24
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import { calculateTetheredPosition as
|
|
1
|
+
import { useState as f, useRef as m, useCallback as g, useLayoutEffect as l } from "react";
|
|
2
|
+
import { calculateTetheredPosition as a } from "./calculate_position.js";
|
|
3
3
|
function E({
|
|
4
|
-
anchor:
|
|
5
|
-
verticalAnchor:
|
|
6
|
-
verticalOrigin:
|
|
4
|
+
anchor: o,
|
|
5
|
+
verticalAnchor: s = "bottom",
|
|
6
|
+
verticalOrigin: r = "top",
|
|
7
7
|
horizontalAnchor: u = "start",
|
|
8
8
|
horizontalOrigin: d = "start",
|
|
9
9
|
verticalOffset: p = 0,
|
|
10
|
-
horizontalOffset:
|
|
10
|
+
horizontalOffset: c = 0
|
|
11
11
|
}) {
|
|
12
|
-
const [
|
|
13
|
-
if (!
|
|
14
|
-
const t =
|
|
15
|
-
return
|
|
16
|
-
anchor:
|
|
12
|
+
const [i, h] = f({ top: 0, left: 0 }), n = m(null), w = g(() => {
|
|
13
|
+
if (!o || !n.current) return;
|
|
14
|
+
const t = n.current.getBoundingClientRect(), e = getComputedStyle(n.current);
|
|
15
|
+
return a({
|
|
16
|
+
anchor: o,
|
|
17
17
|
tether: {
|
|
18
18
|
dimensions: {
|
|
19
19
|
width: t.width,
|
|
@@ -25,35 +25,36 @@ function E({
|
|
|
25
25
|
}
|
|
26
26
|
},
|
|
27
27
|
direction: e.direction,
|
|
28
|
-
verticalAnchor:
|
|
29
|
-
verticalOrigin:
|
|
28
|
+
verticalAnchor: s,
|
|
29
|
+
verticalOrigin: r,
|
|
30
30
|
horizontalAnchor: u,
|
|
31
31
|
horizontalOrigin: d,
|
|
32
32
|
verticalOffset: p,
|
|
33
|
-
horizontalOffset:
|
|
33
|
+
horizontalOffset: c,
|
|
34
34
|
viewport: {
|
|
35
35
|
width: window.innerWidth,
|
|
36
36
|
height: window.innerHeight
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}, [
|
|
40
|
-
|
|
41
|
-
r,
|
|
40
|
+
o,
|
|
42
41
|
s,
|
|
42
|
+
r,
|
|
43
43
|
u,
|
|
44
44
|
d,
|
|
45
45
|
p,
|
|
46
|
-
|
|
46
|
+
c
|
|
47
47
|
]);
|
|
48
|
-
return
|
|
48
|
+
return l(() => {
|
|
49
49
|
const t = () => {
|
|
50
|
-
const e =
|
|
51
|
-
|
|
50
|
+
const e = w();
|
|
51
|
+
if (!e) return;
|
|
52
|
+
(i.top !== e.top || i.left !== e.left) && h(e);
|
|
52
53
|
};
|
|
53
54
|
return t(), window.addEventListener("resize", t), () => {
|
|
54
55
|
window.removeEventListener("resize", t);
|
|
55
56
|
};
|
|
56
|
-
}), { position:
|
|
57
|
+
}), { position: i, tetherRef: n };
|
|
57
58
|
}
|
|
58
59
|
export {
|
|
59
60
|
E as useTether
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTether.js","sources":["../../../../src/overlay/tethered/hooks/useTether.ts"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport
|
|
1
|
+
{"version":3,"file":"useTether.js","sources":["../../../../src/overlay/tethered/hooks/useTether.ts"],"sourcesContent":["import { useCallback, useLayoutEffect, useRef, useState } from 'react';\nimport { type Rectangle } from '../../../utils/index.js';\nimport type { HorizontalTether, VerticalTether } from '../types.js';\nimport { calculateTetheredPosition } from './calculate_position.js';\n\nexport interface UseTetherParams {\n anchor: Rectangle | null;\n verticalAnchor?: VerticalTether;\n verticalOrigin?: VerticalTether;\n horizontalOrigin?: HorizontalTether;\n horizontalAnchor?: HorizontalTether;\n verticalOffset?: number;\n horizontalOffset?: number;\n}\n\nexport function useTether({\n anchor,\n verticalAnchor = 'bottom',\n verticalOrigin = 'top',\n horizontalAnchor = 'start',\n horizontalOrigin = 'start',\n verticalOffset = 0,\n horizontalOffset = 0,\n}: UseTetherParams) {\n const [position, setPosition] = useState({ top: 0, left: 0 });\n const tetherRef = useRef<HTMLDivElement>(null);\n\n const getPosition = useCallback(() => {\n if (!anchor || !tetherRef.current) return;\n\n const tether = tetherRef.current.getBoundingClientRect();\n const computedStyle = getComputedStyle(tetherRef.current);\n\n return calculateTetheredPosition({\n anchor: anchor,\n tether: {\n dimensions: {\n width: tether.width,\n height: tether.height,\n },\n position: {\n x: tether.left,\n y: tether.top,\n },\n },\n direction: computedStyle.direction as 'ltr' | 'rtl',\n verticalAnchor: verticalAnchor,\n verticalOrigin: verticalOrigin,\n horizontalAnchor: horizontalAnchor,\n horizontalOrigin: horizontalOrigin,\n verticalOffset: verticalOffset,\n horizontalOffset: horizontalOffset,\n viewport: {\n width: window.innerWidth,\n height: window.innerHeight,\n },\n });\n }, [\n anchor,\n verticalAnchor,\n verticalOrigin,\n horizontalAnchor,\n horizontalOrigin,\n verticalOffset,\n horizontalOffset,\n ]);\n\n useLayoutEffect(() => {\n const update = () => {\n const newPosition = getPosition();\n if (!newPosition) return;\n const hasChanged =\n position.top !== newPosition.top || position.left !== newPosition.left;\n if (hasChanged) {\n setPosition(newPosition);\n }\n };\n update();\n window.addEventListener('resize', update);\n return () => {\n window.removeEventListener('resize', update);\n };\n });\n\n return { position, tetherRef };\n}\n"],"names":["useTether","anchor","verticalAnchor","verticalOrigin","horizontalAnchor","horizontalOrigin","verticalOffset","horizontalOffset","position","setPosition","useState","tetherRef","useRef","getPosition","useCallback","tether","computedStyle","calculateTetheredPosition","useLayoutEffect","update","newPosition"],"mappings":";;AAeO,SAASA,EAAU;AAAA,EACxB,QAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,IAAmB;AAAA,EACnB,kBAAAC,IAAmB;AAAA,EACnB,gBAAAC,IAAiB;AAAA,EACjB,kBAAAC,IAAmB;AACrB,GAAoB;AAClB,QAAM,CAACC,GAAUC,CAAW,IAAIC,EAAS,EAAE,KAAK,GAAG,MAAM,GAAG,GACtDC,IAAYC,EAAuB,IAAI,GAEvCC,IAAcC,EAAY,MAAM;AACpC,QAAI,CAACb,KAAU,CAACU,EAAU,QAAS;AAEnC,UAAMI,IAASJ,EAAU,QAAQ,sBAAA,GAC3BK,IAAgB,iBAAiBL,EAAU,OAAO;AAExD,WAAOM,EAA0B;AAAA,MAC/B,QAAAhB;AAAA,MACA,QAAQ;AAAA,QACN,YAAY;AAAA,UACV,OAAOc,EAAO;AAAA,UACd,QAAQA,EAAO;AAAA,QAAA;AAAA,QAEjB,UAAU;AAAA,UACR,GAAGA,EAAO;AAAA,UACV,GAAGA,EAAO;AAAA,QAAA;AAAA,MACZ;AAAA,MAEF,WAAWC,EAAc;AAAA,MACzB,gBAAAd;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,UAAU;AAAA,QACR,OAAO,OAAO;AAAA,QACd,QAAQ,OAAO;AAAA,MAAA;AAAA,IACjB,CACD;AAAA,EACH,GAAG;AAAA,IACDN;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,CACD;AAED,SAAAW,EAAgB,MAAM;AACpB,UAAMC,IAAS,MAAM;AACnB,YAAMC,IAAcP,EAAA;AACpB,UAAI,CAACO,EAAa;AAGlB,OADEZ,EAAS,QAAQY,EAAY,OAAOZ,EAAS,SAASY,EAAY,SAElEX,EAAYW,CAAW;AAAA,IAE3B;AACA,WAAAD,EAAA,GACA,OAAO,iBAAiB,UAAUA,CAAM,GACjC,MAAM;AACX,aAAO,oBAAoB,UAAUA,CAAM;AAAA,IAC7C;AAAA,EACF,CAAC,GAEM,EAAE,UAAAX,GAAU,WAAAG,EAAA;AACrB;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTetherContentRect.d.ts","sourceRoot":"","sources":["../../../../src/overlay/tethered/hooks/useTetherContentRect.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAuBzD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAwBjF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useState as r, useLayoutEffect as s } from "react";
|
|
2
|
+
function i(t) {
|
|
3
|
+
if (!t)
|
|
4
|
+
return {
|
|
5
|
+
dimensions: { width: 0, height: 0 },
|
|
6
|
+
position: { x: 0, y: 0 }
|
|
7
|
+
};
|
|
8
|
+
const e = t.getBoundingClientRect();
|
|
9
|
+
return {
|
|
10
|
+
dimensions: {
|
|
11
|
+
width: e.width,
|
|
12
|
+
height: e.height
|
|
13
|
+
},
|
|
14
|
+
position: {
|
|
15
|
+
x: e.left,
|
|
16
|
+
y: e.top
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function u(t) {
|
|
21
|
+
const [e, o] = r(
|
|
22
|
+
() => i(t.current)
|
|
23
|
+
);
|
|
24
|
+
return s(() => {
|
|
25
|
+
const n = () => {
|
|
26
|
+
o(i(t.current));
|
|
27
|
+
};
|
|
28
|
+
return n(), window.addEventListener("resize", n), window.addEventListener("scroll", n, !0), () => {
|
|
29
|
+
window.removeEventListener("resize", n), window.removeEventListener("scroll", n, !0);
|
|
30
|
+
};
|
|
31
|
+
}, [t]), e;
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
u as useTetherContentRect
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=useTetherContentRect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTetherContentRect.js","sources":["../../../../src/overlay/tethered/hooks/useTetherContentRect.ts"],"sourcesContent":["import { useLayoutEffect, useState } from 'react';\nimport type { Rectangle } from '../../../utils/index.js';\n\nfunction getTetherContentRect(element: HTMLElement | null): Rectangle {\n if (!element) {\n return {\n dimensions: { width: 0, height: 0 },\n position: { x: 0, y: 0 },\n };\n }\n\n const rect = element.getBoundingClientRect();\n return {\n dimensions: {\n width: rect.width,\n height: rect.height,\n },\n position: {\n x: rect.left,\n y: rect.top,\n },\n };\n}\n\nexport function useTetherContentRect(ref: React.RefObject<HTMLElement>): Rectangle {\n const [contentRect, setContentRect] = useState<Rectangle>(() =>\n getTetherContentRect(ref.current)\n );\n\n useLayoutEffect(() => {\n const update = () => {\n setContentRect(getTetherContentRect(ref.current));\n };\n\n update();\n\n // Track resize events\n window.addEventListener('resize', update);\n // Track scroll events\n window.addEventListener('scroll', update, true);\n\n return () => {\n window.removeEventListener('resize', update);\n window.removeEventListener('scroll', update, true);\n };\n }, [ref]);\n\n return contentRect;\n}\n"],"names":["getTetherContentRect","element","rect","useTetherContentRect","ref","contentRect","setContentRect","useState","useLayoutEffect","update"],"mappings":";AAGA,SAASA,EAAqBC,GAAwC;AACpE,MAAI,CAACA;AACH,WAAO;AAAA,MACL,YAAY,EAAE,OAAO,GAAG,QAAQ,EAAA;AAAA,MAChC,UAAU,EAAE,GAAG,GAAG,GAAG,EAAA;AAAA,IAAE;AAI3B,QAAMC,IAAOD,EAAQ,sBAAA;AACrB,SAAO;AAAA,IACL,YAAY;AAAA,MACV,OAAOC,EAAK;AAAA,MACZ,QAAQA,EAAK;AAAA,IAAA;AAAA,IAEf,UAAU;AAAA,MACR,GAAGA,EAAK;AAAA,MACR,GAAGA,EAAK;AAAA,IAAA;AAAA,EACV;AAEJ;AAEO,SAASC,EAAqBC,GAA8C;AACjF,QAAM,CAACC,GAAaC,CAAc,IAAIC;AAAA,IAAoB,MACxDP,EAAqBI,EAAI,OAAO;AAAA,EAAA;AAGlC,SAAAI,EAAgB,MAAM;AACpB,UAAMC,IAAS,MAAM;AACnB,MAAAH,EAAeN,EAAqBI,EAAI,OAAO,CAAC;AAAA,IAClD;AAEA,WAAAK,EAAA,GAGA,OAAO,iBAAiB,UAAUA,CAAM,GAExC,OAAO,iBAAiB,UAAUA,GAAQ,EAAI,GAEvC,MAAM;AACX,aAAO,oBAAoB,UAAUA,CAAM,GAC3C,OAAO,oBAAoB,UAAUA,GAAQ,EAAI;AAAA,IACnD;AAAA,EACF,GAAG,CAACL,CAAG,CAAC,GAEDC;AACT;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Position } from '../../../utils/index.js';
|
|
2
|
+
import { HorizontalTether, VerticalTether } from '../types.js';
|
|
3
|
+
import { CaretDirection } from './calculate_origin.js';
|
|
4
|
+
export interface UseTetherOriginResult {
|
|
5
|
+
originPosition: Position;
|
|
6
|
+
originOffset: {
|
|
7
|
+
yOffset: number;
|
|
8
|
+
xOffset: number;
|
|
9
|
+
};
|
|
10
|
+
containerRef: React.RefObject<HTMLDivElement>;
|
|
11
|
+
originDirection: CaretDirection;
|
|
12
|
+
}
|
|
13
|
+
export declare function useTetherOrigin(tetherPosition: Position, hOrigin: HorizontalTether, vOrigin: VerticalTether, precision: 'high' | 'low'): UseTetherOriginResult;
|
|
14
|
+
//# sourceMappingURL=useTetherOrigin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTetherOrigin.d.ts","sourceRoot":"","sources":["../../../../src/overlay/tethered/hooks/useTetherOrigin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAG/B,MAAM,WAAW,qBAAqB;IACpC,cAAc,EAAE,QAAQ,CAAC;IACzB,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACnD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC9C,eAAe,EAAE,cAAc,CAAC;CACjC;AAED,wBAAgB,eAAe,CAC7B,cAAc,EAAE,QAAQ,EACxB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE,cAAc,EACvB,SAAS,EAAE,MAAM,GAAG,KAAK,GACxB,qBAAqB,CAyBvB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useRef as g } from "react";
|
|
2
|
+
import { getOriginOffset as u, getOriginPosition as O, getOriginDirection as m } from "./calculate_origin.js";
|
|
3
|
+
import { useTetherContentRect as p } from "./useTetherContentRect.js";
|
|
4
|
+
function P(r, o, t, f) {
|
|
5
|
+
const i = g(null), n = p(i);
|
|
6
|
+
if (f === "low")
|
|
7
|
+
return {
|
|
8
|
+
originPosition: r,
|
|
9
|
+
originOffset: { yOffset: 0, xOffset: 0 },
|
|
10
|
+
containerRef: i,
|
|
11
|
+
originDirection: "none"
|
|
12
|
+
};
|
|
13
|
+
const e = u(n, o, t), s = O(n.position, e), c = m(t, o);
|
|
14
|
+
return {
|
|
15
|
+
originPosition: s,
|
|
16
|
+
originOffset: e,
|
|
17
|
+
containerRef: i,
|
|
18
|
+
originDirection: c
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
P as useTetherOrigin
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=useTetherOrigin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTetherOrigin.js","sources":["../../../../src/overlay/tethered/hooks/useTetherOrigin.ts"],"sourcesContent":["import { useRef } from 'react';\nimport type { Position } from '../../../utils/index.js';\nimport type { HorizontalTether, VerticalTether } from '../types.js';\nimport {\n getOriginDirection,\n getOriginOffset,\n getOriginPosition,\n type CaretDirection,\n} from './calculate_origin.js';\nimport { useTetherContentRect } from './useTetherContentRect.js';\n\nexport interface UseTetherOriginResult {\n originPosition: Position;\n originOffset: { yOffset: number; xOffset: number };\n containerRef: React.RefObject<HTMLDivElement>;\n originDirection: CaretDirection;\n}\n\nexport function useTetherOrigin(\n tetherPosition: Position,\n hOrigin: HorizontalTether,\n vOrigin: VerticalTether,\n precision: 'high' | 'low'\n): UseTetherOriginResult {\n const containerRef = useRef<HTMLDivElement>(null);\n const containerRect = useTetherContentRect(containerRef);\n\n // If precision is low, return default values\n if (precision === 'low') {\n return {\n originPosition: tetherPosition,\n originOffset: { yOffset: 0, xOffset: 0 },\n containerRef,\n originDirection: 'none',\n };\n }\n\n // Calculate origin values for high precision\n const originOffset = getOriginOffset(containerRect, hOrigin, vOrigin);\n const originPosition = getOriginPosition(containerRect.position, originOffset);\n const originDirection = getOriginDirection(vOrigin, hOrigin);\n\n return {\n originPosition,\n originOffset,\n containerRef,\n originDirection,\n };\n}\n"],"names":["useTetherOrigin","tetherPosition","hOrigin","vOrigin","precision","containerRef","useRef","containerRect","useTetherContentRect","originOffset","getOriginOffset","originPosition","getOriginPosition","originDirection","getOriginDirection"],"mappings":";;;AAkBO,SAASA,EACdC,GACAC,GACAC,GACAC,GACuB;AACvB,QAAMC,IAAeC,EAAuB,IAAI,GAC1CC,IAAgBC,EAAqBH,CAAY;AAGvD,MAAID,MAAc;AAChB,WAAO;AAAA,MACL,gBAAgBH;AAAA,MAChB,cAAc,EAAE,SAAS,GAAG,SAAS,EAAA;AAAA,MACrC,cAAAI;AAAA,MACA,iBAAiB;AAAA,IAAA;AAKrB,QAAMI,IAAeC,EAAgBH,GAAeL,GAASC,CAAO,GAC9DQ,IAAiBC,EAAkBL,EAAc,UAAUE,CAAY,GACvEI,IAAkBC,EAAmBX,GAASD,CAAO;AAE3D,SAAO;AAAA,IACL,gBAAAS;AAAA,IACA,cAAAF;AAAA,IACA,cAAAJ;AAAA,IACA,iBAAAQ;AAAA,EAAA;AAEJ;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HorizontalTether, VerticalTether } from './types.js';
|
|
2
1
|
import { ZStackProps } from '../../stacks/index.js';
|
|
3
2
|
import { Rectangle } from '../../utils/index.js';
|
|
3
|
+
import { HorizontalTether, VerticalTether } from './types.js';
|
|
4
4
|
export interface BaseTetheredOwnProps {
|
|
5
5
|
verticalAnchor?: VerticalTether;
|
|
6
6
|
verticalOrigin?: VerticalTether;
|
|
@@ -11,6 +11,7 @@ export interface BaseTetheredOwnProps {
|
|
|
11
11
|
}
|
|
12
12
|
export interface TetheredOwnProp extends BaseTetheredOwnProps {
|
|
13
13
|
anchor: Rectangle | null;
|
|
14
|
+
precision?: 'high' | 'low';
|
|
14
15
|
}
|
|
15
16
|
export interface TetheredProps extends TetheredOwnProp, ZStackProps {
|
|
16
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethered.d.ts","sourceRoot":"","sources":["../../../src/overlay/tethered/tethered.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tethered.d.ts","sourceRoot":"","sources":["../../../src/overlay/tethered/tethered.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAMlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAKnE,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D,MAAM,EAAE,SAAS,GAAG,IAAI,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;CAC5B;AACD,MAAM,WAAW,aAAc,SAAQ,eAAe,EAAE,WAAW;CAAG;AAEtE,eAAO,MAAM,QAAQ;;+CAgFpB,CAAC"}
|
|
@@ -1,59 +1,92 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
1
|
+
import { jsx as p, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { clsx as c } from "clsx";
|
|
3
|
+
import { forwardRef as j } from "react";
|
|
3
4
|
import "../../stacks/box/box.js";
|
|
4
5
|
import "../../stacks/h_collapsible_box.js";
|
|
5
6
|
import "../../stacks/h_stack.js";
|
|
6
7
|
import "../../stacks/spacer.js";
|
|
7
8
|
import "../../stacks/v_collapsible_box.js";
|
|
8
9
|
import "../../stacks/v_stack.js";
|
|
9
|
-
import { ZStack as
|
|
10
|
+
import { ZStack as D } from "../../stacks/z_stack.js";
|
|
10
11
|
import "../../utils/click_away_listener.js";
|
|
11
12
|
import "../../utils/focus_redirect.js";
|
|
12
13
|
import "../../utils/scroll_away_listener.js";
|
|
13
|
-
import { useForkRef as
|
|
14
|
+
import { useForkRef as E } from "../../utils/hooks/use_fork_ref.js";
|
|
14
15
|
import "../../utils/hooks/use_resize_observer.js";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
16
|
+
import "../../utils/dnd/context.js";
|
|
17
|
+
import "../../draggable.module-BgelQsuJ.js";
|
|
18
|
+
import { Caret as N } from "../caret/caret.js";
|
|
19
|
+
import { Portal as S } from "../portal/portal.js";
|
|
20
|
+
import { useCaretRefDimensions as F } from "./hooks/useCaretRefDimensions.js";
|
|
21
|
+
import { useTether as I } from "./hooks/useTether.js";
|
|
22
|
+
import { useTetherOrigin as V } from "./hooks/useTetherOrigin.js";
|
|
23
|
+
import '../../tethered.css';const Z = "_origin-indicator_cbc16ea", q = "_tethered_44058d8", f = { "origin-indicator": Z, tethered: q }, mt = j(
|
|
19
24
|
function({
|
|
20
|
-
anchor:
|
|
21
|
-
verticalAnchor:
|
|
22
|
-
verticalOrigin:
|
|
23
|
-
horizontalAnchor:
|
|
24
|
-
horizontalOrigin:
|
|
25
|
-
verticalOffset:
|
|
26
|
-
horizontalOffset:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
25
|
+
anchor: h,
|
|
26
|
+
verticalAnchor: n = "bottom",
|
|
27
|
+
verticalOrigin: r = "top",
|
|
28
|
+
horizontalAnchor: s = "start",
|
|
29
|
+
horizontalOrigin: o = "start",
|
|
30
|
+
verticalOffset: x = 0,
|
|
31
|
+
horizontalOffset: g = 0,
|
|
32
|
+
precision: i = "low",
|
|
33
|
+
children: l,
|
|
34
|
+
style: $,
|
|
35
|
+
className: y,
|
|
36
|
+
...R
|
|
37
|
+
}, u) {
|
|
38
|
+
const { position: t, tetherRef: w } = I({
|
|
39
|
+
anchor: h,
|
|
40
|
+
verticalAnchor: n,
|
|
41
|
+
verticalOrigin: r,
|
|
42
|
+
horizontalAnchor: s,
|
|
43
|
+
horizontalOrigin: o,
|
|
44
|
+
verticalOffset: x,
|
|
45
|
+
horizontalOffset: g
|
|
46
|
+
}), T = { x: t.left, y: t.top }, { originPosition: m, originOffset: d, containerRef: _, originDirection: e } = V(T, o, r, i), { caretElementRef: b, caretSize: a } = F(
|
|
47
|
+
i,
|
|
48
|
+
e
|
|
49
|
+
), k = E(u, w, _), C = {
|
|
41
50
|
"--tethered-top": `${t.top}px`,
|
|
42
|
-
"--tethered-left": `${t.left}px
|
|
51
|
+
"--tethered-left": `${t.left}px`,
|
|
52
|
+
"--tethered-origin-y": `${m.y}px`,
|
|
53
|
+
"--tethered-origin-x": `${m.x}px`,
|
|
54
|
+
"--tethered-origin-delta-y": `${d.yOffset}px`,
|
|
55
|
+
"--tethered-origin-delta-x": `${d.xOffset}px`,
|
|
56
|
+
"--origin-indicator-dimensions-width": `${a.width}px`,
|
|
57
|
+
"--origin-indicator-dimensions-height": `${a.height}px`
|
|
43
58
|
};
|
|
44
|
-
return /* @__PURE__ */
|
|
45
|
-
|
|
59
|
+
return /* @__PURE__ */ p(S, { children: /* @__PURE__ */ P(
|
|
60
|
+
D,
|
|
46
61
|
{
|
|
47
|
-
ref:
|
|
48
|
-
className:
|
|
49
|
-
style: {
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
ref: k,
|
|
63
|
+
className: c(f.tethered, "tcn-tethered", y),
|
|
64
|
+
style: { ...C, ...$ },
|
|
65
|
+
"data-v-anchor": n,
|
|
66
|
+
"data-h-anchor": s,
|
|
67
|
+
"data-v-origin": r,
|
|
68
|
+
"data-h-origin": o,
|
|
69
|
+
"data-anchor-direction": e,
|
|
70
|
+
...R,
|
|
71
|
+
children: [
|
|
72
|
+
l,
|
|
73
|
+
i === "high" && e !== "none" && /* @__PURE__ */ p(
|
|
74
|
+
N,
|
|
75
|
+
{
|
|
76
|
+
ref: b,
|
|
77
|
+
direction: e,
|
|
78
|
+
className: c(
|
|
79
|
+
f["origin-indicator"],
|
|
80
|
+
"tcn-tethered-origin-indicator"
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
]
|
|
52
85
|
}
|
|
53
86
|
) });
|
|
54
87
|
}
|
|
55
88
|
);
|
|
56
89
|
export {
|
|
57
|
-
|
|
90
|
+
mt as Tethered
|
|
58
91
|
};
|
|
59
92
|
//# sourceMappingURL=tethered.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tethered.js","sources":["../../../src/overlay/tethered/tethered.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"tethered.js","sources":["../../../src/overlay/tethered/tethered.tsx"],"sourcesContent":["import { clsx } from 'clsx';\nimport { forwardRef, type PropsWithChildren } from 'react';\nimport { ZStack, type ZStackProps } from '../../stacks/index.js';\nimport { useForkRef, type Rectangle } from '../../utils/index.js';\nimport { Caret } from '../caret/caret.js';\nimport { Portal } from '../portal/portal.js';\nimport { useCaretRefDimensions } from './hooks/useCaretRefDimensions.js';\nimport { useTether } from './hooks/useTether.js';\nimport { useTetherOrigin } from './hooks/useTetherOrigin.js';\nimport type { HorizontalTether, VerticalTether } from './types.js';\n\n// Styles\nimport styles from './tethered.module.css';\n\nexport interface BaseTetheredOwnProps {\n verticalAnchor?: VerticalTether;\n verticalOrigin?: VerticalTether;\n horizontalOrigin?: HorizontalTether;\n horizontalAnchor?: HorizontalTether;\n verticalOffset?: number;\n horizontalOffset?: number;\n}\n\nexport interface TetheredOwnProp extends BaseTetheredOwnProps {\n anchor: Rectangle | null;\n precision?: 'high' | 'low';\n}\nexport interface TetheredProps extends TetheredOwnProp, ZStackProps {}\n\nexport const Tethered = forwardRef<HTMLElement, PropsWithChildren<TetheredProps>>(\n function Tethered(\n {\n anchor,\n verticalAnchor = 'bottom',\n verticalOrigin = 'top',\n horizontalAnchor = 'start',\n horizontalOrigin = 'start',\n verticalOffset = 0,\n horizontalOffset = 0,\n precision = 'low',\n children,\n style,\n className,\n ...rest\n },\n ref\n ) {\n const { position, tetherRef } = useTether({\n anchor,\n verticalAnchor,\n verticalOrigin,\n horizontalAnchor,\n horizontalOrigin,\n verticalOffset,\n horizontalOffset,\n });\n\n // Convert position from { top, left } to Position type { x, y }\n const tetherPosition = { x: position.left, y: position.top };\n\n const { originPosition, originOffset, containerRef, originDirection } =\n useTetherOrigin(tetherPosition, horizontalOrigin, verticalOrigin, precision);\n\n const { caretElementRef: setCaretElement, caretSize } = useCaretRefDimensions(\n precision,\n originDirection\n );\n\n const forkedRef = useForkRef(ref, tetherRef, containerRef);\n\n const cssVariables = {\n '--tethered-top': `${position.top}px`,\n '--tethered-left': `${position.left}px`,\n '--tethered-origin-y': `${originPosition.y}px`,\n '--tethered-origin-x': `${originPosition.x}px`,\n '--tethered-origin-delta-y': `${originOffset.yOffset}px`,\n '--tethered-origin-delta-x': `${originOffset.xOffset}px`,\n '--origin-indicator-dimensions-width': `${caretSize.width}px`,\n '--origin-indicator-dimensions-height': `${caretSize.height}px`,\n };\n\n return (\n <Portal>\n <ZStack\n ref={forkedRef}\n className={clsx(styles.tethered, 'tcn-tethered', className)}\n style={{ ...cssVariables, ...style }}\n data-v-anchor={verticalAnchor}\n data-h-anchor={horizontalAnchor}\n data-v-origin={verticalOrigin}\n data-h-origin={horizontalOrigin}\n data-anchor-direction={originDirection}\n {...rest}\n >\n {children}\n {precision === 'high' && originDirection !== 'none' && (\n <Caret\n ref={setCaretElement}\n direction={originDirection}\n className={clsx(\n styles['origin-indicator'],\n 'tcn-tethered-origin-indicator'\n )}\n />\n )}\n </ZStack>\n </Portal>\n );\n }\n);\n"],"names":["Tethered","forwardRef","anchor","verticalAnchor","verticalOrigin","horizontalAnchor","horizontalOrigin","verticalOffset","horizontalOffset","precision","children","style","className","rest","ref","position","tetherRef","useTether","tetherPosition","originPosition","originOffset","containerRef","originDirection","useTetherOrigin","setCaretElement","caretSize","useCaretRefDimensions","forkedRef","useForkRef","cssVariables","Portal","jsxs","ZStack","clsx","styles","jsx","Caret"],"mappings":";;;;;;;;;;;;;;;;;;;;;;4GA6BaA,KAAWC;AAAA,EACtB,SACE;AAAA,IACE,QAAAC;AAAA,IACA,gBAAAC,IAAiB;AAAA,IACjB,gBAAAC,IAAiB;AAAA,IACjB,kBAAAC,IAAmB;AAAA,IACnB,kBAAAC,IAAmB;AAAA,IACnB,gBAAAC,IAAiB;AAAA,IACjB,kBAAAC,IAAmB;AAAA,IACnB,WAAAC,IAAY;AAAA,IACZ,UAAAC;AAAA,IACA,OAAAC;AAAA,IACA,WAAAC;AAAA,IACA,GAAGC;AAAA,EAAA,GAELC,GACA;AACA,UAAM,EAAE,UAAAC,GAAU,WAAAC,EAAA,IAAcC,EAAU;AAAA,MACxC,QAAAf;AAAA,MACA,gBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,kBAAAC;AAAA,MACA,gBAAAC;AAAA,MACA,kBAAAC;AAAA,IAAA,CACD,GAGKU,IAAiB,EAAE,GAAGH,EAAS,MAAM,GAAGA,EAAS,IAAA,GAEjD,EAAE,gBAAAI,GAAgB,cAAAC,GAAc,cAAAC,GAAc,iBAAAC,EAAA,IAClDC,EAAgBL,GAAgBZ,GAAkBF,GAAgBK,CAAS,GAEvE,EAAE,iBAAiBe,GAAiB,WAAAC,EAAA,IAAcC;AAAA,MACtDjB;AAAA,MACAa;AAAA,IAAA,GAGIK,IAAYC,EAAWd,GAAKE,GAAWK,CAAY,GAEnDQ,IAAe;AAAA,MACnB,kBAAkB,GAAGd,EAAS,GAAG;AAAA,MACjC,mBAAmB,GAAGA,EAAS,IAAI;AAAA,MACnC,uBAAuB,GAAGI,EAAe,CAAC;AAAA,MAC1C,uBAAuB,GAAGA,EAAe,CAAC;AAAA,MAC1C,6BAA6B,GAAGC,EAAa,OAAO;AAAA,MACpD,6BAA6B,GAAGA,EAAa,OAAO;AAAA,MACpD,uCAAuC,GAAGK,EAAU,KAAK;AAAA,MACzD,wCAAwC,GAAGA,EAAU,MAAM;AAAA,IAAA;AAG7D,6BACGK,GAAA,EACC,UAAA,gBAAAC;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,KAAKL;AAAA,QACL,WAAWM,EAAKC,EAAO,UAAU,gBAAgBtB,CAAS;AAAA,QAC1D,OAAO,EAAE,GAAGiB,GAAc,GAAGlB,EAAA;AAAA,QAC7B,iBAAeR;AAAA,QACf,iBAAeE;AAAA,QACf,iBAAeD;AAAA,QACf,iBAAeE;AAAA,QACf,yBAAuBgB;AAAA,QACtB,GAAGT;AAAA,QAEH,UAAA;AAAA,UAAAH;AAAA,UACAD,MAAc,UAAUa,MAAoB,UAC3C,gBAAAa;AAAA,YAACC;AAAA,YAAA;AAAA,cACC,KAAKZ;AAAA,cACL,WAAWF;AAAA,cACX,WAAWW;AAAA,gBACTC,EAAO,kBAAkB;AAAA,gBACzB;AAAA,cAAA;AAAA,YACF;AAAA,UAAA;AAAA,QACF;AAAA,MAAA;AAAA,IAAA,GAGN;AAAA,EAEJ;AACF;"}
|
package/dist/stacks/box/box.js
CHANGED
|
@@ -5,17 +5,19 @@ import "../../utils/scroll_away_listener.js";
|
|
|
5
5
|
import O, { useRef as oo } from "react";
|
|
6
6
|
import { useForkRef as ro } from "../../utils/hooks/use_fork_ref.js";
|
|
7
7
|
import "../../utils/hooks/use_resize_observer.js";
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
8
|
+
import "../../utils/dnd/context.js";
|
|
9
|
+
import { clsx as to } from "clsx";
|
|
10
|
+
import "../../draggable.module-BgelQsuJ.js";
|
|
11
|
+
import { LeftResizeHandle as ao } from "./left_resize_handle.js";
|
|
12
|
+
import { RightResizeHandle as eo } from "./right_resize_handle.js";
|
|
13
|
+
import { BottomResizeHandle as fo } from "./bottom_resize_handle.js";
|
|
14
|
+
import { EndResizeHandle as so } from "./end_resize_handle.js";
|
|
15
|
+
import { StartResizeHandle as lo } from "./start_resize_handle.js";
|
|
16
|
+
import { TopResizeHandle as mo } from "./top_resize_handle.js";
|
|
15
17
|
import { isCustomSizeProp as y } from "../utils/isCustomSizeProp.js";
|
|
16
18
|
import { removeUndefinedProperties as no } from "../utils/remove_undefined_properties.js";
|
|
17
19
|
import { s as k } from "../../stack.module-CBV1f12Z.js";
|
|
18
|
-
const
|
|
20
|
+
const Bo = O.forwardRef(function({
|
|
19
21
|
style: v,
|
|
20
22
|
className: P,
|
|
21
23
|
as: _ = "div",
|
|
@@ -47,11 +49,11 @@ const Yo = O.forwardRef(function({
|
|
|
47
49
|
enableResizeOnLeft: c = !1,
|
|
48
50
|
enableResizeOnRight: p = !1,
|
|
49
51
|
onWidthResize: e,
|
|
50
|
-
onHeightResize:
|
|
52
|
+
onHeightResize: d,
|
|
51
53
|
onWidthResizeEnd: f,
|
|
52
54
|
onHeightResizeEnd: u,
|
|
53
|
-
horizontalHandleProps:
|
|
54
|
-
verticalHandleProps:
|
|
55
|
+
horizontalHandleProps: i,
|
|
56
|
+
verticalHandleProps: x,
|
|
55
57
|
...X
|
|
56
58
|
}, Z) {
|
|
57
59
|
const $ = _, o = oo(null), L = ro(Z, o), R = l || n || c || p, T = m || s, z = R, E = T, g = z && r === "flex", S = E && t === "flex", F = !g && !S && (r === "flex" || t === "flex");
|
|
@@ -94,7 +96,7 @@ const Yo = O.forwardRef(function({
|
|
|
94
96
|
...no(W),
|
|
95
97
|
...v
|
|
96
98
|
},
|
|
97
|
-
className:
|
|
99
|
+
className: to(
|
|
98
100
|
k.box,
|
|
99
101
|
P,
|
|
100
102
|
F && "stack-flex",
|
|
@@ -105,57 +107,57 @@ const Yo = O.forwardRef(function({
|
|
|
105
107
|
children: [
|
|
106
108
|
H,
|
|
107
109
|
s && /* @__PURE__ */ a(
|
|
108
|
-
|
|
110
|
+
mo,
|
|
109
111
|
{
|
|
110
|
-
onHeightResize:
|
|
112
|
+
onHeightResize: d,
|
|
111
113
|
onHeightResizeEnd: u,
|
|
112
114
|
targetRef: o,
|
|
113
|
-
handleProps:
|
|
115
|
+
handleProps: i
|
|
114
116
|
}
|
|
115
117
|
),
|
|
116
118
|
m && /* @__PURE__ */ a(
|
|
117
|
-
|
|
119
|
+
fo,
|
|
118
120
|
{
|
|
119
|
-
onHeightResize:
|
|
121
|
+
onHeightResize: d,
|
|
120
122
|
onHeightResizeEnd: u,
|
|
121
123
|
targetRef: o,
|
|
122
|
-
handleProps:
|
|
124
|
+
handleProps: x
|
|
123
125
|
}
|
|
124
126
|
),
|
|
125
127
|
n && /* @__PURE__ */ a(
|
|
126
|
-
|
|
128
|
+
lo,
|
|
127
129
|
{
|
|
128
130
|
onWidthResize: e,
|
|
129
131
|
onWidthResizeEnd: f,
|
|
130
132
|
targetRef: o,
|
|
131
|
-
handleProps:
|
|
133
|
+
handleProps: i
|
|
132
134
|
}
|
|
133
135
|
),
|
|
134
136
|
l && /* @__PURE__ */ a(
|
|
135
|
-
|
|
137
|
+
so,
|
|
136
138
|
{
|
|
137
139
|
onWidthResize: e,
|
|
138
140
|
onWidthResizeEnd: f,
|
|
139
141
|
targetRef: o,
|
|
140
|
-
handleProps:
|
|
142
|
+
handleProps: i
|
|
141
143
|
}
|
|
142
144
|
),
|
|
143
145
|
c && /* @__PURE__ */ a(
|
|
144
|
-
|
|
146
|
+
ao,
|
|
145
147
|
{
|
|
146
148
|
onWidthResize: e,
|
|
147
149
|
onWidthResizeEnd: f,
|
|
148
150
|
targetRef: o,
|
|
149
|
-
handleProps:
|
|
151
|
+
handleProps: x
|
|
150
152
|
}
|
|
151
153
|
),
|
|
152
154
|
p && /* @__PURE__ */ a(
|
|
153
|
-
|
|
155
|
+
eo,
|
|
154
156
|
{
|
|
155
157
|
onWidthResize: e,
|
|
156
158
|
onWidthResizeEnd: f,
|
|
157
159
|
targetRef: o,
|
|
158
|
-
handleProps:
|
|
160
|
+
handleProps: x
|
|
159
161
|
}
|
|
160
162
|
)
|
|
161
163
|
]
|
|
@@ -163,6 +165,6 @@ const Yo = O.forwardRef(function({
|
|
|
163
165
|
);
|
|
164
166
|
});
|
|
165
167
|
export {
|
|
166
|
-
|
|
168
|
+
Bo as Box
|
|
167
169
|
};
|
|
168
170
|
//# sourceMappingURL=box.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"box.js","sources":["../../../src/stacks/box/box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport React, { CSSProperties, HTMLAttributes, useRef } from 'react';\nimport { LeftResizeHandle } from './left_resize_handle.js';\nimport { RightResizeHandle } from './right_resize_handle.js';\nimport { BottomResizeHandle } from './bottom_resize_handle.js';\nimport { EndResizeHandle } from './end_resize_handle.js';\nimport { StartResizeHandle } from './start_resize_handle.js';\nimport { TopResizeHandle } from './top_resize_handle.js';\nimport { clsx } from 'clsx';\nimport { isCustomSizeProp } from '../utils/isCustomSizeProp.js';\nimport { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';\nimport styles from '../stack.module.css';\nimport { HandleProps } from './handle_props.js';\n\nexport interface BoxProps extends HTMLAttributes<HTMLElement> {\n as?: string;\n style?: React.CSSProperties;\n className?: string;\n children?: React.ReactNode;\n width?: 'default' | 'flex' | 'auto' | string | number;\n minWidth?: CSSProperties['minWidth'];\n maxWidth?: CSSProperties['maxWidth'];\n height?: 'default' | 'flex' | 'auto' | string | number;\n minHeight?: CSSProperties['minHeight'];\n maxHeight?: CSSProperties['maxHeight'];\n zIndex?: number;\n padding?: CSSProperties['padding'];\n paddingInline?: CSSProperties['paddingInline'];\n paddingBlock?: CSSProperties['paddingBlock'];\n margin?: CSSProperties['margin'];\n marginBlock?: CSSProperties['marginBlock'];\n marginInline?: CSSProperties['marginInline'];\n marginInlineStart?: CSSProperties['marginInlineStart'];\n marginInlineEnd?: CSSProperties['marginInlineEnd'];\n marginTop?: CSSProperties['marginTop'];\n marginBottom?: CSSProperties['marginBottom'];\n overflow?: React.CSSProperties['overflow'];\n overflowX?: React.CSSProperties['overflowX'];\n overflowY?: React.CSSProperties['overflowY'];\n enableResizeOnTop?: boolean;\n enableResizeOnEnd?: boolean;\n enableResizeOnBottom?: boolean;\n enableResizeOnStart?: boolean;\n enableResizeOnLeft?: boolean;\n enableResizeOnRight?: boolean;\n horizontalHandleProps?: HandleProps;\n verticalHandleProps?: HandleProps;\n onWidthResize?: (\n width: number\n // origin: 'left' | 'right'\n ) => void;\n onHeightResize?: (\n height: number\n // origin: 'top' | 'bottom'\n ) => void;\n onWidthResizeEnd?: (width: number) => void;\n onHeightResizeEnd?: (width: number) => void;\n}\n\nexport const Box = React.forwardRef<HTMLElement, BoxProps>(function Box(\n {\n style,\n className,\n as = 'div',\n children,\n width = 'default',\n minWidth,\n maxWidth,\n height = 'default',\n minHeight,\n maxHeight,\n zIndex,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n enableResizeOnTop = false,\n enableResizeOnEnd = false,\n enableResizeOnBottom = false,\n enableResizeOnStart = false,\n enableResizeOnLeft = false,\n enableResizeOnRight = false,\n onWidthResize,\n onHeightResize,\n onWidthResizeEnd,\n onHeightResizeEnd,\n horizontalHandleProps,\n verticalHandleProps,\n ...otherProps\n }: BoxProps,\n ref\n) {\n const As = as as React.ElementType;\n const boxRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, boxRef);\n const hasHorizontalResize =\n enableResizeOnEnd || enableResizeOnStart || enableResizeOnLeft || enableResizeOnRight;\n const hasVerticalResize = enableResizeOnBottom || enableResizeOnTop;\n\n const cannotHorizontalFlex = hasHorizontalResize;\n const cannotVerticalFlex = hasVerticalResize;\n const warnHorizontalFlex = cannotHorizontalFlex && width === 'flex';\n const warnVerticalFlex = cannotVerticalFlex && height === 'flex';\n const isFlexing =\n !warnHorizontalFlex && !warnVerticalFlex && (width === 'flex' || height === 'flex');\n\n if (warnHorizontalFlex) {\n width = '100%';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n if (warnVerticalFlex) {\n height = 'auto';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n const propStyles = {\n width: !isCustomSizeProp(width) ? width : undefined,\n minWidth,\n maxWidth,\n height: !isCustomSizeProp(height) ? height : undefined,\n minHeight,\n maxHeight,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n zIndex,\n };\n\n return (\n <As\n data-enabled-resize-on-start={String(enableResizeOnStart)}\n data-enabled-resize-on-end={String(enableResizeOnEnd)}\n data-enabled-resize-on-top={String(enableResizeOnTop)}\n data-enabled-resize-on-bottom={String(enableResizeOnBottom)}\n data_enabled-resize-on-left={String(enableResizeOnLeft)}\n data_enabled-resize-on-right={String(enableResizeOnRight)}\n data-height={height}\n data-width={width}\n ref={forkedRef}\n style={{\n ...removeUndefinedProperties(propStyles),\n ...style,\n }}\n className={clsx(\n styles['box'],\n className,\n isFlexing && 'stack-flex',\n isFlexing && styles['stack-flex'],\n 'tcn-box'\n )}\n {...otherProps}\n >\n {children}\n {enableResizeOnTop && (\n <TopResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnBottom && (\n <BottomResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnStart && (\n <StartResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnEnd && (\n <EndResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnLeft && (\n <LeftResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnRight && (\n <RightResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n </As>\n );\n});\n"],"names":["Box","React","style","className","as","children","width","minWidth","maxWidth","height","minHeight","maxHeight","zIndex","padding","paddingInline","paddingBlock","margin","marginBlock","marginInline","marginInlineStart","marginInlineEnd","marginTop","marginBottom","overflow","overflowX","overflowY","enableResizeOnTop","enableResizeOnEnd","enableResizeOnBottom","enableResizeOnStart","enableResizeOnLeft","enableResizeOnRight","onWidthResize","onHeightResize","onWidthResizeEnd","onHeightResizeEnd","horizontalHandleProps","verticalHandleProps","otherProps","ref","As","boxRef","useRef","forkedRef","useForkRef","hasHorizontalResize","hasVerticalResize","cannotHorizontalFlex","cannotVerticalFlex","warnHorizontalFlex","warnVerticalFlex","isFlexing","propStyles","isCustomSizeProp","jsxs","removeUndefinedProperties","clsx","styles","jsx","TopResizeHandle","BottomResizeHandle","StartResizeHandle","EndResizeHandle","LeftResizeHandle","RightResizeHandle"],"mappings":";;;;;;;;;;;;;;;;;AA2DO,MAAMA,KAAMC,EAAM,WAAkC,SACzD;AAAA,EACE,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,IAAAC,IAAK;AAAA,EACL,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,UAAAC;AAAA,EACA,UAAAC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AAE;AAAA,YACA,WAAWO;AAAA,YACX,aAAaL;AAAA,UAAA;AAAA,QAAA;AAAA,QAGhBT,KACC,gBAAA+B;AAAA,UAACI;AAAA,UAAA;AAAA,YACC,eAAA9B;AAAA,YACA,kBAAAE;AAAA,YACA,WAAWO;AAAA,YACX,aAAaL;AAAA,UAAA;AAAA,QAAA;AAAA,QAGhBN,KACC,gBAAA4B;AAAA,UAACK;AAAA,UAAA;AAAA,YACC,eAAA/B;AAAA,YACA,kBAAAE;AAAA,YACA,WAAWO;AAAA,YACX,aAAaJ;AAAA,UAAA;AAAA,QAAA;AAAA,QAGhBN,KACC,gBAAA2B;AAAA,UAACM;AAAA,UAAA;AAAA,YACC,eAAAhC;AAAA,YACA,kBAAAE;AAAA,YACA,WAAWO;AAAA,YACX,aAAaJ;AAAA,UAAA;AAAA,QAAA;AAAA,MACf;AAAA,IAAA;AAAA,EAAA;AAIR,CAAC;"}
|
|
1
|
+
{"version":3,"file":"box.js","sources":["../../../src/stacks/box/box.tsx"],"sourcesContent":["import { useForkRef } from '../../utils/index.js';\nimport React, { CSSProperties, HTMLAttributes, useRef } from 'react';\nimport { LeftResizeHandle } from './left_resize_handle.js';\nimport { RightResizeHandle } from './right_resize_handle.js';\nimport { BottomResizeHandle } from './bottom_resize_handle.js';\nimport { EndResizeHandle } from './end_resize_handle.js';\nimport { StartResizeHandle } from './start_resize_handle.js';\nimport { TopResizeHandle } from './top_resize_handle.js';\nimport { clsx } from 'clsx';\nimport { isCustomSizeProp } from '../utils/isCustomSizeProp.js';\nimport { removeUndefinedProperties } from '../utils/remove_undefined_properties.js';\nimport styles from '../stack.module.css';\nimport { HandleProps } from './handle_props.js';\n\nexport interface BoxProps extends HTMLAttributes<HTMLElement> {\n as?: string;\n style?: React.CSSProperties;\n className?: string;\n children?: React.ReactNode;\n width?: 'default' | 'flex' | 'auto' | string | number;\n minWidth?: CSSProperties['minWidth'];\n maxWidth?: CSSProperties['maxWidth'];\n height?: 'default' | 'flex' | 'auto' | string | number;\n minHeight?: CSSProperties['minHeight'];\n maxHeight?: CSSProperties['maxHeight'];\n zIndex?: number;\n padding?: CSSProperties['padding'];\n paddingInline?: CSSProperties['paddingInline'];\n paddingBlock?: CSSProperties['paddingBlock'];\n margin?: CSSProperties['margin'];\n marginBlock?: CSSProperties['marginBlock'];\n marginInline?: CSSProperties['marginInline'];\n marginInlineStart?: CSSProperties['marginInlineStart'];\n marginInlineEnd?: CSSProperties['marginInlineEnd'];\n marginTop?: CSSProperties['marginTop'];\n marginBottom?: CSSProperties['marginBottom'];\n overflow?: React.CSSProperties['overflow'];\n overflowX?: React.CSSProperties['overflowX'];\n overflowY?: React.CSSProperties['overflowY'];\n enableResizeOnTop?: boolean;\n enableResizeOnEnd?: boolean;\n enableResizeOnBottom?: boolean;\n enableResizeOnStart?: boolean;\n enableResizeOnLeft?: boolean;\n enableResizeOnRight?: boolean;\n horizontalHandleProps?: HandleProps;\n verticalHandleProps?: HandleProps;\n onWidthResize?: (\n width: number\n // origin: 'left' | 'right'\n ) => void;\n onHeightResize?: (\n height: number\n // origin: 'top' | 'bottom'\n ) => void;\n onWidthResizeEnd?: (width: number) => void;\n onHeightResizeEnd?: (width: number) => void;\n}\n\nexport const Box = React.forwardRef<HTMLElement, BoxProps>(function Box(\n {\n style,\n className,\n as = 'div',\n children,\n width = 'default',\n minWidth,\n maxWidth,\n height = 'default',\n minHeight,\n maxHeight,\n zIndex,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n enableResizeOnTop = false,\n enableResizeOnEnd = false,\n enableResizeOnBottom = false,\n enableResizeOnStart = false,\n enableResizeOnLeft = false,\n enableResizeOnRight = false,\n onWidthResize,\n onHeightResize,\n onWidthResizeEnd,\n onHeightResizeEnd,\n horizontalHandleProps,\n verticalHandleProps,\n ...otherProps\n }: BoxProps,\n ref\n) {\n const As = as as React.ElementType;\n const boxRef = useRef<HTMLElement | null>(null);\n const forkedRef = useForkRef(ref, boxRef);\n const hasHorizontalResize =\n enableResizeOnEnd || enableResizeOnStart || enableResizeOnLeft || enableResizeOnRight;\n const hasVerticalResize = enableResizeOnBottom || enableResizeOnTop;\n\n const cannotHorizontalFlex = hasHorizontalResize;\n const cannotVerticalFlex = hasVerticalResize;\n const warnHorizontalFlex = cannotHorizontalFlex && width === 'flex';\n const warnVerticalFlex = cannotVerticalFlex && height === 'flex';\n const isFlexing =\n !warnHorizontalFlex && !warnVerticalFlex && (width === 'flex' || height === 'flex');\n\n if (warnHorizontalFlex) {\n width = '100%';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n if (warnVerticalFlex) {\n height = 'auto';\n // biome-ignore lint/suspicious/noConsole: Need to warn the developer\n console.warn('You cannot have a resizable box and flex simultaneously');\n }\n\n const propStyles = {\n width: !isCustomSizeProp(width) ? width : undefined,\n minWidth,\n maxWidth,\n height: !isCustomSizeProp(height) ? height : undefined,\n minHeight,\n maxHeight,\n padding,\n paddingInline,\n paddingBlock,\n margin,\n marginBlock,\n marginInline,\n marginInlineStart,\n marginInlineEnd,\n marginTop,\n marginBottom,\n overflow,\n overflowX,\n overflowY,\n zIndex,\n };\n\n return (\n <As\n data-enabled-resize-on-start={String(enableResizeOnStart)}\n data-enabled-resize-on-end={String(enableResizeOnEnd)}\n data-enabled-resize-on-top={String(enableResizeOnTop)}\n data-enabled-resize-on-bottom={String(enableResizeOnBottom)}\n data_enabled-resize-on-left={String(enableResizeOnLeft)}\n data_enabled-resize-on-right={String(enableResizeOnRight)}\n data-height={height}\n data-width={width}\n ref={forkedRef}\n style={{\n ...removeUndefinedProperties(propStyles),\n ...style,\n }}\n className={clsx(\n styles['box'],\n className,\n isFlexing && 'stack-flex',\n isFlexing && styles['stack-flex'],\n 'tcn-box'\n )}\n {...otherProps}\n >\n {children}\n {enableResizeOnTop && (\n <TopResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnBottom && (\n <BottomResizeHandle\n onHeightResize={onHeightResize}\n onHeightResizeEnd={onHeightResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnStart && (\n <StartResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnEnd && (\n <EndResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={horizontalHandleProps}\n />\n )}\n {enableResizeOnLeft && (\n <LeftResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n {enableResizeOnRight && (\n <RightResizeHandle\n onWidthResize={onWidthResize}\n onWidthResizeEnd={onWidthResizeEnd}\n targetRef={boxRef}\n handleProps={verticalHandleProps}\n />\n )}\n </As>\n );\n});\n"],"names":["Box","React","style","className","as","children","width","minWidth","maxWidth","height","minHeight","maxHeight","zIndex","padding","paddingInline","paddingBlock","margin","marginBlock","marginInline","marginInlineStart","marginInlineEnd","marginTop","marginBottom","overflow","overflowX","overflowY","enableResizeOnTop","enableResizeOnEnd","enableResizeOnBottom","enableResizeOnStart","enableResizeOnLeft","enableResizeOnRight","onWidthResize","onHeightResize","onWidthResizeEnd","onHeightResizeEnd","horizontalHandleProps","verticalHandleProps","otherProps","ref","As","boxRef","useRef","forkedRef","useForkRef","hasHorizontalResize","hasVerticalResize","cannotHorizontalFlex","cannotVerticalFlex","warnHorizontalFlex","warnVerticalFlex","isFlexing","propStyles","isCustomSizeProp","jsxs","removeUndefinedProperties","clsx","styles","jsx","TopResizeHandle","BottomResizeHandle","StartResizeHandle","EndResizeHandle","LeftResizeHand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