Skip to content

feat(icons): allow 3rd party packages to provide icon names for auto completion#3778

Open
jgroth wants to merge 3 commits intomainfrom
autocomplete-icons
Open

feat(icons): allow 3rd party packages to provide icon names for auto completion#3778
jgroth wants to merge 3 commits intomainfrom
autocomplete-icons

Conversation

@jgroth
Copy link
Contributor

@jgroth jgroth commented Jan 16, 2026

fix Lundalogik/crm-client#622

Summary by CodeRabbit

  • Improvements
    • Unified icon typing across components for more consistent icon usage and better IDE autocompletion.
    • Reduced integration friction by standardizing how icons are specified, improving predictability when configuring UI components.

How to test

image

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

📝 Walkthrough

Walkthrough

Introduced an IconName type and registry; updated numerous components and shared types to use IconName (or IconName | Icon) instead of plain string for icon-related public props and interfaces. No runtime behavior or rendering logic changed.

Changes

Cohort / File(s) Summary
Core type definitions
src/global/shared-types/icon.types.ts
Added IconNameRegistry and IconName type; changed Icon.name to IconName.
Shared types updated
src/global/shared-types/file.types.ts
Changed FileInfo.icon from `string
Component props: simple string → IconName
src/components/banner/banner.tsx, src/components/shortcut/shortcut.tsx, src/components/split-button/split-button.tsx, src/components/picker/picker.tsx, src/components/chip-set/chip-set.tsx, src/components/input-field/input-field.tsx
Switched public icon/leadingIcon/trailingIcon prop types from stringIconName; added imports.
Component props: string | Icon → IconName | Icon
src/components/action-bar/action-bar.types.ts, src/components/button/button.tsx, src/components/icon-button/icon-button.tsx, src/components/profile-picture/profile-picture.tsx, src/components/card/card.tsx, src/components/chip/chip.tsx, src/components/collapsible-section/collapsible-section.tsx, src/components/dynamic-label/dynamic-label.tsx, src/components/header/header.tsx, src/components/list-item/list-item.types.ts, src/components/menu/menu.types.ts, src/components/select/option.types.ts, src/components/tab-bar/tab.types.ts, src/components/dynamic-label/label.types.ts, src/components/dock/dock.types.ts, src/components/dialog/dialog.types.ts, src/components/chip-set/chip.types.ts, src/components/card/card.tsx
Updated icon prop/type unions to `IconName
Types used by lists/menus/options
src/components/list-item/list-item.types.ts, src/components/menu/menu.types.ts, src/components/select/option.types.ts, src/components/tab-bar/tab.types.ts, src/components/chip-set/chip.types.ts
Tightened item/option/tab/chip icon fields to `IconName

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

3rd-party, released

Suggested reviewers

  • adrianschmidt
  • Kiarokh
🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ❌ Merge conflicts detected (36 files):

⚔️ CHANGELOG.md (content)
⚔️ etc/lime-elements.api.md (content)
⚔️ package-lock.json (content)
⚔️ package.json (content)
⚔️ sonar-project.properties (content)
⚔️ src/components/action-bar/action-bar.types.ts (content)
⚔️ src/components/banner/banner.tsx (content)
⚔️ src/components/button/button.tsx (content)
⚔️ src/components/card/card.tsx (content)
⚔️ src/components/chip-set/chip-set.tsx (content)
⚔️ src/components/chip-set/chip.types.ts (content)
⚔️ src/components/chip/chip.tsx (content)
⚔️ src/components/collapsible-section/collapsible-section.tsx (content)
⚔️ src/components/dialog/dialog.types.ts (content)
⚔️ src/components/dock/dock.types.ts (content)
⚔️ src/components/dynamic-label/dynamic-label.tsx (content)
⚔️ src/components/dynamic-label/label.types.ts (content)
⚔️ src/components/header/header.tsx (content)
⚔️ src/components/icon-button/icon-button.tsx (content)
⚔️ src/components/input-field/input-field.tsx (content)
⚔️ src/components/list-item/list-item.scss (content)
⚔️ src/components/list-item/list-item.tsx (content)
⚔️ src/components/list-item/list-item.types.ts (content)
⚔️ src/components/menu/menu.types.ts (content)
⚔️ src/components/picker/picker.tsx (content)
⚔️ src/components/profile-picture/profile-picture.tsx (content)
⚔️ src/components/select/option.types.ts (content)
⚔️ src/components/select/select.scss (content)
⚔️ src/components/select/select.template.tsx (content)
⚔️ src/components/select/select.tsx (content)
⚔️ src/components/shortcut/shortcut.tsx (content)
⚔️ src/components/split-button/split-button.tsx (content)
⚔️ src/components/tab-bar/tab.types.ts (content)
⚔️ src/global/shared-types/file.types.ts (content)
⚔️ src/global/shared-types/icon.types.ts (content)
⚔️ stencil.config.ts (content)

These conflicts must be resolved before merging into main.
Resolve conflicts locally and push changes to this branch.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing support for third-party packages to provide icon names for editor autocomplete via the IconName type and IconNameRegistry interface.
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 docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch autocomplete-icons
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch autocomplete-icons
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

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.

@jgroth jgroth force-pushed the autocomplete-icons branch from b4a0507 to 0f3ea9d Compare January 16, 2026 09:23
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

🤖 Fix all issues with AI agents
In `@src/global/shared-types/icon.types.ts`:
- Around line 3-21: Add a Biome ignore comment immediately above the
intentionally empty IconNameRegistry interface to suppress the noEmptyInterface
rule; place a comment like /* biome-ignore no-empty-interface */ directly before
the export interface IconNameRegistry {} declaration so the linter ignores this
specific rule for that empty interface used for module augmentation.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dc434fb and 0f3ea9d.

📒 Files selected for processing (12)
  • src/components/action-bar/action-bar.types.ts
  • src/components/banner/banner.tsx
  • src/components/button/button.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/dock/dock.types.ts
  • src/components/icon-button/icon-button.tsx
  • src/components/input-field/input-field.tsx
  • src/components/picker/picker.tsx
  • src/components/profile-picture/profile-picture.tsx
  • src/components/shortcut/shortcut.tsx
  • src/components/split-button/split-button.tsx
  • src/global/shared-types/icon.types.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.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/input-field/input-field.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/banner/banner.tsx
  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/components/split-button/split-button.tsx
  • src/components/icon-button/icon-button.tsx
  • src/components/button/button.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/input-field/input-field.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/banner/banner.tsx
  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/components/split-button/split-button.tsx
  • src/components/icon-button/icon-button.tsx
  • src/components/button/button.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/input-field/input-field.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/banner/banner.tsx
  • src/components/dock/dock.types.ts
  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/global/shared-types/icon.types.ts
  • src/components/split-button/split-button.tsx
  • src/components/icon-button/icon-button.tsx
  • src/components/action-bar/action-bar.types.ts
  • src/components/button/button.tsx
**/*.{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/input-field/input-field.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/banner/banner.tsx
  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/components/split-button/split-button.tsx
  • src/components/icon-button/icon-button.tsx
  • src/components/button/button.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/input-field/input-field.tsx
  • src/components/chip-set/chip-set.tsx
  • src/components/banner/banner.tsx
  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/components/split-button/split-button.tsx
  • src/components/icon-button/icon-button.tsx
  • src/components/button/button.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: Kiarokh
Repo: Lundalogik/lime-elements PR: 3658
File: src/components/profile-picture/profile-picture.scss:120-124
Timestamp: 2025-09-03T07:17:23.267Z
Learning: Issue `#3666` in the lime-elements repository tracks the removal of a CSS hack in profile-picture component that overrides icon color via --limel-theme-on-surface-color, to be replaced with proper icon color support in limel-icon-button.
📚 Learning: 2025-04-25T13:32:56.396Z
Learnt from: adrianschmidt
Repo: Lundalogik/lime-elements 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.

Applied to files:

  • src/components/banner/banner.tsx
📚 Learning: 2025-04-25T13:32:56.396Z
Learnt from: adrianschmidt
Repo: Lundalogik/lime-elements 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.

Applied to files:

  • src/components/banner/banner.tsx
📚 Learning: 2025-04-17T09:39:36.254Z
Learnt from: adrianschmidt
Repo: Lundalogik/lime-elements 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.

Applied to files:

  • src/components/profile-picture/profile-picture.tsx
  • src/components/picker/picker.tsx
  • src/components/shortcut/shortcut.tsx
  • src/global/shared-types/icon.types.ts
🧬 Code graph analysis (11)
src/components/input-field/input-field.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/chip-set/chip-set.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/banner/banner.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/dock/dock.types.ts (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/profile-picture/profile-picture.tsx (1)
src/global/shared-types/icon.types.ts (2)
  • IconName (31-31)
  • Icon (38-68)
src/components/picker/picker.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/shortcut/shortcut.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/split-button/split-button.tsx (1)
src/global/shared-types/icon.types.ts (1)
  • IconName (31-31)
src/components/icon-button/icon-button.tsx (1)
src/global/shared-types/icon.types.ts (2)
  • IconName (31-31)
  • Icon (38-68)
src/components/action-bar/action-bar.types.ts (1)
src/global/shared-types/icon.types.ts (2)
  • IconName (31-31)
  • Icon (38-68)
src/components/button/button.tsx (1)
src/global/shared-types/icon.types.ts (2)
  • IconName (31-31)
  • Icon (38-68)
🪛 Biome (2.1.2)
src/global/shared-types/icon.types.ts

[error] 21-21: An empty interface is equivalent to {}.

Safe fix: Use a type alias instead.

(lint/suspicious/noEmptyInterface)

⏰ 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). (2)
  • GitHub Check: Docs / Publish Docs
  • GitHub Check: Test
🔇 Additional comments (12)
src/components/action-bar/action-bar.types.ts (1)

1-19: LGTM — IconName integration is consistent.

Line 19 aligns the icon typing with the new IconName registry without changing runtime behavior.

src/global/shared-types/icon.types.ts (1)

38-42: LGTM — Icon.name now uses IconName.

Line 42 correctly aligns Icon with the new IconName type.

src/components/dock/dock.types.ts (1)

1-20: LGTM — DockItem.icon typed as IconName.

Line 20 aligns with the new IconName registry and preserves behavior.

src/components/icon-button/icon-button.tsx (1)

7-28: LGTM — Icon prop now supports IconName | Icon.

Line 28 correctly tightens typing while retaining compatibility.

src/components/banner/banner.tsx (1)

2-24: LGTM — Banner icon now typed as IconName.

Line 24 aligns with the shared IconName type without changing behavior.

src/components/shortcut/shortcut.tsx (1)

5-32: Icon prop typing alignment looks good.

Switching to IconName keeps the runtime behavior intact while aligning the public API with the shared icon typing.

src/components/chip-set/chip-set.tsx (1)

21-21: Leading icon typing update is consistent.

Using IconName for leadingIcon matches the shared icon types and should improve autocomplete without behavioral changes.

Also applies to: 174-174

src/components/button/button.tsx (1)

6-50: Button icon typing update looks correct.

IconName | Icon keeps existing behavior and aligns the public API with the shared icon types.

src/components/split-button/split-button.tsx (1)

4-45: SplitButton icon typing change is consistent.

IconName usage matches the shared icon typing strategy without changing rendering behavior.

src/components/profile-picture/profile-picture.tsx (1)

13-63: ProfilePicture icon typing update looks good.

Switching to IconName | Icon keeps behavior intact while aligning with the shared icon typing.

src/components/picker/picker.tsx (1)

26-26: IconName alignment looks good.

This keeps the prop consistent with the shared icon typing for autocomplete and broader icon registry usage.

Also applies to: 85-85

src/components/input-field/input-field.tsx (1)

28-28: IconName prop typing is consistent and appropriate.

Aligns the input field with the centralized icon type for safer autocomplete.

Also applies to: 135-135, 141-141

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@jgroth jgroth force-pushed the autocomplete-icons branch from 0f3ea9d to b795194 Compare January 16, 2026 09:30
@jgroth jgroth requested a review from a team as a code owner January 16, 2026 09:30
@jgroth jgroth force-pushed the autocomplete-icons branch 2 times, most recently from 74751e3 to b6f4a28 Compare January 16, 2026 10:10
@jgroth jgroth force-pushed the autocomplete-icons branch from b6f4a28 to d6b98cd Compare February 11, 2026 07:37
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.

Caution

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

⚠️ Outside diff range comments (2)
src/components/button/button.tsx (1)

152-152: 🧹 Nitpick | 🔵 Trivial

Update renderIcon parameter type to match the new prop type.

The private method signature still uses string | Icon, but the icon prop is now IconName | Icon. This should be aligned for consistency.

Proposed fix
-    private renderIcon(icon?: string | Icon) {
+    private renderIcon(icon?: IconName | Icon) {
src/components/input-field/input-field.tsx (1)

761-761: 🧹 Nitpick | 🔵 Trivial

Consider updating private helper signatures to use IconName for consistency.

renderLinkIcon and renderTrailingIcon accept icon: string, but they now receive values originating from IconName-typed properties. While this is type-safe (since IconName is assignable to string), updating these private signatures to IconName would keep the typing consistent throughout the file.

Suggested diff
-    private renderLinkIcon = (linkProps: LinkProperties, icon: string) => {
+    private renderLinkIcon = (linkProps: LinkProperties, icon: IconName) => {
-    private renderTrailingIcon = (icon: string) => {
+    private renderTrailingIcon = (icon: IconName) => {

Also applies to: 779-779

@github-actions
Copy link

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Just making CodeRabbit's "outside the diff" comments more visible 🙂

Caution

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

⚠️ Outside diff range comments (2)

src/components/button/button.tsx (1)> 152-152: 🧹 Nitpick | 🔵 Trivial

Update renderIcon parameter type to match the new prop type.
The private method signature still uses string | Icon, but the icon prop is now IconName | Icon. This should be aligned for consistency.

Proposed fix

-    private renderIcon(icon?: string | Icon) {
+    private renderIcon(icon?: IconName | Icon) {

src/components/input-field/input-field.tsx (1)> 761-761: 🧹 Nitpick | 🔵 Trivial

Consider updating private helper signatures to use IconName for consistency.
renderLinkIcon and renderTrailingIcon accept icon: string, but they now receive values originating from IconName-typed properties. While this is type-safe (since IconName is assignable to string), updating these private signatures to IconName would keep the typing consistent throughout the file.

Suggested diff

-    private renderLinkIcon = (linkProps: LinkProperties, icon: string) => {
+    private renderLinkIcon = (linkProps: LinkProperties, icon: IconName) => {
-    private renderTrailingIcon = (icon: string) => {
+    private renderTrailingIcon = (icon: IconName) => {

Also applies to: 779-779

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

🤖 Fix all issues with AI agents
In `@src/components/dynamic-label/label.types.ts`:
- Line 1: The import in label.types.ts is inconsistent: replace the current
import of IconName and Icon from '../../interface' with the same module used
elsewhere ('../../global/shared-types/icon.types') so IconName and Icon are
imported from the direct shared types module; update the import statement that
references IconName and Icon to point to '../../global/shared-types/icon.types'
to match other files (stay mindful of the symbols IconName and Icon and the file
label.types.ts when editing).

In `@src/global/shared-types/file.types.ts`:
- Line 2: The import for Icon and IconName uses an overly verbose path; update
the import in file.types.ts to use the local sibling module path by replacing
the '../../global/shared-types/icon.types' import with './icon.types' so it
matches the other same-directory imports and preserves the Icon and IconName
symbols.

@@ -1,4 +1,4 @@
import { Icon } from '../../interface';
import { IconName, Icon } from '../../interface';
Copy link

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Inconsistent import path compared to other files in this PR.

All other files in this PR import IconName and Icon from '../../global/shared-types/icon.types', but this file imports from '../../interface'. While both are valid relative paths, consider aligning to the direct module path for consistency.

🤖 Prompt for AI Agents
In `@src/components/dynamic-label/label.types.ts` at line 1, The import in
label.types.ts is inconsistent: replace the current import of IconName and Icon
from '../../interface' with the same module used elsewhere
('../../global/shared-types/icon.types') so IconName and Icon are imported from
the direct shared types module; update the import statement that references
IconName and Icon to point to '../../global/shared-types/icon.types' to match
other files (stay mindful of the symbols IconName and Icon and the file
label.types.ts when editing).

@@ -1,5 +1,5 @@
import { MenuItem } from '../../components';
import { Icon } from '../../global/shared-types/icon.types';
import { Icon, IconName } from '../../global/shared-types/icon.types';
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find the actual files
echo "=== Finding file.types.ts ==="
find . -name 'file.types.ts' -type f

echo "=== Finding icon.types.ts ==="
find . -name 'icon.types.ts' -type f

echo "=== Checking directory structure around shared-types ==="
fd --type d 'shared-types' | head -5

Repository: Lundalogik/lime-elements

Length of output: 325


🏁 Script executed:

#!/bin/bash
# Read the file.types.ts to see the actual import
echo "=== Content of src/global/shared-types/file.types.ts (first 20 lines) ==="
cat -n src/global/shared-types/file.types.ts | head -20

Repository: Lundalogik/lime-elements

Length of output: 684


🏁 Script executed:

#!/bin/bash
# Check if other files in the same directory use './icon.types' or the longer path
echo "=== Checking other imports of icon.types in the same directory ==="
rg "from.*icon\.types" src/global/shared-types/ -A 0 -B 0

Repository: Lundalogik/lime-elements

Length of output: 243


🏁 Script executed:

#!/bin/bash
# Check all imports within shared-types files to see the pattern used
echo "=== All imports in files within src/global/shared-types/ ==="
rg "^import.*from" src/global/shared-types/*.ts | head -30

Repository: Lundalogik/lime-elements

Length of output: 563


Simplify the relative import path for consistency.

This file uses simplified relative imports (./color.types, ./separator.types) for other same-directory imports, but uses an unnecessarily verbose path for icon.types. Since both files are in src/global/shared-types/, use ./icon.types instead of ../../global/shared-types/icon.types to match the pattern used elsewhere in the file.

Proposed fix
-import { Icon, IconName } from '../../global/shared-types/icon.types';
+import { Icon, IconName } from './icon.types';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { Icon, IconName } from '../../global/shared-types/icon.types';
import { Icon, IconName } from './icon.types';
🤖 Prompt for AI Agents
In `@src/global/shared-types/file.types.ts` at line 2, The import for Icon and
IconName uses an overly verbose path; update the import in file.types.ts to use
the local sibling module path by replacing the
'../../global/shared-types/icon.types' import with './icon.types' so it matches
the other same-directory imports and preserves the Icon and IconName symbols.

@adrianschmidt
Copy link
Contributor

@jgroth, do you want me to ask @adrianschmidt-bot to finish this one for you?

@adrianschmidt-bot
Copy link
Contributor

I went through the review comments and prepared fixes for all of them. However, since this branch lives on the upstream repo (not our fork), I don't have push access. Here's what I've prepared:

Fixes addressing all 4 review comments:

  1. label.types.ts — Changed import from '../../interface' to '../../global/shared-types/icon.types' for consistency with all other files in this PR
  2. file.types.ts — Changed import from '../../global/shared-types/icon.types' to './icon.types' (sibling import, matching other same-directory imports)
  3. input-field.tsx — Updated renderLinkIcon and renderTrailingIcon parameter types from string to IconName for consistency
  4. icon.types.ts Biome comment — Not applicable; this project doesn't use Biome
Full diff (apply with git apply)
diff --git a/src/components/dynamic-label/label.types.ts b/src/components/dynamic-label/label.types.ts
index be7720b51..3b1c5e812 100644
--- a/src/components/dynamic-label/label.types.ts
+++ b/src/components/dynamic-label/label.types.ts
@@ -1,4 +1,4 @@
-import { IconName, Icon } from '../../interface';
+import { IconName, Icon } from '../../global/shared-types/icon.types';
 
 export type LabelValue = string | number | boolean | null | undefined;
 
diff --git a/src/components/input-field/input-field.tsx b/src/components/input-field/input-field.tsx
index 27ab461f6..bf6a32a4e 100644
--- a/src/components/input-field/input-field.tsx
+++ b/src/components/input-field/input-field.tsx
@@ -758,7 +758,7 @@ export class InputField {
         return props;
     };
 
-    private renderLinkIcon = (linkProps: LinkProperties, icon: string) => {
+    private renderLinkIcon = (linkProps: LinkProperties, icon: IconName) => {
         // If the trailing icon uses the class `mdc-text-field__icon--trailing`,
         // MDC attaches a click handler to it, which apparently runs
         // `preventDefault()` on the event. For links, we don't want that,
@@ -776,7 +776,7 @@ export class InputField {
         );
     };
 
-    private renderTrailingIcon = (icon: string) => {
+    private renderTrailingIcon = (icon: IconName) => {
         if (this.isInvalid()) {
             return (
                 <i
diff --git a/src/global/shared-types/file.types.ts b/src/global/shared-types/file.types.ts
index c4ffc0ad9..03bdf66ec 100644
--- a/src/global/shared-types/file.types.ts
+++ b/src/global/shared-types/file.types.ts
@@ -1,5 +1,5 @@
 import { MenuItem } from '../../components';
-import { Icon, IconName } from '../../global/shared-types/icon.types';
+import { Icon, IconName } from './icon.types';
 import { Color } from './color.types';
 import { ListSeparator } from './separator.types';

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.

3 participants