@jirawatpyk/aura-react 5.33.0 → 5.34.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/README.md +9 -2
- package/dist/aura.bundle.js +685 -409
- package/dist/cjs/index.cjs +684 -408
- package/dist/esm/StatusTile.js +53 -0
- package/dist/esm/autoTip.js +5 -0
- package/dist/esm/breakpoints.js +18 -1
- package/dist/esm/index.js +5 -0
- package/dist/esm/responsive.js +1 -15
- package/dist/esm/strings.js +4 -0
- package/dist/esm/strings.sv.js +4 -0
- package/dist/esm/strings.th.js +4 -0
- package/dist/esm/tiles.js +212 -0
- package/dist/index.d.cts +111 -36
- package/dist/index.d.ts +111 -36
- package/dist/locales/sv.cjs +4 -0
- package/dist/locales/sv.d.cts +5 -0
- package/dist/locales/sv.d.ts +5 -0
- package/dist/locales/th.cjs +4 -0
- package/dist/locales/th.d.cts +5 -0
- package/dist/locales/th.d.ts +5 -0
- package/dist/server/index.cjs +263 -27
- package/dist/server/index.d.cts +75 -0
- package/dist/server/index.d.ts +75 -0
- package/dist/server/index.js +263 -27
- package/dist/styles.css +62 -0
- package/dist/styles.layer.css +62 -0
- package/package.json +1 -1
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useLinkComponent, useStrings } from "./locale.js";
|
|
4
|
+
import { useAutoTip } from "./autoTip.js";
|
|
5
|
+
import { devWarnOnce } from "./classes.js";
|
|
6
|
+
import { statusTileElement } from "./tiles.js";
|
|
7
|
+
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
|
|
8
|
+
const StatusTile = React.forwardRef(function StatusTile2(props, ref) {
|
|
9
|
+
const Link = useLinkComponent(props.linkComponent);
|
|
10
|
+
const t = useStrings();
|
|
11
|
+
useAutoTip();
|
|
12
|
+
if (!props.href && (props["aria-label"] || props["aria-labelledby"]))
|
|
13
|
+
devWarnOnce(
|
|
14
|
+
"status-tile-label",
|
|
15
|
+
"StatusTile `aria-label` needs `href`: without a link the tile is a plain box, where a name is not allowed."
|
|
16
|
+
);
|
|
17
|
+
const titleRef = React.useRef(null);
|
|
18
|
+
const check = React.useCallback(function() {
|
|
19
|
+
const el = titleRef.current;
|
|
20
|
+
if (!el) return;
|
|
21
|
+
const cut = el.scrollHeight > el.clientHeight + 1;
|
|
22
|
+
const text = (el.textContent || "").replace(/,$/, "").trim();
|
|
23
|
+
if (cut && text) el.setAttribute("data-aura-tip", text);
|
|
24
|
+
else el.removeAttribute("data-aura-tip");
|
|
25
|
+
}, []);
|
|
26
|
+
useIsoLayoutEffect(check, [props.title, check]);
|
|
27
|
+
const linked = !!props.href;
|
|
28
|
+
React.useEffect(
|
|
29
|
+
function() {
|
|
30
|
+
const el = titleRef.current;
|
|
31
|
+
if (!el) return;
|
|
32
|
+
let live = true;
|
|
33
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(check) : null;
|
|
34
|
+
const mo = typeof MutationObserver !== "undefined" ? new MutationObserver(check) : null;
|
|
35
|
+
if (ro) ro.observe(el);
|
|
36
|
+
if (mo) mo.observe(el, { characterData: true, childList: true, subtree: true });
|
|
37
|
+
if (document.fonts && document.fonts.ready)
|
|
38
|
+
document.fonts.ready.then(function() {
|
|
39
|
+
if (live) check();
|
|
40
|
+
});
|
|
41
|
+
return function() {
|
|
42
|
+
live = false;
|
|
43
|
+
if (ro) ro.disconnect();
|
|
44
|
+
if (mo) mo.disconnect();
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
[check, linked]
|
|
48
|
+
);
|
|
49
|
+
return statusTileElement(props, ref, Link, t, titleRef);
|
|
50
|
+
});
|
|
51
|
+
export {
|
|
52
|
+
StatusTile
|
|
53
|
+
};
|
package/dist/esm/autoTip.js
CHANGED
|
@@ -22,6 +22,11 @@ function source(t) {
|
|
|
22
22
|
const tag = el.closest(".aura-tag");
|
|
23
23
|
if (tag) s = tag.querySelector(".aura-tag__text[" + ATTR + "]");
|
|
24
24
|
}
|
|
25
|
+
if (!s) {
|
|
26
|
+
const tile = el.closest(".aura-status-tile");
|
|
27
|
+
const control = el.closest("a, button, input, select, textarea, [tabindex]");
|
|
28
|
+
if (tile && (!control || control === tile)) s = tile.querySelector(".aura-status-tile__title[" + ATTR + "]");
|
|
29
|
+
}
|
|
25
30
|
if (!s || !s.getAttribute(ATTR) || !s.isConnected) return null;
|
|
26
31
|
if (s.getAttribute("aria-expanded") === "true") return null;
|
|
27
32
|
return s;
|
package/dist/esm/breakpoints.js
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
const breakpoints = { sm: 640, md: 768, lg: 1024, xl: 1280 };
|
|
3
|
+
const ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
4
|
+
function respVars(prefix, value, map) {
|
|
5
|
+
const style = {};
|
|
6
|
+
if (value == null) return style;
|
|
7
|
+
if (typeof value !== "object") value = { base: value };
|
|
8
|
+
let byBp = value, cur;
|
|
9
|
+
ORDER.forEach(function(k) {
|
|
10
|
+
if (byBp[k] !== void 0) cur = map ? map(byBp[k]) : byBp[k];
|
|
11
|
+
if (cur !== void 0) style["--" + prefix + "-" + k] = cur;
|
|
12
|
+
});
|
|
13
|
+
return style;
|
|
14
|
+
}
|
|
15
|
+
const space = function(v) {
|
|
16
|
+
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
17
|
+
};
|
|
3
18
|
export {
|
|
4
|
-
breakpoints
|
|
19
|
+
breakpoints,
|
|
20
|
+
respVars,
|
|
21
|
+
space
|
|
5
22
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -36,6 +36,8 @@ import { Stack } from "./Stack.js";
|
|
|
36
36
|
import { Grid } from "./Grid.js";
|
|
37
37
|
import { Container } from "./Container.js";
|
|
38
38
|
import { PageHeader } from "./PageHeader.js";
|
|
39
|
+
import { StatusTile } from "./StatusTile.js";
|
|
40
|
+
import { TileGrid, Sparkline } from "./tiles.js";
|
|
39
41
|
import { AppShell } from "./AppShell.js";
|
|
40
42
|
import { ActionBar } from "./ActionBar.js";
|
|
41
43
|
import { Separator } from "./Separator.js";
|
|
@@ -111,9 +113,11 @@ export {
|
|
|
111
113
|
Separator,
|
|
112
114
|
SideNav,
|
|
113
115
|
Skeleton,
|
|
116
|
+
Sparkline,
|
|
114
117
|
Stack,
|
|
115
118
|
Stat,
|
|
116
119
|
StatusPill,
|
|
120
|
+
StatusTile,
|
|
117
121
|
Stepper,
|
|
118
122
|
Surface,
|
|
119
123
|
Switch,
|
|
@@ -128,6 +132,7 @@ export {
|
|
|
128
132
|
Textarea,
|
|
129
133
|
Th,
|
|
130
134
|
ThemeStyle,
|
|
135
|
+
TileGrid,
|
|
131
136
|
TimePicker,
|
|
132
137
|
Toaster,
|
|
133
138
|
Tooltip,
|
package/dist/esm/responsive.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { breakpoints } from "./breakpoints.js";
|
|
3
|
+
import { breakpoints, respVars, space } from "./breakpoints.js";
|
|
4
4
|
const ORDER = ["base", "sm", "md", "lg", "xl"];
|
|
5
5
|
function useBreakpoint() {
|
|
6
6
|
return React.useSyncExternalStore(subscribe, current, function() {
|
|
@@ -27,20 +27,6 @@ function useResponsive(value) {
|
|
|
27
27
|
for (let i = ORDER.indexOf(bp); i >= 0; i--) if (map[ORDER[i]] !== void 0) return map[ORDER[i]];
|
|
28
28
|
return void 0;
|
|
29
29
|
}
|
|
30
|
-
function respVars(prefix, value, map) {
|
|
31
|
-
const style = {};
|
|
32
|
-
if (value == null) return style;
|
|
33
|
-
if (typeof value !== "object") value = { base: value };
|
|
34
|
-
let byBp = value, cur;
|
|
35
|
-
ORDER.forEach(function(k) {
|
|
36
|
-
if (byBp[k] !== void 0) cur = map ? map(byBp[k]) : byBp[k];
|
|
37
|
-
if (cur !== void 0) style["--" + prefix + "-" + k] = cur;
|
|
38
|
-
});
|
|
39
|
-
return style;
|
|
40
|
-
}
|
|
41
|
-
const space = function(v) {
|
|
42
|
-
return typeof v === "number" ? "var(--aura-space-" + v + ")" : v;
|
|
43
|
-
};
|
|
44
30
|
export {
|
|
45
31
|
breakpoints,
|
|
46
32
|
respVars,
|
package/dist/esm/strings.js
CHANGED
|
@@ -127,6 +127,10 @@ const STRINGS = {
|
|
|
127
127
|
},
|
|
128
128
|
breadcrumbMore: "Show the full path",
|
|
129
129
|
stepError: "has errors",
|
|
130
|
+
statusDown: "Down",
|
|
131
|
+
statusProblem: "Problem",
|
|
132
|
+
statusMaintenance: "Maintenance",
|
|
133
|
+
statusOk: "OK",
|
|
130
134
|
accepts: function(list, max) {
|
|
131
135
|
return [list, max && "up to " + max + " each"].filter(Boolean).join(", ");
|
|
132
136
|
}
|
package/dist/esm/strings.sv.js
CHANGED
|
@@ -123,6 +123,10 @@ const sv = {
|
|
|
123
123
|
},
|
|
124
124
|
breadcrumbMore: "Visa hela s\xF6kv\xE4gen",
|
|
125
125
|
stepError: "har fel",
|
|
126
|
+
statusDown: "Nere",
|
|
127
|
+
statusProblem: "Problem",
|
|
128
|
+
statusMaintenance: "Underh\xE5ll",
|
|
129
|
+
statusOk: "OK",
|
|
126
130
|
accepts: function(list, max) {
|
|
127
131
|
return [list, max && "h\xF6gst " + max + " per fil"].filter(Boolean).join(", ");
|
|
128
132
|
}
|
package/dist/esm/strings.th.js
CHANGED
|
@@ -123,6 +123,10 @@ const th = {
|
|
|
123
123
|
},
|
|
124
124
|
breadcrumbMore: "\u0E41\u0E2A\u0E14\u0E07\u0E40\u0E2A\u0E49\u0E19\u0E17\u0E32\u0E07\u0E17\u0E31\u0E49\u0E07\u0E2B\u0E21\u0E14",
|
|
125
125
|
stepError: "\u0E21\u0E35\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14",
|
|
126
|
+
statusDown: "\u0E25\u0E48\u0E21",
|
|
127
|
+
statusProblem: "\u0E21\u0E35\u0E1B\u0E31\u0E0D\u0E2B\u0E32",
|
|
128
|
+
statusMaintenance: "\u0E1B\u0E34\u0E14\u0E1B\u0E23\u0E31\u0E1A\u0E1B\u0E23\u0E38\u0E07",
|
|
129
|
+
statusOk: "\u0E1B\u0E01\u0E15\u0E34",
|
|
126
130
|
accepts: function(list, max) {
|
|
127
131
|
return [list, max && "\u0E44\u0E21\u0E48\u0E40\u0E01\u0E34\u0E19 " + max + " \u0E15\u0E48\u0E2D\u0E44\u0E1F\u0E25\u0E4C"].filter(Boolean).join(" \xB7 ");
|
|
128
132
|
}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
4
|
+
import { cx } from "./classes.js";
|
|
5
|
+
import { respVars } from "./breakpoints.js";
|
|
6
|
+
import { STRINGS } from "./strings.js";
|
|
7
|
+
import { IconCircleAlert, IconCircleCheck, IconTriangleAlert, IconWrench } from "./icons.js";
|
|
8
|
+
const h = React.createElement;
|
|
9
|
+
const STATUS_ICON = {
|
|
10
|
+
down: IconCircleAlert,
|
|
11
|
+
problem: IconTriangleAlert,
|
|
12
|
+
maintenance: IconWrench,
|
|
13
|
+
ok: IconCircleCheck
|
|
14
|
+
};
|
|
15
|
+
const STATUS_TONE = {
|
|
16
|
+
down: "danger",
|
|
17
|
+
problem: "warning",
|
|
18
|
+
maintenance: "accent",
|
|
19
|
+
ok: "default"
|
|
20
|
+
};
|
|
21
|
+
const STATUS_WORD = {
|
|
22
|
+
down: "statusDown",
|
|
23
|
+
problem: "statusProblem",
|
|
24
|
+
maintenance: "statusMaintenance",
|
|
25
|
+
ok: "statusOk"
|
|
26
|
+
};
|
|
27
|
+
function statusWord(status, t) {
|
|
28
|
+
return String(t[STATUS_WORD[status]] || STATUS_WORD[status]);
|
|
29
|
+
}
|
|
30
|
+
function attrs(props) {
|
|
31
|
+
const out = {};
|
|
32
|
+
Object.keys(props).forEach(function(k) {
|
|
33
|
+
if (k === "id" || k === "style" || k === "lang" || k === "dir" || /^(aria|data)-/.test(k))
|
|
34
|
+
out[k] = props[k];
|
|
35
|
+
});
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
const comma = h("span", { className: "aura-status-tile__sep" }, ",");
|
|
39
|
+
function statusTileElement(props, ref, Link, t, titleRef) {
|
|
40
|
+
const status = STATUS_ICON[props.status] ? props.status : "ok";
|
|
41
|
+
const valueTone = props.valueTone || STATUS_TONE[status];
|
|
42
|
+
const word = props.statusLabel || statusWord(status, t);
|
|
43
|
+
const markers = (props.markers || []).filter(Boolean);
|
|
44
|
+
const has = function(v) {
|
|
45
|
+
return v != null && v !== false && v !== "";
|
|
46
|
+
};
|
|
47
|
+
const hasValue = has(props.value), hasMeta = has(props.meta);
|
|
48
|
+
const Tag = props.href ? Link : "div";
|
|
49
|
+
return h(
|
|
50
|
+
Tag,
|
|
51
|
+
Object.assign(attrs(props), {
|
|
52
|
+
ref,
|
|
53
|
+
href: props.href,
|
|
54
|
+
className: cx("aura-status-tile", "aura-status-tile--" + status, props.href && "is-interactive", props.className)
|
|
55
|
+
}),
|
|
56
|
+
h(
|
|
57
|
+
"span",
|
|
58
|
+
{ className: "aura-status-tile__head" },
|
|
59
|
+
h(Icon, { name: h(STATUS_ICON[status]), size: 16, className: "aura-status-tile__icon" }),
|
|
60
|
+
h("span", { className: "aura-status-tile__title", ref: titleRef }, props.title, comma),
|
|
61
|
+
h("span", { className: "aura-sr-only" }, word + (hasValue || hasMeta || markers.length ? "," : "")),
|
|
62
|
+
hasValue ? h(
|
|
63
|
+
"span",
|
|
64
|
+
{ className: cx("aura-status-tile__value", "is-" + valueTone) },
|
|
65
|
+
props.value,
|
|
66
|
+
hasMeta || markers.length ? comma : null
|
|
67
|
+
) : null
|
|
68
|
+
),
|
|
69
|
+
hasMeta || markers.length ? h(
|
|
70
|
+
"span",
|
|
71
|
+
{ className: "aura-status-tile__foot" },
|
|
72
|
+
hasMeta ? h("span", { className: "aura-status-tile__meta" }, props.meta, markers.length ? comma : null) : null,
|
|
73
|
+
markers.length ? h(
|
|
74
|
+
"span",
|
|
75
|
+
{ className: "aura-status-tile__markers" },
|
|
76
|
+
markers.map(function(m, i) {
|
|
77
|
+
return h(
|
|
78
|
+
"span",
|
|
79
|
+
{
|
|
80
|
+
key: i,
|
|
81
|
+
className: cx("aura-status-tile__marker", "is-" + (m.tone || "neutral")),
|
|
82
|
+
"data-aura-tip": m.label
|
|
83
|
+
},
|
|
84
|
+
h(Icon, { name: m.icon, size: 14 }),
|
|
85
|
+
h("span", { className: "aura-sr-only" }, m.label + (i < markers.length - 1 ? "," : ""))
|
|
86
|
+
);
|
|
87
|
+
})
|
|
88
|
+
) : null
|
|
89
|
+
) : null
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
function ServerStatusTile(props) {
|
|
93
|
+
return statusTileElement(props, void 0, props.linkComponent || "a", STRINGS.en);
|
|
94
|
+
}
|
|
95
|
+
const TileGrid = React.forwardRef(function TileGrid2(props, ref) {
|
|
96
|
+
const style = Object.assign(
|
|
97
|
+
{},
|
|
98
|
+
respVars("aura-grid-cols", props.columns == null ? { base: 2, md: 3 } : props.columns),
|
|
99
|
+
props.style
|
|
100
|
+
);
|
|
101
|
+
return h(
|
|
102
|
+
"ul",
|
|
103
|
+
Object.assign(attrs(props), {
|
|
104
|
+
ref,
|
|
105
|
+
role: "list",
|
|
106
|
+
className: cx("aura-grid-layout", "aura-tile-grid", props.className),
|
|
107
|
+
style
|
|
108
|
+
}),
|
|
109
|
+
/* toArray drops null and booleans and keys each element; a Fragment's children are items too. */
|
|
110
|
+
flat(props.children).map(function(c, i) {
|
|
111
|
+
return h("li", { key: React.isValidElement(c) && c.key != null ? c.key : i }, c);
|
|
112
|
+
})
|
|
113
|
+
);
|
|
114
|
+
});
|
|
115
|
+
function flat(children) {
|
|
116
|
+
const out = [];
|
|
117
|
+
React.Children.toArray(children).forEach(function(c) {
|
|
118
|
+
if (React.isValidElement(c) && c.type === React.Fragment)
|
|
119
|
+
flat(c.props.children).forEach(function(x) {
|
|
120
|
+
out.push(React.isValidElement(x) ? React.cloneElement(x, { key: String(c.key) + "/" + String(x.key) }) : x);
|
|
121
|
+
});
|
|
122
|
+
else if (c !== "") out.push(c);
|
|
123
|
+
});
|
|
124
|
+
return out;
|
|
125
|
+
}
|
|
126
|
+
const SIZES = { sm: [80, 24], md: [120, 32] };
|
|
127
|
+
const PAD = 2;
|
|
128
|
+
function r(n) {
|
|
129
|
+
return Math.round(n * 100) / 100;
|
|
130
|
+
}
|
|
131
|
+
function num(v) {
|
|
132
|
+
return typeof v === "number" && isFinite(v) ? v : null;
|
|
133
|
+
}
|
|
134
|
+
const Sparkline = React.forwardRef(function Sparkline2(props, ref) {
|
|
135
|
+
const wh = SIZES[props.size || "sm"] || SIZES.sm;
|
|
136
|
+
const W = wh[0], H = wh[1];
|
|
137
|
+
const data = (props.data || []).map(num);
|
|
138
|
+
const n = data.length;
|
|
139
|
+
const vals = data.filter(function(v) {
|
|
140
|
+
return v != null;
|
|
141
|
+
});
|
|
142
|
+
let lo = num(props.min), hi = num(props.max);
|
|
143
|
+
if (lo == null) lo = vals.length ? Math.min.apply(null, vals) : 0;
|
|
144
|
+
if (hi == null) hi = vals.length ? Math.max.apply(null, vals) : 0;
|
|
145
|
+
if (lo > hi) {
|
|
146
|
+
const s = lo;
|
|
147
|
+
lo = hi;
|
|
148
|
+
hi = s;
|
|
149
|
+
}
|
|
150
|
+
const step = n > 1 ? (W - 2 * PAD) / (n - 1) : 0;
|
|
151
|
+
const x = function(i) {
|
|
152
|
+
return n > 1 ? PAD + i * step : W / 2;
|
|
153
|
+
};
|
|
154
|
+
const y = function(v) {
|
|
155
|
+
if (hi === lo) return H / 2;
|
|
156
|
+
const k = Math.max(0, Math.min(1, (v - lo) / (hi - lo)));
|
|
157
|
+
return H - PAD - k * (H - 2 * PAD);
|
|
158
|
+
};
|
|
159
|
+
let d = "";
|
|
160
|
+
const dots = [];
|
|
161
|
+
data.forEach(function(v, i) {
|
|
162
|
+
if (v == null) return;
|
|
163
|
+
const prev = i > 0 && data[i - 1] != null, next = i < n - 1 && data[i + 1] != null;
|
|
164
|
+
if (!prev && !next) dots.push(h("circle", { key: "d" + i, cx: r(x(i)), cy: r(y(v)), r: 1.5 }));
|
|
165
|
+
else d += (prev ? "L" : "M") + r(x(i)) + " " + r(y(v));
|
|
166
|
+
});
|
|
167
|
+
const mode = props.failures || "none";
|
|
168
|
+
const fails = [];
|
|
169
|
+
if (mode !== "none" && props.failed)
|
|
170
|
+
data.forEach(function(_v, i) {
|
|
171
|
+
if (!props.failed[i]) return;
|
|
172
|
+
if (mode === "band") {
|
|
173
|
+
const w = Math.max(2, step || W), left = Math.max(0, x(i) - w / 2), right = Math.min(W, x(i) + w / 2);
|
|
174
|
+
fails.push(h("rect", { key: "f" + i, x: r(left), y: 0, width: r(right - left), height: H }));
|
|
175
|
+
} else
|
|
176
|
+
fails.push(
|
|
177
|
+
h("rect", {
|
|
178
|
+
key: "f" + i,
|
|
179
|
+
x: r(Math.max(0, Math.min(W - 1.5, x(i) - 0.75))),
|
|
180
|
+
y: H - 6,
|
|
181
|
+
width: 1.5,
|
|
182
|
+
height: 6
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
const named = !!props.label;
|
|
187
|
+
return h(
|
|
188
|
+
"svg",
|
|
189
|
+
Object.assign(attrs(props), {
|
|
190
|
+
ref,
|
|
191
|
+
className: cx("aura-sparkline", "is-" + (props.tone || "neutral"), props.className),
|
|
192
|
+
width: W,
|
|
193
|
+
height: H,
|
|
194
|
+
viewBox: "0 0 " + W + " " + H,
|
|
195
|
+
role: named ? "img" : void 0,
|
|
196
|
+
"aria-label": named ? props.label : void 0,
|
|
197
|
+
"aria-hidden": named ? void 0 : true,
|
|
198
|
+
focusable: "false"
|
|
199
|
+
}),
|
|
200
|
+
fails.length && mode === "band" ? h("g", { className: "aura-sparkline__band" }, fails) : null,
|
|
201
|
+
d ? h("path", { className: "aura-sparkline__line", d }) : null,
|
|
202
|
+
dots.length ? h("g", { className: "aura-sparkline__dots" }, dots) : null,
|
|
203
|
+
fails.length && mode === "ticks" ? h("g", { className: "aura-sparkline__ticks" }, fails) : null
|
|
204
|
+
);
|
|
205
|
+
});
|
|
206
|
+
export {
|
|
207
|
+
ServerStatusTile,
|
|
208
|
+
Sparkline,
|
|
209
|
+
TileGrid,
|
|
210
|
+
statusTileElement,
|
|
211
|
+
statusWord
|
|
212
|
+
};
|
package/dist/index.d.cts
CHANGED
|
@@ -1614,6 +1614,70 @@ export interface Theme {
|
|
|
1614
1614
|
/** CSS overriding the tokens. No selector: the whole page. A selector (".tenant-acme") scopes it. Load after aura.css. */
|
|
1615
1615
|
css(selector?: string): string;
|
|
1616
1616
|
}
|
|
1617
|
+
/** A monitored thing's state on a StatusTile. */
|
|
1618
|
+
export type StatusTileStatus = "down" | "problem" | "maintenance" | "ok";
|
|
1619
|
+
/** A colour for a tile's value or a marker: `danger`, `warning`, `accent` (violet), `neutral` (grey) or `default`
|
|
1620
|
+
* (the text colour). */
|
|
1621
|
+
export type TileTone = "danger" | "warning" | "accent" | "neutral" | "default";
|
|
1622
|
+
/** A small icon at the end of a StatusTile's second line ("SSL expires soon", "Muted"). */
|
|
1623
|
+
export interface StatusTileMarker {
|
|
1624
|
+
icon: IconInput;
|
|
1625
|
+
/** What it means. Read with the tile's name and shown as a tip on hover (a mouse only: on a phone, say it on the
|
|
1626
|
+
* detail page too). */
|
|
1627
|
+
label: string;
|
|
1628
|
+
/** Default `neutral`. */
|
|
1629
|
+
tone?: TileTone | undefined;
|
|
1630
|
+
}
|
|
1631
|
+
export interface StatusTileProps extends Pick<React$1.HTMLAttributes<HTMLElement>, "id" | "style" | "lang" | "dir">, React$1.AriaAttributes, DataAttributes {
|
|
1632
|
+
/** down (red), problem (amber), maintenance (violet) or ok (grey). Each has its own icon too, so colour is never the
|
|
1633
|
+
* only sign. */
|
|
1634
|
+
status: StatusTileStatus;
|
|
1635
|
+
/** The name. Wraps to two lines at most, then ends with "…"; a cut name shows in full in a tip on hover. */
|
|
1636
|
+
title: React$1.ReactNode;
|
|
1637
|
+
/** Top right, tabular figures: "12m", "99.98%", "240 ms". */
|
|
1638
|
+
value?: React$1.ReactNode | undefined;
|
|
1639
|
+
/** The value's colour. Default: the status's (down → danger, problem → warning, maintenance → accent, ok → default). */
|
|
1640
|
+
valueTone?: TileTone | undefined;
|
|
1641
|
+
/** A short second line: "since 09:41", "3 of 4 checks". */
|
|
1642
|
+
meta?: React$1.ReactNode | undefined;
|
|
1643
|
+
/** Small icons at the end of the second line, each with a label. */
|
|
1644
|
+
markers?: ReadonlyArray<StatusTileMarker> | undefined;
|
|
1645
|
+
/** Makes the whole tile a link. Its name is everything the tile says, in reading order. */
|
|
1646
|
+
href?: string | undefined;
|
|
1647
|
+
/** Your router's link (e.g. `next/link`); defaults to AuraProvider's `linkComponent`, then `<a>`. */
|
|
1648
|
+
linkComponent?: React$1.ElementType | undefined;
|
|
1649
|
+
/** The status word read out after the title. Default: the locale's (Down, Problem, Maintenance, OK). */
|
|
1650
|
+
statusLabel?: string | undefined;
|
|
1651
|
+
className?: string | undefined;
|
|
1652
|
+
}
|
|
1653
|
+
export interface TileGridProps extends Pick<React$1.HTMLAttributes<HTMLElement>, "id" | "style" | "lang" | "dir">, React$1.AriaAttributes, DataAttributes {
|
|
1654
|
+
/** Equal columns, responsive like Grid. Default `{ base: 2, md: 3 }` (two on phones, three from 768px). */
|
|
1655
|
+
columns?: Responsive<number> | undefined;
|
|
1656
|
+
/** Each child (and each child of a Fragment) becomes one list item; the grid is a `ul` with an 8px gap. */
|
|
1657
|
+
children?: React$1.ReactNode;
|
|
1658
|
+
className?: string | undefined;
|
|
1659
|
+
}
|
|
1660
|
+
export interface SparklineProps extends Pick<React$1.SVGAttributes<SVGSVGElement>, "id" | "style">, DataAttributes {
|
|
1661
|
+
/** The values, oldest first. `null` (or a value that isn't a finite number) is no point: the line breaks there. */
|
|
1662
|
+
data: ReadonlyArray<number | null | undefined>;
|
|
1663
|
+
/** Which points failed, by the same index as `data`. Shown only when `failures` isn't `none`. */
|
|
1664
|
+
failed?: ReadonlyArray<boolean | null | undefined> | undefined;
|
|
1665
|
+
/** How failed points show: `none` (default), `band` (a red band behind the point) or `ticks` (a red tick at the
|
|
1666
|
+
* foot). */
|
|
1667
|
+
failures?: "none" | "band" | "ticks" | undefined;
|
|
1668
|
+
/** The line's colour. Default `neutral`. */
|
|
1669
|
+
tone?: "neutral" | "accent" | "danger" | "warning" | "positive" | undefined;
|
|
1670
|
+
/** `sm` 80×24 (default), `md` 120×32. */
|
|
1671
|
+
size?: "sm" | "md" | undefined;
|
|
1672
|
+
/** The scale's ends; default the data's own lowest and highest. Give tiles the same ones to compare them. Values
|
|
1673
|
+
* beyond them are drawn at the edge. */
|
|
1674
|
+
min?: number | undefined;
|
|
1675
|
+
max?: number | undefined;
|
|
1676
|
+
/** What the line says, for screen readers ("Response time, last 24 h: 180–420 ms, 2 failures"). Without it the
|
|
1677
|
+
* sparkline is decoration and hidden from them. */
|
|
1678
|
+
label?: string | undefined;
|
|
1679
|
+
className?: string | undefined;
|
|
1680
|
+
}
|
|
1617
1681
|
/** One SVG child: element name and its attributes. */
|
|
1618
1682
|
export type IconShape = [
|
|
1619
1683
|
string,
|
|
@@ -1824,42 +1888,10 @@ export interface PageHeaderProps extends Pick<React$1.HTMLAttributes<HTMLElement
|
|
|
1824
1888
|
style?: React$1.CSSProperties | undefined;
|
|
1825
1889
|
}
|
|
1826
1890
|
export declare const PageHeader: React$1.ForwardRefExoticComponent<PageHeaderProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1827
|
-
/**
|
|
1828
|
-
*
|
|
1829
|
-
*
|
|
1830
|
-
export declare const
|
|
1831
|
-
/** ActionBar — a bar stuck to the bottom of the screen or of a card: a status line and the form's or selection's
|
|
1832
|
-
* actions. It is `position: sticky`, so it stays in the flow at the end of its parent and never covers the last field. */
|
|
1833
|
-
export declare const ActionBar: React$1.ForwardRefExoticComponent<ActionBarProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1834
|
-
/** Separator — a 1px `aura-border-default` rule between groups of content (4.20). Decorative by default (hidden from
|
|
1835
|
-
* screen readers); `decorative={false}` makes it a `role="separator"` that is announced. */
|
|
1836
|
-
export declare const Separator: React$1.ForwardRefExoticComponent<SeparatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
1837
|
-
/** A static table. Scrolls sideways inside its own box when it is wider than its container. */
|
|
1838
|
-
export declare const Table: React$1.ForwardRefExoticComponent<TableProps & React$1.RefAttributes<HTMLTableElement>>;
|
|
1839
|
-
export declare const THead: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
1840
|
-
export declare const TBody: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
1841
|
-
export declare const TFoot: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
1842
|
-
export declare const Tr: React$1.ForwardRefExoticComponent<TableRowProps & React$1.RefAttributes<HTMLTableRowElement>>;
|
|
1843
|
-
/** Header cell. `scope` defaults to `col`; pass `scope="row"` for a row header in the body. */
|
|
1844
|
-
export declare const Th: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
1845
|
-
/** Data cell. `numeric` right-aligns with tabular figures (money, counts). */
|
|
1846
|
-
export declare const Td: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
1847
|
-
/** BottomNav — a phone tab bar: icon over a short label, a count or dot, the current page marked. Fixed to the bottom,
|
|
1848
|
-
* padded for the home indicator, with a spacer of the same height in the flow so nothing sits under it. Which
|
|
1849
|
-
* breakpoints show it is decided in CSS, so the server's HTML is already right and nothing shifts on hydration. */
|
|
1850
|
-
export declare const BottomNav: React$1.ForwardRefExoticComponent<BottomNavProps & React$1.RefAttributes<HTMLElement>>;
|
|
1851
|
-
/** Min-width breakpoints in px, mirroring the aura-bp-* tokens. */
|
|
1852
|
-
export declare const breakpoints: {
|
|
1853
|
-
sm: 640;
|
|
1854
|
-
md: 768;
|
|
1855
|
-
lg: 1024;
|
|
1856
|
-
xl: 1280;
|
|
1857
|
-
};
|
|
1858
|
-
/** The widest breakpoint the window currently meets: 'base' | 'sm' | 'md' | 'lg' | 'xl'. 'lg' during server render. */
|
|
1859
|
-
export declare function useBreakpoint(): Breakpoint;
|
|
1860
|
-
/** Pick a value for the current breakpoint from { base, sm, md, lg, xl } (falls back to the next smaller one). */
|
|
1861
|
-
export declare function useResponsive<T>(value: Responsive<T>): T | undefined;
|
|
1862
|
-
export declare const Surface: React$1.ForwardRefExoticComponent<SurfaceProps & React$1.RefAttributes<HTMLElement>>;
|
|
1891
|
+
/** StatusTile (5.34, DxT Monitor S06): one monitored thing — a status icon and tint, a two-line title, a value at the
|
|
1892
|
+
* top right, a short meta line and marker icons. With `href` the whole tile is one link, named by everything it
|
|
1893
|
+
* says. Put tiles in a TileGrid. Also exported from `/server` (status word in English unless `statusLabel`). */
|
|
1894
|
+
export declare const StatusTile: React$1.ForwardRefExoticComponent<StatusTileProps & React$1.RefAttributes<HTMLElement>>;
|
|
1863
1895
|
/** Every built-in label. Function entries build the text from their arguments. */
|
|
1864
1896
|
export interface AuraStrings {
|
|
1865
1897
|
close: string;
|
|
@@ -1949,6 +1981,11 @@ export interface AuraStrings {
|
|
|
1949
1981
|
breadcrumbMore: string;
|
|
1950
1982
|
/** A Stepper step with `status: 'error'` (5.18). */
|
|
1951
1983
|
stepError: string;
|
|
1984
|
+
/** StatusTile's status words (5.34). */
|
|
1985
|
+
statusDown: string;
|
|
1986
|
+
statusProblem: string;
|
|
1987
|
+
statusMaintenance: string;
|
|
1988
|
+
statusOk: string;
|
|
1952
1989
|
}
|
|
1953
1990
|
/** Built-in strings by locale. th and sv also ship as packs (`@jirawatpyk/aura-react/locales/th`, `/sv`, 5.9); in 6.0
|
|
1954
1991
|
* only en stays built in and a Thai or Swedish app passes its pack to AuraProvider `strings`. */
|
|
@@ -1961,6 +1998,44 @@ export declare const STRINGS: {
|
|
|
1961
1998
|
th: AuraStrings;
|
|
1962
1999
|
sv: AuraStrings;
|
|
1963
2000
|
};
|
|
2001
|
+
export declare const TileGrid: React$1.ForwardRefExoticComponent<TileGridProps & React$1.RefAttributes<HTMLUListElement>>;
|
|
2002
|
+
export declare const Sparkline: React$1.ForwardRefExoticComponent<SparklineProps & React$1.RefAttributes<SVGSVGElement>>;
|
|
2003
|
+
/** AppShell — side navigation + top bar + content. The nav is fixed from lg (1024px) up and a Drawer below it.
|
|
2004
|
+
* Which one shows is decided in CSS (4.16), so the server's HTML is already right on a phone and nothing shifts on
|
|
2005
|
+
* hydration; JavaScript only opens and closes the drawer. */
|
|
2006
|
+
export declare const AppShell: React$1.ForwardRefExoticComponent<AppShellProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2007
|
+
/** ActionBar — a bar stuck to the bottom of the screen or of a card: a status line and the form's or selection's
|
|
2008
|
+
* actions. It is `position: sticky`, so it stays in the flow at the end of its parent and never covers the last field. */
|
|
2009
|
+
export declare const ActionBar: React$1.ForwardRefExoticComponent<ActionBarProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2010
|
+
/** Separator — a 1px `aura-border-default` rule between groups of content (4.20). Decorative by default (hidden from
|
|
2011
|
+
* screen readers); `decorative={false}` makes it a `role="separator"` that is announced. */
|
|
2012
|
+
export declare const Separator: React$1.ForwardRefExoticComponent<SeparatorProps & React$1.RefAttributes<HTMLDivElement>>;
|
|
2013
|
+
/** A static table. Scrolls sideways inside its own box when it is wider than its container. */
|
|
2014
|
+
export declare const Table: React$1.ForwardRefExoticComponent<TableProps & React$1.RefAttributes<HTMLTableElement>>;
|
|
2015
|
+
export declare const THead: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
2016
|
+
export declare const TBody: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
2017
|
+
export declare const TFoot: React$1.ForwardRefExoticComponent<TableSectionProps & React$1.RefAttributes<HTMLTableSectionElement>>;
|
|
2018
|
+
export declare const Tr: React$1.ForwardRefExoticComponent<TableRowProps & React$1.RefAttributes<HTMLTableRowElement>>;
|
|
2019
|
+
/** Header cell. `scope` defaults to `col`; pass `scope="row"` for a row header in the body. */
|
|
2020
|
+
export declare const Th: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
2021
|
+
/** Data cell. `numeric` right-aligns with tabular figures (money, counts). */
|
|
2022
|
+
export declare const Td: React$1.ForwardRefExoticComponent<TableCellProps & React$1.RefAttributes<HTMLTableCellElement>>;
|
|
2023
|
+
/** BottomNav — a phone tab bar: icon over a short label, a count or dot, the current page marked. Fixed to the bottom,
|
|
2024
|
+
* padded for the home indicator, with a spacer of the same height in the flow so nothing sits under it. Which
|
|
2025
|
+
* breakpoints show it is decided in CSS, so the server's HTML is already right and nothing shifts on hydration. */
|
|
2026
|
+
export declare const BottomNav: React$1.ForwardRefExoticComponent<BottomNavProps & React$1.RefAttributes<HTMLElement>>;
|
|
2027
|
+
/** Min-width breakpoints in px, mirroring the aura-bp-* tokens. */
|
|
2028
|
+
export declare const breakpoints: {
|
|
2029
|
+
sm: 640;
|
|
2030
|
+
md: 768;
|
|
2031
|
+
lg: 1024;
|
|
2032
|
+
xl: 1280;
|
|
2033
|
+
};
|
|
2034
|
+
/** The widest breakpoint the window currently meets: 'base' | 'sm' | 'md' | 'lg' | 'xl'. 'lg' during server render. */
|
|
2035
|
+
export declare function useBreakpoint(): Breakpoint;
|
|
2036
|
+
/** Pick a value for the current breakpoint from { base, sm, md, lg, xl } (falls back to the next smaller one). */
|
|
2037
|
+
export declare function useResponsive<T>(value: Responsive<T>): T | undefined;
|
|
2038
|
+
export declare const Surface: React$1.ForwardRefExoticComponent<SurfaceProps & React$1.RefAttributes<HTMLElement>>;
|
|
1964
2039
|
/** What useAuraLocale returns. `locale` and `calendar` are null outside an AuraProvider. */
|
|
1965
2040
|
export interface AuraLocaleValue {
|
|
1966
2041
|
locale: "th" | "en" | "sv" | null;
|