@paperless/core 3.6.6 → 3.7.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/build/{p-7ead64a1.js → p-11d3bf6d.js} +1 -1
- package/dist/build/p-30e187cd.entry.js +1 -0
- package/dist/build/p-7447d78d.entry.js +1 -0
- package/dist/build/p-ad0caa7e.entry.js +1 -0
- package/dist/build/paperless.esm.js +1 -1
- package/dist/cjs/p-calendar.cjs.entry.js +4 -1
- package/dist/cjs/p-datepicker.cjs.entry.js +6 -3
- package/dist/cjs/p-select.cjs.entry.js +25 -13
- package/dist/collection/components/molecules/calendar/calendar.component.js +4 -1
- package/dist/collection/components/molecules/datepicker/datepicker.component.js +6 -3
- package/dist/collection/components/molecules/select/select.component.js +25 -13
- package/dist/components/{p-B6Eg4keN.js → p-CqInd6A4.js} +1 -1
- package/dist/components/p-calendar.js +1 -1
- package/dist/components/p-datepicker.js +1 -1
- package/dist/components/p-select.js +1 -1
- package/dist/esm/p-calendar.entry.js +4 -1
- package/dist/esm/p-datepicker.entry.js +6 -3
- package/dist/esm/p-select.entry.js +25 -13
- package/dist/index.html +1 -1
- package/dist/paperless/p-30e187cd.entry.js +1 -0
- package/dist/paperless/p-7447d78d.entry.js +1 -0
- package/dist/paperless/p-ad0caa7e.entry.js +1 -0
- package/dist/paperless/paperless.esm.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/hydrate/index.js +35 -17
- package/hydrate/index.mjs +35 -17
- package/package.json +1 -1
- package/dist/build/p-62f87c18.entry.js +0 -1
- package/dist/build/p-8e7069b0.entry.js +0 -1
- package/dist/build/p-df709c40.entry.js +0 -1
- package/dist/paperless/p-62f87c18.entry.js +0 -1
- package/dist/paperless/p-8e7069b0.entry.js +0 -1
- package/dist/paperless/p-df709c40.entry.js +0 -1
package/hydrate/index.js
CHANGED
|
@@ -88093,6 +88093,9 @@ class Calendar {
|
|
|
88093
88093
|
if (dateFnsExports.isValid(value) && !dateFnsExports.isSameDay(value, this._viewDate)) {
|
|
88094
88094
|
this._viewDate = value;
|
|
88095
88095
|
}
|
|
88096
|
+
if (value?.getTime() === this._value?.getTime()) {
|
|
88097
|
+
return;
|
|
88098
|
+
}
|
|
88096
88099
|
this._setValue(value);
|
|
88097
88100
|
}
|
|
88098
88101
|
_parseMinDate(minDate) {
|
|
@@ -88153,7 +88156,7 @@ class Calendar {
|
|
|
88153
88156
|
}
|
|
88154
88157
|
}
|
|
88155
88158
|
render() {
|
|
88156
|
-
return (hAsync(ThemedHost, { key: '
|
|
88159
|
+
return (hAsync(ThemedHost, { key: 'b14ca11713b5ee2c0a5775230987b1654a3c58cc' }, hAsync("div", { key: '467ce8181c5cbbec87de1ae4817ed47183dca8e8', class: calendar$1({ variant: this.variant }) }, this._getView())));
|
|
88157
88160
|
}
|
|
88158
88161
|
_checkTodayButton() {
|
|
88159
88162
|
if (this._maxDate && dateFnsExports.isAfter(this._today, this._maxDate)) {
|
|
@@ -92207,7 +92210,10 @@ class Datepicker {
|
|
|
92207
92210
|
if (typeof value === 'string') {
|
|
92208
92211
|
value = new Date(value);
|
|
92209
92212
|
}
|
|
92210
|
-
this.
|
|
92213
|
+
if (value?.getTime() === this._value?.getTime()) {
|
|
92214
|
+
return;
|
|
92215
|
+
}
|
|
92216
|
+
this._setValue(value, true);
|
|
92211
92217
|
}
|
|
92212
92218
|
parseMinDate(minDate) {
|
|
92213
92219
|
if (minDate === null || minDate === '') {
|
|
@@ -92285,7 +92291,7 @@ class Datepicker {
|
|
|
92285
92291
|
}
|
|
92286
92292
|
}
|
|
92287
92293
|
render() {
|
|
92288
|
-
return (hAsync("p-dropdown", { key: '
|
|
92294
|
+
return (hAsync("p-dropdown", { key: 'e329571548f7fc670ea27b9096e43179bf575f48', allowOverflow: true, applyFullWidth: false, applyMaxWidth: false, disableTriggerClick: true, insideClick: true, isDatepicker: true, placement: this.placement, show: this._showDropdown, strategy: this.strategy }, hAsync("p-field", { key: '5904684c137055d5b2eb25890363ee8b458ce9ff', autoShowError: false, disabled: asBoolean(this.disabled), error: this.error, focused: this._showDropdown, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', label: this.label, loading: this.loading, placeholder: this.placeholder, prefix: this.prefix, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), size: this.size, slot: 'trigger', value: this._getFormattedDate(), onBlur: (ev) => this._onBlur(ev), onFocus: () => this._onFocus(), onInputRefChange: ev => (this._inputRef = ev.detail), onValueChange: ev => this._onValueChange(ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (hAsync("input", { key: '18243b5177bf1ccafc938199d17303a13e9c0a2d', class: '\n pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden\n opacity-0\n ', max: this.maxDate &&
|
|
92289
92295
|
dateFnsExports.format(new Date(this.maxDate), 'yyyy-MM-dd', {
|
|
92290
92296
|
locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
|
|
92291
92297
|
}), min: this._minDate &&
|
|
@@ -92294,7 +92300,7 @@ class Datepicker {
|
|
|
92294
92300
|
}), ref: ref => (this._dateInputRef = ref), slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', value: this._value &&
|
|
92295
92301
|
dateFnsExports.format(this._value, 'yyyy-MM-dd', {
|
|
92296
92302
|
locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
|
|
92297
|
-
}), onInput: ev => this._onNativeInput(ev) })), hAsync("div", { key: '
|
|
92303
|
+
}), onInput: ev => this._onNativeInput(ev) })), hAsync("div", { key: '72072c39f6b9f4234c39474084e10625bb739ff4', slot: 'items', tabIndex: -1 }, hAsync("p-calendar", { key: '374b07930dfaa7f1c1cfdf528fd0b53158d482bc', disableWeekends: this.disableWeekends, disabledDates: this.disabledDates, enableToday: this.enableToday, maxDate: this.maxDate, minDate: this.minDate, mode: this.mode, preselectToday: this.preselectToday, todayText: this.todayText, value: this._value, variant: 'embedded', onValueChange: ({ detail }) => (this.value = detail) }))));
|
|
92298
92304
|
}
|
|
92299
92305
|
documentClickHandler({ target }) {
|
|
92300
92306
|
if (!this._showDropdown || childOf(target, this._el)) {
|
|
@@ -98659,10 +98665,7 @@ const multiItem = cva([
|
|
|
98659
98665
|
const textContainer = cva('block w-full overflow-hidden text-start', {
|
|
98660
98666
|
variants: {
|
|
98661
98667
|
variant: {
|
|
98662
|
-
placeholder:
|
|
98663
|
-
text-storm-400
|
|
98664
|
-
dark:text-white
|
|
98665
|
-
`,
|
|
98668
|
+
placeholder: 'text-storm-400',
|
|
98666
98669
|
default: null,
|
|
98667
98670
|
},
|
|
98668
98671
|
enableTextWrap: {
|
|
@@ -98670,14 +98673,26 @@ const textContainer = cva('block w-full overflow-hidden text-start', {
|
|
|
98670
98673
|
false: 'text-ellipsis whitespace-nowrap',
|
|
98671
98674
|
},
|
|
98672
98675
|
error: {
|
|
98673
|
-
true:
|
|
98676
|
+
true: false,
|
|
98677
|
+
false: 'dark:text-white',
|
|
98678
|
+
},
|
|
98679
|
+
},
|
|
98680
|
+
compoundVariants: [
|
|
98681
|
+
{
|
|
98682
|
+
variant: 'placeholder',
|
|
98683
|
+
error: true,
|
|
98684
|
+
class: `
|
|
98674
98685
|
text-negative-red-700
|
|
98675
98686
|
group-hover/button:text-negative-red-800
|
|
98676
98687
|
dark:text-negative-red-alternative
|
|
98677
98688
|
`,
|
|
98678
|
-
false: null,
|
|
98679
98689
|
},
|
|
98680
|
-
|
|
98690
|
+
{
|
|
98691
|
+
variant: 'default',
|
|
98692
|
+
error: true,
|
|
98693
|
+
class: 'dark:text-negative-red-alternative',
|
|
98694
|
+
},
|
|
98695
|
+
],
|
|
98681
98696
|
});
|
|
98682
98697
|
class Select {
|
|
98683
98698
|
constructor(hostRef) {
|
|
@@ -98903,7 +98918,10 @@ class Select {
|
|
|
98903
98918
|
return this._getParsedItems();
|
|
98904
98919
|
}
|
|
98905
98920
|
get _displayValue() {
|
|
98906
|
-
const placeholder = (hAsync("div", { class: textContainer({
|
|
98921
|
+
const placeholder = (hAsync("div", { class: textContainer({
|
|
98922
|
+
variant: 'placeholder',
|
|
98923
|
+
error: !!this.error?.length,
|
|
98924
|
+
}) }, this.placeholder));
|
|
98907
98925
|
if (!this._selectedItem) {
|
|
98908
98926
|
return placeholder;
|
|
98909
98927
|
}
|
|
@@ -98979,8 +98997,8 @@ class Select {
|
|
|
98979
98997
|
if (this.error?.length) {
|
|
98980
98998
|
buttonIcon = 'warning';
|
|
98981
98999
|
}
|
|
98982
|
-
return (hAsync(ThemedHost, { key: '
|
|
98983
|
-
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '
|
|
99000
|
+
return (hAsync(ThemedHost, { key: 'c15b8ad5b4581bc9d73caec74094d05a5eccdc87' }, hAsync("p-field-container", { key: '79a06c8be8884124cccdb17baf8d386d34f01e47', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '9844250bac67e239336290deb4203ae6ecf62be4', applyChevron: false, applyFullWidth: true, applyMaxWidth: false, "disable-trigger-click": this.disabled, insideClick: true, manual: true, manualChevron: true, scrollable: this.enableAutocomplete ? 'large' : true, show: this._showDropdown, slot: 'content', strategy: this.strategy, onIsOpen: ev => this._onDropdownOpen(ev) }, hAsync("p-button", { key: 'c33d47717e74742095e0bb6597ed74393782924a', active: this._showDropdown, chevron: this.showChevron ? (this._showDropdown ? 'up' : 'down') : false, class: 'w-full', error: !!this.error?.length, icon: buttonIcon, iconClass: this.applyClassOnSelectedItem &&
|
|
99001
|
+
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: 'b8153f212f6fbcaf9654f71cd15cfe274b95125c', class: 'relative min-w-0 flex-1', ref: ref => (this._inputRef = ref) }, this._displayValue)), this.loading ? this._getLoadingItems() : this._getItems(), this.showAddItem && this._getAddItem()))));
|
|
98984
99002
|
}
|
|
98985
99003
|
documentClickHandler(event) {
|
|
98986
99004
|
if (!this._showDropdown || childOfComposed(event, this._el)) {
|
|
@@ -99221,7 +99239,7 @@ class Select {
|
|
|
99221
99239
|
_getDisplay(item, isSelection = false, isSelectedInMenu = false) {
|
|
99222
99240
|
let content = (hAsync("div", { class: textContainer({
|
|
99223
99241
|
variant: 'default',
|
|
99224
|
-
error: !!this.error?.length,
|
|
99242
|
+
error: !!this.error?.length && isSelection,
|
|
99225
99243
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99226
99244
|
}) }, item[isSelection
|
|
99227
99245
|
? (this.selectionDisplayKey ?? this.displayKey)
|
|
@@ -99229,7 +99247,7 @@ class Select {
|
|
|
99229
99247
|
if (this.avatarKey) {
|
|
99230
99248
|
content = (hAsync("span", { class: 'flex items-center gap-2' }, hAsync("p-avatar", { letters: item[this.avatarLettersKey], size: 'sm', src: item[this.avatarKey] }), hAsync("div", { class: textContainer({
|
|
99231
99249
|
variant: 'default',
|
|
99232
|
-
error: !!this.error?.length,
|
|
99250
|
+
error: !!this.error?.length && isSelection,
|
|
99233
99251
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99234
99252
|
}) }, item[this.dropdownDisplayKey ?? this.displayKey])));
|
|
99235
99253
|
}
|
|
@@ -99242,7 +99260,7 @@ class Select {
|
|
|
99242
99260
|
? (item?.[this.iconClassKey] ?? '')
|
|
99243
99261
|
: ''), variant: item[this.iconKey] })), hAsync("div", { class: textContainer({
|
|
99244
99262
|
variant: 'default',
|
|
99245
|
-
error: !!this.error?.length,
|
|
99263
|
+
error: !!this.error?.length && isSelection,
|
|
99246
99264
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99247
99265
|
}) }, item[this.dropdownDisplayKey ?? this.displayKey])));
|
|
99248
99266
|
}
|
package/hydrate/index.mjs
CHANGED
|
@@ -88091,6 +88091,9 @@ class Calendar {
|
|
|
88091
88091
|
if (dateFnsExports.isValid(value) && !dateFnsExports.isSameDay(value, this._viewDate)) {
|
|
88092
88092
|
this._viewDate = value;
|
|
88093
88093
|
}
|
|
88094
|
+
if (value?.getTime() === this._value?.getTime()) {
|
|
88095
|
+
return;
|
|
88096
|
+
}
|
|
88094
88097
|
this._setValue(value);
|
|
88095
88098
|
}
|
|
88096
88099
|
_parseMinDate(minDate) {
|
|
@@ -88151,7 +88154,7 @@ class Calendar {
|
|
|
88151
88154
|
}
|
|
88152
88155
|
}
|
|
88153
88156
|
render() {
|
|
88154
|
-
return (hAsync(ThemedHost, { key: '
|
|
88157
|
+
return (hAsync(ThemedHost, { key: 'b14ca11713b5ee2c0a5775230987b1654a3c58cc' }, hAsync("div", { key: '467ce8181c5cbbec87de1ae4817ed47183dca8e8', class: calendar$1({ variant: this.variant }) }, this._getView())));
|
|
88155
88158
|
}
|
|
88156
88159
|
_checkTodayButton() {
|
|
88157
88160
|
if (this._maxDate && dateFnsExports.isAfter(this._today, this._maxDate)) {
|
|
@@ -92205,7 +92208,10 @@ class Datepicker {
|
|
|
92205
92208
|
if (typeof value === 'string') {
|
|
92206
92209
|
value = new Date(value);
|
|
92207
92210
|
}
|
|
92208
|
-
this.
|
|
92211
|
+
if (value?.getTime() === this._value?.getTime()) {
|
|
92212
|
+
return;
|
|
92213
|
+
}
|
|
92214
|
+
this._setValue(value, true);
|
|
92209
92215
|
}
|
|
92210
92216
|
parseMinDate(minDate) {
|
|
92211
92217
|
if (minDate === null || minDate === '') {
|
|
@@ -92283,7 +92289,7 @@ class Datepicker {
|
|
|
92283
92289
|
}
|
|
92284
92290
|
}
|
|
92285
92291
|
render() {
|
|
92286
|
-
return (hAsync("p-dropdown", { key: '
|
|
92292
|
+
return (hAsync("p-dropdown", { key: 'e329571548f7fc670ea27b9096e43179bf575f48', allowOverflow: true, applyFullWidth: false, applyMaxWidth: false, disableTriggerClick: true, insideClick: true, isDatepicker: true, placement: this.placement, show: this._showDropdown, strategy: this.strategy }, hAsync("p-field", { key: '5904684c137055d5b2eb25890363ee8b458ce9ff', autoShowError: false, disabled: asBoolean(this.disabled), error: this.error, focused: this._showDropdown, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, icon: this.hideIconWhenFilled && !!this._value ? null : 'calendar-multi', iconPosition: 'start', label: this.label, loading: this.loading, placeholder: this.placeholder, prefix: this.prefix, required: asBoolean(this.required), showOptional: asBoolean(this.showOptional), size: this.size, slot: 'trigger', value: this._getFormattedDate(), onBlur: (ev) => this._onBlur(ev), onFocus: () => this._onFocus(), onInputRefChange: ev => (this._inputRef = ev.detail), onValueChange: ev => this._onValueChange(ev.detail) }), this.enableNativePicker && this._isMobileBrowser && (hAsync("input", { key: '18243b5177bf1ccafc938199d17303a13e9c0a2d', class: '\n pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden\n opacity-0\n ', max: this.maxDate &&
|
|
92287
92293
|
dateFnsExports.format(new Date(this.maxDate), 'yyyy-MM-dd', {
|
|
92288
92294
|
locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
|
|
92289
92295
|
}), min: this._minDate &&
|
|
@@ -92292,7 +92298,7 @@ class Datepicker {
|
|
|
92292
92298
|
}), ref: ref => (this._dateInputRef = ref), slot: 'trigger', type: this.mode === 'day' ? 'date' : 'month', value: this._value &&
|
|
92293
92299
|
dateFnsExports.format(this._value, 'yyyy-MM-dd', {
|
|
92294
92300
|
locale: state.locale === 'nl' ? localeExports.nl : localeExports.enUS,
|
|
92295
|
-
}), onInput: ev => this._onNativeInput(ev) })), hAsync("div", { key: '
|
|
92301
|
+
}), onInput: ev => this._onNativeInput(ev) })), hAsync("div", { key: '72072c39f6b9f4234c39474084e10625bb739ff4', slot: 'items', tabIndex: -1 }, hAsync("p-calendar", { key: '374b07930dfaa7f1c1cfdf528fd0b53158d482bc', disableWeekends: this.disableWeekends, disabledDates: this.disabledDates, enableToday: this.enableToday, maxDate: this.maxDate, minDate: this.minDate, mode: this.mode, preselectToday: this.preselectToday, todayText: this.todayText, value: this._value, variant: 'embedded', onValueChange: ({ detail }) => (this.value = detail) }))));
|
|
92296
92302
|
}
|
|
92297
92303
|
documentClickHandler({ target }) {
|
|
92298
92304
|
if (!this._showDropdown || childOf(target, this._el)) {
|
|
@@ -98657,10 +98663,7 @@ const multiItem = cva([
|
|
|
98657
98663
|
const textContainer = cva('block w-full overflow-hidden text-start', {
|
|
98658
98664
|
variants: {
|
|
98659
98665
|
variant: {
|
|
98660
|
-
placeholder:
|
|
98661
|
-
text-storm-400
|
|
98662
|
-
dark:text-white
|
|
98663
|
-
`,
|
|
98666
|
+
placeholder: 'text-storm-400',
|
|
98664
98667
|
default: null,
|
|
98665
98668
|
},
|
|
98666
98669
|
enableTextWrap: {
|
|
@@ -98668,14 +98671,26 @@ const textContainer = cva('block w-full overflow-hidden text-start', {
|
|
|
98668
98671
|
false: 'text-ellipsis whitespace-nowrap',
|
|
98669
98672
|
},
|
|
98670
98673
|
error: {
|
|
98671
|
-
true:
|
|
98674
|
+
true: false,
|
|
98675
|
+
false: 'dark:text-white',
|
|
98676
|
+
},
|
|
98677
|
+
},
|
|
98678
|
+
compoundVariants: [
|
|
98679
|
+
{
|
|
98680
|
+
variant: 'placeholder',
|
|
98681
|
+
error: true,
|
|
98682
|
+
class: `
|
|
98672
98683
|
text-negative-red-700
|
|
98673
98684
|
group-hover/button:text-negative-red-800
|
|
98674
98685
|
dark:text-negative-red-alternative
|
|
98675
98686
|
`,
|
|
98676
|
-
false: null,
|
|
98677
98687
|
},
|
|
98678
|
-
|
|
98688
|
+
{
|
|
98689
|
+
variant: 'default',
|
|
98690
|
+
error: true,
|
|
98691
|
+
class: 'dark:text-negative-red-alternative',
|
|
98692
|
+
},
|
|
98693
|
+
],
|
|
98679
98694
|
});
|
|
98680
98695
|
class Select {
|
|
98681
98696
|
constructor(hostRef) {
|
|
@@ -98901,7 +98916,10 @@ class Select {
|
|
|
98901
98916
|
return this._getParsedItems();
|
|
98902
98917
|
}
|
|
98903
98918
|
get _displayValue() {
|
|
98904
|
-
const placeholder = (hAsync("div", { class: textContainer({
|
|
98919
|
+
const placeholder = (hAsync("div", { class: textContainer({
|
|
98920
|
+
variant: 'placeholder',
|
|
98921
|
+
error: !!this.error?.length,
|
|
98922
|
+
}) }, this.placeholder));
|
|
98905
98923
|
if (!this._selectedItem) {
|
|
98906
98924
|
return placeholder;
|
|
98907
98925
|
}
|
|
@@ -98977,8 +98995,8 @@ class Select {
|
|
|
98977
98995
|
if (this.error?.length) {
|
|
98978
98996
|
buttonIcon = 'warning';
|
|
98979
98997
|
}
|
|
98980
|
-
return (hAsync(ThemedHost, { key: '
|
|
98981
|
-
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: '
|
|
98998
|
+
return (hAsync(ThemedHost, { key: 'c15b8ad5b4581bc9d73caec74094d05a5eccdc87' }, hAsync("p-field-container", { key: '79a06c8be8884124cccdb17baf8d386d34f01e47', error: this.error, forceShowTooltip: !!this.error?.length && !this._showDropdown, helper: this.helper, label: this.label, prefix: this.prefix, required: this.required, showOptional: this.showOptional, variant: 'write' }, hAsync("p-dropdown", { key: '9844250bac67e239336290deb4203ae6ecf62be4', applyChevron: false, applyFullWidth: true, applyMaxWidth: false, "disable-trigger-click": this.disabled, insideClick: true, manual: true, manualChevron: true, scrollable: this.enableAutocomplete ? 'large' : true, show: this._showDropdown, slot: 'content', strategy: this.strategy, onIsOpen: ev => this._onDropdownOpen(ev) }, hAsync("p-button", { key: 'c33d47717e74742095e0bb6597ed74393782924a', active: this._showDropdown, chevron: this.showChevron ? (this._showDropdown ? 'up' : 'down') : false, class: 'w-full', error: !!this.error?.length, icon: buttonIcon, iconClass: this.applyClassOnSelectedItem &&
|
|
98999
|
+
this._selectedItem?.[this.iconClassKey], size: this.size, slot: 'trigger', variant: 'secondary', onClick: ev => this._onClick(ev) }, hAsync("div", { key: 'b8153f212f6fbcaf9654f71cd15cfe274b95125c', class: 'relative min-w-0 flex-1', ref: ref => (this._inputRef = ref) }, this._displayValue)), this.loading ? this._getLoadingItems() : this._getItems(), this.showAddItem && this._getAddItem()))));
|
|
98982
99000
|
}
|
|
98983
99001
|
documentClickHandler(event) {
|
|
98984
99002
|
if (!this._showDropdown || childOfComposed(event, this._el)) {
|
|
@@ -99219,7 +99237,7 @@ class Select {
|
|
|
99219
99237
|
_getDisplay(item, isSelection = false, isSelectedInMenu = false) {
|
|
99220
99238
|
let content = (hAsync("div", { class: textContainer({
|
|
99221
99239
|
variant: 'default',
|
|
99222
|
-
error: !!this.error?.length,
|
|
99240
|
+
error: !!this.error?.length && isSelection,
|
|
99223
99241
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99224
99242
|
}) }, item[isSelection
|
|
99225
99243
|
? (this.selectionDisplayKey ?? this.displayKey)
|
|
@@ -99227,7 +99245,7 @@ class Select {
|
|
|
99227
99245
|
if (this.avatarKey) {
|
|
99228
99246
|
content = (hAsync("span", { class: 'flex items-center gap-2' }, hAsync("p-avatar", { letters: item[this.avatarLettersKey], size: 'sm', src: item[this.avatarKey] }), hAsync("div", { class: textContainer({
|
|
99229
99247
|
variant: 'default',
|
|
99230
|
-
error: !!this.error?.length,
|
|
99248
|
+
error: !!this.error?.length && isSelection,
|
|
99231
99249
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99232
99250
|
}) }, item[this.dropdownDisplayKey ?? this.displayKey])));
|
|
99233
99251
|
}
|
|
@@ -99240,7 +99258,7 @@ class Select {
|
|
|
99240
99258
|
? (item?.[this.iconClassKey] ?? '')
|
|
99241
99259
|
: ''), variant: item[this.iconKey] })), hAsync("div", { class: textContainer({
|
|
99242
99260
|
variant: 'default',
|
|
99243
|
-
error: !!this.error?.length,
|
|
99261
|
+
error: !!this.error?.length && isSelection,
|
|
99244
99262
|
enableTextWrap: this.enableTextWrap && !isSelection,
|
|
99245
99263
|
}) }, item[this.dropdownDisplayKey ?? this.displayKey])));
|
|
99246
99264
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,h as r}from"./p-yFtRjnrU.js";import{c as a}from"./p-CBWjHURv.js";import{d as i,l as s}from"./p-B_lDCj8j.js";import{T as o}from"./p-CSySY6aC.js";import{s as h}from"./p-6XOzWrsN.js";import{c as n}from"./p-xs4N_Y-0.js";import"./p-ChV9xqsO.js";const d=a(["flex w-[17.5rem] flex-col gap-4"],{variants:{variant:{default:["rounded-lg p-2 drop-shadow-2","border border-storm-100"],embedded:"p-1"}}}),c=a(["flex items-center gap-2","w-full rounded-lg p-2","\n bg-off-white-300\n dark:bg-white/15\n "],{variants:{type:{day:"justify-between",month:"justify-between",year:"justify-center"}}}),l=a(["flex flex-col gap-2","w-full"],{variants:{view:{day:"h-auto min-h-[12rem]",month:"min-h-[15rem]",year:"max-h-[15rem]"}}}),m=class{constructor(r){t(this,r),this.valueChange=e(this,"valueChange",3)}variant="default";value;preselectToday=!1;disabledDates;minDate=null;maxDate=null;disableWeekends=!1;enableToday=!0;todayText="today";mode="day";valueChange;_today=new Date;_view=this.mode;_viewDate=this._today;_value;_minDate;_maxDate;_disabledDates=[];_enableToday=!0;_weekDays=[...Array.from({length:7}).keys()];_yearItemsRef;componentWillLoad(){this.disabledDates&&this._parseDisabledDates(this.disabledDates),this._parseMinDate(this.minDate),this._parseMaxDate(this.maxDate),this._parseValue(this.value),this._value&&(this._viewDate=this._value),i.isBefore(this._viewDate,this._minDate)&&(this._viewDate=this._minDate),i.isAfter(this._viewDate,this._maxDate)&&(this._viewDate=this._maxDate),this._modeChange(this.mode)}componentWillRender(){this._enableToday=this.enableToday&&this._checkTodayButton()}componentDidRender(){"year"===this._view&&this._scrollYearIntoView()}_parseValue(t){!t&&this.preselectToday&&(t=new Date),"string"==typeof t&&(t=new Date(t)),i.isValid(t)&&!i.isSameDay(t,this._viewDate)&&(this._viewDate=t),this._setValue(t)}_parseMinDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),i.isValid(t)&&(this._minDate=t,i.isBefore(this._viewDate,this._minDate)&&(this._viewDate=this._minDate))):this.minDate=new Date(i.getYear(i.subYears(new Date,100)),0,1)}_parseMaxDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),i.isValid(t)&&(this._maxDate=t,i.isAfter(this._viewDate,this._maxDate)&&(this._viewDate=this._maxDate))):this.maxDate=this._getAutomaticMax()}_parseDisabledDates(t){"string"==typeof t&&(t=JSON.parse(t)),t&&Array.isArray(t)&&(this._disabledDates=t.map((t=>"string"==typeof t?new Date(t):t)).filter((t=>i.isValid(t))))}_modeChange(t){"year"===t&&"year"!==this._view&&(this._view="year"),"month"===t&&"day"===this._view&&(this._view="month")}render(){return r(o,{key:"396e1c7059b24d8aec57317d839f448be1e37f26"},r("div",{key:"9030d30aa2fbd06919ec711c01f135ef35c5d7f6",class:d({variant:this.variant})},this._getView()))}_checkTodayButton(){return!(this._maxDate&&i.isAfter(this._today,this._maxDate)||this._minDate&&i.isBefore(this._today,this._minDate)||this.disableWeekends&&i.isWeekend(this._today)||"day"!==this.mode)}_getView(){return"year"===this._view?this._getYearView():"month"===this._view?this._getMonthView():this._getDayView()}_getDayView(){const t=this._generateDaysInMonth();return r("div",{class:l({view:"day"})},this._getHeader("day"),r("div",{class:"grid grid-cols-7 justify-between gap-1"},this._weekDays.map((t=>r("span",{class:"w-8 text-center text-xs text-storm-200"},i.format(i.addDays(new Date(2022,7,1),t),"nl"===h.locale?"EEEEEE":"eee",{locale:"nl"===h.locale?s.nl:s.enUS})))),t.map((t=>t.active?r("p-button",{class:n("w-8",`\n col-start-${t.offset}\n `),tabIndex:-1,variant:"primary",onClick:()=>this._setValue(t.date)},t.day):r("time",{class:n("normal flex items-center justify-center rounded-lg","h-8 w-8 text-sm font-semibold","text-storm-300","dark:bg-white/15",{"cursor-pointer hover:bg-white-600 hover:text-storm-500 dark:text-white dark:hover:bg-hurricane-300 dark:hover:text-white":!t.disabled,"dark:text-hurricane-200":t.disabled},`\n col-start-${t.offset}\n `,{"cursor-not-allowed opacity-60":t.disabled},{"border border-solid border-off-white-700 bg-off-white-300 text-storm-500 dark:border-none dark:bg-hurricane-200 dark:text-white":!t.disabled&&i.isSameDay(t.date,new Date)}),onClick:()=>this._setValue(t.date)},t.day)))))}_getMonthView(){const t=this._generateMonths();return r("div",{class:l({view:"month"})},this._getHeader("month"),r("div",{class:"flex flex-wrap items-start gap-2"},t.map((t=>r("p-button",{disabled:t.disabled,tabIndex:-1,variant:t.active?"primary":"secondary",onClick:()=>this._setMonth(t.month)},i.format(i.setMonth(new Date,t.month),"MMMM",{locale:"nl"===h.locale?s.nl:s.enUS}))))))}_getYearView(){const t=this._generateYears();return r("div",{class:l({view:"year"})},this._getHeader("year"),r("div",{class:"grid h-full grid-cols-4 gap-2 overflow-scroll",ref:t=>this._yearItemsRef=t},t.map((t=>r("p-button",{class:"w-full","data-active":t.active,"data-current":t.current,tabIndex:-1,variant:t.active?"primary":"secondary",onClick:()=>this._setYear(t.year)},t.year)))))}_getHeader(t="day"){let e=t=>this._changeMonth(t),a="month";return"month"!==t&&"year"!==t||(e=t=>this._changeYear(t),a="year"),r("div",{class:c({type:this.mode})},"year"!==this.mode&&r("p-button",{disabled:!this._canSetAmount(a,-1)||"year"===this._view,icon:"caret",iconRotate:90,size:"sm",tabIndex:-1,variant:"secondary",iconOnly:!0,onClick:()=>e(-1)}),r("div",{class:n("flex gap-2",{"flex-1":this._enableToday})},"year"!==this.mode&&r("p-button",{active:"month"===this._view&&"month"!==this.mode,disabled:!this._canChangeView("month"),size:"sm",tabIndex:-1,variant:"secondary",onClick:()=>this._changeView("month")},i.format(this._viewDate,"MMMM",{locale:"nl"===h.locale?s.nl:s.enUS})),r("p-button",{active:"year"===this._view&&"year"!==this.mode,disabled:!this._canChangeView("year"),size:"sm",tabIndex:-1,variant:"secondary",onClick:()=>this._changeView("year")},i.getYear(this._viewDate)),this._enableToday&&r("p-tooltip",{class:"ml-auto",content:this.todayText},r("p-button",{icon:"calendar",iconOnly:!0,size:"sm",slot:"trigger",tabIndex:-1,variant:"secondary",onClick:()=>this._setToday()}))),"year"!==this.mode&&r("p-button",{disabled:!this._canSetAmount(a,1)||"year"==this._view,icon:"caret",iconRotate:-90,size:"sm",tabIndex:-1,variant:"secondary",iconOnly:!0,onClick:()=>e(1)}))}_setYear(t){const e=i.setYear(this._viewDate,t);if("year"!==this.mode)return this._viewDate=e,void(this._view="month");this._viewDate=e,this._setValue(i.setMonth(i.setDate(e,1),0))}_setMonth(t){const e=i.setMonth(this._viewDate,t);if("day"===this.mode)return this._viewDate=e,void(this._view="day");this._viewDate=e,this._setValue(i.setDate(e,1))}_setToday(){this._viewDate=this._today,this._setValue(this._today),this._view="day"}_changeMonth(t=1){if(!this._canSetAmount("month",t))return;const e=i.addMonths(this._viewDate,t);this._viewDate=e}_changeYear(t=1){if(!this._canSetAmount("year",t))return;let e=i.addYears(this._viewDate,t);this._viewDate=e}_setValue(t){if(null===t)return this._value=null,void this.valueChange.emit(null);i.isValid(t)&&(this._isDisabledDay(t)||(t=i.startOfDay(t),i.isSameDay(t,this._value)||(this._value=t,this.valueChange.emit(t))))}_generateDaysInMonth(){return[...new Array(i.getDaysInMonth(this._viewDate)).keys()].map((t=>{const e=i.startOfDay(i.setDate(this._viewDate,t+=1)),r=i.getDay(e);return{day:t,date:e,offset:1===t&&(0===r?7:r),current:i.isSameDay(e,this._today),active:i.isSameDay(e,this._value),disabled:this._isDisabledDay(e)}}))}_isDisabledDay(t){return i.isBefore(t,this._minDate)&&!i.isSameDay(t,this._maxDate)||i.isAfter(t,this._maxDate)&&!i.isSameDay(t,this._maxDate)||(0===i.getDay(t)||6===i.getDay(t))&&this.disableWeekends||this._disabledDates.some((e=>i.isSameDay(e,t)))}_generateMonths(){const t=i.getYear(this._viewDate);return[...Array.from({length:12}).keys()].map((e=>{const r=new Date(t,e,1);return{month:e,current:i.isSameMonth(this._today,r),active:i.isSameMonth(this._value,r),disabled:i.isAfter(r,this._maxDate)||i.isBefore(i.endOfMonth(r),this._minDate)}}))}_generateYears(){const t=i.getYear(this._maxDate)+1,e=i.getYear(this._minDate);return[...new Array(t-e).keys()].map((t=>{const r=e+t;return{year:r,current:i.getYear(this._today)===r,active:i.getYear(this._value)===r}}))}_scrollYearIntoView(){const t=this._yearItemsRef;if(!t)return;const e=t.querySelector("p-button[data-active]");if(e)return t.scrollTo({top:e.offsetTop-100});const r=t.querySelector("p-button[data-current]");return r?t.scrollTo({top:r.offsetTop-100}):void 0}_changeView(t){this._canChangeView(t)&&(this._view=t)}_canChangeView(t){return"year"===t?!i.isSameYear(this._minDate,this._maxDate):!i.isSameMonth(this._minDate,this._maxDate)}_canSetAmount(t,e=1){if("month"===t){const t=i.addMonths(this._viewDate,e),r=i.startOfMonth(t);if(i.isBefore(r,i.startOfMonth(this._minDate))&&!i.isSameDay(r,this._minDate)||i.isAfter(r,i.endOfMonth(this._maxDate)))return!1}if("year"===t){let t=i.addYears(this._viewDate,e);const r=i.getYear(t);if(r<i.getYear(this._minDate)||r>i.getYear(this._maxDate))return!1}return!0}_getAutomaticMax(){const t=i.addYears(new Date,50);let e=i.getYear(t);return e=10*Math.ceil(e/10),i.setYear(t,e)}static get watchers(){return{value:[{_parseValue:0}],minDate:[{_parseMinDate:0}],maxDate:[{_parseMaxDate:0}],disabledDates:[{_parseDisabledDates:0}],mode:[{_modeChange:0}]}}};m.style="*{box-sizing:border-box}.static{position:static}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.col-start-4{grid-column-start:4}.col-start-5{grid-column-start:5}.col-start-6{grid-column-start:6}.col-start-7{grid-column-start:7}.ml-auto{margin-left:auto}.flex{display:flex}.grid{display:grid}.h-8{height:2rem}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[15rem\\]{max-height:15rem}.min-h-\\[12rem\\]{min-height:12rem}.min-h-\\[15rem\\]{min-height:15rem}.w-8{width:2rem}.w-\\[17\\.5rem\\]{width:17.5rem}.w-full{width:100%}.flex-1{flex:1 1 0%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.overflow-scroll{overflow:scroll}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-solid{border-style:solid}.border-off-white-700{--tw-border-opacity:1;border-color:rgb(222 219 213/var(--tw-border-opacity,1))}.border-storm-100{--tw-border-opacity:1;border-color:rgb(209 210 212/var(--tw-border-opacity,1))}.bg-off-white-300{--tw-bg-opacity:1;background-color:rgb(248 247 244/var(--tw-bg-opacity,1))}.p-1{padding:.25rem}.p-2{padding:.5rem}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-hurricane-200,.text-storm-200{--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-500{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.opacity-60{opacity:.6}.drop-shadow-2{--tw-drop-shadow:drop-shadow(0 1px 1px rgba(0,2,2,.04)) drop-shadow(0 2px 2px rgba(0,2,2,.04)) drop-shadow(0 4px 4px rgba(0,2,2,.04))}.drop-shadow-2,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:bg-white-600:hover{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.hover\\:text-storm-500:hover{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.dark\\:border-none:where(:host([data-theme=dark]),:host([data-theme=dark]) *){border-style:none}.dark\\:bg-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-bg-opacity:1;background-color:rgb(163 165 169/var(--tw-bg-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:hover\\:bg-hurricane-300:hover:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-bg-opacity:1;background-color:rgb(116 120 127/var(--tw-bg-opacity,1))}.dark\\:hover\\:text-white:hover:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:border-none:where([data-theme=dark],[data-theme=dark] *){border-style:none}.dark\\:bg-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-bg-opacity:1;background-color:rgb(163 165 169/var(--tw-bg-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:hover\\:bg-hurricane-300:hover:where([data-theme=dark],[data-theme=dark] *){--tw-bg-opacity:1;background-color:rgb(116 120 127/var(--tw-bg-opacity,1))}.dark\\:hover\\:text-white:hover:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{m as p_calendar}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s,F as r}from"./p-yFtRjnrU.js";import{c as a}from"./p-CBWjHURv.js";import{T as h}from"./p-CSySY6aC.js";import{a as o}from"./p-TyZ7uPES.js";import{c as n}from"./p-xs4N_Y-0.js";import{S as l}from"./p-CEaB2BT0.js";import"./p-ChV9xqsO.js";import"./p-6XOzWrsN.js";const d=a(["flex items-center gap-2","h-full min-w-0 flex-1","pointer-events-none overflow-hidden"]),c=a(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","whitespace-nowrap text-sm font-semibold","rounded-lg","bg-indigo-100","dark:bg-white/15"]),p=a("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"\n text-storm-400\n dark:text-white\n ",default:null},enableTextWrap:{true:!1,false:"text-ellipsis whitespace-nowrap"},error:{true:"\n text-negative-red-700\n group-hover/button:text-negative-red-800\n dark:text-negative-red-alternative\n ",false:null}}}),m=class{constructor(i){t(this,i),this.queryChange=e(this,"queryChange",3),this.valueChange=e(this,"valueChange",3),this.selectAllChange=e(this,"selectAllChange",3),this.dropdownShown=e(this,"dropdownShown",3),this.add=e(this,"add",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=!0;showChevron=!0;maxDisplayedItems=l;enableAutocomplete=!0;enableTextWrap=!1;asyncFilter=!1;loading=!1;enableSelectAll=!1;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=!0;showOptional=!0;error;disabled=!1;showAddItem=!1;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=!1;_selectedItem=null;_allSelected=!1;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:p({variant:"placeholder"})},this.placeholder);return this._selectedItem?this.multi?0===this._selectedItem?.length?t:s("div",{class:d(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:c(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"\n text-xs text-indigo-500\n group-hover/item:text-indigo-800\n dark:text-white/15\n dark:group-hover/item:text-white\n ",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden)):this._getDisplay(this._selectedItem,!0):t}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey)throw new Error("You must provide a valueKey or identifierKey");this.multi&&(this._setMultiContainerMaxWidth(),this._resizeObserver=new ResizeObserver((()=>{this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth(),this._setCheckSelectedItemsTimeout()}),200)})),this._resizeObserver.observe(this._el)),this.value?this._valueChange():this.itemChanges()}componentDidRender(){this.multi&&this._setMultiContainerMaxWidth()}disconnectedCallback(){this.multi&&this._resizeObserver.disconnect()}render(){let t=this.icon;return this._selectedItem&&!this.avatarKey&&this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem&&(t=this._selectedItem[this.iconKey]),(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey])&&(t=null),this.error?.length&&(t="warning"),s(h,{key:"b7c7d91e9c103eb283a19e6d61bd8a1ccdfcb1ae"},s("p-field-container",{key:"ce39c71781d71950eb8f0ec439e70508a801d4bd",error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,label:this.label,prefix:this.prefix,required:this.required,showOptional:this.showOptional,variant:"write"},s("p-dropdown",{key:"172741cbe636fa4b59cbac4445fdff1c8ade7ca7",applyChevron:!1,applyFullWidth:!0,applyMaxWidth:!1,"disable-trigger-click":this.disabled,insideClick:!0,manual:!0,manualChevron:!0,scrollable:!this.enableAutocomplete||"large",show:this._showDropdown,slot:"content",strategy:this.strategy,onIsOpen:t=>this._onDropdownOpen(t)},s("p-button",{key:"9fda8191122e870eda211c58b30a6de022b629eb",active:this._showDropdown,chevron:!!this.showChevron&&(this._showDropdown?"up":"down"),class:"w-full",error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],size:this.size,slot:"trigger",variant:"secondary",onClick:t=>this._onClick(t)},s("div",{key:"1d08bb324241e1db8698678be35a1fd57f00603f",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){this._showDropdown&&!o(t,this._el)&&(this._showDropdown=!1)}_valueChange(){setTimeout((()=>{this._preselectItem(),this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){this._selectedItem&&!Array.isArray(this._selectedItem)&&(this._selectedItem=[])}_preselectItem(){let t="string"==typeof this.value&&this.multi?JSON.parse(this.value):this.value;if(this.multi)return Array.isArray(t)?(this.value=t,0===t.length?void(this._selectedItem=[]):void(this._selectedItem=this.valueKey&&"false"!==this.valueKey?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t])):(this.value=[],void this.valueChange.emit(this.value));this._selectedItem||t||!this.autoSelectFirst||(t=this._items[0]);const e="object"==typeof t&&null!==t?t[this._identifierKey]:t,i="string"==typeof e||"number"==typeof e?e:JSON.stringify(e),s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null,r="string"==typeof s||"number"==typeof s?s:JSON.stringify(s);if(this._selectedItem&&r===i)return;if(!this._items?.length&&t)return void this._selectValue(t,!1);const a=this._getParsedItems(!1).find((t=>{const e=t?.[this._identifierKey];return("string"==typeof e||"number"==typeof e?e:JSON.stringify(e))===i}));this._selectValue(a??t,!1)}_selectValue(t,e=!0){let i=this.valueKey&&"false"!==this.valueKey&&null!==t&&!this.loading?t?.[this.valueKey]:t;if(this.multi){this._selectedItem&&Array.isArray(this._selectedItem)||(this._selectedItem=[]),this.value&&Array.isArray(this.value)||(this.value=[]);const e=[...this._selectedItem],s=[...this.value],r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));return-1===r?(e.push(t),s.push(i)):(e.splice(r,1),s.splice(r,1)),this._selectedItem=e,this.value=s,void this.valueChange.emit(s)}this._selectedItem=t,this._onBlur(e),i!==this.value&&(this.value=i,this.valueChange.emit(i))}_onClick(t){const e=t?.composedPath();for(const t of e){if("p-button"===t.nodeName.toLowerCase())break;if(t.classList?.contains("item"))return}this._showDropdown=!this._showDropdown}_onBlur(t=!1){this.enableAutocomplete&&!t||(this._showDropdown=!1)}_onAutoComplete(t){this.enableAutocomplete&&(this._showDropdown=!0,this.query=t.detail,this.queryChange.emit(t.detail))}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.some((e=>e[this._identifierKey]===t[this._identifierKey])):t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{active:e,checkbox:!!this.multi,enableTextWrap:this.enableTextWrap,slot:"items",useContainer:!1,onClick:()=>this._selectValue(t)},this._getDisplay(t,!1,e))}));return 0!==this._items.length||this.showAddItem||(t=[s("p",{class:"\n w-full p-2 text-center text-sm text-storm-400\n dark:text-hurricane-200\n ",slot:"items"},this.emptyStateText)]),this.enableSelectAll&&this._items.length>0&&t.unshift(s("p-dropdown-menu-item",{active:this._allSelected,slot:"items",useContainer:!1,checkbox:!0,onClick:()=>this._selectAllChange()},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText)),this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAddItem(){return s(r,null,this._items.length>0&&s("p-divider",{class:"my-1 px-2",slot:"items"}),s("p-dropdown-menu-item",{slot:"items",useContainer:!1,onClick:()=>this.add.emit()},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"}))))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:!1,slot:"items"},s("p-loader",{class:"h-6 w-full rounded",variant:"ghost"}))));return this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,value:this.query,onInputRefChange:t=>this.autocompleteInputRef=t.detail,onValueChange:t=>this._onAutoComplete(t)}))}_setMultiContainerMaxWidth(){this._inputRef&&this._multiContainerRef&&(this._multiContainerRef.style.maxWidth=`${Math.max(this._inputRef.clientWidth-16,16)}px`)}_setCheckSelectedItemsTimeout(){this._checkSelectedItemsTimeout&&clearTimeout(this._checkSelectedItemsTimeout),this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef)return;const t=this._multiContainerRef.getBoundingClientRect(),e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e)s.classList.remove("hidden"),s.classList.add("flex"),s.getBoundingClientRect().right>t.right&&(s.classList.remove("flex"),s.classList.add("hidden"),i++);this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");s&&(s.classList.contains("hidden")||s.classList.add("hidden"),i>0&&s.classList.remove("hidden"))}_onDropdownOpen(t){t.detail&&this.autocompleteInputRef&&setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected,this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=!1,i=!1){let r=s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);return this.avatarKey&&(r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{letters:t[this.avatarLettersKey],size:"sm",src:t[this.avatarKey]}),s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),!this.iconKey||e&&!this.showIconOnSelectedItem||(r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:n("\n text-storm-300\n dark:text-hurricane-200\n ",e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu?"":t?.[this.iconClassKey]??""),variant:t[this.iconKey]}),s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu||!t?.[this.classKey]?.length?r:s("div",{class:t[this.classKey]},r)}_getParsedItems(t=!0){if(!this.items||this.loading)return[];let e="string"==typeof this.items?JSON.parse(this.items):this.items;return"string"==typeof e?.[0]&&(this.displayKey="text",this.valueKey="value",e=e.map((t=>({value:t,text:t})))),this.query?.length&&!this.asyncFilter&&(e=e.filter((t=>this.queryKey?this._checkvalue(this.queryKey,t):this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)))),t?e?.slice(0,this.maxDisplayedItems):e}static get formAssociated(){return!0}static get watchers(){return{value:[{_valueChange:0}],items:[{itemChanges:0}],_showDropdown:[{_showDropdownChanges:0}],multi:[{multiChanges:0}]}}};m.style="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.my-1{margin-bottom:.25rem;margin-top:.25rem}.mb-3{margin-bottom:.75rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-8{height:2rem}.h-\\[1\\.625rem\\]{height:1.625rem}.h-full{height:100%}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1 1 0%}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.bg-indigo-100{--tw-bg-opacity:1;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-indigo-500{--tw-text-opacity:1;color:rgb(142 179 251/var(--tw-text-opacity,1))}.text-indigo-600{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity,1))}.text-negative-red-700{--tw-text-opacity:1;color:rgb(147 16 16/var(--tw-text-opacity,1))}.text-storm-100{--tw-text-opacity:1;color:rgb(209 210 212/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-400{--tw-text-opacity:1;color:rgb(70 75 84/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1;color:rgb(141 16 16/var(--tw-text-opacity,1))}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1;color:rgb(27 88 210/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{m as p_select}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s}from"./p-yFtRjnrU.js";import{d as a,l as h}from"./p-B_lDCj8j.js";import{s as l}from"./p-6XOzWrsN.js";import{c as n}from"./p-TyZ7uPES.js";import{i as r}from"./p-DPc49L2n.js";import{a as o}from"./p-C5CTp9IA.js";const d=class{constructor(i){t(this,i),this.valueChange=e(this,"valueChange",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}placeholder;value;preselectToday=!1;enableNativePicker=!0;disabledDates;minDate=null;maxDate=null;disableWeekends=!1;enableToday=!0;todayText="today";mode="day";valueChange;format="dd-MM-yyyy";hideIconWhenFilled=!1;size="base";prefix;label;loading=!1;helper;required;showOptional=!0;error;disabled=!1;strategy="absolute";placement="bottom-start";get _el(){return i(this)}_showDropdown=!1;_value;_minDate;_maxDate;_disabledDates=[];_isMobileBrowser=!1;_internals;_onInputTimeout;_inputRef;_dateInputRef;_defaultFormats={year:"yyyy",month:"LLLL, yyyy",day:"dd-MM-yyyy",dayNoDashes:"ddMMyyyy"};parseValue(t){!t&&this.preselectToday&&(t=new Date),"string"==typeof t&&(t=new Date(t)),this._setValue(t)}parseMinDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),a.isValid(t)&&(this._minDate=t,a.isBefore(this._value,this._minDate)&&this._setValue(null))):this.minDate=new Date(a.getYear(a.subYears(new Date,100)),0,1)}parseMaxDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),a.isValid(t)&&(this._maxDate=t,a.isAfter(this._value,this._maxDate)&&this._setValue(null))):this.maxDate=this._getAutomaticMax()}parseDisabledDates(t){"string"==typeof t&&(t=JSON.parse(t)),t&&Array.isArray(t)&&(this._disabledDates=t.map((t=>"string"==typeof t?new Date(t):t)).filter((t=>a.isValid(t))),this._isDisabledDay(this._value)&&this._setValue(null))}formResetCallback(){this._setValue(null)}formDisabledCallback(t){this._internals.form&&(this.disabled=t)}componentWillLoad(){this.disabledDates&&this.parseDisabledDates(this.disabledDates),this.parseMinDate(this.minDate),this.parseMaxDate(this.maxDate),this._isMobileBrowser=r(),this.parseValue(this.value)}componentWillRender(){"day"!==this.mode&&this.format===this._defaultFormats.day&&(this.format=this._defaultFormats[this.mode])}render(){return s("p-dropdown",{key:"9bd033bcc9c678b922d2708f0115359a10eda050",allowOverflow:!0,applyFullWidth:!1,applyMaxWidth:!1,disableTriggerClick:!0,insideClick:!0,isDatepicker:!0,placement:this.placement,show:this._showDropdown,strategy:this.strategy},s("p-field",{key:"9954ad569303d1c301e9e23c11ddc8667ed5885b",autoShowError:!1,disabled:o(this.disabled),error:this.error,focused:this._showDropdown,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,icon:this.hideIconWhenFilled&&this._value?null:"calendar-multi",iconPosition:"start",label:this.label,loading:this.loading,placeholder:this.placeholder,prefix:this.prefix,required:o(this.required),showOptional:o(this.showOptional),size:this.size,slot:"trigger",value:this._getFormattedDate(),onBlur:t=>this._onBlur(t),onFocus:()=>this._onFocus(),onInputRefChange:t=>this._inputRef=t.detail,onValueChange:t=>this._onValueChange(t.detail)}),this.enableNativePicker&&this._isMobileBrowser&&s("input",{key:"910da60dd3e8493be39af5153ec17fcaa712d547",class:"\n pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden\n opacity-0\n ",max:this.maxDate&&a.format(new Date(this.maxDate),"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),min:this._minDate&&a.format(new Date(this._minDate),"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),ref:t=>this._dateInputRef=t,slot:"trigger",type:"day"===this.mode?"date":"month",value:this._value&&a.format(this._value,"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),onInput:t=>this._onNativeInput(t)}),s("div",{key:"dbc9708700e9da87b6eaed0074b2c0874af1273e",slot:"items",tabIndex:-1},s("p-calendar",{key:"f209ed8fb397826f9d17f1d635e815418335903c",disableWeekends:this.disableWeekends,disabledDates:this.disabledDates,enableToday:this.enableToday,maxDate:this.maxDate,minDate:this.minDate,mode:this.mode,preselectToday:this.preselectToday,todayText:this.todayText,value:this._value,variant:"embedded",onValueChange:({detail:t})=>this.value=t})))}documentClickHandler({target:t}){this._showDropdown&&!n(t,this._el)&&(this._showDropdown=!1)}_onFocus(){if(this._isMobileBrowser&&this._dateInputRef)return this._dateInputRef.focus(),this._dateInputRef.showPicker(),void this._inputRef.blur();this._showDropdown=!0}_onBlur(t,e){if(e=e||this.format,this._isMobileBrowser&&this._dateInputRef)return;t.relatedTarget&&!n(t.relatedTarget,this._el)&&(this._showDropdown=!1);const i=this._inputRef;if(null===i.value)return;const s=a.parse(i.value,e,new Date,{locale:"nl"===l.locale?h.nl:h.enUS});if(s===this._value)return;const r=a.isValid(s);if(!r&&e===this.format&&"day"===this.mode)return this._onBlur(t,this._defaultFormats.dayNoDashes);r&&!this._isDisabledDay(s)?this._setValue(s,!1):i.value=this._getFormattedDate()}_onValueChange(t,e=this.format){this._onInputTimeout&&(clearTimeout(this._onInputTimeout),this._onInputTimeout=null),this._onInputTimeout=setTimeout((()=>{if(0===t.length){if(null===this._value)return;return void this._setValue(null)}const i=a.parse(t,e,new Date);a.isValid(i)&&a.format(i,e,{locale:"nl"===l.locale?h.nl:h.enUS})===t?this._setValue(i,!1):"day"===this.mode&&this._onValueChange(t,this._defaultFormats.dayNoDashes)}),300)}_onNativeInput(t){t.target&&(this._onInputTimeout&&(clearTimeout(this._onInputTimeout),this._onInputTimeout=null),this._onInputTimeout=setTimeout((()=>{this._setValue(""===t.target.value?null:new Date(t.target.value),!1)})))}_setValue(t,e=!0){if(null===t)return this._value=null,void this.valueChange.emit(null);a.isValid(t)&&(this._isDisabledDay(t)?this._dateInputRef?.value&&(this._dateInputRef.value=this._value?a.format(this._value,"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}):null):(t="day"===this.mode?a.startOfDay(t):"month"===this.mode?a.startOfMonth(t):a.startOfYear(t),a.isSameDay(t,this._value)||(e&&(this._showDropdown=!1),this._value=t,this.valueChange.emit(t))))}_isDisabledDay(t){return this.disableWeekends&&a.isWeekend(t)||a.isBefore(t,this._minDate)&&!a.isSameDay(t,this._minDate)||a.isAfter(t,this._maxDate)&&!a.isSameDay(t,this._maxDate)||this._disabledDates.some((e=>a.isSameDay(e,t)))}_getFormattedDate(){return this._value?a.format(this._value,this.format,{locale:"nl"===l.locale?h.nl:h.enUS}):""}_getAutomaticMax(){const t=a.addYears(new Date,50);let e=a.getYear(t);return e=10*Math.ceil(e/10),a.setYear(t,e)}static get formAssociated(){return!0}static get watchers(){return{value:[{parseValue:0}],minDate:[{parseMinDate:0}],maxDate:[{parseMaxDate:0}],disabledDates:[{parseDisabledDates:0}]}}};d.style="*{box-sizing:border-box}.pointer-events-none{pointer-events:none}.static{position:static}.absolute{position:absolute}.left-0{left:0}.top-0{top:0}.z-\\[-10\\]{z-index:-10}.overflow-hidden{overflow:hidden}.opacity-0{opacity:0}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{d as p_datepicker}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,h as r}from"./p-yFtRjnrU.js";import{c as a}from"./p-CBWjHURv.js";import{d as i,l as s}from"./p-B_lDCj8j.js";import{T as o}from"./p-CSySY6aC.js";import{s as h}from"./p-6XOzWrsN.js";import{c as n}from"./p-xs4N_Y-0.js";import"./p-ChV9xqsO.js";const d=a(["flex w-[17.5rem] flex-col gap-4"],{variants:{variant:{default:["rounded-lg p-2 drop-shadow-2","border border-storm-100"],embedded:"p-1"}}}),c=a(["flex items-center gap-2","w-full rounded-lg p-2","\n bg-off-white-300\n dark:bg-white/15\n "],{variants:{type:{day:"justify-between",month:"justify-between",year:"justify-center"}}}),l=a(["flex flex-col gap-2","w-full"],{variants:{view:{day:"h-auto min-h-[12rem]",month:"min-h-[15rem]",year:"max-h-[15rem]"}}}),m=class{constructor(r){t(this,r),this.valueChange=e(this,"valueChange",3)}variant="default";value;preselectToday=!1;disabledDates;minDate=null;maxDate=null;disableWeekends=!1;enableToday=!0;todayText="today";mode="day";valueChange;_today=new Date;_view=this.mode;_viewDate=this._today;_value;_minDate;_maxDate;_disabledDates=[];_enableToday=!0;_weekDays=[...Array.from({length:7}).keys()];_yearItemsRef;componentWillLoad(){this.disabledDates&&this._parseDisabledDates(this.disabledDates),this._parseMinDate(this.minDate),this._parseMaxDate(this.maxDate),this._parseValue(this.value),this._value&&(this._viewDate=this._value),i.isBefore(this._viewDate,this._minDate)&&(this._viewDate=this._minDate),i.isAfter(this._viewDate,this._maxDate)&&(this._viewDate=this._maxDate),this._modeChange(this.mode)}componentWillRender(){this._enableToday=this.enableToday&&this._checkTodayButton()}componentDidRender(){"year"===this._view&&this._scrollYearIntoView()}_parseValue(t){!t&&this.preselectToday&&(t=new Date),"string"==typeof t&&(t=new Date(t)),i.isValid(t)&&!i.isSameDay(t,this._viewDate)&&(this._viewDate=t),this._setValue(t)}_parseMinDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),i.isValid(t)&&(this._minDate=t,i.isBefore(this._viewDate,this._minDate)&&(this._viewDate=this._minDate))):this.minDate=new Date(i.getYear(i.subYears(new Date,100)),0,1)}_parseMaxDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),i.isValid(t)&&(this._maxDate=t,i.isAfter(this._viewDate,this._maxDate)&&(this._viewDate=this._maxDate))):this.maxDate=this._getAutomaticMax()}_parseDisabledDates(t){"string"==typeof t&&(t=JSON.parse(t)),t&&Array.isArray(t)&&(this._disabledDates=t.map((t=>"string"==typeof t?new Date(t):t)).filter((t=>i.isValid(t))))}_modeChange(t){"year"===t&&"year"!==this._view&&(this._view="year"),"month"===t&&"day"===this._view&&(this._view="month")}render(){return r(o,{key:"396e1c7059b24d8aec57317d839f448be1e37f26"},r("div",{key:"9030d30aa2fbd06919ec711c01f135ef35c5d7f6",class:d({variant:this.variant})},this._getView()))}_checkTodayButton(){return!(this._maxDate&&i.isAfter(this._today,this._maxDate)||this._minDate&&i.isBefore(this._today,this._minDate)||this.disableWeekends&&i.isWeekend(this._today)||"day"!==this.mode)}_getView(){return"year"===this._view?this._getYearView():"month"===this._view?this._getMonthView():this._getDayView()}_getDayView(){const t=this._generateDaysInMonth();return r("div",{class:l({view:"day"})},this._getHeader("day"),r("div",{class:"grid grid-cols-7 justify-between gap-1"},this._weekDays.map((t=>r("span",{class:"w-8 text-center text-xs text-storm-200"},i.format(i.addDays(new Date(2022,7,1),t),"nl"===h.locale?"EEEEEE":"eee",{locale:"nl"===h.locale?s.nl:s.enUS})))),t.map((t=>t.active?r("p-button",{class:n("w-8",`\n col-start-${t.offset}\n `),tabIndex:-1,variant:"primary",onClick:()=>this._setValue(t.date)},t.day):r("time",{class:n("normal flex items-center justify-center rounded-lg","h-8 w-8 text-sm font-semibold","text-storm-300","dark:bg-white/15",{"cursor-pointer hover:bg-white-600 hover:text-storm-500 dark:text-white dark:hover:bg-hurricane-300 dark:hover:text-white":!t.disabled,"dark:text-hurricane-200":t.disabled},`\n col-start-${t.offset}\n `,{"cursor-not-allowed opacity-60":t.disabled},{"border border-solid border-off-white-700 bg-off-white-300 text-storm-500 dark:border-none dark:bg-hurricane-200 dark:text-white":!t.disabled&&i.isSameDay(t.date,new Date)}),onClick:()=>this._setValue(t.date)},t.day)))))}_getMonthView(){const t=this._generateMonths();return r("div",{class:l({view:"month"})},this._getHeader("month"),r("div",{class:"flex flex-wrap items-start gap-2"},t.map((t=>r("p-button",{disabled:t.disabled,tabIndex:-1,variant:t.active?"primary":"secondary",onClick:()=>this._setMonth(t.month)},i.format(i.setMonth(new Date,t.month),"MMMM",{locale:"nl"===h.locale?s.nl:s.enUS}))))))}_getYearView(){const t=this._generateYears();return r("div",{class:l({view:"year"})},this._getHeader("year"),r("div",{class:"grid h-full grid-cols-4 gap-2 overflow-scroll",ref:t=>this._yearItemsRef=t},t.map((t=>r("p-button",{class:"w-full","data-active":t.active,"data-current":t.current,tabIndex:-1,variant:t.active?"primary":"secondary",onClick:()=>this._setYear(t.year)},t.year)))))}_getHeader(t="day"){let e=t=>this._changeMonth(t),a="month";return"month"!==t&&"year"!==t||(e=t=>this._changeYear(t),a="year"),r("div",{class:c({type:this.mode})},"year"!==this.mode&&r("p-button",{disabled:!this._canSetAmount(a,-1)||"year"===this._view,icon:"caret",iconRotate:90,size:"sm",tabIndex:-1,variant:"secondary",iconOnly:!0,onClick:()=>e(-1)}),r("div",{class:n("flex gap-2",{"flex-1":this._enableToday})},"year"!==this.mode&&r("p-button",{active:"month"===this._view&&"month"!==this.mode,disabled:!this._canChangeView("month"),size:"sm",tabIndex:-1,variant:"secondary",onClick:()=>this._changeView("month")},i.format(this._viewDate,"MMMM",{locale:"nl"===h.locale?s.nl:s.enUS})),r("p-button",{active:"year"===this._view&&"year"!==this.mode,disabled:!this._canChangeView("year"),size:"sm",tabIndex:-1,variant:"secondary",onClick:()=>this._changeView("year")},i.getYear(this._viewDate)),this._enableToday&&r("p-tooltip",{class:"ml-auto",content:this.todayText},r("p-button",{icon:"calendar",iconOnly:!0,size:"sm",slot:"trigger",tabIndex:-1,variant:"secondary",onClick:()=>this._setToday()}))),"year"!==this.mode&&r("p-button",{disabled:!this._canSetAmount(a,1)||"year"==this._view,icon:"caret",iconRotate:-90,size:"sm",tabIndex:-1,variant:"secondary",iconOnly:!0,onClick:()=>e(1)}))}_setYear(t){const e=i.setYear(this._viewDate,t);if("year"!==this.mode)return this._viewDate=e,void(this._view="month");this._viewDate=e,this._setValue(i.setMonth(i.setDate(e,1),0))}_setMonth(t){const e=i.setMonth(this._viewDate,t);if("day"===this.mode)return this._viewDate=e,void(this._view="day");this._viewDate=e,this._setValue(i.setDate(e,1))}_setToday(){this._viewDate=this._today,this._setValue(this._today),this._view="day"}_changeMonth(t=1){if(!this._canSetAmount("month",t))return;const e=i.addMonths(this._viewDate,t);this._viewDate=e}_changeYear(t=1){if(!this._canSetAmount("year",t))return;let e=i.addYears(this._viewDate,t);this._viewDate=e}_setValue(t){if(null===t)return this._value=null,void this.valueChange.emit(null);i.isValid(t)&&(this._isDisabledDay(t)||(t=i.startOfDay(t),i.isSameDay(t,this._value)||(this._value=t,this.valueChange.emit(t))))}_generateDaysInMonth(){return[...new Array(i.getDaysInMonth(this._viewDate)).keys()].map((t=>{const e=i.startOfDay(i.setDate(this._viewDate,t+=1)),r=i.getDay(e);return{day:t,date:e,offset:1===t&&(0===r?7:r),current:i.isSameDay(e,this._today),active:i.isSameDay(e,this._value),disabled:this._isDisabledDay(e)}}))}_isDisabledDay(t){return i.isBefore(t,this._minDate)&&!i.isSameDay(t,this._maxDate)||i.isAfter(t,this._maxDate)&&!i.isSameDay(t,this._maxDate)||(0===i.getDay(t)||6===i.getDay(t))&&this.disableWeekends||this._disabledDates.some((e=>i.isSameDay(e,t)))}_generateMonths(){const t=i.getYear(this._viewDate);return[...Array.from({length:12}).keys()].map((e=>{const r=new Date(t,e,1);return{month:e,current:i.isSameMonth(this._today,r),active:i.isSameMonth(this._value,r),disabled:i.isAfter(r,this._maxDate)||i.isBefore(i.endOfMonth(r),this._minDate)}}))}_generateYears(){const t=i.getYear(this._maxDate)+1,e=i.getYear(this._minDate);return[...new Array(t-e).keys()].map((t=>{const r=e+t;return{year:r,current:i.getYear(this._today)===r,active:i.getYear(this._value)===r}}))}_scrollYearIntoView(){const t=this._yearItemsRef;if(!t)return;const e=t.querySelector("p-button[data-active]");if(e)return t.scrollTo({top:e.offsetTop-100});const r=t.querySelector("p-button[data-current]");return r?t.scrollTo({top:r.offsetTop-100}):void 0}_changeView(t){this._canChangeView(t)&&(this._view=t)}_canChangeView(t){return"year"===t?!i.isSameYear(this._minDate,this._maxDate):!i.isSameMonth(this._minDate,this._maxDate)}_canSetAmount(t,e=1){if("month"===t){const t=i.addMonths(this._viewDate,e),r=i.startOfMonth(t);if(i.isBefore(r,i.startOfMonth(this._minDate))&&!i.isSameDay(r,this._minDate)||i.isAfter(r,i.endOfMonth(this._maxDate)))return!1}if("year"===t){let t=i.addYears(this._viewDate,e);const r=i.getYear(t);if(r<i.getYear(this._minDate)||r>i.getYear(this._maxDate))return!1}return!0}_getAutomaticMax(){const t=i.addYears(new Date,50);let e=i.getYear(t);return e=10*Math.ceil(e/10),i.setYear(t,e)}static get watchers(){return{value:[{_parseValue:0}],minDate:[{_parseMinDate:0}],maxDate:[{_parseMaxDate:0}],disabledDates:[{_parseDisabledDates:0}],mode:[{_modeChange:0}]}}};m.style="*{box-sizing:border-box}.static{position:static}.col-start-1{grid-column-start:1}.col-start-2{grid-column-start:2}.col-start-3{grid-column-start:3}.col-start-4{grid-column-start:4}.col-start-5{grid-column-start:5}.col-start-6{grid-column-start:6}.col-start-7{grid-column-start:7}.ml-auto{margin-left:auto}.flex{display:flex}.grid{display:grid}.h-8{height:2rem}.h-auto{height:auto}.h-full{height:100%}.max-h-\\[15rem\\]{max-height:15rem}.min-h-\\[12rem\\]{min-height:12rem}.min-h-\\[15rem\\]{min-height:15rem}.w-8{width:2rem}.w-\\[17\\.5rem\\]{width:17.5rem}.w-full{width:100%}.flex-1{flex:1 1 0%}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.overflow-scroll{overflow:scroll}.rounded-lg{border-radius:.5rem}.border{border-width:1px}.border-solid{border-style:solid}.border-off-white-700{--tw-border-opacity:1;border-color:rgb(222 219 213/var(--tw-border-opacity,1))}.border-storm-100{--tw-border-opacity:1;border-color:rgb(209 210 212/var(--tw-border-opacity,1))}.bg-off-white-300{--tw-bg-opacity:1;background-color:rgb(248 247 244/var(--tw-bg-opacity,1))}.p-1{padding:.25rem}.p-2{padding:.5rem}.text-center{text-align:center}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-hurricane-200,.text-storm-200{--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-500{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.opacity-60{opacity:.6}.drop-shadow-2{--tw-drop-shadow:drop-shadow(0 1px 1px rgba(0,2,2,.04)) drop-shadow(0 2px 2px rgba(0,2,2,.04)) drop-shadow(0 4px 4px rgba(0,2,2,.04))}.drop-shadow-2,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.hover\\:bg-white-600:hover{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.hover\\:text-storm-500:hover{--tw-text-opacity:1;color:rgb(24 30 41/var(--tw-text-opacity,1))}.dark\\:border-none:where(:host([data-theme=dark]),:host([data-theme=dark]) *){border-style:none}.dark\\:bg-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-bg-opacity:1;background-color:rgb(163 165 169/var(--tw-bg-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:hover\\:bg-hurricane-300:hover:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-bg-opacity:1;background-color:rgb(116 120 127/var(--tw-bg-opacity,1))}.dark\\:hover\\:text-white:hover:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:border-none:where([data-theme=dark],[data-theme=dark] *){border-style:none}.dark\\:bg-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-bg-opacity:1;background-color:rgb(163 165 169/var(--tw-bg-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:hover\\:bg-hurricane-300:hover:where([data-theme=dark],[data-theme=dark] *){--tw-bg-opacity:1;background-color:rgb(116 120 127/var(--tw-bg-opacity,1))}.dark\\:hover\\:text-white:hover:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{m as p_calendar}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s,F as r}from"./p-yFtRjnrU.js";import{c as a}from"./p-CBWjHURv.js";import{T as h}from"./p-CSySY6aC.js";import{a as o}from"./p-TyZ7uPES.js";import{c as n}from"./p-xs4N_Y-0.js";import{S as l}from"./p-CEaB2BT0.js";import"./p-ChV9xqsO.js";import"./p-6XOzWrsN.js";const d=a(["flex items-center gap-2","h-full min-w-0 flex-1","pointer-events-none overflow-hidden"]),c=a(["item group/item","pointer-events-auto cursor-pointer","flex h-[1.625rem] items-center gap-2","h-[1.625rem] px-2","whitespace-nowrap text-sm font-semibold","rounded-lg","bg-indigo-100","dark:bg-white/15"]),p=a("block w-full overflow-hidden text-start",{variants:{variant:{placeholder:"\n text-storm-400\n dark:text-white\n ",default:null},enableTextWrap:{true:!1,false:"text-ellipsis whitespace-nowrap"},error:{true:"\n text-negative-red-700\n group-hover/button:text-negative-red-800\n dark:text-negative-red-alternative\n ",false:null}}}),m=class{constructor(i){t(this,i),this.queryChange=e(this,"queryChange",3),this.valueChange=e(this,"valueChange",3),this.selectAllChange=e(this,"selectAllChange",3),this.dropdownShown=e(this,"dropdownShown",3),this.add=e(this,"add",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}items;multi;strategy="absolute";icon;query;placeholder;autocompletePlaceholder="Search...";value;displayKey="text";dropdownDisplayKey;selectionDisplayKey;valueKey;avatarKey;iconKey="icon";iconClassKey="iconClass";showIconOnSelectedItem;classKey="class";applyClassOnSelectedItem;applyClassOnSelectedItemInMenu;avatarLettersKey;identifierKey;queryKey;autoSelectFirst=!0;showChevron=!0;maxDisplayedItems=l;enableAutocomplete=!0;enableTextWrap=!1;asyncFilter=!1;loading=!1;enableSelectAll=!1;selectAllText="Select all";selectAllIcon;queryChange;valueChange;selectAllChange;dropdownShown;size="base";prefix;label;helper;required=!0;showOptional=!0;error;disabled=!1;showAddItem=!1;addItemText="Add item";add;emptyStateText="No items available";get _el(){return i(this)}_showDropdown=!1;_selectedItem=null;_allSelected=!1;_amountHidden=0;_internals;_inputRef;autocompleteInputRef;_multiContainerRef;_resizeObserver;_resizeDebounceTimer;_checkSelectedItemsTimeout;get _items(){return this._getParsedItems()}get _displayValue(){const t=s("div",{class:p({variant:"placeholder"})},this.placeholder);return this._selectedItem?this.multi?0===this._selectedItem?.length?t:s("div",{class:d(),ref:t=>this._multiContainerRef=t},this._selectedItem.map((t=>s("div",{class:c(),onClick:()=>this._selectValue(t)},t[this.selectionDisplayKey??this.displayKey],s("p-icon",{class:"\n text-xs text-indigo-500\n group-hover/item:text-indigo-800\n dark:text-white/15\n dark:group-hover/item:text-white\n ",variant:"negative"})))),s("div",{class:"extra pointer-events-none hidden text-sm text-storm-100"},"+",this._amountHidden)):this._getDisplay(this._selectedItem,!0):t}get _identifierKey(){return this.identifierKey??this.valueKey??"value"}formResetCallback(){this._selectValue(null)}componentDidLoad(){if(!this.valueKey&&!this.identifierKey)throw new Error("You must provide a valueKey or identifierKey");this.multi&&(this._setMultiContainerMaxWidth(),this._resizeObserver=new ResizeObserver((()=>{this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._resizeDebounceTimer=setTimeout((()=>{this._setMultiContainerMaxWidth(),this._setCheckSelectedItemsTimeout()}),200)})),this._resizeObserver.observe(this._el)),this.value?this._valueChange():this.itemChanges()}componentDidRender(){this.multi&&this._setMultiContainerMaxWidth()}disconnectedCallback(){this.multi&&this._resizeObserver.disconnect()}render(){let t=this.icon;return this._selectedItem&&!this.avatarKey&&this.iconKey&&this._selectedItem?.[this.iconKey]&&!this.showIconOnSelectedItem&&(t=this._selectedItem[this.iconKey]),(this.avatarKey&&this._selectedItem?.[this.avatarKey]||this.avatarLettersKey&&this._selectedItem?.[this.avatarLettersKey])&&(t=null),this.error?.length&&(t="warning"),s(h,{key:"b7c7d91e9c103eb283a19e6d61bd8a1ccdfcb1ae"},s("p-field-container",{key:"ce39c71781d71950eb8f0ec439e70508a801d4bd",error:this.error,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,label:this.label,prefix:this.prefix,required:this.required,showOptional:this.showOptional,variant:"write"},s("p-dropdown",{key:"172741cbe636fa4b59cbac4445fdff1c8ade7ca7",applyChevron:!1,applyFullWidth:!0,applyMaxWidth:!1,"disable-trigger-click":this.disabled,insideClick:!0,manual:!0,manualChevron:!0,scrollable:!this.enableAutocomplete||"large",show:this._showDropdown,slot:"content",strategy:this.strategy,onIsOpen:t=>this._onDropdownOpen(t)},s("p-button",{key:"9fda8191122e870eda211c58b30a6de022b629eb",active:this._showDropdown,chevron:!!this.showChevron&&(this._showDropdown?"up":"down"),class:"w-full",error:!!this.error?.length,icon:t,iconClass:this.applyClassOnSelectedItem&&this._selectedItem?.[this.iconClassKey],size:this.size,slot:"trigger",variant:"secondary",onClick:t=>this._onClick(t)},s("div",{key:"1d08bb324241e1db8698678be35a1fd57f00603f",class:"relative min-w-0 flex-1",ref:t=>this._inputRef=t},this._displayValue)),this.loading?this._getLoadingItems():this._getItems(),this.showAddItem&&this._getAddItem())))}documentClickHandler(t){this._showDropdown&&!o(t,this._el)&&(this._showDropdown=!1)}_valueChange(){setTimeout((()=>{this._preselectItem(),this._setCheckSelectedItemsTimeout()}))}itemChanges(){setTimeout((()=>this._preselectItem()))}_showDropdownChanges(){this.dropdownShown.emit({value:this._showDropdown,query:this.query})}multiChanges(){this._selectedItem&&!Array.isArray(this._selectedItem)&&(this._selectedItem=[])}_preselectItem(){let t="string"==typeof this.value&&this.multi?JSON.parse(this.value):this.value;if(this.multi)return Array.isArray(t)?(this.value=t,0===t.length?void(this._selectedItem=[]):void(this._selectedItem=this.valueKey&&"false"!==this.valueKey?this._items.filter((e=>t.includes(e?.[this.valueKey]))):[...t])):(this.value=[],void this.valueChange.emit(this.value));this._selectedItem||t||!this.autoSelectFirst||(t=this._items[0]);const e="object"==typeof t&&null!==t?t[this._identifierKey]:t,i="string"==typeof e||"number"==typeof e?e:JSON.stringify(e),s=this._selectedItem?this._selectedItem?.[this._identifierKey]:null,r="string"==typeof s||"number"==typeof s?s:JSON.stringify(s);if(this._selectedItem&&r===i)return;if(!this._items?.length&&t)return void this._selectValue(t,!1);const a=this._getParsedItems(!1).find((t=>{const e=t?.[this._identifierKey];return("string"==typeof e||"number"==typeof e?e:JSON.stringify(e))===i}));this._selectValue(a??t,!1)}_selectValue(t,e=!0){let i=this.valueKey&&"false"!==this.valueKey&&null!==t&&!this.loading?t?.[this.valueKey]:t;if(this.multi){this._selectedItem&&Array.isArray(this._selectedItem)||(this._selectedItem=[]),this.value&&Array.isArray(this.value)||(this.value=[]);const e=[...this._selectedItem],s=[...this.value],r=e.findIndex((e=>e[this._identifierKey]===t[this._identifierKey]));return-1===r?(e.push(t),s.push(i)):(e.splice(r,1),s.splice(r,1)),this._selectedItem=e,this.value=s,void this.valueChange.emit(s)}this._selectedItem=t,this._onBlur(e),i!==this.value&&(this.value=i,this.valueChange.emit(i))}_onClick(t){const e=t?.composedPath();for(const t of e){if("p-button"===t.nodeName.toLowerCase())break;if(t.classList?.contains("item"))return}this._showDropdown=!this._showDropdown}_onBlur(t=!1){this.enableAutocomplete&&!t||(this._showDropdown=!1)}_onAutoComplete(t){this.enableAutocomplete&&(this._showDropdown=!0,this.query=t.detail,this.queryChange.emit(t.detail))}_checkvalue(t,e){return e?.[t]?.toString()?.toLowerCase().indexOf(this.query?.toLowerCase())>=0}_getItems(){let t=this._items.map((t=>{const e=this.multi&&this._selectedItem&&Array.isArray(this._selectedItem)?this._selectedItem.some((e=>e[this._identifierKey]===t[this._identifierKey])):t[this._identifierKey]===this._selectedItem?.[this._identifierKey];return s("p-dropdown-menu-item",{active:e,checkbox:!!this.multi,enableTextWrap:this.enableTextWrap,slot:"items",useContainer:!1,onClick:()=>this._selectValue(t)},this._getDisplay(t,!1,e))}));return 0!==this._items.length||this.showAddItem||(t=[s("p",{class:"\n w-full p-2 text-center text-sm text-storm-400\n dark:text-hurricane-200\n ",slot:"items"},this.emptyStateText)]),this.enableSelectAll&&this._items.length>0&&t.unshift(s("p-dropdown-menu-item",{active:this._allSelected,slot:"items",useContainer:!1,checkbox:!0,onClick:()=>this._selectAllChange()},this.selectAllIcon?.length?s("span",{class:"flex items-center gap-2"},s("div",{class:"flex w-6 justify-center text-lg"},s("p-icon",{variant:this.selectAllIcon}))," ",this.selectAllText):this.selectAllText)),this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAddItem(){return s(r,null,this._items.length>0&&s("p-divider",{class:"my-1 px-2",slot:"items"}),s("p-dropdown-menu-item",{slot:"items",useContainer:!1,onClick:()=>this.add.emit()},s("span",{class:"flex items-center gap-1 font-semibold text-indigo-600"},this.addItemText,s("p-icon",{variant:"plus"}))))}_getLoadingItems(){const t=[0,0,0].map((()=>s("p-dropdown-menu-item",{enableHover:!1,slot:"items"},s("p-loader",{class:"h-6 w-full rounded",variant:"ghost"}))));return this.enableAutocomplete&&t.unshift(this._getAutoCompleteItem()),t}_getAutoCompleteItem(){return s("div",{class:"sticky top-0 z-10 mb-3 h-8",slot:"items"},s("p-field",{class:"block",placeholder:this.autocompletePlaceholder,value:this.query,onInputRefChange:t=>this.autocompleteInputRef=t.detail,onValueChange:t=>this._onAutoComplete(t)}))}_setMultiContainerMaxWidth(){this._inputRef&&this._multiContainerRef&&(this._multiContainerRef.style.maxWidth=`${Math.max(this._inputRef.clientWidth-16,16)}px`)}_setCheckSelectedItemsTimeout(){this._checkSelectedItemsTimeout&&clearTimeout(this._checkSelectedItemsTimeout),this._checkSelectedItemsTimeout=setTimeout((()=>this._checkSelectedItems()),50)}_checkSelectedItems(){if(!this._multiContainerRef)return;const t=this._multiContainerRef.getBoundingClientRect(),e=this._multiContainerRef.querySelectorAll(".item");let i=0;for(const s of e)s.classList.remove("hidden"),s.classList.add("flex"),s.getBoundingClientRect().right>t.right&&(s.classList.remove("flex"),s.classList.add("hidden"),i++);this._amountHidden=i;const s=this._multiContainerRef.querySelector(".extra");s&&(s.classList.contains("hidden")||s.classList.add("hidden"),i>0&&s.classList.remove("hidden"))}_onDropdownOpen(t){t.detail&&this.autocompleteInputRef&&setTimeout((()=>this.autocompleteInputRef.focus()),100)}_selectAllChange(){this._allSelected=!this._allSelected,this.selectAllChange.emit(this._allSelected)}_getDisplay(t,e=!1,i=!1){let r=s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[e?this.selectionDisplayKey??this.displayKey:this.displayKey]);return this.avatarKey&&(r=s("span",{class:"flex items-center gap-2"},s("p-avatar",{letters:t[this.avatarLettersKey],size:"sm",src:t[this.avatarKey]}),s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),!this.iconKey||e&&!this.showIconOnSelectedItem||(r=s("span",{class:"flex items-center gap-2"},t[this.iconKey]&&s("p-icon",{class:n("\n text-storm-300\n dark:text-hurricane-200\n ",e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu?"":t?.[this.iconClassKey]??""),variant:t[this.iconKey]}),s("div",{class:p({variant:"default",error:!!this.error?.length,enableTextWrap:this.enableTextWrap&&!e})},t[this.dropdownDisplayKey??this.displayKey]))),e&&!this.applyClassOnSelectedItem||i&&!this.applyClassOnSelectedItemInMenu||!t?.[this.classKey]?.length?r:s("div",{class:t[this.classKey]},r)}_getParsedItems(t=!0){if(!this.items||this.loading)return[];let e="string"==typeof this.items?JSON.parse(this.items):this.items;return"string"==typeof e?.[0]&&(this.displayKey="text",this.valueKey="value",e=e.map((t=>({value:t,text:t})))),this.query?.length&&!this.asyncFilter&&(e=e.filter((t=>this.queryKey?this._checkvalue(this.queryKey,t):this._checkvalue(this._identifierKey,t)||this._checkvalue(this.displayKey,t)))),t?e?.slice(0,this.maxDisplayedItems):e}static get formAssociated(){return!0}static get watchers(){return{value:[{_valueChange:0}],items:[{itemChanges:0}],_showDropdown:[{_showDropdownChanges:0}],multi:[{multiChanges:0}]}}};m.style="*{box-sizing:border-box}:host{--tw-translate-y:0px!important;--tw-translate-x:0px!important}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.static{position:static}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:0}.z-10{z-index:10}.my-1{margin-bottom:.25rem;margin-top:.25rem}.mb-3{margin-bottom:.75rem}.block{display:block}.flex{display:flex}.hidden{display:none}.h-6{height:1.5rem}.h-8{height:2rem}.h-\\[1\\.625rem\\]{height:1.625rem}.h-full{height:100%}.w-6{width:1.5rem}.w-full{width:100%}.min-w-0{min-width:0}.flex-1{flex:1 1 0%}.cursor-pointer{cursor:pointer}.items-center{align-items:center}.justify-center{justify-content:center}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.overflow-hidden{overflow:hidden}.text-ellipsis{text-overflow:ellipsis}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-lg{border-radius:.5rem}.bg-indigo-100{--tw-bg-opacity:1;background-color:rgb(227 236 254/var(--tw-bg-opacity,1))}.p-2{padding:.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.text-center{text-align:center}.text-start{text-align:start}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-semibold{font-weight:600}.text-indigo-500{--tw-text-opacity:1;color:rgb(142 179 251/var(--tw-text-opacity,1))}.text-indigo-600{--tw-text-opacity:1;color:rgb(82 138 250/var(--tw-text-opacity,1))}.text-negative-red-700{--tw-text-opacity:1;color:rgb(147 16 16/var(--tw-text-opacity,1))}.text-storm-100{--tw-text-opacity:1;color:rgb(209 210 212/var(--tw-text-opacity,1))}.text-storm-300{--tw-text-opacity:1;color:rgb(116 120 127/var(--tw-text-opacity,1))}.text-storm-400{--tw-text-opacity:1;color:rgb(70 75 84/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.group\\/button:hover .group-hover\\/button\\:text-negative-red-800{--tw-text-opacity:1;color:rgb(141 16 16/var(--tw-text-opacity,1))}.group\\/item:hover .group-hover\\/item\\:text-indigo-800{--tw-text-opacity:1;color:rgb(27 88 210/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where(:host([data-theme=dark]),:host([data-theme=dark]) *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where(:host([data-theme=dark]),:host([data-theme=dark]) *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:bg-white\\/15:where([data-theme=dark],[data-theme=dark] *){background-color:hsla(0,0%,100%,.15)}.dark\\:text-hurricane-200:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(163 165 169/var(--tw-text-opacity,1))}.dark\\:text-negative-red-alternative:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 92 92/var(--tw-text-opacity,1))}.dark\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.dark\\:text-white\\/15:where([data-theme=dark],[data-theme=dark] *){color:hsla(0,0%,100%,.15)}.group\\/item:hover .dark\\:group-hover\\/item\\:text-white:where([data-theme=dark],[data-theme=dark] *){--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}";export{m as p_select}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,a as e,d as i,h as s}from"./p-yFtRjnrU.js";import{d as a,l as h}from"./p-B_lDCj8j.js";import{s as l}from"./p-6XOzWrsN.js";import{c as n}from"./p-TyZ7uPES.js";import{i as r}from"./p-DPc49L2n.js";import{a as o}from"./p-C5CTp9IA.js";const d=class{constructor(i){t(this,i),this.valueChange=e(this,"valueChange",3),i.$hostElement$["s-ei"]?this._internals=i.$hostElement$["s-ei"]:(this._internals=i.$hostElement$.attachInternals(),i.$hostElement$["s-ei"]=this._internals)}placeholder;value;preselectToday=!1;enableNativePicker=!0;disabledDates;minDate=null;maxDate=null;disableWeekends=!1;enableToday=!0;todayText="today";mode="day";valueChange;format="dd-MM-yyyy";hideIconWhenFilled=!1;size="base";prefix;label;loading=!1;helper;required;showOptional=!0;error;disabled=!1;strategy="absolute";placement="bottom-start";get _el(){return i(this)}_showDropdown=!1;_value;_minDate;_maxDate;_disabledDates=[];_isMobileBrowser=!1;_internals;_onInputTimeout;_inputRef;_dateInputRef;_defaultFormats={year:"yyyy",month:"LLLL, yyyy",day:"dd-MM-yyyy",dayNoDashes:"ddMMyyyy"};parseValue(t){!t&&this.preselectToday&&(t=new Date),"string"==typeof t&&(t=new Date(t)),this._setValue(t)}parseMinDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),a.isValid(t)&&(this._minDate=t,a.isBefore(this._value,this._minDate)&&this._setValue(null))):this.minDate=new Date(a.getYear(a.subYears(new Date,100)),0,1)}parseMaxDate(t){null!==t&&""!==t?("string"==typeof t&&(t=new Date(t)),a.isValid(t)&&(this._maxDate=t,a.isAfter(this._value,this._maxDate)&&this._setValue(null))):this.maxDate=this._getAutomaticMax()}parseDisabledDates(t){"string"==typeof t&&(t=JSON.parse(t)),t&&Array.isArray(t)&&(this._disabledDates=t.map((t=>"string"==typeof t?new Date(t):t)).filter((t=>a.isValid(t))),this._isDisabledDay(this._value)&&this._setValue(null))}formResetCallback(){this._setValue(null)}formDisabledCallback(t){this._internals.form&&(this.disabled=t)}componentWillLoad(){this.disabledDates&&this.parseDisabledDates(this.disabledDates),this.parseMinDate(this.minDate),this.parseMaxDate(this.maxDate),this._isMobileBrowser=r(),this.parseValue(this.value)}componentWillRender(){"day"!==this.mode&&this.format===this._defaultFormats.day&&(this.format=this._defaultFormats[this.mode])}render(){return s("p-dropdown",{key:"9bd033bcc9c678b922d2708f0115359a10eda050",allowOverflow:!0,applyFullWidth:!1,applyMaxWidth:!1,disableTriggerClick:!0,insideClick:!0,isDatepicker:!0,placement:this.placement,show:this._showDropdown,strategy:this.strategy},s("p-field",{key:"9954ad569303d1c301e9e23c11ddc8667ed5885b",autoShowError:!1,disabled:o(this.disabled),error:this.error,focused:this._showDropdown,forceShowTooltip:!!this.error?.length&&!this._showDropdown,helper:this.helper,icon:this.hideIconWhenFilled&&this._value?null:"calendar-multi",iconPosition:"start",label:this.label,loading:this.loading,placeholder:this.placeholder,prefix:this.prefix,required:o(this.required),showOptional:o(this.showOptional),size:this.size,slot:"trigger",value:this._getFormattedDate(),onBlur:t=>this._onBlur(t),onFocus:()=>this._onFocus(),onInputRefChange:t=>this._inputRef=t.detail,onValueChange:t=>this._onValueChange(t.detail)}),this.enableNativePicker&&this._isMobileBrowser&&s("input",{key:"910da60dd3e8493be39af5153ec17fcaa712d547",class:"\n pointer-events-none absolute left-0 top-0 z-[-10] overflow-hidden\n opacity-0\n ",max:this.maxDate&&a.format(new Date(this.maxDate),"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),min:this._minDate&&a.format(new Date(this._minDate),"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),ref:t=>this._dateInputRef=t,slot:"trigger",type:"day"===this.mode?"date":"month",value:this._value&&a.format(this._value,"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}),onInput:t=>this._onNativeInput(t)}),s("div",{key:"dbc9708700e9da87b6eaed0074b2c0874af1273e",slot:"items",tabIndex:-1},s("p-calendar",{key:"f209ed8fb397826f9d17f1d635e815418335903c",disableWeekends:this.disableWeekends,disabledDates:this.disabledDates,enableToday:this.enableToday,maxDate:this.maxDate,minDate:this.minDate,mode:this.mode,preselectToday:this.preselectToday,todayText:this.todayText,value:this._value,variant:"embedded",onValueChange:({detail:t})=>this.value=t})))}documentClickHandler({target:t}){this._showDropdown&&!n(t,this._el)&&(this._showDropdown=!1)}_onFocus(){if(this._isMobileBrowser&&this._dateInputRef)return this._dateInputRef.focus(),this._dateInputRef.showPicker(),void this._inputRef.blur();this._showDropdown=!0}_onBlur(t,e){if(e=e||this.format,this._isMobileBrowser&&this._dateInputRef)return;t.relatedTarget&&!n(t.relatedTarget,this._el)&&(this._showDropdown=!1);const i=this._inputRef;if(null===i.value)return;const s=a.parse(i.value,e,new Date,{locale:"nl"===l.locale?h.nl:h.enUS});if(s===this._value)return;const r=a.isValid(s);if(!r&&e===this.format&&"day"===this.mode)return this._onBlur(t,this._defaultFormats.dayNoDashes);r&&!this._isDisabledDay(s)?this._setValue(s,!1):i.value=this._getFormattedDate()}_onValueChange(t,e=this.format){this._onInputTimeout&&(clearTimeout(this._onInputTimeout),this._onInputTimeout=null),this._onInputTimeout=setTimeout((()=>{if(0===t.length){if(null===this._value)return;return void this._setValue(null)}const i=a.parse(t,e,new Date);a.isValid(i)&&a.format(i,e,{locale:"nl"===l.locale?h.nl:h.enUS})===t?this._setValue(i,!1):"day"===this.mode&&this._onValueChange(t,this._defaultFormats.dayNoDashes)}),300)}_onNativeInput(t){t.target&&(this._onInputTimeout&&(clearTimeout(this._onInputTimeout),this._onInputTimeout=null),this._onInputTimeout=setTimeout((()=>{this._setValue(""===t.target.value?null:new Date(t.target.value),!1)})))}_setValue(t,e=!0){if(null===t)return this._value=null,void this.valueChange.emit(null);a.isValid(t)&&(this._isDisabledDay(t)?this._dateInputRef?.value&&(this._dateInputRef.value=this._value?a.format(this._value,"yyyy-MM-dd",{locale:"nl"===l.locale?h.nl:h.enUS}):null):(t="day"===this.mode?a.startOfDay(t):"month"===this.mode?a.startOfMonth(t):a.startOfYear(t),a.isSameDay(t,this._value)||(e&&(this._showDropdown=!1),this._value=t,this.valueChange.emit(t))))}_isDisabledDay(t){return this.disableWeekends&&a.isWeekend(t)||a.isBefore(t,this._minDate)&&!a.isSameDay(t,this._minDate)||a.isAfter(t,this._maxDate)&&!a.isSameDay(t,this._maxDate)||this._disabledDates.some((e=>a.isSameDay(e,t)))}_getFormattedDate(){return this._value?a.format(this._value,this.format,{locale:"nl"===l.locale?h.nl:h.enUS}):""}_getAutomaticMax(){const t=a.addYears(new Date,50);let e=a.getYear(t);return e=10*Math.ceil(e/10),a.setYear(t,e)}static get formAssociated(){return!0}static get watchers(){return{value:[{parseValue:0}],minDate:[{parseMinDate:0}],maxDate:[{parseMaxDate:0}],disabledDates:[{parseDisabledDates:0}]}}};d.style="*{box-sizing:border-box}.pointer-events-none{pointer-events:none}.static{position:static}.absolute{position:absolute}.left-0{left:0}.top-0{top:0}.z-\\[-10\\]{z-index:-10}.overflow-hidden{overflow:hidden}.opacity-0{opacity:0}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}";export{d as p_datepicker}
|