@rededor/cura 1.2.0-rc.0 → 1.2.0-rc.1
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/dist/cjs/cura-calendar.cjs.entry.js +27 -2
- package/dist/cjs/cura-calendar.cjs.entry.js.map +1 -1
- package/dist/cjs/cura.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.js +37 -5
- package/dist/collection/components/cura-calendar/cura-calendar.js.map +1 -1
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js +35 -22
- package/dist/collection/components/cura-calendar/cura-calendar.stories.js.map +1 -1
- package/dist/components/cura-calendar2.js +30 -4
- package/dist/components/cura-calendar2.js.map +1 -1
- package/dist/cura/cura.esm.js +1 -1
- package/dist/cura/cura.esm.js.map +1 -1
- package/dist/cura/{p-563ba0cd.entry.js → p-ef4c9427.entry.js} +2 -2
- package/dist/cura/p-ef4c9427.entry.js.map +1 -0
- package/dist/esm/cura-calendar.entry.js +27 -2
- package/dist/esm/cura-calendar.entry.js.map +1 -1
- package/dist/esm/cura.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/cura-calendar/cura-calendar.d.ts +6 -1
- package/dist/types/components/cura-calendar/cura-calendar.stories.d.ts +1 -1
- package/dist/types/components.d.ts +4 -2
- package/package.json +2 -2
- package/dist/cura/p-563ba0cd.entry.js.map +0 -1
|
@@ -3487,6 +3487,7 @@ const CuraCalendar = class {
|
|
|
3487
3487
|
}
|
|
3488
3488
|
connectedCallback() {
|
|
3489
3489
|
this.setFontProperties();
|
|
3490
|
+
this.initializeDefaultDates();
|
|
3490
3491
|
const colors = [
|
|
3491
3492
|
{ name: '--accent-base', theme: 'accent-base' },
|
|
3492
3493
|
{ name: '--accent-light', theme: 'accent-light' },
|
|
@@ -3509,6 +3510,15 @@ const CuraCalendar = class {
|
|
|
3509
3510
|
* Initialize the selected dates based on defaultDate and mode.
|
|
3510
3511
|
*/
|
|
3511
3512
|
initializeDefaultDates() {
|
|
3513
|
+
if (typeof this.defaultDate === 'string') {
|
|
3514
|
+
const parsedDefaultDate = JSON.parse(this.defaultDate || '[]');
|
|
3515
|
+
if (typeof parsedDefaultDate === 'string') {
|
|
3516
|
+
this.defaultDate = [parsedDefaultDate];
|
|
3517
|
+
}
|
|
3518
|
+
else {
|
|
3519
|
+
this.defaultDate = parsedDefaultDate;
|
|
3520
|
+
}
|
|
3521
|
+
}
|
|
3512
3522
|
this.defaultDates = this.expandDateRanges(this.defaultDate);
|
|
3513
3523
|
}
|
|
3514
3524
|
/**
|
|
@@ -3638,6 +3648,8 @@ const CuraCalendar = class {
|
|
|
3638
3648
|
* @returns {Date[]} An array of individual dates.
|
|
3639
3649
|
*/
|
|
3640
3650
|
expandDateRanges(dates) {
|
|
3651
|
+
if (!dates)
|
|
3652
|
+
return [];
|
|
3641
3653
|
return dates.flatMap(date => {
|
|
3642
3654
|
if (typeof date === 'string')
|
|
3643
3655
|
return isValid(parseISO(date)) ? [parseISO(date)] : [];
|
|
@@ -3876,14 +3888,27 @@ const CuraCalendar = class {
|
|
|
3876
3888
|
watchDefaultDatesArray() {
|
|
3877
3889
|
this.selectedDates = this.customDates;
|
|
3878
3890
|
}
|
|
3891
|
+
handleDefaultDateChange(newValue) {
|
|
3892
|
+
if (typeof newValue === 'string') {
|
|
3893
|
+
const parsedDefaultDate = JSON.parse(newValue || '[]');
|
|
3894
|
+
if (typeof parsedDefaultDate === 'string') {
|
|
3895
|
+
newValue = [parsedDefaultDate];
|
|
3896
|
+
}
|
|
3897
|
+
else {
|
|
3898
|
+
newValue = parsedDefaultDate;
|
|
3899
|
+
}
|
|
3900
|
+
}
|
|
3901
|
+
this.defaultDates = this.expandDateRanges(newValue);
|
|
3902
|
+
}
|
|
3879
3903
|
render() {
|
|
3880
3904
|
const { months } = this.fetchMonthNames();
|
|
3881
|
-
return (index$1.h(index$1.Host, { key: '
|
|
3905
|
+
return (index$1.h(index$1.Host, { key: 'a17c39e83d01fc5443be547f8eab72edb3ce66ce', style: this.getHostCSSProperties() }, index$1.h("div", { key: '1dfb1924dbebc4b650bbed7973e4a0e0d3832c80', class: `calendar ${this.floating ? 'floating' : ''} ${this.embedded ? 'embedded' : ''}`, style: this.styles }, index$1.h("header", { key: '75de60ed10c9b11a4aedf75c8859155e51e05cae', class: "header" }, index$1.h("div", { key: 'd87168554cc1f2d97572fdf5645178a2b7706a83', class: `month-year ${this.type === 'dropdown' && 'dropdown'}` }, index$1.h("cura-icon", { key: '6654b5b1d0a0651bf744cbc7e84617233d4e1f58', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "left", color: this.determinePrevButtonColor(), onClick: !this.collapsed ? () => this.updateCurrentMonth('prev') : () => this.updateCurrentWeek('prev') }), this.type === 'dropdown' ? (index$1.h("div", { class: "select" }, index$1.h("cura-select", { size: "small", class: "drop-month", mode: "transparent", value: months[getMonth(this.currentDate)], onSelected: e => this.onMonthDropdownChange(e) }, months.map((month, index) => (index$1.h("cura-select-option", { size: "xsmall", key: index, value: month }, month)))), index$1.h("cura-select", { size: "small", class: "drop-year", mode: "transparent", value: getYear(this.currentDate).toString(), onSelected: e => this.onYearDropdownChange(e) }, this.fetchYearList().map((year, index) => (index$1.h("cura-select-option", { key: index, value: year.toString() }, year.toString())))))) : (index$1.h("cura-label", { color: "neutral-black", size: "large" }, months[getMonth(this.currentDate)].slice(0, 3), ", ", getYear(this.currentDate))), index$1.h("cura-icon", { key: '3d2c5d35cecc7eb49f7997b84043ce947d8c6492', class: `icon ${this.type === 'dropdown' && 'dropdown'}`, name: "right", color: "primary-base", onClick: !this.collapsed ? () => this.updateCurrentMonth('next') : () => this.updateCurrentWeek('next') }))), index$1.h("span", { key: '5ff644b7c2498f0f6b021158be6c6518b5639405', class: "days-of-week" }, this.fetchWeekDays().map((day, index) => (index$1.h("cura-label", { class: "day", size: "xsmall", color: "neutral-black", weight: "bold", key: index }, day === 'sab' ? 'SÁB' : day.toLocaleUpperCase())))), index$1.h("div", { key: '3cd87dc9c5742b26eeb930d0bdfc181c7f4c2aae', class: "dates" }, !this.collapsed
|
|
3882
3906
|
? this.fetchDaysOfMonth().map((day, index) => (index$1.h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))
|
|
3883
3907
|
: this.fetchDaysOfWeek().map((day, index) => (index$1.h("div", { key: index, class: this.getClasses(day), onClick: () => this.onDateClick(day) }, day ? format(day, 'd') : '')))), this.collapsed !== null ? (this.collapsed ? (index$1.h("div", { class: "collapsed-container" }, index$1.h("cura-button-transparent", { onClick: () => this.showNotColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "plusCircle" }, "Veja mais datas"))) : (index$1.h("div", { class: "collapsed-container" }, index$1.h("cura-button-transparent", { onClick: () => this.showColapsedCalendar(), size: "small", color: "primary", fontColor: "dark", iconName: "minusCircle" }, "Veja menos datas")))) : null)));
|
|
3884
3908
|
}
|
|
3885
3909
|
static get watchers() { return {
|
|
3886
|
-
"customDates": ["watchDefaultDatesArray"]
|
|
3910
|
+
"customDates": ["watchDefaultDatesArray"],
|
|
3911
|
+
"defaultDate": ["handleDefaultDateChange"]
|
|
3887
3912
|
}; }
|
|
3888
3913
|
};
|
|
3889
3914
|
CuraCalendar.style = CuraCalendarStyle0;
|