@babylonjs/shared-ui-components 5.28.0 → 5.29.0
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/colorPicker/colorComponentEntry.d.ts +18 -18
- package/colorPicker/colorComponentEntry.js +36 -36
- package/colorPicker/colorPicker.d.ts +43 -43
- package/colorPicker/colorPicker.js +136 -136
- package/colorPicker/hexColor.d.ts +20 -20
- package/colorPicker/hexColor.js +42 -42
- package/components/Button.d.ts +10 -10
- package/components/Button.js +6 -6
- package/components/Icon.d.ts +6 -6
- package/components/Icon.js +6 -6
- package/components/Label.d.ts +7 -7
- package/components/Label.js +6 -6
- package/components/MessageDialog.d.ts +7 -7
- package/components/MessageDialog.js +22 -22
- package/components/Toggle.d.ts +8 -8
- package/components/Toggle.js +15 -15
- package/components/bars/CommandBarComponent.d.ts +16 -16
- package/components/bars/CommandBarComponent.js +68 -68
- package/components/bars/CommandButtonComponent.d.ts +11 -11
- package/components/bars/CommandButtonComponent.js +6 -6
- package/components/bars/CommandDropdownComponent.d.ts +26 -26
- package/components/bars/CommandDropdownComponent.js +48 -48
- package/components/classNames.d.ts +2 -2
- package/components/classNames.js +18 -18
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -18
- package/components/colorPicker/ColorComponentEntry.js +37 -37
- package/components/colorPicker/ColorPicker.d.ts +43 -43
- package/components/colorPicker/ColorPicker.js +137 -137
- package/components/colorPicker/HexColor.d.ts +20 -20
- package/components/colorPicker/HexColor.js +45 -45
- package/components/layout/DraggableIcon.d.ts +23 -0
- package/components/layout/DraggableIcon.js +18 -0
- package/components/layout/DraggableIcon.js.map +1 -0
- package/components/layout/FlexibleColumn.d.ts +17 -0
- package/components/layout/FlexibleColumn.js +12 -0
- package/components/layout/FlexibleColumn.js.map +1 -0
- package/components/layout/FlexibleDragHandler.d.ts +18 -0
- package/components/layout/FlexibleDragHandler.js +88 -0
- package/components/layout/FlexibleDragHandler.js.map +1 -0
- package/components/layout/FlexibleDropZone.d.ts +19 -0
- package/components/layout/FlexibleDropZone.js +12 -0
- package/components/layout/FlexibleDropZone.js.map +1 -0
- package/components/layout/FlexibleGridContainer.d.ts +10 -0
- package/components/layout/FlexibleGridContainer.js +23 -0
- package/components/layout/FlexibleGridContainer.js.map +1 -0
- package/components/layout/FlexibleGridLayout.d.ts +16 -0
- package/components/layout/FlexibleGridLayout.js +24 -0
- package/components/layout/FlexibleGridLayout.js.map +1 -0
- package/components/layout/FlexibleResizeBar.d.ts +40 -0
- package/components/layout/FlexibleResizeBar.js +21 -0
- package/components/layout/FlexibleResizeBar.js.map +1 -0
- package/components/layout/FlexibleTab.d.ts +34 -0
- package/components/layout/FlexibleTab.js +36 -0
- package/components/layout/FlexibleTab.js.map +1 -0
- package/components/layout/FlexibleTabsContainer.d.ts +28 -0
- package/components/layout/FlexibleTabsContainer.js +54 -0
- package/components/layout/FlexibleTabsContainer.js.map +1 -0
- package/components/layout/LayoutContext.d.ts +12 -0
- package/components/layout/LayoutContext.js +3 -0
- package/components/layout/LayoutContext.js.map +1 -0
- package/components/layout/types.d.ts +78 -0
- package/components/layout/types.js +13 -0
- package/components/layout/types.js.map +1 -0
- package/components/layout/utils.d.ts +25 -0
- package/components/layout/utils.js +68 -0
- package/components/layout/utils.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -40
- package/components/lines/ColorLineComponent.js +145 -145
- package/components/lines/ColorPickerLineComponent.d.ts +33 -33
- package/components/lines/ColorPickerLineComponent.js +61 -61
- package/components/lines/FileButtonLineComponent.d.ts +16 -16
- package/components/lines/FileButtonLineComponent.js +21 -21
- package/components/lines/NumericInputComponent.d.ts +31 -31
- package/components/lines/NumericInputComponent.js +86 -86
- package/lines/booleanLineComponent.d.ts +11 -11
- package/lines/booleanLineComponent.js +14 -14
- package/lines/buttonLineComponent.d.ts +12 -12
- package/lines/buttonLineComponent.js +10 -10
- package/lines/checkBoxLineComponent.d.ts +36 -36
- package/lines/checkBoxLineComponent.js +88 -88
- package/lines/color3LineComponent.d.ts +18 -18
- package/lines/color3LineComponent.js +9 -9
- package/lines/color4LineComponent.d.ts +18 -18
- package/lines/color4LineComponent.js +9 -9
- package/lines/colorLineComponent.d.ts +40 -40
- package/lines/colorLineComponent.js +144 -144
- package/lines/colorPickerComponent.d.ts +31 -31
- package/lines/colorPickerComponent.js +60 -60
- package/lines/draggableLineComponent.d.ts +9 -9
- package/lines/draggableLineComponent.js +12 -12
- package/lines/fileButtonLineComponent.d.ts +17 -17
- package/lines/fileButtonLineComponent.js +20 -20
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -17
- package/lines/fileMultipleButtonLineComponent.js +20 -20
- package/lines/floatLineComponent.d.ts +50 -50
- package/lines/floatLineComponent.js +175 -175
- package/lines/hexLineComponent.d.ts +40 -40
- package/lines/hexLineComponent.js +121 -121
- package/lines/iSelectedLineContainer.d.ts +4 -4
- package/lines/iSelectedLineContainer.js +1 -1
- package/lines/iconButtonLineComponent.d.ts +11 -11
- package/lines/iconButtonLineComponent.js +10 -10
- package/lines/iconComponent.d.ts +9 -9
- package/lines/iconComponent.js +7 -7
- package/lines/indentedTextLineComponent.d.ts +16 -16
- package/lines/indentedTextLineComponent.js +26 -26
- package/lines/inputArrowsComponent.d.ts +13 -13
- package/lines/inputArrowsComponent.js +37 -37
- package/lines/lineContainerComponent.d.ts +19 -19
- package/lines/lineContainerComponent.js +49 -49
- package/lines/linkButtonComponent.d.ts +16 -16
- package/lines/linkButtonComponent.js +20 -20
- package/lines/matrixLineComponent.d.ts +36 -36
- package/lines/matrixLineComponent.js +102 -102
- package/lines/messageLineComponent.d.ts +12 -12
- package/lines/messageLineComponent.js +14 -14
- package/lines/numericInputComponent.d.ts +31 -31
- package/lines/numericInputComponent.js +85 -85
- package/lines/optionsLineComponent.d.ts +48 -48
- package/lines/optionsLineComponent.js +118 -118
- package/lines/popup.d.ts +4 -4
- package/lines/popup.js +67 -67
- package/lines/radioLineComponent.d.ts +21 -21
- package/lines/radioLineComponent.js +26 -26
- package/lines/sliderLineComponent.d.ts +37 -37
- package/lines/sliderLineComponent.js +89 -89
- package/lines/targetsProxy.d.ts +11 -11
- package/lines/targetsProxy.js +42 -42
- package/lines/textInputLineComponent.d.ts +47 -47
- package/lines/textInputLineComponent.js +154 -154
- package/lines/textLineComponent.d.ts +21 -21
- package/lines/textLineComponent.js +30 -30
- package/lines/unitButton.d.ts +8 -8
- package/lines/unitButton.js +7 -7
- package/lines/valueLineComponent.d.ts +15 -15
- package/lines/valueLineComponent.js +12 -12
- package/lines/vector2LineComponent.d.ts +36 -36
- package/lines/vector2LineComponent.js +63 -63
- package/lines/vector3LineComponent.d.ts +41 -41
- package/lines/vector3LineComponent.js +74 -74
- package/lines/vector4LineComponent.d.ts +42 -42
- package/lines/vector4LineComponent.js +81 -81
- package/nodeGraphSystem/displayLedger.d.ts +5 -5
- package/nodeGraphSystem/displayLedger.js +3 -3
- package/nodeGraphSystem/frameNodePort.d.ts +25 -25
- package/nodeGraphSystem/frameNodePort.js +59 -59
- package/nodeGraphSystem/graphCanvas.d.ts +111 -111
- package/nodeGraphSystem/graphCanvas.js +1131 -1131
- package/nodeGraphSystem/graphFrame.d.ts +153 -153
- package/nodeGraphSystem/graphFrame.js +1328 -1328
- package/nodeGraphSystem/graphNode.d.ts +79 -79
- package/nodeGraphSystem/graphNode.js +459 -459
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -13
- package/nodeGraphSystem/interfaces/displayManager.js +1 -1
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -6
- package/nodeGraphSystem/interfaces/nodeContainer.js +1 -1
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -15
- package/nodeGraphSystem/interfaces/nodeData.js +1 -1
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -26
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +1 -1
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -28
- package/nodeGraphSystem/interfaces/portData.js +7 -7
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -6
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +1 -1
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -11
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +1 -1
- package/nodeGraphSystem/nodeLink.d.ts +31 -31
- package/nodeGraphSystem/nodeLink.js +182 -182
- package/nodeGraphSystem/nodePort.d.ts +35 -35
- package/nodeGraphSystem/nodePort.js +128 -128
- package/nodeGraphSystem/propertyLedger.d.ts +8 -8
- package/nodeGraphSystem/propertyLedger.js +3 -3
- package/nodeGraphSystem/stateManager.d.ts +45 -45
- package/nodeGraphSystem/stateManager.js +18 -18
- package/nodeGraphSystem/tools.d.ts +5 -5
- package/nodeGraphSystem/tools.js +36 -36
- package/nodeGraphSystem/typeLedger.d.ts +8 -8
- package/nodeGraphSystem/typeLedger.js +2 -2
- package/nodeGraphSystem/types/framePortData.d.ts +7 -7
- package/nodeGraphSystem/types/framePortData.js +1 -1
- package/package.json +4 -3
- package/propertyChangedEvent.d.ts +7 -7
- package/propertyChangedEvent.js +2 -2
- package/stories/Button.stories.d.ts +10 -10
- package/stories/Button.stories.js +19 -19
- package/stories/Icon.stories.d.ts +9 -9
- package/stories/Icon.stories.js +16 -16
- package/stories/Label.stories.d.ts +8 -8
- package/stories/Label.stories.js +10 -10
- package/stories/MessageDialog.stories.d.ts +9 -9
- package/stories/MessageDialog.stories.js +19 -19
- package/stories/Toggle.stories.d.ts +9 -9
- package/stories/Toggle.stories.js +17 -17
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -11
- package/stories/bars/CommandBarComponent.stories.js +12 -12
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -6
- package/stories/bars/CommandButtonComponent.stories.js +6 -6
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -11
- package/stories/colorPicker/ColorPicker.stories.js +4 -4
- package/stories/layout/FlexibleGridLayout.stories.d.ts +46 -0
- package/stories/layout/FlexibleGridLayout.stories.js +48 -0
- package/stories/layout/FlexibleGridLayout.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -21
- package/stories/lines/ColorLineComponent.stories.js +9 -9
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -14
- package/stories/lines/ColorPickerLineComponent.stories.js +10 -10
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -6
- package/stories/lines/FileButtonLineComponent.stories.js +5 -5
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -11
- package/stories/lines/NumericInputComponent.stories.js +5 -5
- package/stringTools.d.ts +11 -11
- package/stringTools.js +88 -88
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +55 -55
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +12 -12
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -17
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +38 -38
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +25 -25
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -16
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +27 -27
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +17 -17
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +16 -16
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +14 -14
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -15
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +34 -34
- package/tabs/propertyGrids/lockObject.d.ts +9 -9
- package/tabs/propertyGrids/lockObject.js +11 -11
@@ -1,38 +1,38 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import style from "./ColorComponentEntry.modules.scss";
|
4
|
-
export class ColorComponentEntry extends React.Component {
|
5
|
-
constructor(props) {
|
6
|
-
super(props);
|
7
|
-
}
|
8
|
-
updateValue(valueString) {
|
9
|
-
if (/[^0-9.-]/g.test(valueString)) {
|
10
|
-
return;
|
11
|
-
}
|
12
|
-
let valueAsNumber = parseInt(valueString);
|
13
|
-
if (isNaN(valueAsNumber)) {
|
14
|
-
return;
|
15
|
-
}
|
16
|
-
if (this.props.max != undefined && valueAsNumber > this.props.max) {
|
17
|
-
valueAsNumber = this.props.max;
|
18
|
-
}
|
19
|
-
if (this.props.min != undefined && valueAsNumber < this.props.min) {
|
20
|
-
valueAsNumber = this.props.min;
|
21
|
-
}
|
22
|
-
this.props.onChange(valueAsNumber);
|
23
|
-
}
|
24
|
-
lock() {
|
25
|
-
if (this.props.lockObject) {
|
26
|
-
this.props.lockObject.lock = true;
|
27
|
-
}
|
28
|
-
}
|
29
|
-
unlock() {
|
30
|
-
if (this.props.lockObject) {
|
31
|
-
this.props.lockObject.lock = false;
|
32
|
-
}
|
33
|
-
}
|
34
|
-
render() {
|
35
|
-
return (_jsxs("div", { className: style.colorPickerComponent, children: [_jsx("div", { className: style.colorPickerComponentValue, children: _jsx("input", { type: "number", step: 1, className: "numeric-input", value: this.props.value, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateValue(evt.target.value), disabled: this.props.disabled }) }), _jsx("div", { className: style.colorPickerComponentLabel, children: this.props.label })] }));
|
36
|
-
}
|
37
|
-
}
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import style from "./ColorComponentEntry.modules.scss";
|
4
|
+
export class ColorComponentEntry extends React.Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
}
|
8
|
+
updateValue(valueString) {
|
9
|
+
if (/[^0-9.-]/g.test(valueString)) {
|
10
|
+
return;
|
11
|
+
}
|
12
|
+
let valueAsNumber = parseInt(valueString);
|
13
|
+
if (isNaN(valueAsNumber)) {
|
14
|
+
return;
|
15
|
+
}
|
16
|
+
if (this.props.max != undefined && valueAsNumber > this.props.max) {
|
17
|
+
valueAsNumber = this.props.max;
|
18
|
+
}
|
19
|
+
if (this.props.min != undefined && valueAsNumber < this.props.min) {
|
20
|
+
valueAsNumber = this.props.min;
|
21
|
+
}
|
22
|
+
this.props.onChange(valueAsNumber);
|
23
|
+
}
|
24
|
+
lock() {
|
25
|
+
if (this.props.lockObject) {
|
26
|
+
this.props.lockObject.lock = true;
|
27
|
+
}
|
28
|
+
}
|
29
|
+
unlock() {
|
30
|
+
if (this.props.lockObject) {
|
31
|
+
this.props.lockObject.lock = false;
|
32
|
+
}
|
33
|
+
}
|
34
|
+
render() {
|
35
|
+
return (_jsxs("div", { className: style.colorPickerComponent, children: [_jsx("div", { className: style.colorPickerComponentValue, children: _jsx("input", { type: "number", step: 1, className: "numeric-input", value: this.props.value, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateValue(evt.target.value), disabled: this.props.disabled }) }), _jsx("div", { className: style.colorPickerComponentLabel, children: this.props.label })] }));
|
36
|
+
}
|
37
|
+
}
|
38
38
|
//# sourceMappingURL=ColorComponentEntry.js.map
|
@@ -1,43 +1,43 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
3
|
-
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
4
|
-
/**
|
5
|
-
* Interface used to specify creation options for color picker
|
6
|
-
*/
|
7
|
-
export interface IColorPickerProps {
|
8
|
-
color: Color3 | Color4;
|
9
|
-
linearhint?: boolean;
|
10
|
-
debugMode?: boolean;
|
11
|
-
onColorChanged?: (color: Color3 | Color4) => void;
|
12
|
-
lockObject: LockObject;
|
13
|
-
backgroundColor?: string;
|
14
|
-
}
|
15
|
-
/**
|
16
|
-
* Interface used to specify creation options for color picker
|
17
|
-
*/
|
18
|
-
export interface IColorPickerState {
|
19
|
-
color: Color3;
|
20
|
-
alpha: number;
|
21
|
-
}
|
22
|
-
/**
|
23
|
-
* Class used to create a color picker
|
24
|
-
*/
|
25
|
-
export declare class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
|
26
|
-
private _saturationRef;
|
27
|
-
private _hueRef;
|
28
|
-
private _isSaturationPointerDown;
|
29
|
-
private _isHuePointerDown;
|
30
|
-
constructor(props: IColorPickerProps);
|
31
|
-
shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState): boolean;
|
32
|
-
onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
33
|
-
onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
34
|
-
onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
35
|
-
onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
36
|
-
onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
37
|
-
onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
38
|
-
private _evaluateSaturation;
|
39
|
-
private _evaluateHue;
|
40
|
-
componentDidUpdate(): void;
|
41
|
-
raiseOnColorChanged(): void;
|
42
|
-
render(): JSX.Element;
|
43
|
-
}
|
1
|
+
import * as React from "react";
|
2
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
3
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
4
|
+
/**
|
5
|
+
* Interface used to specify creation options for color picker
|
6
|
+
*/
|
7
|
+
export interface IColorPickerProps {
|
8
|
+
color: Color3 | Color4;
|
9
|
+
linearhint?: boolean;
|
10
|
+
debugMode?: boolean;
|
11
|
+
onColorChanged?: (color: Color3 | Color4) => void;
|
12
|
+
lockObject: LockObject;
|
13
|
+
backgroundColor?: string;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Interface used to specify creation options for color picker
|
17
|
+
*/
|
18
|
+
export interface IColorPickerState {
|
19
|
+
color: Color3;
|
20
|
+
alpha: number;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* Class used to create a color picker
|
24
|
+
*/
|
25
|
+
export declare class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {
|
26
|
+
private _saturationRef;
|
27
|
+
private _hueRef;
|
28
|
+
private _isSaturationPointerDown;
|
29
|
+
private _isHuePointerDown;
|
30
|
+
constructor(props: IColorPickerProps);
|
31
|
+
shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState): boolean;
|
32
|
+
onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
33
|
+
onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
34
|
+
onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
35
|
+
onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>): void;
|
36
|
+
onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>): void;
|
37
|
+
onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>): void;
|
38
|
+
private _evaluateSaturation;
|
39
|
+
private _evaluateHue;
|
40
|
+
componentDidUpdate(): void;
|
41
|
+
raiseOnColorChanged(): void;
|
42
|
+
render(): JSX.Element;
|
43
|
+
}
|
@@ -1,138 +1,138 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
-
import { ColorComponentEntry } from "./ColorComponentEntry.js";
|
5
|
-
import { HexColor } from "./HexColor.js";
|
6
|
-
import style from "./ColorPicker.modules.scss";
|
7
|
-
import { ClassNames } from "../classNames.js";
|
8
|
-
/**
|
9
|
-
* Class used to create a color picker
|
10
|
-
*/
|
11
|
-
export class ColorPicker extends React.Component {
|
12
|
-
constructor(props) {
|
13
|
-
super(props);
|
14
|
-
if (this.props.color instanceof Color4) {
|
15
|
-
this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
|
16
|
-
}
|
17
|
-
else {
|
18
|
-
this.state = { color: this.props.color.clone(), alpha: 1 };
|
19
|
-
}
|
20
|
-
this._saturationRef = React.createRef();
|
21
|
-
this._hueRef = React.createRef();
|
22
|
-
}
|
23
|
-
shouldComponentUpdate(nextProps, nextState) {
|
24
|
-
return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
|
25
|
-
}
|
26
|
-
onSaturationPointerDown(evt) {
|
27
|
-
this._evaluateSaturation(evt);
|
28
|
-
this._isSaturationPointerDown = true;
|
29
|
-
evt.currentTarget.setPointerCapture(evt.pointerId);
|
30
|
-
}
|
31
|
-
onSaturationPointerUp(evt) {
|
32
|
-
this._isSaturationPointerDown = false;
|
33
|
-
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
34
|
-
}
|
35
|
-
onSaturationPointerMove(evt) {
|
36
|
-
if (!this._isSaturationPointerDown) {
|
37
|
-
return;
|
38
|
-
}
|
39
|
-
this._evaluateSaturation(evt);
|
40
|
-
}
|
41
|
-
onHuePointerDown(evt) {
|
42
|
-
this._evaluateHue(evt);
|
43
|
-
this._isHuePointerDown = true;
|
44
|
-
evt.currentTarget.setPointerCapture(evt.pointerId);
|
45
|
-
}
|
46
|
-
onHuePointerUp(evt) {
|
47
|
-
this._isHuePointerDown = false;
|
48
|
-
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
49
|
-
}
|
50
|
-
onHuePointerMove(evt) {
|
51
|
-
if (!this._isHuePointerDown) {
|
52
|
-
return;
|
53
|
-
}
|
54
|
-
this._evaluateHue(evt);
|
55
|
-
}
|
56
|
-
_evaluateSaturation(evt) {
|
57
|
-
const left = evt.nativeEvent.offsetX;
|
58
|
-
const top = evt.nativeEvent.offsetY;
|
59
|
-
const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
|
60
|
-
const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
|
61
|
-
if (this.props.debugMode) {
|
62
|
-
console.log("Saturation: " + saturation);
|
63
|
-
console.log("Value: " + value);
|
64
|
-
}
|
65
|
-
const hsv = this.state.color.toHSV();
|
66
|
-
Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
|
67
|
-
if (this.state.alpha === 0) {
|
68
|
-
this.setState({ alpha: 1 });
|
69
|
-
}
|
70
|
-
this.setState({ color: this.state.color });
|
71
|
-
}
|
72
|
-
_evaluateHue(evt) {
|
73
|
-
const left = evt.nativeEvent.offsetX;
|
74
|
-
const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
|
75
|
-
if (this.props.debugMode) {
|
76
|
-
console.log("Hue: " + hue);
|
77
|
-
}
|
78
|
-
const hsv = this.state.color.toHSV();
|
79
|
-
Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
|
80
|
-
this.setState({ color: this.state.color });
|
81
|
-
}
|
82
|
-
componentDidUpdate() {
|
83
|
-
this.raiseOnColorChanged();
|
84
|
-
}
|
85
|
-
raiseOnColorChanged() {
|
86
|
-
if (!this.props.onColorChanged) {
|
87
|
-
return;
|
88
|
-
}
|
89
|
-
if (this.props.color instanceof Color4) {
|
90
|
-
const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
|
91
|
-
this.props.onColorChanged(newColor4);
|
92
|
-
return;
|
93
|
-
}
|
94
|
-
this.props.onColorChanged(this.state.color.clone());
|
95
|
-
}
|
96
|
-
render() {
|
97
|
-
const color4 = Color4.FromColor3(this.state.color);
|
98
|
-
color4.a = this.state.alpha;
|
99
|
-
const colorHex = color4.toHexString();
|
100
|
-
const hsv = this.state.color.toHSV();
|
101
|
-
const colorRef = new Color3();
|
102
|
-
Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
|
103
|
-
const colorHexRef = colorRef.toHexString();
|
104
|
-
const hasAlpha = this.props.color instanceof Color4;
|
105
|
-
return (_jsxs("div", { className: ClassNames({ colorPickerContainer: true, withHints: this.props.linearhint }, style), style: { backgroundColor: this.props.backgroundColor || "inherit" }, children: [_jsxs("div", { className: style.colorPickerSaturation, onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
|
106
|
-
background: colorHexRef,
|
107
|
-
}, children: [_jsx("div", { className: style.colorPickerSaturationWhite }), _jsx("div", { className: style.colorPickerSaturationBlack }), _jsx("div", { className: style.colorPickerSaturationCursor, style: {
|
108
|
-
top: `${-(hsv.b * 100) + 100}%`,
|
109
|
-
left: `${hsv.g * 100}%`,
|
110
|
-
} })] }), _jsxs("div", { className: style.colorPickerHue, children: [_jsx("div", { className: style.colorPickerHueColor, style: {
|
111
|
-
background: colorHex,
|
112
|
-
} }), _jsx("div", { className: style.colorPickerHueSlider, ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: style.colorPickerHueCursor, style: {
|
113
|
-
left: `${(hsv.r / 360.0) * 100}%`,
|
114
|
-
border: `1px solid ` + colorHexRef,
|
115
|
-
} }) })] }), _jsxs("div", { className: style.colorPickerRgb, children: [_jsx("div", { className: style.red, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
|
116
|
-
this.state.color.r = value / 255.0;
|
117
|
-
this.forceUpdate();
|
118
|
-
} }) }), _jsx("div", { className: style.green, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
|
119
|
-
this.state.color.g = value / 255.0;
|
120
|
-
this.forceUpdate();
|
121
|
-
} }) }), _jsx("div", { className: style.blue, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
|
122
|
-
this.state.color.b = value / 255.0;
|
123
|
-
this.forceUpdate();
|
124
|
-
} }) }), _jsx("div", { className: ClassNames({ alpha: true, grayed: hasAlpha }, style), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
|
125
|
-
this.setState({ alpha: value / 255.0 });
|
126
|
-
this.forceUpdate();
|
127
|
-
} }) })] }), _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
|
128
|
-
if (hasAlpha) {
|
129
|
-
const color4 = Color4.FromHexString(value);
|
130
|
-
this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
|
131
|
-
}
|
132
|
-
else {
|
133
|
-
this.setState({ color: Color3.FromHexString(value) });
|
134
|
-
}
|
135
|
-
} }), this.props.linearhint && (_jsx("div", { className: style.colorPickerWarning, children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
|
136
|
-
}
|
137
|
-
}
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
4
|
+
import { ColorComponentEntry } from "./ColorComponentEntry.js";
|
5
|
+
import { HexColor } from "./HexColor.js";
|
6
|
+
import style from "./ColorPicker.modules.scss";
|
7
|
+
import { ClassNames } from "../classNames.js";
|
8
|
+
/**
|
9
|
+
* Class used to create a color picker
|
10
|
+
*/
|
11
|
+
export class ColorPicker extends React.Component {
|
12
|
+
constructor(props) {
|
13
|
+
super(props);
|
14
|
+
if (this.props.color instanceof Color4) {
|
15
|
+
this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
|
16
|
+
}
|
17
|
+
else {
|
18
|
+
this.state = { color: this.props.color.clone(), alpha: 1 };
|
19
|
+
}
|
20
|
+
this._saturationRef = React.createRef();
|
21
|
+
this._hueRef = React.createRef();
|
22
|
+
}
|
23
|
+
shouldComponentUpdate(nextProps, nextState) {
|
24
|
+
return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
|
25
|
+
}
|
26
|
+
onSaturationPointerDown(evt) {
|
27
|
+
this._evaluateSaturation(evt);
|
28
|
+
this._isSaturationPointerDown = true;
|
29
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
30
|
+
}
|
31
|
+
onSaturationPointerUp(evt) {
|
32
|
+
this._isSaturationPointerDown = false;
|
33
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
34
|
+
}
|
35
|
+
onSaturationPointerMove(evt) {
|
36
|
+
if (!this._isSaturationPointerDown) {
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
this._evaluateSaturation(evt);
|
40
|
+
}
|
41
|
+
onHuePointerDown(evt) {
|
42
|
+
this._evaluateHue(evt);
|
43
|
+
this._isHuePointerDown = true;
|
44
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
45
|
+
}
|
46
|
+
onHuePointerUp(evt) {
|
47
|
+
this._isHuePointerDown = false;
|
48
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
49
|
+
}
|
50
|
+
onHuePointerMove(evt) {
|
51
|
+
if (!this._isHuePointerDown) {
|
52
|
+
return;
|
53
|
+
}
|
54
|
+
this._evaluateHue(evt);
|
55
|
+
}
|
56
|
+
_evaluateSaturation(evt) {
|
57
|
+
const left = evt.nativeEvent.offsetX;
|
58
|
+
const top = evt.nativeEvent.offsetY;
|
59
|
+
const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
|
60
|
+
const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
|
61
|
+
if (this.props.debugMode) {
|
62
|
+
console.log("Saturation: " + saturation);
|
63
|
+
console.log("Value: " + value);
|
64
|
+
}
|
65
|
+
const hsv = this.state.color.toHSV();
|
66
|
+
Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
|
67
|
+
if (this.state.alpha === 0) {
|
68
|
+
this.setState({ alpha: 1 });
|
69
|
+
}
|
70
|
+
this.setState({ color: this.state.color });
|
71
|
+
}
|
72
|
+
_evaluateHue(evt) {
|
73
|
+
const left = evt.nativeEvent.offsetX;
|
74
|
+
const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
|
75
|
+
if (this.props.debugMode) {
|
76
|
+
console.log("Hue: " + hue);
|
77
|
+
}
|
78
|
+
const hsv = this.state.color.toHSV();
|
79
|
+
Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
|
80
|
+
this.setState({ color: this.state.color });
|
81
|
+
}
|
82
|
+
componentDidUpdate() {
|
83
|
+
this.raiseOnColorChanged();
|
84
|
+
}
|
85
|
+
raiseOnColorChanged() {
|
86
|
+
if (!this.props.onColorChanged) {
|
87
|
+
return;
|
88
|
+
}
|
89
|
+
if (this.props.color instanceof Color4) {
|
90
|
+
const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
|
91
|
+
this.props.onColorChanged(newColor4);
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
this.props.onColorChanged(this.state.color.clone());
|
95
|
+
}
|
96
|
+
render() {
|
97
|
+
const color4 = Color4.FromColor3(this.state.color);
|
98
|
+
color4.a = this.state.alpha;
|
99
|
+
const colorHex = color4.toHexString();
|
100
|
+
const hsv = this.state.color.toHSV();
|
101
|
+
const colorRef = new Color3();
|
102
|
+
Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
|
103
|
+
const colorHexRef = colorRef.toHexString();
|
104
|
+
const hasAlpha = this.props.color instanceof Color4;
|
105
|
+
return (_jsxs("div", { className: ClassNames({ colorPickerContainer: true, withHints: this.props.linearhint }, style), style: { backgroundColor: this.props.backgroundColor || "inherit" }, children: [_jsxs("div", { className: style.colorPickerSaturation, onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
|
106
|
+
background: colorHexRef,
|
107
|
+
}, children: [_jsx("div", { className: style.colorPickerSaturationWhite }), _jsx("div", { className: style.colorPickerSaturationBlack }), _jsx("div", { className: style.colorPickerSaturationCursor, style: {
|
108
|
+
top: `${-(hsv.b * 100) + 100}%`,
|
109
|
+
left: `${hsv.g * 100}%`,
|
110
|
+
} })] }), _jsxs("div", { className: style.colorPickerHue, children: [_jsx("div", { className: style.colorPickerHueColor, style: {
|
111
|
+
background: colorHex,
|
112
|
+
} }), _jsx("div", { className: style.colorPickerHueSlider, ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: style.colorPickerHueCursor, style: {
|
113
|
+
left: `${(hsv.r / 360.0) * 100}%`,
|
114
|
+
border: `1px solid ` + colorHexRef,
|
115
|
+
} }) })] }), _jsxs("div", { className: style.colorPickerRgb, children: [_jsx("div", { className: style.red, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
|
116
|
+
this.state.color.r = value / 255.0;
|
117
|
+
this.forceUpdate();
|
118
|
+
} }) }), _jsx("div", { className: style.green, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
|
119
|
+
this.state.color.g = value / 255.0;
|
120
|
+
this.forceUpdate();
|
121
|
+
} }) }), _jsx("div", { className: style.blue, children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
|
122
|
+
this.state.color.b = value / 255.0;
|
123
|
+
this.forceUpdate();
|
124
|
+
} }) }), _jsx("div", { className: ClassNames({ alpha: true, grayed: hasAlpha }, style), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
|
125
|
+
this.setState({ alpha: value / 255.0 });
|
126
|
+
this.forceUpdate();
|
127
|
+
} }) })] }), _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
|
128
|
+
if (hasAlpha) {
|
129
|
+
const color4 = Color4.FromHexString(value);
|
130
|
+
this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
this.setState({ color: Color3.FromHexString(value) });
|
134
|
+
}
|
135
|
+
} }), this.props.linearhint && (_jsx("div", { className: style.colorPickerWarning, children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
|
136
|
+
}
|
137
|
+
}
|
138
138
|
//# sourceMappingURL=ColorPicker.js.map
|
@@ -1,20 +1,20 @@
|
|
1
|
-
import * as React from "react";
|
2
|
-
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
-
export interface IHexColorProps {
|
4
|
-
value: string;
|
5
|
-
expectedLength: number;
|
6
|
-
onChange: (value: string) => void;
|
7
|
-
lockObject: LockObject;
|
8
|
-
}
|
9
|
-
export declare class HexColor extends React.Component<IHexColorProps, {
|
10
|
-
hex: string;
|
11
|
-
}> {
|
12
|
-
constructor(props: IHexColorProps);
|
13
|
-
shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
|
14
|
-
hex: string;
|
15
|
-
}): boolean;
|
16
|
-
lock(): void;
|
17
|
-
unlock(): void;
|
18
|
-
updateHexValue(valueString: string): void;
|
19
|
-
render(): JSX.Element;
|
20
|
-
}
|
1
|
+
import * as React from "react";
|
2
|
+
import type { LockObject } from "../../tabs/propertyGrids/lockObject";
|
3
|
+
export interface IHexColorProps {
|
4
|
+
value: string;
|
5
|
+
expectedLength: number;
|
6
|
+
onChange: (value: string) => void;
|
7
|
+
lockObject: LockObject;
|
8
|
+
}
|
9
|
+
export declare class HexColor extends React.Component<IHexColorProps, {
|
10
|
+
hex: string;
|
11
|
+
}> {
|
12
|
+
constructor(props: IHexColorProps);
|
13
|
+
shouldComponentUpdate(nextProps: IHexColorProps, nextState: {
|
14
|
+
hex: string;
|
15
|
+
}): boolean;
|
16
|
+
lock(): void;
|
17
|
+
unlock(): void;
|
18
|
+
updateHexValue(valueString: string): void;
|
19
|
+
render(): JSX.Element;
|
20
|
+
}
|
@@ -1,46 +1,46 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import * as React from "react";
|
3
|
-
import style from "./HexColor.modules.scss";
|
4
|
-
export class HexColor extends React.Component {
|
5
|
-
constructor(props) {
|
6
|
-
super(props);
|
7
|
-
this.state = { hex: this.props.value.replace("#", "") };
|
8
|
-
}
|
9
|
-
shouldComponentUpdate(nextProps, nextState) {
|
10
|
-
if (nextProps.value !== this.props.value) {
|
11
|
-
nextState.hex = nextProps.value.replace("#", "");
|
12
|
-
}
|
13
|
-
return true;
|
14
|
-
}
|
15
|
-
lock() {
|
16
|
-
if (this.props.lockObject) {
|
17
|
-
this.props.lockObject.lock = true;
|
18
|
-
}
|
19
|
-
}
|
20
|
-
unlock() {
|
21
|
-
if (this.props.lockObject) {
|
22
|
-
this.props.lockObject.lock = false;
|
23
|
-
}
|
24
|
-
}
|
25
|
-
updateHexValue(valueString) {
|
26
|
-
if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
this.setState({ hex: valueString });
|
30
|
-
if (valueString.length !== this.props.expectedLength) {
|
31
|
-
if (this.props.expectedLength === 8 && valueString.length === 6) {
|
32
|
-
valueString = valueString + "FF";
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
return;
|
36
|
-
}
|
37
|
-
}
|
38
|
-
this.props.onChange("#" + valueString);
|
39
|
-
}
|
40
|
-
render() {
|
41
|
-
return (_jsxs("div", { className: style.colorPickerHex, children: [_jsx("div", { className: style.colorPickerHexLabel, children: "Hex" }), _jsx("div", { className: style.colorPickerHexValue, children: _jsx("input", { type: "string",
|
42
|
-
// className="hex-input"
|
43
|
-
className: style.colorPickerHex, value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }) })] }));
|
44
|
-
}
|
45
|
-
}
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
import style from "./HexColor.modules.scss";
|
4
|
+
export class HexColor extends React.Component {
|
5
|
+
constructor(props) {
|
6
|
+
super(props);
|
7
|
+
this.state = { hex: this.props.value.replace("#", "") };
|
8
|
+
}
|
9
|
+
shouldComponentUpdate(nextProps, nextState) {
|
10
|
+
if (nextProps.value !== this.props.value) {
|
11
|
+
nextState.hex = nextProps.value.replace("#", "");
|
12
|
+
}
|
13
|
+
return true;
|
14
|
+
}
|
15
|
+
lock() {
|
16
|
+
if (this.props.lockObject) {
|
17
|
+
this.props.lockObject.lock = true;
|
18
|
+
}
|
19
|
+
}
|
20
|
+
unlock() {
|
21
|
+
if (this.props.lockObject) {
|
22
|
+
this.props.lockObject.lock = false;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
updateHexValue(valueString) {
|
26
|
+
if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
|
27
|
+
return;
|
28
|
+
}
|
29
|
+
this.setState({ hex: valueString });
|
30
|
+
if (valueString.length !== this.props.expectedLength) {
|
31
|
+
if (this.props.expectedLength === 8 && valueString.length === 6) {
|
32
|
+
valueString = valueString + "FF";
|
33
|
+
}
|
34
|
+
else {
|
35
|
+
return;
|
36
|
+
}
|
37
|
+
}
|
38
|
+
this.props.onChange("#" + valueString);
|
39
|
+
}
|
40
|
+
render() {
|
41
|
+
return (_jsxs("div", { className: style.colorPickerHex, children: [_jsx("div", { className: style.colorPickerHexLabel, children: "Hex" }), _jsx("div", { className: style.colorPickerHexValue, children: _jsx("input", { type: "string",
|
42
|
+
// className="hex-input"
|
43
|
+
className: style.colorPickerHex, value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }) })] }));
|
44
|
+
}
|
45
|
+
}
|
46
46
|
//# sourceMappingURL=HexColor.js.map
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import type { FC } from "react";
|
2
|
+
import type { ElementTypes, TabDrag } from "./types";
|
3
|
+
/**
|
4
|
+
* Arguments for the DraggableIcon component.
|
5
|
+
*/
|
6
|
+
export interface IDraggableIconProps {
|
7
|
+
/**
|
8
|
+
* Icon source
|
9
|
+
*/
|
10
|
+
src: string;
|
11
|
+
/**
|
12
|
+
* Object that will be passed to the drag event
|
13
|
+
*/
|
14
|
+
item: TabDrag;
|
15
|
+
/**
|
16
|
+
* Type of drag event
|
17
|
+
*/
|
18
|
+
type: ElementTypes;
|
19
|
+
}
|
20
|
+
/**
|
21
|
+
* An icon that can be dragged by the user
|
22
|
+
*/
|
23
|
+
export declare const DraggableIcon: FC<IDraggableIconProps>;
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { useDrag } from "react-dnd";
|
3
|
+
/**
|
4
|
+
* An icon that can be dragged by the user
|
5
|
+
*/
|
6
|
+
export const DraggableIcon = (props) => {
|
7
|
+
const [, drag] = useDrag(() => ({
|
8
|
+
type: props.type,
|
9
|
+
item: props.item,
|
10
|
+
collect(monitor) {
|
11
|
+
return {
|
12
|
+
isDragging: !!monitor.isDragging(),
|
13
|
+
};
|
14
|
+
},
|
15
|
+
}));
|
16
|
+
return _jsx("img", { ref: drag, src: props.src });
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=DraggableIcon.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"DraggableIcon.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/layout/DraggableIcon.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAA4B,CAAC,KAAK,EAAE,EAAE;IAC5D,MAAM,CAAC,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,OAAO,CAAC,OAAO;YACX,OAAO;gBACH,UAAU,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE;aACrC,CAAC;QACN,CAAC;KACJ,CAAC,CAAC,CAAC;IACJ,OAAO,cAAK,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,GAAI,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import type { FC } from \"react\";\r\nimport { useDrag } from \"react-dnd\";\r\nimport type { ElementTypes, TabDrag } from \"./types\";\r\n\r\n/**\r\n * Arguments for the DraggableIcon component.\r\n */\r\nexport interface IDraggableIconProps {\r\n /**\r\n * Icon source\r\n */\r\n src: string;\r\n /**\r\n * Object that will be passed to the drag event\r\n */\r\n item: TabDrag;\r\n /**\r\n * Type of drag event\r\n */\r\n type: ElementTypes;\r\n}\r\n\r\n/**\r\n * An icon that can be dragged by the user\r\n */\r\nexport const DraggableIcon: FC<IDraggableIconProps> = (props) => {\r\n const [, drag] = useDrag(() => ({\r\n type: props.type,\r\n item: props.item,\r\n collect(monitor) {\r\n return {\r\n isDragging: !!monitor.isDragging(),\r\n };\r\n },\r\n }));\r\n return <img ref={drag} src={props.src} />;\r\n};\r\n"]}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { FC } from "react";
|
2
|
+
/**
|
3
|
+
* Arguments for the Column component.
|
4
|
+
*/
|
5
|
+
export interface IFlexibleColumnProps {
|
6
|
+
/**
|
7
|
+
* Width of column
|
8
|
+
*/
|
9
|
+
width: string;
|
10
|
+
}
|
11
|
+
/**
|
12
|
+
* This component represents a single column in the layout. It receives a width
|
13
|
+
* that it occupies and the content to display
|
14
|
+
* @param props
|
15
|
+
* @returns
|
16
|
+
*/
|
17
|
+
export declare const FlexibleColumn: FC<IFlexibleColumnProps>;
|