swatch model

This commit is contained in:
Lone Iversen
2023-02-17 16:25:59 +01:00
parent b820c2f415
commit 0adea4134d
4 changed files with 11 additions and 13 deletions

View File

@@ -146,3 +146,8 @@ export interface DataSourceResponse<T = undefined> {
data?: T;
error?: ProblemDetailsModel;
}
export interface SwatchDetails {
label: string;
value: string;
}

View File

@@ -4,6 +4,7 @@ import { customElement, property } from 'lit/decorators.js';
import { FormControlMixin } from '@umbraco-ui/uui-base/lib/mixins';
import { UUIColorSwatchesEvent } from '@umbraco-ui/uui';
import { UmbLitElement } from '@umbraco-cms/element';
import type { SwatchDetails } from '@umbraco-cms/models';
@customElement('umb-input-color-picker')
export class UmbInputColorPickerElement extends FormControlMixin(UmbLitElement) {
@@ -13,7 +14,7 @@ export class UmbInputColorPickerElement extends FormControlMixin(UmbLitElement)
showLabels = false;
@property()
swatches?: any[];
swatches?: SwatchDetails[];
constructor() {
super();

View File

@@ -4,6 +4,7 @@ import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import { UUIColorSwatchesEvent } from '@umbraco-ui/uui';
import { UmbLitElement } from '@umbraco-cms/element';
import type { DataTypePropertyModel } from '@umbraco-cms/backend-api';
import type { SwatchDetails } from '@umbraco-cms/models';
/**
* @element umb-property-editor-ui-color-picker
@@ -19,7 +20,7 @@ export class UmbPropertyEditorUIColorPickerElement extends UmbLitElement {
private _showLabels = false;
@state()
private _swatches: any[] = [];
private _swatches: SwatchDetails[] = [];
@property({ type: Array, attribute: false })
public set config(config: Array<DataTypePropertyModel>) {

View File

@@ -4,11 +4,7 @@ import './modal-layout-link-picker.element';
import { Meta, Story } from '@storybook/web-components';
import { html } from 'lit';
import type {
UmbModalLayoutLinkPickerElement,
UmbModalLinkPickerData,
UmbModalLinkPickerConfig,
} from './modal-layout-link-picker.element';
import type { UmbModalLayoutLinkPickerElement } from './modal-layout-link-picker.element';
export default {
title: 'API/Modals/Layouts/Link Picker',
@@ -16,14 +12,9 @@ export default {
id: 'modal-layout-link-picker',
} as Meta;
const data: UmbModalLinkPickerConfig = {
hideAnchor: false,
ignoreUserStartNodes: false,
};
export const Overview: Story<UmbModalLayoutLinkPickerElement> = () => html`
<!-- TODO: figure out if generics are allowed for properties:
https://github.com/runem/lit-analyzer/issues/149
https://github.com/runem/lit-analyzer/issues/163 -->
<umb-modal-layout-link-picker .data=${data as any}></umb-modal-layout-link-picker>
<umb-modal-layout-link-picker></umb-modal-layout-link-picker>
`;