@umbraco-ui/uui-form-layout-item 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +31 -0
- package/custom-elements.json +37 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +84 -0
- package/lib/uui-form-layout-item.element.d.ts +21 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 uui-app
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# uui-form-layout-item
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Umbraco style uui-form-layout-item component.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
### ES imports
|
|
10
|
+
|
|
11
|
+
```zsh
|
|
12
|
+
npm i @umbraco-ui/uui-form-layout-item
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Import the registration of `<uui-form-layout-item>` via:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import '@umbraco-ui/uui-form-layout-item/';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
When looking to leverage the `UUIFormLayoutItemElement` base class as a type and/or for extension purposes, do so via:
|
|
22
|
+
|
|
23
|
+
```javascript
|
|
24
|
+
import { UUIFormLayoutItemElement } from '@umbraco-ui/uui-form-layout-item';
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<uui-form-layout-item></uui-form-layout-item>
|
|
31
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "experimental",
|
|
3
|
+
"tags": [
|
|
4
|
+
{
|
|
5
|
+
"name": "uui-form-layout-item",
|
|
6
|
+
"path": "./lib/uui-form-layout-item.element.ts",
|
|
7
|
+
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "description",
|
|
10
|
+
"type": "string | null"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"properties": [
|
|
14
|
+
{
|
|
15
|
+
"name": "styles",
|
|
16
|
+
"type": "CSSResult[]",
|
|
17
|
+
"default": "[null]"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"name": "description",
|
|
21
|
+
"attribute": "description",
|
|
22
|
+
"type": "string | null"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"slots": [
|
|
26
|
+
{
|
|
27
|
+
"name": "",
|
|
28
|
+
"description": "for button contents"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "message",
|
|
32
|
+
"description": "for extras in the messages container"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
}
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './uui-form-layout-item.element';
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { css, LitElement, html } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
8
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
9
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
10
|
+
if (decorator = decorators[i])
|
|
11
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
12
|
+
if (kind && result)
|
|
13
|
+
__defProp(target, key, result);
|
|
14
|
+
return result;
|
|
15
|
+
};
|
|
16
|
+
let UUIFormLayoutItemElement = class extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.description = null;
|
|
20
|
+
this._labelSlotHasContent = false;
|
|
21
|
+
this._labelSlotChanged = (e) => {
|
|
22
|
+
this._labelSlotHasContent = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
23
|
+
};
|
|
24
|
+
this._descriptionSlotHasContent = false;
|
|
25
|
+
this._descriptionSlotChanged = (e) => {
|
|
26
|
+
this._descriptionSlotHasContent = e.target.assignedNodes({ flatten: true }).length > 0;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
render() {
|
|
30
|
+
return html`
|
|
31
|
+
<div id="label" style=${this._labelSlotHasContent ? "" : "display: none"}>
|
|
32
|
+
<slot name="label" @slotchange=${this._labelSlotChanged}></slot>
|
|
33
|
+
</div>
|
|
34
|
+
<div
|
|
35
|
+
id="description"
|
|
36
|
+
style=${this._descriptionSlotHasContent || this.description !== null ? "" : "display: none"}>
|
|
37
|
+
${this.description}
|
|
38
|
+
<slot
|
|
39
|
+
name="description"
|
|
40
|
+
@slotchange=${this._descriptionSlotChanged}></slot>
|
|
41
|
+
</div>
|
|
42
|
+
<uui-form-validation-message>
|
|
43
|
+
<slot></slot>
|
|
44
|
+
<slot name="message" slot="message"></slot>
|
|
45
|
+
</uui-form-validation-message>
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
UUIFormLayoutItemElement.styles = [
|
|
50
|
+
css`
|
|
51
|
+
:host {
|
|
52
|
+
position: relative;
|
|
53
|
+
display: block;
|
|
54
|
+
margin-top: var(--uui-size-space-5,18px);
|
|
55
|
+
margin-bottom: var(--uui-size-space-5,18px);
|
|
56
|
+
}
|
|
57
|
+
#label {
|
|
58
|
+
margin-top: -5px;
|
|
59
|
+
margin-bottom: 5px;
|
|
60
|
+
}
|
|
61
|
+
#description {
|
|
62
|
+
color: var(--uui-interface-contrast-disabled,rgb(115, 113, 110));
|
|
63
|
+
font-size: var(--uui-type-small-size,12px);
|
|
64
|
+
}
|
|
65
|
+
#label + #description {
|
|
66
|
+
margin-top: -8px;
|
|
67
|
+
min-height: 8px;
|
|
68
|
+
}
|
|
69
|
+
`
|
|
70
|
+
];
|
|
71
|
+
__decorateClass([
|
|
72
|
+
property({ type: String })
|
|
73
|
+
], UUIFormLayoutItemElement.prototype, "description", 2);
|
|
74
|
+
__decorateClass([
|
|
75
|
+
state()
|
|
76
|
+
], UUIFormLayoutItemElement.prototype, "_labelSlotHasContent", 2);
|
|
77
|
+
__decorateClass([
|
|
78
|
+
state()
|
|
79
|
+
], UUIFormLayoutItemElement.prototype, "_descriptionSlotHasContent", 2);
|
|
80
|
+
UUIFormLayoutItemElement = __decorateClass([
|
|
81
|
+
defineElement("uui-form-layout-item")
|
|
82
|
+
], UUIFormLayoutItemElement);
|
|
83
|
+
|
|
84
|
+
export { UUIFormLayoutItemElement };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
/**
|
|
3
|
+
* @element uui-form-layout-item
|
|
4
|
+
* @description - Form item composes label, input and validation-messages in a proper layout.
|
|
5
|
+
* @slot - for button contents
|
|
6
|
+
* @slot message - for extras in the messages container
|
|
7
|
+
*/
|
|
8
|
+
export declare class UUIFormLayoutItemElement extends LitElement {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
description: string | null;
|
|
11
|
+
private _labelSlotHasContent;
|
|
12
|
+
private _labelSlotChanged;
|
|
13
|
+
private _descriptionSlotHasContent;
|
|
14
|
+
private _descriptionSlotChanged;
|
|
15
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
'uui-form-layout-item': UUIFormLayoutItemElement;
|
|
20
|
+
}
|
|
21
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@umbraco-ui/uui-form-layout-item",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"Umbraco",
|
|
7
|
+
"Custom elements",
|
|
8
|
+
"Web components",
|
|
9
|
+
"UI",
|
|
10
|
+
"Lit",
|
|
11
|
+
"Form Item"
|
|
12
|
+
],
|
|
13
|
+
"description": "Umbraco UI form-layout-item component",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/umbraco/Umbraco.UI.git",
|
|
17
|
+
"directory": "packages/uui-form-layout-item"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/umbraco/Umbraco.UI/issues"
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/uui-form-layout-item.min.js",
|
|
23
|
+
"module": "./lib/index.js",
|
|
24
|
+
"customElements": "custom-elements.json",
|
|
25
|
+
"files": [
|
|
26
|
+
"lib/**/*.d.ts",
|
|
27
|
+
"lib/**/*.js",
|
|
28
|
+
"custom-elements.json"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@umbraco-ui/uui-base": "0.0.16"
|
|
32
|
+
},
|
|
33
|
+
"scripts": {
|
|
34
|
+
"build": "npm run analyze && tsc --build --force && rollup -c rollup.config.js",
|
|
35
|
+
"clean": "tsc --build --clean && rimraf dist lib/*.js lib/**/*.js custom-elements.json",
|
|
36
|
+
"analyze": "web-component-analyzer **/*.element.ts --outFile custom-elements.json"
|
|
37
|
+
},
|
|
38
|
+
"publishConfig": {
|
|
39
|
+
"access": "public"
|
|
40
|
+
},
|
|
41
|
+
"homepage": "https://uui.umbraco.com/?path=/story/uui-form-layout-item",
|
|
42
|
+
"gitHead": "6fbddfc1295e2ea00a532d4f9eb798165b2d39ac"
|
|
43
|
+
}
|