@locusgraph/components 0.2.0 → 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 (102) hide show
  1. package/dist/action/button-group.js +45 -17
  2. package/dist/action/button.js +44 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +70 -17
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.js +33 -20
  7. package/dist/display/chart/chart-container.js +205 -45
  8. package/dist/display/chart/chart-legend.js +79 -14
  9. package/dist/display/chart/chart-tooltip.js +211 -40
  10. package/dist/display/chat/attachment/attachment-parts.js +56 -13
  11. package/dist/display/chat/attachment/attachment.js +70 -28
  12. package/dist/display/chat/bubble.js +80 -37
  13. package/dist/display/chat/marker.js +44 -15
  14. package/dist/display/chat/message-scroller.js +276 -14
  15. package/dist/display/chat/message.js +58 -13
  16. package/dist/display/content/item.js +134 -47
  17. package/dist/display/content/kbd.js +19 -5
  18. package/dist/display/media/aspect-ratio.js +27 -3
  19. package/dist/display/media/carousel-controls.js +162 -11
  20. package/dist/display/media/carousel.js +325 -65
  21. package/dist/display/rule-grid/rule-grid.js +86 -29
  22. package/dist/display/separator.js +56 -3
  23. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +30 -6
  24. package/dist/display/skeletons/layouts/skeleton-table.js +44 -6
  25. package/dist/display/skeletons/shapes/skeleton-avatar.js +31 -13
  26. package/dist/display/skeletons/shapes/skeleton-button.js +31 -13
  27. package/dist/display/skeletons/shapes/skeleton-text.js +25 -7
  28. package/dist/display/skeletons/skeleton-parts.js +22 -6
  29. package/dist/display/status/alert.js +44 -18
  30. package/dist/display/status/empty.js +69 -22
  31. package/dist/display/status/progress.js +116 -16
  32. package/dist/display/status/skeleton.js +10 -3
  33. package/dist/display/status/spinner.js +11 -3
  34. package/dist/display/table.js +77 -17
  35. package/dist/feedback/toaster.js +98 -21
  36. package/dist/form/advanced/calendar-day-button.js +89 -12
  37. package/dist/form/advanced/calendar.js +349 -56
  38. package/dist/form/advanced/combobox/combobox-chips.js +151 -8
  39. package/dist/form/advanced/combobox/combobox-items.js +239 -14
  40. package/dist/form/advanced/combobox/combobox.js +386 -13
  41. package/dist/form/advanced/input-otp.js +201 -11
  42. package/dist/form/choice/checkbox.js +58 -3
  43. package/dist/form/choice/radio-group.js +94 -5
  44. package/dist/form/choice/select.js +479 -25
  45. package/dist/form/choice/slider.js +118 -4
  46. package/dist/form/choice/switch.js +53 -3
  47. package/dist/form/field/field-error.js +34 -14
  48. package/dist/form/field/field-separator.js +19 -3
  49. package/dist/form/field/field-set.js +21 -5
  50. package/dist/form/field/field-text.js +28 -7
  51. package/dist/form/field/field.js +43 -25
  52. package/dist/form/hook-form/form.js +338 -40
  53. package/dist/form/input-group.js +297 -47
  54. package/dist/form/input.js +13 -3
  55. package/dist/form/label.js +42 -3
  56. package/dist/form/native-select.js +39 -7
  57. package/dist/form/textarea.js +11 -3
  58. package/dist/layout/accordion.js +165 -8
  59. package/dist/layout/collapsible.js +75 -7
  60. package/dist/layout/resizable.js +122 -7
  61. package/dist/layout/scroll/direction.js +25 -3
  62. package/dist/layout/scroll/scroll-area.js +138 -5
  63. package/dist/layout/sidebar/sidebar-context.js +184 -51
  64. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  65. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  66. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  67. package/dist/layout/sidebar/sidebar.js +384 -28
  68. package/dist/layout/tabs.js +183 -18
  69. package/dist/layout/use-mobile.js +11 -11
  70. package/dist/navigation/breadcrumb.js +82 -17
  71. package/dist/navigation/menubar/menubar-items.js +322 -16
  72. package/dist/navigation/menubar/menubar-sub.js +125 -7
  73. package/dist/navigation/menubar/menubar.js +213 -13
  74. package/dist/navigation/navigation-menu.js +90 -18
  75. package/dist/navigation/pagination.js +91 -20
  76. package/dist/overlay/alert-dialog.js +485 -26
  77. package/dist/overlay/context-menu/context-menu-items.js +322 -16
  78. package/dist/overlay/context-menu/context-menu-sub.js +125 -7
  79. package/dist/overlay/context-menu/context-menu.js +140 -11
  80. package/dist/overlay/dialog.js +405 -24
  81. package/dist/overlay/floating/command.js +423 -20
  82. package/dist/overlay/floating/drawer.js +354 -22
  83. package/dist/overlay/floating/hover-card.js +107 -7
  84. package/dist/overlay/menu/dropdown-menu-choice.js +149 -7
  85. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  86. package/dist/overlay/menu/dropdown-menu-sub.js +124 -7
  87. package/dist/overlay/menu/dropdown-menu.js +147 -12
  88. package/dist/overlay/popover.js +106 -7
  89. package/dist/overlay/sheet.js +379 -26
  90. package/dist/overlay/tooltip.js +145 -9
  91. package/dist/shell/app-header.js +29 -5
  92. package/dist/shell/app-shell.js +19 -3
  93. package/dist/shell/breadcrumbs.js +46 -14
  94. package/dist/shell/docs/docs-header.js +210 -10
  95. package/dist/shell/docs/docs-shell.js +36 -3
  96. package/dist/shell/docs/docs-sidebar.js +41 -7
  97. package/dist/shell/docs/on-this-page.js +78 -7
  98. package/dist/shell/docs/use-active-section.js +44 -42
  99. package/dist/shell/navigation/app-sidebar.js +66 -6
  100. package/dist/shell/navigation/nav-group.js +53 -11
  101. package/dist/shell/theme-toggle.js +51 -4
  102. package/package.json +2 -2
@@ -1,8 +1,58 @@
1
1
  "use client";
2
- import { jsx as _jsx } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import * as SwitchPrimitive from "radix-ui/switch";
5
- function Switch({ className, ...props }) {
6
- return (_jsx(SwitchPrimitive.Root, { "data-slot": "switch", className: cn("peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent px-px transition-all outline-none", "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", "focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", className), ...props, children: _jsx(SwitchPrimitive.Thumb, { "data-slot": "switch-thumb", className: cn("pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform", "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0") }) }));
6
+ import * as React from "react";
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ function Switch(t0) {
9
+ const $ = _c(9);
10
+ let className;
11
+ let props;
12
+ if ($[0] !== t0) {
13
+ ({
14
+ className,
15
+ ...props
16
+ } = t0);
17
+ $[0] = t0;
18
+ $[1] = className;
19
+ $[2] = props;
20
+ } else {
21
+ className = $[1];
22
+ props = $[2];
23
+ }
24
+ let t1;
25
+ if ($[3] !== className) {
26
+ t1 = cn("peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent px-px transition-all outline-none", "data-[state=checked]:bg-primary data-[state=unchecked]:bg-input", "focus-visible:ring-2 focus-visible:ring-ring/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50", className);
27
+ $[3] = className;
28
+ $[4] = t1;
29
+ } else {
30
+ t1 = $[4];
31
+ }
32
+ let t2;
33
+ if ($[5] === Symbol.for("react.memo_cache_sentinel")) {
34
+ t2 = /*#__PURE__*/_jsx(SwitchPrimitive.Thumb, {
35
+ "data-slot": "switch-thumb",
36
+ className: cn("pointer-events-none block size-4 rounded-full bg-background shadow-sm ring-0 transition-transform", "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0")
37
+ });
38
+ $[5] = t2;
39
+ } else {
40
+ t2 = $[5];
41
+ }
42
+ let t3;
43
+ if ($[6] !== props || $[7] !== t1) {
44
+ t3 = /*#__PURE__*/_jsx(SwitchPrimitive.Root, {
45
+ "data-slot": "switch",
46
+ className: t1,
47
+ ...props,
48
+ children: t2
49
+ });
50
+ $[6] = props;
51
+ $[7] = t1;
52
+ $[8] = t3;
53
+ } else {
54
+ t3 = $[8];
55
+ }
56
+ return t3;
7
57
  }
8
58
  export { Switch };
@@ -1,20 +1,40 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  function uniqueMessages(errors) {
4
- const messages = errors.map((error) => error?.message).filter((message) => !!message);
5
- return [...new Set(messages)];
4
+ const messages = errors.map(error => error?.message).filter(message => !!message);
5
+ return [...new Set(messages)];
6
6
  }
7
- function FieldErrorContent({ messages }) {
8
- if (messages.length === 1) {
9
- return messages[0];
10
- }
11
- return (_jsx("ul", { className: "ml-4 flex list-disc flex-col gap-1", children: messages.map((message) => (_jsx("li", { children: message }, message))) }));
7
+ function FieldErrorContent({
8
+ messages
9
+ }) {
10
+ if (messages.length === 1) {
11
+ return messages[0];
12
+ }
13
+ return /*#__PURE__*/_jsx("ul", {
14
+ className: "ml-4 flex list-disc flex-col gap-1",
15
+ children: messages.map(message => /*#__PURE__*/_jsx("li", {
16
+ children: message
17
+ }, message))
18
+ });
12
19
  }
13
- function FieldError({ className, children, errors, ...props }) {
14
- const messages = uniqueMessages(errors ?? []);
15
- if (!children && messages.length === 0) {
16
- return null;
17
- }
18
- return (_jsx("div", { role: "alert", "data-slot": "field-error", className: cn("text-sm font-normal text-destructive", className), ...props, children: children ?? _jsx(FieldErrorContent, { messages: messages }) }));
20
+ function FieldError({
21
+ className,
22
+ children,
23
+ errors,
24
+ ...props
25
+ }) {
26
+ const messages = uniqueMessages(errors ?? []);
27
+ if (!children && messages.length === 0) {
28
+ return null;
29
+ }
30
+ return /*#__PURE__*/_jsx("div", {
31
+ role: "alert",
32
+ "data-slot": "field-error",
33
+ className: cn("text-sm font-normal text-destructive", className),
34
+ ...props,
35
+ children: children ?? /*#__PURE__*/_jsx(FieldErrorContent, {
36
+ messages: messages
37
+ })
38
+ });
19
39
  }
20
40
  export { FieldError };
@@ -1,7 +1,23 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
2
  import { Separator } from "../../display/separator.js";
4
- function FieldSeparator({ children, className, ...props }) {
5
- return (_jsxs("div", { "data-slot": "field-separator", "data-content": !!children, className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className), ...props, children: [_jsx(Separator, { className: "absolute inset-0 top-1/2" }), children && (_jsx("span", { className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground", "data-slot": "field-separator-content", children: children }))] }));
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ function FieldSeparator({
5
+ children,
6
+ className,
7
+ ...props
8
+ }) {
9
+ return /*#__PURE__*/_jsxs("div", {
10
+ "data-slot": "field-separator",
11
+ "data-content": !!children,
12
+ className: cn("relative -my-2 h-5 text-sm group-data-[variant=outline]/field-group:-mb-2", className),
13
+ ...props,
14
+ children: [/*#__PURE__*/_jsx(Separator, {
15
+ className: "absolute inset-0 top-1/2"
16
+ }), children && /*#__PURE__*/_jsx("span", {
17
+ className: "relative mx-auto block w-fit bg-background px-2 text-muted-foreground",
18
+ "data-slot": "field-separator-content",
19
+ children: children
20
+ })]
21
+ });
6
22
  }
7
23
  export { FieldSeparator };
@@ -1,9 +1,25 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
- function FieldSet({ className, ...props }) {
4
- return (_jsx("fieldset", { "data-slot": "field-set", className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className), ...props }));
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ function FieldSet({
4
+ className,
5
+ ...props
6
+ }) {
7
+ return /*#__PURE__*/_jsx("fieldset", {
8
+ "data-slot": "field-set",
9
+ className: cn("flex flex-col gap-6", "has-[>[data-slot=checkbox-group]]:gap-3 has-[>[data-slot=radio-group]]:gap-3", className),
10
+ ...props
11
+ });
5
12
  }
6
- function FieldLegend({ className, variant = "legend", ...props }) {
7
- return (_jsx("legend", { "data-slot": "field-legend", "data-variant": variant, className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className), ...props }));
13
+ function FieldLegend({
14
+ className,
15
+ variant = "legend",
16
+ ...props
17
+ }) {
18
+ return /*#__PURE__*/_jsx("legend", {
19
+ "data-slot": "field-legend",
20
+ "data-variant": variant,
21
+ className: cn("mb-3 font-medium", "data-[variant=legend]:text-base", "data-[variant=label]:text-sm", className),
22
+ ...props
23
+ });
8
24
  }
9
25
  export { FieldLegend, FieldSet };
@@ -1,13 +1,34 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
2
  import { Label } from "../label.js";
4
- function FieldLabel({ className, ...props }) {
5
- return (_jsx(Label, { "data-slot": "field-label", className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", className), ...props }));
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
+ function FieldLabel({
5
+ className,
6
+ ...props
7
+ }) {
8
+ return /*#__PURE__*/_jsx(Label, {
9
+ "data-slot": "field-label",
10
+ className: cn("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50", "has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col has-[>[data-slot=field]]:rounded-md has-[>[data-slot=field]]:border [&>*]:data-[slot=field]:p-4", "has-data-[state=checked]:border-primary has-data-[state=checked]:bg-primary/5 dark:has-data-[state=checked]:bg-primary/10", className),
11
+ ...props
12
+ });
6
13
  }
7
- function FieldTitle({ className, ...props }) {
8
- return (_jsx("div", { "data-slot": "field-label", className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className), ...props }));
14
+ function FieldTitle({
15
+ className,
16
+ ...props
17
+ }) {
18
+ return /*#__PURE__*/_jsx("div", {
19
+ "data-slot": "field-label",
20
+ className: cn("flex w-fit items-center gap-2 text-sm leading-snug font-medium group-data-[disabled=true]/field:opacity-50", className),
21
+ ...props
22
+ });
9
23
  }
10
- function FieldDescription({ className, ...props }) {
11
- return (_jsx("p", { "data-slot": "field-description", className: cn("text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className), ...props }));
24
+ function FieldDescription({
25
+ className,
26
+ ...props
27
+ }) {
28
+ return /*#__PURE__*/_jsx("p", {
29
+ "data-slot": "field-description",
30
+ className: cn("text-sm leading-normal font-normal text-muted-foreground group-has-[[data-orientation=horizontal]]/field:text-balance", "last:mt-0 nth-last-2:-mt-1 [[data-variant=legend]+&]:-mt-1.5", "[&>a]:underline [&>a]:underline-offset-4 [&>a:hover]:text-primary", className),
31
+ ...props
32
+ });
12
33
  }
13
34
  export { FieldDescription, FieldLabel, FieldTitle };
@@ -1,33 +1,51 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { cva } from "class-variance-authority";
3
2
  import { cn } from "cn";
3
+ import { jsx as _jsx } from "react/jsx-runtime";
4
4
  const fieldVariants = cva("group/field flex w-full gap-3", {
5
- variants: {
6
- orientation: {
7
- vertical: ["flex-col gap-2 [&>*]:w-full [&>.sr-only]:w-auto"],
8
- horizontal: [
9
- "flex-row items-center",
10
- "[&>[data-slot=field-label]]:flex-auto",
11
- "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
12
- ],
13
- responsive: [
14
- "flex-col gap-2 @md/field-group:flex-row @md/field-group:gap-3 @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
15
- "@md/field-group:[&>[data-slot=field-label]]:flex-auto",
16
- "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",
17
- ],
18
- },
19
- },
20
- defaultVariants: {
21
- orientation: "vertical",
22
- },
5
+ variants: {
6
+ orientation: {
7
+ vertical: ["flex-col gap-2 [&>*]:w-full [&>.sr-only]:w-auto"],
8
+ horizontal: ["flex-row items-center", "[&>[data-slot=field-label]]:flex-auto", "has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"],
9
+ responsive: ["flex-col gap-2 @md/field-group:flex-row @md/field-group:gap-3 @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto", "@md/field-group:[&>[data-slot=field-label]]:flex-auto", "@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"]
10
+ }
11
+ },
12
+ defaultVariants: {
13
+ orientation: "vertical"
14
+ }
23
15
  });
24
- function Field({ className, orientation = "vertical", ...props }) {
25
- return (_jsx("div", { role: "group", "data-slot": "field", "data-orientation": orientation, className: cn(fieldVariants({ orientation }), className), ...props }));
16
+ function Field({
17
+ className,
18
+ orientation = "vertical",
19
+ ...props
20
+ }) {
21
+ return /*#__PURE__*/_jsx("div", {
22
+ role: "group",
23
+ "data-slot": "field",
24
+ "data-orientation": orientation,
25
+ className: cn(fieldVariants({
26
+ orientation
27
+ }), className),
28
+ ...props
29
+ });
26
30
  }
27
- function FieldGroup({ className, ...props }) {
28
- return (_jsx("div", { "data-slot": "field-group", className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className), ...props }));
31
+ function FieldGroup({
32
+ className,
33
+ ...props
34
+ }) {
35
+ return /*#__PURE__*/_jsx("div", {
36
+ "data-slot": "field-group",
37
+ className: cn("group/field-group @container/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4", className),
38
+ ...props
39
+ });
29
40
  }
30
- function FieldContent({ className, ...props }) {
31
- return (_jsx("div", { "data-slot": "field-content", className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className), ...props }));
41
+ function FieldContent({
42
+ className,
43
+ ...props
44
+ }) {
45
+ return /*#__PURE__*/_jsx("div", {
46
+ "data-slot": "field-content",
47
+ className: cn("group/field-content flex flex-1 flex-col gap-1.5 leading-snug", className),
48
+ ...props
49
+ });
32
50
  }
33
51
  export { Field, FieldContent, FieldGroup, fieldVariants };