Skip to content

Conversation

@bjarnef
Copy link
Contributor

@bjarnef bjarnef commented Oct 25, 2025

Prerequisites

  • I have added steps to test this contribution in the description below

If there's an existing issue for this PR then this fixes

Description

This PR fix part of the discussion in #20647 and add the option to hide colors from icon picker, which was previously available in the old backoffice UI: #13079

It would be great if we furthermore can pass in an arrray of color/swatch modal to override the umbracoColors array, but I still think it is useful explicit to hide colors even though colors may be defined.

Example:

const modalContext = modalManager.open(this, UMB_ICON_PICKER_MODAL, {
  value: {
    icon: alias,
    color: color,
  },
  data: { hideColors: true }
});
image

or via configuration of Umb.PropertyEditorUi.IconPicker.

{
  alias: 'icon',
  label: 'Workspace View icon',
  description: "The icon for the Collection's Workspace View.",
  propertyEditorUiAlias: 'Umb.PropertyEditorUi.IconPicker',
  config: [
    { alias: 'placeholder', value: 'icon-grid' },
    { alias: 'hideColors', value: true },
  ],
}
image

Copilot AI review requested due to automatic review settings October 25, 2025 16:38
@github-actions
Copy link

Hi there @bjarnef, thank you for this contribution! 👍

While we wait for one of the Core Collaborators team to have a look at your work, we wanted to let you know about that we have a checklist for some of the things we will consider during review:

  • It's clear what problem this is solving, there's a connected issue or a description of what the changes do and how to test them
  • The automated tests all pass (see "Checks" tab on this PR)
  • The level of security for this contribution is the same or improved
  • The level of performance for this contribution is the same or improved
  • Avoids creating breaking changes; note that behavioral changes might also be perceived as breaking
  • If this is a new feature, Umbraco HQ provided guidance on the implementation beforehand
  • 💡 The contribution looks original and the contributor is presumably allowed to share it

Don't worry if you got something wrong. We like to think of a pull request as the start of a conversation, we're happy to provide guidance on improving your contribution.

If you realize that you might want to make some changes then you can do that by adding new commits to the branch you created for this work and pushing new commits. They should then automatically show up as updates to this pull request.

Thanks, from your friendly Umbraco GitHub bot 🤖 🙂

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 adds the ability to hide the color picker section in the icon picker modal, restoring functionality that existed in the old backoffice UI. This allows developers to programmatically hide colors when opening the icon picker modal by setting hideColors: true in the modal data.

Key Changes:

  • Added hideColors property to the icon picker property editor and modal interfaces
  • Refactored color picker rendering into a conditional renderColors() method

Reviewed Changes

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

File Description
property-editor-ui-icon-picker.element.ts Adds hideColors property and passes it to the modal data
icon-picker-modal.token.ts Extends modal data interface with optional hideColors boolean field
icon-picker-modal.element.ts Refactors color picker rendering into conditional method that respects hideColors flag

${umbFocus()}>
<uui-icon name="search" slot="prepend" id="search_icon"></uui-icon>
</uui-input>
<hr />
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

The <hr /> separator after the search input should only render when colors are visible. Currently, it renders even when hideColors is true, creating an unnecessary visual separator. Move this line inside the renderColors() method before the color swatches to ensure it only appears when colors are shown.

Copilot uses AI. Check for mistakes.
}

renderColors() {
return this.data?.hideColors === true
Copy link

Copilot AI Oct 25, 2025

Choose a reason for hiding this comment

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

The explicit === true comparison is redundant since hideColors is already a boolean. Simplify to return this.data?.hideColors ? nothing : html\...` for cleaner code.

Suggested change
return this.data?.hideColors === true
return this.data?.hideColors

Copilot uses AI. Check for mistakes.
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.

1 participant