@lumiastream/ui 0.2.8-alpha.9 → 0.3.0
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/README.md +6 -6
- package/dist/LSButton.d.ts +32 -0
- package/dist/LSButton.js +80 -0
- package/dist/LSCheckbox.d.ts +21 -0
- package/dist/LSCheckbox.js +113 -0
- package/dist/LSColorPicker.d.ts +19 -0
- package/dist/LSColorPicker.js +316 -0
- package/dist/LSDatePicker.d.ts +15 -0
- package/dist/LSDatePicker.js +198 -0
- package/dist/LSFontPicker.d.ts +17 -0
- package/dist/LSFontPicker.js +179 -0
- package/dist/LSInput.d.ts +32 -0
- package/dist/LSInput.js +159 -0
- package/dist/LSMultiSelect.d.ts +16 -0
- package/dist/LSMultiSelect.js +274 -0
- package/dist/LSRadio.d.ts +17 -0
- package/dist/LSRadio.js +52 -0
- package/dist/LSSelect.d.ts +12 -0
- package/dist/LSSelect.js +140 -0
- package/dist/LSSliderInput.d.ts +39 -0
- package/dist/LSSliderInput.js +342 -0
- package/dist/LSTextField.d.ts +9 -0
- package/dist/LSTextField.js +63 -0
- package/dist/LSVariableInputField.d.ts +96 -0
- package/dist/LSVariableInputField.js +1402 -0
- package/dist/components.d.ts +22 -0
- package/dist/components.js +2317 -0
- package/dist/index.d.ts +26 -863
- package/dist/index.js +3136 -1446
- package/dist/se-import.d.ts +444 -0
- package/dist/se-import.js +8162 -0
- package/dist/utils/chatMedia.d.ts +106 -0
- package/dist/utils/chatMedia.js +611 -0
- package/dist/utils.d.ts +111 -0
- package/dist/utils.js +830 -0
- package/package.json +76 -7
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
// #style-inject:#style-inject
|
|
2
|
+
function styleInject(css, { insertAt } = {}) {
|
|
3
|
+
if (!css || typeof document === "undefined") return;
|
|
4
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
5
|
+
const style = document.createElement("style");
|
|
6
|
+
style.type = "text/css";
|
|
7
|
+
if (insertAt === "top") {
|
|
8
|
+
if (head.firstChild) {
|
|
9
|
+
head.insertBefore(style, head.firstChild);
|
|
10
|
+
} else {
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
if (style.styleSheet) {
|
|
17
|
+
style.styleSheet.cssText = css;
|
|
18
|
+
} else {
|
|
19
|
+
style.appendChild(document.createTextNode(css));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/lumia-ui.css
|
|
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-date-picker input[type=datetime-local]::-webkit-calendar-picker-indicator {\n cursor: pointer;\n opacity: 0.9;\n filter: invert(1);\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 input::placeholder,\n.mui-ls-input textarea::placeholder {\n color: var(--neutralLight3, var(--grey, #9392a1));\n opacity: 1;\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
|
+
|
|
26
|
+
// src/components/LSSliderInput/LSSliderInput.tsx
|
|
27
|
+
import Slider from "@mui/material/Slider";
|
|
28
|
+
import classNames2 from "classnames";
|
|
29
|
+
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
30
|
+
|
|
31
|
+
// src/components/LSInput/LSInput.tsx
|
|
32
|
+
import FormControl from "@mui/material/FormControl";
|
|
33
|
+
import InputAdornment from "@mui/material/InputAdornment";
|
|
34
|
+
import TextField from "@mui/material/TextField";
|
|
35
|
+
import classNames from "classnames";
|
|
36
|
+
import { forwardRef } from "react";
|
|
37
|
+
import { jsx } from "react/jsx-runtime";
|
|
38
|
+
var LSInput = forwardRef(
|
|
39
|
+
(props, ref) => {
|
|
40
|
+
const hasExplicitValue = Object.prototype.hasOwnProperty.call(props, "value");
|
|
41
|
+
const {
|
|
42
|
+
startAdornment,
|
|
43
|
+
endAdornment,
|
|
44
|
+
inputBeforeText,
|
|
45
|
+
inputAfterText,
|
|
46
|
+
maxWidth,
|
|
47
|
+
className = "",
|
|
48
|
+
InputProps: inputPropsProp,
|
|
49
|
+
InputLabelProps: inputLabelPropsProp,
|
|
50
|
+
inputProps: htmlInputPropsProp,
|
|
51
|
+
slotProps: slotPropsProp,
|
|
52
|
+
onChange,
|
|
53
|
+
onChangeStart,
|
|
54
|
+
onChangeEnd,
|
|
55
|
+
type,
|
|
56
|
+
value,
|
|
57
|
+
helperText,
|
|
58
|
+
error,
|
|
59
|
+
style,
|
|
60
|
+
centerText,
|
|
61
|
+
$noMinHeight,
|
|
62
|
+
bypasscolor,
|
|
63
|
+
textColor,
|
|
64
|
+
fullWidth = true,
|
|
65
|
+
...rest
|
|
66
|
+
} = props;
|
|
67
|
+
const isNumberInput = type === "number";
|
|
68
|
+
const labelIdFallback = typeof rest.label === "string" ? rest.label : void 0;
|
|
69
|
+
const normalizedValue = isNumberInput && (value === void 0 || value === null) ? "" : value;
|
|
70
|
+
const handleChange = (event) => {
|
|
71
|
+
const rawValue = event.target.value;
|
|
72
|
+
let sanitizedValue = rawValue;
|
|
73
|
+
if (isNumberInput) {
|
|
74
|
+
if (rawValue === "") {
|
|
75
|
+
sanitizedValue = void 0;
|
|
76
|
+
} else {
|
|
77
|
+
const numericValue = Number(rawValue);
|
|
78
|
+
sanitizedValue = Number.isNaN(numericValue) ? void 0 : numericValue;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
onChangeStart?.(event, sanitizedValue);
|
|
82
|
+
onChange?.(event, sanitizedValue);
|
|
83
|
+
onChangeEnd?.(event, sanitizedValue);
|
|
84
|
+
};
|
|
85
|
+
const resolvedStartAdornment = inputPropsProp?.startAdornment ?? (startAdornment ? /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: startAdornment }) : inputBeforeText ? /* @__PURE__ */ jsx(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx("span", { className: "mui-ls-input-affix", children: inputBeforeText }) }) : void 0);
|
|
86
|
+
const resolvedEndAdornment = inputPropsProp?.endAdornment ?? (endAdornment ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: endAdornment }) : inputAfterText ? /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx("span", { className: "mui-ls-input-affix", children: inputAfterText }) }) : void 0);
|
|
87
|
+
const inputSlotProps = {
|
|
88
|
+
...inputPropsProp,
|
|
89
|
+
startAdornment: resolvedStartAdornment,
|
|
90
|
+
endAdornment: resolvedEndAdornment,
|
|
91
|
+
readOnly: rest.readOnly ?? inputPropsProp?.readOnly,
|
|
92
|
+
sx: {
|
|
93
|
+
...inputPropsProp?.sx ?? {},
|
|
94
|
+
"& input, & textarea": {
|
|
95
|
+
textAlign: centerText ? "center" : void 0,
|
|
96
|
+
color: textColor ?? void 0
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const inputLabelProps = {
|
|
101
|
+
shrink: true,
|
|
102
|
+
...inputLabelPropsProp
|
|
103
|
+
};
|
|
104
|
+
const helperContent = helperText ?? (typeof error === "string" ? error : "");
|
|
105
|
+
const hasError = typeof error === "string" ? true : Boolean(error);
|
|
106
|
+
const resolvedMaxWidth = maxWidth ?? style?.maxWidth;
|
|
107
|
+
const valueProps = hasExplicitValue ? { value: normalizedValue } : {};
|
|
108
|
+
const slotProps = {
|
|
109
|
+
...slotPropsProp ?? {},
|
|
110
|
+
input: {
|
|
111
|
+
...slotPropsProp?.input ?? {},
|
|
112
|
+
...inputSlotProps,
|
|
113
|
+
sx: {
|
|
114
|
+
...slotPropsProp?.input?.sx ?? {},
|
|
115
|
+
...inputSlotProps.sx
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
inputLabel: {
|
|
119
|
+
...slotPropsProp?.inputLabel ?? {},
|
|
120
|
+
...inputLabelProps
|
|
121
|
+
},
|
|
122
|
+
htmlInput: {
|
|
123
|
+
...slotPropsProp?.htmlInput ?? {},
|
|
124
|
+
...htmlInputPropsProp ?? {}
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
const TextFieldComponent = TextField;
|
|
128
|
+
return /* @__PURE__ */ jsx(
|
|
129
|
+
FormControl,
|
|
130
|
+
{
|
|
131
|
+
variant: "outlined",
|
|
132
|
+
className: classNames("mui-ls-input", className, {
|
|
133
|
+
noMinHeight: $noMinHeight,
|
|
134
|
+
bypassMuiColor: bypasscolor || bypasscolor === "default"
|
|
135
|
+
}),
|
|
136
|
+
style: { ...style, maxWidth: resolvedMaxWidth, width: fullWidth ? "100%" : style?.width },
|
|
137
|
+
children: /* @__PURE__ */ jsx(
|
|
138
|
+
TextFieldComponent,
|
|
139
|
+
{
|
|
140
|
+
...rest,
|
|
141
|
+
...valueProps,
|
|
142
|
+
type,
|
|
143
|
+
id: rest.id ?? rest.name ?? labelIdFallback,
|
|
144
|
+
label: rest.label,
|
|
145
|
+
size: rest.size,
|
|
146
|
+
margin: "dense",
|
|
147
|
+
variant: "outlined",
|
|
148
|
+
color: bypasscolor === "default" || bypasscolor === "inherit" ? "primary" : bypasscolor,
|
|
149
|
+
fullWidth,
|
|
150
|
+
onChange: handleChange,
|
|
151
|
+
slotProps,
|
|
152
|
+
inputRef: ref,
|
|
153
|
+
helperText: helperContent,
|
|
154
|
+
error: hasError
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
);
|
|
161
|
+
LSInput.displayName = "LSInput";
|
|
162
|
+
|
|
163
|
+
// src/components/LSSliderInput/LSSliderInput.tsx
|
|
164
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
165
|
+
var normalizeSliderValue = (rawValue) => {
|
|
166
|
+
if (typeof rawValue === "number") {
|
|
167
|
+
return Number.isFinite(rawValue) ? rawValue : 0;
|
|
168
|
+
}
|
|
169
|
+
if (typeof rawValue === "string") {
|
|
170
|
+
const trimmedValue = rawValue.trim();
|
|
171
|
+
if (!trimmedValue) {
|
|
172
|
+
return 0;
|
|
173
|
+
}
|
|
174
|
+
const numericValue = Number(trimmedValue);
|
|
175
|
+
return Number.isFinite(numericValue) ? numericValue : 0;
|
|
176
|
+
}
|
|
177
|
+
return 0;
|
|
178
|
+
};
|
|
179
|
+
var LSSliderInput = ({
|
|
180
|
+
name,
|
|
181
|
+
value,
|
|
182
|
+
defaultValue,
|
|
183
|
+
isFloat,
|
|
184
|
+
isMiliseconds,
|
|
185
|
+
isFloatMiliseconds,
|
|
186
|
+
label,
|
|
187
|
+
inline,
|
|
188
|
+
hasInfo,
|
|
189
|
+
infoOpen,
|
|
190
|
+
infoClose,
|
|
191
|
+
max = Number.MAX_SAFE_INTEGER,
|
|
192
|
+
min = 0,
|
|
193
|
+
step = 1,
|
|
194
|
+
type = "number",
|
|
195
|
+
inputAfterText,
|
|
196
|
+
onChange,
|
|
197
|
+
inputProps = {},
|
|
198
|
+
helperText,
|
|
199
|
+
fullWidth = false,
|
|
200
|
+
hideInput = false,
|
|
201
|
+
hideSlider = false,
|
|
202
|
+
valueLabelFormat,
|
|
203
|
+
...rest
|
|
204
|
+
}) => {
|
|
205
|
+
const isValueFloat = Boolean(isFloat || isFloatMiliseconds || isMiliseconds);
|
|
206
|
+
const actualToDisplay = useCallback(
|
|
207
|
+
(input) => {
|
|
208
|
+
const numericValue = normalizeSliderValue(input);
|
|
209
|
+
if (!isValueFloat) {
|
|
210
|
+
return numericValue;
|
|
211
|
+
}
|
|
212
|
+
const divisor = isFloatMiliseconds ? 1e3 : 1;
|
|
213
|
+
return Number((numericValue / divisor).toFixed(1));
|
|
214
|
+
},
|
|
215
|
+
[isFloatMiliseconds, isValueFloat]
|
|
216
|
+
);
|
|
217
|
+
const displayStep = useMemo(() => actualToDisplay(step), [actualToDisplay, step]);
|
|
218
|
+
const resolvedDefaultValue = defaultValue ?? 0;
|
|
219
|
+
const [displayValue, setDisplayValue] = useState(() => actualToDisplay(defaultValue ?? value ?? resolvedDefaultValue));
|
|
220
|
+
const displayMaximum = useMemo(() => actualToDisplay(max), [actualToDisplay, max]);
|
|
221
|
+
const displayMinimum = useMemo(() => actualToDisplay(min), [actualToDisplay, min]);
|
|
222
|
+
const sliderValue = typeof displayValue === "number" ? Math.min(displayMaximum, Math.max(displayMinimum, displayValue)) : displayMinimum;
|
|
223
|
+
const stepPrecision = useMemo(() => {
|
|
224
|
+
const stepString = String(displayStep);
|
|
225
|
+
const decimalIndex = stepString.indexOf(".");
|
|
226
|
+
return decimalIndex === -1 ? 0 : stepString.length - decimalIndex - 1;
|
|
227
|
+
}, [displayStep]);
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (value !== void 0) {
|
|
230
|
+
setDisplayValue(actualToDisplay(value));
|
|
231
|
+
}
|
|
232
|
+
}, [actualToDisplay, value]);
|
|
233
|
+
const normalizeDisplayValue = useCallback(
|
|
234
|
+
(input) => {
|
|
235
|
+
const bounded = Math.min(displayMaximum, Math.max(displayMinimum, input));
|
|
236
|
+
if (!Number.isFinite(displayStep) || displayStep <= 0) {
|
|
237
|
+
return bounded;
|
|
238
|
+
}
|
|
239
|
+
const snapped = Math.round((bounded - displayMinimum) / displayStep) * displayStep + displayMinimum;
|
|
240
|
+
return Number(snapped.toFixed(stepPrecision));
|
|
241
|
+
},
|
|
242
|
+
[displayMaximum, displayMinimum, displayStep, stepPrecision]
|
|
243
|
+
);
|
|
244
|
+
const handleInputChange = useCallback(
|
|
245
|
+
({ target: { value: inputValue } }) => {
|
|
246
|
+
setDisplayValue(inputValue ?? "");
|
|
247
|
+
if (inputValue === "" || inputValue === null) {
|
|
248
|
+
if (typeof onChange === "function") {
|
|
249
|
+
onChange(void 0);
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const numericValue = Number(inputValue);
|
|
254
|
+
if (Number.isNaN(numericValue)) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
const normalizedDisplayValue = normalizeDisplayValue(numericValue);
|
|
258
|
+
const updatedValue = isFloatMiliseconds ? normalizedDisplayValue * 1e3 : normalizedDisplayValue;
|
|
259
|
+
const upperBound = typeof max === "number" ? max : Number.MAX_SAFE_INTEGER;
|
|
260
|
+
const lowerBound = typeof min === "number" ? min : 0;
|
|
261
|
+
const isValid = updatedValue >= lowerBound && updatedValue <= upperBound;
|
|
262
|
+
if (isValid && typeof onChange === "function") {
|
|
263
|
+
onChange(updatedValue);
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
[isFloatMiliseconds, max, min, normalizeDisplayValue, onChange]
|
|
267
|
+
);
|
|
268
|
+
const handleSliderChange = useCallback(
|
|
269
|
+
(_, sliderInputValue) => {
|
|
270
|
+
const numericValue = typeof sliderInputValue === "number" ? sliderInputValue : sliderInputValue[0];
|
|
271
|
+
const normalizedDisplayValue = normalizeDisplayValue(numericValue);
|
|
272
|
+
setDisplayValue(normalizedDisplayValue);
|
|
273
|
+
const nextValue = isFloatMiliseconds ? normalizedDisplayValue * 1e3 : normalizedDisplayValue;
|
|
274
|
+
onChange?.(nextValue);
|
|
275
|
+
},
|
|
276
|
+
[isFloatMiliseconds, normalizeDisplayValue, onChange]
|
|
277
|
+
);
|
|
278
|
+
const controlsRow = /* @__PURE__ */ jsxs(
|
|
279
|
+
"div",
|
|
280
|
+
{
|
|
281
|
+
className: classNames2("mui-ls-slider-input-row", {
|
|
282
|
+
"mui-ls-slider-input-row--slider": !hideSlider,
|
|
283
|
+
"mui-ls-slider-input-row--input": hideInput
|
|
284
|
+
}),
|
|
285
|
+
children: [
|
|
286
|
+
!hideSlider && /* @__PURE__ */ jsx2(
|
|
287
|
+
Slider,
|
|
288
|
+
{
|
|
289
|
+
value: sliderValue,
|
|
290
|
+
onChange: handleSliderChange,
|
|
291
|
+
onBlur: rest.onBlur,
|
|
292
|
+
color: "primary",
|
|
293
|
+
valueLabelDisplay: "auto",
|
|
294
|
+
valueLabelFormat: (v) => valueLabelFormat?.(v) ?? `${v}${inputAfterText ?? ""}`,
|
|
295
|
+
min: displayMinimum,
|
|
296
|
+
max: displayMaximum,
|
|
297
|
+
step: displayStep,
|
|
298
|
+
sx: { flex: 1, minWidth: 0 }
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
!hideInput && /* @__PURE__ */ jsx2(
|
|
302
|
+
LSInput,
|
|
303
|
+
{
|
|
304
|
+
...rest,
|
|
305
|
+
...inputProps,
|
|
306
|
+
type,
|
|
307
|
+
name,
|
|
308
|
+
onChange: (_event, nextValue) => handleInputChange({ target: { value: nextValue ?? "" } }),
|
|
309
|
+
value: displayValue ?? "",
|
|
310
|
+
inputAfterText,
|
|
311
|
+
InputProps: {
|
|
312
|
+
...inputProps?.InputProps ?? {},
|
|
313
|
+
name,
|
|
314
|
+
type: "number",
|
|
315
|
+
value: displayValue,
|
|
316
|
+
min: displayMinimum,
|
|
317
|
+
max: displayMaximum,
|
|
318
|
+
step: displayStep,
|
|
319
|
+
inputMode: stepPrecision > 0 ? "decimal" : "numeric"
|
|
320
|
+
},
|
|
321
|
+
fullWidth: hideSlider ? fullWidth : false,
|
|
322
|
+
$noMinHeight: false,
|
|
323
|
+
className: hideSlider ? inputProps?.className : `${inputProps?.className ?? ""} mui-ls-slider-input-value`.trim(),
|
|
324
|
+
style: hideSlider ? inputProps?.style : { width: 112, maxWidth: 112, flexShrink: 0 },
|
|
325
|
+
...!hideSlider ? { size: "small" } : {}
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
);
|
|
331
|
+
return /* @__PURE__ */ jsxs("div", { className: "mui-ls-slider-input-root", children: [
|
|
332
|
+
/* @__PURE__ */ jsxs("fieldset", { className: "mui-ls-slider-input-fieldset", children: [
|
|
333
|
+
label && /* @__PURE__ */ jsx2("legend", { className: "mui-ls-slider-input-legend", children: label }),
|
|
334
|
+
controlsRow
|
|
335
|
+
] }),
|
|
336
|
+
helperText && /* @__PURE__ */ jsx2("small", { className: "mui-ls-slider-input-helper", children: helperText })
|
|
337
|
+
] });
|
|
338
|
+
};
|
|
339
|
+
LSSliderInput.displayName = "LSSliderInput";
|
|
340
|
+
export {
|
|
341
|
+
LSSliderInput
|
|
342
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
type LSTextFieldProps = Record<string, any> & {
|
|
4
|
+
InputLabelProps?: Record<string, unknown>;
|
|
5
|
+
InputProps?: Record<string, unknown>;
|
|
6
|
+
};
|
|
7
|
+
declare const LSTextField: React.ForwardRefExoticComponent<Omit<LSTextFieldProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
|
|
9
|
+
export { LSTextField, type LSTextFieldProps };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// #style-inject:#style-inject
|
|
2
|
+
function styleInject(css, { insertAt } = {}) {
|
|
3
|
+
if (!css || typeof document === "undefined") return;
|
|
4
|
+
const head = document.head || document.getElementsByTagName("head")[0];
|
|
5
|
+
const style = document.createElement("style");
|
|
6
|
+
style.type = "text/css";
|
|
7
|
+
if (insertAt === "top") {
|
|
8
|
+
if (head.firstChild) {
|
|
9
|
+
head.insertBefore(style, head.firstChild);
|
|
10
|
+
} else {
|
|
11
|
+
head.appendChild(style);
|
|
12
|
+
}
|
|
13
|
+
} else {
|
|
14
|
+
head.appendChild(style);
|
|
15
|
+
}
|
|
16
|
+
if (style.styleSheet) {
|
|
17
|
+
style.styleSheet.cssText = css;
|
|
18
|
+
} else {
|
|
19
|
+
style.appendChild(document.createTextNode(css));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/lumia-ui.css
|
|
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-date-picker input[type=datetime-local]::-webkit-calendar-picker-indicator {\n cursor: pointer;\n opacity: 0.9;\n filter: invert(1);\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 input::placeholder,\n.mui-ls-input textarea::placeholder {\n color: var(--neutralLight3, var(--grey, #9392a1));\n opacity: 1;\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
|
+
|
|
26
|
+
// src/components/LSTextField/LSTextField.tsx
|
|
27
|
+
import TextField from "@mui/material/TextField";
|
|
28
|
+
import { forwardRef } from "react";
|
|
29
|
+
import { jsx } from "react/jsx-runtime";
|
|
30
|
+
var LSTextField = forwardRef(
|
|
31
|
+
(props, ref) => {
|
|
32
|
+
const { InputLabelProps, InputProps, slotProps, ...rest } = props;
|
|
33
|
+
return /* @__PURE__ */ jsx(
|
|
34
|
+
TextField,
|
|
35
|
+
{
|
|
36
|
+
...rest,
|
|
37
|
+
variant: "outlined",
|
|
38
|
+
className: "mui-ls-input",
|
|
39
|
+
slotProps: {
|
|
40
|
+
...slotProps ?? {},
|
|
41
|
+
input: {
|
|
42
|
+
...slotProps?.input ?? {},
|
|
43
|
+
...InputProps ?? {},
|
|
44
|
+
sx: {
|
|
45
|
+
...slotProps?.input?.sx ?? {},
|
|
46
|
+
...InputProps?.sx ?? {}
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
inputLabel: {
|
|
50
|
+
...slotProps?.inputLabel ?? {},
|
|
51
|
+
shrink: true,
|
|
52
|
+
...InputLabelProps ?? {}
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
ref
|
|
56
|
+
}
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
LSTextField.displayName = "LSTextField";
|
|
61
|
+
export {
|
|
62
|
+
LSTextField
|
|
63
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ReactNode, HTMLAttributes } from 'react';
|
|
4
|
+
import { AutocompleteRenderOptionState } from '@mui/material/Autocomplete';
|
|
5
|
+
|
|
6
|
+
interface IVariables {
|
|
7
|
+
name: string;
|
|
8
|
+
system: boolean;
|
|
9
|
+
isFunction?: boolean;
|
|
10
|
+
locked?: boolean;
|
|
11
|
+
origin: string;
|
|
12
|
+
pluginId?: string;
|
|
13
|
+
allowedPlaces?: string[];
|
|
14
|
+
description: string;
|
|
15
|
+
counter?: boolean;
|
|
16
|
+
example?: string;
|
|
17
|
+
value: string | number | boolean | null | Record<string, unknown> | unknown[];
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
}
|
|
20
|
+
type LSVariableDefinition = {
|
|
21
|
+
name: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
origin?: string;
|
|
24
|
+
example?: unknown;
|
|
25
|
+
};
|
|
26
|
+
type LSVariableInputTranslate = (key: string, fallback?: string, options?: Record<string, unknown>) => string;
|
|
27
|
+
type LSVariableInputContextValue = {
|
|
28
|
+
systemVariables?: Record<string, unknown>;
|
|
29
|
+
functionVariables?: string[];
|
|
30
|
+
translate?: LSVariableInputTranslate;
|
|
31
|
+
onVariableTranslationsNeeded?: () => void;
|
|
32
|
+
isOriginConnected?: (origin: string) => boolean;
|
|
33
|
+
translationKeyExists?: (key: string, namespace?: string) => boolean;
|
|
34
|
+
};
|
|
35
|
+
declare const LSVariableInputProvider: ({ children, value, }: {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
value: LSVariableInputContextValue;
|
|
38
|
+
}) => react_jsx_runtime.JSX.Element;
|
|
39
|
+
type LSAutoCompleteOption = {
|
|
40
|
+
label?: string | number | boolean;
|
|
41
|
+
value?: unknown;
|
|
42
|
+
helperText?: string;
|
|
43
|
+
imageUrl?: string;
|
|
44
|
+
searchText?: string;
|
|
45
|
+
thumb?: string;
|
|
46
|
+
iconUrl?: string;
|
|
47
|
+
previewImageUrl?: string;
|
|
48
|
+
[key: string]: unknown;
|
|
49
|
+
};
|
|
50
|
+
type LSVariableInputFieldProps = {
|
|
51
|
+
name?: string;
|
|
52
|
+
label?: ReactNode;
|
|
53
|
+
type?: string;
|
|
54
|
+
isAutoComplete?: boolean;
|
|
55
|
+
autoCompleteOptions?: LSAutoCompleteOption[];
|
|
56
|
+
autoCompleteGroupBy?: (option: any) => string;
|
|
57
|
+
hideVariables?: boolean;
|
|
58
|
+
allowedVariables?: IVariables[] | string[] | LSVariableDefinition[] | unknown[];
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
autoFocus?: boolean;
|
|
61
|
+
inputProps?: any;
|
|
62
|
+
multiline?: boolean;
|
|
63
|
+
rows?: number;
|
|
64
|
+
maxRows?: number;
|
|
65
|
+
value?: string | number | any[];
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
renderOption?: (props: HTMLAttributes<HTMLLIElement>, option: any, state: AutocompleteRenderOptionState) => ReactNode;
|
|
68
|
+
variant?: "standard" | "filled" | "outlined";
|
|
69
|
+
ListboxComponent?: any;
|
|
70
|
+
onScrollListBox?: (e: any) => void;
|
|
71
|
+
onHighlightChange?: (e: any, value: any) => void;
|
|
72
|
+
onPopupClose?: (e: any, reason: any) => void;
|
|
73
|
+
onPopupOpen?: (e: any) => void;
|
|
74
|
+
onAutocompleteKeyUp?: (e: any, value: any) => void;
|
|
75
|
+
afterFilter?: (filtered: any[]) => void;
|
|
76
|
+
onChange?: (value: any) => void;
|
|
77
|
+
loading?: boolean;
|
|
78
|
+
getOptionLabel?: (option: any) => string;
|
|
79
|
+
isOptionEqualToValue?: (option: any, value: any) => boolean;
|
|
80
|
+
$disableInputChange?: boolean;
|
|
81
|
+
$getFullValueObject?: boolean;
|
|
82
|
+
$multiple?: boolean;
|
|
83
|
+
$disableCloseOnSelect?: boolean;
|
|
84
|
+
$freeSolo?: boolean;
|
|
85
|
+
$renderOption?: any;
|
|
86
|
+
allowedVariableOrigin?: string;
|
|
87
|
+
systemVariables?: Record<string, unknown>;
|
|
88
|
+
functionVariables?: string[];
|
|
89
|
+
translate?: LSVariableInputTranslate;
|
|
90
|
+
onVariableTranslationsNeeded?: () => void;
|
|
91
|
+
isOriginConnected?: (origin: string) => boolean;
|
|
92
|
+
translationKeyExists?: (key: string, namespace?: string) => boolean;
|
|
93
|
+
};
|
|
94
|
+
declare const LSVariableInputField: React.ForwardRefExoticComponent<LSVariableInputFieldProps & React.RefAttributes<HTMLInputElement>>;
|
|
95
|
+
|
|
96
|
+
export { type IVariables, type LSVariableInputContextValue, LSVariableInputField, type LSVariableInputFieldProps, LSVariableInputProvider };
|