Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/audio_player.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import '../../model/a2ui_schemas.dart';
import '../../model/catalog_item.dart';

final _schema = S.object(
description: '''
A catalog item for an audio player.

This widget displays a placeholder for an audio player, used to represent
a component capable of playing audio from a given URL.
''',
properties: {
'url': A2uiSchemas.stringReference(
description: 'The URL of the audio to play.',
Expand Down
7 changes: 7 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ import '../../primitives/logging.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing an elevated button.

This widget displays an interactive button. When pressed, it dispatches
the specified `action` event. The button's appearance can be styled as
a primary action.
''',
properties: {
'child': A2uiSchemas.componentReference(
description:
Expand Down
3 changes: 3 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import '../../model/catalog_item.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a card.
''',
properties: {'child': A2uiSchemas.componentReference()},
required: ['child'],
);
Expand Down
7 changes: 7 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/check_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import '../../model/data_model.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a checkbox with a label.

This widget displays a checkbox a [Text] label. The checkbox's state
is bidirectionally bound to the data model path specified in the `value`
parameter.
''',
properties: {
'label': A2uiSchemas.stringReference(),
'value': A2uiSchemas.booleanReference(),
Expand Down
4 changes: 4 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/column.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import '../../primitives/simple_items.dart';
import 'widget_helpers.dart';

final _schema = S.object(
description: '''
A catalog item representing a layout widget that displays its children in a
vertical array.
''',
properties: {
'distribution': S.string(
description: 'How children are aligned on the main axis. ',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import '../../model/data_model.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a date and/or time input field.

This widget displays a field that, when tapped, opens the native date and/or
time pickers. The selected value is stored as a string in the data model
path specified by the `value` parameter.
''',
properties: {
'value': A2uiSchemas.stringReference(
description: 'The selected date and/or time.',
Expand Down
3 changes: 3 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/divider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import '../../model/catalog_item.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a divider.
''',
properties: {
'axis': S.string(enumValues: ['horizontal', 'vertical']),
},
Expand Down
3 changes: 3 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import '../../model/data_model.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item for an icon.
''',
properties: {
'name': A2uiSchemas.stringReference(
description:
Expand Down
10 changes: 9 additions & 1 deletion packages/genui/lib/src/catalog/core_widgets/image.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ Schema _schema({required bool enableUsageHint}) {
],
);
}
return S.object(properties: properties);
return S.object(
description: '''
A catalog item representing a widget that displays an image.

The image source is specified by the `url` parameter, which can be a network
URL (e.g., `https://...`) or a local asset path (e.g., `assets/...`).
''',
properties: properties,
);
}

extension type _ImageData.fromMap(JsonMap _json) {
Expand Down
3 changes: 3 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import '../../primitives/simple_items.dart';
import 'widget_helpers.dart';

final _schema = S.object(
description: '''
A catalog item representing a scrollable list of widgets.
''',
properties: {
'children': A2uiSchemas.componentArrayReference(),
'direction': S.string(enumValues: ['vertical', 'horizontal']),
Expand Down
8 changes: 8 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ import '../../model/catalog_item.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a modal bottom sheet.

This component doesn't render the modal content directly. Instead, it
renders the `entryPointChild` widget. The `entryPointChild` is expected to
trigger an action (e.g., on button press) that causes the `contentChild` to
be displayed within a modal bottom sheet by the [GenUiSurface].
''',
properties: {
'entryPointChild': A2uiSchemas.componentReference(
description: 'The widget that opens the modal.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import '../../model/data_model.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a multiple choice selection widget.

This widget displays a list of options, each with a checkbox. The
`selections` parameter, which should be a data model path, is updated to
reflect the list of *values* of the currently selected options.
''',
properties: {
'selections': A2uiSchemas.stringArrayReference(),
'options': S.list(
Expand Down
4 changes: 4 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/row.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import '../../primitives/simple_items.dart';
import 'widget_helpers.dart';

final _schema = S.object(
description: '''
A catalog item representing a layout widget that displays its children in a
horizontal array.
''',
properties: {
'children': A2uiSchemas.componentArrayReference(
description:
Expand Down
6 changes: 6 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ import '../../model/data_model.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a slider.

This widget allows the user to select a value from a range by sliding a
thumb along a track. The `value` is bidirectionally bound to the data model.
''',
properties: {
'value': A2uiSchemas.numberReference(),
'minValue': S.number(),
Expand Down
7 changes: 7 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/tabs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ import '../../model/catalog_item.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a tab layout.

This widget displays a [TabBar] and a [TabBarView] to allow navigation
between different child components. Each tab in `tabItems` has a title and
a corresponding child component ID to display when selected.
''',
properties: {
'tabItems': S.list(
items: S.object(
Expand Down
7 changes: 7 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ extension type _TextData.fromMap(JsonMap _json) {
final text = CatalogItem(
name: 'Text',
dataSchema: S.object(
description: '''
A catalog item representing a block of styled text.

This widget displays a string of text. The content is taken from the `text`
parameter, which can be a literal
string or a data model binding.
''',
properties: {
'text': A2uiSchemas.stringReference(
description:
Expand Down
6 changes: 6 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ import '../../model/ui_models.dart';
import '../../primitives/simple_items.dart';

final _schema = S.object(
description: '''
A catalog item representing a text field.

This widget allows the user to enter and edit text. The `text` parameter
bidirectionally binds the field's content to the data model.
''',
properties: {
'text': A2uiSchemas.stringReference(
description: 'The initial value of the text field.',
Expand Down
6 changes: 6 additions & 0 deletions packages/genui/lib/src/catalog/core_widgets/video.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import '../../model/a2ui_schemas.dart';
import '../../model/catalog_item.dart';

final _schema = S.object(
description: '''
A catalog item representing a video player.

This widget currently displays a placeholder for a video player. It is
intended to play video content from the given `url`.
''',
properties: {
'url': A2uiSchemas.stringReference(
description: 'The URL of the video to play.',
Expand Down