@easyops-cn/a2ui-react 0.0.4 → 0.0.6

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 (57) hide show
  1. package/README.md +15 -7
  2. package/dist/0.8/A2UIRenderer.d.ts +43 -35
  3. package/dist/0.8/A2UIRenderer.js +12 -34
  4. package/dist/0.8/components/display/AudioPlayerComponent.js +2 -2
  5. package/dist/0.8/components/display/DividerComponent.js +1 -1
  6. package/dist/0.8/components/display/IconComponent.js +2 -2
  7. package/dist/0.8/components/display/ImageComponent.js +2 -2
  8. package/dist/0.8/components/display/TextComponent.js +2 -2
  9. package/dist/0.8/components/display/VideoComponent.js +2 -2
  10. package/dist/0.8/components/interactive/ButtonComponent.js +2 -2
  11. package/dist/0.8/components/interactive/CheckBoxComponent.js +4 -4
  12. package/dist/0.8/components/interactive/DateTimeInputComponent.js +6 -6
  13. package/dist/0.8/components/interactive/MultipleChoiceComponent.js +5 -5
  14. package/dist/0.8/components/interactive/SliderComponent.js +3 -3
  15. package/dist/0.8/components/interactive/TextFieldComponent.js +5 -5
  16. package/dist/0.8/components/layout/CardComponent.js +1 -1
  17. package/dist/0.8/components/layout/ColumnComponent.js +3 -3
  18. package/dist/0.8/components/layout/ListComponent.js +3 -3
  19. package/dist/0.8/components/layout/ModalComponent.js +1 -1
  20. package/dist/0.8/components/layout/RowComponent.js +3 -3
  21. package/dist/0.8/components/layout/TabsComponent.js +2 -2
  22. package/dist/0.8/contexts/A2UIProvider.d.ts +40 -13
  23. package/dist/0.8/contexts/A2UIProvider.js +32 -7
  24. package/dist/0.8/hooks/useDataBinding.js +17 -12
  25. package/dist/0.8/index.d.ts +20 -2
  26. package/dist/0.8/index.js +13 -9
  27. package/dist/components/ui/button.js +53 -0
  28. package/dist/components/ui/calendar.js +173 -0
  29. package/dist/components/ui/card.js +29 -0
  30. package/dist/components/ui/checkbox.js +31 -0
  31. package/dist/components/ui/dialog.js +77 -0
  32. package/dist/components/ui/input.js +21 -0
  33. package/dist/components/ui/label.js +22 -0
  34. package/dist/components/ui/popover.js +38 -0
  35. package/dist/components/ui/select.js +144 -0
  36. package/dist/components/ui/separator.js +26 -0
  37. package/dist/components/ui/slider.js +63 -0
  38. package/dist/components/ui/tabs.js +67 -0
  39. package/dist/components/ui/textarea.js +18 -0
  40. package/dist/lib/utils.js +8 -0
  41. package/package.json +1 -1
  42. package/dist/0.8/A2UIRenderer.test.d.ts +0 -6
  43. package/dist/0.8/components/ComponentRenderer.test.d.ts +0 -6
  44. package/dist/0.8/components/display/display.test.d.ts +0 -7
  45. package/dist/0.8/components/interactive/interactive.test.d.ts +0 -7
  46. package/dist/0.8/components/layout/layout.test.d.ts +0 -7
  47. package/dist/0.8/contexts/A2UIProvider.test.d.ts +0 -6
  48. package/dist/0.8/contexts/ActionContext.test.d.ts +0 -6
  49. package/dist/0.8/contexts/DataModelContext.test.d.ts +0 -6
  50. package/dist/0.8/contexts/SurfaceContext.test.d.ts +0 -6
  51. package/dist/0.8/hooks/useA2UIMessageHandler.test.d.ts +0 -6
  52. package/dist/0.8/hooks/useComponent.test.d.ts +0 -6
  53. package/dist/0.8/hooks/useDataBinding.test.d.ts +0 -6
  54. package/dist/0.8/hooks/useDispatchAction.test.d.ts +0 -6
  55. package/dist/0.8/hooks/useSurface.test.d.ts +0 -6
  56. package/dist/0.8/utils/dataBinding.test.d.ts +0 -6
  57. package/dist/0.8/utils/pathUtils.test.d.ts +0 -6
@@ -0,0 +1,63 @@
1
+ import { jsxs as h, jsx as e } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import * as a from "@radix-ui/react-slider";
4
+ import { cn as n } from "../../lib/utils.js";
5
+ function v({
6
+ className: l,
7
+ defaultValue: r,
8
+ value: t,
9
+ min: i = 0,
10
+ max: o = 100,
11
+ ...s
12
+ }) {
13
+ const d = m.useMemo(
14
+ () => Array.isArray(t) ? t : Array.isArray(r) ? r : [i, o],
15
+ [t, r, i, o]
16
+ );
17
+ return /* @__PURE__ */ h(
18
+ a.Root,
19
+ {
20
+ "data-slot": "slider",
21
+ defaultValue: r,
22
+ value: t,
23
+ min: i,
24
+ max: o,
25
+ className: n(
26
+ "relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50 data-[orientation=vertical]:h-full data-[orientation=vertical]:min-h-44 data-[orientation=vertical]:w-auto data-[orientation=vertical]:flex-col",
27
+ l
28
+ ),
29
+ ...s,
30
+ children: [
31
+ /* @__PURE__ */ e(
32
+ a.Track,
33
+ {
34
+ "data-slot": "slider-track",
35
+ className: n(
36
+ "bg-muted relative grow overflow-hidden rounded-full data-[orientation=horizontal]:h-1.5 data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-1.5"
37
+ ),
38
+ children: /* @__PURE__ */ e(
39
+ a.Range,
40
+ {
41
+ "data-slot": "slider-range",
42
+ className: n(
43
+ "bg-primary absolute data-[orientation=horizontal]:h-full data-[orientation=vertical]:w-full"
44
+ )
45
+ }
46
+ )
47
+ }
48
+ ),
49
+ Array.from({ length: d.length }, (f, c) => /* @__PURE__ */ e(
50
+ a.Thumb,
51
+ {
52
+ "data-slot": "slider-thumb",
53
+ className: "border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-white shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
54
+ },
55
+ c
56
+ ))
57
+ ]
58
+ }
59
+ );
60
+ }
61
+ export {
62
+ v as Slider
63
+ };
@@ -0,0 +1,67 @@
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import * as s from "@radix-ui/react-tabs";
3
+ import { cn as i } from "../../lib/utils.js";
4
+ function o({
5
+ className: t,
6
+ ...e
7
+ }) {
8
+ return /* @__PURE__ */ a(
9
+ s.Root,
10
+ {
11
+ "data-slot": "tabs",
12
+ className: i("flex flex-col gap-2", t),
13
+ ...e
14
+ }
15
+ );
16
+ }
17
+ function d({
18
+ className: t,
19
+ ...e
20
+ }) {
21
+ return /* @__PURE__ */ a(
22
+ s.List,
23
+ {
24
+ "data-slot": "tabs-list",
25
+ className: i(
26
+ "bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",
27
+ t
28
+ ),
29
+ ...e
30
+ }
31
+ );
32
+ }
33
+ function c({
34
+ className: t,
35
+ ...e
36
+ }) {
37
+ return /* @__PURE__ */ a(
38
+ s.Trigger,
39
+ {
40
+ "data-slot": "tabs-trigger",
41
+ className: i(
42
+ "data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
43
+ t
44
+ ),
45
+ ...e
46
+ }
47
+ );
48
+ }
49
+ function l({
50
+ className: t,
51
+ ...e
52
+ }) {
53
+ return /* @__PURE__ */ a(
54
+ s.Content,
55
+ {
56
+ "data-slot": "tabs-content",
57
+ className: i("flex-1 outline-none", t),
58
+ ...e
59
+ }
60
+ );
61
+ }
62
+ export {
63
+ o as Tabs,
64
+ l as TabsContent,
65
+ d as TabsList,
66
+ c as TabsTrigger
67
+ };
@@ -0,0 +1,18 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { cn as t } from "../../lib/utils.js";
3
+ function n({ className: r, ...e }) {
4
+ return /* @__PURE__ */ i(
5
+ "textarea",
6
+ {
7
+ "data-slot": "textarea",
8
+ className: t(
9
+ "border-input placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 flex field-sizing-content min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-base shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
10
+ r
11
+ ),
12
+ ...e
13
+ }
14
+ );
15
+ }
16
+ export {
17
+ n as Textarea
18
+ };
@@ -0,0 +1,8 @@
1
+ import { clsx as o } from "clsx";
2
+ import { twMerge as t } from "tailwind-merge";
3
+ function n(...r) {
4
+ return t(o(r));
5
+ }
6
+ export {
7
+ n as cn
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easyops-cn/a2ui-react",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A2UI React Renderer",
5
5
  "homepage": "https://easyops-cn.github.io/a2ui-react/",
6
6
  "repository": {
@@ -1,6 +0,0 @@
1
- /**
2
- * A2UIRenderer Tests
3
- *
4
- * Tests for the main A2UIRenderer component.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * ComponentRenderer Tests
3
- *
4
- * Tests for the ComponentRenderer component that routes rendering based on type.
5
- */
6
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Display Components Tests
3
- *
4
- * Tests for TextComponent, ImageComponent, IconComponent, VideoComponent,
5
- * AudioPlayerComponent, and DividerComponent.
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Interactive Components Tests
3
- *
4
- * Tests for ButtonComponent, CheckBoxComponent, TextFieldComponent,
5
- * DateTimeInputComponent, MultipleChoiceComponent, and SliderComponent.
6
- */
7
- export {};
@@ -1,7 +0,0 @@
1
- /**
2
- * Layout Components Tests
3
- *
4
- * Tests for RowComponent, ColumnComponent, ListComponent, CardComponent,
5
- * TabsComponent, and ModalComponent.
6
- */
7
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * A2UIProvider Tests
3
- *
4
- * Tests for the combined A2UI provider component.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * ActionContext Tests
3
- *
4
- * Tests for the Action context provider and hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * DataModelContext Tests
3
- *
4
- * Tests for the DataModel context provider and hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * SurfaceContext Tests
3
- *
4
- * Tests for the Surface context provider and hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * useA2UIMessageHandler Tests
3
- *
4
- * Tests for the useA2UIMessageHandler hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * useComponent Tests
3
- *
4
- * Tests for the useComponent hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * useDataBinding Tests
3
- *
4
- * Tests for the useDataBinding, useDataModel, and useFormBinding hooks.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * useDispatchAction Tests
3
- *
4
- * Tests for the useDispatchAction hooks.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * useSurface Tests
3
- *
4
- * Tests for the useSurface hook.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * dataBinding Tests
3
- *
4
- * Tests for data binding utility functions used in A2UI.
5
- */
6
- export {};
@@ -1,6 +0,0 @@
1
- /**
2
- * pathUtils Tests
3
- *
4
- * Tests for path utility functions used in A2UI data model operations.
5
- */
6
- export {};