@checkstack/ui 1.10.0 → 1.11.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +384 -0
  2. package/package.json +15 -7
  3. package/scripts/generate-stdlib-types.ts +2 -2
  4. package/src/components/ActionCard.tsx +221 -0
  5. package/src/components/CodeEditor/CodeEditor.tsx +51 -9
  6. package/src/components/CodeEditor/TypefoxEditor.tsx +868 -0
  7. package/src/components/CodeEditor/bracketKeyGroups.test.ts +120 -0
  8. package/src/components/CodeEditor/bracketKeyGroups.ts +205 -0
  9. package/src/components/CodeEditor/generateTypeDefinitions.ts +4 -4
  10. package/src/components/CodeEditor/index.ts +2 -0
  11. package/src/components/CodeEditor/scriptContext.test.ts +41 -0
  12. package/src/components/CodeEditor/scriptContext.ts +76 -1
  13. package/src/components/CodeEditor/templateValidation.ts +51 -0
  14. package/src/components/CodeEditor/types.ts +109 -0
  15. package/src/components/CodeEditor/validateJsonTemplate.test.ts +61 -0
  16. package/src/components/CodeEditor/validateJsonTemplate.ts +26 -0
  17. package/src/components/CodeEditor/validateXmlTemplate.test.ts +34 -0
  18. package/src/components/CodeEditor/validateXmlTemplate.ts +35 -0
  19. package/src/components/CodeEditor/validateYamlTemplate.test.ts +39 -0
  20. package/src/components/CodeEditor/validateYamlTemplate.ts +28 -0
  21. package/src/components/DynamicForm/DynamicForm.tsx +2 -0
  22. package/src/components/DynamicForm/FormField.tsx +29 -9
  23. package/src/components/DynamicForm/KeyValueEditor.tsx +2 -169
  24. package/src/components/DynamicForm/MultiTypeEditorField.tsx +16 -7
  25. package/src/components/DynamicForm/types.ts +11 -0
  26. package/src/components/TemplateInput.tsx +104 -0
  27. package/src/components/TemplateInputToggle.tsx +111 -0
  28. package/src/components/TemplateValueInput.test.ts +98 -0
  29. package/src/components/TemplateValueInput.tsx +470 -0
  30. package/src/components/VariablePicker.tsx +271 -0
  31. package/src/hooks/useInitOnceForKey.test.ts +27 -0
  32. package/src/hooks/useInitOnceForKey.ts +21 -18
  33. package/src/index.ts +5 -0
  34. package/stories/ActionCard.stories.tsx +62 -0
  35. package/stories/Alert.stories.tsx +5 -5
  36. package/stories/TemplateInputToggle.stories.tsx +77 -0
  37. package/stories/TemplateValueInput.stories.tsx +65 -0
  38. package/stories/VariablePicker.stories.tsx +109 -0
  39. package/src/components/CodeEditor/MonacoEditor.tsx +0 -616
  40. package/src/components/CodeEditor/monacoStdlib.ts +0 -62
  41. package/src/components/CodeEditor/monacoWorkers.ts +0 -118
@@ -0,0 +1,109 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { useState } from "react";
3
+ import {
4
+ VariablePicker,
5
+ type VariableNode,
6
+ } from "../src/components/VariablePicker";
7
+
8
+ const meta: Meta<typeof VariablePicker> = {
9
+ title: "Components/Automation/VariablePicker",
10
+ component: VariablePicker,
11
+ tags: ["autodocs"],
12
+ parameters: {
13
+ docs: {
14
+ description: {
15
+ component:
16
+ "Hierarchical picker — click the trigger button to open a tree of in-scope automation variables.",
17
+ },
18
+ },
19
+ },
20
+ };
21
+
22
+ export default meta;
23
+ type Story = StoryObj<typeof VariablePicker>;
24
+
25
+ const sampleScope: VariableNode[] = [
26
+ {
27
+ path: "trigger",
28
+ type: "object",
29
+ description: "Trigger that fired this run.",
30
+ children: [
31
+ {
32
+ path: "trigger.event",
33
+ type: '"incident.created" | "incident.resolved"',
34
+ description: "Discriminator.",
35
+ },
36
+ {
37
+ path: "trigger.payload",
38
+ type: "object",
39
+ children: [
40
+ { path: "trigger.payload.incidentId", type: "string" },
41
+ {
42
+ path: "trigger.payload.title",
43
+ type: "string",
44
+ conditionalOnTriggers: ["incident.created"],
45
+ },
46
+ {
47
+ path: "trigger.payload.resolvedAt",
48
+ type: "string",
49
+ conditionalOnTriggers: ["incident.resolved"],
50
+ },
51
+ ],
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ path: "var",
57
+ templateRef: "variables",
58
+ type: "object",
59
+ description: "Operator-defined variables.",
60
+ children: [
61
+ { path: "var.outer", templateRef: "variables.outer", type: "string" },
62
+ ],
63
+ },
64
+ {
65
+ path: "artifact",
66
+ templateRef: "artifacts",
67
+ type: "object",
68
+ description: "Artifacts produced upstream.",
69
+ children: [
70
+ {
71
+ // Hyphenated/dotted artifact id → templateRef uses bracket notation
72
+ // so the inserted `{{ }}` text is runtime-parseable.
73
+ path: "artifact.integration-jira.issue",
74
+ templateRef: 'artifacts["integration-jira.issue"]',
75
+ type: "object",
76
+ children: [
77
+ {
78
+ path: "artifact.integration-jira.issue.key",
79
+ templateRef: 'artifacts["integration-jira.issue"].key',
80
+ type: "string",
81
+ },
82
+ {
83
+ path: "artifact.integration-jira.issue.url",
84
+ templateRef: 'artifacts["integration-jira.issue"].url',
85
+ type: "string",
86
+ },
87
+ ],
88
+ },
89
+ ],
90
+ },
91
+ ];
92
+
93
+ const DefaultDemo = () => {
94
+ const [inserted, setInserted] = useState<string | null>(null);
95
+ return (
96
+ <div className="p-12 flex flex-col items-start gap-4">
97
+ <VariablePicker scope={sampleScope} onSelect={setInserted} />
98
+ {inserted && (
99
+ <p className="text-xs text-muted-foreground">
100
+ Inserted: <code className="font-mono">{`{{${inserted}}}`}</code>
101
+ </p>
102
+ )}
103
+ </div>
104
+ );
105
+ };
106
+
107
+ export const Default: Story = {
108
+ render: () => <DefaultDemo />,
109
+ };