feat: centralize variant types in props#8073
Merged
Conversation
Contributor
|
Netlify Draft Deployment |
Contributor
Hydration Benchmark Report (vs Baseline)✅ Top 5 Improvements (Best Speedups)
🔻 Flop 5 Regressions (Worst Slowdowns)
📋 Show all results
|
fc6cfbb to
d9454c0
Compare
18ca79b to
638b27e
Compare
…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.
56c6b30 to
02dbdd2
Compare
Contributor
There was a problem hiding this comment.
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
watchValidatorcalls 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 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Peter Laske <37439758+laske185@users.noreply.github.com>
laske185
approved these changes
Aug 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
propsdirectory undersrc/schemato 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)).validateDisabled,validateHint, andvalidateTabIndex, 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:
Alert,Combobox, andInputCheckboxto use stricterPropTypedefinitions (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:
watchValidatorwith more robust validation functions, such asvalidateAlertType,validateVariantInputCheckbox, andvalidateLevel, 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:
validateTabIndex) to their respective files in thepropsdirectory ([[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)).AGENTS.mdto 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:
ComboboxandInputCheckboxcomponents 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)).KolInputStateWrapperFcandCustomSuggestionsOptionFc, to improve modularity and reusability in theComboboxcomponent (F5fc93ddL1,[packages/components/src/components/combobox/shadow.tsxL564-R566](https://github.com/public-ui/kolibri/pull/8073/files#diff-9c5839ad62441f821d58f1c59b00a0695d5bf7d32d4fcc605a6df1a78c0f017eL564-R566)).