brix-runtime-sdk-api-web 1.0.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/dist/index.js +190 -0
- package/dist/types/api-exports.test.d.ts +33 -0
- package/dist/types/api-exports.test.d.ts.map +1 -0
- package/dist/types/context/RuntimeContext.d.ts +69 -0
- package/dist/types/context/RuntimeContext.d.ts.map +1 -0
- package/dist/types/context/index.d.ts +23 -0
- package/dist/types/context/index.d.ts.map +1 -0
- package/dist/types/index.d.ts +52 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/types/auth.d.ts +405 -0
- package/dist/types/types/auth.d.ts.map +1 -0
- package/dist/types/types/capability.d.ts +218 -0
- package/dist/types/types/capability.d.ts.map +1 -0
- package/dist/types/types/common.d.ts +99 -0
- package/dist/types/types/common.d.ts.map +1 -0
- package/dist/types/types/config.d.ts +85 -0
- package/dist/types/types/config.d.ts.map +1 -0
- package/dist/types/types/event.d.ts +658 -0
- package/dist/types/types/event.d.ts.map +1 -0
- package/dist/types/types/http.d.ts +132 -0
- package/dist/types/types/http.d.ts.map +1 -0
- package/dist/types/types/i18n.d.ts +327 -0
- package/dist/types/types/i18n.d.ts.map +1 -0
- package/dist/types/types/index.d.ts +61 -0
- package/dist/types/types/index.d.ts.map +1 -0
- package/dist/types/types/layout.d.ts +301 -0
- package/dist/types/types/layout.d.ts.map +1 -0
- package/dist/types/types/module.d.ts +78 -0
- package/dist/types/types/module.d.ts.map +1 -0
- package/dist/types/types/navigation.d.ts +295 -0
- package/dist/types/types/navigation.d.ts.map +1 -0
- package/dist/types/types/plugin-loader-capability.d.ts +142 -0
- package/dist/types/types/plugin-loader-capability.d.ts.map +1 -0
- package/dist/types/types/plugin.d.ts +250 -0
- package/dist/types/types/plugin.d.ts.map +1 -0
- package/dist/types/types/state.d.ts +306 -0
- package/dist/types/types/state.d.ts.map +1 -0
- package/dist/types/types/theme.d.ts +279 -0
- package/dist/types/types/theme.d.ts.map +1 -0
- package/dist/types/types/ui/adapter.d.ts +181 -0
- package/dist/types/types/ui/adapter.d.ts.map +1 -0
- package/dist/types/types/ui/avatar.d.ts +102 -0
- package/dist/types/types/ui/avatar.d.ts.map +1 -0
- package/dist/types/types/ui/badge.d.ts +101 -0
- package/dist/types/types/ui/badge.d.ts.map +1 -0
- package/dist/types/types/ui/button.d.ts +135 -0
- package/dist/types/types/ui/button.d.ts.map +1 -0
- package/dist/types/types/ui/card.d.ts +105 -0
- package/dist/types/types/ui/card.d.ts.map +1 -0
- package/dist/types/types/ui/common.d.ts +29 -0
- package/dist/types/types/ui/common.d.ts.map +1 -0
- package/dist/types/types/ui/icon.d.ts +78 -0
- package/dist/types/types/ui/icon.d.ts.map +1 -0
- package/dist/types/types/ui/index.d.ts +59 -0
- package/dist/types/types/ui/index.d.ts.map +1 -0
- package/dist/types/types/ui/input.d.ts +200 -0
- package/dist/types/types/ui/input.d.ts.map +1 -0
- package/dist/types/types/ui/menu.d.ts +211 -0
- package/dist/types/types/ui/menu.d.ts.map +1 -0
- package/dist/types/types/ui/message.d.ts +121 -0
- package/dist/types/types/ui/message.d.ts.map +1 -0
- package/dist/types/types/ui/modal.d.ts +167 -0
- package/dist/types/types/ui/modal.d.ts.map +1 -0
- package/dist/types/types/ui/select.d.ts +213 -0
- package/dist/types/types/ui/select.d.ts.map +1 -0
- package/dist/types/types/ui/theme-tokens.d.ts +226 -0
- package/dist/types/types/ui/theme-tokens.d.ts.map +1 -0
- package/dist/types/types/ui/tooltip.d.ts +98 -0
- package/dist/types/types/ui/tooltip.d.ts.map +1 -0
- package/dist/types/types/ui.d.ts +49 -0
- package/dist/types/types/ui.d.ts.map +1 -0
- package/package.json +34 -0
- package/src/api-exports.test.ts +199 -0
- package/src/context/RuntimeContext.d.ts +69 -0
- package/src/context/RuntimeContext.d.ts.map +1 -0
- package/src/context/RuntimeContext.ts +75 -0
- package/src/context/index.d.ts +23 -0
- package/src/context/index.d.ts.map +1 -0
- package/src/context/index.ts +23 -0
- package/src/index.d.ts +52 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.ts +59 -0
- package/src/types/auth.d.ts +146 -0
- package/src/types/auth.d.ts.map +1 -0
- package/src/types/auth.ts +479 -0
- package/src/types/capability.d.ts +218 -0
- package/src/types/capability.d.ts.map +1 -0
- package/src/types/capability.ts +302 -0
- package/src/types/common.d.ts +99 -0
- package/src/types/common.d.ts.map +1 -0
- package/src/types/common.ts +115 -0
- package/src/types/config.d.ts +64 -0
- package/src/types/config.d.ts.map +1 -0
- package/src/types/config.ts +96 -0
- package/src/types/event.d.ts +206 -0
- package/src/types/event.d.ts.map +1 -0
- package/src/types/event.ts +776 -0
- package/src/types/http.d.ts +132 -0
- package/src/types/http.d.ts.map +1 -0
- package/src/types/http.ts +156 -0
- package/src/types/i18n.ts +420 -0
- package/src/types/index.d.ts +50 -0
- package/src/types/index.d.ts.map +1 -0
- package/src/types/index.ts +120 -0
- package/src/types/layout.ts +394 -0
- package/src/types/module.d.ts +78 -0
- package/src/types/module.d.ts.map +1 -0
- package/src/types/module.ts +92 -0
- package/src/types/navigation.d.ts +101 -0
- package/src/types/navigation.d.ts.map +1 -0
- package/src/types/navigation.ts +361 -0
- package/src/types/plugin-loader-capability.ts +159 -0
- package/src/types/plugin.d.ts +250 -0
- package/src/types/plugin.d.ts.map +1 -0
- package/src/types/plugin.ts +344 -0
- package/src/types/state.d.ts +119 -0
- package/src/types/state.d.ts.map +1 -0
- package/src/types/state.ts +366 -0
- package/src/types/theme.ts +378 -0
- package/src/types/ui/adapter.ts +222 -0
- package/src/types/ui/avatar.ts +113 -0
- package/src/types/ui/badge.ts +112 -0
- package/src/types/ui/button.ts +148 -0
- package/src/types/ui/card.ts +116 -0
- package/src/types/ui/common.ts +29 -0
- package/src/types/ui/icon.ts +85 -0
- package/src/types/ui/index.ts +78 -0
- package/src/types/ui/input.ts +225 -0
- package/src/types/ui/menu.ts +237 -0
- package/src/types/ui/message.ts +135 -0
- package/src/types/ui/modal.ts +188 -0
- package/src/types/ui/select.ts +239 -0
- package/src/types/ui/theme-tokens.ts +357 -0
- package/src/types/ui/tooltip.ts +120 -0
- package/src/types/ui.ts +49 -0
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Brix Platform Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @file Input Component Type Definitions
|
|
18
|
+
* @description Defines types for the Input component in the UI adapter system
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/ui/input
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { ChangeEvent, KeyboardEvent, FocusEvent, CSSProperties } from 'react';
|
|
24
|
+
import type { ComponentSize } from './common';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Input Field Type
|
|
28
|
+
*
|
|
29
|
+
* HTML input type attribute values supported by the Input component.
|
|
30
|
+
*/
|
|
31
|
+
export type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Input Component Props
|
|
35
|
+
*
|
|
36
|
+
* UI library agnostic input field properties. Supports all standard
|
|
37
|
+
* text input use cases with validation and accessibility features.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <Input
|
|
42
|
+
* label="Email"
|
|
43
|
+
* type="email"
|
|
44
|
+
* placeholder="Enter your email"
|
|
45
|
+
* value={email}
|
|
46
|
+
* onChange={(e) => setEmail(e.target.value)}
|
|
47
|
+
* error={!isValidEmail}
|
|
48
|
+
* helperText={!isValidEmail ? 'Invalid email format' : ''}
|
|
49
|
+
* />
|
|
50
|
+
* ```
|
|
51
|
+
*/
|
|
52
|
+
export interface InputProps {
|
|
53
|
+
/**
|
|
54
|
+
* Input Field Type
|
|
55
|
+
*
|
|
56
|
+
* Determines the input behavior and keyboard on mobile devices.
|
|
57
|
+
* @default 'text'
|
|
58
|
+
*/
|
|
59
|
+
type?: InputType;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Current Value
|
|
63
|
+
*
|
|
64
|
+
* The controlled value of the input field.
|
|
65
|
+
*/
|
|
66
|
+
value?: string;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Default Value
|
|
70
|
+
*
|
|
71
|
+
* The initial value for uncontrolled input usage.
|
|
72
|
+
*/
|
|
73
|
+
defaultValue?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Placeholder Text
|
|
77
|
+
*
|
|
78
|
+
* Hint text displayed when the input is empty.
|
|
79
|
+
*/
|
|
80
|
+
placeholder?: string;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Field Label
|
|
84
|
+
*
|
|
85
|
+
* Accessible label displayed above or beside the input.
|
|
86
|
+
*/
|
|
87
|
+
label?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Helper Text
|
|
91
|
+
*
|
|
92
|
+
* Descriptive text displayed below the input for guidance.
|
|
93
|
+
*/
|
|
94
|
+
helperText?: string;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Error State
|
|
98
|
+
*
|
|
99
|
+
* When true, displays the input in an error state with visual feedback.
|
|
100
|
+
* @default false
|
|
101
|
+
*/
|
|
102
|
+
error?: boolean;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Disabled State
|
|
106
|
+
*
|
|
107
|
+
* When true, the input is non-interactive and visually dimmed.
|
|
108
|
+
* @default false
|
|
109
|
+
*/
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Read-Only State
|
|
114
|
+
*
|
|
115
|
+
* When true, the input value can be selected but not modified.
|
|
116
|
+
* @default false
|
|
117
|
+
*/
|
|
118
|
+
readOnly?: boolean;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Required Field Indicator
|
|
122
|
+
*
|
|
123
|
+
* When true, displays a required field indicator.
|
|
124
|
+
* @default false
|
|
125
|
+
*/
|
|
126
|
+
required?: boolean;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Input Size
|
|
130
|
+
*
|
|
131
|
+
* Controls the input dimensions and font size.
|
|
132
|
+
* @default 'medium'
|
|
133
|
+
*/
|
|
134
|
+
size?: ComponentSize;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Full Width Mode
|
|
138
|
+
*
|
|
139
|
+
* When true, the input expands to fill its container width.
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
fullWidth?: boolean;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Start Adornment Icon
|
|
146
|
+
*
|
|
147
|
+
* Icon name displayed at the start of the input.
|
|
148
|
+
*/
|
|
149
|
+
startAdornment?: string;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* End Adornment Icon
|
|
153
|
+
*
|
|
154
|
+
* Icon name displayed at the end of the input.
|
|
155
|
+
* Commonly used for clear button or visibility toggle.
|
|
156
|
+
*/
|
|
157
|
+
endAdornment?: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Maximum Character Length
|
|
161
|
+
*
|
|
162
|
+
* Maximum number of characters allowed in the input.
|
|
163
|
+
*/
|
|
164
|
+
maxLength?: number;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* HTML Name Attribute
|
|
168
|
+
*
|
|
169
|
+
* Form field name for form submission.
|
|
170
|
+
*/
|
|
171
|
+
name?: string;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Auto Focus
|
|
175
|
+
*
|
|
176
|
+
* When true, the input receives focus on mount.
|
|
177
|
+
* @default false
|
|
178
|
+
*/
|
|
179
|
+
autoFocus?: boolean;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Auto Complete Hint
|
|
183
|
+
*
|
|
184
|
+
* Browser autocomplete hint for the input field.
|
|
185
|
+
*/
|
|
186
|
+
autoComplete?: string;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Change Event Handler
|
|
190
|
+
*
|
|
191
|
+
* Callback fired when the input value changes.
|
|
192
|
+
*/
|
|
193
|
+
onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Focus Event Handler
|
|
197
|
+
*
|
|
198
|
+
* Callback fired when the input receives focus.
|
|
199
|
+
*/
|
|
200
|
+
onFocus?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Blur Event Handler
|
|
204
|
+
*
|
|
205
|
+
* Callback fired when the input loses focus.
|
|
206
|
+
*/
|
|
207
|
+
onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Key Down Event Handler
|
|
211
|
+
*
|
|
212
|
+
* Callback fired on key down events.
|
|
213
|
+
*/
|
|
214
|
+
onKeyDown?: (event: KeyboardEvent<HTMLInputElement>) => void;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Custom Inline Styles
|
|
218
|
+
*/
|
|
219
|
+
style?: CSSProperties;
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Custom CSS Class Name
|
|
223
|
+
*/
|
|
224
|
+
className?: string;
|
|
225
|
+
}
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Brix Platform Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @file Menu Component Type Definitions
|
|
18
|
+
* @description Defines types for the Menu and MenuItem components in the UI adapter system
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/ui/menu
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*
|
|
22
|
+
* [Architectural Note]
|
|
23
|
+
* These are ATOMIC navigation components for Shell layer assembly.
|
|
24
|
+
* Sidebar and Header are assembled at Shell layer using these components.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
import type { ReactNode, MouseEvent, CSSProperties } from 'react';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Menu Item Definition
|
|
31
|
+
*
|
|
32
|
+
* Represents a navigation item in the menu hierarchy.
|
|
33
|
+
* Used by both the Menu component and Shell layout components.
|
|
34
|
+
*/
|
|
35
|
+
export interface MenuItem {
|
|
36
|
+
/**
|
|
37
|
+
* Unique Item Key
|
|
38
|
+
*
|
|
39
|
+
* Unique identifier for the menu item. Used for selection tracking.
|
|
40
|
+
*/
|
|
41
|
+
key: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Display Label
|
|
45
|
+
*
|
|
46
|
+
* The text displayed for this menu item.
|
|
47
|
+
*/
|
|
48
|
+
label: ReactNode;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Icon Name
|
|
52
|
+
*
|
|
53
|
+
* Optional icon displayed before the label.
|
|
54
|
+
*/
|
|
55
|
+
icon?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Navigation Path
|
|
59
|
+
*
|
|
60
|
+
* The URL path this item navigates to.
|
|
61
|
+
*/
|
|
62
|
+
path?: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Child Items
|
|
66
|
+
*
|
|
67
|
+
* Nested submenu items.
|
|
68
|
+
*/
|
|
69
|
+
children?: MenuItem[];
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Hidden State
|
|
73
|
+
*
|
|
74
|
+
* When true, the item is not rendered.
|
|
75
|
+
*/
|
|
76
|
+
hidden?: boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Sort Order
|
|
80
|
+
*
|
|
81
|
+
* Numeric weight for sorting. Lower values appear first.
|
|
82
|
+
*/
|
|
83
|
+
order?: number;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Disabled State
|
|
87
|
+
*
|
|
88
|
+
* When true, the item is non-interactive.
|
|
89
|
+
*/
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Badge Count
|
|
94
|
+
*
|
|
95
|
+
* Optional notification count displayed on the item.
|
|
96
|
+
*/
|
|
97
|
+
badge?: number;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Menu Component Props
|
|
102
|
+
*
|
|
103
|
+
* Atomic navigation menu component. This is a presentation component
|
|
104
|
+
* used by Shell layer to assemble layout components like Sidebar.
|
|
105
|
+
*
|
|
106
|
+
* **Architectural Note:** This is an atomic component.
|
|
107
|
+
* Sidebar and Header are assembled at Shell layer using this component.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```tsx
|
|
111
|
+
* <Menu
|
|
112
|
+
* items={menuItems}
|
|
113
|
+
* selectedKey={currentPath}
|
|
114
|
+
* onSelect={(key, item) => navigate(item.path)}
|
|
115
|
+
* collapsed={sidebarCollapsed}
|
|
116
|
+
* />
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export interface MenuProps {
|
|
120
|
+
/**
|
|
121
|
+
* Menu Items
|
|
122
|
+
*
|
|
123
|
+
* Array of menu items to render.
|
|
124
|
+
*/
|
|
125
|
+
items: MenuItem[];
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Selected Item Key
|
|
129
|
+
*
|
|
130
|
+
* Key of the currently selected item for highlight.
|
|
131
|
+
*/
|
|
132
|
+
selectedKey?: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Expanded Keys
|
|
136
|
+
*
|
|
137
|
+
* Keys of expanded submenu items.
|
|
138
|
+
*/
|
|
139
|
+
expandedKeys?: string[];
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Default Expanded Keys
|
|
143
|
+
*
|
|
144
|
+
* Initially expanded submenu keys for uncontrolled usage.
|
|
145
|
+
*/
|
|
146
|
+
defaultExpandedKeys?: string[];
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Selection Handler
|
|
150
|
+
*
|
|
151
|
+
* Callback fired when a menu item is selected.
|
|
152
|
+
*/
|
|
153
|
+
onSelect?: (key: string, item: MenuItem) => void;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Expand Handler
|
|
157
|
+
*
|
|
158
|
+
* Callback fired when submenu expand state changes.
|
|
159
|
+
*/
|
|
160
|
+
onExpand?: (expandedKeys: string[]) => void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Collapsed Mode
|
|
164
|
+
*
|
|
165
|
+
* When true, displays the menu in collapsed icon-only mode.
|
|
166
|
+
* @default false
|
|
167
|
+
*/
|
|
168
|
+
collapsed?: boolean;
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Inline Mode
|
|
172
|
+
*
|
|
173
|
+
* When true, submenus expand inline. When false, submenus popup.
|
|
174
|
+
* @default true
|
|
175
|
+
*/
|
|
176
|
+
inlineMode?: boolean;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Custom Inline Styles
|
|
180
|
+
*/
|
|
181
|
+
style?: CSSProperties;
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Custom CSS Class Name
|
|
185
|
+
*/
|
|
186
|
+
className?: string;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Menu Item Component Props
|
|
191
|
+
*
|
|
192
|
+
* Individual menu item component props. Used for custom menu item rendering.
|
|
193
|
+
*/
|
|
194
|
+
export interface MenuItemProps {
|
|
195
|
+
/**
|
|
196
|
+
* Item Data
|
|
197
|
+
*
|
|
198
|
+
* The menu item data object.
|
|
199
|
+
*/
|
|
200
|
+
item: MenuItem;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Selected State
|
|
204
|
+
*
|
|
205
|
+
* Whether this item is currently selected.
|
|
206
|
+
*/
|
|
207
|
+
selected?: boolean;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Depth Level
|
|
211
|
+
*
|
|
212
|
+
* Nesting depth for indentation (0 = root level).
|
|
213
|
+
*/
|
|
214
|
+
depth?: number;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Collapsed Mode
|
|
218
|
+
*
|
|
219
|
+
* Whether the parent menu is in collapsed mode.
|
|
220
|
+
*/
|
|
221
|
+
collapsed?: boolean;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Click Handler
|
|
225
|
+
*/
|
|
226
|
+
onClick?: (event: MouseEvent<HTMLElement>) => void;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Custom Inline Styles
|
|
230
|
+
*/
|
|
231
|
+
style?: CSSProperties;
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Custom CSS Class Name
|
|
235
|
+
*/
|
|
236
|
+
className?: string;
|
|
237
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 Brix Platform Authors
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @file Message API Type Definitions
|
|
18
|
+
* @description Defines types for the Toast/Snackbar Message API in the UI adapter system
|
|
19
|
+
* @module @brix/runtime-sdk-api-web/types/ui/message
|
|
20
|
+
* @version 3.2.0
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import type { ReactNode } from 'react';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Message Type Variants
|
|
27
|
+
*/
|
|
28
|
+
export type MessageType = 'success' | 'error' | 'warning' | 'info' | 'loading';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Message Configuration Options
|
|
32
|
+
*/
|
|
33
|
+
export interface MessageOptions {
|
|
34
|
+
/**
|
|
35
|
+
* Message Content
|
|
36
|
+
*/
|
|
37
|
+
content: ReactNode;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Display Duration (ms)
|
|
41
|
+
*
|
|
42
|
+
* Duration before auto-dismiss. 0 means manual dismiss only.
|
|
43
|
+
* @default 3000
|
|
44
|
+
*/
|
|
45
|
+
duration?: number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Closable
|
|
49
|
+
*
|
|
50
|
+
* When true, displays a close button.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
closable?: boolean;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Unique Key
|
|
57
|
+
*
|
|
58
|
+
* Unique key for updating or closing specific messages.
|
|
59
|
+
*/
|
|
60
|
+
key?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Close Callback
|
|
64
|
+
*
|
|
65
|
+
* Callback fired when the message is closed.
|
|
66
|
+
*/
|
|
67
|
+
onClose?: () => void;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Message Destroy Function
|
|
72
|
+
*
|
|
73
|
+
* Function returned by message calls to manually dismiss the message.
|
|
74
|
+
*/
|
|
75
|
+
export type MessageDestroy = () => void;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Message API Interface
|
|
79
|
+
*
|
|
80
|
+
* Imperative API for displaying toast/snackbar messages.
|
|
81
|
+
* This is a stateless API - implementations manage message state internally.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```tsx
|
|
85
|
+
* // Using the message API from UIAdapter
|
|
86
|
+
* const { message } = useUI();
|
|
87
|
+
*
|
|
88
|
+
* message.success({ content: 'Saved successfully!' });
|
|
89
|
+
* message.error({ content: 'Operation failed', duration: 5000 });
|
|
90
|
+
*
|
|
91
|
+
* // With loading state
|
|
92
|
+
* const destroy = message.loading({ content: 'Processing...' });
|
|
93
|
+
* await doAsyncOperation();
|
|
94
|
+
* destroy();
|
|
95
|
+
* message.success({ content: 'Done!' });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
export interface MessageAPI {
|
|
99
|
+
/**
|
|
100
|
+
* Success Message
|
|
101
|
+
*/
|
|
102
|
+
success: (options: MessageOptions | string) => MessageDestroy;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Error Message
|
|
106
|
+
*/
|
|
107
|
+
error: (options: MessageOptions | string) => MessageDestroy;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Warning Message
|
|
111
|
+
*/
|
|
112
|
+
warning: (options: MessageOptions | string) => MessageDestroy;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Info Message
|
|
116
|
+
*/
|
|
117
|
+
info: (options: MessageOptions | string) => MessageDestroy;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Loading Message
|
|
121
|
+
*/
|
|
122
|
+
loading: (options: MessageOptions | string) => MessageDestroy;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Destroy Specific Message
|
|
126
|
+
*
|
|
127
|
+
* Destroys a message by its key.
|
|
128
|
+
*/
|
|
129
|
+
destroy: (key?: string) => void;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Destroy All Messages
|
|
133
|
+
*/
|
|
134
|
+
destroyAll: () => void;
|
|
135
|
+
}
|