@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.
Files changed (24) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.css.js +0 -162
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.css.js.map +1 -1
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.d.ts +5 -21
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js +21 -141
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/index.iife.js +21 -184
  8. package/dist/nile-date-picker/index.cjs.js +1 -1
  9. package/dist/nile-date-picker/index.esm.js +1 -1
  10. package/dist/nile-date-picker/nile-date-picker.cjs.js +1 -1
  11. package/dist/nile-date-picker/nile-date-picker.cjs.js.map +1 -1
  12. package/dist/nile-date-picker/nile-date-picker.css.cjs.js +1 -1
  13. package/dist/nile-date-picker/nile-date-picker.css.cjs.js.map +1 -1
  14. package/dist/nile-date-picker/nile-date-picker.css.esm.js +2 -164
  15. package/dist/nile-date-picker/nile-date-picker.esm.js +3 -4
  16. package/dist/src/nile-date-picker/nile-date-picker.css.js +0 -162
  17. package/dist/src/nile-date-picker/nile-date-picker.css.js.map +1 -1
  18. package/dist/src/nile-date-picker/nile-date-picker.d.ts +5 -21
  19. package/dist/src/nile-date-picker/nile-date-picker.js +21 -141
  20. package/dist/src/nile-date-picker/nile-date-picker.js.map +1 -1
  21. package/dist/tsconfig.tsbuildinfo +1 -1
  22. package/package.json +1 -1
  23. package/src/nile-date-picker/nile-date-picker.css.ts +0 -162
  24. package/src/nile-date-picker/nile-date-picker.ts +20 -160
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKxB,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 .calendar-container {\n font-family: Colfax-regular;\n width: 365px;\n height: auto;\n text-align: center;\n background: white;\n }\n\n .calendar-container.with-margin {\n margin-right: 20px;\n}\n\n .calendar-header {\n display: flex;\n justify-content: space-between;\n padding: 10px;\n padding: 22px 20px;\n font-size: 14px;\n font-weight: 600;\n line-height: 14px;\n letter-spacing: 0.2px;\n }\n\n .divider {\n width: 100%;\n height: 1px;\n background: #c7ced4;\n }\n\n .day-names {\n font-size: 14px;\n font-weight: 600;\n line-height: 14px;\n letter-spacing: 0.2px;\n height: 50px;\n margin-top: 10px;\n }\n\n .day-names,\n .days {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-start;\n height: auto;\n align-items: center;\n }\n\n .days {\n height: auto;\n }\n\n .day {\n flex-basis: calc(100% / 7);\n box-sizing: border-box;\n width: 48px;\n align-items: center;\n padding: 10px;\n height: 32px;\n margin-top: 6px;\n margin-bottom: 6px;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .filler {\n color: grey;\n }\n\n .selected-date {\n color: white;\n border-radius: 4px;\n background: #a5d3f3;\n }\n\n\n\n.calendar-wrapper {\n background: white;\n display: flex;\n justify-content: space-between;\n width: 730px;\n}\n\n.selected-date,\n.range-start,\n.range-end {\n border-radius: 4px;\n background: #a5d3f3;\n color: white;\n}\n\n\n.range-start {\n background: #a5d3f3;\n border-radius: 4px 0 0 4px;\n color: white;\n}\n\n.range-end {\n background: #a5d3f3;\n border-radius: 0 4px 4px 0;\n color: white;\n}\n\n.range-middle {\n background: #a5d3f3;\n color: white;\n border-radius: 0;\n}\n\n.day.selected {\n background: #a5d3f3;\n color: white;\n border-radius: 4px;\n}\n\n.day.in-range {\n background: #a5d3f3;\n color: white;\n}\n\n.selected-date {\n color: white;\n border-radius: 4px;\n background: #a5d3f3;\n}\n\n.base {\n background-color: white;\n border-radius: 4px;\n padding-bottom: 20px\n}\n\n.calender-input{\n padding: 20px;\n padding-bottom: 0px;\n}\n\n.from {\n display: flex;\n justify-content: space-between;\n gap: 20px;\n}\n\n.manual-input{\n width:100%;\n}\n\n.manual-input-label{\n font-size: 12px;\nfont-style: normal;\nfont-weight: 500;\n margin-bottom: 10px;\n}\n\n.apply-button {\n text-align: right;\n display: block;\n padding-top: 20px;\n}\n`;\n\nexport default [styles];\n"]}
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
- valueChanged(): void;
37
- updated(changedProperties: PropertyValues): void;
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
- watch('value')
189
- ], NileDatePicker.prototype, "valueChanged", null);
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,CAA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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAkB;AAEG;IAA/C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;sDAE/B;AAEgC;IAA/C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;qDACxC;AAEqB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAA+B;AAC9B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAA6B;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"]}