@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.
- package/.github/workflows/npm-publish.yml +24 -24
- package/LICENSE +21 -21
- package/README.md +53 -53
- package/dist/@types/forwardRef.d.ts +0 -0
- package/dist/@types/forwardRef.js +1 -0
- package/dist/@types/forwardRef.js.map +1 -0
- package/dist/controls/error-boundary copy.d.ts +23 -0
- package/dist/controls/error-boundary copy.js +33 -0
- package/dist/controls/error-boundary copy.js.map +1 -0
- package/dist/controls/menu.js +2 -2
- package/dist/controls/menu.js.map +1 -1
- package/dist/controls/search.js +19 -11
- package/dist/controls/search.js.map +1 -1
- package/dist/controls/svg.js +21 -21
- package/dist/controls/svg.js.map +1 -1
- package/dist/helpers/common.d.ts +4 -0
- package/dist/helpers/common.js +2 -0
- package/dist/helpers/common.js.map +1 -0
- package/dist/helpers/context.d.ts +26 -0
- package/dist/helpers/context.js +15 -0
- package/dist/helpers/context.js.map +1 -0
- package/dist/helpers/drag-drop/exports.d.ts +12 -0
- package/dist/helpers/drag-drop/exports.js +3 -0
- package/dist/helpers/drag-drop/exports.js.map +1 -0
- package/dist/helpers/exports.d.ts +7 -0
- package/dist/helpers/exports.js +8 -0
- package/dist/helpers/exports.js.map +1 -0
- package/dist/helpers/use-editable-control.d.ts +1 -1
- package/dist/helpers/use-editable-control.js.map +1 -1
- package/package.json +85 -84
- package/src/_modules/config.ts +9 -9
- package/src/_modules/constants.ts +3 -3
- package/src/controls/ColorPickerDialog.tsx +83 -83
- package/src/controls/accordion.tsx +62 -62
- package/src/controls/button.tsx +180 -180
- package/src/controls/canvas/CustomEventTargetBase.ts +32 -32
- package/src/controls/canvas/DrawPad.tsx +296 -296
- package/src/controls/canvas/DrawPadManager.ts +694 -694
- package/src/controls/canvas/bezier.ts +109 -109
- package/src/controls/canvas/point.ts +44 -44
- package/src/controls/card-list.tsx +31 -31
- package/src/controls/card.tsx +77 -77
- package/src/controls/centered.tsx +14 -14
- package/src/controls/date.tsx +87 -87
- package/src/controls/diagram-picker.tsx +96 -96
- package/src/controls/divider.tsx +15 -15
- package/src/controls/dropdown.tsx +66 -66
- package/src/controls/error-boundary.tsx +41 -41
- package/src/controls/field-editor.tsx +42 -42
- package/src/controls/file-upload.tsx +155 -155
- package/src/controls/horizontal.tsx +48 -48
- package/src/controls/html-editor/editor.tsx +182 -182
- package/src/controls/index.ts +33 -33
- package/src/controls/input.tsx +160 -160
- package/src/controls/kwizoverflow.tsx +106 -106
- package/src/controls/list.tsx +119 -119
- package/src/controls/loading.tsx +10 -10
- package/src/controls/menu.tsx +173 -173
- package/src/controls/merge-text.tsx +126 -126
- package/src/controls/please-wait.tsx +32 -32
- package/src/controls/progress-bar.tsx +109 -109
- package/src/controls/prompt.tsx +121 -121
- package/src/controls/qrcode.tsx +36 -36
- package/src/controls/search.tsx +71 -61
- package/src/controls/section.tsx +133 -133
- package/src/controls/svg.tsx +138 -138
- package/src/controls/toolbar.tsx +46 -46
- package/src/controls/vertical-content.tsx +49 -49
- package/src/controls/vertical.tsx +42 -42
- package/src/helpers/block-nav.tsx +88 -88
- package/src/helpers/context-const.ts +29 -29
- package/src/helpers/context-export.tsx +77 -77
- package/src/helpers/context-internal.ts +13 -13
- package/src/helpers/drag-drop/drag-drop-container.tsx +53 -53
- package/src/helpers/drag-drop/drag-drop-context-internal.tsx +9 -9
- package/src/helpers/drag-drop/drag-drop-context.tsx +61 -61
- package/src/helpers/drag-drop/drag-drop.types.ts +21 -21
- package/src/helpers/drag-drop/index.ts +12 -12
- package/src/helpers/drag-drop/readme.md +75 -75
- package/src/helpers/drag-drop/use-draggable.ts +47 -47
- package/src/helpers/drag-drop/use-droppable.ts +38 -38
- package/src/helpers/forwardRef.ts +7 -7
- package/src/helpers/hooks-events.ts +149 -149
- package/src/helpers/hooks.tsx +141 -141
- package/src/helpers/index.ts +8 -8
- package/src/helpers/use-alerts.tsx +74 -74
- package/src/helpers/use-editable-control.tsx +37 -37
- package/src/helpers/use-toast.tsx +29 -29
- package/src/index.ts +2 -2
- package/src/styles/index.ts +1 -1
- package/src/styles/styles.ts +104 -104
- package/src/styles/theme.ts +90 -90
@@ -4,7 +4,7 @@ export declare function useEditableControl(): {
|
|
4
4
|
setHasChanges: (newValue: import("react").SetStateAction<boolean>) => Promise<boolean>;
|
5
5
|
onSaveChanges: (worker: () => Promise<{
|
6
6
|
success: boolean;
|
7
|
-
message
|
7
|
+
message?: string;
|
8
8
|
}>) => Promise<void>;
|
9
9
|
editablePageElement: import("react/jsx-runtime").JSX.Element;
|
10
10
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-editable-control.js","sourceRoot":"","sources":["../../src/helpers/use-editable-control.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D,gJAAgJ;AAChJ,MAAM,UAAU,kBAAkB;IAC9B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjG,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,WAAW,CAAC,CAAO,
|
1
|
+
{"version":3,"file":"use-editable-control.js","sourceRoot":"","sources":["../../src/helpers/use-editable-control.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3D,gJAAgJ;AAChJ,MAAM,UAAU,kBAAkB;IAC9B,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC,KAAK,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;IAEjG,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;IACnC,MAAM,EAAE,aAAa,EAAE,GAAG,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,WAAW,CAAC,CAAO,MAA8D,EAAE,EAAE;QACvG,eAAe,CAAC,IAAI,CAAC,CAAC;QACtB,MAAM,OAAO,GAAG,MAAM,MAAM,EAAE,CAAC;QAC/B,eAAe,CAAC,KAAK,CAAC,CAAC;QAEvB,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC3B,aAAa,CAAC,KAAC,KAAK,cAChB,KAAC,UAAU,cAAE,OAAO,CAAC,OAAO,IAAI,8BAA8B,GAAc,GACxE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;QACrD,CAAC;aACI,CAAC;YACF,aAAa,CAAC,KAAK,CAAC,CAAC;YACrB,aAAa,CAAC,KAAC,KAAK,cAChB,KAAC,UAAU,cAAE,OAAO,CAAC,OAAO,IAAI,gBAAgB,GAAc,GAC1D,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACpD,CAAC;IACL,CAAC,CAAA,EAAE,oBAAoB,CAAC,CAAC;IAEzB,OAAO;QACH,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,mBAAmB,EAAE,8BACzE,YAAY,IAAI,KAAC,UAAU,KAAG,EAC/B,KAAC,OAAO,IAAC,SAAS,EAAE,SAAS,GAAI,IAClC;KACN,CAAC;AACN,CAAC"}
|
package/package.json
CHANGED
@@ -1,84 +1,85 @@
|
|
1
|
-
{
|
2
|
-
"name": "@kwiz/fluentui",
|
3
|
-
"version": "1.0.
|
4
|
-
"description": "KWIZ common controls for FluentUI",
|
5
|
-
"module": "dist/index.js",
|
6
|
-
"types": "dist/index.d.ts",
|
7
|
-
"exports": {
|
8
|
-
".": {
|
9
|
-
"types": "./dist/index.d.ts",
|
10
|
-
"import": "./dist/index.js",
|
11
|
-
"default": "./dist/index.js"
|
12
|
-
},
|
13
|
-
"./package.json": "./package.json"
|
14
|
-
},
|
15
|
-
"scripts": {
|
16
|
-
"watch": "tsc -watch",
|
17
|
-
"build": "npm run test && tsc",
|
18
|
-
"build-explain": "tsc --explainFiles",
|
19
|
-
"check-dependencies": "madge --circular ./src",
|
20
|
-
"create-link": "npm link",
|
21
|
-
"test": "depcruise src && node --import tsx --test src",
|
22
|
-
"link-local-kwiz": "npm link @kwiz/common",
|
23
|
-
"__update-kwiz-packages": "npm install @kwiz/common@latest",
|
24
|
-
"npm-v-patch": "npm version patch && git push origin main:main && git push --tags",
|
25
|
-
"npm-v-major": "npm version major && git push origin main:main && git push --tags",
|
26
|
-
"npm-publish": "npm publish --access public",
|
27
|
-
"reset-repo": "git fetch origin && git reset --hard origin/main"
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
"
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
"
|
36
|
-
|
37
|
-
|
38
|
-
"
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
"
|
43
|
-
|
44
|
-
"
|
45
|
-
|
46
|
-
|
47
|
-
"
|
48
|
-
"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
"
|
53
|
-
|
54
|
-
"
|
55
|
-
"
|
56
|
-
"
|
57
|
-
"
|
58
|
-
"
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
"@fluentui/react-
|
63
|
-
"@
|
64
|
-
"@
|
65
|
-
"@mismerge/
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"jodit
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"react-dnd
|
73
|
-
"react-
|
74
|
-
"
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
"@fluentui/react-
|
79
|
-
"@
|
80
|
-
"@types/react
|
81
|
-
"react": ">=16.
|
82
|
-
"react
|
83
|
-
|
84
|
-
}
|
1
|
+
{
|
2
|
+
"name": "@kwiz/fluentui",
|
3
|
+
"version": "1.0.75",
|
4
|
+
"description": "KWIZ common controls for FluentUI",
|
5
|
+
"module": "dist/index.js",
|
6
|
+
"types": "dist/index.d.ts",
|
7
|
+
"exports": {
|
8
|
+
".": {
|
9
|
+
"types": "./dist/index.d.ts",
|
10
|
+
"import": "./dist/index.js",
|
11
|
+
"default": "./dist/index.js"
|
12
|
+
},
|
13
|
+
"./package.json": "./package.json"
|
14
|
+
},
|
15
|
+
"scripts": {
|
16
|
+
"watch": "tsc -watch",
|
17
|
+
"build": "npm run test && tsc",
|
18
|
+
"build-explain": "tsc --explainFiles",
|
19
|
+
"check-dependencies": "madge --circular ./src",
|
20
|
+
"create-link": "npm link",
|
21
|
+
"test": "depcruise src && node --import tsx --test src",
|
22
|
+
"link-local-kwiz": "npm link @kwiz/common",
|
23
|
+
"__update-kwiz-packages": "npm install @kwiz/common@latest",
|
24
|
+
"npm-v-patch": "npm version patch && git push origin main:main && git push --tags",
|
25
|
+
"npm-v-major": "npm version major && git push origin main:main && git push --tags",
|
26
|
+
"npm-publish": "npm publish --access public",
|
27
|
+
"reset-repo": "git fetch origin && git reset --hard origin/main",
|
28
|
+
"clear-npm-cache": "npm cache clean --force"
|
29
|
+
},
|
30
|
+
"repository": {
|
31
|
+
"type": "git",
|
32
|
+
"url": "git+https://github.com/KWizCom/fluentui.git"
|
33
|
+
},
|
34
|
+
"keywords": [
|
35
|
+
"KWIZ",
|
36
|
+
"FluentUI"
|
37
|
+
],
|
38
|
+
"author": "Shai Petel",
|
39
|
+
"contributors": [
|
40
|
+
"Shai Petel"
|
41
|
+
],
|
42
|
+
"license": "MIT",
|
43
|
+
"bugs": {
|
44
|
+
"url": "https://github.com/KWizCom/fluentui/issues",
|
45
|
+
"email": "support@kwizcom.com"
|
46
|
+
},
|
47
|
+
"homepage": "https://github.com/KWizCom/fluentui#readme",
|
48
|
+
"private": false,
|
49
|
+
"engines": {
|
50
|
+
"node": ">=16"
|
51
|
+
},
|
52
|
+
"packageManager": "npm@9.5.1",
|
53
|
+
"devDependencies": {
|
54
|
+
"@types/qrcode": "^1.5.5",
|
55
|
+
"dependency-cruiser": "^16.8.0",
|
56
|
+
"fs-extra": "^11.2.0",
|
57
|
+
"madge": "^6.1.0",
|
58
|
+
"tsx": "^4.7.1",
|
59
|
+
"typescript": "^5.3.3"
|
60
|
+
},
|
61
|
+
"dependencies": {
|
62
|
+
"@fluentui/react-datepicker-compat": "^0.4.53",
|
63
|
+
"@fluentui/react-timepicker-compat": "^0.2.42",
|
64
|
+
"@kwiz/common": "^1.0.120",
|
65
|
+
"@mismerge/core": "^1.2.1",
|
66
|
+
"@mismerge/react": "^1.0.1",
|
67
|
+
"esbuild": "^0.19.12",
|
68
|
+
"get-tsconfig": "^4.7.2",
|
69
|
+
"jodit": "^4.2.47",
|
70
|
+
"jodit-react": "^4.1.2",
|
71
|
+
"qrcode": "^1.5.4",
|
72
|
+
"react-dnd": "^16.0.1",
|
73
|
+
"react-dnd-html5-backend": "^16.0.1",
|
74
|
+
"react-pick-color": "^2.0.0",
|
75
|
+
"resolve-pkg-maps": "^1.0.0"
|
76
|
+
},
|
77
|
+
"peerDependencies": {
|
78
|
+
"@fluentui/react-components": ">=9.54.17 <10.0.0",
|
79
|
+
"@fluentui/react-icons": "^2.0.269",
|
80
|
+
"@types/react": ">=16.14.0 <19.0.0",
|
81
|
+
"@types/react-dom": ">=16.9.0 <19.0.0",
|
82
|
+
"react": ">=16.14.0 <19.0.0",
|
83
|
+
"react-dom": ">=16.14.0 <19.0.0"
|
84
|
+
}
|
85
|
+
}
|
package/src/_modules/config.ts
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
import { config } from "@kwiz/common";
|
2
|
-
import { BuildNumber, ReleaseStatus } from "./constants";
|
3
|
-
|
4
|
-
export const { logger: GetLogger } = config({
|
5
|
-
BuildNumber: BuildNumber,
|
6
|
-
IsLocalDev: false,
|
7
|
-
ReleaseStatus: ReleaseStatus,
|
8
|
-
ProjectName: "[fluentui]"
|
9
|
-
});
|
1
|
+
import { config } from "@kwiz/common";
|
2
|
+
import { BuildNumber, ReleaseStatus } from "./constants";
|
3
|
+
|
4
|
+
export const { logger: GetLogger } = config({
|
5
|
+
BuildNumber: BuildNumber,
|
6
|
+
IsLocalDev: false,
|
7
|
+
ReleaseStatus: ReleaseStatus,
|
8
|
+
ProjectName: "[fluentui]"
|
9
|
+
});
|
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
export var BuildNumber = 'unset';
|
3
|
-
export const ReleaseStatus = "npm";
|
1
|
+
|
2
|
+
export var BuildNumber = 'unset';
|
3
|
+
export const ReleaseStatus = "npm";
|
@@ -1,84 +1,84 @@
|
|
1
|
-
import { Field } from "@fluentui/react-components";
|
2
|
-
import { ColorRegular } from "@fluentui/react-icons";
|
3
|
-
import { isFunction, isNullOrEmptyString, isNumber } from "@kwiz/common";
|
4
|
-
import * as React from "react";
|
5
|
-
import ColorPicker, { Color } from 'react-pick-color';
|
6
|
-
import { useEffectOnlyOnMount, useStateEX } from "../helpers";
|
7
|
-
import { ButtonEX } from "./button";
|
8
|
-
import { InputEx } from "./input";
|
9
|
-
import { Prompter } from "./prompt";
|
10
|
-
export interface iProps {
|
11
|
-
label?: string;
|
12
|
-
value: string;
|
13
|
-
onChange: (newValue: string) => void;
|
14
|
-
required?: boolean;
|
15
|
-
showValidationErrors?: boolean;
|
16
|
-
underlined?: boolean;
|
17
|
-
width?: number;
|
18
|
-
buttonOnly?: boolean;
|
19
|
-
placeholder?: string;
|
20
|
-
disabled?: boolean;
|
21
|
-
|
22
|
-
/** specify a specific mount node for this dialog */
|
23
|
-
mountNode?: HTMLElement | null | {
|
24
|
-
element?: HTMLElement | null;
|
25
|
-
className?: string;
|
26
|
-
}
|
27
|
-
}
|
28
|
-
|
29
|
-
export const ColorPickerEx: React.FunctionComponent<iProps> = (props) => {
|
30
|
-
const [isOpen, setIsOpen] = useStateEX<boolean>(false);
|
31
|
-
const [selectedColor, setSelectedColor] = useStateEX<string>(props.value);
|
32
|
-
|
33
|
-
const getColorCells = React.useCallback(() => {
|
34
|
-
let cells: Color[] = [
|
35
|
-
"white", "black"
|
36
|
-
];
|
37
|
-
return cells;
|
38
|
-
}, useEffectOnlyOnMount);
|
39
|
-
return <>
|
40
|
-
{props.buttonOnly
|
41
|
-
? <ButtonEX disabled={props.disabled}
|
42
|
-
title="Open color picker"
|
43
|
-
icon={<ColorRegular
|
44
|
-
color={selectedColor} />
|
45
|
-
}
|
46
|
-
onClick={(e) => setIsOpen(true)} />
|
47
|
-
: <Field label={props.label}
|
48
|
-
required={props.required === true}
|
49
|
-
validationMessage={props.showValidationErrors && props.required === true && isNullOrEmptyString(selectedColor) ? "You can't leave this blank." : undefined}
|
50
|
-
>
|
51
|
-
<InputEx disabled={props.disabled}
|
52
|
-
placeholder={props.placeholder || "Enter value here"}
|
53
|
-
style={isNumber(props.width) ? { width: props.width } : undefined}
|
54
|
-
value={selectedColor}
|
55
|
-
onChange={(e, data) => {
|
56
|
-
setSelectedColor(data.value);
|
57
|
-
if (isFunction(props.onChange)) {
|
58
|
-
props.onChange(data.value);
|
59
|
-
}
|
60
|
-
}}
|
61
|
-
contentAfter={<ButtonEX disabled={props.disabled}
|
62
|
-
title="Open color picker"
|
63
|
-
icon={<ColorRegular
|
64
|
-
color={selectedColor} />
|
65
|
-
}
|
66
|
-
onClick={(e) => setIsOpen(true)} />
|
67
|
-
}
|
68
|
-
/>
|
69
|
-
</Field>}
|
70
|
-
{isOpen && <Prompter maxWidth={332} mountNode={props.mountNode}
|
71
|
-
hideOk hideCancel onCancel={() => {
|
72
|
-
if (isFunction(props.onChange)) {
|
73
|
-
props.onChange(selectedColor);
|
74
|
-
}
|
75
|
-
setIsOpen(false);
|
76
|
-
}} showCancelInTitle
|
77
|
-
title={props.label || "Choose a color"}
|
78
|
-
>
|
79
|
-
<ColorPicker color={selectedColor} onChange={color => setSelectedColor(color.hex)}
|
80
|
-
presets={getColorCells()}
|
81
|
-
/>
|
82
|
-
</Prompter>}
|
83
|
-
</>;
|
1
|
+
import { Field } from "@fluentui/react-components";
|
2
|
+
import { ColorRegular } from "@fluentui/react-icons";
|
3
|
+
import { isFunction, isNullOrEmptyString, isNumber } from "@kwiz/common";
|
4
|
+
import * as React from "react";
|
5
|
+
import ColorPicker, { Color } from 'react-pick-color';
|
6
|
+
import { useEffectOnlyOnMount, useStateEX } from "../helpers";
|
7
|
+
import { ButtonEX } from "./button";
|
8
|
+
import { InputEx } from "./input";
|
9
|
+
import { Prompter } from "./prompt";
|
10
|
+
export interface iProps {
|
11
|
+
label?: string;
|
12
|
+
value: string;
|
13
|
+
onChange: (newValue: string) => void;
|
14
|
+
required?: boolean;
|
15
|
+
showValidationErrors?: boolean;
|
16
|
+
underlined?: boolean;
|
17
|
+
width?: number;
|
18
|
+
buttonOnly?: boolean;
|
19
|
+
placeholder?: string;
|
20
|
+
disabled?: boolean;
|
21
|
+
|
22
|
+
/** specify a specific mount node for this dialog */
|
23
|
+
mountNode?: HTMLElement | null | {
|
24
|
+
element?: HTMLElement | null;
|
25
|
+
className?: string;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
export const ColorPickerEx: React.FunctionComponent<iProps> = (props) => {
|
30
|
+
const [isOpen, setIsOpen] = useStateEX<boolean>(false);
|
31
|
+
const [selectedColor, setSelectedColor] = useStateEX<string>(props.value);
|
32
|
+
|
33
|
+
const getColorCells = React.useCallback(() => {
|
34
|
+
let cells: Color[] = [
|
35
|
+
"white", "black"
|
36
|
+
];
|
37
|
+
return cells;
|
38
|
+
}, useEffectOnlyOnMount);
|
39
|
+
return <>
|
40
|
+
{props.buttonOnly
|
41
|
+
? <ButtonEX disabled={props.disabled}
|
42
|
+
title="Open color picker"
|
43
|
+
icon={<ColorRegular
|
44
|
+
color={selectedColor} />
|
45
|
+
}
|
46
|
+
onClick={(e) => setIsOpen(true)} />
|
47
|
+
: <Field label={props.label}
|
48
|
+
required={props.required === true}
|
49
|
+
validationMessage={props.showValidationErrors && props.required === true && isNullOrEmptyString(selectedColor) ? "You can't leave this blank." : undefined}
|
50
|
+
>
|
51
|
+
<InputEx disabled={props.disabled}
|
52
|
+
placeholder={props.placeholder || "Enter value here"}
|
53
|
+
style={isNumber(props.width) ? { width: props.width } : undefined}
|
54
|
+
value={selectedColor}
|
55
|
+
onChange={(e, data) => {
|
56
|
+
setSelectedColor(data.value);
|
57
|
+
if (isFunction(props.onChange)) {
|
58
|
+
props.onChange(data.value);
|
59
|
+
}
|
60
|
+
}}
|
61
|
+
contentAfter={<ButtonEX disabled={props.disabled}
|
62
|
+
title="Open color picker"
|
63
|
+
icon={<ColorRegular
|
64
|
+
color={selectedColor} />
|
65
|
+
}
|
66
|
+
onClick={(e) => setIsOpen(true)} />
|
67
|
+
}
|
68
|
+
/>
|
69
|
+
</Field>}
|
70
|
+
{isOpen && <Prompter maxWidth={332} mountNode={props.mountNode}
|
71
|
+
hideOk hideCancel onCancel={() => {
|
72
|
+
if (isFunction(props.onChange)) {
|
73
|
+
props.onChange(selectedColor);
|
74
|
+
}
|
75
|
+
setIsOpen(false);
|
76
|
+
}} showCancelInTitle
|
77
|
+
title={props.label || "Choose a color"}
|
78
|
+
>
|
79
|
+
<ColorPicker color={selectedColor} onChange={color => setSelectedColor(color.hex)}
|
80
|
+
presets={getColorCells()}
|
81
|
+
/>
|
82
|
+
</Prompter>}
|
83
|
+
</>;
|
84
84
|
};
|
@@ -1,62 +1,62 @@
|
|
1
|
-
import { makeStyles } from "@fluentui/react-components";
|
2
|
-
import { ChevronRightRegular } from "@fluentui/react-icons";
|
3
|
-
import * as React from 'react';
|
4
|
-
import { KnownClassNames } from "../styles/styles";
|
5
|
-
import { ButtonEX } from "./button";
|
6
|
-
import { DividerEX } from "./divider";
|
7
|
-
import { Horizontal } from "./horizontal";
|
8
|
-
import { Vertical } from "./vertical";
|
9
|
-
|
10
|
-
const useStyles = makeStyles({
|
11
|
-
opened: {
|
12
|
-
transform: "rotate(90deg)",
|
13
|
-
transition: "transform 200ms ease-out"
|
14
|
-
},
|
15
|
-
header: {
|
16
|
-
paddingLeft: 0
|
17
|
-
},
|
18
|
-
root: {
|
19
|
-
maxHeight: "100%"
|
20
|
-
},
|
21
|
-
rootFill: {
|
22
|
-
minHeight: "100%"
|
23
|
-
},
|
24
|
-
body: {
|
25
|
-
overflow: "auto",
|
26
|
-
}
|
27
|
-
});
|
28
|
-
|
29
|
-
interface iProps {
|
30
|
-
/** optional: send the key for the group you want to open by default */
|
31
|
-
opened?: string;
|
32
|
-
fillHeight?: boolean;
|
33
|
-
groups: {
|
34
|
-
key: string;
|
35
|
-
title: string;
|
36
|
-
icon?: JSX.Element;
|
37
|
-
content: JSX.Element;
|
38
|
-
}[];
|
39
|
-
}
|
40
|
-
export const AccordionEX: React.FunctionComponent<iProps> = (props) => {
|
41
|
-
const classes = useStyles();
|
42
|
-
const [opened, setOpened] = React.useState(props.opened || props.groups[0].key);
|
43
|
-
return (<Vertical main css={[classes.root, props.fillHeight && classes.rootFill, KnownClassNames.accordion]}>
|
44
|
-
{props.groups.map(group => <React.Fragment key={group.key}>
|
45
|
-
<ButtonEX className={`${classes.header} ${KnownClassNames.accordionHeader} ${opened === group.key ? ` ${KnownClassNames.isOpen}` : ''}`}
|
46
|
-
icon={<ChevronRightRegular className={opened === group.key ? classes.opened : ''} />}
|
47
|
-
title={group.title} showTitleWithIcon dontCenterText
|
48
|
-
onClick={() => setOpened(group.key)}
|
49
|
-
/>
|
50
|
-
<DividerEX />
|
51
|
-
{group.key === opened && <>
|
52
|
-
<Horizontal main css={[classes.body, KnownClassNames.accordionBodyWrapper]}>
|
53
|
-
<Vertical main css={[KnownClassNames.accordionBody]}>
|
54
|
-
{group.content}
|
55
|
-
</Vertical>
|
56
|
-
</Horizontal>
|
57
|
-
<DividerEX />
|
58
|
-
</>}
|
59
|
-
</React.Fragment>)}
|
60
|
-
</Vertical>
|
61
|
-
);
|
62
|
-
}
|
1
|
+
import { makeStyles } from "@fluentui/react-components";
|
2
|
+
import { ChevronRightRegular } from "@fluentui/react-icons";
|
3
|
+
import * as React from 'react';
|
4
|
+
import { KnownClassNames } from "../styles/styles";
|
5
|
+
import { ButtonEX } from "./button";
|
6
|
+
import { DividerEX } from "./divider";
|
7
|
+
import { Horizontal } from "./horizontal";
|
8
|
+
import { Vertical } from "./vertical";
|
9
|
+
|
10
|
+
const useStyles = makeStyles({
|
11
|
+
opened: {
|
12
|
+
transform: "rotate(90deg)",
|
13
|
+
transition: "transform 200ms ease-out"
|
14
|
+
},
|
15
|
+
header: {
|
16
|
+
paddingLeft: 0
|
17
|
+
},
|
18
|
+
root: {
|
19
|
+
maxHeight: "100%"
|
20
|
+
},
|
21
|
+
rootFill: {
|
22
|
+
minHeight: "100%"
|
23
|
+
},
|
24
|
+
body: {
|
25
|
+
overflow: "auto",
|
26
|
+
}
|
27
|
+
});
|
28
|
+
|
29
|
+
interface iProps {
|
30
|
+
/** optional: send the key for the group you want to open by default */
|
31
|
+
opened?: string;
|
32
|
+
fillHeight?: boolean;
|
33
|
+
groups: {
|
34
|
+
key: string;
|
35
|
+
title: string;
|
36
|
+
icon?: JSX.Element;
|
37
|
+
content: JSX.Element;
|
38
|
+
}[];
|
39
|
+
}
|
40
|
+
export const AccordionEX: React.FunctionComponent<iProps> = (props) => {
|
41
|
+
const classes = useStyles();
|
42
|
+
const [opened, setOpened] = React.useState(props.opened || props.groups[0].key);
|
43
|
+
return (<Vertical main css={[classes.root, props.fillHeight && classes.rootFill, KnownClassNames.accordion]}>
|
44
|
+
{props.groups.map(group => <React.Fragment key={group.key}>
|
45
|
+
<ButtonEX className={`${classes.header} ${KnownClassNames.accordionHeader} ${opened === group.key ? ` ${KnownClassNames.isOpen}` : ''}`}
|
46
|
+
icon={<ChevronRightRegular className={opened === group.key ? classes.opened : ''} />}
|
47
|
+
title={group.title} showTitleWithIcon dontCenterText
|
48
|
+
onClick={() => setOpened(group.key)}
|
49
|
+
/>
|
50
|
+
<DividerEX />
|
51
|
+
{group.key === opened && <>
|
52
|
+
<Horizontal main css={[classes.body, KnownClassNames.accordionBodyWrapper]}>
|
53
|
+
<Vertical main css={[KnownClassNames.accordionBody]}>
|
54
|
+
{group.content}
|
55
|
+
</Vertical>
|
56
|
+
</Horizontal>
|
57
|
+
<DividerEX />
|
58
|
+
</>}
|
59
|
+
</React.Fragment>)}
|
60
|
+
</Vertical>
|
61
|
+
);
|
62
|
+
}
|