@astryxdesign/core 0.7.0-canary.f3a2181 → 0.7.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/dist/Chat/ChatComposerInput.d.ts +0 -11
  3. package/dist/Chat/ChatComposerInput.d.ts.map +1 -1
  4. package/dist/Chat/ChatComposerInput.js +0 -11
  5. package/dist/Chat/useTriggerMenu.d.ts.map +1 -1
  6. package/dist/Chat/useTriggerMenu.js +1 -1
  7. package/dist/Tokenizer/Tokenizer.d.ts +1 -12
  8. package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
  9. package/dist/Tokenizer/Tokenizer.js +1 -13
  10. package/dist/Toolbar/Toolbar.d.ts +3 -4
  11. package/dist/Toolbar/Toolbar.d.ts.map +1 -1
  12. package/dist/Toolbar/Toolbar.js +6 -6
  13. package/dist/Typeahead/BaseTypeahead.d.ts +0 -11
  14. package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
  15. package/dist/Typeahead/BaseTypeahead.js +1 -9
  16. package/dist/Typeahead/Typeahead.d.ts +1 -12
  17. package/dist/Typeahead/Typeahead.d.ts.map +1 -1
  18. package/dist/Typeahead/Typeahead.js +1 -13
  19. package/dist/hooks/useRenamedProp.d.ts +6 -6
  20. package/dist/hooks/useRenamedProp.js +6 -6
  21. package/package.json +4 -4
  22. package/src/Chat/ChatComposerInput.doc.mjs +3 -3
  23. package/src/Chat/ChatComposerInput.test.tsx +7 -55
  24. package/src/Chat/ChatComposerInput.tsx +0 -36
  25. package/src/Chat/useTriggerMenu.tsx +1 -4
  26. package/src/Tokenizer/Tokenizer.doc.mjs +0 -16
  27. package/src/Tokenizer/Tokenizer.test.tsx +12 -63
  28. package/src/Tokenizer/Tokenizer.tsx +1 -25
  29. package/src/Toolbar/Toolbar.doc.mjs +3 -3
  30. package/src/Toolbar/Toolbar.test.tsx +1 -1
  31. package/src/Toolbar/Toolbar.tsx +9 -10
  32. package/src/Typeahead/BaseTypeahead.doc.mjs +0 -16
  33. package/src/Typeahead/BaseTypeahead.test.tsx +1 -1
  34. package/src/Typeahead/BaseTypeahead.tsx +1 -21
  35. package/src/Typeahead/Typeahead.doc.mjs +0 -7
  36. package/src/Typeahead/Typeahead.test.tsx +24 -42
  37. package/src/Typeahead/Typeahead.tsx +1 -25
  38. package/src/hooks/useRenamedProp.ts +6 -6
@@ -239,7 +239,7 @@ describe('BaseTypeahead', () => {
239
239
  value={null}
240
240
  onChange={() => {}}
241
241
  debounceMs={0}
242
- emptySearchResultsText="No results found"
242
+ emptySearchText="No results found"
243
243
  />,
244
244
  );
245
245
  const input = screen.getByRole('combobox');
@@ -260,7 +260,7 @@ describe('BaseTypeahead', () => {
260
260
  value={null}
261
261
  onChange={() => {}}
262
262
  debounceMs={0}
263
- emptySearchResultsText="No results found"
263
+ emptySearchText="No results found"
264
264
  />,
265
265
  );
266
266
  const input = screen.getByRole('combobox');
@@ -2189,9 +2189,9 @@ describe('the value is bounded by the content lane', () => {
2189
2189
  });
2190
2190
 
2191
2191
  // `emptySearchResultsText` was renamed to `emptySearchText` and widened from
2192
- // `string` to `ReactNode` (`spec:AST-056` FR1). It is a released prop with a
2193
- // victim, so the replacement ships first and the old name keeps working
2194
- // through the overlap (`spec:AST-017` FR28, FR29).
2192
+ // `string` to `ReactNode` (`spec:AST-056` FR1). The overlap ended in a minor
2193
+ // release (`CLN-0001`–`CLN-0004`, `spec:AST-017` FR31): the old name is no
2194
+ // longer part of the type and is no longer read.
2195
2195
  describe('emptySearchText rename', () => {
2196
2196
  function searchForNothing() {
2197
2197
  fireEvent.change(screen.getByRole('combobox'), {
@@ -2222,8 +2222,10 @@ describe('emptySearchText rename', () => {
2222
2222
  });
2223
2223
  });
2224
2224
 
2225
- it('keeps the deprecated name working, and says it is deprecated', async () => {
2225
+ it('no longer reads the removed emptySearchResultsText (CLN-0002)', async () => {
2226
2226
  const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
2227
+ // The unknown prop reaches the root element, which React reports.
2228
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});
2227
2229
  render(
2228
2230
  <Typeahead
2229
2231
  label="Fruit"
@@ -2231,47 +2233,21 @@ describe('emptySearchText rename', () => {
2231
2233
  value={null}
2232
2234
  onChange={() => {}}
2233
2235
  debounceMs={0}
2236
+ // @ts-expect-error -- removed in the minor release (CLN-0002)
2234
2237
  emptySearchResultsText="Nothing ripe"
2235
2238
  />,
2236
2239
  );
2237
2240
  searchForNothing();
2238
2241
 
2239
2242
  await waitFor(() => {
2240
- expect(screen.getByText('Nothing ripe')).toBeInTheDocument();
2243
+ expect(screen.getByText('No results found')).toBeInTheDocument();
2241
2244
  });
2242
- expect(warn).toHaveBeenCalledWith(
2243
- expect.stringContaining(
2244
- 'Typeahead: `emptySearchResultsText` is deprecated; use `emptySearchText`',
2245
- ),
2246
- );
2247
- warn.mockRestore();
2248
- });
2249
-
2250
- it('lets the new name win when both are set, and warns', async () => {
2251
- const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
2252
- render(
2253
- <Typeahead
2254
- label="Fruit"
2255
- searchSource={fruitSource}
2256
- value={null}
2257
- onChange={() => {}}
2258
- debounceMs={0}
2259
- emptySearchResultsText="Old copy"
2260
- emptySearchText="New copy"
2261
- />,
2262
- );
2263
- searchForNothing();
2264
-
2265
- await waitFor(() => {
2266
- expect(screen.getByText('New copy')).toBeInTheDocument();
2267
- });
2268
- expect(screen.queryByText('Old copy')).not.toBeInTheDocument();
2269
- expect(warn).toHaveBeenCalledWith(
2270
- expect.stringContaining(
2271
- 'Typeahead: `emptySearchResultsText` and `emptySearchText` are both set',
2272
- ),
2245
+ expect(screen.queryByText('Nothing ripe')).not.toBeInTheDocument();
2246
+ expect(warn).not.toHaveBeenCalledWith(
2247
+ expect.stringContaining('is deprecated'),
2273
2248
  );
2274
2249
  warn.mockRestore();
2250
+ error.mockRestore();
2275
2251
  });
2276
2252
  });
2277
2253
 
@@ -2301,14 +2277,16 @@ describe('emptySearchText rename', () => {
2301
2277
  });
2302
2278
  });
2303
2279
 
2304
- it('announces the deprecated name unchanged', async () => {
2305
- const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
2280
+ it('no longer announces the removed emptySearchResultsText (CLN-0003)', async () => {
2281
+ // The unknown prop reaches the root element, which React reports.
2282
+ const error = vi.spyOn(console, 'error').mockImplementation(() => {});
2306
2283
  render(
2307
2284
  <BaseTypeahead
2308
2285
  searchSource={fruitSource}
2309
2286
  value={null}
2310
2287
  onChange={() => {}}
2311
2288
  debounceMs={0}
2289
+ // @ts-expect-error -- removed in the minor release (CLN-0003)
2312
2290
  emptySearchResultsText="Nothing ripe"
2313
2291
  />,
2314
2292
  );
@@ -2317,9 +2295,13 @@ describe('emptySearchText rename', () => {
2317
2295
  await waitFor(() => {
2318
2296
  expect(
2319
2297
  document.querySelector('[data-astryx-live-region="polite"]'),
2320
- ).toHaveTextContent('Nothing ripe');
2298
+ ).toHaveTextContent('No results found');
2321
2299
  });
2322
- warn.mockRestore();
2300
+ expect(
2301
+ document.querySelector('[data-astryx-live-region="polite"]')
2302
+ ?.textContent,
2303
+ ).not.toContain('Nothing ripe');
2304
+ error.mockRestore();
2323
2305
  });
2324
2306
  });
2325
2307
  });
@@ -70,7 +70,6 @@ import {themeProps} from '../utils/themeProps';
70
70
  import {useTranslator} from '../i18n';
71
71
 
72
72
  import {useMergedRefs} from '../hooks/useMergedRefs';
73
- import {useRenamedProp} from '../hooks/useRenamedProp';
74
73
  export type {
75
74
  InputStatus as TypeaheadStatus,
76
75
  InputStatusType as TypeaheadStatusType,
@@ -160,18 +159,6 @@ export interface TypeaheadProps<T extends SearchableItem> extends Omit<
160
159
  * @default 'No results found'
161
160
  */
162
161
  emptySearchText?: ReactNode;
163
-
164
- /**
165
- * Text shown when no results found.
166
- * @default 'No results found'
167
- * @deprecated `DEP-0002`. Renamed to `emptySearchText`, which takes a
168
- * `ReactNode` rather than a `string` — every existing value stays valid
169
- * (`spec:AST-056` FR1, FR7). Still works exactly as released;
170
- * `emptySearchText` wins when both are set. Removal is `CLN-0002`, in a
171
- * later minor whose frozen manifest carries both ids (`spec:AST-017`
172
- * FR31).
173
- */
174
- emptySearchResultsText?: string;
175
162
  /** Whether the input is disabled. @default false */
176
163
  isDisabled?: boolean;
177
164
  /**
@@ -399,8 +386,7 @@ export function Typeahead<T extends SearchableItem>({
399
386
  hasEntriesOnFocus,
400
387
  maxMenuItems,
401
388
  minQueryLength,
402
- emptySearchResultsText,
403
- emptySearchText: emptySearchTextFromProps,
389
+ emptySearchText,
404
390
  isDisabled = false,
405
391
  disabledMessage,
406
392
  hasClear = true,
@@ -435,16 +421,6 @@ export function Typeahead<T extends SearchableItem>({
435
421
  const statusMessageId = useId();
436
422
  const inputGroup = useInputGroup();
437
423
 
438
- // The replacement wins, the released name keeps working, and development
439
- // says which one was read (`spec:AST-056` FR7, `spec:AST-017` FR28).
440
- const emptySearchText = useRenamedProp<ReactNode>({
441
- component: 'Typeahead',
442
- deprecated: 'emptySearchResultsText',
443
- deprecatedValue: emptySearchResultsText,
444
- replacement: 'emptySearchText',
445
- value: emptySearchTextFromProps,
446
- });
447
-
448
424
  const wrapperRef = useRef<HTMLDivElement>(null);
449
425
  const inputRef = useRef<HTMLInputElement>(null);
450
426
  const tokenRef = useRef<HTMLElement>(null);
@@ -56,12 +56,12 @@ export interface RenamedPropOptions<T> {
56
56
  *
57
57
  * @example
58
58
  * ```
59
- * const emptySearchText = useRenamedProp({
60
- * component: 'Tokenizer',
61
- * deprecated: 'emptySearchResultsText',
62
- * deprecatedValue: emptySearchResultsText,
63
- * replacement: 'emptySearchText',
64
- * value: emptySearchTextFromProps,
59
+ * const label = useRenamedProp({
60
+ * component: 'Example',
61
+ * deprecated: 'oldLabel',
62
+ * deprecatedValue: oldLabel,
63
+ * replacement: 'label',
64
+ * value: labelFromProps,
65
65
  * });
66
66
  * ```
67
67
  */