Skip to content

Commit dcf5f6f

Browse files
ByronDWalljaikamatvaloriecarli
authored
CRAFT-1822 | combobox refactor (#630)
* feat(combobox refactor): generate refactor plan * feat(combobox refactor): update refactor plan * feat(combobox refactor): implement refactor of components except for their styling * feat(combobox refactor): single select selects and filters, context and collection are now being set in a usable way * feat(combobox): keyboard interactions now work as expected, multiselect is working with tag group, filtering is working - basic functionality using single context achieved * feat(combobox refactor): at this point, the functionality and styling are looking good, still needs testing, etc tho * feat(combobox refactor): ensure async and creatable options work correctly and add a few basic tests, add a set of custom filters for use with combobox and test them, update comments and documentation, update testing plan, update readme, etc * feat(combobox refactor): clear button conditionally renders, and some other stuff * chore(changeset): add changeset * feat(combobox context): clear react-aria contexts in combobox so that child components in trigger do not receive external values * chore(nimbus): `ComboBox` unit tests and bugfixes (#818) * chore(nimbus): combobox - layout structure tests * chore(nimbus): combobox - multi-select tag display tests * chore(nimbus): combobox - input field behavior tests * chore(nimbus): combobox - button visibility and behavior tests * chore(nimbus): combobox - focus behavior tests * chore(nimbus): notes * chore(nimbus): combobox - keyboard navigation tests * chore(nimbus): combobox - menu opening and closing tests * chore(nimbus): combobox - option selection tests * chore(nimbus): combobox - clear button functionality tests * chore(nimbus): combobox - multi and single select behavior tests * chore(nimbus): combobox - selection persistence tests * chore(nimbus): combobox - basic text filtering tests * chore(nimbus): combobox - custom filter tests * chore(nimbus): combobox - empty state handling tests * chore(nimbus): combobox - basic custom option creation tests * chore(nimbus): combobox - single select creation tests * chore(nimbus): combobox - a11y keyboard tests * chore(nimbus): combobox - a11y relationship tests * chore(nimbus): combobox - visual variant tests * chore(nimbus): combobox - state visual tests * chore(docs): remove temporary testing plan file * chore(combobox): revisions * feat(combobox option): options in listbox don't focus on hover * chore(combobox): add test for modal integration * chore(dialog): squelch button context for children * Revert "chore(dialog): squelch button context for children" This reverts commit af7f799. * chore(combobox): edit tests after rebase * chore(combobox): await in test, fix --------- Co-authored-by: Byron Wall <[email protected]> * chore(docs): adjust code examples * chore: update pnpm-lock.yaml after rebase --------- Co-authored-by: Jai Kamat <[email protected]> Co-authored-by: Valorie <[email protected]>
1 parent 24383d3 commit dcf5f6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+12132
-4059
lines changed

.changeset/salty-meals-bet.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@commercetools/nimbus": minor
3+
"@commercetools/nimbus-i18n": minor
4+
---
5+
6+
Update Combobox to new context-based architecture and add missing features,
7+
update i18n strings.

.claude/agents/nimbus-researcher.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: nimbus-researcher
3-
description: Use this agent when you need to gather information, find documentation, explore technical concepts, or research solutions to problems. This includes searching for library documentation, API references, best practices, code examples, or general web information. The agent will use context7 for library documentation and web search for broader research needs.\n\nExamples:\n<example>\nContext: User needs to understand how to implement a specific React Aria pattern\nuser: "How do I implement an accessible combobox with React Aria?"\nassistant: "I'll use the research-analyst agent to find the React Aria documentation for combobox implementation."\n<commentary>\nSince the user needs documentation about a library feature, use the research-analyst agent to search context7 for React Aria combobox documentation.\n</commentary>\n</example>\n<example>\nContext: User wants to understand a technical concept before implementation\nuser: "What are the best practices for implementing compound components in React?"\nassistant: "Let me use the research-analyst agent to research compound component patterns and best practices."\n<commentary>\nThe user needs research on design patterns and best practices, so the research-analyst agent should gather this information from various sources.\n</commentary>\n</example>\n<example>\nContext: User encounters an error and needs to understand the cause\nuser: "I'm getting a 'Cannot read properties of undefined' error in my Chakra UI recipe"\nassistant: "I'll use the research-analyst agent to research this error in the context of Chakra UI recipes."\n<commentary>\nDebugging requires understanding the error context, so use the research-analyst agent to find relevant documentation and solutions.\n</commentary>\n</example>
3+
description: Use this agent when you need to gather information, find documentation, explore technical concepts, or research solutions to problems. This includes searching for library documentation, API references, best practices, code examples, or general web information. The agent will use the react-aria-docs mcp for react-aria specific documentation and research needs. The agent will use context7 for library documentation and web search for broader research needs. \n\nExamples:\n<example>\nContext: User needs to understand how to implement a specific React Aria pattern\nuser: "How do I implement an accessible combobox with React Aria?"\nassistant: "I'll use the research-analyst agent to find the React Aria documentation for combobox implementation."\n<commentary>\nSince the user needs documentation about a library feature, use the research-analyst agent to search react-aria-docs and context7 for React Aria combobox documentation.\n</commentary>\n</example>\n<example>\nContext: User wants to understand a technical concept before implementation\nuser: "What are the best practices for implementing compound components in React?"\nassistant: "Let me use the research-analyst agent to research compound component patterns and best practices."\n<commentary>\nThe user needs research on design patterns and best practices, so the research-analyst agent should gather this information from various sources.\n</commentary>\n</example>\n<example>\nContext: User encounters an error and needs to understand the cause\nuser: "I'm getting a 'Cannot read properties of undefined' error in my Chakra UI recipe"\nassistant: "I'll use the research-analyst agent to research this error in the context of Chakra UI recipes."\n<commentary>\nDebugging requires understanding the error context, so use the research-analyst agent to find relevant documentation and solutions.\n</commentary>\n</example>
44
model: sonnet
55
---
66

@@ -34,6 +34,9 @@ You will:
3434

3535
- Use `mcp__context7__resolve-library-id` to search for specific library
3636
documentation
37+
- Prefer `mcp__react-aria-docs__list_pages`,
38+
`mcp__react-aria-docs__get_page_info`, and `mcp__react-aria-docs__get_page`
39+
when searching for react-aria library documentation
3740
- Focus on official documentation for React Aria, Chakra UI, React, TypeScript,
3841
and related libraries
3942
- Look for code examples, API references, and implementation patterns

.mcp.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
"time-mcp": {
1616
"command": "npx",
1717
"args": ["-y", "time-mcp"]
18+
},
19+
"react-aria-docs": {
20+
"type": "stdio",
21+
"command": "npx",
22+
"args": ["@react-spectrum/mcp", "react-aria"],
23+
"env": {}
1824
}
1925
}
2026
}

apps/docs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"react-dom": "catalog:react",
4444
"react-intl": "catalog:react",
4545
"react-live": "^4.1.7",
46+
"react-stately": "catalog:react",
4647
"react-router": "^7.12.0",
4748
"react-router-dom": "^7.11.0",
4849
"react-syntax-highlighter": "^15.6.6",
@@ -52,6 +53,7 @@
5253
"remark-mark-highlight": "^0.1.1",
5354
"slug": "^11.0.1",
5455
"to-vfile": "^8.0.0",
56+
"use-debounce": "^10.0.0",
5557
"vite-plugin-markdown": "^2.2.0",
5658
"vite-tsconfig-paths": "^5.1.3",
5759
"zod": "^4.1.12"

apps/docs/src/components/document-renderer/components/live-code-editor/live-code-editor.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {
1313
getLocalTimeZone,
1414
today,
1515
} from "@internationalized/date";
16+
import { useAsyncList } from "react-stately";
17+
import { useDebouncedCallback } from "use-debounce";
1618

1719
const baseHooks = {
1820
useState,
@@ -33,6 +35,8 @@ const scope = {
3335
parseZonedDateTime,
3436
getLocalTimeZone,
3537
today,
38+
useAsyncList,
39+
useDebouncedCallback,
3640
};
3741

3842
const removeImportStatements = (code: string) => {

packages/nimbus/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@
5959
"react-aria-components": "catalog:react",
6060
"react-hotkeys-hook": "^5.2.1",
6161
"react-stately": "catalog:react",
62-
"react-use": "^17.5.1"
62+
"react-use": "^17.5.1",
63+
"use-debounce": "^10.0.0"
6364
},
6465
"devDependencies": {
6566
"@chakra-ui/cli": "catalog:react",
@@ -68,6 +69,7 @@
6869
"@commercetools/nimbus-tokens": "workspace:^",
6970
"@internationalized/date": "catalog:react",
7071
"@react-aria/optimize-locales-plugin": "catalog:react",
72+
"@react-types/shared": "catalog:tooling",
7173
"@storybook/addon-a11y": "catalog:tooling",
7274
"@storybook/addon-docs": "catalog:tooling",
7375
"@storybook/addon-vitest": "catalog:tooling",

packages/nimbus/src/components/calendar/components/calendar.header.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export const CalendarHeader = () => {
3232
<VisuallyHidden>
3333
<Heading />
3434
</VisuallyHidden>
35-
{/* @ts-expect-error - custom-context will add aria-label via the "slot" prop */}
3635
<IconButton
3736
slot={showRangeLabel ? "previous" : "previous-month"}
3837
size="xs"
@@ -50,7 +49,6 @@ export const CalendarHeader = () => {
5049
aria-hidden="true"
5150
slot={showRangeLabel ? "monthRange" : "month"}
5251
/>
53-
{/* @ts-expect-error - custom-context will add aria-label via the "slot" prop */}
5452
<IconButton
5553
slot={showRangeLabel ? "next" : "next-month"}
5654
size="xs"
@@ -62,7 +60,6 @@ export const CalendarHeader = () => {
6260
</Stack>
6361
<Box flexGrow="1" />
6462
<Stack direction="row" alignItems="center">
65-
{/* @ts-expect-error - custom-context will add aria-label via the "slot" prop */}
6663
<IconButton
6764
slot="previous-year"
6865
size="xs"
@@ -80,7 +77,6 @@ export const CalendarHeader = () => {
8077
aria-hidden="true"
8178
slot="year"
8279
/>
83-
{/* @ts-expect-error - custom-context will add aria-label via the "slot" prop */}
8480
<IconButton
8581
slot="next-year"
8682
size="xs"

0 commit comments

Comments
 (0)