@umriss-ui/core 0.40.3 → 0.41.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/CHANGELOG.md +28 -0
- package/README.md +14 -3
- package/dist/core.css +1 -1
- package/dist/core.js +3059 -3025
- package/dist/de.d.ts +3 -2
- package/dist/formats-BdlPZDzb.js +63 -0
- package/dist/index.d.ts +14 -11
- package/dist/styles.d.ts +1 -0
- package/dist/wording/de.js +1 -1
- package/docs/llms-full.md +97 -95
- package/package.json +15 -2
- package/dist/formats-D0YRBdnl.js +0 -62
package/dist/de.d.ts
CHANGED
|
@@ -16,8 +16,9 @@ declare interface Formats {
|
|
|
16
16
|
offset: (d: Date) => string;
|
|
17
17
|
/**
|
|
18
18
|
* A number in the set's notation. Without a digit count the value stands to
|
|
19
|
-
* the tenth decimal place
|
|
20
|
-
*
|
|
19
|
+
* the tenth decimal place, and a non-zero value that would read 0 there is
|
|
20
|
+
* written in scientific notation; with one it is padded and rounded to
|
|
21
|
+
* exactly that many places.
|
|
21
22
|
*/
|
|
22
23
|
number: (n: number, decimals?: number) => string;
|
|
23
24
|
/**
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
const I = [
|
|
2
|
+
["day", 86400],
|
|
3
|
+
["hour", 3600],
|
|
4
|
+
["minute", 60]
|
|
5
|
+
];
|
|
6
|
+
function y(n) {
|
|
7
|
+
const e = new Intl.DateTimeFormat(n, { day: "2-digit", month: "2-digit", year: "numeric" }), i = new Intl.DateTimeFormat(n, { day: "2-digit", month: "2-digit" }), F = new Intl.DateTimeFormat(n, { month: "long", year: "numeric" }), d = new Intl.DateTimeFormat(n, {
|
|
8
|
+
weekday: "long",
|
|
9
|
+
day: "numeric",
|
|
10
|
+
month: "long",
|
|
11
|
+
year: "numeric"
|
|
12
|
+
}), m = { hour: "2-digit", minute: "2-digit", hour12: !1, hourCycle: "h23" }, a = {
|
|
13
|
+
without: new Intl.DateTimeFormat(n, m),
|
|
14
|
+
with: new Intl.DateTimeFormat(n, { ...m, second: "2-digit" })
|
|
15
|
+
}, s = {
|
|
16
|
+
without: new Intl.DateTimeFormat(n, { day: "2-digit", month: "2-digit", year: "numeric", ...m }),
|
|
17
|
+
with: new Intl.DateTimeFormat(n, {
|
|
18
|
+
day: "2-digit",
|
|
19
|
+
month: "2-digit",
|
|
20
|
+
year: "numeric",
|
|
21
|
+
...m,
|
|
22
|
+
second: "2-digit"
|
|
23
|
+
})
|
|
24
|
+
}, h = new Intl.DateTimeFormat(n, { timeZoneName: "shortOffset" }), u = /* @__PURE__ */ new Map(), g = new Intl.NumberFormat(n, { notation: "scientific", maximumSignificantDigits: 10 }), w = new Intl.NumberFormat(n), T = new Intl.NumberFormat(n, { style: "percent", maximumFractionDigits: 0 }), D = new Intl.Collator(n), c = new Intl.RelativeTimeFormat(n, { numeric: "auto" });
|
|
25
|
+
return {
|
|
26
|
+
date: (t) => e.format(t),
|
|
27
|
+
dateShort: (t) => i.format(t),
|
|
28
|
+
month: (t) => F.format(t),
|
|
29
|
+
dateLong: (t) => d.format(t),
|
|
30
|
+
time: (t, o) => (o ? a.with : a.without).format(t),
|
|
31
|
+
dateTime: (t, o) => (o ? s.with : s.without).format(t),
|
|
32
|
+
offset: (t) => h.formatToParts(t).find((o) => o.type === "timeZoneName")?.value ?? "",
|
|
33
|
+
number: (t, o) => {
|
|
34
|
+
if (o === void 0 && t !== 0 && Math.abs(t) < 0.5 * 10 ** -10) return g.format(t);
|
|
35
|
+
let r = u.get(o);
|
|
36
|
+
return r || (r = new Intl.NumberFormat(n, {
|
|
37
|
+
minimumFractionDigits: o,
|
|
38
|
+
maximumFractionDigits: o ?? 10
|
|
39
|
+
}), u.set(o, r)), r.format(t);
|
|
40
|
+
},
|
|
41
|
+
count: (t) => w.format(t),
|
|
42
|
+
percent: (t) => T.format(t),
|
|
43
|
+
compareText: (t, o) => D.compare(t, o),
|
|
44
|
+
relative: (t) => {
|
|
45
|
+
const o = Math.max(0, Math.round(t / 1e3));
|
|
46
|
+
for (const [r, f] of I)
|
|
47
|
+
if (o >= f) return c.format(-Math.floor(o / f), r);
|
|
48
|
+
return c.format(-o, "second");
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const p = y("en-GB");
|
|
53
|
+
function A(n) {
|
|
54
|
+
const e = [...n.number(1234.5, 1).replace(/[\d-]/g, "")], i = e[e.length - 1] ?? ".";
|
|
55
|
+
return { group: e.length > 1 ? e[0] : "", decimal: i };
|
|
56
|
+
}
|
|
57
|
+
const E = A(p);
|
|
58
|
+
export {
|
|
59
|
+
p as D,
|
|
60
|
+
E as a,
|
|
61
|
+
y as f,
|
|
62
|
+
A as s
|
|
63
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export declare interface AccordionProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
62
62
|
* `null` where there is no computable age: without an as-of time there is
|
|
63
63
|
* none.
|
|
64
64
|
*/
|
|
65
|
-
export declare function age(asOf:
|
|
65
|
+
export declare function age(asOf: FreshnessInstant, now: FreshnessInstant): number | null;
|
|
66
66
|
|
|
67
67
|
/** A message that stays put in the page - for what a toast would carry away
|
|
68
68
|
too soon. Warning and danger interrupt the screen reader, the other tones
|
|
@@ -178,7 +178,7 @@ export declare interface BreadcrumbEntry {
|
|
|
178
178
|
/** Routing is the caller's: given, it runs instead of the browser's
|
|
179
179
|
navigation - on the link and in the menu of folded levels. A level with
|
|
180
180
|
`onSelect` and no `href` is a button. In the menu a level is a menu
|
|
181
|
-
entry, not a link: an `href` alone is followed there by
|
|
181
|
+
entry, not a link: an `href` alone (http, https, mailto or tel) is followed there by
|
|
182
182
|
`location.assign`, without a new tab or a middle click - whoever needs
|
|
183
183
|
those routes through `onSelect`. */
|
|
184
184
|
onSelect?: () => void;
|
|
@@ -886,8 +886,9 @@ export declare interface Formats {
|
|
|
886
886
|
offset: (d: Date) => string;
|
|
887
887
|
/**
|
|
888
888
|
* A number in the set's notation. Without a digit count the value stands to
|
|
889
|
-
* the tenth decimal place
|
|
890
|
-
*
|
|
889
|
+
* the tenth decimal place, and a non-zero value that would read 0 there is
|
|
890
|
+
* written in scientific notation; with one it is padded and rounded to
|
|
891
|
+
* exactly that many places.
|
|
891
892
|
*/
|
|
892
893
|
number: (n: number, decimals?: number) => string;
|
|
893
894
|
/**
|
|
@@ -921,7 +922,8 @@ export declare function FormFieldBoundary({ children }: {
|
|
|
921
922
|
children: ReactNode;
|
|
922
923
|
}): JSX.Element;
|
|
923
924
|
|
|
924
|
-
|
|
925
|
+
/** What `useFormField` returns: the wiring a field inside a FormField reads. */
|
|
926
|
+
export declare interface FormFieldContextValue {
|
|
925
927
|
id: string;
|
|
926
928
|
/** The label's own id. `label htmlFor` names only what HTML can label -
|
|
927
929
|
an input, a select, a button; a group (`role="radiogroup"`) is named
|
|
@@ -972,7 +974,7 @@ export declare type Freshness = "fresh" | "stale" | "lost";
|
|
|
972
974
|
* What the value means - good, critical, whatever - is not at issue here and
|
|
973
975
|
* is not touched by this function.
|
|
974
976
|
*/
|
|
975
|
-
export declare function freshness(asOf:
|
|
977
|
+
export declare function freshness(asOf: FreshnessInstant, now: FreshnessInstant, ages: FreshnessAges): Freshness;
|
|
976
978
|
|
|
977
979
|
/**
|
|
978
980
|
* The two ages at which a value changes its state, in milliseconds. Both
|
|
@@ -989,6 +991,9 @@ export declare interface FreshnessAges {
|
|
|
989
991
|
lost: number;
|
|
990
992
|
}
|
|
991
993
|
|
|
994
|
+
/** What may come in as an as-of time or a reference time. */
|
|
995
|
+
export declare type FreshnessInstant = Date | number | null | undefined;
|
|
996
|
+
|
|
992
997
|
/** What `useFreshness` returns: how fresh the value is, how old, and the time
|
|
993
998
|
the reading was taken at. */
|
|
994
999
|
export declare interface FreshnessReading {
|
|
@@ -1105,9 +1110,6 @@ export declare interface InputProps extends Omit<InputHTMLAttributes<HTMLInputEl
|
|
|
1105
1110
|
onClear?: () => void;
|
|
1106
1111
|
}
|
|
1107
1112
|
|
|
1108
|
-
/** What may come in as an as-of time or a reference time. */
|
|
1109
|
-
declare type Instant = Date | number | null | undefined;
|
|
1110
|
-
|
|
1111
1113
|
/** A node's key, as `reader.key` returns it. */
|
|
1112
1114
|
export declare type Key = string | number;
|
|
1113
1115
|
|
|
@@ -1590,7 +1592,7 @@ export declare interface RangePreset {
|
|
|
1590
1592
|
/** The `ref` of a component: the element it renders at its root. */
|
|
1591
1593
|
export declare interface RefProp<E extends Element> {
|
|
1592
1594
|
/** Receives the component's root element. */
|
|
1593
|
-
ref?: Ref<E
|
|
1595
|
+
ref?: Ref<E> | undefined;
|
|
1594
1596
|
}
|
|
1595
1597
|
|
|
1596
1598
|
/** What `scrollForRow` needs to know about a scroll area. */
|
|
@@ -2148,7 +2150,8 @@ export declare interface ToastConfig {
|
|
|
2148
2150
|
limit?: number;
|
|
2149
2151
|
}
|
|
2150
2152
|
|
|
2151
|
-
|
|
2153
|
+
/** What `useToast` returns: the functions that show, change and close toasts. */
|
|
2154
|
+
export declare interface ToastContextValue {
|
|
2152
2155
|
/** Shows a toast and returns its id. */
|
|
2153
2156
|
toast: (options: ToastOptions) => number;
|
|
2154
2157
|
/** Changes a standing toast. A new tone or a new `duration` starts its time
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/wording/de.js
CHANGED