@babylonjs/shared-ui-components 8.16.0 → 8.16.2
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/components/Button.d.ts +2 -2
- package/components/Button.js +1 -1
- package/components/Button.js.map +1 -1
- package/components/TextInputWithSubmit.js +2 -2
- package/components/TextInputWithSubmit.js.map +1 -1
- package/fluent/hoc/buttonLine.d.ts +2 -8
- package/fluent/hoc/buttonLine.js +3 -9
- package/fluent/hoc/buttonLine.js.map +1 -1
- package/fluent/hoc/fileUploadLine.d.ts +2 -2
- package/fluent/hoc/fileUploadLine.js +2 -1
- package/fluent/hoc/fileUploadLine.js.map +1 -1
- package/fluent/hoc/gradientList.d.ts +14 -0
- package/fluent/hoc/gradientList.js +76 -0
- package/fluent/hoc/gradientList.js.map +1 -0
- package/fluent/hoc/{readonlyBooleanLine.d.ts → propertyLines/booleanBadgePropertyLine.d.ts} +1 -1
- package/fluent/hoc/{readonlyBooleanLine.js → propertyLines/booleanBadgePropertyLine.js} +2 -2
- package/fluent/hoc/propertyLines/booleanBadgePropertyLine.js.map +1 -0
- package/fluent/hoc/{checkboxPropertyLine.d.ts → propertyLines/checkboxPropertyLine.d.ts} +1 -1
- package/fluent/hoc/{checkboxPropertyLine.js → propertyLines/checkboxPropertyLine.js} +1 -1
- package/fluent/hoc/propertyLines/checkboxPropertyLine.js.map +1 -0
- package/fluent/hoc/{colorPropertyLine.d.ts → propertyLines/colorPropertyLine.d.ts} +1 -1
- package/fluent/hoc/{colorPropertyLine.js → propertyLines/colorPropertyLine.js} +3 -3
- package/fluent/hoc/propertyLines/colorPropertyLine.js.map +1 -0
- package/fluent/hoc/{dropdownPropertyLine.d.ts → propertyLines/dropdownPropertyLine.d.ts} +1 -2
- package/fluent/hoc/{dropdownPropertyLine.js → propertyLines/dropdownPropertyLine.js} +2 -2
- package/fluent/hoc/propertyLines/dropdownPropertyLine.js.map +1 -0
- package/fluent/hoc/{hexLineComponent.d.ts → propertyLines/hexPropertyLine.d.ts} +1 -1
- package/fluent/hoc/{hexLineComponent.js → propertyLines/hexPropertyLine.js} +2 -2
- package/fluent/hoc/propertyLines/hexPropertyLine.js.map +1 -0
- package/fluent/hoc/propertyLines/inputPropertyLine.d.ts +15 -0
- package/fluent/hoc/propertyLines/inputPropertyLine.js +16 -0
- package/fluent/hoc/propertyLines/inputPropertyLine.js.map +1 -0
- package/fluent/hoc/{linkPropertyLine.js → propertyLines/linkPropertyLine.js} +1 -1
- package/fluent/hoc/propertyLines/linkPropertyLine.js.map +1 -0
- package/fluent/hoc/{propertyLine.js → propertyLines/propertyLine.js} +3 -3
- package/fluent/hoc/propertyLines/propertyLine.js.map +1 -0
- package/fluent/hoc/{switchPropertyLine.d.ts → propertyLines/switchPropertyLine.d.ts} +1 -1
- package/fluent/hoc/{switchPropertyLine.js → propertyLines/switchPropertyLine.js} +1 -1
- package/fluent/hoc/propertyLines/switchPropertyLine.js.map +1 -0
- package/fluent/hoc/propertyLines/syncedSliderPropertyLine.d.ts +11 -0
- package/fluent/hoc/{syncedSliderLine.js → propertyLines/syncedSliderPropertyLine.js} +3 -3
- package/fluent/hoc/propertyLines/syncedSliderPropertyLine.js.map +1 -0
- package/fluent/hoc/propertyLines/textPropertyLine.js.map +1 -0
- package/fluent/hoc/{vectorPropertyLine.js → propertyLines/vectorPropertyLine.js} +2 -2
- package/fluent/hoc/propertyLines/vectorPropertyLine.js.map +1 -0
- package/fluent/primitives/button.d.ts +9 -0
- package/fluent/primitives/button.js +14 -0
- package/fluent/primitives/button.js.map +1 -0
- package/fluent/primitives/checkbox.d.ts +1 -1
- package/fluent/primitives/checkbox.js.map +1 -1
- package/fluent/primitives/colorPicker.d.ts +1 -1
- package/fluent/primitives/colorPicker.js +1 -1
- package/fluent/primitives/colorPicker.js.map +1 -1
- package/fluent/primitives/draggable.d.ts +8 -0
- package/fluent/primitives/draggable.js +33 -0
- package/fluent/primitives/draggable.js.map +1 -0
- package/fluent/primitives/dropdown.d.ts +1 -1
- package/fluent/primitives/dropdown.js.map +1 -1
- package/fluent/primitives/gradient.d.ts +28 -0
- package/fluent/primitives/gradient.js +86 -0
- package/fluent/primitives/gradient.js.map +1 -0
- package/fluent/primitives/input.d.ts +3 -7
- package/fluent/primitives/input.js +10 -7
- package/fluent/primitives/input.js.map +1 -1
- package/fluent/primitives/list.d.ts +26 -0
- package/fluent/primitives/list.js +43 -0
- package/fluent/primitives/list.js.map +1 -0
- package/fluent/primitives/messageBar.js +2 -2
- package/fluent/primitives/messageBar.js.map +1 -1
- package/fluent/primitives/spinButton.d.ts +8 -2
- package/fluent/primitives/spinButton.js +4 -2
- package/fluent/primitives/spinButton.js.map +1 -1
- package/fluent/primitives/switch.d.ts +1 -1
- package/fluent/primitives/switch.js.map +1 -1
- package/fluent/primitives/syncedSlider.d.ts +7 -2
- package/fluent/primitives/syncedSlider.js +28 -11
- package/fluent/primitives/syncedSlider.js.map +1 -1
- package/fluent/primitives/textarea.d.ts +1 -1
- package/fluent/primitives/textarea.js.map +1 -1
- package/lines/booleanLineComponent.js +2 -2
- package/lines/booleanLineComponent.js.map +1 -1
- package/lines/buttonLineComponent.js +3 -1
- package/lines/buttonLineComponent.js.map +1 -1
- package/lines/checkBoxLineComponent.js +1 -1
- package/lines/checkBoxLineComponent.js.map +1 -1
- package/lines/colorLineComponent.js +2 -2
- package/lines/colorLineComponent.js.map +1 -1
- package/lines/draggableLineComponent.d.ts +4 -10
- package/lines/draggableLineComponent.js +12 -10
- package/lines/draggableLineComponent.js.map +1 -1
- package/lines/draggableLineWithButtonComponent.d.ts +3 -7
- package/lines/draggableLineWithButtonComponent.js +14 -12
- package/lines/draggableLineWithButtonComponent.js.map +1 -1
- package/lines/fileButtonLineComponent.js +2 -1
- package/lines/fileButtonLineComponent.js.map +1 -1
- package/lines/floatLineComponent.d.ts +2 -0
- package/lines/floatLineComponent.js +23 -1
- package/lines/floatLineComponent.js.map +1 -1
- package/lines/messageLineComponent.d.ts +2 -0
- package/lines/messageLineComponent.js +9 -1
- package/lines/messageLineComponent.js.map +1 -1
- package/lines/optionsLineComponent.d.ts +1 -1
- package/lines/optionsLineComponent.js +1 -1
- package/lines/optionsLineComponent.js.map +1 -1
- package/lines/sliderLineComponent.js +2 -2
- package/lines/sliderLineComponent.js.map +1 -1
- package/lines/textInputLineComponent.js +3 -3
- package/lines/textInputLineComponent.js.map +1 -1
- package/lines/textLineComponent.js +4 -4
- package/lines/textLineComponent.js.map +1 -1
- package/lines/vector3LineComponent.js +1 -1
- package/lines/vector3LineComponent.js.map +1 -1
- package/package.json +1 -1
- package/split/splitContainer.js +4 -2
- package/split/splitContainer.js.map +1 -1
- package/components/lines/ColorLineComponent.d.ts +0 -38
- package/components/lines/ColorLineComponent.js +0 -147
- package/components/lines/ColorLineComponent.js.map +0 -1
- package/components/lines/ColorLineComponent.module.scss +0 -67
- package/fluent/hoc/checkboxPropertyLine.js.map +0 -1
- package/fluent/hoc/colorPropertyLine.js.map +0 -1
- package/fluent/hoc/dropdownPropertyLine.js.map +0 -1
- package/fluent/hoc/hexLineComponent.js.map +0 -1
- package/fluent/hoc/inputPropertyLine.d.ts +0 -5
- package/fluent/hoc/inputPropertyLine.js +0 -14
- package/fluent/hoc/inputPropertyLine.js.map +0 -1
- package/fluent/hoc/linkPropertyLine.js.map +0 -1
- package/fluent/hoc/propertyLine.js.map +0 -1
- package/fluent/hoc/readonlyBooleanLine.js.map +0 -1
- package/fluent/hoc/switchPropertyLine.js.map +0 -1
- package/fluent/hoc/syncedSliderLine.d.ts +0 -11
- package/fluent/hoc/syncedSliderLine.js.map +0 -1
- package/fluent/hoc/textPropertyLine.js.map +0 -1
- package/fluent/hoc/vectorPropertyLine.js.map +0 -1
- package/lines/iconButtonLineComponent.d.ts +0 -11
- package/lines/iconButtonLineComponent.js +0 -11
- package/lines/iconButtonLineComponent.js.map +0 -1
- /package/fluent/hoc/{linkPropertyLine.d.ts → propertyLines/linkPropertyLine.d.ts} +0 -0
- /package/fluent/hoc/{propertyLine.d.ts → propertyLines/propertyLine.d.ts} +0 -0
- /package/fluent/hoc/{textPropertyLine.d.ts → propertyLines/textPropertyLine.d.ts} +0 -0
- /package/fluent/hoc/{textPropertyLine.js → propertyLines/textPropertyLine.js} +0 -0
- /package/fluent/hoc/{vectorPropertyLine.d.ts → propertyLines/vectorPropertyLine.d.ts} +0 -0
package/components/Button.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import type { PropsWithChildren } from "react";
|
2
|
-
export type
|
2
|
+
export type ButtonComponentProps = {
|
3
3
|
disabled?: boolean;
|
4
4
|
active?: boolean;
|
5
5
|
onClick?: () => void;
|
@@ -8,4 +8,4 @@ export type ButtonProps = {
|
|
8
8
|
title?: string;
|
9
9
|
backgroundColor?: string;
|
10
10
|
};
|
11
|
-
export declare const
|
11
|
+
export declare const ButtonComponent: React.FC<PropsWithChildren<ButtonComponentProps>>;
|
package/components/Button.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import * as styles from "./Button.module.scss";
|
3
3
|
import { ClassNames } from "./classNames.js";
|
4
|
-
export const
|
4
|
+
export const ButtonComponent = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {
|
5
5
|
return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", smaller: size === "smaller", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, style: { backgroundColor }, children: children }));
|
6
6
|
};
|
7
7
|
//# sourceMappingURL=Button.js.map
|
package/components/Button.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAa1C,MAAM,CAAC,MAAM,eAAe,GAAsD,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE;IAC/J,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CACjB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EACvJ,MAAM,CACT,EACD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,EAAE,eAAe,EAAE,YAEzB,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { PropsWithChildren } from \"react\";\r\nimport * as styles from \"./Button.module.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\n// Will be deleted after fluent work complete\r\nexport type ButtonComponentProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\" | \"smaller\";\r\n title?: string;\r\n backgroundColor?: string;\r\n};\r\n\r\nexport const ButtonComponent: React.FC<PropsWithChildren<ButtonComponentProps>> = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {\r\n return (\r\n <button\r\n className={ClassNames(\r\n { button: true, active, wide: size === \"wide\", small: size === \"small\", smaller: size === \"smaller\", light: color === \"light\", dark: color === \"dark\" },\r\n styles\r\n )}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n style={{ backgroundColor }}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useState } from "react";
|
3
|
-
import {
|
3
|
+
import { ButtonComponent } from "./Button.js";
|
4
4
|
import { Icon } from "./Icon.js";
|
5
5
|
import * as style from "./TextInputWithSubmit.module.scss";
|
6
6
|
import submitIcon from "../imgs/confirmGridElementDark.svg";
|
@@ -27,6 +27,6 @@ export const TextInputWithSubmit = (props) => {
|
|
27
27
|
props.cancelSubmit?.();
|
28
28
|
setValue("");
|
29
29
|
};
|
30
|
-
return (_jsxs("div", { className: ClassNames({ line: true, valid, invalid: !valid }, style), children: [props.label && _jsx("label", { children: props.label }), _jsx("input", { className: style.input, type: "text", placeholder: props.placeholder, value: value, onChange: onChange }), _jsxs("div", { children: [_jsx(
|
30
|
+
return (_jsxs("div", { className: ClassNames({ line: true, valid, invalid: !valid }, style), children: [props.label && _jsx("label", { children: props.label }), _jsx("input", { className: style.input, type: "text", placeholder: props.placeholder, value: value, onChange: onChange }), _jsxs("div", { children: [_jsx(ButtonComponent, { color: "light", size: "smaller", backgroundColor: "inherit", onClick: onClickSubmit, disabled: !valid, children: _jsx(Icon, { icon: submitIcon, color: "dark" }) }), _jsx(ButtonComponent, { color: "light", size: "smaller", backgroundColor: "inherit", onClick: onClickCancel, children: _jsx(Icon, { icon: cancelIcon, color: "dark" }) })] })] }));
|
31
31
|
};
|
32
32
|
//# sourceMappingURL=TextInputWithSubmit.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextInputWithSubmit.js","sourceRoot":"","sources":["../../../../dev/sharedUiComponents/src/components/TextInputWithSubmit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAA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M,aAAa,GAAG,GAAG,EAAE;QACvB,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC;QACvB,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,OAAO,CACH,eAAK,SAAS,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,KAAK,CAAC,aACpE,KAAK,CAAC,KAAK,IAAI,0BAAQ,KAAK,CAAC,KAAK,GAAS,EAC5C,gBAAO,SAAS,EAAE,KAAK,CAAC,KAAK,EAAE,IAAI,EAAC,MAAM,EAAC,WAAW,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAI,EAC/G,0BACI,KAAC,eAAe,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,SAAS,EAAC,eAAe,EAAC,SAAS,EAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,KAAK,YAC5G,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,GAAQ,GAC9B,EAClB,KAAC,eAAe,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,SAAS,EAAC,eAAe,EAAC,SAAS,EAAC,OAAO,EAAE,aAAa,YAC1F,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,GAAQ,GAC9B,IAChB,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\r\nimport { ButtonComponent } from \"./Button\";\r\nimport { Icon } from \"./Icon\";\r\nimport * as style from \"./TextInputWithSubmit.module.scss\";\r\n\r\nimport submitIcon from \"../imgs/confirmGridElementDark.svg\";\r\nimport cancelIcon from \"../imgs/deleteGridElementDark.svg\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport interface ITextInputProps {\r\n label?: string;\r\n placeholder?: string;\r\n submitValue: (newValue: string) => void; // Function to call when the value is updated\r\n validateValue?: (value: string) => boolean; // Function to call to validate the value\r\n cancelSubmit?: () => void; // Function to call when the user cancels the submit\r\n}\r\n\r\n/**\r\n * This component represents a text input that can be submitted or cancelled on buttons\r\n * @param props properties\r\n * @returns TextInputWithSubmit element\r\n */\r\nexport const TextInputWithSubmit = (props: ITextInputProps) => {\r\n const [value, setValue] = useState(\"\");\r\n const [valid, setValid] = useState(props.validateValue ? props.validateValue(value) : true);\r\n\r\n useEffect(() => {\r\n setValid(props.validateValue ? props.validateValue(value) : true);\r\n }, [value]);\r\n\r\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n setValue(event.target.value);\r\n };\r\n\r\n const onClickSubmit = () => {\r\n props.submitValue(value);\r\n };\r\n\r\n const onClickCancel = () => {\r\n props.cancelSubmit?.();\r\n setValue(\"\");\r\n };\r\n\r\n return (\r\n <div className={ClassNames({ line: true, valid, invalid: !valid }, style)}>\r\n {props.label && <label>{props.label}</label>}\r\n <input className={style.input} type=\"text\" placeholder={props.placeholder} value={value} onChange={onChange} />\r\n <div>\r\n <ButtonComponent color=\"light\" size=\"smaller\" backgroundColor=\"inherit\" onClick={onClickSubmit} disabled={!valid}>\r\n <Icon icon={submitIcon} color=\"dark\"></Icon>\r\n </ButtonComponent>\r\n <ButtonComponent color=\"light\" size=\"smaller\" backgroundColor=\"inherit\" onClick={onClickCancel}>\r\n <Icon icon={cancelIcon} color=\"dark\"></Icon>\r\n </ButtonComponent>\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
|
@@ -1,14 +1,8 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
|
-
|
3
|
-
label: string;
|
4
|
-
onClick: () => void;
|
5
|
-
disabled?: boolean;
|
6
|
-
icon?: string;
|
7
|
-
title?: string;
|
8
|
-
};
|
2
|
+
import type { ButtonProps } from "../primitives/button.js";
|
9
3
|
/**
|
10
4
|
* Wraps a button with a label in a line container
|
11
5
|
* @param props Button props plus a label
|
12
6
|
* @returns A button inside a line
|
13
7
|
*/
|
14
|
-
export declare const ButtonLine: FunctionComponent<
|
8
|
+
export declare const ButtonLine: FunctionComponent<ButtonProps>;
|
package/fluent/hoc/buttonLine.js
CHANGED
@@ -1,18 +1,12 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
const useButtonLineStyles = makeStyles({
|
5
|
-
button: {
|
6
|
-
border: `1px solid ${tokens.colorBrandBackground}`,
|
7
|
-
},
|
8
|
-
});
|
2
|
+
import { LineContainer } from "./propertyLines/propertyLine.js";
|
3
|
+
import { Button } from "../primitives/button.js";
|
9
4
|
/**
|
10
5
|
* Wraps a button with a label in a line container
|
11
6
|
* @param props Button props plus a label
|
12
7
|
* @returns A button inside a line
|
13
8
|
*/
|
14
9
|
export const ButtonLine = (props) => {
|
15
|
-
|
16
|
-
return (_jsx(LineContainer, { children: _jsx(Button, { className: classes.button, ...props, children: _jsx(Body1, { children: props.label }) }) }));
|
10
|
+
return (_jsx(LineContainer, { children: _jsx(Button, { ...props }) }));
|
17
11
|
};
|
18
12
|
//# sourceMappingURL=buttonLine.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"buttonLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"buttonLine.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/buttonLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAmC,CAAC,KAAK,EAAE,EAAE;IAChE,OAAO,CACH,KAAC,aAAa,cACV,KAAC,MAAM,OAAK,KAAK,GAAI,GACT,CACnB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { LineContainer } from \"./propertyLines/propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { Button } from \"../primitives/button\";\r\nimport type { ButtonProps } from \"../primitives/button\";\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<ButtonProps> = (props) => {\r\n return (\r\n <LineContainer>\r\n <Button {...props} />\r\n </LineContainer>\r\n );\r\n};\r\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { FunctionComponent } from "react";
|
2
|
-
import type {
|
3
|
-
type FileUploadLineProps = Omit<
|
2
|
+
import type { ButtonProps } from "../primitives/button.js";
|
3
|
+
type FileUploadLineProps = Omit<ButtonProps, "onClick"> & {
|
4
4
|
onClick: (files: FileList) => void;
|
5
5
|
accept: string;
|
6
6
|
};
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useRef } from "react";
|
3
3
|
import { ButtonLine } from "./buttonLine.js";
|
4
|
+
import { ArrowUploadRegular } from "@fluentui/react-icons";
|
4
5
|
export const FileUploadLine = (props) => {
|
5
6
|
const inputRef = useRef(null);
|
6
7
|
const handleButtonClick = () => {
|
@@ -13,6 +14,6 @@ export const FileUploadLine = (props) => {
|
|
13
14
|
}
|
14
15
|
evt.target.value = "";
|
15
16
|
};
|
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
|
+
return (_jsxs(_Fragment, { children: [_jsx(ButtonLine, { onClick: handleButtonClick, icon: ArrowUploadRegular, label: props.label }), _jsx("input", { ref: inputRef, type: "file", accept: props.accept, style: { display: "none" }, onChange: handleChange })] }));
|
17
18
|
};
|
18
19
|
//# sourceMappingURL=fileUploadLine.js.map
|
@@ -1 +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;
|
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;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAO3D,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;QACzB,CAAC;QACD,GAAG,CAAC,MAAM,CAAC,KAAK,GAAG,EAAE,CAAC;IAC1B,CAAC,CAAC;IAEF,OAAO,CACH,8BACI,KAAC,UAAU,IAAC,OAAO,EAAE,iBAAiB,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,GAAe,EACnG,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 { ButtonProps } from \"../primitives/button\";\r\nimport { ArrowUploadRegular } from \"@fluentui/react-icons\";\r\n\r\ntype FileUploadLineProps = Omit<ButtonProps, \"onClick\"> & {\r\n onClick: (files: FileList) => 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);\r\n }\r\n evt.target.value = \"\";\r\n };\r\n\r\n return (\r\n <>\r\n <ButtonLine onClick={handleButtonClick} icon={ArrowUploadRegular} 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,14 @@
|
|
1
|
+
import type { FunctionComponent } from "react";
|
2
|
+
import { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from "@babylonjs/core/Misc/gradients.js";
|
3
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
4
|
+
type GradientListProps<T extends FactorGradient | Color3Gradient | Color4Gradient> = {
|
5
|
+
label: string;
|
6
|
+
gradients: Nullable<Array<T>>;
|
7
|
+
addGradient: (step?: T) => void;
|
8
|
+
removeGradient: (step: T) => void;
|
9
|
+
onChange: (newGradient: T) => void;
|
10
|
+
};
|
11
|
+
export declare const FactorGradientList: FunctionComponent<GradientListProps<FactorGradient>>;
|
12
|
+
export declare const Color3GradientList: FunctionComponent<GradientListProps<Color3Gradient>>;
|
13
|
+
export declare const Color4GradientList: FunctionComponent<GradientListProps<Color4Gradient>>;
|
14
|
+
export {};
|
@@ -0,0 +1,76 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { List } from "../primitives/list.js";
|
3
|
+
import { Color3GradientComponent, Color4GradientComponent, FactorGradientComponent } from "../primitives/gradient.js";
|
4
|
+
import { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from "@babylonjs/core/Misc/gradients.js";
|
5
|
+
import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
|
6
|
+
// Convert gradients to LineList items and sort by gradient value
|
7
|
+
function GradientsToListItems(gradients) {
|
8
|
+
return (gradients?.map((gradient, index) => ({
|
9
|
+
id: index,
|
10
|
+
data: gradient,
|
11
|
+
sortBy: gradient.gradient,
|
12
|
+
})) ?? []);
|
13
|
+
}
|
14
|
+
const GradientList = (props) => {
|
15
|
+
const { gradients, type } = props;
|
16
|
+
const items = GradientsToListItems(gradients);
|
17
|
+
const deleteStep = (step) => {
|
18
|
+
props.removeGradient(step);
|
19
|
+
};
|
20
|
+
const addNewStep = () => {
|
21
|
+
if (items.length === 0) {
|
22
|
+
props.addGradient(); // Default
|
23
|
+
}
|
24
|
+
else {
|
25
|
+
switch (props.type) {
|
26
|
+
case "Factor": {
|
27
|
+
const newStep = new FactorGradient(1, 1, 1);
|
28
|
+
props.addGradient(newStep);
|
29
|
+
break;
|
30
|
+
}
|
31
|
+
case "Color3": {
|
32
|
+
const newStepColor3 = new Color3Gradient(1, Color3.White());
|
33
|
+
props.addGradient(newStepColor3);
|
34
|
+
break;
|
35
|
+
}
|
36
|
+
case "Color4": {
|
37
|
+
const newStepColor = new Color4Gradient(1, new Color4(1, 1, 1, 1), new Color4(1, 1, 1, 1));
|
38
|
+
props.addGradient(newStepColor);
|
39
|
+
break;
|
40
|
+
}
|
41
|
+
}
|
42
|
+
}
|
43
|
+
};
|
44
|
+
return (_jsx("div", { children: _jsx(List, { addButtonLabel: items.length > 0 ? `Add new ${props.label}` : `Use ${props.label}s`, items: items, onDelete: (item) => deleteStep(item.data), onAdd: addNewStep, renderItem: (item) => {
|
45
|
+
const gradient = item.data;
|
46
|
+
switch (props.type) {
|
47
|
+
case "Factor":
|
48
|
+
return (_jsx(FactorGradientComponent, { value: gradient, onChange: (newGradient) => {
|
49
|
+
item.data.gradient = newGradient.gradient;
|
50
|
+
item.data.factor1 = newGradient.factor1;
|
51
|
+
item.data.factor2 = newGradient.factor2;
|
52
|
+
props.onChange(newGradient);
|
53
|
+
} }));
|
54
|
+
case "Color3":
|
55
|
+
return (_jsx(Color3GradientComponent, { value: gradient, onChange: (newGradient) => {
|
56
|
+
item.data.gradient = newGradient.gradient;
|
57
|
+
item.data.color = newGradient.color;
|
58
|
+
props.onChange(newGradient);
|
59
|
+
} }));
|
60
|
+
case "Color4":
|
61
|
+
return (_jsx(Color4GradientComponent, { value: gradient, onChange: (newGradient) => {
|
62
|
+
item.data.gradient = newGradient.gradient;
|
63
|
+
item.data.color1 = newGradient.color1;
|
64
|
+
item.data.color2 = newGradient.color2;
|
65
|
+
props.onChange(newGradient);
|
66
|
+
} }));
|
67
|
+
}
|
68
|
+
} }, type) }));
|
69
|
+
};
|
70
|
+
const FactorGradientCast = GradientList;
|
71
|
+
const Color3GradientCast = GradientList;
|
72
|
+
const Color4GradientCast = GradientList;
|
73
|
+
export const FactorGradientList = (props) => _jsx(FactorGradientCast, { ...props, type: "Factor" });
|
74
|
+
export const Color3GradientList = (props) => _jsx(Color3GradientCast, { ...props, type: "Color3" });
|
75
|
+
export const Color4GradientList = (props) => _jsx(Color4GradientCast, { ...props, type: "Color4" });
|
76
|
+
//# sourceMappingURL=gradientList.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"gradientList.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/hoc/gradientList.tsx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,EAAE,IAAI,EAAC,QAAQ,GAAG,CAAC;AACnJ,MAAM,CAAC,MAAM,kBAAkB,GAAyD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,kBAAkB,OAAK,KAAK,EAAE,IAAI,EAAC,QAAQ,GAAG,CAAC;AACnJ,MAAM,CAAC,MAAM,kBAAkB,GAAyD,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,kBAAkB,OAAK,KAAK,EAAE,IAAI,EAAC,QAAQ,GAAG,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\n\r\nimport { List } from \"../primitives/list\";\r\nimport { Color3GradientComponent, Color4GradientComponent, FactorGradientComponent } from \"../primitives/gradient\";\r\nimport { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from \"core/Misc/gradients\";\r\nimport type { IValueGradient } from \"core/Misc/gradients\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\n\r\ntype GradientTypes = \"Factor\" | \"Color3\" | \"Color4\";\r\n\r\ntype GradientListProps<T extends FactorGradient | Color3Gradient | Color4Gradient> = {\r\n label: string;\r\n gradients: Nullable<Array<T>>;\r\n addGradient: (step?: T) => void;\r\n removeGradient: (step: T) => void;\r\n onChange: (newGradient: T) => void;\r\n};\r\n\r\n// Convert gradients to LineList items and sort by gradient value\r\nfunction GradientsToListItems(gradients: Nullable<Array<IValueGradient>>) {\r\n return (\r\n gradients?.map((gradient, index) => ({\r\n id: index,\r\n data: gradient,\r\n sortBy: gradient.gradient,\r\n })) ?? []\r\n );\r\n}\r\n\r\nconst GradientList: FunctionComponent<GradientListProps<FactorGradient | Color3Gradient | Color4Gradient> & { type: GradientTypes }> = (props) => {\r\n const { gradients, type } = props;\r\n const items = GradientsToListItems(gradients);\r\n\r\n const deleteStep = (step: FactorGradient | Color3Gradient | Color4Gradient) => {\r\n props.removeGradient(step);\r\n };\r\n\r\n const addNewStep = () => {\r\n if (items.length === 0) {\r\n props.addGradient(); // Default\r\n } else {\r\n switch (props.type) {\r\n case \"Factor\": {\r\n const newStep = new FactorGradient(1, 1, 1);\r\n props.addGradient(newStep);\r\n break;\r\n }\r\n case \"Color3\": {\r\n const newStepColor3 = new Color3Gradient(1, Color3.White());\r\n props.addGradient(newStepColor3);\r\n break;\r\n }\r\n case \"Color4\": {\r\n const newStepColor = new Color4Gradient(1, new Color4(1, 1, 1, 1), new Color4(1, 1, 1, 1));\r\n props.addGradient(newStepColor);\r\n break;\r\n }\r\n }\r\n }\r\n };\r\n\r\n return (\r\n <div>\r\n <List\r\n key={type}\r\n addButtonLabel={items.length > 0 ? `Add new ${props.label}` : `Use ${props.label}s`}\r\n items={items}\r\n onDelete={(item) => deleteStep(item.data)}\r\n onAdd={addNewStep}\r\n renderItem={(item) => {\r\n const gradient = item.data;\r\n switch (props.type) {\r\n case \"Factor\":\r\n return (\r\n <FactorGradientComponent\r\n value={gradient}\r\n onChange={(newGradient: FactorGradient) => {\r\n item.data.gradient = newGradient.gradient;\r\n item.data.factor1 = newGradient.factor1;\r\n item.data.factor2 = newGradient.factor2;\r\n props.onChange(newGradient);\r\n }}\r\n />\r\n );\r\n\r\n case \"Color3\":\r\n return (\r\n <Color3GradientComponent\r\n value={gradient}\r\n onChange={(newGradient: Color3Gradient) => {\r\n item.data.gradient = newGradient.gradient;\r\n item.data.color = newGradient.color;\r\n props.onChange(newGradient);\r\n }}\r\n />\r\n );\r\n case \"Color4\":\r\n return (\r\n <Color4GradientComponent\r\n value={gradient}\r\n onChange={(newGradient: Color4Gradient) => {\r\n item.data.gradient = newGradient.gradient;\r\n item.data.color1 = newGradient.color1;\r\n item.data.color2 = newGradient.color2;\r\n props.onChange(newGradient);\r\n }}\r\n />\r\n );\r\n }\r\n }}\r\n />\r\n </div>\r\n );\r\n};\r\n\r\nconst FactorGradientCast = GradientList as FunctionComponent<GradientListProps<FactorGradient> & { type: \"Factor\" }>;\r\nconst Color3GradientCast = GradientList as FunctionComponent<GradientListProps<Color3Gradient> & { type: \"Color3\" }>;\r\nconst Color4GradientCast = GradientList as FunctionComponent<GradientListProps<Color4Gradient> & { type: \"Color4\" }>;\r\n\r\nexport const FactorGradientList: FunctionComponent<GradientListProps<FactorGradient>> = (props) => <FactorGradientCast {...props} type=\"Factor\" />;\r\nexport const Color3GradientList: FunctionComponent<GradientListProps<Color3Gradient>> = (props) => <Color3GradientCast {...props} type=\"Color3\" />;\r\nexport const Color4GradientList: FunctionComponent<GradientListProps<Color4Gradient>> = (props) => <Color4GradientCast {...props} type=\"Color4\" />;\r\n"]}
|
@@ -5,6 +5,6 @@ import type { PropertyLineProps } from "./propertyLine.js";
|
|
5
5
|
* @param props - The properties for the PropertyLine, including the boolean value to display.
|
6
6
|
* @returns A PropertyLine component with a PresenceBadge indicating the boolean state.
|
7
7
|
*/
|
8
|
-
export declare const
|
8
|
+
export declare const BooleanBadgePropertyLine: FunctionComponent<PropertyLineProps & {
|
9
9
|
value: boolean;
|
10
10
|
}>;
|
@@ -6,5 +6,5 @@ import { PropertyLine } from "./propertyLine.js";
|
|
6
6
|
* @param props - The properties for the PropertyLine, including the boolean value to display.
|
7
7
|
* @returns A PropertyLine component with a PresenceBadge indicating the boolean state.
|
8
8
|
*/
|
9
|
-
export const
|
10
|
-
//# sourceMappingURL=
|
9
|
+
export const BooleanBadgePropertyLine = (props) => (_jsx(PropertyLine, { label: props.label, children: _jsx(PresenceBadge, { status: props.value ? "available" : "do-not-disturb", outOfOffice: true }) }));
|
10
|
+
//# sourceMappingURL=booleanBadgePropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"booleanBadgePropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/booleanBadgePropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAA8D,CAAC,KAAK,EAAE,EAAE,CAAC,CAC1G,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,CAAC,KAAK,YAC5B,KAAC,aAAa,IAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,EAAE,WAAW,EAAE,IAAI,GAAI,GAC/E,CAClB,CAAC","sourcesContent":["import { PresenceBadge } from \"@fluentui/react-components\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\n\r\n/**\r\n * Displays an icon indicating enabled (green check) or disabled (red cross) state\r\n * @param props - The properties for the PropertyLine, including the boolean value to display.\r\n * @returns A PropertyLine component with a PresenceBadge indicating the boolean state.\r\n */\r\nexport const BooleanBadgePropertyLine: FunctionComponent<PropertyLineProps & { value: boolean }> = (props) => (\r\n <PropertyLine label={props.label}>\r\n <PresenceBadge status={props.value ? \"available\" : \"do-not-disturb\"} outOfOffice={true} />\r\n </PropertyLine>\r\n);\r\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { PropertyLineProps } from "./propertyLine.js";
|
2
2
|
import type { FunctionComponent } from "react";
|
3
|
-
import type { CheckboxProps } from "
|
3
|
+
import type { CheckboxProps } from "../../primitives/checkbox.js";
|
4
4
|
/**
|
5
5
|
* Wraps a checkbox in a property line
|
6
6
|
* @param props - PropertyLineProps and CheckboxProps
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { PropertyLine } from "./propertyLine.js";
|
3
|
-
import { Checkbox } from "
|
3
|
+
import { Checkbox } from "../../primitives/checkbox.js";
|
4
4
|
/**
|
5
5
|
* Wraps a checkbox in a property line
|
6
6
|
* @param props - PropertyLineProps and CheckboxProps
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"checkboxPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/checkboxPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAGrD;;;;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,7 +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
|
-
import type { ColorPickerProps } from "
|
5
|
+
import type { ColorPickerProps } from "../../primitives/colorPicker.js";
|
6
6
|
export type ColorPropertyLineProps = ColorPickerProps<Color3 | Color4> & PropertyLineProps;
|
7
7
|
export declare const Color3PropertyLine: FunctionComponent<ColorPickerProps<Color3> & PropertyLineProps>;
|
8
8
|
export declare const Color4PropertyLine: FunctionComponent<ColorPickerProps<Color4> & PropertyLineProps>;
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { forwardRef, useState } from "react";
|
3
3
|
import { PropertyLine } from "./propertyLine.js";
|
4
|
-
import {
|
4
|
+
import { SyncedSliderPropertyLine } from "./syncedSliderPropertyLine.js";
|
5
5
|
import { Color4 } from "@babylonjs/core/Maths/math.color.js";
|
6
|
-
import { ColorPickerPopup } from "
|
6
|
+
import { ColorPickerPopup } from "../../primitives/colorPicker.js";
|
7
7
|
/**
|
8
8
|
* Reusable component which renders a color property line containing a label, colorPicker popout, and expandable RGBA values
|
9
9
|
* The expandable RGBA values are synced sliders that allow the user to modify the color's RGBA values directly
|
@@ -28,7 +28,7 @@ const ColorPropertyLine = forwardRef((props, ref) => {
|
|
28
28
|
setColor(newColor);
|
29
29
|
props.onChange(newColor);
|
30
30
|
};
|
31
|
-
return (_jsx(PropertyLine, { ref: ref, ...props, expandedContent: _jsxs(_Fragment, { children: [_jsx(
|
31
|
+
return (_jsx(PropertyLine, { ref: ref, ...props, expandedContent: _jsxs(_Fragment, { children: [_jsx(SyncedSliderPropertyLine, { label: "R", value: color.r * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "r") }), _jsx(SyncedSliderPropertyLine, { label: "G", value: color.g * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "g") }), _jsx(SyncedSliderPropertyLine, { label: "B", value: color.b * 255, min: 0, max: 255, onChange: (value) => onSliderChange(value, "b") }), color instanceof Color4 && _jsx(SyncedSliderPropertyLine, { 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
32
|
});
|
33
33
|
export const Color3PropertyLine = ColorPropertyLine;
|
34
34
|
export const Color4PropertyLine = ColorPropertyLine;
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"colorPropertyLine.js","sourceRoot":"","sources":["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from \"react\";\r\nimport { forwardRef, useState } from \"react\";\r\n\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport { SyncedSliderPropertyLine } from \"./syncedSliderPropertyLine\";\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: Color3 | Color4;\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;\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 <SyncedSliderPropertyLine label=\"R\" value={color.r * 255} min={0} max={255} onChange={(value) => onSliderChange(value, \"r\")} />\r\n <SyncedSliderPropertyLine label=\"G\" value={color.g * 255} min={0} max={255} onChange={(value) => onSliderChange(value, \"g\")} />\r\n <SyncedSliderPropertyLine label=\"B\" value={color.b * 255} min={0} max={255} onChange={(value) => onSliderChange(value, \"b\")} />\r\n {color instanceof Color4 && <SyncedSliderPropertyLine 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"]}
|
@@ -1,9 +1,8 @@
|
|
1
1
|
import type { Nullable } from "@babylonjs/core/types.js";
|
2
|
-
import type { AcceptedDropdownValue, DropdownProps } from "
|
2
|
+
import type { AcceptedDropdownValue, DropdownProps } from "../../primitives/dropdown.js";
|
3
3
|
import type { PropertyLineProps } from "./propertyLine.js";
|
4
4
|
import type { FunctionComponent } from "react";
|
5
5
|
type DropdownPropertyLineProps<V extends AcceptedDropdownValue> = Omit<DropdownProps<V>, "includeNullAs"> & PropertyLineProps;
|
6
|
-
export declare const NullableDropdownPropertyLine: FunctionComponent<DropdownPropertyLineProps<AcceptedDropdownValue>>;
|
7
6
|
/**
|
8
7
|
* Dropdown component for explicitly defined number values.
|
9
8
|
* If value can be undefined, use OptionalNumberDropdownPropertyLine instead.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
-
import { Dropdown } from "
|
2
|
+
import { Dropdown } from "../../primitives/dropdown.js";
|
3
3
|
import { PropertyLine } from "./propertyLine.js";
|
4
4
|
/**
|
5
5
|
* Wraps a dropdown in a property line
|
@@ -9,7 +9,7 @@ import { PropertyLine } from "./propertyLine.js";
|
|
9
9
|
const DropdownPropertyLine = (props) => {
|
10
10
|
return (_jsx(PropertyLine, { ...props, children: _jsx(Dropdown, { ...props }) }));
|
11
11
|
};
|
12
|
-
|
12
|
+
const NullableDropdownPropertyLine = (props) => _jsx(DropdownPropertyLine, { ...props, includeNullAs: "null" });
|
13
13
|
const OptionalDropdownPropertyLine = (props) => _jsx(DropdownPropertyLine, { ...props, includeNullAs: "undefined" });
|
14
14
|
/**
|
15
15
|
* Dropdown component for explicitly defined number values.
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"dropdownPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/dropdownPropertyLine.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAM9C;;;;GAIG;AACH,MAAM,oBAAoB,GAAgF,CAAC,KAAK,EAAE,EAAE;IAChH,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,QAAQ,OAAK,KAAK,GAAI,GACZ,CAClB,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,4BAA4B,GAAwE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,oBAAoB,OAAK,KAAK,EAAE,aAAa,EAAC,MAAM,GAAG,CAAC;AAC9K,MAAM,4BAA4B,GAAwE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAC,oBAAoB,OAAK,KAAK,EAAE,aAAa,EAAC,WAAW,GAAG,CAAC;AAEnL;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAA4E,CAAC;AACvH;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,oBAA4E,CAAC;AAEvH;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAA8F,CAAC;AACjJ;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAA8F,CAAC;AAEjJ;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAAgG,CAAC;AACnJ;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,4BAAgG,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport { Dropdown } from \"../../primitives/dropdown\";\r\nimport type { AcceptedDropdownValue, DropdownProps } from \"../../primitives/dropdown\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\ntype DropdownPropertyLineProps<V extends AcceptedDropdownValue> = Omit<DropdownProps<V>, \"includeNullAs\"> & PropertyLineProps;\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\nconst DropdownPropertyLine: FunctionComponent<DropdownProps<AcceptedDropdownValue> & PropertyLineProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Dropdown {...props} />\r\n </PropertyLine>\r\n );\r\n};\r\n\r\nconst NullableDropdownPropertyLine: FunctionComponent<DropdownPropertyLineProps<AcceptedDropdownValue>> = (props) => <DropdownPropertyLine {...props} includeNullAs=\"null\" />;\r\nconst OptionalDropdownPropertyLine: FunctionComponent<DropdownPropertyLineProps<AcceptedDropdownValue>> = (props) => <DropdownPropertyLine {...props} includeNullAs=\"undefined\" />;\r\n\r\n/**\r\n * Dropdown component for explicitly defined number values.\r\n * If value can be undefined, use OptionalNumberDropdownPropertyLine instead.\r\n * If value can be null, use NullableNumberDropdownPropertyLine instead.\r\n */\r\nexport const NumberDropdownPropertyLine = DropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<number>>;\r\n/**\r\n * Dropdown component for explicitly defined string values.\r\n * If value can be undefined, use OptionalStringDropdownPropertyLine instead.\r\n * If value can be null, use NullableStringDropdownPropertyLine instead.\r\n */\r\nexport const StringDropdownPropertyLine = DropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<string>>;\r\n\r\n/**\r\n * Dropdown component for Nullable<number> values.\r\n */\r\nexport const NullableNumberDropdownPropertyLine = NullableDropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<Nullable<number>>>;\r\n/**\r\n * Dropdown component for Nullable<string> values.\r\n */\r\nexport const NullableStringDropdownPropertyLine = NullableDropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<Nullable<string>>>;\r\n\r\n/**\r\n * Dropdown component for number | undefined values\r\n */\r\nexport const OptionalNumberDropdownPropertyLine = OptionalDropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<number | undefined>>;\r\n/**\r\n * Dropdown component for string | undefined values\r\n */\r\nexport const OptionalStringDropdownPropertyLine = OptionalDropdownPropertyLine as FunctionComponent<DropdownPropertyLineProps<string | undefined>>;\r\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { PropertyLineProps } from "./propertyLine.js";
|
2
2
|
import type { FunctionComponent } from "react";
|
3
|
-
import type { InputHexProps } from "
|
3
|
+
import type { InputHexProps } from "../../primitives/colorPicker.js";
|
4
4
|
/**
|
5
5
|
* Wraps a hex input in a property line
|
6
6
|
* @param props - PropertyLineProps and InputHexProps
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { PropertyLine } from "./propertyLine.js";
|
3
|
-
import { InputHexField } from "
|
3
|
+
import { InputHexField } from "../../primitives/colorPicker.js";
|
4
4
|
/**
|
5
5
|
* Wraps a hex input in a property line
|
6
6
|
* @param props - PropertyLineProps and InputHexProps
|
@@ -9,4 +9,4 @@ import { InputHexField } from "../primitives/colorPicker.js";
|
|
9
9
|
export const HexPropertyLine = (props) => {
|
10
10
|
return (_jsx(PropertyLine, { ...props, children: _jsx(InputHexField, { ...props }) }));
|
11
11
|
};
|
12
|
-
//# sourceMappingURL=
|
12
|
+
//# sourceMappingURL=hexPropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"hexPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/hexPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D;;;;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,15 @@
|
|
1
|
+
import type { PropertyLineProps } from "./propertyLine.js";
|
2
|
+
import type { FunctionComponent } from "react";
|
3
|
+
import type { InputProps } from "../../primitives/input.js";
|
4
|
+
/**
|
5
|
+
* Wraps a text input in a property line
|
6
|
+
* @param props - PropertyLineProps and InputProps
|
7
|
+
* @returns property-line wrapped input component
|
8
|
+
*/
|
9
|
+
export declare const TextInputPropertyLine: FunctionComponent<InputProps<string> & PropertyLineProps>;
|
10
|
+
/**
|
11
|
+
* Wraps a number input in a property line
|
12
|
+
* @param props - PropertyLineProps and InputProps
|
13
|
+
* @returns property-line wrapped input component
|
14
|
+
*/
|
15
|
+
export declare const NumberInputPropertyLine: FunctionComponent<InputProps<number> & PropertyLineProps>;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
2
|
+
import { PropertyLine } from "./propertyLine.js";
|
3
|
+
import { NumberInput, TextInput } from "../../primitives/input.js";
|
4
|
+
/**
|
5
|
+
* Wraps a text input in a property line
|
6
|
+
* @param props - PropertyLineProps and InputProps
|
7
|
+
* @returns property-line wrapped input component
|
8
|
+
*/
|
9
|
+
export const TextInputPropertyLine = (props) => (_jsx(PropertyLine, { ...props, children: _jsx(TextInput, { ...props }) }));
|
10
|
+
/**
|
11
|
+
* Wraps a number input in a property line
|
12
|
+
* @param props - PropertyLineProps and InputProps
|
13
|
+
* @returns property-line wrapped input component
|
14
|
+
*/
|
15
|
+
export const NumberInputPropertyLine = (props) => (_jsx(PropertyLine, { ...props, children: _jsx(NumberInput, { ...props }) }));
|
16
|
+
//# sourceMappingURL=inputPropertyLine.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"inputPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/inputPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA8D,CAAC,KAAK,EAAE,EAAE,CAAC,CACvG,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,SAAS,OAAK,KAAK,GAAI,GACb,CAClB,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAA8D,CAAC,KAAK,EAAE,EAAE,CAAC,CACzG,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,WAAW,OAAK,KAAK,GAAI,GACf,CAClB,CAAC","sourcesContent":["import { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport { NumberInput, TextInput } from \"../../primitives/input\";\r\nimport type { InputProps } from \"../../primitives/input\";\r\n\r\n/**\r\n * Wraps a text input in a property line\r\n * @param props - PropertyLineProps and InputProps\r\n * @returns property-line wrapped input component\r\n */\r\nexport const TextInputPropertyLine: FunctionComponent<InputProps<string> & PropertyLineProps> = (props) => (\r\n <PropertyLine {...props}>\r\n <TextInput {...props} />\r\n </PropertyLine>\r\n);\r\n\r\n/**\r\n * Wraps a number input in a property line\r\n * @param props - PropertyLineProps and InputProps\r\n * @returns property-line wrapped input component\r\n */\r\nexport const NumberInputPropertyLine: FunctionComponent<InputProps<number> & PropertyLineProps> = (props) => (\r\n <PropertyLine {...props}>\r\n <NumberInput {...props} />\r\n </PropertyLine>\r\n);\r\n"]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { Body1 } from "@fluentui/react-components";
|
3
3
|
import { PropertyLine } from "./propertyLine.js";
|
4
|
-
import { Link } from "
|
4
|
+
import { Link } from "../../primitives/link.js";
|
5
5
|
/**
|
6
6
|
* Wraps a link in a property line
|
7
7
|
* @param props - PropertyLineProps and LinkProps
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"linkPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/linkPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAW7C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAqD,CAAC,KAAK,EAAE,EAAE;IACxF,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,IAAI,IAAC,MAAM,QAAC,UAAU,EAAC,QAAQ,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,YACnG,KAAC,KAAK,cAAE,KAAK,CAAC,KAAK,GAAS,GACzB,GACI,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Body1 } from \"@fluentui/react-components\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport { Link } from \"../../primitives/link\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\ntype LinkProps = {\r\n value: string;\r\n tooltip?: string;\r\n onLink?: () => void;\r\n url?: string;\r\n};\r\n\r\n/**\r\n * Wraps a link in a property line\r\n * @param props - PropertyLineProps and LinkProps\r\n * @returns property-line wrapped link\r\n */\r\nexport const LinkPropertyLine: FunctionComponent<PropertyLineProps & LinkProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Link inline appearance=\"subtle\" onClick={() => props.onLink?.()} href={props.url} title={props.tooltip}>\r\n <Body1>{props.value}</Body1>\r\n </Link>\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
|
@@ -3,20 +3,20 @@ import { Body1, Body1Strong, Button, InfoLabel, Link, ToggleButton, makeStyles,
|
|
3
3
|
import { Collapse } from "@fluentui/react-motion-components-preview";
|
4
4
|
import { AddFilled, CopyRegular, SubtractFilled } from "@fluentui/react-icons";
|
5
5
|
import { useContext, useState, forwardRef } from "react";
|
6
|
-
import { copyCommandToClipboard } from "
|
7
|
-
import { ToolContext } from "
|
6
|
+
import { copyCommandToClipboard } from "../../../copyCommandToClipboard.js";
|
7
|
+
import { ToolContext } from "../fluentToolWrapper.js";
|
8
8
|
const usePropertyLineStyles = makeStyles({
|
9
9
|
container: {
|
10
10
|
width: "100%",
|
11
11
|
display: "flex",
|
12
12
|
flexDirection: "column", // Stack line + expanded content
|
13
|
+
padding: `${tokens.spacingVerticalXS} 0px`,
|
13
14
|
borderBottom: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
|
14
15
|
},
|
15
16
|
line: {
|
16
17
|
display: "flex",
|
17
18
|
alignItems: "center",
|
18
19
|
justifyContent: "flex-start",
|
19
|
-
padding: `${tokens.spacingVerticalXS} 0px`,
|
20
20
|
width: "100%",
|
21
21
|
},
|
22
22
|
label: {
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"propertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/propertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC3H,OAAO,EAAE,QAAQ,EAAE,MAAM,2CAA2C,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE/E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,qBAAqB,GAAG,UAAU,CAAC;IACrC,SAAS,EAAE;QACP,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ,EAAE,gCAAgC;QACzD,OAAO,EAAE,GAAG,MAAM,CAAC,iBAAiB,MAAM;QAC1C,YAAY,EAAE,GAAG,MAAM,CAAC,eAAe,UAAU,MAAM,CAAC,mBAAmB,EAAE;KAChF;IACD,IAAI,EAAE;QACF,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,YAAY;QAC5B,KAAK,EAAE,MAAM;KAChB;IACD,KAAK,EAAE;QACH,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE,MAAM;QACjB,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,QAAQ;QAClB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EAAE,KAAK,EAAC,mBAAmB,GAAG,CAC5J,IACC,IACJ,EACN,KAAC,QAAQ,IAAC,OAAO,EAAE,QAAQ,IAAI,CAAC,CAAC,eAAe,YAC5C,cAAK,SAAS,EAAE,OAAO,CAAC,eAAe,YAAG,eAAe,GAAO,GACzD,IACC,CACnB,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAmE,CAAC,KAAK,EAAE,EAAE;IAC7G,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,KAAK,cAAE,KAAK,CAAC,KAAK,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, HTMLProps, 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 padding: `${tokens.spacingVerticalXS} 0px`,\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 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<HTMLProps<HTMLDivElement>>>((props, ref) => {\r\n const classes = usePropertyLineStyles();\r\n return (\r\n <div ref={ref} className={classes.container} {...props}>\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
1
|
import type { PropertyLineProps } from "./propertyLine.js";
|
2
2
|
import type { FunctionComponent } from "react";
|
3
|
-
import type { SwitchProps } from "
|
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,6 +1,6 @@
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
2
2
|
import { PropertyLine } from "./propertyLine.js";
|
3
|
-
import { Switch } from "
|
3
|
+
import { Switch } 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
|