@babylonjs/shared-ui-components 5.31.2 → 5.32.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 (40) hide show
  1. package/components/Button.d.ts +2 -1
  2. package/components/Button.js +2 -2
  3. package/components/Button.js.map +1 -1
  4. package/components/Button.modules.scss +5 -0
  5. package/components/Icon.js +1 -1
  6. package/components/Icon.js.map +1 -1
  7. package/components/TextInputWithSubmit.d.ts +12 -0
  8. package/components/TextInputWithSubmit.js +31 -0
  9. package/components/TextInputWithSubmit.js.map +1 -0
  10. package/components/TextInputWithSubmit.modules.scss +22 -0
  11. package/components/lines/OptionsLineComponent.d.ts +20 -0
  12. package/components/lines/OptionsLineComponent.js +39 -0
  13. package/components/lines/OptionsLineComponent.js.map +1 -0
  14. package/components/lines/OptionsLineComponent.modules.scss +12 -0
  15. package/lines/lineContainerComponent.js +3 -0
  16. package/lines/lineContainerComponent.js.map +1 -1
  17. package/lines/optionsLineComponent.d.ts +0 -11
  18. package/lines/optionsLineComponent.js +8 -56
  19. package/lines/optionsLineComponent.js.map +1 -1
  20. package/package.json +1 -1
  21. package/stories/bars/CommandBarComponent.stories.d.ts +4 -6
  22. package/stories/bars/CommandBarComponent.stories.js.map +1 -1
  23. package/stories/bars/CommandButtonComponent.stories.d.ts +3 -1
  24. package/stories/bars/CommandButtonComponent.stories.js.map +1 -1
  25. package/stories/colorPicker/ColorPicker.stories.d.ts +2 -6
  26. package/stories/colorPicker/ColorPicker.stories.js.map +1 -1
  27. package/stories/layout/FlexibleGridLayout.stories.d.ts +4 -40
  28. package/stories/layout/FlexibleGridLayout.stories.js +6 -6
  29. package/stories/layout/FlexibleGridLayout.stories.js.map +1 -1
  30. package/stories/lines/ColorLineComponent.stories.d.ts +2 -16
  31. package/stories/lines/ColorLineComponent.stories.js.map +1 -1
  32. package/stories/lines/ColorPickerLineComponent.stories.d.ts +2 -9
  33. package/stories/lines/ColorPickerLineComponent.stories.js.map +1 -1
  34. package/stories/lines/FileButtonLineComponent.stories.d.ts +2 -1
  35. package/stories/lines/FileButtonLineComponent.stories.js.map +1 -1
  36. package/stories/lines/NumericInputComponent.stories.d.ts +2 -6
  37. package/stories/lines/NumericInputComponent.stories.js.map +1 -1
  38. package/stories/lines/OptionsLineComponent.stories.d.ts +10 -0
  39. package/stories/lines/OptionsLineComponent.stories.js +37 -0
  40. package/stories/lines/OptionsLineComponent.stories.js.map +1 -0
@@ -4,7 +4,8 @@ export declare type ButtonProps = {
4
4
  active?: boolean;
5
5
  onClick?: () => void;
6
6
  color: "light" | "dark";
7
- size: "default" | "small" | "wide";
7
+ size: "default" | "small" | "wide" | "smaller";
8
8
  title?: string;
9
+ backgroundColor?: string;
9
10
  };
10
11
  export declare const Button: React.FC<ButtonProps>;
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import styles from "./Button.modules.scss";
3
3
  import { ClassNames } from "./classNames.js";
4
- export const Button = ({ disabled, active, onClick, children, color, size, title }) => {
5
- return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, children: children }));
4
+ export const Button = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {
5
+ return (_jsx("button", { className: ClassNames({ button: true, active, wide: size === "wide", small: size === "small", smaller: size === "smaller", light: color === "light", dark: color === "dark" }, styles), disabled: disabled, onClick: onClick, title: title, style: { backgroundColor }, children: children }));
6
6
  };
7
7
  //# sourceMappingURL=Button.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW1C,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE;IACzG,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EAAE,MAAM,CAAC,EACzJ,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,YAEX,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import styles from \"./Button.modules.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport type ButtonProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\";\r\n title?: string;\r\n};\r\n\r\nexport const Button: React.FC<ButtonProps> = ({ disabled, active, onClick, children, color, size, title }) => {\r\n return (\r\n <button\r\n className={ClassNames({ button: true, active, wide: size === \"wide\", small: size === \"small\", light: color === \"light\", dark: color === \"dark\" }, styles)}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
1
+ {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,MAAM,MAAM,uBAAuB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAY1C,MAAM,CAAC,MAAM,MAAM,GAA0B,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE;IAC1H,OAAO,CACH,iBACI,SAAS,EAAE,UAAU,CACjB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,KAAK,OAAO,EAAE,OAAO,EAAE,IAAI,KAAK,SAAS,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,MAAM,EAAE,EACvJ,MAAM,CACT,EACD,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,EAAE,eAAe,EAAE,YAEzB,QAAQ,GACJ,CACZ,CAAC;AACN,CAAC,CAAC","sourcesContent":["import styles from \"./Button.modules.scss\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport type ButtonProps = {\r\n disabled?: boolean;\r\n active?: boolean;\r\n onClick?: () => void;\r\n color: \"light\" | \"dark\";\r\n size: \"default\" | \"small\" | \"wide\" | \"smaller\";\r\n title?: string;\r\n backgroundColor?: string;\r\n};\r\n\r\nexport const Button: React.FC<ButtonProps> = ({ disabled, active, onClick, children, color, size, title, backgroundColor }) => {\r\n return (\r\n <button\r\n className={ClassNames(\r\n { button: true, active, wide: size === \"wide\", small: size === \"small\", smaller: size === \"smaller\", light: color === \"light\", dark: color === \"dark\" },\r\n styles\r\n )}\r\n disabled={disabled}\r\n onClick={onClick}\r\n title={title}\r\n style={{ backgroundColor }}\r\n >\r\n {children}\r\n </button>\r\n );\r\n};\r\n"]}
@@ -7,6 +7,7 @@
7
7
  display: inline-flex;
8
8
  align-items: center;
9
9
  justify-content: center;
10
+ padding: 0 0;
10
11
  &.wide {
11
12
  width: 120px;
12
13
  height: 45px;
@@ -16,6 +17,10 @@
16
17
  width: 30px;
17
18
  height: 30px;
18
19
  }
20
+ &.smaller {
21
+ width: 25px;
22
+ height: 25px;
23
+ }
19
24
  &.light {
20
25
  background-color: light-background;
21
26
  color: dark-color;
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { ClassNames } from "./classNames.js";
3
3
  import styles from "./Icon.modules.scss";
4
4
  export const Icon = ({ color = "dark", icon }) => {
5
- return _jsx("img", { src: icon, style: { width: "30px", height: "30px" }, className: ClassNames({ light: color === "light" }, styles) });
5
+ return _jsx("img", { src: icon, style: { width: "100%", height: "100%" }, className: ClassNames({ light: color === "light" }, styles) });
6
6
  };
7
7
  //# sourceMappingURL=Icon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAOzC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAClE,OAAO,cAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,EAAE,MAAM,CAAC,GAAI,CAAC;AACrI,CAAC,CAAC","sourcesContent":["import { ClassNames } from \"./classNames\";\r\nimport styles from \"./Icon.modules.scss\";\r\n\r\nexport type IconProps = {\r\n color?: \"dark\" | \"light\";\r\n icon: string;\r\n};\r\n\r\nexport const Icon: React.FC<IconProps> = ({ color = \"dark\", icon }) => {\r\n return <img src={icon} style={{ width: \"30px\", height: \"30px\" }} className={ClassNames({ light: color === \"light\" }, styles)} />;\r\n};\r\n"]}
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAOzC,MAAM,CAAC,MAAM,IAAI,GAAwB,CAAC,EAAE,KAAK,GAAG,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE;IAClE,OAAO,cAAK,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,KAAK,OAAO,EAAE,EAAE,MAAM,CAAC,GAAI,CAAC;AACrI,CAAC,CAAC","sourcesContent":["import { ClassNames } from \"./classNames\";\r\nimport styles from \"./Icon.modules.scss\";\r\n\r\nexport type IconProps = {\r\n color?: \"dark\" | \"light\";\r\n icon: string;\r\n};\r\n\r\nexport const Icon: React.FC<IconProps> = ({ color = \"dark\", icon }) => {\r\n return <img src={icon} style={{ width: \"100%\", height: \"100%\" }} className={ClassNames({ light: color === \"light\" }, styles)} />;\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ /// <reference types="react" />
2
+ export interface ITextInputProps {
3
+ label?: string;
4
+ placeholder?: string;
5
+ submitValue: (newValue: string) => void;
6
+ validateValue?: (value: string) => boolean;
7
+ cancelSubmit?: () => void;
8
+ }
9
+ /**
10
+ * This component represents a text input that can be submitted or cancelled on buttons
11
+ */
12
+ export declare const TextInputWithSubmit: (props: ITextInputProps) => JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { Button } from "./Button.js";
4
+ import { Icon } from "./Icon.js";
5
+ import style from "./TextInputWithSubmit.modules.scss";
6
+ import submitIcon from "../imgs/confirmGridElementDark.svg";
7
+ import cancelIcon from "../imgs/deleteGridElementDark.svg";
8
+ import { ClassNames } from "./classNames.js";
9
+ /**
10
+ * This component represents a text input that can be submitted or cancelled on buttons
11
+ */
12
+ export const TextInputWithSubmit = (props) => {
13
+ const [value, setValue] = useState("");
14
+ const [valid, setValid] = useState(props.validateValue ? props.validateValue(value) : true);
15
+ useEffect(() => {
16
+ setValid(props.validateValue ? props.validateValue(value) : true);
17
+ }, [value]);
18
+ const onChange = (event) => {
19
+ setValue(event.target.value);
20
+ };
21
+ const onClickSubmit = () => {
22
+ props.submitValue(value);
23
+ };
24
+ const onClickCancel = () => {
25
+ var _a;
26
+ (_a = props.cancelSubmit) === null || _a === void 0 ? void 0 : _a.call(props);
27
+ setValue("");
28
+ };
29
+ return (_jsxs("div", { className: ClassNames({ line: true, valid, invalid: !valid }, style), children: [props.label && _jsx("label", { children: props.label }), _jsx("input", { className: style.input, type: "text", placeholder: props.placeholder, value: value, onChange: onChange }), _jsxs("div", { children: [_jsx(Button, { color: "light", size: "smaller", backgroundColor: "inherit", onClick: onClickSubmit, disabled: !valid, children: _jsx(Icon, { icon: submitIcon, color: "dark" }) }), _jsx(Button, { color: "light", size: "smaller", backgroundColor: "inherit", onClick: onClickCancel, children: _jsx(Icon, { icon: cancelIcon, color: "dark" }) })] })] }));
30
+ };
31
+ //# sourceMappingURL=TextInputWithSubmit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextInputWithSubmit.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/components/TextInputWithSubmit.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,MAAM,oCAAoC,CAAC;AAEvD,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAC5D,OAAO,UAAU,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU1C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAsB,EAAE,EAAE;IAC1D,MAAM,CAAC,KAAK,E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SAAS,EAAC,eAAe,EAAC,SAAS,EAAC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,KAAK,YACnG,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,GAAQ,GACvC,EACT,KAAC,MAAM,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,EAAC,SAAS,EAAC,eAAe,EAAC,SAAS,EAAC,OAAO,EAAE,aAAa,YACjF,KAAC,IAAI,IAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,GAAQ,GACvC,IACP,IACJ,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from \"react\";\r\nimport { Button } from \"./Button\";\r\nimport { Icon } from \"./Icon\";\r\nimport style from \"./TextInputWithSubmit.modules.scss\";\r\n\r\nimport submitIcon from \"../imgs/confirmGridElementDark.svg\";\r\nimport cancelIcon from \"../imgs/deleteGridElementDark.svg\";\r\nimport { ClassNames } from \"./classNames\";\r\n\r\nexport interface ITextInputProps {\r\n label?: string;\r\n placeholder?: string;\r\n submitValue: (newValue: string) => void; // Function to call when the value is updated\r\n validateValue?: (value: string) => boolean; // Function to call to validate the value\r\n cancelSubmit?: () => void; // Function to call when the user cancels the submit\r\n}\r\n\r\n/**\r\n * This component represents a text input that can be submitted or cancelled on buttons\r\n */\r\nexport const TextInputWithSubmit = (props: ITextInputProps) => {\r\n const [value, setValue] = useState(\"\");\r\n const [valid, setValid] = useState(props.validateValue ? props.validateValue(value) : true);\r\n\r\n useEffect(() => {\r\n setValid(props.validateValue ? props.validateValue(value) : true);\r\n }, [value]);\r\n\r\n const onChange = (event: React.ChangeEvent<HTMLInputElement>) => {\r\n setValue(event.target.value);\r\n };\r\n\r\n const onClickSubmit = () => {\r\n props.submitValue(value);\r\n };\r\n\r\n const onClickCancel = () => {\r\n props.cancelSubmit?.();\r\n setValue(\"\");\r\n };\r\n\r\n return (\r\n <div className={ClassNames({ line: true, valid, invalid: !valid }, style)}>\r\n {props.label && <label>{props.label}</label>}\r\n <input className={style.input} type=\"text\" placeholder={props.placeholder} value={value} onChange={onChange} />\r\n <div>\r\n <Button color=\"light\" size=\"smaller\" backgroundColor=\"inherit\" onClick={onClickSubmit} disabled={!valid}>\r\n <Icon icon={submitIcon} color=\"dark\"></Icon>\r\n </Button>\r\n <Button color=\"light\" size=\"smaller\" backgroundColor=\"inherit\" onClick={onClickCancel}>\r\n <Icon icon={cancelIcon} color=\"dark\"></Icon>\r\n </Button>\r\n </div>\r\n </div>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,22 @@
1
+ .line {
2
+ width: 100%;
3
+ height: 100%;
4
+ display: flex;
5
+ justify-content: space-between;
6
+ align-items: center;
7
+ }
8
+
9
+ .input {
10
+ border: unset;
11
+ background-color: inherit;
12
+ flex-grow: 1;
13
+ width: 100px;
14
+ }
15
+
16
+ .valid {
17
+ background-color: white;
18
+ }
19
+
20
+ .invalid {
21
+ background-color: rgba(255, 204, 204, 0.8);
22
+ }
@@ -0,0 +1,20 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * This components represents an options menu with optional
4
+ * customizable properties. Option IDs should be unique.
5
+ */
6
+ export interface IOption {
7
+ label: string;
8
+ value: string;
9
+ id: string;
10
+ }
11
+ export interface IOptionsLineComponentProps {
12
+ options: IOption[];
13
+ addOptionPlaceholder?: string;
14
+ onOptionAdded?: (newOption: IOption) => void;
15
+ onOptionSelected: (selectedOptionValue: string) => void;
16
+ selectedOptionValue: string;
17
+ validateNewOptionValue?: (newOptionValue: string) => boolean;
18
+ addOptionText?: string;
19
+ }
20
+ export declare const OptionsLineComponent: (props: IOptionsLineComponentProps) => JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { TextInputWithSubmit } from "../TextInputWithSubmit.js";
4
+ import style from "./OptionsLineComponent.modules.scss";
5
+ /**
6
+ * We have two possible states. The user starts in the Default option, and can choose to
7
+ * add a new option.
8
+ */
9
+ var OptionStates;
10
+ (function (OptionStates) {
11
+ OptionStates[OptionStates["Default"] = 0] = "Default";
12
+ OptionStates[OptionStates["Adding"] = 1] = "Adding";
13
+ })(OptionStates || (OptionStates = {}));
14
+ const _OptionAddKey = "addCustomOption";
15
+ export const OptionsLineComponent = (props) => {
16
+ var _a;
17
+ const [optionState, setOptionState] = useState(OptionStates.Default); // State of the component
18
+ const onOptionChange = (evt) => {
19
+ if (evt.target.value === _OptionAddKey) {
20
+ setOptionState(OptionStates.Adding);
21
+ }
22
+ else {
23
+ props.onOptionSelected(evt.target.value);
24
+ }
25
+ };
26
+ const onOptionAdd = (value) => {
27
+ var _a;
28
+ const newOptionText = value;
29
+ const newOption = { label: newOptionText, value: newOptionText, id: Date.now().toString() };
30
+ (_a = props.onOptionAdded) === null || _a === void 0 ? void 0 : _a.call(props, newOption);
31
+ props.onOptionSelected(newOption.value);
32
+ setOptionState(OptionStates.Default);
33
+ };
34
+ const onCancelOptionAdd = () => {
35
+ setOptionState(OptionStates.Default);
36
+ };
37
+ return (_jsxs("div", { className: style.optionsLine, children: [optionState === OptionStates.Adding && (_jsx(TextInputWithSubmit, { submitValue: onOptionAdd, placeholder: props.addOptionPlaceholder, validateValue: props.validateNewOptionValue, cancelSubmit: onCancelOptionAdd })), optionState === OptionStates.Default && (_jsxs("select", { className: style.optionsSelect, onChange: onOptionChange, value: props.selectedOptionValue, children: [props.onOptionAdded && (_jsx("option", { value: _OptionAddKey, children: (_a = props.addOptionText) !== null && _a !== void 0 ? _a : "Custom" }, _OptionAddKey)), props.options.map((option) => (_jsx("option", { value: option.value, children: option.label }, option.id)))] }))] }));
38
+ };
39
+ //# sourceMappingURL=OptionsLineComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsLineComponent.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/components/lines/OptionsLineComponent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAA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C,CAAC,CAAC;IAEF,OAAO,CACH,eAAK,SAAS,EAAE,KAAK,CAAC,WAAW,aAC5B,WAAW,KAAK,YAAY,CAAC,MAAM,IAAI,CACpC,KAAC,mBAAmB,IAChB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,KAAK,CAAC,oBAAoB,EACvC,aAAa,EAAE,KAAK,CAAC,sBAAsB,EAC3C,YAAY,EAAE,iBAAiB,GACjC,CACL,EACA,WAAW,KAAK,YAAY,CAAC,OAAO,IAAI,CACrC,kBAAQ,SAAS,EAAE,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,CAAC,mBAAmB,aAC7F,KAAK,CAAC,aAAa,IAAI,CACpB,iBAA4B,KAAK,EAAE,aAAa,YAC3C,MAAA,KAAK,CAAC,aAAa,mCAAI,QAAQ,IADvB,aAAa,CAEjB,CACZ,EACA,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAC3B,iBAAwB,KAAK,EAAE,MAAM,CAAC,KAAK,YACtC,MAAM,CAAC,KAAK,IADJ,MAAM,CAAC,EAAE,CAEb,CACZ,CAAC,IACG,CACZ,IACC,CACT,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type { ChangeEvent } from \"react\";\r\nimport { useState } from \"react\";\r\nimport { TextInputWithSubmit } from \"../TextInputWithSubmit\";\r\nimport style from \"./OptionsLineComponent.modules.scss\";\r\n\r\n/**\r\n * This components represents an options menu with optional\r\n * customizable properties. Option IDs should be unique.\r\n */\r\nexport interface IOption {\r\n label: string;\r\n value: string;\r\n id: string;\r\n}\r\n\r\nexport interface IOptionsLineComponentProps {\r\n options: IOption[];\r\n addOptionPlaceholder?: string; // Placeholder text to display when adding a new option\r\n onOptionAdded?: (newOption: IOption) => void; // Optional function that can be used to add a new option to the menu\r\n onOptionSelected: (selectedOptionValue: string) => void;\r\n selectedOptionValue: string; // The value of the currently selected option\r\n validateNewOptionValue?: (newOptionValue: string) => boolean; // Optional function that can be used to validate the value of a new option\r\n addOptionText?: string; // Optional text to display on the add option button\r\n}\r\n\r\n/**\r\n * We have two possible states. The user starts in the Default option, and can choose to\r\n * add a new option.\r\n */\r\nenum OptionStates {\r\n Default = 0, // Default state,\r\n Adding = 1, // State when the user is adding a new option to the menu\r\n}\r\n\r\nconst _OptionAddKey = \"addCustomOption\";\r\n\r\nexport const OptionsLineComponent = (props: IOptionsLineComponentProps) => {\r\n const [optionState, setOptionState] = useState(OptionStates.Default); // State of the component\r\n\r\n const onOptionChange = (evt: ChangeEvent<HTMLSelectElement>) => {\r\n if (evt.target.value === _OptionAddKey) {\r\n setOptionState(OptionStates.Adding);\r\n } else {\r\n props.onOptionSelected(evt.target.value);\r\n }\r\n };\r\n\r\n const onOptionAdd = (value: string) => {\r\n const newOptionText = value;\r\n const newOption = { label: newOptionText, value: newOptionText, id: Date.now().toString() };\r\n props.onOptionAdded?.(newOption);\r\n props.onOptionSelected(newOption.value);\r\n setOptionState(OptionStates.Default);\r\n };\r\n\r\n const onCancelOptionAdd = () => {\r\n setOptionState(OptionStates.Default);\r\n };\r\n\r\n return (\r\n <div className={style.optionsLine}>\r\n {optionState === OptionStates.Adding && (\r\n <TextInputWithSubmit\r\n submitValue={onOptionAdd}\r\n placeholder={props.addOptionPlaceholder}\r\n validateValue={props.validateNewOptionValue}\r\n cancelSubmit={onCancelOptionAdd}\r\n />\r\n )}\r\n {optionState === OptionStates.Default && (\r\n <select className={style.optionsSelect} onChange={onOptionChange} value={props.selectedOptionValue}>\r\n {props.onOptionAdded && (\r\n <option key={_OptionAddKey} value={_OptionAddKey}>\r\n {props.addOptionText ?? \"Custom\"}\r\n </option>\r\n )}\r\n {props.options.map((option) => (\r\n <option key={option.id} value={option.value}>\r\n {option.label}\r\n </option>\r\n ))}\r\n </select>\r\n )}\r\n </div>\r\n );\r\n};\r\n"]}
@@ -0,0 +1,12 @@
1
+ .optionsLine {
2
+ font-family: "acumin-pro-condensed", sans-serif;
3
+ font-size: 12px;
4
+ height: 25px;
5
+ padding-left: 15px;
6
+ }
7
+
8
+ .optionsSelect {
9
+ width: 100%;
10
+ height: 100%;
11
+ border: unset;
12
+ }
@@ -34,6 +34,9 @@ export class LineContainerComponent extends React.Component {
34
34
  }, 5000);
35
35
  }
36
36
  else if (this.props.selection.selectedLineContainerTitlesNoFocus.indexOf(this.props.title) > -1) {
37
+ setTimeout(() => {
38
+ this.props.selection.selectedLineContainerTitlesNoFocus = [];
39
+ });
37
40
  this.setState({ isExpanded: true, isHighlighted: false });
38
41
  }
39
42
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"lineContainerComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/lines/lineContainerComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,4CAA8B;AAEpD,OAAO,SAAS,MAAM,iBAAiB,CAAC;AASxC,MAAM,OAAO,sBAAuB,SAAQ,KAAK,CAAC,SAAwF;IACtI,YAAY,KAAmC;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAC;QAEb,MAAM,YAAY,GAAG,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEnF,IAAI,CAAC,KAAK,GAAG,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;IACpE,CAAC;IAED,mBAAmB;QACf,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;QAExC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAErD,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,MAAM,SAAS,GAA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IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,kCAAkC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE;YAC/F,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC,CAAC;SAC7D;aAAM;YACH,IAAI,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;SACxC;IACL,CAAC;IAED,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACxB,OAAO,CACH,cAAK,SAAS,EAAC,eAAe,YAC1B,cAAK,SAAS,EAAC,uBAAuB,YAAE,IAAI,CAAC,YAAY,EAAE,GAAO,GAChE,CACT,CAAC;SACL;QAED,OAAO,CACH,eAAK,SAAS,EAAC,eAAe,aAC1B,eAAK,SAAS,EAAC,uBAAuB,aACjC,IAAI,CAAC,YAAY,EAAE,EACpB,cAAK,SAAS,EAAC,UAAU,YAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAO,IACnD,EACN,cAAK,SAAS,EAAE,gCAAgC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,GAAQ,IAC1G,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport { DataStorage } from \"core/Misc/dataStorage\";\r\nimport type { ISelectedLineContainer } from \"./iSelectedLineContainer\";\r\nimport downArrow from \"./downArrow.svg\";\r\n\r\ninterface ILineContainerComponentProps {\r\n selection?: ISelectedLineContainer;\r\n title: string;\r\n children: any[] | any;\r\n closed?: boolean;\r\n}\r\n\r\nexport class LineContainerComponent extends React.Component<ILineContainerComponentProps, { isExpanded: boolean; isHighlighted: boolean }> {\r\n constructor(props: ILineContainerComponentProps) {\r\n super(props);\r\n\r\n const initialState = DataStorage.ReadBoolean(this.props.title, !this.props.closed);\r\n\r\n this.state = { isExpanded: initialState, isHighlighted: false };\r\n }\r\n\r\n switchExpandedState(): void {\r\n const newState = !this.state.isExpanded;\r\n\r\n DataStorage.WriteBoolean(this.props.title, newState);\r\n\r\n this.setState({ isExpanded: newState });\r\n }\r\n\r\n renderHeader() {\r\n const className = this.state.isExpanded ? \"collapse\" : \"collapse closed\";\r\n\r\n return (\r\n <div className=\"header\" onClick={() => this.switchExpandedState()}>\r\n <div className=\"title\">{this.props.title}</div>\r\n <div className={className}>\r\n <img className=\"img\" title={this.props.title} src={downArrow} />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n componentDidMount() {\r\n if (!this.props.selection) {\r\n return;\r\n }\r\n\r\n if (this.props.selection.selectedLineContainerTitles.length === 0 && this.props.selection.selectedLineContainerTitlesNoFocus.length === 0) {\r\n return;\r\n }\r\n\r\n if (this.props.selection.selectedLineContainerTitles.indexOf(this.props.title) > -1) {\r\n setTimeout(() => {\r\n this.props.selection!.selectedLineContainerTitles = [];\r\n });\r\n\r\n this.setState({ isExpanded: true, isHighlighted: true });\r\n\r\n window.setTimeout(() => {\r\n this.setState({ isHighlighted: false });\r\n }, 5000);\r\n } else if (this.props.selection.selectedLineContainerTitlesNoFocus.indexOf(this.props.title) > -1) {\r\n this.setState({ isExpanded: true, isHighlighted: false });\r\n } else {\r\n this.setState({ isExpanded: false });\r\n }\r\n }\r\n\r\n render() {\r\n if (!this.state.isExpanded) {\r\n return (\r\n <div className=\"paneContainer\">\r\n <div className=\"paneContainer-content\">{this.renderHeader()}</div>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <div className=\"paneContainer\">\r\n <div className=\"paneContainer-content\">\r\n {this.renderHeader()}\r\n <div className=\"paneList\">{this.props.children}</div>\r\n </div>\r\n <div className={\"paneContainer-highlight-border\" + (!this.state.isHighlighted ? \" transparent\" : \"\")}></div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":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AAU,EAAE,KAAK,EAAE,CAAC,CAAC;SACxC;IACL,CAAC;IAED,MAAM;QACF,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE;YACxB,OAAO,CACH,cAAK,SAAS,EAAC,eAAe,YAC1B,cAAK,SAAS,EAAC,uBAAuB,YAAE,IAAI,CAAC,YAAY,EAAE,GAAO,GAChE,CACT,CAAC;SACL;QAED,OAAO,CACH,eAAK,SAAS,EAAC,eAAe,aAC1B,eAAK,SAAS,EAAC,uBAAuB,aACjC,IAAI,CAAC,YAAY,EAAE,EACpB,cAAK,SAAS,EAAC,UAAU,YAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAO,IACnD,EACN,cAAK,SAAS,EAAE,gCAAgC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,GAAQ,IAC1G,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport { DataStorage } from \"core/Misc/dataStorage\";\r\nimport type { ISelectedLineContainer } from \"./iSelectedLineContainer\";\r\nimport downArrow from \"./downArrow.svg\";\r\n\r\ninterface ILineContainerComponentProps {\r\n selection?: ISelectedLineContainer;\r\n title: string;\r\n children: any[] | any;\r\n closed?: boolean;\r\n}\r\n\r\nexport class LineContainerComponent extends React.Component<ILineContainerComponentProps, { isExpanded: boolean; isHighlighted: boolean }> {\r\n constructor(props: ILineContainerComponentProps) {\r\n super(props);\r\n\r\n const initialState = DataStorage.ReadBoolean(this.props.title, !this.props.closed);\r\n\r\n this.state = { isExpanded: initialState, isHighlighted: false };\r\n }\r\n\r\n switchExpandedState(): void {\r\n const newState = !this.state.isExpanded;\r\n\r\n DataStorage.WriteBoolean(this.props.title, newState);\r\n\r\n this.setState({ isExpanded: newState });\r\n }\r\n\r\n renderHeader() {\r\n const className = this.state.isExpanded ? \"collapse\" : \"collapse closed\";\r\n\r\n return (\r\n <div className=\"header\" onClick={() => this.switchExpandedState()}>\r\n <div className=\"title\">{this.props.title}</div>\r\n <div className={className}>\r\n <img className=\"img\" title={this.props.title} src={downArrow} />\r\n </div>\r\n </div>\r\n );\r\n }\r\n\r\n componentDidMount() {\r\n if (!this.props.selection) {\r\n return;\r\n }\r\n\r\n if (this.props.selection.selectedLineContainerTitles.length === 0 && this.props.selection.selectedLineContainerTitlesNoFocus.length === 0) {\r\n return;\r\n }\r\n\r\n if (this.props.selection.selectedLineContainerTitles.indexOf(this.props.title) > -1) {\r\n setTimeout(() => {\r\n this.props.selection!.selectedLineContainerTitles = [];\r\n });\r\n\r\n this.setState({ isExpanded: true, isHighlighted: true });\r\n\r\n window.setTimeout(() => {\r\n this.setState({ isHighlighted: false });\r\n }, 5000);\r\n } else if (this.props.selection.selectedLineContainerTitlesNoFocus.indexOf(this.props.title) > -1) {\r\n setTimeout(() => {\r\n this.props.selection!.selectedLineContainerTitlesNoFocus = [];\r\n });\r\n this.setState({ isExpanded: true, isHighlighted: false });\r\n } else {\r\n this.setState({ isExpanded: false });\r\n }\r\n }\r\n\r\n render() {\r\n if (!this.state.isExpanded) {\r\n return (\r\n <div className=\"paneContainer\">\r\n <div className=\"paneContainer-content\">{this.renderHeader()}</div>\r\n </div>\r\n );\r\n }\r\n\r\n return (\r\n <div className=\"paneContainer\">\r\n <div className=\"paneContainer-content\">\r\n {this.renderHeader()}\r\n <div className=\"paneList\">{this.props.children}</div>\r\n </div>\r\n <div className={\"paneContainer-highlight-border\" + (!this.state.isHighlighted ? \" transparent\" : \"\")}></div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
@@ -8,14 +8,9 @@ export interface IOptionsLineComponentProps {
8
8
  target: any;
9
9
  propertyName: string;
10
10
  options: IInspectableOptions[];
11
- addInput?: boolean;
12
11
  noDirectUpdate?: boolean;
13
12
  onSelect?: (value: number | string) => void;
14
13
  extractValue?: (target: any) => number | string;
15
- addVal?: (newVal: {
16
- label: string;
17
- value: number;
18
- }, prevVal: number) => void;
19
14
  onPropertyChangedObservable?: Observable<PropertyChangedEvent>;
20
15
  allowNullValue?: boolean;
21
16
  icon?: string;
@@ -23,13 +18,9 @@ export interface IOptionsLineComponentProps {
23
18
  className?: string;
24
19
  valuesAreStrings?: boolean;
25
20
  defaultIfNull?: number;
26
- fromFontDropdown?: boolean;
27
- valueProp?: number;
28
- fallbackValue?: number;
29
21
  }
30
22
  export declare class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, {
31
23
  value: number | string;
32
- addCustom: boolean;
33
24
  }> {
34
25
  private _localChange;
35
26
  private _remapValueIn;
@@ -38,11 +29,9 @@ export declare class OptionsLineComponent extends React.Component<IOptionsLineCo
38
29
  constructor(props: IOptionsLineComponentProps);
39
30
  shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: {
40
31
  value: number;
41
- addCustom: boolean;
42
32
  }): boolean;
43
33
  raiseOnPropertyChanged(newValue: number, previousValue: number): void;
44
34
  setValue(value: string | number): void;
45
35
  updateValue(valueString: string): void;
46
- updateCustomValue(): void;
47
36
  render(): JSX.Element;
48
37
  }
@@ -2,13 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  // eslint-disable-next-line @typescript-eslint/naming-convention
4
4
  export const Null_Value = Number.MAX_SAFE_INTEGER;
5
- const DEFAULT_FALLBACK_VALUE = -1;
6
5
  export class OptionsLineComponent extends React.Component {
7
6
  constructor(props) {
8
- // Initialize default props
9
7
  super(props);
10
8
  this._localChange = false;
11
- this.state = { value: this._remapValueIn(this._getValue(props)), addCustom: false };
9
+ this.state = { value: this._remapValueIn(this._getValue(props)) };
12
10
  }
13
11
  _remapValueIn(value) {
14
12
  return this.props.allowNullValue && value === null ? Null_Value : value;
@@ -27,14 +25,11 @@ export class OptionsLineComponent extends React.Component {
27
25
  this._localChange = false;
28
26
  return true;
29
27
  }
30
- const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(nextProps.target) : nextProps.target[nextProps.propertyName]);
28
+ const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);
31
29
  if (newValue != null && newValue !== nextState.value) {
32
30
  nextState.value = newValue;
33
31
  return true;
34
32
  }
35
- if (this.props.options !== nextProps.options) {
36
- return true;
37
- }
38
33
  return false;
39
34
  }
40
35
  raiseOnPropertyChanged(newValue, previousValue) {
@@ -53,67 +48,24 @@ export class OptionsLineComponent extends React.Component {
53
48
  this.setState({ value: value });
54
49
  }
55
50
  updateValue(valueString) {
56
- var _a, _b;
57
- let value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
58
- if (isNaN(Number(value))) {
59
- for (let i = 0; i < this.props.options.length; i++) {
60
- if (((_a = this.props.options.at(i)) === null || _a === void 0 ? void 0 : _a.label) === valueString) {
61
- value = Number((_b = this.props.options.at(i)) === null || _b === void 0 ? void 0 : _b.value);
62
- }
63
- }
64
- }
65
- if (value === 0 && this.props.fromFontDropdown) {
66
- this.setState({ addCustom: true });
67
- }
51
+ const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);
68
52
  this._localChange = true;
69
53
  const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
70
54
  if (!this.props.noDirectUpdate) {
71
55
  this.props.target[this.props.propertyName] = this._remapValueOut(value);
72
56
  }
73
- //selecting a regular option from font dropdown
74
- if (value != 0 && this.props.fromFontDropdown) {
75
- this.setState({ value: value });
76
- if (this.props.onSelect) {
77
- this.props.onSelect(value);
78
- }
79
- //selecting 'custom font' from font dropdown
80
- }
81
- else if (this.props.fromFontDropdown) {
82
- if (this.props.onSelect) {
83
- this.props.onSelect(this.state.value);
84
- }
85
- }
86
- //selecting from a dropdown that's not font dropdown
87
- else {
88
- this.setState({ value: value });
89
- if (this.props.onSelect) {
90
- this.props.onSelect(value);
91
- }
57
+ this.setState({ value: value });
58
+ if (this.props.onSelect) {
59
+ this.props.onSelect(value);
92
60
  }
93
61
  const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];
94
62
  this.raiseOnPropertyChanged(newValue, store);
95
63
  }
96
- updateCustomValue() {
97
- this.setState({ addCustom: false });
98
- }
99
64
  render() {
100
65
  var _a;
101
- const fallback = this.props.fallbackValue !== undefined ? this.props.fallbackValue : DEFAULT_FALLBACK_VALUE;
102
- return (_jsxs("div", { className: `listLine ${(_a = this.props.className) !== null && _a !== void 0 ? _a : ""}`, children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), _jsx("div", { className: "label", title: this.props.label, children: this.props.label }), _jsx("div", { className: "options", children: this.state.addCustom ? (_jsx("input", { type: "text", placeholder: "Enter a custom font here", onKeyDown: (event) => {
103
- event.key === "Enter" && this.props.addVal != undefined
104
- ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
105
- this.updateCustomValue(),
106
- this.forceUpdate())
107
- : null;
108
- }, onBlur: (event) => {
109
- this.props.addVal != undefined
110
- ? (this.props.addVal({ label: event.target.value, value: this.props.options.length + 1 }, Number(this.state.value)),
111
- this.updateCustomValue(),
112
- this.forceUpdate())
113
- : null;
114
- } })) : (_jsx("select", { onChange: (evt) => this.updateValue(evt.target.value), value: this.state.value === null || this.state.value === undefined ? fallback : this.state.value, children: this.props.options.map((option, i) => {
66
+ return (_jsxs("div", { className: "listLine" + (this.props.className ? " " + this.props.className : ""), children: [this.props.icon && _jsx("img", { src: this.props.icon, title: this.props.iconLabel, alt: this.props.iconLabel, color: "black", className: "icon" }), _jsx("div", { className: "label", title: this.props.label, children: this.props.label }), _jsx("div", { className: "options", children: _jsx("select", { onChange: (evt) => this.updateValue(evt.target.value), value: (_a = this.state.value) !== null && _a !== void 0 ? _a : "", children: this.props.options.map((option, i) => {
115
67
  return (_jsx("option", { selected: option.selected, value: option.value, title: option.label, children: option.label }, option.label + i));
116
- }) })) })] }));
68
+ }) }) })] }));
117
69
  }
118
70
  }
119
71
  //# sourceMappingURL=optionsLineComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"optionsLineComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/lines/optionsLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAElD,MAAM,sBAAsB,GAAG,CAAC,CAAC,CAAC;AAyBlC,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAqF;IAiBjI,YAAY,KAAiC;QACzC,2BAA2B;QAC3B,KAAK,CAAC,KAAK,CAAC,CAAC;QAlBT,iBAAY,GAAG,KAAK,CAAC;QAoBzB,IAAI,CAAC,KAAK,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IACxF,CAAC;IApBO,aAAa,CAAC,KAAoB;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,KAAM,CAAC;IAC7E,CAAC;IAEO,cAAc,CAAC,KAAa;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,IAAI,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IAC5E,CAAC;IAEO,SAAS,CAAC,KAAiC;QAC/C,IAAI,KAAK,CAAC,YAAY,EAAE;YACpB,OAAO,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3C;QACD,OAAO,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAA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,SAAS;gCAC1B,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAG,KAAK,CAAC,MAA2B,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;oCACvI,IAAI,CAAC,iBAAiB,EAAE;oCACxB,IAAI,CAAC,WAAW,EAAE,CAAC;gCACrB,CAAC,CAAC,IAAI,CAAC;wBACf,CAAC,GACH,CACL,CAAC,CAAC,CAAC,CACA,iBACI,QAAQ,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EACrD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,YAE/F,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAClC,OAAO,CACH,iBAAQ,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAyB,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,YAC7F,MAAM,CAAC,KAAK,IADuB,MAAM,CAAC,KAAK,GAAG,CAAC,CAE/C,CACZ,CAAC;wBACN,CAAC,CAAC,GACG,CACZ,GACC,IACJ,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { IInspectableOptions } from \"core/Misc/iInspectable\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const Null_Value = Number.MAX_SAFE_INTEGER;\r\n\r\nconst DEFAULT_FALLBACK_VALUE = -1;\r\n\r\nexport interface IOptionsLineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n options: IInspectableOptions[];\r\n addInput?: boolean;\r\n noDirectUpdate?: boolean;\r\n onSelect?: (value: number | string) => void;\r\n extractValue?: (target: any) => number | string;\r\n addVal?: (newVal: { label: string; value: number }, prevVal: number) => void;\r\n\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n allowNullValue?: boolean;\r\n icon?: string;\r\n iconLabel?: string;\r\n className?: string;\r\n valuesAreStrings?: boolean;\r\n defaultIfNull?: number;\r\n fromFontDropdown?: boolean;\r\n valueProp?: number;\r\n fallbackValue?: number;\r\n}\r\n\r\nexport class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, { value: number | string; addCustom: boolean }> {\r\n private _localChange = false;\r\n private _remapValueIn(value: number | null): number {\r\n return this.props.allowNullValue && value === null ? Null_Value : value!;\r\n }\r\n\r\n private _remapValueOut(value: number): number | null {\r\n return this.props.allowNullValue && value === Null_Value ? null : value;\r\n }\r\n\r\n private _getValue(props: IOptionsLineComponentProps) {\r\n if (props.extractValue) {\r\n return props.extractValue(props.target);\r\n }\r\n return props.target && props.propertyName ? props.target[props.propertyName] : props.options[props.defaultIfNull || 0];\r\n }\r\n\r\n constructor(props: IOptionsLineComponentProps) {\r\n // Initialize default props\r\n super(props);\r\n\r\n this.state = { value: this._remapValueIn(this._getValue(props)), addCustom: false };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: { value: number; addCustom: boolean }) {\r\n if (this._localChange) {\r\n this._localChange = false;\r\n\r\n return true;\r\n }\r\n\r\n const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(nextProps.target) : nextProps.target[nextProps.propertyName]);\r\n\r\n if (newValue != null && newValue !== nextState.value) {\r\n nextState.value = newValue;\r\n\r\n return true;\r\n }\r\n\r\n if (this.props.options !== nextProps.options) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n raiseOnPropertyChanged(newValue: number, previousValue: number) {\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: newValue,\r\n initialValue: previousValue,\r\n allowNullValue: this.props.allowNullValue,\r\n });\r\n }\r\n\r\n setValue(value: string | number) {\r\n this.setState({ value: value });\r\n }\r\n\r\n updateValue(valueString: string) {\r\n let value = this.props.valuesAreStrings ? valueString : parseInt(valueString);\r\n\r\n if (isNaN(Number(value))) {\r\n for (let i = 0; i < this.props.options.length; i++) {\r\n if (this.props.options.at(i)?.label === valueString) {\r\n value = Number(this.props.options.at(i)?.value);\r\n }\r\n }\r\n }\r\n\r\n if (value === 0 && this.props.fromFontDropdown) {\r\n this.setState({ addCustom: true });\r\n }\r\n\r\n this._localChange = true;\r\n\r\n const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];\r\n\r\n if (!this.props.noDirectUpdate) {\r\n this.props.target[this.props.propertyName] = this._remapValueOut(value as number);\r\n }\r\n\r\n //selecting a regular option from font dropdown\r\n if (value != 0 && this.props.fromFontDropdown) {\r\n this.setState({ value: value });\r\n if (this.props.onSelect) {\r\n this.props.onSelect(value);\r\n }\r\n //selecting 'custom font' from font dropdown\r\n } else if (this.props.fromFontDropdown) {\r\n if (this.props.onSelect) {\r\n this.props.onSelect(this.state.value);\r\n }\r\n }\r\n //selecting from a dropdown that's not font dropdown\r\n else {\r\n this.setState({ value: value });\r\n if (this.props.onSelect) {\r\n this.props.onSelect(value);\r\n }\r\n }\r\n\r\n const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];\r\n\r\n this.raiseOnPropertyChanged(newValue, store);\r\n }\r\n\r\n updateCustomValue() {\r\n this.setState({ addCustom: false });\r\n }\r\n\r\n render() {\r\n const fallback = this.props.fallbackValue !== undefined ? this.props.fallbackValue : DEFAULT_FALLBACK_VALUE;\r\n return (\r\n <div className={`listLine ${this.props.className ?? \"\"}`}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} color=\"black\" className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"options\">\r\n {this.state.addCustom ? (\r\n <input\r\n type=\"text\"\r\n placeholder=\"Enter a custom font here\"\r\n onKeyDown={(event) => {\r\n event.key === \"Enter\" && this.props.addVal != undefined\r\n ? (this.props.addVal({ label: (event.target as HTMLInputElement).value, value: this.props.options.length + 1 }, Number(this.state.value)),\r\n this.updateCustomValue(),\r\n this.forceUpdate())\r\n : null;\r\n }}\r\n onBlur={(event) => {\r\n this.props.addVal != undefined\r\n ? (this.props.addVal({ label: (event.target as HTMLInputElement).value, value: this.props.options.length + 1 }, Number(this.state.value)),\r\n this.updateCustomValue(),\r\n this.forceUpdate())\r\n : null;\r\n }}\r\n />\r\n ) : (\r\n <select\r\n onChange={(evt) => this.updateValue(evt.target.value)}\r\n value={this.state.value === null || this.state.value === undefined ? fallback : this.state.value}\r\n >\r\n {this.props.options.map((option, i) => {\r\n return (\r\n <option selected={option.selected} key={option.label + i} value={option.value} title={option.label}>\r\n {option.label}\r\n </option>\r\n );\r\n })}\r\n </select>\r\n )}\r\n </div>\r\n </div>\r\n );\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"optionsLineComponent.js","sourceRoot":"","sources":["../../../../../dev/sharedUiComponents/src/lines/optionsLineComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,gBAAgB,CAAC;AAmBlD,MAAM,OAAO,oBAAqB,SAAQ,KAAK,CAAC,SAAiE;IAkB7G,YAAY,KAAiC;QACzC,KA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AAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,MAAA,IAAI,CAAC,KAAK,CAAC,KAAK,mCAAI,EAAE,YACvF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAClC,OAAO,CACH,iBAAQ,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAyB,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,YAC7F,MAAM,CAAC,KAAK,IADuB,MAAM,CAAC,KAAK,GAAG,CAAC,CAE/C,CACZ,CAAC;wBACN,CAAC,CAAC,GACG,GACP,IACJ,CACT,CAAC;IACN,CAAC;CACJ","sourcesContent":["import * as React from \"react\";\r\nimport type { Observable } from \"core/Misc/observable\";\r\nimport type { PropertyChangedEvent } from \"../propertyChangedEvent\";\r\nimport type { IInspectableOptions } from \"core/Misc/iInspectable\";\r\n\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport const Null_Value = Number.MAX_SAFE_INTEGER;\r\n\r\nexport interface IOptionsLineComponentProps {\r\n label: string;\r\n target: any;\r\n propertyName: string;\r\n options: IInspectableOptions[];\r\n noDirectUpdate?: boolean;\r\n onSelect?: (value: number | string) => void;\r\n extractValue?: (target: any) => number | string;\r\n onPropertyChangedObservable?: Observable<PropertyChangedEvent>;\r\n allowNullValue?: boolean;\r\n icon?: string;\r\n iconLabel?: string;\r\n className?: string;\r\n valuesAreStrings?: boolean;\r\n defaultIfNull?: number;\r\n}\r\n\r\nexport class OptionsLineComponent extends React.Component<IOptionsLineComponentProps, { value: number | string }> {\r\n private _localChange = false;\r\n\r\n private _remapValueIn(value: number | null): number {\r\n return this.props.allowNullValue && value === null ? Null_Value : value!;\r\n }\r\n\r\n private _remapValueOut(value: number): number | null {\r\n return this.props.allowNullValue && value === Null_Value ? null : value;\r\n }\r\n\r\n private _getValue(props: IOptionsLineComponentProps) {\r\n if (props.extractValue) {\r\n return props.extractValue(props.target);\r\n }\r\n return props.target && props.propertyName ? props.target[props.propertyName] : props.options[props.defaultIfNull || 0];\r\n }\r\n\r\n constructor(props: IOptionsLineComponentProps) {\r\n super(props);\r\n\r\n this.state = { value: this._remapValueIn(this._getValue(props)) };\r\n }\r\n\r\n shouldComponentUpdate(nextProps: IOptionsLineComponentProps, nextState: { value: number }) {\r\n if (this._localChange) {\r\n this._localChange = false;\r\n return true;\r\n }\r\n\r\n const newValue = this._remapValueIn(nextProps.extractValue ? nextProps.extractValue(this.props.target) : nextProps.target[nextProps.propertyName]);\r\n if (newValue != null && newValue !== nextState.value) {\r\n nextState.value = newValue;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n raiseOnPropertyChanged(newValue: number, previousValue: number) {\r\n if (!this.props.onPropertyChangedObservable) {\r\n return;\r\n }\r\n\r\n this.props.onPropertyChangedObservable.notifyObservers({\r\n object: this.props.target,\r\n property: this.props.propertyName,\r\n value: newValue,\r\n initialValue: previousValue,\r\n allowNullValue: this.props.allowNullValue,\r\n });\r\n }\r\n\r\n setValue(value: string | number) {\r\n this.setState({ value: value });\r\n }\r\n\r\n updateValue(valueString: string) {\r\n const value = this.props.valuesAreStrings ? valueString : parseInt(valueString);\r\n this._localChange = true;\r\n\r\n const store = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];\r\n\r\n if (!this.props.noDirectUpdate) {\r\n this.props.target[this.props.propertyName] = this._remapValueOut(value as number);\r\n }\r\n this.setState({ value: value });\r\n\r\n if (this.props.onSelect) {\r\n this.props.onSelect(value);\r\n }\r\n\r\n const newValue = this.props.extractValue ? this.props.extractValue(this.props.target) : this.props.target[this.props.propertyName];\r\n\r\n this.raiseOnPropertyChanged(newValue, store);\r\n }\r\n\r\n render() {\r\n return (\r\n <div className={\"listLine\" + (this.props.className ? \" \" + this.props.className : \"\")}>\r\n {this.props.icon && <img src={this.props.icon} title={this.props.iconLabel} alt={this.props.iconLabel} color=\"black\" className=\"icon\" />}\r\n <div className=\"label\" title={this.props.label}>\r\n {this.props.label}\r\n </div>\r\n <div className=\"options\">\r\n <select onChange={(evt) => this.updateValue(evt.target.value)} value={this.state.value ?? \"\"}>\r\n {this.props.options.map((option, i) => {\r\n return (\r\n <option selected={option.selected} key={option.label + i} value={option.value} title={option.label}>\r\n {option.label}\r\n </option>\r\n );\r\n })}\r\n </select>\r\n </div>\r\n </div>\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": "5.31.2",
3
+ "version": "5.32.1",
4
4
  "main": "index.js",
5
5
  "module": "index.js",
6
6
  "types": "index.d.ts",
@@ -1,11 +1,9 @@
1
1
  /// <reference types="react" />
2
+ import { CommandBarComponent } from "../../components/bars/CommandBarComponent";
3
+ import type { StoryObj } from "@storybook/react";
2
4
  declare const _default: {
3
5
  component: import("react").FC<import("../../components/bars/CommandBarComponent").ICommandBarComponentProps>;
4
6
  };
5
7
  export default _default;
6
- export declare const Default: {};
7
- export declare const WithArtboardColor: {
8
- parameters: {
9
- onArtboardColorChanged: (color: string) => void;
10
- };
11
- };
8
+ export declare const Default: StoryObj<typeof CommandBarComponent>;
9
+ export declare const WithArtboardColor: StoryObj<typeof CommandBarComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandBarComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/bars/CommandBarComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAEhF,eAAe,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAElD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC;AAE1B,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IAC1C,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,sBAAsB;AACtB,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC7B,GAAG,OAAO;IACV,UAAU,EAAE,EAAE,sBAAsB,EAAE,mBAAmB,EAAE;CAC9D,CAAC","sourcesContent":["import { CommandBarComponent } from \"../../components/bars/CommandBarComponent\";\r\n\r\nexport default { component: CommandBarComponent };\r\n\r\n// Default rendering function.\r\nexport const Default = {};\r\n\r\nconst artBoardColorChange = (color: string) => {\r\n console.log(\"new color\", color);\r\n};\r\n\r\n// With Artboard color\r\nexport const WithArtboardColor = {\r\n ...Default,\r\n parameters: { onArtboardColorChanged: artBoardColorChange },\r\n};\r\n"]}
1
+ {"version":3,"file":"CommandBarComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/bars/CommandBarComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AAGhF,eAAe,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;AAElD,8BAA8B;AAC9B,MAAM,CAAC,MAAM,OAAO,GAAyC,EAAE,CAAC;AAEhE,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,EAAE;IAC1C,OAAO,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC,CAAC;AAEF,sBAAsB;AACtB,MAAM,CAAC,MAAM,iBAAiB,GAAyC;IACnE,GAAG,OAAO;IACV,UAAU,EAAE,EAAE,sBAAsB,EAAE,mBAAmB,EAAE;CAC9D,CAAC","sourcesContent":["import { CommandBarComponent } from \"../../components/bars/CommandBarComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: CommandBarComponent };\r\n\r\n// Default rendering function.\r\nexport const Default: StoryObj<typeof CommandBarComponent> = {};\r\n\r\nconst artBoardColorChange = (color: string) => {\r\n console.log(\"new color\", color);\r\n};\r\n\r\n// With Artboard color\r\nexport const WithArtboardColor: StoryObj<typeof CommandBarComponent> = {\r\n ...Default,\r\n parameters: { onArtboardColorChanged: artBoardColorChange },\r\n};\r\n"]}
@@ -1,6 +1,8 @@
1
1
  /// <reference types="react" />
2
+ import { CommandButtonComponent } from "../../components/bars/CommandButtonComponent";
3
+ import type { StoryObj } from "@storybook/react";
2
4
  declare const _default: {
3
5
  component: import("react").FC<import("../../components/bars/CommandButtonComponent").ICommandButtonComponentProps>;
4
6
  };
5
7
  export default _default;
6
- export declare const Default: {};
8
+ export declare const Default: StoryObj<typeof CommandButtonComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandButtonComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/bars/CommandButtonComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF,eAAe;IACX,SAAS,EAAE,sBAAsB;CACpC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC","sourcesContent":["import { CommandButtonComponent } from \"../../components/bars/CommandButtonComponent\";\r\n\r\nexport default {\r\n component: CommandButtonComponent,\r\n};\r\n\r\n// Default rendering function\r\nexport const Default = {};\r\n"]}
1
+ {"version":3,"file":"CommandButtonComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/bars/CommandButtonComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAGtF,eAAe;IACX,SAAS,EAAE,sBAAsB;CACpC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,OAAO,GAA4C,EAAE,CAAC","sourcesContent":["import { CommandButtonComponent } from \"../../components/bars/CommandButtonComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default {\r\n component: CommandButtonComponent,\r\n};\r\n\r\n// Default rendering function\r\nexport const Default: StoryObj<typeof CommandButtonComponent> = {};\r\n"]}
@@ -1,11 +1,7 @@
1
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
2
1
  import { ColorPicker } from "../../components/colorPicker/ColorPicker";
2
+ import type { StoryObj } from "@storybook/react";
3
3
  declare const _default: {
4
4
  component: typeof ColorPicker;
5
5
  };
6
6
  export default _default;
7
- export declare const Default: {
8
- args: {
9
- color: Color3;
10
- };
11
- };
7
+ export declare const Default: StoryObj<typeof ColorPicker>;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/colorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC","sourcesContent":["import { Color3 } from \"core/Maths/math.color\";\r\nimport { ColorPicker } from \"../../components/colorPicker/ColorPicker\";\r\n\r\nexport default { component: ColorPicker };\r\n\r\nexport const Default = { args: { color: new Color3(1, 0, 0) } };\r\n"]}
1
+ {"version":3,"file":"ColorPicker.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/colorPicker/ColorPicker.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAGvE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;AAE1C,MAAM,CAAC,MAAM,OAAO,GAAiC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC","sourcesContent":["import { Color3 } from \"core/Maths/math.color\";\r\nimport { ColorPicker } from \"../../components/colorPicker/ColorPicker\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: ColorPicker };\r\n\r\nexport const Default: StoryObj<typeof ColorPicker> = { args: { color: new Color3(1, 0, 0) } };\r\n"]}
@@ -1,46 +1,10 @@
1
1
  /// <reference types="react" />
2
2
  import type { IFlexibleGridLayoutProps } from "../../components/layout/FlexibleGridLayout";
3
+ import { FlexibleGridLayout } from "../../components/layout/FlexibleGridLayout";
4
+ import type { StoryObj } from "@storybook/react";
3
5
  declare const _default: {
4
6
  component: import("react").FC<IFlexibleGridLayoutProps>;
5
7
  };
6
8
  export default _default;
7
- export declare const Default: {
8
- render: (props: IFlexibleGridLayoutProps) => JSX.Element;
9
- args: {
10
- layoutDefinition: {
11
- columns: {
12
- id: string;
13
- width: string;
14
- rows: {
15
- id: string;
16
- height: string;
17
- selectedTab: string;
18
- tabs: {
19
- id: string;
20
- component: JSX.Element;
21
- }[];
22
- }[];
23
- }[];
24
- };
25
- };
26
- };
27
- export declare const TwoColumn: {
28
- render: (props: IFlexibleGridLayoutProps) => JSX.Element;
29
- args: {
30
- layoutDefinition: {
31
- columns: {
32
- id: string;
33
- width: string;
34
- rows: {
35
- id: string;
36
- height: string;
37
- selectedTab: string;
38
- tabs: {
39
- id: string;
40
- component: JSX.Element;
41
- }[];
42
- }[];
43
- }[];
44
- };
45
- };
46
- };
9
+ export declare const Default: StoryObj<typeof FlexibleGridLayout>;
10
+ export declare const TwoColumn: StoryObj<typeof FlexibleGridLayout>;
@@ -12,8 +12,8 @@ export const Default = {
12
12
  id: "column1",
13
13
  width: "100%",
14
14
  rows: [
15
- { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }) }] },
16
- { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }) }] },
15
+ { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }), title: "Tab title 1" }] },
16
+ { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }), title: "Tab 2" }] },
17
17
  ],
18
18
  },
19
19
  ],
@@ -29,16 +29,16 @@ export const TwoColumn = {
29
29
  id: "column1",
30
30
  width: "50%",
31
31
  rows: [
32
- { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }) }] },
33
- { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }) }] },
32
+ { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }), title: "T1" }] },
33
+ { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }), title: "T2" }] },
34
34
  ],
35
35
  },
36
36
  {
37
37
  id: "column2",
38
38
  width: "50%",
39
39
  rows: [
40
- { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }) }] },
41
- { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }) }] },
40
+ { id: "row1", height: "50%", selectedTab: "tab1", tabs: [{ id: "tab1", component: _jsx("div", { children: "Test tab 1" }), title: "T3" }] },
41
+ { id: "row2", height: "50%", selectedTab: "tab2", tabs: [{ id: "tab2", component: _jsx("div", { children: "Test tab 2" }), title: "T4" }] },
42
42
  ],
43
43
  },
44
44
  ],
@@ -1 +1 @@
1
- {"version":3,"file":"FlexibleGridLayout.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/layout/FlexibleGridLayout.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE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EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAqB,EAAE,CAAC,EAAE;qBAC/G;iBACJ;gBACD;oBACI,EAAE,EAAE,SAAS;oBACb,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE;wBACF,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAqB,EAAE,CAAC,EAAE;wBAC5G,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAqB,EAAE,CAAC,EAAE;qBAC/G;iBACJ;aACJ;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import type { IFlexibleGridLayoutProps } from \"../../components/layout/FlexibleGridLayout\";\r\nimport { FlexibleGridLayout } from \"../../components/layout/FlexibleGridLayout\";\r\n\r\nexport default { component: FlexibleGridLayout };\r\n\r\nexport const Default = {\r\n render: (props: IFlexibleGridLayoutProps) => {\r\n return (\r\n <div style={{ width: \"100%\", height: \"500px\" }}>\r\n <FlexibleGridLayout {...props} />\r\n </div>\r\n );\r\n },\r\n args: {\r\n layoutDefinition: {\r\n columns: [\r\n {\r\n id: \"column1\",\r\n width: \"100%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div> }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div> }] },\r\n ],\r\n },\r\n ],\r\n },\r\n },\r\n};\r\n\r\nexport const TwoColumn = {\r\n render: Default.render,\r\n args: {\r\n layoutDefinition: {\r\n columns: [\r\n {\r\n id: \"column1\",\r\n width: \"50%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div> }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div> }] },\r\n ],\r\n },\r\n {\r\n id: \"column2\",\r\n width: \"50%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div> }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div> }] },\r\n ],\r\n },\r\n ],\r\n },\r\n },\r\n};\r\n"]}
1
+ {"version":3,"file":"FlexibleGridLayout.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/layout/FlexibleGridLayout.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4CAA4C,CAAC;AAGhF,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;AAEjD,MAAM,CAAC,MAAM,OAAO,GAAwC;IACxD,MAAM,EAAE,CAAC,KAA+B,EAAE,EAAE;QACxC,OAAO,CACH,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,YAC1C,KAAC,kBAAkB,OAAK,KAAK,GAAI,GAC/B,CACT,CAAC;IACN,CAAC;IACD,IAAI,EAAE;QACF,gBAAgB,EAAE;YACd,OAAO,EAAE;gBACL;oBACI,EAAE,EAAE,SAAS;oBACb,KAAK,EAAE,MAAM;oBACb,IAAI,EAAE;wBACF,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAqB,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E,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,uCAAqB,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE;qBAC5H;iBACJ;aACJ;SACJ;KACJ;CACJ,CAAC","sourcesContent":["import type { IFlexibleGridLayoutProps } from \"../../components/layout/FlexibleGridLayout\";\r\nimport { FlexibleGridLayout } from \"../../components/layout/FlexibleGridLayout\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: FlexibleGridLayout };\r\n\r\nexport const Default: StoryObj<typeof FlexibleGridLayout> = {\r\n render: (props: IFlexibleGridLayoutProps) => {\r\n return (\r\n <div style={{ width: \"100%\", height: \"500px\" }}>\r\n <FlexibleGridLayout {...props} />\r\n </div>\r\n );\r\n },\r\n args: {\r\n layoutDefinition: {\r\n columns: [\r\n {\r\n id: \"column1\",\r\n width: \"100%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div>, title: \"Tab title 1\" }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div>, title: \"Tab 2\" }] },\r\n ],\r\n },\r\n ],\r\n },\r\n },\r\n};\r\n\r\nexport const TwoColumn: StoryObj<typeof FlexibleGridLayout> = {\r\n render: Default.render,\r\n args: {\r\n layoutDefinition: {\r\n columns: [\r\n {\r\n id: \"column1\",\r\n width: \"50%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div>, title: \"T1\" }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div>, title: \"T2\" }] },\r\n ],\r\n },\r\n {\r\n id: \"column2\",\r\n width: \"50%\",\r\n rows: [\r\n { id: \"row1\", height: \"50%\", selectedTab: \"tab1\", tabs: [{ id: \"tab1\", component: <div>Test tab 1</div>, title: \"T3\" }] },\r\n { id: \"row2\", height: \"50%\", selectedTab: \"tab2\", tabs: [{ id: \"tab2\", component: <div>Test tab 2</div>, title: \"T4\" }] },\r\n ],\r\n },\r\n ],\r\n },\r\n },\r\n};\r\n"]}
@@ -1,21 +1,7 @@
1
- /// <reference types="react" />
2
- import { Observable } from "@babylonjs/core/Misc/observable.js";
3
- import type { PropertyChangedEvent } from "../../propertyChangedEvent";
4
- import type { IColorLineComponentProps } from "../../components/lines/ColorLineComponent";
5
1
  import { ColorLineComponent } from "../../components/lines/ColorLineComponent";
2
+ import type { StoryObj } from "@storybook/react";
6
3
  declare const _default: {
7
4
  component: typeof ColorLineComponent;
8
5
  };
9
6
  export default _default;
10
- export declare const Default: {
11
- render: (args: IColorLineComponentProps) => JSX.Element;
12
- args: {
13
- target: {};
14
- label: string;
15
- propertyName: string;
16
- lockObject: {
17
- lock: boolean;
18
- };
19
- onPropertyChangedObservable: Observable<PropertyChangedEvent>;
20
- };
21
- };
7
+ export declare const Default: StoryObj<typeof ColorLineComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/ColorLineComponent.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;AAEjD,MAAM,yBAAyB,GAAG,IAAI,UAAU,EAAwB,CAAC;AAEzE,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,MAAM,EAAE,CAAC,IAA8B,EAAE,EAAE,CAAC,CACxC,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,YACpE,KAAC,kBAAkB,OAAK,IAAI,GAAI,GAC9B,CACT;IACD,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,2BAA2B,EAAE,yBAAyB,EAAE;CACjJ,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { PropertyChangedEvent } from \"../../propertyChangedEvent\";\r\nimport type { IColorLineComponentProps } from \"../../components/lines/ColorLineComponent\";\r\nimport { ColorLineComponent } from \"../../components/lines/ColorLineComponent\";\r\n\r\nexport default { component: ColorLineComponent };\r\n\r\nconst propertyChangedObservable = new Observable<PropertyChangedEvent>();\r\n\r\nexport const Default = {\r\n render: (args: IColorLineComponentProps) => (\r\n <div style={{ width: \"100%\", display: \"flex\", justifyContent: \"center\" }}>\r\n <ColorLineComponent {...args} />\r\n </div>\r\n ),\r\n args: { target: {}, label: \"test\", propertyName: \"test\", lockObject: { lock: false }, onPropertyChangedObservable: propertyChangedObservable },\r\n};\r\n"]}
1
+ {"version":3,"file":"ColorLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/ColorLineComponent.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,2CAA6B;AAGlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAG/E,eAAe,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;AAEjD,MAAM,yBAAyB,GAAG,IAAI,UAAU,EAAwB,CAAC;AAEzE,MAAM,CAAC,MAAM,OAAO,GAAwC;IACxD,MAAM,EAAE,CAAC,IAA8B,EAAE,EAAE,CAAC,CACxC,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,YACpE,KAAC,kBAAkB,OAAK,IAAI,GAAI,GAC9B,CACT;IACD,IAAI,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,2BAA2B,EAAE,yBAAyB,EAAE;CACjJ,CAAC","sourcesContent":["import { Observable } from \"core/Misc/observable\";\r\nimport type { PropertyChangedEvent } from \"../../propertyChangedEvent\";\r\nimport type { IColorLineComponentProps } from \"../../components/lines/ColorLineComponent\";\r\nimport { ColorLineComponent } from \"../../components/lines/ColorLineComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: ColorLineComponent };\r\n\r\nconst propertyChangedObservable = new Observable<PropertyChangedEvent>();\r\n\r\nexport const Default: StoryObj<typeof ColorLineComponent> = {\r\n render: (args: IColorLineComponentProps) => (\r\n <div style={{ width: \"100%\", display: \"flex\", justifyContent: \"center\" }}>\r\n <ColorLineComponent {...args} />\r\n </div>\r\n ),\r\n args: { target: {}, label: \"test\", propertyName: \"test\", lockObject: { lock: false }, onPropertyChangedObservable: propertyChangedObservable },\r\n};\r\n"]}
@@ -1,14 +1,7 @@
1
- /// <reference types="react" />
2
- import { Color3 } from "@babylonjs/core/Maths/math.color.js";
3
- import type { IColorPickerComponentProps } from "../../components/lines/ColorPickerLineComponent";
4
1
  import { ColorPickerLineComponent } from "../../components/lines/ColorPickerLineComponent";
2
+ import type { StoryObj } from "@storybook/react";
5
3
  declare const _default: {
6
4
  component: typeof ColorPickerLineComponent;
7
5
  };
8
6
  export default _default;
9
- export declare const Default: {
10
- render: (args: IColorPickerComponentProps) => JSX.Element;
11
- args: {
12
- value: Color3;
13
- };
14
- };
7
+ export declare const Default: StoryObj<typeof ColorPickerLineComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPickerLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/ColorPickerLineComponent.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,eAAe;IACX,SAAS,EAAE,wBAAwB;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,MAAM,EAAE,CAAC,IAAgC,EAAE,EAAE,CAAC,CAC1C,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,YACpE,KAAC,wBAAwB,OAAK,IAAI,GAAI,GACpC,CACT;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;CACvC,CAAC","sourcesContent":["import { Color3 } from \"core/Maths/math.color\";\r\nimport type { IColorPickerComponentProps } from \"../../components/lines/ColorPickerLineComponent\";\r\nimport { ColorPickerLineComponent } from \"../../components/lines/ColorPickerLineComponent\";\r\n\r\nexport default {\r\n component: ColorPickerLineComponent,\r\n};\r\n\r\nexport const Default = {\r\n render: (args: IColorPickerComponentProps) => (\r\n <div style={{ width: \"100%\", display: \"flex\", justifyContent: \"center\" }}>\r\n <ColorPickerLineComponent {...args} />\r\n </div>\r\n ),\r\n args: { value: new Color3(1, 0, 0) },\r\n};\r\n"]}
1
+ {"version":3,"file":"ColorPickerLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/ColorPickerLineComponent.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,4CAA8B;AAE/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAG3F,eAAe;IACX,SAAS,EAAE,wBAAwB;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAA8C;IAC9D,MAAM,EAAE,CAAC,IAAgC,EAAE,EAAE,CAAC,CAC1C,cAAK,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,YACpE,KAAC,wBAAwB,OAAK,IAAI,GAAI,GACpC,CACT;IACD,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE;CACvC,CAAC","sourcesContent":["import { Color3 } from \"core/Maths/math.color\";\r\nimport type { IColorPickerComponentProps } from \"../../components/lines/ColorPickerLineComponent\";\r\nimport { ColorPickerLineComponent } from \"../../components/lines/ColorPickerLineComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default {\r\n component: ColorPickerLineComponent,\r\n};\r\n\r\nexport const Default: StoryObj<typeof ColorPickerLineComponent> = {\r\n render: (args: IColorPickerComponentProps) => (\r\n <div style={{ width: \"100%\", display: \"flex\", justifyContent: \"center\" }}>\r\n <ColorPickerLineComponent {...args} />\r\n </div>\r\n ),\r\n args: { value: new Color3(1, 0, 0) },\r\n};\r\n"]}
@@ -1,6 +1,7 @@
1
1
  import { FileButtonLineComponent } from "../../components/lines/FileButtonLineComponent";
2
+ import type { StoryObj } from "@storybook/react";
2
3
  declare const _default: {
3
4
  component: typeof FileButtonLineComponent;
4
5
  };
5
6
  export default _default;
6
- export declare const Default: {};
7
+ export declare const Default: StoryObj<typeof FileButtonLineComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"FileButtonLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/FileButtonLineComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,eAAe;IACX,SAAS,EAAE,uBAAuB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC","sourcesContent":["import { FileButtonLineComponent } from \"../../components/lines/FileButtonLineComponent\";\r\n\r\nexport default {\r\n component: FileButtonLineComponent,\r\n};\r\n\r\nexport const Default = {};\r\n"]}
1
+ {"version":3,"file":"FileButtonLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/FileButtonLineComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAGzF,eAAe;IACX,SAAS,EAAE,uBAAuB;CACrC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAA6C,EAAE,CAAC","sourcesContent":["import { FileButtonLineComponent } from \"../../components/lines/FileButtonLineComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default {\r\n component: FileButtonLineComponent,\r\n};\r\n\r\nexport const Default: StoryObj<typeof FileButtonLineComponent> = {};\r\n"]}
@@ -1,11 +1,7 @@
1
1
  import { NumericInputComponent } from "../../components/lines/NumericInputComponent";
2
+ import type { StoryObj } from "@storybook/react";
2
3
  declare const _default: {
3
4
  component: typeof NumericInputComponent;
4
5
  };
5
6
  export default _default;
6
- export declare const Default: {
7
- args: {
8
- label: string;
9
- value: number;
10
- };
11
- };
7
+ export declare const Default: StoryObj<typeof NumericInputComponent>;
@@ -1 +1 @@
1
- {"version":3,"file":"NumericInputComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/NumericInputComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAErF,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,OAAO,GAAG;IACnB,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE;CACpC,CAAC","sourcesContent":["import { NumericInputComponent } from \"../../components/lines/NumericInputComponent\";\r\n\r\nexport default { component: NumericInputComponent };\r\n\r\nexport const Default = {\r\n args: { label: \"test\", value: 1 },\r\n};\r\n"]}
1
+ {"version":3,"file":"NumericInputComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/NumericInputComponent.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAGrF,eAAe,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC;AAEpD,MAAM,CAAC,MAAM,OAAO,GAA2C;IAC3D,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE;CACpC,CAAC","sourcesContent":["import { NumericInputComponent } from \"../../components/lines/NumericInputComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: NumericInputComponent };\r\n\r\nexport const Default: StoryObj<typeof NumericInputComponent> = {\r\n args: { label: \"test\", value: 1 },\r\n};\r\n"]}
@@ -0,0 +1,10 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from "@storybook/react";
3
+ declare const _default: {
4
+ component: (props: import("../../components/lines/OptionsLineComponent").IOptionsLineComponentProps) => JSX.Element;
5
+ };
6
+ export default _default;
7
+ declare const RenderComponent: (args: any) => JSX.Element;
8
+ export declare const Default: StoryObj<typeof RenderComponent>;
9
+ export declare const WithCustomOptions: StoryObj<typeof RenderComponent>;
10
+ export declare const WithValidation: StoryObj<typeof RenderComponent>;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import { OptionsLineComponent } from "../../components/lines/OptionsLineComponent.js";
4
+ export default { component: OptionsLineComponent };
5
+ const RenderComponent = (args) => {
6
+ const [options, setOptions] = useState(args.initialOptions);
7
+ const [selectedOptionValue, setSelectedOptionValue] = useState(args.initialSelectedOptionValue);
8
+ const onOptionSelected = (selectedOptionValue) => {
9
+ setSelectedOptionValue(selectedOptionValue);
10
+ };
11
+ const onOptionAdded = (newOption) => {
12
+ setOptions([...options, newOption]);
13
+ };
14
+ return (_jsxs("div", { style: { width: "200px" }, children: [_jsx(OptionsLineComponent, { options: options, onOptionSelected: onOptionSelected, selectedOptionValue: selectedOptionValue, onOptionAdded: args.customAdd ? onOptionAdded : undefined, addOptionPlaceholder: args.addOptionPlaceholder, validateNewOptionValue: args.validateNewOptionValue }), _jsxs("div", { children: [_jsx("h3", { children: "Selected option value:" }), _jsx("div", { children: selectedOptionValue })] })] }));
15
+ };
16
+ export const Default = {
17
+ render: (args) => {
18
+ return _jsx(RenderComponent, { ...args });
19
+ },
20
+ args: {
21
+ initialOptions: [
22
+ { label: "Option 1", value: "option1", id: "1" },
23
+ { label: "Option 2", value: "option2", id: "2" },
24
+ { label: "Option 3", value: "option3", id: "3" },
25
+ ],
26
+ initialSelectedOptionValue: "option1",
27
+ },
28
+ };
29
+ export const WithCustomOptions = {
30
+ render: Default.render,
31
+ args: { ...Default.args, customAdd: true, addOptionPlaceholder: "This is a placeholder" },
32
+ };
33
+ export const WithValidation = {
34
+ render: Default.render,
35
+ args: { ...Default.args, customAdd: true, addOptionPlaceholder: "Valid: length > 3", validateNewOptionValue: (value) => value.length > 3 },
36
+ };
37
+ //# sourceMappingURL=OptionsLineComponent.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OptionsLineComponent.stories.js","sourceRoot":"","sources":["../../../../../../dev/sharedUiComponents/src/stories/lines/OptionsLineComponent.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAGnF,eAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAEnD,MAAM,eAAe,GAAG,CAAC,IAAS,EAAE,EAAE;IAClC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5D,MAAM,CAAC,mBAAmB,EAAE,sBAAsB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;IAEhG,MAAM,gBAAgB,GAAG,CAAC,mB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C,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE,uBAAuB,EAAE;CAC5F,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAqC;IAC5D,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,IAAI,EAAE,EAAE,GAAG,OAAO,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;CACrJ,CAAC","sourcesContent":["import { useState } from \"react\";\r\nimport { OptionsLineComponent } from \"../../components/lines/OptionsLineComponent\";\r\nimport type { StoryObj } from \"@storybook/react\";\r\n\r\nexport default { component: OptionsLineComponent };\r\n\r\nconst RenderComponent = (args: any) => {\r\n const [options, setOptions] = useState(args.initialOptions);\r\n const [selectedOptionValue, setSelectedOptionValue] = useState(args.initialSelectedOptionValue);\r\n\r\n const onOptionSelected = (selectedOptionValue: string) => {\r\n setSelectedOptionValue(selectedOptionValue);\r\n };\r\n\r\n const onOptionAdded = (newOption: any) => {\r\n setOptions([...options, newOption]);\r\n };\r\n\r\n return (\r\n <div style={{ width: \"200px\" }}>\r\n <OptionsLineComponent\r\n options={options}\r\n onOptionSelected={onOptionSelected}\r\n selectedOptionValue={selectedOptionValue}\r\n onOptionAdded={args.customAdd ? onOptionAdded : undefined}\r\n addOptionPlaceholder={args.addOptionPlaceholder} // Placeholder text to display when adding a new option\r\n validateNewOptionValue={args.validateNewOptionValue} // Optional function that can be used to validate the value of a new option\r\n />\r\n <div>\r\n <h3>Selected option value:</h3>\r\n <div>{selectedOptionValue}</div>\r\n </div>\r\n </div>\r\n );\r\n};\r\n\r\nexport const Default: StoryObj<typeof RenderComponent> = {\r\n render: (args: any) => {\r\n return <RenderComponent {...args} />;\r\n },\r\n args: {\r\n initialOptions: [\r\n { label: \"Option 1\", value: \"option1\", id: \"1\" },\r\n { label: \"Option 2\", value: \"option2\", id: \"2\" },\r\n { label: \"Option 3\", value: \"option3\", id: \"3\" },\r\n ],\r\n initialSelectedOptionValue: \"option1\",\r\n },\r\n};\r\n\r\nexport const WithCustomOptions: StoryObj<typeof RenderComponent> = {\r\n render: Default.render,\r\n args: { ...Default.args, customAdd: true, addOptionPlaceholder: \"This is a placeholder\" },\r\n};\r\n\r\nexport const WithValidation: StoryObj<typeof RenderComponent> = {\r\n render: Default.render,\r\n args: { ...Default.args, customAdd: true, addOptionPlaceholder: \"Valid: length > 3\", validateNewOptionValue: (value: string) => value.length > 3 },\r\n};\r\n"]}