Skip to content

Commit 65f8ef6

Browse files
committed
feat: Adds new elements from 2.0.0 API
1 parent 44dceff commit 65f8ef6

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

src/form/Input.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FormAction, TextContent } from '../Primitives';
2+
import { UIElement } from './UIElement';
23

34
export interface InputForm {
45
type: 'input';
@@ -10,7 +11,12 @@ export interface InputForm {
1011

1112
export type InputValue = string | number | boolean;
1213

13-
export type InputElement = InputElementSlider | InputElementDropdown | InputElementText | InputElementToggle;
14+
export type InputElement =
15+
| InputElementSlider
16+
| InputElementDropdown
17+
| InputElementText
18+
| InputElementToggle
19+
| UIElement;
1420

1521
export type InputElementSlider = {
1622
type: 'slider';
@@ -20,6 +26,7 @@ export type InputElementSlider = {
2026
max: number;
2127
step: number;
2228
defaultValue?: number;
29+
tooltip?: TextContent;
2330
};
2431

2532
export type InputElementDropdown = {
@@ -31,6 +38,7 @@ export type InputElementDropdown = {
3138
text: TextContent;
3239
value: InputValue;
3340
}>;
41+
tooltip?: TextContent;
3442
};
3543

3644
export type InputElementText = {
@@ -39,11 +47,13 @@ export type InputElementText = {
3947
text: TextContent;
4048
placeholder: TextContent;
4149
defaultValue?: string;
50+
tooltip?: TextContent;
4251
};
4352

4453
export type InputElementToggle = {
4554
type: 'toggle';
4655
name?: string;
4756
text: TextContent;
4857
defaultValue?: boolean;
58+
tooltip?: TextContent;
4959
};

src/form/MultiButton.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { FormAction, TextContent } from '../Primitives';
2+
import { UIElement } from './UIElement';
23

34
export interface MultiButtonForm {
45
type: 'multi-button';
@@ -7,7 +8,7 @@ export interface MultiButtonForm {
78
elements: Array<MultiButtonElement>;
89
}
910

10-
export type MultiButtonElement = MultiButtonElementButton;
11+
export type MultiButtonElement = MultiButtonElementButton | UIElement;
1112

1213
export interface MultiButtonElementButton {
1314
type: 'button';

src/form/UIElement.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { TextContent } from '../Primitives';
2+
3+
export interface Divider {
4+
type: 'divider';
5+
}
6+
7+
export interface Label {
8+
type: 'label';
9+
text: TextContent;
10+
}
11+
12+
export interface Header {
13+
type: 'header';
14+
text: TextContent;
15+
}
16+
17+
export type UIElement = Divider | Label | Header;

0 commit comments

Comments
 (0)