@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.
Files changed (142) hide show
  1. package/components/Button.d.ts +2 -2
  2. package/components/Button.js +1 -1
  3. package/components/Button.js.map +1 -1
  4. package/components/TextInputWithSubmit.js +2 -2
  5. package/components/TextInputWithSubmit.js.map +1 -1
  6. package/fluent/hoc/buttonLine.d.ts +2 -8
  7. package/fluent/hoc/buttonLine.js +3 -9
  8. package/fluent/hoc/buttonLine.js.map +1 -1
  9. package/fluent/hoc/fileUploadLine.d.ts +2 -2
  10. package/fluent/hoc/fileUploadLine.js +2 -1
  11. package/fluent/hoc/fileUploadLine.js.map +1 -1
  12. package/fluent/hoc/gradientList.d.ts +14 -0
  13. package/fluent/hoc/gradientList.js +76 -0
  14. package/fluent/hoc/gradientList.js.map +1 -0
  15. package/fluent/hoc/{readonlyBooleanLine.d.ts → propertyLines/booleanBadgePropertyLine.d.ts} +1 -1
  16. package/fluent/hoc/{readonlyBooleanLine.js → propertyLines/booleanBadgePropertyLine.js} +2 -2
  17. package/fluent/hoc/propertyLines/booleanBadgePropertyLine.js.map +1 -0
  18. package/fluent/hoc/{checkboxPropertyLine.d.ts → propertyLines/checkboxPropertyLine.d.ts} +1 -1
  19. package/fluent/hoc/{checkboxPropertyLine.js → propertyLines/checkboxPropertyLine.js} +1 -1
  20. package/fluent/hoc/propertyLines/checkboxPropertyLine.js.map +1 -0
  21. package/fluent/hoc/{colorPropertyLine.d.ts → propertyLines/colorPropertyLine.d.ts} +1 -1
  22. package/fluent/hoc/{colorPropertyLine.js → propertyLines/colorPropertyLine.js} +3 -3
  23. package/fluent/hoc/propertyLines/colorPropertyLine.js.map +1 -0
  24. package/fluent/hoc/{dropdownPropertyLine.d.ts → propertyLines/dropdownPropertyLine.d.ts} +1 -2
  25. package/fluent/hoc/{dropdownPropertyLine.js → propertyLines/dropdownPropertyLine.js} +2 -2
  26. package/fluent/hoc/propertyLines/dropdownPropertyLine.js.map +1 -0
  27. package/fluent/hoc/{hexLineComponent.d.ts → propertyLines/hexPropertyLine.d.ts} +1 -1
  28. package/fluent/hoc/{hexLineComponent.js → propertyLines/hexPropertyLine.js} +2 -2
  29. package/fluent/hoc/propertyLines/hexPropertyLine.js.map +1 -0
  30. package/fluent/hoc/propertyLines/inputPropertyLine.d.ts +15 -0
  31. package/fluent/hoc/propertyLines/inputPropertyLine.js +16 -0
  32. package/fluent/hoc/propertyLines/inputPropertyLine.js.map +1 -0
  33. package/fluent/hoc/{linkPropertyLine.js → propertyLines/linkPropertyLine.js} +1 -1
  34. package/fluent/hoc/propertyLines/linkPropertyLine.js.map +1 -0
  35. package/fluent/hoc/{propertyLine.js → propertyLines/propertyLine.js} +3 -3
  36. package/fluent/hoc/propertyLines/propertyLine.js.map +1 -0
  37. package/fluent/hoc/{switchPropertyLine.d.ts → propertyLines/switchPropertyLine.d.ts} +1 -1
  38. package/fluent/hoc/{switchPropertyLine.js → propertyLines/switchPropertyLine.js} +1 -1
  39. package/fluent/hoc/propertyLines/switchPropertyLine.js.map +1 -0
  40. package/fluent/hoc/propertyLines/syncedSliderPropertyLine.d.ts +11 -0
  41. package/fluent/hoc/{syncedSliderLine.js → propertyLines/syncedSliderPropertyLine.js} +3 -3
  42. package/fluent/hoc/propertyLines/syncedSliderPropertyLine.js.map +1 -0
  43. package/fluent/hoc/propertyLines/textPropertyLine.js.map +1 -0
  44. package/fluent/hoc/{vectorPropertyLine.js → propertyLines/vectorPropertyLine.js} +2 -2
  45. package/fluent/hoc/propertyLines/vectorPropertyLine.js.map +1 -0
  46. package/fluent/primitives/button.d.ts +9 -0
  47. package/fluent/primitives/button.js +14 -0
  48. package/fluent/primitives/button.js.map +1 -0
  49. package/fluent/primitives/checkbox.d.ts +1 -1
  50. package/fluent/primitives/checkbox.js.map +1 -1
  51. package/fluent/primitives/colorPicker.d.ts +1 -1
  52. package/fluent/primitives/colorPicker.js +1 -1
  53. package/fluent/primitives/colorPicker.js.map +1 -1
  54. package/fluent/primitives/draggable.d.ts +8 -0
  55. package/fluent/primitives/draggable.js +33 -0
  56. package/fluent/primitives/draggable.js.map +1 -0
  57. package/fluent/primitives/dropdown.d.ts +1 -1
  58. package/fluent/primitives/dropdown.js.map +1 -1
  59. package/fluent/primitives/gradient.d.ts +28 -0
  60. package/fluent/primitives/gradient.js +86 -0
  61. package/fluent/primitives/gradient.js.map +1 -0
  62. package/fluent/primitives/input.d.ts +3 -7
  63. package/fluent/primitives/input.js +10 -7
  64. package/fluent/primitives/input.js.map +1 -1
  65. package/fluent/primitives/list.d.ts +26 -0
  66. package/fluent/primitives/list.js +43 -0
  67. package/fluent/primitives/list.js.map +1 -0
  68. package/fluent/primitives/messageBar.js +2 -2
  69. package/fluent/primitives/messageBar.js.map +1 -1
  70. package/fluent/primitives/spinButton.d.ts +8 -2
  71. package/fluent/primitives/spinButton.js +4 -2
  72. package/fluent/primitives/spinButton.js.map +1 -1
  73. package/fluent/primitives/switch.d.ts +1 -1
  74. package/fluent/primitives/switch.js.map +1 -1
  75. package/fluent/primitives/syncedSlider.d.ts +7 -2
  76. package/fluent/primitives/syncedSlider.js +28 -11
  77. package/fluent/primitives/syncedSlider.js.map +1 -1
  78. package/fluent/primitives/textarea.d.ts +1 -1
  79. package/fluent/primitives/textarea.js.map +1 -1
  80. package/lines/booleanLineComponent.js +2 -2
  81. package/lines/booleanLineComponent.js.map +1 -1
  82. package/lines/buttonLineComponent.js +3 -1
  83. package/lines/buttonLineComponent.js.map +1 -1
  84. package/lines/checkBoxLineComponent.js +1 -1
  85. package/lines/checkBoxLineComponent.js.map +1 -1
  86. package/lines/colorLineComponent.js +2 -2
  87. package/lines/colorLineComponent.js.map +1 -1
  88. package/lines/draggableLineComponent.d.ts +4 -10
  89. package/lines/draggableLineComponent.js +12 -10
  90. package/lines/draggableLineComponent.js.map +1 -1
  91. package/lines/draggableLineWithButtonComponent.d.ts +3 -7
  92. package/lines/draggableLineWithButtonComponent.js +14 -12
  93. package/lines/draggableLineWithButtonComponent.js.map +1 -1
  94. package/lines/fileButtonLineComponent.js +2 -1
  95. package/lines/fileButtonLineComponent.js.map +1 -1
  96. package/lines/floatLineComponent.d.ts +2 -0
  97. package/lines/floatLineComponent.js +23 -1
  98. package/lines/floatLineComponent.js.map +1 -1
  99. package/lines/messageLineComponent.d.ts +2 -0
  100. package/lines/messageLineComponent.js +9 -1
  101. package/lines/messageLineComponent.js.map +1 -1
  102. package/lines/optionsLineComponent.d.ts +1 -1
  103. package/lines/optionsLineComponent.js +1 -1
  104. package/lines/optionsLineComponent.js.map +1 -1
  105. package/lines/sliderLineComponent.js +2 -2
  106. package/lines/sliderLineComponent.js.map +1 -1
  107. package/lines/textInputLineComponent.js +3 -3
  108. package/lines/textInputLineComponent.js.map +1 -1
  109. package/lines/textLineComponent.js +4 -4
  110. package/lines/textLineComponent.js.map +1 -1
  111. package/lines/vector3LineComponent.js +1 -1
  112. package/lines/vector3LineComponent.js.map +1 -1
  113. package/package.json +1 -1
  114. package/split/splitContainer.js +4 -2
  115. package/split/splitContainer.js.map +1 -1
  116. package/components/lines/ColorLineComponent.d.ts +0 -38
  117. package/components/lines/ColorLineComponent.js +0 -147
  118. package/components/lines/ColorLineComponent.js.map +0 -1
  119. package/components/lines/ColorLineComponent.module.scss +0 -67
  120. package/fluent/hoc/checkboxPropertyLine.js.map +0 -1
  121. package/fluent/hoc/colorPropertyLine.js.map +0 -1
  122. package/fluent/hoc/dropdownPropertyLine.js.map +0 -1
  123. package/fluent/hoc/hexLineComponent.js.map +0 -1
  124. package/fluent/hoc/inputPropertyLine.d.ts +0 -5
  125. package/fluent/hoc/inputPropertyLine.js +0 -14
  126. package/fluent/hoc/inputPropertyLine.js.map +0 -1
  127. package/fluent/hoc/linkPropertyLine.js.map +0 -1
  128. package/fluent/hoc/propertyLine.js.map +0 -1
  129. package/fluent/hoc/readonlyBooleanLine.js.map +0 -1
  130. package/fluent/hoc/switchPropertyLine.js.map +0 -1
  131. package/fluent/hoc/syncedSliderLine.d.ts +0 -11
  132. package/fluent/hoc/syncedSliderLine.js.map +0 -1
  133. package/fluent/hoc/textPropertyLine.js.map +0 -1
  134. package/fluent/hoc/vectorPropertyLine.js.map +0 -1
  135. package/lines/iconButtonLineComponent.d.ts +0 -11
  136. package/lines/iconButtonLineComponent.js +0 -11
  137. package/lines/iconButtonLineComponent.js.map +0 -1
  138. /package/fluent/hoc/{linkPropertyLine.d.ts → propertyLines/linkPropertyLine.d.ts} +0 -0
  139. /package/fluent/hoc/{propertyLine.d.ts → propertyLines/propertyLine.d.ts} +0 -0
  140. /package/fluent/hoc/{textPropertyLine.d.ts → propertyLines/textPropertyLine.d.ts} +0 -0
  141. /package/fluent/hoc/{textPropertyLine.js → propertyLines/textPropertyLine.js} +0 -0
  142. /package/fluent/hoc/{vectorPropertyLine.d.ts → propertyLines/vectorPropertyLine.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"switchPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/switchPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD;;;;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"]}
@@ -0,0 +1,11 @@
1
+ import type { PropertyLineProps } from "./propertyLine.js";
2
+ import type { SyncedSliderProps } from "../../primitives/syncedSlider.js";
3
+ import type { FunctionComponent } from "react";
4
+ type SyncedSliderPropertyProps = SyncedSliderProps & PropertyLineProps;
5
+ /**
6
+ * Renders a simple wrapper around the SyncedSliderInput
7
+ * @param props
8
+ * @returns
9
+ */
10
+ export declare const SyncedSliderPropertyLine: FunctionComponent<SyncedSliderPropertyProps>;
11
+ export {};
@@ -1,13 +1,13 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { PropertyLine } from "./propertyLine.js";
3
- import { SyncedSliderInput } from "../primitives/syncedSlider.js";
3
+ import { SyncedSliderInput } from "../../primitives/syncedSlider.js";
4
4
  /**
5
5
  * Renders a simple wrapper around the SyncedSliderInput
6
6
  * @param props
7
7
  * @returns
8
8
  */
9
- export const SyncedSliderLine = (props) => {
9
+ export const SyncedSliderPropertyLine = (props) => {
10
10
  const { label, description, ...sliderProps } = props;
11
11
  return (_jsx(PropertyLine, { label: label, description: description, children: _jsx(SyncedSliderInput, { ...sliderProps }) }));
12
12
  };
13
- //# sourceMappingURL=syncedSliderLine.js.map
13
+ //# sourceMappingURL=syncedSliderPropertyLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"syncedSliderPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/syncedSliderPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAKlE;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAiD,CAAC,KAAK,EAAsB,EAAE;IAChH,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IACrD,OAAO,CACH,KAAC,YAAY,IAAC,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,WAAW,YAChD,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 SyncedSliderPropertyProps = 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 SyncedSliderPropertyLine: FunctionComponent<SyncedSliderPropertyProps> = (props): React.ReactElement => {\r\n const { label, description, ...sliderProps } = props;\r\n return (\r\n <PropertyLine label={label} description={description}>\r\n <SyncedSliderInput {...sliderProps} />\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/textPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAS9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAqD,CAAC,KAAK,EAAE,EAAE;IACxF,OAAO,CACH,KAAC,YAAY,OAAK,KAAK,YACnB,KAAC,KAAK,IAAC,KAAK,EAAE,KAAK,CAAC,OAAO,YAAG,KAAK,CAAC,KAAK,GAAS,GACvC,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Body1 } from \"@fluentui/react-components\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport type { PropertyLineProps } from \"./propertyLine\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\ntype TextProps = {\r\n value: string;\r\n tooltip?: string;\r\n};\r\n\r\n/**\r\n * Wraps text in a property line\r\n * @param props - PropertyLineProps and TextProps\r\n * @returns property-line wrapped text\r\n */\r\nexport const TextPropertyLine: FunctionComponent<PropertyLineProps & TextProps> = (props) => {\r\n return (\r\n <PropertyLine {...props}>\r\n <Body1 title={props.tooltip}>{props.value}</Body1>\r\n </PropertyLine>\r\n );\r\n};\r\n"]}
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { useState } from "react";
3
3
  import { Body1 } from "@fluentui/react-components";
4
4
  import { PropertyLine } from "./propertyLine.js";
5
- import { SyncedSliderLine } from "./syncedSliderLine.js";
5
+ import { SyncedSliderPropertyLine } from "./syncedSliderPropertyLine.js";
6
6
  import { Quaternion, Vector4 } from "@babylonjs/core/Maths/math.vector.js";
7
7
  import { Tools } from "@babylonjs/core/Misc/tools.js";
8
8
  /**
@@ -23,7 +23,7 @@ const TensorPropertyLine = (props) => {
23
23
  setVector(newVector);
24
24
  props.onChange(newVector);
25
25
  };
26
- return (_jsx(PropertyLine, { ...props, expandedContent: _jsxs(_Fragment, { children: [_jsx(SyncedSliderLine, { label: "X", value: converted(vector.x), min: min, max: max, onChange: (val) => onChange(val, "x") }), _jsx(SyncedSliderLine, { label: "Y", value: converted(vector.y), min: min, max: max, onChange: (val) => onChange(val, "y") }), _jsx(SyncedSliderLine, { label: "Z", value: converted(vector.z), min: min, max: max, onChange: (val) => onChange(val, "z") }), vector instanceof Vector4 && _jsx(SyncedSliderLine, { label: "W", value: vector.w, min: min, max: max, onChange: (val) => onChange(val, "w") })] }), children: _jsx(Body1, { children: `X: ${formatted(props.value.x)} | Y: ${formatted(props.value.y)} | Z: ${formatted(props.value.z)}${props.value instanceof Vector4 ? ` | W: ${formatted(props.value.w)}` : ""}` }) }));
26
+ return (_jsx(PropertyLine, { ...props, expandedContent: _jsxs(_Fragment, { children: [_jsx(SyncedSliderPropertyLine, { label: "X", value: converted(vector.x), min: min, max: max, onChange: (val) => onChange(val, "x") }), _jsx(SyncedSliderPropertyLine, { label: "Y", value: converted(vector.y), min: min, max: max, onChange: (val) => onChange(val, "y") }), _jsx(SyncedSliderPropertyLine, { label: "Z", value: converted(vector.z), min: min, max: max, onChange: (val) => onChange(val, "z") }), vector instanceof Vector4 && _jsx(SyncedSliderPropertyLine, { label: "W", value: vector.w, min: min, max: max, onChange: (val) => onChange(val, "w") })] }), children: _jsx(Body1, { children: `X: ${formatted(props.value.x)} | Y: ${formatted(props.value.y)} | Z: ${formatted(props.value.z)}${props.value instanceof Vector4 ? ` | W: ${formatted(props.value.w)}` : ""}` }) }));
27
27
  };
28
28
  const ToDegreesConverter = { from: Tools.ToDegrees, to: Tools.ToRadians };
29
29
  export const RotationVectorPropertyLine = (props) => {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vectorPropertyLine.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/fluent/hoc/propertyLines/vectorPropertyLine.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,6CAA+B;AAE7D,OAAO,EAAE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ACd,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC,CAAC;IACF,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CACtB,KAAC,mBAAmB,OAAK,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,aAAa,GAAI,CACnJ,CAAC,CAAC,CAAC,CACA,KAAC,8BAA8B,OAAK,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,GAAI,CACzG,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAyE,CAAC;AAC7G,MAAM,CAAC,MAAM,mBAAmB,GAAG,kBAAyE,CAAC","sourcesContent":["import { useState } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\n\r\nimport { Body1 } from \"@fluentui/react-components\";\r\nimport { PropertyLine } from \"./propertyLine\";\r\nimport type { BaseComponentProps, PropertyLineProps } from \"./propertyLine\";\r\n\r\nimport { SyncedSliderPropertyLine } from \"./syncedSliderPropertyLine\";\r\n\r\nimport { Quaternion, Vector4 } from \"core/Maths/math.vector\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport { Tools } from \"core/Misc/tools\";\r\n\r\nexport type TensorPropertyLineProps<V extends Vector3 | Vector4 | Quaternion> = BaseComponentProps<V> &\r\n PropertyLineProps & {\r\n /**\r\n * If passed, all sliders will use this for the min value\r\n */\r\n min?: number;\r\n /**\r\n * If passed, all sliders will use this for the max value\r\n */\r\n max?: number;\r\n /**\r\n * If passed, the UX will use the conversion functions to display/update values\r\n */\r\n valueConverter?: {\r\n /**\r\n * Will call from(val) before displaying in the UX\r\n */\r\n from: (val: number) => number;\r\n /**\r\n * Will call to(val) before calling onChange\r\n */\r\n to: (val: number) => number;\r\n };\r\n };\r\n\r\n/**\r\n * Reusable component which renders a vector property line containing a label, vector value, and expandable XYZW values\r\n * The expanded section contains a slider/input box for each component of the vector (x, y, z, w)\r\n * @param props\r\n * @returns\r\n */\r\nconst TensorPropertyLine: FunctionComponent<TensorPropertyLineProps<Vector3 | Vector4 | Quaternion>> = (props) => {\r\n const converted = (val: number) => (props.valueConverter ? props.valueConverter.from(val) : val);\r\n const formatted = (val: number) => converted(val).toFixed(2);\r\n\r\n const [vector, setVector] = useState(props.value);\r\n const { min, max } = props;\r\n\r\n const onChange = (val: number, key: \"x\" | \"y\" | \"z\" | \"w\") => {\r\n const value = props.valueConverter ? props.valueConverter.to(val) : val;\r\n const newVector = vector.clone();\r\n (newVector as Vector4)[key] = value; // The syncedSlider for 'w' is only rendered when vector is a Vector4, so this is safe\r\n\r\n setVector(newVector);\r\n props.onChange(newVector);\r\n };\r\n\r\n return (\r\n <PropertyLine\r\n {...props}\r\n expandedContent={\r\n <>\r\n <SyncedSliderPropertyLine label=\"X\" value={converted(vector.x)} min={min} max={max} onChange={(val) => onChange(val, \"x\")} />\r\n <SyncedSliderPropertyLine label=\"Y\" value={converted(vector.y)} min={min} max={max} onChange={(val) => onChange(val, \"y\")} />\r\n <SyncedSliderPropertyLine label=\"Z\" value={converted(vector.z)} min={min} max={max} onChange={(val) => onChange(val, \"z\")} />\r\n {vector instanceof Vector4 && <SyncedSliderPropertyLine label=\"W\" value={vector.w} min={min} max={max} onChange={(val) => onChange(val, \"w\")} />}\r\n </>\r\n }\r\n >\r\n <Body1>{`X: ${formatted(props.value.x)} | Y: ${formatted(props.value.y)} | Z: ${formatted(props.value.z)}${props.value instanceof Vector4 ? ` | W: ${formatted(props.value.w)}` : \"\"}`}</Body1>\r\n </PropertyLine>\r\n );\r\n};\r\n\r\ntype RotationVectorPropertyLineProps = TensorPropertyLineProps<Vector3> & {\r\n /**\r\n * Display angles as degrees instead of radians\r\n */\r\n useDegrees?: boolean;\r\n};\r\n\r\nconst ToDegreesConverter = { from: Tools.ToDegrees, to: Tools.ToRadians };\r\nexport const RotationVectorPropertyLine: FunctionComponent<RotationVectorPropertyLineProps> = (props) => {\r\n const min = props.useDegrees ? 0 : undefined;\r\n const max = props.useDegrees ? 360 : undefined;\r\n return <Vector3PropertyLine {...props} valueConverter={props.useDegrees ? ToDegreesConverter : undefined} min={min} max={max} />;\r\n};\r\n\r\ntype QuaternionPropertyLineProps = TensorPropertyLineProps<Quaternion> & {\r\n /**\r\n * Display angles as degrees instead of radians\r\n */\r\n useDegrees?: boolean;\r\n};\r\n\r\nconst QuaternionPropertyLineInternal = TensorPropertyLine as FunctionComponent<TensorPropertyLineProps<Quaternion>>;\r\nexport const QuaternionPropertyLine: FunctionComponent<QuaternionPropertyLineProps> = (props) => {\r\n const min = props.useDegrees ? 0 : undefined;\r\n const max = props.useDegrees ? 360 : undefined;\r\n const [quat, setQuat] = useState(props.value);\r\n const onQuatChange = (val: Quaternion) => {\r\n setQuat(val);\r\n props.onChange(val);\r\n };\r\n\r\n const onEulerChange = (val: Vector3) => {\r\n const quat = Quaternion.FromEulerAngles(val.x, val.y, val.z);\r\n setQuat(quat);\r\n props.onChange(quat);\r\n };\r\n return props.useDegrees ? (\r\n <Vector3PropertyLine {...props} value={quat.toEulerAngles()} valueConverter={ToDegreesConverter} min={min} max={max} onChange={onEulerChange} />\r\n ) : (\r\n <QuaternionPropertyLineInternal {...props} value={quat} min={min} max={max} onChange={onQuatChange} />\r\n );\r\n};\r\n\r\nexport const Vector3PropertyLine = TensorPropertyLine as FunctionComponent<TensorPropertyLineProps<Vector3>>;\r\nexport const Vector4PropertyLine = TensorPropertyLine as FunctionComponent<TensorPropertyLineProps<Vector4>>;\r\n"]}
@@ -0,0 +1,9 @@
1
+ import type { FunctionComponent } from "react";
2
+ import type { FluentIcon } from "@fluentui/react-icons";
3
+ export type ButtonProps = {
4
+ onClick: () => void;
5
+ icon?: FluentIcon;
6
+ label: string;
7
+ disabled?: boolean;
8
+ };
9
+ export declare const Button: FunctionComponent<ButtonProps>;
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Body1, Button as FluentButton, makeStyles, tokens } from "@fluentui/react-components";
3
+ const useButtonLineStyles = makeStyles({
4
+ button: {
5
+ border: `1px solid ${tokens.colorBrandBackground}`,
6
+ },
7
+ });
8
+ export const Button = (props) => {
9
+ const classes = useButtonLineStyles();
10
+ // eslint-disable-next-line @typescript-eslint/naming-convention
11
+ const { icon: Icon, ...buttonProps } = props;
12
+ return (_jsx(FluentButton, { iconPosition: "after", className: classes.button, ...buttonProps, icon: Icon && _jsx(Icon, {}), children: _jsx(Body1, { children: props.label }) }));
13
+ };
14
+ //# sourceMappingURL=button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAI/F,MAAM,mBAAmB,GAAG,UAAU,CAAC;IACnC,MAAM,EAAE;QACJ,MAAM,EAAE,aAAa,MAAM,CAAC,oBAAoB,EAAE;KACrD;CACJ,CAAC,CAAC;AASH,MAAM,CAAC,MAAM,MAAM,GAAmC,CAAC,KAAK,EAAE,EAAE;IAC5D,MAAM,OAAO,GAAG,mBAAmB,EAAE,CAAC;IACtC,gEAAgE;IAChE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,WAAW,EAAE,GAAG,KAAK,CAAC;IAE7C,OAAO,CACH,KAAC,YAAY,IAAC,YAAY,EAAC,OAAO,EAAC,SAAS,EAAE,OAAO,CAAC,MAAM,KAAM,WAAW,EAAE,IAAI,EAAE,IAAI,IAAI,KAAC,IAAI,KAAG,YACjG,KAAC,KAAK,cAAE,KAAK,CAAC,KAAK,GAAS,GACjB,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Body1, Button as FluentButton, makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { FluentIcon } from \"@fluentui/react-icons\";\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 ButtonProps = {\r\n onClick: () => void;\r\n icon?: FluentIcon;\r\n label: string;\r\n disabled?: boolean;\r\n};\r\n\r\nexport const Button: FunctionComponent<ButtonProps> = (props) => {\r\n const classes = useButtonLineStyles();\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n const { icon: Icon, ...buttonProps } = props;\r\n\r\n return (\r\n <FluentButton iconPosition=\"after\" className={classes.button} {...buttonProps} icon={Icon && <Icon />}>\r\n <Body1>{props.label}</Body1>\r\n </FluentButton>\r\n );\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { FunctionComponent } from "react";
2
- import type { BaseComponentProps } from "../hoc/propertyLine.js";
2
+ import type { BaseComponentProps } from "../hoc/propertyLines/propertyLine.js";
3
3
  export type CheckboxProps = BaseComponentProps<boolean>;
4
4
  /**
5
5
  * This is a primitive fluent checkbox that can both read and write checked state
@@ -1 +1 @@
1
- {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/checkbox.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAqC,CAAC,KAAK,EAAE,EAAE;IAChE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;IAEnE,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,KAAK,CAAC,KAAK,IAAI,SAAS,EAAE,CAAC;YAC3B,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,gDAAgD;QAC7E,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElB,MAAM,QAAQ,GAAG,CAAC,EAAiC,EAAE,CAAuB,EAAE,EAAE;QAC5E,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,OAAO,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;AAC9F,CAAC,CAAC","sourcesContent":["import type { CheckboxOnChangeData } from \"@fluentui/react-components\";\r\nimport type { ChangeEvent, FunctionComponent } from \"react\";\r\n\r\nimport { Checkbox as FluentCheckbox } from \"@fluentui/react-components\";\r\nimport { useEffect, useState } from \"react\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLine\";\r\n\r\nexport type CheckboxProps = BaseComponentProps<boolean>;\r\n/**\r\n * This is a primitive fluent checkbox that can both read and write checked state\r\n * @param props\r\n * @returns Checkbox component\r\n */\r\nexport const Checkbox: FunctionComponent<CheckboxProps> = (props) => {\r\n const [checked, setChecked] = useState(() => props.value ?? false);\r\n\r\n useEffect(() => {\r\n if (props.value != undefined) {\r\n setChecked(props.value); // Update local state when props.checked changes\r\n }\r\n }, [props.value]);\r\n\r\n const onChange = (ev: ChangeEvent<HTMLInputElement>, _: CheckboxOnChangeData) => {\r\n props.onChange(ev.target.checked);\r\n setChecked(ev.target.checked);\r\n };\r\n\r\n return <FluentCheckbox checked={checked} onChange={onChange} disabled={props.disabled} />;\r\n};\r\n"]}
1
+ {"version":3,"file":"checkbox.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/checkbox.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI5C;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAqC,CAAC,KAAK,EAAE,EAAE;IAChE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,CAAC;IAEnE,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,KAAK,CAAC,KAAK,IAAI,SAAS,EAAE,CAAC;YAC3B,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,gDAAgD;QAC7E,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAElB,MAAM,QAAQ,GAAG,CAAC,EAAiC,EAAE,CAAuB,EAAE,EAAE;QAC5E,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAClC,UAAU,CAAC,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC;IAEF,OAAO,KAAC,cAAc,IAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAI,CAAC;AAC9F,CAAC,CAAC","sourcesContent":["import type { CheckboxOnChangeData } from \"@fluentui/react-components\";\r\nimport type { ChangeEvent, FunctionComponent } from \"react\";\r\n\r\nimport { Checkbox as FluentCheckbox } from \"@fluentui/react-components\";\r\nimport { useEffect, useState } from \"react\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLines/propertyLine\";\r\n\r\nexport type CheckboxProps = BaseComponentProps<boolean>;\r\n/**\r\n * This is a primitive fluent checkbox that can both read and write checked state\r\n * @param props\r\n * @returns Checkbox component\r\n */\r\nexport const Checkbox: FunctionComponent<CheckboxProps> = (props) => {\r\n const [checked, setChecked] = useState(() => props.value ?? false);\r\n\r\n useEffect(() => {\r\n if (props.value != undefined) {\r\n setChecked(props.value); // Update local state when props.checked changes\r\n }\r\n }, [props.value]);\r\n\r\n const onChange = (ev: ChangeEvent<HTMLInputElement>, _: CheckboxOnChangeData) => {\r\n props.onChange(ev.target.checked);\r\n setChecked(ev.target.checked);\r\n };\r\n\r\n return <FluentCheckbox checked={checked} onChange={onChange} disabled={props.disabled} />;\r\n};\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import type { FunctionComponent } from "react";
2
2
  import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { BaseComponentProps } from "../hoc/propertyLine.js";
3
+ import type { BaseComponentProps } from "../hoc/propertyLines/propertyLine.js";
4
4
  export type ColorPickerProps<C extends Color3 | Color4> = {
5
5
  isLinearMode?: boolean;
6
6
  } & BaseComponentProps<C>;
@@ -66,7 +66,7 @@ export const ColorPickerPopup = (props) => {
66
66
  align: "start",
67
67
  overflowBoundary: document.body,
68
68
  autoSize: true,
69
- }, open: popoverOpen, trapFocus: true, onOpenChange: (_, data) => setPopoverOpen(data.open), children: [_jsx(PopoverTrigger, { disableButtonEnhancement: true, children: _jsx(ColorSwatch, { size: "small", color: color.toHexString(), value: color.toHexString().slice(1) }) }), _jsx(PopoverSurface, { children: _jsxs("div", { className: classes.colorPickerContainer, children: [_jsxs(ColorPicker, { color: rgbaToHsv(color), onColorChange: handleColorPickerChange, children: [_jsx(ColorArea, { inputX: { "aria-label": "Saturation" }, inputY: { "aria-label": "Brightness" } }), _jsx(ColorSlider, { "aria-label": "Hue" }), color instanceof Color4 && _jsx(AlphaSlider, { "aria-label": "Alpha" })] }), _jsxs("div", { className: classes.container, children: [_jsxs("div", { className: classes.row, children: [_jsx("div", { className: classes.previewColor, style: { backgroundColor: color.toHexString() } }), _jsx(InputHexField, { label: "Gamma Hex", value: color, isLinearMode: props.isLinearMode, onChange: handleChange }), _jsx(InputHexField, { label: "Linear Hex", linearHex: true, isLinearMode: props.isLinearMode, value: color, onChange: handleChange })] }), _jsxs("div", { className: classes.row, children: [_jsx(InputRgbField, { label: "Red", color: color, rgbKey: "r", onChange: handleChange }), _jsx(InputRgbField, { label: "Green", color: color, rgbKey: "g", onChange: handleChange }), _jsx(InputRgbField, { label: "Blue", color: color, rgbKey: "b", onChange: handleChange }), _jsx(InputAlphaField, { color: color, onChange: handleChange })] }), _jsxs("div", { className: classes.row, children: [_jsx(InputHsvField, { label: "Hue", color: color, hsvKey: "h", max: 360, onChange: handleChange }), _jsx(InputHsvField, { label: "Saturation", color: color, hsvKey: "s", max: 100, scale: 100, onChange: handleChange }), _jsx(InputHsvField, { label: "Value", color: color, hsvKey: "v", max: 100, scale: 100, onChange: handleChange })] })] })] }) })] }));
69
+ }, open: popoverOpen, trapFocus: true, onOpenChange: (_, data) => setPopoverOpen(data.open), children: [_jsx(PopoverTrigger, { disableButtonEnhancement: true, children: _jsx(ColorSwatch, { borderColor: tokens.colorNeutralShadowKeyDarker, size: "small", color: color.toHexString(), value: color.toHexString().slice(1) }) }), _jsx(PopoverSurface, { children: _jsxs("div", { className: classes.colorPickerContainer, children: [_jsxs(ColorPicker, { color: rgbaToHsv(color), onColorChange: handleColorPickerChange, children: [_jsx(ColorArea, { inputX: { "aria-label": "Saturation" }, inputY: { "aria-label": "Brightness" } }), _jsx(ColorSlider, { "aria-label": "Hue" }), color instanceof Color4 && _jsx(AlphaSlider, { "aria-label": "Alpha" })] }), _jsxs("div", { className: classes.container, children: [_jsxs("div", { className: classes.row, children: [_jsx("div", { className: classes.previewColor, style: { backgroundColor: color.toHexString() } }), _jsx(InputHexField, { label: "Gamma Hex", value: color, isLinearMode: props.isLinearMode, onChange: handleChange }), _jsx(InputHexField, { label: "Linear Hex", linearHex: true, isLinearMode: props.isLinearMode, value: color, onChange: handleChange })] }), _jsxs("div", { className: classes.row, children: [_jsx(InputRgbField, { label: "Red", color: color, rgbKey: "r", onChange: handleChange }), _jsx(InputRgbField, { label: "Green", color: color, rgbKey: "g", onChange: handleChange }), _jsx(InputRgbField, { label: "Blue", color: color, rgbKey: "b", onChange: handleChange }), _jsx(InputAlphaField, { color: color, onChange: handleChange })] }), _jsxs("div", { className: classes.row, children: [_jsx(InputHsvField, { label: "Hue", color: color, hsvKey: "h", max: 360, onChange: handleChange }), _jsx(InputHsvField, { label: "Saturation", color: color, hsvKey: "s", max: 100, scale: 100, onChange: handleChange }), _jsx(InputHsvField, { label: "Value", color: color, hsvKey: "v", max: 100, scale: 100, onChange: handleChange })] })] })] }) })] }));
70
70
  };
71
71
  /**
72
72
  * Component which displays the passed in color's HEX value, either in linearSpace (if linearHex is true) or in gamma space
@@ -1 +1 @@
1
- {"version":3,"file":"colorPicker.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/colorPicker.tsx"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EACH,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,IAAI,EACJ,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,MAAM,EACN,WAAW,EACX,WAAW,GACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AAGvD,MAAM,oBAAoB,GAAG,UAAU,CAAC;IACpC,oBAAoB,EAAE;QAClB,KAAK,EAAE,OAAO;QACd,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;QACvB,GAAG,EAAE,MAAM,CAAC,qBAAqB,EAAE,OAAO;QAC1C,QAAQ,EAAE,SAAS;KACtB;IACD,YAAY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AC,CAAC,EAC5C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,GACR,IACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,OAAO,CAAC;AAE7B,SAAS,SAAS,CAAC,KAAsD;IACrE,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACtB,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-returns */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { useState, useEffect, useCallback } from \"react\";\r\nimport type { FunctionComponent, ChangeEvent } from \"react\";\r\nimport {\r\n Input,\r\n Label,\r\n SpinButton,\r\n useId,\r\n ColorPicker,\r\n ColorSlider,\r\n ColorArea,\r\n AlphaSlider,\r\n InfoLabel,\r\n Link,\r\n makeStyles,\r\n Popover,\r\n PopoverSurface,\r\n PopoverTrigger,\r\n tokens,\r\n Body1Strong,\r\n ColorSwatch,\r\n} from \"@fluentui/react-components\";\r\nimport type { SpinButtonChangeEvent, SpinButtonOnChangeData, ColorPickerProps as FluentColorPickerProps, InputOnChangeData } from \"@fluentui/react-components\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLine\";\r\n\r\nconst useColorPickerStyles = makeStyles({\r\n colorPickerContainer: {\r\n width: \"325px\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalMNudge, // 10px\r\n overflow: \"visible\",\r\n },\r\n previewColor: {\r\n width: \"50px\",\r\n height: \"50px\",\r\n borderRadius: tokens.borderRadiusMedium,\r\n border: `${tokens.spacingVerticalXXS} solid ${tokens.colorNeutralShadowKeyLighter}`,\r\n \"@media (forced-colors: active)\": {\r\n forcedColorAdjust: \"none\", // ensures elmement maintains color in high constrast mode\r\n },\r\n },\r\n row: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n gap: tokens.spacingVerticalM, // 12px\r\n alignItems: \"center\",\r\n },\r\n colorFieldWrapper: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalSNudge, // 6px\r\n },\r\n input: {\r\n width: \"80px\",\r\n },\r\n spinButton: {\r\n minWidth: \"60px\",\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalL, // 16px\r\n },\r\n});\r\n\r\nexport type ColorPickerProps<C extends Color3 | Color4> = {\r\n isLinearMode?: boolean;\r\n} & BaseComponentProps<C>;\r\n\r\nexport const ColorPickerPopup: FunctionComponent<ColorPickerProps<Color3 | Color4>> = (props) => {\r\n const classes = useColorPickerStyles();\r\n const [color, setColor] = useState(props.value);\r\n\r\n const [popoverOpen, setPopoverOpen] = useState(false);\r\n\r\n useEffect(() => {\r\n setColor(props.value); // Ensures the trigger color updates when props.value changes\r\n }, [props.value]);\r\n\r\n const handleColorPickerChange: FluentColorPickerProps[\"onColorChange\"] = (_, data) => {\r\n let color: Color3 | Color4 = Color3.FromHSV(data.color.h, data.color.s, data.color.v);\r\n if (props.value instanceof Color4) {\r\n color = Color4.FromColor3(color, data.color.a ?? 1);\r\n }\r\n handleChange(color);\r\n };\r\n\r\n const handleChange = (newColor: Color3 | Color4) => {\r\n setColor(newColor);\r\n props.onChange(newColor); // Ensures the parent is notified when color changes from within colorPicker\r\n };\r\n\r\n return (\r\n <Popover\r\n positioning={{\r\n align: \"start\",\r\n overflowBoundary: document.body,\r\n autoSize: true,\r\n }}\r\n open={popoverOpen}\r\n trapFocus\r\n onOpenChange={(_, data) => setPopoverOpen(data.open)}\r\n >\r\n <PopoverTrigger disableButtonEnhancement>\r\n <ColorSwatch size=\"small\" color={color.toHexString()} value={color.toHexString().slice(1)} />\r\n </PopoverTrigger>\r\n\r\n <PopoverSurface>\r\n <div className={classes.colorPickerContainer}>\r\n <ColorPicker color={rgbaToHsv(color)} onColorChange={handleColorPickerChange}>\r\n <ColorArea inputX={{ \"aria-label\": \"Saturation\" }} inputY={{ \"aria-label\": \"Brightness\" }} />\r\n <ColorSlider aria-label=\"Hue\" />\r\n {color instanceof Color4 && <AlphaSlider aria-label=\"Alpha\" />}\r\n </ColorPicker>\r\n <div className={classes.container}>\r\n {/* Top Row: Preview, Gamma Hex, Linear Hex */}\r\n <div className={classes.row}>\r\n <div className={classes.previewColor} style={{ backgroundColor: color.toHexString() }} />\r\n <InputHexField label=\"Gamma Hex\" value={color} isLinearMode={props.isLinearMode} onChange={handleChange} />\r\n <InputHexField label=\"Linear Hex\" linearHex={true} isLinearMode={props.isLinearMode} value={color} onChange={handleChange} />\r\n </div>\r\n\r\n {/* Middle Row: Red, Green, Blue, Alpha */}\r\n <div className={classes.row}>\r\n <InputRgbField label=\"Red\" color={color} rgbKey=\"r\" onChange={handleChange} />\r\n <InputRgbField label=\"Green\" color={color} rgbKey=\"g\" onChange={handleChange} />\r\n <InputRgbField label=\"Blue\" color={color} rgbKey=\"b\" onChange={handleChange} />\r\n <InputAlphaField color={color} onChange={handleChange} />\r\n </div>\r\n\r\n {/* Bottom Row: Hue, Saturation, Value */}\r\n <div className={classes.row}>\r\n <InputHsvField label=\"Hue\" color={color} hsvKey=\"h\" max={360} onChange={handleChange} />\r\n <InputHsvField label=\"Saturation\" color={color} hsvKey=\"s\" max={100} scale={100} onChange={handleChange} />\r\n <InputHsvField label=\"Value\" color={color} hsvKey=\"v\" max={100} scale={100} onChange={handleChange} />\r\n </div>\r\n </div>\r\n </div>\r\n </PopoverSurface>\r\n </Popover>\r\n );\r\n};\r\n\r\ntype HsvKey = \"h\" | \"s\" | \"v\";\r\nexport type InputHexProps = BaseComponentProps<Color3 | Color4> & {\r\n label?: string;\r\n linearHex?: boolean;\r\n isLinearMode?: boolean;\r\n};\r\n/**\r\n * Component which displays the passed in color's HEX value, either in linearSpace (if linearHex is true) or in gamma space\r\n * When the hex color is changed by user, component calculates the new Color3/4 value and calls onChange\r\n *\r\n * Component uses the isLinearMode boolean to display an informative label regarding linear / gamma space\r\n * @param props - The properties for the InputHexField component.\r\n * @returns\r\n */\r\nexport const InputHexField: FunctionComponent<InputHexProps> = (props) => {\r\n const id = useId(\"hex-input\");\r\n const styles = useColorPickerStyles();\r\n const { label, value, onChange, linearHex, isLinearMode } = props;\r\n\r\n const handleChange = (e: ChangeEvent<HTMLInputElement>, _: InputOnChangeData) => {\r\n // If linearHint (aka PBR material, ensure the other values are displayed in gamma even if linear hex changes)\r\n const value = e.target.value;\r\n if (value != \"\" && /^[0-9A-Fa-f]+$/g.test(value) == false) {\r\n return;\r\n }\r\n onChange(Color3.FromHexString(value).toGammaSpace());\r\n };\r\n return (\r\n <div className={styles.colorFieldWrapper}>\r\n {props.linearHex ? (\r\n <InfoLabel\r\n htmlFor={id}\r\n info={\r\n !isLinearMode ? (\r\n <> This color picker is attached to an entity whose color is stored in gamma space, so we are showing linear hex in disabled view </>\r\n ) : (\r\n <>\r\n This color picker is attached to an entity whose color is stored in linear space (ex: PBR Material), and Babylon converts the color to gamma space\r\n before rendering on screen because the human eye is best at processing colors in gamma space. We thus also want to display the color picker in gamma\r\n space so that the color chosen here will match the color seen in your entity.\r\n <br />\r\n If you want to copy/paste the HEX into your code, you can either use\r\n <Body1Strong>Color3.FromHexString(LINEAR_HEX)</Body1Strong>\r\n <br />\r\n or\r\n <br />\r\n <Body1Strong>Color3.FromHexString(GAMMA_HEX).toLinearSpace()</Body1Strong>\r\n <br />\r\n <br />\r\n <Link href=\"https://doc.babylonjs.com/preparingArtForBabylon/controllingColorSpace/\"> Read more in our docs! </Link>\r\n </>\r\n )\r\n }\r\n >\r\n {label}\r\n </InfoLabel>\r\n ) : (\r\n <Label htmlFor={id}>{label}</Label>\r\n )}\r\n <Input\r\n disabled={linearHex ? !isLinearMode : false}\r\n className={styles.input}\r\n value={linearHex ? value.toLinearSpace().toHexString() : value.toHexString()}\r\n id={id}\r\n onChange={handleChange}\r\n />\r\n </div>\r\n );\r\n};\r\n\r\ntype RgbKey = \"r\" | \"g\" | \"b\";\r\ntype InputRgbFieldProps = {\r\n color: Color3 | Color4;\r\n label: string;\r\n rgbKey: RgbKey;\r\n onChange: (color: Color3 | Color4) => void;\r\n};\r\n\r\nconst InputRgbField: FunctionComponent<InputRgbFieldProps> = (props) => {\r\n const { color, onChange, label, rgbKey } = props;\r\n const id = useId(`${label.toLowerCase()}-input`);\r\n const classes = useColorPickerStyles();\r\n\r\n const handleChange = useCallback(\r\n (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const val = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (val === null || Number.isNaN(val) || !NUMBER_REGEX.test(val.toString())) {\r\n return;\r\n }\r\n\r\n const newColor = color.clone();\r\n newColor[rgbKey] = val / 255.0; // Convert to 0-1 range\r\n onChange(newColor);\r\n },\r\n [color]\r\n );\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <Label htmlFor={id}>{label}</Label>\r\n <SpinButton className={classes.spinButton} min={0} max={255} value={color[rgbKey] * 255.0} step={1} id={id} onChange={handleChange} name={rgbKey} />\r\n </div>\r\n );\r\n};\r\n\r\ntype InputHsvFieldProps = {\r\n color: Color3 | Color4;\r\n label: string;\r\n hsvKey: HsvKey;\r\n onChange: (color: Color3 | Color4) => void;\r\n max: number;\r\n scale?: number;\r\n};\r\n\r\n/**\r\n * In the HSV (Hue, Saturation, Value) color model, Hue (H) ranges from 0 to 360 degrees, representing the color's position on the color wheel.\r\n * Saturation (S) ranges from 0 to 100%, indicating the intensity or purity of the color, with 0 being shades of gray and 100 being a fully saturated color.\r\n * Value (V) ranges from 0 to 100%, representing the brightness of the color, with 0 being black and 100 being the brightest.\r\n * @param props - The properties for the InputHsvField component.\r\n */\r\nexport const InputHsvField: FunctionComponent<InputHsvFieldProps> = (props) => {\r\n const { color, label, hsvKey, max, scale = 1 } = props;\r\n\r\n const id = useId(`${label.toLowerCase()}-input`);\r\n const classes = useColorPickerStyles();\r\n\r\n const handleChange = useCallback(\r\n (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const val = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (val === null || Number.isNaN(val) || !NUMBER_REGEX.test(val.toString())) {\r\n return;\r\n }\r\n\r\n // Convert current color to HSV, update the new hsv value, then call onChange prop\r\n const hsv = rgbaToHsv(color);\r\n hsv[hsvKey] = val / scale;\r\n let newColor: Color3 | Color4 = Color3.FromHSV(hsv.h, hsv.s, hsv.v);\r\n if (color instanceof Color4) {\r\n newColor = Color4.FromColor3(newColor, color.a ?? 1);\r\n }\r\n props.onChange(newColor);\r\n },\r\n [color]\r\n );\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <Label htmlFor={id}>{label}</Label>\r\n <SpinButton className={classes.spinButton} min={0} max={max} value={rgbaToHsv(color)[hsvKey] * scale} step={1} id={id} onChange={handleChange} name={hsvKey} />\r\n </div>\r\n );\r\n};\r\n\r\ntype InputAlphaProps = {\r\n color: Color3 | Color4;\r\n onChange: (color: Color4) => void;\r\n};\r\n\r\n/**\r\n * Displays the alpha value of a color, either in the disabled state (if color is Color3) or as a spin button (if color is Color4).\r\n * @param props\r\n * @returns\r\n */\r\nconst InputAlphaField: FunctionComponent<InputAlphaProps> = (props) => {\r\n const classes = useColorPickerStyles();\r\n const id = useId(\"alpha-input\");\r\n const { color } = props;\r\n\r\n const onChange = (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const value = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (Number.isNaN(value) || value < 0 || value > 1) {\r\n return;\r\n }\r\n\r\n if (color instanceof Color4) {\r\n const newColor = color.clone();\r\n newColor.a = value;\r\n return newColor;\r\n } else {\r\n return Color4.FromColor3(color, value);\r\n }\r\n };\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <div className={classes.row}>\r\n <Label htmlFor={id}>Alpha</Label>\r\n {color instanceof Color3 && (\r\n <InfoLabel\r\n htmlFor={id}\r\n info={\r\n <>\r\n Because this color picker is representing a Color3, we do not permit modifying alpha from the color picker. You can however modify the material's\r\n alpha property directly, either in code via material.alpha OR via inspector's transparency section.\r\n </>\r\n }\r\n ></InfoLabel>\r\n )}\r\n </div>\r\n <SpinButton\r\n disabled={color instanceof Color3}\r\n min={0}\r\n max={1}\r\n className={classes.spinButton}\r\n value={color instanceof Color3 ? 1 : color.a}\r\n step={0.01}\r\n onChange={onChange}\r\n id={id}\r\n />\r\n </div>\r\n );\r\n};\r\n\r\nconst NUMBER_REGEX = /^\\d+$/;\r\n\r\nfunction rgbaToHsv(color: { r: number; g: number; b: number; a?: number }): { h: number; s: number; v: number; a?: number } {\r\n const c = new Color3(color.r, color.g, color.b);\r\n const hsv = c.toHSV();\r\n return { h: hsv.r, s: hsv.g, v: hsv.b, a: color.a };\r\n}\r\n"]}
1
+ {"version":3,"file":"colorPicker.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/colorPicker.tsx"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,yDAAyD;AACzD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EACH,KAAK,EACL,KAAK,EACL,UAAU,EACV,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,IAAI,EACJ,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,MAAM,EACN,WAAW,EACX,WAAW,GACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,M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C,SAAS,IACN,OAAO,EAAE,EAAE,EACX,IAAI,EACA,sRAGG,GAEE,CAChB,IACC,EACN,KAAC,UAAU,IACP,QAAQ,EAAE,KAAK,YAAY,MAAM,EACjC,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,CAAC,EACN,SAAS,EAAE,OAAO,CAAC,UAAU,EAC7B,KAAK,EAAE,KAAK,YAAY,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAC5C,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,QAAQ,EAClB,EAAE,EAAE,EAAE,GACR,IACA,CACT,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,OAAO,CAAC;AAE7B,SAAS,SAAS,CAAC,KAAsD;IACrE,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IAChD,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;IACtB,OAAO,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC;AACxD,CAAC","sourcesContent":["/* eslint-disable jsdoc/require-returns */\r\n/* eslint-disable @typescript-eslint/naming-convention */\r\nimport { useState, useEffect, useCallback } from \"react\";\r\nimport type { FunctionComponent, ChangeEvent } from \"react\";\r\nimport {\r\n Input,\r\n Label,\r\n SpinButton,\r\n useId,\r\n ColorPicker,\r\n ColorSlider,\r\n ColorArea,\r\n AlphaSlider,\r\n InfoLabel,\r\n Link,\r\n makeStyles,\r\n Popover,\r\n PopoverSurface,\r\n PopoverTrigger,\r\n tokens,\r\n Body1Strong,\r\n ColorSwatch,\r\n} from \"@fluentui/react-components\";\r\nimport type { SpinButtonChangeEvent, SpinButtonOnChangeData, ColorPickerProps as FluentColorPickerProps, InputOnChangeData } from \"@fluentui/react-components\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLines/propertyLine\";\r\n\r\nconst useColorPickerStyles = makeStyles({\r\n colorPickerContainer: {\r\n width: \"325px\",\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalMNudge, // 10px\r\n overflow: \"visible\",\r\n },\r\n previewColor: {\r\n width: \"50px\",\r\n height: \"50px\",\r\n borderRadius: tokens.borderRadiusMedium,\r\n border: `${tokens.spacingVerticalXXS} solid ${tokens.colorNeutralShadowKeyLighter}`,\r\n \"@media (forced-colors: active)\": {\r\n forcedColorAdjust: \"none\", // ensures elmement maintains color in high constrast mode\r\n },\r\n },\r\n row: {\r\n display: \"flex\",\r\n flexDirection: \"row\",\r\n gap: tokens.spacingVerticalM, // 12px\r\n alignItems: \"center\",\r\n },\r\n colorFieldWrapper: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalSNudge, // 6px\r\n },\r\n input: {\r\n width: \"80px\",\r\n },\r\n spinButton: {\r\n minWidth: \"60px\",\r\n },\r\n container: {\r\n display: \"flex\",\r\n flexDirection: \"column\",\r\n gap: tokens.spacingVerticalL, // 16px\r\n },\r\n});\r\n\r\nexport type ColorPickerProps<C extends Color3 | Color4> = {\r\n isLinearMode?: boolean;\r\n} & BaseComponentProps<C>;\r\n\r\nexport const ColorPickerPopup: FunctionComponent<ColorPickerProps<Color3 | Color4>> = (props) => {\r\n const classes = useColorPickerStyles();\r\n const [color, setColor] = useState(props.value);\r\n\r\n const [popoverOpen, setPopoverOpen] = useState(false);\r\n\r\n useEffect(() => {\r\n setColor(props.value); // Ensures the trigger color updates when props.value changes\r\n }, [props.value]);\r\n\r\n const handleColorPickerChange: FluentColorPickerProps[\"onColorChange\"] = (_, data) => {\r\n let color: Color3 | Color4 = Color3.FromHSV(data.color.h, data.color.s, data.color.v);\r\n if (props.value instanceof Color4) {\r\n color = Color4.FromColor3(color, data.color.a ?? 1);\r\n }\r\n handleChange(color);\r\n };\r\n\r\n const handleChange = (newColor: Color3 | Color4) => {\r\n setColor(newColor);\r\n props.onChange(newColor); // Ensures the parent is notified when color changes from within colorPicker\r\n };\r\n\r\n return (\r\n <Popover\r\n positioning={{\r\n align: \"start\",\r\n overflowBoundary: document.body,\r\n autoSize: true,\r\n }}\r\n open={popoverOpen}\r\n trapFocus\r\n onOpenChange={(_, data) => setPopoverOpen(data.open)}\r\n >\r\n <PopoverTrigger disableButtonEnhancement>\r\n <ColorSwatch borderColor={tokens.colorNeutralShadowKeyDarker} size=\"small\" color={color.toHexString()} value={color.toHexString().slice(1)} />\r\n </PopoverTrigger>\r\n\r\n <PopoverSurface>\r\n <div className={classes.colorPickerContainer}>\r\n <ColorPicker color={rgbaToHsv(color)} onColorChange={handleColorPickerChange}>\r\n <ColorArea inputX={{ \"aria-label\": \"Saturation\" }} inputY={{ \"aria-label\": \"Brightness\" }} />\r\n <ColorSlider aria-label=\"Hue\" />\r\n {color instanceof Color4 && <AlphaSlider aria-label=\"Alpha\" />}\r\n </ColorPicker>\r\n <div className={classes.container}>\r\n {/* Top Row: Preview, Gamma Hex, Linear Hex */}\r\n <div className={classes.row}>\r\n <div className={classes.previewColor} style={{ backgroundColor: color.toHexString() }} />\r\n <InputHexField label=\"Gamma Hex\" value={color} isLinearMode={props.isLinearMode} onChange={handleChange} />\r\n <InputHexField label=\"Linear Hex\" linearHex={true} isLinearMode={props.isLinearMode} value={color} onChange={handleChange} />\r\n </div>\r\n\r\n {/* Middle Row: Red, Green, Blue, Alpha */}\r\n <div className={classes.row}>\r\n <InputRgbField label=\"Red\" color={color} rgbKey=\"r\" onChange={handleChange} />\r\n <InputRgbField label=\"Green\" color={color} rgbKey=\"g\" onChange={handleChange} />\r\n <InputRgbField label=\"Blue\" color={color} rgbKey=\"b\" onChange={handleChange} />\r\n <InputAlphaField color={color} onChange={handleChange} />\r\n </div>\r\n\r\n {/* Bottom Row: Hue, Saturation, Value */}\r\n <div className={classes.row}>\r\n <InputHsvField label=\"Hue\" color={color} hsvKey=\"h\" max={360} onChange={handleChange} />\r\n <InputHsvField label=\"Saturation\" color={color} hsvKey=\"s\" max={100} scale={100} onChange={handleChange} />\r\n <InputHsvField label=\"Value\" color={color} hsvKey=\"v\" max={100} scale={100} onChange={handleChange} />\r\n </div>\r\n </div>\r\n </div>\r\n </PopoverSurface>\r\n </Popover>\r\n );\r\n};\r\n\r\ntype HsvKey = \"h\" | \"s\" | \"v\";\r\nexport type InputHexProps = BaseComponentProps<Color3 | Color4> & {\r\n label?: string;\r\n linearHex?: boolean;\r\n isLinearMode?: boolean;\r\n};\r\n/**\r\n * Component which displays the passed in color's HEX value, either in linearSpace (if linearHex is true) or in gamma space\r\n * When the hex color is changed by user, component calculates the new Color3/4 value and calls onChange\r\n *\r\n * Component uses the isLinearMode boolean to display an informative label regarding linear / gamma space\r\n * @param props - The properties for the InputHexField component.\r\n * @returns\r\n */\r\nexport const InputHexField: FunctionComponent<InputHexProps> = (props) => {\r\n const id = useId(\"hex-input\");\r\n const styles = useColorPickerStyles();\r\n const { label, value, onChange, linearHex, isLinearMode } = props;\r\n\r\n const handleChange = (e: ChangeEvent<HTMLInputElement>, _: InputOnChangeData) => {\r\n // If linearHint (aka PBR material, ensure the other values are displayed in gamma even if linear hex changes)\r\n const value = e.target.value;\r\n if (value != \"\" && /^[0-9A-Fa-f]+$/g.test(value) == false) {\r\n return;\r\n }\r\n onChange(Color3.FromHexString(value).toGammaSpace());\r\n };\r\n return (\r\n <div className={styles.colorFieldWrapper}>\r\n {props.linearHex ? (\r\n <InfoLabel\r\n htmlFor={id}\r\n info={\r\n !isLinearMode ? (\r\n <> This color picker is attached to an entity whose color is stored in gamma space, so we are showing linear hex in disabled view </>\r\n ) : (\r\n <>\r\n This color picker is attached to an entity whose color is stored in linear space (ex: PBR Material), and Babylon converts the color to gamma space\r\n before rendering on screen because the human eye is best at processing colors in gamma space. We thus also want to display the color picker in gamma\r\n space so that the color chosen here will match the color seen in your entity.\r\n <br />\r\n If you want to copy/paste the HEX into your code, you can either use\r\n <Body1Strong>Color3.FromHexString(LINEAR_HEX)</Body1Strong>\r\n <br />\r\n or\r\n <br />\r\n <Body1Strong>Color3.FromHexString(GAMMA_HEX).toLinearSpace()</Body1Strong>\r\n <br />\r\n <br />\r\n <Link href=\"https://doc.babylonjs.com/preparingArtForBabylon/controllingColorSpace/\"> Read more in our docs! </Link>\r\n </>\r\n )\r\n }\r\n >\r\n {label}\r\n </InfoLabel>\r\n ) : (\r\n <Label htmlFor={id}>{label}</Label>\r\n )}\r\n <Input\r\n disabled={linearHex ? !isLinearMode : false}\r\n className={styles.input}\r\n value={linearHex ? value.toLinearSpace().toHexString() : value.toHexString()}\r\n id={id}\r\n onChange={handleChange}\r\n />\r\n </div>\r\n );\r\n};\r\n\r\ntype RgbKey = \"r\" | \"g\" | \"b\";\r\ntype InputRgbFieldProps = {\r\n color: Color3 | Color4;\r\n label: string;\r\n rgbKey: RgbKey;\r\n onChange: (color: Color3 | Color4) => void;\r\n};\r\n\r\nconst InputRgbField: FunctionComponent<InputRgbFieldProps> = (props) => {\r\n const { color, onChange, label, rgbKey } = props;\r\n const id = useId(`${label.toLowerCase()}-input`);\r\n const classes = useColorPickerStyles();\r\n\r\n const handleChange = useCallback(\r\n (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const val = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (val === null || Number.isNaN(val) || !NUMBER_REGEX.test(val.toString())) {\r\n return;\r\n }\r\n\r\n const newColor = color.clone();\r\n newColor[rgbKey] = val / 255.0; // Convert to 0-1 range\r\n onChange(newColor);\r\n },\r\n [color]\r\n );\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <Label htmlFor={id}>{label}</Label>\r\n <SpinButton className={classes.spinButton} min={0} max={255} value={color[rgbKey] * 255.0} step={1} id={id} onChange={handleChange} name={rgbKey} />\r\n </div>\r\n );\r\n};\r\n\r\ntype InputHsvFieldProps = {\r\n color: Color3 | Color4;\r\n label: string;\r\n hsvKey: HsvKey;\r\n onChange: (color: Color3 | Color4) => void;\r\n max: number;\r\n scale?: number;\r\n};\r\n\r\n/**\r\n * In the HSV (Hue, Saturation, Value) color model, Hue (H) ranges from 0 to 360 degrees, representing the color's position on the color wheel.\r\n * Saturation (S) ranges from 0 to 100%, indicating the intensity or purity of the color, with 0 being shades of gray and 100 being a fully saturated color.\r\n * Value (V) ranges from 0 to 100%, representing the brightness of the color, with 0 being black and 100 being the brightest.\r\n * @param props - The properties for the InputHsvField component.\r\n */\r\nexport const InputHsvField: FunctionComponent<InputHsvFieldProps> = (props) => {\r\n const { color, label, hsvKey, max, scale = 1 } = props;\r\n\r\n const id = useId(`${label.toLowerCase()}-input`);\r\n const classes = useColorPickerStyles();\r\n\r\n const handleChange = useCallback(\r\n (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const val = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (val === null || Number.isNaN(val) || !NUMBER_REGEX.test(val.toString())) {\r\n return;\r\n }\r\n\r\n // Convert current color to HSV, update the new hsv value, then call onChange prop\r\n const hsv = rgbaToHsv(color);\r\n hsv[hsvKey] = val / scale;\r\n let newColor: Color3 | Color4 = Color3.FromHSV(hsv.h, hsv.s, hsv.v);\r\n if (color instanceof Color4) {\r\n newColor = Color4.FromColor3(newColor, color.a ?? 1);\r\n }\r\n props.onChange(newColor);\r\n },\r\n [color]\r\n );\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <Label htmlFor={id}>{label}</Label>\r\n <SpinButton className={classes.spinButton} min={0} max={max} value={rgbaToHsv(color)[hsvKey] * scale} step={1} id={id} onChange={handleChange} name={hsvKey} />\r\n </div>\r\n );\r\n};\r\n\r\ntype InputAlphaProps = {\r\n color: Color3 | Color4;\r\n onChange: (color: Color4) => void;\r\n};\r\n\r\n/**\r\n * Displays the alpha value of a color, either in the disabled state (if color is Color3) or as a spin button (if color is Color4).\r\n * @param props\r\n * @returns\r\n */\r\nconst InputAlphaField: FunctionComponent<InputAlphaProps> = (props) => {\r\n const classes = useColorPickerStyles();\r\n const id = useId(\"alpha-input\");\r\n const { color } = props;\r\n\r\n const onChange = (_: SpinButtonChangeEvent, data: SpinButtonOnChangeData) => {\r\n const value = data.value ?? parseFloat(data.displayValue ?? \"\");\r\n\r\n if (Number.isNaN(value) || value < 0 || value > 1) {\r\n return;\r\n }\r\n\r\n if (color instanceof Color4) {\r\n const newColor = color.clone();\r\n newColor.a = value;\r\n return newColor;\r\n } else {\r\n return Color4.FromColor3(color, value);\r\n }\r\n };\r\n\r\n return (\r\n <div className={classes.colorFieldWrapper}>\r\n <div className={classes.row}>\r\n <Label htmlFor={id}>Alpha</Label>\r\n {color instanceof Color3 && (\r\n <InfoLabel\r\n htmlFor={id}\r\n info={\r\n <>\r\n Because this color picker is representing a Color3, we do not permit modifying alpha from the color picker. You can however modify the material's\r\n alpha property directly, either in code via material.alpha OR via inspector's transparency section.\r\n </>\r\n }\r\n ></InfoLabel>\r\n )}\r\n </div>\r\n <SpinButton\r\n disabled={color instanceof Color3}\r\n min={0}\r\n max={1}\r\n className={classes.spinButton}\r\n value={color instanceof Color3 ? 1 : color.a}\r\n step={0.01}\r\n onChange={onChange}\r\n id={id}\r\n />\r\n </div>\r\n );\r\n};\r\n\r\nconst NUMBER_REGEX = /^\\d+$/;\r\n\r\nfunction rgbaToHsv(color: { r: number; g: number; b: number; a?: number }): { h: number; s: number; v: number; a?: number } {\r\n const c = new Color3(color.r, color.g, color.b);\r\n const hsv = c.toHSV();\r\n return { h: hsv.r, s: hsv.g, v: hsv.b, a: color.a };\r\n}\r\n"]}
@@ -0,0 +1,8 @@
1
+ export type DraggableLineProps = {
2
+ format: string;
3
+ data: string;
4
+ tooltip: string;
5
+ label: string;
6
+ onDelete?: () => void;
7
+ };
8
+ export declare const DraggableLine: React.FunctionComponent<DraggableLineProps>;
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { makeStyles, tokens } from "@fluentui/react-components";
3
+ import { DeleteFilled } from "@fluentui/react-icons";
4
+ import { LineContainer } from "../hoc/propertyLines/propertyLine.js";
5
+ const useDraggableStyles = makeStyles({
6
+ draggable: {
7
+ display: "inline-flex",
8
+ alignItems: "center",
9
+ columnGap: tokens.spacingHorizontalS,
10
+ cursor: "grab",
11
+ textAlign: "center",
12
+ boxSizing: "border-box",
13
+ borderBottom: "black",
14
+ margin: `${tokens.spacingVerticalXS} 0px`,
15
+ border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,
16
+ // eslint-disable-next-line @typescript-eslint/naming-convention
17
+ ":hover": {
18
+ backgroundColor: tokens.colorBrandBackground2Hover,
19
+ },
20
+ },
21
+ icon: {
22
+ pointerEvents: "auto", // re‑enable interaction
23
+ display: "flex",
24
+ alignItems: "center",
25
+ },
26
+ });
27
+ export const DraggableLine = (props) => {
28
+ const classes = useDraggableStyles();
29
+ return (_jsx("div", { className: classes.draggable, title: props.tooltip, draggable: true, onDragStart: (event) => {
30
+ event.dataTransfer.setData(props.format, props.data);
31
+ }, children: _jsxs(LineContainer, { children: [props.label, props.onDelete && _jsx(DeleteFilled, { className: classes.icon, onClick: props.onDelete })] }) }));
32
+ };
33
+ //# sourceMappingURL=draggable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"draggable.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/draggable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAUlE,MAAM,kBAAkB,GAAG,UAAU,CAAC;IAClC,SAAS,EAAE;QACP,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,QAAQ;QACpB,SAAS,EAAE,MAAM,CAAC,kBAAkB;QACpC,MAAM,EAAE,MAAM;QACd,SAAS,EAAE,QAAQ;QACnB,SAAS,EAAE,YAAY;QACvB,YAAY,EAAE,OAAO;QACrB,MAAM,EAAE,GAAG,MAAM,CAAC,iBAAiB,MAAM;QACzC,MAAM,EAAE,GAAG,MAAM,CAAC,eAAe,UAAU,MAAM,CAAC,mBAAmB,EAAE;QAEvE,gEAAgE;QAChE,QAAQ,EAAE;YACN,eAAe,EAAE,MAAM,CAAC,0BAA0B;SACrD;KACJ;IACD,IAAI,EAAE;QACF,aAAa,EAAE,MAAM,EAAE,wBAAwB;QAC/C,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;KACvB;CACJ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,aAAa,GAAgD,CAAC,KAAK,EAAE,EAAE;IAChF,MAAM,OAAO,GAAG,kBAAkB,EAAE,CAAC;IACrC,OAAO,CACH,cACI,SAAS,EAAE,OAAO,CAAC,SAAS,EAC5B,KAAK,EAAE,KAAK,CAAC,OAAO,EACpB,SAAS,EAAE,IAAI,EACf,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE;YACnB,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC,YAED,MAAC,aAAa,eACT,KAAK,CAAC,KAAK,EACX,KAAK,CAAC,QAAQ,IAAI,KAAC,YAAY,IAAC,SAAS,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,QAAQ,GAAI,IACzE,GACd,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { makeStyles, tokens } from \"@fluentui/react-components\";\r\nimport { DeleteFilled } from \"@fluentui/react-icons\";\r\nimport { LineContainer } from \"../hoc/propertyLines/propertyLine\";\r\n\r\nexport type DraggableLineProps = {\r\n format: string;\r\n data: string;\r\n tooltip: string;\r\n label: string;\r\n onDelete?: () => void;\r\n};\r\n\r\nconst useDraggableStyles = makeStyles({\r\n draggable: {\r\n display: \"inline-flex\",\r\n alignItems: \"center\",\r\n columnGap: tokens.spacingHorizontalS,\r\n cursor: \"grab\",\r\n textAlign: \"center\",\r\n boxSizing: \"border-box\",\r\n borderBottom: \"black\",\r\n margin: `${tokens.spacingVerticalXS} 0px`,\r\n border: `${tokens.strokeWidthThin} solid ${tokens.colorNeutralStroke1}`,\r\n\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n \":hover\": {\r\n backgroundColor: tokens.colorBrandBackground2Hover,\r\n },\r\n },\r\n icon: {\r\n pointerEvents: \"auto\", // re‑enable interaction\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n },\r\n});\r\n\r\nexport const DraggableLine: React.FunctionComponent<DraggableLineProps> = (props) => {\r\n const classes = useDraggableStyles();\r\n return (\r\n <div\r\n className={classes.draggable}\r\n title={props.tooltip}\r\n draggable={true}\r\n onDragStart={(event) => {\r\n event.dataTransfer.setData(props.format, props.data);\r\n }}\r\n >\r\n <LineContainer>\r\n {props.label}\r\n {props.onDelete && <DeleteFilled className={classes.icon} onClick={props.onDelete} />}\r\n </LineContainer>\r\n </div>\r\n );\r\n};\r\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { FunctionComponent } from "react";
2
- import type { BaseComponentProps } from "../hoc/propertyLine.js";
2
+ import type { BaseComponentProps } from "../hoc/propertyLines/propertyLine.js";
3
3
  import type { Nullable } from "@babylonjs/core/types.js";
4
4
  type DropdownOptionValue = string | number;
5
5
  export type AcceptedDropdownValue = Nullable<DropdownOptionValue> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,UAAU,EAAE,MAAM,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AAG,EAAE,IAAI,EAAE,EAAE;YAC1B,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC;YAC5F,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACtB,aAAa,CAAC,KAAK,CAAC,CAAC;gBACrB,MAAM,OAAO,GAAG,KAAK,CAAC,aAAa,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;gBAClE,KAAK,KAAK,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACxF,CAAC;QACL,CAAC,EACD,eAAe,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EACxC,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,UAAU,CAAC,EAAE,KAAK,YAExD,OAAO,CAAC,GAAG,CAAC,CAAC,MAAsB,EAAE,EAAE,CAAC,CACrC,KAAC,MAAM,IAAC,SAAS,EAAE,OAAO,CAAC,WAAW,EAAqB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,YACrG,MAAM,CAAC,KAAK,IAD4B,MAAM,CAAC,KAAK,CAEhD,CACZ,CAAC,GACW,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Dropdown as FluentDropdown, makeStyles, Option } from \"@fluentui/react-components\";\r\nimport { useEffect, useMemo, useState } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLine\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst useDropdownStyles = makeStyles({\r\n dropdownOption: {\r\n textAlign: \"right\",\r\n minWidth: \"40px\",\r\n },\r\n optionsLine: {},\r\n});\r\n\r\ntype DropdownOptionValue = string | number;\r\nexport type AcceptedDropdownValue = Nullable<DropdownOptionValue> | undefined;\r\nexport type DropdownOption = {\r\n /**\r\n * Defines the visible part of the option\r\n */\r\n label: string;\r\n /**\r\n * Defines the value part of the option\r\n */\r\n value: DropdownOptionValue;\r\n};\r\n\r\nexport type DropdownProps<V extends AcceptedDropdownValue> = BaseComponentProps<V> & {\r\n options: readonly DropdownOption[];\r\n\r\n includeNullAs?: \"null\" | \"undefined\"; // If supplied, adds an option with label 'Not Defined' and later sets value either null or undefined\r\n};\r\n\r\n/**\r\n * Renders a fluent UI dropdown component for the options passed in, and an additional 'Not Defined' option if null is set to true\r\n * This component can handle both null and undefined values\r\n * @param props\r\n * @returns dropdown component\r\n */\r\nexport const Dropdown: FunctionComponent<DropdownProps<AcceptedDropdownValue>> = (props) => {\r\n const classes = useDropdownStyles();\r\n // This component can handle both null and undefined values, so '==' null is intentionally used throughout to check for both cases.\r\n const options = useMemo(\r\n () => (props.includeNullAs ? [{ label: \"<Not defined>\", value: Number.MAX_SAFE_INTEGER }, ...props.options] : props.options),\r\n [props.includeNullAs, props.options]\r\n );\r\n const [defaultVal, setDefaultVal] = useState(props.value == null ? Number.MAX_SAFE_INTEGER : props.value);\r\n useEffect(() => {\r\n setDefaultVal(props.value == null ? Number.MAX_SAFE_INTEGER : props.value);\r\n }, [props.value]);\r\n\r\n return (\r\n <FluentDropdown\r\n size=\"small\"\r\n className={classes.dropdownOption}\r\n onOptionSelect={(evt, data) => {\r\n const value = typeof props.value === \"number\" ? Number(data.optionValue) : data.optionValue;\r\n if (value !== undefined) {\r\n setDefaultVal(value);\r\n const nullVal = props.includeNullAs === \"null\" ? null : undefined;\r\n value === Number.MAX_SAFE_INTEGER ? props.onChange(nullVal) : props.onChange(value);\r\n }\r\n }}\r\n selectedOptions={[defaultVal.toString()]}\r\n value={options.find((o) => o.value === defaultVal)?.label}\r\n >\r\n {options.map((option: DropdownOption) => (\r\n <Option className={classes.optionsLine} key={option.label} value={option.value.toString()} disabled={false}>\r\n {option.label}\r\n </Option>\r\n ))}\r\n </FluentDropdown>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/dropdown.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,IAAI,cAAc,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAC5F,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAKrD,MAAM,iBAAiB,GAAG,UAAU,CAAC;IACjC,cAAc,EAAE;QACZ,SAAS,EAAE,OAAO;QAClB,QAAQ,EAAE,MAAM;KACnB;IACD,WAAW,EAAE,EAAE;CAClB,CAAC,CAAC;AAqBH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAA4D,CAAC,KAAK,EAAE,EAAE;IACvF,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAC;IACpC,mIAAmI;IACnI,MAAM,OAAO,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,gBAAgB,EAAE,EAAE,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,EAC5H,CAAC,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,OAAO,CAAC,CACvC,CAAC;IACF,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC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,EAAE,EAAE,QAAQ,EAAE,KAAK,YACrG,MAAM,CAAC,KAAK,IAD4B,MAAM,CAAC,KAAK,CAEhD,CACZ,CAAC,GACW,CACpB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { Dropdown as FluentDropdown, makeStyles, Option } from \"@fluentui/react-components\";\r\nimport { useEffect, useMemo, useState } from \"react\";\r\nimport type { FunctionComponent } from \"react\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLines/propertyLine\";\r\nimport type { Nullable } from \"core/types\";\r\n\r\nconst useDropdownStyles = makeStyles({\r\n dropdownOption: {\r\n textAlign: \"right\",\r\n minWidth: \"40px\",\r\n },\r\n optionsLine: {},\r\n});\r\n\r\ntype DropdownOptionValue = string | number;\r\nexport type AcceptedDropdownValue = Nullable<DropdownOptionValue> | undefined;\r\nexport type DropdownOption = {\r\n /**\r\n * Defines the visible part of the option\r\n */\r\n label: string;\r\n /**\r\n * Defines the value part of the option\r\n */\r\n value: DropdownOptionValue;\r\n};\r\n\r\nexport type DropdownProps<V extends AcceptedDropdownValue> = BaseComponentProps<V> & {\r\n options: readonly DropdownOption[];\r\n\r\n includeNullAs?: \"null\" | \"undefined\"; // If supplied, adds an option with label 'Not Defined' and later sets value either null or undefined\r\n};\r\n\r\n/**\r\n * Renders a fluent UI dropdown component for the options passed in, and an additional 'Not Defined' option if null is set to true\r\n * This component can handle both null and undefined values\r\n * @param props\r\n * @returns dropdown component\r\n */\r\nexport const Dropdown: FunctionComponent<DropdownProps<AcceptedDropdownValue>> = (props) => {\r\n const classes = useDropdownStyles();\r\n // This component can handle both null and undefined values, so '==' null is intentionally used throughout to check for both cases.\r\n const options = useMemo(\r\n () => (props.includeNullAs ? [{ label: \"<Not defined>\", value: Number.MAX_SAFE_INTEGER }, ...props.options] : props.options),\r\n [props.includeNullAs, props.options]\r\n );\r\n const [defaultVal, setDefaultVal] = useState(props.value == null ? Number.MAX_SAFE_INTEGER : props.value);\r\n useEffect(() => {\r\n setDefaultVal(props.value == null ? Number.MAX_SAFE_INTEGER : props.value);\r\n }, [props.value]);\r\n\r\n return (\r\n <FluentDropdown\r\n size=\"small\"\r\n className={classes.dropdownOption}\r\n onOptionSelect={(evt, data) => {\r\n const value = typeof props.value === \"number\" ? Number(data.optionValue) : data.optionValue;\r\n if (value !== undefined) {\r\n setDefaultVal(value);\r\n const nullVal = props.includeNullAs === \"null\" ? null : undefined;\r\n value === Number.MAX_SAFE_INTEGER ? props.onChange(nullVal) : props.onChange(value);\r\n }\r\n }}\r\n selectedOptions={[defaultVal.toString()]}\r\n value={options.find((o) => o.value === defaultVal)?.label}\r\n >\r\n {options.map((option: DropdownOption) => (\r\n <Option className={classes.optionsLine} key={option.label} value={option.value.toString()} disabled={false}>\r\n {option.label}\r\n </Option>\r\n ))}\r\n </FluentDropdown>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,28 @@
1
+ import type { FunctionComponent } from "react";
2
+ import type { BaseComponentProps } from "../hoc/propertyLines/propertyLine.js";
3
+ import { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from "@babylonjs/core/Misc/gradients.js";
4
+ import { GradientBlockColorStep } from "@babylonjs/core/Materials/Node/Blocks/gradientBlock.js";
5
+ /**
6
+ * Component wrapper for FactorGradient that provides slider inputs for factor1, factor2, and gradient step
7
+ * @param props - Component props containing FactorGradient value and change handler
8
+ * @returns A React component
9
+ */
10
+ export declare const FactorGradientComponent: FunctionComponent<BaseComponentProps<FactorGradient>>;
11
+ /**
12
+ * Component wrapper for Color3Gradient that provides color picker and gradient step slider
13
+ * @param props - Component props containing Color3Gradient value and change handler
14
+ * @returns A React component
15
+ */
16
+ export declare const Color3GradientComponent: FunctionComponent<BaseComponentProps<Color3Gradient>>;
17
+ /**
18
+ * Component wrapper for Color4Gradient that provides color pickers for color1, color2, and gradient step slider
19
+ * @param props - Component props containing Color4Gradient value and change handler
20
+ * @returns A React component
21
+ */
22
+ export declare const Color4GradientComponent: FunctionComponent<BaseComponentProps<Color4Gradient>>;
23
+ /**
24
+ * Component wrapper for GradientBlockColorStep that provides color picker and step slider
25
+ * @param props - Component props containing GradientBlockColorStep value and change handler
26
+ * @returns A React component
27
+ */
28
+ export declare const ColorStepGradientComponent: FunctionComponent<BaseComponentProps<GradientBlockColorStep>>;
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { makeStyles, tokens } from "@fluentui/react-components";
4
+ import { SyncedSliderInput } from "./syncedSlider.js";
5
+ import { Color3, Color4 } from "@babylonjs/core/Maths/math.color.js";
6
+ import { ColorPickerPopup } from "./colorPicker.js";
7
+ import { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from "@babylonjs/core/Misc/gradients.js";
8
+ import { GradientBlockColorStep } from "@babylonjs/core/Materials/Node/Blocks/gradientBlock.js";
9
+ const useGradientStyles = makeStyles({
10
+ container: {
11
+ display: "flex",
12
+ alignItems: "center",
13
+ gap: tokens.spacingHorizontalS,
14
+ width: "100%",
15
+ },
16
+ // Wrapper for each slider to control its size
17
+ valueWrapper: {
18
+ flex: "0 1 auto", // Don't grow, can shrink, size based on content
19
+ alignContent: "center",
20
+ minWidth: "80px", // Minimum width to keep usable
21
+ maxWidth: "100px", // Maximum width to prevent them from getting too wide
22
+ },
23
+ // Wrapper for color pickers - much smaller since they're just swatches
24
+ colorWrapper: {
25
+ alignContent: "center",
26
+ // No flex properties - just take natural size
27
+ },
28
+ // Wrapper for the step slider to take remaining space
29
+ stepSliderWrapper: {
30
+ flex: "1 0 auto", // Can grow, don't shrink, size based on content
31
+ minWidth: "100px",
32
+ },
33
+ });
34
+ /**
35
+ * Gradient component that displays 1 or 2 color or number inputs next to a slider
36
+ * @param props - Component props containing gradient value and change handlers
37
+ * @returns A React component
38
+ */
39
+ const Gradient = (props) => {
40
+ const [gradient, setGradient] = useState(props.value);
41
+ const classes = useGradientStyles();
42
+ useEffect(() => {
43
+ setGradient(props.value); // Re-render if props.value changes
44
+ }, [props.value]);
45
+ const gradientChange = (newGradient) => {
46
+ setGradient(newGradient);
47
+ props.onChange(newGradient);
48
+ };
49
+ return (_jsxs("div", { id: "gradientContainer", className: classes.container, children: [_jsx("div", { className: gradient.value1 instanceof Color3 || gradient.value1 instanceof Color4 ? classes.colorWrapper : classes.valueWrapper, children: gradient.value1 instanceof Color3 || gradient.value1 instanceof Color4 ? (_jsx(ColorPickerPopup, { value: gradient.value1, onChange: (color) => gradientChange({ ...gradient, value1: color }) })) : (_jsx(SyncedSliderInput, { step: 0.01, value: gradient.value1, onChange: (val) => gradientChange({ ...gradient, value1: val }) })) }), gradient.value2 !== undefined && (_jsx("div", { className: gradient.value2 instanceof Color3 || gradient.value2 instanceof Color4 ? classes.colorWrapper : classes.valueWrapper, children: gradient.value2 instanceof Color3 || gradient.value2 instanceof Color4 ? (_jsx(ColorPickerPopup, { value: gradient.value2, onChange: (color) => gradientChange({ ...gradient, value2: color }) })) : (_jsx(SyncedSliderInput, { step: 0.01, value: gradient.value2, onChange: (val) => gradientChange({ ...gradient, value2: val }) })) })), _jsx("div", { className: classes.stepSliderWrapper, children: _jsx(SyncedSliderInput, { notifyOnlyOnRelease: true, min: 0, max: 1, step: 0.01, value: gradient.step, onChange: (val) => gradientChange({ ...gradient, step: val }) }) })] }));
50
+ };
51
+ const FactorGradientCast = Gradient;
52
+ const Color3GradientCast = Gradient;
53
+ const Color4GradientCast = Gradient;
54
+ /**
55
+ * Component wrapper for FactorGradient that provides slider inputs for factor1, factor2, and gradient step
56
+ * @param props - Component props containing FactorGradient value and change handler
57
+ * @returns A React component
58
+ */
59
+ export const FactorGradientComponent = (props) => {
60
+ return (_jsx(FactorGradientCast, { ...props, value: { value1: props.value.factor1, value2: props.value.factor2, step: props.value.gradient }, onChange: (gradient) => props.onChange(new FactorGradient(gradient.step, gradient.value1, gradient.value2)) }));
61
+ };
62
+ /**
63
+ * Component wrapper for Color3Gradient that provides color picker and gradient step slider
64
+ * @param props - Component props containing Color3Gradient value and change handler
65
+ * @returns A React component
66
+ */
67
+ export const Color3GradientComponent = (props) => {
68
+ return (_jsx(Color3GradientCast, { ...props, value: { value1: props.value.color, step: props.value.gradient }, onChange: (gradient) => props.onChange(new Color3Gradient(gradient.step, gradient.value1)) }));
69
+ };
70
+ /**
71
+ * Component wrapper for Color4Gradient that provides color pickers for color1, color2, and gradient step slider
72
+ * @param props - Component props containing Color4Gradient value and change handler
73
+ * @returns A React component
74
+ */
75
+ export const Color4GradientComponent = (props) => {
76
+ return (_jsx(Color4GradientCast, { ...props, value: { value1: props.value.color1, value2: props.value.color2, step: props.value.gradient }, onChange: (gradient) => props.onChange(new Color4Gradient(gradient.step, gradient.value1, gradient.value2)) }));
77
+ };
78
+ /**
79
+ * Component wrapper for GradientBlockColorStep that provides color picker and step slider
80
+ * @param props - Component props containing GradientBlockColorStep value and change handler
81
+ * @returns A React component
82
+ */
83
+ export const ColorStepGradientComponent = (props) => {
84
+ return (_jsx(Color3GradientCast, { ...props, value: { value1: props.value.color, step: props.value.step }, onChange: (gradient) => props.onChange(new GradientBlockColorStep(gradient.step, gradient.value1)) }));
85
+ };
86
+ //# sourceMappingURL=gradient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradient.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/fluent/primitives/gradient.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,4CAA8B;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,aAAa,IAAI,cAAc,EAAE,cAAc,EAAE,0CAA4B;AACtG,OAAO,EAAE,sBAAsB,EAAE,+DAAiD;A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"react\";\r\nimport { makeStyles, tokens } from \"@fluentui/react-components\";\r\n\r\nimport { SyncedSliderInput } from \"./syncedSlider\";\r\nimport { Color3, Color4 } from \"core/Maths/math.color\";\r\nimport { ColorPickerPopup } from \"./colorPicker\";\r\nimport type { BaseComponentProps } from \"../hoc/propertyLines/propertyLine\";\r\nimport { Color3Gradient, ColorGradient as Color4Gradient, FactorGradient } from \"core/Misc/gradients\";\r\nimport { GradientBlockColorStep } from \"core/Materials/Node/Blocks/gradientBlock\";\r\n\r\nconst useGradientStyles = makeStyles({\r\n container: {\r\n display: \"flex\",\r\n alignItems: \"center\",\r\n gap: tokens.spacingHorizontalS,\r\n width: \"100%\",\r\n },\r\n // Wrapper for each slider to control its size\r\n valueWrapper: {\r\n flex: \"0 1 auto\", // Don't grow, can shrink, size based on content\r\n alignContent: \"center\",\r\n minWidth: \"80px\", // Minimum width to keep usable\r\n maxWidth: \"100px\", // Maximum width to prevent them from getting too wide\r\n },\r\n // Wrapper for color pickers - much smaller since they're just swatches\r\n colorWrapper: {\r\n alignContent: \"center\",\r\n // No flex properties - just take natural size\r\n },\r\n // Wrapper for the step slider to take remaining space\r\n stepSliderWrapper: {\r\n flex: \"1 0 auto\", // Can grow, don't shrink, size based on content\r\n minWidth: \"100px\",\r\n },\r\n});\r\n\r\ntype GradientProps<T extends number | Color3 | Color4> = {\r\n value1: T;\r\n value2?: T;\r\n step: number;\r\n};\r\n\r\n/**\r\n * Gradient component that displays 1 or 2 color or number inputs next to a slider\r\n * @param props - Component props containing gradient value and change handlers\r\n * @returns A React component\r\n */\r\nconst Gradient: FunctionComponent<BaseComponentProps<GradientProps<number | Color3 | Color4>>> = (props) => {\r\n const [gradient, setGradient] = useState(props.value);\r\n const classes = useGradientStyles();\r\n\r\n useEffect(() => {\r\n setGradient(props.value); // Re-render if props.value changes\r\n }, [props.value]);\r\n\r\n const gradientChange = (newGradient: GradientProps<number | Color3 | Color4>) => {\r\n setGradient(newGradient);\r\n props.onChange(newGradient);\r\n };\r\n return (\r\n <div id=\"gradientContainer\" className={classes.container}>\r\n <div className={gradient.value1 instanceof Color3 || gradient.value1 instanceof Color4 ? classes.colorWrapper : classes.valueWrapper}>\r\n {gradient.value1 instanceof Color3 || gradient.value1 instanceof Color4 ? (\r\n <ColorPickerPopup value={gradient.value1} onChange={(color) => gradientChange({ ...gradient, value1: color })} />\r\n ) : (\r\n <SyncedSliderInput step={0.01} value={gradient.value1} onChange={(val) => gradientChange({ ...gradient, value1: val })} />\r\n )}\r\n </div>\r\n {gradient.value2 !== undefined && (\r\n <div className={gradient.value2 instanceof Color3 || gradient.value2 instanceof Color4 ? classes.colorWrapper : classes.valueWrapper}>\r\n {gradient.value2 instanceof Color3 || gradient.value2 instanceof Color4 ? (\r\n <ColorPickerPopup value={gradient.value2} onChange={(color) => gradientChange({ ...gradient, value2: color })} />\r\n ) : (\r\n <SyncedSliderInput step={0.01} value={gradient.value2} onChange={(val) => gradientChange({ ...gradient, value2: val })} />\r\n )}\r\n </div>\r\n )}\r\n\r\n <div className={classes.stepSliderWrapper}>\r\n <SyncedSliderInput notifyOnlyOnRelease={true} min={0} max={1} step={0.01} value={gradient.step} onChange={(val) => gradientChange({ ...gradient, step: val })} />\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nconst FactorGradientCast = Gradient as FunctionComponent<BaseComponentProps<GradientProps<number>>>;\r\nconst Color3GradientCast = Gradient as FunctionComponent<BaseComponentProps<GradientProps<Color3>>>;\r\nconst Color4GradientCast = Gradient as FunctionComponent<BaseComponentProps<GradientProps<Color4>>>;\r\n\r\n/**\r\n * Component wrapper for FactorGradient that provides slider inputs for factor1, factor2, and gradient step\r\n * @param props - Component props containing FactorGradient value and change handler\r\n * @returns A React component\r\n */\r\nexport const FactorGradientComponent: FunctionComponent<BaseComponentProps<FactorGradient>> = (props) => {\r\n return (\r\n <FactorGradientCast\r\n {...props}\r\n value={{ value1: props.value.factor1, value2: props.value.factor2, step: props.value.gradient }}\r\n onChange={(gradient) => props.onChange(new FactorGradient(gradient.step, gradient.value1, gradient.value2))}\r\n />\r\n );\r\n};\r\n/**\r\n * Component wrapper for Color3Gradient that provides color picker and gradient step slider\r\n * @param props - Component props containing Color3Gradient value and change handler\r\n * @returns A React component\r\n */\r\nexport const Color3GradientComponent: FunctionComponent<BaseComponentProps<Color3Gradient>> = (props) => {\r\n return (\r\n <Color3GradientCast\r\n {...props}\r\n value={{ value1: props.value.color, step: props.value.gradient }}\r\n onChange={(gradient) => props.onChange(new Color3Gradient(gradient.step, gradient.value1))}\r\n />\r\n );\r\n};\r\n/**\r\n * Component wrapper for Color4Gradient that provides color pickers for color1, color2, and gradient step slider\r\n * @param props - Component props containing Color4Gradient value and change handler\r\n * @returns A React component\r\n */\r\nexport const Color4GradientComponent: FunctionComponent<BaseComponentProps<Color4Gradient>> = (props) => {\r\n return (\r\n <Color4GradientCast\r\n {...props}\r\n value={{ value1: props.value.color1, value2: props.value.color2, step: props.value.gradient }}\r\n onChange={(gradient) => props.onChange(new Color4Gradient(gradient.step, gradient.value1, gradient.value2))}\r\n />\r\n );\r\n};\r\n/**\r\n * Component wrapper for GradientBlockColorStep that provides color picker and step slider\r\n * @param props - Component props containing GradientBlockColorStep value and change handler\r\n * @returns A React component\r\n */\r\nexport const ColorStepGradientComponent: FunctionComponent<BaseComponentProps<GradientBlockColorStep>> = (props) => {\r\n return (\r\n <Color3GradientCast\r\n {...props}\r\n value={{ value1: props.value.color, step: props.value.step }}\r\n onChange={(gradient) => props.onChange(new GradientBlockColorStep(gradient.step, gradient.value1))}\r\n />\r\n );\r\n};\r\n"]}
@@ -1,14 +1,10 @@
1
1
  import type { FunctionComponent } from "react";
2
- import type { BaseComponentProps } from "../hoc/propertyLine.js";
2
+ import type { BaseComponentProps } from "../hoc/propertyLines/propertyLine.js";
3
3
  export type InputProps<T extends string | number> = BaseComponentProps<T> & {
4
4
  step?: number;
5
5
  placeholder?: string;
6
6
  min?: number;
7
7
  max?: number;
8
8
  };
9
- /**
10
- * This is an input text box that stops propagation of change events and sets its width based on the type of input (text or number)
11
- * @param props
12
- * @returns
13
- */
14
- export declare const Input: FunctionComponent<InputProps<string | number>>;
9
+ export declare const NumberInput: FunctionComponent<InputProps<number>>;
10
+ export declare const TextInput: FunctionComponent<InputProps<string>>;