@stackable-labs/sdk-extension-contracts 1.29.0 → 1.31.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.d.ts +294 -9
- package/dist/index.js +277 -85
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -27,22 +27,296 @@ interface ApiError {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* UI Component Contract
|
|
30
|
-
*
|
|
31
|
-
*
|
|
30
|
+
*
|
|
31
|
+
* Single source of truth for all UI tag metadata. Every other export
|
|
32
|
+
* in this file is derived from UI_TAG_DEFINITIONS.
|
|
33
|
+
*
|
|
34
|
+
* To add a new component:
|
|
35
|
+
* 1. Add an entry to UI_TAG_DEFINITIONS
|
|
36
|
+
* 2. Add a host wrapper in embeddables/src/lib/hostComponents.tsx
|
|
37
|
+
* 3. Run `pnpm check:values` to verify consistency
|
|
32
38
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
39
|
+
type UITagCategory = 'layout' | 'text' | 'input' | 'feedback' | 'navigation' | 'composite';
|
|
40
|
+
declare const UI_TAG_DEFINITIONS: {
|
|
41
|
+
readonly 'ui-card': {
|
|
42
|
+
readonly description: "Card container for grouping related content";
|
|
43
|
+
readonly icon: "square";
|
|
44
|
+
readonly category: "layout";
|
|
45
|
+
readonly attributes: readonly ["className", "onClick"];
|
|
46
|
+
readonly children: readonly ["ui-card-header", "ui-card-content"];
|
|
47
|
+
};
|
|
48
|
+
readonly 'ui-card-content': {
|
|
49
|
+
readonly description: "Content area within a Card";
|
|
50
|
+
readonly icon: "square";
|
|
51
|
+
readonly category: "layout";
|
|
52
|
+
readonly attributes: readonly ["className"];
|
|
53
|
+
};
|
|
54
|
+
readonly 'ui-card-header': {
|
|
55
|
+
readonly description: "Header area within a Card";
|
|
56
|
+
readonly icon: "square";
|
|
57
|
+
readonly category: "layout";
|
|
58
|
+
readonly attributes: readonly ["className"];
|
|
59
|
+
};
|
|
60
|
+
readonly 'ui-button': {
|
|
61
|
+
readonly description: "Interactive button with variant and size options";
|
|
62
|
+
readonly icon: "mouse-pointer-click";
|
|
63
|
+
readonly category: "input";
|
|
64
|
+
readonly attributes: readonly ["variant", "size", "disabled", "onClick", "type", "className", "title"];
|
|
65
|
+
readonly attributeValues: {
|
|
66
|
+
readonly variant: readonly ["default", "destructive", "outline", "secondary", "ghost", "link"];
|
|
67
|
+
readonly size: readonly ["default", "xs", "sm", "lg", "icon"];
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
readonly 'ui-text': {
|
|
71
|
+
readonly description: "Paragraph text";
|
|
72
|
+
readonly icon: "type";
|
|
73
|
+
readonly category: "text";
|
|
74
|
+
readonly attributes: readonly ["className", "tone"];
|
|
75
|
+
readonly attributeValues: {
|
|
76
|
+
readonly tone: readonly ["default", "muted", "destructive"];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
readonly 'ui-heading': {
|
|
80
|
+
readonly description: "Heading element (h1–h6)";
|
|
81
|
+
readonly icon: "heading";
|
|
82
|
+
readonly category: "text";
|
|
83
|
+
readonly attributes: readonly ["level", "className"];
|
|
84
|
+
readonly attributeValues: {
|
|
85
|
+
readonly level: readonly ["1", "2", "3", "4", "5", "6"];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
readonly 'ui-badge': {
|
|
89
|
+
readonly description: "Small label for status, category, or count";
|
|
90
|
+
readonly icon: "tag";
|
|
91
|
+
readonly category: "text";
|
|
92
|
+
readonly attributes: readonly ["variant", "hue", "tone", "className"];
|
|
93
|
+
readonly attributeValues: {
|
|
94
|
+
readonly variant: readonly ["default", "secondary", "destructive", "outline", "ghost", "link"];
|
|
95
|
+
readonly hue: readonly ["amber", "blue", "emerald", "red", "purple", "pink", "gray"];
|
|
96
|
+
readonly tone: readonly ["default", "muted", "destructive"];
|
|
97
|
+
};
|
|
98
|
+
};
|
|
99
|
+
readonly 'ui-input': {
|
|
100
|
+
readonly description: "Single-line text input field";
|
|
101
|
+
readonly icon: "text-cursor-input";
|
|
102
|
+
readonly category: "input";
|
|
103
|
+
readonly attributes: readonly ["type", "placeholder", "value", "onChange", "disabled", "className", "id"];
|
|
104
|
+
};
|
|
105
|
+
readonly 'ui-textarea': {
|
|
106
|
+
readonly description: "Multi-line text input field";
|
|
107
|
+
readonly icon: "text";
|
|
108
|
+
readonly category: "input";
|
|
109
|
+
readonly attributes: readonly ["placeholder", "value", "onChange", "disabled", "rows", "className", "id"];
|
|
110
|
+
};
|
|
111
|
+
readonly 'ui-select': {
|
|
112
|
+
readonly description: "Dropdown select with options";
|
|
113
|
+
readonly icon: "chevrons-up-down";
|
|
114
|
+
readonly category: "input";
|
|
115
|
+
readonly attributes: readonly ["value", "defaultValue", "onChange", "placeholder", "disabled", "className"];
|
|
116
|
+
readonly children: readonly ["ui-select-option"];
|
|
117
|
+
};
|
|
118
|
+
readonly 'ui-select-option': {
|
|
119
|
+
readonly description: "Option within a Select dropdown";
|
|
120
|
+
readonly icon: "chevrons-up-down";
|
|
121
|
+
readonly category: "input";
|
|
122
|
+
readonly attributes: readonly ["value", "disabled", "className"];
|
|
123
|
+
};
|
|
124
|
+
readonly 'ui-checkbox': {
|
|
125
|
+
readonly description: "Checkbox toggle for boolean values";
|
|
126
|
+
readonly icon: "square-check";
|
|
127
|
+
readonly category: "input";
|
|
128
|
+
readonly attributes: readonly ["checked", "onChange", "disabled", "className", "id"];
|
|
129
|
+
};
|
|
130
|
+
readonly 'ui-switch': {
|
|
131
|
+
readonly description: "Toggle switch for on/off states";
|
|
132
|
+
readonly icon: "toggle-left";
|
|
133
|
+
readonly category: "input";
|
|
134
|
+
readonly attributes: readonly ["checked", "onChange", "disabled", "size", "className", "id"];
|
|
135
|
+
readonly attributeValues: {
|
|
136
|
+
readonly size: readonly ["sm", "default"];
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
readonly 'ui-label': {
|
|
140
|
+
readonly description: "Form label associated with an input";
|
|
141
|
+
readonly icon: "tag";
|
|
142
|
+
readonly category: "input";
|
|
143
|
+
readonly attributes: readonly ["htmlFor", "className"];
|
|
144
|
+
};
|
|
145
|
+
readonly 'ui-radio-group': {
|
|
146
|
+
readonly description: "Group of radio buttons for single selection";
|
|
147
|
+
readonly icon: "circle-dot";
|
|
148
|
+
readonly category: "input";
|
|
149
|
+
readonly attributes: readonly ["value", "defaultValue", "onChange", "className"];
|
|
150
|
+
readonly children: readonly ["ui-radio-group-item", "ui-label", "ui-inline"];
|
|
151
|
+
};
|
|
152
|
+
readonly 'ui-radio-group-item': {
|
|
153
|
+
readonly description: "Individual radio button within a RadioGroup";
|
|
154
|
+
readonly icon: "circle-dot";
|
|
155
|
+
readonly category: "input";
|
|
156
|
+
readonly attributes: readonly ["value", "disabled", "className", "id"];
|
|
157
|
+
};
|
|
158
|
+
readonly 'ui-stack': {
|
|
159
|
+
readonly description: "Vertical or horizontal flex container with gap";
|
|
160
|
+
readonly icon: "rows-3";
|
|
161
|
+
readonly category: "layout";
|
|
162
|
+
readonly attributes: readonly ["gap", "direction", "className"];
|
|
163
|
+
readonly attributeValues: {
|
|
164
|
+
readonly direction: readonly ["row", "column"];
|
|
165
|
+
readonly gap: readonly ["0", "1", "2", "3", "4", "5", "6", "8", "10", "12"];
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
readonly 'ui-inline': {
|
|
169
|
+
readonly description: "Horizontal flex container with centered items";
|
|
170
|
+
readonly icon: "columns-3";
|
|
171
|
+
readonly category: "layout";
|
|
172
|
+
readonly attributes: readonly ["gap", "className"];
|
|
173
|
+
readonly attributeValues: {
|
|
174
|
+
readonly gap: readonly ["0", "1", "2", "3", "4", "5", "6", "8", "10", "12"];
|
|
175
|
+
};
|
|
176
|
+
};
|
|
177
|
+
readonly 'ui-separator': {
|
|
178
|
+
readonly description: "Horizontal divider line";
|
|
179
|
+
readonly icon: "minus";
|
|
180
|
+
readonly category: "layout";
|
|
181
|
+
readonly attributes: readonly ["className"];
|
|
182
|
+
};
|
|
183
|
+
readonly 'ui-tabs': {
|
|
184
|
+
readonly description: "Tabbed content container";
|
|
185
|
+
readonly icon: "panel-top";
|
|
186
|
+
readonly category: "navigation";
|
|
187
|
+
readonly attributes: readonly ["defaultValue", "className"];
|
|
188
|
+
readonly children: readonly ["ui-tabs-list", "ui-tabs-content"];
|
|
189
|
+
};
|
|
190
|
+
readonly 'ui-tabs-list': {
|
|
191
|
+
readonly description: "Container for tab triggers";
|
|
192
|
+
readonly icon: "panel-top";
|
|
193
|
+
readonly category: "navigation";
|
|
194
|
+
readonly attributes: readonly ["className"];
|
|
195
|
+
readonly children: readonly ["ui-tabs-trigger"];
|
|
196
|
+
};
|
|
197
|
+
readonly 'ui-tabs-trigger': {
|
|
198
|
+
readonly description: "Clickable tab label within TabsList";
|
|
199
|
+
readonly icon: "panel-top";
|
|
200
|
+
readonly category: "navigation";
|
|
201
|
+
readonly attributes: readonly ["value", "className"];
|
|
202
|
+
};
|
|
203
|
+
readonly 'ui-tabs-content': {
|
|
204
|
+
readonly description: "Content panel shown when its tab is active";
|
|
205
|
+
readonly icon: "panel-top";
|
|
206
|
+
readonly category: "navigation";
|
|
207
|
+
readonly attributes: readonly ["value", "className"];
|
|
208
|
+
};
|
|
209
|
+
readonly 'ui-scroll-area': {
|
|
210
|
+
readonly description: "Scrollable content container";
|
|
211
|
+
readonly icon: "scroll";
|
|
212
|
+
readonly category: "layout";
|
|
213
|
+
readonly attributes: readonly ["className"];
|
|
214
|
+
};
|
|
215
|
+
readonly 'ui-avatar': {
|
|
216
|
+
readonly description: "User avatar with image and initials fallback";
|
|
217
|
+
readonly icon: "circle-user";
|
|
218
|
+
readonly category: "composite";
|
|
219
|
+
readonly attributes: readonly ["src", "alt", "className"];
|
|
220
|
+
};
|
|
221
|
+
readonly 'ui-icon': {
|
|
222
|
+
readonly description: "Icon from the allowed icon set";
|
|
223
|
+
readonly icon: "sparkles";
|
|
224
|
+
readonly category: "composite";
|
|
225
|
+
readonly attributes: readonly ["name", "size", "className"];
|
|
226
|
+
readonly attributeValues: {
|
|
227
|
+
readonly size: readonly ["sm", "md", "lg"];
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
readonly 'ui-link': {
|
|
231
|
+
readonly description: "Hyperlink element";
|
|
232
|
+
readonly icon: "link";
|
|
233
|
+
readonly category: "navigation";
|
|
234
|
+
readonly attributes: readonly ["href", "target", "rel", "className"];
|
|
235
|
+
};
|
|
236
|
+
readonly 'ui-menu': {
|
|
237
|
+
readonly description: "Card-based menu with clickable items";
|
|
238
|
+
readonly icon: "menu";
|
|
239
|
+
readonly category: "navigation";
|
|
240
|
+
readonly attributes: readonly ["title", "className"];
|
|
241
|
+
readonly children: readonly ["ui-menu-item"];
|
|
242
|
+
};
|
|
243
|
+
readonly 'ui-menu-item': {
|
|
244
|
+
readonly description: "Clickable item within a Menu";
|
|
245
|
+
readonly icon: "menu";
|
|
246
|
+
readonly category: "navigation";
|
|
247
|
+
readonly attributes: readonly ["icon", "label", "description", "onClick", "className"];
|
|
248
|
+
};
|
|
249
|
+
readonly 'ui-skeleton': {
|
|
250
|
+
readonly description: "Loading placeholder with shimmer effect";
|
|
251
|
+
readonly icon: "loader";
|
|
252
|
+
readonly category: "feedback";
|
|
253
|
+
readonly attributes: readonly ["width", "height", "className"];
|
|
254
|
+
};
|
|
255
|
+
readonly 'ui-tooltip': {
|
|
256
|
+
readonly description: "Hover tooltip with text content";
|
|
257
|
+
readonly icon: "message-square";
|
|
258
|
+
readonly category: "feedback";
|
|
259
|
+
readonly attributes: readonly ["content", "className"];
|
|
260
|
+
};
|
|
261
|
+
readonly 'ui-progress': {
|
|
262
|
+
readonly description: "Progress bar with percentage value";
|
|
263
|
+
readonly icon: "bar-chart";
|
|
264
|
+
readonly category: "feedback";
|
|
265
|
+
readonly attributes: readonly ["value", "className"];
|
|
266
|
+
};
|
|
267
|
+
readonly 'ui-alert': {
|
|
268
|
+
readonly description: "Alert banner with icon and optional title";
|
|
269
|
+
readonly icon: "alert-circle";
|
|
270
|
+
readonly category: "feedback";
|
|
271
|
+
readonly attributes: readonly ["variant", "title", "className"];
|
|
272
|
+
readonly attributeValues: {
|
|
273
|
+
readonly variant: readonly ["default", "destructive"];
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
readonly 'ui-collapsible': {
|
|
277
|
+
readonly description: "Expandable/collapsible content section";
|
|
278
|
+
readonly icon: "chevrons-down-up";
|
|
279
|
+
readonly category: "composite";
|
|
280
|
+
readonly attributes: readonly ["defaultOpen", "className"];
|
|
281
|
+
readonly children: readonly ["ui-collapsible-trigger", "ui-collapsible-content"];
|
|
282
|
+
};
|
|
283
|
+
readonly 'ui-collapsible-trigger': {
|
|
284
|
+
readonly description: "Clickable trigger to toggle Collapsible";
|
|
285
|
+
readonly icon: "chevrons-down-up";
|
|
286
|
+
readonly category: "composite";
|
|
287
|
+
readonly attributes: readonly ["className"];
|
|
288
|
+
};
|
|
289
|
+
readonly 'ui-collapsible-content': {
|
|
290
|
+
readonly description: "Content revealed when Collapsible is open";
|
|
291
|
+
readonly icon: "chevrons-down-up";
|
|
292
|
+
readonly category: "composite";
|
|
293
|
+
readonly attributes: readonly ["className"];
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
/** Union type of all valid UI tag names */
|
|
297
|
+
type UITag = keyof typeof UI_TAG_DEFINITIONS;
|
|
298
|
+
/** All valid UI tag names */
|
|
299
|
+
declare const UI_TAGS: readonly UITag[];
|
|
300
|
+
/** Allowed attributes per UI tag. Host should reject any not in this list. */
|
|
301
|
+
declare const UI_TAG_ATTRIBUTES: Record<UITag, readonly string[]>;
|
|
35
302
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
303
|
+
* Valid attribute values per UI tag (for attributes with enumerable options).
|
|
304
|
+
* Cross-referenced from hostComponents.tsx type casts and @workspace/ui CVA definitions.
|
|
38
305
|
*/
|
|
39
|
-
declare const
|
|
306
|
+
declare const UI_TAG_ATTRIBUTE_VALUES: Partial<Record<UITag, Record<string, readonly string[]>>>;
|
|
40
307
|
/**
|
|
41
308
|
* Valid children per parent UI tag.
|
|
42
309
|
* Only parents with strict composition rules are listed.
|
|
43
310
|
* Host should warn (not block) when children violate these rules.
|
|
44
311
|
*/
|
|
45
312
|
declare const UI_TAG_CHILDREN: Partial<Record<UITag, readonly UITag[]>>;
|
|
313
|
+
/** Category for each UI tag — used for grouping in stories and palettes. */
|
|
314
|
+
declare const UI_TAG_CATEGORIES: Record<UITag, UITagCategory>;
|
|
315
|
+
/**
|
|
316
|
+
* Convert a UI tag to its PascalCase component name.
|
|
317
|
+
* e.g., 'ui-card-content' → 'CardContent'
|
|
318
|
+
*/
|
|
319
|
+
declare const tagToComponentName: (tag: UITag) => string;
|
|
46
320
|
/**
|
|
47
321
|
* Supported icon names (subset of lucide-react).
|
|
48
322
|
* Extensions reference icons by name; host renders the actual icon component.
|
|
@@ -93,9 +367,20 @@ interface ToastPayload {
|
|
|
93
367
|
/** Error message shown when fetch rejects (requires fetch) */
|
|
94
368
|
error?: string;
|
|
95
369
|
}
|
|
370
|
+
/**
|
|
371
|
+
* Messenger commands supported by the Zendesk Web Widget (zE('messenger', command)).
|
|
372
|
+
* NOTE: These only apply in floating mode. In embedded mode (mode: 'embedded'),
|
|
373
|
+
* these are no-ops — the widget renders into target DOM elements and has no
|
|
374
|
+
* launcher button or floating panel to show/hide.
|
|
375
|
+
*/
|
|
376
|
+
type MessengerCommand = 'open' | 'close' | 'show' | 'hide';
|
|
377
|
+
/** Widget-only actions handled by WidgetComponent (not forwarded to Zendesk) */
|
|
378
|
+
type WidgetAction = 'toggle';
|
|
379
|
+
/** Known actions for actions.invoke capability */
|
|
380
|
+
type InvokeAction = 'newConversation' | MessengerCommand | WidgetAction;
|
|
96
381
|
/** Payload for actions.invoke capability */
|
|
97
382
|
interface ActionInvokePayload {
|
|
98
|
-
action:
|
|
383
|
+
action: InvokeAction;
|
|
99
384
|
payload?: Record<string, unknown>;
|
|
100
385
|
}
|
|
101
386
|
/** Context returned by context.read capability */
|
|
@@ -494,4 +779,4 @@ interface Order {
|
|
|
494
779
|
display_status?: OrderStatus;
|
|
495
780
|
}
|
|
496
781
|
|
|
497
|
-
export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, type InstanceOption, type InstanceSettings, type MarketplaceExtension, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type Target, type Theme, type ToastPayload, type UITag, UI_TAGS, UI_TAG_ATTRIBUTES, UI_TAG_CHILDREN };
|
|
782
|
+
export { ALLOWED_ICONS, type ActionInvokePayload, type Address, type AllowedIconName, type ApiError, type ApiRequest, type ApiResponse, CAPABILITY_PERMISSION_MAP, type CapabilityCall, type CapabilityRequest, type CapabilityResponse, type CapabilityType, type ContextData, type Customer, type DataField, type DataFieldType, type EncryptedPayload, type ExtensionManifest, type ExtensionRegistryEntry, type FetchRequest, type FetchRequestInit, type FetchResponse, type HostToSandboxMessage, type InstanceOption, type InstanceSettings, type InvokeAction, type MarketplaceExtension, type MessengerCommand, type NamedEntity, type Order, type OrderAction, type OrderItem, type OrderStatus, type OrderStatuses, PERMISSIONS, type Permission, type Price, type SandboxToHostMessage, type Shipment, type SurfaceContext, type SurfaceLifecycleMessage, type Target, type Theme, type ToastPayload, type UITag, type UITagCategory, UI_TAGS, UI_TAG_ATTRIBUTES, UI_TAG_ATTRIBUTE_VALUES, UI_TAG_CATEGORIES, UI_TAG_CHILDREN, UI_TAG_DEFINITIONS, type WidgetAction, tagToComponentName };
|
package/dist/index.js
CHANGED
|
@@ -1,89 +1,277 @@
|
|
|
1
1
|
// src/components.ts
|
|
2
|
-
var
|
|
3
|
-
"ui-card"
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"ui-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"ui-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"ui-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"ui-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"ui-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
"ui-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"ui-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"ui-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"ui-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"ui-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
2
|
+
var UI_TAG_DEFINITIONS = {
|
|
3
|
+
"ui-card": {
|
|
4
|
+
description: "Card container for grouping related content",
|
|
5
|
+
icon: "square",
|
|
6
|
+
category: "layout",
|
|
7
|
+
attributes: ["className", "onClick"],
|
|
8
|
+
children: ["ui-card-header", "ui-card-content"]
|
|
9
|
+
},
|
|
10
|
+
"ui-card-content": {
|
|
11
|
+
description: "Content area within a Card",
|
|
12
|
+
icon: "square",
|
|
13
|
+
category: "layout",
|
|
14
|
+
attributes: ["className"]
|
|
15
|
+
},
|
|
16
|
+
"ui-card-header": {
|
|
17
|
+
description: "Header area within a Card",
|
|
18
|
+
icon: "square",
|
|
19
|
+
category: "layout",
|
|
20
|
+
attributes: ["className"]
|
|
21
|
+
},
|
|
22
|
+
"ui-button": {
|
|
23
|
+
description: "Interactive button with variant and size options",
|
|
24
|
+
icon: "mouse-pointer-click",
|
|
25
|
+
category: "input",
|
|
26
|
+
attributes: ["variant", "size", "disabled", "onClick", "type", "className", "title"],
|
|
27
|
+
attributeValues: {
|
|
28
|
+
variant: ["default", "destructive", "outline", "secondary", "ghost", "link"],
|
|
29
|
+
size: ["default", "xs", "sm", "lg", "icon"]
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"ui-text": {
|
|
33
|
+
description: "Paragraph text",
|
|
34
|
+
icon: "type",
|
|
35
|
+
category: "text",
|
|
36
|
+
attributes: ["className", "tone"],
|
|
37
|
+
attributeValues: {
|
|
38
|
+
tone: ["default", "muted", "destructive"]
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"ui-heading": {
|
|
42
|
+
description: "Heading element (h1\u2013h6)",
|
|
43
|
+
icon: "heading",
|
|
44
|
+
category: "text",
|
|
45
|
+
attributes: ["level", "className"],
|
|
46
|
+
attributeValues: {
|
|
47
|
+
level: ["1", "2", "3", "4", "5", "6"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"ui-badge": {
|
|
51
|
+
description: "Small label for status, category, or count",
|
|
52
|
+
icon: "tag",
|
|
53
|
+
category: "text",
|
|
54
|
+
attributes: ["variant", "hue", "tone", "className"],
|
|
55
|
+
attributeValues: {
|
|
56
|
+
variant: ["default", "secondary", "destructive", "outline", "ghost", "link"],
|
|
57
|
+
hue: ["amber", "blue", "emerald", "red", "purple", "pink", "gray"],
|
|
58
|
+
tone: ["default", "muted", "destructive"]
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"ui-input": {
|
|
62
|
+
description: "Single-line text input field",
|
|
63
|
+
icon: "text-cursor-input",
|
|
64
|
+
category: "input",
|
|
65
|
+
attributes: ["type", "placeholder", "value", "onChange", "disabled", "className", "id"]
|
|
66
|
+
},
|
|
67
|
+
"ui-textarea": {
|
|
68
|
+
description: "Multi-line text input field",
|
|
69
|
+
icon: "text",
|
|
70
|
+
category: "input",
|
|
71
|
+
attributes: ["placeholder", "value", "onChange", "disabled", "rows", "className", "id"]
|
|
72
|
+
},
|
|
73
|
+
"ui-select": {
|
|
74
|
+
description: "Dropdown select with options",
|
|
75
|
+
icon: "chevrons-up-down",
|
|
76
|
+
category: "input",
|
|
77
|
+
attributes: ["value", "defaultValue", "onChange", "placeholder", "disabled", "className"],
|
|
78
|
+
children: ["ui-select-option"]
|
|
79
|
+
},
|
|
80
|
+
"ui-select-option": {
|
|
81
|
+
description: "Option within a Select dropdown",
|
|
82
|
+
icon: "chevrons-up-down",
|
|
83
|
+
category: "input",
|
|
84
|
+
attributes: ["value", "disabled", "className"]
|
|
85
|
+
},
|
|
86
|
+
"ui-checkbox": {
|
|
87
|
+
description: "Checkbox toggle for boolean values",
|
|
88
|
+
icon: "square-check",
|
|
89
|
+
category: "input",
|
|
90
|
+
attributes: ["checked", "onChange", "disabled", "className", "id"]
|
|
91
|
+
},
|
|
92
|
+
"ui-switch": {
|
|
93
|
+
description: "Toggle switch for on/off states",
|
|
94
|
+
icon: "toggle-left",
|
|
95
|
+
category: "input",
|
|
96
|
+
attributes: ["checked", "onChange", "disabled", "size", "className", "id"],
|
|
97
|
+
attributeValues: {
|
|
98
|
+
size: ["sm", "default"]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"ui-label": {
|
|
102
|
+
description: "Form label associated with an input",
|
|
103
|
+
icon: "tag",
|
|
104
|
+
category: "input",
|
|
105
|
+
attributes: ["htmlFor", "className"]
|
|
106
|
+
},
|
|
107
|
+
"ui-radio-group": {
|
|
108
|
+
description: "Group of radio buttons for single selection",
|
|
109
|
+
icon: "circle-dot",
|
|
110
|
+
category: "input",
|
|
111
|
+
attributes: ["value", "defaultValue", "onChange", "className"],
|
|
112
|
+
children: ["ui-radio-group-item", "ui-label", "ui-inline"]
|
|
113
|
+
},
|
|
114
|
+
"ui-radio-group-item": {
|
|
115
|
+
description: "Individual radio button within a RadioGroup",
|
|
116
|
+
icon: "circle-dot",
|
|
117
|
+
category: "input",
|
|
118
|
+
attributes: ["value", "disabled", "className", "id"]
|
|
119
|
+
},
|
|
120
|
+
"ui-stack": {
|
|
121
|
+
// TODO: explore adding `align` attribute (e.g., 'start', 'center', 'end') — needs host implementation in hostComponents.tsx
|
|
122
|
+
description: "Vertical or horizontal flex container with gap",
|
|
123
|
+
icon: "rows-3",
|
|
124
|
+
category: "layout",
|
|
125
|
+
attributes: ["gap", "direction", "className"],
|
|
126
|
+
attributeValues: {
|
|
127
|
+
direction: ["row", "column"],
|
|
128
|
+
gap: ["0", "1", "2", "3", "4", "5", "6", "8", "10", "12"]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"ui-inline": {
|
|
132
|
+
// TODO: explore adding `align` attribute (e.g., 'start', 'center', 'end') — needs host implementation in hostComponents.tsx
|
|
133
|
+
description: "Horizontal flex container with centered items",
|
|
134
|
+
icon: "columns-3",
|
|
135
|
+
category: "layout",
|
|
136
|
+
attributes: ["gap", "className"],
|
|
137
|
+
attributeValues: {
|
|
138
|
+
gap: ["0", "1", "2", "3", "4", "5", "6", "8", "10", "12"]
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"ui-separator": {
|
|
142
|
+
description: "Horizontal divider line",
|
|
143
|
+
icon: "minus",
|
|
144
|
+
category: "layout",
|
|
145
|
+
attributes: ["className"]
|
|
146
|
+
},
|
|
147
|
+
"ui-tabs": {
|
|
148
|
+
description: "Tabbed content container",
|
|
149
|
+
icon: "panel-top",
|
|
150
|
+
category: "navigation",
|
|
151
|
+
attributes: ["defaultValue", "className"],
|
|
152
|
+
children: ["ui-tabs-list", "ui-tabs-content"]
|
|
153
|
+
},
|
|
154
|
+
"ui-tabs-list": {
|
|
155
|
+
description: "Container for tab triggers",
|
|
156
|
+
icon: "panel-top",
|
|
157
|
+
category: "navigation",
|
|
158
|
+
attributes: ["className"],
|
|
159
|
+
children: ["ui-tabs-trigger"]
|
|
160
|
+
},
|
|
161
|
+
"ui-tabs-trigger": {
|
|
162
|
+
description: "Clickable tab label within TabsList",
|
|
163
|
+
icon: "panel-top",
|
|
164
|
+
category: "navigation",
|
|
165
|
+
attributes: ["value", "className"]
|
|
166
|
+
},
|
|
167
|
+
"ui-tabs-content": {
|
|
168
|
+
description: "Content panel shown when its tab is active",
|
|
169
|
+
icon: "panel-top",
|
|
170
|
+
category: "navigation",
|
|
171
|
+
attributes: ["value", "className"]
|
|
172
|
+
},
|
|
173
|
+
"ui-scroll-area": {
|
|
174
|
+
description: "Scrollable content container",
|
|
175
|
+
icon: "scroll",
|
|
176
|
+
category: "layout",
|
|
177
|
+
attributes: ["className"]
|
|
178
|
+
},
|
|
179
|
+
"ui-avatar": {
|
|
180
|
+
description: "User avatar with image and initials fallback",
|
|
181
|
+
icon: "circle-user",
|
|
182
|
+
category: "composite",
|
|
183
|
+
attributes: ["src", "alt", "className"]
|
|
184
|
+
},
|
|
185
|
+
"ui-icon": {
|
|
186
|
+
description: "Icon from the allowed icon set",
|
|
187
|
+
icon: "sparkles",
|
|
188
|
+
category: "composite",
|
|
189
|
+
attributes: ["name", "size", "className"],
|
|
190
|
+
attributeValues: {
|
|
191
|
+
size: ["sm", "md", "lg"]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
"ui-link": {
|
|
195
|
+
description: "Hyperlink element",
|
|
196
|
+
icon: "link",
|
|
197
|
+
category: "navigation",
|
|
198
|
+
attributes: ["href", "target", "rel", "className"]
|
|
199
|
+
},
|
|
200
|
+
"ui-menu": {
|
|
201
|
+
description: "Card-based menu with clickable items",
|
|
202
|
+
icon: "menu",
|
|
203
|
+
category: "navigation",
|
|
204
|
+
attributes: ["title", "className"],
|
|
205
|
+
children: ["ui-menu-item"]
|
|
206
|
+
},
|
|
207
|
+
"ui-menu-item": {
|
|
208
|
+
description: "Clickable item within a Menu",
|
|
209
|
+
icon: "menu",
|
|
210
|
+
category: "navigation",
|
|
211
|
+
attributes: ["icon", "label", "description", "onClick", "className"]
|
|
212
|
+
},
|
|
213
|
+
"ui-skeleton": {
|
|
214
|
+
description: "Loading placeholder with shimmer effect",
|
|
215
|
+
icon: "loader",
|
|
216
|
+
category: "feedback",
|
|
217
|
+
attributes: ["width", "height", "className"]
|
|
218
|
+
},
|
|
219
|
+
"ui-tooltip": {
|
|
220
|
+
description: "Hover tooltip with text content",
|
|
221
|
+
icon: "message-square",
|
|
222
|
+
category: "feedback",
|
|
223
|
+
attributes: ["content", "className"]
|
|
224
|
+
},
|
|
225
|
+
"ui-progress": {
|
|
226
|
+
description: "Progress bar with percentage value",
|
|
227
|
+
icon: "bar-chart",
|
|
228
|
+
category: "feedback",
|
|
229
|
+
attributes: ["value", "className"]
|
|
230
|
+
},
|
|
231
|
+
"ui-alert": {
|
|
232
|
+
description: "Alert banner with icon and optional title",
|
|
233
|
+
icon: "alert-circle",
|
|
234
|
+
category: "feedback",
|
|
235
|
+
attributes: ["variant", "title", "className"],
|
|
236
|
+
attributeValues: {
|
|
237
|
+
variant: ["default", "destructive"]
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
"ui-collapsible": {
|
|
241
|
+
description: "Expandable/collapsible content section",
|
|
242
|
+
icon: "chevrons-down-up",
|
|
243
|
+
category: "composite",
|
|
244
|
+
attributes: ["defaultOpen", "className"],
|
|
245
|
+
children: ["ui-collapsible-trigger", "ui-collapsible-content"]
|
|
246
|
+
},
|
|
247
|
+
"ui-collapsible-trigger": {
|
|
248
|
+
description: "Clickable trigger to toggle Collapsible",
|
|
249
|
+
icon: "chevrons-down-up",
|
|
250
|
+
category: "composite",
|
|
251
|
+
attributes: ["className"]
|
|
252
|
+
},
|
|
253
|
+
"ui-collapsible-content": {
|
|
254
|
+
description: "Content revealed when Collapsible is open",
|
|
255
|
+
icon: "chevrons-down-up",
|
|
256
|
+
category: "composite",
|
|
257
|
+
attributes: ["className"]
|
|
258
|
+
}
|
|
86
259
|
};
|
|
260
|
+
var defs = UI_TAG_DEFINITIONS;
|
|
261
|
+
var UI_TAGS = Object.keys(UI_TAG_DEFINITIONS);
|
|
262
|
+
var UI_TAG_ATTRIBUTES = Object.fromEntries(
|
|
263
|
+
UI_TAGS.map((tag) => [tag, defs[tag].attributes])
|
|
264
|
+
);
|
|
265
|
+
var UI_TAG_ATTRIBUTE_VALUES = Object.fromEntries(
|
|
266
|
+
UI_TAGS.filter((tag) => defs[tag].attributeValues).map((tag) => [tag, defs[tag].attributeValues])
|
|
267
|
+
);
|
|
268
|
+
var UI_TAG_CHILDREN = Object.fromEntries(
|
|
269
|
+
UI_TAGS.filter((tag) => defs[tag].children).map((tag) => [tag, defs[tag].children])
|
|
270
|
+
);
|
|
271
|
+
var UI_TAG_CATEGORIES = Object.fromEntries(
|
|
272
|
+
UI_TAGS.map((tag) => [tag, defs[tag].category])
|
|
273
|
+
);
|
|
274
|
+
var tagToComponentName = (tag) => tag.replace(/^ui-/, "").split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
87
275
|
var ALLOWED_ICONS = [
|
|
88
276
|
"arrow-left",
|
|
89
277
|
"calendar",
|
|
@@ -165,5 +353,9 @@ export {
|
|
|
165
353
|
PERMISSIONS,
|
|
166
354
|
UI_TAGS,
|
|
167
355
|
UI_TAG_ATTRIBUTES,
|
|
168
|
-
|
|
356
|
+
UI_TAG_ATTRIBUTE_VALUES,
|
|
357
|
+
UI_TAG_CATEGORIES,
|
|
358
|
+
UI_TAG_CHILDREN,
|
|
359
|
+
UI_TAG_DEFINITIONS,
|
|
360
|
+
tagToComponentName
|
|
169
361
|
};
|