-
Notifications
You must be signed in to change notification settings - Fork 1
feat(pds-multiselect): add pds-multiselect component #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for pine-design-system ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
bed416c to
dbde123
Compare
This reverts commit 7b424b8.
16bcbf6 to
85c020a
Compare
|
@coderabbitai review this pr |
|
✅ Actions performedReview triggered.
|
📝 WalkthroughWalkthroughThis pull request introduces a new pds-multiselect web component to the design system. The addition includes a complete Stencil-based component implementation with multi-select functionality, search capability, async data loading support, keyboard navigation, and form integration. Supporting artifacts include TypeScript interfaces, SCSS styling, comprehensive documentation, Storybook stories, and unit tests. ESLint configurations are updated to adjust rule severity and file patterns. Type declarations are extended to expose the component and its event interfaces. A React proxy is added to enable usage in React applications. Form documentation is updated to demonstrate the new component in context. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🤖 Fix all issues with AI agents
In `@libs/core/.lintstagedrc.json`:
- Around line 5-6: You removed js/jsx from the lint-staged glob ("*.{ts,tsx}")
which means Storybook files like IconCopyComponent.jsx will no longer be linted;
either confirm this is intentional or restore linting by updating the
lint-staged config to include jsx (e.g. add js and jsx back to the glob) or add
an explicit pattern that covers story files (e.g. include
"*.stories.{js,jsx,ts,tsx}" or the specific story path), and update the
.lintstagedrc.json entry accordingly so IconCopyComponent.jsx is linted on
commit if desired.
In `@libs/core/src/components/pds-multiselect/pds-multiselect.tsx`:
- Around line 32-35: Search-triggered asyncUrl fetches must be debounced using
the component's debounceMs prop: create a debounced wrapper (e.g.,
debouncedFetchAsyncOptions) that delays calling the existing async fetch routine
and call that wrapper from the search input handler instead of invoking the
fetch directly; reuse and cancel the AbortController before each real fetch to
abort in-flight requests, ensure the debounced timer is cleared and the
controller is aborted in cleanupAutoUpdate/disconnectedCallback, and apply the
same debounced wrapper to the other fetch call sites referenced (around the
blocks at ~214-218 and ~470-482) so all asyncUrl requests honor debounceMs.
- Around line 824-867: The trigger button's ARIA attributes only consider
this.invalid, so when this.errorMessage is present but this.invalid is false the
UI looks invalid but aria-invalid and aria-describedby don't reference the
error; update the trigger's attributes to consider errorMessage as well: change
aria-invalid to use (this.invalid || !!this.errorMessage) and call
assignDescription with the same boolean (assignDescription(this.componentId,
this.invalid || !!this.errorMessage, this.errorMessage || this.helperMessage))
so the error element is always referenced and aria-invalid reflects the visible
error; update references in the render() for the trigger button where
aria-invalid and aria-describedby are set.
🧹 Nitpick comments (2)
libs/core/.eslintrc.json (1)
10-15: Consider keepingno-unused-varsas an error.Downgrading from
"error"to"warn"allows unused variables to accumulate in the codebase without blocking commits. If this change was made to accommodate specific cases in the new component, consider using ESLint disable comments for those specific lines instead of globally relaxing the rule.libs/core/src/components/pds-multiselect/test/pds-multiselect.spec.tsx (1)
309-436: Consider adding Space key test.The keyboard navigation tests comprehensively cover Escape, ArrowDown, ArrowUp, Enter, and Tab keys. However, the PR description mentions Space key support for selection. Consider adding a test case for Space key behavior to ensure complete coverage.
📝 Suggested test for Space key
it('selects highlighted option on Space key', async () => { const page = await newSpecPage({ components: [PdsMultiselect], html: `<pds-multiselect component-id="test"></pds-multiselect>`, }); const changeSpy = jest.fn(); page.root.addEventListener('pdsMultiselectChange', changeSpy); page.rootInstance.internalOptions = [ { id: '1', text: 'Option 1' }, { id: '2', text: 'Option 2' }, ]; page.rootInstance.isOpen = true; page.rootInstance.highlightedIndex = 0; await page.waitForChanges(); const event = new KeyboardEvent('keydown', { key: ' ' }); Object.defineProperty(event, 'preventDefault', { value: jest.fn() }); page.rootInstance.handleSearchInputKeyDown(event); await page.waitForChanges(); expect(changeSpy).toHaveBeenCalled(); expect(changeSpy.mock.calls[0][0].detail.values).toContain('1'); });
pixelflips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, mostly on unexpected file changes and small consistency fixes to prop descriptions.
This is great work!
pixelflips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small nitpicks around prop names and descriptions, and a couple of styling things. Functionally seems to be working great.
libs/core/src/components/pds-multiselect/stories/pds-multiselect.stories.js
Outdated
Show resolved
Hide resolved
libs/core/src/components/pds-multiselect/stories/pds-multiselect.stories.js
Outdated
Show resolved
Hide resolved
8f49f55 to
6e07ec1
Compare
pixelflips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Great work!
Description
Adds a new
pds-multiselectcomponent - a Select2-style pillbox multiselect with typeahead search, checkbox options, and async data support.Features
Type of change
Fixes DSS-87
Usage
ERB (Static Options)
ERB (Async URL)
React
How Has This Been Tested?
Comprehensive spec tests cover:
Test Configuration:
Checklist: