Skip to content

feat: add valuePrefix and valueSuffix properties as replacements for deprecated prefix and suffix#3969

Open
adrianschmidt-bot wants to merge 4 commits intoLundalogik:mainfrom
adrianschmidt-bot:feat/3917-rename-prefix-suffix
Open

feat: add valuePrefix and valueSuffix properties as replacements for deprecated prefix and suffix#3969
adrianschmidt-bot wants to merge 4 commits intoLundalogik:mainfrom
adrianschmidt-bot:feat/3917-rename-prefix-suffix

Conversation

@adrianschmidt-bot
Copy link
Contributor

@adrianschmidt-bot adrianschmidt-bot commented Mar 21, 2026

Summary

This PR implements Phase 1 of issue #3917 by introducing new valuePrefix and valueSuffix properties for the three affected components while maintaining backward compatibility.

What's Changed

🎯 Components Updated

  • limel-circular-progress: Added valuePrefix and valueSuffix props
  • limel-info-tile: Added valuePrefix and valueSuffix props
  • limel-input-field: Added valuePrefix and valueSuffix props
  • InfoTileProgress interface: Added valuePrefix and valueSuffix properties

⚡ Implementation Details

  • Fallback logic: Components prefer new props but fall back to old ones (this.valuePrefix ?? this.prefix)
  • Reflection: New properties are properly reflected as value-prefix and value-suffix attributes
  • Deprecation warnings: Runtime console.warn messages guide developers to migrate
  • JSDoc deprecation: Old properties marked with @deprecated tags
  • Full backward compatibility: All existing code continues to work unchanged

📚 Documentation & Examples

  • All component examples updated to use new property names
  • Documentation reflects best practices with new properties

Why This Approach?

The new valuePrefix/valueSuffix names clearly indicate their purpose (prefixing/suffixing the value display) while avoiding the collision with the native HTML prefix attribute used by RDFa.

Testing

  • ✅ All existing tests pass
  • ✅ Lint checks pass
  • ✅ No breaking changes
  • ✅ Deprecation warnings work as expected

Migration Path

Developers can migrate at their own pace:

// Old (still works, but shows warning)
<limel-input-field prefix="$" suffix="USD" />

// New (recommended)
<limel-input-field valuePrefix="$" valueSuffix="USD" />

Closes #3917 (Phase 1)

Summary by CodeRabbit

  • New Features

    • Added valuePrefix and valueSuffix props across components to control displayed value adornments.
  • Deprecations

    • prefix and suffix props deprecated; runtime console warnings will notify when legacy props are used.
  • Accessibility

    • ARIA value text improved to reflect the effective prefix/suffix and abbreviated values (with sensible suffix fallback).
  • Examples

    • Updated example usages to the new valuePrefix/valueSuffix prop names.
  • Chores

    • Markdown allowlist updated to permit value-prefix/value-suffix attributes.

…deprecated prefix and suffix

This introduces new 'valuePrefix' and 'valueSuffix' properties for limel-circular-progress,
limel-info-tile, and limel-input-field components to resolve conflicts with the native HTML
'prefix' attribute (RDFa global attribute).

The new properties follow the same behavior as the existing ones while providing clearer
semantics. The old 'prefix' and 'suffix' properties remain functional but are marked as
deprecated with runtime warnings to guide consumers toward migration.

Changes:
- Add valuePrefix and valueSuffix props to all three components with reflection support
- Update InfoTileProgress interface with new properties
- Implement fallback logic (valuePrefix ?? prefix) throughout components
- Mark old properties with @deprecated JSDoc tags
- Add console.warn for deprecated property usage with migration guidance
- Update all examples and documentation to use new property names

fix: Lundalogik#3917
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: abe078d3-9600-4355-97cf-f812dc9f655a

📥 Commits

Reviewing files that changed from the base of the PR and between 043a688 and 3742fb8.

📒 Files selected for processing (3)
  • src/components/circular-progress/circular-progress.tsx
  • src/components/circular-progress/examples/circular-progress-css-variables.tsx
  • src/components/markdown/default-whitelist.ts

📝 Walkthrough

Walkthrough

Adds valuePrefix/valueSuffix props across several components and types, deprecates prefix/suffix with JSDoc and runtime warnings, updates component rendering and ARIA to prefer new props, and updates examples and markdown whitelist to use the new attribute names. (Non-breaking migration changes.)

Changes

Cohort / File(s) Summary
Core components
src/components/circular-progress/circular-progress.tsx, src/components/info-tile/info-tile.tsx, src/components/input-field/input-field.tsx
Added public valuePrefix/valueSuffix; marked legacy prefix/suffix as @deprecated; compute effective values via value* ?? prefix/suffix; added runtime console.warn (watchers/componentWillLoad); updated rendering and ARIA usage (use aria-valuetext).
Type definitions
src/components/info-tile/info-tile.types.ts
Added valuePrefix? and valueSuffix? to InfoTileProgress; documented existing prefix/suffix as @deprecated.
Examples — circular-progress
src/components/circular-progress/examples/circular-progress-props.tsx, src/components/circular-progress/examples/circular-progress-css-variables.tsx
Replaced prefix/suffix attributes with valuePrefix/valueSuffix in example usages.
Examples — info-tile
src/components/info-tile/examples/info-tile.tsx, .../info-tile-badge.tsx, .../info-tile-loading.tsx, .../info-tile-primary-slot.tsx, .../info-tile-progress.tsx, .../info-tile-styling.tsx
Updated example JSX and example progress objects to use valuePrefix/valueSuffix instead of prefix/suffix.
Examples — input-field
src/components/input-field/examples/input-field-number-prefix.tsx, src/components/input-field/examples/input-field-text-suffix.tsx
Replaced prefix/suffix with valuePrefix/valueSuffix in examples.
Markdown allowlist
src/components/markdown/default-whitelist.ts
Added value-prefix and value-suffix to allowed attributes for limel-circular-progress and limel-info-tile; reformatted attribute arrays.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

maintenance, docs

Suggested reviewers

  • adrianschmidt
  • jgroth
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding valuePrefix and valueSuffix properties as replacements for deprecated prefix and suffix across components.
Linked Issues check ✅ Passed The PR implementation fully addresses Phase 1 objectives from #3917: new valuePrefix/valueSuffix props added to limel-circular-progress, limel-info-tile, limel-input-field, and InfoTileProgress; deprecated props marked @deprecated with runtime warnings; fallback logic implemented; examples and docs updated.
Out of Scope Changes check ✅ Passed All changes are directly aligned with Phase 1 objectives: introducing new props, deprecating old ones, adding warnings, updating examples/docs, and whitelist updates for markdown. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@adrianschmidt-bot
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

✅ 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.

Copy link
Contributor

@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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
src/components/info-tile/info-tile.tsx (1)

109-114: ⚠️ Potential issue | 🟡 Minor

Update the progress docs to use valueSuffix.

The defaults block still points readers at suffix, so the public API docs will keep advertising the deprecated field instead of the new one.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/info-tile/info-tile.tsx` around lines 109 - 114, The JSDoc for
the progress prop still documents the deprecated `suffix` instead of the new
`valueSuffix`; update the defaults block in the `progress` docs to reference
`valueSuffix` (and remove or mark `suffix` as deprecated) so generated public
API docs advertise `valueSuffix` correctly; look for the `progress` prop JSDoc
in info-tile (info-tile.tsx) and replace `suffix` with `valueSuffix` in the
Defaults list (and ensure `displayPercentageColors`/`maxValue` remain correct).
src/components/circular-progress/circular-progress.tsx (1)

113-124: ⚠️ Potential issue | 🟠 Major

Don't hardcode the progressbar label to percent.

With the new valueSuffix examples covering degrees, seconds, stars, and other units, aria-label="%" on Line 120 will misannounce non-percent scales to assistive tech. Prefer an accessible value/label derived from effectivePrefix, value, and effectiveSuffix.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/circular-progress/circular-progress.tsx` around lines 113 -
124, The ARIA label is hardcoded to "%" which misrepresents non-percent units;
update the circular-progress element to build an accessible label/text from
effectivePrefix, this.value, and effectiveSuffix (use the already-computed
effectivePrefix and effectiveSuffix variables and this.value) and set that
string to aria-label (or aria-valuetext) instead of "%" so assistive tech
announces the correct unit and value; ensure you update the JSX/TSX return where
class={classList} and role="progressbar" are set.
src/components/info-tile/examples/info-tile-styling.tsx (1)

28-45: 🛠️ Refactor suggestion | 🟠 Major

Use <Host> instead of returning an array literal from render().

Multiple top-level JSX elements must be wrapped in the <Host> element, not an array literal.

public render() {
    return (
        <Host>
            <limel-info-tile
                icon="electricity"
                label="Average weekly usage"
                value={this.value}
                valueSuffix="kWh"
                badge={this.badge}
            />
            <limel-info-tile
                label="Average weekly usage"
                icon="electricity"
                value={this.value}
                valueSuffix="kWh"
                progress={this.progress}
                valuePrefix="↑"
            />
        </Host>
    );
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/info-tile/examples/info-tile-styling.tsx` around lines 28 -
45, The render method currently returns an array of two top-level JSX elements;
replace that array return in the render() function with a single <Host> wrapper
that contains both <limel-info-tile> elements so multiple top-level nodes are
valid; update the render() implementation that references this.value, this.badge
and this.progress to return a single <Host> containing the two <limel-info-tile>
instances instead of returning an array literal.
src/components/circular-progress/examples/circular-progress-props.tsx (1)

34-61: ⚠️ Potential issue | 🟡 Minor

Use <Host> instead of returning [] from render().

The render method returns multiple top-level elements wrapped in an array literal. Per the coding guidelines, wrap them in <Host> (imported from @stencil/core) instead. Add Host to the import statement and refactor the render method accordingly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/circular-progress/examples/circular-progress-props.tsx` around
lines 34 - 61, The render() method currently returns an array of
limel-circular-progress elements; change it to return a single <Host> wrapper
containing those elements and add Host to the import from `@stencil/core` (update
the import statement to include Host) so the JSX uses <Host>...</Host> instead
of returning [] in render().
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/circular-progress/circular-progress.tsx`:
- Around line 96-111: Move the deprecation console.warn calls out of render()
into a lifecycle hook (componentWillLoad or componentDidLoad) so they execute
only once per instance; specifically check this.prefix and the deprecated
this.suffix logic there (preserve the same conditions) and remove them from
render(). Also update the aria-label usage in the render output (currently
hardcoded as "%") to use the computed effectiveSuffix (e.g., use effectiveSuffix
or a derived variable instead of "%") so the screen reader reflects valueSuffix
when provided.

In `@src/components/info-tile/info-tile.tsx`:
- Around line 299-311: The component is passing computed
effectiveProgressPrefix/effectiveProgressSuffix into both the new
valuePrefix/valueSuffix and the deprecated prefix/suffix props, which forces
migrated callers through the deprecation path; change the JSX for
limel-circular-progress so valuePrefix/valueSuffix use
effectiveProgressPrefix/effectiveProgressSuffix, but the legacy prefix/suffix
props receive the raw originals (this.progress.prefix and this.progress.suffix)
or are omitted when undefined—stop passing
effectiveProgressPrefix/effectiveProgressSuffix into the deprecated
prefix/suffix attributes to avoid nested deprecation handling.
- Around line 143-153: The deprecation console.warn calls in render() (for the
prefix and suffix props) and in renderProgress() are firing on every render;
remove those console.warns from both render methods and instead emit the
warnings once during component initialization or on prop change by implementing
them in componentWillLoad() or with `@Watch`() handlers. Specifically, move the
prefix/suffix warnings out of render() into componentWillLoad(), or add
`@Watch`('prefix') and `@Watch`('suffix') methods that log when the value becomes
non-null/undefined; do the same for the progress-related deprecation warnings
currently in renderProgress() (implement `@Watch` handlers or check once in
componentWillLoad()), and ensure to import and use the Watch decorator if you
choose that approach.

In `@src/components/input-field/input-field.tsx`:
- Around line 363-373: Move the deprecation console.warn calls out of render()
and into a lifecycle hook that runs once per component instance (e.g.,
componentWillLoad()) to avoid logging on every re-render; locate the checks
referencing this.prefix and this.suffix in render() and relocate them to
componentWillLoad() (or add an instance-level boolean like hasLoggedDeprecation
to guard logging) and keep the same messages recommending
valuePrefix/valueSuffix so warnings are emitted only once.

---

Outside diff comments:
In `@src/components/circular-progress/circular-progress.tsx`:
- Around line 113-124: The ARIA label is hardcoded to "%" which misrepresents
non-percent units; update the circular-progress element to build an accessible
label/text from effectivePrefix, this.value, and effectiveSuffix (use the
already-computed effectivePrefix and effectiveSuffix variables and this.value)
and set that string to aria-label (or aria-valuetext) instead of "%" so
assistive tech announces the correct unit and value; ensure you update the
JSX/TSX return where class={classList} and role="progressbar" are set.

In `@src/components/circular-progress/examples/circular-progress-props.tsx`:
- Around line 34-61: The render() method currently returns an array of
limel-circular-progress elements; change it to return a single <Host> wrapper
containing those elements and add Host to the import from `@stencil/core` (update
the import statement to include Host) so the JSX uses <Host>...</Host> instead
of returning [] in render().

In `@src/components/info-tile/examples/info-tile-styling.tsx`:
- Around line 28-45: The render method currently returns an array of two
top-level JSX elements; replace that array return in the render() function with
a single <Host> wrapper that contains both <limel-info-tile> elements so
multiple top-level nodes are valid; update the render() implementation that
references this.value, this.badge and this.progress to return a single <Host>
containing the two <limel-info-tile> instances instead of returning an array
literal.

In `@src/components/info-tile/info-tile.tsx`:
- Around line 109-114: The JSDoc for the progress prop still documents the
deprecated `suffix` instead of the new `valueSuffix`; update the defaults block
in the `progress` docs to reference `valueSuffix` (and remove or mark `suffix`
as deprecated) so generated public API docs advertise `valueSuffix` correctly;
look for the `progress` prop JSDoc in info-tile (info-tile.tsx) and replace
`suffix` with `valueSuffix` in the Defaults list (and ensure
`displayPercentageColors`/`maxValue` remain correct).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 83baefa3-5576-4052-aa06-870a713a0548

📥 Commits

Reviewing files that changed from the base of the PR and between 6053de0 and 2770605.

📒 Files selected for processing (13)
  • src/components/circular-progress/circular-progress.tsx
  • src/components/circular-progress/examples/circular-progress-props.tsx
  • src/components/info-tile/examples/info-tile-badge.tsx
  • src/components/info-tile/examples/info-tile-loading.tsx
  • src/components/info-tile/examples/info-tile-primary-slot.tsx
  • src/components/info-tile/examples/info-tile-progress.tsx
  • src/components/info-tile/examples/info-tile-styling.tsx
  • src/components/info-tile/examples/info-tile.tsx
  • src/components/info-tile/info-tile.tsx
  • src/components/info-tile/info-tile.types.ts
  • src/components/input-field/examples/input-field-number-prefix.tsx
  • src/components/input-field/examples/input-field-text-suffix.tsx
  • src/components/input-field/input-field.tsx

…ts for deprecated prefix and suffix

address CodeRabbit review: move deprecation warnings to lifecycle hooks, fix aria-label, update JSDoc, fix nested deprecation
@adrianschmidt-bot
Copy link
Contributor Author

CodeRabbit review — addressed

Fixed (⚡ 32ceb09):

  • Moved all deprecation console.warn calls out of render() into componentWillLoad() + @Watch handlers (circular-progress, info-tile, input-field)
  • Fixed hardcoded aria-label="%" in circular-progress → now uses computed aria-valuetext from effective prefix/value/suffix
  • Updated progress JSDoc in info-tile to reference valueSuffix instead of deprecated suffix
  • Removed deprecated prefix/suffix prop pass-through in info-tile's renderProgress() to avoid nested deprecation warnings

Declined — <Host> vs array returns in examples:
The array return pattern (return [...]) is used across dozens of existing example components in this codebase. Changing it in just these two examples would be inconsistent. If we want to adopt <Host> wrapping, that should be a separate cleanup across all examples.

@adrianschmidt-bot
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

✅ 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.

Copy link
Contributor

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/circular-progress/circular-progress.tsx`:
- Around line 63-73: The props valuePrefix and valueSuffix have inconsistent
defaults (valuePrefix is explicitly initialized to null while valueSuffix is
left undefined); to align them, make their defaults consistent—e.g., set
valueSuffix to null (or change valuePrefix to undefined) so both props use the
same sentinel value and the existing checks (!== null && !== undefined) remain
correct; update the declarations for valuePrefix/valueSuffix accordingly
(referencing the Prop-decorated fields valuePrefix and valueSuffix in
circular-progress.tsx).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: abe0ce48-a589-46ed-ad02-d5b67eaf43ae

📥 Commits

Reviewing files that changed from the base of the PR and between 2770605 and 32ceb09.

📒 Files selected for processing (3)
  • src/components/circular-progress/circular-progress.tsx
  • src/components/info-tile/info-tile.tsx
  • src/components/input-field/input-field.tsx

…ts for deprecated prefix and suffix

fixup! feat: add valuePrefix and valueSuffix properties as replacements for deprecated prefix and suffix

Make valuePrefix default consistent with valueSuffix (both undefined)
@adrianschmidt-bot
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

✅ 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.

Copy link
Contributor

@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: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/circular-progress/circular-progress.tsx`:
- Around line 66-73: The markdown whitelist is missing the reflected attribute
names for the circular progress component: add "value-prefix" and "value-suffix"
to the allowed attributes for limel-circular-progress in
src/components/markdown/default-whitelist.ts while keeping the existing "prefix"
and "suffix" entries for the deprecation period; update the whitelist entries so
both the new reflected attribute names (value-prefix/value-suffix) and the old
names (prefix/suffix) are present and accepted for limel-circular-progress,
ensuring the component properties valuePrefix and valueSuffix continue to work
when rendered from markdown.
- Around line 63-67: The example still uses the deprecated prefix attribute on
the limel-circular-progress tag; update the example to use the new valuePrefix
prop instead. Locate the example that renders <limel-circular-progress
prefix="↗" ...> and change the attribute to valuePrefix="↗", and update any
surrounding example text/comment that describes the prop to mention valuePrefix
(and demonstrate its behavior) so the docs no longer reference the deprecated
API and show the new prop usage. Ensure the component usage and wording in the
example match the new `@Prop` public valuePrefix?: string declaration.
- Around line 101-108: The deprecation guard in warnIfDeprecatedSuffix currently
suppresses the warning when valueSuffix is present; update the conditional in
the `@Watch`('suffix') method (warnIfDeprecatedSuffix) to remove the
"this.valueSuffix === undefined" clause so the warning still triggers when a
user explicitly sets suffix (except for the implicit '%' case). Keep the
existing checks for this.suffix !== '%' and null/undefined checks, and ensure
the method emits the deprecation warning when suffix is explicitly provided even
if valueSuffix is also set.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 0d454498-f091-4335-852a-f4cb52862bb2

📥 Commits

Reviewing files that changed from the base of the PR and between 32ceb09 and 043a688.

📒 Files selected for processing (1)
  • src/components/circular-progress/circular-progress.tsx

…ts for deprecated prefix and suffix

fixup! feat: add valuePrefix and valueSuffix properties as replacements for deprecated prefix and suffix

- Update circular-progress CSS variables example to use valuePrefix
- Add value-prefix/value-suffix to markdown whitelist for both
  circular-progress and info-tile
- Remove valueSuffix===undefined guard from suffix deprecation warning
  so warning fires when both suffix and valueSuffix are set
@adrianschmidt-bot
Copy link
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

✅ 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.

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.

Rename prefix and suffix properties to avoid collision with native HTML attribute

1 participant