hazo_ui 4.3.0 → 4.6.0
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/CHANGE_LOG.md +38 -0
- package/README.md +89 -0
- package/dist/index.cjs +426 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -2
- package/dist/index.d.ts +69 -2
- package/dist/index.js +427 -182
- package/dist/index.js.map +1 -1
- package/dist/test-harness/index.cjs +111 -38
- package/dist/test-harness/index.cjs.map +1 -1
- package/dist/test-harness/index.js +81 -23
- package/dist/test-harness/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React4 from 'react';
|
|
2
|
+
import React4__default, { createContext, useState, useRef, useCallback, useContext } from 'react';
|
|
2
3
|
import { clsx } from 'clsx';
|
|
3
4
|
import { twMerge } from 'tailwind-merge';
|
|
4
|
-
import {
|
|
5
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
7
|
+
import { cva } from 'class-variance-authority';
|
|
5
8
|
import { optional_import } from 'hazo_core/client';
|
|
6
9
|
|
|
7
10
|
var __defProp = Object.defineProperty;
|
|
@@ -51,7 +54,7 @@ function AppSidebar({
|
|
|
51
54
|
}) {
|
|
52
55
|
const [collapsed, set_collapsed] = useState(false);
|
|
53
56
|
const [current_path, set_current_path] = useState("/");
|
|
54
|
-
|
|
57
|
+
React4__default.useEffect(() => {
|
|
55
58
|
function update_path() {
|
|
56
59
|
set_current_path(window.location.pathname);
|
|
57
60
|
}
|
|
@@ -254,6 +257,70 @@ function useAutoTest() {
|
|
|
254
257
|
}
|
|
255
258
|
return ctx;
|
|
256
259
|
}
|
|
260
|
+
var buttonVariants = cva(
|
|
261
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
262
|
+
{
|
|
263
|
+
variants: {
|
|
264
|
+
variant: {
|
|
265
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
266
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
267
|
+
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
268
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
269
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
270
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
271
|
+
},
|
|
272
|
+
size: {
|
|
273
|
+
default: "h-10 px-4 py-2",
|
|
274
|
+
sm: "h-9 rounded-md px-3",
|
|
275
|
+
lg: "h-11 rounded-md px-8",
|
|
276
|
+
icon: "h-10 w-10"
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
defaultVariants: {
|
|
280
|
+
variant: "default",
|
|
281
|
+
size: "default"
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
var Button = React4.forwardRef(
|
|
286
|
+
({ className, variant, size, asChild = false, style, ...props }, ref) => {
|
|
287
|
+
const Comp = asChild ? Slot : "button";
|
|
288
|
+
return /* @__PURE__ */ jsx(
|
|
289
|
+
Comp,
|
|
290
|
+
{
|
|
291
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
292
|
+
style,
|
|
293
|
+
ref,
|
|
294
|
+
...props
|
|
295
|
+
}
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
Button.displayName = "Button";
|
|
300
|
+
var Card = React4.forwardRef(
|
|
301
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className), ...props })
|
|
302
|
+
);
|
|
303
|
+
Card.displayName = "Card";
|
|
304
|
+
var CardHeader = React4.forwardRef(
|
|
305
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
|
|
306
|
+
);
|
|
307
|
+
CardHeader.displayName = "CardHeader";
|
|
308
|
+
var CardTitle = React4.forwardRef(
|
|
309
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("h3", { ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })
|
|
310
|
+
);
|
|
311
|
+
CardTitle.displayName = "CardTitle";
|
|
312
|
+
var CardDescription = React4.forwardRef(
|
|
313
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
|
|
314
|
+
);
|
|
315
|
+
CardDescription.displayName = "CardDescription";
|
|
316
|
+
var CardContent = React4.forwardRef(
|
|
317
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
|
|
318
|
+
);
|
|
319
|
+
CardContent.displayName = "CardContent";
|
|
320
|
+
var CardFooter = React4.forwardRef(
|
|
321
|
+
({ className, ...props }, ref) => /* @__PURE__ */ jsx("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
|
|
322
|
+
);
|
|
323
|
+
CardFooter.displayName = "CardFooter";
|
|
257
324
|
|
|
258
325
|
// src/test-harness/scenarios/assertions.ts
|
|
259
326
|
function capture_call_site(stack) {
|
|
@@ -919,8 +986,8 @@ function ScenarioRow({
|
|
|
919
986
|
const { runScenario } = useAutoTest();
|
|
920
987
|
const [expanded, set_expanded] = useState(false);
|
|
921
988
|
const is_running = scenario.status === "running";
|
|
922
|
-
return /* @__PURE__ */ jsxs(
|
|
923
|
-
/* @__PURE__ */ jsxs(
|
|
989
|
+
return /* @__PURE__ */ jsxs(Card, { className: "overflow-hidden", children: [
|
|
990
|
+
/* @__PURE__ */ jsxs(CardHeader, { className: "flex flex-row items-center justify-between px-4 py-3 bg-gray-50 space-y-0", children: [
|
|
924
991
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
925
992
|
/* @__PURE__ */ jsx(
|
|
926
993
|
"button",
|
|
@@ -941,19 +1008,17 @@ function ScenarioRow({
|
|
|
941
1008
|
] })
|
|
942
1009
|
] }),
|
|
943
1010
|
/* @__PURE__ */ jsx(
|
|
944
|
-
|
|
1011
|
+
Button,
|
|
945
1012
|
{
|
|
1013
|
+
variant: "secondary",
|
|
1014
|
+
size: "sm",
|
|
946
1015
|
disabled: is_running,
|
|
947
1016
|
onClick: () => runScenario(scenario.id),
|
|
948
|
-
className: cn(
|
|
949
|
-
"px-3 py-1 rounded text-xs font-medium transition-colors",
|
|
950
|
-
is_running ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-blue-600 text-white hover:bg-blue-700 cursor-pointer"
|
|
951
|
-
),
|
|
952
1017
|
children: is_running ? "Running..." : "Run"
|
|
953
1018
|
}
|
|
954
1019
|
)
|
|
955
1020
|
] }),
|
|
956
|
-
expanded && /* @__PURE__ */ jsx("div", { className: "divide-y divide-gray-100", children: scenario.cases.map((c, i) => /* @__PURE__ */ jsx(CaseRow, { c, scenario_id: scenario.id, pkg }, i)) })
|
|
1021
|
+
expanded && /* @__PURE__ */ jsx(CardContent, { className: "p-0", children: /* @__PURE__ */ jsx("div", { className: "divide-y divide-gray-100", children: scenario.cases.map((c, i) => /* @__PURE__ */ jsx(CaseRow, { c, scenario_id: scenario.id, pkg }, i)) }) })
|
|
957
1022
|
] });
|
|
958
1023
|
}
|
|
959
1024
|
function AutoTestRunner() {
|
|
@@ -989,23 +1054,16 @@ function AutoTestRunner() {
|
|
|
989
1054
|
] }),
|
|
990
1055
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
991
1056
|
failed_cases_flat.length > 0 && /* @__PURE__ */ jsx(CopyAllFailuresButton, { failedCases: failed_cases_flat }),
|
|
1057
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", size: "sm", onClick: reset, disabled: any_running, children: "Reset" }),
|
|
992
1058
|
/* @__PURE__ */ jsx(
|
|
993
|
-
|
|
994
|
-
{
|
|
995
|
-
onClick: reset,
|
|
996
|
-
disabled: any_running,
|
|
997
|
-
className: "px-3 py-1.5 rounded text-xs font-medium border border-gray-300 text-gray-600 hover:bg-gray-50 disabled:opacity-50",
|
|
998
|
-
children: "Reset"
|
|
999
|
-
}
|
|
1000
|
-
),
|
|
1001
|
-
/* @__PURE__ */ jsx(
|
|
1002
|
-
"button",
|
|
1059
|
+
Button,
|
|
1003
1060
|
{
|
|
1004
1061
|
onClick: runAll,
|
|
1005
1062
|
disabled: any_running,
|
|
1063
|
+
size: "sm",
|
|
1006
1064
|
className: cn(
|
|
1007
|
-
"
|
|
1008
|
-
any_running
|
|
1065
|
+
"bg-green-600 text-white hover:bg-green-700",
|
|
1066
|
+
any_running && "bg-gray-100 text-gray-400 hover:bg-gray-100 cursor-not-allowed"
|
|
1009
1067
|
),
|
|
1010
1068
|
children: any_running ? "Running..." : "Run All"
|
|
1011
1069
|
}
|