@aquera/nile-elements 0.0.6-1 → 0.0.6-3
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.css.js +0 -162
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.d.ts +5 -21
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js +21 -141
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-textarea/nile-textarea.d.ts +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-textarea/nile-textarea.js +13 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-textarea/nile-textarea.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +22 -185
- package/dist/nile-date-picker/index.cjs.js +1 -1
- package/dist/nile-date-picker/index.esm.js +1 -1
- package/dist/nile-date-picker/nile-date-picker.cjs.js +1 -1
- package/dist/nile-date-picker/nile-date-picker.cjs.js.map +1 -1
- package/dist/nile-date-picker/nile-date-picker.css.cjs.js +1 -1
- package/dist/nile-date-picker/nile-date-picker.css.cjs.js.map +1 -1
- package/dist/nile-date-picker/nile-date-picker.css.esm.js +2 -164
- package/dist/nile-date-picker/nile-date-picker.esm.js +3 -4
- package/dist/nile-textarea/nile-textarea.cjs.js +1 -1
- package/dist/nile-textarea/nile-textarea.cjs.js.map +1 -1
- package/dist/nile-textarea/nile-textarea.esm.js +2 -2
- package/dist/src/nile-date-picker/nile-date-picker.css.js +0 -162
- package/dist/src/nile-date-picker/nile-date-picker.css.js.map +1 -1
- package/dist/src/nile-date-picker/nile-date-picker.d.ts +5 -21
- package/dist/src/nile-date-picker/nile-date-picker.js +21 -141
- package/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
- package/dist/src/nile-textarea/nile-textarea.d.ts +1 -0
- package/dist/src/nile-textarea/nile-textarea.js +13 -0
- package/dist/src/nile-textarea/nile-textarea.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-date-picker/nile-date-picker.css.ts +0 -162
- package/src/nile-date-picker/nile-date-picker.ts +20 -160
- package/src/nile-textarea/nile-textarea.ts +14 -0
@@ -11,168 +11,6 @@ import { css } from 'lit-element';
|
|
11
11
|
export const styles = css `
|
12
12
|
:host {
|
13
13
|
}
|
14
|
-
|
15
|
-
.calendar-container {
|
16
|
-
font-family: Colfax-regular;
|
17
|
-
width: 365px;
|
18
|
-
height: auto;
|
19
|
-
text-align: center;
|
20
|
-
background: white;
|
21
|
-
}
|
22
|
-
|
23
|
-
.calendar-container.with-margin {
|
24
|
-
margin-right: 20px;
|
25
|
-
}
|
26
|
-
|
27
|
-
.calendar-header {
|
28
|
-
display: flex;
|
29
|
-
justify-content: space-between;
|
30
|
-
padding: 10px;
|
31
|
-
padding: 22px 20px;
|
32
|
-
font-size: 14px;
|
33
|
-
font-weight: 600;
|
34
|
-
line-height: 14px;
|
35
|
-
letter-spacing: 0.2px;
|
36
|
-
}
|
37
|
-
|
38
|
-
.divider {
|
39
|
-
width: 100%;
|
40
|
-
height: 1px;
|
41
|
-
background: #c7ced4;
|
42
|
-
}
|
43
|
-
|
44
|
-
.day-names {
|
45
|
-
font-size: 14px;
|
46
|
-
font-weight: 600;
|
47
|
-
line-height: 14px;
|
48
|
-
letter-spacing: 0.2px;
|
49
|
-
height: 50px;
|
50
|
-
margin-top: 10px;
|
51
|
-
}
|
52
|
-
|
53
|
-
.day-names,
|
54
|
-
.days {
|
55
|
-
display: flex;
|
56
|
-
flex-wrap: wrap;
|
57
|
-
justify-content: flex-start;
|
58
|
-
height: auto;
|
59
|
-
align-items: center;
|
60
|
-
}
|
61
|
-
|
62
|
-
.days {
|
63
|
-
height: auto;
|
64
|
-
}
|
65
|
-
|
66
|
-
.day {
|
67
|
-
flex-basis: calc(100% / 7);
|
68
|
-
box-sizing: border-box;
|
69
|
-
width: 48px;
|
70
|
-
align-items: center;
|
71
|
-
padding: 10px;
|
72
|
-
height: 32px;
|
73
|
-
margin-top: 6px;
|
74
|
-
margin-bottom: 6px;
|
75
|
-
display: flex;
|
76
|
-
justify-content: center;
|
77
|
-
align-items: center;
|
78
|
-
}
|
79
|
-
|
80
|
-
.filler {
|
81
|
-
color: grey;
|
82
|
-
}
|
83
|
-
|
84
|
-
.selected-date {
|
85
|
-
color: white;
|
86
|
-
border-radius: 4px;
|
87
|
-
background: #a5d3f3;
|
88
|
-
}
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
.calendar-wrapper {
|
93
|
-
background: white;
|
94
|
-
display: flex;
|
95
|
-
justify-content: space-between;
|
96
|
-
width: 730px;
|
97
|
-
}
|
98
|
-
|
99
|
-
.selected-date,
|
100
|
-
.range-start,
|
101
|
-
.range-end {
|
102
|
-
border-radius: 4px;
|
103
|
-
background: #a5d3f3;
|
104
|
-
color: white;
|
105
|
-
}
|
106
|
-
|
107
|
-
|
108
|
-
.range-start {
|
109
|
-
background: #a5d3f3;
|
110
|
-
border-radius: 4px 0 0 4px;
|
111
|
-
color: white;
|
112
|
-
}
|
113
|
-
|
114
|
-
.range-end {
|
115
|
-
background: #a5d3f3;
|
116
|
-
border-radius: 0 4px 4px 0;
|
117
|
-
color: white;
|
118
|
-
}
|
119
|
-
|
120
|
-
.range-middle {
|
121
|
-
background: #a5d3f3;
|
122
|
-
color: white;
|
123
|
-
border-radius: 0;
|
124
|
-
}
|
125
|
-
|
126
|
-
.day.selected {
|
127
|
-
background: #a5d3f3;
|
128
|
-
color: white;
|
129
|
-
border-radius: 4px;
|
130
|
-
}
|
131
|
-
|
132
|
-
.day.in-range {
|
133
|
-
background: #a5d3f3;
|
134
|
-
color: white;
|
135
|
-
}
|
136
|
-
|
137
|
-
.selected-date {
|
138
|
-
color: white;
|
139
|
-
border-radius: 4px;
|
140
|
-
background: #a5d3f3;
|
141
|
-
}
|
142
|
-
|
143
|
-
.base {
|
144
|
-
background-color: white;
|
145
|
-
border-radius: 4px;
|
146
|
-
padding-bottom: 20px
|
147
|
-
}
|
148
|
-
|
149
|
-
.calender-input{
|
150
|
-
padding: 20px;
|
151
|
-
padding-bottom: 0px;
|
152
|
-
}
|
153
|
-
|
154
|
-
.from {
|
155
|
-
display: flex;
|
156
|
-
justify-content: space-between;
|
157
|
-
gap: 20px;
|
158
|
-
}
|
159
|
-
|
160
|
-
.manual-input{
|
161
|
-
width:100%;
|
162
|
-
}
|
163
|
-
|
164
|
-
.manual-input-label{
|
165
|
-
font-size: 12px;
|
166
|
-
font-style: normal;
|
167
|
-
font-weight: 500;
|
168
|
-
margin-bottom: 10px;
|
169
|
-
}
|
170
|
-
|
171
|
-
.apply-button {
|
172
|
-
text-align: right;
|
173
|
-
display: block;
|
174
|
-
padding-top: 20px;
|
175
|
-
}
|
176
14
|
`;
|
177
15
|
export default [styles];
|
178
16
|
//# sourceMappingURL=nile-date-picker.css.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-date-picker.css.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-date-picker.css.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;CAGxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * DatePicker CSS\n */\nexport const styles = css`\n :host {\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -6,8 +6,6 @@
|
|
6
6
|
*/
|
7
7
|
import { CSSResultArray, TemplateResult } from 'lit-element';
|
8
8
|
import NileElement from '../internal/nile-element';
|
9
|
-
import type { PropertyValues } from 'lit';
|
10
|
-
import '../nile-popup';
|
11
9
|
import { NileDropdown } from '../nile-dropdown';
|
12
10
|
/**
|
13
11
|
* Nile icon component.
|
@@ -21,31 +19,17 @@ export declare class NileDatePicker extends NileElement {
|
|
21
19
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
22
20
|
*/
|
23
21
|
static get styles(): CSSResultArray;
|
24
|
-
private currentMonth;
|
25
|
-
private currentYear;
|
26
|
-
dropdown: NileDropdown;
|
27
|
-
dropDownOpened: boolean;
|
28
|
-
value: any;
|
29
|
-
rangeValue: any;
|
30
|
-
valueAttribute: string | null;
|
31
|
-
formattedDate: string | null;
|
32
|
-
startDate: Date | null;
|
33
|
-
endDate: Date | null;
|
34
|
-
isSelectingStart: boolean;
|
35
22
|
range: boolean;
|
36
|
-
|
37
|
-
|
38
|
-
static get observedAttributes(): string[];
|
39
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
40
|
-
initializeValue(): void;
|
41
|
-
handleChanged(event: any): void;
|
42
|
-
connectedCallback(): void;
|
43
|
-
disconnectedCallback(): void;
|
23
|
+
value: any;
|
24
|
+
dropdown: NileDropdown;
|
44
25
|
/**
|
45
26
|
* Render method
|
46
27
|
* @slot This is a slot test
|
47
28
|
*/
|
48
29
|
render(): TemplateResult;
|
30
|
+
handleChanged(event: any): void;
|
31
|
+
connectedCallback(): void;
|
32
|
+
disconnectedCallback(): void;
|
49
33
|
}
|
50
34
|
export default NileDatePicker;
|
51
35
|
declare global {
|
@@ -6,12 +6,9 @@
|
|
6
6
|
*/
|
7
7
|
import { __decorate } from "tslib";
|
8
8
|
import { html, property, } from 'lit-element';
|
9
|
-
import { customElement } from 'lit/decorators.js';
|
9
|
+
import { customElement, query } from 'lit/decorators.js';
|
10
10
|
import { styles } from './nile-date-picker.css';
|
11
|
-
import { query } from 'lit/decorators.js';
|
12
|
-
import { watch } from '../internal/watch';
|
13
11
|
import NileElement from '../internal/nile-element';
|
14
|
-
import '../nile-popup';
|
15
12
|
/**
|
16
13
|
* Nile icon component.
|
17
14
|
*
|
@@ -21,14 +18,6 @@ import '../nile-popup';
|
|
21
18
|
let NileDatePicker = class NileDatePicker extends NileElement {
|
22
19
|
constructor() {
|
23
20
|
super(...arguments);
|
24
|
-
this.currentMonth = new Date().getMonth();
|
25
|
-
this.currentYear = new Date().getFullYear();
|
26
|
-
this.dropDownOpened = false;
|
27
|
-
this.valueAttribute = null;
|
28
|
-
this.formattedDate = null;
|
29
|
-
this.startDate = null;
|
30
|
-
this.endDate = null;
|
31
|
-
this.isSelectingStart = true; // flag to indicate what we're selecting
|
32
21
|
this.range = false;
|
33
22
|
}
|
34
23
|
/**
|
@@ -38,104 +27,6 @@ let NileDatePicker = class NileDatePicker extends NileElement {
|
|
38
27
|
static get styles() {
|
39
28
|
return [styles];
|
40
29
|
}
|
41
|
-
valueChanged() {
|
42
|
-
if (this.range && this.value) {
|
43
|
-
this.rangeValue = this.value;
|
44
|
-
this.value = null;
|
45
|
-
return;
|
46
|
-
}
|
47
|
-
if (this.value && !isNaN(this.value.getTime())) {
|
48
|
-
const offset = this.value.getTimezoneOffset();
|
49
|
-
const localDate = new Date(this.value.getTime() - offset * 60 * 1000);
|
50
|
-
if (!isNaN(localDate.getTime())) {
|
51
|
-
this.valueAttribute = localDate.toISOString().split('T')[0];
|
52
|
-
this.formattedDate = `${String(localDate.getDate()).padStart(2, '0')}/${String(localDate.getMonth() + 1).padStart(2, '0')}/${localDate.getFullYear()}`;
|
53
|
-
}
|
54
|
-
}
|
55
|
-
}
|
56
|
-
updated(changedProperties) {
|
57
|
-
super.updated(changedProperties);
|
58
|
-
if (changedProperties.has('valueAttribute')) {
|
59
|
-
const date = new Date(this.valueAttribute || '');
|
60
|
-
if (!isNaN(date.getTime())) {
|
61
|
-
const offset = date.getTimezoneOffset();
|
62
|
-
this.value = new Date(date.getTime() - offset * 60 * 1000);
|
63
|
-
this.currentMonth = this.value.getMonth();
|
64
|
-
this.currentYear = this.value.getFullYear();
|
65
|
-
}
|
66
|
-
}
|
67
|
-
}
|
68
|
-
static get observedAttributes() {
|
69
|
-
return ['value', 'range'];
|
70
|
-
}
|
71
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
72
|
-
if (name === 'value') {
|
73
|
-
this.valueAttribute = newValue;
|
74
|
-
this.initializeValue();
|
75
|
-
}
|
76
|
-
else if (name === 'range') {
|
77
|
-
this.range = newValue !== null;
|
78
|
-
}
|
79
|
-
}
|
80
|
-
initializeValue() {
|
81
|
-
if (this.range) {
|
82
|
-
try {
|
83
|
-
const rangeValue = JSON.parse(this.valueAttribute || '');
|
84
|
-
this.startDate = new Date(rangeValue.startDate);
|
85
|
-
this.endDate = new Date(rangeValue.endDate);
|
86
|
-
// Convert to local time
|
87
|
-
this.startDate = new Date(this.startDate.getTime());
|
88
|
-
this.endDate = new Date(this.endDate.getTime());
|
89
|
-
this.rangeValue = {
|
90
|
-
startDate: this.startDate,
|
91
|
-
endDate: this.endDate,
|
92
|
-
};
|
93
|
-
this.value = null;
|
94
|
-
}
|
95
|
-
catch (e) {
|
96
|
-
// console.error('Invalid range value');
|
97
|
-
}
|
98
|
-
}
|
99
|
-
else {
|
100
|
-
if (this.valueAttribute) {
|
101
|
-
let date;
|
102
|
-
date = new Date(this.valueAttribute);
|
103
|
-
date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
|
104
|
-
if (!isNaN(date.getTime())) {
|
105
|
-
this.value = date;
|
106
|
-
this.currentMonth = this.value.getMonth();
|
107
|
-
this.currentYear = this.value.getFullYear();
|
108
|
-
this.rangeValue = null;
|
109
|
-
}
|
110
|
-
}
|
111
|
-
}
|
112
|
-
this.requestUpdate();
|
113
|
-
}
|
114
|
-
handleChanged(event) {
|
115
|
-
this.emit('nile-changed', { value: event.detail.value });
|
116
|
-
if (this.dropdown) {
|
117
|
-
this.dropdown.hide();
|
118
|
-
}
|
119
|
-
}
|
120
|
-
connectedCallback() {
|
121
|
-
super.connectedCallback();
|
122
|
-
this.initializeValue();
|
123
|
-
if (this.valueAttribute) {
|
124
|
-
const date = new Date(this.valueAttribute);
|
125
|
-
if (!isNaN(date.getTime())) {
|
126
|
-
this.value = date;
|
127
|
-
this.currentMonth = this.value.getMonth();
|
128
|
-
this.currentYear = this.value.getFullYear();
|
129
|
-
}
|
130
|
-
}
|
131
|
-
this.emit('nile-init');
|
132
|
-
}
|
133
|
-
disconnectedCallback() {
|
134
|
-
super.disconnectedCallback();
|
135
|
-
this.emit('nile-destroy');
|
136
|
-
}
|
137
|
-
/* #endregion */
|
138
|
-
/* #region Methods */
|
139
30
|
/**
|
140
31
|
* Render method
|
141
32
|
* @slot This is a slot test
|
@@ -148,45 +39,34 @@ let NileDatePicker = class NileDatePicker extends NileElement {
|
|
148
39
|
part="trigger"
|
149
40
|
name="trigger"
|
150
41
|
></slot>
|
151
|
-
|
152
|
-
<nile-calendar .value="${this.range}" .range="${this.range}" @nile-changed="${this.handleChanged}"> </nile-calendar>
|
42
|
+
<nile-calendar value="${this.value}" .range="${this.range}" @nile-changed="${this.handleChanged}"></nile-calendar>
|
153
43
|
</nile-dropdown>
|
154
44
|
`;
|
155
45
|
}
|
46
|
+
handleChanged(event) {
|
47
|
+
this.emit('nile-changed', event.detail);
|
48
|
+
if (this.dropdown) {
|
49
|
+
this.dropdown.hide();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
connectedCallback() {
|
53
|
+
super.connectedCallback();
|
54
|
+
this.emit('nile-init');
|
55
|
+
}
|
56
|
+
disconnectedCallback() {
|
57
|
+
super.disconnectedCallback();
|
58
|
+
this.emit('nile-destroy');
|
59
|
+
}
|
156
60
|
};
|
157
|
-
__decorate([
|
158
|
-
query('nile-dropdown')
|
159
|
-
], NileDatePicker.prototype, "dropdown", void 0);
|
160
|
-
__decorate([
|
161
|
-
property({ type: Boolean, reflect: true })
|
162
|
-
], NileDatePicker.prototype, "dropDownOpened", void 0);
|
163
|
-
__decorate([
|
164
|
-
property({ type: Object })
|
165
|
-
], NileDatePicker.prototype, "value", void 0);
|
166
|
-
__decorate([
|
167
|
-
property({ type: Object })
|
168
|
-
], NileDatePicker.prototype, "rangeValue", void 0);
|
169
|
-
__decorate([
|
170
|
-
property({ type: String, attribute: 'value' })
|
171
|
-
], NileDatePicker.prototype, "valueAttribute", void 0);
|
172
|
-
__decorate([
|
173
|
-
property({ type: String, attribute: 'value' })
|
174
|
-
], NileDatePicker.prototype, "formattedDate", void 0);
|
175
|
-
__decorate([
|
176
|
-
property({ type: Object })
|
177
|
-
], NileDatePicker.prototype, "startDate", void 0);
|
178
|
-
__decorate([
|
179
|
-
property({ type: Object })
|
180
|
-
], NileDatePicker.prototype, "endDate", void 0);
|
181
|
-
__decorate([
|
182
|
-
property({ type: Boolean })
|
183
|
-
], NileDatePicker.prototype, "isSelectingStart", void 0);
|
184
61
|
__decorate([
|
185
62
|
property({ type: Boolean })
|
186
63
|
], NileDatePicker.prototype, "range", void 0);
|
187
64
|
__decorate([
|
188
|
-
|
189
|
-
], NileDatePicker.prototype, "
|
65
|
+
property()
|
66
|
+
], NileDatePicker.prototype, "value", void 0);
|
67
|
+
__decorate([
|
68
|
+
query('nile-dropdown')
|
69
|
+
], NileDatePicker.prototype, "dropdown", void 0);
|
190
70
|
NileDatePicker = __decorate([
|
191
71
|
customElement('nile-date-picker')
|
192
72
|
], NileDatePicker);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-date-picker.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAGhD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAO1C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAMnD,OAAO,eAAe,CAAC;AAGvB;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QASG,iBAAY,GAAW,IAAI,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;QAC7C,gBAAW,GAAW,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAIX,mBAAc,GAAG,KAAK,CAAC;QAMnB,mBAAc,GAEnD,IAAI,CAAC;QAEgC,kBAAa,GAC3D,IAAI,CAAC;QAEqB,cAAS,GAAgB,IAAI,CAAC;QAC9B,YAAO,GAAgB,IAAI,CAAC;QAC3B,qBAAgB,GAAG,IAAI,CAAC,CAAC,wCAAwC;QAEjE,UAAK,GAAG,KAAK,CAAC;IA8I7C,CAAC;IA5KC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IA2BD,YAAY;QAEV,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE;YAC5B,IAAI,CAAC,UAAU,GAAG,IA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A6B;AAC3B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAyB;AAExB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAe;AAG3C;IADC,KAAK,CAAC,OAAO,CAAC;kDAuBd;AAxDU,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA6K1B;SA7KY,cAAc;AA+K3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport { animateTo, stopAnimations } from '../internal/animate';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport {\n getAnimation,\n setDefaultAnimation,\n} from '../utilities/animation-registry';\nimport { getTabbableBoundary } from '../internal/tabbable';\nimport { waitForEvent } from '../internal/event';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport type NileButton from '../nile-button/nile-button';\nimport type NileIconButton from '../nile-icon-button/nile-icon-button';\nimport type { NileMenu } from '../nile-menu';\nimport type { NilePopup } from '../nile-popup';\nimport '../nile-popup';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n private currentMonth: number = new Date().getMonth();\n private currentYear: number = new Date().getFullYear();\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n @property({ type: Boolean, reflect: true }) dropDownOpened = false;\n\n @property({ type: Object }) value : any;\n\n @property({ type: Object }) rangeValue : any;\n\n @property({ type: String, attribute: 'value' }) valueAttribute:\n | string\n | null = null;\n\n @property({ type: String, attribute: 'value' }) formattedDate: string | null =\n null;\n\n @property({ type: Object }) startDate: Date | null = null;\n @property({ type: Object }) endDate: Date | null = null;\n @property({ type: Boolean }) isSelectingStart = true; // flag to indicate what we're selecting\n\n @property({ type: Boolean }) range = false;\n\n @watch('value')\n valueChanged() {\n\n if (this.range && this.value) {\n this.rangeValue = this.value;\n this.value = null;\n return;\n }\n\n if (this.value && !isNaN(this.value.getTime())) {\n const offset = this.value.getTimezoneOffset();\n const localDate = new Date(this.value.getTime() - offset * 60 * 1000);\n if (!isNaN(localDate.getTime())) {\n this.valueAttribute = localDate.toISOString().split('T')[0];\n this.formattedDate = `${String(localDate.getDate()).padStart(\n 2,\n '0'\n )}/${String(localDate.getMonth() + 1).padStart(\n 2,\n '0'\n )}/${localDate.getFullYear()}`;\n }\n }\n }\n\n\n updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n\n if (changedProperties.has('valueAttribute')) {\n const date = new Date(this.valueAttribute || '');\n if (!isNaN(date.getTime())) {\n const offset = date.getTimezoneOffset();\n this.value = new Date(date.getTime() - offset * 60 * 1000);\n this.currentMonth = this.value.getMonth();\n this.currentYear = this.value.getFullYear();\n }\n }\n }\n\n static get observedAttributes() {\n return ['value', 'range'];\n }\n\n attributeChangedCallback(name: string, oldValue: string, newValue: string) {\n if (name === 'value') {\n this.valueAttribute = newValue;\n this.initializeValue();\n } else if (name === 'range') {\n this.range = newValue !== null;\n }\n }\n\n initializeValue() {\n if (this.range) {\n try {\n const rangeValue = JSON.parse(this.valueAttribute || '');\n this.startDate = new Date(rangeValue.startDate);\n this.endDate = new Date(rangeValue.endDate);\n\n // Convert to local time\n this.startDate = new Date(this.startDate.getTime());\n this.endDate = new Date(this.endDate.getTime());\n\n this.rangeValue = {\n startDate: this.startDate,\n endDate: this.endDate,\n };\n this.value = null;\n } catch (e) {\n // console.error('Invalid range value');\n }\n } else {\n if (this.valueAttribute) {\n let date: Date;\n\n date = new Date(this.valueAttribute);\n\n date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);\n\n if (!isNaN(date.getTime())) {\n this.value = date;\n this.currentMonth = this.value.getMonth();\n this.currentYear = this.value.getFullYear();\n this.rangeValue = null;\n }\n }\n }\n this.requestUpdate();\n }\n\n handleChanged(event:any) {\n this.emit('nile-changed', { value: event.detail.value });\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.initializeValue();\n\n if (this.valueAttribute) {\n const date = new Date(this.valueAttribute);\n if (!isNaN(date.getTime())) {\n this.value = date;\n this.currentMonth = this.value.getMonth();\n this.currentYear = this.value.getFullYear();\n }\n }\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n\n /* #endregion */\n\n /* #region Methods */\n\n /**\n * Render method\n * @slot This is a slot test\n */\n render(): TemplateResult {\n\n return html`\n <nile-dropdown .hoist=\"${true}\">\n <slot\n slot=\"trigger\"\n part=\"trigger\"\n name=\"trigger\"\n ></slot>\n\n<nile-calendar .value=\"${this.range}\" .range=\"${this.range}\" @nile-changed=\"${this.handleChanged}\"> </nile-calendar>\n </nile-dropdown>\n `;\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"nile-date-picker.js","sourceRoot":"","sources":["../../../src/nile-date-picker/nile-date-picker.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAEL,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;GAKG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,WAAW;IAAxC;;QASwB,UAAK,GAAG,KAAK,CAAC;IAwC7C,CAAC;IAhDC;;;OAGG;IACI,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IASD;;;OAGG;IACH,MAAM;QACJ,OAAO,IAAI,CAAA;+BACgB,IAAI;;;;;;8BAML,IAAI,CAAC,KAAK,aAAa,IAAI,CAAC,KAAK,oBAAoB,IAAI,CAAC,aAAa;;KAEhG,CAAC;IACJ,CAAC;IAED,aAAa,CAAC,KAAU;QACtB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;SACtB;IACH,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACzB,CAAC;IAED,oBAAoB;QAClB,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC5B,CAAC;CACF,CAAA;AAxC8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAe;AAE/B;IAAX,QAAQ,EAAE;6CAAY;AAEC;IAAvB,KAAK,CAAC,eAAe,CAAC;gDAAwB;AAbpC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CAiD1B;SAjDY,cAAc;AAmD3B,eAAe,cAAc,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement, query } from 'lit/decorators.js';\nimport { styles } from './nile-date-picker.css';\nimport NileElement from '../internal/nile-element';\nimport { NileDropdown } from '../nile-dropdown';\n\n/**\n * Nile icon component.\n *\n * @tag nile-date-picker\n *\n */\n@customElement('nile-date-picker')\nexport class NileDatePicker extends NileElement {\n /**\n * The styles for DatePicker\n * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`\n */\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ type: Boolean }) range = false;\n\n @property() value: any;\n\n @query('nile-dropdown') dropdown: NileDropdown;\n\n\n /**\n * Render method\n * @slot This is a slot test\n */\n render(): TemplateResult {\n return html`\n <nile-dropdown .hoist=\"${true}\">\n <slot\n slot=\"trigger\"\n part=\"trigger\"\n name=\"trigger\"\n ></slot>\n <nile-calendar value=\"${this.value}\" .range=\"${this.range}\" @nile-changed=\"${this.handleChanged}\"></nile-calendar>\n </nile-dropdown>\n `;\n }\n\n handleChanged(event: any) {\n this.emit('nile-changed', event.detail);\n if (this.dropdown) {\n this.dropdown.hide();\n }\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.emit('nile-destroy');\n }\n}\n\nexport default NileDatePicker;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-date-picker': NileDatePicker;\n }\n}\n"]}
|
@@ -96,6 +96,7 @@ export declare class NileTextarea extends NileElement {
|
|
96
96
|
inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';
|
97
97
|
/** The default value of the form control. Primarily used for resetting the form control. */
|
98
98
|
defaultValue: string;
|
99
|
+
fullHeight: boolean;
|
99
100
|
connectedCallback(): void;
|
100
101
|
disconnectedCallback(): void;
|
101
102
|
private handleBlur;
|
@@ -84,6 +84,7 @@ let NileTextarea = class NileTextarea extends NileElement {
|
|
84
84
|
this.spellcheck = true;
|
85
85
|
/** The default value of the form control. Primarily used for resetting the form control. */
|
86
86
|
this.defaultValue = '';
|
87
|
+
this.fullHeight = false;
|
87
88
|
}
|
88
89
|
connectedCallback() {
|
89
90
|
super.connectedCallback();
|
@@ -92,6 +93,15 @@ let NileTextarea = class NileTextarea extends NileElement {
|
|
92
93
|
this.setTextareaHeight();
|
93
94
|
this.resizeObserver.observe(this.input);
|
94
95
|
});
|
96
|
+
if (this.fullHeight) {
|
97
|
+
requestAnimationFrame(() => {
|
98
|
+
let parentHeight = this.parentElement?.getBoundingClientRect().height;
|
99
|
+
if (parentHeight) {
|
100
|
+
parentHeight = parentHeight - 65;
|
101
|
+
this.shadowRoot?.querySelector('textarea')?.style.setProperty('height', `${parentHeight}px`);
|
102
|
+
}
|
103
|
+
});
|
104
|
+
}
|
95
105
|
this.emit('nile-init');
|
96
106
|
}
|
97
107
|
disconnectedCallback() {
|
@@ -361,6 +371,9 @@ __decorate([
|
|
361
371
|
__decorate([
|
362
372
|
defaultValue()
|
363
373
|
], NileTextarea.prototype, "defaultValue", void 0);
|
374
|
+
__decorate([
|
375
|
+
property({ type: Boolean, reflect: true })
|
376
|
+
], NileTextarea.prototype, "fullHeight", void 0);
|
364
377
|
__decorate([
|
365
378
|
watch('rows', { waitUntilFirstUpdate: true })
|
366
379
|
], NileTextarea.prototype, "handleRowsChange", null);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-textarea.js","sourceRoot":"","sources":["../../../src/nile-textarea/nile-textarea.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC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pC;IAAX,QAAQ,EAAE;kDAAiF;AAW5F;IARC,QAAQ,CAAC;QACR,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,oEAAoE;YACpE,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YACpE,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SACjD;KACF,CAAC;gDACgB;AAMN;IAAX,QAAQ,EAAE;+CAAyF;AAGpF;IAAf,YAAY,EAAE;kDAAmB;AAkDlC;IADC,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;oDAG7C;AAGK;IADL,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;qDAI9C;AApKU,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA8TxB;SA9TY,YAAY;AAgUzB,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport {styles} from './nile-textarea.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query, state } from 'lit/decorators.js';\nimport { defaultValue } from '../internal/default-value';\nimport { FormControlController } from '../internal/form';\nimport { HasSlotController } from '../internal/slot';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n\n/**\n * @summary Textareas collect data from the user and allow multiple lines of text.\n * @tag nile-text-area\n\n *\n * @slot label - The textarea's label. Alternatively, you can use the `label` attribute.\n * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n *\n * @event nile-blur - Emitted when the control loses focus.\n * @event nile-change - Emitted when an alteration to the control's value is committed by the user.\n * @event nile-focus - Emitted when the control gains focus.\n * @event nile-input - Emitted when the control receives input.\n *\n * @csspart form-control - The form control that wraps the label, input, and help text.\n * @csspart form-control-label - The label's wrapper.\n * @csspart form-control-input - The input's wrapper.\n * @csspart form-control-help-text - The help text's wrapper.\n * @csspart base - The component's base wrapper.\n * @csspart textarea - The internal `<textarea>` control.\n */\n\n@customElement('nile-textarea')\nexport class NileTextarea extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');\n private resizeObserver: ResizeObserver;\n\n @query('.textarea__control') input: HTMLTextAreaElement;\n\n @state() private hasFocus = false;\n @property() title = ''; // make reactive to pass through\n\n /** The name of the textarea, submitted as a name/value pair with form data. */\n @property() name = '';\n\n /** The current value of the textarea, submitted as a name/value pair with form data. */\n @property() value = '';\n\n /** The textarea's size. */\n @property({ reflect: true }) size = 'medium';\n\n /** Draws a filled textarea. */\n @property({ type: Boolean, reflect: true }) filled = false;\n\n /** The textarea's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n /** The textarea's help text. If you need to display HTML, use the `help-text` slot instead. */\n @property({ attribute: 'help-text' }) helpText = '';\n\n /** The input's error message. If you need to display HTML, use the `error-message` slot instead. */\n @property({ attribute: 'error-message' }) errorMessage = '';\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = '';\n\n /** The number of rows to display by default. */\n @property({ type: Number }) rows = 4;\n\n /** Controls how the textarea can be resized. */\n @property() resize: 'none' | 'vertical' | 'auto' = 'vertical';\n\n /** Disables the textarea. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the textarea readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n\n /** Makes the textarea a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n @property({ type: Number }) minlength: number;\n\n @property({ type: Number }) maxlength: number;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Controls whether and how text input is automatically capitalized as it is entered by the user. */\n @property() autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';\n\n /** Indicates whether the browser's autocorrect feature is on or off. */\n @property() autocorrect: string;\n\n /**\n * Specifies what permission the browser has to provide assistance in filling out form field values. Refer to\n * [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.\n */\n @property() autocomplete: string;\n\n /** Indicates that the input should receive focus on page load. */\n @property({ type: Boolean }) autofocus: boolean;\n\n /** Used to customize the label or icon of the Enter key on virtual keyboards. */\n @property() enterkeyhint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /** Enables spell checking on the textarea. */\n @property({\n type: Boolean,\n converter: {\n // Allow \"true|false\" attribute values but keep the property boolean\n fromAttribute: value => (!value || value === 'false' ? false : true),\n toAttribute: value => (value ? 'true' : 'false')\n }\n })\n spellcheck = true;\n\n /**\n * Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual\n * keyboard on supportive devices.\n */\n @property() inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n\n /** The default value of the form control. Primarily used for resetting the form control. */\n @defaultValue() defaultValue = '';\n\n connectedCallback() {\n super.connectedCallback();\n this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight());\n\n this.updateComplete.then(() => {\n this.setTextareaHeight();\n this.resizeObserver.observe(this.input);\n });\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this.input);\n this.emit('nile-destroy');\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur', { value: this.value });\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.setTextareaHeight();\n this.emit('nile-change', { value: this.value });\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus', { value: this.value });\n }\n\n private handleInput() {\n this.value = this.input.value;\n this.emit('nile-input', { value: this.value });\n }\n\n private setTextareaHeight() {\n if (this.resize === 'auto') {\n this.input.style.height = 'auto';\n this.input.style.height = `${this.input.scrollHeight}px`;\n } else {\n (this.input.style.height as string | undefined) = undefined;\n }\n }\n\n @watch('rows', { waitUntilFirstUpdate: true })\n handleRowsChange() {\n this.setTextareaHeight();\n }\n\n @watch('value', { waitUntilFirstUpdate: true })\n async handleValueChange() {\n await this.updateComplete;\n this.setTextareaHeight();\n }\n\n /** Sets focus on the textarea. */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /** Removes focus from the textarea. */\n blur() {\n this.input.blur();\n }\n\n /** Selects all the text in the textarea. */\n select() {\n this.input.select();\n }\n\n /** Gets or sets the textarea's scroll position. */\n scrollPosition(position?: { top?: number; left?: number }): { top: number; left: number } | undefined {\n if (position) {\n if (typeof position.top === 'number') this.input.scrollTop = position.top;\n if (typeof position.left === 'number') this.input.scrollLeft = position.left;\n return undefined;\n }\n\n return {\n top: this.input.scrollTop,\n left: this.input.scrollTop\n };\n }\n\n /** Sets the start and end positions of the text selection (0-based). */\n setSelectionRange(\n selectionStart: number,\n selectionEnd: number,\n selectionDirection: 'forward' | 'backward' | 'none' = 'none'\n ) {\n this.input.setSelectionRange(selectionStart, selectionEnd, selectionDirection);\n }\n\n /** Replaces a range of text with a new string. */\n setRangeText(\n replacement: string,\n start?: number,\n end?: number,\n selectMode?: 'select' | 'start' | 'end' | 'preserve'\n ) {\n // @ts-expect-error - start, end, and selectMode are optional\n this.input.setRangeText(replacement, start, end, selectMode);\n\n if (this.value !== this.input.value) {\n this.value = this.input.value;\n }\n\n if (this.value !== this.input.value) {\n this.value = this.input.value;\n this.setTextareaHeight();\n }\n }\n\n render() {\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': this.size === 'medium',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div\n part=\"base\"\n class=${classMap({\n textarea: true,\n 'textarea--medium': this.size === 'medium',\n 'textarea--warning': this.warning,\n 'textarea--error': this.error,\n 'textarea--success': this.success,\n 'textarea--standard': !this.filled,\n 'textarea--disabled': this.disabled,\n 'textarea--focused': this.hasFocus,\n 'textarea--empty': !this.value,\n 'textarea--resize-none': this.resize === 'none',\n 'textarea--resize-vertical': this.resize === 'vertical',\n 'textarea--resize-auto': this.resize === 'auto'\n })}\n >\n <textarea\n part=\"textarea\"\n id=\"input\"\n class=\"textarea__control\"\n title=${this.title /* An empty title prevents browser validation tooltips from appearing on hover */}\n name=${ifDefined(this.name)}\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n placeholder=${ifDefined(this.placeholder)}\n rows=${ifDefined(this.rows)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n autocapitalize=${ifDefined(this.autocapitalize)}\n autocorrect=${ifDefined(this.autocorrect)}\n ?autofocus=${this.autofocus}\n spellcheck=${ifDefined(this.spellcheck)}\n enterkeyhint=${ifDefined(this.enterkeyhint)}\n inputmode=${ifDefined(this.inputmode)}\n aria-describedby=\"help-text\"\n @change=${this.handleChange}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n ></textarea>\n </div>\n </div>\n\n ${\n hasHelpText\n ? html`\n <nile-form-help-text>${this.helpText}</nile-form-help-text>\n `\n : ``\n }\n\n ${\n hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``\n }\n </div>\n `;\n }\n}\n\nexport default NileTextarea;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-textarea': NileTextarea;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"nile-textarea.js","sourceRoot":"","sources":["../../../src/nile-textarea/nile-textarea.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,OAAO,EAAa,IAAI,EAAE,QAAQ,EAAiC,MAAM,aAAa,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,MAAM,EAAC,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AAGnD;;;;;;;;;;;;;;;;;;;GAmBG;AAGI,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,WAAW;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OAAO,EAAE,CAAC;+CAAoB;AAGpC;IAAX,QAAQ,EAAE;kDAAiF;AAW5F;IARC,QAAQ,CAAC;QACR,IAAI,EAAE,OAAO;QACb,SAAS,EAAE;YACT,oEAAoE;YACpE,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;YACpE,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;SACjD;KACF,CAAC;gDACgB;AAMN;IAAX,QAAQ,EAAE;+CAAyF;AAGpF;IAAf,YAAY,EAAE;kDAAmB;AAEU;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;gDAAoB;AA8D/D;IADC,KAAK,CAAC,MAAM,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;oDAG7C;AAGK;IADL,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;qDAI9C;AAlLU,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA4UxB;SA5UY,YAAY;AA8UzB,eAAe,YAAY,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport {styles} from './nile-textarea.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query, state } from 'lit/decorators.js';\nimport { defaultValue } from '../internal/default-value';\nimport { FormControlController } from '../internal/form';\nimport { HasSlotController } from '../internal/slot';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { live } from 'lit/directives/live.js';\nimport { watch } from '../internal/watch';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\n\n/**\n * @summary Textareas collect data from the user and allow multiple lines of text.\n * @tag nile-text-area\n\n *\n * @slot label - The textarea's label. Alternatively, you can use the `label` attribute.\n * @slot help-text - Text that describes how to use the input. Alternatively, you can use the `help-text` attribute.\n *\n * @event nile-blur - Emitted when the control loses focus.\n * @event nile-change - Emitted when an alteration to the control's value is committed by the user.\n * @event nile-focus - Emitted when the control gains focus.\n * @event nile-input - Emitted when the control receives input.\n *\n * @csspart form-control - The form control that wraps the label, input, and help text.\n * @csspart form-control-label - The label's wrapper.\n * @csspart form-control-input - The input's wrapper.\n * @csspart form-control-help-text - The help text's wrapper.\n * @csspart base - The component's base wrapper.\n * @csspart textarea - The internal `<textarea>` control.\n */\n\n@customElement('nile-textarea')\nexport class NileTextarea extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private readonly hasSlotController = new HasSlotController(this, 'help-text', 'label');\n private resizeObserver: ResizeObserver;\n\n @query('.textarea__control') input: HTMLTextAreaElement;\n\n @state() private hasFocus = false;\n @property() title = ''; // make reactive to pass through\n\n /** The name of the textarea, submitted as a name/value pair with form data. */\n @property() name = '';\n\n /** The current value of the textarea, submitted as a name/value pair with form data. */\n @property() value = '';\n\n /** The textarea's size. */\n @property({ reflect: true }) size = 'medium';\n\n /** Draws a filled textarea. */\n @property({ type: Boolean, reflect: true }) filled = false;\n\n /** The textarea's label. If you need to display HTML, use the `label` slot instead. */\n @property() label = '';\n\n /** The textarea's help text. If you need to display HTML, use the `help-text` slot instead. */\n @property({ attribute: 'help-text' }) helpText = '';\n\n /** The input's error message. If you need to display HTML, use the `error-message` slot instead. */\n @property({ attribute: 'error-message' }) errorMessage = '';\n\n /** Placeholder text to show as a hint when the input is empty. */\n @property() placeholder = '';\n\n /** The number of rows to display by default. */\n @property({ type: Number }) rows = 4;\n\n /** Controls how the textarea can be resized. */\n @property() resize: 'none' | 'vertical' | 'auto' = 'vertical';\n\n /** Disables the textarea. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Makes the textarea readonly. */\n @property({ type: Boolean, reflect: true }) readonly = false;\n\n /**\n * By default, form controls are associated with the nearest containing `<form>` element. This attribute allows you\n * to place the form control outside of a form and associate it with the form that has this `id`. The form must be in\n * the same document or shadow root for this to work.\n */\n @property({ reflect: true }) form = '';\n\n /** Makes the textarea a required field. */\n @property({ type: Boolean, reflect: true }) required = false;\n\n @property({ type: Number }) minlength: number;\n\n @property({ type: Number }) maxlength: number;\n\n /** Sets the input to a warning state, changing its visual appearance. */\n @property({ type: Boolean }) warning = false;\n\n /** Sets the input to an error state, changing its visual appearance. */\n @property({ type: Boolean }) error = false;\n\n /** Sets the input to a success state, changing its visual appearance. */\n @property({ type: Boolean }) success = false;\n\n /** Controls whether and how text input is automatically capitalized as it is entered by the user. */\n @property() autocapitalize: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters';\n\n /** Indicates whether the browser's autocorrect feature is on or off. */\n @property() autocorrect: string;\n\n /**\n * Specifies what permission the browser has to provide assistance in filling out form field values. Refer to\n * [this page on MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) for available values.\n */\n @property() autocomplete: string;\n\n /** Indicates that the input should receive focus on page load. */\n @property({ type: Boolean }) autofocus: boolean;\n\n /** Used to customize the label or icon of the Enter key on virtual keyboards. */\n @property() enterkeyhint: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send';\n\n /** Enables spell checking on the textarea. */\n @property({\n type: Boolean,\n converter: {\n // Allow \"true|false\" attribute values but keep the property boolean\n fromAttribute: value => (!value || value === 'false' ? false : true),\n toAttribute: value => (value ? 'true' : 'false')\n }\n })\n spellcheck = true;\n\n /**\n * Tells the browser what type of data will be entered by the user, allowing it to display the appropriate virtual\n * keyboard on supportive devices.\n */\n @property() inputmode: 'none' | 'text' | 'decimal' | 'numeric' | 'tel' | 'search' | 'email' | 'url';\n\n /** The default value of the form control. Primarily used for resetting the form control. */\n @defaultValue() defaultValue = '';\n\n @property({ type: Boolean, reflect: true }) fullHeight = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.resizeObserver = new ResizeObserver(() => this.setTextareaHeight());\n\n this.updateComplete.then(() => {\n this.setTextareaHeight();\n this.resizeObserver.observe(this.input);\n });\n\n if(this.fullHeight){\n requestAnimationFrame(() => {\n let parentHeight = this.parentElement?.getBoundingClientRect().height;\n\n if (parentHeight) {\n parentHeight = parentHeight - 65;\n this.shadowRoot?.querySelector('textarea')?.style.setProperty('height', `${parentHeight}px`);\n }\n });\n }\n\n this.emit('nile-init');\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.resizeObserver.unobserve(this.input);\n this.emit('nile-destroy');\n }\n\n private handleBlur() {\n this.hasFocus = false;\n this.emit('nile-blur', { value: this.value });\n }\n\n private handleChange() {\n this.value = this.input.value;\n this.setTextareaHeight();\n this.emit('nile-change', { value: this.value });\n }\n\n private handleFocus() {\n this.hasFocus = true;\n this.emit('nile-focus', { value: this.value });\n }\n\n private handleInput() {\n this.value = this.input.value;\n this.emit('nile-input', { value: this.value });\n }\n\n private setTextareaHeight() {\n if (this.resize === 'auto') {\n this.input.style.height = 'auto';\n this.input.style.height = `${this.input.scrollHeight}px`;\n } else {\n (this.input.style.height as string | undefined) = undefined;\n }\n }\n\n @watch('rows', { waitUntilFirstUpdate: true })\n handleRowsChange() {\n this.setTextareaHeight();\n }\n\n @watch('value', { waitUntilFirstUpdate: true })\n async handleValueChange() {\n await this.updateComplete;\n this.setTextareaHeight();\n }\n\n /** Sets focus on the textarea. */\n focus(options?: FocusOptions) {\n this.input.focus(options);\n }\n\n /** Removes focus from the textarea. */\n blur() {\n this.input.blur();\n }\n\n /** Selects all the text in the textarea. */\n select() {\n this.input.select();\n }\n\n /** Gets or sets the textarea's scroll position. */\n scrollPosition(position?: { top?: number; left?: number }): { top: number; left: number } | undefined {\n if (position) {\n if (typeof position.top === 'number') this.input.scrollTop = position.top;\n if (typeof position.left === 'number') this.input.scrollLeft = position.left;\n return undefined;\n }\n\n return {\n top: this.input.scrollTop,\n left: this.input.scrollTop\n };\n }\n\n /** Sets the start and end positions of the text selection (0-based). */\n setSelectionRange(\n selectionStart: number,\n selectionEnd: number,\n selectionDirection: 'forward' | 'backward' | 'none' = 'none'\n ) {\n this.input.setSelectionRange(selectionStart, selectionEnd, selectionDirection);\n }\n\n /** Replaces a range of text with a new string. */\n setRangeText(\n replacement: string,\n start?: number,\n end?: number,\n selectMode?: 'select' | 'start' | 'end' | 'preserve'\n ) {\n // @ts-expect-error - start, end, and selectMode are optional\n this.input.setRangeText(replacement, start, end, selectMode);\n\n if (this.value !== this.input.value) {\n this.value = this.input.value;\n }\n\n if (this.value !== this.input.value) {\n this.value = this.input.value;\n this.setTextareaHeight();\n }\n }\n\n render() {\n const hasLabelSlot = this.hasSlotController.test('label');\n const hasHelpTextSlot = this.hasSlotController.test('help-text');\n const hasLabel = this.label ? true : !!hasLabelSlot;\n\n const hasHelpText = this.helpText ? true : false;\n const hasErrorMessage = this.errorMessage ? true : false;\n\n return html`\n <div\n part=\"form-control\"\n class=${classMap({\n 'form-control': true,\n 'form-control--medium': this.size === 'medium',\n 'form-control--has-label': hasLabel,\n 'form-control--has-help-text': hasHelpText\n })}\n >\n <label\n part=\"form-control-label\"\n class=\"form-control__label\"\n for=\"input\"\n aria-hidden=${hasLabel ? 'false' : 'true'}\n >\n <slot name=\"label\">${this.label}</slot>\n </label>\n\n <div part=\"form-control-input\" class=\"form-control-input\">\n <div\n part=\"base\"\n class=${classMap({\n textarea: true,\n 'textarea--medium': this.size === 'medium',\n 'textarea--warning': this.warning,\n 'textarea--error': this.error,\n 'textarea--success': this.success,\n 'textarea--standard': !this.filled,\n 'textarea--disabled': this.disabled,\n 'textarea--focused': this.hasFocus,\n 'textarea--empty': !this.value,\n 'textarea--resize-none': this.resize === 'none',\n 'textarea--resize-vertical': this.resize === 'vertical',\n 'textarea--resize-auto': this.resize === 'auto'\n })}\n >\n <textarea\n part=\"textarea\"\n id=\"input\"\n class=\"textarea__control\"\n title=${this.title /* An empty title prevents browser validation tooltips from appearing on hover */}\n name=${ifDefined(this.name)}\n .value=${live(this.value)}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n placeholder=${ifDefined(this.placeholder)}\n rows=${ifDefined(this.rows)}\n minlength=${ifDefined(this.minlength)}\n maxlength=${ifDefined(this.maxlength)}\n autocapitalize=${ifDefined(this.autocapitalize)}\n autocorrect=${ifDefined(this.autocorrect)}\n ?autofocus=${this.autofocus}\n spellcheck=${ifDefined(this.spellcheck)}\n enterkeyhint=${ifDefined(this.enterkeyhint)}\n inputmode=${ifDefined(this.inputmode)}\n aria-describedby=\"help-text\"\n @change=${this.handleChange}\n @input=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n ></textarea>\n </div>\n </div>\n\n ${\n hasHelpText\n ? html`\n <nile-form-help-text>${this.helpText}</nile-form-help-text>\n `\n : ``\n }\n\n ${\n hasErrorMessage\n ? html`\n <nile-form-error-message\n >${this.errorMessage}</nile-form-error-message\n >\n `\n : ``\n }\n </div>\n `;\n }\n}\n\nexport default NileTextarea;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-textarea': NileTextarea;\n }\n}\n"]}
|