@oliasoft-open-source/react-ui-library 4.15.0-beta-8 → 4.15.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/dist/index.d.ts +2 -15
- package/dist/index.js +9 -65
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -762,7 +762,7 @@ export declare interface IMenuProps {
|
|
|
762
762
|
selected?: boolean;
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
-
declare interface IMenuSection {
|
|
765
|
+
export declare interface IMenuSection {
|
|
766
766
|
type: TMenuType | string;
|
|
767
767
|
label?: ReactNode;
|
|
768
768
|
icon?: string | ReactNode;
|
|
@@ -1190,15 +1190,6 @@ declare interface ISelectSelectedOption {
|
|
|
1190
1190
|
testId?: string;
|
|
1191
1191
|
}
|
|
1192
1192
|
|
|
1193
|
-
export declare interface ISettingFieldProps {
|
|
1194
|
-
helpText: string;
|
|
1195
|
-
children: ReactNode;
|
|
1196
|
-
active?: boolean;
|
|
1197
|
-
isLastField?: boolean;
|
|
1198
|
-
selectedOption: 'all_users' | 'superusers_admin';
|
|
1199
|
-
handleSelectChange: (value: 'all_users' | 'superusers_admin') => void;
|
|
1200
|
-
}
|
|
1201
|
-
|
|
1202
1193
|
export declare interface ISideBarProps {
|
|
1203
1194
|
options: {
|
|
1204
1195
|
title: string;
|
|
@@ -1578,7 +1569,6 @@ export declare interface IUnitInputProps {
|
|
|
1578
1569
|
unitkey?: string;
|
|
1579
1570
|
initUnit?: string;
|
|
1580
1571
|
noConversion?: boolean;
|
|
1581
|
-
doNotConvertValue?: boolean;
|
|
1582
1572
|
testId?: string;
|
|
1583
1573
|
warning?: string | boolean | null;
|
|
1584
1574
|
predefinedOptions?: IPredefinedOption[] | null;
|
|
@@ -1588,7 +1578,6 @@ export declare interface IUnitInputProps {
|
|
|
1588
1578
|
validationCallback?: (name: string, error: string | null) => any;
|
|
1589
1579
|
disabledValidation?: boolean;
|
|
1590
1580
|
allowEmpty?: boolean;
|
|
1591
|
-
autoValue?: string;
|
|
1592
1581
|
onChange?: TOnChangeEventHandler;
|
|
1593
1582
|
onSwitchUnit?: (unit: string) => void;
|
|
1594
1583
|
onClick?: MouseEventHandler<HTMLInputElement>;
|
|
@@ -1707,8 +1696,6 @@ export declare const Row: ({ alignItems, justifyContent, children, flex, height,
|
|
|
1707
1696
|
|
|
1708
1697
|
export declare const Select: (props: ISelectProps) => JSX_2.Element;
|
|
1709
1698
|
|
|
1710
|
-
export declare const SettingField: ({ helpText, active, children, isLastField, selectedOption, handleSelectChange, }: ISettingFieldProps) => JSX_2.Element;
|
|
1711
|
-
|
|
1712
1699
|
export declare const SideBar: default_2.MemoExoticComponent<({ options, startOpen, onShiftClickToggleOpen, top, }: ISideBarProps) => JSX_2.Element>;
|
|
1713
1700
|
|
|
1714
1701
|
export declare const Slider: ({ name, label, width, labelWidth, value, min, max, step, marks, showArrows, showTooltip, tooltipFormatter, disabled, range, small, vertical, onChange, }: ISliderProps) => JSX_2.Element;
|
|
@@ -1897,7 +1884,7 @@ declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTabl
|
|
|
1897
1884
|
|
|
1898
1885
|
declare type UnitContextType = any;
|
|
1899
1886
|
|
|
1900
|
-
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate,
|
|
1887
|
+
export declare const UnitInput: ({ name, placeholder, disabled, disabledUnit, error, left, small, width, value, unitkey, initUnit, noConversion, onChange, onClick, onFocus, onSwitchUnit, unitTemplate, testId, warning, predefinedOptions, initialPredefinedOption, shouldLinkAutomaticly, selectedPredefinedOptionKey, validationCallback, disabledValidation, allowEmpty, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, roundDisplayValue, }: IUnitInputProps) => JSX_2.Element;
|
|
1901
1888
|
|
|
1902
1889
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1903
1890
|
|
package/dist/index.js
CHANGED
|
@@ -70316,7 +70316,6 @@ const UnitInput = ({
|
|
|
70316
70316
|
onFocus = noop$3,
|
|
70317
70317
|
onSwitchUnit = noop$3,
|
|
70318
70318
|
unitTemplate,
|
|
70319
|
-
doNotConvertValue = false,
|
|
70320
70319
|
testId,
|
|
70321
70320
|
warning: warning2 = null,
|
|
70322
70321
|
predefinedOptions,
|
|
@@ -70326,7 +70325,6 @@ const UnitInput = ({
|
|
|
70326
70325
|
validationCallback = () => ({ name: "", error: null }),
|
|
70327
70326
|
disabledValidation = false,
|
|
70328
70327
|
allowEmpty = false,
|
|
70329
|
-
autoValue,
|
|
70330
70328
|
convertBackToStorageUnit = false,
|
|
70331
70329
|
enableCosmeticRounding = true,
|
|
70332
70330
|
enableDisplayRounding = false,
|
|
@@ -70338,7 +70336,6 @@ const UnitInput = ({
|
|
|
70338
70336
|
value = `${value}`;
|
|
70339
70337
|
}
|
|
70340
70338
|
const [propValue = "", propUnit = ""] = value !== void 0 ? split$1(value) : [];
|
|
70341
|
-
const propAutoUnit = autoValue ? getUnit(autoValue) : "";
|
|
70342
70339
|
const preferredUnit = useMemo$1(
|
|
70343
70340
|
() => getPreferredUnit(unitkey, unitTemplate || (context2 == null ? void 0 : context2.unitTemplate)),
|
|
70344
70341
|
[unitkey, unitTemplate, context2 == null ? void 0 : context2.unitTemplate]
|
|
@@ -70351,23 +70348,15 @@ const UnitInput = ({
|
|
|
70351
70348
|
toUnit: initDisplayUnit,
|
|
70352
70349
|
unitkey,
|
|
70353
70350
|
defaultFromUnit: propUnit,
|
|
70354
|
-
doNotConvertValue
|
|
70355
|
-
});
|
|
70356
|
-
const { value: convertedAutoValue } = safeConvertValue({
|
|
70357
|
-
value: autoValue,
|
|
70358
|
-
toUnit: initDisplayUnit,
|
|
70359
|
-
unitkey,
|
|
70360
|
-
defaultFromUnit: propAutoUnit,
|
|
70361
|
-
doNotConvertValue
|
|
70351
|
+
doNotConvertValue: noConversion
|
|
70362
70352
|
});
|
|
70363
|
-
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } :
|
|
70353
|
+
const initDisplayLayer = convertedValue !== "" ? { value: convertedValue, unit: initDisplayUnit } : { value: propValue, unit: propUnit };
|
|
70364
70354
|
const [displayLayer, setDisplayLayer] = useState(initDisplayLayer);
|
|
70365
70355
|
const derivedAllowEmpty = allowEmpty || (displayLayer == null ? void 0 : displayLayer.value) === void 0;
|
|
70366
70356
|
const [predefinedOptionsMenuState, setPredefinedOptionsMenuState] = useState(
|
|
70367
70357
|
initialPredefinedOption ? PredefinedOptionsMenuState.PREDEFINED : PredefinedOptionsMenuState.CUSTOM
|
|
70368
70358
|
);
|
|
70369
|
-
const
|
|
70370
|
-
const disableInternalErrorValidationMessages = !!(disabledValidation || autoValue || disabled2);
|
|
70359
|
+
const disableInternalErrorValidationMessages = !!(disabledValidation || disabled2);
|
|
70371
70360
|
const foundPredefinedMenuOption = predefinedOptions && predefinedOptions.find((el2) => {
|
|
70372
70361
|
if (!(el2 == null ? void 0 : el2.value)) return;
|
|
70373
70362
|
if (selectedPredefinedOptionKey) {
|
|
@@ -70382,7 +70371,7 @@ const UnitInput = ({
|
|
|
70382
70371
|
return withUnit(resultValue, predefinedMenuItemUnit) === el2.value;
|
|
70383
70372
|
});
|
|
70384
70373
|
const getAlternativeUnits = () => {
|
|
70385
|
-
const valueToList =
|
|
70374
|
+
const valueToList = value ?? "";
|
|
70386
70375
|
const initToUnit = displayLayer.unit;
|
|
70387
70376
|
const shouldConvert = checkConversion({
|
|
70388
70377
|
value: valueToList,
|
|
@@ -70441,7 +70430,7 @@ const UnitInput = ({
|
|
|
70441
70430
|
toUnit: initDisplayUnit,
|
|
70442
70431
|
unitkey,
|
|
70443
70432
|
defaultFromUnit: propUnit,
|
|
70444
|
-
doNotConvertValue
|
|
70433
|
+
doNotConvertValue: noConversion
|
|
70445
70434
|
});
|
|
70446
70435
|
newValue = resultValue;
|
|
70447
70436
|
newUnit = initDisplayUnit;
|
|
@@ -70451,7 +70440,7 @@ const UnitInput = ({
|
|
|
70451
70440
|
toUnit: displayLayer.unit,
|
|
70452
70441
|
unitkey,
|
|
70453
70442
|
defaultFromUnit: propUnit,
|
|
70454
|
-
doNotConvertValue
|
|
70443
|
+
doNotConvertValue: noConversion
|
|
70455
70444
|
});
|
|
70456
70445
|
newValue = resultValue;
|
|
70457
70446
|
newUnit = displayLayer.unit;
|
|
@@ -70524,23 +70513,14 @@ const UnitInput = ({
|
|
|
70524
70513
|
sectionsPredefinedMenu = [...sectionsPredefinedMenu, ...dynamicOptions];
|
|
70525
70514
|
}
|
|
70526
70515
|
const getPlaceholder = (placeholder22) => {
|
|
70527
|
-
if (
|
|
70528
|
-
const { value: resultValue } = safeConvertValue({
|
|
70529
|
-
value: autoValue,
|
|
70530
|
-
toUnit: displayLayer.unit,
|
|
70531
|
-
unitkey,
|
|
70532
|
-
defaultFromUnit: propAutoUnit,
|
|
70533
|
-
doNotConvertValue
|
|
70534
|
-
});
|
|
70535
|
-
return resultValue;
|
|
70536
|
-
} else if (isValueWithUnit(placeholder22)) {
|
|
70516
|
+
if (isValueWithUnit(placeholder22)) {
|
|
70537
70517
|
const placeholderUnit = getUnit(placeholder22);
|
|
70538
70518
|
const { value: resultValue } = safeConvertValue({
|
|
70539
70519
|
value: placeholder22,
|
|
70540
70520
|
toUnit: displayLayer.unit,
|
|
70541
70521
|
unitkey,
|
|
70542
70522
|
defaultFromUnit: placeholderUnit,
|
|
70543
|
-
doNotConvertValue
|
|
70523
|
+
doNotConvertValue: noConversion
|
|
70544
70524
|
});
|
|
70545
70525
|
return resultValue;
|
|
70546
70526
|
}
|
|
@@ -70625,7 +70605,7 @@ const UnitInput = ({
|
|
|
70625
70605
|
inline: true,
|
|
70626
70606
|
onClick: (evt) => {
|
|
70627
70607
|
evt.stopPropagation();
|
|
70628
|
-
onClickUnit(
|
|
70608
|
+
onClickUnit(value2, altUnit);
|
|
70629
70609
|
},
|
|
70630
70610
|
description: displayUnit,
|
|
70631
70611
|
selected: displayUnit === displayUnitLabel,
|
|
@@ -70952,41 +70932,6 @@ const SmartUploadModal = ({
|
|
|
70952
70932
|
}
|
|
70953
70933
|
) });
|
|
70954
70934
|
};
|
|
70955
|
-
const SettingField = ({
|
|
70956
|
-
helpText,
|
|
70957
|
-
active: active2 = true,
|
|
70958
|
-
children,
|
|
70959
|
-
isLastField = false,
|
|
70960
|
-
selectedOption,
|
|
70961
|
-
handleSelectChange
|
|
70962
|
-
}) => {
|
|
70963
|
-
const options = [
|
|
70964
|
-
{ label: "All users", value: "all_users" },
|
|
70965
|
-
{ label: "Superusers and Admin only", value: "superusers_admin" }
|
|
70966
|
-
];
|
|
70967
|
-
const onSelectChange = (event) => {
|
|
70968
|
-
handleSelectChange(event.target.value);
|
|
70969
|
-
};
|
|
70970
|
-
return /* @__PURE__ */ jsxs("div", { children: [
|
|
70971
|
-
/* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", children: [
|
|
70972
|
-
children,
|
|
70973
|
-
/* @__PURE__ */ jsx(
|
|
70974
|
-
Select,
|
|
70975
|
-
{
|
|
70976
|
-
name: "userType",
|
|
70977
|
-
options,
|
|
70978
|
-
value: selectedOption,
|
|
70979
|
-
disabled: !active2,
|
|
70980
|
-
onChange: onSelectChange,
|
|
70981
|
-
"aria-label": "Select user type",
|
|
70982
|
-
width: "auto"
|
|
70983
|
-
}
|
|
70984
|
-
)
|
|
70985
|
-
] }),
|
|
70986
|
-
/* @__PURE__ */ jsx(Text, { muted: true, children: helpText }),
|
|
70987
|
-
!isLastField && /* @__PURE__ */ jsx(Divider, {})
|
|
70988
|
-
] });
|
|
70989
|
-
};
|
|
70990
70935
|
export {
|
|
70991
70936
|
Accordion,
|
|
70992
70937
|
AccordionWithDefaultToggle,
|
|
@@ -71050,7 +70995,6 @@ export {
|
|
|
71050
70995
|
RichTextInput,
|
|
71051
70996
|
Row$1 as Row,
|
|
71052
70997
|
Select,
|
|
71053
|
-
SettingField,
|
|
71054
70998
|
SideBar,
|
|
71055
70999
|
Slider,
|
|
71056
71000
|
SmartUploadModal,
|