@smwb/ui-react 2.6.0 → 2.6.2
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/assets/styles/less/components/table/table.entry.css +1 -1
- package/dist/assets/styles/less/components/treeView/treeView.entry.css +1 -1
- package/dist/components/dataDisplay/table/tableHeadCell.js +11 -10
- package/dist/components/dataDisplay/table/tableHeadCell.js.map +1 -1
- package/dist/components/layout/floatingWindow/floatingWindow.js +174 -159
- package/dist/components/layout/floatingWindow/floatingWindow.js.map +1 -1
- package/dist/headless/components/dataDisplay/table/tableHeadCell.js +11 -10
- package/dist/headless/components/dataDisplay/table/tableHeadCell.js.map +1 -1
- package/dist/headless/components/layout/floatingWindow/floatingWindow.js +174 -159
- package/dist/headless/components/layout/floatingWindow/floatingWindow.js.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/react-table/components/dataDisplay/table/tableHeadCell.js +11 -10
- package/dist/react-table/components/dataDisplay/table/tableHeadCell.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
.smwb-table{width:100%;white-space:nowrap;border-collapse:collapse;overflow:scroll}.smwb-table.smwb-hovered tbody tr:hover{background:var(--smui-onSurfaceHover);cursor:pointer}.smwb-table__error{margin-bottom:10px}.smwb-table__container{display:flex;overflow-x:auto;border:1px solid var(--smui-tableBorderColor);border-radius:4px;flex-direction:column}.smwb-table__container.smwb-withPagination{border-radius:4px 4px 0 0}.smwb-table__wrapper{display:flex;flex-direction:column;background-color:var(--smui-surfaceBackground)}.smwb-table__wrapper_loading{pointer-events:none}.smwb-table__cell{position:relative;-webkit-line-clamp:1;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:nowrap;padding:0 16px;height:52px;vertical-align:middle;overflow:hidden;word-wrap:break-word}.smwb-table__cell.smwb-head-cell{height:56px;text-align:left;font-weight:500}.smwb-table__cell.smwb-head-cell.smwb-sortable{cursor:pointer}.smwb-table__cell.smwb-head-cell .smwb-head-cell__content{align-items:center;display:inline-flex;vertical-align:middle;gap:5px;user-select:none}.smwb-table__cell.smwb-head-cell .smwb-head-cell__content input{font-weight:500}.smwb-table__cell.smwb-head-cell.smwb-align_left{text-align:left}.smwb-table__cell.smwb-head-cell.smwb-align_center{text-align:center}.smwb-table__cell.smwb-head-cell.smwb-align_right{text-align:right}.smwb-table__cell.smwb-head-cell .smwb-head-cell__icon{flex-shrink:0;
|
|
1
|
+
.smwb-table{width:100%;white-space:nowrap;border-collapse:collapse;overflow:scroll}.smwb-table.smwb-hovered tbody tr:hover{background:var(--smui-onSurfaceHover);cursor:pointer}.smwb-table__error{margin-bottom:10px}.smwb-table__container{display:flex;overflow-x:auto;border:1px solid var(--smui-tableBorderColor);border-radius:4px;flex-direction:column}.smwb-table__container.smwb-withPagination{border-radius:4px 4px 0 0}.smwb-table__wrapper{display:flex;flex-direction:column;background-color:var(--smui-surfaceBackground)}.smwb-table__wrapper_loading{pointer-events:none}.smwb-table__cell{position:relative;-webkit-line-clamp:1;-webkit-box-orient:vertical;text-overflow:ellipsis;white-space:nowrap;padding:0 16px;height:52px;vertical-align:middle;overflow:hidden;word-wrap:break-word}.smwb-table__cell.smwb-head-cell{height:56px;text-align:left;font-weight:500}.smwb-table__cell.smwb-head-cell.smwb-sortable,.smwb-table__cell.smwb-head-cell.smwb-head-cell_sortable{cursor:pointer}.smwb-table__cell.smwb-head-cell .smwb-head-cell__content{align-items:center;display:inline-flex;vertical-align:middle;gap:5px;user-select:none}.smwb-table__cell.smwb-head-cell .smwb-head-cell__content input{font-weight:500}.smwb-table__cell.smwb-head-cell.smwb-align_left{text-align:left}.smwb-table__cell.smwb-head-cell.smwb-align_center{text-align:center}.smwb-table__cell.smwb-head-cell.smwb-align_right{text-align:right}.smwb-table__cell.smwb-head-cell .smwb-head-cell__icon{flex-shrink:0;transition:opacity .15s ease-in-out;opacity:.4}.smwb-table__cell.smwb-head-cell.smwb-head-cell_sorted .smwb-head-cell__icon,.smwb-table__cell.smwb-head-cell.smwb-head-cell_sortable:hover .smwb-head-cell__icon,.smwb-table__cell.smwb-head-cell .smwb-head-cell__content:focus-visible .smwb-head-cell__icon{opacity:1}.smwb-table__cell.smwb-head-cell.smwb-sorted_asc .smwb-head-cell__icon{opacity:1;transform:rotate(0)}.smwb-table__cell.smwb-head-cell.smwb-sorted_desc .smwb-head-cell__icon{opacity:1;transform:rotate(180deg)}.smwb-table__head .smwb-table__row{border-top:none}.smwb-table__row{border-top:1px solid var(--smui-tableBorderColor)}.smwb-table.smwb-dense .smwb-table__cell{padding:0 16px;height:36px;vertical-align:middle}.smwb-table.smwb-dense .smwb-table__cell.smwb-head-cell{height:40px}.smwb-table.smwb-dense .smwb-table__row{border-top:1px solid var(--smui-tableBorderColor)}.smwb-table__loader{width:100%;display:flex;align-items:center;justify-content:center;position:absolute;height:100%;top:50%;left:50%;transform:translate(-50%,-50%)}.smwb-table__loader__row{height:100px;position:relative}.smwb-scrollbar::-webkit-scrollbar-thumb{background-color:var(--smui-scrollThumbColor);border-radius:999px}.smwb-scrollbar::-webkit-scrollbar{width:6px;height:6px}.smwb-scrollbar::-webkit-scrollbar-track{background-color:transparent}.smwb-head-cell_sortable .smwb-head-cell__content{cursor:pointer;user-select:none;outline:none}.smwb-head-cell_sortable .smwb-head-cell__content:focus-visible{outline:2px solid var(--smui-primaryColor);outline-offset:2px}.smwb-table__row_selected{background-color:var(--smui-onSurfaceHover)}.smwb-table__caption{caption-side:top;text-align:left;padding:8px 12px;color:var(--smui-onSurfaceVariant)}.smwb-table_sticky-header{overflow:visible}.smwb-table__container:has(.smwb-table_sticky-header){overflow:visible}.smwb-table_sticky-header .smwb-table__head .smwb-table__cell{position:sticky;top:0;z-index:2;background-color:var(--smui-surfaceBackground)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.smwb-tree__wrapper .smwb-tree__node:first-child{border-left:0}.smwb-tree__wrapper .smwb-tree__node:first-child:before{opacity:0}.smwb-tree__node{padding-left:30px;margin-left:9px;position:relative;border-left:1px solid var(--smui-primaryColor)}.smwb-tree__node:last-child{border-left-color:transparent}.smwb-tree__node:before{position:absolute;top:0;left:-1px;height:20px;width:25px;border-bottom:1px solid var(--smui-primaryColor);border-left:1px solid var(--smui-primaryColor);content:"";font-weight:600;font-size:14px}.smwb-tree__node__label{position:relative;display:inline-flex;align-items:center;gap:10px}.smwb-tree__node__content{display:flex;align-items:center;gap:10px;height:40px;cursor:pointer;user-select:none}.smwb-tree__node_selected>.smwb-tree__node__content{background-color:var(--smui-onSurfaceHover);border-radius:4px}.smwb-tree__node__checkbox{flex-shrink:0;width:18px;height:18px;min-width:18px;min-height:18px;margin:0;cursor:pointer;accent-color:var(--smui-checkboxCheckedBg)}.smwb-tree__node__loading{padding:4px 8px 4px 28px;font-size:13px;color:var(--smui-onSurfaceVariant)}
|
|
1
|
+
.smwb-tree__wrapper .smwb-tree__node:first-child{border-left:0}.smwb-tree__wrapper .smwb-tree__node:first-child:before{opacity:0}.smwb-tree__node{padding-left:30px;margin-left:9px;position:relative;border-left:1px solid var(--smui-primaryColor)}.smwb-tree__node:last-child{border-left-color:transparent}.smwb-tree__node:before{position:absolute;top:0;left:-1px;height:20px;width:25px;border-bottom:1px solid var(--smui-primaryColor);border-left:1px solid var(--smui-primaryColor);content:"";font-weight:600;font-size:14px}.smwb-tree__node__label{position:relative;display:inline-flex;align-items:center;gap:10px;min-width:0;overflow-wrap:break-word}.smwb-tree__node__label>.smwb-icon__wrapper{flex:none}.smwb-tree__node__content{display:flex;align-items:center;gap:10px;min-height:40px;cursor:pointer;user-select:none}.smwb-tree__node_selected>.smwb-tree__node__content{background-color:var(--smui-onSurfaceHover);border-radius:4px}.smwb-tree__node__checkbox{flex-shrink:0;width:18px;height:18px;min-width:18px;min-height:18px;margin:0;cursor:pointer;accent-color:var(--smui-checkboxCheckedBg)}.smwb-tree__node__loading{padding:4px 8px 4px 28px;font-size:13px;color:var(--smui-onSurfaceVariant)}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as o, jsxs as
|
|
2
|
-
import
|
|
1
|
+
import { jsx as o, jsxs as h } from "react/jsx-runtime";
|
|
2
|
+
import p from "clsx";
|
|
3
3
|
import { Icon as x } from "../../base/icon/icon.js";
|
|
4
4
|
const y = ({
|
|
5
5
|
children: i,
|
|
@@ -10,21 +10,22 @@ const y = ({
|
|
|
10
10
|
sortable: e,
|
|
11
11
|
sortDirection: d,
|
|
12
12
|
onSort: s,
|
|
13
|
-
...
|
|
13
|
+
..._
|
|
14
14
|
}) => {
|
|
15
|
-
const n = d !== void 0 ? d : m ? "asc" : t ? "desc" : !1,
|
|
15
|
+
const n = d !== void 0 ? d : m ? "asc" : t ? "desc" : !1, r = e ? n === "asc" ? "ascending" : n === "desc" ? "descending" : "none" : void 0, f = n === "asc" ? "expand_more" : n === "desc" ? "expand_less" : "unfold_more", w = (c) => {
|
|
16
16
|
e && s && (c.key === "Enter" || c.key === " ") && (c.preventDefault(), s());
|
|
17
17
|
};
|
|
18
18
|
return /* @__PURE__ */ o(
|
|
19
19
|
"th",
|
|
20
20
|
{
|
|
21
|
-
...
|
|
22
|
-
"aria-sort":
|
|
23
|
-
className:
|
|
21
|
+
..._,
|
|
22
|
+
"aria-sort": r,
|
|
23
|
+
className: p("smwb-table__cell", "smwb-head-cell", l, {
|
|
24
24
|
[`smwb-align_${a}`]: !!a,
|
|
25
|
-
"smwb-head-cell_sortable": e
|
|
25
|
+
"smwb-head-cell_sortable": e,
|
|
26
|
+
"smwb-head-cell_sorted": !!e && n !== !1
|
|
26
27
|
}),
|
|
27
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ h(
|
|
28
29
|
"span",
|
|
29
30
|
{
|
|
30
31
|
className: "smwb-head-cell__content",
|
|
@@ -34,7 +35,7 @@ const y = ({
|
|
|
34
35
|
tabIndex: e ? 0 : void 0,
|
|
35
36
|
children: [
|
|
36
37
|
i,
|
|
37
|
-
/* @__PURE__ */ o(x, { name:
|
|
38
|
+
e && /* @__PURE__ */ o(x, { className: "smwb-head-cell__icon", name: f, size: 18, weight: 800 })
|
|
38
39
|
]
|
|
39
40
|
}
|
|
40
41
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tableHeadCell.js","sources":["../../../../src/components/dataDisplay/table/tableHeadCell.tsx"],"sourcesContent":["import React, { PropsWithChildren, ThHTMLAttributes } from \"react\";\nimport cn from \"clsx\";\nimport Icon from \"../../base/icon/icon\";\n\nexport type SortDirection = \"asc\" | \"desc\" | false;\n\nexport interface TableHeadCellProps extends ThHTMLAttributes<HTMLTableCellElement> {\n className?: string;\n cellAlign?: \"left\" | \"right\" | \"center\";\n /** @deprecated use `sortDirection=\"desc\"`. */\n isSortedByDesc?: boolean;\n /** @deprecated use `sortDirection=\"asc\"`. */\n isSortedByAsc?: boolean;\n /** Enables the interactive sort affordance with keyboard/aria support. */\n sortable?: boolean;\n /** Current sort direction for this column. */\n sortDirection?: SortDirection;\n /** Invoked when the user activates the sort control. */\n onSort?: () => void;\n}\n\nconst TableHeadCell = ({\n children,\n className,\n cellAlign = \"left\",\n isSortedByAsc,\n isSortedByDesc,\n sortable,\n sortDirection,\n onSort,\n ...props\n}: PropsWithChildren<TableHeadCellProps>) => {\n const direction: SortDirection =\n sortDirection !== undefined ? sortDirection : isSortedByAsc ? \"asc\" : isSortedByDesc ? \"desc\" : false;\n\n const ariaSort = sortable\n ? direction === \"asc\"\n ? \"ascending\"\n : direction === \"desc\"\n ? \"descending\"\n : \"none\"\n : undefined;\n\n const iconName = direction === \"asc\" ? \"expand_more\" : direction === \"desc\" ? \"expand_less\" : \"\";\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (sortable && onSort && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n onSort();\n }\n };\n\n return (\n <th\n {...props}\n aria-sort={ariaSort}\n className={cn(\"smwb-table__cell\", \"smwb-head-cell\", className, {\n [`smwb-align_${cellAlign}`]: !!cellAlign,\n \"smwb-head-cell_sortable\": sortable,\n })}\n >\n <span\n className=\"smwb-head-cell__content\"\n onClick={sortable ? onSort : undefined}\n onKeyDown={sortable ? onKeyDown : undefined}\n role={sortable ? \"button\" : undefined}\n tabIndex={sortable ? 0 : undefined}\n >\n {children}\n <Icon name={iconName} size={18} weight={800}
|
|
1
|
+
{"version":3,"file":"tableHeadCell.js","sources":["../../../../src/components/dataDisplay/table/tableHeadCell.tsx"],"sourcesContent":["import React, { PropsWithChildren, ThHTMLAttributes } from \"react\";\nimport cn from \"clsx\";\nimport Icon from \"../../base/icon/icon\";\n\nexport type SortDirection = \"asc\" | \"desc\" | false;\n\nexport interface TableHeadCellProps extends ThHTMLAttributes<HTMLTableCellElement> {\n className?: string;\n cellAlign?: \"left\" | \"right\" | \"center\";\n /** @deprecated use `sortDirection=\"desc\"`. */\n isSortedByDesc?: boolean;\n /** @deprecated use `sortDirection=\"asc\"`. */\n isSortedByAsc?: boolean;\n /** Enables the interactive sort affordance with keyboard/aria support. */\n sortable?: boolean;\n /** Current sort direction for this column. */\n sortDirection?: SortDirection;\n /** Invoked when the user activates the sort control. */\n onSort?: () => void;\n}\n\nconst TableHeadCell = ({\n children,\n className,\n cellAlign = \"left\",\n isSortedByAsc,\n isSortedByDesc,\n sortable,\n sortDirection,\n onSort,\n ...props\n}: PropsWithChildren<TableHeadCellProps>) => {\n const direction: SortDirection =\n sortDirection !== undefined ? sortDirection : isSortedByAsc ? \"asc\" : isSortedByDesc ? \"desc\" : false;\n\n const ariaSort = sortable\n ? direction === \"asc\"\n ? \"ascending\"\n : direction === \"desc\"\n ? \"descending\"\n : \"none\"\n : undefined;\n\n /**\n * A sortable column always shows a marker: the current direction once sorted,\n * and `unfold_more` before that — otherwise nothing tells the reader the column\n * can be sorted at all. A cell that is not sortable shows nothing; it used to\n * render an `<Icon name=\"\">`, which reserved a gap and warned about a missing\n * icon under `source: \"smwb\"`.\n */\n const iconName = direction === \"asc\" ? \"expand_more\" : direction === \"desc\" ? \"expand_less\" : \"unfold_more\";\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLSpanElement>) => {\n if (sortable && onSort && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n onSort();\n }\n };\n\n return (\n <th\n {...props}\n aria-sort={ariaSort}\n className={cn(\"smwb-table__cell\", \"smwb-head-cell\", className, {\n [`smwb-align_${cellAlign}`]: !!cellAlign,\n \"smwb-head-cell_sortable\": sortable,\n \"smwb-head-cell_sorted\": !!sortable && direction !== false,\n })}\n >\n <span\n className=\"smwb-head-cell__content\"\n onClick={sortable ? onSort : undefined}\n onKeyDown={sortable ? onKeyDown : undefined}\n role={sortable ? \"button\" : undefined}\n tabIndex={sortable ? 0 : undefined}\n >\n {children}\n {sortable && <Icon className=\"smwb-head-cell__icon\" name={iconName} size={18} weight={800} />}\n </span>\n </th>\n );\n};\n\nexport default TableHeadCell;\n"],"names":["TableHeadCell","children","className","cellAlign","isSortedByAsc","isSortedByDesc","sortable","sortDirection","onSort","props","direction","ariaSort","iconName","onKeyDown","event","jsx","cn","jsxs","Icon"],"mappings":";;;AAqBA,MAAMA,IAAgB,CAAC;AAAA,EACrB,UAAAC;AAAA,EACA,WAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,eAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,eAAAC;AAAA,EACA,QAAAC;AAAA,EACA,GAAGC;AACL,MAA6C;AAC3C,QAAMC,IACJH,MAAkB,SAAYA,IAAgBH,IAAgB,QAAQC,IAAiB,SAAS,IAE5FM,IAAWL,IACbI,MAAc,QACZ,cACAA,MAAc,SACZ,eACA,SACJ,QASEE,IAAWF,MAAc,QAAQ,gBAAgBA,MAAc,SAAS,gBAAgB,eAExFG,IAAY,CAACC,MAAgD;AACjE,IAAIR,KAAYE,MAAWM,EAAM,QAAQ,WAAWA,EAAM,QAAQ,SAChEA,EAAM,eAAA,GACNN,EAAA;AAAA,EAEJ;AAEA,SACE,gBAAAO;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAGN;AAAA,MACJ,aAAWE;AAAA,MACX,WAAWK,EAAG,oBAAoB,kBAAkBd,GAAW;AAAA,QAC7D,CAAC,cAAcC,CAAS,EAAE,GAAG,CAAC,CAACA;AAAA,QAC/B,2BAA2BG;AAAA,QAC3B,yBAAyB,CAAC,CAACA,KAAYI,MAAc;AAAA,MAAA,CACtD;AAAA,MAED,UAAA,gBAAAO;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,SAASX,IAAWE,IAAS;AAAA,UAC7B,WAAWF,IAAWO,IAAY;AAAA,UAClC,MAAMP,IAAW,WAAW;AAAA,UAC5B,UAAUA,IAAW,IAAI;AAAA,UAExB,UAAA;AAAA,YAAAL;AAAA,YACAK,KAAY,gBAAAS,EAACG,GAAA,EAAK,WAAU,wBAAuB,MAAMN,GAAU,MAAM,IAAI,QAAQ,IAAA,CAAK;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IAC7F;AAAA,EAAA;AAGN;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as s, Fragment as
|
|
1
|
+
import { jsx as s, Fragment as Ht, jsxs as T } from "react/jsx-runtime";
|
|
2
2
|
import '../../../assets/styles/less/components/floatingWindow/floatingWindow.entry.css';/* empty css */
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { createPortal as
|
|
5
|
-
import { CSSTransition as
|
|
6
|
-
import
|
|
3
|
+
import { forwardRef as Ut, useState as et, useRef as R, useId as $t, useCallback as A, useEffect as K } from "react";
|
|
4
|
+
import { createPortal as Vt } from "react-dom";
|
|
5
|
+
import { CSSTransition as Xt } from "react-transition-group";
|
|
6
|
+
import nt from "clsx";
|
|
7
7
|
import { Icon as v } from "../../base/icon/icon.js";
|
|
8
|
-
import { useControllableState as
|
|
9
|
-
import { useForkRef as
|
|
10
|
-
import { useSafeLayoutEffect as
|
|
11
|
-
const
|
|
8
|
+
import { useControllableState as O } from "../../../hooks/useControllableState.js";
|
|
9
|
+
import { useForkRef as Yt } from "../../../hooks/useForkRef.js";
|
|
10
|
+
import { useSafeLayoutEffect as Zt } from "../../../hooks/useSafeLayoutEffect.js";
|
|
11
|
+
const jt = {
|
|
12
12
|
n: { dx: 0, dy: 1, dw: 0, dh: -1 },
|
|
13
13
|
s: { dx: 0, dy: 0, dw: 0, dh: 1 },
|
|
14
14
|
e: { dx: 0, dy: 0, dw: 1, dh: 0 },
|
|
@@ -17,97 +17,112 @@ const Vt = {
|
|
|
17
17
|
nw: { dx: 1, dy: 1, dw: -1, dh: -1 },
|
|
18
18
|
se: { dx: 0, dy: 0, dw: 1, dh: 1 },
|
|
19
19
|
sw: { dx: 1, dy: 0, dw: -1, dh: 1 }
|
|
20
|
-
},
|
|
21
|
-
function(
|
|
20
|
+
}, Gt = ["n", "s", "e", "w", "ne", "nw", "se", "sw"], u = () => typeof window == "undefined" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }, qt = { x: 24, y: 24 }, Bt = { width: 360, height: 420 }, de = Ut(
|
|
21
|
+
function(ot, it) {
|
|
22
22
|
const {
|
|
23
|
-
open:
|
|
24
|
-
title:
|
|
25
|
-
headerActions:
|
|
26
|
-
position:
|
|
27
|
-
defaultPosition:
|
|
28
|
-
onPositionChange:
|
|
29
|
-
onMoveEnd:
|
|
30
|
-
size:
|
|
31
|
-
defaultSize:
|
|
32
|
-
onResize:
|
|
33
|
-
onResizeEnd:
|
|
34
|
-
minWidth:
|
|
23
|
+
open: c,
|
|
24
|
+
title: I,
|
|
25
|
+
headerActions: rt,
|
|
26
|
+
position: at,
|
|
27
|
+
defaultPosition: st = qt,
|
|
28
|
+
onPositionChange: dt,
|
|
29
|
+
onMoveEnd: f,
|
|
30
|
+
size: lt,
|
|
31
|
+
defaultSize: ct = Bt,
|
|
32
|
+
onResize: wt,
|
|
33
|
+
onResizeEnd: p,
|
|
34
|
+
minWidth: P = 200,
|
|
35
35
|
minHeight: D = 120,
|
|
36
36
|
maxWidth: a,
|
|
37
37
|
maxHeight: d,
|
|
38
|
-
keepVisible:
|
|
39
|
-
moveStep:
|
|
40
|
-
resizeStep:
|
|
41
|
-
zIndex:
|
|
42
|
-
onActivate:
|
|
43
|
-
collapsed:
|
|
44
|
-
defaultCollapsed:
|
|
45
|
-
onCollapsedChange:
|
|
46
|
-
collapsible:
|
|
47
|
-
movable:
|
|
48
|
-
resizable:
|
|
49
|
-
closeOnEsc:
|
|
50
|
-
onClose:
|
|
51
|
-
moveHandleAriaLabel:
|
|
52
|
-
resizeHandleAriaLabel:
|
|
53
|
-
closeAriaLabel:
|
|
54
|
-
collapseAriaLabel:
|
|
55
|
-
expandAriaLabel:
|
|
56
|
-
className:
|
|
57
|
-
style:
|
|
58
|
-
children:
|
|
59
|
-
...
|
|
60
|
-
} =
|
|
61
|
-
|
|
62
|
-
|
|
38
|
+
keepVisible: F = 56,
|
|
39
|
+
moveStep: ht = 24,
|
|
40
|
+
resizeStep: E = 24,
|
|
41
|
+
zIndex: H,
|
|
42
|
+
onActivate: M,
|
|
43
|
+
collapsed: ut,
|
|
44
|
+
defaultCollapsed: ft = !1,
|
|
45
|
+
onCollapsedChange: pt,
|
|
46
|
+
collapsible: mt = !0,
|
|
47
|
+
movable: gt = !0,
|
|
48
|
+
resizable: yt = !0,
|
|
49
|
+
closeOnEsc: U = !1,
|
|
50
|
+
onClose: _,
|
|
51
|
+
moveHandleAriaLabel: xt = "Move window",
|
|
52
|
+
resizeHandleAriaLabel: bt = "Resize window",
|
|
53
|
+
closeAriaLabel: Pt = "Close window",
|
|
54
|
+
collapseAriaLabel: _t = "Collapse window",
|
|
55
|
+
expandAriaLabel: Rt = "Expand window",
|
|
56
|
+
className: Dt,
|
|
57
|
+
style: S,
|
|
58
|
+
children: Mt,
|
|
59
|
+
...Ct
|
|
60
|
+
} = ot, [$, kt] = et(), C = R(null), zt = Yt(it, C), V = $t();
|
|
61
|
+
Zt(() => {
|
|
62
|
+
kt(document.body);
|
|
63
63
|
}, []);
|
|
64
|
-
const [
|
|
65
|
-
value: ot,
|
|
66
|
-
defaultValue: it,
|
|
67
|
-
onChange: rt
|
|
68
|
-
}), [p, X] = K({
|
|
64
|
+
const [m, X] = O({
|
|
69
65
|
value: at,
|
|
70
66
|
defaultValue: st,
|
|
71
67
|
onChange: dt
|
|
72
|
-
}), [
|
|
73
|
-
value:
|
|
74
|
-
defaultValue:
|
|
75
|
-
onChange:
|
|
76
|
-
}),
|
|
68
|
+
}), [g, Y] = O({
|
|
69
|
+
value: lt,
|
|
70
|
+
defaultValue: ct,
|
|
71
|
+
onChange: wt
|
|
72
|
+
}), [w, At] = O({
|
|
73
|
+
value: ut,
|
|
74
|
+
defaultValue: ft,
|
|
75
|
+
onChange: pt
|
|
76
|
+
}), y = A(
|
|
77
77
|
(t, e) => {
|
|
78
|
-
const n = a != null ? a : e.width, i = d != null ? d : e.height, o = Math.max(
|
|
79
|
-
return { x:
|
|
78
|
+
const n = a != null ? a : e.width, i = d != null ? d : e.height, o = Math.max(P, Math.min(n, t.width)), r = Math.max(D, Math.min(i, t.height)), b = Math.min(F, o), L = Math.max(b - o, Math.min(e.width - b, t.x)), N = Math.max(0, Math.min(Math.max(0, e.height - b), t.y));
|
|
79
|
+
return { x: L, y: N, width: o, height: r };
|
|
80
80
|
},
|
|
81
|
-
[
|
|
82
|
-
),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
[F, d, a, D, P]
|
|
82
|
+
), It = A(
|
|
83
|
+
(t, e) => {
|
|
84
|
+
const n = y(t, e);
|
|
85
|
+
return {
|
|
86
|
+
...n,
|
|
87
|
+
x: Math.max(0, Math.min(n.x, e.width - n.width)),
|
|
88
|
+
y: Math.max(0, Math.min(n.y, e.height - n.height))
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
[y]
|
|
92
|
+
), [Et, Z] = et(!1);
|
|
93
|
+
K(() => {
|
|
94
|
+
c || Z(!1);
|
|
95
|
+
}, [c]);
|
|
96
|
+
const j = { x: m.x, y: m.y, width: g.width, height: g.height }, h = Et ? y(j, u()) : It(j, u()), l = R(h);
|
|
97
|
+
l.current = h;
|
|
98
|
+
const x = A(
|
|
99
|
+
(t, e = !0) => {
|
|
100
|
+
e && Z(!0);
|
|
101
|
+
const n = y(t, u());
|
|
102
|
+
(n.x !== m.x || n.y !== m.y) && X({ x: n.x, y: n.y }), (n.width !== g.width || n.height !== g.height) && Y({ width: n.width, height: n.height });
|
|
88
103
|
},
|
|
89
|
-
[
|
|
90
|
-
),
|
|
91
|
-
|
|
92
|
-
if (!
|
|
93
|
-
const t = () =>
|
|
104
|
+
[y, m.x, m.y, X, Y, g.height, g.width]
|
|
105
|
+
), G = R(x);
|
|
106
|
+
G.current = x, K(() => {
|
|
107
|
+
if (!c) return;
|
|
108
|
+
const t = () => G.current(l.current, !1);
|
|
94
109
|
return window.addEventListener("resize", t), () => window.removeEventListener("resize", t);
|
|
95
|
-
}, [
|
|
96
|
-
if (!
|
|
110
|
+
}, [c]), K(() => {
|
|
111
|
+
if (!c || !U || !_) return;
|
|
97
112
|
const t = (e) => {
|
|
98
113
|
if (e.key !== "Escape") return;
|
|
99
114
|
const n = C.current;
|
|
100
|
-
!n || !n.contains(document.activeElement) ||
|
|
115
|
+
!n || !n.contains(document.activeElement) || _();
|
|
101
116
|
};
|
|
102
117
|
return document.addEventListener("keydown", t), () => document.removeEventListener("keydown", t);
|
|
103
|
-
}, [
|
|
104
|
-
const
|
|
105
|
-
|
|
118
|
+
}, [U, _, c]);
|
|
119
|
+
const q = A(() => {
|
|
120
|
+
M == null || M();
|
|
106
121
|
const t = C.current;
|
|
107
122
|
t && !t.contains(document.activeElement) && t.focus({ preventScroll: !0 });
|
|
108
|
-
}, [
|
|
123
|
+
}, [M]), k = R(null), St = (t) => {
|
|
109
124
|
var n, i, o;
|
|
110
|
-
if (!
|
|
125
|
+
if (!gt || (n = t.target) != null && n.closest("button,[data-no-drag]")) return;
|
|
111
126
|
t.preventDefault();
|
|
112
127
|
const e = l.current;
|
|
113
128
|
k.current = { px: t.clientX, py: t.clientY, x: e.x, y: e.y };
|
|
@@ -115,51 +130,51 @@ const Vt = {
|
|
|
115
130
|
(o = (i = t.currentTarget).setPointerCapture) == null || o.call(i, t.pointerId);
|
|
116
131
|
} catch {
|
|
117
132
|
}
|
|
118
|
-
},
|
|
133
|
+
}, Lt = (t) => {
|
|
119
134
|
const e = k.current;
|
|
120
|
-
e &&
|
|
135
|
+
e && x({
|
|
121
136
|
...l.current,
|
|
122
137
|
x: e.x + t.clientX - e.px,
|
|
123
138
|
y: e.y + t.clientY - e.py
|
|
124
139
|
});
|
|
125
|
-
},
|
|
140
|
+
}, B = (t) => {
|
|
126
141
|
var e, n, i, o;
|
|
127
142
|
if (k.current) {
|
|
128
143
|
k.current = null;
|
|
129
144
|
const r = l.current;
|
|
130
|
-
|
|
145
|
+
f == null || f({ x: r.x, y: r.y });
|
|
131
146
|
}
|
|
132
147
|
(n = (e = t.currentTarget).hasPointerCapture) != null && n.call(e, t.pointerId) && ((o = (i = t.currentTarget).releasePointerCapture) == null || o.call(i, t.pointerId));
|
|
133
|
-
}, z =
|
|
148
|
+
}, z = R(null), Nt = (t, e) => {
|
|
134
149
|
var n, i;
|
|
135
|
-
e.preventDefault(), e.stopPropagation(), z.current = { dir: t, px: e.clientX, py: e.clientY, rect: l.current },
|
|
150
|
+
e.preventDefault(), e.stopPropagation(), z.current = { dir: t, px: e.clientX, py: e.clientY, rect: l.current }, q();
|
|
136
151
|
try {
|
|
137
152
|
(i = (n = e.currentTarget).setPointerCapture) == null || i.call(n, e.pointerId);
|
|
138
153
|
} catch {
|
|
139
154
|
}
|
|
140
|
-
},
|
|
155
|
+
}, Tt = (t) => {
|
|
141
156
|
const e = z.current;
|
|
142
157
|
if (!e) return;
|
|
143
|
-
const n =
|
|
144
|
-
|
|
145
|
-
x: n.dx ? r.x + r.width -
|
|
146
|
-
y: n.dy ? r.y + r.height -
|
|
147
|
-
width:
|
|
148
|
-
height:
|
|
158
|
+
const n = jt[e.dir], i = t.clientX - e.px, o = t.clientY - e.py, r = e.rect, b = u(), L = a != null ? a : b.width, N = d != null ? d : b.height, W = Math.min(L, Math.max(P, r.width + n.dw * i)), tt = Math.min(N, Math.max(D, r.height + n.dh * o));
|
|
159
|
+
x({
|
|
160
|
+
x: n.dx ? r.x + r.width - W : r.x,
|
|
161
|
+
y: n.dy ? r.y + r.height - tt : r.y,
|
|
162
|
+
width: W,
|
|
163
|
+
height: tt
|
|
149
164
|
});
|
|
150
|
-
},
|
|
165
|
+
}, J = (t) => {
|
|
151
166
|
var e, n, i, o;
|
|
152
167
|
if (z.current) {
|
|
153
168
|
z.current = null;
|
|
154
169
|
const r = l.current;
|
|
155
|
-
|
|
170
|
+
p == null || p({ width: r.width, height: r.height });
|
|
156
171
|
}
|
|
157
172
|
(n = (e = t.currentTarget).hasPointerCapture) != null && n.call(e, t.pointerId) && ((o = (i = t.currentTarget).releasePointerCapture) == null || o.call(i, t.pointerId));
|
|
158
|
-
},
|
|
159
|
-
const n =
|
|
160
|
-
t ?
|
|
161
|
-
},
|
|
162
|
-
const e = l.current, n = t.shiftKey ?
|
|
173
|
+
}, Q = (t, e) => {
|
|
174
|
+
const n = y(e, u());
|
|
175
|
+
t ? p == null || p({ width: n.width, height: n.height }) : f == null || f({ x: n.x, y: n.y });
|
|
176
|
+
}, Kt = (t) => {
|
|
177
|
+
const e = l.current, n = t.shiftKey ? E : ht, o = {
|
|
163
178
|
ArrowLeft: [-n, 0],
|
|
164
179
|
ArrowRight: [n, 0],
|
|
165
180
|
ArrowUp: [0, -n],
|
|
@@ -168,69 +183,69 @@ const Vt = {
|
|
|
168
183
|
if (!o) return;
|
|
169
184
|
t.preventDefault();
|
|
170
185
|
const r = t.shiftKey ? { ...e, width: e.width + o[0], height: e.height + o[1] } : { ...e, x: e.x + o[0], y: e.y + o[1] };
|
|
171
|
-
|
|
172
|
-
},
|
|
173
|
-
const e = l.current, n =
|
|
186
|
+
x(r), Q(t.shiftKey, r);
|
|
187
|
+
}, vt = (t) => {
|
|
188
|
+
const e = l.current, n = u();
|
|
174
189
|
let i;
|
|
175
190
|
if (t.key === "ArrowLeft" || t.key === "ArrowRight") {
|
|
176
191
|
t.preventDefault();
|
|
177
192
|
const o = t.key === "ArrowRight" ? 1 : -1;
|
|
178
|
-
i = { ...e, width: e.width + o *
|
|
193
|
+
i = { ...e, width: e.width + o * E };
|
|
179
194
|
} else if (t.key === "ArrowUp" || t.key === "ArrowDown") {
|
|
180
195
|
t.preventDefault();
|
|
181
196
|
const o = t.key === "ArrowDown" ? 1 : -1;
|
|
182
|
-
i = { ...e, height: e.height + o *
|
|
197
|
+
i = { ...e, height: e.height + o * E };
|
|
183
198
|
} else if (t.key === "Home")
|
|
184
|
-
t.preventDefault(), i = { ...e, width:
|
|
199
|
+
t.preventDefault(), i = { ...e, width: P, height: D };
|
|
185
200
|
else if (t.key === "End")
|
|
186
201
|
t.preventDefault(), i = { ...e, width: a != null ? a : n.width, height: d != null ? d : n.height };
|
|
187
202
|
else
|
|
188
203
|
return;
|
|
189
|
-
|
|
190
|
-
},
|
|
191
|
-
if (
|
|
192
|
-
return /* @__PURE__ */ s(
|
|
193
|
-
const
|
|
194
|
-
left: `${
|
|
195
|
-
top: `${
|
|
196
|
-
width: `${
|
|
197
|
-
...
|
|
198
|
-
...
|
|
199
|
-
...
|
|
204
|
+
x(i), Q(!0, i);
|
|
205
|
+
}, Ot = () => At((t) => !t);
|
|
206
|
+
if (!$)
|
|
207
|
+
return /* @__PURE__ */ s(Ht, {});
|
|
208
|
+
const Ft = {
|
|
209
|
+
left: `${h.x}px`,
|
|
210
|
+
top: `${h.y}px`,
|
|
211
|
+
width: `${h.width}px`,
|
|
212
|
+
...w ? {} : { height: `${h.height}px` },
|
|
213
|
+
...H === void 0 ? {} : { zIndex: H },
|
|
214
|
+
...S != null ? S : {}
|
|
200
215
|
};
|
|
201
|
-
return
|
|
216
|
+
return Vt(
|
|
202
217
|
/* @__PURE__ */ s(
|
|
203
|
-
|
|
218
|
+
Xt,
|
|
204
219
|
{
|
|
205
|
-
in:
|
|
220
|
+
in: c,
|
|
206
221
|
timeout: 120,
|
|
207
222
|
mountOnEnter: !0,
|
|
208
223
|
unmountOnExit: !0,
|
|
209
224
|
appear: !0,
|
|
210
225
|
classNames: { enterDone: "smwb-floating-window_entered" },
|
|
211
226
|
nodeRef: C,
|
|
212
|
-
children: /* @__PURE__ */
|
|
227
|
+
children: /* @__PURE__ */ T(
|
|
213
228
|
"div",
|
|
214
229
|
{
|
|
215
|
-
...
|
|
216
|
-
ref:
|
|
230
|
+
...Ct,
|
|
231
|
+
ref: zt,
|
|
217
232
|
"data-testid": "floating-window",
|
|
218
233
|
role: "dialog",
|
|
219
234
|
tabIndex: -1,
|
|
220
|
-
"aria-labelledby":
|
|
221
|
-
className:
|
|
222
|
-
style:
|
|
223
|
-
onPointerDown:
|
|
235
|
+
"aria-labelledby": I ? V : void 0,
|
|
236
|
+
className: nt("smwb-floating-window", Dt, { "smwb-collapsed": w }),
|
|
237
|
+
style: Ft,
|
|
238
|
+
onPointerDown: q,
|
|
224
239
|
children: [
|
|
225
|
-
/* @__PURE__ */
|
|
240
|
+
/* @__PURE__ */ T(
|
|
226
241
|
"div",
|
|
227
242
|
{
|
|
228
243
|
className: "smwb-floating-window__header",
|
|
229
244
|
"data-testid": "floating-window-header",
|
|
230
|
-
onPointerDown:
|
|
231
|
-
onPointerMove:
|
|
232
|
-
onPointerUp:
|
|
233
|
-
onPointerCancel:
|
|
245
|
+
onPointerDown: St,
|
|
246
|
+
onPointerMove: Lt,
|
|
247
|
+
onPointerUp: B,
|
|
248
|
+
onPointerCancel: B,
|
|
234
249
|
children: [
|
|
235
250
|
/* @__PURE__ */ s(
|
|
236
251
|
"span",
|
|
@@ -239,34 +254,34 @@ const Vt = {
|
|
|
239
254
|
"data-testid": "floating-window-move",
|
|
240
255
|
role: "button",
|
|
241
256
|
tabIndex: 0,
|
|
242
|
-
"aria-label":
|
|
243
|
-
onKeyDown:
|
|
257
|
+
"aria-label": xt,
|
|
258
|
+
onKeyDown: Kt,
|
|
244
259
|
children: /* @__PURE__ */ s(v, { name: "drag_indicator" })
|
|
245
260
|
}
|
|
246
261
|
),
|
|
247
|
-
|
|
248
|
-
/* @__PURE__ */
|
|
249
|
-
|
|
250
|
-
|
|
262
|
+
I ? /* @__PURE__ */ s("span", { className: "smwb-floating-window__title", id: V, children: I }) : null,
|
|
263
|
+
/* @__PURE__ */ T("div", { className: "smwb-floating-window__actions", "data-no-drag": !0, children: [
|
|
264
|
+
rt,
|
|
265
|
+
mt ? /* @__PURE__ */ s(
|
|
251
266
|
"button",
|
|
252
267
|
{
|
|
253
268
|
type: "button",
|
|
254
269
|
className: "smwb-floating-window__action",
|
|
255
270
|
"data-testid": "floating-window-collapse",
|
|
256
|
-
"aria-label":
|
|
257
|
-
"aria-expanded": !
|
|
258
|
-
onClick:
|
|
259
|
-
children: /* @__PURE__ */ s(v, { name:
|
|
271
|
+
"aria-label": w ? Rt : _t,
|
|
272
|
+
"aria-expanded": !w,
|
|
273
|
+
onClick: Ot,
|
|
274
|
+
children: /* @__PURE__ */ s(v, { name: w ? "open_in_full" : "close_fullscreen" })
|
|
260
275
|
}
|
|
261
276
|
) : null,
|
|
262
|
-
|
|
277
|
+
_ ? /* @__PURE__ */ s(
|
|
263
278
|
"button",
|
|
264
279
|
{
|
|
265
280
|
type: "button",
|
|
266
281
|
className: "smwb-floating-window__action",
|
|
267
282
|
"data-testid": "floating-window-close",
|
|
268
|
-
"aria-label":
|
|
269
|
-
onClick:
|
|
283
|
+
"aria-label": Pt,
|
|
284
|
+
onClick: _,
|
|
270
285
|
children: /* @__PURE__ */ s(v, { name: "close" })
|
|
271
286
|
}
|
|
272
287
|
) : null
|
|
@@ -274,25 +289,25 @@ const Vt = {
|
|
|
274
289
|
]
|
|
275
290
|
}
|
|
276
291
|
),
|
|
277
|
-
|
|
278
|
-
|
|
292
|
+
w ? null : /* @__PURE__ */ s("div", { className: "smwb-floating-window__body", "data-testid": "floating-window-body", children: Mt }),
|
|
293
|
+
yt && !w ? Gt.map((t) => /* @__PURE__ */ s(
|
|
279
294
|
"div",
|
|
280
295
|
{
|
|
281
|
-
className:
|
|
296
|
+
className: nt("smwb-floating-window__resize", `smwb-floating-window__resize_${t}`),
|
|
282
297
|
"data-testid": `floating-window-resize-${t}`,
|
|
283
298
|
...t === "se" ? {
|
|
284
299
|
role: "separator",
|
|
285
300
|
tabIndex: 0,
|
|
286
|
-
"aria-label":
|
|
287
|
-
"aria-valuemin":
|
|
288
|
-
"aria-valuemax": Math.round(a != null ? a :
|
|
289
|
-
"aria-valuenow": Math.round(
|
|
290
|
-
onKeyDown:
|
|
301
|
+
"aria-label": bt,
|
|
302
|
+
"aria-valuemin": P,
|
|
303
|
+
"aria-valuemax": Math.round(a != null ? a : u().width),
|
|
304
|
+
"aria-valuenow": Math.round(h.width),
|
|
305
|
+
onKeyDown: vt
|
|
291
306
|
} : { "aria-hidden": !0, tabIndex: -1 },
|
|
292
|
-
onPointerDown: (e) =>
|
|
293
|
-
onPointerMove:
|
|
294
|
-
onPointerUp:
|
|
295
|
-
onPointerCancel:
|
|
307
|
+
onPointerDown: (e) => Nt(t, e),
|
|
308
|
+
onPointerMove: Tt,
|
|
309
|
+
onPointerUp: J,
|
|
310
|
+
onPointerCancel: J
|
|
296
311
|
},
|
|
297
312
|
t
|
|
298
313
|
)) : null
|
|
@@ -301,11 +316,11 @@ const Vt = {
|
|
|
301
316
|
)
|
|
302
317
|
}
|
|
303
318
|
),
|
|
304
|
-
|
|
319
|
+
$
|
|
305
320
|
);
|
|
306
321
|
}
|
|
307
322
|
);
|
|
308
323
|
export {
|
|
309
|
-
|
|
324
|
+
de as FloatingWindow
|
|
310
325
|
};
|
|
311
326
|
//# sourceMappingURL=floatingWindow.js.map
|