@aquera/nile-elements 0.0.6-1 → 0.0.6-2
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/tsconfig.tsbuildinfo +1 -1
- package/dist/index.iife.js +21 -184
- 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/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/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/package.json
CHANGED
@@ -13,168 +13,6 @@ import { css } from 'lit-element';
|
|
13
13
|
export const styles = css`
|
14
14
|
:host {
|
15
15
|
}
|
16
|
-
|
17
|
-
.calendar-container {
|
18
|
-
font-family: Colfax-regular;
|
19
|
-
width: 365px;
|
20
|
-
height: auto;
|
21
|
-
text-align: center;
|
22
|
-
background: white;
|
23
|
-
}
|
24
|
-
|
25
|
-
.calendar-container.with-margin {
|
26
|
-
margin-right: 20px;
|
27
|
-
}
|
28
|
-
|
29
|
-
.calendar-header {
|
30
|
-
display: flex;
|
31
|
-
justify-content: space-between;
|
32
|
-
padding: 10px;
|
33
|
-
padding: 22px 20px;
|
34
|
-
font-size: 14px;
|
35
|
-
font-weight: 600;
|
36
|
-
line-height: 14px;
|
37
|
-
letter-spacing: 0.2px;
|
38
|
-
}
|
39
|
-
|
40
|
-
.divider {
|
41
|
-
width: 100%;
|
42
|
-
height: 1px;
|
43
|
-
background: #c7ced4;
|
44
|
-
}
|
45
|
-
|
46
|
-
.day-names {
|
47
|
-
font-size: 14px;
|
48
|
-
font-weight: 600;
|
49
|
-
line-height: 14px;
|
50
|
-
letter-spacing: 0.2px;
|
51
|
-
height: 50px;
|
52
|
-
margin-top: 10px;
|
53
|
-
}
|
54
|
-
|
55
|
-
.day-names,
|
56
|
-
.days {
|
57
|
-
display: flex;
|
58
|
-
flex-wrap: wrap;
|
59
|
-
justify-content: flex-start;
|
60
|
-
height: auto;
|
61
|
-
align-items: center;
|
62
|
-
}
|
63
|
-
|
64
|
-
.days {
|
65
|
-
height: auto;
|
66
|
-
}
|
67
|
-
|
68
|
-
.day {
|
69
|
-
flex-basis: calc(100% / 7);
|
70
|
-
box-sizing: border-box;
|
71
|
-
width: 48px;
|
72
|
-
align-items: center;
|
73
|
-
padding: 10px;
|
74
|
-
height: 32px;
|
75
|
-
margin-top: 6px;
|
76
|
-
margin-bottom: 6px;
|
77
|
-
display: flex;
|
78
|
-
justify-content: center;
|
79
|
-
align-items: center;
|
80
|
-
}
|
81
|
-
|
82
|
-
.filler {
|
83
|
-
color: grey;
|
84
|
-
}
|
85
|
-
|
86
|
-
.selected-date {
|
87
|
-
color: white;
|
88
|
-
border-radius: 4px;
|
89
|
-
background: #a5d3f3;
|
90
|
-
}
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
.calendar-wrapper {
|
95
|
-
background: white;
|
96
|
-
display: flex;
|
97
|
-
justify-content: space-between;
|
98
|
-
width: 730px;
|
99
|
-
}
|
100
|
-
|
101
|
-
.selected-date,
|
102
|
-
.range-start,
|
103
|
-
.range-end {
|
104
|
-
border-radius: 4px;
|
105
|
-
background: #a5d3f3;
|
106
|
-
color: white;
|
107
|
-
}
|
108
|
-
|
109
|
-
|
110
|
-
.range-start {
|
111
|
-
background: #a5d3f3;
|
112
|
-
border-radius: 4px 0 0 4px;
|
113
|
-
color: white;
|
114
|
-
}
|
115
|
-
|
116
|
-
.range-end {
|
117
|
-
background: #a5d3f3;
|
118
|
-
border-radius: 0 4px 4px 0;
|
119
|
-
color: white;
|
120
|
-
}
|
121
|
-
|
122
|
-
.range-middle {
|
123
|
-
background: #a5d3f3;
|
124
|
-
color: white;
|
125
|
-
border-radius: 0;
|
126
|
-
}
|
127
|
-
|
128
|
-
.day.selected {
|
129
|
-
background: #a5d3f3;
|
130
|
-
color: white;
|
131
|
-
border-radius: 4px;
|
132
|
-
}
|
133
|
-
|
134
|
-
.day.in-range {
|
135
|
-
background: #a5d3f3;
|
136
|
-
color: white;
|
137
|
-
}
|
138
|
-
|
139
|
-
.selected-date {
|
140
|
-
color: white;
|
141
|
-
border-radius: 4px;
|
142
|
-
background: #a5d3f3;
|
143
|
-
}
|
144
|
-
|
145
|
-
.base {
|
146
|
-
background-color: white;
|
147
|
-
border-radius: 4px;
|
148
|
-
padding-bottom: 20px
|
149
|
-
}
|
150
|
-
|
151
|
-
.calender-input{
|
152
|
-
padding: 20px;
|
153
|
-
padding-bottom: 0px;
|
154
|
-
}
|
155
|
-
|
156
|
-
.from {
|
157
|
-
display: flex;
|
158
|
-
justify-content: space-between;
|
159
|
-
gap: 20px;
|
160
|
-
}
|
161
|
-
|
162
|
-
.manual-input{
|
163
|
-
width:100%;
|
164
|
-
}
|
165
|
-
|
166
|
-
.manual-input-label{
|
167
|
-
font-size: 12px;
|
168
|
-
font-style: normal;
|
169
|
-
font-weight: 500;
|
170
|
-
margin-bottom: 10px;
|
171
|
-
}
|
172
|
-
|
173
|
-
.apply-button {
|
174
|
-
text-align: right;
|
175
|
-
display: block;
|
176
|
-
padding-top: 20px;
|
177
|
-
}
|
178
16
|
`;
|
179
17
|
|
180
18
|
export default [styles];
|
@@ -12,25 +12,9 @@ import {
|
|
12
12
|
CSSResultArray,
|
13
13
|
TemplateResult,
|
14
14
|
} from 'lit-element';
|
15
|
-
import { customElement } from 'lit/decorators.js';
|
15
|
+
import { customElement, query } from 'lit/decorators.js';
|
16
16
|
import { styles } from './nile-date-picker.css';
|
17
|
-
import { animateTo, stopAnimations } from '../internal/animate';
|
18
|
-
import { classMap } from 'lit/directives/class-map.js';
|
19
|
-
import { query } from 'lit/decorators.js';
|
20
|
-
import {
|
21
|
-
getAnimation,
|
22
|
-
setDefaultAnimation,
|
23
|
-
} from '../utilities/animation-registry';
|
24
|
-
import { getTabbableBoundary } from '../internal/tabbable';
|
25
|
-
import { waitForEvent } from '../internal/event';
|
26
|
-
import { watch } from '../internal/watch';
|
27
17
|
import NileElement from '../internal/nile-element';
|
28
|
-
import type { CSSResultGroup, PropertyValues } from 'lit';
|
29
|
-
import type NileButton from '../nile-button/nile-button';
|
30
|
-
import type NileIconButton from '../nile-icon-button/nile-icon-button';
|
31
|
-
import type { NileMenu } from '../nile-menu';
|
32
|
-
import type { NilePopup } from '../nile-popup';
|
33
|
-
import '../nile-popup';
|
34
18
|
import { NileDropdown } from '../nile-dropdown';
|
35
19
|
|
36
20
|
/**
|
@@ -49,123 +33,32 @@ export class NileDatePicker extends NileElement {
|
|
49
33
|
return [styles];
|
50
34
|
}
|
51
35
|
|
52
|
-
private currentMonth: number = new Date().getMonth();
|
53
|
-
private currentYear: number = new Date().getFullYear();
|
54
|
-
|
55
|
-
@query('nile-dropdown') dropdown: NileDropdown;
|
56
|
-
|
57
|
-
@property({ type: Boolean, reflect: true }) dropDownOpened = false;
|
58
|
-
|
59
|
-
@property({ type: Object }) value : any;
|
60
|
-
|
61
|
-
@property({ type: Object }) rangeValue : any;
|
62
|
-
|
63
|
-
@property({ type: String, attribute: 'value' }) valueAttribute:
|
64
|
-
| string
|
65
|
-
| null = null;
|
66
|
-
|
67
|
-
@property({ type: String, attribute: 'value' }) formattedDate: string | null =
|
68
|
-
null;
|
69
|
-
|
70
|
-
@property({ type: Object }) startDate: Date | null = null;
|
71
|
-
@property({ type: Object }) endDate: Date | null = null;
|
72
|
-
@property({ type: Boolean }) isSelectingStart = true; // flag to indicate what we're selecting
|
73
|
-
|
74
36
|
@property({ type: Boolean }) range = false;
|
75
37
|
|
76
|
-
@
|
77
|
-
valueChanged() {
|
78
|
-
|
79
|
-
if (this.range && this.value) {
|
80
|
-
this.rangeValue = this.value;
|
81
|
-
this.value = null;
|
82
|
-
return;
|
83
|
-
}
|
84
|
-
|
85
|
-
if (this.value && !isNaN(this.value.getTime())) {
|
86
|
-
const offset = this.value.getTimezoneOffset();
|
87
|
-
const localDate = new Date(this.value.getTime() - offset * 60 * 1000);
|
88
|
-
if (!isNaN(localDate.getTime())) {
|
89
|
-
this.valueAttribute = localDate.toISOString().split('T')[0];
|
90
|
-
this.formattedDate = `${String(localDate.getDate()).padStart(
|
91
|
-
2,
|
92
|
-
'0'
|
93
|
-
)}/${String(localDate.getMonth() + 1).padStart(
|
94
|
-
2,
|
95
|
-
'0'
|
96
|
-
)}/${localDate.getFullYear()}`;
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
updated(changedProperties: PropertyValues) {
|
103
|
-
super.updated(changedProperties);
|
38
|
+
@property() value: any;
|
104
39
|
|
105
|
-
|
106
|
-
const date = new Date(this.valueAttribute || '');
|
107
|
-
if (!isNaN(date.getTime())) {
|
108
|
-
const offset = date.getTimezoneOffset();
|
109
|
-
this.value = new Date(date.getTime() - offset * 60 * 1000);
|
110
|
-
this.currentMonth = this.value.getMonth();
|
111
|
-
this.currentYear = this.value.getFullYear();
|
112
|
-
}
|
113
|
-
}
|
114
|
-
}
|
115
|
-
|
116
|
-
static get observedAttributes() {
|
117
|
-
return ['value', 'range'];
|
118
|
-
}
|
119
|
-
|
120
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string) {
|
121
|
-
if (name === 'value') {
|
122
|
-
this.valueAttribute = newValue;
|
123
|
-
this.initializeValue();
|
124
|
-
} else if (name === 'range') {
|
125
|
-
this.range = newValue !== null;
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
initializeValue() {
|
130
|
-
if (this.range) {
|
131
|
-
try {
|
132
|
-
const rangeValue = JSON.parse(this.valueAttribute || '');
|
133
|
-
this.startDate = new Date(rangeValue.startDate);
|
134
|
-
this.endDate = new Date(rangeValue.endDate);
|
135
|
-
|
136
|
-
// Convert to local time
|
137
|
-
this.startDate = new Date(this.startDate.getTime());
|
138
|
-
this.endDate = new Date(this.endDate.getTime());
|
139
|
-
|
140
|
-
this.rangeValue = {
|
141
|
-
startDate: this.startDate,
|
142
|
-
endDate: this.endDate,
|
143
|
-
};
|
144
|
-
this.value = null;
|
145
|
-
} catch (e) {
|
146
|
-
// console.error('Invalid range value');
|
147
|
-
}
|
148
|
-
} else {
|
149
|
-
if (this.valueAttribute) {
|
150
|
-
let date: Date;
|
151
|
-
|
152
|
-
date = new Date(this.valueAttribute);
|
40
|
+
@query('nile-dropdown') dropdown: NileDropdown;
|
153
41
|
|
154
|
-
date = new Date(date.getTime() - date.getTimezoneOffset() * 60000);
|
155
42
|
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
}
|
163
|
-
|
164
|
-
|
43
|
+
/**
|
44
|
+
* Render method
|
45
|
+
* @slot This is a slot test
|
46
|
+
*/
|
47
|
+
render(): TemplateResult {
|
48
|
+
return html`
|
49
|
+
<nile-dropdown .hoist="${true}">
|
50
|
+
<slot
|
51
|
+
slot="trigger"
|
52
|
+
part="trigger"
|
53
|
+
name="trigger"
|
54
|
+
></slot>
|
55
|
+
<nile-calendar value="${this.value}" .range="${this.range}" @nile-changed="${this.handleChanged}"></nile-calendar>
|
56
|
+
</nile-dropdown>
|
57
|
+
`;
|
165
58
|
}
|
166
59
|
|
167
|
-
handleChanged(event:any) {
|
168
|
-
this.emit('nile-changed',
|
60
|
+
handleChanged(event: any) {
|
61
|
+
this.emit('nile-changed', event.detail);
|
169
62
|
if (this.dropdown) {
|
170
63
|
this.dropdown.hide();
|
171
64
|
}
|
@@ -173,16 +66,6 @@ export class NileDatePicker extends NileElement {
|
|
173
66
|
|
174
67
|
connectedCallback() {
|
175
68
|
super.connectedCallback();
|
176
|
-
this.initializeValue();
|
177
|
-
|
178
|
-
if (this.valueAttribute) {
|
179
|
-
const date = new Date(this.valueAttribute);
|
180
|
-
if (!isNaN(date.getTime())) {
|
181
|
-
this.value = date;
|
182
|
-
this.currentMonth = this.value.getMonth();
|
183
|
-
this.currentYear = this.value.getFullYear();
|
184
|
-
}
|
185
|
-
}
|
186
69
|
this.emit('nile-init');
|
187
70
|
}
|
188
71
|
|
@@ -190,29 +73,6 @@ export class NileDatePicker extends NileElement {
|
|
190
73
|
super.disconnectedCallback();
|
191
74
|
this.emit('nile-destroy');
|
192
75
|
}
|
193
|
-
|
194
|
-
/* #endregion */
|
195
|
-
|
196
|
-
/* #region Methods */
|
197
|
-
|
198
|
-
/**
|
199
|
-
* Render method
|
200
|
-
* @slot This is a slot test
|
201
|
-
*/
|
202
|
-
render(): TemplateResult {
|
203
|
-
|
204
|
-
return html`
|
205
|
-
<nile-dropdown .hoist="${true}">
|
206
|
-
<slot
|
207
|
-
slot="trigger"
|
208
|
-
part="trigger"
|
209
|
-
name="trigger"
|
210
|
-
></slot>
|
211
|
-
|
212
|
-
<nile-calendar .value="${this.range}" .range="${this.range}" @nile-changed="${this.handleChanged}"> </nile-calendar>
|
213
|
-
</nile-dropdown>
|
214
|
-
`;
|
215
|
-
}
|
216
76
|
}
|
217
77
|
|
218
78
|
export default NileDatePicker;
|