@checkstack/ui 0.0.3 → 0.1.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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @checkstack/ui
|
|
2
2
|
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 8e43507: # Button component defaults to type="button"
|
|
8
|
+
|
|
9
|
+
The `Button` component now defaults to `type="button"` instead of the HTML default `type="submit"`. This prevents accidental form submissions when buttons are placed inside forms but aren't intended to submit.
|
|
10
|
+
|
|
11
|
+
## Changes
|
|
12
|
+
|
|
13
|
+
- Default `type` prop is now `"button"` instead of the HTML implicit `"submit"`
|
|
14
|
+
- Form submission buttons must now explicitly set `type="submit"`
|
|
15
|
+
|
|
16
|
+
## Migration
|
|
17
|
+
|
|
18
|
+
No migration needed if your submit buttons already have `type="submit"` explicitly set (recommended practice). If you have buttons that should submit forms but don't have an explicit type, add `type="submit"`:
|
|
19
|
+
|
|
20
|
+
```diff
|
|
21
|
+
- <Button onClick={handleSubmit}>Submit</Button>
|
|
22
|
+
+ <Button type="submit">Submit</Button>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- 97c5a6b: Fixed DOM clobbering issue in DynamicForm by prefixing field IDs with 'field-'. Previously, schema fields with names matching native DOM properties (like 'nodeName', 'tagName', 'innerHTML') could shadow those properties, causing floating-ui and React to crash during DOM traversal.
|
|
28
|
+
- Updated dependencies [8e43507]
|
|
29
|
+
- @checkstack/common@0.1.0
|
|
30
|
+
- @checkstack/frontend-api@0.0.4
|
|
31
|
+
|
|
32
|
+
## 0.0.4
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- f5b1f49: Extended DynamicForm type definitions with additional JSON Schema metadata properties.
|
|
37
|
+
- Updated dependencies [f5b1f49]
|
|
38
|
+
- @checkstack/common@0.0.3
|
|
39
|
+
- @checkstack/frontend-api@0.0.3
|
|
40
|
+
|
|
3
41
|
## 0.0.3
|
|
4
42
|
|
|
5
43
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -39,12 +39,16 @@ export interface ButtonProps
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
42
|
-
(
|
|
42
|
+
(
|
|
43
|
+
{ className, variant, size, asChild = false, type = "button", ...props },
|
|
44
|
+
ref
|
|
45
|
+
) => {
|
|
43
46
|
const Comp = asChild ? Slot : "button";
|
|
44
47
|
return (
|
|
45
48
|
<Comp
|
|
46
49
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
47
50
|
ref={ref}
|
|
51
|
+
type={asChild ? undefined : type}
|
|
48
52
|
{...props}
|
|
49
53
|
/>
|
|
50
54
|
);
|
|
@@ -109,7 +109,9 @@ export const DynamicForm: React.FC<DynamicFormProps> = ({
|
|
|
109
109
|
return (
|
|
110
110
|
<FormField
|
|
111
111
|
key={key}
|
|
112
|
-
|
|
112
|
+
// Prefix with 'field-' to prevent DOM clobbering when field names
|
|
113
|
+
// match native DOM properties (e.g., nodeName, tagName, innerHTML)
|
|
114
|
+
id={`field-${key}`}
|
|
113
115
|
label={label}
|
|
114
116
|
propSchema={propSchema}
|
|
115
117
|
value={value[key]}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
import type { TemplateProperty } from "../TemplateEditor";
|
|
2
|
+
import type {
|
|
3
|
+
JsonSchemaPropertyCore,
|
|
4
|
+
JsonSchemaBase,
|
|
5
|
+
} from "@checkstack/common";
|
|
2
6
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
oneOf?: JsonSchemaProperty[]; // Discriminated union variants
|
|
15
|
-
anyOf?: JsonSchemaProperty[]; // Union variants
|
|
16
|
-
"x-secret"?: boolean; // Custom metadata for secret fields
|
|
17
|
-
"x-color"?: boolean; // Custom metadata for color fields
|
|
18
|
-
"x-options-resolver"?: string; // Name of a resolver function for dynamic options
|
|
19
|
-
"x-depends-on"?: string[]; // Field names this field depends on (triggers refetch when they change)
|
|
7
|
+
/**
|
|
8
|
+
* JSON Schema property with DynamicForm-specific x-* extensions for config rendering.
|
|
9
|
+
* Uses the generic core type for proper recursive typing.
|
|
10
|
+
*/
|
|
11
|
+
export interface JsonSchemaProperty
|
|
12
|
+
extends JsonSchemaPropertyCore<JsonSchemaProperty> {
|
|
13
|
+
// Config-specific x-* extensions
|
|
14
|
+
"x-secret"?: boolean; // Field contains sensitive data
|
|
15
|
+
"x-color"?: boolean; // Field is a color picker
|
|
16
|
+
"x-options-resolver"?: string; // Name of resolver function for dynamic options
|
|
17
|
+
"x-depends-on"?: string[]; // Field names this field depends on (triggers refetch)
|
|
20
18
|
"x-hidden"?: boolean; // Field should be hidden in form (auto-populated)
|
|
21
|
-
"x-searchable"?: boolean; // Shows
|
|
19
|
+
"x-searchable"?: boolean; // Shows search input for filtering dropdown options
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
/** Option returned by an options resolver */
|
|
@@ -32,10 +30,10 @@ export type OptionsResolver = (
|
|
|
32
30
|
formValues: Record<string, unknown>
|
|
33
31
|
) => Promise<ResolverOption[]>;
|
|
34
32
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
/**
|
|
34
|
+
* JSON Schema for config forms with DynamicForm-specific extensions.
|
|
35
|
+
*/
|
|
36
|
+
export type JsonSchema = JsonSchemaBase<JsonSchemaProperty>;
|
|
39
37
|
|
|
40
38
|
export interface DynamicFormProps {
|
|
41
39
|
schema: JsonSchema;
|