@asanchez-sa/abby 0.3.0 → 0.4.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/components/badge/badge.d.ts +3 -2
- package/dist/components/badge/badge.js +27 -11
- package/dist/components/calendar/calendar.d.ts +26 -5
- package/dist/components/calendar/calendar.js +387 -72
- package/dist/components/chart/chart.d.ts +76 -0
- package/dist/components/chart/chart.js +565 -0
- package/dist/components/chart/parts/axes.js +126 -0
- package/dist/components/chart/parts/frame.d.ts +31 -0
- package/dist/components/chart/parts/frame.js +278 -0
- package/dist/components/chart/parts/legend.d.ts +16 -0
- package/dist/components/chart/parts/legend.js +82 -0
- package/dist/components/chart/parts/points.d.ts +1 -0
- package/dist/components/chart/parts/points.js +139 -0
- package/dist/components/chart/parts/scale.js +139 -0
- package/dist/components/chart/parts/table.js +105 -0
- package/dist/components/chart/parts/types.d.ts +44 -0
- package/dist/components/chart/parts/types.js +8 -0
- package/dist/components/filter-chip/filter-chip.d.ts +36 -0
- package/dist/components/filter-chip/filter-chip.js +97 -0
- package/dist/components/graph/graph.d.ts +151 -0
- package/dist/components/graph/graph.js +959 -0
- package/dist/components/model-selector/model-selector.d.ts +38 -3
- package/dist/components/model-selector/model-selector.js +331 -73
- package/dist/components/number-input/number-input.d.ts +14 -3
- package/dist/components/number-input/number-input.js +193 -34
- package/dist/components/spinner/spinner.d.ts +7 -1
- package/dist/components/spinner/spinner.js +86 -26
- package/dist/components/toast/toast.d.ts +19 -2
- package/dist/components/toast/toast.js +211 -49
- package/dist/components/toggle/toggle.d.ts +18 -4
- package/dist/components/toggle/toggle.js +167 -32
- package/dist/components/week-strip/week-strip.d.ts +27 -5
- package/dist/components/week-strip/week-strip.js +288 -134
- package/package.json +4 -1
- package/skills/agent-ready-ui/SKILL.md +1 -1
- package/skills/blocks/SKILL.md +1 -1
- package/skills/compose-screens/SKILL.md +47 -5
- package/skills/compose-screens/references/calendar-week.md +77 -0
- package/skills/compose-screens/references/charts-and-maps.md +183 -0
- package/skills/compose-screens/references/filter-chips.md +61 -0
- package/skills/compose-screens/references/number-units.md +52 -0
- package/skills/note-editor/SKILL.md +1 -1
- package/skills/note-status/SKILL.md +1 -1
- package/skills/setup/SKILL.md +1 -1
- package/skills/theming/SKILL.md +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { mergeProps } from "../../core/ui-sdk.js";
|
|
3
|
+
import "../../core/index.js";
|
|
2
4
|
import { cn, cnState } from "../../utilities/cn/index.js";
|
|
3
5
|
import { buttonLook } from "../button/button.js";
|
|
4
6
|
import { Icon } from "../icon/icon.js";
|
|
5
7
|
import { c } from "react/compiler-runtime";
|
|
8
|
+
import { createContext, use, useState } from "react";
|
|
6
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
10
|
import { Alert02Icon, Cancel01Icon, CheckmarkCircle02Icon, InformationCircleIcon, Loading03Icon, MultiplicationSignCircleIcon } from "@hugeicons/core-free-icons";
|
|
8
11
|
import { Toast as Toast$1, ToastAction as ToastAction$1, ToastClose as ToastClose$1, ToastDescription as ToastDescription$1, ToastRegion as ToastRegion$1, ToastTitle as ToastTitle$1, createToaster, toast } from "@ui-sdk/react/toast";
|
|
@@ -33,58 +36,104 @@ function defaultToast(item) {
|
|
|
33
36
|
/* @__PURE__ */ jsx(ToastAction, {})
|
|
34
37
|
] });
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
39
|
+
const ToastScope = createContext(null);
|
|
40
|
+
function watchRegion() {
|
|
41
|
+
const reasons = /* @__PURE__ */ new Set();
|
|
42
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
43
|
+
const stopped = /* @__PURE__ */ new Map();
|
|
44
|
+
const hold = (reason, on) => {
|
|
45
|
+
if (on === reasons.has(reason)) return;
|
|
46
|
+
if (on) reasons.add(reason);
|
|
47
|
+
else reasons.delete(reason);
|
|
48
|
+
listeners.forEach((listener) => listener());
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
paused: () => reasons.size > 0,
|
|
52
|
+
subscribe(listener) {
|
|
53
|
+
listeners.add(listener);
|
|
54
|
+
return () => void listeners.delete(listener);
|
|
55
|
+
},
|
|
56
|
+
/** Keeps where a bar stopped while its toast is still in the queue. */
|
|
57
|
+
stop(key, time, toaster) {
|
|
58
|
+
const queued = new Set(toaster.toasts().map((toast) => `${toast.id}:${toast.version}`));
|
|
59
|
+
for (const old of stopped.keys()) if (!queued.has(old)) stopped.delete(old);
|
|
60
|
+
if (queued.has(key)) stopped.set(key, time);
|
|
61
|
+
},
|
|
62
|
+
/** Where the bar of a toast that shows again goes on from. */
|
|
63
|
+
resume(key) {
|
|
64
|
+
const time = stopped.get(key);
|
|
65
|
+
stopped.delete(key);
|
|
66
|
+
return time;
|
|
67
|
+
},
|
|
68
|
+
/** The region element's ref: listens while it's on the page. */
|
|
69
|
+
attach: (region) => {
|
|
70
|
+
const doc = region.ownerDocument;
|
|
71
|
+
const view = doc.defaultView ?? window;
|
|
72
|
+
const offs = [];
|
|
73
|
+
const listen = (target, type, handler) => {
|
|
74
|
+
target.addEventListener(type, handler);
|
|
75
|
+
offs.push(() => target.removeEventListener(type, handler));
|
|
76
|
+
};
|
|
77
|
+
listen(region, "pointerenter", (e) => {
|
|
78
|
+
if (e.pointerType !== "touch") hold("item-hover", true);
|
|
79
|
+
});
|
|
80
|
+
listen(region, "pointerleave", (e) => {
|
|
81
|
+
if (e.pointerType !== "touch") hold("item-hover", false);
|
|
82
|
+
});
|
|
83
|
+
listen(region, "focusin", () => hold("focus-in", true));
|
|
84
|
+
listen(region, "focusout", (e) => {
|
|
85
|
+
const to = e.relatedTarget;
|
|
86
|
+
if (to) {
|
|
87
|
+
if (!region.contains(to)) hold("focus-in", false);
|
|
88
|
+
} else queueMicrotask(() => {
|
|
89
|
+
if (!doc.hasFocus() || !region.contains(doc.activeElement)) hold("focus-in", false);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
listen(view, "blur", () => setTimeout(() => doc.activeElement?.tagName !== "IFRAME" && hold("window-blur", true)));
|
|
93
|
+
listen(view, "focus", () => hold("window-blur", false));
|
|
94
|
+
listen(doc, "visibilitychange", () => hold("page-hide", doc.visibilityState === "hidden"));
|
|
95
|
+
hold("page-hide", doc.visibilityState === "hidden");
|
|
96
|
+
const swiping = () => hold("swipe", !!region.querySelector("[data-swiping]"));
|
|
97
|
+
const swipes = new MutationObserver(swiping);
|
|
98
|
+
swipes.observe(region, {
|
|
99
|
+
subtree: true,
|
|
100
|
+
attributeFilter: ["data-swiping"]
|
|
101
|
+
});
|
|
102
|
+
offs.push(() => swipes.disconnect());
|
|
103
|
+
swiping();
|
|
104
|
+
return () => {
|
|
105
|
+
offs.forEach((off) => off());
|
|
106
|
+
for (const reason of reasons) hold(reason, false);
|
|
107
|
+
stopped.clear();
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
function ToastRegion({ className, children = defaultToast, render, toaster = toast, ref, ...props }) {
|
|
113
|
+
const [pauses] = useState(watchRegion);
|
|
114
|
+
return /* @__PURE__ */ jsx(ToastRegion$1, {
|
|
115
|
+
ref: mergeProps({ ref: pauses.attach }, { ref }).ref,
|
|
116
|
+
toaster,
|
|
117
|
+
render: render ?? ((regionProps, state) => /* @__PURE__ */ jsx("section", {
|
|
118
|
+
...regionProps,
|
|
119
|
+
"data-agent-hidden": state.toasts.length === 0 ? "" : void 0
|
|
120
|
+
})),
|
|
121
|
+
className: cnState([
|
|
60
122
|
"fixed inset-auto m-4 h-(--toast-front-height) w-89 max-w-[calc(100vw-2rem)] overflow-visible border-0 bg-transparent p-0",
|
|
61
123
|
"data-expanded:h-[calc(var(--toast-stack-height)+(var(--toast-count)-1)*0.75rem)]",
|
|
62
124
|
"data-[side=bottom]:bottom-0 data-[side=top]:top-0",
|
|
63
125
|
"data-[align=start]:start-0 data-[align=end]:end-0 data-[align=center]:left-1/2 data-[align=center]:mx-0 data-[align=center]:-translate-x-1/2"
|
|
64
|
-
], className)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
});
|
|
76
|
-
$[7] = children;
|
|
77
|
-
$[8] = props;
|
|
78
|
-
$[9] = t2;
|
|
79
|
-
$[10] = t3;
|
|
80
|
-
$[11] = t4;
|
|
81
|
-
} else t4 = $[11];
|
|
82
|
-
return t4;
|
|
83
|
-
}
|
|
84
|
-
function _temp(regionProps, state) {
|
|
85
|
-
return /* @__PURE__ */ jsx("section", {
|
|
86
|
-
...regionProps,
|
|
87
|
-
"data-agent-hidden": state.toasts.length === 0 ? "" : void 0
|
|
126
|
+
], className),
|
|
127
|
+
...props,
|
|
128
|
+
children: (item, entry) => /* @__PURE__ */ jsx(ToastScope, {
|
|
129
|
+
value: {
|
|
130
|
+
item,
|
|
131
|
+
entry,
|
|
132
|
+
pauses,
|
|
133
|
+
toaster
|
|
134
|
+
},
|
|
135
|
+
children: children(item, entry)
|
|
136
|
+
})
|
|
88
137
|
});
|
|
89
138
|
}
|
|
90
139
|
function Toast(t0) {
|
|
@@ -282,4 +331,117 @@ function ToastClose(t0) {
|
|
|
282
331
|
} else t3 = $[17];
|
|
283
332
|
return t3;
|
|
284
333
|
}
|
|
285
|
-
|
|
334
|
+
/**
|
|
335
|
+
* A thin bar on the toast's bottom edge that empties over the toast's
|
|
336
|
+
* `duration`, so a person sees how long an Undo is left. Compose it inside
|
|
337
|
+
* `Toast`, in the children of `ToastRegion`. It draws nothing for a toast that
|
|
338
|
+
* never closes (`duration: Infinity`) or is `loading`, and it stays full under
|
|
339
|
+
* reduced motion.
|
|
340
|
+
*
|
|
341
|
+
* It follows ui-sdk's timer: it pauses while the pointer (not a touch) or
|
|
342
|
+
* focus is in the region, a toast is swiped, the page is hidden, the window
|
|
343
|
+
* is inactive or the toast's action is pending; an update starts it over, and
|
|
344
|
+
* a toast hidden past `maxVisible` goes on where it stopped. Two pauses leave
|
|
345
|
+
* no trace a part can read, so the bar doesn't follow them: an `onDismiss`
|
|
346
|
+
* that cancels the timeout keeps the toast and starts ui-sdk's timer over
|
|
347
|
+
* while the bar stays empty, and a `pause()` an agent calls on the region
|
|
348
|
+
* holds the toast while the bar runs on.
|
|
349
|
+
*/
|
|
350
|
+
function ToastProgress(t0) {
|
|
351
|
+
const $ = c(19);
|
|
352
|
+
let className;
|
|
353
|
+
let props;
|
|
354
|
+
if ($[0] !== t0) {
|
|
355
|
+
({className, ...props} = t0);
|
|
356
|
+
$[0] = t0;
|
|
357
|
+
$[1] = className;
|
|
358
|
+
$[2] = props;
|
|
359
|
+
} else {
|
|
360
|
+
className = $[1];
|
|
361
|
+
props = $[2];
|
|
362
|
+
}
|
|
363
|
+
const scope = use(ToastScope);
|
|
364
|
+
if (!scope) return null;
|
|
365
|
+
const { item, entry, pauses, toaster } = scope;
|
|
366
|
+
if (!Number.isFinite(item.duration) || item.type === "loading") return null;
|
|
367
|
+
const { duration, id, version } = item;
|
|
368
|
+
const leaving = entry.leaving;
|
|
369
|
+
let t1;
|
|
370
|
+
if ($[3] !== className) {
|
|
371
|
+
t1 = cn("pointer-events-none absolute inset-x-0 bottom-0 h-0.5 bg-secondary", className);
|
|
372
|
+
$[3] = className;
|
|
373
|
+
$[4] = t1;
|
|
374
|
+
} else t1 = $[4];
|
|
375
|
+
const t2 = leaving ? "" : void 0;
|
|
376
|
+
let t3;
|
|
377
|
+
if ($[5] !== duration || $[6] !== id || $[7] !== pauses || $[8] !== toaster || $[9] !== version) {
|
|
378
|
+
t3 = (fill) => fill ? countDown(fill, duration, `${id}:${version}`, pauses, toaster) : void 0;
|
|
379
|
+
$[5] = duration;
|
|
380
|
+
$[6] = id;
|
|
381
|
+
$[7] = pauses;
|
|
382
|
+
$[8] = toaster;
|
|
383
|
+
$[9] = version;
|
|
384
|
+
$[10] = t3;
|
|
385
|
+
} else t3 = $[10];
|
|
386
|
+
let t4;
|
|
387
|
+
if ($[11] !== t2 || $[12] !== t3 || $[13] !== version) {
|
|
388
|
+
t4 = /* @__PURE__ */ jsx("div", {
|
|
389
|
+
"data-slot": "toast-progress-fill",
|
|
390
|
+
"data-leaving": t2,
|
|
391
|
+
className: "h-full origin-left bg-primary rtl:origin-right",
|
|
392
|
+
ref: t3
|
|
393
|
+
}, version);
|
|
394
|
+
$[11] = t2;
|
|
395
|
+
$[12] = t3;
|
|
396
|
+
$[13] = version;
|
|
397
|
+
$[14] = t4;
|
|
398
|
+
} else t4 = $[14];
|
|
399
|
+
let t5;
|
|
400
|
+
if ($[15] !== props || $[16] !== t1 || $[17] !== t4) {
|
|
401
|
+
t5 = /* @__PURE__ */ jsx("div", {
|
|
402
|
+
"aria-hidden": "true",
|
|
403
|
+
"data-slot": "toast-progress",
|
|
404
|
+
className: t1,
|
|
405
|
+
...props,
|
|
406
|
+
children: t4
|
|
407
|
+
});
|
|
408
|
+
$[15] = props;
|
|
409
|
+
$[16] = t1;
|
|
410
|
+
$[17] = t4;
|
|
411
|
+
$[18] = t5;
|
|
412
|
+
} else t5 = $[18];
|
|
413
|
+
return t5;
|
|
414
|
+
}
|
|
415
|
+
function countDown(fill, duration, key, pauses, toaster) {
|
|
416
|
+
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
417
|
+
const animation = fill.animate([{ scale: "1 1" }, { scale: "0 1" }], {
|
|
418
|
+
duration,
|
|
419
|
+
easing: "linear",
|
|
420
|
+
fill: "forwards"
|
|
421
|
+
});
|
|
422
|
+
const resumed = pauses.resume(key);
|
|
423
|
+
if (resumed !== void 0) animation.currentTime = resumed;
|
|
424
|
+
const root = fill.closest("[data-slot=\"toast\"]");
|
|
425
|
+
const held = () => !!root?.querySelector("[data-slot=\"toast-action\"][data-pending], [data-slot=\"toast-close\"][data-pending]");
|
|
426
|
+
const hidden = () => fill.hasAttribute("data-leaving") && toaster.toasts().some((toast) => `${toast.id}:${toast.version}` === key);
|
|
427
|
+
const sync = () => {
|
|
428
|
+
if (animation.playState === "finished") return;
|
|
429
|
+
if (pauses.paused() || held() || hidden()) animation.pause();
|
|
430
|
+
else if (animation.playState === "paused") animation.play();
|
|
431
|
+
};
|
|
432
|
+
const watcher = new MutationObserver(sync);
|
|
433
|
+
if (root) watcher.observe(root, {
|
|
434
|
+
subtree: true,
|
|
435
|
+
attributeFilter: ["data-pending"]
|
|
436
|
+
});
|
|
437
|
+
watcher.observe(fill, { attributeFilter: ["data-leaving"] });
|
|
438
|
+
const unsubscribe = pauses.subscribe(sync);
|
|
439
|
+
sync();
|
|
440
|
+
return () => {
|
|
441
|
+
unsubscribe();
|
|
442
|
+
watcher.disconnect();
|
|
443
|
+
if (hidden() && animation.playState === "paused") pauses.stop(key, Number(animation.currentTime ?? 0), toaster);
|
|
444
|
+
animation.cancel();
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
export { Toast, ToastAction, ToastClose, ToastDescription, ToastProgress, ToastRegion, ToastTitle, createToaster, toast };
|
|
@@ -2,14 +2,28 @@ import { VariantProps } from "../../utilities/cn/index.js";
|
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
3
|
import { Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, ToggleIcon as ToggleIcon$1, createToggleController, createToggleGroupController } from "@ui-sdk/react/toggle";
|
|
4
4
|
declare const toggleVariants: (props?: ({
|
|
5
|
-
variant?: "default" | "outline" | null | undefined;
|
|
5
|
+
variant?: "chip" | "default" | "outline" | null | undefined;
|
|
6
6
|
size?: "default" | "lg" | "sm" | "xs" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
8
|
type ToggleProps = ComponentProps<typeof Toggle$1> & VariantProps<typeof toggleVariants>;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/**
|
|
10
|
+
* A toggle with only an icon needs an `aria-label`. `variant="chip"` is one
|
|
11
|
+
* choice in a row of filters: use `size="sm"` (28px) and a `ToggleGroup` with
|
|
12
|
+
* `deselectable={false}` so one always stays chosen.
|
|
13
|
+
*/
|
|
14
|
+
declare function Toggle({ variant, size, className, "aria-describedby": describedBy, ...props }: ToggleProps): import("react").JSX.Element;
|
|
15
|
+
type ToggleCountProps = Omit<ComponentProps<"span">, "children"> & {
|
|
16
|
+
/** The number, or text, shown after the name. */
|
|
17
|
+
children: string | number;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* What a chip holds, after its name ("Payments 142"): small, in `subtle` and
|
|
21
|
+
* with tabular figures. It is `aria-hidden` and its text is the chip's
|
|
22
|
+
* description, so the chip's name stays its own.
|
|
23
|
+
*/
|
|
24
|
+
declare function ToggleCount({ className, children, ...props }: ToggleCountProps): import("react").JSX.Element;
|
|
11
25
|
declare function ToggleIcon({ className, ...props }: ComponentProps<typeof ToggleIcon$1>): import("react").JSX.Element;
|
|
12
26
|
type ToggleGroupProps<T extends string = string> = Parameters<typeof ToggleGroup$1<T>>[0];
|
|
13
27
|
/** Name it with `aria-label`, and give each toggle a `value`. */
|
|
14
28
|
declare function ToggleGroup<T extends string = string>({ className, ...props }: ToggleGroupProps<T>): import("react").JSX.Element;
|
|
15
|
-
export { Toggle, ToggleGroup, type ToggleGroupProps, ToggleIcon, type ToggleProps, createToggleController, createToggleGroupController, toggleVariants };
|
|
29
|
+
export { Toggle, ToggleCount, type ToggleCountProps, ToggleGroup, type ToggleGroupProps, ToggleIcon, type ToggleProps, createToggleController, createToggleGroupController, toggleVariants };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cnState, cva } from "../../utilities/cn/index.js";
|
|
2
|
+
import { cn, cnState, cva } from "../../utilities/cn/index.js";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { createContext, useContext, useEffect, useId, useState } from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
import { Toggle as Toggle$1, ToggleGroup as ToggleGroup$1, ToggleIcon as ToggleIcon$1, createToggleController, createToggleGroupController } from "@ui-sdk/react/toggle";
|
|
6
7
|
// src/components/toggle/toggle.tsx
|
|
7
8
|
const toggleVariants = cva("inline-flex items-center justify-center gap-1.5 rounded-full text-sm font-medium whitespace-nowrap text-foreground select-none press hover:bg-accent focus-ring data-disabled:pointer-events-none data-disabled:opacity-50 data-[orientation=vertical]:justify-start data-pressed:bg-primary data-pressed:text-primary-foreground data-pressed:hover:bg-primary/85 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
|
|
8
9
|
variants: {
|
|
9
10
|
variant: {
|
|
10
11
|
default: "bg-transparent",
|
|
11
|
-
outline: "border border-input bg-background data-pressed:border-primary"
|
|
12
|
+
outline: "border border-input bg-background data-pressed:border-primary",
|
|
13
|
+
chip: "group/toggle border border-transparent bg-transparent font-normal text-muted-foreground data-pressed:border-input data-pressed:bg-background data-pressed:font-semibold data-pressed:text-foreground data-pressed:hover:bg-background"
|
|
12
14
|
},
|
|
13
15
|
size: {
|
|
14
16
|
xs: "h-6 min-w-6 gap-1 px-1 text-xs",
|
|
@@ -17,59 +19,192 @@ const toggleVariants = cva("inline-flex items-center justify-center gap-1.5 roun
|
|
|
17
19
|
lg: "h-11 min-w-11 px-3.5 text-base"
|
|
18
20
|
}
|
|
19
21
|
},
|
|
22
|
+
compoundVariants: [{
|
|
23
|
+
variant: "chip",
|
|
24
|
+
size: "sm",
|
|
25
|
+
className: "gap-1.5 px-3"
|
|
26
|
+
}],
|
|
20
27
|
defaultVariants: {
|
|
21
28
|
variant: "default",
|
|
22
29
|
size: "default"
|
|
23
30
|
}
|
|
24
31
|
});
|
|
25
|
-
|
|
32
|
+
const CountContext = createContext(null);
|
|
33
|
+
/**
|
|
34
|
+
* A toggle with only an icon needs an `aria-label`. `variant="chip"` is one
|
|
35
|
+
* choice in a row of filters: use `size="sm"` (28px) and a `ToggleGroup` with
|
|
36
|
+
* `deselectable={false}` so one always stays chosen.
|
|
37
|
+
*/
|
|
26
38
|
function Toggle(t0) {
|
|
27
|
-
const $ = c(
|
|
39
|
+
const $ = c(26);
|
|
28
40
|
let className;
|
|
41
|
+
let describedBy;
|
|
29
42
|
let props;
|
|
30
43
|
let size;
|
|
31
44
|
let variant;
|
|
32
45
|
if ($[0] !== t0) {
|
|
33
|
-
({variant, size, className, ...props} = t0);
|
|
46
|
+
({variant, size, className, "aria-describedby": describedBy, ...props} = t0);
|
|
34
47
|
$[0] = t0;
|
|
35
48
|
$[1] = className;
|
|
36
|
-
$[2] =
|
|
37
|
-
$[3] =
|
|
38
|
-
$[4] =
|
|
49
|
+
$[2] = describedBy;
|
|
50
|
+
$[3] = props;
|
|
51
|
+
$[4] = size;
|
|
52
|
+
$[5] = variant;
|
|
39
53
|
} else {
|
|
40
54
|
className = $[1];
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
55
|
+
describedBy = $[2];
|
|
56
|
+
props = $[3];
|
|
57
|
+
size = $[4];
|
|
58
|
+
variant = $[5];
|
|
44
59
|
}
|
|
45
|
-
const
|
|
46
|
-
const
|
|
60
|
+
const id = useId();
|
|
61
|
+
const [counted, setCounted] = useState(false);
|
|
62
|
+
let t1;
|
|
63
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t1 = () => (on) => setCounted(on);
|
|
65
|
+
$[6] = t1;
|
|
66
|
+
} else t1 = $[6];
|
|
67
|
+
const [describe] = useState(t1);
|
|
68
|
+
const t2 = counted ? `${id}-count` : void 0;
|
|
47
69
|
let t3;
|
|
48
|
-
if ($[
|
|
49
|
-
t3 =
|
|
70
|
+
if ($[7] !== describedBy || $[8] !== t2) {
|
|
71
|
+
t3 = [describedBy, t2].filter(Boolean);
|
|
72
|
+
$[7] = describedBy;
|
|
73
|
+
$[8] = t2;
|
|
74
|
+
$[9] = t3;
|
|
75
|
+
} else t3 = $[9];
|
|
76
|
+
const description = t3.join(" ");
|
|
77
|
+
let t4;
|
|
78
|
+
if ($[10] !== describe || $[11] !== id) {
|
|
79
|
+
t4 = {
|
|
80
|
+
id,
|
|
81
|
+
describe
|
|
82
|
+
};
|
|
83
|
+
$[10] = describe;
|
|
84
|
+
$[11] = id;
|
|
85
|
+
$[12] = t4;
|
|
86
|
+
} else t4 = $[12];
|
|
87
|
+
const t5 = variant ?? "default";
|
|
88
|
+
const t6 = size ?? "default";
|
|
89
|
+
const t7 = description || void 0;
|
|
90
|
+
let t8;
|
|
91
|
+
if ($[13] !== className || $[14] !== size || $[15] !== variant) {
|
|
92
|
+
t8 = cnState(toggleVariants({
|
|
50
93
|
variant,
|
|
51
94
|
size
|
|
52
95
|
}), className);
|
|
53
|
-
$[
|
|
54
|
-
$[
|
|
55
|
-
$[
|
|
96
|
+
$[13] = className;
|
|
97
|
+
$[14] = size;
|
|
98
|
+
$[15] = variant;
|
|
99
|
+
$[16] = t8;
|
|
100
|
+
} else t8 = $[16];
|
|
101
|
+
let t9;
|
|
102
|
+
if ($[17] !== props || $[18] !== t5 || $[19] !== t6 || $[20] !== t7 || $[21] !== t8) {
|
|
103
|
+
t9 = /* @__PURE__ */ jsx(Toggle$1, {
|
|
104
|
+
"data-variant": t5,
|
|
105
|
+
"data-size": t6,
|
|
106
|
+
"aria-describedby": t7,
|
|
107
|
+
className: t8,
|
|
108
|
+
...props
|
|
109
|
+
});
|
|
110
|
+
$[17] = props;
|
|
111
|
+
$[18] = t5;
|
|
112
|
+
$[19] = t6;
|
|
113
|
+
$[20] = t7;
|
|
114
|
+
$[21] = t8;
|
|
115
|
+
$[22] = t9;
|
|
116
|
+
} else t9 = $[22];
|
|
117
|
+
let t10;
|
|
118
|
+
if ($[23] !== t4 || $[24] !== t9) {
|
|
119
|
+
t10 = /* @__PURE__ */ jsx(CountContext.Provider, {
|
|
120
|
+
value: t4,
|
|
121
|
+
children: t9
|
|
122
|
+
});
|
|
123
|
+
$[23] = t4;
|
|
124
|
+
$[24] = t9;
|
|
125
|
+
$[25] = t10;
|
|
126
|
+
} else t10 = $[25];
|
|
127
|
+
return t10;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* What a chip holds, after its name ("Payments 142"): small, in `subtle` and
|
|
131
|
+
* with tabular figures. It is `aria-hidden` and its text is the chip's
|
|
132
|
+
* description, so the chip's name stays its own.
|
|
133
|
+
*/
|
|
134
|
+
function ToggleCount(t0) {
|
|
135
|
+
const $ = c(19);
|
|
136
|
+
let children;
|
|
137
|
+
let className;
|
|
138
|
+
let props;
|
|
139
|
+
if ($[0] !== t0) {
|
|
140
|
+
({className, children, ...props} = t0);
|
|
141
|
+
$[0] = t0;
|
|
142
|
+
$[1] = children;
|
|
143
|
+
$[2] = className;
|
|
144
|
+
$[3] = props;
|
|
145
|
+
} else {
|
|
146
|
+
children = $[1];
|
|
147
|
+
className = $[2];
|
|
148
|
+
props = $[3];
|
|
149
|
+
}
|
|
150
|
+
const scope = useContext(CountContext);
|
|
151
|
+
const describe = scope?.describe;
|
|
152
|
+
let t1;
|
|
153
|
+
let t2;
|
|
154
|
+
if ($[4] !== describe) {
|
|
155
|
+
t1 = () => {
|
|
156
|
+
describe?.(true);
|
|
157
|
+
return () => describe?.(false);
|
|
158
|
+
};
|
|
159
|
+
t2 = [describe];
|
|
160
|
+
$[4] = describe;
|
|
161
|
+
$[5] = t1;
|
|
162
|
+
$[6] = t2;
|
|
163
|
+
} else {
|
|
164
|
+
t1 = $[5];
|
|
165
|
+
t2 = $[6];
|
|
166
|
+
}
|
|
167
|
+
useEffect(t1, t2);
|
|
168
|
+
let t3;
|
|
169
|
+
if ($[7] !== className) {
|
|
170
|
+
t3 = cn("text-supporting text-subtle tabular-nums group-data-pressed/toggle:text-muted-foreground", className);
|
|
171
|
+
$[7] = className;
|
|
56
172
|
$[8] = t3;
|
|
57
173
|
} else t3 = $[8];
|
|
58
174
|
let t4;
|
|
59
|
-
if ($[9] !==
|
|
60
|
-
t4 = /* @__PURE__ */ jsx(
|
|
61
|
-
"data-
|
|
62
|
-
"
|
|
175
|
+
if ($[9] !== children || $[10] !== props || $[11] !== t3) {
|
|
176
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
177
|
+
"data-slot": "toggle-count",
|
|
178
|
+
"aria-hidden": "true",
|
|
63
179
|
className: t3,
|
|
64
|
-
...props
|
|
180
|
+
...props,
|
|
181
|
+
children
|
|
65
182
|
});
|
|
66
|
-
$[9] =
|
|
67
|
-
$[10] =
|
|
68
|
-
$[11] =
|
|
69
|
-
$[12] =
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
183
|
+
$[9] = children;
|
|
184
|
+
$[10] = props;
|
|
185
|
+
$[11] = t3;
|
|
186
|
+
$[12] = t4;
|
|
187
|
+
} else t4 = $[12];
|
|
188
|
+
let t5;
|
|
189
|
+
if ($[13] !== children || $[14] !== scope) {
|
|
190
|
+
t5 = scope ? /* @__PURE__ */ jsx("span", {
|
|
191
|
+
id: `${scope.id}-count`,
|
|
192
|
+
hidden: true,
|
|
193
|
+
"aria-hidden": "true",
|
|
194
|
+
children
|
|
195
|
+
}) : null;
|
|
196
|
+
$[13] = children;
|
|
197
|
+
$[14] = scope;
|
|
198
|
+
$[15] = t5;
|
|
199
|
+
} else t5 = $[15];
|
|
200
|
+
let t6;
|
|
201
|
+
if ($[16] !== t4 || $[17] !== t5) {
|
|
202
|
+
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t4, t5] });
|
|
203
|
+
$[16] = t4;
|
|
204
|
+
$[17] = t5;
|
|
205
|
+
$[18] = t6;
|
|
206
|
+
} else t6 = $[18];
|
|
207
|
+
return t6;
|
|
73
208
|
}
|
|
74
209
|
function ToggleIcon(t0) {
|
|
75
210
|
const $ = c(8);
|
|
@@ -134,4 +269,4 @@ function ToggleGroup(t0) {
|
|
|
134
269
|
} else t2 = $[7];
|
|
135
270
|
return t2;
|
|
136
271
|
}
|
|
137
|
-
export { Toggle, ToggleGroup, ToggleIcon, createToggleController, createToggleGroupController, toggleVariants };
|
|
272
|
+
export { Toggle, ToggleCount, ToggleGroup, ToggleIcon, createToggleController, createToggleGroupController, toggleVariants };
|
|
@@ -4,7 +4,7 @@ import { ButtonLook } from "../button/button.js";
|
|
|
4
4
|
import { DateMatchers } from "../calendar/calendar.js";
|
|
5
5
|
import { ReactNode } from "react";
|
|
6
6
|
/** The colors a mark can take. A mark never says something by color alone: its label does. */
|
|
7
|
-
type WeekStripTone = "primary" | "muted" | "destructive" | "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5";
|
|
7
|
+
type WeekStripTone = "primary" | "muted" | "destructive" | "warning" | "success" | "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5";
|
|
8
8
|
/** What's on a day. Screen readers and agents hear `label` and `description` after the date. */
|
|
9
9
|
type WeekStripMark = {
|
|
10
10
|
/** Up to three dots under the day number. */
|
|
@@ -13,6 +13,14 @@ type WeekStripMark = {
|
|
|
13
13
|
label?: string;
|
|
14
14
|
/** A dot in the corner, for a day that needs attention. `true` is `"destructive"`. */
|
|
15
15
|
corner?: boolean | WeekStripTone;
|
|
16
|
+
/**
|
|
17
|
+
* A bar as tall as this value against the largest of the days shown, up to
|
|
18
|
+
* 44px. Zero draws none. The `label`, and the dots or the check, sit under it
|
|
19
|
+
* instead of replacing each other. Without a `label`, the value is the day's name.
|
|
20
|
+
*/
|
|
21
|
+
bar?: number;
|
|
22
|
+
/** A check in place of the dots, for a day that is closed. `true` is `"success"`. */
|
|
23
|
+
check?: boolean | WeekStripTone;
|
|
16
24
|
/** What the dots or the corner mean, read after the date and the label. */
|
|
17
25
|
description?: string;
|
|
18
26
|
};
|
|
@@ -71,6 +79,8 @@ type WeekStripOptions = {
|
|
|
71
79
|
marks?: (date: string) => WeekStripMark | undefined;
|
|
72
80
|
/** Whether nothing can be picked or focused. */
|
|
73
81
|
disabled?: boolean;
|
|
82
|
+
/** Whether no day is selected or can be: the days stay focusable and are read with their marks. */
|
|
83
|
+
readOnly?: boolean;
|
|
74
84
|
/** Drives the strip from anywhere. Create one with `createWeekStripController()`. */
|
|
75
85
|
controller?: WeekStripController;
|
|
76
86
|
};
|
|
@@ -79,6 +89,7 @@ type WeekStripRootState = {
|
|
|
79
89
|
days: string[];
|
|
80
90
|
scroll: boolean;
|
|
81
91
|
disabled: boolean;
|
|
92
|
+
readOnly: boolean;
|
|
82
93
|
};
|
|
83
94
|
type WeekStripHeadingState = {
|
|
84
95
|
/** The month or months shown, like "November 2026". */
|
|
@@ -92,6 +103,7 @@ type WeekStripDaysState = {
|
|
|
92
103
|
/** The days shown, as ISO dates. */
|
|
93
104
|
days: string[];
|
|
94
105
|
scroll: boolean;
|
|
106
|
+
readOnly: boolean;
|
|
95
107
|
};
|
|
96
108
|
type WeekStripDayState = {
|
|
97
109
|
date: string;
|
|
@@ -109,8 +121,17 @@ type WeekStripDayState = {
|
|
|
109
121
|
disabled: boolean;
|
|
110
122
|
faded: boolean;
|
|
111
123
|
scroll: boolean;
|
|
124
|
+
readOnly: boolean;
|
|
112
125
|
marks: WeekStripMark | undefined;
|
|
126
|
+
/** The largest `bar` among the days shown, which the tallest bar is measured against. */
|
|
127
|
+
barMax: number;
|
|
113
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* A bar's height in px: its share of the largest value, up to 44. The largest
|
|
131
|
+
* one is 44 and a value of zero is 0; any other value keeps at least 2px so it
|
|
132
|
+
* can be seen.
|
|
133
|
+
*/
|
|
134
|
+
declare function weekStripBarHeight(value: number | undefined, max: number): number;
|
|
114
135
|
/** Drives a week strip from anywhere: pass it as `controller`. */
|
|
115
136
|
declare function createWeekStripController(): WeekStripController;
|
|
116
137
|
/**
|
|
@@ -142,7 +163,7 @@ type WeekStripProps = WeekStripOptions & Omit<PartProps<"div", WeekStripRootStat
|
|
|
142
163
|
size?: WeekStripSize;
|
|
143
164
|
};
|
|
144
165
|
/** Without children it renders Previous, the heading, Next and the days; in scroll mode, only the days. */
|
|
145
|
-
declare function WeekStrip({ value, defaultValue, onValueChange, week, defaultWeek, onWeekChange, scroll, start, length, weekStartsOn, locale, timeZone, today, unavailable, faded, marks, disabled, controller, label, size, className, children, ...props }: WeekStripProps): import("react").JSX.Element | null;
|
|
166
|
+
declare function WeekStrip({ value, defaultValue, onValueChange, week, defaultWeek, onWeekChange, scroll, start, length, weekStartsOn, locale, timeZone, today, unavailable, faded, marks, disabled, readOnly, controller, label, size, className, children, ...props }: WeekStripProps): import("react").JSX.Element | null;
|
|
146
167
|
/** The month or months shown, like "November 2026". Children replace the text. */
|
|
147
168
|
declare function WeekStripHeading({ className, children, ...props }: PartProps<"h2", WeekStripHeadingState>): import("react").JSX.Element | null;
|
|
148
169
|
type WeekStripStepProps = PartProps<"button", WeekStripStepState> & ButtonLook & {
|
|
@@ -169,9 +190,10 @@ type WeekStripMarksProps = {
|
|
|
169
190
|
className?: string;
|
|
170
191
|
};
|
|
171
192
|
/**
|
|
172
|
-
* A day's marks: its label, else up to three dots, and its corner
|
|
173
|
-
*
|
|
193
|
+
* A day's marks: its label, else up to three dots or a check, and its corner
|
|
194
|
+
* dot. With a `bar` the label and the dots or the check sit side by side under
|
|
195
|
+
* it. It keeps its height without marks, so every day lines up. Decorative: the
|
|
174
196
|
* day's name carries what they mean.
|
|
175
197
|
*/
|
|
176
198
|
declare function WeekStripMarks({ marks, className }: WeekStripMarksProps): import("react").JSX.Element;
|
|
177
|
-
export { WeekStrip, type WeekStripController, WeekStripDay, type WeekStripDayProps, type WeekStripDayState, WeekStripDays, type WeekStripDaysState, WeekStripHeading, type WeekStripHeadingState, type WeekStripMark, WeekStripMarks, type WeekStripMarksProps, WeekStripNext, type WeekStripOptions, WeekStripPrevious, type WeekStripProps, type WeekStripRootState, type WeekStripSize, type WeekStripStepProps, type WeekStripStepState, type WeekStripTone, type WeekStripValueChangeReason, type WeekStripWeekChangeReason, createWeekStripController, useWeekStrip, weekStripLayout, weekStripParts };
|
|
199
|
+
export { WeekStrip, type WeekStripController, WeekStripDay, type WeekStripDayProps, type WeekStripDayState, WeekStripDays, type WeekStripDaysState, WeekStripHeading, type WeekStripHeadingState, type WeekStripMark, WeekStripMarks, type WeekStripMarksProps, WeekStripNext, type WeekStripOptions, WeekStripPrevious, type WeekStripProps, type WeekStripRootState, type WeekStripSize, type WeekStripStepProps, type WeekStripStepState, type WeekStripTone, type WeekStripValueChangeReason, type WeekStripWeekChangeReason, createWeekStripController, useWeekStrip, weekStripBarHeight, weekStripLayout, weekStripParts };
|