@undevy-org/tablewright 0.4.0 → 0.5.1

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 (27) hide show
  1. package/dist/es/components/data-table/AppliedStateChips.js +15 -6
  2. package/dist/es/components/data-table/ColumnFilterPopover.js +42 -29
  3. package/dist/es/components/data-table/CompoundFilterPopover.js +38 -22
  4. package/dist/es/components/data-table/DrawerShell.js +2 -0
  5. package/dist/es/components/data-table/FilterFormPanel.js +36 -18
  6. package/dist/es/components/data-table/FilterPopoverFooter.js +12 -4
  7. package/dist/es/components/data-table/TableLayout.js +10 -1
  8. package/dist/es/components/layout/Sidebar.js +8 -1
  9. package/dist/es/components/layout/SidebarAccountMenu.js +3 -2
  10. package/dist/es/components/layout/SidebarUser.js +2 -1
  11. package/dist/es/lib/collapsed-nav-link-a11y.js +6 -0
  12. package/dist/es/lib/decorative-avatar-alt.js +6 -0
  13. package/dist/es/lib/scroll-region-tab-index.js +4 -0
  14. package/dist/styles.css +3 -0
  15. package/dist/tablewright.cjs +175 -89
  16. package/dist/tablewright.css +3 -0
  17. package/dist/types/components/data-table/AppliedStateChips.d.ts +13 -1
  18. package/dist/types/components/data-table/ColumnFilterPopover.d.ts +22 -1
  19. package/dist/types/components/data-table/CompoundFilterPopover.d.ts +19 -1
  20. package/dist/types/components/data-table/FilterFormPanel.d.ts +17 -1
  21. package/dist/types/components/data-table/FilterPopoverFooter.d.ts +8 -1
  22. package/dist/types/components/layout/Sidebar.d.ts +1 -0
  23. package/dist/types/index.d.ts +5 -1
  24. package/dist/types/lib/collapsed-nav-link-a11y.d.ts +2 -0
  25. package/dist/types/lib/decorative-avatar-alt.d.ts +2 -0
  26. package/dist/types/lib/scroll-region-tab-index.d.ts +2 -0
  27. package/package.json +7 -2
@@ -2,16 +2,24 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/utils.js";
3
3
  import { Button } from "../ui/button.js";
4
4
  import { ButtonFooter } from "../ui/button-footer.js";
5
+ const DEFAULT_LABELS = {
6
+ apply: "Apply",
7
+ clear: "Clear"
8
+ };
5
9
  function FilterPopoverFooter({
6
10
  onApply,
7
11
  onClear,
8
- applyLabel = "Apply",
9
- clearLabel = "Clear",
12
+ labels: labelOverrides,
13
+ applyLabel,
14
+ clearLabel,
10
15
  className
11
16
  }) {
17
+ const labels = { ...DEFAULT_LABELS, ...labelOverrides };
18
+ const apply = applyLabel ?? labels.apply;
19
+ const clear = clearLabel ?? labels.clear;
12
20
  return /* @__PURE__ */ jsxs(ButtonFooter, { className: cn("px-3 py-2.5", className), children: [
13
- onClear && /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", size: "sm", onClick: onClear, children: clearLabel }),
14
- /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", onClick: onApply, children: applyLabel })
21
+ onClear && /* @__PURE__ */ jsx(Button, { type: "button", variant: "secondary", size: "sm", onClick: onClear, children: clear }),
22
+ /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", onClick: onApply, children: apply })
15
23
  ] });
16
24
  }
17
25
  export {
@@ -1,12 +1,21 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { cn } from "../../lib/utils.js";
3
+ import { SCROLL_REGION_TAB_INDEX } from "../../lib/scroll-region-tab-index.js";
3
4
  import { useScrollActivity } from "../../hooks/use-scroll-activity.js";
4
5
  function TableLayout({ children, className }) {
5
6
  return /* @__PURE__ */ jsx("div", { className: cn("relative flex flex-1 flex-col overflow-hidden", className), children });
6
7
  }
7
8
  function ScrollArea({ children, className }) {
8
9
  const scrollRef = useScrollActivity();
9
- return /* @__PURE__ */ jsx("div", { ref: scrollRef, className: cn("scrollbar-auto-hide flex-1 overflow-auto", className), children });
10
+ return /* @__PURE__ */ jsx(
11
+ "div",
12
+ {
13
+ ref: scrollRef,
14
+ tabIndex: SCROLL_REGION_TAB_INDEX,
15
+ className: cn("scrollbar-auto-hide flex-1 overflow-auto", className),
16
+ children
17
+ }
18
+ );
10
19
  }
11
20
  TableLayout.ScrollArea = ScrollArea;
12
21
  export {
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { ChevronRight, ChevronLeft } from "lucide-react";
4
+ import { collapsedNavLinkAriaLabel } from "../../lib/collapsed-nav-link-a11y.js";
4
5
  import { cn } from "../../lib/utils.js";
5
6
  import { useAppShell } from "./app-shell-context.js";
6
7
  function isItemActive(href, activeKey) {
@@ -75,10 +76,15 @@ const Sidebar = React.forwardRef(
75
76
  ),
76
77
  showExpanded && /* @__PURE__ */ jsx("span", { className: "truncate text-[13px]", children: item.label })
77
78
  ] });
79
+ const collapsedLinkLabel = collapsedNavLinkAriaLabel(
80
+ showExpanded,
81
+ item.label
82
+ );
78
83
  if (renderLink) {
79
84
  return /* @__PURE__ */ jsx(React.Fragment, { children: renderLink(item.href, {
80
85
  className: itemClassName,
81
- children
86
+ children,
87
+ ...collapsedLinkLabel ? { "aria-label": collapsedLinkLabel } : {}
82
88
  }) }, item.key);
83
89
  }
84
90
  return /* @__PURE__ */ jsx(
@@ -86,6 +92,7 @@ const Sidebar = React.forwardRef(
86
92
  {
87
93
  href: item.href,
88
94
  className: itemClassName,
95
+ "aria-label": collapsedLinkLabel,
89
96
  children
90
97
  },
91
98
  item.key
@@ -2,6 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { ChevronDown, SunMoon, LogOut } from "lucide-react";
3
3
  import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "../ui/dropdown-menu.js";
4
4
  import { ThemeSwitch } from "../ui/theme-switch.js";
5
+ import { decorativeAvatarAlt } from "../../lib/decorative-avatar-alt.js";
5
6
  import { cn } from "../../lib/utils.js";
6
7
  import { useAppShell } from "./app-shell-context.js";
7
8
  function getInitials(name) {
@@ -26,7 +27,7 @@ function SidebarAccountMenu({
26
27
  "img",
27
28
  {
28
29
  src: avatarUrl,
29
- alt: name,
30
+ alt: decorativeAvatarAlt(!effectiveCollapsed, name),
30
31
  className: "h-7 w-7 shrink-0 rounded-full object-cover"
31
32
  }
32
33
  ) : /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-[var(--bg-tertiary)] text-[11px] font-semibold text-[var(--text-secondary)]", children: getInitials(name) });
@@ -62,7 +63,7 @@ function SidebarAccountMenu({
62
63
  "img",
63
64
  {
64
65
  src: avatarUrl,
65
- alt: name,
66
+ alt: decorativeAvatarAlt(true, name),
66
67
  className: "h-8 w-8 shrink-0 rounded-full object-cover"
67
68
  }
68
69
  ) : /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--bg-tertiary)] text-[11px] font-semibold text-[var(--text-secondary)]", children: getInitials(name) }),
@@ -1,5 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
+ import { decorativeAvatarAlt } from "../../lib/decorative-avatar-alt.js";
3
4
  import { cn } from "../../lib/utils.js";
4
5
  import { useAppShell } from "./app-shell-context.js";
5
6
  function getInitials(name) {
@@ -23,7 +24,7 @@ const SidebarUser = React.forwardRef(
23
24
  "img",
24
25
  {
25
26
  src: avatarUrl,
26
- alt: name,
27
+ alt: decorativeAvatarAlt(!effectiveCollapsed, name),
27
28
  className: "h-8 w-8 shrink-0 rounded-full object-cover"
28
29
  }
29
30
  ) : /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--bg-tertiary)] text-[11px] font-semibold text-[var(--text-secondary)]", children: getInitials(name) }),
@@ -0,0 +1,6 @@
1
+ function collapsedNavLinkAriaLabel(showExpanded, label) {
2
+ return showExpanded ? void 0 : label;
3
+ }
4
+ export {
5
+ collapsedNavLinkAriaLabel
6
+ };
@@ -0,0 +1,6 @@
1
+ function decorativeAvatarAlt(adjacentNameVisible, name) {
2
+ return adjacentNameVisible ? "" : name;
3
+ }
4
+ export {
5
+ decorativeAvatarAlt
6
+ };
@@ -0,0 +1,4 @@
1
+ const SCROLL_REGION_TAB_INDEX = 0;
2
+ export {
3
+ SCROLL_REGION_TAB_INDEX
4
+ };
package/dist/styles.css CHANGED
@@ -580,6 +580,9 @@
580
580
  .h-9 {
581
581
  height: 2.25rem
582
582
  }
583
+ .h-96 {
584
+ height: 24rem
585
+ }
583
586
  .h-\[18px\] {
584
587
  height: 18px
585
588
  }