@limetech/lime-elements 34.1.0-next.6 → 34.1.0
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/{checkbox.template-d4423721.js → checkbox.template-312308d8.js} +9 -1
- 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-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/limel-chip-set.cjs.entry.js +50 -28
- 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 +59 -26
- package/dist/cjs/limel-grid.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +713 -0
- package/dist/cjs/limel-list_3.cjs.entry.js +2431 -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 +1 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +69 -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/checkbox/checkbox.css +96 -0
- package/dist/collection/components/checkbox/checkbox.js +19 -1
- package/dist/collection/components/checkbox/checkbox.template.js +9 -1
- package/dist/collection/components/chip-set/chip-set.css +14 -0
- package/dist/collection/components/chip-set/chip-set.js +75 -35
- package/dist/collection/components/code-editor/code-editor.css +7 -0
- package/dist/collection/components/color-picker/color-picker-palette.css +1239 -0
- package/dist/collection/components/color-picker/color-picker-palette.js +135 -0
- package/dist/collection/components/color-picker/color-picker.css +108 -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 +50 -0
- package/dist/collection/components/form/templates/array-field-collapsible-item.js +8 -8
- package/dist/collection/components/form/templates/common.js +1 -1
- package/dist/collection/components/form/widgets/select.js +3 -4
- package/dist/collection/components/grid/grid.css +1 -1
- package/dist/collection/components/input-field/input-field.css +13 -0
- package/dist/collection/components/list/list-renderer.js +17 -0
- package/dist/collection/components/list/list.css +423 -3
- package/dist/collection/components/list/list.js +1 -0
- package/dist/collection/components/menu-list/menu-list.css +1408 -60
- package/dist/collection/components/picker/picker.js +18 -1
- package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +1 -2
- package/dist/collection/components/slider/slider.js +69 -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/{checkbox.template-dbdd27c8.js → checkbox.template-4be69ce6.js} +9 -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-checkbox.entry.js +3 -3
- package/dist/esm/limel-chip-set.entry.js +50 -28
- 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 +55 -22
- package/dist/esm/limel-grid.entry.js +1 -1
- package/dist/esm/limel-input-field.entry.js +709 -0
- package/dist/esm/limel-list_3.entry.js +2425 -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 +1 -1
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +69 -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-fc691234.entry.js → p-03aa01b5.entry.js} +2 -2
- package/dist/lime-elements/p-090bc949.js +1 -0
- package/dist/lime-elements/p-0c121e2f.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-1876a96a.entry.js +1 -0
- package/dist/lime-elements/{p-425a0596.js → p-1a64b531.js} +1 -1
- 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-46af5a60.entry.js +82 -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-11d5a71a.entry.js → p-5170a62c.entry.js} +1 -1
- package/dist/lime-elements/{p-ab049a50.entry.js → p-58cbe99d.entry.js} +1 -1
- package/dist/lime-elements/p-5a9ecd77.entry.js +73 -0
- package/dist/lime-elements/p-6003f817.entry.js +1 -0
- package/dist/lime-elements/p-622be09b.entry.js +126 -0
- package/dist/lime-elements/p-7f43b0c4.js +1 -0
- package/dist/lime-elements/p-858c6b82.js +1 -0
- package/dist/lime-elements/p-8a2c1038.entry.js +16 -0
- package/dist/lime-elements/{p-a1153d2a.entry.js → p-8ad5e143.entry.js} +1 -1
- package/dist/lime-elements/{p-b386bfeb.entry.js → p-a2cf74c1.entry.js} +1 -1
- package/dist/lime-elements/p-a77cbb08.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-f83213b8.js +1 -0
- package/dist/lime-elements/{p-23d59a30.entry.js → p-fbe6100e.entry.js} +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -0
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/chip-set/chip-set.d.ts +12 -0
- 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 +7 -1
- package/dist/types/components/list/list-item.types.d.ts +14 -0
- package/dist/types/components/list/list-renderer.d.ts +2 -0
- package/dist/types/components/list/list.d.ts +1 -0
- 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 +147 -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-1cf833c8.entry.js +0 -16
- package/dist/lime-elements/p-227d2c5a.entry.js +0 -1
- 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-89b5a983.js +0 -1
- package/dist/lime-elements/p-8bbe3720.js +0 -1
- package/dist/lime-elements/p-8d8bd2ab.entry.js +0 -73
- package/dist/lime-elements/p-8e4ff107.js +0 -1
- package/dist/lime-elements/p-acfbf7ac.js +0 -1
- package/dist/lime-elements/p-b5d6abc3.entry.js +0 -126
- 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-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,108 @@
|
|
|
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-magenta;"]:after,
|
|
8
|
+
.chosen-color-preview[style="--background:lime-magenta;"]:after {
|
|
9
|
+
background-color: var(--lime-magenta);
|
|
10
|
+
}
|
|
11
|
+
.picker-trigger[style="--background:lime-blue;"]:after,
|
|
12
|
+
.chosen-color-preview[style="--background:lime-blue;"]:after {
|
|
13
|
+
background-color: var(--lime-blue);
|
|
14
|
+
}
|
|
15
|
+
.picker-trigger[style="--background:lime-orange;"]:after,
|
|
16
|
+
.chosen-color-preview[style="--background:lime-orange;"]:after {
|
|
17
|
+
background-color: var(--lime-orange);
|
|
18
|
+
}
|
|
19
|
+
.picker-trigger[style="--background:lime-green;"]:after,
|
|
20
|
+
.chosen-color-preview[style="--background:lime-green;"]:after {
|
|
21
|
+
background-color: var(--lime-green);
|
|
22
|
+
}
|
|
23
|
+
.picker-trigger[style="--background:lime-red;"]:after,
|
|
24
|
+
.chosen-color-preview[style="--background:lime-red;"]:after {
|
|
25
|
+
background-color: var(--lime-red);
|
|
26
|
+
}
|
|
27
|
+
.picker-trigger[style="--background:lime-dark-blue;"]:after,
|
|
28
|
+
.chosen-color-preview[style="--background:lime-dark-blue;"]:after {
|
|
29
|
+
background-color: var(--lime-dark-blue);
|
|
30
|
+
}
|
|
31
|
+
.picker-trigger[style="--background:lime-turquoise;"]:after,
|
|
32
|
+
.chosen-color-preview[style="--background:lime-turquoise;"]:after {
|
|
33
|
+
background-color: var(--lime-turquoise);
|
|
34
|
+
}
|
|
35
|
+
.picker-trigger[style="--background:lime-yellow;"]:after,
|
|
36
|
+
.chosen-color-preview[style="--background:lime-yellow;"]:after {
|
|
37
|
+
background-color: var(--lime-yellow);
|
|
38
|
+
}
|
|
39
|
+
.picker-trigger[style="--background:lime-light-grey;"]:after,
|
|
40
|
+
.chosen-color-preview[style="--background:lime-light-grey;"]:after {
|
|
41
|
+
background-color: var(--lime-light-grey);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
:host {
|
|
45
|
+
--popover-surface-width: 50rem;
|
|
46
|
+
--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>");
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.color-picker {
|
|
50
|
+
display: grid;
|
|
51
|
+
gap: 0.5rem;
|
|
52
|
+
grid-template-columns: auto 1fr;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.chosen-color-preview,
|
|
56
|
+
.picker-trigger {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
position: relative;
|
|
59
|
+
isolation: isolate;
|
|
60
|
+
width: 3.5rem;
|
|
61
|
+
height: 3.5rem;
|
|
62
|
+
}
|
|
63
|
+
.chosen-color-preview:before, .chosen-color-preview:after,
|
|
64
|
+
.picker-trigger:before,
|
|
65
|
+
.picker-trigger:after {
|
|
66
|
+
content: "";
|
|
67
|
+
position: absolute;
|
|
68
|
+
inset: 0;
|
|
69
|
+
border-radius: inherit;
|
|
70
|
+
}
|
|
71
|
+
.chosen-color-preview:before,
|
|
72
|
+
.picker-trigger:before {
|
|
73
|
+
background: var(--color-picker-default-background);
|
|
74
|
+
background-size: 0.5rem;
|
|
75
|
+
z-index: 0;
|
|
76
|
+
}
|
|
77
|
+
.chosen-color-preview:after,
|
|
78
|
+
.picker-trigger:after {
|
|
79
|
+
background: var(--background);
|
|
80
|
+
z-index: 1;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.picker-trigger {
|
|
84
|
+
border-radius: 0.5rem;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
87
|
+
box-shadow: var(--button-shadow-normal);
|
|
88
|
+
}
|
|
89
|
+
.picker-trigger:hover {
|
|
90
|
+
box-shadow: var(--button-shadow-hovered);
|
|
91
|
+
}
|
|
92
|
+
.picker-trigger:active {
|
|
93
|
+
box-shadow: var(--button-shadow-pressed);
|
|
94
|
+
transform: translate3d(0, 0.08rem, 0);
|
|
95
|
+
}
|
|
96
|
+
.picker-trigger:after {
|
|
97
|
+
box-shadow: 0 0 0 0.25rem rgb(var(--contrast-100)) inset;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:host([readonly]) .picker-trigger:hover, :host([readonly]) .picker-trigger:active {
|
|
101
|
+
cursor: default;
|
|
102
|
+
box-shadow: var(--button-shadow-normal);
|
|
103
|
+
transform: none;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.chosen-color-input[readonly] {
|
|
107
|
+
transform: translateY(1rem);
|
|
108
|
+
}
|
|
@@ -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() {
|
|
@@ -33,6 +34,7 @@ export class Form {
|
|
|
33
34
|
this.disabled = false;
|
|
34
35
|
this.isValid = true;
|
|
35
36
|
this.handleChange = this.handleChange.bind(this);
|
|
37
|
+
this.getCustomErrorMessages = this.getCustomErrorMessages.bind(this);
|
|
36
38
|
}
|
|
37
39
|
connectedCallback() {
|
|
38
40
|
this.initialize();
|
|
@@ -78,6 +80,7 @@ export class Form {
|
|
|
78
80
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
79
81
|
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
80
82
|
disabled: this.disabled,
|
|
83
|
+
transformErrors: this.getCustomErrorMessages,
|
|
81
84
|
formContext: {
|
|
82
85
|
schema: this.modifiedSchema,
|
|
83
86
|
rootValue: this.value,
|
|
@@ -139,6 +142,33 @@ export class Form {
|
|
|
139
142
|
};
|
|
140
143
|
});
|
|
141
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
|
+
}
|
|
142
172
|
static get is() { return "limel-form"; }
|
|
143
173
|
static get encapsulation() { return "shadow"; }
|
|
144
174
|
static get originalStyleUrls() { return {
|
|
@@ -215,6 +245,26 @@ export class Form {
|
|
|
215
245
|
"tags": [],
|
|
216
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."
|
|
217
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
|
+
}
|
|
218
268
|
}
|
|
219
269
|
}; }
|
|
220
270
|
static get events() { return [{
|
|
@@ -35,10 +35,10 @@ export class CollapsibleItemTemplate extends React.Component {
|
|
|
35
35
|
const { item, index } = this.props;
|
|
36
36
|
const actions = [
|
|
37
37
|
{
|
|
38
|
-
id: '
|
|
39
|
-
icon: '
|
|
40
|
-
disabled: !item.
|
|
41
|
-
run: item.
|
|
38
|
+
id: 'down',
|
|
39
|
+
icon: 'down_arrow',
|
|
40
|
+
disabled: !item.hasMoveDown,
|
|
41
|
+
run: item.onReorderClick(index, index + 1),
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
id: 'up',
|
|
@@ -47,10 +47,10 @@ export class CollapsibleItemTemplate extends React.Component {
|
|
|
47
47
|
run: item.onReorderClick(index, index - 1),
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
id: '
|
|
51
|
-
icon: '
|
|
52
|
-
disabled: !item.
|
|
53
|
-
run: item.
|
|
50
|
+
id: 'remove',
|
|
51
|
+
icon: 'trash',
|
|
52
|
+
disabled: !item.hasRemove,
|
|
53
|
+
run: item.onDropIndexClick(index),
|
|
54
54
|
},
|
|
55
55
|
];
|
|
56
56
|
element.actions = actions;
|
|
@@ -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) {
|
|
@@ -23,7 +23,7 @@ slot {
|
|
|
23
23
|
display: grid;
|
|
24
24
|
grid-template-areas: var(--lime-grid-area, "");
|
|
25
25
|
grid-template-columns: repeat(var(--lime-grid-columns, 4), minmax(0, 1fr));
|
|
26
|
-
|
|
26
|
+
gap: var(--lime-grid-gutter, 1rem);
|
|
27
27
|
grid-auto-flow: row dense;
|
|
28
28
|
grid-auto-rows: var(--lime-grid-cell-height, 2.5rem);
|
|
29
29
|
margin: 0;
|
|
@@ -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
|
}
|