@kwiz/fluentui 1.0.78 → 1.0.79

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.
Files changed (87) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +53 -53
  3. package/dist/controls/svg.js +21 -21
  4. package/dist/controls/svg.js.map +1 -1
  5. package/package.json +85 -85
  6. package/.dependency-cruiser.js +0 -399
  7. package/.github/workflows/npm-publish.yml +0 -24
  8. package/dist/@types/forwardRef.d.ts +0 -0
  9. package/dist/@types/forwardRef.js +0 -1
  10. package/dist/@types/forwardRef.js.map +0 -1
  11. package/dist/controls/error-boundary copy.d.ts +0 -23
  12. package/dist/controls/error-boundary copy.js +0 -33
  13. package/dist/controls/error-boundary copy.js.map +0 -1
  14. package/dist/helpers/common.d.ts +0 -4
  15. package/dist/helpers/common.js +0 -2
  16. package/dist/helpers/common.js.map +0 -1
  17. package/dist/helpers/context.d.ts +0 -26
  18. package/dist/helpers/context.js +0 -15
  19. package/dist/helpers/context.js.map +0 -1
  20. package/dist/helpers/drag-drop/exports.d.ts +0 -12
  21. package/dist/helpers/drag-drop/exports.js +0 -3
  22. package/dist/helpers/drag-drop/exports.js.map +0 -1
  23. package/dist/helpers/exports.d.ts +0 -7
  24. package/dist/helpers/exports.js +0 -8
  25. package/dist/helpers/exports.js.map +0 -1
  26. package/src/_modules/config.ts +0 -9
  27. package/src/_modules/constants.ts +0 -3
  28. package/src/controls/ColorPickerDialog.tsx +0 -84
  29. package/src/controls/accordion.tsx +0 -62
  30. package/src/controls/button.tsx +0 -181
  31. package/src/controls/canvas/CustomEventTargetBase.ts +0 -33
  32. package/src/controls/canvas/DrawPad.tsx +0 -297
  33. package/src/controls/canvas/DrawPadManager.ts +0 -695
  34. package/src/controls/canvas/bezier.ts +0 -110
  35. package/src/controls/canvas/point.ts +0 -45
  36. package/src/controls/card-list.tsx +0 -32
  37. package/src/controls/card.tsx +0 -78
  38. package/src/controls/centered.tsx +0 -15
  39. package/src/controls/date.tsx +0 -88
  40. package/src/controls/diagram-picker.tsx +0 -97
  41. package/src/controls/divider.tsx +0 -16
  42. package/src/controls/dropdown.tsx +0 -67
  43. package/src/controls/error-boundary.tsx +0 -42
  44. package/src/controls/field-editor.tsx +0 -43
  45. package/src/controls/file-upload.tsx +0 -156
  46. package/src/controls/horizontal.tsx +0 -49
  47. package/src/controls/html-editor/editor.tsx +0 -182
  48. package/src/controls/index.ts +0 -33
  49. package/src/controls/input.tsx +0 -161
  50. package/src/controls/kwizoverflow.tsx +0 -107
  51. package/src/controls/list.tsx +0 -120
  52. package/src/controls/loading.tsx +0 -11
  53. package/src/controls/menu.tsx +0 -196
  54. package/src/controls/merge-text.tsx +0 -126
  55. package/src/controls/please-wait.tsx +0 -33
  56. package/src/controls/progress-bar.tsx +0 -110
  57. package/src/controls/prompt.tsx +0 -122
  58. package/src/controls/qrcode.tsx +0 -37
  59. package/src/controls/search.tsx +0 -72
  60. package/src/controls/section.tsx +0 -134
  61. package/src/controls/svg.tsx +0 -139
  62. package/src/controls/toolbar.tsx +0 -47
  63. package/src/controls/vertical-content.tsx +0 -50
  64. package/src/controls/vertical.tsx +0 -43
  65. package/src/helpers/block-nav.tsx +0 -89
  66. package/src/helpers/context-const.ts +0 -30
  67. package/src/helpers/context-export.tsx +0 -78
  68. package/src/helpers/context-internal.ts +0 -14
  69. package/src/helpers/drag-drop/drag-drop-container.tsx +0 -54
  70. package/src/helpers/drag-drop/drag-drop-context-internal.tsx +0 -10
  71. package/src/helpers/drag-drop/drag-drop-context.tsx +0 -62
  72. package/src/helpers/drag-drop/drag-drop.types.ts +0 -21
  73. package/src/helpers/drag-drop/index.ts +0 -12
  74. package/src/helpers/drag-drop/readme.md +0 -76
  75. package/src/helpers/drag-drop/use-draggable.ts +0 -48
  76. package/src/helpers/drag-drop/use-droppable.ts +0 -39
  77. package/src/helpers/forwardRef.ts +0 -7
  78. package/src/helpers/hooks-events.ts +0 -150
  79. package/src/helpers/hooks.tsx +0 -175
  80. package/src/helpers/index.ts +0 -8
  81. package/src/helpers/use-alerts.tsx +0 -75
  82. package/src/helpers/use-editable-control.tsx +0 -38
  83. package/src/helpers/use-toast.tsx +0 -30
  84. package/src/index.ts +0 -3
  85. package/src/styles/index.ts +0 -1
  86. package/src/styles/styles.ts +0 -105
  87. package/src/styles/theme.ts +0 -91
@@ -1,122 +0,0 @@
1
- import { Dialog, DialogActions, DialogBody, DialogContent, DialogModalType, DialogSurface, DialogTitle, DialogTrigger, useId } from '@fluentui/react-components';
2
- import { DismissRegular } from '@fluentui/react-icons';
3
- import { isNotEmptyArray, isNullOrEmptyString, noops, PushNoDuplicate, RemoveItemFromArr, stopEvent } from '@kwiz/common';
4
- import React from 'react';
5
- import { useKWIZFluentContext } from '../helpers/context-internal';
6
- import { useKeyDown } from '../helpers/hooks-events';
7
- import { ButtonEX, ButtonEXProps, ButtonEXSecondary } from './button';
8
-
9
- export interface IPrompterProps {
10
- hideOk?: boolean;
11
- hideCancel?: boolean;
12
- showCancelInTitle?: boolean;
13
- /** return false to prevent closing the dialog. */
14
- onOK?: () => Promise<void> | void;
15
- onCancel?: () => void;
16
- /** OK */
17
- okButtonText?: string;
18
- /** Cancel */
19
- cancelButtonText?: string;
20
- title?: string | JSX.Element;
21
- okButtonProps?: Partial<ButtonEXProps>;
22
- cancelButtonProps?: Partial<ButtonEXProps>;
23
- children?: JSX.Element;
24
-
25
- /** allow to epand the dialog to be wider */
26
- maxWidth?: number | string;
27
-
28
- /** additional button actions at the bottom */
29
- actions?: JSX.Element[];
30
-
31
- /** dialog title actions */
32
- titleActions?: JSX.Element[];
33
- /** specify a specific mount node for this dialog */
34
- mountNode?: HTMLElement | null | {
35
- element?: HTMLElement | null;
36
- className?: string;
37
- }
38
-
39
- modalType?: DialogModalType;
40
- /** do not fire ok/cancel on esc/enter press */
41
- disableKeyboardActions?: boolean;
42
- }
43
- const dialogsOrder: string[] = [];
44
- export const Prompter = React.forwardRef<HTMLDivElement, (IPrompterProps)>((props, ref) => {
45
- const ctx = useKWIZFluentContext();
46
- const disableKeyboardActions = React.useRef(props.disableKeyboardActions);
47
- disableKeyboardActions.current = props.disableKeyboardActions;
48
-
49
- const myId = useId();
50
- React.useEffect(() => {
51
- PushNoDuplicate(dialogsOrder, myId);
52
- //cleanup
53
- return () => RemoveItemFromArr(dialogsOrder, myId);
54
- }, [myId]);
55
-
56
- const onOK = props.onOK || noops;
57
- const onCancel = props.onCancel || noops;
58
-
59
- let okProps: ButtonEXProps = {
60
- ...(props.okButtonProps as any || {}),
61
- onClick: () => onOK(),
62
- title: props.okButtonText || 'OK'
63
- };
64
- let cancelProps: ButtonEXProps = {
65
- ...(props.cancelButtonProps as any || {}),
66
- onClick: () => onCancel(),
67
- title: props.cancelButtonText || 'Cancel'
68
- };
69
-
70
- useKeyDown({
71
- onEnter: (e) => {
72
- const topMost = dialogsOrder.indexOf(myId) === dialogsOrder.length - 1;
73
- if (topMost && !disableKeyboardActions.current) {
74
- stopEvent(e);
75
- onOK();
76
- }
77
- },
78
- onEscape: (e) => {
79
- const topMost = dialogsOrder.indexOf(myId) === dialogsOrder.length - 1;
80
- if (topMost && !disableKeyboardActions.current) {
81
- stopEvent(e);
82
- onCancel();
83
- }
84
- }
85
- });
86
-
87
- const actions: JSX.Element[] = [];
88
- if (!props.hideOk) actions.push(<DialogTrigger key='ok' disableButtonEnhancement>
89
- <ButtonEXSecondary {...okProps} />
90
- </DialogTrigger>);
91
- if (!props.hideCancel) actions.push(<DialogTrigger key='cancel' disableButtonEnhancement>
92
- <ButtonEXSecondary {...cancelProps} />
93
- </DialogTrigger>);
94
- if (isNotEmptyArray(props.actions))
95
- actions.push(...props.actions);
96
-
97
- const titleActions: JSX.Element[] = props.titleActions ? [...props.titleActions] : [];
98
- if (props.showCancelInTitle)
99
- titleActions.push(<DialogTrigger key='cancel' disableButtonEnhancement>
100
- <ButtonEX {...cancelProps} icon={<DismissRegular />} />
101
- </DialogTrigger>);
102
-
103
-
104
- return (
105
- <Dialog open modalType={props.modalType}>
106
- <DialogSurface mountNode={props.mountNode || ctx.mountNode}
107
- style={!isNullOrEmptyString(props.maxWidth) ? { maxWidth: props.maxWidth } : undefined}>
108
- <DialogBody>
109
- {(!isNullOrEmptyString(props.title) || isNotEmptyArray(titleActions)) && <DialogTitle
110
- action={titleActions}
111
- >{props.title}</DialogTitle>}
112
- <DialogContent ref={ref}>
113
- {props.children}
114
- </DialogContent>
115
- {isNotEmptyArray(actions) && <DialogActions fluid={actions.length > 2}>
116
- {actions}
117
- </DialogActions>}
118
- </DialogBody>
119
- </DialogSurface>
120
- </Dialog>
121
- );
122
- });
@@ -1,37 +0,0 @@
1
- import { makeStyles } from '@fluentui/react-components';
2
- import { colorToHex } from '@kwiz/common';
3
- import QRCode from 'qrcode';
4
- import React, { useEffect, useRef } from 'react';
5
-
6
- const useStyles = makeStyles({
7
- center: {
8
- justifyContent: 'center'
9
- },
10
- })
11
-
12
- interface IProps {
13
- value: string;
14
- color?: string;
15
- width?: number;
16
- backgroundColor?: string;
17
- foregroundColor?: string;
18
- }
19
- export const QRCodeEX: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
20
- const container = useRef<HTMLCanvasElement>();
21
- useEffect(() => {
22
- if (container.current) {
23
- let dark = props.foregroundColor ? colorToHex(props.foregroundColor) : "#000000ff";
24
- let light = props.backgroundColor ? colorToHex(props.backgroundColor) : "#ffffffff";
25
- QRCode.toCanvas(container.current, props.value, {
26
- color: {
27
- dark,
28
- light
29
- },
30
- width: props.width
31
- });
32
- }
33
- }, [container]);
34
- return (
35
- <canvas ref={container} />
36
- );
37
- }
@@ -1,72 +0,0 @@
1
- import { Input, InputProps, makeStyles, mergeClasses } from '@fluentui/react-components';
2
- import { DismissRegular, SearchRegular } from "@fluentui/react-icons";
3
- import { debounce, isNullOrEmptyString, isNullOrUndefined } from '@kwiz/common';
4
- import React, { useEffect, useRef } from 'react';
5
- import { GetLogger } from '../_modules/config';
6
- import { useEffectOnlyOnMount, useStateEX } from '../helpers';
7
- import { mixins } from '../styles/styles';
8
- const logger = GetLogger("Search");
9
-
10
- const useStyles = makeStyles({
11
- main: mixins.main,
12
- clickable: mixins.clickable,
13
- root: {
14
- },
15
- searchIcon: {
16
- },
17
- });
18
-
19
- interface IProps extends Omit<InputProps, "onChange"> {
20
- main?: boolean;
21
- /** number of seconds to debounce the deferred event */
22
- delay?: number;
23
- /** if changing the value in the caller - change this prop to reset */
24
- resetValue?: string;
25
- onChangeDeferred?: (newValue: string) => void;
26
- onChange?: (newValue: string) => void;
27
- }
28
-
29
- /** value is set on first load. to change the value after it was first set - change the compoenet's key. */
30
- export const Search: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
31
- const cssNames = useStyles();
32
-
33
- let delay = props.delay || 1;
34
-
35
- let refonChangeDeferred = useRef(props.onChangeDeferred);
36
- //keep updating the ref
37
- React.useEffect(() => { refonChangeDeferred.current = props.onChangeDeferred; }, [props.onChangeDeferred]);
38
-
39
- //cannot call debounce every render, since it won't be the same debounced instance...
40
- var notifyParent = React.useCallback(debounce(v => {
41
- logger.log(`Set: ${v}`);
42
- //Call the latest ref - we don't want to call an old version of this function
43
- refonChangeDeferred.current?.(v);
44
- }, delay * 1000), [delay]);
45
-
46
- const [currentValue, setCurrentValue] = useStateEX(props.value || props.defaultValue || "", { skipUpdateIfSame: true });
47
- useEffect(() => {
48
- if (!isNullOrUndefined(props.value))
49
- setCurrentValue(props.value);
50
- }, [props.value]);
51
-
52
- var changeValue = React.useCallback((newValue: string) => {
53
- newValue = newValue || "";//no null or undefined here
54
- setCurrentValue(newValue);//keep our state updated in sync
55
- props.onChange?.(newValue);//if parent is using search as managed control, keep it up to date in sync
56
- notifyParent(newValue);//trigger a search async
57
- }, useEffectOnlyOnMount);
58
-
59
- return (
60
- <Input {...props} autoFocus defaultValue={undefined} value={currentValue} onChange={(e, data) => {
61
- changeValue(data.value);
62
- }}
63
- className={mergeClasses(cssNames.root, props.main && cssNames.main)}
64
- contentBefore={!isNullOrEmptyString(currentValue) ? undefined : <SearchRegular className={cssNames.searchIcon} />}
65
- contentAfter={isNullOrEmptyString(currentValue)
66
- ? undefined
67
- : <DismissRegular className={cssNames.clickable} onClick={() => {
68
- changeValue("");
69
- }} />
70
- } />
71
- );
72
- }
@@ -1,134 +0,0 @@
1
- import { makeStyles, mergeClasses, Portal, tokens } from '@fluentui/react-components';
2
- import { getScrollParent, isFunction, isNotEmptyArray, isNotEmptyString, isNullOrUndefined } from '@kwiz/common';
3
- import React, { useEffect, useState } from 'react';
4
- import { useElementSize, useRefWithState } from '../helpers';
5
- import { useKWIZFluentContext } from '../helpers/context-internal';
6
- import { KnownClassNames, mixins, useCommonStyles } from '../styles/styles';
7
-
8
- const useStyles = makeStyles({
9
- main: mixins.main,
10
- clickable: mixins.clickable,
11
- left: {
12
- ...mixins.float,
13
- float: "left",
14
- marginRight: tokens.spacingHorizontalXXL
15
- },
16
- right: {
17
- ...mixins.float,
18
- float: "right",
19
- marginLeft: tokens.spacingHorizontalXXL
20
- },
21
- sticky: {
22
- ...mixins.box,
23
- position: "sticky",
24
- top: 0,
25
- overflow: "auto",
26
- height: "fit-content",
27
- maxHeight: "fit-content"
28
- },
29
- selfCentered: {
30
- alignSelf: "center"
31
- }
32
- });
33
-
34
-
35
- export interface ISectionProps {
36
- main?: boolean;
37
- css?: string[];
38
- style?: React.CSSProperties;
39
- onClick?: (event: React.MouseEvent<HTMLDivElement, MouseEvent>) => void;
40
- rootProps?: React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>;
41
- title?: string;
42
- left?: boolean;
43
- right?: boolean;
44
- /** set height to match scroll parent's height, and stick to top */
45
- sticky?: boolean;
46
- /** true - will add css position fixed. portal will also wrap it in a portal. */
47
- fullscreen?: boolean | "portal";
48
- centerSelf?: boolean;
49
- }
50
-
51
- export const Section = React.forwardRef<HTMLDivElement, React.PropsWithChildren<ISectionProps>>((props, ref) => {
52
- const ctx = useKWIZFluentContext();
53
- const commonStyles = useCommonStyles();
54
- const cssNames = useStyles();
55
- let css: string[] = [KnownClassNames.section];
56
- if (props.main) css.push(cssNames.main);
57
- if (props.centerSelf) css.push(cssNames.selfCentered);
58
- if (isFunction(props.onClick))
59
- css.push(cssNames.clickable);
60
-
61
- if (props.left) {
62
- css.push(cssNames.left);
63
- css.push(KnownClassNames.left);
64
- }
65
- else if (props.right) {
66
- css.push(cssNames.right);
67
- css.push(KnownClassNames.right);
68
- }
69
- else if (props.sticky) {
70
- css.push(cssNames.sticky);
71
- }
72
-
73
- /** need scrollparent if we are sticky */
74
- const [scrollParent, setScrollParent] = useState<HTMLElement>(null);
75
- const divRef = useRefWithState<HTMLDivElement>();
76
-
77
- //wait for my content to finish loading, it might change scrollparent
78
- const mySize = useElementSize(divRef.ref.current);
79
-
80
- useEffect(() => {
81
- //setting the forwardRef
82
- if (!isNullOrUndefined(ref)) {
83
- if (isFunction(ref)) ref(divRef.ref.current);
84
- else (ref as React.MutableRefObject<HTMLDivElement>).current = divRef.ref.current;
85
- }
86
- }, [divRef.value]);
87
-
88
- useEffect(() => {
89
- if (props.sticky) {
90
- let scrollParent = getScrollParent(divRef.ref.current ? divRef.ref.current.parentElement : null);
91
- setScrollParent(scrollParent);
92
- }
93
- }, [divRef.value, mySize.height]);
94
-
95
- const parentSize = useElementSize(scrollParent);
96
- useEffect(() => {
97
- if (props.sticky && divRef.ref.current) {
98
- let maxHeight = "fit-content";
99
- if (scrollParent) {
100
- let height = parseFloat(getComputedStyle(scrollParent).height);
101
- let myStyle = getComputedStyle(divRef.ref.current);
102
-
103
- let pTop = parseFloat(myStyle.paddingTop);
104
- let pBottom = parseFloat(myStyle.paddingBottom);
105
- let mTop = parseFloat(myStyle.marginTop);
106
- let mBottom = parseFloat(myStyle.marginBottom);
107
- if (pTop > 0) height -= pTop;
108
- if (pBottom > 0) height -= pBottom;
109
- if (mTop > 0) height -= mTop;
110
- if (mBottom > 0) height -= mBottom;
111
-
112
- maxHeight = `${height}px`;
113
- }
114
- divRef.ref.current.style.maxHeight = maxHeight;
115
- }
116
- }, [props.sticky, parentSize.height, divRef.value]);
117
-
118
- //a css class might have space and multiuple classes in it
119
- if (isNotEmptyArray(props.css)) props.css.filter(c => isNotEmptyString(c)).forEach(c => css.push(...c.split(" ")));
120
- if (props.fullscreen) css.push(commonStyles.fullscreen);
121
- const control = <div ref={divRef.set} {...(props.rootProps || {})} title={props.title} style={props.style}
122
- className={mergeClasses(...css)}
123
- onClick={props.onClick}>
124
- {props.children}
125
- </div>;
126
-
127
- return (
128
- props.fullscreen === "portal"
129
- ? <Portal mountNode={ctx.mountNode}>
130
- {control}
131
- </Portal>
132
- : control
133
- );
134
- });
@@ -1,139 +0,0 @@
1
- import { tokens } from '@fluentui/react-components';
2
- import React from 'react';
3
- import { flushSync } from 'react-dom';
4
- import { createRoot } from 'react-dom/client';
5
-
6
- interface IProps {
7
- size: number;
8
- }
9
- export const YouTubeIcon: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
10
- return (
11
- <svg height={`${props.size}px`} width={`${props.size}px`} version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink"
12
- viewBox="0 0 461.001 461.001" xmlSpace="preserve">
13
- <g>
14
- <path style={{ fill: "#F61C0D" }} d="M365.257,67.393H95.744C42.866,67.393,0,110.259,0,163.137v134.728
15
- c0,52.878,42.866,95.744,95.744,95.744h269.513c52.878,0,95.744-42.866,95.744-95.744V163.137
16
- C461.001,110.259,418.135,67.393,365.257,67.393z M300.506,237.056l-126.06,60.123c-3.359,1.602-7.239-0.847-7.239-4.568V168.607
17
- c0-3.774,3.982-6.22,7.348-4.514l126.06,63.881C304.363,229.873,304.298,235.248,300.506,237.056z"/>
18
- </g>
19
- </svg>
20
- );
21
- }
22
-
23
- export const MermaidIcon: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
24
- return (
25
- <svg height={`${props.size}px`} width={`${props.size}px`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 490.16 490.16">
26
- <defs>
27
- <style>{`.mm-cls-1{fill:#ff3670;}.mm-cls-2{fill:#fff;}`}</style></defs>
28
- <rect className="mm-cls-1" width="490.16" height="490.16" rx="84.61" />
29
- <path className="mm-cls-2" d="M407.48,111.18A165.2,165.2,0,0,0,245.08,220,165.2,165.2,0,0,0,82.68,111.18a165.5,165.5,0,0,0,72.06,143.64,88.81,88.81,0,0,1,38.53,73.45v50.86H296.9V328.27a88.8,88.8,0,0,1,38.52-73.45,165.41,165.41,0,0,0,72.06-143.64Z" />
30
- <path className="mm-cls-2" d="M160.63,328.27a56.09,56.09,0,0,0-24.27-46.49,198.74,198.74,0,0,1-28.54-23.66A196.87,196.87,0,0,1,82.53,227V379.13h78.1Z" />
31
- <path className="mm-cls-2" d="M329.53,328.27a56.09,56.09,0,0,1,24.27-46.49,198.74,198.74,0,0,0,28.54-23.66A196.87,196.87,0,0,0,407.63,227V379.13h-78.1Z" />
32
- </svg>
33
- );
34
- }
35
-
36
- export const TeamsIcon: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
37
- return (
38
- <svg height={`${props.size}px`} width={`${props.size}px`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2228.833 2073.333">
39
- <path fill="#5059C9" d="M1554.637,777.5h575.713c54.391,0,98.483,44.092,98.483,98.483c0,0,0,0,0,0v524.398 c0,199.901-162.051,361.952-361.952,361.952h0h-1.711c-199.901,0.028-361.975-162-362.004-361.901c0-0.017,0-0.034,0-0.052V828.971 C1503.167,800.544,1526.211,777.5,1554.637,777.5L1554.637,777.5z" />
40
- <circle fill="#5059C9" cx="1943.75" cy="440.583" r="233.25" />
41
- <circle fill="#7B83EB" cx="1218.083" cy="336.917" r="336.917" />
42
- <path fill="#7B83EB" d="M1667.323,777.5H717.01c-53.743,1.33-96.257,45.931-95.01,99.676v598.105 c-7.505,322.519,247.657,590.16,570.167,598.053c322.51-7.893,577.671-275.534,570.167-598.053V877.176 C1763.579,823.431,1721.066,778.83,1667.323,777.5z" />
43
- <path opacity=".1" d="M1244,777.5v838.145c-0.258,38.435-23.549,72.964-59.09,87.598 c-11.316,4.787-23.478,7.254-35.765,7.257H667.613c-6.738-17.105-12.958-34.21-18.142-51.833 c-18.144-59.477-27.402-121.307-27.472-183.49V877.02c-1.246-53.659,41.198-98.19,94.855-99.52H1244z" />
44
- <path opacity=".2" d="M1192.167,777.5v889.978c-0.002,12.287-2.47,24.449-7.257,35.765 c-14.634,35.541-49.163,58.833-87.598,59.09H691.975c-8.812-17.105-17.105-34.21-24.362-51.833 c-7.257-17.623-12.958-34.21-18.142-51.833c-18.144-59.476-27.402-121.307-27.472-183.49V877.02 c-1.246-53.659,41.198-98.19,94.855-99.52H1192.167z" />
45
- <path opacity=".2" d="M1192.167,777.5v786.312c-0.395,52.223-42.632,94.46-94.855,94.855h-447.84 c-18.144-59.476-27.402-121.307-27.472-183.49V877.02c-1.246-53.659,41.198-98.19,94.855-99.52H1192.167z" />
46
- <path opacity=".2" d="M1140.333,777.5v786.312c-0.395,52.223-42.632,94.46-94.855,94.855H649.472 c-18.144-59.476-27.402-121.307-27.472-183.49V877.02c-1.246-53.659,41.198-98.19,94.855-99.52H1140.333z" />
47
- <path opacity=".1" d="M1244,509.522v163.275c-8.812,0.518-17.105,1.037-25.917,1.037 c-8.812,0-17.105-0.518-25.917-1.037c-17.496-1.161-34.848-3.937-51.833-8.293c-104.963-24.857-191.679-98.469-233.25-198.003 c-7.153-16.715-12.706-34.071-16.587-51.833h258.648C1201.449,414.866,1243.801,457.217,1244,509.522z" />
48
- <path opacity=".2" d="M1192.167,561.355v111.442c-17.496-1.161-34.848-3.937-51.833-8.293 c-104.963-24.857-191.679-98.469-233.25-198.003h190.228C1149.616,466.699,1191.968,509.051,1192.167,561.355z" />
49
- <path opacity=".2" d="M1192.167,561.355v111.442c-17.496-1.161-34.848-3.937-51.833-8.293 c-104.963-24.857-191.679-98.469-233.25-198.003h190.228C1149.616,466.699,1191.968,509.051,1192.167,561.355z" />
50
- <path opacity=".2" d="M1140.333,561.355v103.148c-104.963-24.857-191.679-98.469-233.25-198.003 h138.395C1097.783,466.699,1140.134,509.051,1140.333,561.355z" />
51
- <linearGradient id="a" gradientUnits="userSpaceOnUse" x1="198.099" y1="1683.0726" x2="942.2344" y2="394.2607" gradientTransform="matrix(1 0 0 -1 0 2075.3333)">
52
- <stop offset="0" stopColor="#5a62c3" />
53
- <stop offset=".5" stopColor="#4d55bd" />
54
- <stop offset="1" stopColor="#3940ab" />
55
- </linearGradient>
56
- <path fill="url(#a)" d="M95.01,466.5h950.312c52.473,0,95.01,42.538,95.01,95.01v950.312c0,52.473-42.538,95.01-95.01,95.01 H95.01c-52.473,0-95.01-42.538-95.01-95.01V561.51C0,509.038,42.538,466.5,95.01,466.5z" />
57
- <path fill="#FFF" d="M820.211,828.193H630.241v517.297H509.211V828.193H320.123V727.844h500.088V828.193z" />
58
- </svg>
59
- );
60
- }
61
-
62
- export const SVGLinkIcon = (props: { size: number }) => {
63
- return (
64
- <svg fill={tokens.colorNeutralForeground1} height={`${props.size}px`} width={`${props.size}px`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 490.16 490.16">
65
- <g>
66
- <g>
67
- <path d="M409.657,32.474c-43.146-43.146-113.832-43.146-156.978,0l-84.763,84.762c29.07-8.262,60.589-6.12,88.129,6.732
68
- l44.063-44.064c17.136-17.136,44.982-17.136,62.118,0c17.136,17.136,17.136,44.982,0,62.118l-55.386,55.386l-36.414,36.414
69
- c-17.136,17.136-44.982,17.136-62.119,0l-47.43,47.43c11.016,11.017,23.868,19.278,37.332,24.48
70
- c36.415,14.382,78.643,8.874,110.467-16.219c3.06-2.447,6.426-5.201,9.18-8.262l57.222-57.222l34.578-34.578
71
- C453.109,146.306,453.109,75.926,409.657,32.474z"/>
72
- <path d="M184.135,320.114l-42.228,42.228c-17.136,17.137-44.982,17.137-62.118,0c-17.136-17.136-17.136-44.981,0-62.118
73
- l91.8-91.799c17.136-17.136,44.982-17.136,62.119,0l47.43-47.43c-11.016-11.016-23.868-19.278-37.332-24.48
74
- c-38.25-15.3-83.232-8.262-115.362,20.502c-1.53,1.224-3.06,2.754-4.284,3.978l-91.8,91.799
75
- c-43.146,43.146-43.146,113.832,0,156.979c43.146,43.146,113.832,43.146,156.978,0l82.927-83.845
76
- C230.035,335.719,220.243,334.496,184.135,320.114z"/>
77
- </g>
78
- </g>
79
- </svg>
80
- );
81
- }
82
-
83
- export const SVGSplitIcon = (props: { size: number }) => {
84
- return <svg fill={tokens.colorNeutralForeground1} height={`${props.size}px`} width={`${props.size}px`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17">
85
- <path d="M10.646 13.146l0.707 0.707-2.853 2.854-2.854-2.854 0.707-0.707 1.647 1.647v-3.772h1v3.772l1.646-1.647zM8 2.207v3.772h1v-3.772l1.646 1.646 0.707-0.707-2.853-2.853-2.854 2.853 0.707 0.707 1.647-1.646zM0 8v1h17v-1h-17z" />
86
- </svg>;
87
- }
88
-
89
- export const HubSpotIcon = (props: { size: number }) => {
90
- return <svg fill={tokens.colorNeutralForeground1} height={`${props.size}px`} width={`${props.size}px`} xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
91
- <path d="M267.4 211.6c-25.1 23.7-40.8 57.3-40.8 94.6 0 29.3 9.7 56.3 26 78L203.1 434c-4.4-1.6-9.1-2.5-14-2.5-10.8 0-20.9 4.2-28.5 11.8-7.6 7.6-11.8 17.8-11.8 28.6s4.2 20.9 11.8 28.5c7.6 7.6 17.8 11.6 28.5 11.6 10.8 0 20.9-3.9 28.6-11.6 7.6-7.6 11.8-17.8 11.8-28.5 0-4.2-.6-8.2-1.9-12.1l50-50.2c22 16.9 49.4 26.9 79.3 26.9 71.9 0 130-58.3 130-130.2 0-65.2-47.7-119.2-110.2-128.7V116c17.5-7.4 28.2-23.8 28.2-42.9 0-26.1-20.9-47.9-47-47.9S311.2 47 311.2 73.1c0 19.1 10.7 35.5 28.2 42.9v61.2c-15.2 2.1-29.6 6.7-42.7 13.6-27.6-20.9-117.5-85.7-168.9-124.8 1.2-4.4 2-9 2-13.8C129.8 23.4 106.3 0 77.4 0 48.6 0 25.2 23.4 25.2 52.2c0 28.9 23.4 52.3 52.2 52.3 9.8 0 18.9-2.9 26.8-7.6l163.2 114.7zm89.5 163.6c-38.1 0-69-30.9-69-69s30.9-69 69-69 69 30.9 69 69-30.9 69-69 69z" />
92
- </svg>;
93
- }
94
-
95
-
96
- //get icons as html
97
- export const GetSVGLinkIcon = (props: { size: number }) => {
98
- return (
99
- `<svg fill="${tokens.colorNeutralForeground1}" height="${props.size}px" width="${props.size}px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 490.16 490.16">
100
- <g>
101
- <g>
102
- <path d="M409.657,32.474c-43.146-43.146-113.832-43.146-156.978,0l-84.763,84.762c29.07-8.262,60.589-6.12,88.129,6.732
103
- l44.063-44.064c17.136-17.136,44.982-17.136,62.118,0c17.136,17.136,17.136,44.982,0,62.118l-55.386,55.386l-36.414,36.414
104
- c-17.136,17.136-44.982,17.136-62.119,0l-47.43,47.43c11.016,11.017,23.868,19.278,37.332,24.48
105
- c36.415,14.382,78.643,8.874,110.467-16.219c3.06-2.447,6.426-5.201,9.18-8.262l57.222-57.222l34.578-34.578
106
- C453.109,146.306,453.109,75.926,409.657,32.474z"/>
107
- <path d="M184.135,320.114l-42.228,42.228c-17.136,17.137-44.982,17.137-62.118,0c-17.136-17.136-17.136-44.981,0-62.118
108
- l91.8-91.799c17.136-17.136,44.982-17.136,62.119,0l47.43-47.43c-11.016-11.016-23.868-19.278-37.332-24.48
109
- c-38.25-15.3-83.232-8.262-115.362,20.502c-1.53,1.224-3.06,2.754-4.284,3.978l-91.8,91.799
110
- c-43.146,43.146-43.146,113.832,0,156.979c43.146,43.146,113.832,43.146,156.978,0l82.927-83.845
111
- C230.035,335.719,220.243,334.496,184.135,320.114z"/>
112
- </g>
113
- </g>
114
- </svg>`
115
- );
116
- }
117
-
118
- export const GetSVGSplitIcon = (props: { size: number }) => {
119
- return `<svg fill="${tokens.colorNeutralForeground1}" height="${props.size}px" width="${props.size}px" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 17">
120
- <path d="M10.646 13.146l0.707 0.707-2.853 2.854-2.854-2.854 0.707-0.707 1.647 1.647v-3.772h1v3.772l1.646-1.647zM8 2.207v3.772h1v-3.772l1.646 1.646 0.707-0.707-2.853-2.853-2.854 2.853 0.707 0.707 1.647-1.646zM0 8v1h17v-1h-17z" />
121
- </svg>`;
122
- }
123
-
124
- export function GetSVGCopyIcon(props: { size: number }) {
125
- return (
126
- `<svg fill="var(--colorNeutralForeground1)" width="${props.size}px" height="${props.size}px" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
127
- <path d="M8 2a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h6a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8ZM7 4a1 1 0 0 1 1-1h6a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1V4ZM4 6a2 2 0 0 1 1-1.73V14.5A2.5 2.5 0 0 0 7.5 17h6.23A2 2 0 0 1 12 18H7.5A3.5 3.5 0 0 1 4 14.5V6Z"></path>
128
- </svg>`
129
- )
130
- }
131
-
132
- export function IconToSVG(icon: JSX.Element) {
133
- const iconDiv = document.createElement('div');
134
- const root = createRoot(iconDiv);
135
- flushSync(() => {
136
- root.render(icon);
137
- });
138
- return iconDiv.innerHTML;
139
- }
@@ -1,47 +0,0 @@
1
- import { Toolbar, ToolbarDivider, ToolbarGroup } from '@fluentui/react-components';
2
- import React from 'react';
3
- import { KnownClassNames } from '../styles/styles';
4
- import { KWIZOverflow } from './kwizoverflow';
5
-
6
- interface IProps {
7
- /** toolbar buttons that may render or render in overflow */
8
- buttonGroups: { elm: JSX.Element, overflowElement?: JSX.Element }[][];
9
- /** side buttons that will always render, never overflow */
10
- sideButtons?: JSX.Element;
11
- }
12
- export const ToolbarEX: React.FunctionComponent<IProps> = (props) => {
13
- let elements: { id: string, priority?: number, elm: JSX.Element, overflowElement?: JSX.Element }[] = [];
14
- props.buttonGroups.forEach((group, groupIndex) => {
15
- group.forEach((button, buttonIndex) => {
16
- const mapped = { ...button, id: `m${groupIndex}-${buttonIndex}` };
17
- if (buttonIndex === 0 && groupIndex > 0 && props.buttonGroups[groupIndex - 1].length > 0) {
18
- //first button, not first group, and previous group was not empty
19
- //add divider
20
- mapped.overflowElement = mapped.overflowElement || mapped.elm;
21
- //this way if button rendes it is with the divider, but if it is in overflow - there will be no divider
22
- mapped.elm = <span>
23
- <ToolbarDivider style={{ display: 'inline-flex' }} />
24
- {mapped.elm}
25
- </span>;
26
-
27
- }
28
- elements.push(mapped);
29
- })
30
- });
31
-
32
- return (
33
- <KWIZOverflow className={KnownClassNames.printHide}
34
- items={elements}
35
- getKey={e => e.id}
36
- renderItem={(e, i, overflow) => overflow && e.overflowElement || e.elm}
37
- getPriority={e => e.priority || -1}
38
- groupWrapper={children => <Toolbar aria-label="Default" style={{ justifyContent: "space-between" }}>
39
- <ToolbarGroup role="presentation">
40
- {children}
41
- </ToolbarGroup>
42
- <ToolbarGroup role="presentation">
43
- {props.sideButtons}
44
- </ToolbarGroup>
45
- </Toolbar>}
46
- />);
47
- }
@@ -1,50 +0,0 @@
1
- import { makeStyles, mergeClasses } from '@fluentui/react-components';
2
- import { isNotEmptyArray } from '@kwiz/common';
3
- import React from 'react';
4
- import { useWindowSize } from '../helpers';
5
-
6
- const useStyles = makeStyles({
7
- verticalContainer: {
8
- position: "relative",
9
- ['& > div']: {
10
- position: "absolute",
11
- transform: "rotate(90deg)"
12
- }
13
- }
14
- });
15
-
16
- interface IProps {
17
- css?: string[];
18
- }
19
- export const VerticalContent: React.FunctionComponent<React.PropsWithChildren<IProps>> = (props) => {
20
- const classes = useStyles();
21
- let css: string[] = [classes.verticalContainer];
22
- const size = useWindowSize();
23
-
24
- let div = React.useRef();
25
- let rotate = React.useRef();
26
-
27
- if (isNotEmptyArray(props.css)) css.push(...props.css);
28
-
29
- React.useEffect(() => {
30
- if (div.current && rotate.current) {
31
- let rootDiv = (div.current as HTMLDivElement);
32
- let rotateDiv = (rotate.current as HTMLDivElement);
33
- rootDiv.style.height = `${rotateDiv.clientWidth}px`;
34
- rootDiv.style.width = `${rotateDiv.clientHeight}px`;
35
- rootDiv.style.minHeight = `${rotateDiv.clientWidth}px`;
36
- rootDiv.style.minWidth = `${rotateDiv.clientHeight}px`;
37
-
38
- rotateDiv.style.top = `${(rotateDiv.clientWidth - rotateDiv.clientHeight) / 2}px`;
39
- rotateDiv.style.left = `-${(rotateDiv.clientWidth - rotateDiv.clientHeight) / 2}px`;
40
- }
41
- }, [div, rotate, size.height, size.width]);
42
-
43
- return (
44
- <div ref={div} className={mergeClasses(...css)}>
45
- <div ref={rotate}>
46
- {props.children}
47
- </div>
48
- </div>
49
- );
50
- }
@@ -1,43 +0,0 @@
1
- import { makeStyles } from '@fluentui/react-components';
2
- import { isNotEmptyArray } from '@kwiz/common';
3
- import React from 'react';
4
- import { KnownClassNames, mixins } from '../styles/styles';
5
- import { ISectionProps, Section } from './section';
6
-
7
- const useStyles = makeStyles({
8
- vertical: {
9
- ...mixins.flex,
10
- flexDirection: 'column'
11
- },
12
- wrap: mixins.wrap,
13
- nogap: mixins.nogap,
14
- vCentered: {
15
- justifyContent: "center"
16
- },
17
-
18
- })
19
-
20
- interface IProps extends ISectionProps {
21
- wrap?: boolean;
22
- nogap?: boolean;
23
- /** vertical centered */
24
- vCentered?: boolean;
25
- }
26
- export const Vertical = React.forwardRef<HTMLDivElement, React.PropsWithChildren<IProps>>((props, ref) => {
27
- const cssNames = useStyles();
28
- let css: string[] = [KnownClassNames.vertical];
29
-
30
- css.push(cssNames.vertical);
31
- if (props.wrap)
32
- css.push(cssNames.wrap);
33
- if (props.nogap)
34
- css.push(cssNames.nogap);
35
- if (props.vCentered)
36
- css.push(cssNames.vCentered);
37
-
38
- if (isNotEmptyArray(props.css)) css.push(...props.css);
39
-
40
- return (
41
- <Section {...props} css={css} ref={ref} />
42
- );
43
- });