@kwiz/fluentui 1.0.20 → 1.0.22
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/.github/workflows/npm-publish.yml +1 -0
- 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 +31 -0
- package/dist/controls/dropdown.js +28 -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/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 +25 -0
- package/dist/index.js +25 -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 +1 -1
@@ -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,MAA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AC,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,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;
|
@@ -0,0 +1,287 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { Link, Toast, ToastBody, Toaster, ToastFooter, ToastTitle, useId, useToastController } from "@fluentui/react-components";
|
3
|
+
import { isDebug, isFunction, isNotEmptyArray, isNullOrEmptyString, jsonClone, jsonStringify, LoggerLevel, objectsEqual, wrapFunction } from "@kwiz/common";
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
5
|
+
import { GetLogger } from "../_modules/config";
|
6
|
+
import { Prompter } from "../controls/prompt";
|
7
|
+
import { KnownClassNames } from "../styles/styles";
|
8
|
+
import { useKWIZFluentContext } from "./context";
|
9
|
+
const logger = GetLogger("helpers/hooks");
|
10
|
+
/** Empty array ensures that effect is only run on mount */
|
11
|
+
export const useEffectOnlyOnMount = [];
|
12
|
+
/** set state on steroids. provide promise callback after render, onChange transformer and automatic skip-set when value not changed */
|
13
|
+
export function useStateEX(initialValue, options) {
|
14
|
+
options = options || {};
|
15
|
+
const name = options.name || '';
|
16
|
+
let logger = GetLogger(`useStateWithTrack${isNullOrEmptyString(name) ? '' : ` ${name}`}`);
|
17
|
+
logger.setLevel(LoggerLevel.WARN);
|
18
|
+
const [value, setValueInState] = useState(initialValue);
|
19
|
+
const currentValue = useRef(value);
|
20
|
+
/** make this a collection in case several callers are awaiting the same propr update */
|
21
|
+
const resolveState = useRef([]);
|
22
|
+
const isMounted = useRef(false);
|
23
|
+
useEffect(() => {
|
24
|
+
isMounted.current = true;
|
25
|
+
return () => {
|
26
|
+
isMounted.current = false;
|
27
|
+
};
|
28
|
+
}, useEffectOnlyOnMount);
|
29
|
+
function resolvePromises() {
|
30
|
+
if (isNotEmptyArray(resolveState.current)) {
|
31
|
+
let resolvers = resolveState.current.slice();
|
32
|
+
resolveState.current = []; //clear
|
33
|
+
resolvers.map(r => r(currentValue.current));
|
34
|
+
}
|
35
|
+
}
|
36
|
+
;
|
37
|
+
useEffect(() => {
|
38
|
+
resolvePromises();
|
39
|
+
if (isNotEmptyArray(resolveState.current)) {
|
40
|
+
logger.log(`resolved after render`);
|
41
|
+
let resolvers = resolveState.current.slice();
|
42
|
+
resolveState.current = []; //clear
|
43
|
+
resolvers.map(r => r(value));
|
44
|
+
}
|
45
|
+
}, [value, resolveState.current]);
|
46
|
+
let setValueWithCheck = !options.skipUpdateIfSame ? setValueInState : (newValue) => {
|
47
|
+
logger.groupSync('conditional value change', log => {
|
48
|
+
if (logger.getLevel() === LoggerLevel.VERBOSE) {
|
49
|
+
log('old: ' + jsonStringify(currentValue.current));
|
50
|
+
log('new: ' + jsonStringify(newValue));
|
51
|
+
}
|
52
|
+
if (!objectsEqual(newValue, currentValue.current)) {
|
53
|
+
log(`value changed`);
|
54
|
+
setValueInState(newValue);
|
55
|
+
}
|
56
|
+
else {
|
57
|
+
log(`value unchanged`);
|
58
|
+
resolvePromises();
|
59
|
+
}
|
60
|
+
});
|
61
|
+
};
|
62
|
+
let setValueWithEvents = wrapFunction(setValueWithCheck, {
|
63
|
+
before: newValue => isFunction(options.onChange) ? options.onChange(newValue) : newValue,
|
64
|
+
after: newValue => currentValue.current = newValue
|
65
|
+
});
|
66
|
+
const setValue = useCallback((newState) => new Promise(resolve => {
|
67
|
+
if (!isMounted.current) {
|
68
|
+
//unmounted may never resolve
|
69
|
+
logger.log(`resolved without wait`);
|
70
|
+
resolve(newState);
|
71
|
+
}
|
72
|
+
else {
|
73
|
+
resolveState.current.push(resolve);
|
74
|
+
setValueWithEvents(newState);
|
75
|
+
}
|
76
|
+
}), []);
|
77
|
+
return [value, setValue, currentValue];
|
78
|
+
}
|
79
|
+
export function useTrackFocus(props) {
|
80
|
+
const wrapperDiv = props.ref || useRef(null);
|
81
|
+
useEffect(() => {
|
82
|
+
function focusIn(e) {
|
83
|
+
let elm = e.target; //document.activeElement;
|
84
|
+
if (wrapperDiv.current) {
|
85
|
+
while (elm && elm !== wrapperDiv.current) {
|
86
|
+
elm = elm.parentElement;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
else
|
90
|
+
elm = null;
|
91
|
+
if (wrapperDiv.current && elm === wrapperDiv.current)
|
92
|
+
props.onFocus();
|
93
|
+
else
|
94
|
+
props.onLoseFocus();
|
95
|
+
}
|
96
|
+
if (wrapperDiv.current) {
|
97
|
+
if (wrapperDiv.current)
|
98
|
+
wrapperDiv.current.tabIndex = 1;
|
99
|
+
window.addEventListener("focusin", focusIn);
|
100
|
+
// Remove event listener on cleanup
|
101
|
+
return () => window.removeEventListener("focusin", focusIn);
|
102
|
+
}
|
103
|
+
}, [wrapperDiv.current]);
|
104
|
+
return wrapperDiv;
|
105
|
+
}
|
106
|
+
export function useWindowSize() {
|
107
|
+
// Initialize state with undefined width/height so server and client renders match
|
108
|
+
// Learn more here: https://joshwcomeau.com/react/the-perils-of-rehydration/
|
109
|
+
const [windowSize, setWindowSize] = useState({
|
110
|
+
width: undefined,
|
111
|
+
height: undefined
|
112
|
+
});
|
113
|
+
useEffect(() => {
|
114
|
+
// Handler to call on window resize
|
115
|
+
function handleResize() {
|
116
|
+
// Set window width/height to state
|
117
|
+
setWindowSize({
|
118
|
+
width: window.innerWidth,
|
119
|
+
height: window.innerHeight
|
120
|
+
});
|
121
|
+
}
|
122
|
+
// Add event listener
|
123
|
+
window.addEventListener("resize", handleResize);
|
124
|
+
// Call handler right away so state gets updated with initial window size
|
125
|
+
handleResize();
|
126
|
+
// Remove event listener on cleanup
|
127
|
+
return () => window.removeEventListener("resize", handleResize);
|
128
|
+
}, useEffectOnlyOnMount);
|
129
|
+
return windowSize;
|
130
|
+
}
|
131
|
+
export function useIsInPrint() {
|
132
|
+
// Initialize state with false
|
133
|
+
const [printMode, setPrintMode] = useState(false);
|
134
|
+
useEffect(() => {
|
135
|
+
function forcePrint(e) {
|
136
|
+
if (e.ctrlKey && e.shiftKey && e.altKey) {
|
137
|
+
if (e.key.toLocaleLowerCase() === "q") {
|
138
|
+
document.body.classList.remove(KnownClassNames.print);
|
139
|
+
handlePrint(e, false);
|
140
|
+
}
|
141
|
+
else {
|
142
|
+
console.warn('forced print mode - to exit refresh to ctrl+shift+alt+q');
|
143
|
+
document.body.classList.add(KnownClassNames.print);
|
144
|
+
handlePrint(e, true);
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
// Handler to call on printing
|
149
|
+
function handlePrint(e, force) {
|
150
|
+
if (force === true)
|
151
|
+
setPrintMode(true);
|
152
|
+
else if (window.matchMedia) {
|
153
|
+
var mediaQueryList = window.matchMedia('print');
|
154
|
+
if (mediaQueryList.matches) {
|
155
|
+
setPrintMode(true);
|
156
|
+
}
|
157
|
+
else {
|
158
|
+
setPrintMode(false);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
}
|
162
|
+
// Add event listener
|
163
|
+
window.addEventListener("print", handlePrint);
|
164
|
+
if (isDebug())
|
165
|
+
window.addEventListener("keydown", forcePrint);
|
166
|
+
// Call handler right away so state gets updated with initial printing state
|
167
|
+
handlePrint();
|
168
|
+
// Remove event listener on cleanup
|
169
|
+
return () => {
|
170
|
+
window.removeEventListener("print", handlePrint);
|
171
|
+
if (isDebug())
|
172
|
+
window.removeEventListener("keydown", forcePrint);
|
173
|
+
};
|
174
|
+
}, useEffectOnlyOnMount);
|
175
|
+
return printMode;
|
176
|
+
}
|
177
|
+
/** set block message if you want to block nav.
|
178
|
+
* - call setMessage to add a blocker message
|
179
|
+
* - call onNav when you have internal navigation (open / close popups)
|
180
|
+
* - render the navPrompt control to your page
|
181
|
+
* FYI for page unload, most modern browsers won't show your message but a generic one instead. */
|
182
|
+
export function useBlockNav() {
|
183
|
+
const [, setBlockNavMessages, blockNavMessagesRef] = useStateEX({});
|
184
|
+
const [prompt, setPrompt] = useStateEX(null);
|
185
|
+
const getMessagesArr = useCallback(() => {
|
186
|
+
return Object.keys(blockNavMessagesRef.current).map(id => blockNavMessagesRef.current[id]);
|
187
|
+
}, useEffectOnlyOnMount);
|
188
|
+
const getMessages = useCallback(() => {
|
189
|
+
return getMessagesArr().join();
|
190
|
+
}, useEffectOnlyOnMount);
|
191
|
+
const onNav = useCallback((nav) => {
|
192
|
+
let messages = getMessagesArr();
|
193
|
+
if (isNotEmptyArray(messages)) {
|
194
|
+
//need to release react to re-render the prompt
|
195
|
+
window.setTimeout(() => {
|
196
|
+
//prompt, if ok - clear messages and nav.
|
197
|
+
setPrompt({
|
198
|
+
okButtonText: "Leave",
|
199
|
+
cancelButtonText: "Cancel",
|
200
|
+
title: "Leave page?",
|
201
|
+
children: messages.length > 1
|
202
|
+
? _jsx("ul", { children: messages.map((m, i) => _jsx("li", { children: m }, `m${i}`)) })
|
203
|
+
: _jsx("p", { children: messages[0] }),
|
204
|
+
onCancel: () => setPrompt(null),
|
205
|
+
onOK: () => {
|
206
|
+
setPrompt(null);
|
207
|
+
setBlockNavMessages({}); //clear messages
|
208
|
+
nav();
|
209
|
+
}
|
210
|
+
});
|
211
|
+
}, 1);
|
212
|
+
}
|
213
|
+
else
|
214
|
+
nav();
|
215
|
+
}, useEffectOnlyOnMount);
|
216
|
+
useEffect(() => {
|
217
|
+
function handleBeforeUnload(e) {
|
218
|
+
//todo: use blockMessageRef.current so that we don't have to re-register every time message changes.
|
219
|
+
//otherwise we would have to add blockMessage as a dependency for this useEffect
|
220
|
+
const message = getMessages();
|
221
|
+
if (!isNullOrEmptyString(message)) {
|
222
|
+
e.preventDefault();
|
223
|
+
e.returnValue = message;
|
224
|
+
}
|
225
|
+
}
|
226
|
+
// Add event listener
|
227
|
+
window.addEventListener("beforeunload", handleBeforeUnload);
|
228
|
+
// Remove event listener on cleanup
|
229
|
+
return () => window.removeEventListener("beforeunload", handleBeforeUnload);
|
230
|
+
}, useEffectOnlyOnMount);
|
231
|
+
return {
|
232
|
+
setMessage: (id, message) => {
|
233
|
+
let current = jsonClone(blockNavMessagesRef.current);
|
234
|
+
if (isNullOrEmptyString(message))
|
235
|
+
delete current[id];
|
236
|
+
else
|
237
|
+
current[id] = message;
|
238
|
+
if (!objectsEqual(current, blockNavMessagesRef.current))
|
239
|
+
setBlockNavMessages(current);
|
240
|
+
},
|
241
|
+
// clearMessages: () => {
|
242
|
+
// setBlockNavMessages({});
|
243
|
+
// },
|
244
|
+
// getMessages,
|
245
|
+
// getMessagesArr,
|
246
|
+
onNav,
|
247
|
+
navPrompt: prompt ? _jsx(Prompter, Object.assign({}, prompt)) : undefined
|
248
|
+
};
|
249
|
+
}
|
250
|
+
export function useKeyDown(options) {
|
251
|
+
let elm = options.elm || document;
|
252
|
+
useEffect(() => {
|
253
|
+
let handler = (e) => {
|
254
|
+
if (e.key === "Enter" && isFunction(options.onEnter))
|
255
|
+
options.onEnter(e);
|
256
|
+
else if (e.key === "Escape" && isFunction(options.onEscape))
|
257
|
+
options.onEscape(e);
|
258
|
+
if (isFunction(options.onKeyDown))
|
259
|
+
options.onKeyDown(e);
|
260
|
+
};
|
261
|
+
elm.addEventListener("keydown", handler);
|
262
|
+
return () => elm.removeEventListener("keydown", handler);
|
263
|
+
}, [elm]);
|
264
|
+
}
|
265
|
+
export function useToast() {
|
266
|
+
const ctx = useKWIZFluentContext();
|
267
|
+
const toasterId = useId("toaster");
|
268
|
+
const { dispatchToast } = useToastController(toasterId);
|
269
|
+
return {
|
270
|
+
control: _jsx(Toaster, { mountNode: ctx.mountNode, toasterId: toasterId }),
|
271
|
+
dispatch: (info) => {
|
272
|
+
dispatchToast(_jsxs(Toast, { children: [info.title && _jsx(ToastTitle, { action: info.titleAction ? _jsx(Link, { onClick: info.titleAction.onClick, children: info.titleAction.text }) : undefined, children: info.title }), info.body && _jsx(ToastBody, { subtitle: info.subtitle, children: info.body }), isNotEmptyArray(info.footerActions) &&
|
273
|
+
_jsx(ToastFooter, { children: info.footerActions.map((a, i) => _jsx(Link, { onClick: a.onClick, children: a.text }, `l${i}`)) })] }), { intent: info.intent || "info" });
|
274
|
+
}
|
275
|
+
};
|
276
|
+
}
|
277
|
+
export function useKWIZFluentContextProvider(options) {
|
278
|
+
let v = options && options.ctx || {};
|
279
|
+
const [kwizFluentContext, setKwizFluentContext] = useState(v);
|
280
|
+
useEffect(() => {
|
281
|
+
// ref only updates in useEffect, not in useMemo or anything else.
|
282
|
+
// we need to set it into state so it will trigger a ui update
|
283
|
+
setKwizFluentContext(Object.assign(Object.assign({}, v), { mountNode: options.root.current }));
|
284
|
+
}, [options.root]);
|
285
|
+
return kwizFluentContext;
|
286
|
+
}
|
287
|
+
//# sourceMappingURL=hooks.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hooks.js","sourceRoot":"","sources":["../../src/helpers/hooks.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAA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,GAAQ,CAAC,CAAC,CAAC,SAAS,YAAG,IAAI,CAAC,KAAK,GAAc,EACnK,IAAI,CAAC,IAAI,IAAI,KAAC,SAAS,IAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,YAAG,IAAI,CAAC,IAAI,GAAa,EACxE,eAAe,CAAC,IAAI,CAAC,aAAa,CAAC;wBAChC,KAAC,WAAW,cACP,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,KAAC,IAAI,IAAe,OAAO,EAAE,CAAC,CAAC,OAAO,YAAG,CAAC,CAAC,IAAI,IAApC,IAAI,CAAC,EAAE,CAAqC,CAAC,GAChF,IAEd,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,MAAM,EAAE,CAAC,CAAC;QACjD,CAAC;KACJ,CAAA;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,OAG5C;IACG,IAAI,CAAC,GAAuB,OAAO,IAAI,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC;IACzD,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAqB,CAAC,CAAC,CAAC;IAClF,SAAS,CAAC,GAAG,EAAE;QACX,kEAAkE;QAClE,8DAA8D;QAC9D,oBAAoB,iCACb,CAAC,KACJ,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,IACjC,CAAC;IACP,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACnB,OAAO,iBAAiB,CAAC;AAC7B,CAAC"}
|
package/dist/index.d.ts
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
export * from './controls/accordion';
|
2
|
+
export * from './controls/button';
|
3
|
+
export * from './controls/centered';
|
4
|
+
export * from './controls/date';
|
5
|
+
export * from './controls/dropdown';
|
6
|
+
export * from './controls/error-boundary';
|
7
|
+
export * from './controls/field-editor';
|
8
|
+
export * from './controls/file-upload';
|
9
|
+
export * from './controls/horizontal';
|
10
|
+
export * from './controls/input';
|
11
|
+
export * from './controls/kwizoverflow';
|
12
|
+
export * from './controls/list';
|
13
|
+
export * from './controls/loading';
|
14
|
+
export * from './controls/please-wait';
|
15
|
+
export * from './controls/prompt';
|
16
|
+
export * from './controls/search';
|
17
|
+
export * from './controls/section';
|
18
|
+
export * from './controls/svg';
|
19
|
+
export * from './controls/toolbar';
|
20
|
+
export * from './controls/vertical';
|
21
|
+
export * from './controls/vertical-content';
|
22
|
+
export { KWIZFluentContext, useKWIZFluentContext } from './helpers/context';
|
23
|
+
export type { iKWIZFluentContext } from './helpers/context';
|
24
|
+
export * from './helpers/hooks';
|
25
|
+
export { KnownClassNames } from './styles/styles';
|
package/dist/index.js
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
export * from './controls/accordion';
|
2
|
+
export * from './controls/button';
|
3
|
+
export * from './controls/centered';
|
4
|
+
export * from './controls/date';
|
5
|
+
export * from './controls/dropdown';
|
6
|
+
export * from './controls/error-boundary';
|
7
|
+
export * from './controls/field-editor';
|
8
|
+
export * from './controls/file-upload';
|
9
|
+
export * from './controls/horizontal';
|
10
|
+
export * from './controls/input';
|
11
|
+
export * from './controls/kwizoverflow';
|
12
|
+
export * from './controls/list';
|
13
|
+
export * from './controls/loading';
|
14
|
+
export * from './controls/please-wait';
|
15
|
+
export * from './controls/prompt';
|
16
|
+
export * from './controls/search';
|
17
|
+
export * from './controls/section';
|
18
|
+
export * from './controls/svg';
|
19
|
+
export * from './controls/toolbar';
|
20
|
+
export * from './controls/vertical';
|
21
|
+
export * from './controls/vertical-content';
|
22
|
+
export { KWIZFluentContext, useKWIZFluentContext } from './helpers/context';
|
23
|
+
export * from './helpers/hooks';
|
24
|
+
export { KnownClassNames } from './styles/styles';
|
25
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE5E,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { GriffelStyle } from "@fluentui/react-components";
|
2
|
+
export declare namespace mixins {
|
3
|
+
const main: GriffelStyle;
|
4
|
+
const clickable: GriffelStyle;
|
5
|
+
const float: GriffelStyle;
|
6
|
+
const flex: GriffelStyle;
|
7
|
+
const wrap: GriffelStyle;
|
8
|
+
const nogap: GriffelStyle;
|
9
|
+
const ellipsis: GriffelStyle;
|
10
|
+
}
|
11
|
+
export declare const KnownClassNames: {
|
12
|
+
print: string;
|
13
|
+
section: string;
|
14
|
+
vertical: string;
|
15
|
+
horizontal: string;
|
16
|
+
list: string;
|
17
|
+
};
|
18
|
+
export declare const useCommonStyles: () => Record<"printShow" | "printHide", string>;
|
19
|
+
export declare const widthMedium = 360;
|