@dtkt/protoform 0.0.0-stage → 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/LICENSE +202 -0
- package/README.md +221 -2
- package/dist/base.d.ts +19 -0
- package/dist/comments.d.ts +9 -0
- package/dist/components/enum.d.ts +24 -0
- package/dist/components/field.d.ts +16 -0
- package/dist/components/frame.d.ts +6 -0
- package/dist/components/group.d.ts +25 -0
- package/dist/components/hooks.d.ts +18 -0
- package/dist/components/index.d.ts +13 -0
- package/dist/components/index.js +14 -0
- package/dist/components/list.d.ts +7 -0
- package/dist/components/map.d.ts +7 -0
- package/dist/components/message.d.ts +17 -0
- package/dist/components/oneof.d.ts +8 -0
- package/dist/components/protoform.d.ts +20 -0
- package/dist/components/scalar.d.ts +34 -0
- package/dist/components/select.d.ts +1 -0
- package/dist/components/submit.d.ts +8 -0
- package/dist/components/wkt.d.ts +20 -0
- package/dist/context-DSrebuNf.js +1024 -0
- package/dist/element.d.ts +23 -0
- package/dist/enum.d.ts +17 -0
- package/dist/env.d.ts +28 -0
- package/dist/favicon.ico +0 -0
- package/dist/field.d.ts +17 -0
- package/dist/gen/dtkt/protoform/v1beta1/protoform_pb.d.ts +463 -0
- package/dist/gen/dtkt/protoform/v1beta1/protoform_pb.js +6 -0
- package/dist/gen/google/api/field_behavior_pb.d.ts +133 -0
- package/dist/gen/google/api/field_behavior_pb.js +5 -0
- package/dist/icons.svg +24 -0
- package/dist/kit/bare.d.ts +3 -0
- package/dist/kit/context.d.ts +56 -0
- package/dist/kit/index.d.ts +4 -0
- package/dist/kit/index.js +1 -0
- package/dist/kit/tailwind/index.d.ts +7 -0
- package/dist/kit/tailwind/index.js +327 -0
- package/dist/kit/types.d.ts +126 -0
- package/dist/list.d.ts +29 -0
- package/dist/main.d.ts +13 -0
- package/dist/main.js +3 -0
- package/dist/map.d.ts +36 -0
- package/dist/message.d.ts +61 -0
- package/dist/oneof.d.ts +27 -0
- package/dist/path.d.ts +8 -0
- package/dist/protoform-DmMJ7LSw.js +835 -0
- package/dist/providers/env.d.ts +4 -0
- package/dist/providers/index.d.ts +2 -0
- package/dist/providers/index.js +11 -0
- package/dist/providers/ui.d.ts +13 -0
- package/dist/scalar.d.ts +30 -0
- package/dist/store.d.ts +29 -0
- package/dist/styles.css +2 -0
- package/dist/ui-DGND0oTu.js +32 -0
- package/dist/wellknown.d.ts +10 -0
- package/package.json +141 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ScalarType } from '@bufbuild/protobuf';
|
|
2
|
+
import { ScalarValue } from '@bufbuild/protobuf/reflect';
|
|
3
|
+
import { ScalarField } from '../scalar';
|
|
4
|
+
import { FormStore } from '../store';
|
|
5
|
+
import { FieldElementProps } from './field';
|
|
6
|
+
export type ScalarInputProps = {
|
|
7
|
+
scalar: ScalarType;
|
|
8
|
+
value: ScalarValue;
|
|
9
|
+
/** Called with each valid value; may return an error message to display. */
|
|
10
|
+
onValue: (value: ScalarValue) => string | void;
|
|
11
|
+
/** Where unparsable input is recorded so it blocks submission. */
|
|
12
|
+
store: FormStore;
|
|
13
|
+
errorPath: string;
|
|
14
|
+
id?: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
describedBy?: string;
|
|
17
|
+
invalid?: boolean;
|
|
18
|
+
readOnly?: boolean;
|
|
19
|
+
required?: boolean;
|
|
20
|
+
multiline?: boolean;
|
|
21
|
+
placeholder?: string;
|
|
22
|
+
/** Called when Enter is pressed in a single-line input (suppresses the form's implicit submit). */
|
|
23
|
+
onEnter?: () => void;
|
|
24
|
+
"aria-label"?: string;
|
|
25
|
+
};
|
|
26
|
+
/** An editor for a single scalar value; usable standalone (e.g. list items). */
|
|
27
|
+
export declare function ScalarInput({ scalar, value, onValue, store, errorPath, multiline, ...control }: ScalarInputProps): import('react').JSX.Element;
|
|
28
|
+
type ScalarElementProps = FieldElementProps & {
|
|
29
|
+
field: ScalarField;
|
|
30
|
+
/** Render strings and bytes in a multi-line text area. */
|
|
31
|
+
multiline?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function ScalarElement({ field, mode, id, describedBy, invalid, multiline }: ScalarElementProps): import('react').JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { ButtonProps } from '../kit/types';
|
|
3
|
+
export type SubmitButtonProps = PropsWithChildren<Pick<ButtonProps, "variant" | "size" | "disabled" | "aria-label">>;
|
|
4
|
+
/**
|
|
5
|
+
* A submit button drawn by the active kit. Put it in `<Protoform>`'s children
|
|
6
|
+
* (or anywhere under a `UIProvider`) so it matches the rest of the form.
|
|
7
|
+
*/
|
|
8
|
+
export declare function SubmitButton({ variant, children, ...props }: SubmitButtonProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Message } from '../message';
|
|
2
|
+
import { FieldDisplayMode } from './field';
|
|
3
|
+
export type WellKnownEditorProps = {
|
|
4
|
+
message: Message;
|
|
5
|
+
mode?: FieldDisplayMode;
|
|
6
|
+
id?: string;
|
|
7
|
+
describedBy?: string;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
/** Names the control when there's no surrounding label (e.g. rows in a list). */
|
|
10
|
+
"aria-label"?: string;
|
|
11
|
+
};
|
|
12
|
+
/** Editors for the well-known types where a nested form would be awkward. */
|
|
13
|
+
export declare function WellKnownEditor(props: WellKnownEditorProps): import('react').JSX.Element;
|
|
14
|
+
export type AnyEditorProps = {
|
|
15
|
+
message: Message;
|
|
16
|
+
mode?: FieldDisplayMode;
|
|
17
|
+
depth?: number;
|
|
18
|
+
};
|
|
19
|
+
/** `google.protobuf.Any`: pick a message type from the registry, then edit it. */
|
|
20
|
+
export declare function AnyEditor({ message, mode, depth }: AnyEditorProps): import('react').JSX.Element;
|