@oliasoft-open-source/react-ui-library 4.7.2 → 4.7.3-beta-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{index-D5kcnHmD.js → index-7PLAdoQ9.js} +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.html +1 -1
- package/dist/index.js +31 -4
- package/dist/index.js.map +1 -1
- package/dist/storybook/assets/{Color-KGDBMAHA-q-P5APaO.js → Color-KGDBMAHA-flSaV_MJ.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-PKQXORMH-D3Cy2r_Z.js → DocsRenderer-PKQXORMH-B2MpYyNq.js} +1 -1
- package/dist/storybook/assets/{buttons-and-links-caWZb4X6.js → buttons-and-links-BYEAhhA9.js} +1 -1
- package/dist/storybook/assets/{chunk-HLWAVYOI-PihY4p8L.js → chunk-HLWAVYOI-BYDWICmD.js} +1 -1
- package/dist/storybook/assets/{color-DVJ4PKqw.js → color-Da1CW6lH.js} +1 -1
- package/dist/storybook/assets/{iframe-MGOUznuN.js → iframe-BCuVAzCF.js} +2 -2
- package/dist/storybook/assets/{index-Br4CWgtc.js → index-B9beUMCC.js} +1 -1
- package/dist/storybook/assets/{index-W0dVTpIv.js → index-DJ8hSxGk.js} +4 -4
- package/dist/storybook/assets/{input-validation-CbAszrvQ.js → input-validation-D54Tgh0X.js} +1 -1
- package/dist/storybook/assets/{inputs-BcVLXteo.js → inputs-D7FnSkCy.js} +1 -1
- package/dist/storybook/assets/{layout-forms-l-XDMkfI.js → layout-forms-DMszHpOu.js} +1 -1
- package/dist/storybook/assets/{layout-general-DL0Q90Ai.js → layout-general-CWsbvxgT.js} +1 -1
- package/dist/storybook/assets/{padding-and-spacing-B2-WaM9r.js → padding-and-spacing-vB3pUNzW.js} +1 -1
- package/dist/storybook/assets/{preview-Eh31roT5.js → preview-1T5p1vXe.js} +2 -2
- package/dist/storybook/assets/{preview-Duk5kU8o.js → preview-DMFuiETZ.js} +1 -1
- package/dist/storybook/assets/{unit-input.stories-RF3UHFxA.js → unit-input.stories-DeyzCbvE.js} +24 -24
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +1 -1
- package/dist/404.html +0 -1
|
@@ -75846,6 +75846,7 @@ function TreeInner(props, ref2) {
|
|
|
75846
75846
|
}
|
|
75847
75847
|
reactExports.forwardRef(TreeInner);
|
|
75848
75848
|
requireUnits();
|
|
75849
|
+
reactExports.createContext(null);
|
|
75849
75850
|
const Footer = () => {
|
|
75850
75851
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75851
75852
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
|
package/dist/index.d.ts
CHANGED
|
@@ -866,6 +866,8 @@ export declare interface INativeSelectProps {
|
|
|
866
866
|
maxTooltipWidth?: TStringOrNumber;
|
|
867
867
|
}
|
|
868
868
|
|
|
869
|
+
export declare const initializeContext: (value: UnitContextType) => void;
|
|
870
|
+
|
|
869
871
|
export declare const Input: default_2.ForwardRefExoticComponent<IInputProps & default_2.RefAttributes<HTMLInputElement>>;
|
|
870
872
|
|
|
871
873
|
export declare const InputGroup: ({ children, small, width, }: IInputGroupProps) => ReactElement;
|
|
@@ -1852,7 +1854,9 @@ export declare type TTriggerType = 'Text' | 'Button' | 'DropDownButton' | 'Compo
|
|
|
1852
1854
|
|
|
1853
1855
|
declare type TUnitTableCellShape = TCellShape | IUnitTableStaticCell | IUnitTableInputCell | IUnitTableNumberInputCell;
|
|
1854
1856
|
|
|
1855
|
-
|
|
1857
|
+
declare type UnitContextType = any;
|
|
1858
|
+
|
|
1859
|
+
export declare const UnitInput: default_2.FC<IUnitInputProps>;
|
|
1856
1860
|
|
|
1857
1861
|
export declare const UnitTable: ({ table, unitConfig, convertBackToStorageUnit, enableCosmeticRounding, enableDisplayRounding, }: IUnitTableProps) => JSX_2.Element;
|
|
1858
1862
|
|
package/dist/index.html
CHANGED
|
@@ -1 +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-
|
|
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-7PLAdoQ9.js"></script><link rel="stylesheet" crossorigin href="/react-ui-library/assets/index-Oe0PlEED.css"></head><body><div id="content"></div></body>
|
package/dist/index.js
CHANGED
|
@@ -70026,7 +70026,7 @@ const getPreferredUnit = (unitkey, unitTemplate) => {
|
|
|
70026
70026
|
const preferredUnit = unitTemplate == null ? void 0 : unitTemplate[unitkey];
|
|
70027
70027
|
if (!preferredUnit) {
|
|
70028
70028
|
console.log(
|
|
70029
|
-
`Warning: 'unitTemplate'
|
|
70029
|
+
`Warning: 'unitTemplate' missing for '${unitkey}'. Using initial unit, value unit, or default.`
|
|
70030
70030
|
);
|
|
70031
70031
|
return unitFromQuantity(unitkey) ?? "";
|
|
70032
70032
|
}
|
|
@@ -70124,11 +70124,33 @@ const isKnownUnit = (valueWithUnit, defaultUnit) => {
|
|
|
70124
70124
|
const unitFromValue = getUnit(valueWithUnit || "");
|
|
70125
70125
|
return isUnitKnown(defaultUnit) && isUnitKnown(unitFromValue);
|
|
70126
70126
|
};
|
|
70127
|
+
const UnitContext = createContext(null);
|
|
70128
|
+
const UnitContextProvider = ({ children, value }) => {
|
|
70129
|
+
return /* @__PURE__ */ jsx(UnitContext.Provider, { value, children });
|
|
70130
|
+
};
|
|
70131
|
+
const useUnitContext = () => {
|
|
70132
|
+
return useContext(UnitContext);
|
|
70133
|
+
};
|
|
70134
|
+
let isInitialized = false;
|
|
70135
|
+
let providedValue = null;
|
|
70136
|
+
const initializeContext = (value) => {
|
|
70137
|
+
if (!isInitialized) {
|
|
70138
|
+
providedValue = value;
|
|
70139
|
+
isInitialized = true;
|
|
70140
|
+
}
|
|
70141
|
+
};
|
|
70142
|
+
const WithUnitContext = (Component2) => (props) => {
|
|
70143
|
+
if (!isInitialized) {
|
|
70144
|
+
console.log("Context not initialized. Call initializeContext first.");
|
|
70145
|
+
return /* @__PURE__ */ jsx(Component2, { ...props });
|
|
70146
|
+
}
|
|
70147
|
+
return /* @__PURE__ */ jsx(UnitContextProvider, { value: providedValue, children: /* @__PURE__ */ jsx(Component2, { ...props }) });
|
|
70148
|
+
};
|
|
70127
70149
|
const predefinedMenuActive = "_predefinedMenuActive_1yvt4_1";
|
|
70128
70150
|
const styles = {
|
|
70129
70151
|
predefinedMenuActive
|
|
70130
70152
|
};
|
|
70131
|
-
const
|
|
70153
|
+
const UnitInputComponent = ({
|
|
70132
70154
|
name: name2,
|
|
70133
70155
|
placeholder: placeholder3 = "",
|
|
70134
70156
|
disabled: disabled2 = false,
|
|
@@ -70149,7 +70171,7 @@ const UnitInput = ({
|
|
|
70149
70171
|
},
|
|
70150
70172
|
onSwitchUnit = () => {
|
|
70151
70173
|
},
|
|
70152
|
-
unitTemplate,
|
|
70174
|
+
unitTemplate: externalUnitTemplate,
|
|
70153
70175
|
doNotConvertValue = false,
|
|
70154
70176
|
testId,
|
|
70155
70177
|
warning: warning2 = null,
|
|
@@ -70162,6 +70184,9 @@ const UnitInput = ({
|
|
|
70162
70184
|
allowEmpty = false,
|
|
70163
70185
|
autoValue
|
|
70164
70186
|
}) => {
|
|
70187
|
+
const context2 = useUnitContext();
|
|
70188
|
+
const unitTemplate = externalUnitTemplate ?? (context2 == null ? void 0 : context2.unitTemplate);
|
|
70189
|
+
console.log("context in component ->>>>", context2);
|
|
70165
70190
|
if (typeof value === "number") {
|
|
70166
70191
|
value = `${value}`;
|
|
70167
70192
|
}
|
|
@@ -70173,7 +70198,7 @@ const UnitInput = ({
|
|
|
70173
70198
|
[unitkey, unitTemplate]
|
|
70174
70199
|
);
|
|
70175
70200
|
const knownUnit = isKnownUnit(value, defaultUnit);
|
|
70176
|
-
const initDisplayUnit = initUnit ||
|
|
70201
|
+
const initDisplayUnit = initUnit || propUnit || defaultUnit;
|
|
70177
70202
|
const previousInitUnit = usePrevious(initDisplayUnit);
|
|
70178
70203
|
const convertedValue = safeConvertValue(
|
|
70179
70204
|
value,
|
|
@@ -70448,6 +70473,7 @@ const UnitInput = ({
|
|
|
70448
70473
|
}
|
|
70449
70474
|
);
|
|
70450
70475
|
};
|
|
70476
|
+
const UnitInput = WithUnitContext(UnitInputComponent);
|
|
70451
70477
|
const normalizeUnits = (unitConfig) => unitConfig.reduce(
|
|
70452
70478
|
({ preferredUnits, storageUnits }, { unitKey, preferredUnit, storageUnit }) => {
|
|
70453
70479
|
preferredUnits[unitKey] = preferredUnit;
|
|
@@ -70842,6 +70868,7 @@ export {
|
|
|
70842
70868
|
UnitInput,
|
|
70843
70869
|
UnitTable,
|
|
70844
70870
|
dismissToast,
|
|
70871
|
+
initializeContext,
|
|
70845
70872
|
readFile,
|
|
70846
70873
|
toast,
|
|
70847
70874
|
useFocus,
|