@locusgraph/components 0.2.1 → 0.2.2

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 (43) hide show
  1. package/dist/action/button-group.js +33 -136
  2. package/dist/action/button.js +15 -62
  3. package/dist/display/badge.js +13 -54
  4. package/dist/display/chat/attachment/attachment-parts.js +52 -218
  5. package/dist/display/chat/attachment/attachment.js +46 -186
  6. package/dist/display/chat/bubble.js +47 -192
  7. package/dist/display/chat/marker.js +32 -131
  8. package/dist/display/chat/message.js +56 -236
  9. package/dist/display/content/item.js +101 -415
  10. package/dist/display/content/kbd.js +18 -77
  11. package/dist/display/rule-grid/rule-grid.js +69 -292
  12. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +25 -74
  13. package/dist/display/skeletons/layouts/skeleton-table.js +38 -158
  14. package/dist/display/skeletons/shapes/skeleton-avatar.js +19 -83
  15. package/dist/display/skeletons/shapes/skeleton-button.js +19 -83
  16. package/dist/display/skeletons/shapes/skeleton-text.js +18 -71
  17. package/dist/display/skeletons/skeleton-parts.js +17 -58
  18. package/dist/display/status/alert.js +30 -122
  19. package/dist/display/status/empty.js +57 -238
  20. package/dist/display/status/skeleton.js +9 -39
  21. package/dist/display/status/spinner.js +10 -40
  22. package/dist/display/table.js +75 -308
  23. package/dist/form/field/field-error.js +24 -107
  24. package/dist/form/field/field-separator.js +14 -65
  25. package/dist/form/field/field-set.js +20 -84
  26. package/dist/form/field/field-text.js +27 -115
  27. package/dist/form/field/field.js +31 -125
  28. package/dist/form/input.js +11 -45
  29. package/dist/form/native-select.js +31 -139
  30. package/dist/form/textarea.js +9 -39
  31. package/dist/layout/use-mobile.js +7 -20
  32. package/dist/navigation/breadcrumb.js +75 -294
  33. package/dist/navigation/navigation-menu.js +83 -359
  34. package/dist/navigation/pagination.js +78 -315
  35. package/dist/shell/app-header.js +21 -73
  36. package/dist/shell/app-shell.js +17 -56
  37. package/dist/shell/breadcrumbs.js +39 -97
  38. package/dist/shell/docs/docs-shell.js +35 -99
  39. package/dist/shell/docs/docs-sidebar.js +39 -86
  40. package/dist/shell/docs/use-active-section.js +31 -75
  41. package/dist/shell/navigation/app-sidebar.js +52 -174
  42. package/dist/shell/navigation/nav-group.js +40 -149
  43. package/package.json +1 -1
@@ -1,108 +1,50 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- function CrumbLabel(t0) {
5
- const $ = _c(8);
6
- const {
7
- crumb,
8
- last,
9
- Link
10
- } = t0;
3
+ function CrumbLabel({
4
+ crumb,
5
+ last,
6
+ Link
7
+ }) {
11
8
  if (last) {
12
- let t1;
13
- if ($[0] !== crumb.label) {
14
- t1 = /*#__PURE__*/_jsx("span", {
15
- "aria-current": "page",
16
- className: "truncate font-medium",
17
- children: crumb.label
18
- });
19
- $[0] = crumb.label;
20
- $[1] = t1;
21
- } else {
22
- t1 = $[1];
23
- }
24
- return t1;
9
+ return /*#__PURE__*/_jsx("span", {
10
+ "aria-current": "page",
11
+ className: "truncate font-medium",
12
+ children: crumb.label
13
+ });
25
14
  }
26
15
  if (crumb.href === undefined) {
27
- let t1;
28
- if ($[2] !== crumb.label) {
29
- t1 = /*#__PURE__*/_jsx("span", {
30
- className: "truncate text-soft",
31
- children: crumb.label
32
- });
33
- $[2] = crumb.label;
34
- $[3] = t1;
35
- } else {
36
- t1 = $[3];
37
- }
38
- return t1;
39
- }
40
- let t1;
41
- if ($[4] !== Link || $[5] !== crumb.href || $[6] !== crumb.label) {
42
- t1 = /*#__PURE__*/_jsx(Link, {
43
- href: crumb.href,
44
- className: "truncate text-soft transition-colors hover:text-foreground",
16
+ return /*#__PURE__*/_jsx("span", {
17
+ className: "truncate text-soft",
45
18
  children: crumb.label
46
19
  });
47
- $[4] = Link;
48
- $[5] = crumb.href;
49
- $[6] = crumb.label;
50
- $[7] = t1;
51
- } else {
52
- t1 = $[7];
53
20
  }
54
- return t1;
21
+ return /*#__PURE__*/_jsx(Link, {
22
+ href: crumb.href,
23
+ className: "truncate text-soft transition-colors hover:text-foreground",
24
+ children: crumb.label
25
+ });
55
26
  }
56
- function Breadcrumbs(t0) {
57
- const $ = _c(8);
58
- const {
59
- items,
60
- linkComponent: t1
61
- } = t0;
62
- const linkComponent = t1 === undefined ? "a" : t1;
63
- let t2;
64
- if ($[0] !== items || $[1] !== linkComponent) {
65
- let t3;
66
- if ($[3] !== items.length || $[4] !== linkComponent) {
67
- t3 = (crumb, index) => {
68
- const last = index === items.length - 1;
69
- return /*#__PURE__*/_jsxs("span", {
70
- className: last ? "flex min-w-0 items-center gap-1.5" : "hidden items-center gap-1.5 sm:flex",
71
- children: [/*#__PURE__*/_jsx(CrumbLabel, {
72
- crumb: crumb,
73
- last: last,
74
- Link: linkComponent
75
- }), last ? null : /*#__PURE__*/_jsx(ChevronRightIcon, {
76
- className: "size-3.5 shrink-0 text-faint",
77
- "aria-hidden": true
78
- })]
79
- }, crumb.href ?? index);
80
- };
81
- $[3] = items.length;
82
- $[4] = linkComponent;
83
- $[5] = t3;
84
- } else {
85
- t3 = $[5];
86
- }
87
- t2 = items.map(t3);
88
- $[0] = items;
89
- $[1] = linkComponent;
90
- $[2] = t2;
91
- } else {
92
- t2 = $[2];
93
- }
94
- let t3;
95
- if ($[6] !== t2) {
96
- t3 = /*#__PURE__*/_jsx("nav", {
97
- "aria-label": "Breadcrumb",
98
- className: "flex min-w-0 items-center gap-1.5 text-sm",
99
- children: t2
100
- });
101
- $[6] = t2;
102
- $[7] = t3;
103
- } else {
104
- t3 = $[7];
105
- }
106
- return t3;
27
+ function Breadcrumbs({
28
+ items,
29
+ linkComponent = "a"
30
+ }) {
31
+ return /*#__PURE__*/_jsx("nav", {
32
+ "aria-label": "Breadcrumb",
33
+ className: "flex min-w-0 items-center gap-1.5 text-sm",
34
+ children: items.map((crumb, index) => {
35
+ const last = index === items.length - 1;
36
+ return /*#__PURE__*/_jsxs("span", {
37
+ className: last ? "flex min-w-0 items-center gap-1.5" : "hidden items-center gap-1.5 sm:flex",
38
+ children: [/*#__PURE__*/_jsx(CrumbLabel, {
39
+ crumb: crumb,
40
+ last: last,
41
+ Link: linkComponent
42
+ }), last ? null : /*#__PURE__*/_jsx(ChevronRightIcon, {
43
+ className: "size-3.5 shrink-0 text-faint",
44
+ "aria-hidden": true
45
+ })]
46
+ }, crumb.href ?? index);
47
+ })
48
+ });
107
49
  }
108
50
  export { Breadcrumbs };
@@ -1,104 +1,40 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { cn } from "cn";
3
2
  import { TooltipProvider } from "../../overlay/tooltip.js";
4
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- function DocsShell(t0) {
6
- const $ = _c(18);
7
- const {
8
- header,
9
- sidebar,
10
- aside,
11
- children
12
- } = t0;
13
- const t1 = sidebar && "lg:grid lg:grid-cols-[18rem_minmax(0,1fr)]";
14
- let t2;
15
- if ($[0] !== t1) {
16
- t2 = cn("mx-auto w-full max-w-[1536px] flex-1 items-start px-2", t1);
17
- $[0] = t1;
18
- $[1] = t2;
19
- } else {
20
- t2 = $[1];
21
- }
22
- let t3;
23
- if ($[2] !== sidebar) {
24
- t3 = sidebar && /*#__PURE__*/_jsx("aside", {
25
- "data-slot": "docs-sidebar",
26
- className: "sticky top-[calc(var(--docs-header-height)+0.6rem)] hidden h-[calc(100svh-10rem)] lg:block",
27
- children: sidebar
28
- });
29
- $[2] = sidebar;
30
- $[3] = t3;
31
- } else {
32
- t3 = $[3];
33
- }
34
- let t4;
35
- if ($[4] !== children) {
36
- t4 = /*#__PURE__*/_jsx("main", {
37
- "data-slot": "docs-body",
38
- className: "min-w-0 flex-1 px-4 pt-6 pb-16 md:px-6 lg:pt-10",
39
- children: children
40
- });
41
- $[4] = children;
42
- $[5] = t4;
43
- } else {
44
- t4 = $[5];
45
- }
46
- let t5;
47
- if ($[6] !== aside) {
48
- t5 = aside && /*#__PURE__*/_jsx("aside", {
49
- "data-slot": "docs-aside",
50
- className: "sticky top-[calc(var(--docs-header-height)+1px)] hidden h-[90svh] w-72 shrink-0 flex-col gap-8 overflow-hidden pt-10 xl:flex",
51
- children: /*#__PURE__*/_jsx("div", {
52
- className: "no-scrollbar flex flex-col gap-8 overflow-y-auto px-8",
53
- children: aside
54
- })
55
- });
56
- $[6] = aside;
57
- $[7] = t5;
58
- } else {
59
- t5 = $[7];
60
- }
61
- let t6;
62
- if ($[8] !== t4 || $[9] !== t5) {
63
- t6 = /*#__PURE__*/_jsxs("div", {
64
- className: "flex min-w-0 items-stretch",
65
- children: [t4, t5]
66
- });
67
- $[8] = t4;
68
- $[9] = t5;
69
- $[10] = t6;
70
- } else {
71
- t6 = $[10];
72
- }
73
- let t7;
74
- if ($[11] !== t2 || $[12] !== t3 || $[13] !== t6) {
75
- t7 = /*#__PURE__*/_jsxs("div", {
76
- className: t2,
77
- children: [t3, t6]
78
- });
79
- $[11] = t2;
80
- $[12] = t3;
81
- $[13] = t6;
82
- $[14] = t7;
83
- } else {
84
- t7 = $[14];
85
- }
86
- let t8;
87
- if ($[15] !== header || $[16] !== t7) {
88
- t8 = /*#__PURE__*/_jsx(TooltipProvider, {
89
- delayDuration: 0,
90
- children: /*#__PURE__*/_jsxs("div", {
91
- "data-slot": "docs-shell",
92
- className: "flex min-h-svh flex-col bg-background [--docs-header-height:3.5rem] lg:[--docs-header-height:4rem]",
93
- children: [header, t7]
94
- })
95
- });
96
- $[15] = header;
97
- $[16] = t7;
98
- $[17] = t8;
99
- } else {
100
- t8 = $[17];
101
- }
102
- return t8;
4
+ function DocsShell({
5
+ header,
6
+ sidebar,
7
+ aside,
8
+ children
9
+ }) {
10
+ return /*#__PURE__*/_jsx(TooltipProvider, {
11
+ delayDuration: 0,
12
+ children: /*#__PURE__*/_jsxs("div", {
13
+ "data-slot": "docs-shell",
14
+ className: "flex min-h-svh flex-col bg-background [--docs-header-height:3.5rem] lg:[--docs-header-height:4rem]",
15
+ children: [header, /*#__PURE__*/_jsxs("div", {
16
+ className: cn("mx-auto w-full max-w-[1536px] flex-1 items-start px-2", sidebar && "lg:grid lg:grid-cols-[18rem_minmax(0,1fr)]"),
17
+ children: [sidebar && /*#__PURE__*/_jsx("aside", {
18
+ "data-slot": "docs-sidebar",
19
+ className: "sticky top-[calc(var(--docs-header-height)+0.6rem)] hidden h-[calc(100svh-10rem)] lg:block",
20
+ children: sidebar
21
+ }), /*#__PURE__*/_jsxs("div", {
22
+ className: "flex min-w-0 items-stretch",
23
+ children: [/*#__PURE__*/_jsx("main", {
24
+ "data-slot": "docs-body",
25
+ className: "min-w-0 flex-1 px-4 pt-6 pb-16 md:px-6 lg:pt-10",
26
+ children: children
27
+ }), aside && /*#__PURE__*/_jsx("aside", {
28
+ "data-slot": "docs-aside",
29
+ className: "sticky top-[calc(var(--docs-header-height)+1px)] hidden h-[90svh] w-72 shrink-0 flex-col gap-8 overflow-hidden pt-10 xl:flex",
30
+ children: /*#__PURE__*/_jsx("div", {
31
+ className: "no-scrollbar flex flex-col gap-8 overflow-y-auto px-8",
32
+ children: aside
33
+ })
34
+ })]
35
+ })]
36
+ })]
37
+ })
38
+ });
103
39
  }
104
40
  export { DocsShell };
@@ -1,93 +1,46 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { cn } from "cn";
3
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
- function DocsNavList(t0) {
5
- const $ = _c(9);
6
- const {
7
- groups,
8
- activeHref,
9
- linkComponent: t1
10
- } = t0;
11
- const Link = t1 === undefined ? "a" : t1;
12
- let t2;
13
- if ($[0] !== Link || $[1] !== activeHref || $[2] !== groups) {
14
- let t3;
15
- if ($[4] !== Link || $[5] !== activeHref) {
16
- t3 = group => /*#__PURE__*/_jsxs("div", {
17
- className: "flex flex-col",
18
- children: [/*#__PURE__*/_jsx("p", {
19
- className: "eyebrow flex h-8 items-center px-2",
20
- children: group.label
21
- }), /*#__PURE__*/_jsx("ul", {
22
- className: "flex flex-col gap-0.5",
23
- children: group.items.map(item => {
24
- const active = item.href === activeHref;
25
- return /*#__PURE__*/_jsx("li", {
26
- children: /*#__PURE__*/_jsx(Link, {
27
- href: item.href,
28
- "aria-current": active ? "page" : undefined,
29
- className: cn("flex h-[30px] w-fit items-center rounded-md border border-transparent px-2 text-sm font-medium transition-colors hover:bg-accent", active && "border-accent bg-accent"),
30
- children: item.title
31
- })
32
- }, item.href);
33
- })
34
- })]
35
- }, group.label);
36
- $[4] = Link;
37
- $[5] = activeHref;
38
- $[6] = t3;
39
- } else {
40
- t3 = $[6];
41
- }
42
- t2 = groups.map(t3);
43
- $[0] = Link;
44
- $[1] = activeHref;
45
- $[2] = groups;
46
- $[3] = t2;
47
- } else {
48
- t2 = $[3];
49
- }
50
- let t3;
51
- if ($[7] !== t2) {
52
- t3 = /*#__PURE__*/_jsx("div", {
53
- className: "flex flex-col gap-4",
54
- children: t2
55
- });
56
- $[7] = t2;
57
- $[8] = t3;
58
- } else {
59
- t3 = $[8];
60
- }
61
- return t3;
3
+ function DocsNavList({
4
+ groups,
5
+ activeHref,
6
+ linkComponent: Link = "a"
7
+ }) {
8
+ return /*#__PURE__*/_jsx("div", {
9
+ className: "flex flex-col gap-4",
10
+ children: groups.map(group => /*#__PURE__*/_jsxs("div", {
11
+ className: "flex flex-col",
12
+ children: [/*#__PURE__*/_jsx("p", {
13
+ className: "eyebrow flex h-8 items-center px-2",
14
+ children: group.label
15
+ }), /*#__PURE__*/_jsx("ul", {
16
+ className: "flex flex-col gap-0.5",
17
+ children: group.items.map(item => {
18
+ const active = item.href === activeHref;
19
+ return /*#__PURE__*/_jsx("li", {
20
+ children: /*#__PURE__*/_jsx(Link, {
21
+ href: item.href,
22
+ "aria-current": active ? "page" : undefined,
23
+ className: cn("flex h-[30px] w-fit items-center rounded-md border border-transparent px-2 text-sm font-medium transition-colors hover:bg-accent", active && "border-accent bg-accent"),
24
+ children: item.title
25
+ })
26
+ }, item.href);
27
+ })
28
+ })]
29
+ }, group.label))
30
+ });
62
31
  }
63
32
  function DocsSidebar(props) {
64
- const $ = _c(3);
65
- let t0;
66
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
67
- t0 = /*#__PURE__*/_jsx("div", {
33
+ return /*#__PURE__*/_jsxs("div", {
34
+ className: "relative h-full",
35
+ children: [/*#__PURE__*/_jsx("div", {
68
36
  className: "absolute top-12 right-2 bottom-0 w-px bg-[linear-gradient(to_bottom,transparent_0%,var(--border)_10%,var(--border)_90%,transparent_100%)]"
69
- });
70
- $[0] = t0;
71
- } else {
72
- t0 = $[0];
73
- }
74
- let t1;
75
- if ($[1] !== props) {
76
- t1 = /*#__PURE__*/_jsxs("div", {
77
- className: "relative h-full",
78
- children: [t0, /*#__PURE__*/_jsx("nav", {
79
- "aria-label": "Documentation",
80
- className: "no-scrollbar h-full w-56 overflow-y-auto pt-10 pb-12 pl-2.5 [mask-image:linear-gradient(to_bottom,transparent,black_2rem,black_calc(100%-3rem),transparent)]",
81
- children: /*#__PURE__*/_jsx(DocsNavList, {
82
- ...props
83
- })
84
- })]
85
- });
86
- $[1] = props;
87
- $[2] = t1;
88
- } else {
89
- t1 = $[2];
90
- }
91
- return t1;
37
+ }), /*#__PURE__*/_jsx("nav", {
38
+ "aria-label": "Documentation",
39
+ className: "no-scrollbar h-full w-56 overflow-y-auto pt-10 pb-12 pl-2.5 [mask-image:linear-gradient(to_bottom,transparent,black_2rem,black_calc(100%-3rem),transparent)]",
40
+ children: /*#__PURE__*/_jsx(DocsNavList, {
41
+ ...props
42
+ })
43
+ })]
44
+ });
92
45
  }
93
46
  export { DocsNavList, DocsSidebar };
@@ -1,4 +1,3 @@
1
- import { c as _c } from "react/compiler-runtime";
2
1
  import { useCallback, useEffect, useRef, useState } from "react";
3
2
  const SMOOTH_SCROLL_MS = 800;
4
3
  function isWindowScrolledToBottom() {
@@ -18,83 +17,40 @@ function lastSectionAboveLine(ids) {
18
17
  return current;
19
18
  }
20
19
  function useActiveSection(sectionIds) {
21
- const $ = _c(9);
22
20
  const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
23
21
  const pinnedUntil = useRef(0);
24
- let t0;
25
- if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26
- t0 = id => {
27
- if (Date.now() > pinnedUntil.current) {
28
- setActiveId(id);
29
- }
30
- };
31
- $[0] = t0;
32
- } else {
33
- t0 = $[0];
34
- }
35
- const followScroll = t0;
36
- let t1;
37
- if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
38
- t1 = id_0 => {
39
- pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
40
- setActiveId(id_0);
41
- };
42
- $[1] = t1;
43
- } else {
44
- t1 = $[1];
45
- }
46
- const pinSection = t1;
47
- let t2;
48
- if ($[2] !== sectionIds) {
49
- t2 = sectionIds.join(" ");
50
- $[2] = sectionIds;
51
- $[3] = t2;
52
- } else {
53
- t2 = $[3];
54
- }
55
- const idsKey = t2;
56
- let t3;
57
- let t4;
58
- if ($[4] !== idsKey) {
59
- t3 = () => {
60
- const ids = idsKey.split(" ").filter(Boolean);
61
- let frame = 0;
62
- const updateActiveSection = () => {
63
- cancelAnimationFrame(frame);
64
- frame = requestAnimationFrame(() => {
65
- const lastId = ids.at(-1);
66
- const current = isWindowScrolledToBottom() && lastId ? lastId : lastSectionAboveLine(ids);
67
- if (current) {
68
- followScroll(current);
69
- }
70
- });
71
- };
72
- updateActiveSection();
73
- window.addEventListener("scroll", updateActiveSection, {
74
- passive: true
22
+ const followScroll = useCallback(id => {
23
+ if (Date.now() > pinnedUntil.current) {
24
+ setActiveId(id);
25
+ }
26
+ }, []);
27
+ const pinSection = useCallback(id => {
28
+ pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
29
+ setActiveId(id);
30
+ }, []);
31
+ const idsKey = sectionIds.join(" ");
32
+ useEffect(() => {
33
+ const ids = idsKey.split(" ").filter(Boolean);
34
+ let frame = 0;
35
+ const updateActiveSection = () => {
36
+ cancelAnimationFrame(frame);
37
+ frame = requestAnimationFrame(() => {
38
+ const lastId = ids.at(-1);
39
+ const current = isWindowScrolledToBottom() && lastId ? lastId : lastSectionAboveLine(ids);
40
+ if (current) {
41
+ followScroll(current);
42
+ }
75
43
  });
76
- return () => {
77
- cancelAnimationFrame(frame);
78
- window.removeEventListener("scroll", updateActiveSection);
79
- };
80
44
  };
81
- t4 = [idsKey, followScroll];
82
- $[4] = idsKey;
83
- $[5] = t3;
84
- $[6] = t4;
85
- } else {
86
- t3 = $[5];
87
- t4 = $[6];
88
- }
89
- useEffect(t3, t4);
90
- let t5;
91
- if ($[7] !== activeId) {
92
- t5 = [activeId, pinSection];
93
- $[7] = activeId;
94
- $[8] = t5;
95
- } else {
96
- t5 = $[8];
97
- }
98
- return t5;
45
+ updateActiveSection();
46
+ window.addEventListener("scroll", updateActiveSection, {
47
+ passive: true
48
+ });
49
+ return () => {
50
+ cancelAnimationFrame(frame);
51
+ window.removeEventListener("scroll", updateActiveSection);
52
+ };
53
+ }, [idsKey, followScroll]);
54
+ return [activeId, pinSection];
99
55
  }
100
56
  export { useActiveSection };