@kwiz/fluentui 1.0.73 → 1.0.75

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 (92) hide show
  1. package/.github/workflows/npm-publish.yml +24 -24
  2. package/LICENSE +21 -21
  3. package/README.md +53 -53
  4. package/dist/@types/forwardRef.d.ts +0 -0
  5. package/dist/@types/forwardRef.js +1 -0
  6. package/dist/@types/forwardRef.js.map +1 -0
  7. package/dist/controls/error-boundary copy.d.ts +23 -0
  8. package/dist/controls/error-boundary copy.js +33 -0
  9. package/dist/controls/error-boundary copy.js.map +1 -0
  10. package/dist/controls/menu.js +2 -2
  11. package/dist/controls/menu.js.map +1 -1
  12. package/dist/controls/search.js +19 -11
  13. package/dist/controls/search.js.map +1 -1
  14. package/dist/controls/svg.js +21 -21
  15. package/dist/controls/svg.js.map +1 -1
  16. package/dist/helpers/common.d.ts +4 -0
  17. package/dist/helpers/common.js +2 -0
  18. package/dist/helpers/common.js.map +1 -0
  19. package/dist/helpers/context.d.ts +26 -0
  20. package/dist/helpers/context.js +15 -0
  21. package/dist/helpers/context.js.map +1 -0
  22. package/dist/helpers/drag-drop/exports.d.ts +12 -0
  23. package/dist/helpers/drag-drop/exports.js +3 -0
  24. package/dist/helpers/drag-drop/exports.js.map +1 -0
  25. package/dist/helpers/exports.d.ts +7 -0
  26. package/dist/helpers/exports.js +8 -0
  27. package/dist/helpers/exports.js.map +1 -0
  28. package/dist/helpers/use-editable-control.d.ts +1 -1
  29. package/dist/helpers/use-editable-control.js.map +1 -1
  30. package/package.json +85 -84
  31. package/src/_modules/config.ts +9 -9
  32. package/src/_modules/constants.ts +3 -3
  33. package/src/controls/ColorPickerDialog.tsx +83 -83
  34. package/src/controls/accordion.tsx +62 -62
  35. package/src/controls/button.tsx +180 -180
  36. package/src/controls/canvas/CustomEventTargetBase.ts +32 -32
  37. package/src/controls/canvas/DrawPad.tsx +296 -296
  38. package/src/controls/canvas/DrawPadManager.ts +694 -694
  39. package/src/controls/canvas/bezier.ts +109 -109
  40. package/src/controls/canvas/point.ts +44 -44
  41. package/src/controls/card-list.tsx +31 -31
  42. package/src/controls/card.tsx +77 -77
  43. package/src/controls/centered.tsx +14 -14
  44. package/src/controls/date.tsx +87 -87
  45. package/src/controls/diagram-picker.tsx +96 -96
  46. package/src/controls/divider.tsx +15 -15
  47. package/src/controls/dropdown.tsx +66 -66
  48. package/src/controls/error-boundary.tsx +41 -41
  49. package/src/controls/field-editor.tsx +42 -42
  50. package/src/controls/file-upload.tsx +155 -155
  51. package/src/controls/horizontal.tsx +48 -48
  52. package/src/controls/html-editor/editor.tsx +182 -182
  53. package/src/controls/index.ts +33 -33
  54. package/src/controls/input.tsx +160 -160
  55. package/src/controls/kwizoverflow.tsx +106 -106
  56. package/src/controls/list.tsx +119 -119
  57. package/src/controls/loading.tsx +10 -10
  58. package/src/controls/menu.tsx +173 -173
  59. package/src/controls/merge-text.tsx +126 -126
  60. package/src/controls/please-wait.tsx +32 -32
  61. package/src/controls/progress-bar.tsx +109 -109
  62. package/src/controls/prompt.tsx +121 -121
  63. package/src/controls/qrcode.tsx +36 -36
  64. package/src/controls/search.tsx +71 -61
  65. package/src/controls/section.tsx +133 -133
  66. package/src/controls/svg.tsx +138 -138
  67. package/src/controls/toolbar.tsx +46 -46
  68. package/src/controls/vertical-content.tsx +49 -49
  69. package/src/controls/vertical.tsx +42 -42
  70. package/src/helpers/block-nav.tsx +88 -88
  71. package/src/helpers/context-const.ts +29 -29
  72. package/src/helpers/context-export.tsx +77 -77
  73. package/src/helpers/context-internal.ts +13 -13
  74. package/src/helpers/drag-drop/drag-drop-container.tsx +53 -53
  75. package/src/helpers/drag-drop/drag-drop-context-internal.tsx +9 -9
  76. package/src/helpers/drag-drop/drag-drop-context.tsx +61 -61
  77. package/src/helpers/drag-drop/drag-drop.types.ts +21 -21
  78. package/src/helpers/drag-drop/index.ts +12 -12
  79. package/src/helpers/drag-drop/readme.md +75 -75
  80. package/src/helpers/drag-drop/use-draggable.ts +47 -47
  81. package/src/helpers/drag-drop/use-droppable.ts +38 -38
  82. package/src/helpers/forwardRef.ts +7 -7
  83. package/src/helpers/hooks-events.ts +149 -149
  84. package/src/helpers/hooks.tsx +141 -141
  85. package/src/helpers/index.ts +8 -8
  86. package/src/helpers/use-alerts.tsx +74 -74
  87. package/src/helpers/use-editable-control.tsx +37 -37
  88. package/src/helpers/use-toast.tsx +29 -29
  89. package/src/index.ts +2 -2
  90. package/src/styles/index.ts +1 -1
  91. package/src/styles/styles.ts +104 -104
  92. package/src/styles/theme.ts +90 -90
@@ -1,134 +1,134 @@
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
- );
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
134
  });
@@ -1,139 +1,139 @@
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;
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
139
  }