@oliasoft-open-source/react-ui-library 4.2.1-beta-2 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/404.html +1 -0
- package/dist/index.js +24 -7
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-6VNJS4EI-6b48c85b.js → Color-6VNJS4EI-176a0637.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-NNNQARDV-25c0f625.js → DocsRenderer-NNNQARDV-d6b1a926.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-4HIR6TLV-9ebd09dc.js → WithTooltip-4HIR6TLV-01fcb383.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-16cf8577.js → buttons-and-links-9b4c48c7.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-1c498991.js → chunk-HLWAVYOI-efbdedb9.js} +1 -1
- package/dist/storybook/assets/{color-8b40ecf4.js → color-bdf2c712.js} +1 -1
- package/dist/storybook/assets/{formatter-SWP5E3XI-521171e8.js → formatter-SWP5E3XI-a62ef2ff.js} +1 -1
- package/dist/storybook/assets/{iframe-5eee0790.js → iframe-3b8c9505.js} +1 -1
- package/dist/storybook/assets/{index-665bded2.js → index-5306dda7.js} +4 -4
- package/dist/storybook/assets/{input-validation-560fd9e3.js → input-validation-cad6ba98.js} +1 -1
- package/dist/storybook/assets/{inputs-ed0fc7ad.js → inputs-b36361a7.js} +1 -1
- package/dist/storybook/assets/{layout-forms-e9b95540.js → layout-forms-500f50e3.js} +1 -1
- package/dist/storybook/assets/{layout-general-7a81d7f9.js → layout-general-6fcc0bac.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-ea2bf22c.js → padding-and-spacing-b4b4aa42.js} +1 -1
- package/dist/storybook/assets/{preview-51e87244.js → preview-6eef7a6c.js} +1 -1
- package/dist/storybook/assets/preview-c280dfa3.js +1 -0
- package/dist/storybook/assets/{syntaxhighlighter-NMPM6SWI-96abff19.js → syntaxhighlighter-NMPM6SWI-2c058518.js} +1 -1
- package/dist/storybook/assets/unit-input.stories-65984064.js +273 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/stories.json +1 -1
- package/package.json +1 -1
- package/dist/storybook/assets/preview-987fd1ab.js +0 -1
- package/dist/storybook/assets/unit-input.stories-0eea1703.js +0 -265
package/dist/404.html
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!doctype html><head><title>React UI Library</title><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1" user-scalable="no"><meta name="apple-mobile-web-app-capable" content="yes"><script type="module" crossorigin src="/react-ui-library/assets/index-26f804a8.js"></script><link rel="stylesheet" href="/react-ui-library/assets/index-0d78a198.css"></head><body><div id="content"></div></body>
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as PropTypes from "prop-types";
|
|
|
11
11
|
import PropTypes__default from "prop-types";
|
|
12
12
|
import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
|
|
13
13
|
import _$1, { set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$2, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isObjectLike, has as has$1 } from "lodash";
|
|
14
|
-
import { validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList } from "@oliasoft-open-source/units";
|
|
14
|
+
import { validateNumber, cleanNumStr, unitFromQuantity, isValueWithUnit, withUnit, convertSamePrecision, getValue as getValue$1, getUnit, KNOWN_UNITS, split as split$1, checkAndCleanDecimalComma, label as label$b, altUnitsList } from "@oliasoft-open-source/units";
|
|
15
15
|
import { isValueWithUnit as isValueWithUnit$1 } from "@oliasoft-open-source/units/dist/units";
|
|
16
16
|
const global$2 = "";
|
|
17
17
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
@@ -9162,6 +9162,7 @@ const Input$1 = forwardRef(
|
|
|
9162
9162
|
size: size2 = null
|
|
9163
9163
|
//use width instead
|
|
9164
9164
|
}, ref2) => {
|
|
9165
|
+
const [valueState, setValueState] = useState(value);
|
|
9165
9166
|
const disabledContext = useContext(DisabledContext);
|
|
9166
9167
|
const order2 = (() => {
|
|
9167
9168
|
if (groupOrder) {
|
|
@@ -9177,6 +9178,10 @@ const Input$1 = forwardRef(
|
|
|
9177
9178
|
return "";
|
|
9178
9179
|
})();
|
|
9179
9180
|
const width2 = propWidth || (size2 ? "auto" : "100%");
|
|
9181
|
+
const handleChange = (e2) => {
|
|
9182
|
+
setValueState(e2.target.value);
|
|
9183
|
+
onChange(e2);
|
|
9184
|
+
};
|
|
9180
9185
|
return /* @__PURE__ */ jsx("div", { style: { width: width2 }, className: order2, children: /* @__PURE__ */ jsx(
|
|
9181
9186
|
Tooltip,
|
|
9182
9187
|
{
|
|
@@ -9194,8 +9199,8 @@ const Input$1 = forwardRef(
|
|
|
9194
9199
|
type: type || "text",
|
|
9195
9200
|
size: size2 || 20,
|
|
9196
9201
|
placeholder: placeholder3 ?? "",
|
|
9197
|
-
value:
|
|
9198
|
-
onChange,
|
|
9202
|
+
value: valueState ?? "",
|
|
9203
|
+
onChange: handleChange,
|
|
9199
9204
|
onKeyPress,
|
|
9200
9205
|
onFocus,
|
|
9201
9206
|
onBlur,
|
|
@@ -70156,15 +70161,18 @@ const isValueWithUnknownUnit = (value) => {
|
|
|
70156
70161
|
return Boolean(getUnit(value));
|
|
70157
70162
|
};
|
|
70158
70163
|
const safeConvertValue = (value = "", toUnit, defaultFromUnit, doNotConvertValue) => {
|
|
70159
|
-
if (doNotConvertValue)
|
|
70164
|
+
if (doNotConvertValue) {
|
|
70160
70165
|
return value;
|
|
70166
|
+
}
|
|
70161
70167
|
const isWithUnit = isValueWithUnknownUnit(value) || isValueWithUnit(value);
|
|
70162
70168
|
const rawValue = getValue$1(value);
|
|
70163
70169
|
const isInvalidInput = isWrongValue(rawValue);
|
|
70164
|
-
if (isInvalidInput)
|
|
70170
|
+
if (isInvalidInput) {
|
|
70165
70171
|
return rawValue;
|
|
70166
|
-
|
|
70172
|
+
}
|
|
70173
|
+
if (!isWithUnit) {
|
|
70167
70174
|
return value;
|
|
70175
|
+
}
|
|
70168
70176
|
return convertUnit(rawValue, toUnit, defaultFromUnit, doNotConvertValue);
|
|
70169
70177
|
};
|
|
70170
70178
|
const getStringName = (name2) => {
|
|
@@ -70212,6 +70220,14 @@ const validate = (value, options) => {
|
|
|
70212
70220
|
}
|
|
70213
70221
|
return null;
|
|
70214
70222
|
};
|
|
70223
|
+
const isUnitKnown = (unit2 = "") => {
|
|
70224
|
+
var _a;
|
|
70225
|
+
return (_a = KNOWN_UNITS) == null ? void 0 : _a.includes(unit2);
|
|
70226
|
+
};
|
|
70227
|
+
const isKnownUnit = (valueWithUnit, defaultUnit) => {
|
|
70228
|
+
const unitFromValue = getUnit(valueWithUnit || "");
|
|
70229
|
+
return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
|
|
70230
|
+
};
|
|
70215
70231
|
const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
|
|
70216
70232
|
const styles = {
|
|
70217
70233
|
predefinedMenuActive
|
|
@@ -70260,6 +70276,7 @@ const UnitInput = ({
|
|
|
70260
70276
|
() => getPreferredUnit(unitkey, unitTemplate),
|
|
70261
70277
|
[unitkey, unitTemplate]
|
|
70262
70278
|
);
|
|
70279
|
+
const knownUnit = isKnownUnit(value, defaultUnit);
|
|
70263
70280
|
const initDisplayUnit = initUnit || defaultUnit || propUnit;
|
|
70264
70281
|
const previousInitUnit = usePrevious(initDisplayUnit);
|
|
70265
70282
|
const convertedValue = safeConvertValue(
|
|
@@ -70500,7 +70517,7 @@ const UnitInput = ({
|
|
|
70500
70517
|
},
|
|
70501
70518
|
stringName
|
|
70502
70519
|
),
|
|
70503
|
-
displayUnitLabel && (noConvert ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
|
|
70520
|
+
displayUnitLabel && (noConvert || !knownUnit ? /* @__PURE__ */ jsx(InputGroupAddon, { groupOrder: "last", children: displayUnitLabel }) : /* @__PURE__ */ jsx(
|
|
70504
70521
|
Menu,
|
|
70505
70522
|
{
|
|
70506
70523
|
maxHeight: 380,
|