@asanchez-sa/abby 0.3.0 → 0.5.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 +7 -0
- package/dist/components/chart/chart.js +7 -0
- package/dist/components/chart/parts/bar.d.ts +32 -0
- package/dist/components/chart/parts/bar.js +348 -0
- package/dist/components/chart/parts/categories.d.ts +32 -0
- package/dist/components/chart/parts/categories.js +212 -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/line.d.ts +43 -0
- package/dist/components/chart/parts/line.js +266 -0
- package/dist/components/chart/parts/scale.js +96 -0
- package/dist/components/chart/parts/scatter.d.ts +67 -0
- package/dist/components/chart/parts/scatter.js +157 -0
- package/dist/components/chart/parts/surface.d.ts +26 -0
- package/dist/components/chart/parts/surface.js +76 -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 +12 -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/dist/styles/components.css +66 -0
- package/package.json +5 -1
- package/skills/agent-ready-ui/SKILL.md +1 -1
- package/skills/blocks/SKILL.md +1 -1
- package/skills/compose-screens/SKILL.md +48 -5
- package/skills/compose-screens/references/calendar-week.md +77 -0
- package/skills/compose-screens/references/charts-and-maps.md +298 -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
|
@@ -7,11 +7,11 @@ import "../../core/index.js";
|
|
|
7
7
|
import { cn, cnState, cva } from "../../utilities/cn/index.js";
|
|
8
8
|
import "../../utilities/date/index.js";
|
|
9
9
|
import "../../utilities/platform/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { addDays, firstDayOfWeek, formatDate, formatDateRange, isISODate, startOfWeek, todayDate, weekday } from "../../utilities/date/ui-sdk.js";
|
|
11
11
|
import "../../utilities/text/index.js";
|
|
12
|
-
import {
|
|
12
|
+
import { createTypeahead, isTypeaheadKey, pageLocale } from "../../utilities/text/ui-sdk.js";
|
|
13
13
|
import { buttonLook } from "../button/button.js";
|
|
14
|
-
import {
|
|
14
|
+
import { announce } from "../../utilities/platform/ui-sdk.js";
|
|
15
15
|
import { Icon } from "../icon/icon.js";
|
|
16
16
|
import { c } from "react/compiler-runtime";
|
|
17
17
|
import { createContext, use } from "react";
|
|
@@ -47,9 +47,10 @@ function stopOf(state) {
|
|
|
47
47
|
return days.find((day) => !matches(day, state.unavailable)) ?? days[0];
|
|
48
48
|
}
|
|
49
49
|
function nameOf(state, date, mark) {
|
|
50
|
+
const label = mark?.label ?? (mark?.bar === void 0 ? void 0 : String(mark.bar));
|
|
50
51
|
return [
|
|
51
52
|
formatDate(date, localeOf(state)),
|
|
52
|
-
|
|
53
|
+
label,
|
|
53
54
|
mark?.description
|
|
54
55
|
].filter(Boolean).join(", ");
|
|
55
56
|
}
|
|
@@ -68,6 +69,21 @@ function monthsOf(state) {
|
|
|
68
69
|
year: "numeric"
|
|
69
70
|
});
|
|
70
71
|
}
|
|
72
|
+
/** The tallest a bar gets, in px: Paper's lane for the bars. */
|
|
73
|
+
const BAR_MAX_HEIGHT = 44;
|
|
74
|
+
/** What counts as a bar's value: a finite number above zero. */
|
|
75
|
+
const barValue = (bar) => typeof bar === "number" && Number.isFinite(bar) && bar > 0 ? bar : 0;
|
|
76
|
+
/**
|
|
77
|
+
* A bar's height in px: its share of the largest value, up to 44. The largest
|
|
78
|
+
* one is 44 and a value of zero is 0; any other value keeps at least 2px so it
|
|
79
|
+
* can be seen.
|
|
80
|
+
*/
|
|
81
|
+
function weekStripBarHeight(value, max) {
|
|
82
|
+
const amount = barValue(value);
|
|
83
|
+
const top = barValue(max);
|
|
84
|
+
if (amount === 0 || top === 0) return 0;
|
|
85
|
+
return Math.min(BAR_MAX_HEIGHT, Math.max(2, amount / top * BAR_MAX_HEIGHT));
|
|
86
|
+
}
|
|
71
87
|
const present = (on) => on ? "" : void 0;
|
|
72
88
|
const reducedMotion = (el) => el.ownerDocument.defaultView?.matchMedia("(prefers-reduced-motion: reduce)").matches ?? true;
|
|
73
89
|
/**
|
|
@@ -94,6 +110,7 @@ const weekStrip = definePrimitive({
|
|
|
94
110
|
faded: "value",
|
|
95
111
|
marks: "value",
|
|
96
112
|
disabled: "boolean",
|
|
113
|
+
readOnly: "boolean",
|
|
97
114
|
controller: "value"
|
|
98
115
|
},
|
|
99
116
|
controlled: ["value", "week"],
|
|
@@ -113,7 +130,8 @@ const weekStrip = definePrimitive({
|
|
|
113
130
|
unavailable: options.unavailable ?? null,
|
|
114
131
|
faded: options.faded ?? null,
|
|
115
132
|
marks: options.marks ?? null,
|
|
116
|
-
disabled: options.disabled ?? false
|
|
133
|
+
disabled: options.disabled ?? false,
|
|
134
|
+
readOnly: options.readOnly ?? false
|
|
117
135
|
};
|
|
118
136
|
},
|
|
119
137
|
sync: (options) => ({
|
|
@@ -128,7 +146,8 @@ const weekStrip = definePrimitive({
|
|
|
128
146
|
unavailable: options.unavailable ?? null,
|
|
129
147
|
faded: options.faded ?? null,
|
|
130
148
|
marks: options.marks ?? null,
|
|
131
|
-
disabled: options.disabled ?? false
|
|
149
|
+
disabled: options.disabled ?? false,
|
|
150
|
+
readOnly: options.readOnly ?? false
|
|
132
151
|
}),
|
|
133
152
|
api: (context) => {
|
|
134
153
|
const { store } = context;
|
|
@@ -146,7 +165,7 @@ const weekStrip = definePrimitive({
|
|
|
146
165
|
};
|
|
147
166
|
const pickable = (date) => {
|
|
148
167
|
const state = store.get();
|
|
149
|
-
if (state.disabled || !isISODate(date) || matches(date, state.unavailable)) return false;
|
|
168
|
+
if (state.disabled || state.readOnly || !isISODate(date) || matches(date, state.unavailable)) return false;
|
|
150
169
|
return !state.scroll || daysOf(state).includes(date);
|
|
151
170
|
};
|
|
152
171
|
const select = (date, reason, event) => {
|
|
@@ -212,7 +231,7 @@ const weekStrip = definePrimitive({
|
|
|
212
231
|
};
|
|
213
232
|
return {
|
|
214
233
|
getValue: () => store.get().value,
|
|
215
|
-
setValue: (value) => value === null ? change("value", null, { reason: "imperative" }) : select(value, "imperative"),
|
|
234
|
+
setValue: (value) => store.get().readOnly ? false : value === null ? change("value", null, { reason: "imperative" }) : select(value, "imperative"),
|
|
216
235
|
getWeek: () => firstDayOf(store.get()),
|
|
217
236
|
setWeek: (date) => showWeek(date, "imperative"),
|
|
218
237
|
previous: (event) => step(-7, "previous-press", event),
|
|
@@ -259,11 +278,13 @@ const weekStrip = definePrimitive({
|
|
|
259
278
|
value: state.value,
|
|
260
279
|
days: daysOf(state),
|
|
261
280
|
scroll: state.scroll,
|
|
262
|
-
disabled: state.disabled
|
|
281
|
+
disabled: state.disabled,
|
|
282
|
+
readOnly: state.readOnly
|
|
263
283
|
}),
|
|
264
284
|
attrs: (state) => ({
|
|
265
285
|
"data-scroll": present(state.scroll),
|
|
266
|
-
"data-disabled": present(state.disabled)
|
|
286
|
+
"data-disabled": present(state.disabled),
|
|
287
|
+
"data-readonly": present(state.readOnly)
|
|
267
288
|
}),
|
|
268
289
|
bind: (el, part) => part.api.internal.readClient(el)
|
|
269
290
|
}),
|
|
@@ -303,12 +324,14 @@ const weekStrip = definePrimitive({
|
|
|
303
324
|
],
|
|
304
325
|
state: (state) => ({
|
|
305
326
|
days: daysOf(state),
|
|
306
|
-
scroll: state.scroll
|
|
327
|
+
scroll: state.scroll,
|
|
328
|
+
readOnly: state.readOnly
|
|
307
329
|
}),
|
|
308
330
|
attrs: (state) => ({
|
|
309
331
|
"aria-label": rangeOf(state),
|
|
310
332
|
"aria-orientation": "horizontal",
|
|
311
333
|
"aria-disabled": state.disabled ? "true" : void 0,
|
|
334
|
+
"aria-readonly": state.readOnly ? "true" : void 0,
|
|
312
335
|
"data-scroll": present(state.scroll)
|
|
313
336
|
}),
|
|
314
337
|
on: { keydown: (event, { api }) => api.internal.keydown(event) },
|
|
@@ -342,25 +365,28 @@ const weekStrip = definePrimitive({
|
|
|
342
365
|
name: nameOf(state, key, marks),
|
|
343
366
|
weekday: formatDate(key, localeOf(state), { weekday: "short" }),
|
|
344
367
|
label: formatDate(key, localeOf(state), { day: "numeric" }),
|
|
345
|
-
selected: state.value === key,
|
|
368
|
+
selected: !state.readOnly && state.value === key,
|
|
346
369
|
today: state.today === key,
|
|
347
370
|
unavailable,
|
|
348
371
|
disabled: unavailable || state.disabled,
|
|
349
372
|
faded: matches(key, state.faded),
|
|
350
373
|
scroll: state.scroll,
|
|
351
|
-
|
|
374
|
+
readOnly: state.readOnly,
|
|
375
|
+
marks,
|
|
376
|
+
barMax: Math.max(0, ...daysOf(state).map((day) => barValue(state.marks?.(day)?.bar)))
|
|
352
377
|
};
|
|
353
378
|
},
|
|
354
379
|
attrs: (state, part) => {
|
|
355
380
|
const unavailable = matches(part.key, state.unavailable);
|
|
356
381
|
const disabled = unavailable || state.disabled;
|
|
357
382
|
return {
|
|
358
|
-
"aria-selected": String(state.value === part.key),
|
|
383
|
+
"aria-selected": String(!state.readOnly && state.value === part.key),
|
|
359
384
|
"aria-disabled": disabled ? "true" : void 0,
|
|
360
385
|
"aria-current": state.today === part.key ? "date" : void 0,
|
|
361
386
|
tabindex: part.api.internal.roving.tabIndex(state, part),
|
|
362
387
|
"data-value": part.key,
|
|
363
|
-
"data-selected": present(state.value === part.key),
|
|
388
|
+
"data-selected": present(!state.readOnly && state.value === part.key),
|
|
389
|
+
"data-readonly": present(state.readOnly),
|
|
364
390
|
"data-today": present(state.today === part.key),
|
|
365
391
|
"data-unavailable": present(unavailable),
|
|
366
392
|
"data-disabled": present(disabled),
|
|
@@ -467,7 +493,7 @@ function weekStripParts(scroll) {
|
|
|
467
493
|
}
|
|
468
494
|
/** Without children it renders Previous, the heading, Next and the days; in scroll mode, only the days. */
|
|
469
495
|
function WeekStrip(t0) {
|
|
470
|
-
const $ = c(
|
|
496
|
+
const $ = c(57);
|
|
471
497
|
let children;
|
|
472
498
|
let className;
|
|
473
499
|
let controller;
|
|
@@ -481,6 +507,7 @@ function WeekStrip(t0) {
|
|
|
481
507
|
let onValueChange;
|
|
482
508
|
let onWeekChange;
|
|
483
509
|
let props;
|
|
510
|
+
let readOnly;
|
|
484
511
|
let scroll;
|
|
485
512
|
let start;
|
|
486
513
|
let t1;
|
|
@@ -492,7 +519,7 @@ function WeekStrip(t0) {
|
|
|
492
519
|
let week;
|
|
493
520
|
let weekStartsOn;
|
|
494
521
|
if ($[0] !== t0) {
|
|
495
|
-
({value, defaultValue, onValueChange, week, defaultWeek, onWeekChange, scroll, start, length, weekStartsOn, locale, timeZone, today, unavailable, faded, marks, disabled, controller, label: t1, size: t2, className, children, ...props} = t0);
|
|
522
|
+
({value, defaultValue, onValueChange, week, defaultWeek, onWeekChange, scroll, start, length, weekStartsOn, locale, timeZone, today, unavailable, faded, marks, disabled, readOnly, controller, label: t1, size: t2, className, children, ...props} = t0);
|
|
496
523
|
$[0] = t0;
|
|
497
524
|
$[1] = children;
|
|
498
525
|
$[2] = className;
|
|
@@ -507,16 +534,17 @@ function WeekStrip(t0) {
|
|
|
507
534
|
$[11] = onValueChange;
|
|
508
535
|
$[12] = onWeekChange;
|
|
509
536
|
$[13] = props;
|
|
510
|
-
$[14] =
|
|
511
|
-
$[15] =
|
|
512
|
-
$[16] =
|
|
513
|
-
$[17] =
|
|
514
|
-
$[18] =
|
|
515
|
-
$[19] =
|
|
516
|
-
$[20] =
|
|
517
|
-
$[21] =
|
|
518
|
-
$[22] =
|
|
519
|
-
$[23] =
|
|
537
|
+
$[14] = readOnly;
|
|
538
|
+
$[15] = scroll;
|
|
539
|
+
$[16] = start;
|
|
540
|
+
$[17] = t1;
|
|
541
|
+
$[18] = t2;
|
|
542
|
+
$[19] = timeZone;
|
|
543
|
+
$[20] = today;
|
|
544
|
+
$[21] = unavailable;
|
|
545
|
+
$[22] = value;
|
|
546
|
+
$[23] = week;
|
|
547
|
+
$[24] = weekStartsOn;
|
|
520
548
|
} else {
|
|
521
549
|
children = $[1];
|
|
522
550
|
className = $[2];
|
|
@@ -531,21 +559,22 @@ function WeekStrip(t0) {
|
|
|
531
559
|
onValueChange = $[11];
|
|
532
560
|
onWeekChange = $[12];
|
|
533
561
|
props = $[13];
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
562
|
+
readOnly = $[14];
|
|
563
|
+
scroll = $[15];
|
|
564
|
+
start = $[16];
|
|
565
|
+
t1 = $[17];
|
|
566
|
+
t2 = $[18];
|
|
567
|
+
timeZone = $[19];
|
|
568
|
+
today = $[20];
|
|
569
|
+
unavailable = $[21];
|
|
570
|
+
value = $[22];
|
|
571
|
+
week = $[23];
|
|
572
|
+
weekStartsOn = $[24];
|
|
544
573
|
}
|
|
545
574
|
const label = t1 === void 0 ? "Day" : t1;
|
|
546
575
|
const size = t2 === void 0 ? "md" : t2;
|
|
547
576
|
let t3;
|
|
548
|
-
if ($[
|
|
577
|
+
if ($[25] !== controller || $[26] !== defaultValue || $[27] !== defaultWeek || $[28] !== disabled || $[29] !== faded || $[30] !== length || $[31] !== locale || $[32] !== marks || $[33] !== onValueChange || $[34] !== onWeekChange || $[35] !== readOnly || $[36] !== scroll || $[37] !== start || $[38] !== timeZone || $[39] !== today || $[40] !== unavailable || $[41] !== value || $[42] !== week || $[43] !== weekStartsOn) {
|
|
549
578
|
t3 = {
|
|
550
579
|
value,
|
|
551
580
|
defaultValue,
|
|
@@ -564,43 +593,45 @@ function WeekStrip(t0) {
|
|
|
564
593
|
faded,
|
|
565
594
|
marks,
|
|
566
595
|
disabled,
|
|
596
|
+
readOnly,
|
|
567
597
|
controller
|
|
568
598
|
};
|
|
569
|
-
$[
|
|
570
|
-
$[
|
|
571
|
-
$[
|
|
572
|
-
$[
|
|
573
|
-
$[
|
|
574
|
-
$[
|
|
575
|
-
$[
|
|
576
|
-
$[
|
|
577
|
-
$[
|
|
578
|
-
$[
|
|
579
|
-
$[
|
|
580
|
-
$[
|
|
581
|
-
$[
|
|
582
|
-
$[
|
|
583
|
-
$[
|
|
584
|
-
$[
|
|
585
|
-
$[
|
|
586
|
-
$[
|
|
587
|
-
$[
|
|
588
|
-
|
|
599
|
+
$[25] = controller;
|
|
600
|
+
$[26] = defaultValue;
|
|
601
|
+
$[27] = defaultWeek;
|
|
602
|
+
$[28] = disabled;
|
|
603
|
+
$[29] = faded;
|
|
604
|
+
$[30] = length;
|
|
605
|
+
$[31] = locale;
|
|
606
|
+
$[32] = marks;
|
|
607
|
+
$[33] = onValueChange;
|
|
608
|
+
$[34] = onWeekChange;
|
|
609
|
+
$[35] = readOnly;
|
|
610
|
+
$[36] = scroll;
|
|
611
|
+
$[37] = start;
|
|
612
|
+
$[38] = timeZone;
|
|
613
|
+
$[39] = today;
|
|
614
|
+
$[40] = unavailable;
|
|
615
|
+
$[41] = value;
|
|
616
|
+
$[42] = week;
|
|
617
|
+
$[43] = weekStartsOn;
|
|
618
|
+
$[44] = t3;
|
|
619
|
+
} else t3 = $[44];
|
|
589
620
|
const handle = usePrimitive(weekStrip, t3);
|
|
590
621
|
let t4;
|
|
591
|
-
if ($[
|
|
622
|
+
if ($[45] === Symbol.for("react.memo_cache_sentinel")) {
|
|
592
623
|
t4 = {};
|
|
593
|
-
$[
|
|
594
|
-
} else t4 = $[
|
|
624
|
+
$[45] = t4;
|
|
625
|
+
} else t4 = $[45];
|
|
595
626
|
const t5 = props["aria-labelledby"] ? void 0 : label;
|
|
596
627
|
let t6;
|
|
597
|
-
if ($[
|
|
628
|
+
if ($[46] !== className) {
|
|
598
629
|
t6 = cnState([weekStripLayout, "w-full min-w-0 text-sm"], className);
|
|
599
|
-
$[
|
|
600
|
-
$[
|
|
601
|
-
} else t6 = $[
|
|
630
|
+
$[46] = className;
|
|
631
|
+
$[47] = t6;
|
|
632
|
+
} else t6 = $[47];
|
|
602
633
|
let t7;
|
|
603
|
-
if ($[
|
|
634
|
+
if ($[48] !== children || $[49] !== handle || $[50] !== size) {
|
|
604
635
|
t7 = (state) => /* @__PURE__ */ jsx(WeekStripContext, {
|
|
605
636
|
value: {
|
|
606
637
|
handle,
|
|
@@ -608,25 +639,25 @@ function WeekStrip(t0) {
|
|
|
608
639
|
},
|
|
609
640
|
children: typeof children === "function" ? children(state) : children ?? weekStripParts(state.scroll)
|
|
610
641
|
});
|
|
611
|
-
$[
|
|
612
|
-
$[
|
|
613
|
-
$[
|
|
614
|
-
$[
|
|
615
|
-
} else t7 = $[
|
|
642
|
+
$[48] = children;
|
|
643
|
+
$[49] = handle;
|
|
644
|
+
$[50] = size;
|
|
645
|
+
$[51] = t7;
|
|
646
|
+
} else t7 = $[51];
|
|
616
647
|
let t8;
|
|
617
|
-
if ($[
|
|
648
|
+
if ($[52] !== props || $[53] !== t5 || $[54] !== t6 || $[55] !== t7) {
|
|
618
649
|
t8 = {
|
|
619
650
|
"aria-label": t5,
|
|
620
651
|
className: t6,
|
|
621
652
|
children: t7,
|
|
622
653
|
...props
|
|
623
654
|
};
|
|
624
|
-
$[
|
|
625
|
-
$[
|
|
626
|
-
$[
|
|
627
|
-
$[
|
|
628
|
-
$[
|
|
629
|
-
} else t8 = $[
|
|
655
|
+
$[52] = props;
|
|
656
|
+
$[53] = t5;
|
|
657
|
+
$[54] = t6;
|
|
658
|
+
$[55] = t7;
|
|
659
|
+
$[56] = t8;
|
|
660
|
+
} else t8 = $[56];
|
|
630
661
|
return usePart(handle, "root", t4, t8, "div");
|
|
631
662
|
}
|
|
632
663
|
/** The month or months shown, like "November 2026". Children replace the text. */
|
|
@@ -874,7 +905,7 @@ function _temp(day) {
|
|
|
874
905
|
}
|
|
875
906
|
const weekStripDayVariants = cva([
|
|
876
907
|
"relative flex cursor-default flex-col items-center justify-center rounded-lg tabular-nums select-none focus-ring focus-visible:z-10",
|
|
877
|
-
"not-data-selected:not-data-disabled:hover:bg-accent",
|
|
908
|
+
"not-data-selected:not-data-disabled:not-data-readonly:hover:bg-accent",
|
|
878
909
|
"data-today:not-data-selected:ring-1 data-today:not-data-selected:ring-input data-today:not-data-selected:ring-inset",
|
|
879
910
|
"data-faded:not-data-selected:text-muted-foreground",
|
|
880
911
|
"data-selected:bg-primary data-selected:text-primary-foreground",
|
|
@@ -972,58 +1003,146 @@ function WeekStripDay(t0) {
|
|
|
972
1003
|
return usePart(weekStrip, "day", t1, t4, "div");
|
|
973
1004
|
}
|
|
974
1005
|
function WeekStripDayFace(t0) {
|
|
975
|
-
const $ = c(
|
|
1006
|
+
const $ = c(15);
|
|
976
1007
|
const { state, size } = t0;
|
|
1008
|
+
if (state.marks?.bar !== void 0) {
|
|
1009
|
+
let t1;
|
|
1010
|
+
if ($[0] !== state) {
|
|
1011
|
+
t1 = /* @__PURE__ */ jsx(WeekStripBarFace, { state });
|
|
1012
|
+
$[0] = state;
|
|
1013
|
+
$[1] = t1;
|
|
1014
|
+
} else t1 = $[1];
|
|
1015
|
+
return t1;
|
|
1016
|
+
}
|
|
977
1017
|
let t1;
|
|
978
|
-
if ($[
|
|
1018
|
+
if ($[2] !== state.weekday) {
|
|
979
1019
|
t1 = /* @__PURE__ */ jsx("span", {
|
|
980
1020
|
className: "text-xs text-muted-foreground in-data-selected:text-primary-foreground",
|
|
981
1021
|
children: state.weekday
|
|
982
1022
|
});
|
|
983
|
-
$[
|
|
984
|
-
$[
|
|
985
|
-
} else t1 = $[
|
|
1023
|
+
$[2] = state.weekday;
|
|
1024
|
+
$[3] = t1;
|
|
1025
|
+
} else t1 = $[3];
|
|
986
1026
|
const t2 = size === "md" ? "text-base" : "text-sm";
|
|
987
1027
|
let t3;
|
|
988
|
-
if ($[
|
|
1028
|
+
if ($[4] !== t2) {
|
|
989
1029
|
t3 = cn("font-medium", t2);
|
|
990
|
-
$[
|
|
991
|
-
$[
|
|
992
|
-
} else t3 = $[
|
|
1030
|
+
$[4] = t2;
|
|
1031
|
+
$[5] = t3;
|
|
1032
|
+
} else t3 = $[5];
|
|
993
1033
|
let t4;
|
|
994
|
-
if ($[
|
|
1034
|
+
if ($[6] !== state.label || $[7] !== t3) {
|
|
995
1035
|
t4 = /* @__PURE__ */ jsx("span", {
|
|
996
1036
|
className: t3,
|
|
997
1037
|
children: state.label
|
|
998
1038
|
});
|
|
999
|
-
$[
|
|
1000
|
-
$[
|
|
1001
|
-
$[
|
|
1002
|
-
} else t4 = $[
|
|
1039
|
+
$[6] = state.label;
|
|
1040
|
+
$[7] = t3;
|
|
1041
|
+
$[8] = t4;
|
|
1042
|
+
} else t4 = $[8];
|
|
1003
1043
|
let t5;
|
|
1004
|
-
if ($[
|
|
1044
|
+
if ($[9] !== state.marks) {
|
|
1005
1045
|
t5 = /* @__PURE__ */ jsx(WeekStripMarks, { marks: state.marks });
|
|
1006
|
-
$[
|
|
1007
|
-
$[
|
|
1008
|
-
} else t5 = $[
|
|
1046
|
+
$[9] = state.marks;
|
|
1047
|
+
$[10] = t5;
|
|
1048
|
+
} else t5 = $[10];
|
|
1009
1049
|
let t6;
|
|
1010
|
-
if ($[
|
|
1050
|
+
if ($[11] !== t1 || $[12] !== t4 || $[13] !== t5) {
|
|
1011
1051
|
t6 = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1012
1052
|
t1,
|
|
1013
1053
|
t4,
|
|
1014
1054
|
t5
|
|
1015
1055
|
] });
|
|
1016
|
-
$[
|
|
1017
|
-
$[
|
|
1018
|
-
$[
|
|
1019
|
-
$[
|
|
1020
|
-
} else t6 = $[
|
|
1056
|
+
$[11] = t1;
|
|
1057
|
+
$[12] = t4;
|
|
1058
|
+
$[13] = t5;
|
|
1059
|
+
$[14] = t6;
|
|
1060
|
+
} else t6 = $[14];
|
|
1021
1061
|
return t6;
|
|
1022
1062
|
}
|
|
1063
|
+
/**
|
|
1064
|
+
* A day with a bar, as Paper's week summary draws it: the weekday and number on
|
|
1065
|
+
* one line, the bar on a 44px lane that keeps its height without one, and the
|
|
1066
|
+
* count with its mark under it.
|
|
1067
|
+
*/
|
|
1068
|
+
function WeekStripBarFace(t0) {
|
|
1069
|
+
const $ = c(13);
|
|
1070
|
+
const { state } = t0;
|
|
1071
|
+
const height = weekStripBarHeight(state.marks?.bar, state.barMax);
|
|
1072
|
+
let t1;
|
|
1073
|
+
if ($[0] !== state.label || $[1] !== state.weekday) {
|
|
1074
|
+
t1 = /* @__PURE__ */ jsxs("span", {
|
|
1075
|
+
className: "text-footnote font-medium whitespace-nowrap text-subtle in-data-selected:text-primary-foreground",
|
|
1076
|
+
children: [
|
|
1077
|
+
state.weekday,
|
|
1078
|
+
" ",
|
|
1079
|
+
state.label
|
|
1080
|
+
]
|
|
1081
|
+
});
|
|
1082
|
+
$[0] = state.label;
|
|
1083
|
+
$[1] = state.weekday;
|
|
1084
|
+
$[2] = t1;
|
|
1085
|
+
} else t1 = $[2];
|
|
1086
|
+
let t2;
|
|
1087
|
+
if ($[3] !== height) {
|
|
1088
|
+
t2 = height > 0 && /* @__PURE__ */ jsx("span", {
|
|
1089
|
+
"data-slot": "week-strip-bar",
|
|
1090
|
+
className: "w-5 rounded-xs bg-foreground/14 in-data-selected:bg-primary-foreground/40",
|
|
1091
|
+
style: { height: `${height}px` }
|
|
1092
|
+
});
|
|
1093
|
+
$[3] = height;
|
|
1094
|
+
$[4] = t2;
|
|
1095
|
+
} else t2 = $[4];
|
|
1096
|
+
let t3;
|
|
1097
|
+
if ($[5] !== t2) {
|
|
1098
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
1099
|
+
className: "flex h-11 items-end",
|
|
1100
|
+
children: t2
|
|
1101
|
+
});
|
|
1102
|
+
$[5] = t2;
|
|
1103
|
+
$[6] = t3;
|
|
1104
|
+
} else t3 = $[6];
|
|
1105
|
+
let t4;
|
|
1106
|
+
if ($[7] !== state.marks) {
|
|
1107
|
+
t4 = /* @__PURE__ */ jsx(WeekStripMarks, { marks: state.marks });
|
|
1108
|
+
$[7] = state.marks;
|
|
1109
|
+
$[8] = t4;
|
|
1110
|
+
} else t4 = $[8];
|
|
1111
|
+
let t5;
|
|
1112
|
+
if ($[9] !== t1 || $[10] !== t3 || $[11] !== t4) {
|
|
1113
|
+
t5 = /* @__PURE__ */ jsxs("span", {
|
|
1114
|
+
className: "flex flex-col items-center gap-1.5",
|
|
1115
|
+
children: [
|
|
1116
|
+
t1,
|
|
1117
|
+
t3,
|
|
1118
|
+
t4
|
|
1119
|
+
]
|
|
1120
|
+
});
|
|
1121
|
+
$[9] = t1;
|
|
1122
|
+
$[10] = t3;
|
|
1123
|
+
$[11] = t4;
|
|
1124
|
+
$[12] = t5;
|
|
1125
|
+
} else t5 = $[12];
|
|
1126
|
+
return t5;
|
|
1127
|
+
}
|
|
1128
|
+
const checkClasses = {
|
|
1129
|
+
primary: "text-primary in-data-selected:text-primary-foreground",
|
|
1130
|
+
muted: "text-muted-foreground in-data-selected:text-primary-foreground",
|
|
1131
|
+
destructive: "text-destructive",
|
|
1132
|
+
warning: "text-warning",
|
|
1133
|
+
success: "text-success",
|
|
1134
|
+
"chart-1": "text-chart-1",
|
|
1135
|
+
"chart-2": "text-chart-2",
|
|
1136
|
+
"chart-3": "text-chart-3",
|
|
1137
|
+
"chart-4": "text-chart-4",
|
|
1138
|
+
"chart-5": "text-chart-5"
|
|
1139
|
+
};
|
|
1023
1140
|
const toneClasses = {
|
|
1024
1141
|
primary: "bg-primary in-data-selected:bg-primary-foreground",
|
|
1025
1142
|
muted: "bg-muted-foreground in-data-selected:bg-primary-foreground",
|
|
1026
1143
|
destructive: "bg-destructive",
|
|
1144
|
+
warning: "bg-warning",
|
|
1145
|
+
success: "bg-success",
|
|
1027
1146
|
"chart-1": "bg-chart-1",
|
|
1028
1147
|
"chart-2": "bg-chart-2",
|
|
1029
1148
|
"chart-3": "bg-chart-3",
|
|
@@ -1032,51 +1151,86 @@ const toneClasses = {
|
|
|
1032
1151
|
};
|
|
1033
1152
|
const dotClasses = "size-1.5 shrink-0 rounded-full in-data-selected:ring-1 in-data-selected:ring-primary-foreground";
|
|
1034
1153
|
/**
|
|
1035
|
-
* A day's marks: its label, else up to three dots, and its corner
|
|
1036
|
-
*
|
|
1154
|
+
* A day's marks: its label, else up to three dots or a check, and its corner
|
|
1155
|
+
* dot. With a `bar` the label and the dots or the check sit side by side under
|
|
1156
|
+
* it. It keeps its height without marks, so every day lines up. Decorative: the
|
|
1037
1157
|
* day's name carries what they mean.
|
|
1038
1158
|
*/
|
|
1039
1159
|
function WeekStripMarks(t0) {
|
|
1040
|
-
const $ = c(
|
|
1160
|
+
const $ = c(19);
|
|
1041
1161
|
const { marks, className } = t0;
|
|
1042
1162
|
const corner = marks?.corner === true ? "destructive" : marks?.corner || void 0;
|
|
1163
|
+
const check = marks?.check === true ? "success" : marks?.check || void 0;
|
|
1164
|
+
const bar = marks?.bar !== void 0;
|
|
1043
1165
|
let t1;
|
|
1044
|
-
if ($[0] !==
|
|
1045
|
-
t1 =
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1166
|
+
if ($[0] !== check || $[1] !== marks?.dots) {
|
|
1167
|
+
t1 = check ? /* @__PURE__ */ jsx("svg", {
|
|
1168
|
+
viewBox: "0 0 8 8",
|
|
1169
|
+
fill: "none",
|
|
1170
|
+
stroke: "currentColor",
|
|
1171
|
+
strokeWidth: "1.3",
|
|
1172
|
+
strokeLinecap: "round",
|
|
1173
|
+
strokeLinejoin: "round",
|
|
1174
|
+
className: cn("size-2.5 shrink-0", checkClasses[check]),
|
|
1175
|
+
children: /* @__PURE__ */ jsx("path", { d: "M1.5 4.2l1.6 1.6L6.5 2.4" })
|
|
1176
|
+
}) : marks?.dots?.slice(0, 3).map(_temp2);
|
|
1177
|
+
$[0] = check;
|
|
1178
|
+
$[1] = marks?.dots;
|
|
1179
|
+
$[2] = t1;
|
|
1180
|
+
} else t1 = $[2];
|
|
1181
|
+
const indicator = t1;
|
|
1049
1182
|
let t2;
|
|
1050
|
-
if ($[
|
|
1051
|
-
t2 = marks?.label ? /* @__PURE__ */ jsx("span", {
|
|
1183
|
+
if ($[3] !== bar || $[4] !== marks) {
|
|
1184
|
+
t2 = marks?.label ? bar ? /* @__PURE__ */ jsx("span", {
|
|
1185
|
+
className: cn("text-supporting", barValue(marks.bar) > 0 ? "font-medium text-foreground" : "text-subtle", "in-data-selected:text-primary-foreground"),
|
|
1186
|
+
children: marks.label
|
|
1187
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
1052
1188
|
className: "truncate px-0.5 text-xs leading-none text-muted-foreground in-data-selected:text-primary-foreground",
|
|
1053
1189
|
children: marks.label
|
|
1054
|
-
}) :
|
|
1055
|
-
$[
|
|
1056
|
-
$[
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
$[4] = corner;
|
|
1062
|
-
$[5] = t3;
|
|
1063
|
-
} else t3 = $[5];
|
|
1190
|
+
}) : void 0;
|
|
1191
|
+
$[3] = bar;
|
|
1192
|
+
$[4] = marks;
|
|
1193
|
+
$[5] = t2;
|
|
1194
|
+
} else t2 = $[5];
|
|
1195
|
+
const label = t2;
|
|
1196
|
+
const t3 = bar ? "h-4 gap-1" : "h-3 gap-0.5";
|
|
1064
1197
|
let t4;
|
|
1065
|
-
if ($[6] !==
|
|
1066
|
-
t4 =
|
|
1198
|
+
if ($[6] !== className || $[7] !== t3) {
|
|
1199
|
+
t4 = cn("flex max-w-full items-center justify-center", t3, className);
|
|
1200
|
+
$[6] = className;
|
|
1201
|
+
$[7] = t3;
|
|
1202
|
+
$[8] = t4;
|
|
1203
|
+
} else t4 = $[8];
|
|
1204
|
+
let t5;
|
|
1205
|
+
if ($[9] !== bar || $[10] !== indicator || $[11] !== label) {
|
|
1206
|
+
t5 = bar ? /* @__PURE__ */ jsxs(Fragment$1, { children: [label, indicator] }) : label ?? indicator;
|
|
1207
|
+
$[9] = bar;
|
|
1208
|
+
$[10] = indicator;
|
|
1209
|
+
$[11] = label;
|
|
1210
|
+
$[12] = t5;
|
|
1211
|
+
} else t5 = $[12];
|
|
1212
|
+
let t6;
|
|
1213
|
+
if ($[13] !== corner) {
|
|
1214
|
+
t6 = corner && /* @__PURE__ */ jsx("span", { className: cn("absolute end-1 top-1", dotClasses, toneClasses[corner]) });
|
|
1215
|
+
$[13] = corner;
|
|
1216
|
+
$[14] = t6;
|
|
1217
|
+
} else t6 = $[14];
|
|
1218
|
+
let t7;
|
|
1219
|
+
if ($[15] !== t4 || $[16] !== t5 || $[17] !== t6) {
|
|
1220
|
+
t7 = /* @__PURE__ */ jsxs("span", {
|
|
1067
1221
|
"data-slot": "week-strip-marks",
|
|
1068
1222
|
"aria-hidden": "true",
|
|
1069
|
-
className:
|
|
1070
|
-
children: [
|
|
1223
|
+
className: t4,
|
|
1224
|
+
children: [t5, t6]
|
|
1071
1225
|
});
|
|
1072
|
-
$[
|
|
1073
|
-
$[
|
|
1074
|
-
$[
|
|
1075
|
-
$[
|
|
1076
|
-
} else
|
|
1077
|
-
return
|
|
1226
|
+
$[15] = t4;
|
|
1227
|
+
$[16] = t5;
|
|
1228
|
+
$[17] = t6;
|
|
1229
|
+
$[18] = t7;
|
|
1230
|
+
} else t7 = $[18];
|
|
1231
|
+
return t7;
|
|
1078
1232
|
}
|
|
1079
1233
|
function _temp2(tone, index) {
|
|
1080
1234
|
return /* @__PURE__ */ jsx("span", { className: cn(dotClasses, toneClasses[tone]) }, `${tone}-${index}`);
|
|
1081
1235
|
}
|
|
1082
|
-
export { WeekStrip, WeekStripDay, WeekStripDays, WeekStripHeading, WeekStripMarks, WeekStripNext, WeekStripPrevious, createWeekStripController, useWeekStrip, weekStripLayout, weekStripParts };
|
|
1236
|
+
export { WeekStrip, WeekStripDay, WeekStripDays, WeekStripHeading, WeekStripMarks, WeekStripNext, WeekStripPrevious, createWeekStripController, useWeekStrip, weekStripBarHeight, weekStripLayout, weekStripParts };
|