@babylonjs/shared-ui-components 8.44.1 → 8.45.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.
Files changed (43) hide show
  1. package/constToOptionsMaps.d.ts +7 -0
  2. package/constToOptionsMaps.js +9 -0
  3. package/constToOptionsMaps.js.map +1 -1
  4. package/fluent/hoc/fluentToolWrapper.d.ts +4 -0
  5. package/fluent/hoc/fluentToolWrapper.js +2 -1
  6. package/fluent/hoc/fluentToolWrapper.js.map +1 -1
  7. package/fluent/hoc/propertyLines/colorPropertyLine.js +2 -1
  8. package/fluent/hoc/propertyLines/colorPropertyLine.js.map +1 -1
  9. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.d.ts +4 -0
  10. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.js +2 -0
  11. package/fluent/hoc/propertyLines/entitySelectorPropertyLine.js.map +1 -1
  12. package/fluent/hoc/propertyLines/propertyLine.js +24 -12
  13. package/fluent/hoc/propertyLines/propertyLine.js.map +1 -1
  14. package/fluent/hoc/propertyLines/vectorPropertyLine.js +2 -1
  15. package/fluent/hoc/propertyLines/vectorPropertyLine.js.map +1 -1
  16. package/fluent/primitives/button.d.ts +3 -2
  17. package/fluent/primitives/button.js.map +1 -1
  18. package/fluent/primitives/colorPicker.js +5 -1
  19. package/fluent/primitives/colorPicker.js.map +1 -1
  20. package/fluent/primitives/comboBox.js +6 -1
  21. package/fluent/primitives/comboBox.js.map +1 -1
  22. package/fluent/primitives/contextMenu.d.ts +105 -0
  23. package/fluent/primitives/contextMenu.js +56 -0
  24. package/fluent/primitives/contextMenu.js.map +1 -0
  25. package/fluent/primitives/entitySelector.d.ts +10 -2
  26. package/fluent/primitives/entitySelector.js +41 -5
  27. package/fluent/primitives/entitySelector.js.map +1 -1
  28. package/fluent/primitives/link.d.ts +19 -2
  29. package/fluent/primitives/link.js +5 -3
  30. package/fluent/primitives/link.js.map +1 -1
  31. package/fluent/primitives/materialSelector.d.ts +2 -1
  32. package/fluent/primitives/materialSelector.js.map +1 -1
  33. package/fluent/primitives/nodeSelector.d.ts +2 -1
  34. package/fluent/primitives/nodeSelector.js.map +1 -1
  35. package/fluent/primitives/skeletonSelector.d.ts +22 -0
  36. package/fluent/primitives/skeletonSelector.js +16 -0
  37. package/fluent/primitives/skeletonSelector.js.map +1 -0
  38. package/fluent/primitives/textureSelector.d.ts +2 -1
  39. package/fluent/primitives/textureSelector.js +3 -3
  40. package/fluent/primitives/textureSelector.js.map +1 -1
  41. package/fluent/primitives/toggleButton.js +10 -2
  42. package/fluent/primitives/toggleButton.js.map +1 -1
  43. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"nodeSelector.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/nodeSelector.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyC,CAAC,KAAK,EAAE,EAAE;IACxE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;IAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE3D,OAAO,KAAC,cAAc,OAAK,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AACjF,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Node } from \"core/node\";\r\nimport type { PrimitiveProps } from \"./primitive\";\r\n\r\nimport { useCallback } from \"react\";\r\nimport { EntitySelector } from \"./entitySelector\";\r\n\r\nexport type NodeSelectorProps = PrimitiveProps<Nullable<Node>> & {\r\n /**\r\n * The scene to get nodes from\r\n */\r\n scene: Scene;\r\n /**\r\n * Optional filter function to filter which nodes are shown\r\n */\r\n filter?: (node: Node) => boolean;\r\n};\r\n\r\n/**\r\n * A primitive component with a ComboBox for selecting from existing scene nodes.\r\n * @param props NodeSelectorProps\r\n * @returns NodeSelector component\r\n */\r\nexport const NodeSelector: FunctionComponent<NodeSelectorProps> = (props) => {\r\n NodeSelector.displayName = \"NodeSelector\";\r\n const { scene, ...rest } = props;\r\n\r\n const getNodes = useCallback(() => scene.getNodes(), [scene]);\r\n const getName = useCallback((node: Node) => node.name, []);\r\n\r\n return <EntitySelector {...rest} getEntities={getNodes} getName={getName} />;\r\n};\r\n"]}
1
+ {"version":3,"file":"nodeSelector.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/nodeSelector.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyC,CAAC,KAAK,EAAE,EAAE;IACxE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;IAC1C,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,IAAU,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAE3D,OAAO,KAAC,cAAc,OAAK,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AACjF,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Node } from \"core/node\";\r\nimport type { PrimitiveProps } from \"./primitive\";\r\nimport type { EntitySelectorProps } from \"./entitySelector\";\r\n\r\nimport { useCallback } from \"react\";\r\nimport { EntitySelector } from \"./entitySelector\";\r\n\r\nexport type NodeSelectorProps = PrimitiveProps<Nullable<Node>> & {\r\n /**\r\n * The scene to get nodes from\r\n */\r\n scene: Scene;\r\n /**\r\n * Optional filter function to filter which nodes are shown\r\n */\r\n filter?: (node: Node) => boolean;\r\n} & Omit<EntitySelectorProps<Node>, \"getEntities\" | \"getName\">;\r\n\r\n/**\r\n * A primitive component with a ComboBox for selecting from existing scene nodes.\r\n * @param props NodeSelectorProps\r\n * @returns NodeSelector component\r\n */\r\nexport const NodeSelector: FunctionComponent<NodeSelectorProps> = (props) => {\r\n NodeSelector.displayName = \"NodeSelector\";\r\n const { scene, ...rest } = props;\r\n\r\n const getNodes = useCallback(() => scene.getNodes(), [scene]);\r\n const getName = useCallback((node: Node) => node.name, []);\r\n\r\n return <EntitySelector {...rest} getEntities={getNodes} getName={getName} />;\r\n};\r\n"]}
@@ -0,0 +1,22 @@
1
+ import type { FunctionComponent } from "react";
2
+ import type { Scene } from "@babylonjs/core/scene.js";
3
+ import type { Nullable } from "@babylonjs/core/types.js";
4
+ import type { Skeleton } from "@babylonjs/core/Bones/skeleton.js";
5
+ import type { PrimitiveProps } from "./primitive.js";
6
+ import type { EntitySelectorProps } from "./entitySelector.js";
7
+ export type SkeletonSelectorProps = PrimitiveProps<Nullable<Skeleton>> & {
8
+ /**
9
+ * The scene to get skeletons from
10
+ */
11
+ scene: Scene;
12
+ /**
13
+ * Optional filter function to filter which skeletons are shown
14
+ */
15
+ filter?: (skeleton: Skeleton) => boolean;
16
+ } & Omit<EntitySelectorProps<Skeleton>, "getEntities" | "getName">;
17
+ /**
18
+ * A primitive component with a ComboBox for selecting from existing scene skeletons.
19
+ * @param props SkeletonSelectorProps
20
+ * @returns SkeletonSelector component
21
+ */
22
+ export declare const SkeletonSelector: FunctionComponent<SkeletonSelectorProps>;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ import { EntitySelector } from "./entitySelector.js";
4
+ /**
5
+ * A primitive component with a ComboBox for selecting from existing scene skeletons.
6
+ * @param props SkeletonSelectorProps
7
+ * @returns SkeletonSelector component
8
+ */
9
+ export const SkeletonSelector = (props) => {
10
+ SkeletonSelector.displayName = "SkeletonSelector";
11
+ const { scene, ...rest } = props;
12
+ const getSkeletons = useCallback(() => scene.skeletons, [scene.skeletons]);
13
+ const getName = useCallback((skeleton) => skeleton.name, []);
14
+ return _jsx(EntitySelector, { ...rest, getEntities: getSkeletons, getName: getName });
15
+ };
16
+ //# sourceMappingURL=skeletonSelector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skeletonSelector.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/skeletonSelector.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAA6C,CAAC,KAAK,EAAE,EAAE;IAChF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAC;IAClD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAEjC,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IAC3E,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IAEvE,OAAO,KAAC,cAAc,OAAK,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,GAAI,CAAC;AACrF,CAAC,CAAC","sourcesContent":["import type { FunctionComponent } from \"react\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { Skeleton } from \"core/Bones/skeleton\";\r\nimport type { PrimitiveProps } from \"./primitive\";\r\nimport type { EntitySelectorProps } from \"./entitySelector\";\r\n\r\nimport { useCallback } from \"react\";\r\nimport { EntitySelector } from \"./entitySelector\";\r\n\r\nexport type SkeletonSelectorProps = PrimitiveProps<Nullable<Skeleton>> & {\r\n /**\r\n * The scene to get skeletons from\r\n */\r\n scene: Scene;\r\n /**\r\n * Optional filter function to filter which skeletons are shown\r\n */\r\n filter?: (skeleton: Skeleton) => boolean;\r\n} & Omit<EntitySelectorProps<Skeleton>, \"getEntities\" | \"getName\">;\r\n\r\n/**\r\n * A primitive component with a ComboBox for selecting from existing scene skeletons.\r\n * @param props SkeletonSelectorProps\r\n * @returns SkeletonSelector component\r\n */\r\nexport const SkeletonSelector: FunctionComponent<SkeletonSelectorProps> = (props) => {\r\n SkeletonSelector.displayName = \"SkeletonSelector\";\r\n const { scene, ...rest } = props;\r\n\r\n const getSkeletons = useCallback(() => scene.skeletons, [scene.skeletons]);\r\n const getName = useCallback((skeleton: Skeleton) => skeleton.name, []);\r\n\r\n return <EntitySelector {...rest} getEntities={getSkeletons} getName={getName} />;\r\n};\r\n"]}
@@ -3,6 +3,7 @@ import type { Scene } from "@babylonjs/core/scene.js";
3
3
  import type { Nullable } from "@babylonjs/core/types.js";
4
4
  import type { FunctionComponent } from "react";
5
5
  import type { PrimitiveProps } from "./primitive.js";
6
+ import type { EntitySelectorProps } from "./entitySelector.js";
6
7
  export type TextureSelectorProps = PrimitiveProps<Nullable<BaseTexture>> & {
7
8
  /**
8
9
  * The scene to get textures from
@@ -16,7 +17,7 @@ export type TextureSelectorProps = PrimitiveProps<Nullable<BaseTexture>> & {
16
17
  * Whether to only allow cube textures
17
18
  */
18
19
  cubeOnly?: boolean;
19
- };
20
+ } & Omit<EntitySelectorProps<BaseTexture>, "getEntities" | "getName">;
20
21
  /**
21
22
  * A primitive component with a ComboBox for selecting from existing scene textures
22
23
  * and a button for uploading new texture files.
@@ -19,11 +19,11 @@ const useStyles = makeStyles({
19
19
  */
20
20
  export const TextureSelector = (props) => {
21
21
  TextureSelector.displayName = "TextureSelector";
22
- const { scene, cubeOnly, value, onChange } = props;
22
+ const { scene, cubeOnly, value, onChange, onLink, defaultValue } = props;
23
23
  const classes = useStyles();
24
24
  const getTextures = useCallback(() => scene.textures, [scene.textures]);
25
- const getName = useCallback((texture) => texture.displayName || texture.name, []);
25
+ const getName = useCallback((texture) => texture.displayName || texture.name || `${texture.getClassName() || "Unnamed Texture"} (${texture.uniqueId})`, []);
26
26
  const filter = useCallback((texture) => !cubeOnly || texture.isCube, [cubeOnly]);
27
- return (_jsxs("div", { className: classes.container, children: [_jsx(EntitySelector, { value: value, onChange: onChange, getEntities: getTextures, getName: getName, filter: filter }), _jsx(TextureUpload, { scene: scene, onChange: onChange, cubeOnly: cubeOnly })] }));
27
+ return (_jsxs("div", { className: classes.container, children: [_jsx(EntitySelector, { value: value, onChange: onChange, onLink: onLink, defaultValue: defaultValue, getEntities: getTextures, getName: getName, filter: filter }), !value && _jsx(TextureUpload, { scene: scene, onChange: onChange, cubeOnly: cubeOnly })] }));
28
28
  };
29
29
  //# sourceMappingURL=textureSelector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textureSelector.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/textureSelector.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAA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E,QAAQ,GAAI,IACrE,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { PrimitiveProps } from \"./primitive\";\r\n\r\nimport { makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport { useCallback } from \"react\";\r\nimport { TextureUpload } from \"../hoc/textureUpload\";\r\nimport { EntitySelector } from \"./entitySelector\";\r\n\r\nconst useStyles = makeStyles({\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n alignItems: \"center\",\r\n gap: tokens.spacingHorizontalS,\r\n },\r\n});\r\n\r\nexport type TextureSelectorProps = PrimitiveProps<Nullable<BaseTexture>> & {\r\n /**\r\n * The scene to get textures from\r\n */\r\n scene: Scene;\r\n /**\r\n * File types to accept for upload\r\n */\r\n accept?: string;\r\n /**\r\n * Whether to only allow cube textures\r\n */\r\n cubeOnly?: boolean;\r\n};\r\n\r\n/**\r\n * A primitive component with a ComboBox for selecting from existing scene textures\r\n * and a button for uploading new texture files.\r\n * @param props TextureSelectorProps\r\n * @returns TextureSelector component\r\n */\r\nexport const TextureSelector: FunctionComponent<TextureSelectorProps> = (props) => {\r\n TextureSelector.displayName = \"TextureSelector\";\r\n const { scene, cubeOnly, value, onChange } = props;\r\n const classes = useStyles();\r\n\r\n const getTextures = useCallback(() => scene.textures, [scene.textures]);\r\n const getName = useCallback((texture: BaseTexture) => texture.displayName || texture.name, []);\r\n const filter = useCallback((texture: BaseTexture) => !cubeOnly || texture.isCube, [cubeOnly]);\r\n\r\n return (\r\n <div className={classes.container}>\r\n <EntitySelector value={value} onChange={onChange} getEntities={getTextures} getName={getName} filter={filter} />\r\n <TextureUpload scene={scene} onChange={onChange} cubeOnly={cubeOnly} />\r\n </div>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"textureSelector.js","sourceRoot":"","sources":["../../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eAAK,SAAS,EAAE,OAAO,CAAC,SAAS,aAC7B,KAAC,cAAc,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAI,EAC3J,CAAC,KAAK,IAAI,KAAC,aAAa,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,GAAI,IAChF,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport type { Scene } from \"core/scene\";\r\nimport type { Nullable } from \"core/types\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { PrimitiveProps } from \"./primitive\";\r\nimport type { EntitySelectorProps } from \"./entitySelector\";\r\n\r\nimport { makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport { useCallback } from \"react\";\r\nimport { TextureUpload } from \"../hoc/textureUpload\";\r\nimport { EntitySelector } from \"./entitySelector\";\r\n\r\nconst useStyles = makeStyles({\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n alignItems: \"center\",\r\n gap: tokens.spacingHorizontalS,\r\n },\r\n});\r\n\r\nexport type TextureSelectorProps = PrimitiveProps<Nullable<BaseTexture>> & {\r\n /**\r\n * The scene to get textures from\r\n */\r\n scene: Scene;\r\n /**\r\n * File types to accept for upload\r\n */\r\n accept?: string;\r\n /**\r\n * Whether to only allow cube textures\r\n */\r\n cubeOnly?: boolean;\r\n} & Omit<EntitySelectorProps<BaseTexture>, \"getEntities\" | \"getName\">;\r\n\r\n/**\r\n * A primitive component with a ComboBox for selecting from existing scene textures\r\n * and a button for uploading new texture files.\r\n * @param props TextureSelectorProps\r\n * @returns TextureSelector component\r\n */\r\nexport const TextureSelector: FunctionComponent<TextureSelectorProps> = (props) => {\r\n TextureSelector.displayName = \"TextureSelector\";\r\n const { scene, cubeOnly, value, onChange, onLink, defaultValue } = props;\r\n const classes = useStyles();\r\n\r\n const getTextures = useCallback(() => scene.textures, [scene.textures]);\r\n const getName = useCallback((texture: BaseTexture) => texture.displayName || texture.name || `${texture.getClassName() || \"Unnamed Texture\"} (${texture.uniqueId})`, []);\r\n const filter = useCallback((texture: BaseTexture) => !cubeOnly || texture.isCube, [cubeOnly]);\r\n\r\n return (\r\n <div className={classes.container}>\r\n <EntitySelector value={value} onChange={onChange} onLink={onLink} defaultValue={defaultValue} getEntities={getTextures} getName={getName} filter={filter} />\r\n {!value && <TextureUpload scene={scene} onChange={onChange} cubeOnly={cubeOnly} />}\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,7 +1,14 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { ToggleButton as FluentToggleButton } from "@fluentui/react-components";
2
+ import { ToggleButton as FluentToggleButton, makeStyles } from "@fluentui/react-components";
3
3
  import { useCallback, useContext, useEffect, useState } from "react";
4
4
  import { ToolContext } from "../hoc/fluentToolWrapper.js";
5
+ const useStyles = makeStyles({
6
+ button: {
7
+ display: "flex",
8
+ alignItems: "center",
9
+ justifyContent: "center",
10
+ },
11
+ });
5
12
  /**
6
13
  * Toggles between two states using a button with icons.
7
14
  * If no disabledIcon is provided, the button will toggle between visual enabled/disabled states without an icon change
@@ -13,6 +20,7 @@ export const ToggleButton = (props) => {
13
20
  ToggleButton.displayName = "ToggleButton";
14
21
  const { value, onChange, title, appearance = "subtle" } = props;
15
22
  const { size } = useContext(ToolContext);
23
+ const classes = useStyles();
16
24
  const [checked, setChecked] = useState(value);
17
25
  const toggle = useCallback(() => {
18
26
  setChecked((prev) => {
@@ -24,6 +32,6 @@ export const ToggleButton = (props) => {
24
32
  useEffect(() => {
25
33
  setChecked(props.value);
26
34
  }, [props.value]);
27
- return (_jsx(FluentToggleButton, { title: title, size: size, icon: checked ? _jsx(props.checkedIcon, {}) : props.uncheckedIcon ? _jsx(props.uncheckedIcon, {}) : _jsx(props.checkedIcon, {}), appearance: appearance, checked: checked, onClick: toggle }));
35
+ return (_jsx(FluentToggleButton, { className: classes.button, title: title, size: size, icon: checked ? _jsx(props.checkedIcon, {}) : props.uncheckedIcon ? _jsx(props.uncheckedIcon, {}) : _jsx(props.checkedIcon, {}), appearance: appearance, checked: checked, onClick: toggle }));
28
36
  };
29
37
  //# sourceMappingURL=toggleButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toggleButton.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/toggleButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhF,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AASvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyC,CAAC,KAAK,EAAE,EAAE;IACxE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;IAC1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC;YACtB,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClB,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,SAAS,CAAC,GAAG,EAAE;QACX,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElB,OAAO,CACH,KAAC,kBAAkB,IACf,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,WAAW,KAAG,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,aAAa,KAAG,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,WAAW,KAAG,EAC7G,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACjB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { ToggleButton as FluentToggleButton } from \"@fluentui/react-components\";\r\nimport type { ButtonProps } from \"./button\";\r\nimport { useCallback, useContext, useEffect, useState } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { FluentIcon } from \"@fluentui/react-icons\";\r\nimport { ToolContext } from \"../hoc/fluentToolWrapper\";\r\n\r\ntype ToggleButtonProps = Omit<ButtonProps, \"icon\" | \"onClick\"> & {\r\n value: boolean;\r\n checkedIcon: FluentIcon;\r\n uncheckedIcon?: FluentIcon;\r\n onChange: (checked: boolean) => void;\r\n};\r\n\r\n/**\r\n * Toggles between two states using a button with icons.\r\n * If no disabledIcon is provided, the button will toggle between visual enabled/disabled states without an icon change\r\n *\r\n * @param props\r\n * @returns\r\n */\r\nexport const ToggleButton: FunctionComponent<ToggleButtonProps> = (props) => {\r\n ToggleButton.displayName = \"ToggleButton\";\r\n const { value, onChange, title, appearance = \"subtle\" } = props;\r\n const { size } = useContext(ToolContext);\r\n const [checked, setChecked] = useState(value);\r\n const toggle = useCallback(() => {\r\n setChecked((prev) => {\r\n const enabled = !prev;\r\n onChange(enabled);\r\n return enabled;\r\n });\r\n }, [setChecked]);\r\n\r\n useEffect(() => {\r\n setChecked(props.value);\r\n }, [props.value]);\r\n\r\n return (\r\n <FluentToggleButton\r\n title={title}\r\n size={size}\r\n icon={checked ? <props.checkedIcon /> : props.uncheckedIcon ? <props.uncheckedIcon /> : <props.checkedIcon />}\r\n appearance={appearance}\r\n checked={checked}\r\n onClick={toggle}\r\n />\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"toggleButton.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/toggleButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,IAAI,kBAAkB,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,MAAM,EAAE;QACJ,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;KAC3B;CACJ,CAAC,CAAC;AASH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyC,CAAC,KAAK,EAAE,EAAE;IACxE,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;IAC1C,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,GAAG,QAAQ,EAAE,GAAG,KAAK,CAAC;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAC5B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC5B,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE;YAChB,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC;YACtB,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClB,OAAO,OAAO,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC;IAEjB,SAAS,CAAC,GAAG,EAAE;QACX,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElB,OAAO,CACH,KAAC,kBAAkB,IACf,SAAS,EAAE,OAAO,CAAC,MAAM,EACzB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,WAAW,KAAG,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,aAAa,KAAG,CAAC,CAAC,CAAC,KAAC,KAAK,CAAC,WAAW,KAAG,EAC7G,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACjB,CACL,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { ToggleButton as FluentToggleButton, makeStyles } from \"@fluentui/react-components\";\r\nimport type { ButtonProps } from \"./button\";\r\nimport { useCallback, useContext, useEffect, useState } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { FluentIcon } from \"@fluentui/react-icons\";\r\nimport { ToolContext } from \"../hoc/fluentToolWrapper\";\r\n\r\nconst useStyles = makeStyles({\r\n button: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n justifyContent: \"center\",\r\n },\r\n});\r\n\r\ntype ToggleButtonProps = Omit<ButtonProps, \"icon\" | \"onClick\"> & {\r\n value: boolean;\r\n checkedIcon: FluentIcon;\r\n uncheckedIcon?: FluentIcon;\r\n onChange: (checked: boolean) => void;\r\n};\r\n\r\n/**\r\n * Toggles between two states using a button with icons.\r\n * If no disabledIcon is provided, the button will toggle between visual enabled/disabled states without an icon change\r\n *\r\n * @param props\r\n * @returns\r\n */\r\nexport const ToggleButton: FunctionComponent<ToggleButtonProps> = (props) => {\r\n ToggleButton.displayName = \"ToggleButton\";\r\n const { value, onChange, title, appearance = \"subtle\" } = props;\r\n const { size } = useContext(ToolContext);\r\n const classes = useStyles();\r\n const [checked, setChecked] = useState(value);\r\n const toggle = useCallback(() => {\r\n setChecked((prev) => {\r\n const enabled = !prev;\r\n onChange(enabled);\r\n return enabled;\r\n });\r\n }, [setChecked]);\r\n\r\n useEffect(() => {\r\n setChecked(props.value);\r\n }, [props.value]);\r\n\r\n return (\r\n <FluentToggleButton\r\n className={classes.button}\r\n title={title}\r\n size={size}\r\n icon={checked ? <props.checkedIcon /> : props.uncheckedIcon ? <props.uncheckedIcon /> : <props.checkedIcon />}\r\n appearance={appearance}\r\n checked={checked}\r\n onClick={toggle}\r\n />\r\n );\r\n};\r\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonjs/shared-ui-components",
3
- "version": "8.44.1",
3
+ "version": "8.45.1",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",