@antglobal/copilot-cards-web 1.0.1 → 1.0.3
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 +438 -12
- package/dist/index.js +3628 -295
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -445,6 +445,12 @@ declare abstract class BaseElement extends HTMLElement {
|
|
|
445
445
|
protected buildInlineStyle(style?: Record<string, any>, isExpressionResult?: boolean): string;
|
|
446
446
|
/** Resolve a single size value (number → px). */
|
|
447
447
|
protected toCSS(value: string | number): string;
|
|
448
|
+
/**
|
|
449
|
+
* Escape a value before interpolating it into a double-quoted HTML
|
|
450
|
+
* attribute. Browsers decode the entities before parsing inline CSS, so
|
|
451
|
+
* valid CSS strings keep working while quotes cannot create attributes.
|
|
452
|
+
*/
|
|
453
|
+
private escapeAttribute;
|
|
448
454
|
/**
|
|
449
455
|
* CSS properties whose numeric values are unitless — appending `px`
|
|
450
456
|
* to these produces invalid CSS the browser silently drops
|
|
@@ -573,12 +579,11 @@ declare class CardButton extends BaseElement {
|
|
|
573
579
|
* {
|
|
574
580
|
* "type": "Input",
|
|
575
581
|
* "props": {
|
|
576
|
-
* "placeholder": "
|
|
577
|
-
* "inputType": "
|
|
578
|
-
* "variableKey": "
|
|
579
|
-
* "
|
|
580
|
-
* "
|
|
581
|
-
* "disabled": false,
|
|
582
|
+
* "placeholder": "Phone Number",
|
|
583
|
+
* "inputType": "tel",
|
|
584
|
+
* "variableKey": "phone",
|
|
585
|
+
* "prefix": "+86",
|
|
586
|
+
* "suffix": { "name": "info", "size": 18 },
|
|
582
587
|
* "style": { "width": 300 }
|
|
583
588
|
* },
|
|
584
589
|
* "events": {
|
|
@@ -595,6 +600,7 @@ declare class CardInput extends BaseElement {
|
|
|
595
600
|
private escapeHtml;
|
|
596
601
|
/** Escape attribute values for safe insertion. */
|
|
597
602
|
private escapeAttr;
|
|
603
|
+
private _domId;
|
|
598
604
|
}
|
|
599
605
|
|
|
600
606
|
/**
|
|
@@ -685,6 +691,81 @@ declare class CardRate extends BaseElement {
|
|
|
685
691
|
protected render(): void;
|
|
686
692
|
/** Reset internal state when props update externally */
|
|
687
693
|
updateProps(props: Record<string, any>, isMobile?: boolean): void;
|
|
694
|
+
private commit;
|
|
695
|
+
private normalizeValue;
|
|
696
|
+
private escapeAttr;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* CardCounter — Custom Element for a numeric stepper (−/value/+).
|
|
701
|
+
*
|
|
702
|
+
* A self-contained value control: two buttons decrement / increment the
|
|
703
|
+
* middle number within [min, max] by `step`, disabling each button at its
|
|
704
|
+
* bound. Both the icons and every part's style are configurable.
|
|
705
|
+
*
|
|
706
|
+
* The value is synced to schema variables the same way `Input` does — an
|
|
707
|
+
* `input` event drives `variableKey` auto-sync (no re-render), while a
|
|
708
|
+
* `change` event lets `onChange` actions read `${_event.value}`.
|
|
709
|
+
*
|
|
710
|
+
* Controlled vs uncontrolled:
|
|
711
|
+
* • Uncontrolled — set a static `defaultValue` and (optionally) a
|
|
712
|
+
* `variableKey`. Clicks update the internal value silently; the value is
|
|
713
|
+
* available to later actions (e.g. form submit) but nothing else re-renders.
|
|
714
|
+
* • Controlled — bind `value` to a variable (`"value": "${qty}"`) and wire an
|
|
715
|
+
* `onChange` → `setVariable`. Because `setVariable` rebuilds the DOM, the
|
|
716
|
+
* stepper must read its value from that variable or it will visually reset
|
|
717
|
+
* to `defaultValue` on every change. Prefer this when other nodes display
|
|
718
|
+
* the same value.
|
|
719
|
+
*
|
|
720
|
+
* Schema example:
|
|
721
|
+
* ```json
|
|
722
|
+
* {
|
|
723
|
+
* "type": "Counter",
|
|
724
|
+
* "props": {
|
|
725
|
+
* "defaultValue": 1,
|
|
726
|
+
* "min": 1,
|
|
727
|
+
* "max": 99,
|
|
728
|
+
* "step": 1,
|
|
729
|
+
* "variableKey": "qty",
|
|
730
|
+
* "size": 28,
|
|
731
|
+
* "plusIcon": { "name": "+" },
|
|
732
|
+
* "minusIcon": { "name": "−" },
|
|
733
|
+
* "plusStyle": { "background": "#2f3542", "color": "#fff" }
|
|
734
|
+
* },
|
|
735
|
+
* "events": {
|
|
736
|
+
* "onChange": [{ "type": "setVariable", "params": { "key": "qty", "value": "${_event.value}" } }]
|
|
737
|
+
* }
|
|
738
|
+
* }
|
|
739
|
+
* ```
|
|
740
|
+
*/
|
|
741
|
+
|
|
742
|
+
declare class CardCounter extends BaseElement {
|
|
743
|
+
static readonly is = "ai-card-counter";
|
|
744
|
+
/** Internal interactive value (tracks clicks before external update) */
|
|
745
|
+
private _currentValue;
|
|
746
|
+
protected render(): void;
|
|
747
|
+
/** Clamp, de-dup, update internal value and emit input + change. */
|
|
748
|
+
private commit;
|
|
749
|
+
private clamp;
|
|
750
|
+
/** Trim binary-float drift from decimal steps (e.g. 0.1 + 0.2). */
|
|
751
|
+
private round;
|
|
752
|
+
/**
|
|
753
|
+
* Default minus glyph — a rounded stroke line, drawn in a symmetric
|
|
754
|
+
* 24×24 viewBox centered at (12,12). The SVG fills the button, so the
|
|
755
|
+
* mark is guaranteed centered on both axes (unlike the source's
|
|
756
|
+
* asymmetric 7×2 box, whose line sat above its own midline).
|
|
757
|
+
*/
|
|
758
|
+
private defaultMinusGlyph;
|
|
759
|
+
/** Default plus glyph — a rounded stroke cross centered at (12,12). */
|
|
760
|
+
private defaultPlusGlyph;
|
|
761
|
+
/**
|
|
762
|
+
* Build the glyph inside a button.
|
|
763
|
+
* Priority: icon.src (image) > icon.name (emoji / text) > fallback (default SVG).
|
|
764
|
+
*/
|
|
765
|
+
private renderIcon;
|
|
766
|
+
/** Reset internal state when props update externally. */
|
|
767
|
+
updateProps(props: Record<string, any>, isMobile?: boolean): void;
|
|
768
|
+
private escapeAttr;
|
|
688
769
|
}
|
|
689
770
|
|
|
690
771
|
/**
|
|
@@ -734,6 +815,7 @@ declare class CardTag extends BaseElement {
|
|
|
734
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): 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
|
|
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,145 @@ 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>;
|
|
981
1194
|
}
|
|
982
1195
|
interface SelectProps {
|
|
983
1196
|
/** Dropdown options list */
|
|
984
1197
|
options?: SelectOption[];
|
|
985
1198
|
/** Placeholder text (default '请选择') */
|
|
986
1199
|
placeholder?: string;
|
|
1200
|
+
/** Initial value for uncontrolled usage */
|
|
1201
|
+
defaultValue?: string;
|
|
987
1202
|
/** Currently selected value */
|
|
988
1203
|
value?: string;
|
|
1204
|
+
/** Reactive variable the value is synced into */
|
|
1205
|
+
variableKey?: string;
|
|
989
1206
|
/** Whether the select is disabled (default false) */
|
|
990
1207
|
disabled?: boolean;
|
|
991
|
-
/**
|
|
1208
|
+
/** Whether the selection is read-only */
|
|
1209
|
+
readonly?: boolean;
|
|
1210
|
+
/** Accessible label for the combobox */
|
|
1211
|
+
ariaLabel?: string;
|
|
1212
|
+
/** Component layout style, such as width and margin */
|
|
1213
|
+
style?: Record<string, any>;
|
|
1214
|
+
/** Component size preset (default medium) */
|
|
1215
|
+
size?: SelectSize;
|
|
1216
|
+
/** Trigger appearance preset (default outlined) */
|
|
1217
|
+
variant?: SelectVariant;
|
|
1218
|
+
/** Accent used for focus and selection states */
|
|
1219
|
+
accentColor?: string;
|
|
1220
|
+
/** Advanced semantic styles for internal parts */
|
|
1221
|
+
styles?: SelectStyles;
|
|
1222
|
+
}
|
|
1223
|
+
interface SwitchProps {
|
|
1224
|
+
/** Current external checked state */
|
|
1225
|
+
checked?: boolean;
|
|
1226
|
+
/** Initial checked state for uncontrolled usage */
|
|
1227
|
+
defaultChecked?: boolean;
|
|
1228
|
+
/** Whether the switch is disabled */
|
|
1229
|
+
disabled?: boolean;
|
|
1230
|
+
/** Whether the switch is read-only but remains focusable */
|
|
1231
|
+
readonly?: boolean;
|
|
1232
|
+
/** Track height in px (default 22; default width is 44) */
|
|
1233
|
+
size?: number;
|
|
1234
|
+
/** Track color while checked */
|
|
1235
|
+
activeColor?: string;
|
|
1236
|
+
/** Track color while unchecked */
|
|
1237
|
+
inactiveColor?: string;
|
|
1238
|
+
/** Thumb color */
|
|
1239
|
+
thumbColor?: string;
|
|
1240
|
+
/** Reactive variable the boolean value is synced into */
|
|
1241
|
+
variableKey?: string;
|
|
1242
|
+
/** Accessible label */
|
|
1243
|
+
ariaLabel?: string;
|
|
1244
|
+
/** Outer wrapper style */
|
|
1245
|
+
style?: Record<string, any>;
|
|
1246
|
+
/** Track style */
|
|
1247
|
+
trackStyle?: Record<string, any>;
|
|
1248
|
+
/** Thumb style */
|
|
1249
|
+
thumbStyle?: Record<string, any>;
|
|
1250
|
+
}
|
|
1251
|
+
type ChoiceListValue = string | string[] | null;
|
|
1252
|
+
interface ChoiceListProps {
|
|
1253
|
+
/** Single-select or multi-select behavior (default single) */
|
|
1254
|
+
selectionMode?: 'single' | 'multiple';
|
|
1255
|
+
/** Current external selection */
|
|
1256
|
+
value?: ChoiceListValue;
|
|
1257
|
+
/** Initial uncontrolled selection */
|
|
1258
|
+
defaultValue?: ChoiceListValue;
|
|
1259
|
+
/** Whether a selected single choice can be cleared */
|
|
1260
|
+
allowClear?: boolean;
|
|
1261
|
+
/** Maximum number of selected items in multiple mode */
|
|
1262
|
+
maxSelected?: number;
|
|
1263
|
+
/** Disable selection and all slotted interactions */
|
|
1264
|
+
disabled?: boolean;
|
|
1265
|
+
/** Lock selection while keeping slotted interactions available */
|
|
1266
|
+
readonly?: boolean;
|
|
1267
|
+
/** List flow direction */
|
|
1268
|
+
direction?: 'vertical' | 'horizontal';
|
|
1269
|
+
/** Gap between direct ChoiceItem children */
|
|
1270
|
+
gap?: number | string;
|
|
1271
|
+
/** Item shell preset; content composition is independent (default plain) */
|
|
1272
|
+
variant?: 'plain' | 'outlined';
|
|
1273
|
+
/** Position of every selection indicator */
|
|
1274
|
+
indicatorPosition?: 'start' | 'end';
|
|
1275
|
+
/** Reactive variable the selection is synced into */
|
|
1276
|
+
variableKey?: string;
|
|
1277
|
+
/** Accessible group label */
|
|
1278
|
+
ariaLabel?: string;
|
|
1279
|
+
/** List wrapper style */
|
|
1280
|
+
style?: Record<string, any>;
|
|
1281
|
+
/** Default style merged into every ChoiceItem */
|
|
1282
|
+
itemStyle?: Record<string, any>;
|
|
1283
|
+
/** Style merged into selected ChoiceItems */
|
|
1284
|
+
selectedItemStyle?: Record<string, any>;
|
|
1285
|
+
/** Default style for every selection indicator */
|
|
1286
|
+
indicatorStyle?: Record<string, any>;
|
|
1287
|
+
/** Style merged into selected indicators */
|
|
1288
|
+
selectedIndicatorStyle?: Record<string, any>;
|
|
1289
|
+
/** Checked mark used by multiple mode; defaults to built-in `check_bold` */
|
|
1290
|
+
checkedIcon?: ChoiceIndicatorIcon;
|
|
1291
|
+
}
|
|
1292
|
+
interface ChoiceIndicatorIcon {
|
|
1293
|
+
/** Built-in icon name or fallback text/emoji */
|
|
1294
|
+
name?: string;
|
|
1295
|
+
/** External image URL; takes precedence over name */
|
|
1296
|
+
src?: string;
|
|
1297
|
+
/** Icon size in px */
|
|
1298
|
+
size?: number;
|
|
1299
|
+
/** Built-in SVG color */
|
|
1300
|
+
color?: string;
|
|
1301
|
+
}
|
|
1302
|
+
interface ChoiceItemProps {
|
|
1303
|
+
/** Unique selection value within the direct parent ChoiceList */
|
|
1304
|
+
value: string;
|
|
1305
|
+
/** Disable this item and all slotted interactions */
|
|
1306
|
+
disabled?: boolean;
|
|
1307
|
+
/** Accessible item label; falls back to value */
|
|
1308
|
+
ariaLabel?: string;
|
|
1309
|
+
/** Item shell style */
|
|
992
1310
|
style?: Record<string, any>;
|
|
1311
|
+
/** Style merged while selected */
|
|
1312
|
+
selectedStyle?: Record<string, any>;
|
|
1313
|
+
/** Per-item indicator style */
|
|
1314
|
+
indicatorStyle?: Record<string, any>;
|
|
1315
|
+
/** Per-item selected indicator style */
|
|
1316
|
+
selectedIndicatorStyle?: Record<string, any>;
|
|
1317
|
+
/** Per-item checked mark override */
|
|
1318
|
+
checkedIcon?: ChoiceIndicatorIcon;
|
|
993
1319
|
}
|
|
994
1320
|
interface PasscodeInputProps {
|
|
995
1321
|
/** Number of passcode cells (default 6, max 10) */
|
|
@@ -1028,16 +1354,45 @@ interface FormField {
|
|
|
1028
1354
|
placeholder?: string;
|
|
1029
1355
|
/** Whether the field is required */
|
|
1030
1356
|
required?: boolean;
|
|
1357
|
+
/** Declarative validation rules, evaluated in array order */
|
|
1358
|
+
rules?: FormRule[];
|
|
1359
|
+
/** Static content rendered before text-like fields */
|
|
1360
|
+
prefix?: InputAffix;
|
|
1361
|
+
/** Static content rendered after text-like fields */
|
|
1362
|
+
suffix?: InputAffix;
|
|
1031
1363
|
/** Options for select type */
|
|
1032
1364
|
options?: {
|
|
1033
1365
|
label: string;
|
|
1034
1366
|
value: string;
|
|
1367
|
+
disabled?: boolean;
|
|
1035
1368
|
}[];
|
|
1369
|
+
/** Style forwarded to Select trigger or Rate wrapper; currently ignored by other field types */
|
|
1370
|
+
style?: Record<string, any>;
|
|
1371
|
+
/** Select size preset */
|
|
1372
|
+
size?: SelectSize;
|
|
1373
|
+
/** Select trigger appearance preset */
|
|
1374
|
+
variant?: SelectVariant;
|
|
1375
|
+
/** Select focus and selection accent */
|
|
1376
|
+
accentColor?: string;
|
|
1377
|
+
/** Advanced semantic styles for select fields */
|
|
1378
|
+
styles?: SelectStyles;
|
|
1036
1379
|
/** Number of cells for passcode type (default 6) */
|
|
1037
1380
|
length?: number;
|
|
1038
1381
|
/** Initial value */
|
|
1039
1382
|
defaultValue?: any;
|
|
1040
1383
|
}
|
|
1384
|
+
interface FormRule {
|
|
1385
|
+
/** Whether an empty value is invalid */
|
|
1386
|
+
required?: boolean;
|
|
1387
|
+
/** Regular expression source used to validate the string value */
|
|
1388
|
+
pattern?: string;
|
|
1389
|
+
/** Minimum string length */
|
|
1390
|
+
minLength?: number;
|
|
1391
|
+
/** Maximum string length */
|
|
1392
|
+
maxLength?: number;
|
|
1393
|
+
/** Error message shown when this rule fails */
|
|
1394
|
+
message?: string;
|
|
1395
|
+
}
|
|
1041
1396
|
interface FormProps {
|
|
1042
1397
|
/** Form field definitions */
|
|
1043
1398
|
fields?: FormField[];
|
|
@@ -1045,9 +1400,13 @@ interface FormProps {
|
|
|
1045
1400
|
submitText?: string;
|
|
1046
1401
|
/** Form layout direction (default 'vertical') */
|
|
1047
1402
|
layout?: 'vertical' | 'horizontal';
|
|
1048
|
-
/**
|
|
1403
|
+
/** Disables submission and Select/Rate interaction; native fields stop syncing but remain editable */
|
|
1049
1404
|
disabled?: boolean;
|
|
1050
|
-
/**
|
|
1405
|
+
/** Style merged into invalid field controls */
|
|
1406
|
+
invalidStyle?: Record<string, any>;
|
|
1407
|
+
/** Style applied to validation messages */
|
|
1408
|
+
errorStyle?: Record<string, any>;
|
|
1409
|
+
/** Inline style applied to the inner form wrapper */
|
|
1051
1410
|
style?: Record<string, any>;
|
|
1052
1411
|
}
|
|
1053
1412
|
interface LoadingProps {
|
|
@@ -1143,6 +1502,8 @@ interface StepsProps {
|
|
|
1143
1502
|
items?: StepItem[];
|
|
1144
1503
|
/** Global icon size in px (default 28) */
|
|
1145
1504
|
iconSize?: number;
|
|
1505
|
+
/** Title and description layout within each step (default vertical) */
|
|
1506
|
+
textLayout?: 'vertical' | 'horizontal';
|
|
1146
1507
|
/** Title text style overrides */
|
|
1147
1508
|
titleProps?: {
|
|
1148
1509
|
fontSize?: string;
|
|
@@ -1219,6 +1580,7 @@ declare class CardProgress extends BaseElement {
|
|
|
1219
1580
|
* { "title": "Final review", "status": "pending" }
|
|
1220
1581
|
* ],
|
|
1221
1582
|
* "iconSize": 28,
|
|
1583
|
+
* "textLayout": "vertical",
|
|
1222
1584
|
* "titleProps": { "fontSize": "14px", "fontWeight": 500, "color": "#1a1a1a" },
|
|
1223
1585
|
* "descriptionProps": { "fontSize": "12px", "color": "#8c8c8c" },
|
|
1224
1586
|
* "connector": { "width": 2, "minHeight": 24, "style": "solid", "color": "#e8e8e8", "completedColor": "#52c41a" }
|
|
@@ -1324,6 +1686,70 @@ declare class CardHtml extends BaseElement {
|
|
|
1324
1686
|
protected render(): void;
|
|
1325
1687
|
}
|
|
1326
1688
|
|
|
1689
|
+
declare class CardSwitch extends BaseElement {
|
|
1690
|
+
static readonly is = "ai-card-switch";
|
|
1691
|
+
private _currentChecked;
|
|
1692
|
+
protected render(): void;
|
|
1693
|
+
updateProps(props: Record<string, any>, isMobile?: boolean): void;
|
|
1694
|
+
private commit;
|
|
1695
|
+
private escapeAttr;
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
declare class CardChoiceList extends BaseElement {
|
|
1699
|
+
static readonly is = "ai-card-choice-list";
|
|
1700
|
+
private _currentValue;
|
|
1701
|
+
private readonly _onChoiceRequest;
|
|
1702
|
+
private readonly _onChoiceNavigate;
|
|
1703
|
+
protected render(): void;
|
|
1704
|
+
updateProps(props: Record<string, any>, isMobile?: boolean): void;
|
|
1705
|
+
private commitRequest;
|
|
1706
|
+
private syncItems;
|
|
1707
|
+
private navigateFrom;
|
|
1708
|
+
private get mode();
|
|
1709
|
+
private get currentValue();
|
|
1710
|
+
private get values();
|
|
1711
|
+
private get maxSelected();
|
|
1712
|
+
private normalizeValue;
|
|
1713
|
+
private cloneValue;
|
|
1714
|
+
private escapeAttr;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
interface IconRenderInput {
|
|
1718
|
+
name?: unknown;
|
|
1719
|
+
src?: unknown;
|
|
1720
|
+
size?: unknown;
|
|
1721
|
+
color?: unknown;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
interface ChoiceItemSelectionContext {
|
|
1725
|
+
selectionMode: 'single' | 'multiple';
|
|
1726
|
+
variant: 'plain' | 'outlined';
|
|
1727
|
+
selected: boolean;
|
|
1728
|
+
listDisabled: boolean;
|
|
1729
|
+
listReadonly: boolean;
|
|
1730
|
+
selectionBlocked: boolean;
|
|
1731
|
+
tabIndex: 0 | -1;
|
|
1732
|
+
indicatorPosition: 'start' | 'end';
|
|
1733
|
+
itemStyle?: Record<string, any>;
|
|
1734
|
+
selectedItemStyle?: Record<string, any>;
|
|
1735
|
+
indicatorStyle?: Record<string, any>;
|
|
1736
|
+
selectedIndicatorStyle?: Record<string, any>;
|
|
1737
|
+
checkedIcon?: IconRenderInput;
|
|
1738
|
+
}
|
|
1739
|
+
declare class CardChoiceItem extends BaseElement {
|
|
1740
|
+
static readonly is = "ai-card-choice-item";
|
|
1741
|
+
private _context;
|
|
1742
|
+
get value(): string;
|
|
1743
|
+
get itemDisabled(): boolean;
|
|
1744
|
+
setSelectionContext(context: ChoiceItemSelectionContext): void;
|
|
1745
|
+
focusIndicator(): void;
|
|
1746
|
+
protected render(): void;
|
|
1747
|
+
private renderIndicator;
|
|
1748
|
+
private requestChange;
|
|
1749
|
+
private hasInteractiveTarget;
|
|
1750
|
+
private escapeAttr;
|
|
1751
|
+
}
|
|
1752
|
+
|
|
1327
1753
|
/**
|
|
1328
1754
|
* Component Renderer Registry — maps schema `type` to render functions.
|
|
1329
1755
|
*
|
|
@@ -1349,5 +1775,5 @@ declare const componentRenderers: Record<string, ComponentRenderer>;
|
|
|
1349
1775
|
*/
|
|
1350
1776
|
declare function registerComponent(type: string, renderer: ComponentRenderer): void;
|
|
1351
1777
|
|
|
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 };
|
|
1778
|
+
export { BaseElement, BotSDK, CardButton, CardChoiceItem, CardChoiceList, CardCollapse, CardCounter, CardDivider, CardForm, CardHtml, CardIcon, CardImage, CardInput, CardLoading, CardPasscodeInput, CardProgress, CardRate, CardSelect, CardSteps, CardSwitch, CardTag, CardText, LocalActionConfigProvider, RemoteActionConfigProvider, buildStyleString, componentRenderers, connectSSE, connectStreaming, createWebActionContext, isMobileViewport, onViewportChange, pxToRem, pxToVw, registerComponent, renderCard, renderStreamingCard, resolveSize, sanitizeHtml, trimIncompleteTag };
|
|
1779
|
+
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, SSEConnectOptions, SelectOption, SelectProps, SelectSize, SelectStyles, SelectVariant, StepIcon, StepItem, StepsProps, StreamingCardInstance, StreamingCardOptions, StreamingConnectOptions, StreamingConnection, SwitchProps, TagProps, TextProps, WebActionContextOptions };
|