@pure-ds/core 0.7.25 → 0.7.26
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/.cursorrules +12 -1
- package/.github/copilot-instructions.md +12 -1
- package/custom-elements.json +1099 -74
- package/dist/types/public/assets/js/pds-ask.d.ts +2 -1
- package/dist/types/public/assets/js/pds-ask.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-autocomplete.d.ts +25 -36
- package/dist/types/public/assets/js/pds-autocomplete.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-enhancers.d.ts +4 -4
- package/dist/types/public/assets/js/pds-enhancers.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-manager.d.ts +444 -159
- package/dist/types/public/assets/js/pds-manager.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds-toast.d.ts +7 -6
- package/dist/types/public/assets/js/pds-toast.d.ts.map +1 -1
- package/dist/types/public/assets/js/pds.d.ts +4 -3
- package/dist/types/public/assets/js/pds.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-daterange.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-daterange.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-rating.d.ts +120 -0
- package/dist/types/public/assets/pds/components/pds-rating.d.ts.map +1 -0
- package/dist/types/public/assets/pds/components/pds-tags.d.ts +2 -0
- package/dist/types/public/assets/pds/components/pds-tags.d.ts.map +1 -0
- package/dist/types/src/js/common/ask.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-generator.d.ts.map +1 -1
- package/package.json +2 -2
- package/public/assets/js/app.js +1 -1
- package/public/assets/js/pds-ask.js +6 -6
- package/public/assets/js/pds-manager.js +104 -29
- package/public/assets/pds/components/pds-calendar.js +91 -159
- package/public/assets/pds/components/pds-daterange.js +683 -0
- package/public/assets/pds/components/pds-form.js +123 -21
- package/public/assets/pds/components/pds-rating.js +648 -0
- package/public/assets/pds/components/pds-tags.js +802 -0
- package/public/assets/pds/core/pds-ask.js +6 -6
- package/public/assets/pds/core/pds-manager.js +104 -29
- package/public/assets/pds/custom-elements.json +1099 -74
- package/public/assets/pds/pds-css-complete.json +7 -2
- package/public/assets/pds/pds.css-data.json +4 -4
- package/public/assets/pds/vscode-custom-data.json +97 -0
- package/src/js/pds-core/pds-generator.js +103 -28
- package/src/js/pds-core/pds-ontology.js +2 -2
|
@@ -52,6 +52,14 @@ class DateHelper {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
parseDate(dateString) {
|
|
55
|
+
if (typeof dateString === "string") {
|
|
56
|
+
const trimmed = dateString.trim();
|
|
57
|
+
const dateOnly = /^(\d{4})-(\d{2})-(\d{2})$/.exec(trimmed);
|
|
58
|
+
if (dateOnly) {
|
|
59
|
+
const [, year, month, day] = dateOnly;
|
|
60
|
+
return new Date(Number(year), Number(month) - 1, Number(day));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
55
63
|
const timestamp = Date.parse(dateString);
|
|
56
64
|
return new Date(timestamp);
|
|
57
65
|
}
|
|
@@ -75,9 +83,10 @@ class DateHelper {
|
|
|
75
83
|
|
|
76
84
|
/**
|
|
77
85
|
* @component pds-calendar
|
|
78
|
-
* @description A fully featured calendar component with month navigation, event display, and
|
|
86
|
+
* @description A fully featured calendar component with month navigation, event display, and keyboard-friendly date selection
|
|
79
87
|
*
|
|
80
88
|
* @fires pds-calendar#month-rendered - Dispatched after the calendar month is rendered with event fill capability
|
|
89
|
+
* @fires pds-calendar#month-change - Dispatched when the visible month/year changes
|
|
81
90
|
*
|
|
82
91
|
* @attr {String} date - The date to display (defaults to current date). Accepts any valid date string
|
|
83
92
|
*
|
|
@@ -151,7 +160,7 @@ class PdsCalendar extends HTMLElement {
|
|
|
151
160
|
constructor() {
|
|
152
161
|
super();
|
|
153
162
|
this.#date = new Date();
|
|
154
|
-
this.#initialDate =
|
|
163
|
+
this.#initialDate = "";
|
|
155
164
|
|
|
156
165
|
this.dateHelper = new DateHelper();
|
|
157
166
|
this.#dayNames = this.dateHelper.getDayNames();
|
|
@@ -175,7 +184,6 @@ class PdsCalendar extends HTMLElement {
|
|
|
175
184
|
|
|
176
185
|
if (name === "date") {
|
|
177
186
|
this.date = newValue;
|
|
178
|
-
this.reRender();
|
|
179
187
|
return;
|
|
180
188
|
}
|
|
181
189
|
|
|
@@ -195,6 +203,13 @@ class PdsCalendar extends HTMLElement {
|
|
|
195
203
|
* @param {String|Date} value - Date string or Date object
|
|
196
204
|
*/
|
|
197
205
|
set date(value) {
|
|
206
|
+
if (value == null || value === "") {
|
|
207
|
+
this.#date = new Date(Number.NaN);
|
|
208
|
+
this.updateFormState();
|
|
209
|
+
if (this.isRendered) this.reRender();
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
|
|
198
213
|
this.#date =
|
|
199
214
|
typeof value === "string"
|
|
200
215
|
? this.dateHelper.parseDate(value)
|
|
@@ -263,7 +278,6 @@ class PdsCalendar extends HTMLElement {
|
|
|
263
278
|
|
|
264
279
|
set value(value) {
|
|
265
280
|
if (value == null || value === "") {
|
|
266
|
-
this.removeAttribute("date");
|
|
267
281
|
this.#date = new Date(Number.NaN);
|
|
268
282
|
this.updateFormState();
|
|
269
283
|
this.reRender();
|
|
@@ -301,7 +315,7 @@ class PdsCalendar extends HTMLElement {
|
|
|
301
315
|
background-color: var(--surface-bg);
|
|
302
316
|
margin: auto;
|
|
303
317
|
overflow: visible;
|
|
304
|
-
box-shadow: var(--shadow-lg);
|
|
318
|
+
box-shadow: var(--shadow, var(--shadow-lg));
|
|
305
319
|
border-radius: var(--radius-lg);
|
|
306
320
|
position: relative;
|
|
307
321
|
}
|
|
@@ -549,6 +563,8 @@ class PdsCalendar extends HTMLElement {
|
|
|
549
563
|
border: var(--border-width-thick) solid var(--color-primary-500) !important;
|
|
550
564
|
}
|
|
551
565
|
|
|
566
|
+
|
|
567
|
+
|
|
552
568
|
.task {
|
|
553
569
|
border-left-width: var(--border-width-thick);
|
|
554
570
|
padding: var(--spacing-1) var(--spacing-2);
|
|
@@ -560,6 +576,10 @@ class PdsCalendar extends HTMLElement {
|
|
|
560
576
|
border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
|
|
561
577
|
}
|
|
562
578
|
|
|
579
|
+
label {
|
|
580
|
+
cursor: pointer;
|
|
581
|
+
}
|
|
582
|
+
|
|
563
583
|
.task--warning {
|
|
564
584
|
border-left-color: var(--color-warning-500);
|
|
565
585
|
}
|
|
@@ -602,60 +622,6 @@ class PdsCalendar extends HTMLElement {
|
|
|
602
622
|
}
|
|
603
623
|
}
|
|
604
624
|
|
|
605
|
-
/* Day expansion styles */
|
|
606
|
-
.calendar.day-expanded {
|
|
607
|
-
.day-name {
|
|
608
|
-
opacity: 0;
|
|
609
|
-
pointer-events: none;
|
|
610
|
-
transition: opacity 0.2s;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
.day:not(.expanded-cell) {
|
|
614
|
-
opacity: 0;
|
|
615
|
-
pointer-events: none;
|
|
616
|
-
transition: opacity 0.2s;
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
.day.has-events {
|
|
621
|
-
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
.expanded-cell {
|
|
625
|
-
position: absolute !important;
|
|
626
|
-
top: 0 !important;
|
|
627
|
-
left: 0 !important;
|
|
628
|
-
right: 0 !important;
|
|
629
|
-
bottom: 0 !important;
|
|
630
|
-
width: auto !important;
|
|
631
|
-
height: auto !important;
|
|
632
|
-
grid-column: unset !important;
|
|
633
|
-
grid-row: unset !important;
|
|
634
|
-
z-index: 1000 !important;
|
|
635
|
-
background: var(--surface-bg) !important;
|
|
636
|
-
padding: 2rem !important;
|
|
637
|
-
overflow-y: auto !important;
|
|
638
|
-
border: none !important;
|
|
639
|
-
cursor: pointer !important;
|
|
640
|
-
|
|
641
|
-
.nr {
|
|
642
|
-
font-size: var(--font-size-2xl) !important;
|
|
643
|
-
font-weight: var(--font-weight-bold) !important;
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
.task {
|
|
647
|
-
font-size: var(--font-size-base) !important;
|
|
648
|
-
padding: var(--spacing-4) !important;
|
|
649
|
-
margin-bottom: var(--spacing-3) !important;
|
|
650
|
-
|
|
651
|
-
h3 {
|
|
652
|
-
font-size: var(--font-size-lg) !important;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
655
|
-
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
625
|
`
|
|
660
626
|
);
|
|
661
627
|
|
|
@@ -667,6 +633,23 @@ class PdsCalendar extends HTMLElement {
|
|
|
667
633
|
);
|
|
668
634
|
|
|
669
635
|
queueMicrotask(() => {
|
|
636
|
+
const initialAttrDate = this.getAttribute("date");
|
|
637
|
+
if (initialAttrDate != null) {
|
|
638
|
+
const parsedInitialDate = this.dateHelper.parseDate(initialAttrDate);
|
|
639
|
+
if (
|
|
640
|
+
parsedInitialDate instanceof Date
|
|
641
|
+
&& !Number.isNaN(parsedInitialDate.getTime())
|
|
642
|
+
) {
|
|
643
|
+
const year = parsedInitialDate.getFullYear();
|
|
644
|
+
const month = String(parsedInitialDate.getMonth() + 1).padStart(2, "0");
|
|
645
|
+
const day = String(parsedInitialDate.getDate()).padStart(2, "0");
|
|
646
|
+
this.#initialDate = `${year}-${month}-${day}`;
|
|
647
|
+
} else {
|
|
648
|
+
this.#initialDate = "";
|
|
649
|
+
}
|
|
650
|
+
} else if (!this.#initialDate) {
|
|
651
|
+
this.#initialDate = this.serializeDate();
|
|
652
|
+
}
|
|
670
653
|
this.setupPaging();
|
|
671
654
|
this.updateFormState();
|
|
672
655
|
});
|
|
@@ -682,16 +665,26 @@ class PdsCalendar extends HTMLElement {
|
|
|
682
665
|
}
|
|
683
666
|
|
|
684
667
|
formResetCallback() {
|
|
685
|
-
|
|
668
|
+
const defaultDate = this.getAttribute("date");
|
|
669
|
+
if (defaultDate != null && defaultDate !== "") {
|
|
670
|
+
this.date = defaultDate;
|
|
671
|
+
} else if (this.#initialDate) {
|
|
672
|
+
this.date = this.#initialDate;
|
|
673
|
+
} else {
|
|
674
|
+
this.#date = new Date(Number.NaN);
|
|
675
|
+
}
|
|
686
676
|
this.updateFormState();
|
|
687
677
|
this.reRender();
|
|
688
678
|
}
|
|
689
679
|
|
|
690
680
|
formStateRestoreCallback(state) {
|
|
691
|
-
if (typeof state === "string"
|
|
681
|
+
if (typeof state === "string") {
|
|
692
682
|
this.value = state;
|
|
683
|
+
} else if (state == null) {
|
|
684
|
+
this.value = "";
|
|
693
685
|
}
|
|
694
686
|
this.updateFormState();
|
|
687
|
+
this.reRender();
|
|
695
688
|
}
|
|
696
689
|
|
|
697
690
|
checkValidity() {
|
|
@@ -843,9 +836,35 @@ class PdsCalendar extends HTMLElement {
|
|
|
843
836
|
* @private
|
|
844
837
|
*/
|
|
845
838
|
reRender() {
|
|
839
|
+
const previousMonth = Number.isInteger(this.month) ? this.month : null;
|
|
840
|
+
const previousYear = Number.isInteger(this.year) ? this.year : null;
|
|
841
|
+
|
|
846
842
|
this.shadowRoot.innerHTML = this.render();
|
|
843
|
+
this.isRendered = true;
|
|
844
|
+
|
|
845
|
+
const monthChanged =
|
|
846
|
+
Number.isInteger(previousMonth)
|
|
847
|
+
&& Number.isInteger(previousYear)
|
|
848
|
+
&& (previousMonth !== this.month || previousYear !== this.year);
|
|
849
|
+
|
|
850
|
+
if (monthChanged) {
|
|
851
|
+
this.dispatchEvent(
|
|
852
|
+
new CustomEvent("month-change", {
|
|
853
|
+
detail: {
|
|
854
|
+
date: this.date,
|
|
855
|
+
year: this.year,
|
|
856
|
+
month: this.month,
|
|
857
|
+
previousYear,
|
|
858
|
+
previousMonth,
|
|
859
|
+
},
|
|
860
|
+
bubbles: true,
|
|
861
|
+
composed: true,
|
|
862
|
+
})
|
|
863
|
+
);
|
|
864
|
+
}
|
|
865
|
+
|
|
847
866
|
queueMicrotask(() => {
|
|
848
|
-
this.
|
|
867
|
+
this.setupInteractions();
|
|
849
868
|
});
|
|
850
869
|
}
|
|
851
870
|
|
|
@@ -997,48 +1016,18 @@ class PdsCalendar extends HTMLElement {
|
|
|
997
1016
|
}
|
|
998
1017
|
|
|
999
1018
|
/**
|
|
1000
|
-
* Sets up day
|
|
1019
|
+
* Sets up day interactions and keyboard support
|
|
1001
1020
|
* @private
|
|
1002
1021
|
*/
|
|
1003
|
-
|
|
1004
|
-
if (this.
|
|
1005
|
-
this.
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
if (month) {
|
|
1013
|
-
this.date = Date.now();
|
|
1014
|
-
this.reRender();
|
|
1015
|
-
return;
|
|
1016
|
-
}
|
|
1017
|
-
|
|
1018
|
-
const compactMode = this.compact;
|
|
1019
|
-
if (compactMode) return;
|
|
1020
|
-
|
|
1021
|
-
const cell = e.target.closest(".day.has-events[data-day]");
|
|
1022
|
-
if (!cell) return;
|
|
1023
|
-
|
|
1024
|
-
const day = cell.dataset.day;
|
|
1025
|
-
const calendar = this.shadowRoot.querySelector(".calendar");
|
|
1026
|
-
|
|
1027
|
-
// Toggle if clicking same day
|
|
1028
|
-
if (expandedDay === day) {
|
|
1029
|
-
await this.collapseDay(calendar, cell);
|
|
1030
|
-
expandedDay = null;
|
|
1031
|
-
} else {
|
|
1032
|
-
// Collapse previous day if exists
|
|
1033
|
-
if (expandedDay) {
|
|
1034
|
-
const prevCell = this.shadowRoot.querySelector(
|
|
1035
|
-
`[data-day="${expandedDay}"]`
|
|
1036
|
-
);
|
|
1037
|
-
await this.collapseDay(calendar, prevCell);
|
|
1038
|
-
}
|
|
1039
|
-
await this.expandDay(calendar, cell);
|
|
1040
|
-
expandedDay = day;
|
|
1041
|
-
}
|
|
1022
|
+
setupInteractions() {
|
|
1023
|
+
if (this.interactionSetup) return;
|
|
1024
|
+
this.interactionSetup = true;
|
|
1025
|
+
|
|
1026
|
+
this.shadowRoot.addEventListener("click", (event) => {
|
|
1027
|
+
const month = event.target.closest(".current-month");
|
|
1028
|
+
if (!month) return;
|
|
1029
|
+
this.date = Date.now();
|
|
1030
|
+
this.reRender();
|
|
1042
1031
|
});
|
|
1043
1032
|
|
|
1044
1033
|
this.shadowRoot.addEventListener('change', (event) => {
|
|
@@ -1140,63 +1129,6 @@ class PdsCalendar extends HTMLElement {
|
|
|
1140
1129
|
target?.focus();
|
|
1141
1130
|
}
|
|
1142
1131
|
|
|
1143
|
-
/**
|
|
1144
|
-
* Expands a day cell to full view
|
|
1145
|
-
* @param {HTMLElement} calendar - The calendar container element
|
|
1146
|
-
* @param {HTMLElement} cell - The day cell to expand
|
|
1147
|
-
* @private
|
|
1148
|
-
*/
|
|
1149
|
-
async expandDay(calendar, cell) {
|
|
1150
|
-
// Capture the cell's current position and size
|
|
1151
|
-
const calendarRect = calendar.getBoundingClientRect();
|
|
1152
|
-
const cellRect = cell.getBoundingClientRect();
|
|
1153
|
-
|
|
1154
|
-
const relativeTop = cellRect.top - calendarRect.top;
|
|
1155
|
-
const relativeLeft = cellRect.left - calendarRect.left;
|
|
1156
|
-
|
|
1157
|
-
// Set initial absolute position to match grid position
|
|
1158
|
-
cell.style.position = "absolute";
|
|
1159
|
-
cell.style.top = `${relativeTop}px`;
|
|
1160
|
-
cell.style.left = `${relativeLeft}px`;
|
|
1161
|
-
cell.style.width = `${cellRect.width}px`;
|
|
1162
|
-
cell.style.height = `${cellRect.height}px`;
|
|
1163
|
-
cell.style.gridColumn = "unset";
|
|
1164
|
-
cell.style.gridRow = "unset";
|
|
1165
|
-
|
|
1166
|
-
// Force a reflow
|
|
1167
|
-
cell.offsetHeight;
|
|
1168
|
-
|
|
1169
|
-
// Now add classes to trigger transition to expanded state
|
|
1170
|
-
calendar.classList.add("day-expanded");
|
|
1171
|
-
cell.classList.add("expanded-cell");
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
/**
|
|
1175
|
-
* Collapses an expanded day cell back to grid view
|
|
1176
|
-
* @param {HTMLElement} calendar - The calendar container element
|
|
1177
|
-
* @param {HTMLElement} cell - The day cell to collapse
|
|
1178
|
-
* @private
|
|
1179
|
-
*/
|
|
1180
|
-
async collapseDay(calendar, cell) {
|
|
1181
|
-
if (!cell) return;
|
|
1182
|
-
|
|
1183
|
-
// Remove expanded classes
|
|
1184
|
-
calendar.classList.remove("day-expanded");
|
|
1185
|
-
cell.classList.remove("expanded-cell");
|
|
1186
|
-
|
|
1187
|
-
// Wait for transition to complete
|
|
1188
|
-
await new Promise((resolve) => setTimeout(resolve, 400));
|
|
1189
|
-
|
|
1190
|
-
// Reset to grid positioning
|
|
1191
|
-
cell.style.position = "";
|
|
1192
|
-
cell.style.top = "";
|
|
1193
|
-
cell.style.left = "";
|
|
1194
|
-
cell.style.width = "";
|
|
1195
|
-
cell.style.height = "";
|
|
1196
|
-
cell.style.gridColumn = "";
|
|
1197
|
-
cell.style.gridRow = "";
|
|
1198
|
-
}
|
|
1199
|
-
|
|
1200
1132
|
/**
|
|
1201
1133
|
* Dispatches the month-rendered event with fill capability
|
|
1202
1134
|
* @fires pds-calendar#month-rendered
|