@locusgraph/components 0.2.0 → 0.2.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 (102) hide show
  1. package/dist/action/button-group.js +148 -17
  2. package/dist/action/button.js +91 -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 +74 -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 +222 -13
  11. package/dist/display/chat/attachment/attachment.js +210 -28
  12. package/dist/display/chat/bubble.js +225 -37
  13. package/dist/display/chat/marker.js +143 -15
  14. package/dist/display/chat/message-scroller.js +276 -14
  15. package/dist/display/chat/message.js +238 -13
  16. package/dist/display/content/item.js +448 -47
  17. package/dist/display/content/kbd.js +78 -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 +309 -29
  22. package/dist/display/separator.js +56 -3
  23. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +79 -6
  24. package/dist/display/skeletons/layouts/skeleton-table.js +163 -5
  25. package/dist/display/skeletons/shapes/skeleton-avatar.js +95 -13
  26. package/dist/display/skeletons/shapes/skeleton-button.js +95 -13
  27. package/dist/display/skeletons/shapes/skeleton-text.js +78 -7
  28. package/dist/display/skeletons/skeleton-parts.js +63 -6
  29. package/dist/display/status/alert.js +136 -18
  30. package/dist/display/status/empty.js +250 -22
  31. package/dist/display/status/progress.js +116 -16
  32. package/dist/display/status/skeleton.js +40 -3
  33. package/dist/display/status/spinner.js +41 -3
  34. package/dist/display/table.js +310 -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 +117 -14
  48. package/dist/form/field/field-separator.js +70 -3
  49. package/dist/form/field/field-set.js +85 -5
  50. package/dist/form/field/field-text.js +116 -7
  51. package/dist/form/field/field.js +137 -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 +47 -3
  55. package/dist/form/label.js +42 -3
  56. package/dist/form/native-select.js +147 -7
  57. package/dist/form/textarea.js +41 -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 +23 -10
  70. package/dist/navigation/breadcrumb.js +301 -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 +366 -18
  75. package/dist/navigation/pagination.js +328 -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 +81 -5
  92. package/dist/shell/app-shell.js +58 -3
  93. package/dist/shell/breadcrumbs.js +102 -12
  94. package/dist/shell/docs/docs-header.js +210 -10
  95. package/dist/shell/docs/docs-shell.js +100 -3
  96. package/dist/shell/docs/docs-sidebar.js +88 -7
  97. package/dist/shell/docs/on-this-page.js +78 -7
  98. package/dist/shell/docs/use-active-section.js +88 -42
  99. package/dist/shell/navigation/app-sidebar.js +188 -6
  100. package/dist/shell/navigation/nav-group.js +161 -10
  101. package/dist/shell/theme-toggle.js +51 -4
  102. package/package.json +2 -2
@@ -1,57 +1,355 @@
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 Slot from "radix-ui/slot";
5
6
  import * as React from "react";
6
- import { Controller, FormProvider, useFormContext, useFormState, } from "react-hook-form";
7
+ import { Controller, FormProvider, useFormContext, useFormState } from "react-hook-form";
7
8
  import { Label } from "../label.js";
9
+ import { jsx as _jsx } from "react/jsx-runtime";
8
10
  const Form = FormProvider;
9
11
  const FormFieldContext = React.createContext({});
10
- const FormField = ({ ...props }) => {
11
- return (_jsx(FormFieldContext.Provider, { value: { name: props.name }, children: _jsx(Controller, { ...props }) }));
12
+ const FormField = t0 => {
13
+ const $ = _c(9);
14
+ let props;
15
+ if ($[0] !== t0) {
16
+ ({
17
+ ...props
18
+ } = t0);
19
+ $[0] = t0;
20
+ $[1] = props;
21
+ } else {
22
+ props = $[1];
23
+ }
24
+ let t1;
25
+ if ($[2] !== props.name) {
26
+ t1 = {
27
+ name: props.name
28
+ };
29
+ $[2] = props.name;
30
+ $[3] = t1;
31
+ } else {
32
+ t1 = $[3];
33
+ }
34
+ let t2;
35
+ if ($[4] !== props) {
36
+ t2 = /*#__PURE__*/_jsx(Controller, {
37
+ ...props
38
+ });
39
+ $[4] = props;
40
+ $[5] = t2;
41
+ } else {
42
+ t2 = $[5];
43
+ }
44
+ let t3;
45
+ if ($[6] !== t1 || $[7] !== t2) {
46
+ t3 = /*#__PURE__*/_jsx(FormFieldContext.Provider, {
47
+ value: t1,
48
+ children: t2
49
+ });
50
+ $[6] = t1;
51
+ $[7] = t2;
52
+ $[8] = t3;
53
+ } else {
54
+ t3 = $[8];
55
+ }
56
+ return t3;
12
57
  };
13
58
  const useFormField = () => {
14
- const fieldContext = React.useContext(FormFieldContext);
15
- const itemContext = React.useContext(FormItemContext);
16
- const { getFieldState } = useFormContext();
17
- const formState = useFormState({ name: fieldContext.name });
18
- const fieldState = getFieldState(fieldContext.name, formState);
19
- if (!fieldContext) {
20
- throw new Error("useFormField should be used within <FormField>");
21
- }
22
- const { id } = itemContext;
23
- return {
24
- id,
25
- name: fieldContext.name,
26
- formItemId: `${id}-form-item`,
27
- formDescriptionId: `${id}-form-item-description`,
28
- formMessageId: `${id}-form-item-message`,
29
- ...fieldState,
59
+ const $ = _c(13);
60
+ const fieldContext = React.useContext(FormFieldContext);
61
+ const itemContext = React.useContext(FormItemContext);
62
+ const {
63
+ getFieldState
64
+ } = useFormContext();
65
+ let t0;
66
+ if ($[0] !== fieldContext.name) {
67
+ t0 = {
68
+ name: fieldContext.name
30
69
  };
70
+ $[0] = fieldContext.name;
71
+ $[1] = t0;
72
+ } else {
73
+ t0 = $[1];
74
+ }
75
+ const formState = useFormState(t0);
76
+ let t1;
77
+ if ($[2] !== fieldContext.name || $[3] !== formState || $[4] !== getFieldState) {
78
+ t1 = getFieldState(fieldContext.name, formState);
79
+ $[2] = fieldContext.name;
80
+ $[3] = formState;
81
+ $[4] = getFieldState;
82
+ $[5] = t1;
83
+ } else {
84
+ t1 = $[5];
85
+ }
86
+ const fieldState = t1;
87
+ if (!fieldContext) {
88
+ throw new Error("useFormField should be used within <FormField>");
89
+ }
90
+ const {
91
+ id
92
+ } = itemContext;
93
+ const t2 = `${id}-form-item`;
94
+ const t3 = `${id}-form-item-description`;
95
+ const t4 = `${id}-form-item-message`;
96
+ let t5;
97
+ if ($[6] !== fieldContext.name || $[7] !== fieldState || $[8] !== id || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
98
+ t5 = {
99
+ id,
100
+ name: fieldContext.name,
101
+ formItemId: t2,
102
+ formDescriptionId: t3,
103
+ formMessageId: t4,
104
+ ...fieldState
105
+ };
106
+ $[6] = fieldContext.name;
107
+ $[7] = fieldState;
108
+ $[8] = id;
109
+ $[9] = t2;
110
+ $[10] = t3;
111
+ $[11] = t4;
112
+ $[12] = t5;
113
+ } else {
114
+ t5 = $[12];
115
+ }
116
+ return t5;
31
117
  };
32
118
  const FormItemContext = React.createContext({});
33
- function FormItem({ className, ...props }) {
34
- const id = React.useId();
35
- return (_jsx(FormItemContext.Provider, { value: { id }, children: _jsx("div", { "data-slot": "form-item", className: cn("grid gap-2", className), ...props }) }));
119
+ function FormItem(t0) {
120
+ const $ = _c(13);
121
+ let className;
122
+ let props;
123
+ if ($[0] !== t0) {
124
+ ({
125
+ className,
126
+ ...props
127
+ } = t0);
128
+ $[0] = t0;
129
+ $[1] = className;
130
+ $[2] = props;
131
+ } else {
132
+ className = $[1];
133
+ props = $[2];
134
+ }
135
+ const id = React.useId();
136
+ let t1;
137
+ if ($[3] !== id) {
138
+ t1 = {
139
+ id
140
+ };
141
+ $[3] = id;
142
+ $[4] = t1;
143
+ } else {
144
+ t1 = $[4];
145
+ }
146
+ let t2;
147
+ if ($[5] !== className) {
148
+ t2 = cn("grid gap-2", className);
149
+ $[5] = className;
150
+ $[6] = t2;
151
+ } else {
152
+ t2 = $[6];
153
+ }
154
+ let t3;
155
+ if ($[7] !== props || $[8] !== t2) {
156
+ t3 = /*#__PURE__*/_jsx("div", {
157
+ "data-slot": "form-item",
158
+ className: t2,
159
+ ...props
160
+ });
161
+ $[7] = props;
162
+ $[8] = t2;
163
+ $[9] = t3;
164
+ } else {
165
+ t3 = $[9];
166
+ }
167
+ let t4;
168
+ if ($[10] !== t1 || $[11] !== t3) {
169
+ t4 = /*#__PURE__*/_jsx(FormItemContext.Provider, {
170
+ value: t1,
171
+ children: t3
172
+ });
173
+ $[10] = t1;
174
+ $[11] = t3;
175
+ $[12] = t4;
176
+ } else {
177
+ t4 = $[12];
178
+ }
179
+ return t4;
36
180
  }
37
- function FormLabel({ className, ...props }) {
38
- const { error, formItemId } = useFormField();
39
- return (_jsx(Label, { "data-slot": "form-label", "data-error": !!error, className: className, htmlFor: formItemId, ...props }));
181
+ function FormLabel(t0) {
182
+ const $ = _c(8);
183
+ let className;
184
+ let props;
185
+ if ($[0] !== t0) {
186
+ ({
187
+ className,
188
+ ...props
189
+ } = t0);
190
+ $[0] = t0;
191
+ $[1] = className;
192
+ $[2] = props;
193
+ } else {
194
+ className = $[1];
195
+ props = $[2];
196
+ }
197
+ const {
198
+ error,
199
+ formItemId
200
+ } = useFormField();
201
+ const t1 = !!error;
202
+ let t2;
203
+ if ($[3] !== className || $[4] !== formItemId || $[5] !== props || $[6] !== t1) {
204
+ t2 = /*#__PURE__*/_jsx(Label, {
205
+ "data-slot": "form-label",
206
+ "data-error": t1,
207
+ className: className,
208
+ htmlFor: formItemId,
209
+ ...props
210
+ });
211
+ $[3] = className;
212
+ $[4] = formItemId;
213
+ $[5] = props;
214
+ $[6] = t1;
215
+ $[7] = t2;
216
+ } else {
217
+ t2 = $[7];
218
+ }
219
+ return t2;
40
220
  }
41
- function FormControl({ ...props }) {
42
- const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
43
- return (_jsx(Slot.Root, { "data-slot": "form-control", id: formItemId, "aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`, "aria-invalid": !!error, ...props }));
221
+ function FormControl(t0) {
222
+ const $ = _c(7);
223
+ let props;
224
+ if ($[0] !== t0) {
225
+ ({
226
+ ...props
227
+ } = t0);
228
+ $[0] = t0;
229
+ $[1] = props;
230
+ } else {
231
+ props = $[1];
232
+ }
233
+ const {
234
+ error,
235
+ formItemId,
236
+ formDescriptionId,
237
+ formMessageId
238
+ } = useFormField();
239
+ const t1 = !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`;
240
+ const t2 = !!error;
241
+ let t3;
242
+ if ($[2] !== formItemId || $[3] !== props || $[4] !== t1 || $[5] !== t2) {
243
+ t3 = /*#__PURE__*/_jsx(Slot.Root, {
244
+ "data-slot": "form-control",
245
+ id: formItemId,
246
+ "aria-describedby": t1,
247
+ "aria-invalid": t2,
248
+ ...props
249
+ });
250
+ $[2] = formItemId;
251
+ $[3] = props;
252
+ $[4] = t1;
253
+ $[5] = t2;
254
+ $[6] = t3;
255
+ } else {
256
+ t3 = $[6];
257
+ }
258
+ return t3;
44
259
  }
45
- function FormDescription({ className, ...props }) {
46
- const { formDescriptionId } = useFormField();
47
- return (_jsx("p", { "data-slot": "form-description", id: formDescriptionId, className: cn("text-sm text-muted-foreground", className), ...props }));
260
+ function FormDescription(t0) {
261
+ const $ = _c(9);
262
+ let className;
263
+ let props;
264
+ if ($[0] !== t0) {
265
+ ({
266
+ className,
267
+ ...props
268
+ } = t0);
269
+ $[0] = t0;
270
+ $[1] = className;
271
+ $[2] = props;
272
+ } else {
273
+ className = $[1];
274
+ props = $[2];
275
+ }
276
+ const {
277
+ formDescriptionId
278
+ } = useFormField();
279
+ let t1;
280
+ if ($[3] !== className) {
281
+ t1 = cn("text-sm text-muted-foreground", className);
282
+ $[3] = className;
283
+ $[4] = t1;
284
+ } else {
285
+ t1 = $[4];
286
+ }
287
+ let t2;
288
+ if ($[5] !== formDescriptionId || $[6] !== props || $[7] !== t1) {
289
+ t2 = /*#__PURE__*/_jsx("p", {
290
+ "data-slot": "form-description",
291
+ id: formDescriptionId,
292
+ className: t1,
293
+ ...props
294
+ });
295
+ $[5] = formDescriptionId;
296
+ $[6] = props;
297
+ $[7] = t1;
298
+ $[8] = t2;
299
+ } else {
300
+ t2 = $[8];
301
+ }
302
+ return t2;
48
303
  }
49
- function FormMessage({ className, ...props }) {
50
- const { error, formMessageId } = useFormField();
51
- const body = error ? String(error?.message ?? "") : props.children;
52
- if (!body) {
53
- return null;
54
- }
55
- return (_jsx("p", { "data-slot": "form-message", id: formMessageId, className: cn("text-sm text-destructive", className), ...props, children: body }));
304
+ function FormMessage(t0) {
305
+ const $ = _c(10);
306
+ let className;
307
+ let props;
308
+ if ($[0] !== t0) {
309
+ ({
310
+ className,
311
+ ...props
312
+ } = t0);
313
+ $[0] = t0;
314
+ $[1] = className;
315
+ $[2] = props;
316
+ } else {
317
+ className = $[1];
318
+ props = $[2];
319
+ }
320
+ const {
321
+ error,
322
+ formMessageId
323
+ } = useFormField();
324
+ const body = error ? String(error?.message ?? "") : props.children;
325
+ if (!body) {
326
+ return null;
327
+ }
328
+ let t1;
329
+ if ($[3] !== className) {
330
+ t1 = cn("text-sm text-destructive", className);
331
+ $[3] = className;
332
+ $[4] = t1;
333
+ } else {
334
+ t1 = $[4];
335
+ }
336
+ let t2;
337
+ if ($[5] !== body || $[6] !== formMessageId || $[7] !== props || $[8] !== t1) {
338
+ t2 = /*#__PURE__*/_jsx("p", {
339
+ "data-slot": "form-message",
340
+ id: formMessageId,
341
+ className: t1,
342
+ ...props,
343
+ children: body
344
+ });
345
+ $[5] = body;
346
+ $[6] = formMessageId;
347
+ $[7] = props;
348
+ $[8] = t1;
349
+ $[9] = t2;
350
+ } else {
351
+ t2 = $[9];
352
+ }
353
+ return t2;
56
354
  }
57
- export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField, };
355
+ export { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, useFormField };