Skip to content

Commit

Permalink
[sparkle] - enh: Checkbox (dust-tt#8001)
Browse files Browse the repository at this point in the history
* [sparkle] - refactor: streamline Checkbox component with Radix UI and improved styles

 - Refactored Checkbox component to use Radix UI primitives for improved accessibility and functionality
 - Simplified Checkbox props and removed unnecessary code for clarity and maintainability
 - Created new Checkbox variants with text and description for better UX in different contexts
 - Updated Checkbox stories to reflect the new API and component structure
 - Organized exports to include new Checkbox variants in the component library index

* [sparkle] - feature: add radix-ui checkbox and class variance dependency

 - Implemented @radix-ui/react-checkbox for better checkbox functionality and UI consistency
 - Integrated class-variance-authority for handling class composition logic

* [sparkle] - refactor: streamline Checkbox component and usage in Tree stories

 - Add `checked` prop directly to `Checkbox` component logic to handle partial and fully checked states
 - Simplify checkbox prop usage by removing `variant` field and utilizing boolean for `checked` state in Tree stories
 - Export `CheckboxProps` type from Checkbox component for external type usage
 - Update `TreeExample` and `SelectDataSourceExample` in stories to align with Checkbox component changes

* [sparkle] - refactor: simplify Checkbox component props

 - Remove `isPartial` prop interface from Checkbox component, simplifying the component's API and prop handling

* [sparkle] - refactor: remove default props from Checkbox component

 - Default properties for size and isPartial are now expected to be explicitly provided
 - Ensures more clarity and control over Checkbox usage by requiring specific prop values

* [sparkle] - refactor: update Checkbox component to support 'partial' state

 - Refactored the `Checkbox` component's styles to replace the `isPartial` variant with a more versatile `checked` variant
 - Introduced a new type `CheckBoxStateType` to support 'partial' along with boolean states
 - Updated stories and related components to use the new 'partial' state checker instead of the 'indeterminate' or `isPartial` props
 - Cleaned up props by using an Omit type to exclude the old `checked` prop and swap it for the new `checked` state type

* [sparkle] - feature: update partial state color and add disabled state to Checkbox

- Changed the background color for partial state of Checkbox to 's-bg-muted-foreground'
- Added disabled variants for all sizes and states of Checkbox in story examples

* [sparkle] - fix: update Checkbox to handle 'partial' checked state

 - Remove "defaultChecked" from the props being passed to CheckboxPrimitive.Root to prevent conflicts with controlled behavior
 - Modify the "checked" prop handling to support "indeterminate" state when Checkbox is given a "partial" value

* [sparkle] - feature: bump package version to 0.2.267

 - Package version updated to reflect new changes and features introduced
 - Synchronized package-lock.json version to match package.json for consistency

---------

Co-authored-by: Jules <[email protected]>
  • Loading branch information
JulesBelveze and Jules authored Oct 14, 2024
1 parent 52910a0 commit a752b4d
Show file tree
Hide file tree
Showing 6 changed files with 360 additions and 270 deletions.
185 changes: 183 additions & 2 deletions sparkle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion sparkle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dust-tt/sparkle",
"version": "0.2.266",
"version": "0.2.267",
"scripts": {
"build": "rm -rf dist && npm run tailwind && npm run build:esm && npm run build:cjs",
"tailwind": "tailwindcss -i ./src/styles/tailwind.css -o dist/sparkle.css",
Expand Down Expand Up @@ -94,13 +94,15 @@
"@emoji-mart/data": "^1.1.2",
"@emoji-mart/react": "^1.1.1",
"@headlessui/react": "^1.7.19",
"@radix-ui/react-checkbox": "^1.1.2",
"@radix-ui/react-dropdown-menu": "^2.1.2",
"@radix-ui/react-label": "^2.1.0",
"@radix-ui/react-popover": "^1.1.2",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-tooltip": "^1.1.3",
"@tanstack/react-table": "^8.13.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"emoji-mart": "^5.5.2",
"lottie-react": "^2.4.0",
Expand Down
Loading

0 comments on commit a752b4d

Please sign in to comment.