8000 feat: update version to 2.1.0 and add action prop to AsyncSearchableS… by iamraihan · Pull Request #133 · getdokan/dokan-ui · GitHub
[go: up one dir, main page]

Skip to content

feat: update version to 2.1.0 and add action prop to AsyncSearchableS… - #133

Merged
shams-sadek1981 merged 1 commit into
developfrom
feat/asyncsearch-component-action-node
Feb 24, 2026
Merged

shams-sadek1981 merged 1 commit into
developfrom
feat/asyncsearch-component-action-node

Conversation

@iamraihan
@iamraihan iamraihan commented Feb 24, 2026 •
Copy link
Copy Markdown
Contributor

…elect component

Summary by CodeRabbit

  • New Features

    • Added optional action element capability to the async searchable select component, allowing interactive controls to be positioned adjacent to the label for enhanced user workflows.
  • Chores

    • Version bumped to 2.1.0

@coderabbitai
coderabbitai Bot commented Feb 24, 2026 •
Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR bumps the package version to 2.1.0 and introduces a new optional action prop to the AsyncSearchableSelect component. The component now supports rendering an action element (like a button) alongside the label using a horizontal flex layout. A corresponding story variant demonstrates this functionality.

Changes

Cohort / File(s) Summary
Version Update
package.json
Bumped package version from 2.0.6 to 2.1.0.
Action Prop Addition
src/components/AsyncSearchableSelect.tsx
Added optional action?: React.ReactNode prop to AsyncSearchableSelectProps. Restructured label rendering with a flex container to position the action element to the right of the label.
Story Variant
src/stories/AsyncSearchableSelect.stories.tsx
Added new WithAction story demonstrating the action prop with a clickable "+ Add New" button that triggers an alert.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #115: Modifies AsyncSearchableSelect.tsx component rendering and layout logic
  • PR #116: Updates AsyncSearchableSelectProps with additional prop configurations

Suggested labels

Status: Needs Dev Review

Suggested reviewers

  • arafatkn
  • tanmaymishu

Poem

🐰 A new action blooms beside the label's nest,
With flex layout magic making UI requests,
The button stands ready, "+ Add New" so bright,
Version 2.1.0 takes flight! ✨
Stories tell tales of this feature so right 📖

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: version bump to 2.1.0 and adding an action prop to AsyncSearchableSelect component.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/asyncsearch-component-action-node

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/components/AsyncSearchableSelect.tsx (1)

1-24: Prefer a type-only React import for ReactNode.
This avoids a value import that’s only needed for types.

♻️ Suggested change
-import React from 'react';
+import type { ReactNode } from 'react';
@@
-  action?: React.ReactNode;
+  action?: ReactNode;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/AsyncSearchableSelect.tsx` around lines 1 - 24, The code
imports the entire React namespace but only uses the ReactNode type for the
'action' prop in AsyncSearchableSelectProps; switch to a type-only import:
replace the top-level "import React from 'react';" with "import type { ReactNode
} from 'react';" and update the prop type declaration from "action?:
React.ReactNode" to "action?: ReactNode" (adjust any other React.* type uses
similarly) so the runtime doesn't import an unused React value.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/stories/AsyncSearchableSelect.stories.tsx`:
- Around line 112-126: In the WithAction story object replace the invalid prop
key MenuPortal with the correct react-select prop menuPosition set to 'fixed'
(remove MenuPortal entry and add menuPosition: 'fixed' inside the args for the
WithAction Story) while keeping menuPortalTarget as-is; update the args in the
WithAction Story definition to use menuPosition so the select uses fixed
positioning.

---

Nitpick comments:
In `@src/components/AsyncSearchableSelect.tsx`:
- Around line 1-24: The code imports the entire React namespace but only uses
the ReactNode type for the 'action' prop in AsyncSearchableSelectProps; switch
to a type-only import: replace the top-level "import React from 'react';" with
"import type { ReactNode } from 'react';" and update the prop type declaration
from "action?: React.ReactNode" to "action?: ReactNode" (adjust any other
React.* type uses similarly) so the runtime doesn't import an unused React
value.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 58a48d5 and 81058c8.

📒 Files selected for processing (3)
  • package.json
  • src/components/AsyncSearchableSelect.tsx
  • src/stories/AsyncSearchableSelect.stories.tsx

Comment on lines +112 to +126
export const WithAction: Story = {
args: {
className: 8000 '',
defaultOptions: [
{ label: 'Bangladesh', value: 'BD' },
{ label: 'India', value: 'IN' },
{ label: 'Pakistan', value: 'PK' },
{ label: 'Sri Lanka', value: 'SL' },
],
label: 'Countries',
helpText: 'This is a help text example',
errors: [],
required: true,
menuPortalTarget: document.body,
MenuPortal: 'fixed',
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, find and examine the AsyncSearchableSelect.stories.tsx file
find . -type f -name "AsyncSearchableSelect.stories.tsx" | head -5

Repository: getdokan/dokan-ui

Length of output: 108


🏁 Script executed:

# Also search for the AsyncSearchableSelect component definition
find . -type f \( -name "*.ts" -o -name "*.tsx" \) | xargs grep -l "AsyncSearchableSelect" | grep -v ".stories" | head -10

Repository: getdokan/dokan-ui

Length of output: 119


🌐 Web query:

react-select 5.x props MenuPortal menuPosition menuPortalTarget documentation

💡 Result:

In react-select 5.x, the relevant props are:

  • menuPortalTarget?: HTMLElement — enables portaling and sets the DOM node the menu portal mounts into (e.g. document.body). The menu uses the built-in MenuPortal component when this prop is provided. [1][3]
  • menuPosition?: "absolute" | "fixed" (default "absolute") — sets the CSS position used for the menu; "fixed" is commonly used with portals/modals to avoid clipping/scroll-container issues. [1]
  • Styling the portal wrapper: use the styles prop key menuPortal (e.g. to set zIndex). [2]

Example:

import Select from "react-select";

<Select
  menuPortalTarget={document.body}
  menuPosition="fixed"
  styles={{
    menuPortal: (base) => ({ ...base, zIndex: 9999 }),
  }}
/>;

Sources: React Select Props API (menuPortalTarget, menuPosition) [1], Styles API (menuPortal style key) [2], Components docs (MenuPortal is replaceable/customizable) [3].

[1] https://react-select-oss.netlify.app/props
[2] https://react-select-oss.netlify.app/styles
[3] https://react-select-oss.netlify.app/components


🏁 Script executed:

cat -n ./src/stories/AsyncSearchableSelect.stories.tsx | sed -n '100,130p'

Repository: getdokan/dokan-ui

Length of output: 907


🏁 Script executed:

cat ./src/components/AsyncSearchableSelect.tsx

Repository: getdokan/dokan-ui

Length of output: 5279


Replace MenuPortal with menuPosition: 'fixed'.

MenuPortal is not a valid prop for react-select; the correct prop for fixed positioning is menuPosition.

✅ Suggested fix
-    MenuPortal: 'fixed',
+    menuPosition: 'fixed',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
export const WithAction: Story = {
args: {
className: '',
defaultOptions: [
{ label: 'Bangladesh', value: 'BD' },
{ label: 'India', value: 'IN' },
{ label: 'Pakistan', value: 'PK' },
{ label: 'Sri Lanka', value: 'SL' },
],
label: 'Countries',
helpText: 'This is a help text example',
errors: [],
required: true,
menuPortalTarget: document.body,
MenuPortal: 'fixed',
export const WithAction: Story = {
args: {
className: '',
defaultOptions: [
{ label: 'Bangladesh', value: 'BD' },
{ label: 'India', value: 'IN' },
{ label: 'Pakistan', value: 'PK' },
{ label: 'Sri Lanka', value: 'SL' },
],
label: 'Countries',
helpText: 'This is a help text example',
errors: [],
required: true,
menuPortalTarget: document.body,
menuPosition: 'fixed',
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/stories/AsyncSearchableSelect.stories.tsx` around lines 112 - 126, In the
WithAction story object replace the invalid prop key MenuPortal with the correct
react-select prop menuPosition set to 'fixed' (remove MenuPortal entry and add
menuPosition: 'fixed' inside the args for the WithAction Story) while keeping
menuPortalTarget as-is; update the args in the WithAction Story definition to
use menuPosition so the select uses fixed positioning.

@shams-sadek1981
shams-sadek1981 merged commit c1627bc into develop Feb 24, 2026
5 checks passed
Copilot AI left a comment
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds an optional action prop to the AsyncSearchableSelect component, allowing developers to place interactive controls (like "+ Add New" buttons) next to the label. The version is appropriately bumped from 2.0.6 to 2.1.0, following semantic versioning for a backward-compatible feature addition.

Changes:

  • Added optional action prop to AsyncSearchableSelect component for rendering action elements adjacent to the label
  • Refactored label layout from inline-block to flex layout to accommodate the action element
  • Added new WithAction story demonstrating the feature usage
  • Version bump to 2.1.0

Re 8000 viewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
package.json Version bumped to 2.1.0 for the new feature
src/components/AsyncSearchableSelect.tsx Added action prop type definition, refactored label layout to flex container with justify-between to position action alongside label
src/stories/AsyncSearchableSelect.stories.tsx Added WithAction story demonstrating usage of the new action prop with a button example

@@ -1,3 +1,4 @@
import React from 'react';
Copilot AI Feb 24, 2026
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The React import is unnecessary in this file. With the new JSX transform configured in tsconfig.json ("jsx": "react-jsx"), React doesn't need to be imported for JSX to work. Since this component only uses the React.ReactNode type annotation and doesn't use any React APIs (hooks, React.FC, etc.), the import can be safely removed. TypeScript will still recognize React.ReactNode from the global React types.

This follows the same pattern used in SearchableSelect.tsx and TaggableSelect.tsx, which also use React.ReactNode without importing React.

Suggested change
import React from 'react';

Copilot uses AI. Check for mistakes.
{props.label}
{props.required && <span className={'ms-0.5 text-danger-500'}>*</span>}
</label>
{props.action && <div>{props.action}</div>}
Copilot AI Feb 24, 2026
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wrapper div around props.action is unnecessary. The action prop is already a ReactNode and can be rendered directly without an extra wrapper. This simplifies the markup and follows React best practices.

Change from:
{props.action &&

{props.action}
}

To:
{props.action && props.action}

Or even more concisely:
{props.action}

Suggested change
{props.action && <div>{props.action}</div>}
{props.action}

Copilot uses AI. Check for mistakes.
@iamraihan iamraihan self-assigned this Mar 2, 2026

This branch was successfully deployed

1 active deployment
Preview — 81058c89 Deployed Feb 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0