( props: Props<Option, IsMulti, Group>, selectValue: Options<Option> )
| 396 | } |
| 397 | |
| 398 | function buildCategorizedOptions< |
| 399 | Option, |
| 400 | IsMulti extends boolean, |
| 401 | Group extends GroupBase<Option> |
| 402 | >( |
| 403 | props: Props<Option, IsMulti, Group>, |
| 404 | selectValue: Options<Option> |
| 405 | ): CategorizedGroupOrOption<Option, Group>[] { |
| 406 | return props.options |
| 407 | .map((groupOrOption, groupOrOptionIndex) => { |
| 408 | if ('options' in groupOrOption) { |
| 409 | const categorizedOptions = groupOrOption.options |
| 410 | .map((option, optionIndex) => |
| 411 | toCategorizedOption(props, option, selectValue, optionIndex) |
| 412 | ) |
| 413 | .filter((categorizedOption) => isFocusable(props, categorizedOption)); |
| 414 | return categorizedOptions.length > 0 |
| 415 | ? { |
| 416 | type: 'group' as const, |
| 417 | data: groupOrOption, |
| 418 | options: categorizedOptions, |
| 419 | index: groupOrOptionIndex, |
| 420 | } |
| 421 | : undefined; |
| 422 | } |
| 423 | const categorizedOption = toCategorizedOption( |
| 424 | props, |
| 425 | groupOrOption, |
| 426 | selectValue, |
| 427 | groupOrOptionIndex |
| 428 | ); |
| 429 | return isFocusable(props, categorizedOption) |
| 430 | ? categorizedOption |
| 431 | : undefined; |
| 432 | }) |
| 433 | .filter(notNullish); |
| 434 | } |
| 435 | |
| 436 | function buildFocusableOptionsFromCategorizedOptions< |
| 437 | Option, |
no test coverage detected
searching dependent graphs…