@babylonjs/shared-ui-components 8.13.0 → 8.13.1
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/fluent/hoc/buttonLine.d.ts +5 -3
- package/fluent/hoc/buttonLine.js.map +1 -1
- package/fluent/hoc/checkboxPropertyLine.d.ts +9 -0
- package/fluent/hoc/checkboxPropertyLine.js +12 -0
- package/fluent/hoc/checkboxPropertyLine.js.map +1 -0
- package/fluent/hoc/colorPropertyLine.d.ts +4 -11
- package/fluent/hoc/colorPropertyLine.js +25 -7
- package/fluent/hoc/colorPropertyLine.js.map +1 -1
- package/fluent/hoc/dropdownPropertyLine.d.ts +9 -0
- package/fluent/hoc/dropdownPropertyLine.js +12 -0
- package/fluent/hoc/dropdownPropertyLine.js.map +1 -0
- package/fluent/hoc/fileUploadLine.d.ts +8 -0
- package/fluent/hoc/fileUploadLine.js +18 -0
- package/fluent/hoc/fileUploadLine.js.map +1 -0
- package/fluent/hoc/hexLineComponent.d.ts +9 -0
- package/fluent/hoc/hexLineComponent.js +12 -0
- package/fluent/hoc/hexLineComponent.js.map +1 -0
- package/fluent/hoc/inputPropertyLine.d.ts +5 -0
- package/fluent/hoc/inputPropertyLine.js +14 -0
- package/fluent/hoc/inputPropertyLine.js.map +1 -0
- package/fluent/hoc/propertyLine.d.ts +30 -3
- package/fluent/hoc/propertyLine.js +32 -15
- package/fluent/hoc/propertyLine.js.map +1 -1
- package/fluent/hoc/switchPropertyLine.d.ts +1 -1
- package/fluent/hoc/switchPropertyLine.js.map +1 -1
- package/fluent/hoc/syncedSliderLine.d.ts +5 -21
- package/fluent/hoc/syncedSliderLine.js +3 -10
- package/fluent/hoc/syncedSliderLine.js.map +1 -1
- package/fluent/hoc/vectorPropertyLine.d.ts +30 -11
- package/fluent/hoc/vectorPropertyLine.js +23 -6
- package/fluent/hoc/vectorPropertyLine.js.map +1 -1
- package/fluent/primitives/accordion.d.ts +6 -0
- package/fluent/primitives/accordion.js +32 -0
- package/fluent/primitives/accordion.js.map +1 -0
- package/fluent/primitives/checkbox.d.ts +2 -1
- package/fluent/primitives/checkbox.js +7 -7
- package/fluent/primitives/checkbox.js.map +1 -1
- package/fluent/primitives/colorPicker.d.ts +38 -0
- package/fluent/primitives/colorPicker.js +174 -0
- package/fluent/primitives/colorPicker.js.map +1 -0
- package/fluent/primitives/dropdown.d.ts +8 -8
- package/fluent/primitives/dropdown.js +15 -4
- package/fluent/primitives/dropdown.js.map +1 -1
- package/fluent/primitives/input.d.ts +8 -2
- package/fluent/primitives/input.js +4 -8
- package/fluent/primitives/input.js.map +1 -1
- package/fluent/primitives/spinButton.d.ts +4 -0
- package/fluent/primitives/spinButton.js +28 -0
- package/fluent/primitives/spinButton.js.map +1 -0
- package/fluent/primitives/switch.d.ts +3 -2
- package/fluent/primitives/switch.js +8 -8
- package/fluent/primitives/switch.js.map +1 -1
- package/fluent/primitives/syncedSlider.d.ts +5 -10
- package/fluent/primitives/syncedSlider.js +8 -7
- package/fluent/primitives/syncedSlider.js.map +1 -1
- package/fluent/primitives/textarea.d.ts +4 -0
- package/fluent/primitives/textarea.js.map +1 -1
- package/lines/checkBoxLineComponent.js +2 -2
- package/lines/checkBoxLineComponent.js.map +1 -1
- package/lines/colorLineComponent.d.ts +2 -0
- package/lines/colorLineComponent.js +14 -1
- package/lines/colorLineComponent.js.map +1 -1
- package/lines/fileButtonLineComponent.d.ts +2 -0
- package/lines/fileButtonLineComponent.js +9 -1
- package/lines/fileButtonLineComponent.js.map +1 -1
- package/lines/optionsLineComponent.js +3 -3
- package/lines/optionsLineComponent.js.map +1 -1
- package/lines/sliderLineComponent.js +1 -1
- package/lines/sliderLineComponent.js.map +1 -1
- package/lines/textInputLineComponent.js +1 -10
- package/lines/textInputLineComponent.js.map +1 -1
- package/lines/vector3LineComponent.js +2 -2
- package/lines/vector3LineComponent.js.map +1 -1
- package/package.json +1 -1
- package/fluent/primitives/text.d.ts +0 -1
- package/fluent/primitives/text.js +0 -3
- package/fluent/primitives/text.js.map +0 -1
@@ -1,7 +1,10 @@
|
|
1
|
-
import type { ButtonProps as FluentButtonProps } from "@fluentui/react-components";
|
2
1
|
import type { FunctionComponent } from "react";
|
3
|
-
type ButtonLineProps =
|
2
|
+
export type ButtonLineProps = {
|
4
3
|
label: string;
|
4
|
+
onClick: () => void;
|
5
|
+
disabled?: boolean;
|
6
|
+
icon?: string;
|
7
|
+
title?: string;
|
5
8
|
};
|
6
9
|
/**
|
7
10
|
* Wraps a button with a label in a line container
|
@@ -9,4 +12,3 @@ type ButtonLineProps = FluentButtonProps & {
|
|
9
12
|
* @returns A button inside a line
|
10
13
|
*/
|
11
14
|
export declare const ButtonLine: FunctionComponent<ButtonLineProps>;
|
12
|
-
export {};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buttonLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"buttonLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,mBAAmB,GAAG,UAAU,CAAC;IACnC,MAAM,EAAE;QACJ,MAAM,EAAE,aAAa,MAAM,CAAC,oBAAoB,EAAE;KACrD;CACJ,CAAC,CAAC;AAUH;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAuC,CAAC,KAAK,EAAE,EAAE;IACpE,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IACtC,OAAO,CACH,KAAC,aAAa,cACV,KAAC,MAAM,IAAC,SAAS,EAAE,OAAO,CAAC,MAAM,KAAM,KAAK,YACxC,KAAC,KAAK,cAAE,KAAK,CAAC,KAAK,GAAS,GACvB,GACG,CACnB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Body1, Button, makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport { LineContainer } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\nconst useButtonLineStyles = makeStyles({\r\n button: {\r\n border: `1px solid ${tokens.colorBrandBackground}`,\r\n },\r\n});\r\n\r\nexport type ButtonLineProps = {\r\n label: string;\r\n onClick: () => void;\r\n disabled?: boolean;\r\n icon?: string;\r\n title?: string;\r\n};\r\n\r\n/**\r\n * Wraps a button with a label in a line container\r\n * @param props Button props plus a label\r\n * @returns A button inside a line\r\n */\r\nexport const ButtonLine: FunctionComponent<ButtonLineProps> = (props) => {\r\n const classes = useButtonLineStyles();\r\n return (\r\n <LineContainer>\r\n <Button className={classes.button} {...props}>\r\n <Body1>{props.label}</Body1>\r\n </Button>\r\n </LineContainer>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { PropertyLineProps } from "./propertyLine.js";
|
2
|
+
import type { FunctionComponent } from "react";
|
3
|
+
import type { CheckboxProps } from "../primitives/checkbox.js";
|
4
|
+
/**
|
5
|
+
* Wraps a checkbox in a property line
|
6
|
+
* @param props - PropertyLineProps and CheckboxProps
|
7
|
+
* @returns property-line wrapped checkbox
|
8
|
+
*/
|
9
|
+
export declare const CheckboxPropertyLine: FunctionComponent<PropertyLineProps & CheckboxProps>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { PropertyLine } from "./propertyLine.js";
|
3
|
+
import { Checkbox } from "../primitives/checkbox.js";
|
4
|
+
/**
|
5
|
+
* Wraps a checkbox in a property line
|
6
|
+
* @param props - PropertyLineProps and CheckboxProps
|
7
|
+
* @returns property-line wrapped checkbox
|
8
|
+
*/
|
9
|
+
export const CheckboxPropertyLine = (props) => {
|
10
|
+
return (_jsx(PropertyLine, { ...props, children: _jsx(Checkbox, { ...props }) }));
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=checkboxPropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkboxPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/checkboxPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGlD;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAyD,CAAC,KAAK,EAAE,EAAE;IAChG,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,QAAQ,OAAK,KAAK,GAAI,GACZ,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { Checkbox } from \"../primitives/checkbox\";\r\nimport type { CheckboxProps } from \"../primitives/checkbox\";\r\n\r\n/**\r\n * Wraps a checkbox in a property line\r\n * @param props - PropertyLineProps and CheckboxProps\r\n * @returns property-line wrapped checkbox\r\n */\r\nexport const CheckboxPropertyLine: FunctionComponent<PropertyLineProps & CheckboxProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Checkbox {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -2,14 +2,7 @@ import type { FunctionComponent } from "react";
|
|
2
2
|
import type { PropertyLineProps } from "./propertyLine.js";
|
3
3
|
import type { Color3 } from "@babylonjs/core/Maths/math.color.js";
|
4
4
|
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
5
|
-
type
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
* Reusable component which renders a color property line containing a label, colorPicker popout, and expandable RGBA values
|
10
|
-
* The expandable RGBA values are synced sliders that allow the user to modify the color's RGBA values directly
|
11
|
-
* @param props - PropertyLine props, replacing children with a color object so that we can properly display the color
|
12
|
-
* @returns Component wrapping a colorPicker component (coming soon) with a property line
|
13
|
-
*/
|
14
|
-
export declare const ColorPropertyLine: FunctionComponent<ColorSliderProps & PropertyLineProps>;
|
15
|
-
export {};
|
5
|
+
import type { ColorPickerProps } from "../primitives/colorPicker.js";
|
6
|
+
export type ColorPropertyLineProps = ColorPickerProps<Color3 | Color4> & PropertyLineProps;
|
7
|
+
export declare const Color3PropertyLine: FunctionComponent<ColorPickerProps<Color3> & PropertyLineProps>;
|
8
|
+
export declare const Color4PropertyLine: FunctionComponent<ColorPickerProps<Color4> & PropertyLineProps>;
|
@@ -1,17 +1,35 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { forwardRef, useState } from "react";
|
2
3
|
import { PropertyLine } from "./propertyLine.js";
|
3
4
|
import { SyncedSliderLine } from "./syncedSliderLine.js";
|
4
5
|
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
5
|
-
|
6
|
-
return (_jsxs(_Fragment, { children: [_jsx(SyncedSliderLine, { label: "R", propertyKey: "r", target: props.color, min: 0, max: 255 }), _jsx(SyncedSliderLine, { label: "G", propertyKey: "g", target: props.color, min: 0, max: 255 }), _jsx(SyncedSliderLine, { label: "B", propertyKey: "b", target: props.color, min: 0, max: 255 }), props.color instanceof Color4 && _jsx(SyncedSliderLine, { label: "A", propertyKey: "a", target: props.color, min: 0, max: 1 })] }));
|
7
|
-
};
|
6
|
+
import { ColorPickerPopup } from "../primitives/colorPicker.js";
|
8
7
|
/**
|
9
8
|
* Reusable component which renders a color property line containing a label, colorPicker popout, and expandable RGBA values
|
10
9
|
* The expandable RGBA values are synced sliders that allow the user to modify the color's RGBA values directly
|
11
10
|
* @param props - PropertyLine props, replacing children with a color object so that we can properly display the color
|
12
|
-
* @returns Component wrapping a colorPicker component
|
11
|
+
* @returns Component wrapping a colorPicker component with a property line
|
13
12
|
*/
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
const ColorPropertyLine = forwardRef((props, ref) => {
|
14
|
+
const [color, setColor] = useState(props.value);
|
15
|
+
const onSliderChange = (value, key) => {
|
16
|
+
let newColor;
|
17
|
+
if (key === "a") {
|
18
|
+
newColor = Color4.FromColor3(color, value);
|
19
|
+
}
|
20
|
+
else {
|
21
|
+
newColor = color.clone();
|
22
|
+
newColor[key] = value / 255.0;
|
23
|
+
}
|
24
|
+
setColor(newColor); // Create a new object to trigger re-render
|
25
|
+
props.onChange(newColor);
|
26
|
+
};
|
27
|
+
const onColorPickerChange = (newColor) => {
|
28
|
+
setColor(newColor);
|
29
|
+
props.onChange(newColor);
|
30
|
+
};
|
31
|
+
return (_jsx(PropertyLine, { ref: ref, ...props, expandedContent: _jsxs(_Fragment, { children: [_jsx(SyncedSliderLine, { label: "R", value: color.r * 255.0, min: 0, max: 255, step: 1, onChange: (value) => onSliderChange(value, "r") }), _jsx(SyncedSliderLine, { label: "G", value: color.g * 255.0, min: 0, max: 255, step: 1, onChange: (value) => onSliderChange(value, "g") }), _jsx(SyncedSliderLine, { label: "B", value: color.b * 255.0, min: 0, max: 255, step: 1, onChange: (value) => onSliderChange(value, "b") }), color instanceof Color4 && _jsx(SyncedSliderLine, { label: "A", value: color.a, min: 0, max: 1, step: 0.01, onChange: (value) => onSliderChange(value, "a") })] }), children: _jsx(ColorPickerPopup, { ...props, onChange: onColorPickerChange, value: color }) }));
|
32
|
+
});
|
33
|
+
export const Color3PropertyLine = ColorPropertyLine;
|
34
|
+
export const Color4PropertyLine = ColorPropertyLine;
|
17
35
|
//# sourceMappingURL=colorPropertyLine.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"colorPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/colorPropertyLine.tsx"],"names":[],"mappings":";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MAAM,kBAAkB,GAAG,iBAAoF,CAAC;AACvH,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAoF,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport { forwardRef, useState } from \"react\";\r\n\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport { SyncedSliderLine } from \"./syncedSliderLine\";\r\n\r\nimport type { Color3 } from \"core/Maths/math.color\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { ColorPickerPopup } from \"../primitives/colorPicker\";\r\nimport type { ColorPickerProps } from \"../primitives/colorPicker\";\r\n\r\nexport type ColorPropertyLineProps = ColorPickerProps<Color3 | Color4> & PropertyLineProps;\r\n\r\n/**\r\n * Reusable component which renders a color property line containing a label, colorPicker popout, and expandable RGBA values\r\n * The expandable RGBA values are synced sliders that allow the user to modify the color's RGBA values directly\r\n * @param props - PropertyLine props, replacing children with a color object so that we can properly display the color\r\n * @returns Component wrapping a colorPicker component with a property line\r\n */\r\nconst ColorPropertyLine = forwardRef<HTMLDivElement, ColorPropertyLineProps>((props, ref) => {\r\n const [color, setColor] = useState(props.value);\r\n\r\n const onSliderChange = (value: number, key: \"r\" | \"g\" | \"b\" | \"a\") => {\r\n let newColor;\r\n if (key === \"a\") {\r\n newColor = Color4.FromColor3(color, value);\r\n } else {\r\n newColor = color.clone();\r\n newColor[key] = value / 255.0;\r\n }\r\n\r\n setColor(newColor); // Create a new object to trigger re-render\r\n props.onChange(newColor);\r\n };\r\n\r\n const onColorPickerChange = (newColor: Color3 | Color4) => {\r\n setColor(newColor);\r\n props.onChange(newColor);\r\n };\r\n\r\n return (\r\n <PropertyLine\r\n ref={ref}\r\n {...props}\r\n expandedContent={\r\n <>\r\n <SyncedSliderLine label=\"R\" value={color.r * 255.0} min={0} max={255} step={1} onChange={(value) => onSliderChange(value, \"r\")} />\r\n <SyncedSliderLine label=\"G\" value={color.g * 255.0} min={0} max={255} step={1} onChange={(value) => onSliderChange(value, \"g\")} />\r\n <SyncedSliderLine label=\"B\" value={color.b * 255.0} min={0} max={255} step={1} onChange={(value) => onSliderChange(value, \"b\")} />\r\n {color instanceof Color4 && <SyncedSliderLine label=\"A\" value={color.a} min={0} max={1} step={0.01} onChange={(value) => onSliderChange(value, \"a\")} />}\r\n </>\r\n }\r\n >\r\n <ColorPickerPopup {...props} onChange={onColorPickerChange} value={color} />\r\n </PropertyLine>\r\n );\r\n});\r\n\r\nexport const Color3PropertyLine = ColorPropertyLine as FunctionComponent<ColorPickerProps<Color3> & PropertyLineProps>;\r\nexport const Color4PropertyLine = ColorPropertyLine as FunctionComponent<ColorPickerProps<Color4> & PropertyLineProps>;\r\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { DropdownProps } from "../primitives/dropdown.js";
|
2
|
+
import type { PropertyLineProps } from "./propertyLine.js";
|
3
|
+
import type { FunctionComponent } from "react";
|
4
|
+
/**
|
5
|
+
* Wraps a dropdown in a property line
|
6
|
+
* @param props - PropertyLineProps and DropdownProps
|
7
|
+
* @returns property-line wrapped dropdown
|
8
|
+
*/
|
9
|
+
export declare const DropdownPropertyLine: FunctionComponent<PropertyLineProps & DropdownProps>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { Dropdown } from "../primitives/dropdown.js";
|
3
|
+
import { PropertyLine } from "./propertyLine.js";
|
4
|
+
/**
|
5
|
+
* Wraps a dropdown in a property line
|
6
|
+
* @param props - PropertyLineProps and DropdownProps
|
7
|
+
* @returns property-line wrapped dropdown
|
8
|
+
*/
|
9
|
+
export const DropdownPropertyLine = (props) => {
|
10
|
+
return (_jsx(PropertyLine, { ...props, children: _jsx(Dropdown, { ...props }) }));
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=dropdownPropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dropdownPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/dropdownPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAI9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAyD,CAAC,KAAK,EAAE,EAAE;IAChG,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,QAAQ,OAAK,KAAK,GAAI,GACZ,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Dropdown } from \"../primitives/dropdown\";\r\nimport type { DropdownProps } from \"../primitives/dropdown\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\n/**\r\n * Wraps a dropdown in a property line\r\n * @param props - PropertyLineProps and DropdownProps\r\n * @returns property-line wrapped dropdown\r\n */\r\nexport const DropdownPropertyLine: FunctionComponent<PropertyLineProps & DropdownProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Dropdown {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { FunctionComponent } from "react";
|
2
|
+
import type { ButtonLineProps } from "./buttonLine.js";
|
3
|
+
type FileUploadLineProps = Omit<ButtonLineProps, "onClick"> & {
|
4
|
+
onClick: (file: File) => void;
|
5
|
+
accept: string;
|
6
|
+
};
|
7
|
+
export declare const FileUploadLine: FunctionComponent<FileUploadLineProps>;
|
8
|
+
export {};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
+
import { useRef } from "react";
|
3
|
+
import { ButtonLine } from "./buttonLine.js";
|
4
|
+
export const FileUploadLine = (props) => {
|
5
|
+
const inputRef = useRef(null);
|
6
|
+
const handleButtonClick = () => {
|
7
|
+
inputRef.current?.click();
|
8
|
+
};
|
9
|
+
const handleChange = (evt) => {
|
10
|
+
const files = evt.target.files;
|
11
|
+
if (files && files.length) {
|
12
|
+
props.onClick(files[0]);
|
13
|
+
}
|
14
|
+
evt.target.value = "";
|
15
|
+
};
|
16
|
+
return (_jsxs(_Fragment, { children: [_jsx(ButtonLine, { onClick: handleButtonClick, label: props.label }), _jsx("input", { ref: inputRef, type: "file", accept: props.accept, style: { display: "none" }, onChange: handleChange })] }));
|
17
|
+
};
|
18
|
+
//# sourceMappingURL=fileUploadLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"fileUploadLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/fileUploadLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ1C,MAAM,CAAC,MAAM,cAAc,GAA2C,CAAC,KAAK,EAAE,EAAE;IAC5E,MAAM,QAAQ,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAEhD,MAAM,iBAAiB,GAAG,GAAG,EAAE;QAC3B,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC9B,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,CAAC,GAAwC,EAAE,EAAE;QAC9D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/B,IAAI,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACH,8BACI,KAAC,UAAU,IAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAe,EACzE,gBAAO,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAC,MAAM,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,GAAI,IAC/G,CACN,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useRef } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { ButtonLine } from \"./buttonLine\";\r\nimport type { ButtonLineProps } from \"./buttonLine\";\r\n\r\ntype FileUploadLineProps = Omit<ButtonLineProps, \"onClick\"> & {\r\n onClick: (file: File) => void;\r\n accept: string;\r\n};\r\n\r\nexport const FileUploadLine: FunctionComponent<FileUploadLineProps> = (props) => {\r\n const inputRef = useRef<HTMLInputElement>(null);\r\n\r\n const handleButtonClick = () => {\r\n inputRef.current?.click();\r\n };\r\n\r\n const handleChange = (evt: React.ChangeEvent<HTMLInputElement>) => {\r\n const files = evt.target.files;\r\n if (files && files.length) {\r\n props.onClick(files[0]);\r\n }\r\n evt.target.value = \"\";\r\n };\r\n\r\n return (\r\n <>\r\n <ButtonLine onClick={handleButtonClick} label={props.label}></ButtonLine>\r\n <input ref={inputRef} type=\"file\" accept={props.accept} style={{ display: \"none\" }} onChange={handleChange} />\r\n </>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { PropertyLineProps } from "./propertyLine.js";
|
2
|
+
import type { FunctionComponent } from "react";
|
3
|
+
import type { InputHexProps } from "../primitives/colorPicker.js";
|
4
|
+
/**
|
5
|
+
* Wraps a hex input in a property line
|
6
|
+
* @param props - PropertyLineProps and InputHexProps
|
7
|
+
* @returns property-line wrapped input hex component
|
8
|
+
*/
|
9
|
+
export declare const HexPropertyLine: FunctionComponent<InputHexProps & PropertyLineProps>;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { PropertyLine } from "./propertyLine.js";
|
3
|
+
import { InputHexField } from "../primitives/colorPicker.js";
|
4
|
+
/**
|
5
|
+
* Wraps a hex input in a property line
|
6
|
+
* @param props - PropertyLineProps and InputHexProps
|
7
|
+
* @returns property-line wrapped input hex component
|
8
|
+
*/
|
9
|
+
export const HexPropertyLine = (props) => {
|
10
|
+
return (_jsx(PropertyLine, { ...props, children: _jsx(InputHexField, { ...props }) }));
|
11
|
+
};
|
12
|
+
//# sourceMappingURL=hexLineComponent.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hexLineComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/hexLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG1D;;;;GAIG;AACH,MAAM,CAAC,MAAM,eAAe,GAAyD,CAAC,KAAK,EAAE,EAAE;IAC3F,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,aAAa,OAAK,KAAK,GAAI,GACjB,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { InputHexField } from \"../primitives/colorPicker\";\r\nimport type { InputHexProps } from \"../primitives/colorPicker\";\r\n\r\n/**\r\n * Wraps a hex input in a property line\r\n * @param props - PropertyLineProps and InputHexProps\r\n * @returns property-line wrapped input hex component\r\n */\r\nexport const HexPropertyLine: FunctionComponent<InputHexProps & PropertyLineProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <InputHexField {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { PropertyLineProps } from "./propertyLine.js";
|
2
|
+
import type { FunctionComponent } from "react";
|
3
|
+
import type { InputProps } from "../primitives/input.js";
|
4
|
+
export declare const TextInputPropertyLine: FunctionComponent<InputProps<string> & PropertyLineProps>;
|
5
|
+
export declare const FloatInputPropertyLine: FunctionComponent<InputProps<number> & PropertyLineProps>;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { PropertyLine } from "./propertyLine.js";
|
3
|
+
import { Input } from "../primitives/input.js";
|
4
|
+
/**
|
5
|
+
* Wraps an input in a property line
|
6
|
+
* @param props - PropertyLineProps and InputProps
|
7
|
+
* @returns property-line wrapped input component
|
8
|
+
*/
|
9
|
+
const InputPropertyLine = (props) => {
|
10
|
+
return (_jsx(PropertyLine, { ...props, children: _jsx(Input, { ...props }) }));
|
11
|
+
};
|
12
|
+
export const TextInputPropertyLine = InputPropertyLine;
|
13
|
+
export const FloatInputPropertyLine = InputPropertyLine;
|
14
|
+
//# sourceMappingURL=inputPropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"inputPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/inputPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAK5C;;;;GAIG;AACH,MAAM,iBAAiB,GAA8C,CAAC,KAAK,EAAE,EAAE;IAC3E,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,KAAK,OAAK,KAAK,GAAI,GACT,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAA8E,CAAC;AACpH,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAA8E,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { Input } from \"../primitives/input\";\r\nimport type { InputProps } from \"../primitives/input\";\r\n\r\ntype InputPropertyLineProps = InputProps<string | number> & PropertyLineProps;\r\n\r\n/**\r\n * Wraps an input in a property line\r\n * @param props - PropertyLineProps and InputProps\r\n * @returns property-line wrapped input component\r\n */\r\nconst InputPropertyLine: FunctionComponent<InputPropertyLineProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Input {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n\r\nexport const TextInputPropertyLine = InputPropertyLine as FunctionComponent<InputProps<string> & PropertyLineProps>;\r\nexport const FloatInputPropertyLine = InputPropertyLine as FunctionComponent<InputProps<number> & PropertyLineProps>;\r\n"]}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { FunctionComponent
|
1
|
+
import type { FunctionComponent } from "react";
|
2
2
|
export type PropertyLineProps = {
|
3
3
|
/**
|
4
4
|
* The name of the property to display in the property line.
|
@@ -16,8 +16,32 @@ export type PropertyLineProps = {
|
|
16
16
|
* If supplied, an 'expand' icon will be shown which, when clicked, renders this component within the property line.
|
17
17
|
*/
|
18
18
|
expandedContent?: JSX.Element;
|
19
|
+
/**
|
20
|
+
* Link to the documentation for this property, available from the info icon either linked from the description (if provided) or defalt 'docs' text
|
21
|
+
*/
|
22
|
+
docLink?: string;
|
23
|
+
};
|
24
|
+
export declare const LineContainer: import("react").ForwardRefExoticComponent<{
|
25
|
+
children?: import("react").ReactNode | undefined;
|
26
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
27
|
+
export type BaseComponentProps<T> = {
|
28
|
+
/**
|
29
|
+
* The value of the property to be displayed and modified.
|
30
|
+
*/
|
31
|
+
value: T;
|
32
|
+
/**
|
33
|
+
* Callback function to handle changes to the value
|
34
|
+
*/
|
35
|
+
onChange: (value: T) => void;
|
36
|
+
/**
|
37
|
+
* Optional flag to disable the component, preventing any interaction.
|
38
|
+
*/
|
39
|
+
disabled?: boolean;
|
40
|
+
/**
|
41
|
+
* Optional class name to apply custom styles to the component.
|
42
|
+
*/
|
43
|
+
className?: string;
|
19
44
|
};
|
20
|
-
export declare const LineContainer: FunctionComponent<PropsWithChildren>;
|
21
45
|
/**
|
22
46
|
* A reusable component that renders a property line with a label and child content, and an optional description, copy button, and expandable section.
|
23
47
|
*
|
@@ -25,4 +49,7 @@ export declare const LineContainer: FunctionComponent<PropsWithChildren>;
|
|
25
49
|
* @returns A React element representing the property line.
|
26
50
|
*
|
27
51
|
*/
|
28
|
-
export declare const PropertyLine:
|
52
|
+
export declare const PropertyLine: import("react").ForwardRefExoticComponent<PropertyLineProps & {
|
53
|
+
children?: import("react").ReactNode | undefined;
|
54
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
55
|
+
export declare const PlaceholderPropertyLine: FunctionComponent<BaseComponentProps<any> & PropertyLineProps>;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { Body1Strong, Button, InfoLabel, makeStyles, tokens } from "@fluentui/react-components";
|
3
|
-
import {
|
4
|
-
import {
|
2
|
+
import { Body1, Body1Strong, Button, InfoLabel, Link, ToggleButton, makeStyles, tokens } from "@fluentui/react-components";
|
3
|
+
import { Collapse } from "@fluentui/react-motion-components-preview";
|
4
|
+
import { AddFilled, CopyRegular, SubtractFilled } from "@fluentui/react-icons";
|
5
|
+
import { useContext, useState, forwardRef } from "react";
|
5
6
|
import { copyCommandToClipboard } from "../../copyCommandToClipboard.js";
|
6
7
|
import { ToolContext } from "./fluentToolWrapper.js";
|
7
8
|
const usePropertyLineStyles = makeStyles({
|
@@ -19,18 +20,29 @@ const usePropertyLineStyles = makeStyles({
|
|
19
20
|
width: "100%",
|
20
21
|
},
|
21
22
|
label: {
|
22
|
-
|
23
|
+
flex: "1 1 0",
|
24
|
+
minWidth: "50px",
|
23
25
|
textAlign: "left",
|
26
|
+
whiteSpace: "nowrap",
|
27
|
+
overflow: "hidden",
|
28
|
+
textOverflow: "ellipsis",
|
29
|
+
},
|
30
|
+
labelText: {
|
31
|
+
whiteSpace: "nowrap",
|
24
32
|
},
|
25
33
|
rightContent: {
|
26
|
-
|
34
|
+
flex: "0 1 auto",
|
27
35
|
display: "flex",
|
28
36
|
alignItems: "center",
|
29
37
|
justifyContent: "flex-end",
|
38
|
+
gap: tokens.spacingHorizontalS,
|
30
39
|
},
|
31
40
|
button: {
|
32
41
|
marginLeft: tokens.spacingHorizontalXXS,
|
33
|
-
|
42
|
+
margin: 0,
|
43
|
+
padding: 0,
|
44
|
+
border: 0,
|
45
|
+
minWidth: 0,
|
34
46
|
},
|
35
47
|
fillRestOfRightContentWidth: {
|
36
48
|
flex: 1,
|
@@ -38,14 +50,15 @@ const usePropertyLineStyles = makeStyles({
|
|
38
50
|
justifyContent: "flex-end",
|
39
51
|
alignItems: "center",
|
40
52
|
},
|
41
|
-
|
42
|
-
|
53
|
+
expandButton: {
|
54
|
+
margin: 0,
|
43
55
|
},
|
56
|
+
expandedContent: {},
|
44
57
|
});
|
45
|
-
export const LineContainer = (props) => {
|
58
|
+
export const LineContainer = forwardRef((props, ref) => {
|
46
59
|
const classes = usePropertyLineStyles();
|
47
|
-
return _jsx("div", { className: classes.container, children: props.children });
|
48
|
-
};
|
60
|
+
return (_jsx("div", { ref: ref, className: classes.container, children: props.children }));
|
61
|
+
});
|
49
62
|
/**
|
50
63
|
* A reusable component that renders a property line with a label and child content, and an optional description, copy button, and expandable section.
|
51
64
|
*
|
@@ -53,14 +66,18 @@ export const LineContainer = (props) => {
|
|
53
66
|
* @returns A React element representing the property line.
|
54
67
|
*
|
55
68
|
*/
|
56
|
-
export const PropertyLine = (props) => {
|
69
|
+
export const PropertyLine = forwardRef((props, ref) => {
|
57
70
|
const classes = usePropertyLineStyles();
|
58
71
|
const [expanded, setExpanded] = useState(false);
|
59
|
-
const { label,
|
72
|
+
const { label, onCopy, expandedContent, children } = props;
|
60
73
|
const { disableCopy } = useContext(ToolContext);
|
61
|
-
|
74
|
+
const description = props.description ?? (props.docLink ? _jsx(Link, { href: props.docLink, children: props.description ?? "Docs" }) : props.description);
|
75
|
+
return (_jsxs(LineContainer, { ref: ref, children: [_jsxs("div", { className: classes.line, children: [_jsx(InfoLabel, { className: classes.label, info: description, children: _jsx(Body1Strong, { className: classes.labelText, children: label }) }), _jsxs("div", { className: classes.rightContent, children: [_jsx("div", { className: classes.fillRestOfRightContentWidth, children: children }), expandedContent && (_jsx(ToggleButton, { appearance: "transparent", icon: expanded ? _jsx(SubtractFilled, {}) : _jsx(AddFilled, {}), className: classes.button, checked: expanded, onClick: (e) => {
|
62
76
|
e.stopPropagation();
|
63
77
|
setExpanded((expanded) => !expanded);
|
64
|
-
} })), onCopy && !disableCopy && (_jsx(Button, { className: classes.button, id: "copyProperty", icon: _jsx(
|
78
|
+
} })), onCopy && !disableCopy && (_jsx(Button, { className: classes.button, id: "copyProperty", icon: _jsx(CopyRegular, {}), onClick: () => copyCommandToClipboard(onCopy()), title: "Copy to clipboard" }))] })] }), _jsx(Collapse, { visible: expanded && !!expandedContent, children: _jsx("div", { className: classes.expandedContent, children: expandedContent }) })] }));
|
79
|
+
});
|
80
|
+
export const PlaceholderPropertyLine = (props) => {
|
81
|
+
return (_jsx(PropertyLine, { ...props, children: _jsx(Body1, { children: props.value }) }));
|
65
82
|
};
|
66
83
|
//# sourceMappingURL=propertyLine.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"propertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,M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K,GAAS,GACjB,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Body1, Body1Strong, Button, InfoLabel, Link, ToggleButton, makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport { Collapse } from \"@fluentui/react-motion-components-preview\";\r\nimport { AddFilled, CopyRegular, SubtractFilled } from \"@fluentui/react-icons\";\r\nimport type { FunctionComponent, PropsWithChildren } from \"react\";\r\nimport { useContext, useState, forwardRef } from \"react\";\r\nimport { copyCommandToClipboard } from \"../../copyCommandToClipboard\";\r\nimport { ToolContext } from \"./fluentToolWrapper\";\r\n\r\nconst usePropertyLineStyles = makeStyles({\r\n container: {\r\n width: \"100%\",\r\n display: \"flex\",\r\n flexDirection: \"column\", // Stack line + expanded content\r\n borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\r\n },\r\n line: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"flex-start\",\r\n padding: `${tokens.spacingVerticalXS} 0px`,\r\n width: \"100%\",\r\n },\r\n label: {\r\n flex: \"1 1 0\",\r\n minWidth: \"50px\",\r\n textAlign: \"left\",\r\n whiteSpace: \"nowrap\",\r\n overflow: \"hidden\",\r\n textOverflow: \"ellipsis\",\r\n },\r\n labelText: {\r\n whiteSpace: \"nowrap\",\r\n },\r\n rightContent: {\r\n flex: \"0 1 auto\",\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"flex-end\",\r\n gap: tokens.spacingHorizontalS,\r\n },\r\n button: {\r\n marginLeft: tokens.spacingHorizontalXXS,\r\n margin: 0,\r\n padding: 0,\r\n border: 0,\r\n minWidth: 0,\r\n },\r\n fillRestOfRightContentWidth: {\r\n flex: 1,\r\n display: \"flex\",\r\n justifyContent: \"flex-end\",\r\n alignItems: \"center\",\r\n },\r\n expandButton: {\r\n margin: 0,\r\n },\r\n expandedContent: {},\r\n});\r\n\r\nexport type PropertyLineProps = {\r\n /**\r\n * The name of the property to display in the property line.\r\n */\r\n label: string;\r\n /**\r\n * Optional description for the property, shown on hover of the info icon\r\n */\r\n description?: string;\r\n /**\r\n * Optional function returning a string to copy to clipboard.\r\n */\r\n onCopy?: () => string;\r\n /**\r\n * If supplied, an 'expand' icon will be shown which, when clicked, renders this component within the property line.\r\n */\r\n expandedContent?: JSX.Element;\r\n\r\n /**\r\n * Link to the documentation for this property, available from the info icon either linked from the description (if provided) or defalt 'docs' text\r\n */\r\n docLink?: string;\r\n};\r\n\r\nexport const LineContainer = forwardRef<HTMLDivElement, PropsWithChildren>((props, ref) => {\r\n const classes = usePropertyLineStyles();\r\n return (\r\n <div ref={ref} className={classes.container}>\r\n {props.children}\r\n </div>\r\n );\r\n});\r\n\r\nexport type BaseComponentProps<T> = {\r\n /**\r\n * The value of the property to be displayed and modified.\r\n */\r\n value: T;\r\n /**\r\n * Callback function to handle changes to the value\r\n */\r\n onChange: (value: T) => void;\r\n /**\r\n * Optional flag to disable the component, preventing any interaction.\r\n */\r\n disabled?: boolean;\r\n /**\r\n * Optional class name to apply custom styles to the component.\r\n */\r\n className?: string;\r\n};\r\n\r\n/**\r\n * A reusable component that renders a property line with a label and child content, and an optional description, copy button, and expandable section.\r\n *\r\n * @param props - The properties for the PropertyLine component.\r\n * @returns A React element representing the property line.\r\n *\r\n */\r\nexport const PropertyLine = forwardRef<HTMLDivElement, PropsWithChildren<PropertyLineProps>>((props, ref) => {\r\n const classes = usePropertyLineStyles();\r\n const [expanded, setExpanded] = useState(false);\r\n\r\n const { label, onCopy, expandedContent, children } = props;\r\n\r\n const { disableCopy } = useContext(ToolContext);\r\n\r\n const description = props.description ?? (props.docLink ? <Link href={props.docLink}>{props.description ?? \"Docs\"}</Link> : props.description);\r\n\r\n return (\r\n <LineContainer ref={ref}>\r\n <div className={classes.line}>\r\n <InfoLabel className={classes.label} info={description}>\r\n <Body1Strong className={classes.labelText}>{label}</Body1Strong>\r\n </InfoLabel>\r\n <div className={classes.rightContent}>\r\n <div className={classes.fillRestOfRightContentWidth}>{children}</div>\r\n\r\n {expandedContent && (\r\n <ToggleButton\r\n appearance=\"transparent\"\r\n icon={expanded ? <SubtractFilled /> : <AddFilled />}\r\n className={classes.button}\r\n checked={expanded}\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n setExpanded((expanded) => !expanded);\r\n }}\r\n />\r\n )}\r\n\r\n {onCopy && !disableCopy && (\r\n <Button className={classes.button} id=\"copyProperty\" icon={<CopyRegular />} onClick={() => copyCommandToClipboard(onCopy())} title=\"Copy to clipboard\" />\r\n )}\r\n </div>\r\n </div>\r\n <Collapse visible={expanded && !!expandedContent}>\r\n <div className={classes.expandedContent}>{expandedContent}</div>\r\n </Collapse>\r\n </LineContainer>\r\n );\r\n});\r\n\r\nexport const PlaceholderPropertyLine: FunctionComponent<BaseComponentProps<any> & PropertyLineProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Body1>{props.value}</Body1>\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { SwitchProps } from "@fluentui/react-components";
|
2
1
|
import type { PropertyLineProps } from "./propertyLine.js";
|
3
2
|
import type { FunctionComponent } from "react";
|
3
|
+
import type { SwitchProps } from "../primitives/switch.js";
|
4
4
|
/**
|
5
5
|
* Wraps a switch in a property line
|
6
6
|
* @param props - The properties for the switch and property line
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"switchPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/switchPropertyLine.tsx"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"switchPropertyLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/switchPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAuD,CAAC,KAAK,EAAE,EAAE;IAC5F,6DAA6D;IAC7D,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACxC,8FAA8F;IAC9F,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,MAAM,OAAK,WAAW,GAAI,GAChB,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { Switch } from \"../primitives/switch\";\r\nimport type { SwitchProps } from \"../primitives/switch\";\r\n/**\r\n * Wraps a switch in a property line\r\n * @param props - The properties for the switch and property line\r\n * @returns A React element representing the property line with a switch\r\n */\r\nexport const SwitchPropertyLine: FunctionComponent<PropertyLineProps & SwitchProps> = (props) => {\r\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\r\n const { label, ...switchProps } = props;\r\n // Ensure the label gets passed to the PropertyLine component and not to the underlying switch\r\n return (\r\n <PropertyLine {...props}>\r\n <Switch {...switchProps} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -1,27 +1,11 @@
|
|
1
1
|
import type { PropertyLineProps } from "./propertyLine.js";
|
2
2
|
import type { SyncedSliderProps } from "../primitives/syncedSlider.js";
|
3
|
-
|
4
|
-
|
5
|
-
* String key
|
6
|
-
*/
|
7
|
-
propertyKey: K;
|
8
|
-
/**
|
9
|
-
* target where O[K] is a number
|
10
|
-
*/
|
11
|
-
target: O;
|
12
|
-
/**
|
13
|
-
* Callback when either the slider or input value changes
|
14
|
-
*/
|
15
|
-
onChange?: (value: number) => void;
|
16
|
-
};
|
3
|
+
import type { FunctionComponent } from "react";
|
4
|
+
type SyncedSliderLineProps = SyncedSliderProps & PropertyLineProps;
|
17
5
|
/**
|
18
|
-
* Renders a
|
19
|
-
* When value changes, updates the object with the new value and calls the onChange callback.
|
20
|
-
*
|
21
|
-
* Example usage looks like
|
22
|
-
* \<SyncedSliderLine propertyKey="x" target=\{vector\} /\>
|
23
|
-
* \<SyncedSliderLine propertyKey="r" target=\{color\} /\>
|
6
|
+
* Renders a simple wrapper around the SyncedSliderInput
|
24
7
|
* @param props
|
25
8
|
* @returns
|
26
9
|
*/
|
27
|
-
export declare const SyncedSliderLine: <
|
10
|
+
export declare const SyncedSliderLine: FunctionComponent<SyncedSliderLineProps>;
|
11
|
+
export {};
|
@@ -2,19 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { PropertyLine } from "./propertyLine.js";
|
3
3
|
import { SyncedSliderInput } from "../primitives/syncedSlider.js";
|
4
4
|
/**
|
5
|
-
* Renders a
|
6
|
-
* When value changes, updates the object with the new value and calls the onChange callback.
|
7
|
-
*
|
8
|
-
* Example usage looks like
|
9
|
-
* \<SyncedSliderLine propertyKey="x" target=\{vector\} /\>
|
10
|
-
* \<SyncedSliderLine propertyKey="r" target=\{color\} /\>
|
5
|
+
* Renders a simple wrapper around the SyncedSliderInput
|
11
6
|
* @param props
|
12
7
|
* @returns
|
13
8
|
*/
|
14
9
|
export const SyncedSliderLine = (props) => {
|
15
|
-
|
16
|
-
|
17
|
-
props.onChange?.(val);
|
18
|
-
} }) }));
|
10
|
+
const { label, ...sliderProps } = props;
|
11
|
+
return (_jsx(PropertyLine, { label: label, children: _jsx(SyncedSliderInput, { ...sliderProps }) }));
|
19
12
|
};
|
20
13
|
//# sourceMappingURL=syncedSliderLine.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"syncedSliderLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/syncedSliderLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
1
|
+
{"version":3,"file":"syncedSliderLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/syncedSliderLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAK/D;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6C,CAAC,KAAK,EAAsB,EAAE;IACpG,MAAM,EAAE,KAAK,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACxC,OAAO,CACH,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,YACtB,KAAC,iBAAiB,OAAK,WAAW,GAAI,GAC3B,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport { SyncedSliderInput } from \"../primitives/syncedSlider\";\r\nimport type { SyncedSliderProps } from \"../primitives/syncedSlider\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\ntype SyncedSliderLineProps = SyncedSliderProps & PropertyLineProps;\r\n/**\r\n * Renders a simple wrapper around the SyncedSliderInput\r\n * @param props\r\n * @returns\r\n */\r\nexport const SyncedSliderLine: FunctionComponent<SyncedSliderLineProps> = (props): React.ReactElement => {\r\n const { label, ...sliderProps } = props;\r\n return (\r\n <PropertyLine label={label}>\r\n <SyncedSliderInput {...sliderProps} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|