@otfdashkit/ui 0.1.8 → 0.1.10
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/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -21
- package/dist/index.mjs +23 -21
- package/package.json +1 -1
- package/src/advanced/rich-editor.tsx +3 -11
- package/src/components/DataTable/DataTable.tsx +1 -1
- package/src/data/DataGrid.tsx +1 -1
- package/src/data/EventCalendar.tsx +21 -5
package/dist/index.d.mts
CHANGED
|
@@ -1668,7 +1668,7 @@ type RichEditorProps = Omit<React__default.HTMLAttributes<HTMLDivElement>, 'onCh
|
|
|
1668
1668
|
onChange?: (html: string) => void;
|
|
1669
1669
|
/** Placeholder shown when the document is empty. */
|
|
1670
1670
|
placeholder?: string;
|
|
1671
|
-
/** Default true. When false the
|
|
1671
|
+
/** Default true. When false the content is read-only and no toolbar is shown. */
|
|
1672
1672
|
editable?: boolean;
|
|
1673
1673
|
/** Toolbar layout. Default 'full'. */
|
|
1674
1674
|
toolbar?: RichEditorToolbarVariant;
|
|
@@ -1684,7 +1684,7 @@ declare const RichEditor: React__default.ForwardRefExoticComponent<Omit<React__d
|
|
|
1684
1684
|
onChange?: (html: string) => void;
|
|
1685
1685
|
/** Placeholder shown when the document is empty. */
|
|
1686
1686
|
placeholder?: string;
|
|
1687
|
-
/** Default true. When false the
|
|
1687
|
+
/** Default true. When false the content is read-only and no toolbar is shown. */
|
|
1688
1688
|
editable?: boolean;
|
|
1689
1689
|
/** Toolbar layout. Default 'full'. */
|
|
1690
1690
|
toolbar?: RichEditorToolbarVariant;
|
package/dist/index.d.ts
CHANGED
|
@@ -1668,7 +1668,7 @@ type RichEditorProps = Omit<React__default.HTMLAttributes<HTMLDivElement>, 'onCh
|
|
|
1668
1668
|
onChange?: (html: string) => void;
|
|
1669
1669
|
/** Placeholder shown when the document is empty. */
|
|
1670
1670
|
placeholder?: string;
|
|
1671
|
-
/** Default true. When false the
|
|
1671
|
+
/** Default true. When false the content is read-only and no toolbar is shown. */
|
|
1672
1672
|
editable?: boolean;
|
|
1673
1673
|
/** Toolbar layout. Default 'full'. */
|
|
1674
1674
|
toolbar?: RichEditorToolbarVariant;
|
|
@@ -1684,7 +1684,7 @@ declare const RichEditor: React__default.ForwardRefExoticComponent<Omit<React__d
|
|
|
1684
1684
|
onChange?: (html: string) => void;
|
|
1685
1685
|
/** Placeholder shown when the document is empty. */
|
|
1686
1686
|
placeholder?: string;
|
|
1687
|
-
/** Default true. When false the
|
|
1687
|
+
/** Default true. When false the content is read-only and no toolbar is shown. */
|
|
1688
1688
|
editable?: boolean;
|
|
1689
1689
|
/** Toolbar layout. Default 'full'. */
|
|
1690
1690
|
toolbar?: RichEditorToolbarVariant;
|
package/dist/index.js
CHANGED
|
@@ -3503,7 +3503,7 @@ function DataTableColumnHeader({ column, title }) {
|
|
|
3503
3503
|
className: "flex items-center gap-1 hover:text-[hsl(var(--foreground))]",
|
|
3504
3504
|
children: [
|
|
3505
3505
|
title,
|
|
3506
|
-
sorted === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-3 w-3" }) : sorted === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "h-3 w-3
|
|
3506
|
+
sorted === "asc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-3 w-3" }) : sorted === "desc" ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "h-3 w-3" })
|
|
3507
3507
|
]
|
|
3508
3508
|
}
|
|
3509
3509
|
);
|
|
@@ -6998,24 +6998,12 @@ var RichEditor = React137__namespace.default.forwardRef(
|
|
|
6998
6998
|
className: cn(
|
|
6999
6999
|
"overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]",
|
|
7000
7000
|
"focus-within:ring-2 focus-within:ring-[hsl(var(--ring))]",
|
|
7001
|
-
!editable && "opacity-90",
|
|
7002
7001
|
className
|
|
7003
7002
|
),
|
|
7004
7003
|
...rest,
|
|
7005
7004
|
children: [
|
|
7006
|
-
/* @__PURE__ */ jsxRuntime.
|
|
7007
|
-
|
|
7008
|
-
{
|
|
7009
|
-
className: cn(
|
|
7010
|
-
!editable && "pointer-events-none select-none opacity-60"
|
|
7011
|
-
),
|
|
7012
|
-
"aria-hidden": !editable || void 0,
|
|
7013
|
-
children: [
|
|
7014
|
-
toolbar === "full" ? /* @__PURE__ */ jsxRuntime.jsx(FullToolbar, { editor }) : null,
|
|
7015
|
-
toolbar === "minimal" ? /* @__PURE__ */ jsxRuntime.jsx(MinimalToolbar, { editor }) : null
|
|
7016
|
-
]
|
|
7017
|
-
}
|
|
7018
|
-
),
|
|
7005
|
+
editable && toolbar === "full" ? /* @__PURE__ */ jsxRuntime.jsx(FullToolbar, { editor }) : null,
|
|
7006
|
+
editable && toolbar === "minimal" ? /* @__PURE__ */ jsxRuntime.jsx(MinimalToolbar, { editor }) : null,
|
|
7019
7007
|
/* @__PURE__ */ jsxRuntime.jsx(react$1.EditorContent, { editor }),
|
|
7020
7008
|
toolbar === "bubble" && editable ? /* @__PURE__ */ jsxRuntime.jsx(BubbleToolbar, { editor }) : null,
|
|
7021
7009
|
maxLength != null ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-end border-t border-[hsl(var(--border))] bg-[hsl(var(--muted))]/30 px-3 py-1.5", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -10845,7 +10833,7 @@ function Checkbox2({
|
|
|
10845
10833
|
function SortIcon({ dir }) {
|
|
10846
10834
|
if (dir === "asc") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUp, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10847
10835
|
if (dir === "desc") return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowDown, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10848
|
-
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "h-3.5 w-3.5 shrink-0
|
|
10836
|
+
return /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowUpDown, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10849
10837
|
}
|
|
10850
10838
|
function ColumnVisibilityDropdown({
|
|
10851
10839
|
columns,
|
|
@@ -11298,7 +11286,7 @@ var EventCalendar = React137__namespace.default.forwardRef(
|
|
|
11298
11286
|
"div",
|
|
11299
11287
|
{
|
|
11300
11288
|
"data-slot": "event-calendar-header",
|
|
11301
|
-
className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
11289
|
+
className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
11302
11290
|
children: [
|
|
11303
11291
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11304
11292
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -11338,7 +11326,7 @@ var EventCalendar = React137__namespace.default.forwardRef(
|
|
|
11338
11326
|
"div",
|
|
11339
11327
|
{
|
|
11340
11328
|
"data-slot": "event-calendar-title",
|
|
11341
|
-
className: "text-sm font-medium tabular-nums",
|
|
11329
|
+
className: "whitespace-nowrap text-sm font-medium tabular-nums",
|
|
11342
11330
|
children: headerLabel
|
|
11343
11331
|
}
|
|
11344
11332
|
),
|
|
@@ -11430,7 +11418,16 @@ function MonthView({
|
|
|
11430
11418
|
return Array.from({ length: 7 }, (_, i) => dateFns.format(dateFns.addDays(start, i), "EEE"));
|
|
11431
11419
|
}, [weekStartsOn]);
|
|
11432
11420
|
const today = /* @__PURE__ */ new Date();
|
|
11433
|
-
|
|
11421
|
+
const gridRef = React137__namespace.default.useRef(null);
|
|
11422
|
+
const [compact, setCompact] = React137__namespace.default.useState(false);
|
|
11423
|
+
React137__namespace.default.useEffect(() => {
|
|
11424
|
+
const el = gridRef.current;
|
|
11425
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
11426
|
+
const ro = new ResizeObserver(() => setCompact(el.clientWidth / 7 < 72));
|
|
11427
|
+
ro.observe(el);
|
|
11428
|
+
return () => ro.disconnect();
|
|
11429
|
+
}, []);
|
|
11430
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: gridRef, className: "flex flex-col", "data-slot": "event-calendar-month", children: [
|
|
11434
11431
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "grid grid-cols-7 border-b border-border", children: weekdayLabels.map((label) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
11435
11432
|
"div",
|
|
11436
11433
|
{
|
|
@@ -11493,6 +11490,7 @@ function MonthView({
|
|
|
11493
11490
|
EventChip,
|
|
11494
11491
|
{
|
|
11495
11492
|
event: ev,
|
|
11493
|
+
compact,
|
|
11496
11494
|
onClick: () => onEventClick?.(ev)
|
|
11497
11495
|
},
|
|
11498
11496
|
ev.id
|
|
@@ -11534,6 +11532,7 @@ function MonthView({
|
|
|
11534
11532
|
}
|
|
11535
11533
|
function EventChip({
|
|
11536
11534
|
event,
|
|
11535
|
+
compact,
|
|
11537
11536
|
onClick
|
|
11538
11537
|
}) {
|
|
11539
11538
|
const color = event.color ?? DEFAULT_COLOR3;
|
|
@@ -11547,7 +11546,10 @@ function EventChip({
|
|
|
11547
11546
|
onClick?.();
|
|
11548
11547
|
},
|
|
11549
11548
|
title: event.title,
|
|
11550
|
-
className:
|
|
11549
|
+
className: cn(
|
|
11550
|
+
"group/chip flex w-full items-center gap-1.5 truncate rounded px-1.5 py-0.5 text-left text-[11px] font-medium text-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
11551
|
+
compact && "h-4 justify-center px-0"
|
|
11552
|
+
),
|
|
11551
11553
|
style: {
|
|
11552
11554
|
backgroundColor: `color-mix(in oklab, ${color} 22%, transparent)`
|
|
11553
11555
|
},
|
|
@@ -11560,7 +11562,7 @@ function EventChip({
|
|
|
11560
11562
|
style: { backgroundColor: color }
|
|
11561
11563
|
}
|
|
11562
11564
|
),
|
|
11563
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate", children: event.title })
|
|
11565
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: compact ? "sr-only" : "truncate", children: event.title })
|
|
11564
11566
|
]
|
|
11565
11567
|
}
|
|
11566
11568
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -3450,7 +3450,7 @@ function DataTableColumnHeader({ column, title }) {
|
|
|
3450
3450
|
className: "flex items-center gap-1 hover:text-[hsl(var(--foreground))]",
|
|
3451
3451
|
children: [
|
|
3452
3452
|
title,
|
|
3453
|
-
sorted === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "h-3 w-3" }) : sorted === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-3 w-3
|
|
3453
|
+
sorted === "asc" ? /* @__PURE__ */ jsx(ArrowUp, { className: "h-3 w-3" }) : sorted === "desc" ? /* @__PURE__ */ jsx(ArrowDown, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-3 w-3" })
|
|
3454
3454
|
]
|
|
3455
3455
|
}
|
|
3456
3456
|
);
|
|
@@ -6945,24 +6945,12 @@ var RichEditor = React137__default.forwardRef(
|
|
|
6945
6945
|
className: cn(
|
|
6946
6946
|
"overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]",
|
|
6947
6947
|
"focus-within:ring-2 focus-within:ring-[hsl(var(--ring))]",
|
|
6948
|
-
!editable && "opacity-90",
|
|
6949
6948
|
className
|
|
6950
6949
|
),
|
|
6951
6950
|
...rest,
|
|
6952
6951
|
children: [
|
|
6953
|
-
/* @__PURE__ */
|
|
6954
|
-
|
|
6955
|
-
{
|
|
6956
|
-
className: cn(
|
|
6957
|
-
!editable && "pointer-events-none select-none opacity-60"
|
|
6958
|
-
),
|
|
6959
|
-
"aria-hidden": !editable || void 0,
|
|
6960
|
-
children: [
|
|
6961
|
-
toolbar === "full" ? /* @__PURE__ */ jsx(FullToolbar, { editor }) : null,
|
|
6962
|
-
toolbar === "minimal" ? /* @__PURE__ */ jsx(MinimalToolbar, { editor }) : null
|
|
6963
|
-
]
|
|
6964
|
-
}
|
|
6965
|
-
),
|
|
6952
|
+
editable && toolbar === "full" ? /* @__PURE__ */ jsx(FullToolbar, { editor }) : null,
|
|
6953
|
+
editable && toolbar === "minimal" ? /* @__PURE__ */ jsx(MinimalToolbar, { editor }) : null,
|
|
6966
6954
|
/* @__PURE__ */ jsx(EditorContent, { editor }),
|
|
6967
6955
|
toolbar === "bubble" && editable ? /* @__PURE__ */ jsx(BubbleToolbar, { editor }) : null,
|
|
6968
6956
|
maxLength != null ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-end border-t border-[hsl(var(--border))] bg-[hsl(var(--muted))]/30 px-3 py-1.5", children: /* @__PURE__ */ jsxs(
|
|
@@ -10792,7 +10780,7 @@ function Checkbox2({
|
|
|
10792
10780
|
function SortIcon({ dir }) {
|
|
10793
10781
|
if (dir === "asc") return /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10794
10782
|
if (dir === "desc") return /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10795
|
-
return /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-3.5 w-3.5 shrink-0
|
|
10783
|
+
return /* @__PURE__ */ jsx(ArrowUpDown, { className: "h-3.5 w-3.5 shrink-0" });
|
|
10796
10784
|
}
|
|
10797
10785
|
function ColumnVisibilityDropdown({
|
|
10798
10786
|
columns,
|
|
@@ -11245,7 +11233,7 @@ var EventCalendar = React137__default.forwardRef(
|
|
|
11245
11233
|
"div",
|
|
11246
11234
|
{
|
|
11247
11235
|
"data-slot": "event-calendar-header",
|
|
11248
|
-
className: "flex items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
11236
|
+
className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2",
|
|
11249
11237
|
children: [
|
|
11250
11238
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
11251
11239
|
/* @__PURE__ */ jsx(
|
|
@@ -11285,7 +11273,7 @@ var EventCalendar = React137__default.forwardRef(
|
|
|
11285
11273
|
"div",
|
|
11286
11274
|
{
|
|
11287
11275
|
"data-slot": "event-calendar-title",
|
|
11288
|
-
className: "text-sm font-medium tabular-nums",
|
|
11276
|
+
className: "whitespace-nowrap text-sm font-medium tabular-nums",
|
|
11289
11277
|
children: headerLabel
|
|
11290
11278
|
}
|
|
11291
11279
|
),
|
|
@@ -11377,7 +11365,16 @@ function MonthView({
|
|
|
11377
11365
|
return Array.from({ length: 7 }, (_, i) => format(addDays(start, i), "EEE"));
|
|
11378
11366
|
}, [weekStartsOn]);
|
|
11379
11367
|
const today = /* @__PURE__ */ new Date();
|
|
11380
|
-
|
|
11368
|
+
const gridRef = React137__default.useRef(null);
|
|
11369
|
+
const [compact, setCompact] = React137__default.useState(false);
|
|
11370
|
+
React137__default.useEffect(() => {
|
|
11371
|
+
const el = gridRef.current;
|
|
11372
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
11373
|
+
const ro = new ResizeObserver(() => setCompact(el.clientWidth / 7 < 72));
|
|
11374
|
+
ro.observe(el);
|
|
11375
|
+
return () => ro.disconnect();
|
|
11376
|
+
}, []);
|
|
11377
|
+
return /* @__PURE__ */ jsxs("div", { ref: gridRef, className: "flex flex-col", "data-slot": "event-calendar-month", children: [
|
|
11381
11378
|
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 border-b border-border", children: weekdayLabels.map((label) => /* @__PURE__ */ jsx(
|
|
11382
11379
|
"div",
|
|
11383
11380
|
{
|
|
@@ -11440,6 +11437,7 @@ function MonthView({
|
|
|
11440
11437
|
EventChip,
|
|
11441
11438
|
{
|
|
11442
11439
|
event: ev,
|
|
11440
|
+
compact,
|
|
11443
11441
|
onClick: () => onEventClick?.(ev)
|
|
11444
11442
|
},
|
|
11445
11443
|
ev.id
|
|
@@ -11481,6 +11479,7 @@ function MonthView({
|
|
|
11481
11479
|
}
|
|
11482
11480
|
function EventChip({
|
|
11483
11481
|
event,
|
|
11482
|
+
compact,
|
|
11484
11483
|
onClick
|
|
11485
11484
|
}) {
|
|
11486
11485
|
const color = event.color ?? DEFAULT_COLOR3;
|
|
@@ -11494,7 +11493,10 @@ function EventChip({
|
|
|
11494
11493
|
onClick?.();
|
|
11495
11494
|
},
|
|
11496
11495
|
title: event.title,
|
|
11497
|
-
className:
|
|
11496
|
+
className: cn(
|
|
11497
|
+
"group/chip flex w-full items-center gap-1.5 truncate rounded px-1.5 py-0.5 text-left text-[11px] font-medium text-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
11498
|
+
compact && "h-4 justify-center px-0"
|
|
11499
|
+
),
|
|
11498
11500
|
style: {
|
|
11499
11501
|
backgroundColor: `color-mix(in oklab, ${color} 22%, transparent)`
|
|
11500
11502
|
},
|
|
@@ -11507,7 +11509,7 @@ function EventChip({
|
|
|
11507
11509
|
style: { backgroundColor: color }
|
|
11508
11510
|
}
|
|
11509
11511
|
),
|
|
11510
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: event.title })
|
|
11512
|
+
/* @__PURE__ */ jsx("span", { className: compact ? "sr-only" : "truncate", children: event.title })
|
|
11511
11513
|
]
|
|
11512
11514
|
}
|
|
11513
11515
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@otfdashkit/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"description": "OTF UI: 150+ React components for web apps (primitives, blocks, layouts and charts), themed by @otfdashkit/tokens. Works with Tailwind CSS v3 and v4. Shares component names and tokens with @otfdashkit/ui-native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"otfdashkit",
|
|
@@ -63,7 +63,7 @@ export type RichEditorProps = Omit<
|
|
|
63
63
|
onChange?: (html: string) => void
|
|
64
64
|
/** Placeholder shown when the document is empty. */
|
|
65
65
|
placeholder?: string
|
|
66
|
-
/** Default true. When false the
|
|
66
|
+
/** Default true. When false the content is read-only and no toolbar is shown. */
|
|
67
67
|
editable?: boolean
|
|
68
68
|
/** Toolbar layout. Default 'full'. */
|
|
69
69
|
toolbar?: RichEditorToolbarVariant
|
|
@@ -657,20 +657,12 @@ export const RichEditor = React.forwardRef<HTMLDivElement, RichEditorProps>(
|
|
|
657
657
|
className={cn(
|
|
658
658
|
'overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-[hsl(var(--card-foreground))]',
|
|
659
659
|
'focus-within:ring-2 focus-within:ring-[hsl(var(--ring))]',
|
|
660
|
-
!editable && 'opacity-90',
|
|
661
660
|
className
|
|
662
661
|
)}
|
|
663
662
|
{...rest}
|
|
664
663
|
>
|
|
665
|
-
<
|
|
666
|
-
|
|
667
|
-
!editable && 'pointer-events-none select-none opacity-60'
|
|
668
|
-
)}
|
|
669
|
-
aria-hidden={!editable || undefined}
|
|
670
|
-
>
|
|
671
|
-
{toolbar === 'full' ? <FullToolbar editor={editor} /> : null}
|
|
672
|
-
{toolbar === 'minimal' ? <MinimalToolbar editor={editor} /> : null}
|
|
673
|
-
</div>
|
|
664
|
+
{editable && toolbar === 'full' ? <FullToolbar editor={editor} /> : null}
|
|
665
|
+
{editable && toolbar === 'minimal' ? <MinimalToolbar editor={editor} /> : null}
|
|
674
666
|
|
|
675
667
|
<EditorContent editor={editor} />
|
|
676
668
|
|
|
@@ -34,7 +34,7 @@ export function DataTableColumnHeader({ column, title }: { column: any; title: s
|
|
|
34
34
|
className="flex items-center gap-1 hover:text-[hsl(var(--foreground))]"
|
|
35
35
|
>
|
|
36
36
|
{title}
|
|
37
|
-
{sorted === 'asc' ? <ArrowUp className="h-3 w-3" /> : sorted === 'desc' ? <ArrowDown className="h-3 w-3" /> : <ArrowUpDown className="h-3 w-3
|
|
37
|
+
{sorted === 'asc' ? <ArrowUp className="h-3 w-3" /> : sorted === 'desc' ? <ArrowDown className="h-3 w-3" /> : <ArrowUpDown className="h-3 w-3" />}
|
|
38
38
|
</button>
|
|
39
39
|
)
|
|
40
40
|
}
|
package/src/data/DataGrid.tsx
CHANGED
|
@@ -91,7 +91,7 @@ export interface DataGridProps<T extends object> {
|
|
|
91
91
|
function SortIcon({ dir }: { dir: 'asc' | 'desc' | false }) {
|
|
92
92
|
if (dir === 'asc') return <ArrowUp className="h-3.5 w-3.5 shrink-0" />
|
|
93
93
|
if (dir === 'desc') return <ArrowDown className="h-3.5 w-3.5 shrink-0" />
|
|
94
|
-
return <ArrowUpDown className="h-3.5 w-3.5 shrink-0
|
|
94
|
+
return <ArrowUpDown className="h-3.5 w-3.5 shrink-0" />
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// ── Column visibility dropdown ───────────────────────────────────
|
|
@@ -181,7 +181,7 @@ export const EventCalendar = React.forwardRef<HTMLDivElement, EventCalendarProps
|
|
|
181
181
|
{/* Header */}
|
|
182
182
|
<div
|
|
183
183
|
data-slot="event-calendar-header"
|
|
184
|
-
className="flex items-center justify-between gap-2 border-b border-border px-3 py-2"
|
|
184
|
+
className="flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2"
|
|
185
185
|
>
|
|
186
186
|
<div className="flex items-center gap-1">
|
|
187
187
|
<Button
|
|
@@ -214,7 +214,7 @@ export const EventCalendar = React.forwardRef<HTMLDivElement, EventCalendarProps
|
|
|
214
214
|
|
|
215
215
|
<div
|
|
216
216
|
data-slot="event-calendar-title"
|
|
217
|
-
className="text-sm font-medium tabular-nums"
|
|
217
|
+
className="whitespace-nowrap text-sm font-medium tabular-nums"
|
|
218
218
|
>
|
|
219
219
|
{headerLabel}
|
|
220
220
|
</div>
|
|
@@ -314,9 +314,19 @@ function MonthView({
|
|
|
314
314
|
}, [weekStartsOn])
|
|
315
315
|
|
|
316
316
|
const today = new Date()
|
|
317
|
+
// Day cells under ~72px cannot hold a readable title, so chips collapse to their colour dot.
|
|
318
|
+
const gridRef = React.useRef<HTMLDivElement>(null)
|
|
319
|
+
const [compact, setCompact] = React.useState(false)
|
|
320
|
+
React.useEffect(() => {
|
|
321
|
+
const el = gridRef.current
|
|
322
|
+
if (!el || typeof ResizeObserver === 'undefined') return
|
|
323
|
+
const ro = new ResizeObserver(() => setCompact(el.clientWidth / 7 < 72))
|
|
324
|
+
ro.observe(el)
|
|
325
|
+
return () => ro.disconnect()
|
|
326
|
+
}, [])
|
|
317
327
|
|
|
318
328
|
return (
|
|
319
|
-
<div className="flex flex-col" data-slot="event-calendar-month">
|
|
329
|
+
<div ref={gridRef} className="flex flex-col" data-slot="event-calendar-month">
|
|
320
330
|
<div className="grid grid-cols-7 border-b border-border">
|
|
321
331
|
{weekdayLabels.map((label) => (
|
|
322
332
|
<div
|
|
@@ -388,6 +398,7 @@ function MonthView({
|
|
|
388
398
|
<EventChip
|
|
389
399
|
key={ev.id}
|
|
390
400
|
event={ev}
|
|
401
|
+
compact={compact}
|
|
391
402
|
onClick={() => onEventClick?.(ev)}
|
|
392
403
|
/>
|
|
393
404
|
))}
|
|
@@ -432,9 +443,11 @@ function MonthView({
|
|
|
432
443
|
|
|
433
444
|
function EventChip({
|
|
434
445
|
event,
|
|
446
|
+
compact,
|
|
435
447
|
onClick,
|
|
436
448
|
}: {
|
|
437
449
|
event: CalendarEvent
|
|
450
|
+
compact?: boolean
|
|
438
451
|
onClick?: () => void
|
|
439
452
|
}) {
|
|
440
453
|
const color = event.color ?? DEFAULT_COLOR
|
|
@@ -447,7 +460,10 @@ function EventChip({
|
|
|
447
460
|
onClick?.()
|
|
448
461
|
}}
|
|
449
462
|
title={event.title}
|
|
450
|
-
className=
|
|
463
|
+
className={cn(
|
|
464
|
+
'group/chip flex w-full items-center gap-1.5 truncate rounded px-1.5 py-0.5 text-left text-[11px] font-medium text-foreground hover:opacity-90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring',
|
|
465
|
+
compact && 'h-4 justify-center px-0'
|
|
466
|
+
)}
|
|
451
467
|
style={{
|
|
452
468
|
backgroundColor: `color-mix(in oklab, ${color} 22%, transparent)`,
|
|
453
469
|
}}
|
|
@@ -457,7 +473,7 @@ function EventChip({
|
|
|
457
473
|
className="h-2 w-2 flex-shrink-0 rounded-full"
|
|
458
474
|
style={{ backgroundColor: color }}
|
|
459
475
|
/>
|
|
460
|
-
<span className=
|
|
476
|
+
<span className={compact ? 'sr-only' : 'truncate'}>{event.title}</span>
|
|
461
477
|
</button>
|
|
462
478
|
)
|
|
463
479
|
}
|