@internationalized/number 3.6.5 → 3.6.7
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/{main.js → index.cjs} +5 -5
- package/dist/{main.js.map → index.cjs.map} +1 -1
- package/dist/{import.mjs → index.js} +4 -4
- package/dist/{module.js.map → index.js.map} +1 -1
- package/dist/{module.js → index.mjs} +4 -4
- package/dist/index.mjs.map +1 -0
- package/dist/{NumberFormatter.main.js → private/NumberFormatter.cjs} +28 -27
- package/dist/private/NumberFormatter.cjs.map +1 -0
- package/dist/{NumberFormatter.mjs → private/NumberFormatter.js} +25 -22
- package/dist/private/NumberFormatter.js.map +1 -0
- package/dist/{NumberFormatter.module.js → private/NumberFormatter.mjs} +28 -27
- package/dist/private/NumberFormatter.mjs.map +1 -0
- package/dist/{NumberParser.main.js → private/NumberParser.cjs} +94 -79
- package/dist/private/NumberParser.cjs.map +1 -0
- package/dist/{NumberParser.mjs → private/NumberParser.js} +67 -48
- package/dist/private/NumberParser.js.map +1 -0
- package/dist/{NumberParser.module.js → private/NumberParser.mjs} +94 -79
- package/dist/private/NumberParser.mjs.map +1 -0
- package/dist/types/src/NumberFormatter.d.ts +32 -0
- package/dist/types/src/NumberParser.d.ts +27 -0
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +33 -18
- package/src/NumberFormatter.ts +39 -13
- package/src/NumberParser.ts +139 -52
- package/dist/NumberFormatter.main.js.map +0 -1
- package/dist/NumberFormatter.module.js.map +0 -1
- package/dist/NumberParser.main.js.map +0 -1
- package/dist/NumberParser.module.js.map +0 -1
- package/dist/types.d.ts +0 -50
- package/dist/types.d.ts.map +0 -1
package/dist/types.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export interface NumberFormatOptions extends Intl.NumberFormatOptions {
|
|
2
|
-
/** Overrides default numbering system for the current locale. */
|
|
3
|
-
numberingSystem?: string;
|
|
4
|
-
}
|
|
5
|
-
interface NumberRangeFormatPart extends Intl.NumberFormatPart {
|
|
6
|
-
source: 'startRange' | 'endRange' | 'shared';
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* A wrapper around Intl.NumberFormat providing additional options, polyfills, and caching for performance.
|
|
10
|
-
*/
|
|
11
|
-
export class NumberFormatter implements Intl.NumberFormat {
|
|
12
|
-
constructor(locale: string, options?: NumberFormatOptions);
|
|
13
|
-
/** Formats a number value as a string, according to the locale and options provided to the constructor. */
|
|
14
|
-
format(value: number): string;
|
|
15
|
-
/** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
|
|
16
|
-
formatToParts(value: number): Intl.NumberFormatPart[];
|
|
17
|
-
/** Formats a number range as a string. */
|
|
18
|
-
formatRange(start: number, end: number): string;
|
|
19
|
-
/** Formats a number range as an array of parts. */
|
|
20
|
-
formatRangeToParts(start: number, end: number): NumberRangeFormatPart[];
|
|
21
|
-
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
22
|
-
resolvedOptions(): Intl.ResolvedNumberFormatOptions;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* A NumberParser can be used to perform locale-aware parsing of numbers from Unicode strings,
|
|
26
|
-
* as well as validation of partial user input. It automatically detects the numbering system
|
|
27
|
-
* used in the input, and supports parsing decimals, percentages, currency values, and units
|
|
28
|
-
* according to the locale.
|
|
29
|
-
*/
|
|
30
|
-
export class NumberParser {
|
|
31
|
-
constructor(locale: string, options?: Intl.NumberFormatOptions);
|
|
32
|
-
/**
|
|
33
|
-
* Parses the given string to a number. Returns NaN if a valid number could not be parsed.
|
|
34
|
-
*/
|
|
35
|
-
parse(value: string): number;
|
|
36
|
-
/**
|
|
37
|
-
* Returns whether the given string could potentially be a valid number. This should be used to
|
|
38
|
-
* validate user input as the user types. If a `minValue` or `maxValue` is provided, the validity
|
|
39
|
-
* of the minus/plus sign characters can be checked.
|
|
40
|
-
*/
|
|
41
|
-
isValidPartialNumber(value: string, minValue?: number, maxValue?: number): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Returns a numbering system for which the given string is valid in the current locale.
|
|
44
|
-
* If no numbering system could be detected, the default numbering system for the current
|
|
45
|
-
* locale is returned.
|
|
46
|
-
*/
|
|
47
|
-
getNumberingSystem(value: string): string;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"AA0CA,oCAAqC,SAAQ,IAAI,oBAAoB;IACnE,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,+BAAgC,SAAQ,IAAI,CAAC,gBAAgB;IAC3D,MAAM,EAAE,YAAY,GAAG,UAAU,GAAG,QAAQ,CAAA;CAC7C;AAED;;GAEG;AACH,4BAA6B,YAAW,IAAI,CAAC,YAAY;gBAI3C,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,mBAAwB;IAK7D,2GAA2G;IAC3G,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAoB7B,+FAA+F;IAC/F,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,gBAAgB,EAAE;IAKrD,0CAA0C;IAC1C,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM;IAa/C,mDAAmD;IACnD,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,qBAAqB,EAAE;IAkBvE,6FAA6F;IAC7F,eAAe,IAAI,KAAK,2BAA2B;CAYpD;AC7GD;;;;;GAKG;AACH;gBAIc,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,KAAK,mBAAwB;IAKlE;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;OAIG;IACH,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO;IAIlF;;;;OAIG;IACH,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;CAG1C","sources":["packages/@internationalized/number/src/packages/@internationalized/number/src/NumberFormatter.ts","packages/@internationalized/number/src/packages/@internationalized/number/src/NumberParser.ts","packages/@internationalized/number/src/packages/@internationalized/number/src/index.ts","packages/@internationalized/number/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport type {NumberFormatOptions} from './NumberFormatter';\n\nexport {NumberFormatter} from './NumberFormatter';\nexport {NumberParser} from './NumberParser';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|