@antglobal/copilot-cards-web 1.0.2 → 1.0.4

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.
Files changed (3) hide show
  1. package/dist/index.d.ts +467 -37
  2. package/dist/index.js +4091 -496
  3. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -29,6 +29,24 @@ interface WebActionContextOptions {
29
29
  */
30
30
  declare function createWebActionContext(options?: WebActionContextOptions): ActionRunnerContext;
31
31
 
32
+ interface ResponsiveMobileOptions {
33
+ readonly unit: 'rem';
34
+ readonly rootValue: number;
35
+ }
36
+ interface ResponsiveOptions {
37
+ readonly mobile?: ResponsiveMobileOptions;
38
+ }
39
+ interface ResponsiveContext {
40
+ readonly active: boolean;
41
+ readonly rootValue: number;
42
+ resolveLength(value: string | number): string;
43
+ convertCSS(value: string): string;
44
+ }
45
+ declare const DEFAULT_MOBILE_RESPONSIVE: ResponsiveMobileOptions;
46
+ /** Convert CSS px lengths while preserving strings, comments, and URLs. */
47
+ declare function convertPixelTokens(value: string, rootValue: number): string;
48
+ declare function createResponsiveContext(isMobile: boolean, responsive?: ResponsiveOptions): ResponsiveContext;
49
+
32
50
  /**
33
51
  * renderCard — the primary public API for @antglobal/copilot-cards-web.
34
52
  *
@@ -46,6 +64,8 @@ declare function createWebActionContext(options?: WebActionContextOptions): Acti
46
64
  interface RenderCardOptions extends WebActionContextOptions {
47
65
  /** Force mobile mode; auto-detected from viewport if omitted */
48
66
  isMobile?: boolean;
67
+ /** Mobile sizing conversion. `isMobile: true` defaults to rem/rootValue 100. */
68
+ responsive?: ResponsiveOptions;
49
69
  /** External variables to merge into schema.variables (overrides schema defaults) */
50
70
  variables?: Record<string, any>;
51
71
  /** Bot ID — used to look up bot-scoped action handlers */
@@ -422,16 +442,18 @@ declare abstract class BaseElement extends HTMLElement {
422
442
  protected _node: RenderTreeNode | null;
423
443
  protected _props: Record<string, any>;
424
444
  protected _isMobile: boolean;
445
+ protected _responsiveOptions?: ResponsiveOptions;
446
+ protected _responsive: ResponsiveContext;
425
447
  constructor();
426
448
  /**
427
449
  * Set component data and trigger render.
428
450
  * Called by the component renderer (from `renderCard` pipeline).
429
451
  */
430
- setData(node: RenderTreeNode, props: Record<string, any>, isMobile: boolean): void;
452
+ setData(node: RenderTreeNode, props: Record<string, any>, isMobile: boolean, responsive?: ResponsiveOptions): void;
431
453
  /**
432
454
  * Update props only (e.g. on variable change + re-render).
433
455
  */
434
- updateProps(props: Record<string, any>, isMobile?: boolean): void;
456
+ updateProps(props: Record<string, any>, isMobile?: boolean, responsive?: ResponsiveOptions): void;
435
457
  /**
436
458
  * Subclasses must implement this to render their UI into `this.shadowRoot`.
437
459
  */
@@ -445,6 +467,14 @@ declare abstract class BaseElement extends HTMLElement {
445
467
  protected buildInlineStyle(style?: Record<string, any>, isExpressionResult?: boolean): string;
446
468
  /** Resolve a single size value (number → px). */
447
469
  protected toCSS(value: string | number): string;
470
+ /** Assign component markup and convert only its CSS declarations. */
471
+ protected setShadowHTML(html: string): void;
472
+ /**
473
+ * Escape a value before interpolating it into a double-quoted HTML
474
+ * attribute. Browsers decode the entities before parsing inline CSS, so
475
+ * valid CSS strings keep working while quotes cannot create attributes.
476
+ */
477
+ private escapeAttribute;
448
478
  /**
449
479
  * CSS properties whose numeric values are unitless — appending `px`
450
480
  * to these produces invalid CSS the browser silently drops
@@ -466,7 +496,7 @@ declare class CardText extends BaseElement {
466
496
  private _mdPendingUpdate;
467
497
  private _tooltipEl;
468
498
  private _tooltipTimer;
469
- setData(node: RenderTreeNode, props: Record<string, any>, isMobile: boolean): void;
499
+ setData(node: RenderTreeNode, props: Record<string, any>, isMobile: boolean, responsive?: ResponsiveOptions): void;
470
500
  protected render(): void;
471
501
  /**
472
502
  * Handle incremental content update in streaming mode.
@@ -494,7 +524,7 @@ declare class CardText extends BaseElement {
494
524
  * Remove cursor when streaming ends.
495
525
  * Called externally when streaming prop changes to false.
496
526
  */
497
- updateProps(props: Record<string, any>, isMobile?: boolean): void;
527
+ updateProps(props: Record<string, any>, isMobile?: boolean, responsive?: ResponsiveOptions): void;
498
528
  /**
499
529
  * Parse markdown to HTML using marked.
500
530
  */
@@ -573,12 +603,11 @@ declare class CardButton extends BaseElement {
573
603
  * {
574
604
  * "type": "Input",
575
605
  * "props": {
576
- * "placeholder": "Enter your name",
577
- * "inputType": "text",
578
- * "variableKey": "userName",
579
- * "label": "Name",
580
- * "maxLength": 100,
581
- * "disabled": false,
606
+ * "placeholder": "Phone Number",
607
+ * "inputType": "tel",
608
+ * "variableKey": "phone",
609
+ * "prefix": "+86",
610
+ * "suffix": { "name": "info", "size": 18 },
582
611
  * "style": { "width": 300 }
583
612
  * },
584
613
  * "events": {
@@ -595,6 +624,7 @@ declare class CardInput extends BaseElement {
595
624
  private escapeHtml;
596
625
  /** Escape attribute values for safe insertion. */
597
626
  private escapeAttr;
627
+ private _domId;
598
628
  }
599
629
 
600
630
  /**
@@ -685,55 +715,107 @@ declare class CardRate extends BaseElement {
685
715
  protected render(): void;
686
716
  /** Reset internal state when props update externally */
687
717
  updateProps(props: Record<string, any>, isMobile?: boolean): void;
718
+ private commit;
719
+ private normalizeValue;
720
+ private escapeAttr;
688
721
  }
689
722
 
690
723
  /**
691
- * CardTag — Custom Element for rendering a tag/badge label.
724
+ * CardCounter — Custom Element for a numeric stepper (−/value/+).
725
+ *
726
+ * A self-contained value control: two buttons decrement / increment the
727
+ * middle number within [min, max] by `step`, disabling each button at its
728
+ * bound. Both the icons and every part's style are configurable.
729
+ *
730
+ * The value is synced to schema variables the same way `Input` does — an
731
+ * `input` event drives `variableKey` auto-sync (no re-render), while a
732
+ * `change` event lets `onChange` actions read `${_event.value}`.
733
+ *
734
+ * Controlled vs uncontrolled:
735
+ * • Uncontrolled — set a static `defaultValue` and (optionally) a
736
+ * `variableKey`. Clicks update the internal value silently; the value is
737
+ * available to later actions (e.g. form submit) but nothing else re-renders.
738
+ * • Controlled — bind `value` to a variable (`"value": "${qty}"`) and wire an
739
+ * `onChange` → `setVariable`. Because `setVariable` rebuilds the DOM, the
740
+ * stepper must read its value from that variable or it will visually reset
741
+ * to `defaultValue` on every change. Prefer this when other nodes display
742
+ * the same value.
692
743
  *
693
744
  * Schema example:
694
745
  * ```json
695
746
  * {
696
- * "type": "Tag",
747
+ * "type": "Counter",
697
748
  * "props": {
698
- * "content": "NEW",
699
- * "color": "blue",
700
- * "closable": false
749
+ * "defaultValue": 1,
750
+ * "min": 1,
751
+ * "max": 99,
752
+ * "step": 1,
753
+ * "variableKey": "qty",
754
+ * "size": 28,
755
+ * "plusIcon": { "name": "+" },
756
+ * "minusIcon": { "name": "−" },
757
+ * "plusStyle": { "background": "#2f3542", "color": "#fff" }
758
+ * },
759
+ * "events": {
760
+ * "onChange": [{ "type": "setVariable", "params": { "key": "qty", "value": "${_event.value}" } }]
701
761
  * }
702
762
  * }
703
763
  * ```
704
764
  */
705
765
 
706
- declare class CardTag extends BaseElement {
707
- static readonly is = "ai-card-tag";
766
+ declare class CardCounter extends BaseElement {
767
+ static readonly is = "ai-card-counter";
768
+ /** Internal interactive value (tracks clicks before external update) */
769
+ private _currentValue;
708
770
  protected render(): void;
771
+ /** Clamp, de-dup, update internal value and emit input + change. */
772
+ private commit;
773
+ private clamp;
774
+ /** Trim binary-float drift from decimal steps (e.g. 0.1 + 0.2). */
775
+ private round;
776
+ /**
777
+ * Default minus glyph — a rounded stroke line, drawn in a symmetric
778
+ * 24×24 viewBox centered at (12,12). The SVG fills the button, so the
779
+ * mark is guaranteed centered on both axes (unlike the source's
780
+ * asymmetric 7×2 box, whose line sat above its own midline).
781
+ */
782
+ private defaultMinusGlyph;
783
+ /** Default plus glyph — a rounded stroke cross centered at (12,12). */
784
+ private defaultPlusGlyph;
785
+ /**
786
+ * Build the glyph inside a button.
787
+ * Priority: icon.src (image) > icon.name (emoji / text) > fallback (default SVG).
788
+ */
789
+ private renderIcon;
790
+ /** Reset internal state when props update externally. */
791
+ updateProps(props: Record<string, any>, isMobile?: boolean): void;
792
+ private escapeAttr;
709
793
  }
710
794
 
711
795
  /**
712
- * CardSelect — Custom Element for a dropdown selector.
796
+ * CardTag — Custom Element for rendering a tag/badge label.
713
797
  *
714
798
  * Schema example:
715
799
  * ```json
716
800
  * {
717
- * "type": "Select",
801
+ * "type": "Tag",
718
802
  * "props": {
719
- * "placeholder": "请选择",
720
- * "options": [
721
- * { "label": "选项一", "value": "1" },
722
- * { "label": "选项二", "value": "2" }
723
- * ],
724
- * "value": ""
803
+ * "content": "NEW",
804
+ * "color": "blue",
805
+ * "closable": false
725
806
  * }
726
807
  * }
727
808
  * ```
728
- *
729
- * The value is semi-controlled: a user-picked option shows on the trigger
730
- * immediately even when no `onChange` action is wired, while any external
731
- * `props.value` change (e.g. a variable update re-render) overrides the
732
- * local pick.
733
809
  */
734
810
 
811
+ declare class CardTag extends BaseElement {
812
+ static readonly is = "ai-card-tag";
813
+ protected render(): void;
814
+ }
815
+
735
816
  declare class CardSelect extends BaseElement {
736
817
  private _open;
818
+ private _activeIndex;
737
819
  /** Option picked locally; shown until props.value changes externally. */
738
820
  private _localValue;
739
821
  /** Last seen props.value — detects external changes vs. re-renders. */
@@ -742,7 +824,15 @@ declare class CardSelect extends BaseElement {
742
824
  static readonly is = "ai-card-select";
743
825
  protected render(): void;
744
826
  disconnectedCallback(): void;
827
+ updateProps(props: Record<string, any>, isMobile?: boolean, responsive?: ResponsiveOptions): void;
745
828
  private _setOpen;
829
+ private openWithCurrentOption;
830
+ private handleKeydown;
831
+ private findNextEnabled;
832
+ private commit;
833
+ private escapeAttr;
834
+ private escapeText;
835
+ private applyHostStyles;
746
836
  }
747
837
 
748
838
  /**
@@ -827,8 +917,20 @@ declare class CardForm extends BaseElement {
827
917
  private _submitted;
828
918
  protected render(): void;
829
919
  private _renderField;
920
+ private _initializeSelectFields;
921
+ private _selectProps;
922
+ private _initializeRateFields;
923
+ private _rateProps;
924
+ private _renderAffix;
830
925
  private _bindEvents;
926
+ private _syncPasscodeValue;
831
927
  private _validate;
928
+ private _validateField;
929
+ private _ruleMessage;
930
+ private _updateFieldValidation;
931
+ private _escapeHtml;
932
+ private _escapeAttr;
933
+ private _domId;
832
934
  updateProps(props: Record<string, any>, isMobile?: boolean): void;
833
935
  }
834
936
 
@@ -895,6 +997,23 @@ interface ButtonProps {
895
997
  /** Inline style object */
896
998
  style?: Record<string, any>;
897
999
  }
1000
+ interface InputAffixConfig {
1001
+ /** Static text. When present, it takes precedence over icon fields. */
1002
+ text?: string;
1003
+ /** Built-in icon name or fallback text/emoji */
1004
+ name?: string;
1005
+ /** External image URL; takes precedence over name */
1006
+ src?: string;
1007
+ /** Icon or image size in px */
1008
+ size?: number;
1009
+ /** Built-in icon color */
1010
+ color?: string;
1011
+ /** Accessible description for icon or image affixes */
1012
+ ariaLabel?: string;
1013
+ /** Inline style applied to the affix wrapper */
1014
+ style?: Record<string, any>;
1015
+ }
1016
+ type InputAffix = string | InputAffixConfig;
898
1017
  interface InputProps {
899
1018
  /** Placeholder text */
900
1019
  placeholder?: string;
@@ -904,16 +1023,32 @@ interface InputProps {
904
1023
  label?: string;
905
1024
  /** Initial value */
906
1025
  defaultValue?: string;
1026
+ /** Reactive variable the value is synced into */
1027
+ variableKey?: string;
1028
+ /** Static content rendered before the editable value */
1029
+ prefix?: InputAffix;
1030
+ /** Static content rendered after the editable value */
1031
+ suffix?: InputAffix;
907
1032
  /** Whether the input is disabled */
908
1033
  disabled?: boolean;
909
1034
  /** Whether the input is read-only */
910
1035
  readonly?: boolean;
911
1036
  /** Maximum character length */
912
1037
  maxLength?: number;
1038
+ /** Minimum value for number inputs */
1039
+ min?: number;
1040
+ /** Maximum value for number inputs */
1041
+ max?: number;
1042
+ /** Increment used by number inputs (default 1) */
1043
+ step?: number;
1044
+ /** Whether number inputs show built-in step controls (default true) */
1045
+ controls?: boolean;
913
1046
  /** Number of rows for textarea (default 3) */
914
1047
  rows?: number;
915
- /** Inline style object */
1048
+ /** Inline style applied to the combined input control */
916
1049
  style?: Record<string, any>;
1050
+ /** Inline style applied directly to the native input or textarea */
1051
+ inputStyle?: Record<string, any>;
917
1052
  }
918
1053
  interface ImageProps {
919
1054
  /** Image URL */
@@ -948,20 +1083,84 @@ interface DividerProps {
948
1083
  interface RateProps {
949
1084
  /** Current rating value (default 0) */
950
1085
  value?: number;
1086
+ /** Initial value for uncontrolled usage */
1087
+ defaultValue?: number;
951
1088
  /** Total number of stars (default 5) */
952
1089
  count?: number;
1090
+ /** Whether the rating is disabled */
1091
+ disabled?: boolean;
953
1092
  /** Whether the rating is read-only (default false) */
954
1093
  readonly?: boolean;
955
1094
  /** Whether half-star selection is allowed (default false) */
956
1095
  allowHalf?: boolean;
1096
+ /** Whether clicking the current value clears it (default true) */
1097
+ allowClear?: boolean;
957
1098
  /** Star size in px (default 24) */
958
1099
  size?: number;
1100
+ /** Gap between stars in px (default 4) */
1101
+ gap?: number;
959
1102
  /** Active star color (default '#fadb14') */
960
1103
  color?: string;
961
1104
  /** Inactive star color (default '#e8e8e8') */
962
1105
  inactiveColor?: string;
1106
+ /** Reactive variable the value is synced into */
1107
+ variableKey?: string;
1108
+ /** Accessible label for the slider */
1109
+ ariaLabel?: string;
963
1110
  /** Inline style object */
964
1111
  style?: Record<string, any>;
1112
+ /** Style applied to every star */
1113
+ starStyle?: Record<string, any>;
1114
+ /** Style applied to active stars */
1115
+ activeStarStyle?: Record<string, any>;
1116
+ /** Style applied to inactive stars */
1117
+ inactiveStarStyle?: Record<string, any>;
1118
+ }
1119
+ interface CounterIcon {
1120
+ /** URL to an icon image (png/svg); http(s) or image data URI */
1121
+ src?: string;
1122
+ /** Built-in icon name or emoji / text glyph */
1123
+ name?: string;
1124
+ }
1125
+ interface CounterProps {
1126
+ /** Initial value (default `min`, falling back to 0) */
1127
+ defaultValue?: number;
1128
+ /** Current external value; takes precedence over defaultValue */
1129
+ value?: number;
1130
+ /** Minimum value (default 0) */
1131
+ min?: number;
1132
+ /** Maximum value (default Infinity) */
1133
+ max?: number;
1134
+ /** Increment/decrement step (default 1) */
1135
+ step?: number;
1136
+ /** Disable the whole control (default false) */
1137
+ disabled?: boolean;
1138
+ /** Read-only: show the value, disable both buttons (default false) */
1139
+ readonly?: boolean;
1140
+ /** Button diameter in px (default 28) */
1141
+ size?: number;
1142
+ /** Min width of the value text in px (default 32) */
1143
+ valueWidth?: number;
1144
+ /** Reactive variable the value is synced into */
1145
+ variableKey?: string;
1146
+ /** Accessible label for the decrement button */
1147
+ decreaseAriaLabel?: string;
1148
+ /** Accessible label for the increment button */
1149
+ increaseAriaLabel?: string;
1150
+ /** Custom minus-button icon ({ src | name }); defaults to '−' */
1151
+ minusIcon?: CounterIcon;
1152
+ /** Custom plus-button icon ({ src | name }); defaults to '+' */
1153
+ plusIcon?: CounterIcon;
1154
+ /** Inline style for the outer wrapper */
1155
+ style?: Record<string, any>;
1156
+ /** Inline style applied to both buttons */
1157
+ buttonStyle?: Record<string, any>;
1158
+ /** Inline style for the minus button (merged over `buttonStyle`) */
1159
+ minusStyle?: Record<string, any>;
1160
+ /** Inline style for the plus button (merged over `buttonStyle`) */
1161
+ plusStyle?: Record<string, any>;
1162
+ /** Inline style for the value text */
1163
+ valueStyle?: Record<string, any>;
965
1164
  }
966
1165
  interface TagProps {
967
1166
  /** Tag label text */
@@ -978,18 +1177,149 @@ interface TagProps {
978
1177
  interface SelectOption {
979
1178
  label: string;
980
1179
  value: string;
1180
+ /** Whether this option cannot be selected */
1181
+ disabled?: boolean;
1182
+ }
1183
+ type SelectSize = 'small' | 'medium' | 'large';
1184
+ type SelectVariant = 'outlined' | 'filled' | 'borderless';
1185
+ interface SelectStyles {
1186
+ /** Select trigger style */
1187
+ trigger?: Record<string, any>;
1188
+ /** Dropdown panel style */
1189
+ dropdown?: Record<string, any>;
1190
+ /** Style applied to every option */
1191
+ option?: Record<string, any>;
1192
+ /** Style merged into the selected option */
1193
+ selectedOption?: Record<string, any>;
1194
+ /** Arrow wrapper style; overrides arrowSize for declared dimensions */
1195
+ arrow?: Record<string, any>;
981
1196
  }
982
1197
  interface SelectProps {
983
1198
  /** Dropdown options list */
984
1199
  options?: SelectOption[];
985
1200
  /** Placeholder text (default '请选择') */
986
1201
  placeholder?: string;
1202
+ /** Initial value for uncontrolled usage */
1203
+ defaultValue?: string;
987
1204
  /** Currently selected value */
988
1205
  value?: string;
1206
+ /** Reactive variable the value is synced into */
1207
+ variableKey?: string;
989
1208
  /** Whether the select is disabled (default false) */
990
1209
  disabled?: boolean;
991
- /** Inline style object */
1210
+ /** Whether the selection is read-only */
1211
+ readonly?: boolean;
1212
+ /** Accessible label for the combobox */
1213
+ ariaLabel?: string;
1214
+ /** Component layout style, such as width and margin */
992
1215
  style?: Record<string, any>;
1216
+ /** Component size preset (default medium) */
1217
+ size?: SelectSize;
1218
+ /** Trigger appearance preset (default outlined) */
1219
+ variant?: SelectVariant;
1220
+ /** Accent used for focus and selection states */
1221
+ accentColor?: string;
1222
+ /** Dropdown arrow size in px or as a CSS length */
1223
+ arrowSize?: number | string;
1224
+ /** Advanced semantic styles for internal parts */
1225
+ styles?: SelectStyles;
1226
+ }
1227
+ interface SwitchProps {
1228
+ /** Current external checked state */
1229
+ checked?: boolean;
1230
+ /** Initial checked state for uncontrolled usage */
1231
+ defaultChecked?: boolean;
1232
+ /** Whether the switch is disabled */
1233
+ disabled?: boolean;
1234
+ /** Whether the switch is read-only but remains focusable */
1235
+ readonly?: boolean;
1236
+ /** Track height in px (default 22; default width is 44) */
1237
+ size?: number;
1238
+ /** Track color while checked */
1239
+ activeColor?: string;
1240
+ /** Track color while unchecked */
1241
+ inactiveColor?: string;
1242
+ /** Thumb color */
1243
+ thumbColor?: string;
1244
+ /** Reactive variable the boolean value is synced into */
1245
+ variableKey?: string;
1246
+ /** Accessible label */
1247
+ ariaLabel?: string;
1248
+ /** Outer wrapper style */
1249
+ style?: Record<string, any>;
1250
+ /** Track style */
1251
+ trackStyle?: Record<string, any>;
1252
+ /** Thumb style */
1253
+ thumbStyle?: Record<string, any>;
1254
+ }
1255
+ type ChoiceListValue = string | string[] | null;
1256
+ interface ChoiceListProps {
1257
+ /** Single-select or multi-select behavior (default single) */
1258
+ selectionMode?: 'single' | 'multiple';
1259
+ /** Current external selection */
1260
+ value?: ChoiceListValue;
1261
+ /** Initial uncontrolled selection */
1262
+ defaultValue?: ChoiceListValue;
1263
+ /** Whether a selected single choice can be cleared */
1264
+ allowClear?: boolean;
1265
+ /** Maximum number of selected items in multiple mode */
1266
+ maxSelected?: number;
1267
+ /** Disable selection and all slotted interactions */
1268
+ disabled?: boolean;
1269
+ /** Lock selection while keeping slotted interactions available */
1270
+ readonly?: boolean;
1271
+ /** List flow direction */
1272
+ direction?: 'vertical' | 'horizontal';
1273
+ /** Gap between direct ChoiceItem children */
1274
+ gap?: number | string;
1275
+ /** Item shell preset; content composition is independent (default plain) */
1276
+ variant?: 'plain' | 'outlined';
1277
+ /** Position of every selection indicator */
1278
+ indicatorPosition?: 'start' | 'end';
1279
+ /** Reactive variable the selection is synced into */
1280
+ variableKey?: string;
1281
+ /** Accessible group label */
1282
+ ariaLabel?: string;
1283
+ /** List wrapper style */
1284
+ style?: Record<string, any>;
1285
+ /** Default style merged into every ChoiceItem */
1286
+ itemStyle?: Record<string, any>;
1287
+ /** Style merged into selected ChoiceItems */
1288
+ selectedItemStyle?: Record<string, any>;
1289
+ /** Default style for every selection indicator */
1290
+ indicatorStyle?: Record<string, any>;
1291
+ /** Style merged into selected indicators */
1292
+ selectedIndicatorStyle?: Record<string, any>;
1293
+ /** Checked mark used by multiple mode; defaults to built-in `check_bold` */
1294
+ checkedIcon?: ChoiceIndicatorIcon;
1295
+ }
1296
+ interface ChoiceIndicatorIcon {
1297
+ /** Built-in icon name or fallback text/emoji */
1298
+ name?: string;
1299
+ /** External image URL; takes precedence over name */
1300
+ src?: string;
1301
+ /** Icon size in px */
1302
+ size?: number;
1303
+ /** Built-in SVG color */
1304
+ color?: string;
1305
+ }
1306
+ interface ChoiceItemProps {
1307
+ /** Unique selection value within the direct parent ChoiceList */
1308
+ value: string;
1309
+ /** Disable this item and all slotted interactions */
1310
+ disabled?: boolean;
1311
+ /** Accessible item label; falls back to value */
1312
+ ariaLabel?: string;
1313
+ /** Item shell style */
1314
+ style?: Record<string, any>;
1315
+ /** Style merged while selected */
1316
+ selectedStyle?: Record<string, any>;
1317
+ /** Per-item indicator style */
1318
+ indicatorStyle?: Record<string, any>;
1319
+ /** Per-item selected indicator style */
1320
+ selectedIndicatorStyle?: Record<string, any>;
1321
+ /** Per-item checked mark override */
1322
+ checkedIcon?: ChoiceIndicatorIcon;
993
1323
  }
994
1324
  interface PasscodeInputProps {
995
1325
  /** Number of passcode cells (default 6, max 10) */
@@ -1028,16 +1358,45 @@ interface FormField {
1028
1358
  placeholder?: string;
1029
1359
  /** Whether the field is required */
1030
1360
  required?: boolean;
1361
+ /** Declarative validation rules, evaluated in array order */
1362
+ rules?: FormRule[];
1363
+ /** Static content rendered before text-like fields */
1364
+ prefix?: InputAffix;
1365
+ /** Static content rendered after text-like fields */
1366
+ suffix?: InputAffix;
1031
1367
  /** Options for select type */
1032
1368
  options?: {
1033
1369
  label: string;
1034
1370
  value: string;
1371
+ disabled?: boolean;
1035
1372
  }[];
1373
+ /** Style forwarded to Select trigger or Rate wrapper; currently ignored by other field types */
1374
+ style?: Record<string, any>;
1375
+ /** Select size preset */
1376
+ size?: SelectSize;
1377
+ /** Select trigger appearance preset */
1378
+ variant?: SelectVariant;
1379
+ /** Select focus and selection accent */
1380
+ accentColor?: string;
1381
+ /** Advanced semantic styles for select fields */
1382
+ styles?: SelectStyles;
1036
1383
  /** Number of cells for passcode type (default 6) */
1037
1384
  length?: number;
1038
1385
  /** Initial value */
1039
1386
  defaultValue?: any;
1040
1387
  }
1388
+ interface FormRule {
1389
+ /** Whether an empty value is invalid */
1390
+ required?: boolean;
1391
+ /** Regular expression source used to validate the string value */
1392
+ pattern?: string;
1393
+ /** Minimum string length */
1394
+ minLength?: number;
1395
+ /** Maximum string length */
1396
+ maxLength?: number;
1397
+ /** Error message shown when this rule fails */
1398
+ message?: string;
1399
+ }
1041
1400
  interface FormProps {
1042
1401
  /** Form field definitions */
1043
1402
  fields?: FormField[];
@@ -1045,9 +1404,13 @@ interface FormProps {
1045
1404
  submitText?: string;
1046
1405
  /** Form layout direction (default 'vertical') */
1047
1406
  layout?: 'vertical' | 'horizontal';
1048
- /** Whether the entire form is disabled (default false) */
1407
+ /** Disables submission and Select/Rate interaction; native fields stop syncing but remain editable */
1049
1408
  disabled?: boolean;
1050
- /** Inline style object */
1409
+ /** Style merged into invalid field controls */
1410
+ invalidStyle?: Record<string, any>;
1411
+ /** Style applied to validation messages */
1412
+ errorStyle?: Record<string, any>;
1413
+ /** Inline style applied to the inner form wrapper */
1051
1414
  style?: Record<string, any>;
1052
1415
  }
1053
1416
  interface LoadingProps {
@@ -1143,6 +1506,8 @@ interface StepsProps {
1143
1506
  items?: StepItem[];
1144
1507
  /** Global icon size in px (default 28) */
1145
1508
  iconSize?: number;
1509
+ /** Title and description layout within each step (default vertical) */
1510
+ textLayout?: 'vertical' | 'horizontal';
1146
1511
  /** Title text style overrides */
1147
1512
  titleProps?: {
1148
1513
  fontSize?: string;
@@ -1219,6 +1584,7 @@ declare class CardProgress extends BaseElement {
1219
1584
  * { "title": "Final review", "status": "pending" }
1220
1585
  * ],
1221
1586
  * "iconSize": 28,
1587
+ * "textLayout": "vertical",
1222
1588
  * "titleProps": { "fontSize": "14px", "fontWeight": 500, "color": "#1a1a1a" },
1223
1589
  * "descriptionProps": { "fontSize": "12px", "color": "#8c8c8c" },
1224
1590
  * "connector": { "width": 2, "minHeight": 24, "style": "solid", "color": "#e8e8e8", "completedColor": "#52c41a" }
@@ -1324,6 +1690,70 @@ declare class CardHtml extends BaseElement {
1324
1690
  protected render(): void;
1325
1691
  }
1326
1692
 
1693
+ declare class CardSwitch extends BaseElement {
1694
+ static readonly is = "ai-card-switch";
1695
+ private _currentChecked;
1696
+ protected render(): void;
1697
+ updateProps(props: Record<string, any>, isMobile?: boolean): void;
1698
+ private commit;
1699
+ private escapeAttr;
1700
+ }
1701
+
1702
+ declare class CardChoiceList extends BaseElement {
1703
+ static readonly is = "ai-card-choice-list";
1704
+ private _currentValue;
1705
+ private readonly _onChoiceRequest;
1706
+ private readonly _onChoiceNavigate;
1707
+ protected render(): void;
1708
+ updateProps(props: Record<string, any>, isMobile?: boolean): void;
1709
+ private commitRequest;
1710
+ private syncItems;
1711
+ private navigateFrom;
1712
+ private get mode();
1713
+ private get currentValue();
1714
+ private get values();
1715
+ private get maxSelected();
1716
+ private normalizeValue;
1717
+ private cloneValue;
1718
+ private escapeAttr;
1719
+ }
1720
+
1721
+ interface IconRenderInput {
1722
+ name?: unknown;
1723
+ src?: unknown;
1724
+ size?: unknown;
1725
+ color?: unknown;
1726
+ }
1727
+
1728
+ interface ChoiceItemSelectionContext {
1729
+ selectionMode: 'single' | 'multiple';
1730
+ variant: 'plain' | 'outlined';
1731
+ selected: boolean;
1732
+ listDisabled: boolean;
1733
+ listReadonly: boolean;
1734
+ selectionBlocked: boolean;
1735
+ tabIndex: 0 | -1;
1736
+ indicatorPosition: 'start' | 'end';
1737
+ itemStyle?: Record<string, any>;
1738
+ selectedItemStyle?: Record<string, any>;
1739
+ indicatorStyle?: Record<string, any>;
1740
+ selectedIndicatorStyle?: Record<string, any>;
1741
+ checkedIcon?: IconRenderInput;
1742
+ }
1743
+ declare class CardChoiceItem extends BaseElement {
1744
+ static readonly is = "ai-card-choice-item";
1745
+ private _context;
1746
+ get value(): string;
1747
+ get itemDisabled(): boolean;
1748
+ setSelectionContext(context: ChoiceItemSelectionContext): void;
1749
+ focusIndicator(): void;
1750
+ protected render(): void;
1751
+ private renderIndicator;
1752
+ private requestChange;
1753
+ private hasInteractiveTarget;
1754
+ private escapeAttr;
1755
+ }
1756
+
1327
1757
  /**
1328
1758
  * Component Renderer Registry — maps schema `type` to render functions.
1329
1759
  *
@@ -1332,7 +1762,7 @@ declare class CardHtml extends BaseElement {
1332
1762
  * for the `renderCard` pipeline to attach events and children.
1333
1763
  */
1334
1764
 
1335
- type ComponentRenderer = (node: RenderTreeNode, props: Record<string, any>, isMobile: boolean) => HTMLElement;
1765
+ type ComponentRenderer = (node: RenderTreeNode, props: Record<string, any>, isMobile: boolean, responsive?: ResponsiveOptions) => HTMLElement;
1336
1766
  declare const componentRenderers: Record<string, ComponentRenderer>;
1337
1767
  /**
1338
1768
  * Register a custom component renderer.
@@ -1349,5 +1779,5 @@ declare const componentRenderers: Record<string, ComponentRenderer>;
1349
1779
  */
1350
1780
  declare function registerComponent(type: string, renderer: ComponentRenderer): void;
1351
1781
 
1352
- export { BaseElement, BotSDK, CardButton, CardCollapse, CardDivider, CardForm, CardHtml, CardIcon, CardImage, CardInput, CardLoading, CardPasscodeInput, CardProgress, CardRate, CardSelect, CardSteps, CardTag, CardText, LocalActionConfigProvider, RemoteActionConfigProvider, buildStyleString, componentRenderers, connectSSE, connectStreaming, createWebActionContext, isMobileViewport, onViewportChange, pxToRem, pxToVw, registerComponent, renderCard, renderStreamingCard, resolveSize, sanitizeHtml, trimIncompleteTag };
1353
- export type { A2UIActionPayload, BotSDKOptions, ButtonProps, CardInstance, CollapseProps, ComponentRenderer, ConnectorConfig, DividerProps, FormField, FormProps, HtmlProps, IconProps, ImageProps, InputProps, LoadingProps, PartialFinalizeResult, PasscodeInputProps, ProgressProps, ProgressSegment, RateProps, RenderCardOptions, SSEConnectOptions, SelectOption, SelectProps, StepIcon, StepItem, StepsProps, StreamingCardInstance, StreamingCardOptions, StreamingConnectOptions, StreamingConnection, TagProps, TextProps, WebActionContextOptions };
1782
+ export { BaseElement, BotSDK, CardButton, CardChoiceItem, CardChoiceList, CardCollapse, CardCounter, CardDivider, CardForm, CardHtml, CardIcon, CardImage, CardInput, CardLoading, CardPasscodeInput, CardProgress, CardRate, CardSelect, CardSteps, CardSwitch, CardTag, CardText, DEFAULT_MOBILE_RESPONSIVE, LocalActionConfigProvider, RemoteActionConfigProvider, buildStyleString, componentRenderers, connectSSE, connectStreaming, convertPixelTokens, createResponsiveContext, createWebActionContext, isMobileViewport, onViewportChange, pxToRem, pxToVw, registerComponent, renderCard, renderStreamingCard, resolveSize, sanitizeHtml, trimIncompleteTag };
1783
+ export type { A2UIActionPayload, BotSDKOptions, ButtonProps, CardInstance, ChoiceIndicatorIcon, ChoiceItemProps, ChoiceListProps, ChoiceListValue, CollapseProps, ComponentRenderer, ConnectorConfig, CounterIcon, CounterProps, DividerProps, FormField, FormProps, FormRule, HtmlProps, IconProps, ImageProps, InputAffix, InputAffixConfig, InputProps, LoadingProps, PartialFinalizeResult, PasscodeInputProps, ProgressProps, ProgressSegment, RateProps, RenderCardOptions, ResponsiveContext, ResponsiveMobileOptions, ResponsiveOptions, SSEConnectOptions, SelectOption, SelectProps, SelectSize, SelectStyles, SelectVariant, StepIcon, StepItem, StepsProps, StreamingCardInstance, StreamingCardOptions, StreamingConnectOptions, StreamingConnection, SwitchProps, TagProps, TextProps, WebActionContextOptions };