Skip to content

feat(admin): implement DataTableToolbar component with Storybook stories #215#463

Merged
husamettinarabaci merged 7 commits into
developfrom
feat/admin-data-table-toolbar
Jan 28, 2026
Merged

feat(admin): implement DataTableToolbar component with Storybook stories #215#463
husamettinarabaci merged 7 commits into
developfrom
feat/admin-data-table-toolbar

Conversation

@ayseturmus

Copy link
Copy Markdown
Contributor

Pull Request

📄 Summary

This PR extends DataTableToolbar with loading state support, improved filter behavior, and i18n-ready text handling.
The implementation follows AGENTS.md (composition-first, accessibility, Svelte 5 runes).


✨ Key Changes

  • Loading state

    • loading prop with Spinner
    • loadingAriaLabel for screen readers
  • Filter improvements

    • filterCloseOnSelect prop
    • noFilterText externalized for i18n
    • Filter rendering and layout fixes (filterMinWidth)
  • Storybook

    • Tag Filter story added
    • Playground and core variants updated

🧩 Affected Module(s)

  • Source Code
  • Documentation
  • CI / Infra

🔗 Related Issues

Closes #215


✅ Checklist

  • Conventional PR title (feat)
  • Static analysis & build passed
  • No hardcoded strings (i18n-ready)
  • Library components only
  • Storybook coverage added
  • No unrelated changes

💬 Notes

  • Uses Svelte 5 runes ($props, $state, $derived)
  • Fully typed TypeScript props
  • Static DaisyUI classes only
  • Exported via src/lib/index.ts

- Add noFilterText prop to externalize hardcoded 'No filter' string
- Remove hardcoded aria-label default value
- Ensure all user-facing text is externalized as props
…nteractions

- Add filterCloseOnSelect prop to control dropdown close behavior
- Fix Button component usage in filter content (remove class prop that breaks DaisyUI classes)
- Add event propagation handling for Tag clicks in filter dropdown
- Document raw HTML usage in stories according to AGENTS.md
@github-actions github-actions Bot added the module:source Source Code label Jan 24, 2026
@github-project-automation github-project-automation Bot moved this to 📥 Inbox / Ideas in hexaTune Project Jan 24, 2026
@ayseturmus ayseturmus changed the title Feat/admin data table toolbar feat(admin): implement DataTableToolbar component with Storybook stories #215 Jan 24, 2026

@husamettinarabaci husamettinarabaci left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Request Changes: Component Composition Violation

Thank you for the comprehensive implementation! The PR is high-quality overall, but there's one critical component composition issue that needs to be addressed before merging.


❌ Issue: Raw HTML Input Instead of Library Component

Location: DataTableToolbar.svelte:500-519

The component currently uses a raw HTML <input> element instead of the library's Input component:

<!-- Current Implementation - INCORRECT -->
<input
  type="search"
  bind:value={searchValue}
  placeholder={searchPlaceholder}
  disabled={disabled || loading}
  aria-label={searchAriaLabel}
  oninput={handleSearchInput}
  onkeydown={handleSearchKeydown}  // ❌ This is why raw HTML was used
  class={[...].join(' ')}
/>

Reason Given: Input component doesn't support onkeydown prop.


🎯 Required Changes

Per AGENTS.md Component Composition Rules (lines 196-217, 373-413):

⚠️ CRITICAL PRIORITY RULE: Library components MUST be used unless TECHNICALLY IMPOSSIBLE.

Decision Tree Step 3: Can the library component be extended/modified to support your needs?

  • YES → Modify the component first. Do NOT bypass it. STOP HERE.

Solution: Extend the Input Component

1. Add onkeydown prop to Input component:

// In Input.svelte Props interface
interface Props {
  // ... existing props
  onkeydown?: (event: KeyboardEvent) => void;
}

// In the input element
<input 
  onkeydown={onkeydown}
  {...otherProps}
/>

2. Update DataTableToolbar to use Input component:

<Input
  type="search"
  bind:value={searchValue}
  placeholder={searchPlaceholder}
  disabled={disabled || loading}
  ariaLabel={searchAriaLabel}
  oninput={handleSearchInput}
  onkeydown={handleSearchKeydown}  // ✅ Now supported
  size={searchSize}
  class="w-full"
/>

📚 Why This Matters

From AGENTS.md (lines 274-283):

Example Scenario:
If you add a loading state to the Button component, and all composite components use <Button> internally, every button across the library automatically gets the loading feature.

If you use raw HTML:

  • You have to manually update every component
  • Features become inconsistent
  • Maintenance becomes a nightmare
  • Bugs multiply across the codebase

By using the Input component:

  • Future Input enhancements (validation, icons, error states) automatically propagate
  • Maintains consistency across the library
  • Follows the established architecture pattern

✅ Everything Else Looks Great!

The rest of the implementation is excellent:

  • ✅ All other components properly use library primitives (Button, Text, Badge, etc.)
  • ✅ No hardcoded strings (i18n-ready)
  • ✅ Comprehensive Storybook coverage (11 stories)
  • ✅ TypeScript strictly typed
  • ✅ Accessibility best practices
  • ✅ DaisyUI static classes only
  • ✅ Proper documentation

📋 Action Items

  • Add onkeydown prop to Input.svelte component
  • Replace raw HTML <input> with <Input> component in DataTableToolbar.svelte
  • Remove the raw HTML justification comment (lines 492-499)
  • Verify all functionality still works (Enter key search)
  • Update if Input component changes affect other files

Once these changes are made, this PR will be ready to merge! 🚀


Reference: AGENTS.md - Component Composition & Reusability Principle (lines 196-479)

@github-project-automation github-project-automation Bot moved this from 📥 Inbox / Ideas to 🚧 In Progress in hexaTune Project Jan 25, 2026
yusufyilmazf
yusufyilmazf previously approved these changes Jan 25, 2026
@yusufyilmazf yusufyilmazf dismissed stale reviews from husamettinarabaci and themself January 25, 2026 17:39

.

yusufyilmazf
yusufyilmazf previously approved these changes Jan 25, 2026
- Add onkeydown prop to Input component Props interface
- Support KeyboardEvent handling for Enter key and other keyboard interactions
- Follows AGENTS.md component composition extension pattern
- Replace raw HTML input element with Input component
- Remove raw HTML justification comment
- Use Input component's onkeydown prop for Enter key handling
- Follows AGENTS.md component composition rules

@husamettinarabaci husamettinarabaci left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@github-project-automation github-project-automation Bot moved this from 🚧 In Progress to Done in hexaTune Project Jan 28, 2026
@husamettinarabaci husamettinarabaci merged commit 7216af5 into develop Jan 28, 2026
6 checks passed
@husamettinarabaci husamettinarabaci deleted the feat/admin-data-table-toolbar branch January 28, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:source Source Code

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants