@kosdev-code/kos-ui-sdk 0.1.0-next.748 → 0.1.0-next.779
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/.kos.json +310 -0
- package/index.cjs.map +1 -1
- package/index.js.map +1 -1
- package/models/utils/conversion-utils.d.ts +26 -0
- package/models/utils/conversion-utils.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -41,6 +41,32 @@ export declare const convert: (value: number, from: UnitConversionSource, to?: U
|
|
|
41
41
|
* Converts a numeric value from one unit to another, formats the result, and returns
|
|
42
42
|
* an object containing the converted value, display strings, and the unit.
|
|
43
43
|
*
|
|
44
|
+
* @example
|
|
45
|
+
* convert and format a value, letting the region determine the target unit:
|
|
46
|
+
*
|
|
47
|
+
* ```typescript
|
|
48
|
+
* import { convertWithUnits } from "@kosdev-code/kos-ui-sdk";
|
|
49
|
+
*
|
|
50
|
+
* // If the region is set to US, the value is converted to fluid ounces.
|
|
51
|
+
* const result = convertWithUnits(1000, "milliliter");
|
|
52
|
+
* // result.value -> the converted numeric value as a string
|
|
53
|
+
* // result.display -> "33.81 fluid ounces" (long form)
|
|
54
|
+
* // result.shortDisplay -> "33.81 fl oz" (short form)
|
|
55
|
+
* // result.unit -> "fluid-ounce"
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* specify the target unit and control the number of decimal places:
|
|
60
|
+
*
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { convertWithUnits } from "@kosdev-code/kos-ui-sdk";
|
|
63
|
+
*
|
|
64
|
+
* const result = convertWithUnits(1000, "milliliter", "fluid-ounce", {
|
|
65
|
+
* minDecimals: 1,
|
|
66
|
+
* maxDecimals: 1,
|
|
67
|
+
* });
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
44
70
|
* @param value - The numeric value to convert.
|
|
45
71
|
* @param from - The source unit or unit system to convert from.
|
|
46
72
|
* @param to - (Optional) The target unit or unit system to convert to. If not provided, uses the default unit system.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversion-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/models/utils/conversion-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,CAAC;AAsBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,MAAM,oBAAoB,EAC1B,KAAK,oBAAoB,WAqB1B,CAAC;AA6BF
|
|
1
|
+
{"version":3,"file":"conversion-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ui-sdk/src/models/utils/conversion-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE1E,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,CAAC;AAsBvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,MAAM,EACb,MAAM,oBAAoB,EAC1B,KAAK,oBAAoB,WAqB1B,CAAC;AA6BF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,MAAM,EACb,MAAM,oBAAoB,EAC1B,KAAK,oBAAoB,EACzB,SAAS;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,KACA;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CA4CtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ui-sdk",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.779",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./index.cjs",
|
|
6
6
|
"module": "./index.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"**/*.d.ts",
|
|
15
15
|
"**/*.d.cts",
|
|
16
16
|
"**/*.d.ts.map",
|
|
17
|
-
"kos
|
|
17
|
+
".kos.json"
|
|
18
18
|
],
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"react-router-dom": "^6.11.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@kosdev-code/kos-api-levels": "0.1.0-next.
|
|
43
|
+
"@kosdev-code/kos-api-levels": "0.1.0-next.779",
|
|
44
44
|
"mobx": "^6.9.0",
|
|
45
45
|
"mobx-react-lite": "^3.4.3",
|
|
46
46
|
"date-fns": "^2.30.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"kos": {
|
|
51
51
|
"build": {
|
|
52
|
-
"gitHash": "
|
|
52
|
+
"gitHash": "0e5061abb3930c28dfd53a874539900cd0809220"
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
}
|