@babylonjs/shared-ui-components 5.28.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 -0
- package/colorPicker/colorComponentEntry.js +37 -0
- package/colorPicker/colorComponentEntry.js.map +1 -0
- package/colorPicker/colorPicker.d.ts +43 -0
- package/colorPicker/colorPicker.js +137 -0
- package/colorPicker/colorPicker.js.map +1 -0
- package/colorPicker/hexColor.d.ts +20 -0
- package/colorPicker/hexColor.js +43 -0
- package/colorPicker/hexColor.js.map +1 -0
- package/components/Button.d.ts +10 -0
- package/components/Button.js +7 -0
- package/components/Button.js.map +1 -0
- package/components/Icon.d.ts +6 -0
- package/components/Icon.js +7 -0
- package/components/Icon.js.map +1 -0
- package/components/Label.d.ts +7 -0
- package/components/Label.js +7 -0
- package/components/Label.js.map +1 -0
- package/components/MessageDialog.d.ts +7 -0
- package/components/MessageDialog.js +23 -0
- package/components/MessageDialog.js.map +1 -0
- package/components/Toggle.d.ts +8 -0
- package/components/Toggle.js +16 -0
- package/components/Toggle.js.map +1 -0
- package/components/bars/CommandBarComponent.d.ts +16 -0
- package/components/bars/CommandBarComponent.js +69 -0
- package/components/bars/CommandBarComponent.js.map +1 -0
- package/components/bars/CommandButtonComponent.d.ts +11 -0
- package/components/bars/CommandButtonComponent.js +7 -0
- package/components/bars/CommandButtonComponent.js.map +1 -0
- package/components/bars/CommandDropdownComponent.d.ts +26 -0
- package/components/bars/CommandDropdownComponent.js +49 -0
- package/components/bars/CommandDropdownComponent.js.map +1 -0
- package/components/classNames.d.ts +2 -0
- package/components/classNames.js +19 -0
- package/components/classNames.js.map +1 -0
- package/components/colorPicker/ColorComponentEntry.d.ts +18 -0
- package/components/colorPicker/ColorComponentEntry.js +38 -0
- package/components/colorPicker/ColorComponentEntry.js.map +1 -0
- package/components/colorPicker/ColorPicker.d.ts +43 -0
- package/components/colorPicker/ColorPicker.js +138 -0
- package/components/colorPicker/ColorPicker.js.map +1 -0
- package/components/colorPicker/HexColor.d.ts +20 -0
- package/components/colorPicker/HexColor.js +46 -0
- package/components/colorPicker/HexColor.js.map +1 -0
- package/components/lines/ColorLineComponent.d.ts +40 -0
- package/components/lines/ColorLineComponent.js +146 -0
- package/components/lines/ColorLineComponent.js.map +1 -0
- package/components/lines/ColorPickerLineComponent.d.ts +33 -0
- package/components/lines/ColorPickerLineComponent.js +62 -0
- package/components/lines/ColorPickerLineComponent.js.map +1 -0
- package/components/lines/FileButtonLineComponent.d.ts +16 -0
- package/components/lines/FileButtonLineComponent.js +22 -0
- package/components/lines/FileButtonLineComponent.js.map +1 -0
- package/components/lines/NumericInputComponent.d.ts +31 -0
- package/components/lines/NumericInputComponent.js +87 -0
- package/components/lines/NumericInputComponent.js.map +1 -0
- package/license.md +71 -0
- package/lines/booleanLineComponent.d.ts +11 -0
- package/lines/booleanLineComponent.js +15 -0
- package/lines/booleanLineComponent.js.map +1 -0
- package/lines/buttonLineComponent.d.ts +12 -0
- package/lines/buttonLineComponent.js +11 -0
- package/lines/buttonLineComponent.js.map +1 -0
- package/lines/checkBoxLineComponent.d.ts +36 -0
- package/lines/checkBoxLineComponent.js +89 -0
- package/lines/checkBoxLineComponent.js.map +1 -0
- package/lines/color3LineComponent.d.ts +18 -0
- package/lines/color3LineComponent.js +10 -0
- package/lines/color3LineComponent.js.map +1 -0
- package/lines/color4LineComponent.d.ts +18 -0
- package/lines/color4LineComponent.js +10 -0
- package/lines/color4LineComponent.js.map +1 -0
- package/lines/colorLineComponent.d.ts +40 -0
- package/lines/colorLineComponent.js +145 -0
- package/lines/colorLineComponent.js.map +1 -0
- package/lines/colorPickerComponent.d.ts +31 -0
- package/lines/colorPickerComponent.js +61 -0
- package/lines/colorPickerComponent.js.map +1 -0
- package/lines/draggableLineComponent.d.ts +9 -0
- package/lines/draggableLineComponent.js +13 -0
- package/lines/draggableLineComponent.js.map +1 -0
- package/lines/fileButtonLineComponent.d.ts +17 -0
- package/lines/fileButtonLineComponent.js +21 -0
- package/lines/fileButtonLineComponent.js.map +1 -0
- package/lines/fileMultipleButtonLineComponent.d.ts +17 -0
- package/lines/fileMultipleButtonLineComponent.js +21 -0
- package/lines/fileMultipleButtonLineComponent.js.map +1 -0
- package/lines/floatLineComponent.d.ts +50 -0
- package/lines/floatLineComponent.js +176 -0
- package/lines/floatLineComponent.js.map +1 -0
- package/lines/hexLineComponent.d.ts +40 -0
- package/lines/hexLineComponent.js +122 -0
- package/lines/hexLineComponent.js.map +1 -0
- package/lines/iSelectedLineContainer.d.ts +4 -0
- package/lines/iSelectedLineContainer.js +2 -0
- package/lines/iSelectedLineContainer.js.map +1 -0
- package/lines/iconButtonLineComponent.d.ts +11 -0
- package/lines/iconButtonLineComponent.js +11 -0
- package/lines/iconButtonLineComponent.js.map +1 -0
- package/lines/iconComponent.d.ts +9 -0
- package/lines/iconComponent.js +8 -0
- package/lines/iconComponent.js.map +1 -0
- package/lines/indentedTextLineComponent.d.ts +16 -0
- package/lines/indentedTextLineComponent.js +27 -0
- package/lines/indentedTextLineComponent.js.map +1 -0
- package/lines/inputArrowsComponent.d.ts +13 -0
- package/lines/inputArrowsComponent.js +38 -0
- package/lines/inputArrowsComponent.js.map +1 -0
- package/lines/lineContainerComponent.d.ts +19 -0
- package/lines/lineContainerComponent.js +50 -0
- package/lines/lineContainerComponent.js.map +1 -0
- package/lines/linkButtonComponent.d.ts +16 -0
- package/lines/linkButtonComponent.js +21 -0
- package/lines/linkButtonComponent.js.map +1 -0
- package/lines/matrixLineComponent.d.ts +36 -0
- package/lines/matrixLineComponent.js +103 -0
- package/lines/matrixLineComponent.js.map +1 -0
- package/lines/messageLineComponent.d.ts +12 -0
- package/lines/messageLineComponent.js +15 -0
- package/lines/messageLineComponent.js.map +1 -0
- package/lines/numericInputComponent.d.ts +31 -0
- package/lines/numericInputComponent.js +86 -0
- package/lines/numericInputComponent.js.map +1 -0
- package/lines/optionsLineComponent.d.ts +48 -0
- package/lines/optionsLineComponent.js +119 -0
- package/lines/optionsLineComponent.js.map +1 -0
- package/lines/popup.d.ts +4 -0
- package/lines/popup.js +68 -0
- package/lines/popup.js.map +1 -0
- package/lines/radioLineComponent.d.ts +21 -0
- package/lines/radioLineComponent.js +27 -0
- package/lines/radioLineComponent.js.map +1 -0
- package/lines/sliderLineComponent.d.ts +37 -0
- package/lines/sliderLineComponent.js +90 -0
- package/lines/sliderLineComponent.js.map +1 -0
- package/lines/targetsProxy.d.ts +11 -0
- package/lines/targetsProxy.js +43 -0
- package/lines/targetsProxy.js.map +1 -0
- package/lines/textInputLineComponent.d.ts +47 -0
- package/lines/textInputLineComponent.js +155 -0
- package/lines/textInputLineComponent.js.map +1 -0
- package/lines/textLineComponent.d.ts +21 -0
- package/lines/textLineComponent.js +31 -0
- package/lines/textLineComponent.js.map +1 -0
- package/lines/unitButton.d.ts +8 -0
- package/lines/unitButton.js +8 -0
- package/lines/unitButton.js.map +1 -0
- package/lines/valueLineComponent.d.ts +15 -0
- package/lines/valueLineComponent.js +13 -0
- package/lines/valueLineComponent.js.map +1 -0
- package/lines/vector2LineComponent.d.ts +36 -0
- package/lines/vector2LineComponent.js +64 -0
- package/lines/vector2LineComponent.js.map +1 -0
- package/lines/vector3LineComponent.d.ts +41 -0
- package/lines/vector3LineComponent.js +75 -0
- package/lines/vector3LineComponent.js.map +1 -0
- package/lines/vector4LineComponent.d.ts +42 -0
- package/lines/vector4LineComponent.js +82 -0
- package/lines/vector4LineComponent.js.map +1 -0
- package/nodeGraphSystem/displayLedger.d.ts +5 -0
- package/nodeGraphSystem/displayLedger.js +4 -0
- package/nodeGraphSystem/displayLedger.js.map +1 -0
- package/nodeGraphSystem/frameNodePort.d.ts +25 -0
- package/nodeGraphSystem/frameNodePort.js +60 -0
- package/nodeGraphSystem/frameNodePort.js.map +1 -0
- package/nodeGraphSystem/graphCanvas.d.ts +111 -0
- package/nodeGraphSystem/graphCanvas.js +1132 -0
- package/nodeGraphSystem/graphCanvas.js.map +1 -0
- package/nodeGraphSystem/graphFrame.d.ts +153 -0
- package/nodeGraphSystem/graphFrame.js +1329 -0
- package/nodeGraphSystem/graphFrame.js.map +1 -0
- package/nodeGraphSystem/graphNode.d.ts +79 -0
- package/nodeGraphSystem/graphNode.js +460 -0
- package/nodeGraphSystem/graphNode.js.map +1 -0
- package/nodeGraphSystem/interfaces/displayManager.d.ts +13 -0
- package/nodeGraphSystem/interfaces/displayManager.js +2 -0
- package/nodeGraphSystem/interfaces/displayManager.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeContainer.d.ts +6 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js +2 -0
- package/nodeGraphSystem/interfaces/nodeContainer.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeData.d.ts +15 -0
- package/nodeGraphSystem/interfaces/nodeData.js +2 -0
- package/nodeGraphSystem/interfaces/nodeData.js.map +1 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.d.ts +26 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js +2 -0
- package/nodeGraphSystem/interfaces/nodeLocationInfo.js.map +1 -0
- package/nodeGraphSystem/interfaces/portData.d.ts +28 -0
- package/nodeGraphSystem/interfaces/portData.js +8 -0
- package/nodeGraphSystem/interfaces/portData.js.map +1 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.d.ts +6 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js +2 -0
- package/nodeGraphSystem/interfaces/propertyComponentProps.js.map +1 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.d.ts +11 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js +2 -0
- package/nodeGraphSystem/interfaces/selectionChangedOptions.js.map +1 -0
- package/nodeGraphSystem/nodeLink.d.ts +31 -0
- package/nodeGraphSystem/nodeLink.js +183 -0
- package/nodeGraphSystem/nodeLink.js.map +1 -0
- package/nodeGraphSystem/nodePort.d.ts +35 -0
- package/nodeGraphSystem/nodePort.js +129 -0
- package/nodeGraphSystem/nodePort.js.map +1 -0
- package/nodeGraphSystem/propertyLedger.d.ts +8 -0
- package/nodeGraphSystem/propertyLedger.js +4 -0
- package/nodeGraphSystem/propertyLedger.js.map +1 -0
- package/nodeGraphSystem/stateManager.d.ts +45 -0
- package/nodeGraphSystem/stateManager.js +19 -0
- package/nodeGraphSystem/stateManager.js.map +1 -0
- package/nodeGraphSystem/tools.d.ts +5 -0
- package/nodeGraphSystem/tools.js +37 -0
- package/nodeGraphSystem/tools.js.map +1 -0
- package/nodeGraphSystem/typeLedger.d.ts +8 -0
- package/nodeGraphSystem/typeLedger.js +3 -0
- package/nodeGraphSystem/typeLedger.js.map +1 -0
- package/nodeGraphSystem/types/framePortData.d.ts +7 -0
- package/nodeGraphSystem/types/framePortData.js +2 -0
- package/nodeGraphSystem/types/framePortData.js.map +1 -0
- package/package.json +55 -0
- package/propertyChangedEvent.d.ts +7 -0
- package/propertyChangedEvent.js +3 -0
- package/propertyChangedEvent.js.map +1 -0
- package/readme.md +6 -0
- package/stories/Button.stories.d.ts +10 -0
- package/stories/Button.stories.js +20 -0
- package/stories/Button.stories.js.map +1 -0
- package/stories/Icon.stories.d.ts +9 -0
- package/stories/Icon.stories.js +17 -0
- package/stories/Icon.stories.js.map +1 -0
- package/stories/Label.stories.d.ts +8 -0
- package/stories/Label.stories.js +11 -0
- package/stories/Label.stories.js.map +1 -0
- package/stories/MessageDialog.stories.d.ts +9 -0
- package/stories/MessageDialog.stories.js +20 -0
- package/stories/MessageDialog.stories.js.map +1 -0
- package/stories/Toggle.stories.d.ts +9 -0
- package/stories/Toggle.stories.js +18 -0
- package/stories/Toggle.stories.js.map +1 -0
- package/stories/bars/CommandBarComponent.stories.d.ts +11 -0
- package/stories/bars/CommandBarComponent.stories.js +13 -0
- package/stories/bars/CommandBarComponent.stories.js.map +1 -0
- package/stories/bars/CommandButtonComponent.stories.d.ts +6 -0
- package/stories/bars/CommandButtonComponent.stories.js +7 -0
- package/stories/bars/CommandButtonComponent.stories.js.map +1 -0
- package/stories/colorPicker/ColorPicker.stories.d.ts +11 -0
- package/stories/colorPicker/ColorPicker.stories.js +5 -0
- package/stories/colorPicker/ColorPicker.stories.js.map +1 -0
- package/stories/lines/ColorLineComponent.stories.d.ts +21 -0
- package/stories/lines/ColorLineComponent.stories.js +10 -0
- package/stories/lines/ColorLineComponent.stories.js.map +1 -0
- package/stories/lines/ColorPickerLineComponent.stories.d.ts +14 -0
- package/stories/lines/ColorPickerLineComponent.stories.js +11 -0
- package/stories/lines/ColorPickerLineComponent.stories.js.map +1 -0
- package/stories/lines/FileButtonLineComponent.stories.d.ts +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js +6 -0
- package/stories/lines/FileButtonLineComponent.stories.js.map +1 -0
- package/stories/lines/NumericInputComponent.stories.d.ts +11 -0
- package/stories/lines/NumericInputComponent.stories.js +6 -0
- package/stories/lines/NumericInputComponent.stories.js.map +1 -0
- package/stringTools.d.ts +11 -0
- package/stringTools.js +89 -0
- package/stringTools.js.map +1 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/checkboxPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/colorPickerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js +56 -0
- package/tabs/propertyGrids/gui/commonControlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js +13 -0
- package/tabs/propertyGrids/gui/controlPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/ellipsePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.d.ts +17 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js +39 -0
- package/tabs/propertyGrids/gui/gridPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/imageBasedSliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js +26 -0
- package/tabs/propertyGrids/gui/imagePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/inputTextPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.d.ts +16 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js +28 -0
- package/tabs/propertyGrids/gui/linePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js +18 -0
- package/tabs/propertyGrids/gui/radioButtonPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/rectanglePropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js +16 -0
- package/tabs/propertyGrids/gui/scrollViewerPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js +17 -0
- package/tabs/propertyGrids/gui/sliderPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js +15 -0
- package/tabs/propertyGrids/gui/stackPanelPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.d.ts +15 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js +35 -0
- package/tabs/propertyGrids/gui/textBlockPropertyGridComponent.js.map +1 -0
- package/tabs/propertyGrids/lockObject.d.ts +9 -0
- package/tabs/propertyGrids/lockObject.js +12 -0
- package/tabs/propertyGrids/lockObject.js.map +1 -0
@@ -0,0 +1,18 @@
|
|
1
|
+
import * as React from "react";
|
2
|
+
import type { LockObject } from "../tabs/propertyGrids/lockObject";
|
3
|
+
export interface IColorComponentEntryProps {
|
4
|
+
value: number;
|
5
|
+
label: string;
|
6
|
+
max?: number;
|
7
|
+
min?: number;
|
8
|
+
onChange: (value: number) => void;
|
9
|
+
disabled?: boolean;
|
10
|
+
lockObject: LockObject;
|
11
|
+
}
|
12
|
+
export declare class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {
|
13
|
+
constructor(props: IColorComponentEntryProps);
|
14
|
+
updateValue(valueString: string): void;
|
15
|
+
lock(): void;
|
16
|
+
unlock(): void;
|
17
|
+
render(): JSX.Element;
|
18
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
export class ColorComponentEntry extends React.Component {
|
4
|
+
constructor(props) {
|
5
|
+
super(props);
|
6
|
+
}
|
7
|
+
updateValue(valueString) {
|
8
|
+
if (/[^0-9.-]/g.test(valueString)) {
|
9
|
+
return;
|
10
|
+
}
|
11
|
+
let valueAsNumber = parseInt(valueString);
|
12
|
+
if (isNaN(valueAsNumber)) {
|
13
|
+
return;
|
14
|
+
}
|
15
|
+
if (this.props.max != undefined && valueAsNumber > this.props.max) {
|
16
|
+
valueAsNumber = this.props.max;
|
17
|
+
}
|
18
|
+
if (this.props.min != undefined && valueAsNumber < this.props.min) {
|
19
|
+
valueAsNumber = this.props.min;
|
20
|
+
}
|
21
|
+
this.props.onChange(valueAsNumber);
|
22
|
+
}
|
23
|
+
lock() {
|
24
|
+
if (this.props.lockObject) {
|
25
|
+
this.props.lockObject.lock = true;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
unlock() {
|
29
|
+
if (this.props.lockObject) {
|
30
|
+
this.props.lockObject.lock = false;
|
31
|
+
}
|
32
|
+
}
|
33
|
+
render() {
|
34
|
+
return (_jsxs("div", { className: "color-picker-component", children: [_jsx("div", { className: "color-picker-component-value", 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: "color-picker-component-label", children: this.props.label })] }));
|
35
|
+
}
|
36
|
+
}
|
37
|
+
//# sourceMappingURL=colorComponentEntry.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"colorComponentEntry.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/colorPicker/colorComponentEntry.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,OAAO,mBAAoB,SAAQ,KAAK,CAAC,SAAoC;IAC/E,YAAY,KAAgC;QACxC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAED,WAAW,CAAC,WAAmB;QAC3B,IAAI,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE;YAC/B,OAAO;SACV;QAED,IAAI,aAAa,GAAG,QAAQ,CAAC,WAAW,CAAC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,KAAK,CAAC,QAAQ,GAC/B,GACA,EACN,cAAK,SAAS,EAAC,8BAA8B,YAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAO,IACpE,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\nexport interface IColorComponentEntryProps {\r\n value: number;\r\n label: string;\r\n max?: number;\r\n min?: number;\r\n onChange: (value: number) => void;\r\n disabled?: boolean;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class ColorComponentEntry extends React.Component<IColorComponentEntryProps> {\r\n constructor(props: IColorComponentEntryProps) {\r\n super(props);\r\n }\r\n\r\n updateValue(valueString: string) {\r\n if (/[^0-9.-]/g.test(valueString)) {\r\n return;\r\n }\r\n\r\n let valueAsNumber = parseInt(valueString);\r\n\r\n if (isNaN(valueAsNumber)) {\r\n return;\r\n }\r\n if (this.props.max != undefined && valueAsNumber > this.props.max) {\r\n valueAsNumber = this.props.max;\r\n }\r\n if (this.props.min != undefined && valueAsNumber < this.props.min) {\r\n valueAsNumber = this.props.min;\r\n }\r\n\r\n this.props.onChange(valueAsNumber);\r\n }\r\n\r\n lock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }\r\n\r\n unlock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n public render() {\r\n return (\r\n <div className=\"color-picker-component\">\r\n <div className=\"color-picker-component-value\">\r\n <input\r\n type=\"number\"\r\n step={1}\r\n className=\"numeric-input\"\r\n value={this.props.value}\r\n onBlur={() => this.unlock()}\r\n onFocus={() => this.lock()}\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n disabled={this.props.disabled}\r\n />\r\n </div>\r\n <div className=\"color-picker-component-label\">{this.props.label}</div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +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
|
+
import "./colorPicker.scss";
|
5
|
+
/**
|
6
|
+
* Interface used to specify creation options for color picker
|
7
|
+
*/
|
8
|
+
export interface IColorPickerProps {
|
9
|
+
color: Color3 | Color4;
|
10
|
+
linearhint?: boolean;
|
11
|
+
debugMode?: boolean;
|
12
|
+
onColorChanged?: (color: Color3 | Color4) => void;
|
13
|
+
lockObject: LockObject;
|
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
|
+
}
|
@@ -0,0 +1,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 "./colorPicker.scss";
|
7
|
+
/**
|
8
|
+
* Class used to create a color picker
|
9
|
+
*/
|
10
|
+
export class ColorPicker extends React.Component {
|
11
|
+
constructor(props) {
|
12
|
+
super(props);
|
13
|
+
if (this.props.color instanceof Color4) {
|
14
|
+
this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };
|
15
|
+
}
|
16
|
+
else {
|
17
|
+
this.state = { color: this.props.color.clone(), alpha: 1 };
|
18
|
+
}
|
19
|
+
this._saturationRef = React.createRef();
|
20
|
+
this._hueRef = React.createRef();
|
21
|
+
}
|
22
|
+
shouldComponentUpdate(nextProps, nextState) {
|
23
|
+
return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();
|
24
|
+
}
|
25
|
+
onSaturationPointerDown(evt) {
|
26
|
+
this._evaluateSaturation(evt);
|
27
|
+
this._isSaturationPointerDown = true;
|
28
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
29
|
+
}
|
30
|
+
onSaturationPointerUp(evt) {
|
31
|
+
this._isSaturationPointerDown = false;
|
32
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
33
|
+
}
|
34
|
+
onSaturationPointerMove(evt) {
|
35
|
+
if (!this._isSaturationPointerDown) {
|
36
|
+
return;
|
37
|
+
}
|
38
|
+
this._evaluateSaturation(evt);
|
39
|
+
}
|
40
|
+
onHuePointerDown(evt) {
|
41
|
+
this._evaluateHue(evt);
|
42
|
+
this._isHuePointerDown = true;
|
43
|
+
evt.currentTarget.setPointerCapture(evt.pointerId);
|
44
|
+
}
|
45
|
+
onHuePointerUp(evt) {
|
46
|
+
this._isHuePointerDown = false;
|
47
|
+
evt.currentTarget.releasePointerCapture(evt.pointerId);
|
48
|
+
}
|
49
|
+
onHuePointerMove(evt) {
|
50
|
+
if (!this._isHuePointerDown) {
|
51
|
+
return;
|
52
|
+
}
|
53
|
+
this._evaluateHue(evt);
|
54
|
+
}
|
55
|
+
_evaluateSaturation(evt) {
|
56
|
+
const left = evt.nativeEvent.offsetX;
|
57
|
+
const top = evt.nativeEvent.offsetY;
|
58
|
+
const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current.clientWidth));
|
59
|
+
const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current.clientHeight));
|
60
|
+
if (this.props.debugMode) {
|
61
|
+
console.log("Saturation: " + saturation);
|
62
|
+
console.log("Value: " + value);
|
63
|
+
}
|
64
|
+
const hsv = this.state.color.toHSV();
|
65
|
+
Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);
|
66
|
+
if (this.state.alpha === 0) {
|
67
|
+
this.setState({ alpha: 1 });
|
68
|
+
}
|
69
|
+
this.setState({ color: this.state.color });
|
70
|
+
}
|
71
|
+
_evaluateHue(evt) {
|
72
|
+
const left = evt.nativeEvent.offsetX;
|
73
|
+
const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current.clientWidth));
|
74
|
+
if (this.props.debugMode) {
|
75
|
+
console.log("Hue: " + hue);
|
76
|
+
}
|
77
|
+
const hsv = this.state.color.toHSV();
|
78
|
+
Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);
|
79
|
+
this.setState({ color: this.state.color });
|
80
|
+
}
|
81
|
+
componentDidUpdate() {
|
82
|
+
this.raiseOnColorChanged();
|
83
|
+
}
|
84
|
+
raiseOnColorChanged() {
|
85
|
+
if (!this.props.onColorChanged) {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
if (this.props.color instanceof Color4) {
|
89
|
+
const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);
|
90
|
+
this.props.onColorChanged(newColor4);
|
91
|
+
return;
|
92
|
+
}
|
93
|
+
this.props.onColorChanged(this.state.color.clone());
|
94
|
+
}
|
95
|
+
render() {
|
96
|
+
const color4 = Color4.FromColor3(this.state.color);
|
97
|
+
color4.a = this.state.alpha;
|
98
|
+
const colorHex = color4.toHexString();
|
99
|
+
const hsv = this.state.color.toHSV();
|
100
|
+
const colorRef = new Color3();
|
101
|
+
Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);
|
102
|
+
const colorHexRef = colorRef.toHexString();
|
103
|
+
const hasAlpha = this.props.color instanceof Color4;
|
104
|
+
return (_jsxs("div", { className: "color-picker-container" + (this.props.linearhint ? " with-hints" : ""), children: [_jsxs("div", { className: "color-picker-saturation", onPointerMove: (e) => this.onSaturationPointerMove(e), onPointerDown: (e) => this.onSaturationPointerDown(e), onPointerUp: (e) => this.onSaturationPointerUp(e), ref: this._saturationRef, style: {
|
105
|
+
background: colorHexRef,
|
106
|
+
}, children: [_jsx("div", { className: "color-picker-saturation-white" }), _jsx("div", { className: "color-picker-saturation-black" }), _jsx("div", { className: "color-picker-saturation-cursor", style: {
|
107
|
+
top: `${-(hsv.b * 100) + 100}%`,
|
108
|
+
left: `${hsv.g * 100}%`,
|
109
|
+
} })] }), _jsxs("div", { className: "color-picker-hue", children: [_jsx("div", { className: "color-picker-hue-color", style: {
|
110
|
+
background: colorHex,
|
111
|
+
} }), _jsx("div", { className: "color-picker-hue-slider", ref: this._hueRef, onPointerMove: (e) => this.onHuePointerMove(e), onPointerDown: (e) => this.onHuePointerDown(e), onPointerUp: (e) => this.onHuePointerUp(e), children: _jsx("div", { className: "color-picker-hue-cursor", style: {
|
112
|
+
left: `${(hsv.r / 360.0) * 100}%`,
|
113
|
+
border: `1px solid ` + colorHexRef,
|
114
|
+
} }) })] }), _jsx("div", { className: "color-picker-alpha" }), _jsxs("div", { className: "color-picker-rgb", children: [_jsx("div", { className: "red", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "R", min: 0, max: 255, value: Math.round(this.state.color.r * 255), onChange: (value) => {
|
115
|
+
this.state.color.r = value / 255.0;
|
116
|
+
this.forceUpdate();
|
117
|
+
} }) }), _jsx("div", { className: "green", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "G", min: 0, max: 255, value: Math.round(this.state.color.g * 255), onChange: (value) => {
|
118
|
+
this.state.color.g = value / 255.0;
|
119
|
+
this.forceUpdate();
|
120
|
+
} }) }), _jsx("div", { className: "blue", children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "B", min: 0, max: 255, value: Math.round(this.state.color.b * 255), onChange: (value) => {
|
121
|
+
this.state.color.b = value / 255.0;
|
122
|
+
this.forceUpdate();
|
123
|
+
} }) }), _jsx("div", { className: "alpha" + (hasAlpha ? "" : " grayed"), children: _jsx(ColorComponentEntry, { lockObject: this.props.lockObject, label: "A", min: 0, max: 255, value: Math.round(this.state.alpha * 255), onChange: (value) => {
|
124
|
+
this.setState({ alpha: value / 255.0 });
|
125
|
+
this.forceUpdate();
|
126
|
+
} }) })] }), _jsxs("div", { className: "color-picker-hex", children: [_jsx("div", { className: "color-picker-hex-label", children: "Hex" }), _jsx("div", { className: "color-picker-hex-value", children: _jsx(HexColor, { lockObject: this.props.lockObject, expectedLength: hasAlpha ? 8 : 6, value: colorHex, onChange: (value) => {
|
127
|
+
if (hasAlpha) {
|
128
|
+
const color4 = Color4.FromHexString(value);
|
129
|
+
this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });
|
130
|
+
}
|
131
|
+
else {
|
132
|
+
this.setState({ color: Color3.FromHexString(value) });
|
133
|
+
}
|
134
|
+
} }) })] }), this.props.linearhint && (_jsx("div", { className: "color-picker-warning", children: "(Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))" }))] }));
|
135
|
+
}
|
136
|
+
}
|
137
|
+
//# sourceMappingURL=colorPicker.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"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;oCAChB,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,EAAE,CAAC,CAAC;oCACxC,IAAI,CAAC,WAAW,EAAE,CAAC;gCACvB,CAAC,GACH,GACA,IACJ,EACN,eAAK,SAAS,EAAC,kBAAkB,aAC7B,cAAK,SAAS,EAAC,wBAAwB,oBAAU,EACjD,cAAK,SAAS,EAAC,wBAAwB,YACnC,KAAC,QAAQ,IACL,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,EACjC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAChC,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;oCAChB,IAAI,QAAQ,EAAE;wCACV,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;wCAC3C,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;qCACvF;yCAAM;wCACH,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;qCACzD;gCACL,CAAC,GACH,GACA,IACJ,EACL,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CACtB,cAAK,SAAS,EAAC,sBAAsB,0IAE/B,CACT,IACC,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { ColorComponentEntry } from \"./colorComponentEntry\";\r\nimport { HexColor } from \"./hexColor\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\nimport \"./colorPicker.scss\";\r\n\r\n/**\r\n * Interface used to specify creation options for color picker\r\n */\r\nexport interface IColorPickerProps {\r\n color: Color3 | Color4;\r\n linearhint?: boolean;\r\n debugMode?: boolean;\r\n onColorChanged?: (color: Color3 | Color4) => void;\r\n lockObject: LockObject;\r\n}\r\n\r\n/**\r\n * Interface used to specify creation options for color picker\r\n */\r\nexport interface IColorPickerState {\r\n color: Color3;\r\n alpha: number;\r\n}\r\n\r\n/**\r\n * Class used to create a color picker\r\n */\r\nexport class ColorPicker extends React.Component<IColorPickerProps, IColorPickerState> {\r\n private _saturationRef: React.RefObject<HTMLDivElement>;\r\n private _hueRef: React.RefObject<HTMLDivElement>;\r\n private _isSaturationPointerDown: boolean;\r\n private _isHuePointerDown: boolean;\r\n\r\n constructor(props: IColorPickerProps) {\r\n super(props);\r\n if (this.props.color instanceof Color4) {\r\n this.state = { color: new Color3(this.props.color.r, this.props.color.g, this.props.color.b), alpha: this.props.color.a };\r\n } else {\r\n this.state = { color: this.props.color.clone(), alpha: 1 };\r\n }\r\n this._saturationRef = React.createRef();\r\n this._hueRef = React.createRef();\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IColorPickerProps, nextState: IColorPickerState) {\r\n return nextProps.color.toHexString() !== this.props.color.toHexString() || nextState.color.toHexString() !== this.props.color.toHexString();\r\n }\r\n\r\n onSaturationPointerDown(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._evaluateSaturation(evt);\r\n this._isSaturationPointerDown = true;\r\n\r\n evt.currentTarget.setPointerCapture(evt.pointerId);\r\n }\r\n\r\n onSaturationPointerUp(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._isSaturationPointerDown = false;\r\n evt.currentTarget.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n onSaturationPointerMove(evt: React.PointerEvent<HTMLDivElement>) {\r\n if (!this._isSaturationPointerDown) {\r\n return;\r\n }\r\n this._evaluateSaturation(evt);\r\n }\r\n\r\n onHuePointerDown(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._evaluateHue(evt);\r\n this._isHuePointerDown = true;\r\n\r\n evt.currentTarget.setPointerCapture(evt.pointerId);\r\n }\r\n\r\n onHuePointerUp(evt: React.PointerEvent<HTMLDivElement>) {\r\n this._isHuePointerDown = false;\r\n evt.currentTarget.releasePointerCapture(evt.pointerId);\r\n }\r\n\r\n onHuePointerMove(evt: React.PointerEvent<HTMLDivElement>) {\r\n if (!this._isHuePointerDown) {\r\n return;\r\n }\r\n this._evaluateHue(evt);\r\n }\r\n\r\n private _evaluateSaturation(evt: React.PointerEvent<HTMLDivElement>) {\r\n const left = evt.nativeEvent.offsetX;\r\n const top = evt.nativeEvent.offsetY;\r\n\r\n const saturation = Math.min(1, Math.max(0.0001, left / this._saturationRef.current!.clientWidth));\r\n const value = Math.min(1, Math.max(0.0001, 1 - top / this._saturationRef.current!.clientHeight));\r\n\r\n if (this.props.debugMode) {\r\n console.log(\"Saturation: \" + saturation);\r\n console.log(\"Value: \" + value);\r\n }\r\n\r\n const hsv = this.state.color.toHSV();\r\n Color3.HSVtoRGBToRef(hsv.r, saturation, value, this.state.color);\r\n if (this.state.alpha === 0) {\r\n this.setState({ alpha: 1 });\r\n }\r\n this.setState({ color: this.state.color });\r\n }\r\n\r\n private _evaluateHue(evt: React.PointerEvent<HTMLDivElement>) {\r\n const left = evt.nativeEvent.offsetX;\r\n\r\n const hue = 360 * Math.min(0.9999, Math.max(0.0001, left / this._hueRef.current!.clientWidth));\r\n\r\n if (this.props.debugMode) {\r\n console.log(\"Hue: \" + hue);\r\n }\r\n\r\n const hsv = this.state.color.toHSV();\r\n Color3.HSVtoRGBToRef(hue, Math.max(hsv.g, 0.01), Math.max(hsv.b, 0.01), this.state.color);\r\n this.setState({ color: this.state.color });\r\n }\r\n\r\n componentDidUpdate() {\r\n this.raiseOnColorChanged();\r\n }\r\n\r\n raiseOnColorChanged() {\r\n if (!this.props.onColorChanged) {\r\n return;\r\n }\r\n\r\n if (this.props.color instanceof Color4) {\r\n const newColor4 = Color4.FromColor3(this.state.color, this.state.alpha);\r\n\r\n this.props.onColorChanged(newColor4);\r\n\r\n return;\r\n }\r\n\r\n this.props.onColorChanged(this.state.color.clone());\r\n }\r\n\r\n public render() {\r\n const color4 = Color4.FromColor3(this.state.color);\r\n color4.a = this.state.alpha;\r\n const colorHex = color4.toHexString();\r\n const hsv = this.state.color.toHSV();\r\n const colorRef = new Color3();\r\n Color3.HSVtoRGBToRef(hsv.r, 1, 1, colorRef);\r\n const colorHexRef = colorRef.toHexString();\r\n const hasAlpha = this.props.color instanceof Color4;\r\n\r\n return (\r\n <div className={\"color-picker-container\" + (this.props.linearhint ? \" with-hints\" : \"\")}>\r\n <div\r\n className=\"color-picker-saturation\"\r\n onPointerMove={(e) => this.onSaturationPointerMove(e)}\r\n onPointerDown={(e) => this.onSaturationPointerDown(e)}\r\n onPointerUp={(e) => this.onSaturationPointerUp(e)}\r\n ref={this._saturationRef}\r\n style={{\r\n background: colorHexRef,\r\n }}\r\n >\r\n <div className=\"color-picker-saturation-white\"></div>\r\n <div className=\"color-picker-saturation-black\"></div>\r\n <div\r\n className=\"color-picker-saturation-cursor\"\r\n style={{\r\n top: `${-(hsv.b * 100) + 100}%`,\r\n left: `${hsv.g * 100}%`,\r\n }}\r\n ></div>\r\n </div>\r\n <div className=\"color-picker-hue\">\r\n <div\r\n className=\"color-picker-hue-color\"\r\n style={{\r\n background: colorHex,\r\n }}\r\n ></div>\r\n <div\r\n className=\"color-picker-hue-slider\"\r\n ref={this._hueRef}\r\n onPointerMove={(e) => this.onHuePointerMove(e)}\r\n onPointerDown={(e) => this.onHuePointerDown(e)}\r\n onPointerUp={(e) => this.onHuePointerUp(e)}\r\n >\r\n <div\r\n className=\"color-picker-hue-cursor\"\r\n style={{\r\n left: `${(hsv.r / 360.0) * 100}%`,\r\n border: `1px solid ` + colorHexRef,\r\n }}\r\n ></div>\r\n </div>\r\n </div>\r\n <div className=\"color-picker-alpha\"></div>\r\n <div className=\"color-picker-rgb\">\r\n <div className=\"red\">\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"R\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.r * 255)}\r\n onChange={(value) => {\r\n this.state.color.r = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className=\"green\">\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"G\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.g * 255)}\r\n onChange={(value) => {\r\n this.state.color.g = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className=\"blue\">\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"B\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.color.b * 255)}\r\n onChange={(value) => {\r\n this.state.color.b = value / 255.0;\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n <div className={\"alpha\" + (hasAlpha ? \"\" : \" grayed\")}>\r\n <ColorComponentEntry\r\n lockObject={this.props.lockObject}\r\n label=\"A\"\r\n min={0}\r\n max={255}\r\n value={Math.round(this.state.alpha * 255)}\r\n onChange={(value) => {\r\n this.setState({ alpha: value / 255.0 });\r\n this.forceUpdate();\r\n }}\r\n />\r\n </div>\r\n </div>\r\n <div className=\"color-picker-hex\">\r\n <div className=\"color-picker-hex-label\">Hex</div>\r\n <div className=\"color-picker-hex-value\">\r\n <HexColor\r\n lockObject={this.props.lockObject}\r\n expectedLength={hasAlpha ? 8 : 6}\r\n value={colorHex}\r\n onChange={(value) => {\r\n if (hasAlpha) {\r\n const color4 = Color4.FromHexString(value);\r\n this.setState({ color: new Color3(color4.r, color4.g, color4.b), alpha: color4.a });\r\n } else {\r\n this.setState({ color: Color3.FromHexString(value) });\r\n }\r\n }}\r\n />\r\n </div>\r\n </div>\r\n {this.props.linearhint && (\r\n <div className=\"color-picker-warning\">\r\n (Note: color is stored in linear mode and was converted to gamma to be displayed here (toGammaSpace() / toLinearSpace()))\r\n </div>\r\n )}\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +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
|
+
}
|
@@ -0,0 +1,43 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import * as React from "react";
|
3
|
+
export class HexColor extends React.Component {
|
4
|
+
constructor(props) {
|
5
|
+
super(props);
|
6
|
+
this.state = { hex: this.props.value.replace("#", "") };
|
7
|
+
}
|
8
|
+
shouldComponentUpdate(nextProps, nextState) {
|
9
|
+
if (nextProps.value !== this.props.value) {
|
10
|
+
nextState.hex = nextProps.value.replace("#", "");
|
11
|
+
}
|
12
|
+
return true;
|
13
|
+
}
|
14
|
+
lock() {
|
15
|
+
if (this.props.lockObject) {
|
16
|
+
this.props.lockObject.lock = true;
|
17
|
+
}
|
18
|
+
}
|
19
|
+
unlock() {
|
20
|
+
if (this.props.lockObject) {
|
21
|
+
this.props.lockObject.lock = false;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
updateHexValue(valueString) {
|
25
|
+
if (valueString != "" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
this.setState({ hex: valueString });
|
29
|
+
if (valueString.length !== this.props.expectedLength) {
|
30
|
+
if (this.props.expectedLength === 8 && valueString.length === 6) {
|
31
|
+
valueString = valueString + "FF";
|
32
|
+
}
|
33
|
+
else {
|
34
|
+
return;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
this.props.onChange("#" + valueString);
|
38
|
+
}
|
39
|
+
render() {
|
40
|
+
return (_jsx("input", { type: "string", className: "hex-input", value: this.state.hex, onBlur: () => this.unlock(), onFocus: () => this.lock(), onChange: (evt) => this.updateHexValue(evt.target.value) }));
|
41
|
+
}
|
42
|
+
}
|
43
|
+
//# sourceMappingURL=hexColor.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hexColor.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/colorPicker/hexColor.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAA0C;IAC1E,YAAY,KAAqB;QAC7B,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,IAAI,CAAC,KAAK,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;IAC5D,CAAC;IAED,qBAAqB,CAAC,SAAyB,EAAE,SAA0B;QACvE,IAAI,SAAS,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE;YACtC,SAAS,CAAC,GAAG,GAAG,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;SACpD;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI;QACA,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC;SACrC;IACL,CAAC;IAED,MAAM;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACvB,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,GAAG,KAAK,CAAC;SACtC;IACL,CAAC;IAED,cAAc,CAAC,WAAmB;QAC9B,IAAI,WAAW,IAAI,EAAE,IAAI,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,KAAK,EAAE;YACnE,OAAO;SACV;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,CAAC,CAAC;QAEpC,IAAI,WAAW,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE;YAClD,IAAI,IAAI,CAAC,KAAK,CAAC,cAAc,KAAK,CAAC,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC7D,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;aACpC;iBAAM;gBACH,OAAO;aACV;SACJ;QAED,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,GAAG,WAAW,CAAC,CAAC;IAC3C,CAAC;IAEM,MAAM;QACT,OAAO,CACH,gBACI,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,WAAW,EACrB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,EACrB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,EAC3B,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAC1B,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAC1D,CACL,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { LockObject } from \"../tabs/propertyGrids/lockObject\";\r\n\r\nexport interface IHexColorProps {\r\n value: string;\r\n expectedLength: number;\r\n onChange: (value: string) => void;\r\n lockObject: LockObject;\r\n}\r\n\r\nexport class HexColor extends React.Component<IHexColorProps, { hex: string }> {\r\n constructor(props: IHexColorProps) {\r\n super(props);\r\n\r\n this.state = { hex: this.props.value.replace(\"#\", \"\") };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IHexColorProps, nextState: { hex: string }) {\r\n if (nextProps.value !== this.props.value) {\r\n nextState.hex = nextProps.value.replace(\"#\", \"\");\r\n }\r\n\r\n return true;\r\n }\r\n\r\n lock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = true;\r\n }\r\n }\r\n\r\n unlock() {\r\n if (this.props.lockObject) {\r\n this.props.lockObject.lock = false;\r\n }\r\n }\r\n\r\n updateHexValue(valueString: string) {\r\n if (valueString != \"\" && /^[0-9A-Fa-f]+$/g.test(valueString) == false) {\r\n return;\r\n }\r\n\r\n this.setState({ hex: valueString });\r\n\r\n if (valueString.length !== this.props.expectedLength) {\r\n if (this.props.expectedLength === 8 && valueString.length === 6) {\r\n valueString = valueString + \"FF\";\r\n } else {\r\n return;\r\n }\r\n }\r\n\r\n this.props.onChange(\"#\" + valueString);\r\n }\r\n\r\n public render() {\r\n return (\r\n <input\r\n type=\"string\"\r\n className=\"hex-input\"\r\n value={this.state.hex}\r\n onBlur={() => this.unlock()}\r\n onFocus={() => this.lock()}\r\n onChange={(evt) => this.updateHexValue(evt.target.value)}\r\n />\r\n );\r\n }\r\n}\r\n"]}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
export declare type ButtonProps = {
|
3
|
+
disabled?: boolean;
|
4
|
+
active?: boolean;
|
5
|
+
onClick?: () => void;
|
6
|
+
color: "light" | "dark";
|
7
|
+
size: "default" | "small" | "wide";
|
8
|
+
title?: string;
|
9
|
+
};
|
10
|
+
export declare const Button: React.FC<ButtonProps>;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import styles from "./Button.modules.scss";
|
3
|
+
import { ClassNames } from "./classNames.js";
|
4
|
+
export const Button = ({ disabled, active, onClick, children, color, size, title }) => {
|
5
|
+
return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, children: children }));
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=Button.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IACzG,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,EACzJ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,YAEX,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import styles from \"./Button.modules.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport type ButtonProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\";\r\n title?: string;\r\n};\r\n\r\nexport const Button: React.FC<ButtonProps> = ({ disabled, active, onClick, children, color, size, title }) => {\r\n return (\r\n <button\r\n className={ClassNames({ button: true, active, wide: size === \"wide\", small: size === \"small\", light: color === \"light\", dark: color === \"dark\" }, styles)}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { ClassNames } from "./classNames.js";
|
3
|
+
import styles from "./Icon.modules.scss";
|
4
|
+
export const Icon = ({ color = "dark", icon }) => {
|
5
|
+
return _jsx("img", { src: icon, style: { width: "30px", height: "30px" }, className: ClassNames({ light: color === "light" }, styles) });
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=Icon.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAOzC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAClE,OAAO,cAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,EAAE,MAAM,CAAC,GAAI,CAAC;AACrI,CAAC,CAAC","sourcesContent":["import { ClassNames } from \"./classNames\";\r\nimport styles from \"./Icon.modules.scss\";\r\n\r\nexport type IconProps = {\r\n color?: \"dark\" | \"light\";\r\n icon: string;\r\n};\r\n\r\nexport const Icon: React.FC<IconProps> = ({ color = \"dark\", icon }) => {\r\n return <img src={icon} style={{ width: \"30px\", height: \"30px\" }} className={ClassNames({ light: color === \"light\" }, styles)} />;\r\n};\r\n"]}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { ClassNames } from "./classNames.js";
|
3
|
+
import styles from "./Label.modules.scss";
|
4
|
+
export const Label = ({ text, children, color }) => {
|
5
|
+
return (_jsxs("label", { className: ClassNames({ label: true, light: color === "light", dark: color === "dark" }, styles), children: [_jsx("span", { children: text }), children] }));
|
6
|
+
};
|
7
|
+
//# sourceMappingURL=Label.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Label.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Label.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,sBAAsB,CAAC;AAQ1C,MAAM,CAAC,MAAM,KAAK,GAAyB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IACrE,OAAO,CACH,iBAAO,SAAS,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,aACnG,yBAAO,IAAI,GAAQ,EAClB,QAAQ,IACL,CACX,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { ReactChild } from \"react\";\r\nimport { ClassNames } from \"./classNames\";\r\nimport styles from \"./Label.modules.scss\";\r\n\r\nexport type LabelProps = {\r\n text: string;\r\n children?: ReactChild;\r\n color?: \"dark\" | \"light\";\r\n};\r\n\r\nexport const Label: React.FC<LabelProps> = ({ text, children, color }) => {\r\n return (\r\n <label className={ClassNames({ label: true, light: color === \"light\", dark: color === \"dark\" }, styles)}>\r\n <span>{text}</span>\r\n {children}\r\n </label>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useState, useEffect } from "react";
|
3
|
+
import { ClassNames } from "./classNames.js";
|
4
|
+
import styles from "./MessageDialog.modules.scss";
|
5
|
+
export const MessageDialog = (props) => {
|
6
|
+
const [message, setMessage] = useState(props.message);
|
7
|
+
const [isError, setIsError] = useState(props.isError);
|
8
|
+
useEffect(() => {
|
9
|
+
setMessage(props.message);
|
10
|
+
setIsError(props.isError);
|
11
|
+
}, [props]);
|
12
|
+
const onClick = () => {
|
13
|
+
setMessage("");
|
14
|
+
if (props.onClose) {
|
15
|
+
props.onClose();
|
16
|
+
}
|
17
|
+
};
|
18
|
+
if (!message) {
|
19
|
+
return null;
|
20
|
+
}
|
21
|
+
return (_jsx("div", { className: styles["dialog-container"], children: _jsxs("div", { className: styles["dialog"], children: [_jsx("div", { className: styles["dialog-message"], children: message }), _jsx("div", { className: styles["dialog-buttons"], children: _jsx("div", { className: ClassNames({ "dialog-button-ok": true, error: isError }, styles), onClick: onClick, children: "OK" }) })] }) }));
|
22
|
+
};
|
23
|
+
//# sourceMappingURL=MessageDialog.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"MessageDialog.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/MessageDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,8BAA8B,CAAC;AAQlD,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,KAAK,EAAE,EAAE;IACjE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAEtD,SAAS,CAAC,GAAG,EAAE;QACX,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC1B,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,MAAM,OAAO,GAAG,GAAG,EAAE;QACjB,UAAU,CAAC,EAAE,CAAC,CAAC;QACf,IAAI,KAAK,CAAC,OAAO,EAAE;YACf,KAAK,CAAC,OAAO,EAAE,CAAC;SACnB;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,IAAI,CAAC;KACf;IAED,OAAO,CACH,cAAK,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,YACtC,eAAK,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,aAC5B,cAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,YAAG,OAAO,GAAO,EACzD,cAAK,SAAS,EAAE,MAAM,CAAC,gBAAgB,CAAC,YACpC,cAAK,SAAS,EAAE,UAAU,CAAC,EAAE,kBAAkB,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,mBAE5F,GACJ,IACJ,GACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useState, useEffect } from \"react\";\r\nimport * as React from \"react\";\r\nimport { ClassNames } from \"./classNames\";\r\nimport styles from \"./MessageDialog.modules.scss\";\r\n\r\nexport interface MessageDialogProps {\r\n message: string;\r\n isError: boolean;\r\n onClose?: () => void;\r\n}\r\n\r\nexport const MessageDialog: React.FC<MessageDialogProps> = (props) => {\r\n const [message, setMessage] = useState(props.message);\r\n const [isError, setIsError] = useState(props.isError);\r\n\r\n useEffect(() => {\r\n setMessage(props.message);\r\n setIsError(props.isError);\r\n }, [props]);\r\n\r\n const onClick = () => {\r\n setMessage(\"\");\r\n if (props.onClose) {\r\n props.onClose();\r\n }\r\n };\r\n\r\n if (!message) {\r\n return null;\r\n }\r\n\r\n return (\r\n <div className={styles[\"dialog-container\"]}>\r\n <div className={styles[\"dialog\"]}>\r\n <div className={styles[\"dialog-message\"]}>{message}</div>\r\n <div className={styles[\"dialog-buttons\"]}>\r\n <div className={ClassNames({ \"dialog-button-ok\": true, error: isError }, styles)} onClick={onClick}>\r\n OK\r\n </div>\r\n </div>\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import styles from "./Toggle.modules.scss";
|
3
|
+
import { ClassNames } from "./classNames.js";
|
4
|
+
import toggleOnIcon_30px from "../imgs/toggleOnIcon_30px.svg";
|
5
|
+
import toggleMixedIcon_30px from "../imgs/toggleMixedIcon_30px.svg";
|
6
|
+
import toggleOffIcon_30px from "../imgs/toggleOffIcon_30px.svg";
|
7
|
+
import { Icon } from "./Icon.js";
|
8
|
+
const Icons = {
|
9
|
+
on: toggleOnIcon_30px,
|
10
|
+
mixed: toggleMixedIcon_30px,
|
11
|
+
off: toggleOffIcon_30px,
|
12
|
+
};
|
13
|
+
export const Toggle = ({ color = "dark", toggled = "off", padded = false, onToggle = () => { } }) => {
|
14
|
+
return (_jsxs("label", { className: ClassNames({ toggle: true, padded }, styles), children: [_jsx("input", { type: "checkbox", style: { display: "none" }, checked: toggled === "on", onChange: () => onToggle() }), _jsx(Icon, { icon: Icons[toggled], color: color })] }));
|
15
|
+
};
|
16
|
+
//# sourceMappingURL=Toggle.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Toggle.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Toggle.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,iBAAiB,MAAM,+BAA+B,CAAC;AAC9D,OAAO,oBAAoB,MAAM,kCAAkC,CAAC;AACpE,OAAO,kBAAkB,MAAM,gCAAgC,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,MAAM,KAAK,GAAG;IACV,EAAE,EAAE,iBAAiB;IACrB,KAAK,EAAE,oBAAoB;IAC3B,GAAG,EAAE,kBAAkB;CAC1B,CAAC;AASF,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,QAAQ,GAAG,GAAG,EAAE,GAAE,CAAC,EAAE,EAAE,EAAE;IACtH,OAAO,CACH,iBAAO,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,aAC1D,gBAAO,IAAI,EAAC,UAAU,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,QAAQ,EAAE,GAAI,EAC5G,KAAC,IAAI,IAAC,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,GAAI,IACxC,CACX,CAAC;AACN,CAAC,CAAC","sourcesContent":["import styles from \"./Toggle.modules.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nimport toggleOnIcon_30px from \"../imgs/toggleOnIcon_30px.svg\";\r\nimport toggleMixedIcon_30px from \"../imgs/toggleMixedIcon_30px.svg\";\r\nimport toggleOffIcon_30px from \"../imgs/toggleOffIcon_30px.svg\";\r\nimport { Icon } from \"./Icon\";\r\n\r\nconst Icons = {\r\n on: toggleOnIcon_30px,\r\n mixed: toggleMixedIcon_30px,\r\n off: toggleOffIcon_30px,\r\n};\r\n\r\nexport type ToggleProps = {\r\n toggled: \"on\" | \"mixed\" | \"off\";\r\n onToggle?: () => void;\r\n padded?: boolean;\r\n color?: \"dark\" | \"light\";\r\n};\r\n\r\nexport const Toggle: React.FC<ToggleProps> = ({ color = \"dark\", toggled = \"off\", padded = false, onToggle = () => {} }) => {\r\n return (\r\n <label className={ClassNames({ toggle: true, padded }, styles)}>\r\n <input type=\"checkbox\" style={{ display: \"none\" }} checked={toggled === \"on\"} onChange={() => onToggle()} />\r\n <Icon icon={Icons[toggled]} color={color} />\r\n </label>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import type { FC } from "react";
|
2
|
+
export interface ICommandBarComponentProps {
|
3
|
+
onSaveButtonClicked?: () => void;
|
4
|
+
onSaveToSnippetButtonClicked?: () => void;
|
5
|
+
onLoadFromSnippetButtonClicked?: () => void;
|
6
|
+
onHelpButtonClicked?: () => void;
|
7
|
+
onGiveFeedbackButtonClicked?: () => void;
|
8
|
+
onSelectButtonClicked?: () => void;
|
9
|
+
onPanButtonClicked?: () => void;
|
10
|
+
onZoomButtonClicked?: () => void;
|
11
|
+
onFitButtonClicked?: () => void;
|
12
|
+
onArtboardColorChanged?: (newColor: string) => void;
|
13
|
+
artboardColor?: string;
|
14
|
+
artboardColorPickerColor?: string;
|
15
|
+
}
|
16
|
+
export declare const CommandBarComponent: FC<ICommandBarComponentProps>;
|
@@ -0,0 +1,69 @@
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { JoinClassNames } from "../classNames.js";
|
3
|
+
import { CommandButtonComponent } from "./CommandButtonComponent.js";
|
4
|
+
import { CommandDropdownComponent } from "./CommandDropdownComponent.js";
|
5
|
+
import hamburgerIcon from "../../imgs/hamburgerIcon.svg";
|
6
|
+
import pointerIcon from "../../imgs/pointerIcon.svg";
|
7
|
+
import handIcon from "../../imgs/handIcon.svg";
|
8
|
+
import zoomIcon from "../../imgs/zoomIcon.svg";
|
9
|
+
import logoIcon from "../../imgs/babylonLogo.svg";
|
10
|
+
import canvasFitIcon from "../../imgs/canvasFitIcon.svg";
|
11
|
+
import betaFlag from "../../imgs/betaFlag.svg";
|
12
|
+
import style from "./CommandBar.modules.scss";
|
13
|
+
import { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
14
|
+
import { ColorPickerLineComponent } from "../lines/ColorPickerLineComponent.js";
|
15
|
+
export const CommandBarComponent = (props) => {
|
16
|
+
return (_jsxs("div", { className: style.commandBar, children: [_jsxs("div", { className: style.commandsLeft, children: [_jsxs("div", { className: style.divider, children: [_jsx("img", { src: logoIcon, color: "white", className: "active", draggable: false }), _jsx(CommandDropdownComponent
|
17
|
+
//globalState={this.props.globalState}
|
18
|
+
, {
|
19
|
+
//globalState={this.props.globalState}
|
20
|
+
toRight: true, icon: hamburgerIcon, tooltip: "Options", items: [
|
21
|
+
{
|
22
|
+
label: "Save",
|
23
|
+
onClick: () => {
|
24
|
+
props.onSaveButtonClicked && props.onSaveButtonClicked();
|
25
|
+
},
|
26
|
+
},
|
27
|
+
{
|
28
|
+
label: "Load",
|
29
|
+
fileButton: true,
|
30
|
+
},
|
31
|
+
{
|
32
|
+
label: "Save to snippet",
|
33
|
+
onClick: () => {
|
34
|
+
props.onSaveToSnippetButtonClicked && props.onSaveToSnippetButtonClicked();
|
35
|
+
},
|
36
|
+
},
|
37
|
+
{
|
38
|
+
label: "Load from snippet",
|
39
|
+
onClick: () => {
|
40
|
+
props.onLoadFromSnippetButtonClicked && props.onLoadFromSnippetButtonClicked();
|
41
|
+
},
|
42
|
+
},
|
43
|
+
{
|
44
|
+
label: "Help",
|
45
|
+
onClick: () => {
|
46
|
+
props.onHelpButtonClicked && props.onHelpButtonClicked();
|
47
|
+
},
|
48
|
+
},
|
49
|
+
{
|
50
|
+
label: "Give feedback",
|
51
|
+
onClick: () => {
|
52
|
+
props.onGiveFeedbackButtonClicked && props.onGiveFeedbackButtonClicked();
|
53
|
+
},
|
54
|
+
},
|
55
|
+
] }), _jsx(CommandButtonComponent, { tooltip: "Select", icon: pointerIcon, shortcut: "S", isActive: false, onClick: () => {
|
56
|
+
props.onSelectButtonClicked && props.onSelectButtonClicked();
|
57
|
+
} }), _jsx(CommandButtonComponent, { tooltip: "Pan", icon: handIcon, shortcut: "P", isActive: false, onClick: () => {
|
58
|
+
props.onPanButtonClicked && props.onPanButtonClicked();
|
59
|
+
} }), _jsx(CommandButtonComponent, { tooltip: "Zoom", shortcut: "Z", icon: zoomIcon, isActive: false, onClick: () => {
|
60
|
+
props.onZoomButtonClicked && props.onZoomButtonClicked();
|
61
|
+
} })] }), _jsx("div", { className: style.divider, children: _jsx(CommandButtonComponent, { tooltip: "Fit to Window", shortcut: "F", icon: canvasFitIcon, isActive: false, onClick: () => {
|
62
|
+
props.onFitButtonClicked && props.onFitButtonClicked();
|
63
|
+
} }) }), _jsxs("div", { className: JoinClassNames(style, "divider", "padded"), children: [_jsx("div", { style: { paddingRight: "5px" }, children: "Artboard:" }), props.onArtboardColorChanged && (_jsx(ColorPickerLineComponent, { backgroundColor: props.artboardColorPickerColor || "#888888", value: props.artboardColor ? Color3.FromHexString(props.artboardColor) : new Color3(0, 0, 0), onColorChanged: (newColor) => {
|
64
|
+
if (props.onArtboardColorChanged) {
|
65
|
+
props.onArtboardColorChanged(newColor);
|
66
|
+
}
|
67
|
+
} }))] })] }), _jsx("div", { className: style.commandsRight, children: _jsx("img", { src: betaFlag, className: style.betaFlag, draggable: false }) })] }));
|
68
|
+
};
|
69
|
+
//# sourceMappingURL=CommandBarComponent.js.map
|