@danxbot/ui 5.1.0 → 5.2.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.js +7623 -7489
- package/dist/index.js.map +1 -1
- package/dist/pure.js +250 -13
- package/dist/pure.js.map +1 -1
- package/dist/types/icons/data.d.ts +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/values/boolean.d.ts +28 -0
- package/dist/types/lib/values/currency.d.ts +22 -0
- package/dist/types/lib/values/date.d.ts +30 -0
- package/dist/types/lib/values/datetime.d.ts +48 -0
- package/dist/types/lib/values/index.d.ts +6 -0
- package/dist/types/lib/values/number.d.ts +27 -0
- package/dist/types/lib/values/phone.d.ts +23 -0
- package/dist/types/pure.d.ts +11 -5
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ten stored digits → `"(555) 123-4567"`. `null` / `undefined` / `""` → `"—"`.
|
|
3
|
+
*
|
|
4
|
+
* A non-empty value that is not exactly ten digits after parsing is returned
|
|
5
|
+
* UNCHANGED — the same "show the corruption, don't hide it behind absence"
|
|
6
|
+
* rule `formatDate` documents. A stored value should already be `parsePhone`'s
|
|
7
|
+
* output; if it is not, that is a data problem worth seeing in the row, not
|
|
8
|
+
* a blank field that looks like nobody ever entered a number.
|
|
9
|
+
*/
|
|
10
|
+
export declare function formatPhone(value: string | null | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* A human-typed phone number → ten stored digits, or `null`.
|
|
13
|
+
*
|
|
14
|
+
* Strips everything but digits, so `"(555) 123-4567"`, `"555.123.4567"`,
|
|
15
|
+
* `"555-123-4567 "` and `"5551234567"` all normalise the same way. A leading
|
|
16
|
+
* US country code (`"1"`, making 11 digits total) is dropped — `"+1 (555)
|
|
17
|
+
* 123-4567"` is the same number as `"(555) 123-4567"` and should be stored
|
|
18
|
+
* identically. Anything that is not exactly 10 digits after that — too few,
|
|
19
|
+
* too many, or an 11-digit number NOT starting with `1` (a foreign number
|
|
20
|
+
* mis-typed into a US field, not a US number with an extra digit) — returns
|
|
21
|
+
* `null` rather than truncating or padding a guess into place.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parsePhone(input: string): string | null;
|
package/dist/types/pure.d.ts
CHANGED
|
@@ -24,13 +24,19 @@
|
|
|
24
24
|
*
|
|
25
25
|
* WHAT BELONGS HERE. Decisions about how a value READS, with no dependencies:
|
|
26
26
|
* precision, units, the point at which a rounded figure stops telling the
|
|
27
|
-
* truth. Deliberately NOT the calendar
|
|
28
|
-
* `hoursInDay` and the rest
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
27
|
+
* truth. Deliberately NOT the whole calendar layer — `formatDateRange`,
|
|
28
|
+
* `hoursInDay`, `monthGridDays` and the rest of `lib/time`'s CALENDAR-UI
|
|
29
|
+
* surface are equally pure but answer a question this entry's consumers do
|
|
30
|
+
* not have: they are grid-layout and scheduling math, not "turn a stored
|
|
31
|
+
* value into a string." `lib/values/date.ts` and `datetime.ts` are the
|
|
32
|
+
* question that WAS asked (a consumer's data grid duplicating this exact
|
|
33
|
+
* display/parse logic locally, instead of sourcing it from one place) and are
|
|
34
|
+
* exported below. They reuse `lib/time`'s zone arithmetic internally — that
|
|
35
|
+
* module has no React in it either, so pulling it in transitively costs real
|
|
36
|
+
* bytes but not the one thing this entry actually guards against.
|
|
32
37
|
*
|
|
33
38
|
* Everything exported here is ALSO exported from the main entry, so nothing
|
|
34
39
|
* about this is a migration and no existing import has to change.
|
|
35
40
|
*/
|
|
36
41
|
export { formatBytes, formatTokens } from "./lib/format";
|
|
42
|
+
export { formatDate, parseDate, formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions, formatCurrency, parseCurrency, formatPhone, parsePhone, formatNumber, parseNumber, type FormatNumberOptions, formatBoolean, parseBoolean, type FormatBooleanOptions, } from "./lib/values";
|