@undevy-org/tablewright 0.7.6 → 0.7.8
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.
|
@@ -20,8 +20,10 @@ function patchFieldState(prev, fieldId, value) {
|
|
|
20
20
|
function mergeCompoundSubDraft(compound, subKey, next) {
|
|
21
21
|
const rest = { ...compound };
|
|
22
22
|
delete rest[subKey];
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
if (isFilterValueEmpty(next)) {
|
|
24
|
+
return Object.keys(rest).length === 0 ? void 0 : rest;
|
|
25
|
+
}
|
|
26
|
+
return { ...rest, [subKey]: next };
|
|
25
27
|
}
|
|
26
28
|
function formatTextMultiSummary(values, labels) {
|
|
27
29
|
if (values.length === 2) {
|
|
@@ -50,15 +52,10 @@ function mergeCompoundValueForApply(config, fieldId, committed, draft, touched,
|
|
|
50
52
|
if (hiddenSubSet.has(compoundSubTouchKey(fieldId, sub.key))) continue;
|
|
51
53
|
const touchKey = compoundSubTouchKey(fieldId, sub.key);
|
|
52
54
|
const subCommitted = committedCompound[sub.key];
|
|
53
|
-
const subDraft = draftCompound[sub.key];
|
|
54
55
|
if (shouldPreserveMultiSubOnApply(sub, subCommitted, touchKey, touched)) {
|
|
55
|
-
|
|
56
|
-
merged[sub.key] = subCommitted;
|
|
57
|
-
}
|
|
56
|
+
merged[sub.key] = subCommitted;
|
|
58
57
|
continue;
|
|
59
58
|
}
|
|
60
|
-
if (subDraft === void 0 || isFilterValueEmpty(subDraft)) continue;
|
|
61
|
-
merged[sub.key] = subDraft;
|
|
62
59
|
}
|
|
63
60
|
for (const key of Object.keys(merged)) {
|
|
64
61
|
const value = merged[key];
|
|
@@ -75,14 +72,14 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
75
72
|
if (isMultiStringFilterValue(committed) && !touched.has(fieldId)) {
|
|
76
73
|
return { kind: "skip" };
|
|
77
74
|
}
|
|
78
|
-
if (
|
|
75
|
+
if (isFilterValueEmpty(draft)) {
|
|
79
76
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
80
77
|
}
|
|
81
78
|
return { kind: "set", value: draft };
|
|
82
79
|
}
|
|
83
80
|
case "date":
|
|
84
81
|
case "number-range": {
|
|
85
|
-
if (
|
|
82
|
+
if (isFilterValueEmpty(draft)) {
|
|
86
83
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
87
84
|
}
|
|
88
85
|
return { kind: "set", value: draft };
|
|
@@ -96,7 +93,7 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
96
93
|
touched,
|
|
97
94
|
hiddenSubSet
|
|
98
95
|
);
|
|
99
|
-
if (
|
|
96
|
+
if (isFilterValueEmpty(merged)) {
|
|
100
97
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
101
98
|
}
|
|
102
99
|
return { kind: "set", value: merged };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
3
|
+
import { ChevronDown, SunMoon, Sun, Moon, LogOut } from "lucide-react";
|
|
4
|
+
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, DropdownMenuItem } from "../ui/dropdown-menu.js";
|
|
5
5
|
import { cn } from "../../lib/utils.js";
|
|
6
6
|
import { useAppShell } from "./app-shell-context.js";
|
|
7
7
|
function getInitials(name) {
|
|
@@ -58,10 +58,9 @@ function SidebarAccountMenu({
|
|
|
58
58
|
className: "min-w-[220px]",
|
|
59
59
|
children: [
|
|
60
60
|
/* @__PURE__ */ jsxs(
|
|
61
|
-
|
|
61
|
+
DropdownMenuLabel,
|
|
62
62
|
{
|
|
63
|
-
|
|
64
|
-
className: "gap-2.5 px-2 py-2 opacity-100 focus:bg-transparent data-[disabled]:opacity-100",
|
|
63
|
+
className: "flex cursor-default select-none items-center gap-2.5 px-2 py-2 font-normal",
|
|
65
64
|
children: [
|
|
66
65
|
avatarUrl ? /* @__PURE__ */ jsx(
|
|
67
66
|
"img",
|
|
@@ -80,27 +79,52 @@ function SidebarAccountMenu({
|
|
|
80
79
|
),
|
|
81
80
|
/* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
82
81
|
showTheme && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
83
|
-
/* @__PURE__ */ jsxs(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
82
|
+
/* @__PURE__ */ jsxs(DropdownMenuGroup, { className: "flex items-center justify-between px-3 py-2", children: [
|
|
83
|
+
/* @__PURE__ */ jsxs(
|
|
84
|
+
DropdownMenuLabel,
|
|
85
|
+
{
|
|
86
|
+
className: "flex cursor-default select-none items-center gap-2 p-0 font-normal",
|
|
87
|
+
children: [
|
|
90
88
|
/* @__PURE__ */ jsx(SunMoon, { className: "h-4 w-4" }),
|
|
91
89
|
/* @__PURE__ */ jsx("span", { className: "text-[13px]", children: "Theme" })
|
|
92
|
-
]
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
/* @__PURE__ */ jsx(
|
|
94
|
+
DropdownMenuPrimitive.RadioGroup,
|
|
95
|
+
{
|
|
96
|
+
value: theme,
|
|
97
|
+
onValueChange: (value) => onThemeChange(value),
|
|
98
|
+
className: "inline-flex h-[var(--size-control-md)] items-center gap-1 rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-surface)] px-1 py-1",
|
|
99
|
+
children: /* @__PURE__ */ jsxs("div", { className: "inline-flex self-stretch items-center gap-1", children: [
|
|
100
|
+
/* @__PURE__ */ jsx(
|
|
101
|
+
DropdownMenuPrimitive.RadioItem,
|
|
102
|
+
{
|
|
103
|
+
value: "light",
|
|
104
|
+
"aria-label": "Light",
|
|
105
|
+
onSelect: (event) => event.preventDefault(),
|
|
106
|
+
className: cn(
|
|
107
|
+
"relative flex cursor-default select-none items-center justify-center rounded-md px-2 py-0 outline-none focus:bg-transparent hover:bg-[var(--bg-hover)] data-[state=checked]:bg-[var(--bg-secondary)] data-[state=checked]:text-[var(--text-primary)] text-[var(--text-secondary)]"
|
|
108
|
+
),
|
|
109
|
+
children: /* @__PURE__ */ jsx(Sun, { className: "h-4 w-4" })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx(
|
|
113
|
+
DropdownMenuPrimitive.RadioItem,
|
|
114
|
+
{
|
|
115
|
+
value: "dark",
|
|
116
|
+
"aria-label": "Dark",
|
|
117
|
+
onSelect: (event) => event.preventDefault(),
|
|
118
|
+
className: cn(
|
|
119
|
+
"relative flex cursor-default select-none items-center justify-center rounded-md px-2 py-0 outline-none focus:bg-transparent hover:bg-[var(--bg-hover)] data-[state=checked]:bg-[var(--bg-secondary)] data-[state=checked]:text-[var(--text-primary)] text-[var(--text-secondary)]"
|
|
120
|
+
),
|
|
121
|
+
children: /* @__PURE__ */ jsx(Moon, { className: "h-4 w-4" })
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] })
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
] }),
|
|
104
128
|
hasItemsBelow && /* @__PURE__ */ jsx(DropdownMenuSeparator, {})
|
|
105
129
|
] }),
|
|
106
130
|
menuItems && menuItems.map((item) => {
|
package/dist/styles.css
CHANGED
|
@@ -1139,6 +1139,10 @@
|
|
|
1139
1139
|
padding-left: 1.5rem;
|
|
1140
1140
|
padding-right: 1.5rem
|
|
1141
1141
|
}
|
|
1142
|
+
.py-0 {
|
|
1143
|
+
padding-top: 0px;
|
|
1144
|
+
padding-bottom: 0px
|
|
1145
|
+
}
|
|
1142
1146
|
.py-0\.5 {
|
|
1143
1147
|
padding-top: 0.125rem;
|
|
1144
1148
|
padding-bottom: 0.125rem
|
|
@@ -1678,6 +1682,9 @@
|
|
|
1678
1682
|
.data-\[state\=checked\]\:bg-\[var\(--accent-primary\)\][data-state="checked"] {
|
|
1679
1683
|
background-color: var(--accent-primary)
|
|
1680
1684
|
}
|
|
1685
|
+
.data-\[state\=checked\]\:bg-\[var\(--bg-secondary\)\][data-state="checked"] {
|
|
1686
|
+
background-color: var(--bg-secondary)
|
|
1687
|
+
}
|
|
1681
1688
|
.data-\[state\=indeterminate\]\:bg-\[var\(--accent-primary\)\][data-state="indeterminate"] {
|
|
1682
1689
|
background-color: var(--accent-primary)
|
|
1683
1690
|
}
|
|
@@ -1687,12 +1694,12 @@
|
|
|
1687
1694
|
.data-\[state\=active\]\:text-\[var\(--text-primary\)\][data-state="active"] {
|
|
1688
1695
|
color: var(--text-primary)
|
|
1689
1696
|
}
|
|
1697
|
+
.data-\[state\=checked\]\:text-\[var\(--text-primary\)\][data-state="checked"] {
|
|
1698
|
+
color: var(--text-primary)
|
|
1699
|
+
}
|
|
1690
1700
|
.data-\[disabled\=true\]\:opacity-50[data-disabled="true"] {
|
|
1691
1701
|
opacity: 0.5
|
|
1692
1702
|
}
|
|
1693
|
-
.data-\[disabled\]\:opacity-100[data-disabled] {
|
|
1694
|
-
opacity: 1
|
|
1695
|
-
}
|
|
1696
1703
|
.data-\[state\=open\]\:opacity-100[data-state="open"] {
|
|
1697
1704
|
opacity: 1
|
|
1698
1705
|
}
|
package/dist/tablewright.cjs
CHANGED
|
@@ -2260,10 +2260,9 @@ function SidebarAccountMenu({
|
|
|
2260
2260
|
className: "min-w-[220px]",
|
|
2261
2261
|
children: [
|
|
2262
2262
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2263
|
-
|
|
2263
|
+
DropdownMenuLabel,
|
|
2264
2264
|
{
|
|
2265
|
-
|
|
2266
|
-
className: "gap-2.5 px-2 py-2 opacity-100 focus:bg-transparent data-[disabled]:opacity-100",
|
|
2265
|
+
className: "flex cursor-default select-none items-center gap-2.5 px-2 py-2 font-normal",
|
|
2267
2266
|
children: [
|
|
2268
2267
|
avatarUrl ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
2269
2268
|
"img",
|
|
@@ -2282,27 +2281,52 @@ function SidebarAccountMenu({
|
|
|
2282
2281
|
),
|
|
2283
2282
|
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {}),
|
|
2284
2283
|
showTheme && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2285
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2284
|
+
/* @__PURE__ */ jsxRuntime.jsxs(DropdownMenuGroup, { className: "flex items-center justify-between px-3 py-2", children: [
|
|
2285
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2286
|
+
DropdownMenuLabel,
|
|
2287
|
+
{
|
|
2288
|
+
className: "flex cursor-default select-none items-center gap-2 p-0 font-normal",
|
|
2289
|
+
children: [
|
|
2292
2290
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.SunMoon, { className: "h-4 w-4" }),
|
|
2293
2291
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[13px]", children: "Theme" })
|
|
2294
|
-
]
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
)
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2292
|
+
]
|
|
2293
|
+
}
|
|
2294
|
+
),
|
|
2295
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2296
|
+
DropdownMenuPrimitive__namespace.RadioGroup,
|
|
2297
|
+
{
|
|
2298
|
+
value: theme,
|
|
2299
|
+
onValueChange: (value) => onThemeChange(value),
|
|
2300
|
+
className: "inline-flex h-[var(--size-control-md)] items-center gap-1 rounded-lg border border-[var(--border-subtle)] bg-[var(--bg-surface)] px-1 py-1",
|
|
2301
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex self-stretch items-center gap-1", children: [
|
|
2302
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2303
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2304
|
+
{
|
|
2305
|
+
value: "light",
|
|
2306
|
+
"aria-label": "Light",
|
|
2307
|
+
onSelect: (event) => event.preventDefault(),
|
|
2308
|
+
className: cn(
|
|
2309
|
+
"relative flex cursor-default select-none items-center justify-center rounded-md px-2 py-0 outline-none focus:bg-transparent hover:bg-[var(--bg-hover)] data-[state=checked]:bg-[var(--bg-secondary)] data-[state=checked]:text-[var(--text-primary)] text-[var(--text-secondary)]"
|
|
2310
|
+
),
|
|
2311
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Sun, { className: "h-4 w-4" })
|
|
2312
|
+
}
|
|
2313
|
+
),
|
|
2314
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2315
|
+
DropdownMenuPrimitive__namespace.RadioItem,
|
|
2316
|
+
{
|
|
2317
|
+
value: "dark",
|
|
2318
|
+
"aria-label": "Dark",
|
|
2319
|
+
onSelect: (event) => event.preventDefault(),
|
|
2320
|
+
className: cn(
|
|
2321
|
+
"relative flex cursor-default select-none items-center justify-center rounded-md px-2 py-0 outline-none focus:bg-transparent hover:bg-[var(--bg-hover)] data-[state=checked]:bg-[var(--bg-secondary)] data-[state=checked]:text-[var(--text-primary)] text-[var(--text-secondary)]"
|
|
2322
|
+
),
|
|
2323
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Moon, { className: "h-4 w-4" })
|
|
2324
|
+
}
|
|
2325
|
+
)
|
|
2326
|
+
] })
|
|
2327
|
+
}
|
|
2328
|
+
)
|
|
2329
|
+
] }),
|
|
2306
2330
|
hasItemsBelow && /* @__PURE__ */ jsxRuntime.jsx(DropdownMenuSeparator, {})
|
|
2307
2331
|
] }),
|
|
2308
2332
|
menuItems && menuItems.map((item) => {
|
|
@@ -4058,8 +4082,10 @@ function patchFieldState(prev, fieldId, value) {
|
|
|
4058
4082
|
function mergeCompoundSubDraft(compound, subKey, next) {
|
|
4059
4083
|
const rest = { ...compound };
|
|
4060
4084
|
delete rest[subKey];
|
|
4061
|
-
|
|
4062
|
-
|
|
4085
|
+
if (isFilterValueEmpty(next)) {
|
|
4086
|
+
return Object.keys(rest).length === 0 ? void 0 : rest;
|
|
4087
|
+
}
|
|
4088
|
+
return { ...rest, [subKey]: next };
|
|
4063
4089
|
}
|
|
4064
4090
|
function formatTextMultiSummary(values, labels) {
|
|
4065
4091
|
if (values.length === 2) {
|
|
@@ -4088,15 +4114,10 @@ function mergeCompoundValueForApply(config, fieldId, committed, draft, touched,
|
|
|
4088
4114
|
if (hiddenSubSet.has(compoundSubTouchKey(fieldId, sub.key))) continue;
|
|
4089
4115
|
const touchKey = compoundSubTouchKey(fieldId, sub.key);
|
|
4090
4116
|
const subCommitted = committedCompound[sub.key];
|
|
4091
|
-
const subDraft = draftCompound[sub.key];
|
|
4092
4117
|
if (shouldPreserveMultiSubOnApply(sub, subCommitted, touchKey, touched)) {
|
|
4093
|
-
|
|
4094
|
-
merged[sub.key] = subCommitted;
|
|
4095
|
-
}
|
|
4118
|
+
merged[sub.key] = subCommitted;
|
|
4096
4119
|
continue;
|
|
4097
4120
|
}
|
|
4098
|
-
if (subDraft === void 0 || isFilterValueEmpty(subDraft)) continue;
|
|
4099
|
-
merged[sub.key] = subDraft;
|
|
4100
4121
|
}
|
|
4101
4122
|
for (const key of Object.keys(merged)) {
|
|
4102
4123
|
const value = merged[key];
|
|
@@ -4113,14 +4134,14 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
4113
4134
|
if (isMultiStringFilterValue(committed) && !touched.has(fieldId)) {
|
|
4114
4135
|
return { kind: "skip" };
|
|
4115
4136
|
}
|
|
4116
|
-
if (
|
|
4137
|
+
if (isFilterValueEmpty(draft)) {
|
|
4117
4138
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4118
4139
|
}
|
|
4119
4140
|
return { kind: "set", value: draft };
|
|
4120
4141
|
}
|
|
4121
4142
|
case "date":
|
|
4122
4143
|
case "number-range": {
|
|
4123
|
-
if (
|
|
4144
|
+
if (isFilterValueEmpty(draft)) {
|
|
4124
4145
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4125
4146
|
}
|
|
4126
4147
|
return { kind: "set", value: draft };
|
|
@@ -4134,7 +4155,7 @@ function resolveFieldApplyChange(config, fieldId, committed, draft, touched, hid
|
|
|
4134
4155
|
touched,
|
|
4135
4156
|
hiddenSubSet
|
|
4136
4157
|
);
|
|
4137
|
-
if (
|
|
4158
|
+
if (isFilterValueEmpty(merged)) {
|
|
4138
4159
|
return isActive ? { kind: "remove" } : { kind: "skip" };
|
|
4139
4160
|
}
|
|
4140
4161
|
return { kind: "set", value: merged };
|
package/dist/tablewright.css
CHANGED
|
@@ -987,6 +987,10 @@
|
|
|
987
987
|
padding-left: 1.5rem;
|
|
988
988
|
padding-right: 1.5rem
|
|
989
989
|
}
|
|
990
|
+
.py-0 {
|
|
991
|
+
padding-top: 0px;
|
|
992
|
+
padding-bottom: 0px
|
|
993
|
+
}
|
|
990
994
|
.py-0\.5 {
|
|
991
995
|
padding-top: 0.125rem;
|
|
992
996
|
padding-bottom: 0.125rem
|
|
@@ -1526,6 +1530,9 @@
|
|
|
1526
1530
|
.data-\[state\=checked\]\:bg-\[var\(--accent-primary\)\][data-state="checked"] {
|
|
1527
1531
|
background-color: var(--accent-primary)
|
|
1528
1532
|
}
|
|
1533
|
+
.data-\[state\=checked\]\:bg-\[var\(--bg-secondary\)\][data-state="checked"] {
|
|
1534
|
+
background-color: var(--bg-secondary)
|
|
1535
|
+
}
|
|
1529
1536
|
.data-\[state\=indeterminate\]\:bg-\[var\(--accent-primary\)\][data-state="indeterminate"] {
|
|
1530
1537
|
background-color: var(--accent-primary)
|
|
1531
1538
|
}
|
|
@@ -1535,12 +1542,12 @@
|
|
|
1535
1542
|
.data-\[state\=active\]\:text-\[var\(--text-primary\)\][data-state="active"] {
|
|
1536
1543
|
color: var(--text-primary)
|
|
1537
1544
|
}
|
|
1545
|
+
.data-\[state\=checked\]\:text-\[var\(--text-primary\)\][data-state="checked"] {
|
|
1546
|
+
color: var(--text-primary)
|
|
1547
|
+
}
|
|
1538
1548
|
.data-\[disabled\=true\]\:opacity-50[data-disabled="true"] {
|
|
1539
1549
|
opacity: 0.5
|
|
1540
1550
|
}
|
|
1541
|
-
.data-\[disabled\]\:opacity-100[data-disabled] {
|
|
1542
|
-
opacity: 1
|
|
1543
|
-
}
|
|
1544
1551
|
.data-\[state\=open\]\:opacity-100[data-state="open"] {
|
|
1545
1552
|
opacity: 1
|
|
1546
1553
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@undevy-org/tablewright",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.8",
|
|
4
4
|
"description": "React data-table and application-shell components: filters, drawers, row controls, sortable and resizable columns, built on Radix UI and TanStack Table.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|