Skip to content

Conversation

@pixelflips
Copy link
Member

@pixelflips pixelflips commented Oct 23, 2025

Description

Adds a highlight boolean prop to pds-textarea that applies purple accent styling to draw attention to important fields.

What it does:

  • Applies accent background, border, and text color
  • Styles character counter
  • Semantic states (disabled, invalid, readonly) take precedence over highlight styling

Why:
Provides a visual way to emphasize important textarea fields without overriding critical user feedback states.

Fixes https://kajabi.atlassian.net/browse/DSS-1562

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • unit tests (3 tests covering rendering, reflection, and state precedence)
  • e2e tests (2 tests for attribute behavior and dynamic toggling)
  • tested manually (Storybook story with all controls functional)
  • other: Fixed pre-existing hideLabel test bug

Test coverage:

  • Prop reflection (reflect: true)
  • Semantic states override highlight (disabled, invalid, readonly)
  • Character counter styling works with highlight
  • Compatible with all existing textarea features (maxLength, action slot, etc.)

Test Configuration:

  • Pine versions:
  • OS:
  • Browsers:
  • Screen readers:
  • Misc:

Checklist:

If not applicable, leave options unchecked.

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • Design has QA'ed and approved this PR

@pixelflips pixelflips self-assigned this Oct 23, 2025
@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for pine-design-system ready!

Name Link
🔨 Latest commit 24989c0
🔍 Latest deploy log https://app.netlify.com/projects/pine-design-system/deploys/68fab8c04b03ac00083f92a2
😎 Deploy Preview https://deploy-preview-569--pine-design-system.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions bot added the package: core Changes have been made to the Core package label Oct 23, 2025
@pixelflips pixelflips marked this pull request as ready for review October 23, 2025 22:43
@pixelflips
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

cursor[bot]

This comment was marked as outdated.

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 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.

📝 Walkthrough

Walkthrough

This pull request updates the core component type definitions to add @default documentation annotations and mark several LocalJSX props as optional across multiple components. Concurrently, it introduces a new optional highlight prop to the PdsTextarea component with accompanying SCSS styling for the highlighted state. The enhancement includes updated documentation, story examples, and comprehensive end-to-end and unit test coverage for the new highlight functionality, with no changes to existing component behavior outside of the textarea addition.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "feat(pds-textarea): add highlight prop and styling" directly and accurately describes the primary changes in the changeset. The modifications across all files are cohesively focused on introducing a new highlight feature to the pds-textarea component, including the boolean prop, associated styling, documentation, tests, and story examples. The title is specific, concise, and clearly communicates the main functional addition without being vague or misleading.
Description Check ✅ Passed The pull request description follows the repository's template structure and includes all major required sections. It provides a clear summary of the feature being added (a highlight prop for pds-textarea), explains the motivation and implementation approach, includes a link to the related issue (DSS-1562), and properly categorizes the change as a new feature requiring documentation updates. The testing section is comprehensive, detailing 3 unit tests, 2 e2e tests, and manual testing with specific coverage areas. All applicable checklist items are appropriately marked, though the Test Configuration environment fields are left blank, which appears to be acceptable given the nature of the testing performed.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/pds-textarea-highlight

Comment @coderabbitai help to get the list of available commands and usage tips.

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: 0

🧹 Nitpick comments (6)
libs/core/src/components/pds-textarea/readme.md (1)

19-19: Clarify state precedence in prop docs.

Note that highlight is ignored when disabled, readonly, or invalid. Add this to the JSDoc so it appears in the auto-generated table.

libs/core/src/components/pds-textarea/test/pds-textarea.e2e.ts (1)

227-261: Good coverage for reflection/toggling. Consider adding precedence cases.

Add E2E cases ensuring highlight is ignored when readonly and when invalid.

Example to append:

+  it('ignores highlight when readonly', async () => {
+    const page = await newE2EPage();
+    await page.setContent('<pds-textarea highlight readonly label="Msg" value="x"></pds-textarea>');
+    const host = await page.find('pds-textarea');
+    const textarea = await page.find('pds-textarea >>> textarea');
+    expect(host).toHaveAttribute('highlight');
+    expect(await textarea.getProperty('readOnly')).toBe(true);
+  });
+
+  it('ignores highlight when invalid', async () => {
+    const page = await newE2EPage();
+    await page.setContent('<pds-textarea highlight invalid error-message="err" value="x"></pds-textarea>');
+    const host = await page.find('pds-textarea');
+    const field = await page.find('pds-textarea >>> .pds-textarea__field');
+    expect(host).toHaveAttribute('highlight');
+    expect(await field.getProperty('className')).toContain('is-invalid');
+  });
libs/core/src/components/pds-textarea/docs/pds-textarea.mdx (1)

119-129: Use boolean prop in React example and call out precedence.

  • In React, prefer boolean prop: highlight or highlight={true} instead of highlight="true".
  • Add a short note: “Highlight is ignored when disabled, readonly, or invalid.”

Suggested snippet change:

- react: '<PdsTextarea name="Highlight" label="Message" highlight="true" value="This textarea is highlighted" componentId="textarea-highlight"></PdsTextarea>',
+ react: '<PdsTextarea name="Highlight" label="Message" highlight value="This textarea is highlighted" componentId="textarea-highlight"></PdsTextarea>',
libs/core/src/components/pds-textarea/pds-textarea.scss (1)

13-28: Scope counter highlight to non-invalid state to avoid mixed styles.

When invalid, the field drops highlight but the counter still picks highlight text color. Scope the counter rule to non-invalid too.

-  .pds-textarea__character-counter {
-    background: color-mix(in srgb, var(--pine-color-accent-disabled) 80%, transparent);
-    color: var(--pine-color-purple-700);
-  }
+  // Only apply counter highlight when field is not invalid
+  .pds-textarea__field:not(.is-invalid) ~ .pds-textarea__character-counter {
+    background: color-mix(in srgb, var(--pine-color-accent-disabled) 80%, transparent);
+    color: var(--pine-color-purple-700);
+  }

Optional:

  • Prefer an accent text token (e.g., --pine-color-text-accent) over a specific purple scale to support theming.
libs/core/src/components/pds-textarea/pds-textarea.tsx (1)

153-157: Prop looks good. Add JSDoc details for precedence and default.

Document that highlight is ignored when disabled, readonly, or invalid, and add @DefaultValue for consistency with other props.

   /**
-   * Applies highlight styling to the textarea field.
+   * Applies highlight styling to the textarea field.
+   * Ignored when the component is disabled, readonly, or invalid.
+   * @defaultValue undefined
    */
   @Prop({ reflect: true }) highlight?: boolean;
libs/core/src/components/pds-textarea/test/pds-textarea.spec.tsx (1)

984-1037: Nice highlight spec coverage. Add a couple more cases.

  • Precedence: add tests for readonly and invalid.
  • Parsing: add a case that highlight="false" does not set the attribute.
   describe('highlight', () => {
@@
     it('semantic states take precedence over highlight', async () => {
@@
       expect(textarea?.hasAttribute('disabled')).toBe(true);
     });
+
+    it('ignores highlight when readonly', async () => {
+      const { root } = await newSpecPage({
+        components: [PdsTextarea],
+        html: `<pds-textarea component-id="ta-ro" highlight readonly value="x"></pds-textarea>`,
+      });
+      expect(root?.hasAttribute('highlight')).toBe(true);
+      const textarea = root?.shadowRoot?.querySelector('textarea');
+      expect(textarea?.readOnly).toBe(true);
+    });
+
+    it('ignores highlight when invalid', async () => {
+      const { root } = await newSpecPage({
+        components: [PdsTextarea],
+        html: `<pds-textarea component-id="ta-invalid" highlight invalid error-message="err" value="x"></pds-textarea>`,
+      });
+      expect(root?.hasAttribute('highlight')).toBe(true);
+      const field = root?.shadowRoot?.querySelector('.pds-textarea__field');
+      expect(field?.classList.contains('is-invalid')).toBe(true);
+    });
+
+    it('treats highlight="false" as false', async () => {
+      const { root } = await newSpecPage({
+        components: [PdsTextarea],
+        html: `<pds-textarea component-id="ta-false" highlight="false"></pds-textarea>`,
+      });
+      expect(root?.hasAttribute('highlight')).toBe(false);
+    });
   });
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba80935 and d4745a0.

📒 Files selected for processing (8)
  • libs/core/src/components.d.ts (58 hunks)
  • libs/core/src/components/pds-textarea/docs/pds-textarea.mdx (1 hunks)
  • libs/core/src/components/pds-textarea/pds-textarea.scss (1 hunks)
  • libs/core/src/components/pds-textarea/pds-textarea.tsx (1 hunks)
  • libs/core/src/components/pds-textarea/readme.md (1 hunks)
  • libs/core/src/components/pds-textarea/stories/pds-textarea.stories.js (5 hunks)
  • libs/core/src/components/pds-textarea/test/pds-textarea.e2e.ts (1 hunks)
  • libs/core/src/components/pds-textarea/test/pds-textarea.spec.tsx (2 hunks)
⏰ 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: Cursor Bugbot
  • GitHub Check: Cycode: Vulnerable Dependencies
  • GitHub Check: Cycode: Vulnerable Dependencies
🔇 Additional comments (8)
libs/core/src/components/pds-textarea/test/pds-textarea.spec.tsx (1)

665-665: LGTM on removing explicit false.

Relying on absence of hide-label is cleaner and matches Stencil boolean handling.

libs/core/src/components/pds-textarea/stories/pds-textarea.stories.js (5)

15-15: LGTM!

The highlight prop is correctly added to the default args with an appropriate default value of false.


49-49: LGTM!

The property binding syntax is correct for Lit. Using .highlight (dot prefix) ensures the value is set as a property rather than an attribute, which is the recommended approach for boolean values.


114-121: LGTM!

The new Highlight story effectively demonstrates the highlight feature with a clear example. The pre-populated value helps visualize how the highlighted state appears with content.


158-158: LGTM!

The highlight prop is correctly propagated to the withActionLink story template, ensuring consistency across all story variations.


183-183: LGTM!

The highlight prop is correctly propagated to the withActionButton story template, maintaining consistency across all story variations.

libs/core/src/components.d.ts (2)

1831-1834: LGTM!

The highlight property is correctly added to the Components.PdsTextarea interface with appropriate typing and documentation. The optional marker (?) correctly indicates this is a non-required prop.


4522-4525: LGTM!

The highlight property is correctly added to the LocalJSX.PdsTextarea interface, maintaining consistency with the Components namespace definition. This enables proper TypeScript support when using the component in JSX.

@pixelflips pixelflips changed the title feat(pds-select): add highlight prop and styling feat(pds-textarea): add highlight prop and styling Oct 23, 2025
@pixelflips pixelflips merged commit 06693ac into main Oct 28, 2025
25 of 28 checks passed
@pixelflips pixelflips deleted the feat/pds-textarea-highlight branch October 28, 2025 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core Changes have been made to the Core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants