@oliasoft-open-source/react-ui-library 4.16.1-beta-3 → 4.17.0-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/README.md CHANGED
@@ -37,7 +37,7 @@ To quickly start a new project using the React UI Library with Vite, you can use
37
37
  ```bash
38
38
  cd my-new-project
39
39
  ```
40
-
40
+
41
41
  3. **Install React UI Library: Add the React UI Library to your project:**
42
42
 
43
43
  ```bash
@@ -48,13 +48,13 @@ To quickly start a new project using the React UI Library with Vite, you can use
48
48
  ```bash
49
49
  yarn add @oliasoft-open-source/react-ui-library
50
50
  ```
51
-
51
+
52
52
  4. **Modify the Sample Page:** Open the src/App.jsx file and import a component from the React UI Library to use it:
53
53
 
54
54
  ```bash
55
55
  import React from 'react';
56
56
  import { Text } from '@oliasoft-open-source/react-ui-library';
57
-
57
+
58
58
  function App() {
59
59
  return (
60
60
  <div className="App">
@@ -62,7 +62,7 @@ To quickly start a new project using the React UI Library with Vite, you can use
62
62
  </div>
63
63
  );
64
64
  }
65
-
65
+
66
66
  export default App;
67
67
  ```
68
68
 
@@ -358,7 +358,6 @@ The `Button` component is a versatile interface element that supports various st
358
358
  | `disabled` | If true, disables the button. | `false` |
359
359
  | `groupOrder` | Specifies the button's position in a group (e.g., start, middle, end). | None (optional) |
360
360
  | `icon` | An icon to be displayed on the button. Deprecated in favor of using `label`. | None (optional) |
361
- | `ignoreDisabledContext` | Allows the button to be enabled even when inside `DisabledContext`. | `false` |
362
361
  | `label` | The content of the button, which can be text or a ReactNode. | None (optional) |
363
362
  | `loading` | Shows an activity indicator, suggesting that an action is in progress. | `false` |
364
363
  | `name` | The name of the button, which can be used in forms. | None (optional) |
package/dist/index.d.ts CHANGED
@@ -43,7 +43,7 @@ export declare enum BreadcrumbLinkType {
43
43
  CUSTOM = "custom"
44
44
  }
45
45
 
46
- export declare const Button: ({ active, basic, colored, disabled, ignoreDisabledContext, groupOrder, icon, label, loading, name, pill, round, small, styles, width, title, type, onClick, error, warning, testId, tooltip, inverted, component: Component, url, }: IButtonProps) => JSX_2.Element;
46
+ export declare const Button: ({ active, basic, colored, disabled, groupOrder, icon, label, loading, name, pill, round, small, styles, width, title, type, onClick, error, warning, testId, tooltip, inverted, component: Component, url, }: IButtonProps) => JSX_2.Element;
47
47
 
48
48
  export declare const ButtonGroup: (props: IButtonGroupProps) => JSX_2.Element;
49
49
 
@@ -206,7 +206,6 @@ export declare interface IButtonProps {
206
206
  basic?: boolean;
207
207
  colored?: boolean | string;
208
208
  disabled?: boolean;
209
- ignoreDisabledContext?: boolean;
210
209
  groupOrder?: string | null;
211
210
  icon?: ReactNode | string;
212
211
  label?: ReactNode | string | null;
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import * as PropTypes from "prop-types";
16
16
  import PropTypes__default from "prop-types";
17
17
  import ReactDOM, { createPortal, unstable_batchedUpdates, render } from "react-dom";
18
18
  import { noop as noop$2, set, get as get$2, isString as isString$3, isNumber as isNumber$1, isBoolean as isBoolean$1, isFunction as isFunction$3, isEmpty, isArray as isArray$1, toNumber, debounce as debounce$2, isObject as isObject$5, isEqual as isEqual$3 } from "lodash";
19
- import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
19
+ import { toString as toString$1, isScientificStringNum, roundToPrecision, toNum, validateNumber, cleanNumStr, stripLeadingZeros, roundToFixed, roundByMagnitude, unitFromQuantity, getUnit, KNOWN_UNITS, ALT_UNITS, isValueWithUnit, getValue, withUnit, convertSamePrecision, convertAndGetValue, split as split$1, label as label$b, isValidNum, getAltUnitsListByQuantity, altUnitsList, withPrettyUnitLabel, getUnitsForQuantity, roundByMagnitudeToFixed } from "@oliasoft-open-source/units";
20
20
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
21
21
  function getDefaultExportFromCjs(x2) {
22
22
  return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
@@ -4078,7 +4078,6 @@ const Button$1 = ({
4078
4078
  basic: basic2 = false,
4079
4079
  colored: colored2 = false,
4080
4080
  disabled: disabled2 = false,
4081
- ignoreDisabledContext = false,
4082
4081
  groupOrder = null,
4083
4082
  icon: icon2 = null,
4084
4083
  label: label2 = "",
@@ -4134,7 +4133,6 @@ const Button$1 = ({
4134
4133
  }
4135
4134
  return "";
4136
4135
  })();
4137
- const isDisabled = disabled2 || disabledContext && !ignoreDisabledContext;
4138
4136
  return /* @__PURE__ */ jsx(ButtonTooltipWrapper, { tooltip: tooltip2, children: /* @__PURE__ */ jsxs(
4139
4137
  Component2,
4140
4138
  {
@@ -4144,7 +4142,7 @@ const Button$1 = ({
4144
4142
  active2 ? buttonStyles.active : "",
4145
4143
  basic2 ? buttonStyles.basic : "",
4146
4144
  color2,
4147
- isDisabled ? buttonStyles.disabled : "",
4145
+ disabled2 || disabledContext ? buttonStyles.disabled : "",
4148
4146
  (icon2 || loading) && !label2 ? buttonStyles.iconOnly : "",
4149
4147
  inverted2 ? buttonStyles.inverted : "",
4150
4148
  order2,
@@ -4153,7 +4151,7 @@ const Button$1 = ({
4153
4151
  small2 ? buttonStyles.small : "",
4154
4152
  styles2
4155
4153
  ),
4156
- disabled: isDisabled,
4154
+ disabled: disabled2 || disabledContext,
4157
4155
  name: name2 ?? "",
4158
4156
  onClick,
4159
4157
  ...title2 ? { title: title2 } : {},
@@ -6690,8 +6688,7 @@ const Dialog = ({ dialog: dialog2 }) => {
6690
6688
  small: true,
6691
6689
  colored: "muted",
6692
6690
  onClick: onClose,
6693
- testId: testId && `${testId}-dismiss`,
6694
- ignoreDisabledContext: true
6691
+ testId: testId && `${testId}-dismiss`
6695
6692
  }
6696
6693
  ) }) : null
6697
6694
  ] }),
@@ -65775,6 +65772,10 @@ const checkConversion = ({
65775
65772
  if (!availableUnits.includes(toUnit)) {
65776
65773
  return false;
65777
65774
  }
65775
+ const valueUnit = getUnit(String(value));
65776
+ if (valueUnit && !availableUnits.includes(valueUnit)) {
65777
+ return false;
65778
+ }
65778
65779
  return true;
65779
65780
  };
65780
65781
  const convertUnit = ({
@@ -65827,6 +65828,14 @@ const safeConvertValue = ({
65827
65828
  }) => {
65828
65829
  const rawValue = getValue(value);
65829
65830
  const isInvalidInput = isWrongValue(rawValue);
65831
+ const shouldConvert = checkConversion({
65832
+ value,
65833
+ unitkey,
65834
+ toUnit
65835
+ });
65836
+ if (!shouldConvert) {
65837
+ return { value: rawValue };
65838
+ }
65830
65839
  if (isValueWithUnknownUnit(value)) {
65831
65840
  return { value: rawValue };
65832
65841
  }
@@ -66048,6 +66057,22 @@ const UnitInput = ({
66048
66057
  const createPredefinedOption = (el2) => {
66049
66058
  const elementValue = (el2 == null ? void 0 : el2.value) ? el2.value : "";
66050
66059
  const [value2 = "", unit2 = ""] = isValueWithUnit(elementValue) ? split$1(elementValue) : [elementValue];
66060
+ let description2 = withPrettyUnitLabel(elementValue);
66061
+ const shouldConvert = checkConversion({
66062
+ value: elementValue,
66063
+ unitkey,
66064
+ toUnit: unit2
66065
+ });
66066
+ if (shouldConvert) {
66067
+ const { value: value3 = "" } = safeConvertValue({
66068
+ value: elementValue,
66069
+ toUnit: preferredUnit,
66070
+ unitkey,
66071
+ defaultFromUnit: unit2,
66072
+ doNotConvertValue: noConversion
66073
+ });
66074
+ description2 = withPrettyUnitLabel(withUnit(value3, preferredUnit));
66075
+ }
66051
66076
  return {
66052
66077
  type: MenuType.OPTION,
66053
66078
  inline: true,
@@ -66069,7 +66094,7 @@ const UnitInput = ({
66069
66094
  /* @__PURE__ */ jsx(Text, { children: el2.label }),
66070
66095
  /* @__PURE__ */ jsx(Spacer, { width: "20px", height: "0" })
66071
66096
  ] }),
66072
- description: isValueWithUnit(elementValue) ? `${value2} ${unit2}` : elementValue,
66097
+ description: description2,
66073
66098
  selected: foundPredefinedMenuOption === el2 && predefinedOptionsMenuState === PredefinedOptionsMenuState.PREDEFINED
66074
66099
  };
66075
66100
  };