@devalok/shilp-sutra-karm 0.13.0 → 0.14.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.
@@ -1,15 +1,15 @@
1
1
  "use client";
2
2
  import { jsx as e, jsxs as s } from "react/jsx-runtime";
3
- import * as y from "react";
4
- import { useState as w } from "react";
5
- import { IconCheck as k, IconCoffee as A, IconClock as C, IconArrowRight as D, IconSparkles as I, IconChevronDown as _, IconChevronUp as R } from "@tabler/icons-react";
6
- import { cn as p } from "@devalok/shilp-sutra/ui/lib/utils";
7
- import { M as j } from "./vendor.js";
8
- function M() {
9
- const l = (/* @__PURE__ */ new Date()).getHours();
10
- return l < 12 ? "Good morning" : l < 17 ? "Good afternoon" : "Good evening";
3
+ import * as w from "react";
4
+ import { useState as k } from "react";
5
+ import { IconCheck as D, IconCoffee as A, IconClock as C, IconArrowRight as M, IconSparkles as v, IconChevronDown as I, IconRefresh as T } from "@tabler/icons-react";
6
+ import { cn as c } from "@devalok/shilp-sutra/ui/lib/utils";
7
+ import { M as R } from "./vendor.js";
8
+ function _() {
9
+ const i = (/* @__PURE__ */ new Date()).getHours();
10
+ return i < 12 ? "Good morning" : i < 17 ? "Good afternoon" : "Good evening";
11
11
  }
12
- function T() {
12
+ function j() {
13
13
  return (/* @__PURE__ */ new Date()).toLocaleDateString("en-IN", {
14
14
  weekday: "long",
15
15
  day: "numeric",
@@ -18,52 +18,52 @@ function T() {
18
18
  timeZone: "Asia/Kolkata"
19
19
  });
20
20
  }
21
- function B(l) {
22
- return new Date(l).toLocaleTimeString("en-IN", {
21
+ function B(i) {
22
+ return new Date(i).toLocaleTimeString("en-IN", {
23
23
  hour: "2-digit",
24
24
  minute: "2-digit",
25
25
  hour12: !0,
26
26
  timeZone: "Asia/Kolkata"
27
27
  });
28
28
  }
29
- const O = y.forwardRef(
29
+ const G = w.forwardRef(
30
30
  function({
31
- userName: a,
31
+ userName: r,
32
32
  attendance: t,
33
- canMarkAttendance: o,
34
- onMarkAttendance: c,
35
- isSubmitting: d = !1,
36
- formatTime: h = B
37
- }, r) {
38
- var u, g;
39
- const i = ((u = t == null ? void 0 : t.attendance) == null ? void 0 : u.status) ?? "Not_Marked", N = i === "PRESENT" || d, f = i === "BREAK", b = (g = t == null ? void 0 : t.attendance) == null ? void 0 : g.timeIn, n = M(), m = (a == null ? void 0 : a.split(" ")[0]) || "there", x = T();
40
- return N && !f ? /* @__PURE__ */ e("div", { ref: r, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-05b sm:px-ds-07", children: [
33
+ canMarkAttendance: m,
34
+ onMarkAttendance: l,
35
+ isSubmitting: a = !1,
36
+ formatTime: u = B
37
+ }, x) {
38
+ var b, N;
39
+ const f = ((b = t == null ? void 0 : t.attendance) == null ? void 0 : b.status) ?? "Not_Marked", h = f === "PRESENT" || a, p = f === "BREAK", g = (N = t == null ? void 0 : t.attendance) == null ? void 0 : N.timeIn, n = _(), o = (r == null ? void 0 : r.split(" ")[0]) || "there", d = j();
40
+ return h && !p ? /* @__PURE__ */ e("div", { ref: x, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-05b sm:px-ds-07", children: [
41
41
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-ds-02", children: [
42
42
  /* @__PURE__ */ s("h2", { className: "text-ds-2xl text-text-primary", children: [
43
43
  n,
44
44
  ",",
45
45
  " ",
46
- /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: m })
46
+ /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: o })
47
47
  ] }),
48
- /* @__PURE__ */ e("p", { className: "text-ds-md text-text-tertiary", children: x })
48
+ /* @__PURE__ */ e("p", { className: "text-ds-md text-text-tertiary", children: d })
49
49
  ] }),
50
50
  /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03 rounded-ds-xl bg-success-surface px-ds-05 py-ds-03", children: [
51
- /* @__PURE__ */ e("div", { className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-full bg-text-success", children: /* @__PURE__ */ e(k, { className: "h-ico-sm w-ico-sm text-text-on-color" }) }),
51
+ /* @__PURE__ */ e("div", { className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-full bg-text-success", children: /* @__PURE__ */ e(D, { className: "h-ico-sm w-ico-sm text-text-on-color" }) }),
52
52
  /* @__PURE__ */ s("span", { className: "text-ds-md font-semibold text-text-success", children: [
53
53
  "Marked at",
54
54
  " ",
55
- b ? h(b) : "--:--"
55
+ g ? u(g) : "--:--"
56
56
  ] })
57
57
  ] })
58
- ] }) }) : f ? /* @__PURE__ */ e("div", { ref: r, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-05b sm:px-ds-07", children: [
58
+ ] }) }) : p ? /* @__PURE__ */ e("div", { ref: x, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-05b sm:px-ds-07", children: [
59
59
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-ds-02", children: [
60
60
  /* @__PURE__ */ s("h2", { className: "text-ds-2xl text-text-primary", children: [
61
61
  n,
62
62
  ",",
63
63
  " ",
64
- /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: m })
64
+ /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: o })
65
65
  ] }),
66
- /* @__PURE__ */ e("p", { className: "text-ds-md text-text-tertiary", children: x })
66
+ /* @__PURE__ */ e("p", { className: "text-ds-md text-text-tertiary", children: d })
67
67
  ] }),
68
68
  /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03 rounded-ds-xl bg-warning-surface px-ds-05 py-ds-03", children: [
69
69
  /* @__PURE__ */ e(A, { className: "h-ico-sm w-ico-sm text-text-warning" }),
@@ -72,38 +72,38 @@ const O = y.forwardRef(
72
72
  t != null && t.breakReason ? ` — ${t.breakReason}` : ""
73
73
  ] })
74
74
  ] })
75
- ] }) }) : o ? /* @__PURE__ */ e("div", { ref: r, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-gradient-to-br from-interactive-subtle via-background to-success-surface", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-07 sm:px-ds-07 sm:py-ds-08", children: [
75
+ ] }) }) : m ? /* @__PURE__ */ e("div", { ref: x, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-gradient-to-br from-interactive-subtle via-background to-success-surface", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-07 sm:px-ds-07 sm:py-ds-08", children: [
76
76
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-ds-02b", children: [
77
77
  /* @__PURE__ */ s("h2", { className: "text-ds-3xl text-text-primary", children: [
78
78
  n,
79
79
  ",",
80
80
  " ",
81
- /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: m })
81
+ /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: o })
82
82
  ] }),
83
- /* @__PURE__ */ e("div", { className: "flex items-center gap-ds-03", children: /* @__PURE__ */ e("p", { className: "text-ds-base text-text-tertiary", children: x }) })
83
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-ds-03", children: /* @__PURE__ */ e("p", { className: "text-ds-base text-text-tertiary", children: d }) })
84
84
  ] }),
85
85
  /* @__PURE__ */ s(
86
86
  "button",
87
87
  {
88
88
  type: "button",
89
- onClick: c,
90
- disabled: d,
89
+ onClick: l,
90
+ disabled: a,
91
91
  className: "flex items-center gap-ds-03 rounded-ds-xl bg-interactive px-ds-06 py-ds-04 font-semibold text-text-on-color shadow-02 transition-all duration-moderate-01 ease-expressive-standard hover:-translate-y-0.5 hover:shadow-03 active:translate-y-0 active:scale-[0.98] disabled:opacity-[0.38]",
92
92
  children: [
93
- d ? "Marking..." : "Mark Attendance",
94
- !d && /* @__PURE__ */ e(D, { className: "h-ico-sm w-ico-sm" })
93
+ a ? "Marking..." : "Mark Attendance",
94
+ !a && /* @__PURE__ */ e(M, { className: "h-ico-sm w-ico-sm" })
95
95
  ]
96
96
  }
97
97
  )
98
- ] }) }) : /* @__PURE__ */ e("div", { ref: r, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-06 sm:px-ds-07 sm:py-ds-07", children: [
98
+ ] }) }) : /* @__PURE__ */ e("div", { ref: x, className: "relative overflow-hidden rounded-ds-2xl border border-border bg-layer-01 shadow-01", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-06 py-ds-06 sm:px-ds-07 sm:py-ds-07", children: [
99
99
  /* @__PURE__ */ s("div", { className: "flex flex-col gap-ds-02b", children: [
100
100
  /* @__PURE__ */ s("h2", { className: "text-ds-3xl text-text-primary", children: [
101
101
  n,
102
102
  ",",
103
103
  " ",
104
- /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: m })
104
+ /* @__PURE__ */ e("span", { className: "font-semibold italic text-interactive", children: o })
105
105
  ] }),
106
- /* @__PURE__ */ e("p", { className: "text-ds-base text-text-tertiary", children: x })
106
+ /* @__PURE__ */ e("p", { className: "text-ds-base text-text-tertiary", children: d })
107
107
  ] }),
108
108
  /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03 rounded-ds-xl bg-layer-02 px-ds-05 py-ds-03", children: [
109
109
  /* @__PURE__ */ e(C, { className: "h-ico-sm w-ico-sm text-text-placeholder" }),
@@ -112,66 +112,115 @@ const O = y.forwardRef(
112
112
  ] }) });
113
113
  }
114
114
  );
115
- O.displayName = "AttendanceCTA";
116
- const v = [
115
+ G.displayName = "AttendanceCTA";
116
+ function O(i) {
117
+ const r = new Date(i), m = (/* @__PURE__ */ new Date()).getTime() - r.getTime(), l = Math.floor(m / 6e4);
118
+ if (l < 1) return "just now";
119
+ if (l < 60) return `${l}m ago`;
120
+ const a = Math.floor(l / 60);
121
+ return a < 24 ? `${a}h ago` : `${Math.floor(a / 24)}d ago`;
122
+ }
123
+ const y = [
117
124
  "bg-category-amber",
118
125
  "bg-category-teal",
119
126
  "bg-category-cyan",
120
127
  "bg-interactive",
121
128
  "bg-accent"
122
- ], G = y.forwardRef(
129
+ ], $ = w.forwardRef(
123
130
  function({
124
- data: a,
131
+ data: r,
125
132
  loading: t = !1,
126
- className: o
127
- }, c) {
128
- const [d, h] = w(!1);
129
- return t ? /* @__PURE__ */ s("div", { ref: c, className: p("flex flex-col gap-ds-04 rounded-ds-2xl border border-border bg-layer-01 shadow-01 p-ds-05b", o), children: [
130
- /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
131
- /* @__PURE__ */ e("div", { className: "h-ico-sm w-ico-sm animate-pulse rounded bg-layer-02" }),
132
- /* @__PURE__ */ e("div", { className: "h-4 w-24 animate-pulse rounded bg-layer-02" })
133
- ] }),
134
- [1, 2, 3].map((r) => /* @__PURE__ */ s("div", { className: "flex items-start gap-ds-04", children: [
135
- /* @__PURE__ */ e("div", { className: "mt-ds-02b h-2 w-2 shrink-0 animate-pulse rounded-ds-full bg-layer-02" }),
136
- /* @__PURE__ */ e(
137
- "div",
133
+ onRefresh: m,
134
+ unavailable: l = !1,
135
+ collapsible: a = !0,
136
+ defaultCollapsed: u = !1,
137
+ title: x,
138
+ className: f
139
+ }, h) {
140
+ const [p, g] = k(u), n = x ?? "Morning Brief";
141
+ if (t && !r)
142
+ return /* @__PURE__ */ s("div", { ref: h, className: c("flex flex-col gap-ds-04 rounded-ds-2xl border border-border bg-layer-01 shadow-01 p-ds-05b", f), children: [
143
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
144
+ /* @__PURE__ */ e("div", { className: "h-ico-sm w-ico-sm animate-pulse rounded bg-layer-02" }),
145
+ /* @__PURE__ */ e("div", { className: "h-4 w-24 animate-pulse rounded bg-layer-02" })
146
+ ] }),
147
+ [1, 2, 3].map((d) => /* @__PURE__ */ s("div", { className: "flex items-start gap-ds-04", children: [
148
+ /* @__PURE__ */ e("div", { className: "mt-ds-02b h-2 w-2 shrink-0 animate-pulse rounded-ds-full bg-layer-02" }),
149
+ /* @__PURE__ */ e(
150
+ "div",
151
+ {
152
+ className: "h-4 animate-pulse rounded bg-layer-02",
153
+ style: { width: `${60 + d * 10}%` }
154
+ }
155
+ )
156
+ ] }, d))
157
+ ] });
158
+ if (l)
159
+ return /* @__PURE__ */ s("div", { ref: h, className: c("flex items-center gap-ds-03 rounded-ds-2xl border border-border bg-layer-01 shadow-01 px-ds-05b py-ds-05", f), children: [
160
+ /* @__PURE__ */ e(v, { className: "h-ico-sm w-ico-sm text-text-placeholder" }),
161
+ /* @__PURE__ */ e("span", { className: "text-ds-sm text-text-placeholder", children: "AI brief unavailable" })
162
+ ] });
163
+ if (!r || r.brief.length === 0) return null;
164
+ const o = !a || !p;
165
+ return /* @__PURE__ */ s("div", { ref: h, className: c("flex flex-col rounded-ds-2xl border border-border bg-layer-01 shadow-01", f), children: [
166
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-05b py-ds-05", children: [
167
+ a ? /* @__PURE__ */ s(
168
+ "button",
138
169
  {
139
- className: "h-4 animate-pulse rounded bg-layer-02",
140
- style: { width: `${60 + r * 10}%` }
170
+ type: "button",
171
+ "aria-label": "Toggle brief",
172
+ "aria-expanded": o,
173
+ onClick: () => g(!p),
174
+ className: "flex flex-1 items-center gap-ds-03 transition-colors hover:opacity-80",
175
+ children: [
176
+ /* @__PURE__ */ e(v, { className: "h-ico-sm w-ico-sm text-interactive" }),
177
+ /* @__PURE__ */ e("span", { className: "text-ds-base font-semibold text-text-primary", children: n }),
178
+ /* @__PURE__ */ e(
179
+ I,
180
+ {
181
+ className: c(
182
+ "h-ico-sm w-ico-sm text-text-placeholder transition-transform duration-200",
183
+ o && "rotate-180"
184
+ )
185
+ }
186
+ )
187
+ ]
141
188
  }
142
- )
143
- ] }, r))
144
- ] }) : !a || a.brief.length === 0 ? null : /* @__PURE__ */ s("div", { ref: c, className: p("flex flex-col rounded-ds-2xl border border-border bg-layer-01 shadow-01", o), children: [
145
- /* @__PURE__ */ s(
146
- "button",
147
- {
148
- type: "button",
149
- "aria-label": "Toggle brief",
150
- onClick: () => h(!d),
151
- className: "flex items-center justify-between px-ds-05b py-ds-05 transition-colors hover:bg-layer-02",
152
- children: [
153
- /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
154
- /* @__PURE__ */ e(I, { className: "h-ico-sm w-ico-sm text-interactive" }),
155
- /* @__PURE__ */ e("span", { className: "text-ds-base font-semibold text-text-primary", children: "Morning Brief" })
156
- ] }),
157
- d ? /* @__PURE__ */ e(_, { className: "h-ico-sm w-ico-sm text-text-placeholder" }) : /* @__PURE__ */ e(R, { className: "h-ico-sm w-ico-sm text-text-placeholder" })
158
- ]
159
- }
160
- ),
161
- !d && /* @__PURE__ */ e("div", { className: "flex flex-col gap-ds-03 border-t border-border px-ds-05b pb-ds-05b pt-ds-05", children: a.brief.map((r, i) => /* @__PURE__ */ s("div", { className: "flex items-start gap-ds-04", children: [
162
- /* @__PURE__ */ e(
163
- "div",
189
+ ) : /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
190
+ /* @__PURE__ */ e(v, { className: "h-ico-sm w-ico-sm text-interactive" }),
191
+ /* @__PURE__ */ e("span", { className: "text-ds-base font-semibold text-text-primary", children: n })
192
+ ] }),
193
+ /* @__PURE__ */ e("div", { className: "flex items-center gap-ds-02", children: m && /* @__PURE__ */ e(
194
+ "button",
164
195
  {
165
- className: p("mt-ds-02b h-2 w-2 shrink-0 rounded-ds-full", v[i % v.length])
196
+ type: "button",
197
+ onClick: m,
198
+ "aria-label": "Refresh brief",
199
+ className: "p-1.5 rounded hover:bg-layer-02 transition-colors",
200
+ children: /* @__PURE__ */ e(T, { className: c("h-ico-sm w-ico-sm text-text-placeholder", t && "animate-spin") })
166
201
  }
167
- ),
168
- /* @__PURE__ */ e("div", { className: "text-ds-md text-text-secondary [&_p]:mb-0 [&_strong]:font-semibold [&_code]:rounded [&_code]:bg-field [&_code]:px-1 [&_code]:py-ds-01 [&_code]:text-ds-sm [&_a]:text-interactive [&_a]:underline", children: /* @__PURE__ */ e(j, { children: r }) })
169
- ] }, i)) })
202
+ ) })
203
+ ] }),
204
+ /* @__PURE__ */ e("div", { className: c("grid transition-[grid-template-rows] duration-200", o ? "grid-rows-[1fr]" : "grid-rows-[0fr]"), children: /* @__PURE__ */ e("div", { className: "overflow-hidden", children: /* @__PURE__ */ s("div", { className: "flex flex-col gap-ds-03 border-t border-border px-ds-05b pb-ds-05b pt-ds-05", children: [
205
+ r.brief.map((d, b) => /* @__PURE__ */ s("div", { className: "flex items-start gap-ds-04", children: [
206
+ /* @__PURE__ */ e(
207
+ "div",
208
+ {
209
+ className: c("mt-ds-02b h-2 w-2 shrink-0 rounded-ds-full", y[b % y.length])
210
+ }
211
+ ),
212
+ /* @__PURE__ */ e("div", { className: "text-ds-md text-text-secondary [&_p]:mb-0 [&_strong]:font-semibold [&_code]:rounded [&_code]:bg-field [&_code]:px-1 [&_code]:py-ds-01 [&_code]:text-ds-sm [&_a]:text-interactive [&_a]:underline", children: /* @__PURE__ */ e(R, { children: d }) })
213
+ ] }, b)),
214
+ /* @__PURE__ */ s("div", { className: "mt-ds-02 text-ds-xs text-text-placeholder", children: [
215
+ "Generated ",
216
+ O(r.generatedAt)
217
+ ] })
218
+ ] }) }) })
170
219
  ] });
171
220
  }
172
221
  );
173
- G.displayName = "DailyBrief";
222
+ $.displayName = "DailyBrief";
174
223
  export {
175
- O as A,
176
- G as D
224
+ G as A,
225
+ $ as D
177
226
  };
@@ -6,6 +6,11 @@ export interface BriefData {
6
6
  export interface DailyBriefProps {
7
7
  data: BriefData | null;
8
8
  loading?: boolean;
9
+ onRefresh?: () => void;
10
+ unavailable?: boolean;
11
+ collapsible?: boolean;
12
+ defaultCollapsed?: boolean;
13
+ title?: string;
9
14
  className?: string;
10
15
  }
11
16
  declare const DailyBrief: React.ForwardRefExoticComponent<DailyBriefProps & React.RefAttributes<HTMLDivElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"daily-brief.d.ts","sourceRoot":"","sources":["../../src/dashboard/daily-brief.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAcD,QAAA,MAAM,UAAU,wFAqEf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,CAAA"}
1
+ {"version":3,"file":"daily-brief.d.ts","sourceRoot":"","sources":["../../src/dashboard/daily-brief.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAU9B,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,IAAI,CAAA;IACtB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA+BD,QAAA,MAAM,UAAU,wFAkHf,CAAA;AAID,OAAO,EAAE,UAAU,EAAE,CAAA"}
@@ -1,3 +1,5 @@
1
1
  export { AttendanceCTA, type AttendanceCTAProps } from './attendance-cta';
2
2
  export { DailyBrief, type BriefData, type DailyBriefProps } from './daily-brief';
3
+ export { ScratchpadWidget, type ScratchpadItem, type ScratchpadWidgetProps } from './scratchpad-widget';
4
+ export { SidebarScratchpad, type SidebarScratchpadProps } from './sidebar-scratchpad';
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dashboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAA;AAChF,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,KAAK,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AACvG,OAAO,EAAE,iBAAiB,EAAE,KAAK,sBAAsB,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1,6 +1,270 @@
1
1
  "use client";
2
- import { A as r, D as t } from "../_chunks/daily-brief.js";
2
+ import { A as Q, D as V } from "../_chunks/daily-brief.js";
3
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
4
+ import * as I from "react";
5
+ import { useState as v, useRef as W, useEffect as _ } from "react";
6
+ import { IconX as $, IconChevronDown as B } from "@tabler/icons-react";
7
+ import { cn as l } from "@devalok/shilp-sutra/ui/lib/utils";
8
+ import { Checkbox as A } from "@devalok/shilp-sutra/ui/checkbox";
9
+ import { Input as G } from "@devalok/shilp-sutra/ui/input";
10
+ import { Button as M } from "@devalok/shilp-sutra/ui/button";
11
+ const d = 20, w = 2, k = (d - w) / 2, D = 2 * Math.PI * k;
12
+ function K({ count: h, max: a, allDone: n }) {
13
+ const i = a > 0 ? h / a : 0, o = D * (1 - i);
14
+ return /* @__PURE__ */ s("div", { className: l("relative flex items-center justify-center", n && "animate-[scale-pulse_300ms_ease-out]"), children: [
15
+ /* @__PURE__ */ s("svg", { width: d, height: d, viewBox: `0 0 ${d} ${d}`, className: "-rotate-90", children: [
16
+ /* @__PURE__ */ e(
17
+ "circle",
18
+ {
19
+ cx: d / 2,
20
+ cy: d / 2,
21
+ r: k,
22
+ fill: "none",
23
+ strokeWidth: w,
24
+ className: "stroke-layer-02"
25
+ }
26
+ ),
27
+ /* @__PURE__ */ e(
28
+ "circle",
29
+ {
30
+ cx: d / 2,
31
+ cy: d / 2,
32
+ r: k,
33
+ fill: "none",
34
+ strokeWidth: w,
35
+ strokeLinecap: "round",
36
+ strokeDasharray: D,
37
+ strokeDashoffset: o,
38
+ className: l(
39
+ "transition-all duration-300",
40
+ n ? "stroke-success" : "stroke-interactive"
41
+ )
42
+ }
43
+ )
44
+ ] }),
45
+ /* @__PURE__ */ s("span", { className: "absolute text-[8px] font-medium text-text-secondary", "data-testid": "progress-count", children: [
46
+ h,
47
+ "/",
48
+ a
49
+ ] })
50
+ ] });
51
+ }
52
+ const z = I.forwardRef(
53
+ function({
54
+ items: a,
55
+ maxItems: n = 5,
56
+ onToggle: i,
57
+ onAdd: o,
58
+ onDelete: f,
59
+ title: m = "My Scratchpad",
60
+ resetLabel: c,
61
+ emptyText: u = "Nothing here yet. Add a task!",
62
+ emptyIcon: r,
63
+ loading: g = !1,
64
+ className: S
65
+ }, R) {
66
+ const [p, y] = v(!1), [N, x] = v(""), b = W(null), j = a.length > 0 && a.every((t) => t.done);
67
+ _(() => {
68
+ p && b.current && b.current.focus();
69
+ }, [p]);
70
+ function C() {
71
+ const t = N.trim();
72
+ t && (o(t), x(""));
73
+ }
74
+ function E(t) {
75
+ t.key === "Enter" ? (t.preventDefault(), C()) : t.key === "Escape" && (y(!1), x(""));
76
+ }
77
+ return g ? /* @__PURE__ */ s(
78
+ "div",
79
+ {
80
+ ref: R,
81
+ className: l(
82
+ "flex flex-col gap-ds-04 rounded-ds-2xl border border-border bg-layer-01 shadow-01 p-ds-05b",
83
+ S
84
+ ),
85
+ children: [
86
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: [
87
+ /* @__PURE__ */ e("div", { className: "h-4 w-28 animate-pulse rounded bg-layer-02" }),
88
+ /* @__PURE__ */ e("div", { className: "h-5 w-5 animate-pulse rounded-full bg-layer-02" })
89
+ ] }),
90
+ [1, 2, 3].map((t) => /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
91
+ /* @__PURE__ */ e("div", { className: "h-ico-md w-ico-md shrink-0 animate-pulse rounded-ds-sm bg-layer-02" }),
92
+ /* @__PURE__ */ e(
93
+ "div",
94
+ {
95
+ className: "h-4 animate-pulse rounded bg-layer-02",
96
+ style: { width: `${50 + t * 12}%` }
97
+ }
98
+ )
99
+ ] }, t))
100
+ ]
101
+ }
102
+ ) : /* @__PURE__ */ s(
103
+ "div",
104
+ {
105
+ ref: R,
106
+ className: l(
107
+ "flex flex-col rounded-ds-2xl border border-border bg-layer-01 shadow-01",
108
+ S
109
+ ),
110
+ children: [
111
+ /* @__PURE__ */ s("div", { className: "flex items-center justify-between px-ds-05b py-ds-05", children: [
112
+ /* @__PURE__ */ e("span", { className: "text-ds-base font-semibold text-text-primary", children: m }),
113
+ /* @__PURE__ */ e(K, { count: a.length, max: n, allDone: j })
114
+ ] }),
115
+ /* @__PURE__ */ s("div", { className: "flex flex-col border-t border-border px-ds-05b pb-ds-04 pt-ds-04", children: [
116
+ a.length === 0 && !p ? /* @__PURE__ */ s("div", { className: "flex flex-col items-center justify-center gap-ds-03 py-ds-06 text-center", children: [
117
+ r && /* @__PURE__ */ e(r, { className: "h-ico-lg w-ico-lg text-text-placeholder" }),
118
+ /* @__PURE__ */ e("span", { className: "text-ds-md text-text-placeholder", children: u })
119
+ ] }) : /* @__PURE__ */ e("div", { className: "flex flex-col gap-ds-02b", children: a.map((t) => /* @__PURE__ */ s(
120
+ "div",
121
+ {
122
+ className: "group flex items-center gap-ds-03 rounded-ds-md px-ds-02 py-ds-02 transition-colors hover:bg-layer-02",
123
+ children: [
124
+ /* @__PURE__ */ e(
125
+ A,
126
+ {
127
+ checked: t.done,
128
+ onCheckedChange: (T) => i(t.id, T === !0),
129
+ "aria-label": `Toggle ${t.text}`
130
+ }
131
+ ),
132
+ /* @__PURE__ */ e(
133
+ "span",
134
+ {
135
+ className: l(
136
+ "flex-1 text-ds-md transition-all duration-200 ease-in-out",
137
+ t.done && "text-text-placeholder line-through"
138
+ ),
139
+ children: t.text
140
+ }
141
+ ),
142
+ /* @__PURE__ */ e(
143
+ "button",
144
+ {
145
+ type: "button",
146
+ onClick: () => f(t.id),
147
+ "aria-label": `Delete ${t.text}`,
148
+ className: "flex h-ico-md w-ico-md items-center justify-center rounded-ds-sm opacity-0 transition-opacity group-hover:opacity-100 group-focus-within:opacity-100 hover:bg-layer-03",
149
+ children: /* @__PURE__ */ e($, { className: "h-3 w-3 text-text-placeholder" })
150
+ }
151
+ )
152
+ ]
153
+ },
154
+ t.id
155
+ )) }),
156
+ a.length < n && /* @__PURE__ */ e("div", { className: "mt-ds-02b", children: p ? /* @__PURE__ */ s("div", { className: "flex items-center gap-ds-03", children: [
157
+ /* @__PURE__ */ e(
158
+ G,
159
+ {
160
+ ref: b,
161
+ size: "sm",
162
+ value: N,
163
+ onChange: (t) => x(t.target.value),
164
+ onKeyDown: E,
165
+ onBlur: () => {
166
+ N.trim() || (y(!1), x(""));
167
+ },
168
+ placeholder: "What needs doing?",
169
+ className: "flex-1"
170
+ }
171
+ ),
172
+ /* @__PURE__ */ e(
173
+ M,
174
+ {
175
+ size: "sm",
176
+ onClick: C,
177
+ onMouseDown: (t) => t.preventDefault(),
178
+ children: "Add"
179
+ }
180
+ )
181
+ ] }) : /* @__PURE__ */ e(
182
+ "button",
183
+ {
184
+ type: "button",
185
+ onClick: () => y(!0),
186
+ className: "w-full rounded-ds-md px-ds-02 py-ds-02 text-left text-ds-md text-text-placeholder transition-colors hover:bg-layer-02",
187
+ children: "+ Add a task..."
188
+ }
189
+ ) }),
190
+ c && /* @__PURE__ */ e("span", { className: "mt-ds-03 text-ds-xs text-text-placeholder", children: c })
191
+ ] })
192
+ ]
193
+ }
194
+ );
195
+ }
196
+ );
197
+ z.displayName = "ScratchpadWidget";
198
+ const O = I.forwardRef(
199
+ function({ items: a, onToggle: n, defaultOpen: i = !0, badgeCount: o, className: f }, m) {
200
+ const [c, u] = v(i);
201
+ return /* @__PURE__ */ s("div", { ref: m, className: l("flex flex-col", f), children: [
202
+ /* @__PURE__ */ s(
203
+ "button",
204
+ {
205
+ type: "button",
206
+ onClick: () => u((r) => !r),
207
+ "aria-expanded": c,
208
+ className: "flex w-full items-center gap-ds-02 px-ds-03 py-ds-02 text-left text-ds-xs font-semibold text-text-secondary transition-colors hover:bg-layer-02",
209
+ children: [
210
+ /* @__PURE__ */ e(
211
+ B,
212
+ {
213
+ className: l(
214
+ "h-3.5 w-3.5 shrink-0 transition-transform duration-200",
215
+ !c && "-rotate-180"
216
+ )
217
+ }
218
+ ),
219
+ /* @__PURE__ */ e("span", { className: "flex-1", children: "Scratchpad" }),
220
+ o != null && o > 0 && /* @__PURE__ */ e("span", { className: "rounded-full bg-layer-02 px-1.5 text-ds-xs text-text-secondary", children: o })
221
+ ]
222
+ }
223
+ ),
224
+ /* @__PURE__ */ e(
225
+ "div",
226
+ {
227
+ className: l(
228
+ "grid transition-[grid-template-rows] duration-200",
229
+ c ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
230
+ ),
231
+ children: /* @__PURE__ */ e("div", { className: "overflow-hidden", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-0.5 px-ds-03 pb-ds-02", children: a.map((r) => /* @__PURE__ */ s(
232
+ "label",
233
+ {
234
+ className: "flex cursor-pointer items-center gap-ds-02 rounded-ds-sm px-ds-02 py-0.5 transition-colors hover:bg-layer-02",
235
+ children: [
236
+ /* @__PURE__ */ e(
237
+ A,
238
+ {
239
+ checked: r.done,
240
+ onCheckedChange: (g) => n(r.id, g === !0),
241
+ "aria-label": `Toggle ${r.text}`,
242
+ className: "h-3.5 w-3.5"
243
+ }
244
+ ),
245
+ /* @__PURE__ */ e(
246
+ "span",
247
+ {
248
+ className: l(
249
+ "flex-1 text-xs transition-all duration-200",
250
+ r.done ? "text-text-placeholder line-through" : "text-text-primary"
251
+ ),
252
+ children: r.text
253
+ }
254
+ )
255
+ ]
256
+ },
257
+ r.id
258
+ )) }) })
259
+ }
260
+ )
261
+ ] });
262
+ }
263
+ );
264
+ O.displayName = "SidebarScratchpad";
3
265
  export {
4
- r as AttendanceCTA,
5
- t as DailyBrief
266
+ Q as AttendanceCTA,
267
+ V as DailyBrief,
268
+ z as ScratchpadWidget,
269
+ O as SidebarScratchpad
6
270
  };
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ export interface ScratchpadItem {
3
+ id: string;
4
+ text: string;
5
+ done: boolean;
6
+ }
7
+ export interface ScratchpadWidgetProps {
8
+ items: ScratchpadItem[];
9
+ maxItems?: number;
10
+ onToggle: (id: string, done: boolean) => void;
11
+ onAdd: (text: string) => void;
12
+ onDelete: (id: string) => void;
13
+ onReorder?: (items: ScratchpadItem[]) => void;
14
+ title?: string;
15
+ resetLabel?: string;
16
+ emptyText?: string;
17
+ emptyIcon?: React.ComponentType<{
18
+ className?: string;
19
+ }>;
20
+ loading?: boolean;
21
+ className?: string;
22
+ }
23
+ declare const ScratchpadWidget: React.ForwardRefExoticComponent<ScratchpadWidgetProps & React.RefAttributes<HTMLDivElement>>;
24
+ export { ScratchpadWidget };
25
+ //# sourceMappingURL=scratchpad-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scratchpad-widget.d.ts","sourceRoot":"","sources":["../../src/dashboard/scratchpad-widget.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAY9B,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7C,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,IAAI,CAAA;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACvD,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAoDD,QAAA,MAAM,gBAAgB,8FAiLrB,CAAA;AAID,OAAO,EAAE,gBAAgB,EAAE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { ScratchpadItem } from './scratchpad-widget';
2
+ import * as React from 'react';
3
+ export interface SidebarScratchpadProps {
4
+ items: ScratchpadItem[];
5
+ onToggle: (id: string, done: boolean) => void;
6
+ defaultOpen?: boolean;
7
+ badgeCount?: number;
8
+ className?: string;
9
+ }
10
+ declare const SidebarScratchpad: React.ForwardRefExoticComponent<SidebarScratchpadProps & React.RefAttributes<HTMLDivElement>>;
11
+ export { SidebarScratchpad };
12
+ //# sourceMappingURL=sidebar-scratchpad.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar-scratchpad.d.ts","sourceRoot":"","sources":["../../src/dashboard/sidebar-scratchpad.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAMzD,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IAC7C,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAMD,QAAA,MAAM,iBAAiB,+FAkEtB,CAAA;AAID,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devalok/shilp-sutra-karm",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Domain components for Karm — board, tasks, chat, dashboard, client, and admin",
5
5
  "license": "MIT",
6
6
  "type": "module",