@worldresources/wri-design-systems 2.211.3 → 2.212.1

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 CHANGED
@@ -134,6 +134,11 @@ type ComboboxLabels = {
134
134
  noItemsFoundLabel: ReactNodeLabel;
135
135
  /** Builds the visible text for the create-new-option row. Default: (inputValue) => `Create “${inputValue}”` */
136
136
  createOptionLabel: (inputValue: string) => ReactNodeLabel;
137
+ /**
138
+ * Visually hidden text announced while the dropdown is loading. Rendered as
139
+ * JSX child of the loading status element. Default: "Loading"
140
+ */
141
+ loadingLabel: ReactNodeLabel;
137
142
  };
138
143
  /** Labels for CloseButton internal UI strings. */
139
144
  type CloseButtonLabels = {
@@ -1237,6 +1242,17 @@ type ComboboxItem = {
1237
1242
  value: string;
1238
1243
  };
1239
1244
  type ComboboxProps = {
1245
+ /**
1246
+ * Dropdown options for both static lists and dynamically updated results.
1247
+ * Changes to the list contents replace the dropdown options.
1248
+ * @default []
1249
+ */
1250
+ items?: ComboboxItem[];
1251
+ /**
1252
+ * Legacy dropdown options, read only on mount when `items` is omitted.
1253
+ * @deprecated Pass the options through `items` instead.
1254
+ * @default []
1255
+ */
1240
1256
  initialItems?: ComboboxItem[];
1241
1257
  label?: string;
1242
1258
  required?: boolean;
@@ -1260,15 +1276,32 @@ type ComboboxProps = {
1260
1276
  /** Called with the selected values whenever the selection changes. */
1261
1277
  onChange?: (values: string[]) => void;
1262
1278
  /**
1263
- * Whether the user can create options that do not exist in `initialItems`.
1279
+ * Whether the user can create options that do not exist in the item list.
1264
1280
  * When `true`, typing a non-matching value shows a "Create …" row that adds
1265
1281
  * the entry to the list on selection.
1266
1282
  * @default false
1267
1283
  */
1268
1284
  creatable?: boolean;
1285
+ /**
1286
+ * Called with the current input text on every change, including the empty
1287
+ * string when the input resets after a selection or clear (use it to restore
1288
+ * the full list). Providing this
1289
+ * callback enables server-side filtering mode: the built-in client-side
1290
+ * filtering is skipped and the rendered list is whatever `items` currently
1291
+ * contains, so the consumer can fetch matching items and pass them back via
1292
+ * the `items` prop.
1293
+ */
1294
+ onQueryChange?: (query: string) => void;
1295
+ /**
1296
+ * Shows a loading spinner inside the dropdown and hides the "No items
1297
+ * found" empty state. Intended for server-side filtering mode while a
1298
+ * request triggered by `onQueryChange` is in flight.
1299
+ * @default false
1300
+ */
1301
+ isLoading?: boolean;
1269
1302
  };
1270
1303
 
1271
- declare const Combobox: ({ label, required, caption, errorMessage, size, disabled, showOptionalLabel, placeholder, labels, noMarginBottom, initialItems, multiple, showSelectedItems, value: controlledValue, defaultValue, onChange, creatable, }: ComboboxProps) => _emotion_react_jsx_runtime.JSX.Element;
1304
+ declare const Combobox: ({ label, required, caption, errorMessage, size, disabled, showOptionalLabel, placeholder, labels, noMarginBottom, items, initialItems, multiple, showSelectedItems, value: controlledValue, defaultValue, onChange, creatable, onQueryChange, isLoading, }: ComboboxProps) => _emotion_react_jsx_runtime.JSX.Element;
1272
1305
 
1273
1306
  type TagProps = Omit<Tag$1.RootProps, 'size' | 'variant' | 'colorPalette' | 'children'> & {
1274
1307
  label: string;