@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.
@@ -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;
@@ -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 and time layers — `formatDateRange`,
28
- * `hoursInDay` and the rest are equally pure and would drag the whole `Intl`
29
- * time layer behind them, which is a bigger entry answering a question nobody
30
- * has asked yet. That is a separate decision, to be made when a consumer needs
31
- * it and not before.
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";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danxbot/ui",
3
- "version": "5.1.0",
3
+ "version": "5.2.0",
4
4
  "type": "module",
5
5
  "description": "Danxbot — a domain-agnostic React design system with motion as a first-class primitive.",
6
6
  "license": "MIT",