@kwiz/fluentui 1.0.21 → 1.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/.github/workflows/npm-publish.yml +4 -15
- package/dist/_modules/config.d.ts +1 -0
- package/dist/_modules/config.js +9 -0
- package/dist/_modules/config.js.map +1 -0
- package/dist/_modules/constants.d.ts +2 -0
- package/dist/_modules/constants.js +3 -0
- package/dist/_modules/constants.js.map +1 -0
- package/dist/controls/accordion.d.ts +13 -0
- package/dist/controls/accordion.js +27 -0
- package/dist/controls/accordion.js.map +1 -0
- package/dist/controls/button.d.ts +28 -0
- package/dist/controls/button.js +113 -0
- package/dist/controls/button.js.map +1 -0
- package/dist/controls/centered.d.ts +5 -0
- package/dist/controls/centered.js +14 -0
- package/dist/controls/centered.js.map +1 -0
- package/dist/controls/date.d.ts +8 -0
- package/dist/controls/date.js +32 -0
- package/dist/controls/date.js.map +1 -0
- package/dist/controls/dropdown.d.ts +36 -0
- package/dist/controls/dropdown.js +35 -0
- package/dist/controls/dropdown.js.map +1 -0
- package/dist/controls/error-boundary.d.ts +23 -0
- package/dist/controls/error-boundary.js +33 -0
- package/dist/controls/error-boundary.js.map +1 -0
- package/dist/controls/field-editor.d.ts +13 -0
- package/dist/controls/field-editor.js +15 -0
- package/dist/controls/field-editor.js.map +1 -0
- package/dist/controls/file-upload.d.ts +18 -0
- package/dist/controls/file-upload.js +41 -0
- package/dist/controls/file-upload.js.map +1 -0
- package/dist/controls/horizontal.d.ts +8 -0
- package/dist/controls/horizontal.js +23 -0
- package/dist/controls/horizontal.js.map +1 -0
- package/dist/controls/input.d.ts +13 -0
- package/dist/controls/input.js +43 -0
- package/dist/controls/input.js.map +1 -0
- package/dist/controls/kwizoverflow.d.ts +14 -0
- package/dist/controls/kwizoverflow.js +45 -0
- package/dist/controls/kwizoverflow.js.map +1 -0
- package/dist/controls/list.d.ts +21 -0
- package/dist/controls/list.js +72 -0
- package/dist/controls/list.js.map +1 -0
- package/dist/controls/loading.d.ts +5 -0
- package/dist/controls/loading.js +7 -0
- package/dist/controls/loading.js.map +1 -0
- package/dist/controls/please-wait.d.ts +18 -0
- package/dist/controls/please-wait.js +16 -0
- package/dist/controls/please-wait.js.map +1 -0
- package/dist/controls/prompt.d.ts +32 -0
- package/dist/controls/prompt.js +31 -0
- package/dist/controls/prompt.js.map +1 -0
- package/dist/controls/search.d.ts +13 -0
- package/dist/controls/search.js +47 -0
- package/dist/controls/search.js.map +1 -0
- package/dist/controls/section.d.ts +14 -0
- package/dist/controls/section.js +27 -0
- package/dist/controls/section.js.map +1 -0
- package/dist/controls/svg.d.ts +23 -0
- package/dist/controls/svg.js +45 -0
- package/dist/controls/svg.js.map +1 -0
- package/dist/controls/toolbar.d.ts +12 -0
- package/dist/controls/toolbar.js +23 -0
- package/dist/controls/toolbar.js.map +1 -0
- package/dist/controls/vertical-content.d.ts +6 -0
- package/dist/controls/vertical-content.js +37 -0
- package/dist/controls/vertical-content.js.map +1 -0
- package/dist/controls/vertical.d.ts +8 -0
- package/dist/controls/vertical.js +23 -0
- package/dist/controls/vertical.js.map +1 -0
- package/dist/helpers/context.d.ts +26 -0
- package/dist/helpers/context.js +15 -0
- package/dist/helpers/context.js.map +1 -0
- package/dist/helpers/drag-drop/drag-drop-container.d.ts +15 -0
- package/dist/helpers/drag-drop/drag-drop-container.js +13 -0
- package/dist/helpers/drag-drop/drag-drop-container.js.map +1 -0
- package/dist/helpers/drag-drop/drag-drop-context.d.ts +30 -0
- package/dist/helpers/drag-drop/drag-drop-context.js +47 -0
- package/dist/helpers/drag-drop/drag-drop-context.js.map +1 -0
- package/dist/helpers/drag-drop/exports.d.ts +4 -0
- package/dist/helpers/drag-drop/exports.js +3 -0
- package/dist/helpers/drag-drop/exports.js.map +1 -0
- package/dist/helpers/drag-drop/use-draggable.d.ts +13 -0
- package/dist/helpers/drag-drop/use-draggable.js +33 -0
- package/dist/helpers/drag-drop/use-draggable.js.map +1 -0
- package/dist/helpers/drag-drop/use-droppable.d.ts +14 -0
- package/dist/helpers/drag-drop/use-droppable.js +28 -0
- package/dist/helpers/drag-drop/use-droppable.js.map +1 -0
- package/dist/helpers/hooks.d.ts +62 -0
- package/dist/helpers/hooks.js +287 -0
- package/dist/helpers/hooks.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/styles/styles.d.ts +19 -0
- package/dist/styles/styles.js +79 -0
- package/dist/styles/styles.js.map +1 -0
- package/dist/styles/theme.d.ts +6 -0
- package/dist/styles/theme.js +77 -0
- package/dist/styles/theme.js.map +1 -0
- package/package.json +3 -1
- package/src/controls/dropdown.tsx +33 -28
- package/src/helpers/drag-drop/drag-drop-container.tsx +47 -0
- package/src/helpers/drag-drop/drag-drop-context.tsx +67 -0
- package/src/helpers/drag-drop/exports.ts +4 -0
- package/src/helpers/drag-drop/readme.md +76 -0
- package/src/helpers/drag-drop/use-draggable.ts +56 -0
- package/src/helpers/drag-drop/use-droppable.ts +48 -0
- package/src/index.ts +1 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Toolbar, ToolbarDivider, ToolbarGroup } from '@fluentui/react-components';
|
3
|
+
import { useCommonStyles } from '../styles/styles';
|
4
|
+
import { KWIZOverflow } from './kwizoverflow';
|
5
|
+
export const ToolbarEX = (props) => {
|
6
|
+
const commonCssNames = useCommonStyles();
|
7
|
+
let elements = [];
|
8
|
+
props.buttonGroups.forEach((group, groupIndex) => {
|
9
|
+
group.forEach((button, buttonIndex) => {
|
10
|
+
const mapped = Object.assign(Object.assign({}, button), { id: `m${groupIndex}-${buttonIndex}` });
|
11
|
+
if (buttonIndex === 0 && groupIndex > 0 && props.buttonGroups[groupIndex - 1].length > 0) {
|
12
|
+
//first button, not first group, and previous group was not empty
|
13
|
+
//add divider
|
14
|
+
mapped.overflowElement = mapped.overflowElement || mapped.elm;
|
15
|
+
//this way if button rendes it is with the divider, but if it is in overflow - there will be no divider
|
16
|
+
mapped.elm = _jsxs("span", { children: [_jsx(ToolbarDivider, { style: { display: 'inline-flex' } }), mapped.elm] });
|
17
|
+
}
|
18
|
+
elements.push(mapped);
|
19
|
+
});
|
20
|
+
});
|
21
|
+
return (_jsx(KWIZOverflow, { className: commonCssNames.printHide, items: elements, getKey: e => e.id, renderItem: (e, i, overflow) => overflow && e.overflowElement || e.elm, getPriority: e => e.priority || -1, groupWrapper: children => _jsxs(Toolbar, { "aria-label": "Default", style: { justifyContent: "space-between" }, children: [_jsx(ToolbarGroup, { role: "presentation", children: children }), _jsx(ToolbarGroup, { role: "presentation", children: props.sideButtons })] }) }));
|
22
|
+
};
|
23
|
+
//# sourceMappingURL=toolbar.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"toolbar.js","sourceRoot":"","sources":["../../src/controls/toolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAQ9C,MAAM,CAAC,MAAM,SAAS,GAAoC,CAAC,KAAK,EAAE,EAAE;IAChE,MAAM,cAAc,GAAG,eAAe,EAAE,CAAC;IAEzC,IAAI,QAAQ,GAAyF,EAAE,CAAC;IACxG,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE;YAClC,MAAM,MAAM,mCAAQ,MAAM,KAAE,EAAE,EAAE,IAAI,UAAU,IAAI,WAAW,EAAE,GAAE,CAAC;YAClE,IAAI,WAAW,KAAK,CAAC,IAAI,UAAU,GAAG,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACvF,iEAAiE;gBACjE,aAAa;gBACb,MAAM,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,IAAI,MAAM,CAAC,GAAG,CAAC;gBAC9D,uGAAuG;gBACvG,MAAM,CAAC,GAAG,GAAG,2BACT,KAAC,cAAc,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE,GAAI,EACpD,MAAM,CAAC,GAAG,IACR,CAAC;YAEZ,CAAC;YACD,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,CAAC;IAEH,OAAO,CACH,KAAC,YAAY,IAAC,SAAS,EAAE,cAAc,CAAC,SAAS,EAC7C,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EACjB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,CAAC,QAAQ,IAAI,CAAC,CAAC,eAAe,IAAI,CAAC,CAAC,GAAG,EACtE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,EAClC,YAAY,EAAE,QAAQ,CAAC,EAAE,CAAC,MAAC,OAAO,kBAAY,SAAS,EAAC,KAAK,EAAE,EAAE,cAAc,EAAE,eAAe,EAAE,aAC9F,KAAC,YAAY,IAAC,IAAI,EAAC,cAAc,YAC5B,QAAQ,GACE,EACf,KAAC,YAAY,IAAC,IAAI,EAAC,cAAc,YAC5B,KAAK,CAAC,WAAW,GACP,IACT,GACZ,CAAC,CAAC;AACZ,CAAC,CAAA"}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { makeStyles, mergeClasses } from '@fluentui/react-components';
|
3
|
+
import { isNotEmptyArray } from '@kwiz/common';
|
4
|
+
import React from 'react';
|
5
|
+
import { useWindowSize } from '../helpers/hooks';
|
6
|
+
const useStyles = makeStyles({
|
7
|
+
verticalContainer: {
|
8
|
+
position: "relative",
|
9
|
+
['& > div']: {
|
10
|
+
position: "absolute",
|
11
|
+
transform: "rotate(90deg)"
|
12
|
+
}
|
13
|
+
}
|
14
|
+
});
|
15
|
+
export const VerticalContent = (props) => {
|
16
|
+
const classes = useStyles();
|
17
|
+
let css = [classes.verticalContainer];
|
18
|
+
const size = useWindowSize();
|
19
|
+
let div = React.useRef();
|
20
|
+
let rotate = React.useRef();
|
21
|
+
if (isNotEmptyArray(props.css))
|
22
|
+
css.push(...props.css);
|
23
|
+
React.useEffect(() => {
|
24
|
+
if (div.current && rotate.current) {
|
25
|
+
let rootDiv = div.current;
|
26
|
+
let rotateDiv = rotate.current;
|
27
|
+
rootDiv.style.height = `${rotateDiv.clientWidth}px`;
|
28
|
+
rootDiv.style.width = `${rotateDiv.clientHeight}px`;
|
29
|
+
rootDiv.style.minHeight = `${rotateDiv.clientWidth}px`;
|
30
|
+
rootDiv.style.minWidth = `${rotateDiv.clientHeight}px`;
|
31
|
+
rotateDiv.style.top = `${(rotateDiv.clientWidth - rotateDiv.clientHeight) / 2}px`;
|
32
|
+
rotateDiv.style.left = `-${(rotateDiv.clientWidth - rotateDiv.clientHeight) / 2}px`;
|
33
|
+
}
|
34
|
+
}, [div, rotate, size.height, size.width]);
|
35
|
+
return (_jsx("div", { ref: div, className: mergeClasses(...css), children: _jsx("div", { ref: rotate, children: props.children }) }));
|
36
|
+
};
|
37
|
+
//# sourceMappingURL=vertical-content.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vertical-content.js","sourceRoot":"","sources":["../../src/controls/vertical-content.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,iBAAiB,EAAE;QACf,QAAQ,EAAE,UAAU;QACpB,CAAC,SAAS,CAAC,EAAE;YACT,QAAQ,EAAE,UAAU;YACpB,SAAS,EAAE,eAAe;SAC7B;KACJ;CACJ,CAAC,CAAC;AAKH,MAAM,CAAC,MAAM,eAAe,GAA6D,CAAC,KAAK,EAAE,EAAE;IAC/F,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAC5B,IAAI,GAAG,GAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAChD,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;IAE7B,IAAI,GAAG,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;IACzB,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;IAE5B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACjB,IAAI,GAAG,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAChC,IAAI,OAAO,GAAI,GAAG,CAAC,OAA0B,CAAC;YAC9C,IAAI,SAAS,GAAI,MAAM,CAAC,OAA0B,CAAC;YACnD,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,SAAS,CAAC,WAAW,IAAI,CAAC;YACpD,OAAO,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,SAAS,CAAC,YAAY,IAAI,CAAC;YACpD,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,GAAG,SAAS,CAAC,WAAW,IAAI,CAAC;YACvD,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,GAAG,SAAS,CAAC,YAAY,IAAI,CAAC;YAEvD,SAAS,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;YAClF,SAAS,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,GAAG,SAAS,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;QACxF,CAAC;IACL,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3C,OAAO,CACH,cAAK,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,YAAY,CAAC,GAAG,GAAG,CAAC,YAC1C,cAAK,GAAG,EAAE,MAAM,YACX,KAAK,CAAC,QAAQ,GACb,GACJ,CACT,CAAC;AACN,CAAC,CAAA"}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { makeStyles } from '@fluentui/react-components';
|
3
|
+
import { isNotEmptyArray } from '@kwiz/common';
|
4
|
+
import { KnownClassNames, mixins } from '../styles/styles';
|
5
|
+
import { Section } from './section';
|
6
|
+
const useStyles = makeStyles({
|
7
|
+
vertical: Object.assign(Object.assign({}, mixins.flex), { flexDirection: 'column' }),
|
8
|
+
wrap: mixins.wrap,
|
9
|
+
nogap: mixins.nogap
|
10
|
+
});
|
11
|
+
export const Vertical = (props) => {
|
12
|
+
const cssNames = useStyles();
|
13
|
+
let css = [KnownClassNames.vertical];
|
14
|
+
css.push(cssNames.vertical);
|
15
|
+
if (props.wrap)
|
16
|
+
css.push(cssNames.wrap);
|
17
|
+
if (props.nogap)
|
18
|
+
css.push(cssNames.nogap);
|
19
|
+
if (isNotEmptyArray(props.css))
|
20
|
+
css.push(...props.css);
|
21
|
+
return (_jsx(Section, Object.assign({}, props, { css: css })));
|
22
|
+
};
|
23
|
+
//# sourceMappingURL=vertical.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"vertical.js","sourceRoot":"","sources":["../../src/controls/vertical.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAiB,OAAO,EAAE,MAAM,WAAW,CAAC;AAEnD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,QAAQ,kCACD,MAAM,CAAC,IAAI,KACd,aAAa,EAAE,QAAQ,GAC1B;IACD,IAAI,EAAE,MAAM,CAAC,IAAI;IACjB,KAAK,EAAE,MAAM,CAAC,KAAK;CACtB,CAAC,CAAA;AAMF,MAAM,CAAC,MAAM,QAAQ,GAA6D,CAAC,KAAK,EAAE,EAAE;IACxF,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,IAAI,GAAG,GAAa,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IAE/C,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,IAAI;QACV,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,KAAK;QACX,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAE7B,IAAI,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC;QAAE,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvD,OAAO,CACH,KAAC,OAAO,oBAAK,KAAK,IAAE,GAAG,EAAE,GAAG,IAAI,CACnC,CAAC;AACN,CAAC,CAAA"}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import React from "react";
|
2
|
+
export interface iKWIZFluentContext {
|
3
|
+
/**
|
4
|
+
* Where the portal children are mounted on DOM
|
5
|
+
*
|
6
|
+
* @default a new element on document.body without any styling
|
7
|
+
*/
|
8
|
+
mountNode?: HTMLElement | null | {
|
9
|
+
element?: HTMLElement | null;
|
10
|
+
className?: string;
|
11
|
+
};
|
12
|
+
/**
|
13
|
+
* Controls the colors and borders of the input.
|
14
|
+
*
|
15
|
+
* @default 'underline'
|
16
|
+
*/
|
17
|
+
inputAppearance?: 'outline' | 'underline' | 'filled-darker' | 'filled-lighter';
|
18
|
+
/**
|
19
|
+
* A button can be rounded, circular, or square.
|
20
|
+
*
|
21
|
+
* @default 'rounded'
|
22
|
+
*/
|
23
|
+
buttonShape?: 'rounded' | 'circular' | 'square';
|
24
|
+
}
|
25
|
+
export declare const KWIZFluentContext: React.Context<iKWIZFluentContext>;
|
26
|
+
export declare function useKWIZFluentContext(): iKWIZFluentContext;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { isNullOrUndefined } from "@kwiz/common";
|
2
|
+
import React from "react";
|
3
|
+
//create context
|
4
|
+
export const KWIZFluentContext = React.createContext(null);
|
5
|
+
//use context from within controls
|
6
|
+
export function useKWIZFluentContext() {
|
7
|
+
let ctx = React.useContext(KWIZFluentContext) || {};
|
8
|
+
//set defaults
|
9
|
+
if (isNullOrUndefined(ctx.inputAppearance))
|
10
|
+
ctx.inputAppearance = "underline";
|
11
|
+
if (isNullOrUndefined(ctx.buttonShape))
|
12
|
+
ctx.buttonShape = "circular";
|
13
|
+
return ctx;
|
14
|
+
}
|
15
|
+
//# sourceMappingURL=context.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/helpers/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,MAAM,OAAO,CAAC;AA2B1B,gBAAgB;AAChB,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAC,aAAa,CAAqB,IAAI,CAAC,CAAC;AAC/E,kCAAkC;AAClC,MAAM,UAAU,oBAAoB;IAChC,IAAI,GAAG,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC;IACpD,cAAc;IACd,IAAI,iBAAiB,CAAC,GAAG,CAAC,eAAe,CAAC;QACtC,GAAG,CAAC,eAAe,GAAG,WAAW,CAAC;IACtC,IAAI,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;QAClC,GAAG,CAAC,WAAW,GAAG,UAAU,CAAC;IACjC,OAAO,GAAG,CAAC;AACf,CAAC"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import { iDraggedItemType, iDraggableProps } from "./use-draggable";
|
2
|
+
import { iDroppableProps } from "./use-droppable";
|
3
|
+
interface one<DragItemType extends iDraggedItemType<string>> {
|
4
|
+
dragInfo: iDraggableProps<DragItemType>;
|
5
|
+
}
|
6
|
+
interface other<DropInfoTypes extends string = never, DropInfoItemTypes extends iDraggedItemType<DropInfoTypes> = never> {
|
7
|
+
dropInfo: iDroppableProps<DropInfoTypes, DropInfoItemTypes>;
|
8
|
+
}
|
9
|
+
type iDragDropProps<DragItemType extends iDraggedItemType<string>, DropInfoTypes extends string = never, DropInfoItemTypes extends iDraggedItemType<DropInfoTypes> = never> = one<DragItemType> | other<DropInfoTypes, DropInfoItemTypes> | (one<DragItemType> & other<DropInfoTypes, DropInfoItemTypes>);
|
10
|
+
type iProps<DragItemType extends iDraggedItemType<string>, DropInfoTypes extends string, DropInfoItemTypes extends iDraggedItemType<DropInfoTypes>> = Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
11
|
+
onDraggingClassName?: string;
|
12
|
+
onDragOverClassName?: string;
|
13
|
+
} & iDragDropProps<DragItemType, DropInfoTypes, DropInfoItemTypes>;
|
14
|
+
export declare function DragDropContainer<DragItemType extends iDraggedItemType<string> = never, DropInfoTypes extends string = never, DropInfoItemTypes extends iDraggedItemType<DropInfoTypes> = never>(props: React.PropsWithChildren<iProps<DragItemType, DropInfoTypes, DropInfoItemTypes>>): import("react/jsx-runtime").JSX.Element;
|
15
|
+
export {};
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { isNullOrEmptyString } from "@kwiz/common";
|
3
|
+
import { useDragDropContext } from "./drag-drop-context";
|
4
|
+
export function DragDropContainer(props) {
|
5
|
+
const { drag, drop, dragDropRef } = useDragDropContext(props);
|
6
|
+
const classNames = isNullOrEmptyString(props.className) ? [] : props.className.split(' ');
|
7
|
+
if (drag.isDragging && props.onDraggingClassName)
|
8
|
+
classNames.push(props.onDraggingClassName);
|
9
|
+
if (drop.isOver && props.onDragOverClassName)
|
10
|
+
classNames.push(props.onDragOverClassName);
|
11
|
+
return _jsx("div", Object.assign({}, (props || {}), { ref: dragDropRef, className: classNames.join(' '), children: props.children }));
|
12
|
+
}
|
13
|
+
//# sourceMappingURL=drag-drop-container.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"drag-drop-container.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/drag-drop-container.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAgCzD,MAAM,UAAU,iBAAiB,CAI/B,KAAsF;IAEpF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAE9D,MAAM,UAAU,GAAa,mBAAmB,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpG,IAAI,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,mBAAmB;QAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAC7F,IAAI,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,mBAAmB;QAAE,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;IAEzF,OAAO,8BAAS,CAAC,KAAK,IAAI,EAAE,CAAC,IAAE,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,YAAG,KAAK,CAAC,QAAQ,IAAO,CAAC;AAC7G,CAAC"}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { iDraggableProps, iDraggedItemType } from "./use-draggable";
|
3
|
+
import { iDroppableProps } from "./use-droppable";
|
4
|
+
export interface iDragDropContext {
|
5
|
+
isDragging: boolean;
|
6
|
+
setIsDragging: (value: boolean) => void;
|
7
|
+
}
|
8
|
+
export declare const DragDropContext: React.Context<iDragDropContext>;
|
9
|
+
export declare function useDragDropContextInternal(): iDragDropContext;
|
10
|
+
export declare function useDragDropContext<DragItemType extends iDraggedItemType<string> = never, DropInfoType extends iDroppableProps<string, any> = never>(info: {
|
11
|
+
dragInfo?: iDraggableProps<DragItemType>;
|
12
|
+
dropInfo?: DropInfoType;
|
13
|
+
}): {
|
14
|
+
dragDropContext: iDragDropContext;
|
15
|
+
drag: {
|
16
|
+
isDragging: boolean;
|
17
|
+
dragRef: import("react-dnd").ConnectDragSource;
|
18
|
+
};
|
19
|
+
drop: {
|
20
|
+
canDrop: boolean;
|
21
|
+
isOver: boolean;
|
22
|
+
dropRef: import("react-dnd").ConnectDropTarget;
|
23
|
+
};
|
24
|
+
dragDropRef: import("react-dnd").ConnectDragSource;
|
25
|
+
};
|
26
|
+
export declare function useDragDropContextProvider(): iDragDropContext;
|
27
|
+
interface iProps {
|
28
|
+
}
|
29
|
+
export declare const DragDropContextProvider: React.FunctionComponent<React.PropsWithChildren<iProps>>;
|
30
|
+
export {};
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { isNullOrUndefined } from "@kwiz/common";
|
3
|
+
import React, { useContext } from "react";
|
4
|
+
import { DndProvider } from "react-dnd";
|
5
|
+
import { HTML5Backend } from "react-dnd-html5-backend";
|
6
|
+
import { useStateEX } from "../hooks";
|
7
|
+
import { useDraggable } from "./use-draggable";
|
8
|
+
import useDroppable from "./use-droppable";
|
9
|
+
//create context
|
10
|
+
export const DragDropContext = React.createContext(null);
|
11
|
+
//use context from within controls
|
12
|
+
export function useDragDropContextInternal() {
|
13
|
+
const dragDropContext = useContext(DragDropContext);
|
14
|
+
return dragDropContext;
|
15
|
+
}
|
16
|
+
export function useDragDropContext(info) {
|
17
|
+
const dragDropContext = useDragDropContextInternal();
|
18
|
+
const isDraggable = !isNullOrUndefined(info.dragInfo);
|
19
|
+
const isDroppable = !isNullOrUndefined(info.dropInfo);
|
20
|
+
const drag = useDraggable(info === null || info === void 0 ? void 0 : info.dragInfo);
|
21
|
+
const drop = useDroppable(info === null || info === void 0 ? void 0 : info.dropInfo);
|
22
|
+
const acceptDrops = isDroppable && !drag.isDragging && dragDropContext.isDragging;
|
23
|
+
return {
|
24
|
+
dragDropContext,
|
25
|
+
drag,
|
26
|
+
drop,
|
27
|
+
dragDropRef: isDraggable && !isDroppable
|
28
|
+
? drag.dragRef
|
29
|
+
: !isDraggable && isDroppable
|
30
|
+
? drop.dropRef
|
31
|
+
//both drag and drop allowed
|
32
|
+
: acceptDrops ? drop.dropRef : drag.dragRef
|
33
|
+
};
|
34
|
+
}
|
35
|
+
export function useDragDropContextProvider() {
|
36
|
+
const [isDragging, setIsDragging] = useStateEX(false);
|
37
|
+
//build context
|
38
|
+
const ctx = {
|
39
|
+
isDragging, setIsDragging
|
40
|
+
};
|
41
|
+
return ctx;
|
42
|
+
}
|
43
|
+
export const DragDropContextProvider = (props) => {
|
44
|
+
const provider = useDragDropContextProvider();
|
45
|
+
return _jsx(DragDropContext.Provider, { value: provider, children: _jsx(DndProvider, { backend: HTML5Backend, children: props.children }) });
|
46
|
+
};
|
47
|
+
//# sourceMappingURL=drag-drop-context.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"drag-drop-context.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/drag-drop-context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAqC,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAClF,OAAO,YAAiC,MAAM,iBAAiB,CAAC;AAMhE,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC,aAAa,CAAmB,IAAI,CAAC,CAAC;AAC3E,kCAAkC;AAClC,MAAM,UAAU,0BAA0B;IACtC,MAAM,eAAe,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC;IACpD,OAAO,eAAe,CAAC;AAC3B,CAAC;AACD,MAAM,UAAU,kBAAkB,CAGhC,IAGD;IACG,MAAM,eAAe,GAAG,0BAA0B,EAAE,CAAC;IACrD,MAAM,WAAW,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,WAAW,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,QAAQ,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,WAAW,IAAI,CAAC,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC;IAElF,OAAO;QACH,eAAe;QACf,IAAI;QACJ,IAAI;QACJ,WAAW,EAAE,WAAW,IAAI,CAAC,WAAW;YACpC,CAAC,CAAC,IAAI,CAAC,OAAO;YACd,CAAC,CAAC,CAAC,WAAW,IAAI,WAAW;gBACzB,CAAC,CAAC,IAAI,CAAC,OAAO;gBACd,4BAA4B;gBAC5B,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO;KACtD,CAAC;AACN,CAAC;AACD,MAAM,UAAU,0BAA0B;IACtC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEtD,eAAe;IACf,MAAM,GAAG,GAAqB;QAC1B,UAAU,EAAE,aAAa;KAC5B,CAAC;IAGF,OAAO,GAAG,CAAC;AACf,CAAC;AAID,MAAM,CAAC,MAAM,uBAAuB,GAA6D,CAAC,KAAK,EAAE,EAAE;IACvG,MAAM,QAAQ,GAAG,0BAA0B,EAAE,CAAC;IAC9C,OAAO,KAAC,eAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,QAAQ,YAC5C,KAAC,WAAW,IAAC,OAAO,EAAE,YAAY,YAC7B,KAAK,CAAC,QAAQ,GACL,GACS,CAAC;AAChC,CAAC,CAAA"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { ConnectDragSource } from 'react-dnd';
|
2
|
+
export interface iDraggedItemType<DragType extends string> {
|
3
|
+
type: DragType;
|
4
|
+
}
|
5
|
+
export interface iDraggableProps<ItemType extends iDraggedItemType<string>> {
|
6
|
+
item: ItemType;
|
7
|
+
onBeginDrag?: () => void;
|
8
|
+
onEndDrag?: (dropResult: any) => void;
|
9
|
+
}
|
10
|
+
export declare function useDraggable<ItemType extends iDraggedItemType<string>>(props?: iDraggableProps<ItemType>): {
|
11
|
+
isDragging: boolean;
|
12
|
+
dragRef: ConnectDragSource;
|
13
|
+
};
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import { useEffect } from 'react';
|
2
|
+
import { useDrag } from 'react-dnd';
|
3
|
+
import { useDragDropContextInternal } from './drag-drop-context';
|
4
|
+
export function useDraggable(props) {
|
5
|
+
const { item, onBeginDrag, onEndDrag, } = props || {
|
6
|
+
item: {
|
7
|
+
type: "~invalid~"
|
8
|
+
}
|
9
|
+
};
|
10
|
+
const dragDropContext = useDragDropContextInternal();
|
11
|
+
const [{ isDragging }, dragRef] = useDrag(() => ({
|
12
|
+
type: item.type,
|
13
|
+
item,
|
14
|
+
collect: (monitor) => ({
|
15
|
+
isDragging: monitor.isDragging(),
|
16
|
+
}),
|
17
|
+
end: (item, monitor) => {
|
18
|
+
dragDropContext.setIsDragging(false);
|
19
|
+
onEndDrag && onEndDrag(monitor.getDropResult());
|
20
|
+
},
|
21
|
+
}), [item, item.type]);
|
22
|
+
useEffect(() => {
|
23
|
+
if (isDragging) {
|
24
|
+
dragDropContext.setIsDragging(true);
|
25
|
+
onBeginDrag && onBeginDrag();
|
26
|
+
}
|
27
|
+
}, [isDragging, onBeginDrag]);
|
28
|
+
return {
|
29
|
+
isDragging,
|
30
|
+
dragRef,
|
31
|
+
};
|
32
|
+
}
|
33
|
+
//# sourceMappingURL=use-draggable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-draggable.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/use-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAwC,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1E,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAWjE,MAAM,UAAU,YAAY,CAA4C,KAAiC;IAIrG,MAAM,EACF,IAAI,EACJ,WAAW,EACX,SAAS,GACZ,GAAG,KAAK,IAAI;QACT,IAAI,EAAE;YACF,IAAI,EAAE,WAAW;SACpB;KACJ,CAAC;IAEF,MAAM,eAAe,GAAG,0BAA0B,EAAE,CAAC;IAErD,MAAM,CAAC,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,GAAG,OAAO,CACrC,GAAG,EAAE,CAAC,CAAC;QACH,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,IAAI;QACJ,OAAO,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;YACtC,UAAU,EAAE,OAAO,CAAC,UAAU,EAAE;SACnC,CAAC;QACF,GAAG,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE;YACnB,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACrC,SAAS,IAAI,SAAS,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC;QACpD,CAAC;KACJ,CAAC,EACF,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CACpB,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,UAAU,EAAE,CAAC;YACb,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;YACpC,WAAW,IAAI,WAAW,EAAE,CAAC;QACjC,CAAC;IACL,CAAC,EAAE,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC,CAAA;IAE7B,OAAO;QACH,UAAU;QACV,OAAO;KACV,CAAC;AACN,CAAC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ConnectDropTarget } from 'react-dnd';
|
2
|
+
import { iDraggedItemType } from './use-draggable';
|
3
|
+
export interface iDroppableProps<DropTypes extends string, ItemTypes extends iDraggedItemType<DropTypes>> {
|
4
|
+
acceptTypes: DropTypes[];
|
5
|
+
onItemDrop: (item: ItemTypes) => void;
|
6
|
+
onHover?: (item: ItemTypes) => void;
|
7
|
+
onDrop?: () => void;
|
8
|
+
}
|
9
|
+
declare function useDroppable<DropType extends string, ItemType extends iDraggedItemType<DropType>>(props?: iDroppableProps<DropType, ItemType>): {
|
10
|
+
canDrop: boolean;
|
11
|
+
isOver: boolean;
|
12
|
+
dropRef: ConnectDropTarget;
|
13
|
+
};
|
14
|
+
export default useDroppable;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { useDrop } from 'react-dnd';
|
2
|
+
function useDroppable(props) {
|
3
|
+
const { acceptTypes, onItemDrop, onHover, onDrop, } = props || {
|
4
|
+
acceptTypes: [],
|
5
|
+
onItemDrop: () => { }
|
6
|
+
};
|
7
|
+
const [{ canDrop, isOver }, dropRef] = useDrop({
|
8
|
+
accept: acceptTypes,
|
9
|
+
drop: (item) => {
|
10
|
+
onItemDrop(item);
|
11
|
+
onDrop === null || onDrop === void 0 ? void 0 : onDrop();
|
12
|
+
},
|
13
|
+
hover: (item) => {
|
14
|
+
onHover === null || onHover === void 0 ? void 0 : onHover(item);
|
15
|
+
},
|
16
|
+
collect: (monitor) => ({
|
17
|
+
canDrop: monitor.canDrop(),
|
18
|
+
isOver: monitor.isOver(),
|
19
|
+
}),
|
20
|
+
});
|
21
|
+
return {
|
22
|
+
canDrop,
|
23
|
+
isOver,
|
24
|
+
dropRef,
|
25
|
+
};
|
26
|
+
}
|
27
|
+
export default useDroppable;
|
28
|
+
//# sourceMappingURL=use-droppable.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"use-droppable.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/use-droppable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,OAAO,EAAE,MAAM,WAAW,CAAC;AAU1E,SAAS,YAAY,CAAuE,KAA2C;IAKnI,MAAM,EACF,WAAW,EACX,UAAU,EACV,OAAO,EACP,MAAM,GACT,GAAG,KAAK,IAAI;QACT,WAAW,EAAE,EAAE;QACf,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC;KACxB,CAAC;IAEF,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC;QAC3C,MAAM,EAAE,WAAW;QACnB,IAAI,EAAE,CAAC,IAAc,EAAE,EAAE;YACrB,UAAU,CAAC,IAAI,CAAC,CAAC;YACjB,MAAM,aAAN,MAAM,uBAAN,MAAM,EAAI,CAAC;QACf,CAAC;QACD,KAAK,EAAE,CAAC,IAAc,EAAE,EAAE;YACtB,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,CAAC,CAAC;QACpB,CAAC;QACD,OAAO,EAAE,CAAC,OAA0B,EAAE,EAAE,CAAC,CAAC;YACtC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE;SAC3B,CAAC;KACL,CAAC,CAAC;IAEH,OAAO;QACH,OAAO;QACP,MAAM;QACN,OAAO;KACV,CAAC;AACN,CAAC;AAED,eAAe,YAAY,CAAC"}
|
@@ -0,0 +1,62 @@
|
|
1
|
+
import { ToastIntent } from "@fluentui/react-components";
|
2
|
+
import { MutableRefObject, SetStateAction } from "react";
|
3
|
+
import { iKWIZFluentContext } from "./context";
|
4
|
+
/** Empty array ensures that effect is only run on mount */
|
5
|
+
export declare const useEffectOnlyOnMount: any[];
|
6
|
+
/** set state on steroids. provide promise callback after render, onChange transformer and automatic skip-set when value not changed */
|
7
|
+
export declare function useStateEX<ValueType>(initialValue: ValueType, options?: {
|
8
|
+
onChange?: (newValue: SetStateAction<ValueType>) => SetStateAction<ValueType>;
|
9
|
+
skipUpdateIfSame?: boolean;
|
10
|
+
name?: string;
|
11
|
+
}): [
|
12
|
+
ValueType,
|
13
|
+
(newValue: SetStateAction<ValueType>) => Promise<ValueType>,
|
14
|
+
MutableRefObject<ValueType>
|
15
|
+
];
|
16
|
+
export declare function useTrackFocus(props: {
|
17
|
+
onFocus: () => void;
|
18
|
+
onLoseFocus: () => void;
|
19
|
+
ref?: MutableRefObject<HTMLElement>;
|
20
|
+
}): MutableRefObject<HTMLElement>;
|
21
|
+
export declare function useWindowSize(): {
|
22
|
+
width: number;
|
23
|
+
height: number;
|
24
|
+
};
|
25
|
+
export declare function useIsInPrint(): boolean;
|
26
|
+
/** set block message if you want to block nav.
|
27
|
+
* - call setMessage to add a blocker message
|
28
|
+
* - call onNav when you have internal navigation (open / close popups)
|
29
|
+
* - render the navPrompt control to your page
|
30
|
+
* FYI for page unload, most modern browsers won't show your message but a generic one instead. */
|
31
|
+
export declare function useBlockNav(): {
|
32
|
+
setMessage: (id: string, message?: string) => void;
|
33
|
+
onNav: (nav: () => void) => void;
|
34
|
+
navPrompt: import("react/jsx-runtime").JSX.Element;
|
35
|
+
};
|
36
|
+
export declare function useKeyDown(options: {
|
37
|
+
elm?: HTMLElement | Document;
|
38
|
+
onEnter?: (e: KeyboardEvent) => void;
|
39
|
+
onEscape?: (e: KeyboardEvent) => void;
|
40
|
+
onKeyDown?: (e: KeyboardEvent) => void;
|
41
|
+
}): void;
|
42
|
+
export declare function useToast(): {
|
43
|
+
control: import("react/jsx-runtime").JSX.Element;
|
44
|
+
dispatch: (info: {
|
45
|
+
title?: string;
|
46
|
+
body?: string;
|
47
|
+
subtitle?: string;
|
48
|
+
titleAction?: {
|
49
|
+
text: string;
|
50
|
+
onClick: () => void;
|
51
|
+
};
|
52
|
+
footerActions?: {
|
53
|
+
text: string;
|
54
|
+
onClick: () => void;
|
55
|
+
}[];
|
56
|
+
intent?: ToastIntent;
|
57
|
+
}) => void;
|
58
|
+
};
|
59
|
+
export declare function useKWIZFluentContextProvider(options: {
|
60
|
+
root?: React.MutableRefObject<HTMLDivElement>;
|
61
|
+
ctx?: iKWIZFluentContext;
|
62
|
+
}): iKWIZFluentContext;
|