nish-ui 1.7.0 → 1.9.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 +15 -1
- package/dist/chart.js.map +1 -1
- package/dist/elements-charts.d.ts +53 -0
- package/dist/elements-charts.js +132 -0
- package/dist/elements-charts.js.map +1 -0
- package/dist/elements-data.d.ts +95 -0
- package/dist/elements-data.js +47 -0
- package/dist/elements-data.js.map +1 -0
- package/dist/elements-forms.d.ts +147 -0
- package/dist/elements-forms.js +92 -0
- package/dist/elements-forms.js.map +1 -0
- package/dist/elements.js +3 -3
- package/dist/elements.js.map +1 -1
- package/dist/files.json +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +54 -27
- package/dist/index.js.map +1 -1
- package/dist/nish-components.css +2598 -176
- package/dist/system-canvas.js.map +1 -1
- package/dist/theme.d.ts +3 -0
- package/dist/theme.global.js +16 -4
- package/dist/theme.global.js.map +1 -1
- package/dist/theme.js +13 -1
- package/dist/theme.js.map +1 -1
- package/package.json +30 -2
package/dist/files.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -172,6 +172,9 @@ interface MountScrollspyOptions {
|
|
|
172
172
|
/** Pixels from the top of the viewport where a section counts as current. Default: the
|
|
173
173
|
* `--nish-header-h` variable plus the nav's own height plus 8. */
|
|
174
174
|
offset?: number;
|
|
175
|
+
/** Publish the nav's height as `--nish-sticky-extra`. Default true; a non-sticky nav passes
|
|
176
|
+
* false so it does not touch a value another sticky nav publishes. */
|
|
177
|
+
height?: boolean;
|
|
175
178
|
}
|
|
176
179
|
/** Scrollspy for a `.nish-subnav`: each `a[href^="#"]` maps to the element with that id.
|
|
177
180
|
* The link whose section is current gets `aria-current="true"` (the last section whose top
|
package/dist/index.js
CHANGED
|
@@ -587,6 +587,13 @@ function mountThemeToggle(button, opts = {}) {
|
|
|
587
587
|
off();
|
|
588
588
|
};
|
|
589
589
|
}
|
|
590
|
+
var TOAST_ICON_PATHS = {
|
|
591
|
+
neutral: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/>',
|
|
592
|
+
info: '<circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/>',
|
|
593
|
+
ok: '<circle cx="12" cy="12" r="10"/><path d="m9 12 2 2 4-4"/>',
|
|
594
|
+
warn: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4M12 17h.01"/>',
|
|
595
|
+
loss: '<path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3"/><path d="M12 9v4M12 17h.01"/>'
|
|
596
|
+
};
|
|
590
597
|
var TOAST_MS = 6e3;
|
|
591
598
|
var toastRegion = null;
|
|
592
599
|
var hideCurrent = null;
|
|
@@ -602,6 +609,11 @@ function showToast(content, opts = {}) {
|
|
|
602
609
|
const region = toastRegion;
|
|
603
610
|
const box = document.createElement("div");
|
|
604
611
|
box.className = "nish-toast" + (opts.tone && opts.tone !== "neutral" ? ` nish-toast--${opts.tone}` : "");
|
|
612
|
+
const icon = document.createElement("span");
|
|
613
|
+
icon.className = "nish-toast-icon";
|
|
614
|
+
icon.setAttribute("aria-hidden", "true");
|
|
615
|
+
icon.innerHTML = `<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" focusable="false">${TOAST_ICON_PATHS[opts.tone ?? "neutral"]}</svg>`;
|
|
616
|
+
box.append(icon);
|
|
605
617
|
const body = document.createElement("p");
|
|
606
618
|
body.className = "nish-toast-body";
|
|
607
619
|
body.append(typeof content === "string" ? document.createTextNode(content) : content);
|
|
@@ -965,7 +977,7 @@ function mountScrollspy(nav, o = {}) {
|
|
|
965
977
|
return null;
|
|
966
978
|
}
|
|
967
979
|
};
|
|
968
|
-
const unheight = mountHeightVar(nav, "--nish-sticky-extra");
|
|
980
|
+
const unheight = o.height === false ? () => void 0 : mountHeightVar(nav, "--nish-sticky-extra");
|
|
969
981
|
let current = null;
|
|
970
982
|
const edges = () => {
|
|
971
983
|
const max = nav.scrollWidth - nav.clientWidth;
|
|
@@ -4784,6 +4796,31 @@ import {
|
|
|
4784
4796
|
useRef as useRef9,
|
|
4785
4797
|
useState as useState8
|
|
4786
4798
|
} from "react";
|
|
4799
|
+
|
|
4800
|
+
// src/sparkline-path.ts
|
|
4801
|
+
function sparklineGeometry(values, width, height, min, max) {
|
|
4802
|
+
const nums = values.filter((v) => v != null && Number.isFinite(v));
|
|
4803
|
+
const empty = nums.length === 0;
|
|
4804
|
+
const lo = min ?? (empty ? 0 : Math.min(...nums));
|
|
4805
|
+
const hi = max ?? (empty ? 1 : Math.max(...nums));
|
|
4806
|
+
const pad = 2;
|
|
4807
|
+
const x = (i) => values.length <= 1 ? width / 2 : i / (values.length - 1) * width;
|
|
4808
|
+
const y = (v) => hi === lo ? height / 2 : pad + (1 - (v - lo) / (hi - lo)) * (height - 2 * pad);
|
|
4809
|
+
const runs = [];
|
|
4810
|
+
let run = [];
|
|
4811
|
+
values.forEach((v, i) => {
|
|
4812
|
+
if (v == null || !Number.isFinite(v)) {
|
|
4813
|
+
if (run.length) runs.push(run);
|
|
4814
|
+
run = [];
|
|
4815
|
+
} else run.push({ x: x(i), y: y(v) });
|
|
4816
|
+
});
|
|
4817
|
+
if (run.length) runs.push(run);
|
|
4818
|
+
const line = (r) => r.length === 1 ? `M${r[0].x},${r[0].y}h0` : r.map((p, i) => `${i ? "L" : "M"}${p.x},${p.y}`).join("");
|
|
4819
|
+
const area = (r) => r.length < 2 ? "" : `${line(r)}L${r[r.length - 1].x},${height}L${r[0].x},${height}Z`;
|
|
4820
|
+
return { empty, lines: runs.map(line), areas: runs.map(area), baseline: `M0,${height / 2}H${width}` };
|
|
4821
|
+
}
|
|
4822
|
+
|
|
4823
|
+
// src/components/display.tsx
|
|
4787
4824
|
import { Fragment as Fragment6, jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
4788
4825
|
function Svg3({ size = 16, children, ...rest }) {
|
|
4789
4826
|
return /* @__PURE__ */ jsx12(
|
|
@@ -5099,24 +5136,7 @@ function Sparkline({
|
|
|
5099
5136
|
max,
|
|
5100
5137
|
className
|
|
5101
5138
|
}) {
|
|
5102
|
-
const
|
|
5103
|
-
const empty = nums.length === 0;
|
|
5104
|
-
const lo = min ?? (empty ? 0 : Math.min(...nums));
|
|
5105
|
-
const hi = max ?? (empty ? 1 : Math.max(...nums));
|
|
5106
|
-
const pad = 2;
|
|
5107
|
-
const x = (i) => values.length <= 1 ? width / 2 : i / (values.length - 1) * width;
|
|
5108
|
-
const y = (v) => hi === lo ? height / 2 : pad + (1 - (v - lo) / (hi - lo)) * (height - 2 * pad);
|
|
5109
|
-
const runs = [];
|
|
5110
|
-
let run = [];
|
|
5111
|
-
values.forEach((v, i) => {
|
|
5112
|
-
if (v == null || !Number.isFinite(v)) {
|
|
5113
|
-
if (run.length) runs.push(run);
|
|
5114
|
-
run = [];
|
|
5115
|
-
} else run.push({ x: x(i), y: y(v) });
|
|
5116
|
-
});
|
|
5117
|
-
if (run.length) runs.push(run);
|
|
5118
|
-
const line = (r) => r.length === 1 ? `M${r[0].x},${r[0].y}h0` : r.map((p, i) => `${i ? "L" : "M"}${p.x},${p.y}`).join("");
|
|
5119
|
-
const area = (r) => r.length < 2 ? "" : `${line(r)}L${r[r.length - 1].x},${height}L${r[0].x},${height}Z`;
|
|
5139
|
+
const { empty, lines, areas, baseline } = sparklineGeometry(values, width, height, min, max);
|
|
5120
5140
|
return /* @__PURE__ */ jsx12(
|
|
5121
5141
|
"svg",
|
|
5122
5142
|
{
|
|
@@ -5130,18 +5150,18 @@ function Sparkline({
|
|
|
5130
5150
|
children: empty ? /* @__PURE__ */ jsx12(
|
|
5131
5151
|
"path",
|
|
5132
5152
|
{
|
|
5133
|
-
d:
|
|
5153
|
+
d: baseline,
|
|
5134
5154
|
stroke: "currentColor",
|
|
5135
5155
|
strokeWidth: 1.5,
|
|
5136
5156
|
strokeDasharray: "3 3",
|
|
5137
5157
|
vectorEffect: "non-scaling-stroke"
|
|
5138
5158
|
}
|
|
5139
5159
|
) : /* @__PURE__ */ jsxs12(Fragment6, { children: [
|
|
5140
|
-
fill ?
|
|
5141
|
-
|
|
5160
|
+
fill ? areas.map((d, i) => /* @__PURE__ */ jsx12("path", { d, fill: "currentColor", fillOpacity: 0.15 }, `a${i}`)) : null,
|
|
5161
|
+
lines.map((d, i) => /* @__PURE__ */ jsx12(
|
|
5142
5162
|
"path",
|
|
5143
5163
|
{
|
|
5144
|
-
d
|
|
5164
|
+
d,
|
|
5145
5165
|
fill: "none",
|
|
5146
5166
|
stroke: "currentColor",
|
|
5147
5167
|
strokeWidth: 1.5,
|
|
@@ -8878,14 +8898,21 @@ function ServiceTokensSection({
|
|
|
8878
8898
|
|
|
8879
8899
|
// src/components/combobox.tsx
|
|
8880
8900
|
import { useCallback as useCallback10, useEffect as useEffect23, useId as useId11, useMemo as useMemo7, useRef as useRef21, useState as useState21 } from "react";
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
var
|
|
8884
|
-
var
|
|
8901
|
+
|
|
8902
|
+
// src/combobox-filter.ts
|
|
8903
|
+
var COMBOBOX_MAX_SHOWN = 50;
|
|
8904
|
+
var COMBOBOX_DEBOUNCE_MS = 200;
|
|
8905
|
+
var defaultComboboxFilter = (o, q) => {
|
|
8885
8906
|
const needle = q.trim().toLowerCase();
|
|
8886
8907
|
if (!needle) return true;
|
|
8887
8908
|
return o.label.toLowerCase().includes(needle) || (o.hint?.toLowerCase().includes(needle) ?? false);
|
|
8888
8909
|
};
|
|
8910
|
+
|
|
8911
|
+
// src/components/combobox.tsx
|
|
8912
|
+
import { jsx as jsx25, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8913
|
+
var MAX_SHOWN = COMBOBOX_MAX_SHOWN;
|
|
8914
|
+
var DEBOUNCE_MS = COMBOBOX_DEBOUNCE_MS;
|
|
8915
|
+
var defaultFilter = defaultComboboxFilter;
|
|
8889
8916
|
function Combobox({
|
|
8890
8917
|
options,
|
|
8891
8918
|
value,
|