@limetech/lime-elements 34.1.0-next.2 → 34.1.0-next.23
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/dist/cjs/{_arrayIncludesWith-d69e30af.js → _arrayIncludesWith-36a6fafb.js} +7 -6
- package/dist/cjs/{_assignValue-493aac17.js → _assignValue-c9fc3712.js} +2 -2
- package/dist/cjs/{_defineProperty-c081d04c.js → _defineProperty-8351e789.js} +4 -3
- package/dist/cjs/eq-9a943b00.js +75 -0
- package/dist/cjs/{isArrayLike-2bebb99c.js → isArrayLike-ac53bdac.js} +1 -30
- package/dist/cjs/{isEqual-1ce0c121.js → isEqual-e3b9c27c.js} +21 -19
- package/dist/cjs/{eq-3b43a5ca.js → isObject-e28b7997.js} +0 -71
- package/dist/cjs/isObjectLike-3e3f0cba.js +31 -0
- package/dist/cjs/{isSymbol-4666002c.js → isSymbol-d22b2798.js} +3 -3
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-code-editor.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +188 -0
- package/dist/cjs/limel-color-picker.cjs.entry.js +51 -0
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/{limel-flatpickr-adapter_2.cjs.entry.js → limel-flatpickr-adapter.cjs.entry.js} +8 -801
- package/dist/cjs/limel-form.cjs.entry.js +56 -18
- package/dist/cjs/limel-input-field.cjs.entry.js +713 -0
- package/dist/cjs/limel-list_3.cjs.entry.js +2414 -0
- package/dist/cjs/limel-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-menu.cjs.entry.js +5 -4
- package/dist/cjs/limel-picker.cjs.entry.js +5 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-progress-flow.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +96 -13
- package/dist/cjs/limel-tab-bar.cjs.entry.js +7 -5
- package/dist/cjs/limel-table.cjs.entry.js +9 -7
- package/dist/cjs/{limel-tooltip.cjs.entry.js → limel-tooltip_2.cjs.entry.js} +16 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{pickBy-64252559.js → pickBy-88b0430a.js} +10 -10
- package/dist/cjs/toNumber-062ea29c.js +99 -0
- package/dist/cjs/{zipObject-2f430e94.js → zipObject-4050a45f.js} +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/code-editor/code-editor.css +7 -0
- package/dist/collection/components/color-picker/color-picker-palette.css +1235 -0
- package/dist/collection/components/color-picker/color-picker-palette.js +135 -0
- package/dist/collection/components/color-picker/color-picker.css +104 -0
- package/dist/collection/components/color-picker/color-picker.js +189 -0
- package/dist/collection/components/color-picker/swatches.js +29 -0
- package/dist/collection/components/file/file.js +1 -1
- package/dist/collection/components/form/adapters/widget-adapter.js +4 -1
- package/dist/collection/components/form/form.js +73 -0
- package/dist/collection/components/form/templates/common.js +1 -1
- package/dist/collection/components/form/widgets/select.js +3 -4
- package/dist/collection/components/input-field/input-field.css +13 -0
- package/dist/collection/components/list/list.css +2 -1
- package/dist/collection/components/menu-list/menu-list.css +988 -59
- package/dist/collection/components/picker/picker.js +23 -1
- package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +7 -5
- package/dist/collection/components/progress-flow/progress-flow.css +0 -4
- package/dist/collection/components/slider/slider.js +96 -13
- package/dist/esm/{_arrayIncludesWith-3f5ce249.js → _arrayIncludesWith-b5d3fd9e.js} +5 -4
- package/dist/esm/{_assignValue-94fb6adc.js → _assignValue-08fe10bc.js} +2 -2
- package/dist/esm/{_defineProperty-cbf98a2a.js → _defineProperty-8c869077.js} +2 -1
- package/dist/esm/eq-c1c7f528.js +72 -0
- package/dist/esm/{isArrayLike-14db8f02.js → isArrayLike-dd37ba9a.js} +2 -30
- package/dist/esm/{isEqual-4d982635.js → isEqual-4f22635f.js} +5 -3
- package/dist/esm/{eq-f40dd1d6.js → isObject-c74e273c.js} +1 -70
- package/dist/esm/isObjectLike-38996507.js +29 -0
- package/dist/esm/{isSymbol-84252d8e.js → isSymbol-5bf20921.js} +2 -2
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-code-editor.entry.js +1 -1
- package/dist/esm/limel-color-picker-palette_2.entry.js +183 -0
- package/dist/esm/limel-color-picker.entry.js +47 -0
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/{limel-flatpickr-adapter_2.entry.js → limel-flatpickr-adapter.entry.js} +8 -800
- package/dist/esm/limel-form.entry.js +52 -14
- package/dist/esm/limel-input-field.entry.js +709 -0
- package/dist/esm/limel-list_3.entry.js +2408 -0
- package/dist/esm/limel-menu-list.entry.js +1 -1
- package/dist/esm/limel-menu.entry.js +5 -4
- package/dist/esm/limel-picker.entry.js +5 -1
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-progress-flow.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +96 -13
- package/dist/esm/limel-tab-bar.entry.js +7 -5
- package/dist/esm/limel-table.entry.js +9 -7
- package/dist/esm/{limel-tooltip.entry.js → limel-tooltip_2.entry.js} +16 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{pickBy-c485c1b5.js → pickBy-8a849e46.js} +5 -5
- package/dist/esm/toNumber-a6ed64f0.js +97 -0
- package/dist/esm/{zipObject-53fcafb3.js → zipObject-22e88ce9.js} +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-090bc949.js +1 -0
- package/dist/lime-elements/{p-c6b97214.entry.js → p-0ce9165f.entry.js} +1 -1
- package/dist/lime-elements/p-13f0e4f4.entry.js +1 -0
- package/dist/lime-elements/{p-425a0596.js → p-1a64b531.js} +1 -1
- package/dist/lime-elements/p-1cf833c8.entry.js +16 -0
- package/dist/lime-elements/p-365098fe.js +1 -0
- package/dist/lime-elements/p-379955f4.js +1 -0
- package/dist/lime-elements/p-426d11b4.js +1 -0
- package/dist/lime-elements/p-440084ea.js +1 -0
- package/dist/lime-elements/p-468e940e.entry.js +16 -0
- package/dist/lime-elements/p-4bc5d3fc.entry.js +1 -0
- package/dist/lime-elements/p-511d71e0.entry.js +1 -0
- package/dist/lime-elements/p-58cbe99d.entry.js +1 -0
- package/dist/lime-elements/p-7f43b0c4.js +1 -0
- package/dist/lime-elements/p-858c6b82.js +1 -0
- package/dist/lime-elements/{p-c07139f1.entry.js → p-87644ec9.entry.js} +2 -2
- package/dist/lime-elements/{p-a1153d2a.entry.js → p-8ad5e143.entry.js} +1 -1
- package/dist/lime-elements/{p-d070f0e7.entry.js → p-a4c532a7.entry.js} +1 -1
- package/dist/lime-elements/p-a77cbb08.entry.js +1 -0
- package/dist/lime-elements/p-a8404021.entry.js +82 -0
- package/dist/lime-elements/p-bc8c777b.entry.js +1 -0
- package/dist/lime-elements/p-c93050d6.js +1 -0
- package/dist/lime-elements/p-d529bb7d.js +1 -0
- package/dist/lime-elements/p-eda23c05.js +1 -0
- package/dist/lime-elements/{p-ff0217b3.entry.js → p-f2c706b8.entry.js} +1 -1
- package/dist/lime-elements/p-f5a3e526.entry.js +1 -0
- package/dist/lime-elements/p-f83213b8.js +1 -0
- package/dist/lime-elements/p-f8a2dc0e.entry.js +1 -0
- package/dist/lime-elements/{p-03c28bee.entry.js → p-fbe6100e.entry.js} +1 -1
- package/dist/types/components/color-picker/color-picker-palette.d.ts +32 -0
- package/dist/types/components/color-picker/color-picker.d.ts +54 -0
- package/dist/types/components/color-picker/swatches.d.ts +4 -0
- package/dist/types/components/form/form.d.ts +11 -1
- package/dist/types/components/picker/picker.d.ts +4 -0
- package/dist/types/components/slider/slider.d.ts +8 -0
- package/dist/types/components.d.ts +139 -1
- package/package.json +1 -1
- package/dist/cjs/limel-list_2.cjs.entry.js +0 -485
- package/dist/cjs/limel-popover.cjs.entry.js +0 -116
- package/dist/cjs/limel-portal.cjs.entry.js +0 -1935
- package/dist/cjs/limel-tooltip-content.cjs.entry.js +0 -22
- package/dist/esm/limel-list_2.entry.js +0 -480
- package/dist/esm/limel-popover.entry.js +0 -112
- package/dist/esm/limel-portal.entry.js +0 -1931
- package/dist/esm/limel-tooltip-content.entry.js +0 -18
- package/dist/lime-elements/p-11d5a71a.entry.js +0 -1
- package/dist/lime-elements/p-227d2c5a.entry.js +0 -1
- package/dist/lime-elements/p-33f3e1db.entry.js +0 -16
- package/dist/lime-elements/p-3ce2d46a.js +0 -1
- package/dist/lime-elements/p-77afe6dd.entry.js +0 -1
- package/dist/lime-elements/p-7c4d91f5.js +0 -1
- package/dist/lime-elements/p-845e645a.entry.js +0 -1
- package/dist/lime-elements/p-8bbe3720.js +0 -1
- package/dist/lime-elements/p-8e4ff107.js +0 -1
- package/dist/lime-elements/p-acfbf7ac.js +0 -1
- package/dist/lime-elements/p-bbc1bb01.entry.js +0 -1
- package/dist/lime-elements/p-c0765c9b.js +0 -1
- package/dist/lime-elements/p-df55ee67.entry.js +0 -82
- package/dist/lime-elements/p-e28a4246.entry.js +0 -1
- package/dist/lime-elements/p-e5738ec6.entry.js +0 -1
- package/dist/lime-elements/p-ee7355e7.js +0 -1
- package/dist/lime-elements/p-f4495f59.entry.js +0 -1
- package/dist/lime-elements/p-fbe32287.entry.js +0 -16
- package/dist/lime-elements/p-fc610f15.js +0 -1
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Component, h, Prop, Event } from '@stencil/core';
|
|
2
|
+
import { brightnesses, colors, getColorName, getCssColor } from './swatches';
|
|
3
|
+
/**
|
|
4
|
+
* @private
|
|
5
|
+
*/
|
|
6
|
+
export class Palette {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.renderSwatches = () => {
|
|
9
|
+
return colors.map((color) => {
|
|
10
|
+
return brightnesses.map(this.renderSwatch(color));
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
this.renderSwatch = (color) => (brightness) => {
|
|
14
|
+
const colorName = getColorName(color, brightness);
|
|
15
|
+
const classList = {
|
|
16
|
+
swatch: true,
|
|
17
|
+
[colorName]: true,
|
|
18
|
+
'swatch--selected': this.value === getCssColor(color, brightness),
|
|
19
|
+
};
|
|
20
|
+
return (h("div", { class: classList, onClick: this.handleClick(color, brightness), tabindex: "0" }));
|
|
21
|
+
};
|
|
22
|
+
this.handleChange = (event) => {
|
|
23
|
+
event.stopPropagation();
|
|
24
|
+
this.change.emit(event.detail);
|
|
25
|
+
};
|
|
26
|
+
this.handleClick = (color, brightness) => (event) => {
|
|
27
|
+
const value = getCssColor(color, brightness);
|
|
28
|
+
event.stopPropagation();
|
|
29
|
+
this.change.emit(value);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
render() {
|
|
33
|
+
const background = this.value ? { '--background': this.value } : {};
|
|
34
|
+
return [
|
|
35
|
+
h("div", { class: "color-picker-palette" }, this.renderSwatches()),
|
|
36
|
+
h("div", { class: "chosen-color-name" },
|
|
37
|
+
h("limel-input-field", { label: this.label, helperText: this.helperText, value: this.value, onChange: this.handleChange, required: this.required }),
|
|
38
|
+
h("div", { class: "chosen-color-preview", style: background })),
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
static get is() { return "limel-color-picker-palette"; }
|
|
42
|
+
static get encapsulation() { return "shadow"; }
|
|
43
|
+
static get originalStyleUrls() { return {
|
|
44
|
+
"$": ["color-picker-palette.scss"]
|
|
45
|
+
}; }
|
|
46
|
+
static get styleUrls() { return {
|
|
47
|
+
"$": ["color-picker-palette.css"]
|
|
48
|
+
}; }
|
|
49
|
+
static get properties() { return {
|
|
50
|
+
"value": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"mutable": false,
|
|
53
|
+
"complexType": {
|
|
54
|
+
"original": "string",
|
|
55
|
+
"resolved": "string",
|
|
56
|
+
"references": {}
|
|
57
|
+
},
|
|
58
|
+
"required": false,
|
|
59
|
+
"optional": false,
|
|
60
|
+
"docs": {
|
|
61
|
+
"tags": [],
|
|
62
|
+
"text": "Color value that is manually typed by the user"
|
|
63
|
+
},
|
|
64
|
+
"attribute": "value",
|
|
65
|
+
"reflect": true
|
|
66
|
+
},
|
|
67
|
+
"label": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": "Label of the input field"
|
|
80
|
+
},
|
|
81
|
+
"attribute": "label",
|
|
82
|
+
"reflect": true
|
|
83
|
+
},
|
|
84
|
+
"helperText": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "string",
|
|
89
|
+
"resolved": "string",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": "Helper text of the input field"
|
|
97
|
+
},
|
|
98
|
+
"attribute": "helper-text",
|
|
99
|
+
"reflect": true
|
|
100
|
+
},
|
|
101
|
+
"required": {
|
|
102
|
+
"type": "boolean",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "boolean",
|
|
106
|
+
"resolved": "boolean",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Set to `true` if a value is required"
|
|
114
|
+
},
|
|
115
|
+
"attribute": "required",
|
|
116
|
+
"reflect": true
|
|
117
|
+
}
|
|
118
|
+
}; }
|
|
119
|
+
static get events() { return [{
|
|
120
|
+
"method": "change",
|
|
121
|
+
"name": "change",
|
|
122
|
+
"bubbles": true,
|
|
123
|
+
"cancelable": true,
|
|
124
|
+
"composed": true,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Emits chosen value to the parent component"
|
|
128
|
+
},
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "string",
|
|
131
|
+
"resolved": "string",
|
|
132
|
+
"references": {}
|
|
133
|
+
}
|
|
134
|
+
}]; }
|
|
135
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is imported into every component!
|
|
3
|
+
*
|
|
4
|
+
* Nothing in this file may output any CSS
|
|
5
|
+
* without being explicitly called by outside code.
|
|
6
|
+
*/
|
|
7
|
+
.picker-trigger[style="--background:lime-blue;"]:after,
|
|
8
|
+
.chosen-color-preview[style="--background:lime-blue;"]:after {
|
|
9
|
+
background-color: var(--lime-blue);
|
|
10
|
+
}
|
|
11
|
+
.picker-trigger[style="--background:lime-orange;"]:after,
|
|
12
|
+
.chosen-color-preview[style="--background:lime-orange;"]:after {
|
|
13
|
+
background-color: var(--lime-orange);
|
|
14
|
+
}
|
|
15
|
+
.picker-trigger[style="--background:lime-green;"]:after,
|
|
16
|
+
.chosen-color-preview[style="--background:lime-green;"]:after {
|
|
17
|
+
background-color: var(--lime-green);
|
|
18
|
+
}
|
|
19
|
+
.picker-trigger[style="--background:lime-red;"]:after,
|
|
20
|
+
.chosen-color-preview[style="--background:lime-red;"]:after {
|
|
21
|
+
background-color: var(--lime-red);
|
|
22
|
+
}
|
|
23
|
+
.picker-trigger[style="--background:lime-dark-blue;"]:after,
|
|
24
|
+
.chosen-color-preview[style="--background:lime-dark-blue;"]:after {
|
|
25
|
+
background-color: var(--lime-dark-blue);
|
|
26
|
+
}
|
|
27
|
+
.picker-trigger[style="--background:lime-turquoise;"]:after,
|
|
28
|
+
.chosen-color-preview[style="--background:lime-turquoise;"]:after {
|
|
29
|
+
background-color: var(--lime-turquoise);
|
|
30
|
+
}
|
|
31
|
+
.picker-trigger[style="--background:lime-yellow;"]:after,
|
|
32
|
+
.chosen-color-preview[style="--background:lime-yellow;"]:after {
|
|
33
|
+
background-color: var(--lime-yellow);
|
|
34
|
+
}
|
|
35
|
+
.picker-trigger[style="--background:lime-light-grey;"]:after,
|
|
36
|
+
.chosen-color-preview[style="--background:lime-light-grey;"]:after {
|
|
37
|
+
background-color: var(--lime-light-grey);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
:host {
|
|
41
|
+
--popover-surface-width: 50rem;
|
|
42
|
+
--color-picker-default-background: url("data:image/svg+xml;charset=utf-8, <svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8' style='fill-rule:evenodd;'><path fill-opacity='0.1' d='M0 0h4v4H0zM4 4h4v4H4z'/></svg>");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.color-picker {
|
|
46
|
+
display: grid;
|
|
47
|
+
gap: 0.5rem;
|
|
48
|
+
grid-template-columns: auto 1fr;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.chosen-color-preview,
|
|
52
|
+
.picker-trigger {
|
|
53
|
+
box-sizing: border-box;
|
|
54
|
+
position: relative;
|
|
55
|
+
isolation: isolate;
|
|
56
|
+
width: 3.5rem;
|
|
57
|
+
height: 3.5rem;
|
|
58
|
+
}
|
|
59
|
+
.chosen-color-preview:before, .chosen-color-preview:after,
|
|
60
|
+
.picker-trigger:before,
|
|
61
|
+
.picker-trigger:after {
|
|
62
|
+
content: "";
|
|
63
|
+
position: absolute;
|
|
64
|
+
inset: 0;
|
|
65
|
+
border-radius: inherit;
|
|
66
|
+
}
|
|
67
|
+
.chosen-color-preview:before,
|
|
68
|
+
.picker-trigger:before {
|
|
69
|
+
background: var(--color-picker-default-background);
|
|
70
|
+
background-size: 0.5rem;
|
|
71
|
+
z-index: 0;
|
|
72
|
+
}
|
|
73
|
+
.chosen-color-preview:after,
|
|
74
|
+
.picker-trigger:after {
|
|
75
|
+
background: var(--background);
|
|
76
|
+
z-index: 1;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.picker-trigger {
|
|
80
|
+
border-radius: 0.5rem;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
83
|
+
box-shadow: var(--button-shadow-normal);
|
|
84
|
+
}
|
|
85
|
+
.picker-trigger:hover {
|
|
86
|
+
box-shadow: var(--button-shadow-hovered);
|
|
87
|
+
}
|
|
88
|
+
.picker-trigger:active {
|
|
89
|
+
box-shadow: var(--button-shadow-pressed);
|
|
90
|
+
transform: translate3d(0, 0.08rem, 0);
|
|
91
|
+
}
|
|
92
|
+
.picker-trigger:after {
|
|
93
|
+
box-shadow: 0 0 0 0.25rem rgb(var(--contrast-100)) inset;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
:host([readonly]) .picker-trigger:hover, :host([readonly]) .picker-trigger:active {
|
|
97
|
+
cursor: default;
|
|
98
|
+
box-shadow: var(--button-shadow-normal);
|
|
99
|
+
transform: none;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.chosen-color-input[readonly] {
|
|
103
|
+
transform: translateY(1rem);
|
|
104
|
+
}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/* eslint-disable multiline-ternary */
|
|
2
|
+
import { Component, h, Prop, State, Event } from '@stencil/core';
|
|
3
|
+
/**
|
|
4
|
+
* This component enables you to select a swatch from out color palette, simply
|
|
5
|
+
* by clicking on it. You can then copy the css variable name of the chosen color
|
|
6
|
+
* and use it where desired.
|
|
7
|
+
*
|
|
8
|
+
* The color picker can also show you a preview of any valid color name or color value.
|
|
9
|
+
*
|
|
10
|
+
* :::note
|
|
11
|
+
* Make sure to read our [guidelines about usage of colors](/#/DesignGuidelines/color-system.md/) from our palette.
|
|
12
|
+
* :::
|
|
13
|
+
*
|
|
14
|
+
* @exampleComponent limel-example-color-picker
|
|
15
|
+
* @exampleComponent limel-example-color-picker-readonly
|
|
16
|
+
*/
|
|
17
|
+
export class ColorPicker {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.isOpen = false;
|
|
20
|
+
this.renderTooltip = () => {
|
|
21
|
+
if (!this.readonly && this.tooltipLabel) {
|
|
22
|
+
return (h("limel-tooltip", { label: this.tooltipLabel, elementId: "tooltip-button" }));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
this.renderPickerPalette = () => {
|
|
26
|
+
if (this.readonly) {
|
|
27
|
+
return this.renderPickerTrigger();
|
|
28
|
+
}
|
|
29
|
+
return (h("limel-popover", { open: this.isOpen, onClose: this.onPopoverClose },
|
|
30
|
+
this.renderPickerTrigger(),
|
|
31
|
+
h("limel-color-picker-palette", { value: this.value, label: this.label, helperText: this.helperText, onChange: this.handleChange, required: this.required })));
|
|
32
|
+
};
|
|
33
|
+
this.renderPickerTrigger = () => {
|
|
34
|
+
const background = this.value ? { '--background': this.value } : {};
|
|
35
|
+
return (h("div", { class: "picker-trigger", slot: "trigger", style: background, role: "button", tabindex: "0", onClick: this.openPopover, id: "tooltip-button" }));
|
|
36
|
+
};
|
|
37
|
+
this.openPopover = (event) => {
|
|
38
|
+
event.stopPropagation();
|
|
39
|
+
this.isOpen = true;
|
|
40
|
+
};
|
|
41
|
+
this.onPopoverClose = (event) => {
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
this.isOpen = false;
|
|
44
|
+
};
|
|
45
|
+
this.handleChange = (event) => {
|
|
46
|
+
event.stopPropagation();
|
|
47
|
+
this.change.emit(event.detail);
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
return [
|
|
52
|
+
this.renderTooltip(),
|
|
53
|
+
h("div", { class: "color-picker" },
|
|
54
|
+
this.renderPickerPalette(),
|
|
55
|
+
h("limel-input-field", { label: this.label, helperText: this.helperText, value: this.value, onChange: this.handleChange, required: this.required, readonly: this.readonly, class: "chosen-color-input" })),
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
static get is() { return "limel-color-picker"; }
|
|
59
|
+
static get encapsulation() { return "shadow"; }
|
|
60
|
+
static get originalStyleUrls() { return {
|
|
61
|
+
"$": ["color-picker.scss"]
|
|
62
|
+
}; }
|
|
63
|
+
static get styleUrls() { return {
|
|
64
|
+
"$": ["color-picker.css"]
|
|
65
|
+
}; }
|
|
66
|
+
static get properties() { return {
|
|
67
|
+
"value": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"mutable": false,
|
|
70
|
+
"complexType": {
|
|
71
|
+
"original": "string",
|
|
72
|
+
"resolved": "string",
|
|
73
|
+
"references": {}
|
|
74
|
+
},
|
|
75
|
+
"required": false,
|
|
76
|
+
"optional": false,
|
|
77
|
+
"docs": {
|
|
78
|
+
"tags": [],
|
|
79
|
+
"text": "Name or code of the chosen color"
|
|
80
|
+
},
|
|
81
|
+
"attribute": "value",
|
|
82
|
+
"reflect": true
|
|
83
|
+
},
|
|
84
|
+
"label": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"mutable": false,
|
|
87
|
+
"complexType": {
|
|
88
|
+
"original": "string",
|
|
89
|
+
"resolved": "string",
|
|
90
|
+
"references": {}
|
|
91
|
+
},
|
|
92
|
+
"required": false,
|
|
93
|
+
"optional": false,
|
|
94
|
+
"docs": {
|
|
95
|
+
"tags": [],
|
|
96
|
+
"text": "The label of the input field"
|
|
97
|
+
},
|
|
98
|
+
"attribute": "label",
|
|
99
|
+
"reflect": true
|
|
100
|
+
},
|
|
101
|
+
"helperText": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"mutable": false,
|
|
104
|
+
"complexType": {
|
|
105
|
+
"original": "string",
|
|
106
|
+
"resolved": "string",
|
|
107
|
+
"references": {}
|
|
108
|
+
},
|
|
109
|
+
"required": false,
|
|
110
|
+
"optional": false,
|
|
111
|
+
"docs": {
|
|
112
|
+
"tags": [],
|
|
113
|
+
"text": "Helper text of the input field"
|
|
114
|
+
},
|
|
115
|
+
"attribute": "helper-text",
|
|
116
|
+
"reflect": true
|
|
117
|
+
},
|
|
118
|
+
"tooltipLabel": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "string",
|
|
123
|
+
"resolved": "string",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Displayed as tooltips when picker is hovered."
|
|
131
|
+
},
|
|
132
|
+
"attribute": "tooltip-label",
|
|
133
|
+
"reflect": true
|
|
134
|
+
},
|
|
135
|
+
"required": {
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"mutable": false,
|
|
138
|
+
"complexType": {
|
|
139
|
+
"original": "boolean",
|
|
140
|
+
"resolved": "boolean",
|
|
141
|
+
"references": {}
|
|
142
|
+
},
|
|
143
|
+
"required": false,
|
|
144
|
+
"optional": false,
|
|
145
|
+
"docs": {
|
|
146
|
+
"tags": [],
|
|
147
|
+
"text": "Set to `true` if a value is required"
|
|
148
|
+
},
|
|
149
|
+
"attribute": "required",
|
|
150
|
+
"reflect": true
|
|
151
|
+
},
|
|
152
|
+
"readonly": {
|
|
153
|
+
"type": "boolean",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "boolean",
|
|
157
|
+
"resolved": "boolean",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "Set to `true` if a value is readonly. This makes the component un-interactive."
|
|
165
|
+
},
|
|
166
|
+
"attribute": "readonly",
|
|
167
|
+
"reflect": true
|
|
168
|
+
}
|
|
169
|
+
}; }
|
|
170
|
+
static get states() { return {
|
|
171
|
+
"isOpen": {}
|
|
172
|
+
}; }
|
|
173
|
+
static get events() { return [{
|
|
174
|
+
"method": "change",
|
|
175
|
+
"name": "change",
|
|
176
|
+
"bubbles": true,
|
|
177
|
+
"cancelable": true,
|
|
178
|
+
"composed": true,
|
|
179
|
+
"docs": {
|
|
180
|
+
"tags": [],
|
|
181
|
+
"text": "Emits chosen value to the parent component"
|
|
182
|
+
},
|
|
183
|
+
"complexType": {
|
|
184
|
+
"original": "string",
|
|
185
|
+
"resolved": "string",
|
|
186
|
+
"references": {}
|
|
187
|
+
}
|
|
188
|
+
}]; }
|
|
189
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const colors = [
|
|
2
|
+
'red',
|
|
3
|
+
'pink',
|
|
4
|
+
'magenta',
|
|
5
|
+
'purple',
|
|
6
|
+
'violet',
|
|
7
|
+
'indigo',
|
|
8
|
+
'blue',
|
|
9
|
+
'sky',
|
|
10
|
+
'cyan',
|
|
11
|
+
'teal',
|
|
12
|
+
'green',
|
|
13
|
+
'lime',
|
|
14
|
+
'grass',
|
|
15
|
+
'yellow',
|
|
16
|
+
'amber',
|
|
17
|
+
'orange',
|
|
18
|
+
'coral',
|
|
19
|
+
'brown',
|
|
20
|
+
'gray',
|
|
21
|
+
'glaucous',
|
|
22
|
+
];
|
|
23
|
+
export const brightnesses = ['lighter', 'light', 'default', 'dark', 'darker'];
|
|
24
|
+
export function getColorName(color, brightness) {
|
|
25
|
+
return `--color-${color}-${brightness}`;
|
|
26
|
+
}
|
|
27
|
+
export function getCssColor(color, brightness) {
|
|
28
|
+
return `rgb(var(${getColorName(color, brightness)}))`;
|
|
29
|
+
}
|
|
@@ -115,7 +115,7 @@ export class File {
|
|
|
115
115
|
'is-file-picker': true,
|
|
116
116
|
'shows-dropzone': true,
|
|
117
117
|
'highlight-dropzone': this.isDraggingOverDropZone,
|
|
118
|
-
}, disabled: this.disabled, readonly: this.readonly, label: this.label, leadingIcon: "upload_to_cloud", onChange: this.handleChipSetChange, onClick: this.handleFileSelection, onInteract: this.handleChipInteract, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, required: this.required, type: "input", value: this.chipArray, title: this.getTranslation('drag-and-drop-tips'), onDragEnter: this.handleDragEnter, onDragOver: this.preventAndStop, onDragLeave: this.handleDragLeave, onDrop: this.handleFileDrop }),
|
|
118
|
+
}, disabled: this.disabled, readonly: this.readonly, label: this.label, leadingIcon: "upload_to_cloud", language: this.language, onChange: this.handleChipSetChange, onClick: this.handleFileSelection, onInteract: this.handleChipInteract, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, required: this.required, type: "input", value: this.chipArray, title: this.getTranslation('drag-and-drop-tips'), onDragEnter: this.handleDragEnter, onDragOver: this.preventAndStop, onDragLeave: this.handleDragLeave, onDrop: this.handleFileDrop }),
|
|
119
119
|
];
|
|
120
120
|
}
|
|
121
121
|
get chipArray() {
|
|
@@ -87,9 +87,12 @@ export class LimeElementsWidgetAdapter extends React.Component {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
isDisabled() {
|
|
90
|
+
var _a, _b;
|
|
90
91
|
const widgetProps = this.props.widgetProps;
|
|
91
92
|
const options = widgetProps.schema.lime;
|
|
92
|
-
return widgetProps.disabled ||
|
|
93
|
+
return (widgetProps.disabled ||
|
|
94
|
+
(options === null || options === void 0 ? void 0 : options.disabled) ||
|
|
95
|
+
((_b = (_a = options === null || options === void 0 ? void 0 : options.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.disabled));
|
|
93
96
|
}
|
|
94
97
|
isReadOnly() {
|
|
95
98
|
const widgetProps = this.props.widgetProps;
|
|
@@ -20,6 +20,7 @@ import { isInteger } from './validators';
|
|
|
20
20
|
* @exampleComponent limel-example-props-factory-form
|
|
21
21
|
* @exampleComponent limel-example-form-layout
|
|
22
22
|
* @exampleComponent limel-example-form-span-fields
|
|
23
|
+
* @exampleComponent limel-example-custom-error-message
|
|
23
24
|
*/
|
|
24
25
|
export class Form {
|
|
25
26
|
constructor() {
|
|
@@ -27,8 +28,13 @@ export class Form {
|
|
|
27
28
|
* The schema used to render the form
|
|
28
29
|
*/
|
|
29
30
|
this.schema = {};
|
|
31
|
+
/**
|
|
32
|
+
* Set to `true` to disable the whole form.
|
|
33
|
+
*/
|
|
34
|
+
this.disabled = false;
|
|
30
35
|
this.isValid = true;
|
|
31
36
|
this.handleChange = this.handleChange.bind(this);
|
|
37
|
+
this.getCustomErrorMessages = this.getCustomErrorMessages.bind(this);
|
|
32
38
|
}
|
|
33
39
|
connectedCallback() {
|
|
34
40
|
this.initialize();
|
|
@@ -73,6 +79,8 @@ export class Form {
|
|
|
73
79
|
FieldTemplate: FieldTemplate,
|
|
74
80
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
75
81
|
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
82
|
+
disabled: this.disabled,
|
|
83
|
+
transformErrors: this.getCustomErrorMessages,
|
|
76
84
|
formContext: {
|
|
77
85
|
schema: this.modifiedSchema,
|
|
78
86
|
rootValue: this.value,
|
|
@@ -134,6 +142,33 @@ export class Form {
|
|
|
134
142
|
};
|
|
135
143
|
});
|
|
136
144
|
}
|
|
145
|
+
getCustomErrorMessages(originalErrors) {
|
|
146
|
+
if (!this.transformErrors) {
|
|
147
|
+
return originalErrors;
|
|
148
|
+
}
|
|
149
|
+
const errors = originalErrors.map((error) => {
|
|
150
|
+
return {
|
|
151
|
+
name: error.name,
|
|
152
|
+
property: error.property,
|
|
153
|
+
message: error.message,
|
|
154
|
+
// For some reason 'schemaPath' is missing from the AjvError type definition:
|
|
155
|
+
// https://github.com/rjsf-team/react-jsonschema-form/issues/2140
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
157
|
+
schemaPath: error['schemaPath'],
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
// Use `.call({}, …)` here to bind `this` to an empty object to prevent
|
|
161
|
+
// the consumer submitted `transformErrors` from getting access to our
|
|
162
|
+
// component's internals. /Ads
|
|
163
|
+
return this.transformErrors
|
|
164
|
+
.call({}, errors)
|
|
165
|
+
.map((transformedError) => {
|
|
166
|
+
const originalError = originalErrors.find((error) => {
|
|
167
|
+
return transformedError.property === error.property;
|
|
168
|
+
});
|
|
169
|
+
return Object.assign(Object.assign({}, originalError), { message: transformedError.message });
|
|
170
|
+
});
|
|
171
|
+
}
|
|
137
172
|
static get is() { return "limel-form"; }
|
|
138
173
|
static get encapsulation() { return "shadow"; }
|
|
139
174
|
static get originalStyleUrls() { return {
|
|
@@ -174,6 +209,24 @@ export class Form {
|
|
|
174
209
|
"text": "Value of the form"
|
|
175
210
|
}
|
|
176
211
|
},
|
|
212
|
+
"disabled": {
|
|
213
|
+
"type": "boolean",
|
|
214
|
+
"mutable": false,
|
|
215
|
+
"complexType": {
|
|
216
|
+
"original": "boolean",
|
|
217
|
+
"resolved": "boolean",
|
|
218
|
+
"references": {}
|
|
219
|
+
},
|
|
220
|
+
"required": false,
|
|
221
|
+
"optional": false,
|
|
222
|
+
"docs": {
|
|
223
|
+
"tags": [],
|
|
224
|
+
"text": "Set to `true` to disable the whole form."
|
|
225
|
+
},
|
|
226
|
+
"attribute": "disabled",
|
|
227
|
+
"reflect": false,
|
|
228
|
+
"defaultValue": "false"
|
|
229
|
+
},
|
|
177
230
|
"propsFactory": {
|
|
178
231
|
"type": "unknown",
|
|
179
232
|
"mutable": false,
|
|
@@ -192,6 +245,26 @@ export class Form {
|
|
|
192
245
|
"tags": [],
|
|
193
246
|
"text": "Factory for creating properties for custom form components\n\nWhen using custom components in the form some properties might have to be\nset dynamically. If this factory is set, it will be called with the\ncurrent schema for the field for each custom component in the form. The\nfactory must return an object where each key is the name of the property\nthat should be set, along with its value."
|
|
194
247
|
}
|
|
248
|
+
},
|
|
249
|
+
"transformErrors": {
|
|
250
|
+
"type": "unknown",
|
|
251
|
+
"mutable": false,
|
|
252
|
+
"complexType": {
|
|
253
|
+
"original": "(errors: FormError[]) => FormError[]",
|
|
254
|
+
"resolved": "(errors: FormError[]) => FormError[]",
|
|
255
|
+
"references": {
|
|
256
|
+
"FormError": {
|
|
257
|
+
"location": "import",
|
|
258
|
+
"path": "./form.types"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": true,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Custom function to customize the default error messages"
|
|
267
|
+
}
|
|
195
268
|
}
|
|
196
269
|
}; }
|
|
197
270
|
static get events() { return [{
|
|
@@ -59,7 +59,7 @@ function findFirstEntry(data, subSchema) {
|
|
|
59
59
|
getRequiredEntry(data, subSchema),
|
|
60
60
|
...Object.entries(data),
|
|
61
61
|
];
|
|
62
|
-
return entries.filter(([_, value]) => !!value)[0];
|
|
62
|
+
return entries.filter(([_, value]) => !!value && typeof value !== 'boolean')[0];
|
|
63
63
|
}
|
|
64
64
|
function getRequiredEntry(data, subSchema) {
|
|
65
65
|
if (!('required' in subSchema)) {
|
|
@@ -11,6 +11,7 @@ export class Select extends React.Component {
|
|
|
11
11
|
this.handleChange = this.handleChange.bind(this);
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
|
+
var _a, _b;
|
|
14
15
|
const props = this.props;
|
|
15
16
|
const enumOptions = props.options.enumOptions;
|
|
16
17
|
const options = enumOptions.map(createOption);
|
|
@@ -21,6 +22,7 @@ export class Select extends React.Component {
|
|
|
21
22
|
else {
|
|
22
23
|
value = findValue(props.value, options);
|
|
23
24
|
}
|
|
25
|
+
const additionalProps = ((_b = (_a = props.schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) || {};
|
|
24
26
|
return React.createElement(LimeElementsWidgetAdapter, {
|
|
25
27
|
name: 'limel-select',
|
|
26
28
|
value: value,
|
|
@@ -28,10 +30,7 @@ export class Select extends React.Component {
|
|
|
28
30
|
change: this.handleChange,
|
|
29
31
|
},
|
|
30
32
|
widgetProps: props,
|
|
31
|
-
extraProps: {
|
|
32
|
-
multiple: props.multiple,
|
|
33
|
-
options: options,
|
|
34
|
-
},
|
|
33
|
+
extraProps: Object.assign({ multiple: props.multiple, options: options }, additionalProps),
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
handleChange(event) {
|
|
@@ -1885,6 +1885,9 @@ input.mdc-text-field__input::-webkit-search-cancel-button:active {
|
|
|
1885
1885
|
input.mdc-text-field__input::-webkit-search-cancel-button:hover {
|
|
1886
1886
|
background-color: #757580;
|
|
1887
1887
|
}
|
|
1888
|
+
input.mdc-text-field__input::-webkit-search-cancel-button:active {
|
|
1889
|
+
transform: none;
|
|
1890
|
+
}
|
|
1888
1891
|
|
|
1889
1892
|
.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field-character-counter, .mdc-text-field:not(.mdc-text-field--disabled) + .mdc-text-field-helper-line .mdc-text-field-character-counter, .mdc-text-field:not(.mdc-text-field--disabled) + .mdc-text-field-helper-line .mdc-text-field-helper-text {
|
|
1890
1893
|
color: rgba(var(--contrast-1200), 1);
|
|
@@ -1949,4 +1952,14 @@ input.mdc-text-field__input::-webkit-search-cancel-button:hover {
|
|
|
1949
1952
|
:host([type=urlAsText]) .mdc-text-field.lime-text-field--readonly:hover .mdc-text-field__input,
|
|
1950
1953
|
:host([type=tel]) .mdc-text-field.lime-text-field--readonly:hover .mdc-text-field__input {
|
|
1951
1954
|
z-index: 1;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
:host([type=url]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1958
|
+
:host([type=email]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1959
|
+
:host([type=urlAsText]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1960
|
+
:host([type=tel]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input {
|
|
1961
|
+
overflow: hidden;
|
|
1962
|
+
white-space: nowrap;
|
|
1963
|
+
text-overflow: ellipsis;
|
|
1964
|
+
width: calc(100% - 2.75rem);
|
|
1952
1965
|
}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
* @prop --list-grid-item-min-width: Minimum width of items in a list that has `has-grid-layout` class. Defaults to `7.5rem`.
|
|
69
69
|
* @prop --list-grid-gap: Distance between items in a list that has `has-grid-layout` class. Defaults to `0.75rem`.
|
|
70
70
|
*/
|
|
71
|
-
:host {
|
|
71
|
+
:host(limel-list) {
|
|
72
72
|
display: block;
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -3061,6 +3061,7 @@ a.mdc-list-item {
|
|
|
3061
3061
|
border-radius: 0.375rem;
|
|
3062
3062
|
}
|
|
3063
3063
|
.mdc-deprecated-list .mdc-deprecated-list-item {
|
|
3064
|
+
box-sizing: border-box;
|
|
3064
3065
|
z-index: 0;
|
|
3065
3066
|
}
|
|
3066
3067
|
.mdc-deprecated-list .mdc-deprecated-list-item.mdc-deprecated-list-item--disabled {
|