add number range property editor ui

This commit is contained in:
Mads Rasmussen
2023-01-10 08:58:51 +01:00
parent e08a4139df
commit 0ccd622e01
5 changed files with 81 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import { manifest as markdownEditor } from './markdown-editor/manifests';
import { manifest as radioButtonList } from './radio-button-list/manifests';
import { manifest as checkboxList } from './checkbox-list/manifests';
import { manifest as blockList } from './block-list/manifests';
import { manifest as numberRange } from './number-range/manifests';
import type { ManifestPropertyEditorUI } from '@umbraco-cms/models';
@@ -40,6 +41,7 @@ export const manifests: Array<ManifestPropertyEditorUI> = [
radioButtonList,
checkboxList,
blockList,
numberRange,
{
type: 'propertyEditorUI',
alias: 'Umb.PropertyEditorUI.Number',

View File

@@ -0,0 +1,14 @@
import type { ManifestPropertyEditorUI } from '@umbraco-cms/models';
export const manifest: ManifestPropertyEditorUI = {
type: 'propertyEditorUI',
alias: 'Umb.PropertyEditorUI.NumberRange',
name: 'Number Range Property Editor UI',
loader: () => import('./property-editor-ui-number-range.element'),
meta: {
label: 'Number Range',
propertyEditorModel: '',
icon: 'umb:autofill',
group: 'common',
},
};

View File

@@ -0,0 +1,29 @@
import { html, LitElement } from 'lit';
import { UUITextStyles } from '@umbraco-ui/uui-css/lib';
import { customElement, property } from 'lit/decorators.js';
/**
* @element umb-property-editor-ui-number-range
*/
@customElement('umb-property-editor-ui-number-range')
export class UmbPropertyEditorUINumberRangeElement extends LitElement {
static styles = [UUITextStyles];
@property()
value = '';
@property({ type: Array, attribute: false })
public config = [];
render() {
return html`<div>umb-property-editor-ui-number-range</div>`;
}
}
export default UmbPropertyEditorUINumberRangeElement;
declare global {
interface HTMLElementTagNameMap {
'umb-property-editor-ui-number-range': UmbPropertyEditorUINumberRangeElement;
}
}

View File

@@ -0,0 +1,15 @@
import { Meta, Story } from '@storybook/web-components';
import { html } from 'lit-html';
import type { UmbPropertyEditorUINumberRangeElement } from './property-editor-ui-number-range.element';
import './property-editor-ui-number-range.element';
export default {
title: 'Property Editor UIs/Number Range',
component: 'umb-property-editor-ui-number-range',
id: 'umb-property-editor-ui-number-range',
} as Meta;
export const AAAOverview: Story<UmbPropertyEditorUINumberRangeElement> = () =>
html`<umb-property-editor-ui-number-range></umb-property-editor-ui-number-range>`;
AAAOverview.storyName = 'Overview';

View File

@@ -0,0 +1,21 @@
import { expect, fixture, html } from '@open-wc/testing';
import { UmbPropertyEditorUINumberRangeElement } from './property-editor-ui-number-range.element';
import { defaultA11yConfig } from '@umbraco-cms/test-utils';
describe('UmbPropertyEditorUINumberRangeElement', () => {
let element: UmbPropertyEditorUINumberRangeElement;
beforeEach(async () => {
element = await fixture(
html` <umb-property-editor-ui-number-range></umb-property-editor-ui-number-range> `
);
});
it('is defined with its own instance', () => {
expect(element).to.be.instanceOf(UmbPropertyEditorUINumberRangeElement);
});
it('passes the a11y audit', async () => {
await expect(element).shadowDom.to.be.accessible(defaultA11yConfig);
});
});