@limetech/lime-elements 36.0.0-next.9 → 36.0.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/{dateFormatter-05d80b12.js → dateFormatter-d7a8d40d.js} +1 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-chip-set.cjs.entry.js +19 -11
- package/dist/cjs/limel-code-editor.cjs.entry.js +1596 -2
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +3 -3
- package/dist/cjs/limel-dock-button.cjs.entry.js +32 -6
- package/dist/cjs/limel-dock.cjs.entry.js +4 -7
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +2 -2
- package/dist/cjs/limel-form.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +13 -6
- package/dist/cjs/limel-menu-list.cjs.entry.js +2 -3
- package/dist/cjs/limel-menu.cjs.entry.js +3 -14
- package/dist/cjs/limel-popover_4.cjs.entry.js +1 -1
- package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/limel-select.cjs.entry.js +4 -5
- package/dist/cjs/limel-table.cjs.entry.js +17 -5
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{moment-5cfac5cd.js → moment-d1e35cdc.js} +2 -2
- package/dist/collection/components/button/button.css +11 -7
- package/dist/collection/components/chip-set/chip-set.css +6 -2
- package/dist/collection/components/chip-set/chip-set.js +21 -13
- package/dist/collection/components/code-editor/code-editor.css +153 -1
- package/dist/collection/components/code-editor/code-editor.js +90 -2
- package/dist/collection/components/collapsible-section/collapsible-section.css +8 -7
- package/dist/collection/components/date-picker/date-picker.js +18 -1
- package/dist/collection/components/dock/dock-button/dock-button.css +15 -9
- package/dist/collection/components/dock/dock-button/dock-button.js +61 -24
- package/dist/collection/components/dock/dock.css +7 -3
- package/dist/collection/components/dock/dock.js +37 -7
- package/dist/collection/components/input-field/input-field.js +32 -7
- package/dist/collection/components/menu/menu.js +3 -14
- package/dist/collection/components/menu-list/menu-list.js +5 -25
- package/dist/collection/components/popover-surface/popover-surface.css +5 -4
- package/dist/collection/components/progress-flow/progress-flow-item/progress-flow-item.css +21 -8
- package/dist/collection/components/select/select.css +10 -11
- package/dist/collection/components/select/select.template.js +3 -4
- package/dist/collection/components/table/columns.js +1 -0
- package/dist/collection/components/table/layout.js +8 -0
- package/dist/collection/components/table/table.css +89 -61
- package/dist/collection/components/table/table.js +46 -15
- package/dist/collection/style/internal/codemirror-tooltip.scss +19 -0
- package/dist/collection/style/mixins.scss +11 -0
- package/dist/esm/{dateFormatter-2cad0292.js → dateFormatter-784c3334.js} +1 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-button.entry.js +1 -1
- package/dist/esm/limel-chip-set.entry.js +19 -11
- package/dist/esm/limel-code-editor.entry.js +1596 -2
- package/dist/esm/limel-collapsible-section.entry.js +1 -1
- package/dist/esm/limel-date-picker.entry.js +3 -3
- package/dist/esm/limel-dock-button.entry.js +32 -6
- package/dist/esm/limel-dock.entry.js +4 -7
- package/dist/esm/limel-flatpickr-adapter.entry.js +2 -2
- package/dist/esm/limel-form.entry.js +1 -1
- package/dist/esm/limel-input-field.entry.js +13 -6
- package/dist/esm/limel-menu-list.entry.js +2 -3
- package/dist/esm/limel-menu.entry.js +3 -14
- package/dist/esm/limel-popover_4.entry.js +1 -1
- package/dist/esm/limel-progress-flow-item.entry.js +1 -1
- package/dist/esm/limel-select.entry.js +4 -5
- package/dist/esm/limel-table.entry.js +18 -6
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{moment-367e51c5.js → moment-faa8a4a8.js} +2 -2
- package/dist/lime-elements/lime-elements.css +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-7e571ec6.entry.js → p-0ba0c38a.entry.js} +1 -1
- package/dist/lime-elements/p-104c89e8.entry.js +1 -0
- package/dist/lime-elements/p-1390fdcb.entry.js +126 -0
- package/dist/lime-elements/{p-1dfccbc5.entry.js → p-2fc4f4ff.entry.js} +1 -1
- package/dist/lime-elements/p-3cf4aae0.entry.js +1 -0
- package/dist/lime-elements/p-4dc07252.entry.js +82 -0
- package/dist/lime-elements/p-5ef52589.entry.js +1 -0
- package/dist/lime-elements/p-653faf47.entry.js +1 -0
- package/dist/lime-elements/{p-d76f896d.js → p-73df4d83.js} +1 -1
- package/dist/lime-elements/p-93f42a32.entry.js +1 -0
- package/dist/lime-elements/p-945afca2.js +3 -0
- package/dist/lime-elements/p-b0e54dc2.entry.js +1 -0
- package/dist/lime-elements/p-c15da26d.entry.js +1 -0
- package/dist/lime-elements/{p-af0ec482.entry.js → p-c544c05b.entry.js} +1 -1
- package/dist/lime-elements/p-c59cbd68.entry.js +1 -0
- package/dist/lime-elements/p-cb8db8c2.entry.js +37 -0
- package/dist/lime-elements/p-f41567a1.entry.js +1 -0
- package/dist/lime-elements/p-f5df4d4f.entry.js +1 -0
- package/dist/lime-elements/style/internal/codemirror-tooltip.scss +19 -0
- package/dist/lime-elements/style/mixins.scss +11 -0
- package/dist/types/components/chip-set/chip-set.d.ts +3 -2
- package/dist/types/components/code-editor/code-editor.d.ts +14 -0
- package/dist/types/components/date-picker/date-picker.d.ts +4 -0
- package/dist/types/components/dock/dock-button/dock-button.d.ts +21 -5
- package/dist/types/components/dock/dock.d.ts +11 -3
- package/dist/types/components/input-field/input-field.d.ts +6 -0
- package/dist/types/components/menu/menu.d.ts +1 -2
- package/dist/types/components/menu-list/menu-list.d.ts +2 -7
- package/dist/types/components/table/layout.d.ts +2 -0
- package/dist/types/components/table/table.d.ts +16 -1
- package/dist/types/components/table/table.types.d.ts +4 -0
- package/dist/types/components.d.ts +67 -15
- package/package.json +5 -4
- package/dist/lime-elements/p-1a2ffe75.entry.js +0 -82
- package/dist/lime-elements/p-1e59114e.entry.js +0 -1
- package/dist/lime-elements/p-3af5f9ad.js +0 -3
- package/dist/lime-elements/p-5ad60e14.entry.js +0 -126
- package/dist/lime-elements/p-64f068a8.entry.js +0 -1
- package/dist/lime-elements/p-6884b012.entry.js +0 -1
- package/dist/lime-elements/p-6966b5df.entry.js +0 -1
- package/dist/lime-elements/p-722d32e0.entry.js +0 -1
- package/dist/lime-elements/p-75152d89.entry.js +0 -1
- package/dist/lime-elements/p-7ee4b825.entry.js +0 -1
- package/dist/lime-elements/p-97d6c4a6.entry.js +0 -1
- package/dist/lime-elements/p-b95e80c9.entry.js +0 -1
- package/dist/lime-elements/p-bd098a11.entry.js +0 -1
- package/dist/lime-elements/p-d1ee4501.entry.js +0 -37
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import { Component, h, Prop, Element, Event, State, } from '@stencil/core';
|
|
1
|
+
import { Component, h, Prop, Element, Event, State, Watch, } from '@stencil/core';
|
|
2
2
|
import CodeMirror from 'codemirror';
|
|
3
3
|
import 'codemirror/mode/javascript/javascript';
|
|
4
4
|
import 'codemirror/addon/selection/active-line';
|
|
5
5
|
import 'codemirror/addon/edit/matchbrackets';
|
|
6
|
+
import 'codemirror/addon/lint/lint';
|
|
7
|
+
import 'codemirror/addon/lint/json-lint';
|
|
8
|
+
import 'codemirror/addon/fold/foldgutter';
|
|
9
|
+
import 'codemirror/addon/fold/brace-fold';
|
|
10
|
+
import jslint from 'jsonlint-mod';
|
|
6
11
|
/**
|
|
7
12
|
* Currently this component support syntax highlighting for `javascript`,
|
|
8
13
|
`json` and `typescript` formats.
|
|
9
14
|
*
|
|
10
15
|
* @exampleComponent limel-example-code-editor
|
|
11
16
|
* @exampleComponent limel-example-code-editor-readonly-with-line-numbers
|
|
17
|
+
* @exampleComponent limel-example-code-editor-fold-lint
|
|
12
18
|
*/
|
|
13
19
|
export class CodeEditor {
|
|
14
20
|
constructor() {
|
|
@@ -24,6 +30,14 @@ export class CodeEditor {
|
|
|
24
30
|
* Displays line numbers in the editor
|
|
25
31
|
*/
|
|
26
32
|
this.lineNumbers = false;
|
|
33
|
+
/**
|
|
34
|
+
* Allows the user to fold code
|
|
35
|
+
*/
|
|
36
|
+
this.fold = false;
|
|
37
|
+
/**
|
|
38
|
+
* Enables linting of JSON content
|
|
39
|
+
*/
|
|
40
|
+
this.lint = false;
|
|
27
41
|
/**
|
|
28
42
|
* Select color scheme for the editor
|
|
29
43
|
*/
|
|
@@ -65,16 +79,37 @@ export class CodeEditor {
|
|
|
65
79
|
}
|
|
66
80
|
this.editor = this.createEditor();
|
|
67
81
|
}
|
|
82
|
+
watchValue(newValue) {
|
|
83
|
+
if (!this.editor) {
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const currentValue = this.editor.getValue();
|
|
87
|
+
if (newValue === currentValue) {
|
|
88
|
+
// Circuit breaker for when the change comes from the editor itself
|
|
89
|
+
// The caret position will be reset without this
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
this.editor.getDoc().setValue(newValue || '');
|
|
93
|
+
}
|
|
68
94
|
createEditor() {
|
|
69
95
|
const options = this.getOptions();
|
|
70
96
|
const editor = CodeMirror(this.host.shadowRoot.querySelector('.editor'), options);
|
|
71
97
|
editor.on('change', this.handleChange);
|
|
98
|
+
// Replace tab with spaces and use the actual indent setting for
|
|
99
|
+
// the space count
|
|
100
|
+
editor.setOption('extraKeys', {
|
|
101
|
+
Tab: (codeMirror) => {
|
|
102
|
+
const spaces = Array(codeMirror.getOption('indentUnit') + 1).join(' ');
|
|
103
|
+
codeMirror.replaceSelection(spaces);
|
|
104
|
+
},
|
|
105
|
+
});
|
|
72
106
|
return editor;
|
|
73
107
|
}
|
|
74
108
|
getOptions() {
|
|
75
109
|
let mode = this.language;
|
|
76
110
|
const TAB_SIZE = 4;
|
|
77
111
|
let theme = 'lime light';
|
|
112
|
+
const gutters = [];
|
|
78
113
|
if (this.isDarkMode()) {
|
|
79
114
|
theme = 'lime dark';
|
|
80
115
|
}
|
|
@@ -83,6 +118,13 @@ export class CodeEditor {
|
|
|
83
118
|
name: 'application/json',
|
|
84
119
|
json: true,
|
|
85
120
|
};
|
|
121
|
+
if (this.lint) {
|
|
122
|
+
gutters.push('CodeMirror-lint-markers');
|
|
123
|
+
if (!('jsonlint' in window)) {
|
|
124
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
125
|
+
window['jsonlint'] = jslint;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
86
128
|
}
|
|
87
129
|
else if (this.language === 'typescript') {
|
|
88
130
|
mode = {
|
|
@@ -90,9 +132,12 @@ export class CodeEditor {
|
|
|
90
132
|
typescript: true,
|
|
91
133
|
};
|
|
92
134
|
}
|
|
135
|
+
if (this.fold) {
|
|
136
|
+
gutters.push('CodeMirror-foldgutter');
|
|
137
|
+
}
|
|
93
138
|
return {
|
|
94
139
|
mode: mode,
|
|
95
|
-
value: this.value,
|
|
140
|
+
value: this.value || '',
|
|
96
141
|
theme: theme,
|
|
97
142
|
readOnly: this.readonly,
|
|
98
143
|
tabSize: TAB_SIZE,
|
|
@@ -100,6 +145,9 @@ export class CodeEditor {
|
|
|
100
145
|
lineNumbers: this.lineNumbers,
|
|
101
146
|
styleActiveLine: true,
|
|
102
147
|
matchBrackets: true,
|
|
148
|
+
lint: this.lint,
|
|
149
|
+
foldGutter: this.fold,
|
|
150
|
+
gutters: gutters,
|
|
103
151
|
};
|
|
104
152
|
}
|
|
105
153
|
isDarkMode() {
|
|
@@ -208,6 +256,42 @@ export class CodeEditor {
|
|
|
208
256
|
"reflect": false,
|
|
209
257
|
"defaultValue": "false"
|
|
210
258
|
},
|
|
259
|
+
"fold": {
|
|
260
|
+
"type": "boolean",
|
|
261
|
+
"mutable": false,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "boolean",
|
|
264
|
+
"resolved": "boolean",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Allows the user to fold code"
|
|
272
|
+
},
|
|
273
|
+
"attribute": "fold",
|
|
274
|
+
"reflect": false,
|
|
275
|
+
"defaultValue": "false"
|
|
276
|
+
},
|
|
277
|
+
"lint": {
|
|
278
|
+
"type": "boolean",
|
|
279
|
+
"mutable": false,
|
|
280
|
+
"complexType": {
|
|
281
|
+
"original": "boolean",
|
|
282
|
+
"resolved": "boolean",
|
|
283
|
+
"references": {}
|
|
284
|
+
},
|
|
285
|
+
"required": false,
|
|
286
|
+
"optional": false,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [],
|
|
289
|
+
"text": "Enables linting of JSON content"
|
|
290
|
+
},
|
|
291
|
+
"attribute": "lint",
|
|
292
|
+
"reflect": false,
|
|
293
|
+
"defaultValue": "false"
|
|
294
|
+
},
|
|
211
295
|
"colorScheme": {
|
|
212
296
|
"type": "string",
|
|
213
297
|
"mutable": false,
|
|
@@ -252,4 +336,8 @@ export class CodeEditor {
|
|
|
252
336
|
}
|
|
253
337
|
}]; }
|
|
254
338
|
static get elementRef() { return "host"; }
|
|
339
|
+
static get watchers() { return [{
|
|
340
|
+
"propName": "value",
|
|
341
|
+
"methodName": "watchValue"
|
|
342
|
+
}]; }
|
|
255
343
|
}
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
/**
|
|
64
64
|
* @prop --closed-header-background-color: background color for header when closed
|
|
65
65
|
* @prop --open-header-background-color: background color for header when open
|
|
66
|
-
* @prop --header-stroke-color: color of the animated icons that
|
|
66
|
+
* @prop --header-stroke-color: color of the animated icons that visualize collapsed or normal states of the headers, as well as the divider line on headers
|
|
67
67
|
* @prop --body-background-color: background color for body
|
|
68
68
|
* @prop --body-padding: space around content of the body
|
|
69
69
|
*/
|
|
@@ -92,6 +92,13 @@
|
|
|
92
92
|
background-color: var(--closed-header-background-color, rgb(var(--contrast-200)));
|
|
93
93
|
border-radius: var(--border-radius-of-header);
|
|
94
94
|
}
|
|
95
|
+
.section__header:focus {
|
|
96
|
+
outline: none;
|
|
97
|
+
}
|
|
98
|
+
.section__header:focus-visible {
|
|
99
|
+
outline: none;
|
|
100
|
+
box-shadow: var(--shadow-depth-8-focused);
|
|
101
|
+
}
|
|
95
102
|
section.open .section__header {
|
|
96
103
|
background-color: var(--open-header-background-color, rgb(var(--contrast-100)));
|
|
97
104
|
border-radius: var(--border-radius-of-header) var(--border-radius-of-header) 0 0;
|
|
@@ -102,12 +109,6 @@ section.open .section__header:hover {
|
|
|
102
109
|
.section__header:hover {
|
|
103
110
|
background-color: var(--open-header-background-color, rgb(var(--contrast-300)));
|
|
104
111
|
}
|
|
105
|
-
.section__header:focus {
|
|
106
|
-
outline: none;
|
|
107
|
-
}
|
|
108
|
-
.section__header:focus-visible {
|
|
109
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
110
|
-
}
|
|
111
112
|
|
|
112
113
|
.section__header__title {
|
|
113
114
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -114,7 +114,7 @@ export class DatePicker {
|
|
|
114
114
|
}
|
|
115
115
|
const dropdownZIndex = getComputedStyle(this.host).getPropertyValue('--dropdown-z-index');
|
|
116
116
|
return [
|
|
117
|
-
h("limel-input-field", Object.assign({ disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, helperText: this.helperText, required: this.required, value: this.formattedValue, onFocus: this.showCalendar, onBlur: this.hideCalendar, onClick: this.onInputClick, onChange: this.handleInputElementChange, ref: (el) => (this.textField = el) }, inputProps)),
|
|
117
|
+
h("limel-input-field", Object.assign({ disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, placeholder: this.placeholder, helperText: this.helperText, required: this.required, value: this.formattedValue, onFocus: this.showCalendar, onBlur: this.hideCalendar, onClick: this.onInputClick, onChange: this.handleInputElementChange, ref: (el) => (this.textField = el) }, inputProps)),
|
|
118
118
|
h("limel-portal", { containerId: this.portalId, visible: this.showPortal, containerStyle: { 'z-index': dropdownZIndex } },
|
|
119
119
|
h("limel-flatpickr-adapter", { format: this.internalFormat, language: this.language, type: this.type, value: this.value, ref: (el) => (this.datePickerCalendar = el), isOpen: this.showPortal, onChange: this.handleCalendarChange })),
|
|
120
120
|
];
|
|
@@ -298,6 +298,23 @@ export class DatePicker {
|
|
|
298
298
|
"attribute": "label",
|
|
299
299
|
"reflect": true
|
|
300
300
|
},
|
|
301
|
+
"placeholder": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "string",
|
|
306
|
+
"resolved": "string",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"optional": false,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": "The placeholder text shown inside the input field, when the field is focused and empty"
|
|
314
|
+
},
|
|
315
|
+
"attribute": "placeholder",
|
|
316
|
+
"reflect": true
|
|
317
|
+
},
|
|
301
318
|
"helperText": {
|
|
302
319
|
"type": "string",
|
|
303
320
|
"mutable": false,
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
.button {
|
|
14
14
|
all: unset;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
15
17
|
box-sizing: border-box;
|
|
16
18
|
display: flex;
|
|
17
19
|
align-items: center;
|
|
@@ -25,20 +27,20 @@
|
|
|
25
27
|
color: var(--limel-dock-item-text-color);
|
|
26
28
|
background-color: var(--dock-background-color);
|
|
27
29
|
}
|
|
28
|
-
.button:
|
|
29
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
30
|
-
}
|
|
31
|
-
.dock-item:not(.selected) .button:not(.disabled) {
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
34
|
-
}
|
|
35
|
-
.dock-item:not(.selected) .button:not(.disabled):hover {
|
|
30
|
+
.button:hover {
|
|
36
31
|
box-shadow: var(--button-shadow-hovered);
|
|
37
32
|
}
|
|
38
|
-
.
|
|
33
|
+
.button:active {
|
|
39
34
|
box-shadow: var(--button-shadow-pressed);
|
|
40
35
|
transform: translate3d(0, 0.08rem, 0);
|
|
41
36
|
}
|
|
37
|
+
.button:focus {
|
|
38
|
+
outline: none;
|
|
39
|
+
}
|
|
40
|
+
.button:focus-visible {
|
|
41
|
+
outline: none;
|
|
42
|
+
box-shadow: var(--shadow-depth-8-focused);
|
|
43
|
+
}
|
|
42
44
|
.button:hover {
|
|
43
45
|
z-index: 1;
|
|
44
46
|
}
|
|
@@ -47,12 +49,16 @@
|
|
|
47
49
|
background-color: var(--dock-item-background-color--selected, rgb(var(--contrast-200)));
|
|
48
50
|
box-shadow: var(--button-shadow-inset);
|
|
49
51
|
}
|
|
52
|
+
.button.selected:focus-visible {
|
|
53
|
+
box-shadow: var(--button-shadow-inset), var(--shadow-depth-8-focused);
|
|
54
|
+
}
|
|
50
55
|
.button.selected .icon {
|
|
51
56
|
color: var(--limel-dock-item-text--selected);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
limel-popover {
|
|
55
60
|
display: grid;
|
|
61
|
+
grid-template-columns: 100%;
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
.text {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Event, h, Prop, State } from '@stencil/core';
|
|
1
|
+
import { Component, Event, h, Prop, State, Watch, } from '@stencil/core';
|
|
2
2
|
import { createRandomString } from '../../../util/random-string';
|
|
3
3
|
/**
|
|
4
4
|
* @private
|
|
@@ -6,17 +6,26 @@ import { createRandomString } from '../../../util/random-string';
|
|
|
6
6
|
export class DockButton {
|
|
7
7
|
constructor() {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* When the dock is expanded or collapsed, dock items
|
|
10
|
+
* show labels and tooltips as suitable for the layout.
|
|
10
11
|
*/
|
|
11
12
|
this.expanded = false;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
+
* When dock is using mobile layout, dock items
|
|
15
|
+
* show labels and tooltips as suitable for the layout.
|
|
14
16
|
*/
|
|
15
17
|
this.useMobileLayout = false;
|
|
18
|
+
/**
|
|
19
|
+
* Indicated whether the popover that renders a component is open.
|
|
20
|
+
*/
|
|
16
21
|
this.isOpen = false;
|
|
17
22
|
this.openPopover = (event) => {
|
|
18
23
|
event.stopPropagation();
|
|
19
24
|
this.isOpen = true;
|
|
25
|
+
this.menuOpen.emit(this.item);
|
|
26
|
+
};
|
|
27
|
+
this.setCustomComponentElement = (element) => {
|
|
28
|
+
this.customComponentElement = element;
|
|
20
29
|
};
|
|
21
30
|
this.onPopoverClose = () => {
|
|
22
31
|
this.isOpen = false;
|
|
@@ -24,7 +33,13 @@ export class DockButton {
|
|
|
24
33
|
};
|
|
25
34
|
this.handleClick = (event) => {
|
|
26
35
|
event.stopPropagation();
|
|
27
|
-
this.
|
|
36
|
+
this.itemSelected.emit(this.item);
|
|
37
|
+
};
|
|
38
|
+
this.focusCustomComponentElement = () => {
|
|
39
|
+
var _a, _b, _c;
|
|
40
|
+
if ((_b = (_a = this.customComponentElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.delegatesFocus) {
|
|
41
|
+
(_c = this.customComponentElement) === null || _c === void 0 ? void 0 : _c.focus();
|
|
42
|
+
}
|
|
28
43
|
};
|
|
29
44
|
this.tooltipId = createRandomString();
|
|
30
45
|
}
|
|
@@ -35,12 +50,19 @@ export class DockButton {
|
|
|
35
50
|
}
|
|
36
51
|
return this.renderButton(this.handleClick);
|
|
37
52
|
}
|
|
53
|
+
openWatcher() {
|
|
54
|
+
if (!this.isOpen) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const observer = new IntersectionObserver(this.focusCustomComponentElement);
|
|
58
|
+
observer.observe(this.customComponentElement);
|
|
59
|
+
}
|
|
38
60
|
renderPopover() {
|
|
39
61
|
var _a;
|
|
40
62
|
const CustomComponent = (_a = this.item) === null || _a === void 0 ? void 0 : _a.dockMenu.componentName;
|
|
41
63
|
return (h("limel-popover", { openDirection: this.useMobileLayout ? 'top' : 'right', open: this.isOpen || this.item.dockMenu.menuOpen, onClose: this.onPopoverClose },
|
|
42
64
|
this.renderButton(this.openPopover, 'trigger'),
|
|
43
|
-
h(CustomComponent, Object.assign({}, (this.item.dockMenu.props || {}), { onClose: this.onPopoverClose }))));
|
|
65
|
+
h(CustomComponent, Object.assign({ ref: this.setCustomComponentElement }, (this.item.dockMenu.props || {}), { onClose: this.onPopoverClose }))));
|
|
44
66
|
}
|
|
45
67
|
renderButton(handleClick, slot) {
|
|
46
68
|
var _a;
|
|
@@ -95,11 +117,8 @@ export class DockButton {
|
|
|
95
117
|
"required": true,
|
|
96
118
|
"optional": false,
|
|
97
119
|
"docs": {
|
|
98
|
-
"tags": [
|
|
99
|
-
|
|
100
|
-
"text": undefined
|
|
101
|
-
}],
|
|
102
|
-
"text": ""
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": "Item that is placed in the dock."
|
|
103
122
|
}
|
|
104
123
|
},
|
|
105
124
|
"expanded": {
|
|
@@ -113,11 +132,8 @@ export class DockButton {
|
|
|
113
132
|
"required": false,
|
|
114
133
|
"optional": true,
|
|
115
134
|
"docs": {
|
|
116
|
-
"tags": [
|
|
117
|
-
|
|
118
|
-
"text": undefined
|
|
119
|
-
}],
|
|
120
|
-
"text": ""
|
|
135
|
+
"tags": [],
|
|
136
|
+
"text": "When the dock is expanded or collapsed, dock items\nshow labels and tooltips as suitable for the layout."
|
|
121
137
|
},
|
|
122
138
|
"attribute": "expanded",
|
|
123
139
|
"reflect": true,
|
|
@@ -134,11 +150,8 @@ export class DockButton {
|
|
|
134
150
|
"required": false,
|
|
135
151
|
"optional": true,
|
|
136
152
|
"docs": {
|
|
137
|
-
"tags": [
|
|
138
|
-
|
|
139
|
-
"text": undefined
|
|
140
|
-
}],
|
|
141
|
-
"text": ""
|
|
153
|
+
"tags": [],
|
|
154
|
+
"text": "When dock is using mobile layout, dock items\nshow labels and tooltips as suitable for the layout."
|
|
142
155
|
},
|
|
143
156
|
"attribute": "use-mobile-layout",
|
|
144
157
|
"reflect": true,
|
|
@@ -149,14 +162,34 @@ export class DockButton {
|
|
|
149
162
|
"isOpen": {}
|
|
150
163
|
}; }
|
|
151
164
|
static get events() { return [{
|
|
152
|
-
"method": "
|
|
153
|
-
"name": "
|
|
165
|
+
"method": "itemSelected",
|
|
166
|
+
"name": "itemSelected",
|
|
154
167
|
"bubbles": true,
|
|
155
168
|
"cancelable": true,
|
|
156
169
|
"composed": true,
|
|
157
170
|
"docs": {
|
|
158
171
|
"tags": [],
|
|
159
|
-
"text": "Fired when
|
|
172
|
+
"text": "Fired when a dock item has been selected from the dock."
|
|
173
|
+
},
|
|
174
|
+
"complexType": {
|
|
175
|
+
"original": "DockItem",
|
|
176
|
+
"resolved": "DockItem",
|
|
177
|
+
"references": {
|
|
178
|
+
"DockItem": {
|
|
179
|
+
"location": "import",
|
|
180
|
+
"path": "../dock.types"
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
"method": "menuOpen",
|
|
186
|
+
"name": "menuOpen",
|
|
187
|
+
"bubbles": true,
|
|
188
|
+
"cancelable": true,
|
|
189
|
+
"composed": true,
|
|
190
|
+
"docs": {
|
|
191
|
+
"tags": [],
|
|
192
|
+
"text": "Fired when a dock menu is opened."
|
|
160
193
|
},
|
|
161
194
|
"complexType": {
|
|
162
195
|
"original": "DockItem",
|
|
@@ -176,7 +209,7 @@ export class DockButton {
|
|
|
176
209
|
"composed": true,
|
|
177
210
|
"docs": {
|
|
178
211
|
"tags": [],
|
|
179
|
-
"text": ""
|
|
212
|
+
"text": "Fired when the popover is closed."
|
|
180
213
|
},
|
|
181
214
|
"complexType": {
|
|
182
215
|
"original": "void",
|
|
@@ -184,4 +217,8 @@ export class DockButton {
|
|
|
184
217
|
"references": {}
|
|
185
218
|
}
|
|
186
219
|
}]; }
|
|
220
|
+
static get watchers() { return [{
|
|
221
|
+
"propName": "isOpen",
|
|
222
|
+
"methodName": "openWatcher"
|
|
223
|
+
}]; }
|
|
187
224
|
}
|
|
@@ -92,15 +92,19 @@ nav::-webkit-scrollbar {
|
|
|
92
92
|
box-shadow: var(--button-shadow-pressed);
|
|
93
93
|
transform: translate3d(0, 0.08rem, 0);
|
|
94
94
|
}
|
|
95
|
+
.expand-shrink:focus {
|
|
96
|
+
outline: none;
|
|
97
|
+
}
|
|
98
|
+
.expand-shrink:focus-visible {
|
|
99
|
+
outline: none;
|
|
100
|
+
box-shadow: var(--shadow-depth-8-focused);
|
|
101
|
+
}
|
|
95
102
|
.expand-shrink.expanded {
|
|
96
103
|
justify-content: flex-end;
|
|
97
104
|
}
|
|
98
105
|
.expand-shrink.expanded limel-icon {
|
|
99
106
|
transform: rotateY(180deg);
|
|
100
107
|
}
|
|
101
|
-
.expand-shrink:focus-visible {
|
|
102
|
-
box-shadow: var(--shadow-depth-8-focused);
|
|
103
|
-
}
|
|
104
108
|
.expand-shrink limel-icon {
|
|
105
109
|
width: calc(var(--dock-expand-shrink-button-height) - 0.25rem);
|
|
106
110
|
color: var(--dock-item-icon-color, var(--limel-dock-item-text-color));
|
|
@@ -56,12 +56,7 @@ export class Dock {
|
|
|
56
56
|
return (h("limel-dock-button", { class: {
|
|
57
57
|
'dock-item': true,
|
|
58
58
|
selected: item.selected,
|
|
59
|
-
}, item: item, expanded: this.expanded && !this.useMobileLayout, useMobileLayout: this.useMobileLayout
|
|
60
|
-
};
|
|
61
|
-
this.handleDockItemClick = (event) => {
|
|
62
|
-
if (!event.detail.selected) {
|
|
63
|
-
this.itemSelected.emit(event.detail);
|
|
64
|
-
}
|
|
59
|
+
}, item: item, expanded: this.expanded && !this.useMobileLayout, useMobileLayout: this.useMobileLayout }));
|
|
65
60
|
};
|
|
66
61
|
this.handleResize = () => {
|
|
67
62
|
if (window.innerWidth <= this.mobileBreakPoint) {
|
|
@@ -239,7 +234,7 @@ export class Dock {
|
|
|
239
234
|
"composed": true,
|
|
240
235
|
"docs": {
|
|
241
236
|
"tags": [],
|
|
242
|
-
"text": "Fired when a
|
|
237
|
+
"text": "Fired when a dock item has been selected from the dock."
|
|
243
238
|
},
|
|
244
239
|
"complexType": {
|
|
245
240
|
"original": "DockItem",
|
|
@@ -251,6 +246,41 @@ export class Dock {
|
|
|
251
246
|
}
|
|
252
247
|
}
|
|
253
248
|
}
|
|
249
|
+
}, {
|
|
250
|
+
"method": "menuOpen",
|
|
251
|
+
"name": "menuOpen",
|
|
252
|
+
"bubbles": true,
|
|
253
|
+
"cancelable": true,
|
|
254
|
+
"composed": true,
|
|
255
|
+
"docs": {
|
|
256
|
+
"tags": [],
|
|
257
|
+
"text": "Fired when a dock menu is opened."
|
|
258
|
+
},
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "DockItem",
|
|
261
|
+
"resolved": "DockItem",
|
|
262
|
+
"references": {
|
|
263
|
+
"DockItem": {
|
|
264
|
+
"location": "import",
|
|
265
|
+
"path": "./dock.types"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}, {
|
|
270
|
+
"method": "close",
|
|
271
|
+
"name": "close",
|
|
272
|
+
"bubbles": true,
|
|
273
|
+
"cancelable": true,
|
|
274
|
+
"composed": true,
|
|
275
|
+
"docs": {
|
|
276
|
+
"tags": [],
|
|
277
|
+
"text": "Fired when the popover is closed."
|
|
278
|
+
},
|
|
279
|
+
"complexType": {
|
|
280
|
+
"original": "void",
|
|
281
|
+
"resolved": "void",
|
|
282
|
+
"references": {}
|
|
283
|
+
}
|
|
254
284
|
}, {
|
|
255
285
|
"method": "dockExpanded",
|
|
256
286
|
"name": "dockExpanded",
|
|
@@ -7,6 +7,7 @@ import { createRandomString } from '../../util/random-string';
|
|
|
7
7
|
const helperTextId = 'tf-helper-text';
|
|
8
8
|
/**
|
|
9
9
|
* @exampleComponent limel-example-input-field-text
|
|
10
|
+
* @exampleComponent limel-example-input-field-placeholder
|
|
10
11
|
* @exampleComponent limel-example-input-field-text-multiple
|
|
11
12
|
* @exampleComponent limel-example-input-field-number
|
|
12
13
|
* @exampleComponent limel-example-input-field-autocomplete
|
|
@@ -101,6 +102,7 @@ export class InputField {
|
|
|
101
102
|
this.getContainerClassList = () => {
|
|
102
103
|
const classList = {
|
|
103
104
|
'mdc-text-field': true,
|
|
105
|
+
'mdc-text-field--no-label': !this.label,
|
|
104
106
|
'mdc-text-field--outlined': true,
|
|
105
107
|
'mdc-text-field--invalid': this.isInvalid(),
|
|
106
108
|
'mdc-text-field--disabled': this.disabled || this.readonly,
|
|
@@ -127,7 +129,7 @@ export class InputField {
|
|
|
127
129
|
return;
|
|
128
130
|
}
|
|
129
131
|
const type = this.type === 'urlAsText' ? 'text' : this.type;
|
|
130
|
-
return (h("input", Object.assign({}, properties, { type: type, pattern: this.pattern, onWheel: this.handleWheel, onKeyDown: this.onKeyDown, value: this.value })));
|
|
132
|
+
return (h("input", Object.assign({}, properties, { type: type, pattern: this.pattern, onWheel: this.handleWheel, onKeyDown: this.onKeyDown, value: this.value, placeholder: this.placeholder })));
|
|
131
133
|
};
|
|
132
134
|
this.renderTextarea = (properties) => {
|
|
133
135
|
if (this.type !== 'textarea') {
|
|
@@ -252,6 +254,17 @@ export class InputField {
|
|
|
252
254
|
}
|
|
253
255
|
return this.limelInputField.shadowRoot.querySelector(elementName);
|
|
254
256
|
};
|
|
257
|
+
this.renderLabel = (labelId) => {
|
|
258
|
+
const labelClassList = {
|
|
259
|
+
'mdc-floating-label': true,
|
|
260
|
+
'mdc-floating-label--float-above': !!this.value || this.isFocused || this.readonly,
|
|
261
|
+
};
|
|
262
|
+
if (!this.label) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
return (h("span", { class: "mdc-notched-outline__notch" },
|
|
266
|
+
h("span", { class: labelClassList, id: labelId }, this.label)));
|
|
267
|
+
};
|
|
255
268
|
this.renderLeadingIcon = () => {
|
|
256
269
|
if (this.type === 'textarea') {
|
|
257
270
|
return;
|
|
@@ -516,16 +529,11 @@ export class InputField {
|
|
|
516
529
|
properties['aria-controls'] = helperTextId;
|
|
517
530
|
properties['aria-describedby'] = helperTextId;
|
|
518
531
|
}
|
|
519
|
-
const labelClassList = {
|
|
520
|
-
'mdc-floating-label': true,
|
|
521
|
-
'mdc-floating-label--float-above': !!this.value || this.isFocused || this.readonly,
|
|
522
|
-
};
|
|
523
532
|
return [
|
|
524
533
|
h("label", { class: this.getContainerClassList() },
|
|
525
534
|
h("span", { class: "mdc-notched-outline", tabindex: "-1" },
|
|
526
535
|
h("span", { class: "mdc-notched-outline__leading" }),
|
|
527
|
-
|
|
528
|
-
h("span", { class: labelClassList, id: labelId }, this.label)),
|
|
536
|
+
this.renderLabel(labelId),
|
|
529
537
|
h("span", { class: "mdc-notched-outline__trailing" })),
|
|
530
538
|
this.renderLeadingIcon(),
|
|
531
539
|
this.renderEmptyValueForReadonly(),
|
|
@@ -627,6 +635,23 @@ export class InputField {
|
|
|
627
635
|
"attribute": "label",
|
|
628
636
|
"reflect": true
|
|
629
637
|
},
|
|
638
|
+
"placeholder": {
|
|
639
|
+
"type": "string",
|
|
640
|
+
"mutable": false,
|
|
641
|
+
"complexType": {
|
|
642
|
+
"original": "string",
|
|
643
|
+
"resolved": "string",
|
|
644
|
+
"references": {}
|
|
645
|
+
},
|
|
646
|
+
"required": false,
|
|
647
|
+
"optional": false,
|
|
648
|
+
"docs": {
|
|
649
|
+
"tags": [],
|
|
650
|
+
"text": "The placeholder text shown inside the input field, when the field is focused and empty."
|
|
651
|
+
},
|
|
652
|
+
"attribute": "placeholder",
|
|
653
|
+
"reflect": true
|
|
654
|
+
},
|
|
630
655
|
"helperText": {
|
|
631
656
|
"type": "string",
|
|
632
657
|
"mutable": false,
|
|
@@ -66,13 +66,8 @@ export class Menu {
|
|
|
66
66
|
}
|
|
67
67
|
this.open = !this.open;
|
|
68
68
|
};
|
|
69
|
-
this.
|
|
70
|
-
|
|
71
|
-
if (item === event.detail) {
|
|
72
|
-
return event.detail;
|
|
73
|
-
}
|
|
74
|
-
return item;
|
|
75
|
-
});
|
|
69
|
+
this.handleSelect = (event) => {
|
|
70
|
+
event.stopPropagation();
|
|
76
71
|
this.select.emit(event.detail);
|
|
77
72
|
this.open = false;
|
|
78
73
|
};
|
|
@@ -90,12 +85,6 @@ export class Menu {
|
|
|
90
85
|
};
|
|
91
86
|
this.portalId = createRandomString();
|
|
92
87
|
}
|
|
93
|
-
componentDidLoad() {
|
|
94
|
-
if (!this.host.querySelector('[slot="trigger"]')) {
|
|
95
|
-
// eslint-disable-next-line no-console
|
|
96
|
-
console.warn('Using limel-menu with the default trigger is deprecated. Please provide your own trigger element.');
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
88
|
openWatcher() {
|
|
100
89
|
if (!this.open) {
|
|
101
90
|
return;
|
|
@@ -117,7 +106,7 @@ export class Menu {
|
|
|
117
106
|
} },
|
|
118
107
|
h("limel-menu-list", { class: {
|
|
119
108
|
'has-grid-layout has-interactive-items': this.gridLayout,
|
|
120
|
-
}, items: this.items, type: "menu", badgeIcons: this.badgeIcons,
|
|
109
|
+
}, items: this.items, type: "menu", badgeIcons: this.badgeIcons, onSelect: this.handleSelect, ref: this.setListElement })))));
|
|
121
110
|
}
|
|
122
111
|
componentDidRender() {
|
|
123
112
|
const slotElement = this.host.shadowRoot.querySelector('slot');
|