Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/add disabled to listbox listboxitem #2485

Conversation

fpribeiro3069
Copy link
Contributor

@fpribeiro3069 fpribeiro3069 commented Feb 15, 2024

Linked Issue

Closes #2484

Description

Added disabled prop to ListBox and ListBoxItem to prevent selection of inner radio/checkbox inputs.
A ListBoxItem disabled will:

  • restrict selection
  • lose hover style
  • cursor defaults to cursor-default
  • default style of `variant-ghost´

Changsets

Instructions: Changesets automate our changelog. If you modify files in /packages, run pnpm changeset in the root of the monorepo, follow the prompts, then commit the markdown file. Changes that add features should be minor while chores and bugfixes should be patch. Please prefix the changeset message with feat:, bugfix: or chore:.

Checklist

Please read and apply all contribution requirements.

  • This PR targets the dev branch (NEVER master)
  • Documentation reflects all relevant changes
  • Branch is prefixed with: docs/, feat/, chore/, bugfix/
  • Ensure Svelte and Typescript linting is current - run pnpm ci:check
  • Ensure Prettier linting is current - run pnpm format
  • All test cases are passing - run pnpm test
  • Includes a changeset (if relevant; see above)

Copy link

changeset-bot bot commented Feb 15, 2024

🦋 Changeset detected

Latest commit: b930cc7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@skeletonlabs/skeleton Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
skeleton-docs ✅ Ready (Inspect) Visit Preview Feb 26, 2024 5:56pm

@fpribeiro3069 fpribeiro3069 marked this pull request as ready for review February 15, 2024 17:38
@@ -17,6 +19,8 @@
// Props (styles) - Item Only
/** Provide classes to set the listbox item active background styles. */
export let active: CssClasses = 'variant-filled';
/** Provide classes to set the listbox item active disabled background styles */
export let activeDisabled: CssClasses = 'variant-ghost';
Copy link
Contributor

Choose a reason for hiding this comment

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

Typically, we don't offer a "disabled-style" prop.
Instead, we provide a default styling for disabled elements (* users can always override these styles). However, if we decide to introduce such a feature, let's consider renaming the prop and updating the corresponding comment for clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've renamed the class and holding on removing if there is an intention in providing this feature, as you mentioned.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This can be closed if you agree with #2485 (comment)

export let hover: CssClasses = getContext('hover');
export let padding: CssClasses = getContext('padding');
export let regionLead: CssClasses = getContext('regionLead');
export let regionDefault: CssClasses = getContext('regionDefault');
export let regionTrail: CssClasses = getContext('regionTrail');

// Classes
const cBase = 'cursor-pointer -outline-offset-[3px]';
const cBase = '-outline-offset-[3px]';
Copy link
Contributor

Choose a reason for hiding this comment

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

let's re-add cursor-pointer here and override it using the disabled style instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've re added it but I'm not sure how can i override the disabled style. Could you elaborate more on that?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, let me know if i'm doing this correctly. I've removed entirely the possibility for styling the active disabled items and replaced it with opacity which seems better, using the cDisabled approach.

@endigo9740
Copy link
Contributor

@fpribeiro3069 the PR was great, just a couple fixes needed:

  1. We don't need a changeset for /sites/skeleton.dev (the docs), only for packages like /packages/skeleton. So I've updated and corrected your changeset.
  2. Given disabled is such a common featured in interfaces and form elements, the big detailed example was probably overkill, so I've simplified this down to two simple snippets. This provides less to maintain over time too.

I've made the changes for you and this satisfies all requirements on our end, so I'll merge and this will be part of tomorrow's release. Thanks for your contribution!

@endigo9740 endigo9740 merged commit 3a27212 into skeletonlabs:dev Feb 26, 2024
3 of 5 checks passed
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.

Add disabled property to ListBoxItem
3 participants