@limetech/lime-elements 36.3.0-next.2 → 36.3.0-next.21
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/README.md +1 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-badge.cjs.entry.js +1 -1
- package/dist/cjs/limel-button.cjs.entry.js +1 -2
- package/dist/cjs/limel-chip-set.cjs.entry.js +1 -1
- package/dist/cjs/limel-collapsible-section.cjs.entry.js +1 -1
- package/dist/cjs/limel-date-picker.cjs.entry.js +47 -7
- package/dist/cjs/limel-dock-button.cjs.entry.js +7 -2
- package/dist/cjs/limel-dock.cjs.entry.js +1 -1
- package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +11 -8
- package/dist/cjs/limel-form.cjs.entry.js +79 -1
- package/dist/cjs/limel-header.cjs.entry.js +2 -2
- package/dist/cjs/limel-info-tile.cjs.entry.js +4 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +1 -1
- package/dist/cjs/limel-split-button.cjs.entry.js +1 -1
- package/dist/cjs/limel-switch.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-bar.cjs.entry.js +1 -1
- package/dist/cjs/limel-tab-panel.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{dateFormatter-d7a8d40d.js → sv-dffe48b5.js} +222 -173
- package/dist/collection/components/badge/badge.css +1 -1
- package/dist/collection/components/badge/badge.js +4 -2
- package/dist/collection/components/button/button.css +16 -13
- package/dist/collection/components/button/button.js +4 -5
- package/dist/collection/components/chip-set/chip-set.css +3 -0
- package/dist/collection/components/chip-set/chip-set.js +1 -1
- package/dist/collection/components/collapsible-section/collapsible-section.css +1 -0
- package/dist/collection/components/date-picker/date-picker.js +30 -5
- package/dist/collection/components/date-picker/dateFormatter.js +7 -3
- package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +22 -1
- package/dist/collection/components/date-picker/pickers/Picker.js +11 -8
- package/dist/collection/components/dock/dock-button/dock-button.css +8 -1
- package/dist/collection/components/dock/dock-button/dock-button.js +6 -1
- package/dist/collection/components/dock/dock.css +2 -0
- package/dist/collection/components/dock/dock.js +1 -0
- package/dist/collection/components/file/file.js +1 -1
- package/dist/collection/components/form/form.css +91 -4
- package/dist/collection/components/form/form.js +1 -0
- package/dist/collection/components/form/form.types.js +8 -0
- package/dist/collection/components/form/row/row.js +47 -0
- package/dist/collection/components/form/templates/object-field.js +5 -0
- package/dist/collection/components/form/templates/row-layout.js +20 -0
- package/dist/collection/components/header/header.css +2 -2
- package/dist/collection/components/header/header.js +8 -2
- package/dist/collection/components/info-tile/info-tile.css +1 -1
- package/dist/collection/components/info-tile/info-tile.js +3 -0
- package/dist/collection/components/input-field/input-field.css +2 -0
- package/dist/collection/components/slider/slider.css +1 -0
- package/dist/collection/components/snackbar/snackbar.js +1 -1
- package/dist/collection/components/split-button/split-button.css +8 -0
- package/dist/collection/components/switch/switch.css +1 -0
- package/dist/collection/components/tab-bar/tab-bar.css +13 -5
- package/dist/collection/components/tab-panel/tab-panel.css +5 -0
- package/dist/collection/style/internal/shared_input-select-picker.scss +4 -0
- package/dist/collection/style/internal/z-index.scss +0 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-badge.entry.js +1 -1
- package/dist/esm/limel-button.entry.js +1 -2
- package/dist/esm/limel-chip-set.entry.js +1 -1
- package/dist/esm/limel-collapsible-section.entry.js +1 -1
- package/dist/esm/limel-date-picker.entry.js +46 -6
- package/dist/esm/limel-dock-button.entry.js +7 -2
- package/dist/esm/limel-dock.entry.js +1 -1
- package/dist/esm/limel-flatpickr-adapter.entry.js +11 -8
- package/dist/esm/limel-form.entry.js +79 -1
- package/dist/esm/limel-header.entry.js +2 -2
- package/dist/esm/limel-info-tile.entry.js +4 -1
- package/dist/esm/limel-input-field.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +1 -1
- package/dist/esm/limel-split-button.entry.js +1 -1
- package/dist/esm/limel-switch.entry.js +1 -1
- package/dist/esm/limel-tab-bar.entry.js +1 -1
- package/dist/esm/limel-tab-panel.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{dateFormatter-784c3334.js → sv-336c4576.js} +222 -173
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/p-004aad18.entry.js +1 -0
- package/dist/lime-elements/p-079921e9.entry.js +16 -0
- package/dist/lime-elements/{p-8ca53aa2.entry.js → p-15c3ec8e.entry.js} +1 -1
- package/dist/lime-elements/p-3a7b55ce.entry.js +1 -0
- package/dist/lime-elements/{p-06f2f6b4.entry.js → p-3fda3473.entry.js} +1 -1
- package/dist/lime-elements/{p-73df4d83.js → p-4dd9a5a5.js} +5 -3
- package/dist/lime-elements/{p-524bd0cc.entry.js → p-5393213b.entry.js} +1 -1
- package/dist/lime-elements/{p-e5213a54.entry.js → p-55c8cb64.entry.js} +4 -4
- package/dist/lime-elements/p-6980ef7f.entry.js +1 -0
- package/dist/lime-elements/{p-d379f4d6.entry.js → p-8c4e3b46.entry.js} +1 -1
- package/dist/lime-elements/{p-5f13035a.entry.js → p-95cefb5f.entry.js} +1 -1
- package/dist/lime-elements/p-b40f37d7.entry.js +1 -0
- package/dist/lime-elements/{p-a94e949f.entry.js → p-c6e913a4.entry.js} +1 -1
- package/dist/lime-elements/{p-91604294.entry.js → p-d51892ae.entry.js} +1 -1
- package/dist/lime-elements/{p-d9c96100.entry.js → p-dcf88b3e.entry.js} +1 -1
- package/dist/lime-elements/{p-65a3be2c.entry.js → p-e479f165.entry.js} +1 -1
- package/dist/lime-elements/p-e768eab3.entry.js +1 -0
- package/dist/lime-elements/{p-864db270.entry.js → p-ff340a70.entry.js} +1 -1
- package/dist/lime-elements/style/internal/shared_input-select-picker.scss +4 -0
- package/dist/lime-elements/style/internal/z-index.scss +0 -1
- package/dist/types/components/badge/badge.d.ts +4 -2
- package/dist/types/components/button/button.d.ts +4 -6
- package/dist/types/components/date-picker/date-picker.d.ts +10 -0
- package/dist/types/components/date-picker/date.types.d.ts +1 -1
- package/dist/types/components/date-picker/dateFormatter.d.ts +3 -2
- package/dist/types/components/date-picker/flatpickr-adapter/flatpickr-adapter.d.ts +1 -0
- package/dist/types/components/date-picker/pickers/Picker.d.ts +4 -2
- package/dist/types/components/dock/dock-button/dock-button.d.ts +1 -0
- package/dist/types/components/dock/dock.d.ts +1 -0
- package/dist/types/components/dock/dock.types.d.ts +4 -0
- package/dist/types/components/form/form.d.ts +1 -0
- package/dist/types/components/form/form.types.d.ts +16 -1
- package/dist/types/components/form/row/row.d.ts +16 -0
- package/dist/types/components/form/templates/row-layout.d.ts +11 -0
- package/dist/types/components/form/templates/types.d.ts +3 -0
- package/dist/types/components/header/header.d.ts +7 -1
- package/dist/types/components.d.ts +13 -3
- package/package.json +16 -17
- package/dist/lime-elements/p-61b3352f.entry.js +0 -1
- package/dist/lime-elements/p-c4a89055.entry.js +0 -16
- package/dist/lime-elements/p-c6c37de3.entry.js +0 -1
- package/dist/lime-elements/p-cc9f89a9.entry.js +0 -1
- package/dist/lime-elements/p-d512656b.entry.js +0 -1
- package/dist/lime-elements/p-e6a11b73.entry.js +0 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
/**
|
|
3
3
|
* @exampleComponent limel-example-button-basic
|
|
4
|
+
* @exampleComponent limel-example-button-primary
|
|
5
|
+
* @exampleComponent limel-example-button-outlined
|
|
4
6
|
* @exampleComponent limel-example-button-disabled
|
|
5
7
|
* @exampleComponent limel-example-button-icon
|
|
6
8
|
* @exampleComponent limel-example-button-loading
|
|
7
|
-
* @exampleComponent limel-example-button-outlined
|
|
8
|
-
* @exampleComponent limel-example-button-primary
|
|
9
|
-
* @exampleComponent limel-example-button-composite
|
|
10
9
|
* @exampleComponent limel-example-button-click-success
|
|
11
10
|
* @exampleComponent limel-example-button-click-fail
|
|
12
11
|
* @exampleComponent limel-example-button-reduce-presence
|
|
13
12
|
* @exampleComponent limel-example-button-colors
|
|
13
|
+
* @exampleComponent limel-example-button-composite
|
|
14
14
|
*/
|
|
15
15
|
export class Button {
|
|
16
16
|
constructor() {
|
|
@@ -26,7 +26,6 @@ export class Button {
|
|
|
26
26
|
render() {
|
|
27
27
|
return (h("button", { class: {
|
|
28
28
|
'mdc-button': true,
|
|
29
|
-
'mdc-button--unelevated': this.primary,
|
|
30
29
|
loading: this.loading,
|
|
31
30
|
'just-loaded': this.justLoaded && !this.loadingFailed,
|
|
32
31
|
'just-failed': this.justLoaded && this.loadingFailed,
|
|
@@ -182,7 +181,7 @@ export class Button {
|
|
|
182
181
|
"optional": false,
|
|
183
182
|
"docs": {
|
|
184
183
|
"tags": [],
|
|
185
|
-
"text": "Set to `true` to put the button in the `loading` state.\
|
|
184
|
+
"text": "Set to `true` to put the button in the `loading` state.\nThis also disables the button."
|
|
186
185
|
},
|
|
187
186
|
"attribute": "loading",
|
|
188
187
|
"reflect": true,
|
|
@@ -2591,6 +2591,7 @@
|
|
|
2591
2591
|
}
|
|
2592
2592
|
|
|
2593
2593
|
.mdc-text-field__icon {
|
|
2594
|
+
color: rgb(var(--contrast-900));
|
|
2594
2595
|
flex-shrink: 0;
|
|
2595
2596
|
}
|
|
2596
2597
|
|
|
@@ -2668,6 +2669,7 @@
|
|
|
2668
2669
|
}
|
|
2669
2670
|
|
|
2670
2671
|
.mdc-text-field__icon {
|
|
2672
|
+
color: rgb(var(--contrast-900));
|
|
2671
2673
|
width: 1.5rem;
|
|
2672
2674
|
height: 1.5rem;
|
|
2673
2675
|
}
|
|
@@ -2932,6 +2934,7 @@ limel-icon.mdc-chip__icon.mdc-chip__icon--leading {
|
|
|
2932
2934
|
.delimiter {
|
|
2933
2935
|
opacity: 0.5;
|
|
2934
2936
|
padding: 0 0.125rem;
|
|
2937
|
+
color: var(--mdc-theme-on-surface);
|
|
2935
2938
|
}
|
|
2936
2939
|
|
|
2937
2940
|
:host(.is-file-picker.shows-dropzone[readonly]) .mdc-text-field:not(.has-chips) .mdc-notched-outline:before, :host(.is-file-picker.shows-dropzone[readonly]) .mdc-text-field:not(.has-chips) .mdc-notched-outline:after {
|
|
@@ -662,7 +662,7 @@ export class ChipSet {
|
|
|
662
662
|
"mutable": false,
|
|
663
663
|
"complexType": {
|
|
664
664
|
"original": "Languages",
|
|
665
|
-
"resolved": "\"da\" | \"en\" | \"fi\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
665
|
+
"resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
666
666
|
"references": {
|
|
667
667
|
"Languages": {
|
|
668
668
|
"location": "import",
|
|
@@ -138,6 +138,7 @@ section.open .section__header:hover {
|
|
|
138
138
|
text-transform: inherit;
|
|
139
139
|
/* @alternate */
|
|
140
140
|
text-transform: var(--mdc-typography-headline2-text-transform, inherit);
|
|
141
|
+
color: var(--mdc-theme-on-surface);
|
|
141
142
|
justify-self: flex-start;
|
|
142
143
|
padding-right: 0.75rem;
|
|
143
144
|
user-select: none;
|
|
@@ -36,6 +36,7 @@ const nativeFormatForType = {
|
|
|
36
36
|
* @exampleComponent limel-example-date-picker-formatted
|
|
37
37
|
* @exampleComponent limel-example-date-picker-programmatic-change
|
|
38
38
|
* @exampleComponent limel-example-date-picker-composite
|
|
39
|
+
* @exampleComponent limel-example-date-picker-custom-formatter
|
|
39
40
|
*/
|
|
40
41
|
export class DatePicker {
|
|
41
42
|
constructor() {
|
|
@@ -50,6 +51,7 @@ export class DatePicker {
|
|
|
50
51
|
this.hideCalendar();
|
|
51
52
|
}
|
|
52
53
|
};
|
|
54
|
+
this.formatValue = (value) => this.dateFormatter.formatDate(value, this.internalFormat);
|
|
53
55
|
this.disabled = false;
|
|
54
56
|
this.readonly = false;
|
|
55
57
|
this.invalid = false;
|
|
@@ -61,6 +63,7 @@ export class DatePicker {
|
|
|
61
63
|
this.type = 'datetime';
|
|
62
64
|
this.format = undefined;
|
|
63
65
|
this.language = 'en';
|
|
66
|
+
this.formatter = undefined;
|
|
64
67
|
this.formattedValue = undefined;
|
|
65
68
|
this.internalFormat = undefined;
|
|
66
69
|
this.showPortal = false;
|
|
@@ -79,7 +82,7 @@ export class DatePicker {
|
|
|
79
82
|
componentWillLoad() {
|
|
80
83
|
this.useNative = !this.readonly && (isIOSDevice() || isAndroidDevice());
|
|
81
84
|
this.updateInternalFormatAndType();
|
|
82
|
-
this.formattedValue = this.
|
|
85
|
+
this.formattedValue = this.formatValue(this.value);
|
|
83
86
|
}
|
|
84
87
|
componentWillUpdate() {
|
|
85
88
|
this.updateInternalFormatAndType();
|
|
@@ -97,12 +100,12 @@ export class DatePicker {
|
|
|
97
100
|
const dropdownZIndex = getComputedStyle(this.host).getPropertyValue('--dropdown-z-index');
|
|
98
101
|
return [
|
|
99
102
|
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)),
|
|
100
|
-
h("limel-portal", { containerId: this.portalId, visible: this.showPortal, containerStyle: { 'z-index': dropdownZIndex } }, 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 })),
|
|
103
|
+
h("limel-portal", { containerId: this.portalId, visible: this.showPortal, containerStyle: { 'z-index': dropdownZIndex } }, h("limel-flatpickr-adapter", { format: this.internalFormat, language: this.language, type: this.type, value: this.value, ref: (el) => (this.datePickerCalendar = el), isOpen: this.showPortal, formatter: this.formatValue, onChange: this.handleCalendarChange })),
|
|
101
104
|
];
|
|
102
105
|
}
|
|
103
106
|
onValueChange(newValue, oldValue) {
|
|
104
107
|
if (newValue !== oldValue && newValue !== this.formattedValue) {
|
|
105
|
-
this.formattedValue = this.
|
|
108
|
+
this.formattedValue = this.formatValue(this.value);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
updateInternalFormatAndType() {
|
|
@@ -111,6 +114,9 @@ export class DatePicker {
|
|
|
111
114
|
if (this.useNative) {
|
|
112
115
|
this.internalFormat = this.nativeFormat;
|
|
113
116
|
}
|
|
117
|
+
else if (this.formatter) {
|
|
118
|
+
this.formatValue = this.formatter;
|
|
119
|
+
}
|
|
114
120
|
else if (this.format) {
|
|
115
121
|
this.internalFormat = this.format;
|
|
116
122
|
}
|
|
@@ -170,7 +176,7 @@ export class DatePicker {
|
|
|
170
176
|
}
|
|
171
177
|
handleCalendarChange(event) {
|
|
172
178
|
const date = event.detail;
|
|
173
|
-
this.formattedValue = this.
|
|
179
|
+
this.formattedValue = this.formatValue(date);
|
|
174
180
|
event.stopPropagation();
|
|
175
181
|
if (this.pickerIsAutoClosing()) {
|
|
176
182
|
this.hideCalendar();
|
|
@@ -400,7 +406,7 @@ export class DatePicker {
|
|
|
400
406
|
"mutable": false,
|
|
401
407
|
"complexType": {
|
|
402
408
|
"original": "Languages",
|
|
403
|
-
"resolved": "\"da\" | \"en\" | \"fi\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
409
|
+
"resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
404
410
|
"references": {
|
|
405
411
|
"Languages": {
|
|
406
412
|
"location": "import",
|
|
@@ -417,6 +423,25 @@ export class DatePicker {
|
|
|
417
423
|
"attribute": "language",
|
|
418
424
|
"reflect": true,
|
|
419
425
|
"defaultValue": "'en'"
|
|
426
|
+
},
|
|
427
|
+
"formatter": {
|
|
428
|
+
"type": "unknown",
|
|
429
|
+
"mutable": false,
|
|
430
|
+
"complexType": {
|
|
431
|
+
"original": "(date: Date) => string",
|
|
432
|
+
"resolved": "(date: Date) => string",
|
|
433
|
+
"references": {
|
|
434
|
+
"Date": {
|
|
435
|
+
"location": "global"
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
"required": false,
|
|
440
|
+
"optional": true,
|
|
441
|
+
"docs": {
|
|
442
|
+
"tags": [],
|
|
443
|
+
"text": "Custom formatting function. Will be used for date formatting.\n\n:::note\noverrides `format` and `language`\n:::"
|
|
444
|
+
}
|
|
420
445
|
}
|
|
421
446
|
};
|
|
422
447
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import 'moment/locale/da';
|
|
2
|
+
import 'moment/locale/de';
|
|
2
3
|
import 'moment/locale/fi';
|
|
3
|
-
import 'moment/locale/nb';
|
|
4
|
-
import 'moment/locale/sv';
|
|
5
4
|
import 'moment/locale/fr';
|
|
5
|
+
import 'moment/locale/nb';
|
|
6
6
|
import 'moment/locale/nl';
|
|
7
|
+
import 'moment/locale/sv';
|
|
7
8
|
import moment from 'moment/moment';
|
|
8
9
|
export class DateFormatter {
|
|
9
10
|
constructor(language = 'en') {
|
|
@@ -22,7 +23,10 @@ export class DateFormatter {
|
|
|
22
23
|
return null;
|
|
23
24
|
}
|
|
24
25
|
getLanguage() {
|
|
25
|
-
|
|
26
|
+
if (this.language === 'no') {
|
|
27
|
+
return 'nb';
|
|
28
|
+
}
|
|
29
|
+
return this.language;
|
|
26
30
|
}
|
|
27
31
|
getDateFormat(type) {
|
|
28
32
|
return ({
|
|
@@ -23,6 +23,7 @@ export class DatePickerCalendar {
|
|
|
23
23
|
this.isOpen = undefined;
|
|
24
24
|
this.inputElement = undefined;
|
|
25
25
|
this.language = 'en';
|
|
26
|
+
this.formatter = undefined;
|
|
26
27
|
}
|
|
27
28
|
componentWillLoad() {
|
|
28
29
|
switch (this.type) {
|
|
@@ -49,6 +50,7 @@ export class DatePickerCalendar {
|
|
|
49
50
|
this.picker = new DatetimePicker(this.format, this.language, this.change);
|
|
50
51
|
break;
|
|
51
52
|
}
|
|
53
|
+
this.picker.formatDate = this.formatter;
|
|
52
54
|
}
|
|
53
55
|
componentDidUpdate() {
|
|
54
56
|
if (this.flatPickrCreated) {
|
|
@@ -217,7 +219,7 @@ export class DatePickerCalendar {
|
|
|
217
219
|
"mutable": false,
|
|
218
220
|
"complexType": {
|
|
219
221
|
"original": "Languages",
|
|
220
|
-
"resolved": "\"da\" | \"en\" | \"fi\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
222
|
+
"resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
221
223
|
"references": {
|
|
222
224
|
"Languages": {
|
|
223
225
|
"location": "import",
|
|
@@ -234,6 +236,25 @@ export class DatePickerCalendar {
|
|
|
234
236
|
"attribute": "language",
|
|
235
237
|
"reflect": false,
|
|
236
238
|
"defaultValue": "'en'"
|
|
239
|
+
},
|
|
240
|
+
"formatter": {
|
|
241
|
+
"type": "unknown",
|
|
242
|
+
"mutable": false,
|
|
243
|
+
"complexType": {
|
|
244
|
+
"original": "(date: Date) => string",
|
|
245
|
+
"resolved": "(date: Date) => string",
|
|
246
|
+
"references": {
|
|
247
|
+
"Date": {
|
|
248
|
+
"location": "global"
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
},
|
|
252
|
+
"required": true,
|
|
253
|
+
"optional": false,
|
|
254
|
+
"docs": {
|
|
255
|
+
"tags": [],
|
|
256
|
+
"text": ""
|
|
257
|
+
}
|
|
237
258
|
}
|
|
238
259
|
};
|
|
239
260
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import flatpickr from 'flatpickr';
|
|
2
2
|
import FlatpickrLanguages from 'flatpickr/dist/l10n';
|
|
3
3
|
import 'moment/locale/da';
|
|
4
|
+
import 'moment/locale/de';
|
|
4
5
|
import 'moment/locale/fi';
|
|
6
|
+
import 'moment/locale/fr';
|
|
5
7
|
import 'moment/locale/nb';
|
|
8
|
+
import 'moment/locale/nl';
|
|
6
9
|
import 'moment/locale/sv';
|
|
7
10
|
import moment from 'moment/moment';
|
|
8
11
|
import { isAndroidDevice, isIOSDevice } from '../../../util/device';
|
|
9
|
-
import { DateFormatter } from '../dateFormatter';
|
|
10
12
|
export class Picker {
|
|
11
13
|
constructor(dateFormat, language, change) {
|
|
12
14
|
this.change = change;
|
|
@@ -17,12 +19,10 @@ export class Picker {
|
|
|
17
19
|
if (dateFormat) {
|
|
18
20
|
this.dateFormat = dateFormat;
|
|
19
21
|
}
|
|
20
|
-
this.dateFormatter = new DateFormatter(language);
|
|
21
22
|
this.getWeek = this.getWeek.bind(this);
|
|
22
23
|
this.handleClose = this.handleClose.bind(this);
|
|
23
24
|
this.handleOnClose = this.handleOnClose.bind(this);
|
|
24
25
|
this.parseDate = this.parseDate.bind(this);
|
|
25
|
-
this.formatDate = this.formatDate.bind(this);
|
|
26
26
|
this.getFlatpickrLang = this.getFlatpickrLang.bind(this);
|
|
27
27
|
}
|
|
28
28
|
init(element, container, value) {
|
|
@@ -56,9 +56,6 @@ export class Picker {
|
|
|
56
56
|
}
|
|
57
57
|
this.flatpickr.destroy();
|
|
58
58
|
}
|
|
59
|
-
formatDate(date) {
|
|
60
|
-
return this.dateFormatter.formatDate(date, this.dateFormat);
|
|
61
|
-
}
|
|
62
59
|
handleClose(selectedDates) {
|
|
63
60
|
return new Promise((resolve) => {
|
|
64
61
|
setTimeout(() => {
|
|
@@ -69,10 +66,16 @@ export class Picker {
|
|
|
69
66
|
});
|
|
70
67
|
}
|
|
71
68
|
getFlatpickrLang() {
|
|
72
|
-
|
|
69
|
+
if (this.language === 'nb') {
|
|
70
|
+
return 'no';
|
|
71
|
+
}
|
|
72
|
+
return this.language;
|
|
73
73
|
}
|
|
74
74
|
getMomentLang() {
|
|
75
|
-
|
|
75
|
+
if (this.language === 'no') {
|
|
76
|
+
return 'nb';
|
|
77
|
+
}
|
|
78
|
+
return this.language;
|
|
76
79
|
}
|
|
77
80
|
getPickerDate(selectedDates) {
|
|
78
81
|
return selectedDates[0] ? new Date(selectedDates[0].toJSON()) : null;
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
.button {
|
|
14
14
|
all: unset;
|
|
15
|
+
isolation: isolate;
|
|
16
|
+
position: relative;
|
|
15
17
|
cursor: pointer;
|
|
16
18
|
transition: color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease-out;
|
|
17
19
|
color: var(--limel-dock-item-text-color);
|
|
@@ -19,7 +21,6 @@
|
|
|
19
21
|
box-sizing: border-box;
|
|
20
22
|
display: flex;
|
|
21
23
|
align-items: center;
|
|
22
|
-
position: relative;
|
|
23
24
|
width: 100%;
|
|
24
25
|
height: var(--dock-item-height);
|
|
25
26
|
border-radius: 0.375rem;
|
|
@@ -77,4 +78,10 @@ limel-popover {
|
|
|
77
78
|
width: calc(var(--dock-item-height) - 1rem);
|
|
78
79
|
height: calc(var(--dock-item-height) - 1rem);
|
|
79
80
|
color: var(--dock-item-icon-color, var(--limel-dock-item-text-color));
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
limel-badge {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: -0.125rem;
|
|
86
|
+
right: -0.125rem;
|
|
80
87
|
}
|
|
@@ -5,6 +5,11 @@ import { createRandomString } from '../../../util/random-string';
|
|
|
5
5
|
*/
|
|
6
6
|
export class DockButton {
|
|
7
7
|
constructor() {
|
|
8
|
+
this.renderNotification = () => {
|
|
9
|
+
if (this.item.badge || this.item.badge === '') {
|
|
10
|
+
return h("limel-badge", { label: this.item.badge });
|
|
11
|
+
}
|
|
12
|
+
};
|
|
8
13
|
this.openPopover = (event) => {
|
|
9
14
|
event.stopPropagation();
|
|
10
15
|
this.isOpen = true;
|
|
@@ -57,7 +62,7 @@ export class DockButton {
|
|
|
57
62
|
return (h("button", { slot: slot, tabindex: "0", id: this.tooltipId, type: "button", class: {
|
|
58
63
|
button: true,
|
|
59
64
|
selected: (_a = this.item) === null || _a === void 0 ? void 0 : _a.selected,
|
|
60
|
-
}, onClick: handleClick }, this.renderIcon(), this.renderLabel(), this.renderTooltip()));
|
|
65
|
+
}, onClick: handleClick, "aria-live": this.item.badge ? 'polite' : 'off' }, this.renderIcon(), this.renderLabel(), this.renderTooltip(), this.renderNotification()));
|
|
61
66
|
}
|
|
62
67
|
renderIcon() {
|
|
63
68
|
if (!this.item.icon) {
|
|
@@ -20,6 +20,8 @@
|
|
|
20
20
|
* @prop --popover-surface-width: Defines the width of the popover that is opened for dock items with custom components. Defaults to `auto`.
|
|
21
21
|
*/
|
|
22
22
|
:host(limel-dock) {
|
|
23
|
+
--badge-background-color: rgb(var(--color-red-default));
|
|
24
|
+
--badge-text-color: rgb(var(--color-white));
|
|
23
25
|
--dock-item-height: 2.75rem;
|
|
24
26
|
--dock-padding: 0.25rem;
|
|
25
27
|
--dock-expand-shrink-button-height: 1rem;
|
|
@@ -3,6 +3,7 @@ const DEFAULT_MOBILE_BREAKPOINT = 700;
|
|
|
3
3
|
/**
|
|
4
4
|
* @exampleComponent limel-example-dock-basic
|
|
5
5
|
* @exampleComponent limel-example-dock-custom-component
|
|
6
|
+
* @exampleComponent limel-example-dock-notification
|
|
6
7
|
* @exampleComponent limel-example-dock-mobile
|
|
7
8
|
* @exampleComponent limel-example-dock-expanded
|
|
8
9
|
* @exampleComponent limel-example-dock-colors-css
|
|
@@ -303,7 +303,7 @@ export class File {
|
|
|
303
303
|
"mutable": false,
|
|
304
304
|
"complexType": {
|
|
305
305
|
"original": "Languages",
|
|
306
|
-
"resolved": "\"da\" | \"en\" | \"fi\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
306
|
+
"resolved": "\"da\" | \"de\" | \"en\" | \"fi\" | \"fr\" | \"nb\" | \"nl\" | \"no\" | \"sv\"",
|
|
307
307
|
"references": {
|
|
308
308
|
"Languages": {
|
|
309
309
|
"location": "import",
|
|
@@ -66,6 +66,8 @@
|
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* @prop --form-body-padding: space around content of the form
|
|
69
|
+
* @prop --form-background-color-of-even-rows: Background of even rows in the form, when layout type is `row`. Defaults to `transparent`.
|
|
70
|
+
* @prop --form-background-color-of-odd-rows:Background of odd rows in the form, when layout type is `row`. Defaults to `--contrast-200`.
|
|
69
71
|
*/
|
|
70
72
|
.mdc-typography {
|
|
71
73
|
-moz-osx-font-smoothing: grayscale;
|
|
@@ -536,22 +538,28 @@
|
|
|
536
538
|
position: relative;
|
|
537
539
|
}
|
|
538
540
|
|
|
541
|
+
.form-group .mdc-typography--headline1,
|
|
542
|
+
.form-group .mdc-typography--body1 {
|
|
543
|
+
color: rgb(var(--contrast-1100));
|
|
544
|
+
}
|
|
539
545
|
.form-group .mdc-typography--headline1 {
|
|
540
546
|
--mdc-typography-headline1-font-size: 2rem;
|
|
541
547
|
--mdc-typography-headline1-line-height: 2.25rem;
|
|
542
548
|
--mdc-typography-headline1-letter-spacing: -0.0625rem;
|
|
543
549
|
--mdc-typography-headline1-font-weight: 400;
|
|
544
|
-
color: rgb(var(--contrast-1000));
|
|
545
550
|
margin-top: 1.5rem;
|
|
546
551
|
margin-bottom: 0.5rem;
|
|
547
552
|
}
|
|
553
|
+
.form-group .form-group .mdc-typography--headline1,
|
|
554
|
+
.form-group .form-group .mdc-typography--body1 {
|
|
555
|
+
color: rgb(var(--contrast-1200));
|
|
556
|
+
}
|
|
548
557
|
.form-group .form-group .mdc-typography--headline1 {
|
|
549
558
|
--mdc-typography-headline1-font-size: 1.625rem;
|
|
550
559
|
--mdc-typography-headline1-line-height: 1.25rem;
|
|
551
560
|
--mdc-typography-headline1-font-weight: 300;
|
|
552
561
|
margin-top: 1.25rem;
|
|
553
562
|
margin-bottom: 0.5rem;
|
|
554
|
-
color: rgb(var(--contrast-1100));
|
|
555
563
|
}
|
|
556
564
|
.form-group .form-group .mdc-typography--headline1:before {
|
|
557
565
|
content: "";
|
|
@@ -567,25 +575,104 @@
|
|
|
567
575
|
border-radius: 0.125rem;
|
|
568
576
|
opacity: 0.6;
|
|
569
577
|
}
|
|
578
|
+
.form-group .form-group .form-group .mdc-typography--headline1,
|
|
579
|
+
.form-group .form-group .form-group .mdc-typography--body1 {
|
|
580
|
+
color: rgb(var(--contrast-1300));
|
|
581
|
+
}
|
|
570
582
|
.form-group .form-group .form-group .mdc-typography--headline1 {
|
|
571
583
|
--mdc-typography-headline1-font-size: 1.375rem;
|
|
572
584
|
--mdc-typography-headline1-line-height: 1.5rem;
|
|
573
585
|
--mdc-typography-headline1-font-weight: 300;
|
|
574
586
|
margin-top: 1rem;
|
|
575
587
|
margin-bottom: 0.5rem;
|
|
576
|
-
color: rgb(var(--contrast-1200));
|
|
577
588
|
}
|
|
578
589
|
.form-group .form-group .form-group .mdc-typography--headline1:before {
|
|
579
590
|
display: none;
|
|
580
591
|
}
|
|
592
|
+
.form-group .form-group .form-group .form-group .mdc-typography--headline1,
|
|
593
|
+
.form-group .form-group .form-group .form-group .mdc-typography--body1 {
|
|
594
|
+
color: rgb(var(--contrast-1400));
|
|
595
|
+
}
|
|
581
596
|
.form-group .form-group .form-group .form-group .mdc-typography--headline1 {
|
|
582
597
|
--mdc-typography-headline1-font-size: 1.25rem;
|
|
583
598
|
--mdc-typography-headline1-line-height: 1.25rem;
|
|
584
599
|
--mdc-typography-headline1-font-weight: 300;
|
|
585
600
|
margin-top: 1rem;
|
|
586
601
|
margin-bottom: 0.5rem;
|
|
587
|
-
color: rgb(var(--contrast-1200));
|
|
588
602
|
}
|
|
589
603
|
.form-group .form-group .form-group .form-group .mdc-typography--headline1:before {
|
|
590
604
|
display: none;
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
/*
|
|
608
|
+
* This file is imported into every component!
|
|
609
|
+
*
|
|
610
|
+
* Nothing in this file may output any CSS
|
|
611
|
+
* without being explicitly called by outside code.
|
|
612
|
+
*/
|
|
613
|
+
.limel-form-row--layout {
|
|
614
|
+
--limel-form-row-border-radius: 0.375rem;
|
|
615
|
+
--limel-form-row-icon-size: 1.75rem;
|
|
616
|
+
--limel-form-row-main-information-gap: 0.5rem;
|
|
617
|
+
display: flex;
|
|
618
|
+
flex-direction: column;
|
|
619
|
+
}
|
|
620
|
+
.limel-form-row--layout .row {
|
|
621
|
+
display: flex;
|
|
622
|
+
gap: 0.5rem;
|
|
623
|
+
flex-direction: column;
|
|
624
|
+
padding: 0.5rem 1rem;
|
|
625
|
+
}
|
|
626
|
+
.limel-form-row--layout .row:nth-child(odd) {
|
|
627
|
+
background-color: var(--form-background-color-of-odd-rows, rgb(var(--contrast-200)));
|
|
628
|
+
}
|
|
629
|
+
.limel-form-row--layout .row:nth-child(even) {
|
|
630
|
+
background-color: var(--form-background-color-of-even-rows, transparent);
|
|
631
|
+
}
|
|
632
|
+
.limel-form-row--layout .row:first-child {
|
|
633
|
+
border-radius: var(--limel-form-row-border-radius) var(--limel-form-row-border-radius) 0 0;
|
|
634
|
+
}
|
|
635
|
+
.limel-form-row--layout .row:last-child {
|
|
636
|
+
border-radius: 0 0 var(--limel-form-row-border-radius) var(--limel-form-row-border-radius);
|
|
637
|
+
}
|
|
638
|
+
.limel-form-row--layout .main-information {
|
|
639
|
+
display: flex;
|
|
640
|
+
flex-direction: row;
|
|
641
|
+
align-items: center;
|
|
642
|
+
gap: var(--limel-form-row-main-information-gap);
|
|
643
|
+
min-width: 0;
|
|
644
|
+
}
|
|
645
|
+
.limel-form-row--layout limel-icon {
|
|
646
|
+
color: rgb(var(--contrast-1200));
|
|
647
|
+
width: var(--limel-form-row-icon-size);
|
|
648
|
+
flex-shrink: 0;
|
|
649
|
+
min-width: 0;
|
|
650
|
+
}
|
|
651
|
+
.limel-form-row--layout .title {
|
|
652
|
+
overflow: hidden;
|
|
653
|
+
white-space: nowrap;
|
|
654
|
+
text-overflow: ellipsis;
|
|
655
|
+
margin: 0;
|
|
656
|
+
font-weight: normal;
|
|
657
|
+
flex-grow: 1;
|
|
658
|
+
color: var(--mdc-theme-on-surface);
|
|
659
|
+
font-size: var(--mdc-typography-subtitle1-font-size, 0.875rem);
|
|
660
|
+
}
|
|
661
|
+
.limel-form-row--layout .description {
|
|
662
|
+
margin: 0;
|
|
663
|
+
color: var(--mdc-theme-text-secondary-on-background);
|
|
664
|
+
font-size: var(--mdc-typography-body2-font-size, 0.8125rem);
|
|
665
|
+
line-height: 1.5;
|
|
666
|
+
}
|
|
667
|
+
.limel-form-row--layout .has-icon .description {
|
|
668
|
+
padding-left: calc(var(--limel-form-row-icon-size) + var(--limel-form-row-main-information-gap));
|
|
669
|
+
}
|
|
670
|
+
.limel-form-row--layout .form-group.field {
|
|
671
|
+
flex-shrink: 0;
|
|
672
|
+
display: flex;
|
|
673
|
+
align-content: center;
|
|
674
|
+
}
|
|
675
|
+
.limel-form-row--layout .form-group.field limel-slider {
|
|
676
|
+
min-width: 8rem;
|
|
677
|
+
display: block;
|
|
591
678
|
}
|
|
@@ -23,6 +23,7 @@ import { mapValues } from 'lodash-es';
|
|
|
23
23
|
* @exampleComponent limel-example-form-span-fields
|
|
24
24
|
* @exampleComponent limel-example-custom-error-message
|
|
25
25
|
* @exampleComponent limel-example-server-errors
|
|
26
|
+
* @exampleComponent limel-example-form-row-layout
|
|
26
27
|
*/
|
|
27
28
|
export class Form {
|
|
28
29
|
constructor() {
|
|
@@ -8,4 +8,12 @@ export var FormLayoutType;
|
|
|
8
8
|
* Render the form fields using a responsive grid layout
|
|
9
9
|
*/
|
|
10
10
|
FormLayoutType["Grid"] = "grid";
|
|
11
|
+
/**
|
|
12
|
+
* Render the form fields in full-width rows.
|
|
13
|
+
* Each row can have a leading `icon`, and a field.
|
|
14
|
+
* `title` and `description` provided by the schema will be placed
|
|
15
|
+
* on the row itself, and not on the field.
|
|
16
|
+
* This layout is good for creating UIs for user settings pages.
|
|
17
|
+
*/
|
|
18
|
+
FormLayoutType["Row"] = "row";
|
|
11
19
|
})(FormLayoutType || (FormLayoutType = {}));
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export class Row extends React.Component {
|
|
3
|
+
constructor(props) {
|
|
4
|
+
super(props);
|
|
5
|
+
this.props = props;
|
|
6
|
+
}
|
|
7
|
+
render() {
|
|
8
|
+
const classes = ['row'];
|
|
9
|
+
if (this.icon) {
|
|
10
|
+
classes.push('has-icon');
|
|
11
|
+
}
|
|
12
|
+
return React.createElement('div', {
|
|
13
|
+
className: classes.join(' '),
|
|
14
|
+
}, this.renderMainInformation(), this.renderDescription());
|
|
15
|
+
}
|
|
16
|
+
renderIcon() {
|
|
17
|
+
if (this.icon) {
|
|
18
|
+
return React.createElement('limel-icon', {
|
|
19
|
+
name: this.icon,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
renderMainInformation() {
|
|
24
|
+
return React.createElement('div', { className: 'main-information' }, this.renderIcon(), this.renderTitle(), this.renderChildren());
|
|
25
|
+
}
|
|
26
|
+
renderTitle() {
|
|
27
|
+
var _a;
|
|
28
|
+
return React.createElement('h1', { className: 'title' }, (_a = this.schema) === null || _a === void 0 ? void 0 : _a.title);
|
|
29
|
+
}
|
|
30
|
+
renderDescription() {
|
|
31
|
+
var _a;
|
|
32
|
+
if ((_a = this.schema) === null || _a === void 0 ? void 0 : _a.description) {
|
|
33
|
+
return React.createElement('p', { className: 'description' }, this.schema.description);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
renderChildren() {
|
|
37
|
+
const children = this.props.children;
|
|
38
|
+
return Object.assign(Object.assign({}, children), { props: Object.assign(Object.assign({}, children.props), { schema: Object.assign(Object.assign({}, children.props.schema), { title: null, description: null }) }) });
|
|
39
|
+
}
|
|
40
|
+
get schema() {
|
|
41
|
+
return this.props.children.props.schema;
|
|
42
|
+
}
|
|
43
|
+
get icon() {
|
|
44
|
+
var _a, _b, _c;
|
|
45
|
+
return (_c = (_b = (_a = this.schema) === null || _a === void 0 ? void 0 : _a.lime) === null || _b === void 0 ? void 0 : _b.layout) === null || _c === void 0 ? void 0 : _c.icon;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { FormLayoutType } from '../form.types';
|
|
3
3
|
import { renderDescription, renderTitle } from './common';
|
|
4
4
|
import { GridLayout } from './grid-layout';
|
|
5
|
+
import { RowLayout } from './row-layout';
|
|
5
6
|
export const ObjectFieldTemplate = (props) => {
|
|
6
7
|
const id = props.idSchema.$id;
|
|
7
8
|
if (id === 'root' || !isCollapsible(props.schema)) {
|
|
@@ -41,6 +42,7 @@ function renderLayout(properties, layout) {
|
|
|
41
42
|
const layouts = {
|
|
42
43
|
default: renderDefaultLayout,
|
|
43
44
|
grid: renderGridLayout,
|
|
45
|
+
row: renderRowLayout,
|
|
44
46
|
};
|
|
45
47
|
return layouts[type](properties, layout);
|
|
46
48
|
}
|
|
@@ -54,6 +56,9 @@ function renderGridLayout(properties, layout) {
|
|
|
54
56
|
options: layout,
|
|
55
57
|
}, properties.map((element) => element.content));
|
|
56
58
|
}
|
|
59
|
+
function renderRowLayout(properties) {
|
|
60
|
+
return React.createElement(RowLayout, {}, properties.map((element) => element.content));
|
|
61
|
+
}
|
|
57
62
|
function isCollapsible(schema) {
|
|
58
63
|
var _a;
|
|
59
64
|
return !!((_a = schema.lime) === null || _a === void 0 ? void 0 : _a.collapsible);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Row } from '../row/row';
|
|
3
|
+
export class RowLayout extends React.Component {
|
|
4
|
+
constructor(props) {
|
|
5
|
+
super(props);
|
|
6
|
+
this.props = props;
|
|
7
|
+
this.elementRef = React.createRef();
|
|
8
|
+
}
|
|
9
|
+
render() {
|
|
10
|
+
const classes = ['limel-form-row--layout'];
|
|
11
|
+
return React.createElement('div', {
|
|
12
|
+
className: classes.join(' '),
|
|
13
|
+
ref: this.elementRef,
|
|
14
|
+
}, this.props.children.map((child, index) => {
|
|
15
|
+
return React.createElement(Row, {
|
|
16
|
+
key: index.toString(),
|
|
17
|
+
}, child);
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
font-weight: bold;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
slot[name=actions] {
|
|
77
77
|
flex-shrink: 0;
|
|
78
78
|
}
|
|
79
79
|
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
:host(limel-header.has-responsive-layout) .headings {
|
|
96
96
|
padding-right: 0.5rem;
|
|
97
97
|
}
|
|
98
|
-
:host(limel-header.has-responsive-layout)
|
|
98
|
+
:host(limel-header.has-responsive-layout) slot[name=actions] {
|
|
99
99
|
display: flex;
|
|
100
100
|
justify-content: flex-end;
|
|
101
101
|
}
|