Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,7 @@ export class UmbIconPickerModalElement extends UmbModalBaseElement<UmbIconPicker
<umb-body-layout headline=${this.localize.term('defaultdialogs_selectIcon')}>
<div id="container">
${this.renderSearch()}
<hr />
<uui-color-swatches
value=${ifDefined(this.value.color)}
label=${this.localize.term('defaultdialogs_colorSwitcher')}
@change=${this.#onColorChange}>
${
// TODO: Missing localization for the color aliases. [NL]
this._colorList.map(
(color) => html`
<uui-color-swatch
label=${color.alias}
title=${color.alias}
value=${color.alias}
style="--uui-swatch-color: var(${color.varName})">
</uui-color-swatch>
`,
)
}
</uui-color-swatches>
<hr />
${this.renderColors()}
<uui-scroll-container id="icons">
${this.data?.showEmptyOption && !this._isSearching
? html`
Expand Down Expand Up @@ -144,9 +125,35 @@ export class UmbIconPickerModalElement extends UmbModalBaseElement<UmbIconPicker
${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.
? nothing
: html`<uui-color-swatches
value=${ifDefined(this.value.color)}
label=${this.localize.term('defaultdialogs_colorSwitcher')}
@change=${this.#onColorChange}>
${
// TODO: Missing localization for the color aliases. [NL]
this._colorList.map(
(color) => html`
<uui-color-swatch
label=${color.alias}
title=${color.alias}
value=${color.alias}
style="--uui-swatch-color: var(${color.varName})">
</uui-color-swatch>
`,
)
}
</uui-color-swatches>
<hr />
`;
}

renderIcons() {
return this._iconsFiltered
? repeat(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { UmbModalToken } from '@umbraco-cms/backoffice/modal';
export interface UmbIconPickerModalData {
placeholder?: string;
showEmptyOption?: boolean;
hideColors?: boolean;
}

export interface UmbIconPickerModalValue {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ export const manifests: Array<UmbExtensionManifest> = [
description: 'Icon name to show when no icon is selected',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.IconPicker',
},
{
alias: 'hideColors',
label: 'Hide colors',
description: 'Hide color swatches from modal',
propertyEditorUiAlias: 'Umb.PropertyEditorUi.Toggle',
},
],
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,14 @@ export class UmbPropertyEditorUIIconPickerElement
@state()
private _placeholderIcon = '';

@state()
private _hideColors = false;

public set config(config: UmbPropertyEditorConfigCollection | undefined) {
if (!config) return;
const placeholder = config.getValueByAlias('placeholder');
this._placeholderIcon = typeof placeholder === 'string' ? placeholder : '';
this._hideColors = config.getValueByAlias('hideColors') as boolean;
}

private async _openModal() {
Expand All @@ -70,7 +74,7 @@ export class UmbPropertyEditorUIIconPickerElement
icon: this._icon,
color: this._color,
},
data: { placeholder: this._placeholderIcon, showEmptyOption: !this.mandatory },
data: { placeholder: this._placeholderIcon, showEmptyOption: !this.mandatory, hideColors: this._hideColors },
}).catch(() => undefined);

if (!data) return;
Expand Down
Loading