Skip to content

Conversation

@Kiarokh
Copy link
Contributor

@Kiarokh Kiarokh commented Jul 31, 2025

continuation of #3518

Summary by CodeRabbit

  • New Features

    • Added support for marking the slider as required and indicating invalid states, with corresponding visual cues.
  • Style

    • Improved the slider’s layout using flexbox and updated styling for the outline and helper line.
    • Simplified label styling and ensured consistent font usage for the value indicator.
    • Enhanced the appearance and conditional display of helper lines and outlines.

Review:

  • Commits are atomic
  • Commits have the correct type for the changes made
  • Commits with breaking changes are marked as such

Browsers tested:

(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)

Windows:

  • Chrome
  • Edge
  • Firefox

Linux:

  • Chrome
  • Firefox

macOS:

  • Chrome
  • Firefox
  • Safari

Mobile:

  • Chrome on Android
  • iOS

Copilot AI review requested due to automatic review settings July 31, 2025 10:11
@Kiarokh Kiarokh requested a review from a team as a code owner July 31, 2025 10:11
@coderabbitai
Copy link

coderabbitai bot commented Jul 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The slider component was updated by refactoring its rendering to use a <limel-notched-outline> wrapper and by adding two new boolean properties: required and invalid. The SCSS was revised to improve layout, simplify label styling, and conditionally style the outline and helper line based on validity.

Changes

Cohort / File(s) Change Summary
Slider SCSS Refactor
src/components/slider/slider.scss
Updated layout to use flex column, removed floating label styles, added conditional styling for outline and helper line, and simplified label styling.
Slider Component Refactor & API Extension
src/components/slider/slider.tsx
Added required and invalid properties, refactored render method to use <limel-notched-outline>, updated helper line rendering, and restructured markup.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Slider
    participant NotchedOutline
    participant HelperLine

    User->>Slider: Interacts with slider
    Slider->>NotchedOutline: Passes label, required, invalid, disabled, readonly, value
    NotchedOutline->>Slider: Renders content slot (slider input, track, etc.)
    Slider->>HelperLine: Passes invalid property for helper text rendering
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

visual design, accessibility

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch notched-slider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Kiarokh Kiarokh self-assigned this Jul 31, 2025
Copy link
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 PR enhances the slider component by adding required and invalid state support, aligning it with other form controls. The changes replace the basic label element with a notched outline component to provide consistent styling and validation states.

  • Adds required and invalid properties to the slider component
  • Replaces basic label with limel-notched-outline component for consistent form styling
  • Updates helper line to display invalid state styling

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/components/slider/slider.tsx Adds required/invalid props and replaces label with notched outline component
src/components/slider/slider.scss Updates styling for new notched outline layout and removes old label styles
etc/lime-elements.api.md Updates TypeScript API definitions to include new required and invalid properties

@Kiarokh Kiarokh added visual design Visual styling that may or may not affect usability maintenance Things that are important but not urgent, and not directly related to any specific bug or feature labels Jul 31, 2025
@coderabbitai coderabbitai bot changed the title @coderabbitai Refactor slider to use notched outline and add required and invalid props Jul 31, 2025
@github-actions
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3626/

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f0eed2a and f781a19.

⛔ Files ignored due to path filters (1)
  • etc/lime-elements.api.md is excluded by !etc/lime-elements.api.md
📒 Files selected for processing (2)
  • src/components/slider/slider.scss (1 hunks)
  • src/components/slider/slider.tsx (3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
src/components/**/*.scss

📄 CodeRabbit Inference Engine (.cursor/rules/css-class-names-in-components-using-shadow-dom.mdc)

Do not use BEM-style class names in CSS for components, as components use shadow-DOM.

Files:

  • src/components/slider/slider.scss
**/*.{tsx,scss}

⚙️ CodeRabbit Configuration File

**/*.{tsx,scss}: Almost all our components use shadow-DOM. Therefore, we have no need of BEM-style class names in our CSS.

Files:

  • src/components/slider/slider.scss
  • src/components/slider/slider.tsx
**/*.tsx

📄 CodeRabbit Inference Engine (.cursor/rules/wrap-multiple-jsx-elements-in-host-not-in-array.mdc)

When returning multiple JSX elements from the render method, never wrap them in an array literal. Instead, always wrap them in the special <Host> element. When there is already a single top-level element, it does not have to be wrapped in <Host>.

Files:

  • src/components/slider/slider.tsx

⚙️ CodeRabbit Configuration File

**/*.tsx: Our .tsx files are typically using StencilJS, not React. When a developer wants to return multiple top-level JSX elements from the render method, they will sometimes wrap them in an array literal. In these cases, rather than recommending they add key properties to the elements, recommend removing the hardcoded array literal. Recommend wrapping the elements in StencilJS's special <Host> element.

Files:

  • src/components/slider/slider.tsx
**/*.{ts,tsx}

⚙️ CodeRabbit Configuration File

**/*.{ts,tsx}: Imports from other files in the same module (lime-elements) must use relative paths. Using absolute paths for imports will cause the production build to fail.

Files:

  • src/components/slider/slider.tsx
src/components/**/*.tsx

⚙️ CodeRabbit Configuration File

src/components/**/*.tsx: When contributors add new props to existing components in the lime-elements repository, they should always add documentation examples that demonstrate the new prop's usage and explain how it works. This helps with user adoption, feature discoverability, and maintains comprehensive documentation.

Files:

  • src/components/slider/slider.tsx
🧠 Learnings (3)
📓 Common learnings
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3581
File: src/components/chip-set/chip-set.tsx:626-626
Timestamp: 2025-07-02T12:49:21.522Z
Learning: When contributors add new props to existing components in the lime-elements repository, they should always add documentation examples that demonstrate the new prop's usage and explain how it works. This helps with user adoption, feature discoverability, and maintains comprehensive documentation.
Learnt from: Kiarokh
PR: Lundalogik/lime-elements#3518
File: src/components/chip-set/chip-set.tsx:367-385
Timestamp: 2025-04-14T12:22:22.298Z
Learning: In limel-chip-set, the onClick handler should be placed on the content div (<div slot="content">) rather than on the limel-notched-outline component, and should only be applied when type is 'input'.
src/components/slider/slider.scss (12)

Learnt from: CR
PR: Lundalogik/lime-elements#0
File: .cursor/rules/css-class-names-in-components-using-shadow-dom.mdc:0-0
Timestamp: 2025-07-21T00:27:58.489Z
Learning: Applies to src/components/**/*.scss : Do not use BEM-style class names in CSS for components, as components use shadow-DOM.

Learnt from: Kiarokh
PR: #3567
File: src/components/ai-avatar/ai-avatar.scss:0-0
Timestamp: 2025-05-28T08:37:45.610Z
Learning: In SCSS files, CSS property values can be split across multiple lines when properly indented, particularly for complex values like animation shorthands with CSS custom properties. This is valid SCSS syntax that compiles correctly to CSS and is often the result of auto-formatting tools.

Learnt from: adrianschmidt
PR: #3529
File: src/components/ai-avatar/ai-avatar.scss:20-22
Timestamp: 2025-04-29T14:15:32.104Z
Learning: In components using Shadow DOM (like those in lime-elements), the universal selector * is already scoped to the component's shadow tree and won't cause unwanted side effects outside the component. There's no functional difference between * and :host * in this context.

Learnt from: Kiarokh
PR: #3624
File: src/components/button-group/button-group.scss:115-118
Timestamp: 2025-07-30T14:20:41.779Z
Learning: In lime-elements, CSS custom properties like --limel-theme-surface-background-color are applied at :root level via core-styles.scss and should be expected to be available without fallbacks. The library's architecture guarantees these theme variables are present, so adding fallbacks would be redundant and go against the design intention.

Learnt from: Kiarokh
PR: #3624
File: src/components/button-group/button-group.scss:115-118
Timestamp: 2025-07-30T14:20:41.779Z
Learning: In lime-elements, CSS custom properties like --limel-theme-surface-background-color are applied at :root level via core-styles.scss and should be expected to be available without fallbacks. The library's architecture guarantees these theme variables are present, so adding fallbacks would be redundant and go against the design intention.

Learnt from: Kiarokh
PR: #3518
File: src/components/notched-outline/examples/notched-outline-basic.scss:11-22
Timestamp: 2025-04-14T10:01:18.721Z
Learning: Examples in Lime Elements use Shadow DOM (with shadow: true in the component decorator) for style encapsulation, making additional class-based selectors unnecessary. This ensures styles are automatically scoped to each component without leaking to the rest of the application.

Learnt from: Kiarokh
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:24-28
Timestamp: 2025-04-25T14:22:02.157Z
Learning: In lime-elements, CSS custom properties follow a specific naming convention:

  1. Internal use variables (not for consumers) are prefixed with --limel-component-name-
  2. External use variables (intended for consumers) are prefixed with --component-name-
    Variables documented with JSDoc comments are typically meant for external use.

Learnt from: Kiarokh
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:96-122
Timestamp: 2025-04-25T14:18:07.755Z
Learning: In Lime Elements components that use Shadow DOM (with shadow: true in the component decorator), keyframe animation names don't need to be namespaced as they are automatically scoped to the component and won't collide with animations from other components.

Learnt from: Kiarokh
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.scss:1-3
Timestamp: 2025-04-25T14:23:56.018Z
Learning: In the lime-elements repository, CSS custom properties prefixed with --lime- are considered internal implementation details and should not be documented in JSDoc comments, while other custom properties should be documented as they are part of the public API.

Learnt from: Kiarokh
PR: #3518
File: src/components/chip-set/chip-set.tsx:367-385
Timestamp: 2025-04-14T12:22:22.298Z
Learning: In limel-chip-set, the onClick handler should be placed on the content div (

) rather than on the limel-notched-outline component, and should only be applied when type is 'input'.

Learnt from: adrianschmidt
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.tsx:30-38
Timestamp: 2025-04-25T13:32:56.396Z
Learning: For StencilJS components in lime-elements, prefer using the <Host> element to wrap child elements in the render method instead of returning an array of elements. This follows the standard pattern in the codebase and eliminates the need for key attributes.

Learnt from: adrianschmidt
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.tsx:30-38
Timestamp: 2025-04-25T13:32:56.396Z
Learning: For StencilJS components in lime-elements, prefer using the <Host> element to wrap child elements in the render method instead of returning an array of elements, which eliminates the need for key attributes and follows StencilJS best practices.

src/components/slider/slider.tsx (4)

Learnt from: Kiarokh
PR: #3581
File: src/components/chip-set/chip-set.tsx:626-626
Timestamp: 2025-07-02T12:49:21.522Z
Learning: When contributors add new props to existing components in the lime-elements repository, they should always add documentation examples that demonstrate the new prop's usage and explain how it works. This helps with user adoption, feature discoverability, and maintains comprehensive documentation.

Learnt from: adrianschmidt
PR: #3530
File: src/components/text-editor/examples/text-editor-composite.tsx:4-7
Timestamp: 2025-04-17T09:39:36.254Z
Learning: For lime-elements, example files should import types from the public API using '@limetech/lime-elements' rather than defining duplicate types locally. This includes types like EditorUiType which are part of the component's public API.

Learnt from: Kiarokh
PR: #3518
File: src/components/chip-set/chip-set.tsx:367-385
Timestamp: 2025-04-14T12:22:22.298Z
Learning: In limel-chip-set, the onClick handler should be placed on the content div (

) rather than on the limel-notched-outline component, and should only be applied when type is 'input'.

Learnt from: adrianschmidt
PR: #3529
File: src/components/lime-ai-avatar/lime-ai-avatar.tsx:30-38
Timestamp: 2025-04-25T13:32:56.396Z
Learning: For StencilJS components in lime-elements, prefer using the <Host> element to wrap child elements in the render method instead of returning an array of elements. This follows the standard pattern in the codebase and eliminates the need for key attributes.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build
  • GitHub Check: Docs / Publish Docs
  • GitHub Check: Test
🔇 Additional comments (7)
src/components/slider/slider.scss (5)

4-4: LGTM: Proper mixins import added

The mixins import is correctly added to support the helper line mixin used later in the file.


13-15: LGTM: Appropriate layout changes for new structure

The flex column layout with isolation and relative positioning properly supports the new limel-notched-outline wrapper structure.


17-22: LGTM: Conditional styling for invalid state

The conditional styling correctly hides the notched outline border and background when the slider is not marked as invalid, which aligns with the new invalid property functionality.


24-24: LGTM: Proper use of helper line mixin

The mixin correctly implements the conditional hiding of helper lines when not needed, following established patterns in the codebase.


26-31: LGTM: Content slot styling updated appropriately

The content slot styling properly accommodates the new slot structure with full width, flex column layout, and appropriate padding for the slider content.

src/components/slider/slider.tsx (2)

165-226: LGTM: Well-structured refactor with notched outline wrapper

The refactoring to use limel-notched-outline wrapper is well-implemented:

  • All necessary props are correctly passed to the wrapper
  • Content is properly slotted within the content slot
  • The slider structure and functionality are preserved
  • Accessibility attributes are maintained (aria-labelledby, aria-controls)

The use of <Host> wrapper follows StencilJS best practices for the component.


272-272: LGTM: Helper line properly receives invalid state

The helper line component correctly receives the invalid property, ensuring consistent validation styling throughout the component.

@Kiarokh Kiarokh enabled auto-merge (rebase) July 31, 2025 10:24
@Kiarokh Kiarokh removed their assignment Jul 31, 2025
flex-direction: column;
}

:host(limel-slider:not([invalid]):not([invalid='true'])) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
:host(limel-slider:not([invalid]):not([invalid='true'])) {
:host(limel-slider:not([invalid]):not([invalid='true'])),
// We don't want the gray notched outlines around the slider by default
:host(limel-slider:[disabled]):not([disabled='false']) {
// and we don't want the `disabled` but `invalid` slider to show any
// red lines. Since users cannot do anything to fix a disabled but invalid slider

Copy link
Contributor

@LucyChyzhova LucyChyzhova left a comment

Choose a reason for hiding this comment

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

Really nice! I love the refactoring part as well!

Kiarokh added 2 commits August 4, 2025 14:56
Note that for simplicity, the required prop
does not have any visual representation yet.
The required asterisk is automatically added in the next commit.
@Kiarokh Kiarokh force-pushed the notched-slider branch 2 times, most recently from 754220c to 2e4446d Compare August 4, 2025 13:00
Kiarokh added 2 commits August 4, 2025 15:01
The main render method is split and different
parts of the user interface have now distinct render methods,
with single responsibility.
Copy link
Contributor

@civing civing left a comment

Choose a reason for hiding this comment

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

I've only looked at the API change

@Kiarokh Kiarokh merged commit bbb9045 into main Aug 5, 2025
12 checks passed
@Kiarokh Kiarokh deleted the notched-slider branch August 5, 2025 05:53
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 38.21.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Things that are important but not urgent, and not directly related to any specific bug or feature released visual design Visual styling that may or may not affect usability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants