@lumiastream/ui 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +67 -21
- package/dist/index.js +1151 -260
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,29 +21,57 @@ function styleInject(css, { insertAt } = {}) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
// src/lumia-ui.css
|
|
24
|
-
styleInject(".ls-button,\n.ls-button *,\n.ls-color-picker,\n.ls-color-picker *,\n.mui-multi-select,\n.mui-multi-select *,\n.ls-multi-select-value,\n.ls-multi-select-value *,\n.ls-variable-picker,\n.ls-variable-picker *,\n.ls-variable-token,\n.ls-variable-token *,\n.ls-font-picker,\n.ls-font-picker *,\n.mui-ls-input,\n.mui-ls-input * {\n box-sizing: border-box;\n}\n.ls-button,\n.ls-color-picker button,\n.mui-multi-select button {\n font: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n}\n.ls-button,\n.ls-color-picker__preview {\n appearance: none;\n -webkit-appearance: none;\n background-color: transparent;\n background-image: none;\n cursor: pointer;\n text-transform: none;\n user-select: none;\n}\n.ls-button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 0.5rem;\n border-radius: var(--radiusContainerSm, 0.375rem);\n border: 1px solid color-mix(in srgb, #fff 10%, transparent);\n color: var(--neutralLight1, #f4f3ff);\n font-weight: 500;\n box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);\n transition:\n filter 150ms cubic-bezier(0.4, 0, 0.2, 1),\n opacity 150ms cubic-bezier(0.4, 0, 0.2, 1),\n box-shadow 150ms cubic-bezier(0.4, 0, 0.2, 1);\n white-space: nowrap;\n}\n.ls-button--small {\n padding-inline: 0.75rem;\n padding-block: 0.25rem;\n font-size: 0.875rem;\n line-height: 1.25rem;\n}\n.ls-button--medium {\n padding-inline: 1rem;\n padding-block: 0.5rem;\n font-size: 1rem;\n line-height: 1.5rem;\n}\n.ls-button--large {\n padding-inline: 1.5rem;\n padding-block: 0.75rem;\n font-size: 1.125rem;\n line-height: 1.75rem;\n}\n.ls-button:hover {\n filter: brightness(1.1);\n}\n.ls-button:focus {\n outline: none;\n}\n.ls-button:focus-visible {\n box-shadow:\n 0 0 0 2px var(--primary, #ff4076),\n 0 0 0 4px var(--neutralDark1, #1b1a28),\n 0 8px 18px rgba(0, 0, 0, 0.18);\n}\n.ls-button:active {\n filter: brightness(0.95);\n}\n.ls-button:disabled,\n.ls-button[aria-disabled=true] {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.ls-button:disabled:hover,\n.ls-button[aria-disabled=true]:hover {\n filter: none;\n}\n.mui-ls-input,\n.ls-font-picker,\n.ls-color-picker__input {\n width: 100%;\n}\n.mui-multi-select .MuiSelect-select {\n min-width: 0;\n}\n.ls-multi-select-value {\n display: flex;\n width: 100%;\n min-width: 0;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n overflow: hidden;\n white-space: nowrap;\n}\n.ls-multi-select-value__label {\n min-width: 0;\n flex: 1 1 0%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ls-multi-select-value__count {\n flex-shrink: 0;\n white-space: nowrap;\n}\n.ls-color-picker__preview {\n position: relative;\n display: inline-block;\n width: 1.5rem;\n height: 1.5rem;\n flex-shrink: 0;\n padding: 0;\n border: 1px solid color-mix(in srgb, #fff 25%, transparent);\n border-radius: var(--radiusContainerSm, 0.375rem);\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);\n color: transparent;\n line-height: 0;\n}\n.ls-color-picker__preview:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.ls-color-picker__preview:focus {\n outline: none;\n}\n.ls-color-picker__preview:focus-visible {\n box-shadow:\n 0 0 0 2px var(--primary, #ff4076),\n 0 0 0 4px var(--neutralDark1, #1b1a28),\n 0 0 0 1px rgba(0, 0, 0, 0.25);\n}\n.ls-color-picker__gradient circle,\n.ls-color-picker__gradient polyline {\n stroke: #fff;\n}\n.ls-variable-picker {\n --variable-custom-color: var(--customVariables, #69ffd2);\n --variable-function-color: var(--functionVariables, var(--semanticPurple, #b489ff));\n --variable-normal-color: var(--normalVariables, var(--semanticBlue, #65b8ff));\n display: flex;\n width: 92vw;\n max-width: 1100px;\n min-height: 50vh;\n max-height: 55vh;\n flex-direction: column;\n overflow: hidden;\n}\n.ls-variable-picker__intro {\n margin-bottom: 1rem;\n color: var(--neutralLight2, #cac9d5);\n}\n.ls-variable-picker__header,\n.ls-variable-picker__row {\n display: grid;\n grid-template-columns: minmax(300px, 1.5fr) 2fr;\n gap: 2rem;\n}\n.ls-variable-picker__header {\n margin-bottom: 0.25rem;\n padding-inline: 0.25rem;\n color: var(--neutralLight3, #9392a1);\n}\n.ls-variable-picker__list {\n height: 100%;\n overflow: auto;\n padding-right: 1rem;\n}\n.ls-variable-picker__row {\n cursor: pointer;\n align-items: start;\n border-bottom: 1px solid color-mix(in srgb, #fff 10%, transparent);\n padding: 1rem 0.25rem;\n}\n.ls-variable-picker__row:active {\n opacity: 0.8;\n}\n.ls-variable-picker__description {\n max-width: 600px;\n overflow-wrap: break-word;\n line-height: 1.25;\n}\n.ls-variable-token {\n display: flex;\n min-width: 0;\n align-items: center;\n}\n.ls-variable-token--custom {\n color: var(--customVariables, #69ffd2);\n}\n.ls-variable-token--function {\n color: var(--functionVariables, var(--semanticPurple, #b489ff));\n}\n.ls-variable-token--system {\n color: var(--normalVariables, var(--semanticBlue, #65b8ff));\n}\n.ls-variable-token__name {\n min-width: 0;\n word-break: break-all;\n}\n.ls-variable-token__badge {\n display: inline-flex;\n margin-left: 0.5rem;\n flex-shrink: 0;\n align-items: center;\n border: 1px solid currentcolor;\n border-radius: 0.25rem;\n padding-inline: 0.25rem;\n padding-block: 0;\n font-size: 10px;\n font-weight: 600;\n line-height: 1;\n text-transform: uppercase;\n}\n");
|
|
24
|
+
styleInject(".ls-color-picker,\n.ls-color-picker *,\n.mui-multi-select,\n.mui-multi-select *,\n.ls-multi-select-value,\n.ls-multi-select-value *,\n.ls-variable-picker,\n.ls-variable-picker *,\n.ls-variable-token,\n.ls-variable-token *,\n.ls-font-picker,\n.ls-font-picker *,\n.mui-ls-input,\n.mui-ls-input * {\n box-sizing: border-box;\n}\n.ls-color-picker button,\n.mui-multi-select button {\n font: inherit;\n letter-spacing: inherit;\n color: inherit;\n margin: 0;\n}\n.ls-color-picker__preview {\n appearance: none;\n -webkit-appearance: none;\n background-color: transparent;\n background-image: none;\n cursor: pointer;\n text-transform: uppercase;\n user-select: none;\n}\n.mui-ls-button.Mui-disabled {\n color: var(--neutralLight2, var(--white2, #cac9d5));\n opacity: 0.45;\n background-color: var(--separator, #0a0821);\n cursor: not-allowed;\n}\n.mui-ls-button {\n border-radius: var(--radius, 1rem);\n padding: 0.375rem 1.5rem;\n text-transform: uppercase;\n}\n.mui-ls-button.MuiButton-sizeSmall {\n padding: 0.25rem 1rem;\n}\n.mui-ls-button.MuiButton-sizeLarge {\n padding: 0.625rem 2rem;\n}\n.mui-ls-button--extended {\n padding-inline: 3rem;\n}\n.mui-ls-button.MuiButton-containedPrimary,\n.mui-ls-button.Mui-disabled.MuiButton-containedPrimary {\n background: var(--primary, #ff4076);\n color: var(--alwayswhite, #fff) !important;\n}\n.mui-ls-button.MuiButton-containedSecondary {\n background-color: var(--secondary, #535395);\n color: var(--alwayswhite, #fff) !important;\n}\n.mui-ls-button.Mui-disabled.MuiButton-containedSecondary {\n background-color: var(--secondary, #535395);\n color: var(--neutralLight2, var(--white2, #cac9d5));\n opacity: 0.4;\n}\n.mui-ls-button.MuiButton-outlinedPrimary {\n color: var(--primary, #ff4076);\n border-color: var(--primary, #ff4076);\n}\n.mui-ls-button.MuiButton-outlinedPrimary:hover {\n border-color: var(--primary, #ff4076);\n background-color: color-mix(in srgb, var(--primary, #ff4076) 12%, transparent);\n}\n.mui-ls-button.MuiButton-outlinedSecondary {\n color: var(--neutralLight1, var(--white, #fff));\n border-color: var(--secondary, #535395);\n}\n.mui-ls-button.MuiButton-outlinedSecondary.Mui-disabled {\n color: var(--neutralLight2, var(--white2, #cac9d5));\n border-color: var(--neutralDark4, var(--cardborder, #393853));\n background-color: var(--transwhite, rgba(255, 255, 255, 0.05));\n opacity: 0.5;\n}\n.mui-ls-button.MuiButton-outlinedSecondary:hover {\n border-color: var(--secondary, #535395);\n background-color: var(--transwhite, rgba(255, 255, 255, 0.05));\n}\n.mui-ls-button.MuiButton-containedError {\n color: var(--alwayswhite, #fff) !important;\n}\n.mui-ls-button.MuiButton-outlinedError {\n color: var(--error, #fd5454);\n border-color: var(--error, #fd5454);\n}\n.mui-ls-button.MuiButton-outlinedError:hover {\n border-color: var(--error, #fd5454);\n background-color: color-mix(in srgb, var(--error, #fd5454) 12%, transparent);\n}\n.mui-ls-button--neutral.mui-ls-button--contained {\n background-color: var(--neutralDark4, var(--cardborder, #393853));\n color: var(--neutralLight1, var(--white, #fff)) !important;\n}\n.mui-ls-button--neutral.mui-ls-button--contained:hover {\n background-color: color-mix(in srgb, var(--neutralDark4, var(--cardborder, #393853)) 82%, var(--neutralLight1, #fff));\n}\n.mui-ls-button--neutral.mui-ls-button--outlined {\n color: var(--neutralLight1, var(--white, #fff));\n border-color: var(--neutralDark4, var(--cardborder, #393853));\n background-color: transparent;\n}\n.mui-ls-button--neutral.mui-ls-button--outlined:hover {\n border-color: var(--neutralLight3, var(--grey, #9392a1));\n background-color: var(--transwhite, rgba(255, 255, 255, 0.05));\n}\n.mui-ls-button--neutral.mui-ls-button--text {\n color: var(--neutralLight1, var(--white, #fff));\n}\n.mui-ls-button--neutral.mui-ls-button--text:hover {\n background-color: var(--transwhite, rgba(255, 255, 255, 0.05));\n}\n.mui-ls-button svg {\n max-height: 24px;\n max-width: 24px;\n}\n.mui-ls-input,\n.ls-font-picker,\n.ls-color-picker__input {\n width: 100%;\n}\n.mui-ls-input,\n.mui-ls-select-form-control,\n.mui-multi-select,\n.ls-font-picker,\n.mui-ls-slider-input-root {\n --ls-control-height: 55px;\n}\n.mui-ls-input .MuiOutlinedInput-root,\n.mui-ls-input .MuiInputBase-root,\n.mui-ls-input .MuiOutlinedInput-notchedOutline,\n.mui-ls-select.MuiOutlinedInput-root,\n.mui-ls-select .MuiOutlinedInput-notchedOutline,\n.mui-multi-select .mui-ls-select.MuiOutlinedInput-root,\n.mui-multi-select .mui-ls-select .MuiOutlinedInput-notchedOutline,\n.ls-font-picker .MuiOutlinedInput-root,\n.ls-font-picker .MuiInputBase-root,\n.ls-font-picker .MuiOutlinedInput-notchedOutline,\n.ls-color-picker__input .MuiOutlinedInput-root,\n.ls-color-picker__input .MuiInputBase-root,\n.ls-color-picker__input .MuiOutlinedInput-notchedOutline {\n border-radius: var(--radius) !important;\n}\n.mui-ls-input .MuiInputBase-root,\n.mui-ls-select.MuiInputBase-root,\n.mui-multi-select .mui-ls-select.MuiInputBase-root,\n.ls-font-picker .MuiInputBase-root {\n min-height: var(--ls-control-height);\n}\n.mui-ls-input.small .MuiInputBase-root {\n min-height: 25px;\n}\n.mui-ls-input.medium .MuiInputBase-root {\n min-height: 35px;\n}\n.mui-ls-input.noMinHeight .MuiInputBase-root {\n min-height: unset;\n}\n.mui-ls-select .MuiSelect-select,\n.mui-multi-select .MuiSelect-select {\n display: flex;\n min-height: calc(var(--ls-control-height) - 2px);\n align-items: center;\n box-sizing: border-box;\n border-radius: var(--radius);\n}\n.mui-multi-select .MuiSelect-select {\n min-width: 0;\n}\n.MuiSvgIcon-root svg {\n color: var(--neutralLight1, var(--white, #fff)) !important;\n}\n.mui-ls-input .MuiSvgIcon-root svg path {\n fill: currentcolor;\n stroke: currentcolor;\n}\n.mui-ls-input .Mui-focused .MuiOutlinedInput-notchedOutline,\n.mui-ls-input .MuiOutlinedInput-root.Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: var(--primary, #ff4076) !important;\n}\n.ls-variable-autocomplete-popper .MuiAutocomplete-paper,\n.ls-variable-autocomplete-paper {\n border: 1px solid var(--neutralDark4, var(--cardborder, #393853)) !important;\n border-radius: var(--radius, 1rem) !important;\n background: var(--neutralDark2, var(--cardbackground, #211f45)) !important;\n color: var(--neutralLight1, var(--white, #fff)) !important;\n box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32) !important;\n overflow: hidden !important;\n}\n.ls-variable-autocomplete-popper .MuiAutocomplete-listbox,\n.ls-variable-autocomplete-listbox {\n padding: 0.25rem 0 !important;\n background: var(--neutralDark2, var(--cardbackground, #211f45)) !important;\n color: var(--neutralLight1, var(--white, #fff)) !important;\n}\n.ls-variable-autocomplete-popper .MuiAutocomplete-option,\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option {\n display: flex !important;\n min-height: 44px !important;\n align-items: center !important;\n padding: 0.625rem 1rem !important;\n color: var(--neutralLight1, var(--white, #fff)) !important;\n font-size: 1rem !important;\n line-height: 1.35 !important;\n cursor: pointer !important;\n transition: background-color 120ms ease, color 120ms ease !important;\n}\n.ls-variable-autocomplete-popper .MuiAutocomplete-option > *,\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option > * {\n min-width: 0;\n}\n.ls-variable-autocomplete-popper .MuiAutocomplete-option:hover,\n.ls-variable-autocomplete-popper .MuiAutocomplete-option.Mui-focused,\n.ls-variable-autocomplete-popper .MuiAutocomplete-option[data-focus=true],\n.ls-variable-autocomplete-popper .MuiAutocomplete-option[aria-selected=true],\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option:hover,\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option.Mui-focused,\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option[data-focus=true],\n.ls-variable-autocomplete-listbox .MuiAutocomplete-option[aria-selected=true] {\n background: var( --cardHover, var(--transwhite, rgba(255, 255, 255, 0.05)) ) !important;\n color: var(--neutralLight1, var(--white, #fff)) !important;\n}\n.ls-variable-option {\n gap: 0.75rem;\n}\n.ls-variable-option__thumb {\n width: 40px;\n height: 40px;\n flex: 0 0 40px;\n border-radius: var(--radius, 1rem);\n object-fit: cover;\n}\n.ls-variable-option__thumb--placeholder {\n background: var(--neutralDark4, var(--cardborder, #393853));\n}\n.ls-variable-option__body {\n min-width: 0;\n}\n.ls-variable-option__label {\n color: var(--neutralLight1, var(--white, #fff));\n font-weight: 500;\n line-height: 1.25;\n}\n.ls-variable-option__helper {\n margin-top: 0.125rem;\n color: var(--neutralLight3, var(--grey, #9392a1));\n font-size: 0.875rem;\n line-height: 1.25;\n}\n.ls-variable-autocomplete-popup-indicator,\n.ls-variable-autocomplete-popup-indicator.MuiIconButton-root,\n.ls-variable-autocomplete-popup-indicator svg {\n color: var(--neutralLight1, var(--white, #fff)) !important;\n}\n.ls-variable-autocomplete-popup-indicator svg path {\n fill: currentcolor !important;\n stroke: currentcolor !important;\n}\n.ls-variable-input-adornment,\n.ls-variable-input-adornment.MuiInputAdornment-root {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n width: 24px;\n min-width: 24px;\n margin-left: 0.35rem;\n border-radius: var(--radius, 1rem);\n background: var(--primary, #ff4076) !important;\n color: var(--alwayswhite, var(--white, #fff)) !important;\n font-weight: 800;\n line-height: 1;\n letter-spacing: 0;\n cursor: pointer;\n user-select: none;\n}\n.ls-variable-input-adornment svg,\n.ls-variable-input-adornment path {\n color: currentcolor !important;\n fill: currentcolor !important;\n stroke: currentcolor !important;\n}\n.ls-variable-input-adornment:hover,\n.ls-variable-input-adornment.MuiInputAdornment-root:hover {\n filter: brightness(1.08);\n}\n.ls-variable-input-adornment:active,\n.ls-variable-input-adornment.MuiInputAdornment-root:active {\n filter: brightness(0.96);\n}\n.mui-ls-slider-input-root {\n width: 100%;\n}\n.mui-ls-slider-input-fieldset {\n position: relative;\n min-width: 0;\n width: 100%;\n min-height: var(--ls-control-height);\n margin: 0;\n border: 2px solid var(--neutralDark4, var(--cardborder, #393853));\n border-radius: var(--radius, 1rem);\n padding: 0 0.875rem 0.5rem 0.875rem;\n background: transparent;\n color: var(--neutralLight1, var(--white, #fff));\n}\n.mui-ls-slider-input-fieldset:hover {\n border-color: var(--primary, #ff4076);\n}\n.mui-ls-slider-input-legend {\n display: block;\n width: auto;\n max-width: calc(100% - 1rem);\n margin: 0;\n padding: 0 0.25rem;\n color: var(--neutralLight1, var(--white, #fff));\n font-size: 0.875rem;\n line-height: 1.1;\n white-space: nowrap;\n}\n.mui-ls-slider-input-row {\n display: flex;\n min-width: 0;\n min-height: calc(var(--ls-control-height) - 14px);\n align-items: center;\n gap: 1rem;\n}\n.mui-ls-slider-input-row--slider {\n flex-wrap: nowrap;\n}\n.mui-ls-slider-input-row--input {\n justify-content: stretch;\n}\n.mui-ls-slider-input-value.mui-ls-input {\n margin: 0;\n}\n.mui-ls-slider-input-value.mui-ls-input .MuiFormControl-root,\n.mui-ls-slider-input-value.mui-ls-input .MuiTextField-root {\n margin: 0;\n}\n.mui-ls-slider-input-value.mui-ls-input .MuiInputBase-root {\n min-height: 36px;\n}\n.mui-ls-slider-input-value.mui-ls-input .MuiOutlinedInput-notchedOutline {\n border-color: var(--neutralDark4, var(--cardborder, #393853));\n}\n.mui-ls-slider-input-helper {\n display: block;\n margin-top: 0.25rem;\n color: var(--neutralLight3, var(--grey, #9392a1));\n font-size: 0.75rem;\n line-height: 1.25;\n}\n.ls-multi-select-value {\n display: flex;\n width: 100%;\n min-width: 0;\n flex-wrap: nowrap;\n align-items: center;\n justify-content: space-between;\n gap: 0.5rem;\n overflow: hidden;\n white-space: nowrap;\n}\n.ls-multi-select-value__label {\n min-width: 0;\n flex: 1 1 0%;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.ls-multi-select-value__count {\n flex-shrink: 0;\n white-space: nowrap;\n}\n.ls-color-picker__preview {\n position: relative;\n display: inline-block;\n width: 1.5rem;\n height: 1.5rem;\n flex-shrink: 0;\n padding: 0;\n border: 1px solid color-mix(in srgb, #fff 25%, transparent);\n border-radius: var(--radius, 1rem);\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);\n color: transparent;\n line-height: 0;\n}\n.ls-color-picker__preview:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n}\n.ls-color-picker__preview:focus {\n outline: none;\n}\n.ls-color-picker__preview:focus-visible {\n box-shadow:\n 0 0 0 2px var(--primary, #ff4076),\n 0 0 0 4px var(--neutralDark1, #1b1a28),\n 0 0 0 1px rgba(0, 0, 0, 0.25);\n}\n.ls-color-picker__gradient circle,\n.ls-color-picker__gradient polyline {\n stroke: #fff;\n}\n.ls-variable-picker {\n --variable-custom-color: var(--customVariables, #69ffd2);\n --variable-function-color: var( --functionVariables, var(--semanticPurple, #b489ff) );\n --variable-normal-color: var(--normalVariables, var(--semanticBlue, #65b8ff));\n display: flex;\n width: 92vw;\n max-width: 1100px;\n min-height: 50vh;\n max-height: 55vh;\n flex-direction: column;\n overflow: hidden;\n padding: 1rem;\n}\n.ls-variable-picker__field {\n margin: 0 0 0.75rem;\n border: 1px solid color-mix(in srgb, var(--primary, #ff4076) 42%, var(--neutralDark4, #393853));\n border-radius: var(--radius, 1rem);\n padding: 0.5rem;\n}\n.ls-variable-picker__legend {\n padding-inline: 0.375rem;\n color: var(--primary, #ff4076);\n font-size: 0.75rem;\n font-weight: 700;\n}\n.ls-variable-picker__intro {\n margin-bottom: 1rem;\n color: var(--neutralLight2, #cac9d5);\n}\n.ls-variable-picker__header,\n.ls-variable-picker__row {\n display: grid;\n grid-template-columns: minmax(300px, 1.5fr) 1fr 1fr;\n gap: 2rem;\n}\n.ls-variable-picker__header {\n margin-bottom: 0.25rem;\n padding-inline: 0.25rem;\n padding-right: 1.7rem;\n color: var(--neutralLight3, #9392a1);\n}\n.ls-variable-picker__list {\n height: 100%;\n overflow: auto;\n padding-right: 1rem;\n}\n.ls-variable-picker__row {\n cursor: pointer;\n align-items: start;\n border-bottom: 1px solid color-mix(in srgb, var(--neutralDark4, #393853) 70%, transparent);\n padding: 1rem 0.25rem;\n}\n.ls-variable-picker__row--no-border {\n border-bottom: 0;\n}\n.ls-variable-picker__token-cell {\n display: flex;\n min-width: 0;\n align-items: center;\n gap: 0.375rem;\n}\n.ls-variable-picker__expand-toggle,\n.ls-variable-picker__expand-spacer {\n width: 24px;\n height: 24px;\n flex: 0 0 24px;\n}\n.ls-variable-picker__expand-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n border: 1px solid color-mix(in srgb, var(--neutralDark4, #393853) 75%, transparent);\n border-radius: var(--radius, 1rem);\n padding: 0;\n background: var(--neutralDark3, var(--containerbackground, #1f1f3a));\n color: var(--neutralLight2, #cac9d5);\n transition:\n background-color 140ms ease,\n border-color 140ms ease,\n color 140ms ease,\n transform 140ms ease;\n}\n.ls-variable-picker__expand-toggle:hover {\n border-color: var(--primary, #ff4076);\n background: color-mix(in srgb, var(--primary, #ff4076) 16%, var(--neutralDark3, #1f1f3a));\n color: var(--neutralLight1, #fff);\n}\n.ls-variable-picker__expand-toggle svg {\n transform: rotate(-90deg);\n transition: transform 140ms ease;\n}\n.ls-variable-picker__expand-toggle--expanded svg {\n transform: rotate(0deg);\n}\n.ls-variable-picker__row:active {\n opacity: 0.8;\n}\n.ls-variable-picker__description {\n max-width: 600px;\n overflow-wrap: break-word;\n line-height: 1.25;\n word-break: break-all;\n}\n.ls-variable-picker__value {\n min-width: 0;\n}\n.ls-variable-picker__value-input {\n width: 100%;\n min-width: 0;\n cursor: text;\n overflow: hidden;\n border: 0;\n background: transparent;\n color: var(--neutralLight1, var(--white, #fff));\n caret-color: transparent;\n font: inherit;\n font-size: 1rem;\n line-height: 1.25;\n outline: 0;\n padding: 0;\n text-overflow: ellipsis;\n}\n.ls-variable-picker__value-input:focus {\n outline: 0;\n}\n.ls-variable-picker__value-input::selection {\n background: color-mix(in srgb, var(--primary, #ff4076) 45%, transparent);\n color: var(--alwayswhite, var(--white, #fff));\n}\n.ls-variable-token {\n display: flex;\n min-width: 0;\n align-items: center;\n}\n.ls-variable-token--custom {\n color: var(--customVariables, #69ffd2);\n}\n.ls-variable-token--function {\n color: var(--functionVariables, var(--semanticPurple, #b489ff));\n}\n.ls-variable-token--system {\n color: var(--normalVariables, var(--semanticBlue, #65b8ff));\n}\n.ls-variable-token__name {\n min-width: 0;\n word-break: break-all;\n}\n.ls-variable-token__badge {\n display: inline-flex;\n margin-left: 0.5rem;\n flex-shrink: 0;\n align-items: center;\n border: 1px solid currentcolor;\n border-radius: var(--radius, 1rem);\n padding-inline: 0.25rem;\n padding-block: 0;\n font-size: 10px;\n font-weight: 600;\n line-height: 1;\n text-transform: uppercase;\n}\n");
|
|
25
25
|
|
|
26
26
|
// src/components/LSButton/LSButton.tsx
|
|
27
|
+
import Button from "@mui/material/Button";
|
|
28
|
+
import classNames from "classnames";
|
|
27
29
|
import { jsx } from "react/jsx-runtime";
|
|
28
30
|
var LSButton = ({
|
|
31
|
+
label,
|
|
32
|
+
disabled = false,
|
|
33
|
+
loading = false,
|
|
34
|
+
variant = "contained",
|
|
35
|
+
extended = 0,
|
|
36
|
+
color,
|
|
29
37
|
primary = false,
|
|
30
|
-
size = "medium",
|
|
31
38
|
backgroundColor,
|
|
32
|
-
|
|
39
|
+
className,
|
|
40
|
+
sx,
|
|
41
|
+
style,
|
|
33
42
|
...props
|
|
34
43
|
}) => {
|
|
35
|
-
const
|
|
44
|
+
const resolvedColor = color ?? (primary ? "primary" : "primary");
|
|
45
|
+
const muiColor = resolvedColor === "neutral" ? void 0 : resolvedColor;
|
|
46
|
+
const backgroundSx = backgroundColor ? { backgroundColor, "&:hover": { backgroundColor } } : null;
|
|
47
|
+
const secondaryOutlinedStyles = resolvedColor === "secondary" && variant === "outlined" ? {
|
|
48
|
+
color: "var(--white) !important",
|
|
49
|
+
"& .MuiButton-startIcon, & .MuiButton-endIcon": {
|
|
50
|
+
color: "inherit"
|
|
51
|
+
}
|
|
52
|
+
} : null;
|
|
36
53
|
return /* @__PURE__ */ jsx(
|
|
37
|
-
|
|
54
|
+
Button,
|
|
38
55
|
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
disabled: disabled || loading,
|
|
57
|
+
variant,
|
|
58
|
+
color: muiColor,
|
|
59
|
+
style,
|
|
60
|
+
sx: [
|
|
61
|
+
{ borderRadius: "1rem", transition: "opacity 300ms ease-in-out" },
|
|
62
|
+
...backgroundSx ? [backgroundSx] : [],
|
|
63
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : [],
|
|
64
|
+
...secondaryOutlinedStyles ? [secondaryOutlinedStyles] : []
|
|
65
|
+
],
|
|
66
|
+
className: classNames(
|
|
67
|
+
"mui-ls-button cursor-pointer rounded-2xl pb-1.5 pt-1.5 hover:opacity-80 svg-current-color",
|
|
68
|
+
extended ? "pl-12 pr-12 mui-ls-button--extended" : "pl-6 pr-6",
|
|
69
|
+
`mui-ls-button--${resolvedColor}`,
|
|
70
|
+
`mui-ls-button--${variant}`,
|
|
71
|
+
className
|
|
72
|
+
),
|
|
45
73
|
...props,
|
|
46
|
-
children: label
|
|
74
|
+
children: loading ? "Loading..." : label
|
|
47
75
|
}
|
|
48
76
|
);
|
|
49
77
|
};
|
|
@@ -52,7 +80,7 @@ var LSButton = ({
|
|
|
52
80
|
import FormControl from "@mui/material/FormControl";
|
|
53
81
|
import InputAdornment from "@mui/material/InputAdornment";
|
|
54
82
|
import TextField from "@mui/material/TextField";
|
|
55
|
-
import
|
|
83
|
+
import classNames2 from "classnames";
|
|
56
84
|
import { forwardRef } from "react";
|
|
57
85
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
58
86
|
var LSInput = forwardRef(
|
|
@@ -149,7 +177,7 @@ var LSInput = forwardRef(
|
|
|
149
177
|
FormControl,
|
|
150
178
|
{
|
|
151
179
|
variant: "outlined",
|
|
152
|
-
className:
|
|
180
|
+
className: classNames2("mui-ls-input", className, {
|
|
153
181
|
noMinHeight: $noMinHeight,
|
|
154
182
|
bypassMuiColor: bypasscolor || bypasscolor === "default"
|
|
155
183
|
}),
|
|
@@ -182,7 +210,7 @@ LSInput.displayName = "LSInput";
|
|
|
182
210
|
|
|
183
211
|
// src/components/LSSliderInput/LSSliderInput.tsx
|
|
184
212
|
import Slider from "@mui/material/Slider";
|
|
185
|
-
import
|
|
213
|
+
import classNames3 from "classnames";
|
|
186
214
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
187
215
|
import { jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
188
216
|
var normalizeSliderValue = (rawValue) => {
|
|
@@ -301,7 +329,7 @@ var LSSliderInput = ({
|
|
|
301
329
|
const controlsRow = /* @__PURE__ */ jsxs(
|
|
302
330
|
"div",
|
|
303
331
|
{
|
|
304
|
-
className:
|
|
332
|
+
className: classNames3("mui-ls-slider-input-row", {
|
|
305
333
|
"mui-ls-slider-input-row--slider": !hideSlider,
|
|
306
334
|
"mui-ls-slider-input-row--input": hideInput
|
|
307
335
|
}),
|
|
@@ -342,28 +370,20 @@ var LSSliderInput = ({
|
|
|
342
370
|
inputMode: stepPrecision > 0 ? "decimal" : "numeric"
|
|
343
371
|
},
|
|
344
372
|
fullWidth: hideSlider ? fullWidth : false,
|
|
345
|
-
$noMinHeight:
|
|
346
|
-
className: hideSlider ? inputProps?.className : `${inputProps?.className ?? ""}
|
|
347
|
-
style: hideSlider ? inputProps?.style : { width:
|
|
373
|
+
$noMinHeight: false,
|
|
374
|
+
className: hideSlider ? inputProps?.className : `${inputProps?.className ?? ""} mui-ls-slider-input-value`.trim(),
|
|
375
|
+
style: hideSlider ? inputProps?.style : { width: 112, maxWidth: 112, flexShrink: 0 },
|
|
348
376
|
...!hideSlider ? { size: "small" } : {}
|
|
349
377
|
}
|
|
350
378
|
)
|
|
351
379
|
]
|
|
352
380
|
}
|
|
353
381
|
);
|
|
354
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
355
|
-
/* @__PURE__ */ jsxs(
|
|
356
|
-
"
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
"mui-ls-slider-input-fieldset--fullWidth": fullWidth
|
|
360
|
-
}),
|
|
361
|
-
children: [
|
|
362
|
-
label && /* @__PURE__ */ jsx3("legend", { className: "mui-ls-slider-input-legend", children: label }),
|
|
363
|
-
controlsRow
|
|
364
|
-
]
|
|
365
|
-
}
|
|
366
|
-
),
|
|
382
|
+
return /* @__PURE__ */ jsxs("div", { className: "mui-ls-slider-input-root", children: [
|
|
383
|
+
/* @__PURE__ */ jsxs("fieldset", { className: "mui-ls-slider-input-fieldset", children: [
|
|
384
|
+
label && /* @__PURE__ */ jsx3("legend", { className: "mui-ls-slider-input-legend", children: label }),
|
|
385
|
+
controlsRow
|
|
386
|
+
] }),
|
|
367
387
|
helperText && /* @__PURE__ */ jsx3("small", { className: "mui-ls-slider-input-helper", children: helperText })
|
|
368
388
|
] });
|
|
369
389
|
};
|
|
@@ -374,8 +394,19 @@ import FormControl2 from "@mui/material/FormControl";
|
|
|
374
394
|
import InputLabel from "@mui/material/InputLabel";
|
|
375
395
|
import Select from "@mui/material/Select";
|
|
376
396
|
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
377
|
-
var LSSelect = ({
|
|
378
|
-
|
|
397
|
+
var LSSelect = ({
|
|
398
|
+
className = "",
|
|
399
|
+
style,
|
|
400
|
+
...props
|
|
401
|
+
}) => {
|
|
402
|
+
const {
|
|
403
|
+
placeholder,
|
|
404
|
+
displayEmpty: displayEmptyProp,
|
|
405
|
+
renderValue: renderValueProp,
|
|
406
|
+
variant: _variant,
|
|
407
|
+
MenuProps,
|
|
408
|
+
...rest
|
|
409
|
+
} = props;
|
|
379
410
|
const labelKey = props.name ?? (typeof props.label === "string" ? props.label : void 0);
|
|
380
411
|
const labelId = props.label && labelKey ? `label_${labelKey}` : void 0;
|
|
381
412
|
const placeholderText = typeof placeholder === "string" ? placeholder : "";
|
|
@@ -398,6 +429,7 @@ var LSSelect = ({ className = "", style, ...props }) => {
|
|
|
398
429
|
backgroundColor: "var(--neutralDark2)",
|
|
399
430
|
color: "var(--neutralLight1)",
|
|
400
431
|
border: "1px solid var(--neutralDark4)",
|
|
432
|
+
borderRadius: "var(--radius, 1rem)",
|
|
401
433
|
boxShadow: "0 16px 32px rgba(0, 0, 0, 0.32)",
|
|
402
434
|
...MenuProps?.slotProps?.paper?.sx
|
|
403
435
|
}
|
|
@@ -418,6 +450,7 @@ var LSSelect = ({ className = "", style, ...props }) => {
|
|
|
418
450
|
backgroundColor: "var(--neutralDark2)",
|
|
419
451
|
color: "var(--neutralLight1)",
|
|
420
452
|
border: "1px solid var(--neutralDark4)",
|
|
453
|
+
borderRadius: "var(--radius, 1rem)",
|
|
421
454
|
boxShadow: "0 16px 32px rgba(0, 0, 0, 0.32)",
|
|
422
455
|
"& .MuiList-root": {
|
|
423
456
|
backgroundColor: "var(--neutralDark2)"
|
|
@@ -433,24 +466,39 @@ var LSSelect = ({ className = "", style, ...props }) => {
|
|
|
433
466
|
}
|
|
434
467
|
}
|
|
435
468
|
};
|
|
436
|
-
return /* @__PURE__ */ jsxs2(
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
{
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
children: props.
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
469
|
+
return /* @__PURE__ */ jsxs2(
|
|
470
|
+
FormControl2,
|
|
471
|
+
{
|
|
472
|
+
variant: "outlined",
|
|
473
|
+
className: `${className} mui-ls-select-form-control`,
|
|
474
|
+
sx: {
|
|
475
|
+
marginBottom: ".3rem",
|
|
476
|
+
marginTop: ".5rem",
|
|
477
|
+
minWidth: "100px",
|
|
478
|
+
width: "100%"
|
|
479
|
+
},
|
|
480
|
+
size: rest.size,
|
|
481
|
+
style,
|
|
482
|
+
children: [
|
|
483
|
+
props.label && /* @__PURE__ */ jsx4(InputLabel, { shrink: true, id: labelId, children: props.label }),
|
|
484
|
+
/* @__PURE__ */ jsx4(
|
|
485
|
+
Select,
|
|
486
|
+
{
|
|
487
|
+
MenuProps: mergedMenuProps,
|
|
488
|
+
className: "mui-ls-select",
|
|
489
|
+
variant: "outlined",
|
|
490
|
+
labelId,
|
|
491
|
+
label: props.label,
|
|
492
|
+
displayEmpty,
|
|
493
|
+
renderValue,
|
|
494
|
+
...rest,
|
|
495
|
+
value,
|
|
496
|
+
children: props.children
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
]
|
|
500
|
+
}
|
|
501
|
+
);
|
|
454
502
|
};
|
|
455
503
|
LSSelect.displayName = "LSSelect";
|
|
456
504
|
|
|
@@ -459,7 +507,7 @@ import Checkbox from "@mui/material/Checkbox";
|
|
|
459
507
|
import FormControlLabel from "@mui/material/FormControlLabel";
|
|
460
508
|
import { forwardRef as forwardRef2 } from "react";
|
|
461
509
|
import { useController, useFormContext } from "react-hook-form";
|
|
462
|
-
import
|
|
510
|
+
import classNames4 from "classnames";
|
|
463
511
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
464
512
|
var LSCheckbox = forwardRef2(({ className = "", checked, inputRef, slotProps, ...props }, ref) => {
|
|
465
513
|
const CheckboxComponent = Checkbox;
|
|
@@ -468,7 +516,7 @@ var LSCheckbox = forwardRef2(({ className = "", checked, inputRef, slotProps, ..
|
|
|
468
516
|
{
|
|
469
517
|
...props,
|
|
470
518
|
checked,
|
|
471
|
-
className:
|
|
519
|
+
className: classNames4("ls-checkbox", className, { "Mui-disabled": props.disabled }),
|
|
472
520
|
ref,
|
|
473
521
|
slotProps: {
|
|
474
522
|
...slotProps ?? {},
|
|
@@ -496,7 +544,7 @@ function LSCheckboxField({
|
|
|
496
544
|
return /* @__PURE__ */ jsx5(
|
|
497
545
|
FormControlLabel,
|
|
498
546
|
{
|
|
499
|
-
className:
|
|
547
|
+
className: classNames4("ls-checkbox-row", className),
|
|
500
548
|
labelPlacement,
|
|
501
549
|
disabled,
|
|
502
550
|
control: /* @__PURE__ */ jsx5(
|
|
@@ -534,7 +582,7 @@ var LSColorPicker = ({ value = DEFAULT_COLOR, onChange, onBlur, className, name,
|
|
|
534
582
|
right: 0,
|
|
535
583
|
top: "calc(100% + 0.5rem)",
|
|
536
584
|
zIndex: 1e3,
|
|
537
|
-
borderRadius: "
|
|
585
|
+
borderRadius: "1rem",
|
|
538
586
|
background: "var(--neutralDark1)",
|
|
539
587
|
padding: "0.5rem",
|
|
540
588
|
boxShadow: "0 8px 24px rgba(0, 0, 0, 0.4)"
|
|
@@ -545,7 +593,7 @@ var LSColorPicker = ({ value = DEFAULT_COLOR, onChange, onBlur, className, name,
|
|
|
545
593
|
height: inlinePickerHeight,
|
|
546
594
|
minHeight: inlinePickerHeight,
|
|
547
595
|
marginTop: "0.5rem",
|
|
548
|
-
borderRadius: "
|
|
596
|
+
borderRadius: "1rem",
|
|
549
597
|
background: "var(--neutralDark1)",
|
|
550
598
|
padding: "0.5rem",
|
|
551
599
|
boxSizing: "border-box",
|
|
@@ -675,15 +723,36 @@ var LSColorPicker = ({ value = DEFAULT_COLOR, onChange, onBlur, className, name,
|
|
|
675
723
|
import { KeyboardArrowDown } from "@mui/icons-material";
|
|
676
724
|
import Autocomplete from "@mui/material/Autocomplete";
|
|
677
725
|
import TextField2 from "@mui/material/TextField";
|
|
678
|
-
import {
|
|
726
|
+
import {
|
|
727
|
+
memo,
|
|
728
|
+
startTransition,
|
|
729
|
+
useEffect as useEffect3,
|
|
730
|
+
useMemo as useMemo2,
|
|
731
|
+
useRef as useRef2,
|
|
732
|
+
useState as useState3
|
|
733
|
+
} from "react";
|
|
679
734
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
680
|
-
var LSFontPicker = memo(function LSFontPicker2({
|
|
735
|
+
var LSFontPicker = memo(function LSFontPicker2({
|
|
736
|
+
value,
|
|
737
|
+
onChange,
|
|
738
|
+
fonts = [],
|
|
739
|
+
localFonts = [],
|
|
740
|
+
onLoadFonts,
|
|
741
|
+
defaultValue = "Roboto",
|
|
742
|
+
placeholder = "Select a font",
|
|
743
|
+
isAlertManager = false,
|
|
744
|
+
label,
|
|
745
|
+
helperText
|
|
746
|
+
}) {
|
|
681
747
|
const AutocompleteComponent = Autocomplete;
|
|
682
748
|
const TextFieldComponent = TextField2;
|
|
683
749
|
const [inputValue, setInputValue] = useState3(value ?? defaultValue);
|
|
684
750
|
const onLoadFontsRef = useRef2(onLoadFonts);
|
|
685
751
|
const onChangeRef = useRef2(onChange);
|
|
686
|
-
const combinedFonts = useMemo2(
|
|
752
|
+
const combinedFonts = useMemo2(
|
|
753
|
+
() => Array.from(/* @__PURE__ */ new Set([...localFonts, ...fonts])).sort(),
|
|
754
|
+
[fonts, localFonts]
|
|
755
|
+
);
|
|
687
756
|
const currentValue = value ?? defaultValue;
|
|
688
757
|
useEffect3(() => {
|
|
689
758
|
onLoadFontsRef.current = onLoadFonts;
|
|
@@ -719,7 +788,9 @@ var LSFontPicker = memo(function LSFontPicker2({ value, onChange, fonts = [], lo
|
|
|
719
788
|
popupIcon: /* @__PURE__ */ jsx7(KeyboardArrowDown, {}),
|
|
720
789
|
isOptionEqualToValue: (option, selectedValue) => option === selectedValue,
|
|
721
790
|
onChange: (_event, newValue) => {
|
|
722
|
-
handleValueChange(
|
|
791
|
+
handleValueChange(
|
|
792
|
+
typeof newValue === "string" ? newValue : `${newValue ?? ""}`
|
|
793
|
+
);
|
|
723
794
|
},
|
|
724
795
|
onInputChange: (_event, newInputValue, reason) => {
|
|
725
796
|
if (reason === "input" || reason === "clear") {
|
|
@@ -734,7 +805,7 @@ var LSFontPicker = memo(function LSFontPicker2({ value, onChange, fonts = [], lo
|
|
|
734
805
|
sx: {
|
|
735
806
|
background: "var(--neutralDark3)",
|
|
736
807
|
border: "1px solid var(--neutralDark4)",
|
|
737
|
-
borderRadius: "var(--
|
|
808
|
+
borderRadius: "var(--radius, 1rem)",
|
|
738
809
|
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.3)",
|
|
739
810
|
color: "var(--neutralLight1)",
|
|
740
811
|
marginTop: "4px"
|
|
@@ -783,7 +854,7 @@ var LSFontPicker = memo(function LSFontPicker2({ value, onChange, fonts = [], lo
|
|
|
783
854
|
helperText,
|
|
784
855
|
placeholder,
|
|
785
856
|
fullWidth: true,
|
|
786
|
-
className: "mui-ls-input
|
|
857
|
+
className: "mui-ls-input",
|
|
787
858
|
variant: "outlined",
|
|
788
859
|
sx: {
|
|
789
860
|
"& .MuiOutlinedInput-root": {
|
|
@@ -803,7 +874,13 @@ var LSFontPicker = memo(function LSFontPicker2({ value, onChange, fonts = [], lo
|
|
|
803
874
|
// src/components/LSMultiSelect/LSMultiSelect.tsx
|
|
804
875
|
import { MenuItem } from "@mui/material";
|
|
805
876
|
import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
806
|
-
var LSMultiSelect = ({
|
|
877
|
+
var LSMultiSelect = ({
|
|
878
|
+
options,
|
|
879
|
+
placeholder = "Select...",
|
|
880
|
+
value,
|
|
881
|
+
onChange,
|
|
882
|
+
label
|
|
883
|
+
}) => {
|
|
807
884
|
const handleChange = (event) => {
|
|
808
885
|
const {
|
|
809
886
|
target: { value: value2 }
|
|
@@ -821,7 +898,9 @@ var LSMultiSelect = ({ options, placeholder = "Select...", value, onChange, labe
|
|
|
821
898
|
onChange: handleChange,
|
|
822
899
|
displayEmpty: true,
|
|
823
900
|
renderValue: (selected) => /* @__PURE__ */ jsxs4("div", { className: "ls-multi-select-value", children: [
|
|
824
|
-
/* @__PURE__ */ jsx8("div", { className: "ls-multi-select-value__label", children: selected.length > 0 ? selected.map(
|
|
901
|
+
/* @__PURE__ */ jsx8("div", { className: "ls-multi-select-value__label", children: selected.length > 0 ? selected.map(
|
|
902
|
+
(val) => options.find((opt) => opt.value === val)?.label ?? val
|
|
903
|
+
).join(", ") : placeholder }),
|
|
825
904
|
/* @__PURE__ */ jsx8("div", { className: "ls-multi-select-value__count", children: `(${selected.length})` })
|
|
826
905
|
] }),
|
|
827
906
|
MenuProps: {
|
|
@@ -832,6 +911,7 @@ var LSMultiSelect = ({ options, placeholder = "Select...", value, onChange, labe
|
|
|
832
911
|
backgroundColor: "var(--neutralDark2)",
|
|
833
912
|
color: "var(--neutralLight1)",
|
|
834
913
|
border: "1px solid var(--neutralDark4)",
|
|
914
|
+
borderRadius: "var(--radius, 1rem)",
|
|
835
915
|
boxShadow: "0 16px 32px rgba(0, 0, 0, 0.32)",
|
|
836
916
|
backdropFilter: "none",
|
|
837
917
|
opacity: 1,
|
|
@@ -854,6 +934,7 @@ var LSMultiSelect = ({ options, placeholder = "Select...", value, onChange, labe
|
|
|
854
934
|
opacity: 1,
|
|
855
935
|
maxHeight: "280px !important",
|
|
856
936
|
border: "1px solid var(--neutralDark4)",
|
|
937
|
+
borderRadius: "var(--radius, 1rem)",
|
|
857
938
|
"& .MuiList-root": {
|
|
858
939
|
backgroundColor: "var(--neutralDark2)"
|
|
859
940
|
}
|
|
@@ -877,7 +958,14 @@ var LSMultiSelect = ({ options, placeholder = "Select...", value, onChange, labe
|
|
|
877
958
|
}
|
|
878
959
|
},
|
|
879
960
|
children: [
|
|
880
|
-
/* @__PURE__ */ jsx8(
|
|
961
|
+
/* @__PURE__ */ jsx8(
|
|
962
|
+
LSCheckbox,
|
|
963
|
+
{
|
|
964
|
+
checked: (value ?? []).includes(option.value),
|
|
965
|
+
tabIndex: -1,
|
|
966
|
+
disableRipple: true
|
|
967
|
+
}
|
|
968
|
+
),
|
|
881
969
|
/* @__PURE__ */ jsx8("span", { children: option.label })
|
|
882
970
|
]
|
|
883
971
|
},
|
|
@@ -891,16 +979,16 @@ var LSMultiSelect = ({ options, placeholder = "Select...", value, onChange, labe
|
|
|
891
979
|
import FormControlLabel2 from "@mui/material/FormControlLabel";
|
|
892
980
|
import Radio from "@mui/material/Radio";
|
|
893
981
|
import RadioGroup from "@mui/material/RadioGroup";
|
|
894
|
-
import
|
|
982
|
+
import classNames5 from "classnames";
|
|
895
983
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
896
984
|
var LSRadio = ({ className = "", ...props }) => {
|
|
897
|
-
return /* @__PURE__ */ jsx9(Radio, { ...props, className:
|
|
985
|
+
return /* @__PURE__ */ jsx9(Radio, { ...props, className: classNames5("ls-radio", className) });
|
|
898
986
|
};
|
|
899
987
|
var LSRadioGroup = ({ selections, className = "", optionClassName = "", row, ...props }) => {
|
|
900
|
-
return /* @__PURE__ */ jsx9(RadioGroup, { ...props, row, className:
|
|
988
|
+
return /* @__PURE__ */ jsx9(RadioGroup, { ...props, row, className: classNames5("ls-radio-group", className, { row }), children: selections.map((selection) => /* @__PURE__ */ jsx9(
|
|
901
989
|
FormControlLabel2,
|
|
902
990
|
{
|
|
903
|
-
className:
|
|
991
|
+
className: classNames5("ls-radio-row", optionClassName),
|
|
904
992
|
value: selection.value,
|
|
905
993
|
disabled: selection.disabled,
|
|
906
994
|
control: /* @__PURE__ */ jsx9(LSRadio, {}),
|
|
@@ -915,44 +1003,65 @@ LSRadioGroup.displayName = "LSRadioGroup";
|
|
|
915
1003
|
import TextField3 from "@mui/material/TextField";
|
|
916
1004
|
import { forwardRef as forwardRef3 } from "react";
|
|
917
1005
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
918
|
-
var LSTextField = forwardRef3(
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
...slotProps
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
...
|
|
932
|
-
|
|
1006
|
+
var LSTextField = forwardRef3(
|
|
1007
|
+
(props, ref) => {
|
|
1008
|
+
const { InputLabelProps, InputProps, slotProps, ...rest } = props;
|
|
1009
|
+
return /* @__PURE__ */ jsx10(
|
|
1010
|
+
TextField3,
|
|
1011
|
+
{
|
|
1012
|
+
...rest,
|
|
1013
|
+
variant: "outlined",
|
|
1014
|
+
className: "mui-ls-input",
|
|
1015
|
+
slotProps: {
|
|
1016
|
+
...slotProps ?? {},
|
|
1017
|
+
input: {
|
|
1018
|
+
...slotProps?.input ?? {},
|
|
1019
|
+
...InputProps ?? {},
|
|
1020
|
+
sx: {
|
|
1021
|
+
...slotProps?.input?.sx ?? {},
|
|
1022
|
+
...InputProps?.sx ?? {}
|
|
1023
|
+
}
|
|
1024
|
+
},
|
|
1025
|
+
inputLabel: {
|
|
1026
|
+
...slotProps?.inputLabel ?? {},
|
|
1027
|
+
shrink: true,
|
|
1028
|
+
...InputLabelProps ?? {}
|
|
933
1029
|
}
|
|
934
1030
|
},
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
},
|
|
941
|
-
ref
|
|
942
|
-
}
|
|
943
|
-
);
|
|
944
|
-
});
|
|
1031
|
+
ref
|
|
1032
|
+
}
|
|
1033
|
+
);
|
|
1034
|
+
}
|
|
1035
|
+
);
|
|
945
1036
|
LSTextField.displayName = "LSTextField";
|
|
946
1037
|
|
|
947
1038
|
// src/components/LSVariableInputField/LSVariableInputField.tsx
|
|
948
|
-
import Autocomplete2, {
|
|
1039
|
+
import Autocomplete2, {
|
|
1040
|
+
createFilterOptions
|
|
1041
|
+
} from "@mui/material/Autocomplete";
|
|
949
1042
|
import InputAdornment2 from "@mui/material/InputAdornment";
|
|
950
|
-
import Search from "@mui/icons-material/Search";
|
|
951
1043
|
import Popover from "@mui/material/Popover";
|
|
952
|
-
import
|
|
953
|
-
import
|
|
1044
|
+
import Search from "@mui/icons-material/Search";
|
|
1045
|
+
import KeyboardArrowDown2 from "@mui/icons-material/KeyboardArrowDown";
|
|
1046
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
1047
|
+
import {
|
|
1048
|
+
Fragment,
|
|
1049
|
+
createContext,
|
|
1050
|
+
forwardRef as forwardRef4,
|
|
1051
|
+
useCallback as useCallback2,
|
|
1052
|
+
useContext,
|
|
1053
|
+
useEffect as useEffect4,
|
|
1054
|
+
useMemo as useMemo3,
|
|
1055
|
+
useRef as useRef3,
|
|
1056
|
+
useState as useState4
|
|
1057
|
+
} from "react";
|
|
1058
|
+
import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1059
|
+
import { createElement } from "react";
|
|
954
1060
|
var LSVariableInputContext = createContext({});
|
|
955
|
-
var LSVariableInputProvider = ({
|
|
1061
|
+
var LSVariableInputProvider = ({
|
|
1062
|
+
children,
|
|
1063
|
+
value
|
|
1064
|
+
}) => {
|
|
956
1065
|
return /* @__PURE__ */ jsx11(LSVariableInputContext.Provider, { value, children });
|
|
957
1066
|
};
|
|
958
1067
|
var DEFAULT_FUNCTION_VARIABLES = [
|
|
@@ -971,8 +1080,8 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
971
1080
|
"screenshot",
|
|
972
1081
|
"overlay_screenshot",
|
|
973
1082
|
"obs_screenshot",
|
|
974
|
-
"obs_replay",
|
|
975
1083
|
"obs_vertical_replay",
|
|
1084
|
+
"obs_replay",
|
|
976
1085
|
"get_queue_count",
|
|
977
1086
|
"lumia_uptime",
|
|
978
1087
|
"twitch_uptime",
|
|
@@ -987,15 +1096,105 @@ var DEFAULT_FUNCTION_VARIABLES = [
|
|
|
987
1096
|
"ai_prompt",
|
|
988
1097
|
"viewer_profile_summary"
|
|
989
1098
|
];
|
|
990
|
-
var
|
|
991
|
-
var
|
|
1099
|
+
var MAX_OBJECT_DEPTH = 5;
|
|
1100
|
+
var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1101
|
+
var isExpandableValue = (value) => {
|
|
1102
|
+
if (isPlainObject(value)) return Object.keys(value).length > 0;
|
|
1103
|
+
if (Array.isArray(value)) return value.length > 0;
|
|
1104
|
+
return false;
|
|
1105
|
+
};
|
|
1106
|
+
var isPrimitiveValue = (value) => value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
1107
|
+
var renderPrimitiveValue = (value) => {
|
|
1108
|
+
if (value === null || value === void 0) return "";
|
|
1109
|
+
if (typeof value === "boolean") return value.toString();
|
|
1110
|
+
if (typeof value === "number") return value.toString();
|
|
1111
|
+
if (typeof value === "string") return value;
|
|
1112
|
+
return String(value);
|
|
1113
|
+
};
|
|
1114
|
+
var renderComplexPreview = (value) => {
|
|
1115
|
+
if (Array.isArray(value)) {
|
|
1116
|
+
return `Array(${value.length}) [${value.slice(0, 3).map(
|
|
1117
|
+
(item) => typeof item === "string" ? `"${item}"` : typeof item === "object" ? "{...}" : String(item)
|
|
1118
|
+
).join(", ")}${value.length > 3 ? "..." : ""}]`;
|
|
1119
|
+
}
|
|
1120
|
+
const keys = Object.keys(value);
|
|
1121
|
+
return `Object {${keys.slice(0, 2).join(", ")}${keys.length > 2 ? "..." : ""}}`;
|
|
1122
|
+
};
|
|
1123
|
+
var getVariableValueDisplay = (value) => {
|
|
1124
|
+
const isComplexValue = !isPrimitiveValue(value) && value !== null && typeof value === "object";
|
|
1125
|
+
const displayValue = isComplexValue ? renderComplexPreview(value) : renderPrimitiveValue(value);
|
|
1126
|
+
const fullValue = isComplexValue ? JSON.stringify(value, null, 2) : renderPrimitiveValue(value);
|
|
1127
|
+
return { displayValue, fullValue, isComplexValue };
|
|
1128
|
+
};
|
|
1129
|
+
var buildValueChildren = (value, parentPath, depth) => {
|
|
1130
|
+
if (depth >= MAX_OBJECT_DEPTH) return [];
|
|
1131
|
+
if (isPlainObject(value)) {
|
|
1132
|
+
return Object.keys(value).map((key) => {
|
|
1133
|
+
const childValue = value[key];
|
|
1134
|
+
const relativePath = parentPath ? `${parentPath}.${key}` : key;
|
|
1135
|
+
const expandable = depth + 1 < MAX_OBJECT_DEPTH && isExpandableValue(childValue);
|
|
1136
|
+
return {
|
|
1137
|
+
relativePath,
|
|
1138
|
+
key,
|
|
1139
|
+
displayKey: key,
|
|
1140
|
+
depth: depth + 1,
|
|
1141
|
+
value: childValue,
|
|
1142
|
+
isExpandable: expandable,
|
|
1143
|
+
children: expandable ? buildValueChildren(childValue, relativePath, depth + 1) : []
|
|
1144
|
+
};
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
if (Array.isArray(value)) {
|
|
1148
|
+
return value.map((item, idx) => {
|
|
1149
|
+
const relativePath = parentPath ? `${parentPath}.${idx}` : String(idx);
|
|
1150
|
+
const expandable = depth + 1 < MAX_OBJECT_DEPTH && isExpandableValue(item);
|
|
1151
|
+
return {
|
|
1152
|
+
relativePath,
|
|
1153
|
+
key: String(idx),
|
|
1154
|
+
displayKey: `[${idx}]`,
|
|
1155
|
+
depth: depth + 1,
|
|
1156
|
+
value: item,
|
|
1157
|
+
isExpandable: expandable,
|
|
1158
|
+
children: expandable ? buildValueChildren(item, relativePath, depth + 1) : []
|
|
1159
|
+
};
|
|
1160
|
+
});
|
|
1161
|
+
}
|
|
1162
|
+
return [];
|
|
1163
|
+
};
|
|
1164
|
+
var isVariableRecord = (value) => {
|
|
1165
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
1166
|
+
const v = value;
|
|
1167
|
+
return typeof v.name === "string" && ("system" in v || "origin" in v || "value" in v);
|
|
1168
|
+
};
|
|
1169
|
+
var synthesizeRecord = (name, value) => ({
|
|
1170
|
+
name,
|
|
1171
|
+
system: false,
|
|
1172
|
+
origin: "",
|
|
1173
|
+
description: "",
|
|
1174
|
+
value: value ?? ""
|
|
1175
|
+
});
|
|
1176
|
+
var normalizeVariableRecords = (systemVariables) => {
|
|
1177
|
+
const out = {};
|
|
1178
|
+
if (!systemVariables) return out;
|
|
1179
|
+
for (const [key, raw] of Object.entries(systemVariables)) {
|
|
1180
|
+
if (raw === void 0 || raw === null) continue;
|
|
1181
|
+
out[key] = isVariableRecord(raw) ? raw : synthesizeRecord(key, raw);
|
|
1182
|
+
}
|
|
1183
|
+
return out;
|
|
1184
|
+
};
|
|
992
1185
|
var defaultTranslate = (key, fallback, options) => {
|
|
993
1186
|
if (fallback && fallback !== "-") return fallback;
|
|
994
|
-
if (key === "overlay-variables.variables-description")
|
|
995
|
-
|
|
996
|
-
if (key === "overlay-variables.
|
|
997
|
-
|
|
1187
|
+
if (key === "overlay-variables.variables-description")
|
|
1188
|
+
return "Use variables that will automatically be replaced before sending out the text";
|
|
1189
|
+
if (key === "overlay-variables.variable" || key === "commands.variable")
|
|
1190
|
+
return "Variable";
|
|
1191
|
+
if (key === "overlay-variables.description" || key === "commands.description")
|
|
1192
|
+
return "Description";
|
|
1193
|
+
if (key === "commands.suggested-variables") return "Suggested Variables";
|
|
1194
|
+
if (key === "common.value") return "Value";
|
|
1195
|
+
if (key === "common.search" || key === "assets.search") return "Search";
|
|
998
1196
|
if (key === "variables.functionvariables") return "Function variables";
|
|
1197
|
+
if (key === "chatbot.allowed-variables") return "Allowed Variables";
|
|
999
1198
|
if (key.startsWith("variables.")) {
|
|
1000
1199
|
const variableName = key.replace("variables.", "");
|
|
1001
1200
|
const example = options?.example;
|
|
@@ -1010,20 +1209,78 @@ var normalizeAllowedDefinitions = (allowedVariables) => {
|
|
|
1010
1209
|
allowedVariables.forEach((variable) => {
|
|
1011
1210
|
let variableName = "";
|
|
1012
1211
|
let description;
|
|
1212
|
+
let origin;
|
|
1213
|
+
let example;
|
|
1013
1214
|
if (typeof variable === "string") {
|
|
1014
1215
|
variableName = variable.trim();
|
|
1015
1216
|
} else if (variable && typeof variable === "object") {
|
|
1016
1217
|
const typedVariable = variable;
|
|
1017
|
-
const candidateName = [
|
|
1218
|
+
const candidateName = [
|
|
1219
|
+
typedVariable.name,
|
|
1220
|
+
typedVariable.key,
|
|
1221
|
+
typedVariable.variable
|
|
1222
|
+
].find((value) => typeof value === "string");
|
|
1018
1223
|
variableName = typeof candidateName === "string" ? candidateName.trim() : "";
|
|
1019
1224
|
description = typeof typedVariable.description === "string" ? typedVariable.description.trim() : void 0;
|
|
1225
|
+
origin = typeof typedVariable.origin === "string" ? typedVariable.origin.trim().toLowerCase() : void 0;
|
|
1226
|
+
example = typedVariable.example;
|
|
1020
1227
|
}
|
|
1021
1228
|
if (!variableName || unique.has(variableName)) return;
|
|
1022
1229
|
unique.add(variableName);
|
|
1023
|
-
definitions.push({ name: variableName, description });
|
|
1230
|
+
definitions.push({ name: variableName, description, origin, example });
|
|
1024
1231
|
});
|
|
1025
1232
|
return definitions;
|
|
1026
1233
|
};
|
|
1234
|
+
var filter = createFilterOptions({
|
|
1235
|
+
stringify: (option) => {
|
|
1236
|
+
if (typeof option === "string") return option;
|
|
1237
|
+
if (typeof option === "number" || typeof option === "boolean" || typeof option === "bigint")
|
|
1238
|
+
return String(option);
|
|
1239
|
+
if (!option || typeof option !== "object") return "";
|
|
1240
|
+
const typed = option;
|
|
1241
|
+
return [typed.label, typed.value, typed.helperText, typed.searchText].filter(
|
|
1242
|
+
(value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean"
|
|
1243
|
+
).map((value) => String(value)).join(" ");
|
|
1244
|
+
}
|
|
1245
|
+
});
|
|
1246
|
+
var visualTypeFromRecord = (variable) => {
|
|
1247
|
+
if (variable?.isFunction) return "func";
|
|
1248
|
+
if (variable?.system || variable?.locked) return "system";
|
|
1249
|
+
return "custom";
|
|
1250
|
+
};
|
|
1251
|
+
var visualTypeRank = (variableType) => {
|
|
1252
|
+
if (variableType === "custom") return 0;
|
|
1253
|
+
if (variableType === "func") return 1;
|
|
1254
|
+
return 2;
|
|
1255
|
+
};
|
|
1256
|
+
var orderItemsByVariableType = (items, getType) => {
|
|
1257
|
+
const grouped = {
|
|
1258
|
+
custom: [],
|
|
1259
|
+
func: [],
|
|
1260
|
+
system: []
|
|
1261
|
+
};
|
|
1262
|
+
items.forEach((item) => grouped[getType(item)].push(item));
|
|
1263
|
+
return [...grouped.custom, ...grouped.func, ...grouped.system];
|
|
1264
|
+
};
|
|
1265
|
+
var sortItemsByVariableTypeThenName = (items, getType, getName) => {
|
|
1266
|
+
return [...items].sort((a, b) => {
|
|
1267
|
+
const typeDiff = visualTypeRank(getType(a)) - visualTypeRank(getType(b));
|
|
1268
|
+
if (typeDiff !== 0) return typeDiff;
|
|
1269
|
+
return getName(a).localeCompare(getName(b));
|
|
1270
|
+
});
|
|
1271
|
+
};
|
|
1272
|
+
var humanizeVariableName = (rawName) => {
|
|
1273
|
+
if (!rawName) return "";
|
|
1274
|
+
return rawName.replace(/^_+|_+$/g, "").replace(/_/g, " ").replace(/\s+/g, " ").trim().replace(/\b\w/g, (char) => char.toUpperCase());
|
|
1275
|
+
};
|
|
1276
|
+
var getVariableColorClass = (variableType, isSuggested) => {
|
|
1277
|
+
if (isSuggested && variableType !== "func")
|
|
1278
|
+
return "ls-variable-token--custom";
|
|
1279
|
+
if (variableType === "func") return "ls-variable-token--function";
|
|
1280
|
+
if (variableType === "system") return "ls-variable-token--system";
|
|
1281
|
+
return "ls-variable-token--custom";
|
|
1282
|
+
};
|
|
1283
|
+
var CHILD_VARIABLE_COLOR_CLASS = "ls-variable-token--child";
|
|
1027
1284
|
var LSVariableInputField = forwardRef4((props, ref) => {
|
|
1028
1285
|
const context = useContext(LSVariableInputContext);
|
|
1029
1286
|
const {
|
|
@@ -1032,6 +1289,7 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1032
1289
|
type,
|
|
1033
1290
|
isAutoComplete,
|
|
1034
1291
|
autoCompleteOptions,
|
|
1292
|
+
autoCompleteGroupBy,
|
|
1035
1293
|
renderOption,
|
|
1036
1294
|
hideVariables,
|
|
1037
1295
|
allowedVariables,
|
|
@@ -1051,114 +1309,427 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1051
1309
|
onPopupOpen,
|
|
1052
1310
|
afterFilter,
|
|
1053
1311
|
onChange,
|
|
1312
|
+
loading,
|
|
1313
|
+
getOptionLabel,
|
|
1314
|
+
isOptionEqualToValue,
|
|
1315
|
+
$disableInputChange,
|
|
1316
|
+
$getFullValueObject,
|
|
1317
|
+
$multiple,
|
|
1318
|
+
$disableCloseOnSelect,
|
|
1319
|
+
$freeSolo,
|
|
1320
|
+
$renderOption,
|
|
1321
|
+
allowedVariableOrigin,
|
|
1054
1322
|
systemVariables: systemVariablesProp,
|
|
1055
1323
|
functionVariables: functionVariablesProp,
|
|
1056
1324
|
translate,
|
|
1057
|
-
onVariableTranslationsNeeded
|
|
1325
|
+
onVariableTranslationsNeeded,
|
|
1326
|
+
isOriginConnected: isOriginConnectedProp,
|
|
1327
|
+
translationKeyExists: translationKeyExistsProp
|
|
1058
1328
|
} = props;
|
|
1059
1329
|
const t = translate ?? context.translate ?? defaultTranslate;
|
|
1060
|
-
const
|
|
1061
|
-
const
|
|
1330
|
+
const rawSystemVariables = systemVariablesProp ?? context.systemVariables ?? {};
|
|
1331
|
+
const variableRecords = useMemo3(
|
|
1332
|
+
() => normalizeVariableRecords(rawSystemVariables),
|
|
1333
|
+
[rawSystemVariables]
|
|
1334
|
+
);
|
|
1335
|
+
const functionVariables = useMemo3(
|
|
1336
|
+
() => functionVariablesProp ?? context.functionVariables ?? DEFAULT_FUNCTION_VARIABLES,
|
|
1337
|
+
[context.functionVariables, functionVariablesProp]
|
|
1338
|
+
);
|
|
1062
1339
|
const requestTranslations = onVariableTranslationsNeeded ?? context.onVariableTranslationsNeeded;
|
|
1340
|
+
const isOriginConnected = isOriginConnectedProp ?? context.isOriginConnected;
|
|
1341
|
+
const translationKeyExists = translationKeyExistsProp ?? context.translationKeyExists;
|
|
1063
1342
|
const containerRef = useRef3(null);
|
|
1064
1343
|
const variableId = useRef3(`variable-input-${name ?? "field"}`);
|
|
1065
1344
|
const [showVariables, setShowVariables] = useState4(false);
|
|
1066
1345
|
const [searchQuery, setSearchQuery] = useState4("");
|
|
1067
|
-
const functionVariableSet = useMemo3(
|
|
1068
|
-
|
|
1346
|
+
const functionVariableSet = useMemo3(
|
|
1347
|
+
() => new Set(functionVariables),
|
|
1348
|
+
[functionVariables]
|
|
1349
|
+
);
|
|
1350
|
+
const allowedVariableDefinitions = useMemo3(
|
|
1351
|
+
() => normalizeAllowedDefinitions(allowedVariables),
|
|
1352
|
+
[allowedVariables]
|
|
1353
|
+
);
|
|
1069
1354
|
const allowedVariableDefinitionLookup = useMemo3(() => {
|
|
1070
1355
|
const lookup = /* @__PURE__ */ new Map();
|
|
1071
|
-
allowedVariableDefinitions.forEach(
|
|
1356
|
+
allowedVariableDefinitions.forEach(
|
|
1357
|
+
(definition) => lookup.set(definition.name, definition)
|
|
1358
|
+
);
|
|
1072
1359
|
return lookup;
|
|
1073
1360
|
}, [allowedVariableDefinitions]);
|
|
1074
|
-
const allowedVariableNames = useMemo3(
|
|
1075
|
-
|
|
1361
|
+
const allowedVariableNames = useMemo3(
|
|
1362
|
+
() => allowedVariableDefinitions.map((definition) => definition.name),
|
|
1363
|
+
[allowedVariableDefinitions]
|
|
1364
|
+
);
|
|
1365
|
+
const [filteredAllowedVariables, setFilteredAllowedVariables] = useState4(allowedVariableDefinitions);
|
|
1076
1366
|
const [filteredSystemVariables, setFilteredSystemVariables] = useState4([]);
|
|
1367
|
+
const [expandedPaths, setExpandedPaths] = useState4(
|
|
1368
|
+
() => /* @__PURE__ */ new Set()
|
|
1369
|
+
);
|
|
1370
|
+
const [autoExpandPaths, setAutoExpandPaths] = useState4(
|
|
1371
|
+
() => /* @__PURE__ */ new Set()
|
|
1372
|
+
);
|
|
1373
|
+
const systemVariableValueTrees = useMemo3(() => {
|
|
1374
|
+
const map = /* @__PURE__ */ new Map();
|
|
1375
|
+
Object.values(variableRecords).forEach((variable) => {
|
|
1376
|
+
if (variable && isExpandableValue(variable.value)) {
|
|
1377
|
+
map.set(variable.name, buildValueChildren(variable.value, "", 0));
|
|
1378
|
+
}
|
|
1379
|
+
});
|
|
1380
|
+
return map;
|
|
1381
|
+
}, [variableRecords]);
|
|
1382
|
+
const allowedExampleTrees = useMemo3(() => {
|
|
1383
|
+
const map = /* @__PURE__ */ new Map();
|
|
1384
|
+
allowedVariableDefinitions.forEach((definition) => {
|
|
1385
|
+
if (isExpandableValue(definition.example)) {
|
|
1386
|
+
map.set(definition.name, buildValueChildren(definition.example, "", 0));
|
|
1387
|
+
}
|
|
1388
|
+
});
|
|
1389
|
+
return map;
|
|
1390
|
+
}, [allowedVariableDefinitions]);
|
|
1077
1391
|
useEffect4(() => {
|
|
1078
1392
|
requestTranslations?.();
|
|
1079
1393
|
}, [requestTranslations]);
|
|
1080
|
-
const
|
|
1394
|
+
const isPathExpanded = useCallback2(
|
|
1395
|
+
(path) => expandedPaths.has(path) || autoExpandPaths.has(path),
|
|
1396
|
+
[autoExpandPaths, expandedPaths]
|
|
1397
|
+
);
|
|
1398
|
+
const toggleExpand = useCallback2(
|
|
1399
|
+
(path) => {
|
|
1400
|
+
const expanded = expandedPaths.has(path) || autoExpandPaths.has(path);
|
|
1401
|
+
if (expanded) {
|
|
1402
|
+
if (expandedPaths.has(path)) {
|
|
1403
|
+
setExpandedPaths((prev) => {
|
|
1404
|
+
const next = new Set(prev);
|
|
1405
|
+
next.delete(path);
|
|
1406
|
+
return next;
|
|
1407
|
+
});
|
|
1408
|
+
}
|
|
1409
|
+
if (autoExpandPaths.has(path)) {
|
|
1410
|
+
setAutoExpandPaths((prev) => {
|
|
1411
|
+
const next = new Set(prev);
|
|
1412
|
+
next.delete(path);
|
|
1413
|
+
return next;
|
|
1414
|
+
});
|
|
1415
|
+
}
|
|
1416
|
+
} else {
|
|
1417
|
+
setExpandedPaths((prev) => {
|
|
1418
|
+
const next = new Set(prev);
|
|
1419
|
+
next.add(path);
|
|
1420
|
+
return next;
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
[autoExpandPaths, expandedPaths]
|
|
1425
|
+
);
|
|
1426
|
+
const namespaceHas = useCallback2(
|
|
1427
|
+
(key, namespace) => {
|
|
1428
|
+
if (!translationKeyExists) return false;
|
|
1429
|
+
try {
|
|
1430
|
+
return translationKeyExists(key, namespace);
|
|
1431
|
+
} catch {
|
|
1432
|
+
return false;
|
|
1433
|
+
}
|
|
1434
|
+
},
|
|
1435
|
+
[translationKeyExists]
|
|
1436
|
+
);
|
|
1437
|
+
const resolveTranslationFromNamespace = useCallback2(
|
|
1438
|
+
(variableName, namespace) => {
|
|
1439
|
+
const normalizedNamespace = typeof namespace === "string" ? namespace.trim().toLowerCase() : "";
|
|
1440
|
+
if (!normalizedNamespace) return null;
|
|
1441
|
+
const normalizedName = variableName.trim().toLowerCase();
|
|
1442
|
+
if (!normalizedName) return null;
|
|
1443
|
+
const unprefixedName = normalizedName.startsWith(
|
|
1444
|
+
`${normalizedNamespace}_`
|
|
1445
|
+
) ? normalizedName.slice(normalizedNamespace.length + 1) : normalizedName;
|
|
1446
|
+
const prefixedName = normalizedName.startsWith(`${normalizedNamespace}_`) ? normalizedName : `${normalizedNamespace}_${normalizedName}`;
|
|
1447
|
+
const candidateKeys = [prefixedName, unprefixedName];
|
|
1448
|
+
for (const key of candidateKeys) {
|
|
1449
|
+
if (namespaceHas(key, normalizedNamespace))
|
|
1450
|
+
return t(key, void 0, { ns: normalizedNamespace });
|
|
1451
|
+
if (namespaceHas(`variables.${key}`, normalizedNamespace))
|
|
1452
|
+
return t(`variables.${key}`, void 0, { ns: normalizedNamespace });
|
|
1453
|
+
}
|
|
1454
|
+
return null;
|
|
1455
|
+
},
|
|
1456
|
+
[namespaceHas, t]
|
|
1457
|
+
);
|
|
1458
|
+
const knownOrigins = useMemo3(() => {
|
|
1459
|
+
return Array.from(
|
|
1460
|
+
new Set(
|
|
1461
|
+
Object.values(variableRecords).map(
|
|
1462
|
+
(variable) => typeof variable?.origin === "string" ? variable.origin.trim().toLowerCase() : ""
|
|
1463
|
+
).filter((origin) => origin.length > 0)
|
|
1464
|
+
)
|
|
1465
|
+
);
|
|
1466
|
+
}, [variableRecords]);
|
|
1467
|
+
const resolveAllowedVariableOrigin = useCallback2(
|
|
1081
1468
|
(variableName) => {
|
|
1082
|
-
|
|
1083
|
-
|
|
1469
|
+
const originFromProp = typeof allowedVariableOrigin === "string" ? allowedVariableOrigin.trim().toLowerCase() : "";
|
|
1470
|
+
if (originFromProp) return originFromProp;
|
|
1471
|
+
const fromDefinition = allowedVariableDefinitionLookup.get(variableName)?.origin;
|
|
1472
|
+
if (fromDefinition) return fromDefinition;
|
|
1473
|
+
const normalizedName = variableName.trim().toLowerCase();
|
|
1474
|
+
if (!normalizedName) return void 0;
|
|
1475
|
+
const prefixCandidate = normalizedName.split("_")[0];
|
|
1476
|
+
if (prefixCandidate) {
|
|
1477
|
+
const hasScopedTranslation = namespaceHas(normalizedName, prefixCandidate) || namespaceHas(`variables.${normalizedName}`, prefixCandidate) || namespaceHas(
|
|
1478
|
+
normalizedName.slice(prefixCandidate.length + 1),
|
|
1479
|
+
prefixCandidate
|
|
1480
|
+
) || namespaceHas(
|
|
1481
|
+
`variables.${normalizedName.slice(prefixCandidate.length + 1)}`,
|
|
1482
|
+
prefixCandidate
|
|
1483
|
+
);
|
|
1484
|
+
if (hasScopedTranslation) return prefixCandidate;
|
|
1485
|
+
}
|
|
1486
|
+
const prefixedMatch = knownOrigins.find(
|
|
1487
|
+
(origin) => normalizedName.startsWith(`${origin}_`)
|
|
1488
|
+
);
|
|
1489
|
+
if (prefixedMatch) return prefixedMatch;
|
|
1490
|
+
const matchingOrigins = knownOrigins.filter(
|
|
1491
|
+
(origin) => namespaceHas(normalizedName, origin) || namespaceHas(`variables.${normalizedName}`, origin) || namespaceHas(`${origin}_${normalizedName}`, origin)
|
|
1492
|
+
);
|
|
1493
|
+
if (matchingOrigins.length === 1) return matchingOrigins[0];
|
|
1494
|
+
const inferredOrigins = Array.from(
|
|
1495
|
+
new Set(
|
|
1496
|
+
Object.values(variableRecords).filter((variable) => {
|
|
1497
|
+
const variableNameLower = typeof variable?.name === "string" ? variable.name.trim().toLowerCase() : "";
|
|
1498
|
+
const variableOrigin = typeof variable?.origin === "string" ? variable.origin.trim().toLowerCase() : "";
|
|
1499
|
+
if (!variableNameLower || !variableOrigin) return false;
|
|
1500
|
+
return variableNameLower === normalizedName || variableNameLower === `${variableOrigin}_${normalizedName}`;
|
|
1501
|
+
}).map((variable) => String(variable.origin).trim().toLowerCase()).filter((origin) => origin.length > 0)
|
|
1502
|
+
)
|
|
1503
|
+
);
|
|
1504
|
+
return inferredOrigins.length === 1 ? inferredOrigins[0] : void 0;
|
|
1084
1505
|
},
|
|
1085
|
-
[
|
|
1506
|
+
[
|
|
1507
|
+
allowedVariableDefinitionLookup,
|
|
1508
|
+
allowedVariableOrigin,
|
|
1509
|
+
knownOrigins,
|
|
1510
|
+
namespaceHas,
|
|
1511
|
+
variableRecords
|
|
1512
|
+
]
|
|
1086
1513
|
);
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
return [...grouped.custom, ...grouped.func, ...grouped.system];
|
|
1514
|
+
const resolveVariableDescription = useCallback2(
|
|
1515
|
+
(variableName, fallbackDescription, origin) => {
|
|
1516
|
+
const fromOrigin = resolveTranslationFromNamespace(variableName, origin);
|
|
1517
|
+
if (fromOrigin && fromOrigin.trim().length > 0) return fromOrigin;
|
|
1518
|
+
const defaultTranslationKey = `variables.${variableName}`;
|
|
1519
|
+
const defaultTranslated = t(defaultTranslationKey);
|
|
1520
|
+
if (typeof defaultTranslated === "string" && defaultTranslated !== defaultTranslationKey)
|
|
1521
|
+
return defaultTranslated;
|
|
1522
|
+
if (fallbackDescription && fallbackDescription.trim().length > 0)
|
|
1523
|
+
return fallbackDescription;
|
|
1524
|
+
return humanizeVariableName(variableName);
|
|
1099
1525
|
},
|
|
1100
|
-
[
|
|
1526
|
+
[resolveTranslationFromNamespace, t]
|
|
1101
1527
|
);
|
|
1102
|
-
const
|
|
1103
|
-
(
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1528
|
+
const getSystemVariableDescription = useCallback2(
|
|
1529
|
+
(variable) => {
|
|
1530
|
+
if (variable?.system && !variable?.pluginId) {
|
|
1531
|
+
return t(`variables.${variable.description}`, void 0, {
|
|
1532
|
+
example: variable.example,
|
|
1533
|
+
interpolation: { escapeValue: false, prefix: "{{{", suffix: "}}}" }
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
return resolveVariableDescription(
|
|
1537
|
+
variable?.name ?? "",
|
|
1538
|
+
variable?.description,
|
|
1539
|
+
variable?.origin
|
|
1540
|
+
);
|
|
1541
|
+
},
|
|
1542
|
+
[resolveVariableDescription, t]
|
|
1543
|
+
);
|
|
1544
|
+
const getAllowedVariableRecord = useCallback2(
|
|
1545
|
+
(variableName) => {
|
|
1546
|
+
const direct = variableRecords[variableName];
|
|
1547
|
+
if (direct) return direct;
|
|
1548
|
+
const normalizedOrigin = resolveAllowedVariableOrigin(variableName);
|
|
1549
|
+
if (!normalizedOrigin) return void 0;
|
|
1550
|
+
const prefixedName = variableName.startsWith(`${normalizedOrigin}_`) ? variableName : `${normalizedOrigin}_${variableName}`;
|
|
1551
|
+
return variableRecords[prefixedName];
|
|
1552
|
+
},
|
|
1553
|
+
[resolveAllowedVariableOrigin, variableRecords]
|
|
1108
1554
|
);
|
|
1109
1555
|
const getAllowedVariableDescription = useCallback2(
|
|
1110
1556
|
(variableName) => {
|
|
1111
|
-
const
|
|
1112
|
-
if (
|
|
1113
|
-
const
|
|
1114
|
-
const
|
|
1115
|
-
return
|
|
1557
|
+
const variable = variableRecords[variableName];
|
|
1558
|
+
if (variable) return getSystemVariableDescription(variable);
|
|
1559
|
+
const fromDefinition = allowedVariableDefinitionLookup.get(variableName);
|
|
1560
|
+
const origin = resolveAllowedVariableOrigin(variableName);
|
|
1561
|
+
return resolveVariableDescription(
|
|
1562
|
+
variableName,
|
|
1563
|
+
fromDefinition?.description,
|
|
1564
|
+
origin
|
|
1565
|
+
);
|
|
1566
|
+
},
|
|
1567
|
+
[
|
|
1568
|
+
allowedVariableDefinitionLookup,
|
|
1569
|
+
getSystemVariableDescription,
|
|
1570
|
+
resolveAllowedVariableOrigin,
|
|
1571
|
+
resolveVariableDescription,
|
|
1572
|
+
variableRecords
|
|
1573
|
+
]
|
|
1574
|
+
);
|
|
1575
|
+
const getAllowedVariableValue = useCallback2(
|
|
1576
|
+
(variableName) => {
|
|
1577
|
+
if (!variableName) return void 0;
|
|
1578
|
+
const direct = variableRecords[variableName]?.value;
|
|
1579
|
+
if (direct !== void 0) return direct;
|
|
1580
|
+
const normalizedOrigin = resolveAllowedVariableOrigin(variableName);
|
|
1581
|
+
if (!normalizedOrigin) return void 0;
|
|
1582
|
+
const prefixedName = variableName.startsWith(`${normalizedOrigin}_`) ? variableName : `${normalizedOrigin}_${variableName}`;
|
|
1583
|
+
return variableRecords[prefixedName]?.value;
|
|
1584
|
+
},
|
|
1585
|
+
[resolveAllowedVariableOrigin, variableRecords]
|
|
1586
|
+
);
|
|
1587
|
+
const getAllowedVariableVisualType = useCallback2(
|
|
1588
|
+
(variableName) => {
|
|
1589
|
+
const record = getAllowedVariableRecord(variableName);
|
|
1590
|
+
if (record) return visualTypeFromRecord(record);
|
|
1591
|
+
if (functionVariableSet.has(variableName)) return "func";
|
|
1592
|
+
return "custom";
|
|
1593
|
+
},
|
|
1594
|
+
[functionVariableSet, getAllowedVariableRecord]
|
|
1595
|
+
);
|
|
1596
|
+
const getAllowedVariableTree = useCallback2(
|
|
1597
|
+
(definition) => {
|
|
1598
|
+
const record = getAllowedVariableRecord(definition.name);
|
|
1599
|
+
const liveTree = record ? systemVariableValueTrees.get(record.name) : void 0;
|
|
1600
|
+
if (liveTree && liveTree.length > 0) return liveTree;
|
|
1601
|
+
return allowedExampleTrees.get(definition.name);
|
|
1116
1602
|
},
|
|
1117
|
-
[
|
|
1603
|
+
[allowedExampleTrees, getAllowedVariableRecord, systemVariableValueTrees]
|
|
1118
1604
|
);
|
|
1119
|
-
|
|
1605
|
+
useEffect4(() => {
|
|
1120
1606
|
const query = (searchQuery ?? "").toLowerCase().replace("{{", "").replace("}}", "").trim();
|
|
1607
|
+
const nextAutoExpand = /* @__PURE__ */ new Set();
|
|
1608
|
+
const collectNestedAutoExpand = (rootToken, tree) => {
|
|
1609
|
+
if (!query || !tree || tree.length === 0) return false;
|
|
1610
|
+
let hit = false;
|
|
1611
|
+
const walk = (nodes) => {
|
|
1612
|
+
nodes.forEach((node) => {
|
|
1613
|
+
if (node.relativePath.toLowerCase().includes(query) || node.key.toLowerCase().includes(query)) {
|
|
1614
|
+
hit = true;
|
|
1615
|
+
const segments = node.relativePath.split(".");
|
|
1616
|
+
for (let i = 0; i < segments.length; i++) {
|
|
1617
|
+
const rel = segments.slice(0, i).join(".");
|
|
1618
|
+
nextAutoExpand.add(rel ? `${rootToken}.${rel}` : rootToken);
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
if (node.children.length) walk(node.children);
|
|
1622
|
+
});
|
|
1623
|
+
};
|
|
1624
|
+
walk(tree);
|
|
1625
|
+
return hit;
|
|
1626
|
+
};
|
|
1121
1627
|
if (allowedVariableNames.length > 0) {
|
|
1122
1628
|
if (!query) {
|
|
1123
|
-
setFilteredAllowedVariables(
|
|
1629
|
+
setFilteredAllowedVariables(
|
|
1630
|
+
orderItemsByVariableType(
|
|
1631
|
+
allowedVariableDefinitions,
|
|
1632
|
+
(definition) => getAllowedVariableVisualType(definition.name)
|
|
1633
|
+
)
|
|
1634
|
+
);
|
|
1124
1635
|
} else {
|
|
1125
1636
|
const nameMatches = [];
|
|
1126
1637
|
const descMatches = [];
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
|
|
1638
|
+
const nestedMatches = [];
|
|
1639
|
+
allowedVariableDefinitions.forEach((definition) => {
|
|
1640
|
+
const nameLower = definition.name?.toLowerCase();
|
|
1641
|
+
const descLower = getAllowedVariableDescription(
|
|
1642
|
+
definition.name
|
|
1643
|
+
)?.toLowerCase();
|
|
1644
|
+
if (nameLower?.includes(query)) {
|
|
1645
|
+
nameMatches.push(definition);
|
|
1646
|
+
return;
|
|
1647
|
+
}
|
|
1648
|
+
if (descLower?.includes(query)) {
|
|
1649
|
+
descMatches.push(definition);
|
|
1650
|
+
return;
|
|
1651
|
+
}
|
|
1652
|
+
const tree = getAllowedVariableTree(definition);
|
|
1653
|
+
if (tree && collectNestedAutoExpand(definition.name, tree)) {
|
|
1654
|
+
nestedMatches.push(definition);
|
|
1655
|
+
}
|
|
1132
1656
|
});
|
|
1133
|
-
|
|
1657
|
+
const sortByDef = (items) => sortItemsByVariableTypeThenName(
|
|
1658
|
+
items,
|
|
1659
|
+
(definition) => getAllowedVariableVisualType(definition.name),
|
|
1660
|
+
(definition) => definition.name
|
|
1661
|
+
);
|
|
1662
|
+
setFilteredAllowedVariables([
|
|
1663
|
+
...sortByDef(nameMatches),
|
|
1664
|
+
...sortByDef(descMatches),
|
|
1665
|
+
...sortByDef(nestedMatches)
|
|
1666
|
+
]);
|
|
1134
1667
|
}
|
|
1135
1668
|
} else {
|
|
1136
1669
|
setFilteredAllowedVariables([]);
|
|
1137
1670
|
}
|
|
1138
|
-
const
|
|
1139
|
-
const
|
|
1140
|
-
|
|
1671
|
+
const allowedSet = new Set(allowedVariableNames);
|
|
1672
|
+
const shouldKeep = (variable) => {
|
|
1673
|
+
if (allowedSet.has(variable.name)) return false;
|
|
1674
|
+
if (!variable.origin) return true;
|
|
1675
|
+
if (!isOriginConnected) return true;
|
|
1676
|
+
return isOriginConnected(variable.origin);
|
|
1677
|
+
};
|
|
1678
|
+
const allRecords = Object.values(variableRecords);
|
|
1141
1679
|
if (!query) {
|
|
1142
|
-
|
|
1680
|
+
const visible = allRecords.filter(shouldKeep);
|
|
1681
|
+
setFilteredSystemVariables(
|
|
1682
|
+
orderItemsByVariableType(
|
|
1683
|
+
visible,
|
|
1684
|
+
(variable) => visualTypeFromRecord(variable)
|
|
1685
|
+
)
|
|
1686
|
+
);
|
|
1143
1687
|
} else {
|
|
1144
1688
|
const nameMatches = [];
|
|
1145
1689
|
const descMatches = [];
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1690
|
+
const nestedMatches = [];
|
|
1691
|
+
allRecords.forEach((variable) => {
|
|
1692
|
+
if (!shouldKeep(variable)) return;
|
|
1693
|
+
const description = getSystemVariableDescription(variable);
|
|
1694
|
+
const nameLower = variable.name?.toLowerCase();
|
|
1695
|
+
const descLower = description?.toLowerCase();
|
|
1696
|
+
if (nameLower?.includes(query)) {
|
|
1697
|
+
nameMatches.push(variable);
|
|
1698
|
+
return;
|
|
1699
|
+
}
|
|
1700
|
+
if (descLower?.includes(query)) {
|
|
1701
|
+
descMatches.push(variable);
|
|
1702
|
+
return;
|
|
1703
|
+
}
|
|
1704
|
+
const tree = systemVariableValueTrees.get(variable.name);
|
|
1705
|
+
if (tree && collectNestedAutoExpand(variable.example ?? variable.name, tree)) {
|
|
1706
|
+
nestedMatches.push(variable);
|
|
1707
|
+
}
|
|
1155
1708
|
});
|
|
1156
|
-
|
|
1709
|
+
const sortSys = (items) => sortItemsByVariableTypeThenName(
|
|
1710
|
+
items,
|
|
1711
|
+
(variable) => visualTypeFromRecord(variable),
|
|
1712
|
+
(variable) => variable?.name ?? ""
|
|
1713
|
+
);
|
|
1714
|
+
setFilteredSystemVariables([
|
|
1715
|
+
...sortSys(nameMatches),
|
|
1716
|
+
...sortSys(descMatches),
|
|
1717
|
+
...sortSys(nestedMatches)
|
|
1718
|
+
]);
|
|
1157
1719
|
}
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1720
|
+
setAutoExpandPaths(nextAutoExpand);
|
|
1721
|
+
}, [
|
|
1722
|
+
searchQuery,
|
|
1723
|
+
allowedVariableDefinitions,
|
|
1724
|
+
allowedVariableNames,
|
|
1725
|
+
getAllowedVariableDescription,
|
|
1726
|
+
getAllowedVariableTree,
|
|
1727
|
+
getAllowedVariableVisualType,
|
|
1728
|
+
getSystemVariableDescription,
|
|
1729
|
+
isOriginConnected,
|
|
1730
|
+
systemVariableValueTrees,
|
|
1731
|
+
variableRecords
|
|
1732
|
+
]);
|
|
1162
1733
|
const clickedVariableIcon = () => {
|
|
1163
1734
|
if (!hideVariables) setShowVariables((current) => !current);
|
|
1164
1735
|
};
|
|
@@ -1168,25 +1739,273 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1168
1739
|
};
|
|
1169
1740
|
const insertVariable = (variable) => {
|
|
1170
1741
|
appendValue(`{{${variable}}}`);
|
|
1742
|
+
setShowVariables(false);
|
|
1171
1743
|
};
|
|
1172
|
-
const getVariableColorClass = (variableType, isSuggested = false) => {
|
|
1173
|
-
if (isSuggested && variableType !== "func") return "ls-variable-token--custom";
|
|
1174
|
-
if (variableType === "func") return "ls-variable-token--function";
|
|
1175
|
-
if (variableType === "system") return "ls-variable-token--system";
|
|
1176
|
-
return "ls-variable-token--custom";
|
|
1177
|
-
};
|
|
1178
|
-
const renderVariableToken = (variableName, variableType, isSuggested = false) => /* @__PURE__ */ jsxs5("div", { className: `ls-variable-token ${getVariableColorClass(variableType, isSuggested)}`, children: [
|
|
1179
|
-
/* @__PURE__ */ jsx11("span", { className: "ls-variable-token__name", children: `{{${variableName}}}` }),
|
|
1180
|
-
variableType === "func" && /* @__PURE__ */ jsx11("span", { className: "ls-variable-token__badge", title: t("variables.functionvariables", "Function variables"), children: "fx" })
|
|
1181
|
-
] });
|
|
1182
1744
|
const handleFilterOptions = (options, params) => {
|
|
1183
1745
|
const filtered = filter(options, params);
|
|
1184
1746
|
afterFilter?.(filtered);
|
|
1185
1747
|
return filtered;
|
|
1186
1748
|
};
|
|
1749
|
+
const renderVariableToken = (variableName, variableType, isSuggested = false) => /* @__PURE__ */ jsxs5(
|
|
1750
|
+
"div",
|
|
1751
|
+
{
|
|
1752
|
+
className: `ls-variable-token ${getVariableColorClass(variableType, isSuggested)}`,
|
|
1753
|
+
children: [
|
|
1754
|
+
/* @__PURE__ */ jsx11("span", { className: "ls-variable-token__name", children: `{{${variableName}}}` }),
|
|
1755
|
+
variableType === "func" && /* @__PURE__ */ jsx11(
|
|
1756
|
+
"span",
|
|
1757
|
+
{
|
|
1758
|
+
className: "ls-variable-token__badge",
|
|
1759
|
+
title: t("variables.functionvariables", "Function variables"),
|
|
1760
|
+
children: "fx"
|
|
1761
|
+
}
|
|
1762
|
+
)
|
|
1763
|
+
]
|
|
1764
|
+
}
|
|
1765
|
+
);
|
|
1766
|
+
const renderExpandToggle = (path, expanded) => /* @__PURE__ */ jsx11(
|
|
1767
|
+
"button",
|
|
1768
|
+
{
|
|
1769
|
+
type: "button",
|
|
1770
|
+
onClick: (e) => {
|
|
1771
|
+
e.stopPropagation();
|
|
1772
|
+
toggleExpand(path);
|
|
1773
|
+
},
|
|
1774
|
+
className: `ls-variable-picker__expand-toggle${expanded ? " ls-variable-picker__expand-toggle--expanded" : ""}`,
|
|
1775
|
+
"aria-label": expanded ? "Collapse" : "Expand",
|
|
1776
|
+
"aria-expanded": expanded,
|
|
1777
|
+
children: /* @__PURE__ */ jsx11(KeyboardArrowDown2, { style: { width: 16, height: 16 } })
|
|
1778
|
+
}
|
|
1779
|
+
);
|
|
1780
|
+
const renderExpandSpacer = () => /* @__PURE__ */ jsx11("span", { className: "ls-variable-picker__expand-spacer", "aria-hidden": true });
|
|
1781
|
+
const getVariableValuePreview = (variableValue) => {
|
|
1782
|
+
const { displayValue, fullValue } = getVariableValueDisplay(variableValue);
|
|
1783
|
+
return { displayValue, fullValue };
|
|
1784
|
+
};
|
|
1785
|
+
const renderVariableValueInput = (displayValue, fullValue) => /* @__PURE__ */ jsx11(
|
|
1786
|
+
"input",
|
|
1787
|
+
{
|
|
1788
|
+
className: "ls-variable-picker__value-input",
|
|
1789
|
+
title: fullValue,
|
|
1790
|
+
readOnly: true,
|
|
1791
|
+
value: fullValue || displayValue,
|
|
1792
|
+
onClick: (e) => e.stopPropagation(),
|
|
1793
|
+
onMouseDown: (e) => e.stopPropagation(),
|
|
1794
|
+
onKeyDown: (e) => e.stopPropagation(),
|
|
1795
|
+
"aria-label": t("common.value", "Value")
|
|
1796
|
+
}
|
|
1797
|
+
);
|
|
1798
|
+
const renderValueChildRows = (rootToken, nodes) => nodes.map((node) => {
|
|
1799
|
+
const fullToken = `${rootToken}.${node.relativePath}`;
|
|
1800
|
+
const expanded = node.isExpandable && isPathExpanded(fullToken);
|
|
1801
|
+
const { displayValue, fullValue } = getVariableValuePreview(node.value);
|
|
1802
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1803
|
+
/* @__PURE__ */ jsxs5(
|
|
1804
|
+
"div",
|
|
1805
|
+
{
|
|
1806
|
+
className: "ls-variable-picker__row ls-variable-picker__row--child",
|
|
1807
|
+
onClick: () => {
|
|
1808
|
+
if (node.isExpandable && !expanded) toggleExpand(fullToken);
|
|
1809
|
+
else insertVariable(fullToken);
|
|
1810
|
+
},
|
|
1811
|
+
children: [
|
|
1812
|
+
/* @__PURE__ */ jsxs5(
|
|
1813
|
+
"div",
|
|
1814
|
+
{
|
|
1815
|
+
className: "ls-variable-picker__token-cell",
|
|
1816
|
+
style: { paddingLeft: `${node.depth * 1.25}rem` },
|
|
1817
|
+
children: [
|
|
1818
|
+
node.isExpandable ? renderExpandToggle(fullToken, expanded) : renderExpandSpacer(),
|
|
1819
|
+
/* @__PURE__ */ jsx11(
|
|
1820
|
+
"div",
|
|
1821
|
+
{
|
|
1822
|
+
className: `ls-variable-token ${CHILD_VARIABLE_COLOR_CLASS}`,
|
|
1823
|
+
children: /* @__PURE__ */ jsx11("span", { className: "ls-variable-token__name", children: `{{${fullToken}}}` })
|
|
1824
|
+
}
|
|
1825
|
+
)
|
|
1826
|
+
]
|
|
1827
|
+
}
|
|
1828
|
+
),
|
|
1829
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: node.displayKey }),
|
|
1830
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__value", title: fullValue, children: renderVariableValueInput(displayValue, fullValue) })
|
|
1831
|
+
]
|
|
1832
|
+
}
|
|
1833
|
+
),
|
|
1834
|
+
expanded && renderValueChildRows(rootToken, node.children)
|
|
1835
|
+
] }, fullToken);
|
|
1836
|
+
});
|
|
1837
|
+
const toOptionLabelString = (input) => {
|
|
1838
|
+
if (typeof input === "string") return input;
|
|
1839
|
+
if (typeof input === "number" || typeof input === "boolean" || typeof input === "bigint")
|
|
1840
|
+
return String(input);
|
|
1841
|
+
if (input === null || input === void 0) return "";
|
|
1842
|
+
if (typeof input === "object") {
|
|
1843
|
+
const labelCandidate = input.label;
|
|
1844
|
+
if (typeof labelCandidate === "string") return labelCandidate;
|
|
1845
|
+
if (typeof labelCandidate === "number" || typeof labelCandidate === "boolean" || typeof labelCandidate === "bigint")
|
|
1846
|
+
return String(labelCandidate);
|
|
1847
|
+
const valueCandidate = input.value;
|
|
1848
|
+
if (typeof valueCandidate === "string") return valueCandidate;
|
|
1849
|
+
if (typeof valueCandidate === "number" || typeof valueCandidate === "boolean" || typeof valueCandidate === "bigint")
|
|
1850
|
+
return String(valueCandidate);
|
|
1851
|
+
try {
|
|
1852
|
+
return JSON.stringify(input);
|
|
1853
|
+
} catch {
|
|
1854
|
+
return "[object Object]";
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
return String(input);
|
|
1858
|
+
};
|
|
1859
|
+
const resolveOptionLabel = (option) => {
|
|
1860
|
+
if (typeof getOptionLabel === "function") {
|
|
1861
|
+
try {
|
|
1862
|
+
const customLabel = getOptionLabel(option);
|
|
1863
|
+
return toOptionLabelString(
|
|
1864
|
+
customLabel === void 0 ? option : customLabel
|
|
1865
|
+
);
|
|
1866
|
+
} catch {
|
|
1867
|
+
return toOptionLabelString(option);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
return toOptionLabelString(option);
|
|
1871
|
+
};
|
|
1872
|
+
const defaultRenderOption = (optionProps, option) => {
|
|
1873
|
+
const opt = option;
|
|
1874
|
+
const thumb = opt?.imageUrl ?? opt?.thumb ?? opt?.iconUrl ?? opt?.previewImageUrl;
|
|
1875
|
+
const helperText = typeof opt?.helperText === "string" ? opt.helperText : "";
|
|
1876
|
+
const isSelected = opt?.value === value;
|
|
1877
|
+
return /* @__PURE__ */ createElement(
|
|
1878
|
+
"li",
|
|
1879
|
+
{
|
|
1880
|
+
...optionProps,
|
|
1881
|
+
key: String(opt?.label ?? opt?.value ?? ""),
|
|
1882
|
+
className: [
|
|
1883
|
+
optionProps.className,
|
|
1884
|
+
"ls-variable-option",
|
|
1885
|
+
isSelected ? "ls-variable-option--selected" : ""
|
|
1886
|
+
].filter(Boolean).join(" ")
|
|
1887
|
+
},
|
|
1888
|
+
thumb ? /* @__PURE__ */ jsx11(
|
|
1889
|
+
"img",
|
|
1890
|
+
{
|
|
1891
|
+
src: thumb,
|
|
1892
|
+
className: "ls-variable-option__thumb",
|
|
1893
|
+
alt: ""
|
|
1894
|
+
}
|
|
1895
|
+
) : null,
|
|
1896
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-option__body", children: [
|
|
1897
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-option__label", children: resolveOptionLabel(opt) }),
|
|
1898
|
+
helperText ? /* @__PURE__ */ jsx11("div", { className: "ls-variable-option__helper", children: helperText }) : null
|
|
1899
|
+
] })
|
|
1900
|
+
);
|
|
1901
|
+
};
|
|
1902
|
+
const showSuggestedSection = allowedVariableNames.length > 0 && filteredAllowedVariables.length > 0;
|
|
1903
|
+
const pickerBody = /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker ls-variable-picker--three-col", children: [
|
|
1904
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
|
|
1905
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__intro-text", children: t(
|
|
1906
|
+
"overlay-variables.variables-description",
|
|
1907
|
+
"Use variables that will automatically be replaced before sending out the text"
|
|
1908
|
+
) }),
|
|
1909
|
+
/* @__PURE__ */ jsx11(
|
|
1910
|
+
LSInput,
|
|
1911
|
+
{
|
|
1912
|
+
autoFocus: true,
|
|
1913
|
+
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { color: "#fff", width: 20, height: 20 } }),
|
|
1914
|
+
placeholder: t("common.search", "Search"),
|
|
1915
|
+
value: searchQuery,
|
|
1916
|
+
onChange: (e) => setSearchQuery(e.target.value),
|
|
1917
|
+
type: "text"
|
|
1918
|
+
}
|
|
1919
|
+
)
|
|
1920
|
+
] }),
|
|
1921
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__header", children: [
|
|
1922
|
+
/* @__PURE__ */ jsx11("div", { style: { paddingLeft: "2.2rem" }, children: t("commands.variable", "Variable") }),
|
|
1923
|
+
/* @__PURE__ */ jsx11("div", { children: t("commands.description", "Description") }),
|
|
1924
|
+
/* @__PURE__ */ jsx11("div", { children: t("common.value", "Value") })
|
|
1925
|
+
] }),
|
|
1926
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__list", children: [
|
|
1927
|
+
showSuggestedSection && /* @__PURE__ */ jsxs5("fieldset", { className: "ls-variable-picker__field", children: [
|
|
1928
|
+
/* @__PURE__ */ jsx11("legend", { className: "ls-variable-picker__legend", children: t("commands.suggested-variables", "Suggested Variables") }),
|
|
1929
|
+
filteredAllowedVariables.map((definition, idx) => {
|
|
1930
|
+
const variableType = getAllowedVariableVisualType(
|
|
1931
|
+
definition.name
|
|
1932
|
+
);
|
|
1933
|
+
const tree = getAllowedVariableTree(definition);
|
|
1934
|
+
const { displayValue, fullValue } = getVariableValuePreview(
|
|
1935
|
+
getAllowedVariableValue(definition.name) ?? definition.example
|
|
1936
|
+
);
|
|
1937
|
+
const expandable = !!tree && tree.length > 0;
|
|
1938
|
+
const expanded = expandable && isPathExpanded(definition.name);
|
|
1939
|
+
const isLast = idx === filteredAllowedVariables.length - 1;
|
|
1940
|
+
const rowCls = `ls-variable-picker__row${isLast && !expanded ? " ls-variable-picker__row--no-border" : ""}`;
|
|
1941
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1942
|
+
/* @__PURE__ */ jsxs5(
|
|
1943
|
+
"div",
|
|
1944
|
+
{
|
|
1945
|
+
className: rowCls,
|
|
1946
|
+
onClick: () => {
|
|
1947
|
+
if (expandable && !expanded)
|
|
1948
|
+
toggleExpand(definition.name);
|
|
1949
|
+
else insertVariable(definition.name);
|
|
1950
|
+
},
|
|
1951
|
+
children: [
|
|
1952
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__token-cell", children: [
|
|
1953
|
+
expandable ? renderExpandToggle(definition.name, expanded) : renderExpandSpacer(),
|
|
1954
|
+
renderVariableToken(definition.name, variableType, true)
|
|
1955
|
+
] }),
|
|
1956
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getAllowedVariableDescription(definition.name) }),
|
|
1957
|
+
/* @__PURE__ */ jsx11(
|
|
1958
|
+
"div",
|
|
1959
|
+
{
|
|
1960
|
+
className: "ls-variable-picker__value",
|
|
1961
|
+
title: fullValue,
|
|
1962
|
+
children: renderVariableValueInput(displayValue, fullValue)
|
|
1963
|
+
}
|
|
1964
|
+
)
|
|
1965
|
+
]
|
|
1966
|
+
}
|
|
1967
|
+
),
|
|
1968
|
+
expanded && tree && renderValueChildRows(definition.name, tree)
|
|
1969
|
+
] }, definition.name);
|
|
1970
|
+
})
|
|
1971
|
+
] }),
|
|
1972
|
+
filteredSystemVariables?.map((variable) => {
|
|
1973
|
+
const variableType = visualTypeFromRecord(variable);
|
|
1974
|
+
const { displayValue, fullValue } = getVariableValuePreview(
|
|
1975
|
+
variable.value
|
|
1976
|
+
);
|
|
1977
|
+
const rootToken = variable.example ?? variable.name;
|
|
1978
|
+
const tree = systemVariableValueTrees.get(variable.name);
|
|
1979
|
+
const expandable = !!tree && tree.length > 0;
|
|
1980
|
+
const expanded = expandable && isPathExpanded(rootToken);
|
|
1981
|
+
return /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
1982
|
+
/* @__PURE__ */ jsxs5(
|
|
1983
|
+
"div",
|
|
1984
|
+
{
|
|
1985
|
+
className: "ls-variable-picker__row",
|
|
1986
|
+
onClick: () => {
|
|
1987
|
+
if (expandable && !expanded) toggleExpand(rootToken);
|
|
1988
|
+
else insertVariable(rootToken);
|
|
1989
|
+
},
|
|
1990
|
+
children: [
|
|
1991
|
+
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__token-cell", children: [
|
|
1992
|
+
expandable ? renderExpandToggle(rootToken, expanded) : renderExpandSpacer(),
|
|
1993
|
+
renderVariableToken(variable.name, variableType)
|
|
1994
|
+
] }),
|
|
1995
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getSystemVariableDescription(variable) }),
|
|
1996
|
+
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__value", title: fullValue, children: renderVariableValueInput(displayValue, fullValue) })
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
),
|
|
2000
|
+
expanded && tree && renderValueChildRows(rootToken, tree)
|
|
2001
|
+
] }, variable.name);
|
|
2002
|
+
})
|
|
2003
|
+
] })
|
|
2004
|
+
] });
|
|
1187
2005
|
const textField = (params = {}) => /* @__PURE__ */ jsx11(
|
|
1188
2006
|
VariableInputTextField,
|
|
1189
2007
|
{
|
|
2008
|
+
t,
|
|
1190
2009
|
params,
|
|
1191
2010
|
id: variableId.current,
|
|
1192
2011
|
containerRef,
|
|
@@ -1201,19 +2020,21 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1201
2020
|
rows,
|
|
1202
2021
|
maxRows,
|
|
1203
2022
|
value,
|
|
1204
|
-
onChange,
|
|
2023
|
+
onChange: $disableInputChange ? void 0 : onChange,
|
|
1205
2024
|
clickedVariableIcon,
|
|
1206
2025
|
inputProps,
|
|
2026
|
+
allowedVariables,
|
|
2027
|
+
showVariableIcon: !hideVariables && (!isAutoComplete || allowedVariableDefinitions.length > 0),
|
|
1207
2028
|
ref
|
|
1208
2029
|
}
|
|
1209
2030
|
);
|
|
1210
|
-
return /* @__PURE__ */ jsxs5(
|
|
2031
|
+
return /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
1211
2032
|
/* @__PURE__ */ jsx11(
|
|
1212
2033
|
Popover,
|
|
1213
2034
|
{
|
|
1214
2035
|
anchorEl: containerRef.current,
|
|
1215
|
-
anchorOrigin: { vertical: "bottom", horizontal: "
|
|
1216
|
-
transformOrigin: { vertical: "top", horizontal: "
|
|
2036
|
+
anchorOrigin: { vertical: "bottom", horizontal: "left" },
|
|
2037
|
+
transformOrigin: { vertical: "top", horizontal: "left" },
|
|
1217
2038
|
open: !hideVariables && showVariables,
|
|
1218
2039
|
onClose: clickedVariableIcon,
|
|
1219
2040
|
slotProps: {
|
|
@@ -1221,59 +2042,110 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1221
2042
|
sx: {
|
|
1222
2043
|
color: "var(--neutralLight2, #cac9d5)",
|
|
1223
2044
|
backgroundColor: "var(--neutralDark1, #171628)",
|
|
1224
|
-
padding
|
|
1225
|
-
|
|
2045
|
+
// Paper has no padding of its own — the picker body's `p-2` is the
|
|
2046
|
+
// single source of internal spacing. Adding paper padding on top of
|
|
2047
|
+
// that compounds the inset and forces premature horizontal scroll.
|
|
2048
|
+
padding: 0,
|
|
2049
|
+
border: "1px solid var(--neutralDark4, #393853)",
|
|
2050
|
+
borderRadius: "var(--radius, 1rem)",
|
|
2051
|
+
overflow: "hidden"
|
|
1226
2052
|
}
|
|
1227
2053
|
}
|
|
1228
2054
|
},
|
|
1229
|
-
children:
|
|
1230
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__intro", children: [
|
|
1231
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variables-description", "Use variables that will automatically be replaced before sending out the text") }),
|
|
1232
|
-
/* @__PURE__ */ jsx11(
|
|
1233
|
-
LSInput,
|
|
1234
|
-
{
|
|
1235
|
-
autoFocus: true,
|
|
1236
|
-
startAdornment: /* @__PURE__ */ jsx11(Search, { style: { width: 18, height: 18 } }),
|
|
1237
|
-
placeholder: t("assets.search", "Search"),
|
|
1238
|
-
value: searchQuery,
|
|
1239
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
1240
|
-
type: "text",
|
|
1241
|
-
style: { padding: "1rem 0 0" }
|
|
1242
|
-
}
|
|
1243
|
-
)
|
|
1244
|
-
] }),
|
|
1245
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__header", children: [
|
|
1246
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.variable", "Variable") }),
|
|
1247
|
-
/* @__PURE__ */ jsx11("div", { children: t("overlay-variables.description", "Description") })
|
|
1248
|
-
] }),
|
|
1249
|
-
/* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__list", children: [
|
|
1250
|
-
allowedVariableNames.length > 0 && filteredAllowedVariables?.map((variableName) => /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__row", onClick: () => insertVariable(variableName), children: [
|
|
1251
|
-
renderVariableToken(variableName, getVariableVisualType(variableName), true),
|
|
1252
|
-
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: getAllowedVariableDescription(variableName) })
|
|
1253
|
-
] }, variableName)),
|
|
1254
|
-
filteredSystemVariables?.map((variableKey) => /* @__PURE__ */ jsxs5("div", { className: "ls-variable-picker__row", onClick: () => insertVariable(variableKey), children: [
|
|
1255
|
-
renderVariableToken(variableKey, getVariableVisualType(variableKey)),
|
|
1256
|
-
/* @__PURE__ */ jsx11("div", { className: "ls-variable-picker__description", children: t(`variables.${variableKey}`, "-", { example: systemVariables?.[variableKey], interpolation: { escapeValue: false, prefix: "{{{", suffix: "}}}" } }) })
|
|
1257
|
-
] }, variableKey))
|
|
1258
|
-
] })
|
|
1259
|
-
] })
|
|
2055
|
+
children: pickerBody
|
|
1260
2056
|
}
|
|
1261
2057
|
),
|
|
1262
2058
|
isAutoComplete ? /* @__PURE__ */ jsx11(
|
|
1263
2059
|
Autocomplete2,
|
|
1264
2060
|
{
|
|
1265
2061
|
disableClearable: true,
|
|
1266
|
-
|
|
2062
|
+
openOnFocus: true,
|
|
1267
2063
|
includeInputInList: true,
|
|
1268
|
-
|
|
1269
|
-
|
|
2064
|
+
multiple: $multiple,
|
|
2065
|
+
freeSolo: $freeSolo,
|
|
2066
|
+
disableCloseOnSelect: $disableCloseOnSelect,
|
|
2067
|
+
groupBy: autoCompleteGroupBy,
|
|
1270
2068
|
options: autoCompleteOptions ?? [],
|
|
2069
|
+
isOptionEqualToValue,
|
|
1271
2070
|
value,
|
|
1272
|
-
|
|
1273
|
-
|
|
2071
|
+
disabled,
|
|
2072
|
+
loading,
|
|
2073
|
+
getOptionLabel: resolveOptionLabel,
|
|
2074
|
+
onChange: (_e, nextValue) => {
|
|
2075
|
+
if ($getFullValueObject) {
|
|
2076
|
+
onChange?.(nextValue);
|
|
2077
|
+
return;
|
|
2078
|
+
}
|
|
2079
|
+
if ($multiple) {
|
|
2080
|
+
const list = Array.isArray(nextValue) ? nextValue : nextValue ? [nextValue] : [];
|
|
2081
|
+
const mapped = list.map((entry) => {
|
|
2082
|
+
if (entry && typeof entry === "object" && "value" in entry) {
|
|
2083
|
+
return entry.value;
|
|
2084
|
+
}
|
|
2085
|
+
return entry;
|
|
2086
|
+
});
|
|
2087
|
+
onChange?.(mapped);
|
|
2088
|
+
return;
|
|
2089
|
+
}
|
|
2090
|
+
if (nextValue && typeof nextValue === "object" && "value" in nextValue) {
|
|
2091
|
+
onChange?.(nextValue.value);
|
|
2092
|
+
return;
|
|
2093
|
+
}
|
|
2094
|
+
onChange?.(nextValue);
|
|
2095
|
+
},
|
|
2096
|
+
onInputChange: $disableInputChange ? void 0 : (_e, nextValue) => onChange?.(nextValue),
|
|
1274
2097
|
filterOptions: handleFilterOptions,
|
|
1275
|
-
|
|
1276
|
-
|
|
2098
|
+
renderOption: $renderOption ?? renderOption ?? defaultRenderOption,
|
|
2099
|
+
slots: ListboxComponent ? { listbox: ListboxComponent } : void 0,
|
|
2100
|
+
slotProps: {
|
|
2101
|
+
popper: {
|
|
2102
|
+
className: "ls-variable-autocomplete-popper"
|
|
2103
|
+
},
|
|
2104
|
+
paper: {
|
|
2105
|
+
className: "ls-variable-autocomplete-paper",
|
|
2106
|
+
sx: {
|
|
2107
|
+
border: "1px solid var(--neutralDark4, var(--cardborder, #393853))",
|
|
2108
|
+
borderRadius: "var(--radius, 1rem)",
|
|
2109
|
+
backgroundColor: "var(--neutralDark2, var(--cardbackground, #211f45))",
|
|
2110
|
+
color: "var(--neutralLight1, var(--white, #fff))",
|
|
2111
|
+
boxShadow: "0 16px 32px rgba(0, 0, 0, 0.32)",
|
|
2112
|
+
overflow: "hidden"
|
|
2113
|
+
}
|
|
2114
|
+
},
|
|
2115
|
+
listbox: {
|
|
2116
|
+
className: "ls-variable-autocomplete-listbox",
|
|
2117
|
+
onScroll: onScrollListBox,
|
|
2118
|
+
sx: {
|
|
2119
|
+
padding: "0.25rem 0",
|
|
2120
|
+
backgroundColor: "var(--neutralDark2, var(--cardbackground, #211f45))",
|
|
2121
|
+
color: "var(--neutralLight1, var(--white, #fff))",
|
|
2122
|
+
"& .MuiAutocomplete-option": {
|
|
2123
|
+
display: "flex",
|
|
2124
|
+
minHeight: 44,
|
|
2125
|
+
alignItems: "center",
|
|
2126
|
+
padding: "0.625rem 1rem",
|
|
2127
|
+
color: "var(--neutralLight1, var(--white, #fff))",
|
|
2128
|
+
fontSize: "1rem",
|
|
2129
|
+
lineHeight: 1.35,
|
|
2130
|
+
transition: "background-color 120ms ease, color 120ms ease"
|
|
2131
|
+
},
|
|
2132
|
+
"& .MuiAutocomplete-option:hover, & .MuiAutocomplete-option.Mui-focused, & .MuiAutocomplete-option[data-focus='true'], & .MuiAutocomplete-option[aria-selected='true']": {
|
|
2133
|
+
backgroundColor: "var(--cardHover, var(--transwhite, rgba(255, 255, 255, 0.05)))",
|
|
2134
|
+
color: "var(--neutralLight1, var(--white, #fff))"
|
|
2135
|
+
}
|
|
2136
|
+
}
|
|
2137
|
+
},
|
|
2138
|
+
popupIndicator: {
|
|
2139
|
+
className: "ls-variable-autocomplete-popup-indicator",
|
|
2140
|
+
sx: {
|
|
2141
|
+
color: "var(--neutralLight1, var(--white, #fff))",
|
|
2142
|
+
"& svg": {
|
|
2143
|
+
color: "var(--neutralLight1, var(--white, #fff))",
|
|
2144
|
+
fill: "currentColor"
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
},
|
|
1277
2149
|
onHighlightChange,
|
|
1278
2150
|
onOpen: onPopupOpen,
|
|
1279
2151
|
onClose: onPopupClose,
|
|
@@ -1284,7 +2156,35 @@ var LSVariableInputField = forwardRef4((props, ref) => {
|
|
|
1284
2156
|
});
|
|
1285
2157
|
LSVariableInputField.displayName = "LSVariableInputField";
|
|
1286
2158
|
var VariableInputTextField = forwardRef4(
|
|
1287
|
-
({
|
|
2159
|
+
({
|
|
2160
|
+
t,
|
|
2161
|
+
id,
|
|
2162
|
+
name,
|
|
2163
|
+
label,
|
|
2164
|
+
type,
|
|
2165
|
+
variant,
|
|
2166
|
+
disabled,
|
|
2167
|
+
autoFocus,
|
|
2168
|
+
multiline,
|
|
2169
|
+
placeholder,
|
|
2170
|
+
rows,
|
|
2171
|
+
maxRows,
|
|
2172
|
+
value,
|
|
2173
|
+
onChange,
|
|
2174
|
+
inputProps,
|
|
2175
|
+
clickedVariableIcon,
|
|
2176
|
+
params = {},
|
|
2177
|
+
containerRef,
|
|
2178
|
+
showVariableIcon
|
|
2179
|
+
}, ref) => {
|
|
2180
|
+
const inputPropsInputProps = inputProps?.InputProps ?? {};
|
|
2181
|
+
const paramsInputProps = params?.InputProps ?? {};
|
|
2182
|
+
const inputPropsSlotInputProps = inputProps?.slotProps?.input ?? {};
|
|
2183
|
+
const paramsSlotInputProps = params?.slotProps?.input ?? {};
|
|
2184
|
+
const explicitStartAdornment = inputProps?.startAdornment;
|
|
2185
|
+
const resolvedExplicitStartAdornment = explicitStartAdornment ? /* @__PURE__ */ jsx11(InputAdornment2, { position: "start", children: explicitStartAdornment }) : void 0;
|
|
2186
|
+
const startAdornment = paramsInputProps.startAdornment ?? paramsSlotInputProps.startAdornment ?? inputPropsInputProps.startAdornment ?? inputPropsSlotInputProps.startAdornment ?? resolvedExplicitStartAdornment;
|
|
2187
|
+
const endAdornment = paramsInputProps.endAdornment ?? paramsSlotInputProps.endAdornment ?? inputPropsInputProps.endAdornment ?? inputPropsSlotInputProps.endAdornment;
|
|
1288
2188
|
return /* @__PURE__ */ jsx11(
|
|
1289
2189
|
LSTextField,
|
|
1290
2190
|
{
|
|
@@ -1292,7 +2192,7 @@ var VariableInputTextField = forwardRef4(
|
|
|
1292
2192
|
name,
|
|
1293
2193
|
label,
|
|
1294
2194
|
type,
|
|
1295
|
-
color: "
|
|
2195
|
+
color: "primary",
|
|
1296
2196
|
variant,
|
|
1297
2197
|
disabled,
|
|
1298
2198
|
autoFocus,
|
|
@@ -1302,46 +2202,37 @@ var VariableInputTextField = forwardRef4(
|
|
|
1302
2202
|
maxRows,
|
|
1303
2203
|
value,
|
|
1304
2204
|
fullWidth: true,
|
|
1305
|
-
className: `mui-ls-input
|
|
1306
|
-
onChange: (e) => onChange
|
|
2205
|
+
className: `mui-ls-input ${params?.className ?? ""} ${inputProps?.className ?? ""}`.trim(),
|
|
2206
|
+
onChange: onChange ? (e) => onChange(e.target.value) : void 0,
|
|
1307
2207
|
...inputProps,
|
|
1308
2208
|
...params,
|
|
1309
2209
|
InputProps: {
|
|
1310
|
-
...
|
|
1311
|
-
...
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
2210
|
+
...inputPropsSlotInputProps,
|
|
2211
|
+
...inputPropsInputProps,
|
|
2212
|
+
...paramsSlotInputProps,
|
|
2213
|
+
...paramsInputProps,
|
|
2214
|
+
startAdornment,
|
|
2215
|
+
endAdornment: /* @__PURE__ */ jsxs5(Fragment2, { children: [
|
|
2216
|
+
endAdornment ?? null,
|
|
2217
|
+
showVariableIcon ? /* @__PURE__ */ jsx11(
|
|
2218
|
+
Tooltip,
|
|
1316
2219
|
{
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
alignItems: "center",
|
|
1327
|
-
justifyContent: "center",
|
|
1328
|
-
padding: "4px",
|
|
1329
|
-
minWidth: "22px",
|
|
1330
|
-
minHeight: "22px",
|
|
1331
|
-
width: "22px",
|
|
1332
|
-
height: "22px",
|
|
1333
|
-
color: "var(--neutralDark1)",
|
|
1334
|
-
"& *": {
|
|
1335
|
-
cursor: "pointer",
|
|
1336
|
-
color: "var(--neutralDark1)"
|
|
2220
|
+
title: t("chatbot.allowed-variables", "Allowed Variables"),
|
|
2221
|
+
children: /* @__PURE__ */ jsx11(
|
|
2222
|
+
InputAdornment2,
|
|
2223
|
+
{
|
|
2224
|
+
position: "end",
|
|
2225
|
+
onClick: clickedVariableIcon,
|
|
2226
|
+
ref: containerRef,
|
|
2227
|
+
className: "ls-variable-input-adornment",
|
|
2228
|
+
children: "{}"
|
|
1337
2229
|
}
|
|
1338
|
-
|
|
1339
|
-
children: "{}"
|
|
2230
|
+
)
|
|
1340
2231
|
}
|
|
1341
|
-
)
|
|
2232
|
+
) : null
|
|
1342
2233
|
] })
|
|
1343
2234
|
},
|
|
1344
|
-
ref
|
|
2235
|
+
inputRef: ref
|
|
1345
2236
|
}
|
|
1346
2237
|
);
|
|
1347
2238
|
}
|