@vicinae/api 0.20.5 → 0.20.7

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.
@@ -4,7 +4,7 @@ import { type ImageLike } from "../image";
4
4
  * @category UI Components
5
5
  */
6
6
  export declare namespace Form {
7
- type Props = {
7
+ export type Props = {
8
8
  actions?: React.ReactNode;
9
9
  children?: React.ReactNode;
10
10
  enableDrafts?: boolean;
@@ -12,20 +12,94 @@ export declare namespace Form {
12
12
  navigationTitle?: string;
13
13
  searchBarAccessory?: React.ReactNode;
14
14
  };
15
- type TextField = FormItemRef;
16
- type PasswordField = FormItemRef;
17
- type TextArea = FormItemRef;
18
- type Checkbox = FormItemRef;
19
- type DatePicker = FormItemRef;
20
- type Dropdown = FormItemRef;
21
- type TagPicker = FormItemRef;
22
- type FilePicker = FormItemRef;
23
- type ItemReference = FormItemRef;
24
- type ItemProps<T extends Value> = FormItemProps<T>;
25
- type Value = string | number | boolean | string[] | number[] | Date | null;
26
- type Values = {
15
+ export type TextField = FormItemRef;
16
+ export type PasswordField = FormItemRef;
17
+ export type TextArea = FormItemRef;
18
+ export type Checkbox = FormItemRef;
19
+ export type DatePicker = FormItemRef;
20
+ export type Dropdown = FormItemRef;
21
+ export type TagPicker = FormItemRef;
22
+ export type FilePicker = FormItemRef;
23
+ export type ItemReference = FormItemRef;
24
+ type WithFormRef<T> = {
25
+ ref?: Ref<T>;
26
+ };
27
+ export type ItemProps<T extends Value> = FormItemProps<T>;
28
+ export namespace TextField {
29
+ type Props = FormItemProps<string> & WithFormRef<Form.TextField> & {
30
+ placeholder?: string;
31
+ };
32
+ }
33
+ export namespace PasswordField {
34
+ type Props = FormItemProps<string> & WithFormRef<Form.PasswordField> & {
35
+ placeholder?: string;
36
+ };
37
+ }
38
+ export namespace TextArea {
39
+ type Props = FormItemProps<string> & WithFormRef<Form.TextArea> & {
40
+ placeholder?: string;
41
+ };
42
+ }
43
+ export namespace Checkbox {
44
+ type Props = FormItemProps<boolean> & WithFormRef<Form.Checkbox> & {
45
+ label?: string;
46
+ };
47
+ }
48
+ export namespace DatePicker {
49
+ type Props = FormItemProps<Date | null> & WithFormRef<Form.DatePicker> & {
50
+ min?: Date;
51
+ max?: Date;
52
+ type?: DatePickerType;
53
+ };
54
+ }
55
+ export namespace Dropdown {
56
+ type Props = FormItemProps<string> & WithFormRef<Form.Dropdown> & {
57
+ tooltip?: string;
58
+ children?: ReactNode;
59
+ filtering?: boolean;
60
+ isLoading?: boolean;
61
+ placeholder?: string;
62
+ throttle?: boolean;
63
+ onSearchTextChange?: (text: string) => void;
64
+ };
65
+ }
66
+ export namespace TagPicker {
67
+ type Props = FormItemProps<string[]> & WithFormRef<Form.TagPicker> & {
68
+ children?: ReactNode;
69
+ };
70
+ namespace Item {
71
+ type Props = {
72
+ title: string;
73
+ value: string;
74
+ icon: ImageLike;
75
+ };
76
+ }
77
+ }
78
+ export namespace FilePicker {
79
+ type Props = FormItemProps<string[]> & WithFormRef<Form.FilePicker> & {
80
+ allowMultipleSelection?: boolean;
81
+ canChooseDirectories?: boolean;
82
+ canChooseFiles?: boolean;
83
+ showHiddenFiles?: boolean;
84
+ };
85
+ }
86
+ export namespace Description {
87
+ type Props = {
88
+ text: string;
89
+ title?: string;
90
+ };
91
+ }
92
+ export namespace LinkAccessory {
93
+ type Props = {
94
+ target: string;
95
+ text: string;
96
+ };
97
+ }
98
+ export type Value = string | number | boolean | string[] | number[] | Date | null;
99
+ export type Values = {
27
100
  [itemId: string]: Value;
28
101
  };
102
+ export {};
29
103
  }
30
104
  type FormItemRef = {
31
105
  focus: () => void;
@@ -52,65 +126,23 @@ interface FormEvent<T extends Form.Value> {
52
126
  type: FormEventType;
53
127
  }
54
128
  type FormEventType = "focus" | "blur";
55
- interface WithFormRef<T> {
56
- ref?: Ref<T>;
57
- }
58
- interface TextFieldProps extends FormItemProps<string>, WithFormRef<Form.TextField> {
59
- placeholder?: string;
60
- }
61
- interface PasswordFieldProps extends FormItemProps<string>, WithFormRef<Form.PasswordField> {
62
- placeholder?: string;
63
- }
64
129
  export declare enum DatePickerType {
65
130
  DateTime = "dateTime",
66
131
  Date = "date"
67
132
  }
68
- interface DatePickerProps extends FormItemProps<Date | null>, WithFormRef<Form.DatePicker> {
69
- min?: Date;
70
- max?: Date;
71
- type?: DatePickerType;
72
- }
73
- interface CheckboxProps extends FormItemProps<boolean>, WithFormRef<Form.Checkbox> {
74
- label?: string;
75
- }
76
- interface DropdownProps extends FormItemProps<string>, WithFormRef<Form.Dropdown> {
77
- tooltip?: string;
78
- children?: ReactNode;
79
- filtering?: boolean;
80
- isLoading?: boolean;
81
- placeholder?: string;
82
- throttle?: boolean;
83
- onSearchTextChange?: (text: string) => void;
84
- }
85
- interface TagPickerProps extends FormItemProps<string[]>, WithFormRef<Form.TagPicker> {
86
- children?: ReactNode;
87
- }
88
- interface TextAreaProps extends FormItemProps<string>, WithFormRef<Form.TextArea> {
89
- placeholder?: string;
90
- }
91
- interface FilePickerProps extends FormItemProps<string[]>, WithFormRef<Form.FilePicker> {
92
- allowMultipleSelection?: boolean;
93
- canChooseDirectories?: boolean;
94
- canChooseFiles?: boolean;
95
- showHiddenFiles?: boolean;
96
- }
97
- type DescriptionProps = {
98
- text: string;
99
- title?: string;
100
- };
101
133
  /**
102
134
  * @category UI Components
103
135
  */
104
136
  export declare const Form: import("react").FC<Form.Props> & {
105
- TextField: import("react").FC<TextFieldProps>;
106
- PasswordField: import("react").FC<PasswordFieldProps>;
107
- DatePicker: import("react").FC<DatePickerProps> & {
137
+ TextField: import("react").FC<Form.TextField.Props>;
138
+ PasswordField: import("react").FC<Form.PasswordField.Props>;
139
+ DatePicker: import("react").FC<Form.DatePicker.Props> & {
108
140
  Type: typeof DatePickerType;
109
141
  isFullDay: (value: Date | null | undefined) => boolean;
110
142
  };
111
- Checkbox: import("react").FC<CheckboxProps>;
112
- TextArea: import("react").FC<TextAreaProps>;
113
- Dropdown: import("react").FC<DropdownProps> & {
143
+ Checkbox: import("react").FC<Form.Checkbox.Props>;
144
+ TextArea: import("react").FC<Form.TextArea.Props>;
145
+ Dropdown: import("react").FC<Form.Dropdown.Props> & {
114
146
  Item: import("react").FC<{
115
147
  title: string;
116
148
  value: string;
@@ -122,19 +154,12 @@ export declare const Form: import("react").FC<Form.Props> & {
122
154
  children?: ReactNode;
123
155
  }>;
124
156
  };
125
- Description: import("react").FC<DescriptionProps>;
126
- TagPicker: import("react").FC<TagPickerProps> & {
127
- Item: import("react").FC<{
128
- title: string;
129
- value: string;
130
- icon: ImageLike;
131
- }>;
157
+ Description: import("react").FC<Form.Description.Props>;
158
+ TagPicker: import("react").FC<Form.TagPicker.Props> & {
159
+ Item: import("react").FC<Form.TagPicker.Item.Props>;
132
160
  };
133
- FilePicker: import("react").FC<FilePickerProps>;
161
+ FilePicker: import("react").FC<Form.FilePicker.Props>;
134
162
  Separator: () => import("react/jsx-runtime").JSX.Element;
135
- LinkAccessory: ({ target, text }: {
136
- target: string;
137
- text: string;
138
- }) => import("react/jsx-runtime").JSX.Element;
163
+ LinkAccessory: ({ target, text }: Form.LinkAccessory.Props) => import("react/jsx-runtime").JSX.Element;
139
164
  };
140
165
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.20.5",
3
+ "version": "0.20.7",
4
4
  "description": "TypeScript SDK to build Vicinae extensions",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",