@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.
- package/README.md +15 -7
- package/dist/0.8/A2UIRenderer.d.ts +43 -35
- package/dist/0.8/A2UIRenderer.js +12 -34
- package/dist/0.8/components/display/AudioPlayerComponent.js +2 -2
- package/dist/0.8/components/display/DividerComponent.js +1 -1
- package/dist/0.8/components/display/IconComponent.js +2 -2
- package/dist/0.8/components/display/ImageComponent.js +2 -2
- package/dist/0.8/components/display/TextComponent.js +2 -2
- package/dist/0.8/components/display/VideoComponent.js +2 -2
- package/dist/0.8/components/interactive/ButtonComponent.js +2 -2
- package/dist/0.8/components/interactive/CheckBoxComponent.js +4 -4
- package/dist/0.8/components/interactive/DateTimeInputComponent.js +6 -6
- package/dist/0.8/components/interactive/MultipleChoiceComponent.js +5 -5
- package/dist/0.8/components/interactive/SliderComponent.js +3 -3
- package/dist/0.8/components/interactive/TextFieldComponent.js +5 -5
- package/dist/0.8/components/layout/CardComponent.js +1 -1
- package/dist/0.8/components/layout/ColumnComponent.js +3 -3
- package/dist/0.8/components/layout/ListComponent.js +3 -3
- package/dist/0.8/components/layout/ModalComponent.js +1 -1
- package/dist/0.8/components/layout/RowComponent.js +3 -3
- package/dist/0.8/components/layout/TabsComponent.js +2 -2
- package/dist/0.8/contexts/A2UIProvider.d.ts +40 -13
- package/dist/0.8/contexts/A2UIProvider.js +32 -7
- package/dist/0.8/hooks/useDataBinding.js +17 -12
- package/dist/0.8/index.d.ts +20 -2
- package/dist/0.8/index.js +13 -9
- package/dist/components/ui/button.js +53 -0
- package/dist/components/ui/calendar.js +173 -0
- package/dist/components/ui/card.js +29 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/components/ui/dialog.js +77 -0
- package/dist/components/ui/input.js +21 -0
- package/dist/components/ui/label.js +22 -0
- package/dist/components/ui/popover.js +38 -0
- package/dist/components/ui/select.js +144 -0
- package/dist/components/ui/separator.js +26 -0
- package/dist/components/ui/slider.js +63 -0
- package/dist/components/ui/tabs.js +67 -0
- package/dist/components/ui/textarea.js +18 -0
- package/dist/lib/utils.js +8 -0
- package/package.json +1 -1
- package/dist/0.8/A2UIRenderer.test.d.ts +0 -6
- package/dist/0.8/components/ComponentRenderer.test.d.ts +0 -6
- package/dist/0.8/components/display/display.test.d.ts +0 -7
- package/dist/0.8/components/interactive/interactive.test.d.ts +0 -7
- package/dist/0.8/components/layout/layout.test.d.ts +0 -7
- package/dist/0.8/contexts/A2UIProvider.test.d.ts +0 -6
- package/dist/0.8/contexts/ActionContext.test.d.ts +0 -6
- package/dist/0.8/contexts/DataModelContext.test.d.ts +0 -6
- package/dist/0.8/contexts/SurfaceContext.test.d.ts +0 -6
- package/dist/0.8/hooks/useA2UIMessageHandler.test.d.ts +0 -6
- package/dist/0.8/hooks/useComponent.test.d.ts +0 -6
- package/dist/0.8/hooks/useDataBinding.test.d.ts +0 -6
- package/dist/0.8/hooks/useDispatchAction.test.d.ts +0 -6
- package/dist/0.8/hooks/useSurface.test.d.ts +0 -6
- package/dist/0.8/utils/dataBinding.test.d.ts +0 -6
- 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
|
+
};
|
package/package.json
CHANGED