hazo_ui 4.3.1 → 4.6.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.
@@ -1,14 +1,32 @@
1
1
  'use strict';
2
2
 
3
- var React = require('react');
3
+ var React4 = require('react');
4
4
  var clsx = require('clsx');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
+ var reactSlot = require('@radix-ui/react-slot');
8
+ var classVarianceAuthority = require('class-variance-authority');
7
9
  var client = require('hazo_core/client');
8
10
 
9
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
10
28
 
11
- var React__default = /*#__PURE__*/_interopDefault(React);
29
+ var React4__namespace = /*#__PURE__*/_interopNamespace(React4);
12
30
 
13
31
  var __defProp = Object.defineProperty;
14
32
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
@@ -55,9 +73,9 @@ function AppSidebar({
55
73
  pkg,
56
74
  navItems
57
75
  }) {
58
- const [collapsed, set_collapsed] = React.useState(false);
59
- const [current_path, set_current_path] = React.useState("/");
60
- React__default.default.useEffect(() => {
76
+ const [collapsed, set_collapsed] = React4.useState(false);
77
+ const [current_path, set_current_path] = React4.useState("/");
78
+ React4__namespace.default.useEffect(() => {
61
79
  function update_path() {
62
80
  set_current_path(window.location.pathname);
63
81
  }
@@ -141,7 +159,7 @@ function getRegistry() {
141
159
  function clearRegistry() {
142
160
  registry.clear();
143
161
  }
144
- var AutoTestContext = React.createContext(null);
162
+ var AutoTestContext = React4.createContext(null);
145
163
  function build_initial_state() {
146
164
  const registry2 = getRegistry();
147
165
  const map = /* @__PURE__ */ new Map();
@@ -163,12 +181,12 @@ function AutoTestProvider({
163
181
  pkg: _pkg,
164
182
  children
165
183
  }) {
166
- const [scenarios, set_scenarios] = React.useState(
184
+ const [scenarios, set_scenarios] = React4.useState(
167
185
  () => build_initial_state()
168
186
  );
169
- const scenarios_ref = React.useRef(scenarios);
187
+ const scenarios_ref = React4.useRef(scenarios);
170
188
  scenarios_ref.current = scenarios;
171
- const update_scenario = React.useCallback(
189
+ const update_scenario = React4.useCallback(
172
190
  (id, updater) => {
173
191
  set_scenarios((prev) => {
174
192
  const next = new Map(prev);
@@ -181,7 +199,7 @@ function AutoTestProvider({
181
199
  },
182
200
  []
183
201
  );
184
- const runScenario = React.useCallback(
202
+ const runScenario = React4.useCallback(
185
203
  async (id) => {
186
204
  const registry2 = getRegistry();
187
205
  const scenario = registry2.get(id);
@@ -236,13 +254,13 @@ function AutoTestProvider({
236
254
  },
237
255
  [update_scenario]
238
256
  );
239
- const runAll = React.useCallback(async () => {
257
+ const runAll = React4.useCallback(async () => {
240
258
  const ids = Array.from(getRegistry().keys());
241
259
  for (const id of ids) {
242
260
  await runScenario(id);
243
261
  }
244
262
  }, [runScenario]);
245
- const reset = React.useCallback(() => {
263
+ const reset = React4.useCallback(() => {
246
264
  set_scenarios(build_initial_state());
247
265
  }, []);
248
266
  const value = {
@@ -254,12 +272,76 @@ function AutoTestProvider({
254
272
  return /* @__PURE__ */ jsxRuntime.jsx(AutoTestContext.Provider, { value, children });
255
273
  }
256
274
  function useAutoTest() {
257
- const ctx = React.useContext(AutoTestContext);
275
+ const ctx = React4.useContext(AutoTestContext);
258
276
  if (!ctx) {
259
277
  throw new Error("useAutoTest must be used within an <AutoTestProvider>");
260
278
  }
261
279
  return ctx;
262
280
  }
281
+ var buttonVariants = classVarianceAuthority.cva(
282
+ "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",
283
+ {
284
+ variants: {
285
+ variant: {
286
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
287
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
288
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
289
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
290
+ ghost: "hover:bg-accent hover:text-accent-foreground",
291
+ link: "text-primary underline-offset-4 hover:underline"
292
+ },
293
+ size: {
294
+ default: "h-10 px-4 py-2",
295
+ sm: "h-9 rounded-md px-3",
296
+ lg: "h-11 rounded-md px-8",
297
+ icon: "h-10 w-10"
298
+ }
299
+ },
300
+ defaultVariants: {
301
+ variant: "default",
302
+ size: "default"
303
+ }
304
+ }
305
+ );
306
+ var Button = React4__namespace.forwardRef(
307
+ ({ className, variant, size, asChild = false, style, ...props }, ref) => {
308
+ const Comp = asChild ? reactSlot.Slot : "button";
309
+ return /* @__PURE__ */ jsxRuntime.jsx(
310
+ Comp,
311
+ {
312
+ className: cn(buttonVariants({ variant, size, className })),
313
+ style,
314
+ ref,
315
+ ...props
316
+ }
317
+ );
318
+ }
319
+ );
320
+ Button.displayName = "Button";
321
+ var Card = React4__namespace.forwardRef(
322
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("rounded-lg border bg-card text-card-foreground shadow-sm", className), ...props })
323
+ );
324
+ Card.displayName = "Card";
325
+ var CardHeader = React4__namespace.forwardRef(
326
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })
327
+ );
328
+ CardHeader.displayName = "CardHeader";
329
+ var CardTitle = React4__namespace.forwardRef(
330
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("h3", { ref, className: cn("text-2xl font-semibold leading-none tracking-tight", className), ...props })
331
+ );
332
+ CardTitle.displayName = "CardTitle";
333
+ var CardDescription = React4__namespace.forwardRef(
334
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("p", { ref, className: cn("text-sm text-muted-foreground", className), ...props })
335
+ );
336
+ CardDescription.displayName = "CardDescription";
337
+ var CardContent = React4__namespace.forwardRef(
338
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("p-6 pt-0", className), ...props })
339
+ );
340
+ CardContent.displayName = "CardContent";
341
+ var CardFooter = React4__namespace.forwardRef(
342
+ ({ className, ...props }, ref) => /* @__PURE__ */ jsxRuntime.jsx("div", { ref, className: cn("flex items-center p-6 pt-0", className), ...props })
343
+ );
344
+ CardFooter.displayName = "CardFooter";
263
345
 
264
346
  // src/test-harness/scenarios/assertions.ts
265
347
  function capture_call_site(stack) {
@@ -761,7 +843,7 @@ async function build_copy_all_text(failed_cases) {
761
843
  function CopyAllFailuresButton({
762
844
  failedCases
763
845
  }) {
764
- const [state, set_state] = React.useState("idle");
846
+ const [state, set_state] = React4.useState("idle");
765
847
  async function handle_click() {
766
848
  set_state("copying");
767
849
  try {
@@ -832,7 +914,7 @@ function CopySinglePromptButton({
832
914
  case_result,
833
915
  pkg
834
916
  }) {
835
- const [copied, set_copied] = React.useState(false);
917
+ const [copied, set_copied] = React4.useState(false);
836
918
  async function handle_copy() {
837
919
  const scenario = getRegistry().get(scenario_id);
838
920
  if (!case_result.error) return;
@@ -866,7 +948,7 @@ function CaseRow({
866
948
  scenario_id,
867
949
  pkg
868
950
  }) {
869
- const [expanded, set_expanded] = React.useState(false);
951
+ const [expanded, set_expanded] = React4.useState(false);
870
952
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-6 py-2", children: [
871
953
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 text-sm", children: [
872
954
  c.doc && /* @__PURE__ */ jsxRuntime.jsx(
@@ -923,10 +1005,10 @@ function ScenarioRow({
923
1005
  pkg
924
1006
  }) {
925
1007
  const { runScenario } = useAutoTest();
926
- const [expanded, set_expanded] = React.useState(false);
1008
+ const [expanded, set_expanded] = React4.useState(false);
927
1009
  const is_running = scenario.status === "running";
928
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border border-gray-200 rounded-lg overflow-hidden", children: [
929
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 py-3 bg-gray-50", children: [
1010
+ return /* @__PURE__ */ jsxRuntime.jsxs(Card, { className: "overflow-hidden", children: [
1011
+ /* @__PURE__ */ jsxRuntime.jsxs(CardHeader, { className: "flex flex-row items-center justify-between px-4 py-3 bg-gray-50 space-y-0", children: [
930
1012
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
931
1013
  /* @__PURE__ */ jsxRuntime.jsx(
932
1014
  "button",
@@ -947,19 +1029,17 @@ function ScenarioRow({
947
1029
  ] })
948
1030
  ] }),
949
1031
  /* @__PURE__ */ jsxRuntime.jsx(
950
- "button",
1032
+ Button,
951
1033
  {
1034
+ variant: "secondary",
1035
+ size: "sm",
952
1036
  disabled: is_running,
953
1037
  onClick: () => runScenario(scenario.id),
954
- className: cn(
955
- "px-3 py-1 rounded text-xs font-medium transition-colors",
956
- is_running ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-blue-600 text-white hover:bg-blue-700 cursor-pointer"
957
- ),
958
1038
  children: is_running ? "Running..." : "Run"
959
1039
  }
960
1040
  )
961
1041
  ] }),
962
- expanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-gray-100", children: scenario.cases.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(CaseRow, { c, scenario_id: scenario.id, pkg }, i)) })
1042
+ expanded && /* @__PURE__ */ jsxRuntime.jsx(CardContent, { className: "p-0", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "divide-y divide-gray-100", children: scenario.cases.map((c, i) => /* @__PURE__ */ jsxRuntime.jsx(CaseRow, { c, scenario_id: scenario.id, pkg }, i)) }) })
963
1043
  ] });
964
1044
  }
965
1045
  function AutoTestRunner() {
@@ -995,23 +1075,16 @@ function AutoTestRunner() {
995
1075
  ] }),
996
1076
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
997
1077
  failed_cases_flat.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(CopyAllFailuresButton, { failedCases: failed_cases_flat }),
1078
+ /* @__PURE__ */ jsxRuntime.jsx(Button, { variant: "outline", size: "sm", onClick: reset, disabled: any_running, children: "Reset" }),
998
1079
  /* @__PURE__ */ jsxRuntime.jsx(
999
- "button",
1000
- {
1001
- onClick: reset,
1002
- disabled: any_running,
1003
- 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",
1004
- children: "Reset"
1005
- }
1006
- ),
1007
- /* @__PURE__ */ jsxRuntime.jsx(
1008
- "button",
1080
+ Button,
1009
1081
  {
1010
1082
  onClick: runAll,
1011
1083
  disabled: any_running,
1084
+ size: "sm",
1012
1085
  className: cn(
1013
- "px-4 py-1.5 rounded text-xs font-medium transition-colors",
1014
- any_running ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-green-600 text-white hover:bg-green-700 cursor-pointer"
1086
+ "bg-green-600 text-white hover:bg-green-700",
1087
+ any_running && "bg-gray-100 text-gray-400 hover:bg-gray-100 cursor-not-allowed"
1015
1088
  ),
1016
1089
  children: any_running ? "Running..." : "Run All"
1017
1090
  }