@rinzai/zen 0.9.0 → 0.10.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.
Files changed (112) hide show
  1. package/dist/animated-number/index.d.ts +6 -2
  2. package/dist/animated-number/index.d.ts.map +1 -1
  3. package/dist/animated-number/index.js +68 -17
  4. package/dist/calendar-heatmap/index.d.ts +25 -0
  5. package/dist/calendar-heatmap/index.d.ts.map +1 -0
  6. package/dist/calendar-heatmap/index.js +48 -0
  7. package/dist/chart/allocation.d.ts +30 -0
  8. package/dist/chart/allocation.d.ts.map +1 -0
  9. package/dist/chart/allocation.js +69 -0
  10. package/dist/chart/index.d.ts +1 -0
  11. package/dist/chart/index.d.ts.map +1 -1
  12. package/dist/chart/index.js +85 -83
  13. package/dist/code-block/index.d.ts +1 -1
  14. package/dist/code-block/index.d.ts.map +1 -1
  15. package/dist/code-block/index.js +31 -22
  16. package/dist/collapse/index.d.ts +3 -2
  17. package/dist/collapse/index.d.ts.map +1 -1
  18. package/dist/collapse/index.js +1 -1
  19. package/dist/date-picker/index.d.ts +10 -2
  20. package/dist/date-picker/index.d.ts.map +1 -1
  21. package/dist/date-picker/index.js +43 -21
  22. package/dist/dialog/index.d.ts +4 -2
  23. package/dist/dialog/index.d.ts.map +1 -1
  24. package/dist/dialog/index.js +69 -113
  25. package/dist/editable-cell/index.d.ts +2 -1
  26. package/dist/editable-cell/index.d.ts.map +1 -1
  27. package/dist/editable-cell/index.js +24 -17
  28. package/dist/filter-bar/index.d.ts +21 -0
  29. package/dist/filter-bar/index.d.ts.map +1 -0
  30. package/dist/filter-bar/index.js +90 -0
  31. package/dist/icon-picker/index.d.ts +38 -0
  32. package/dist/icon-picker/index.d.ts.map +1 -0
  33. package/dist/icon-picker/index.js +112 -0
  34. package/dist/icons/arrow-left.js +23 -0
  35. package/dist/icons/micro/arrow-trending-down.d.ts +3 -0
  36. package/dist/icons/micro/arrow-trending-down.d.ts.map +1 -0
  37. package/dist/icons/micro/arrow-trending-down.js +21 -0
  38. package/dist/icons/micro/arrow-trending-up.d.ts +3 -0
  39. package/dist/icons/micro/arrow-trending-up.d.ts.map +1 -0
  40. package/dist/icons/micro/arrow-trending-up.js +21 -0
  41. package/dist/index.d.ts +17 -5
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/kbd/index.d.ts +4 -0
  44. package/dist/kbd/index.d.ts.map +1 -0
  45. package/dist/kbd/index.js +12 -0
  46. package/dist/keypad/index.d.ts +20 -0
  47. package/dist/keypad/index.d.ts.map +1 -0
  48. package/dist/keypad/index.js +42 -0
  49. package/dist/lib.js +92 -77
  50. package/dist/load-more/index.d.ts +19 -0
  51. package/dist/load-more/index.d.ts.map +1 -0
  52. package/dist/load-more/index.js +37 -0
  53. package/dist/menu/index.d.ts +22 -3
  54. package/dist/menu/index.d.ts.map +1 -1
  55. package/dist/menu/index.js +132 -45
  56. package/dist/meter/index.d.ts +3 -1
  57. package/dist/meter/index.d.ts.map +1 -1
  58. package/dist/meter/index.js +19 -14
  59. package/dist/money-input/index.d.ts +3 -3
  60. package/dist/page-transition/index.d.ts +10 -0
  61. package/dist/page-transition/index.d.ts.map +1 -0
  62. package/dist/page-transition/index.js +16 -0
  63. package/dist/progress-ring/index.d.ts +4 -1
  64. package/dist/progress-ring/index.d.ts.map +1 -1
  65. package/dist/progress-ring/index.js +47 -38
  66. package/dist/range-slider/index.d.ts +26 -0
  67. package/dist/range-slider/index.d.ts.map +1 -0
  68. package/dist/range-slider/index.js +44 -0
  69. package/dist/repeat-picker/index.d.ts +22 -0
  70. package/dist/repeat-picker/index.d.ts.map +1 -0
  71. package/dist/repeat-picker/index.js +115 -0
  72. package/dist/slider/index.d.ts +2 -0
  73. package/dist/slider/index.d.ts.map +1 -1
  74. package/dist/slider/index.js +19 -18
  75. package/dist/sortable/index.d.ts +33 -0
  76. package/dist/sortable/index.d.ts.map +1 -0
  77. package/dist/sortable/index.js +147 -0
  78. package/dist/table/index.d.ts +5 -1
  79. package/dist/table/index.d.ts.map +1 -1
  80. package/dist/table/index.js +90 -58
  81. package/dist/table/selection.d.ts +55 -0
  82. package/dist/table/selection.d.ts.map +1 -0
  83. package/dist/table/selection.js +83 -0
  84. package/dist/table/swipe.d.ts +18 -0
  85. package/dist/table/swipe.d.ts.map +1 -0
  86. package/dist/table/swipe.js +53 -0
  87. package/dist/tabs/index.d.ts.map +1 -1
  88. package/dist/tabs/index.js +101 -51
  89. package/dist/theme-toggle/index.js +6 -6
  90. package/dist/theme.css +184 -11
  91. package/dist/toast/index.js +25 -25
  92. package/dist/toggle/index.d.ts.map +1 -1
  93. package/dist/toggle/index.js +1 -1
  94. package/dist/trend/index.d.ts +19 -0
  95. package/dist/trend/index.d.ts.map +1 -0
  96. package/dist/trend/index.js +27 -0
  97. package/dist/utils/date.d.ts +34 -0
  98. package/dist/utils/date.d.ts.map +1 -1
  99. package/dist/utils/date.js +45 -12
  100. package/dist/utils/money.d.ts +3 -1
  101. package/dist/utils/money.d.ts.map +1 -1
  102. package/dist/utils/money.js +24 -1
  103. package/dist/utils/repeat.d.ts +17 -0
  104. package/dist/utils/repeat.d.ts.map +1 -0
  105. package/dist/utils/repeat.js +38 -0
  106. package/dist/utils/swipe.d.ts +29 -0
  107. package/dist/utils/swipe.d.ts.map +1 -0
  108. package/dist/utils/swipe.js +85 -0
  109. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  110. package/dist/utils/useAnchoredPopup.js +3 -9
  111. package/dist/zen.css +1 -1
  112. package/package.json +3 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toggle/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACnF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,+BAwChD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/toggle/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,WAAY,SAAQ,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IACnF,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,+BAyChD"}
@@ -4,7 +4,7 @@ import { jsx as t, jsxs as n } from "react/jsx-runtime";
4
4
  //#region packages/toggle/index.tsx
5
5
  function r(r) {
6
6
  let { className: i, onChange: a, onKeyDown: o, disabled: s, ...c } = r;
7
- return /* @__PURE__ */ n("label", {
7
+ return /* @__PURE__ */ n("span", {
8
8
  className: e("zen__toggle bg-tint/[0.06] relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border border-[color:oklch(var(--tint)/var(--zen-control-edge))] p-0.5", "has-focus-visible:ring-glow/50 transition-[background-color,box-shadow,border-color] duration-300 has-focus-visible:ring-2", "has-checked:border-glow/60 has-checked:bg-glow/40 has-checked:shadow-[0_0_18px_-2px_oklch(var(--glow)/calc(0.8*var(--glow-k)))]", "has-disabled:cursor-not-allowed has-disabled:opacity-50", i),
9
9
  children: [/* @__PURE__ */ t("input", {
10
10
  type: "checkbox",
@@ -0,0 +1,19 @@
1
+ import { ComponentProps } from 'react';
2
+ /**
3
+ * A change, e.g. "+12%" with an arrow, coloured by whether it's good news:
4
+ * savings going up is, spending going up isn't (`good="down"`). `value` is
5
+ * the change as a fraction (0.12 for 12%); children follow it, muted, e.g.
6
+ * "vs last month".
7
+ */
8
+ export default function Trend({ value, good, locale, format, className, children, ...rest }: TrendProps): import('react').JSX.Element;
9
+ export interface TrendProps extends ComponentProps<'span'> {
10
+ /** The change as a fraction: 0.12 is 12% up, -0.05 is 5% down. */
11
+ value: number;
12
+ /** Which way is good news (default `up`); spending would be `down`. */
13
+ good?: 'up' | 'down';
14
+ /** For the default percent format. */
15
+ locale?: string;
16
+ /** How the change reads, e.g. as money instead of a percent. */
17
+ format?: (value: number) => string;
18
+ }
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/trend/index.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,KAAK,CAAC,EAC1B,KAAK,EACL,IAAW,EACX,MAAM,EACN,MAGK,EACL,SAAS,EACT,QAAQ,EACR,GAAG,IAAI,EACV,EAAE,UAAU,+BAsBZ;AAED,MAAM,WAAW,UAAW,SAAQ,cAAc,CAAC,MAAM,CAAC;IACtD,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,uEAAuE;IACvE,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IACrB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC"}
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { cx as e } from "../utils/cx.js";
3
+ import t from "../icons/micro/arrow-trending-down.js";
4
+ import n from "../icons/micro/arrow-trending-up.js";
5
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
6
+ //#region packages/trend/index.tsx
7
+ function a({ value: a, good: o = "up", locale: s, format: c = (e) => new Intl.NumberFormat(s, {
8
+ style: "percent",
9
+ maximumFractionDigits: 1,
10
+ signDisplay: "exceptZero"
11
+ }).format(e), className: l, children: u, ...d }) {
12
+ let f = a > 0 ? "up" : a < 0 ? "down" : "flat", p = f === "up" ? n : f === "down" ? t : null;
13
+ return /* @__PURE__ */ i("span", {
14
+ className: e("zen__trend inline-flex items-center gap-1.5 text-xs", l),
15
+ ...d,
16
+ children: [/* @__PURE__ */ i("span", {
17
+ "data-direction": f,
18
+ className: e("inline-flex items-center gap-0.5 rounded-md border px-1.5 py-0.5 font-medium whitespace-nowrap tabular-nums", f === "flat" ? "border-tint/10 bg-tint/[0.06] text-muted-foreground" : f === o ? "border-glow/30 bg-glow/10 text-primary" : "border-destructive/40 bg-destructive/10 text-destructive"),
19
+ children: [p && /* @__PURE__ */ r(p, { className: "size-3.5" }), c(a)]
20
+ }), u && /* @__PURE__ */ r("span", {
21
+ className: "text-muted-foreground",
22
+ children: u
23
+ })]
24
+ });
25
+ }
26
+ //#endregion
27
+ export { a as default };
@@ -21,6 +21,40 @@ export declare function daysInMonth(month: Month): number;
21
21
  export declare function dayOfWeek(date: DateString): number;
22
22
  /** Today in the user's time zone. */
23
23
  export declare function today(now?: Date): DateString;
24
+ /**
25
+ * The ranges people pick most, up to `today`: label them yourself, e.g. for
26
+ * DateRangePicker's presets. Weeks start on `weekStartsOn` (0 for Sunday).
27
+ */
28
+ export declare function commonRanges(today: DateString, weekStartsOn?: number): {
29
+ today: {
30
+ start: string;
31
+ end: string;
32
+ };
33
+ thisWeek: {
34
+ start: string;
35
+ end: string;
36
+ };
37
+ last7Days: {
38
+ start: string;
39
+ end: string;
40
+ };
41
+ last30Days: {
42
+ start: string;
43
+ end: string;
44
+ };
45
+ thisMonth: {
46
+ start: string;
47
+ end: string;
48
+ };
49
+ lastMonth: {
50
+ start: string;
51
+ end: string;
52
+ };
53
+ thisYear: {
54
+ start: string;
55
+ end: string;
56
+ };
57
+ };
24
58
  /** Days from `from` to `to` (negative if `to` is earlier). */
25
59
  export declare function daysBetween(from: DateString, to: DateString): number;
26
60
  /** How much of a date to show; `day` is the day and month without the year ("Sep 3"), for dates within the year. */
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AAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAElD;AAED,qCAAqC;AACrC,wBAAgB,KAAK,CAAC,GAAG,GAAE,IAAiB,GAAG,UAAU,CAExD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,SAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAY/D;AAED,8DAA8D;AAC9D,wBAAgB,WAAW,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,GAAG,MAAM,CAEpE;AAED,oHAAoH;AACpH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,MAAM,CAAC;AAQrE;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,SAAoB,GAAG,MAAM,CAEhG;AAED,sDAAsD;AACtD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,GAAG,OAAO,GAAG,MAAgB,GAAG,MAAM,EAAE,CAGnG;AAUD,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAahD;AAED,kGAAkG;AAClG,wBAAgB,eAAe,CAC3B,KAAK,EAAE,UAAU,EACjB,GAAG,EAAE,UAAU,EACf,MAAM,EAAE,MAAM,EACd,KAAK,GAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAY,GAC7C,MAAM,CAER"}
@@ -30,10 +30,43 @@ function s(e) {
30
30
  function c(e = /* @__PURE__ */ new Date()) {
31
31
  return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
32
32
  }
33
- function l(e, t) {
33
+ function l(e, t = 1) {
34
+ let n = e.slice(0, 7), r = a(`${n}-01`, -1);
35
+ return {
36
+ today: {
37
+ start: e,
38
+ end: e
39
+ },
40
+ thisWeek: {
41
+ start: i(e, -((s(e) - t + 7) % 7)),
42
+ end: e
43
+ },
44
+ last7Days: {
45
+ start: i(e, -6),
46
+ end: e
47
+ },
48
+ last30Days: {
49
+ start: i(e, -29),
50
+ end: e
51
+ },
52
+ thisMonth: {
53
+ start: `${n}-01`,
54
+ end: e
55
+ },
56
+ lastMonth: {
57
+ start: r,
58
+ end: i(`${n}-01`, -1)
59
+ },
60
+ thisYear: {
61
+ start: `${e.slice(0, 4)}-01-01`,
62
+ end: e
63
+ }
64
+ };
65
+ }
66
+ function u(e, t) {
34
67
  return n(t) - n(e);
35
68
  }
36
- var u = (e, t) => new Intl.DateTimeFormat(e, t === "day" ? {
69
+ var d = (e, t) => new Intl.DateTimeFormat(e, t === "day" ? {
37
70
  day: "numeric",
38
71
  month: "short",
39
72
  timeZone: "UTC"
@@ -41,30 +74,30 @@ var u = (e, t) => new Intl.DateTimeFormat(e, t === "day" ? {
41
74
  dateStyle: t,
42
75
  timeZone: "UTC"
43
76
  });
44
- function d(e, t, r = "medium") {
45
- return _(u(t, r).format(n(e) * 864e5));
77
+ function f(e, t, r = "medium") {
78
+ return v(d(t, r).format(n(e) * 864e5));
46
79
  }
47
- function f(e, t = "short") {
80
+ function p(e, t = "short") {
48
81
  let n = new Intl.DateTimeFormat(e, {
49
82
  weekday: t,
50
83
  timeZone: "UTC"
51
84
  });
52
85
  return Array.from({ length: 7 }, (e, t) => n.format(Date.UTC(2023, 0, 1 + t)));
53
86
  }
54
- var p = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" ")), m = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
55
- function h(e) {
87
+ var m = new Set("AG AS BD BR BS BT BW BZ CA CN CO DM DO ET GT GU HK HN ID IL IN JM JP KE KH KR LA MH MM MO MT MX MZ NI NP PA PE PH PK PR PT PY SA SG SV TH TT TW UM US VE VI WS YE ZA ZW".split(" ")), h = new Set("AE AF BH DJ DZ EG IQ IR JO KW LY OM QA SD SY".split(" "));
88
+ function g(e) {
56
89
  try {
57
90
  let t = new Intl.Locale(e), n = t.getWeekInfo?.() ?? t.weekInfo;
58
91
  if (n) return n.firstDay % 7;
59
92
  let r = t.maximize().region ?? "";
60
- return p.has(r) ? 0 : m.has(r) ? 6 : 1;
93
+ return m.has(r) ? 0 : h.has(r) ? 6 : 1;
61
94
  } catch {
62
95
  return 1;
63
96
  }
64
97
  }
65
- function g(e, t, r, i = "medium") {
66
- return _(u(r, i).formatRange(n(e) * 864e5, n(t) * 864e5));
98
+ function _(e, t, r, i = "medium") {
99
+ return v(d(r, i).formatRange(n(e) * 864e5, n(t) * 864e5));
67
100
  }
68
- var _ = (e) => e.replace(/[\u2009\u202f]/g, " ");
101
+ var v = (e) => e.replace(/[\u2009\u202f]/g, " ");
69
102
  //#endregion
70
- export { i as addDays, a as addMonthsToDate, n as dayIndex, s as dayOfWeek, l as daysBetween, o as daysInMonth, d as formatDate, g as formatDateRange, r as fromDayIndex, t as isDate, c as today, h as weekStart, f as weekdayNames };
103
+ export { i as addDays, a as addMonthsToDate, l as commonRanges, n as dayIndex, s as dayOfWeek, u as daysBetween, o as daysInMonth, f as formatDate, _ as formatDateRange, r as fromDayIndex, t as isDate, c as today, g as weekStart, p as weekdayNames };
@@ -24,7 +24,9 @@ export declare class MoneyParseError extends Error {
24
24
  export declare function parseMoney(input: string, currency: string): Money;
25
25
  /**
26
26
  * Like parseMoney, plus shorthand: "1.5L" (lakh), "2cr" (crore), "10k",
27
- * "1.2m". Scaling is done by shifting the decimal string, so it stays exact.
27
+ * "1.2m", and sums: "120 + 45.50 - 10", "3 * 12.99", "1200 / 4" (× and ÷
28
+ * too). Amounts add exactly; times and divide take plain numbers and round
29
+ * to the currency's smallest unit (halves away from zero).
28
30
  */
29
31
  export declare function parseMoneyInput(input: string, currency: string): Money;
30
32
  //# sourceMappingURL=money.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../packages/utils/money.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CACvB,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,EAAE,YAAmB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACzD,MAAM,CAQR;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOpF;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,KAAK,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAajE;AAiBD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAiBtE"}
1
+ {"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../packages/utils/money.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,4FAA4F;AAC5F,wBAAgB,WAAW,CACvB,MAAM,EAAE,KAAK,EACb,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,EAAE,YAAmB,EAAE,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GACzD,MAAM,CAQR;AAED,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAOpF;AAED,+DAA+D;AAC/D,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAMvE;AAED,qBAAa,eAAgB,SAAQ,KAAK;gBAC1B,KAAK,EAAE,MAAM;CAI5B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAajE;AAiBD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,CAmBtE"}
@@ -56,7 +56,30 @@ var o = {
56
56
  mn: 6,
57
57
  million: 6
58
58
  };
59
- function s(t, n) {
59
+ function s(e, t) {
60
+ let n = e.trim().split(/(?<=[\d.a-z])\s*([+\-−*/×÷])\s*/i);
61
+ if (n.length === 1) return l(e, t);
62
+ let r = 0, a = 0;
63
+ for (; a < n.length;) {
64
+ let i = a === 0 || n[a - 1] === "+" ? 1 : -1, o = l(n[a], t);
65
+ for (a += 2; a < n.length && /[*/×÷]/.test(n[a - 1]);) {
66
+ let t = n[a - 1] === "*" || n[a - 1] === "×";
67
+ o = c(o, n[a], t, e), a += 2;
68
+ }
69
+ r += i * o;
70
+ }
71
+ if (!Number.isSafeInteger(r)) throw new i(e);
72
+ return r;
73
+ }
74
+ function c(e, t, n, r) {
75
+ let a = /^(\d*)(?:\.(\d+))?$/.exec(t.trim());
76
+ if (!a || a[1] === "" && !a[2]) throw new i(r);
77
+ let o = (a[2] ?? "").length, s = BigInt((a[1] || "0") + (a[2] ?? "")), c = 10n ** BigInt(o), [l, u] = n ? [BigInt(e) * s, c] : [BigInt(e) * c, s];
78
+ if (u === 0n) throw new i(r);
79
+ let d = l < 0n, f = ((d ? -l : l) * 2n + u) / (u * 2n);
80
+ return Number(d ? -f : f);
81
+ }
82
+ function l(t, n) {
60
83
  let r = /^\s*(.*?)\s*([a-z]+)\s*$/i.exec(t), s = o[r ? r[2].toLowerCase() : ""];
61
84
  if (!r || s === void 0) return a(t, n);
62
85
  let c = e(n), l = /^([+-]?)[^\d.+-]*([\d,\s_]*)(?:\.(\d*))?$/.exec(r[1]);
@@ -0,0 +1,17 @@
1
+ import { DateString } from './date';
2
+ /**
3
+ * How often something comes round: every `every` days, weeks, months or
4
+ * years. Weekly can name `weekdays` (0 for Sunday … 6); monthly a `day` of the
5
+ * month (-1 for the last). Otherwise it falls on the start date's.
6
+ */
7
+ export interface Repeat {
8
+ every: number;
9
+ unit: 'day' | 'week' | 'month' | 'year';
10
+ weekdays?: number[];
11
+ day?: number;
12
+ }
13
+ /** "Every 2 weeks on Mon, Thu", "Every month on day 5", "Every year on Sep 3" (from `start`). */
14
+ export declare function describeRepeat(repeat: Repeat, locale: string, start?: DateString): string;
15
+ /** The next `count` dates it falls on, from `start` (which sets the cycle) onwards, not before `from`. */
16
+ export declare function nextOccurrences(repeat: Repeat, start: DateString, count: number, from?: string): DateString[];
17
+ //# sourceMappingURL=repeat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../packages/utils/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,KAAK,UAAU,EAMlB,MAAM,QAAQ,CAAC;AAEhB;;;;GAIG;AACH,MAAM,WAAW,MAAM;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IACxC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAezF;AAED,0GAA0G;AAC1G,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,SAAQ,GAAG,UAAU,EAAE,CAW5G"}
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { addDays as e, addMonthsToDate as t, dayOfWeek as n, daysBetween as r, daysInMonth as i, formatDate as a, weekdayNames as o } from "./date.js";
3
+ //#region packages/utils/repeat.ts
4
+ function s(e, t, n) {
5
+ let { every: r, unit: i } = e, s = r === 1 ? `Every ${i}` : `Every ${r} ${i}s`;
6
+ if (i === "week" && e.weekdays?.length) {
7
+ let n = o(t);
8
+ return `${s} on ${[...e.weekdays].sort((e, t) => e - t).map((e) => n[e]).join(", ")}`;
9
+ }
10
+ return i === "month" && e.day !== void 0 ? `${s} on ${e.day === -1 ? "the last day" : `day ${e.day}`}` : i === "year" && n ? `${s} on ${a(n, t, "day")}` : s;
11
+ }
12
+ function c(e, t, n, r = t) {
13
+ let i = [], a = Math.max(1, Math.floor(e.every)), o = Math.max(0, Math.floor(l(e.unit, t, r) / a) - 1);
14
+ for (let s = o; i.length < n && s < o + n + 2; s++) for (let o of u(e, t, s * a)) o >= t && o >= r && i.length < n && i.push(o);
15
+ return i;
16
+ }
17
+ function l(e, t, n) {
18
+ if (e === "day") return r(t, n);
19
+ if (e === "week") return Math.floor(r(t, n) / 7);
20
+ let i = (Number(n.slice(0, 4)) - Number(t.slice(0, 4))) * 12 + Number(n.slice(5, 7)) - Number(t.slice(5, 7));
21
+ return e === "month" ? i : Math.floor(i / 12);
22
+ }
23
+ function u(r, a, o) {
24
+ switch (r.unit) {
25
+ case "day": return [e(a, o)];
26
+ case "week": {
27
+ let t = r.weekdays?.length ? [...new Set(r.weekdays)].sort((e, t) => e - t) : [n(a)], i = e(a, -n(a) + o * 7);
28
+ return t.map((t) => e(i, t));
29
+ }
30
+ case "month": {
31
+ let e = t(`${a.slice(0, 7)}-01`, o).slice(0, 7), n = i(e), s = r.day ?? Number(a.slice(8));
32
+ return [`${e}-${String(s === -1 ? n : Math.min(s, n)).padStart(2, "0")}`];
33
+ }
34
+ case "year": return [t(a, o * 12)];
35
+ }
36
+ }
37
+ //#endregion
38
+ export { s as describeRepeat, c as nextOccurrences };
@@ -0,0 +1,29 @@
1
+ import { RefObject } from 'react';
2
+ /** A flick at least this fast (px/ms) counts, however short. */
3
+ export declare const FLICK_SPEED = 0.5;
4
+ export interface SwipeDirection {
5
+ /** `inline` is x along the text: flipped in right-to-left layouts. */
6
+ axis: 'x' | 'y' | 'inline';
7
+ /** 1 for right or down (or the inline end), -1 for left or up (or the inline start). */
8
+ sign: 1 | -1;
9
+ }
10
+ export interface SwipeHandlers {
11
+ /** The finger moved; `d` is how far along the direction (negative once it's come back past the start). */
12
+ move: (d: number) => void;
13
+ /** Let go `d` along, moving at `speed` (px/ms) just before. */
14
+ release: (d: number, speed: number) => void;
15
+ /** Interrupted (a second finger, or the browser took the touch): put things back. */
16
+ cancel: () => void;
17
+ /** How far along letting go would act (close, open…); crossing it, either way, gives a light tap where phones can vibrate. */
18
+ threshold?: () => number;
19
+ }
20
+ /**
21
+ * A finger swiping `ref` in `direction`. Only a deliberate swipe: one finger,
22
+ * mostly along the direction, not starting in a text field or on something
23
+ * that handles its own touch gestures (its touch-action says so), and not
24
+ * while what's under the finger can still scroll that way. While swiping, the
25
+ * element has data-swiping, the page doesn't scroll, and the click that ends
26
+ * it is swallowed.
27
+ */
28
+ export declare function useSwipe(ref: RefObject<HTMLElement | null>, direction: SwipeDirection | undefined, handlers: SwipeHandlers): void;
29
+ //# sourceMappingURL=swipe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"swipe.d.ts","sourceRoot":"","sources":["../../packages/utils/swipe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAqB,MAAM,OAAO,CAAC;AAErD,gEAAgE;AAChE,eAAO,MAAM,WAAW,MAAM,CAAC;AAM/B,MAAM,WAAW,cAAc;IAC3B,sEAAsE;IACtE,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,CAAC;IAC3B,wFAAwF;IACxF,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC1B,0GAA0G;IAC1G,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1B,+DAA+D;IAC/D,OAAO,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,qFAAqF;IACrF,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,8HAA8H;IAC9H,SAAS,CAAC,EAAE,MAAM,MAAM,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACpB,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAClC,SAAS,EAAE,cAAc,GAAG,SAAS,EACrC,QAAQ,EAAE,aAAa,QAkG1B"}
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import { useEffect as e, useRef as t } from "react";
3
+ //#region packages/utils/swipe.ts
4
+ var n = .5, r = 100, i = 8;
5
+ function a(n, a, c) {
6
+ let l = t(c);
7
+ e(() => {
8
+ l.current = c;
9
+ });
10
+ let u = a?.axis, d = a?.sign;
11
+ e(() => {
12
+ let e = n.current;
13
+ if (!e || !u || !d) return;
14
+ let t = u === "y" ? "y" : "x", a = u === "inline" && getComputedStyle(e).direction === "rtl" ? -d : d, c = null, f = !1, p = (e) => (t === "y" ? e.clientY - c.y : e.clientX - c.x) * a, m = (e) => t === "y" ? e.clientX - c.x : e.clientY - c.y, h = () => {
15
+ let t = c?.on;
16
+ return c = null, t ? (delete e.dataset.swiping, f = !0, !0) : !1;
17
+ }, g = (n) => {
18
+ if (f = !1, n.pointerType === "touch") {
19
+ if (!n.isPrimary) {
20
+ h() && l.current.cancel();
21
+ return;
22
+ }
23
+ o(n.target, e, t) || (c = {
24
+ id: n.pointerId,
25
+ x: n.clientX,
26
+ y: n.clientY,
27
+ points: [[n.timeStamp, 0]],
28
+ on: !1,
29
+ past: !1
30
+ });
31
+ }
32
+ }, _ = (n) => {
33
+ if (!c || n.pointerId !== c.id) return;
34
+ let o = p(n);
35
+ if (!c.on) {
36
+ if (Math.hypot(o, m(n)) < i) return;
37
+ if (o <= 0 || Math.abs(m(n)) * 1.5 > o || s(n.target, t, a)) {
38
+ c = null;
39
+ return;
40
+ }
41
+ c.on = !0, e.dataset.swiping = "", e.setPointerCapture?.(n.pointerId);
42
+ }
43
+ c.points = [...c.points.filter(([e]) => n.timeStamp - e < r), [n.timeStamp, o]], l.current.move(o);
44
+ let u = l.current.threshold?.();
45
+ u !== void 0 && o > u !== c.past && (c.past = !c.past, navigator.vibrate?.(8));
46
+ }, v = (e) => {
47
+ if (!c || e.pointerId !== c.id) return;
48
+ let t = p(e), [n, i] = c.points.find(([t]) => e.timeStamp - t < r) ?? [e.timeStamp, t], a = (t - i) / Math.max(1, e.timeStamp - n);
49
+ h() && (e.type === "pointerup" ? l.current.release(t, a) : l.current.cancel());
50
+ }, y = (e) => {
51
+ c?.on && e.preventDefault();
52
+ }, b = (e) => {
53
+ f && (f = !1, e.stopPropagation(), e.preventDefault());
54
+ };
55
+ return e.addEventListener("pointerdown", g), e.addEventListener("pointermove", _), e.addEventListener("pointerup", v), e.addEventListener("pointercancel", v), e.addEventListener("touchmove", y, { passive: !1 }), e.addEventListener("click", b, !0), () => {
56
+ e.removeEventListener("pointerdown", g), e.removeEventListener("pointermove", _), e.removeEventListener("pointerup", v), e.removeEventListener("pointercancel", v), e.removeEventListener("touchmove", y), e.removeEventListener("click", b, !0), delete e.dataset.swiping;
57
+ };
58
+ }, [
59
+ n,
60
+ u,
61
+ d
62
+ ]);
63
+ }
64
+ function o(e, t, n) {
65
+ if (e.closest("input, textarea, select, [contenteditable]:not([contenteditable=\"false\"])")) return !0;
66
+ let r = n === "y" ? /pan-(y|up|down)/ : /pan-(x|left|right)/;
67
+ for (let n = e; n && n !== t; n = n.parentElement) {
68
+ let e = getComputedStyle(n).touchAction;
69
+ if (e && e !== "auto" && e !== "manipulation" && !r.test(e)) return !0;
70
+ }
71
+ return !1;
72
+ }
73
+ function s(e, t, n) {
74
+ for (let r = e; r; r = r.parentElement) {
75
+ let e = getComputedStyle(r), i = t === "y" ? e.overflowY : e.overflowX;
76
+ if (r === r.ownerDocument.scrollingElement ? i === "hidden" || i === "clip" : !/auto|scroll/.test(i)) continue;
77
+ let a = t === "y" ? r.scrollHeight - r.clientHeight : r.scrollWidth - r.clientWidth;
78
+ if (a <= 0) continue;
79
+ let o = t === "x" && e.direction === "rtl", s = t === "y" ? r.scrollTop : o ? r.scrollLeft + a : r.scrollLeft;
80
+ if (n > 0 ? s > 0 : s < a - 1) return !0;
81
+ }
82
+ return !1;
83
+ }
84
+ //#endregion
85
+ export { n as FLICK_SPEED, a as useSwipe };
@@ -1 +1 @@
1
- {"version":3,"file":"useAnchoredPopup.d.ts","sourceRoot":"","sources":["../../packages/utils/useAnchoredPopup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAmD,MAAM,OAAO,CAAC;AAElG;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,WAAW,GAAG,cAAc,EAAE,EACrE,KAAe,EACf,MAAU,EACV,UAAkB,EAClB,YAAY,GACf,GAAE,oBAAyB;;;oBAgBb,OAAO;;;eA6CkD,aAAa;;;;;;;;;;;;;EAJpF;AAED,gGAAgG;AAChG,wBAAgB,SAAS,CAAC,EAAE,EAAE,MAAM;;WACoC,aAAa;EACpF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CA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UAAU,aAAa;IACnB,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;CAChC;AAYD,8FAA8F;AAC9F,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,QAiCnE;AAiCD,MAAM,WAAW,oBAAoB;IACjC,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC;IACnC,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
@@ -61,12 +61,6 @@ function s(e, { align: t = "start", offset: n = 4, width: r } = {}) {
61
61
  positionArea: i,
62
62
  positionTryFallbacks: "flip-block",
63
63
  inset: "auto",
64
- margin: `${n}px 0`,
65
- transformOrigin: {
66
- start: "top left",
67
- end: "top right",
68
- center: "top"
69
- }[t],
70
64
  ...r === "at-least" && {
71
65
  width: "max-content",
72
66
  minWidth: "anchor-size(width)"
@@ -113,12 +107,12 @@ function f(e) {
113
107
  "position-area",
114
108
  "position-try-fallbacks"
115
109
  ]) s.removeProperty(e);
116
- s.inset = "0 auto auto 0", s.margin = "0", a === "match" && (s.width = `${o.width}px`), a === "at-least" && (s.minWidth = `${o.width}px`);
110
+ s.inset = "0 auto auto 0", a === "match" && (s.width = `${o.width}px`), a === "at-least" && (s.minWidth = `${o.width}px`);
117
111
  let c = {
118
112
  width: e.offsetWidth,
119
113
  height: e.offsetHeight
120
- }, l = document.documentElement.clientWidth, u = window.innerHeight, f = o.bottom + i, p = o.top - i - c.height, m = f + c.height > u - d && p >= d ? p : f, h = getComputedStyle(n).direction === "rtl", g = h ? o.right - c.width : o.left, _ = h ? o.left : o.right - c.width, v = r === "center" ? o.left + (o.width - c.width) / 2 : r === "end" ? _ : g;
121
- s.top = `${m}px`, s.transformOrigin = s.transformOrigin.replace(/top|bottom/, m === p ? "bottom" : "top"), s.left = `${Math.max(d, Math.min(v, l - c.width - d))}px`;
114
+ }, l = document.documentElement.clientWidth, u = document.documentElement.clientHeight, f = o.bottom + i + c.height > u - d && o.top - i - c.height >= d, p = getComputedStyle(n).direction === "rtl", m = p ? o.right - c.width : o.left, h = p ? o.left : o.right - c.width, g = r === "center" ? o.left + (o.width - c.width) / 2 : r === "end" ? h : m;
115
+ s.top = f ? "auto" : `${o.bottom}px`, s.bottom = f ? `${u - o.top}px` : "auto", s.left = `${Math.max(d, Math.min(g, l - c.width - d))}px`;
122
116
  }
123
117
  //#endregion
124
118
  export { o as anchorFor, s as anchoredStyle, u as useAnchorFallback, a as useAnchoredPopup };