Skip to content

feat: centralize variant types in props#8073

Merged
deleonio merged 2 commits intodevelopfrom
feature/user-story-fur-issue-8060-schreiben
Aug 4, 2025
Merged

feat: centralize variant types in props#8073
deleonio merged 2 commits intodevelopfrom
feature/user-story-fur-issue-8060-schreiben

Conversation

@deleonio
Copy link
Copy Markdown
Contributor

@deleonio deleonio commented Jul 18, 2025

This pull request introduces several changes aimed at improving code consistency, enforcing validation rules, and centralizing property handling across components. The most important updates include the migration to dedicated property validators, the replacement of inline validation logic, and the use of stricter prop types for better type safety. These changes enhance maintainability and ensure consistent behavior across components.

Centralized Property Handling and Validation:

  • Introduced a new props directory under src/schema to centralize property definitions, including types, schemas, and validators. Components now import these validators instead of implementing custom logic (AGENTS.md, [packages/components/AGENTS.mdR60-R67](https://github.com/public-ui/kolibri/pull/8073/files#diff-592d196ca4aa95fa88f677eaa664bfcba0ae5d0280e933e20739de90ac85964cR60-R67)).
  • Replaced inline validation logic with dedicated validator functions for various properties, such as validateDisabled, validateHint, and validateTabIndex, across multiple components ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-32ff3f1ee6664d0de5fd5c7b2bc0a95bb3b7b37de19730aa06184315dfd5858aL69-R69), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-32ff3f1ee6664d0de5fd5c7b2bc0a95bb3b7b37de19730aa06184315dfd5858aL103-R100), [[3]](https://github.com/public-ui/kolibri/pull/8073/files#diff-32ff3f1ee6664d0de5fd5c7b2bc0a95bb3b7b37de19730aa06184315dfd5858aL21-R37), [[4]](https://github.com/public-ui/kolibri/pull/8073/files#diff-8d6c3c6399003ba8d5a7511318a56abe6bd1b5f3914e4ab9aeb32524088d5d56L46-R49)).

Stricter Prop Types:

  • Updated prop types for components like Alert, Combobox, and InputCheckbox to use stricter PropType definitions (e.g., AlertTypePropType, PlaceholderPropType, InputCheckboxVariantPropType) for improved type safety and clarity ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-0304530fb50ea8d1a99c6d4a7b68f71c364e087b7927416629d7cd69ef1d26c0L81-R95), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-9c5839ad62441f821d58f1c59b00a0695d5bf7d32d4fcc605a6df1a78c0f017eL493-R495), [[3]](https://github.com/public-ui/kolibri/pull/8073/files#diff-9759e01b01c6ba7305b0c522808868536dc2d1c9ffccc47fcf4035dcb9e0b36bL258-R259)).

Validation Logic Replacement:

  • Replaced watchValidator with more robust validation functions, such as validateAlertType, validateVariantInputCheckbox, and validateLevel, to ensure consistent validation logic across components ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-a1c7fe964bd2013aea572415254f9aba9cf867dffaeda9b9589b8b868027a179L2-R7), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-5455ba22a322dc0635f05de2ffee825921ff26f44878d60f532edcefb93c0139L74-R76), [[3]](https://github.com/public-ui/kolibri/pull/8073/files#diff-0304530fb50ea8d1a99c6d4a7b68f71c364e087b7927416629d7cd69ef1d26c0L140-R155)).

Code Consistency:

  • Improved import organization and reduced redundancy by moving specific validators (e.g., validateTabIndex) to their respective files in the props directory ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-32ff3f1ee6664d0de5fd5c7b2bc0a95bb3b7b37de19730aa06184315dfd5858aL21-R37), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-8d6c3c6399003ba8d5a7511318a56abe6bd1b5f3914e4ab9aeb32524088d5d56L46-R49)).
  • Updated documentation in AGENTS.md to reflect the new approach to props handling and discourage disabling lint rules via inline comments ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-a54ff182c7e8acf56acfd6e4b9c3ff41e2c41a31c9b211b2deb9df75d9a478f9L229-R229), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-592d196ca4aa95fa88f677eaa664bfcba0ae5d0280e933e20739de90ac85964cR60-R67)).

Component-Specific Enhancements:

  • Refactored Combobox and InputCheckbox components to use the centralized property handling and stricter validation logic, ensuring consistent behavior and reducing duplication ([[1]](https://github.com/public-ui/kolibri/pull/8073/files#diff-afe9ed580a01dd9b6fbee7dc67f7b725715b564e705c6d1542ad976fdb8ebfbdL16-R21), [[2]](https://github.com/public-ui/kolibri/pull/8073/files#diff-9759e01b01c6ba7305b0c522808868536dc2d1c9ffccc47fcf4035dcb9e0b36bL382-R383)).
  • Added new functional components and utilities, such as KolInputStateWrapperFc and CustomSuggestionsOptionFc, to improve modularity and reusability in the Combobox component (F5fc93ddL1, [packages/components/src/components/combobox/shadow.tsxL564-R566](https://github.com/public-ui/kolibri/pull/8073/files#diff-9c5839ad62441f821d58f1c59b00a0695d5bf7d32d4fcc605a6df1a78c0f017eL564-R566)).

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 18, 2025

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jul 18, 2025

Hydration Benchmark Report (vs Baseline)

✅ Top 5 Improvements (Best Speedups)

Component Current Baseline Δ% Result
kol-form 30.8ms 35.6ms -13.5%
kol-input-email 54.9ms 62.5ms -12.2%
kol-abbr 17.4ms 19.8ms -12.1%
kol-input-radio 51.2ms 56.5ms -9.4%
kol-badge 63.8ms 70.1ms -9%

🔻 Flop 5 Regressions (Worst Slowdowns)

Component Current Baseline Δ% Result
kol-drawer 40.8ms 25.6ms +59.4% 🔻
kol-card 29.3ms 22.6ms +29.6% 🔻
kol-button-link 58.8ms 50.7ms +16% 🔻
kol-tree 29.8ms 26.5ms +12.5% 🔻
kol-link-button 61.7ms 56.5ms +9.2%
📋 Show all results
Component Current Baseline Δ% Result
kol-abbr 17.4ms 19.8ms -12.1%
kol-accordion 130.1ms 131ms -0.7%
kol-alert 104.8ms 105.9ms -1%
kol-avatar 26.4ms 26.9ms -1.9%
kol-badge 63.8ms 70.1ms -9%
kol-breadcrumb 100.3ms 97.6ms +2.8%
kol-button 64.7ms 63ms +2.7%
kol-button-link 58.8ms 50.7ms +16% 🔻
kol-card 29.3ms 22.6ms +29.6% 🔻
kol-details 130.9ms 134.9ms -3%
kol-drawer 40.8ms 25.6ms +59.4% 🔻
kol-form 30.8ms 35.6ms -13.5%
kol-heading 21.1ms 21.5ms -1.9%
kol-icon 68.4ms 65.1ms +5.1%
kol-image 17.8ms 19.3ms -7.8%
kol-input-checkbox 137.7ms 141.3ms -2.5%
kol-input-color 79.8ms 81.9ms -2.6%
kol-input-date 68.2ms 70.3ms -3%
kol-input-email 54.9ms 62.5ms -12.2%
kol-input-file 97.6ms 93.7ms +4.2%
kol-input-number 60.6ms 56.1ms +8%
kol-input-password 53.5ms 51.6ms +3.7%
kol-input-radio 51.2ms 56.5ms -9.4%
kol-input-text 61.5ms 59.3ms +3.7%
kol-link 54.3ms 49.8ms +9%
kol-link-button 61.7ms 56.5ms +9.2%
kol-modal 19.7ms 20.5ms -3.9%
kol-nav 31.7ms 33.9ms -6.5%
kol-pagination 443.7ms 423.8ms +4.7%
kol-popover-button 71.8ms 71.3ms +0.7%
kol-progress 32.4ms 32.8ms -1.2%
kol-quote 19.4ms 19ms +2.1%
kol-select 123ms 117.1ms +5%
kol-skip-nav 22.1ms 23.6ms -6.4%
kol-spin 23ms 24.2ms -5%
kol-split-button 170.1ms 174.7ms -2.6%
kol-table-stateful 391ms 374.7ms +4.4%
kol-table-stateless 437.1ms 437ms +0%
kol-tabs 29.6ms 32.3ms -8.4%
kol-textarea 50.5ms 54.1ms -6.7%
kol-toolbar 34.7ms 36ms -3.6%
kol-tree 29.8ms 26.5ms +12.5% 🔻
kol-tree-item 69ms 64ms +7.8%
kol-version 157.1ms 154.8ms +1.5%

@deleonio deleonio requested review from Copilot and laske185 July 18, 2025 14:40

This comment was marked as outdated.

@deleonio deleonio marked this pull request as ready for review July 21, 2025 10:13
@deleonio deleonio marked this pull request as draft July 21, 2025 14:14
@deleonio deleonio closed this Jul 23, 2025
@deleonio deleonio force-pushed the feature/user-story-fur-issue-8060-schreiben branch from fc6cfbb to d9454c0 Compare July 23, 2025 10:52
@publicuibot publicuibot bot locked and limited conversation to collaborators Jul 23, 2025
@deleonio deleonio reopened this Jul 23, 2025
@deleonio deleonio force-pushed the feature/user-story-fur-issue-8060-schreiben branch 2 times, most recently from 18ca79b to 638b27e Compare July 25, 2025 22:05
@deleonio deleonio requested a review from Copilot July 25, 2025 22:06
@public-ui public-ui unlocked this conversation Jul 26, 2025

This comment was marked as outdated.

…idation

- Updated textarea component to use new prop types for resizing, placeholder, read-only, and required attributes.
- Enhanced alert component schema by introducing alert type and variant props.
- Modified input-checkbox schema to include new icon props and variant types.
- Refined input-date, input-number, and input-text schemas to utilize new type prop types.
- Added new props for managing current length, has value, and multi-sort capabilities.
- Introduced validation for new props including accept, pattern, placeholder, and unit.
- Removed deprecated progress type definitions and updated related schemas.
- Improved validation logic for tab index and added accessibility hints.
- Added new props for quote and toaster components to enhance functionality.
- Updated sample components to reflect changes in prop types and validation.
@deleonio deleonio force-pushed the feature/user-story-fur-issue-8060-schreiben branch from 56c6b30 to 02dbdd2 Compare July 28, 2025 05:07
@deleonio deleonio marked this pull request as ready for review July 28, 2025 05:07
@deleonio deleonio requested a review from Copilot July 28, 2025 08:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 centralizes property definitions and validation logic by introducing a dedicated props directory under src/schema. The changes replace inline validation with standardized validators and migrate to stricter prop types for better type safety and consistency across components.

Key changes:

  • Centralized property validation through dedicated validator functions in src/schema/props
  • Migration from generic types (e.g., AlertType) to prop-specific types (e.g., AlertTypePropType)
  • Replacement of inline watchValidator calls with centralized validation functions

Reviewed Changes

Copilot reviewed 73 out of 73 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
packages/samples/react/src/components/toast/basic.tsx Updated imports to use new prop types (AlertTypePropType, AlertVariantPropType)
packages/samples/react/src/components/alert/basic.tsx Updated type annotations to use new prop types
packages/components/src/schema/props/ Added centralized property definitions with types, schemas, and validators
packages/components/src/components/*/controller.ts Migrated from inline validation to centralized validator functions
packages/components/src/components/*/shadow.tsx Updated prop type annotations and imports
packages/components/AGENTS.md Added documentation for new props handling approach

Comment thread packages/components/src/schema/props/variant-quote.ts Outdated
Comment thread packages/components/src/schema/props/variant-progress.ts Outdated
Comment thread packages/components/src/schema/props/variant-input-checkbox.ts Outdated
Comment thread packages/components/src/schema/props/variant-alert.ts Outdated
Comment thread packages/components/src/schema/props/type-input-text.ts Outdated
Comment thread packages/components/src/schema/props/type-input-date.ts Outdated
Comment thread packages/components/src/schema/props/resize-textarea.ts Outdated
Comment thread packages/components/src/schema/props/alert-type.ts Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Peter Laske <37439758+laske185@users.noreply.github.com>
@deleonio deleonio merged commit 84758b5 into develop Aug 4, 2025
9 checks passed
@deleonio deleonio deleted the feature/user-story-fur-issue-8060-schreiben branch August 4, 2025 13:19
@publicuibot publicuibot bot locked and limited conversation to collaborators Aug 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants